Commit graph

239 commits

Author SHA1 Message Date
Dirk Hohndel
9bd77b51f5 Give the widget for the new profile a better name
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11 12:36:03 -08:00
Dirk Hohndel
d1c4bcf570 New profile: enable switching between dive computers
This was mostly in place, just needed to be hooked up.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11 12:35:54 -08:00
Tomaz Canabrava
cafc7e4b13 Clear the data when the model resets.
This patch does a few things:
1 - reset the model when user closes the dive file
2 - connects the 'rowsAboutToBeRemoved' in a way that the graphics can
    remove their polygons too
3 - adds a 'clear' virtual method so items that don't follow the rules can
    clean themseves up.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10 09:57:04 -08:00
Danilo Cesar Lemes de Paula
31c45b8c4c Enable the dive planning under a compile flag
Allow subsurface to show the dive planner in case a compile flag is given.

qmake CONFIG+=planner

Signed-off-by: Danilo Cesar Lemes de Paula <danilo.eu@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10 08:08:20 -08:00
Boris Barbulovski
b88958ded5 mainwindow.cpp improvements
* Add missing variable members to the initializer lists.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 14:42:07 -08:00
Boris Barbulovski
9eb47602dd Cleanup SubsurfaceWebServices class
* Remove statuic SubsurfaceWebServices::instance() member.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 14:04:37 -08:00
Boris Barbulovski
449c6fc6f2 DownloadFromDCWidget class cleanup
Remove static DownloadFromDCWidget::instance() method

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 08:17:08 -08:00
Boris Barbulovski
02e9a6d07b PrintDialog class cleanup.
* Remove static PrintDialog::instance() method
* Remove void PrintDialog::runDialog() method
* construct/destruct print dialog on demand

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 08:15:42 -08:00
Boris Barbulovski
3161114106 SubsurfaceAbout class cleanup.
Main change is that now SubsurfaceAbout doesn't have instance object, but
it constructs and destructs dynamically.

 * Remove the static SubsurfaceAbout::instance() class member
 * construct/destruct about dialog on demand
 * Other small aboutbox cleanups.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
ACK-ed-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08 08:00:27 -08:00
Tomaz Canabrava
2322fdfc42 Load options as soon as the progrm starts
Populate the status of the profile tool box as soon as the program
starts.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-06 11:32:11 -08:00
Tomaz Canabrava
185b7a454a Save the old pref system when changing the new one
Since we have now a mix of old / new prefs, remember
to change both when we alter something.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-06 11:31:44 -08:00
Tomaz Canabrava
96e35e542c Move save of preferences to the preferences dialog.
I had a few very strange bugs regarding to preferences (like clicking on
apply twice so things worked), because the code that moved from
"QSettings" to 'Internal Settings Struct' was being triggered on the
mainwindow, *after* the settingsChanged signal was emmited. This should
fix the problem.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-06 11:30:57 -08:00
Tomaz Canabrava
c84ef319a2 Create a toolbox on the left side of the new profile
For quick acess of preferences the show / hide stuff from the Settings
dialog is now in that toolbox and in the future we can put a few more,
like 'Show Notifications Panel' and 'Enable Legend'

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-06 06:34:05 -08:00
Tomaz Canabrava
793879b6fa The plot-profile method was being called too many times.
There was a bug in the old implementation where we needed to
trigger a repaint of the profile almost everywhere. this isn't
needed anymore on the new one, so do not use the same method
that will be killed when I finish this.e

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-17 06:16:35 +07:00
Boris Barbulovski
6cc65f5e1c Fix some memory leaks.
Memory leaks were caused by broken parent/child relations.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16 12:15:47 +07:00
Dirk Hohndel
a27f67c026 Whitespace and coding style updates
Another futile attempt to cleanup the code and make coding style and
whitespace consistent. I tried to add a file that describes the key points
of our coding style. I have no illusions that this will help the least
bit...

This commit should ONLY change whitespace

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16 11:50:56 +07:00
Tomaz Canabrava
52064d9e02 Added debug code to help understand the Profile
This commit adds a QTableView if built in debug mode. This is very userful
to understand the Profile that will be drawn by the graphics classes and
fix the possible errors.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16 10:12:31 +07:00
Tomaz Canabrava
90fc7a23f2 Pass the current selected dive to the new Profile Widget.
This call just passes the selected dive to the new profile widget. No
drawing is performed, I still have to setup the constructors and the rest
of the initialization of the new Profile.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16 10:12:30 +07:00
Anton Lundin
7e9582631d Convert to TRUE/FALSE to stdbools true/false
I had problems with this one on Qt5.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15 15:52:31 +07:00
Anton Lundin
abfd86af59 Remove unused import
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15 15:49:46 +07:00
Boris Barbulovski
7d741a0022 Add-main-window-full-screen-feature
This patch enables main window full screen mode by menu toggle or pressing
F11.

