Commit 78850edc authored by Isaak Lim's avatar Isaak Lim
Browse files

- states of toolboxes is remembered when changing views

- not sure what causes flickering when adding toolboxes with scripts

closes #1015

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@15476 383ad7c9-94d9-4d36-a494-682f7c89f535
parent f06a7cda
......@@ -49,7 +49,6 @@
#include "SideArea.hh"
#include "SideElement.hh"
#include <OpenFlipper/common/GlobalOptions.hh>
#include <iostream>
//== IMPLEMENTATION ==========================================================
SideArea::SideArea (QWidget *_parent) :
......@@ -194,6 +193,22 @@ void SideArea::restoreState (QSettings &_settings)
//-----------------------------------------------------------------------------
void SideArea::saveViewModeState(const QString& _viewMode) {
foreach (SideElement *e, items_) {
sideElementState_[_viewMode + e->name()] = e->active();
}
}
//-----------------------------------------------------------------------------
void SideArea::restoreViewModeState(const QString& _viewMode) {
foreach (SideElement *e, items_) {
e->setActive(sideElementState_[_viewMode + e->name()]);
}
}
//-----------------------------------------------------------------------------
void SideArea::setElementActive(QString _name, bool _active)
{
for (int i=0; i < items_.count(); i++)
......
......@@ -102,9 +102,15 @@ class SideArea : public QWidget {
/// returns the current state
void saveState (QSettings &_settings);
/// saves the active state of _viewMode
void saveViewModeState(const QString& _viewMode);
/// restores the state
void restoreState (QSettings &_settings);
/// restores the active state of _viewMode
void restoreViewModeState(const QString& _viewMode);
/// set the active state of given element
void setElementActive(QString _name, bool _active);
......@@ -136,6 +142,9 @@ class SideArea : public QWidget {
// item names
QStringList itemNames_;
// saves active state of each SideElement in each view
QMap<QString, bool> sideElementState_;
// main layout
QVBoxLayout *layout_;
};
......
......@@ -57,7 +57,6 @@
#include <OpenFlipper/common/GlobalOptions.hh>
#include "SideElement.hh"
#include <iostream>
//== IMPLEMENTATION ==========================================================
......
......@@ -362,8 +362,10 @@ void CoreWidget::slotChangeView(QString _mode, QStringList _toolboxWidgets, QStr
// Remove all toolbox entries if the view has changed
if (_mode != OpenFlipper::Options::currentViewMode())
if (_mode != OpenFlipper::Options::currentViewMode()) {
toolBox_->saveViewModeState(OpenFlipper::Options::currentViewMode());
toolBox_->clear();
}
//find all widgets that should be visible
for (int i=0; i < _toolboxWidgets.size(); i++) {
......@@ -415,6 +417,9 @@ void CoreWidget::slotChangeView(QString _mode, QStringList _toolboxWidgets, QStr
}
}
if (_mode != OpenFlipper::Options::currentViewMode()) {
toolBox_->restoreViewModeState(_mode);
}
if (_expandAll)
toolBox_->expandAll();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment