aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
AgeCommit message (Collapse)Author
2021-01-11undo: remove invalidate_dive_cache call from MainTabGravatar Berthold Stoeger
When creating the RenumberDive undo command, the MainTab would manually call invalidate_dive_cache(). However, this is done on undo/redo, therefore the call can (should) be removed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10profile: remove ProfileWidget2::dateTimeChanged()Gravatar Berthold Stoeger
This function sent a signal and the only listener was removed in the previous commit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10statistics: convert chart to QQuickItemGravatar Berthold Stoeger
It turns out that the wrong base class was used for the chart. QQuickWidget can only be used on desktop, not in a mobile UI. Therefore, turn this into a QQuickItem and move the container QQuickWidget into desktop-only code. Currently, this code is insane: The chart is rendered onto a QGraphicsScene (as it was before), which is then rendered into a QImage, which is transformed into a QSGTexture, which is then projected onto the device. This is performed on every mouse move event, since these events in general change the position of the info-box. The plan is to slowly convert elements such as the info-box into QQuickItems. Browsing the QtQuick documentation, this will not be much fun. Also note that the rendering currently tears, flickers and has antialiasing artifacts, most likely owing to integer (QImage) to floating point (QGraphicsScene, QQuickItem) conversion problems. The data flow is QGraphicsScene (float) -> QImage (int) -> QQuickItem (float). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-06desktop/update-check: fix logic when to ask about update checkGravatar Dirk Hohndel
Checking a field that we intentionally don't store to disk is obviously wrong. It's been this way for a long time and it has annoyed me many times, but somehow I never spent the time to track down why this was happening. It makes much more sense to use the presence of either the don't check flag or a next check date as an indication that we have already asked this question. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-06desktop/UI: move statistics to View menuGravatar Dirk Hohndel
It seems to make more sense to have it there with the 'Yearly Statistics' and not in the Log menu. Interestingly enough, both locations were clearly considered when first adding this in commit 106f7a8e0e ("desktop: add statistics widget dummy and application state") as you can tell by the never implemented actionViewStats. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-06dekstop/UI: remove duplicate resourceGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-06desktop/UI: add shortcut for 'Open cloud storage'Gravatar Dirk Hohndel
This seems like a logical extension of the shortcuts we already have. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-03desktop: rename Statistics tab to SummaryGravatar Dirk Hohndel
We now have three different things that are kinda like statistics: - the summary tab (reasonably useful when looking at selected dives) - the yearly statistics (Ctrl/CMD-Y) - the full statistics (Ctrl/CMD-T) I'd argue that's at least one too many. But I'm sure some people will disagree. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-03statistics: reverse chart selection logicGravatar Berthold Stoeger
The old ways was to select the chart first, then depending on the chart choose the binning. Willem says that it should work the other way round: select the binning (or operation) and make the charts depend on that. I'm not arguing one way or the other, just note that the new way is much more tricky, because it is easy to get unsupported combinations. For example, there is no chart where the first variable is unbinned, but the second axis is binned or has an operation. This makes things distinctly more tricky and this code still needs a thorough audit. Since this is all more tricky, implement a "invalid" chart state. Ideally that should be never shown to the user, but let's try to be defensive. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-03desktop: add statistics widget dummy and application stateGravatar Berthold Stoeger
Add a new "statistics" application state. In the statistics state show the statistics widget and the filter in the top quadrants. The idea is to allow filtering and doing statistics at the same time. Sadly, we can't use the filter-widget in different quadrants, because Qt's ownership model is completely broken / inflexible. It does not support a widget having different parents and thus a widget can only belong to one QStackedWidget. Hiding the map in the statistics view is quite hacky: Since the view of the quadrants is not determined by the "ApplicationState", we have to restore the original quadrant visibility when exiting the stats mode. Therefore, set the original visibility-state when changing application state. The MainWindow-quadrant code really needs to be rewritten! Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-03statistics: implement a statistics widget on desktopGravatar Berthold Stoeger
Implement a widget that shows the statistics state as comboboxes and the statistics chart. Calls into the statistics code if any of the comboboxes changes. The hardest part here is the formatting of the charts list with its icons and with headings. Sadly, it is not trivial to arrange icons horizontally. Therefore we would have to fully reimplement the ComboBox view, which is probably not fun. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-01cleanup: remove "GpsLocation *locationProvider" from MainWindowGravatar Berthold Stoeger
This is mobile only and not used on desktop. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-29cleanup: remove getDivesInTrip() in qthelper.cppGravatar Berthold Stoeger
This function was not used anywhere. Moreover, remove a few unused includes from qthelper.h. Surprisingly, a number of users of qthelper.h depend on these, so readd them at the appropriate places. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-17printing: remove CylinderObjectHelperGravatar Berthold Stoeger
With the removal of grantlee, this became pointless glue code. Call the formatting functions directly. Since the printing code was the only user of CylinderObjectHelper, remove the whole thing. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-17printing: remove DiveObjectHelper from printing codeGravatar Berthold Stoeger
At this point (post grantlee), DiveObjectHelper is just pointless glue code. Let's remove it from the printing code and call the formatting functions directly. If necessary, move these functions to core/string-format.cpp. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-17printing: remove DiveObjectHelperGrantleeGravatar Berthold Stoeger
This was a weird helper object, needed for grantlee. Instead of storing this object, loop over cylinders and dives directly. The actual accessor function is unchanged and now generates a DiveObjectHelper or DiveCylinderHelper for every variable access. Obviously, this is very inefficient. However, this will be replaced in future commits by direct calls to formatting functions. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-17cleanup: remove QPointer instancesGravatar Berthold Stoeger
QPointer is a strange "smart" pointer class, which resets itself when the pointed-to QObject is deleted. It does this by listening to the corresponding signal and therefore is surprisingly heavy for a plain pointer. A cynic would say that the existence of QPointer is an expression of Qt's broken ownership model. In any case, QPointer was only used at two places, were it was 100% useless: As a parameter to a function and as a locally scoped pointer. It only makes sense if a) there is a chance that the object disappears during the pointer's lifetime and b) it is actually checked for null before use None of which was the case here. Remove. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-17printing: move #includes from headers to source filesGravatar Berthold Stoeger
To decrease include-file interdependencies. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-17printing: remove YearInfo structureGravatar Berthold Stoeger
This is a wrapper around "stats *" used to pass statistics through Qt's weird metatype system. Not needed anymore. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-17printing: refactor if and loop codeGravatar Berthold Stoeger
The loop code was buggy: the current position was only increased inside when executing the loop once. This would obviously fail for empty lists. Moreover, the whole thing was quite difficult to reason about, since a reference to the current position was passed down in the call hierarchy. Instead, pass from and to values to the parse function and create a generic function that can search for the end of loop and if blocks. This function handles nested if and for loops. The if-code now formats the block only if the condition is true. The old code would format the block and throw it away if not needed. This should now provide better diagnostics for mismatched tags. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-17printing: remove objects QVariant mapGravatar Berthold Stoeger
An artifact from the old grantlee code: the whole parser state was kept in an untyped QVariant map. One case was particularly bizarre: the options were a class member and yet added to the weird map. Replace this by a strongly typed state structure. Ultimately, this will allow us to replace the "dive object helper". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-17cleanup: make templateOptions and printOptions reference typesGravatar Berthold Stoeger
These two structs describe options used during printing. They are passed through numerous classes as pointer. In this case, reference semantics are preferred, as references: - can never be null - can not change during their lifetime This not only helps the compiler, as it can optimize away null checks, but also your fellow coder. Moreover, it prevents unintentional creation of uninitialized references: one can't create an instance of a class without initializing a reference member. It does not prevent references from going dangling. However, pointers have the same disadvantage. Contains a few whitespace cleanups. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-13cleanup: remove MainWindow::stateBeforeEdit memberGravatar Berthold Stoeger
The last user was removed in accf1fcc8f6ad. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-13cleanup: remove unused typedefsGravatar Berthold Stoeger
Last users removed in ca6aa3813956b5e8be68b86ed36a5786b3ee746f. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-13prefs: add option to display only actually used tanksGravatar Berthold Stoeger
A user complained about the default cylinders list. Provide a preferences option to turn this off. When changing the preferences, the tank-info model will be completely rebuilt. Currently, this is a bit crude as this will be done for any preferences change. Suggested-by: Adolph Weidanz <weidanz.adolph@gmail.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-13core: remove the "no-name" tank infoGravatar Berthold Stoeger
There was a tank info with an empty name. According to a comment, this is needed for the "no cylinder" case. However, we now support empty cylinder tables, so this is not needed anymore. Therefore, remove it. Make sure that the user can still enter the empty name, just in case. But don't save the size and pressure in that case. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-13desktop: don't save data to the "no-name" tankGravatar Berthold Stoeger
There seems to be no point to saving data to the tank with the empty name. Don't save tank-pressure and size to that tank info. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-13core: keep tank infos in a dynamic tableGravatar Berthold Stoeger
The list of known tank types were kept in a fixed size table. Instead, use a dynamic table with our horrendous table macros. This is more flexible and sensible. While doing this, clean up the TankInfoModel, which was leaking memory. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-12cleanup: remove unused #undefs in mainwindow.cppGravatar Berthold Stoeger
These macros were removed 2016-ish. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-12profile: move connect() calls to profileGravatar Berthold Stoeger
The mainwindow was connecting preferences changes to the profile. Do this directly in the profile. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-12cleanup: remove unused signal ProfileWidget2::updateDiveInfoGravatar Berthold Stoeger
Last user was remove in 0bd821183d. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-12profile: move DiveHandler to profile-widget folderGravatar Berthold Stoeger
These are the small dots that describe dragable points on the profile when in the planner. It makes no sense to have them in desktop's planner-widget code. They belong to the profile. Therefore, move the code there and compile on mobile. Not everything can be compiled on mobile for now, but it is a start. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-12cleanup: remove unused macros in diveplanner.cppGravatar Berthold Stoeger
Clearly, these are artifacts. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-12profile: call clearHandlers() in setPlanState()Gravatar Berthold Stoeger
This function, which removes the handlers from the profile, was called in setAddState() but not in setPlanState(). In the latter case it was called explicitly by the caller. Move the call from the caller into the function. This allows us to make clearHandlers() private in to the profile widget. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-12desktop: move planner-code to diveplanner.cppGravatar Berthold Stoeger
Around 2015 there was a push to move planner UI code from mainwindow.cpp to diveplanner.cpp. That never was completed, presumably because the planner is actually three widgets. Collect these widgets in one PlannerWidgets class and move the code there. This is not a full dis-entanglement, as the plannerwidgets have to access the profile via the mainwindow. But at least it collects the planner UI code at a single place. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-12desktop: use getDiveSelection to access selected divesGravatar Berthold Stoeger
In the list view two functions were still manually collecting the selected dives. Use getDiveSelection() there as well. Careful: that means that the check for dives that are already outside of a trip now has to be done in the RemoveDivesFromTrip command. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-12desktop: init dive list header actions in constructorGravatar Berthold Stoeger
The main window called a function to init the header actions (i.e. the context menu) of the dive-list. There is no reason why this shouldn't be done in the constructor of the dive list, since it only accesses the QSettings, which are available at application startup. This improves modularity of the code (by a tiny, tiny bit). Moreover, the initialization function was at the same time the header-reloading function. That function can now be folded into the settings-changed function, since that is the only remaining user. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-12preferences: connect() dialog page only onceGravatar Berthold Stoeger
Weirdly, the settingsChanged() signal of the dialog-pages was connected() to the settingsChanged() signal of the dialog every time the settings were accepted. Do it only once in the constructor. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-12preferences: don't remove/add pages in refreshPages()Gravatar Berthold Stoeger
This function was called when opening the preferences dialog to update all the pages with the current preferences. For unknown reasons it also removed / readded all the pages. Remove that code and use the now leaner function when refreshing the pages. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-12preferences: sort pages only onceGravatar Berthold Stoeger
After each addition of a page in the constructor, the list was resorted. This appears pointless. Instead, sort the list only after all pages were added. Since the add-page function is now a single line, remove it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-12preferences: create global settingsChanged signalGravatar Berthold Stoeger
So far, the PreferencesDialog emitted a settingsChanged signal. This meant that models that listened to that signal had to conditionally compile out the code for mobile or the connection had to be made in MainWindow. Instead, introduce a global signal that does this and move the connects to the listeners to remove inter-dependencies. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-12cleanup: remove unused PreferencesDialog::emitSettingsChanged()Gravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-12Add surge etc to printing template variablesGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-12-08Fix cylinders in printing templatesGravatar Robert C. Helling
These did not appear in our templates. With this commit, there are two lists to iterate over, cylinders and cylinderObjects: cylinders has just one property: description which is a string summarizing cylinder information cylinderObjects has the individual properties addresable This also fixes a bug when the iterator variable did not have the singular name of the list it iterates over. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-12-03cleanup: remove unnecessary includes from divepicturewidget.cppGravatar Berthold Stoeger
Also, use finer-grained Qt includes instead of the full QtWidgets include. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-11-26cleanup: remove unused function in templatelayout.cppGravatar Berthold Stoeger
This was removed with grantlee. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-11-14cleanup: remove empty function MainTab::reload()Gravatar Berthold Stoeger
This used to reload the completion models. Moreover, remove two obsolete member-function declarations. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-11-14desktop: automatically reload completion-modelsGravatar Berthold Stoeger
Instead of programatically reload the completion models, listen to the relevant signals in the models. To that goal, derive all the models from a base class. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-11-12desktop: update completion models if dive was editedGravatar Berthold Stoeger
In the main-tab, when changing tag, buddy or divemaster, update the corresponding completion model. This is a quick-fix and the wrong thing to do. It works only if the currently shown dive is changed, which is not a given. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-11-12printing: properly initialize DPI valueGravatar Berthold Stoeger
The DPI value in the print_options structure was never initialized. This could lead to random DPI values and crashes. How this ever worked is a mystery. Therefore, read and write the DPI value from the settings just as the other print-options. And initialize the corresponding dialog widget to this value. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>