mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Control via themes when do we have to use native icons for folders.
This commit is contained in:
parent
4216717d07
commit
797d7aa723
@ -54,9 +54,10 @@
|
||||
#include "db_helper.h"
|
||||
#include "qnaturalsorting.h"
|
||||
#include "yacreader_global_gui.h"
|
||||
#include "theme.h"
|
||||
|
||||
#include "QsLog.h"
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#include <QFileIconProvider>
|
||||
QIcon finishedFolderIcon;
|
||||
void drawMacOSXFinishedFolderIcon()
|
||||
@ -92,7 +93,6 @@ void drawMacOSXFinishedFolderIcon()
|
||||
}
|
||||
finishedFolderIcon.addPixmap(pixSelectedOn, QIcon::Selected, QIcon::On);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define ROOT 1
|
||||
|
||||
@ -155,22 +155,23 @@ QVariant FolderModel::data(const QModelIndex &index, int role) const
|
||||
}
|
||||
|
||||
if (role == Qt::DecorationRole) {
|
||||
#ifdef Q_OS_MAC
|
||||
if (item->data(FolderModel::Finished).toBool()) {
|
||||
if (finishedFolderIcon.isNull()) {
|
||||
drawMacOSXFinishedFolderIcon();
|
||||
}
|
||||
if (Theme::currentTheme().useNativeFolderIcons) {
|
||||
if (item->data(FolderModel::Finished).toBool()) {
|
||||
if (finishedFolderIcon.isNull()) {
|
||||
drawMacOSXFinishedFolderIcon();
|
||||
}
|
||||
|
||||
return QVariant(finishedFolderIcon);
|
||||
return QVariant(finishedFolderIcon);
|
||||
}
|
||||
else {
|
||||
return QVariant(QFileIconProvider().icon(QFileIconProvider::Folder));
|
||||
}
|
||||
} else {
|
||||
return QVariant(QFileIconProvider().icon(QFileIconProvider::Folder));
|
||||
if (item->data(FolderModel::Finished).toBool())
|
||||
return QVariant(YACReader::noHighlightedIcon(":/images/sidebar/folder_finished.png"));
|
||||
else
|
||||
return QVariant(YACReader::noHighlightedIcon(":/images/sidebar/folder.png"));
|
||||
}
|
||||
#else
|
||||
if (item->data(FolderModel::Finished).toBool())
|
||||
return QVariant(YACReader::noHighlightedIcon(":/images/sidebar/folder_finished.png"));
|
||||
else
|
||||
return QVariant(YACReader::noHighlightedIcon(":/images/sidebar/folder.png"));
|
||||
#endif
|
||||
}
|
||||
|
||||
if (role == FolderModel::CompletedRole)
|
||||
|
@ -20,6 +20,8 @@ public:
|
||||
|
||||
t.itemLibrarySelectedStyleSheet = "color: white; background-color:#91c4f4; border-bottom:1px solid #91c4f4;";
|
||||
t.itemLibraryNoSelectedStyleSheet = "background-color:transparent;";
|
||||
|
||||
t.useNativeFolderIcons = true;
|
||||
} else {
|
||||
t.isMacosNative = false;
|
||||
|
||||
@ -29,6 +31,8 @@ public:
|
||||
|
||||
t.itemLibrarySelectedStyleSheet = "color: white; background-color:#2E2E2E; font-weight:bold;";
|
||||
t.itemLibraryNoSelectedStyleSheet = "background-color:transparent; color:#DDDFDF;";
|
||||
|
||||
t.useNativeFolderIcons = false;
|
||||
}
|
||||
|
||||
return t;
|
||||
@ -45,6 +49,9 @@ public:
|
||||
//library item
|
||||
QString itemLibrarySelectedStyleSheet;
|
||||
QString itemLibraryNoSelectedStyleSheet;
|
||||
|
||||
//tree folders
|
||||
bool useNativeFolderIcons;
|
||||
};
|
||||
|
||||
#endif // THEME_H
|
||||
|
Loading…
Reference in New Issue
Block a user