added highlights to the scrollbar
This commit is contained in:
@@ -132,7 +132,7 @@ public:
|
||||
return acceptedItems;
|
||||
}
|
||||
|
||||
// replaces a single item, return true if successful
|
||||
// replace an single item, return index if successful, -1 if unsuccessful
|
||||
int replaceItem(const T &item, const T &replacement)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(this->mutex);
|
||||
@@ -166,6 +166,38 @@ public:
|
||||
return -1;
|
||||
}
|
||||
|
||||
// replace an item at index, return true if worked
|
||||
bool replaceItem(size_t index, const T &replacement)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(this->mutex);
|
||||
|
||||
int x = 0;
|
||||
|
||||
for (size_t i = 0; i < this->chunks->size(); i++) {
|
||||
Chunk &chunk = this->chunks->at(i);
|
||||
|
||||
size_t start = i == 0 ? this->firstChunkOffset : 0;
|
||||
size_t end = i == chunk->size() - 1 ? this->lastChunkEnd : chunk->size();
|
||||
|
||||
for (size_t j = start; j < end; j++) {
|
||||
if (x == index) {
|
||||
Chunk newChunk = std::make_shared<std::vector<T>>();
|
||||
newChunk->resize(chunk->size());
|
||||
|
||||
for (size_t k = 0; k < chunk->size(); k++) {
|
||||
newChunk->at(k) = chunk->at(k);
|
||||
}
|
||||
|
||||
newChunk->at(j) = replacement;
|
||||
this->chunks->at(i) = newChunk;
|
||||
|
||||
return x;
|
||||
}
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// void insertAfter(const std::vector<T> &items, const T &index)
|
||||
|
||||
messages::LimitedQueueSnapshot<T> getSnapshot()
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include <list>
|
||||
#include <tuple>
|
||||
|
||||
typedef chatterino::widgets::ScrollbarHighlight SBHighlight;
|
||||
|
||||
namespace chatterino {
|
||||
namespace messages {
|
||||
|
||||
@@ -128,6 +130,14 @@ void Message::updateContent() const
|
||||
this->content = _content;
|
||||
}
|
||||
|
||||
SBHighlight Message::getScrollBarHighlight() const
|
||||
{
|
||||
if (this->getFlags() & Message::Highlighted) {
|
||||
return SBHighlight(SBHighlight::Highlight);
|
||||
}
|
||||
return SBHighlight();
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
void AddCurrentTimestamp(Message *message)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "messages/word.hpp"
|
||||
#include "widgets/helper/scrollbarhighlight.hpp"
|
||||
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
@@ -23,6 +24,7 @@ public:
|
||||
None = 0,
|
||||
System = (1 << 1),
|
||||
Timeout = (1 << 2),
|
||||
Highlighted = (1 << 3),
|
||||
};
|
||||
|
||||
bool containsHighlightedPhrase() const;
|
||||
@@ -44,6 +46,7 @@ public:
|
||||
bool getDisableCompactEmotes() const;
|
||||
void setDisableCompactEmotes(bool value);
|
||||
void updateContent() const;
|
||||
widgets::ScrollbarHighlight getScrollBarHighlight() const;
|
||||
|
||||
QString loginName;
|
||||
QString displayName;
|
||||
|
||||
Reference in New Issue
Block a user