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);
}
}
checkForUpdate();
if (mSettings->autoCheckForUpdateOnStart()) checkForUpdate();
setIsRestarting(false);
window->show();
window->requestActivate();

View file

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

View file

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

View file

@ -940,6 +940,15 @@ void SettingsModel::setShowPastMeetings(bool 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 {
#ifdef ENABLE_UPDATE_CHECK
return true;

View file

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