summaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.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/mainwindow.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/mainwindow.cpp')
-rw-r--r--qt-ui/mainwindow.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 676ca3ab7..da1a1cd54 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -24,7 +24,7 @@
#include <fcntl.h>
#include "divelistview.h"
#include "starwidget.h"
-
+#include "ssrf-version.h"
#include "dive.h"
#include "display.h"
#include "divelist.h"
@@ -47,6 +47,7 @@
#endif
#include "divelogimportdialog.h"
#include "divelogexportdialog.h"
+#include "usersurvey.h"
#ifndef NO_USERMANUAL
#include "usermanual.h"
#endif
@@ -61,7 +62,8 @@ MainWindow::MainWindow() : QMainWindow(),
yearlyStatsModel(0),
state(VIEWALL),
updateManager(0),
- fakeDiveId(0)
+ fakeDiveId(0),
+ survey(0)
{
Q_ASSERT_X(m_Instance == NULL, "MainWindow", "MainWindow recreated!");
m_Instance = this;
@@ -814,10 +816,31 @@ void MainWindow::readSettings()
default_dive_computer_device = getSetting(s, "dive_computer_device");
s.endGroup();
loadRecentFiles(&s);
+ checkSurvey(&s);
}
#undef TOOLBOX_PREF_BUTTON
+void MainWindow::checkSurvey(QSettings *s)
+{
+ s->beginGroup("UserSurvey");
+ if (!s->contains("FirstUse42")) {
+ QVariant value = QDate().currentDate();
+ s->setValue("FirstUse42", value);
+ } else {
+ // wait a week for production versions, but not at all for non-tagged builds
+ QString ver(VERSION_STRING);
+ int waitTime = ver.contains('-') ? -1 : 7;
+ QDate firstUse42 = s->value("FirstUse42").toDate();
+ if (firstUse42.daysTo(QDate().currentDate()) > waitTime && !s->contains("SurveyDone")) {
+ if (!survey)
+ survey = new UserSurvey(this);
+ survey->show();
+ }
+ }
+ s->endGroup();
+}
+
void MainWindow::writeSettings()
{
QSettings settings;