mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
* Add `<functional>` include to QStringHash.hpp This ensures the base `std::hash` template is declared before this specialization * Add missing includes to `src/providers/twitch/TwitchAccountManager.hpp` * Move explicit HelixChatters constructor to the source file * Remove unused includes & add used includes to NicknamesModel.hpp * NicknamesModel.hpp: Remove `virtual` when `override` is used * Add missing QStringHash include to TwitchEmotes.cpp * Add missing includes to various files * Print Qt version in cmake step Technically unrelated, but I'm sneaking it in * Add changelog entry
33 lines
1.1 KiB
C++
33 lines
1.1 KiB
C++
#include "controllers/nicknames/NicknamesModel.hpp"
|
|
|
|
#include "controllers/nicknames/Nickname.hpp"
|
|
#include "util/StandardItemHelper.hpp"
|
|
|
|
namespace chatterino {
|
|
|
|
NicknamesModel::NicknamesModel(QObject *parent)
|
|
: SignalVectorModel<Nickname>(4, parent)
|
|
{
|
|
}
|
|
|
|
// turn a vector item into a model row
|
|
Nickname NicknamesModel::getItemFromRow(std::vector<QStandardItem *> &row,
|
|
const Nickname &original)
|
|
{
|
|
return Nickname{row[0]->data(Qt::DisplayRole).toString().trimmed(),
|
|
row[1]->data(Qt::DisplayRole).toString(),
|
|
row[2]->data(Qt::CheckStateRole).toBool(),
|
|
row[3]->data(Qt::CheckStateRole).toBool()};
|
|
}
|
|
|
|
// turns a row in the model into a vector item
|
|
void NicknamesModel::getRowFromItem(const Nickname &item,
|
|
std::vector<QStandardItem *> &row)
|
|
{
|
|
setStringItem(row[0], item.name());
|
|
setStringItem(row[1], item.replace());
|
|
setBoolItem(row[2], item.isRegex());
|
|
setBoolItem(row[3], item.isCaseSensitive());
|
|
}
|
|
|
|
} // namespace chatterino
|