mirror of
https://github.com/YACReader/yacreader
synced 2026-03-02 19:00:04 -05:00
Add ThemeManager
It can listen to system changes and update the current theme, widgets can use it to get the current theme.
This commit is contained in:
37
common/themes/theme_manager.h
Normal file
37
common/themes/theme_manager.h
Normal file
@ -0,0 +1,37 @@
|
||||
#ifndef THEME_MANAGER_H
|
||||
#define THEME_MANAGER_H
|
||||
|
||||
#include "theme.h"
|
||||
#include "theme_id.h"
|
||||
|
||||
#include <QtCore>
|
||||
|
||||
class ThemeManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static ThemeManager &instance();
|
||||
|
||||
ThemeManager(const ThemeManager &) = delete;
|
||||
ThemeManager &operator=(const ThemeManager &) = delete;
|
||||
ThemeManager(ThemeManager &&) = delete;
|
||||
ThemeManager &operator=(ThemeManager &&) = delete;
|
||||
|
||||
void initialize();
|
||||
|
||||
void setTheme(ThemeId themeId);
|
||||
|
||||
const Theme &getCurrentTheme() const { return currentTheme; }
|
||||
|
||||
signals:
|
||||
void themeChanged();
|
||||
|
||||
private:
|
||||
explicit ThemeManager();
|
||||
ThemeId themeId = ThemeId::Classic;
|
||||
Theme currentTheme;
|
||||
|
||||
void updateCurrentTheme();
|
||||
};
|
||||
|
||||
#endif // THEME_MANAGER_H
|
||||
Reference in New Issue
Block a user