changed AccountManager to AccountController
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
#include "application.hpp"
|
||||
#include "channel.hpp"
|
||||
#include "credentials.hpp"
|
||||
#include "singletons/accountmanager.hpp"
|
||||
#include "singletons/settingsmanager.hpp"
|
||||
#include "ui_accountpopupform.h"
|
||||
#include "util/urlfetch.hpp"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "application.hpp"
|
||||
#include "const.hpp"
|
||||
#include "singletons/accountmanager.hpp"
|
||||
#include "controllers/accounts/accountcontroller.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
namespace widgets {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "emotepopup.hpp"
|
||||
|
||||
#include "application.hpp"
|
||||
#include "controllers/accounts/accountcontroller.hpp"
|
||||
#include "messages/messagebuilder.hpp"
|
||||
#include "providers/twitch/twitchchannel.hpp"
|
||||
#include "singletons/accountmanager.hpp"
|
||||
#include "widgets/notebook.hpp"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
|
||||
@@ -2,11 +2,17 @@
|
||||
|
||||
#include "application.hpp"
|
||||
#include "const.hpp"
|
||||
#include "singletons/accountmanager.hpp"
|
||||
#include "controllers/accounts/accountcontroller.hpp"
|
||||
#include "controllers/accounts/accountmodel.hpp"
|
||||
#include "util/layoutcreator.hpp"
|
||||
#include "widgets/helper/editablemodelview.hpp"
|
||||
#include "widgets/logindialog.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QHeaderView>
|
||||
#include <QTableView>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
namespace chatterino {
|
||||
@@ -16,32 +22,42 @@ namespace settingspages {
|
||||
AccountsPage::AccountsPage()
|
||||
: SettingsPage("Accounts", ":/images/accounts.svg")
|
||||
{
|
||||
auto *app = getApp();
|
||||
|
||||
util::LayoutCreator<AccountsPage> layoutCreator(this);
|
||||
|
||||
auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
|
||||
auto buttons = layout.emplace<QDialogButtonBox>();
|
||||
{
|
||||
this->addButton = buttons->addButton("Add", QDialogButtonBox::YesRole);
|
||||
this->removeButton = buttons->addButton("Remove", QDialogButtonBox::NoRole);
|
||||
}
|
||||
|
||||
layout.emplace<AccountSwitchWidget>(this).assign(&this->accSwitchWidget);
|
||||
helper::EditableModelView *view =
|
||||
*layout.emplace<helper::EditableModelView>(app->accounts->createModel(nullptr));
|
||||
|
||||
view->setTitles({"Name"});
|
||||
view->getTableView()->horizontalHeader()->setStretchLastSection(true);
|
||||
|
||||
view->addButtonPressed.connect([] {});
|
||||
|
||||
// auto buttons = layout.emplace<QDialogButtonBox>();
|
||||
// {
|
||||
// this->addButton = buttons->addButton("Add", QDialogButtonBox::YesRole);
|
||||
// this->removeButton = buttons->addButton("Remove", QDialogButtonBox::NoRole);
|
||||
// }
|
||||
|
||||
// layout.emplace<AccountSwitchWidget>(this).assign(&this->accSwitchWidget);
|
||||
|
||||
// ----
|
||||
QObject::connect(this->addButton, &QPushButton::clicked, []() {
|
||||
static auto loginWidget = new LoginWidget();
|
||||
loginWidget->show();
|
||||
});
|
||||
// QObject::connect(this->addButton, &QPushButton::clicked, []() {
|
||||
// static auto loginWidget = new LoginWidget();
|
||||
// loginWidget->show();
|
||||
// });
|
||||
|
||||
QObject::connect(this->removeButton, &QPushButton::clicked, [this] {
|
||||
auto selectedUser = this->accSwitchWidget->currentItem()->text();
|
||||
if (selectedUser == ANONYMOUS_USERNAME_LABEL) {
|
||||
// Do nothing
|
||||
return;
|
||||
}
|
||||
// QObject::connect(this->removeButton, &QPushButton::clicked, [this] {
|
||||
// auto selectedUser = this->accSwitchWidget->currentItem()->text();
|
||||
// if (selectedUser == ANONYMOUS_USERNAME_LABEL) {
|
||||
// // Do nothing
|
||||
// return;
|
||||
// }
|
||||
|
||||
getApp()->accounts->Twitch.removeUser(selectedUser);
|
||||
});
|
||||
// getApp()->accounts->Twitch.removeUser(selectedUser);
|
||||
// });
|
||||
}
|
||||
|
||||
} // namespace settingspages
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "ignoreuserspage.hpp"
|
||||
|
||||
#include "application.hpp"
|
||||
#include "controllers/accounts/accountcontroller.hpp"
|
||||
#include "controllers/ignores/ignorecontroller.hpp"
|
||||
#include "controllers/ignores/ignoremodel.hpp"
|
||||
#include "singletons/accountmanager.hpp"
|
||||
#include "singletons/settingsmanager.hpp"
|
||||
#include "util/layoutcreator.hpp"
|
||||
#include "widgets/helper/editablemodelview.hpp"
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
#include "moderationpage.hpp"
|
||||
|
||||
#include "application.hpp"
|
||||
#include "controllers/taggedusers/taggeduserscontroller.hpp"
|
||||
#include "controllers/taggedusers/taggedusersmodel.hpp"
|
||||
#include "singletons/pathmanager.hpp"
|
||||
#include "util/layoutcreator.hpp"
|
||||
#include "widgets/helper/editablemodelview.hpp"
|
||||
|
||||
#include <QFormLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QHeaderView>
|
||||
#include <QLabel>
|
||||
#include <QListView>
|
||||
#include <QPushButton>
|
||||
#include <QTableView>
|
||||
#include <QTextEdit>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
@@ -32,37 +38,41 @@ ModerationPage::ModerationPage()
|
||||
auto app = getApp();
|
||||
util::LayoutCreator<ModerationPage> layoutCreator(this);
|
||||
|
||||
auto layout = layoutCreator.setLayoutType<QVBoxLayout>();
|
||||
auto tabs = layoutCreator.emplace<QTabWidget>();
|
||||
|
||||
auto logs = tabs.appendTab(new QVBoxLayout, "Logs");
|
||||
{
|
||||
// Logs (copied from LoggingMananger)
|
||||
auto logPath = app->paths->logsFolderPath;
|
||||
|
||||
auto created = layout.emplace<QLabel>();
|
||||
auto created = logs.emplace<QLabel>();
|
||||
created->setText("Logs are saved to " + CreateLink(logPath, true));
|
||||
created->setTextFormat(Qt::RichText);
|
||||
created->setTextInteractionFlags(Qt::TextBrowserInteraction |
|
||||
Qt::LinksAccessibleByKeyboard |
|
||||
Qt::LinksAccessibleByKeyboard);
|
||||
created->setOpenExternalLinks(true);
|
||||
layout.append(this->createCheckBox("Enable logging", app->settings->enableLogging));
|
||||
logs.append(this->createCheckBox("Enable logging", app->settings->enableLogging));
|
||||
|
||||
layout->addStretch(1);
|
||||
// Logs end
|
||||
logs->addStretch(1);
|
||||
}
|
||||
|
||||
auto modMode = tabs.appendTab(new QVBoxLayout, "Moderation mode");
|
||||
{
|
||||
// clang-format off
|
||||
auto label = layout.emplace<QLabel>("Click the moderation mod button (<img width='18' height='18' src=':/images/moderatormode_disabled.png'>) in a channel that you moderate to enable moderator mode.<br>");
|
||||
auto label = modMode.emplace<QLabel>("Click the moderation mod button (<img width='18' height='18' src=':/images/moderatormode_disabled.png'>) in a channel that you moderate to enable moderator mode.<br>");
|
||||
label->setWordWrap(true);
|
||||
label->setStyleSheet("color: #bbb");
|
||||
// clang-format on
|
||||
|
||||
auto form = layout.emplace<QFormLayout>();
|
||||
{
|
||||
form->addRow("Action on timed out messages (unimplemented):",
|
||||
this->createComboBox({"Disable", "Hide"}, app->settings->timeoutAction));
|
||||
}
|
||||
// auto form = modMode.emplace<QFormLayout>();
|
||||
// {
|
||||
// form->addRow("Action on timed out messages (unimplemented):",
|
||||
// this->createComboBox({"Disable", "Hide"},
|
||||
// app->settings->timeoutAction));
|
||||
// }
|
||||
|
||||
auto modButtons =
|
||||
layout.emplace<QGroupBox>("Custom moderator buttons").setLayoutType<QVBoxLayout>();
|
||||
modMode.emplace<QGroupBox>("Custom moderator buttons").setLayoutType<QVBoxLayout>();
|
||||
{
|
||||
auto label2 =
|
||||
modButtons.emplace<QLabel>("One action per line. {user} will be replaced with the "
|
||||
@@ -80,6 +90,20 @@ ModerationPage::ModerationPage()
|
||||
app->settings->moderationActions = text->toPlainText();
|
||||
});
|
||||
}
|
||||
|
||||
/*auto taggedUsers = tabs.appendTab(new QVBoxLayout, "Tagged users");
|
||||
{
|
||||
helper::EditableModelView *view = *taggedUsers.emplace<helper::EditableModelView>(
|
||||
app->taggedUsers->createModel(nullptr));
|
||||
|
||||
view->setTitles({"Name"});
|
||||
view->getTableView()->horizontalHeader()->setStretchLastSection(true);
|
||||
|
||||
view->addButtonPressed.connect([] {
|
||||
getApp()->taggedUsers->users.appendItem(
|
||||
controllers::taggedusers::TaggedUser(ProviderId::Twitch, "example", "xD"));
|
||||
});
|
||||
}*/
|
||||
}
|
||||
|
||||
// ---- misc
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "widgets/window.hpp"
|
||||
|
||||
#include "application.hpp"
|
||||
#include "singletons/accountmanager.hpp"
|
||||
#include "controllers/accounts/accountcontroller.hpp"
|
||||
#include "singletons/ircmanager.hpp"
|
||||
#include "singletons/settingsmanager.hpp"
|
||||
#include "singletons/thememanager.hpp"
|
||||
|
||||
Reference in New Issue
Block a user