[Dirk Hohndel: whitespace cleanup]

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15 06:28:01 +07:00
Dirk Hohndel
23973e8abd Don't show tanks that aren't used during a dive
Some dive computers will always download all tanks that they store, not
just the ones used in a dive. Most people only want to see the tanks that
they actually used during the dive (and for the others there's an option
to go back to the old behavior, just in case).

All this is only in memory / during runtime. If the dive computer provided
the extra data we will not throw it away.

Fixes #373

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-11 22:02:35 +07:00
Sergey Starosek
a8c0bf3e57 Fix app icon and title for yearly statistics
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-11 06:40:20 +07:00
Sergey Starosek
8ded16fd1b Switch to new UserManual implementation
This enables search within user manual by pressing Ctrl-F.
Esc key closes search panel.

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-10 16:07:54 +07:00
Miika Turkia
88fdf1b138 Show import dialog only when needed for CSV config
We do not need any import dialog when importing normal XML based
divelogs. With this they are imported directly after file selection
dialog. However, when CSV files are detected in the import list, the
configuration dialog is displayed and applied for them. (CSV files are
detected by file extension.)

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-08 05:54:20 +08:00
Miika Turkia
b052b790df Refactoring import to DiveLogImportDialog
Changing the import stuff to DiveLogImport. Now we should have one
import function/dialog for importing divelogs instead of multiple menu
entries.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-03 10:30:08 -08:00
Dirk Hohndel
90ff8e672b Update tank model with custom tanks used in XML files
Fixes #377

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-28 14:56:01 -08:00
Thiago Macieira
8eb6dfdb02 Use QFile::{encode,decode}Name for file names
And make them use UTF-8 on Windows instead of the local 8 bit encoding.
This will also get us the proper NFD encoding on OS X.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-20 09:53:05 -08:00
Lubomir I. Ivanov
1bb7ab30c6 Files: prefer toUtf8() over toLocal8Bit()
We may want to use toUtf8() for win32 considerations.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-19 07:28:25 -08:00
Tomaz Canabrava
77c2c4c5ad Make default font setting actually work
We were asking the widget.font() which returned the font that the
QFontSelector uses to display it's contents, instead of using
currentFont() that's the correctly selected font. duh. :))

Fixes #368
Fixes #375

(for #375 the solution is to select a different font that a) looks better
and b) has the missing characters)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-18 13:38:40 -08:00
Dirk Hohndel
33668ffd35 Don't enter edit profile mode when already editing the dive
This is not the ideal solution. Ideally we might want to simply enter the
profile edit mode if we edit a dive that was manually added. But right now
the code contains lots of assumptions about being in one mode or the other
and as we are redoing the profile / planner classes for 4.1 anyway, I'd
rather err on the safe side for 4.0.1

Fixes #374

