Save Properties for each State of the mainWindow

Each state can have the same widgets but with different
properties - currently I'm using "enabled" : true and false
for the DiveSiteEdit, it looks like a big amount of code
for such a small thing but it was the cleaner way that
I tougth of doing.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-08-20 22:24:49 -03:00 committed by Dirk Hohndel
parent 307df53bb4
commit 0f096d0e53
2 changed files with 48 additions and 0 deletions

View file

@ -39,6 +39,9 @@ class PlannerSettingsWidget;
class QUndoStack;
class LocationInformationWidget;
typedef std::pair<QByteArray, QVariant> WidgetProperty;
typedef QVector<WidgetProperty> PropertyList;
enum MainWindowTitleFormat {
MWTF_DEFAULT,
MWTF_FILENAME
@ -89,6 +92,7 @@ public:
void printPlan();
void checkSurvey(QSettings *s);
void setApplicationState(const QByteArray& state);
void setStateProperties(const QByteArray& state, const PropertyList& tl, const PropertyList& tr, const PropertyList& bl,const PropertyList& br);
bool inPlanner();
QUndoStack *undoStack;
NotificationWidget *getNotificationWidget();
@ -225,7 +229,20 @@ private:
QWidget *bottomLeft;
QWidget *bottomRight;
};
struct PropertiesForQuadrant {
PropertiesForQuadrant(){}
PropertiesForQuadrant(const PropertyList& tl, const PropertyList& tr,const PropertyList& bl,const PropertyList& br) :
topLeft(tl), topRight(tr), bottomLeft(bl), bottomRight(br) {}
PropertyList topLeft;
PropertyList topRight;
PropertyList bottomLeft;
PropertyList bottomRight;
};
QHash<QByteArray, WidgetForQuadrant> applicationState;
QHash<QByteArray, PropertiesForQuadrant> stateProperties;
QByteArray currentApplicationState;
WindowTitleUpdate *wtu;
};