moved settings tab icons to SettingsDialog
This commit is contained in:
@@ -157,32 +157,33 @@ void SettingsDialog::addTabs()
|
||||
|
||||
this->ui_.tabContainer->setContentsMargins(0, 20, 0, 20);
|
||||
|
||||
this->addTab(new GeneralPage);
|
||||
this->addTab(new GeneralPage, ":/settings/about.svg");
|
||||
|
||||
this->ui_.tabContainer->addSpacing(16);
|
||||
|
||||
this->addTab(new AccountsPage);
|
||||
this->addTab(new AccountsPage, ":/settings/accounts.svg");
|
||||
|
||||
this->ui_.tabContainer->addSpacing(16);
|
||||
|
||||
this->addTab(new CommandPage);
|
||||
this->addTab(new HighlightingPage);
|
||||
this->addTab(new IgnoresPage);
|
||||
this->addTab(new CommandPage, ":/settings/commands.svg");
|
||||
this->addTab(new HighlightingPage, ":/settings/notifications.svg");
|
||||
this->addTab(new IgnoresPage, ":/settings/ignore.svg");
|
||||
|
||||
this->ui_.tabContainer->addSpacing(16);
|
||||
|
||||
this->addTab(new KeyboardSettingsPage);
|
||||
this->addTab(new ModerationPage);
|
||||
this->addTab(new NotificationPage);
|
||||
this->addTab(new ExternalToolsPage);
|
||||
this->addTab(new KeyboardSettingsPage, ":/settings/keybinds.svg");
|
||||
this->addTab(new ModerationPage, ":/settings/moderation.svg");
|
||||
this->addTab(new NotificationPage, ":/settings/notification2.svg");
|
||||
this->addTab(new ExternalToolsPage, ":/settings/externaltools.svg");
|
||||
|
||||
this->ui_.tabContainer->addStretch(1);
|
||||
this->addTab(new AboutPage, Qt::AlignBottom);
|
||||
this->addTab(new AboutPage, ":/settings/about.svg", Qt::AlignBottom);
|
||||
}
|
||||
|
||||
void SettingsDialog::addTab(SettingsPage *page, Qt::Alignment alignment)
|
||||
void SettingsDialog::addTab(SettingsPage *page, const QString &iconPath,
|
||||
Qt::Alignment alignment)
|
||||
{
|
||||
auto tab = new SettingsDialogTab(this, page, page->getIconResource());
|
||||
auto tab = new SettingsDialogTab(this, page, iconPath);
|
||||
page->setTab(tab);
|
||||
|
||||
this->ui_.pageStack->addWidget(page);
|
||||
|
||||
@@ -49,8 +49,9 @@ private:
|
||||
|
||||
void initUi();
|
||||
void addTabs();
|
||||
void addTab(SettingsPage *page, Qt::Alignment alignment = Qt::AlignTop);
|
||||
void selectTab(SettingsDialogTab *tab, bool byUser = true);
|
||||
void addTab(SettingsPage *page, const QString &iconPath,
|
||||
Qt::Alignment alignment = Qt::AlignTop);
|
||||
void selectTab(SettingsDialogTab *tab, const bool byUser = true);
|
||||
void selectPage(SettingsPage *page);
|
||||
void selectTab(SettingsTabId id);
|
||||
SettingsDialogTab *tab(SettingsTabId id);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
namespace chatterino {
|
||||
|
||||
AboutPage::AboutPage()
|
||||
: SettingsPage("About", ":/settings/about.svg")
|
||||
: SettingsPage("About")
|
||||
{
|
||||
LayoutCreator<AboutPage> layoutCreator(this);
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
namespace chatterino {
|
||||
|
||||
AccountsPage::AccountsPage()
|
||||
: SettingsPage("Accounts", ":/settings/accounts.svg")
|
||||
: SettingsPage("Accounts")
|
||||
{
|
||||
auto *app = getApp();
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace {
|
||||
} // namespace
|
||||
|
||||
CommandPage::CommandPage()
|
||||
: SettingsPage("Commands", ":/settings/commands.svg")
|
||||
: SettingsPage("Commands")
|
||||
{
|
||||
auto app = getApp();
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace chatterino {
|
||||
|
||||
ExternalToolsPage::ExternalToolsPage()
|
||||
: SettingsPage("External tools", ":/settings/externaltools.svg")
|
||||
: SettingsPage("External tools")
|
||||
{
|
||||
LayoutCreator<ExternalToolsPage> layoutCreator(this);
|
||||
auto layout = layoutCreator.setLayoutType<QVBoxLayout>();
|
||||
|
||||
@@ -237,7 +237,7 @@ bool SettingsLayout::filterElements(const QString &query)
|
||||
}
|
||||
|
||||
GeneralPage::GeneralPage()
|
||||
: SettingsPage("General", ":/settings/about.svg")
|
||||
: SettingsPage("General")
|
||||
{
|
||||
auto y = new QVBoxLayout;
|
||||
auto scroll = new QScrollArea;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
namespace chatterino {
|
||||
|
||||
HighlightingPage::HighlightingPage()
|
||||
: SettingsPage("Highlights", ":/settings/notifications.svg")
|
||||
: SettingsPage("Highlights")
|
||||
{
|
||||
auto app = getApp();
|
||||
LayoutCreator<HighlightingPage> layoutCreator(this);
|
||||
|
||||
@@ -29,7 +29,7 @@ static void addUsersTab(IgnoresPage &page, LayoutCreator<QVBoxLayout> box,
|
||||
QStringListModel &model);
|
||||
|
||||
IgnoresPage::IgnoresPage()
|
||||
: SettingsPage("Ignores", ":/settings/ignore.svg")
|
||||
: SettingsPage("Ignores")
|
||||
{
|
||||
LayoutCreator<IgnoresPage> layoutCreator(this);
|
||||
auto layout = layoutCreator.setLayoutType<QVBoxLayout>();
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
namespace chatterino {
|
||||
|
||||
KeyboardSettingsPage::KeyboardSettingsPage()
|
||||
: SettingsPage("Keybindings", ":/settings/keybinds.svg")
|
||||
: SettingsPage("Keybindings")
|
||||
{
|
||||
auto layout =
|
||||
LayoutCreator<KeyboardSettingsPage>(this).setLayoutType<QVBoxLayout>();
|
||||
|
||||
@@ -73,7 +73,7 @@ QString fetchLogDirectorySize()
|
||||
}
|
||||
|
||||
ModerationPage::ModerationPage()
|
||||
: SettingsPage("Moderation", ":/settings/moderation.svg")
|
||||
: SettingsPage("Moderation")
|
||||
{
|
||||
auto app = getApp();
|
||||
LayoutCreator<ModerationPage> layoutCreator(this);
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
namespace chatterino {
|
||||
|
||||
NotificationPage::NotificationPage()
|
||||
: SettingsPage("Notifications", ":/settings/notification2.svg")
|
||||
: SettingsPage("Notifications")
|
||||
{
|
||||
LayoutCreator<NotificationPage> layoutCreator(this);
|
||||
auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
|
||||
|
||||
@@ -64,9 +64,8 @@ bool filterItemsRec(QObject *object, const QString &query)
|
||||
return any;
|
||||
}
|
||||
|
||||
SettingsPage::SettingsPage(const QString &name, const QString &iconResource)
|
||||
SettingsPage::SettingsPage(const QString &name)
|
||||
: name_(name)
|
||||
, iconResource_(iconResource)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -81,11 +80,6 @@ const QString &SettingsPage::getName()
|
||||
return this->name_;
|
||||
}
|
||||
|
||||
const QString &SettingsPage::getIconResource()
|
||||
{
|
||||
return this->iconResource_;
|
||||
}
|
||||
|
||||
SettingsDialogTab *SettingsPage::tab() const
|
||||
{
|
||||
return this->tab_;
|
||||
|
||||
@@ -47,10 +47,9 @@ class SettingsPage : public QFrame
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SettingsPage(const QString &name, const QString &iconResource);
|
||||
SettingsPage(const QString &name);
|
||||
|
||||
const QString &getName();
|
||||
const QString &getIconResource();
|
||||
|
||||
virtual bool filterElements(const QString &query);
|
||||
|
||||
@@ -73,10 +72,7 @@ public:
|
||||
|
||||
protected:
|
||||
QString name_;
|
||||
QString iconResource_;
|
||||
|
||||
SettingsDialogTab *tab_;
|
||||
|
||||
pajlada::Signals::NoArgSignal onCancel_;
|
||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user