#include "AccountsPage.hpp" #include "Application.hpp" #include "controllers/accounts/AccountController.hpp" #include "controllers/accounts/AccountModel.hpp" #include "providers/twitch/TwitchCommon.hpp" #include "util/LayoutCreator.hpp" #include "widgets/dialogs/LoginDialog.hpp" #include "widgets/helper/EditableModelView.hpp" #include #include #include #include #include namespace chatterino { AccountsPage::AccountsPage() : SettingsPage("Accounts", ":/settings/accounts.svg") { auto *app = getApp(); LayoutCreator layoutCreator(this); auto layout = layoutCreator.emplace().withoutMargin(); EditableModelView *view = layout.emplace(app->accounts->createModel(nullptr)) .getElement(); view->getTableView()->horizontalHeader()->setVisible(false); view->getTableView()->horizontalHeader()->setStretchLastSection(true); view->addButtonPressed.connect([] { static auto loginWidget = new LoginWidget(); loginWidget->show(); loginWidget->raise(); }); view->getTableView()->setStyleSheet("background: #333"); // auto buttons = layout.emplace(); // { // this->addButton = buttons->addButton("Add", // QDialogButtonBox::YesRole); this->removeButton = // buttons->addButton("Remove", QDialogButtonBox::NoRole); // } // layout.emplace(this).assign(&this->accSwitchWidget); // ---- // 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; // } // getApp()->accounts->Twitch.removeUser(selectedUser); // }); } } // namespace chatterino