Added Highlights (#86)

Added Highlights
This commit is contained in:
Cranken
2017-07-31 00:37:22 +02:00
committed by pajlada
parent 467ca90fd8
commit 8fb0671834
17 changed files with 245 additions and 12 deletions
+2 -1
View File
@@ -29,9 +29,10 @@ Message::Message(const QString &text)
}
*/
Message::Message(const QString &text, const std::vector<Word> &words)
Message::Message(const QString &text, const std::vector<Word> &words, const bool &highlight)
: text(text)
, words(words)
, highlightTab(highlight)
{
}
+1 -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;
const QString &getTimeoutUser() const;
+5 -1
View File
@@ -16,7 +16,7 @@ MessageBuilder::MessageBuilder()
SharedMessage MessageBuilder::build()
{
return SharedMessage(new Message(this->originalMessage, _words));
return SharedMessage(new Message(this->originalMessage, _words,highlight));
}
void MessageBuilder::appendWord(const Word &word)
@@ -31,6 +31,10 @@ void MessageBuilder::appendTimestamp()
appendTimestamp(t);
}
void MessageBuilder::setHighlight(const bool &value){
highlight = value;
}
void MessageBuilder::appendTimestamp(time_t time)
{
char timeStampBuffer[69];
+2
View File
@@ -18,6 +18,7 @@ public:
void appendWord(const Word &word);
void appendTimestamp();
void appendTimestamp(std::time_t time);
void setHighlight(const bool &value);
QString matchLink(const QString &string);
QRegularExpression regex;
@@ -26,6 +27,7 @@ public:
private:
std::vector<Word> _words;
bool highlight = false;
std::chrono::time_point<std::chrono::system_clock> _parseTime;
};