mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-09 13:13:34 +00:00
Make the launcher dara directory and bsa list play nicer with dark
themes. Known issue: the padding icon for disabled data directories is of wrong color.
This commit is contained in:
parent
2061a0b66e
commit
bab5e56768
@ -247,16 +247,7 @@ void Launcher::DataFilesPage::populateFileViews(const QString& contentModelName)
|
|||||||
// add new achives files presents in current directory
|
// add new achives files presents in current directory
|
||||||
addArchivesFromDir(currentDir);
|
addArchivesFromDir(currentDir);
|
||||||
|
|
||||||
// Display new content with green background
|
|
||||||
QColor background;
|
|
||||||
QString tooltip;
|
QString tooltip;
|
||||||
if (mNewDataDirs.contains(currentDir))
|
|
||||||
{
|
|
||||||
tooltip += "Will be added to the current profile\n";
|
|
||||||
background = Qt::green;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
background = Qt::white;
|
|
||||||
|
|
||||||
// add content files presents in current directory
|
// add content files presents in current directory
|
||||||
mSelector->addFiles(currentDir, mNewDataDirs.contains(currentDir));
|
mSelector->addFiles(currentDir, mNewDataDirs.contains(currentDir));
|
||||||
@ -265,7 +256,14 @@ void Launcher::DataFilesPage::populateFileViews(const QString& contentModelName)
|
|||||||
ui.directoryListWidget->addItem(currentDir);
|
ui.directoryListWidget->addItem(currentDir);
|
||||||
auto row = ui.directoryListWidget->count() - 1;
|
auto row = ui.directoryListWidget->count() - 1;
|
||||||
auto* item = ui.directoryListWidget->item(row);
|
auto* item = ui.directoryListWidget->item(row);
|
||||||
item->setBackground(background);
|
|
||||||
|
// Display new content with green background
|
||||||
|
if (mNewDataDirs.contains(currentDir))
|
||||||
|
{
|
||||||
|
tooltip += "Will be added to the current profile\n";
|
||||||
|
item->setBackground(Qt::green);
|
||||||
|
item->setForeground(Qt::black);
|
||||||
|
}
|
||||||
|
|
||||||
// deactivate data-local and global data directory: they are always included
|
// deactivate data-local and global data directory: they are always included
|
||||||
if (currentDir == mDataLocal || currentDir == globalDataDir)
|
if (currentDir == mDataLocal || currentDir == globalDataDir)
|
||||||
@ -284,7 +282,7 @@ void Launcher::DataFilesPage::populateFileViews(const QString& contentModelName)
|
|||||||
{
|
{
|
||||||
// Pad to correct vertical alignment
|
// Pad to correct vertical alignment
|
||||||
QPixmap pixmap(QSize(200, 200)); // Arbitrary big number, will be scaled down to widget size
|
QPixmap pixmap(QSize(200, 200)); // Arbitrary big number, will be scaled down to widget size
|
||||||
pixmap.fill(background);
|
pixmap.fill(ui.directoryListWidget->palette().base().color());
|
||||||
auto emptyIcon = QIcon(pixmap);
|
auto emptyIcon = QIcon(pixmap);
|
||||||
item->setIcon(emptyIcon);
|
item->setIcon(emptyIcon);
|
||||||
}
|
}
|
||||||
@ -447,7 +445,6 @@ void Launcher::DataFilesPage::setProfile (const QString &previous, const QString
|
|||||||
{
|
{
|
||||||
auto* item = ui.archiveListWidget->item(i);
|
auto* item = ui.archiveListWidget->item(i);
|
||||||
mKnownArchives.push_back(item->text());
|
mKnownArchives.push_back(item->text());
|
||||||
item->setBackground(Qt::white);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
checkForDefaultProfile();
|
checkForDefaultProfile();
|
||||||
@ -704,7 +701,10 @@ void Launcher::DataFilesPage::addArchive(const QString& name, Qt::CheckState sel
|
|||||||
ui.archiveListWidget->insertItem(row, name);
|
ui.archiveListWidget->insertItem(row, name);
|
||||||
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);
|
ui.archiveListWidget->item(row)->setBackground(Qt::green);
|
||||||
|
ui.archiveListWidget->item(row)->setForeground(Qt::black);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Launcher::DataFilesPage::addArchivesFromDir(const QString& path)
|
void Launcher::DataFilesPage::addArchivesFromDir(const QString& path)
|
||||||
|
@ -169,6 +169,15 @@ QVariant ContentSelectorModel::ContentModel::data(const QModelIndex &index, int
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case Qt::ForegroundRole:
|
||||||
|
{
|
||||||
|
if (isNew(file->fileName()))
|
||||||
|
{
|
||||||
|
return QVariant(QColor(Qt::black));
|
||||||
|
}
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
case Qt::EditRole:
|
case Qt::EditRole:
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user