Remove some unused themes code.

This commit is contained in:
John Preston 2018-09-29 09:53:30 +03:00
parent 20e303d3e6
commit 29432d5d6a
3 changed files with 1 additions and 42 deletions

View File

@ -710,29 +710,6 @@ void SetupChatBackground(not_null<Ui::VerticalLayout*> container) {
}, adaptive->lifetime()); }, adaptive->lifetime());
} }
void SetupUseDefaultTheme(not_null<Ui::VerticalLayout*> container) {
using Update = const Window::Theme::BackgroundUpdate;
container->add(
object_ptr<Ui::SlideWrap<Button>>(
container,
object_ptr<Button>(
container,
Lang::Viewer(lng_settings_bg_use_default),
st::settingsButton))
)->toggleOn(rpl::single(
Window::Theme::SuggestThemeReset()
) | rpl::then(base::ObservableViewer(
*Window::Theme::Background()
) | rpl::filter([](const Update &update) {
return (update.type == Update::Type::ApplyingTheme
|| update.type == Update::Type::New);
}) | rpl::map([] {
return Window::Theme::SuggestThemeReset();
})))->entity()->addClickHandler([] {
Window::Theme::ApplyDefault();
});
}
void SetupDefaultThemes(not_null<Ui::VerticalLayout*> container) { void SetupDefaultThemes(not_null<Ui::VerticalLayout*> container) {
using Type = DefaultTheme::Type; using Type = DefaultTheme::Type;
using Scheme = DefaultTheme::Scheme; using Scheme = DefaultTheme::Scheme;
@ -932,8 +909,6 @@ void SetupThemeOptions(not_null<Ui::VerticalLayout*> container) {
container, container,
[] { Window::Theme::Editor::Start(); })); [] { Window::Theme::Editor::Start(); }));
//SetupUseDefaultTheme(container);
AddSkip(container); AddSkip(container);
} }

View File

@ -451,7 +451,7 @@ void ChatBackground::setPreparedImage(QImage &&image) {
if (testingPalette()) { if (testingPalette()) {
return false; return false;
} else if (IsNonDefaultThemeOrBackground() || nightMode()) { } else if (isNonDefaultThemeOrBackground() || nightMode()) {
return !usingThemeBackground(); return !usingThemeBackground();
} }
return !usingDefaultBackground(); return !usingDefaultBackground();
@ -857,10 +857,6 @@ bool Apply(std::unique_ptr<Preview> preview) {
return true; return true;
} }
void ApplyDefault() {
ApplyDefaultWithPath(IsNightMode() ? NightThemePath() : QString());
}
void ApplyDefaultWithPath(const QString &themePath) { void ApplyDefaultWithPath(const QString &themePath) {
if (!themePath.isEmpty()) { if (!themePath.isEmpty()) {
if (auto preview = PreviewFromFile(themePath)) { if (auto preview = PreviewFromFile(themePath)) {
@ -937,10 +933,6 @@ QString NightThemePath() {
return str_const_toString(kNightThemeFile); return str_const_toString(kNightThemeFile);
} }
bool IsNonDefaultThemeOrBackground() {
return Background()->isNonDefaultThemeOrBackground();
}
bool IsNonDefaultBackground() { bool IsNonDefaultBackground() {
return Background()->isNonDefaultBackground(); return Background()->isNonDefaultBackground();
} }
@ -963,10 +955,6 @@ void ToggleNightMode(const QString &path) {
Background()->toggleNightMode(path); Background()->toggleNightMode(path);
} }
bool SuggestThemeReset() {
return IsNonDefaultThemeOrBackground();
}
bool LoadFromFile(const QString &path, Instance *out, QByteArray *outContent) { bool LoadFromFile(const QString &path, Instance *out, QByteArray *outContent) {
*outContent = readThemeContent(path); *outContent = readThemeContent(path);
if (outContent->size() < 4) { if (outContent->size() < 4) {

View File

@ -56,7 +56,6 @@ struct Preview {
bool Apply(const QString &filepath); bool Apply(const QString &filepath);
bool Apply(std::unique_ptr<Preview> preview); bool Apply(std::unique_ptr<Preview> preview);
void ApplyDefault();
void ApplyDefaultWithPath(const QString &themePath); void ApplyDefaultWithPath(const QString &themePath);
bool ApplyEditedPalette(const QString &path, const QByteArray &content); bool ApplyEditedPalette(const QString &path, const QByteArray &content);
void KeepApplied(); void KeepApplied();
@ -66,8 +65,6 @@ void SetNightModeValue(bool nightMode);
void ToggleNightMode(); void ToggleNightMode();
void ToggleNightMode(const QString &themePath); void ToggleNightMode(const QString &themePath);
bool IsNonDefaultBackground(); bool IsNonDefaultBackground();
bool IsNonDefaultThemeOrBackground();
bool SuggestThemeReset();
void Revert(); void Revert();
bool LoadFromFile(const QString &file, Instance *out, QByteArray *outContent); bool LoadFromFile(const QString &file, Instance *out, QByteArray *outContent);
@ -154,7 +151,6 @@ private:
friend void ToggleNightMode(const QString &themePath); friend void ToggleNightMode(const QString &themePath);
friend void KeepApplied(); friend void KeepApplied();
friend bool IsNonDefaultBackground(); friend bool IsNonDefaultBackground();
friend bool IsNonDefaultThemeOrBackground();
int32 _id = internal::kUninitializedBackground; int32 _id = internal::kUninitializedBackground;
QPixmap _pixmap; QPixmap _pixmap;