lazily initialize settings pages
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
namespace chatterino {
|
||||
|
||||
AboutPage::AboutPage()
|
||||
: SettingsPage("About")
|
||||
{
|
||||
LayoutCreator<AboutPage> layoutCreator(this);
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
namespace chatterino {
|
||||
|
||||
AccountsPage::AccountsPage()
|
||||
: SettingsPage("Accounts")
|
||||
{
|
||||
auto *app = getApp();
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ namespace {
|
||||
} // namespace
|
||||
|
||||
CommandPage::CommandPage()
|
||||
: SettingsPage("Commands")
|
||||
{
|
||||
auto app = getApp();
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
namespace chatterino {
|
||||
|
||||
ExternalToolsPage::ExternalToolsPage()
|
||||
: SettingsPage("External tools")
|
||||
{
|
||||
LayoutCreator<ExternalToolsPage> layoutCreator(this);
|
||||
auto layout = layoutCreator.setLayoutType<QVBoxLayout>();
|
||||
|
||||
@@ -237,7 +237,6 @@ bool SettingsLayout::filterElements(const QString &query)
|
||||
}
|
||||
|
||||
GeneralPage::GeneralPage()
|
||||
: SettingsPage("General")
|
||||
{
|
||||
auto y = new QVBoxLayout;
|
||||
auto scroll = new QScrollArea;
|
||||
@@ -263,9 +262,7 @@ GeneralPage::GeneralPage()
|
||||
bool GeneralPage::filterElements(const QString &query)
|
||||
{
|
||||
if (this->settingsLayout_)
|
||||
return this->settingsLayout_->filterElements(query) ||
|
||||
this->name_.contains(query, Qt::CaseInsensitive) ||
|
||||
query.isEmpty();
|
||||
return this->settingsLayout_->filterElements(query) || query.isEmpty();
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
namespace chatterino {
|
||||
|
||||
HighlightingPage::HighlightingPage()
|
||||
: SettingsPage("Highlights")
|
||||
{
|
||||
auto app = getApp();
|
||||
LayoutCreator<HighlightingPage> layoutCreator(this);
|
||||
|
||||
@@ -29,7 +29,6 @@ static void addUsersTab(IgnoresPage &page, LayoutCreator<QVBoxLayout> box,
|
||||
QStringListModel &model);
|
||||
|
||||
IgnoresPage::IgnoresPage()
|
||||
: SettingsPage("Ignores")
|
||||
{
|
||||
LayoutCreator<IgnoresPage> layoutCreator(this);
|
||||
auto layout = layoutCreator.setLayoutType<QVBoxLayout>();
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
namespace chatterino {
|
||||
|
||||
KeyboardSettingsPage::KeyboardSettingsPage()
|
||||
: SettingsPage("Keybindings")
|
||||
{
|
||||
auto layout =
|
||||
LayoutCreator<KeyboardSettingsPage>(this).setLayoutType<QVBoxLayout>();
|
||||
|
||||
@@ -73,7 +73,6 @@ QString fetchLogDirectorySize()
|
||||
}
|
||||
|
||||
ModerationPage::ModerationPage()
|
||||
: SettingsPage("Moderation")
|
||||
{
|
||||
auto app = getApp();
|
||||
LayoutCreator<ModerationPage> layoutCreator(this);
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
namespace chatterino {
|
||||
|
||||
NotificationPage::NotificationPage()
|
||||
: SettingsPage("Notifications")
|
||||
{
|
||||
LayoutCreator<NotificationPage> layoutCreator(this);
|
||||
auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
|
||||
|
||||
@@ -64,20 +64,13 @@ bool filterItemsRec(QObject *object, const QString &query)
|
||||
return any;
|
||||
}
|
||||
|
||||
SettingsPage::SettingsPage(const QString &name)
|
||||
: name_(name)
|
||||
SettingsPage::SettingsPage()
|
||||
{
|
||||
}
|
||||
|
||||
bool SettingsPage::filterElements(const QString &query)
|
||||
{
|
||||
return filterItemsRec(this, query) || query.isEmpty() ||
|
||||
this->name_.contains(query, Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
const QString &SettingsPage::getName()
|
||||
{
|
||||
return this->name_;
|
||||
return filterItemsRec(this, query) || query.isEmpty();
|
||||
}
|
||||
|
||||
SettingsDialogTab *SettingsPage::tab() const
|
||||
|
||||
@@ -47,9 +47,7 @@ class SettingsPage : public QFrame
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SettingsPage(const QString &name);
|
||||
|
||||
const QString &getName();
|
||||
SettingsPage();
|
||||
|
||||
virtual bool filterElements(const QString &query);
|
||||
|
||||
@@ -71,7 +69,6 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
QString name_;
|
||||
SettingsDialogTab *tab_;
|
||||
pajlada::Signals::NoArgSignal onCancel_;
|
||||
std::vector<pajlada::Signals::ScopedConnection> managedConnections_;
|
||||
|
||||
Reference in New Issue
Block a user