Revert "GUI: Show information label if Cppcheck is outdated"

I plan to add something like this again after the release.
This commit is contained in:
Daniel Marjamäki 2019-06-28 22:36:19 +02:00
parent 0d69a86bf8
commit 0ab3d07f75
6 changed files with 3 additions and 116 deletions

View File

@ -9,7 +9,6 @@ INCLUDEPATH += . \
../lib
QT += widgets
QT += printsupport
QT += network
contains(LINKCORE, [yY][eE][sS]) {
LIBS += -l../bin/cppcheck-core
@ -122,8 +121,7 @@ HEADERS += aboutdialog.h \
cppchecklibrarydata.h \
libraryaddfunctiondialog.h \
libraryeditargdialog.h \
newsuppressiondialog.h \
networkinfo.h
newsuppressiondialog.h
SOURCES += aboutdialog.cpp \
application.cpp \
@ -163,8 +161,7 @@ SOURCES += aboutdialog.cpp \
cppchecklibrarydata.cpp \
libraryaddfunctiondialog.cpp \
libraryeditargdialog.cpp \
newsuppressiondialog.cpp \
networkinfo.cpp
newsuppressiondialog.cpp
win32 {
RC_FILE = cppcheck-gui.rc

View File

@ -30,13 +30,11 @@
#include "mainwindow.h"
#include "cppcheck.h"
#include "version.h"
#include "applicationlist.h"
#include "aboutdialog.h"
#include "common.h"
#include "threadhandler.h"
#include "networkinfo.h"
#include "fileviewdialog.h"
#include "projectfile.h"
#include "projectfiledialog.h"
@ -78,11 +76,6 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
mThread->setDataDir(getDataDir(settings));
mUI.mResults->initialize(mSettings, mApplications, mThread);
mUI.mLabelUpgradeCppcheck->setVisible(false);
NetworkInfo *networkInfo = new NetworkInfo(this);
connect(networkInfo, SIGNAL(cppcheckVersion(QString)), this, SLOT(networkCppcheckVersion(QString)));
networkInfo->start();
// Filter timer to delay filtering results slightly while typing
mFilterTimer = new QTimer(this);
mFilterTimer->setInterval(500);
@ -1769,20 +1762,3 @@ void MainWindow::suppressIds(QStringList ids)
mProjectFile->setSuppressions(suppressions);
mProjectFile->write();
}
void MainWindow::networkCppcheckVersion(QString version)
{
qDebug() << "MainWindow::networkCppcheckVersion:" << version;
if (!QRegExp("Cppcheck [0-9]\\.[0-9][0-9]").exactMatch(version)) {
mUI.mLabelUpgradeCppcheck->setVisible(false);
return;
}
version = version.mid(9,4);
if (version <= CPPCHECK_VERSION_STRING)
mUI.mLabelUpgradeCppcheck->setVisible(false);
else {
mUI.mLabelUpgradeCppcheck->setVisible(true);
mUI.mLabelUpgradeCppcheck->setText(tr("Newer Cppcheck version is available: %1").arg(version));
}
}

View File

@ -225,9 +225,6 @@ protected slots:
/** Suppress error ids */
void suppressIds(QStringList ids);
/** Cppcheck version received from network */
void networkCppcheckVersion(QString version);
private:
/** Get filename for last results */

View File

@ -50,29 +50,10 @@
<height>16777215</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="ResultsView" name="mResults" native="true"/>
</item>
<item>
<widget class="QLabel" name="mLabelUpgradeCppcheck">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">QLabel { background-color : rgb(239, 242, 172); }</string>
</property>
<property name="text">
<string>This is not latest Cppcheck version. Latest Cppcheck version is 999.999</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="mMenuBar">

View File

@ -1,31 +0,0 @@
#include "networkinfo.h"
#include <QNetworkReply>
#include <QNetworkRequest>
NetworkInfo::NetworkInfo(QObject *parent) : QObject(parent)
{
mManager = new QNetworkAccessManager;
connect(mManager, SIGNAL(finished(QNetworkReply*)),
this, SLOT(managerFinished(QNetworkReply*)));
}
NetworkInfo::~NetworkInfo()
{
delete mManager;
}
void NetworkInfo::start()
{
//QNetworkRequest request;
request.setUrl(QUrl("http://cppcheck.sourceforge.net/version.txt"));
mManager->get(request);
}
void NetworkInfo::managerFinished(QNetworkReply *reply) {
if (reply->error()) {
qDebug() << reply->errorString();
return;
}
emit cppcheckVersion(reply->readAll().trimmed());
}

View File

@ -1,33 +0,0 @@
#ifndef NETWORKINFO_H
#define NETWORKINFO_H
#include <QObject>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QString>
/// @addtogroup GUI
/// @{
/**
* Network communications with cppcheck website to get current version etc
*/
class NetworkInfo : public QObject
{
Q_OBJECT
public:
NetworkInfo(QObject *parent);
~NetworkInfo();
void start();
signals:
void cppcheckVersion(QString version);
private slots:
void managerFinished(QNetworkReply *reply);
private:
QNetworkAccessManager *mManager;
QNetworkRequest request;
};
/// @}
#endif // NETWORKINFO_H