diff options
| author | AL <26797547+Al12rs@users.noreply.github.com> | 2020-04-29 16:49:12 +0200 |
|---|---|---|
| committer | AL <26797547+Al12rs@users.noreply.github.com> | 2020-04-29 16:49:12 +0200 |
| commit | 312af10f4f7aae13d953141ad9e2fb0180aebbef (patch) | |
| tree | 820f2e5ff48ec0c6fb2c532725ce14ccce263d1d /src | |
| parent | 9945beabf160c68852a8bdac07de255f04fd6886 (diff) | |
Allow coloring notes field.
Diffstat (limited to 'src')
| -rw-r--r-- | src/mainwindow.cpp | 19 | ||||
| -rw-r--r-- | src/modlist.cpp | 6 |
2 files changed, 13 insertions, 12 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 01d3e62c..8393d314 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -3649,11 +3649,7 @@ void MainWindow::setColor_clicked() if (selection->hasSelection() && selection->selectedRows().count() > 1) { for (QModelIndex idx : selection->selectedRows()) { ModInfo::Ptr info = ModInfo::getByIndex(idx.data(Qt::UserRole + 1).toInt()); - auto flags = info->getFlags(); - if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_SEPARATOR) != flags.end()) - { - info->setColor(currentColor); - } + info->setColor(currentColor); } } else { @@ -3669,11 +3665,7 @@ void MainWindow::resetColor_clicked() if (selection->hasSelection() && selection->selectedRows().count() > 1) { for (QModelIndex idx : selection->selectedRows()) { ModInfo::Ptr info = ModInfo::getByIndex(idx.data(Qt::UserRole + 1).toInt()); - auto flags = info->getFlags(); - if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_SEPARATOR) != flags.end()) - { - info->setColor(color); - } + info->setColor(color); } } else { @@ -4774,6 +4766,13 @@ void MainWindow::on_modList_customContextMenuRequested(const QPoint &pos) menu.addSeparator(); + menu.addAction(tr("Select Color..."), this, SLOT(setColor_clicked())); + + if (info->getColor().isValid()) + menu.addAction(tr("Reset Color"), this, SLOT(resetColor_clicked())); + + menu.addSeparator(); + if (info->getNexusID() > 0 && Settings::instance().nexus().endorsementIntegration()) { switch (info->endorsedState()) { case ModInfo::ENDORSED_TRUE: { diff --git a/src/modlist.cpp b/src/modlist.cpp index fb3dde13..4afd2a25 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -404,7 +404,7 @@ QVariant ModList::data(const QModelIndex &modelIndex, int role) const } return QVariant(); } else if (role == Qt::ForegroundRole) { - if (modInfo->hasFlag(ModInfo::FLAG_SEPARATOR) && modInfo->getColor().isValid()) { + if (modInfo->hasFlag(ModInfo::FLAG_SEPARATOR) || (column == COL_NOTES) && modInfo->getColor().isValid()) { return ColorSettings::idealTextColor(modInfo->getColor()); } else if (column == COL_NAME) { int highlight = modInfo->getHighlight(); @@ -430,7 +430,9 @@ QVariant ModList::data(const QModelIndex &modelIndex, int role) const bool overwritten = m_Overwritten.find(modIndex) != m_Overwritten.end(); bool archiveOverwritten = m_ArchiveOverwritten.find(modIndex) != m_ArchiveOverwritten.end(); bool archiveLooseOverwritten = m_ArchiveLooseOverwritten.find(modIndex) != m_ArchiveLooseOverwritten.end(); - if (modInfo->getHighlight() & ModInfo::HIGHLIGHT_PLUGIN) { + if (column == COL_NOTES && modInfo->getColor().isValid()) { + return modInfo->getColor(); + } else if (modInfo->getHighlight() & ModInfo::HIGHLIGHT_PLUGIN) { return Settings::instance().colors().modlistContainsPlugin(); } else if (overwritten || archiveLooseOverwritten) { return Settings::instance().colors().modlistOverwritingLoose(); |
