Commit graph

239 commits

Author SHA1 Message Date
Berthold Stoeger
45395fd466 Dive pictures: Don't plot pictures twice when changing current dive
In MainWindow::current_dive_changed() first plotDive() is called,
which replots all the pictures by calling plotPictures(). This
is pointess, because it plots the pictures of the previous dive.

Then, updateDiveInfo() is called, which resets the dive pictures
and automatically replots them. Thus, switching between dives
both with hundreds of pictures is way slower than necessary.

Switching the plotDive() and updateDiveInfo() calls doesn't work.
The reason is not 100% clear, but it doesn't make sense to plot
pictures of the new dive as long as the profile still shows the
old dive anyway.

As a quick-fix, add a flag to plotDive(), which tells the function
to clear the pictures list instead of redrawing it.
Ultimately, plotDive() should probably be split in two functions.
One for the callers who update the pictures themselves and one
for the others.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-17 07:24:54 -07:00
Berthold Stoeger
9b4728c7a9 Cloud-storage: consistently don't save empty file on desktop version
Make the behavior consistent: Don't save an empty file to the cloud,
neither on selection of "Save to cloud" nor on "Save". The latter
was not the case. It was a bit hard to trigger: Open cloud, delete
all dives, save.

Fixes #1228

Reported-by: Jan Iversen <jani@apache.org>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-14 12:52:54 -07:00
Dirk Hohndel
d577467f97 Core: introduce new subsurface-string header
First small step to shrinking dive.h.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-05-14 10:13:39 -07:00
Berthold Stoeger
57bf174c4f Desktop: On dive edit from the dive list or map, switch to new state
If "Edit dive" is selected from the dive list or the map view, switch
to a new mode, which shows the dive infos and the profile.

After the edit, switch back to the previous state.

Fixes #1213

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-13 07:08:34 -07:00
Berthold Stoeger
9d342d0e1a Desktop: Make "Edit dive" menu entry work for downloaded dives
Confusingly, "Edit dive" did only work for planned / manually
entered dives. Change this, but only start profile-editing for
planned / manually entered dives.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-13 07:08:34 -07:00
Oliver Schwaneberg
55ac07f6f6 Corrected file name "weigthsysteminfomodel" to "weightsysteminfomodel"
Signed-off-by: Oliver Schwaneberg <oliver.schwaneberg@gmail.com>
2018-05-11 02:23:51 +03:00
Dirk Hohndel
7e73b30e97 Revert "GPS: use applyGpsLocation::applyLocations from core"
This reverts commit 70e0e80de5.

This caused the GPS workflow to break for Linus. Let's revert
for 4.7.8 and figure out how to do this cleanup correctly, later.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-03 11:52:46 -07:00
Stefan Fuchs
cfd4c42829 Profile heatmap/heartrate: Only enable max one of these at same time
Only allow to enable maximum one of both items tissue heatmap or
heartrate in profile.
This is done by always switching off the other one at the moment you
turn on one of the two items (heatmap or heartrate).

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-03-19 15:44:02 -07:00
Berthold Stoeger
d1572a8d95 Cleanup: introduce copy_qstring() function
strdup(qPrintable(s)) and copy_string(qPrintable(s)) were such common
occurrences that they seem worthy of a short helper-function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-14 13:55:36 +02:00
Berthold Stoeger
b72cc1f317 Cleanup: consistently use qPrintable()
Replace constructs of the kind
  s.toUtf8().data(),
  s.toUtf8().constData(),
  s.toLocal8Bit().data(),
  s.toLocal8Bit.constData() or
  qUtf8Printable(s)
by
  qPrintable(s).

This is concise, consistent and - in principle - more performant than
the .data() versions.

Sadly, owing to a suboptimal implementation, qPrintable(s) currently
is a pessimization compared to s.toUtf8().data(). A fix is scheduled for
new Qt versions: https://codereview.qt-project.org/#/c/221331/

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-14 13:55:36 +02:00
Berthold Stoeger
8f81a22e7f Make report_error() reentrant
Remove the global error buffer and pass the error string directly
to the frontend. The frontend is then responsible for accumulating
errors.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-31 14:47:26 +01:00
Berthold Stoeger
df81a39aa5 Remove unnecessary check for MainWindow instance
The error-callback is installed in the MainWindow constructor.
Therefore, in the error-callback the existence of the MainWindow
instance is guaranteed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-31 14:47:26 +01:00
Berthold Stoeger
a25f54e3c2 Use queued connection to thread-safe MainWindow error handling
Up to now, errors produced by threads were not directly shown in
the MainWindow. Code running in the GUI thread had to manually
show the errors.

