Applied project style to multiple files

This commit is contained in:
fourtf
2018-07-06 18:10:21 +02:00
parent 3993708164
commit 535c0616a3
26 changed files with 149 additions and 157 deletions
+7 -7
View File
@@ -4,13 +4,13 @@
namespace chatterino {
Account::Account(ProviderId _providerId)
: providerId(_providerId)
Account::Account(ProviderId providerId)
: providerId_(providerId)
{
static QString twitch("Twitch");
this->category = [&]() {
switch (_providerId) {
this->category_ = [&]() {
switch (providerId) {
case ProviderId::Twitch:
return twitch;
}
@@ -20,12 +20,12 @@ Account::Account(ProviderId _providerId)
const QString &Account::getCategory() const
{
return this->category;
return this->category_;
}
ProviderId Account::getProviderId() const
{
return this->providerId;
return this->providerId_;
}
bool Account::operator<(const Account &other) const
@@ -33,7 +33,7 @@ bool Account::operator<(const Account &other) const
QString a = this->toString();
QString b = other.toString();
return std::tie(this->category, a) < std::tie(other.category, b);
return std::tie(this->category_, a) < std::tie(other.category_, b);
}
} // namespace chatterino
+2 -2
View File
@@ -19,8 +19,8 @@ public:
bool operator<(const Account &other) const;
private:
ProviderId providerId;
QString category;
ProviderId providerId_;
QString category_;
};
} // namespace chatterino
@@ -7,7 +7,7 @@ namespace chatterino {
AccountController::AccountController()
{
this->twitch.accounts.itemInserted.connect([this](const auto &args) {
this->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) {
@@ -16,11 +16,11 @@ AccountController::AccountController()
auto it = std::find(accs.begin(), accs.end(), args.item);
assert(it != accs.end());
this->accounts.removeItem(it - accs.begin());
this->accounts_.removeItem(it - accs.begin());
}
});
this->accounts.itemRemoved.connect([this](const auto &args) {
this->accounts_.itemRemoved.connect([this](const auto &args) {
switch (args.item->getProviderId()) {
case ProviderId::Twitch: {
auto &accs = this->twitch.accounts.getVector();
@@ -42,7 +42,7 @@ AccountModel *AccountController::createModel(QObject *parent)
{
AccountModel *model = new AccountModel(parent);
model->init(&this->accounts);
model->init(&this->accounts_);
return model;
}
@@ -23,7 +23,7 @@ public:
TwitchAccountManager twitch;
private:
SortedSignalVector<std::shared_ptr<Account>, SharedPtrElementLess<Account>> accounts;
SortedSignalVector<std::shared_ptr<Account>, SharedPtrElementLess<Account>> accounts_;
};
} // namespace chatterino
+4 -4
View File
@@ -27,7 +27,7 @@ void AccountModel::getRowFromItem(const std::shared_ptr<Account> &item,
int AccountModel::beforeInsert(const std::shared_ptr<Account> &item,
std::vector<QStandardItem *> &row, int proposedIndex)
{
if (this->categoryCount[item->getCategory()]++ == 0) {
if (this->categoryCount_[item->getCategory()]++ == 0) {
auto row = this->createRow();
setStringItem(row[0], item->getCategory(), false, false);
@@ -44,11 +44,11 @@ int AccountModel::beforeInsert(const std::shared_ptr<Account> &item,
void AccountModel::afterRemoved(const std::shared_ptr<Account> &item,
std::vector<QStandardItem *> &row, int index)
{
auto it = this->categoryCount.find(item->getCategory());
assert(it != this->categoryCount.end());
auto it = this->categoryCount_.find(item->getCategory());
assert(it != this->categoryCount_.end());
if (it->second <= 1) {
this->categoryCount.erase(it);
this->categoryCount_.erase(it);
this->removeCustomRow(index - 1);
} else {
it->second--;
+1 -1
View File
@@ -33,7 +33,7 @@ protected:
friend class AccountController;
private:
std::unordered_map<QString, int> categoryCount;
std::unordered_map<QString, int> categoryCount_;
};
} // namespace chatterino