Commit graph

2063 commits

Author SHA1 Message Date
jme
aecb4f5005 Delete desktop-widgets/preferences/preferences_dc.h
Remove preferences "Dive Download" window.    Delete all dive computers no longer needed now that they can be deleted on the import window.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-26 08:14:16 +12:00
jme
358b9186bf Delete desktop-widgets/preferences/preferences_dc.cpp
Remove preferences "Dive Download" window.    Delete all dive computers no longer needed now that they can be deleted on the import window.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-26 08:14:16 +12:00
jme
12ae3d4e96 Update preferencesdialog.cpp
Remove preferences "Dive Download" window.    Delete all dive computers no longer needed now that they can be dleted on the import window.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-26 08:14:16 +12:00
jme
34926f1325 Update CMakeLists.txt
Remove preferences "Dive Download" window.    Delete all dive computers no longer needed now that they can be dleted on the import window.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-26 08:14:16 +12:00
Berthold Stoeger
556ecd5a9b core: use C++-primitives for g_tag_list
The old code was leaking memory. Use std::unique_ptr<> for
ownership management.

This is still very primitive and divetags are kept during
application lifetime. There should probably be some form
of reference counting. And the taglist should not be global,
but attached to the divelog.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
b320942343 Replace remaining qDebug()s by report_info()
The only case left is in android.cpp, though that is only compiled
when compiling the full desktop app on Android. I.e. never. So
don't bother for now.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
9febfdd084 Remove diabled debugging output in subsurfacewebservices.cpp
Why bother with commented out code?

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
4af2ec88bd Use std::vector<string> instead of QStringList in main()
In an effort to convert core to C++ structures.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
c6cd10a43f core: make getCloudURL() return an std::string
Let's use std::string in the core. Notably, I'd like to make
the numerous main() functions mostly independent of Qt. Some
things will have to remain, such as argument parsing, of course.

This changes the API: instead of returning an error code and
taking a pointer to the actual return-value, return an
std::optional<std::string>> that is set if the function succeeds.

