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