summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-23 09:09:48 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-23 09:31:08 -0800
commitddc01e39e7486434c6b814358ab4c77ea92c0776 (patch)
tree400ca390cff8070e5736eeeaf5d3f913b7d58b0a /qt-ui
parent62999c866f993bacadbbcad8aaf9a191f440dd1a (diff)
downloadsubsurface-ddc01e39e7486434c6b814358ab4c77ea92c0776.tar.gz
Move helper functions around
We had a ton of helper functions in qt-gui.cpp which really didn't make much sense. So I moved them all into qthelper.cpp. Also moved the UserAgent helper that didn't belong in the UpdateHandler to begin with - that's a generic helper used in many places... With this we can successfully build using cmake again. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/diveshareexportdialog.cpp3
-rw-r--r--qt-ui/subsurfacewebservices.cpp3
-rw-r--r--qt-ui/updatemanager.cpp3
-rw-r--r--qt-ui/usersurvey.cpp16
-rw-r--r--qt-ui/usersurvey.h1
5 files changed, 6 insertions, 20 deletions
diff --git a/qt-ui/diveshareexportdialog.cpp b/qt-ui/diveshareexportdialog.cpp
index 9e8e69ad6..40670d7fc 100644
--- a/qt-ui/diveshareexportdialog.cpp
+++ b/qt-ui/diveshareexportdialog.cpp
@@ -4,6 +4,7 @@
#include "save-html.h"
#include "usersurvey.h"
#include "subsurfacewebservices.h"
+#include "helpers.h"
#include <QDesktopServices>
#include <QSettings>
@@ -130,7 +131,7 @@ void DiveShareExportDialog::doUpload()
else
request.setUrl(QUrl(DIVESHARE_BASE_URI "/upload"));
- request.setRawHeader("User-Agent", UserSurvey::getUserAgent().toUtf8());
+ request.setRawHeader("User-Agent", getUserAgent().toUtf8());
if (ui->txtUID->text().length() != 0)
request.setRawHeader("X-UID", ui->txtUID->text().toUtf8());
diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp
index 0348d6b8f..908747b25 100644
--- a/qt-ui/subsurfacewebservices.cpp
+++ b/qt-ui/subsurfacewebservices.cpp
@@ -1,4 +1,5 @@
#include "subsurfacewebservices.h"
+#include "helpers.h"
#include "webservice.h"
#include "mainwindow.h"
#include "usersurvey.h"
@@ -232,7 +233,7 @@ WebServices::WebServices(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f
ui.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
timeout.setSingleShot(true);
defaultApplyText = ui.buttonBox->button(QDialogButtonBox::Apply)->text();
- userAgent = UserSurvey::getUserAgent();
+ userAgent = getUserAgent();
}
void WebServices::hidePassword()
diff --git a/qt-ui/updatemanager.cpp b/qt-ui/updatemanager.cpp
index fbaa6ba3c..8a22400b9 100644
--- a/qt-ui/updatemanager.cpp
+++ b/qt-ui/updatemanager.cpp
@@ -1,5 +1,6 @@
#include "updatemanager.h"
#include "usersurvey.h"
+#include "helpers.h"
#include <QtNetwork>
#include <QMessageBox>
#include <QUuid>
@@ -53,7 +54,7 @@ void UpdateManager::checkForUpdates(bool automatic)
QNetworkRequest request;
request.setUrl(url);
request.setRawHeader("Accept", "text/xml");
- QString userAgent = UserSurvey::getUserAgent();
+ QString userAgent = getUserAgent();
request.setRawHeader("User-Agent", userAgent.toUtf8());
connect(SubsurfaceWebServices::manager()->get(request), SIGNAL(finished()), this, SLOT(requestReceived()), Qt::UniqueConnection);
}
diff --git a/qt-ui/usersurvey.cpp b/qt-ui/usersurvey.cpp
index a2b47e4d0..05da582a1 100644
--- a/qt-ui/usersurvey.cpp
+++ b/qt-ui/usersurvey.cpp
@@ -49,22 +49,6 @@ QString UserSurvey::getVersion()
return sysInfo;
}
-QString UserSurvey::getUserAgent()
-{
- QString arch;
- // fill in the system data - use ':' as separator
- // replace all other ':' with ' ' so that this is easy to parse
- QString userAgent = QString("Subsurface:%1:").arg(subsurface_version());
- userAgent.append(SubsurfaceSysInfo::prettyOsName().replace(':', ' ') + ":");
- arch = SubsurfaceSysInfo::buildCpuArchitecture().replace(':', ' ');
- userAgent.append(arch);
- if (arch == "i386")
- userAgent.append("/" + SubsurfaceSysInfo::currentCpuArchitecture());
- userAgent.append(":" + uiLanguage(NULL));
- return userAgent;
-
-}
-
UserSurvey::~UserSurvey()
{
delete ui;
diff --git a/qt-ui/usersurvey.h b/qt-ui/usersurvey.h
index 55140521e..1dd5aaab3 100644
--- a/qt-ui/usersurvey.h
+++ b/qt-ui/usersurvey.h
@@ -16,7 +16,6 @@ public:
explicit UserSurvey(QWidget *parent = 0);
~UserSurvey();
static QString getVersion();
- static QString getUserAgent();
private
slots: