mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
ae26b835b6
Things that were once singletons are no longer singletons, but are instead stored in the "Application" singleton Some singletons still remain, and some renaming/renamespacing is left
62 lines
1.3 KiB
C++
62 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <QWidget>
|
|
#include <pajlada/signals/signal.hpp>
|
|
|
|
namespace chatterino {
|
|
namespace singletons {
|
|
class ThemeManager;
|
|
} // namespace singletons
|
|
|
|
namespace widgets {
|
|
|
|
class BaseWindow;
|
|
|
|
class BaseWidget : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit BaseWidget(QWidget *parent, Qt::WindowFlags f = Qt::WindowFlags());
|
|
virtual ~BaseWidget();
|
|
|
|
float getScale() const;
|
|
pajlada::Signals::Signal<float> scaleChanged;
|
|
|
|
QSize getScaleIndependantSize() const;
|
|
int getScaleIndependantWidth() const;
|
|
int getScaleIndependantHeight() const;
|
|
void setScaleIndependantSize(int width, int yOffset);
|
|
void setScaleIndependantSize(QSize);
|
|
void setScaleIndependantWidth(int value);
|
|
void setScaleIndependantHeight(int value);
|
|
|
|
protected:
|
|
void childEvent(QChildEvent *) override;
|
|
|
|
virtual void scaleChangedEvent(float newScale);
|
|
virtual void themeRefreshEvent();
|
|
|
|
virtual void showEvent(QShowEvent *) override;
|
|
|
|
void setScale(float value);
|
|
|
|
singletons::ThemeManager *themeManager;
|
|
|
|
private:
|
|
void init();
|
|
float scale = 1.f;
|
|
QSize scaleIndependantSize;
|
|
|
|
std::vector<BaseWidget *> widgets;
|
|
|
|
pajlada::Signals::Connection themeConnection;
|
|
|
|
static void setScaleRecursive(float scale, QObject *object);
|
|
|
|
friend class BaseWindow;
|
|
};
|
|
|
|
} // namespace widgets
|
|
} // namespace chatterino
|