matrixion/include/ui/Theme.h

92 lines
1.2 KiB
C
Raw Normal View History

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