Returning an empty string in the error case might be simpler,
but oh well...

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
da7ea17b66 cleanup: replace fprintf to stderr by report_info()
Let's try to unify debugging output!

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
4db19d6284 planner: use std::string in plannernotes.cpp
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
jme
bd31efa821 Update downloadfromdivecomputer.cpp
Remove lines setting "current" computer to computer1.  

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-22 16:52:19 +12:00
jme
80eff1d6e2 Update downloadfromdivecomputer.ui
Per suggestion, use QFrame and trashcan icon.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-22 16:52:19 +12:00
jme
74b1648fcc Update downloadfromdivecomputer.h
Change DDC<n> to DeleteDC<n>

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-22 16:52:19 +12:00
jme
7fb0e9e59e Update downloadfromdivecomputer.cpp
Changed DDC<n> to DeleteDC<n> and hide set visibility for new Qframe

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-22 16:52:19 +12:00
jme
d59bd1831a Update downloadfromdivecomputer.cpp
Added delete dive computer buttons.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-22 16:52:19 +12:00
jme
f05808fded Update downloadfromdivecomputer.h
Added delete dive computer buttons.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-22 16:52:19 +12:00
jme
1692e48163 Update downloadfromdivecomputer.ui
Added delete dive computer buttons.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-22 16:52:19 +12:00
Michael Keller
375b08857c Desktop: Remove Unneeded Special Case for MacOS.
Since the removal of this special case for MacOS was confirmed to be
working in the case of building with bluetooth support in #4120, we should
probably remove it from the code used when building without bluetooth
support as well.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-04-21 13:13:18 +12:00
jme
77281f8bfe Update downloadfromdivecomputer.cpp
If Bluetooth isn't enabled, don't clear non Bluetooth address.    There was an earlier concern that USB mount point shouldn't be preserved because they may change.   This behavior is different on a Mac where the USB serial mount points tend to be persistent.   Michael tested this on Linux and suggested on saving the mount points for Linux and Windows.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-17 10:03:32 +12:00
jme
6b11457ddd Update downloadfromdivecomputer.cpp
Based on Michael's suggestion, added code to refine enableBluetoothMode. 

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-17 10:03:32 +12:00
jme
8a20509861 Update downloadfromdivecomputer.cpp
Removed blank lines - forgot that blank lines without a continuation \ would break the macro.    Embarrassing to say the least.   I need to figure out how to upload tested code into git.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-17 10:03:32 +12:00
jme
334a357c19 Update downloadfromdivecomputer.cpp
Removed the MacOs specific code and added comment explaining why ui.device.Text must be set before the ui.bluetoothMode change handler runs.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-17 10:03:32 +12:00
jme
1973d7c881 Update downloadfromdivecomputer.cpp
Preserve bluetooth address if we have it (don't rescan) and for MacOS save the mount point if we have it.     As best as I can tell, the mount points for USB devices do not change on MacOs regardless of the USB port being used.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-17 10:03:32 +12:00
jme
a5575f43a3 Update downloadfromdivecomputer.cpp
Per Michael's suggestion, use isBluetoothAddress as check before skipping Bluetooth scan. 

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-17 10:03:32 +12:00
jme
ffce4bc097 Update downloadfromdivecomputer.cpp
another space that should have been a tab.

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-17 10:03:32 +12:00
jme
5980db073a Update downloadfromdivecomputer.cpp
Replaces spaces with tabs and corrected misplaced braces (embarassing...).

Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-17 10:03:32 +12:00
jme
4dcc9210a9 Avoid unnecessary bluetooth device address scanning.
When switching from a non-bluetooth computer to a bluetooh computer an unnecessary bluetooth scan may be forced.   This patch will avoid the scan if the bluetooth device address is known.



Signed-off-by: jme <32236882+notrege@users.noreply.github.com>
2024-04-17 10:03:32 +12:00
Berthold Stoeger
0d011231e6 desktop: unglobalize ComboBox-models
The combo-boxes (cylinder type, weightsystem, etc.) were controlled
by global models. Keeping these models up-to-date was very combersome
and buggy.

Create a new model everytime a combobox is opened. Ultimately it
might even be better to create a copy of the strings and switch
to simple QStringListModel. Set data in the core directly and
don't do this via the models.

The result is much simpler and easier to handle.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-16 08:56:49 +12:00
Berthold Stoeger
2c490fcbbb desktop: take an std::string in MainWindow::setCurrentFile()
This fixes a crash condition when opening the cloud from
desktop: The old code passed a NULL pointer that was then
assigned to an std::string, which is not supported.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-25 06:45:36 +01:00
Berthold Stoeger
5ac64ab2cd cleanup: replace Q_FOREACH and foreach by range base for
Q_FOREACH and foreach are anachronisms.

Range based for may cause a performance regression: it can
lead to a copy of shared containers (one reason why Qt's
COW containers are broken). However, as long as there is no
user noticeable delay, there is no point in analyzing each case.
And also no point in slapping an 'asConst' on every container
that is looped over.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-24 17:53:19 +01:00
Berthold Stoeger
41cb916060 core: turn existing_filename into std::string
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-24 17:53:19 +01:00
Berthold Stoeger
37f2207f94 printing: pass current filename to dialog
Instead of accessing a global variable, pass the filename
from the MainWindow to the dialog. This is supposed to cut
down on the global variable mess.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-24 17:53:19 +01:00
Berthold Stoeger
3a1122048b core: make logfile_name and dumpfile_name std::string
To avoid memory management woes. These shouldn't be global
variables, but let's fix that later.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-24 17:53:19 +01:00
Berthold Stoeger
64419f2b19 dive download: pass current filename to dialog
Instead of accessing a global variable, pass the filename
from the MainWindow to the dialog. This is supposed to cut
down on the global variable mess.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-24 17:53:19 +01:00
Berthold Stoeger
981352646c computer configuration: pass current filename to dialog
Instead of accessing a global variable, pass the filename
from the MainWindow to the dialog. This is supposed to cut
down on the global variable mess.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-24 17:53:19 +01:00
Berthold Stoeger
2e067c89dd cleanup: Make ConfigureDiveComputerDialog::closeEvent() private
There is no subclass of ConfigureDiveComputerDialog, so there
seems no reason for protected members.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-24 17:53:19 +01:00
Berthold Stoeger
8733828380 computer configuration: use value semantics for DeviceDetails
The memory managements for DeviceDetails was very sketchy.
First of all, sharing a pointer to a structure between threads
seems like a recipe for disaster. Secondly, the structure was
a QObject and when first generated included in the (silly)
Qt object tree, but when generated in the threads it was not.
Clearly, this leaks.

Instead, use value semantics and use local copies of the
structure. I didn't go full length and use std::move to
move the data, because this doesn't work through signals
(which are the wrong abstraction here, but OK) and secondly
I didn't have time to analyze whether the caller still
needs the data after passing it down to the worker thread.

To be able to pass an object through signals, the class
has to be registered in the Qt MetaType system. Super
ugly, but fine for now. Ultimately, this whole thing should
probably be replaced by futures, co-routines, or whatever.

Moreover, this removes the prefix from  number of "m_*"
function parameters. By convention, "m_" marks member
variables, which function parameters are not.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>

make DeviceDetails a metatype

So that we can pass it as value through the signal/slot system.
(squash with original commit)

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-24 17:53:19 +01:00
Berthold Stoeger
3229d1e3a1 preferences: replace macro by local function
No apparent reason for having this as a hard-to-read macro.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-13 13:17:01 +13:00
Berthold Stoeger
857148efd6 preferences: replace SIGNAL/SLOT by function pointers
This give compile time checking. In fact, one of the connections was
not working (currentIndexChanged(QString) doesn't exist in newer(?)
Qt versions).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-13 13:17:01 +13:00
Berthold Stoeger
bfbf4934dd core: enable compiler warngings for report_error and report_info
printf() is a horrible interface as it does no type checking.
Let's at least use the compiler to check format strings and
arguments. This obviously doesn't work for translated strings
and using report_error on translated strings is dubious. But OK.

Had to convert a number of report_error() calls to supress
warnings.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-12 10:31:07 -04:00
Berthold Stoeger
119fe908c7 core: port filterpreset.cpp to std::string
Less memory management hassle.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Michael Keller
1ce385b363 Desktop: Add Button and Link to 'Contribute' Page.
Add a button that opens the 'Contribute' page to the 'About' dialogue,
to encourage more users to start to contribute.

Requires https://github.com/subsurface/new-website/pull/36 to be
deployed to have a valid link target.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-02-04 14:50:18 -08:00
Dirk Hohndel
3eb5ea9adf desktop: add password reset to cloud preferences
This must be the number one support request we get. I can't believe we never
thought of adding a button to do this.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-25 10:42:48 -08:00
Simeon
24c1cb5b09 Update to use AUTOMOC
When trying to build the integrated user manual,
the linker stopped with the error message "undefined reference to vtable ...".
This is a subtle bug, connected to the qt preprocessor MOC.
Adding "set(CMAKE_AUTOMOC ON)" to the desktop-widgets/CMakeLists.txt fixed the problem.

For more information, see:
https://github.com/bincrafters/community/issues/466
https://cmake.org/cmake/help/latest/prop_tgt/AUTOMOC.html

Signed-off-by: Simeon Geiger <simeon.geiger@gmail.com>
2024-01-20 09:38:22 -08:00
Berthold Stoeger
bef21ff5eb code consistency: replace qMin/qMax by std::min/std::max
We use the latter pretty consistently, so let's remove the few
left instances of the former.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-01-17 14:23:19 -08:00
Berthold Stoeger
91e4fb4769 cleanup: more Coverity silencing
Mostly irrelevant std::move() stuff of copy-on-write Qt objects,
a few real bugs, a timestamp_t downconversion and some codingsyle
adaptation.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-01-17 14:23:19 -08:00
Berthold Stoeger
35ff6eea35 desktop: block signals when setting combobox-indexes
On the InformationTab a signal is emitted when programatically
setting the index of the dive mode combobox which in turn then
edits the dive.

Usually not a problem, because the editing code realizes that
the value is not changed. It is however a problem when multiple
dives are selected.

Therefore, block the signals when setting the index. Same for
the other comboboxes on the same page.

Fixes #3960.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-01-16 14:52:36 -08:00
Berthold Stoeger
bdade9e499 planner: initialize subobject of PlannerWidgets in correct order
The DivePlannerWidget was initialized before the planner models.
However, it attaches these (non existing) models to the comboboxes.
That can't work. Initialize in correct order.

Fixes #4014

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-01-16 14:22:16 -08:00
Berthold Stoeger
8a3a0edb83 cleanup: silence std::move()-related Coverity warnings
Unfortunately Coverity doesn't understand that most Qt data
structures are copy-on-write. It's a mis-feature of Qt, but
it is the way it is. Thus, passing by value is not an issue.

Out of ca. 25 warnings only two were legit. Let's silence
the others by either std::move()ing or passing by reference,
as would be idiomatic C++, which Qt is not.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-01-15 15:11:36 -08:00