update which actually let's you compile, but doesn't properly save an item after renaming it

This commit is contained in:
apa420
2018-08-10 00:04:50 +02:00
parent 5c6d2f36b5
commit 5437a6dd4d
3 changed files with 30 additions and 3 deletions
@@ -1,4 +1,4 @@
#include "NotificationController.hpp"
#include "controllers/notifications/NotificationController.hpp"
#include "Application.hpp"
#include "controllers/notifications/NotificationModel.hpp"
@@ -33,23 +33,47 @@ void NotificationController::updateChannelNotification(
bool NotificationController::isChannelNotified(const QString &channelName)
{
for (std::vector<int>::size_type i = 0;
i != notificationVector.getVector().size(); i++) {
if (notificationVector.getVector()[i] == channelName) {
return true;
}
}
return false;
/*
const auto &vector = notificationSetting_.getValue();
return std::find(vector.begin(), vector.end(), channelName) != vector.end();
*/
}
void NotificationController::addChannelNotification(const QString &channelName)
{
notificationVector.appendItem(channelName);
/*
auto vector = notificationSetting_.getValue();
vector.push_back(channelName);
notificationSetting_.setValue(vector);
*/
}
void NotificationController::removeChannelNotification(
const QString &channelName)
{
for (std::vector<int>::size_type i = 0;
i != notificationVector.getVector().size(); i++) {
if (notificationVector.getVector()[i] == channelName) {
notificationVector.removeItem(i);
i--;
}
}
// notificationVector.removeItem(std::find(
// notificationVector.begin(), notificationVector.end(), channelName));
/*
auto vector = notificationSetting_.getValue();
vector.erase(std::find(vector.begin(), vector.end(), channelName));
notificationSetting_.setValue(vector);
*/
}
NotificationModel *NotificationController::createModel(QObject *parent)