This can be simplified by using Qt's queued connection as message
passing facility.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-31 14:47:26 +01:00
Robert C. Helling
de49f2484f Resize progress bar width to fit all text
At least on Mac with larger font sizes part of the label
text of the git access progress bar is cut off (even though
it should automatically resize). This patch adds explicit
resize.

Fixes #1041

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-01-13 19:13:14 +01:00
Berthold Stoeger
6a07ccbad2 Use helper function empty_string() instead of manual checks
For code consistency, substitute boolean expressions:
 s && *s     -> !empty_string(s)
 s && s[0]   -> !empty_string(s)
 !s || !*s   ->  empty_string(s)
 !s || !s[0] ->  empty_string(s)

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-11 06:07:13 +01:00
Berthold Stoeger
e85ecdd925 Introduce helper function empty_string()
There are ca. 50 constructs of the kind
  same_string(s, "")
to test for empty or null strings. Replace them by the new helper
function empty_string().

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-11 06:07:13 +01:00
Berthold Stoeger
339f214384 Remove redundant setting of prefs.git_local_only
In MainWindow::on_actionCloudOnline_triggered(), prefs.git_local_only
was set twice in the case of going online. Remove the second,
unnecessary, assignment.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-08 12:01:04 +01:00
Berthold Stoeger
099662023c Move resetting of current file out of clear_dive_file_data()
This is the only case where C-code sets the current file.
Remove this call for a better separation of C-backend and
C++-frontend parts.

There were four callers of clear_dive_file_data(). Two of them
would call set_filename() anyway. For the remaining two add an
explicit call to set_filename().

This commit fixes a bug introduced in commit b3901aa8f9:
The cloud-online menu entry was still enabled after "closing" the
cloud storage.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-08 12:01:04 +01:00
Berthold Stoeger
b3901aa8f9 Enable cloud-online menu entry only if connected to cloud
Enable the menu item cloud-online only if the current file is the
cloud storage. Since this has to be checked every time the current
file is set, factor this out into the new MainWindow::setCurrentFile()
function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-06 10:46:07 -08:00
Berthold Stoeger
bb64c6bda8 Turn take-cloud-online menu action into checkbox
Replace the "Take cloud storage online" menu entry by a "Cloud online"
checkbox. After this change, the user can also force going offline.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-06 10:46:07 -08:00
Berthold Stoeger
dbef391786 Sync cloud storage on take-cloud-online
When taking the cloud online, actually sync with the online cloud storage.
If there are no unsaved changes, do the same as "Open cloud storage".
If there are unsaved changes, ask the user if they want to commit them
(do the same as "Save to cloud storage") or if they want to sync manually.

If syncing failed, inform the user.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-06 10:46:07 -08:00
Jan Mulder
70e0e80de5 GPS: use applyGpsLocation::applyLocations from core
Fixes a big duplication of code. The code to apply GPS locations
from the location service was already in core, and used from mobile,
but there was an almost literal copy in the desktop code.

See also commits 6f42ab46da and ee9531f76e, where only
one side of the duplicated code was fixed.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-06 09:21:16 +01:00
Berthold Stoeger
40fa148548 Replace BEHAVIOR macro by initializer lists
The macro BEHAVIOR expanded to "QList<int>()". This was used to
generate temporary QList<int>s with constructs such as
  BEHAVIOR << COLLAPSED << EXPANDED
