ChatWidgetView -> ChannelView, added Emote Picker

This commit is contained in:
fourtf
2017-09-16 00:05:06 +02:00
parent 84c23a5d00
commit c7b3480aaf
37 changed files with 532 additions and 407 deletions
+2 -1
View File
@@ -24,7 +24,7 @@ class Message
{
public:
// explicit Message(const QString &text);
//explicit Message(const QString &text, const std::vector<messages::Word> &words,
// explicit Message(const QString &text, const std::vector<messages::Word> &words,
// const bool &highlight);
bool getCanHighlightTab() const;
@@ -39,6 +39,7 @@ public:
const QString &getId() const;
const QString text;
bool centered = false;
private:
static LazyLoadedImage *badgeStaff;
+1 -1
View File
@@ -12,7 +12,7 @@ MessageBuilder::MessageBuilder()
_parseTime = std::chrono::system_clock::now();
}
SharedMessage MessageBuilder::build()
SharedMessage MessageBuilder::getMessage()
{
return this->message;
}
+1 -1
View File
@@ -14,7 +14,7 @@ class MessageBuilder
public:
MessageBuilder();
SharedMessage build();
SharedMessage getMessage();
void appendWord(const Word &&word);
void appendTimestamp();
+13 -7
View File
@@ -129,7 +129,7 @@ bool MessageRef::layout(int width, bool enableEmoteMargins)
// word wrapping
if (word.isText() && word.getWidth() + MARGIN_LEFT > right) {
alignWordParts(lineStart, lineHeight);
alignWordParts(lineStart, lineHeight, width);
y += lineHeight;
@@ -183,7 +183,7 @@ bool MessageRef::layout(int width, bool enableEmoteMargins)
first = false;
} else {
// doesn't fit in the line
alignWordParts(lineStart, lineHeight);
alignWordParts(lineStart, lineHeight, width);
y += lineHeight;
@@ -201,7 +201,7 @@ bool MessageRef::layout(int width, bool enableEmoteMargins)
}
}
alignWordParts(lineStart, lineHeight);
alignWordParts(lineStart, lineHeight, width);
if (_height != y + lineHeight) {
sizeChanged = true;
@@ -224,12 +224,18 @@ const std::vector<WordPart> &MessageRef::getWordParts() const
return _wordParts;
}
void MessageRef::alignWordParts(int lineStart, int lineHeight)
void MessageRef::alignWordParts(int lineStart, int lineHeight, int width)
{
for (size_t i = lineStart; i < _wordParts.size(); i++) {
WordPart &wordPart2 = _wordParts.at(i);
int xOffset = 0;
wordPart2.setY(wordPart2.getY() + lineHeight);
if (this->_message->centered && _wordParts.size() > 0) {
xOffset = (width - this->_wordParts.at(_wordParts.size() - 1).getRight()) / 2;
}
for (size_t i = lineStart; i < this->_wordParts.size(); i++) {
WordPart &wordPart2 = this->_wordParts.at(i);
wordPart2.setPosition(wordPart2.getX() + xOffset, wordPart2.getY() + lineHeight);
}
}
+1 -1
View File
@@ -47,7 +47,7 @@ private:
Word::Type _currentWordTypes = Word::None;
// methods
void alignWordParts(int lineStart, int lineHeight);
void alignWordParts(int lineStart, int lineHeight, int width);
};
} // namespace messages
+3 -1
View File
@@ -77,9 +77,11 @@ public:
EmojiImage = (1 << 23),
EmojiText = (1 << 24),
AlwaysShow = (1 << 25),
Default = TimestampNoSeconds | Badges | Username | BitsStatic | FfzEmoteImage |
BttvEmoteImage | BttvGifEmoteImage | TwitchEmoteImage | BitsAmount | Text |
ButtonBan | ButtonTimeout
ButtonBan | ButtonTimeout | AlwaysShow
};
Word()