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:
parent
0d69a86bf8
commit
0ab3d07f75
|
@ -9,7 +9,6 @@ INCLUDEPATH += . \
|
||||||
../lib
|
../lib
|
||||||
QT += widgets
|
QT += widgets
|
||||||
QT += printsupport
|
QT += printsupport
|
||||||
QT += network
|
|
||||||
|
|
||||||
contains(LINKCORE, [yY][eE][sS]) {
|
contains(LINKCORE, [yY][eE][sS]) {
|
||||||
LIBS += -l../bin/cppcheck-core
|
LIBS += -l../bin/cppcheck-core
|
||||||
|
@ -122,8 +121,7 @@ HEADERS += aboutdialog.h \
|
||||||
cppchecklibrarydata.h \
|
cppchecklibrarydata.h \
|
||||||
libraryaddfunctiondialog.h \
|
libraryaddfunctiondialog.h \
|
||||||
libraryeditargdialog.h \
|
libraryeditargdialog.h \
|
||||||
newsuppressiondialog.h \
|
newsuppressiondialog.h
|
||||||
networkinfo.h
|
|
||||||
|
|
||||||
SOURCES += aboutdialog.cpp \
|
SOURCES += aboutdialog.cpp \
|
||||||
application.cpp \
|
application.cpp \
|
||||||
|
@ -163,8 +161,7 @@ SOURCES += aboutdialog.cpp \
|
||||||
cppchecklibrarydata.cpp \
|
cppchecklibrarydata.cpp \
|
||||||
libraryaddfunctiondialog.cpp \
|
libraryaddfunctiondialog.cpp \
|
||||||
libraryeditargdialog.cpp \
|
libraryeditargdialog.cpp \
|
||||||
newsuppressiondialog.cpp \
|
newsuppressiondialog.cpp
|
||||||
networkinfo.cpp
|
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
RC_FILE = cppcheck-gui.rc
|
RC_FILE = cppcheck-gui.rc
|
||||||
|
|
|
@ -30,13 +30,11 @@
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
#include "cppcheck.h"
|
#include "cppcheck.h"
|
||||||
#include "version.h"
|
|
||||||
|
|
||||||
#include "applicationlist.h"
|
#include "applicationlist.h"
|
||||||
#include "aboutdialog.h"
|
#include "aboutdialog.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "threadhandler.h"
|
#include "threadhandler.h"
|
||||||
#include "networkinfo.h"
|
|
||||||
#include "fileviewdialog.h"
|
#include "fileviewdialog.h"
|
||||||
#include "projectfile.h"
|
#include "projectfile.h"
|
||||||
#include "projectfiledialog.h"
|
#include "projectfiledialog.h"
|
||||||
|
@ -78,11 +76,6 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
|
||||||
mThread->setDataDir(getDataDir(settings));
|
mThread->setDataDir(getDataDir(settings));
|
||||||
mUI.mResults->initialize(mSettings, mApplications, mThread);
|
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
|
// Filter timer to delay filtering results slightly while typing
|
||||||
mFilterTimer = new QTimer(this);
|
mFilterTimer = new QTimer(this);
|
||||||
mFilterTimer->setInterval(500);
|
mFilterTimer->setInterval(500);
|
||||||
|
@ -1769,20 +1762,3 @@ void MainWindow::suppressIds(QStringList ids)
|
||||||
mProjectFile->setSuppressions(suppressions);
|
mProjectFile->setSuppressions(suppressions);
|
||||||
mProjectFile->write();
|
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -225,9 +225,6 @@ protected slots:
|
||||||
/** Suppress error ids */
|
/** Suppress error ids */
|
||||||
void suppressIds(QStringList ids);
|
void suppressIds(QStringList ids);
|
||||||
|
|
||||||
/** Cppcheck version received from network */
|
|
||||||
void networkCppcheckVersion(QString version);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/** Get filename for last results */
|
/** Get filename for last results */
|
||||||
|
|
|
@ -50,29 +50,10 @@
|
||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="ResultsView" name="mResults" native="true"/>
|
<widget class="ResultsView" name="mResults" native="true"/>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenuBar" name="mMenuBar">
|
<widget class="QMenuBar" name="mMenuBar">
|
||||||
|
|
|
@ -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());
|
|
||||||
}
|
|
|
@ -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
|
|
Loading…
Reference in New Issue