User survey: force running the survey from command line

This way people can test the dialog much easier.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-06-14 14:45:42 -07:00
parent 181d4e2fa6
commit 8bd535d092
3 changed files with 17 additions and 11 deletions

2
dive.h
View file

@ -404,7 +404,7 @@ extern const struct units SI_units, IMPERIAL_units;
extern struct units xml_parsing_units; extern struct units xml_parsing_units;
extern struct units *get_units(void); extern struct units *get_units(void);
extern int verbose, quit; extern int run_survey, verbose, quit;
struct dive_table { struct dive_table {
int nr, allocated, preexisting; int nr, allocated, preexisting;

View file

@ -827,16 +827,15 @@ void MainWindow::checkSurvey(QSettings *s)
if (!s->contains("FirstUse42")) { if (!s->contains("FirstUse42")) {
QVariant value = QDate().currentDate(); QVariant value = QDate().currentDate();
s->setValue("FirstUse42", value); s->setValue("FirstUse42", value);
} else { }
// 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
QString ver(VERSION_STRING); QString ver(VERSION_STRING);
int waitTime = ver.contains('-') ? -1 : 7; int waitTime = ver.contains('-') ? -1 : 7;
QDate firstUse42 = s->value("FirstUse42").toDate(); QDate firstUse42 = s->value("FirstUse42").toDate();
if (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();
} }

View file

@ -35,6 +35,8 @@ struct preferences default_prefs = {
.show_average_depth = true .show_average_depth = true
}; };
int run_survey;
struct units *get_units() struct units *get_units()
{ {
return &prefs.units; return &prefs.units;
@ -97,6 +99,7 @@ static void print_help()
printf("\n --import logfile ... Logs before this option is treated as base, everything after is imported"); printf("\n --import logfile ... Logs before this option is treated as base, everything after is imported");
printf("\n --verbose|-v Verbose debug (repeat to increase verbosity)"); printf("\n --verbose|-v Verbose debug (repeat to increase verbosity)");
printf("\n --version Prints current version"); printf("\n --version Prints current version");
printf("\n --survey Offer to submit a user survey");
printf("\n --win32console Create a dedicated console if needed (Windows only). Add option before everything else\n\n"); printf("\n --win32console Create a dedicated console if needed (Windows only). Add option before everything else\n\n");
} }
@ -133,6 +136,10 @@ void parse_argument(const char *arg)
print_version(); print_version();
exit(0); exit(0);
} }
if (strcmp(arg, "--survey") == 0) {
run_survey = true;
return;
}
if (strcmp(arg, "--win32console") == 0) if (strcmp(arg, "--win32console") == 0)
return; return;
/* fallthrough */ /* fallthrough */