init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
This commit is contained in:
95
Telegram/SourceFiles/window/themes/window_theme_editor.h
Normal file
95
Telegram/SourceFiles/window/themes/window_theme_editor.h
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
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 "data/data_cloud_themes.h"
|
||||
#include "ui/rp_widget.h"
|
||||
#include "base/object_ptr.h"
|
||||
|
||||
namespace style {
|
||||
struct colorizer;
|
||||
} // namespace style
|
||||
|
||||
namespace Ui {
|
||||
class FlatButton;
|
||||
class ScrollArea;
|
||||
class CrossButton;
|
||||
class MultiSelect;
|
||||
class PlainShadow;
|
||||
class DropdownMenu;
|
||||
class IconButton;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Window {
|
||||
|
||||
class Controller;
|
||||
|
||||
namespace Theme {
|
||||
|
||||
struct ParsedTheme {
|
||||
QByteArray palette;
|
||||
QByteArray background;
|
||||
bool isPng = false;
|
||||
bool tiled = false;
|
||||
};
|
||||
|
||||
[[nodiscard]] QByteArray ColorHexString(const QColor &color);
|
||||
[[nodiscard]] QByteArray ReplaceValueInPaletteContent(
|
||||
const QByteArray &content,
|
||||
const QByteArray &name,
|
||||
const QByteArray &value);
|
||||
[[nodiscard]] QByteArray WriteCloudToText(const Data::CloudTheme &cloud);
|
||||
[[nodiscard]] Data::CloudTheme ReadCloudFromText(const QByteArray &text);
|
||||
[[nodiscard]] QByteArray StripCloudTextFields(const QByteArray &text);
|
||||
|
||||
class Editor : public Ui::RpWidget {
|
||||
public:
|
||||
Editor(
|
||||
QWidget*,
|
||||
not_null<Window::Controller*> window,
|
||||
const Data::CloudTheme &cloud);
|
||||
|
||||
[[nodiscard]] static QByteArray ColorizeInContent(
|
||||
QByteArray content,
|
||||
const style::colorizer &colorizer);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
void keyPressEvent(QKeyEvent *e) override;
|
||||
|
||||
void focusInEvent(QFocusEvent *e) override;
|
||||
|
||||
private:
|
||||
void save();
|
||||
void showMenu();
|
||||
void exportTheme();
|
||||
void importTheme();
|
||||
void closeEditor();
|
||||
void closeWithConfirmation();
|
||||
void updateControlsGeometry();
|
||||
|
||||
const not_null<Window::Controller*> _window;
|
||||
const Data::CloudTheme _cloud;
|
||||
|
||||
object_ptr<Ui::ScrollArea> _scroll;
|
||||
class Inner;
|
||||
QPointer<Inner> _inner;
|
||||
object_ptr<Ui::CrossButton> _close;
|
||||
object_ptr<Ui::IconButton> _menuToggle;
|
||||
base::unique_qptr<Ui::DropdownMenu> _menu;
|
||||
object_ptr<Ui::MultiSelect> _select;
|
||||
object_ptr<Ui::PlainShadow> _leftShadow;
|
||||
object_ptr<Ui::PlainShadow> _topShadow;
|
||||
object_ptr<Ui::FlatButton> _save;
|
||||
bool _saving = false;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Theme
|
||||
} // namespace Window
|
||||
Reference in New Issue
Block a user