Instead, simply use initializer lists such as
  {COLLAPSED, EXPANDED}

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-04 08:21:43 -08:00
Berthold Stoeger
f8517c583b Replace macro TOGGLE_COLLAPSABLE by function toggleCollapsible()
There was no reason to do this in a macro. Let the compiler decide
if it wants to inline or not. Note that for consistency with the
Qt functions, collapsAble was replaced by collabsIble.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-04 08:21:43 -08:00
Berthold Stoeger
b4e36c5912 Use set_autogroup() function
Since this function exists, use it instead of setting the global
variable directly.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-04 08:21:43 -08:00
Jan Mulder
e16b58ee08 Desktop: follow autogroup setting in UI
When importing a dive (using import from logfile) and it is a
ssrf/xml file that contains the autogroup setting, the autogroup
is effectuated in the dive list. Not sure that I like this
behavior, but thats the way it currently is. Simply wrong
is that in this case the menu item toggle is not adapted
so we end up with a dive list that is autogrouped, but
the menu toggle is off.

This can be solved by setting the UI toggle in a more central
location.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-02 06:47:53 +02:00
Berthold Stoeger
f74308bed4 Desktop: Don't hide errors on opening cloud storage
In MainWindow::on_actionCloudstorageopen_triggered(),
getNotificationWidget()->hideNotification() was called, thus hiding
any error message produced by the cloud code. Notably, the information
"Cannot sync with cloud server, working with offline copy" was
not shown.

Therefore, remove this call. Note that on cloud save messages were
not hidden.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-29 09:19:17 -08:00
Berthold Stoeger
4ac5b9c965 Simplify mainwindow title logic: remove MainWindowTitleFormat enum
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>
2017-12-11 23:10:09 -06:00
Berthold Stoeger
931bcc1966 Remove unused variable in on_actionCloudstorageopen_triggered()
This was an artifact of commit 136110784e

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-12 04:08:58 +01:00
Berthold Stoeger
ea0cbba804 Remove second parameter (bool force) in set_filename()
The last force=false case was removed in commit 96d1cc570e.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-11 00:17:39 +01:00
Berthold Stoeger
0a2e53caf2 Use QDir::exists() instead of QDir::setCurrent() to check for existence
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>
2017-12-04 18:35:44 +01:00
Berthold Stoeger
136110784e On failed cloud save hide progress bar
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>
2017-12-01 16:39:58 -08:00
Robert C. Helling
a9703628c4 Actually compute variations in background
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>
2017-12-01 15:47:51 -08:00
Martin Měřinský
0855f6f315 Use icons relative path.
Icon paths are defined in one place only - application's embedded resources.

Signed-off-by: Martin Měřinský <mermar@centrum.cz>
2017-11-30 23:14:46 -08:00
Stefan Fuchs
4ee9791cb8 Fix views in mainwindow
Divelist only view was broken.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-01 04:03:30 +01:00
Berthold Stoeger
f8a200dbce Don't use action tooltip to access recently used file
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>
2017-12-01 03:39:10 +01:00
Berthold Stoeger
4296ca11a6 Dynamically generate recent files actions
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>
2017-12-01 03:39:10 +01:00
Berthold Stoeger
1208bc8428 Remove "#if !defined(SUBSURFACE_MOBILE)" in mainwindow.cpp
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>
2017-11-30 16:52:22 +01:00
Berthold Stoeger
8b9c63b2d8 Move creation of QSession object into MainWindow::checkSurvey()
Instead of handing the QSession object down, simply create it in
MainWindow::checkSurvey()

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-30 16:52:22 +01:00
Berthold Stoeger
135ea00d88 implify recent file handling in mainwindow.cpp
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>
2017-11-30 16:52:22 +01:00
Dirk Hohndel
fd9c905ba3 Revert "Use icons relative path."
This reverts commit b0d98f6e26.
2017-11-29 14:05:07 -08:00
Martin Měřinský
b0d98f6e26 Use icons relative path.
Icon paths are defined in one place only - application's embedded resources.

