mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
Added popups for "check for update" triggered by user
This commit is contained in:
parent
e31d0b3763
commit
ef3a7e1795
13 changed files with 125 additions and 23 deletions
|
|
@ -2391,7 +2391,7 @@ Klikněte zde: <a href="%1">%1</a>
|
|||
<source>newVersionAvailable</source>
|
||||
<translation>K dispozici je nová verze (%1)!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<message>
|
||||
<source>newFileMessage</source>
|
||||
<translation>Obdržena nová příloha!</translation>
|
||||
</message>
|
||||
|
|
|
|||
|
|
@ -1922,6 +1922,26 @@ Click here: <a href="%1">%1</a>
|
|||
</context>
|
||||
<context>
|
||||
<name>MainWindow</name>
|
||||
<message>
|
||||
<source>newVersionCheckError</source>
|
||||
<translation>An error occured checking for a new version. Try again later or contact support if problem persists.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>newVersionAvailableInstructions</source>
|
||||
<translation>To upgrade to the new version, download the package and install it over the existing one</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>downloadUpdate</source>
|
||||
<translation>Download</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>noNewVersionAvailable</source>
|
||||
<translation>Your application is up to date.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>newVersionInstalled</source>
|
||||
<translation>New application version successfully installed.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>mainSearchBarPlaceholder</source>
|
||||
<translation>Search contact, start a call or a chat…</translation>
|
||||
|
|
|
|||
|
|
@ -1922,6 +1922,26 @@ Cliquez ici : <a href="%1">%1</a>
|
|||
</context>
|
||||
<context>
|
||||
<name>MainWindow</name>
|
||||
<message>
|
||||
<source>newVersionCheckError</source>
|
||||
<translation>Une erreur est survenue. Merci de réessayer plus tard ou de contacter le support.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>newVersionAvailableInstructions</source>
|
||||
<translation>Pour mettre à jour télécharger l'application et lancer l'installeur.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>downloadUpdate</source>
|
||||
<translation>Télécharger</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>noNewVersionAvailable</source>
|
||||
<translation>Votre application est à jour.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>newVersionInstalled</source>
|
||||
<translation>La nouvelle version de l'application a été installée avec succès.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>mainSearchBarPlaceholder</source>
|
||||
<translation>Chercher un contact, appeler ou envoyer un message…</translation>
|
||||
|
|
|
|||
|
|
@ -298,6 +298,7 @@ App::App (int &argc, char *argv[]) : SingleApplication(argc, argv, true, Mode::U
|
|||
qInfo() << QStringLiteral("Received command from other application: `%1`.").arg(command);
|
||||
Cli::executeCommand(command);
|
||||
});
|
||||
mCheckForUpdateUserInitiated = false;
|
||||
}
|
||||
|
||||
App::~App () {
|
||||
|
|
@ -1162,6 +1163,12 @@ void App::openAppAfterInit (bool mustBeIconified) {
|
|||
#endif
|
||||
setOpened(true);
|
||||
useFetchConfig(fetchFilePath);
|
||||
|
||||
QString lastRunningVersion = CoreManager::getInstance()->getSettingsModel()->getLastRunningVersionOfApp();
|
||||
if (lastRunningVersion != "unknown" && lastRunningVersion != applicationVersion()) {
|
||||
emit CoreManager::getInstance()->userInitiatedVersionUpdateCheckResult(3, "", "");
|
||||
}
|
||||
CoreManager::getInstance()->getSettingsModel()->setLastRunningVersionOfApp(applicationVersion());
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
@ -1187,10 +1194,11 @@ void App::checkForUpdate() {
|
|||
checkForUpdates(false);
|
||||
}
|
||||
void App::checkForUpdates(bool force) {
|
||||
if(force || CoreManager::getInstance()->getSettingsModel()->isCheckForUpdateEnabled())
|
||||
if(force || CoreManager::getInstance()->getSettingsModel()->isCheckForUpdateEnabled()) {
|
||||
getInstance()->mCheckForUpdateUserInitiated = force;
|
||||
CoreManager::getInstance()->getCore()->checkForUpdate(
|
||||
Utils::appStringToCoreString(applicationVersion())
|
||||
);
|
||||
Utils::appStringToCoreString(applicationVersion()));
|
||||
}
|
||||
}
|
||||
|
||||
bool App::isPdfAvailable(){
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ public:
|
|||
Q_INVOKABLE QQuickWindow *getSettingsWindow () const;
|
||||
|
||||
Q_INVOKABLE static void smartShowWindow (QQuickWindow *window);
|
||||
bool mCheckForUpdateUserInitiated;
|
||||
Q_INVOKABLE static void checkForUpdates(bool force = false);
|
||||
|
||||
// Check module availability when no dependencies are needed (else use SettingsModel)
|
||||
|
|
|
|||
|
|
@ -449,11 +449,23 @@ void CoreHandlers::onVersionUpdateCheckResultReceived (
|
|||
const string &version,
|
||||
const string &url
|
||||
) {
|
||||
if (result == linphone::VersionUpdateCheckResult::NewVersionAvailable)
|
||||
App::getInstance()->getNotifier()->notifyNewVersionAvailable(
|
||||
Utils::coreStringToAppString(version),
|
||||
Utils::coreStringToAppString(url)
|
||||
);
|
||||
|
||||
if (App::getInstance()->mCheckForUpdateUserInitiated) {
|
||||
App::getInstance()->mCheckForUpdateUserInitiated = false;
|
||||
if (result == linphone::VersionUpdateCheckResult::Error) {
|
||||
emit CoreManager::getInstance()->userInitiatedVersionUpdateCheckResult(0);
|
||||
} else if (result == linphone::VersionUpdateCheckResult::NewVersionAvailable) {
|
||||
emit CoreManager::getInstance()->userInitiatedVersionUpdateCheckResult(1, Utils::coreStringToAppString(version), Utils::coreStringToAppString(url));
|
||||
} else if (result == linphone::VersionUpdateCheckResult::UpToDate) {
|
||||
emit CoreManager::getInstance()->userInitiatedVersionUpdateCheckResult(2);
|
||||
}
|
||||
} else {
|
||||
if (result == linphone::VersionUpdateCheckResult::NewVersionAvailable)
|
||||
App::getInstance()->getNotifier()->notifyNewVersionAvailable(
|
||||
Utils::coreStringToAppString(version),
|
||||
Utils::coreStringToAppString(url)
|
||||
);
|
||||
}
|
||||
}
|
||||
void CoreHandlers::onEcCalibrationResult(
|
||||
const std::shared_ptr<linphone::Core> &,
|
||||
|
|
|
|||
|
|
@ -192,8 +192,9 @@ signals:
|
|||
|
||||
void eventCountChanged ();
|
||||
void callLogsCountChanged();
|
||||
void remoteProvisioningFailed();
|
||||
|
||||
void remoteProvisioningFailed();
|
||||
void userInitiatedVersionUpdateCheckResult(int result, QString version = nullptr, QString url = nullptr);
|
||||
|
||||
private:
|
||||
CoreManager (QObject *parent, const QString &configPath);
|
||||
~CoreManager ();
|
||||
|
|
|
|||
|
|
@ -1689,6 +1689,15 @@ void SettingsModel::setVersionCheckUrl(const QString& url){
|
|||
}
|
||||
}
|
||||
|
||||
QString SettingsModel::getLastRunningVersionOfApp(){
|
||||
auto version = mConfig->getString("app_version", "last_running", "unknown");
|
||||
return Utils::coreStringToAppString(version);
|
||||
}
|
||||
|
||||
void SettingsModel::setLastRunningVersionOfApp(const QString& version){
|
||||
mConfig->setString("app_version", "last_running", Utils::appStringToCoreString(version));
|
||||
}
|
||||
|
||||
SettingsModel::VersionCheckType SettingsModel::getVersionCheckType() const{
|
||||
return (SettingsModel::VersionCheckType) mConfig->getInt(UiSection, "version_check_type", (int)VersionCheckType_Release);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -614,6 +614,9 @@ public:
|
|||
QString getVersionCheckUrl();
|
||||
void setVersionCheckUrl(const QString& url);
|
||||
|
||||
QString getLastRunningVersionOfApp();
|
||||
void setLastRunningVersionOfApp (const QString& version);
|
||||
|
||||
VersionCheckType getVersionCheckType() const;
|
||||
void setVersionCheckType(const VersionCheckType& type);
|
||||
Q_INVOKABLE bool haveVersionNightlyUrl()const;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
#include <QAction>
|
||||
#include <QBitmap>
|
||||
#include <QFileInfo>
|
||||
#include <QCoreApplication>
|
||||
#include <QCryptographicHash>
|
||||
#include <QCursor>
|
||||
#include <QDir>
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
#include <QLocale>
|
||||
#include <QImage>
|
||||
#include <QDateTime>
|
||||
#include <QCoreApplication>
|
||||
|
||||
|
||||
#include <linphone++/address.hh>
|
||||
|
||||
|
|
|
|||
|
|
@ -122,3 +122,14 @@ function handleAuthenticationRequested (authInfo, realm, sipAddress, userId) {
|
|||
function warnProvisioningFailed(window) {
|
||||
Utils.infoDialog(window, qsTr('lastProvisioningFailed'))
|
||||
}
|
||||
|
||||
function proposeDownloadUpdate(window, version, url) {
|
||||
window.attachVirtualWindow(Utils.buildCommonDialogUri('ConfirmDialog'), {
|
||||
descriptionText:qsTr('newVersionAvailable').replace("%1", version)+"\n"+qsTr('newVersionAvailableInstructions'),
|
||||
buttonTexts : [qsTr('cancel'),qsTr('downloadUpdate')]
|
||||
}, function (status) {
|
||||
if (status) {
|
||||
Qt.openUrlExternally(url)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ ApplicationWindow {
|
|||
property string _currentView
|
||||
property var _lockedInfo
|
||||
property SmartSearchBar mainSearchBar : (mainLoader.item ? mainLoader.item.mainSearchBar : null)
|
||||
property var notifyNewVersionInstallWhenLoaded : false
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -56,7 +57,18 @@ ApplicationWindow {
|
|||
Connections {
|
||||
target: CoreManager
|
||||
onCoreManagerInitialized: mainLoader.active = true
|
||||
onRemoteProvisioningFailed: if(mainLoader.active) Logic.warnProvisioningFailed(window)
|
||||
onRemoteProvisioningFailed: if(mainLoader.active) Logic.warnProvisioningFailed(window)
|
||||
onUserInitiatedVersionUpdateCheckResult: switch(result) {
|
||||
case 0 : Utils.infoDialog(window, qsTr('newVersionCheckError')); break;
|
||||
case 1 : Logic.proposeDownloadUpdate(window, version, url); break;
|
||||
case 2 : Utils.infoDialog(window, qsTr('noNewVersionAvailable')+"\n"+Qt.application.version); break;
|
||||
case 3 : if (mainLoader.active)
|
||||
Utils.infoDialog(window, qsTr('newVersionInstalled')+"\n"+Qt.application.version)
|
||||
else
|
||||
notifyNewVersionInstallWhenLoaded = true
|
||||
break;
|
||||
default : {}
|
||||
}
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
|
|
@ -72,16 +84,20 @@ ApplicationWindow {
|
|||
anchors.fill: parent
|
||||
|
||||
onLoaded: {
|
||||
if(!CoreManager.isLastRemoteProvisioningGood()) {
|
||||
Logic.warnProvisioningFailed(window)
|
||||
}
|
||||
switch(SettingsModel.getShowDefaultPage()) {
|
||||
case 1 : window.setView('Calls'); break;
|
||||
case 2 : window.setView('Conversations'); break;
|
||||
case 3 : ContactsListModel.update(); window.setView('Contacts'); break;
|
||||
case 4 : window.setView('Conferences'); break;
|
||||
default:{}
|
||||
}
|
||||
if(!CoreManager.isLastRemoteProvisioningGood()) {
|
||||
Logic.warnProvisioningFailed(window)
|
||||
}
|
||||
if (notifyNewVersionInstallWhenLoaded) {
|
||||
notifyNewVersionInstallWhenLoaded = false
|
||||
Utils.infoDialog(window, qsTr('newVersionInstalled')+"\n"+Qt.application.version)
|
||||
}
|
||||
switch(SettingsModel.getShowDefaultPage()) {
|
||||
case 1 : window.setView('Calls'); break;
|
||||
case 2 : window.setView('Conversations'); break;
|
||||
case 3 : ContactsListModel.update(); window.setView('Contacts'); break;
|
||||
case 4 : window.setView('Conferences'); break;
|
||||
default:{}
|
||||
}
|
||||
}
|
||||
|
||||
sourceComponent: ColumnLayout {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue