mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Added fakechannels
This commit is contained in:
parent
c4679bf048
commit
8ea3b6c8ee
2 changed files with 21 additions and 24 deletions
|
@ -36,18 +36,17 @@ void NotificationController::initialize(Settings &settings, Paths &paths)
|
||||||
this->channelMap[Platform::Mixer].delayedItemsChanged.connect([this] { //
|
this->channelMap[Platform::Mixer].delayedItemsChanged.connect([this] { //
|
||||||
this->mixerSetting_.setValue(
|
this->mixerSetting_.setValue(
|
||||||
this->channelMap[Platform::Mixer].getVector());
|
this->channelMap[Platform::Mixer].getVector());
|
||||||
});
|
});*/
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
connect(liveStatusTimer_, SIGNAL(timeout()), this, SLOT());
|
|
||||||
liveStatusTimer_.start(60 * 1000);
|
|
||||||
*/
|
|
||||||
liveStatusTimer_ = new QTimer();
|
liveStatusTimer_ = new QTimer();
|
||||||
QObject::connect(liveStatusTimer_, this, SIGNAL(timeout()),
|
|
||||||
SLOT(fetchFakeChannels()));
|
this->fetchFakeChannels();
|
||||||
connect(liveStatusTimer_, SIGNAL(timeout()), SLOT(fetchFakeChannels()));
|
|
||||||
liveStatusTimer_->start(1000);
|
QObject::connect(this->liveStatusTimer_, &QTimer::timeout, [=] {
|
||||||
|
this->fetchFakeChannels();
|
||||||
|
qDebug() << " MY CODE IS SHIT OMEGALUL ";
|
||||||
|
});
|
||||||
|
this->liveStatusTimer_->start(60 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationController::updateChannelNotification(
|
void NotificationController::updateChannelNotification(
|
||||||
|
@ -118,19 +117,15 @@ NotificationModel *NotificationController::createModel(QObject *parent,
|
||||||
|
|
||||||
void NotificationController::fetchFakeChannels()
|
void NotificationController::fetchFakeChannels()
|
||||||
{
|
{
|
||||||
|
qDebug() << " USING DEBUGGER ";
|
||||||
for (std::vector<int>::size_type i = 0;
|
for (std::vector<int>::size_type i = 0;
|
||||||
i != channelMap[Platform::Twitch].getVector().size(); i++) {
|
i != channelMap[Platform::Twitch].getVector().size(); i++) {
|
||||||
auto chan = getApp()->twitch.server->getChannelOrEmpty(
|
auto chan = getApp()->twitch.server->getChannelOrEmpty(
|
||||||
channelMap[Platform::Twitch].getVector()[i]);
|
channelMap[Platform::Twitch].getVector()[i]);
|
||||||
|
if (chan->isEmpty()) {
|
||||||
/*
|
getFakeTwitchChannelLiveStatus(
|
||||||
auto chan = getApp()->twitch.server->getChannelOrEmpty(chanName);
|
channelMap[Platform::Twitch].getVector()[i]);
|
||||||
if (auto *twitchChannel = dynamic_cast<TwitchChannel *>(chan.get())) {
|
|
||||||
if (channelMap[Platform::Twitch].getVector()[i].toLower() ==
|
|
||||||
channelName.toLower()) { channelMap[Platform::Twitch].removeItem(i);
|
|
||||||
i--;
|
|
||||||
}
|
}
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +167,8 @@ void NotificationController::getFakeTwitchChannelLiveStatus(
|
||||||
// Stream is live
|
// Stream is live
|
||||||
auto i = std::find(fakeTwitchChannels.begin(),
|
auto i = std::find(fakeTwitchChannels.begin(),
|
||||||
fakeTwitchChannels.end(), channelName);
|
fakeTwitchChannels.end(), channelName);
|
||||||
if (i != fakeTwitchChannels.end()) {
|
|
||||||
|
if (!(i != fakeTwitchChannels.end())) {
|
||||||
fakeTwitchChannels.push_back(channelName);
|
fakeTwitchChannels.push_back(channelName);
|
||||||
if (Toasts::isEnabled()) {
|
if (Toasts::isEnabled()) {
|
||||||
getApp()->toasts->sendChannelNotification(channelName,
|
getApp()->toasts->sendChannelNotification(channelName,
|
||||||
|
|
|
@ -17,7 +17,7 @@ enum class Platform : uint8_t {
|
||||||
// Mixer, // 1
|
// Mixer, // 1
|
||||||
};
|
};
|
||||||
|
|
||||||
class NotificationController final : public Singleton
|
class NotificationController final : public Singleton, private QObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void initialize(Settings &settings, Paths &paths) override;
|
virtual void initialize(Settings &settings, Paths &paths) override;
|
||||||
|
@ -37,19 +37,20 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool initialized_ = false;
|
bool initialized_ = false;
|
||||||
QTimer *liveStatusTimer_;
|
|
||||||
|
void fetchFakeChannels();
|
||||||
void removeFakeChannel(const QString channelName);
|
void removeFakeChannel(const QString channelName);
|
||||||
std::vector<QString> fakeTwitchChannels;
|
|
||||||
void getFakeTwitchChannelLiveStatus(const QString &channelName);
|
void getFakeTwitchChannelLiveStatus(const QString &channelName);
|
||||||
|
|
||||||
|
std::vector<QString> fakeTwitchChannels;
|
||||||
|
QTimer *liveStatusTimer_;
|
||||||
|
|
||||||
ChatterinoSetting<std::vector<QString>> twitchSetting_ = {
|
ChatterinoSetting<std::vector<QString>> twitchSetting_ = {
|
||||||
"/notifications/twitch"};
|
"/notifications/twitch"};
|
||||||
/*
|
/*
|
||||||
ChatterinoSetting<std::vector<QString>> mixerSetting_ = {
|
ChatterinoSetting<std::vector<QString>> mixerSetting_ = {
|
||||||
"/notifications/mixer"};
|
"/notifications/mixer"};
|
||||||
*/
|
*/
|
||||||
private slots:
|
|
||||||
void fetchFakeChannels();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|
Loading…
Reference in a new issue