add auto check for update on start config setting

This commit is contained in:
Gaelle Braud 2026-03-02 10:26:32 +01:00
parent 4221518dc1
commit 4e27f3528a
5 changed files with 22 additions and 1 deletions

View file

@ -860,7 +860,7 @@ void App::initCore() {
Qt::SingleShotConnection); Qt::SingleShotConnection);
} }
} }
checkForUpdate(); if (mSettings->autoCheckForUpdateOnStart()) checkForUpdate();
setIsRestarting(false); setIsRestarting(false);
window->show(); window->show();
window->requestActivate(); window->requestActivate();

View file

@ -118,6 +118,7 @@ SettingsCore::SettingsCore(QObject *parent) : QObject(parent) {
// Check for update // Check for update
mIsCheckForUpdateAvailable = settingsModel->isCheckForUpdateAvailable(); mIsCheckForUpdateAvailable = settingsModel->isCheckForUpdateAvailable();
mAutoCheckForUpdateOnStart = settingsModel->autoCheckForUpdateOnStart();
// Ui // Ui
INIT_CORE_MEMBER(DisableChatFeature, settingsModel) INIT_CORE_MEMBER(DisableChatFeature, settingsModel)
@ -314,6 +315,7 @@ void SettingsCore::reloadSettings() {
// Check for update // Check for update
mIsCheckForUpdateAvailable = settingsModel->isCheckForUpdateAvailable(); mIsCheckForUpdateAvailable = settingsModel->isCheckForUpdateAvailable();
mAutoCheckForUpdateOnStart = settingsModel->autoCheckForUpdateOnStart();
setDisableChatFeature(settingsModel->getDisableChatFeature()); setDisableChatFeature(settingsModel->getDisableChatFeature());
setDisableMeetingsFeature(settingsModel->getDisableMeetingsFeature()); setDisableMeetingsFeature(settingsModel->getDisableMeetingsFeature());
@ -1408,6 +1410,7 @@ void SettingsCore::writeFromModel(const std::shared_ptr<SettingsModel> &model) {
// Check update // Check update
mIsCheckForUpdateAvailable = model->isCheckForUpdateAvailable(); mIsCheckForUpdateAvailable = model->isCheckForUpdateAvailable();
mAutoCheckForUpdateOnStart = model->autoCheckForUpdateOnStart();
// UI // UI
mDisableChatFeature = model->getDisableChatFeature(); mDisableChatFeature = model->getDisableChatFeature();
@ -1445,6 +1448,10 @@ bool SettingsCore::isCheckForUpdateAvailable() const {
return mIsCheckForUpdateAvailable; return mIsCheckForUpdateAvailable;
} }
bool SettingsCore::autoCheckForUpdateOnStart() const {
return mAutoCheckForUpdateOnStart;
}
void SettingsCore::save() { void SettingsCore::save() {
mustBeInMainThread(getClassName() + Q_FUNC_INFO); mustBeInMainThread(getClassName() + Q_FUNC_INFO);
SettingsCore *thisCopy = new SettingsCore(*this); SettingsCore *thisCopy = new SettingsCore(*this);

View file

@ -278,6 +278,7 @@ public:
void setCardDAVMinCharForResearch(int min); void setCardDAVMinCharForResearch(int min);
bool isCheckForUpdateAvailable() const; bool isCheckForUpdateAvailable() const;
bool autoCheckForUpdateOnStart() const;
Q_INVOKABLE void save(); Q_INVOKABLE void save();
Q_INVOKABLE void undo(); Q_INVOKABLE void undo();
@ -489,6 +490,7 @@ private:
// Check update // Check update
bool mIsCheckForUpdateAvailable = false; bool mIsCheckForUpdateAvailable = false;
bool mAutoCheckForUpdateOnStart = false;
DECLARE_ABSTRACT_OBJECT DECLARE_ABSTRACT_OBJECT
}; };

View file

@ -940,6 +940,15 @@ void SettingsModel::setShowPastMeetings(bool show) {
emit showPastMeetingsChanged(show); emit showPastMeetingsChanged(show);
} }
bool SettingsModel::autoCheckForUpdateOnStart() const {
return !!mConfig->getInt(UiSection, "auto_check_for_update_on_start", isCheckForUpdateAvailable());
}
void SettingsModel::setAutoCheckForUpdateOnStart(bool check) {
mConfig->setInt(UiSection, "auto_check_for_update_on_start", check);
emit autoCheckForUpdateOnStartChanged();
}
bool SettingsModel::isCheckForUpdateAvailable() const { bool SettingsModel::isCheckForUpdateAvailable() const {
#ifdef ENABLE_UPDATE_CHECK #ifdef ENABLE_UPDATE_CHECK
return true; return true;

View file

@ -198,6 +198,8 @@ public:
bool getShowPastMeetings() const; bool getShowPastMeetings() const;
void setShowPastMeetings(bool show); void setShowPastMeetings(bool show);
bool autoCheckForUpdateOnStart() const;
void setAutoCheckForUpdateOnStart(bool check);
bool isCheckForUpdateAvailable() const; bool isCheckForUpdateAvailable() const;
bool isCheckForUpdateEnabled() const; bool isCheckForUpdateEnabled() const;
void setCheckForUpdateEnabled(bool enable); void setCheckForUpdateEnabled(bool enable);
@ -291,6 +293,7 @@ signals:
void showPastMeetingsChanged(bool value); void showPastMeetingsChanged(bool value);
void autoCheckForUpdateOnStartChanged();
void checkForUpdateEnabledChanged(); void checkForUpdateEnabledChanged();
void versionCheckUrlChanged(); void versionCheckUrlChanged();