Signed-off-by: Martin Měřinský <mermar@centrum.cz>
2017-11-29 11:46:35 +01:00
Stefan Fuchs
276fd441b5 When replanning logged dive call CylindersModel->updateDive
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>
2017-11-27 22:40:16 +01:00
Berthold Stoeger
2a0520d57d Simplify signal handling after dive site editing
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>
2017-11-26 18:50:40 -08:00
Dirk Hohndel
357dea0bcb Merge branch 'print' of https://github.com/neolit123/subsurface 2017-11-25 08:30:24 -08:00
Berthold Stoeger
dd2466f518 Update filters on refreshDisplay and remember old selecttions
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>
2017-11-25 08:24:36 -08:00
Lubomir I. Ivanov
65f0600679 printing: update the coping of bundled templates
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>
2017-11-24 23:06:52 +02:00
Lubomir I. Ivanov
9209382c18 printing: add set_bundled_templates_as_read_only()
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>
2017-11-24 21:50:12 +02:00
Jan Mulder
c995069e14 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>
2017-11-21 19:25:35 +01:00
Stefan Fuchs
8b56dc30d7 Correct, cleanup, translate and unify file filters
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>
2017-11-04 14:27:00 +01:00
Stefan Fuchs
a94fba2439 Planner copy salinity only if current dive exists
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-04 09:15:59 +01:00
Berthold Stoeger
3acc28cebf Postpone error message display if not in GUI thread
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>
2017-10-31 16:32:08 -07:00
Stefan Fuchs
d470ef05e0 New dive plan set salinity to current dive salinity if dive selected
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>
2017-10-30 21:45:56 +01:00
Lubomir I. Ivanov
4357e06ba0 mainwindow.cpp: fix whitespace
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-28 17:39:19 +02:00
Stefan Fuchs
81492b8cba Set checked status of menu entry for dive list filter correctly
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>
2017-10-28 14:16:38 +02:00
Dirk Hohndel
e64dcd12bd desktop UI: no longer attempt to manually show error notifications
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>
2017-10-26 15:55:49 +02:00
Dirk Hohndel
f088aa4c8b desktop UI: always show errors when reported
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>
2017-10-26 15:50:53 +02:00
Lubomir I. Ivanov
3f7900bf4e mainwindow: disable fullscreen support by default
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>
2017-10-22 06:09:05 -04:00
Robert C. Helling
a422957cd6 Use displayed_dc instead of current_dc
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>
2017-10-19 14:57:02 -04:00
Robert C. Helling
e955099e6c Refuse to save an empty log to the clould
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>
2017-10-19 07:37:47 -04:00
Tomaz Canabrava
527078e277 [Facebook] Use statusbar instead of popup messages
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-02 08:54:03 -07:00
Tomaz Canabrava
3e2a86cf80 [Facebook] More debug calls
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-02 08:54:03 -07:00
Lubomir I. Ivanov
4bb180b117 remove Marble from the source tree
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>
2017-09-04 07:46:35 -07:00
Lubomir I. Ivanov
0d3d9c01eb mapwidget: add public slot endGetDiveCoordinates()
Later this has to be replaced / renamed if needed.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
39af5bb05b mapwidget: add an empty reload() method
Call same method in MainWindow if the NO_MARBLE macro is defined.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
86f4a26a83 mainwindow: rename GLOBE_MAXIMIZED to MAP_MAXIMIZED
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
4a10c94840 mainwindow: rename "actionViewGlobe" to "actionViewMap"
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>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
b054c211a1 mainwindow: don't remove the "view globe" action from the menu
We now have a map no matter NO_MARBLE.
TODO: rename the action itself.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
1a5122e8f8 mainwindow: enable centerOnDiveSite() no matter the NO_MARBLE macro
The same public slot now exists for both widgets, so the ifndef macro
check is redundant.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
b0b5f701fc mainwindow: create an instance of MapWidget for NO_MARBLE
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>
2017-07-28 07:31:11 -07:00
Lubomir I. Ivanov
0f0a953727 mainwindow: rename the variable 'globeGps' to 'mapWidget'
This is needed by the transition to the new map widget. Also
generalizes the variable name.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00
Dirk Hohndel
6afe6baa14 Desktop UI: reset cloud storage progress 'percentage'
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>
2017-06-18 01:46:49 -07:00
Dirk Hohndel
b2b51c833a QML UI: redesign the user notification
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>
2017-06-17 23:22:37 -07:00
Tomaz Canabrava
54bb5ccf9e Display the dialog correctly
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-27 11:07:19 -07:00
Tomaz Canabrava
dec47e11cd Separate the download thread from the widget logic
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>
2017-05-27 07:53:14 -07:00
Dirk Hohndel
9021a44ccc Add SPDX header to desktop widgets
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-29 13:32:55 -07:00
Dirk Hohndel
2182f00177 Reduce default verbosity
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-22 12:38:59 -07:00
Jan Mulder
ff5c04eb97 Do not abort when there is no current dive
Yes, currentdive can be undefined in case of of a new logbook and starting the planner
right away. Do not abort on that.

