diff --git a/Telegram/SourceFiles/boxes/add_contact_box.cpp b/Telegram/SourceFiles/boxes/add_contact_box.cpp index 9d5356464f..ed831de5f8 100644 --- a/Telegram/SourceFiles/boxes/add_contact_box.cpp +++ b/Telegram/SourceFiles/boxes/add_contact_box.cpp @@ -766,7 +766,7 @@ SetupChannelBox::SetupChannelBox( st::defaultBoxCheckbox) , _aboutPublicWidth(st::boxWideWidth - st::boxPadding.left() - - st::boxButtonPadding.right() + - st::defaultBox.buttonPadding.right() - st::newGroupPadding.left() - st::defaultRadio.diameter - st::defaultBoxCheckbox.textPosition.x()) @@ -1345,7 +1345,7 @@ void RevokePublicLinkBox::prepare() { if (callback) { callback(); } - }), st::boxLayerScroll, _innerTop); + }), st::boxScroll, _innerTop); addButton(tr::lng_cancel(), [=] { closeBox(); }); diff --git a/Telegram/SourceFiles/boxes/auto_download_box.cpp b/Telegram/SourceFiles/boxes/auto_download_box.cpp index bc4351e332..21d44e0c25 100644 --- a/Telegram/SourceFiles/boxes/auto_download_box.cpp +++ b/Telegram/SourceFiles/boxes/auto_download_box.cpp @@ -10,8 +10,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "lang/lang_keys.h" #include "main/main_session.h" #include "data/data_session.h" -#include "info/profile/info_profile_button.h" #include "ui/widgets/continuous_sliders.h" +#include "ui/widgets/buttons.h" #include "ui/wrap/vertical_layout.h" #include "ui/wrap/wrap.h" #include "storage/localstorage.h" diff --git a/Telegram/SourceFiles/boxes/boxes.style b/Telegram/SourceFiles/boxes/boxes.style index 14d65894ae..04e21e28c2 100644 --- a/Telegram/SourceFiles/boxes/boxes.style +++ b/Telegram/SourceFiles/boxes/boxes.style @@ -42,7 +42,7 @@ countryRowBgOver: windowBgOver; countryRowCodeFg: windowSubTextFg; countryRowCodeFgOver: windowSubTextFgOver; countriesSkip: 12px; -countriesScroll: ScrollArea(boxLayerScroll) { +countriesScroll: ScrollArea(boxScroll) { deltat: 9px; deltab: 3px; } @@ -352,7 +352,7 @@ membersAbout: FlatLabel(defaultFlatLabel) { style: boxLabelStyle; } -sessionsScroll: boxLayerScroll; +sessionsScroll: boxScroll; sessionsHeight: 350px; sessionHeight: 70px; sessionCurrentPadding: margins(0px, 7px, 0px, 4px); @@ -490,7 +490,7 @@ langsRadio: Radio(defaultRadio) { backgroundPadding: 10px; backgroundSize: size(108px, 193px); -backgroundScroll: ScrollArea(boxLayerScroll) { +backgroundScroll: ScrollArea(boxScroll) { deltax: 3px; width: 10px; deltat: 10px; @@ -852,7 +852,7 @@ createPollWarningPosition: point(16px, 6px); callSettingsButton: IconButton { width: 50px; - height: boxLayerTitleHeight; + height: boxTitleHeight; icon: icon {{ "menu_settings", boxTitleCloseFg }}; iconOver: icon {{ "menu_settings", boxTitleCloseFgOver }}; iconPosition: point(8px, -1px); diff --git a/Telegram/SourceFiles/boxes/confirm_box.cpp b/Telegram/SourceFiles/boxes/confirm_box.cpp index c7db08c408..402facdc05 100644 --- a/Telegram/SourceFiles/boxes/confirm_box.cpp +++ b/Telegram/SourceFiles/boxes/confirm_box.cpp @@ -56,7 +56,7 @@ ConfirmBox::ConfirmBox( : _confirmText(tr::lng_box_ok(tr::now)) , _cancelText(tr::lng_cancel(tr::now)) , _confirmStyle(st::defaultBoxButton) -, _text(st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right()) +, _text(st::boxWidth - st::boxPadding.left() - st::defaultBox.buttonPadding.right()) , _confirmedCallback(std::move(confirmedCallback)) , _cancelledCallback(std::move(cancelledCallback)) { init(text); @@ -71,7 +71,7 @@ ConfirmBox::ConfirmBox( : _confirmText(confirmText) , _cancelText(tr::lng_cancel(tr::now)) , _confirmStyle(st::defaultBoxButton) -, _text(st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right()) +, _text(st::boxWidth - st::boxPadding.left() - st::defaultBox.buttonPadding.right()) , _confirmedCallback(std::move(confirmedCallback)) , _cancelledCallback(std::move(cancelledCallback)) { init(text); @@ -86,7 +86,7 @@ ConfirmBox::ConfirmBox( : _confirmText(confirmText) , _cancelText(tr::lng_cancel(tr::now)) , _confirmStyle(st::defaultBoxButton) -, _text(st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right()) +, _text(st::boxWidth - st::boxPadding.left() - st::defaultBox.buttonPadding.right()) , _confirmedCallback(std::move(confirmedCallback)) , _cancelledCallback(std::move(cancelledCallback)) { init(text); @@ -102,7 +102,7 @@ ConfirmBox::ConfirmBox( : _confirmText(confirmText) , _cancelText(tr::lng_cancel(tr::now)) , _confirmStyle(confirmStyle) -, _text(st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right()) +, _text(st::boxWidth - st::boxPadding.left() - st::defaultBox.buttonPadding.right()) , _confirmedCallback(std::move(confirmedCallback)) , _cancelledCallback(std::move(cancelledCallback)) { init(text); @@ -118,7 +118,7 @@ ConfirmBox::ConfirmBox( : _confirmText(confirmText) , _cancelText(cancelText) , _confirmStyle(st::defaultBoxButton) -, _text(st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right()) +, _text(st::boxWidth - st::boxPadding.left() - st::defaultBox.buttonPadding.right()) , _confirmedCallback(std::move(confirmedCallback)) , _cancelledCallback(std::move(cancelledCallback)) { init(text); @@ -135,7 +135,7 @@ ConfirmBox::ConfirmBox( : _confirmText(confirmText) , _cancelText(cancelText) , _confirmStyle(st::defaultBoxButton) -, _text(st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right()) +, _text(st::boxWidth - st::boxPadding.left() - st::defaultBox.buttonPadding.right()) , _confirmedCallback(std::move(confirmedCallback)) , _cancelledCallback(std::move(cancelledCallback)) { init(text); @@ -149,7 +149,7 @@ ConfirmBox::ConfirmBox( : _confirmText(doneText) , _confirmStyle(st::defaultBoxButton) , _informative(true) -, _text(st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right()) +, _text(st::boxWidth - st::boxPadding.left() - st::defaultBox.buttonPadding.right()) , _confirmedCallback(generateInformCallback(closedCallback)) , _cancelledCallback(generateInformCallback(closedCallback)) { init(text); @@ -163,7 +163,7 @@ ConfirmBox::ConfirmBox( : _confirmText(doneText) , _confirmStyle(st::defaultBoxButton) , _informative(true) -, _text(st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right()) +, _text(st::boxWidth - st::boxPadding.left() - st::defaultBox.buttonPadding.right()) , _confirmedCallback(generateInformCallback(closedCallback)) , _cancelledCallback(generateInformCallback(closedCallback)) { init(text); @@ -220,7 +220,7 @@ void ConfirmBox::setMaxLineCount(int count) { } void ConfirmBox::textUpdated() { - _textWidth = st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right(); + _textWidth = st::boxWidth - st::boxPadding.left() - st::defaultBox.buttonPadding.right(); _textHeight = _text.countHeight(_textWidth); if (_maxLineCount > 0) { accumulate_min(_textHeight, _maxLineCount * st::boxLabelStyle.lineHeight); @@ -324,7 +324,7 @@ InformBox::InformBox(QWidget*, const TextWithEntities &text, const QString &done MaxInviteBox::MaxInviteBox(QWidget*, not_null channel) : BoxContent() , _channel(channel) -, _text(st::boxLabelStyle, tr::lng_participant_invite_sorry(tr::now, lt_count, Global::ChatSizeMax()), _confirmBoxTextOptions, st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right()) { +, _text(st::boxLabelStyle, tr::lng_participant_invite_sorry(tr::now, lt_count, Global::ChatSizeMax()), _confirmBoxTextOptions, st::boxWidth - st::boxPadding.left() - st::defaultBox.buttonPadding.right()) { } void MaxInviteBox::prepare() { @@ -332,7 +332,7 @@ void MaxInviteBox::prepare() { addButton(tr::lng_box_ok(), [=] { closeBox(); }); - _textWidth = st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right(); + _textWidth = st::boxWidth - st::boxPadding.left() - st::defaultBox.buttonPadding.right(); _textHeight = qMin(_text.countHeight(_textWidth), 16 * st::boxLabelStyle.lineHeight); setDimensions(st::boxWidth, st::boxPadding.top() + _textHeight + st::boxTextFont->height + st::boxTextFont->height * 2 + st::newGroupLinkPadding.bottom()); diff --git a/Telegram/SourceFiles/boxes/edit_caption_box.cpp b/Telegram/SourceFiles/boxes/edit_caption_box.cpp index 06d17191b0..8cc81d2c4d 100644 --- a/Telegram/SourceFiles/boxes/edit_caption_box.cpp +++ b/Telegram/SourceFiles/boxes/edit_caption_box.cpp @@ -756,7 +756,7 @@ void EditCaptionBox::updateBoxSize() { } int EditCaptionBox::errorTopSkip() const { - return (st::boxButtonPadding.top() / 2); + return (st::defaultBox.buttonPadding.top() / 2); } void EditCaptionBox::paintEvent(QPaintEvent *e) { diff --git a/Telegram/SourceFiles/boxes/edit_privacy_box.cpp b/Telegram/SourceFiles/boxes/edit_privacy_box.cpp index d693492a13..03667da4e6 100644 --- a/Telegram/SourceFiles/boxes/edit_privacy_box.cpp +++ b/Telegram/SourceFiles/boxes/edit_privacy_box.cpp @@ -14,7 +14,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/wrap/vertical_layout.h" #include "history/history.h" #include "boxes/peer_list_controllers.h" -#include "info/profile/info_profile_button.h" #include "settings/settings_common.h" #include "settings/settings_privacy_security.h" #include "calls/calls_instance.h" diff --git a/Telegram/SourceFiles/boxes/language_box.cpp b/Telegram/SourceFiles/boxes/language_box.cpp index a169f7a1f4..135186d91a 100644 --- a/Telegram/SourceFiles/boxes/language_box.cpp +++ b/Telegram/SourceFiles/boxes/language_box.cpp @@ -336,8 +336,8 @@ void Rows::mousePressEvent(QMouseEvent *e) { QRect Rows::menuToggleArea() const { const auto size = st::topBarSearch.width; const auto top = (DefaultRowHeight() - size) / 2; - const auto skip = st::boxLayerScroll.width - - st::boxLayerScroll.deltax + const auto skip = st::boxScroll.width + - st::boxScroll.deltax + top; const auto left = width() - skip - size; return QRect(left, top, size, size); @@ -1072,7 +1072,7 @@ void LanguageBox::prepare() { const auto [recent, official] = PrepareLists(); const auto inner = setInnerWidget( object_ptr(this, recent, official), - st::boxLayerScroll, + st::boxScroll, select->height()); inner->resizeToWidth(st::boxWidth); diff --git a/Telegram/SourceFiles/boxes/local_storage_box.cpp b/Telegram/SourceFiles/boxes/local_storage_box.cpp index 618c1035aa..b850b4005f 100644 --- a/Telegram/SourceFiles/boxes/local_storage_box.cpp +++ b/Telegram/SourceFiles/boxes/local_storage_box.cpp @@ -231,7 +231,7 @@ int LocalStorageBox::Row::resizeGetHeight(int newWidth) { newWidth); } _clear->moveToRight( - st::boxLayerButtonPadding.right(), + st::layerBox.buttonPadding.right(), (height - _clear->height()) / 2, newWidth); return height; diff --git a/Telegram/SourceFiles/boxes/peer_list_box.cpp b/Telegram/SourceFiles/boxes/peer_list_box.cpp index 0542e0e34a..3259bc7372 100644 --- a/Telegram/SourceFiles/boxes/peer_list_box.cpp +++ b/Telegram/SourceFiles/boxes/peer_list_box.cpp @@ -110,7 +110,7 @@ void PeerListBox::prepare() { this, _controller.get(), st::peerListBox), - st::boxLayerScroll)); + st::boxScroll)); content()->resizeToWidth(_controller->contentWidth()); _controller->setDelegate(this); diff --git a/Telegram/SourceFiles/boxes/peers/edit_linked_chat_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_linked_chat_box.cpp index e813bb3f1c..d490a38f4c 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_linked_chat_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_linked_chat_box.cpp @@ -11,9 +11,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_channel.h" #include "data/data_chat.h" #include "ui/widgets/labels.h" +#include "ui/widgets/buttons.h" #include "ui/wrap/vertical_layout.h" #include "ui/text/text_utilities.h" // Ui::Text::ToUpper -#include "info/profile/info_profile_button.h" #include "boxes/peer_list_box.h" #include "boxes/confirm_box.h" #include "boxes/add_contact_box.h" @@ -244,7 +244,7 @@ object_ptr SetupCreateGroup( Fn callback) { Expects(channel->isBroadcast()); - auto result = object_ptr( + auto result = object_ptr( parent, tr::lng_manage_discussion_group_create( ) | Ui::Text::ToUpper(), @@ -266,7 +266,7 @@ object_ptr SetupUnlink( not_null parent, not_null channel, Fn callback) { - auto result = object_ptr( + auto result = object_ptr( parent, (channel->isBroadcast() ? tr::lng_manage_discussion_group_unlink diff --git a/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp index 289708e364..c082c447fa 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp @@ -22,7 +22,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/text_options.h" #include "ui/special_buttons.h" #include "chat_helpers/emoji_suggestions_widget.h" -#include "info/profile/info_profile_button.h" #include "settings/settings_privacy_security.h" #include "boxes/calendar_box.h" #include "boxes/confirm_box.h" diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp index 56bf1dfacf..918901b887 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp @@ -24,7 +24,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_peer.h" #include "data/data_session.h" #include "history/admin_log/history_admin_log_section.h" -#include "info/profile/info_profile_button.h" #include "info/profile/info_profile_values.h" #include "lang/lang_keys.h" #include "mainwidget.h" @@ -35,6 +34,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/special_buttons.h" #include "ui/toast/toast.h" #include "ui/widgets/checkbox.h" +#include "ui/widgets/buttons.h" #include "ui/widgets/input_fields.h" #include "ui/widgets/labels.h" #include "ui/widgets/box_content_divider.h" @@ -93,7 +93,7 @@ void AddButtonWithCount( &icon)); } -object_ptr CreateButtonWithText( +object_ptr CreateButtonWithText( not_null parent, rpl::producer &&text, rpl::producer &&label, @@ -107,7 +107,7 @@ object_ptr CreateButtonWithText( nullptr); } -Info::Profile::Button *AddButtonWithText( +Ui::SettingsButton *AddButtonWithText( not_null parent, rpl::producer &&text, rpl::producer &&label, @@ -1478,14 +1478,14 @@ void EditPeerInfoBox::prepare() { std::move(content))); } -object_ptr EditPeerInfoBox::CreateButton( +object_ptr EditPeerInfoBox::CreateButton( not_null parent, rpl::producer &&text, rpl::producer &&count, Fn callback, - const style::InfoProfileCountButton &st, + const style::SettingsCountButton &st, const style::icon *icon) { - auto result = object_ptr( + auto result = object_ptr( parent, rpl::duplicate(text), st.button); diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.h b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.h index 59c85a48a9..11ffd36ec8 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.h +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.h @@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "boxes/abstract_box.h" namespace style { -struct InfoProfileCountButton; +struct SettingsCountButton; } // namespace style namespace Window { @@ -20,14 +20,9 @@ class SessionNavigation; namespace Ui { class VerticalLayout; +class SettingsButton; } // namespace Ui -namespace Info { -namespace Profile { -class Button; -} // namespace Profile -} // namespace Info - class EditPeerInfoBox : public Ui::BoxContent { public: EditPeerInfoBox( @@ -41,12 +36,12 @@ public: static bool Available(not_null peer); - [[nodiscard]] static object_ptr CreateButton( + [[nodiscard]] static object_ptr CreateButton( not_null parent, rpl::producer &&text, rpl::producer &&count, Fn callback, - const style::InfoProfileCountButton &st, + const style::SettingsCountButton &st, const style::icon *icon = nullptr); protected: diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp index 0bbe227c7b..c518e56f34 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp @@ -13,10 +13,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/wrap/vertical_layout.h" #include "ui/widgets/labels.h" #include "ui/widgets/checkbox.h" +#include "ui/widgets/buttons.h" #include "ui/widgets/continuous_sliders.h" #include "ui/widgets/box_content_divider.h" #include "ui/toast/toast.h" -#include "info/profile/info_profile_button.h" #include "info/profile/info_profile_icon.h" #include "info/profile/info_profile_values.h" #include "boxes/peers/edit_participants_box.h" diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_type_box.h b/Telegram/SourceFiles/boxes/peers/edit_peer_type_box.h index 5e5ba890a0..7e0e6c6200 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_type_box.h +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_type_box.h @@ -11,19 +11,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/timer.h" namespace style { -struct InfoProfileCountButton; +struct SettingsCountButton; } // namespace style namespace Ui { class VerticalLayout; +class SettingsButton; } // namespace Ui -namespace Info { -namespace Profile { -class Button; -} // namespace Profile -} // namespace Info - enum class Privacy { HasUsername, NoUsername, diff --git a/Telegram/SourceFiles/boxes/send_files_box.cpp b/Telegram/SourceFiles/boxes/send_files_box.cpp index cb0a589fd5..a20a084a2b 100644 --- a/Telegram/SourceFiles/boxes/send_files_box.cpp +++ b/Telegram/SourceFiles/boxes/send_files_box.cpp @@ -1436,7 +1436,7 @@ void SendFilesBox::prepareAlbumPreview() { const auto wrap = Ui::CreateChild( this, - st::boxLayerScroll); + st::boxScroll); _albumPreview = wrap->setOwnedWidget(object_ptr( this, _list, diff --git a/Telegram/SourceFiles/boxes/sessions_box.cpp b/Telegram/SourceFiles/boxes/sessions_box.cpp index a2888695f9..91247790d1 100644 --- a/Telegram/SourceFiles/boxes/sessions_box.cpp +++ b/Telegram/SourceFiles/boxes/sessions_box.cpp @@ -15,7 +15,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_session.h" #include "base/unixtime.h" #include "boxes/confirm_box.h" -#include "info/profile/info_profile_button.h" #include "settings/settings_common.h" #include "ui/widgets/buttons.h" #include "ui/widgets/scroll_area.h" @@ -70,7 +69,7 @@ private: void setupContent(); QPointer _current; - QPointer _terminateAll; + QPointer _terminateAll; QPointer _incomplete; QPointer _list; @@ -369,7 +368,7 @@ void SessionsBox::Inner::setupContent() { object_ptr(content)))->setDuration(0); const auto terminateInner = terminateWrap->entity(); _terminateAll = terminateInner->add( - object_ptr( + object_ptr( terminateInner, tr::lng_sessions_terminate_all(), st::terminateSessionsButton)); diff --git a/Telegram/SourceFiles/boxes/stickers_box.cpp b/Telegram/SourceFiles/boxes/stickers_box.cpp index 0d3048172d..c426a2316b 100644 --- a/Telegram/SourceFiles/boxes/stickers_box.cpp +++ b/Telegram/SourceFiles/boxes/stickers_box.cpp @@ -769,7 +769,7 @@ void StickersBox::Inner::resizeEvent(QResizeEvent *e) { void StickersBox::Inner::updateControlsGeometry() { if (_megagroupSet) { auto top = st::groupStickersFieldPadding.top(); - auto fieldLeft = st::boxLayerTitlePosition.x(); + auto fieldLeft = st::boxTitlePosition.x(); _megagroupSetField->setGeometryToLeft(fieldLeft, top, width() - fieldLeft - st::groupStickersFieldPadding.right(), _megagroupSetField->height()); top += _megagroupSetField->height() + st::groupStickersFieldPadding.bottom(); if (_megagroupSelectedRemove) { @@ -780,8 +780,8 @@ void StickersBox::Inner::updateControlsGeometry() { } _megagroupDivider->setGeometryToLeft(0, top, width(), _megagroupDivider->height()); top += _megagroupDivider->height(); - _megagroupSubTitle->resizeToNaturalWidth(width() - 2 * st::boxLayerTitlePosition.x()); - _megagroupSubTitle->moveToLeft(st::boxLayerTitlePosition.x(), top + st::boxLayerTitlePosition.y()); + _megagroupSubTitle->resizeToNaturalWidth(width() - 2 * st::boxTitlePosition.x()); + _megagroupSubTitle->moveToLeft(st::boxTitlePosition.x(), top + st::boxTitlePosition.y()); } } @@ -1913,7 +1913,7 @@ void StickersBox::Inner::readVisibleSets() { } void StickersBox::Inner::updateScrollbarWidth() { - auto width = (_visibleBottom - _visibleTop < height()) ? (st::boxLayerScroll.width - st::boxLayerScroll.deltax) : 0; + auto width = (_visibleBottom - _visibleTop < height()) ? (st::boxScroll.width - st::boxScroll.deltax) : 0; if (_scrollbar != width) { _scrollbar = width; update(); diff --git a/Telegram/SourceFiles/chat_helpers/chat_helpers.style b/Telegram/SourceFiles/chat_helpers/chat_helpers.style index 06bc2196e8..7aa5580d9c 100644 --- a/Telegram/SourceFiles/chat_helpers/chat_helpers.style +++ b/Telegram/SourceFiles/chat_helpers/chat_helpers.style @@ -79,7 +79,7 @@ stickersFeaturedInstalled: icon {{ "send_control_save", lightButtonFg }}; stickersMaxHeight: 320px; stickersPadding: margins(19px, 13px, 19px, 13px); stickersSize: size(64px, 64px); -stickersScroll: ScrollArea(boxLayerScroll) { +stickersScroll: ScrollArea(boxScroll) { deltat: 19px; deltab: 9px; } diff --git a/Telegram/SourceFiles/core/base_integration.cpp b/Telegram/SourceFiles/core/base_integration.cpp new file mode 100644 index 0000000000..d6cf7cb8d6 --- /dev/null +++ b/Telegram/SourceFiles/core/base_integration.cpp @@ -0,0 +1,32 @@ +/* +This file is part of Telegram Desktop, +the official desktop application for the Telegram messaging service. + +For license and copyright information please follow this link: +https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL +*/ +#include "core/base_integration.h" + +#include "core/sandbox.h" +#include "core/crash_reports.h" + +namespace Core { + +BaseIntegration::BaseIntegration(int argc, char *argv[]) +: Integration(argc, argv) { +} + +void BaseIntegration::enterFromEventLoop(FnMut &&method) { + Core::Sandbox::Instance().customEnterFromEventLoop( + std::move(method)); +} + +void BaseIntegration::logAssertionViolation(const QString &info) { +#ifdef LOG + LOG(("Assertion Failed! ") + info); +#endif // LOG + + CrashReports::SetAnnotation("Assertion", info); +} + +} // namespace Core diff --git a/Telegram/SourceFiles/core/base_integration.h b/Telegram/SourceFiles/core/base_integration.h new file mode 100644 index 0000000000..5d7221b8df --- /dev/null +++ b/Telegram/SourceFiles/core/base_integration.h @@ -0,0 +1,23 @@ +/* +This file is part of Telegram Desktop, +the official desktop application for the Telegram messaging service. + +For license and copyright information please follow this link: +https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL +*/ +#pragma once + +#include "base/integration.h" + +namespace Core { + +class BaseIntegration : public base::Integration { +public: + BaseIntegration(int argc, char *argv[]); + + void enterFromEventLoop(FnMut &&method) override; + void logAssertionViolation(const QString &info) override; + +}; + +} // namespace Core diff --git a/Telegram/SourceFiles/core/crash_reports.h b/Telegram/SourceFiles/core/crash_reports.h index 5e60afd0e2..665c431f9a 100644 --- a/Telegram/SourceFiles/core/crash_reports.h +++ b/Telegram/SourceFiles/core/crash_reports.h @@ -57,24 +57,3 @@ void StartCatching(not_null launcher); void FinishCatching(); } // namespace CrashReports - -namespace base { -namespace assertion { - -inline void log(const char *message, const char *file, int line) { - const auto info = QStringLiteral("%1 %2:%3" - ).arg(message - ).arg(file - ).arg(line - ); - const auto entry = QStringLiteral("Assertion Failed! ") + info; - -#ifdef LOG - LOG((entry)); -#endif // LOG - - CrashReports::SetAnnotation("Assertion", info); -} - -} // namespace assertion -} // namespace base diff --git a/Telegram/SourceFiles/core/launcher.cpp b/Telegram/SourceFiles/core/launcher.cpp index 4b04f8ed4c..25473426f9 100644 --- a/Telegram/SourceFiles/core/launcher.cpp +++ b/Telegram/SourceFiles/core/launcher.cpp @@ -235,8 +235,10 @@ Launcher::Launcher( const QString &systemVersion) : _argc(argc) , _argv(argv) +, _baseIntegration(_argc, _argv) , _deviceModel(deviceModel) , _systemVersion(systemVersion) { + base::Integration::Set(&_baseIntegration); } void Launcher::init() { diff --git a/Telegram/SourceFiles/core/launcher.h b/Telegram/SourceFiles/core/launcher.h index 6060e96ff7..05648bdb15 100644 --- a/Telegram/SourceFiles/core/launcher.h +++ b/Telegram/SourceFiles/core/launcher.h @@ -7,6 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once +#include "core/base_integration.h" + namespace Core { class Launcher { @@ -63,6 +65,7 @@ private: int _argc; char **_argv; QStringList _arguments; + BaseIntegration _baseIntegration; const QString _deviceModel; const QString _systemVersion; diff --git a/Telegram/SourceFiles/export/view/export_view_settings.cpp b/Telegram/SourceFiles/export/view/export_view_settings.cpp index 7722112549..579efb1619 100644 --- a/Telegram/SourceFiles/export/view/export_view_settings.cpp +++ b/Telegram/SourceFiles/export/view/export_view_settings.cpp @@ -103,7 +103,7 @@ void SettingsWidget::changeData(Callback &&callback) { void SettingsWidget::setupContent() { const auto scroll = Ui::CreateChild( this, - st::boxLayerScroll); + st::boxScroll); const auto wrap = scroll->setOwnedWidget( object_ptr( scroll, @@ -406,7 +406,7 @@ not_null SettingsWidget::setupButtons( not_null wrap) { using namespace rpl::mappers; - const auto buttonsPadding = st::boxButtonPadding; + const auto buttonsPadding = st::defaultBox.buttonPadding; const auto buttonsHeight = buttonsPadding.top() + st::defaultBoxButton.height + buttonsPadding.bottom(); @@ -654,8 +654,8 @@ void SettingsWidget::refreshButtons( container->sizeValue( ) | rpl::start_with_next([=](QSize size) { - const auto right = st::boxButtonPadding.right(); - const auto top = st::boxButtonPadding.top(); + const auto right = st::defaultBox.buttonPadding.right(); + const auto top = st::defaultBox.buttonPadding.top(); start->moveToRight(right, top); }, start->lifetime()); } @@ -674,9 +674,9 @@ void SettingsWidget::refreshButtons( container->sizeValue(), start ? start->widthValue() : rpl::single(0) ) | rpl::start_with_next([=](QSize size, int width) { - const auto right = st::boxButtonPadding.right() - + (width ? width + st::boxButtonPadding.left() : 0); - const auto top = st::boxButtonPadding.top(); + const auto right = st::defaultBox.buttonPadding.right() + + (width ? width + st::defaultBox.buttonPadding.left() : 0); + const auto top = st::defaultBox.buttonPadding.top(); cancel->moveToRight(right, top); }, cancel->lifetime()); } diff --git a/Telegram/SourceFiles/info/info.style b/Telegram/SourceFiles/info/info.style index 9867eaa2bf..673fd58624 100644 --- a/Telegram/SourceFiles/info/info.style +++ b/Telegram/SourceFiles/info/info.style @@ -196,7 +196,7 @@ infoTopBarDuration: 150; infoLayerTopMinimal: 20px; infoLayerTopMaximal: 40px; -infoLayerTopBarHeight: boxLayerTitleHeight; +infoLayerTopBarHeight: boxTitleHeight; infoLayerTopBarBackIcon: icon {{ "info_back", boxTitleCloseFg }}; infoLayerTopBarBackIconOver: icon {{ "info_back", boxTitleCloseFgOver }}; infoLayerTopBarBack: IconButton(infoTopBarBack) { @@ -256,7 +256,7 @@ infoLayerTopBar: InfoTopBar(infoTopBar) { height: infoLayerTopBarHeight; back: infoLayerTopBarBack; title: boxTitle; - titlePosition: boxLayerTitlePosition; + titlePosition: boxTitlePosition; bg: boxBg; mediaCancel: infoLayerTopBarMediaCancel; mediaActionsSkip: 6px; @@ -402,7 +402,7 @@ infoProfileToggle: Toggle(defaultToggle) { infoProfileToggleOver: Toggle(infoProfileToggle) { untoggledFg: menuIconFgOver; } -infoProfileButton: InfoProfileButton { +infoProfileButton: SettingsButton { textFg: windowBoldFg; textFgOver: windowBoldFgOver; textBg: windowBg; @@ -419,10 +419,10 @@ infoProfileButton: InfoProfileButton { ripple: defaultRippleAnimation; } -infoNotificationsButton: InfoProfileButton(infoProfileButton) { +infoNotificationsButton: SettingsButton(infoProfileButton) { padding: margins(79px, 13px, 8px, 9px); } -infoMainButton: InfoProfileButton(infoProfileButton) { +infoMainButton: SettingsButton(infoProfileButton) { textFg: lightButtonFg; textFgOver: lightButtonFgOver; font: semiboldFont; @@ -431,14 +431,14 @@ infoSharedMediaCoverHeight: 62px; infoSharedMediaButton: infoProfileButton; infoSharedMediaBottomSkip: 12px; -infoBlockButton: InfoProfileButton(infoProfileButton) { +infoBlockButton: SettingsButton(infoProfileButton) { textFg: attentionButtonFg; textFgOver: attentionButtonFgOver; } -infoCreateLinkedChatButton: InfoProfileButton(infoMainButton) { +infoCreateLinkedChatButton: SettingsButton(infoMainButton) { padding: margins(74px, 10px, 8px, 8px); } -infoUnlinkChatButton: InfoProfileButton(infoCreateLinkedChatButton) { +infoUnlinkChatButton: SettingsButton(infoCreateLinkedChatButton) { textFg: attentionButtonFg; textFgOver: attentionButtonFgOver; } @@ -587,8 +587,8 @@ infoChannelsList: PeerList(infoCommonGroupsList) { } } -managePeerButton: InfoProfileCountButton { - button: InfoProfileButton(infoProfileButton) { +managePeerButton: SettingsCountButton { + button: SettingsButton(infoProfileButton) { padding: margins(76px, 12px, 76px, 10px); } iconPosition: point(20px, 5px); @@ -598,31 +598,31 @@ managePeerButton: InfoProfileCountButton { labelPosition: point(25px, 12px); } -peerPermissionsButton: InfoProfileCountButton(managePeerButton) { - button: InfoProfileButton(infoProfileButton) { +peerPermissionsButton: SettingsCountButton(managePeerButton) { + button: SettingsButton(infoProfileButton) { padding: margins(24px, 12px, 24px, 10px); } iconPosition: point(24px, 5px); } -manageGroupButton: InfoProfileCountButton(managePeerButton) { - button: InfoProfileButton(infoProfileButton) { +manageGroupButton: SettingsCountButton(managePeerButton) { + button: SettingsButton(infoProfileButton) { padding: margins(72px, 10px, 24px, 8px); } labelPosition: point(22px, 12px); iconPosition: point(20px, 4px); } -manageGroupTopButtonWithText: InfoProfileCountButton(manageGroupButton) { - button: InfoProfileButton(infoProfileButton) { +manageGroupTopButtonWithText: SettingsCountButton(manageGroupButton) { + button: SettingsButton(infoProfileButton) { padding: margins(22px, 10px, 24px, 8px); } labelPosition: point(22px, 10px); iconPosition: point(0px, 0px); } -manageDeleteGroupButton: InfoProfileCountButton(manageGroupTopButtonWithText) { - button: InfoProfileButton(infoProfileButton) { +manageDeleteGroupButton: SettingsCountButton(manageGroupTopButtonWithText) { + button: SettingsButton(infoProfileButton) { padding: margins(25px, 11px, 24px, 8px); textFg: attentionButtonFg; textFgOver: attentionButtonFg; @@ -634,7 +634,7 @@ manageDeleteGroupButton: InfoProfileCountButton(manageGroupTopButtonWithText) { editPeerSkip: 7px; editPeerHistoryVisibilityMargins: margins(15px, 0px, 20px, 16px); -terminateSessionsButton: InfoProfileButton(infoBlockButton) { +terminateSessionsButton: SettingsButton(infoBlockButton) { padding: margins(23px, 12px, 23px, 10px); } diff --git a/Telegram/SourceFiles/info/media/info_media_buttons.h b/Telegram/SourceFiles/info/media/info_media_buttons.h index d70a594c5d..e79cac60d2 100644 --- a/Telegram/SourceFiles/info/media/info_media_buttons.h +++ b/Telegram/SourceFiles/info/media/info_media_buttons.h @@ -13,10 +13,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "storage/storage_shared_media.h" #include "info/info_memento.h" #include "info/info_controller.h" -#include "info/profile/info_profile_button.h" #include "info/profile/info_profile_values.h" #include "ui/wrap/slide_wrap.h" #include "ui/wrap/vertical_layout.h" +#include "ui/widgets/buttons.h" #include "window/window_session_controller.h" #include "data/data_channel.h" #include "data/data_user.h" @@ -53,7 +53,7 @@ inline auto AddCountedButton( Ui::MultiSlideTracker &tracker) { using namespace rpl::mappers; - using Button = Profile::Button; + using Button = Ui::SettingsButton; auto forked = std::move(count) | start_spawning(parent->lifetime()); auto text = rpl::duplicate( diff --git a/Telegram/SourceFiles/info/media/info_media_inner_widget.cpp b/Telegram/SourceFiles/info/media/info_media_inner_widget.cpp index d94f87651d..1f72ed4063 100644 --- a/Telegram/SourceFiles/info/media/info_media_inner_widget.cpp +++ b/Telegram/SourceFiles/info/media/info_media_inner_widget.cpp @@ -12,11 +12,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "info/media/info_media_list_widget.h" #include "info/media/info_media_buttons.h" #include "info/media/info_media_empty_widget.h" -#include "info/profile/info_profile_button.h" #include "info/profile/info_profile_icon.h" #include "info/info_controller.h" #include "ui/widgets/discrete_sliders.h" #include "ui/widgets/shadow.h" +#include "ui/widgets/buttons.h" #include "ui/widgets/box_content_divider.h" #include "ui/wrap/vertical_layout.h" #include "ui/search_field_controller.h" diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index 859e3d68a0..0b08107ba7 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/wrap/slide_wrap.h" #include "ui/widgets/shadow.h" #include "ui/widgets/labels.h" +#include "ui/widgets/buttons.h" #include "ui/widgets/box_content_divider.h" #include "ui/layers/generic_box.h" #include "ui/toast/toast.h" @@ -34,7 +35,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "info/info_memento.h" #include "info/profile/info_profile_icon.h" #include "info/profile/info_profile_values.h" -#include "info/profile/info_profile_button.h" #include "info/profile/info_profile_text.h" #include "support/support_helper.h" #include "window/window_session_controller.h" @@ -76,11 +76,11 @@ auto AddActionButton( Text &&text, ToggleOn &&toggleOn, Callback &&callback, - const style::InfoProfileButton &st + const style::SettingsButton &st = st::infoSharedMediaButton) { - auto result = parent->add(object_ptr>( + auto result = parent->add(object_ptr>( parent, - object_ptr