added new TupleTableModel for settingsdialog
This commit is contained in:
@@ -10,13 +10,14 @@ namespace messages {
|
||||
|
||||
struct HighlightPhrase {
|
||||
QString key;
|
||||
bool sound;
|
||||
bool alert;
|
||||
bool sound;
|
||||
bool regex;
|
||||
|
||||
bool operator==(const HighlightPhrase &rhs) const
|
||||
bool operator==(const HighlightPhrase &other) const
|
||||
{
|
||||
return std::tie(this->key, this->sound, this->alert) ==
|
||||
std::tie(rhs.key, rhs.sound, rhs.alert);
|
||||
return std::tie(this->key, this->sound, this->alert, this->regex) ==
|
||||
std::tie(other.key, other.sound, other.alert, other.regex);
|
||||
}
|
||||
};
|
||||
} // namespace messages
|
||||
@@ -35,6 +36,7 @@ struct Serialize<chatterino::messages::HighlightPhrase> {
|
||||
AddMember(ret, "key", value.key, a);
|
||||
AddMember(ret, "alert", value.alert, a);
|
||||
AddMember(ret, "sound", value.sound, a);
|
||||
AddMember(ret, "regex", value.regex, a);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -70,6 +72,13 @@ struct Deserialize<chatterino::messages::HighlightPhrase> {
|
||||
}
|
||||
}
|
||||
|
||||
if (value.HasMember("regex")) {
|
||||
const rapidjson::Value ®ex = value["regex"];
|
||||
if (regex.IsBool()) {
|
||||
ret.regex = regex.GetBool();
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -198,7 +198,7 @@ void MessageLayout::updateBuffer(QPixmap *buffer, int messageIndex, Selection &s
|
||||
// draw message
|
||||
this->container.paintElements(painter);
|
||||
|
||||
#ifdef OHHEYITSFOURTF
|
||||
#ifdef FOURTF
|
||||
// debug
|
||||
painter.setPen(QColor(255, 0, 0));
|
||||
painter.drawRect(buffer->rect().x(), buffer->rect().y(), buffer->rect().width() - 1,
|
||||
|
||||
@@ -191,7 +191,7 @@ MessageLayoutElement *MessageLayoutContainer::getElementAt(QPoint point)
|
||||
void MessageLayoutContainer::paintElements(QPainter &painter)
|
||||
{
|
||||
for (const std::unique_ptr<MessageLayoutElement> &element : this->elements) {
|
||||
#ifdef OHHEYITSFOURTF
|
||||
#ifdef FOURTF
|
||||
painter.setPen(QColor(0, 255, 0));
|
||||
painter.drawRect(element->getRect());
|
||||
#endif
|
||||
@@ -214,12 +214,14 @@ void MessageLayoutContainer::paintSelection(QPainter &painter, int messageIndex,
|
||||
QColor selectionColor = themeManager.messages.selection;
|
||||
|
||||
// don't draw anything
|
||||
if (selection.selectionMin.messageIndex > messageIndex || selection.selectionMax.messageIndex < messageIndex) {
|
||||
if (selection.selectionMin.messageIndex > messageIndex ||
|
||||
selection.selectionMax.messageIndex < messageIndex) {
|
||||
return;
|
||||
}
|
||||
|
||||
// fully selected
|
||||
if (selection.selectionMin.messageIndex < messageIndex && selection.selectionMax.messageIndex > messageIndex) {
|
||||
if (selection.selectionMin.messageIndex < messageIndex &&
|
||||
selection.selectionMax.messageIndex > messageIndex) {
|
||||
for (Line &line : this->lines) {
|
||||
QRect rect = line.rect;
|
||||
|
||||
@@ -267,8 +269,8 @@ void MessageLayoutContainer::paintSelection(QPainter &painter, int messageIndex,
|
||||
int c = this->elements[i]->getSelectionIndexCount();
|
||||
|
||||
if (index + c > selection.selectionMax.charIndex) {
|
||||
r = this->elements[i]->getXFromIndex(selection.selectionMax.charIndex -
|
||||
index);
|
||||
r = this->elements[i]->getXFromIndex(
|
||||
selection.selectionMax.charIndex - index);
|
||||
break;
|
||||
}
|
||||
index += c;
|
||||
|
||||
Reference in New Issue
Block a user