added categories to the accountspage
This commit is contained in:
@@ -9,7 +9,29 @@ namespace accounts {
|
||||
AccountController::AccountController()
|
||||
{
|
||||
this->twitch.accounts.itemInserted.connect([this](const auto &args) {
|
||||
accounts.insertItem(std::dynamic_pointer_cast<Account>(args.item));
|
||||
this->accounts.insertItem(std::dynamic_pointer_cast<Account>(args.item));
|
||||
});
|
||||
|
||||
this->twitch.accounts.itemRemoved.connect([this](const auto &args) {
|
||||
if (args.caller != this) {
|
||||
auto &accs = this->twitch.accounts.getVector();
|
||||
auto it = std::find(accs.begin(), accs.end(), args.item);
|
||||
assert(it != accs.end());
|
||||
|
||||
this->accounts.removeItem(it - accs.begin());
|
||||
}
|
||||
});
|
||||
|
||||
this->accounts.itemRemoved.connect([this](const auto &args) {
|
||||
switch (args.item->getProviderId()) {
|
||||
case ProviderId::Twitch: {
|
||||
auto &accs = this->twitch.accounts.getVector();
|
||||
auto it = std::find(accs.begin(), accs.end(), args.item);
|
||||
assert(it != accs.end());
|
||||
|
||||
this->twitch.accounts.removeItem(it - accs.begin(), this);
|
||||
} break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -21,8 +43,18 @@ void AccountController::load()
|
||||
AccountModel *AccountController::createModel(QObject *parent)
|
||||
{
|
||||
AccountModel *model = new AccountModel(parent);
|
||||
// model->accountRemoved.connect([this](const auto &account) {
|
||||
// switch (account->getProviderId()) {
|
||||
// case ProviderId::Twitch: {
|
||||
// auto &accs = this->twitch.accounts.getVector();
|
||||
// auto it = std::find(accs.begin(), accs.end(), account);
|
||||
// assert(it != accs.end());
|
||||
|
||||
// this->twitch.accounts.removeItem(it - accs.begin());
|
||||
// } break;
|
||||
// }
|
||||
// });
|
||||
|
||||
//(util::BaseSignalVector<stdAccount> *)
|
||||
model->init(&this->accounts);
|
||||
return model;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user