mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-05-16 04:27:56 +00:00
fix(App): check update at startup
This commit is contained in:
parent
93f91b42e1
commit
b9353adc39
4 changed files with 25 additions and 23 deletions
|
|
@ -29,6 +29,8 @@
|
|||
#include <QtDebug>
|
||||
#include <QTimer>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "../components/Components.hpp"
|
||||
#include "../utils/Utils.hpp"
|
||||
|
||||
|
|
@ -55,6 +57,8 @@
|
|||
|
||||
#define SELF_TEST_DELAY 300000
|
||||
|
||||
#define VERSION_UPDATE_CHECK_INTERVAL 86400000 // 24 hours in milliseconds.
|
||||
|
||||
using namespace std;
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -256,12 +260,6 @@ void App::smartShowWindow (QQuickWindow *window) {
|
|||
window->requestActivate();
|
||||
}
|
||||
|
||||
void App::checkForUpdate () {
|
||||
CoreManager::getInstance()->getCore()->checkForUpdate(
|
||||
::Utils::appStringToCoreString(applicationVersion())
|
||||
);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool App::hasFocus () const {
|
||||
|
|
@ -528,6 +526,24 @@ void App::openAppAfterInit () {
|
|||
if (!commandArgument.isEmpty())
|
||||
executeCommand(commandArgument);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_UPDATE_CHECK
|
||||
QTimer *timer = new QTimer(mEngine);
|
||||
timer->setInterval(VERSION_UPDATE_CHECK_INTERVAL);
|
||||
|
||||
QObject::connect(timer, &QTimer::timeout, this, &App::checkForUpdate);
|
||||
timer->start();
|
||||
|
||||
checkForUpdate();
|
||||
#endif // ifdef ENABLE_UPDATE_CHECK
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void App::checkForUpdate () {
|
||||
CoreManager::getInstance()->getCore()->checkForUpdate(
|
||||
::Utils::appStringToCoreString(applicationVersion())
|
||||
);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -78,7 +78,6 @@ public:
|
|||
Q_INVOKABLE QQuickWindow *getSettingsWindow ();
|
||||
|
||||
Q_INVOKABLE static void smartShowWindow (QQuickWindow *window);
|
||||
Q_INVOKABLE static void checkForUpdate ();
|
||||
|
||||
public slots:
|
||||
void quit ();
|
||||
|
|
@ -109,6 +108,8 @@ private:
|
|||
|
||||
void openAppAfterInit ();
|
||||
|
||||
static void checkForUpdate ();
|
||||
|
||||
static QString getQtVersion () {
|
||||
return qVersion();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,11 +31,6 @@
|
|||
|
||||
#include "CoreHandlers.hpp"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define VERSION_UPDATE_CHECK_OBJECT_NAME "version-update-check-timer"
|
||||
#define VERSION_UPDATE_CHECK_INTERVAL 86400000 /* 24 hours in milliseconds. */
|
||||
|
||||
using namespace std;
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -78,16 +73,6 @@ void CoreHandlers::notifyCoreStarted () {
|
|||
[this]() {
|
||||
qInfo() << QStringLiteral("Core started.");
|
||||
emit coreStarted();
|
||||
|
||||
#ifdef ENABLE_UPDATE_CHECK
|
||||
QTimer *timer = new QTimer(this);
|
||||
timer->setInterval(VERSION_UPDATE_CHECK_INTERVAL);
|
||||
|
||||
QObject::connect(timer, &QTimer::timeout, this, &App::checkForUpdate);
|
||||
timer->start();
|
||||
|
||||
App::checkForUpdate();
|
||||
#endif // ifdef ENABLE_UPDATE_CHECK
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include "app/App.hpp"
|
||||
|
||||
// Must be unique. Used by `SingleApplication`.
|
||||
// Must be unique. Used by `SingleApplication` and `Paths`.
|
||||
#define APPLICATION_NAME "linphone"
|
||||
#define APPLICATION_VERSION LINPHONE_QT_GIT_VERSION
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue