2019-07-23 22:18:36 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <boost/optional.hpp>
|
|
|
|
#include <pajlada/signals/signal.hpp>
|
|
|
|
#include <pajlada/signals/signalholder.hpp>
|
Sort and force grouping of includes (#4172)
This change enforces strict include grouping using IncludeCategories
In addition to adding this to the .clang-format file and applying it in the tests/src and src directories, I also did the following small changes:
In ChatterSet.hpp, I changed lrucache to a <>include
In Irc2.hpp, I change common/SignalVector.hpp to a "project-include"
In AttachedWindow.cpp, NativeMessaging.cpp, WindowsHelper.hpp, BaseWindow.cpp, and StreamerMode.cpp, I disabled clang-format for the windows-includes
In WindowDescriptors.hpp, I added the missing vector include. It was previously not needed because the include was handled by another file that was previously included first.
clang-format minimum version has been bumped, so Ubuntu version used in the check-formatting job has been bumped to 22.04 (which is the latest LTS)
2022-11-27 19:32:53 +01:00
|
|
|
#include <QShortcut>
|
|
|
|
#include <QWidget>
|
2019-07-23 22:18:36 +02:00
|
|
|
|
2019-10-07 15:46:08 +02:00
|
|
|
namespace chatterino {
|
2019-07-23 22:18:36 +02:00
|
|
|
|
|
|
|
class Theme;
|
|
|
|
class BaseWindow;
|
|
|
|
|
|
|
|
class BaseWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2020-09-25 23:41:18 +02:00
|
|
|
explicit BaseWidget(QWidget *parent = nullptr,
|
|
|
|
Qt::WindowFlags f = Qt::WindowFlags());
|
2019-07-23 22:18:36 +02:00
|
|
|
|
|
|
|
virtual float scale() const;
|
|
|
|
pajlada::Signals::Signal<float> scaleChanged;
|
|
|
|
|
|
|
|
boost::optional<float> overrideScale() const;
|
|
|
|
void setOverrideScale(boost::optional<float>);
|
|
|
|
|
|
|
|
QSize scaleIndependantSize() const;
|
|
|
|
int scaleIndependantWidth() const;
|
|
|
|
int scaleIndependantHeight() const;
|
|
|
|
void setScaleIndependantSize(int width, int height);
|
|
|
|
void setScaleIndependantSize(QSize);
|
|
|
|
void setScaleIndependantWidth(int value);
|
|
|
|
void setScaleIndependantHeight(int value);
|
|
|
|
|
|
|
|
float qtFontScale() const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void childEvent(QChildEvent *) override;
|
|
|
|
virtual void showEvent(QShowEvent *) override;
|
|
|
|
|
|
|
|
virtual void scaleChangedEvent(float newScale);
|
|
|
|
virtual void themeChangedEvent();
|
2021-11-21 18:46:21 +01:00
|
|
|
[[deprecated("addShortcuts called without overriding it")]] virtual void
|
|
|
|
addShortcuts()
|
|
|
|
{
|
|
|
|
}
|
2019-07-23 22:18:36 +02:00
|
|
|
|
|
|
|
void setScale(float value);
|
|
|
|
|
|
|
|
Theme *theme;
|
|
|
|
|
2021-11-21 18:46:21 +01:00
|
|
|
std::vector<QShortcut *> shortcuts_;
|
|
|
|
void clearShortcuts();
|
|
|
|
pajlada::Signals::SignalHolder signalHolder_;
|
|
|
|
|
2019-07-23 22:18:36 +02:00
|
|
|
private:
|
|
|
|
float scale_{1.f};
|
|
|
|
boost::optional<float> overrideScale_;
|
|
|
|
QSize scaleIndependantSize_;
|
|
|
|
|
|
|
|
std::vector<BaseWidget *> widgets_;
|
|
|
|
|
|
|
|
friend class BaseWindow;
|
|
|
|
};
|
|
|
|
|
2019-10-07 15:46:08 +02:00
|
|
|
} // namespace chatterino
|