mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Provide section title from the section class.
This commit is contained in:
parent
b1e3b9688e
commit
d9bbfeead1
20 changed files with 110 additions and 94 deletions
|
@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/search_field_controller.h"
|
#include "ui/search_field_controller.h"
|
||||||
#include "ui/widgets/scroll_area.h"
|
#include "ui/widgets/scroll_area.h"
|
||||||
#include "ui/ui_utility.h"
|
#include "ui/ui_utility.h"
|
||||||
|
#include "lang/lang_keys.h"
|
||||||
#include "data/data_user.h"
|
#include "data/data_user.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
|
@ -62,6 +63,10 @@ Widget::Widget(
|
||||||
user));
|
user));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpl::producer<QString> Widget::title() {
|
||||||
|
return tr::lng_profile_common_groups_section();
|
||||||
|
}
|
||||||
|
|
||||||
not_null<UserData*> Widget::user() const {
|
not_null<UserData*> Widget::user() const {
|
||||||
return _inner->user();
|
return _inner->user();
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,8 @@ public:
|
||||||
const QRect &geometry,
|
const QRect &geometry,
|
||||||
not_null<Memento*> memento);
|
not_null<Memento*> memento);
|
||||||
|
|
||||||
|
rpl::producer<QString> title() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void saveState(not_null<Memento*> memento);
|
void saveState(not_null<Memento*> memento);
|
||||||
void restoreState(not_null<Memento*> memento);
|
void restoreState(not_null<Memento*> memento);
|
||||||
|
|
|
@ -101,6 +101,10 @@ void Widget::selectionAction(SelectionAction action) {
|
||||||
_inner->selectionAction(action);
|
_inner->selectionAction(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpl::producer<QString> Widget::title() {
|
||||||
|
return tr::lng_downloads_section();
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<Info::Memento> Make(not_null<UserData*> self) {
|
std::shared_ptr<Info::Memento> Make(not_null<UserData*> self) {
|
||||||
return std::make_shared<Info::Memento>(
|
return std::make_shared<Info::Memento>(
|
||||||
std::vector<std::shared_ptr<ContentMemento>>(
|
std::vector<std::shared_ptr<ContentMemento>>(
|
||||||
|
|
|
@ -57,6 +57,8 @@ public:
|
||||||
rpl::producer<SelectedItems> selectedListValue() const override;
|
rpl::producer<SelectedItems> selectedListValue() const override;
|
||||||
void selectionAction(SelectionAction action) override;
|
void selectionAction(SelectionAction action) override;
|
||||||
|
|
||||||
|
rpl::producer<QString> title() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void saveState(not_null<Memento*> memento);
|
void saveState(not_null<Memento*> memento);
|
||||||
void restoreState(not_null<Memento*> memento);
|
void restoreState(not_null<Memento*> memento);
|
||||||
|
|
|
@ -100,6 +100,14 @@ std::shared_ptr<ContentMemento> ContentWidget::createMemento() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ContentWidget::setIsStackBottom(bool isStackBottom) {
|
||||||
|
_isStackBottom = isStackBottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ContentWidget::isStackBottom() const {
|
||||||
|
return _isStackBottom;
|
||||||
|
}
|
||||||
|
|
||||||
void ContentWidget::paintEvent(QPaintEvent *e) {
|
void ContentWidget::paintEvent(QPaintEvent *e) {
|
||||||
Painter p(this);
|
Painter p(this);
|
||||||
p.fillRect(e->rect(), _bg);
|
p.fillRect(e->rect(), _bg);
|
||||||
|
|
|
@ -45,8 +45,8 @@ public:
|
||||||
not_null<ContentMemento*> memento) = 0;
|
not_null<ContentMemento*> memento) = 0;
|
||||||
std::shared_ptr<ContentMemento> createMemento();
|
std::shared_ptr<ContentMemento> createMemento();
|
||||||
|
|
||||||
virtual void setIsStackBottom(bool isStackBottom) {
|
virtual void setIsStackBottom(bool isStackBottom);
|
||||||
}
|
[[nodiscard]] bool isStackBottom() const;
|
||||||
|
|
||||||
rpl::producer<int> scrollHeightValue() const;
|
rpl::producer<int> scrollHeightValue() const;
|
||||||
rpl::producer<int> desiredHeightValue() const override;
|
rpl::producer<int> desiredHeightValue() const override;
|
||||||
|
@ -73,6 +73,8 @@ public:
|
||||||
virtual void selectionAction(SelectionAction action) {
|
virtual void selectionAction(SelectionAction action) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] virtual rpl::producer<QString> title() = 0;
|
||||||
|
|
||||||
virtual void saveChanges(FnMut<void()> done);
|
virtual void saveChanges(FnMut<void()> done);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -111,6 +113,7 @@ private:
|
||||||
base::unique_qptr<Ui::RpWidget> _searchWrap = nullptr;
|
base::unique_qptr<Ui::RpWidget> _searchWrap = nullptr;
|
||||||
QPointer<Ui::InputField> _searchField;
|
QPointer<Ui::InputField> _searchField;
|
||||||
int _innerDesiredHeight = 0;
|
int _innerDesiredHeight = 0;
|
||||||
|
bool _isStackBottom = false;
|
||||||
|
|
||||||
// Saving here topDelta in setGeometryWithTopMoved() to get it passed to resizeEvent().
|
// Saving here topDelta in setGeometryWithTopMoved() to get it passed to resizeEvent().
|
||||||
int _topDelta = 0;
|
int _topDelta = 0;
|
||||||
|
|
|
@ -560,75 +560,4 @@ void TopBar::performDelete() {
|
||||||
_selectionActionRequests.fire(SelectionAction::Delete);
|
_selectionActionRequests.fire(SelectionAction::Delete);
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<QString> TitleValue(
|
|
||||||
const Section §ion,
|
|
||||||
Key key,
|
|
||||||
bool isStackBottom) {
|
|
||||||
const auto peer = key.peer();
|
|
||||||
|
|
||||||
switch (section.type()) {
|
|
||||||
case Section::Type::Profile:
|
|
||||||
if (const auto user = peer->asUser()) {
|
|
||||||
return (user->isBot() && !user->isSupport())
|
|
||||||
? tr::lng_info_bot_title()
|
|
||||||
: tr::lng_info_user_title();
|
|
||||||
} else if (const auto channel = peer->asChannel()) {
|
|
||||||
return channel->isMegagroup()
|
|
||||||
? tr::lng_info_group_title()
|
|
||||||
: tr::lng_info_channel_title();
|
|
||||||
} else if (peer->isChat()) {
|
|
||||||
return tr::lng_info_group_title();
|
|
||||||
}
|
|
||||||
Unexpected("Bad peer type in Info::TitleValue()");
|
|
||||||
|
|
||||||
case Section::Type::Media:
|
|
||||||
if (peer->sharedMediaInfo() && isStackBottom) {
|
|
||||||
return tr::lng_profile_shared_media();
|
|
||||||
}
|
|
||||||
switch (section.mediaType()) {
|
|
||||||
case Section::MediaType::Photo:
|
|
||||||
return tr::lng_media_type_photos();
|
|
||||||
case Section::MediaType::GIF:
|
|
||||||
return tr::lng_media_type_gifs();
|
|
||||||
case Section::MediaType::Video:
|
|
||||||
return tr::lng_media_type_videos();
|
|
||||||
case Section::MediaType::MusicFile:
|
|
||||||
return tr::lng_media_type_songs();
|
|
||||||
case Section::MediaType::File:
|
|
||||||
return tr::lng_media_type_files();
|
|
||||||
case Section::MediaType::RoundVoiceFile:
|
|
||||||
return tr::lng_media_type_audios();
|
|
||||||
case Section::MediaType::Link:
|
|
||||||
return tr::lng_media_type_links();
|
|
||||||
case Section::MediaType::RoundFile:
|
|
||||||
return tr::lng_media_type_rounds();
|
|
||||||
}
|
|
||||||
Unexpected("Bad media type in Info::TitleValue()");
|
|
||||||
|
|
||||||
case Section::Type::CommonGroups:
|
|
||||||
return tr::lng_profile_common_groups_section();
|
|
||||||
|
|
||||||
case Section::Type::Members:
|
|
||||||
if (const auto channel = peer->asChannel()) {
|
|
||||||
return channel->isMegagroup()
|
|
||||||
? tr::lng_profile_participants_section()
|
|
||||||
: tr::lng_profile_subscribers_section();
|
|
||||||
}
|
|
||||||
return tr::lng_profile_participants_section();
|
|
||||||
|
|
||||||
case Section::Type::Settings:
|
|
||||||
return section.settingsType()()->title();
|
|
||||||
|
|
||||||
case Section::Type::PollResults:
|
|
||||||
return key.poll()->quiz()
|
|
||||||
? tr::lng_polls_quiz_results_title()
|
|
||||||
: tr::lng_polls_poll_results_title();
|
|
||||||
|
|
||||||
case Section::Type::Downloads:
|
|
||||||
return tr::lng_downloads_section();
|
|
||||||
|
|
||||||
}
|
|
||||||
Unexpected("Bad section type in Info::TitleValue()");
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Info
|
} // namespace Info
|
||||||
|
|
|
@ -35,11 +35,6 @@ namespace Info {
|
||||||
class Key;
|
class Key;
|
||||||
class Section;
|
class Section;
|
||||||
|
|
||||||
rpl::producer<QString> TitleValue(
|
|
||||||
const Section §ion,
|
|
||||||
Key key,
|
|
||||||
bool isStackBottom);
|
|
||||||
|
|
||||||
class TopBar : public Ui::RpWidget {
|
class TopBar : public Ui::RpWidget {
|
||||||
public:
|
public:
|
||||||
TopBar(
|
TopBar(
|
||||||
|
|
|
@ -355,10 +355,6 @@ void WrapWidget::createTopBar() {
|
||||||
_content->selectionAction(action);
|
_content->selectionAction(action);
|
||||||
}, _topBar->lifetime());
|
}, _topBar->lifetime());
|
||||||
|
|
||||||
_topBar->setTitle(TitleValue(
|
|
||||||
_controller->section(),
|
|
||||||
_controller->key(),
|
|
||||||
!hasStackHistory()));
|
|
||||||
if (wrapValue == Wrap::Narrow || hasStackHistory()) {
|
if (wrapValue == Wrap::Narrow || hasStackHistory()) {
|
||||||
_topBar->enableBackButton();
|
_topBar->enableBackButton();
|
||||||
_topBar->backRequest(
|
_topBar->backRequest(
|
||||||
|
@ -616,8 +612,9 @@ void WrapWidget::showContent(object_ptr<ContentWidget> content) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WrapWidget::finishShowContent() {
|
void WrapWidget::finishShowContent() {
|
||||||
_content->setIsStackBottom(!hasStackHistory());
|
|
||||||
updateContentGeometry();
|
updateContentGeometry();
|
||||||
|
_content->setIsStackBottom(!hasStackHistory());
|
||||||
|
_topBar->setTitle(_content->title());
|
||||||
_desiredHeights.fire(desiredHeightForContent());
|
_desiredHeights.fire(desiredHeightForContent());
|
||||||
_desiredShadowVisibilities.fire(_content->desiredShadowVisibility());
|
_desiredShadowVisibilities.fire(_content->desiredShadowVisibility());
|
||||||
_selectedLists.fire(_content->selectedListValue());
|
_selectedLists.fire(_content->selectedListValue());
|
||||||
|
|
|
@ -15,6 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/ui_utility.h"
|
#include "ui/ui_utility.h"
|
||||||
#include "data/data_peer.h"
|
#include "data/data_peer.h"
|
||||||
#include "data/data_user.h"
|
#include "data/data_user.h"
|
||||||
|
#include "lang/lang_keys.h"
|
||||||
#include "styles/style_info.h"
|
#include "styles/style_info.h"
|
||||||
|
|
||||||
namespace Info {
|
namespace Info {
|
||||||
|
@ -97,7 +98,33 @@ void Widget::selectionAction(SelectionAction action) {
|
||||||
_inner->selectionAction(action);
|
_inner->selectionAction(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpl::producer<QString> Widget::title() {
|
||||||
|
if (controller()->key().peer()->sharedMediaInfo() && isStackBottom()) {
|
||||||
|
return tr::lng_profile_shared_media();
|
||||||
|
}
|
||||||
|
switch (controller()->section().mediaType()) {
|
||||||
|
case Section::MediaType::Photo:
|
||||||
|
return tr::lng_media_type_photos();
|
||||||
|
case Section::MediaType::GIF:
|
||||||
|
return tr::lng_media_type_gifs();
|
||||||
|
case Section::MediaType::Video:
|
||||||
|
return tr::lng_media_type_videos();
|
||||||
|
case Section::MediaType::MusicFile:
|
||||||
|
return tr::lng_media_type_songs();
|
||||||
|
case Section::MediaType::File:
|
||||||
|
return tr::lng_media_type_files();
|
||||||
|
case Section::MediaType::RoundVoiceFile:
|
||||||
|
return tr::lng_media_type_audios();
|
||||||
|
case Section::MediaType::Link:
|
||||||
|
return tr::lng_media_type_links();
|
||||||
|
case Section::MediaType::RoundFile:
|
||||||
|
return tr::lng_media_type_rounds();
|
||||||
|
}
|
||||||
|
Unexpected("Bad media type in Info::TitleValue()");
|
||||||
|
}
|
||||||
|
|
||||||
void Widget::setIsStackBottom(bool isStackBottom) {
|
void Widget::setIsStackBottom(bool isStackBottom) {
|
||||||
|
ContentWidget::setIsStackBottom(isStackBottom);
|
||||||
_inner->setIsStackBottom(isStackBottom);
|
_inner->setIsStackBottom(isStackBottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,6 +108,8 @@ public:
|
||||||
rpl::producer<SelectedItems> selectedListValue() const override;
|
rpl::producer<SelectedItems> selectedListValue() const override;
|
||||||
void selectionAction(SelectionAction action) override;
|
void selectionAction(SelectionAction action) override;
|
||||||
|
|
||||||
|
rpl::producer<QString> title() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void saveState(not_null<Memento*> memento);
|
void saveState(not_null<Memento*> memento);
|
||||||
void restoreState(not_null<Memento*> memento);
|
void restoreState(not_null<Memento*> memento);
|
||||||
|
|
|
@ -11,6 +11,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "info/info_controller.h"
|
#include "info/info_controller.h"
|
||||||
#include "ui/widgets/scroll_area.h"
|
#include "ui/widgets/scroll_area.h"
|
||||||
#include "ui/ui_utility.h"
|
#include "ui/ui_utility.h"
|
||||||
|
#include "data/data_peer.h"
|
||||||
|
#include "data/data_channel.h"
|
||||||
|
#include "lang/lang_keys.h"
|
||||||
#include "styles/style_info.h"
|
#include "styles/style_info.h"
|
||||||
|
|
||||||
namespace Info {
|
namespace Info {
|
||||||
|
@ -79,6 +82,15 @@ void Widget::setInternalState(
|
||||||
restoreState(memento);
|
restoreState(memento);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpl::producer<QString> Widget::title() {
|
||||||
|
if (const auto channel = controller()->key().peer()->asChannel()) {
|
||||||
|
return channel->isMegagroup()
|
||||||
|
? tr::lng_profile_participants_section()
|
||||||
|
: tr::lng_profile_subscribers_section();
|
||||||
|
}
|
||||||
|
return tr::lng_profile_participants_section();
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<ContentMemento> Widget::doCreateMemento() {
|
std::shared_ptr<ContentMemento> Widget::doCreateMemento() {
|
||||||
auto result = std::make_shared<Memento>(controller());
|
auto result = std::make_shared<Memento>(controller());
|
||||||
saveState(result.get());
|
saveState(result.get());
|
||||||
|
|
|
@ -56,6 +56,8 @@ public:
|
||||||
const QRect &geometry,
|
const QRect &geometry,
|
||||||
not_null<Memento*> memento);
|
not_null<Memento*> memento);
|
||||||
|
|
||||||
|
rpl::producer<QString> title() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void saveState(not_null<Memento*> memento);
|
void saveState(not_null<Memento*> memento);
|
||||||
void restoreState(not_null<Memento*> memento);
|
void restoreState(not_null<Memento*> memento);
|
||||||
|
|
|
@ -9,6 +9,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include "info/polls/info_polls_results_inner_widget.h"
|
#include "info/polls/info_polls_results_inner_widget.h"
|
||||||
#include "boxes/peer_list_box.h"
|
#include "boxes/peer_list_box.h"
|
||||||
|
#include "lang/lang_keys.h"
|
||||||
|
#include "data/data_poll.h"
|
||||||
|
|
||||||
namespace Info {
|
namespace Info {
|
||||||
namespace Polls {
|
namespace Polls {
|
||||||
|
@ -88,6 +90,12 @@ void Widget::setInternalState(
|
||||||
restoreState(memento);
|
restoreState(memento);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpl::producer<QString> Widget::title() {
|
||||||
|
return poll()->quiz()
|
||||||
|
? tr::lng_polls_quiz_results_title()
|
||||||
|
: tr::lng_polls_poll_results_title();
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<ContentMemento> Widget::doCreateMemento() {
|
std::shared_ptr<ContentMemento> Widget::doCreateMemento() {
|
||||||
auto result = std::make_shared<Memento>(poll(), contextId());
|
auto result = std::make_shared<Memento>(poll(), contextId());
|
||||||
saveState(result.get());
|
saveState(result.get());
|
||||||
|
|
|
@ -56,6 +56,8 @@ public:
|
||||||
const QRect &geometry,
|
const QRect &geometry,
|
||||||
not_null<Memento*> memento);
|
not_null<Memento*> memento);
|
||||||
|
|
||||||
|
rpl::producer<QString> title() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void saveState(not_null<Memento*> memento);
|
void saveState(not_null<Memento*> memento);
|
||||||
void restoreState(not_null<Memento*> memento);
|
void restoreState(not_null<Memento*> memento);
|
||||||
|
|
|
@ -44,9 +44,6 @@ public:
|
||||||
void saveState(not_null<Memento*> memento);
|
void saveState(not_null<Memento*> memento);
|
||||||
void restoreState(not_null<Memento*> memento);
|
void restoreState(not_null<Memento*> memento);
|
||||||
|
|
||||||
void setIsStackBottom(bool isStackBottom) {
|
|
||||||
_isStackBottom = isStackBottom;
|
|
||||||
}
|
|
||||||
rpl::producer<Ui::ScrollToRequest> scrollToRequests() const;
|
rpl::producer<Ui::ScrollToRequest> scrollToRequests() const;
|
||||||
rpl::producer<int> desiredHeightValue() const override;
|
rpl::producer<int> desiredHeightValue() const override;
|
||||||
|
|
||||||
|
@ -68,8 +65,6 @@ private:
|
||||||
bool canHideDetailsEver() const;
|
bool canHideDetailsEver() const;
|
||||||
rpl::producer<bool> canHideDetails() const;
|
rpl::producer<bool> canHideDetails() const;
|
||||||
|
|
||||||
rpl::variable<bool> _isStackBottom = true;
|
|
||||||
|
|
||||||
const not_null<Controller*> _controller;
|
const not_null<Controller*> _controller;
|
||||||
const not_null<PeerData*> _peer;
|
const not_null<PeerData*> _peer;
|
||||||
PeerData * const _migrated = nullptr;
|
PeerData * const _migrated = nullptr;
|
||||||
|
|
|
@ -11,6 +11,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "info/profile/info_profile_members.h"
|
#include "info/profile/info_profile_members.h"
|
||||||
#include "ui/widgets/scroll_area.h"
|
#include "ui/widgets/scroll_area.h"
|
||||||
#include "ui/ui_utility.h"
|
#include "ui/ui_utility.h"
|
||||||
|
#include "data/data_peer.h"
|
||||||
|
#include "data/data_channel.h"
|
||||||
|
#include "data/data_user.h"
|
||||||
|
#include "lang/lang_keys.h"
|
||||||
#include "info/info_controller.h"
|
#include "info/info_controller.h"
|
||||||
|
|
||||||
namespace Info {
|
namespace Info {
|
||||||
|
@ -72,14 +76,27 @@ Widget::Widget(
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::setIsStackBottom(bool isStackBottom) {
|
|
||||||
_inner->setIsStackBottom(isStackBottom);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Widget::setInnerFocus() {
|
void Widget::setInnerFocus() {
|
||||||
_inner->setFocus();
|
_inner->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpl::producer<QString> Widget::title() {
|
||||||
|
const auto peer = controller()->key().peer();
|
||||||
|
if (const auto user = peer->asUser()) {
|
||||||
|
return (user->isBot() && !user->isSupport())
|
||||||
|
? tr::lng_info_bot_title()
|
||||||
|
: tr::lng_info_user_title();
|
||||||
|
} else if (const auto channel = peer->asChannel()) {
|
||||||
|
return channel->isMegagroup()
|
||||||
|
? tr::lng_info_group_title()
|
||||||
|
: tr::lng_info_channel_title();
|
||||||
|
} else if (peer->isChat()) {
|
||||||
|
return tr::lng_info_group_title();
|
||||||
|
}
|
||||||
|
Unexpected("Bad peer type in Info::TitleValue()");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
bool Widget::showInternal(not_null<ContentMemento*> memento) {
|
bool Widget::showInternal(not_null<ContentMemento*> memento) {
|
||||||
if (!controller()->validateMementoPeer(memento)) {
|
if (!controller()->validateMementoPeer(memento)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -51,8 +51,6 @@ public:
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
not_null<Controller*> controller);
|
not_null<Controller*> controller);
|
||||||
|
|
||||||
void setIsStackBottom(bool isStackBottom) override;
|
|
||||||
|
|
||||||
bool showInternal(
|
bool showInternal(
|
||||||
not_null<ContentMemento*> memento) override;
|
not_null<ContentMemento*> memento) override;
|
||||||
|
|
||||||
|
@ -62,6 +60,8 @@ public:
|
||||||
|
|
||||||
void setInnerFocus() override;
|
void setInnerFocus() override;
|
||||||
|
|
||||||
|
rpl::producer<QString> title() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void saveState(not_null<Memento*> memento);
|
void saveState(not_null<Memento*> memento);
|
||||||
void restoreState(not_null<Memento*> memento);
|
void restoreState(not_null<Memento*> memento);
|
||||||
|
|
|
@ -90,6 +90,10 @@ rpl::producer<bool> Widget::desiredShadowVisibility() const {
|
||||||
: rpl::single(true);
|
: rpl::single(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpl::producer<QString> Widget::title() {
|
||||||
|
return _type()->title();
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<ContentMemento> Widget::doCreateMemento() {
|
std::shared_ptr<ContentMemento> Widget::doCreateMemento() {
|
||||||
auto result = std::make_shared<Memento>(self(), _type);
|
auto result = std::make_shared<Memento>(self(), _type);
|
||||||
saveState(result.get());
|
saveState(result.get());
|
||||||
|
|
|
@ -67,6 +67,8 @@ public:
|
||||||
|
|
||||||
rpl::producer<bool> desiredShadowVisibility() const override;
|
rpl::producer<bool> desiredShadowVisibility() const override;
|
||||||
|
|
||||||
|
rpl::producer<QString> title() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void saveState(not_null<Memento*> memento);
|
void saveState(not_null<Memento*> memento);
|
||||||
void restoreState(not_null<Memento*> memento);
|
void restoreState(not_null<Memento*> memento);
|
||||||
|
|
Loading…
Add table
Reference in a new issue