aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.cpp
AgeCommit message (Collapse)Author
2013-06-06Try to get rid of unnecessary reloads of the dive listGravatar Dirk Hohndel
Don't call refreshDisplay() after preferences change. This strangely somehow leads to a situation where I need to move the mouse over the dive list before changes to the units are reflected. When calling reload() do not force layout change / resort unless that is the intention. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-05Fixing some issues with the dive selection after OK on preferencesGravatar Dirk Hohndel
These changes should be correct - but they still don't fix the problem that after we click 'OK' on the preferences (regardless of whether any changes were made), the first dive is set as current dive and shown in the map window. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-05Update the current dive when no dive was selectedGravatar Dirk Hohndel
The check to only update the dive if there were already dives selected before seems bogus. I'm sure I put it there for a reason but it seems flat out wrong. This gets triggered when you select a trip by clicking on the trip header. In that case all dives get unselected (amount_selected = 0) and then we try to select the first dive in the trip - which fails because of this check. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-04Rewrite readSettings to do what it should have done from the startGravatar Dirk Hohndel
This function was supposed to take the default_prefs into account but clearly wasn't. Now it should be much more readable and maintainable. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-03Tie all the pieces together and make Preferences work as intendedGravatar Dirk Hohndel
Not Apply / Close without Saving / OK work as designed. And things get correctly stored and reset. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-02Merge branch 'selection'Gravatar Dirk Hohndel
2013-06-02Once again try to fix the selectionGravatar Dirk Hohndel
Things got broken. Again. We no longer kept track of the selected dives in our structures which broke statistics. This attempts to fix that, but appears to still have a bug when selecting trips. Sometimes this results in 0 dives being selected according to our data structures, while Qt happily shows all dives of the trip as seected. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-02Correctly implement Metric / Imperial / Personalize preferenceGravatar Dirk Hohndel
The code so far had completely ignored Metric / Imperial. Turning this into a three way radio box seemed to make much more sense. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-31Display the Subsurface manual in the help widgetGravatar Dirk Hohndel
This adds a helper function to determine the Subsurface data directory (are we running from build directory? installed on Linux? installed on Mac? - still need to add support for Windows). This same function is then used by both the setup for Marble and for the help browser. This assumes that the user-manual.html file has actually been built and installed (which we don't do by default with the current Makefile). Right now there are rendering issues with our manual in the help browser widget - I'm sure this can be fixed... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-31Added preliminary support for a Manual Display Widget.Gravatar Tomaz Canabrava
Added a preliminary support for a manual display widget, it's a very basic HTML text-browser, so it can have hyperlinks, images and everything that a 1995 browser has. The long term plan is to subsittute this manual by a more modern 'help' using QGraphicsView, that will interact on the application level. See #121 Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-31Show ceilings for individual tissuesGravatar Robert Helling
I think that displaying tissue loadings either as pressure or as percentages is not very intuitive but that it makes much more sense when translated to ceiling depths. This change enables just that for the 16 tissues in our calculated ceiling and visualizes this in the profile graph. There is a checkbox in the preferences to turn this on. If enabled, all tissues having non-trivial ceilings are also shown in the info box. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-30Hook up the Download dialogGravatar Dirk Hohndel
The download already worked, but we didn't display the new dives. This introduces a new slot for MainWindow that updates what is displayed in Subsurface after files were imported. With this change we can successfully download ONCE - but when trying to download a second dive the dialog doesn't appear to get refreshed the right way - the OK button doesn't appear to work anymore (Cancel however does). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-29Correct the ceiling preference handlingGravatar Dirk Hohndel
Added the red dc ceiling as preference option. Hooked them all up together so the sub-preferences are enabled when the master preference is set (for 3m and red ceiling). Use the options in the profile plotting functions. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-29Connect preferences to the rest of the codeGravatar Dirk Hohndel
The biggest problem here was that bool has different sizes in C and C++ code. So using this in a structure shared between the two sides wasn't a smart idea. Instead I went with 'short', but that caused problems with Qt being to smart for its own good and not doing the right thing when dealing with 'boolean' settings and a short value. This may be something in the way I implemented things (as I doubt that something this fundamental would be broken) but the workaround implemented here (explicitly using 0 or 1 depending on the value of the boolean) seems to work. I also decided to get rid of the confusion of where gflow/gfhigh are floating point (0..1) and when they are integers (0..100). We now use integers anywhere outside of deco.c. I also applied some serious spelling corrections to the preferences dialog's ui file. Finally, this enables the code that selects which partial pressure graph to show. Still to do: font size, metric/imperial logic Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-26Hook up most of the Preferences dialogGravatar Dirk Hohndel
The imperial/metric super setting doesn't have any effect. But changing the individual units now works and is tracked. And causes the display to change after clicking "OK" (but not yet when clicking "Apply"). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-26Repair the saving and loading of unitsGravatar Dirk Hohndel
This way it should work... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-26Fix colum visibility selection in the divelistGravatar Dirk Hohndel
Several changes: - split the reload of the DiveListView from the reload of the header - don't include the column title in the name of the setting; the title will change depending on the units and localization chosen by the user - rename the slot that toggles visibility to make the code more readable - use setCollumHidden() method to simplify the code - don't save the width of hidden columns (as they would be saved as zero width and can then no longer be enabled) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-25Avoid marble widget resize when switching divesGravatar Henrik Brautaset Aronsen
The "no dive location" message box was displayed above the marble widget, which made the layout splitter move horizontally. Made the message box as an overlay on the map instead. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-24Added support for a preliminary Preferences DialogGravatar Tomaz Canabrava
Dirk asked me to try to make it more modern, so I used as a base, the Firefox preferences. currently it saves / loads the preferences, and also smits a signal 'preferencesChanged' that should be connected to anything that uses preferenes, via the PreferencesDialog::intance() object. In the future, I plan to make it have a signal / slot for each member that changes. I also moved the icons to a new folder this time, because the amount of icons is now more than just two, and it was becoming messy. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-24Improve wording in askSaveChanges()Gravatar Henrik Brautaset Aronsen
Don't Save/Cancel/Save is less ambiguous than OK/Cancel/Save. Also being slightly more verbose when creating the QMessageBox. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22The never ending, futile fight for whitespace consistencyGravatar Dirk Hohndel
I just need to write a tool that does this... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-21Replace GError handling with a kMessageWidget based approachGravatar Dirk Hohndel
Instead of passing pointers to GError around we pass just pointers to error message texts around and use kMessageWidget to show those. Problem is that right now the close button on that doesn't do a thing - so the error stays around indefinitely. Oops. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-21Merge branch 'microFixes' of https://github.com/tcanabrava/subsurfaceGravatar Dirk Hohndel
2013-05-21Fixed the hide / show columns using the settings.Gravatar Tomaz Canabrava
This also changed a bit the behavior on how the QSettings are managed, till now, we used the QSettings constructor passing the name of the software and the 'company', but this is now default - so there's no need to pass anything by the QSettings contructor. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-21Correctly restore the column sizes in the dive listGravatar Dirk Hohndel
Ordering here is important - we can't resize the columns before they are created. On the other hand this now means that we explicitly need to expand to the first dive shown. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-20Skeleton code for a non-blocking UI thread for downloading dives from the DCGravatar Tomaz Canabrava
This is the skeleton code for a non-blocking ui-thread It already creates the first-thread ( 'do not block the ui' ) and the second thread ('download from the dive computer') We can in the future merge both in the same place - I didn't want to do that now because the download function is written in the libdivecomputer.c code, and I cant just transform that to a QThread and use signals, so I used two threads for that. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-19Close needs to clear the Globe and the DiveNotesGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19Replace glib file/directory handling with equivalent Qt codeGravatar Dirk Hohndel
I hope this is indeed equivalent... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19Implenent file_save and file_save_asGravatar Dirk Hohndel
This allows us to do the right thing at exit (and also connects to more of the menu actions to actually do something). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19Show the correct question at exit when there are unsaved changesGravatar Dirk Hohndel
We want to give the user the option to 'cancel' and not exit the program, to 'save' the file, or to say I'm 'OK' with losing the unsaved data. This does NOT implement the actual save / save-as, yet. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19Removed unused GTK calls onto the Qt versionGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-18Make impossible to change dives while editing one.Gravatar Tomaz Canabrava
This is to prevent loss of data, so if the user is editing something, either cancel the edition or save it, to continue moving around on the Dive List. - Only the dive list is affected, user can still play with the globe and the profile. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-17Prettification of the map view.Gravatar Tomaz Canabrava
Just some prettifications, better defaults, etc. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17Borrowed the KMessageWidget code to better show passive information.Gravatar Tomaz Canabrava
Borrowed the code from KMessageWidget from Aurelian Gateau, Kdelibs, to better show passive information and notifications. instead of a popup blowing in the user's face, a nice, animated and well designed widget will gracefully fade-in, show the notes, and fade out when not needed anymore. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17Added real support for the marble widgetGravatar Tomaz Canabrava
The marble widget now shows the dive locations and also will center on the dive that the user clicked in the dive list. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-16Fix loading a second dive, after the first file was loaded.Gravatar Tomaz Canabrava
This patch fixes loading a second dive-file after the first one had been loaded. it simply clears some information and makes sure that the current selected dive is invalid when the file closes. I also did a bit of code cleanup on this one to make things simpler in the future. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-16Correctly set the unselected dive.Gravatar Tomaz Canabrava
The selected dive was being set to zero when the program started, but zero is actually the first dive. There were workarounds on the gtk code for that probably Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-14Fix the focus issues, load a profile when load a file.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-14code to show profile againGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-13Trying to make the DiveList selection behave correctlyGravatar Tomaz Canabrava
And rip out all the code that Dirk put there to do that. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-13Fix segfault on mouseOver at the Profile with an invalid dive selected ( trip )Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-12Allow walking the dive list with the cursor keysGravatar Dirk Hohndel
Figure out what is our first selected element (in case we start out from a multiple selection) and then move to the next logical element. So the code traverses an expanded tree (from a trip 'down' to its first dive or 'up' to the last dive of the previous trip - and similar from a first dive in a trip 'up' to its trip and from a last dive in a trip 'down' to the next trip. This does not take 'shift-cursor-up/down' into account (i.e. manual selection extension). Instead with just cursor up and down a single dive (or single trip) is selected. My guess is that the code will make someone's eyes bleed. Be warned. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-12Modify selection changed slot to deal with trips correctlyGravatar Dirk Hohndel
If a user clicks on a trip, all the dives in a trip should be selected. But if a user selects a range of dives that happens to have a trip header in it, then only the range of dives should be selected (the trip header is marked as 'selected' for visual consistency, even though not all dives in this trip are selected). This also changes the code to scrollTo the first selected dive instead of just expanding the parent. This seems to give us a more pleasant visual appearance (trying to keep the selected dive centered in the dive list) and as a side effect no longer hides the first dive trip at program start (before this change the first dive in the first trip would be the top entry in the dive list, with its trip just out of sight above). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-10Make nextDC and previousDC work and assign shortcutsGravatar Dirk Hohndel
Cursor right and left now work again to switch between divecomputers. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-09Enable defautl_filename in settingsGravatar Dirk Hohndel
We don't have a UI to set it, yet, so you have to manually set it in the config file, but once you do that it works... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-06Start populating the maintab Dive Info widgetGravatar Dirk Hohndel
Establish some useful helpers and use them when updating the values. One of the helpers (from statistics.c) puzzlingly doesn't link - so that's ifdefed out. Also had to re-arrange the settings reading code (it came too late) and to extract the expanding code of the top dive from the settings reading code (as it had no business being there to begin with). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-06Added the code to populate the tabs when a dive is selected.Gravatar Tomaz Canabrava
So, this is what happens now: Every tab should be populated from updateDiveInfo method, it will be called whenever a new dive is selected I'm already populating the 'notes' box to show how it can be done. If you are unsure what's the name of anything, open the file maintab.ui on the designer, click on the item and check its objectName, the access is ui->objectName from here on. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-06Add various keyboard shortcuts.Gravatar Amit Chaudhuri
Add shortcuts to match GTK version for view menu items and the log menu so that e.g. Ctrl+1 selects the list view. Remove debug statements from the view functions. Leave in place for functions with no obvious actions yet coded. Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-05Add most settings to the QSettings codeGravatar Dirk Hohndel
This is missing the char * based settings (as I have no idea how to do those) plus the map provider. Everything else should work. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-04Started the code for the Profile PlottingGravatar Tomaz Canabrava
This small patch adds a new class - ProfileGraphicsView it's a QGraphicsView based class that will holds all graphics-items for the plotting. The setup is simple, just call ui->ListView->plot( dive ) ( that's already a ProfileGraphicsView and magic will happen. Since Im using a QGraphicsView , the size of the canvas doesn't matter and I'm fixing it at 0,0,100,100. when a resize is done, the resizeEvent will be called, fitting the scene's rectangle on the view. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>