mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
update which actually let's you compile, but doesn't properly save an item after renaming it
This commit is contained in:
parent
5c6d2f36b5
commit
5437a6dd4d
|
@ -1,4 +1,4 @@
|
||||||
#include "NotificationController.hpp"
|
#include "controllers/notifications/NotificationController.hpp"
|
||||||
|
|
||||||
#include "Application.hpp"
|
#include "Application.hpp"
|
||||||
#include "controllers/notifications/NotificationModel.hpp"
|
#include "controllers/notifications/NotificationModel.hpp"
|
||||||
|
@ -33,23 +33,47 @@ void NotificationController::updateChannelNotification(
|
||||||
|
|
||||||
bool NotificationController::isChannelNotified(const QString &channelName)
|
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();
|
const auto &vector = notificationSetting_.getValue();
|
||||||
return std::find(vector.begin(), vector.end(), channelName) != vector.end();
|
return std::find(vector.begin(), vector.end(), channelName) != vector.end();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationController::addChannelNotification(const QString &channelName)
|
void NotificationController::addChannelNotification(const QString &channelName)
|
||||||
{
|
{
|
||||||
|
notificationVector.appendItem(channelName);
|
||||||
|
/*
|
||||||
auto vector = notificationSetting_.getValue();
|
auto vector = notificationSetting_.getValue();
|
||||||
vector.push_back(channelName);
|
vector.push_back(channelName);
|
||||||
notificationSetting_.setValue(vector);
|
notificationSetting_.setValue(vector);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationController::removeChannelNotification(
|
void NotificationController::removeChannelNotification(
|
||||||
const QString &channelName)
|
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();
|
auto vector = notificationSetting_.getValue();
|
||||||
vector.erase(std::find(vector.begin(), vector.end(), channelName));
|
vector.erase(std::find(vector.begin(), vector.end(), channelName));
|
||||||
notificationSetting_.setValue(vector);
|
notificationSetting_.setValue(vector);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
NotificationModel *NotificationController::createModel(QObject *parent)
|
NotificationModel *NotificationController::createModel(QObject *parent)
|
||||||
|
|
|
@ -23,4 +23,5 @@ void NotificationModel::getRowFromItem(const QString &item,
|
||||||
{
|
{
|
||||||
setStringItem(row[0], item);
|
setStringItem(row[0], item);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
#include "NotificationPage.hpp"
|
#include "NotificationPage.hpp"
|
||||||
|
|
||||||
#include "Application.hpp"
|
#include "Application.hpp"
|
||||||
|
#include "controllers/notifications/NotificationController.hpp"
|
||||||
|
#include "controllers/notifications/NotificationModel.hpp"
|
||||||
#include "singletons/Settings.hpp"
|
#include "singletons/Settings.hpp"
|
||||||
#include "src/controllers/notifications/NotificationController.hpp"
|
|
||||||
#include "util/LayoutCreator.hpp"
|
#include "util/LayoutCreator.hpp"
|
||||||
#include "widgets/helper/EditableModelView.hpp"
|
#include "widgets/helper/EditableModelView.hpp"
|
||||||
|
|
||||||
|
@ -57,7 +58,8 @@ NotificationPage::NotificationPage()
|
||||||
});
|
});
|
||||||
|
|
||||||
view->addButtonPressed.connect([] {
|
view->addButtonPressed.connect([] {
|
||||||
getApp()->notifications->addChannelNotification("channel");
|
getApp()->notifications->notificationVector.appendItem(
|
||||||
|
"channel");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue