Fix whitespace and indentation errors.

See #6672, thanks Sea-n.
This commit is contained in:
John Preston 2020-01-02 14:25:52 +03:00
parent 74733275d8
commit 4eeac7dc18
25 changed files with 148 additions and 146 deletions

View File

@ -53,10 +53,10 @@ void RemoveQuarantineAttribute(NSString *path) {
} }
void RemoveQuarantineFromBundle(NSString *path) { void RemoveQuarantineFromBundle(NSString *path) {
RemoveQuarantineAttribute(path); RemoveQuarantineAttribute(path);
RemoveQuarantineAttribute([path stringByAppendingString:@"/Contents/MacOS/Telegram"]); RemoveQuarantineAttribute([path stringByAppendingString:@"/Contents/MacOS/Telegram"]);
RemoveQuarantineAttribute([path stringByAppendingString:@"/Contents/Helpers/crashpad_handler"]); RemoveQuarantineAttribute([path stringByAppendingString:@"/Contents/Helpers/crashpad_handler"]);
RemoveQuarantineAttribute([path stringByAppendingString:@"/Contents/Frameworks/Updater"]); RemoveQuarantineAttribute([path stringByAppendingString:@"/Contents/Frameworks/Updater"]);
} }
void delFolder() { void delFolder() {

View File

@ -316,12 +316,12 @@ namespace App {
} }
QImage readImage(QByteArray data, QByteArray *format, bool opaque, bool *animated) { QImage readImage(QByteArray data, QByteArray *format, bool opaque, bool *animated) {
QByteArray tmpFormat; QByteArray tmpFormat;
QImage result; QImage result;
QBuffer buffer(&data); QBuffer buffer(&data);
if (!format) { if (!format) {
format = &tmpFormat; format = &tmpFormat;
} }
{ {
QImageReader reader(&buffer, *format); QImageReader reader(&buffer, *format);
#ifndef OS_MAC_OLD #ifndef OS_MAC_OLD

View File

@ -268,25 +268,25 @@ LastCrashedWindow::LastCrashedWindow(
} }
if (_minidumpFull.isEmpty()) { if (_minidumpFull.isEmpty()) {
QString maxDump, maxDumpFull; QString maxDump, maxDumpFull;
QDateTime maxDumpModified, workingModified = QFileInfo(cWorkingDir() + qsl("tdata/working")).lastModified(); QDateTime maxDumpModified, workingModified = QFileInfo(cWorkingDir() + qsl("tdata/working")).lastModified();
QFileInfoList list = QDir(dumpspath).entryInfoList(); QFileInfoList list = QDir(dumpspath).entryInfoList();
for (int32 i = 0, l = list.size(); i < l; ++i) { for (int32 i = 0, l = list.size(); i < l; ++i) {
QString name = list.at(i).fileName(); QString name = list.at(i).fileName();
if (name.endsWith(qstr(".dmp"))) { if (name.endsWith(qstr(".dmp"))) {
QDateTime modified = list.at(i).lastModified(); QDateTime modified = list.at(i).lastModified();
if (maxDump.isEmpty() || qAbs(workingModified.secsTo(modified)) < qAbs(workingModified.secsTo(maxDumpModified))) { if (maxDump.isEmpty() || qAbs(workingModified.secsTo(modified)) < qAbs(workingModified.secsTo(maxDumpModified))) {
maxDump = name; maxDump = name;
maxDumpModified = modified; maxDumpModified = modified;
maxDumpFull = list.at(i).absoluteFilePath(); maxDumpFull = list.at(i).absoluteFilePath();
dumpsize = list.at(i).size(); dumpsize = list.at(i).size();
} }
} }
} }
if (!maxDump.isEmpty() && qAbs(workingModified.secsTo(maxDumpModified)) < 10) { if (!maxDump.isEmpty() && qAbs(workingModified.secsTo(maxDumpModified)) < 10) {
_minidumpName = maxDump; _minidumpName = maxDump;
_minidumpFull = maxDumpFull; _minidumpFull = maxDumpFull;
} }
} }
if (_minidumpName.isEmpty()) { // currently don't accept crash reports without dumps from google libraries if (_minidumpName.isEmpty()) { // currently don't accept crash reports without dumps from google libraries
_sendingState = SendingNoReport; _sendingState = SendingNoReport;
} else { } else {

View File

@ -241,7 +241,7 @@ public:
protected: protected:
void resizeEvent(QResizeEvent *e); void resizeEvent(QResizeEvent *e);
void closeEvent(QCloseEvent *e); void closeEvent(QCloseEvent *e);
private: private:
PreLaunchLog _log; PreLaunchLog _log;

View File

@ -201,13 +201,13 @@ void SignalHandler(int signum) {
if (name) { if (name) {
dump() << "Caught signal " << signum << " (" << name << ") in thread " << uint64(thread) << "\n"; dump() << "Caught signal " << signum << " (" << name << ") in thread " << uint64(thread) << "\n";
} else if (signum == -1) { } else if (signum == -1) {
dump() << "Google Breakpad caught a crash, minidump written in thread " << uint64(thread) << "\n"; dump() << "Google Breakpad caught a crash, minidump written in thread " << uint64(thread) << "\n";
if (BreakpadDumpPath) { if (BreakpadDumpPath) {
dump() << "Minidump: " << BreakpadDumpPath << "\n"; dump() << "Minidump: " << BreakpadDumpPath << "\n";
} else if (BreakpadDumpPathW) { } else if (BreakpadDumpPathW) {
dump() << "Minidump: " << BreakpadDumpPathW << "\n"; dump() << "Minidump: " << BreakpadDumpPathW << "\n";
} }
} else { } else {
dump() << "Caught signal " << signum << " in thread " << uint64(thread) << "\n"; dump() << "Caught signal " << signum << " in thread " << uint64(thread) << "\n";
} }
@ -246,18 +246,18 @@ void SignalHandler(int signum) {
#endif #endif
} }
void *addresses[132] = { 0 }; void *addresses[132] = { 0 };
size_t size = backtrace(addresses, 128); size_t size = backtrace(addresses, 128);
/* overwrite sigaction with caller's address */ /* overwrite sigaction with caller's address */
if (caller) { if (caller) {
for (int i = size; i > 1; --i) { for (int i = size; i > 1; --i) {
addresses[i + 3] = addresses[i]; addresses[i + 3] = addresses[i];
} }
addresses[2] = (void*)0x1; addresses[2] = (void*)0x1;
addresses[3] = caller; addresses[3] = caller;
addresses[4] = (void*)0x1; addresses[4] = (void*)0x1;
} }
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
dump() << "\nBase image addresses:\n"; dump() << "\nBase image addresses:\n";
@ -302,14 +302,14 @@ bool DumpCallback(const google_breakpad::MinidumpDescriptor &md, void *context,
CrashLogged = true; CrashLogged = true;
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
BreakpadDumpPathW = _minidump_id; BreakpadDumpPathW = _minidump_id;
SignalHandler(-1); SignalHandler(-1);
#else // Q_OS_WIN #else // Q_OS_WIN
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
BreakpadDumpPath = _minidump_id; BreakpadDumpPath = _minidump_id;
#else // Q_OS_MAC #else // Q_OS_MAC
BreakpadDumpPath = md.path(); BreakpadDumpPath = md.path();
#endif // else for Q_OS_MAC #endif // else for Q_OS_MAC
SignalHandler(-1, 0, 0); SignalHandler(-1, 0, 0);
#endif // else for Q_OS_WIN #endif // else for Q_OS_WIN
@ -382,12 +382,13 @@ void StartCatching(not_null<Core::Launcher*> launcher) {
crashpad::CrashpadClient crashpad_client; crashpad::CrashpadClient crashpad_client;
std::string handler = (cExeDir() + cExeName() + qsl("/Contents/Helpers/crashpad_handler")).toUtf8().constData(); std::string handler = (cExeDir() + cExeName() + qsl("/Contents/Helpers/crashpad_handler")).toUtf8().constData();
std::string database = QFile::encodeName(dumpspath).constData(); std::string database = QFile::encodeName(dumpspath).constData();
if (crashpad_client.StartHandler(base::FilePath(handler), if (crashpad_client.StartHandler(
base::FilePath(database), base::FilePath(handler),
std::string(), base::FilePath(database),
ProcessAnnotations, std::string(),
std::vector<std::string>(), ProcessAnnotations,
false)) { std::vector<std::string>(),
false)) {
crashpad_client.UseHandler(); crashpad_client.UseHandler();
} }
#endif // else for MAC_USE_BREAKPAD #endif // else for MAC_USE_BREAKPAD
@ -580,20 +581,20 @@ const dump &operator<<(const dump &stream, const char *str) {
} }
const dump &operator<<(const dump &stream, const wchar_t *str) { const dump &operator<<(const dump &stream, const wchar_t *str) {
if (!ReportFile) return stream; if (!ReportFile) return stream;
for (int i = 0, l = wcslen(str); i < l; ++i) { for (int i = 0, l = wcslen(str); i < l; ++i) {
if ( if (
#if !defined(__WCHAR_UNSIGNED__) #if !defined(__WCHAR_UNSIGNED__)
str[i] >= 0 && str[i] >= 0 &&
#endif #endif
str[i] < 128) { str[i] < 128) {
SafeWriteChar(char(str[i])); SafeWriteChar(char(str[i]));
} else { } else {
SafeWriteChar('?'); SafeWriteChar('?');
} }
} }
return stream; return stream;
} }
const dump &operator<<(const dump &stream, int num) { const dump &operator<<(const dump &stream, int num) {

View File

@ -65,7 +65,7 @@ private:
const QString &text, const QString &text,
Types types, Types types,
const QString &about); const QString &about);
void addChatOption( void addChatOption(
not_null<Ui::VerticalLayout*> container, not_null<Ui::VerticalLayout*> container,
const QString &text, const QString &text,
Types types); Types types);

View File

@ -116,7 +116,7 @@ public:
void leaveToChildEvent(QEvent *e, QWidget *child) override; void leaveToChildEvent(QEvent *e, QWidget *child) override;
void dragEnterEvent(QDragEnterEvent *e) override; void dragEnterEvent(QDragEnterEvent *e) override;
void dragLeaveEvent(QDragLeaveEvent *e) override; void dragLeaveEvent(QDragLeaveEvent *e) override;
void dropEvent(QDropEvent *e) override; void dropEvent(QDropEvent *e) override;
bool isItemCompletelyHidden(HistoryItem *item) const; bool isItemCompletelyHidden(HistoryItem *item) const;
void updateTopBarSelection(); void updateTopBarSelection();

View File

@ -96,7 +96,7 @@ int32 documentColorIndex(DocumentData *document, QString &ext) {
? document->mimeString().toLower() ? document->mimeString().toLower()
: QString(); : QString();
if (name.endsWith(qstr(".doc")) || if (name.endsWith(qstr(".doc")) ||
name.endsWith(qstr(".docx")) || name.endsWith(qstr(".docx")) ||
name.endsWith(qstr(".txt")) || name.endsWith(qstr(".txt")) ||
name.endsWith(qstr(".psd")) || name.endsWith(qstr(".psd")) ||
mime.startsWith(qstr("text/"))) { mime.startsWith(qstr("text/"))) {

View File

@ -3492,7 +3492,7 @@ void MainWidget::activate() {
if (!_mainSection) { if (!_mainSection) {
if (_hider) { if (_hider) {
_dialogs->setInnerFocus(); _dialogs->setInnerFocus();
} else if (App::wnd() && !Ui::isLayerShown()) { } else if (App::wnd() && !Ui::isLayerShown()) {
if (!cSendPaths().isEmpty()) { if (!cSendPaths().isEmpty()) {
const auto interpret = qstr("interpret://"); const auto interpret = qstr("interpret://");
const auto path = cSendPaths()[0]; const auto path = cSendPaths()[0];

View File

@ -558,7 +558,7 @@ bool MainWindow::eventFilter(QObject *object, QEvent *e) {
} }
void MainWindow::updateTrayMenu(bool force) { void MainWindow::updateTrayMenu(bool force) {
if (!trayIconMenu || (Platform::IsWindows() && !force)) return; if (!trayIconMenu || (Platform::IsWindows() && !force)) return;
auto iconMenu = trayIconMenu; auto iconMenu = trayIconMenu;
auto actions = iconMenu->actions(); auto actions = iconMenu->actions();
@ -589,12 +589,12 @@ void MainWindow::updateTrayMenu(bool force) {
notificationAction->setText(notificationActionText); notificationAction->setText(notificationActionText);
#ifndef Q_OS_WIN #ifndef Q_OS_WIN
if (trayIcon && trayIcon->contextMenu() != iconMenu) { if (trayIcon && trayIcon->contextMenu() != iconMenu) {
trayIcon->setContextMenu(iconMenu); trayIcon->setContextMenu(iconMenu);
} }
#endif // !Q_OS_WIN #endif // !Q_OS_WIN
psTrayMenuUpdated(); psTrayMenuUpdated();
} }
void MainWindow::onShowAddContact() { void MainWindow::onShowAddContact() {
@ -694,7 +694,7 @@ void MainWindow::showFromTray(QSystemTrayIcon::ActivationReason reason) {
updateTrayMenu(); updateTrayMenu();
updateGlobalMenu(); updateGlobalMenu();
}); });
activate(); activate();
Notify::unreadCounterUpdated(); Notify::unreadCounterUpdated();
} }
} }

View File

@ -96,7 +96,7 @@ class RPCDoneHandlerBare : public RPCAbstractDoneHandler { // done(from, end)
using CallbackType = bool (*)(const mtpPrime *, const mtpPrime *); using CallbackType = bool (*)(const mtpPrime *, const mtpPrime *);
public: public:
RPCDoneHandlerBare(CallbackType onDone) : _onDone(onDone) { RPCDoneHandlerBare(CallbackType onDone) : _onDone(onDone) {
} }
bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override { bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override {
return (*_onDone)(from, end); return (*_onDone)(from, end);
@ -111,7 +111,7 @@ class RPCDoneHandlerBareReq : public RPCAbstractDoneHandler { // done(from, end,
using CallbackType = bool (*)(const mtpPrime *, const mtpPrime *, mtpRequestId); using CallbackType = bool (*)(const mtpPrime *, const mtpPrime *, mtpRequestId);
public: public:
RPCDoneHandlerBareReq(CallbackType onDone) : _onDone(onDone) { RPCDoneHandlerBareReq(CallbackType onDone) : _onDone(onDone) {
} }
bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override { bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override {
return (*_onDone)(from, end, requestId); return (*_onDone)(from, end, requestId);
@ -127,7 +127,7 @@ class RPCDoneHandlerPlain : public RPCAbstractDoneHandler { // done(result)
using CallbackType = TReturn (*)(const TResponse &); using CallbackType = TReturn (*)(const TResponse &);
public: public:
RPCDoneHandlerPlain(CallbackType onDone) : _onDone(onDone) { RPCDoneHandlerPlain(CallbackType onDone) : _onDone(onDone) {
} }
bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override { bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override {
auto response = TResponse(); auto response = TResponse();
@ -148,7 +148,7 @@ class RPCDoneHandlerReq : public RPCAbstractDoneHandler { // done(result, req_id
using CallbackType = TReturn (*)(const TResponse &, mtpRequestId); using CallbackType = TReturn (*)(const TResponse &, mtpRequestId);
public: public:
RPCDoneHandlerReq(CallbackType onDone) : _onDone(onDone) { RPCDoneHandlerReq(CallbackType onDone) : _onDone(onDone) {
} }
bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override { bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override {
auto response = TResponse(); auto response = TResponse();
@ -169,7 +169,7 @@ class RPCDoneHandlerNo : public RPCAbstractDoneHandler { // done()
using CallbackType = TReturn (*)(); using CallbackType = TReturn (*)();
public: public:
RPCDoneHandlerNo(CallbackType onDone) : _onDone(onDone) { RPCDoneHandlerNo(CallbackType onDone) : _onDone(onDone) {
} }
bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override { bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override {
(*_onDone)(); (*_onDone)();
@ -186,7 +186,7 @@ class RPCDoneHandlerNoReq : public RPCAbstractDoneHandler { // done(req_id)
using CallbackType = TReturn (*)(mtpRequestId); using CallbackType = TReturn (*)(mtpRequestId);
public: public:
RPCDoneHandlerNoReq(CallbackType onDone) : _onDone(onDone) { RPCDoneHandlerNoReq(CallbackType onDone) : _onDone(onDone) {
} }
bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override { bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override {
(*_onDone)(requestId); (*_onDone)(requestId);
@ -346,7 +346,7 @@ class RPCDoneHandlerBareOwned : public RPCOwnedDoneHandler { // done(from, end)
using CallbackType = bool (TReceiver::*)(const mtpPrime *, const mtpPrime *); using CallbackType = bool (TReceiver::*)(const mtpPrime *, const mtpPrime *);
public: public:
RPCDoneHandlerBareOwned(TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _onDone(onDone) { RPCDoneHandlerBareOwned(TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _onDone(onDone) {
} }
bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override { bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override {
return _owner return _owner
@ -364,7 +364,7 @@ class RPCDoneHandlerBareOwnedReq : public RPCOwnedDoneHandler { // done(from, en
using CallbackType = bool (TReceiver::*)(const mtpPrime *, const mtpPrime *, mtpRequestId); using CallbackType = bool (TReceiver::*)(const mtpPrime *, const mtpPrime *, mtpRequestId);
public: public:
RPCDoneHandlerBareOwnedReq(TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _onDone(onDone) { RPCDoneHandlerBareOwnedReq(TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _onDone(onDone) {
} }
bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override { bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override {
return _owner return _owner
@ -382,7 +382,7 @@ class RPCDoneHandlerOwned : public RPCOwnedDoneHandler { // done(result)
using CallbackType = TReturn (TReceiver::*)(const TResponse &); using CallbackType = TReturn (TReceiver::*)(const TResponse &);
public: public:
RPCDoneHandlerOwned(TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _onDone(onDone) { RPCDoneHandlerOwned(TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _onDone(onDone) {
} }
bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override { bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override {
auto response = TResponse(); auto response = TResponse();
@ -405,7 +405,7 @@ class RPCDoneHandlerOwnedReq : public RPCOwnedDoneHandler { // done(result, req_
using CallbackType = TReturn (TReceiver::*)(const TResponse &, mtpRequestId); using CallbackType = TReturn (TReceiver::*)(const TResponse &, mtpRequestId);
public: public:
RPCDoneHandlerOwnedReq(TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _onDone(onDone) { RPCDoneHandlerOwnedReq(TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _onDone(onDone) {
} }
bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override { bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override {
auto response = TResponse(); auto response = TResponse();
@ -428,7 +428,7 @@ class RPCDoneHandlerOwnedNo : public RPCOwnedDoneHandler { // done()
using CallbackType = TReturn (TReceiver::*)(); using CallbackType = TReturn (TReceiver::*)();
public: public:
RPCDoneHandlerOwnedNo(TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _onDone(onDone) { RPCDoneHandlerOwnedNo(TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _onDone(onDone) {
} }
bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override { bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override {
if (_owner) (static_cast<TReceiver*>(_owner)->*_onDone)(); if (_owner) (static_cast<TReceiver*>(_owner)->*_onDone)();
@ -445,7 +445,7 @@ class RPCDoneHandlerOwnedNoReq : public RPCOwnedDoneHandler { // done(req_id)
using CallbackType = TReturn (TReceiver::*)(mtpRequestId); using CallbackType = TReturn (TReceiver::*)(mtpRequestId);
public: public:
RPCDoneHandlerOwnedNoReq(TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _onDone(onDone) { RPCDoneHandlerOwnedNoReq(TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _onDone(onDone) {
} }
bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override { bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override {
if (_owner) (static_cast<TReceiver*>(_owner)->*_onDone)(requestId); if (_owner) (static_cast<TReceiver*>(_owner)->*_onDone)(requestId);
@ -462,7 +462,7 @@ class RPCBindedDoneHandlerBareOwned : public RPCOwnedDoneHandler { // done(b, fr
using CallbackType = bool (TReceiver::*)(T, const mtpPrime *, const mtpPrime *); using CallbackType = bool (TReceiver::*)(T, const mtpPrime *, const mtpPrime *);
public: public:
RPCBindedDoneHandlerBareOwned(T b, TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _b(b), _onDone(onDone) { RPCBindedDoneHandlerBareOwned(T b, TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _b(b), _onDone(onDone) {
} }
bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override { bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override {
return _owner return _owner
@ -481,7 +481,7 @@ class RPCBindedDoneHandlerBareOwnedReq : public RPCOwnedDoneHandler { // done(b,
using CallbackType = bool (TReceiver::*)(T, const mtpPrime *, const mtpPrime *, mtpRequestId); using CallbackType = bool (TReceiver::*)(T, const mtpPrime *, const mtpPrime *, mtpRequestId);
public: public:
RPCBindedDoneHandlerBareOwnedReq(T b, TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _b(b), _onDone(onDone) { RPCBindedDoneHandlerBareOwnedReq(T b, TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _b(b), _onDone(onDone) {
} }
bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override { bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override {
return _owner return _owner
@ -500,7 +500,7 @@ class RPCBindedDoneHandlerOwned : public RPCOwnedDoneHandler { // done(b, result
using CallbackType = TReturn (TReceiver::*)(T, const TResponse &); using CallbackType = TReturn (TReceiver::*)(T, const TResponse &);
public: public:
RPCBindedDoneHandlerOwned(T b, TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _onDone(onDone), _b(b) { RPCBindedDoneHandlerOwned(T b, TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _onDone(onDone), _b(b) {
} }
bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override { bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override {
auto response = TResponse(); auto response = TResponse();
@ -524,7 +524,7 @@ class RPCBindedDoneHandlerOwnedReq : public RPCOwnedDoneHandler { // done(b, res
using CallbackType = TReturn (TReceiver::*)(T, const TResponse &, mtpRequestId); using CallbackType = TReturn (TReceiver::*)(T, const TResponse &, mtpRequestId);
public: public:
RPCBindedDoneHandlerOwnedReq(T b, TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _onDone(onDone), _b(b) { RPCBindedDoneHandlerOwnedReq(T b, TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _onDone(onDone), _b(b) {
} }
bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override { bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override {
auto response = TResponse(); auto response = TResponse();
@ -548,7 +548,7 @@ class RPCBindedDoneHandlerOwnedNo : public RPCOwnedDoneHandler { // done(b)
using CallbackType = TReturn (TReceiver::*)(T); using CallbackType = TReturn (TReceiver::*)(T);
public: public:
RPCBindedDoneHandlerOwnedNo(T b, TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _b(b), _onDone(onDone) { RPCBindedDoneHandlerOwnedNo(T b, TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _b(b), _onDone(onDone) {
} }
bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override { bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override {
if (_owner) (static_cast<TReceiver*>(_owner)->*_onDone)(_b); if (_owner) (static_cast<TReceiver*>(_owner)->*_onDone)(_b);
@ -566,7 +566,7 @@ class RPCBindedDoneHandlerOwnedNoReq : public RPCOwnedDoneHandler { // done(b, r
using CallbackType = TReturn (TReceiver::*)(T, mtpRequestId); using CallbackType = TReturn (TReceiver::*)(T, mtpRequestId);
public: public:
RPCBindedDoneHandlerOwnedNoReq(T b, TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _b(b), _onDone(onDone) { RPCBindedDoneHandlerOwnedNoReq(T b, TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _b(b), _onDone(onDone) {
} }
bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override { bool operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override {
if (_owner) (static_cast<TReceiver*>(_owner)->*_onDone)(_b, requestId); if (_owner) (static_cast<TReceiver*>(_owner)->*_onDone)(_b, requestId);

View File

@ -17,19 +17,19 @@ namespace Libs {
namespace { namespace {
bool loadLibrary(QLibrary &lib, const char *name, int version) { bool loadLibrary(QLibrary &lib, const char *name, int version) {
DEBUG_LOG(("Loading '%1' with version %2...").arg(QLatin1String(name)).arg(version)); DEBUG_LOG(("Loading '%1' with version %2...").arg(QLatin1String(name)).arg(version));
lib.setFileNameAndVersion(QLatin1String(name), version); lib.setFileNameAndVersion(QLatin1String(name), version);
if (lib.load()) { if (lib.load()) {
DEBUG_LOG(("Loaded '%1' with version %2!").arg(QLatin1String(name)).arg(version)); DEBUG_LOG(("Loaded '%1' with version %2!").arg(QLatin1String(name)).arg(version));
return true; return true;
} }
lib.setFileNameAndVersion(QLatin1String(name), QString()); lib.setFileNameAndVersion(QLatin1String(name), QString());
if (lib.load()) { if (lib.load()) {
DEBUG_LOG(("Loaded '%1' without version!").arg(QLatin1String(name))); DEBUG_LOG(("Loaded '%1' without version!").arg(QLatin1String(name)));
return true; return true;
} }
LOG(("Could not load '%1' with version %2 :(").arg(QLatin1String(name)).arg(version)); LOG(("Could not load '%1' with version %2 :(").arg(QLatin1String(name)).arg(version));
return false; return false;
} }
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION #ifndef TDESKTOP_DISABLE_GTK_INTEGRATION

View File

@ -258,7 +258,7 @@ inline bool g_type_cit_helper(Object *instance, GType iface_type) {
if (ginstance->g_class && ginstance->g_class->g_type == iface_type) { if (ginstance->g_class && ginstance->g_class->g_type == iface_type) {
return true; return true;
} }
return g_type_check_instance_is_a(ginstance, iface_type); return g_type_check_instance_is_a(ginstance, iface_type);
} }
typedef gint (*f_gtk_dialog_run)(GtkDialog *dialog); typedef gint (*f_gtk_dialog_run)(GtkDialog *dialog);

View File

@ -188,12 +188,12 @@ static gboolean _trayIconCheck(gpointer/* pIn*/) {
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION #endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
quint32 djbStringHash(QString string) { quint32 djbStringHash(QString string) {
quint32 hash = 5381; quint32 hash = 5381;
QByteArray chars = string.toLatin1(); QByteArray chars = string.toLatin1();
for(int i = 0; i < chars.length(); i++){ for(int i = 0; i < chars.length(); i++){
hash = (hash << 5) + hash + chars[i]; hash = (hash << 5) + hash + chars[i];
} }
return hash; return hash;
} }
} // namespace } // namespace
@ -556,7 +556,7 @@ void MainWindow::psFirstShow() {
"telegramdesktop.desktop", "telegramdesktop.desktop",
"Telegram.desktop" "Telegram.desktop"
}; };
for (auto it = possibleDesktopFiles.begin(); it != possibleDesktopFiles.end(); it++) { for (auto it = possibleDesktopFiles.begin(); it != possibleDesktopFiles.end(); it++) {
if (!QStandardPaths::locate(QStandardPaths::ApplicationsLocation, *it).isEmpty()) { if (!QStandardPaths::locate(QStandardPaths::ApplicationsLocation, *it).isEmpty()) {
_desktopFile = *it; _desktopFile = *it;

View File

@ -39,13 +39,13 @@ using Platform::File::internal::EscapeShell;
namespace { namespace {
bool RunShellCommand(const QByteArray &command) { bool RunShellCommand(const QByteArray &command) {
auto result = system(command.constData()); auto result = system(command.constData());
if (result) { if (result) {
DEBUG_LOG(("App Error: command failed, code: %1, command (in utf8): %2").arg(result).arg(command.constData())); DEBUG_LOG(("App Error: command failed, code: %1, command (in utf8): %2").arg(result).arg(command.constData()));
return false; return false;
} }
DEBUG_LOG(("App Info: command succeeded, command (in utf8): %1").arg(command.constData())); DEBUG_LOG(("App Info: command succeeded, command (in utf8): %1").arg(command.constData()));
return true; return true;
} }
void FallbackFontConfig() { void FallbackFontConfig() {

View File

@ -32,10 +32,10 @@ inline void IgnoreApplicationActivationRightNow() {
} // namespace Platform } // namespace Platform
inline QString psServerPrefix() { inline QString psServerPrefix() {
return qsl("/tmp/"); return qsl("/tmp/");
} }
inline void psCheckLocalSocket(const QString &serverName) { inline void psCheckLocalSocket(const QString &serverName) {
QFile address(serverName); QFile address(serverName);
if (address.exists()) { if (address.exists()) {
address.remove(); address.remove();
} }

View File

@ -1163,7 +1163,7 @@ void AppendEmojiPacks(std::vector<PickerScrubberItem> &to) {
return item; return item;
} else if (isType(kTypeScrubber)) { } else if (isType(kTypeScrubber)) {
const auto isSticker = ([dictionaryItem[@"cmd"] intValue] const auto isSticker = ([dictionaryItem[@"cmd"] intValue]
== kCommandScrubberStickers); == kCommandScrubberStickers);
const auto type = isSticker const auto type = isSticker
? ScrubberItemType::Sticker ? ScrubberItemType::Sticker
: ScrubberItemType::Emoji; : ScrubberItemType::Emoji;

View File

@ -33,13 +33,13 @@ inline void finish() {
inline QString psServerPrefix() { inline QString psServerPrefix() {
#ifndef OS_MAC_STORE #ifndef OS_MAC_STORE
return qsl("/tmp/"); return qsl("/tmp/");
#else // OS_MAC_STORE #else // OS_MAC_STORE
return objc_documentsPath(); return objc_documentsPath();
#endif // OS_MAC_STORE #endif // OS_MAC_STORE
} }
inline void psCheckLocalSocket(const QString &serverName) { inline void psCheckLocalSocket(const QString &serverName) {
QFile address(serverName); QFile address(serverName);
if (address.exists()) { if (address.exists()) {
address.remove(); address.remove();
} }

View File

@ -58,9 +58,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#endif #endif
#ifndef WM_NCPOINTERUPDATE #ifndef WM_NCPOINTERUPDATE
#define WM_NCPOINTERUPDATE 0x0241 #define WM_NCPOINTERUPDATE 0x0241
#define WM_NCPOINTERDOWN 0x0242 #define WM_NCPOINTERDOWN 0x0242
#define WM_NCPOINTERUP 0x0243 #define WM_NCPOINTERUP 0x0243
#endif #endif
using namespace Microsoft::WRL; using namespace Microsoft::WRL;
@ -70,22 +70,23 @@ using namespace Windows::Foundation;
using namespace Platform; using namespace Platform;
namespace { namespace {
QStringList _initLogs;
bool themeInited = false; QStringList _initLogs;
bool finished = true;
QMargins simpleMargins, margins;
HICON bigIcon = 0, smallIcon = 0, overlayIcon = 0;
class _PsInitializer { bool themeInited = false;
public: bool finished = true;
_PsInitializer() { QMargins simpleMargins, margins;
Dlls::start(); HICON bigIcon = 0, smallIcon = 0, overlayIcon = 0;
}
};
_PsInitializer _psInitializer;
class _PsInitializer {
public:
_PsInitializer() {
Dlls::start();
}
}; };
_PsInitializer _psInitializer;
} // namespace
void psDeleteDir(const QString &dir) { void psDeleteDir(const QString &dir) {
std::wstring wDir = QDir::toNativeSeparators(dir).toStdWString(); std::wstring wDir = QDir::toNativeSeparators(dir).toStdWString();
@ -131,11 +132,11 @@ namespace {
} }
QStringList psInitLogs() { QStringList psInitLogs() {
return _initLogs; return _initLogs;
} }
void psClearInitLogs() { void psClearInitLogs() {
_initLogs = QStringList(); _initLogs = QStringList();
} }
void psActivateProcess(uint64 pid) { void psActivateProcess(uint64 pid) {

View File

@ -197,12 +197,12 @@ autoDownloadLimitButton: SettingsButton(settingsButton) {
padding: margins(22px, 10px, 22px, 0px); padding: margins(22px, 10px, 22px, 0px);
} }
settingsAudioVolumeSlider: MediaSlider(defaultContinuousSlider) { settingsAudioVolumeSlider: MediaSlider(defaultContinuousSlider) {
seekSize: size(15px, 15px); seekSize: size(15px, 15px);
} }
settingsAudioVolumeSliderPadding: margins(23px, 5px, 20px, 10px); settingsAudioVolumeSliderPadding: margins(23px, 5px, 20px, 10px);
settingsAudioVolumeLabel: LabelSimple(defaultLabelSimple) { settingsAudioVolumeLabel: LabelSimple(defaultLabelSimple) {
font: boxTextFont; font: boxTextFont;
textFg: windowBoldFg; textFg: windowBoldFg;
} }
settingsAudioVolumeLabelPadding: margins(22px, 11px, 22px, 11px); settingsAudioVolumeLabelPadding: margins(22px, 11px, 22px, 11px);
settingsLevelMeterPadding: margins(23px, 10px, 20px, 10px); settingsLevelMeterPadding: margins(23px, 10px, 20px, 10px);

@ -1 +1 @@
Subproject commit ee55a0b69f65622fe25487745e5537ebcffd8372 Subproject commit d14ae77ad5ed27ca6ddbc9579c0c5e0afa18ffca

@ -1 +1 @@
Subproject commit 78690f858fc48b1bc824fd52a7d90a1080b0610e Subproject commit baae6cdd9ba5216732222e7dec9a76b9ea3a7c83

@ -1 +1 @@
Subproject commit bd850834fc9ba6c62784306b65506ab19d64ab89 Subproject commit 2888aabf28bf9ca89f3d6d67a523bc5f2ce802ce

@ -1 +1 @@
Subproject commit 765e525458843ffb893586441b885ac5ba143e51 Subproject commit d30d361609d4b76d3a55b1329642caee30b82264

2
cmake

@ -1 +1 @@
Subproject commit 449066752048a9b5e64f8b9bbad7af8b0e53e8b2 Subproject commit b087501d66ea13395acd91397b3ab6a3a77c41b8