- 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>
<translation>Luk</translation>
</message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<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>
<translation type="unfinished"></translation>
</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>
<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>
<translation>Schließen</translation>
</message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<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>
<translation type="unfinished"></translation>
</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>
<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>
<translation>Quit</translation>
</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>
<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>
<translation>Select a new font</translation>
</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>
<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>
<translation>Cerrar</translation>
</message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<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>
<translation type="unfinished"></translation>
</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>
<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>
<translation>Quitter</translation>
</message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<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>
<translation>Sélectionnez une nouvelle police</translation>
</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>
<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>
<translation>Kilépés</translation>
</message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<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>
<translation>Új betűkészlet kijelölése</translation>
</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>
<name>SettingsVideo</name>

View file

@ -1348,6 +1348,11 @@ Clicca: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<source>quit</source>
<translation>Esci</translation>
</message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<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>
<translation type="unfinished"></translation>
</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>
<name>SettingsVideo</name>

View file

@ -1339,6 +1339,11 @@
<source>quit</source>
<translation></translation>
</message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindowTopMenuBar</name>
@ -2506,6 +2511,11 @@
<extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment>
<translation type="unfinished"></translation>
</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>
<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>
<translation>Išeiti</translation>
</message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<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>
<translation type="unfinished"></translation>
</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>
<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>
<translation>Desistir</translation>
</message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<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>
<translation type="unfinished"></translation>
</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>
<name>SettingsVideo</name>

View file

@ -1357,6 +1357,11 @@
<source>quit</source>
<translation>Выйти</translation>
</message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindowTopMenuBar</name>
@ -2526,6 +2531,11 @@
<extracomment>&apos;Select a new font&apos; : Popup title for choosing new fonts</extracomment>
<translation type="unfinished"></translation>
</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>
<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>
<translation>Avsluta</translation>
</message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<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>
<translation type="unfinished"></translation>
</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>
<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>
<translation>Çıkış</translation>
</message>
<message>
<source>checkForUpdates</source>
<extracomment>&apos;Check for updates&apos; : Item menu for checking updates</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<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>
<translation type="unfinished"></translation>
</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>
<name>SettingsVideo</name>

View file

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

View file

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

View file

@ -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())
);
}

View file

@ -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);

View file

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

View file

@ -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{

View file

@ -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);

View file

@ -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')

View file

@ -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
}
}
}
}
}