Option to disable the automatic search for updates.

This commit is contained in:
Roman Telezhynskyi 2021-11-18 14:55:15 +02:00
parent 679bb9af48
commit d61eda4a41
14 changed files with 147 additions and 16 deletions

View File

@ -21,6 +21,7 @@
- Fix double call of a main path context menu. - Fix double call of a main path context menu.
- Improve storing visibility group items. Don't store duplicate information. - Improve storing visibility group items. Don't store duplicate information.
- Remove tool from all visibility groups it in. - Remove tool from all visibility groups it in.
- Option to disable the automatic search for updates.
# Valentina 0.7.49 July 1, 2021 # Valentina 0.7.49 July 1, 2021
- Fix crash. - Fix crash.

View File

@ -61,6 +61,9 @@ PuzzlePreferencesConfigurationPage::PuzzlePreferencesConfigurationPage(QWidget *
ui->graphOutputCheck->setChecked(settings->GetGraphicalOutput()); ui->graphOutputCheck->setChecked(settings->GetGraphicalOutput());
ui->checkBoxOpenGLRender->setChecked(settings->IsOpenGLRender()); ui->checkBoxOpenGLRender->setChecked(settings->IsOpenGLRender());
//----------------------- Update
ui->checkBoxAutomaticallyCheckUpdates->setChecked(settings->IsAutomaticallyCheckUpdates());
// Tab Scrolling // Tab Scrolling
ui->spinBoxDuration->setMinimum(VCommonSettings::scrollingDurationMin); ui->spinBoxDuration->setMinimum(VCommonSettings::scrollingDurationMin);
ui->spinBoxDuration->setMaximum(VCommonSettings::scrollingDurationMax); ui->spinBoxDuration->setMaximum(VCommonSettings::scrollingDurationMax);
@ -140,6 +143,11 @@ auto PuzzlePreferencesConfigurationPage::Apply() -> QStringList
settings->SetOpenGLRender(ui->checkBoxOpenGLRender->isChecked()); settings->SetOpenGLRender(ui->checkBoxOpenGLRender->isChecked());
} }
if (settings->IsAutomaticallyCheckUpdates() != ui->checkBoxAutomaticallyCheckUpdates->isChecked())
{
settings->SetAutomaticallyCheckUpdates(ui->checkBoxAutomaticallyCheckUpdates->isChecked());
}
// Tab Scrolling // Tab Scrolling
settings->SetScrollingDuration(ui->spinBoxDuration->value()); settings->SetScrollingDuration(ui->spinBoxDuration->value());
settings->SetScrollingUpdateInterval(ui->spinBoxUpdateInterval->value()); settings->SetScrollingUpdateInterval(ui->spinBoxUpdateInterval->value());

View File

@ -155,6 +155,28 @@ This option will take an affect after restart.</string>
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="groupBox_9">
<property name="title">
<string>Update</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="QCheckBox" name="checkBoxAutomaticallyCheckUpdates">
<property name="toolTip">
<string>Automatically check for updates each time the application starts</string>
</property>
<property name="text">
<string>Automatically check for updates</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">

View File

@ -37,6 +37,7 @@
#include "../vmisc/vsysexits.h" #include "../vmisc/vsysexits.h"
#include "../vmisc/diagnostic.h" #include "../vmisc/diagnostic.h"
#include "../vmisc/qt_dispatch/qt_dispatch.h" #include "../vmisc/qt_dispatch/qt_dispatch.h"
#include "../fervor/fvupdater.h"
#include <QMessageBox> #include <QMessageBox>
#include <QLoggingCategory> #include <QLoggingCategory>
@ -565,6 +566,15 @@ void VPApplication::ProcessArguments(const VPCommandLinePtr &cmd)
void VPApplication::ProcessCMD() void VPApplication::ProcessCMD()
{ {
ParseCommandLine(SocketConnection::Client, arguments()); ParseCommandLine(SocketConnection::Client, arguments());
if (IsAppInGUIMode() && Settings()->IsAutomaticallyCheckUpdates())
{
// Set feed URL before doing anything else
FvUpdater::sharedUpdater()->SetFeedURL(FvUpdater::CurrentFeedURL());
// Check for updates automatically
FvUpdater::sharedUpdater()->CheckForUpdatesSilent();
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -87,6 +87,10 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare
//----------------------- Toolbar //----------------------- Toolbar
ui->toolBarStyleCheck->setChecked(MApplication::VApp()->TapeSettings()->GetToolBarStyle()); ui->toolBarStyleCheck->setChecked(MApplication::VApp()->TapeSettings()->GetToolBarStyle());
//----------------------- Update
ui->checkBoxAutomaticallyCheckUpdates->setChecked(
MApplication::VApp()->TapeSettings()->IsAutomaticallyCheckUpdates());
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -133,6 +137,11 @@ QStringList TapePreferencesConfigurationPage::Apply()
MApplication::VApp()->RetranslateGroups(); MApplication::VApp()->RetranslateGroups();
} }
if (settings->IsAutomaticallyCheckUpdates() != ui->checkBoxAutomaticallyCheckUpdates->isChecked())
{
settings->SetAutomaticallyCheckUpdates(ui->checkBoxAutomaticallyCheckUpdates->isChecked());
}
return preferences; return preferences;
} }

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>544</width> <width>544</width>
<height>648</height> <height>636</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -25,7 +25,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>524</width> <width>524</width>
<height>628</height> <height>616</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
@ -188,6 +188,28 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="groupBox_9">
<property name="title">
<string>Update</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QCheckBox" name="checkBoxAutomaticallyCheckUpdates">
<property name="toolTip">
<string>Automatically check for updates each time the application starts</string>
</property>
<property name="text">
<string>Automatically check for updates</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>

