Skip to content

Commit 0d29934

Browse files
committed
GUI: Install link when new version is available
1 parent bd95efc commit 0d29934

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

gui/mainwindow.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1951,9 +1951,18 @@ void MainWindow::replyFinished(QNetworkReply *reply) {
19511951
const int latestVersion = getVersion(str.trimmed());
19521952
if (appVersion < latestVersion) {
19531953
if (mSettings->value(SETTINGS_CHECK_VERSION, 0).toInt() != latestVersion) {
1954+
QString install;
1955+
if (isCppcheckPremium()) {
1956+
#ifdef Q_OS_WIN
1957+
const QString url("https://cppchecksolutions.com/cppcheck-premium-installation");
1958+
#else
1959+
const QString url("https://cppchecksolutions.com/cppcheck-premium-linux-installation");
1960+
#endif
1961+
install = "<a href=\"" + url + "\">" + tr("Install") + "</a>";
1962+
}
19541963
mUI->mButtonHideInformation->setVisible(true);
19551964
mUI->mLabelInformation->setVisible(true);
1956-
mUI->mLabelInformation->setText(tr("New version available: %1").arg(str.trimmed()));
1965+
mUI->mLabelInformation->setText(tr("New version available: %1. %2").arg(str.trimmed()).arg(install));
19571966
}
19581967
}
19591968
}

gui/mainwindow.ui

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@
8383
<property name="text">
8484
<string>Checking for updates</string>
8585
</property>
86+
<property name="textFormat">
87+
<enum>Qt::RichText</enum>
88+
</property>
89+
<property name="openExternalLinks">
90+
<bool>true</bool>
91+
</property>
92+
<property name="textInteractionFlags">
93+
<set>Qt::TextBrowserInteraction</set>
94+
</property>
8695
</widget>
8796
</item>
8897
<item>

0 commit comments

Comments
 (0)