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>
This way we can avoid having to use Qt Creator (in preparation for
eventually testing the iOS build in Travis CI).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The build process uses the dummy.qml file to determine which QML modules
to package. This ensures that Subsurface-mobile includes all its
dependencies.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Icon aliases were inconsistent mess. Underscores vs. hyphens vs. camelCase.
With vs. without filename suffix. Lower vs. upper case. "icon" suffix vs.
prefix vs. nothing. Some were duplicated, eg warning vs. warning-icon. Some
icons didn't have alias at all.
This changes all icon aliases to one, easy grep-able style which complies
to Freedesktop Icon Naming Specification (Guidelines).
Signed-off-by: Martin Měřinský <mermar@centrum.cz>
Add a file CHANGELOG.md in the root Subsurface directory
and track this file with the `-text merge=union` attribute.
This prevents merge conflicts if release notes are added
on top of the file by different commits.
Also, make ReleaseNotes/ReleaseNotes.txt point to that file.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
After one selected a dive and then selects NO dive don't touch
the visibility of UI fields for depth and duration.
So if previously selected dive was a manually added dive, keep them
visible. If it was no manually added dive keep them invisible.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Change the merging behavior for the following information:
Divemaster, buddy, suit:
From "(a) or (b)" to "a, b"
Notes:
From "(a) or (b)" to "a\n--\nb"
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Remove duplicate and incorrect setPlainText call via macro for dive notes.
Deal correctly with ASCII line breaks "\n" in dive notes with html
markup (replace them with <br>).
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
The centerOn*() functions can just return early
for invalid input, instead of branching the conditions.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
- Add the helper coordIsValid() and use it in centerOnCoordinate().
This checks for NaN coordinates and prevents an infinite while() loop.
- Use '-= 1.0' instead of '--' to be more clear that the decremented
variable is a float
- Store the current center with 'centerStored' in
centerOnCoordinate(). Fixes a possible zoom out glitch.
- use Math.floor() to convert 'zoomLevel' to integer when estimating
zoomOut in centerOn*()
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
The zoom out function is no longer used as we don't zoom
out when a dive doesn't have dive site coordinates.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
There was a problem with the current different duration
for pan and zoom. Ideally the pan should before the zoom:
Map zooms out -> pan to new center starts -> zoom in
The problem with this is that if the map pans out too much it
loses it's center and the above scheme would not work.
To solve the problem, make the duration of pan and zoom
the same this is not idea, but prevents the case where
the map would not zoom-in at the correct center.
Also remove the easing function.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Currently when the user is typing new coordinates the
marker on the map changes location right away. Disable that and
add a 'flag' button that should be pressed instead. Also make the
coordinates update when pressing Enter or when the text
field loses focus.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
When the map is performing zoom/pan animation and the
user performs an action that would trigger a new zoom/pan
animation, but some glitches can occurs. An example
would be when one clicks a dive in the dive list -
the zoom/pan animation will trigger, so that the map
is centered on the dive site, but if the user clicks the
[+] button to zoom-in, while the animation is running
the map will glitch.
This patch prevents such glitches by stopping
all running animations in progress when the user:
- single clicks the map
- uses the mouse-wheel to zoom
- presses the [+] / [-] buttons
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Avoid using qvariant_cast() with getRole() in favor of
MapLocation::coordinate() in MapWidgetHelper::reloadMapLocations().
This makes the code more readble.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Once the user starts editing a dive site, make sure to pass
coordinates of either the current map center (if a new MapLocation
is being added) or the coordinates of the existing MapLocation.
The "Dive site management" coordinates text field would receive
these new coordinates after the displayed_dive_site struct
is updated and the coordinatesChanged() signal is emitted.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Once the user starts editing the coordinates by hand
(from the "Dive site management" UI) make sure to
update the map to center on those user entered
coordinates.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>