diff options
-rw-r--r-- | display.h | 2 | ||||
-rw-r--r-- | pref.h | 1 | ||||
-rw-r--r-- | profile.c | 5 | ||||
-rw-r--r-- | qt-ui/mainwindow.cpp | 12 | ||||
-rw-r--r-- | qt-ui/mainwindow.h | 2 | ||||
-rw-r--r-- | qt-ui/mainwindow.ui | 31 | ||||
-rw-r--r-- | qt-ui/preferences.cpp | 1 | ||||
-rw-r--r-- | qt-ui/profilegraphics.cpp | 3 |
8 files changed, 41 insertions, 16 deletions
@@ -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; @@ -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 }; @@ -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 @@ <rect> <x>0</x> <y>0</y> - <width>763</width> - <height>667</height> + <width>1418</width> + <height>1084</height> </rect> </property> <widget class="QWidget" name="centralwidget"> @@ -454,7 +454,7 @@ <string>...</string> </property> <property name="icon"> - <iconset> + <iconset resource="../subsurface.qrc"> <normaloff>:/flag</normaloff>:/flag</iconset> </property> <property name="iconSize"> @@ -472,6 +472,29 @@ </widget> </item> <item> + <widget class="QToolButton" name="profScaled"> + <property name="text"> + <string>...</string> + </property> + <property name="icon"> + <iconset resource="../subsurface.qrc"> + <normaloff>:/scale</normaloff>:/scale</iconset> + </property> + <property name="iconSize"> + <size> + <width>24</width> + <height>24</height> + </size> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + </widget> + </item> + <item> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -564,7 +587,7 @@ <rect> <x>0</x> <y>0</y> - <width>763</width> + <width>1418</width> <height>25</height> </rect> </property> 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); |