experiment with making a highlight configure dialog

This commit is contained in:
Rasmus Karlsson 2024-03-17 14:27:23 +01:00
parent 46c5609736
commit 94f218cc26
8 changed files with 301 additions and 58 deletions

View file

@ -568,6 +568,9 @@ set(SOURCE_FILES
widgets/dialogs/EditHotkeyDialog.hpp widgets/dialogs/EditHotkeyDialog.hpp
widgets/dialogs/EmotePopup.cpp widgets/dialogs/EmotePopup.cpp
widgets/dialogs/EmotePopup.hpp widgets/dialogs/EmotePopup.hpp
widgets/dialogs/HighlightConfigureDialog.cpp
widgets/dialogs/HighlightConfigureDialog.hpp
widgets/dialogs/HighlightConfigureDialog.ui
widgets/dialogs/IrcConnectionEditor.cpp widgets/dialogs/IrcConnectionEditor.cpp
widgets/dialogs/IrcConnectionEditor.hpp widgets/dialogs/IrcConnectionEditor.hpp
widgets/dialogs/IrcConnectionEditor.ui widgets/dialogs/IrcConnectionEditor.ui

View file

@ -77,7 +77,8 @@ void HighlightModel::afterInit()
auto selfColor = ColorProvider::instance().color(ColorType::SelfHighlight); auto selfColor = ColorProvider::instance().color(ColorType::SelfHighlight);
setColorItem(usernameRow[Column::Color], *selfColor, false); setColorItem(usernameRow[Column::Color], *selfColor, false);
this->insertCustomRow(usernameRow, HighlightRowIndexes::SelfHighlightRow); this->insertCustomRow(
usernameRow, static_cast<int>(HighlightRowIndexes::SelfHighlightRow));
// Highlight settings for whispers // Highlight settings for whispers
std::vector<QStandardItem *> whisperRow = this->createRow(); std::vector<QStandardItem *> whisperRow = this->createRow();
@ -101,7 +102,8 @@ void HighlightModel::afterInit()
auto whisperColor = ColorProvider::instance().color(ColorType::Whisper); auto whisperColor = ColorProvider::instance().color(ColorType::Whisper);
setColorItem(whisperRow[Column::Color], *whisperColor, false); setColorItem(whisperRow[Column::Color], *whisperColor, false);
this->insertCustomRow(whisperRow, HighlightRowIndexes::WhisperRow); this->insertCustomRow(whisperRow,
static_cast<int>(HighlightRowIndexes::WhisperRow));
// Highlight settings for subscription messages // Highlight settings for subscription messages
std::vector<QStandardItem *> subRow = this->createRow(); std::vector<QStandardItem *> subRow = this->createRow();
@ -123,7 +125,8 @@ void HighlightModel::afterInit()
auto subColor = ColorProvider::instance().color(ColorType::Subscription); auto subColor = ColorProvider::instance().color(ColorType::Subscription);
setColorItem(subRow[Column::Color], *subColor, false); setColorItem(subRow[Column::Color], *subColor, false);
this->insertCustomRow(subRow, HighlightRowIndexes::SubRow); this->insertCustomRow(subRow,
static_cast<int>(HighlightRowIndexes::SubRow));
// Highlight settings for redeemed highlight messages // Highlight settings for redeemed highlight messages
std::vector<QStandardItem *> redeemedRow = this->createRow(); std::vector<QStandardItem *> redeemedRow = this->createRow();
@ -148,7 +151,8 @@ void HighlightModel::afterInit()
ColorProvider::instance().color(ColorType::RedeemedHighlight); ColorProvider::instance().color(ColorType::RedeemedHighlight);
setColorItem(redeemedRow[Column::Color], *RedeemedColor, false); setColorItem(redeemedRow[Column::Color], *RedeemedColor, false);
this->insertCustomRow(redeemedRow, HighlightRowIndexes::RedeemedRow); this->insertCustomRow(redeemedRow,
static_cast<int>(HighlightRowIndexes::RedeemedRow));
// Highlight settings for first messages // Highlight settings for first messages
std::vector<QStandardItem *> firstMessageRow = this->createRow(); std::vector<QStandardItem *> firstMessageRow = this->createRow();
@ -174,8 +178,9 @@ void HighlightModel::afterInit()
ColorProvider::instance().color(ColorType::FirstMessageHighlight); ColorProvider::instance().color(ColorType::FirstMessageHighlight);
setColorItem(firstMessageRow[Column::Color], *FirstMessageColor, false); setColorItem(firstMessageRow[Column::Color], *FirstMessageColor, false);
this->insertCustomRow(firstMessageRow, this->insertCustomRow(
HighlightRowIndexes::FirstMessageRow); firstMessageRow,
static_cast<int>(HighlightRowIndexes::FirstMessageRow));
// Highlight settings for hype chats // Highlight settings for hype chats
std::vector<QStandardItem *> elevatedMessageRow = this->createRow(); std::vector<QStandardItem *> elevatedMessageRow = this->createRow();
@ -201,8 +206,9 @@ void HighlightModel::afterInit()
setColorItem(elevatedMessageRow[Column::Color], *elevatedMessageColor, setColorItem(elevatedMessageRow[Column::Color], *elevatedMessageColor,
false); false);
this->insertCustomRow(elevatedMessageRow, this->insertCustomRow(
HighlightRowIndexes::ElevatedMessageRow); elevatedMessageRow,
static_cast<int>(HighlightRowIndexes::ElevatedMessageRow));
// Highlight settings for reply threads // Highlight settings for reply threads
std::vector<QStandardItem *> threadMessageRow = this->createRow(); std::vector<QStandardItem *> threadMessageRow = this->createRow();
@ -231,8 +237,9 @@ void HighlightModel::afterInit()
ColorProvider::instance().color(ColorType::ThreadMessageHighlight); ColorProvider::instance().color(ColorType::ThreadMessageHighlight);
setColorItem(threadMessageRow[Column::Color], *threadMessageColor, false); setColorItem(threadMessageRow[Column::Color], *threadMessageColor, false);
this->insertCustomRow(threadMessageRow, this->insertCustomRow(
HighlightRowIndexes::ThreadMessageRow); threadMessageRow,
static_cast<int>(HighlightRowIndexes::ThreadMessageRow));
// Highlight settings for automod caught messages // Highlight settings for automod caught messages
const std::vector<QStandardItem *> automodRow = this->createRow(); const std::vector<QStandardItem *> automodRow = this->createRow();
@ -258,52 +265,55 @@ void HighlightModel::afterInit()
ColorProvider::instance().color(ColorType::AutomodHighlight); ColorProvider::instance().color(ColorType::AutomodHighlight);
setColorItem(automodRow[Column::Color], *automodColor, false); setColorItem(automodRow[Column::Color], *automodColor, false);
this->insertCustomRow(automodRow, HighlightRowIndexes::AutomodRow); this->insertCustomRow(automodRow,
static_cast<int>(HighlightRowIndexes::AutomodRow));
} }
void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row, void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
int column, const QVariant &value, int column, const QVariant &value,
int role, int rowIndex) int role, int rowIndex)
{ {
switch (column) auto rowIndex2 = static_cast<HighlightRowIndexes>(rowIndex);
auto column2 = static_cast<Column>(column);
switch (column2)
{ {
case Column::Pattern: { case Column::Pattern: {
if (role == Qt::CheckStateRole) if (role == Qt::CheckStateRole)
{ {
if (rowIndex == HighlightRowIndexes::SelfHighlightRow) if (rowIndex2 == HighlightRowIndexes::SelfHighlightRow)
{ {
getSettings()->enableSelfHighlight.setValue(value.toBool()); getSettings()->enableSelfHighlight.setValue(value.toBool());
} }
else if (rowIndex == HighlightRowIndexes::WhisperRow) else if (rowIndex2 == HighlightRowIndexes::WhisperRow)
{ {
getSettings()->enableWhisperHighlight.setValue( getSettings()->enableWhisperHighlight.setValue(
value.toBool()); value.toBool());
} }
else if (rowIndex == HighlightRowIndexes::SubRow) else if (rowIndex2 == HighlightRowIndexes::SubRow)
{ {
getSettings()->enableSubHighlight.setValue(value.toBool()); getSettings()->enableSubHighlight.setValue(value.toBool());
} }
else if (rowIndex == HighlightRowIndexes::RedeemedRow) else if (rowIndex2 == HighlightRowIndexes::RedeemedRow)
{ {
getSettings()->enableRedeemedHighlight.setValue( getSettings()->enableRedeemedHighlight.setValue(
value.toBool()); value.toBool());
} }
else if (rowIndex == HighlightRowIndexes::FirstMessageRow) else if (rowIndex2 == HighlightRowIndexes::FirstMessageRow)
{ {
getSettings()->enableFirstMessageHighlight.setValue( getSettings()->enableFirstMessageHighlight.setValue(
value.toBool()); value.toBool());
} }
else if (rowIndex == HighlightRowIndexes::ElevatedMessageRow) else if (rowIndex2 == HighlightRowIndexes::ElevatedMessageRow)
{ {
getSettings()->enableElevatedMessageHighlight.setValue( getSettings()->enableElevatedMessageHighlight.setValue(
value.toBool()); value.toBool());
} }
else if (rowIndex == HighlightRowIndexes::ThreadMessageRow) else if (rowIndex2 == HighlightRowIndexes::ThreadMessageRow)
{ {
getSettings()->enableThreadHighlight.setValue( getSettings()->enableThreadHighlight.setValue(
value.toBool()); value.toBool());
} }
else if (rowIndex == HighlightRowIndexes::AutomodRow) else if (rowIndex2 == HighlightRowIndexes::AutomodRow)
{ {
getSettings()->enableAutomodHighlight.setValue( getSettings()->enableAutomodHighlight.setValue(
value.toBool()); value.toBool());
@ -314,17 +324,17 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
case Column::ShowInMentions: { case Column::ShowInMentions: {
if (role == Qt::CheckStateRole) if (role == Qt::CheckStateRole)
{ {
if (rowIndex == HighlightRowIndexes::SelfHighlightRow) if (rowIndex2 == HighlightRowIndexes::SelfHighlightRow)
{ {
getSettings()->showSelfHighlightInMentions.setValue( getSettings()->showSelfHighlightInMentions.setValue(
value.toBool()); value.toBool());
} }
else if (rowIndex == HighlightRowIndexes::ThreadMessageRow) else if (rowIndex2 == HighlightRowIndexes::ThreadMessageRow)
{ {
getSettings()->showThreadHighlightInMentions.setValue( getSettings()->showThreadHighlightInMentions.setValue(
value.toBool()); value.toBool());
} }
else if (rowIndex == HighlightRowIndexes::AutomodRow) else if (rowIndex2 == HighlightRowIndexes::AutomodRow)
{ {
getSettings()->showAutomodInMentions.setValue( getSettings()->showAutomodInMentions.setValue(
value.toBool()); value.toBool());
@ -335,43 +345,43 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
case Column::FlashTaskbar: { case Column::FlashTaskbar: {
if (role == Qt::CheckStateRole) if (role == Qt::CheckStateRole)
{ {
if (rowIndex == HighlightRowIndexes::SelfHighlightRow) if (rowIndex2 == HighlightRowIndexes::SelfHighlightRow)
{ {
getSettings()->enableSelfHighlightTaskbar.setValue( getSettings()->enableSelfHighlightTaskbar.setValue(
value.toBool()); value.toBool());
} }
else if (rowIndex == HighlightRowIndexes::WhisperRow) else if (rowIndex2 == HighlightRowIndexes::WhisperRow)
{ {
getSettings()->enableWhisperHighlightTaskbar.setValue( getSettings()->enableWhisperHighlightTaskbar.setValue(
value.toBool()); value.toBool());
} }
else if (rowIndex == HighlightRowIndexes::SubRow) else if (rowIndex2 == HighlightRowIndexes::SubRow)
{ {
getSettings()->enableSubHighlightTaskbar.setValue( getSettings()->enableSubHighlightTaskbar.setValue(
value.toBool()); value.toBool());
} }
else if (rowIndex == HighlightRowIndexes::RedeemedRow) else if (rowIndex2 == HighlightRowIndexes::RedeemedRow)
{ {
// getSettings()->enableRedeemedHighlightTaskbar.setValue( // getSettings()->enableRedeemedHighlightTaskbar.setValue(
// value.toBool()); // value.toBool());
} }
else if (rowIndex == HighlightRowIndexes::FirstMessageRow) else if (rowIndex2 == HighlightRowIndexes::FirstMessageRow)
{ {
// getSettings()->enableFirstMessageHighlightTaskbar.setValue( // getSettings()->enableFirstMessageHighlightTaskbar.setValue(
// value.toBool()); // value.toBool());
} }
else if (rowIndex == HighlightRowIndexes::ElevatedMessageRow) else if (rowIndex2 == HighlightRowIndexes::ElevatedMessageRow)
{ {
// getSettings() // getSettings()
// ->enableElevatedMessageHighlightTaskbar.setvalue( // ->enableElevatedMessageHighlightTaskbar.setvalue(
// value.toBool()); // value.toBool());
} }
else if (rowIndex == HighlightRowIndexes::ThreadMessageRow) else if (rowIndex2 == HighlightRowIndexes::ThreadMessageRow)
{ {
getSettings()->enableThreadHighlightTaskbar.setValue( getSettings()->enableThreadHighlightTaskbar.setValue(
value.toBool()); value.toBool());
} }
else if (rowIndex == HighlightRowIndexes::AutomodRow) else if (rowIndex2 == HighlightRowIndexes::AutomodRow)
{ {
getSettings()->enableAutomodHighlightTaskbar.setValue( getSettings()->enableAutomodHighlightTaskbar.setValue(
value.toBool()); value.toBool());
@ -382,42 +392,42 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
case Column::PlaySound: { case Column::PlaySound: {
if (role == Qt::CheckStateRole) if (role == Qt::CheckStateRole)
{ {
if (rowIndex == HighlightRowIndexes::SelfHighlightRow) if (rowIndex2 == HighlightRowIndexes::SelfHighlightRow)
{ {
getSettings()->enableSelfHighlightSound.setValue( getSettings()->enableSelfHighlightSound.setValue(
value.toBool()); value.toBool());
} }
else if (rowIndex == HighlightRowIndexes::WhisperRow) else if (rowIndex2 == HighlightRowIndexes::WhisperRow)
{ {
getSettings()->enableWhisperHighlightSound.setValue( getSettings()->enableWhisperHighlightSound.setValue(
value.toBool()); value.toBool());
} }
else if (rowIndex == HighlightRowIndexes::SubRow) else if (rowIndex2 == HighlightRowIndexes::SubRow)
{ {
getSettings()->enableSubHighlightSound.setValue( getSettings()->enableSubHighlightSound.setValue(
value.toBool()); value.toBool());
} }
else if (rowIndex == HighlightRowIndexes::RedeemedRow) else if (rowIndex2 == HighlightRowIndexes::RedeemedRow)
{ {
// getSettings()->enableRedeemedHighlightSound.setValue( // getSettings()->enableRedeemedHighlightSound.setValue(
// value.toBool()); // value.toBool());
} }
else if (rowIndex == HighlightRowIndexes::FirstMessageRow) else if (rowIndex2 == HighlightRowIndexes::FirstMessageRow)
{ {
// getSettings()->enableFirstMessageHighlightSound.setValue( // getSettings()->enableFirstMessageHighlightSound.setValue(
// value.toBool()); // value.toBool());
} }
else if (rowIndex == HighlightRowIndexes::ElevatedMessageRow) else if (rowIndex2 == HighlightRowIndexes::ElevatedMessageRow)
{ {
// getSettings()->enableElevatedMessageHighlightSound.setValue( // getSettings()->enableElevatedMessageHighlightSound.setValue(
// value.toBool()); // value.toBool());
} }
else if (rowIndex == HighlightRowIndexes::ThreadMessageRow) else if (rowIndex2 == HighlightRowIndexes::ThreadMessageRow)
{ {
getSettings()->enableThreadHighlightSound.setValue( getSettings()->enableThreadHighlightSound.setValue(
value.toBool()); value.toBool());
} }
else if (rowIndex == HighlightRowIndexes::AutomodRow) else if (rowIndex2 == HighlightRowIndexes::AutomodRow)
{ {
getSettings()->enableAutomodHighlightSound.setValue( getSettings()->enableAutomodHighlightSound.setValue(
value.toBool()); value.toBool());
@ -437,27 +447,27 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
// Custom sound file // Custom sound file
if (role == Qt::UserRole) if (role == Qt::UserRole)
{ {
if (rowIndex == HighlightRowIndexes::SelfHighlightRow) if (rowIndex2 == HighlightRowIndexes::SelfHighlightRow)
{ {
getSettings()->selfHighlightSoundUrl.setValue( getSettings()->selfHighlightSoundUrl.setValue(
value.toString()); value.toString());
} }
else if (rowIndex == HighlightRowIndexes::WhisperRow) else if (rowIndex2 == HighlightRowIndexes::WhisperRow)
{ {
getSettings()->whisperHighlightSoundUrl.setValue( getSettings()->whisperHighlightSoundUrl.setValue(
value.toString()); value.toString());
} }
else if (rowIndex == HighlightRowIndexes::SubRow) else if (rowIndex2 == HighlightRowIndexes::SubRow)
{ {
getSettings()->subHighlightSoundUrl.setValue( getSettings()->subHighlightSoundUrl.setValue(
value.toString()); value.toString());
} }
else if (rowIndex == HighlightRowIndexes::ThreadMessageRow) else if (rowIndex2 == HighlightRowIndexes::ThreadMessageRow)
{ {
getSettings()->threadHighlightSoundUrl.setValue( getSettings()->threadHighlightSoundUrl.setValue(
value.toString()); value.toString());
} }
else if (rowIndex == HighlightRowIndexes::AutomodRow) else if (rowIndex2 == HighlightRowIndexes::AutomodRow)
{ {
getSettings()->automodHighlightSoundUrl.setValue( getSettings()->automodHighlightSoundUrl.setValue(
value.toString()); value.toString());
@ -474,42 +484,42 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
setting.setValue(color.name(QColor::HexArgb)); setting.setValue(color.name(QColor::HexArgb));
}; };
if (rowIndex == HighlightRowIndexes::SelfHighlightRow) if (rowIndex2 == HighlightRowIndexes::SelfHighlightRow)
{ {
setColor(getSettings()->selfHighlightColor, setColor(getSettings()->selfHighlightColor,
ColorType::SelfHighlight); ColorType::SelfHighlight);
} }
else if (rowIndex == HighlightRowIndexes::WhisperRow) else if (rowIndex2 == HighlightRowIndexes::WhisperRow)
{ {
setColor(getSettings()->whisperHighlightColor, setColor(getSettings()->whisperHighlightColor,
ColorType::Whisper); ColorType::Whisper);
} }
else if (rowIndex == HighlightRowIndexes::SubRow) else if (rowIndex2 == HighlightRowIndexes::SubRow)
{ {
setColor(getSettings()->subHighlightColor, setColor(getSettings()->subHighlightColor,
ColorType::Subscription); ColorType::Subscription);
} }
else if (rowIndex == HighlightRowIndexes::RedeemedRow) else if (rowIndex2 == HighlightRowIndexes::RedeemedRow)
{ {
setColor(getSettings()->redeemedHighlightColor, setColor(getSettings()->redeemedHighlightColor,
ColorType::RedeemedHighlight); ColorType::RedeemedHighlight);
} }
else if (rowIndex == HighlightRowIndexes::FirstMessageRow) else if (rowIndex2 == HighlightRowIndexes::FirstMessageRow)
{ {
setColor(getSettings()->firstMessageHighlightColor, setColor(getSettings()->firstMessageHighlightColor,
ColorType::FirstMessageHighlight); ColorType::FirstMessageHighlight);
} }
else if (rowIndex == HighlightRowIndexes::ElevatedMessageRow) else if (rowIndex2 == HighlightRowIndexes::ElevatedMessageRow)
{ {
setColor(getSettings()->elevatedMessageHighlightColor, setColor(getSettings()->elevatedMessageHighlightColor,
ColorType::ElevatedMessageHighlight); ColorType::ElevatedMessageHighlight);
} }
else if (rowIndex == HighlightRowIndexes::ThreadMessageRow) else if (rowIndex2 == HighlightRowIndexes::ThreadMessageRow)
{ {
setColor(getSettings()->threadHighlightColor, setColor(getSettings()->threadHighlightColor,
ColorType::ThreadMessageHighlight); ColorType::ThreadMessageHighlight);
} }
else if (rowIndex == HighlightRowIndexes::AutomodRow) else if (rowIndex2 == HighlightRowIndexes::AutomodRow)
{ {
setColor(getSettings()->automodHighlightColor, setColor(getSettings()->automodHighlightColor,
ColorType::AutomodHighlight); ColorType::AutomodHighlight);

View file

@ -23,10 +23,11 @@ public:
PlaySound = 5, PlaySound = 5,
SoundPath = 6, SoundPath = 6,
Color = 7, Color = 7,
Configure = 8,
COUNT // keep this as last member of enum COUNT // keep this as last member of enum
}; };
enum HighlightRowIndexes { enum class HighlightRowIndexes {
SelfHighlightRow = 0, SelfHighlightRow = 0,
WhisperRow = 1, WhisperRow = 1,
SubRow = 2, SubRow = 2,
@ -35,6 +36,7 @@ public:
ElevatedMessageRow = 5, ElevatedMessageRow = 5,
ThreadMessageRow = 6, ThreadMessageRow = 6,
AutomodRow = 7, AutomodRow = 7,
COUNT,
}; };
enum UserHighlightRowIndexes { enum UserHighlightRowIndexes {

View file

@ -0,0 +1,23 @@
#include "widgets/dialogs/HighlightConfigureDialog.hpp"
#include "widgets/dialogs/ui_HighlightConfigureDialog.h"
namespace chatterino {
HighlightConfigureDialog::HighlightConfigureDialog(HighlightPhrase phrase,
QWidget *parent)
: QDialog(parent, Qt::WindowStaysOnTopHint)
, ui_(new Ui::HighlightConfigureDialog)
{
this->ui_->setupUi(this);
this->ui_->patternLineEdit->setText(phrase.getPattern());
}
HighlightConfigureDialog::~HighlightConfigureDialog()
{
delete ui_;
}
} // namespace chatterino

View file

@ -0,0 +1,35 @@
#pragma once
#include "controllers/highlights/HighlightPhrase.hpp"
#include <QDialog>
namespace Ui {
class HighlightConfigureDialog;
} // namespace Ui
namespace chatterino {
struct IrcServerData;
class HighlightConfigureDialog : public QDialog
{
Q_OBJECT
public:
explicit HighlightConfigureDialog(HighlightPhrase phrase, QWidget *parent);
HighlightConfigureDialog(const HighlightConfigureDialog &) = delete;
HighlightConfigureDialog(HighlightConfigureDialog &&) = delete;
HighlightConfigureDialog &operator=(const HighlightConfigureDialog &) =
delete;
HighlightConfigureDialog &operator=(HighlightConfigureDialog &&) = delete;
~HighlightConfigureDialog() override;
private:
Ui::HighlightConfigureDialog *ui_;
};
} // namespace chatterino

View file

@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>HighlightConfigureDialog</class>
<widget class="QDialog" name="HighlightConfigureDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Configure highlight</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="patternLabel">
<property name="text">
<string>Pattern</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="patternLineEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="showInMentionsLabel">
<property name="text">
<string>Show in Mentions</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="showInMentionsCheckBox"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="flaskTaskbarLabel">
<property name="text">
<string>Flask taskbar</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="flaskTaskbarCheckBox"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="enableRegexLabel">
<property name="text">
<string>Enable regex</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="enableRegexCheckBox"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="playSoundLabel">
<property name="text">
<string>Play sound</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="playSoundCheckBox"/>
</item>
<item row="5" column="0">
<widget class="QLabel" name="customSoundLabel">
<property name="text">
<string>Custom sound</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="customSoundLineEdit"/>
</item>
<item row="6" column="0">
<widget class="QLabel" name="colorLabel">
<property name="text">
<string>Color</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QWidget" name="colorWidget" native="true"/>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>HighlightConfigureDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>HighlightConfigureDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View file

@ -1,4 +1,4 @@
#include "HighlightingPage.hpp" #include "widgets/settingspages/HighlightingPage.hpp"
#include "Application.hpp" #include "Application.hpp"
#include "controllers/highlights/BadgeHighlightModel.hpp" #include "controllers/highlights/BadgeHighlightModel.hpp"
@ -15,6 +15,7 @@
#include "util/LayoutCreator.hpp" #include "util/LayoutCreator.hpp"
#include "widgets/dialogs/BadgePickerDialog.hpp" #include "widgets/dialogs/BadgePickerDialog.hpp"
#include "widgets/dialogs/ColorPickerDialog.hpp" #include "widgets/dialogs/ColorPickerDialog.hpp"
#include "widgets/dialogs/HighlightConfigureDialog.hpp"
#include "widgets/helper/color/ColorItemDelegate.hpp" #include "widgets/helper/color/ColorItemDelegate.hpp"
#include "widgets/helper/EditableModelView.hpp" #include "widgets/helper/EditableModelView.hpp"
@ -75,10 +76,17 @@ HighlightingPage::HighlightingPage()
&getSettings()->highlightedMessages)) &getSettings()->highlightedMessages))
.getElement(); .getElement();
view->addRegexHelpLink(); view->addRegexHelpLink();
view->setTitles({"Pattern", "Show in\nMentions", view->setTitles({
"Flash\ntaskbar", "Enable\nregex", "Pattern",
"Case-\nsensitive", "Play\nsound", "Show in\nMentions",
"Custom\nsound", "Color"}); "Flash\ntaskbar",
"Enable\nregex",
"Case-\nsensitive",
"Play\nsound",
"Custom\nsound",
"Color",
"Configure",
});
view->getTableView()->horizontalHeader()->setSectionResizeMode( view->getTableView()->horizontalHeader()->setSectionResizeMode(
QHeaderView::Fixed); QHeaderView::Fixed);
view->getTableView()->horizontalHeader()->setSectionResizeMode( view->getTableView()->horizontalHeader()->setSectionResizeMode(
@ -353,6 +361,21 @@ void HighlightingPage::openColorDialog(const QModelIndex &clicked,
dialog->show(); dialog->show();
} }
void HighlightingPage::openConfigureDialog(const QModelIndex &clicked,
EditableModelView *view,
HighlightTab tab)
{
if (tab != HighlightTab::Messages)
{
return;
}
auto phrase =
getSettings()->highlightedMessages.readOnly()->at(clicked.row());
auto *xd = new HighlightConfigureDialog(phrase, this);
xd->show();
}
void HighlightingPage::tableCellClicked(const QModelIndex &clicked, void HighlightingPage::tableCellClicked(const QModelIndex &clicked,
EditableModelView *view, EditableModelView *view,
HighlightTab tab) HighlightTab tab)
@ -376,6 +399,10 @@ void HighlightingPage::tableCellClicked(const QModelIndex &clicked,
{ {
this->openColorDialog(clicked, view, tab); this->openColorDialog(clicked, view, tab);
} }
else if (clicked.column() == Column::Configure)
{
this->openConfigureDialog(clicked, view, tab);
}
} }
break; break;

View file

@ -28,6 +28,8 @@ private:
int soundColumn); int soundColumn);
void openColorDialog(const QModelIndex &clicked, EditableModelView *view, void openColorDialog(const QModelIndex &clicked, EditableModelView *view,
HighlightTab tab); HighlightTab tab);
void openConfigureDialog(const QModelIndex &clicked,
EditableModelView *view, HighlightTab tab);
}; };
} // namespace chatterino } // namespace chatterino