mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
parent
6229b2f434
commit
d0839ac36e
|
@ -63,10 +63,10 @@ void HighlightModel::afterInit()
|
|||
usernameRow[Column::CaseSensitive]->setFlags(0);
|
||||
|
||||
QUrl selfSound = QUrl(getSettings()->selfHighlightSoundUrl.getValue());
|
||||
setFilePathItem(usernameRow[Column::SoundPath], selfSound);
|
||||
setFilePathItem(usernameRow[Column::SoundPath], selfSound, false);
|
||||
|
||||
auto selfColor = ColorProvider::instance().color(ColorType::SelfHighlight);
|
||||
setColorItem(usernameRow[Column::Color], *selfColor);
|
||||
setColorItem(usernameRow[Column::Color], *selfColor, false);
|
||||
|
||||
this->insertCustomRow(usernameRow, 0);
|
||||
|
||||
|
@ -86,10 +86,10 @@ void HighlightModel::afterInit()
|
|||
|
||||
QUrl whisperSound =
|
||||
QUrl(getSettings()->whisperHighlightSoundUrl.getValue());
|
||||
setFilePathItem(whisperRow[Column::SoundPath], whisperSound);
|
||||
setFilePathItem(whisperRow[Column::SoundPath], whisperSound, false);
|
||||
|
||||
auto whisperColor = ColorProvider::instance().color(ColorType::Whisper);
|
||||
setColorItem(whisperRow[Column::Color], *whisperColor);
|
||||
setColorItem(whisperRow[Column::Color], *whisperColor, false);
|
||||
|
||||
this->insertCustomRow(whisperRow, 1);
|
||||
|
||||
|
@ -107,10 +107,10 @@ void HighlightModel::afterInit()
|
|||
subRow[Column::CaseSensitive]->setFlags(0);
|
||||
|
||||
QUrl subSound = QUrl(getSettings()->subHighlightSoundUrl.getValue());
|
||||
setFilePathItem(subRow[Column::SoundPath], subSound);
|
||||
setFilePathItem(subRow[Column::SoundPath], subSound, false);
|
||||
|
||||
auto subColor = ColorProvider::instance().color(ColorType::Subscription);
|
||||
setColorItem(subRow[Column::Color], *subColor);
|
||||
setColorItem(subRow[Column::Color], *subColor, false);
|
||||
|
||||
this->insertCustomRow(subRow, 2);
|
||||
}
|
||||
|
|
|
@ -22,17 +22,23 @@ static void setStringItem(QStandardItem *item, const QString &value,
|
|||
(editable ? (Qt::ItemIsEditable) : 0)));
|
||||
}
|
||||
|
||||
static void setFilePathItem(QStandardItem *item, const QUrl &value)
|
||||
static void setFilePathItem(QStandardItem *item, const QUrl &value,
|
||||
bool selectable = true)
|
||||
{
|
||||
item->setData(value, Qt::UserRole);
|
||||
item->setData(value.fileName(), Qt::DisplayRole);
|
||||
item->setFlags(Qt::ItemFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable));
|
||||
item->setFlags(
|
||||
Qt::ItemFlags(Qt::ItemIsEnabled |
|
||||
(selectable ? Qt::ItemIsSelectable : Qt::NoItemFlags)));
|
||||
}
|
||||
|
||||
static void setColorItem(QStandardItem *item, const QColor &value)
|
||||
static void setColorItem(QStandardItem *item, const QColor &value,
|
||||
bool selectable = true)
|
||||
{
|
||||
item->setData(value, Qt::DecorationRole);
|
||||
item->setFlags(Qt::ItemFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable));
|
||||
item->setFlags(
|
||||
Qt::ItemFlags(Qt::ItemIsEnabled |
|
||||
(selectable ? Qt::ItemIsSelectable : Qt::NoItemFlags)));
|
||||
}
|
||||
|
||||
static QStandardItem *emptyItem()
|
||||
|
|
Loading…
Reference in a new issue