Reported-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-04-20 10:57:11 -07:00
Jan Mulder
89b914e47d Preserve dive mode when planning a dive
Data such as cilinders and used gasses are populated fromn the currently
selected dive when starting the planner. It is more logical to use
the dive mode (OC, CCR, pSCR) of the currently selected dive
as well. This commits changes this.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-04-20 10:57:11 -07:00
Jan Mulder
f2d88619c5 Restore FB grayed out when disconnected
See https://github.com/Subsurface-divelog/subsurface/issues/253. The original
behaviour (greyed out when disconnected) is restored. Not sure where and when
got lost, but this simple change fixes it.

Fixes #253

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-04-16 07:43:23 -07:00
Tomaz Canabrava
1fc4fba69f Break down MainTab into smaller classes
Maintab is one of our most complex classes, and it's
something I'm not actually proud of. But it currently
works and the idea of splitting it was in my head for
quite a while.

This is the third or fourth tentative of splitting it,
and this time I let the most complex part of it untouched,
the Notes and Equipment tab are way too complex to untangle
right now on my limited time.

A new class 'TabBase' should be used for any new tab that
we may create, and added on the MainTab (see the new lines
on the MainTab constructor).

Also, Extra Info, Information, Photos and Statistics where
ported to this new way helping reduce the number of
lines and functions on the MainTab quite a bit.

Overall this is a step in the right direction for the future.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-06 18:23:25 -07:00
Jeremie Guichard
597539ce39 Fix double to int truncation in C++ code
Wfloat-conversion enabled for C++ part of the code
Fix warnings raised by the flag using lrint

Original issue reported on the mailing list:
The ascent/descent rates are sometimes not what is expected.
E.g. setting the ascent rate to 10m/min results in an actual
ascent rate of 9m/min.
This is due to truncating the ascent rate preference,
then effectively rounding up the time to reach each stop to 2s intervals.
The result being that setting the ascent rate to 10m/min
results in 20s to ascend 3m (9m/min), when it should be exactly 18s.

Reported-by: John Smith <noseygit@hotmail.com>
Reported-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-03-24 09:39:25 -07:00
Dirk Hohndel
d36f056bde Get initial depth/duration correct when manually adding dive
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-04 12:16:49 -08:00
Jan Mulder
0f56a1e4bf Add 4 file types op file-open logbook menu filter, consistency
4 file types (that are very rarely used), did showup in the
import-import dive logs menu (e.g. the file filter), but were
missing from file-open logbook file type filter.

Just added them to the file-open part to be more consistent.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-02-25 09:18:53 -08:00
Jan Mulder
7165cb473a Correct file list in file-open filter box
Some missing ;; caused the filter on filetypes in open-open logbook to be garbled.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-02-25 09:18:53 -08:00
Stefan Fuchs
4f2a7dc972 Remove default stylesheet from planner output
Remove the default stylesheet ("Courier" 13pt) from the planner output QTextEdit.
Remove the content of the html property of the QTextEdit because we overwrite it when doing setHtml.
After printing copy the original dive notes string displayed_dive.notes back to the QTextEdit

Advantages:
Display is according to font settings.
ctrl - mousewheel for zoom always works.
Drawbacks:
Printing font is same as display font but can be adjusted by zooming before.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-02-20 09:42:29 -08:00
Robert C. Helling
dbf1390094 Only set surface pressure when it has a value
When replanning a dive, do not set the surface pressure when it is 0.
Same for salinity.

This closes #161 .

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-01-18 06:50:01 -08:00
Dirk Hohndel
b2cc840ebf Facebook integration: change the menu entry to disconnect
This way the menu entry becomes the togglee it appears it was designed to be in
the first place.

This closes #129

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-01-01 22:24:48 -08:00
Dirk Hohndel
c39fbea0ee Facebook integration: keep the connections QMenu around
This way we can change the text, later.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-01-01 22:19:08 -08:00
Robert C. Helling
fb2ba72e42 Set surface pressure and salinity correctly when replanning
We need to initialize the UI elements accordingly.

