Skip to content
Snippets Groups Projects
Commit c87060bb authored by SeeLook's avatar SeeLook :musical_note:
Browse files

Display changelog when Nootka version is newer than before

- but don't do that if user still wants to see 'Got It!' info
parent f852355d
No related branches found
No related tags found
No related merge requests found
Pipeline #3375 skipped
......@@ -268,19 +268,32 @@ void TdialogLoaderObject::checkForUpdates() {
bool TdialogLoaderObject::checkVersion(QObject* nootWin) {
// Do not show changelog page until user wants to see any 'Got It' info.
if (GLOB->gotIt(QLatin1String("noteSelected"), true)
|| GLOB->gotIt(QLatin1String("soundInfo"), true)
#if defined (Q_OS_ANDROID)
|| GLOB->gotIt(QLatin1String("howToScore"), true)
#endif
)
return false;
QString configVersion = GLOB->config->value(QLatin1String("version"), QString()).toString();
auto confVerNr = QVersionNumber::fromString(configVersion);
auto currVerNr = QVersionNumber::fromString(GLOB->version);
if (configVersion.isEmpty() || currVerNr > confVerNr) {
if (currVerNr > confVerNr) {
QTimer::singleShot(1500, [=]{
// TODO: so far we are displaying 'about' dialog with communicate for testers, but show 'support' here later
if (nootWin && QString(nootWin->metaObject()->className()).contains("MainWindow_QMLTYPE")) {
QMetaObject::invokeMethod(nootWin, "showDialog",
Q_ARG(QVariant, 2));
QMetaObject::invokeMethod(nootWin, "showDialog", Q_ARG(QVariant, 2));
auto dialogLoader = qvariant_cast<QObject*>(nootWin->property("dialogLoader"));
if (dialogLoader) {
auto aboutContent = qvariant_cast<QObject*>(dialogLoader->property("currentDialog"));
QMetaObject::invokeMethod(aboutContent, "showPage", Q_ARG(QVariant, 6));
}
GLOB->config->setValue(QLatin1String("version"), GLOB->version);
}
});
return true;
}
return false;
}
......@@ -315,8 +315,8 @@ int main(int argc, char *argv[])
sound->init();
if (firstLoop && !wasFirstRun) {
// show some dialog when version was changed (news or other info)
if (firstLoop && !wasFirstRun && !e->rootObjects().isEmpty()) {
// show dialog with changes when version was changed
if (!TdialogLoaderObject::checkVersion(e->rootObjects().first())) {
// or check updates if no version changed
if (gl->config->value(QLatin1String("Updates/enableUpdates"), true).toBool())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment