mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
WIP notification settings, doesn't actually work
This commit is contained in:
parent
b68c7ded5f
commit
5c6d2f36b5
26
src/controllers/notifications/NotificationModel.cpp
Normal file
26
src/controllers/notifications/NotificationModel.cpp
Normal 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
|
28
src/controllers/notifications/NotificationModel.hpp
Normal file
28
src/controllers/notifications/NotificationModel.hpp
Normal 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
|
Loading…
Reference in a new issue