Added the ability to add nicknames for users (#2981)
Co-authored-by: Mm2PL <mm2pl+gh@kotmisia.pl> Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#include "NicknamesModel.hpp"
|
||||
|
||||
#include "Application.hpp"
|
||||
#include "providers/twitch/api/Helix.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "util/StandardItemHelper.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
NicknamesModel::NicknamesModel(QObject *parent)
|
||||
: SignalVectorModel<Nickname>(2, 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(),
|
||||
row[1]->data(Qt::DisplayRole).toString()};
|
||||
}
|
||||
|
||||
// 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());
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
Reference in New Issue
Block a user