diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 69cf363c3..5a2f872b4 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -252,7 +252,12 @@ void MainWindow::on_actionDownloadDC_triggered()
void MainWindow::on_actionDownloadWeb_triggered()
{
- SubsurfaceWebServices::instance()->runDialog();
+ SubsurfaceWebServices::instance()->exec();
+}
+
+void MainWindow::on_actionDivelogs_de_triggered()
+{
+ DivelogsDeWebServices::instance()->exec();
}
void MainWindow::on_actionEditDeviceNames_triggered()
diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h
index 5dfae3e98..1c68fc4f7 100644
--- a/qt-ui/mainwindow.h
+++ b/qt-ui/mainwindow.h
@@ -69,6 +69,7 @@ private slots:
/* log menu actions */
void on_actionDownloadDC_triggered();
void on_actionDownloadWeb_triggered();
+ void on_actionDivelogs_de_triggered();
void on_actionEditDeviceNames_triggered();
void on_actionAddDive_triggered();
void on_actionRenumber_triggered();
@@ -120,7 +121,6 @@ private:
void redrawProfile();
void file_save();
void file_save_as();
- void setupSplitters();
};
MainWindow *mainWindow();
diff --git a/qt-ui/mainwindow.ui b/qt-ui/mainwindow.ui
index ffe55c1f9..2ea6df354 100644
--- a/qt-ui/mainwindow.ui
+++ b/qt-ui/mainwindow.ui
@@ -18,7 +18,16 @@
0
-
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
0
-
@@ -39,7 +48,16 @@
0
-
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
0
-
@@ -52,7 +70,16 @@
0
-
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
0
-
@@ -70,7 +97,16 @@
0
-
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
0
-
@@ -83,7 +119,16 @@
0
-
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
0
-
@@ -169,7 +214,7 @@
0
0
763
- 32
+ 18
diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp
index f2b1b88cc..7ece0a640 100644
--- a/qt-ui/subsurfacewebservices.cpp
+++ b/qt-ui/subsurfacewebservices.cpp
@@ -15,6 +15,33 @@
struct dive_table gps_location_table;
static bool merge_locations_into_dives(void);
+WebServices::WebServices(QWidget* parent, Qt::WindowFlags f): QDialog(parent, f)
+, reply(0)
+{
+ ui.setupUi(this);
+ connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*)));
+ connect(ui.download, SIGNAL(clicked(bool)), this, SLOT(startDownload()));
+ ui.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
+
+}
+
+void WebServices::hidePassword()
+{
+ ui.password->hide();
+ ui.passLabel->hide();
+}
+
+void WebServices::hideUpload()
+{
+ ui.upload->hide();
+}
+
+// #
+// #
+// # Subsurface Web Service Implementation.
+// #
+// #
+
SubsurfaceWebServices* SubsurfaceWebServices::instance()
{
static SubsurfaceWebServices *self = new SubsurfaceWebServices();
@@ -24,12 +51,10 @@ SubsurfaceWebServices* SubsurfaceWebServices::instance()
SubsurfaceWebServices::SubsurfaceWebServices(QWidget* parent, Qt::WindowFlags f)
{
- ui.setupUi(this);
- connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*)));
- connect(ui.download, SIGNAL(clicked(bool)), this, SLOT(startDownload()));
- ui.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
QSettings s;
- ui.userID->setText(s.value("webservice_uid").toString());
+ ui.userID->setText(s.value("subsurface_webservice_uid").toString());
+ hidePassword();
+ hideUpload();
}
static void clear_table(struct dive_table *table)
@@ -56,7 +81,7 @@ void SubsurfaceWebServices::buttonClicked(QAbstractButton* button)
/* store last entered uid in config */
QSettings s;
- s.setValue("webservice_uid", ui.userID->text());
+ s.setValue("subsurface_webservice_uid", ui.userID->text());
s.sync();
hide();
close();
@@ -135,11 +160,6 @@ void SubsurfaceWebServices::setStatusText(int status)
ui.status->setText(text);
}
-void SubsurfaceWebServices::runDialog()
-{
- exec();
-}
-
/* requires that there is a or tag under the tag */
void SubsurfaceWebServices::download_dialog_traverse_xml(xmlNodePtr node, unsigned int *download_status)
{
@@ -240,3 +260,51 @@ static bool merge_locations_into_dives(void)
}
return changed > 0;
}
+
+// #
+// #
+// # Divelogs DE Web Service Implementation.
+// #
+// #
+
+DivelogsDeWebServices* DivelogsDeWebServices::instance()
+{
+ static DivelogsDeWebServices *self = new DivelogsDeWebServices();
+ self->setAttribute(Qt::WA_QuitOnClose, false);
+ return self;
+}
+
+DivelogsDeWebServices::DivelogsDeWebServices(QWidget* parent, Qt::WindowFlags f): WebServices(parent, f)
+{
+
+}
+
+void DivelogsDeWebServices::startUpload()
+{
+
+}
+
+void DivelogsDeWebServices::startDownload()
+{
+
+}
+
+void DivelogsDeWebServices::downloadFinished()
+{
+
+}
+
+void DivelogsDeWebServices::setStatusText(int status)
+{
+
+}
+
+void DivelogsDeWebServices::downloadError(QNetworkReply::NetworkError error)
+{
+
+}
+
+void DivelogsDeWebServices::buttonClicked(QAbstractButton* button)
+{
+
+}
diff --git a/qt-ui/subsurfacewebservices.h b/qt-ui/subsurfacewebservices.h
index 0719a8f15..515e3fe9c 100644
--- a/qt-ui/subsurfacewebservices.h
+++ b/qt-ui/subsurfacewebservices.h
@@ -5,33 +5,64 @@
#include
#include
-#include "ui_subsurfacewebservices.h"
+#include "ui_webservices.h"
class QAbstractButton;
class QNetworkReply;
-class SubsurfaceWebServices : public QDialog {
+class WebServices : public QDialog{
Q_OBJECT
public:
- static SubsurfaceWebServices* instance();
- void runDialog();
-
-private slots:
- void startDownload();
- void buttonClicked(QAbstractButton* button);
- void downloadFinished();
- void downloadError(QNetworkReply::NetworkError error);
-
-private:
- void setStatusText(int status);
- void download_dialog_traverse_xml(xmlNodePtr node, unsigned int *download_status);
- unsigned int download_dialog_parse_response(const QByteArray& length);
+ explicit WebServices(QWidget* parent = 0, Qt::WindowFlags f = 0);
+ void hidePassword();
+ void hideUpload();
- explicit SubsurfaceWebServices(QWidget* parent = 0, Qt::WindowFlags f = 0);
- Ui::SubsurfaceWebServices ui;
+private slots:
+ virtual void startDownload() = 0;
+ virtual void startUpload() = 0;
+ virtual void buttonClicked(QAbstractButton* button) = 0;
+
+protected:
+ Ui::WebServices ui;
QNetworkReply *reply;
QNetworkAccessManager *manager;
QByteArray downloadedData;
};
+class SubsurfaceWebServices : public WebServices {
+ Q_OBJECT
+public:
+ static SubsurfaceWebServices* instance();
+
+private slots:
+ void startDownload();
+ void buttonClicked(QAbstractButton* button);
+ void downloadFinished();
+ void downloadError(QNetworkReply::NetworkError error);
+ void startUpload(){} /*no op*/
+private:
+ explicit SubsurfaceWebServices(QWidget* parent = 0, Qt::WindowFlags f = 0);
+ void setStatusText(int status);
+ void download_dialog_traverse_xml(xmlNodePtr node, unsigned int *download_status);
+ unsigned int download_dialog_parse_response(const QByteArray& length);
+};
+
+class DivelogsDeWebServices : public WebServices {
+ Q_OBJECT
+public:
+ static DivelogsDeWebServices * instance();
+
+private slots:
+ void startDownload();
+ void buttonClicked(QAbstractButton* button);
+ void downloadFinished();
+ void downloadError(QNetworkReply::NetworkError error);
+ void startUpload();
+private:
+ explicit DivelogsDeWebServices (QWidget* parent = 0, Qt::WindowFlags f = 0);
+ void setStatusText(int status);
+ void download_dialog_traverse_xml(xmlNodePtr node, unsigned int *download_status);
+ unsigned int download_dialog_parse_response(const QByteArray& length);
+};
+
#endif
diff --git a/qt-ui/subsurfacewebservices.ui b/qt-ui/webservices.ui
similarity index 71%
rename from qt-ui/subsurfacewebservices.ui
rename to qt-ui/webservices.ui
index 899eea909..b190a7980 100644
--- a/qt-ui/subsurfacewebservices.ui
+++ b/qt-ui/webservices.ui
@@ -1,40 +1,23 @@
- SubsurfaceWebServices
-
+ WebServices
+
0
0
- 399
- 104
+ 425
+ 141
Download Location Data
- -
-
-
- 0
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Help
-
-
-
- -
-
+
-
+
- Download
+ Status:
@@ -45,6 +28,30 @@
+ -
+
+
+ Download
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Help
+
+
+
+ -
+
+
+ 0
+
+
+
-
@@ -52,20 +59,34 @@
- -
-
-
- Status:
-
-
-
- -
+
-
+ -
+
+
+ Password
+
+
+
+ -
+
+
+ QLineEdit::Password
+
+
+
+ -
+
+
+ Upload
+
+
+
@@ -73,7 +94,7 @@
buttonBox
accepted()
- SubsurfaceWebServices
+ WebServices
accept()
@@ -89,7 +110,7 @@
buttonBox
rejected()
- SubsurfaceWebServices
+ WebServices
reject()
diff --git a/subsurface.pro b/subsurface.pro
index e9927686f..15caa8f99 100644
--- a/subsurface.pro
+++ b/subsurface.pro
@@ -119,7 +119,7 @@ FORMS = \
qt-ui/preferences.ui \
qt-ui/printoptions.ui \
qt-ui/renumber.ui \
- qt-ui/subsurfacewebservices.ui \
+ qt-ui/webservices.ui \
qt-ui/tableview.ui \
qt-ui/csvimportdialog.ui