GUI: Add setting 'Check for updates'
This commit is contained in:
parent
13d81cdd58
commit
fba70683bc
|
@ -90,6 +90,7 @@
|
||||||
#define SETTINGS_SHOW_STATISTICS "Show statistics"
|
#define SETTINGS_SHOW_STATISTICS "Show statistics"
|
||||||
#define SETTINGS_OPEN_PROJECT "Open Project"
|
#define SETTINGS_OPEN_PROJECT "Open Project"
|
||||||
#define SETTINGS_CHECK_VERSION "Check Version"
|
#define SETTINGS_CHECK_VERSION "Check Version"
|
||||||
|
#define SETTINGS_CHECK_FOR_UPDATES "Check for updates"
|
||||||
|
|
||||||
// The maximum value for the progress bar
|
// The maximum value for the progress bar
|
||||||
#define PROGRESS_MAX 1024.0
|
#define PROGRESS_MAX 1024.0
|
||||||
|
|
|
@ -258,6 +258,10 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
|
||||||
connect(mUI->mButtonHideInformation, &QPushButton::clicked,
|
connect(mUI->mButtonHideInformation, &QPushButton::clicked,
|
||||||
this, &MainWindow::hideInformation);
|
this, &MainWindow::hideInformation);
|
||||||
|
|
||||||
|
if (!mSettings->contains(SETTINGS_CHECK_FOR_UPDATES))
|
||||||
|
mSettings->setValue(SETTINGS_CHECK_FOR_UPDATES, isCppcheckPremium());
|
||||||
|
|
||||||
|
if (mSettings->value(SETTINGS_CHECK_FOR_UPDATES, false).toBool()) {
|
||||||
// Is there a new version?
|
// Is there a new version?
|
||||||
if (isCppcheckPremium()) {
|
if (isCppcheckPremium()) {
|
||||||
const QUrl url("https://files.cppchecksolutions.com/version.txt");
|
const QUrl url("https://files.cppchecksolutions.com/version.txt");
|
||||||
|
@ -266,6 +270,9 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
|
||||||
const QUrl url("https://cppcheck.sourceforge.io/version.txt");
|
const QUrl url("https://cppcheck.sourceforge.io/version.txt");
|
||||||
mNetworkAccessManager->get(QNetworkRequest(url));
|
mNetworkAccessManager->get(QNetworkRequest(url));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
delete mUI->mLayoutInformation;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
|
@ -1956,6 +1963,7 @@ void MainWindow::hideInformation() {
|
||||||
mSettings->setValue(SETTINGS_CHECK_VERSION, version);
|
mSettings->setValue(SETTINGS_CHECK_VERSION, version);
|
||||||
mUI->mLabelInformation->setVisible(false);
|
mUI->mLabelInformation->setVisible(false);
|
||||||
mUI->mButtonHideInformation->setVisible(false);
|
mUI->mButtonHideInformation->setVisible(false);
|
||||||
|
mUI->mLayoutInformation->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::isCppcheckPremium() const {
|
bool MainWindow::isCppcheckPremium() const {
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="mLayoutInformation">
|
||||||
<property name="sizeConstraint">
|
<property name="sizeConstraint">
|
||||||
<enum>QLayout::SetDefaultConstraint</enum>
|
<enum>QLayout::SetDefaultConstraint</enum>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>589</width>
|
<width>627</width>
|
||||||
<height>346</height>
|
<height>411</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -157,6 +157,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="mCheckForUpdates">
|
||||||
|
<property name="text">
|
||||||
|
<string>Check for updates</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_2">
|
<spacer name="verticalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -310,7 +317,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="mPythonPathWarning">
|
<widget class="QLabel" name="mPythonPathWarning">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string></string>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -60,6 +60,7 @@ SettingsDialog::SettingsDialog(ApplicationList *list,
|
||||||
mUI->mEnableInconclusive->setCheckState(boolToCheckState(settings.value(SETTINGS_INCONCLUSIVE_ERRORS, false).toBool()));
|
mUI->mEnableInconclusive->setCheckState(boolToCheckState(settings.value(SETTINGS_INCONCLUSIVE_ERRORS, false).toBool()));
|
||||||
mUI->mShowStatistics->setCheckState(boolToCheckState(settings.value(SETTINGS_SHOW_STATISTICS, false).toBool()));
|
mUI->mShowStatistics->setCheckState(boolToCheckState(settings.value(SETTINGS_SHOW_STATISTICS, false).toBool()));
|
||||||
mUI->mShowErrorId->setCheckState(boolToCheckState(settings.value(SETTINGS_SHOW_ERROR_ID, false).toBool()));
|
mUI->mShowErrorId->setCheckState(boolToCheckState(settings.value(SETTINGS_SHOW_ERROR_ID, false).toBool()));
|
||||||
|
mUI->mCheckForUpdates->setCheckState(boolToCheckState(settings.value(SETTINGS_CHECK_FOR_UPDATES, false).toBool()));
|
||||||
mUI->mEditPythonPath->setText(settings.value(SETTINGS_PYTHON_PATH, QString()).toString());
|
mUI->mEditPythonPath->setText(settings.value(SETTINGS_PYTHON_PATH, QString()).toString());
|
||||||
validateEditPythonPath();
|
validateEditPythonPath();
|
||||||
mUI->mEditMisraFile->setText(settings.value(SETTINGS_MISRA_FILE, QString()).toString());
|
mUI->mEditMisraFile->setText(settings.value(SETTINGS_MISRA_FILE, QString()).toString());
|
||||||
|
@ -182,6 +183,7 @@ void SettingsDialog::saveSettingValues() const
|
||||||
saveCheckboxValue(&settings, mUI->mEnableInconclusive, SETTINGS_INCONCLUSIVE_ERRORS);
|
saveCheckboxValue(&settings, mUI->mEnableInconclusive, SETTINGS_INCONCLUSIVE_ERRORS);
|
||||||
saveCheckboxValue(&settings, mUI->mShowStatistics, SETTINGS_SHOW_STATISTICS);
|
saveCheckboxValue(&settings, mUI->mShowStatistics, SETTINGS_SHOW_STATISTICS);
|
||||||
saveCheckboxValue(&settings, mUI->mShowErrorId, SETTINGS_SHOW_ERROR_ID);
|
saveCheckboxValue(&settings, mUI->mShowErrorId, SETTINGS_SHOW_ERROR_ID);
|
||||||
|
saveCheckboxValue(&settings, mUI->mCheckForUpdates, SETTINGS_CHECK_FOR_UPDATES);
|
||||||
settings.setValue(SETTINGS_PYTHON_PATH, mUI->mEditPythonPath->text());
|
settings.setValue(SETTINGS_PYTHON_PATH, mUI->mEditPythonPath->text());
|
||||||
settings.setValue(SETTINGS_MISRA_FILE, mUI->mEditMisraFile->text());
|
settings.setValue(SETTINGS_MISRA_FILE, mUI->mEditMisraFile->text());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue