aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Jan Mulder <jlmulder@xs4all.nl>2017-11-21 12:23:58 +0100
committerGravatar Jan Mulder <jlmulder@xs4all.nl>2017-11-21 19:25:35 +0100
commitc995069e14cdd7c1132866ac78ad7839faecfa15 (patch)
treea720dd10ba7d3bbc55ea92e68c5664a185376ad5 /desktop-widgets
parent32a7cde180a342aef13b1ffcbe53a088ab4dc51c (diff)
downloadsubsurface-c995069e14cdd7c1132866ac78ad7839faecfa15.tar.gz
Desktop UI: allow user defined cylinder as default
Currently, it was only possible to use a hard-coded default cylinder in the preferences. At the same time, the user is allowed to add own cylinders to a dive (by just typing in a new name and cylinder properties). These own cylinders could not be selected in the preferences, requiring the user to manually add this every dive. Not sure the reason for all this was intentional, or just an overlooked aspect in the implementation. It appeared that the selection list in the UI was constructed before any logbook was parsed, so at that moment, there are only hard-coded cylinders. The fix is simple. Refresh the UI of the preferences just before it is shown. While opening the logbook, a new list of cylinders, including the own cylinders is constructed, so the UI is refreshed to that. While a simple change, there is a use case that might be considered strange. Open a logbook, choose new logbook, and change the default cylinder preference to an own (from the previously opened logbook). Do not add a dive with the new (own) cylinder and save this logbook. Reopen this new logbook, and see that the default cylinder in the preferences is empty. This is logical, as the list of own possible cylinders is constructed from the (new) logbook, that has no dive with that specific own cylinder. I consider this acceptable behavior, as it can be also be used to copy own cylinders to a new logbook. Fixes: #821 Proposed-by: Davide DB <dbdavide@gmail.com> Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/mainwindow.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index e84b6160a..f685a2b74 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -774,6 +774,11 @@ void MainWindow::showProfile()
void MainWindow::on_actionPreferences_triggered()
{
+ // the refreshPages() is currently done for just one
+ // reason. Allow the user to define a default cylinder that
+ // is not hardcoded but coming from the logbook.
+ PreferencesDialog::instance()->refreshPages();
+
PreferencesDialog::instance()->show();
PreferencesDialog::instance()->raise();
}