diff --git a/chatterino.pro b/chatterino.pro index eeaf2bb3..46ae571c 100644 --- a/chatterino.pro +++ b/chatterino.pro @@ -108,7 +108,6 @@ SOURCES += \ src/providers/twitch/TwitchMessageBuilder.cpp \ src/providers/twitch/TwitchServer.cpp \ src/providers/twitch/TwitchUser.cpp \ - src/common/ChatterinoSetting.cpp \ src/singletons/helper/GifTimer.cpp \ src/singletons/helper/LoggingChannel.cpp \ src/controllers/moderationactions/ModerationAction.cpp \ @@ -141,7 +140,6 @@ SOURCES += \ src/widgets/helper/SearchPopup.cpp \ src/widgets/helper/SettingsDialogTab.cpp \ src/widgets/helper/SignalLabel.cpp \ - src/widgets/helper/TitlebarButton.cpp \ src/widgets/Notebook.cpp \ src/widgets/Scrollbar.cpp \ src/widgets/settingspages/AboutPage.cpp \ @@ -201,9 +199,7 @@ SOURCES += \ src/controllers/notifications/NotificationModel.cpp \ src/singletons/Toasts.cpp \ src/common/DownloadManager.cpp \ - src/widgets/helper/Button.cpp \ src/messages/MessageContainer.cpp \ - src/debug/Benchmark.cpp \ src/common/UsernameSet.cpp \ src/widgets/settingspages/AdvancedPage.cpp \ src/util/IncognitoBrowser.cpp \ @@ -250,9 +246,6 @@ HEADERS += \ src/controllers/taggedusers/TaggedUser.hpp \ src/controllers/taggedusers/TaggedUsersController.hpp \ src/controllers/taggedusers/TaggedUsersModel.hpp \ - src/debug/AssertInGuiThread.hpp \ - src/debug/Benchmark.hpp \ - src/debug/Log.hpp \ src/messages/Image.hpp \ src/messages/layouts/MessageLayout.hpp \ src/messages/layouts/MessageLayoutContainer.hpp \ @@ -285,7 +278,6 @@ HEADERS += \ src/providers/twitch/TwitchMessageBuilder.hpp \ src/providers/twitch/TwitchServer.hpp \ src/providers/twitch/TwitchUser.hpp \ - src/common/ChatterinoSetting.hpp \ src/singletons/helper/GifTimer.hpp \ src/singletons/helper/LoggingChannel.hpp \ src/controllers/moderationactions/ModerationAction.hpp \ @@ -295,7 +287,6 @@ HEADERS += \ src/util/ConcurrentMap.hpp \ src/util/DebugCount.hpp \ src/util/DistanceBetweenPoints.hpp \ - src/util/Helpers.hpp \ src/util/IrcHelpers.hpp \ src/util/LayoutCreator.hpp \ src/util/QStringHash.hpp \ @@ -330,7 +321,6 @@ HEADERS += \ src/widgets/helper/SearchPopup.hpp \ src/widgets/helper/SettingsDialogTab.hpp \ src/widgets/helper/SignalLabel.hpp \ - src/widgets/helper/TitlebarButton.hpp \ src/widgets/Notebook.hpp \ src/widgets/Scrollbar.hpp \ src/widgets/settingspages/AboutPage.hpp \ @@ -367,7 +357,6 @@ HEADERS += \ src/singletons/Theme.hpp \ src/common/SignalVector.hpp \ src/widgets/dialogs/LogsPopup.hpp \ - src/common/Singleton.hpp \ src/controllers/moderationactions/ModerationActionModel.hpp \ src/widgets/settingspages/LookPage.hpp \ src/widgets/settingspages/FeelPage.hpp \ @@ -398,7 +387,6 @@ HEADERS += \ src/singletons/Toasts.hpp \ src/common/DownloadManager.hpp \ src/util/LayoutHelper.hpp \ - src/widgets/helper/Button.hpp \ src/messages/MessageContainer.hpp \ src/common/UsernameSet.hpp \ src/widgets/settingspages/AdvancedPage.hpp \ diff --git a/lib/appbase b/lib/appbase index 52d615d0..57d61602 160000 --- a/lib/appbase +++ b/lib/appbase @@ -1 +1 @@ -Subproject commit 52d615d08b399eb91f890e2c775c234fcd5f678c +Subproject commit 57d61602c375cc83418ba59a36535247060dab6a diff --git a/src/common/ChatterinoSetting.cpp b/src/common/ChatterinoSetting.cpp deleted file mode 100644 index f3d9272b..00000000 --- a/src/common/ChatterinoSetting.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "common/ChatterinoSetting.hpp" - -#include "singletons/Settings.hpp" - -namespace chatterino { - -void _registerSetting(std::weak_ptr setting) -{ - _actuallyRegisterSetting(setting); -} - -} // namespace chatterino diff --git a/src/common/ChatterinoSetting.hpp b/src/common/ChatterinoSetting.hpp deleted file mode 100644 index 886ef12c..00000000 --- a/src/common/ChatterinoSetting.hpp +++ /dev/null @@ -1,54 +0,0 @@ -#pragma once - -#include -#include - -namespace chatterino { - -void _registerSetting(std::weak_ptr setting); - -template -class ChatterinoSetting : public pajlada::Settings::Setting -{ -public: - ChatterinoSetting(const std::string &path) - : pajlada::Settings::Setting(path) - { - _registerSetting(this->getData()); - } - - ChatterinoSetting(const std::string &path, const Type &defaultValue) - : pajlada::Settings::Setting(path, defaultValue) - { - _registerSetting(this->getData()); - } - - template - ChatterinoSetting &operator=(const T2 &newValue) - { - this->setValue(newValue); - - return *this; - } - - ChatterinoSetting &operator=(Type &&newValue) noexcept - { - pajlada::Settings::Setting::operator=(newValue); - - return *this; - } - - using pajlada::Settings::Setting::operator==; - using pajlada::Settings::Setting::operator!=; - - using pajlada::Settings::Setting::operator Type; -}; - -using BoolSetting = ChatterinoSetting; -using FloatSetting = ChatterinoSetting; -using DoubleSetting = ChatterinoSetting; -using IntSetting = ChatterinoSetting; -using StringSetting = ChatterinoSetting; -using QStringSetting = ChatterinoSetting; - -} // namespace chatterino diff --git a/src/common/Singleton.hpp b/src/common/Singleton.hpp deleted file mode 100644 index a98dedac..00000000 --- a/src/common/Singleton.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include - -namespace chatterino { - -class Settings; -class Paths; - -class Singleton : boost::noncopyable -{ -public: - virtual ~Singleton() = default; - - virtual void initialize(Settings &settings, Paths &paths) - { - (void)(settings); - (void)(paths); - } - - virtual void save() - { - } -}; - -} // namespace chatterino diff --git a/src/debug/AssertInGuiThread.hpp b/src/debug/AssertInGuiThread.hpp deleted file mode 100644 index 248ba8b1..00000000 --- a/src/debug/AssertInGuiThread.hpp +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace chatterino { - -static void assertInGuiThread() -{ -#ifdef _DEBUG - assert(QCoreApplication::instance()->thread() == QThread::currentThread()); -#endif -} - -} // namespace chatterino diff --git a/src/debug/Benchmark.cpp b/src/debug/Benchmark.cpp deleted file mode 100644 index 2ab28a68..00000000 --- a/src/debug/Benchmark.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "Benchmark.hpp" - -namespace chatterino { - -BenchmarkGuard::BenchmarkGuard(const QString &_name) - : name_(_name) -{ - timer_.start(); -} - -BenchmarkGuard::~BenchmarkGuard() -{ - log("{} {} ms", this->name_, float(timer_.nsecsElapsed()) / 1000000.0f); -} - -qreal BenchmarkGuard::getElapsedMs() -{ - return qreal(timer_.nsecsElapsed()) / 1000000.0; -} - -} // namespace chatterino diff --git a/src/debug/Benchmark.hpp b/src/debug/Benchmark.hpp deleted file mode 100644 index 065048e8..00000000 --- a/src/debug/Benchmark.hpp +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include "debug/Log.hpp" - -#include -#include - -namespace chatterino { - -class BenchmarkGuard : boost::noncopyable -{ -public: - BenchmarkGuard(const QString &_name); - ~BenchmarkGuard(); - qreal getElapsedMs(); - -private: - QElapsedTimer timer_; - QString name_; -}; - -} // namespace chatterino diff --git a/src/debug/Log.hpp b/src/debug/Log.hpp deleted file mode 100644 index 31536781..00000000 --- a/src/debug/Log.hpp +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include "util/Helpers.hpp" - -#include -#include - -namespace chatterino { - -template -inline void log(const std::string &formatString, Args &&... args) -{ - qDebug().noquote() << QTime::currentTime().toString("hh:mm:ss.zzz") - << fS(formatString, std::forward(args)...).c_str(); -} - -template -inline void log(const char *formatString, Args &&... args) -{ - log(std::string(formatString), std::forward(args)...); -} - -template -inline void log(const QString &formatString, Args &&... args) -{ - log(formatString.toStdString(), std::forward(args)...); -} - -} // namespace chatterino diff --git a/src/util/Helpers.hpp b/src/util/Helpers.hpp deleted file mode 100644 index 640a9840..00000000 --- a/src/util/Helpers.hpp +++ /dev/null @@ -1,56 +0,0 @@ -#pragma once - -#include -#include - -namespace chatterino { - -template -auto fS(Args &&... args) -{ - return fmt::format(std::forward(args)...); -} - -static QString CreateUUID() -{ - auto uuid = QUuid::createUuid(); - return uuid.toString(); -} - -static QString createLink(const QString &url, bool file = false) -{ - return QString("" + - url + ""; -} - -static QString createNamedLink(const QString &url, const QString &name, - bool file = false) -{ - return QString("" + - name + ""; -} - -static QString shortenString(const QString &str, unsigned maxWidth = 50) -{ - auto shortened = QString(str); - - if (str.size() > int(maxWidth)) - { - shortened.resize(int(maxWidth)); - shortened += "..."; - } - - return shortened; -} - -} // namespace chatterino - -namespace fmt { - -// format_arg for QString -inline void format_arg(BasicFormatter &f, const char *&, const QString &v) -{ - f.writer().write("{}", v.toStdString()); -} - -} // namespace fmt diff --git a/src/util/StreamLink.cpp b/src/util/StreamLink.cpp index 31b2d2fd..c213c83d 100644 --- a/src/util/StreamLink.cpp +++ b/src/util/StreamLink.cpp @@ -1,9 +1,9 @@ #include "util/StreamLink.hpp" #include "Application.hpp" -#include "Helpers.hpp" #include "debug/Log.hpp" #include "singletons/Settings.hpp" +#include "util/Helpers.hpp" #include "widgets/dialogs/QualityPopup.hpp" #include diff --git a/src/widgets/helper/Button.cpp b/src/widgets/helper/Button.cpp deleted file mode 100644 index 98a7cedb..00000000 --- a/src/widgets/helper/Button.cpp +++ /dev/null @@ -1,338 +0,0 @@ -#include "Button.hpp" - -#include -#include -#include -#include - -#include "singletons/Theme.hpp" -#include "util/FunctionEventFilter.hpp" - -namespace chatterino { - -Button::Button(BaseWidget *parent) - : BaseWidget(parent) -{ - connect(&effectTimer_, &QTimer::timeout, this, - &Button::onMouseEffectTimeout); - - this->effectTimer_.setInterval(20); - this->effectTimer_.start(); - - this->setMouseTracking(true); -} - -void Button::setMouseEffectColor(boost::optional color) -{ - this->mouseEffectColor_ = color; -} - -void Button::setPixmap(const QPixmap &_pixmap) -{ - this->pixmap_ = _pixmap; - this->update(); -} - -const QPixmap &Button::getPixmap() const -{ - return this->pixmap_; -} - -void Button::setDim(bool value) -{ - this->dimPixmap_ = value; - - this->update(); -} - -bool Button::getDim() const -{ - return this->dimPixmap_; -} - -void Button::setEnable(bool value) -{ - this->enabled_ = value; - - this->update(); -} - -bool Button::getEnable() const -{ - return this->enabled_; -} - -void Button::setEnableMargin(bool value) -{ - this->enableMargin_ = value; - - this->update(); -} - -bool Button::getEnableMargin() const -{ - return this->enableMargin_; -} - -qreal Button::getCurrentDimAmount() const -{ - return this->dimPixmap_ && !this->mouseOver_ ? 0.7 : 1; -} - -void Button::setBorderColor(const QColor &color) -{ - this->borderColor_ = color; - - this->update(); -} - -const QColor &Button::getBorderColor() const -{ - return this->borderColor_; -} - -void Button::setMenu(std::unique_ptr menu) -{ - this->menu_ = std::move(menu); - - this->menu_->installEventFilter( - new FunctionEventFilter(this, [this](QObject *, QEvent *event) { - if (event->type() == QEvent::Hide) - { - QTimer::singleShot(20, this, - [this] { this->menuVisible_ = false; }); - } - return false; - })); -} - -void Button::paintEvent(QPaintEvent *) -{ - QPainter painter(this); - - painter.setRenderHint(QPainter::SmoothPixmapTransform); - - if (!this->pixmap_.isNull()) - { - if (!this->mouseOver_ && this->dimPixmap_ && this->enabled_) - { - painter.setOpacity(this->getCurrentDimAmount()); - } - - QRect rect = this->rect(); - int s = this->enableMargin_ ? int(6 * this->scale()) : 0; - - rect.moveLeft(s); - rect.setRight(rect.right() - s - s); - rect.moveTop(s); - rect.setBottom(rect.bottom() - s - s); - - painter.drawPixmap(rect, this->pixmap_); - - painter.setOpacity(1); - } - - this->fancyPaint(painter); - - if (this->borderColor_.isValid()) - { - painter.setRenderHint(QPainter::Antialiasing, false); - painter.setPen(this->borderColor_); - painter.drawRect(0, 0, this->width() - 1, this->height() - 1); - } -} - -void Button::fancyPaint(QPainter &painter) -{ - if (!this->enabled_) - { - return; - } - - painter.setRenderHint(QPainter::HighQualityAntialiasing); - painter.setRenderHint(QPainter::Antialiasing); - QColor c; - - if (this->mouseEffectColor_) - { - c = this->mouseEffectColor_.get(); - } - else - { - c = this->theme->isLightTheme() ? QColor(0, 0, 0) - : QColor(255, 255, 255); - } - - if (this->hoverMultiplier_ > 0) - { - QRadialGradient gradient(QPointF(mousePos_), this->width() / 2); - - gradient.setColorAt(0, QColor(c.red(), c.green(), c.blue(), - int(50 * this->hoverMultiplier_))); - gradient.setColorAt(1, QColor(c.red(), c.green(), c.blue(), - int(40 * this->hoverMultiplier_))); - - painter.fillRect(this->rect(), gradient); - } - - for (auto effect : this->clickEffects_) - { - QRadialGradient gradient(effect.position.x(), effect.position.y(), - effect.progress * qreal(width()) * 2, - effect.position.x(), effect.position.y()); - - gradient.setColorAt(0, QColor(c.red(), c.green(), c.blue(), - int((1 - effect.progress) * 95))); - gradient.setColorAt(0.9999, QColor(c.red(), c.green(), c.blue(), - int((1 - effect.progress) * 95))); - gradient.setColorAt(1, QColor(c.red(), c.green(), c.blue(), int(0))); - - painter.fillRect(this->rect(), gradient); - } -} - -void Button::enterEvent(QEvent *) -{ - this->mouseOver_ = true; -} - -void Button::leaveEvent(QEvent *) -{ - this->mouseOver_ = false; -} - -void Button::mousePressEvent(QMouseEvent *event) -{ - if (!this->enabled_) - { - return; - } - - if (event->button() != Qt::LeftButton) - { - return; - } - - this->clickEffects_.push_back(ClickEffect(event->pos())); - - this->mouseDown_ = true; - - emit this->leftMousePress(); - - if (this->menu_ && !this->menuVisible_) - { - QTimer::singleShot(80, this, [this] { this->showMenu(); }); - this->mouseDown_ = false; - this->mouseOver_ = false; - } -} - -void Button::mouseReleaseEvent(QMouseEvent *event) -{ - if (!this->enabled_) - return; - - if (event->button() == Qt::LeftButton) - { - this->mouseDown_ = false; - - if (this->rect().contains(event->pos())) - emit leftClicked(); - } - - emit clicked(event->button()); -} - -void Button::mouseMoveEvent(QMouseEvent *event) -{ - if (this->enabled_) - { - this->mousePos_ = event->pos(); - - this->update(); - } -} - -void Button::onMouseEffectTimeout() -{ - bool performUpdate = false; - - if (selected_) - { - if (this->hoverMultiplier_ != 0) - { - this->hoverMultiplier_ = - std::max(0.0, this->hoverMultiplier_ - 0.1); - performUpdate = true; - } - } - else if (mouseOver_) - { - if (this->hoverMultiplier_ != 1) - { - this->hoverMultiplier_ = - std::min(1.0, this->hoverMultiplier_ + 0.5); - performUpdate = true; - } - } - else - { - if (this->hoverMultiplier_ != 0) - { - this->hoverMultiplier_ = - std::max(0.0, this->hoverMultiplier_ - 0.3); - performUpdate = true; - } - } - - if (this->clickEffects_.size() != 0) - { - performUpdate = true; - - for (auto it = this->clickEffects_.begin(); - it != this->clickEffects_.end();) - { - it->progress += mouseDown_ ? 0.02 : 0.07; - - if (it->progress >= 1.0) - { - it = this->clickEffects_.erase(it); - } - else - { - it++; - } - } - } - - if (performUpdate) - { - update(); - } -} - -void Button::showMenu() -{ - if (!this->menu_) - return; - - auto point = [this] { - auto bounds = QApplication::desktop()->availableGeometry(this); - - auto point = this->mapToGlobal( - QPoint(this->width() - this->menu_->width(), this->height())); - - if (point.y() + this->menu_->height() > bounds.bottom()) - { - point.setY(point.y() - this->menu_->height() - this->height()); - } - - return point; - }; - - this->menu_->popup(point()); - this->menu_->move(point()); - this->menuVisible_ = true; -} - -} // namespace chatterino diff --git a/src/widgets/helper/Button.hpp b/src/widgets/helper/Button.hpp deleted file mode 100644 index 318c5416..00000000 --- a/src/widgets/helper/Button.hpp +++ /dev/null @@ -1,89 +0,0 @@ -#pragma once - -#include - -#include "widgets/BaseWidget.hpp" - -#include -#include -#include -#include -#include -#include - -namespace chatterino { - -class Button : public BaseWidget -{ - Q_OBJECT - - struct ClickEffect { - double progress = 0.0; - QPoint position; - - ClickEffect(QPoint _position) - : position(_position) - { - } - }; - -public: - Button(BaseWidget *parent = nullptr); - - void setMouseEffectColor(boost::optional color); - void setPixmap(const QPixmap &pixmap_); - const QPixmap &getPixmap() const; - - void setDim(bool value); - bool getDim() const; - qreal getCurrentDimAmount() const; - - void setEnable(bool value); - bool getEnable() const; - - void setEnableMargin(bool value); - bool getEnableMargin() const; - - void setBorderColor(const QColor &color); - const QColor &getBorderColor() const; - - void setMenu(std::unique_ptr menu); - -signals: - void leftClicked(); - void clicked(Qt::MouseButton button); - void leftMousePress(); - -protected: - virtual void paintEvent(QPaintEvent *) override; - virtual void enterEvent(QEvent *) override; - virtual void leaveEvent(QEvent *) override; - virtual void mousePressEvent(QMouseEvent *event) override; - virtual void mouseReleaseEvent(QMouseEvent *event) override; - virtual void mouseMoveEvent(QMouseEvent *event) override; - - void fancyPaint(QPainter &painter); - - bool enabled_{true}; - bool selected_{false}; - bool mouseOver_{false}; - bool mouseDown_{false}; - bool menuVisible_{false}; - -private: - void onMouseEffectTimeout(); - void showMenu(); - - QColor borderColor_{}; - QPixmap pixmap_{}; - bool dimPixmap_{true}; - bool enableMargin_{true}; - QPoint mousePos_{}; - double hoverMultiplier_{0.0}; - QTimer effectTimer_{}; - std::vector clickEffects_{}; - boost::optional mouseEffectColor_{}; - std::unique_ptr menu_{}; -}; - -} // namespace chatterino diff --git a/src/widgets/helper/NotebookButton.hpp b/src/widgets/helper/NotebookButton.hpp index b0e46c8f..09ef8f47 100644 --- a/src/widgets/helper/NotebookButton.hpp +++ b/src/widgets/helper/NotebookButton.hpp @@ -1,6 +1,6 @@ #pragma once -#include "Button.hpp" +#include "widgets/helper/Button.hpp" #include diff --git a/src/widgets/helper/TitlebarButton.cpp b/src/widgets/helper/TitlebarButton.cpp deleted file mode 100644 index 51be6b9a..00000000 --- a/src/widgets/helper/TitlebarButton.cpp +++ /dev/null @@ -1,134 +0,0 @@ -#include "TitlebarButton.hpp" - -#include "singletons/Theme.hpp" - -namespace chatterino { - -TitleBarButton::TitleBarButton() - : Button(nullptr) -{ -} - -TitleBarButtonStyle TitleBarButton::getButtonStyle() const -{ - return this->style_; -} - -void TitleBarButton::setButtonStyle(TitleBarButtonStyle _style) -{ - this->style_ = _style; - this->update(); -} - -void TitleBarButton::paintEvent(QPaintEvent *event) -{ - QPainter painter(this); - - painter.setOpacity(this->getCurrentDimAmount()); - - QColor color = this->theme->window.text; - QColor background = this->theme->window.background; - - int xD = this->height() / 3; - int centerX = this->width() / 2; - - painter.setRenderHint(QPainter::Antialiasing, false); - - switch (this->style_) - { - case TitleBarButtonStyle::Minimize: - { - painter.fillRect(centerX - xD / 2, xD * 3 / 2, xD, 1, color); - break; - } - case TitleBarButtonStyle::Maximize: - { - painter.setPen(color); - painter.drawRect(centerX - xD / 2, xD, xD - 1, xD - 1); - break; - } - case TitleBarButtonStyle::Unmaximize: - { - int xD2 = xD * 1 / 5; - int xD3 = xD * 4 / 5; - - painter.drawRect(centerX - xD / 2 + xD2, xD, xD3, xD3); - painter.fillRect(centerX - xD / 2, xD + xD2, xD3, xD3, - this->theme->window.background); - painter.drawRect(centerX - xD / 2, xD + xD2, xD3, xD3); - break; - } - case TitleBarButtonStyle::Close: - { - QRect rect(centerX - xD / 2, xD, xD - 1, xD - 1); - painter.setPen(QPen(color, 1)); - - painter.drawLine(rect.topLeft(), rect.bottomRight()); - painter.drawLine(rect.topRight(), rect.bottomLeft()); - break; - } - case TitleBarButtonStyle::User: - { - color = "#999"; - - painter.setRenderHint(QPainter::Antialiasing); - painter.setRenderHint(QPainter::HighQualityAntialiasing); - - auto a = xD / 3; - QPainterPath path; - - painter.save(); - painter.translate(3, 3); - - path.arcMoveTo(a, 4 * a, 6 * a, 6 * a, 0); - path.arcTo(a, 4 * a, 6 * a, 6 * a, 0, 180); - - painter.fillPath(path, color); - - painter.setBrush(background); - painter.drawEllipse(2 * a, 1 * a, 4 * a, 4 * a); - - painter.setBrush(color); - painter.drawEllipse(2.5 * a, 1.5 * a, 3 * a + 1, 3 * a); - painter.restore(); - - break; - } - case TitleBarButtonStyle::Settings: - { - color = "#999"; - painter.setRenderHint(QPainter::Antialiasing); - painter.setRenderHint(QPainter::HighQualityAntialiasing); - - painter.save(); - painter.translate(3, 3); - - auto a = xD / 3; - QPainterPath path; - - path.arcMoveTo(a, a, 6 * a, 6 * a, 0 - (360 / 32.0)); - - for (int i = 0; i < 8; i++) - { - path.arcTo(a, a, 6 * a, 6 * a, i * (360 / 8.0) - (360 / 32.0), - (360 / 32.0)); - path.arcTo(2 * a, 2 * a, 4 * a, 4 * a, - i * (360 / 8.0) + (360 / 32.0), (360 / 32.0)); - } - - painter.strokePath(path, color); - painter.fillPath(path, color); - - painter.setBrush(background); - painter.drawEllipse(3 * a, 3 * a, 2 * a, 2 * a); - painter.restore(); - break; - } - default:; - } - - Button::paintEvent(event); - // this->fancyPaint(painter); -} - -} // namespace chatterino diff --git a/src/widgets/helper/TitlebarButton.hpp b/src/widgets/helper/TitlebarButton.hpp deleted file mode 100644 index ed1261e9..00000000 --- a/src/widgets/helper/TitlebarButton.hpp +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include "widgets/helper/Button.hpp" - -namespace chatterino { - -enum class TitleBarButtonStyle { - None = 0, - Minimize = 1, - Maximize = 2, - Unmaximize = 4, - Close = 8, - User = 16, - Settings = 32 -}; - -class TitleBarButton : public Button -{ -public: - TitleBarButton(); - - TitleBarButtonStyle getButtonStyle() const; - void setButtonStyle(TitleBarButtonStyle style_); - -protected: - void paintEvent(QPaintEvent *) override; - -private: - TitleBarButtonStyle style_; -}; - -} // namespace chatterino