mirror of https://github.com/procxx/kepka.git
				
				
				
			half warnings fixed, half disabled for mac build, custom openssl build used, fixed notify activate, bold fonts etc
This commit is contained in:
		
							parent
							
								
									7d9d5aa81a
								
							
						
					
					
						commit
						196b412d1f
					
				|  | @ -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))); | 		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) { | 	int32 onlineWillChangeIn(int32 online, int32 now) { | ||||||
| 		if (online <= 0) return 86400; | 		if (online <= 0) return 86400; | ||||||
| 		if (online > now) { | 		if (online > now) { | ||||||
|  | @ -314,7 +321,7 @@ namespace App { | ||||||
| 			case mtpc_userStatusOnline: data->onlineTill = status->c_userStatusOnline().vexpires.v; break; | 			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; | 				data->contact = 0; | ||||||
| 			} | 			} | ||||||
| 			if (data->contact > 0 && !wasContact) { | 			if (data->contact > 0 && !wasContact) { | ||||||
|  | @ -605,7 +612,7 @@ namespace App { | ||||||
| 			} | 			} | ||||||
| 			if (user->contact > 0) { | 			if (user->contact > 0) { | ||||||
| 				if (!wasContact) { | 				if (!wasContact) { | ||||||
| 					App::main()->addNewContact(user->id & 0xFFFFFFFF, false); | 					App::main()->addNewContact(App::userFromPeer(user->id), false); | ||||||
| 					user->input = MTP_inputPeerContact(userId); | 					user->input = MTP_inputPeerContact(userId); | ||||||
| 					user->inputUser = MTP_inputUserContact(userId); | 					user->inputUser = MTP_inputUserContact(userId); | ||||||
| 				} | 				} | ||||||
|  | @ -614,7 +621,7 @@ namespace App { | ||||||
| 					user->input = MTP_inputPeerForeign(userId, MTP_long(user->access)); | 					user->input = MTP_inputPeerForeign(userId, MTP_long(user->access)); | ||||||
| 					user->inputUser = MTP_inputUserForeign(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; | 					user->contact = 0; | ||||||
| 				} | 				} | ||||||
| 				if (wasContact) { | 				if (wasContact) { | ||||||
|  | @ -1608,7 +1615,7 @@ namespace App { | ||||||
| 					continue; | 					continue; | ||||||
| 				} | 				} | ||||||
| 				uint32 dataLen = *(const uint32*)decrypted.constData(); | 				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())); | 					LOG(("App Error: bad decrypted part size: %1, fullDataLen: %2, decrypted size: %3").arg(dataLen).arg(fullDataLen).arg(decrypted.size())); | ||||||
| 					continue; | 					continue; | ||||||
| 				} | 				} | ||||||
|  | @ -1774,7 +1781,7 @@ namespace App { | ||||||
| 		quint32 count; | 		quint32 count; | ||||||
| 		stream >> count; | 		stream >> count; | ||||||
| 
 | 
 | ||||||
| 		for (int32 i = 0; i < count; ++i) { | 		for (uint32 i = 0; i < count; ++i) { | ||||||
| 			readOneMuted(stream); | 			readOneMuted(stream); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -60,6 +60,8 @@ namespace App { | ||||||
| 		return peerFromUser(user_id.v); | 		return peerFromUser(user_id.v); | ||||||
| 	} | 	} | ||||||
| 	MTPpeer peerToMTP(const PeerId &peer_id); | 	MTPpeer peerToMTP(const PeerId &peer_id); | ||||||
|  |     int32 userFromPeer(const PeerId &peer_id); | ||||||
|  |     int32 chatFromPeer(const PeerId &peer_id); | ||||||
| 
 | 
 | ||||||
| 	int32 onlineWillChangeIn(int32 onlineOnServer, int32 nowOnServer); | 	int32 onlineWillChangeIn(int32 onlineOnServer, int32 nowOnServer); | ||||||
| 	QString onlineText(int32 onlineOnServer, int32 nowOnServer); | 	QString onlineText(int32 onlineOnServer, int32 nowOnServer); | ||||||
|  |  | ||||||
|  | @ -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) { | 	if (sendRequest) { | ||||||
| 		QNetworkRequest checkVersion(QUrl(qsl("http://tdesktop.com/win/tupdates/current"))); | 		QNetworkRequest checkVersion(QUrl(qsl("http://tdesktop.com/win/tupdates/current"))); | ||||||
|  |  | ||||||
|  | @ -22,10 +22,10 @@ Copyright (c) 2014 John Preston, https://tdesktop.com | ||||||
| #include "mainwidget.h" | #include "mainwidget.h" | ||||||
| #include "window.h" | #include "window.h" | ||||||
| 
 | 
 | ||||||
| AboutBox::AboutBox() : _hiding(false), | AboutBox::AboutBox() : | ||||||
| _text(this, lang(lng_about_text), st::aboutLabel, st::aboutTextStyle), |  | ||||||
| _done(this, lang(lng_about_done), st::aboutCloseButton), | _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; | 	_width = st::aboutWidth; | ||||||
| 	_height = st::aboutHeight; | 	_height = st::aboutHeight; | ||||||
|  |  | ||||||
|  | @ -24,14 +24,14 @@ Copyright (c) 2014 John Preston, https://tdesktop.com | ||||||
| #include "window.h" | #include "window.h" | ||||||
| 
 | 
 | ||||||
| AddContactBox::AddContactBox(QString fname, QString lname, QString phone) : | AddContactBox::AddContactBox(QString fname, QString lname, QString phone) : | ||||||
| 	_hiding(false), _peer(0), _addRequest(0), _contactId(0), | 	_peer(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)), |  | ||||||
| 	_addButton(this, lang(lng_add_contact), st::btnSelectDone), | 	_addButton(this, lang(lng_add_contact), st::btnSelectDone), | ||||||
| 	_retryButton(this, lang(lng_try_other_contact), st::btnSelectDone), | 	_retryButton(this, lang(lng_try_other_contact), st::btnSelectDone), | ||||||
| 	_cancelButton(this, lang(lng_cancel), st::btnSelectCancel), | 	_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()) { | 	if (!phone.isEmpty()) { | ||||||
| 		_phoneInput.setDisabled(true); | 		_phoneInput.setDisabled(true); | ||||||
|  | @ -41,14 +41,14 @@ AddContactBox::AddContactBox(QString fname, QString lname, QString phone) : | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| AddContactBox::AddContactBox(PeerData *peer) : | AddContactBox::AddContactBox(PeerData *peer) : | ||||||
| 	_hiding(false), _peer(peer), _addRequest(0), _contactId(0), | 	_peer(peer), | ||||||
| 	_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)), |  | ||||||
| 	_addButton(this, lang(lng_settings_save), st::btnSelectDone), | 	_addButton(this, lang(lng_settings_save), st::btnSelectDone), | ||||||
| 	_retryButton(this, lang(lng_try_other_contact), st::btnSelectDone), | 	_retryButton(this, lang(lng_try_other_contact), st::btnSelectDone), | ||||||
| 	_cancelButton(this, lang(lng_cancel), st::btnSelectCancel), | 	_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(); | 	initBox(); | ||||||
| } | } | ||||||
|  | @ -204,7 +204,7 @@ void AddContactBox::animStep(float64 dt) { | ||||||
| 		_cache = QPixmap(); | 		_cache = QPixmap(); | ||||||
| 		if (!_hiding) { | 		if (!_hiding) { | ||||||
| 			showAll(); | 			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(); | 				_firstInput.setFocus(); | ||||||
| 			} else { | 			} else { | ||||||
| 				_phoneInput.setFocus(); | 				_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)); | 		_addRequest = MTP::send(MTPaccount_UpdateProfile(MTP_string(firstName), MTP_string(lastName)), rpcDone(&AddContactBox::onSaveSelfDone), rpcFail(&AddContactBox::onSaveSelfFail)); | ||||||
| 	} else if (_peer) { | 	} else if (_peer) { | ||||||
| 		if (_peer->chat) { | 		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 { | 		} else { | ||||||
| 			_contactId = MTP::nonce<uint64>(); | 			_contactId = MTP::nonce<uint64>(); | ||||||
| 			QVector<MTPInputContact> v(1, MTP_inputPhoneContact(MTP_long(_contactId), MTP_string(_peer->asUser()->phone), MTP_string(firstName), MTP_string(lastName))); | 			QVector<MTPInputContact> v(1, MTP_inputPhoneContact(MTP_long(_contactId), MTP_string(_peer->asUser()->phone), MTP_string(firstName), MTP_string(lastName))); | ||||||
|  |  | ||||||
|  | @ -22,8 +22,8 @@ Copyright (c) 2014 John Preston, https://tdesktop.com | ||||||
| #include "mainwidget.h" | #include "mainwidget.h" | ||||||
| #include "window.h" | #include "window.h" | ||||||
| 
 | 
 | ||||||
| AddParticipantInner::AddParticipantInner(ChatData *chat) : _chat(chat), _selCount(0), | AddParticipantInner::AddParticipantInner(ChatData *chat) : _chat(chat), | ||||||
| 	_contacts(&App::main()->contactsList()), _sel(0), _filteredSel(-1), _mouseSel(false) { | 	_contacts(&App::main()->contactsList()), _sel(0), _filteredSel(-1), _mouseSel(false), _selCount(0) { | ||||||
| 	 | 	 | ||||||
| 	_filter = qsl("a"); | 	_filter = qsl("a"); | ||||||
| 	updateFilter(); | 	updateFilter(); | ||||||
|  | @ -507,12 +507,12 @@ void AddParticipantInner::selectSkipPage(int32 h, int32 dir) { | ||||||
| 	selectSkip(points * dir); | 	selectSkip(points * dir); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| AddParticipantBox::AddParticipantBox(ChatData *chat) : _inner(chat), _hiding(false), | AddParticipantBox::AddParticipantBox(ChatData *chat) : | ||||||
| 	_scroll(this, st::newGroupScroll), | 	_scroll(this, st::newGroupScroll), _inner(chat), | ||||||
| 	_filter(this, st::contactsFilter, lang(lng_participant_filter)), | 	_filter(this, st::contactsFilter, lang(lng_participant_filter)), | ||||||
| 	_invite(this, lang(lng_participant_invite), st::btnSelectDone), | 	_invite(this, lang(lng_participant_invite), st::btnSelectDone), | ||||||
| 	_cancel(this, lang(lng_cancel), st::btnSelectCancel), | 	_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; | 	_width = st::participantWidth; | ||||||
| 	_height = App::wnd()->height() - st::boxPadding.top() - st::boxPadding.bottom(); | 	_height = App::wnd()->height() - st::boxPadding.top() - st::boxPadding.bottom(); | ||||||
|  |  | ||||||
|  | @ -22,10 +22,10 @@ Copyright (c) 2014 John Preston, https://tdesktop.com | ||||||
| #include "mainwidget.h" | #include "mainwidget.h" | ||||||
| #include "window.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), | 	_confirm(this, doneText.isEmpty() ? lang(lng_continue) : doneText, st::btnSelectDone), | ||||||
| 	_cancel(this, cancelText.isEmpty() ? lang(lng_cancel) : cancelText, st::btnSelectCancel), | 	_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); | 	_text.setText(st::boxFont, text, _textPlainOptions); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -22,17 +22,17 @@ Copyright (c) 2014 John Preston, https://tdesktop.com | ||||||
| #include "mainwidget.h" | #include "mainwidget.h" | ||||||
| #include "window.h" | #include "window.h" | ||||||
| 
 | 
 | ||||||
| ConnectionBox::ConnectionBox() : _hiding(false), | ConnectionBox::ConnectionBox() : | ||||||
| 	_hostInput(this, st::inpConnectionHost, lang(lng_connection_host_ph), cConnectionProxy().host), |     _saveButton(this, lang(lng_connection_save), st::btnSelectDone), | ||||||
| 	_portInput(this, st::inpConnectionPort, lang(lng_connection_port_ph), QString::number(cConnectionProxy().port)), |     _cancelButton(this, lang(lng_cancel), st::btnSelectCancel), | ||||||
| 	_userInput(this, st::inpConnectionUser, lang(lng_connection_user_ph), cConnectionProxy().user), |     _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), | 	_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)), | 	_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)), | 	_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)), | 	_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; | 	_width = st::addContactWidth; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -395,11 +395,11 @@ void ContactsInner::selectSkipPage(int32 h, int32 dir) { | ||||||
| 	selectSkip(points * 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), | 	_addContact(this, lang(lng_add_contact_button), st::contactsAdd), | ||||||
| 	_filter(this, st::contactsFilter, lang(lng_participant_filter)), | 	_filter(this, st::contactsFilter, lang(lng_participant_filter)), | ||||||
| 	_close(this, lang(lng_contacts_done), st::contactsClose), | 	_close(this, lang(lng_contacts_done), st::contactsClose), | ||||||
| 	a_opacity(0, 1) { | 	_hiding(false), a_opacity(0, 1) { | ||||||
| 
 | 
 | ||||||
| 	_width = st::participantWidth; | 	_width = st::participantWidth; | ||||||
| 	_height = App::wnd()->height() - st::boxPadding.top() - st::boxPadding.bottom(); | 	_height = App::wnd()->height() - st::boxPadding.top() - st::boxPadding.bottom(); | ||||||
|  |  | ||||||
|  | @ -21,14 +21,14 @@ Copyright (c) 2014 John Preston, https://tdesktop.com | ||||||
| #include "downloadpathbox.h" | #include "downloadpathbox.h" | ||||||
| #include "gui/filedialog.h" | #include "gui/filedialog.h" | ||||||
| 
 | 
 | ||||||
| DownloadPathBox::DownloadPathBox() : _hiding(false), | DownloadPathBox::DownloadPathBox() : | ||||||
| 	_path(cDownloadPath()), | 	_path(cDownloadPath()), | ||||||
| 	_tempRadio(this, qsl("dir_type"), 0, lang(lng_download_path_temp_radio), _path.isEmpty()), | 	_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()), | 	_dirRadio(this, qsl("dir_type"), 1, lang(lng_download_path_dir_radio), !_path.isEmpty()), | ||||||
| 	_dirInput(this, st::inpDownloadDir, QString(), QDir::toNativeSeparators(_path)), | 	_dirInput(this, st::inpDownloadDir, QString(), QDir::toNativeSeparators(_path)), | ||||||
| 	_saveButton(this, lang(lng_connection_save), st::btnSelectDone), | 	_saveButton(this, lang(lng_connection_save), st::btnSelectDone), | ||||||
| 	_cancelButton(this, lang(lng_cancel), st::btnSelectCancel), | 	_cancelButton(this, lang(lng_cancel), st::btnSelectCancel), | ||||||
| 	a_opacity(0, 1) { | 	a_opacity(0, 1), _hiding(false) { | ||||||
| 
 | 
 | ||||||
| 	_width = st::addContactWidth; | 	_width = st::addContactWidth; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -65,9 +65,8 @@ namespace { | ||||||
| 	const uint32 replacesCount = sizeof(replaces) / sizeof(EmojiReplace), replacesInRow = 8; | 	const uint32 replacesCount = sizeof(replaces) / sizeof(EmojiReplace), replacesInRow = 8; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| EmojiBox::EmojiBox() : _hiding(false), | EmojiBox::EmojiBox() : _done(this, lang(lng_about_done), st::aboutCloseButton), | ||||||
| 	_done(this, lang(lng_about_done), st::aboutCloseButton), |     _hiding(false), a_opacity(0, 1) { | ||||||
| 	a_opacity(0, 1) { |  | ||||||
| 
 | 
 | ||||||
| 	fillBlocks(); | 	fillBlocks(); | ||||||
| 
 | 
 | ||||||
|  | @ -96,7 +95,7 @@ EmojiBox::EmojiBox() : _hiding(false), | ||||||
| void EmojiBox::fillBlocks() { | void EmojiBox::fillBlocks() { | ||||||
| 	BlockRow currentRow; | 	BlockRow currentRow; | ||||||
| 	currentRow.reserve(replacesInRow); | 	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)); | 		Block block(getEmoji(replaces[i].code), QString::fromUtf8(replaces[i].replace)); | ||||||
| 		currentRow.push_back(block); | 		currentRow.push_back(block); | ||||||
| 		if (currentRow.size() == replacesInRow) { | 		if (currentRow.size() == replacesInRow) { | ||||||
|  |  | ||||||
|  | @ -438,11 +438,11 @@ QVector<MTPInputUser> NewGroupInner::selectedInputs() { | ||||||
| 	return result; | 	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)), | 	_filter(this, st::contactsFilter, lang(lng_participant_filter)), | ||||||
| 	_next(this, lang(lng_create_group_next), st::btnSelectDone), | 	_next(this, lang(lng_create_group_next), st::btnSelectDone), | ||||||
| 	_cancel(this, lang(lng_cancel), st::btnSelectCancel), | 	_cancel(this, lang(lng_cancel), st::btnSelectCancel), | ||||||
| 	a_opacity(0, 1) { |     _hiding(false),	a_opacity(0, 1) { | ||||||
| 
 | 
 | ||||||
| 	_width = st::participantWidth; | 	_width = st::participantWidth; | ||||||
| 	_height = App::wnd()->height() - st::boxPadding.top() - st::boxPadding.bottom(); | 	_height = App::wnd()->height() - st::boxPadding.top() - st::boxPadding.bottom(); | ||||||
|  | @ -596,11 +596,11 @@ NewGroupBox::~NewGroupBox() { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| CreateGroupBox::CreateGroupBox(const MTPVector<MTPInputUser> &users) : _users(users), | CreateGroupBox::CreateGroupBox(const MTPVector<MTPInputUser> &users) : _users(users), | ||||||
| 	_hiding(false), _createRequestId(0), | 	_createRequestId(0), | ||||||
| 	_name(this, st::newGroupName, lang(lng_dlg_new_group_name)), | 	_name(this, st::newGroupName, lang(lng_dlg_new_group_name)), | ||||||
| 	_create(this, lang(lng_dlg_create_group), st::btnSelectDone), | 	_create(this, lang(lng_dlg_create_group), st::btnSelectDone), | ||||||
| 	_cancel(this, lang(lng_cancel), st::btnSelectCancel), | 	_cancel(this, lang(lng_cancel), st::btnSelectCancel), | ||||||
| 	a_opacity(0, 1) { |     _hiding(false),	a_opacity(0, 1) { | ||||||
| 	_width = st::addContactWidth; | 	_width = st::addContactWidth; | ||||||
| 
 | 
 | ||||||
| 	_height = st::addContactTitleHeight + st::addContactPadding.top() + _name.height() + st::addContactPadding.bottom() + _create.height(); | 	_height = st::addContactTitleHeight + st::addContactPadding.top() + _name.height() + st::addContactPadding.bottom() + _create.height(); | ||||||
|  |  | ||||||
|  | @ -25,10 +25,10 @@ Copyright (c) 2014 John Preston, https://tdesktop.com | ||||||
| #include "photocropbox.h" | #include "photocropbox.h" | ||||||
| #include "fileuploader.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), | 	_sendButton(this, lang(lng_settings_save), st::btnSelectDone), | ||||||
| 	_cancelButton(this, lang(lng_cancel), st::btnSelectCancel), | 	_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(&_sendButton, SIGNAL(clicked()), this, SLOT(onSend())); | ||||||
| 	connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onCancel())); | 	connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onCancel())); | ||||||
|  |  | ||||||
|  | @ -76,7 +76,7 @@ void DialogsListWidget::paintEvent(QPaintEvent *e) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void DialogsListWidget::activate() { | 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); | 		selectSkip(1); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | @ -90,7 +90,7 @@ void DialogsListWidget::mouseMoveEvent(QMouseEvent *e) { | ||||||
| 
 | 
 | ||||||
| void DialogsListWidget::onUpdateSelected(bool force) { | void DialogsListWidget::onUpdateSelected(bool force) { | ||||||
| 	QPoint mouse(mapFromGlobal(lastMousePos)); | 	QPoint mouse(mapFromGlobal(lastMousePos)); | ||||||
| 	if (!force && !rect().contains(mouse) || !selByMouse) return; | 	if ((!force && !rect().contains(mouse)) || !selByMouse) return; | ||||||
| 
 | 
 | ||||||
| 	int w = width(), mouseY = mouse.y(); | 	int w = width(), mouseY = mouse.y(); | ||||||
| 	if (filter.isEmpty()) { | 	if (filter.isEmpty()) { | ||||||
|  | @ -704,9 +704,19 @@ DialogsIndexed &DialogsListWidget::dialogsList() { | ||||||
| 	return dialogs; | 	return dialogs; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| DialogsWidget::DialogsWidget(MainWidget *parent) : QWidget(parent), _configLoaded(false), _drawShadow(true), | DialogsWidget::DialogsWidget(MainWidget *parent) : QWidget(parent) | ||||||
| scroll(this, st::dlgScroll), list(&scroll, parent), _filter(this, st::dlgFilter, lang(lng_dlg_filter)), dlgOffset(0), dlgCount(-1), dlgPreloading(0), contactsRequest(0), | , _configLoaded(false) | ||||||
| _newGroup(this, st::btnNewGroup), _addContact(this, st::btnAddContact) { | , _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.setWidget(&list); | ||||||
| 	scroll.setFocusPolicy(Qt::NoFocus); | 	scroll.setFocusPolicy(Qt::NoFocus); | ||||||
| 	connect(&list, SIGNAL(mustScrollTo(int, int)), &scroll, SLOT(scrollToY(int, int))); | 	connect(&list, SIGNAL(mustScrollTo(int, int)), &scroll, SLOT(scrollToY(int, int))); | ||||||
|  |  | ||||||
|  | @ -23,7 +23,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com | ||||||
| #include "lang.h" | #include "lang.h" | ||||||
| 
 | 
 | ||||||
| Dropdown::Dropdown(QWidget *parent) : TWidget(parent), | 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(); | 	_width = st::dropdownPadding.left() + st::dropdownPadding.right(); | ||||||
| 	_height = st::dropdownPadding.top() + st::dropdownPadding.bottom(); | 	_height = st::dropdownPadding.top() + st::dropdownPadding.bottom(); | ||||||
| 	resize(_width, _height); | 	resize(_width, _height); | ||||||
|  | @ -173,7 +173,7 @@ bool Dropdown::eventFilter(QObject *obj, QEvent *e) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| DragArea::DragArea(QWidget *parent) : TWidget(parent), | 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); | 	setMouseTracking(true); | ||||||
| 	setAcceptDrops(true); | 	setAcceptDrops(true); | ||||||
| } | } | ||||||
|  | @ -311,7 +311,7 @@ bool DragArea::animStep(float64 ms) { | ||||||
| 
 | 
 | ||||||
| static const int emojiPerRow = 7, emojiRowsPerPage = 6; | 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); | 	resize(emojiPerRow * st::emojiPanSize.width(), emojiRowsPerPage * st::emojiPanSize.height() - st::emojiPanSub); | ||||||
| 	setMouseTracking(true); | 	setMouseTracking(true); | ||||||
| 	setFocusPolicy(Qt::NoFocus); | 	setFocusPolicy(Qt::NoFocus); | ||||||
|  | @ -481,13 +481,14 @@ void EmojiPanInner::showEmojiPack(DBIEmojiTab packIndex) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| EmojiPan::EmojiPan(QWidget *parent) : TWidget(parent), | 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), | _recent (this, qsl("emoji_group"), dbietRecent , QString(), cEmojiTab() == dbietRecent , st::rbEmojiRecent), | ||||||
| _people (this, qsl("emoji_group"), dbietPeople , QString(), cEmojiTab() == dbietPeople , st::rbEmojiPeople), | _people (this, qsl("emoji_group"), dbietPeople , QString(), cEmojiTab() == dbietPeople , st::rbEmojiPeople), | ||||||
| _nature (this, qsl("emoji_group"), dbietNature , QString(), cEmojiTab() == dbietNature , st::rbEmojiNature), | _nature (this, qsl("emoji_group"), dbietNature , QString(), cEmojiTab() == dbietNature , st::rbEmojiNature), | ||||||
| _objects(this, qsl("emoji_group"), dbietObjects, QString(), cEmojiTab() == dbietObjects, st::rbEmojiObjects), | _objects(this, qsl("emoji_group"), dbietObjects, QString(), cEmojiTab() == dbietObjects, st::rbEmojiObjects), | ||||||
| _places (this, qsl("emoji_group"), dbietPlaces , QString(), cEmojiTab() == dbietPlaces , st::rbEmojiPlaces), | _places (this, qsl("emoji_group"), dbietPlaces , QString(), cEmojiTab() == dbietPlaces , st::rbEmojiPlaces), | ||||||
| _symbols(this, qsl("emoji_group"), dbietSymbols, QString(), cEmojiTab() == dbietSymbols, st::rbEmojiSymbols), | _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); | 	setFocusPolicy(Qt::NoFocus); | ||||||
| 	_scroll.setFocusPolicy(Qt::NoFocus); | 	_scroll.setFocusPolicy(Qt::NoFocus); | ||||||
| 	_scroll.viewport()->setFocusPolicy(Qt::NoFocus); | 	_scroll.viewport()->setFocusPolicy(Qt::NoFocus); | ||||||
|  | @ -666,9 +667,8 @@ void EmojiPan::hideAll() { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void EmojiPan::onTabChange() { | void EmojiPan::onTabChange() { | ||||||
| 	DBIEmojiTab newTab; | 	DBIEmojiTab newTab = dbietRecent; | ||||||
| 	if (_recent.checked()) newTab = dbietRecent; | 	if (_people.checked()) newTab = dbietPeople; | ||||||
| 	else if (_people.checked()) newTab = dbietPeople; |  | ||||||
| 	else if (_nature.checked()) newTab = dbietNature; | 	else if (_nature.checked()) newTab = dbietNature; | ||||||
| 	else if (_objects.checked()) newTab = dbietObjects; | 	else if (_objects.checked()) newTab = dbietObjects; | ||||||
| 	else if (_places.checked()) newTab = dbietPlaces; | 	else if (_places.checked()) newTab = dbietPlaces; | ||||||
|  |  | ||||||
|  | @ -18,7 +18,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com | ||||||
| #include "stdafx.h" | #include "stdafx.h" | ||||||
| #include "fileuploader.h" | #include "fileuploader.h" | ||||||
| 
 | 
 | ||||||
| FileUploader::FileUploader() : uploading(0), sentSize(0) { | FileUploader::FileUploader() : sentSize(0), uploading(0) { | ||||||
| 	nextTimer.setSingleShot(true); | 	nextTimer.setSingleShot(true); | ||||||
| 	connect(&nextTimer, SIGNAL(timeout()), this, SLOT(sendNext())); | 	connect(&nextTimer, SIGNAL(timeout()), this, SLOT(sendNext())); | ||||||
| } | } | ||||||
|  | @ -116,7 +116,7 @@ void FileUploader::sendNext() { | ||||||
| 		} else { | 		} else { | ||||||
| 			toSend = i->media.data.mid(i->docSentParts * i->docPartSize, i->docPartSize); | 			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(); | 			currentFailed(); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | @ -61,7 +61,7 @@ namespace { | ||||||
| 			CountriesByISO2::const_iterator already = countriesByISO2.constFind(info->iso2); | 			CountriesByISO2::const_iterator already = countriesByISO2.constFind(info->iso2); | ||||||
| 			if (already != countriesByISO2.cend()) { | 			if (already != countriesByISO2.cend()) { | ||||||
| 				QString badISO = info->iso2; | 				QString badISO = info->iso2; | ||||||
| 				badISO; | 				(void)badISO; | ||||||
| 			} | 			} | ||||||
| 			countriesByISO2.insert(info->iso2, info); | 			countriesByISO2.insert(info->iso2, info); | ||||||
| 		} | 		} | ||||||
|  | @ -82,7 +82,7 @@ QString findValidCode(QString fullCode) { | ||||||
| 	return ""; | 	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(); | 	initCountries(); | ||||||
| 
 | 
 | ||||||
| 	resize(_st.width, _st.height + _st.ptrSize.height()); | 	resize(_st.width, _st.height + _st.ptrSize.height()); | ||||||
|  | @ -204,8 +204,8 @@ CountryInput::~CountryInput() { | ||||||
| 	delete _select; | 	delete _select; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| CountryList::CountryList(QWidget *parent, const style::countryList &st) : QWidget(parent), _sel(0), _mouseSel(false), | CountryList::CountryList(QWidget *parent, const style::countryList &st) : QWidget(parent), _sel(0), | ||||||
| 	_st(st) { | 	_st(st), _mouseSel(false) { | ||||||
| 	CountriesByISO2::const_iterator l = countriesByISO2.constFind(lastValidISO); | 	CountriesByISO2::const_iterator l = countriesByISO2.constFind(lastValidISO); | ||||||
| 	bool seenLastValid = false; | 	bool seenLastValid = false; | ||||||
| 	int already = countriesAll.size(); | 	int already = countriesAll.size(); | ||||||
|  | @ -338,7 +338,7 @@ void CountryList::mouseMoveEvent(QMouseEvent *e) { | ||||||
| 
 | 
 | ||||||
| void CountryList::onUpdateSelected(bool force) { | void CountryList::onUpdateSelected(bool force) { | ||||||
| 	QPoint p(mapFromGlobal(_mousePos)); | 	QPoint p(mapFromGlobal(_mousePos)); | ||||||
| 	if (!force && !rect().contains(p) || !_mouseSel) return; | 	if ((!force && !rect().contains(p)) || !_mouseSel) return; | ||||||
| 
 | 
 | ||||||
| 	int newSelected = p.y(); | 	int newSelected = p.y(); | ||||||
| 	newSelected = (newSelected > _st.verticalMargin) ? (newSelected - _st.verticalMargin) / _st.rowHeight : 0; | 	newSelected = (newSelected > _st.verticalMargin) ? (newSelected - _st.verticalMargin) / _st.rowHeight : 0; | ||||||
|  | @ -413,11 +413,11 @@ QString CountryList::getSelectedCountry() const { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| CountrySelect::CountrySelect() : QWidget(App::wnd()), | CountrySelect::CountrySelect() : QWidget(App::wnd()), | ||||||
| 	_scroll(this, st::scrollCountries), _list(&_scroll), | 	_result("none"), | ||||||
| 	_filter(this, st::inpCountry, lang(lng_country_ph)), |     _filter(this, st::inpCountry, lang(lng_country_ph)), _scroll(this, st::scrollCountries), _list(&_scroll), | ||||||
| 	_doneButton(this, lang(lng_country_done), st::btnSelectDone), |     _doneButton(this, lang(lng_country_done), st::btnSelectDone), | ||||||
| 	_cancelButton(this, lang(lng_cancel), st::btnSelectCancel), |     _cancelButton(this, lang(lng_cancel), st::btnSelectCancel), | ||||||
| 	_innerLeft(0), _innerTop(0), _innerWidth(0), _innerHeight(0), _result("none"), |     _innerLeft(0), _innerTop(0), _innerWidth(0), _innerHeight(0), | ||||||
| 	a_alpha(0), a_bgAlpha(0), a_coord(st::countriesSlideShift), _shadow(st::boxShadow) { | 	a_alpha(0), a_bgAlpha(0), a_coord(st::countriesSlideShift), _shadow(st::boxShadow) { | ||||||
| 	setGeometry(App::wnd()->rect()); | 	setGeometry(App::wnd()->rect()); | ||||||
| 	 | 	 | ||||||
|  |  | ||||||
|  | @ -3558,7 +3558,7 @@ const EmojiData *getEmoji(uint32 code) { | ||||||
| 		return 0; | 		return 0; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (highCode == 35 || highCode >= 48 && highCode < 58) { | 	if (highCode == 35 || (highCode >= 48 && highCode < 58)) { | ||||||
| 		if ((code & 0xFFFF) != 0x20E3) return 0; | 		if ((code & 0xFFFF) != 0x20E3) return 0; | ||||||
| 
 | 
 | ||||||
| 		switch (code) { | 		switch (code) { | ||||||
|  |  | ||||||
|  | @ -19,9 +19,9 @@ Copyright (c) 2014 John Preston, https://tdesktop.com | ||||||
| #include "gui/flatbutton.h" | #include "gui/flatbutton.h" | ||||||
| 
 | 
 | ||||||
| FlatButton::FlatButton(QWidget *parent, const QString &text, const style::flatButton &st) : Button(parent), | FlatButton::FlatButton(QWidget *parent, const QString &text, const style::flatButton &st) : Button(parent), | ||||||
| 	_text(text), _opacity(1), | 	_text(text), | ||||||
| 	_st(st), | 	_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) { | 	if (_st.width < 0) { | ||||||
| 		_st.width = _st.font->m.width(text) - _st.width; | 		_st.width = _st.font->m.width(text) - _st.width; | ||||||
| 	} else if (!_st.width) { | 	} else if (!_st.width) { | ||||||
|  | @ -133,8 +133,8 @@ void LinkButton::onStateChange(int oldState, ButtonStateChangeSource source) { | ||||||
| LinkButton::~LinkButton() { | LinkButton::~LinkButton() { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| IconedButton::IconedButton(QWidget *parent, const style::iconedButton &st, const QString &text) : Button(parent), _opacity(1), | 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) { | 	_text(text), _st(st), a_opacity(_st.opacity), a_bg(_st.bgColor->c), _opacity(1) { | ||||||
| 
 | 
 | ||||||
| 	if (_st.width < 0) { | 	if (_st.width < 0) { | ||||||
| 		_st.width = _st.font->m.width(text) - _st.width; | 		_st.width = _st.font->m.width(text) - _st.width; | ||||||
|  |  | ||||||
|  | @ -22,7 +22,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com | ||||||
| #include "flatcheckbox.h" | #include "flatcheckbox.h" | ||||||
| 
 | 
 | ||||||
| FlatCheckbox::FlatCheckbox(QWidget *parent, const QString &text, bool checked, const style::flatCheckbox &st) : Button(parent), | 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(clicked()), this, SLOT(onClicked())); | ||||||
| 	connect(this, SIGNAL(stateChanged(int, ButtonStateChangeSource)), this, SLOT(onStateChange(int, ButtonStateChangeSource))); | 	connect(this, SIGNAL(stateChanged(int, ButtonStateChangeSource)), this, SLOT(onStateChange(int, ButtonStateChangeSource))); | ||||||
| 	setCursor(_st.cursor); | 	setCursor(_st.cursor); | ||||||
|  | @ -92,7 +92,7 @@ void FlatCheckbox::paintEvent(QPaintEvent *e) { | ||||||
| 	if (_state & StateDisabled) { | 	if (_state & StateDisabled) { | ||||||
| 		QRect sRect(_checked ? _st.chkDisImageRect : _st.disImageRect); | 		QRect sRect(_checked ? _st.chkDisImageRect : _st.disImageRect); | ||||||
| 		p.drawPixmap(_st.imagePos, App::sprite(), sRect); | 		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); | 		p.setOpacity(_opacity); | ||||||
| 		QRect sRect(_checked ? _st.chkImageRect : _st.imageRect); | 		QRect sRect(_checked ? _st.chkImageRect : _st.imageRect); | ||||||
| 		p.drawPixmap(_st.imagePos, App::sprite(), sRect); | 		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) : | 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); | 	_group->insert(this); | ||||||
| 	connect(this, SIGNAL(changed()), this, SLOT(onChanged())); | 	connect(this, SIGNAL(changed()), this, SLOT(onChanged())); | ||||||
| 	if (this->checked()) onChanged(); | 	if (this->checked()) onChanged(); | ||||||
|  |  | ||||||
|  | @ -41,9 +41,9 @@ namespace { | ||||||
| 	FlatInputStyle _flatInputStyle; | 	FlatInputStyle _flatInputStyle; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| FlatInput::FlatInput(QWidget *parent, const style::flatInput &st, const QString &pholder, const QString &v) : QLineEdit(v, parent), _oldtext(v), | FlatInput::FlatInput(QWidget *parent, const style::flatInput &st, const QString &pholder, const QString &v) : QLineEdit(v, parent), _oldtext(v), _kev(0), _phVisible(!v.length()), | ||||||
| 	_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), | ||||||
| 	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); | 	resize(_st.width, _st.height); | ||||||
| 	 | 	 | ||||||
| 	setFont(_st.font->f); | 	setFont(_st.font->f); | ||||||
|  |  | ||||||
|  | @ -29,7 +29,7 @@ namespace { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| FlatLabel::FlatLabel(QWidget *parent, const QString &text, const style::flatLabel &st, const style::textStyle &tst) : TWidget(parent), | 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); | 	setRichText(text); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -20,10 +20,11 @@ Copyright (c) 2014 John Preston, https://tdesktop.com | ||||||
| 
 | 
 | ||||||
| #include "flattextarea.h" | #include "flattextarea.h" | ||||||
| 
 | 
 | ||||||
| FlatTextarea::FlatTextarea(QWidget *parent, const style::flatTextarea &st, const QString &pholder, const QString &v) : QTextEdit(v, parent), _oldtext(v), | FlatTextarea::FlatTextarea(QWidget *parent, const style::flatTextarea &st, const QString &pholder, const QString &v) : QTextEdit(v, parent), | ||||||
| 	_st(st), _phVisible(!v.length()), _ph(pholder), _fakeMargin(0), | 	_ph(pholder), _oldtext(v), _phVisible(!v.length()), | ||||||
| 	a_phLeft(_phVisible ? 0 : st.phShift), a_phAlpha(_phVisible ? 1 : 0), a_phColor(st.phColor->c), |     a_phLeft(_phVisible ? 0 : st.phShift), a_phAlpha(_phVisible ? 1 : 0), a_phColor(st.phColor->c), | ||||||
| 	_touchPress(false), _touchRightButton(false), _touchMove(false), _replacingEmojis(false) { |     _st(st), _fakeMargin(0), | ||||||
|  |     _touchPress(false), _touchRightButton(false), _touchMove(false), _replacingEmojis(false) { | ||||||
| 	setAcceptRichText(false); | 	setAcceptRichText(false); | ||||||
| 	resize(_st.width, _st.font->height); | 	resize(_st.width, _st.font->height); | ||||||
| 	 | 	 | ||||||
|  | @ -300,10 +301,10 @@ void FlatTextarea::processDocumentContentsChange(int position, int charsAdded) { | ||||||
| 
 | 
 | ||||||
| 				QString t(fragment.text()); | 				QString t(fragment.text()); | ||||||
| 				for (const QChar *ch = t.constData(), *e = ch + t.size(); ch != e; ++ch) { | 				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()); | 						emoji = getEmoji((ch->unicode() << 16) | (ch + 1)->unicode()); | ||||||
| 						if (emoji) { | 						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; | 								emoji = 0; | ||||||
| 							} else { | 							} else { | ||||||
| 								emojiPosition = p + (ch - t.constData()); | 								emojiPosition = p + (ch - t.constData()); | ||||||
|  | @ -438,7 +439,7 @@ QMimeData *FlatTextarea::createMimeDataFromSelection() const { | ||||||
| 
 | 
 | ||||||
| void FlatTextarea::keyPressEvent(QKeyEvent *e) { | void FlatTextarea::keyPressEvent(QKeyEvent *e) { | ||||||
| 	bool shift = e->modifiers().testFlag(Qt::ShiftModifier); | 	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); | 	bool enter = (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return); | ||||||
| 
 | 
 | ||||||
| 	if (enter && ctrlGood) { | 	if (enter && ctrlGood) { | ||||||
|  |  | ||||||
|  | @ -190,10 +190,10 @@ int64 imageCacheSize() { | ||||||
| 	return globalAquiredSize; | 	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); | 	setData(bytes); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -36,10 +36,12 @@ void ScrollShadow::changeVisibility(bool shown) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| ScrollBar::ScrollBar(ScrollArea *parent, bool vert, const style::flatScroll *st) : QWidget(parent), | 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), | 	_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()), | ||||||
| 	_connected(vert ? parent->verticalScrollBar() : parent->horizontalScrollBar()), _scrollMax(_connected->maximum()) { |     _scrollMax(_connected->maximum()), _hideIn(-1), | ||||||
|  |     a_bg((_st->hiding ? st::transparent : _st->bgColor)->c), | ||||||
|  |     a_bar((_st->hiding ? st::transparent : _st->barColor)->c) { | ||||||
| 	recountSize(); | 	recountSize(); | ||||||
| 
 | 
 | ||||||
| 	_hideTimer.setSingleShot(true); | 	_hideTimer.setSingleShot(true); | ||||||
|  | @ -249,10 +251,12 @@ void ScrollBar::resizeEvent(QResizeEvent *e) { | ||||||
| 	updateBar(); | 	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), | 	hor(this, false, &_st), vert(this, true, &_st), topSh(this, &_st), bottomSh(this, &_st), | ||||||
| 	_touchScroll(false), _touchPress(false), _touchRightButton(false), _widgetAcceptsTouch(false), |     _touchEnabled(handleTouch), _touchScroll(false), _touchPress(false), _touchRightButton(false), | ||||||
| 	_touchScrollState(TouchScrollManual), _touchPrevPosValid(false), _touchWaitingAcceleration(false), _touchSpeedTime(0), _touchAccelerationTime(0), _touchTime(0) { | 	_touchScrollState(TouchScrollManual), _touchPrevPosValid(false), _touchWaitingAcceleration(false), | ||||||
|  |     _touchSpeedTime(0), _touchAccelerationTime(0), _touchTime(0), _widgetAcceptsTouch(false) { | ||||||
| 	connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SIGNAL(scrolled())); | 	connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SIGNAL(scrolled())); | ||||||
| 	connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SIGNAL(scrolled())); | 	connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SIGNAL(scrolled())); | ||||||
| 	connect(&vert, SIGNAL(topShadowVisibility(bool)), &topSh, SLOT(changeVisibility(bool))); | 	connect(&vert, SIGNAL(topShadowVisibility(bool)), &topSh, SLOT(changeVisibility(bool))); | ||||||
|  | @ -365,8 +369,8 @@ void ScrollArea::touchUpdateSpeed() { | ||||||
| 			if (_touchScrollState == TouchScrollAuto) { | 			if (_touchScrollState == TouchScrollAuto) { | ||||||
| 				const int oldSpeedY = _touchSpeed.y(); | 				const int oldSpeedY = _touchSpeed.y(); | ||||||
| 				const int oldSpeedX = _touchSpeed.x(); | 				const int oldSpeedX = _touchSpeed.x(); | ||||||
| 				if ((oldSpeedY <= 0 && newSpeedY <= 0) || (oldSpeedY >= 0 && newSpeedY >= 0) | 				if ((oldSpeedY <= 0 && newSpeedY <= 0) || ((oldSpeedY >= 0 && newSpeedY >= 0) | ||||||
| 					&& (oldSpeedX <= 0 && newSpeedX <= 0) || (oldSpeedX >= 0 && newSpeedX >= 0)) { | 					&& (oldSpeedX <= 0 && newSpeedX <= 0)) || (oldSpeedX >= 0 && newSpeedX >= 0)) { | ||||||
| 					_touchSpeed.setY(snap((oldSpeedY + (newSpeedY / 4)), -MaxScrollAccelerated, +MaxScrollAccelerated)); | 					_touchSpeed.setY(snap((oldSpeedY + (newSpeedY / 4)), -MaxScrollAccelerated, +MaxScrollAccelerated)); | ||||||
| 					_touchSpeed.setX(snap((oldSpeedX + (newSpeedX / 4)), -MaxScrollAccelerated, +MaxScrollAccelerated)); | 					_touchSpeed.setX(snap((oldSpeedX + (newSpeedX / 4)), -MaxScrollAccelerated, +MaxScrollAccelerated)); | ||||||
| 				} else { | 				} else { | ||||||
|  |  | ||||||
|  | @ -23,7 +23,7 @@ namespace { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| namespace style { | 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) { | 		if (other) { | ||||||
| 			memcpy(modified, other, sizeof(modified)); | 			memcpy(modified, other, sizeof(modified)); | ||||||
| 		} else { | 		} else { | ||||||
|  |  | ||||||
|  | @ -372,7 +372,7 @@ public: | ||||||
| 					} else if (ch == ')' || ch == ']' || ch == '}' || ch == '>') { | 					} else if (ch == ')' || ch == ']' || ch == '}' || ch == '>') { | ||||||
| 						if (parenth.isEmpty()) break; | 						if (parenth.isEmpty()) break; | ||||||
| 						const QChar *q = parenth.pop(), open(*q); | 						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; | 							p = q; | ||||||
| 							break; | 							break; | ||||||
| 						} | 						} | ||||||
|  | @ -623,7 +623,7 @@ public: | ||||||
| 				ch = *ptr; | 				ch = *ptr; | ||||||
| 				chInt = (chInt << 16) | ch.unicode(); | 				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) { | 			if (ptr + 1 < end && (ptr + 1)->unicode() == 0x20E3) { | ||||||
| 				_t->_text.push_back(ch); | 				_t->_text.push_back(ch); | ||||||
| 				skipBack = -1; | 				skipBack = -1; | ||||||
|  | @ -657,7 +657,7 @@ public: | ||||||
| 		if (!e) return; | 		if (!e) return; | ||||||
| 
 | 
 | ||||||
| 		if (e->len > 2) { | 		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; | 				return; | ||||||
| 			} else { | 			} else { | ||||||
| 				_t->_text.push_back(*++ptr); | 				_t->_text.push_back(*++ptr); | ||||||
|  | @ -669,8 +669,8 @@ public: | ||||||
| 		emoji = e; | 		emoji = e; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	TextParser(Text *t, const QString &text, const TextParseOptions &options) : _t(t), src(text), stopAfterWidth(QFIXED_MAX), | 	TextParser(Text *t, const QString &text, const TextParseOptions &options) : _t(t), src(text), | ||||||
| 		rich(options.flags & TextParseRichText), multiline(options.flags & TextParseMultiline), flags(0), lnkIndex(0), maxLnkIndex(0) { | 		rich(options.flags & TextParseRichText), multiline(options.flags & TextParseMultiline), maxLnkIndex(0), flags(0), lnkIndex(0), stopAfterWidth(QFIXED_MAX) { | ||||||
| 		int flags = options.flags; | 		int flags = options.flags; | ||||||
| 		if (options.maxw > 0 && options.maxh > 0) { | 		if (options.maxw > 0 && options.maxh > 0) { | ||||||
| 			stopAfterWidth = ((options.maxh / _t->_font->height) + 1) * options.maxw; | 			stopAfterWidth = ((options.maxh / _t->_font->height) + 1) * options.maxw; | ||||||
|  | @ -884,7 +884,7 @@ public: | ||||||
| 		return _blockEnd(t, i, e) - (*i)->from(); | 		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) { | 	void initNextParagraph(Text::TextBlocks::const_iterator i) { | ||||||
|  | @ -1228,12 +1228,12 @@ public: | ||||||
| 		bool selectFromStart = (_selectedTo > _lineStart) && (_lineStart > 0) && (_selectedFrom <= _lineStart); | 		bool selectFromStart = (_selectedTo > _lineStart) && (_lineStart > 0) && (_selectedFrom <= _lineStart); | ||||||
| 		bool selectTillEnd = (_selectedTo >= _lineEnd) && (_lineEnd < _t->_text.size()) && (_selectedFrom < _lineEnd) && (!_endBlock || _endBlock->type() != TextBlockSkip); | 		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) { | 			if (x > _x) { | ||||||
| 				_p->fillRect(QRectF(_x.toReal(), _y + _yDelta, (x - _x).toReal(), _fontHeight), _textStyle->selectBG->b); | 				_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) { | 			if (x < _x + _wLeft) { | ||||||
| 				_p->fillRect(QRectF((x + _w - _wLeft).toReal(), _y + _yDelta, (_x + _wLeft - x).toReal(), _fontHeight), _textStyle->selectBG->b); | 				_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) { | 					for (int charsCount = (ch2 - ch); ch < ch2; ++ch) { | ||||||
| 						QFixed shift1 = QFixed(2 * (charsCount - (ch2 - ch)) + 2) * gwidth / QFixed(2 * charsCount), | 						QFixed shift1 = QFixed(2 * (charsCount - (ch2 - ch)) + 2) * gwidth / QFixed(2 * charsCount), | ||||||
| 						       shift2 = QFixed(2 * (charsCount - (ch2 - ch)) + 1) * gwidth / QFixed(2 * charsCount); | 						       shift2 = QFixed(2 * (charsCount - (ch2 - ch)) + 1) * gwidth / QFixed(2 * charsCount); | ||||||
| 						if (rtl && _lnkX >= tmpx - shift1 || | 						if ((rtl && _lnkX >= tmpx - shift1) || | ||||||
| 							!rtl && _lnkX < tmpx + shift1) { | 							(!rtl && _lnkX < tmpx + shift1)) { | ||||||
| 							*_getSymbol = _localFrom + itemStart + ch; | 							*_getSymbol = _localFrom + itemStart + ch; | ||||||
| 							if (rtl && _lnkX >= tmpx - shift2 || | 							if ((rtl && _lnkX >= tmpx - shift2) || | ||||||
| 								!rtl && _lnkX < tmpx + shift2) { | 								(!rtl && _lnkX < tmpx + shift2)) { | ||||||
| 								*_getSymbolAfter = false; | 								*_getSymbolAfter = false; | ||||||
| 							} else { | 							} else { | ||||||
| 								*_getSymbolAfter = true; | 								*_getSymbolAfter = true; | ||||||
|  | @ -2807,7 +2807,7 @@ namespace { | ||||||
| class BlockParser { | class BlockParser { | ||||||
| public: | 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); | 		parseWords(minResizeWidth, blockFrom); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -125,8 +125,8 @@ private: | ||||||
| struct TextWord { | struct TextWord { | ||||||
| 	TextWord() { | 	TextWord() { | ||||||
| 	} | 	} | ||||||
| 	TextWord(uint16 from, QFixed width, QFixed rbearing, QFixed rpadding = 0) : from(from), width(width), | 	TextWord(uint16 from, QFixed width, QFixed rbearing, QFixed rpadding = 0) : from(from), | ||||||
| 		_rbearing(rbearing.value() > 0x7FFF ? 0x7FFF : (rbearing.value() < -0x7FFF ? -0x7FFF : rbearing.value())), rpadding(rpadding) { | 		_rbearing(rbearing.value() > 0x7FFF ? 0x7FFF : (rbearing.value() < -0x7FFF ? -0x7FFF : rbearing.value())), width(width), rpadding(rpadding) { | ||||||
| 	} | 	} | ||||||
| 	QFixed f_rbearing() const { | 	QFixed f_rbearing() const { | ||||||
| 		return QFixed::fromFixed(_rbearing); | 		return QFixed::fromFixed(_rbearing); | ||||||
|  | @ -357,7 +357,7 @@ public: | ||||||
| 
 | 
 | ||||||
| 	QString original(uint16 selectedFrom = 0, uint16 selectedTo = 0xFFFF, bool expandLinks = true) const; | 	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; | 		if (_text.size() < maxdots) return false; | ||||||
| 
 | 
 | ||||||
| 		int32 nowDots = 0, from = _text.size() - maxdots, to = _text.size(); | 		int32 nowDots = 0, from = _text.size() - maxdots, to = _text.size(); | ||||||
|  |  | ||||||
|  | @ -120,8 +120,16 @@ void historyInit() { | ||||||
| NotifySettings globalNotifyAll, globalNotifyUsers, globalNotifyChats; | NotifySettings globalNotifyAll, globalNotifyUsers, globalNotifyChats; | ||||||
| NotifySettingsPtr globalNotifyAllPtr = UnknownNotifySettings, globalNotifyUsersPtr = UnknownNotifySettings, globalNotifyChatsPtr = UnknownNotifySettings; | NotifySettingsPtr globalNotifyAllPtr = UnknownNotifySettings, globalNotifyUsersPtr = UnknownNotifySettings, globalNotifyChatsPtr = UnknownNotifySettings; | ||||||
| 
 | 
 | ||||||
| PeerData::PeerData(const PeerId &id) : id(id), access(0), chat(App::isChat(id)), loaded(false), notify(UnknownNotifySettings), | PeerData::PeerData(const PeerId &id) : id(id) | ||||||
| 	colorIndex(peerColorIndex(id)), color(peerColor(colorIndex)), photo(chat ? chatDefPhoto(colorIndex) : userDefPhoto(colorIndex)), nameVersion(0) { | , 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() { | UserData *PeerData::asUser() { | ||||||
|  | @ -259,7 +267,7 @@ QString saveFileName(const QString &title, const QString &filter, const QString | ||||||
| 
 | 
 | ||||||
| void VideoOpenLink::onClick(Qt::MouseButton button) const { | void VideoOpenLink::onClick(Qt::MouseButton button) const { | ||||||
| 	VideoData *data = video(); | 	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); | 	QString already = data->already(true); | ||||||
| 	if (!already.isEmpty()) { | 	if (!already.isEmpty()) { | ||||||
|  | @ -304,7 +312,7 @@ void VideoSaveLink::onClick(Qt::MouseButton button) const { | ||||||
| 
 | 
 | ||||||
| void VideoCancelLink::onClick(Qt::MouseButton button) const { | void VideoCancelLink::onClick(Qt::MouseButton button) const { | ||||||
| 	VideoData *data = video(); | 	VideoData *data = video(); | ||||||
| 	if (!data->user && !data->date || button != Qt::LeftButton) return; | 	if ((!data->user && !data->date) || button != Qt::LeftButton) return; | ||||||
| 
 | 
 | ||||||
| 	data->cancel(); | 	data->cancel(); | ||||||
| } | } | ||||||
|  | @ -319,7 +327,7 @@ void VideoData::save(const QString &toFile) { | ||||||
| 
 | 
 | ||||||
| void AudioOpenLink::onClick(Qt::MouseButton button) const { | void AudioOpenLink::onClick(Qt::MouseButton button) const { | ||||||
| 	AudioData *data = audio(); | 	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); | 	QString already = data->already(true); | ||||||
| 	if (!already.isEmpty()) { | 	if (!already.isEmpty()) { | ||||||
|  | @ -364,7 +372,7 @@ void AudioSaveLink::onClick(Qt::MouseButton button) const { | ||||||
| 
 | 
 | ||||||
| void AudioCancelLink::onClick(Qt::MouseButton button) const { | void AudioCancelLink::onClick(Qt::MouseButton button) const { | ||||||
| 	AudioData *data = audio(); | 	AudioData *data = audio(); | ||||||
| 	if (!data->user && !data->date || button != Qt::LeftButton) return; | 	if ((!data->user && !data->date) || button != Qt::LeftButton) return; | ||||||
| 
 | 
 | ||||||
| 	data->cancel(); | 	data->cancel(); | ||||||
| } | } | ||||||
|  | @ -379,7 +387,7 @@ void AudioData::save(const QString &toFile) { | ||||||
| 
 | 
 | ||||||
| void DocumentOpenLink::onClick(Qt::MouseButton button) const { | void DocumentOpenLink::onClick(Qt::MouseButton button) const { | ||||||
| 	DocumentData *data = document(); | 	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); | 	QString already = data->already(true); | ||||||
| 	if (!already.isEmpty()) { | 	if (!already.isEmpty()) { | ||||||
|  | @ -451,7 +459,7 @@ void DocumentSaveLink::onClick(Qt::MouseButton button) const { | ||||||
| 
 | 
 | ||||||
| void DocumentCancelLink::onClick(Qt::MouseButton button) const { | void DocumentCancelLink::onClick(Qt::MouseButton button) const { | ||||||
| 	DocumentData *data = document(); | 	DocumentData *data = document(); | ||||||
| 	if (!data->user && !data->date || button != Qt::LeftButton) return; | 	if ((!data->user && !data->date) || button != Qt::LeftButton) return; | ||||||
| 
 | 
 | ||||||
| 	data->cancel(); | 	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->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), | History::History(const PeerId &peerId) : width(0), height(0) | ||||||
| 	msgCount(0), offset(0), peer(App::peer(peerId)), posInDialogs(0), unreadCount(0), inboxReadTill(0), outboxReadTill(0), lastWidth(0), lastScrollTop(History::ScrollMax), | , msgCount(0) | ||||||
| 	lastItemTextCache(st::dlgRichMinWidth), textCachedFor(0), typingText(st::dlgRichMinWidth), mute(isNotifyMuted(peer->notify)) { | , 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() { | void History::updateNameText() { | ||||||
|  | @ -1360,7 +1385,7 @@ void HistoryBlock::removeItem(HistoryItem *item) { | ||||||
| 				} | 				} | ||||||
| 			} else if (myIndex > 0) { | 			} else if (myIndex > 0) { | ||||||
| 				HistoryBlock *prevBlock = (*history)[myIndex - 1]; | 				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())); | 					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) { | 				} else if ((*prevBlock)[prevBlock->size() - 1]->itemType() == HistoryItem::DateType) { | ||||||
| 					(*prevBlock)[prevBlock->size() - 1]->destroy(); | 					(*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) : | HistoryItem::HistoryItem(History *history, HistoryBlock *block, MsgId msgId, bool out, bool unread, QDateTime msgDate, int32 from) : y(0) | ||||||
| 	y(0), id(msgId), _history(history), _block(block), _out(out), _unread(unread), date(msgDate), _from(App::user(from)), _fromVersion(_from->nameVersion) { | , id(msgId) | ||||||
|  | , date(msgDate) | ||||||
|  | , _from(App::user(from)) | ||||||
|  | , _fromVersion(_from->nameVersion) | ||||||
|  | , _history(history) | ||||||
|  | , _block(block) | ||||||
|  | , _out(out) | ||||||
|  | , _unread(unread) | ||||||
|  | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void HistoryItem::markRead() { | void HistoryItem::markRead() { | ||||||
|  | @ -1442,7 +1475,10 @@ HistoryItem *regItem(HistoryItem *item) { | ||||||
| 	return 0; | 	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(); | 	int32 tw = data->full->width(), th = data->full->height(); | ||||||
| 	if (!tw || !th) { | 	if (!tw || !th) { | ||||||
| 		tw = th = 1; | 		tw = th = 1; | ||||||
|  | @ -1583,7 +1619,14 @@ QString formatDurationAndSizeText(qint64 duration, qint64 size) { | ||||||
| 
 | 
 | ||||||
| int32 _downloadWidth = 0, _openWithWidth = 0, _cancelWidth = 0, _buttonWidth = 0; | 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; | 	_maxw = st::mediaMaxWidth; | ||||||
| 
 | 
 | ||||||
| 	_size = formatDurationAndSizeText(data->duration, data->size); | 	_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; | 	_maxw = st::mediaMaxWidth; | ||||||
| 
 | 
 | ||||||
| 	_size = formatDurationAndSizeText(data->duration, data->size); | 	_size = formatDurationAndSizeText(data->duration, data->size); | ||||||
|  | @ -1966,7 +2016,15 @@ HistoryMedia *HistoryAudio::clone() const { | ||||||
| 	return n; | 	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; | 	_maxw = st::mediaMaxWidth; | ||||||
| 	_namew = st::mediaFont->m.width(_name.isEmpty() ? qsl("Document") : _name); | 	_namew = st::mediaFont->m.width(_name.isEmpty() ? qsl("Document") : _name); | ||||||
| 
 | 
 | ||||||
|  | @ -2178,7 +2236,11 @@ HistoryMedia *HistoryDocument::clone() const { | ||||||
| 	return n; | 	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; | 	_maxw = st::mediaMaxWidth; | ||||||
| 	name.setText(st::mediaFont, (first + ' ' + last).trimmed(), _textNameOptions); | 	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) : | 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))); | 	QString text(textClean(qs(msg.vmessage))); | ||||||
| 	initMedia(msg.vmedia, text); | 	initMedia(msg.vmedia, text); | ||||||
| 	initDimensions(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) : | 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); | 	QString text(msg); | ||||||
| 	initMedia(media, text); | 	initMedia(media, text); | ||||||
| 	initDimensions(text); | 	initDimensions(text); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| HistoryMessage::HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, bool out, bool unread, QDateTime date, int32 from, const QString &msg, HistoryMedia *fromMedia) : | 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); | 	QString text(msg); | ||||||
| 	if (fromMedia) { | 	if (fromMedia) { | ||||||
| 		media = fromMedia->clone(); | 		media = fromMedia->clone(); | ||||||
|  | @ -2713,17 +2790,23 @@ HistoryMessage::~HistoryMessage() { | ||||||
| 	delete media; | 	delete media; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, const MTPDmessageForwarded &msg) : | 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) | ||||||
| 	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)), fwdFromVersion(fwdFrom->nameVersion), fwdDate(::date(msg.vfwd_date)), fromWidth(st::msgServiceFont->m.width(lang(lng_forwarded_from))), fwdFromName(4096) { | , fwdFrom(App::user(msg.vfwd_from_id.v)) | ||||||
|  | , fwdFromName(4096) | ||||||
|  | , fwdFromVersion(fwdFrom->nameVersion) | ||||||
|  | , fromWidth(st::msgServiceFont->m.width(lang(lng_forwarded_from))) | ||||||
|  | { | ||||||
| 	fwdNameUpdated(); | 	fwdNameUpdated(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, MsgId id, HistoryMessage *msg) : | 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()) | ||||||
| 	HistoryMessage(history, block, id, true, true, ::date(unixtime()), MTP::authedId(), msg->HistoryMessage::selectedText(FullItemSel), msg->getMedia()), | , fwdDate(dynamic_cast<HistoryForwarded*>(msg) ? dynamic_cast<HistoryForwarded*>(msg)->dateForwarded() : msg->date) | ||||||
| 	fwdFrom(dynamic_cast<HistoryForwarded*>(msg) ? dynamic_cast<HistoryForwarded*>(msg)->fromForwarded() : msg->from()), fwdFromVersion(fwdFrom->nameVersion), | , fwdFrom(dynamic_cast<HistoryForwarded*>(msg) ? dynamic_cast<HistoryForwarded*>(msg)->fromForwarded() : msg->from()) | ||||||
| 	fwdDate(dynamic_cast<HistoryForwarded*>(msg) ? dynamic_cast<HistoryForwarded*>(msg)->dateForwarded() : msg->date), | , fwdFromName(4096) | ||||||
| 	fromWidth(st::msgServiceFont->m.width(lang(lng_forwarded_from))), fwdFromName(4096) { | , fwdFromVersion(fwdFrom->nameVersion) | ||||||
|  | , fromWidth(st::msgServiceFont->m.width(lang(lng_forwarded_from))) | ||||||
|  | { | ||||||
| 	fwdNameUpdated(); | 	fwdNameUpdated(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -2946,7 +3029,10 @@ QString HistoryServiceMsg::messageByAction(const MTPmessageAction &action, TextL | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| HistoryServiceMsg::HistoryServiceMsg(History *history, HistoryBlock *block, const MTPDmessageService &msg) : | 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; | 	TextLinkPtr second; | ||||||
| 	QString text(messageByAction(msg.vaction, 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) : | 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(); | 	_maxw = _text.maxWidth() + st::msgServicePadding.left() + st::msgServicePadding.right(); | ||||||
| 	_minh = _text.minHeight(); | 	_minh = _text.minHeight(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -57,7 +57,7 @@ struct ChatData; | ||||||
| struct UserData; | struct UserData; | ||||||
| struct PeerData { | struct PeerData { | ||||||
| 	PeerData(const PeerId &id); | 	PeerData(const PeerId &id); | ||||||
| 	~PeerData() { | 	virtual ~PeerData() { | ||||||
| 		if (notify != UnknownNotifySettings && notify != EmptyNotifySettings) { | 		if (notify != UnknownNotifySettings && notify != EmptyNotifySettings) { | ||||||
| 			delete notify; | 			delete notify; | ||||||
| 			notify = UnknownNotifySettings; | 			notify = UnknownNotifySettings; | ||||||
|  | @ -212,7 +212,7 @@ enum FileStatus { | ||||||
| 
 | 
 | ||||||
| struct VideoData { | 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) : | 	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)); | 		memset(md5, 0, sizeof(md5)); | ||||||
| 	} | 	} | ||||||
| 	void forget() { | 	void forget() { | ||||||
|  | @ -314,7 +314,7 @@ public: | ||||||
| 
 | 
 | ||||||
| struct AudioData { | 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) :  | 	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)); | 		memset(md5, 0, sizeof(md5)); | ||||||
| 	} | 	} | ||||||
| 	void forget() { | 	void forget() { | ||||||
|  | @ -412,7 +412,7 @@ public: | ||||||
| 
 | 
 | ||||||
| struct DocumentData { | 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) : | 	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)); | 		memset(md5, 0, sizeof(md5)); | ||||||
| 	} | 	} | ||||||
| 	void forget() { | 	void forget() { | ||||||
|  | @ -628,7 +628,7 @@ struct History : public QList<HistoryBlock*> { | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| struct DialogsList { | 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 { | 	void adjustCurrent(int32 y, int32 h) const { | ||||||
|  | @ -985,7 +985,7 @@ public: | ||||||
| 		return _out; | 		return _out; | ||||||
| 	} | 	} | ||||||
| 	bool unread() const { | 	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; | 		return _unread; | ||||||
| 	} | 	} | ||||||
| 	virtual bool needCheck() const { | 	virtual bool needCheck() const { | ||||||
|  |  | ||||||
|  | @ -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
 | // 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),  | HistoryList::HistoryList(HistoryWidget *historyWidget, ScrollArea *scroll, History *history) : QWidget(0) | ||||||
| 	historyWidget(historyWidget), scrollArea(scroll), hist(history), currentBlock(0), currentItem(0), _menu(0), |     , hist(history) | ||||||
| 	_dragAction(NoDrag), _dragItem(0), _dragSelFrom(0), _dragSelTo(0), _dragSelecting(false), |     , historyWidget(historyWidget) | ||||||
| 	_dragSelType(TextSelectLetters), _dragWasInactive(false), |     , scrollArea(scroll) | ||||||
| 	_touchScroll(false), _touchSelect(false), _touchInProgress(false), |     , currentBlock(0) | ||||||
| 	_touchScrollState(TouchScrollManual), _touchPrevPosValid(false), _touchWaitingAcceleration(false), _touchSpeedTime(0), _touchAccelerationTime(0), _touchTime(0), |     , currentItem(0) | ||||||
| 	_cursor(style::cur_default) { |     , _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); | 	linkTipTimer.setSingleShot(true); | ||||||
| 	connect(&linkTipTimer, SIGNAL(timeout()), this, SLOT(showLinkTip())); | 	connect(&linkTipTimer, SIGNAL(timeout()), this, SLOT(showLinkTip())); | ||||||
|  | @ -167,8 +184,8 @@ void HistoryList::touchUpdateSpeed() { | ||||||
| 			if (_touchScrollState == TouchScrollAuto) { | 			if (_touchScrollState == TouchScrollAuto) { | ||||||
| 				const int oldSpeedY = _touchSpeed.y(); | 				const int oldSpeedY = _touchSpeed.y(); | ||||||
| 				const int oldSpeedX = _touchSpeed.x(); | 				const int oldSpeedX = _touchSpeed.x(); | ||||||
| 				if ((oldSpeedY <= 0 && newSpeedY <= 0) || (oldSpeedY >= 0 && newSpeedY >= 0) | 				if ((oldSpeedY <= 0 && newSpeedY <= 0) || ((oldSpeedY >= 0 && newSpeedY >= 0) | ||||||
| 					&& (oldSpeedX <= 0 && newSpeedX <= 0) || (oldSpeedX >= 0 && newSpeedX >= 0)) { | 					&& (oldSpeedX <= 0 && newSpeedX <= 0)) || (oldSpeedX >= 0 && newSpeedX >= 0)) { | ||||||
| 					_touchSpeed.setY(snap((oldSpeedY + (newSpeedY / 4)), -MaxScrollAccelerated, +MaxScrollAccelerated)); | 					_touchSpeed.setY(snap((oldSpeedY + (newSpeedY / 4)), -MaxScrollAccelerated, +MaxScrollAccelerated)); | ||||||
| 					_touchSpeed.setX(snap((oldSpeedX + (newSpeedX / 4)), -MaxScrollAccelerated, +MaxScrollAccelerated)); | 					_touchSpeed.setX(snap((oldSpeedX + (newSpeedX / 4)), -MaxScrollAccelerated, +MaxScrollAccelerated)); | ||||||
| 				} else { | 				} 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_save_image), this, SLOT(saveContextImage()))->setEnabled(true); | ||||||
| 				_menu->addAction(lang(lng_context_copy_image), this, SLOT(copyContextImage()))->setEnabled(true); | 				_menu->addAction(lang(lng_context_copy_image), this, SLOT(copyContextImage()))->setEnabled(true); | ||||||
| 			} else { | 			} 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); | 					_menu->addAction(lang(lng_context_cancel_download), this, SLOT(cancelContextDownload()))->setEnabled(true); | ||||||
| 				} else { | 				} 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(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); | 					_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) { | 	for (SelectedItems::const_iterator i = _selected.cbegin(), e = _selected.cend(); i != e; ++i) { | ||||||
| 		HistoryItem *item = i.key(); | 		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); | 			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); | 				_selected[_dragItem] = _dragItem->adjustSelection(qMin(second, _dragSymbol), qMax(second, _dragSymbol), _dragSelType); | ||||||
| 				updateDragSelection(0, 0, false); | 				updateDragSelection(0, 0, false); | ||||||
| 			} else { | 			} 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; | 				HistoryItem *dragSelFrom = _dragItem, *dragSelTo = item; | ||||||
| 				if (!dragSelFrom->hasPoint(_dragStartPos.x(), _dragStartPos.y())) { // maybe exclude dragSelFrom
 | 				if (!dragSelFrom->hasPoint(_dragStartPos.x(), _dragStartPos.y())) { // maybe exclude dragSelFrom
 | ||||||
| 					if (selectingDown) { | 					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); | 							dragSelFrom = (dragSelFrom == dragSelTo) ? 0 : nextItem(dragSelFrom); | ||||||
| 						} | 						} | ||||||
| 					} else { | 					} 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); | 							dragSelFrom = (dragSelFrom == dragSelTo) ? 0 : prevItem(dragSelFrom); | ||||||
| 						} | 						} | ||||||
| 					} | 					} | ||||||
|  | @ -1218,11 +1235,19 @@ void MessageField::focusInEvent(QFocusEvent *e) { | ||||||
| 	emit focused(); | 	emit focused(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| HistoryHider::HistoryHider(MainWidget *parent, bool forwardSelected) : QWidget(parent), | HistoryHider::HistoryHider(MainWidget *parent, bool forwardSelected) : QWidget(parent) | ||||||
| 	aOpacity(0, 1), aOpacityFunc(anim::easeOutCirc), hiding(false), offered(0), _forwardRequest(0), |     , sharedContact(0) | ||||||
| 	toTextWidth(0), _forwardSelected(forwardSelected), sharedContact(0), shadow(st::boxShadow), |     , _forwardSelected(forwardSelected) | ||||||
| 	forwardButton(this, lang(lng_forward), st::btnSelectDone), |     , forwardButton(this, lang(lng_forward), st::btnSelectDone) | ||||||
| 	cancelButton(this, lang(lng_cancel), st::btnSelectCancel) { |     , 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(&forwardButton, SIGNAL(clicked()), this, SLOT(forward())); | ||||||
| 	connect(&cancelButton, SIGNAL(clicked()), this, SLOT(startHide())); | 	connect(&cancelButton, SIGNAL(clicked()), this, SLOT(startHide())); | ||||||
|  | @ -1234,11 +1259,19 @@ HistoryHider::HistoryHider(MainWidget *parent, bool forwardSelected) : QWidget(p | ||||||
| 	anim::start(this); | 	anim::start(this); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| HistoryHider::HistoryHider(MainWidget *parent, UserData *sharedContact) : QWidget(parent), | HistoryHider::HistoryHider(MainWidget *parent, UserData *sharedContact) : QWidget(parent) | ||||||
| 	aOpacity(0, 1), aOpacityFunc(anim::easeOutCirc), hiding(false), offered(0), _forwardRequest(0), |     , sharedContact(sharedContact) | ||||||
| 	toTextWidth(0), _forwardSelected(false), sharedContact(sharedContact), shadow(st::boxShadow), |     , _forwardSelected(false) | ||||||
| 	forwardButton(this, lang(lng_forward), st::btnSelectDone), |     , forwardButton(this, lang(lng_forward), st::btnSelectDone) | ||||||
| 	cancelButton(this, lang(lng_cancel), st::btnSelectCancel) { |     , 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(&forwardButton, SIGNAL(clicked()), this, SLOT(forward())); | ||||||
| 	connect(&cancelButton, SIGNAL(clicked()), this, SLOT(startHide())); | 	connect(&cancelButton, SIGNAL(clicked()), this, SLOT(startHide())); | ||||||
|  | @ -1382,7 +1415,7 @@ void HistoryHider::resizeEvent(QResizeEvent *e) { | ||||||
| 
 | 
 | ||||||
| void HistoryHider::offerPeer(PeerId peer) { | void HistoryHider::offerPeer(PeerId peer) { | ||||||
| 	offered = App::peer(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(); | 	toTextWidth = toText.maxWidth(); | ||||||
| 	if (toTextWidth > box.width() - st::boxPadding.left() - st::boxPadding.right()) { | 	if (toTextWidth > box.width() - st::boxPadding.left() - st::boxPadding.right()) { | ||||||
| 		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); | 	parent()->noHider(this); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| HistoryWidget::HistoryWidget(QWidget *parent) : QWidget(parent), noTypingUpdate(false), serviceImageCacheSize(0), | HistoryWidget::HistoryWidget(QWidget *parent) : QWidget(parent) | ||||||
| 	_scroll(this, st::historyScroll, false), _list(0), histPeer(0), _activePeer(0), histOffset(0), histCount(-1), |     , histOffset(0) | ||||||
| 	hist(0), histPreloading(0), histReadRequestId(0), hiderOffered(false), _histInited(false), |     , histCount(-1) | ||||||
| 	_send(this, lang(lng_send_button), st::btnSend), histRequestsCount(0), |     , histReadRequestId(0) | ||||||
| 	_attachDocument(this, st::btnAttachDocument), _attachPhoto(this, st::btnAttachPhoto), _attachEmoji(this, st::btnAttachEmoji), |     , histRequestsCount(0) | ||||||
| 	confirmImageId(0), loadingChatId(0), loadingRequestId(0), titlePeerTextWidth(0), |     , histPeer(0) | ||||||
| 	_field(this, st::taMsgField, lang(lng_message_ph)), bg(st::msgBG), imageLoader(this), |     , _activePeer(0) | ||||||
| 	_attachType(this), _emojiPan(this), _attachDrag(DragStateNone), _attachDragDocument(this), _attachDragPhoto(this), _scrollDelta(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); | 	_scroll.setFocusPolicy(Qt::NoFocus); | ||||||
| 
 | 
 | ||||||
| 	setAcceptDrops(true); | 	setAcceptDrops(true); | ||||||
|  | @ -1462,7 +1519,7 @@ void HistoryWidget::onTextChange() { | ||||||
| 
 | 
 | ||||||
| void HistoryWidget::updateTyping(bool typing) { | void HistoryWidget::updateTyping(bool typing) { | ||||||
| 	uint64 ms = getms() + 10000; | 	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; | 	hist->myTyping = typing ? ms : 0; | ||||||
| 	if (typing) MTP::send(MTPmessages_SetTyping(histPeer->input, MTP_bool(typing))); | 	if (typing) MTP::send(MTPmessages_SetTyping(histPeer->input, MTP_bool(typing))); | ||||||
|  | @ -1877,7 +1934,7 @@ void HistoryWidget::loadMessages() { | ||||||
| void HistoryWidget::onListScroll() { | void HistoryWidget::onListScroll() { | ||||||
| 	App::checkImageCacheSize(); | 	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); | 		checkUnreadLoaded(true); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
|  | @ -1951,7 +2008,7 @@ mtpRequestId HistoryWidget::onForward(const PeerId &peer, bool forwardSelected) | ||||||
| 			newId = clientMsgId(); | 			newId = clientMsgId(); | ||||||
| 			hist->addToBackForwarded(newId, msg); | 			hist->addToBackForwarded(newId, msg); | ||||||
| 			MTP::send(MTPmessages_ForwardMessage(histPeer->input, MTP_int(item->id), MTP_long(randomId)), App::main()->rpcDone(&MainWidget::sentFullDataReceived, randomId)); | 			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();
 | 	//		newId = clientMsgId();
 | ||||||
| 	//		MTP::send(MTPmessages_ForwardMessage(histPeer->input, MTP_int(item->id), MTP_long(randomId)), App::main()->rpcDone(&MainWidget::sentFullDataReceived, randomId));
 | 	//		MTP::send(MTPmessages_ForwardMessage(histPeer->input, MTP_int(item->id), MTP_long(randomId)), App::main()->rpcDone(&MainWidget::sentFullDataReceived, randomId));
 | ||||||
| 		} else if (msg) { | 		} else if (msg) { | ||||||
|  | @ -2407,7 +2464,6 @@ void HistoryWidget::onPhotoReady() { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void HistoryWidget::onPhotoFailed(quint64 id) { | void HistoryWidget::onPhotoFailed(quint64 id) { | ||||||
| 	id = id; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void HistoryWidget::confirmSendImage(const ReadyLocalMedia &img) { | void HistoryWidget::confirmSendImage(const ReadyLocalMedia &img) { | ||||||
|  | @ -2545,7 +2601,7 @@ void HistoryWidget::resizeEvent(QResizeEvent *e) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void HistoryWidget::updateListSize(int32 addToY, bool initial) { | 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()
 | 	if (!App::wnd()->isVisible()) return; // scrollTopMax etc are not working after recountHeight()
 | ||||||
| 
 | 
 | ||||||
|  | @ -2788,8 +2844,8 @@ void HistoryWidget::paintEvent(QPaintEvent *e) { | ||||||
| 
 | 
 | ||||||
| 			// points
 | 			// points
 | ||||||
| 			p.setOpacity(st::introPointAlpha); | 			p.setOpacity(st::introPointAlpha); | ||||||
| 			int x = pointsLeft + st::introPointLeft; | 			int32 x = pointsLeft + st::introPointLeft; | ||||||
| 			for (uint32 i = 0; i < pointsCount; ++i) { | 			for (int32 i = 0; i < pointsCount; ++i) { | ||||||
| 				p.fillRect(x, pointsTop + st::introPointTop, st::introPointWidth, st::introPointHeight, st::introPointColor->b); | 				p.fillRect(x, pointsTop + st::introPointTop, st::introPointWidth, st::introPointHeight, st::introPointColor->b); | ||||||
| 				x += (st::introPointWidth + 2 * st::introPointDelta); | 				x += (st::introPointWidth + 2 * st::introPointDelta); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
|  | @ -45,8 +45,8 @@ namespace { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| IntroWidget::IntroWidget(Window *window) : QWidget(window), | IntroWidget::IntroWidget(Window *window) : QWidget(window), | ||||||
| 	wnd(window), cacheForHideInd(0), cacheForShowInd(0), _callTimeout(60), | 	cacheForHideInd(0), cacheForShowInd(0), wnd(window), steps(new IntroSteps(this)), | ||||||
| 	steps(new IntroSteps(this)), phone(0), code(0), signup(0), current(0), moving(0), visibilityChanging(0) { |     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)); | 	setGeometry(QRect(0, st::titleHeight, wnd->width(), wnd->height() - st::titleHeight)); | ||||||
| 
 | 
 | ||||||
| 	countryForReg = psCurrentCountry(); | 	countryForReg = psCurrentCountry(); | ||||||
|  |  | ||||||
|  | @ -67,10 +67,10 @@ void CodeInput::correctValue(QKeyEvent *e, const QString &was) { | ||||||
| 	if (strict) emit codeEntered(); | 	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), | 	next(this, lang(lng_intro_next), st::btnIntroNext), | ||||||
| 	back(this, lang(lng_intro_back), st::btnIntroBack), | 	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); | 	setVisible(false); | ||||||
| 	setGeometry(parent->innerRect()); | 	setGeometry(parent->innerRect()); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -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), | 	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), | 	country(this, st::introCountry), | ||||||
| 	phone(this, st::inpIntroPhone, lang(lng_phone_ph)), code(this, st::inpIntroCountryCode) { | 	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); | 	setVisible(false); | ||||||
| 	setGeometry(parent->innerRect()); | 	setGeometry(parent->innerRect()); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -28,7 +28,8 @@ Copyright (c) 2014 John Preston, https://tdesktop.com | ||||||
| #include "intro/intro.h" | #include "intro/intro.h" | ||||||
| 
 | 
 | ||||||
| IntroSignup::IntroSignup(IntroWidget *parent) : IntroStage(parent), | 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)), | 	first(this, st::inpIntroName, lang(lng_signup_firstname)), | ||||||
| 	last(this, st::inpIntroName, lang(lng_signup_lastname)) { | 	last(this, st::inpIntroName, lang(lng_signup_lastname)) { | ||||||
| 	setVisible(false); | 	setVisible(false); | ||||||
|  |  | ||||||
|  | @ -66,7 +66,7 @@ namespace { | ||||||
| 		if (!skipJunk(from, end)) return false; | 		if (!skipJunk(from, end)) return false; | ||||||
| 
 | 
 | ||||||
| 		const char *nameStart = from; | 		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; | 			++from; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -126,9 +126,23 @@ BackgroundWidget::~BackgroundWidget() { | ||||||
| 	if (_hidden) _hidden->deleteLater(); | 	if (_hidden) _hidden->deleteLater(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| LayerWidget::LayerWidget(QWidget *parent, PhotoData *photo, HistoryItem *item) : QWidget(parent), photo(photo), video(0), | LayerWidget::LayerWidget(QWidget *parent, PhotoData *photo, HistoryItem *item) : QWidget(parent) | ||||||
| 	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), | , photo(photo) | ||||||
| 	_touchPress(false), _touchMove(false), _touchRightButton(false), _menu(0) { | , 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; | 	int32 x, y, w; | ||||||
| 	if (App::wnd()->getPhotoCoords(photo, x, y, w)) { | 	if (App::wnd()->getPhotoCoords(photo, x, y, w)) { | ||||||
| 		iX = anim::ivalue(x); | 		iX = anim::ivalue(x); | ||||||
|  | @ -149,9 +163,23 @@ LayerWidget::LayerWidget(QWidget *parent, PhotoData *photo, HistoryItem *item) : | ||||||
| 	connect(&_touchTimer, SIGNAL(timeout()), this, SLOT(onTouchTimer())); | 	connect(&_touchTimer, SIGNAL(timeout()), this, SLOT(onTouchTimer())); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| LayerWidget::LayerWidget(QWidget *parent, VideoData *video, HistoryItem *item) : QWidget(parent), photo(0), video(video), | LayerWidget::LayerWidget(QWidget *parent, VideoData *video, HistoryItem *item) : QWidget(parent) | ||||||
| 	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), | , photo(0) | ||||||
| 	_touchPress(false), _touchMove(false), _touchRightButton(false), _menu(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; | 	int32 x, y, w; | ||||||
| 	if (App::wnd()->getVideoCoords(video, x, y, w)) { | 	if (App::wnd()->getVideoCoords(video, x, y, w)) { | ||||||
| 		iX = anim::ivalue(x); | 		iX = anim::ivalue(x); | ||||||
|  | @ -279,7 +307,7 @@ void LayerWidget::keyPressEvent(QKeyEvent *e) { | ||||||
| 				photo->full->pix().toImage().save(file, "JPG"); | 				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()); | 		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_forward_image), this, SLOT(forwardMessage()))->setEnabled(true); | ||||||
| 			} | 			} | ||||||
| 			_menu->addAction(lang(lng_context_delete_image), this, SLOT(deleteMessage()))->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->addAction(lang(lng_context_delete_image), this, SLOT(deleteMessage()))->setEnabled(true); | ||||||
| 		} | 		} | ||||||
| 		_menu->setAttribute(Qt::WA_DeleteOnClose); | 		_menu->setAttribute(Qt::WA_DeleteOnClose); | ||||||
|  |  | ||||||
|  | @ -19,7 +19,10 @@ Copyright (c) 2014 John Preston, https://tdesktop.com | ||||||
| #include "localimageloader.h" | #include "localimageloader.h" | ||||||
| #include <libexif/exif-data.h> | #include <libexif/exif-data.h> | ||||||
| 
 | 
 | ||||||
| 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); | 	moveToThread(thread); | ||||||
| 	connect(loader, SIGNAL(needToPrepare()), this, SLOT(prepareImages())); | 	connect(loader, SIGNAL(needToPrepare()), this, SLOT(prepareImages())); | ||||||
| 	connect(this, SIGNAL(imageReady()), loader, SLOT(onImageReady())); | 	connect(this, SIGNAL(imageReady()), loader, SLOT(onImageReady())); | ||||||
|  | @ -101,7 +104,7 @@ void LocalImageLoaderPrivate::prepareImages() { | ||||||
| 		filesize = 0; | 		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()); | 			QMutexLocker lock(loader->toPrepareMutex()); | ||||||
| 			ToPrepareMedias &list(loader->toPrepareMedias()); | 			ToPrepareMedias &list(loader->toPrepareMedias()); | ||||||
|  |  | ||||||
|  | @ -25,11 +25,11 @@ enum ToPrepareMediaType { | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| struct ToPrepareMedia { | struct ToPrepareMedia { | ||||||
| 	ToPrepareMedia(const QString &file, const PeerId &peer, ToPrepareMediaType t) : file(file), peer(peer), id(MTP::nonce<PhotoId>()), type(t) { | 	ToPrepareMedia(const QString &file, const PeerId &peer, ToPrepareMediaType t) : id(MTP::nonce<PhotoId>()), file(file), peer(peer), type(t) { | ||||||
| 	} | 	} | ||||||
| 	ToPrepareMedia(const QImage &img, const PeerId &peer, ToPrepareMediaType t) : img(img), peer(peer), id(MTP::nonce<PhotoId>()), type(t) { | 	ToPrepareMedia(const QImage &img, const PeerId &peer, ToPrepareMediaType t) : id(MTP::nonce<PhotoId>()), img(img), peer(peer), type(t) { | ||||||
| 	} | 	} | ||||||
| 	ToPrepareMedia(const QByteArray &data, const PeerId &peer, ToPrepareMediaType t) : data(data), peer(peer), id(MTP::nonce<PhotoId>()), type(t) { | 	ToPrepareMedia(const QByteArray &data, const PeerId &peer, ToPrepareMediaType t) : id(MTP::nonce<PhotoId>()), data(data), peer(peer), type(t) { | ||||||
| 	} | 	} | ||||||
| 	PhotoId id; | 	PhotoId id; | ||||||
| 	QString file; | 	QString file; | ||||||
|  | @ -43,7 +43,7 @@ typedef QList<ToPrepareMedia> ToPrepareMedias; | ||||||
| typedef QMap<int32, QByteArray> LocalFileParts; | typedef QMap<int32, QByteArray> LocalFileParts; | ||||||
| struct ReadyLocalMedia { | 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) : | 	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()) { | 		if (!jpeg.isEmpty()) { | ||||||
| 			int32 size = jpeg.size(); | 			int32 size = jpeg.size(); | ||||||
| 			for (int32 i = 0, part = 0; i < size; i += UploadPartSize, ++part) { | 			for (int32 i = 0, part = 0; i < size; i += UploadPartSize, ++part) { | ||||||
|  |  | ||||||
|  | @ -260,9 +260,9 @@ MainWidget *TopBarWidget::main() { | ||||||
| 	return static_cast<MainWidget*>(parentWidget()); | 	return static_cast<MainWidget*>(parentWidget()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| MainWidget::MainWidget(Window *window) : QWidget(window), profile(0), _dialogsWidth(st::dlgMinWidth), | MainWidget::MainWidget(Window *window) : QWidget(window), failedObjId(0), _dialogsWidth(st::dlgMinWidth), | ||||||
| 	updPts(0), updDate(0), updQts(0), updSeq(0), updInited(false), failedObjId(0), | 	dialogs(this), history(this), profile(0), _topBar(this), hider(0), | ||||||
| 	dialogs(this), history(this), onlineRequest(0), hider(0), _topBar(this) { |     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)); | 	setGeometry(QRect(0, st::titleHeight, App::wnd()->width(), App::wnd()->height() - st::titleHeight)); | ||||||
| 
 | 
 | ||||||
| 	connect(window, SIGNAL(resized(const QSize &)), this, SLOT(onParentResize(const QSize &))); | 	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) { | bool MainWidget::leaveChatFailed(PeerData *peer, const RPCError &e) { | ||||||
| 	if (e.type() == "CHAT_ID_INVALID") { // left this chat already
 | 	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); | 			showPeer(0); | ||||||
| 		} | 		} | ||||||
| 		dialogs.removePeer(peer); | 		dialogs.removePeer(peer); | ||||||
|  | @ -370,7 +370,7 @@ bool MainWidget::leaveChatFailed(PeerData *peer, const RPCError &e) { | ||||||
| 
 | 
 | ||||||
| void MainWidget::deleteHistory(PeerData *peer, const MTPmessages_StatedMessage &result) { | void MainWidget::deleteHistory(PeerData *peer, const MTPmessages_StatedMessage &result) { | ||||||
| 	sentFullDataReceived(0, 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); | 		showPeer(0); | ||||||
| 	} | 	} | ||||||
| 	dialogs.removePeer(peer); | 	dialogs.removePeer(peer); | ||||||
|  | @ -398,7 +398,7 @@ void MainWidget::deleteHistoryAndContact(UserData *user, const MTPcontacts_Link | ||||||
| 	App::feedUsers(MTP_vector<MTPUser>(QVector<MTPUser>(1, d.vuser))); | 	App::feedUsers(MTP_vector<MTPUser>(QVector<MTPUser>(1, d.vuser))); | ||||||
| 	App::feedUserLink(MTP_int(user->id & 0xFFFFFFFF), d.vmy_link, d.vforeign_link); | 	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); | 		showPeer(0); | ||||||
| 	} | 	} | ||||||
| 	dialogs.removePeer(user); | 	dialogs.removePeer(user); | ||||||
|  | @ -472,7 +472,7 @@ void MainWidget::checkedHistory(PeerData *peer, const MTPmessages_Messages &resu | ||||||
| 	if (!v) return; | 	if (!v) return; | ||||||
| 
 | 
 | ||||||
| 	if (v->isEmpty()) { | 	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); | 			showPeer(0); | ||||||
| 		} | 		} | ||||||
| 		dialogs.removePeer(peer); | 		dialogs.removePeer(peer); | ||||||
|  | @ -1113,7 +1113,7 @@ void MainWidget::onTopBarClick() { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void MainWidget::onPeerShown(PeerData *peer) { | void MainWidget::onPeerShown(PeerData *peer) { | ||||||
| 	if (profile || peer && peer->id) { | 	if (profile || (peer && peer->id)) { | ||||||
| 		_topBar.show(); | 		_topBar.show(); | ||||||
| 	} else { | 	} else { | ||||||
| 		_topBar.hide(); | 		_topBar.hide(); | ||||||
|  |  | ||||||
|  | @ -25,7 +25,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com | ||||||
| #include "profilewidget.h" | #include "profilewidget.h" | ||||||
| 
 | 
 | ||||||
| class Window; | class Window; | ||||||
| class DialogRow; | struct DialogRow; | ||||||
| class MainWidget; | class MainWidget; | ||||||
| 
 | 
 | ||||||
| class TopBarWidget : public QWidget, public Animated { | class TopBarWidget : public QWidget, public Animated { | ||||||
|  |  | ||||||
|  | @ -483,7 +483,7 @@ namespace MTP { | ||||||
| 		if (!started) return; | 		if (!started) return; | ||||||
| 
 | 
 | ||||||
| 		int32 m = mainSession->getDC(); | 		int32 m = mainSession->getDC(); | ||||||
| 		if (!dc || m == dc || m && fromZeroOnly) return; | 		if (!dc || m == dc || (m && fromZeroOnly)) return; | ||||||
| 		mtpSetDC(dc); | 		mtpSetDC(dc); | ||||||
| 		mainSession = _mtp_internal::getSession(dc); | 		mainSession = _mtp_internal::getSession(dc); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -517,7 +517,7 @@ namespace { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| MTPabstractTcpConnection::MTPabstractTcpConnection() : | 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() { | void MTPabstractTcpConnection::socketRead() { | ||||||
|  | @ -1033,22 +1033,22 @@ void MTProtoConnectionPrivate::createConn() { | ||||||
| 
 | 
 | ||||||
| MTProtoConnectionPrivate::MTProtoConnectionPrivate(QThread *thread, MTProtoConnection *owner, MTPSessionData *data, uint32 _dc) | MTProtoConnectionPrivate::MTProtoConnectionPrivate(QThread *thread, MTProtoConnection *owner, MTPSessionData *data, uint32 _dc) | ||||||
| 	: QObject(0) | 	: QObject(0) | ||||||
| 	, dc(_dc) |  | ||||||
| 	, conn(0) |  | ||||||
| 	, retryTimeout(1) |  | ||||||
| 	, receiveDelay(MinReceiveDelay) |  | ||||||
| 	, firstSentAt(-1) |  | ||||||
| 	, oldConnection(true) |  | ||||||
| 	, _state(MTProtoConnection::Disconnected) | 	, _state(MTProtoConnection::Disconnected) | ||||||
| 	, _owner(owner) |     , dc(_dc) | ||||||
| 	, sessionData(data) |     , _owner(owner) | ||||||
| 	, keyId(0) |     , conn(0) | ||||||
| 	, pingId(0) |     , retryTimeout(1) | ||||||
| 	, toSendPingId(0) |     , oldConnection(true) | ||||||
| 	, pingMsgId(0) |     , receiveDelay(MinReceiveDelay) | ||||||
| 	, restarted(false) |     , firstSentAt(-1) | ||||||
| 	, ackRequest(MTP_msgs_ack(MTPVector<MTPlong>())) | 	, ackRequest(MTP_msgs_ack(MTPVector<MTPlong>())) | ||||||
| 	, myKeyLock(false) |     , pingId(0) | ||||||
|  |     , toSendPingId(0) | ||||||
|  |     , pingMsgId(0) | ||||||
|  |     , restarted(false) | ||||||
|  |     , keyId(0) | ||||||
|  |     , sessionData(data) | ||||||
|  |     , myKeyLock(false) | ||||||
| 	, authKeyData(0) { | 	, authKeyData(0) { | ||||||
| 
 | 
 | ||||||
| 	ackRequestData = &ackRequest._msgs_ack().vmsg_ids._vector().v; | 	ackRequestData = &ackRequest._msgs_ack().vmsg_ids._vector().v; | ||||||
|  | @ -1405,7 +1405,7 @@ void MTProtoConnectionPrivate::onReceivedSome() { | ||||||
| 		int32 ms = getms() - firstSentAt; | 		int32 ms = getms() - firstSentAt; | ||||||
| 		DEBUG_LOG(("MTP Info: response in %1ms, receiveDelay: %2ms").arg(ms).arg(receiveDelay)); | 		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; | 		firstSentAt = -1; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | @ -1502,7 +1502,7 @@ void MTProtoConnectionPrivate::handleReceived() { | ||||||
| 		uint32 seqNo = *(uint32*)&data[6], msgLen = *(uint32*)&data[7]; | 		uint32 seqNo = *(uint32*)&data[6], msgLen = *(uint32*)&data[7]; | ||||||
| 		bool needAck = (seqNo & 0x01); | 		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())); | 			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())); | 			TCP_LOG(("TCP Error: bad message %1").arg(mb(encrypted, len * sizeof(mtpPrime)).str())); | ||||||
| 			conn->received().pop_front(); | 			conn->received().pop_front(); | ||||||
|  | @ -1987,7 +1987,7 @@ int32 MTProtoConnectionPrivate::handleOneReceived(const mtpPrime *from, const mt | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		mtpRequestId requestId = wasSent(reqMsgId.v); | 		mtpRequestId requestId = wasSent(reqMsgId.v); | ||||||
| 		if (requestId && requestId != 0xFFFFFFFF) { | 		if (requestId && requestId != mtpRequestId(0xFFFFFFFF)) { | ||||||
| 			QWriteLocker locker(sessionData->haveReceivedMutex()); | 			QWriteLocker locker(sessionData->haveReceivedMutex()); | ||||||
| 			sessionData->haveReceivedMap().insert(requestId, response); // save rpc_result for processing in main mtp thread
 | 			sessionData->haveReceivedMap().insert(requestId, response); // save rpc_result for processing in main mtp thread
 | ||||||
| 		} else { | 		} else { | ||||||
|  | @ -2899,12 +2899,12 @@ bool MTProtoConnectionPrivate::sendRequest(mtpRequest &request, bool needAnyResp | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| mtpRequestId MTProtoConnectionPrivate::wasSent(mtpMsgId msgId) const { | mtpRequestId MTProtoConnectionPrivate::wasSent(mtpMsgId msgId) const { | ||||||
| 	if (msgId == pingMsgId) return 0xFFFFFFFF; | 	if (msgId == pingMsgId) return mtpRequestId(0xFFFFFFFF); | ||||||
| 	{ | 	{ | ||||||
| 		QReadLocker locker(sessionData->haveSentMutex()); | 		QReadLocker locker(sessionData->haveSentMutex()); | ||||||
| 		const mtpRequestMap &haveSent(sessionData->haveSentMap()); | 		const mtpRequestMap &haveSent(sessionData->haveSentMap()); | ||||||
| 		mtpRequestMap::const_iterator i = haveSent.constFind(msgId); | 		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()); | 		QReadLocker locker(sessionData->toResendMutex()); | ||||||
|  |  | ||||||
|  | @ -84,7 +84,7 @@ namespace { | ||||||
| 					continue; | 					continue; | ||||||
| 				} | 				} | ||||||
| 				uint32 dataLen = *(const uint32*)decrypted.constData(); | 				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())); | 					LOG(("MTP Error: bad decrypted part size: %1, fullDataLen: %2, decrypted size: %3").arg(dataLen).arg(fullDataLen).arg(decrypted.size())); | ||||||
| 					continue; | 					continue; | ||||||
| 				} | 				} | ||||||
|  | @ -200,7 +200,7 @@ namespace { | ||||||
| 			DEBUG_LOG(("MTP Info: keys file opened for reading")); | 			DEBUG_LOG(("MTP Info: keys file opened for reading")); | ||||||
| 			int32 oldFound = readAuthKeys(keysFile); | 			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())); | 				gDCOptions.insert(1, mtpDcOption(1, "", cFirstDCIp(), cFirstDCPort())); | ||||||
| 				userId = 0; | 				userId = 0; | ||||||
| 				mainDC = 0; | 				mainDC = 0; | ||||||
|  |  | ||||||
|  | @ -34,8 +34,10 @@ namespace { | ||||||
| 	LoaderQueues queues; | 	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), | mtpFileLoader::mtpFileLoader(int32 dc, const int64 &volume, int32 local, const int64 &secret) : prev(0), next(0), | ||||||
| 	dc(dc), volume(volume), local(local), secret(secret), size(0), type(MTP_storage_fileUnknown()), locationType(0), id(0), access(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); | 	LoaderQueues::iterator i = queues.find(dc); | ||||||
| 	if (i == queues.cend()) { | 	if (i == queues.cend()) { | ||||||
| 		i = queues.insert(dc, mtpFileLoaderQueue()); | 		i = queues.insert(dc, mtpFileLoaderQueue()); | ||||||
|  | @ -43,8 +45,10 @@ mtpFileLoader::mtpFileLoader(int32 dc, const int64 &volume, int32 local, const i | ||||||
| 	queue = &i.value(); | 	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), | mtpFileLoader::mtpFileLoader(int32 dc, const uint64 &id, const uint64 &access, mtpTypeId locType, const QString &to, int32 size) : prev(0), next(0), | ||||||
| 	dc(dc), id(id), access(access), type(MTP_storage_fileUnknown()), locationType(locType), file(to), initialSize(size) { |     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); | 	LoaderQueues::iterator i = queues.find(MTP::dld + dc); | ||||||
| 	if (i == queues.cend()) { | 	if (i == queues.cend()) { | ||||||
| 		i = queues.insert(MTP::dld + dc, mtpFileLoaderQueue()); | 		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); | 		const string &bytes(d.vbytes.c_string().v); | ||||||
| 		if (bytes.size()) { | 		if (bytes.size()) { | ||||||
| 			if (file.isOpen()) { | 			if (file.isOpen()) { | ||||||
| 				if (file.write(bytes.data(), bytes.size()) != bytes.size()) { | 				if (file.write(bytes.data(), bytes.size()) != qint64(bytes.size())) { | ||||||
| 					return finishFail(); | 					return finishFail(); | ||||||
| 				} | 				} | ||||||
| 			} else { | 			} else { | ||||||
|  | @ -318,7 +322,7 @@ bool mtpFileLoader::loading() const { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void mtpFileLoader::started(bool loadFirst, bool prior) { | void mtpFileLoader::started(bool loadFirst, bool prior) { | ||||||
| 	if (queue->queries >= MaxFileQueries && (!loadFirst || !prior) || complete) return; | 	if ((queue->queries >= MaxFileQueries && (!loadFirst || !prior)) || complete) return; | ||||||
| 	loadPart(); | 	loadPart(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -457,7 +457,7 @@ class RPCBindedDoneHandlerOwned : public RPCOwnedDoneHandler { // done(b, result | ||||||
| 	typedef TReturn (TReceiver::*CallbackType)(T, const TResponse &); | 	typedef TReturn (TReceiver::*CallbackType)(T, const TResponse &); | ||||||
| 
 | 
 | ||||||
| public: | 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 { | 	virtual void operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) const { | ||||||
| 		if (_owner) (static_cast<TReceiver*>(_owner)->*_onDone)(_b, TResponse(from, end)); | 		if (_owner) (static_cast<TReceiver*>(_owner)->*_onDone)(_b, TResponse(from, end)); | ||||||
|  | @ -589,7 +589,7 @@ class RPCBindedFailHandlerOwned : public RPCOwnedFailHandler { // fail(b, error) | ||||||
| 	typedef bool (TReceiver::*CallbackType)(T, const RPCError &); | 	typedef bool (TReceiver::*CallbackType)(T, const RPCError &); | ||||||
| 
 | 
 | ||||||
| public: | 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 { | 	virtual bool operator()(mtpRequestId requestId, const RPCError &e) const { | ||||||
| 		return _owner ? (static_cast<TReceiver*>(_owner)->*_onFail)(_b, e) : true; | 		return _owner ? (static_cast<TReceiver*>(_owner)->*_onFail)(_b, e) : true; | ||||||
|  | @ -623,7 +623,7 @@ class RPCBindedFailHandlerOwnedNo : public RPCOwnedFailHandler { // fail(b) | ||||||
| 	typedef bool (TReceiver::*CallbackType)(T); | 	typedef bool (TReceiver::*CallbackType)(T); | ||||||
| 
 | 
 | ||||||
| public: | 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 { | 	virtual bool operator()(mtpRequestId requestId, const RPCError &e) const { | ||||||
| 		return _owner ? (static_cast<TReceiver*>(_owner)->*_onFail)(_b) : true; | 		return _owner ? (static_cast<TReceiver*>(_owner)->*_onFail)(_b) : true; | ||||||
|  | @ -640,7 +640,7 @@ class RPCBindedFailHandlerOwnedNoReq : public RPCOwnedFailHandler { // fail(b, r | ||||||
| 	typedef bool (TReceiver::*CallbackType)(T, mtpRequestId); | 	typedef bool (TReceiver::*CallbackType)(T, mtpRequestId); | ||||||
| 
 | 
 | ||||||
| public: | 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 { | 	virtual bool operator()(mtpRequestId requestId, const RPCError &e) const { | ||||||
| 		return _owner ? (static_cast<TReceiver*>(_owner)->*_onFail)(_b, requestId) : true; | 		return _owner ? (static_cast<TReceiver*>(_owner)->*_onFail)(_b, requestId) : true; | ||||||
|  |  | ||||||
|  | @ -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) { | void MTProtoSession::start(int32 dcenter, uint32 connects) { | ||||||
|  | @ -158,7 +158,7 @@ void MTProtoSession::checkRequestsByTimer() { | ||||||
| 						stateRequestIds.push_back(MTP_long(i.key())); | 						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.reserve(haveSentCount); | ||||||
| 				removingIds.push_back(i.key()); | 				removingIds.push_back(i.key()); | ||||||
| 			} | 			} | ||||||
|  | @ -216,7 +216,7 @@ int32 MTProtoSession::requestState(mtpRequestId requestId) const { | ||||||
| 				result = MTP::RequestConnecting; | 				result = MTP::RequestConnecting; | ||||||
| 			} | 			} | ||||||
| 		} else if (s < 0) { | 		} else if (s < 0) { | ||||||
| 			if (result < 0 && s > result || result == MTP::RequestSent) { | 			if ((result < 0 && s > result) || result == MTP::RequestSent) { | ||||||
| 				result = s; | 				result = s; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | @ -27,9 +27,9 @@ class MTPSessionData { | ||||||
| public: | public: | ||||||
| 	 | 	 | ||||||
| 	MTPSessionData(MTProtoSession *creator) | 	MTPSessionData(MTProtoSession *creator) | ||||||
| 	: _session(0), _salt(0), fakeRequestId(-2000000000) | 	: _session(0), _salt(0) | ||||||
| 	, _messagesSent(0), keyChecked(false) | 	, _messagesSent(0), fakeRequestId(-2000000000) | ||||||
| 	, _owner(creator) { | 	, _owner(creator), keyChecked(false) { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	void setSession(uint64 session) { | 	void setSession(uint64 session) { | ||||||
|  |  | ||||||
|  | @ -619,7 +619,7 @@ bool ProfileInner::animStep(float64 ms) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool ProfileInner::getPhotoCoords(PhotoData *photo, int32 &x, int32 &y, int32 &w) const { | 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; | 		x = _left; | ||||||
| 		y = st::profilePadding.top(); | 		y = st::profilePadding.top(); | ||||||
| 		w = st::setPhotoSize; | 		w = st::setPhotoSize; | ||||||
|  | @ -704,8 +704,11 @@ void ProfileInner::showAll() { | ||||||
| 	resize(width(), h); | 	resize(width(), h); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| ProfileWidget::ProfileWidget(QWidget *parent, const PeerData *peer) : QWidget(parent), | ProfileWidget::ProfileWidget(QWidget *parent, const PeerData *peer) : QWidget(parent) | ||||||
| 	_inner(this, &_scroll, peer), _scroll(this, st::setScroll), _showing(false) { |     , _scroll(this, st::setScroll) | ||||||
|  |     , _inner(this, &_scroll, peer) | ||||||
|  |     , _showing(false) | ||||||
|  | { | ||||||
| 	_scroll.setWidget(&_inner); | 	_scroll.setWidget(&_inner); | ||||||
| 	_scroll.move(0, 0); | 	_scroll.move(0, 0); | ||||||
| 	_inner.move(0, 0); | 	_inner.move(0, 0); | ||||||
|  |  | ||||||
|  | @ -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()),
 | PsNotifyWindow::PsNotifyWindow(HistoryItem *item, int32 x, int32 y) : history(item->history()),// started(GetTickCount()),
 | ||||||
| alphaDuration(st::notifyFastAnim), posDuration(st::notifyFastAnim), aY(y + st::notifyHeight + st::notifyDeltaY), close(this, st::notifyClose), aOpacityFunc(st::notifyFastAnimFunc) { | 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; | 	int32 w = st::notifyWidth, h = st::notifyHeight; | ||||||
| 	QImage img(w * cIntRetinaFactor(), h * cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied); | 	QImage img(w * cIntRetinaFactor(), h * cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied); | ||||||
|  |  | ||||||
|  | @ -101,6 +101,11 @@ public: | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| - (void) userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification { | - (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){ |     if (notification.activationType == NSUserNotificationActivationTypeReplied){ | ||||||
|         wnd->data->onNotifyReply(notification); |         wnd->data->onNotifyReply(notification); | ||||||
|     } else if (notification.activationType == NSUserNotificationActivationTypeContentsClicked) { |     } 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) { | void PsMacWindowPrivate::showNotify(unsigned long long peer, const char *utf8title, const char *utf8subtitle, const char *utf8msg) { | ||||||
|     NSUserNotification *notification = [[NSUserNotification alloc] init]; |     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]; |     [notification setUserInfo:uinfo]; | ||||||
|     [uinfo release]; |     [uinfo release]; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -70,6 +70,8 @@ float64 gRetinaFactor = 1.; | ||||||
| int32 gIntRetinaFactor = 1; | int32 gIntRetinaFactor = 1; | ||||||
| bool gCustomNotifies = false; | bool gCustomNotifies = false; | ||||||
| 
 | 
 | ||||||
|  | uint64 gInstance = 0.; | ||||||
|  | 
 | ||||||
| #ifdef Q_OS_WIN | #ifdef Q_OS_WIN | ||||||
| DBIPlatform gPlatform = dbipWindows; | DBIPlatform gPlatform = dbipWindows; | ||||||
| #elif defined Q_OS_MAC | #elif defined Q_OS_MAC | ||||||
|  | @ -81,6 +83,7 @@ DBIPlatform gPlatform = dbipLinux; | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| void settingsParseArgs(int argc, char *argv[]) { | void settingsParseArgs(int argc, char *argv[]) { | ||||||
|  |     memset_rand(&gInstance, sizeof(gInstance)); | ||||||
| 	gExeDir = psCurrentExeDirectory(argc, argv); | 	gExeDir = psCurrentExeDirectory(argc, argv); | ||||||
| 	for (int32 i = 0; i < argc; ++i) { | 	for (int32 i = 0; i < argc; ++i) { | ||||||
| 		if (string("-release") == argv[i]) { | 		if (string("-release") == argv[i]) { | ||||||
|  |  | ||||||
|  | @ -135,6 +135,8 @@ DeclareSetting(float64, RetinaFactor); | ||||||
| DeclareSetting(int32, IntRetinaFactor); | DeclareSetting(int32, IntRetinaFactor); | ||||||
| DeclareSetting(bool, CustomNotifies); | DeclareSetting(bool, CustomNotifies); | ||||||
| 
 | 
 | ||||||
|  | DeclareReadSetting(uint64, Instance); | ||||||
|  | 
 | ||||||
| DeclareReadSetting(DBIPlatform, Platform); | DeclareReadSetting(DBIPlatform, Platform); | ||||||
| 
 | 
 | ||||||
| void settingsParseArgs(int argc, char *argv[]); | void settingsParseArgs(int argc, char *argv[]); | ||||||
|  |  | ||||||
|  | @ -135,10 +135,10 @@ SettingsInner::SettingsInner(Settings *parent) : QWidget(parent), | ||||||
| 	_viewEmojis(this, lang(lng_settings_view_emojis)), | 	_viewEmojis(this, lang(lng_settings_view_emojis)), | ||||||
| 
 | 
 | ||||||
| 	_enterSend(this, qsl("send_key"), 0, lang(lng_settings_send_enter), !cCtrlEnter()), | 	_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()), | 	_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)), | 	_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)), | 	_downloadPathClear(this, lang(lng_download_path_clear)), | ||||||
| 	_tempDirClearingWidth(st::linkFont->m.width(lang(lng_download_path_clearing))), | 	_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
 | 	// advanced
 | ||||||
| 	_connectionType(this, lang(lng_connection_auto)), | 	_connectionType(this, lang(lng_connection_auto)), | ||||||
| 	_resetSessions(this, lang(lng_settings_reset)), | 	_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) { | 	if (_self) { | ||||||
| 		_nameText.setText(st::setNameFont, _nameCache, _textNameOptions); | 		_nameText.setText(st::setNameFont, _nameCache, _textNameOptions); | ||||||
|  |  | ||||||
|  | @ -49,7 +49,8 @@ void TitleHider::setLevel(float64 level) { | ||||||
| TitleWidget::TitleWidget(Window *window) | TitleWidget::TitleWidget(Window *window) | ||||||
| 	: QWidget(window) | 	: QWidget(window) | ||||||
| 	, wnd(window) | 	, wnd(window) | ||||||
| 	, availWidth(460) |     , hideLevel(0) | ||||||
|  |     , hider(0) | ||||||
| 	, _settings(this, lang(lng_menu_settings), st::titleTextButton) | 	, _settings(this, lang(lng_menu_settings), st::titleTextButton) | ||||||
| 	, _contacts(this, lang(lng_menu_contacts), st::titleTextButton) | 	, _contacts(this, lang(lng_menu_contacts), st::titleTextButton) | ||||||
| 	, _about(this, lang(lng_menu_about), st::titleTextButton) | 	, _about(this, lang(lng_menu_about), st::titleTextButton) | ||||||
|  | @ -58,9 +59,9 @@ TitleWidget::TitleWidget(Window *window) | ||||||
| 	, _maximize(this, window) | 	, _maximize(this, window) | ||||||
| 	, _restore(this, window) | 	, _restore(this, window) | ||||||
| 	, _close(this, window) | 	, _close(this, window) | ||||||
| 	, lastMaximized(!(window->windowState() & Qt::WindowMaximized)) |     , availWidth(460) | ||||||
| 	, hider(0) |     , lastMaximized(!(window->windowState() & Qt::WindowMaximized)) | ||||||
| 	, hideLevel(0) { | { | ||||||
| 
 | 
 | ||||||
| 	setGeometry(0, 0, wnd->width(), st::titleHeight); | 	setGeometry(0, 0, wnd->width(), st::titleHeight); | ||||||
| 	stateChanged(); | 	stateChanged(); | ||||||
|  | @ -226,7 +227,7 @@ HitTestType TitleWidget::hitTest(const QPoint &p) { | ||||||
| 	} else if (x >= 0 && x < w && y >= 0 && y < h) { | 	} else if (x >= 0 && x < w && y >= 0 && y < h) { | ||||||
| 		if (false | 		if (false | ||||||
| 			|| _settings.geometry().contains(x, y) | 			|| _settings.geometry().contains(x, y) | ||||||
| 			|| !_contacts.isHidden() && _contacts.geometry().contains(x, y) | 			|| (!_contacts.isHidden() && _contacts.geometry().contains(x, y)) | ||||||
| 			|| _about.geometry().contains(x, y) | 			|| _about.geometry().contains(x, y) | ||||||
| 		) { | 		) { | ||||||
| 			return HitTestClient; | 			return HitTestClient; | ||||||
|  |  | ||||||
|  | @ -34,9 +34,8 @@ namespace { | ||||||
| 	class _TypeSizeCheckerHelper { | 	class _TypeSizeCheckerHelper { | ||||||
| 	public: | 	public: | ||||||
| 		_TypeSizeCheckerHelper() { | 		_TypeSizeCheckerHelper() { | ||||||
| #ifndef Q_OS_MAC |             int _BadTypeSize[N ? -1 : 1]; | ||||||
| 			_BadTypeSize<T> field; |             (void)sizeof(_BadTypeSize); | ||||||
| #endif |  | ||||||
| 		} | 		} | ||||||
| 	}; | 	}; | ||||||
| 
 | 
 | ||||||
|  | @ -398,11 +397,11 @@ namespace { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	inline uint32 _md5_F(uint32 x, uint32 y, uint32 z) { | 	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) { | 	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) { | 	inline uint32 _md5_H(uint32 x, uint32 y, uint32 z) { | ||||||
|  |  | ||||||
|  | @ -29,7 +29,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com | ||||||
| #include "layerwidget.h" | #include "layerwidget.h" | ||||||
| #include "settingswidget.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); | 	set(text, reconnect); | ||||||
| 	connect(&_reconnect, SIGNAL(clicked()), this, SLOT(onReconnect())); | 	connect(&_reconnect, SIGNAL(clicked()), this, SLOT(onReconnect())); | ||||||
| } | } | ||||||
|  | @ -77,8 +77,8 @@ void TempDirDeleter::onStart() { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Window::Window(QWidget *parent)	: PsMainWindow(parent), | Window::Window(QWidget *parent)	: PsMainWindow(parent), | ||||||
| 	dragging(false), intro(0), main(0), settings(0), layer(0), layerBG(0), myIcon(QPixmap::fromImage(icon256)), _topWidget(0), | 	intro(0), main(0), settings(0), layer(0), layerBG(0), _topWidget(0), | ||||||
| 	_connecting(0), _inactivePress(false), _tempDeleter(0), _tempDeleterThread(0) { | 	_connecting(0), _tempDeleter(0), _tempDeleterThread(0), myIcon(QPixmap::fromImage(icon256)), dragging(false), _inactivePress(false) { | ||||||
| 
 | 
 | ||||||
| 	if (objectName().isEmpty()) | 	if (objectName().isEmpty()) | ||||||
| 		setObjectName(qsl("MainWindow")); | 		setObjectName(qsl("MainWindow")); | ||||||
|  | @ -253,7 +253,7 @@ void Window::mtpStateChanged(int32 dc, int32 state) { | ||||||
| 
 | 
 | ||||||
| void Window::updateTitleStatus() { | void Window::updateTitleStatus() { | ||||||
| 	int32 state = MTP::dcstate(); | 	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) { | 		if (main || getms() > 5000 || _connecting) { | ||||||
| 			showConnecting(lang(lng_connecting)); | 			showConnecting(lang(lng_connecting)); | ||||||
| 		} | 		} | ||||||
|  | @ -384,7 +384,7 @@ void Window::paintEvent(QPaintEvent *e) { | ||||||
| HitTestType Window::hitTest(const QPoint &p) const { | HitTestType Window::hitTest(const QPoint &p) const { | ||||||
| 	int x(p.x()), y(p.y()), w(width()), h(height()); | 	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 (!windowState().testFlag(Qt::WindowMaximized)) { | ||||||
| 		if (y < raw) { | 		if (y < raw) { | ||||||
| 			if (x < raw) { | 			if (x < raw) { | ||||||
|  |  | ||||||
|  | @ -38,6 +38,7 @@ | ||||||
| 		02F93BF511880983D3C57B84 /* dialogswidget.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = E466873F01ABA1E55E914489 /* dialogswidget.cpp */; settings = {ATTRIBUTES = (); }; }; | 		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 = (); }; }; | 		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 = (); }; }; | 		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 */; }; | 		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 = (); }; }; | 		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 = (); }; }; | 		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 = "<absolute>"; }; | 		047DAFB0A7DE92C63033A43C /* mainwidget.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = mainwidget.cpp; path = SourceFiles/mainwidget.cpp; sourceTree = "<absolute>"; }; | ||||||
| 		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 = "<absolute>"; }; | 		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 = "<absolute>"; }; | ||||||
| 		06E379415713F34B83F99C35 /* app.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = app.cpp; path = SourceFiles/app.cpp; sourceTree = "<absolute>"; }; | 		06E379415713F34B83F99C35 /* app.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = app.cpp; path = SourceFiles/app.cpp; sourceTree = "<absolute>"; }; | ||||||
|  | 		07055CC3194EE85B0008DEF6 /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = "./../../Libraries/openssl-xcode/libcrypto.a"; sourceTree = "<group>"; }; | ||||||
| 		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 = "<absolute>"; }; | 		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 = "<absolute>"; }; | ||||||
| 		0771C4C94B623FC34BF62983 /* intro.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = intro.cpp; path = SourceFiles/intro/intro.cpp; sourceTree = "<absolute>"; }; | 		0771C4C94B623FC34BF62983 /* intro.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = intro.cpp; path = SourceFiles/intro/intro.cpp; sourceTree = "<absolute>"; }; | ||||||
| 		07C3AF24194335ED0016CFF1 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = Telegram/Images.xcassets; sourceTree = SOURCE_ROOT; }; | 		07C3AF24194335ED0016CFF1 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = Telegram/Images.xcassets; sourceTree = SOURCE_ROOT; }; | ||||||
|  | @ -593,6 +595,7 @@ | ||||||
| 			isa = PBXFrameworksBuildPhase; | 			isa = PBXFrameworksBuildPhase; | ||||||
| 			buildActionMask = 2147483647; | 			buildActionMask = 2147483647; | ||||||
| 			files = ( | 			files = ( | ||||||
|  | 				07055CC4194EE85B0008DEF6 /* libcrypto.a in Link Binary With Libraries */, | ||||||
| 				1BB705CDB741E2B7450201A5 /* Cocoa.framework in Link Binary With Libraries */, | 				1BB705CDB741E2B7450201A5 /* Cocoa.framework in Link Binary With Libraries */, | ||||||
| 				B58956C9C026BD3A7FD9ECDF /* libexif.a in Link Binary With Libraries */, | 				B58956C9C026BD3A7FD9ECDF /* libexif.a in Link Binary With Libraries */, | ||||||
| 				328FD74542F6E2C873EE4D4B /* ApplicationServices.framework in Link Binary With Libraries */, | 				328FD74542F6E2C873EE4D4B /* ApplicationServices.framework in Link Binary With Libraries */, | ||||||
|  | @ -1069,6 +1072,7 @@ | ||||||
| 		AF39DD055C3EF8226FBE929D /* Frameworks */ = { | 		AF39DD055C3EF8226FBE929D /* Frameworks */ = { | ||||||
| 			isa = PBXGroup; | 			isa = PBXGroup; | ||||||
| 			children = ( | 			children = ( | ||||||
|  | 				07055CC3194EE85B0008DEF6 /* libcrypto.a */, | ||||||
| 				AEA456A2F75ED9F5CDA7BCBE /* Cocoa.framework */, | 				AEA456A2F75ED9F5CDA7BCBE /* Cocoa.framework */, | ||||||
| 				4AF15B5A0A43EB62D6DAF211 /* libexif.a */, | 				4AF15B5A0A43EB62D6DAF211 /* libexif.a */, | ||||||
| 				DFD7912080BC557230093752 /* ApplicationServices.framework */, | 				DFD7912080BC557230093752 /* ApplicationServices.framework */, | ||||||
|  | @ -1182,6 +1186,7 @@ | ||||||
| 		6DB9C3763D02B1415CD9D565 /* Project object */ = { | 		6DB9C3763D02B1415CD9D565 /* Project object */ = { | ||||||
| 			isa = PBXProject; | 			isa = PBXProject; | ||||||
| 			attributes = { | 			attributes = { | ||||||
|  | 				LastUpgradeCheck = 0510; | ||||||
| 			}; | 			}; | ||||||
| 			buildConfigurationList = DAC4C1AA5EDEA1C85E9CA5E6 /* Build configuration list for PBXProject "Telegram" */; | 			buildConfigurationList = DAC4C1AA5EDEA1C85E9CA5E6 /* Build configuration list for PBXProject "Telegram" */; | ||||||
| 			compatibilityVersion = "Xcode 3.2"; | 			compatibilityVersion = "Xcode 3.2"; | ||||||
|  | @ -1417,7 +1422,7 @@ | ||||||
| 				GCC_OPTIMIZATION_LEVEL = 0; | 				GCC_OPTIMIZATION_LEVEL = 0; | ||||||
| 				GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h; | 				GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h; | ||||||
| 				OBJROOT = ./../Mac/DebugIntermediate; | 				OBJROOT = ./../Mac/DebugIntermediate; | ||||||
| 				PRODUCT_NAME = "Preprocess copy"; | 				PRODUCT_NAME = "Meta Compile"; | ||||||
| 				QT_LIBRARY_SUFFIX = _debug; | 				QT_LIBRARY_SUFFIX = _debug; | ||||||
| 				SDKROOT = macosx; | 				SDKROOT = macosx; | ||||||
| 				SYMROOT = ./../Mac; | 				SYMROOT = ./../Mac; | ||||||
|  | @ -1435,7 +1440,7 @@ | ||||||
| 				GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h; | 				GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h; | ||||||
| 				LLVM_LTO = YES; | 				LLVM_LTO = YES; | ||||||
| 				OBJROOT = ./../Mac/ReleaseIntermediate; | 				OBJROOT = ./../Mac/ReleaseIntermediate; | ||||||
| 				PRODUCT_NAME = "Preprocess copy"; | 				PRODUCT_NAME = "Meta Compile"; | ||||||
| 				QT_LIBRARY_SUFFIX = ""; | 				QT_LIBRARY_SUFFIX = ""; | ||||||
| 				SDKROOT = macosx; | 				SDKROOT = macosx; | ||||||
| 				SYMROOT = ./../Mac; | 				SYMROOT = ./../Mac; | ||||||
|  | @ -1445,8 +1450,13 @@ | ||||||
| 		339EE1B2CC4FC24589A0EA95 /* Release */ = { | 		339EE1B2CC4FC24589A0EA95 /* Release */ = { | ||||||
| 			isa = XCBuildConfiguration; | 			isa = XCBuildConfiguration; | ||||||
| 			buildSettings = { | 			buildSettings = { | ||||||
| 				ARCHS = x86_64; |  | ||||||
| 				CC = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang; | 				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; | 				COPY_PHASE_STRIP = YES; | ||||||
| 				DYLIB_COMPATIBILITY_VERSION = 0.5; | 				DYLIB_COMPATIBILITY_VERSION = 0.5; | ||||||
| 				DYLIB_CURRENT_VERSION = 0.5.1; | 				DYLIB_CURRENT_VERSION = 0.5.1; | ||||||
|  | @ -1456,6 +1466,9 @@ | ||||||
| 				GCC_PRECOMPILE_PREFIX_HEADER = YES; | 				GCC_PRECOMPILE_PREFIX_HEADER = YES; | ||||||
| 				GCC_PREFIX_HEADER = SourceFiles/stdafx.h; | 				GCC_PREFIX_HEADER = SourceFiles/stdafx.h; | ||||||
| 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0; | 				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 = ( | 				HEADER_SEARCH_PATHS = ( | ||||||
| 					./../../Libraries/QtStatic/qtbase/include/QtGui/5.3.0/QtGui, | 					./../../Libraries/QtStatic/qtbase/include/QtGui/5.3.0/QtGui, | ||||||
| 					./../../Libraries/QtStatic/qtbase/include/QtCore/5.3.0/QtCore, | 					./../../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/bearer", | ||||||
| 					"/usr/local/Qt-5.3.0/plugins/platforms", | 					"/usr/local/Qt-5.3.0/plugins/platforms", | ||||||
| 					"/usr/local/Qt-5.3.0/plugins/imageformats", | 					"/usr/local/Qt-5.3.0/plugins/imageformats", | ||||||
|  | 					"./../../Libraries/openssl-xcode", | ||||||
| 				); | 				); | ||||||
| 				MACOSX_DEPLOYMENT_TARGET = 10.7; | 				MACOSX_DEPLOYMENT_TARGET = 10.7; | ||||||
| 				OBJROOT = "./../Mac/$(CONFIGURATION)Intermediate"; | 				OBJROOT = "./../Mac/$(CONFIGURATION)Intermediate"; | ||||||
|  | @ -1502,6 +1516,12 @@ | ||||||
| 					"-DQT_NETWORK_LIB", | 					"-DQT_NETWORK_LIB", | ||||||
| 					"-DQT_GUI_LIB", | 					"-DQT_GUI_LIB", | ||||||
| 					"-DQT_CORE_LIB", | 					"-DQT_CORE_LIB", | ||||||
|  | 					"-Wno-unused-variable", | ||||||
|  | 					"-Wno-unused-parameter", | ||||||
|  | 					"-Wno-unused-function", | ||||||
|  | 					"-Wno-switch", | ||||||
|  | 					"-Wno-comment", | ||||||
|  | 					"-I./../../Libraries/openssl-xcode/include", | ||||||
| 				); | 				); | ||||||
| 				OTHER_CPLUSPLUSFLAGS = ( | 				OTHER_CPLUSPLUSFLAGS = ( | ||||||
| 					"-pipe", | 					"-pipe", | ||||||
|  | @ -1516,12 +1536,16 @@ | ||||||
| 					"-DQT_NETWORK_LIB", | 					"-DQT_NETWORK_LIB", | ||||||
| 					"-DQT_GUI_LIB", | 					"-DQT_GUI_LIB", | ||||||
| 					"-DQT_CORE_LIB", | 					"-DQT_CORE_LIB", | ||||||
|  | 					"-Wno-unused-variable", | ||||||
|  | 					"-Wno-unused-parameter", | ||||||
|  | 					"-Wno-unused-function", | ||||||
|  | 					"-Wno-switch", | ||||||
|  | 					"-Wno-comment", | ||||||
|  | 					"-I./../../Libraries/openssl-xcode/include", | ||||||
| 				); | 				); | ||||||
| 				OTHER_LDFLAGS = ( | 				OTHER_LDFLAGS = ( | ||||||
| 					"-headerpad_max_install_names", | 					"-headerpad_max_install_names", | ||||||
| 					"-stdlib=libc++", | 					"-stdlib=libc++", | ||||||
| 					"-lcrypto", |  | ||||||
| 					"-lssl", |  | ||||||
| 					"-L/usr/local/Qt-5.3.0/lib", | 					"-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/mediaservice", | ||||||
| 					"-L/usr/local/Qt-5.3.0/plugins/audio", | 					"-L/usr/local/Qt-5.3.0/plugins/audio", | ||||||
|  | @ -1544,8 +1568,13 @@ | ||||||
| 		3AA6C32AC930069E80220CF1 /* Debug */ = { | 		3AA6C32AC930069E80220CF1 /* Debug */ = { | ||||||
| 			isa = XCBuildConfiguration; | 			isa = XCBuildConfiguration; | ||||||
| 			buildSettings = { | 			buildSettings = { | ||||||
| 				ARCHS = x86_64; |  | ||||||
| 				CC = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang; | 				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; | 				COPY_PHASE_STRIP = NO; | ||||||
| 				DEBUG_INFORMATION_FORMAT = dwarf; | 				DEBUG_INFORMATION_FORMAT = dwarf; | ||||||
| 				DYLIB_COMPATIBILITY_VERSION = 0.5; | 				DYLIB_COMPATIBILITY_VERSION = 0.5; | ||||||
|  | @ -1556,6 +1585,9 @@ | ||||||
| 				GCC_PRECOMPILE_PREFIX_HEADER = YES; | 				GCC_PRECOMPILE_PREFIX_HEADER = YES; | ||||||
| 				GCC_PREFIX_HEADER = SourceFiles/stdafx.h; | 				GCC_PREFIX_HEADER = SourceFiles/stdafx.h; | ||||||
| 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0; | 				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 = ( | 				HEADER_SEARCH_PATHS = ( | ||||||
| 					./../../Libraries/QtStatic/qtbase/include/QtGui/5.3.0/QtGui, | 					./../../Libraries/QtStatic/qtbase/include/QtGui/5.3.0/QtGui, | ||||||
| 					./../../Libraries/QtStatic/qtbase/include/QtCore/5.3.0/QtCore, | 					./../../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/bearer", | ||||||
| 					"/usr/local/Qt-5.3.0/plugins/platforms", | 					"/usr/local/Qt-5.3.0/plugins/platforms", | ||||||
| 					"/usr/local/Qt-5.3.0/plugins/imageformats", | 					"/usr/local/Qt-5.3.0/plugins/imageformats", | ||||||
|  | 					"./../../Libraries/openssl-xcode", | ||||||
| 				); | 				); | ||||||
| 				MACOSX_DEPLOYMENT_TARGET = 10.7; | 				MACOSX_DEPLOYMENT_TARGET = 10.7; | ||||||
| 				OBJROOT = "./../Mac/$(CONFIGURATION)Intermediate"; | 				OBJROOT = "./../Mac/$(CONFIGURATION)Intermediate"; | ||||||
|  | 				ONLY_ACTIVE_ARCH = YES; | ||||||
| 				OTHER_CFLAGS = ( | 				OTHER_CFLAGS = ( | ||||||
| 					"-pipe", | 					"-pipe", | ||||||
| 					"-g", | 					"-g", | ||||||
|  | @ -1603,6 +1637,12 @@ | ||||||
| 					"-DQT_NETWORK_LIB", | 					"-DQT_NETWORK_LIB", | ||||||
| 					"-DQT_GUI_LIB", | 					"-DQT_GUI_LIB", | ||||||
| 					"-DQT_CORE_LIB", | 					"-DQT_CORE_LIB", | ||||||
|  | 					"-Wno-unused-variable", | ||||||
|  | 					"-Wno-unused-parameter", | ||||||
|  | 					"-Wno-unused-function", | ||||||
|  | 					"-Wno-switch", | ||||||
|  | 					"-Wno-comment", | ||||||
|  | 					"-I./../../Libraries/openssl-xcode/include", | ||||||
| 				); | 				); | ||||||
| 				OTHER_CPLUSPLUSFLAGS = ( | 				OTHER_CPLUSPLUSFLAGS = ( | ||||||
| 					"-pipe", | 					"-pipe", | ||||||
|  | @ -1618,12 +1658,16 @@ | ||||||
| 					"-DQT_NETWORK_LIB", | 					"-DQT_NETWORK_LIB", | ||||||
| 					"-DQT_GUI_LIB", | 					"-DQT_GUI_LIB", | ||||||
| 					"-DQT_CORE_LIB", | 					"-DQT_CORE_LIB", | ||||||
|  | 					"-Wno-unused-variable", | ||||||
|  | 					"-Wno-unused-parameter", | ||||||
|  | 					"-Wno-unused-function", | ||||||
|  | 					"-Wno-switch", | ||||||
|  | 					"-Wno-comment", | ||||||
|  | 					"-I./../../Libraries/openssl-xcode/include", | ||||||
| 				); | 				); | ||||||
| 				OTHER_LDFLAGS = ( | 				OTHER_LDFLAGS = ( | ||||||
| 					"-headerpad_max_install_names", | 					"-headerpad_max_install_names", | ||||||
| 					"-stdlib=libc++", | 					"-stdlib=libc++", | ||||||
| 					"-lcrypto", |  | ||||||
| 					"-lssl", |  | ||||||
| 					"-L/usr/local/Qt-5.3.0/lib", | 					"-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/mediaservice", | ||||||
| 					"-L/usr/local/Qt-5.3.0/plugins/audio", | 					"-L/usr/local/Qt-5.3.0/plugins/audio", | ||||||
|  | @ -1647,6 +1691,7 @@ | ||||||
| 			isa = XCBuildConfiguration; | 			isa = XCBuildConfiguration; | ||||||
| 			buildSettings = { | 			buildSettings = { | ||||||
| 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||||||
|  | 				COMBINE_HIDPI_IMAGES = YES; | ||||||
| 				COPY_PHASE_STRIP = YES; | 				COPY_PHASE_STRIP = YES; | ||||||
| 				CURRENT_PROJECT_VERSION = 0.5.2; | 				CURRENT_PROJECT_VERSION = 0.5.2; | ||||||
| 				DYLIB_CURRENT_VERSION = 0.5.2; | 				DYLIB_CURRENT_VERSION = 0.5.2; | ||||||
|  | @ -1667,6 +1712,7 @@ | ||||||
| 			isa = XCBuildConfiguration; | 			isa = XCBuildConfiguration; | ||||||
| 			buildSettings = { | 			buildSettings = { | ||||||
| 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||||||
|  | 				COMBINE_HIDPI_IMAGES = YES; | ||||||
| 				COPY_PHASE_STRIP = NO; | 				COPY_PHASE_STRIP = NO; | ||||||
| 				CURRENT_PROJECT_VERSION = 0.5.2; | 				CURRENT_PROJECT_VERSION = 0.5.2; | ||||||
| 				DEBUG_INFORMATION_FORMAT = dwarf; | 				DEBUG_INFORMATION_FORMAT = dwarf; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue