- Add a manual update check

- Add option to enable check updates
- Fix crash on quit
This commit is contained in:
Julien Wadel 2021-10-22 21:49:11 +02:00
parent 765f68d18b
commit e404cafc2b
22 changed files with 198 additions and 6 deletions

View file

@ -1348,6 +1348,11 @@ Klik her: <a href="%1">%1</a>
<source>quit</source> <source>quit</source>
<translation>Luk</translation> <translation>Luk</translation>
</message> </message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MainWindowTopMenuBar</name> <name>MainWindowTopMenuBar</name>
@ -2516,6 +2521,11 @@ Klik her: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment> <extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>checkForUpdateLabel</source>
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>SettingsVideo</name> <name>SettingsVideo</name>

View file

@ -1348,6 +1348,11 @@ Klicken Sie hier: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<source>quit</source> <source>quit</source>
<translation>Schließen</translation> <translation>Schließen</translation>
</message> </message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MainWindowTopMenuBar</name> <name>MainWindowTopMenuBar</name>
@ -2516,6 +2521,11 @@ Klicken Sie hier: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment> <extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>checkForUpdateLabel</source>
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>SettingsVideo</name> <name>SettingsVideo</name>

View file

@ -1348,6 +1348,11 @@ Click here: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<source>quit</source> <source>quit</source>
<translation>Quit</translation> <translation>Quit</translation>
</message> </message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation>Check for updates</translation>
</message>
</context> </context>
<context> <context>
<name>MainWindowTopMenuBar</name> <name>MainWindowTopMenuBar</name>
@ -2539,6 +2544,11 @@ Click here: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment> <extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment>
<translation>Select a new font</translation> <translation>Select a new font</translation>
</message> </message>
<message>
<source>checkForUpdateLabel</source>
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation>Check for updates</translation>
</message>
</context> </context>
<context> <context>
<name>SettingsVideo</name> <name>SettingsVideo</name>

View file

@ -1348,6 +1348,11 @@ Haga clic aquí: &lt;a href=&quot;%1&quot;&gt;%1 &lt;/a&gt;
<source>quit</source> <source>quit</source>
<translation>Cerrar</translation> <translation>Cerrar</translation>
</message> </message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MainWindowTopMenuBar</name> <name>MainWindowTopMenuBar</name>
@ -2516,6 +2521,11 @@ Haga clic aquí: &lt;a href=&quot;%1&quot;&gt;%1 &lt;/a&gt;
<extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment> <extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>checkForUpdateLabel</source>
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>SettingsVideo</name> <name>SettingsVideo</name>

View file

@ -1348,6 +1348,11 @@ Cliquez ici : &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<source>quit</source> <source>quit</source>
<translation>Quitter</translation> <translation>Quitter</translation>
</message> </message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MainWindowTopMenuBar</name> <name>MainWindowTopMenuBar</name>
@ -2516,6 +2521,11 @@ Cliquez ici : &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment> <extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment>
<translation>Sélectionnez une nouvelle police</translation> <translation>Sélectionnez une nouvelle police</translation>
</message> </message>
<message>
<source>checkForUpdateLabel</source>
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>SettingsVideo</name> <name>SettingsVideo</name>

View file

@ -1339,6 +1339,11 @@ Kattintson ide: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<source>quit</source> <source>quit</source>
<translation>Kilépés</translation> <translation>Kilépés</translation>
</message> </message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MainWindowTopMenuBar</name> <name>MainWindowTopMenuBar</name>
@ -2506,6 +2511,11 @@ Kattintson ide: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment> <extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment>
<translation>Új betűkészlet kijelölése</translation> <translation>Új betűkészlet kijelölése</translation>
</message> </message>
<message>
<source>checkForUpdateLabel</source>
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>SettingsVideo</name> <name>SettingsVideo</name>

View file

@ -1348,6 +1348,11 @@ Clicca: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<source>quit</source> <source>quit</source>
<translation>Esci</translation> <translation>Esci</translation>
</message> </message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MainWindowTopMenuBar</name> <name>MainWindowTopMenuBar</name>
@ -2516,6 +2521,11 @@ Clicca: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment> <extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>checkForUpdateLabel</source>
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>SettingsVideo</name> <name>SettingsVideo</name>

View file

