From 196b412d1fc7cfcd953ceab3dddc6dfa86f27aea Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 16 Jun 2014 13:31:10 +0400 Subject: [PATCH] half warnings fixed, half disabled for mac build, custom openssl build used, fixed notify activate, bold fonts etc --- Telegram/SourceFiles/app.cpp | 17 +- Telegram/SourceFiles/app.h | 2 + Telegram/SourceFiles/application.cpp | 2 +- Telegram/SourceFiles/boxes/aboutbox.cpp | 6 +- Telegram/SourceFiles/boxes/addcontactbox.cpp | 24 +-- .../SourceFiles/boxes/addparticipantbox.cpp | 10 +- Telegram/SourceFiles/boxes/confirmbox.cpp | 4 +- Telegram/SourceFiles/boxes/connectionbox.cpp | 14 +- Telegram/SourceFiles/boxes/contactsbox.cpp | 4 +- .../SourceFiles/boxes/downloadpathbox.cpp | 4 +- Telegram/SourceFiles/boxes/emojibox.cpp | 7 +- Telegram/SourceFiles/boxes/newgroupbox.cpp | 8 +- Telegram/SourceFiles/boxes/photocropbox.cpp | 4 +- Telegram/SourceFiles/dialogswidget.cpp | 20 ++- Telegram/SourceFiles/dropdown.cpp | 14 +- Telegram/SourceFiles/fileuploader.cpp | 4 +- Telegram/SourceFiles/gui/countryinput.cpp | 20 +-- Telegram/SourceFiles/gui/emoji_config.cpp | 2 +- Telegram/SourceFiles/gui/flatbutton.cpp | 8 +- Telegram/SourceFiles/gui/flatcheckbox.cpp | 6 +- Telegram/SourceFiles/gui/flatinput.cpp | 6 +- Telegram/SourceFiles/gui/flatlabel.cpp | 2 +- Telegram/SourceFiles/gui/flattextarea.cpp | 15 +- Telegram/SourceFiles/gui/images.cpp | 4 +- Telegram/SourceFiles/gui/scrollarea.cpp | 20 ++- Telegram/SourceFiles/gui/style_core.cpp | 2 +- Telegram/SourceFiles/gui/text.cpp | 26 +-- Telegram/SourceFiles/gui/text.h | 6 +- Telegram/SourceFiles/history.cpp | 153 ++++++++++++++---- Telegram/SourceFiles/history.h | 12 +- Telegram/SourceFiles/historywidget.cpp | 138 +++++++++++----- Telegram/SourceFiles/intro/intro.cpp | 4 +- Telegram/SourceFiles/intro/introcode.cpp | 4 +- Telegram/SourceFiles/intro/introphone.cpp | 9 +- Telegram/SourceFiles/intro/introsignup.cpp | 3 +- Telegram/SourceFiles/langloaderplain.cpp | 2 +- Telegram/SourceFiles/layerwidget.cpp | 44 ++++- Telegram/SourceFiles/localimageloader.cpp | 7 +- Telegram/SourceFiles/localimageloader.h | 8 +- Telegram/SourceFiles/mainwidget.cpp | 16 +- Telegram/SourceFiles/mainwidget.h | 2 +- Telegram/SourceFiles/mtproto/mtp.cpp | 2 +- .../SourceFiles/mtproto/mtpConnection.cpp | 40 ++--- Telegram/SourceFiles/mtproto/mtpDC.cpp | 4 +- .../SourceFiles/mtproto/mtpFileLoader.cpp | 16 +- Telegram/SourceFiles/mtproto/mtpRPC.h | 8 +- Telegram/SourceFiles/mtproto/mtpSession.cpp | 6 +- Telegram/SourceFiles/mtproto/mtpSession.h | 6 +- Telegram/SourceFiles/profilewidget.cpp | 9 +- Telegram/SourceFiles/pspecific_mac.cpp | 4 +- Telegram/SourceFiles/pspecific_mac_p.mm | 7 +- Telegram/SourceFiles/settings.cpp | 3 + Telegram/SourceFiles/settings.h | 2 + Telegram/SourceFiles/settingswidget.cpp | 8 +- Telegram/SourceFiles/title.cpp | 11 +- Telegram/SourceFiles/types.cpp | 9 +- Telegram/SourceFiles/window.cpp | 10 +- Telegram/Telegram.xcodeproj/project.pbxproj | 62 ++++++- 58 files changed, 568 insertions(+), 302 deletions(-) diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index 2a240a0c9..e0e0c0bd7 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -156,6 +156,13 @@ namespace App { return (peer_id & 0x100000000L) ? MTP_peerChat(MTP_int(int32(peer_id & 0xFFFFFFFFL))) : MTP_peerUser(MTP_int(int32(peer_id & 0xFFFFFFFFL))); } + int32 userFromPeer(const PeerId &peer_id) { + return (peer_id & 0x100000000L) ? 0 : int32(peer_id & 0xFFFFFFFFL); + } + int32 chatFromPeer(const PeerId &peer_id) { + return (peer_id & 0x100000000L) ? int32(peer_id & 0xFFFFFFFFL) : 0; + } + int32 onlineWillChangeIn(int32 online, int32 now) { if (online <= 0) return 86400; if (online > now) { @@ -314,7 +321,7 @@ namespace App { case mtpc_userStatusOnline: data->onlineTill = status->c_userStatusOnline().vexpires.v; break; } - if (data->contact < 0 && !data->phone.isEmpty() && data->id != MTP::authedId()) { + if (data->contact < 0 && !data->phone.isEmpty() && (data->id & 0xFFFFFFFF) != MTP::authedId()) { data->contact = 0; } if (data->contact > 0 && !wasContact) { @@ -605,7 +612,7 @@ namespace App { } if (user->contact > 0) { if (!wasContact) { - App::main()->addNewContact(user->id & 0xFFFFFFFF, false); + App::main()->addNewContact(App::userFromPeer(user->id), false); user->input = MTP_inputPeerContact(userId); user->inputUser = MTP_inputUserContact(userId); } @@ -614,7 +621,7 @@ namespace App { user->input = MTP_inputPeerForeign(userId, MTP_long(user->access)); user->inputUser = MTP_inputUserForeign(userId, MTP_long(user->access)); } - if (user->contact < 0 && !user->phone.isEmpty() && user->id != MTP::authedId()) { + if (user->contact < 0 && !user->phone.isEmpty() && App::userFromPeer(user->id) != MTP::authedId()) { user->contact = 0; } if (wasContact) { @@ -1608,7 +1615,7 @@ namespace App { continue; } uint32 dataLen = *(const uint32*)decrypted.constData(); - if (dataLen > decrypted.size() || dataLen <= fullDataLen - 16 || dataLen < 4) { + if (dataLen > uint32(decrypted.size()) || dataLen <= fullDataLen - 16 || dataLen < 4) { LOG(("App Error: bad decrypted part size: %1, fullDataLen: %2, decrypted size: %3").arg(dataLen).arg(fullDataLen).arg(decrypted.size())); continue; } @@ -1774,7 +1781,7 @@ namespace App { quint32 count; stream >> count; - for (int32 i = 0; i < count; ++i) { + for (uint32 i = 0; i < count; ++i) { readOneMuted(stream); } } diff --git a/Telegram/SourceFiles/app.h b/Telegram/SourceFiles/app.h index ee74e191e..8a20785ac 100644 --- a/Telegram/SourceFiles/app.h +++ b/Telegram/SourceFiles/app.h @@ -60,6 +60,8 @@ namespace App { return peerFromUser(user_id.v); } MTPpeer peerToMTP(const PeerId &peer_id); + int32 userFromPeer(const PeerId &peer_id); + int32 chatFromPeer(const PeerId &peer_id); int32 onlineWillChangeIn(int32 onlineOnServer, int32 nowOnServer); QString onlineText(int32 onlineOnServer, int32 nowOnServer); diff --git a/Telegram/SourceFiles/application.cpp b/Telegram/SourceFiles/application.cpp index f902fc4cb..f9e54fa3c 100644 --- a/Telegram/SourceFiles/application.cpp +++ b/Telegram/SourceFiles/application.cpp @@ -417,7 +417,7 @@ void Application::startUpdateCheck(bool forceWait) { } } } - if (cManyInstance() && !cDebug() || cPlatform() == dbipMac) return; // only main instance is updating + if ((cManyInstance() && !cDebug()) || cPlatform() == dbipMac) return; // only main instance is updating if (sendRequest) { QNetworkRequest checkVersion(QUrl(qsl("http://tdesktop.com/win/tupdates/current"))); diff --git a/Telegram/SourceFiles/boxes/aboutbox.cpp b/Telegram/SourceFiles/boxes/aboutbox.cpp index 55d438b9e..188e8bf15 100644 --- a/Telegram/SourceFiles/boxes/aboutbox.cpp +++ b/Telegram/SourceFiles/boxes/aboutbox.cpp @@ -22,10 +22,10 @@ Copyright (c) 2014 John Preston, https://tdesktop.com #include "mainwidget.h" #include "window.h" -AboutBox::AboutBox() : _hiding(false), -_text(this, lang(lng_about_text), st::aboutLabel, st::aboutTextStyle), +AboutBox::AboutBox() : _done(this, lang(lng_about_done), st::aboutCloseButton), -a_opacity(0, 1) { +_text(this, lang(lng_about_text), st::aboutLabel, st::aboutTextStyle), +_hiding(false), a_opacity(0, 1) { _width = st::aboutWidth; _height = st::aboutHeight; diff --git a/Telegram/SourceFiles/boxes/addcontactbox.cpp b/Telegram/SourceFiles/boxes/addcontactbox.cpp index 566b7428e..2ac12c875 100644 --- a/Telegram/SourceFiles/boxes/addcontactbox.cpp +++ b/Telegram/SourceFiles/boxes/addcontactbox.cpp @@ -24,14 +24,14 @@ Copyright (c) 2014 John Preston, https://tdesktop.com #include "window.h" AddContactBox::AddContactBox(QString fname, QString lname, QString phone) : - _hiding(false), _peer(0), _addRequest(0), _contactId(0), - _firstInput(this, st::inpAddContact, lang(lng_signup_firstname), fname), - _lastInput(this, st::inpAddContact, lang(lng_signup_lastname), lname), - _phoneInput(this, st::inpAddContact, lang(lng_contact_phone), phone.isEmpty() ? phone : App::formatPhone(phone)), + _peer(0), _addButton(this, lang(lng_add_contact), st::btnSelectDone), _retryButton(this, lang(lng_try_other_contact), st::btnSelectDone), _cancelButton(this, lang(lng_cancel), st::btnSelectCancel), - a_opacity(0, 1) { + _firstInput(this, st::inpAddContact, lang(lng_signup_firstname), fname), + _lastInput(this, st::inpAddContact, lang(lng_signup_lastname), lname), + _phoneInput(this, st::inpAddContact, lang(lng_contact_phone), phone.isEmpty() ? phone : App::formatPhone(phone)), + _contactId(0), _addRequest(0), a_opacity(0, 1), _hiding(false) { if (!phone.isEmpty()) { _phoneInput.setDisabled(true); @@ -41,14 +41,14 @@ AddContactBox::AddContactBox(QString fname, QString lname, QString phone) : } AddContactBox::AddContactBox(PeerData *peer) : - _hiding(false), _peer(peer), _addRequest(0), _contactId(0), - _firstInput(this, st::inpAddContact, lang(peer->chat ? lng_dlg_new_group_name : lng_signup_firstname), peer->chat ? peer->name : peer->asUser()->firstName), - _lastInput(this, st::inpAddContact, lang(lng_signup_lastname), peer->chat ? QString() : peer->asUser()->lastName), - _phoneInput(this, st::inpAddContact, lang(lng_contact_phone)), + _peer(peer), _addButton(this, lang(lng_settings_save), st::btnSelectDone), _retryButton(this, lang(lng_try_other_contact), st::btnSelectDone), _cancelButton(this, lang(lng_cancel), st::btnSelectCancel), - a_opacity(0, 1) { + _firstInput(this, st::inpAddContact, lang(peer->chat ? lng_dlg_new_group_name : lng_signup_firstname), peer->chat ? peer->name : peer->asUser()->firstName), + _lastInput(this, st::inpAddContact, lang(lng_signup_lastname), peer->chat ? QString() : peer->asUser()->lastName), + _phoneInput(this, st::inpAddContact, lang(lng_contact_phone)), + _contactId(0), _addRequest(0), a_opacity(0, 1), _hiding(false) { initBox(); } @@ -204,7 +204,7 @@ void AddContactBox::animStep(float64 dt) { _cache = QPixmap(); if (!_hiding) { showAll(); - if (_firstInput.text().isEmpty() && _lastInput.text().isEmpty() || _phoneInput.isHidden() || !_phoneInput.isEnabled()) { + if ((_firstInput.text().isEmpty() && _lastInput.text().isEmpty()) || _phoneInput.isHidden() || !_phoneInput.isEnabled()) { _firstInput.setFocus(); } else { _phoneInput.setFocus(); @@ -238,7 +238,7 @@ void AddContactBox::onSend() { _addRequest = MTP::send(MTPaccount_UpdateProfile(MTP_string(firstName), MTP_string(lastName)), rpcDone(&AddContactBox::onSaveSelfDone), rpcFail(&AddContactBox::onSaveSelfFail)); } else if (_peer) { if (_peer->chat) { - _addRequest = MTP::send(MTPmessages_EditChatTitle(MTP_int(int32(_peer->id & 0xFFFFFFFF)), MTP_string(firstName)), rpcDone(&AddContactBox::onSaveChatDone), rpcFail(&AddContactBox::onSaveFail)); + _addRequest = MTP::send(MTPmessages_EditChatTitle(MTP_int(App::chatFromPeer(_peer->id)), MTP_string(firstName)), rpcDone(&AddContactBox::onSaveChatDone), rpcFail(&AddContactBox::onSaveFail)); } else { _contactId = MTP::nonce(); QVector v(1, MTP_inputPhoneContact(MTP_long(_contactId), MTP_string(_peer->asUser()->phone), MTP_string(firstName), MTP_string(lastName))); diff --git a/Telegram/SourceFiles/boxes/addparticipantbox.cpp b/Telegram/SourceFiles/boxes/addparticipantbox.cpp index 9a493f7ef..3253f76f0 100644 --- a/Telegram/SourceFiles/boxes/addparticipantbox.cpp +++ b/Telegram/SourceFiles/boxes/addparticipantbox.cpp @@ -22,8 +22,8 @@ Copyright (c) 2014 John Preston, https://tdesktop.com #include "mainwidget.h" #include "window.h" -AddParticipantInner::AddParticipantInner(ChatData *chat) : _chat(chat), _selCount(0), - _contacts(&App::main()->contactsList()), _sel(0), _filteredSel(-1), _mouseSel(false) { +AddParticipantInner::AddParticipantInner(ChatData *chat) : _chat(chat), + _contacts(&App::main()->contactsList()), _sel(0), _filteredSel(-1), _mouseSel(false), _selCount(0) { _filter = qsl("a"); updateFilter(); @@ -507,12 +507,12 @@ void AddParticipantInner::selectSkipPage(int32 h, int32 dir) { selectSkip(points * dir); } -AddParticipantBox::AddParticipantBox(ChatData *chat) : _inner(chat), _hiding(false), - _scroll(this, st::newGroupScroll), +AddParticipantBox::AddParticipantBox(ChatData *chat) : + _scroll(this, st::newGroupScroll), _inner(chat), _filter(this, st::contactsFilter, lang(lng_participant_filter)), _invite(this, lang(lng_participant_invite), st::btnSelectDone), _cancel(this, lang(lng_cancel), st::btnSelectCancel), - a_opacity(0, 1), af_opacity(anim::linear) { + _hiding(false), a_opacity(0, 1), af_opacity(anim::linear) { _width = st::participantWidth; _height = App::wnd()->height() - st::boxPadding.top() - st::boxPadding.bottom(); diff --git a/Telegram/SourceFiles/boxes/confirmbox.cpp b/Telegram/SourceFiles/boxes/confirmbox.cpp index 0c6f86fcf..e1dfdf6ef 100644 --- a/Telegram/SourceFiles/boxes/confirmbox.cpp +++ b/Telegram/SourceFiles/boxes/confirmbox.cpp @@ -22,10 +22,10 @@ Copyright (c) 2014 John Preston, https://tdesktop.com #include "mainwidget.h" #include "window.h" -ConfirmBox::ConfirmBox(QString text, QString doneText, QString cancelText) : _hiding(false), _text(100), +ConfirmBox::ConfirmBox(QString text, QString doneText, QString cancelText) : _confirm(this, doneText.isEmpty() ? lang(lng_continue) : doneText, st::btnSelectDone), _cancel(this, cancelText.isEmpty() ? lang(lng_cancel) : cancelText, st::btnSelectCancel), - a_opacity(0, 1), af_opacity(anim::linear) { + _text(100), _hiding(false), a_opacity(0, 1), af_opacity(anim::linear) { _text.setText(st::boxFont, text, _textPlainOptions); diff --git a/Telegram/SourceFiles/boxes/connectionbox.cpp b/Telegram/SourceFiles/boxes/connectionbox.cpp index e975e2678..047270462 100644 --- a/Telegram/SourceFiles/boxes/connectionbox.cpp +++ b/Telegram/SourceFiles/boxes/connectionbox.cpp @@ -22,17 +22,17 @@ Copyright (c) 2014 John Preston, https://tdesktop.com #include "mainwidget.h" #include "window.h" -ConnectionBox::ConnectionBox() : _hiding(false), - _hostInput(this, st::inpConnectionHost, lang(lng_connection_host_ph), cConnectionProxy().host), - _portInput(this, st::inpConnectionPort, lang(lng_connection_port_ph), QString::number(cConnectionProxy().port)), - _userInput(this, st::inpConnectionUser, lang(lng_connection_user_ph), cConnectionProxy().user), +ConnectionBox::ConnectionBox() : + _saveButton(this, lang(lng_connection_save), st::btnSelectDone), + _cancelButton(this, lang(lng_cancel), st::btnSelectCancel), + _hostInput(this, st::inpConnectionHost, lang(lng_connection_host_ph), cConnectionProxy().host), + _portInput(this, st::inpConnectionPort, lang(lng_connection_port_ph), QString::number(cConnectionProxy().port)), + _userInput(this, st::inpConnectionUser, lang(lng_connection_user_ph), cConnectionProxy().user), _passwordInput(this, st::inpConnectionPassword, lang(lng_connection_password_ph), cConnectionProxy().password), - _saveButton(this, lang(lng_connection_save), st::btnSelectDone), - _cancelButton(this, lang(lng_cancel), st::btnSelectCancel), _autoRadio(this, qsl("conn_type"), dbictAuto, lang(lng_connection_auto_rb), (cConnectionType() == dbictAuto)), _httpProxyRadio(this, qsl("conn_type"), dbictHttpProxy, lang(lng_connection_http_proxy_rb), (cConnectionType() == dbictHttpProxy)), _tcpProxyRadio(this, qsl("conn_type"), dbictTcpProxy, lang(lng_connection_tcp_proxy_rb), (cConnectionType() == dbictTcpProxy)), - a_opacity(0, 1) { + a_opacity(0, 1), _hiding(false) { _width = st::addContactWidth; diff --git a/Telegram/SourceFiles/boxes/contactsbox.cpp b/Telegram/SourceFiles/boxes/contactsbox.cpp index 07ce2c443..4f4e5c9a4 100644 --- a/Telegram/SourceFiles/boxes/contactsbox.cpp +++ b/Telegram/SourceFiles/boxes/contactsbox.cpp @@ -395,11 +395,11 @@ void ContactsInner::selectSkipPage(int32 h, int32 dir) { selectSkip(points * dir); } -ContactsBox::ContactsBox() : _inner(), _hiding(false), _scroll(this, st::newGroupScroll), +ContactsBox::ContactsBox() : _scroll(this, st::newGroupScroll), _inner(), _addContact(this, lang(lng_add_contact_button), st::contactsAdd), _filter(this, st::contactsFilter, lang(lng_participant_filter)), _close(this, lang(lng_contacts_done), st::contactsClose), - a_opacity(0, 1) { + _hiding(false), a_opacity(0, 1) { _width = st::participantWidth; _height = App::wnd()->height() - st::boxPadding.top() - st::boxPadding.bottom(); diff --git a/Telegram/SourceFiles/boxes/downloadpathbox.cpp b/Telegram/SourceFiles/boxes/downloadpathbox.cpp index 0283d4e41..0b5d76c19 100644 --- a/Telegram/SourceFiles/boxes/downloadpathbox.cpp +++ b/Telegram/SourceFiles/boxes/downloadpathbox.cpp @@ -21,14 +21,14 @@ Copyright (c) 2014 John Preston, https://tdesktop.com #include "downloadpathbox.h" #include "gui/filedialog.h" -DownloadPathBox::DownloadPathBox() : _hiding(false), +DownloadPathBox::DownloadPathBox() : _path(cDownloadPath()), _tempRadio(this, qsl("dir_type"), 0, lang(lng_download_path_temp_radio), _path.isEmpty()), _dirRadio(this, qsl("dir_type"), 1, lang(lng_download_path_dir_radio), !_path.isEmpty()), _dirInput(this, st::inpDownloadDir, QString(), QDir::toNativeSeparators(_path)), _saveButton(this, lang(lng_connection_save), st::btnSelectDone), _cancelButton(this, lang(lng_cancel), st::btnSelectCancel), - a_opacity(0, 1) { + a_opacity(0, 1), _hiding(false) { _width = st::addContactWidth; diff --git a/Telegram/SourceFiles/boxes/emojibox.cpp b/Telegram/SourceFiles/boxes/emojibox.cpp index 133d79ddc..27e262971 100644 --- a/Telegram/SourceFiles/boxes/emojibox.cpp +++ b/Telegram/SourceFiles/boxes/emojibox.cpp @@ -65,9 +65,8 @@ namespace { const uint32 replacesCount = sizeof(replaces) / sizeof(EmojiReplace), replacesInRow = 8; } -EmojiBox::EmojiBox() : _hiding(false), - _done(this, lang(lng_about_done), st::aboutCloseButton), - a_opacity(0, 1) { +EmojiBox::EmojiBox() : _done(this, lang(lng_about_done), st::aboutCloseButton), + _hiding(false), a_opacity(0, 1) { fillBlocks(); @@ -96,7 +95,7 @@ EmojiBox::EmojiBox() : _hiding(false), void EmojiBox::fillBlocks() { BlockRow currentRow; currentRow.reserve(replacesInRow); - for (int32 i = 0; i < replacesCount; ++i) { + for (uint32 i = 0; i < replacesCount; ++i) { Block block(getEmoji(replaces[i].code), QString::fromUtf8(replaces[i].replace)); currentRow.push_back(block); if (currentRow.size() == replacesInRow) { diff --git a/Telegram/SourceFiles/boxes/newgroupbox.cpp b/Telegram/SourceFiles/boxes/newgroupbox.cpp index 5fa27274d..3030a59e4 100644 --- a/Telegram/SourceFiles/boxes/newgroupbox.cpp +++ b/Telegram/SourceFiles/boxes/newgroupbox.cpp @@ -438,11 +438,11 @@ QVector NewGroupInner::selectedInputs() { return result; } -NewGroupBox::NewGroupBox() : _inner(), _hiding(false), _scroll(this, st::newGroupScroll), +NewGroupBox::NewGroupBox() : _scroll(this, st::newGroupScroll), _inner(), _filter(this, st::contactsFilter, lang(lng_participant_filter)), _next(this, lang(lng_create_group_next), st::btnSelectDone), _cancel(this, lang(lng_cancel), st::btnSelectCancel), - a_opacity(0, 1) { + _hiding(false), a_opacity(0, 1) { _width = st::participantWidth; _height = App::wnd()->height() - st::boxPadding.top() - st::boxPadding.bottom(); @@ -596,11 +596,11 @@ NewGroupBox::~NewGroupBox() { } CreateGroupBox::CreateGroupBox(const MTPVector &users) : _users(users), - _hiding(false), _createRequestId(0), + _createRequestId(0), _name(this, st::newGroupName, lang(lng_dlg_new_group_name)), _create(this, lang(lng_dlg_create_group), st::btnSelectDone), _cancel(this, lang(lng_cancel), st::btnSelectCancel), - a_opacity(0, 1) { + _hiding(false), a_opacity(0, 1) { _width = st::addContactWidth; _height = st::addContactTitleHeight + st::addContactPadding.top() + _name.height() + st::addContactPadding.bottom() + _create.height(); diff --git a/Telegram/SourceFiles/boxes/photocropbox.cpp b/Telegram/SourceFiles/boxes/photocropbox.cpp index 2f0b173e2..8729aabd6 100644 --- a/Telegram/SourceFiles/boxes/photocropbox.cpp +++ b/Telegram/SourceFiles/boxes/photocropbox.cpp @@ -25,10 +25,10 @@ Copyright (c) 2014 John Preston, https://tdesktop.com #include "photocropbox.h" #include "fileuploader.h" -PhotoCropBox::PhotoCropBox(const QImage &img, const PeerId &peer) : _img(img), _downState(0), _peerId(peer), +PhotoCropBox::PhotoCropBox(const QImage &img, const PeerId &peer) : _downState(0), _sendButton(this, lang(lng_settings_save), st::btnSelectDone), _cancelButton(this, lang(lng_cancel), st::btnSelectCancel), - a_opacity(0, 1) { + _img(img), _peerId(peer), a_opacity(0, 1) { connect(&_sendButton, SIGNAL(clicked()), this, SLOT(onSend())); connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onCancel())); diff --git a/Telegram/SourceFiles/dialogswidget.cpp b/Telegram/SourceFiles/dialogswidget.cpp index 46e45ab3d..c7f605f8c 100644 --- a/Telegram/SourceFiles/dialogswidget.cpp +++ b/Telegram/SourceFiles/dialogswidget.cpp @@ -76,7 +76,7 @@ void DialogsListWidget::paintEvent(QPaintEvent *e) { } void DialogsListWidget::activate() { - if (filter.isEmpty() && !sel || !filter.isEmpty() && (filteredSel < 0 || filteredSel >= filtered.size())) { + if ((filter.isEmpty() && !sel) || (!filter.isEmpty() && (filteredSel < 0 || filteredSel >= filtered.size()))) { selectSkip(1); } } @@ -90,7 +90,7 @@ void DialogsListWidget::mouseMoveEvent(QMouseEvent *e) { void DialogsListWidget::onUpdateSelected(bool force) { QPoint mouse(mapFromGlobal(lastMousePos)); - if (!force && !rect().contains(mouse) || !selByMouse) return; + if ((!force && !rect().contains(mouse)) || !selByMouse) return; int w = width(), mouseY = mouse.y(); if (filter.isEmpty()) { @@ -704,9 +704,19 @@ DialogsIndexed &DialogsListWidget::dialogsList() { return dialogs; } -DialogsWidget::DialogsWidget(MainWidget *parent) : QWidget(parent), _configLoaded(false), _drawShadow(true), -scroll(this, st::dlgScroll), list(&scroll, parent), _filter(this, st::dlgFilter, lang(lng_dlg_filter)), dlgOffset(0), dlgCount(-1), dlgPreloading(0), contactsRequest(0), -_newGroup(this, st::btnNewGroup), _addContact(this, st::btnAddContact) { +DialogsWidget::DialogsWidget(MainWidget *parent) : QWidget(parent) +, _configLoaded(false) +, _drawShadow(true) +, dlgOffset(0) +, dlgCount(-1) +, dlgPreloading(0) +, contactsRequest(0) +, _filter(this, st::dlgFilter, lang(lng_dlg_filter)) +, _newGroup(this, st::btnNewGroup) +, _addContact(this, st::btnAddContact) +, scroll(this, st::dlgScroll) +, list(&scroll, parent) +{ scroll.setWidget(&list); scroll.setFocusPolicy(Qt::NoFocus); connect(&list, SIGNAL(mustScrollTo(int, int)), &scroll, SLOT(scrollToY(int, int))); diff --git a/Telegram/SourceFiles/dropdown.cpp b/Telegram/SourceFiles/dropdown.cpp index ba8773790..51c81c16a 100644 --- a/Telegram/SourceFiles/dropdown.cpp +++ b/Telegram/SourceFiles/dropdown.cpp @@ -23,7 +23,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com #include "lang.h" Dropdown::Dropdown(QWidget *parent) : TWidget(parent), - _shadow(st::dropdownShadow), a_opacity(0), _hiding(false) { + _hiding(false), a_opacity(0), _shadow(st::dropdownShadow) { _width = st::dropdownPadding.left() + st::dropdownPadding.right(); _height = st::dropdownPadding.top() + st::dropdownPadding.bottom(); resize(_width, _height); @@ -173,7 +173,7 @@ bool Dropdown::eventFilter(QObject *obj, QEvent *e) { } DragArea::DragArea(QWidget *parent) : TWidget(parent), - _shadow(st::boxShadow), a_opacity(0), a_color(st::dragColor->c), _hiding(false), _in(false) { + _hiding(false), _in(false), a_opacity(0), a_color(st::dragColor->c), _shadow(st::boxShadow) { setMouseTracking(true); setAcceptDrops(true); } @@ -311,7 +311,7 @@ bool DragArea::animStep(float64 ms) { static const int emojiPerRow = 7, emojiRowsPerPage = 6; -EmojiPanInner::EmojiPanInner(QWidget *parent) : QWidget(parent), _selected(-1), _pressedSel(-1), _tab(cEmojiTab()) { +EmojiPanInner::EmojiPanInner(QWidget *parent) : QWidget(parent), _tab(cEmojiTab()), _selected(-1), _pressedSel(-1) { resize(emojiPerRow * st::emojiPanSize.width(), emojiRowsPerPage * st::emojiPanSize.height() - st::emojiPanSub); setMouseTracking(true); setFocusPolicy(Qt::NoFocus); @@ -481,13 +481,14 @@ void EmojiPanInner::showEmojiPack(DBIEmojiTab packIndex) { } EmojiPan::EmojiPan(QWidget *parent) : TWidget(parent), +_hiding(false), a_opacity(0), _shadow(st::dropdownShadow), _recent (this, qsl("emoji_group"), dbietRecent , QString(), cEmojiTab() == dbietRecent , st::rbEmojiRecent), _people (this, qsl("emoji_group"), dbietPeople , QString(), cEmojiTab() == dbietPeople , st::rbEmojiPeople), _nature (this, qsl("emoji_group"), dbietNature , QString(), cEmojiTab() == dbietNature , st::rbEmojiNature), _objects(this, qsl("emoji_group"), dbietObjects, QString(), cEmojiTab() == dbietObjects, st::rbEmojiObjects), _places (this, qsl("emoji_group"), dbietPlaces , QString(), cEmojiTab() == dbietPlaces , st::rbEmojiPlaces), _symbols(this, qsl("emoji_group"), dbietSymbols, QString(), cEmojiTab() == dbietSymbols, st::rbEmojiSymbols), -_shadow(st::dropdownShadow), a_opacity(0), _hiding(false), _scroll(this, st::emojiScroll), _inner() { +_scroll(this, st::emojiScroll), _inner() { setFocusPolicy(Qt::NoFocus); _scroll.setFocusPolicy(Qt::NoFocus); _scroll.viewport()->setFocusPolicy(Qt::NoFocus); @@ -666,9 +667,8 @@ void EmojiPan::hideAll() { } void EmojiPan::onTabChange() { - DBIEmojiTab newTab; - if (_recent.checked()) newTab = dbietRecent; - else if (_people.checked()) newTab = dbietPeople; + DBIEmojiTab newTab = dbietRecent; + if (_people.checked()) newTab = dbietPeople; else if (_nature.checked()) newTab = dbietNature; else if (_objects.checked()) newTab = dbietObjects; else if (_places.checked()) newTab = dbietPlaces; diff --git a/Telegram/SourceFiles/fileuploader.cpp b/Telegram/SourceFiles/fileuploader.cpp index 0293863c8..a1988fcee 100644 --- a/Telegram/SourceFiles/fileuploader.cpp +++ b/Telegram/SourceFiles/fileuploader.cpp @@ -18,7 +18,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com #include "stdafx.h" #include "fileuploader.h" -FileUploader::FileUploader() : uploading(0), sentSize(0) { +FileUploader::FileUploader() : sentSize(0), uploading(0) { nextTimer.setSingleShot(true); connect(&nextTimer, SIGNAL(timeout()), this, SLOT(sendNext())); } @@ -116,7 +116,7 @@ void FileUploader::sendNext() { } else { toSend = i->media.data.mid(i->docSentParts * i->docPartSize, i->docPartSize); } - if (toSend.size() > i->docPartSize || toSend.size() < i->docPartSize && i->docSentParts + 1 != i->docPartsCount) { + if (toSend.size() > i->docPartSize || (toSend.size() < i->docPartSize && i->docSentParts + 1 != i->docPartsCount)) { currentFailed(); return; } diff --git a/Telegram/SourceFiles/gui/countryinput.cpp b/Telegram/SourceFiles/gui/countryinput.cpp index 04f7212da..45ad9de78 100644 --- a/Telegram/SourceFiles/gui/countryinput.cpp +++ b/Telegram/SourceFiles/gui/countryinput.cpp @@ -61,7 +61,7 @@ namespace { CountriesByISO2::const_iterator already = countriesByISO2.constFind(info->iso2); if (already != countriesByISO2.cend()) { QString badISO = info->iso2; - badISO; + (void)badISO; } countriesByISO2.insert(info->iso2, info); } @@ -82,7 +82,7 @@ QString findValidCode(QString fullCode) { return ""; } -CountryInput::CountryInput(QWidget *parent, const style::countryInput &st) : QWidget(parent), _st(st), _active(false), _select(0), _text(lang(lng_country_code)) { +CountryInput::CountryInput(QWidget *parent, const style::countryInput &st) : QWidget(parent), _st(st), _active(false), _text(lang(lng_country_code)), _select(0) { initCountries(); resize(_st.width, _st.height + _st.ptrSize.height()); @@ -204,8 +204,8 @@ CountryInput::~CountryInput() { delete _select; } -CountryList::CountryList(QWidget *parent, const style::countryList &st) : QWidget(parent), _sel(0), _mouseSel(false), - _st(st) { +CountryList::CountryList(QWidget *parent, const style::countryList &st) : QWidget(parent), _sel(0), + _st(st), _mouseSel(false) { CountriesByISO2::const_iterator l = countriesByISO2.constFind(lastValidISO); bool seenLastValid = false; int already = countriesAll.size(); @@ -338,7 +338,7 @@ void CountryList::mouseMoveEvent(QMouseEvent *e) { void CountryList::onUpdateSelected(bool force) { QPoint p(mapFromGlobal(_mousePos)); - if (!force && !rect().contains(p) || !_mouseSel) return; + if ((!force && !rect().contains(p)) || !_mouseSel) return; int newSelected = p.y(); newSelected = (newSelected > _st.verticalMargin) ? (newSelected - _st.verticalMargin) / _st.rowHeight : 0; @@ -413,11 +413,11 @@ QString CountryList::getSelectedCountry() const { } CountrySelect::CountrySelect() : QWidget(App::wnd()), - _scroll(this, st::scrollCountries), _list(&_scroll), - _filter(this, st::inpCountry, lang(lng_country_ph)), - _doneButton(this, lang(lng_country_done), st::btnSelectDone), - _cancelButton(this, lang(lng_cancel), st::btnSelectCancel), - _innerLeft(0), _innerTop(0), _innerWidth(0), _innerHeight(0), _result("none"), + _result("none"), + _filter(this, st::inpCountry, lang(lng_country_ph)), _scroll(this, st::scrollCountries), _list(&_scroll), + _doneButton(this, lang(lng_country_done), st::btnSelectDone), + _cancelButton(this, lang(lng_cancel), st::btnSelectCancel), + _innerLeft(0), _innerTop(0), _innerWidth(0), _innerHeight(0), a_alpha(0), a_bgAlpha(0), a_coord(st::countriesSlideShift), _shadow(st::boxShadow) { setGeometry(App::wnd()->rect()); diff --git a/Telegram/SourceFiles/gui/emoji_config.cpp b/Telegram/SourceFiles/gui/emoji_config.cpp index 7c067590b..697a73c0b 100644 --- a/Telegram/SourceFiles/gui/emoji_config.cpp +++ b/Telegram/SourceFiles/gui/emoji_config.cpp @@ -3558,7 +3558,7 @@ const EmojiData *getEmoji(uint32 code) { return 0; } - if (highCode == 35 || highCode >= 48 && highCode < 58) { + if (highCode == 35 || (highCode >= 48 && highCode < 58)) { if ((code & 0xFFFF) != 0x20E3) return 0; switch (code) { diff --git a/Telegram/SourceFiles/gui/flatbutton.cpp b/Telegram/SourceFiles/gui/flatbutton.cpp index 500570d25..152cabf72 100644 --- a/Telegram/SourceFiles/gui/flatbutton.cpp +++ b/Telegram/SourceFiles/gui/flatbutton.cpp @@ -19,9 +19,9 @@ Copyright (c) 2014 John Preston, https://tdesktop.com #include "gui/flatbutton.h" FlatButton::FlatButton(QWidget *parent, const QString &text, const style::flatButton &st) : Button(parent), - _text(text), _opacity(1), + _text(text), _st(st), - a_bg(st.bgColor->c), a_text(st.color->c) { + a_bg(st.bgColor->c), a_text(st.color->c), _opacity(1) { if (_st.width < 0) { _st.width = _st.font->m.width(text) - _st.width; } else if (!_st.width) { @@ -133,8 +133,8 @@ void LinkButton::onStateChange(int oldState, ButtonStateChangeSource source) { LinkButton::~LinkButton() { } -IconedButton::IconedButton(QWidget *parent, const style::iconedButton &st, const QString &text) : Button(parent), _opacity(1), - _text(text), _st(st), a_opacity(_st.opacity), a_bg(_st.bgColor->c) { +IconedButton::IconedButton(QWidget *parent, const style::iconedButton &st, const QString &text) : Button(parent), + _text(text), _st(st), a_opacity(_st.opacity), a_bg(_st.bgColor->c), _opacity(1) { if (_st.width < 0) { _st.width = _st.font->m.width(text) - _st.width; diff --git a/Telegram/SourceFiles/gui/flatcheckbox.cpp b/Telegram/SourceFiles/gui/flatcheckbox.cpp index 9382c0c05..69609810e 100644 --- a/Telegram/SourceFiles/gui/flatcheckbox.cpp +++ b/Telegram/SourceFiles/gui/flatcheckbox.cpp @@ -22,7 +22,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com #include "flatcheckbox.h" FlatCheckbox::FlatCheckbox(QWidget *parent, const QString &text, bool checked, const style::flatCheckbox &st) : Button(parent), - _text(text), _checked(checked), _st(st), _opacity(1), a_over(0, 0) { + _st(st), a_over(0, 0), _text(text), _opacity(1), _checked(checked) { connect(this, SIGNAL(clicked()), this, SLOT(onClicked())); connect(this, SIGNAL(stateChanged(int, ButtonStateChangeSource)), this, SLOT(onStateChange(int, ButtonStateChangeSource))); setCursor(_st.cursor); @@ -92,7 +92,7 @@ void FlatCheckbox::paintEvent(QPaintEvent *e) { if (_state & StateDisabled) { QRect sRect(_checked ? _st.chkDisImageRect : _st.disImageRect); p.drawPixmap(_st.imagePos, App::sprite(), sRect); - } else if (_checked && _st.chkImageRect == _st.chkOverImageRect || !_checked && _st.imageRect == _st.overImageRect) { + } else if ((_checked && _st.chkImageRect == _st.chkOverImageRect) || (!_checked && _st.imageRect == _st.overImageRect)) { p.setOpacity(_opacity); QRect sRect(_checked ? _st.chkImageRect : _st.imageRect); p.drawPixmap(_st.imagePos, App::sprite(), sRect); @@ -185,7 +185,7 @@ void RadiobuttonsGroup::remove(FlatRadiobutton * const &radio) { } FlatRadiobutton::FlatRadiobutton(QWidget *parent, const QString &group, int32 value, const QString &text, bool checked, const style::flatCheckbox &st) : - FlatCheckbox(parent, text, checked, st), _value(value), _group(radioButtons.reg(group)) { + FlatCheckbox(parent, text, checked, st), _group(radioButtons.reg(group)), _value(value) { _group->insert(this); connect(this, SIGNAL(changed()), this, SLOT(onChanged())); if (this->checked()) onChanged(); diff --git a/Telegram/SourceFiles/gui/flatinput.cpp b/Telegram/SourceFiles/gui/flatinput.cpp index ab7851322..74d734234 100644 --- a/Telegram/SourceFiles/gui/flatinput.cpp +++ b/Telegram/SourceFiles/gui/flatinput.cpp @@ -41,9 +41,9 @@ namespace { FlatInputStyle _flatInputStyle; } -FlatInput::FlatInput(QWidget *parent, const style::flatInput &st, const QString &pholder, const QString &v) : QLineEdit(v, parent), _oldtext(v), - _st(st), _phVisible(!v.length()), _kev(0), a_borderColor(st.borderColor->c), a_bgColor(st.bgColor->c), _notingBene(0), - a_phLeft(_phVisible ? 0 : st.phShift), a_phAlpha(_phVisible ? 1 : 0), a_phColor(st.phColor->c) { +FlatInput::FlatInput(QWidget *parent, const style::flatInput &st, const QString &pholder, const QString &v) : QLineEdit(v, parent), _oldtext(v), _kev(0), _phVisible(!v.length()), + a_phLeft(_phVisible ? 0 : st.phShift), a_phAlpha(_phVisible ? 1 : 0), a_phColor(st.phColor->c), + a_borderColor(st.borderColor->c), a_bgColor(st.bgColor->c), _notingBene(0), _st(st) { resize(_st.width, _st.height); setFont(_st.font->f); diff --git a/Telegram/SourceFiles/gui/flatlabel.cpp b/Telegram/SourceFiles/gui/flatlabel.cpp index ca95c4040..d4335e0ee 100644 --- a/Telegram/SourceFiles/gui/flatlabel.cpp +++ b/Telegram/SourceFiles/gui/flatlabel.cpp @@ -29,7 +29,7 @@ namespace { } FlatLabel::FlatLabel(QWidget *parent, const QString &text, const style::flatLabel &st, const style::textStyle &tst) : TWidget(parent), -_st(st), _tst(tst), _text(_st.width ? _st.width : QFIXED_MAX), _opacity(1) { +_text(st.width ? st.width : QFIXED_MAX), _st(st), _tst(tst), _opacity(1) { setRichText(text); } diff --git a/Telegram/SourceFiles/gui/flattextarea.cpp b/Telegram/SourceFiles/gui/flattextarea.cpp index e592e389b..8383763dc 100644 --- a/Telegram/SourceFiles/gui/flattextarea.cpp +++ b/Telegram/SourceFiles/gui/flattextarea.cpp @@ -20,10 +20,11 @@ Copyright (c) 2014 John Preston, https://tdesktop.com #include "flattextarea.h" -FlatTextarea::FlatTextarea(QWidget *parent, const style::flatTextarea &st, const QString &pholder, const QString &v) : QTextEdit(v, parent), _oldtext(v), - _st(st), _phVisible(!v.length()), _ph(pholder), _fakeMargin(0), - a_phLeft(_phVisible ? 0 : st.phShift), a_phAlpha(_phVisible ? 1 : 0), a_phColor(st.phColor->c), - _touchPress(false), _touchRightButton(false), _touchMove(false), _replacingEmojis(false) { +FlatTextarea::FlatTextarea(QWidget *parent, const style::flatTextarea &st, const QString &pholder, const QString &v) : QTextEdit(v, parent), + _ph(pholder), _oldtext(v), _phVisible(!v.length()), + a_phLeft(_phVisible ? 0 : st.phShift), a_phAlpha(_phVisible ? 1 : 0), a_phColor(st.phColor->c), + _st(st), _fakeMargin(0), + _touchPress(false), _touchRightButton(false), _touchMove(false), _replacingEmojis(false) { setAcceptRichText(false); resize(_st.width, _st.font->height); @@ -300,10 +301,10 @@ void FlatTextarea::processDocumentContentsChange(int position, int charsAdded) { QString t(fragment.text()); for (const QChar *ch = t.constData(), *e = ch + t.size(); ch != e; ++ch) { - if (ch + 1 < e && (ch->isHighSurrogate() || (ch->unicode() >= 48 && ch->unicode() < 58 || ch->unicode() == 35) && (ch + 1)->unicode() == 0x20E3)) { + if (ch + 1 < e && (ch->isHighSurrogate() || (((ch->unicode() >= 48 && ch->unicode() < 58) || ch->unicode() == 35) && (ch + 1)->unicode() == 0x20E3))) { emoji = getEmoji((ch->unicode() << 16) | (ch + 1)->unicode()); if (emoji) { - if (emoji->len == 4 && (ch + 3 >= e || (((ch + 2)->unicode() << 16) | (ch + 3)->unicode()) != emoji->code2)) { + if (emoji->len == 4 && (ch + 3 >= e || ((uint32((ch + 2)->unicode()) << 16) | uint32((ch + 3)->unicode())) != emoji->code2)) { emoji = 0; } else { emojiPosition = p + (ch - t.constData()); @@ -438,7 +439,7 @@ QMimeData *FlatTextarea::createMimeDataFromSelection() const { void FlatTextarea::keyPressEvent(QKeyEvent *e) { bool shift = e->modifiers().testFlag(Qt::ShiftModifier); - bool ctrl = e->modifiers().testFlag(Qt::ControlModifier), ctrlGood = ctrl && cCtrlEnter() || !ctrl && !shift && !cCtrlEnter(); + bool ctrl = e->modifiers().testFlag(Qt::ControlModifier), ctrlGood = (ctrl && cCtrlEnter()) || (!ctrl && !shift && !cCtrlEnter()); bool enter = (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return); if (enter && ctrlGood) { diff --git a/Telegram/SourceFiles/gui/images.cpp b/Telegram/SourceFiles/gui/images.cpp index 6c0785ae8..c73f8d3af 100644 --- a/Telegram/SourceFiles/gui/images.cpp +++ b/Telegram/SourceFiles/gui/images.cpp @@ -190,10 +190,10 @@ int64 imageCacheSize() { return globalAquiredSize; } -StorageImage::StorageImage(int32 width, int32 height, int32 dc, const int64 &volume, int32 local, const int64 &secret) : loader(new mtpFileLoader(dc, volume, local, secret)), w(width), h(height) { +StorageImage::StorageImage(int32 width, int32 height, int32 dc, const int64 &volume, int32 local, const int64 &secret) : w(width), h(height), loader(new mtpFileLoader(dc, volume, local, secret)) { } -StorageImage::StorageImage(int32 width, int32 height, int32 dc, const int64 &volume, int32 local, const int64 &secret, QByteArray &bytes) : loader(0), w(width), h(height) { +StorageImage::StorageImage(int32 width, int32 height, int32 dc, const int64 &volume, int32 local, const int64 &secret, QByteArray &bytes) : w(width), h(height), loader(0) { setData(bytes); } diff --git a/Telegram/SourceFiles/gui/scrollarea.cpp b/Telegram/SourceFiles/gui/scrollarea.cpp index dffe381c6..3900aed22 100644 --- a/Telegram/SourceFiles/gui/scrollarea.cpp +++ b/Telegram/SourceFiles/gui/scrollarea.cpp @@ -36,10 +36,12 @@ void ScrollShadow::changeVisibility(bool shown) { } ScrollBar::ScrollBar(ScrollArea *parent, bool vert, const style::flatScroll *st) : QWidget(parent), - _st(st), _area(parent), _vertical(vert), _hideIn(-1), + _area(parent), _st(st), _vertical(vert), _over(false), _overbar(false), _moving(false), _topSh(false), _bottomSh(false), - a_bg((_st->hiding ? st::transparent : _st->bgColor)->c), a_bar((_st->hiding ? st::transparent : _st->barColor)->c), - _connected(vert ? parent->verticalScrollBar() : parent->horizontalScrollBar()), _scrollMax(_connected->maximum()) { + _connected(vert ? parent->verticalScrollBar() : parent->horizontalScrollBar()), + _scrollMax(_connected->maximum()), _hideIn(-1), + a_bg((_st->hiding ? st::transparent : _st->bgColor)->c), + a_bar((_st->hiding ? st::transparent : _st->barColor)->c) { recountSize(); _hideTimer.setSingleShot(true); @@ -249,10 +251,12 @@ void ScrollBar::resizeEvent(QResizeEvent *e) { updateBar(); } -ScrollArea::ScrollArea(QWidget *parent, const style::flatScroll &st, bool handleTouch) : QScrollArea(parent), _st(st), _touchEnabled(handleTouch), +ScrollArea::ScrollArea(QWidget *parent, const style::flatScroll &st, bool handleTouch) : QScrollArea(parent), + _st(st), hor(this, false, &_st), vert(this, true, &_st), topSh(this, &_st), bottomSh(this, &_st), - _touchScroll(false), _touchPress(false), _touchRightButton(false), _widgetAcceptsTouch(false), - _touchScrollState(TouchScrollManual), _touchPrevPosValid(false), _touchWaitingAcceleration(false), _touchSpeedTime(0), _touchAccelerationTime(0), _touchTime(0) { + _touchEnabled(handleTouch), _touchScroll(false), _touchPress(false), _touchRightButton(false), + _touchScrollState(TouchScrollManual), _touchPrevPosValid(false), _touchWaitingAcceleration(false), + _touchSpeedTime(0), _touchAccelerationTime(0), _touchTime(0), _widgetAcceptsTouch(false) { connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SIGNAL(scrolled())); connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SIGNAL(scrolled())); connect(&vert, SIGNAL(topShadowVisibility(bool)), &topSh, SLOT(changeVisibility(bool))); @@ -365,8 +369,8 @@ void ScrollArea::touchUpdateSpeed() { if (_touchScrollState == TouchScrollAuto) { const int oldSpeedY = _touchSpeed.y(); const int oldSpeedX = _touchSpeed.x(); - if ((oldSpeedY <= 0 && newSpeedY <= 0) || (oldSpeedY >= 0 && newSpeedY >= 0) - && (oldSpeedX <= 0 && newSpeedX <= 0) || (oldSpeedX >= 0 && newSpeedX >= 0)) { + if ((oldSpeedY <= 0 && newSpeedY <= 0) || ((oldSpeedY >= 0 && newSpeedY >= 0) + && (oldSpeedX <= 0 && newSpeedX <= 0)) || (oldSpeedX >= 0 && newSpeedX >= 0)) { _touchSpeed.setY(snap((oldSpeedY + (newSpeedY / 4)), -MaxScrollAccelerated, +MaxScrollAccelerated)); _touchSpeed.setX(snap((oldSpeedX + (newSpeedX / 4)), -MaxScrollAccelerated, +MaxScrollAccelerated)); } else { diff --git a/Telegram/SourceFiles/gui/style_core.cpp b/Telegram/SourceFiles/gui/style_core.cpp index 93b252759..561953587 100644 --- a/Telegram/SourceFiles/gui/style_core.cpp +++ b/Telegram/SourceFiles/gui/style_core.cpp @@ -23,7 +23,7 @@ namespace { } namespace style { - FontData::FontData(uint32 size, uint32 flags, uint32 family, Font *other) : _size(size), _flags(flags), _family(family), f(_fontFamilies[family]), m(f) { + FontData::FontData(uint32 size, uint32 flags, uint32 family, Font *other) : f(_fontFamilies[family]), m(f), _size(size), _flags(flags), _family(family) { if (other) { memcpy(modified, other, sizeof(modified)); } else { diff --git a/Telegram/SourceFiles/gui/text.cpp b/Telegram/SourceFiles/gui/text.cpp index 6f5b71f1f..f7522142b 100644 --- a/Telegram/SourceFiles/gui/text.cpp +++ b/Telegram/SourceFiles/gui/text.cpp @@ -372,7 +372,7 @@ public: } else if (ch == ')' || ch == ']' || ch == '}' || ch == '>') { if (parenth.isEmpty()) break; const QChar *q = parenth.pop(), open(*q); - if (ch == ')' && open != '(' || ch == ']' && open != '[' || ch == '}' && open != '{' || ch == '>' && open != '<') { + if ((ch == ')' && open != '(') || (ch == ']' && open != '[') || (ch == '}' && open != '{') || (ch == '>' && open != '<')) { p = q; break; } @@ -623,7 +623,7 @@ public: ch = *ptr; chInt = (chInt << 16) | ch.unicode(); } - } else if (ch >= 48 && ch < 58 || ch == 35) { // check for digit emoji + } else if ((ch >= 48 && ch < 58) || ch == 35) { // check for digit emoji if (ptr + 1 < end && (ptr + 1)->unicode() == 0x20E3) { _t->_text.push_back(ch); skipBack = -1; @@ -657,7 +657,7 @@ public: if (!e) return; if (e->len > 2) { - if (ptr + 2 >= end || e->code2 != (((ptr + 1)->unicode() << 16) | (ptr + 2)->unicode())) { + if (ptr + 2 >= end || e->code2 != ((uint32((ptr + 1)->unicode()) << 16) | uint32((ptr + 2)->unicode()))) { return; } else { _t->_text.push_back(*++ptr); @@ -669,8 +669,8 @@ public: emoji = e; } - TextParser(Text *t, const QString &text, const TextParseOptions &options) : _t(t), src(text), stopAfterWidth(QFIXED_MAX), - rich(options.flags & TextParseRichText), multiline(options.flags & TextParseMultiline), flags(0), lnkIndex(0), maxLnkIndex(0) { + TextParser(Text *t, const QString &text, const TextParseOptions &options) : _t(t), src(text), + rich(options.flags & TextParseRichText), multiline(options.flags & TextParseMultiline), maxLnkIndex(0), flags(0), lnkIndex(0), stopAfterWidth(QFIXED_MAX) { int flags = options.flags; if (options.maxw > 0 && options.maxh > 0) { stopAfterWidth = ((options.maxh / _t->_font->height) + 1) * options.maxw; @@ -884,7 +884,7 @@ public: return _blockEnd(t, i, e) - (*i)->from(); } - TextPainter(QPainter *p, const Text *t) : _p(p), _t(t), _elideLast(false), _elideSavedBlock(0), _lnkResult(0), _inTextFlag(0), _getSymbol(0), _getSymbolAfter(0), _getSymbolUpon(0), _str(0) { + TextPainter(QPainter *p, const Text *t) : _p(p), _t(t), _elideLast(false), _str(0), _elideSavedBlock(0), _lnkResult(0), _inTextFlag(0), _getSymbol(0), _getSymbolAfter(0), _getSymbolUpon(0) { } void initNextParagraph(Text::TextBlocks::const_iterator i) { @@ -1228,12 +1228,12 @@ public: bool selectFromStart = (_selectedTo > _lineStart) && (_lineStart > 0) && (_selectedFrom <= _lineStart); bool selectTillEnd = (_selectedTo >= _lineEnd) && (_lineEnd < _t->_text.size()) && (_selectedFrom < _lineEnd) && (!_endBlock || _endBlock->type() != TextBlockSkip); - if (selectFromStart && _parDirection == Qt::LeftToRight || selectTillEnd && _parDirection == Qt::RightToLeft) { + if ((selectFromStart && _parDirection == Qt::LeftToRight) || (selectTillEnd && _parDirection == Qt::RightToLeft)) { if (x > _x) { _p->fillRect(QRectF(_x.toReal(), _y + _yDelta, (x - _x).toReal(), _fontHeight), _textStyle->selectBG->b); } } - if (selectTillEnd && _parDirection == Qt::LeftToRight || selectFromStart && _parDirection == Qt::RightToLeft) { + if ((selectTillEnd && _parDirection == Qt::LeftToRight) || (selectFromStart && _parDirection == Qt::RightToLeft)) { if (x < _x + _wLeft) { _p->fillRect(QRectF((x + _w - _wLeft).toReal(), _y + _yDelta, (_x + _wLeft - x).toReal(), _fontHeight), _textStyle->selectBG->b); } @@ -1452,11 +1452,11 @@ public: for (int charsCount = (ch2 - ch); ch < ch2; ++ch) { QFixed shift1 = QFixed(2 * (charsCount - (ch2 - ch)) + 2) * gwidth / QFixed(2 * charsCount), shift2 = QFixed(2 * (charsCount - (ch2 - ch)) + 1) * gwidth / QFixed(2 * charsCount); - if (rtl && _lnkX >= tmpx - shift1 || - !rtl && _lnkX < tmpx + shift1) { + if ((rtl && _lnkX >= tmpx - shift1) || + (!rtl && _lnkX < tmpx + shift1)) { *_getSymbol = _localFrom + itemStart + ch; - if (rtl && _lnkX >= tmpx - shift2 || - !rtl && _lnkX < tmpx + shift2) { + if ((rtl && _lnkX >= tmpx - shift2) || + (!rtl && _lnkX < tmpx + shift2)) { *_getSymbolAfter = false; } else { *_getSymbolAfter = true; @@ -2807,7 +2807,7 @@ namespace { class BlockParser { public: - BlockParser(QTextEngine *e, TextBlock *b, QFixed minResizeWidth, int32 blockFrom) : eng(e), block(b) { + BlockParser(QTextEngine *e, TextBlock *b, QFixed minResizeWidth, int32 blockFrom) : block(b), eng(e) { parseWords(minResizeWidth, blockFrom); } diff --git a/Telegram/SourceFiles/gui/text.h b/Telegram/SourceFiles/gui/text.h index 20a0bb765..7f804c5c9 100644 --- a/Telegram/SourceFiles/gui/text.h +++ b/Telegram/SourceFiles/gui/text.h @@ -125,8 +125,8 @@ private: struct TextWord { TextWord() { } - TextWord(uint16 from, QFixed width, QFixed rbearing, QFixed rpadding = 0) : from(from), width(width), - _rbearing(rbearing.value() > 0x7FFF ? 0x7FFF : (rbearing.value() < -0x7FFF ? -0x7FFF : rbearing.value())), rpadding(rpadding) { + TextWord(uint16 from, QFixed width, QFixed rbearing, QFixed rpadding = 0) : from(from), + _rbearing(rbearing.value() > 0x7FFF ? 0x7FFF : (rbearing.value() < -0x7FFF ? -0x7FFF : rbearing.value())), width(width), rpadding(rpadding) { } QFixed f_rbearing() const { return QFixed::fromFixed(_rbearing); @@ -357,7 +357,7 @@ public: QString original(uint16 selectedFrom = 0, uint16 selectedTo = 0xFFFF, bool expandLinks = true) const; - bool lastDots(uint32 dots, int32 maxdots = 3) { // hack for typing animation + bool lastDots(int32 dots, int32 maxdots = 3) { // hack for typing animation if (_text.size() < maxdots) return false; int32 nowDots = 0, from = _text.size() - maxdots, to = _text.size(); diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index 29941ab06..7a582b628 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -120,8 +120,16 @@ void historyInit() { NotifySettings globalNotifyAll, globalNotifyUsers, globalNotifyChats; NotifySettingsPtr globalNotifyAllPtr = UnknownNotifySettings, globalNotifyUsersPtr = UnknownNotifySettings, globalNotifyChatsPtr = UnknownNotifySettings; -PeerData::PeerData(const PeerId &id) : id(id), access(0), chat(App::isChat(id)), loaded(false), notify(UnknownNotifySettings), - colorIndex(peerColorIndex(id)), color(peerColor(colorIndex)), photo(chat ? chatDefPhoto(colorIndex) : userDefPhoto(colorIndex)), nameVersion(0) { +PeerData::PeerData(const PeerId &id) : id(id) +, loaded(false) +, chat(App::isChat(id)) +, access(0) +, colorIndex(peerColorIndex(id)) +, color(peerColor(colorIndex)) +, photo(chat ? chatDefPhoto(colorIndex) : userDefPhoto(colorIndex)) +, nameVersion(0) +, notify(UnknownNotifySettings) +{ } UserData *PeerData::asUser() { @@ -259,7 +267,7 @@ QString saveFileName(const QString &title, const QString &filter, const QString void VideoOpenLink::onClick(Qt::MouseButton button) const { VideoData *data = video(); - if (!data->user && !data->date || button != Qt::LeftButton) return; + if ((!data->user && !data->date) || button != Qt::LeftButton) return; QString already = data->already(true); if (!already.isEmpty()) { @@ -304,7 +312,7 @@ void VideoSaveLink::onClick(Qt::MouseButton button) const { void VideoCancelLink::onClick(Qt::MouseButton button) const { VideoData *data = video(); - if (!data->user && !data->date || button != Qt::LeftButton) return; + if ((!data->user && !data->date) || button != Qt::LeftButton) return; data->cancel(); } @@ -319,7 +327,7 @@ void VideoData::save(const QString &toFile) { void AudioOpenLink::onClick(Qt::MouseButton button) const { AudioData *data = audio(); - if (!data->user && !data->date || button != Qt::LeftButton) return; + if ((!data->user && !data->date) || button != Qt::LeftButton) return; QString already = data->already(true); if (!already.isEmpty()) { @@ -364,7 +372,7 @@ void AudioSaveLink::onClick(Qt::MouseButton button) const { void AudioCancelLink::onClick(Qt::MouseButton button) const { AudioData *data = audio(); - if (!data->user && !data->date || button != Qt::LeftButton) return; + if ((!data->user && !data->date) || button != Qt::LeftButton) return; data->cancel(); } @@ -379,7 +387,7 @@ void AudioData::save(const QString &toFile) { void DocumentOpenLink::onClick(Qt::MouseButton button) const { DocumentData *data = document(); - if (!data->user && !data->date || button != Qt::LeftButton) return; + if ((!data->user && !data->date) || button != Qt::LeftButton) return; QString already = data->already(true); if (!already.isEmpty()) { @@ -451,7 +459,7 @@ void DocumentSaveLink::onClick(Qt::MouseButton button) const { void DocumentCancelLink::onClick(Qt::MouseButton button) const { DocumentData *data = document(); - if (!data->user && !data->date || button != Qt::LeftButton) return; + if ((!data->user && !data->date) || button != Qt::LeftButton) return; data->cancel(); } @@ -563,9 +571,26 @@ void DialogRow::paint(QPainter &p, int32 w, bool act, bool sel) const { history->nameText.drawElided(p, rectForName.left(), rectForName.top(), rectForName.width()); } -History::History(const PeerId &peerId) : width(0), height(0), myTyping(0), showFrom(0), unreadLoaded(true), unreadBar(0), notifyFrom(0), - msgCount(0), offset(0), peer(App::peer(peerId)), posInDialogs(0), unreadCount(0), inboxReadTill(0), outboxReadTill(0), lastWidth(0), lastScrollTop(History::ScrollMax), - lastItemTextCache(st::dlgRichMinWidth), textCachedFor(0), typingText(st::dlgRichMinWidth), mute(isNotifyMuted(peer->notify)) { +History::History(const PeerId &peerId) : width(0), height(0) +, msgCount(0) +, offset(0) +, unreadCount(0) +, inboxReadTill(0) +, outboxReadTill(0) +, showFrom(0) +, notifyFrom(0) +, unreadBar(0) +, unreadLoaded(true) +, peer(App::peer(peerId)) +, lastWidth(0) +, lastScrollTop(History::ScrollMax) +, mute(isNotifyMuted(peer->notify)) +, textCachedFor(0) +, lastItemTextCache(st::dlgRichMinWidth) +, posInDialogs(0) +, typingText(st::dlgRichMinWidth) +, myTyping(0) +{ } void History::updateNameText() { @@ -1360,7 +1385,7 @@ void HistoryBlock::removeItem(HistoryItem *item) { } } else if (myIndex > 0) { HistoryBlock *prevBlock = (*history)[myIndex - 1]; - if (prevBlock->isEmpty() || (myIndex == 1) && (prevBlock->size() != 1 || (*prevBlock->cbegin())->itemType() != HistoryItem::DateType)) { + if (prevBlock->isEmpty() || ((myIndex == 1) && (prevBlock->size() != 1 || (*prevBlock->cbegin())->itemType() != HistoryItem::DateType))) { LOG(("App Error: Found bad history, with no first date block: %1").arg((*history)[0]->size())); } else if ((*prevBlock)[prevBlock->size() - 1]->itemType() == HistoryItem::DateType) { (*prevBlock)[prevBlock->size() - 1]->destroy(); @@ -1411,8 +1436,16 @@ void HistoryBlock::removeItem(HistoryItem *item) { } } -HistoryItem::HistoryItem(History *history, HistoryBlock *block, MsgId msgId, bool out, bool unread, QDateTime msgDate, int32 from) : - y(0), id(msgId), _history(history), _block(block), _out(out), _unread(unread), date(msgDate), _from(App::user(from)), _fromVersion(_from->nameVersion) { +HistoryItem::HistoryItem(History *history, HistoryBlock *block, MsgId msgId, bool out, bool unread, QDateTime msgDate, int32 from) : y(0) +, id(msgId) +, date(msgDate) +, _from(App::user(from)) +, _fromVersion(_from->nameVersion) +, _history(history) +, _block(block) +, _out(out) +, _unread(unread) +{ } void HistoryItem::markRead() { @@ -1442,7 +1475,10 @@ HistoryItem *regItem(HistoryItem *item) { return 0; } -HistoryPhoto::HistoryPhoto(const MTPDphoto &photo, int32 width) : data(App::feedPhoto(photo)), w(width), openl(new PhotoLink(data)) { +HistoryPhoto::HistoryPhoto(const MTPDphoto &photo, int32 width) : data(App::feedPhoto(photo)) +, openl(new PhotoLink(data)) +, w(width) +{ int32 tw = data->full->width(), th = data->full->height(); if (!tw || !th) { tw = th = 1; @@ -1583,7 +1619,14 @@ QString formatDurationAndSizeText(qint64 duration, qint64 size) { int32 _downloadWidth = 0, _openWithWidth = 0, _cancelWidth = 0, _buttonWidth = 0; -HistoryVideo::HistoryVideo(const MTPDvideo &video, int32 width) : data(App::feedVideo(video)), w(width), _openl(new VideoOpenLink(data)), _savel(new VideoSaveLink(data)), _cancell(new VideoCancelLink(data)), _dldDone(0), _uplDone(0) { +HistoryVideo::HistoryVideo(const MTPDvideo &video, int32 width) : data(App::feedVideo(video)) +, _openl(new VideoOpenLink(data)) +, _savel(new VideoSaveLink(data)) +, _cancell(new VideoCancelLink(data)) +, w(width) +, _dldDone(0) +, _uplDone(0) +{ _maxw = st::mediaMaxWidth; _size = formatDurationAndSizeText(data->duration, data->size); @@ -1790,7 +1833,14 @@ void HistoryVideo::draw(QPainter &p, const HistoryItem *parent, const QString &t } } -HistoryAudio::HistoryAudio(const MTPDaudio &audio, int32 width) : data(App::feedAudio(audio)), w(width), _openl(new AudioOpenLink(data)), _savel(new AudioSaveLink(data)), _cancell(new AudioCancelLink(data)), _dldDone(0), _uplDone(0) { +HistoryAudio::HistoryAudio(const MTPDaudio &audio, int32 width) : data(App::feedAudio(audio)) +, _openl(new AudioOpenLink(data)) +, _savel(new AudioSaveLink(data)) +, _cancell(new AudioCancelLink(data)) +, w(width) +, _dldDone(0) +, _uplDone(0) +{ _maxw = st::mediaMaxWidth; _size = formatDurationAndSizeText(data->duration, data->size); @@ -1966,7 +2016,15 @@ HistoryMedia *HistoryAudio::clone() const { return n; } -HistoryDocument::HistoryDocument(const MTPDdocument &document, int32 width) : data(App::feedDocument(document)), w(width), _openl(new DocumentOpenLink(data)), _savel(new DocumentSaveLink(data)), _cancell(new DocumentCancelLink(data)), _name(data->name), _dldDone(0), _uplDone(0) { +HistoryDocument::HistoryDocument(const MTPDdocument &document, int32 width) : data(App::feedDocument(document)) +, _openl(new DocumentOpenLink(data)) +, _savel(new DocumentSaveLink(data)) +, _cancell(new DocumentCancelLink(data)) +, w(width) +, _name(data->name) +, _dldDone(0) +, _uplDone(0) +{ _maxw = st::mediaMaxWidth; _namew = st::mediaFont->m.width(_name.isEmpty() ? qsl("Document") : _name); @@ -2178,7 +2236,11 @@ HistoryMedia *HistoryDocument::clone() const { return n; } -HistoryContact::HistoryContact(int32 userId, const QString &first, const QString &last, const QString &phone) : userId(userId), phone(App::formatPhone(phone)), contact(App::userLoaded(userId)), w(0) { +HistoryContact::HistoryContact(int32 userId, const QString &first, const QString &last, const QString &phone) : userId(userId) +, w(0) +, phone(App::formatPhone(phone)) +, contact(App::userLoaded(userId)) +{ _maxw = st::mediaMaxWidth; name.setText(st::mediaFont, (first + ' ' + last).trimmed(), _textNameOptions); @@ -2296,7 +2358,12 @@ void HistoryContact::draw(QPainter &p, const HistoryItem *parent, const QString } HistoryMessage::HistoryMessage(History *history, HistoryBlock *block, const MTPDmessage &msg) : - HistoryItem(history, block, msg.vid.v, msg.vout.v, msg.vunread.v, ::date(msg.vdate), msg.vfrom_id.v), media(0), _text(st::msgMinWidth), _textWidth(0), _textHeight(0) { + HistoryItem(history, block, msg.vid.v, msg.vout.v, msg.vunread.v, ::date(msg.vdate), msg.vfrom_id.v) +, _text(st::msgMinWidth) +, _textWidth(0) +, _textHeight(0) +, media(0) +{ QString text(textClean(qs(msg.vmessage))); initMedia(msg.vmedia, text); initDimensions(text); @@ -2315,14 +2382,24 @@ HistoryMessage::HistoryMessage(History *history, HistoryBlock *block, const MTPD //} HistoryMessage::HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, bool out, bool unread, QDateTime date, int32 from, const QString &msg, const MTPMessageMedia &media) : - HistoryItem(history, block, msgId, out, unread, date, from), media(0), _text(st::msgMinWidth), _textWidth(0), _textHeight(0) { + HistoryItem(history, block, msgId, out, unread, date, from) +, _text(st::msgMinWidth) +, _textWidth(0) +, _textHeight(0) +, media(0) +{ QString text(msg); initMedia(media, text); initDimensions(text); } HistoryMessage::HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, bool out, bool unread, QDateTime date, int32 from, const QString &msg, HistoryMedia *fromMedia) : - HistoryItem(history, block, msgId, out, unread, date, from), media(0), _text(st::msgMinWidth), _textWidth(0), _textHeight(0) { + HistoryItem(history, block, msgId, out, unread, date, from) +, _text(st::msgMinWidth) +, _textWidth(0) +, _textHeight(0) +, media(0) +{ QString text(msg); if (fromMedia) { media = fromMedia->clone(); @@ -2713,17 +2790,23 @@ HistoryMessage::~HistoryMessage() { delete media; } -HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, const MTPDmessageForwarded &msg) : - HistoryMessage(history, block, msg.vid.v, msg.vout.v, msg.vunread.v, ::date(msg.vdate), msg.vfrom_id.v, textClean(qs(msg.vmessage)), msg.vmedia), - fwdFrom(App::user(msg.vfwd_from_id.v)), fwdFromVersion(fwdFrom->nameVersion), fwdDate(::date(msg.vfwd_date)), fromWidth(st::msgServiceFont->m.width(lang(lng_forwarded_from))), fwdFromName(4096) { +HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, const MTPDmessageForwarded &msg) : HistoryMessage(history, block, msg.vid.v, msg.vout.v, msg.vunread.v, ::date(msg.vdate), msg.vfrom_id.v, textClean(qs(msg.vmessage)), msg.vmedia) +, fwdDate(::date(msg.vfwd_date)) +, fwdFrom(App::user(msg.vfwd_from_id.v)) +, fwdFromName(4096) +, fwdFromVersion(fwdFrom->nameVersion) +, fromWidth(st::msgServiceFont->m.width(lang(lng_forwarded_from))) +{ fwdNameUpdated(); } -HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, MsgId id, HistoryMessage *msg) : - HistoryMessage(history, block, id, true, true, ::date(unixtime()), MTP::authedId(), msg->HistoryMessage::selectedText(FullItemSel), msg->getMedia()), - fwdFrom(dynamic_cast(msg) ? dynamic_cast(msg)->fromForwarded() : msg->from()), fwdFromVersion(fwdFrom->nameVersion), - fwdDate(dynamic_cast(msg) ? dynamic_cast(msg)->dateForwarded() : msg->date), - fromWidth(st::msgServiceFont->m.width(lang(lng_forwarded_from))), fwdFromName(4096) { +HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, MsgId id, HistoryMessage *msg) : HistoryMessage(history, block, id, true, true, ::date(unixtime()), MTP::authedId(), msg->HistoryMessage::selectedText(FullItemSel), msg->getMedia()) +, fwdDate(dynamic_cast(msg) ? dynamic_cast(msg)->dateForwarded() : msg->date) +, fwdFrom(dynamic_cast(msg) ? dynamic_cast(msg)->fromForwarded() : msg->from()) +, fwdFromName(4096) +, fwdFromVersion(fwdFrom->nameVersion) +, fromWidth(st::msgServiceFont->m.width(lang(lng_forwarded_from))) +{ fwdNameUpdated(); } @@ -2946,7 +3029,10 @@ QString HistoryServiceMsg::messageByAction(const MTPmessageAction &action, TextL } HistoryServiceMsg::HistoryServiceMsg(History *history, HistoryBlock *block, const MTPDmessageService &msg) : - HistoryItem(history, block, msg.vid.v, msg.vout.v, msg.vunread.v, ::date(msg.vdate), msg.vfrom_id.v), media(0), _text(st::msgMinWidth) { + HistoryItem(history, block, msg.vid.v, msg.vout.v, msg.vunread.v, ::date(msg.vdate), msg.vfrom_id.v) +, _text(st::msgMinWidth) +, media(0) +{ TextLinkPtr second; QString text(messageByAction(msg.vaction, second)); @@ -2976,7 +3062,10 @@ HistoryServiceMsg::HistoryServiceMsg(History *history, HistoryBlock *block, cons } /**/ HistoryServiceMsg::HistoryServiceMsg(History *history, HistoryBlock *block, MsgId msgId, QDateTime date, const QString &msg, bool out, bool unread, HistoryMedia *media) : - HistoryItem(history, block, msgId, out, unread, date, 0), media(media), _text(st::msgServiceFont, msg, _historySrvOptions, st::dlgMinWidth) { + HistoryItem(history, block, msgId, out, unread, date, 0) +, _text(st::msgServiceFont, msg, _historySrvOptions, st::dlgMinWidth) +, media(media) +{ _maxw = _text.maxWidth() + st::msgServicePadding.left() + st::msgServicePadding.right(); _minh = _text.minHeight(); } diff --git a/Telegram/SourceFiles/history.h b/Telegram/SourceFiles/history.h index bb965cc35..167f02219 100644 --- a/Telegram/SourceFiles/history.h +++ b/Telegram/SourceFiles/history.h @@ -57,7 +57,7 @@ struct ChatData; struct UserData; struct PeerData { PeerData(const PeerId &id); - ~PeerData() { + virtual ~PeerData() { if (notify != UnknownNotifySettings && notify != EmptyNotifySettings) { delete notify; notify = UnknownNotifySettings; @@ -212,7 +212,7 @@ enum FileStatus { struct VideoData { VideoData(const VideoId &id, const uint64 &access = 0, int32 user = 0, int32 date = 0, int32 duration = 0, int32 w = 0, int32 h = 0, const ImagePtr &thumb = ImagePtr(), int32 dc = 0, int32 size = 0) : - id(id), access(access), user(user), date(date), duration(duration), w(w), h(h), thumb(thumb), dc(dc), size(size), openOnSave(0), loader(0), fileType(0), status(FileReady), uploadOffset(0) { + id(id), access(access), user(user), date(date), duration(duration), w(w), h(h), thumb(thumb), dc(dc), size(size), status(FileReady), uploadOffset(0), fileType(0), openOnSave(0), loader(0) { memset(md5, 0, sizeof(md5)); } void forget() { @@ -314,7 +314,7 @@ public: struct AudioData { AudioData(const AudioId &id, const uint64 &access = 0, int32 user = 0, int32 date = 0, int32 duration = 0, int32 dc = 0, int32 size = 0) : - id(id), access(access), user(user), date(date), dc(dc), duration(duration), size(size), openOnSave(0), loader(0), status(FileReady), uploadOffset(0) { + id(id), access(access), user(user), date(date), duration(duration), dc(dc), size(size), status(FileReady), uploadOffset(0), openOnSave(0), loader(0) { memset(md5, 0, sizeof(md5)); } void forget() { @@ -412,7 +412,7 @@ public: struct DocumentData { DocumentData(const DocumentId &id, const uint64 &access = 0, int32 user = 0, int32 date = 0, const QString &name = QString(), const QString &mime = QString(), const ImagePtr &thumb = ImagePtr(), int32 dc = 0, int32 size = 0) : - id(id), access(access), user(user), date(date), name(name), mime(mime), thumb(thumb), dc(dc), size(size), openOnSave(0), loader(0), status(FileReady), uploadOffset(0) { + id(id), access(access), user(user), date(date), name(name), mime(mime), thumb(thumb), dc(dc), size(size), status(FileReady), uploadOffset(0), openOnSave(0), loader(0) { memset(md5, 0, sizeof(md5)); } void forget() { @@ -628,7 +628,7 @@ struct History : public QList { }; struct DialogsList { - DialogsList(bool sortByName) : end(&last), begin(&last), current(&last), byName(sortByName), count(0) { + DialogsList(bool sortByName) : begin(&last), end(&last), byName(sortByName), count(0), current(&last) { } void adjustCurrent(int32 y, int32 h) const { @@ -985,7 +985,7 @@ public: return _out; } bool unread() const { - if (_out && (id > 0 && id < _history->outboxReadTill) || !_out && id > 0 && id < _history->inboxReadTill) return false; + if ((_out && (id > 0 && id < _history->outboxReadTill)) || (!_out && id > 0 && id < _history->inboxReadTill)) return false; return _unread; } virtual bool needCheck() const { diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 5728114fc..d5dc43b19 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -30,13 +30,30 @@ Copyright (c) 2014 John Preston, https://tdesktop.com // flick scroll taken from http://qt-project.org/doc/qt-4.8/demos-embedded-anomaly-src-flickcharm-cpp.html -HistoryList::HistoryList(HistoryWidget *historyWidget, ScrollArea *scroll, History *history) : QWidget(0), - historyWidget(historyWidget), scrollArea(scroll), hist(history), currentBlock(0), currentItem(0), _menu(0), - _dragAction(NoDrag), _dragItem(0), _dragSelFrom(0), _dragSelTo(0), _dragSelecting(false), - _dragSelType(TextSelectLetters), _dragWasInactive(false), - _touchScroll(false), _touchSelect(false), _touchInProgress(false), - _touchScrollState(TouchScrollManual), _touchPrevPosValid(false), _touchWaitingAcceleration(false), _touchSpeedTime(0), _touchAccelerationTime(0), _touchTime(0), - _cursor(style::cur_default) { +HistoryList::HistoryList(HistoryWidget *historyWidget, ScrollArea *scroll, History *history) : QWidget(0) + , hist(history) + , historyWidget(historyWidget) + , scrollArea(scroll) + , currentBlock(0) + , currentItem(0) + , _cursor(style::cur_default) + , _dragAction(NoDrag) + , _dragSelType(TextSelectLetters) + , _dragItem(0) + , _dragWasInactive(false) + , _dragSelFrom(0) + , _dragSelTo(0) + , _dragSelecting(false) + , _touchScroll(false) + , _touchSelect(false) + , _touchInProgress(false) + , _touchScrollState(TouchScrollManual) + , _touchPrevPosValid(false) + , _touchWaitingAcceleration(false) + , _touchSpeedTime(0) + , _touchAccelerationTime(0) + , _touchTime(0) + , _menu(0) { linkTipTimer.setSingleShot(true); connect(&linkTipTimer, SIGNAL(timeout()), this, SLOT(showLinkTip())); @@ -167,8 +184,8 @@ void HistoryList::touchUpdateSpeed() { if (_touchScrollState == TouchScrollAuto) { const int oldSpeedY = _touchSpeed.y(); const int oldSpeedX = _touchSpeed.x(); - if ((oldSpeedY <= 0 && newSpeedY <= 0) || (oldSpeedY >= 0 && newSpeedY >= 0) - && (oldSpeedX <= 0 && newSpeedX <= 0) || (oldSpeedX >= 0 && newSpeedX >= 0)) { + if ((oldSpeedY <= 0 && newSpeedY <= 0) || ((oldSpeedY >= 0 && newSpeedY >= 0) + && (oldSpeedX <= 0 && newSpeedX <= 0)) || (oldSpeedX >= 0 && newSpeedX >= 0)) { _touchSpeed.setY(snap((oldSpeedY + (newSpeedY / 4)), -MaxScrollAccelerated, +MaxScrollAccelerated)); _touchSpeed.setX(snap((oldSpeedX + (newSpeedX / 4)), -MaxScrollAccelerated, +MaxScrollAccelerated)); } else { @@ -615,10 +632,10 @@ void HistoryList::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { _menu->addAction(lang(lng_context_save_image), this, SLOT(saveContextImage()))->setEnabled(true); _menu->addAction(lang(lng_context_copy_image), this, SLOT(copyContextImage()))->setEnabled(true); } else { - if (lnkVideo && lnkVideo->video()->loader || lnkAudio && lnkAudio->audio()->loader || lnkDocument && lnkDocument->document()->loader) { + if ((lnkVideo && lnkVideo->video()->loader) || (lnkAudio && lnkAudio->audio()->loader) || (lnkDocument && lnkDocument->document()->loader)) { _menu->addAction(lang(lng_context_cancel_download), this, SLOT(cancelContextDownload()))->setEnabled(true); } else { - if (lnkVideo && !lnkVideo->video()->already(true).isEmpty() || lnkAudio && !lnkAudio->audio()->already(true).isEmpty() || lnkDocument && !lnkDocument->document()->already(true).isEmpty()) { + if ((lnkVideo && !lnkVideo->video()->already(true).isEmpty()) || (lnkAudio && !lnkAudio->audio()->already(true).isEmpty()) || (lnkDocument && !lnkDocument->document()->already(true).isEmpty())) { _menu->addAction(lang(lng_context_show_in_folder), this, SLOT(showContextInFolder()))->setEnabled(true); } _menu->addAction(lang(lnkVideo ? lng_context_open_video : (lnkAudio ? lng_context_open_audio : lng_context_open_document)), this, SLOT(openContextFile()))->setEnabled(true); @@ -961,7 +978,7 @@ void HistoryList::fillSelectedItems(HistoryItemSet &sel, bool forDelete) { for (SelectedItems::const_iterator i = _selected.cbegin(), e = _selected.cend(); i != e; ++i) { HistoryItem *item = i.key(); - if (item->itemType() == HistoryItem::MsgType && (item->id > 0 && !item->serviceMsg() || forDelete)) { + if (item->itemType() == HistoryItem::MsgType && ((item->id > 0 && !item->serviceMsg()) || forDelete)) { sel.insert(item->y + item->block()->y, item); } } @@ -1031,15 +1048,15 @@ void HistoryList::onUpdateSelected(bool force) { _selected[_dragItem] = _dragItem->adjustSelection(qMin(second, _dragSymbol), qMax(second, _dragSymbol), _dragSelType); updateDragSelection(0, 0, false); } else { - bool selectingDown = (_dragItem->block()->y < item->block()->y) || (_dragItem->block() == item->block()) && (_dragItem->y < item->y || _dragItem == item && _dragStartPos.y() < m.y()); + bool selectingDown = (_dragItem->block()->y < item->block()->y) || ((_dragItem->block() == item->block()) && (_dragItem->y < item->y || (_dragItem == item && _dragStartPos.y() < m.y()))); HistoryItem *dragSelFrom = _dragItem, *dragSelTo = item; if (!dragSelFrom->hasPoint(_dragStartPos.x(), _dragStartPos.y())) { // maybe exclude dragSelFrom if (selectingDown) { - if (_dragStartPos.y() >= dragSelFrom->height() - st::msgMargin.bottom() || (item == dragSelFrom) && (m.y() < _dragStartPos.y() + QApplication::startDragDistance())) { + if (_dragStartPos.y() >= dragSelFrom->height() - st::msgMargin.bottom() || ((item == dragSelFrom) && (m.y() < _dragStartPos.y() + QApplication::startDragDistance()))) { dragSelFrom = (dragSelFrom == dragSelTo) ? 0 : nextItem(dragSelFrom); } } else { - if (_dragStartPos.y() < st::msgMargin.top() || (item == dragSelFrom) && (m.y() >= _dragStartPos.y() - QApplication::startDragDistance())) { + if (_dragStartPos.y() < st::msgMargin.top() || ((item == dragSelFrom) && (m.y() >= _dragStartPos.y() - QApplication::startDragDistance()))) { dragSelFrom = (dragSelFrom == dragSelTo) ? 0 : prevItem(dragSelFrom); } } @@ -1218,11 +1235,19 @@ void MessageField::focusInEvent(QFocusEvent *e) { emit focused(); } -HistoryHider::HistoryHider(MainWidget *parent, bool forwardSelected) : QWidget(parent), - aOpacity(0, 1), aOpacityFunc(anim::easeOutCirc), hiding(false), offered(0), _forwardRequest(0), - toTextWidth(0), _forwardSelected(forwardSelected), sharedContact(0), shadow(st::boxShadow), - forwardButton(this, lang(lng_forward), st::btnSelectDone), - cancelButton(this, lang(lng_cancel), st::btnSelectCancel) { +HistoryHider::HistoryHider(MainWidget *parent, bool forwardSelected) : QWidget(parent) + , sharedContact(0) + , _forwardSelected(forwardSelected) + , forwardButton(this, lang(lng_forward), st::btnSelectDone) + , cancelButton(this, lang(lng_cancel), st::btnSelectCancel) + , offered(0) + , aOpacity(0, 1) + , aOpacityFunc(anim::easeOutCirc) + , hiding(false) + , _forwardRequest(0) + , toTextWidth(0) + , shadow(st::boxShadow) +{ connect(&forwardButton, SIGNAL(clicked()), this, SLOT(forward())); connect(&cancelButton, SIGNAL(clicked()), this, SLOT(startHide())); @@ -1234,11 +1259,19 @@ HistoryHider::HistoryHider(MainWidget *parent, bool forwardSelected) : QWidget(p anim::start(this); } -HistoryHider::HistoryHider(MainWidget *parent, UserData *sharedContact) : QWidget(parent), - aOpacity(0, 1), aOpacityFunc(anim::easeOutCirc), hiding(false), offered(0), _forwardRequest(0), - toTextWidth(0), _forwardSelected(false), sharedContact(sharedContact), shadow(st::boxShadow), - forwardButton(this, lang(lng_forward), st::btnSelectDone), - cancelButton(this, lang(lng_cancel), st::btnSelectCancel) { +HistoryHider::HistoryHider(MainWidget *parent, UserData *sharedContact) : QWidget(parent) + , sharedContact(sharedContact) + , _forwardSelected(false) + , forwardButton(this, lang(lng_forward), st::btnSelectDone) + , cancelButton(this, lang(lng_cancel), st::btnSelectCancel) + , offered(0) + , aOpacity(0, 1) + , aOpacityFunc(anim::easeOutCirc) + , hiding(false) + , _forwardRequest(0) + , toTextWidth(0) + , shadow(st::boxShadow) +{ connect(&forwardButton, SIGNAL(clicked()), this, SLOT(forward())); connect(&cancelButton, SIGNAL(clicked()), this, SLOT(startHide())); @@ -1382,7 +1415,7 @@ void HistoryHider::resizeEvent(QResizeEvent *e) { void HistoryHider::offerPeer(PeerId peer) { offered = App::peer(peer); - toText.setText(st::boxFont, lang(sharedContact ? lng_forward_share_contact : lng_forward_confirm).replace(qsl("{recipient}"), offered->chat ? '«' + offered->name + '»' : offered->name), _textNameOptions); + toText.setText(st::boxFont, lang(sharedContact ? lng_forward_share_contact : lng_forward_confirm).replace(qsl("{recipient}"), offered->chat ? '\xAB' + offered->name + '\xBB' : offered->name), _textNameOptions); toTextWidth = toText.maxWidth(); if (toTextWidth > box.width() - st::boxPadding.left() - st::boxPadding.right()) { toTextWidth = box.width() - st::boxPadding.left() - st::boxPadding.right(); @@ -1402,14 +1435,38 @@ HistoryHider::~HistoryHider() { parent()->noHider(this); } -HistoryWidget::HistoryWidget(QWidget *parent) : QWidget(parent), noTypingUpdate(false), serviceImageCacheSize(0), - _scroll(this, st::historyScroll, false), _list(0), histPeer(0), _activePeer(0), histOffset(0), histCount(-1), - hist(0), histPreloading(0), histReadRequestId(0), hiderOffered(false), _histInited(false), - _send(this, lang(lng_send_button), st::btnSend), histRequestsCount(0), - _attachDocument(this, st::btnAttachDocument), _attachPhoto(this, st::btnAttachPhoto), _attachEmoji(this, st::btnAttachEmoji), - confirmImageId(0), loadingChatId(0), loadingRequestId(0), titlePeerTextWidth(0), - _field(this, st::taMsgField, lang(lng_message_ph)), bg(st::msgBG), imageLoader(this), - _attachType(this), _emojiPan(this), _attachDrag(DragStateNone), _attachDragDocument(this), _attachDragPhoto(this), _scrollDelta(0) { +HistoryWidget::HistoryWidget(QWidget *parent) : QWidget(parent) + , histOffset(0) + , histCount(-1) + , histReadRequestId(0) + , histRequestsCount(0) + , histPeer(0) + , _activePeer(0) + , histPreloading(0) + , _scroll(this, st::historyScroll, false) + , _list(0) + , hist(0) + , _histInited(false) + , _send(this, lang(lng_send_button), st::btnSend) + , _attachDocument(this, st::btnAttachDocument) + , _attachPhoto(this, st::btnAttachPhoto) + , _attachEmoji(this, st::btnAttachEmoji) + , _field(this, st::taMsgField, lang(lng_message_ph)) + , _attachType(this) + , _emojiPan(this) + , _attachDrag(DragStateNone) + , _attachDragDocument(this) + , _attachDragPhoto(this) + , imageLoader(this) + , noTypingUpdate(false) + , loadingChatId(0) + , loadingRequestId(0) + , serviceImageCacheSize(0) + , confirmImageId(0) + , titlePeerTextWidth(0) + , bg(st::msgBG) + , hiderOffered(false) + , _scrollDelta(0) { _scroll.setFocusPolicy(Qt::NoFocus); setAcceptDrops(true); @@ -1462,7 +1519,7 @@ void HistoryWidget::onTextChange() { void HistoryWidget::updateTyping(bool typing) { uint64 ms = getms() + 10000; - if (noTypingUpdate || !hist || typing && (hist->myTyping + 5000 > ms) || !typing && (hist->myTyping + 5000 <= ms)) return; + if (noTypingUpdate || !hist || (typing && (hist->myTyping + 5000 > ms)) || (!typing && (hist->myTyping + 5000 <= ms))) return; hist->myTyping = typing ? ms : 0; if (typing) MTP::send(MTPmessages_SetTyping(histPeer->input, MTP_bool(typing))); @@ -1877,7 +1934,7 @@ void HistoryWidget::loadMessages() { void HistoryWidget::onListScroll() { App::checkImageCacheSize(); - if (histPreloading || !hist || (_list->isHidden() || _scroll.isHidden() || !App::wnd()->windowHandle()->isVisible()) && hist->unreadLoaded) { + if (histPreloading || !hist || ((_list->isHidden() || _scroll.isHidden() || !App::wnd()->windowHandle()->isVisible()) && hist->unreadLoaded)) { checkUnreadLoaded(true); return; } @@ -1951,7 +2008,7 @@ mtpRequestId HistoryWidget::onForward(const PeerId &peer, bool forwardSelected) newId = clientMsgId(); hist->addToBackForwarded(newId, msg); MTP::send(MTPmessages_ForwardMessage(histPeer->input, MTP_int(item->id), MTP_long(randomId)), App::main()->rpcDone(&MainWidget::sentFullDataReceived, randomId)); - } else if (srv || msg && msg->selectedText(FullItemSel).isEmpty()) { + } else if (srv || (msg && msg->selectedText(FullItemSel).isEmpty())) { // newId = clientMsgId(); // MTP::send(MTPmessages_ForwardMessage(histPeer->input, MTP_int(item->id), MTP_long(randomId)), App::main()->rpcDone(&MainWidget::sentFullDataReceived, randomId)); } else if (msg) { @@ -2407,7 +2464,6 @@ void HistoryWidget::onPhotoReady() { } void HistoryWidget::onPhotoFailed(quint64 id) { - id = id; } void HistoryWidget::confirmSendImage(const ReadyLocalMedia &img) { @@ -2545,7 +2601,7 @@ void HistoryWidget::resizeEvent(QResizeEvent *e) { } void HistoryWidget::updateListSize(int32 addToY, bool initial) { - if (!hist || !_histInited && !initial) return; + if (!hist || (!_histInited && !initial)) return; if (!App::wnd()->isVisible()) return; // scrollTopMax etc are not working after recountHeight() @@ -2788,8 +2844,8 @@ void HistoryWidget::paintEvent(QPaintEvent *e) { // points p.setOpacity(st::introPointAlpha); - int x = pointsLeft + st::introPointLeft; - for (uint32 i = 0; i < pointsCount; ++i) { + int32 x = pointsLeft + st::introPointLeft; + for (int32 i = 0; i < pointsCount; ++i) { p.fillRect(x, pointsTop + st::introPointTop, st::introPointWidth, st::introPointHeight, st::introPointColor->b); x += (st::introPointWidth + 2 * st::introPointDelta); } diff --git a/Telegram/SourceFiles/intro/intro.cpp b/Telegram/SourceFiles/intro/intro.cpp index 6b1eed49a..9e9416a64 100644 --- a/Telegram/SourceFiles/intro/intro.cpp +++ b/Telegram/SourceFiles/intro/intro.cpp @@ -45,8 +45,8 @@ namespace { } IntroWidget::IntroWidget(Window *window) : QWidget(window), - wnd(window), cacheForHideInd(0), cacheForShowInd(0), _callTimeout(60), - steps(new IntroSteps(this)), phone(0), code(0), signup(0), current(0), moving(0), visibilityChanging(0) { + cacheForHideInd(0), cacheForShowInd(0), wnd(window), steps(new IntroSteps(this)), + phone(0), code(0), signup(0), current(0), moving(0), visibilityChanging(0), _callTimeout(60) { setGeometry(QRect(0, st::titleHeight, wnd->width(), wnd->height() - st::titleHeight)); countryForReg = psCurrentCountry(); diff --git a/Telegram/SourceFiles/intro/introcode.cpp b/Telegram/SourceFiles/intro/introcode.cpp index 371c07978..5da3d88d0 100644 --- a/Telegram/SourceFiles/intro/introcode.cpp +++ b/Telegram/SourceFiles/intro/introcode.cpp @@ -67,10 +67,10 @@ void CodeInput::correctValue(QKeyEvent *e, const QString &was) { if (strict) emit codeEntered(); } -IntroCode::IntroCode(IntroWidget *parent) : IntroStage(parent), +IntroCode::IntroCode(IntroWidget *parent) : IntroStage(parent), errorAlpha(0), next(this, lang(lng_intro_next), st::btnIntroNext), back(this, lang(lng_intro_back), st::btnIntroBack), - code(this, st::inpIntroCode, lang(lng_code_ph)), errorAlpha(0), waitTillCall(intro()->getCallTimeout()) { + code(this, st::inpIntroCode, lang(lng_code_ph)), waitTillCall(intro()->getCallTimeout()) { setVisible(false); setGeometry(parent->innerRect()); diff --git a/Telegram/SourceFiles/intro/introphone.cpp b/Telegram/SourceFiles/intro/introphone.cpp index 4ee34782f..f7905d43f 100644 --- a/Telegram/SourceFiles/intro/introphone.cpp +++ b/Telegram/SourceFiles/intro/introphone.cpp @@ -40,10 +40,13 @@ namespace { }; } -IntroPhone::IntroPhone(IntroWidget *parent) : IntroStage(parent), changed(false), +IntroPhone::IntroPhone(IntroWidget *parent) : IntroStage(parent), + errorAlpha(0), changed(false), next(this, lang(lng_intro_next), st::btnIntroStart), - country(this, st::introCountry), errorAlpha(0), _signup(this, lang(lng_phone_notreg).replace(qsl("{signup}"), textcmdStartLink(1)).replace(qsl("{/signup}"), textcmdStopLink()), st::introErrLabel), _showSignup(false), - phone(this, st::inpIntroPhone, lang(lng_phone_ph)), code(this, st::inpIntroCountryCode) { + country(this, st::introCountry), + phone(this, st::inpIntroPhone, lang(lng_phone_ph)), code(this, st::inpIntroCountryCode), + _signup(this, lang(lng_phone_notreg).replace(qsl("{signup}"), textcmdStartLink(1)).replace(qsl("{/signup}"), textcmdStopLink()), st::introErrLabel), + _showSignup(false) { setVisible(false); setGeometry(parent->innerRect()); diff --git a/Telegram/SourceFiles/intro/introsignup.cpp b/Telegram/SourceFiles/intro/introsignup.cpp index 29986a1be..f4547fb94 100644 --- a/Telegram/SourceFiles/intro/introsignup.cpp +++ b/Telegram/SourceFiles/intro/introsignup.cpp @@ -28,7 +28,8 @@ Copyright (c) 2014 John Preston, https://tdesktop.com #include "intro/intro.h" IntroSignup::IntroSignup(IntroWidget *parent) : IntroStage(parent), - next(this, lang(lng_intro_finish), st::btnIntroFinish), errorAlpha(0), a_photo(0), + errorAlpha(0), a_photo(0), + next(this, lang(lng_intro_finish), st::btnIntroFinish), first(this, st::inpIntroName, lang(lng_signup_firstname)), last(this, st::inpIntroName, lang(lng_signup_lastname)) { setVisible(false); diff --git a/Telegram/SourceFiles/langloaderplain.cpp b/Telegram/SourceFiles/langloaderplain.cpp index 8286e0a4c..b7a555444 100644 --- a/Telegram/SourceFiles/langloaderplain.cpp +++ b/Telegram/SourceFiles/langloaderplain.cpp @@ -66,7 +66,7 @@ namespace { if (!skipJunk(from, end)) return false; const char *nameStart = from; - while (from < end && (*from >= 'a' && *from <= 'z' || *from >= 'A' && *from <= 'Z' || *from == '_' || *from >= '0' && *from <= '9')) { + while (from < end && ((*from >= 'a' && *from <= 'z') || (*from >= 'A' && *from <= 'Z') || *from == '_' || (*from >= '0' && *from <= '9'))) { ++from; } diff --git a/Telegram/SourceFiles/layerwidget.cpp b/Telegram/SourceFiles/layerwidget.cpp index 86421e353..ff8e33ec2 100644 --- a/Telegram/SourceFiles/layerwidget.cpp +++ b/Telegram/SourceFiles/layerwidget.cpp @@ -126,9 +126,23 @@ BackgroundWidget::~BackgroundWidget() { if (_hidden) _hidden->deleteLater(); } -LayerWidget::LayerWidget(QWidget *parent, PhotoData *photo, HistoryItem *item) : QWidget(parent), photo(photo), video(0), - aBackground(0), aOver(0), iX(App::wnd()->width() / 2), iY(App::wnd()->height() / 2), iW(0), iCoordFunc(anim::sineInOut), aOverFunc(anim::linear), aBackgroundFunc(anim::easeOutCirc), hiding(false), - _touchPress(false), _touchMove(false), _touchRightButton(false), _menu(0) { +LayerWidget::LayerWidget(QWidget *parent, PhotoData *photo, HistoryItem *item) : QWidget(parent) +, photo(photo) +, video(0) +, aBackground(0) +, aOver(0) +, iX(App::wnd()->width() / 2) +, iY(App::wnd()->height() / 2) +, iW(0) +, iCoordFunc(anim::sineInOut) +, aBackgroundFunc(anim::easeOutCirc) +, aOverFunc(anim::linear) +, hiding(false) +, _touchPress(false) +, _touchMove(false) +, _touchRightButton(false) +, _menu(0) +{ int32 x, y, w; if (App::wnd()->getPhotoCoords(photo, x, y, w)) { iX = anim::ivalue(x); @@ -149,9 +163,23 @@ LayerWidget::LayerWidget(QWidget *parent, PhotoData *photo, HistoryItem *item) : connect(&_touchTimer, SIGNAL(timeout()), this, SLOT(onTouchTimer())); } -LayerWidget::LayerWidget(QWidget *parent, VideoData *video, HistoryItem *item) : QWidget(parent), photo(0), video(video), - aBackground(0), aOver(0), iX(App::wnd()->width() / 2), iY(App::wnd()->height() / 2), iW(0), iCoordFunc(anim::sineInOut), aOverFunc(anim::linear), aBackgroundFunc(anim::easeOutCirc), hiding(false), - _touchPress(false), _touchMove(false), _touchRightButton(false), _menu(0) { +LayerWidget::LayerWidget(QWidget *parent, VideoData *video, HistoryItem *item) : QWidget(parent) +, photo(0) +, video(video) +, aBackground(0) +, aOver(0) +, iX(App::wnd()->width() / 2) +, iY(App::wnd()->height() / 2) +, iW(0) +, iCoordFunc(anim::sineInOut) +, aBackgroundFunc(anim::easeOutCirc) +, aOverFunc(anim::linear) +, hiding(false) +, _touchPress(false) +, _touchMove(false) +, _touchRightButton(false) +, _menu(0) +{ int32 x, y, w; if (App::wnd()->getVideoCoords(video, x, y, w)) { iX = anim::ivalue(x); @@ -279,7 +307,7 @@ void LayerWidget::keyPressEvent(QKeyEvent *e) { photo->full->pix().toImage().save(file, "JPG"); } } - } else if (photo && photo->full->loaded() && (e->key() == Qt::Key_Copy || e->key() == Qt::Key_C && e->modifiers().testFlag(Qt::ControlModifier))) { + } else if (photo && photo->full->loaded() && (e->key() == Qt::Key_Copy || (e->key() == Qt::Key_C && e->modifiers().testFlag(Qt::ControlModifier)))) { QApplication::clipboard()->setPixmap(photo->full->pix()); } } @@ -304,7 +332,7 @@ void LayerWidget::contextMenuEvent(QContextMenuEvent *e) { _menu->addAction(lang(lng_context_forward_image), this, SLOT(forwardMessage()))->setEnabled(true); } _menu->addAction(lang(lng_context_delete_image), this, SLOT(deleteMessage()))->setEnabled(true); - } else if (App::self() && App::self()->photoId == photo->id || photo->chat && photo->chat->photoId == photo->id) { + } else if ((App::self() && App::self()->photoId == photo->id) || (photo->chat && photo->chat->photoId == photo->id)) { _menu->addAction(lang(lng_context_delete_image), this, SLOT(deleteMessage()))->setEnabled(true); } _menu->setAttribute(Qt::WA_DeleteOnClose); diff --git a/Telegram/SourceFiles/localimageloader.cpp b/Telegram/SourceFiles/localimageloader.cpp index ed6d97b85..8b180efc2 100644 --- a/Telegram/SourceFiles/localimageloader.cpp +++ b/Telegram/SourceFiles/localimageloader.cpp @@ -19,7 +19,10 @@ Copyright (c) 2014 John Preston, https://tdesktop.com #include "localimageloader.h" #include -LocalImageLoaderPrivate::LocalImageLoaderPrivate(int32 currentUser, LocalImageLoader *loader, QThread *thread) : QObject(0), user(currentUser), loader(loader) { +LocalImageLoaderPrivate::LocalImageLoaderPrivate(int32 currentUser, LocalImageLoader *loader, QThread *thread) : QObject(0) + , loader(loader) + , user(currentUser) +{ moveToThread(thread); connect(loader, SIGNAL(needToPrepare()), this, SLOT(prepareImages())); connect(this, SIGNAL(imageReady()), loader, SLOT(onImageReady())); @@ -101,7 +104,7 @@ void LocalImageLoaderPrivate::prepareImages() { filesize = 0; } - if (img.isNull() && (type != ToPrepareDocument || !filesize) || type == ToPrepareAuto || img.isNull() && file.isEmpty() && data.isEmpty()) { // if could not decide what type + if ((img.isNull() && (type != ToPrepareDocument || !filesize)) || type == ToPrepareAuto || (img.isNull() && file.isEmpty() && data.isEmpty())) { // if could not decide what type { QMutexLocker lock(loader->toPrepareMutex()); ToPrepareMedias &list(loader->toPrepareMedias()); diff --git a/Telegram/SourceFiles/localimageloader.h b/Telegram/SourceFiles/localimageloader.h index a0cf22097..ff5449ecd 100644 --- a/Telegram/SourceFiles/localimageloader.h +++ b/Telegram/SourceFiles/localimageloader.h @@ -25,11 +25,11 @@ enum ToPrepareMediaType { }; struct ToPrepareMedia { - ToPrepareMedia(const QString &file, const PeerId &peer, ToPrepareMediaType t) : file(file), peer(peer), id(MTP::nonce()), type(t) { + ToPrepareMedia(const QString &file, const PeerId &peer, ToPrepareMediaType t) : id(MTP::nonce()), file(file), peer(peer), type(t) { } - ToPrepareMedia(const QImage &img, const PeerId &peer, ToPrepareMediaType t) : img(img), peer(peer), id(MTP::nonce()), type(t) { + ToPrepareMedia(const QImage &img, const PeerId &peer, ToPrepareMediaType t) : id(MTP::nonce()), img(img), peer(peer), type(t) { } - ToPrepareMedia(const QByteArray &data, const PeerId &peer, ToPrepareMediaType t) : data(data), peer(peer), id(MTP::nonce()), type(t) { + ToPrepareMedia(const QByteArray &data, const PeerId &peer, ToPrepareMediaType t) : id(MTP::nonce()), data(data), peer(peer), type(t) { } PhotoId id; QString file; @@ -43,7 +43,7 @@ typedef QList ToPrepareMedias; typedef QMap LocalFileParts; struct ReadyLocalMedia { ReadyLocalMedia(ToPrepareMediaType type, const QString &file, const QString &filename, int32 filesize, const QByteArray &data, const uint64 &id, const uint64 &jpeg_id, const PeerId &peer, const MTPPhoto &photo, const PreparedPhotoThumbs &photoThumbs, const MTPDocument &document, const QByteArray &jpeg) : - type(type), file(file), filename(filename), filesize(filesize), data(data), id(id), jpeg_id(jpeg_id), peer(peer), photo(photo), photoThumbs(photoThumbs), document(document) { + type(type), file(file), filename(filename), filesize(filesize), data(data), id(id), jpeg_id(jpeg_id), peer(peer), photo(photo), document(document), photoThumbs(photoThumbs) { if (!jpeg.isEmpty()) { int32 size = jpeg.size(); for (int32 i = 0, part = 0; i < size; i += UploadPartSize, ++part) { diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 457d2bda5..efc3f94a4 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -260,9 +260,9 @@ MainWidget *TopBarWidget::main() { return static_cast(parentWidget()); } -MainWidget::MainWidget(Window *window) : QWidget(window), profile(0), _dialogsWidth(st::dlgMinWidth), - updPts(0), updDate(0), updQts(0), updSeq(0), updInited(false), failedObjId(0), - dialogs(this), history(this), onlineRequest(0), hider(0), _topBar(this) { +MainWidget::MainWidget(Window *window) : QWidget(window), failedObjId(0), _dialogsWidth(st::dlgMinWidth), + dialogs(this), history(this), profile(0), _topBar(this), hider(0), + updPts(0), updDate(0), updQts(0), updSeq(0), updInited(false), onlineRequest(0) { setGeometry(QRect(0, st::titleHeight, App::wnd()->width(), App::wnd()->height() - st::titleHeight)); connect(window, SIGNAL(resized(const QSize &)), this, SLOT(onParentResize(const QSize &))); @@ -358,7 +358,7 @@ void MainWidget::dialogsActivate() { bool MainWidget::leaveChatFailed(PeerData *peer, const RPCError &e) { if (e.type() == "CHAT_ID_INVALID") { // left this chat already - if (profile && profile->peer() == peer || profileStack.indexOf(peer) >= 0 || history.peer() == peer) { + if ((profile && profile->peer() == peer) || profileStack.indexOf(peer) >= 0 || history.peer() == peer) { showPeer(0); } dialogs.removePeer(peer); @@ -370,7 +370,7 @@ bool MainWidget::leaveChatFailed(PeerData *peer, const RPCError &e) { void MainWidget::deleteHistory(PeerData *peer, const MTPmessages_StatedMessage &result) { sentFullDataReceived(0, result); - if (profile && profile->peer() == peer || profileStack.indexOf(peer) >= 0 || history.peer() == peer) { + if ((profile && profile->peer() == peer) || profileStack.indexOf(peer) >= 0 || history.peer() == peer) { showPeer(0); } dialogs.removePeer(peer); @@ -398,7 +398,7 @@ void MainWidget::deleteHistoryAndContact(UserData *user, const MTPcontacts_Link App::feedUsers(MTP_vector(QVector(1, d.vuser))); App::feedUserLink(MTP_int(user->id & 0xFFFFFFFF), d.vmy_link, d.vforeign_link); - if (profile && profile->peer() == user || profileStack.indexOf(user) >= 0 || history.peer() == user) { + if ((profile && profile->peer() == user) || profileStack.indexOf(user) >= 0 || history.peer() == user) { showPeer(0); } dialogs.removePeer(user); @@ -472,7 +472,7 @@ void MainWidget::checkedHistory(PeerData *peer, const MTPmessages_Messages &resu if (!v) return; if (v->isEmpty()) { - if (profile && profile->peer() == peer || profileStack.indexOf(peer) >= 0 || history.peer() == peer) { + if ((profile && profile->peer() == peer) || profileStack.indexOf(peer) >= 0 || history.peer() == peer) { showPeer(0); } dialogs.removePeer(peer); @@ -1113,7 +1113,7 @@ void MainWidget::onTopBarClick() { } void MainWidget::onPeerShown(PeerData *peer) { - if (profile || peer && peer->id) { + if (profile || (peer && peer->id)) { _topBar.show(); } else { _topBar.hide(); diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index dc7d85db3..491365a9c 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -25,7 +25,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com #include "profilewidget.h" class Window; -class DialogRow; +struct DialogRow; class MainWidget; class TopBarWidget : public QWidget, public Animated { diff --git a/Telegram/SourceFiles/mtproto/mtp.cpp b/Telegram/SourceFiles/mtproto/mtp.cpp index a6df55806..f3d5f0052 100644 --- a/Telegram/SourceFiles/mtproto/mtp.cpp +++ b/Telegram/SourceFiles/mtproto/mtp.cpp @@ -483,7 +483,7 @@ namespace MTP { if (!started) return; int32 m = mainSession->getDC(); - if (!dc || m == dc || m && fromZeroOnly) return; + if (!dc || m == dc || (m && fromZeroOnly)) return; mtpSetDC(dc); mainSession = _mtp_internal::getSession(dc); } diff --git a/Telegram/SourceFiles/mtproto/mtpConnection.cpp b/Telegram/SourceFiles/mtproto/mtpConnection.cpp index c11fac3a0..a114c0f57 100644 --- a/Telegram/SourceFiles/mtproto/mtpConnection.cpp +++ b/Telegram/SourceFiles/mtproto/mtpConnection.cpp @@ -517,7 +517,7 @@ namespace { } MTPabstractTcpConnection::MTPabstractTcpConnection() : -currentPos((char*)shortBuffer), packetRead(0), packetLeft(0), readingToShort(true), packetNum(0) { +packetNum(0), packetRead(0), packetLeft(0), readingToShort(true), currentPos((char*)shortBuffer) { } void MTPabstractTcpConnection::socketRead() { @@ -1033,22 +1033,22 @@ void MTProtoConnectionPrivate::createConn() { MTProtoConnectionPrivate::MTProtoConnectionPrivate(QThread *thread, MTProtoConnection *owner, MTPSessionData *data, uint32 _dc) : QObject(0) - , dc(_dc) - , conn(0) - , retryTimeout(1) - , receiveDelay(MinReceiveDelay) - , firstSentAt(-1) - , oldConnection(true) , _state(MTProtoConnection::Disconnected) - , _owner(owner) - , sessionData(data) - , keyId(0) - , pingId(0) - , toSendPingId(0) - , pingMsgId(0) - , restarted(false) + , dc(_dc) + , _owner(owner) + , conn(0) + , retryTimeout(1) + , oldConnection(true) + , receiveDelay(MinReceiveDelay) + , firstSentAt(-1) , ackRequest(MTP_msgs_ack(MTPVector())) - , myKeyLock(false) + , pingId(0) + , toSendPingId(0) + , pingMsgId(0) + , restarted(false) + , keyId(0) + , sessionData(data) + , myKeyLock(false) , authKeyData(0) { ackRequestData = &ackRequest._msgs_ack().vmsg_ids._vector().v; @@ -1405,7 +1405,7 @@ void MTProtoConnectionPrivate::onReceivedSome() { int32 ms = getms() - firstSentAt; DEBUG_LOG(("MTP Info: response in %1ms, receiveDelay: %2ms").arg(ms).arg(receiveDelay)); - if (ms > 0 && ms * 2 < receiveDelay) receiveDelay = qMax(ms * 2, int32(MinReceiveDelay)); + if (ms > 0 && ms * 2 < int32(receiveDelay)) receiveDelay = qMax(ms * 2, int32(MinReceiveDelay)); firstSentAt = -1; } } @@ -1502,7 +1502,7 @@ void MTProtoConnectionPrivate::handleReceived() { uint32 seqNo = *(uint32*)&data[6], msgLen = *(uint32*)&data[7]; bool needAck = (seqNo & 0x01); - if (dataBuffer.size() < msgLen + 8 * sizeof(mtpPrime) || (msgLen & 0x03)) { + if (uint32(dataBuffer.size()) < msgLen + 8 * sizeof(mtpPrime) || (msgLen & 0x03)) { LOG(("TCP Error: bad msg_len received %1, data size: %2").arg(msgLen).arg(dataBuffer.size())); TCP_LOG(("TCP Error: bad message %1").arg(mb(encrypted, len * sizeof(mtpPrime)).str())); conn->received().pop_front(); @@ -1987,7 +1987,7 @@ int32 MTProtoConnectionPrivate::handleOneReceived(const mtpPrime *from, const mt } mtpRequestId requestId = wasSent(reqMsgId.v); - if (requestId && requestId != 0xFFFFFFFF) { + if (requestId && requestId != mtpRequestId(0xFFFFFFFF)) { QWriteLocker locker(sessionData->haveReceivedMutex()); sessionData->haveReceivedMap().insert(requestId, response); // save rpc_result for processing in main mtp thread } else { @@ -2899,12 +2899,12 @@ bool MTProtoConnectionPrivate::sendRequest(mtpRequest &request, bool needAnyResp } mtpRequestId MTProtoConnectionPrivate::wasSent(mtpMsgId msgId) const { - if (msgId == pingMsgId) return 0xFFFFFFFF; + if (msgId == pingMsgId) return mtpRequestId(0xFFFFFFFF); { QReadLocker locker(sessionData->haveSentMutex()); const mtpRequestMap &haveSent(sessionData->haveSentMap()); mtpRequestMap::const_iterator i = haveSent.constFind(msgId); - if (i != haveSent.cend()) return i.value()->requestId || 0xFFFFFFFF; + if (i != haveSent.cend()) return i.value()->requestId ? i.value()->requestId : mtpRequestId(0xFFFFFFFF); } { QReadLocker locker(sessionData->toResendMutex()); diff --git a/Telegram/SourceFiles/mtproto/mtpDC.cpp b/Telegram/SourceFiles/mtproto/mtpDC.cpp index 0116805fc..699f74cd5 100644 --- a/Telegram/SourceFiles/mtproto/mtpDC.cpp +++ b/Telegram/SourceFiles/mtproto/mtpDC.cpp @@ -84,7 +84,7 @@ namespace { continue; } uint32 dataLen = *(const uint32*)decrypted.constData(); - if (dataLen > decrypted.size() || dataLen <= fullDataLen - 16 || dataLen < 4) { + if (dataLen > uint32(decrypted.size()) || dataLen <= fullDataLen - 16 || dataLen < 4) { LOG(("MTP Error: bad decrypted part size: %1, fullDataLen: %2, decrypted size: %3").arg(dataLen).arg(fullDataLen).arg(decrypted.size())); continue; } @@ -200,7 +200,7 @@ namespace { DEBUG_LOG(("MTP Info: keys file opened for reading")); int32 oldFound = readAuthKeys(keysFile); - if (gDCOptions.isEmpty() || mainDC && gDCOptions.find(mainDC) == gDCOptions.cend()) { // load first dc info + if (gDCOptions.isEmpty() || (mainDC && gDCOptions.find(mainDC) == gDCOptions.cend())) { // load first dc info gDCOptions.insert(1, mtpDcOption(1, "", cFirstDCIp(), cFirstDCPort())); userId = 0; mainDC = 0; diff --git a/Telegram/SourceFiles/mtproto/mtpFileLoader.cpp b/Telegram/SourceFiles/mtproto/mtpFileLoader.cpp index c6f57145c..f441bbd03 100644 --- a/Telegram/SourceFiles/mtproto/mtpFileLoader.cpp +++ b/Telegram/SourceFiles/mtproto/mtpFileLoader.cpp @@ -34,8 +34,10 @@ namespace { LoaderQueues queues; } -mtpFileLoader::mtpFileLoader(int32 dc, const int64 &volume, int32 local, const int64 &secret) : next(0), prev(0), inQueue(false), complete(false), requestId(0), priority(0), initialSize(0), - dc(dc), volume(volume), local(local), secret(secret), size(0), type(MTP_storage_fileUnknown()), locationType(0), id(0), access(0) { +mtpFileLoader::mtpFileLoader(int32 dc, const int64 &volume, int32 local, const int64 &secret) : prev(0), next(0), + priority(0), inQueue(false), complete(false), requestId(0), + dc(dc), locationType(0), volume(volume), local(local), secret(secret), + id(0), access(0), initialSize(0), size(0), type(MTP_storage_fileUnknown()) { LoaderQueues::iterator i = queues.find(dc); if (i == queues.cend()) { i = queues.insert(dc, mtpFileLoaderQueue()); @@ -43,8 +45,10 @@ mtpFileLoader::mtpFileLoader(int32 dc, const int64 &volume, int32 local, const i queue = &i.value(); } -mtpFileLoader::mtpFileLoader(int32 dc, const uint64 &id, const uint64 &access, mtpTypeId locType, const QString &to, int32 size) : next(0), prev(0), inQueue(false), complete(false), requestId(0), priority(0), - dc(dc), id(id), access(access), type(MTP_storage_fileUnknown()), locationType(locType), file(to), initialSize(size) { +mtpFileLoader::mtpFileLoader(int32 dc, const uint64 &id, const uint64 &access, mtpTypeId locType, const QString &to, int32 size) : prev(0), next(0), + priority(0), inQueue(false), complete(false), requestId(0), + dc(dc), locationType(locType), + id(id), access(access), file(to), initialSize(size), type(MTP_storage_fileUnknown()) { LoaderQueues::iterator i = queues.find(MTP::dld + dc); if (i == queues.cend()) { i = queues.insert(MTP::dld + dc, mtpFileLoaderQueue()); @@ -145,7 +149,7 @@ void mtpFileLoader::partLoaded(int32 offset, const MTPupload_File &result) { const string &bytes(d.vbytes.c_string().v); if (bytes.size()) { if (file.isOpen()) { - if (file.write(bytes.data(), bytes.size()) != bytes.size()) { + if (file.write(bytes.data(), bytes.size()) != qint64(bytes.size())) { return finishFail(); } } else { @@ -318,7 +322,7 @@ bool mtpFileLoader::loading() const { } void mtpFileLoader::started(bool loadFirst, bool prior) { - if (queue->queries >= MaxFileQueries && (!loadFirst || !prior) || complete) return; + if ((queue->queries >= MaxFileQueries && (!loadFirst || !prior)) || complete) return; loadPart(); } diff --git a/Telegram/SourceFiles/mtproto/mtpRPC.h b/Telegram/SourceFiles/mtproto/mtpRPC.h index fdf3d8e26..8fa3a8886 100644 --- a/Telegram/SourceFiles/mtproto/mtpRPC.h +++ b/Telegram/SourceFiles/mtproto/mtpRPC.h @@ -457,7 +457,7 @@ class RPCBindedDoneHandlerOwned : public RPCOwnedDoneHandler { // done(b, result typedef TReturn (TReceiver::*CallbackType)(T, const TResponse &); public: - RPCBindedDoneHandlerOwned(T b, TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _b(b), _onDone(onDone) { + RPCBindedDoneHandlerOwned(T b, TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _onDone(onDone), _b(b) { } virtual void operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) const { if (_owner) (static_cast(_owner)->*_onDone)(_b, TResponse(from, end)); @@ -589,7 +589,7 @@ class RPCBindedFailHandlerOwned : public RPCOwnedFailHandler { // fail(b, error) typedef bool (TReceiver::*CallbackType)(T, const RPCError &); public: - RPCBindedFailHandlerOwned(T b, TReceiver *receiver, CallbackType onFail) : RPCOwnedFailHandler(receiver), _b(b), _onFail(onFail) { + RPCBindedFailHandlerOwned(T b, TReceiver *receiver, CallbackType onFail) : RPCOwnedFailHandler(receiver), _onFail(onFail), _b(b) { } virtual bool operator()(mtpRequestId requestId, const RPCError &e) const { return _owner ? (static_cast(_owner)->*_onFail)(_b, e) : true; @@ -623,7 +623,7 @@ class RPCBindedFailHandlerOwnedNo : public RPCOwnedFailHandler { // fail(b) typedef bool (TReceiver::*CallbackType)(T); public: - RPCBindedFailHandlerOwnedNo(T b, TReceiver *receiver, CallbackType onFail) : RPCOwnedFailHandler(receiver), _b(b), _onFail(onFail) { + RPCBindedFailHandlerOwnedNo(T b, TReceiver *receiver, CallbackType onFail) : RPCOwnedFailHandler(receiver), _onFail(onFail), _b(b) { } virtual bool operator()(mtpRequestId requestId, const RPCError &e) const { return _owner ? (static_cast(_owner)->*_onFail)(_b) : true; @@ -640,7 +640,7 @@ class RPCBindedFailHandlerOwnedNoReq : public RPCOwnedFailHandler { // fail(b, r typedef bool (TReceiver::*CallbackType)(T, mtpRequestId); public: - RPCBindedFailHandlerOwnedNoReq(T b, TReceiver *receiver, CallbackType onFail) : RPCOwnedFailHandler(receiver), _b(b), _onFail(onFail) { + RPCBindedFailHandlerOwnedNoReq(T b, TReceiver *receiver, CallbackType onFail) : RPCOwnedFailHandler(receiver), _onFail(onFail), _b(b) { } virtual bool operator()(mtpRequestId requestId, const RPCError &e) const { return _owner ? (static_cast(_owner)->*_onFail)(_b, requestId) : true; diff --git a/Telegram/SourceFiles/mtproto/mtpSession.cpp b/Telegram/SourceFiles/mtproto/mtpSession.cpp index c510769b6..0a69076bb 100644 --- a/Telegram/SourceFiles/mtproto/mtpSession.cpp +++ b/Telegram/SourceFiles/mtproto/mtpSession.cpp @@ -63,7 +63,7 @@ void MTPSessionData::clear() { } -MTProtoSession::MTProtoSession() : data(this), dc(0), dcId(0), msSendCall(0), msWait(0) { +MTProtoSession::MTProtoSession() : data(this), dcId(0), dc(0), msSendCall(0), msWait(0) { } void MTProtoSession::start(int32 dcenter, uint32 connects) { @@ -158,7 +158,7 @@ void MTProtoSession::checkRequestsByTimer() { stateRequestIds.push_back(MTP_long(i.key())); } } - } else if (unixtime() > (uint32)(i.key() >> 32) + MTPContainerLives) { + } else if (unixtime() > (int32)(i.key() >> 32) + MTPContainerLives) { removingIds.reserve(haveSentCount); removingIds.push_back(i.key()); } @@ -216,7 +216,7 @@ int32 MTProtoSession::requestState(mtpRequestId requestId) const { result = MTP::RequestConnecting; } } else if (s < 0) { - if (result < 0 && s > result || result == MTP::RequestSent) { + if ((result < 0 && s > result) || result == MTP::RequestSent) { result = s; } } diff --git a/Telegram/SourceFiles/mtproto/mtpSession.h b/Telegram/SourceFiles/mtproto/mtpSession.h index 1f198e142..eb2220f43 100644 --- a/Telegram/SourceFiles/mtproto/mtpSession.h +++ b/Telegram/SourceFiles/mtproto/mtpSession.h @@ -27,9 +27,9 @@ class MTPSessionData { public: MTPSessionData(MTProtoSession *creator) - : _session(0), _salt(0), fakeRequestId(-2000000000) - , _messagesSent(0), keyChecked(false) - , _owner(creator) { + : _session(0), _salt(0) + , _messagesSent(0), fakeRequestId(-2000000000) + , _owner(creator), keyChecked(false) { } void setSession(uint64 session) { diff --git a/Telegram/SourceFiles/profilewidget.cpp b/Telegram/SourceFiles/profilewidget.cpp index cb5769ac8..15c7bb823 100644 --- a/Telegram/SourceFiles/profilewidget.cpp +++ b/Telegram/SourceFiles/profilewidget.cpp @@ -619,7 +619,7 @@ bool ProfileInner::animStep(float64 ms) { } bool ProfileInner::getPhotoCoords(PhotoData *photo, int32 &x, int32 &y, int32 &w) const { - if (_peerUser && photo->id == _peerUser->photoId || _peerChat && photo->id == _peerChat->photoId) { + if ((_peerUser && photo->id == _peerUser->photoId) || (_peerChat && photo->id == _peerChat->photoId)) { x = _left; y = st::profilePadding.top(); w = st::setPhotoSize; @@ -704,8 +704,11 @@ void ProfileInner::showAll() { resize(width(), h); } -ProfileWidget::ProfileWidget(QWidget *parent, const PeerData *peer) : QWidget(parent), - _inner(this, &_scroll, peer), _scroll(this, st::setScroll), _showing(false) { +ProfileWidget::ProfileWidget(QWidget *parent, const PeerData *peer) : QWidget(parent) + , _scroll(this, st::setScroll) + , _inner(this, &_scroll, peer) + , _showing(false) +{ _scroll.setWidget(&_inner); _scroll.move(0, 0); _inner.move(0, 0); diff --git a/Telegram/SourceFiles/pspecific_mac.cpp b/Telegram/SourceFiles/pspecific_mac.cpp index 9f0cde452..02b363b3f 100644 --- a/Telegram/SourceFiles/pspecific_mac.cpp +++ b/Telegram/SourceFiles/pspecific_mac.cpp @@ -684,8 +684,8 @@ void PsMainWindow::psUpdateNotifies() { } } -PsNotifyWindow::PsNotifyWindow(HistoryItem *item, int32 x, int32 y) : history(item->history()), aOpacity(0), _index(0), hiding(false),// started(GetTickCount()), -alphaDuration(st::notifyFastAnim), posDuration(st::notifyFastAnim), aY(y + st::notifyHeight + st::notifyDeltaY), close(this, st::notifyClose), aOpacityFunc(st::notifyFastAnimFunc) { +PsNotifyWindow::PsNotifyWindow(HistoryItem *item, int32 x, int32 y) : history(item->history()),// started(GetTickCount()), +close(this, st::notifyClose), alphaDuration(st::notifyFastAnim), posDuration(st::notifyFastAnim), hiding(false), _index(0), aOpacity(0), aOpacityFunc(st::notifyFastAnimFunc), aY(y + st::notifyHeight + st::notifyDeltaY) { int32 w = st::notifyWidth, h = st::notifyHeight; QImage img(w * cIntRetinaFactor(), h * cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied); diff --git a/Telegram/SourceFiles/pspecific_mac_p.mm b/Telegram/SourceFiles/pspecific_mac_p.mm index 0d3532bc0..88caf5c54 100644 --- a/Telegram/SourceFiles/pspecific_mac_p.mm +++ b/Telegram/SourceFiles/pspecific_mac_p.mm @@ -101,6 +101,11 @@ public: } - (void) userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification { + NSNumber *instObj = [[notification userInfo] objectForKey:@"inst"]; + unsigned long long instLong = [instObj unsignedLongLongValue]; + if (instLong != cInstance()) { // other app instance notification + return; + } if (notification.activationType == NSUserNotificationActivationTypeReplied){ wnd->data->onNotifyReply(notification); } else if (notification.activationType == NSUserNotificationActivationTypeContentsClicked) { @@ -151,7 +156,7 @@ void PsMacWindowPrivate::activateWnd(WId winId) { void PsMacWindowPrivate::showNotify(unsigned long long peer, const char *utf8title, const char *utf8subtitle, const char *utf8msg) { NSUserNotification *notification = [[NSUserNotification alloc] init]; - NSDictionary *uinfo = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithUnsignedLongLong:peer],@"peer",nil]; + NSDictionary *uinfo = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithUnsignedLongLong:peer],@"peer",[NSNumber numberWithUnsignedLongLong:cInstance()],@"inst",nil]; [notification setUserInfo:uinfo]; [uinfo release]; diff --git a/Telegram/SourceFiles/settings.cpp b/Telegram/SourceFiles/settings.cpp index 33db92f11..411d7d42b 100644 --- a/Telegram/SourceFiles/settings.cpp +++ b/Telegram/SourceFiles/settings.cpp @@ -70,6 +70,8 @@ float64 gRetinaFactor = 1.; int32 gIntRetinaFactor = 1; bool gCustomNotifies = false; +uint64 gInstance = 0.; + #ifdef Q_OS_WIN DBIPlatform gPlatform = dbipWindows; #elif defined Q_OS_MAC @@ -81,6 +83,7 @@ DBIPlatform gPlatform = dbipLinux; #endif void settingsParseArgs(int argc, char *argv[]) { + memset_rand(&gInstance, sizeof(gInstance)); gExeDir = psCurrentExeDirectory(argc, argv); for (int32 i = 0; i < argc; ++i) { if (string("-release") == argv[i]) { diff --git a/Telegram/SourceFiles/settings.h b/Telegram/SourceFiles/settings.h index b0a1dd748..52bb4708d 100644 --- a/Telegram/SourceFiles/settings.h +++ b/Telegram/SourceFiles/settings.h @@ -135,6 +135,8 @@ DeclareSetting(float64, RetinaFactor); DeclareSetting(int32, IntRetinaFactor); DeclareSetting(bool, CustomNotifies); +DeclareReadSetting(uint64, Instance); + DeclareReadSetting(DBIPlatform, Platform); void settingsParseArgs(int argc, char *argv[]); diff --git a/Telegram/SourceFiles/settingswidget.cpp b/Telegram/SourceFiles/settingswidget.cpp index 8b27ee368..ea88ff967 100644 --- a/Telegram/SourceFiles/settingswidget.cpp +++ b/Telegram/SourceFiles/settingswidget.cpp @@ -135,10 +135,10 @@ SettingsInner::SettingsInner(Settings *parent) : QWidget(parent), _viewEmojis(this, lang(lng_settings_view_emojis)), _enterSend(this, qsl("send_key"), 0, lang(lng_settings_send_enter), !cCtrlEnter()), -_ctrlEnterSend(this, qsl("send_key"), 1, lang((cPlatform() == dbipMac) ? lng_settings_send_cmdenter : lng_settings_send_ctrlenter), cCtrlEnter()), + _ctrlEnterSend(this, qsl("send_key"), 1, lang((cPlatform() == dbipMac) ? lng_settings_send_cmdenter : lng_settings_send_ctrlenter), cCtrlEnter()), - _downloadPathWidth(st::linkFont->m.width(lang(lng_download_path_label))), _dontAskDownloadPath(this, lang(lng_download_path_dont_ask), !cAskDownloadPath()), + _downloadPathWidth(st::linkFont->m.width(lang(lng_download_path_label))), _downloadPathEdit(this, cDownloadPath().isEmpty() ? lang(lng_download_path_temp) : st::linkFont->m.elidedText(QDir::toNativeSeparators(cDownloadPath()), Qt::ElideRight, st::setWidth - st::setVersionLeft - _downloadPathWidth)), _downloadPathClear(this, lang(lng_download_path_clear)), _tempDirClearingWidth(st::linkFont->m.width(lang(lng_download_path_clearing))), @@ -150,8 +150,8 @@ _ctrlEnterSend(this, qsl("send_key"), 1, lang((cPlatform() == dbipMac) ? lng_set // advanced _connectionType(this, lang(lng_connection_auto)), _resetSessions(this, lang(lng_settings_reset)), - _resetDone(false), - _logOut(this, lang(lng_settings_logout), st::btnLogout) + _logOut(this, lang(lng_settings_logout), st::btnLogout), + _resetDone(false) { if (_self) { _nameText.setText(st::setNameFont, _nameCache, _textNameOptions); diff --git a/Telegram/SourceFiles/title.cpp b/Telegram/SourceFiles/title.cpp index fde848d9c..1b4f8389e 100644 --- a/Telegram/SourceFiles/title.cpp +++ b/Telegram/SourceFiles/title.cpp @@ -49,7 +49,8 @@ void TitleHider::setLevel(float64 level) { TitleWidget::TitleWidget(Window *window) : QWidget(window) , wnd(window) - , availWidth(460) + , hideLevel(0) + , hider(0) , _settings(this, lang(lng_menu_settings), st::titleTextButton) , _contacts(this, lang(lng_menu_contacts), st::titleTextButton) , _about(this, lang(lng_menu_about), st::titleTextButton) @@ -58,9 +59,9 @@ TitleWidget::TitleWidget(Window *window) , _maximize(this, window) , _restore(this, window) , _close(this, window) - , lastMaximized(!(window->windowState() & Qt::WindowMaximized)) - , hider(0) - , hideLevel(0) { + , availWidth(460) + , lastMaximized(!(window->windowState() & Qt::WindowMaximized)) +{ setGeometry(0, 0, wnd->width(), st::titleHeight); stateChanged(); @@ -226,7 +227,7 @@ HitTestType TitleWidget::hitTest(const QPoint &p) { } else if (x >= 0 && x < w && y >= 0 && y < h) { if (false || _settings.geometry().contains(x, y) - || !_contacts.isHidden() && _contacts.geometry().contains(x, y) + || (!_contacts.isHidden() && _contacts.geometry().contains(x, y)) || _about.geometry().contains(x, y) ) { return HitTestClient; diff --git a/Telegram/SourceFiles/types.cpp b/Telegram/SourceFiles/types.cpp index 8ae68c213..a08383dce 100644 --- a/Telegram/SourceFiles/types.cpp +++ b/Telegram/SourceFiles/types.cpp @@ -34,9 +34,8 @@ namespace { class _TypeSizeCheckerHelper { public: _TypeSizeCheckerHelper() { -#ifndef Q_OS_MAC - _BadTypeSize field; -#endif + int _BadTypeSize[N ? -1 : 1]; + (void)sizeof(_BadTypeSize); } }; @@ -398,11 +397,11 @@ namespace { } inline uint32 _md5_F(uint32 x, uint32 y, uint32 z) { - return x & y | ~x & z; + return (x & y) | (~x & z); } inline uint32 _md5_G(uint32 x, uint32 y, uint32 z) { - return x & z | y & ~z; + return (x & z) | (y & ~z); } inline uint32 _md5_H(uint32 x, uint32 y, uint32 z) { diff --git a/Telegram/SourceFiles/window.cpp b/Telegram/SourceFiles/window.cpp index 1daba3f63..8cf74c8bb 100644 --- a/Telegram/SourceFiles/window.cpp +++ b/Telegram/SourceFiles/window.cpp @@ -29,7 +29,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com #include "layerwidget.h" #include "settingswidget.h" -ConnectingWidget::ConnectingWidget(QWidget *parent, const QString &text, const QString &reconnect) : QWidget(parent), _reconnect(this, QString()), _shadow(st::boxShadow) { +ConnectingWidget::ConnectingWidget(QWidget *parent, const QString &text, const QString &reconnect) : QWidget(parent), _shadow(st::boxShadow), _reconnect(this, QString()) { set(text, reconnect); connect(&_reconnect, SIGNAL(clicked()), this, SLOT(onReconnect())); } @@ -77,8 +77,8 @@ void TempDirDeleter::onStart() { } Window::Window(QWidget *parent) : PsMainWindow(parent), - dragging(false), intro(0), main(0), settings(0), layer(0), layerBG(0), myIcon(QPixmap::fromImage(icon256)), _topWidget(0), - _connecting(0), _inactivePress(false), _tempDeleter(0), _tempDeleterThread(0) { + intro(0), main(0), settings(0), layer(0), layerBG(0), _topWidget(0), + _connecting(0), _tempDeleter(0), _tempDeleterThread(0), myIcon(QPixmap::fromImage(icon256)), dragging(false), _inactivePress(false) { if (objectName().isEmpty()) setObjectName(qsl("MainWindow")); @@ -253,7 +253,7 @@ void Window::mtpStateChanged(int32 dc, int32 state) { void Window::updateTitleStatus() { int32 state = MTP::dcstate(); - if (state == MTProtoConnection::Connecting || state == MTProtoConnection::Disconnected || state < 0 && state > -600) { + if (state == MTProtoConnection::Connecting || state == MTProtoConnection::Disconnected || (state < 0 && state > -600)) { if (main || getms() > 5000 || _connecting) { showConnecting(lang(lng_connecting)); } @@ -384,7 +384,7 @@ void Window::paintEvent(QPaintEvent *e) { HitTestType Window::hitTest(const QPoint &p) const { int x(p.x()), y(p.y()), w(width()), h(height()); - const uint32 raw = psResizeRowWidth(); + const int32 raw = psResizeRowWidth(); if (!windowState().testFlag(Qt::WindowMaximized)) { if (y < raw) { if (x < raw) { diff --git a/Telegram/Telegram.xcodeproj/project.pbxproj b/Telegram/Telegram.xcodeproj/project.pbxproj index a0c983c83..93f54a598 100644 --- a/Telegram/Telegram.xcodeproj/project.pbxproj +++ b/Telegram/Telegram.xcodeproj/project.pbxproj @@ -38,6 +38,7 @@ 02F93BF511880983D3C57B84 /* dialogswidget.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = E466873F01ABA1E55E914489 /* dialogswidget.cpp */; settings = {ATTRIBUTES = (); }; }; 03270F718426CFE84729079E /* flattextarea.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 5C7FD422BBEDA858D7237AE9 /* flattextarea.cpp */; settings = {ATTRIBUTES = (); }; }; 06EABCC49D2EEE4076322BE7 /* moc_mtp.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 924D4939FD169BB4B8AEB1C9 /* moc_mtp.cpp */; settings = {ATTRIBUTES = (); }; }; + 07055CC4194EE85B0008DEF6 /* libcrypto.a in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 07055CC3194EE85B0008DEF6 /* libcrypto.a */; }; 0749CE69194D723400345D61 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 07C3AF24194335ED0016CFF1 /* Images.xcassets */; }; 0A49F3A5DC0680FB31519670 /* phoneinput.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 7C8F9CA4FCE8AF8FCCCB961E /* phoneinput.cpp */; settings = {ATTRIBUTES = (); }; }; 0CB7DE9A54CC9BF86FB7B5CA /* mtp.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 6D50D70712776D7ED3B00E5C /* mtp.cpp */; settings = {ATTRIBUTES = (); }; }; @@ -224,6 +225,7 @@ 047DAFB0A7DE92C63033A43C /* mainwidget.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = mainwidget.cpp; path = SourceFiles/mainwidget.cpp; sourceTree = ""; }; 060A694B42A4555240009936 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtga.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtga.pri"; sourceTree = ""; }; 06E379415713F34B83F99C35 /* app.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = app.cpp; path = SourceFiles/app.cpp; sourceTree = ""; }; + 07055CC3194EE85B0008DEF6 /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = "./../../Libraries/openssl-xcode/libcrypto.a"; sourceTree = ""; }; 075EB50EB07CF69FD62FB8DF /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sql_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sql_private.pri"; sourceTree = ""; }; 0771C4C94B623FC34BF62983 /* intro.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = intro.cpp; path = SourceFiles/intro/intro.cpp; sourceTree = ""; }; 07C3AF24194335ED0016CFF1 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = Telegram/Images.xcassets; sourceTree = SOURCE_ROOT; }; @@ -593,6 +595,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 07055CC4194EE85B0008DEF6 /* libcrypto.a in Link Binary With Libraries */, 1BB705CDB741E2B7450201A5 /* Cocoa.framework in Link Binary With Libraries */, B58956C9C026BD3A7FD9ECDF /* libexif.a in Link Binary With Libraries */, 328FD74542F6E2C873EE4D4B /* ApplicationServices.framework in Link Binary With Libraries */, @@ -1069,6 +1072,7 @@ AF39DD055C3EF8226FBE929D /* Frameworks */ = { isa = PBXGroup; children = ( + 07055CC3194EE85B0008DEF6 /* libcrypto.a */, AEA456A2F75ED9F5CDA7BCBE /* Cocoa.framework */, 4AF15B5A0A43EB62D6DAF211 /* libexif.a */, DFD7912080BC557230093752 /* ApplicationServices.framework */, @@ -1182,6 +1186,7 @@ 6DB9C3763D02B1415CD9D565 /* Project object */ = { isa = PBXProject; attributes = { + LastUpgradeCheck = 0510; }; buildConfigurationList = DAC4C1AA5EDEA1C85E9CA5E6 /* Build configuration list for PBXProject "Telegram" */; compatibilityVersion = "Xcode 3.2"; @@ -1417,7 +1422,7 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h; OBJROOT = ./../Mac/DebugIntermediate; - PRODUCT_NAME = "Preprocess copy"; + PRODUCT_NAME = "Meta Compile"; QT_LIBRARY_SUFFIX = _debug; SDKROOT = macosx; SYMROOT = ./../Mac; @@ -1435,7 +1440,7 @@ GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h; LLVM_LTO = YES; OBJROOT = ./../Mac/ReleaseIntermediate; - PRODUCT_NAME = "Preprocess copy"; + PRODUCT_NAME = "Meta Compile"; QT_LIBRARY_SUFFIX = ""; SDKROOT = macosx; SYMROOT = ./../Mac; @@ -1445,8 +1450,13 @@ 339EE1B2CC4FC24589A0EA95 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = x86_64; CC = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = YES; DYLIB_COMPATIBILITY_VERSION = 0.5; DYLIB_CURRENT_VERSION = 0.5.1; @@ -1456,6 +1466,9 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = SourceFiles/stdafx.h; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; HEADER_SEARCH_PATHS = ( ./../../Libraries/QtStatic/qtbase/include/QtGui/5.3.0/QtGui, ./../../Libraries/QtStatic/qtbase/include/QtCore/5.3.0/QtCore, @@ -1488,6 +1501,7 @@ "/usr/local/Qt-5.3.0/plugins/bearer", "/usr/local/Qt-5.3.0/plugins/platforms", "/usr/local/Qt-5.3.0/plugins/imageformats", + "./../../Libraries/openssl-xcode", ); MACOSX_DEPLOYMENT_TARGET = 10.7; OBJROOT = "./../Mac/$(CONFIGURATION)Intermediate"; @@ -1502,6 +1516,12 @@ "-DQT_NETWORK_LIB", "-DQT_GUI_LIB", "-DQT_CORE_LIB", + "-Wno-unused-variable", + "-Wno-unused-parameter", + "-Wno-unused-function", + "-Wno-switch", + "-Wno-comment", + "-I./../../Libraries/openssl-xcode/include", ); OTHER_CPLUSPLUSFLAGS = ( "-pipe", @@ -1516,12 +1536,16 @@ "-DQT_NETWORK_LIB", "-DQT_GUI_LIB", "-DQT_CORE_LIB", + "-Wno-unused-variable", + "-Wno-unused-parameter", + "-Wno-unused-function", + "-Wno-switch", + "-Wno-comment", + "-I./../../Libraries/openssl-xcode/include", ); OTHER_LDFLAGS = ( "-headerpad_max_install_names", "-stdlib=libc++", - "-lcrypto", - "-lssl", "-L/usr/local/Qt-5.3.0/lib", "-L/usr/local/Qt-5.3.0/plugins/mediaservice", "-L/usr/local/Qt-5.3.0/plugins/audio", @@ -1544,8 +1568,13 @@ 3AA6C32AC930069E80220CF1 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = x86_64; CC = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; DYLIB_COMPATIBILITY_VERSION = 0.5; @@ -1556,6 +1585,9 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = SourceFiles/stdafx.h; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; HEADER_SEARCH_PATHS = ( ./../../Libraries/QtStatic/qtbase/include/QtGui/5.3.0/QtGui, ./../../Libraries/QtStatic/qtbase/include/QtCore/5.3.0/QtCore, @@ -1588,9 +1620,11 @@ "/usr/local/Qt-5.3.0/plugins/bearer", "/usr/local/Qt-5.3.0/plugins/platforms", "/usr/local/Qt-5.3.0/plugins/imageformats", + "./../../Libraries/openssl-xcode", ); MACOSX_DEPLOYMENT_TARGET = 10.7; OBJROOT = "./../Mac/$(CONFIGURATION)Intermediate"; + ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = ( "-pipe", "-g", @@ -1603,6 +1637,12 @@ "-DQT_NETWORK_LIB", "-DQT_GUI_LIB", "-DQT_CORE_LIB", + "-Wno-unused-variable", + "-Wno-unused-parameter", + "-Wno-unused-function", + "-Wno-switch", + "-Wno-comment", + "-I./../../Libraries/openssl-xcode/include", ); OTHER_CPLUSPLUSFLAGS = ( "-pipe", @@ -1618,12 +1658,16 @@ "-DQT_NETWORK_LIB", "-DQT_GUI_LIB", "-DQT_CORE_LIB", + "-Wno-unused-variable", + "-Wno-unused-parameter", + "-Wno-unused-function", + "-Wno-switch", + "-Wno-comment", + "-I./../../Libraries/openssl-xcode/include", ); OTHER_LDFLAGS = ( "-headerpad_max_install_names", "-stdlib=libc++", - "-lcrypto", - "-lssl", "-L/usr/local/Qt-5.3.0/lib", "-L/usr/local/Qt-5.3.0/plugins/mediaservice", "-L/usr/local/Qt-5.3.0/plugins/audio", @@ -1647,6 +1691,7 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; CURRENT_PROJECT_VERSION = 0.5.2; DYLIB_CURRENT_VERSION = 0.5.2; @@ -1667,6 +1712,7 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 0.5.2; DEBUG_INFORMATION_FORMAT = dwarf;