Commit graph

3301 commits

Author SHA1 Message Date
Maximilian Güntner
6ee2d88896 Hide TadWidget and Label when editing a trip
Also hide ui.CoordinatedLabel when editing a trip,
since ui.coordinates is hidden.

Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-05 17:05:29 +09:00
Dirk Hohndel
0f66e7a025 Show a different message when editing more than one dive
I still wonder if we have all the semantics correct for multi dive
editing. This will need more testing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-05 15:57:24 +09:00
Dirk Hohndel
e90f5c28df Fix dive merging
When merging dives, the indices of the following dives change - so we need
to adjust the variable used in the for_each loop.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-05 15:44:16 +09:00
Dirk Hohndel
01d515b5d8 Remember the column we are sorting by
A call to DiveListView::reload always reset our sortcolumn to be 0.
Instead we are tracking the correct sort column and sort direction.

This also removes an obsolete private member that was unused.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-05 14:23:37 +09:00
Dirk Hohndel
eaa0d647b7 Don't force the DiveListView to be a tree when reloading
We should keep whatever view the user last used.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-05 13:56:20 +09:00
Dirk Hohndel
9383693928 Create installer with qmake
This is seriously flawed. makensis is run twice for some reason. I also
noticed that the data and xslt directories under packaging/windows aren't
created when running make install. Running
	make -f Makefile.Release install_marbledir install_deploy
works, but obviously this should be taken care of by the dependency.

The installed binary under Windows is not finding its icon, the
translations are missing... lots of work left to do here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-05 13:05:14 +09:00
Dirk Hohndel
7966f72fb7 Merge branch 'tagwidget-pr' of github.com:mguentner/subsurface 2013-11-02 12:56:18 -07:00
Dirk Hohndel
13ee1943eb Fix warning about ambiguous if / else nesting
Should have cleaned that up when committing the code.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-02 12:53:57 -07:00
Linus Torvalds
58fa613236 Speed up XML loading
This tries to speed up XML loading for large XML files (and thus
subsurface startup times) by trimming the fat off our own matching code.

The actual libxml overhead (particularly string allocation) tends to be
the dominant part, so this only speeds up a big load by about 12% for me,
but hey, it can be noticeable. Dirk's example nasty 175MB xml file with
~5200 dives takes "only' 7.7 seconds to load, when it used to take 8.8s.
And that's on a fast machine.

For smaller xml files, the dynamic loading costs etc startup costs tend to
be big enough that the xml parsing costs aren't as noticeable.

Aside from switching the node names around to "little endian" (ie least
significant name first) format to avoid some unnecessary strlen() calls,
this makes the nodename generation use a non-locale 'tolower()', and only
decodes up to two levels of names (since that's the maximum we ever match
against anyway).

It also introduces a "-q" argument to make startup timing easier. Passing
in "-q" just makes subsurface quit imediately after doing all necessary
startup code.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-02 12:51:32 -07:00
Maximilian Güntner
c4d8b6a4d5 Fix the inconsistent behaviour of QCompleter
The TagWidget behaves now similiar to a QLineEdit.
Pressing Enter/Return will now close the completion widget.

Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
2013-11-02 17:10:34 +01:00
Maximilian Güntner
2967391ffe Correct tabstops in MainTab
Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
2013-11-02 17:10:34 +01:00
Maximilian Güntner
5d93242b34 Corrected indentation, added license/copyright
Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
2013-11-02 17:10:30 +01:00
Maximilian Güntner
04cdfce782 Added a custom widget for tagging dives
A custom tag widget has been added to MainTab.
Tags are seperated by a comma ",". The implementation
supports escaping a comma by using "\,".
While typing, the widget supports the user by suggesting
tags using a QCompleter.

Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
2013-11-02 03:37:31 +01:00
Maximilian Güntner
6fe8cb6521 Replaced the tag implementation
The new implementation supports custom tags
which are provided by the user as well as
default tags which are provided by subsurface.
Default tags can be translated and will be written
to XML in their non-localized form.

Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
2013-11-02 02:55:03 +01:00
Maximilian Güntner
2ef80930ff change the key from const char * to QByteArray
if trGettext() gets called with a *text that resides
in the stack, the QHash will return incorrect values after
the second call of trGettext() with that *text.

Example (assuming nothing has been translated):

void func(const char *text) {
        char *translated = trGettext(text);
        doSomethingWith(translated);
}

func("foo"); (1)
func("bar"); (2)

(1) *translated is "foo"
(2) *translated should be "bar" but is "foo" because
    the key (const char*) points to the value "foo"
    which has been set in the previous call (1).

Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
2013-11-02 02:55:02 +01:00
Dirk Hohndel
9e63539237 Merge branch 'editMode' of github.com:tcanabrava/subsurface 2013-11-01 11:19:23 -07:00
Tomaz Canabrava
0e96c9f62e Enable undo for the Edit mode on Added Dives.
This enables undo for the edit mode on added dives, it uses the
premade backup to fill the old dive with data. :)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
2013-11-01 14:06:03 -04:00
Tomaz Canabrava
23a193b0d1 Changed the backup implementation of the samples on EditDive.
Changed the backup implementation of the samples on EditDive,
it's way cleaner now what's happening, and it's also better for
the cancel edit.

Next: The Cancel Edit.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
2013-11-01 13:45:14 -04:00
Tomaz Canabrava
f7cd3e780c Enable editing a dive that was manually entered.
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>
2013-11-01 11:48:34 -04:00
Tomaz Canabrava
d9afcdc8cb Code cleanup - Stop calling the same 6 lines everywhere.
There's a method named refreshDisplay, fairly unused, let's
use it a bit mroe.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
2013-11-01 09:43:41 -04:00
Tomaz Canabrava
69d4ccae6d Added a new option to edit the dives.
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>
2013-11-01 09:33:39 -04:00
Tomaz Canabrava
a7b19b251d Removed Reference to dangling pointer.
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>
2013-10-31 16:50:09 -04:00
Miika Turkia
1a4d098ef2 Add alt based shortcuts to access menus
This adds alt-f shortcut to access file menu as well as other similar
alt based shortcuts for other menu items.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-27 10:58:52 -07:00
Dirk Hohndel
899f077abd Merge branch 'webservices' of github.com:tcanabrava/subsurface 2013-10-27 03:22:09 +00:00
Danilo Cesar Lemes de Paula
6259b0301b fix device probing for UEMIS computer on linux
When the device probing was ported from the Gtk version
we skipped the UEMIS code.

It's still based on the contents of /proc/mounts, although
without the use of glib's helpers.

Signed-off-by: Danilo Cesar Lemes de Paula <danilo.eu@gmail.com>
2013-10-25 23:56:27 +00:00
Tomaz Canabrava
a4da3004da code cleanup: removed unused function from mainwindow.h
The setupSplitters method was created quite a while ago
to deal with the splitters when I didn't used a more sane
approach. I forgot to delete it back them, removing now.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-24 23:04:34 -02:00
Tomaz Canabrava
7bea2e1be0 Minimum hooking-up done, divelogs.de shows on menu-activation.
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>
2013-10-24 23:02:59 -02:00
Tomaz Canabrava
6cf875ed92 Reorganized the downlads menu for the inclusion of more webservices.
This patch moves around a few items on the menu to a new submenu
downloads/uploads. I think it's not the best way, but it already
fives a bit more of 'unverbosity', because the old menu had
'Download from Dive Computer', 'Download from Webservices', and
now we would introduce a new 'Download from Divelogs.de'
I tougth it was better to have a 'parent' named 'Download' and
put all children inside. this can grow quite big as soon as I implement
the plugin system for that.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-24 22:57:43 -02:00
Tomaz Canabrava
216f9212b9 Added the skeleton for the Download / Upload from Divelogs.de
Added the skeleton code for the Download / Upload from Divelogs.
de webservice. Now I need to hoopup things from the .ui side and
do the actual implementation of the code.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-24 22:52:11 -02:00
Tomaz Canabrava
06ba04ab78 fix the string of the subsurfice webservice on the settings.
The setting was 'webservice', but this is too wide, since we are
supporting more than one. changed it to 'subsurface_webservice_uid'

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-24 22:39:21 -02:00
Tomaz Canabrava
d2b87e0eb5 Fixed a crash when the user canceled the download from webservice dialog.
Null references, ah, love them.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-24 22:38:41 -02:00
Tomaz Canabrava
5eb2cc4594 Created a 'WebService' dialog that will handle download and upload.
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>
2013-10-24 22:30:21 -02:00
Michael Andreen
695f64a23a Subject: [PATCH] No need to center on dive after editing coordinates.
This is done automatically now.

Signed-off-by: Michael Andreen <harv@ruin.nu>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-24 16:58:05 +01:00
Miika Turkia
89770249d0 Add current date to CSV import
Since CSV import does not include date/time stamp, we need to generate
one for ourselves. This patch uses current time of the import as dive
time.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-20 15:27:07 +02:00
Miika Turkia
3e48511318 Export dives in UDDF format
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>
2013-10-20 15:26:02 +02:00
Miika Turkia
bdedf46e4c Get rid of compiler warning on format strings
This gets rid of compiler warnings "format not a string literal and no
format arguments [-Wformat-security]". E.g. when building distribution
packages these warnings are often treated as errors preventing the
build (with good reason).

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2013-10-20 15:25:27 +02:00
Anton Lundin
8873381496 Use configured vertical speed units in ruler
Ruler was hard-coded to use seconds as speed unit. This makes it use
get_vertical_speed_units to switch between seconds and minutes.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-20 06:41:30 +02:00
Thiago Macieira
f22065874b Remove the "in C" part about Subsurface's description
It's not written purely in C anymore. There's quite a lot of C++ now,
not to mention Perl, XSLT, shell scripting, etc. :-)

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17 20:28:22 -07:00
Dirk Hohndel
75a004d44a Some adjustments to "save as"
The popup menu entries should be all lowercase.
Also we should handle this the same as regular save and open when it comes
to remembering the last path.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17 20:26:38 -07:00
Tomaz Canabrava
ed28628449 Added 'Save As' option on the dive list menu.
This adds the 'Save As' option on the dive list,
very straigth forward, just simple and beauty.
tested and working.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17 20:19:50 -07:00
Dirk Hohndel
8259b1a59a Implement hook up autogroup menu
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>
2013-10-17 16:30:32 -07:00
Dirk Hohndel
8f623c2c72 Fix marble losting track of zoom level
Marble had a bug on the way it treats zoom level, there's
no way for it to find out if it's user-input or algorithm input
and when a user clicks on a dive, it spins and centers on it,
but if the user clicks on another dive when it's still spinning,
it will get the zoom in the actual state ( spinning, usually zoom
is far away from the first position ) and continue the spin to the
other position.

This patch works by saving the first location and triggering a
helper function with a timer that will only update the zoom level
if the timer is not active ( and thus, will not get the bugged
zoom state set by the animation. ).

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17 15:00:22 -07:00
Anton Lundin
579d1cb915 Show SAC in the mouseover.
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>
2013-10-17 14:56:52 -07:00
Anton Lundin
437246d3ed Move sac-calculation to profile.c
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17 14:54:11 -07:00
Anton Lundin
0bdf11b094 Rename T: to Temp: in Information box
D as in depth, T as in time and not another T as in temp.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17 14:51:19 -07:00
Miika Turkia
70a3e769e1 Open CSV files only via the GUI
Since the CSV import transformation is now parametrized and does not
have any defaults, we need to use the CSV import GUI. Thus give an error
message if one is opening CSV file directly.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17 12:19:45 -07:00
Miika Turkia
f771a94a85 Get information only from first line at each time
As some CSV log files seem to contain multiple sample lines for a single
time, we'll just grab the first one of them to avoid duplicates.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17 12:19:23 -07:00
Miika Turkia
3ec6871720 Field variables for CSV import
Field variables for the CSV XSLT import have disappeared at some point
during developing GUI for the CSV import. So adding them to the XSLT for
the field selections to have effect.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17 12:19:06 -07:00
Lubomir I. Ivanov
861b524e7a Helpers: move some date related function to qt-gui.cpp
divelist.c:
get_dive_date_string()
get_short_dive_date_string()
get_trip_date_string()

MinGW support for *printf and parameter positions (e.g. %1$d)
is horribly broken. Instead of implementing *proper* support
for this feature Microsoft decide to ignore the standard (again)
and they implement new functions with the '_p' suffix,
such as 'sprintf_p', which seem to be available from a 2003 runtime.
To top that 'sprintf_p' is not really a 'sprintf' but rather
a 'snprintf'.

It seems that the MinGW people ignore the issue and do not provide
wrappers of any sort, or at least for the current recommended compiler
for Qt 4.8.5 on Windows - which is a 4.4.0. A note of warning;
inspecting how MinGW does certain things in headers such as stdio.h,
can ensue bad dreams or other negative effects on to the viewer.

This forces us to move the following functions from the 'back-end'
(divelist.c) to the 'front-end' (qt-gui.cpp) and use QString.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-16 15:04:44 -07:00
Miika Turkia
4c49670cdb GUI for CSV import
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>
2013-10-16 12:44:07 -07:00