aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
AgeCommit message (Collapse)Author
2014-01-11Fix app icon and title for yearly statisticsGravatar Sergey Starosek
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-10Make divelist search case insensitiveGravatar Sergey Starosek
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-10User manual: overlay search panelGravatar Sergey Starosek
Make search panel floating so that web view does not resize. This commit also addresses following issues: - search now wraps around document - application icon and window title are now back Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-10Switch to new UserManual implementationGravatar Sergey Starosek
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-10Extract user manual web view into a separate classGravatar Sergey Starosek
Provide search functionality which addresses ticket #391 Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-10Make Ctrl-F window shortcutGravatar Sergey Starosek
The shortcut may be used elsewhere, e.g. in user manual Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Remove now stale arguments to "CHANGED()" macroGravatar Linus Torvalds
We now never remove units or percentage signs, and always just compare the string data, so we should remove the hacky arguments that are no longer used. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Add and use 'string_to_fraction()' helper converter functionGravatar Linus Torvalds
This matches the pattern of unit conversion, and will allow us to remove all the code that uses the old complex "CHANGED()" macro that tries to remove units or percent signs. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Add unit-aware cylinder size string parsercGravatar Linus Torvalds
Whittling down on the string parsing that doesn't check user-specified units. Still need to handle temperatures (and will do percentages to match the pattern too), but this is getting us closer to always honoring user-specified units. With this you can say that you have a "10l" cylinder at "3000psi", and it will do the right thing (it's basically a 72 cuft cylinder in imperial measurements). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-09Add unit-aware conversion of pressure dataGravatar Linus Torvalds
This just adds (and uses) a string_to_pressure() to parse pressure units correctly when filling in cylinder pressures. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-08Add a string_to_depth() helper function to match our string_to_weight oneGravatar Linus Torvalds
It's currently only used for the setting of the cylinder switching depth, but now that one should work with user-specified units (so you can set a max depth in feet even if you use metric, and vice versa). In the future, if we also make the unit preferences something you can pass in (with user preferences as a default argument value), we might want to use this for parsing the XML too, so that we'd honor explicit units in the XML strings. But the XML input unit preferences are not necessarily at all the same as the user preferences, so that does require us to extend the conversion functions to do possibly explicit unit preference selection. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-08const'ify our strtod() helper functionsGravatar Linus Torvalds
The C library doesn't use const char pointers for legacy reasons (and because you *can* modify the string the end pointer points to), but let's do it in our internal implementation just because it's a nice guarantee to have. We actually used to have a non-const end pointer and replace a decimal comma with a decimal dot, but that was because we didn't have the fancy "allow commas" flags. So by using our own strtod_flags() function, we can now keep all the strings we parse read-only rather than modify them as we parse them. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-08Make 'string_to_grams()' use proper type safe typesGravatar Linus Torvalds
Make it use 'weight_t' and hide the "grams" part inside the type. That was the whole point of the weight_t type, after all. Returning a "double" was always bogus, since we internally always do integer grams (and the function actually used "rint()" to get all the rounding right anyway). As a result, it's now called "string_to_weight()". Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-08Show import dialog only when needed for CSV configGravatar Miika Turkia
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-08DownloadFromDCWidget: prevent possible leaks for log/dump filesGravatar Lubomir I. Ivanov
If the 'logfile_name' and 'dumpfile_name' were NULL we can simply strdup() them with a new value, but if there was a previous value we need to free() first. C99 6.7.8 allows us to keep said variables without the explicit NULL initialiazation. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-07Not everything can be done with the diveIdGravatar Dirk Hohndel
In commit c3fe1a9e9f79 ("Get rid of pointers to dive structures in the UI") I was a bit too aggressive moving away from pointers to dives. This is only needed for pointers that are held across operations that could change the dive_table. I figured that it wouldn't hurt to get rid of some more pointers as well, but it turns out I was wrong. The current dive that we store in the Cylinder and Weight models can be a dive that isn't in the dive_table at all: the multiEditEquipmentPlaceholder. And when using the diveId we end up finding the original dive in the dive_table and therefore modify the wrong structure. This undoes two thirds of the above mentioned commit. Reported-and-analyzed-by: Patrick Valsecchi <patrick@thus.ch> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-07Restructure overly agressive Q_ASSERTGravatar Dirk Hohndel
Turns out this function can be called when there is no valid dive - so only protect those parts that dereference the dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-07Get rid of pointers to dive structures in the UIGravatar Dirk Hohndel
The assumption that the pointer will keep pointing to a valid structure is fundamentally flawed. And even if that is true today, it might change in the future - just don't do it. Use the diveId instead. The exception is when you own the structure and use it within one UI interaction during which any way to change the dive_table is disabled (e.g., while adding / editing a dive). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-07Setting dive as 'current' when restoring selectionGravatar Tomaz Canabrava
Restoring the selection was not setting the selected dive as current, and thus, breaking keyboard navigation. Fixes #402 Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-07Add CaseInsensitivity to all of the completers.Gravatar Tomaz Canabrava
Just one of the completers had Qt::CaseInsentitive set, setting for all of them. Fixes #400 Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-06Use helper function to display mean depth with correct unitGravatar Dirk Hohndel
In commit 528d0ea0e7bd ("Print numerical value of mean depth") Miika once again forgot the three non-metric countries on this planet... :-) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-06Print numerical value of mean depthGravatar Miika Turkia
This will print the numerical value of mean depth to the profile graph. Fixes #405 Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-03Parse localized weight unitsGravatar Dirk Hohndel
We have the wonderful Qt string functions. Let's use them to make the code simpler and easier to read. Suggested-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-03Maintab: prevent a segfault in the 'Equipment' tabGravatar Lubomir I. Ivanov
When a dive contains no cylinders, clicking the '+' button could SIGSEGV if current_dive->dc.model is NULL. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-03Rename menu entry for log importGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-03Refactoring import to DiveLogImportDialogGravatar Miika Turkia
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-03Merging Import dialogGravatar Miika Turkia
This patch merges import dialog with CSV import dialog. The aim is to have only one import menu entry for log files. This menu entry pops up an import dialog that has tabs for different types of imports (supported dive logs and CSV configuration currently). Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-03MainTab location coordinates displayed in ISO6709 formatGravatar Tim Wootton
changes the location coordinates display in the main tab to use ISO6709(2008) Annex D suggested format. Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-02Fix imperial cylinder sizes in equipment tabGravatar Linus Torvalds
The imperial cylinder sizes are not just in cubic feet: they are in cubic feet of gas at STP. So the imperial/metric difference is not just about converting blindly from liters to cubic feet, you also have to take the working pressure of the cylinder into account. This was broken by commit f9b7c5dfe9d0 ("Make units in cells consistant in CylindersModel"), because those poor sheltered Swedish people have never had to work with the wondrous imperial cylinder sizing, and think that units should make _sense_. Hah. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-02Allow the user to specify weight units explicitlyGravatar Linus Torvalds
Instead of always assuming that all numbers are in the users locale weight units, allow the user to say "kg" or "lbs" explicitly. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-02Ignore units when entering values for equipmentGravatar Dirk Hohndel
Note that this is IMHO the wrong fix. Because we shouldn't just ignore the units, we should do correct conversions. Before this patch, if the user is in metric mode and then types in 4.5kg or 10lbs for a weight, Subsurface ignores the entry and throws it away. Very much not the expected behavior. With this patch Subsurface will take the value, but ignore the unit and assume that the user meant kg (since it's in metric mode). Still not really the expected behavior for 10lbs (which is now 10kg), but if the user typed 4.5kg (which admittedly is much more likely), then with this change Subsurface will do the right thing. Fixes #395 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-29Fix typoGravatar Dirk Hohndel
Reported-by: Peter Konings <peter.l.e.konings@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-29Use field numbers in CSV import instead of indexesGravatar Miika Turkia
For the common user, a field number is more intuitive than field index. So let's use that in numbering CSV import fields. Fixes #388 Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-28Enable https for Windows binariesGravatar Dirk Hohndel
This requires the ssleay32.dll and libeay32.dll to be copied into packaging/windows, first. Fixes #367 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-28Update tank model with custom tanks used in XML filesGravatar Dirk Hohndel
Fixes #377 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-28Remove nonexisting member from headerGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-28Fix bookmark/gaschange setting for UbuntuGravatar Miika Turkia
On Ubuntu, new events have time zero. This is fixed by resetting gc.rightx to maxtime at the end of plot function. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-28Use bookmark flag when bookmark contains headingGravatar Miika Turkia
Bookmark with compass heading is named 'heading' and should use the bookmark icon. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-27Clear equipment tab for trips displayGravatar Dirk Hohndel
And prevent the user from editing equipment in trip edit mode (those edits are both meaningless and of course will be ignored once we save the changes to the trip). Also moved some code for setting up tanks, weights, tags, etc, into the "this is not a trip-edit" part of the updateDiveInfo() function. Fixes #392 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-27Handle editing a manually added dive consistentlyGravatar Dirk Hohndel
Regardless of whether the user clicks in the info tab, makes a change to equipment or starts by editing the profile (i.e., clicking on the little penguin), we should get into the same state and behave the same way. This means that when editing a manually added dive we are always in editMode == MANUALLY_ADDED_DIVE - and editMode == DIVE means we are editing a dive that came from another source. Fixes #379 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-27Fix warning about initialization orderingGravatar Dirk Hohndel
I cannot tell what the potential impact of this might be, but the fix is trivial. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-27Disable DC device node if it is not neededGravatar Benjamin
This patch disables/enables the DC device node based on what type of transport the selected DC uses. The only time the device node field is used is if the selected DC uses a serial transport type. IrDA and USB type transports do not use the device node. Signed-off-by: Benjamin Fogel <nystire@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-26Display warning that dives won't be downloaded when enabling libdc dumpGravatar Dirk Hohndel
The warning is only shown once per session. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-26Small code simplificationGravatar Patrick Valsecchi
Use QStringList::contains instead of iterating the list. Signed-off-by: Patrick Valsecchi <patrick@thus.ch> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-25Don't reset panels while editing a diveGravatar Dirk Hohndel
MANUALLY_ADDED_DIVE is a different flavor of ADD mode (in both cases we are in "planner mode"), so bail out for that as well. See #379 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-24Enable libdivecomputer log or dump from the UIGravatar Dirk Hohndel
Pick filenames for these functions as they are selected. Use the windows-safe fopen function. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-24use qMakePair helper instead of QPair<int,int> and such.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-24Don't use QList if sizeof(item) > void*.Gravatar Tomaz Canabrava
QList is optimized for storing pointer-sized items, thus a QVector is the better choice for everything else. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-24removed unused files.Gravatar Tomaz Canabrava
Thise files dates back from the beginning of the Qt port and were never used anyway... Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-24Don't check if pointer is valid before deleting it.Gravatar Tomaz Canabrava
deleting a null pointer is valid, so we just delete it instead of checking if it exists. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>