Fixes #1094

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-26 12:47:54 -08:00
Dirk Hohndel
c564e06d4e Manual revert of commit 9295b3aa37
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-15 20:37:35 +09:00
Robert C. Helling
05098f90cd Use fake profile when replanning dives without samples
This can happen when the user asks to replan a dive that
was imported from CSV.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-09 06:25:11 -08:00
Dirk Hohndel
131c5a2abe Fix building of Facebook support
No idea when this got broken. Fix seems like a hack as that variable
should get set in the plugin CMakeLists.txt. But it seems to work, so
"whatever".

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-22 17:12:00 -07:00
Tomaz Canabrava
db8e8957ab Settings update: Add "Dive Computer" settings to SettingsObjectWrapper
For some reason, the dive computer settings weren't in the
settings prefs. This moves it, makes the boilerplate on Settings
ObjectWrapper and make things compile.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-27 11:40:44 -07:00
Dirk Hohndel
430f5b77c5 Add menu entry to remove the offline state
If an attempt to contact the cloud storage fails, Subsurface switches into
offline mode. This allows us to go back online again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-30 13:29:06 -07:00
Dirk Hohndel
8f4e649c68 If cloud storage is offline, show that in title bar
Not sure if "local cache" is the best text, but it's accurate.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-17 12:27:01 +09:00
Robert C. Helling
783844eb3d Set date and time when replanning a dive
Otherwise we pretend the dive is now.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-06-13 22:17:49 -07:00
Linus Torvalds
710d47a2da Make sure dive computer model is proper malloc'ed allocation
Reported-and-tested-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-06-11 10:29:31 -07:00
Miika Turkia
98741c864c Use encoded file name on import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-05-05 07:28:00 -07:00
Miika Turkia
74065ad8aa Allow parsing of .txt files on import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-05-05 07:27:31 -07:00
Miika Turkia
8a4f2f998a Fix file extension regesp
The original negative lookahead failed in case the file name contains
more than 1 dot as it looks for dot that is not followed by the given
extensions. And such a match exists in the file name. The new version
should look properly if the file ends with any of the given extensions.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-25 09:08:11 -07:00
Miika Turkia
4955f858bf Add CSV parsing trigger for zxu and zxl files
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-25 09:08:01 -07:00
Miika Turkia
46074ebf21 Add DAN DL7 file extensions for import UI
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-25 09:07:53 -07:00
Dirk Hohndel
6725d54db2 Desktop UI: make sure that git progress is actually shown
This updates the got progress indicator to the changed interface where we don't
pass in an explicit percentage.

It also finally fixes an old problem: If we don't allow the Qt main loop to
process the events, we'll never see a decent progress indicator...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-05 23:43:17 -07:00
Dirk Hohndel
7be962bfc2 Move subsurface-core to core and qt-mobile to mobile-widgets
Having subsurface-core as a directory name really messes with
autocomplete and is obviously redundant. Simmilarly, qt-mobile caused an
autocomplete conflict and also was inconsistent with the desktop-widget
name for the directory containing the "other" UI.

And while cleaning up the resulting change in the path name for include
files, I decided to clean up those even more to make them consistent
overall.

This could have been handled in more commits, but since this requires a
make clean before the build, it seemed more sensible to do it all in one.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04 22:33:58 -07:00
Dirk Hohndel
eea1ff6a83 Change the git progress update callback signature
This way we can include additional text. This will be used in later
patches.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04 14:17:45 -07:00
Dirk Hohndel
abb3b03511 Don't start Add or Plan while accessing cloud storage
This avoids a race condition where we get confused about our internal
state.

Fixes #1031

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-22 17:41:15 -07:00
Dirk Hohndel
071e6dbd6f Silence warnings in mainwindow.cpp
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-09 21:50:26 -08:00
Tomaz Canabrava
5bf0e48700 Remove unused variable
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-07 11:17:16 -08:00
Tomaz Canabrava
2c5fad73e8 Start to use the QSettings ObjectWrapper
start of the QSettinsg Object Wrapper usage on the code
this first patch removes two macros that generated around
200 lines in runtime for something like a quarter of it
Basically, whenever we changed anything we called the
PreferencesDialog::settingsChanged and connected everythign
to that signal, now each setting has it's own changed signal
and we can call it directly.

