Remove app.h / facades.h from precompiled header.

This commit is contained in:
John Preston 2019-09-13 09:06:02 +03:00
parent a87529b8c9
commit 0c713a930a
285 changed files with 1086 additions and 679 deletions

View File

@ -7,6 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
class History;
namespace Api {
struct SendOptions {

View File

@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_document.h"
#include "data/data_photo.h"
#include "data/data_channel.h" // ChannelData::addsSignature.
#include "data/data_user.h" // App::peerName(UserData*).
#include "data/data_user.h" // UserData::name
#include "data/data_session.h"
#include "data/data_file_origin.h"
#include "history/history.h"
@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "main/main_session.h"
#include "mainwidget.h"
#include "apiwrap.h"
#include "app.h"
namespace Api {
namespace {
@ -68,9 +69,7 @@ void SendExistingMedia(
sendFlags |= MTPmessages_SendMedia::Flag::f_silent;
}
auto messageFromId = channelPost ? 0 : session->userId();
auto messagePostAuthor = channelPost
? App::peerName(session->user())
: QString();
auto messagePostAuthor = channelPost ? session->user()->name : QString();
auto caption = TextWithEntities{
message.textWithTags.text,

View File

@ -58,6 +58,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "storage/storage_shared_media.h"
#include "storage/storage_user_photos.h"
#include "storage/storage_media_prepare.h"
#include "facades.h"
#include "app.h"
//#include "storage/storage_feed_messages.h" // #feed
namespace {
@ -4514,7 +4516,7 @@ void ApiWrap::forwardMessages(
? UserId(0)
: peerToUser(self->id);
const auto messagePostAuthor = channelPost
? App::peerName(self)
? self->name
: QString();
history->addNewLocalMessage(
newId.msg,
@ -4608,7 +4610,7 @@ void ApiWrap::sendSharedContact(
}
const auto messageFromId = channelPost ? 0 : _session->userId();
const auto messagePostAuthor = channelPost
? App::peerName(_session->user())
? _session->user()->name
: QString();
const auto vcard = QString();
const auto views = 1;
@ -4998,7 +5000,7 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
}
auto messageFromId = channelPost ? 0 : _session->userId();
auto messagePostAuthor = channelPost
? App::peerName(_session->user())
? _session->user()->name
: QString();
if (action.options.scheduled) {
flags |= MTPDmessage::Flag::f_from_scheduled;
@ -5136,7 +5138,7 @@ void ApiWrap::sendInlineResult(
const auto messageFromId = channelPost ? 0 : _session->userId();
const auto messagePostAuthor = channelPost
? App::peerName(_session->user())
? _session->user()->name
: QString();
_session->data().registerMessageRandomId(randomId, newId);

View File

@ -105,23 +105,6 @@ namespace App {
return result;
}
MainWindow *wnd() {
return (Core::IsAppLaunched() && Core::App().activeWindow())
? Core::App().activeWindow()->widget().get()
: nullptr;
}
MainWidget *main() {
if (auto window = wnd()) {
return window->mainWidget();
}
return nullptr;
}
QString peerName(const PeerData *peer, bool forDialogs) {
return peer ? ((forDialogs && peer->isUser() && !peer->asUser()->nameOrPhone.isEmpty()) ? peer->asUser()->nameOrPhone : peer->name) : tr::lng_deleted(tr::now);
}
void prepareCorners(RoundCorners index, int32 radius, const QBrush &brush, const style::color *shadow = nullptr, QImage *cors = nullptr) {
Expects(::corners.size() > index);

View File

@ -18,10 +18,16 @@ namespace HistoryView {
class Element;
} // namespace HistoryView
namespace Media {
namespace Clip {
class Reader;
} // namespace Clip
} // namespace Media
using HistoryItemsMap = base::flat_set<not_null<HistoryItem*>>;
using GifItems = QHash<Media::Clip::Reader*, HistoryItem*>;
enum RoundCorners {
enum RoundCorners : int {
SmallMaskCorners = 0x00, // for images
LargeMaskCorners,
@ -60,13 +66,8 @@ enum RoundCorners {
};
namespace App {
MainWindow *wnd();
MainWidget *main();
QString formatPhone(QString phone);
[[nodiscard]] QString peerName(const PeerData *peer, bool forDialogs = false);
void hoveredItem(HistoryView::Element *item);
HistoryView::Element *hoveredItem();
void pressedItem(HistoryView::Element *item);

View File

@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/timer.h"
#include "mainwidget.h"
#include "mainwindow.h"
#include "app.h"
struct AbstractBox::LoadingProgress {
LoadingProgress(
@ -596,3 +597,39 @@ void BoxContentDivider::paintEvent(QPaintEvent *e) {
auto dividerFillBottom = myrtlrect(0, height() - st::profileDividerBottom.height(), width(), st::profileDividerBottom.height());
st::profileDividerBottom.fill(p, dividerFillBottom);
}
namespace Ui {
namespace internal {
void showBox(
object_ptr<BoxContent> content,
LayerOptions options,
anim::type animated) {
if (auto w = App::wnd()) {
w->ui_showBox(std::move(content), options, animated);
}
}
} // namespace internal
void hideLayer(anim::type animated) {
if (auto w = App::wnd()) {
w->ui_showBox(
{ nullptr },
LayerOption::CloseOther,
animated);
}
}
void hideSettingsAndLayer(anim::type animated) {
if (auto w = App::wnd()) {
w->ui_hideSettingsAndLayer(animated);
}
}
bool isLayerShown() {
if (auto w = App::wnd()) return w->ui_isLayerShown();
return false;
}
} // namespace Ui

View File

@ -9,6 +9,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/layer_widget.h"
#include "base/unique_qptr.h"
#include "base/flags.h"
#include "ui/effects/animation_value.h"
#include "ui/rp_widget.h"
namespace style {
@ -427,3 +429,30 @@ private:
QPointer<BoxContent> _value;
};
// Legacy global method.
namespace Ui {
namespace internal {
void showBox(
object_ptr<BoxContent> content,
LayerOptions options,
anim::type animated);
} // namespace internal
template <typename BoxType>
QPointer<BoxType> show(
object_ptr<BoxType> content,
LayerOptions options = LayerOption::CloseOther,
anim::type animated = anim::type::normal) {
auto result = QPointer<BoxType>(content.data());
internal::showBox(std::move(content), options, animated);
return result;
}
void hideLayer(anim::type animated = anim::type::normal);
void hideSettingsAndLayer(anim::type animated = anim::type::normal);
bool isLayerShown();
} // namespace Ui

View File

@ -40,6 +40,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "apiwrap.h"
#include "observer_peer.h"
#include "main/main_session.h"
#include "facades.h"
#include <QtGui/QGuiApplication>
#include <QtGui/QClipboard>

View File

@ -11,6 +11,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mtproto/sender.h"
#include "styles/style_widgets.h"
#include <QtCore/QTimer>
class ConfirmBox;
class PeerListBox;

View File

@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "storage/localstorage.h"
#include "mainwindow.h"
#include "ui/widgets/checkbox.h"
#include "facades.h"
#include "styles/style_boxes.h"
AutoLockBox::AutoLockBox(QWidget*, not_null<Main::Session*> session)

View File

@ -16,6 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_session.h"
#include "boxes/background_preview_box.h"
#include "boxes/confirm_box.h"
#include "app.h"
#include "styles/style_overview.h"
#include "styles/style_boxes.h"
#include "styles/style_chat_helpers.h"

View File

@ -24,6 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/unixtime.h"
#include "boxes/confirm_box.h"
#include "boxes/background_preview_box.h"
#include "app.h"
#include "styles/style_history.h"
#include "styles/style_boxes.h"

View File

@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "main/main_session.h"
#include "data/data_session.h"
#include "data/data_user.h"
#include "app.h"
#include "styles/style_boxes.h"
namespace {

View File

@ -34,6 +34,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/unixtime.h"
#include "main/main_session.h"
#include "observer_peer.h"
#include "facades.h"
#include "app.h"
#include <QtGui/QGuiApplication>
#include <QtGui/QClipboard>
@ -907,7 +909,9 @@ void ConfirmInviteBox::prepare() {
for (const auto user : _participants) {
auto name = new Ui::FlatLabel(this, st::confirmInviteUserName);
name->resizeToWidth(st::confirmInviteUserPhotoSize + padding);
name->setText(user->firstName.isEmpty() ? App::peerName(user) : user->firstName);
name->setText(user->firstName.isEmpty()
? user->name
: user->firstName);
name->moveToLeft(left + (padding / 2), st::confirmInviteUserNameTop);
left += _userWidth;
}

View File

@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "platform/platform_info.h" // Platform::SystemVersionPretty
#include "mainwidget.h"
#include "numbers.h"
#include "app.h"
#include "lang/lang_keys.h"
namespace {

View File

@ -24,6 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/effects/animations.h"
#include "ui/effects/radial_animation.h"
#include "ui/text_options.h"
#include "facades.h"
#include "styles/style_boxes.h"
#include "styles/style_chat_helpers.h"
#include "styles/style_info.h"

View File

@ -23,6 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/view/history_view_schedule_box.h"
#include "settings/settings_common.h"
#include "base/unique_qptr.h"
#include "facades.h"
#include "styles/style_boxes.h"
#include "styles/style_settings.h"

View File

@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/checkbox.h"
#include "ui/widgets/buttons.h"
#include "platform/platform_specific.h"
#include "facades.h"
#include "styles/style_boxes.h"
DownloadPathBox::DownloadPathBox(QWidget *parent)

View File

@ -37,6 +37,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/window_session_controller.h"
#include "ui/widgets/checkbox.h"
#include "confirm_box.h"
#include "facades.h"
#include "app.h"
#include <QtCore/QMimeData>

View File

@ -10,7 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/abstract_box.h"
#include "storage/storage_media_prepare.h"
#include "ui/wrap/slide_wrap.h"
#include <rpl/event_stream.h>
#include "media/clip/media_clip_reader.h"
namespace ChatHelpers {
class TabbedPanel;

View File

@ -8,11 +8,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/edit_color_box.h"
#include "lang/lang_keys.h"
#include "styles/style_boxes.h"
#include "ui/widgets/shadow.h"
#include "platform/platform_info.h"
#include "styles/style_mediaview.h"
#include "ui/widgets/input_fields.h"
#include "platform/platform_info.h"
#include "app.h"
#include "styles/style_boxes.h"
#include "styles/style_mediaview.h"
class EditColorBox::Picker : public TWidget {
public:

View File

@ -11,10 +11,11 @@ Copyright (C) 2017, Nicholas Guriev <guriev-ns@ya.ru>
#include "main/main_session.h"
#include "data/data_session.h"
#include "data/data_peer.h"
#include "styles/style_boxes.h"
#include "ui/special_buttons.h"
#include "ui/widgets/checkbox.h"
#include "ui/widgets/labels.h"
#include "app.h"
#include "styles/style_boxes.h"
namespace {
@ -44,7 +45,7 @@ void MuteSettingsBox::prepare() {
icon->moveToLeft(st::boxPadding.left(), y);
object_ptr<Ui::FlatLabel> title(this, st::muteChatTitle);
title->setText(App::peerName(_peer, true));
title->setText(_peer->name);
title->moveToLeft(
st::boxPadding.left() + st::muteChatTitleLeft,
y + (icon->height() / 2) - (title->height() / 2));

View File

@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/wrap/fade_wrap.h"
#include "passport/passport_encryption.h"
#include "passport/passport_panel_edit_contact.h"
#include "facades.h"
#include "styles/style_boxes.h"
#include "styles/style_passport.h"

View File

@ -22,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/history.h"
#include "dialogs/dialogs_main_list.h"
#include "window/window_session_controller.h"
#include "facades.h"
#include "styles/style_boxes.h"
#include "styles/style_profile.h"
@ -456,7 +457,7 @@ void AddBotToGroupBoxController::shareBotGame(not_null<PeerData*> chat) {
});
auto confirmText = [chat] {
if (chat->isUser()) {
return tr::lng_bot_sure_share_game(tr::now, lt_user, App::peerName(chat));
return tr::lng_bot_sure_share_game(tr::now, lt_user, chat->name);
}
return tr::lng_bot_sure_share_game_group(tr::now, lt_group, chat->name);
}();

View File

@ -28,6 +28,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
//
//};
class History;
namespace Window {
class SessionNavigation;
} // namespace Window

View File

@ -24,6 +24,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/window_session_controller.h"
#include "apiwrap.h"
#include "observer_peer.h"
#include "facades.h"
#include "app.h"
namespace {
@ -775,7 +777,7 @@ void AddSpecialBoxController::kickUser(
: tr::lng_profile_sure_kick_channel)(
tr::now,
lt_user,
App::peerName(user));
user->name);
_editBox = Ui::show(
Box<ConfirmBox>(text, kickUserSure),
LayerOption::KeepOther);

View File

@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/toast/toast.h"
#include "main/main_session.h"
#include "apiwrap.h"
#include "app.h"
#include "styles/style_boxes.h"
#include "styles/style_info.h"

View File

@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/confirm_box.h"
#include "boxes/add_contact_box.h"
#include "apiwrap.h"
#include "facades.h"
#include "main/main_session.h"
#include "styles/style_boxes.h"
#include "styles/style_info.h"

View File

@ -35,6 +35,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/core_cloud_password.h"
#include "base/unixtime.h"
#include "apiwrap.h"
#include "facades.h"
#include "main/main_session.h"
#include "styles/style_boxes.h"
#include "styles/style_info.h"
@ -160,7 +161,7 @@ EditParticipantBox::Inner::Inner(
_userPhoto->setPointerCursor(false);
_userName.setText(
st::rightsNameStyle,
App::peerName(_user),
_user->name,
Ui::NameTextOptions());
}

View File

@ -27,6 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/popup_menu.h"
#include "window/window_session_controller.h"
#include "history/history.h"
#include "facades.h"
namespace {
@ -1817,7 +1818,7 @@ void ParticipantsBoxController::refreshCustomStatus(
row->setCustomStatus(tr::lng_channel_admin_status_promoted_by(
tr::now,
lt_user,
App::peerName(by)));
by->name));
} else {
if (_additional.isCreator(user)) {
row->setCustomStatus(
@ -1834,7 +1835,7 @@ void ParticipantsBoxController::refreshCustomStatus(
: tr::lng_channel_banned_status_restricted_by)(
tr::now,
lt_user,
by ? App::peerName(by) : "Unknown"));
by ? by->name : "Unknown"));
}
}

View File

@ -43,9 +43,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/wrap/slide_wrap.h"
#include "ui/wrap/vertical_layout.h"
#include "window/window_session_controller.h"
#include <rpl/flatten_latest.h>
#include <rpl/range.h>
#include "info/profile/info_profile_icon.h"
#include "app.h"
#include "facades.h"
namespace {

View File

@ -22,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/peers/edit_peer_info_box.h"
#include "window/window_session_controller.h"
#include "mainwindow.h"
#include "app.h"
#include "styles/style_boxes.h"
#include "styles/style_info.h"

View File

@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lang/lang_keys.h"
#include "ui/widgets/buttons.h"
#include "app.h"
#include "styles/style_boxes.h"
PhotoCropBox::PhotoCropBox(

View File

@ -34,6 +34,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "api/api_common.h"
#include "window/window_session_controller.h"
#include "layout.h"
#include "facades.h"
#include "app.h"
#include "styles/style_history.h"
#include "styles/style_boxes.h"
#include "styles/style_chat_helpers.h"

View File

@ -54,7 +54,7 @@ public:
Fn<void(PeerData *peer, bool selected)> callback);
void peerUnselected(not_null<PeerData*> peer);
QVector<PeerData*> selected() const;
std::vector<not_null<PeerData*>> selected() const;
bool hasSelected() const;
void peopleReceived(
@ -1064,8 +1064,8 @@ void ShareBox::Inner::refresh() {
update();
}
QVector<PeerData*> ShareBox::Inner::selected() const {
auto result = QVector<PeerData*>();
std::vector<not_null<PeerData*>> ShareBox::Inner::selected() const {
auto result = std::vector<not_null<PeerData*>>();
result.reserve(_dataMap.size());
for (const auto &[peer, chat] : _dataMap) {
if (chat->checkbox.checked()) {

View File

@ -56,7 +56,7 @@ class ShareBox : public BoxContent, public RPCSender {
public:
using CopyCallback = Fn<void()>;
using SubmitCallback = Fn<void(
QVector<PeerData*>&&,
std::vector<not_null<PeerData*>>&&,
TextWithTags&&,
Api::SendOptions)>;
using FilterCallback = Fn<bool(PeerData*)>;

View File

@ -29,6 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "apiwrap.h"
#include "mainwidget.h"
#include "mainwindow.h"
#include "app.h"
#include "styles/style_boxes.h"
#include "styles/style_chat_helpers.h"

View File

@ -32,6 +32,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/image/image.h"
#include "window/window_session_controller.h"
#include "main/main_session.h"
#include "facades.h"
#include "app.h"
#include "styles/style_boxes.h"
#include "styles/style_chat_helpers.h"

View File

@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lang/lang_keys.h"
#include "main/main_session.h"
#include "apiwrap.h"
#include "app.h"
#include "styles/style_boxes.h"
void UrlAuthBox::Activate(
@ -176,7 +177,7 @@ not_null<Ui::RpWidget*> UrlAuthBox::setupContent(
textcmdStartSemibold() + domain + textcmdStopSemibold(),
lt_user,
(textcmdStartSemibold()
+ App::peerName(session->user())
+ session->user()->name
+ textcmdStopSemibold())));
const auto allow = bot
? addCheckbox(tr::lng_url_auth_allow_messages(

View File

@ -21,6 +21,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_session.h"
#include "data/data_media_types.h"
#include "data/data_user.h"
#include "facades.h"
#include "app.h"
namespace Calls {
namespace {

View File

@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "calls/calls_panel.h"
#include "data/data_user.h"
#include "data/data_session.h"
#include "facades.h"
#ifdef slots
#undef slots
@ -871,11 +872,11 @@ void Call::setFailedQueued(int error) {
void Call::handleRequestError(const RPCError &error) {
if (error.type() == qstr("USER_PRIVACY_RESTRICTED")) {
Ui::show(Box<InformBox>(tr::lng_call_error_not_available(tr::now, lt_user, App::peerName(_user))));
Ui::show(Box<InformBox>(tr::lng_call_error_not_available(tr::now, lt_user, _user->name)));
} else if (error.type() == qstr("PARTICIPANT_VERSION_OUTDATED")) {
Ui::show(Box<InformBox>(tr::lng_call_error_outdated(tr::now, lt_user, App::peerName(_user))));
Ui::show(Box<InformBox>(tr::lng_call_error_outdated(tr::now, lt_user, _user->name)));
} else if (error.type() == qstr("CALL_PROTOCOL_LAYER_INVALID")) {
Ui::show(Box<InformBox>(Lang::Hard::CallErrorIncompatible().replace("{user}", App::peerName(_user))));
Ui::show(Box<InformBox>(Lang::Hard::CallErrorIncompatible().replace("{user}", _user->name)));
}
finish(FinishType::Failed);
}
@ -885,7 +886,7 @@ void Call::handleControllerError(int error) {
Ui::show(Box<InformBox>(
Lang::Hard::CallErrorIncompatible().replace(
"{user}",
App::peerName(_user))));
_user->name)));
} else if (error == tgvoip::ERROR_AUDIO_IO) {
Ui::show(Box<InformBox>(tr::lng_call_error_audio_io(tr::now)));
}

View File

@ -22,6 +22,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/unixtime.h"
#include "mainwidget.h"
#include "boxes/rate_call_box.h"
#include "facades.h"
#include "app.h"
namespace Calls {
namespace {
@ -41,7 +43,7 @@ void Instance::startOutgoingCall(not_null<UserData*> user) {
if (user->callsStatus() == UserData::CallsStatus::Private) {
// Request full user once more to refresh the setting in case it was changed.
_session->api().requestFullPeer(user);
Ui::show(Box<InformBox>(tr::lng_call_error_not_available(tr::now, lt_user, App::peerName(user))));
Ui::show(Box<InformBox>(tr::lng_call_error_not_available(tr::now, lt_user, user->name)));
return;
}
requestMicrophonePermissionOrFail(crl::guard(this, [=] {

View File

@ -30,6 +30,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "platform/platform_specific.h"
#include "window/main_window.h"
#include "layout.h"
#include "app.h"
#include <QtWidgets/QDesktopWidget>
#include <QtWidgets/QApplication>
@ -357,7 +358,7 @@ void Panel::initControls() {
if (!_call || update.peer != _call->user()) {
return;
}
_name->setText(App::peerName(_call->user()));
_name->setText(_call->user()->name);
updateControlsGeometry();
}));
_updateDurationTimer.setCallback([this] {
@ -415,7 +416,7 @@ void Panel::reinitControls() {
st::callPanelSignalBars,
[=] { rtlupdate(signalBarsRect()); });
_name->setText(App::peerName(_call->user()));
_name->setText(_call->user()->name);
updateStatusText(_call->state());
}
@ -815,7 +816,7 @@ void Panel::leaveToChildEvent(QEvent *e, QWidget *child) {
}
QString Panel::tooltipText() const {
return tr::lng_call_fingerprint_tooltip(tr::now, lt_user, App::peerName(_user));
return tr::lng_call_fingerprint_tooltip(tr::now, lt_user, _user->name);
}
QPoint Panel::tooltipPos() const {

View File

@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/abstract_box.h"
#include "base/timer.h"
#include "layout.h"
#include "app.h"
#include "styles/style_calls.h"
#include "styles/style_boxes.h"
@ -133,10 +134,10 @@ void TopBar::updateInfoLabels() {
}
void TopBar::setInfoLabels() {
if (auto call = _call.get()) {
auto user = call->user();
auto fullName = App::peerName(user);
auto shortName = user->firstName;
if (const auto call = _call.get()) {
const auto user = call->user();
const auto fullName = user->name;
const auto shortName = user->firstName;
_fullInfoLabel->setText(fullName.toUpper());
_shortInfoLabel->setText(shortName.toUpper());
}

View File

@ -12,6 +12,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_user.h"
#include "data/data_session.h"
#include "main/main_session.h"
#include "facades.h"
#include "app.h"
#include "styles/style_widgets.h"
#include "styles/style_history.h"

View File

@ -16,6 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "emoji_suggestions_helper.h"
#include "window/window_session_controller.h"
#include "facades.h"
#include "app.h"
#include "styles/style_chat_helpers.h"
namespace ChatHelpers {

View File

@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/application.h"
#include "main/main_account.h"
#include "mainwidget.h"
#include "app.h"
#include "styles/style_boxes.h"
#include "styles/style_chat_helpers.h"

View File

@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/application.h"
#include "core/event_filter.h"
#include "main/main_session.h"
#include "app.h"
#include "styles/style_chat_helpers.h"
#include <QtWidgets/QApplication>

View File

@ -21,6 +21,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "main/main_session.h"
#include "chat_helpers/stickers.h"
#include "base/unixtime.h"
#include "facades.h"
#include "app.h"
#include "styles/style_history.h"
#include "styles/style_widgets.h"
#include "styles/style_chat_helpers.h"

View File

@ -24,6 +24,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mainwindow.h"
#include "window/window_session_controller.h"
#include "history/view/history_view_cursor_state.h"
#include "facades.h"
#include "app.h"
#include <QtWidgets/QApplication>

View File

@ -10,6 +10,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "chat_helpers/tabbed_selector.h"
#include "base/timer.h"
#include "inline_bots/inline_bot_layout_item.h"
#include "app.h"
#include <QtCore/QTimer>
namespace InlineBots {
namespace Layout {

View File

@ -22,6 +22,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/unixtime.h"
#include "lottie/lottie_single_player.h"
#include "lottie/lottie_multi_player.h"
#include "facades.h"
#include "app.h"
#include "styles/style_chat_helpers.h"
namespace Stickers {

View File

@ -17,6 +17,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_session.h"
#include "data/data_document.h"
#include "apiwrap.h"
#include "app.h"
#include "facades.h"
#include "styles/style_history.h"
#include <QtCore/QBuffer>

View File

@ -31,6 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "main/main_session.h"
#include "observer_peer.h"
#include "apiwrap.h"
#include "app.h"
#include "styles/style_chat_helpers.h"
#include "styles/style_window.h"

View File

@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mainwindow.h"
#include "core/application.h"
#include "core/qt_signal_producer.h"
#include "app.h"
#include "styles/style_chat_helpers.h"
namespace ChatHelpers {

View File

@ -61,6 +61,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/confirm_phone_box.h"
#include "boxes/confirm_box.h"
#include "boxes/share_box.h"
#include "facades.h"
#include "app.h"
#include <QtWidgets/QDesktopWidget>
#include <QtCore/QMimeDatabase>

View File

@ -23,6 +23,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/tooltip.h"
#include "data/data_user.h"
#include "data/data_session.h"
#include "facades.h"
#include "app.h"
#include <QtGui/QDesktopServices>
#include <QtGui/QGuiApplication>
@ -184,8 +186,8 @@ auto MentionNameClickHandler::getTextEntity() const -> TextEntity {
}
QString MentionNameClickHandler::tooltip() const {
if (auto user = Auth().data().userLoaded(_userId)) {
auto name = App::peerName(user);
if (const auto user = Auth().data().userLoaded(_userId)) {
const auto name = user->name;
if (name != _text) {
return name;
}

View File

@ -14,11 +14,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/main_window.h"
#include "platform/platform_specific.h"
#include "base/zlib_help.h"
#include "app.h"
#include <QtWidgets/QFileDialog>
#include <QtGui/QScreen>
#include <QtGui/QDesktopServices>
#include <QtCore/QStandardPaths>
#include <QtCore/QTimer>
namespace {

View File

@ -28,6 +28,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mainwidget.h"
#include "main/main_session.h"
#include "apiwrap.h"
#include "app.h"
namespace Core {
namespace {

View File

@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/sandbox.h"
#include "platform/platform_specific.h"
#include "facades.h"
namespace Core {
namespace {

View File

@ -24,6 +24,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/qthelp_url.h"
#include "base/qthelp_regex.h"
#include "ui/effects/animations.h"
#include "facades.h"
#include "app.h"
#include <QtGui/QScreen>

View File

@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "media/player/media_player_instance.h"
#include "platform/platform_info.h"
#include "base/parse_helper.h"
#include "facades.h"
#include <QtWidgets/QShortcut>
#include <QtCore/QJsonDocument>

View File

@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "info/settings/info_settings_widget.h"
#include "window/window_session_controller.h"
#include "settings/settings_intro.h"
#include "app.h"
#include <QtCore/QJsonDocument>
#include <QtCore/QJsonObject>

View File

@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/application.h" // Core::App().showTheme.
#include "lang/lang_keys.h"
#include "apiwrap.h"
#include "app.h"
#include "mainwindow.h"
namespace Data {

View File

@ -33,6 +33,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mainwindow.h"
#include "core/application.h"
#include "lottie/lottie_animation.h"
#include "facades.h"
#include "app.h"
namespace {

View File

@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#pragma once
#include "base/flags.h"
#include "base/binary_guard.h"
#include "data/data_types.h"
#include "ui/image/image.h"

View File

@ -15,6 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lottie/lottie_animation.h"
#include "window/themes/window_theme_preview.h"
#include "main/main_session.h"
#include "app.h"
#include <QtCore/QBuffer>
#include <QtGui/QImageReader>

View File

@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#pragma once
#include "ui/image/image.h"
#include "base/binary_guard.h"
class DocumentData;

View File

@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "observer_peer.h"
#include "apiwrap.h"
#include "mainwidget.h"
#include "facades.h"
#include "styles/style_dialogs.h"
namespace Data {

View File

@ -40,6 +40,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lang/lang_keys.h"
#include "layout.h"
#include "storage/file_upload.h"
#include "app.h"
namespace Data {
namespace {

View File

@ -28,6 +28,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/history.h"
#include "history/view/history_view_element.h"
#include "history/history_item.h"
#include "facades.h"
#include "app.h"
namespace {

View File

@ -13,6 +13,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/image/image_source.h"
#include "mainwidget.h"
#include "core/application.h"
#include "facades.h"
#include "app.h"
PhotoData::PhotoData(not_null<Data::Session*> owner, PhotoId id)
: id(id)

View File

@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mainwidget.h"
#include "main/main_session.h"
#include "apiwrap.h"
#include "app.h"
uint64 PtsWaiter::ptsKey(PtsSkippedQueue queue, int32 pts) {
return _queue.insert(uint64(uint32(pts)) << 32 | (++_skippedKey), queue).key();

View File

@ -48,6 +48,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_scheduled_messages.h"
#include "data/data_cloud_themes.h"
#include "base/unixtime.h"
#include "facades.h"
#include "app.h"
#include "styles/style_boxes.h" // st::backgroundSize
namespace Data {

View File

@ -11,6 +11,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/weak_ptr.h"
#include "data/data_sparse_ids.h"
class History;
std::optional<Storage::SharedMediaType> SharedMediaOverviewType(
Storage::SharedMediaType type);
void SharedMediaShowOverview(

View File

@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/text_options.h"
#include "apiwrap.h"
#include "lang/lang_keys.h"
#include "facades.h"
namespace {

View File

@ -15,6 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "main/main_session.h"
#include "history/history_item.h"
#include "history/history.h"
#include "app.h"
#include "styles/style_dialogs.h" // st::dialogsTextWidthMin
namespace Dialogs {

View File

@ -41,6 +41,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/multi_select.h"
#include "ui/empty_userpic.h"
#include "ui/unread_badge.h"
#include "facades.h"
#include "styles/style_dialogs.h"
#include "styles/style_chat_helpers.h"
#include "styles/style_window.h"
@ -2273,12 +2274,7 @@ void InnerWidget::refreshSearchInChatLabel() {
dialog,
Ui::DialogTextOptions());
}
const auto from = [&] {
if (const auto from = _searchFromUser) {
return App::peerName(from);
}
return QString();
}();
const auto from = _searchFromUser ? _searchFromUser->name : QString();
if (!from.isEmpty()) {
const auto fromUserText = tr::lng_dlg_search_from(
tr::now,

View File

@ -36,6 +36,7 @@ namespace Dialogs {
class Row;
class FakeRow;
class IndexedList;
enum class Mode;
struct ChosenRow {
Key key;

View File

@ -27,6 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_user.h"
#include "data/data_folder.h"
#include "data/data_peer_values.h"
#include "app.h"
namespace Dialogs {
namespace Layout {

View File

@ -38,7 +38,7 @@ QString ComposeFolderListEntryText(not_null<Data::Folder*> folder) {
list.size() - (throwAwayLastName ? 1 : 0)
);
const auto wrapName = [](not_null<History*> history) {
const auto name = TextUtilities::Clean(App::peerName(history->peer));
const auto name = TextUtilities::Clean(history->peer->name);
return (history->unreadCount() > 0)
? (textcmdStartSemibold()
+ textcmdLink(1, name)

View File

@ -38,6 +38,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_chat.h"
#include "data/data_user.h"
#include "data/data_folder.h"
#include "facades.h"
#include "app.h"
#include "styles/style_dialogs.h"
#include "styles/style_history.h"
#include "styles/style_info.h"

View File

@ -40,6 +40,7 @@ class ConnectionState;
namespace Dialogs {
enum class Mode;
struct RowDescriptor;
class Row;
class FakeRow;

View File

@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "main/main_session.h"
#include "data/data_session.h"
#include "base/unixtime.h"
#include "facades.h"
#include "styles/style_export.h"
#include "styles/style_boxes.h"

View File

@ -10,6 +10,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "export/export_settings.h"
#include "ui/rp_widget.h"
class BoxContent;
namespace Ui {
class VerticalLayout;
class Checkbox;

View File

@ -182,38 +182,6 @@ void activateClickHandler(ClickHandlerPtr handler, Qt::MouseButton button) {
} // namespace App
namespace Ui {
namespace internal {
void showBox(
object_ptr<BoxContent> content,
LayerOptions options,
anim::type animated) {
if (auto w = App::wnd()) {
w->ui_showBox(std::move(content), options, animated);
}
}
} // namespace internal
void hideLayer(anim::type animated) {
if (auto w = App::wnd()) {
w->ui_showBox(
{ nullptr },
LayerOption::CloseOther,
animated);
}
}
void hideSettingsAndLayer(anim::type animated) {
if (auto w = App::wnd()) {
w->ui_hideSettingsAndLayer(animated);
}
}
bool isLayerShown() {
if (auto w = App::wnd()) return w->ui_isLayerShown();
return false;
}
void showPeerProfile(const PeerId &peer) {
if (const auto window = App::wnd()) {

View File

@ -9,8 +9,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/type_traits.h"
#include "base/observer.h"
#include "ui/effects/animation_value.h"
class BoxContent;
class History;
namespace Data {
struct FileOrigin;
@ -78,38 +79,9 @@ void activateClickHandler(ClickHandlerPtr handler, Qt::MouseButton button);
} // namespace App
enum class LayerOption {
CloseOther = (1 << 0),
KeepOther = (1 << 1),
ShowAfterOther = (1 << 2),
};
using LayerOptions = base::flags<LayerOption>;
inline constexpr auto is_flag_type(LayerOption) { return true; };
namespace Ui {
namespace internal {
void showBox(
object_ptr<BoxContent> content,
LayerOptions options,
anim::type animated);
} // namespace internal
template <typename BoxType>
QPointer<BoxType> show(
object_ptr<BoxType> content,
LayerOptions options = LayerOption::CloseOther,
anim::type animated = anim::type::normal) {
auto result = QPointer<BoxType>(content.data());
internal::showBox(std::move(content), options, animated);
return result;
}
void hideLayer(anim::type animated = anim::type::normal);
void hideSettingsAndLayer(anim::type animated = anim::type::normal);
bool isLayerShown();
// Legacy global methods.
void showPeerProfile(const PeerId &peer);
void showPeerProfile(const PeerData *peer);

View File

@ -42,6 +42,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_media_types.h"
#include "data/data_channel.h"
#include "data/data_user.h"
#include "facades.h"
#include "app.h"
#include <QtWidgets/QApplication>
#include <QtGui/QClipboard>

View File

@ -23,6 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/application.h"
#include "mainwindow.h" // App::wnd()->sessionController
#include "main/main_session.h"
#include "facades.h"
namespace AdminLog {
namespace {
@ -241,7 +242,7 @@ TextWithEntities GenerateBannedChangeText(
auto GenerateUserString(MTPint userId) {
// User name in "User name (@username)" format with entities.
auto user = Auth().data().user(userId.v);
auto name = TextWithEntities { App::peerName(user) };
auto name = TextWithEntities { user->name };
auto entityData = QString::number(user->id)
+ '.'
+ QString::number(user->accessHash());
@ -383,7 +384,7 @@ void GenerateItems(
};
using Flag = MTPDmessage::Flag;
auto fromName = App::peerName(from);
auto fromName = from->name;
auto fromLink = from->createOpenLink();
auto fromLinkText = textcmdLink(1, fromName);

View File

@ -7,6 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
class History;
namespace HistoryView {
class ElementDelegate;
class Element;

View File

@ -26,6 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_channel.h"
#include "data/data_session.h"
#include "lang/lang_keys.h"
#include "facades.h"
#include "styles/style_history.h"
#include "styles/style_window.h"
#include "styles/style_info.h"

View File

@ -40,8 +40,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/text_options.h"
#include "core/crash_reports.h"
#include "base/unixtime.h"
#include "facades.h"
#include "styles/style_dialogs.h"
#include <memory>
namespace {

View File

@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mainwindow.h"
#include "apiwrap.h"
#include "mainwidget.h"
#include "app.h"
#include "ui/widgets/shadow.h"
DragArea::DragArea(QWidget *parent) : TWidget(parent) {

View File

@ -49,6 +49,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_poll.h"
#include "data/data_photo.h"
#include "data/data_user.h"
#include "facades.h"
#include "app.h"
#include <QtGui/QClipboard>
#include <QtWidgets/QApplication>

View File

@ -25,6 +25,7 @@ struct StateRequest;
enum class CursorState : char;
enum class PointState : char;
class EmptyPainter;
class Element;
} // namespace HistoryView
namespace Window {

View File

@ -41,6 +41,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_chat.h"
#include "data/data_user.h"
#include "observer_peer.h"
#include "facades.h"
#include "styles/style_dialogs.h"
#include "styles/style_history.h"

View File

@ -55,6 +55,7 @@ class ElementDelegate;
} // namespace HistoryView
struct HiddenSenderInfo;
class History;
class HistoryItem : public RuntimeComposer<HistoryItem> {
public:

View File

@ -24,9 +24,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_user.h"
#include "data/data_file_origin.h"
#include "main/main_session.h"
#include "window/window_session_controller.h"
#include "facades.h"
#include "styles/style_widgets.h"
#include "styles/style_history.h"
#include "window/window_session_controller.h"
#include <QtGui/QGuiApplication>
@ -113,7 +114,7 @@ void HistoryMessageForwarded::create(const HistoryMessageVia *via) const {
&& originalSender->isChannel()
&& !originalSender->isMegagroup();
const auto name = originalSender
? App::peerName(originalSender)
? originalSender->name
: hiddenSenderInfo->name;
if (!originalAuthor.isEmpty()) {
phrase = tr::lng_forwarded_signed(
@ -258,12 +259,9 @@ void HistoryMessageReply::updateName() const {
}
return replyToMsg->author().get();
}();
const auto name = [&] {
if (replyToVia && from->isUser()) {
return from->asUser()->firstName;
}
return App::peerName(from);
}();
const auto name = (replyToVia && from->isUser())
? from->asUser()->firstName
: from->name;
replyToName.setText(st::fwdTextStyle, name, Ui::NameTextOptions());
replyToVersion = replyToMsg->author()->nameVersion;
bool hasPreview = replyToMsg->media() ? replyToMsg->media()->hasReplyPreview() : false;

View File

@ -36,6 +36,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_media_types.h"
#include "data/data_channel.h"
#include "data/data_user.h"
#include "facades.h"
#include "app.h"
#include "styles/style_dialogs.h"
#include "styles/style_widgets.h"
#include "styles/style_history.h"
@ -224,7 +226,7 @@ void FastShareMessage(not_null<HistoryItem*> item) {
}
};
auto submitCallback = [=](
QVector<PeerData*> &&result,
std::vector<not_null<PeerData*>> &&result,
TextWithTags &&comment,
Api::SendOptions options) {
if (!data->requests.empty()) {
@ -251,7 +253,7 @@ void FastShareMessage(not_null<HistoryItem*> item) {
auto text = TextWithEntities();
if (result.size() > 1) {
text.append(
Ui::Text::Bold(App::peerName(error.second))
Ui::Text::Bold(error.second->name)
).append("\n\n");
}
text.append(error.first);
@ -1312,7 +1314,7 @@ QString HistoryMessage::notificationHeader() const {
if (out() && isFromScheduled() && !_history->peer->isSelf()) {
return tr::lng_from_you(tr::now);
} else if (!_history->peer->isUser() && !isPost()) {
return App::peerName(from());
return from()->name;
}
return QString();
}

View File

@ -203,7 +203,7 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
result.text = tr::lng_action_secure_values_sent(
tr::now,
lt_user,
textcmdLink(1, App::peerName(history()->peer)),
textcmdLink(1, history()->peer->name),
lt_documents,
documents.join(", "));
return result;

Some files were not shown because too many files have changed in this diff Show More