diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index 2c20fe32a7..63a865738f 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -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) { diff --git a/Telegram/SourceFiles/app.h b/Telegram/SourceFiles/app.h index 466fec3961..ec27125c18 100644 --- a/Telegram/SourceFiles/app.h +++ b/Telegram/SourceFiles/app.h @@ -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); diff --git a/Telegram/SourceFiles/application.cpp b/Telegram/SourceFiles/application.cpp index 351e5ca2b0..96b015b391 100644 --- a/Telegram/SourceFiles/application.cpp +++ b/Telegram/SourceFiles/application.cpp @@ -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(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(); diff --git a/Telegram/SourceFiles/application.h b/Telegram/SourceFiles/application.h index 27347b9800..a18b4d9fa3 100644 --- a/Telegram/SourceFiles/application.h +++ b/Telegram/SourceFiles/application.h @@ -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); diff --git a/Telegram/SourceFiles/autoupdater.cpp b/Telegram/SourceFiles/autoupdater.cpp index a9881a9e43..0999c3a468 100644 --- a/Telegram/SourceFiles/autoupdater.cpp +++ b/Telegram/SourceFiles/autoupdater.cpp @@ -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()) { diff --git a/Telegram/SourceFiles/boxes/aboutbox.cpp b/Telegram/SourceFiles/boxes/aboutbox.cpp index 184df91d44..83650f48e2 100644 --- a/Telegram/SourceFiles/boxes/aboutbox.cpp +++ b/Telegram/SourceFiles/boxes/aboutbox.cpp @@ -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) { diff --git a/Telegram/SourceFiles/boxes/connectionbox.cpp b/Telegram/SourceFiles/boxes/connectionbox.cpp index 755221c49c..cc9e597435 100644 --- a/Telegram/SourceFiles/boxes/connectionbox.cpp +++ b/Telegram/SourceFiles/boxes/connectionbox.cpp @@ -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()); diff --git a/Telegram/SourceFiles/intro/introwidget.cpp b/Telegram/SourceFiles/intro/introwidget.cpp index 9d2f661fb3..36c81ae274 100644 --- a/Telegram/SourceFiles/intro/introwidget.cpp +++ b/Telegram/SourceFiles/intro/introwidget.cpp @@ -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) { diff --git a/Telegram/SourceFiles/localstorage.cpp b/Telegram/SourceFiles/localstorage.cpp index a57e4f56ed..b2ff027da0 100644 --- a/Telegram/SourceFiles/localstorage.cpp +++ b/Telegram/SourceFiles/localstorage.cpp @@ -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: { diff --git a/Telegram/SourceFiles/logs.cpp b/Telegram/SourceFiles/logs.cpp index 5565cecbd3..0149538583 100644 --- a/Telegram/SourceFiles/logs.cpp +++ b/Telegram/SourceFiles/logs.cpp @@ -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"); } diff --git a/Telegram/SourceFiles/main.cpp b/Telegram/SourceFiles/main.cpp index 3fc2ce67ad..4b70abf069 100644 --- a/Telegram/SourceFiles/main.cpp +++ b/Telegram/SourceFiles/main.cpp @@ -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(); diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index adfd05e65b..6b96824763 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -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) { diff --git a/Telegram/SourceFiles/mainwindow.cpp b/Telegram/SourceFiles/mainwindow.cpp index e9ecb1c391..496ba9e26b 100644 --- a/Telegram/SourceFiles/mainwindow.cpp +++ b/Telegram/SourceFiles/mainwindow.cpp @@ -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 { diff --git a/Telegram/SourceFiles/mainwindow.h b/Telegram/SourceFiles/mainwindow.h index 144d6fb0f1..bb6c4f4736 100644 --- a/Telegram/SourceFiles/mainwindow.h +++ b/Telegram/SourceFiles/mainwindow.h @@ -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); diff --git a/Telegram/SourceFiles/mtproto/connection_auto.cpp b/Telegram/SourceFiles/mtproto/connection_auto.cpp index 307d316cc3..7000983d94 100644 --- a/Telegram/SourceFiles/mtproto/connection_auto.cpp +++ b/Telegram/SourceFiles/mtproto/connection_auto.cpp @@ -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())); diff --git a/Telegram/SourceFiles/mtproto/file_download.cpp b/Telegram/SourceFiles/mtproto/file_download.cpp index a7836cec93..caaf3a403a 100644 --- a/Telegram/SourceFiles/mtproto/file_download.cpp +++ b/Telegram/SourceFiles/mtproto/file_download.cpp @@ -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() { diff --git a/Telegram/SourceFiles/mtproto/file_download.h b/Telegram/SourceFiles/mtproto/file_download.h index ed9d15b8eb..7623842883 100644 --- a/Telegram/SourceFiles/mtproto/file_download.h +++ b/Telegram/SourceFiles/mtproto/file_download.h @@ -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 LoaderPointers; LoaderPointers _loaderPointers; diff --git a/Telegram/SourceFiles/platform/linux/linux_libs.cpp b/Telegram/SourceFiles/platform/linux/linux_libs.cpp index 110180a4c2..a9731ce593 100644 --- a/Telegram/SourceFiles/platform/linux/linux_libs.cpp +++ b/Telegram/SourceFiles/platform/linux/linux_libs.cpp @@ -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(); diff --git a/Telegram/SourceFiles/platform/linux/linux_libs.h b/Telegram/SourceFiles/platform/linux/linux_libs.h index 3b542a4070..bc3dce6e91 100644 --- a/Telegram/SourceFiles/platform/linux/linux_libs.h +++ b/Telegram/SourceFiles/platform/linux/linux_libs.h @@ -30,7 +30,7 @@ extern "C" { #ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION #include -#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 diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp index 42e4716eff..d404a4cecc 100644 --- a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp @@ -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(); diff --git a/Telegram/SourceFiles/pspecific_linux.cpp b/Telegram/SourceFiles/pspecific_linux.cpp index 0662398b77..c2e954a1ca 100644 --- a/Telegram/SourceFiles/pspecific_linux.cpp +++ b/Telegram/SourceFiles/pspecific_linux.cpp @@ -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() { diff --git a/Telegram/SourceFiles/pspecific_mac_p.mm b/Telegram/SourceFiles/pspecific_mac_p.mm index 0bf1b6959c..f75a0ee641 100644 --- a/Telegram/SourceFiles/pspecific_mac_p.mm +++ b/Telegram/SourceFiles/pspecific_mac_p.mm @@ -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()) { diff --git a/Telegram/SourceFiles/pspecific_win.cpp b/Telegram/SourceFiles/pspecific_win.cpp index 7e79bfec79..781a4d6d42 100644 --- a/Telegram/SourceFiles/pspecific_win.cpp +++ b/Telegram/SourceFiles/pspecific_win.cpp @@ -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() { diff --git a/Telegram/SourceFiles/pspecific_winrt.cpp b/Telegram/SourceFiles/pspecific_winrt.cpp index 79858d2b7e..b5c5618d23 100644 --- a/Telegram/SourceFiles/pspecific_winrt.cpp +++ b/Telegram/SourceFiles/pspecific_winrt.cpp @@ -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() { diff --git a/Telegram/SourceFiles/settings/settings_advanced_widget.cpp b/Telegram/SourceFiles/settings/settings_advanced_widget.cpp index 3cb43df4d2..86437d3896 100644 --- a/Telegram/SourceFiles/settings/settings_advanced_widget.cpp +++ b/Telegram/SourceFiles/settings/settings_advanced_widget.cpp @@ -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)); diff --git a/Telegram/SourceFiles/settings/settings_advanced_widget.h b/Telegram/SourceFiles/settings/settings_advanced_widget.h index 92eecc0b13..81e8c5e38b 100644 --- a/Telegram/SourceFiles/settings/settings_advanced_widget.h +++ b/Telegram/SourceFiles/settings/settings_advanced_widget.h @@ -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 _manageLocalStorage = { nullptr }; #ifndef TDESKTOP_DISABLE_NETWORK_PROXY ChildWidget _connectionType = { nullptr }; -#endif // TDESKTOP_DISABLE_NETWORK_PROXY +#endif // !TDESKTOP_DISABLE_NETWORK_PROXY ChildWidget _askQuestion = { nullptr }; ChildWidget _telegramFAQ = { nullptr }; ChildWidget _logOut = { nullptr }; diff --git a/Telegram/SourceFiles/settings/settings_general_widget.cpp b/Telegram/SourceFiles/settings/settings_general_widget.cpp index 9c5e66c59f..af6f287987 100644 --- a/Telegram/SourceFiles/settings/settings_general_widget.cpp +++ b/Telegram/SourceFiles/settings/settings_general_widget.cpp @@ -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()) { diff --git a/Telegram/SourceFiles/settings/settings_general_widget.h b/Telegram/SourceFiles/settings/settings_general_widget.h index ca6551fad7..018dba991a 100644 --- a/Telegram/SourceFiles/settings/settings_general_widget.h +++ b/Telegram/SourceFiles/settings/settings_general_widget.h @@ -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 _updateAutomatically = { nullptr }; ChildWidget> _updateRow = { nullptr }; -#endif // TDESKTOP_DISABLE_AUTOUPDATE +#endif // !TDESKTOP_DISABLE_AUTOUPDATE ChildWidget _enableTrayIcon = { nullptr }; ChildWidget _enableTaskbarIcon = { nullptr }; ChildWidget _autoStart = { nullptr }; diff --git a/Telegram/SourceFiles/settings/settings_scale_widget.cpp b/Telegram/SourceFiles/settings/settings_scale_widget.cpp index 4d5f913568..a621e832d0 100644 --- a/Telegram/SourceFiles/settings/settings_scale_widget.cpp +++ b/Telegram/SourceFiles/settings/settings_scale_widget.cpp @@ -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 { diff --git a/Telegram/SourceFiles/sysbuttons.cpp b/Telegram/SourceFiles/sysbuttons.cpp index f7c1529547..8821619ef2 100644 --- a/Telegram/SourceFiles/sysbuttons.cpp +++ b/Telegram/SourceFiles/sysbuttons.cpp @@ -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); diff --git a/Telegram/SourceFiles/title.cpp b/Telegram/SourceFiles/title.cpp index 6ff6f77eef..0a34528a2c 100644 --- a/Telegram/SourceFiles/title.cpp +++ b/Telegram/SourceFiles/title.cpp @@ -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);