View File

@ -39,6 +39,7 @@
#include "../vmisc/qt_dispatch/qt_dispatch.h" #include "../vmisc/qt_dispatch/qt_dispatch.h"
#include "../qmuparser/qmuparsererror.h" #include "../qmuparser/qmuparsererror.h"
#include "../vpatterndb/variables/vmeasurement.h" #include "../vpatterndb/variables/vmeasurement.h"
#include "../fervor/fvupdater.h"
#include <QDir> #include <QDir>
#include <QFileOpenEvent> #include <QFileOpenEvent>
@ -871,6 +872,15 @@ TMainWindow *MApplication::NewMainWindow()
void MApplication::ProcessCMD() void MApplication::ProcessCMD()
{ {
ParseCommandLine(SocketConnection::Client, arguments()); ParseCommandLine(SocketConnection::Client, arguments());
if (IsAppInGUIMode() && Settings()->IsAutomaticallyCheckUpdates())
{
// Set feed URL before doing anything else
FvUpdater::sharedUpdater()->SetFeedURL(FvUpdater::CurrentFeedURL());
// Check for updates automatically
FvUpdater::sharedUpdater()->CheckForUpdatesSilent();
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -136,6 +136,9 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
// Native dialogs // Native dialogs
ui->checkBoxDontUseNativeDialog->setChecked(settings->IsDontUseNativeDialog()); ui->checkBoxDontUseNativeDialog->setChecked(settings->IsDontUseNativeDialog());
//----------------------- Update
ui->checkBoxAutomaticallyCheckUpdates->setChecked(settings->IsAutomaticallyCheckUpdates());
// Tab Scrolling // Tab Scrolling
ui->spinBoxDuration->setMinimum(VCommonSettings::scrollingDurationMin); ui->spinBoxDuration->setMinimum(VCommonSettings::scrollingDurationMin);
ui->spinBoxDuration->setMaximum(VCommonSettings::scrollingDurationMax); ui->spinBoxDuration->setMaximum(VCommonSettings::scrollingDurationMax);
@ -212,6 +215,7 @@ QStringList PreferencesConfigurationPage::Apply()
VAbstractApplication::VApp()->LoadTranslation(locale); VAbstractApplication::VApp()->LoadTranslation(locale);
} }
if (m_unitChanged) if (m_unitChanged)
{ {
const auto unit = qvariant_cast<QString>(ui->unitCombo->currentData()); const auto unit = qvariant_cast<QString>(ui->unitCombo->currentData());
@ -219,6 +223,7 @@ QStringList PreferencesConfigurationPage::Apply()
m_unitChanged = false; m_unitChanged = false;
preferences.append(tr("default unit")); preferences.append(tr("default unit"));
} }
if (m_labelLangChanged) if (m_labelLangChanged)
{ {
const auto locale = qvariant_cast<QString>(ui->labelCombo->currentData()); const auto locale = qvariant_cast<QString>(ui->labelCombo->currentData());
@ -226,6 +231,11 @@ QStringList PreferencesConfigurationPage::Apply()
m_labelLangChanged = false; m_labelLangChanged = false;
} }
if (settings->IsAutomaticallyCheckUpdates() != ui->checkBoxAutomaticallyCheckUpdates->isChecked())
{
settings->SetAutomaticallyCheckUpdates(ui->checkBoxAutomaticallyCheckUpdates->isChecked());
}
// Tab Scrolling // Tab Scrolling
settings->SetScrollingDuration(ui->spinBoxDuration->value()); settings->SetScrollingDuration(ui->spinBoxDuration->value());
settings->SetScrollingUpdateInterval(ui->spinBoxUpdateInterval->value()); settings->SetScrollingUpdateInterval(ui->spinBoxUpdateInterval->value());

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>680</width> <width>680</width>
<height>624</height> <height>872</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -33,9 +33,9 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>-27</y>
<width>624</width> <width>624</width>
<height>765</height> <height>838</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
@ -293,6 +293,28 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="groupBox_9">
<property name="title">
<string>Update</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QCheckBox" name="checkBoxAutomaticallyCheckUpdates">
<property name="toolTip">
<string>Automatically check for updates each time the application starts</string>
</property>
<property name="text">
<string>Automatically check for updates</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>

View File

@ -80,7 +80,7 @@ int main(int argc, char *argv[])
VApplication app(argc, argv); VApplication app(argc, argv);
app.InitOptions(); app.InitOptions();
if (VApplication::IsGUIMode()) if (VApplication::IsGUIMode() && VAbstractApplication::VApp()->Settings()->IsAutomaticallyCheckUpdates())
{ {
// Set feed URL before doing anything else // Set feed URL before doing anything else
FvUpdater::sharedUpdater()->SetFeedURL(FvUpdater::CurrentFeedURL()); FvUpdater::sharedUpdater()->SetFeedURL(FvUpdater::CurrentFeedURL());
@ -91,7 +91,7 @@ int main(int argc, char *argv[])
MainWindow w; MainWindow w;
#if !defined(Q_OS_MAC) #if !defined(Q_OS_MAC)
app.setWindowIcon(QIcon(":/icon/64x64/icon64x64.png")); VApplication::setWindowIcon(QIcon(":/icon/64x64/icon64x64.png"));
#endif // !defined(Q_OS_MAC) #endif // !defined(Q_OS_MAC)
app.setMainWindow(&w); app.setMainWindow(&w);

View File

@ -284,7 +284,7 @@ bool FvUpdater::CheckForUpdates(bool silentAsMuchAsItCouldGet)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool FvUpdater::CheckForUpdatesSilent() auto FvUpdater::CheckForUpdatesSilent() -> bool
{ {
if (VAbstractApplication::VApp()->Settings()->GetDateOfLastRemind().daysTo(QDate::currentDate()) >= 1) if (VAbstractApplication::VApp()->Settings()->GetDateOfLastRemind().daysTo(QDate::currentDate()) >= 1)
{ {
@ -295,18 +295,16 @@ bool FvUpdater::CheckForUpdatesSilent()
} }
return success; return success;
} }
else
{
if (m_dropOnFinnish) if (m_dropOnFinnish)
{ {
drop(); drop();
} }
return true; return true;
} }
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool FvUpdater::CheckForUpdatesNotSilent() auto FvUpdater::CheckForUpdatesNotSilent() -> bool
{ {
const bool success = CheckForUpdates(false); const bool success = CheckForUpdates(false);
if (m_dropOnFinnish && not success) if (m_dropOnFinnish && not success)

View File

@ -121,6 +121,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingToolSeamAllowanceDialogSize, (QL
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingIncrementsDialogSize, (QLatin1String("toolIncrementsDialogSize"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingIncrementsDialogSize, (QLatin1String("toolIncrementsDialogSize")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFormulaWizardDialogSize, (QLatin1String("formulaWizardDialogSize"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFormulaWizardDialogSize, (QLatin1String("formulaWizardDialogSize")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFinalMeasurementsDialogSize, (QLatin1String("finalMeasurementsDialogSize"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFinalMeasurementsDialogSize, (QLatin1String("finalMeasurementsDialogSize")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingAutomaticallyCheckUpdates, (QLatin1String("automaticallyCheckUpdates")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLatestSkippedVersion, (QLatin1String("lastestSkippedVersion"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLatestSkippedVersion, (QLatin1String("lastestSkippedVersion")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDateOfLastRemind, (QLatin1String("dateOfLastRemind"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDateOfLastRemind, (QLatin1String("dateOfLastRemind")))
@ -821,6 +822,21 @@ void VCommonSettings::SetFinalMeasurementsDialogSize(const QSize &sz)
setValue(*settingFinalMeasurementsDialogSize, sz); setValue(*settingFinalMeasurementsDialogSize, sz);
} }
//---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::IsAutomaticallyCheckUpdates() const
{
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
return settings.value(*settingAutomaticallyCheckUpdates, true).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetAutomaticallyCheckUpdates(bool value)
{
QSettings settings(this->format(), this->scope(), this->organizationName(), *commonIniFilename);
settings.setValue(*settingAutomaticallyCheckUpdates, value);
settings.sync();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
unsigned VCommonSettings::GetLatestSkippedVersion() const unsigned VCommonSettings::GetLatestSkippedVersion() const
{ {

View File

@ -157,6 +157,9 @@ public:
QSize GetFinalMeasurementsDialogSize() const; QSize GetFinalMeasurementsDialogSize() const;
void SetFinalMeasurementsDialogSize(const QSize& sz); void SetFinalMeasurementsDialogSize(const QSize& sz);
bool IsAutomaticallyCheckUpdates() const;
void SetAutomaticallyCheckUpdates(bool value);
unsigned GetLatestSkippedVersion() const; unsigned GetLatestSkippedVersion() const;
void SetLatestSkippedVersion(unsigned value); void SetLatestSkippedVersion(unsigned value);