mirror of https://github.com/procxx/kepka.git
Allow to disable the updater using a marco
Adding "DEFINES += TDESKTOP_DISABLE_AUTOUPDATE" to Telegram.pro would disable the updater. This eases creating packages for Linux distributions, where updates are handled by the corresponding package manager.
This commit is contained in:
parent
5a1079e367
commit
4e65b2724d
|
@ -95,7 +95,10 @@ namespace {
|
||||||
|
|
||||||
Application::Application(int &argc, char **argv) : PsApplication(argc, argv),
|
Application::Application(int &argc, char **argv) : PsApplication(argc, argv),
|
||||||
serverName(psServerPrefix() + cGUIDStr()), closing(false),
|
serverName(psServerPrefix() + cGUIDStr()), closing(false),
|
||||||
updateRequestId(0), updateReply(0), updateThread(0), updateDownloader(0), _translator(0) {
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
|
updateRequestId(0), updateReply(0), updateThread(0), updateDownloader(0),
|
||||||
|
#endif
|
||||||
|
_translator(0) {
|
||||||
|
|
||||||
DEBUG_LOG(("Application Info: creation.."));
|
DEBUG_LOG(("Application Info: creation.."));
|
||||||
|
|
||||||
|
@ -178,9 +181,11 @@ Application::Application(int &argc, char **argv) : PsApplication(argc, argv),
|
||||||
connect(&socket, SIGNAL(readyRead()), this, SLOT(socketReading()));
|
connect(&socket, SIGNAL(readyRead()), this, SLOT(socketReading()));
|
||||||
connect(&server, SIGNAL(newConnection()), this, SLOT(newInstanceConnected()));
|
connect(&server, SIGNAL(newConnection()), this, SLOT(newInstanceConnected()));
|
||||||
connect(this, SIGNAL(aboutToQuit()), this, SLOT(closeApplication()));
|
connect(this, SIGNAL(aboutToQuit()), this, SLOT(closeApplication()));
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
connect(&updateCheckTimer, SIGNAL(timeout()), this, SLOT(startUpdateCheck()));
|
connect(&updateCheckTimer, SIGNAL(timeout()), this, SLOT(startUpdateCheck()));
|
||||||
connect(this, SIGNAL(updateFailed()), this, SLOT(onUpdateFailed()));
|
connect(this, SIGNAL(updateFailed()), this, SLOT(onUpdateFailed()));
|
||||||
connect(this, SIGNAL(updateReady()), this, SLOT(onUpdateReady()));
|
connect(this, SIGNAL(updateReady()), this, SLOT(onUpdateReady()));
|
||||||
|
#endif
|
||||||
connect(this, SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(onAppStateChanged(Qt::ApplicationState)));
|
connect(this, SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(onAppStateChanged(Qt::ApplicationState)));
|
||||||
//connect(&writeUserConfigTimer, SIGNAL(timeout()), this, SLOT(onWriteUserConfig()));
|
//connect(&writeUserConfigTimer, SIGNAL(timeout()), this, SLOT(onWriteUserConfig()));
|
||||||
//writeUserConfigTimer.setSingleShot(true);
|
//writeUserConfigTimer.setSingleShot(true);
|
||||||
|
@ -195,6 +200,7 @@ Application::Application(int &argc, char **argv) : PsApplication(argc, argv),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
void Application::updateGotCurrent() {
|
void Application::updateGotCurrent() {
|
||||||
if (!updateReply || updateThread) return;
|
if (!updateReply || updateThread) return;
|
||||||
|
|
||||||
|
@ -258,6 +264,7 @@ void Application::onUpdateFailed() {
|
||||||
cSetLastUpdateCheck(unixtime());
|
cSetLastUpdateCheck(unixtime());
|
||||||
Local::writeSettings();
|
Local::writeSettings();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void Application::regPhotoUpdate(const PeerId &peer, MsgId msgId) {
|
void Application::regPhotoUpdate(const PeerId &peer, MsgId msgId) {
|
||||||
photoUpdates.insert(msgId, peer);
|
photoUpdates.insert(msgId, peer);
|
||||||
|
@ -431,11 +438,16 @@ void Application::onSwitchTestMode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::UpdatingState Application::updatingState() {
|
Application::UpdatingState Application::updatingState() {
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
if (!updateThread) return Application::UpdatingNone;
|
if (!updateThread) return Application::UpdatingNone;
|
||||||
if (!updateDownloader) return Application::UpdatingReady;
|
if (!updateDownloader) return Application::UpdatingReady;
|
||||||
return Application::UpdatingDownload;
|
return Application::UpdatingDownload;
|
||||||
|
#else
|
||||||
|
return Application::UpdatingNone;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
int32 Application::updatingSize() {
|
int32 Application::updatingSize() {
|
||||||
if (!updateDownloader) return 0;
|
if (!updateDownloader) return 0;
|
||||||
return updateDownloader->size();
|
return updateDownloader->size();
|
||||||
|
@ -445,6 +457,7 @@ int32 Application::updatingReady() {
|
||||||
if (!updateDownloader) return 0;
|
if (!updateDownloader) return 0;
|
||||||
return updateDownloader->ready();
|
return updateDownloader->ready();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
FileUploader *Application::uploader() {
|
FileUploader *Application::uploader() {
|
||||||
if (!::uploader) ::uploader = new FileUploader();
|
if (!::uploader) ::uploader = new FileUploader();
|
||||||
|
@ -488,6 +501,7 @@ void Application::uploadProfilePhoto(const QImage &tosend, const PeerId &peerId)
|
||||||
App::uploader()->uploadMedia(newId, ready);
|
App::uploader()->uploadMedia(newId, ready);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
void Application::stopUpdate() {
|
void Application::stopUpdate() {
|
||||||
if (updateReply) {
|
if (updateReply) {
|
||||||
updateReply->abort();
|
updateReply->abort();
|
||||||
|
@ -541,6 +555,7 @@ void Application::startUpdateCheck(bool forceWait) {
|
||||||
updateCheckTimer.start((updateInSecs + 5) * 1000);
|
updateCheckTimer.start((updateInSecs + 5) * 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
QChar _toHex(ushort v) {
|
QChar _toHex(ushort v) {
|
||||||
|
@ -643,11 +658,13 @@ void Application::socketError(QLocalSocket::LocalSocketError e) {
|
||||||
return App::quit();
|
return App::quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
if (!cNoStartUpdate() && checkReadyUpdate()) {
|
if (!cNoStartUpdate() && checkReadyUpdate()) {
|
||||||
cSetRestartingUpdate(true);
|
cSetRestartingUpdate(true);
|
||||||
DEBUG_LOG(("Application Info: installing update instead of starting app.."));
|
DEBUG_LOG(("Application Info: installing update instead of starting app.."));
|
||||||
return App::quit();
|
return App::quit();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
startApp();
|
startApp();
|
||||||
}
|
}
|
||||||
|
@ -833,13 +850,15 @@ Application::~Application() {
|
||||||
App::deinitMedia();
|
App::deinitMedia();
|
||||||
deinitImageLinkManager();
|
deinitImageLinkManager();
|
||||||
mainApp = 0;
|
mainApp = 0;
|
||||||
delete updateReply;
|
|
||||||
delete ::uploader;
|
delete ::uploader;
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
|
delete updateReply;
|
||||||
updateReply = 0;
|
updateReply = 0;
|
||||||
if (updateDownloader) updateDownloader->deleteLater();
|
if (updateDownloader) updateDownloader->deleteLater();
|
||||||
updateDownloader = 0;
|
updateDownloader = 0;
|
||||||
if (updateThread) updateThread->quit();
|
if (updateThread) updateThread->quit();
|
||||||
updateThread = 0;
|
updateThread = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
delete window;
|
delete window;
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,10 @@ public:
|
||||||
UpdatingReady,
|
UpdatingReady,
|
||||||
};
|
};
|
||||||
UpdatingState updatingState();
|
UpdatingState updatingState();
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
int32 updatingSize();
|
int32 updatingSize();
|
||||||
int32 updatingReady();
|
int32 updatingReady();
|
||||||
|
#endif
|
||||||
|
|
||||||
FileUploader *uploader();
|
FileUploader *uploader();
|
||||||
void uploadProfilePhoto(const QImage &tosend, const PeerId &peerId);
|
void uploadProfilePhoto(const QImage &tosend, const PeerId &peerId);
|
||||||
|
@ -78,11 +80,13 @@ public:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
void updateChecking();
|
void updateChecking();
|
||||||
void updateLatest();
|
void updateLatest();
|
||||||
void updateDownloading(qint64 ready, qint64 total);
|
void updateDownloading(qint64 ready, qint64 total);
|
||||||
void updateReady();
|
void updateReady();
|
||||||
void updateFailed();
|
void updateFailed();
|
||||||
|
#endif
|
||||||
|
|
||||||
void peerPhotoDone(PeerId peer);
|
void peerPhotoDone(PeerId peer);
|
||||||
void peerPhotoFail(PeerId peer);
|
void peerPhotoFail(PeerId peer);
|
||||||
|
@ -91,7 +95,9 @@ signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
void startUpdateCheck(bool forceWait = false);
|
void startUpdateCheck(bool forceWait = false);
|
||||||
|
#endif
|
||||||
void socketConnected();
|
void socketConnected();
|
||||||
void socketError(QLocalSocket::LocalSocketError e);
|
void socketError(QLocalSocket::LocalSocketError e);
|
||||||
void socketDisconnected();
|
void socketDisconnected();
|
||||||
|
@ -103,11 +109,13 @@ public slots:
|
||||||
void readClients();
|
void readClients();
|
||||||
void removeClients();
|
void removeClients();
|
||||||
|
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
void updateGotCurrent();
|
void updateGotCurrent();
|
||||||
void updateFailedCurrent(QNetworkReply::NetworkError e);
|
void updateFailedCurrent(QNetworkReply::NetworkError e);
|
||||||
|
|
||||||
void onUpdateReady();
|
void onUpdateReady();
|
||||||
void onUpdateFailed();
|
void onUpdateFailed();
|
||||||
|
#endif
|
||||||
|
|
||||||
void photoUpdated(MsgId msgId, const MTPInputFile &file);
|
void photoUpdated(MsgId msgId, const MTPInputFile &file);
|
||||||
|
|
||||||
|
@ -142,12 +150,14 @@ private:
|
||||||
|
|
||||||
Window *window;
|
Window *window;
|
||||||
|
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
mtpRequestId updateRequestId;
|
mtpRequestId updateRequestId;
|
||||||
QNetworkAccessManager updateManager;
|
QNetworkAccessManager updateManager;
|
||||||
QNetworkReply *updateReply;
|
QNetworkReply *updateReply;
|
||||||
SingleTimer updateCheckTimer;
|
SingleTimer updateCheckTimer;
|
||||||
QThread *updateThread;
|
QThread *updateThread;
|
||||||
UpdateDownloader *updateDownloader;
|
UpdateDownloader *updateDownloader;
|
||||||
|
#endif
|
||||||
|
|
||||||
QTimer writeUserConfigTimer;
|
QTimer writeUserConfigTimer;
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,9 @@ GNU General Public License for more details.
|
||||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "application.h"
|
#include "application.h"
|
||||||
#include "pspecific.h"
|
#include "pspecific.h"
|
||||||
|
@ -534,3 +537,5 @@ bool checkReadyUpdate() {
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -17,6 +17,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
|
|
||||||
#include <QtNetwork/QLocalSocket>
|
#include <QtNetwork/QLocalSocket>
|
||||||
#include <QtNetwork/QLocalServer>
|
#include <QtNetwork/QLocalServer>
|
||||||
#include <QtNetwork/QNetworkReply>
|
#include <QtNetwork/QNetworkReply>
|
||||||
|
@ -60,3 +62,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
bool checkReadyUpdate();
|
bool checkReadyUpdate();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -43,7 +43,9 @@ namespace {
|
||||||
countryForReg = nearest.vcountry.c_string().v.c_str();
|
countryForReg = nearest.vcountry.c_string().v.c_str();
|
||||||
emit signalEmitOn->countryChanged();
|
emit signalEmitOn->countryChanged();
|
||||||
}
|
}
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
if (App::app()) App::app()->startUpdateCheck();
|
if (App::app()) App::app()->startUpdateCheck();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
DEBUG_LOG(("Application Info: Telegram done, result: %1").arg(result));
|
DEBUG_LOG(("Application Info: Telegram done, result: %1").arg(result));
|
||||||
|
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
if (cRestartingUpdate()) {
|
if (cRestartingUpdate()) {
|
||||||
if (DevVersion) {
|
if (DevVersion) {
|
||||||
LOG(("Writing 'devversion' file before launching the Updater!"));
|
LOG(("Writing 'devversion' file before launching the Updater!"));
|
||||||
|
@ -93,7 +94,9 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
DEBUG_LOG(("Application Info: executing updater to install update.."));
|
DEBUG_LOG(("Application Info: executing updater to install update.."));
|
||||||
psExecUpdater();
|
psExecUpdater();
|
||||||
} else if (cRestarting()) {
|
} else
|
||||||
|
#endif
|
||||||
|
if (cRestarting()) {
|
||||||
DEBUG_LOG(("Application Info: executing Telegram, because of restart.."));
|
DEBUG_LOG(("Application Info: executing Telegram, because of restart.."));
|
||||||
psExecTelegram();
|
psExecTelegram();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2768,7 +2768,9 @@ void MainWidget::start(const MTPUser &user) {
|
||||||
|
|
||||||
cSetOtherOnline(0);
|
cSetOtherOnline(0);
|
||||||
App::feedUsers(MTP_vector<MTPUser>(1, user));
|
App::feedUsers(MTP_vector<MTPUser>(1, user));
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
App::app()->startUpdateCheck();
|
App::app()->startUpdateCheck();
|
||||||
|
#endif
|
||||||
MTP::send(MTPupdates_GetState(), rpcDone(&MainWidget::gotState));
|
MTP::send(MTPupdates_GetState(), rpcDone(&MainWidget::gotState));
|
||||||
update();
|
update();
|
||||||
if (!cStartUrl().isEmpty()) {
|
if (!cStartUrl().isEmpty()) {
|
||||||
|
|
|
@ -127,9 +127,11 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : QWidget(parent),
|
||||||
|
|
||||||
// general
|
// general
|
||||||
_changeLanguage(this, lang(lng_settings_change_lang)),
|
_changeLanguage(this, lang(lng_settings_change_lang)),
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
_autoUpdate(this, lang(lng_settings_auto_update), cAutoUpdate()),
|
_autoUpdate(this, lang(lng_settings_auto_update), cAutoUpdate()),
|
||||||
_checkNow(this, lang(lng_settings_check_now)),
|
_checkNow(this, lang(lng_settings_check_now)),
|
||||||
_restartNow(this, lang(lng_settings_update_now)),
|
_restartNow(this, lang(lng_settings_update_now)),
|
||||||
|
#endif
|
||||||
|
|
||||||
_supportTray(cSupportTray()),
|
_supportTray(cSupportTray()),
|
||||||
_workmodeTray(this, lang(lng_settings_workmode_tray), (cWorkMode() == dbiwmTrayOnly || cWorkMode() == dbiwmWindowAndTray)),
|
_workmodeTray(this, lang(lng_settings_workmode_tray), (cWorkMode() == dbiwmTrayOnly || cWorkMode() == dbiwmWindowAndTray)),
|
||||||
|
@ -226,9 +228,11 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : QWidget(parent),
|
||||||
|
|
||||||
// general
|
// general
|
||||||
connect(&_changeLanguage, SIGNAL(clicked()), this, SLOT(onChangeLanguage()));
|
connect(&_changeLanguage, SIGNAL(clicked()), this, SLOT(onChangeLanguage()));
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
connect(&_autoUpdate, SIGNAL(changed()), this, SLOT(onAutoUpdate()));
|
connect(&_autoUpdate, SIGNAL(changed()), this, SLOT(onAutoUpdate()));
|
||||||
connect(&_checkNow, SIGNAL(clicked()), this, SLOT(onCheckNow()));
|
connect(&_checkNow, SIGNAL(clicked()), this, SLOT(onCheckNow()));
|
||||||
connect(&_restartNow, SIGNAL(clicked()), this, SLOT(onRestartNow()));
|
connect(&_restartNow, SIGNAL(clicked()), this, SLOT(onRestartNow()));
|
||||||
|
#endif
|
||||||
|
|
||||||
connect(&_workmodeTray, SIGNAL(changed()), this, SLOT(onWorkmodeTray()));
|
connect(&_workmodeTray, SIGNAL(changed()), this, SLOT(onWorkmodeTray()));
|
||||||
connect(&_workmodeWindow, SIGNAL(changed()), this, SLOT(onWorkmodeWindow()));
|
connect(&_workmodeWindow, SIGNAL(changed()), this, SLOT(onWorkmodeWindow()));
|
||||||
|
@ -246,11 +250,13 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : QWidget(parent),
|
||||||
_newVersionText = lang(lng_settings_update_ready) + ' ';
|
_newVersionText = lang(lng_settings_update_ready) + ' ';
|
||||||
_newVersionWidth = st::linkFont->m.width(_newVersionText);
|
_newVersionWidth = st::linkFont->m.width(_newVersionText);
|
||||||
|
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
connect(App::app(), SIGNAL(updateChecking()), this, SLOT(onUpdateChecking()));
|
connect(App::app(), SIGNAL(updateChecking()), this, SLOT(onUpdateChecking()));
|
||||||
connect(App::app(), SIGNAL(updateLatest()), this, SLOT(onUpdateLatest()));
|
connect(App::app(), SIGNAL(updateLatest()), this, SLOT(onUpdateLatest()));
|
||||||
connect(App::app(), SIGNAL(updateDownloading(qint64,qint64)), this, SLOT(onUpdateDownloading(qint64,qint64)));
|
connect(App::app(), SIGNAL(updateDownloading(qint64,qint64)), this, SLOT(onUpdateDownloading(qint64,qint64)));
|
||||||
connect(App::app(), SIGNAL(updateReady()), this, SLOT(onUpdateReady()));
|
connect(App::app(), SIGNAL(updateReady()), this, SLOT(onUpdateReady()));
|
||||||
connect(App::app(), SIGNAL(updateFailed()), this, SLOT(onUpdateFailed()));
|
connect(App::app(), SIGNAL(updateFailed()), this, SLOT(onUpdateFailed()));
|
||||||
|
#endif
|
||||||
|
|
||||||
// chat options
|
// chat options
|
||||||
connect(&_replaceEmojis, SIGNAL(changed()), this, SLOT(onReplaceEmojis()));
|
connect(&_replaceEmojis, SIGNAL(changed()), this, SLOT(onReplaceEmojis()));
|
||||||
|
@ -303,6 +309,7 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : QWidget(parent),
|
||||||
|
|
||||||
updateOnlineDisplay();
|
updateOnlineDisplay();
|
||||||
|
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
switch (App::app()->updatingState()) {
|
switch (App::app()->updatingState()) {
|
||||||
case Application::UpdatingDownload:
|
case Application::UpdatingDownload:
|
||||||
setUpdatingState(UpdatingDownload, true);
|
setUpdatingState(UpdatingDownload, true);
|
||||||
|
@ -311,6 +318,9 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : QWidget(parent),
|
||||||
case Application::UpdatingReady: setUpdatingState(UpdatingReady, true); break;
|
case Application::UpdatingReady: setUpdatingState(UpdatingReady, true); break;
|
||||||
default: setUpdatingState(UpdatingNone, true); break;
|
default: setUpdatingState(UpdatingNone, true); break;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
_updatingState = UpdatingNone;
|
||||||
|
#endif
|
||||||
|
|
||||||
updateConnectionType();
|
updateConnectionType();
|
||||||
|
|
||||||
|
@ -430,6 +440,7 @@ void SettingsInner::paintEvent(QPaintEvent *e) {
|
||||||
p.drawText(_left + st::setHeaderLeft, top + st::setHeaderTop + st::setHeaderFont->ascent, lang(lng_settings_section_general));
|
p.drawText(_left + st::setHeaderLeft, top + st::setHeaderTop + st::setHeaderFont->ascent, lang(lng_settings_section_general));
|
||||||
top += st::setHeaderSkip;
|
top += st::setHeaderSkip;
|
||||||
|
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
top += _autoUpdate.height();
|
top += _autoUpdate.height();
|
||||||
QString textToDraw;
|
QString textToDraw;
|
||||||
if (cAutoUpdate()) {
|
if (cAutoUpdate()) {
|
||||||
|
@ -448,6 +459,7 @@ void SettingsInner::paintEvent(QPaintEvent *e) {
|
||||||
p.setPen(st::setVersionColor->p);
|
p.setPen(st::setVersionColor->p);
|
||||||
p.drawText(_left + st::setVersionLeft, top + st::setVersionTop + st::linkFont->ascent, textToDraw);
|
p.drawText(_left + st::setVersionLeft, top + st::setVersionTop + st::linkFont->ascent, textToDraw);
|
||||||
top += st::setVersionHeight;
|
top += st::setVersionHeight;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (cPlatform() == dbipWindows) {
|
if (cPlatform() == dbipWindows) {
|
||||||
top += _workmodeTray.height() + st::setLittleSkip;
|
top += _workmodeTray.height() + st::setLittleSkip;
|
||||||
|
@ -656,10 +668,12 @@ void SettingsInner::resizeEvent(QResizeEvent *e) {
|
||||||
// general
|
// general
|
||||||
top += st::setHeaderSkip;
|
top += st::setHeaderSkip;
|
||||||
_changeLanguage.move(_left + st::setWidth - _changeLanguage.width(), top - st::setHeaderSkip + st::setHeaderTop + st::setHeaderFont->ascent - st::linkFont->ascent);
|
_changeLanguage.move(_left + st::setWidth - _changeLanguage.width(), top - st::setHeaderSkip + st::setHeaderTop + st::setHeaderFont->ascent - st::linkFont->ascent);
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
_autoUpdate.move(_left, top);
|
_autoUpdate.move(_left, top);
|
||||||
_checkNow.move(_left + st::setWidth - _checkNow.width(), top + st::cbDefFlat.textTop); top += _autoUpdate.height();
|
_checkNow.move(_left + st::setWidth - _checkNow.width(), top + st::cbDefFlat.textTop); top += _autoUpdate.height();
|
||||||
_restartNow.move(_left + st::setWidth - _restartNow.width(), top + st::setVersionTop);
|
_restartNow.move(_left + st::setWidth - _restartNow.width(), top + st::setVersionTop);
|
||||||
top += st::setVersionHeight;
|
top += st::setVersionHeight;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (cPlatform() == dbipWindows) {
|
if (cPlatform() == dbipWindows) {
|
||||||
_workmodeTray.move(_left, top); top += _workmodeTray.height() + st::setLittleSkip;
|
_workmodeTray.move(_left, top); top += _workmodeTray.height() + st::setLittleSkip;
|
||||||
|
@ -972,8 +986,10 @@ void SettingsInner::showAll() {
|
||||||
|
|
||||||
// general
|
// general
|
||||||
_changeLanguage.show();
|
_changeLanguage.show();
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
_autoUpdate.show();
|
_autoUpdate.show();
|
||||||
setUpdatingState(_updatingState, true);
|
setUpdatingState(_updatingState, true);
|
||||||
|
#endif
|
||||||
if (cPlatform() == dbipWindows) {
|
if (cPlatform() == dbipWindows) {
|
||||||
_workmodeTray.show();
|
_workmodeTray.show();
|
||||||
_workmodeWindow.show();
|
_workmodeWindow.show();
|
||||||
|
@ -1219,6 +1235,7 @@ void SettingsInner::onUpdateLocalStorage() {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
void SettingsInner::onAutoUpdate() {
|
void SettingsInner::onAutoUpdate() {
|
||||||
cSetAutoUpdate(!cAutoUpdate());
|
cSetAutoUpdate(!cAutoUpdate());
|
||||||
Local::writeSettings();
|
Local::writeSettings();
|
||||||
|
@ -1244,8 +1261,10 @@ void SettingsInner::onCheckNow() {
|
||||||
cSetLastUpdateCheck(0);
|
cSetLastUpdateCheck(0);
|
||||||
App::app()->startUpdateCheck();
|
App::app()->startUpdateCheck();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void SettingsInner::onRestartNow() {
|
void SettingsInner::onRestartNow() {
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
checkReadyUpdate();
|
checkReadyUpdate();
|
||||||
if (_updatingState == UpdatingReady) {
|
if (_updatingState == UpdatingReady) {
|
||||||
cSetRestartingUpdate(true);
|
cSetRestartingUpdate(true);
|
||||||
|
@ -1253,6 +1272,10 @@ void SettingsInner::onRestartNow() {
|
||||||
cSetRestarting(true);
|
cSetRestarting(true);
|
||||||
cSetRestartingToSettings(true);
|
cSetRestartingToSettings(true);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
cSetRestarting(true);
|
||||||
|
cSetRestartingToSettings(true);
|
||||||
|
#endif
|
||||||
App::quit();
|
App::quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1636,6 +1659,7 @@ void SettingsInner::onTempDirClearFailed(int task) {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
void SettingsInner::setUpdatingState(UpdatingState state, bool force) {
|
void SettingsInner::setUpdatingState(UpdatingState state, bool force) {
|
||||||
if (_updatingState != state || force) {
|
if (_updatingState != state || force) {
|
||||||
_updatingState = state;
|
_updatingState = state;
|
||||||
|
@ -1689,6 +1713,7 @@ void SettingsInner::onUpdateReady() {
|
||||||
void SettingsInner::onUpdateFailed() {
|
void SettingsInner::onUpdateFailed() {
|
||||||
setUpdatingState(UpdatingFail);
|
setUpdatingState(UpdatingFail);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void SettingsInner::onPhotoUpdateStart() {
|
void SettingsInner::onPhotoUpdateStart() {
|
||||||
showAll();
|
showAll();
|
||||||
|
|
|
@ -97,8 +97,10 @@ public slots:
|
||||||
void onUpdatePhoto();
|
void onUpdatePhoto();
|
||||||
void onUpdatePhotoCancel();
|
void onUpdatePhotoCancel();
|
||||||
|
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
void onAutoUpdate();
|
void onAutoUpdate();
|
||||||
void onCheckNow();
|
void onCheckNow();
|
||||||
|
#endif
|
||||||
void onRestartNow();
|
void onRestartNow();
|
||||||
|
|
||||||
void onPasscode();
|
void onPasscode();
|
||||||
|
@ -149,11 +151,13 @@ public slots:
|
||||||
|
|
||||||
void onLocalStorageClear();
|
void onLocalStorageClear();
|
||||||
|
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
void onUpdateChecking();
|
void onUpdateChecking();
|
||||||
void onUpdateLatest();
|
void onUpdateLatest();
|
||||||
void onUpdateDownloading(qint64 ready, qint64 total);
|
void onUpdateDownloading(qint64 ready, qint64 total);
|
||||||
void onUpdateReady();
|
void onUpdateReady();
|
||||||
void onUpdateFailed();
|
void onUpdateFailed();
|
||||||
|
#endif
|
||||||
|
|
||||||
void onShowSessions();
|
void onShowSessions();
|
||||||
|
|
||||||
|
@ -206,8 +210,10 @@ private:
|
||||||
|
|
||||||
// general
|
// general
|
||||||
LinkButton _changeLanguage;
|
LinkButton _changeLanguage;
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
FlatCheckbox _autoUpdate;
|
FlatCheckbox _autoUpdate;
|
||||||
LinkButton _checkNow, _restartNow;
|
LinkButton _checkNow, _restartNow;
|
||||||
|
#endif
|
||||||
bool _supportTray; // cSupportTray() value on settings create
|
bool _supportTray; // cSupportTray() value on settings create
|
||||||
FlatCheckbox _workmodeTray, _workmodeWindow;
|
FlatCheckbox _workmodeTray, _workmodeWindow;
|
||||||
FlatCheckbox _autoStart, _startMinimized, _sendToMenu;
|
FlatCheckbox _autoStart, _startMinimized, _sendToMenu;
|
||||||
|
@ -280,8 +286,10 @@ private:
|
||||||
void offPasswordDone(const MTPBool &result);
|
void offPasswordDone(const MTPBool &result);
|
||||||
bool offPasswordFail(const RPCError &error);
|
bool offPasswordFail(const RPCError &error);
|
||||||
|
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
void setUpdatingState(UpdatingState state, bool force = false);
|
void setUpdatingState(UpdatingState state, bool force = false);
|
||||||
void setDownloadProgress(qint64 ready, qint64 total);
|
void setDownloadProgress(qint64 ready, qint64 total);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -143,7 +143,9 @@ UpdateBtn::UpdateBtn(QWidget *parent, Window *window, const QString &text) : Sys
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateBtn::onClick() {
|
void UpdateBtn::onClick() {
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
checkReadyUpdate();
|
checkReadyUpdate();
|
||||||
|
#endif
|
||||||
if (App::app()->updatingState() == Application::UpdatingReady) {
|
if (App::app()->updatingState() == Application::UpdatingReady) {
|
||||||
cSetRestartingUpdate(true);
|
cSetRestartingUpdate(true);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -80,7 +80,9 @@ TitleWidget::TitleWidget(Window *window)
|
||||||
connect(&_contacts, SIGNAL(clicked()), this, SLOT(onContacts()));
|
connect(&_contacts, SIGNAL(clicked()), this, SLOT(onContacts()));
|
||||||
connect(&_about, SIGNAL(clicked()), this, SLOT(onAbout()));
|
connect(&_about, SIGNAL(clicked()), this, SLOT(onAbout()));
|
||||||
connect(wnd->windowHandle(), SIGNAL(windowStateChanged(Qt::WindowState)), this, SLOT(stateChanged(Qt::WindowState)));
|
connect(wnd->windowHandle(), SIGNAL(windowStateChanged(Qt::WindowState)), this, SLOT(stateChanged(Qt::WindowState)));
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
connect(App::app(), SIGNAL(updateReady()), this, SLOT(showUpdateBtn()));
|
connect(App::app(), SIGNAL(updateReady()), this, SLOT(showUpdateBtn()));
|
||||||
|
#endif
|
||||||
|
|
||||||
if (cPlatform() != dbipWindows) {
|
if (cPlatform() != dbipWindows) {
|
||||||
_minimize.hide();
|
_minimize.hide();
|
||||||
|
|
Loading…
Reference in New Issue