Added fakechannels

This commit is contained in:
apa420 2018-08-26 13:19:09 +02:00
parent c4679bf048
commit 8ea3b6c8ee
2 changed files with 21 additions and 24 deletions

View file

@ -36,18 +36,17 @@ void NotificationController::initialize(Settings &settings, Paths &paths)
this->channelMap[Platform::Mixer].delayedItemsChanged.connect([this] { //
this->mixerSetting_.setValue(
this->channelMap[Platform::Mixer].getVector());
});
*/
});*/
/*
connect(liveStatusTimer_, SIGNAL(timeout()), this, SLOT());
liveStatusTimer_.start(60 * 1000);
*/
liveStatusTimer_ = new QTimer();
QObject::connect(liveStatusTimer_, this, SIGNAL(timeout()),
SLOT(fetchFakeChannels()));
connect(liveStatusTimer_, SIGNAL(timeout()), SLOT(fetchFakeChannels()));
liveStatusTimer_->start(1000);
this->fetchFakeChannels();
QObject::connect(this->liveStatusTimer_, &QTimer::timeout, [=] {
this->fetchFakeChannels();
qDebug() << " MY CODE IS SHIT OMEGALUL ";
});
this->liveStatusTimer_->start(60 * 1000);
}
void NotificationController::updateChannelNotification(
@ -118,19 +117,15 @@ NotificationModel *NotificationController::createModel(QObject *parent,
void NotificationController::fetchFakeChannels()
{
qDebug() << " USING DEBUGGER ";
for (std::vector<int>::size_type i = 0;
i != channelMap[Platform::Twitch].getVector().size(); i++) {
auto chan = getApp()->twitch.server->getChannelOrEmpty(
channelMap[Platform::Twitch].getVector()[i]);
/*
auto chan = getApp()->twitch.server->getChannelOrEmpty(chanName);
if (auto *twitchChannel = dynamic_cast<TwitchChannel *>(chan.get())) {
if (channelMap[Platform::Twitch].getVector()[i].toLower() ==
channelName.toLower()) { channelMap[Platform::Twitch].removeItem(i);
i--;
if (chan->isEmpty()) {
getFakeTwitchChannelLiveStatus(
channelMap[Platform::Twitch].getVector()[i]);
}
}*/
}
}
@ -172,7 +167,8 @@ void NotificationController::getFakeTwitchChannelLiveStatus(
// Stream is live
auto i = std::find(fakeTwitchChannels.begin(),
fakeTwitchChannels.end(), channelName);
if (i != fakeTwitchChannels.end()) {
if (!(i != fakeTwitchChannels.end())) {
fakeTwitchChannels.push_back(channelName);
if (Toasts::isEnabled()) {
getApp()->toasts->sendChannelNotification(channelName,

View file

@ -17,7 +17,7 @@ enum class Platform : uint8_t {
// Mixer, // 1
};
class NotificationController final : public Singleton
class NotificationController final : public Singleton, private QObject
{
public:
virtual void initialize(Settings &settings, Paths &paths) override;
@ -37,19 +37,20 @@ public:
private:
bool initialized_ = false;
QTimer *liveStatusTimer_;
void fetchFakeChannels();
void removeFakeChannel(const QString channelName);
std::vector<QString> fakeTwitchChannels;
void getFakeTwitchChannelLiveStatus(const QString &channelName);
std::vector<QString> fakeTwitchChannels;
QTimer *liveStatusTimer_;
ChatterinoSetting<std::vector<QString>> twitchSetting_ = {
"/notifications/twitch"};
/*
ChatterinoSetting<std::vector<QString>> mixerSetting_ = {
"/notifications/mixer"};
*/
private slots:
void fetchFakeChannels();
};
} // namespace chatterino