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