(well, it fixes the second bug reported in 374 which is quite different
from the original bug)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-17 06:45:31 -08:00
Dirk Hohndel
fe88a2a476 Don't quit while dive is edited
If the user edits a dive and then quits we try to ask them to finish
editing, first. If the user did this by either clicking the little 'x'
in the window decoration or by hitting Alt-F4 (or similar), we didn't
have that question (only the 'save changes' question in case the dive list
had already been modified.

Fixes #374

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-16 16:37:44 -08:00
Anton Lundin
e6c51cc314 Implement a settingsChanged in DivePlannerWidget
This is so we can default to the GF's from the preferences. We need the
bail handler in createTemporaryPlan, because its triggered when we
change GF's, and if we don't have a stagingDive there, we will access a
NULL-pointer.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-09 07:51:40 +01:00
Anton Lundin
755ea74492 Add support to edit a planned dive
Left to do is to remove all the auto-added deco-points, aka the ones
that had entered==FALSE before we created a dive from the plan.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-07 08:09:05 -08:00
Martin Gysel
d9ca999a17 redraw profile (actually clean it) if no dive is selected
otherwise the previous selected dive is still visible in the profile
view. clicking on edit crashs subsurface: null pointer dereference in
editCurrentDive as it uses 'current_dive' which is null.

Signed-off-by: Martin Gysel <me@bearsh.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-07 07:27:46 -08:00
Sergey Starosek
07e1e416cf Add icon and title for User Manual window
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-06 07:31:08 -08:00
Lubomir I. Ivanov
26d2cc0fef MainWindow: fix setTitle() calls
setTitle() works with an enum that can be fed different values,
and other we may have eventually. For example not only "app title",
or "app title: filename", but others, like dates, certain app status
and so on.

Patch fixes an issue where deleting a single dive in the divelist
resets the title to "Subsurface" only. clearUpEmpty() should only
call setTitle(MWTF_DEFAULT) if no file is currently open.

It also adds a safe-guard to revert back to MWTF_DEFAULT if
no file is open but setTitle is called with MWTF_FILENAME.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-05 08:04:55 -08:00
Sergey Starosek
09a8a85bab Open external links in default browser
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-05 07:31:29 -08:00
Dirk Hohndel
421dceba1e Merge branch 'improve-subsurfaceweb' of git://github.com/thiagomacieira/subsurface 2013-12-04 16:21:44 -08:00
Tomaz Canabrava
9190c97a3c Attempt to fix the 'click goes to 0,0' thing on the globe.
This patch attempts to fix the 'click goes to 0,0' bug on the
globe. it moves a bit of code around and I particulary don't
like the way that we are dealing with 'EditMode', I think I'll
refactor that for 4.1. We are alredy dealing with a bunch
of states, maybe a State Machine will help on removing code-complexity.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-03 18:48:17 -08:00
Thiago Macieira
a1972bc343 Implement the network part of the support for divelogs.de
This implements support for:
 * uploading a zip file containing dives - untested
   (the zip file must have been prepared elsewhere)
 * downloading the dive list and the dive XML files

The networking part is finished, but it's missing the actual import of
the XML files sent by divelogs.de.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
2013-12-03 13:53:00 -08:00
Sergey Starosek
8189790815 More strings to be translated
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-03 11:14:41 -08:00
Lubomir I. Ivanov
bbc022ba18 MainWindow: store the window maximized state
We add the "maximized" entry for the settings group "MainWindow",
and store it on close, so that the window state is the same on
the next run. But then also, we only store the window size and resize
to that size if not maximized. This attempts to preserve a "restored"
window size.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-02 08:47:23 -08:00
Tomaz Canabrava
c94101dd4f Changing the preferences should update the Add Dive interface
Since all internal units are in mm we needed to only update what's shown
on the interface.

Fixes #299

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-26 12:28:16 -08:00
Tomaz Canabrava
e175b1d1ab Remember Trip Selection.
This patch remembers the trip selection across the Dive Tree Model.
It's a tiny bit big because we used to have a variable 'selected
trips' that's now calculed dynamically - this is more future proof.

This is a start of Un-cluttering the view ( for 4.1 I hope to reduce the
code in this class to nearly a half. )

Fixes #303

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-26 11:25:50 -08:00
Dirk Hohndel
8e5c222e98 Create a text entry for default cylinder in preferences
We don't do anything with this just yet.
And frankly, a drop down of the cylinders that we know of would be even
better. But hey, it's a start.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-23 22:01:11 -08:00
Taiane Ramos
450fd9c7bd Save button on menu calls InfoWidget save
When editing a dive and clicking save button on menu bar, it saved
dive information but didn't mark dive as not being edited anymore.
For closing file, user should always click on the save button on
the bottom of the page and then saving it.
Now when clicking save button on menu bar, it will call the
accept_changes before saving to disk.

Signed-off-by: exhora <exhora.tat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-22 21:39:20 -08:00
Tomaz Canabrava
6fd0087a27 Show user-hidden widget when choosing Show All
A user could have hiddden and lost any of the four panels
on the interface. Now when he chooses 'show all', if a
part of the interface is hidden, it will be shown again.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-22 07:35:10 -08:00
Patrick Valsecchi
fe2eabf375 Added a configuration option to have gf_low apply at max depth instead of at deepest ceiling.
Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 08:11:40 -08:00
Patrick Valsecchi
4c4a7a6d96 Refactoring of the configuration handling.
Before, when clicking the OK button on the preferences GUI, we were
updating in-memory preferences from the GUI, saving them to the
configuration file from the GUI, reloading from the file to the
in-memory preferences. Then, to add to the ducplication, when the
application was exiting, some fields were saved again.
Basically the first step and the last step were useless appart from
the fact the the other steps where missing a few fields here and there.

This patch removes the first step and fixes the missing fields.

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
ACKed-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 08:11:40 -08:00