Don't do "obvious cleanups" at 4 in the morning when you can't sleep because
of emotionally draining issues outside of your control... and if you do,
at least compile test them.
This was introduced by me in commit 2f9f46cb0253 ("Random white space
cleanup").
Sorry.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I just went thru all of subsurface code removing
some whitespaces issues and trying to make the
code prettyer, I also removed a few QString issues.d
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This means we don't have to new/delete them, which is a waste of
overhead.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This means we can also remove the forward declarations.
This is the first step in removing the memory allocation for the ui
sub-classes. Without the second step, this commit is just making the
compilation time increase for no good reason :-)
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
* Removes the InterfaceThread
which is basically an unecessary proxy between the MainThread and
the DownloadThread.
* Use a state machine to control the DownloadWidget UI logic.
Signed-off-by: Danilo Cesar Lemes de Paula <danilo.eu@gmail.com>
The DownloadDialog behavior was broken in a way it allows the user
to make changes on the dialog while the download is happening.
Also, clicking on "Cancel" breaks/hangs the UI sometimes, as libdivingcomputer
doesn't always cancels the download right away. That's a bug that
still needs to be fixed.
Signed-off-by: Danilo Cesar Lemes de Paula <danilo.eu@gmail.com>
While most dialogs can be open and the main application window
can still be accessed, certain should possibly be modal
in these terms.
This patch proposes the download from webservice and DC dialogs
to lock the main application window until they are closed, with
the consideration of preventing eventual unexpected behavior
in the divelist if both dialogs are active at the same time.
To solve that QtDialog::exec() is used instead of
QtWidget::show().
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Most child windows should be closed with the main application
window otherwise if left open and if making specific
modifictions could potentially cause a SIGSEGV.
To solve that we mark all custom windows/dialogs with
the Qt::WA_QuitOnClose attribute on instance creation.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This behaves somewhat differently from the Gtk version - still needs
more investigation. But at least now it's hooked in.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The old gtk branch started out with device_data_t explicitly cleared,
but the Qt version never did that. And we actually depend on the
deviceid in particular being initialized to zero (and then we fill in
the details in the divecomputer download callbacks)
Not properly initializing it meant that we ended up with random
deviceid's that got added to the divecomputer device lists, and then
saved to the XML file without actually matching the data in the dive
computers in the actual *dives*.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
The data is saved in the settings and the correct dive computer (vendor
and product) and device are picked when the download dialog is openend.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Small changes to the names of elements the divecomputer download UI and
very simplistic first stab at populating the device_data_t structure.
This is lacking lots of things
- it should remember the last vendor / product used
- it should figure out which device (mount point) to offer
- it needs proper error handling
But it's a step in the right direction.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This uses the QStringListModel to populate the items
of the QComboBoxes. I used a QHash to hold every Computer
of a particular Vendor. so, products[vendor] gives me
the full list of products from each vendor.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
I think it's self explanatory - When user clicks on
'Cancel', the interface will wait for the trhead to quit
then will close itself.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
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>