@ -1339,6 +1339,11 @@
<source>quit</source> <source>quit</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MainWindowTopMenuBar</name> <name>MainWindowTopMenuBar</name>
@ -2506,6 +2511,11 @@
<extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment> <extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>checkForUpdateLabel</source>
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>SettingsVideo</name> <name>SettingsVideo</name>

View file

@ -1357,6 +1357,11 @@ Spustelėkite čia: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<source>quit</source> <source>quit</source>
<translation>Išeiti</translation> <translation>Išeiti</translation>
</message> </message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MainWindowTopMenuBar</name> <name>MainWindowTopMenuBar</name>
@ -2526,6 +2531,11 @@ Spustelėkite čia: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment> <extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>checkForUpdateLabel</source>
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>SettingsVideo</name> <name>SettingsVideo</name>

View file

@ -1348,6 +1348,11 @@ Clique aqui: &lt;a href=&quot;%1&quot;&gt;%1 &lt;/a&gt;
<source>quit</source> <source>quit</source>
<translation>Desistir</translation> <translation>Desistir</translation>
</message> </message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MainWindowTopMenuBar</name> <name>MainWindowTopMenuBar</name>
@ -2516,6 +2521,11 @@ Clique aqui: &lt;a href=&quot;%1&quot;&gt;%1 &lt;/a&gt;
<extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment> <extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>checkForUpdateLabel</source>
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>SettingsVideo</name> <name>SettingsVideo</name>

View file

@ -1357,6 +1357,11 @@
<source>quit</source> <source>quit</source>
<translation>Выйти</translation> <translation>Выйти</translation>
</message> </message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MainWindowTopMenuBar</name> <name>MainWindowTopMenuBar</name>
@ -2526,6 +2531,11 @@
<extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment> <extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>checkForUpdateLabel</source>
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>SettingsVideo</name> <name>SettingsVideo</name>

View file

@ -1348,6 +1348,11 @@ Klicka här: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<source>quit</source> <source>quit</source>
<translation>Avsluta</translation> <translation>Avsluta</translation>
</message> </message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MainWindowTopMenuBar</name> <name>MainWindowTopMenuBar</name>
@ -2516,6 +2521,11 @@ Klicka här: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment> <extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>checkForUpdateLabel</source>
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>SettingsVideo</name> <name>SettingsVideo</name>

View file

@ -1339,6 +1339,11 @@ Buraya tıklayın: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<source>quit</source> <source>quit</source>
<translation>Çıkış</translation> <translation>Çıkış</translation>
</message> </message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MainWindowTopMenuBar</name> <name>MainWindowTopMenuBar</name>
@ -2506,6 +2511,11 @@ Buraya tıklayın: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment> <extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>checkForUpdateLabel</source>
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>SettingsVideo</name> <name>SettingsVideo</name>

View file

@ -1357,6 +1357,11 @@
<source>quit</source> <source>quit</source>
<translation>Вийти</translation> <translation>Вийти</translation>
</message> </message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MainWindowTopMenuBar</name> <name>MainWindowTopMenuBar</name>
@ -2526,6 +2531,11 @@
<extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment> <extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>checkForUpdateLabel</source>
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>SettingsVideo</name> <name>SettingsVideo</name>

View file

@ -1339,6 +1339,11 @@
<source>quit</source> <source>quit</source>
<translation>退</translation> <translation>退</translation>
</message> </message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MainWindowTopMenuBar</name> <name>MainWindowTopMenuBar</name>
@ -2506,6 +2511,11 @@
<extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment> <extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment>
<translation></translation> <translation></translation>
</message> </message>
<message>
<source>checkForUpdateLabel</source>
<extracomment>&apos;Check for updates&apos; : Label switch for enabling check for updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>SettingsVideo</name> <name>SettingsVideo</name>

View file

