mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Cleaned some stuff up and did some things
This commit is contained in:
parent
320558ee63
commit
93bbe33664
6 changed files with 13 additions and 47 deletions
|
@ -231,7 +231,6 @@ SOURCES += \
|
||||||
src/singletons/Updates.cpp \
|
src/singletons/Updates.cpp \
|
||||||
src/singletons/Theme.cpp \
|
src/singletons/Theme.cpp \
|
||||||
src/controllers/moderationactions/ModerationActionModel.cpp \
|
src/controllers/moderationactions/ModerationActionModel.cpp \
|
||||||
src/widgets/settingspages/NotificationPage.cpp \
|
|
||||||
src/widgets/settingspages/LookPage.cpp \
|
src/widgets/settingspages/LookPage.cpp \
|
||||||
src/widgets/settingspages/FeelPage.cpp \
|
src/widgets/settingspages/FeelPage.cpp \
|
||||||
src/util/InitUpdateButton.cpp \
|
src/util/InitUpdateButton.cpp \
|
||||||
|
@ -255,8 +254,6 @@ SOURCES += \
|
||||||
src/BrowserExtension.cpp \
|
src/BrowserExtension.cpp \
|
||||||
src/util/FormatTime.cpp \
|
src/util/FormatTime.cpp \
|
||||||
src/util/FunctionEventFilter.cpp \
|
src/util/FunctionEventFilter.cpp \
|
||||||
src/controllers/notifications/notificationcontroller.cpp \
|
|
||||||
src/widgets/settingspages/NotificationPage.cpp \
|
|
||||||
src/controllers/notifications/NotificationModel.cpp \
|
src/controllers/notifications/NotificationModel.cpp \
|
||||||
src/singletons/Toasts.cpp
|
src/singletons/Toasts.cpp
|
||||||
|
|
||||||
|
@ -433,7 +430,6 @@ HEADERS += \
|
||||||
src/widgets/dialogs/LogsPopup.hpp \
|
src/widgets/dialogs/LogsPopup.hpp \
|
||||||
src/common/Singleton.hpp \
|
src/common/Singleton.hpp \
|
||||||
src/controllers/moderationactions/ModerationActionModel.hpp \
|
src/controllers/moderationactions/ModerationActionModel.hpp \
|
||||||
src/widgets/settingspages/NotificationPage.hpp \
|
|
||||||
src/widgets/settingspages/LookPage.hpp \
|
src/widgets/settingspages/LookPage.hpp \
|
||||||
src/widgets/settingspages/FeelPage.hpp \
|
src/widgets/settingspages/FeelPage.hpp \
|
||||||
src/util/InitUpdateButton.hpp \
|
src/util/InitUpdateButton.hpp \
|
||||||
|
@ -460,7 +456,6 @@ HEADERS += \
|
||||||
src/BrowserExtension.hpp \
|
src/BrowserExtension.hpp \
|
||||||
src/util/FormatTime.hpp \
|
src/util/FormatTime.hpp \
|
||||||
src/util/FunctionEventFilter.hpp \
|
src/util/FunctionEventFilter.hpp \
|
||||||
src/widgets/settingspages/NotificationPage.hpp \
|
|
||||||
src/controllers/notifications/NotificationModel.hpp \
|
src/controllers/notifications/NotificationModel.hpp \
|
||||||
src/controllers/notifications/NotificationPhrase.hpp \
|
src/controllers/notifications/NotificationPhrase.hpp \
|
||||||
src/singletons/Toasts.hpp
|
src/singletons/Toasts.hpp
|
||||||
|
|
|
@ -23,7 +23,7 @@ void NotificationController::initialize(Settings &settings, Paths &paths)
|
||||||
this->twitchSetting_.setValue(
|
this->twitchSetting_.setValue(
|
||||||
this->channelMap[Platform::Twitch].getVector());
|
this->channelMap[Platform::Twitch].getVector());
|
||||||
});
|
});
|
||||||
|
/*
|
||||||
for (const QString &channelName : this->mixerSetting_.getValue()) {
|
for (const QString &channelName : this->mixerSetting_.getValue()) {
|
||||||
this->channelMap[Platform::Mixer].appendItem(channelName);
|
this->channelMap[Platform::Mixer].appendItem(channelName);
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ void NotificationController::initialize(Settings &settings, Paths &paths)
|
||||||
this->mixerSetting_.setValue(
|
this->mixerSetting_.setValue(
|
||||||
this->channelMap[Platform::Mixer].getVector());
|
this->channelMap[Platform::Mixer].getVector());
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationController::updateChannelNotification(
|
void NotificationController::updateChannelNotification(
|
||||||
|
@ -52,24 +53,6 @@ bool NotificationController::isChannelNotified(const QString &channelName,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// for (std::vector<int>::size_type i = 0; i != channelMap[p])
|
|
||||||
/*
|
|
||||||
if (p == Platform::Twitch) {
|
|
||||||
for (std::vector<int>::size_type i = 0;
|
|
||||||
i != twitchVector.getVector().size(); i++) {
|
|
||||||
if (twitchVector.getVector()[i].toLower() ==
|
|
||||||
channelName.toLowercase()) { return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (p == Platform::Mixer) {
|
|
||||||
for (std::vector<int>::size_type i = 0;
|
|
||||||
i != mixerVector.getVector().size(); i++) {
|
|
||||||
if (mixerVector.getVector()[i].toLower() ==
|
|
||||||
channelName.toLowercase()) { return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +67,7 @@ void NotificationController::removeChannelNotification(
|
||||||
{
|
{
|
||||||
for (std::vector<int>::size_type i = 0;
|
for (std::vector<int>::size_type i = 0;
|
||||||
i != channelMap[p].getVector().size(); i++) {
|
i != channelMap[p].getVector().size(); i++) {
|
||||||
if (channelMap[p].getVector()[i].toLower() == channelName) {
|
if (channelMap[p].getVector()[i].toLower() == channelName.toLower()) {
|
||||||
channelMap[p].removeItem(i);
|
channelMap[p].removeItem(i);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
|
@ -116,13 +99,6 @@ NotificationModel *NotificationController::createModel(QObject *parent,
|
||||||
{
|
{
|
||||||
NotificationModel *model = new NotificationModel(parent);
|
NotificationModel *model = new NotificationModel(parent);
|
||||||
model->init(&this->channelMap[p]);
|
model->init(&this->channelMap[p]);
|
||||||
/*
|
|
||||||
if (p == Platform::Twitch) {
|
|
||||||
model->init(&this->twitchVector);
|
|
||||||
} else if (p == Platform::Mixer) {
|
|
||||||
model->init(&this->mixerVector);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,8 @@ class Paths;
|
||||||
class NotificationModel;
|
class NotificationModel;
|
||||||
|
|
||||||
enum class Platform : uint8_t {
|
enum class Platform : uint8_t {
|
||||||
Twitch = 0, // 0
|
Twitch, // 0
|
||||||
Mixer = 1, // 1
|
// Mixer, // 1
|
||||||
HitBox = 2, // 2
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NotificationController final : public Singleton
|
class NotificationController final : public Singleton
|
||||||
|
@ -31,8 +30,6 @@ public:
|
||||||
UnsortedSignalVector<QString> getVector(Platform p);
|
UnsortedSignalVector<QString> getVector(Platform p);
|
||||||
|
|
||||||
std::map<Platform, UnsortedSignalVector<QString>> channelMap;
|
std::map<Platform, UnsortedSignalVector<QString>> channelMap;
|
||||||
// UnsortedSignalVector<QString> twitchVector;
|
|
||||||
// UnsortedSignalVector<QString> mixerVector;
|
|
||||||
|
|
||||||
NotificationModel *createModel(QObject *parent, Platform p);
|
NotificationModel *createModel(QObject *parent, Platform p);
|
||||||
|
|
||||||
|
@ -40,8 +37,10 @@ private:
|
||||||
bool initialized_ = false;
|
bool initialized_ = false;
|
||||||
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"};
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|
|
@ -352,8 +352,7 @@ void TwitchChannel::refreshLiveStatus()
|
||||||
QString url("https://api.twitch.tv/kraken/streams/" + roomID);
|
QString url("https://api.twitch.tv/kraken/streams/" + roomID);
|
||||||
|
|
||||||
//<<<<<<< HEAD
|
//<<<<<<< HEAD
|
||||||
// auto request = makeGetStreamRequest(roomID,
|
// auto request = makeGetStreamRequest(roomID, QThread::currentThread());
|
||||||
// QThread::currentThread());
|
|
||||||
//=======
|
//=======
|
||||||
auto request = NetworkRequest::twitchRequest(url);
|
auto request = NetworkRequest::twitchRequest(url);
|
||||||
request.setCaller(QThread::currentThread());
|
request.setCaller(QThread::currentThread());
|
||||||
|
@ -400,8 +399,7 @@ Outcome TwitchChannel::parseLiveStatus(const rapidjson::Document &document)
|
||||||
const rapidjson::Value &streamChannel = stream["channel"];
|
const rapidjson::Value &streamChannel = stream["channel"];
|
||||||
|
|
||||||
if (!streamChannel.IsObject() || !streamChannel.HasMember("status")) {
|
if (!streamChannel.IsObject() || !streamChannel.HasMember("status")) {
|
||||||
Log("[TwitchChannel:refreshLiveStatus] Missing member \"status\" "
|
Log("[TwitchChannel:refreshLiveStatus] Missing member \"status\" in "
|
||||||
"in "
|
|
||||||
"channel");
|
"channel");
|
||||||
return Failure;
|
return Failure;
|
||||||
}
|
}
|
||||||
|
@ -475,8 +473,8 @@ Outcome TwitchChannel::parseRecentMessages(const QJsonObject &jsonRoot)
|
||||||
|
|
||||||
for (const auto jsonMessage : jsonMessages) {
|
for (const auto jsonMessage : jsonMessages) {
|
||||||
auto content = jsonMessage.toString().toUtf8();
|
auto content = jsonMessage.toString().toUtf8();
|
||||||
// passing nullptr as the channel makes the message invalid but we
|
// passing nullptr as the channel makes the message invalid but we don't
|
||||||
// don't check for that anyways
|
// check for that anyways
|
||||||
auto message = Communi::IrcMessage::fromData(content, nullptr);
|
auto message = Communi::IrcMessage::fromData(content, nullptr);
|
||||||
auto privMsg = dynamic_cast<Communi::IrcPrivateMessage *>(message);
|
auto privMsg = dynamic_cast<Communi::IrcPrivateMessage *>(message);
|
||||||
assert(privMsg);
|
assert(privMsg);
|
||||||
|
|
|
@ -118,8 +118,6 @@ private:
|
||||||
void loadRecentMessages();
|
void loadRecentMessages();
|
||||||
Outcome parseRecentMessages(const QJsonObject &jsonRoot);
|
Outcome parseRecentMessages(const QJsonObject &jsonRoot);
|
||||||
|
|
||||||
bool toastIsEnabled();
|
|
||||||
|
|
||||||
void setLive(bool newLiveStatus);
|
void setLive(bool newLiveStatus);
|
||||||
|
|
||||||
void loadBadges();
|
void loadBadges();
|
||||||
|
@ -155,8 +153,6 @@ private:
|
||||||
QTimer liveStatusTimer_;
|
QTimer liveStatusTimer_;
|
||||||
QTimer chattersListTimer_;
|
QTimer chattersListTimer_;
|
||||||
|
|
||||||
std::vector<QString> liveChannels;
|
|
||||||
|
|
||||||
friend class TwitchServer;
|
friend class TwitchServer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,7 @@ NotificationPage::NotificationPage()
|
||||||
.appendItem("channel");
|
.appendItem("channel");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
auto mixerChannels = tabs.appendTab(new QVBoxLayout, "Mixer");
|
auto mixerChannels = tabs.appendTab(new QVBoxLayout, "Mixer");
|
||||||
{
|
{
|
||||||
EditableModelView *view =
|
EditableModelView *view =
|
||||||
|
@ -94,6 +95,7 @@ NotificationPage::NotificationPage()
|
||||||
.appendItem("channel");
|
.appendItem("channel");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue