aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar pestophagous <pestophagous@users.noreply.github.com>2015-10-05 22:21:44 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-10-07 08:34:47 +0100
commite522dd1a68d559f43a337e862f9f0a4d233d9272 (patch)
tree0c6639b004e29b91a8ff733192e1fd9a25f8020f
parent4f287b6f801d1689794c5a9177f2d95090fbe8d8 (diff)
downloadsubsurface-e522dd1a68d559f43a337e862f9f0a4d233d9272.tar.gz
Preserve profile toggle-button state zoomed_plot across sessions.
Fixes #912 Signed-off-by: K. Heller <pestophagous@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/mainwindow.cpp5
-rw-r--r--qt-ui/profile/profilewidget2.cpp5
2 files changed, 8 insertions, 2 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 317980d24..87597606d 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -1150,7 +1150,8 @@ void MainWindow::readSettings()
TOOLBOX_PREF_BUTTON(show_pictures_in_profile, show_pictures_in_profile, profTogglePicture);
TOOLBOX_PREF_BUTTON(tankbar, tankbar, profTankbar);
TOOLBOX_PREF_BUTTON(percentagegraph, percentagegraph, profTissues);
- s.endGroup();
+ TOOLBOX_PREF_BUTTON(zoomed_plot, zoomed_plot, profScaled);
+ s.endGroup(); // note: why doesn't the list of 17 buttons match the order in the gui?
s.beginGroup("DiveComputer");
default_dive_computer_vendor = getSetting(s, "dive_computer_vendor");
default_dive_computer_product = getSetting(s, "dive_computer_product");
@@ -1717,6 +1718,7 @@ void MainWindow::editCurrentDive()
PREF_PROFILE(QT_PREFS); \
}
+// note: why doesn't the list of 17 buttons match the order in the gui? or the order above? (line 1136)
TOOLBOX_PREF_PROFILE(profCalcAllTissues, calcalltissues, calcalltissues);
TOOLBOX_PREF_PROFILE(profCalcCeiling, calcceiling, calcceiling);
TOOLBOX_PREF_PROFILE(profDcCeiling, dcceiling, dcceiling);
@@ -1734,6 +1736,7 @@ TOOLBOX_PREF_PROFILE(profScaled, zoomed_plot, zoomed_plot);
TOOLBOX_PREF_PROFILE(profTogglePicture, show_pictures_in_profile, show_pictures_in_profile);
TOOLBOX_PREF_PROFILE(profTankbar, tankbar, tankbar);
TOOLBOX_PREF_PROFILE(profTissues, percentagegraph, percentagegraph);
+// couldn't the args to TOOLBOX_PREF_PROFILE be made to go in the same sequence as TOOLBOX_PREF_BUTTON?
void MainWindow::turnOffNdlTts()
{
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 5b7c3832a..5d2b507a0 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -75,7 +75,7 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
background(new DivePixmapItem()),
backgroundFile(":poster"),
toolTipItem(new ToolTipItem()),
- isPlotZoomed(prefs.zoomed_plot),
+ isPlotZoomed(prefs.zoomed_plot),// no! bad use of prefs. 'PreferencesDialog::loadSettings' NOT CALLED yet.
profileYAxis(new DepthAxis()),
gasYAxis(new PartialGasPressureAxis()),
temperatureAxis(new TemperatureAxis()),
@@ -111,6 +111,9 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
shouldCalculateMaxDepth(true),
fontPrintScale(1.0)
{
+ // would like to be able to ASSERT here that PreferencesDialog::loadSettings has been called.
+ isPlotZoomed = prefs.zoomed_plot; // now it seems that 'prefs' has loaded our preferences
+
memset(&plotInfo, 0, sizeof(plotInfo));
setupSceneAndFlags();