diff options
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/CMakeLists.txt | 3 | ||||
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 18 | ||||
-rw-r--r-- | desktop-widgets/mainwindow.h | 3 | ||||
-rw-r--r-- | desktop-widgets/mainwindow.ui | 10 |
4 files changed, 33 insertions, 1 deletions
diff --git a/desktop-widgets/CMakeLists.txt b/desktop-widgets/CMakeLists.txt index 7fc76ece3..30a001056 100644 --- a/desktop-widgets/CMakeLists.txt +++ b/desktop-widgets/CMakeLists.txt @@ -40,6 +40,7 @@ set (SUBSURFACE_UI setpoint.ui shiftimagetimes.ui shifttimes.ui + statswidget.ui tableview.ui templateedit.ui tripselectiodialog.ui @@ -104,6 +105,8 @@ set(SUBSURFACE_INTERFACE simplewidgets.cpp simplewidgets.h starwidget.cpp + statswidget.h + statswidget.cpp starwidget.h subsurfacewebservices.cpp subsurfacewebservices.h diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index e56384540..99040aecf 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -50,6 +50,7 @@ #include "desktop-widgets/tab-widgets/maintab.h" #include "desktop-widgets/updatemanager.h" #include "desktop-widgets/simplewidgets.h" +#include "desktop-widgets/statswidget.h" #include "commands/command.h" #include "profile-widget/profilewidget2.h" @@ -141,6 +142,7 @@ MainWindow::MainWindow() : QMainWindow(), graphics = new ProfileWidget2(this); MapWidget *mapWidget = MapWidget::instance(); plannerWidgets.reset(new PlannerWidgets); + StatsWidget *statistics = new StatsWidget(this); // what is a sane order for those icons? we should have the ones the user is // most likely to want towards the top so they are always visible @@ -183,6 +185,8 @@ MainWindow::MainWindow() : QMainWindow(), { diveList, FLAG_DISABLED }, { mapWidget, FLAG_NONE } }); registerApplicationState(ApplicationState::FilterDive, { { mainTab.get(), FLAG_NONE }, { profileContainer, FLAG_NONE }, { diveList, FLAG_NONE }, { &filterWidget, FLAG_NONE } }); + registerApplicationState(ApplicationState::Statistics, { { statistics, FLAG_NONE }, { profileContainer, FLAG_NONE }, + { diveList, FLAG_DISABLED }, { &filterWidget, FLAG_NONE } }); setApplicationState(ApplicationState::Default); setWindowIcon(QIcon(":subsurface-icon")); @@ -1593,6 +1597,15 @@ void MainWindow::on_actionFilterTags_triggered() showFilterIfEnabled(); } +void MainWindow::on_actionStats_triggered() +{ + setApplicationState(getAppState() == ApplicationState::Statistics ? ApplicationState::Default : ApplicationState::Statistics); + toggleCollapsible(true); + ui.topSplitter->setSizes({ EXPANDED, COLLAPSED }); + ui.mainSplitter->setSizes({ EXPANDED, EXPANDED }); + ui.bottomSplitter->setSizes({ EXPANDED, EXPANDED }); +} + void MainWindow::showFilterIfEnabled() { if (getAppState() == ApplicationState::FilterDive) { @@ -1642,6 +1655,11 @@ void MainWindow::setApplicationState(ApplicationState state) setQuadrant(quadrants.topRight, ui.topRight); setQuadrant(quadrants.bottomLeft, ui.bottomLeft); setQuadrant(quadrants.bottomRight, ui.bottomRight); + + // The statistics view does its own thing with respect to visibility + // of quadrants. So in case we leave that state, change to the + // original visibility of the quadrants. + enterState(this->state); } void MainWindow::showProgressBar() diff --git a/desktop-widgets/mainwindow.h b/desktop-widgets/mainwindow.h index eb5d76447..6734eb7bd 100644 --- a/desktop-widgets/mainwindow.h +++ b/desktop-widgets/mainwindow.h @@ -51,7 +51,7 @@ public: MAP_MAXIMIZED, INFO_MAXIMIZED, PROFILE_MAXIMIZED, - LIST_MAXIMIZED, + LIST_MAXIMIZED }; MainWindow(); @@ -131,6 +131,7 @@ slots: void on_copy_triggered(); void on_paste_triggered(); void on_actionFilterTags_triggered(); + void on_actionStats_triggered(); void on_actionConfigure_Dive_Computer_triggered(); void setDefaultState(); void setAutomaticTitle(); diff --git a/desktop-widgets/mainwindow.ui b/desktop-widgets/mainwindow.ui index 071e4fe53..c7c464f71 100644 --- a/desktop-widgets/mainwindow.ui +++ b/desktop-widgets/mainwindow.ui @@ -97,6 +97,7 @@ <addaction name="actionAutoGroup"/> <addaction name="separator"/> <addaction name="actionFilterTags"/> + <addaction name="actionStats"/> </widget> <widget class="QMenu" name="menuView"> <property name="title"> @@ -107,6 +108,7 @@ <addaction name="actionViewProfile"/> <addaction name="actionViewInfo"/> <addaction name="actionViewMap"/> + <addaction name="actionViewStats"/> <addaction name="separator"/> <addaction name="actionYearlyStatistics"/> <addaction name="actionPreviousDC"/> @@ -640,6 +642,14 @@ <string notr="true">Ctrl+F</string> </property> </action> + <action name="actionStats"> + <property name="text"> + <string>Dive statistics</string> + </property> + <property name="shortcut"> + <string notr="true">Ctrl+T</string> + </property> + </action> <action name="profTissues"> <property name="checkable"> <bool>true</bool> |