The best thing about this approach is that we don't trigger
repaints for things that are not directly profile related. (
actually we still do, but the plan is to remove them in due time)

this commit breaks correct atualization of the profile (because
everything was connected to PreferencesDialog::settingsChanged)
and now I need to hunt a bit for the correct connections

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-25 13:04:01 -08:00
Dirk Hohndel
2882a1ef41 Remove the non-canonical Subusrface version
It no longer makes sense to lie about the version. If you are running a product
build, then the canonical version is the same version as the plain version used
to be. And in either case it makes much more sense to simply log the full
version information.

We used to have the differently styled versions for different OSs, but I don't
think this is needed anymore. Let's hope this doesn't go down as one of these
"famous last words" moments...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-20 07:59:50 -08:00
Dirk Hohndel
7aab635585 Remove support for older libgit2 - we now require 0.23 or later
Also fixes a capitalization error that prevented finding libssh2 in some
circumstances. And adds a missing include when building with libzip on Mac.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-15 13:33:00 -08:00
Dirk Hohndel
8f33403e4f Fetch the Subsurface webservice userid if cloud credentials were given
This allows users to not have to worry about this userid anymore. Both the
mobile app and the desktop app can now derive the userid from the cloud
storage credentials.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-02 14:32:03 -08:00
Anton Lundin
59042b2ed0 Fix disabling of facebook integration
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-02 09:21:04 -08:00
Dirk Hohndel
9295b3aa37 Add menu entry for creating GPS location
And disable it if there is no satellite based location service (but see
the comment in the previous commit - this doesn't appear to work
reliably).

Nothing happens when you use the menu entry. This just allows us to hook
this up later.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-18 19:17:32 -08:00
Dirk Hohndel
ff5bd062f6 Location service: instantiate location provider in the desktop UI
We still aren't doing anything with it, but at least it's there now.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-18 18:52:44 -08:00
Lubomir I. Ivanov
f5dbc3b44d Planner: support profile in planner print
The "Print" button in the planner dumps the QTextEdit to
a QPrinter via ::print(). This patch renders the Profile
to a Pixmap which is inserted as Base64 stream in an <img>
tag and fed on top of the QTextEdit HTML contents.

This route preserves the planner notes as text in PDF prints.
The quick alternative is to render the QTextDocument to
a QPixmap as well, but that will not preserve the text
and pagination becomes manual.

Possibly the QTextDocument can be rendered as a QPicture
but pagination is still an issue, while so far there is exactly
one user requesting this feature!

Related small change in ProfileWidget2:
Explicitly hide the tooltip when printMode is true.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-15 21:07:27 -08:00
Dirk Hohndel
3453234a3b Missing half of the previous commit
Oops. I fixed the previous commit, tested the fix, and then forgot to
update the commit and instead pushed it out. That was dumb.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-14 10:43:37 -08:00
Dirk Hohndel
97fa132202 Move proxy initialization into shared code
This way we can use the same code on desktop and mobile app.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-14 09:39:02 -08:00
Dirk Hohndel
111a153295 Preferences: correctly hook up the signals to enable/disable cloud storage
This way the menu state matches the actual verification state again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-10 13:45:13 -08:00
Tomaz Canabrava
f5f2c37184 Remove the PluginSystem
But keep the Interface so it's still userfull to create a new
SocialNetwork  when needed, but it will be part of the code,
and not a plugin.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-09 18:00:56 -08:00
Tomaz Canabrava
66091ff853 Remove Facebook from Plugins
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-09 18:00:56 -08:00
Tomaz Canabrava
4ddf4f6d83 Removed C++11 from the code.
Make Dirk ungrumpy

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-08 16:33:34 -08:00
Tomaz Canabrava
125217074e Remove lambdas: they don't work on OSX 10.7
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-08 15:58:44 -08:00
Tomaz Canabrava
a1ff14a48f Facebook Plugin is aware of it's connection status
This patch makes facebook plugin aware of it's connection status
enabling uploads only when connected, and hooking some things up.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-08 09:45:08 -08:00
Tomaz Canabrava
72b85e3151 We are not using this code anymore, rip it off
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-08 09:45:02 -08:00
Tomaz Canabrava
287977b04c Change from uploadCurrentDive to requestUpload call
Since we can't forbit the plugins to upload more than just the
current dive, it's better to change the name of the call.
also add a stub to make sure it's calling the right method inside
the plugin.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-08 09:44:55 -08:00
Tomaz Canabrava
486857f2b4 Make it possible to connect to facebook again
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-08 09:44:40 -08:00
Lubomir I. Ivanov
9614952611 mainwindow.cpp: remove unused variable 'diveSitePictures'
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-11-07 22:26:25 -08:00
Lubomir I. Ivanov
8e7be1b50a Untangle DiveCalculatedCeiling from MainWindow
DiveCalculatedCeiling is the last class the references
MainWindow in the profile-widget stack.

