mirror of
https://github.com/YACReader/yacreader
synced 2025-06-03 09:08:20 -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 "db_helper.h"
|
||||||
#include "qnaturalsorting.h"
|
#include "qnaturalsorting.h"
|
||||||
#include "yacreader_global_gui.h"
|
#include "yacreader_global_gui.h"
|
||||||
|
#include "theme.h"
|
||||||
|
|
||||||
#include "QsLog.h"
|
#include "QsLog.h"
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
#include <QFileIconProvider>
|
#include <QFileIconProvider>
|
||||||
QIcon finishedFolderIcon;
|
QIcon finishedFolderIcon;
|
||||||
void drawMacOSXFinishedFolderIcon()
|
void drawMacOSXFinishedFolderIcon()
|
||||||
@ -92,7 +93,6 @@ void drawMacOSXFinishedFolderIcon()
|
|||||||
}
|
}
|
||||||
finishedFolderIcon.addPixmap(pixSelectedOn, QIcon::Selected, QIcon::On);
|
finishedFolderIcon.addPixmap(pixSelectedOn, QIcon::Selected, QIcon::On);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ROOT 1
|
#define ROOT 1
|
||||||
|
|
||||||
@ -155,22 +155,23 @@ QVariant FolderModel::data(const QModelIndex &index, int role) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (role == Qt::DecorationRole) {
|
if (role == Qt::DecorationRole) {
|
||||||
#ifdef Q_OS_MAC
|
if (Theme::currentTheme().useNativeFolderIcons) {
|
||||||
if (item->data(FolderModel::Finished).toBool()) {
|
if (item->data(FolderModel::Finished).toBool()) {
|
||||||
if (finishedFolderIcon.isNull()) {
|
if (finishedFolderIcon.isNull()) {
|
||||||
drawMacOSXFinishedFolderIcon();
|
drawMacOSXFinishedFolderIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
return QVariant(finishedFolderIcon);
|
return QVariant(finishedFolderIcon);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return QVariant(QFileIconProvider().icon(QFileIconProvider::Folder));
|
||||||
|
}
|
||||||
} else {
|
} 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)
|
if (role == FolderModel::CompletedRole)
|
||||||
|
@ -20,6 +20,8 @@ public:
|
|||||||
|
|
||||||
t.itemLibrarySelectedStyleSheet = "color: white; background-color:#91c4f4; border-bottom:1px solid #91c4f4;";
|
t.itemLibrarySelectedStyleSheet = "color: white; background-color:#91c4f4; border-bottom:1px solid #91c4f4;";
|
||||||
t.itemLibraryNoSelectedStyleSheet = "background-color:transparent;";
|
t.itemLibraryNoSelectedStyleSheet = "background-color:transparent;";
|
||||||
|
|
||||||
|
t.useNativeFolderIcons = true;
|
||||||
} else {
|
} else {
|
||||||
t.isMacosNative = false;
|
t.isMacosNative = false;
|
||||||
|
|
||||||
@ -29,6 +31,8 @@ public:
|
|||||||
|
|
||||||
t.itemLibrarySelectedStyleSheet = "color: white; background-color:#2E2E2E; font-weight:bold;";
|
t.itemLibrarySelectedStyleSheet = "color: white; background-color:#2E2E2E; font-weight:bold;";
|
||||||
t.itemLibraryNoSelectedStyleSheet = "background-color:transparent; color:#DDDFDF;";
|
t.itemLibraryNoSelectedStyleSheet = "background-color:transparent; color:#DDDFDF;";
|
||||||
|
|
||||||
|
t.useNativeFolderIcons = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
@ -45,6 +49,9 @@ public:
|
|||||||
//library item
|
//library item
|
||||||
QString itemLibrarySelectedStyleSheet;
|
QString itemLibrarySelectedStyleSheet;
|
||||||
QString itemLibraryNoSelectedStyleSheet;
|
QString itemLibraryNoSelectedStyleSheet;
|
||||||
|
|
||||||
|
//tree folders
|
||||||
|
bool useNativeFolderIcons;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // THEME_H
|
#endif // THEME_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user