This is far from perfect.
Avoid a weird warning when total = -1 is passed into the progress bar.
Enable the Accept button once the download completes.
Merge the downloaded dives into the existing dive list on Apply.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This implements support for:
* uploading a zip file containing dives - untested
(the zip file must have been prepared elsewhere)
* downloading the dive list and the dive XML files
The networking part is finished, but it's missing the actual import of
the XML files sent by divelogs.de.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
The time out is 30 seconds from the start of the request or from the
last time we got any data from the server.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
QNetworkReply might emit signals after it's been told to go away. We
don't want to change the status after that.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Re-enable buttons that should be enabled by default, disable the others,
set the status to empty, make the progress bar go back to zero.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Just my OCD asserting itself. It looks cleaner this way, if the static
functions aren't interleaved in the middle of the WebServices class.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
One of the rules of using QNetworkAccessManager is to share it among all
users, since sockets and other state can be shared. Looks like Marble
doesn't allow us to set it, though, and it creates multiple instances.
I'll prepare an upstream patch to fix that sometime.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Subsurface creates a lot of singleton instances on demand, but nothing
ever deleted them. Since they are singletons, these memory allocations
are technically not leaks. However, they clutter the output in valgrind
and other memory analysers, hiding the real issues.
The solution is to delete these items at exit. For the models and for
gettextFromC, the solution is to use a QScopedPointer, which will delete
its payload when it gets destroyed. For the dialogs and other widgets,
we can't do that: they need to be deleted before QApplication exits, so
we just set the parent in all of them to the main window.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I'll admit that I don't fully understand this part of Qt.
But commenting out the deleteLater (like we already do for another one)
fixes the crash - and shouldn't do more than add a potential small memory
leak.
Fixes#309
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch does the hooking up to show the dialog of the
divelogs.de window when the user selects it on the menu.:
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Added the skeleton code for the Download / Upload from Divelogs.
de webservice. Now I need to hoopup things from the .ui side and
do the actual implementation of the code.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
The setting was 'webservice', but this is too wide, since we are
supporting more than one. changed it to 'subsurface_webservice_uid'
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Created a WebService dialog that will handle download and upload
from all child based webservices. Also, ported the currently - only
- one webservice to use the new dialog.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This patch implements GUI for importing CSV log files. One is able to
configure what columns contain time, depth and temperature fields.
Pre-configured log applications currently included are ADP log viewer
and XP5. (Both of these use actually tab as separator, so the field
separator currently hard-coded.)
[Dirk Hohndel: minor fixes]
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The Model View system in Qt is *very* verbose, this is the
beginning of a series of patches that will concentrate
the boilerplate somewhere and reduce the amount of lines
and will also try to make the code cleaner and easyer to
understand,
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
- remove the build flags and libraries from the Makefile / Configure.mk
- remove the glib types (gboolean, gchar, gint64, gint)
- comment out / hack around gettext
- replace the glib file helper functions
- replace g_ascii_strtod
- replace g_build_filename
- use environment variables instead of g_get_home_dir() & g_get_user_name()
- comment out GPS string parsing (uses glib utf8 macros)
This needs massive cleanup, but it's a snapshot of what I have right now, in
case people want to look at it.
Signed-off-by: Dirk Hohndel <dirk@hohndel.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>
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>
We need to close the dialog after applying what was downloaded, and we
should not try to delete the manager in case of cancel (as that reliably
causes the SIGSEGV.
Suggested-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Hoocked up the apply button - Didn't tested ( as I frankly don't know
what the expected result should be. ). but the app is not crashing, yey.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
The XML is now being correctly parsed, Clicking on Help
will open the browser pointing to the api site, and clicking
on cancel will cancel the download.
Clicking on Apply still doesn't apply, but that's next. :)
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Added initial support for download dive info from subsurface web service,
the current code only downloads and output the xml downloaded in the debug
area. Now I need to parse things up and plug the unplugged stuff.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>