@ -950,7 +950,7 @@ void App::openAppAfterInit (bool mustBeIconified) {
QObject::connect(timer, &QTimer::timeout, this, &App::checkForUpdate); QObject::connect(timer, &QTimer::timeout, this, &App::checkForUpdate);
timer->start(); timer->start();
checkForUpdate(); checkForUpdates();
#endif // ifdef ENABLE_UPDATE_CHECK #endif // ifdef ENABLE_UPDATE_CHECK
if(setFetchConfig(mParser)) if(setFetchConfig(mParser))
@ -1000,6 +1000,10 @@ QString App::getStrippedApplicationVersion(){// x.y.z but if 'z-*' then x.y.z-1
return currentVersion; return currentVersion;
} }
void App::checkForUpdate() { void App::checkForUpdate() {
checkForUpdates(false);
}
void App::checkForUpdates(bool force) {
if(force || CoreManager::getInstance()->getSettingsModel()->isCheckForUpdateEnabled())
CoreManager::getInstance()->getCore()->checkForUpdate( CoreManager::getInstance()->getCore()->checkForUpdate(
Utils::appStringToCoreString(getStrippedApplicationVersion()) Utils::appStringToCoreString(getStrippedApplicationVersion())
); );

View file

@ -113,6 +113,7 @@ public:
Q_INVOKABLE QQuickWindow *getSettingsWindow () const; Q_INVOKABLE QQuickWindow *getSettingsWindow () const;
Q_INVOKABLE static void smartShowWindow (QQuickWindow *window); Q_INVOKABLE static void smartShowWindow (QQuickWindow *window);
Q_INVOKABLE static void checkForUpdates(bool force = false);
public slots: public slots:
void stateChanged(Qt::ApplicationState); void stateChanged(Qt::ApplicationState);

View file

@ -99,5 +99,9 @@ AppController::AppController (int &argc, char *argv[]) {
} }
AppController::~AppController () { AppController::~AppController () {
try{
delete mApp; delete mApp;
} }
catch(...){
}
}

View file

@ -1255,6 +1255,15 @@ void SettingsModel::setExitOnClose (bool value) {
emit exitOnCloseChanged(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{ bool SettingsModel::getShowLocalSipAccount()const{

View file

@ -178,6 +178,7 @@ class SettingsModel : public QObject {
Q_PROPERTY(QString downloadFolder READ getDownloadFolder WRITE setDownloadFolder NOTIFY downloadFolderChanged) Q_PROPERTY(QString downloadFolder READ getDownloadFolder WRITE setDownloadFolder NOTIFY downloadFolderChanged)
Q_PROPERTY(bool exitOnClose READ getExitOnClose WRITE setExitOnClose NOTIFY exitOnCloseChanged) 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 showLocalSipAccount READ getShowLocalSipAccount CONSTANT)
Q_PROPERTY(bool showStartChatButton READ getShowStartChatButton CONSTANT) Q_PROPERTY(bool showStartChatButton READ getShowStartChatButton CONSTANT)
@ -457,6 +458,9 @@ public:
bool getExitOnClose () const; bool getExitOnClose () const;
void setExitOnClose (bool value); void setExitOnClose (bool value);
bool isCheckForUpdateEnabled() const;
void setCheckForUpdateEnabled(bool enable);
Q_INVOKABLE bool getShowLocalSipAccount () const; Q_INVOKABLE bool getShowLocalSipAccount () const;
Q_INVOKABLE bool getShowStartChatButton () const; Q_INVOKABLE bool getShowStartChatButton () const;
Q_INVOKABLE bool getShowStartVideoCallButton () const; Q_INVOKABLE bool getShowStartVideoCallButton () const;
@ -629,6 +633,8 @@ signals:
void exitOnCloseChanged (bool value); void exitOnCloseChanged (bool value);
void checkForUpdateEnabledChanged();
// Advanced. ----------------------------------------------------------------- // Advanced. -----------------------------------------------------------------
void logsFolderChanged (const QString &folder); void logsFolderChanged (const QString &folder);

View file

@ -5,6 +5,7 @@ import QtQuick 2.7
import Linphone 1.0 import Linphone 1.0
import Common 1.0 import Common 1.0
import Utils 1.0 import Utils 1.0
// ============================================================================= // =============================================================================
Item { Item {
@ -59,6 +60,13 @@ Item {
onTriggered: settingsShortcut.onActivated() onTriggered: settingsShortcut.onActivated()
} }
MenuItem {
//: 'Check for updates' : Item menu for checking updates
text: qsTr('checkForUpdates')
onTriggered: App.checkForUpdates(true)
}
MenuItem { MenuItem {
text: qsTr('about') text: qsTr('about')

View file

@ -203,6 +203,16 @@ TabContainer {
onClicked: App.autoStart = !checked 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
}
}
} }
} }
} }