This commit is contained in:
Rasmus Karlsson 2018-09-01 12:33:27 +00:00
parent afeb7e719b
commit d16307a484
2 changed files with 19 additions and 12 deletions

View file

@ -6,9 +6,9 @@
#include "controllers/ignores/IgnoreController.hpp" #include "controllers/ignores/IgnoreController.hpp"
#include "debug/Log.hpp" #include "debug/Log.hpp"
#include "messages/Message.hpp" #include "messages/Message.hpp"
#include "providers/LinkResolver.hpp"
#include "providers/twitch/TwitchBadges.hpp" #include "providers/twitch/TwitchBadges.hpp"
#include "providers/twitch/TwitchChannel.hpp" #include "providers/twitch/TwitchChannel.hpp"
#include "providers/LinkResolver.hpp"
#include "singletons/Emotes.hpp" #include "singletons/Emotes.hpp"
#include "singletons/Resources.hpp" #include "singletons/Resources.hpp"
#include "singletons/Settings.hpp" #include "singletons/Settings.hpp"
@ -269,12 +269,15 @@ void TwitchMessageBuilder::addTextOrEmoji(const QString &string_)
link = Link(Link::Url, linkString); link = Link(Link::Url, linkString);
textColor = MessageColor(MessageColor::Link); textColor = MessageColor(MessageColor::Link);
auto linkMELowercase = this->emplace<TextElement>(lowercaseLinkString, auto linkMELowercase =
MessageElementFlag::LowercaseLink, textColor) this->emplace<TextElement>(lowercaseLinkString,
->setLink(link); MessageElementFlag::LowercaseLink,
auto linkMEOriginal = this->emplace<TextElement>(string, textColor)
MessageElementFlag::OriginalLink, textColor) ->setLink(link);
->setLink(link); auto linkMEOriginal =
this->emplace<TextElement>(string, MessageElementFlag::OriginalLink,
textColor)
->setLink(link);
LinkResolver::getLinkInfo( LinkResolver::getLinkInfo(
linkString, [linkMELowercase, linkMEOriginal](QString tooltipText) { linkString, [linkMELowercase, linkMEOriginal](QString tooltipText) {

View file

@ -84,7 +84,8 @@ void SplitInput::initLayout()
})); }));
// open emote popup // open emote popup
QObject::connect(this->ui_.emoteButton, &EffectLabel::clicked, [=] { this->openEmotePopup(); }); QObject::connect(this->ui_.emoteButton, &EffectLabel::clicked,
[=] { this->openEmotePopup(); });
// clear channelview selection when selecting in the input // clear channelview selection when selecting in the input
QObject::connect(this->ui_.textEdit, &QTextEdit::copyAvailable, QObject::connect(this->ui_.textEdit, &QTextEdit::copyAvailable,
@ -180,7 +181,8 @@ void SplitInput::installKeyPressedEvent()
c->sendMessage(sendMessage); c->sendMessage(sendMessage);
// don't add duplicate messages and empty message to message history // don't add duplicate messages and empty message to message history
if ((this->prevMsg_.isEmpty() || !this->prevMsg_.endsWith(message)) && if ((this->prevMsg_.isEmpty() ||
!this->prevMsg_.endsWith(message)) &&
!message.trimmed().isEmpty()) !message.trimmed().isEmpty())
this->prevMsg_.append(message); this->prevMsg_.append(message);
@ -189,7 +191,8 @@ void SplitInput::installKeyPressedEvent()
this->currMsg_ = QString(); this->currMsg_ = QString();
this->ui_.textEdit->setText(QString()); this->ui_.textEdit->setText(QString());
this->prevIndex_ = 0; this->prevIndex_ = 0;
} else if (message == this->prevMsg_.at(this->prevMsg_.size() - 1)) { } else if (message ==
this->prevMsg_.at(this->prevMsg_.size() - 1)) {
this->prevMsg_.removeLast(); this->prevMsg_.removeLast();
} }
this->prevIndex_ = this->prevMsg_.size(); this->prevIndex_ = this->prevMsg_.size();
@ -248,14 +251,15 @@ void SplitInput::installKeyPressedEvent()
// Then simply get currMsg_. // Then simply get currMsg_.
this->ui_.textEdit->setText(this->currMsg_); this->ui_.textEdit->setText(this->currMsg_);
} else if (message != this->currMsg_) { } else if (message != this->currMsg_) {
// If user are already in current message // If user are already in current message
// And type something new // And type something new
// Then replace currMsg_ with new one. // Then replace currMsg_ with new one.
this->currMsg_ = message; this->currMsg_ = message;
} }
// If user is already in current message // If user is already in current message
// Then don't touch cursos. // Then don't touch cursos.
cursorToEnd = (message == this->prevMsg_.at(this->prevIndex_ - 1)); cursorToEnd =
(message == this->prevMsg_.at(this->prevIndex_ - 1));
} }
if (cursorToEnd) { if (cursorToEnd) {