mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-23 03:37:41 +00:00
username support added, layer 18
This commit is contained in:
parent
3daa74ff27
commit
30ae073080
@ -57,8 +57,8 @@ lng_month_day: "{month} {day}";
|
||||
|
||||
lng_cancel: "Cancel";
|
||||
lng_continue: "Continue";
|
||||
lng_connecting: "Connecting...";
|
||||
lng_reconnecting: "Reconnect in %1 s...";
|
||||
lng_connecting: "Connecting..";
|
||||
lng_reconnecting: "Reconnect in %1 s..";
|
||||
lng_reconnecting_try_now: "Try now";
|
||||
|
||||
lng_status_offline: "offline";
|
||||
@ -74,6 +74,7 @@ lng_status_lastseen_yesterday: "yesterday at {time}";
|
||||
lng_status_lastseen_date: "{date}";
|
||||
lng_status_lastseen_date_time: "{date} at {time}";
|
||||
lng_status_online: "online";
|
||||
lng_status_connecting: "connecting..";
|
||||
|
||||
lng_chat_no_members: "Group is unaccessible";
|
||||
lng_chat_members: "%1 members";
|
||||
@ -109,7 +110,7 @@ lng_code_ph: "Your code";
|
||||
lng_code_desc: "We have sent you an SMS with activation
|
||||
code to your phone. Please enter it below.";
|
||||
lng_code_call: "Telegram will dial your number in %1:%2";
|
||||
lng_code_calling: "Requesting a call from Telegram...";
|
||||
lng_code_calling: "Requesting a call from Telegram..";
|
||||
lng_code_called: "Telegram dialed your number";
|
||||
|
||||
lng_bad_phone: "Invalid phone number. Please try again.";
|
||||
@ -136,7 +137,25 @@ lng_settings_cancel: "Cancel";
|
||||
lng_settings_upload: "Set Profile Photo";
|
||||
lng_settings_badsize: "This image has bad size, please try other.";
|
||||
lng_settings_crop_profile: "Select square area for your profile photo";
|
||||
lng_settings_uploading_photo: "Uploading photo...";
|
||||
lng_settings_uploading_photo: "Uploading photo..";
|
||||
|
||||
lng_username_title: "Change username";
|
||||
lng_username_about: "You can choose a username on Telegram.
|
||||
If you do, other people will be able to find
|
||||
you by this username and contact you
|
||||
without knowing your phone number.
|
||||
|
||||
You can use a-z, 0-9 and underscores.
|
||||
Minimum length is 5 characters.";
|
||||
lng_username_invalid: "This name is invalid.";
|
||||
lng_username_occupied: "This name is already occupied.";
|
||||
lng_username_too_short: "This name is too short.";
|
||||
|
||||
lng_settings_section_contact_info: "Contact info";
|
||||
lng_settings_phone_number: "Phone number:";
|
||||
lng_settings_username: "Username:";
|
||||
lng_settings_choose_username: "choose username";
|
||||
lng_settings_change_username: "Change";
|
||||
|
||||
lng_settings_section_notify: "Notifications";
|
||||
lng_settings_desktop_notify: "Desktop notifications";
|
||||
@ -151,9 +170,9 @@ lng_settings_section_general: "General";
|
||||
lng_settings_auto_update: "Update automatically";
|
||||
lng_settings_current_version: "Version {version}";
|
||||
lng_settings_check_now: "Check for updates";
|
||||
lng_settings_update_checking: "Checking for updates...";
|
||||
lng_settings_update_checking: "Checking for updates..";
|
||||
lng_settings_latest_installed: "Latest version is installed";
|
||||
lng_settings_downloading: "Downloading update {ready} / {total} Mb...";
|
||||
lng_settings_downloading: "Downloading update {ready} / {total} Mb..";
|
||||
lng_settings_update_ready: "New version is ready";
|
||||
lng_settings_update_now: "Restart Now";
|
||||
lng_settings_update_fail: "Update check failed :(";
|
||||
@ -192,7 +211,7 @@ lng_download_path_settings: "Go to Settings";
|
||||
lng_download_finish_failed: "File download could not be finished.
|
||||
|
||||
Would you like to try again?";
|
||||
lng_download_path_clearing: "Clearing...";
|
||||
lng_download_path_clearing: "Clearing..";
|
||||
lng_download_path_cleared: "Cleared!";
|
||||
lng_download_path_clear_failed: "Clear failed :(";
|
||||
|
||||
@ -238,7 +257,7 @@ lng_profile_add_participant: "Add Member";
|
||||
lng_profile_delete_and_exit: "Leave";
|
||||
lng_profile_kick: "Kick";
|
||||
lng_profile_sure_kick: "Kick {user} from the group?";
|
||||
lng_profile_loading: "Loading...";
|
||||
lng_profile_loading: "Loading..";
|
||||
lng_profile_shared_media: "Shared media";
|
||||
lng_profile_no_media: "No media in this conversation.";
|
||||
lng_profile_photo: "{count} photo »";
|
||||
@ -315,7 +334,7 @@ lng_in_dlg_audio: "Audio";
|
||||
lng_in_dlg_document: "Document";
|
||||
|
||||
lng_send_button: "Send";
|
||||
lng_message_ph: "Write a message...";
|
||||
lng_message_ph: "Write a message..";
|
||||
lng_empty_history: "";
|
||||
lng_willbe_history: "Please select chat to start messaging";
|
||||
lng_message_with_from: "[c]{from}:[/c] {message}";
|
||||
@ -343,7 +362,7 @@ lng_context_copy_email: "Copy email address";
|
||||
lng_context_open_hashtag: "Search by hashtag";
|
||||
lng_context_copy_hashtag: "Copy hashtag";
|
||||
lng_context_open_image: "Open Image";
|
||||
lng_context_save_image: "Save Image As...";
|
||||
lng_context_save_image: "Save Image As..";
|
||||
lng_context_forward_image: "Forward Image";
|
||||
lng_context_delete_image: "Delete Image";
|
||||
lng_context_copy_image: "Copy Image";
|
||||
@ -352,11 +371,11 @@ lng_context_cancel_download: "Cancel Download";
|
||||
lng_context_show_in_folder: "Show in Folder";
|
||||
lng_context_show_in_finder: "Show in Finder";
|
||||
lng_context_open_video: "Open Video";
|
||||
lng_context_save_video: "Save Video As...";
|
||||
lng_context_save_video: "Save Video As..";
|
||||
lng_context_open_audio: "Open Audio";
|
||||
lng_context_save_audio: "Save Audio As...";
|
||||
lng_context_save_audio: "Save Audio As..";
|
||||
lng_context_open_document: "Open File";
|
||||
lng_context_save_document: "Save File As...";
|
||||
lng_context_save_document: "Save File As..";
|
||||
lng_context_forward_file: "Forward File";
|
||||
lng_context_delete_file: "Delete File";
|
||||
lng_context_close_file: "Close File";
|
||||
@ -375,7 +394,7 @@ lng_really_send_file: "Do you want to send this file?";
|
||||
lng_really_share_contact: "Do you want to share this contact?";
|
||||
lng_send_image_compressed: "Send compressed image";
|
||||
|
||||
lng_forward_choose: "Choose recipient...";
|
||||
lng_forward_choose: "Choose recipient..";
|
||||
lng_forward_confirm: "Forward to {recipient}?";
|
||||
lng_forward_share_contact: "Share contact to {recipient}?";
|
||||
lng_forward_send_file_confirm: "Send «{name}» to {recipient}?";
|
||||
@ -430,6 +449,7 @@ lng_about_done: "Done";
|
||||
lng_search_no_results: "No messages found";
|
||||
lng_search_one_result: "Found {count} message";
|
||||
lng_search_n_results: "Found {count} messages";
|
||||
lng_search_global_results: "Global search results";
|
||||
|
||||
lng_mediaview_save: "Download";
|
||||
lng_mediaview_forward: "Forward";
|
||||
|
@ -484,10 +484,9 @@ setTop: 26px;
|
||||
setNameLeft: 3px;
|
||||
setNameTop: 1px;
|
||||
setNameFont: font(22px);
|
||||
setPhoneFont: font(16px);
|
||||
setPhoneColor: #999;
|
||||
setPhoneTop: 39px;
|
||||
setPhoneLeft: 1px;
|
||||
setStatusTop: 39px;
|
||||
setStatusLeft: 1px;
|
||||
setStatusFont: font(16px);
|
||||
setPhotoSize: 120px;
|
||||
setHeaderFont: font(20px);
|
||||
setHeaderColor: black;
|
||||
@ -1622,3 +1621,17 @@ mediaviewLoaderSkip: 9px;
|
||||
|
||||
minPhotoWidth: 90px;
|
||||
minPhotoHeight: 90px;
|
||||
|
||||
usernameFont: font(14px);
|
||||
usernameColor: #777;
|
||||
usernameWidth: 336px;
|
||||
usernameSkip: 32px;
|
||||
usernameInput: flatInput(inpAddContact) {
|
||||
bgColor: transparent;
|
||||
}
|
||||
usernameDone: flatButton(btnSelectDone) {
|
||||
width: 168px;
|
||||
}
|
||||
usernameCancel: flatButton(btnSelectCancel) {
|
||||
width: 167px;
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ namespace App {
|
||||
data = App::user(peer);
|
||||
data->input = MTP_inputPeerContact(d.vid);
|
||||
data->inputUser = MTP_inputUserContact(d.vid);
|
||||
data->setName(lang(lng_deleted), QString(), QString());
|
||||
data->setName(lang(lng_deleted), QString(), QString(), QString());
|
||||
data->setPhoto(MTP_userProfilePhotoEmpty());
|
||||
data->access = 0;
|
||||
wasContact = (data->contact > 0);
|
||||
@ -253,7 +253,7 @@ namespace App {
|
||||
data = App::user(peer);
|
||||
data->input = MTP_inputPeerContact(d.vid);
|
||||
data->inputUser = MTP_inputUserContact(d.vid);
|
||||
data->setName(textOneLine(qs(d.vfirst_name)), textOneLine(qs(d.vlast_name)), QString());
|
||||
data->setName(textOneLine(qs(d.vfirst_name)), textOneLine(qs(d.vlast_name)), QString(), textOneLine(qs(d.vusername)));
|
||||
data->setPhoto(MTP_userProfilePhotoEmpty());
|
||||
data->access = 0;
|
||||
wasContact = (data->contact > 0);
|
||||
@ -266,7 +266,7 @@ namespace App {
|
||||
data = App::user(peer);
|
||||
data->input = MTP_inputPeerSelf();
|
||||
data->inputUser = MTP_inputUserSelf();
|
||||
data->setName(textOneLine(qs(d.vfirst_name)), textOneLine(qs(d.vlast_name)), QString());
|
||||
data->setName(textOneLine(qs(d.vfirst_name)), textOneLine(qs(d.vlast_name)), QString(), textOneLine(qs(d.vusername)));
|
||||
data->setPhoto(d.vphoto);
|
||||
data->setPhone(qs(d.vphone));
|
||||
data->access = 0;
|
||||
@ -283,7 +283,7 @@ namespace App {
|
||||
data = App::user(peer);
|
||||
data->input = MTP_inputPeerContact(d.vid);
|
||||
data->inputUser = MTP_inputUserContact(d.vid);
|
||||
data->setName(textOneLine(qs(d.vfirst_name)), textOneLine(qs(d.vlast_name)), QString());
|
||||
data->setName(textOneLine(qs(d.vfirst_name)), textOneLine(qs(d.vlast_name)), QString(), textOneLine(qs(d.vusername)));
|
||||
data->setPhoto(d.vphoto);
|
||||
data->setPhone(qs(d.vphone));
|
||||
data->access = d.vaccess_hash.v;
|
||||
@ -299,7 +299,7 @@ namespace App {
|
||||
data->input = MTP_inputPeerForeign(d.vid, d.vaccess_hash);
|
||||
data->inputUser = MTP_inputUserForeign(d.vid, d.vaccess_hash);
|
||||
data->setPhone(qs(d.vphone));
|
||||
data->setName(textOneLine(qs(d.vfirst_name)), textOneLine(qs(d.vlast_name)), (data->id != 333000 && !data->phone.isEmpty()) ? formatPhone(data->phone) : QString());
|
||||
data->setName(textOneLine(qs(d.vfirst_name)), textOneLine(qs(d.vlast_name)), (data->id != 333000 && !data->phone.isEmpty()) ? formatPhone(data->phone) : QString(), textOneLine(qs(d.vusername)));
|
||||
data->setPhoto(d.vphoto);
|
||||
data->access = d.vaccess_hash.v;
|
||||
wasContact = (data->contact > 0);
|
||||
@ -313,7 +313,7 @@ namespace App {
|
||||
data = App::user(peer);
|
||||
data->input = MTP_inputPeerForeign(d.vid, d.vaccess_hash);
|
||||
data->inputUser = MTP_inputUserForeign(d.vid, d.vaccess_hash);
|
||||
data->setName(textOneLine(qs(d.vfirst_name)), textOneLine(qs(d.vlast_name)), QString());
|
||||
data->setName(textOneLine(qs(d.vfirst_name)), textOneLine(qs(d.vlast_name)), QString(), textOneLine(qs(d.vusername)));
|
||||
data->setPhoto(d.vphoto);
|
||||
data->access = d.vaccess_hash.v;
|
||||
wasContact = (data->contact > 0);
|
||||
@ -634,7 +634,7 @@ namespace App {
|
||||
App::main()->removeContact(user);
|
||||
}
|
||||
}
|
||||
user->setName(textOneLine(user->firstName), textOneLine(user->lastName), (user->contact || user->id == 333000 || user->phone.isEmpty()) ? QString() : App::formatPhone(user->phone));
|
||||
user->setName(textOneLine(user->firstName), textOneLine(user->lastName), (user->contact || user->id == 333000 || user->phone.isEmpty()) ? QString() : App::formatPhone(user->phone), textOneLine(user->username));
|
||||
if (App::main()) App::main()->peerUpdated(user);
|
||||
}
|
||||
}
|
||||
|
@ -256,10 +256,11 @@ void AddContactBox::onSaveSelfDone(const MTPUser &user) {
|
||||
}
|
||||
|
||||
bool AddContactBox::onSaveSelfFail(const RPCError &error) {
|
||||
_addRequest = 0;
|
||||
QString err(error.type());
|
||||
QString firstName = textOneLine(_firstInput.text()), lastName = textOneLine(_lastInput.text());
|
||||
if (err == "NAME_NOT_MODIFIED") {
|
||||
App::self()->setName(firstName, lastName, firstName + ' ' + lastName);
|
||||
App::self()->setName(firstName, lastName, firstName + ' ' + lastName, textOneLine(App::self()->username));
|
||||
emit closed();
|
||||
return true;
|
||||
} else if (err == "FIRSTNAME_INVALID") {
|
||||
@ -276,6 +277,7 @@ bool AddContactBox::onSaveSelfFail(const RPCError &error) {
|
||||
}
|
||||
|
||||
bool AddContactBox::onSaveFail(const RPCError &error) {
|
||||
_addRequest = 0;
|
||||
QString err(error.type());
|
||||
QString firstName = _firstInput.text().trimmed(), lastName = _lastInput.text().trimmed();
|
||||
if (err == "CHAT_TITLE_NOT_MODIFIED") {
|
||||
|
@ -58,7 +58,7 @@ private:
|
||||
PeerData *_peer;
|
||||
QString _boxTitle;
|
||||
|
||||
int32 _width, _height, _thumbw, _thumbh;
|
||||
int32 _width, _height;
|
||||
FlatButton _addButton, _retryButton, _cancelButton;
|
||||
FlatInput _firstInput, _lastInput, _phoneInput;
|
||||
|
||||
|
272
Telegram/SourceFiles/boxes/usernamebox.cpp
Normal file
272
Telegram/SourceFiles/boxes/usernamebox.cpp
Normal file
@ -0,0 +1,272 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
It is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "lang.h"
|
||||
|
||||
#include "application.h"
|
||||
#include "usernamebox.h"
|
||||
#include "mainwidget.h"
|
||||
#include "window.h"
|
||||
|
||||
UsernameInput::UsernameInput(QWidget *parent, const style::flatInput &st, const QString &ph, const QString &val) : FlatInput(parent, st, ph, val) {
|
||||
}
|
||||
|
||||
void UsernameInput::correctValue(QKeyEvent *e, const QString &was) {
|
||||
QString oldText(text()), newText;
|
||||
int32 oldPos(cursorPosition()), newPos(-1), oldLen(oldText.length());
|
||||
newText.reserve(oldLen);
|
||||
|
||||
for (int32 i = 0; i < oldLen; ++i) {
|
||||
if (i == oldPos) {
|
||||
newPos = newText.length();
|
||||
}
|
||||
|
||||
QChar ch = oldText[i];
|
||||
if ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9') || ch == '_' || (ch == '@' && !i)) {
|
||||
if (newText.size() < MaxUsernameLength) {
|
||||
newText.append(ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (newPos < 0) {
|
||||
newPos = newText.length();
|
||||
}
|
||||
if (newText != oldText) {
|
||||
setText(newText);
|
||||
setCursorPosition(newPos);
|
||||
}
|
||||
}
|
||||
|
||||
UsernameBox::UsernameBox() :
|
||||
_saveButton(this, lang(lng_settings_save), st::usernameDone),
|
||||
_cancelButton(this, lang(lng_cancel), st::usernameCancel),
|
||||
_usernameInput(this, st::inpAddContact, qsl("@username"), App::self()->username),
|
||||
_saveRequest(0), _checkRequest(0), _about(st::usernameWidth - 2 * st::addContactTitlePos.x()),
|
||||
a_opacity(0, 1), _hiding(false) {
|
||||
_about.setRichText(st::usernameFont, lang(lng_username_about));
|
||||
initBox();
|
||||
}
|
||||
|
||||
void UsernameBox::initBox() {
|
||||
_width = st::usernameWidth;
|
||||
_height = st::addContactTitleHeight + st::addContactPadding.top() + _usernameInput.height() + st::addContactPadding.bottom() + _about.countHeight(st::usernameWidth - 2 * st::addContactTitlePos.x()) + st::usernameSkip + _saveButton.height();
|
||||
_usernameInput.setGeometry(st::addContactPadding.left(), st::addContactTitleHeight + st::addContactPadding.top(), _width - st::addContactPadding.left() - st::addContactPadding.right(), _usernameInput.height());
|
||||
|
||||
int32 buttonTop = _height - _cancelButton.height();
|
||||
_cancelButton.move(0, buttonTop);
|
||||
_saveButton.move(_width - _saveButton.width(), buttonTop);
|
||||
|
||||
connect(&_saveButton, SIGNAL(clicked()), this, SLOT(onSave()));
|
||||
connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onCancel()));
|
||||
connect(&_usernameInput, SIGNAL(changed()), this, SLOT(onChanged()));
|
||||
|
||||
_checkTimer.setSingleShot(true);
|
||||
connect(&_checkTimer, SIGNAL(timeout()), this, SLOT(onCheck()));
|
||||
|
||||
resize(_width, _height);
|
||||
|
||||
showAll();
|
||||
_cache = myGrab(this, rect());
|
||||
hideAll();
|
||||
}
|
||||
|
||||
void UsernameBox::hideAll() {
|
||||
_usernameInput.hide();
|
||||
_saveButton.hide();
|
||||
_cancelButton.hide();
|
||||
}
|
||||
|
||||
void UsernameBox::showAll() {
|
||||
_usernameInput.show();
|
||||
_saveButton.show();
|
||||
_cancelButton.show();
|
||||
}
|
||||
|
||||
void UsernameBox::keyPressEvent(QKeyEvent *e) {
|
||||
if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
|
||||
onSave();
|
||||
} else if (e->key() == Qt::Key_Escape) {
|
||||
onCancel();
|
||||
}
|
||||
}
|
||||
|
||||
void UsernameBox::parentResized() {
|
||||
QSize s = parentWidget()->size();
|
||||
setGeometry((s.width() - _width) / 2, (s.height() - _height) / 2, _width, _height);
|
||||
update();
|
||||
}
|
||||
|
||||
void UsernameBox::paintEvent(QPaintEvent *e) {
|
||||
QPainter p(this);
|
||||
if (_cache.isNull()) {
|
||||
if (!_hiding || a_opacity.current() > 0.01) {
|
||||
// fill bg
|
||||
p.fillRect(QRect(QPoint(0, 0), size()), st::boxBG->b);
|
||||
|
||||
// paint shadows
|
||||
p.fillRect(0, st::addContactTitleHeight, _width, st::scrollDef.topsh, st::scrollDef.shColor->b);
|
||||
p.fillRect(0, size().height() - st::usernameCancel.height - st::scrollDef.bottomsh, _width, st::scrollDef.bottomsh, st::scrollDef.shColor->b);
|
||||
|
||||
// paint button sep
|
||||
p.fillRect(st::usernameCancel.width, size().height() - st::usernameCancel.height, st::lineWidth, st::usernameCancel.height, st::btnSelectSep->b);
|
||||
|
||||
// draw box title / text
|
||||
p.setPen(st::black->p);
|
||||
p.setFont(st::addContactTitleFont->f);
|
||||
p.drawText(st::addContactTitlePos.x(), st::addContactTitlePos.y() + st::addContactTitleFont->ascent, lang(lng_username_title));
|
||||
|
||||
if (!_errorText.isEmpty()) {
|
||||
p.setPen(st::setErrColor->p);
|
||||
p.setFont(st::setErrFont->f);
|
||||
int32 w = st::setErrFont->m.width(_errorText);
|
||||
p.drawText((_width - w) / 2, _usernameInput.y() + _usernameInput.height() + ((st::usernameSkip - st::setErrFont->height) / 2) + st::setErrFont->ascent, _errorText);
|
||||
}
|
||||
p.setPen(st::usernameColor->p);
|
||||
_about.draw(p, st::addContactTitlePos.x(), _usernameInput.y() + _usernameInput.height() + st::usernameSkip, width() - 2 * st::addContactTitlePos.x());
|
||||
}
|
||||
} else {
|
||||
p.setOpacity(a_opacity.current());
|
||||
p.drawPixmap(0, 0, _cache);
|
||||
}
|
||||
}
|
||||
|
||||
void UsernameBox::animStep(float64 dt) {
|
||||
if (dt >= 1) {
|
||||
a_opacity.finish();
|
||||
_cache = QPixmap();
|
||||
if (!_hiding) {
|
||||
showAll();
|
||||
_usernameInput.setFocus();
|
||||
}
|
||||
} else {
|
||||
a_opacity.update(dt, anim::linear);
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
void UsernameBox::onSave() {
|
||||
if (_saveRequest) return;
|
||||
|
||||
_sentUsername = getName();
|
||||
_saveRequest = MTP::send(MTPaccount_UpdateUsername(MTP_string(_sentUsername)), rpcDone(&UsernameBox::onUpdateDone), rpcFail(&UsernameBox::onUpdateFail));
|
||||
}
|
||||
|
||||
void UsernameBox::onCheck() {
|
||||
if (_checkRequest) {
|
||||
MTP::cancel(_checkRequest);
|
||||
}
|
||||
QString name = getName();
|
||||
if (name.size() >= MinUsernameLength) {
|
||||
_checkRequest = MTP::send(MTPaccount_CheckUsername(MTP_string(name)), rpcDone(&UsernameBox::onCheckDone), rpcFail(&UsernameBox::onCheckFail));
|
||||
}
|
||||
}
|
||||
|
||||
void UsernameBox::onChanged() {
|
||||
QString name = getName();
|
||||
if (name.isEmpty()) {
|
||||
if (!_errorText.isEmpty()) {
|
||||
_errorText = QString();
|
||||
update();
|
||||
}
|
||||
_checkTimer.stop();
|
||||
} else if (name.size() < MinUsernameLength) {
|
||||
if (_errorText != lang(lng_username_too_short)) {
|
||||
_errorText = lang(lng_username_too_short);
|
||||
update();
|
||||
}
|
||||
_checkTimer.stop();
|
||||
} else {
|
||||
if (!_errorText.isEmpty()) {
|
||||
_errorText = QString();
|
||||
update();
|
||||
}
|
||||
_checkTimer.start(UsernameCheckTimeout);
|
||||
}
|
||||
}
|
||||
|
||||
void UsernameBox::onUpdateDone(const MTPUser &user) {
|
||||
App::feedUsers(MTP_vector<MTPUser>(QVector<MTPUser>(1, user)));
|
||||
emit closed();
|
||||
}
|
||||
|
||||
bool UsernameBox::onUpdateFail(const RPCError &error) {
|
||||
_saveRequest = 0;
|
||||
QString err(error.type()), name = getName();
|
||||
if (err == "USERNAME_NOT_MODIFIED") {
|
||||
App::self()->setName(textOneLine(App::self()->firstName), textOneLine(App::self()->lastName), textOneLine(App::self()->nameOrPhone), textOneLine(name));
|
||||
emit closed();
|
||||
return true;
|
||||
} else if (err == "USERNAME_INVALID") {
|
||||
_usernameInput.setFocus();
|
||||
_usernameInput.notaBene();
|
||||
_errorText = lang(lng_username_invalid);
|
||||
return true;
|
||||
} else if (err == "USERNAME_OCCUPIED") {
|
||||
_usernameInput.setFocus();
|
||||
_usernameInput.notaBene();
|
||||
_errorText = lang(lng_username_occupied);
|
||||
return true;
|
||||
}
|
||||
_usernameInput.setFocus();
|
||||
return true;
|
||||
}
|
||||
|
||||
void UsernameBox::onCheckDone(const MTPBool &result) {
|
||||
_checkRequest = 0;
|
||||
QString newError = result.v ? QString() : lang(lng_username_occupied);
|
||||
if (_errorText != newError) {
|
||||
_errorText = newError;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
bool UsernameBox::onCheckFail(const RPCError &error) {
|
||||
_checkRequest = 0;
|
||||
QString err(error.type());
|
||||
if (err == "USERNAME_INVALID") {
|
||||
_errorText = lang(lng_username_invalid);
|
||||
update();
|
||||
return true;
|
||||
} else if (err == "USERNAME_OCCUPIED") {
|
||||
_errorText = lang(lng_username_occupied);
|
||||
update();
|
||||
return true;
|
||||
}
|
||||
_usernameInput.setFocus();
|
||||
return true;
|
||||
}
|
||||
|
||||
QString UsernameBox::getName() const {
|
||||
return _usernameInput.text().replace('@', QString()).trimmed();
|
||||
}
|
||||
|
||||
void UsernameBox::onCancel() {
|
||||
emit closed();
|
||||
}
|
||||
|
||||
void UsernameBox::startHide() {
|
||||
_hiding = true;
|
||||
if (_cache.isNull()) {
|
||||
_cache = myGrab(this, rect());
|
||||
hideAll();
|
||||
}
|
||||
a_opacity.start(0);
|
||||
}
|
||||
|
||||
UsernameBox::~UsernameBox() {
|
||||
}
|
82
Telegram/SourceFiles/boxes/usernamebox.h
Normal file
82
Telegram/SourceFiles/boxes/usernamebox.h
Normal file
@ -0,0 +1,82 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
It is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "layerwidget.h"
|
||||
|
||||
class UsernameInput : public FlatInput {
|
||||
public:
|
||||
|
||||
UsernameInput(QWidget *parent, const style::flatInput &st, const QString &ph = QString(), const QString &val = QString());
|
||||
|
||||
protected:
|
||||
|
||||
void correctValue(QKeyEvent *e, const QString &was);
|
||||
|
||||
};
|
||||
|
||||
class UsernameBox : public LayeredWidget, public RPCSender {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
UsernameBox();
|
||||
void parentResized();
|
||||
void animStep(float64 dt);
|
||||
void keyPressEvent(QKeyEvent *e);
|
||||
void paintEvent(QPaintEvent *e);
|
||||
void startHide();
|
||||
~UsernameBox();
|
||||
|
||||
public slots:
|
||||
|
||||
void onSave();
|
||||
void onCancel();
|
||||
|
||||
void onCheck();
|
||||
void onChanged();
|
||||
|
||||
private:
|
||||
|
||||
void hideAll();
|
||||
void showAll();
|
||||
|
||||
void onUpdateDone(const MTPUser &result);
|
||||
bool onUpdateFail(const RPCError &error);
|
||||
|
||||
void onCheckDone(const MTPBool &result);
|
||||
bool onCheckFail(const RPCError &error);
|
||||
|
||||
QString getName() const;
|
||||
void initBox();
|
||||
|
||||
int32 _width, _height;
|
||||
FlatButton _saveButton, _cancelButton;
|
||||
UsernameInput _usernameInput;
|
||||
|
||||
QPixmap _cache;
|
||||
|
||||
mtpRequestId _saveRequest, _checkRequest;
|
||||
QString _sentUsername, _errorText;
|
||||
|
||||
Text _about;
|
||||
QTimer _checkTimer;
|
||||
|
||||
anim::fvalue a_opacity;
|
||||
bool _hiding;
|
||||
};
|
@ -88,6 +88,11 @@ enum {
|
||||
PreloadHeightsCount = 3, // when 3 screens to scroll left make a preload request
|
||||
EmojiPadPerRow = 7,
|
||||
EmojiPadRowsPerPage = 6,
|
||||
|
||||
SearchPeopleLimit = 5,
|
||||
MinUsernameLength = 5,
|
||||
MaxUsernameLength = 32,
|
||||
UsernameCheckTimeout = 200,
|
||||
};
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
|
@ -26,7 +26,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
#include "boxes/newgroupbox.h"
|
||||
|
||||
DialogsListWidget::DialogsListWidget(QWidget *parent, MainWidget *main) : QWidget(parent),
|
||||
dialogs(false), contactsNoDialogs(true), contacts(true), sel(0), contactSel(false), selByMouse(false), filteredSel(-1), searchedCount(0), searchedSel(-1), _lastSearchId(0), _state(DefaultState) {
|
||||
dialogs(false), contactsNoDialogs(true), contacts(true), sel(0), contactSel(false), selByMouse(false), filteredSel(-1), searchedCount(0), searchedSel(-1), peopleSel(-1), _lastSearchId(0), _state(DefaultState) {
|
||||
connect(main, SIGNAL(dialogToTop(const History::DialogLinks &)), this, SLOT(onDialogToTop(const History::DialogLinks &)));
|
||||
connect(main, SIGNAL(peerNameChanged(PeerData *, const PeerData::Names &, const PeerData::NameFirstChars &)), this, SLOT(onPeerNameChanged(PeerData *, const PeerData::Names &, const PeerData::NameFirstChars &)));
|
||||
connect(main, SIGNAL(peerPhotoChanged(PeerData *)), this, SLOT(onPeerPhotoChanged(PeerData *)));
|
||||
@ -76,6 +76,33 @@ void DialogsListWidget::paintEvent(QPaintEvent *e) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!peopleResults.isEmpty()) {
|
||||
p.fillRect(0, 0, width(), st::searchedBarHeight, st::searchedBarBG->b);
|
||||
p.setFont(st::searchedBarFont->f);
|
||||
p.setPen(st::searchedBarColor->p);
|
||||
p.drawText(QRect(0, 0, width(), st::searchedBarHeight), lang(lng_search_global_results), style::al_center);
|
||||
p.translate(0, st::searchedBarHeight);
|
||||
|
||||
int32 skip = filterResults.size() * st::dlgHeight + st::searchedBarHeight;
|
||||
int32 from = (r.top() - skip) / int32(st::dlgHeight);
|
||||
if (from < 0) {
|
||||
from = 0;
|
||||
} else if (from > peopleResults.size()) {
|
||||
from = peopleResults.size();
|
||||
}
|
||||
p.translate(0, from * st::dlgHeight);
|
||||
if (from < peopleResults.size()) {
|
||||
int32 to = ((r.bottom() - skip) / int32(st::dlgHeight)) + 1, w = width();
|
||||
if (to > peopleResults.size()) to = peopleResults.size();
|
||||
for (; from < to; ++from) {
|
||||
bool active = (peopleResults[from] == App::main()->activePeer() && !App::main()->activeMsgId());
|
||||
bool selected = (from == peopleSel);
|
||||
peopleResultPaint(peopleResults[from], p, w, active, selected);
|
||||
p.translate(0, st::dlgHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_state == SearchedState || !searchResults.isEmpty()) {
|
||||
QString text = searchResults.isEmpty() ? lang(lng_search_no_results) : lang(searchedCount > 1 ? lng_search_n_results : lng_search_one_result).replace(qsl("{count}"), QString::number(searchedCount));
|
||||
p.fillRect(0, 0, width(), st::searchedBarHeight, st::searchedBarBG->b);
|
||||
@ -85,13 +112,17 @@ void DialogsListWidget::paintEvent(QPaintEvent *e) {
|
||||
p.translate(0, st::searchedBarHeight);
|
||||
|
||||
int32 skip = filterResults.size() * st::dlgHeight + st::searchedBarHeight;
|
||||
if (!peopleResults.isEmpty()) skip += peopleResults.size() * st::dlgHeight + st::searchedBarHeight;
|
||||
int32 from = (r.top() - skip) / int32(st::dlgHeight);
|
||||
if (from < 0) from = 0;
|
||||
if (from < 0) {
|
||||
from = 0;
|
||||
} else if (from > searchResults.size()) {
|
||||
from = searchResults.size();
|
||||
}
|
||||
p.translate(0, from * st::dlgHeight);
|
||||
if (from < searchResults.size()) {
|
||||
int32 to = ((r.bottom() - skip) / int32(st::dlgHeight)) + 1, w = width();
|
||||
if (to > searchResults.size()) to = searchResults.size();
|
||||
|
||||
p.translate(0, from * st::dlgHeight);
|
||||
for (; from < to; ++from) {
|
||||
bool active = (searchResults[from]->_item->id == App::main()->activeMsgId());
|
||||
bool selected = (from == searchedSel);
|
||||
@ -103,6 +134,34 @@ void DialogsListWidget::paintEvent(QPaintEvent *e) {
|
||||
}
|
||||
}
|
||||
|
||||
void DialogsListWidget::peopleResultPaint(UserData *user, QPainter &p, int32 w, bool act, bool sel) const {
|
||||
QRect fullRect(0, 0, w, st::dlgHeight);
|
||||
p.fillRect(fullRect, (act ? st::dlgActiveBG : (sel ? st::dlgHoverBG : st::dlgBG))->b);
|
||||
|
||||
History *history = App::history(user->id);
|
||||
|
||||
p.drawPixmap(st::dlgPaddingHor, st::dlgPaddingVer, history->peer->photo->pix(st::dlgPhotoSize));
|
||||
|
||||
int32 nameleft = st::dlgPaddingHor + st::dlgPhotoSize + st::dlgPhotoPadding;
|
||||
int32 namewidth = w - nameleft - st::dlgPaddingHor;
|
||||
QRect rectForName(nameleft, st::dlgPaddingVer + st::dlgNameTop, namewidth, st::msgNameFont->height);
|
||||
|
||||
// draw chat icon
|
||||
if (history->peer->chat) {
|
||||
p.drawPixmap(QPoint(rectForName.left() + st::dlgChatImgLeft, rectForName.top() + st::dlgChatImgTop), App::sprite(), (act ? st::dlgActiveChatImg : st::dlgChatImg));
|
||||
rectForName.setLeft(rectForName.left() + st::dlgChatImgSkip);
|
||||
}
|
||||
|
||||
// draw unread
|
||||
QRect tr(nameleft, st::dlgPaddingVer + st::dlgFont->height + st::dlgSep, namewidth, st::dlgFont->height);
|
||||
p.setPen((act ? st::dlgActiveColor : st::dlgSystemColor)->p);
|
||||
p.setFont(st::dlgHistFont->f);
|
||||
p.drawText(tr.left(), tr.top() + st::dlgHistFont->ascent, st::dlgHistFont->m.elidedText('@' + user->username, Qt::ElideRight, tr.width()));
|
||||
|
||||
p.setPen((act ? st::dlgActiveColor : st::dlgNameColor)->p);
|
||||
history->nameText.drawElided(p, rectForName.left(), rectForName.top(), rectForName.width());
|
||||
}
|
||||
|
||||
void DialogsListWidget::activate() {
|
||||
if (_state == DefaultState && !sel) {
|
||||
selectSkip(1);
|
||||
@ -147,9 +206,21 @@ void DialogsListWidget::onUpdateSelected(bool force) {
|
||||
parentWidget()->update();
|
||||
}
|
||||
}
|
||||
mouseY -= filterResults.size() * st::dlgHeight + st::searchedBarHeight;
|
||||
if (!peopleResults.isEmpty()) {
|
||||
int32 newPeopleSel = (mouseY >= 0) ? (mouseY / int32(st::dlgHeight)) : -1;
|
||||
if (newPeopleSel < 0 || newPeopleSel >= peopleResults.size()) {
|
||||
newPeopleSel = -1;
|
||||
}
|
||||
if (newPeopleSel != peopleSel) {
|
||||
peopleSel = newPeopleSel;
|
||||
setCursor((peopleSel >= 0) ? style::cur_pointer : style::cur_default);
|
||||
parentWidget()->update();
|
||||
}
|
||||
mouseY -= peopleResults.size() * st::dlgHeight + st::searchedBarHeight;
|
||||
}
|
||||
if (_state == SearchedState && !searchResults.isEmpty()) {
|
||||
mouseY -= filterResults.size() * st::dlgHeight + st::searchedBarHeight;
|
||||
int32 newSearchedSel = (mouseY >= 0) ? mouseY / int32(st::dlgHeight) : -1;
|
||||
int32 newSearchedSel = (mouseY >= 0) ? (mouseY / int32(st::dlgHeight)) : -1;
|
||||
if (newSearchedSel < 0 || newSearchedSel >= searchResults.size()) {
|
||||
newSearchedSel = -1;
|
||||
}
|
||||
@ -276,8 +347,18 @@ void DialogsListWidget::dlgUpdated(History *history) {
|
||||
}
|
||||
++cnt;
|
||||
}
|
||||
if (!searchResults.isEmpty()) {
|
||||
if (!peopleResults.isEmpty()) {
|
||||
int32 cnt = 0, add = filterResults.size() * st::dlgHeight + st::searchedBarHeight;
|
||||
for (PeopleResults::const_iterator i = peopleResults.cbegin(), e = peopleResults.cend(); i != e; ++i) {
|
||||
if ((*i) == history->peer) {
|
||||
update(0, add + cnt * st::dlgHeight, width(), st::dlgHeight);
|
||||
break;
|
||||
}
|
||||
++cnt;
|
||||
}
|
||||
}
|
||||
if (!searchResults.isEmpty()) {
|
||||
int32 cnt = 0, add = (filterResults.size() + peopleResults.size()) * st::dlgHeight + (peopleResults.isEmpty() ? 0 : st::searchedBarHeight) + st::searchedBarHeight;
|
||||
for (SearchResults::const_iterator i = searchResults.cbegin(), e = searchResults.cend(); i != e; ++i) {
|
||||
if ((*i)->_item->history() == history) {
|
||||
update(0, add + cnt * st::dlgHeight, width(), st::dlgHeight);
|
||||
@ -352,6 +433,7 @@ void DialogsListWidget::onFilterUpdate(QString newFilter, bool force) {
|
||||
if (filter.isEmpty()) {
|
||||
_state = DefaultState;
|
||||
filterResults.clear();
|
||||
peopleResults.clear();
|
||||
searchResults.clear();
|
||||
_lastSearchId = 0;
|
||||
} else {
|
||||
@ -441,7 +523,8 @@ DialogsListWidget::~DialogsListWidget() {
|
||||
clearSearchResults();
|
||||
}
|
||||
|
||||
void DialogsListWidget::clearSearchResults() {
|
||||
void DialogsListWidget::clearSearchResults(bool clearPeople) {
|
||||
if (clearPeople) peopleResults.clear();
|
||||
if (!searchResults.isEmpty()) {
|
||||
for (SearchResults::const_iterator i = searchResults.cbegin(), e = searchResults.cend(); i != e; ++i) {
|
||||
delete *i;
|
||||
@ -490,7 +573,7 @@ void DialogsListWidget::dialogsReceived(const QVector<MTPDialog> &added) {
|
||||
|
||||
void DialogsListWidget::searchReceived(const QVector<MTPMessage> &messages, bool fromStart, int32 fullCount) {
|
||||
if (fromStart) {
|
||||
clearSearchResults();
|
||||
clearSearchResults(false);
|
||||
}
|
||||
for (QVector<MTPMessage>::const_iterator i = messages.cbegin(), e = messages.cend(); i != e; ++i) {
|
||||
HistoryItem *item = App::histories().addToBack(*i, -1);
|
||||
@ -504,6 +587,19 @@ void DialogsListWidget::searchReceived(const QVector<MTPMessage> &messages, bool
|
||||
refresh();
|
||||
}
|
||||
|
||||
void DialogsListWidget::peopleReceived(const QVector<MTPContactFound> &people) {
|
||||
peopleResults.clear();
|
||||
peopleResults.reserve(people.size());
|
||||
for (QVector<MTPContactFound>::const_iterator i = people.cbegin(), e = people.cend(); i != e; ++i) {
|
||||
int32 uid = i->c_contactFound().vuser_id.v;
|
||||
History *h = App::historyLoaded(uid);
|
||||
if (h && !h->isEmpty()) continue; // skip dialogs
|
||||
|
||||
peopleResults.push_back(App::user(uid));
|
||||
}
|
||||
refresh();
|
||||
}
|
||||
|
||||
void DialogsListWidget::contactsReceived(const QVector<MTPContact> &contacts) {
|
||||
for (QVector<MTPContact>::const_iterator i = contacts.cbegin(), e = contacts.cend(); i != e; ++i) {
|
||||
addNewContact(i->c_contact().vuser_id.v);
|
||||
@ -543,9 +639,9 @@ void DialogsListWidget::refresh(bool toTop) {
|
||||
if (_state == DefaultState) {
|
||||
h = (dialogs.list.count + contactsNoDialogs.list.count) * st::dlgHeight;
|
||||
} else if (_state == FilteredState) {
|
||||
h = (filterResults.count() + searchResults.count()) * st::dlgHeight + (searchResults.isEmpty() ? 0 : st::searchedBarHeight);
|
||||
h = (filterResults.count() + peopleResults.count() + searchResults.count()) * st::dlgHeight + (peopleResults.isEmpty() ? 0 : st::searchedBarHeight) + (searchResults.isEmpty() ? 0 : st::searchedBarHeight);
|
||||
} else if (_state == SearchedState) {
|
||||
h = (filterResults.count() + searchResults.count()) * st::dlgHeight + st::searchedBarHeight;
|
||||
h = (filterResults.count() + peopleResults.count() + searchResults.count()) * st::dlgHeight + (peopleResults.isEmpty() ? 0 : st::searchedBarHeight) + st::searchedBarHeight;
|
||||
}
|
||||
resize(width(), h);
|
||||
if (toTop) {
|
||||
@ -562,8 +658,7 @@ void DialogsListWidget::setMouseSel(bool msel, bool toTop) {
|
||||
sel = (dialogs.list.count ? dialogs.list.begin : (contactsNoDialogs.list.count ? contactsNoDialogs.list.begin : 0));
|
||||
contactSel = !dialogs.list.count && contactsNoDialogs.list.count;
|
||||
} else if (_state == FilteredState || _state == SearchedState) { // don't select first elem in search
|
||||
filteredSel = -1;
|
||||
searchedSel = -1;
|
||||
filteredSel = peopleSel = searchedSel = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -572,7 +667,7 @@ void DialogsListWidget::setState(State newState) {
|
||||
_state = newState;
|
||||
if (_state == DefaultState) {
|
||||
clearSearchResults();
|
||||
searchedSel = filteredSel = -1;
|
||||
searchedSel = peopleSel = filteredSel = -1;
|
||||
} else if (_state == DefaultState || _state == SearchedState) {
|
||||
filterResults.clear();
|
||||
filteredSel = -1;
|
||||
@ -589,6 +684,7 @@ void DialogsListWidget::clearFilter() {
|
||||
if (_state == FilteredState || _state == SearchedState) {
|
||||
_state = DefaultState;
|
||||
filterResults.clear();
|
||||
peopleResults.clear();
|
||||
searchResults.clear();
|
||||
_lastSearchId = 0;
|
||||
filter = QString();
|
||||
@ -606,7 +702,6 @@ void DialogsListWidget::addDialog(const MTPDdialog &dialog) {
|
||||
}
|
||||
|
||||
void DialogsListWidget::selectSkip(int32 direction) {
|
||||
int32 skipMore = 0;
|
||||
if (_state == DefaultState) {
|
||||
if (!sel) {
|
||||
if (dialogs.list.count && direction > 0) {
|
||||
@ -634,55 +729,40 @@ void DialogsListWidget::selectSkip(int32 direction) {
|
||||
int32 fromY = (sel->pos + (contactSel ? dialogs.list.count : 0)) * st::dlgHeight;
|
||||
emit mustScrollTo(fromY, fromY + st::dlgHeight);
|
||||
} else if (_state == FilteredState || _state == SearchedState) {
|
||||
if (filterResults.isEmpty() && searchResults.isEmpty()) return;
|
||||
if (filteredSel < 0 || filteredSel >= filterResults.size()) {
|
||||
if (searchedSel < 0 || searchedSel >= searchResults.size()) {
|
||||
if (filterResults.isEmpty()) {
|
||||
searchedSel = 0;
|
||||
} else {
|
||||
filteredSel = 0;
|
||||
}
|
||||
} else if (direction < 0 && !searchedSel && !filterResults.isEmpty()) {
|
||||
searchedSel = -1;
|
||||
filteredSel = filterResults.size() + direction;
|
||||
if (filteredSel < 0) filteredSel = 0;
|
||||
if (filterResults.isEmpty() && peopleResults.isEmpty() && searchResults.isEmpty()) return;
|
||||
if ((filteredSel < 0 || filteredSel >= filterResults.size()) &&
|
||||
(peopleSel < 0 || peopleSel >= peopleResults.size()) &&
|
||||
(searchedSel < 0 || searchedSel >= searchResults.size())) {
|
||||
if (filterResults.isEmpty() && peopleResults.isEmpty()) {
|
||||
searchedSel = 0;
|
||||
} else if (filterResults.isEmpty()) {
|
||||
peopleSel = 0;
|
||||
} else {
|
||||
if (direction < -1 && searchedSel + direction < 0) {
|
||||
skipMore = direction + searchedSel;
|
||||
if (skipMore == direction) {
|
||||
skipMore = 0;
|
||||
} else {
|
||||
direction -= skipMore;
|
||||
}
|
||||
}
|
||||
searchedSel = snap(searchedSel + direction, 0, searchResults.size() - 1);
|
||||
filteredSel = 0;
|
||||
}
|
||||
} else if (direction > 0 && filteredSel == filterResults.size() - 1 && !searchResults.isEmpty()) {
|
||||
filteredSel = -1;
|
||||
searchedSel = direction - 1;
|
||||
if (searchedSel > searchResults.size() - 1) searchedSel = searchResults.size() - 1;
|
||||
} else {
|
||||
if (direction > 1 && filteredSel + direction > filterResults.size() - 1) {
|
||||
skipMore = direction - (filterResults.size() - 1 - filteredSel);
|
||||
if (skipMore == direction) {
|
||||
skipMore = 0;
|
||||
} else {
|
||||
direction -= skipMore;
|
||||
}
|
||||
int32 cur = (filteredSel >= 0 && filteredSel < filterResults.size()) ? filteredSel : ((peopleSel >= 0 && peopleSel < peopleResults.size()) ? (peopleSel + filterResults.size()) : (searchedSel + peopleResults.size() + filterResults.size()));
|
||||
cur = snap(cur + direction, 0, filterResults.size() + peopleResults.size() + searchResults.size() - 1);
|
||||
if (cur < filterResults.size()) {
|
||||
filteredSel = cur;
|
||||
peopleSel = searchedSel = -1;
|
||||
} else if (cur < filterResults.size() + peopleResults.size()) {
|
||||
peopleSel = cur - filterResults.size();
|
||||
filteredSel = searchedSel = -1;
|
||||
} else {
|
||||
filteredSel = peopleSel = -1;
|
||||
searchedSel = cur - filterResults.size() - peopleResults.size();
|
||||
}
|
||||
filteredSel = snap(filteredSel + direction, 0, filterResults.size() - 1);
|
||||
}
|
||||
if (filteredSel >= 0 && filteredSel < filterResults.size()) {
|
||||
emit mustScrollTo(filteredSel * st::dlgHeight, (filteredSel + 1) * st::dlgHeight);
|
||||
} else if (peopleSel >= 0 && peopleSel < peopleResults.size()) {
|
||||
emit mustScrollTo((peopleSel + filterResults.size()) * st::dlgHeight + (peopleSel ? st::searchedBarHeight : 0), (peopleSel + filterResults.size() + 1) * st::dlgHeight);
|
||||
} else {
|
||||
emit mustScrollTo((searchedSel + filterResults.size()) * st::dlgHeight + (searchedSel ? st::searchedBarHeight : 0), (searchedSel + filterResults.size() + 1) * st::dlgHeight + st::searchedBarHeight);
|
||||
emit mustScrollTo((searchedSel + peopleResults.size() + filterResults.size()) * st::dlgHeight + (peopleResults.size() ? st::searchedBarHeight : 0) + (searchedSel ? st::searchedBarHeight : 0), (searchedSel + peopleResults.size() + filterResults.size() + 1) * st::dlgHeight + (peopleResults.size() ? st::searchedBarHeight : 0) + st::searchedBarHeight);
|
||||
}
|
||||
}
|
||||
if (skipMore) {
|
||||
return selectSkip(skipMore);
|
||||
} else {
|
||||
parentWidget()->update();
|
||||
}
|
||||
parentWidget()->update();
|
||||
}
|
||||
|
||||
void DialogsListWidget::scrollToPeer(const PeerId &peer, MsgId msgId) {
|
||||
@ -798,8 +878,18 @@ void DialogsListWidget::loadPeerPhotos(int32 yFrom) {
|
||||
|
||||
from = (yFrom > st::searchedBarHeight ? ((yFrom - st::searchedBarHeight) / int32(st::dlgHeight)) : 0) - filterResults.size();
|
||||
if (from < 0) from = 0;
|
||||
if (from < searchResults.size()) {
|
||||
if (from < peopleResults.size()) {
|
||||
int32 to = (yTo > st::searchedBarHeight ? ((yTo - st::searchedBarHeight) / int32(st::dlgHeight)) : 0) - filterResults.size() + 1, w = width();
|
||||
if (to > peopleResults.size()) to = peopleResults.size();
|
||||
|
||||
for (; from < to; ++from) {
|
||||
peopleResults[from]->photo->load();
|
||||
}
|
||||
}
|
||||
from = (yFrom > ((peopleResults.isEmpty() ? 0 : st::searchedBarHeight) + st::searchedBarHeight) ? ((yFrom - (peopleResults.isEmpty() ? 0 : st::searchedBarHeight) - st::searchedBarHeight) / int32(st::dlgHeight)) : 0) - filterResults.size() - peopleResults.size();
|
||||
if (from < 0) from = 0;
|
||||
if (from < searchResults.size()) {
|
||||
int32 to = (yTo >(peopleResults.isEmpty() ? 0 : st::searchedBarHeight) + st::searchedBarHeight ? ((yTo - (peopleResults.isEmpty() ? 0 : st::searchedBarHeight) - st::searchedBarHeight) / int32(st::dlgHeight)) : 0) - filterResults.size() - peopleResults.size() + 1, w = width();
|
||||
if (to > searchResults.size()) to = searchResults.size();
|
||||
|
||||
for (; from < to; ++from) {
|
||||
@ -817,15 +907,21 @@ bool DialogsListWidget::choosePeer() {
|
||||
} else if (_state == FilteredState || _state == SearchedState) {
|
||||
if (filteredSel >= 0 && filteredSel < filterResults.size()) {
|
||||
history = filterResults[filteredSel]->history;
|
||||
} else if (peopleSel >= 0 && peopleSel < peopleResults.size()) {
|
||||
history = App::history(peopleResults[peopleSel]->id);
|
||||
} else if (searchedSel >= 0 && searchedSel < searchResults.size()) {
|
||||
history = searchResults[searchedSel]->_item->history();
|
||||
msgId = searchResults[searchedSel]->_item->id;
|
||||
}
|
||||
}
|
||||
if (history) {
|
||||
emit peerChosen(history->peer->id, msgId);
|
||||
bool chosen = (!App::main()->selectingPeer() && (_state == FilteredState || _state == SearchedState) && filteredSel >= 0 && filteredSel < filterResults.size());
|
||||
App::main()->showPeer(history->peer->id, msgId);
|
||||
if (chosen) {
|
||||
emit searchResultChosen();
|
||||
}
|
||||
sel = 0;
|
||||
filteredSel = -1;
|
||||
filteredSel = peopleSel = searchedSel = -1;
|
||||
parentWidget()->update();
|
||||
return true;
|
||||
}
|
||||
@ -835,10 +931,10 @@ bool DialogsListWidget::choosePeer() {
|
||||
void DialogsListWidget::destroyData() {
|
||||
sel = 0;
|
||||
contactSel = false;
|
||||
filteredSel = 0;
|
||||
filteredSel = -1;
|
||||
filterResults.clear();
|
||||
filter.clear();
|
||||
searchedSel = 0;
|
||||
searchedSel = peopleSel = -1;
|
||||
clearSearchResults();
|
||||
contacts.clear();
|
||||
contactsNoDialogs.clear();
|
||||
@ -883,6 +979,33 @@ void DialogsListWidget::peerBefore(const PeerData *inPeer, MsgId inMsg, PeerData
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (searchResults.at(0)->_item->history()->peer == inPeer && searchResults.at(0)->_item->id == inMsg) {
|
||||
outMsg = 0;
|
||||
if (peopleResults.isEmpty()) {
|
||||
if (filterResults.isEmpty()) {
|
||||
outPeer = 0;
|
||||
} else {
|
||||
outPeer = filterResults.back()->history->peer;
|
||||
}
|
||||
} else {
|
||||
outPeer = peopleResults.back();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!peopleResults.isEmpty() && peopleResults.at(0) == inPeer) {
|
||||
outPeer = filterResults.isEmpty() ? 0 : filterResults.back()->history->peer;
|
||||
outMsg = 0;
|
||||
return;
|
||||
}
|
||||
if (!peopleResults.isEmpty()) {
|
||||
for (PeopleResults::const_iterator b = peopleResults.cbegin(), i = b + 1, e = peopleResults.cend(); i != e; ++i) {
|
||||
if ((*i) == inPeer) {
|
||||
outPeer = (*(i - 1));
|
||||
outMsg = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (filterResults.isEmpty() || filterResults.at(0)->history->peer == inPeer) {
|
||||
outPeer = 0;
|
||||
@ -892,8 +1015,7 @@ void DialogsListWidget::peerBefore(const PeerData *inPeer, MsgId inMsg, PeerData
|
||||
|
||||
for (FilteredDialogs::const_iterator b = filterResults.cbegin(), i = b + 1, e = filterResults.cend(); i != e; ++i) {
|
||||
if ((*i)->history->peer == inPeer) {
|
||||
FilteredDialogs::const_iterator j = i - 1;
|
||||
outPeer = (*j)->history->peer;
|
||||
outPeer = (*(i - 1))->history->peer;
|
||||
outMsg = 0;
|
||||
return;
|
||||
}
|
||||
@ -943,11 +1065,32 @@ void DialogsListWidget::peerAfter(const PeerData *inPeer, MsgId inMsg, PeerData
|
||||
}
|
||||
}
|
||||
}
|
||||
for (PeopleResults::const_iterator i = peopleResults.cbegin(), e = peopleResults.cend(); i != e; ++i) {
|
||||
if ((*i) == inPeer) {
|
||||
++i;
|
||||
if (i == e && !searchResults.isEmpty()) {
|
||||
outPeer = searchResults.front()->_item->history()->peer;
|
||||
outMsg = searchResults.front()->_item->id;
|
||||
} else {
|
||||
outPeer = (i == e) ? 0 : (*i);
|
||||
outMsg = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (FilteredDialogs::const_iterator i = filterResults.cbegin(), e = filterResults.cend(); i != e; ++i) {
|
||||
if ((*i)->history->peer == inPeer) {
|
||||
++i;
|
||||
outPeer = (i == e) ? 0 : (*i)->history->peer;
|
||||
outMsg = 0;
|
||||
if (i == e && !peopleResults.isEmpty()) {
|
||||
outPeer = peopleResults.front();
|
||||
outMsg = 0;
|
||||
} else if (i == e && !searchResults.isEmpty()) {
|
||||
outPeer = searchResults.front()->_item->history()->peer;
|
||||
outMsg = searchResults.front()->_item->id;
|
||||
} else {
|
||||
outPeer = (i == e) ? 0 : (*i)->history->peer;
|
||||
outMsg = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -964,6 +1107,14 @@ DialogsIndexed &DialogsListWidget::dialogsList() {
|
||||
return dialogs;
|
||||
}
|
||||
|
||||
DialogsListWidget::FilteredDialogs &DialogsListWidget::filteredList() {
|
||||
return filterResults;
|
||||
}
|
||||
|
||||
DialogsListWidget::PeopleResults &DialogsListWidget::peopleList() {
|
||||
return peopleResults;
|
||||
}
|
||||
|
||||
DialogsListWidget::SearchResults &DialogsListWidget::searchList() {
|
||||
return searchResults;
|
||||
}
|
||||
@ -985,13 +1136,14 @@ DialogsWidget::DialogsWidget(MainWidget *parent) : QWidget(parent)
|
||||
, scroll(this, st::dlgScroll)
|
||||
, list(&scroll, parent)
|
||||
, _searchFull(false)
|
||||
, _peopleFull(false)
|
||||
{
|
||||
scroll.setWidget(&list);
|
||||
scroll.setFocusPolicy(Qt::NoFocus);
|
||||
connect(&list, SIGNAL(mustScrollTo(int, int)), &scroll, SLOT(scrollToY(int, int)));
|
||||
connect(&list, SIGNAL(dialogToTopFrom(int)), this, SLOT(onDialogToTopFrom(int)));
|
||||
connect(&list, SIGNAL(peerChosen(const PeerId &, MsgId)), this, SIGNAL(peerChosen(const PeerId &, MsgId)));
|
||||
connect(&list, SIGNAL(searchMessages()), this, SLOT(onNeedSearchMessages()));
|
||||
connect(&list, SIGNAL(searchResultChosen()), this, SLOT(onCancel()));
|
||||
connect(&scroll, SIGNAL(geometryChanged()), &list, SLOT(onParentGeometryChanged()));
|
||||
connect(&scroll, SIGNAL(scrolled()), &list, SLOT(onUpdateSelected()));
|
||||
connect(&scroll, SIGNAL(scrolled()), this, SLOT(onListScroll()));
|
||||
@ -1082,10 +1234,6 @@ void DialogsWidget::onCancel() {
|
||||
emit cancelled();
|
||||
}
|
||||
|
||||
void DialogsWidget::clearFiltered() {
|
||||
onCancel();
|
||||
}
|
||||
|
||||
void DialogsWidget::itemRemoved(HistoryItem *item) {
|
||||
list.itemRemoved(item);
|
||||
}
|
||||
@ -1164,6 +1312,9 @@ bool DialogsWidget::onSearchMessages(bool searchCache) {
|
||||
if (_searchRequest) {
|
||||
_searchRequest = 0;
|
||||
}
|
||||
if (_peopleRequest) {
|
||||
_peopleRequest = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (searchCache) {
|
||||
@ -1181,6 +1332,22 @@ bool DialogsWidget::onSearchMessages(bool searchCache) {
|
||||
_searchRequest = MTP::send(MTPmessages_Search(MTP_inputPeerEmpty(), MTP_string(_searchQuery), MTP_inputMessagesFilterEmpty(), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(SearchPerPage)), rpcDone(&DialogsWidget::searchReceived, true), rpcFail(&DialogsWidget::searchFailed));
|
||||
_searchQueries.insert(_searchRequest, _searchQuery);
|
||||
}
|
||||
if (q.size() >= MinUsernameLength) {
|
||||
if (searchCache) {
|
||||
PeopleCache::const_iterator i = _peopleCache.constFind(q);
|
||||
if (i != _peopleCache.cend()) {
|
||||
_peopleQuery = q;
|
||||
_peopleRequest = 0;
|
||||
peopleReceived(i.value(), 0);
|
||||
return true;
|
||||
}
|
||||
} else if (_peopleQuery != q) {
|
||||
_peopleQuery = q;
|
||||
_peopleFull = false;
|
||||
_peopleRequest = MTP::send(MTPcontacts_Search(MTP_string(_peopleQuery), MTP_int(SearchPeopleLimit)), rpcDone(&DialogsWidget::peopleReceived), rpcFail(&DialogsWidget::peopleFailed));
|
||||
_peopleQueries.insert(_peopleRequest, _peopleQuery);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1267,6 +1434,28 @@ void DialogsWidget::searchReceived(bool fromStart, const MTPmessages_Messages &r
|
||||
}
|
||||
}
|
||||
|
||||
void DialogsWidget::peopleReceived(const MTPcontacts_Found &result, mtpRequestId req) {
|
||||
if (list.state() == DialogsListWidget::FilteredState || list.state() == DialogsListWidget::SearchedState) {
|
||||
PeopleQueries::iterator i = _peopleQueries.find(req);
|
||||
if (i != _peopleQueries.cend()) {
|
||||
_peopleCache[i.value()] = result;
|
||||
_peopleQueries.erase(i);
|
||||
}
|
||||
}
|
||||
|
||||
if (_peopleRequest == req) {
|
||||
switch (result.type()) {
|
||||
case mtpc_contacts_found: {
|
||||
App::feedUsers(result.c_contacts_found().vusers);
|
||||
list.peopleReceived(result.c_contacts_found().vresults.c_vector().v);
|
||||
} break;
|
||||
}
|
||||
|
||||
_peopleRequest = 0;
|
||||
onListScroll();
|
||||
}
|
||||
}
|
||||
|
||||
bool DialogsWidget::searchFailed(const RPCError &error, mtpRequestId req) {
|
||||
if (_searchRequest == req) {
|
||||
_searchRequest = 0;
|
||||
@ -1275,6 +1464,14 @@ bool DialogsWidget::searchFailed(const RPCError &error, mtpRequestId req) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DialogsWidget::peopleFailed(const RPCError &error, mtpRequestId req) {
|
||||
if (_peopleRequest == req) {
|
||||
_peopleRequest = 0;
|
||||
_peopleFull = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DialogsWidget::addNewContact(int32 uid, bool show) {
|
||||
_filter.setText(QString());
|
||||
onFilterUpdate();
|
||||
@ -1288,8 +1485,7 @@ bool DialogsWidget::addNewContact(int32 uid, bool show) {
|
||||
void DialogsWidget::onListScroll() {
|
||||
list.loadPeerPhotos(scroll.scrollTop());
|
||||
if (list.state() == DialogsListWidget::SearchedState) {
|
||||
DialogsListWidget::SearchResults &res(list.searchList());
|
||||
if (scroll.scrollTop() > res.size() * st::dlgHeight - PreloadHeightsCount * scroll.height()) {
|
||||
if (scroll.scrollTop() > (list.searchList().size() + list.filteredList().size() + list.peopleList().size()) * st::dlgHeight - PreloadHeightsCount * scroll.height()) {
|
||||
onSearchMore(list.lastSearchId());
|
||||
}
|
||||
} else if (scroll.scrollTop() > list.dialogsList().list.count * st::dlgHeight - PreloadHeightsCount * scroll.height()) {
|
||||
@ -1312,6 +1508,11 @@ void DialogsWidget::onFilterUpdate() {
|
||||
_cancelSearch.show();
|
||||
_newGroup.hide();
|
||||
}
|
||||
if (filterText.size() < MinUsernameLength) {
|
||||
_peopleCache.clear();
|
||||
_peopleQueries.clear();
|
||||
_peopleQuery = QString();
|
||||
}
|
||||
}
|
||||
|
||||
void DialogsWidget::resizeEvent(QResizeEvent *e) {
|
||||
|
@ -28,6 +28,7 @@ public:
|
||||
|
||||
void dialogsReceived(const QVector<MTPDialog> &dialogs);
|
||||
void searchReceived(const QVector<MTPMessage> &messages, bool fromStart, int32 fullCount);
|
||||
void peopleReceived(const QVector<MTPContactFound> &people);
|
||||
void showMore(int32 pixels);
|
||||
|
||||
void activate();
|
||||
@ -41,6 +42,8 @@ public:
|
||||
void enterEvent(QEvent *e);
|
||||
void leaveEvent(QEvent *e);
|
||||
|
||||
void peopleResultPaint(UserData *user, QPainter &p, int32 w, bool act, bool sel) const;
|
||||
|
||||
void selectSkip(int32 direction);
|
||||
void selectSkipPage(int32 pixels, int32 direction);
|
||||
|
||||
@ -62,10 +65,14 @@ public:
|
||||
void peerAfter(const PeerData *inPeer, MsgId inMsg, PeerData *&outPeer, MsgId &outMsg) const;
|
||||
void scrollToPeer(const PeerId &peer, MsgId msgId);
|
||||
|
||||
typedef QVector<DialogRow*> FilteredDialogs;
|
||||
typedef QVector<UserData*> PeopleResults;
|
||||
typedef QVector<FakeDialogRow*> SearchResults;
|
||||
|
||||
DialogsIndexed &contactsList();
|
||||
DialogsIndexed &dialogsList();
|
||||
FilteredDialogs &filteredList();
|
||||
PeopleResults &peopleList();
|
||||
SearchResults &searchList();
|
||||
MsgId lastSearchId() const;
|
||||
|
||||
@ -96,15 +103,15 @@ public slots:
|
||||
|
||||
signals:
|
||||
|
||||
void peerChosen(const PeerId &, MsgId);
|
||||
void mustScrollTo(int scrollToTop, int scrollToBottom);
|
||||
void dialogToTopFrom(int movedFrom);
|
||||
void searchMessages();
|
||||
void searchResultChosen();
|
||||
|
||||
private:
|
||||
|
||||
void addDialog(const MTPDdialog &dialog);
|
||||
void clearSearchResults();
|
||||
void clearSearchResults(bool clearPeople = true);
|
||||
|
||||
DialogsIndexed dialogs;
|
||||
DialogsIndexed contactsNoDialogs;
|
||||
@ -114,13 +121,15 @@ private:
|
||||
bool selByMouse;
|
||||
|
||||
QString filter;
|
||||
typedef QVector<DialogRow*> FilteredDialogs;
|
||||
FilteredDialogs filterResults;
|
||||
int32 filteredSel;
|
||||
|
||||
SearchResults searchResults;
|
||||
int32 searchedCount, searchedSel;
|
||||
|
||||
PeopleResults peopleResults;
|
||||
int32 peopleSel;
|
||||
|
||||
MsgId _lastSearchId;
|
||||
|
||||
State _state;
|
||||
@ -140,6 +149,7 @@ public:
|
||||
void dialogsReceived(const MTPmessages_Dialogs &dialogs);
|
||||
void contactsReceived(const MTPcontacts_Contacts &contacts);
|
||||
void searchReceived(bool fromStart, const MTPmessages_Messages &result, mtpRequestId req);
|
||||
void peopleReceived(const MTPcontacts_Found &result, mtpRequestId req);
|
||||
bool addNewContact(int32 uid, bool show = true);
|
||||
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
@ -174,14 +184,12 @@ public:
|
||||
|
||||
void searchMessages(const QString &query);
|
||||
void onSearchMore(MsgId minMsgId);
|
||||
void clearFiltered();
|
||||
|
||||
void itemRemoved(HistoryItem *item);
|
||||
void itemReplaced(HistoryItem *oldItem, HistoryItem *newItem);
|
||||
|
||||
signals:
|
||||
|
||||
void peerChosen(const PeerId &, MsgId);
|
||||
void cancelled();
|
||||
|
||||
public slots:
|
||||
@ -206,6 +214,7 @@ private:
|
||||
bool dialogsFailed(const RPCError &e);
|
||||
bool contactsFailed();
|
||||
bool searchFailed(const RPCError &error, mtpRequestId req);
|
||||
bool peopleFailed(const RPCError &error, mtpRequestId req);
|
||||
|
||||
int32 dlgOffset, dlgCount;
|
||||
mtpRequestId dlgPreloading;
|
||||
@ -217,9 +226,9 @@ private:
|
||||
DialogsListWidget list;
|
||||
|
||||
QTimer _searchTimer;
|
||||
QString _searchQuery;
|
||||
bool _searchFull;
|
||||
mtpRequestId _searchRequest;
|
||||
QString _searchQuery, _peopleQuery;
|
||||
bool _searchFull, _peopleFull;
|
||||
mtpRequestId _searchRequest, _peopleRequest;
|
||||
|
||||
typedef QMap<QString, MTPmessages_Messages> SearchCache;
|
||||
SearchCache _searchCache;
|
||||
@ -227,4 +236,10 @@ private:
|
||||
typedef QMap<mtpRequestId, QString> SearchQueries;
|
||||
SearchQueries _searchQueries;
|
||||
|
||||
typedef QMap<QString, MTPcontacts_Found> PeopleCache;
|
||||
PeopleCache _peopleCache;
|
||||
|
||||
typedef QMap<mtpRequestId, QString> PeopleQueries;
|
||||
PeopleQueries _peopleQueries;
|
||||
|
||||
};
|
||||
|
@ -27,7 +27,6 @@ class FlatInput : public QLineEdit, public Animated {
|
||||
public:
|
||||
|
||||
FlatInput(QWidget *parent, const style::flatInput &st, const QString &ph = QString(), const QString &val = QString());
|
||||
QString val() const;
|
||||
|
||||
bool event(QEvent *e);
|
||||
void touchEvent(QTouchEvent *e);
|
||||
|
@ -306,7 +306,9 @@ void PeerData::updateName(const QString &newName, const QString &newNameOrPhone)
|
||||
NameFirstChars oldChars = chars;
|
||||
fillNames();
|
||||
App::history(id)->updateNameText();
|
||||
emit App::main()->peerNameChanged(this, oldNames, oldChars);
|
||||
if (App::main()) {
|
||||
emit App::main()->peerNameChanged(this, oldNames, oldChars);
|
||||
}
|
||||
nameUpdated();
|
||||
}
|
||||
|
||||
@ -326,9 +328,38 @@ void UserData::setPhoto(const MTPUserProfilePhoto &p) {
|
||||
emit App::main()->peerPhotoChanged(this);
|
||||
}
|
||||
|
||||
void UserData::setName(const QString &first, const QString &last, const QString &phoneName) {
|
||||
void PeerData::fillNames() {
|
||||
names.clear();
|
||||
chars.clear();
|
||||
QString toIndex = textAccentFold(name);
|
||||
if (nameOrPhone != name) {
|
||||
toIndex += ' ' + textAccentFold(nameOrPhone);
|
||||
}
|
||||
if (!chat) {
|
||||
toIndex += ' ' + textAccentFold(asUser()->username);
|
||||
}
|
||||
if (cRussianLetters().match(toIndex).hasMatch()) {
|
||||
toIndex += ' ' + translitRusEng(toIndex);
|
||||
}
|
||||
toIndex += ' ' + rusKeyboardLayoutSwitch(toIndex);
|
||||
|
||||
QStringList namesList = toIndex.toLower().split(cWordSplit(), QString::SkipEmptyParts);
|
||||
for (QStringList::const_iterator i = namesList.cbegin(), e = namesList.cend(); i != e; ++i) {
|
||||
names.insert(*i);
|
||||
chars.insert(i->at(0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void UserData::setName(const QString &first, const QString &last, const QString &phoneName, const QString &usern) {
|
||||
bool updName = !first.isEmpty() || !last.isEmpty();
|
||||
|
||||
if (username != usern) {
|
||||
username = usern;
|
||||
if (App::main()) {
|
||||
App::main()->peerUsernameChanged(this);
|
||||
}
|
||||
}
|
||||
if (updName && first.trimmed().isEmpty()) {
|
||||
firstName = last;
|
||||
lastName = QString();
|
||||
@ -338,7 +369,7 @@ void UserData::setName(const QString &first, const QString &last, const QString
|
||||
firstName = first;
|
||||
lastName = last;
|
||||
}
|
||||
updateName(firstName + qsl(" ") + lastName, phoneName);
|
||||
updateName(firstName + ' ' + lastName, phoneName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1290,16 +1321,20 @@ HistoryItem *History::doAddToBack(HistoryBlock *to, bool newBlock, HistoryItem *
|
||||
return adding;
|
||||
}
|
||||
|
||||
void History::unregTyping(UserData *from) {
|
||||
TypingUsers::iterator i = typing.find(from);
|
||||
if (i != typing.end()) {
|
||||
uint64 ms = getms();
|
||||
i.value() = ms;
|
||||
updateTyping(ms, 0, true);
|
||||
App::main()->topBar()->update();
|
||||
}
|
||||
}
|
||||
|
||||
void History::newItemAdded(HistoryItem *item) {
|
||||
App::checkImageCacheSize();
|
||||
if (item->from()) {
|
||||
TypingUsers::iterator i = typing.find(item->from());
|
||||
if (i != typing.end()) {
|
||||
uint64 ms = getms();
|
||||
i.value() = ms;
|
||||
updateTyping(ms, 0, true);
|
||||
App::main()->topBar()->update();
|
||||
}
|
||||
unregTyping(item->from());
|
||||
}
|
||||
if (item->out()) {
|
||||
// inboxRead(false);
|
||||
@ -3012,7 +3047,7 @@ void HistoryContact::updateFrom(const MTPMessageMedia &media) {
|
||||
}
|
||||
|
||||
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)
|
||||
HistoryItem(history, block, msg.vid.v, (msg.vflags.v & 0x02), (msg.vflags.v & 0x01), ::date(msg.vdate), msg.vfrom_id.v)
|
||||
, _text(st::msgMinWidth)
|
||||
, _textWidth(0)
|
||||
, _textHeight(0)
|
||||
@ -3418,7 +3453,7 @@ HistoryMessage::~HistoryMessage() {
|
||||
delete _media;
|
||||
}
|
||||
|
||||
HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, const MTPDmessageForwarded &msg) : HistoryMessage(history, block, msg.vid.v, msg.vout.v, msg.vunread.v, ::date(msg.vdate), msg.vfrom_id.v, textClean(qs(msg.vmessage)), msg.vmedia)
|
||||
HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, const MTPDmessageForwarded &msg) : HistoryMessage(history, block, msg.vid.v, (msg.vflags.v & 0x02), (msg.vflags.v & 0x01), ::date(msg.vdate), msg.vfrom_id.v, textClean(qs(msg.vmessage)), msg.vmedia)
|
||||
, fwdDate(::date(msg.vfwd_date))
|
||||
, fwdFrom(App::user(msg.vfwd_from_id.v))
|
||||
, fwdFromName(4096)
|
||||
@ -3657,7 +3692,7 @@ QString HistoryServiceMsg::messageByAction(const MTPmessageAction &action, TextL
|
||||
}
|
||||
|
||||
HistoryServiceMsg::HistoryServiceMsg(History *history, HistoryBlock *block, const MTPDmessageService &msg) :
|
||||
HistoryItem(history, block, msg.vid.v, msg.vout.v, msg.vunread.v, ::date(msg.vdate), msg.vfrom_id.v)
|
||||
HistoryItem(history, block, msg.vid.v, (msg.vflags.v & 0x02), (msg.vflags.v & 0x01), ::date(msg.vdate), msg.vfrom_id.v)
|
||||
, _text(st::msgMinWidth)
|
||||
, _media(0)
|
||||
{
|
||||
|
@ -84,28 +84,7 @@ struct PeerData {
|
||||
|
||||
void updateName(const QString &newName, const QString &newNameOrPhone);
|
||||
|
||||
void fillNames() {
|
||||
names.clear();
|
||||
chars.clear();
|
||||
QString toIndex = textAccentFold(name);
|
||||
if (nameOrPhone != name) {
|
||||
toIndex += qsl(" ") + textAccentFold(nameOrPhone);
|
||||
}
|
||||
if (cRussianLetters().match(toIndex).hasMatch()) {
|
||||
toIndex += qsl(" ") + translitRusEng(toIndex);
|
||||
}
|
||||
toIndex += qsl(" ") + rusKeyboardLayoutSwitch(toIndex);
|
||||
|
||||
if (name.midRef(0, 8) == "Telegram") {
|
||||
int a = 0;
|
||||
}
|
||||
|
||||
QStringList namesList = toIndex.toLower().split(cWordSplit(), QString::SkipEmptyParts);
|
||||
for (QStringList::const_iterator i = namesList.cbegin(), e = namesList.cend(); i != e; ++i) {
|
||||
names.insert(*i);
|
||||
chars.insert(i->at(0));
|
||||
}
|
||||
}
|
||||
void fillNames();
|
||||
|
||||
virtual void nameUpdated() {
|
||||
}
|
||||
@ -152,12 +131,13 @@ struct UserData : public PeerData {
|
||||
UserData(const PeerId &id) : PeerData(id), lnk(new PeerLink(this)), onlineTill(0), contact(-1), photosCount(-1) {
|
||||
}
|
||||
void setPhoto(const MTPUserProfilePhoto &photo);
|
||||
void setName(const QString &first, const QString &last, const QString &phoneName);
|
||||
void setName(const QString &first, const QString &last, const QString &phoneName, const QString &username);
|
||||
void setPhone(const QString &newPhone);
|
||||
void nameUpdated();
|
||||
|
||||
QString firstName;
|
||||
QString lastName;
|
||||
QString username;
|
||||
QString phone;
|
||||
Text nameText;
|
||||
PhotoId photoId;
|
||||
@ -675,6 +655,7 @@ struct History : public QList<HistoryBlock*> {
|
||||
HistoryItem *doAddToBack(HistoryBlock *to, bool newBlock, HistoryItem *adding, bool newMsg);
|
||||
|
||||
void newItemAdded(HistoryItem *item);
|
||||
void unregTyping(UserData *from);
|
||||
|
||||
void inboxRead(bool byThisInstance = false);
|
||||
void outboxRead();
|
||||
|
@ -1600,7 +1600,7 @@ void HistoryWidget::updateTyping(bool typing) {
|
||||
if (noTypingUpdate || !hist || (typing && (hist->myTyping + 5000 > ms)) || (!typing && (hist->myTyping + 5000 <= ms))) return;
|
||||
|
||||
hist->myTyping = typing ? ms : 0;
|
||||
if (typing) MTP::send(MTPmessages_SetTyping(histPeer->input, MTP_bool(typing)));
|
||||
if (typing) MTP::send(MTPmessages_SetTyping(histPeer->input, typing ? MTP_sendMessageTypingAction() : MTP_sendMessageCancelAction()));
|
||||
}
|
||||
|
||||
void HistoryWidget::activate() {
|
||||
@ -1657,9 +1657,6 @@ void HistoryWidget::showPeer(const PeerId &peer, MsgId msgId, bool force, bool l
|
||||
App::main()->offerPeer(peer);
|
||||
return;
|
||||
}
|
||||
if (peer && !msgId) {
|
||||
App::main()->dialogsClear();
|
||||
}
|
||||
if (hist) {
|
||||
if (histPeer->id == peer) {
|
||||
if (msgId != hist->activeMsgId) {
|
||||
@ -2204,7 +2201,8 @@ void HistoryWidget::onSend(bool ctrlShiftEnter) {
|
||||
hist->loadAround(0);
|
||||
|
||||
MTPstring msgText(MTP_string(text));
|
||||
hist->addToBack(MTP_message(MTP_int(newId), MTP_int(MTP::authedId()), App::peerToMTP(histPeer->id), MTP_bool(true), MTP_bool(true), MTP_int(unixtime()), msgText, MTP_messageMediaEmpty()));
|
||||
int32 flags = 0x01 | 0x02; // unread, out
|
||||
hist->addToBack(MTP_message(MTP_int(flags), MTP_int(newId), MTP_int(MTP::authedId()), App::peerToMTP(histPeer->id), MTP_int(unixtime()), msgText, MTP_messageMediaEmpty()));
|
||||
App::main()->historyToDown(hist);
|
||||
App::main()->dialogsToUp();
|
||||
peerMessagesUpdated();
|
||||
@ -2250,7 +2248,8 @@ mtpRequestId HistoryWidget::onForward(const PeerId &peer, SelectedItemSet toForw
|
||||
|
||||
MTPstring msgText(MTP_string(msg->selectedText(FullItemSel)));
|
||||
|
||||
hist->addToBack(MTP_message(MTP_int(newId), MTP_int(MTP::authedId()), App::peerToMTP(histPeer->id), MTP_bool(true), MTP_bool(true), MTP_int(unixtime()), msgText, MTP_messageMediaEmpty()));
|
||||
int32 flags = 0x01 | 0x02; // unread, out
|
||||
hist->addToBack(MTP_message(MTP_int(flags), MTP_int(newId), MTP_int(MTP::authedId()), App::peerToMTP(histPeer->id), MTP_int(unixtime()), msgText, MTP_messageMediaEmpty()));
|
||||
MTP::send(MTPmessages_SendMessage(histPeer->input, msgText, MTP_long(randomId)), App::main()->rpcDone(&MainWidget::sentDataReceived, randomId));
|
||||
}
|
||||
if (newId) {
|
||||
@ -2294,7 +2293,8 @@ void HistoryWidget::shareContact(const PeerId &peer, const QString &phone, const
|
||||
|
||||
h->loadAround(0);
|
||||
|
||||
h->addToBack(MTP_message(MTP_int(newId), MTP_int(MTP::authedId()), App::peerToMTP(peer), MTP_bool(true), MTP_bool(true), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaContact(MTP_string(phone), MTP_string(fname), MTP_string(lname), MTP_int(userId))));
|
||||
int32 flags = 0x01 | 0x02; // unread, out
|
||||
h->addToBack(MTP_message(MTP_int(flags), MTP_int(newId), MTP_int(MTP::authedId()), App::peerToMTP(peer), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaContact(MTP_string(phone), MTP_string(fname), MTP_string(lname), MTP_int(userId))));
|
||||
|
||||
MTP::send(MTPmessages_SendMedia(App::peer(peer)->input, MTP_inputMediaContact(MTP_string(phone), MTP_string(fname), MTP_string(lname)), MTP_long(randomId)), App::main()->rpcDone(&MainWidget::sentFullDataReceived, randomId));
|
||||
|
||||
@ -2822,10 +2822,12 @@ void HistoryWidget::confirmSendImage(const ReadyLocalMedia &img) {
|
||||
History *h = App::history(img.peer);
|
||||
if (img.type == ToPreparePhoto) {
|
||||
h->loadAround(0);
|
||||
h->addToBack(MTP_message(MTP_int(newId), MTP_int(MTP::authedId()), App::peerToMTP(img.peer), MTP_bool(true), MTP_bool(true), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaPhoto(img.photo)));
|
||||
int32 flags = 0x01 | 0x02; // unread, out
|
||||
h->addToBack(MTP_message(MTP_int(flags), MTP_int(newId), MTP_int(MTP::authedId()), App::peerToMTP(img.peer), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaPhoto(img.photo)));
|
||||
} else if (img.type == ToPrepareDocument) {
|
||||
h->loadAround(0);
|
||||
h->addToBack(MTP_message(MTP_int(newId), MTP_int(MTP::authedId()), App::peerToMTP(img.peer), MTP_bool(true), MTP_bool(true), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaDocument(img.document)));
|
||||
int32 flags = 0x01 | 0x02; // unread, out
|
||||
h->addToBack(MTP_message(MTP_int(flags), MTP_int(newId), MTP_int(MTP::authedId()), App::peerToMTP(img.peer), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaDocument(img.document)));
|
||||
}
|
||||
|
||||
if (hist && histPeer && img.peer == histPeer->id) {
|
||||
|
@ -237,9 +237,15 @@ void IntroPhone::phoneSubmitDone(const MTPauth_SentCode &result) {
|
||||
stopCheck();
|
||||
enableAll(false);
|
||||
|
||||
const MTPDauth_sentCode &d(result.c_auth_sentCode());
|
||||
intro()->setPhone(sentPhone, d.vphone_code_hash.c_string().v.c_str(), d.vphone_registered.v);
|
||||
intro()->setCallTimeout(result.c_auth_sentCode().vsend_call_timeout.v);
|
||||
if (result.type() == mtpc_auth_sentCode) {
|
||||
const MTPDauth_sentCode &d(result.c_auth_sentCode());
|
||||
intro()->setPhone(sentPhone, d.vphone_code_hash.c_string().v.c_str(), d.vphone_registered.v);
|
||||
intro()->setCallTimeout(d.vsend_call_timeout.v);
|
||||
} else if (result.type() == mtpc_auth_sentAppCode) {
|
||||
const MTPDauth_sentAppCode &d(result.c_auth_sentAppCode());
|
||||
intro()->setPhone(sentPhone, d.vphone_code_hash.c_string().v.c_str(), d.vphone_registered.v);
|
||||
intro()->setCallTimeout(d.vsend_call_timeout.v);
|
||||
}
|
||||
intro()->onIntroNext();
|
||||
}
|
||||
|
||||
|
@ -279,7 +279,6 @@ dialogs(this), history(this), profile(0), overview(0), _topBar(this), hider(0),
|
||||
setGeometry(QRect(0, st::titleHeight, App::wnd()->width(), App::wnd()->height() - st::titleHeight));
|
||||
|
||||
connect(window, SIGNAL(resized(const QSize &)), this, SLOT(onParentResize(const QSize &)));
|
||||
connect(&dialogs, SIGNAL(peerChosen(const PeerId &, MsgId)), this, SLOT(showPeer(const PeerId &, MsgId)));
|
||||
connect(&dialogs, SIGNAL(cancelled()), this, SLOT(dialogsCancelled()));
|
||||
connect(&history, SIGNAL(cancelled()), &dialogs, SLOT(activate()));
|
||||
connect(this, SIGNAL(peerPhotoChanged(PeerData *)), this, SIGNAL(dialogsUpdated()));
|
||||
@ -559,7 +558,8 @@ void MainWidget::sendMessage(History *hist, const QString &text) {
|
||||
hist->loadAround(0);
|
||||
|
||||
MTPstring msgText(MTP_string(msg));
|
||||
hist->addToBack(MTP_message(MTP_int(newId), MTP_int(MTP::authedId()), App::peerToMTP(hist->peer->id), MTP_bool(true), MTP_bool(true), MTP_int(unixtime()), msgText, MTP_messageMediaEmpty()));
|
||||
int32 flags = 0x01 | 0x02; // unread, out
|
||||
hist->addToBack(MTP_message(MTP_int(flags), MTP_int(newId), MTP_int(MTP::authedId()), App::peerToMTP(hist->peer->id), MTP_int(unixtime()), msgText, MTP_messageMediaEmpty()));
|
||||
historyToDown(hist);
|
||||
if (history.peer() == hist->peer) {
|
||||
history.peerMessagesUpdated();
|
||||
@ -575,7 +575,7 @@ void MainWidget::readServerHistory(History *hist, bool force) {
|
||||
ReadRequests::const_iterator i = _readRequests.constFind(hist->peer);
|
||||
if (i == _readRequests.cend()) {
|
||||
hist->inboxRead(true);
|
||||
_readRequests.insert(hist->peer, MTP::send(MTPmessages_ReadHistory(hist->peer->input, MTP_int(0), MTP_int(0)), rpcDone(&MainWidget::partWasRead, hist->peer)));
|
||||
_readRequests.insert(hist->peer, MTP::send(MTPmessages_ReadHistory(hist->peer->input, MTP_int(0), MTP_int(0), MTP_bool(true)), rpcDone(&MainWidget::partWasRead, hist->peer)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -755,6 +755,15 @@ void MainWidget::loadMediaBack(PeerData *peer, MediaOverviewType type, bool many
|
||||
_overviewLoad[type].insert(hist->peer, MTP::send(MTPmessages_Search(hist->peer->input, MTPstring(), filter, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(minId), MTP_int(limit)), rpcDone(&MainWidget::photosLoaded, hist)));
|
||||
}
|
||||
|
||||
void MainWidget::peerUsernameChanged(PeerData *peer) {
|
||||
if (profile && profile->peer() == peer) {
|
||||
profile->update();
|
||||
}
|
||||
if (App::settings() && peer == App::self()) {
|
||||
App::settings()->usernameChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWidget::photosLoaded(History *h, const MTPmessages_Messages &msgs, mtpRequestId req) {
|
||||
OverviewsPreload::iterator it;
|
||||
MediaOverviewType type = OverviewCount;
|
||||
@ -820,7 +829,7 @@ void MainWidget::partWasRead(PeerData *peer, const MTPmessages_AffectedHistory &
|
||||
if (!MTP::authedId() || offset <= 0) {
|
||||
_readRequests.remove(peer);
|
||||
} else {
|
||||
_readRequests[peer] = MTP::send(MTPmessages_ReadHistory(peer->input, MTP_int(0), MTP_int(offset)), rpcDone(&MainWidget::partWasRead, peer));
|
||||
_readRequests[peer] = MTP::send(MTPmessages_ReadHistory(peer->input, MTP_int(0), MTP_int(offset), MTP_bool(true)), rpcDone(&MainWidget::partWasRead, peer));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1414,10 +1423,6 @@ void MainWidget::dialogsToUp() {
|
||||
dialogs.dialogsToUp();
|
||||
}
|
||||
|
||||
void MainWidget::dialogsClear() {
|
||||
dialogs.clearFiltered();
|
||||
}
|
||||
|
||||
void MainWidget::newUnreadMsg(History *hist, MsgId msgId) {
|
||||
history.newUnreadMsg(hist, msgId);
|
||||
}
|
||||
@ -1950,7 +1955,8 @@ void MainWidget::updateReceived(const mtpPrime *from, const mtpPrime *end) {
|
||||
}
|
||||
|
||||
if (!App::userLoaded(d.vfrom_id.v)) return getDifference();
|
||||
HistoryItem *item = App::histories().addToBack(MTP_message(d.vid, d.vfrom_id, MTP_peerUser(MTP_int(MTP::authedId())), MTP_bool(false), MTP_bool(true), d.vdate, d.vmessage, MTP_messageMediaEmpty()));
|
||||
int32 flags = 0x01; // unread
|
||||
HistoryItem *item = App::histories().addToBack(MTP_message(MTP_int(flags), d.vid, d.vfrom_id, MTP_peerUser(MTP_int(MTP::authedId())), d.vdate, d.vmessage, MTP_messageMediaEmpty()));
|
||||
if (item) {
|
||||
history.peerMessagesUpdated(item->history()->peer->id);
|
||||
}
|
||||
@ -1965,7 +1971,8 @@ void MainWidget::updateReceived(const mtpPrime *from, const mtpPrime *end) {
|
||||
}
|
||||
|
||||
if (!App::chatLoaded(d.vchat_id.v) || !App::userLoaded(d.vfrom_id.v)) return getDifference();
|
||||
HistoryItem *item = App::histories().addToBack(MTP_message(d.vid, d.vfrom_id, MTP_peerChat(d.vchat_id), MTP_bool(false), MTP_bool(true), d.vdate, d.vmessage, MTP_messageMediaEmpty()));
|
||||
int32 flags = 0x01; // unread
|
||||
HistoryItem *item = App::histories().addToBack(MTP_message(MTP_int(flags), d.vid, d.vfrom_id, MTP_peerChat(d.vchat_id), d.vdate, d.vmessage, MTP_messageMediaEmpty()));
|
||||
if (item) {
|
||||
history.peerMessagesUpdated(item->history()->peer->id);
|
||||
}
|
||||
@ -2056,7 +2063,11 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
|
||||
History *history = App::historyLoaded(App::peerFromUser(d.vuser_id));
|
||||
UserData *user = App::userLoaded(d.vuser_id.v);
|
||||
if (history && user) {
|
||||
dialogs.regTyping(history, user);
|
||||
if (d.vaction.type() == mtpc_sendMessageTypingAction) {
|
||||
dialogs.regTyping(history, user);
|
||||
} else if (d.vaction.type() == mtpc_sendMessageCancelAction) {
|
||||
history->unregTyping(user);
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
||||
@ -2105,7 +2116,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
|
||||
const MTPDupdateUserName &d(update.c_updateUserName());
|
||||
UserData *user = App::userLoaded(d.vuser_id.v);
|
||||
if (user && user->contact <= 0) {
|
||||
user->setName(textOneLine(qs(d.vfirst_name)), textOneLine(qs(d.vlast_name)), user->nameOrPhone);
|
||||
user->setName(textOneLine(qs(d.vfirst_name)), textOneLine(qs(d.vlast_name)), user->nameOrPhone, textOneLine(qs(d.vusername)));
|
||||
if (App::main()) App::main()->peerUpdated(user);
|
||||
}
|
||||
} break;
|
||||
@ -2200,5 +2211,10 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
|
||||
const MTPDupdateDcOptions &d(update.c_updateDcOptions());
|
||||
MTP::updateDcOptions(d.vdc_options.c_vector().v);
|
||||
} break;
|
||||
|
||||
case mtpc_updateServiceNotification: {
|
||||
const MTPDupdateServiceNotification &d(update.c_updateServiceNotification());
|
||||
//
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
@ -196,7 +196,6 @@ public:
|
||||
void msgUpdated(PeerId peer, const HistoryItem *msg);
|
||||
void historyToDown(History *hist);
|
||||
void dialogsToUp();
|
||||
void dialogsClear(); // after showing peer history
|
||||
void newUnreadMsg(History *history, MsgId msgId);
|
||||
void updUpdated(int32 pts, int32 date, int32 qts, int32 seq);
|
||||
void historyWasRead();
|
||||
@ -282,6 +281,7 @@ public:
|
||||
void itemResized(HistoryItem *row);
|
||||
|
||||
void loadMediaBack(PeerData *peer, MediaOverviewType type, bool many = false);
|
||||
void peerUsernameChanged(PeerData *peer);
|
||||
|
||||
~MainWidget();
|
||||
|
||||
|
@ -329,6 +329,9 @@ enum {
|
||||
mtpc_invokeWithLayer13 = 0x427c8ea2,
|
||||
mtpc_invokeWithLayer14 = 0x2b9b08fa,
|
||||
mtpc_invokeWithLayer15 = 0xb4418b64,
|
||||
mtpc_invokeWithLayer16 = 0xcf5f0987,
|
||||
mtpc_invokeWithLayer17 = 0x50858a19,
|
||||
mtpc_invokeWithLayer18 = 0x1c900537,
|
||||
|
||||
// manually parsed
|
||||
mtpc_rpc_result = 0xf35c6d01,
|
||||
@ -354,6 +357,9 @@ static const mtpTypeId mtpLayers[] = {
|
||||
mtpc_invokeWithLayer13,
|
||||
mtpc_invokeWithLayer14,
|
||||
mtpc_invokeWithLayer15,
|
||||
mtpc_invokeWithLayer16,
|
||||
mtpc_invokeWithLayer17,
|
||||
mtpc_invokeWithLayer18,
|
||||
}, mtpLayerMax = sizeof(mtpLayers) / sizeof(mtpLayers[0]);
|
||||
|
||||
template <typename bareT>
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -31,6 +31,9 @@
|
||||
//invokeWithLayer13#427c8ea2 query:!X = X;
|
||||
//invokeWithLayer14#2b9b08fa query:!X = X;
|
||||
//invokeWithLayer15#b4418b64 query:!X = X;
|
||||
//invokeWithLayer16#cf5f0987 query:!X = X;
|
||||
//invokeWithLayer17#50858a19 query:!X = X;
|
||||
//invokeWithLayer18#1c900537 query:!X = X;
|
||||
|
||||
///////////////////////////////
|
||||
/// Authorization key creation
|
||||
@ -123,8 +126,6 @@ register.saveDeveloperInfo#9a5f6e95 name:string email:string phone_number:string
|
||||
|
||||
---types---
|
||||
|
||||
|
||||
|
||||
inputPeerEmpty#7f3b18ea = InputPeer;
|
||||
inputPeerSelf#7da07ec9 = InputPeer;
|
||||
inputPeerContact#1023dbe8 user_id:int = InputPeer;
|
||||
@ -188,11 +189,11 @@ fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileL
|
||||
fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation;
|
||||
|
||||
userEmpty#200250ba id:int = User;
|
||||
userSelf#720535ec id:int first_name:string last_name:string phone:string photo:UserProfilePhoto status:UserStatus inactive:Bool = User;
|
||||
userContact#f2fb8319 id:int first_name:string last_name:string access_hash:long phone:string photo:UserProfilePhoto status:UserStatus = User;
|
||||
userRequest#22e8ceb0 id:int first_name:string last_name:string access_hash:long phone:string photo:UserProfilePhoto status:UserStatus = User;
|
||||
userForeign#5214c89d id:int first_name:string last_name:string access_hash:long photo:UserProfilePhoto status:UserStatus = User;
|
||||
userDeleted#b29ad7cc id:int first_name:string last_name:string = User;
|
||||
userSelf#7007b451 id:int first_name:string last_name:string username:string phone:string photo:UserProfilePhoto status:UserStatus inactive:Bool = User;
|
||||
userContact#cab35e18 id:int first_name:string last_name:string username:string access_hash:long phone:string photo:UserProfilePhoto status:UserStatus = User;
|
||||
userRequest#d9ccc4ef id:int first_name:string last_name:string username:string access_hash:long phone:string photo:UserProfilePhoto status:UserStatus = User;
|
||||
userForeign#75cf7a8 id:int first_name:string last_name:string username:string access_hash:long photo:UserProfilePhoto status:UserStatus = User;
|
||||
userDeleted#d6016d7a id:int first_name:string last_name:string username:string = User;
|
||||
|
||||
userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto;
|
||||
userProfilePhoto#d559d8c8 photo_id:long photo_small:FileLocation photo_big:FileLocation = UserProfilePhoto;
|
||||
@ -216,9 +217,9 @@ chatPhotoEmpty#37c1011c = ChatPhoto;
|
||||
chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto;
|
||||
|
||||
messageEmpty#83e5de54 id:int = Message;
|
||||
message#22eb6aba id:int from_id:int to_id:Peer out:Bool unread:Bool date:int message:string media:MessageMedia = Message;
|
||||
messageForwarded#5f46804 id:int fwd_from_id:int fwd_date:int from_id:int to_id:Peer out:Bool unread:Bool date:int message:string media:MessageMedia = Message;
|
||||
messageService#9f8d60bb id:int from_id:int to_id:Peer out:Bool unread:Bool date:int action:MessageAction = Message;
|
||||
message#567699b3 flags:int id:int from_id:int to_id:Peer date:int message:string media:MessageMedia = Message;
|
||||
messageForwarded#a367e716 flags:int id:int fwd_from_id:int fwd_date:int from_id:int to_id:Peer date:int message:string media:MessageMedia = Message;
|
||||
messageService#1d86f70e flags:int id:int from_id:int to_id:Peer date:int action:MessageAction = Message;
|
||||
|
||||
messageMediaEmpty#3ded6320 = MessageMedia;
|
||||
messageMediaPhoto#c8c45a2a photo:Photo = MessageMedia;
|
||||
@ -284,8 +285,6 @@ importedContact#d0028438 user_id:int client_id:long = ImportedContact;
|
||||
|
||||
contactBlocked#561bc879 user_id:int date:int = ContactBlocked;
|
||||
|
||||
contactFound#ea879f95 user_id:int = ContactFound;
|
||||
|
||||
contactSuggested#3de191a1 user_id:int mutual_contacts:int = ContactSuggested;
|
||||
|
||||
contactStatus#aa77b873 user_id:int expires:int = ContactStatus;
|
||||
@ -310,8 +309,6 @@ contacts.importedContacts#ad524315 imported:Vector<ImportedContact> retry_contac
|
||||
contacts.blocked#1c138d15 blocked:Vector<ContactBlocked> users:Vector<User> = contacts.Blocked;
|
||||
contacts.blockedSlice#900802a1 count:int blocked:Vector<ContactBlocked> users:Vector<User> = contacts.Blocked;
|
||||
|
||||
contacts.found#566000e results:Vector<ContactFound> users:Vector<User> = contacts.Found;
|
||||
|
||||
contacts.suggested#5649dcc5 results:Vector<ContactSuggested> users:Vector<User> = contacts.Suggested;
|
||||
|
||||
messages.dialogs#15ba6c40 dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.Dialogs;
|
||||
@ -349,11 +346,11 @@ updateMessageID#4e90bfd6 id:int random_id:long = Update;
|
||||
updateReadMessages#c6649e31 messages:Vector<int> pts:int = Update;
|
||||
updateDeleteMessages#a92bfe26 messages:Vector<int> pts:int = Update;
|
||||
updateRestoreMessages#d15de04d messages:Vector<int> pts:int = Update;
|
||||
updateUserTyping#6baa8508 user_id:int = Update;
|
||||
updateChatUserTyping#3c46cfe6 chat_id:int user_id:int = Update;
|
||||
updateUserTyping#5c486927 user_id:int action:SendMessageAction = Update;
|
||||
updateChatUserTyping#9a65ea1f chat_id:int user_id:int action:SendMessageAction = Update;
|
||||
updateChatParticipants#7761198 participants:ChatParticipants = Update;
|
||||
updateUserStatus#1bfbd823 user_id:int status:UserStatus = Update;
|
||||
updateUserName#da22d9ad user_id:int first_name:string last_name:string = Update;
|
||||
updateUserName#a7332b73 user_id:int first_name:string last_name:string username:string = Update;
|
||||
updateUserPhoto#95313b0c user_id:int date:int photo:UserProfilePhoto previous:Bool = Update;
|
||||
updateContactRegistered#2575bbb9 user_id:int date:int = Update;
|
||||
updateContactLink#51a48a9a user_id:int my_link:contacts.MyLink foreign_link:contacts.ForeignLink = Update;
|
||||
@ -446,19 +443,6 @@ inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation
|
||||
encryptedMessage#ed18c118 random_id:long chat_id:int date:int bytes:bytes file:EncryptedFile = EncryptedMessage;
|
||||
encryptedMessageService#23734b06 random_id:long chat_id:int date:int bytes:bytes = EncryptedMessage;
|
||||
|
||||
decryptedMessageLayer#99a438cf layer:int message:DecryptedMessage = DecryptedMessageLayer;
|
||||
|
||||
decryptedMessage#1f814f1f random_id:long random_bytes:bytes message:string media:DecryptedMessageMedia = DecryptedMessage;
|
||||
decryptedMessageService#aa48327d random_id:long random_bytes:bytes action:DecryptedMessageAction = DecryptedMessage;
|
||||
|
||||
decryptedMessageMediaEmpty#89f5c4a = DecryptedMessageMedia;
|
||||
decryptedMessageMediaPhoto#32798a8c thumb:bytes thumb_w:int thumb_h:int w:int h:int size:int key:bytes iv:bytes = DecryptedMessageMedia;
|
||||
decryptedMessageMediaVideo#524a415d thumb:bytes thumb_w:int thumb_h:int duration:int mime_type:string w:int h:int size:int key:bytes iv:bytes = DecryptedMessageMedia;
|
||||
decryptedMessageMediaGeoPoint#35480a59 lat:double long:double = DecryptedMessageMedia;
|
||||
decryptedMessageMediaContact#588a0a97 phone_number:string first_name:string last_name:string user_id:int = DecryptedMessageMedia;
|
||||
|
||||
decryptedMessageActionSetMessageTTL#a1733aec ttl_seconds:int = DecryptedMessageAction;
|
||||
|
||||
messages.dhConfigNotModified#c0e24635 random:bytes = messages.DhConfig;
|
||||
messages.dhConfig#2c221edd g:int p:bytes version:int random:bytes = messages.DhConfig;
|
||||
|
||||
@ -491,9 +475,6 @@ inputDocument#18798952 id:long access_hash:long = InputDocument;
|
||||
inputAudioFileLocation#74dc404d id:long access_hash:long = InputFileLocation;
|
||||
inputDocumentFileLocation#4e45abe9 id:long access_hash:long = InputFileLocation;
|
||||
|
||||
decryptedMessageMediaDocument#b095434b thumb:bytes thumb_w:int thumb_h:int file_name:string mime_type:string size:int key:bytes iv:bytes = DecryptedMessageMedia;
|
||||
decryptedMessageMediaAudio#57e0a9cb duration:int mime_type:string size:int key:bytes iv:bytes = DecryptedMessageMedia;
|
||||
|
||||
audioEmpty#586988d8 id:long = Audio;
|
||||
audio#c7ac6496 id:long access_hash:long user_id:int date:int duration:int mime_type:string size:int dc_id:int = Audio;
|
||||
|
||||
@ -502,12 +483,6 @@ document#9efc6326 id:long access_hash:long user_id:int date:int file_name:string
|
||||
|
||||
help.support#17c6b5f6 phone_number:string user:User = help.Support;
|
||||
|
||||
decryptedMessageActionReadMessages#c4f40be random_ids:Vector<long> = DecryptedMessageAction;
|
||||
decryptedMessageActionDeleteMessages#65614304 random_ids:Vector<long> = DecryptedMessageAction;
|
||||
decryptedMessageActionScreenshotMessages#8ac1f475 random_ids:Vector<long> = DecryptedMessageAction;
|
||||
decryptedMessageActionFlushHistory#6719e45c = DecryptedMessageAction;
|
||||
decryptedMessageActionNotifyLayer#f3048883 layer:int = DecryptedMessageAction;
|
||||
|
||||
notifyPeer#9fd40bd8 peer:Peer = NotifyPeer;
|
||||
notifyUsers#b4c83b4c = NotifyPeer;
|
||||
notifyChats#c007cec3 = NotifyPeer;
|
||||
@ -516,6 +491,25 @@ notifyAll#74d07c60 = NotifyPeer;
|
||||
updateUserBlocked#80ece81a user_id:int blocked:Bool = Update;
|
||||
updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update;
|
||||
|
||||
auth.sentAppCode#e325edcf phone_registered:Bool phone_code_hash:string send_call_timeout:int is_password:Bool = auth.SentCode;
|
||||
|
||||
sendMessageTypingAction#16bf744e = SendMessageAction;
|
||||
sendMessageCancelAction#fd5ec8f5 = SendMessageAction;
|
||||
sendMessageRecordVideoAction#a187d66f = SendMessageAction;
|
||||
sendMessageUploadVideoAction#92042ff7 = SendMessageAction;
|
||||
sendMessageRecordAudioAction#d52f73f7 = SendMessageAction;
|
||||
sendMessageUploadAudioAction#e6ac8a6f = SendMessageAction;
|
||||
sendMessageUploadPhotoAction#990a3c1a = SendMessageAction;
|
||||
sendMessageUploadDocumentAction#8faee98e = SendMessageAction;
|
||||
sendMessageGeoLocationAction#176f8ba1 = SendMessageAction;
|
||||
sendMessageChooseContactAction#628cbc6f = SendMessageAction;
|
||||
|
||||
contactFound#ea879f95 user_id:int = ContactFound;
|
||||
|
||||
contacts.found#566000e results:Vector<ContactFound> users:Vector<User> = contacts.Found;
|
||||
|
||||
updateServiceNotification#382dd3e4 type:string message:string media:MessageMedia popup:Bool = Update;
|
||||
|
||||
---functions---
|
||||
|
||||
invokeAfterMsg#cb9f372d msg_id:long query:!X = X;
|
||||
@ -532,6 +526,7 @@ auth.resetAuthorizations#9fab0d1a = Bool;
|
||||
auth.sendInvites#771c1d97 phone_numbers:Vector<string> message:string = Bool;
|
||||
auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization;
|
||||
auth.importAuthorization#e3ef9613 id:int bytes:bytes = auth.Authorization;
|
||||
auth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool;
|
||||
|
||||
account.registerDevice#446c712c token_type:int token:string device_model:string system_version:string app_version:string app_sandbox:Bool lang_code:string = Bool;
|
||||
account.unregisterDevice#65c55b40 token_type:int token:string = Bool;
|
||||
@ -548,24 +543,25 @@ users.getFullUser#ca30a5b1 id:InputUser = UserFull;
|
||||
contacts.getStatuses#c4a353ee = Vector<ContactStatus>;
|
||||
contacts.getContacts#22c6aa08 hash:string = contacts.Contacts;
|
||||
contacts.importContacts#da30b32d contacts:Vector<InputContact> replace:Bool = contacts.ImportedContacts;
|
||||
contacts.search#11f812d8 q:string limit:int = contacts.Found;
|
||||
contacts.getSuggested#cd773428 limit:int = contacts.Suggested;
|
||||
contacts.deleteContact#8e953744 id:InputUser = contacts.Link;
|
||||
contacts.deleteContacts#59ab389e id:Vector<InputUser> = Bool;
|
||||
contacts.block#332b49fc id:InputUser = Bool;
|
||||
contacts.unblock#e54100bd id:InputUser = Bool;
|
||||
contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked;
|
||||
contacts.exportCard#84e53737 = Vector<int>;
|
||||
contacts.importCard#4fe196fe export_card:Vector<int> = User;
|
||||
|
||||
messages.getMessages#4222fa74 id:Vector<int> = messages.Messages;
|
||||
messages.getDialogs#eccf1df6 offset:int max_id:int limit:int = messages.Dialogs;
|
||||
messages.getHistory#92a1df2f peer:InputPeer offset:int max_id:int limit:int = messages.Messages;
|
||||
messages.search#7e9f2ab peer:InputPeer q:string filter:MessagesFilter min_date:int max_date:int offset:int max_id:int limit:int = messages.Messages;
|
||||
messages.readHistory#b04f2510 peer:InputPeer max_id:int offset:int = messages.AffectedHistory;
|
||||
messages.readHistory#eed884c6 peer:InputPeer max_id:int offset:int read_contents:Bool = messages.AffectedHistory;
|
||||
messages.deleteHistory#f4f8fb61 peer:InputPeer offset:int = messages.AffectedHistory;
|
||||
messages.deleteMessages#14f2dd0a id:Vector<int> = Vector<int>;
|
||||
messages.restoreMessages#395f9d7e id:Vector<int> = Vector<int>;
|
||||
messages.receivedMessages#28abcb68 max_id:int = Vector<int>;
|
||||
messages.setTyping#719839e9 peer:InputPeer typing:Bool = Bool;
|
||||
messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool;
|
||||
messages.sendMessage#4cde0aab peer:InputPeer message:string random_id:long = messages.SentMessage;
|
||||
messages.sendMedia#a3c85d76 peer:InputPeer media:InputMedia random_id:long = messages.StatedMessage;
|
||||
messages.forwardMessages#514cd10f peer:InputPeer id:Vector<int> = messages.StatedMessages;
|
||||
@ -626,3 +622,12 @@ upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int
|
||||
initConnection#69796de9 api_id:int device_model:string system_version:string app_version:string lang_code:string query:!X = X;
|
||||
|
||||
help.getSupport#9cdf08cd = help.Support;
|
||||
|
||||
auth.sendSms#da9f3e8 phone_number:string phone_code_hash:string = Bool;
|
||||
|
||||
messages.readMessageContents#354b5bc2 id:Vector<int> = Vector<int>;
|
||||
|
||||
account.checkUsername#2714d86c username:string = Bool;
|
||||
account.updateUsername#3e0bdd7c username:string = User;
|
||||
|
||||
contacts.search#11f812d8 q:string limit:int = contacts.Found;
|
||||
|
@ -414,21 +414,27 @@ void ProfileInner::paintEvent(QPaintEvent *e) {
|
||||
_nameText.drawElided(p, _left + st::profilePhotoSize + st::profileNameLeft, top + st::profileNameTop, _width - st::profilePhotoSize - st::profileNameLeft);
|
||||
|
||||
p.setFont(st::profileStatusFont->f);
|
||||
int32 addbyname = 0;
|
||||
if (_peerUser && !_peerUser->username.isEmpty()) {
|
||||
addbyname = st::profileStatusTop + st::linkFont->ascent - (st::profileNameTop + st::profileNameFont->ascent);
|
||||
p.setPen(st::black->p);
|
||||
p.drawText(_left + st::profilePhotoSize + st::profileStatusLeft, top + st::profileStatusTop + st::linkFont->ascent, '@' + _peerUser->username);
|
||||
}
|
||||
p.setPen((_peerUser && _peerUser->onlineTill >= l_time ? st::profileOnlineColor : st::profileOfflineColor)->p);
|
||||
p.drawText(_left + st::profilePhotoSize + st::profileStatusLeft, top + st::profileStatusTop + st::linkFont->ascent, _onlineText);
|
||||
p.drawText(_left + st::profilePhotoSize + st::profileStatusLeft, top + addbyname + st::profileStatusTop + st::linkFont->ascent, _onlineText);
|
||||
if (!_cancelPhoto.isHidden()) {
|
||||
p.drawText(_left + st::profilePhotoSize + st::profilePhoneLeft, _cancelPhoto.y() + st::linkFont->ascent, lang(lng_settings_uploading_photo));
|
||||
p.drawText(_left + st::profilePhotoSize + st::profilePhoneLeft, _cancelPhoto.y() + addbyname + st::linkFont->ascent, lang(lng_settings_uploading_photo));
|
||||
}
|
||||
|
||||
if (!_errorText.isEmpty()) {
|
||||
p.setFont(st::setErrFont->f);
|
||||
p.setPen(st::setErrColor->p);
|
||||
p.drawText(_left + st::profilePhotoSize + st::profilePhoneLeft, top + st::profilePhoneTop + st::profilePhoneFont->ascent, _errorText);
|
||||
p.drawText(_left + st::profilePhotoSize + st::profilePhoneLeft, top + addbyname + st::profilePhoneTop + st::profilePhoneFont->ascent, _errorText);
|
||||
}
|
||||
if (!_phoneText.isEmpty()) {
|
||||
p.setPen(st::black->p);
|
||||
p.setFont(st::linkFont->f);
|
||||
p.drawText(_left + st::profilePhotoSize + st::profilePhoneLeft, top + st::profilePhoneTop + st::profilePhoneFont->ascent, _phoneText);
|
||||
p.drawText(_left + st::profilePhotoSize + st::profilePhoneLeft, top + addbyname + st::profilePhoneTop + st::profilePhoneFont->ascent, _phoneText);
|
||||
}
|
||||
top += st::profilePhotoSize;
|
||||
top += st::profileButtonTop;
|
||||
|
@ -28,6 +28,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
#include "boxes/emojibox.h"
|
||||
#include "boxes/confirmbox.h"
|
||||
#include "boxes/downloadpathbox.h"
|
||||
#include "boxes/usernamebox.h"
|
||||
#include "gui/filedialog.h"
|
||||
|
||||
Slider::Slider(QWidget *parent, const style::slider &st, int32 count, int32 sel) : QWidget(parent),
|
||||
@ -96,14 +97,19 @@ bool scaleIs(DBIScale scale) {
|
||||
}
|
||||
|
||||
SettingsInner::SettingsInner(SettingsWidget *parent) : QWidget(parent),
|
||||
_self(App::self()),
|
||||
|
||||
// profile
|
||||
_nameCache(_self ? _self->name : QString()),
|
||||
_phoneText(_self ? App::formatPhone(_self->phone) : QString()),
|
||||
_nameCache(self() ? self()->name : QString()),
|
||||
_uploadPhoto(this, lang(lng_settings_upload), st::btnSetUpload),
|
||||
_cancelPhoto(this, lang(lng_cancel)), _nameOver(false), _photoOver(false), a_photo(0),
|
||||
|
||||
// contact info
|
||||
_phoneText(self() ? App::formatPhone(self()->phone) : QString()),
|
||||
_usernameText((self() && !self()->username.isEmpty()) ? ('@' + self()->username) : QString()),
|
||||
_phoneLeft(st::linkFont->m.width(lang(lng_settings_phone_number)) + st::linkFont->spacew),
|
||||
_usernameLeft(st::linkFont->m.width(lang(lng_settings_username)) + st::linkFont->spacew),
|
||||
_chooseUsername(this, lang(lng_settings_choose_username)),
|
||||
_changeUsername(this, lang(lng_settings_change_username)),
|
||||
|
||||
// notifications
|
||||
_desktopNotify(this, lang(lng_settings_desktop_notify), cDesktopNotify()),
|
||||
_senderName(this, lang(lng_settings_show_name), cNotifyView() <= dbinvShowName),
|
||||
@ -152,11 +158,11 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : QWidget(parent),
|
||||
_logOut(this, lang(lng_settings_logout), st::btnLogout),
|
||||
_resetDone(false)
|
||||
{
|
||||
if (_self) {
|
||||
if (self()) {
|
||||
_nameText.setText(st::setNameFont, _nameCache, _textNameOptions);
|
||||
PhotoData *selfPhoto = _self->photoId ? App::photo(_self->photoId) : 0;
|
||||
if (selfPhoto && selfPhoto->date) _photoLink = TextLinkPtr(new PhotoLink(selfPhoto, _self));
|
||||
MTP::send(MTPusers_GetFullUser(_self->inputUser), rpcDone(&SettingsInner::gotFullSelf));
|
||||
PhotoData *selfPhoto = self()->photoId ? App::photo(self()->photoId) : 0;
|
||||
if (selfPhoto && selfPhoto->date) _photoLink = TextLinkPtr(new PhotoLink(selfPhoto, self()));
|
||||
MTP::send(MTPusers_GetFullUser(self()->inputUser), rpcDone(&SettingsInner::gotFullSelf));
|
||||
|
||||
connect(App::main(), SIGNAL(peerPhotoChanged(PeerData *)), this, SLOT(peerUpdated(PeerData *)));
|
||||
connect(App::main(), SIGNAL(peerNameChanged(PeerData *, const PeerData::Names &, const PeerData::NameFirstChars &)), this, SLOT(peerUpdated(PeerData *)));
|
||||
@ -169,6 +175,10 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : QWidget(parent),
|
||||
connect(App::app(), SIGNAL(peerPhotoDone(PeerId)), this, SLOT(onPhotoUpdateDone(PeerId)));
|
||||
connect(App::app(), SIGNAL(peerPhotoFail(PeerId)), this, SLOT(onPhotoUpdateFail(PeerId)));
|
||||
|
||||
// contact info
|
||||
connect(&_chooseUsername, SIGNAL(clicked()), this, SLOT(onUsername()));
|
||||
connect(&_changeUsername, SIGNAL(clicked()), this, SLOT(onUsername()));
|
||||
|
||||
// notifications
|
||||
_senderName.setDisabled(!_desktopNotify.checked());
|
||||
_messagePreview.setDisabled(_senderName.disabled() || !_senderName.checked());
|
||||
@ -253,21 +263,21 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : QWidget(parent),
|
||||
}
|
||||
|
||||
void SettingsInner::peerUpdated(PeerData *data) {
|
||||
if (_self && data == _self) {
|
||||
if (_self->photoId) {
|
||||
PhotoData *selfPhoto = App::photo(_self->photoId);
|
||||
if (self() && data == self()) {
|
||||
if (self()->photoId) {
|
||||
PhotoData *selfPhoto = App::photo(self()->photoId);
|
||||
if (selfPhoto->date) {
|
||||
_photoLink = TextLinkPtr(new PhotoLink(selfPhoto, _self));
|
||||
_photoLink = TextLinkPtr(new PhotoLink(selfPhoto, self()));
|
||||
} else {
|
||||
_photoLink = TextLinkPtr();
|
||||
MTP::send(MTPusers_GetFullUser(_self->inputUser), rpcDone(&SettingsInner::gotFullSelf));
|
||||
MTP::send(MTPusers_GetFullUser(self()->inputUser), rpcDone(&SettingsInner::gotFullSelf));
|
||||
}
|
||||
} else {
|
||||
_photoLink = TextLinkPtr();
|
||||
}
|
||||
|
||||
if (_nameCache != _self->name) {
|
||||
_nameCache = _self->name;
|
||||
if (_nameCache != self()->name) {
|
||||
_nameCache = self()->name;
|
||||
_nameText.setText(st::setNameFont, _nameCache, _textNameOptions);
|
||||
update();
|
||||
}
|
||||
@ -280,7 +290,7 @@ void SettingsInner::paintEvent(QPaintEvent *e) {
|
||||
p.setClipRect(e->rect());
|
||||
|
||||
int32 top = 0;
|
||||
if (_self) {
|
||||
if (self()) {
|
||||
// profile
|
||||
top += st::setTop;
|
||||
|
||||
@ -288,14 +298,11 @@ void SettingsInner::paintEvent(QPaintEvent *e) {
|
||||
if (!_cancelPhoto.isHidden()) {
|
||||
p.setFont(st::linkFont->f);
|
||||
p.setPen(st::black->p);
|
||||
p.drawText(_uploadPhoto.x() + st::setPhoneLeft, _cancelPhoto.y() + st::linkFont->ascent, lang(lng_settings_uploading_photo));
|
||||
p.drawText(_uploadPhoto.x() + st::setStatusLeft, _cancelPhoto.y() + st::linkFont->ascent, lang(lng_settings_uploading_photo));
|
||||
}
|
||||
p.setFont(st::setPhoneFont->f);
|
||||
p.setPen(st::setPhoneColor->p);
|
||||
p.drawText(_uploadPhoto.x() + st::setPhoneLeft, top + st::setPhoneTop + st::setPhoneFont->ascent, _phoneText);
|
||||
|
||||
if (_photoLink) {
|
||||
p.drawPixmap(_left, top, _self->photo->pix(st::setPhotoSize));
|
||||
p.drawPixmap(_left, top, self()->photo->pix(st::setPhotoSize));
|
||||
} else {
|
||||
if (a_photo.current() < 1) {
|
||||
p.drawPixmap(QPoint(_left, top), App::sprite(), st::setPhotoImg);
|
||||
@ -306,6 +313,12 @@ void SettingsInner::paintEvent(QPaintEvent *e) {
|
||||
p.setOpacity(1);
|
||||
}
|
||||
}
|
||||
|
||||
p.setFont(st::setStatusFont->f);
|
||||
bool connecting = App::wnd()->connectingVisible();
|
||||
p.setPen((connecting ? st::profileOfflineColor : st::profileOnlineColor)->p);
|
||||
p.drawText(_uploadPhoto.x() + st::setStatusLeft, top + st::setStatusTop + st::setStatusFont->ascent, lang(connecting ? lng_status_connecting : lng_status_online));
|
||||
|
||||
top += st::setPhotoSize;
|
||||
|
||||
if (!_errorText.isEmpty()) {
|
||||
@ -314,6 +327,24 @@ void SettingsInner::paintEvent(QPaintEvent *e) {
|
||||
p.drawText(QRect(_uploadPhoto.x(), _uploadPhoto.y() + _uploadPhoto.height() + st::setLittleSkip, _uploadPhoto.width(), st::setErrFont->height), _errorText, style::al_center);
|
||||
}
|
||||
|
||||
// contact info
|
||||
p.setFont(st::setHeaderFont->f);
|
||||
p.setPen(st::setHeaderColor->p);
|
||||
p.drawText(_left + st::setHeaderLeft, top + st::setHeaderTop + st::setHeaderFont->ascent, lang(lng_settings_section_contact_info));
|
||||
top += st::setHeaderSkip;
|
||||
|
||||
p.setFont(st::linkFont->f);
|
||||
p.setPen(st::black->p);
|
||||
p.drawText(_left, top + st::linkFont->ascent, lang(lng_settings_phone_number));
|
||||
p.drawText(_left + _phoneLeft, top + st::linkFont->ascent, _phoneText);
|
||||
top += st::linkFont->height + st::setLittleSkip;
|
||||
|
||||
p.drawText(_left, top + st::linkFont->ascent, lang(lng_settings_username));
|
||||
if (!_usernameText.isEmpty()) {
|
||||
p.drawText(_left + _usernameLeft, top + st::linkFont->ascent, _usernameText);
|
||||
}
|
||||
top += st::linkFont->height;
|
||||
|
||||
// notifications
|
||||
p.setFont(st::setHeaderFont->f);
|
||||
p.setPen(st::setHeaderColor->p);
|
||||
@ -389,7 +420,7 @@ void SettingsInner::paintEvent(QPaintEvent *e) {
|
||||
p.setFont(st::linkFont->f);
|
||||
}
|
||||
|
||||
if (_self) {
|
||||
if (self()) {
|
||||
// chat options
|
||||
p.setFont(st::setHeaderFont->f);
|
||||
p.setPen(st::setHeaderColor->p);
|
||||
@ -435,7 +466,7 @@ void SettingsInner::paintEvent(QPaintEvent *e) {
|
||||
p.setPen(st::black->p);
|
||||
p.drawText(_left + st::setHeaderLeft, _connectionType.y() + st::linkFont->ascent, _connectionTypeText);
|
||||
|
||||
if (_self && _resetDone) {
|
||||
if (self() && _resetDone) {
|
||||
p.drawText(_resetSessions.x(), _resetSessions.y() + st::linkFont->ascent, lang(lng_settings_reset_done));
|
||||
}
|
||||
}
|
||||
@ -445,13 +476,19 @@ void SettingsInner::resizeEvent(QResizeEvent *e) {
|
||||
|
||||
int32 top = 0;
|
||||
|
||||
if (_self) {
|
||||
if (self()) {
|
||||
// profile
|
||||
top += st::setTop;
|
||||
top += st::setPhotoSize;
|
||||
_uploadPhoto.move(_left + st::setWidth - _uploadPhoto.width(), top - _uploadPhoto.height());
|
||||
_cancelPhoto.move(_left + st::setWidth - _cancelPhoto.width(), top - _uploadPhoto.height() + st::btnSetUpload.textTop + st::btnSetUpload.font->ascent - st::linkFont->ascent);
|
||||
|
||||
// contact info
|
||||
top += st::setHeaderSkip;
|
||||
top += st::linkFont->height + st::setLittleSkip;
|
||||
_chooseUsername.move(_left + _usernameLeft, top);
|
||||
_changeUsername.move(_left + st::setWidth - _changeUsername.width(), top); top += st::linkFont->height;
|
||||
|
||||
// notifications
|
||||
top += st::setHeaderSkip;
|
||||
_desktopNotify.move(_left, top); top += _desktopNotify.height() + st::setLittleSkip;
|
||||
@ -485,7 +522,7 @@ void SettingsInner::resizeEvent(QResizeEvent *e) {
|
||||
}
|
||||
|
||||
// chat options
|
||||
if (_self) {
|
||||
if (self()) {
|
||||
top += st::setHeaderSkip;
|
||||
_viewEmojis.move(_left + st::setWidth - _viewEmojis.width(), top + st::cbDefFlat.textTop);
|
||||
_replaceEmojis.move(_left, top); top += _replaceEmojis.height() + st::setSectionSkip;
|
||||
@ -507,7 +544,7 @@ void SettingsInner::resizeEvent(QResizeEvent *e) {
|
||||
// advanced
|
||||
top += st::setHeaderSkip;
|
||||
_connectionType.move(_left + st::setHeaderLeft + _connectionTypeWidth, top); top += _connectionType.height() + st::setLittleSkip;
|
||||
if (_self) {
|
||||
if (self()) {
|
||||
_resetSessions.move(_left, top); top += _resetSessions.height() + st::setSectionSkip;
|
||||
_logOut.move(_left, top);
|
||||
}
|
||||
@ -520,7 +557,7 @@ void SettingsInner::keyPressEvent(QKeyEvent *e) {
|
||||
}
|
||||
|
||||
void SettingsInner::mouseMoveEvent(QMouseEvent *e) {
|
||||
if (!_self) {
|
||||
if (!self()) {
|
||||
setCursor(style::cur_default);
|
||||
} else {
|
||||
bool nameOver = QRect(_uploadPhoto.x() + st::setNameLeft, st::setTop + st::setNameTop, qMin(_uploadPhoto.width() - int(st::setNameLeft), _nameText.maxWidth()), st::setNameFont->height).contains(e->pos());
|
||||
@ -543,14 +580,14 @@ void SettingsInner::mouseMoveEvent(QMouseEvent *e) {
|
||||
|
||||
void SettingsInner::mousePressEvent(QMouseEvent *e) {
|
||||
mouseMoveEvent(e);
|
||||
if (!_self) {
|
||||
if (!self()) {
|
||||
return;
|
||||
}
|
||||
if (QRect(_uploadPhoto.x() + st::setNameLeft, st::setTop + st::setNameTop, qMin(_uploadPhoto.width() - int(st::setNameLeft), _nameText.maxWidth()), st::setNameFont->height).contains(e->pos())) {
|
||||
App::wnd()->showLayer(new AddContactBox(_self));
|
||||
App::wnd()->showLayer(new AddContactBox(self()));
|
||||
} else if (QRect(_left, st::setTop, st::setPhotoSize, st::setPhotoSize).contains(e->pos())) {
|
||||
if (_photoLink) {
|
||||
App::photo(_self->photoId)->full->load();
|
||||
App::photo(self()->photoId)->full->load();
|
||||
_photoLink->onClick(e->button());
|
||||
} else {
|
||||
onUpdatePhoto();
|
||||
@ -600,22 +637,28 @@ void SettingsInner::updateConnectionType() {
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsInner::gotFullSelf(const MTPUserFull &self) {
|
||||
if (!_self) return;
|
||||
App::feedPhoto(self.c_userFull().vprofile_photo);
|
||||
App::feedUsers(MTP_vector<MTPUser>(QVector<MTPUser>(1, self.c_userFull().vuser)));
|
||||
PhotoData *selfPhoto = _self->photoId ? App::photo(_self->photoId) : 0;
|
||||
void SettingsInner::gotFullSelf(const MTPUserFull &selfFull) {
|
||||
if (!self()) return;
|
||||
App::feedPhoto(selfFull.c_userFull().vprofile_photo);
|
||||
App::feedUsers(MTP_vector<MTPUser>(QVector<MTPUser>(1, selfFull.c_userFull().vuser)));
|
||||
PhotoData *selfPhoto = self()->photoId ? App::photo(self()->photoId) : 0;
|
||||
if (selfPhoto && selfPhoto->date) {
|
||||
_photoLink = TextLinkPtr(new PhotoLink(selfPhoto, _self));
|
||||
_photoLink = TextLinkPtr(new PhotoLink(selfPhoto, self()));
|
||||
} else {
|
||||
_photoLink = TextLinkPtr();
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsInner::usernameChanged() {
|
||||
_usernameText = (self() && !self()->username.isEmpty()) ? ('@' + self()->username) : QString();
|
||||
showAll();
|
||||
update();
|
||||
}
|
||||
|
||||
void SettingsInner::showAll() {
|
||||
// profile
|
||||
if (_self) {
|
||||
if (App::app()->isPhotoUpdating(_self->id)) {
|
||||
if (self()) {
|
||||
if (App::app()->isPhotoUpdating(self()->id)) {
|
||||
_cancelPhoto.show();
|
||||
_uploadPhoto.hide();
|
||||
} else {
|
||||
@ -627,8 +670,22 @@ void SettingsInner::showAll() {
|
||||
_cancelPhoto.hide();
|
||||
}
|
||||
|
||||
// contact info
|
||||
if (self()) {
|
||||
if (self()->username.isEmpty()) {
|
||||
_chooseUsername.show();
|
||||
_changeUsername.hide();
|
||||
} else {
|
||||
_chooseUsername.hide();
|
||||
_changeUsername.show();
|
||||
}
|
||||
} else {
|
||||
_chooseUsername.hide();
|
||||
_changeUsername.hide();
|
||||
}
|
||||
|
||||
// notifications
|
||||
if (_self) {
|
||||
if (self()) {
|
||||
_desktopNotify.show();
|
||||
_senderName.show();
|
||||
_messagePreview.show();
|
||||
@ -673,7 +730,7 @@ void SettingsInner::showAll() {
|
||||
}
|
||||
|
||||
// chat options
|
||||
if (_self) {
|
||||
if (self()) {
|
||||
_replaceEmojis.show();
|
||||
if (cReplaceEmojis()) {
|
||||
_viewEmojis.show();
|
||||
@ -707,7 +764,7 @@ void SettingsInner::showAll() {
|
||||
}
|
||||
|
||||
// advanced
|
||||
if (_self) {
|
||||
if (self()) {
|
||||
if (_resetDone) {
|
||||
_resetSessions.hide();
|
||||
} else {
|
||||
@ -727,8 +784,8 @@ void SettingsInner::saveError(const QString &str) {
|
||||
}
|
||||
|
||||
void SettingsInner::onUpdatePhotoCancel() {
|
||||
if (_self) {
|
||||
App::app()->cancelPhotoUpdate(_self->id);
|
||||
if (self()) {
|
||||
App::app()->cancelPhotoUpdate(self()->id);
|
||||
}
|
||||
showAll();
|
||||
update();
|
||||
@ -759,7 +816,7 @@ void SettingsInner::onUpdatePhoto() {
|
||||
saveError(lang(lng_bad_photo));
|
||||
return;
|
||||
}
|
||||
PhotoCropBox *box = new PhotoCropBox(img, _self->id);
|
||||
PhotoCropBox *box = new PhotoCropBox(img, self()->id);
|
||||
connect(box, SIGNAL(closed()), this, SLOT(onPhotoUpdateStart()));
|
||||
App::wnd()->showLayer(box);
|
||||
}
|
||||
@ -822,6 +879,12 @@ void SettingsInner::onConnectionType() {
|
||||
App::wnd()->showLayer(box);
|
||||
}
|
||||
|
||||
void SettingsInner::onUsername() {
|
||||
UsernameBox *box = new UsernameBox();
|
||||
connect(box, SIGNAL(closed()), this, SLOT(usernameChanged()));
|
||||
App::wnd()->showLayer(box);
|
||||
}
|
||||
|
||||
void SettingsInner::onWorkmodeTray() {
|
||||
if ((!_workmodeTray.checked() || cPlatform() != dbipWindows) && !_workmodeWindow.checked()) {
|
||||
_workmodeWindow.setChecked(true);
|
||||
@ -1120,14 +1183,14 @@ void SettingsInner::onPhotoUpdateStart() {
|
||||
}
|
||||
|
||||
void SettingsInner::onPhotoUpdateFail(PeerId peer) {
|
||||
if (!_self || _self->id != peer) return;
|
||||
if (!self() || self()->id != peer) return;
|
||||
saveError(lang(lng_bad_photo));
|
||||
showAll();
|
||||
update();
|
||||
}
|
||||
|
||||
void SettingsInner::onPhotoUpdateDone(PeerId peer) {
|
||||
if (!_self || _self->id != peer) return;
|
||||
if (!self() || self()->id != peer) return;
|
||||
showAll();
|
||||
update();
|
||||
}
|
||||
@ -1245,6 +1308,10 @@ void SettingsWidget::rpcInvalidate() {
|
||||
_inner.rpcInvalidate();
|
||||
}
|
||||
|
||||
void SettingsWidget::usernameChanged() {
|
||||
_inner.usernameChanged();
|
||||
}
|
||||
|
||||
SettingsWidget::~SettingsWidget() {
|
||||
if (App::wnd()) App::wnd()->noSettings(this);
|
||||
}
|
||||
|
@ -80,6 +80,7 @@ public:
|
||||
|
||||
public slots:
|
||||
|
||||
void usernameChanged();
|
||||
void updateConnectionType();
|
||||
|
||||
void peerUpdated(PeerData *data);
|
||||
@ -93,6 +94,8 @@ public slots:
|
||||
|
||||
void onConnectionType();
|
||||
|
||||
void onUsername();
|
||||
|
||||
void onWorkmodeTray();
|
||||
void onWorkmodeWindow();
|
||||
|
||||
@ -144,13 +147,14 @@ private:
|
||||
|
||||
void setScale(DBIScale newScale);
|
||||
|
||||
UserData *_self;
|
||||
UserData *self() const {
|
||||
return App::self();
|
||||
}
|
||||
int32 _left;
|
||||
|
||||
// profile
|
||||
Text _nameText;
|
||||
QString _nameCache;
|
||||
QString _phoneText;
|
||||
TextLinkPtr _photoLink;
|
||||
FlatButton _uploadPhoto;
|
||||
LinkButton _cancelPhoto;
|
||||
@ -159,6 +163,11 @@ private:
|
||||
|
||||
QString _errorText;
|
||||
|
||||
// contact info
|
||||
QString _phoneText, _usernameText;
|
||||
int32 _phoneLeft, _usernameLeft;
|
||||
LinkButton _chooseUsername, _changeUsername;
|
||||
|
||||
// notifications
|
||||
FlatCheckbox _desktopNotify, _senderName, _messagePreview, _soundNotify;
|
||||
|
||||
@ -236,6 +245,7 @@ public:
|
||||
void updateConnectionType();
|
||||
|
||||
void rpcInvalidate();
|
||||
void usernameChanged();
|
||||
|
||||
~SettingsWidget();
|
||||
|
||||
|
@ -609,6 +609,11 @@ void Window::showConnecting(const QString &text, const QString &reconnect) {
|
||||
resizeEvent(0);
|
||||
fixOrder();
|
||||
}
|
||||
if (settings) settings->update();
|
||||
}
|
||||
|
||||
bool Window::connectingVisible() const {
|
||||
return _connecting && !_connecting->isHidden();
|
||||
}
|
||||
|
||||
void Window::hideConnecting() {
|
||||
@ -616,6 +621,7 @@ void Window::hideConnecting() {
|
||||
_connecting->deleteLater();
|
||||
_connecting = 0;
|
||||
}
|
||||
if (settings) settings->update();
|
||||
}
|
||||
|
||||
void Window::replaceLayer(LayeredWidget *w) {
|
||||
|
@ -172,6 +172,7 @@ public:
|
||||
|
||||
void showConnecting(const QString &text, const QString &reconnect = QString());
|
||||
void hideConnecting();
|
||||
bool connectingVisible() const;
|
||||
|
||||
void hideSettings(bool fast = false);
|
||||
void showPhoto(const PhotoLink *lnk, HistoryItem *item = 0);
|
||||
|
@ -346,6 +346,10 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GeneratedFiles\Debug\moc_usernamebox.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GeneratedFiles\Debug\moc_window.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@ -550,6 +554,10 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GeneratedFiles\Deploy\moc_usernamebox.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GeneratedFiles\Deploy\moc_window.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@ -763,6 +771,10 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GeneratedFiles\Release\moc_usernamebox.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GeneratedFiles\Release\moc_window.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
@ -782,6 +794,7 @@
|
||||
<ClCompile Include="SourceFiles\boxes\newgroupbox.cpp" />
|
||||
<ClCompile Include="SourceFiles\boxes\photocropbox.cpp" />
|
||||
<ClCompile Include="SourceFiles\boxes\photosendbox.cpp" />
|
||||
<ClCompile Include="SourceFiles\boxes\usernamebox.cpp" />
|
||||
<ClCompile Include="SourceFiles\dialogswidget.cpp" />
|
||||
<ClCompile Include="SourceFiles\dropdown.cpp" />
|
||||
<ClCompile Include="SourceFiles\fileuploader.cpp" />
|
||||
@ -1058,6 +1071,20 @@
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -D_WITH_DEBUG -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\OpenSSL-Win32\include" "-I.\..\..\Libraries\libogg-1.3.2\include" "-I.\..\..\Libraries\opus\include" "-I.\..\..\Libraries\opusfile\include" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.3.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.3.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/audio.h"</Command>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="SourceFiles\boxes\usernamebox.h">
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">Moc%27ing usernamebox.h...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/boxes/usernamebox.h" -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -D_WITH_DEBUG -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\OpenSSL-Win32\include" "-I.\..\..\Libraries\libogg-1.3.2\include" "-I.\..\..\Libraries\opus\include" "-I.\..\..\Libraries\opusfile\include" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.3.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.3.1\QtGui"</Command>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Moc%27ing usernamebox.h...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/boxes/usernamebox.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\OpenSSL-Win32\include" "-I.\..\..\Libraries\libogg-1.3.2\include" "-I.\..\..\Libraries\opus\include" "-I.\..\..\Libraries\opusfile\include" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.3.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.3.1\QtGui"</Command>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Moc%27ing usernamebox.h...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/boxes/usernamebox.h" -DAL_LIBTYPE_STATIC -DUNICODE -D_WITH_DEBUG -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\OpenSSL-Win32\include" "-I.\..\..\Libraries\libogg-1.3.2\include" "-I.\..\..\Libraries\opus\include" "-I.\..\..\Libraries\opusfile\include" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.3.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.3.1\QtGui"</Command>
|
||||
</CustomBuild>
|
||||
<ClInclude Include="SourceFiles\config.h" />
|
||||
<CustomBuild Include="SourceFiles\gui\animation.h">
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Moc%27ing animation.h...</Message>
|
||||
|
@ -722,6 +722,18 @@
|
||||
<ClCompile Include="SourceFiles\mtproto\mtpScheme.cpp">
|
||||
<Filter>mtproto</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SourceFiles\boxes\usernamebox.cpp">
|
||||
<Filter>boxes</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GeneratedFiles\Deploy\moc_usernamebox.cpp">
|
||||
<Filter>Generated Files\Deploy</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GeneratedFiles\Debug\moc_usernamebox.cpp">
|
||||
<Filter>Generated Files\Debug</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GeneratedFiles\Release\moc_usernamebox.cpp">
|
||||
<Filter>Generated Files\Release</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="SourceFiles\stdafx.h">
|
||||
@ -972,6 +984,9 @@
|
||||
<CustomBuild Include="SourceFiles\gui\contextmenu.h">
|
||||
<Filter>gui</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="SourceFiles\boxes\usernamebox.h">
|
||||
<Filter>boxes</Filter>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="SourceFiles\art\iconround256.ico" />
|
||||
|
Loading…
Reference in New Issue
Block a user