The MainWindow::setTitle() function was passed an enum, which depended
on whether existing_file is set or not. The check can be (and was!) done
directly in setTitle(). Therefore, remove the whole enum.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Don't change into a directory just to see if it exists.
Remove unnecessary braces of one of the changed if statements.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The progressbar was not hidden on failed save to cloud. In return
remove an unnecessary variable on loading from cloud.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This reenables the computation of plan variations but now in a separate
thread. Once finieshed, a signal is sent to update the notes.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Currently, the path to the recently used file is stored in the tooltip
of the corresponding recent file action. Instead, store the number
of the recent file in the action. This allows for more flexibility
concerning formating of the tooltips (think git repositories, etc.).
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Instead of using four recent files actions defined in mainwindow.ui,
generate these actions dynamically depending on the macro NUM_RECENT_FILES.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The file mainwindow.cpp is only compiled for desktop versions, so the
condition is redundant.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Instead of handing the QSession object down, simply create it in
MainWindow::checkSurvey()
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The old code used to be unnecessarily complex: the recent files list
was extended for each file and shrunk if a load failed.
By adding a file to the recent file list only if the load succeeded, a
whole method could be removed.
Other changes: keep track of the recent files using a QStringList and
clearly separate the actions:
- Read recent files from settings [loadRecentFiles()]
- Write recent files to settings [updateRecentFiles()]
- Update the recent files actions in the menu [updateRecentFilesMenu()]
- Add a file to the list of recent files [addRecentFile()]
With this reorganization the code hopefully became more clear.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
reset_cylinder may transform unused cylinders into zombie cylinders
inside the planner because it adds a depth info and therefore the
planner will use them.
By calling CylindersModel->updateDive these cylinders will become visible
and can be deleted by the user.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Since commit 01d961086c, MainWindow::refreshDisplay()
is called in the refreshDiveInfo() signal of maintab after editing a
dive site. Since this was the only use of the refreshDiveInfo signal,
remove this signal and instead connect to MainWindow::refreshDisplay directly.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Update the filters if the list of dives is updated by calling
MultiFilterSortModel::instance()->myInvalidate();
This had the side effect of clearing all selections. Thus, in
the repopulate() methods of the FilterModels, check those
entries that were checked previously. Since all the filter
models use the same code, introduce a base class FilterModelBase.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This update includes:
- Instead of copyPath() use a new specialized function:
copy_bundled_templates()
- The new function supports overwriting of templates
in the user path, but only if a template file is read-only
- If the file is RW create a backup of the file in the
form of: <file-name>-User.html
- Collect backup files and store them in a QStringList
which is then shown in a QMessageBox from MainWindow
to notifying the user about the backup
This change allows moving the maintenance of the bundled
templates back to the application developers and contributors
as currently the only one who can edit the templates in the user
path was the user.
Suggested-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Add the function set_bundled_templates_as_read_only()
in templatelayout.cpp/h. The function is used to
mark the bundled template files as read-only in
the user folder. It is called in mainwindow.cpp,
after the files are copied from the bundle.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
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>
Correct spelling and typos in file filters.
Unify and translate file filter names.
Don't pass a file filter to a directory open dialog - not needed.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Calls to report_error() crashed if not called from GUI thread.
Fix this by postponing error message display if not in GUI thread.
Code that creates a thread which possibly calls report_error()
is responsible for calling MainWindow::showErrors() to flush
the accumulated messages.
Note that there is a race condition in report_error() and
get_error_string(). Nevertheless, hitting it should be rather
unlikely (two threads producing error messages at the same time)
and hopefully it can be fixed rather easily.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This helps people who always use a std. salinity of e.g. 1020g/l.
If they have a log with their dives open and plan a new dive they will
have also for new planned dives the salinity set to their prefered value.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
When enabling the dive list filter via the menu entry
"Log->Filter dives" and then switch off the filter via the small "close"
button of the filter:
Set the checked status of the menu entry correctly.
Also set it correctly when switching on/off via the menu entry to avoid
any situation where it is not synced.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
report_error() now does this automatically. So all these odd places in which we tried
to make sure that we show errors are no longer needed.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Instead of waiting for a manual call to showError(), simply use the new
callback to always immediately show the error in the notification widget.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Require the FULLSCREEN_SUPPORT macro to enable fullscreen
support.
The toggle was added 4 years ago in Subsurface, but with the
current version of Qt 5.9.x, it's very buggy on Windows and
Ubuntu. While it's possible to make this work on Windows,
it seems to behave broken in different ways on different
versiosn of Ubuntu.
Fixes#705
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
current_dc is a macro that determines the dive computer
based on the current dive number. When the planner is started
from an emtpy dive list, the dive number ends up being -1 and
that doesn't produce a valid dive computer. Use the divecomputer
of the displayed_dive instead. This is done via a macro that
can also be used in two other places. Without this patch, the
planner crashed when called on an empty dive list.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
This should prevent the problem of a user accidentally
"deleting" their dives in the cloud by hitting "save to cloud"
in the wrong moment.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
In desktop-widgets, remove globe.cpp, globe.h and also remove
the NO_MARBLE macro usage.
At this point the MapWidget will always be created and there will
always be a map in the application.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Also change the menu entry text itself to "Map" instead of "Globe".
"Map" covers both Marble and Qt Location in terms of "map" solutions.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This is an attempt for a smooth transition between Marble
and Qt Location map integration. If NO_MARBLE is defined
an instance of MapWidget (Qt Location) is created,
else an instance of the Marble widget would be used.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
The fake percentage needs to at least start at 0 for every cloud interaction.
Yes, the file global variable is ugly. So sue me.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The old system of cloud access updates with fake percentages just wasn't
helpful. Even worse, it hid a lot important information from the user.
This should be more useful (but it will require that we localize the
messages sent from the git progress notifications and make them more
'user ready').
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is important to not duplicate code for the Qml
view. Now the DownloadFromDiveComputer widget is mostly
free from important code (that has been upgraded to the
core folder), and I can start coding the QML interface.
There are still a few functions on the desktop widget
that will die so I can call them via the QML code later.
I also touched the location of a few globals (please, let's
stop using those) - because it was declared on the
desktop code and being used in the core.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>