In modelDataChanged() it looks for the information()
widget and sets a slot for the dateTimeChanged() signal that
information() emits.

To solve the issue we make DiveCalculatedCeiling recieve
a ProfileWidget2 reference and make ProfileWidget2 emit
the dateTimeChangedItems() signal.

ProfileWidget2 itself listens for the dateTimeChanged()
signal that information() emits and emits dateTimeChangedItems()
to notify any possible children/item listeners in the
ProfileWidget2::dateTimeChanged() slot.

The connection between ProfileWidget2 and information()
is set in MainWindow. This makes DiveCalculatedCeiling
unaware of MainWindow and which class originally emits
the dateTimeChanged() signal to ProfileWidget2.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
--
Think delegation.

Tomaz, please take a look at this one, to double check
if i messed up.

also i have zero idea how the mobile app is setting these
connections, if it does so even.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-06 09:58:34 -08:00
Dirk Hohndel
081295cb40 Untangle Profile from MainWindow: files on command line
There's no reason why this should be on the MainWindow widget.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-05 13:45:50 -08:00
Tomaz Canabrava
ff57881265 Preferences: Remove the old dialog and use the new one
The new preferences dialog still needs a bit of fine tuning
but should already work.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-02 12:52:15 -08:00
Tomaz Canabrava
8dad3457ef Make the skeleton Facebook plugin and make sure it is loaded
Currently we need to copy manually the plugin dynamic library
to the /plugins folder.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:52 -07:00
Tomaz Canabrava
d3a8288ad5 Populate the MainMenu with social network actions
The magic happens here: We are iterating over the plugins
and populating the main menu with all actions provided by
them. Currently we can't test this as we don't have a single
plugin. Next patch series of commits will be adding the
Facebook plugin.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:52 -07:00
Tomaz Canabrava
9d1117cd6c Constify, Referencify
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:52 -07:00
Tomaz Canabrava
628eb76af4 It's safe to delete a Null Pointer
So don't check it with an if.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:51 -07:00
Tomaz Canabrava
b7a476169d Preferecnes: add the initial skeleton
This Preferences dialog should be visually similar to the
old one - the main difference is how it acts on the preferences.
It's also not based on .ui files since it's a very simple widget
I prefered to mount it by hand - no more than 6 lines of c++ code.

Right now we have only one preference page on this, and nothing
is hoocked up.

I've also changed mainwindow a bit to only show this dialog for
testing purposes.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:49 -07:00
Tomaz Canabrava
1d6683f3e0 Move Profile widget out of desktop-widgets
The reason for that is, even if profile widget is made with qpainter
and for that reason it should be a desktop widget, it's being used
on the mobile version because of a lack of QML plotting library that
is fast and reliable.

We discovered that it was faster just to encapsulate our Profile in
a QML class and call it directly.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:49 -07:00
Tomaz Canabrava
e49d6213ad Move qt-ui to desktop-widgets
Since we have now destkop and mobile versions, 'qt-ui' was a very
poor name choice for a folder that contains only destkop-enabled
widgets.

Also, move the graphicsview-common.h/cpp to subsurface-core because
it doesn't depend on qgraphicsview, it merely implements all the
colors that we use throughout Subsurface, and we will use colors on both
desktop and mobile versions

Same thing applies for metrics.h/cpp

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:49 -07:00
Renamed from qt-ui/mainwindow.cpp (Browse further)