mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-25 04:38:23 +00:00
Fixed travis build for TDESKTOP_DISABLE_AUTOUPDATE case.
This commit is contained in:
parent
086f754a96
commit
fc7c5d0ab3
@ -2671,7 +2671,7 @@ namespace {
|
||||
void setProxySettings(QNetworkAccessManager &manager) {
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
manager.setProxy(getHttpProxySettings());
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
}
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
@ -2687,7 +2687,7 @@ namespace {
|
||||
}
|
||||
return QNetworkProxy(QNetworkProxy::DefaultProxy);
|
||||
}
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
|
||||
void setProxySettings(QTcpSocket &socket) {
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
@ -2697,7 +2697,7 @@ namespace {
|
||||
} else {
|
||||
socket.setProxy(QNetworkProxy(QNetworkProxy::NoProxy));
|
||||
}
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
}
|
||||
|
||||
QImage **cornersMask(ImageRoundRadius radius) {
|
||||
|
@ -276,7 +276,7 @@ namespace App {
|
||||
void setProxySettings(QNetworkAccessManager &manager);
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
QNetworkProxy getHttpProxySettings();
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
void setProxySettings(QTcpSocket &socket);
|
||||
|
||||
QImage **cornersMask(ImageRoundRadius radius);
|
||||
|
@ -118,7 +118,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) {
|
||||
connect(&_updateCheckTimer, SIGNAL(timeout()), this, SLOT(updateCheck()));
|
||||
connect(this, SIGNAL(updateFailed()), this, SLOT(onUpdateFailed()));
|
||||
connect(this, SIGNAL(updateReady()), this, SLOT(onUpdateReady()));
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
|
||||
if (cManyInstance()) {
|
||||
LOG(("Many instance allowed, starting..."));
|
||||
@ -210,7 +210,7 @@ void Application::socketError(QLocalSocket::LocalSocketError e) {
|
||||
DEBUG_LOG(("Application Info: installing update instead of starting app..."));
|
||||
return App::quit();
|
||||
}
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
|
||||
singleInstanceChecked();
|
||||
}
|
||||
@ -359,7 +359,7 @@ void Application::closeApplication() {
|
||||
_updateThread->quit();
|
||||
}
|
||||
_updateThread = 0;
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
}
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||
@ -510,7 +510,7 @@ void Application::startUpdateCheck(bool forceWait) {
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
|
||||
inline Application *application() {
|
||||
return qobject_cast<Application*>(QApplication::instance());
|
||||
@ -633,7 +633,7 @@ namespace Sandbox {
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
|
||||
void connect(const char *signal, QObject *object, const char *method) {
|
||||
if (Application *a = application()) {
|
||||
@ -796,7 +796,7 @@ AppClass::AppClass() : QObject()
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
|
||||
if (state != Local::ReadMapPassNeeded) {
|
||||
checkMapVersion();
|
||||
|
@ -99,7 +99,7 @@ private:
|
||||
QThread *_updateThread = nullptr;
|
||||
UpdateChecker *_updateChecker = nullptr;
|
||||
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
};
|
||||
|
||||
namespace Sandbox {
|
||||
@ -129,7 +129,7 @@ namespace Sandbox {
|
||||
void updateFailed();
|
||||
void updateReady();
|
||||
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
|
||||
void connect(const char *signal, QObject *object, const char *method);
|
||||
|
||||
|
@ -42,10 +42,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
#ifdef Q_OS_WIN
|
||||
typedef DWORD VerInt;
|
||||
typedef WCHAR VerChar;
|
||||
#else
|
||||
#else // Q_OS_WIN
|
||||
typedef int VerInt;
|
||||
typedef wchar_t VerChar;
|
||||
#endif
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
UpdateChecker::UpdateChecker(QThread *thread, const QString &url) : reply(0), already(0), full(0) {
|
||||
updateUrl = url;
|
||||
@ -248,9 +248,9 @@ void UpdateChecker::unpackUpdate() {
|
||||
|
||||
#ifdef Q_OS_WIN // use Lzma SDK for win
|
||||
const int32 hSigLen = 128, hShaLen = 20, hPropsLen = LZMA_PROPS_SIZE, hOriginalSizeLen = sizeof(int32), hSize = hSigLen + hShaLen + hPropsLen + hOriginalSizeLen; // header
|
||||
#else
|
||||
#else // Q_OS_WIN
|
||||
const int32 hSigLen = 128, hShaLen = 20, hPropsLen = 0, hOriginalSizeLen = sizeof(int32), hSize = hSigLen + hShaLen + hOriginalSizeLen; // header
|
||||
#endif
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
QByteArray compressed = outputFile.readAll();
|
||||
int32 compressedLen = compressed.size() - hSize;
|
||||
@ -315,7 +315,7 @@ void UpdateChecker::unpackUpdate() {
|
||||
LOG(("Update Error: could not uncompress lzma, code: %1").arg(uncompressRes));
|
||||
return fatalFail();
|
||||
}
|
||||
#else
|
||||
#else // Q_OS_WIN
|
||||
lzma_stream stream = LZMA_STREAM_INIT;
|
||||
|
||||
lzma_ret ret = lzma_stream_decoder(&stream, UINT64_MAX, LZMA_CONCATENATED);
|
||||
@ -358,7 +358,7 @@ void UpdateChecker::unpackUpdate() {
|
||||
LOG(("Error in decompression: %1 (error code %2)").arg(msg).arg(res));
|
||||
return fatalFail();
|
||||
}
|
||||
#endif
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
tempDir.mkdir(tempDir.absolutePath());
|
||||
|
||||
@ -410,7 +410,7 @@ void UpdateChecker::unpackUpdate() {
|
||||
stream >> relativeName >> fileSize >> fileInnerData;
|
||||
#if defined Q_OS_MAC || defined Q_OS_LINUX
|
||||
stream >> executable;
|
||||
#endif
|
||||
#endif // Q_OS_MAC || Q_OS_LINUX
|
||||
if (stream.status() != QDataStream::Ok) {
|
||||
LOG(("Update Error: cant read file from downloaded stream, status: %1").arg(stream.status()));
|
||||
return fatalFail();
|
||||
@ -534,13 +534,13 @@ bool checkReadyUpdate() {
|
||||
#ifdef Q_OS_WIN
|
||||
QString curUpdater = (cExeDir() + qsl("Updater.exe"));
|
||||
QFileInfo updater(cWorkingDir() + qsl("tupdates/temp/Updater.exe"));
|
||||
#elif defined Q_OS_MAC
|
||||
#elif defined Q_OS_MAC // Q_OS_WIN
|
||||
QString curUpdater = (cExeDir() + cExeName() + qsl("/Contents/Frameworks/Updater"));
|
||||
QFileInfo updater(cWorkingDir() + qsl("tupdates/temp/Telegram.app/Contents/Frameworks/Updater"));
|
||||
#elif defined Q_OS_LINUX
|
||||
#elif defined Q_OS_LINUX // Q_OS_MAC
|
||||
QString curUpdater = (cExeDir() + qsl("Updater"));
|
||||
QFileInfo updater(cWorkingDir() + qsl("tupdates/temp/Updater"));
|
||||
#endif
|
||||
#endif // Q_OS_LINUX
|
||||
if (!updater.exists()) {
|
||||
QFileInfo current(curUpdater);
|
||||
if (!current.exists()) {
|
||||
@ -567,23 +567,23 @@ bool checkReadyUpdate() {
|
||||
UpdateChecker::clearAll();
|
||||
return false;
|
||||
}
|
||||
#elif defined Q_OS_MAC
|
||||
#elif defined Q_OS_MAC // Q_OS_WIN
|
||||
QDir().mkpath(QFileInfo(curUpdater).absolutePath());
|
||||
DEBUG_LOG(("Update Info: moving %1 to %2...").arg(updater.absoluteFilePath()).arg(curUpdater));
|
||||
if (!objc_moveFile(updater.absoluteFilePath(), curUpdater)) {
|
||||
UpdateChecker::clearAll();
|
||||
return false;
|
||||
}
|
||||
#elif defined Q_OS_LINUX
|
||||
#elif defined Q_OS_LINUX // Q_OS_MAC
|
||||
if (!linuxMoveFile(QFile::encodeName(updater.absoluteFilePath()).constData(), QFile::encodeName(curUpdater).constData())) {
|
||||
UpdateChecker::clearAll();
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#endif // Q_OS_LINUX
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
|
||||
QString countBetaVersionSignature(uint64 version) { // duplicated in packer.cpp
|
||||
if (cBetaPrivateKey().isEmpty()) {
|
||||
|
@ -116,7 +116,7 @@ void AboutBox::dragEnterEvent(QDragEnterEvent *e) {
|
||||
e->setDropAction(Qt::CopyAction);
|
||||
e->accept();
|
||||
}
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_CRASH_REPORTS
|
||||
}
|
||||
|
||||
void AboutBox::dropEvent(QDropEvent *e) {
|
||||
|
@ -192,7 +192,7 @@ void ConnectionBox::onSave() {
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(false);
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
}
|
||||
if (cPlatform() == dbipWindows && Global::TryIPv6() != _tryIPv6.checked()) {
|
||||
Global::SetTryIPv6(_tryIPv6.checked());
|
||||
|
@ -60,7 +60,7 @@ IntroWidget::IntroWidget(QWidget *parent) : TWidget(parent)
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||
Sandbox::startUpdateCheck();
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
}
|
||||
|
||||
void IntroWidget::langChangeTo(int32 langId) {
|
||||
|
@ -1079,9 +1079,11 @@ bool _readSetting(quint32 blockId, QDataStream &stream, int version) {
|
||||
if (!_checkStreamStatus(stream)) return false;
|
||||
|
||||
cSetAutoUpdate(v == 1);
|
||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||
if (!cAutoUpdate()) {
|
||||
Sandbox::stopUpdate();
|
||||
}
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
} break;
|
||||
|
||||
case dbiLastUpdateCheck: {
|
||||
|
@ -592,8 +592,8 @@ void _moveOldDataFiles(const QString &wasDir) {
|
||||
}
|
||||
if (!tdataConfig.exists() || tdataConfig.remove()) {
|
||||
LOG(("Removed 'tdata/config'"));
|
||||
LOG(("Could not remove 'tdata/config'"));
|
||||
} else {
|
||||
LOG(("Could not remove 'tdata/config'"));
|
||||
}
|
||||
QDir().rmdir(wasDir + "tdata");
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ int main(int argc, char *argv[]) {
|
||||
DEBUG_LOG(("Application Info: executing updater to install update..."));
|
||||
psExecUpdater();
|
||||
} else
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
if (cRestarting()) {
|
||||
DEBUG_LOG(("Application Info: executing Telegram, because of restart..."));
|
||||
psExecTelegram();
|
||||
|
@ -171,7 +171,7 @@ MainWidget::MainWidget(MainWindow *window) : TWidget(window)
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||
Sandbox::startUpdateCheck();
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
}
|
||||
|
||||
bool MainWidget::onForward(const PeerId &peer, ForwardWhatMessages what) {
|
||||
|
@ -1751,7 +1751,7 @@ LastCrashedWindow::LastCrashedWindow()
|
||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||
, _updatingCheck(this)
|
||||
, _updatingSkip(this, false)
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
{
|
||||
excludeReportUsername();
|
||||
|
||||
@ -1846,12 +1846,12 @@ LastCrashedWindow::LastCrashedWindow()
|
||||
|
||||
cSetLastUpdateCheck(0);
|
||||
Sandbox::startUpdateCheck();
|
||||
#else
|
||||
#else // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
_updating.setText(qsl("Please check if there is a new version available."));
|
||||
if (_sendingState != SendingNoReport) {
|
||||
_sendingState = SendingNone;
|
||||
}
|
||||
#endif
|
||||
#endif // else for !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
|
||||
_pleaseSendReport.setText(qsl("Please send us a crash report."));
|
||||
_yourReportName.setText(qsl("Your Report Tag: %1\nYour User Tag: %2").arg(QString(_minidumpName).replace(".dmp", "")).arg(Sandbox::UserTag(), 0, 16));
|
||||
@ -2308,7 +2308,7 @@ void LastCrashedWindow::updateControls() {
|
||||
_updatingSkip.hide();
|
||||
}
|
||||
}
|
||||
#else
|
||||
#else // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
h += _networkSettings.height() + padding;
|
||||
h += padding + _send.height() + padding;
|
||||
if (_sendingState == SendingNoReport) {
|
||||
@ -2380,7 +2380,7 @@ void LastCrashedWindow::updateControls() {
|
||||
|
||||
_getApp.show();
|
||||
h += _networkSettings.height() + padding;
|
||||
#endif
|
||||
#endif // else for !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
|
||||
QRect scr(QApplication::primaryScreen()->availableGeometry());
|
||||
QSize s(2 * padding + QFontMetrics(_label.font()).width(qsl("Last time Telegram Desktop was not closed properly.")) + padding + _networkSettings.width(), h);
|
||||
@ -2409,7 +2409,7 @@ void LastCrashedWindow::onNetworkSettingsSaved(QString host, quint32 port, QStri
|
||||
cSetLastUpdateCheck(0);
|
||||
Sandbox::startUpdateCheck();
|
||||
} else
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
if (_sendingState == SendingFail || _sendingState == SendingProgress) {
|
||||
onSendReport();
|
||||
}
|
||||
@ -2500,7 +2500,7 @@ void LastCrashedWindow::onUpdateReady() {
|
||||
void LastCrashedWindow::onUpdateFailed() {
|
||||
setUpdatingState(UpdatingFail);
|
||||
}
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
|
||||
void LastCrashedWindow::onContinue() {
|
||||
if (SignalHandlers::restart() == SignalHandlers::CantOpen) {
|
||||
@ -2591,7 +2591,7 @@ void LastCrashedWindow::resizeEvent(QResizeEvent *e) {
|
||||
_updatingCheck.move(width() - padding - _updatingCheck.width(), height() - padding - _updatingCheck.height());
|
||||
_updatingSkip.move(width() - padding - _updatingCheck.width() - padding - _updatingSkip.width(), height() - padding - _updatingSkip.height());
|
||||
}
|
||||
#else
|
||||
#else // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
_getApp.move((width() - _getApp.width()) / 2, _updating.y() + _updating.height() + padding);
|
||||
|
||||
_pleaseSendReport.move(padding, padding * 2 + _networkSettings.height() + _networkSettings.height() + padding + _getApp.height() + padding + (_showReport.height() - _pleaseSendReport.height()) / 2);
|
||||
@ -2600,7 +2600,7 @@ void LastCrashedWindow::resizeEvent(QResizeEvent *e) {
|
||||
_includeUsername.move(padding, _yourReportName.y() + _yourReportName.height() + padding);
|
||||
|
||||
_networkSettings.move(padding * 2 + _pleaseSendReport.width(), padding * 2 + _networkSettings.height() + _networkSettings.height() + padding + _getApp.height() + padding);
|
||||
#endif
|
||||
#endif // else for !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
if (_reportUsername.isEmpty()) {
|
||||
_report.setGeometry(padding, _yourReportName.y() + _yourReportName.height() + padding, width() - 2 * padding, _pleaseSendReport.height() * 12.5);
|
||||
} else {
|
||||
|
@ -387,7 +387,7 @@ public slots:
|
||||
void onUpdateDownloading(qint64 ready, qint64 total);
|
||||
void onUpdateReady();
|
||||
void onUpdateFailed();
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
|
||||
protected:
|
||||
|
||||
@ -450,7 +450,7 @@ private:
|
||||
|
||||
void setUpdatingState(UpdatingState state, bool force = false);
|
||||
void setDownloadProgress(qint64 ready, qint64 total);
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
|
||||
QString getReportField(const QLatin1String &name, const QLatin1String &prefix);
|
||||
void addReportFieldPart(const QLatin1String &name, const QLatin1String &prefix, QHttpMultiPart *multipart);
|
||||
|
@ -37,7 +37,7 @@ AutoConnection::AutoConnection(QThread *thread) : AbstractTCPConnection(thread)
|
||||
manager.moveToThread(thread);
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
manager.setProxy(QNetworkProxy(QNetworkProxy::DefaultProxy));
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
|
||||
httpStartTimer.moveToThread(thread);
|
||||
httpStartTimer.setSingleShot(true);
|
||||
@ -50,7 +50,7 @@ AutoConnection::AutoConnection(QThread *thread) : AbstractTCPConnection(thread)
|
||||
sock.moveToThread(thread);
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
sock.setProxy(QNetworkProxy(QNetworkProxy::NoProxy));
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
connect(&sock, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError)));
|
||||
connect(&sock, SIGNAL(connected()), this, SLOT(onSocketConnected()));
|
||||
connect(&sock, SIGNAL(disconnected()), this, SLOT(onSocketDisconnected()));
|
||||
|
@ -769,7 +769,7 @@ void reinitWebLoadManager() {
|
||||
if (webLoadManager()) {
|
||||
webLoadManager()->setProxySettings(App::getHttpProxySettings());
|
||||
}
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
}
|
||||
|
||||
void stopWebLoadManager() {
|
||||
@ -792,7 +792,7 @@ void WebLoadManager::setProxySettings(const QNetworkProxy &proxy) {
|
||||
_proxySettings = proxy;
|
||||
emit proxyApplyDelayed();
|
||||
}
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
|
||||
WebLoadManager::WebLoadManager(QThread *thread) {
|
||||
moveToThread(thread);
|
||||
@ -1024,7 +1024,7 @@ void WebLoadManager::proxyApply() {
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
QMutexLocker lock(&_loaderPointersMutex);
|
||||
_manager.setProxy(_proxySettings);
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
}
|
||||
|
||||
void WebLoadManager::finish() {
|
||||
|
@ -331,7 +331,7 @@ public:
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
void setProxySettings(const QNetworkProxy &proxy);
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
|
||||
void append(webFileLoader *loader, const QString &url);
|
||||
void stop(webFileLoader *reader);
|
||||
@ -364,7 +364,7 @@ private:
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
QNetworkProxy _proxySettings;
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
QNetworkAccessManager _manager;
|
||||
typedef QMap<webFileLoader*, webFileLoaderPrivate*> LoaderPointers;
|
||||
LoaderPointers _loaderPointers;
|
||||
|
@ -209,7 +209,7 @@ f_g_slist_free g_slist_free = nullptr;
|
||||
f_unity_launcher_entry_set_count unity_launcher_entry_set_count = nullptr;
|
||||
f_unity_launcher_entry_set_count_visible unity_launcher_entry_set_count_visible = nullptr;
|
||||
f_unity_launcher_entry_get_for_desktop_id unity_launcher_entry_get_for_desktop_id = nullptr;
|
||||
#endif // TDESKTOP_DISABLE_UNITY_INTEGRATION
|
||||
#endif // !TDESKTOP_DISABLE_UNITY_INTEGRATION
|
||||
|
||||
void start() {
|
||||
DEBUG_LOG(("Loading libraries"));
|
||||
@ -279,7 +279,7 @@ void start() {
|
||||
load(lib_unity, "unity_launcher_entry_set_count", unity_launcher_entry_set_count);
|
||||
load(lib_unity, "unity_launcher_entry_set_count_visible", unity_launcher_entry_set_count_visible);
|
||||
}
|
||||
#endif // TDESKTOP_DISABLE_UNITY_INTEGRATION
|
||||
#endif // !TDESKTOP_DISABLE_UNITY_INTEGRATION
|
||||
|
||||
if (gtkLoaded) {
|
||||
startLibNotify();
|
||||
|
@ -30,7 +30,7 @@ extern "C" {
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION
|
||||
#include <unity/unity/unity.h>
|
||||
#endif // TDESKTOP_DISABLE_UNITY_INTEGRATION
|
||||
#endif // !TDESKTOP_DISABLE_UNITY_INTEGRATION
|
||||
|
||||
namespace Platform {
|
||||
namespace Libs {
|
||||
@ -351,7 +351,7 @@ extern f_unity_launcher_entry_set_count_visible unity_launcher_entry_set_count_v
|
||||
|
||||
typedef UnityLauncherEntry* (*f_unity_launcher_entry_get_for_desktop_id)(const gchar* desktop_id);
|
||||
extern f_unity_launcher_entry_get_for_desktop_id unity_launcher_entry_get_for_desktop_id;
|
||||
#endif // TDESKTOP_DISABLE_UNITY_INTEGRATION
|
||||
#endif // !TDESKTOP_DISABLE_UNITY_INTEGRATION
|
||||
|
||||
} // namespace Libs
|
||||
} // namespace Platform
|
||||
|
@ -173,7 +173,7 @@ static gboolean _trayIconCheck(gpointer/* pIn*/) {
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION
|
||||
UnityLauncherEntry *_psUnityLauncherEntry = nullptr;
|
||||
#endif // TDESKTOP_DISABLE_UNITY_INTEGRATION
|
||||
#endif // !TDESKTOP_DISABLE_UNITY_INTEGRATION
|
||||
|
||||
} // namespace
|
||||
|
||||
@ -326,7 +326,7 @@ void MainWindow::psUpdateCounter() {
|
||||
Libs::unity_launcher_entry_set_count_visible(_psUnityLauncherEntry, FALSE);
|
||||
}
|
||||
}
|
||||
#endif // TDESKTOP_DISABLE_UNITY_INTEGRATION
|
||||
#endif // !TDESKTOP_DISABLE_UNITY_INTEGRATION
|
||||
|
||||
if (noQtTrayIcon) {
|
||||
if (useAppIndicator) {
|
||||
@ -427,7 +427,7 @@ void MainWindow::LibsLoaded() {
|
||||
if (useUnityCount) {
|
||||
DEBUG_LOG(("Unity count api loaded!"));
|
||||
}
|
||||
#endif // TDESKTOP_DISABLE_UNITY_INTEGRATION
|
||||
#endif // !TDESKTOP_DISABLE_UNITY_INTEGRATION
|
||||
}
|
||||
|
||||
void MainWindow::psInitSize() {
|
||||
@ -617,7 +617,7 @@ void MainWindow::psFirstShow() {
|
||||
} else {
|
||||
LOG(("Not using Unity Launcher count."));
|
||||
}
|
||||
#endif // TDESKTOP_DISABLE_UNITY_INTEGRATION
|
||||
#endif // !TDESKTOP_DISABLE_UNITY_INTEGRATION
|
||||
|
||||
psUpdateMargins();
|
||||
|
||||
|
@ -422,11 +422,11 @@ namespace {
|
||||
}
|
||||
|
||||
void psRegisterCustomScheme() {
|
||||
#ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
|
||||
#ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
|
||||
QString home(_psHomeDir());
|
||||
if (home.isEmpty() || cBetaVersion()) return; // don't update desktop file for beta version
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION
|
||||
#ifndef TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION
|
||||
DEBUG_LOG(("App Info: placing .desktop file"));
|
||||
if (QDir(home + qsl(".local/")).exists()) {
|
||||
QString apps = home + qsl(".local/share/applications/");
|
||||
@ -473,7 +473,7 @@ void psRegisterCustomScheme() {
|
||||
LOG(("App Error: Could not open '%1' for write").arg(file));
|
||||
}
|
||||
}
|
||||
#endif // TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION
|
||||
#endif // !TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION
|
||||
|
||||
DEBUG_LOG(("App Info: registerting for Gnome"));
|
||||
if (_psRunCommand("gconftool-2 -t string -s /desktop/gnome/url-handlers/tg/command " + escapeShell(escapeShell(QFile::encodeName(cExeDir() + cExeName())) + " -- %s"))) {
|
||||
@ -512,7 +512,7 @@ void psRegisterCustomScheme() {
|
||||
LOG(("App Error: Could not open '%1' for write").arg(file));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
|
||||
}
|
||||
|
||||
void psNewVersion() {
|
||||
|
@ -914,10 +914,10 @@ void objc_finish() {
|
||||
}
|
||||
|
||||
void objc_registerCustomScheme() {
|
||||
#ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
|
||||
#ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
|
||||
OSStatus result = LSSetDefaultHandlerForURLScheme(CFSTR("tg"), (CFStringRef)[[NSBundle mainBundle] bundleIdentifier]);
|
||||
DEBUG_LOG(("App Info: set default handler for 'tg' scheme result: %1").arg(result));
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
|
||||
}
|
||||
|
||||
BOOL _execUpdater(BOOL update = YES, const QString &crashreport = QString()) {
|
||||
|
@ -809,7 +809,7 @@ void RegisterCustomScheme() {
|
||||
if (!_psOpenRegKey(L"Software\\Classes\\tg\\shell\\open", &rkey)) return;
|
||||
if (!_psOpenRegKey(L"Software\\Classes\\tg\\shell\\open\\command", &rkey)) return;
|
||||
if (!_psSetKeyValue(rkey, 0, '"' + exe + qsl("\" -workdir \"") + cWorkingDir() + qsl("\" -- \"%1\""))) return;
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
|
||||
}
|
||||
|
||||
void psNewVersion() {
|
||||
|
@ -2264,7 +2264,7 @@ void RegisterCustomScheme() {
|
||||
//if (!_psOpenRegKey(L"Software\\Classes\\tg\\shell\\open", &rkey)) return;
|
||||
//if (!_psOpenRegKey(L"Software\\Classes\\tg\\shell\\open\\command", &rkey)) return;
|
||||
//if (!_psSetKeyValue(rkey, 0, '"' + exe + qsl("\" -workdir \"") + cWorkingDir() + qsl("\" -- \"%1\""))) return;
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
|
||||
}
|
||||
|
||||
void psNewVersion() {
|
||||
|
@ -37,7 +37,7 @@ AdvancedWidget::AdvancedWidget(QWidget *parent, UserData *self) : BlockWidget(pa
|
||||
subscribe(Global::RefConnectionTypeChanged(), [this]() {
|
||||
connectionTypeUpdated();
|
||||
});
|
||||
#endif // TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
#endif // !TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
}
|
||||
|
||||
void AdvancedWidget::createControls() {
|
||||
@ -47,7 +47,7 @@ void AdvancedWidget::createControls() {
|
||||
style::margins marginLocalStorage = ([&marginSmall, &marginLarge]() {
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
return marginSmall;
|
||||
#else // TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
#else // !TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
return marginLarge;
|
||||
#endif // TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
})();
|
||||
@ -58,7 +58,7 @@ void AdvancedWidget::createControls() {
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
addChildRow(_connectionType, marginLarge, lang(lng_connection_type), lang(lng_connection_auto_connecting), LabeledLink::Type::Primary, SLOT(onConnectionType()));
|
||||
connectionTypeUpdated();
|
||||
#endif // TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
#endif // !TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
|
||||
if (self()) {
|
||||
addChildRow(_askQuestion, marginSmall, lang(lng_settings_ask_question), SLOT(onAskQuestion()));
|
||||
@ -95,7 +95,7 @@ void AdvancedWidget::connectionTypeUpdated() {
|
||||
void AdvancedWidget::onConnectionType() {
|
||||
Ui::showLayer(new ConnectionBox());
|
||||
}
|
||||
#endif // TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
#endif // !TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
|
||||
void AdvancedWidget::onAskQuestion() {
|
||||
ConfirmBox *box = new ConfirmBox(lang(lng_settings_ask_sure), lang(lng_settings_ask_ok), st::defaultBoxButton, lang(lng_settings_faq_button));
|
||||
|
@ -35,7 +35,7 @@ private slots:
|
||||
void onManageLocalStorage();
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
void onConnectionType();
|
||||
#endif // TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
#endif // !TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
void onAskQuestion();
|
||||
void onAskQuestionSure();
|
||||
void onTelegramFAQ();
|
||||
@ -45,13 +45,13 @@ private:
|
||||
void createControls();
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
void connectionTypeUpdated();
|
||||
#endif // TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
#endif // !TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
void supportGot(const MTPhelp_Support &support);
|
||||
|
||||
ChildWidget<LinkButton> _manageLocalStorage = { nullptr };
|
||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
ChildWidget<LabeledLink> _connectionType = { nullptr };
|
||||
#endif // TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
#endif // !TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
ChildWidget<LinkButton> _askQuestion = { nullptr };
|
||||
ChildWidget<LinkButton> _telegramFAQ = { nullptr };
|
||||
ChildWidget<LinkButton> _logOut = { nullptr };
|
||||
|
@ -165,7 +165,7 @@ void UpdateStateRow::onReady() {
|
||||
void UpdateStateRow::onFailed() {
|
||||
setState(State::Fail);
|
||||
}
|
||||
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
|
||||
GeneralWidget::GeneralWidget(QWidget *parent, UserData *self) : BlockWidget(parent, self, lang(lng_settings_section_general))
|
||||
, _changeLanguage(this, lang(lng_settings_change_lang), st::defaultBoxLinkButton) {
|
||||
@ -196,7 +196,7 @@ void GeneralWidget::refreshControls() {
|
||||
if (!cAutoUpdate()) {
|
||||
_updateRow->hideFast();
|
||||
}
|
||||
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
|
||||
if (cPlatform() == dbipWindows || cSupportTray()) {
|
||||
addChildRow(_enableTrayIcon, marginSmall, lang(lng_settings_workmode_tray), SLOT(onEnableTrayIcon()), (cWorkMode() == dbiwmTrayOnly || cWorkMode() == dbiwmWindowAndTray));
|
||||
@ -269,10 +269,10 @@ void GeneralWidget::onRestart() {
|
||||
cSetRestarting(true);
|
||||
cSetRestartingToSettings(true);
|
||||
}
|
||||
#else
|
||||
#else // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
cSetRestarting(true);
|
||||
cSetRestartingToSettings(true);
|
||||
#endif
|
||||
#endif // else for !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
App::quit();
|
||||
}
|
||||
|
||||
@ -288,7 +288,7 @@ void GeneralWidget::onUpdateAutomatically() {
|
||||
Sandbox::stopUpdate();
|
||||
}
|
||||
}
|
||||
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
|
||||
void GeneralWidget::onEnableTrayIcon() {
|
||||
if ((!_enableTrayIcon->checked() || cPlatform() != dbipWindows) && _enableTaskbarIcon && !_enableTaskbarIcon->checked()) {
|
||||
|
@ -80,7 +80,7 @@ private:
|
||||
QString _downloadText;
|
||||
|
||||
};
|
||||
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
|
||||
class GeneralWidget : public BlockWidget {
|
||||
Q_OBJECT
|
||||
@ -97,7 +97,7 @@ private slots:
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||
void onUpdateAutomatically();
|
||||
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
|
||||
void onEnableTrayIcon();
|
||||
void onEnableTaskbarIcon();
|
||||
@ -118,7 +118,7 @@ private:
|
||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||
ChildWidget<Checkbox> _updateAutomatically = { nullptr };
|
||||
ChildWidget<Ui::WidgetSlideWrap<UpdateStateRow>> _updateRow = { nullptr };
|
||||
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
ChildWidget<Checkbox> _enableTrayIcon = { nullptr };
|
||||
ChildWidget<Checkbox> _enableTaskbarIcon = { nullptr };
|
||||
ChildWidget<Checkbox> _autoStart = { nullptr };
|
||||
|
@ -118,9 +118,9 @@ void ScaleWidget::scaleChanged() {
|
||||
void ScaleWidget::onRestartNow() {
|
||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||
bool updateReady = (Sandbox::updatingState() == Application::UpdatingReady);
|
||||
#else
|
||||
#else // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
bool updateReady = false;
|
||||
#endif
|
||||
#endif // else for !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
if (updateReady) {
|
||||
cSetRestartingUpdate(true);
|
||||
} else {
|
||||
|
@ -138,7 +138,7 @@ UpdateBtn::UpdateBtn(QWidget *parent) : SysBtn(parent, st::sysUpd, lang(lng_menu
|
||||
if (Sandbox::updatingState() == Application::UpdatingReady) {
|
||||
cSetRestartingUpdate(true);
|
||||
} else
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
{
|
||||
cSetRestarting(true);
|
||||
cSetRestartingToSettings(false);
|
||||
|
@ -99,7 +99,7 @@ TitleWidget::TitleWidget(QWidget *parent) : TWidget(parent)
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||
Sandbox::connect(SIGNAL(updateReady()), this, SLOT(updateControlsVisibility()));
|
||||
#endif
|
||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
|
||||
subscribe(Adaptive::Changed(), [this]() { updateAdaptiveLayout(); });
|
||||
if (Media::Player::exists()) {
|
||||
@ -248,9 +248,9 @@ void TitleWidget::updateControlsVisibility() {
|
||||
void TitleWidget::updateRestartButtonVisibility() {
|
||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||
bool updateReady = (Sandbox::updatingState() == Application::UpdatingReady);
|
||||
#else
|
||||
#else // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
bool updateReady = false;
|
||||
#endif
|
||||
#endif // else for !TDESKTOP_DISABLE_AUTOUPDATE
|
||||
auto scaleRestarting = cEvalScale(cConfigScale()) != cEvalScale(cRealScale());
|
||||
|
||||
auto updateVisible = _cancel.isHidden() && (updateReady || scaleRestarting);
|
||||
|
Loading…
Reference in New Issue
Block a user