Cleaned some stuff up and did some things

This commit is contained in:
apa420 2018-08-12 21:05:12 +02:00
parent 320558ee63
commit 93bbe33664
6 changed files with 13 additions and 47 deletions

View file

@ -231,7 +231,6 @@ SOURCES += \
src/singletons/Updates.cpp \
src/singletons/Theme.cpp \
src/controllers/moderationactions/ModerationActionModel.cpp \
src/widgets/settingspages/NotificationPage.cpp \
src/widgets/settingspages/LookPage.cpp \
src/widgets/settingspages/FeelPage.cpp \
src/util/InitUpdateButton.cpp \
@ -255,8 +254,6 @@ SOURCES += \
src/BrowserExtension.cpp \
src/util/FormatTime.cpp \
src/util/FunctionEventFilter.cpp \
src/controllers/notifications/notificationcontroller.cpp \
src/widgets/settingspages/NotificationPage.cpp \
src/controllers/notifications/NotificationModel.cpp \
src/singletons/Toasts.cpp
@ -433,7 +430,6 @@ HEADERS += \
src/widgets/dialogs/LogsPopup.hpp \
src/common/Singleton.hpp \
src/controllers/moderationactions/ModerationActionModel.hpp \
src/widgets/settingspages/NotificationPage.hpp \
src/widgets/settingspages/LookPage.hpp \
src/widgets/settingspages/FeelPage.hpp \
src/util/InitUpdateButton.hpp \
@ -460,7 +456,6 @@ HEADERS += \
src/BrowserExtension.hpp \
src/util/FormatTime.hpp \
src/util/FunctionEventFilter.hpp \
src/widgets/settingspages/NotificationPage.hpp \
src/controllers/notifications/NotificationModel.hpp \
src/controllers/notifications/NotificationPhrase.hpp \
src/singletons/Toasts.hpp

View file

@ -23,7 +23,7 @@ void NotificationController::initialize(Settings &settings, Paths &paths)
this->twitchSetting_.setValue(
this->channelMap[Platform::Twitch].getVector());
});
/*
for (const QString &channelName : this->mixerSetting_.getValue()) {
this->channelMap[Platform::Mixer].appendItem(channelName);
}
@ -32,6 +32,7 @@ void NotificationController::initialize(Settings &settings, Paths &paths)
this->mixerSetting_.setValue(
this->channelMap[Platform::Mixer].getVector());
});
*/
}
void NotificationController::updateChannelNotification(
@ -52,24 +53,6 @@ bool NotificationController::isChannelNotified(const QString &channelName,
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;
}
@ -84,7 +67,7 @@ void NotificationController::removeChannelNotification(
{
for (std::vector<int>::size_type i = 0;
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);
i--;
}
@ -116,13 +99,6 @@ NotificationModel *NotificationController::createModel(QObject *parent,
{
NotificationModel *model = new NotificationModel(parent);
model->init(&this->channelMap[p]);
/*
if (p == Platform::Twitch) {
model->init(&this->twitchVector);
} else if (p == Platform::Mixer) {
model->init(&this->mixerVector);
}
*/
return model;
}

View file

@ -11,9 +11,8 @@ class Paths;
class NotificationModel;
enum class Platform : uint8_t {
Twitch = 0, // 0
Mixer = 1, // 1
HitBox = 2, // 2
Twitch, // 0
// Mixer, // 1
};
class NotificationController final : public Singleton
@ -31,8 +30,6 @@ public:
UnsortedSignalVector<QString> getVector(Platform p);
std::map<Platform, UnsortedSignalVector<QString>> channelMap;
// UnsortedSignalVector<QString> twitchVector;
// UnsortedSignalVector<QString> mixerVector;
NotificationModel *createModel(QObject *parent, Platform p);
@ -40,8 +37,10 @@ private:
bool initialized_ = false;
ChatterinoSetting<std::vector<QString>> twitchSetting_ = {
"/notifications/twitch"};
/*
ChatterinoSetting<std::vector<QString>> mixerSetting_ = {
"/notifications/mixer"};
*/
};
} // namespace chatterino

View file

@ -352,8 +352,7 @@ void TwitchChannel::refreshLiveStatus()
QString url("https://api.twitch.tv/kraken/streams/" + roomID);
//<<<<<<< HEAD
// auto request = makeGetStreamRequest(roomID,
// QThread::currentThread());
// auto request = makeGetStreamRequest(roomID, QThread::currentThread());
//=======
auto request = NetworkRequest::twitchRequest(url);
request.setCaller(QThread::currentThread());
@ -400,8 +399,7 @@ Outcome TwitchChannel::parseLiveStatus(const rapidjson::Document &document)
const rapidjson::Value &streamChannel = stream["channel"];
if (!streamChannel.IsObject() || !streamChannel.HasMember("status")) {
Log("[TwitchChannel:refreshLiveStatus] Missing member \"status\" "
"in "
Log("[TwitchChannel:refreshLiveStatus] Missing member \"status\" in "
"channel");
return Failure;
}
@ -475,8 +473,8 @@ Outcome TwitchChannel::parseRecentMessages(const QJsonObject &jsonRoot)
for (const auto jsonMessage : jsonMessages) {
auto content = jsonMessage.toString().toUtf8();
// passing nullptr as the channel makes the message invalid but we
// don't check for that anyways
// passing nullptr as the channel makes the message invalid but we don't
// check for that anyways
auto message = Communi::IrcMessage::fromData(content, nullptr);
auto privMsg = dynamic_cast<Communi::IrcPrivateMessage *>(message);
assert(privMsg);

View file

@ -118,8 +118,6 @@ private:
void loadRecentMessages();
Outcome parseRecentMessages(const QJsonObject &jsonRoot);
bool toastIsEnabled();
void setLive(bool newLiveStatus);
void loadBadges();
@ -155,8 +153,6 @@ private:
QTimer liveStatusTimer_;
QTimer chattersListTimer_;
std::vector<QString> liveChannels;
friend class TwitchServer;
};

View file

@ -68,6 +68,7 @@ NotificationPage::NotificationPage()
.appendItem("channel");
});
}
/*
auto mixerChannels = tabs.appendTab(new QVBoxLayout, "Mixer");
{
EditableModelView *view =
@ -94,6 +95,7 @@ NotificationPage::NotificationPage()
.appendItem("channel");
});
}
*/
}
}
}