refactor: buttons and friends (#6102)
This commit is contained in:
@@ -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();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user