mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 07:07:08 +02:00
Allow wide chats in empty window.
This commit is contained in:
parent
4d4cf472c8
commit
d91b75b8f8
9 changed files with 149 additions and 57 deletions
Telegram/SourceFiles
|
@ -123,7 +123,8 @@ Settings::Settings()
|
|||
: _sendSubmitWay(Ui::InputSubmitSettings::Enter)
|
||||
, _floatPlayerColumn(Window::Column::Second)
|
||||
, _floatPlayerCorner(RectPart::TopRight)
|
||||
, _dialogsWidthRatio(DefaultDialogsWidthRatio()) {
|
||||
, _dialogsWithChatWidthRatio(DefaultDialogsWidthRatio())
|
||||
, _dialogsNoChatWidthRatio(DefaultDialogsWidthRatio()) {
|
||||
}
|
||||
|
||||
Settings::~Settings() = default;
|
||||
|
@ -218,7 +219,8 @@ QByteArray Settings::serialize() const {
|
|||
+ Serialize::stringSize(_callCaptureDeviceId.current())
|
||||
+ Serialize::bytearraySize(ivPosition)
|
||||
+ Serialize::stringSize(noWarningExtensions)
|
||||
+ Serialize::stringSize(_customFontFamily);
|
||||
+ Serialize::stringSize(_customFontFamily)
|
||||
+ sizeof(qint32);
|
||||
|
||||
auto result = QByteArray();
|
||||
result.reserve(size);
|
||||
|
@ -280,7 +282,7 @@ QByteArray Settings::serialize() const {
|
|||
<< qint32(_floatPlayerCorner)
|
||||
<< qint32(_thirdSectionInfoEnabled ? 1 : 0)
|
||||
<< qint32(std::clamp(
|
||||
qRound(_dialogsWidthRatio.current() * 1000000),
|
||||
qRound(_dialogsWithChatWidthRatio.current() * 1000000),
|
||||
0,
|
||||
1000000))
|
||||
<< qint32(_thirdColumnWidth.current())
|
||||
|
@ -365,7 +367,11 @@ QByteArray Settings::serialize() const {
|
|||
<< _callCaptureDeviceId.current()
|
||||
<< ivPosition
|
||||
<< noWarningExtensions
|
||||
<< _customFontFamily;
|
||||
<< _customFontFamily
|
||||
<< qint32(std::clamp(
|
||||
qRound(_dialogsNoChatWidthRatio.current() * 1000000),
|
||||
0,
|
||||
1000000));
|
||||
}
|
||||
|
||||
Ensures(result.size() == size);
|
||||
|
@ -434,7 +440,8 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
|||
qint32 floatPlayerColumn = static_cast<qint32>(Window::Column::Second);
|
||||
qint32 floatPlayerCorner = static_cast<qint32>(RectPart::TopRight);
|
||||
qint32 thirdSectionInfoEnabled = 0;
|
||||
float64 dialogsWidthRatio = _dialogsWidthRatio.current();
|
||||
float64 dialogsWithChatWidthRatio = _dialogsWithChatWidthRatio.current();
|
||||
float64 dialogsNoChatWidthRatio = _dialogsNoChatWidthRatio.current();
|
||||
qint32 thirdColumnWidth = _thirdColumnWidth.current();
|
||||
qint32 thirdSectionExtendedBy = _thirdSectionExtendedBy;
|
||||
qint32 notifyFromAll = _notifyFromAll ? 1 : 0;
|
||||
|
@ -546,18 +553,18 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
|||
>> mainMenuAccountsShown;
|
||||
}
|
||||
if (!stream.atEnd()) {
|
||||
auto dialogsWidthRatioInt = qint32();
|
||||
auto dialogsWithChatWidthRatioInt = qint32();
|
||||
stream
|
||||
>> tabbedSelectorSectionEnabled
|
||||
>> floatPlayerColumn
|
||||
>> floatPlayerCorner
|
||||
>> thirdSectionInfoEnabled
|
||||
>> dialogsWidthRatioInt
|
||||
>> dialogsWithChatWidthRatioInt
|
||||
>> thirdColumnWidth
|
||||
>> thirdSectionExtendedBy
|
||||
>> notifyFromAll;
|
||||
dialogsWidthRatio = std::clamp(
|
||||
dialogsWidthRatioInt / 1000000.,
|
||||
dialogsWithChatWidthRatio = std::clamp(
|
||||
dialogsWithChatWidthRatioInt / 1000000.,
|
||||
0.,
|
||||
1.);
|
||||
}
|
||||
|
@ -772,6 +779,15 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
|||
if (!stream.atEnd()) {
|
||||
stream >> customFontFamily;
|
||||
}
|
||||
if (!stream.atEnd()) {
|
||||
auto dialogsNoChatWidthRatioInt = qint32();
|
||||
stream
|
||||
>> dialogsNoChatWidthRatioInt;
|
||||
dialogsNoChatWidthRatio = std::clamp(
|
||||
dialogsNoChatWidthRatioInt / 1000000.,
|
||||
0.,
|
||||
1.);
|
||||
}
|
||||
if (stream.status() != QDataStream::Ok) {
|
||||
LOG(("App Error: "
|
||||
"Bad data for Core::Settings::constructFromSerialized()"));
|
||||
|
@ -872,7 +888,10 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
|||
case RectPart::BottomRight: _floatPlayerCorner = uncheckedCorner; break;
|
||||
}
|
||||
_thirdSectionInfoEnabled = thirdSectionInfoEnabled;
|
||||
_dialogsWidthRatio = dialogsWidthRatio;
|
||||
_dialogsWithChatWidthRatio = dialogsWithChatWidthRatio;
|
||||
_dialogsNoChatWidthRatio = (dialogsWithChatWidthRatio > 0)
|
||||
? dialogsWithChatWidthRatio
|
||||
: dialogsNoChatWidthRatio;
|
||||
_thirdColumnWidth = thirdColumnWidth;
|
||||
_thirdSectionExtendedBy = thirdSectionExtendedBy;
|
||||
if (_thirdSectionInfoEnabled) {
|
||||
|
@ -1025,16 +1044,46 @@ void Settings::setTabbedReplacedWithInfo(bool enabled) {
|
|||
}
|
||||
}
|
||||
|
||||
void Settings::setDialogsWidthRatio(float64 ratio) {
|
||||
_dialogsWidthRatio = ratio;
|
||||
void Settings::updateDialogsWidthRatio(float64 ratio, bool nochat) {
|
||||
const auto changeWithChat = !nochat
|
||||
|| (dialogsWithChatWidthRatio() > 0)
|
||||
|| _dialogsWidthSetToZeroWithoutChat;
|
||||
const auto changedWithChat = changeWithChat
|
||||
&& (dialogsWithChatWidthRatio() != ratio);
|
||||
|
||||
const auto changeNoChat = nochat
|
||||
|| (dialogsWithChatWidthRatio() != ratio);
|
||||
const auto changedNoChat = changeNoChat
|
||||
&& (dialogsNoChatWidthRatio() != ratio);
|
||||
|
||||
if (changedWithChat) {
|
||||
_dialogsWidthSetToZeroWithoutChat = nochat && !(ratio > 0);
|
||||
_dialogsWithChatWidthRatio = ratio;
|
||||
}
|
||||
if (changedNoChat) {
|
||||
_dialogsNoChatWidthRatio = ratio;
|
||||
}
|
||||
}
|
||||
|
||||
float64 Settings::dialogsWidthRatio() const {
|
||||
return _dialogsWidthRatio.current();
|
||||
float64 Settings::dialogsWidthRatio(bool nochat) const {
|
||||
const auto withchat = dialogsWithChatWidthRatio();
|
||||
return (!nochat || withchat > 0) ? withchat : dialogsNoChatWidthRatio();
|
||||
}
|
||||
|
||||
rpl::producer<float64> Settings::dialogsWidthRatioChanges() const {
|
||||
return _dialogsWidthRatio.changes();
|
||||
float64 Settings::dialogsWithChatWidthRatio() const {
|
||||
return _dialogsWithChatWidthRatio.current();
|
||||
}
|
||||
|
||||
rpl::producer<float64> Settings::dialogsWithChatWidthRatioChanges() const {
|
||||
return _dialogsWithChatWidthRatio.changes();
|
||||
}
|
||||
|
||||
float64 Settings::dialogsNoChatWidthRatio() const {
|
||||
return _dialogsNoChatWidthRatio.current();
|
||||
}
|
||||
|
||||
rpl::producer<float64> Settings::dialogsNoChatWidthRatioChanges() const {
|
||||
return _dialogsNoChatWidthRatio.changes();
|
||||
}
|
||||
|
||||
void Settings::setThirdColumnWidth(int width) {
|
||||
|
@ -1326,7 +1375,8 @@ void Settings::resetOnLastLogout() {
|
|||
_floatPlayerCorner = RectPart::TopRight; // per-window
|
||||
_thirdSectionInfoEnabled = true; // per-window
|
||||
_thirdSectionExtendedBy = -1; // per-window
|
||||
_dialogsWidthRatio = DefaultDialogsWidthRatio(); // per-window
|
||||
_dialogsWithChatWidthRatio = DefaultDialogsWidthRatio(); // per-window
|
||||
_dialogsNoChatWidthRatio = DefaultDialogsWidthRatio(); // per-window
|
||||
_thirdColumnWidth = kDefaultThirdColumnWidth; // p-w
|
||||
_notifyFromAll = true;
|
||||
_tabbedReplacedWithInfo = false; // per-window
|
||||
|
|
|
@ -614,9 +614,15 @@ public:
|
|||
[[nodiscard]] RectPart floatPlayerCorner() const {
|
||||
return _floatPlayerCorner;
|
||||
}
|
||||
void setDialogsWidthRatio(float64 ratio);
|
||||
[[nodiscard]] float64 dialogsWidthRatio() const;
|
||||
[[nodiscard]] rpl::producer<float64> dialogsWidthRatioChanges() const;
|
||||
|
||||
void updateDialogsWidthRatio(float64 ratio, bool nochat);
|
||||
[[nodiscard]] float64 dialogsWidthRatio(bool nochat) const;
|
||||
|
||||
[[nodiscard]] float64 dialogsWithChatWidthRatio() const;
|
||||
[[nodiscard]] rpl::producer<float64> dialogsWithChatWidthRatioChanges() const;
|
||||
[[nodiscard]] float64 dialogsNoChatWidthRatio() const;
|
||||
[[nodiscard]] rpl::producer<float64> dialogsNoChatWidthRatioChanges() const;
|
||||
|
||||
void setThirdColumnWidth(int width);
|
||||
[[nodiscard]] int thirdColumnWidth() const;
|
||||
[[nodiscard]] rpl::producer<int> thirdColumnWidthChanges() const;
|
||||
|
@ -969,7 +975,8 @@ private:
|
|||
bool _thirdSectionInfoEnabled = true; // per-window
|
||||
rpl::event_stream<bool> _thirdSectionInfoEnabledValue; // per-window
|
||||
int _thirdSectionExtendedBy = -1; // per-window
|
||||
rpl::variable<float64> _dialogsWidthRatio; // per-window
|
||||
rpl::variable<float64> _dialogsWithChatWidthRatio; // per-window
|
||||
rpl::variable<float64> _dialogsNoChatWidthRatio; // per-window
|
||||
rpl::variable<int> _thirdColumnWidth = kDefaultThirdColumnWidth; // p-w
|
||||
bool _notifyFromAll = true;
|
||||
rpl::variable<bool> _nativeWindowFrame = false;
|
||||
|
@ -1015,6 +1022,7 @@ private:
|
|||
float64 _rememberedSongVolume = kDefaultVolume;
|
||||
bool _rememberedSoundNotifyFromTray = false;
|
||||
bool _rememberedFlashBounceNotifyFromTray = false;
|
||||
bool _dialogsWidthSetToZeroWithoutChat = false;
|
||||
|
||||
QByteArray _photoEditorBrush;
|
||||
|
||||
|
|
|
@ -2667,8 +2667,9 @@ void Widget::updateForceDisplayWide() {
|
|||
void Widget::showForum(
|
||||
not_null<Data::Forum*> forum,
|
||||
const Window::SectionShow ¶ms) {
|
||||
const auto nochat = !controller()->mainSectionShown();
|
||||
if (!params.childColumn
|
||||
|| !Core::App().settings().dialogsWidthRatio()
|
||||
|| !Core::App().settings().dialogsWidthRatio(nochat)
|
||||
|| (_layout != Layout::Main)
|
||||
|| OptionForumHideChatsList.value()) {
|
||||
changeOpenedForum(forum, params.animated);
|
||||
|
|
|
@ -128,7 +128,7 @@ void SessionSettings::addFromSerialized(const QByteArray &serialized) {
|
|||
base::flat_set<PeerId> groupEmojiSectionHidden;
|
||||
qint32 appThirdSectionInfoEnabled = 0;
|
||||
qint32 legacySmallDialogsList = 0;
|
||||
float64 appDialogsWidthRatio = app.dialogsWidthRatio();
|
||||
float64 appDialogsWidthRatio = app.dialogsWidthRatio(false);
|
||||
int appThirdColumnWidth = app.thirdColumnWidth();
|
||||
int appThirdSectionExtendedBy = app.thirdSectionExtendedBy();
|
||||
qint32 appSendFilesWay = app.sendFilesWay().serialize();
|
||||
|
@ -535,7 +535,7 @@ void SessionSettings::addFromSerialized(const QByteArray &serialized) {
|
|||
case RectPart::BottomRight: app.setFloatPlayerCorner(uncheckedCorner); break;
|
||||
}
|
||||
app.setThirdSectionInfoEnabled(appThirdSectionInfoEnabled);
|
||||
app.setDialogsWidthRatio(appDialogsWidthRatio);
|
||||
app.updateDialogsWidthRatio(appDialogsWidthRatio, false);
|
||||
app.setThirdColumnWidth(appThirdColumnWidth);
|
||||
app.setThirdSectionExtendedBy(appThirdSectionExtendedBy);
|
||||
}
|
||||
|
|
|
@ -303,8 +303,16 @@ MainWidget::MainWidget(
|
|||
});
|
||||
}, lifetime());
|
||||
|
||||
const auto filter = [=](bool mainSectionShown) {
|
||||
return rpl::filter([=] {
|
||||
return (_controller->mainSectionShown() == mainSectionShown);
|
||||
});
|
||||
};
|
||||
rpl::merge(
|
||||
Core::App().settings().dialogsWidthRatioChanges() | rpl::to_empty,
|
||||
Core::App().settings().dialogsWithChatWidthRatioChanges(
|
||||
) | filter(true) | rpl::to_empty,
|
||||
Core::App().settings().dialogsNoChatWidthRatioChanges(
|
||||
) | filter(false) | rpl::to_empty,
|
||||
Core::App().settings().thirdColumnWidthChanges() | rpl::to_empty
|
||||
) | rpl::start_with_next([=] {
|
||||
updateControlsGeometry();
|
||||
|
@ -1408,6 +1416,7 @@ void MainWidget::showHistory(
|
|||
auto onlyDialogs = noPeer && isOneColumn();
|
||||
_mainSection.destroy();
|
||||
|
||||
updateMainSectionShown();
|
||||
updateControlsGeometry();
|
||||
|
||||
if (noPeer) {
|
||||
|
@ -1781,6 +1790,7 @@ void MainWidget::showNewSection(
|
|||
if (const auto entry = _mainSection->activeChat(); entry.key) {
|
||||
_controller->setActiveChatEntry(entry);
|
||||
}
|
||||
updateMainSectionShown();
|
||||
|
||||
// Depends on SessionController::activeChatEntry
|
||||
// for tabbed selector showing in the third column.
|
||||
|
@ -1815,22 +1825,16 @@ void MainWidget::checkMainSectionToLayer() {
|
|||
}
|
||||
Ui::FocusPersister persister(this);
|
||||
if (auto layer = _mainSection->moveContentToLayer(rect())) {
|
||||
dropMainSection(_mainSection);
|
||||
_mainSection.destroy();
|
||||
_controller->showBackFromStack(
|
||||
SectionShow(
|
||||
anim::type::instant,
|
||||
anim::activation::background));
|
||||
_controller->showSpecialLayer(
|
||||
std::move(layer),
|
||||
anim::type::instant);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWidget::dropMainSection(Window::SectionWidget *widget) {
|
||||
if (_mainSection != widget) {
|
||||
return;
|
||||
}
|
||||
_mainSection.destroy();
|
||||
_controller->showBackFromStack(
|
||||
SectionShow(
|
||||
anim::type::instant,
|
||||
anim::activation::background));
|
||||
updateMainSectionShown();
|
||||
}
|
||||
|
||||
PeerData *MainWidget::singlePeer() const {
|
||||
|
@ -2236,13 +2240,18 @@ void MainWidget::resizeEvent(QResizeEvent *e) {
|
|||
updateControlsGeometry();
|
||||
}
|
||||
|
||||
void MainWidget::updateMainSectionShown() {
|
||||
_controller->setMainSectionShown(_mainSection || _history->peer());
|
||||
}
|
||||
|
||||
void MainWidget::updateControlsGeometry() {
|
||||
if (!width()) {
|
||||
return;
|
||||
}
|
||||
updateWindowAdaptiveLayout();
|
||||
if (_dialogs) {
|
||||
if (Core::App().settings().dialogsWidthRatio() > 0) {
|
||||
const auto nochat = !_controller->mainSectionShown();
|
||||
if (Core::App().settings().dialogsWidthRatio(nochat) > 0) {
|
||||
_a_dialogsWidth.stop();
|
||||
}
|
||||
if (!_a_dialogsWidth.animating()) {
|
||||
|
@ -2444,19 +2453,22 @@ void MainWidget::ensureFirstColumnResizeAreaCreated() {
|
|||
return;
|
||||
}
|
||||
auto moveLeftCallback = [=](int globalLeft) {
|
||||
auto newWidth = globalLeft - mapToGlobal(QPoint(0, 0)).x();
|
||||
auto newRatio = (newWidth < st::columnMinimalWidthLeft / 2)
|
||||
const auto newWidth = globalLeft - mapToGlobal(QPoint(0, 0)).x();
|
||||
const auto newRatio = (newWidth < st::columnMinimalWidthLeft / 2)
|
||||
? 0.
|
||||
: float64(newWidth) / width();
|
||||
Core::App().settings().setDialogsWidthRatio(newRatio);
|
||||
const auto nochat = !_controller->mainSectionShown();
|
||||
Core::App().settings().updateDialogsWidthRatio(newRatio, nochat);
|
||||
};
|
||||
auto moveFinishedCallback = [=] {
|
||||
if (isOneColumn()) {
|
||||
return;
|
||||
}
|
||||
if (Core::App().settings().dialogsWidthRatio() > 0) {
|
||||
Core::App().settings().setDialogsWidthRatio(
|
||||
float64(_dialogsWidth) / width());
|
||||
const auto nochat = !_controller->mainSectionShown();
|
||||
if (Core::App().settings().dialogsWidthRatio(nochat) > 0) {
|
||||
Core::App().settings().updateDialogsWidthRatio(
|
||||
float64(_dialogsWidth) / width(),
|
||||
nochat);
|
||||
}
|
||||
Core::App().saveSettingsDelayed();
|
||||
};
|
||||
|
@ -2491,12 +2503,13 @@ void MainWidget::ensureThirdColumnResizeAreaCreated() {
|
|||
}
|
||||
|
||||
void MainWidget::updateDialogsWidthAnimated() {
|
||||
if (!_dialogs || Core::App().settings().dialogsWidthRatio() > 0) {
|
||||
const auto nochat = !_controller->mainSectionShown();
|
||||
if (!_dialogs || Core::App().settings().dialogsWidthRatio(nochat) > 0) {
|
||||
return;
|
||||
}
|
||||
auto dialogsWidth = _dialogsWidth;
|
||||
updateWindowAdaptiveLayout();
|
||||
if (!Core::App().settings().dialogsWidthRatio()
|
||||
if (!Core::App().settings().dialogsWidthRatio(nochat)
|
||||
&& (_dialogsWidth != dialogsWidth
|
||||
|| _a_dialogsWidth.animating())) {
|
||||
_dialogs->startWidthAnimation();
|
||||
|
@ -2709,8 +2722,10 @@ void MainWidget::handleHistoryBack() {
|
|||
}
|
||||
|
||||
void MainWidget::updateWindowAdaptiveLayout() {
|
||||
const auto nochat = !_controller->mainSectionShown();
|
||||
|
||||
auto layout = _controller->computeColumnLayout();
|
||||
auto dialogsWidthRatio = Core::App().settings().dialogsWidthRatio();
|
||||
auto dialogsWidthRatio = Core::App().settings().dialogsWidthRatio(nochat);
|
||||
|
||||
// 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.
|
||||
|
@ -2753,7 +2768,7 @@ void MainWidget::updateWindowAdaptiveLayout() {
|
|||
//}
|
||||
}
|
||||
|
||||
Core::App().settings().setDialogsWidthRatio(dialogsWidthRatio);
|
||||
Core::App().settings().updateDialogsWidthRatio(dialogsWidthRatio, nochat);
|
||||
|
||||
auto useSmallColumnWidth = !isOneColumn()
|
||||
&& !dialogsWidthRatio
|
||||
|
|
|
@ -250,6 +250,7 @@ private:
|
|||
void handleAudioUpdate(const Media::Player::TrackState &state);
|
||||
void updateMediaPlaylistPosition(int x);
|
||||
void updateControlsGeometry();
|
||||
void updateMainSectionShown();
|
||||
void updateDialogsWidthAnimated();
|
||||
void updateThirdColumnToCurrentChat(
|
||||
Dialogs::Key key,
|
||||
|
@ -278,7 +279,6 @@ private:
|
|||
void showNewSection(
|
||||
std::shared_ptr<Window::SectionMemento> memento,
|
||||
const SectionShow ¶ms);
|
||||
void dropMainSection(Window::SectionWidget *widget);
|
||||
|
||||
Window::SectionSlideParams prepareThirdSectionAnimation(Window::SectionWidget *section);
|
||||
|
||||
|
|
|
@ -400,7 +400,7 @@ bool ReadSetting(
|
|||
stream >> v;
|
||||
if (!CheckStreamStatus(stream)) return false;
|
||||
|
||||
Core::App().settings().setDialogsWidthRatio(v / 1000000.);
|
||||
Core::App().settings().updateDialogsWidthRatio(v / 1000000., false);
|
||||
context.legacyRead = true;
|
||||
} break;
|
||||
|
||||
|
|
|
@ -1946,7 +1946,10 @@ int SessionController::countDialogsWidthFromRatio(int bodyWidth) const {
|
|||
if (!_isPrimary) {
|
||||
return 0;
|
||||
}
|
||||
auto result = qRound(bodyWidth * Core::App().settings().dialogsWidthRatio());
|
||||
const auto nochat = !mainSectionShown();
|
||||
const auto width = bodyWidth
|
||||
* Core::App().settings().dialogsWidthRatio(nochat);
|
||||
auto result = qRound(width);
|
||||
accumulate_max(result, st::columnMinimalWidthLeft);
|
||||
// accumulate_min(result, st::columnMaximalWidthLeft);
|
||||
return result;
|
||||
|
@ -2035,10 +2038,12 @@ void SessionController::resizeForThirdSection() {
|
|||
if (extendBy != settings.thirdColumnWidth()) {
|
||||
settings.setThirdColumnWidth(extendBy);
|
||||
}
|
||||
const auto nochat = !mainSectionShown();
|
||||
auto newBodyWidth = layout.bodyWidth + extendedBy;
|
||||
auto currentRatio = settings.dialogsWidthRatio();
|
||||
settings.setDialogsWidthRatio(
|
||||
(currentRatio * layout.bodyWidth) / newBodyWidth);
|
||||
auto currentRatio = settings.dialogsWidthRatio(nochat);
|
||||
settings.updateDialogsWidthRatio(
|
||||
(currentRatio * layout.bodyWidth) / newBodyWidth,
|
||||
nochat);
|
||||
}
|
||||
auto savedValue = (extendedBy == extendBy) ? -1 : extendedBy;
|
||||
settings.setThirdSectionExtendedBy(savedValue);
|
||||
|
@ -2054,6 +2059,7 @@ void SessionController::closeThirdSection() {
|
|||
auto newWindowSize = widget()->size();
|
||||
auto layout = computeColumnLayout();
|
||||
if (layout.windowLayout == Adaptive::WindowLayout::ThreeColumn) {
|
||||
const auto nochat = !mainSectionShown();
|
||||
auto noResize = widget()->isFullScreen()
|
||||
|| widget()->isMaximized();
|
||||
auto savedValue = settings.thirdSectionExtendedBy();
|
||||
|
@ -2063,9 +2069,10 @@ void SessionController::closeThirdSection() {
|
|||
auto newBodyWidth = noResize
|
||||
? layout.bodyWidth
|
||||
: (layout.bodyWidth - extendedBy);
|
||||
auto currentRatio = settings.dialogsWidthRatio();
|
||||
settings.setDialogsWidthRatio(
|
||||
(currentRatio * layout.bodyWidth) / newBodyWidth);
|
||||
auto currentRatio = settings.dialogsWidthRatio(nochat);
|
||||
settings.updateDialogsWidthRatio(
|
||||
(currentRatio * layout.bodyWidth) / newBodyWidth,
|
||||
nochat);
|
||||
newWindowSize = QSize(
|
||||
widget()->width() + (newBodyWidth - layout.bodyWidth),
|
||||
widget()->height());
|
||||
|
|
|
@ -515,6 +515,16 @@ public:
|
|||
std::optional<bool> show = std::nullopt) const;
|
||||
void finishChatThemeEdit(not_null<PeerData*> peer);
|
||||
|
||||
[[nodiscard]] bool mainSectionShown() const {
|
||||
return _mainSectionShown.current();
|
||||
}
|
||||
[[nodiscard]] rpl::producer<bool> mainSectionShownChanges() const {
|
||||
return _mainSectionShown.changes();
|
||||
}
|
||||
void setMainSectionShown(bool value) {
|
||||
_mainSectionShown = value;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool chatsForceDisplayWide() const {
|
||||
return _chatsForceDisplayWide.current();
|
||||
}
|
||||
|
@ -678,6 +688,7 @@ private:
|
|||
rpl::variable<Dialogs::Key> _searchInChat;
|
||||
rpl::variable<Dialogs::RowDescriptor> _activeChatEntry;
|
||||
rpl::lifetime _activeHistoryLifetime;
|
||||
rpl::variable<bool> _mainSectionShown = false;
|
||||
rpl::variable<bool> _chatsForceDisplayWide = false;
|
||||
std::deque<Dialogs::RowDescriptor> _chatEntryHistory;
|
||||
int _chatEntryHistoryPosition = -1;
|
||||
|
|
Loading…
Add table
Reference in a new issue