2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-10-15 14:26:04 +00:00

Allow editing topic title and icon.

This commit is contained in:
John Preston
2022-09-27 16:05:47 +04:00
parent c90f879c96
commit 3b3792ef75
42 changed files with 603 additions and 190 deletions

View File

@@ -33,6 +33,14 @@ Memento::Memento(not_null<PeerData*> peer, Section section)
: Memento(DefaultStack(peer, section)) {
}
Memento::Memento(not_null<Data::ForumTopic*> topic)
: Memento(topic, Section::Type::Profile) {
}
Memento::Memento(not_null<Data::ForumTopic*> topic, Section section)
: Memento(DefaultStack(topic, section)) {
}
Memento::Memento(Settings::Tag settings, Section section)
: Memento(DefaultStack(settings, section)) {
}
@@ -53,6 +61,14 @@ std::vector<std::shared_ptr<ContentMemento>> Memento::DefaultStack(
return result;
}
std::vector<std::shared_ptr<ContentMemento>> Memento::DefaultStack(
not_null<Data::ForumTopic*> topic,
Section section) {
auto result = std::vector<std::shared_ptr<ContentMemento>>();
result.push_back(DefaultContent(topic, section));
return result;
}
std::vector<std::shared_ptr<ContentMemento>> Memento::DefaultStack(
Settings::Tag settings,
Section section) {
@@ -111,6 +127,18 @@ std::shared_ptr<ContentMemento> Memento::DefaultContent(
Unexpected("Wrong section type in Info::Memento::DefaultContent()");
}
std::shared_ptr<ContentMemento> Memento::DefaultContent(
not_null<Data::ForumTopic*> topic,
Section section) {
switch (section.type()) {
case Section::Type::Profile:
return std::make_shared<Profile::Memento>(topic);
case Section::Type::Media:
return std::make_shared<Media::Memento>(topic, section.mediaType());
}
Unexpected("Wrong section type in Info::Memento::DefaultContent()");
}
object_ptr<Window::SectionWidget> Memento::createWidget(
QWidget *parent,
not_null<Window::SessionController*> controller,