mirror of https://github.com/procxx/kepka.git
Section dummies for new Settings.
This commit is contained in:
parent
4f16ad6757
commit
f0d092f126
|
@ -2127,6 +2127,7 @@ void UpdateApplication() {
|
||||||
cSetLastUpdateCheck(0);
|
cSetLastUpdateCheck(0);
|
||||||
Core::UpdateChecker().start();
|
Core::UpdateChecker().start();
|
||||||
if (const auto window = App::wnd()) {
|
if (const auto window = App::wnd()) {
|
||||||
|
// #TODO settings
|
||||||
auto settings = Box<OldSettings::Widget>();
|
auto settings = Box<OldSettings::Widget>();
|
||||||
const auto weak = make_weak(settings.data());
|
const auto weak = make_weak(settings.data());
|
||||||
window->showSpecialLayer(std::move(settings), anim::type::normal);
|
window->showSpecialLayer(std::move(settings), anim::type::normal);
|
||||||
|
|
|
@ -160,10 +160,6 @@ void ContentWidget::setScrollTopSkip(int scrollTopSkip) {
|
||||||
_scrollTopSkip = scrollTopSkip;
|
_scrollTopSkip = scrollTopSkip;
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<Section> ContentWidget::sectionRequest() const {
|
|
||||||
return rpl::never<Section>();
|
|
||||||
}
|
|
||||||
|
|
||||||
rpl::producer<int> ContentWidget::scrollHeightValue() const {
|
rpl::producer<int> ContentWidget::scrollHeightValue() const {
|
||||||
return _scroll->heightValue();
|
return _scroll->heightValue();
|
||||||
}
|
}
|
||||||
|
@ -253,4 +249,18 @@ void ContentWidget::refreshSearchField(bool shown) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Key ContentMemento::key() const {
|
||||||
|
if (const auto peerId = this->peerId()) {
|
||||||
|
return Key(App::peer(peerId));
|
||||||
|
} else if (const auto feed = this->feed()) {
|
||||||
|
return Key(feed);
|
||||||
|
} else {
|
||||||
|
return Settings::Tag{ settingsSelf() };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ContentMemento::ContentMemento(Settings::Tag settings)
|
||||||
|
: _settingsSelf(settings.self.get()) {
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Info
|
} // namespace Info
|
||||||
|
|
|
@ -28,6 +28,9 @@ class Feed;
|
||||||
} // namespace Data
|
} // namespace Data
|
||||||
|
|
||||||
namespace Info {
|
namespace Info {
|
||||||
|
namespace Settings {
|
||||||
|
struct Tag;
|
||||||
|
} // namespace Settings
|
||||||
|
|
||||||
class ContentMemento;
|
class ContentMemento;
|
||||||
class Controller;
|
class Controller;
|
||||||
|
@ -42,7 +45,6 @@ public:
|
||||||
not_null<ContentMemento*> memento) = 0;
|
not_null<ContentMemento*> memento) = 0;
|
||||||
std::unique_ptr<ContentMemento> createMemento();
|
std::unique_ptr<ContentMemento> createMemento();
|
||||||
|
|
||||||
virtual rpl::producer<Section> sectionRequest() const;
|
|
||||||
virtual void setIsStackBottom(bool isStackBottom) {
|
virtual void setIsStackBottom(bool isStackBottom) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,9 +121,9 @@ public:
|
||||||
: _peerId(peerId)
|
: _peerId(peerId)
|
||||||
, _migratedPeerId(migratedPeerId) {
|
, _migratedPeerId(migratedPeerId) {
|
||||||
}
|
}
|
||||||
explicit ContentMemento(not_null<Data::Feed*> feed)
|
explicit ContentMemento(not_null<Data::Feed*> feed) : _feed(feed) {
|
||||||
: _feed(feed) {
|
|
||||||
}
|
}
|
||||||
|
explicit ContentMemento(Settings::Tag settings);
|
||||||
|
|
||||||
virtual object_ptr<ContentWidget> createWidget(
|
virtual object_ptr<ContentWidget> createWidget(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
|
@ -137,6 +139,10 @@ public:
|
||||||
Data::Feed *feed() const {
|
Data::Feed *feed() const {
|
||||||
return _feed;
|
return _feed;
|
||||||
}
|
}
|
||||||
|
UserData *settingsSelf() const {
|
||||||
|
return _settingsSelf;
|
||||||
|
}
|
||||||
|
Key key() const;
|
||||||
|
|
||||||
virtual Section section() const = 0;
|
virtual Section section() const = 0;
|
||||||
|
|
||||||
|
@ -171,6 +177,7 @@ private:
|
||||||
const PeerId _peerId = 0;
|
const PeerId _peerId = 0;
|
||||||
const PeerId _migratedPeerId = 0;
|
const PeerId _migratedPeerId = 0;
|
||||||
Data::Feed * const _feed = nullptr;
|
Data::Feed * const _feed = nullptr;
|
||||||
|
UserData * const _settingsSelf = nullptr;
|
||||||
int _scrollTop = 0;
|
int _scrollTop = 0;
|
||||||
QString _searchFieldQuery;
|
QString _searchFieldQuery;
|
||||||
bool _searchEnabledByContent = false;
|
bool _searchEnabledByContent = false;
|
||||||
|
|
|
@ -38,6 +38,9 @@ Key::Key(not_null<PeerData*> peer) : _value(peer) {
|
||||||
Key::Key(not_null<Data::Feed*> feed) : _value(feed) {
|
Key::Key(not_null<Data::Feed*> feed) : _value(feed) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Key::Key(Settings::Tag settings) : _value(settings) {
|
||||||
|
}
|
||||||
|
|
||||||
PeerData *Key::peer() const {
|
PeerData *Key::peer() const {
|
||||||
if (const auto peer = base::get_if<not_null<PeerData*>>(&_value)) {
|
if (const auto peer = base::get_if<not_null<PeerData*>>(&_value)) {
|
||||||
return *peer;
|
return *peer;
|
||||||
|
@ -52,6 +55,13 @@ Data::Feed *Key::feed() const {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UserData *Key::settingsSelf() const {
|
||||||
|
if (const auto tag = base::get_if<Settings::Tag>(&_value)) {
|
||||||
|
return tag->self;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
rpl::producer<SparseIdsMergedSlice> AbstractController::mediaSource(
|
rpl::producer<SparseIdsMergedSlice> AbstractController::mediaSource(
|
||||||
SparseIdsMergedSlice::UniversalMsgId aroundId,
|
SparseIdsMergedSlice::UniversalMsgId aroundId,
|
||||||
int limitBefore,
|
int limitBefore,
|
||||||
|
@ -88,9 +98,7 @@ Controller::Controller(
|
||||||
not_null<ContentMemento*> memento)
|
not_null<ContentMemento*> memento)
|
||||||
: AbstractController(window)
|
: AbstractController(window)
|
||||||
, _widget(widget)
|
, _widget(widget)
|
||||||
, _key(memento->peerId()
|
, _key(memento->key())
|
||||||
? Key(App::peer(memento->peerId()))
|
|
||||||
: Key(memento->feed()))
|
|
||||||
, _migrated(memento->migratedPeerId()
|
, _migrated(memento->migratedPeerId()
|
||||||
? App::peer(memento->migratedPeerId())
|
? App::peer(memento->migratedPeerId())
|
||||||
: nullptr)
|
: nullptr)
|
||||||
|
@ -135,7 +143,8 @@ bool Controller::validateMementoPeer(
|
||||||
not_null<ContentMemento*> memento) const {
|
not_null<ContentMemento*> memento) const {
|
||||||
return memento->peerId() == peerId()
|
return memento->peerId() == peerId()
|
||||||
&& memento->migratedPeerId() == migratedPeerId()
|
&& memento->migratedPeerId() == migratedPeerId()
|
||||||
&& memento->feed() == feed();
|
&& memento->feed() == feed()
|
||||||
|
&& memento->settingsSelf() == settingsSelf();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::setSection(not_null<ContentMemento*> memento) {
|
void Controller::setSection(not_null<ContentMemento*> memento) {
|
||||||
|
|
|
@ -10,23 +10,39 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include <rpl/variable.h>
|
#include <rpl/variable.h>
|
||||||
#include "data/data_search_controller.h"
|
#include "data/data_search_controller.h"
|
||||||
#include "window/window_controller.h"
|
#include "window/window_controller.h"
|
||||||
|
#include "settings/settings_common.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class SearchFieldController;
|
class SearchFieldController;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
namespace Info {
|
namespace Info {
|
||||||
|
namespace Settings {
|
||||||
|
|
||||||
|
struct Tag {
|
||||||
|
explicit Tag(not_null<UserData*> self) : self(self) {
|
||||||
|
}
|
||||||
|
|
||||||
|
not_null<UserData*> self;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Settings
|
||||||
|
|
||||||
class Key {
|
class Key {
|
||||||
public:
|
public:
|
||||||
Key(not_null<PeerData*> peer);
|
Key(not_null<PeerData*> peer);
|
||||||
Key(not_null<Data::Feed*> feed);
|
Key(not_null<Data::Feed*> feed);
|
||||||
|
Key(Settings::Tag settings);
|
||||||
|
|
||||||
PeerData *peer() const;
|
PeerData *peer() const;
|
||||||
Data::Feed *feed() const;
|
Data::Feed *feed() const;
|
||||||
|
UserData *settingsSelf() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
base::variant<not_null<PeerData*>, not_null<Data::Feed*>> _value;
|
base::variant<
|
||||||
|
not_null<PeerData*>,
|
||||||
|
not_null<Data::Feed*>,
|
||||||
|
Settings::Tag> _value;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -43,28 +59,41 @@ public:
|
||||||
CommonGroups,
|
CommonGroups,
|
||||||
Members,
|
Members,
|
||||||
Channels,
|
Channels,
|
||||||
|
Settings,
|
||||||
};
|
};
|
||||||
|
using SettingsType = ::Settings::Type;
|
||||||
using MediaType = Storage::SharedMediaType;
|
using MediaType = Storage::SharedMediaType;
|
||||||
|
|
||||||
Section(Type type) : _type(type) {
|
Section(Type type) : _type(type) {
|
||||||
Expects(type != Type::Media);
|
Expects(type != Type::Media && type != Type::Settings);
|
||||||
}
|
}
|
||||||
Section(MediaType mediaType)
|
Section(MediaType mediaType)
|
||||||
: _type(Type::Media)
|
: _type(Type::Media)
|
||||||
, _mediaType(mediaType) {
|
, _mediaType(mediaType) {
|
||||||
}
|
}
|
||||||
|
Section(SettingsType settingsType)
|
||||||
|
: _type(Type::Settings)
|
||||||
|
, _settingsType(settingsType) {
|
||||||
|
}
|
||||||
|
|
||||||
Type type() const {
|
Type type() const {
|
||||||
return _type;
|
return _type;
|
||||||
}
|
}
|
||||||
MediaType mediaType() const {
|
MediaType mediaType() const {
|
||||||
Expects(_type == Type::Media);
|
Expects(_type == Type::Media);
|
||||||
|
|
||||||
return _mediaType;
|
return _mediaType;
|
||||||
}
|
}
|
||||||
|
SettingsType settingsType() const {
|
||||||
|
Expects(_type == Type::Settings);
|
||||||
|
|
||||||
|
return _settingsType;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Type _type;
|
Type _type;
|
||||||
Storage::SharedMediaType _mediaType;
|
MediaType _mediaType = MediaType();
|
||||||
|
SettingsType _settingsType = SettingsType();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -93,6 +122,9 @@ public:
|
||||||
Data::Feed *feed() const {
|
Data::Feed *feed() const {
|
||||||
return key().feed();
|
return key().feed();
|
||||||
}
|
}
|
||||||
|
UserData *settingsSelf() const {
|
||||||
|
return key().settingsSelf();
|
||||||
|
}
|
||||||
|
|
||||||
virtual void setSearchEnabledByContent(bool enabled) {
|
virtual void setSearchEnabledByContent(bool enabled) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "info/channels/info_channels_widget.h"
|
#include "info/channels/info_channels_widget.h"
|
||||||
#include "info/common_groups/info_common_groups_widget.h"
|
#include "info/common_groups/info_common_groups_widget.h"
|
||||||
#include "info/feed/info_feed_profile_widget.h"
|
#include "info/feed/info_feed_profile_widget.h"
|
||||||
|
#include "info/settings/info_settings_widget.h"
|
||||||
#include "info/info_section_widget.h"
|
#include "info/info_section_widget.h"
|
||||||
#include "info/info_layer_widget.h"
|
#include "info/info_layer_widget.h"
|
||||||
#include "info/info_controller.h"
|
#include "info/info_controller.h"
|
||||||
|
@ -32,6 +33,10 @@ Memento::Memento(not_null<Data::Feed*> feed, Section section)
|
||||||
: Memento(DefaultStack(feed, section)) {
|
: Memento(DefaultStack(feed, section)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Memento::Memento(Settings::Tag settings, Section section)
|
||||||
|
: Memento(DefaultStack(settings, section)) {
|
||||||
|
}
|
||||||
|
|
||||||
Memento::Memento(std::vector<std::unique_ptr<ContentMemento>> stack)
|
Memento::Memento(std::vector<std::unique_ptr<ContentMemento>> stack)
|
||||||
: _stack(std::move(stack)) {
|
: _stack(std::move(stack)) {
|
||||||
}
|
}
|
||||||
|
@ -52,6 +57,16 @@ std::vector<std::unique_ptr<ContentMemento>> Memento::DefaultStack(
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::unique_ptr<ContentMemento>> Memento::DefaultStack(
|
||||||
|
Settings::Tag settings,
|
||||||
|
Section section) {
|
||||||
|
auto result = std::vector<std::unique_ptr<ContentMemento>>();
|
||||||
|
result.push_back(std::make_unique<Settings::Memento>(
|
||||||
|
settings.self,
|
||||||
|
section.settingsType()));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
Section Memento::DefaultSection(Dialogs::Key key) {
|
Section Memento::DefaultSection(Dialogs::Key key) {
|
||||||
if (const auto peer = key.peer()) {
|
if (const auto peer = key.peer()) {
|
||||||
if (peer->isSelf()) {
|
if (peer->isSelf()) {
|
||||||
|
|
|
@ -26,16 +26,20 @@ struct ScrollToRequest;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
namespace Info {
|
namespace Info {
|
||||||
|
namespace Settings {
|
||||||
|
struct Tag;
|
||||||
|
} // namespace Settings
|
||||||
|
|
||||||
class ContentMemento;
|
class ContentMemento;
|
||||||
class WrapWidget;
|
class WrapWidget;
|
||||||
|
|
||||||
class Memento final : public Window::SectionMemento {
|
class Memento final : public Window::SectionMemento {
|
||||||
public:
|
public:
|
||||||
Memento(PeerId peerId);
|
explicit Memento(PeerId peerId);
|
||||||
Memento(PeerId peerId, Section section);
|
Memento(PeerId peerId, Section section);
|
||||||
Memento(not_null<Data::Feed*> feed, Section section);
|
Memento(not_null<Data::Feed*> feed, Section section);
|
||||||
Memento(std::vector<std::unique_ptr<ContentMemento>> stack);
|
Memento(Settings::Tag settings, Section section);
|
||||||
|
explicit Memento(std::vector<std::unique_ptr<ContentMemento>> stack);
|
||||||
|
|
||||||
object_ptr<Window::SectionWidget> createWidget(
|
object_ptr<Window::SectionWidget> createWidget(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
|
@ -54,6 +58,7 @@ public:
|
||||||
|
|
||||||
not_null<ContentMemento*> content() {
|
not_null<ContentMemento*> content() {
|
||||||
Expects(!_stack.empty());
|
Expects(!_stack.empty());
|
||||||
|
|
||||||
return _stack.back().get();
|
return _stack.back().get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,6 +74,9 @@ private:
|
||||||
static std::vector<std::unique_ptr<ContentMemento>> DefaultStack(
|
static std::vector<std::unique_ptr<ContentMemento>> DefaultStack(
|
||||||
not_null<Data::Feed*> feed,
|
not_null<Data::Feed*> feed,
|
||||||
Section section);
|
Section section);
|
||||||
|
static std::vector<std::unique_ptr<ContentMemento>> DefaultStack(
|
||||||
|
Settings::Tag settings,
|
||||||
|
Section section);
|
||||||
static std::unique_ptr<ContentMemento> DefaultContent(
|
static std::unique_ptr<ContentMemento> DefaultContent(
|
||||||
not_null<Data::Feed*> feed,
|
not_null<Data::Feed*> feed,
|
||||||
Section section);
|
Section section);
|
||||||
|
|
|
@ -587,6 +587,22 @@ rpl::producer<QString> TitleValue(
|
||||||
case Section::Type::Channels:
|
case Section::Type::Channels:
|
||||||
return lng_info_feed_channels;
|
return lng_info_feed_channels;
|
||||||
|
|
||||||
|
case Section::Type::Settings:
|
||||||
|
switch (section.settingsType()) {
|
||||||
|
case Section::SettingsType::Main:
|
||||||
|
return lng_menu_settings;
|
||||||
|
case Section::SettingsType::Information:
|
||||||
|
return lng_settings_section_info;
|
||||||
|
case Section::SettingsType::Notifications:
|
||||||
|
return lng_settings_section_notify;
|
||||||
|
case Section::SettingsType::PrivacySecurity:
|
||||||
|
return lng_settings_section_privacy;
|
||||||
|
case Section::SettingsType::General:
|
||||||
|
return lng_settings_section_general;
|
||||||
|
case Section::SettingsType::Chat:
|
||||||
|
return lng_settings_section_chat_settings;
|
||||||
|
}
|
||||||
|
Unexpected("Bad settings type in Info::TitleValue()");
|
||||||
}
|
}
|
||||||
Unexpected("Bad section type in Info::TitleValue()");
|
Unexpected("Bad section type in Info::TitleValue()");
|
||||||
}());
|
}());
|
||||||
|
|
|
@ -200,6 +200,8 @@ Dialogs::RowDescriptor WrapWidget::activeChat() const {
|
||||||
return Dialogs::RowDescriptor(App::history(peer), FullMsgId());
|
return Dialogs::RowDescriptor(App::history(peer), FullMsgId());
|
||||||
} else if (const auto feed = key().feed()) {
|
} else if (const auto feed = key().feed()) {
|
||||||
return Dialogs::RowDescriptor(feed, FullMsgId());
|
return Dialogs::RowDescriptor(feed, FullMsgId());
|
||||||
|
} else if (key().settingsSelf()) {
|
||||||
|
return Dialogs::RowDescriptor();
|
||||||
}
|
}
|
||||||
Unexpected("Owner in WrapWidget::activeChat().");
|
Unexpected("Owner in WrapWidget::activeChat().");
|
||||||
}
|
}
|
||||||
|
@ -512,6 +514,10 @@ void WrapWidget::showProfileMenu() {
|
||||||
feed,
|
feed,
|
||||||
addAction,
|
addAction,
|
||||||
Window::PeerMenuSource::Profile);
|
Window::PeerMenuSource::Profile);
|
||||||
|
} else if (const auto self = key().settingsSelf()) {
|
||||||
|
// #TODO settings top menu
|
||||||
|
_topBarMenu = nullptr;
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
_topBarMenu = nullptr;
|
_topBarMenu = nullptr;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -97,7 +97,7 @@ bool Widget::showInternal(not_null<ContentMemento*> memento) {
|
||||||
if (!controller()->validateMementoPeer(memento)) {
|
if (!controller()->validateMementoPeer(memento)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (auto mediaMemento = dynamic_cast<Memento*>(memento.get())) {
|
if (const auto mediaMemento = dynamic_cast<Memento*>(memento.get())) {
|
||||||
if (_inner->showInternal(mediaMemento)) {
|
if (_inner->showInternal(mediaMemento)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
/*
|
||||||
|
This file is part of Telegram Desktop,
|
||||||
|
the official desktop application for the Telegram messaging service.
|
||||||
|
|
||||||
|
For license and copyright information please follow this link:
|
||||||
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
*/
|
||||||
|
#include "info/settings/info_settings_widget.h"
|
||||||
|
|
||||||
|
#include "info/info_memento.h"
|
||||||
|
#include "settings/settings_common.h"
|
||||||
|
|
||||||
|
namespace Info {
|
||||||
|
namespace Settings {
|
||||||
|
|
||||||
|
Memento::Memento(not_null<UserData*> self, Type type)
|
||||||
|
: ContentMemento(Tag{ self })
|
||||||
|
, _type(type) {
|
||||||
|
}
|
||||||
|
|
||||||
|
Section Memento::section() const {
|
||||||
|
return Section(_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
object_ptr<ContentWidget> Memento::createWidget(
|
||||||
|
QWidget *parent,
|
||||||
|
not_null<Controller*> controller,
|
||||||
|
const QRect &geometry) {
|
||||||
|
auto result = object_ptr<Widget>(
|
||||||
|
parent,
|
||||||
|
controller);
|
||||||
|
result->setInternalState(geometry, this);
|
||||||
|
return std::move(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
Memento::~Memento() = default;
|
||||||
|
|
||||||
|
Widget::Widget(
|
||||||
|
QWidget *parent,
|
||||||
|
not_null<Controller*> controller)
|
||||||
|
: ContentWidget(parent, controller)
|
||||||
|
, _self(controller->key().settingsSelf())
|
||||||
|
, _type(controller->section().settingsType()) {
|
||||||
|
const auto inner = setInnerWidget(
|
||||||
|
::Settings::CreateSection(_type, this, _self));
|
||||||
|
inner->sectionShowOther(
|
||||||
|
) | rpl::start_with_next([=](Type type) {
|
||||||
|
this->controller()->showSettings(type);
|
||||||
|
}, inner->lifetime());
|
||||||
|
}
|
||||||
|
|
||||||
|
not_null<UserData*> Widget::self() const {
|
||||||
|
return _self;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Widget::showInternal(not_null<ContentMemento*> memento) {
|
||||||
|
//if (const auto myMemento = dynamic_cast<Memento*>(memento.get())) {
|
||||||
|
// Assert(myMemento->self() == self());
|
||||||
|
|
||||||
|
// if (_inner->showInternal(myMemento)) {
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Widget::setInternalState(
|
||||||
|
const QRect &geometry,
|
||||||
|
not_null<Memento*> memento) {
|
||||||
|
setGeometry(geometry);
|
||||||
|
Ui::SendPendingMoveResizeEvents(this);
|
||||||
|
restoreState(memento);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<ContentMemento> Widget::doCreateMemento() {
|
||||||
|
auto result = std::make_unique<Memento>(self(), _type);
|
||||||
|
saveState(result.get());
|
||||||
|
return std::move(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Widget::saveState(not_null<Memento*> memento) {
|
||||||
|
memento->setScrollTop(scrollTopSave());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Widget::restoreState(not_null<Memento*> memento) {
|
||||||
|
const auto scrollTop = memento->scrollTop();
|
||||||
|
scrollTopRestore(memento->scrollTop());
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Settings
|
||||||
|
} // namespace Info
|
|
@ -0,0 +1,74 @@
|
||||||
|
/*
|
||||||
|
This file is part of Telegram Desktop,
|
||||||
|
the official desktop application for the Telegram messaging service.
|
||||||
|
|
||||||
|
For license and copyright information please follow this link:
|
||||||
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "info/info_content_widget.h"
|
||||||
|
#include "info/info_controller.h"
|
||||||
|
|
||||||
|
namespace Info {
|
||||||
|
namespace Settings {
|
||||||
|
|
||||||
|
using Type = Section::SettingsType;
|
||||||
|
|
||||||
|
struct Tag;
|
||||||
|
class InnerWidget;
|
||||||
|
|
||||||
|
class Memento final : public ContentMemento {
|
||||||
|
public:
|
||||||
|
Memento(not_null<UserData*> self, Type type);
|
||||||
|
|
||||||
|
object_ptr<ContentWidget> createWidget(
|
||||||
|
QWidget *parent,
|
||||||
|
not_null<Controller*> controller,
|
||||||
|
const QRect &geometry) override;
|
||||||
|
|
||||||
|
Section section() const override;
|
||||||
|
|
||||||
|
Type type() const {
|
||||||
|
return _type;
|
||||||
|
}
|
||||||
|
|
||||||
|
not_null<UserData*> self() const {
|
||||||
|
return settingsSelf();
|
||||||
|
}
|
||||||
|
|
||||||
|
~Memento();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Type _type = Type();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class Widget final : public ContentWidget {
|
||||||
|
public:
|
||||||
|
Widget(
|
||||||
|
QWidget *parent,
|
||||||
|
not_null<Controller*> controller);
|
||||||
|
|
||||||
|
not_null<UserData*> self() const;
|
||||||
|
|
||||||
|
bool showInternal(
|
||||||
|
not_null<ContentMemento*> memento) override;
|
||||||
|
|
||||||
|
void setInternalState(
|
||||||
|
const QRect &geometry,
|
||||||
|
not_null<Memento*> memento);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void saveState(not_null<Memento*> memento);
|
||||||
|
void restoreState(not_null<Memento*> memento);
|
||||||
|
|
||||||
|
std::unique_ptr<ContentMemento> doCreateMemento() override;
|
||||||
|
|
||||||
|
not_null<UserData*> _self;
|
||||||
|
Type _type = Type();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Settings
|
||||||
|
} // namespace Info
|
|
@ -302,7 +302,12 @@ void MainWindow::setupMain(const MTPUser *self) {
|
||||||
void MainWindow::showSettings() {
|
void MainWindow::showSettings() {
|
||||||
if (isHidden()) showFromTray();
|
if (isHidden()) showFromTray();
|
||||||
|
|
||||||
controller()->showSpecialLayer(Box<OldSettings::Widget>());
|
if (const auto controller = this->controller()) {
|
||||||
|
controller->showSettings();
|
||||||
|
} else {
|
||||||
|
// #TODO settings
|
||||||
|
showSpecialLayer(Box<OldSettings::Widget>(), anim::type::normal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::showSpecialLayer(
|
void MainWindow::showSpecialLayer(
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
/*
|
||||||
|
This file is part of Telegram Desktop,
|
||||||
|
the official desktop application for the Telegram messaging service.
|
||||||
|
|
||||||
|
For license and copyright information please follow this link:
|
||||||
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
*/
|
||||||
|
using "basic.style";
|
||||||
|
using "ui/widgets/widgets.style";
|
||||||
|
using "info/info.style";
|
||||||
|
|
||||||
|
settingsSectionButton: infoProfileButton;
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
This file is part of Telegram Desktop,
|
||||||
|
the official desktop application for the Telegram messaging service.
|
||||||
|
|
||||||
|
For license and copyright information please follow this link:
|
||||||
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
*/
|
||||||
|
#include "settings/settings_chat.h"
|
||||||
|
|
||||||
|
#include "settings/settings_common.h"
|
||||||
|
#include "boxes/abstract_box.h"
|
||||||
|
#include "ui/wrap/vertical_layout.h"
|
||||||
|
#include "lang/lang_keys.h"
|
||||||
|
#include "styles/style_settings.h"
|
||||||
|
|
||||||
|
namespace Settings {
|
||||||
|
|
||||||
|
Chat::Chat(QWidget *parent, not_null<UserData*> self)
|
||||||
|
: Section(parent)
|
||||||
|
, _self(self) {
|
||||||
|
setupContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Chat::setupContent() {
|
||||||
|
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
|
||||||
|
|
||||||
|
content->add(object_ptr<BoxContentDivider>(content));
|
||||||
|
|
||||||
|
Ui::ResizeFitChild(this, content);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Settings
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
This file is part of Telegram Desktop,
|
||||||
|
the official desktop application for the Telegram messaging service.
|
||||||
|
|
||||||
|
For license and copyright information please follow this link:
|
||||||
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "settings/settings_common.h"
|
||||||
|
|
||||||
|
namespace Settings {
|
||||||
|
|
||||||
|
class Chat : public Section {
|
||||||
|
public:
|
||||||
|
Chat(QWidget *parent, not_null<UserData*> self);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setupContent();
|
||||||
|
|
||||||
|
not_null<UserData*> _self;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Settings
|
|
@ -0,0 +1,40 @@
|
||||||
|
/*
|
||||||
|
This file is part of Telegram Desktop,
|
||||||
|
the official desktop application for the Telegram messaging service.
|
||||||
|
|
||||||
|
For license and copyright information please follow this link:
|
||||||
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
*/
|
||||||
|
#include "settings/settings_common.h"
|
||||||
|
|
||||||
|
#include "settings/settings_chat.h"
|
||||||
|
#include "settings/settings_general.h"
|
||||||
|
#include "settings/settings_information.h"
|
||||||
|
#include "settings/settings_main.h"
|
||||||
|
#include "settings/settings_notifications.h"
|
||||||
|
#include "settings/settings_privacy_security.h"
|
||||||
|
|
||||||
|
namespace Settings {
|
||||||
|
|
||||||
|
object_ptr<Section> CreateSection(
|
||||||
|
Type type,
|
||||||
|
not_null<QWidget*> parent,
|
||||||
|
UserData *self) {
|
||||||
|
switch (type) {
|
||||||
|
case Type::Main:
|
||||||
|
return object_ptr<::Settings::Main>(parent, self);
|
||||||
|
case Type::Information:
|
||||||
|
return object_ptr<::Settings::Information>(parent, self);
|
||||||
|
case Type::Notifications:
|
||||||
|
return object_ptr<::Settings::Notifications>(parent, self);
|
||||||
|
case Type::PrivacySecurity:
|
||||||
|
return object_ptr<::Settings::PrivacySecurity>(parent, self);
|
||||||
|
case Type::General:
|
||||||
|
return object_ptr<::Settings::General>(parent, self);
|
||||||
|
case Type::Chat:
|
||||||
|
return object_ptr<::Settings::Chat>(parent, self);
|
||||||
|
}
|
||||||
|
Unexpected("Settings section type in Widget::createInnerWidget.");
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Settings
|
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
This file is part of Telegram Desktop,
|
||||||
|
the official desktop application for the Telegram messaging service.
|
||||||
|
|
||||||
|
For license and copyright information please follow this link:
|
||||||
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ui/rp_widget.h"
|
||||||
|
|
||||||
|
namespace Info {
|
||||||
|
namespace Profile {
|
||||||
|
class Button;
|
||||||
|
} // namespace Profile
|
||||||
|
} // namespace Info
|
||||||
|
|
||||||
|
namespace Settings {
|
||||||
|
|
||||||
|
enum class Type {
|
||||||
|
Main,
|
||||||
|
Information,
|
||||||
|
Notifications,
|
||||||
|
PrivacySecurity,
|
||||||
|
General,
|
||||||
|
Chat,
|
||||||
|
};
|
||||||
|
|
||||||
|
using Button = Info::Profile::Button;
|
||||||
|
|
||||||
|
class Section : public Ui::RpWidget {
|
||||||
|
public:
|
||||||
|
using RpWidget::RpWidget;
|
||||||
|
|
||||||
|
virtual rpl::producer<Type> sectionShowOther() {
|
||||||
|
return rpl::never<Type>();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
object_ptr<Section> CreateSection(
|
||||||
|
Type type,
|
||||||
|
not_null<QWidget*> parent,
|
||||||
|
UserData *self = nullptr);
|
||||||
|
|
||||||
|
} // namespace Settings
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
This file is part of Telegram Desktop,
|
||||||
|
the official desktop application for the Telegram messaging service.
|
||||||
|
|
||||||
|
For license and copyright information please follow this link:
|
||||||
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
*/
|
||||||
|
#include "settings/settings_general.h"
|
||||||
|
|
||||||
|
#include "settings/settings_common.h"
|
||||||
|
#include "boxes/abstract_box.h"
|
||||||
|
#include "ui/wrap/vertical_layout.h"
|
||||||
|
#include "lang/lang_keys.h"
|
||||||
|
#include "styles/style_settings.h"
|
||||||
|
|
||||||
|
namespace Settings {
|
||||||
|
|
||||||
|
General::General(QWidget *parent, UserData *self)
|
||||||
|
: Section(parent)
|
||||||
|
, _self(self) {
|
||||||
|
setupContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
void General::setupContent() {
|
||||||
|
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
|
||||||
|
|
||||||
|
content->add(object_ptr<BoxContentDivider>(content));
|
||||||
|
|
||||||
|
Ui::ResizeFitChild(this, content);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Settings
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
This file is part of Telegram Desktop,
|
||||||
|
the official desktop application for the Telegram messaging service.
|
||||||
|
|
||||||
|
For license and copyright information please follow this link:
|
||||||
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "settings/settings_common.h"
|
||||||
|
|
||||||
|
namespace Settings {
|
||||||
|
|
||||||
|
class General : public Section {
|
||||||
|
public:
|
||||||
|
explicit General(QWidget *parent, UserData *self = nullptr);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setupContent();
|
||||||
|
|
||||||
|
UserData *_self = nullptr;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Settings
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
This file is part of Telegram Desktop,
|
||||||
|
the official desktop application for the Telegram messaging service.
|
||||||
|
|
||||||
|
For license and copyright information please follow this link:
|
||||||
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
*/
|
||||||
|
#include "settings/settings_information.h"
|
||||||
|
|
||||||
|
#include "settings/settings_common.h"
|
||||||
|
#include "boxes/abstract_box.h"
|
||||||
|
#include "ui/wrap/vertical_layout.h"
|
||||||
|
#include "lang/lang_keys.h"
|
||||||
|
#include "styles/style_settings.h"
|
||||||
|
|
||||||
|
namespace Settings {
|
||||||
|
|
||||||
|
Information::Information(QWidget *parent, not_null<UserData*> self)
|
||||||
|
: Section(parent)
|
||||||
|
, _self(self) {
|
||||||
|
setupContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Information::setupContent() {
|
||||||
|
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
|
||||||
|
|
||||||
|
content->add(object_ptr<BoxContentDivider>(content));
|
||||||
|
|
||||||
|
Ui::ResizeFitChild(this, content);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Settings
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
This file is part of Telegram Desktop,
|
||||||
|
the official desktop application for the Telegram messaging service.
|
||||||
|
|
||||||
|
For license and copyright information please follow this link:
|
||||||
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "settings/settings_common.h"
|
||||||
|
|
||||||
|
namespace Settings {
|
||||||
|
|
||||||
|
class Information : public Section {
|
||||||
|
public:
|
||||||
|
Information(QWidget *parent, not_null<UserData*> self);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setupContent();
|
||||||
|
|
||||||
|
not_null<UserData*> _self;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Settings
|
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
This file is part of Telegram Desktop,
|
||||||
|
the official desktop application for the Telegram messaging service.
|
||||||
|
|
||||||
|
For license and copyright information please follow this link:
|
||||||
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
*/
|
||||||
|
#include "settings/settings_main.h"
|
||||||
|
|
||||||
|
#include "settings/settings_common.h"
|
||||||
|
#include "boxes/abstract_box.h"
|
||||||
|
#include "ui/wrap/vertical_layout.h"
|
||||||
|
#include "info/profile/info_profile_button.h"
|
||||||
|
#include "lang/lang_keys.h"
|
||||||
|
#include "styles/style_settings.h"
|
||||||
|
|
||||||
|
namespace Settings {
|
||||||
|
|
||||||
|
Main::Main(QWidget *parent, not_null<UserData*> self)
|
||||||
|
: Section(parent)
|
||||||
|
, _self(self) {
|
||||||
|
setupContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Main::setupContent() {
|
||||||
|
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
|
||||||
|
|
||||||
|
content->add(object_ptr<BoxContentDivider>(content));
|
||||||
|
|
||||||
|
const auto addSection = [&](LangKey label, Type type) {
|
||||||
|
content->add(object_ptr<Button>(
|
||||||
|
content,
|
||||||
|
Lang::Viewer(label),
|
||||||
|
st::settingsSectionButton)
|
||||||
|
)->addClickHandler([=] {
|
||||||
|
_showOther.fire_copy(type);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
addSection(lng_settings_section_info, Type::Information);
|
||||||
|
addSection(lng_settings_section_notify, Type::Notifications);
|
||||||
|
addSection(lng_settings_section_privacy, Type::PrivacySecurity);
|
||||||
|
addSection(lng_settings_section_general, Type::General);
|
||||||
|
addSection(lng_settings_section_chat_settings, Type::Chat);
|
||||||
|
|
||||||
|
Ui::ResizeFitChild(this, content);
|
||||||
|
}
|
||||||
|
|
||||||
|
rpl::producer<Type> Main::sectionShowOther() {
|
||||||
|
return _showOther.events();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Settings
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
This file is part of Telegram Desktop,
|
||||||
|
the official desktop application for the Telegram messaging service.
|
||||||
|
|
||||||
|
For license and copyright information please follow this link:
|
||||||
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "settings/settings_common.h"
|
||||||
|
|
||||||
|
namespace Settings {
|
||||||
|
|
||||||
|
class Main : public Section {
|
||||||
|
public:
|
||||||
|
Main(QWidget *parent, not_null<UserData*> self);
|
||||||
|
|
||||||
|
rpl::producer<Type> sectionShowOther() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setupContent();
|
||||||
|
|
||||||
|
not_null<UserData*> _self;
|
||||||
|
rpl::event_stream<Type> _showOther;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Settings
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
This file is part of Telegram Desktop,
|
||||||
|
the official desktop application for the Telegram messaging service.
|
||||||
|
|
||||||
|
For license and copyright information please follow this link:
|
||||||
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
*/
|
||||||
|
#include "settings/settings_notifications.h"
|
||||||
|
|
||||||
|
#include "settings/settings_common.h"
|
||||||
|
#include "boxes/abstract_box.h"
|
||||||
|
#include "ui/wrap/vertical_layout.h"
|
||||||
|
#include "lang/lang_keys.h"
|
||||||
|
#include "styles/style_settings.h"
|
||||||
|
|
||||||
|
namespace Settings {
|
||||||
|
|
||||||
|
Notifications::Notifications(QWidget *parent, not_null<UserData*> self)
|
||||||
|
: Section(parent)
|
||||||
|
, _self(self) {
|
||||||
|
setupContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Notifications::setupContent() {
|
||||||
|
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
|
||||||
|
|
||||||
|
content->add(object_ptr<BoxContentDivider>(content));
|
||||||
|
|
||||||
|
Ui::ResizeFitChild(this, content);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Settings
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
This file is part of Telegram Desktop,
|
||||||
|
the official desktop application for the Telegram messaging service.
|
||||||
|
|
||||||
|
For license and copyright information please follow this link:
|
||||||
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "settings/settings_common.h"
|
||||||
|
|
||||||
|
namespace Settings {
|
||||||
|
|
||||||
|
class Notifications : public Section {
|
||||||
|
public:
|
||||||
|
Notifications(QWidget *parent, not_null<UserData*> self);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setupContent();
|
||||||
|
|
||||||
|
not_null<UserData*> _self;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Settings
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
This file is part of Telegram Desktop,
|
||||||
|
the official desktop application for the Telegram messaging service.
|
||||||
|
|
||||||
|
For license and copyright information please follow this link:
|
||||||
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
*/
|
||||||
|
#include "settings/settings_privacy_security.h"
|
||||||
|
|
||||||
|
#include "settings/settings_common.h"
|
||||||
|
#include "boxes/abstract_box.h"
|
||||||
|
#include "ui/wrap/vertical_layout.h"
|
||||||
|
#include "lang/lang_keys.h"
|
||||||
|
#include "styles/style_settings.h"
|
||||||
|
|
||||||
|
namespace Settings {
|
||||||
|
|
||||||
|
PrivacySecurity::PrivacySecurity(QWidget *parent, not_null<UserData*> self)
|
||||||
|
: Section(parent)
|
||||||
|
, _self(self) {
|
||||||
|
setupContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PrivacySecurity::setupContent() {
|
||||||
|
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
|
||||||
|
|
||||||
|
content->add(object_ptr<BoxContentDivider>(content));
|
||||||
|
|
||||||
|
Ui::ResizeFitChild(this, content);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Settings
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
This file is part of Telegram Desktop,
|
||||||
|
the official desktop application for the Telegram messaging service.
|
||||||
|
|
||||||
|
For license and copyright information please follow this link:
|
||||||
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "settings/settings_common.h"
|
||||||
|
|
||||||
|
namespace Settings {
|
||||||
|
|
||||||
|
class PrivacySecurity : public Section {
|
||||||
|
public:
|
||||||
|
PrivacySecurity(QWidget *parent, not_null<UserData*> self);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setupContent();
|
||||||
|
|
||||||
|
not_null<UserData*> _self;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Settings
|
|
@ -9,6 +9,20 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
|
||||||
|
void ResizeFitChild(
|
||||||
|
not_null<RpWidget*> parent,
|
||||||
|
not_null<RpWidget*> child) {
|
||||||
|
parent->widthValue(
|
||||||
|
) | rpl::start_with_next([=](int width) {
|
||||||
|
child->resizeToWidth(width);
|
||||||
|
}, child->lifetime());
|
||||||
|
|
||||||
|
child->heightValue(
|
||||||
|
) | rpl::start_with_next([=](int height) {
|
||||||
|
parent->resize(parent->width(), height);
|
||||||
|
}, child->lifetime());
|
||||||
|
}
|
||||||
|
|
||||||
rpl::producer<QRect> RpWidgetMethods::geometryValue() const {
|
rpl::producer<QRect> RpWidgetMethods::geometryValue() const {
|
||||||
auto &stream = eventStreams().geometry;
|
auto &stream = eventStreams().geometry;
|
||||||
return stream.events_starting_with_copy(callGetGeometry());
|
return stream.events_starting_with_copy(callGetGeometry());
|
||||||
|
|
|
@ -31,6 +31,8 @@ private:
|
||||||
|
|
||||||
} // namespace details
|
} // namespace details
|
||||||
|
|
||||||
|
class RpWidget;
|
||||||
|
|
||||||
template <typename Widget, typename ...Args>
|
template <typename Widget, typename ...Args>
|
||||||
inline base::unique_qptr<Widget> CreateObject(Args &&...args) {
|
inline base::unique_qptr<Widget> CreateObject(Args &&...args) {
|
||||||
return base::make_unique_q<Widget>(
|
return base::make_unique_q<Widget>(
|
||||||
|
@ -50,6 +52,10 @@ inline void DestroyChild(QWidget *child) {
|
||||||
delete child;
|
delete child;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ResizeFitChild(
|
||||||
|
not_null<RpWidget*> parent,
|
||||||
|
not_null<RpWidget*> child);
|
||||||
|
|
||||||
template <typename Value>
|
template <typename Value>
|
||||||
inline void AttachAsChild(not_null<QObject*> parent, Value &&value) {
|
inline void AttachAsChild(not_null<QObject*> parent, Value &&value) {
|
||||||
using PlainValue = std::decay_t<Value>;
|
using PlainValue = std::decay_t<Value>;
|
||||||
|
|
|
@ -8,7 +8,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "window/window_controller.h"
|
#include "window/window_controller.h"
|
||||||
|
|
||||||
#include "window/main_window.h"
|
#include "window/main_window.h"
|
||||||
|
#include "old_settings/settings_widget.h"
|
||||||
#include "info/info_memento.h"
|
#include "info/info_memento.h"
|
||||||
|
#include "info/info_controller.h"
|
||||||
#include "history/history.h"
|
#include "history/history.h"
|
||||||
#include "history/history_item.h"
|
#include "history/history_item.h"
|
||||||
#include "history/view/history_view_element.h"
|
#include "history/view/history_view_element.h"
|
||||||
|
@ -473,6 +475,26 @@ void Navigation::showPeerInfo(
|
||||||
showPeerInfo(history->peer->id, params);
|
showPeerInfo(history->peer->id, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Navigation::showSettings(
|
||||||
|
Settings::Type type,
|
||||||
|
const SectionShow ¶ms) {
|
||||||
|
const auto self = App::self();
|
||||||
|
if (!self) {
|
||||||
|
// #TODO settings
|
||||||
|
App::wnd()->showSpecialLayer(
|
||||||
|
Box<OldSettings::Widget>(),
|
||||||
|
params.animated);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
showSection(
|
||||||
|
Info::Memento(Info::Settings::Tag{ self }, Info::Section(type)),
|
||||||
|
params);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Navigation::showSettings(const SectionShow ¶ms) {
|
||||||
|
showSettings(Settings::Type::Main, params);
|
||||||
|
}
|
||||||
|
|
||||||
void Controller::showSection(
|
void Controller::showSection(
|
||||||
SectionMemento &&memento,
|
SectionMemento &&memento,
|
||||||
const SectionShow ¶ms) {
|
const SectionShow ¶ms) {
|
||||||
|
|
|
@ -15,6 +15,10 @@ class MainWidget;
|
||||||
class HistoryMessage;
|
class HistoryMessage;
|
||||||
class HistoryService;
|
class HistoryService;
|
||||||
|
|
||||||
|
namespace Settings {
|
||||||
|
enum class Type;
|
||||||
|
} // namespace Settings
|
||||||
|
|
||||||
namespace Media {
|
namespace Media {
|
||||||
namespace Player {
|
namespace Player {
|
||||||
class RoundController;
|
class RoundController;
|
||||||
|
@ -114,6 +118,11 @@ public:
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
const SectionShow ¶ms = SectionShow());
|
const SectionShow ¶ms = SectionShow());
|
||||||
|
|
||||||
|
void showSettings(
|
||||||
|
Settings::Type type,
|
||||||
|
const SectionShow ¶ms = SectionShow());
|
||||||
|
void showSettings(const SectionShow ¶ms = SectionShow());
|
||||||
|
|
||||||
virtual ~Navigation() = default;
|
virtual ~Navigation() = default;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
'<(src_loc)/passport/passport.style',
|
'<(src_loc)/passport/passport.style',
|
||||||
'<(src_loc)/profile/profile.style',
|
'<(src_loc)/profile/profile.style',
|
||||||
'<(src_loc)/old_settings/old_settings.style',
|
'<(src_loc)/old_settings/old_settings.style',
|
||||||
|
'<(src_loc)/settings/settings.style',
|
||||||
'<(src_loc)/chat_helpers/chat_helpers.style',
|
'<(src_loc)/chat_helpers/chat_helpers.style',
|
||||||
'<(src_loc)/ui/widgets/widgets.style',
|
'<(src_loc)/ui/widgets/widgets.style',
|
||||||
'<(src_loc)/window/window.style',
|
'<(src_loc)/window/window.style',
|
||||||
|
|
|
@ -315,6 +315,8 @@
|
||||||
<(src_loc)/info/profile/info_profile_values.h
|
<(src_loc)/info/profile/info_profile_values.h
|
||||||
<(src_loc)/info/profile/info_profile_widget.cpp
|
<(src_loc)/info/profile/info_profile_widget.cpp
|
||||||
<(src_loc)/info/profile/info_profile_widget.h
|
<(src_loc)/info/profile/info_profile_widget.h
|
||||||
|
<(src_loc)/info/settings/info_settings_widget.cpp
|
||||||
|
<(src_loc)/info/settings/info_settings_widget.h
|
||||||
<(src_loc)/inline_bots/inline_bot_layout_internal.cpp
|
<(src_loc)/inline_bots/inline_bot_layout_internal.cpp
|
||||||
<(src_loc)/inline_bots/inline_bot_layout_internal.h
|
<(src_loc)/inline_bots/inline_bot_layout_internal.h
|
||||||
<(src_loc)/inline_bots/inline_bot_layout_item.cpp
|
<(src_loc)/inline_bots/inline_bot_layout_item.cpp
|
||||||
|
@ -562,6 +564,20 @@
|
||||||
<(src_loc)/old_settings/settings_scale_widget.h
|
<(src_loc)/old_settings/settings_scale_widget.h
|
||||||
<(src_loc)/old_settings/settings_widget.cpp
|
<(src_loc)/old_settings/settings_widget.cpp
|
||||||
<(src_loc)/old_settings/settings_widget.h
|
<(src_loc)/old_settings/settings_widget.h
|
||||||
|
<(src_loc)/settings/settings_chat.cpp
|
||||||
|
<(src_loc)/settings/settings_chat.h
|
||||||
|
<(src_loc)/settings/settings_common.cpp
|
||||||
|
<(src_loc)/settings/settings_common.h
|
||||||
|
<(src_loc)/settings/settings_general.cpp
|
||||||
|
<(src_loc)/settings/settings_general.h
|
||||||
|
<(src_loc)/settings/settings_information.cpp
|
||||||
|
<(src_loc)/settings/settings_information.h
|
||||||
|
<(src_loc)/settings/settings_main.cpp
|
||||||
|
<(src_loc)/settings/settings_main.h
|
||||||
|
<(src_loc)/settings/settings_notifications.cpp
|
||||||
|
<(src_loc)/settings/settings_notifications.h
|
||||||
|
<(src_loc)/settings/settings_privacy_security.cpp
|
||||||
|
<(src_loc)/settings/settings_privacy_security.h
|
||||||
<(src_loc)/storage/file_download.cpp
|
<(src_loc)/storage/file_download.cpp
|
||||||
<(src_loc)/storage/file_download.h
|
<(src_loc)/storage/file_download.h
|
||||||
<(src_loc)/storage/file_upload.cpp
|
<(src_loc)/storage/file_upload.cpp
|
||||||
|
|
Loading…
Reference in New Issue