changed AccountManager to AccountController
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
#include "account.hpp"
|
||||
|
||||
#include <tuple>
|
||||
|
||||
namespace chatterino {
|
||||
namespace controllers {
|
||||
namespace accounts {
|
||||
|
||||
Account::Account(const QString &category)
|
||||
Account::Account(const QString &_category)
|
||||
: category(_category)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -15,14 +18,10 @@ const QString &Account::getCategory() const
|
||||
|
||||
bool Account::operator<(const Account &other) const
|
||||
{
|
||||
if (this->category < other.category) {
|
||||
return true;
|
||||
} else if (this->category == other.category) {
|
||||
if (this->toString() < other.toString()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
QString a = this->toString();
|
||||
QString b = other.toString();
|
||||
|
||||
return std::tie(this->category, a) < std::tie(other.category, b);
|
||||
}
|
||||
|
||||
} // namespace accounts
|
||||
|
||||
@@ -10,6 +10,11 @@ AccountController::AccountController()
|
||||
{
|
||||
}
|
||||
|
||||
void AccountController::load()
|
||||
{
|
||||
this->Twitch.load();
|
||||
}
|
||||
|
||||
AccountModel *AccountController::createModel(QObject *parent)
|
||||
{
|
||||
AccountModel *model = new AccountModel(parent);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <QObject>
|
||||
|
||||
#include "controllers/accounts/account.hpp"
|
||||
#include "providers/twitch/twitchaccountmanager.hpp"
|
||||
#include "util/sharedptrelementless.hpp"
|
||||
#include "util/signalvector2.hpp"
|
||||
|
||||
@@ -19,6 +20,10 @@ public:
|
||||
|
||||
AccountModel *createModel(QObject *parent);
|
||||
|
||||
void load();
|
||||
|
||||
providers::twitch::TwitchAccountManager Twitch;
|
||||
|
||||
private:
|
||||
util::SortedSignalVector<std::shared_ptr<Account>, util::SharedPtrElementLess<Account>>
|
||||
accounts;
|
||||
|
||||
@@ -10,9 +10,10 @@ AccountModel::AccountModel(QObject *parent)
|
||||
}
|
||||
|
||||
// turn a vector item into a model row
|
||||
std::shared_ptr<Account> AccountModel::getItemFromRow(std::vector<QStandardItem *> &row)
|
||||
std::shared_ptr<Account> AccountModel::getItemFromRow(std::vector<QStandardItem *> &,
|
||||
const std::shared_ptr<Account> &original)
|
||||
{
|
||||
return nullptr;
|
||||
return original;
|
||||
}
|
||||
|
||||
// turns a row in the model into a vector item
|
||||
|
||||
@@ -16,7 +16,8 @@ public:
|
||||
|
||||
protected:
|
||||
// turn a vector item into a model row
|
||||
virtual std::shared_ptr<Account> getItemFromRow(std::vector<QStandardItem *> &row) override;
|
||||
virtual std::shared_ptr<Account> getItemFromRow(
|
||||
std::vector<QStandardItem *> &row, const std::shared_ptr<Account> &original) override;
|
||||
|
||||
// turns a row in the model into a vector item
|
||||
virtual void getRowFromItem(const std::shared_ptr<Account> &item,
|
||||
|
||||
Reference in New Issue
Block a user