mirror of
https://github.com/YACReader/yacreader
synced 2026-04-12 15:49:53 -04:00
Provide more meaningful theme colors to deal with not completed and recent states
This commit is contained in:
@ -151,7 +151,8 @@
|
|||||||
"folderIconSelectedColor": "#e0e0e0",
|
"folderIconSelectedColor": "#e0e0e0",
|
||||||
"folderIconSelectedShadowColor": "#000000",
|
"folderIconSelectedShadowColor": "#000000",
|
||||||
"folderIconShadowColor": "#000000",
|
"folderIconShadowColor": "#000000",
|
||||||
"folderIndicatorColor": "#edc518",
|
"newItemColor": "#edc518",
|
||||||
|
"folderNotCompletedColor": "#edc518",
|
||||||
"folderReadOverlayColor": "#464646",
|
"folderReadOverlayColor": "#464646",
|
||||||
"folderReadOverlaySelectedColor": "#464646",
|
"folderReadOverlaySelectedColor": "#464646",
|
||||||
"scrollBackgroundColor": "#404040",
|
"scrollBackgroundColor": "#404040",
|
||||||
|
|||||||
@ -151,7 +151,8 @@
|
|||||||
"folderIconSelectedColor": "#e0e0e0",
|
"folderIconSelectedColor": "#e0e0e0",
|
||||||
"folderIconSelectedShadowColor": "#000000",
|
"folderIconSelectedShadowColor": "#000000",
|
||||||
"folderIconShadowColor": "#000000",
|
"folderIconShadowColor": "#000000",
|
||||||
"folderIndicatorColor": "#edc518",
|
"newItemColor": "#edc518",
|
||||||
|
"folderNotCompletedColor": "#edc518",
|
||||||
"folderReadOverlayColor": "#222222",
|
"folderReadOverlayColor": "#222222",
|
||||||
"folderReadOverlaySelectedColor": "#222222",
|
"folderReadOverlaySelectedColor": "#222222",
|
||||||
"scrollBackgroundColor": "#404040",
|
"scrollBackgroundColor": "#404040",
|
||||||
|
|||||||
@ -151,7 +151,8 @@
|
|||||||
"folderIconSelectedColor": "#ffffff",
|
"folderIconSelectedColor": "#ffffff",
|
||||||
"folderIconSelectedShadowColor": "#161616",
|
"folderIconSelectedShadowColor": "#161616",
|
||||||
"folderIconShadowColor": "#ffffff",
|
"folderIconShadowColor": "#ffffff",
|
||||||
"folderIndicatorColor": "#555f7f",
|
"newItemColor": "#555f7f",
|
||||||
|
"folderNotCompletedColor": "#555f7f",
|
||||||
"folderReadOverlayColor": "#ffffff",
|
"folderReadOverlayColor": "#ffffff",
|
||||||
"folderReadOverlaySelectedColor": "#161616",
|
"folderReadOverlaySelectedColor": "#161616",
|
||||||
"scrollBackgroundColor": "#e0e0e0",
|
"scrollBackgroundColor": "#e0e0e0",
|
||||||
|
|||||||
@ -195,7 +195,8 @@ struct NavigationTreeThemeTemplates {
|
|||||||
|
|
||||||
struct NavigationTreeTheme {
|
struct NavigationTreeTheme {
|
||||||
QString navigationTreeQSS;
|
QString navigationTreeQSS;
|
||||||
QColor folderIndicatorColor; // For incomplete folders and recently updated folders
|
QColor folderNotCompletedColor; // Left-edge bar for folders not yet fully read
|
||||||
|
QColor newItemColor; // Dot for recently added/updated folders
|
||||||
|
|
||||||
// Branch indicator icon paths (used by QSS url())
|
// Branch indicator icon paths (used by QSS url())
|
||||||
QString branchClosedIconPath;
|
QString branchClosedIconPath;
|
||||||
|
|||||||
@ -101,7 +101,8 @@ struct NavigationTreeParams {
|
|||||||
QColor scrollBackgroundColor;
|
QColor scrollBackgroundColor;
|
||||||
QColor scrollHandleColor;
|
QColor scrollHandleColor;
|
||||||
QColor selectedTextColor;
|
QColor selectedTextColor;
|
||||||
QColor folderIndicatorColor;
|
QColor folderNotCompletedColor;
|
||||||
|
QColor newItemColor;
|
||||||
|
|
||||||
// Branch indicator icon colors (independent of sidebarIcons.iconColor)
|
// Branch indicator icon colors (independent of sidebarIcons.iconColor)
|
||||||
QColor branchIndicatorColor;
|
QColor branchIndicatorColor;
|
||||||
@ -657,7 +658,8 @@ Theme makeTheme(const ThemeParams ¶ms)
|
|||||||
theme.navigationTree.branchOpenIconPath,
|
theme.navigationTree.branchOpenIconPath,
|
||||||
theme.navigationTree.branchClosedIconSelectedPath,
|
theme.navigationTree.branchClosedIconSelectedPath,
|
||||||
theme.navigationTree.branchOpenIconSelectedPath);
|
theme.navigationTree.branchOpenIconSelectedPath);
|
||||||
theme.navigationTree.folderIndicatorColor = nt.folderIndicatorColor;
|
theme.navigationTree.folderNotCompletedColor = nt.folderNotCompletedColor;
|
||||||
|
theme.navigationTree.newItemColor = nt.newItemColor;
|
||||||
|
|
||||||
// Folder icon — normal and selected states with independent colors
|
// Folder icon — normal and selected states with independent colors
|
||||||
{
|
{
|
||||||
@ -1032,7 +1034,8 @@ Theme makeTheme(const QJsonObject &json)
|
|||||||
nt.scrollBackgroundColor = colorFromJson(o, "scrollBackgroundColor", nt.scrollBackgroundColor);
|
nt.scrollBackgroundColor = colorFromJson(o, "scrollBackgroundColor", nt.scrollBackgroundColor);
|
||||||
nt.scrollHandleColor = colorFromJson(o, "scrollHandleColor", nt.scrollHandleColor);
|
nt.scrollHandleColor = colorFromJson(o, "scrollHandleColor", nt.scrollHandleColor);
|
||||||
nt.selectedTextColor = colorFromJson(o, "selectedTextColor", nt.selectedTextColor);
|
nt.selectedTextColor = colorFromJson(o, "selectedTextColor", nt.selectedTextColor);
|
||||||
nt.folderIndicatorColor = colorFromJson(o, "folderIndicatorColor", nt.folderIndicatorColor);
|
nt.folderNotCompletedColor = colorFromJson(o, "folderNotCompletedColor", nt.folderNotCompletedColor);
|
||||||
|
nt.newItemColor = colorFromJson(o, "newItemColor", nt.newItemColor);
|
||||||
nt.branchIndicatorColor = colorFromJson(o, "branchIndicatorColor", nt.branchIndicatorColor);
|
nt.branchIndicatorColor = colorFromJson(o, "branchIndicatorColor", nt.branchIndicatorColor);
|
||||||
nt.branchIndicatorSelectedColor = colorFromJson(o, "branchIndicatorSelectedColor", nt.branchIndicatorSelectedColor);
|
nt.branchIndicatorSelectedColor = colorFromJson(o, "branchIndicatorSelectedColor", nt.branchIndicatorSelectedColor);
|
||||||
nt.folderIconColor = colorFromJson(o, "folderIconColor", nt.folderIconColor);
|
nt.folderIconColor = colorFromJson(o, "folderIconColor", nt.folderIconColor);
|
||||||
|
|||||||
@ -87,15 +87,18 @@ void YACReaderFoldersViewItemDeletegate::paint(QPainter *painter, const QStyleOp
|
|||||||
if (opt.state & QStyle::State_MouseOver)
|
if (opt.state & QStyle::State_MouseOver)
|
||||||
opt.state |= QStyle::State_Selected;
|
opt.state |= QStyle::State_Selected;
|
||||||
|
|
||||||
// Get indicator color from parent tree view
|
// Get indicator colors from the theme via the owning view
|
||||||
QColor indicatorColor(237, 197, 24); // Default fallback
|
QColor notCompletedColor(237, 197, 24); // Default fallback
|
||||||
if (auto treeView = qobject_cast<YACReaderTreeView *>(parent())) {
|
QColor newItemDotColor(237, 197, 24); // Default fallback
|
||||||
indicatorColor = treeView->folderIndicatorColor();
|
if (auto foldersView = qobject_cast<YACReaderFoldersView *>(parent())) {
|
||||||
|
const auto &nt = foldersView->navigationTreeTheme();
|
||||||
|
notCompletedColor = nt.folderNotCompletedColor;
|
||||||
|
newItemDotColor = nt.newItemColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!index.data(FolderModel::CompletedRole).toBool()) {
|
if (!index.data(FolderModel::CompletedRole).toBool()) {
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->setBrush(QBrush(indicatorColor));
|
painter->setBrush(QBrush(notCompletedColor));
|
||||||
painter->setPen(QPen(QBrush(), 0));
|
painter->setPen(QPen(QBrush(), 0));
|
||||||
painter->drawRect(0, opt.rect.y(), 2, opt.rect.height());
|
painter->drawRect(0, opt.rect.y(), 2, opt.rect.height());
|
||||||
painter->restore();
|
painter->restore();
|
||||||
@ -114,7 +117,7 @@ void YACReaderFoldersViewItemDeletegate::paint(QPainter *painter, const QStyleOp
|
|||||||
if (now - added < daysInSeconds || now - updated < daysInSeconds) {
|
if (now - added < daysInSeconds || now - updated < daysInSeconds) {
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->setRenderHint(QPainter::Antialiasing);
|
painter->setRenderHint(QPainter::Antialiasing);
|
||||||
painter->setBrush(QBrush(indicatorColor));
|
painter->setBrush(QBrush(newItemDotColor));
|
||||||
painter->setPen(QPen(QBrush(), 0));
|
painter->setPen(QPen(QBrush(), 0));
|
||||||
painter->drawEllipse(opt.rect.x() + 13, opt.rect.y() + 2, 7, 7);
|
painter->drawEllipse(opt.rect.x() + 13, opt.rect.y() + 2, 7, 7);
|
||||||
painter->restore();
|
painter->restore();
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
#define YACREADER_FOLDERS_VIEW_H
|
#define YACREADER_FOLDERS_VIEW_H
|
||||||
|
|
||||||
#include "yacreader_treeview.h"
|
#include "yacreader_treeview.h"
|
||||||
|
#include "theme.h"
|
||||||
|
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
|
|
||||||
@ -10,6 +11,7 @@ class YACReaderFoldersView : public YACReaderTreeView
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit YACReaderFoldersView(QWidget *parent = nullptr);
|
explicit YACReaderFoldersView(QWidget *parent = nullptr);
|
||||||
|
const NavigationTreeTheme &navigationTreeTheme() const { return theme.navigationTree; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
// Drops
|
// Drops
|
||||||
|
|||||||
@ -10,7 +10,6 @@ class YACReaderTreeView : public QTreeView, protected Themable
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit YACReaderTreeView(QWidget *parent = 0);
|
explicit YACReaderTreeView(QWidget *parent = 0);
|
||||||
QColor folderIndicatorColor() const { return theme.navigationTree.folderIndicatorColor; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void mousePressEvent(QMouseEvent *event) override;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user