Implement /ignore and /unignore commands
Simplify authorized network requests for Twitch V5 api add onShow virtual function to settings pages if they need to be refreshed when shown Actually ignoring messages from ignored users is still not implemented Working on #247
This commit is contained in:
@@ -153,6 +153,10 @@ void SettingsDialog::refresh()
|
||||
// this->ui.accountSwitchWidget->refresh();
|
||||
|
||||
getApp()->settings->saveSnapshot();
|
||||
|
||||
for (auto *tab : this->tabs) {
|
||||
tab->getSettingsPage()->onShow();
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::scaleChangedEvent(float newDpi)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "ignoreuserspage.hpp"
|
||||
|
||||
#include "application.hpp"
|
||||
#include "singletons/accountmanager.hpp"
|
||||
#include "singletons/settingsmanager.hpp"
|
||||
#include "util/layoutcreator.hpp"
|
||||
|
||||
@@ -53,8 +54,7 @@ IgnoreUsersPage::IgnoreUsersPage()
|
||||
addremove->addStretch(1);
|
||||
}
|
||||
|
||||
auto userList = users.emplace<QListView>();
|
||||
UNUSED(userList); // TODO: Fill this list in with ignored users
|
||||
users.emplace<QListView>()->setModel(&this->userListModel);
|
||||
}
|
||||
|
||||
// messages
|
||||
@@ -68,6 +68,23 @@ IgnoreUsersPage::IgnoreUsersPage()
|
||||
label->setStyleSheet("color: #BBB");
|
||||
}
|
||||
|
||||
void IgnoreUsersPage::onShow()
|
||||
{
|
||||
auto app = getApp();
|
||||
|
||||
auto user = app->accounts->Twitch.getCurrent();
|
||||
|
||||
if (user->isAnon()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList users;
|
||||
for (const auto &ignoredUser : user->getIgnores()) {
|
||||
users << ignoredUser.name;
|
||||
}
|
||||
this->userListModel.setStringList(users);
|
||||
}
|
||||
|
||||
} // namespace settingspages
|
||||
} // namespace widgets
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "widgets/settingspages/settingspage.hpp"
|
||||
|
||||
#include <QStringListModel>
|
||||
|
||||
namespace chatterino {
|
||||
namespace widgets {
|
||||
namespace settingspages {
|
||||
@@ -10,6 +12,11 @@ class IgnoreUsersPage : public SettingsPage
|
||||
{
|
||||
public:
|
||||
IgnoreUsersPage();
|
||||
|
||||
void onShow() final;
|
||||
|
||||
private:
|
||||
QStringListModel userListModel;
|
||||
};
|
||||
|
||||
} // namespace settingspages
|
||||
|
||||
@@ -28,6 +28,10 @@ public:
|
||||
QLineEdit *createLineEdit(pajlada::Settings::Setting<QString> &setting);
|
||||
QSpinBox *createSpinBox(pajlada::Settings::Setting<int> &setting, int min = 0, int max = 2500);
|
||||
|
||||
virtual void onShow()
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
QString name;
|
||||
QString iconResource;
|
||||
|
||||
Reference in New Issue
Block a user