MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / replyFinished

Method replyFinished

gui/mainwindow.cpp:2252–2289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2250}
2251
2252void MainWindow::replyFinished(QNetworkReply *reply) {
2253 reply->deleteLater();
2254 if (reply->error()) {
2255 mUI->mLayoutInformation->deleteLater();
2256 qDebug() << "Response: ERROR";
2257 return;
2258 }
2259 const QString str = reply->readAll();
2260 qDebug() << "Response: " << str;
2261 if (reply->url().fileName() == "version.txt") {
2262 // TODO: lacks extra version
2263 QString nameWithVersion = QString("Cppcheck %1").arg(CppCheck::version());
2264 // TODO: this should not contain the version
2265 if (!mCppcheckCfgProductName.isEmpty())
2266 nameWithVersion = mCppcheckCfgProductName;
2267 const int appVersion = getVersion(nameWithVersion);
2268 const int latestVersion = getVersion(str.trimmed());
2269 if (appVersion < latestVersion) {
2270 if (mSettings->value(SETTINGS_CHECK_VERSION, 0).toInt() != latestVersion) {
2271 QString install;
2272 if (isCppcheckPremium()) {
2273#ifdef Q_OS_WIN
2274 const QString url("https://cppchecksolutions.com/cppcheck-premium-installation");
2275#else
2276 const QString url("https://cppchecksolutions.com/cppcheck-premium-linux-installation");
2277#endif
2278 install = "<a href=\"" + url + "\">" + tr("Install") + "</a>";
2279 }
2280 mUI->mButtonHideInformation->setVisible(true);
2281 mUI->mLabelInformation->setVisible(true);
2282 mUI->mLabelInformation->setText(tr("New version available: %1. %2").arg(str.trimmed()).arg(install));
2283 }
2284 }
2285 }
2286 if (!mUI->mLabelInformation->isVisible()) {
2287 mUI->mLayoutInformation->deleteLater();
2288 }
2289}
2290
2291void MainWindow::hideInformation() {
2292 int version = getVersion(mUI->mLabelInformation->text());

Callers

nothing calls this directly

Calls 6

getVersionFunction · 0.85
readAllMethod · 0.80
isEmptyMethod · 0.80
QStringClass · 0.70
errorMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected