summaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/mainwindow.cpp')
-rw-r--r--qt-ui/mainwindow.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 1a12305d9..dec550389 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -119,6 +119,13 @@ MainWindow::MainWindow() : QMainWindow(),
QWidget *diveSitePictures = new QWidget(); // Placeholder
+ std::pair<QByteArray, QVariant> enabled = std::make_pair("enabled", QVariant(true));
+ std::pair<QByteArray, QVariant> disabled = std::make_pair("enabled", QVariant(false));
+ PropertyList enabledList;
+ PropertyList disabledList;
+ enabledList.push_back(enabled);
+ disabledList.push_back(disabled);
+
registerApplicationState("Default", mainTab, profileContainer, diveListView, globeGps );
registerApplicationState("AddDive", mainTab, profileContainer, diveListView, globeGps );
registerApplicationState("EditDive", mainTab, profileContainer, diveListView, globeGps );
@@ -126,6 +133,13 @@ MainWindow::MainWindow() : QMainWindow(),
registerApplicationState("EditPlannedDive", plannerWidget, profileContainer, diveListView, globeGps );
registerApplicationState("EditDiveSite", diveSiteEdit, diveSitePictures, diveListView, globeGps);
+ setStateProperties("Default", enabledList, enabledList, enabledList,enabledList);
+ setStateProperties("AddDive", enabledList, enabledList, enabledList,enabledList);
+ setStateProperties("EditDive", enabledList, enabledList, enabledList,enabledList);
+ setStateProperties("PlanDive", enabledList, enabledList, enabledList,enabledList);
+ setStateProperties("EditPlannedDive", enabledList, enabledList, enabledList,enabledList);
+ setStateProperties("EditDiveSite", enabledList, enabledList, disabledList, enabledList);
+
setApplicationState("Default");
ui.multiFilter->hide();
@@ -213,6 +227,11 @@ MainWindow::~MainWindow()
m_Instance = NULL;
}
+void MainWindow::setStateProperties(const QByteArray& state, const PropertyList& tl, const PropertyList& tr, const PropertyList& bl, const PropertyList& br)
+{
+ stateProperties[state] = PropertiesForQuadrant(tl, tr, bl, br);
+}
+
void MainWindow::on_actionDiveSiteEdit_triggered() {
setApplicationState("EditDiveSite");
}
@@ -1726,9 +1745,21 @@ void MainWindow::setApplicationState(const QByteArray& state) {
}
SET_CURRENT_INDEX( topLeft )
+ Q_FOREACH(const WidgetProperty& p, stateProperties[state].topLeft) {
+ ui.topLeft->currentWidget()->setProperty( p.first.data(), p.second);
+ }
SET_CURRENT_INDEX( topRight )
+ Q_FOREACH(const WidgetProperty& p, stateProperties[state].topRight) {
+ ui.topRight->currentWidget()->setProperty( p.first.data(), p.second);
+ }
SET_CURRENT_INDEX( bottomLeft )
+ Q_FOREACH(const WidgetProperty& p, stateProperties[state].bottomLeft) {
+ ui.bottomLeft->currentWidget()->setProperty( p.first.data(), p.second);
+ }
SET_CURRENT_INDEX( bottomRight )
+ Q_FOREACH(const WidgetProperty& p, stateProperties[state].bottomRight) {
+ ui.bottomRight->currentWidget()->setProperty( p.first.data(), p.second);
+ }
#undef SET_CURRENT_INDEX
}