diff --git a/display.h b/display.h index 30fd2067a..64d481eeb 100644 --- a/display.h +++ b/display.h @@ -52,7 +52,7 @@ struct options { int profile_height, notes_height, tanks_height; }; -extern char zoomed_plot, dc_number; +extern char dc_number; extern unsigned int amount_selected; diff --git a/pref.h b/pref.h index 415743562..83e88cdcd 100644 --- a/pref.h +++ b/pref.h @@ -38,6 +38,7 @@ struct preferences { struct units units; short show_sac; bool display_unused_tanks; + bool zoomed_plot; }; enum unit_system_values { METRIC, IMPERIAL, PERSONALIZE }; diff --git a/profile.c b/profile.c index 5ab59ce6c..84ba30f97 100644 --- a/profile.c +++ b/profile.c @@ -16,7 +16,6 @@ #include "membuffer.h" int selected_dive = -1; /* careful: 0 is a valid value */ -char zoomed_plot = 0; char dc_number = 0; @@ -61,7 +60,7 @@ static void dump_pi (struct plot_info *pi) int get_maxtime(struct plot_info *pi) { int seconds = pi->maxtime; - if (zoomed_plot) { + if (prefs.zoomed_plot) { /* Rounded up to one minute, with at least 2.5 minutes to * spare. * For dive times shorter than 10 minutes, we use seconds/4 to @@ -86,7 +85,7 @@ int get_maxdepth(struct plot_info *pi) unsigned mm = pi->maxdepth; int md; - if (zoomed_plot) { + if (prefs.zoomed_plot) { /* Rounded up to 10m, with at least 3m to spare */ md = ROUND_UP(mm+3000, 10000); } else { 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);