mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 15:47:11 +02:00
Renamed class back from AdaptiveModern to Adaptive.
This commit is contained in:
parent
5b4d442799
commit
2ed3543b53
11 changed files with 37 additions and 37 deletions
|
@ -4087,8 +4087,8 @@ void HistoryWidget::toggleTabbedSelectorMode() {
|
|||
|
||||
void HistoryWidget::recountChatWidth() {
|
||||
const auto layout = (width() < st::adaptiveChatWideWidth)
|
||||
? Window::AdaptiveModern::ChatLayout::Normal
|
||||
: Window::AdaptiveModern::ChatLayout::Wide;
|
||||
? Window::Adaptive::ChatLayout::Normal
|
||||
: Window::Adaptive::ChatLayout::Wide;
|
||||
controller()->adaptive().setChatLayout(layout);
|
||||
}
|
||||
|
||||
|
|
|
@ -393,8 +393,8 @@ void PinnedWidget::resizeEvent(QResizeEvent *e) {
|
|||
|
||||
void PinnedWidget::recountChatWidth() {
|
||||
auto layout = (width() < st::adaptiveChatWideWidth)
|
||||
? Window::AdaptiveModern::ChatLayout::Normal
|
||||
: Window::AdaptiveModern::ChatLayout::Wide;
|
||||
? Window::Adaptive::ChatLayout::Normal
|
||||
: Window::Adaptive::ChatLayout::Wide;
|
||||
controller()->adaptive().setChatLayout(layout);
|
||||
}
|
||||
|
||||
|
|
|
@ -1464,8 +1464,8 @@ void RepliesWidget::resizeEvent(QResizeEvent *e) {
|
|||
|
||||
void RepliesWidget::recountChatWidth() {
|
||||
auto layout = (width() < st::adaptiveChatWideWidth)
|
||||
? Window::AdaptiveModern::ChatLayout::Normal
|
||||
: Window::AdaptiveModern::ChatLayout::Wide;
|
||||
? Window::Adaptive::ChatLayout::Normal
|
||||
: Window::Adaptive::ChatLayout::Wide;
|
||||
controller()->adaptive().setChatLayout(layout);
|
||||
}
|
||||
|
||||
|
|
|
@ -2656,7 +2656,7 @@ void MainWidget::updateWindowAdaptiveLayout() {
|
|||
|
||||
// Check if we are in a single-column layout in a wide enough window
|
||||
// for the normal layout. If so, switch to the normal layout.
|
||||
if (layout.windowLayout == Window::AdaptiveModern::WindowLayout::OneColumn) {
|
||||
if (layout.windowLayout == Window::Adaptive::WindowLayout::OneColumn) {
|
||||
auto chatWidth = layout.chatWidth;
|
||||
//if (session().settings().tabbedSelectorSectionEnabled()
|
||||
// && chatWidth >= _history->minimalWidthForTabbedSelectorSection()) {
|
||||
|
@ -2666,7 +2666,7 @@ void MainWidget::updateWindowAdaptiveLayout() {
|
|||
+ st::columnMinimalWidthMain;
|
||||
if (chatWidth >= minimalNormalWidth) {
|
||||
// Switch layout back to normal in a wide enough window.
|
||||
layout.windowLayout = Window::AdaptiveModern::WindowLayout::Normal;
|
||||
layout.windowLayout = Window::Adaptive::WindowLayout::Normal;
|
||||
layout.dialogsWidth = st::columnMinimalWidthLeft;
|
||||
layout.chatWidth = layout.bodyWidth - layout.dialogsWidth;
|
||||
dialogsWidthRatio = float64(layout.dialogsWidth) / layout.bodyWidth;
|
||||
|
@ -2676,7 +2676,7 @@ void MainWidget::updateWindowAdaptiveLayout() {
|
|||
// Check if we are going to create the third column and shrink the
|
||||
// dialogs widget to provide a wide enough chat history column.
|
||||
// Don't shrink the column on the first call, when window is inited.
|
||||
if (layout.windowLayout == Window::AdaptiveModern::WindowLayout::ThreeColumn
|
||||
if (layout.windowLayout == Window::Adaptive::WindowLayout::ThreeColumn
|
||||
&& _controller->widget()->positionInited()) {
|
||||
//auto chatWidth = layout.chatWidth;
|
||||
//if (_history->willSwitchToTabbedSelectorWithWidth(chatWidth)) {
|
||||
|
|
|
@ -969,8 +969,8 @@ void SetupChatBackground(
|
|||
}, tile->lifetime());
|
||||
|
||||
adaptive->toggleOn(controller->adaptive().chatLayoutValue(
|
||||
) | rpl::map([](Window::AdaptiveModern::ChatLayout layout) {
|
||||
return (layout == Window::AdaptiveModern::ChatLayout::Wide);
|
||||
) | rpl::map([](Window::Adaptive::ChatLayout layout) {
|
||||
return (layout == Window::Adaptive::ChatLayout::Wide);
|
||||
}));
|
||||
|
||||
adaptive->entity()->checkedChanges(
|
||||
|
|
|
@ -15,57 +15,57 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
namespace Window {
|
||||
|
||||
AdaptiveModern::AdaptiveModern() = default;
|
||||
Adaptive::Adaptive() = default;
|
||||
|
||||
void AdaptiveModern::setWindowLayout(WindowLayout value) {
|
||||
void Adaptive::setWindowLayout(WindowLayout value) {
|
||||
_layout = value;
|
||||
}
|
||||
|
||||
void AdaptiveModern::setChatLayout(ChatLayout value) {
|
||||
void Adaptive::setChatLayout(ChatLayout value) {
|
||||
_chatLayout = value;
|
||||
}
|
||||
|
||||
rpl::producer<> AdaptiveModern::changed() const {
|
||||
rpl::producer<> Adaptive::changed() const {
|
||||
return rpl::merge(
|
||||
Core::App().settings().adaptiveForWideValue() | rpl::to_empty,
|
||||
_chatLayout.changes() | rpl::to_empty,
|
||||
_layout.changes() | rpl::to_empty);
|
||||
}
|
||||
|
||||
rpl::producer<bool> AdaptiveModern::oneColumnValue() const {
|
||||
rpl::producer<bool> Adaptive::oneColumnValue() const {
|
||||
return _layout.value(
|
||||
) | rpl::map([=] {
|
||||
return isOneColumn();
|
||||
});
|
||||
}
|
||||
|
||||
rpl::producer<AdaptiveModern::ChatLayout> AdaptiveModern::chatLayoutValue() const {
|
||||
rpl::producer<Adaptive::ChatLayout> Adaptive::chatLayoutValue() const {
|
||||
return _chatLayout.value();
|
||||
}
|
||||
|
||||
bool AdaptiveModern::isOneColumn() const {
|
||||
bool Adaptive::isOneColumn() const {
|
||||
return _layout.current() == WindowLayout::OneColumn;
|
||||
}
|
||||
|
||||
bool AdaptiveModern::isNormal() const {
|
||||
bool Adaptive::isNormal() const {
|
||||
return _layout.current() == WindowLayout::Normal;
|
||||
}
|
||||
|
||||
bool AdaptiveModern::isThreeColumn() const {
|
||||
bool Adaptive::isThreeColumn() const {
|
||||
return _layout.current() == WindowLayout::ThreeColumn;
|
||||
}
|
||||
|
||||
rpl::producer<bool> AdaptiveModern::chatWideValue() const {
|
||||
rpl::producer<bool> Adaptive::chatWideValue() const {
|
||||
return rpl::combine(
|
||||
_chatLayout.value(
|
||||
) | rpl::map(rpl::mappers::_1 == AdaptiveModern::ChatLayout::Wide),
|
||||
) | rpl::map(rpl::mappers::_1 == Adaptive::ChatLayout::Wide),
|
||||
Core::App().settings().adaptiveForWideValue()
|
||||
) | rpl::map(rpl::mappers::_1 && rpl::mappers::_2);
|
||||
}
|
||||
|
||||
bool AdaptiveModern::isChatWide() const {
|
||||
bool Adaptive::isChatWide() const {
|
||||
return Core::App().settings().adaptiveForWide()
|
||||
&& (_chatLayout.current() == AdaptiveModern::ChatLayout::Wide);
|
||||
&& (_chatLayout.current() == Adaptive::ChatLayout::Wide);
|
||||
}
|
||||
|
||||
} // namespace Window
|
||||
|
|
|
@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
namespace Window {
|
||||
|
||||
class AdaptiveModern {
|
||||
class Adaptive {
|
||||
public:
|
||||
enum class WindowLayout {
|
||||
OneColumn,
|
||||
|
@ -22,7 +22,7 @@ public:
|
|||
Wide,
|
||||
};
|
||||
|
||||
AdaptiveModern();
|
||||
Adaptive();
|
||||
|
||||
void setWindowLayout(WindowLayout value);
|
||||
void setChatLayout(ChatLayout value);
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace Window {
|
|||
|
||||
Controller::Controller()
|
||||
: _widget(this)
|
||||
, _adaptive(std::make_unique<AdaptiveModern>())
|
||||
, _adaptive(std::make_unique<Adaptive>())
|
||||
, _isActiveTimer([=] { updateIsActive(); }) {
|
||||
_widget.init();
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ void Controller::showLogoutConfirmation() {
|
|||
callback));
|
||||
}
|
||||
|
||||
Window::AdaptiveModern &Controller::adaptive() const {
|
||||
Window::Adaptive &Controller::adaptive() const {
|
||||
return *_adaptive;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
}
|
||||
[[nodiscard]] bool locked() const;
|
||||
|
||||
[[nodiscard]] AdaptiveModern &adaptive() const;
|
||||
[[nodiscard]] Adaptive &adaptive() const;
|
||||
|
||||
void finishFirstShow();
|
||||
|
||||
|
@ -93,7 +93,7 @@ private:
|
|||
|
||||
Main::Account *_account = nullptr;
|
||||
::MainWindow _widget;
|
||||
const std::unique_ptr<AdaptiveModern> _adaptive;
|
||||
const std::unique_ptr<Adaptive> _adaptive;
|
||||
std::unique_ptr<SessionController> _sessionController;
|
||||
base::Timer _isActiveTimer;
|
||||
QPointer<Ui::BoxContent> _termsBox;
|
||||
|
|
|
@ -803,7 +803,7 @@ bool SessionController::forceWideDialogs() const {
|
|||
}
|
||||
|
||||
auto SessionController::computeColumnLayout() const -> ColumnLayout {
|
||||
auto layout = AdaptiveModern::WindowLayout::OneColumn;
|
||||
auto layout = Adaptive::WindowLayout::OneColumn;
|
||||
|
||||
auto bodyWidth = widget()->bodyWidget()->width() - filtersWidth();
|
||||
auto dialogsWidth = 0, chatWidth = 0, thirdWidth = 0;
|
||||
|
@ -832,12 +832,12 @@ auto SessionController::computeColumnLayout() const -> ColumnLayout {
|
|||
if (useOneColumnLayout()) {
|
||||
dialogsWidth = chatWidth = bodyWidth;
|
||||
} else if (useNormalLayout()) {
|
||||
layout = AdaptiveModern::WindowLayout::Normal;
|
||||
layout = Adaptive::WindowLayout::Normal;
|
||||
dialogsWidth = countDialogsWidthFromRatio(bodyWidth);
|
||||
accumulate_min(dialogsWidth, bodyWidth - st::columnMinimalWidthMain);
|
||||
chatWidth = bodyWidth - dialogsWidth;
|
||||
} else {
|
||||
layout = AdaptiveModern::WindowLayout::ThreeColumn;
|
||||
layout = Adaptive::WindowLayout::ThreeColumn;
|
||||
dialogsWidth = countDialogsWidthFromRatio(bodyWidth);
|
||||
thirdWidth = countThirdColumnWidthFromRatio(bodyWidth);
|
||||
auto shrink = shrinkDialogsAndThirdColumns(
|
||||
|
@ -960,7 +960,7 @@ void SessionController::closeThirdSection() {
|
|||
auto &settings = Core::App().settings();
|
||||
auto newWindowSize = widget()->size();
|
||||
auto layout = computeColumnLayout();
|
||||
if (layout.windowLayout == AdaptiveModern::WindowLayout::ThreeColumn) {
|
||||
if (layout.windowLayout == Adaptive::WindowLayout::ThreeColumn) {
|
||||
auto noResize = widget()->isFullScreen()
|
||||
|| widget()->isMaximized();
|
||||
auto savedValue = settings.thirdSectionExtendedBy();
|
||||
|
@ -1206,7 +1206,7 @@ void SessionController::showNewChannel() {
|
|||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
Window::AdaptiveModern &SessionController::adaptive() const {
|
||||
Window::Adaptive &SessionController::adaptive() const {
|
||||
return _window->adaptive();
|
||||
}
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ public:
|
|||
}
|
||||
[[nodiscard]] not_null<::MainWindow*> widget() const;
|
||||
[[nodiscard]] not_null<MainWidget*> content() const;
|
||||
[[nodiscard]] AdaptiveModern &adaptive() const;
|
||||
[[nodiscard]] Adaptive &adaptive() const;
|
||||
|
||||
// We need access to this from MainWidget::MainWidget, where
|
||||
// we can't call content() yet.
|
||||
|
@ -287,7 +287,7 @@ public:
|
|||
int dialogsWidth;
|
||||
int chatWidth;
|
||||
int thirdWidth;
|
||||
AdaptiveModern::WindowLayout windowLayout;
|
||||
Adaptive::WindowLayout windowLayout;
|
||||
};
|
||||
[[nodiscard]] ColumnLayout computeColumnLayout() const;
|
||||
int dialogsSmallColumnWidth() const;
|
||||
|
|
Loading…
Add table
Reference in a new issue