refactor: buttons and friends (#6102)

This commit is contained in:
nerix
2025-05-25 11:17:06 +02:00
committed by GitHub
parent deed1061b5
commit 84c0b39fde
49 changed files with 1083 additions and 691 deletions
+15 -3
View File
@@ -15,6 +15,9 @@
namespace chatterino {
class Button;
class PixmapButton;
class SvgButton;
class Window;
class UpdateDialog;
class NotebookButton;
@@ -131,7 +134,16 @@ protected:
void paintEvent(QPaintEvent *) override;
NotebookButton *getAddButton();
NotebookButton *addCustomButton();
template <typename T>
T *addCustomButton(auto &&...args)
{
auto *btn = new T(std::forward<decltype(args)>(args)..., this);
this->customButtons_.push_back(btn);
this->performLayout();
return btn;
}
struct Item {
NotebookTab *tab{};
@@ -206,7 +218,7 @@ private:
QWidget *selectedPage_ = nullptr;
NotebookButton *addButton_;
std::vector<NotebookButton *> customButtons_;
std::vector<Button *> customButtons_;
bool allowUserTabManagement_ = false;
bool showTabs_ = true;
@@ -261,7 +273,7 @@ private:
pajlada::Signals::SignalHolder signalHolder_;
// Main window on Windows has basically a duplicate of this in Window
NotebookButton *streamerModeIcon_{};
PixmapButton *streamerModeIcon_{};
void updateStreamerModeIcon();
};