Merge branch 'highlight_color' into 'master'

Highlight new items in launcher by text formatting, not by color

See merge request OpenMW/openmw!3625
macos_ci_fix
Alexei Kotov 1 year ago
commit 53f5e4dd3c

@ -301,12 +301,14 @@ void Launcher::DataFilesPage::populateFileViews(const QString& contentModelName)
auto row = ui.directoryListWidget->count() - 1; auto row = ui.directoryListWidget->count() - 1;
auto* item = ui.directoryListWidget->item(row); auto* item = ui.directoryListWidget->item(row);
// Display new content with green background // Display new content with custom formatting
if (mNewDataDirs.contains(canonicalDirPath)) if (mNewDataDirs.contains(canonicalDirPath))
{ {
tooltip += "Will be added to the current profile\n"; tooltip += "Will be added to the current profile\n";
item->setBackground(Qt::green); QFont font = item->font();
item->setForeground(Qt::black); font.setBold(true);
font.setItalic(true);
item->setFont(font);
} }
// deactivate data-local and global data directory: they are always included // deactivate data-local and global data directory: they are always included
@ -737,8 +739,11 @@ void Launcher::DataFilesPage::addArchive(const QString& name, Qt::CheckState sel
ui.archiveListWidget->item(row)->setCheckState(selected); ui.archiveListWidget->item(row)->setCheckState(selected);
if (mKnownArchives.filter(name).isEmpty()) // XXX why contains doesn't work here ??? if (mKnownArchives.filter(name).isEmpty()) // XXX why contains doesn't work here ???
{ {
ui.archiveListWidget->item(row)->setBackground(Qt::green); auto item = ui.archiveListWidget->item(row);
ui.archiveListWidget->item(row)->setForeground(Qt::black); QFont font = item->font();
font.setBold(true);
font.setItalic(true);
item->setFont(font);
} }
} }

@ -7,6 +7,7 @@
#include <QDebug> #include <QDebug>
#include <QDir> #include <QDir>
#include <QFont>
#include <components/esm/format.hpp> #include <components/esm/format.hpp>
#include <components/esm3/esmreader.hpp> #include <components/esm3/esmreader.hpp>
@ -164,20 +165,14 @@ QVariant ContentSelectorModel::ContentModel::data(const QModelIndex& index, int
return isLoadOrderError(file) ? mWarningIcon : QVariant(); return isLoadOrderError(file) ? mWarningIcon : QVariant();
} }
case Qt::BackgroundRole: case Qt::FontRole:
{ {
if (isNew(file->fileName())) if (isNew(file->fileName()))
{ {
return QVariant(QColor(Qt::green)); auto font = QFont();
} font.setBold(true);
return QVariant(); font.setItalic(true);
} return font;
case Qt::ForegroundRole:
{
if (isNew(file->fileName()))
{
return QVariant(QColor(Qt::black));
} }
return QVariant(); return QVariant();
} }

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>571</width> <width>573</width>
<height>384</height> <height>384</height>
</rect> </rect>
</property> </property>
@ -30,7 +30,7 @@
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="dataNoteLabel"> <widget class="QLabel" name="dataNoteLabel">
<property name="text"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;note: content files that are not part of current Content List are &lt;/span&gt;&lt;span style=&quot; font-style:italic; background-color:#00ff00;&quot;&gt;highlighted&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;note: content files that are not part of current Content List are &lt;span style=&quot; font-style:italic;font-weight: bold&quot;&gt;highlighted&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -57,7 +57,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;note: directories that are not part of current Content List are &lt;/span&gt;&lt;span style=&quot; font-style:italic; background-color:#00ff00;&quot;&gt;highlighted&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;note: directories that are not part of current Content List are &lt;span style=&quot; font-style:italic;font-weight: bold&quot;&gt;highlighted&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -210,7 +210,7 @@
<item row="27" column="0" colspan="2"> <item row="27" column="0" colspan="2">
<widget class="QLabel" name="archiveNoteLabel"> <widget class="QLabel" name="archiveNoteLabel">
<property name="text"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;note: archives that are not part of current Content List are &lt;/span&gt;&lt;span style=&quot; font-style:italic; background-color:#00ff00;&quot;&gt;highlighted&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;note: archives that are not part of current Content List are &lt;span style=&quot; font-style:italic;font-weight: bold&quot;&gt;highlighted&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>

Loading…
Cancel
Save