diff --git a/linphone-app/assets/languages/da.ts b/linphone-app/assets/languages/da.ts index 3dd90f5b8..aeeb5bd98 100644 --- a/linphone-app/assets/languages/da.ts +++ b/linphone-app/assets/languages/da.ts @@ -1348,6 +1348,11 @@ Klik her: <a href="%1">%1</a> quit Luk + + checkForUpdates + 'Check for updates' : Item menu for checking updates + + MainWindowTopMenuBar @@ -2516,6 +2521,11 @@ Klik her: <a href="%1">%1</a> 'Select a new font' : Popup title for choosing new fonts + + checkForUpdateLabel + 'Check for updates' : Label switch for enabling check for updates + + SettingsVideo diff --git a/linphone-app/assets/languages/de.ts b/linphone-app/assets/languages/de.ts index 31b314873..90fe5637c 100644 --- a/linphone-app/assets/languages/de.ts +++ b/linphone-app/assets/languages/de.ts @@ -1348,6 +1348,11 @@ Klicken Sie hier: <a href="%1">%1</a> quit Schließen + + checkForUpdates + 'Check for updates' : Item menu for checking updates + + MainWindowTopMenuBar @@ -2516,6 +2521,11 @@ Klicken Sie hier: <a href="%1">%1</a> 'Select a new font' : Popup title for choosing new fonts + + checkForUpdateLabel + 'Check for updates' : Label switch for enabling check for updates + + SettingsVideo diff --git a/linphone-app/assets/languages/en.ts b/linphone-app/assets/languages/en.ts index 6a349ca6b..379d9f48a 100644 --- a/linphone-app/assets/languages/en.ts +++ b/linphone-app/assets/languages/en.ts @@ -1348,6 +1348,11 @@ Click here: <a href="%1">%1</a> quit Quit + + checkForUpdates + 'Check for updates' : Item menu for checking updates + Check for updates + MainWindowTopMenuBar @@ -2539,6 +2544,11 @@ Click here: <a href="%1">%1</a> 'Select a new font' : Popup title for choosing new fonts Select a new font + + checkForUpdateLabel + 'Check for updates' : Label switch for enabling check for updates + Check for updates + SettingsVideo diff --git a/linphone-app/assets/languages/es.ts b/linphone-app/assets/languages/es.ts index a61405436..62b173289 100644 --- a/linphone-app/assets/languages/es.ts +++ b/linphone-app/assets/languages/es.ts @@ -1348,6 +1348,11 @@ Haga clic aquí: <a href="%1">%1 </a> quit Cerrar + + checkForUpdates + 'Check for updates' : Item menu for checking updates + + MainWindowTopMenuBar @@ -2516,6 +2521,11 @@ Haga clic aquí: <a href="%1">%1 </a> 'Select a new font' : Popup title for choosing new fonts + + checkForUpdateLabel + 'Check for updates' : Label switch for enabling check for updates + + SettingsVideo diff --git a/linphone-app/assets/languages/fr_FR.ts b/linphone-app/assets/languages/fr_FR.ts index fea8f51a1..a05c23c14 100644 --- a/linphone-app/assets/languages/fr_FR.ts +++ b/linphone-app/assets/languages/fr_FR.ts @@ -1348,6 +1348,11 @@ Cliquez ici : <a href="%1">%1</a> quit Quitter + + checkForUpdates + 'Check for updates' : Item menu for checking updates + + MainWindowTopMenuBar @@ -2516,6 +2521,11 @@ Cliquez ici : <a href="%1">%1</a> 'Select a new font' : Popup title for choosing new fonts Sélectionnez une nouvelle police + + checkForUpdateLabel + 'Check for updates' : Label switch for enabling check for updates + + SettingsVideo diff --git a/linphone-app/assets/languages/hu.ts b/linphone-app/assets/languages/hu.ts index bd54669db..264311902 100644 --- a/linphone-app/assets/languages/hu.ts +++ b/linphone-app/assets/languages/hu.ts @@ -1339,6 +1339,11 @@ Kattintson ide: <a href="%1">%1</a> quit Kilépés + + checkForUpdates + 'Check for updates' : Item menu for checking updates + + MainWindowTopMenuBar @@ -2506,6 +2511,11 @@ Kattintson ide: <a href="%1">%1</a> 'Select a new font' : Popup title for choosing new fonts Új betűkészlet kijelölése + + checkForUpdateLabel + 'Check for updates' : Label switch for enabling check for updates + + SettingsVideo diff --git a/linphone-app/assets/languages/it.ts b/linphone-app/assets/languages/it.ts index 5388546b0..94ef1a6fe 100644 --- a/linphone-app/assets/languages/it.ts +++ b/linphone-app/assets/languages/it.ts @@ -1348,6 +1348,11 @@ Clicca: <a href="%1">%1</a> quit Esci + + checkForUpdates + 'Check for updates' : Item menu for checking updates + + MainWindowTopMenuBar @@ -2516,6 +2521,11 @@ Clicca: <a href="%1">%1</a> 'Select a new font' : Popup title for choosing new fonts + + checkForUpdateLabel + 'Check for updates' : Label switch for enabling check for updates + + SettingsVideo diff --git a/linphone-app/assets/languages/ja.ts b/linphone-app/assets/languages/ja.ts index 288226e15..d73f252af 100644 --- a/linphone-app/assets/languages/ja.ts +++ b/linphone-app/assets/languages/ja.ts @@ -1339,6 +1339,11 @@ quit 終了 + + checkForUpdates + 'Check for updates' : Item menu for checking updates + + MainWindowTopMenuBar @@ -2506,6 +2511,11 @@ 'Select a new font' : Popup title for choosing new fonts + + checkForUpdateLabel + 'Check for updates' : Label switch for enabling check for updates + + SettingsVideo diff --git a/linphone-app/assets/languages/lt.ts b/linphone-app/assets/languages/lt.ts index 9a923784a..a7faf12ed 100644 --- a/linphone-app/assets/languages/lt.ts +++ b/linphone-app/assets/languages/lt.ts @@ -1357,6 +1357,11 @@ Spustelėkite čia: <a href="%1">%1</a> quit Išeiti + + checkForUpdates + 'Check for updates' : Item menu for checking updates + + MainWindowTopMenuBar @@ -2526,6 +2531,11 @@ Spustelėkite čia: <a href="%1">%1</a> 'Select a new font' : Popup title for choosing new fonts + + checkForUpdateLabel + 'Check for updates' : Label switch for enabling check for updates + + SettingsVideo diff --git a/linphone-app/assets/languages/pt_BR.ts b/linphone-app/assets/languages/pt_BR.ts index 2779a3faf..45020bf3b 100644 --- a/linphone-app/assets/languages/pt_BR.ts +++ b/linphone-app/assets/languages/pt_BR.ts @@ -1348,6 +1348,11 @@ Clique aqui: <a href="%1">%1 </a> quit Desistir + + checkForUpdates + 'Check for updates' : Item menu for checking updates + + MainWindowTopMenuBar @@ -2516,6 +2521,11 @@ Clique aqui: <a href="%1">%1 </a> 'Select a new font' : Popup title for choosing new fonts + + checkForUpdateLabel + 'Check for updates' : Label switch for enabling check for updates + + SettingsVideo diff --git a/linphone-app/assets/languages/ru.ts b/linphone-app/assets/languages/ru.ts index 1714dc86e..913c20d18 100644 --- a/linphone-app/assets/languages/ru.ts +++ b/linphone-app/assets/languages/ru.ts @@ -1357,6 +1357,11 @@ quit Выйти + + checkForUpdates + 'Check for updates' : Item menu for checking updates + + MainWindowTopMenuBar @@ -2526,6 +2531,11 @@ 'Select a new font' : Popup title for choosing new fonts + + checkForUpdateLabel + 'Check for updates' : Label switch for enabling check for updates + + SettingsVideo diff --git a/linphone-app/assets/languages/sv.ts b/linphone-app/assets/languages/sv.ts index 98970eed5..af484b3f6 100644 --- a/linphone-app/assets/languages/sv.ts +++ b/linphone-app/assets/languages/sv.ts @@ -1348,6 +1348,11 @@ Klicka här: <a href="%1">%1</a> quit Avsluta + + checkForUpdates + 'Check for updates' : Item menu for checking updates + + MainWindowTopMenuBar @@ -2516,6 +2521,11 @@ Klicka här: <a href="%1">%1</a> 'Select a new font' : Popup title for choosing new fonts + + checkForUpdateLabel + 'Check for updates' : Label switch for enabling check for updates + + SettingsVideo diff --git a/linphone-app/assets/languages/tr.ts b/linphone-app/assets/languages/tr.ts index b67457209..585f21b8b 100644 --- a/linphone-app/assets/languages/tr.ts +++ b/linphone-app/assets/languages/tr.ts @@ -1339,6 +1339,11 @@ Buraya tıklayın: <a href="%1">%1</a> quit Çıkış + + checkForUpdates + 'Check for updates' : Item menu for checking updates + + MainWindowTopMenuBar @@ -2506,6 +2511,11 @@ Buraya tıklayın: <a href="%1">%1</a> 'Select a new font' : Popup title for choosing new fonts + + checkForUpdateLabel + 'Check for updates' : Label switch for enabling check for updates + + SettingsVideo diff --git a/linphone-app/assets/languages/uk.ts b/linphone-app/assets/languages/uk.ts index 1f76c03e3..0fd85acf4 100644 --- a/linphone-app/assets/languages/uk.ts +++ b/linphone-app/assets/languages/uk.ts @@ -1357,6 +1357,11 @@ quit Вийти + + checkForUpdates + 'Check for updates' : Item menu for checking updates + + MainWindowTopMenuBar @@ -2526,6 +2531,11 @@ 'Select a new font' : Popup title for choosing new fonts + + checkForUpdateLabel + 'Check for updates' : Label switch for enabling check for updates + + SettingsVideo diff --git a/linphone-app/assets/languages/zh_CN.ts b/linphone-app/assets/languages/zh_CN.ts index 9752f8e2e..eac738fa3 100644 --- a/linphone-app/assets/languages/zh_CN.ts +++ b/linphone-app/assets/languages/zh_CN.ts @@ -1339,6 +1339,11 @@ quit 退出 + + checkForUpdates + 'Check for updates' : Item menu for checking updates + + MainWindowTopMenuBar @@ -2506,6 +2511,11 @@ 'Select a new font' : Popup title for choosing new fonts 选择新字体 + + checkForUpdateLabel + 'Check for updates' : Label switch for enabling check for updates + + SettingsVideo diff --git a/linphone-app/src/app/App.cpp b/linphone-app/src/app/App.cpp index ca0cdefe0..0bfbb0a8f 100644 --- a/linphone-app/src/app/App.cpp +++ b/linphone-app/src/app/App.cpp @@ -950,7 +950,7 @@ void App::openAppAfterInit (bool mustBeIconified) { QObject::connect(timer, &QTimer::timeout, this, &App::checkForUpdate); timer->start(); - checkForUpdate(); + checkForUpdates(); #endif // ifdef ENABLE_UPDATE_CHECK if(setFetchConfig(mParser)) @@ -999,8 +999,12 @@ QString App::getStrippedApplicationVersion(){// x.y.z but if 'z-*' then x.y.z-1 } return currentVersion; } -void App::checkForUpdate () { - CoreManager::getInstance()->getCore()->checkForUpdate( - Utils::appStringToCoreString(getStrippedApplicationVersion()) - ); +void App::checkForUpdate() { + checkForUpdates(false); +} +void App::checkForUpdates(bool force) { + if(force || CoreManager::getInstance()->getSettingsModel()->isCheckForUpdateEnabled()) + CoreManager::getInstance()->getCore()->checkForUpdate( + Utils::appStringToCoreString(getStrippedApplicationVersion()) + ); } diff --git a/linphone-app/src/app/App.hpp b/linphone-app/src/app/App.hpp index b195f580f..66a0d0f0e 100644 --- a/linphone-app/src/app/App.hpp +++ b/linphone-app/src/app/App.hpp @@ -113,6 +113,7 @@ public: Q_INVOKABLE QQuickWindow *getSettingsWindow () const; Q_INVOKABLE static void smartShowWindow (QQuickWindow *window); + Q_INVOKABLE static void checkForUpdates(bool force = false); public slots: void stateChanged(Qt::ApplicationState); diff --git a/linphone-app/src/app/AppController.cpp b/linphone-app/src/app/AppController.cpp index 95423c241..f1aa790be 100644 --- a/linphone-app/src/app/AppController.cpp +++ b/linphone-app/src/app/AppController.cpp @@ -99,5 +99,9 @@ AppController::AppController (int &argc, char *argv[]) { } AppController::~AppController () { - delete mApp; + try{ + delete mApp; + } + catch(...){ + } } diff --git a/linphone-app/src/components/settings/SettingsModel.cpp b/linphone-app/src/components/settings/SettingsModel.cpp index 2b1a109b9..21943cc62 100644 --- a/linphone-app/src/components/settings/SettingsModel.cpp +++ b/linphone-app/src/components/settings/SettingsModel.cpp @@ -1255,6 +1255,15 @@ void SettingsModel::setExitOnClose (bool value) { emit exitOnCloseChanged(value); } +bool SettingsModel::isCheckForUpdateEnabled() const{ + return !!mConfig->getInt(UiSection, "check_for_update_enabled", 1); +} + +void SettingsModel::setCheckForUpdateEnabled(bool enable){ + mConfig->setInt(UiSection, "check_for_update_enabled", enable); + emit checkForUpdateEnabledChanged(); +} + // ----------------------------------------------------------------------------- bool SettingsModel::getShowLocalSipAccount()const{ diff --git a/linphone-app/src/components/settings/SettingsModel.hpp b/linphone-app/src/components/settings/SettingsModel.hpp index 3d5a10efa..a4f28b611 100644 --- a/linphone-app/src/components/settings/SettingsModel.hpp +++ b/linphone-app/src/components/settings/SettingsModel.hpp @@ -178,6 +178,7 @@ class SettingsModel : public QObject { Q_PROPERTY(QString downloadFolder READ getDownloadFolder WRITE setDownloadFolder NOTIFY downloadFolderChanged) Q_PROPERTY(bool exitOnClose READ getExitOnClose WRITE setExitOnClose NOTIFY exitOnCloseChanged) + Q_PROPERTY(bool checkForUpdateEnabled READ isCheckForUpdateEnabled WRITE setCheckForUpdateEnabled NOTIFY checkForUpdateEnabledChanged) Q_PROPERTY(bool showLocalSipAccount READ getShowLocalSipAccount CONSTANT) Q_PROPERTY(bool showStartChatButton READ getShowStartChatButton CONSTANT) @@ -457,6 +458,9 @@ public: bool getExitOnClose () const; void setExitOnClose (bool value); + bool isCheckForUpdateEnabled() const; + void setCheckForUpdateEnabled(bool enable); + Q_INVOKABLE bool getShowLocalSipAccount () const; Q_INVOKABLE bool getShowStartChatButton () const; Q_INVOKABLE bool getShowStartVideoCallButton () const; @@ -629,6 +633,8 @@ signals: void exitOnCloseChanged (bool value); + void checkForUpdateEnabledChanged(); + // Advanced. ----------------------------------------------------------------- void logsFolderChanged (const QString &folder); diff --git a/linphone-app/ui/views/App/Main/MainWindowMenuBar.qml b/linphone-app/ui/views/App/Main/MainWindowMenuBar.qml index a485aace5..0cea881f1 100644 --- a/linphone-app/ui/views/App/Main/MainWindowMenuBar.qml +++ b/linphone-app/ui/views/App/Main/MainWindowMenuBar.qml @@ -5,6 +5,7 @@ import QtQuick 2.7 import Linphone 1.0 import Common 1.0 import Utils 1.0 + // ============================================================================= Item { @@ -58,6 +59,13 @@ Item { onTriggered: settingsShortcut.onActivated() } + + MenuItem { + //: 'Check for updates' : Item menu for checking updates + text: qsTr('checkForUpdates') + + onTriggered: App.checkForUpdates(true) + } MenuItem { text: qsTr('about') diff --git a/linphone-app/ui/views/App/Settings/SettingsUi.qml b/linphone-app/ui/views/App/Settings/SettingsUi.qml index cb9141f26..0cf95a968 100644 --- a/linphone-app/ui/views/App/Settings/SettingsUi.qml +++ b/linphone-app/ui/views/App/Settings/SettingsUi.qml @@ -203,6 +203,16 @@ TabContainer { onClicked: App.autoStart = !checked } } + FormGroup { + //: 'Check for updates' : Label switch for enabling check for updates + label: qsTr('checkForUpdateLabel') + + Switch { + checked: SettingsModel.checkForUpdateEnabled + + onClicked: SettingsModel.checkForUpdateEnabled = !checked + } + } } } }