From 8c56b2f45e546048941ba004bce5e5bfd0e6e660 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 27 Feb 2014 12:31:00 -0300 Subject: Store zoomed plot in preferences This patch makes the 'Zoomed Plot' a preference that can be stored and retrieved, this way if the user sets the plot to be 'zoomed', this information will persist even if they closed or opened subsurface again. Also, added the 'Scale' button on the new profile, but didn't did the glue code yet. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/mainwindow.cpp | 12 ++++++------ qt-ui/mainwindow.h | 2 +- qt-ui/mainwindow.ui | 31 +++++++++++++++++++++++++++---- qt-ui/preferences.cpp | 1 + qt-ui/profilegraphics.cpp | 3 ++- 5 files changed, 37 insertions(+), 12 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 70415f077..59ebf2f25 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -364,12 +364,6 @@ void MainWindow::on_actionAutoGroup_triggered() mark_divelist_changed(true); } -void MainWindow::on_actionToggleZoom_triggered() -{ - zoomed_plot = !zoomed_plot; - ui.ProfileWidget->refresh(); -} - void MainWindow::on_actionYearlyStatistics_triggered() { QTreeView *view = new QTreeView(); @@ -1066,4 +1060,10 @@ void MainWindow::on_profSAC_clicked(bool triggered) TOOLBOX_PREF_PROFILE(show_sac); } +void MainWindow::on_profScaled_clicked(bool triggered) +{ + prefs.zoomed_plot = triggered; + TOOLBOX_PREF_PROFILE(zoomed_plot); +} + #undef TOOLBOX_PREF_PROFILE diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h index 24d3d701f..a9c2d4701 100644 --- a/qt-ui/mainwindow.h +++ b/qt-ui/mainwindow.h @@ -81,7 +81,6 @@ private slots: void on_actionAddDive_triggered(); void on_actionRenumber_triggered(); void on_actionAutoGroup_triggered(); - void on_actionToggleZoom_triggered(); void on_actionYearlyStatistics_triggered(); /* view menu actions */ @@ -123,6 +122,7 @@ private slots: void on_profPn2_clicked(bool triggered); void on_profRuler_clicked(bool triggered); void on_profSAC_clicked(bool triggered); + void on_profScaled_clicked(bool triggered); protected: void closeEvent(QCloseEvent *); diff --git a/qt-ui/mainwindow.ui b/qt-ui/mainwindow.ui index 6e1489eca..e6adb5ba2 100644 --- a/qt-ui/mainwindow.ui +++ b/qt-ui/mainwindow.ui @@ -6,8 +6,8 @@ 0 0 - 763 - 667 + 1418 + 1084 @@ -454,7 +454,7 @@ ... - + :/flag:/flag @@ -471,6 +471,29 @@ + + + + ... + + + + :/scale:/scale + + + + 24 + 24 + + + + true + + + true + + + @@ -564,7 +587,7 @@ 0 0 - 763 + 1418 25 diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp index c1c03e829..4d3816feb 100644 --- a/qt-ui/preferences.cpp +++ b/qt-ui/preferences.cpp @@ -264,6 +264,7 @@ void PreferencesDialog::loadSettings() GET_INT("gflow", gflow); GET_INT("gfhigh", gfhigh); GET_BOOL("gf_low_at_maxdepth", gf_low_at_maxdepth); + GET_BOOL("zoomed_plot", zoomed_plot); set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth); GET_BOOL("show_sac", show_sac); GET_BOOL("display_unused_tanks", display_unused_tanks); diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp index c63f7159d..2ec903950 100644 --- a/qt-ui/profilegraphics.cpp +++ b/qt-ui/profilegraphics.cpp @@ -1453,9 +1453,10 @@ void ProfileGraphicsView::on_rulerAction() void ProfileGraphicsView::on_scaleAction() { - zoomed_plot = !zoomed_plot; + prefs.zoomed_plot = !prefs.zoomed_plot; refresh(); } + QColor EventItem::getColor(const color_indice_t i) { return profile_color[i].at((isGrayscale) ? 1 : 0); -- cgit v1.2.3-70-g09d2