aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
AgeCommit message (Collapse)Author
2020-11-03desktop: offer different colors for info tab titlesGravatar willemferguson
Add a preference option to set the color of the text on the information tab to either MediumBlue, LightBlue or Black. The last two of these colors are meant to enable areadable font contrast on displays with dark mode. The choice is saved with the other preferences. [Dirk Hohndel: this isn't really about dark mode, so changed many of the types and variable names, changed the user visible texts, and addressed some whitespace issues] Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-29desktop: add label to dive computer tableGravatar Doug Junkins
There was no "title" property on the dive computer table which was causing an default label of "GroupBox" to appear above the table. Added a title property to clean up the UI. Signed-off-by: Doug Junkins <junkins@foghead.com>
2020-10-29desktop: use default colors for dive info labelsGravatar Doug Junkins
Removed the style change to force a style change for the labels on the dive information page to Medium Blue. This makes labels more readable in MacOSX dark mode since the default style changes colors when the mode is shifted from light to dark or vice versa. Signed-off-by: Doug Junkins <junkins@foghead.com>
2020-10-28cleanup: remove unnecessary includes from maintabGravatar Berthold Stoeger
These are artifacts from when the maintab contained more stuff. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-26desktop: move MinMaxAvgWidget to TabDiveStatisticsGravatar Berthold Stoeger
This is its only user and the widget is scheduled for removal. Let's move it there temporarilly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-26cleanup: remove dive.h include in simplewidgets.hGravatar Berthold Stoeger
Let's simply forward declare the needed structures. Also removes removes two more unnecessary includes. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-26cleanup: fix deprecated QVector constructorGravatar Dirk Hohndel
Annoyingly, the replacement has only been available since Qt 5.14. To make the code less messy, implement our own stdToQt conversion helper. Suggested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26cleanup: remove reference to deprecated enum valueGravatar Dirk Hohndel
This had been deprecated for quite a while. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26cleanup: don't initialize flags with just an integerGravatar Dirk Hohndel
This is slightly different from the previous cleanup around QFlag use as this one is related to QtWebKit flags. But the logic is the same. Just syntax to avoid a warning. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26cleanup: replace deprecated signalGravatar Dirk Hohndel
Again, the replacement was only implemented in Qt 5.14, so more conditional code. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26cleanup: SkipEmptyParts syntax has changedGravatar Dirk Hohndel
Sadly, the new enum has only been available since Qt 5.14, so this is a rather ugly replacement. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26cleanup: model isn't used in the lambdaGravatar Dirk Hohndel
Simply cleaning up a warning. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26cleanup: remove obsolete connectionsGravatar Dirk Hohndel
Not sure how this even ended up in this .ui file. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26cleanup: fix deprecated roleGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26cleanup: replace deprecated use of child memberGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26cleanup: fix deprecated form of QProcess::startGravatar Dirk Hohndel
You are now required to always provide a list of arguments. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26cleanup: fix deprecated QFlags useGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-25filter: use 64-bit integer literal for generating bit fieldsGravatar Berthold Stoeger
For multiple-choice constraints we use a bit field of type uint64_t. This means we theoretically support up to 64 items. Currently use at most seven. Coverity complained (correctly) that we use the expression "1 << x" to generate the bitfields. However 1 is a 32-bit literal on most platforms, which makes this undefined behavior for x >= 32. Change the integer literal to 64-bit 1ULL. Moreover, when detecting items with an index >= 64, don't even attempt to set the according bit, since this is undefined behavior and the compiler is free to do as it pleases in such a case. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25cleanup: remove get_times() functionsGravatar Berthold Stoeger
The function 1) was misnamed: it determined the time of the first selcted dive. 2) had only one caller. 3) would crash if there was no selected dive. Let's just fold the functionality into the caller. It's a one-liner anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25cleanup: remove MainWindow::setFileClean()Gravatar Berthold Stoeger
This function was used to unify both methods of tracking unsaved changes. Since desktop now only uses the undo system, it can be replaced by a single call to "Command::setClean()". Arguably, the UI is the wrong place to do this and the appropriate calls should be done by the core. However, let's play it safe for now and avoid any breaking change. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25cleanup: remove MainWindow::unsavedChanges() functionGravatar Berthold Stoeger
This function was used to unify both methods of checking for unsaved changes: the global unsaved_changes() flag and the Command::clean() function of the undo-system. However, all desktop functions are now undoable and therefore the function is not needed and can be replaced by calls to !Command::clean(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25desktop: remove DiveComputerManagementDialogGravatar Berthold Stoeger
This is now done in a TabWidget with undo-support. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25devices: connect DiveComputerModel to undo-commandGravatar Berthold Stoeger
Instead of modifying the device table directly, call the undo commands. Moreover, don't keep our own copy in the mode - show the original version. Connect to the appropriate signals. This means that the calls from the DiveComputerManagement dialog have to be removed, since this mode of editing is not supported. The whole dialog will be removed in a future commit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25desktop: add tab-widget for dive computer namesGravatar Berthold Stoeger
If we want to include dive computer names in the undo system, there should be visual feedback on undo/redo. This would mean opening the divecomputer dialog, which would appear quite strange. Therefore, add a tab. This is not ideal, but consistent with the dive site tab, which probably shouldn't be there either. In the future, the UI needs some rethinking. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-24devices: add devices in Command::importTable()Gravatar Berthold Stoeger
Add a device_table parameters to Command::importTable() and add_imported_dives(). The content of this table will be added to the global device list (respectively removed on undo). This is currently a no-op, as the parser doesn't yet fill out the device table, but adds devices directly to the global device table. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-24parser: add device_table to parser stateGravatar Berthold Stoeger
If we want to avoid the parsers to directly modify global data, we have to provide a device_table to parse into. This adds such a state and the corresponding function parameters. However, for now this is unused. Adding new parameters is very painful and this commit shows that we urgently need a "struct divelog" collecting all those tables! Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-24cleanup: remove TagWidget::fixPopupPosition()Gravatar Berthold Stoeger
No user of that member function! Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-24desktop: overwrite drag & drop in TagWidgetGravatar Berthold Stoeger
The interaction of Qt's drag & drop with GroupedLineEdit was exceedingly weird. The user was able to scroll the viewport making the text invisible. This implements a very primitive alternative drag & drop functionality: dropped text is regarged as a distinct tag. This means that it is not possible to modify existing tags by dropping in the middle of them. Arguably, this might even be better than arbitrary drag & drop. But even if not perfect, this fixes a very nasty UI behavior. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-24desktop: avoid crashes on drag&drop in GroupedLineEditGravatar Berthold Stoeger
If the user manages to "scroll" through the QPlainTextEdit by a drag&drop action, the state of the widget becomes inconsistent. On the one hand, the text-block says that it has one line. On the other hand, its layout says that it has no line. When trying to fetch the line, a crash occurs. Try to detect such a strange state and return early in GroupedLineEdit::paintEvent(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-23parser: replace params[] code by new xml_params structGravatar Berthold Stoeger
This fixes a load of memory holes, and makes the code (hopefully) more readable. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-17filter: don't add to filter presets when importing dive sitesGravatar Berthold Stoeger
When importing dive-sites we would add to the global filter-preset table. This data should be thrown away, just like the other tables that might be imported. This shows that we really should introduce a "struct divelog", which collects all those tables into a single structure. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-17filter: remove filter_preset_table_tGravatar Berthold Stoeger
We used a typedef "filter_preset_table_t" for the filter preset table, because it is a "std::vector<filter_preset>". However, that is in contrast to all the other global tables (dives, trips, sites) that we have. Therefore, turn this into a standard struct, which simply inherits from "std::vector<filter_preset>". Note that while inheriting from std::vector<> is generally not recommended, it is not a problem here, because we don't modify it in any shape or form. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-11desktop: make divecomputer table sortableGravatar Berthold Stoeger
Add a small proxy-model on top of DiveComputerModel so that clicking on table headers makes the table sortable. The UI feature here is not as important as the fact that the UI does its own sorting and we can keep the device-table in the core sorted differently. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-08build-system: remove building Grantlee cmakeGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-08Remove code references to GrantleeGravatar Robert C. Helling
These are no longer needed. What is still missing is removing Grantlee from the various build systems. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-08Interpret divelist printing templatesGravatar Robert C. Helling
This is a first step of an efford to get rid of the Grantlee dependency. This implements template processing for those constructs used in our divelist and statistics printing templates. It implements a template parser for loops over dives, cylinders and year and variable replacement. As the previous Grantlee code, it does not really use Qt's QObject introspection capabilities but reuses the old long chain of if-else-statements. The grantlee code is not yet removed. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-06cleanup: use safe connect() in ConfigureDiveComputerDialogGravatar Berthold Stoeger
The pointer-to-member-function version is compile-time checked and therefore less risky with respect to refactoring. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-05Remove empty vertical space from filter QListWidgetGravatar willemferguson
In the filter the dropdown lists for selecting dive mode or day-of-week has a lot of white space at the bottom. This PR removes that white space. Actually the white space at the bottom of a QListWidget appears to be a known bug (actually an omission) for the current Qt V15. The above solution is a brute-force workaround to achieve the same end result. The active line is actually the setFixedSize(). The other line, however, comprises good QT layout policy to minimise widget size. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2020-10-05clenup: remove bogus connect statement.Gravatar Berthold Stoeger
In OstcFirmwareCheck::saveOstcFirmware() we find the connect() call connect(dialog, SIGNAL(finished(int)), config, SLOT(dc_close())); whereby "config" is of the type "ConfigureDiveComputer". However, the function signature of ConfigureDiveComputer::dc_close reads as void dc_close(device_data_t *data); and indeed "data" is accessed inside the function. I don't understand how this doesn't crash, but clearly something is amiss. Let's remove that connect statement. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-03planner: limit depth and time of segments to sane valuesGravatar Berthold Stoeger
Using non-sensical depth and times for segments in the planner may lead to an unresponsive UI. Therefore limit depth to 1000 m/3300 ft and time to 100 h. Limiting of depth is done in settingsChanged() since it has to adapt to the user changig their preferred units. Fixes #2762. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-03cleanup: use getDiveSelection() to loop over selected divesGravatar Berthold Stoeger
getDiveSelection() returns a vector of the selected dives. Use that instead of looping over the dive table and checking manually. This removes a few lines of code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-03desktop: allow moving dives to arbitrary tripsGravatar Berthold Stoeger
The UI only allowed adding dives to trips above or below the current dive (and even that is buggy). This is a strange restriction, since trips are designed to be non-contiguous. Allow adding dives to any trip using the new trip selection dialog. The undo-command is already there, so only little code to write. This feature was requested on the mailing list. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-03desktop: add trip selection dialogGravatar Berthold Stoeger
A simple dialog to select a trip. Simply fill a QListWidget without the model/view rigmarole. So much less painful! Of course that means that the dialog has to be regenerated everytime it is used. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-02desktop: fix paging through dive list with page-up key, etcGravatar Berthold Stoeger
In the dive list we have horrible code, which intercepts all events to save the selection before/after the event. This was necessary because we couldn't get Qt's selection data flow under control. This means intercepting all events that can change the selection. The page-up, page-down, home and end keys were forgotten. Add these cases. Fixes #2957. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29cleanup: rename FilterWidget2 to FilterWidgetGravatar Berthold Stoeger
The name "FilterWidget2" is historical and has no meaning anymore, since the current version has little to nothing to do with the "second" version of the widget. Rename the class and source files accordingly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: avoid unnecessary filter recalculations when loading setGravatar Berthold Stoeger
When loading a stored filter set, we would get numerous constraintChanged signals, which caused filter recalculations. Use the ignoreSignal flag to prevent these. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: add modified flagGravatar Berthold Stoeger
When editing the filter, the modified flag is set and shown to the user. After saving / loading / clearing the filter, the flag is reset. This simulates (probably badly) a usual load/save interface. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: show currently selected preset in a text fieldGravatar Berthold Stoeger
This provides some visual feedback on the currently selected preset. Update when changing selection or clearing the filter. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: when clearing the filter unselect the current filter presetGravatar Berthold Stoeger
It makes no sense to have the a filter preset selected after clearing the filter. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: when a filter preset is selected, suggest its name on saveGravatar Berthold Stoeger
The goal here is to let the user edit already existing sets and save them using their old name. This is a stop-gap measure until we get a proper filter-set editing interface. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>