nheko/include/ui/Theme.h

98 lines
1.5 KiB
C
Raw Normal View History

#pragma once
2017-04-06 01:06:42 +02:00
#include <QColor>
#include <QHash>
#include <QObject>
2017-10-15 21:08:51 +02:00
namespace ui {
enum class AvatarType
2017-04-06 01:06:42 +02:00
{
2017-10-15 21:08:51 +02:00
Icon,
Image,
Letter
};
2017-04-06 01:06:42 +02:00
2017-10-15 21:08:51 +02:00
namespace sidebar {
2018-01-09 14:07:32 +01:00
static const int SmallSize = 60;
static const int NormalSize = 260;
2018-01-09 14:07:32 +01:00
static const int CommunitiesSidebarSize = 64;
2017-05-19 18:55:38 +02:00
}
2017-04-06 01:06:42 +02:00
// Default font size.
const int FontSize = 16;
// Default avatar size. Width and height.
const int AvatarSize = 40;
2017-10-15 21:08:51 +02:00
enum class ButtonPreset
{
FlatPreset,
CheckablePreset
};
2017-04-06 01:06:42 +02:00
2017-10-15 21:08:51 +02:00
enum class RippleStyle
{
CenteredRipple,
PositionedRipple,
NoRipple
};
2017-04-06 01:06:42 +02:00
2017-10-15 21:08:51 +02:00
enum class OverlayStyle
{
NoOverlay,
TintedOverlay,
GrayOverlay
};
2017-04-06 01:06:42 +02:00
2017-10-15 21:08:51 +02:00
enum class Role
{
Default,
Primary,
Secondary
};
2017-04-06 01:06:42 +02:00
2017-10-15 21:08:51 +02:00
enum class ButtonIconPlacement
{
LeftIcon,
RightIcon
};
2017-04-06 01:06:42 +02:00
2017-10-15 21:08:51 +02:00
enum class ProgressType
{
DeterminateProgress,
IndeterminateProgress
};
2017-04-06 01:06:42 +02:00
2017-10-15 21:08:51 +02:00
enum class Color
{
2017-09-10 11:59:21 +02:00
Black,
BrightWhite,
FadedWhite,
MediumWhite,
DarkGreen,
LightGreen,
BrightGreen,
Gray,
Red,
Blue,
Transparent
2017-04-06 01:06:42 +02:00
};
2017-08-20 12:47:22 +02:00
} // namespace ui
2017-04-06 01:06:42 +02:00
class Theme : public QObject
{
2017-09-10 11:59:21 +02:00
Q_OBJECT
2017-04-06 01:06:42 +02:00
public:
2017-09-10 11:59:21 +02:00
explicit Theme(QObject *parent = 0);
2017-04-06 01:06:42 +02:00
2017-09-10 11:59:21 +02:00
QColor getColor(const QString &key) const;
2017-04-06 01:06:42 +02:00
2017-09-10 11:59:21 +02:00
void setColor(const QString &key, const QColor &color);
void setColor(const QString &key, ui::Color color);
2017-04-06 01:06:42 +02:00
private:
2017-09-10 11:59:21 +02:00
QColor rgba(int r, int g, int b, qreal a) const;
2017-04-06 01:06:42 +02:00
2017-09-10 11:59:21 +02:00
QHash<QString, QColor> colors_;
2017-04-06 01:06:42 +02:00
};