WIP notification settings, doesn't actually work

This commit is contained in:
apa420 2018-08-09 15:41:32 +02:00
parent b68c7ded5f
commit 5c6d2f36b5
2 changed files with 54 additions and 0 deletions

View file

@ -0,0 +1,26 @@
#include "NotificationModel.hpp"
#include "Application.hpp"
#include "singletons/Settings.hpp"
#include "util/StandardItemHelper.hpp"
namespace chatterino {
NotificationModel::NotificationModel(QObject *parent)
: SignalVectorModel<QString>(1, parent)
{
}
// turn a vector item into a model row
QString NotificationModel::getItemFromRow(std::vector<QStandardItem *> &row,
const QString &original)
{
return QString(row[0]->data().toString());
}
void NotificationModel::getRowFromItem(const QString &item,
std::vector<QStandardItem *> &row)
{
setStringItem(row[0], item);
}
} // namespace chatterino

View file

@ -0,0 +1,28 @@
#pragma once
#include <QObject>
#include "common/SignalVectorModel.hpp"
#include "controllers/notifications/NotificationController.hpp"
namespace chatterino {
class NotificationController;
class NotificationModel : public SignalVectorModel<QString>
{
explicit NotificationModel(QObject *parent);
protected:
// turn a vector item into a model row
virtual QString getItemFromRow(std::vector<QStandardItem *> &row,
const QString &original) override;
// turns a row in the model into a vector item
virtual void getRowFromItem(const QString &item,
std::vector<QStandardItem *> &row) override;
friend class NotificationController;
};
} // namespace chatterino