First attempt to use the tools on one of our source files.
So far so good. Not perfect, but a HUGE improvement.
Most importantly it effortlessly fixed the Allman style braces introduced
in commit 51220f26ef ("Add recent files to main menu.").
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add(up to four) recent files to File main menu.
Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
C++ style of accessing single instance class object.
Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
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>
* Add missing variable members to the initializer lists.
Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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#368Fixes#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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
This is a bit painful, but we basically walk the samples and pick the
valid tank from the events. And then we do a simple discrete integration
to figure out the mean depth per tank and duration per tank. And then we
assemble all that into per tank statistics.
Strangely the value calculated here seems slightly higher than one would
expect from the overall SAC rate. This inconsistency should be
investigated a bit further, but my guess it it's based on the assumption
that the DC provided mean depth is possibly more accurate than what we can
calculate from the profile.
Fixes#284
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We need to check for this whenever we do something that directly or
indirectly closes the data file. Previously we were missing the straight
"quit". Also, we should consistently check for both editing or dive
addition. And lastly, we should use consistent language with commit
0e9cd09442 ("Make editing message consistent with button labels").
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- Dive list no longer has messed up trip entries
- Dive list is now correctly marked as modified after trips are merged
- When data file is closed, the list of selected trips is cleared which
avoids a potential crash when loading a new data file
Fixes#286
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- Allow ssrf as a default log file suffix.
- Allow sde/dld/db as import log suffices (we don't use the LIBZIP
and SQLITE3 ifdefs anymore)
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
No need to add more code to Subsurface by bringing in std::string too.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Rewrite of the way we handle the last used directory for the loading /
saving of files.
we didn't reuse anything for the code, and that's error prone
and also dumb =p. Reworked that so we have a nice method
to help us out on that. lastUsedDir and updateLastUsedDir
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In the Gtk version there were no option to disable the showing of time
in the mouse over, so this removes that option to limit the amount of
clutter in the settings panel.
This also renames the time and temperature to match the names they used
to have. T -> @, Temp -> T
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We remember what was selected before and restore it. Maybe there's a more
"Qt way" of doing this, but my implementation appears to work :-)
Also remove unconditional debug output that snuck into an earlier commit.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We previously did did bad things when running with an empty configuration.
This attemps to clean it. We will now correctly handle the splitters in
almost all cases ( if I didn't break anything on the way. )
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Let the user choose if the calculation of ndl and tts is worth the time
it takes.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This now offers the correct gases for which we have cylinders defined.
For both the planner and add dive we still don't end up with the correct
cylinders in the resulting dive. But that's for another commit to fix.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This should leave the program in a consistent state after add dive was
cancelled (and do the right thing in case the dive list was empty).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This just makes sure that we do the right thing with the staging drive,
that we don't mess up the selection, the we are smart about using our
helper functions, etc.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is intended to allow the user to provide the gases / cylinders that
she will be diving with. With that information the planner can warn the
user about insufficient gases, but more importantly it can show relevant
gases in the gas select drop down.
Right now the add cylinder button doesn't add a cylinder - that's a
problem.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The user could add a dive, and in the middle click on the 'plan'
button. Since we didn't cared about that on the widget, a lot of
inconsistencies could occour. this fixes that by setting a flag
on the Planner, that has now three modes: nothing, plan and add.
(maybe in the future an edit mode will be valid too.)
If in 'NOTHING' mode, user can enter the addition, edition and
planning. If in any other mode, user can't do a thing. The mode
gets back to NOTHING when user accepts or cancels a plan / add
/ edition.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is a try: when the user changes the orientation on the columns
by clicking on the title of them and organizing by something that's
not the number, we lost track of the opened branches. this commit
doesn't fix that, but it fixes a possible similar issue.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
I got a bit lost trying to find the code that handled DiveList columns
today, so I thought it was better to move it to its file, after all we
do have a divelistview.h :)
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This just proves one point: I'm retarded.
I moved some code around and forgot to close the old group, so I created a
group inside 'MainWindow' that handled the ListWidget, wich was not the
right thing to do at all.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I basically rewrote the way we handled the splitters. It now uses a state
to know what it's doing, and will only update the value of the
saved-to-disk splitter size if the state shows the splitters (currently
only VIEWALL), where all the other states should hide the splitters, and
the values of the splitters don't matter.
Fixes#225
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since the model name is written into the XML file it has to be a literal
string that isn't translated. Otherwise a datafile written in one locale
behaves differently when opened by Subsurface under a different locale.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch enables editing a dive that was manually entered,
it doesn't cover dive plans yet because on the plan I need to
figure out what are the 'user-entered' points, and what are
the algorithm point. and I feel lazy. =p
One last thing that's missing is to revert the dive to the
previous condition if the user cancels the edition, currently
canceling and applying ok is the same thing.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Added a new option to edit the dive in the profile view. The option
will only be visible if the dive was manually entered or if the dive
is a plan.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
We cannot use tr("").toLocal8bit().constData(); on a function
that expects a char* because the object will be deleted on the
next line, so a strdup is necessary.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
This patch does the hooking up to show the dialog of the
divelogs.de window when the user selects it on the menu.:
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Created a WebService dialog that will handle download and upload
from all child based webservices. Also, ported the currently - only
- one webservice to use the new dialog.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Implement exporting in UDDF format as was done in Gtk version. File menu
exports all the dives, right click on selection exports the selected
ones.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This tracks the autogroup state remembered in data files. Toggling the
checkable menu item causes the divelist to be marked as changed. This
might actually be untrue - but that's really hard to track so this is the
"better safe than sorry" approach.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is really nice to have when looking at specific parts of a dive.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch implements GUI for importing CSV log files. One is able to
configure what columns contain time, depth and temperature fields.
Pre-configured log applications currently included are ADP log viewer
and XP5. (Both of these use actually tab as separator, so the field
separator currently hard-coded.)
[Dirk Hohndel: minor fixes]
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- remove the build flags and libraries from the Makefile / Configure.mk
- remove the glib types (gboolean, gchar, gint64, gint)
- comment out / hack around gettext
- replace the glib file helper functions
- replace g_ascii_strtod
- replace g_build_filename
- use environment variables instead of g_get_home_dir() & g_get_user_name()
- comment out GPS string parsing (uses glib utf8 macros)
This needs massive cleanup, but it's a snapshot of what I have right now, in
case people want to look at it.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch fixes some unsane values that was being retrieved
by the ui-files on first time opening. it creates a basic layout
of the application using the current desktop size.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Those preferences removed ( basically the ones about visibility of
the List View of the Table ) are now managed by the Qt Settings
system, and thus there's no need to have them there. wich gave us
a pretty good cleanup.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Some people (free divers) are loving ft/s or m/s units for vertical speeds.
Now they can choose between /min or /s in the configuration (only Qt UI).
Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For a new installation, subsurface will now start on fullscreen,
this fixes the bug where subsurface would start using the interface
file ( mainwindow.ui ) configured size, and that silly monster
always changes when editing something.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
The first time the user loads subsurface, the default_filename
is not configured yet, but yet the software tries to load "",
sending an error message that this file doesn't exists.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Taiane Ramos <exhora.tat@gmail.com>
This means we don't have to new/delete them, which is a waste of
overhead.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This means we can also remove the forward declarations.
This is the first step in removing the memory allocation for the ui
sub-classes. Without the second step, this commit is just making the
compilation time increase for no good reason :-)
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch removes the magic indexes used to control the mainwindow
display of the profile and planner by an enum. a bit more verbose
but hard to miss.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Things need to be cleared out and disabled. But fixing this bug leaves
another issue - while the newly selected dive after a delete acts as if it
was selected, it doesn't show up as selected in the dive list.
Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is much friendlier than just showing an empty profile. I picked a
nice and simple three level dive. 25 minutes at 18m, 15 minutes at 9m, and
a safety stop.
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This gets things mostly right.
It creates a dive and uses the planner widget to create samples which are
copied into the dive. It fills in some reasonable defaults (DC model,
timestamp), but doesn't allow editing the timestamp (or the temperatures
and air pressure).
On accept the planner gets reset and the dive appears correctly in the
dive list.
Cancel still needs to be handled.
And I bet there are many subtle bugs lurking here and there. But it's a
start.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This looks like it might work, but since we keep recreating the dive, the
info entered in the info pane is actually lost. But it's a step in the
right direction.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Right now this is just calling the same code and setting a flag whether we
are planning or adding a dive.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is really nice to have when looking at specific coutures of a dive
or events.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This fixes a crash in the current Qt subsurface code that can happen
after downloading dives from a dive computer, and the new dives merge
with old dives, causing the old dives to be re-allocated into the
merged one.
In that case, the list widgets don't get fully updated, and contain
stale pointers to old dives that no longer exists. Doing anything that
refreshes the display will hide this problem, and you do need to have
multiple dive computers on the same dive to trigger it in the first
place, so it's reasonably hard to hit, but very annoying when you do.
This patch just makes us reload all the dive UI tables, which may be
overkill. It also doesn't actually fix the fact that we seem to do
"process_dives()" within the context of the downloader thread, which
looks like a possible source of races. The "process_dives()" should
also be moved to the main thread, but needs the preferDownloaded()
information that is part of the download window, so it doesn't fit
here. Somebody else (Tomaz?) will hopefully fix that part.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Plug the cancel action on the dive planner ( before that, only by
hitting the 'ESC' button things worked, so now you can also click
on the Cancel box that's on the right of the planner profile window.
Also, the beginning of the 'ok' code is also at place.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
The code to initialize the weight systems from the last datafile loaded
had not been brought over from the Gtk version.
We now correctly update the data structure when loading file (but not yet
when editing values).
Most likely the same needs to be done for the tanks as well.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The Command line execution of Subsurface happened before the
GUI was created, this leaded to various bugs by me(tm) over
time. This patch seems to fix all of those, by reusing the
same code for GUI interaction and CommandLine interaction.
I had to rework how the main.c worked, it used to be C code
calling C++ code, and this is non desirable, since C doesn't
really understand C++.
I Moved all of C-related code to 'subsurfacestartup.c/h' and
created a tiny wrapper to call it, so all of the C code is still
C code, and the new main.cpp calls the mainwindow->loadFiles and
mainWindow->importFiles to get rid of the bugs that happened before.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Merged the shared code for the three table views into
one code, this way less code is needed if we need to
construct another tableview in the future.
I still need to clean some of the models too.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Added a new widget to control the DivePlanner, now we
have two widgets, a graphics one and a qt sidget based one.
the Technical divers will most likely use the QtWidget one
while the hobbists will most likely use the QGraphicsView
one. there's not a option to choose one, they both will
appear at the same time.
Next step: make the screens to work.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Looks like the QTextBrowser can't render the manual correctly.
Also, QWebView provides a better way to find contents on a webpage,
which is an important feature for an user manual (to be implemented).
Signed-off-by: Danilo Cesar Lemes de Paula <danilo.eu@gmail.com>
PrintOptions is a QWidget class to be used as an
addition to a future print dialog (possibly based on
QPrintDialog). Currently only contains a couple of
radio buttons.
PrintDialog (printdialog.cpp/h) which is a basic QDialog
is currently added for testing only and it holds
an instance of PrintOptions.
Calling File->Print opens this test dialog for now.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
While in zoomed mode and when resizing the splitters or
switching views the profile tooltip can end up being at the
wrong location and also the zoom state becomes corrupt,
so perhaps the entire transformation needs to be reset.
To prevent the bug we listen for relevent to the profile
splitter resize event, view changes and clear()/plot() the
entire profile graphics.
This is an slow/expensive solution and perhaps there are
cheaper alternatives e.g. updating only the scene rectangle
and tooltip, somehow.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Added the left / right shortcuts for moving the handlers around in time,
this also made me wonder why we have the 'previous dc' on the menu, it
got actually to broke my code on the shortcuts for the planner because
they are active everytime - should they be active only when the profile's
visible or they serve any other purpose?
If they serve only for the profile, I'll get them out of the menu and
put them in their proper place - the profile view.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Most child windows should be closed with the main application
window otherwise if left open and if making specific
modifictions could potentially cause a SIGSEGV.
To solve that we mark all custom windows/dialogs with
the Qt::WA_QuitOnClose attribute on instance creation.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Now, activating the dive planner will hide the profile
and show the planner on the same place. we still need
a way to 'cancel' or 'accept' the profile created.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
1) Make a call mark_divelist_changed(TRUE) when the user adds new
cylinder or weight entries.
2) Call mark_divelist_changed(FALSE) in
MainWindow::on_actionClose_triggered() so that each time after
a file is closed or a new one is created it does not ask immediately
the user for a save confirmation for the blank file/divelist.
3) Call mark_divelist_changed(TRUE) once a dive's geo location
has changed in GlobeGPS::changeDiveGeoPosition().
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There are a couple of problems with said icons:
- When the Equip. tab is first seen, no relative event is monitored
so that the correct position is updated and the icons are positioned.
To solve that we connect the signal MainTab::currentChanged(int)
and call MainTab::equipmentPlusUpdate().
- When the info-profile QSplitter resizes with a snap towards/from
the edges of the main window, no resize handler is called such as
MainTab::resizeEvent().
A solution is to monitor the resize of the info-profile splitter
with MainWindow::on_infoProfileSplitter_splitterMoved() and again
call MainTab::equipmentPlusUpdate()
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If a file has been opened from the command line or via the File
menu the main window title becomes "Subsurface: filename.ext".
Title also updates if 'File->Save As' is called. "Subsurface" only
is displayed when no active file is present or post 'File->New'
or 'File->Close'.
To make this work a new public method is added - MainWindow::setTitle()
and also an enum type MainWindowTitleFormat, which should allow
more complicated formatting, such as showing the selected dives
or the total number of dives (e.g. MWTF_FILENAME_N_DIVES).
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For viewing the Globe section (pane) we need to collapse
both the 'list' and the 'main' splitters.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
File->New in the GTK version performed the same as File->Close.
Creating a new file may also ask the user if the current file has
to be saved.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Similar to File->Open but for multiple files and without
calling on_actionClose_triggered().
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The dialog is similar to the one in the GTK version
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Added the first files and skeleton code for the visual
dive planner. now I need to fill things. The code is
using the print action borrowed, this will need to move
to a better choice in the future.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This data structure was quite fragile and made 'undo' when editing
rather hard to implement. So instead I decided to turn this into a
QMultiMap which seemed like the ideal data structure for it.
This map holds all the dive computer related data indexed by the model. As
QMultiMap it allows multiple entries per key (model string) and
disambiguates between them with the deviceId.
This commit turned out much larger than I wanted. But I didn't manage to
find a clean way to break it up and make the pieces make sense.
So this brings back the Ok / Cancel button for the dive computer edit
dialog. And it makes those two buttons actually do the right thing (which
is what started this whole process). For this to work we simply copy the
map to a working copy and do all edits on that one - and then copy that
over the 'real' map when we accept the changes.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Yearly stats are being displayed. the code is similar to the GTK one,
but I advise the reader that it's a bit risky ( I got an unreproducible
crash but it seems to be fixed now. ). The selection behavior is *weird*
and I have no idea why, but I'm very sleepy - will try to look at
it again tomorrow.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This simply creates a view to show the model, while doing that
I noticed that the model header wasn't showing, so I fixed it too.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
So, I changed a lot of code to reduce boilerplate on models in the
future. Currently we do not have a lot of models, but this can increase
quite rapdly. There's a second TreeModel in the works, the Yearly
Statistics, this patch will save around 250 LOC for this new model,
and more and more models will give us a greater saving.
Iwll do that for the table models in the future too - I did the tree
models now because they are the most complex case and I didn't wanted
to create a second tree model without this.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This code adds a Renumber Dialog, that's most a copy & paste
of the GTK visual, I didn't tried to do anything fance with it,
but I still dont like how it looks like. a better management
form is needed. :)
( Well, actually my dislike is mostly because it's on a menu
and it's on a popup, I think a 'toolbox' should exist to hold
all of those widgets that don't belong to the menu - will try
that later )
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Fixed the show / hide dialog shortcuts to take the splitter into consideration,
So, here's the deal.
We have a few QSplitters that takes care of helping us with the
size of a few widgets, they are ok, and we should continue using them
to manage the visibility of them too. But the way that we did before was to
widget->hide(); something, and if you hided something using the splitter,
by holding it's handle and collapsing the widget, then you used the 'ctrl+number'
shortcut to show it, it whould only show a gray panel.
This patch makes everything behave using the splitters.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
For consistency I didn't change the meaning of Ctrl-1/2/3/4 and added
this as Ctrl-5 - but one could just as easily make the argument that
"ViewGlobe" should be Ctrl-4 and "ViewAll" should be Ctrl-5.
This ensures that only one of the four widgets is shown in the
individual modes, but it doesn't address the drawing issues with the
profile.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Added a simple TextEditor in the graph for the 'Dive Plan' mode,
this text editor is very simple, so the user can double click on
'depth' or 'duration' to set the depth or duration of the dive.
Since this was a test, only 'duration' was done, and I'll add
duration on the next commit.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This patch adds a dive from the menu, it's the dive that will
be used to add a new dive plan. so, I also removed the option
'add imput plan' from the menu.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>