GUI: Install link when new version is available

This commit is contained in:
Daniel Marjamäki 2022-11-08 13:33:57 +01:00
parent bd95efc987
commit 0d2993408a
2 changed files with 19 additions and 1 deletions

View File

@ -1951,9 +1951,18 @@ void MainWindow::replyFinished(QNetworkReply *reply) {
const int latestVersion = getVersion(str.trimmed());
if (appVersion < latestVersion) {
if (mSettings->value(SETTINGS_CHECK_VERSION, 0).toInt() != latestVersion) {
QString install;
if (isCppcheckPremium()) {
#ifdef Q_OS_WIN
const QString url("https://cppchecksolutions.com/cppcheck-premium-installation");
#else
const QString url("https://cppchecksolutions.com/cppcheck-premium-linux-installation");
#endif
install = "<a href=\"" + url + "\">" + tr("Install") + "</a>";
}
mUI->mButtonHideInformation->setVisible(true);
mUI->mLabelInformation->setVisible(true);
mUI->mLabelInformation->setText(tr("New version available: %1").arg(str.trimmed()));
mUI->mLabelInformation->setText(tr("New version available: %1. %2").arg(str.trimmed()).arg(install));
}
}
}

View File

@ -83,6 +83,15 @@
<property name="text">
<string>Checking for updates</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
<item>