Added _UPDMODULE, URL_APPCAST_UPDATES defines

This commit is contained in:
SimplestStudio
2022-02-14 18:51:43 +02:00
parent 6c95cda7e7
commit 6571f31548
6 changed files with 31 additions and 17 deletions

View File

@ -24,15 +24,15 @@ DEFINES += __DONT_WRITE_IN_APP_TITLE
message($$PLATFORM_BUILD)
#win32 {
#CONFIG += updmodule
#updmodule {
#DEFINES += _UPDMODULE
#DEFINES += URL_APPCAST_UPDATES=$$join(LINK,,\\\",\\\")
CONFIG += updmodule
updmodule {
DEFINES += _UPDMODULE
DEFINES += URL_APPCAST_UPDATES=$$join(LINK,,\\\",\\\")
#LIBS += -L$$PWD/3dparty/WinSparkle/$$PLATFORM_BUILD -lWinSparkle
#message(updates is turned on)
#message(url: $$join(LINK,,\\\",\\\"))
#}
message(updates is turned on)
message(url: $$join(LINK,,\\\",\\\"))
}
#}
HEADERS += \

View File

@ -78,12 +78,14 @@ CAscApplicationManagerWrapper::CAscApplicationManagerWrapper(CAscApplicationMana
m_themes = std::make_shared<CThemes>();
#ifdef _UPDMODULE
m_pUpdateManager = new CUpdateManager(this);
connect(m_pUpdateManager, &CUpdateManager::checkFinished, this, &CAscApplicationManagerWrapper::showUpdateMessage);
connect(m_pUpdateManager, &CUpdateManager::updateLoaded, this, &CAscApplicationManagerWrapper::showStartInstallMessage);
connect(m_pUpdateManager, &CUpdateManager::progresChanged, this, [=](const int &percent) {
AscAppManager::sendCommandTo(0, "updates:download", QString("{\"progress\":\"%1\"}").arg(QString::number(percent)));
});
#endif
}
CAscApplicationManagerWrapper::~CAscApplicationManagerWrapper()
@ -278,6 +280,7 @@ bool CAscApplicationManagerWrapper::processCommonEvent(NSEditorApi::CAscCefMenuE
// RELEASEINTERFACE(event);
return true;
} else
#ifdef _UPDMODULE
if ( !(cmd.find(L"update") == std::wstring::npos) ) { // params: check, download, install, abort
const QString params = QString::fromStdWString(pData->get_Param());
#ifdef Q_OS_WIN
@ -302,6 +305,7 @@ bool CAscApplicationManagerWrapper::processCommonEvent(NSEditorApi::CAscCefMenuE
#endif
return true;
} else
#endif
if ( cmd.compare(L"title:button") == 0 ) {
map<int, CCefEventsGate *>::const_iterator it = m_receivers.find(event->get_SenderId());
if ( it != m_receivers.cend() ) {
@ -1201,11 +1205,13 @@ void CAscApplicationManagerWrapper::launchAppClose()
}
} else
if ( !(m_countViews > 1) ) {
#ifdef _UPDMODULE
#ifdef Q_OS_WIN
// ========== Start update installation ============
m_pUpdateManager->handleAppClose();
// =================================================
#endif
#endif
DestroyCefView(-1);
if ( m_pMainWindow ) {
@ -1575,7 +1581,7 @@ bool CAscApplicationManagerWrapper::applySettings(const wstring& wstrjson)
m_private->m_openEditorWindow = objRoot["editorwindowmode"].toBool();
_reg_user.setValue("editorWindowMode", m_private->m_openEditorWindow);
}
#ifdef _UPDMODULE
#ifdef Q_OS_WIN
if ( objRoot.contains("autoupdatemode") ) {
_reg_user.setValue("autoUpdateMode", objRoot["autoupdatemode"].toString());
@ -1587,7 +1593,7 @@ bool CAscApplicationManagerWrapper::applySettings(const wstring& wstrjson)
m_pUpdateManager->setNewUpdateSetting(interval);
}
#endif
#endif
} else {
/* parse settings error */
}
@ -1936,6 +1942,7 @@ void CAscApplicationManagerWrapper::addStylesheets(CScalingFactor f, const std::
void CAscApplicationManagerWrapper::showUpdateMessage(const bool &error,
const bool &updateExist,
#ifdef _UPDMODULE
const QString &version,
const QString &changelog)
{
@ -1997,3 +2004,4 @@ void CAscApplicationManagerWrapper::showStartInstallMessage()
break;
}
}
#endif

View File

@ -44,8 +44,9 @@
#include "ceditorwindow.h"
#include "cwindowsqueue.h"
#include "ceventdriver.h"
#include "cupdatemanager.h"
#ifdef _UPDMODULE
#include "cupdatemanager.h"
#endif
#ifdef _WIN32
#include "win/mainwindow.h"
@ -152,9 +153,11 @@ public slots:
void onEditorWidgetClosed();
private slots:
#ifdef _UPDMODULE
void showStartInstallMessage();
void showUpdateMessage(const bool &error, const bool &updateExist,
void showUpdateMessage(const bool error, const bool updateExist,
const QString &version, const QString &changelog);
#endif
public:
static CAscApplicationManagerWrapper & getInstance();
@ -191,7 +194,6 @@ public:
static void destroyViewer(QCefView * v);
static void cancelClose();
//static void checkUpdates();
uint logoutCount(const std::wstring& portal) const;
void Logout(const std::wstring& portal);
@ -204,8 +206,9 @@ private:
std::unique_ptr<CAscApplicationManagerWrapper_Private> m_private;
CAscApplicationManagerWrapper(CAscApplicationManagerWrapper_Private *);
#ifdef _UPDMODULE
CUpdateManager *m_pUpdateManager;
#endif
};
#endif // QASCAPPLICATIONMANAGER

View File

@ -33,6 +33,7 @@
#include "cupdatemanager.h"
#include <QProcess>
#define URL_APPCAST_UPDATES "http://nct.onlyoffice.com/sh/XHh" // Temporary URL
CUpdateManager::CUpdateManager(QObject *parent):
QObject(parent),

View File

@ -64,7 +64,7 @@
#define APP_SIMPLE_WINDOW_TITLE "ONLYOFFICE Editor"
#define URL_SITE "http://www.onlyoffice.com"
#define URL_APPCAST_UPDATES "http://nct.onlyoffice.com/sh/XHh"
//#define URL_APPCAST_UPDATES ""
#define URL_SIGNUP "https://onlyoffice.com/registration.aspx?desktop=true"
#define GET_REGISTRY_USER(variable) \

View File

@ -103,11 +103,13 @@ void CMainPanelImpl::refreshAboutVersion()
_json_obj["editorwindowmode"] = reg_user.value("editorWindowMode",false).toBool();
// Read update settings
#ifdef _UPDMODULE
AscAppManager::sendCommandTo(0, "updates:turn", "on");
#ifdef Q_OS_WIN
_json_obj["updates"] = QJsonObject({{"mode", reg_user.value("autoUpdateMode","silent").toString()}});
#else
_json_obj["updates"] = QJsonObject({{"interval", reg_user.value("checkUpdatesInterval","day").toString()}});
#endif
#endif
AscAppManager::sendCommandTo(SEND_TO_ALL_START_PAGE, "settings:init", Utils::stringifyJson(_json_obj));