aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.cpp
AgeCommit message (Collapse)Author
2015-06-03Remove unnecessary callsGravatar Tomaz Canabrava
All those calls are unnecessary: The first will be called when the QComboBox in the MainTab changes its index, and the other two calls shouldn't be called: the only thing that should change a dive site inside the LocationManagement is the LocationManagement. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01Create a new DiveSite when user clicks on addGravatar Tomaz Canabrava
Also reorganized a bit of the code, and renamed a few misleading methods. [Dirk Hohndel: remove some C++11 code] Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01Manage Dive Site from the MainMenuGravatar Tomaz Canabrava
Trigger the ManageDiveSite from the MainMenu. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01Move helper function to the appropriate fileGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01Cloud storage: only make this available with new enough libgit2Gravatar Dirk Hohndel
The credential callback doesn't appear to work (at least not the way I implemented it) with v0.22 and earlier. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31Cloud storage: first stab at implementing cloud storageGravatar Dirk Hohndel
So far there is no mechanism to actually create a repository on the server, so this only works with the two test repositories. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29Move DivePictureModel to qt-modelsGravatar Tomaz Canabrava
This class will surely be used on the mobile version, and it was very tangled inside divepicturewidget. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29Fewer rebuilds triggered by changes in models.hGravatar Tomaz Canabrava
Models.h now is quite minimal, I'll keep it like that for now, until it grows huge again. I've also cleaned a bit the headers that are using it so only the ones that actually need the stuff that I've left behind will actually include this file. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29Move the YearlyStatisticsModel to qt-modelsGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29Move WeigthSystem Info model to qt-modelsGravatar Tomaz Canabrava
This is another effort to make it easyer for the mobile interface of Subsurface. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29Move Tankinfomodel to its own fileGravatar Tomaz Canabrava
Another change to make it easier to program the mobile ui. This was a fairly easy patch: just moved the contents of the file and fixed the includes. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29Move DivePlannerModel and CylinderModel to qt-modelsGravatar Tomaz Canabrava
Still trying to make it easier for the Mobile Port: This patch is a bit bigger than I hopped, but it was the smallest that I could get. A lot of TODO items where added where I broke the code because the current implementation would break the QML implementtion on the designer. I'll most probably fix those myself when I finish the transition to the models to the new folder. I only moved both models at once because there's an interdependency between them (seems inevitable, tough, but I'll take a better look at it later). Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-27Strip the default suffix if saving to git branchGravatar Dirk Hohndel
For some reason the file selection dialog box now always adds a default suffix to the file name we pick - which results in our test for git storage to fail. So if the filename looks like "<path>[branch].ssrf" then remove the suffix that was added. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-26Do not set the dive_site when changing divesGravatar Tomaz Canabrava
We should only set the dive_site on the dive site management widget when we are going to use that information, this is because the dive_site management widget will filter all dives on the dive list. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-25Layout issues: Fix the Profile/ToolbarGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-25Layout issues: Remove auto layout management from mainwindow.cppGravatar Tomaz Canabrava
While this worked for a bit, it was very error prone as it relied in layout having specific names, and layouts in the .ui files are treated as substandard items. Every time a 'break layout' command is issues (and it's issued quite a lot when trying to reorganize the items on the widget) all layout items are removed and new ones are added later, without any of the names. Since the new layout can be different the old names are not usefull anymore - and a clean compilation won't trigger a single warning either: the name resolution is done at runtime and not at compile time, so it would just fail silently. Instead of brute-forcing each layout to have 0,0 or 5,5 margins, we should put the correct values on the .ui files. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-22Location management: reflect changes to the coordinates on the mapGravatar Dirk Hohndel
This is a bit aggressive as it changes the globe with every single character that's entered, but it's better than what we had before. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-21Fix typoGravatar Paul-Erik Törrönen
Loockup -> Lookup Signed-off-by: Paul-Erik Törrönen <poltsi@777-team.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17Better name for the disable/enable geolocation editGravatar Tomaz Canabrava
'enable' and 'disable' is too generic, and we are only blocking the geolocation edit. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17Move Locationinformation to its own file.Gravatar Tomaz Canabrava
The SimpleWidgets file was getting too big, and location information will also need a new model - a good way to do not mix everything is to put things in a new file. [Dirk Hohndel: added missing include of stdint.h] Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-17Fix signal connectionsGravatar Tomaz Canabrava
I don't know what happened to me, I connected to some signals that didn't exist at all. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-11Make sure that the save file dialog actually is marked as suchGravatar Dirk Hohndel
While this worked on Linux, on the Mac we didn't have an input field to enter the file name. With this we explicitly declare that this is a file save dialog and that the user can specify a non-existing file name. Fixes #872 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-10Get the location information in a separate threadGravatar Tomaz Canabrava
This makes Subsurface usable faster for those without a good internet connection when they are opening an older data file. While parsing, we are only feeding an vector of locations, after the parsing is done, we traverse the vector searching for the information on the web. I need to also add a way to stop if there`s no internet connection - but this will be another patch. Also, fixed two small memory leaks from the old imp. [Dirk Hohndel: cleaned up the whitespace mess] Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-08Only warn when trying to replan a logged diveGravatar Robert C. Helling
If there are more than 100 samples, average some of them so we end up with no more than 100. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-29Display a notification while image hashing is ongoing.Gravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-14Show error messages for incorrect edit invocationGravatar Gehad elrobey
Planned dives must be replanned while manually added dives must be edited. Show error messages to handle wrong user input. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-04OSTCTools-Add support to import .dive filesGravatar Salvador Cuñat
OSTCTools is a windows based software by Robert Angeymar which performs configuration upgrade, memory analysis and download tasks for H&W OSTC devices. Downloaded dives are stored in files (one archive each) with the raw binary data heavily padded at the begining of the file, and some other data not included in H&W dive header protocol as the device's serial number. The import function simply takes the raw data part of the file and lets libdivecomputer do the parseing. Then adds some additional info as OSTC reported dive number and serial device number. Please note that OSTCTools is *not* a real logging software, it simply gets the DC raw data, so there isn't any information about dive site, equipment and so. Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-30Make the image hashing non-blocking againGravatar Robert C. Helling
...it had become blocking with 1e3700c1 Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-30Manual added dives edit button is missingGravatar Gehad elrobey
once the manual added dive is added it can't be edited directly, This can be fixed by adding an edit button to the log menu, this will be consistent with the plan/replan buttons. Fixes #847 Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-21Implement handler for cancel button of Save As dialogGravatar Claudiu Olteanu
When an user opened the "Save as" dialog and pressed the cancel button a null string was returned. Therefore the file_save_as function returned an error which was lately shown when the file_save function was called. Now the function checks if the cancel/exit button was pressed and returns. Fixes #844 Reported-by: longjohnsilver Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-20Prevent crash when clicking re-plan without selected diveGravatar Marcos CARDINOT
test case: 1 - make sure that you DO NOT have anything selected on the 'Dive list; 2 - in the menu bar, click on 'Log'->'Re-plan dive'; 3 - crash! Fixes #858 Signed-off-by: Marcos CARDINOT <mcardinot@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-19Fix a couple of typosGravatar Torstein Husebø
Signed-off-by: Torstein Husebø <torstein@huseboe.net> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-16Don't overwrite the displayed dive in the middle of editingGravatar Dirk Hohndel
Coming back from a dive site edit we must not call refreshDisplay() or otherwise the edits on the displayed_dive are overwritten. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-16Make sure the dive site edit widget is current when switching to itGravatar Dirk Hohndel
Otherwise it will show outdated information. If the user edits the location name and then clicks 'manage' we need to make sure that the correct site is shown. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10Don't call UI functions from helper codeGravatar Dirk Hohndel
This may seem much more complicated but actually is much cleaner. Add each thread we start to the list of future results and add a new UI function that updates the UI once all of the threads have finished. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-10Import Datatrak/WLog filesGravatar Salvador Cuñat
Sequentially parses a file, expected to be a Datatrak/WLog divelog, and converts the dive info into Subsurface's dive structure. As my first DC, back in 90s, was an Aladin Air X, the obvious choice of log software was DTrak (Win version). After using it for some time we moved to WLog (shareware software more user friendly than Dtrak, printing capable, and still better, it runs under wine, which, as linux user, was definitive for me). Then, some years later, my last Aladin died and I moved to an OSTC, forcing me to look for a software that support this DC. I found JDivelog which was capable of import Dtrak logs and used it for some time until discovered Subsurface existence and devoted to it. The fact was that importing Dtrak dives in JDivelog and then re-importing them in Subsurface caused a significant data loss (mainly in the profile events and alarms) and weird location of some other info in the dive notes (mostly tag items in the original Dtrak software). This situation can't actually be solved with tools like divelogs.de which causes similar if no greater data loss. Although this won't be a core feature for Subsurface, I expect it can be useful for some other divers as has been for me. Comments and issues: Datatrak/Wlog files include a lot of diving data which are not directly supported in Subsurface, in these cases we choose mostly to use "tags". The lack of some important info in Datatrak archives (e.g. tank's initial pressure) forces us to do some arbitrary assumptions (e.g. initial pressure = 200 bar). There might be archives coming directly from old DOS days, as first versions of Datatrak run on that OS; they were coded CP437 or CP850, while dive logs coming from Win versions seems to be coded CP1252. Finally, Wlog seems to use a mixed confusing style. Program directly converts some of the old encoded chars to iso8859 but is expected there be some issues with non alphabetic chars, e.g. "ª". There are two text fields: "Other activities" and "Dive notes", both limited to 256 char size. We have merged them in Subsurface's "Dive Notes" although the first one could be "tagged", but we're unsure that the user had filled it in a tag friendly way. WLog adds some information to the dive and lets the user to write more than 256 chars notes. This is achieved, while keeping compatibility with DTrak divelogs, by adding a complementary file named equally as the .log file and with .add extension where all this info is stored. We have, still, not worked with this complementary files. This work is based on the paper referenced in butracker #194 which has some errors (e.g. beginning of log and beginning of dive are changed) and a lot of bytes of unknown meaning. Example.log shows, at least, one more byte than those referred in the paper for the O2 Aladin computer, this could be a byte referred to the use of SCR but the lack of an OC dive with O2 computer makes impossible for us to compare. The only way we have figured out to distinguish a priori between SCR and non SCR dives with O2 computers is that the dives are tagged with a "rebreather" tag. Obviously this is not a very trusty way of doing things. In SCR dives, the O2% in mix means, probably, the maximum O2% in the circuit, not the O2% of the EAN mix in the tanks, which would be unknown in this case. The list of DCs related in bug #194 paper seems incomplete, we have added one or two from WLog and discarded those which are known to exist but whose model is unknown, grouping them under the imaginative name of "unknown". The list can easily be increased in the future if we ever know the models identifiers. BTW, in Example.log, 0x00 identifier is used for some DC dives and from my own divelogs is inferred that 0x00 is used for manually entered dives, this could easily be an error in Example.log coming from a preproduction DC model. Example.log which is shipped in datatrak package is included in dives directory for testing pourposes. [Dirk Hohndel: some small cleanups, merged with latest master, support divesites, remove the pointless memset() before free() calls add to cmake build] Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-09Fix building with NO_PRINTING for AndroidGravatar Anton Lundin
Back in 4867ee8ad87399f34a399f30def700b2fc045309 ("Move the Profile out of the mainwindow.ui") the way to access the PlannerDetails object changed. This does the corresponding change to the NO_PRINTING block, making it build on Android again. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-08Include upper case extensions on import dialogGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-28Show notification message while logs are converted from v2Gravatar Gehad elrobey
This is another long operation that needs showing a notification about importing the old format log files Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-27Change the references to ShowError to the new notification object.Gravatar Gehad elrobey
Showing an Error message is better called from the Notification Object, So for consistency old references to showError is replaced by calling the notification object. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-27Creating a Notification widget in the Main Window.Gravatar Gehad elrobey
The main error message bar can be used to show exporting information and other notification. So a new Notification handler object is created in the main window <NotificationWidget> that inherits <KMessageWidget> that shows different type of notifications, ex. (Warning, Error and information) Also this class contains a QFutureWatcher object that is set to handle the QFuture variable returned from the exporting thread. this will allow the UI to be updated when the thread finishes execution. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-27UI to learn hashes of local image filesGravatar Robert C. Helling
This addes a menu entry for the user to select a directory that is recursively traversed to look for image files and compute the hashes of those images (for those images to be available to be displayed in dives according to their hash values). This traversal and hash computation happens in and independend thread and so far the only feedback to the user is that upon completion the dispayed images are updated. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-27Add hashes to imagesGravatar Robert C. Helling
Upon successfull reading an image file, this computes a SHA1 hash of the image and saves it with the picture tag in the log file. When a file is not successfully loaded (for example because the log was created on a different computer) we look up the hash in a dictionary that maps hashes to local file names. That dictionary (actually two for both directions), is loaded on startup and saved upon destruction of the main window. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-25Display slowness warning before opening a V2 fileGravatar Dirk Hohndel
This is somewhat invasive as aborting the XML file read requires us to report things up the recursive parsing chain. What we really need to do here is to ask the user how they want to use the data from reverse geo lookup. But for now we only warn about the fact that this can take a while. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-16Fix profile toolbarGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-15add and use a version.c / version.h pairGravatar Lubomir I. Ivanov
version.c is now object code which is recompiled each time ssrf-version.h changes, while the interface file version.h remains that same at all times and files which include it will not need to be recompiled. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-14Add ssrf as dive log extension on importGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-14When cleaning up the empty screen, also clean up dive sitesGravatar Dirk Hohndel
Otherwise we are using stale pointers in the displayed_dive_site global. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-14mainwindow.cpp: don't close a file if a dive site is being editedGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-13When updating the dive site name, show this on the maintabGravatar Dirk Hohndel
If we accept a change on the dive site management screen, it needs to be reflected on the Dive notes tab right away. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>