summaryrefslogtreecommitdiffstats
path: root/qt-ui/usersurvey.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-13 10:56:46 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-13 14:03:51 -0700
commitcdd3b3d9cd5439cd56fb752e56a72045bed55f90 (patch)
tree76042136d2c7d68b1109ec45649970ad6e4a1dc6 /qt-ui/usersurvey.cpp
parent64236388e467dd149d285accdee74897a2a7c5a1 (diff)
downloadsubsurface-cdd3b3d9cd5439cd56fb752e56a72045bed55f90.tar.gz
Start a user survey dialog
The idea is that a week after the user starts using Subsurface we ask them if they would like to submit a survey response. If you are running a development build, don't wait seven days. This patch doesn't do anything with the user's selections, doesn't submit anything to our server, etc. It's just a placeholder to tune what we should ask, etc. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/usersurvey.cpp')
-rw-r--r--qt-ui/usersurvey.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/qt-ui/usersurvey.cpp b/qt-ui/usersurvey.cpp
new file mode 100644
index 000000000..7da7b3cdb
--- /dev/null
+++ b/qt-ui/usersurvey.cpp
@@ -0,0 +1,53 @@
+#include <QShortcut>
+#include <QMessageBox>
+#include <QDebug>
+#include <QSettings>
+
+#include "usersurvey.h"
+#include "ui_usersurvey.h"
+#include "ssrf-version.h"
+
+#include "helpers.h"
+
+UserSurvey::UserSurvey(QWidget *parent) : QDialog(parent),
+ ui(new Ui::UserSurvey)
+{
+ ui->setupUi(this);
+ // fill in the system data
+}
+
+UserSurvey::~UserSurvey()
+{
+ delete ui;
+}
+
+void UserSurvey::on_buttonBox_accepted()
+{
+ // now we need to collect the data and submit it
+ QSettings s;
+ s.beginGroup("UserSurvey");
+ s.setValue("SurveyDone", "submitted");
+ 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();
+}