Move creation of QSession object into MainWindow::checkSurvey()

Instead of handing the QSession object down, simply create it in
MainWindow::checkSurvey()

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2017-11-30 15:57:26 +01:00 committed by Lubomir I. Ivanov
parent 135ea00d88
commit 8b9c63b2d8
2 changed files with 10 additions and 11 deletions

View file

@ -1440,11 +1440,9 @@ void MainWindow::readSettings()
enableDisableCloudActions(); enableDisableCloudActions();
#if !defined(SUBSURFACE_MOBILE) #if !defined(SUBSURFACE_MOBILE)
QSettings s; //TODO: this 's' exists only for the loadRecentFiles, remove it.
loadRecentFiles(); loadRecentFiles();
if (firstRun) { if (firstRun) {
checkSurvey(&s); checkSurvey();
firstRun = false; firstRun = false;
} }
#endif #endif
@ -1452,22 +1450,23 @@ void MainWindow::readSettings()
#undef TOOLBOX_PREF_BUTTON #undef TOOLBOX_PREF_BUTTON
void MainWindow::checkSurvey(QSettings *s) void MainWindow::checkSurvey()
{ {
s->beginGroup("UserSurvey"); QSettings s;
if (!s->contains("FirstUse42")) { s.beginGroup("UserSurvey");
if (!s.contains("FirstUse42")) {
QVariant value = QDate().currentDate(); QVariant value = QDate().currentDate();
s->setValue("FirstUse42", value); s.setValue("FirstUse42", value);
} }
// wait a week for production versions, but not at all for non-tagged builds // wait a week for production versions, but not at all for non-tagged builds
int waitTime = 7; int waitTime = 7;
QDate firstUse42 = s->value("FirstUse42").toDate(); QDate firstUse42 = s.value("FirstUse42").toDate();
if (run_survey || (firstUse42.daysTo(QDate().currentDate()) > waitTime && !s->contains("SurveyDone"))) { if (run_survey || (firstUse42.daysTo(QDate().currentDate()) > waitTime && !s.contains("SurveyDone"))) {
if (!survey) if (!survey)
survey = new UserSurvey(this); survey = new UserSurvey(this);
survey->show(); survey->show();
} }
s->endGroup(); s.endGroup();
} }
void MainWindow::writeSettings() void MainWindow::writeSettings()

View file

@ -83,7 +83,7 @@ public:
ProfileWidget2 *graphics() const; ProfileWidget2 *graphics() const;
PlannerDetails *plannerDetails() const; PlannerDetails *plannerDetails() const;
void printPlan(); void printPlan();
void checkSurvey(QSettings *s); void checkSurvey();
void setApplicationState(const QByteArray& state); void setApplicationState(const QByteArray& state);
void setStateProperties(const QByteArray& state, const PropertyList& tl, const PropertyList& tr, const PropertyList& bl,const PropertyList& br); void setStateProperties(const QByteArray& state, const PropertyList& tl, const PropertyList& tr, const PropertyList& bl,const PropertyList& br);
bool inPlanner(); bool inPlanner();