Added some functionality to the accountPopup (#117)

* Added some buttons.

* Added some more functionality.

* Finished adding button functionality.

* Implemented @fourtf's suggestions.
This commit is contained in:
Cranken
2017-09-23 19:23:10 +02:00
committed by fourtf
parent 206a3518b0
commit 881e695189
16 changed files with 555 additions and 130 deletions
+28 -30
View File
@@ -245,13 +245,6 @@ SharedMessage TwitchMessageBuilder::parse()
i++;
}
// TODO: Implement this xD
// if (!isReceivedWhisper &&
// AppSettings.HighlightIgnoredUsers.ContainsKey(Username))
// {
// HighlightTab = false;
// }
return this->getMessage();
}
@@ -397,6 +390,8 @@ void TwitchMessageBuilder::parseHighlights()
bool alert;
};
QStringList blackList = settings.highlightUserBlacklist.get().split("\n",QString::SkipEmptyParts);
// TODO: This vector should only be rebuilt upon highlights being changed
std::vector<Highlight> activeHighlights;
@@ -404,6 +399,7 @@ void TwitchMessageBuilder::parseHighlights()
activeHighlights.emplace_back(currentUsername, settings.enableHighlightSound.get(),
settings.enableHighlightTaskbar.get());
}
const auto &highlightProperties = settings.highlightProperties.get();
for (auto it = highlightProperties.begin(); it != highlightProperties.end(); ++it) {
@@ -414,37 +410,39 @@ void TwitchMessageBuilder::parseHighlights()
bool doHighlight = false;
bool playSound = false;
bool doAlert = false;
if(!blackList.contains(this->ircMessage->nick(),Qt::CaseInsensitive))
{
for (const Highlight &highlight : activeHighlights) {
if (this->originalMessage.contains(highlight.target, Qt::CaseInsensitive)) {
qDebug() << "Highlight because " << this->originalMessage << " contains "
<< highlight.target;
doHighlight = true;
for (const Highlight &highlight : activeHighlights) {
if (this->originalMessage.contains(highlight.target, Qt::CaseInsensitive)) {
qDebug() << "Highlight because " << this->originalMessage << " contains "
<< highlight.target;
doHighlight = true;
if (highlight.sound) {
playSound = true;
}
if (highlight.sound) {
playSound = true;
}
if (highlight.alert) {
doAlert = true;
}
if (highlight.alert) {
doAlert = true;
}
if (playSound && doAlert) {
// Break if no further action can be taken from other highlights
// This might change if highlights can have custom colors/sounds/actions
break;
if (playSound && doAlert) {
// Break if no further action can be taken from other highlights
// This might change if highlights can have custom colors/sounds/actions
break;
}
}
}
}
this->setHighlight(doHighlight);
this->setHighlight(doHighlight);
if (playSound) {
player->play();
}
if (playSound) {
player->play();
}
if (doAlert) {
QApplication::alert(windowManager.getMainWindow().window(), 2500);
if (doAlert) {
QApplication::alert(windowManager.getMainWindow().window(), 2500);
}
}
}