diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2020-04-19 12:39:59 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-04-19 14:27:54 -0700 |
commit | ad66297cfd843199f39e3a231cb8311652ea183c (patch) | |
tree | fedc6cf6422fa120de30c570f3b9a7a1224242de /desktop-widgets | |
parent | 4fd4b75269469ee1029c51bdaf8275149d20a929 (diff) | |
download | subsurface-ad66297cfd843199f39e3a231cb8311652ea183c.tar.gz |
desktop: remove user survey
We have never made good use of the results. Let's just remove it.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/CMakeLists.txt | 3 | ||||
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 33 | ||||
-rw-r--r-- | desktop-widgets/mainwindow.h | 3 | ||||
-rw-r--r-- | desktop-widgets/mainwindow.ui | 6 | ||||
-rw-r--r-- | desktop-widgets/subsurfacewebservices.cpp | 15 | ||||
-rw-r--r-- | desktop-widgets/subsurfacewebservices.h | 7 | ||||
-rw-r--r-- | desktop-widgets/usersurvey.cpp | 134 | ||||
-rw-r--r-- | desktop-widgets/usersurvey.h | 31 | ||||
-rw-r--r-- | desktop-widgets/usersurvey.ui | 191 |
9 files changed, 0 insertions, 423 deletions
diff --git a/desktop-widgets/CMakeLists.txt b/desktop-widgets/CMakeLists.txt index 82a81321e..499dd27b9 100644 --- a/desktop-widgets/CMakeLists.txt +++ b/desktop-widgets/CMakeLists.txt @@ -43,7 +43,6 @@ set (SUBSURFACE_UI tableview.ui templateedit.ui urldialog.ui - usersurvey.ui webservices.ui tab-widgets/maintab.ui tab-widgets/TabDiveStatistics.ui @@ -130,8 +129,6 @@ set(SUBSURFACE_INTERFACE textedit.h updatemanager.cpp updatemanager.h - usersurvey.cpp - usersurvey.h ) if(NOT NO_USERMANUAL) diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index e7416fe89..d81a2f914 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -51,7 +51,6 @@ #include "desktop-widgets/subsurfacewebservices.h" #include "desktop-widgets/tab-widgets/maintab.h" #include "desktop-widgets/updatemanager.h" -#include "desktop-widgets/usersurvey.h" #include "desktop-widgets/simplewidgets.h" #include "commands/command.h" @@ -125,7 +124,6 @@ MainWindow::MainWindow() : QMainWindow(), helpView(0), #endif state(VIEWALL), - survey(nullptr), findMovedImagesDialog(nullptr) { Q_ASSERT_X(m_Instance == NULL, "MainWindow", "MainWindow recreated!"); @@ -1177,13 +1175,6 @@ void MainWindow::on_actionUserManual_triggered() #endif } -void MainWindow::on_actionUserSurvey_triggered() -{ - if(!survey) - survey = new UserSurvey(this); - survey->show(); -} - void MainWindow::on_actionHash_images_triggered() { if(!findMovedImagesDialog) @@ -1333,40 +1324,16 @@ void MainWindow::initialUiSetup() void MainWindow::readSettings() { - static bool firstRun = true; init_proxy(); // now make sure that the cloud menu items are enabled IFF cloud account is verified enableDisableCloudActions(); loadRecentFiles(); - if (firstRun) { - checkSurvey(); - firstRun = false; - } } #undef TOOLBOX_PREF_BUTTON -void MainWindow::checkSurvey() -{ - QSettings s; - s.beginGroup("UserSurvey"); - if (!s.contains("FirstUse42")) { - QVariant value = QDate().currentDate(); - s.setValue("FirstUse42", value); - } - // wait a week for production versions, but not at all for non-tagged builds - int waitTime = 7; - QDate firstUse42 = s.value("FirstUse42").toDate(); - if (run_survey || (firstUse42.daysTo(QDate().currentDate()) > waitTime && !s.contains("SurveyDone"))) { - if (!survey) - survey = new UserSurvey(this); - survey->show(); - } - s.endGroup(); -} - void MainWindow::writeSettings() { QSettings settings; diff --git a/desktop-widgets/mainwindow.h b/desktop-widgets/mainwindow.h index 1fb20a7ce..ec09e7223 100644 --- a/desktop-widgets/mainwindow.h +++ b/desktop-widgets/mainwindow.h @@ -74,7 +74,6 @@ public: void importFiles(const QStringList importFiles); void setToolButtonsEnabled(bool enabled); void printPlan(); - void checkSurvey(); void setApplicationState(ApplicationState state); bool inPlanner(); NotificationWidget *getNotificationWidget(); @@ -127,7 +126,6 @@ slots: /* other menu actions */ void on_actionAboutSubsurface_triggered(); void on_actionUserManual_triggered(); - void on_actionUserSurvey_triggered(); void on_actionDivePlanner_triggered(); void on_actionReplanDive_triggered(); void on_action_Check_for_Updates_triggered(); @@ -217,7 +215,6 @@ private: void setupForAddAndPlan(const char *model); void configureToolbar(); void setupSocialNetworkMenu(); - QDialog *survey; QDialog *findMovedImagesDialog; struct dive copyPasteDive; struct dive_components what; diff --git a/desktop-widgets/mainwindow.ui b/desktop-widgets/mainwindow.ui index 3e839e51b..5b9e318f5 100644 --- a/desktop-widgets/mainwindow.ui +++ b/desktop-widgets/mainwindow.ui @@ -121,7 +121,6 @@ </property> <addaction name="actionAboutSubsurface"/> <addaction name="action_Check_for_Updates"/> - <addaction name="actionUserSurvey"/> <addaction name="actionUserManual"/> </widget> <widget class="QMenu" name="menuImport"> @@ -659,11 +658,6 @@ <string>Toggle tissue heat-map</string> </property> </action> - <action name="actionUserSurvey"> - <property name="text"> - <string>User &survey</string> - </property> - </action> <action name="action_Undo"> <property name="text"> <string>&Undo</string> diff --git a/desktop-widgets/subsurfacewebservices.cpp b/desktop-widgets/subsurfacewebservices.cpp index 80a17af2a..d016a9dc6 100644 --- a/desktop-widgets/subsurfacewebservices.cpp +++ b/desktop-widgets/subsurfacewebservices.cpp @@ -4,7 +4,6 @@ #include "core/webservice.h" #include "core/settings/qPrefCloudStorage.h" #include "desktop-widgets/mainwindow.h" -#include "desktop-widgets/usersurvey.h" #include "commands/command.h" #include "core/trip.h" #include "core/errorhelper.h" @@ -478,17 +477,3 @@ void DivelogsDeWebServices::buttonClicked(QAbstractButton *button) break; } } - -UserSurveyServices::UserSurveyServices(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f) -{ -} - -QNetworkReply *UserSurveyServices::sendSurvey(QString values) -{ - QNetworkRequest request; - request.setUrl(QString("http://subsurface-divelog.org/survey?%1").arg(values)); - request.setRawHeader("Accept", "text/xml"); - request.setRawHeader("User-Agent", getUserAgent().toUtf8()); - QNetworkReply *reply = manager()->get(request); - return reply; -} diff --git a/desktop-widgets/subsurfacewebservices.h b/desktop-widgets/subsurfacewebservices.h index 8f515e27c..e9b593005 100644 --- a/desktop-widgets/subsurfacewebservices.h +++ b/desktop-widgets/subsurfacewebservices.h @@ -76,11 +76,4 @@ private: bool useSelectedDives; }; -class UserSurveyServices : public QDialog { - Q_OBJECT -public: - QNetworkReply* sendSurvey(QString values); - explicit UserSurveyServices(QWidget *parent = 0, Qt::WindowFlags f = 0); -}; - #endif // SUBSURFACEWEBSERVICES_H diff --git a/desktop-widgets/usersurvey.cpp b/desktop-widgets/usersurvey.cpp deleted file mode 100644 index 9f237abea..000000000 --- a/desktop-widgets/usersurvey.cpp +++ /dev/null @@ -1,134 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include <QShortcut> -#include <QMessageBox> -#include <QSettings> - -#include "desktop-widgets/usersurvey.h" -#include "ui_usersurvey.h" -#include "core/version.h" -#include "desktop-widgets/subsurfacewebservices.h" -#include "desktop-widgets/updatemanager.h" - -#include "core/qthelper.h" -#include "core/subsurfacesysinfo.h" - -UserSurvey::UserSurvey(QWidget *parent) : QDialog(parent), - ui(new Ui::UserSurvey) -{ - ui->setupUi(this); - ui->buttonBox->buttons().first()->setText(tr("Send")); - this->adjustSize(); - QShortcut *closeKey = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); - connect(closeKey, SIGNAL(activated()), this, SLOT(close())); - QShortcut *quitKey = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); - connect(quitKey, SIGNAL(activated()), parent, SLOT(close())); - - os = QString("ssrfVers=%1").arg(subsurface_canonical_version()); - os.append(QString("&prettyOsName=%1").arg(SubsurfaceSysInfo::prettyOsName())); - QString arch = SubsurfaceSysInfo::buildCpuArchitecture(); - os.append(QString("&appCpuArch=%1").arg(arch)); - if (arch == "i386") { - QString osArch = SubsurfaceSysInfo::currentCpuArchitecture(); - os.append(QString("&osCpuArch=%1").arg(osArch)); - } - os.append(QString("&uiLang=%1").arg(getUiLanguage())); - os.append(QString("&uuid=%1").arg(getUUID())); - ui->system->setPlainText(getVersion()); -} - -QString UserSurvey::getVersion() -{ - QString arch; - // fill in the system data - QString sysInfo = QString("Subsurface %1").arg(subsurface_canonical_version()); - sysInfo.append(tr("\nOperating system: %1").arg(SubsurfaceSysInfo::prettyOsName())); - arch = SubsurfaceSysInfo::buildCpuArchitecture(); - sysInfo.append(tr("\nCPU architecture: %1").arg(arch)); - if (arch == "i386") - sysInfo.append(tr("\nOS CPU architecture: %1").arg(SubsurfaceSysInfo::currentCpuArchitecture())); - sysInfo.append(tr("\nLanguage: %1").arg(getUiLanguage())); - return sysInfo; -} - -UserSurvey::~UserSurvey() -{ - delete ui; -} - -#define ADD_OPTION(_name) values.append(ui->_name->isChecked() ? "&" #_name "=1" : "&" #_name "=0") - -void UserSurvey::on_buttonBox_accepted() -{ - // now we need to collect the data and submit it - QString values = os; - ADD_OPTION(recreational); - ADD_OPTION(tech); - ADD_OPTION(planning); - ADD_OPTION(download); - ADD_OPTION(divecomputer); - ADD_OPTION(manual); - ADD_OPTION(companion); - values.append(QString("&suggestion=%1").arg(ui->suggestions->toPlainText())); - UserSurveyServices uss(this); - connect(uss.sendSurvey(values), SIGNAL(finished()), SLOT(requestReceived())); - hide(); -} - -void UserSurvey::on_buttonBox_rejected() -{ - QMessageBox response(this); - response.setText(tr("Should we ask you later?")); - response.addButton(tr("Don't ask me again"), QMessageBox::RejectRole); - response.addButton(tr("Ask later"), QMessageBox::AcceptRole); - response.setWindowTitle(tr("Ask again?")); // Not displayed on MacOSX as described in Qt API - response.setIcon(QMessageBox::Question); - response.setWindowModality(Qt::WindowModal); - switch (response.exec()) { - case QDialog::Accepted: - // nothing to do here, we'll just ask again the next time they start - break; - case QDialog::Rejected: - QSettings s; - s.beginGroup("UserSurvey"); - s.setValue("SurveyDone", "declined"); - break; - } - hide(); -} - -void UserSurvey::requestReceived() -{ - QMessageBox msgbox; - QString msgTitle = tr("Submit user survey."); - QString msgText = "<h3>" + tr("Subsurface was unable to submit the user survey.") + "</h3>"; - - QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender()); - if (reply->error() != QNetworkReply::NoError) { - //Network Error - msgText = msgText + "<br/><b>" + tr("The following error occurred:") + "</b><br/>" + reply->errorString() - + "<br/><br/><b>" + tr("Please check your internet connection.") + "</b>"; - } else { - //No network error - QString response(reply->readAll()); - QString responseBody = response.split("\"").at(1); - - msgbox.setIcon(QMessageBox::Information); - - if (responseBody == "OK") { - msgText = tr("Survey successfully submitted."); - QSettings s; - s.beginGroup("UserSurvey"); - s.setValue("SurveyDone", "submitted"); - } else { - msgText = tr("There was an error while trying to check for updates.<br/><br/>%1").arg(responseBody); - msgbox.setIcon(QMessageBox::Warning); - } - } - - msgbox.setWindowTitle(msgTitle); - msgbox.setWindowIcon(QIcon(":subsurface-icon")); - msgbox.setText(msgText); - msgbox.setTextFormat(Qt::RichText); - msgbox.exec(); - reply->deleteLater(); -} diff --git a/desktop-widgets/usersurvey.h b/desktop-widgets/usersurvey.h deleted file mode 100644 index 32acfa87b..000000000 --- a/desktop-widgets/usersurvey.h +++ /dev/null @@ -1,31 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#ifndef USERSURVEY_H -#define USERSURVEY_H - -#include <QDialog> -class QNetworkAccessManager; -class QNetworkReply; - -namespace Ui { - class UserSurvey; -} - -class UserSurvey : public QDialog { - Q_OBJECT - -public: - explicit UserSurvey(QWidget *parent = 0); - ~UserSurvey(); - static QString getVersion(); - -private -slots: - void on_buttonBox_accepted(); - void on_buttonBox_rejected(); - void requestReceived(); - -private: - Ui::UserSurvey *ui; - QString os; -}; -#endif // USERSURVEY_H diff --git a/desktop-widgets/usersurvey.ui b/desktop-widgets/usersurvey.ui deleted file mode 100644 index c509fd2a7..000000000 --- a/desktop-widgets/usersurvey.ui +++ /dev/null @@ -1,191 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>UserSurvey</class> - <widget class="QDialog" name="UserSurvey"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>538</width> - <height>714</height> - </rect> - </property> - <property name="windowTitle"> - <string>User survey</string> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="1" column="0" colspan="3"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string><html><head/><body><p>We would love to learn more about our users, their preferences and their usage habits. Please spare a minute to fill out this form and submit it to the Subsurface team.</p></body></html></string> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="2" column="0" colspan="3"> - <widget class="Line" name="line"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item row="3" column="0" colspan="3"> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>What kind of diver are you?</string> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QCheckBox" name="tech"> - <property name="text"> - <string>Technical diver</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QCheckBox" name="recreational"> - <property name="text"> - <string>Recreational diver</string> - </property> - </widget> - </item> - <item row="4" column="2"> - <widget class="QCheckBox" name="planning"> - <property name="text"> - <string>Dive planner</string> - </property> - </widget> - </item> - <item row="5" column="0" colspan="3"> - <widget class="Line" name="line_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item row="6" column="0" colspan="3"> - <widget class="QLabel" name="label_6"> - <property name="text"> - <string>Where are you importing data from?</string> - </property> - </widget> - </item> - <item row="7" column="0" colspan="3"> - <widget class="QCheckBox" name="download"> - <property name="text"> - <string>Supported dive computer</string> - </property> - </widget> - </item> - <item row="8" column="0" colspan="3"> - <widget class="QCheckBox" name="divecomputer"> - <property name="text"> - <string>Other software/sources</string> - </property> - </widget> - </item> - <item row="9" column="0" colspan="3"> - <widget class="QCheckBox" name="manual"> - <property name="text"> - <string>Manually entering dives</string> - </property> - </widget> - </item> - <item row="10" column="0" colspan="3"> - <widget class="QCheckBox" name="companion"> - <property name="text"> - <string>Android/iPhone companion app</string> - </property> - </widget> - </item> - <item row="11" column="0" colspan="3"> - <widget class="Line" name="line_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item row="12" column="0" colspan="3"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Any suggestions? (in English)</string> - </property> - </widget> - </item> - <item row="13" column="0" colspan="3"> - <widget class="QPlainTextEdit" name="suggestions"/> - </item> - <item row="14" column="0" colspan="3"> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>The following information about your system will also be submitted.</string> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="15" column="0" colspan="3"> - <widget class="QPlainTextEdit" name="system"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="readOnly"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="16" column="1" colspan="2"> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="focusPolicy"> - <enum>Qt::TabFocus</enum> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set> - </property> - </widget> - </item> - <item row="0" column="0" colspan="3"> - <widget class="QLabel" name="label"> - <property name="font"> - <font> - <pointsize>11</pointsize> - </font> - </property> - <property name="text"> - <string>Subsurface user survey</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - <tabstops> - <tabstop>tech</tabstop> - <tabstop>recreational</tabstop> - <tabstop>planning</tabstop> - <tabstop>download</tabstop> - <tabstop>divecomputer</tabstop> - <tabstop>manual</tabstop> - <tabstop>companion</tabstop> - <tabstop>suggestions</tabstop> - <tabstop>system</tabstop> - <tabstop>buttonBox</tabstop> - </tabstops> - <resources/> - <connections/> -</ui> |