mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Use theme in the sidebar.
This commit is contained in:
parent
b91186a708
commit
cc73b27388
@ -49,6 +49,9 @@ public:
|
|||||||
|
|
||||||
"QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {background: none; }"
|
"QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {background: none; }"
|
||||||
"QScrollBar:horizontal{height:0px;}";
|
"QScrollBar:horizontal{height:0px;}";
|
||||||
|
|
||||||
|
t.sidebarBackgroundColor = "#F1F1F1";
|
||||||
|
t.sidebarSplitterStyle = "QSplitter::handle:vertical { height: 29px; background-color: transparent;}";
|
||||||
} else {
|
} else {
|
||||||
t.isMacosNative = false;
|
t.isMacosNative = false;
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
@ -85,6 +88,12 @@ public:
|
|||||||
|
|
||||||
"QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {background: none; }"
|
"QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {background: none; }"
|
||||||
"QScrollBar:horizontal{height:0px;}";
|
"QScrollBar:horizontal{height:0px;}";
|
||||||
|
|
||||||
|
t.sidebarBackgroundColor = "#454545";
|
||||||
|
t.sidebarSplitterStyle = "QSplitter::handle:vertical { height: 39px; background-color: transparent;}";/*"QSplitter::handle { "
|
||||||
|
" image: none; background-color = black; "
|
||||||
|
" }"
|
||||||
|
"QSplitter::handle:vertical { height: 39px;}"*/
|
||||||
}
|
}
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
@ -113,6 +122,10 @@ public:
|
|||||||
//EmptyFolderWidget
|
//EmptyFolderWidget
|
||||||
QString emptyFolderWidgetImage;
|
QString emptyFolderWidgetImage;
|
||||||
QString emptyFolderWidgetStyle;
|
QString emptyFolderWidgetStyle;
|
||||||
|
|
||||||
|
//Sidebar
|
||||||
|
QString sidebarBackgroundColor;
|
||||||
|
QString sidebarSplitterStyle;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // THEME_H
|
#endif // THEME_H
|
||||||
|
@ -23,27 +23,20 @@ YACReaderSideBar::YACReaderSideBar(QWidget *parent)
|
|||||||
readingListsView = new YACReaderReadingListsView;
|
readingListsView = new YACReaderReadingListsView;
|
||||||
selectedLibrary = new YACReaderLibraryListWidget;
|
selectedLibrary = new YACReaderLibraryListWidget;
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
if (theme.isMacosNative) {
|
||||||
librariesTitle = new YACReaderTitledToolBar(tr("Libraries"));
|
librariesTitle = new YACReaderTitledToolBar(tr("Libraries"));
|
||||||
foldersTitle = new YACReaderTitledToolBar(tr("Folders"));
|
foldersTitle = new YACReaderTitledToolBar(tr("Folders"));
|
||||||
readingListsTitle = new YACReaderTitledToolBar(tr("Reading Lists"));
|
readingListsTitle = new YACReaderTitledToolBar(tr("Reading Lists"));
|
||||||
#else
|
} else {
|
||||||
librariesTitle = new YACReaderTitledToolBar(tr("LIBRARIES"));
|
librariesTitle = new YACReaderTitledToolBar(tr("LIBRARIES"));
|
||||||
foldersTitle = new YACReaderTitledToolBar(tr("FOLDERS"));
|
foldersTitle = new YACReaderTitledToolBar(tr("FOLDERS"));
|
||||||
readingListsTitle = new YACReaderTitledToolBar(tr("READING LISTS"));
|
readingListsTitle = new YACReaderTitledToolBar(tr("READING LISTS"));
|
||||||
#endif
|
}
|
||||||
|
|
||||||
splitter = new QSplitter(this);
|
splitter = new QSplitter(this);
|
||||||
splitter->setOrientation(Qt::Vertical);
|
splitter->setOrientation(Qt::Vertical);
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
splitter->setStyleSheet(theme.sidebarSplitterStyle);
|
||||||
splitter->setStyleSheet("QSplitter::handle { "
|
|
||||||
" image: none; background-color = black; "
|
|
||||||
" }"
|
|
||||||
"QSplitter::handle:vertical { height: 39px;}");
|
|
||||||
#else
|
|
||||||
splitter->setStyleSheet("QSplitter::handle:vertical { height: 26px; background-color: transparent;}");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
selectedLibrary->setContextMenuPolicy(Qt::ActionsContextMenu);
|
selectedLibrary->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||||
selectedLibrary->setAttribute(Qt::WA_MacShowFocusRect, false);
|
selectedLibrary->setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||||
@ -55,24 +48,25 @@ YACReaderSideBar::YACReaderSideBar(QWidget *parent)
|
|||||||
l->setContentsMargins(0, 0, 0, 0);
|
l->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
//LIBRARIES-------------------------------------------------------
|
//LIBRARIES-------------------------------------------------------
|
||||||
#ifndef Q_OS_MAC
|
if (!theme.isMacosNative) {
|
||||||
l->addSpacing(5);
|
l->addSpacing(5);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
l->addWidget(librariesTitle);
|
l->addWidget(librariesTitle);
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
if (!theme.isMacosNative) {
|
||||||
l->addSpacing(4);
|
l->addSpacing(4);
|
||||||
l->addWidget(new YACReaderSideBarSeparator(this));
|
l->addWidget(new YACReaderSideBarSeparator(this));
|
||||||
l->addSpacing(3);
|
l->addSpacing(3);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
l->addWidget(selectedLibrary);
|
l->addWidget(selectedLibrary);
|
||||||
#ifndef Q_OS_MAC
|
|
||||||
l->addSpacing(11);
|
if (!theme.isMacosNative) {
|
||||||
#else
|
l->addSpacing(11);
|
||||||
l->addSpacing(6);
|
} else {
|
||||||
#endif
|
l->addSpacing(6);
|
||||||
|
}
|
||||||
|
|
||||||
//END LIBRARIES---------------------------------------------------
|
//END LIBRARIES---------------------------------------------------
|
||||||
|
|
||||||
@ -82,23 +76,18 @@ YACReaderSideBar::YACReaderSideBar(QWidget *parent)
|
|||||||
foldersLayout->setContentsMargins(0, 0, 0, 0);
|
foldersLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
foldersLayout->setSpacing(0);
|
foldersLayout->setSpacing(0);
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
if (!theme.isMacosNative) {
|
||||||
//foldersLayout->addSpacing(6);
|
foldersLayout->addWidget(new YACReaderSideBarSeparator(this));
|
||||||
|
foldersLayout->addSpacing(4);
|
||||||
//foldersLayout->addSpacing(5);
|
}
|
||||||
foldersLayout->addWidget(new YACReaderSideBarSeparator(this));
|
|
||||||
foldersLayout->addSpacing(4);
|
|
||||||
#else
|
|
||||||
//foldersLayout->addSpacing(6);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
foldersLayout->addWidget(foldersTitle);
|
foldersLayout->addWidget(foldersTitle);
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
if (!theme.isMacosNative) {
|
||||||
foldersLayout->addSpacing(4);
|
foldersLayout->addSpacing(4);
|
||||||
foldersLayout->addWidget(new YACReaderSideBarSeparator(this));
|
foldersLayout->addWidget(new YACReaderSideBarSeparator(this));
|
||||||
foldersLayout->addSpacing(4);
|
foldersLayout->addSpacing(4);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
foldersLayout->addWidget(foldersView);
|
foldersLayout->addWidget(foldersView);
|
||||||
foldersLayout->addSpacing(6);
|
foldersLayout->addSpacing(6);
|
||||||
@ -114,23 +103,18 @@ YACReaderSideBar::YACReaderSideBar(QWidget *parent)
|
|||||||
readingListsHeaderLayout->setContentsMargins(0, 0, 0, 0);
|
readingListsHeaderLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
readingListsHeaderLayout->setSpacing(0);
|
readingListsHeaderLayout->setSpacing(0);
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
if (!theme.isMacosNative) {
|
||||||
//readingListsHeaderLayout->addSpacing(6);
|
readingListsHeaderLayout->addWidget(new YACReaderSideBarSeparator(this));
|
||||||
|
readingListsHeaderLayout->addSpacing(4);
|
||||||
//readingListsHeaderLayout->addSpacing(5);
|
}
|
||||||
readingListsHeaderLayout->addWidget(new YACReaderSideBarSeparator(this));
|
|
||||||
readingListsHeaderLayout->addSpacing(4);
|
|
||||||
#else
|
|
||||||
//readingListsHeaderLayout->addSpacing(6);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
readingListsHeaderLayout->addWidget(readingListsTitle);
|
readingListsHeaderLayout->addWidget(readingListsTitle);
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
if (!theme.isMacosNative) {
|
||||||
readingListsHeaderLayout->addSpacing(4);
|
readingListsHeaderLayout->addSpacing(4);
|
||||||
readingListsHeaderLayout->addWidget(new YACReaderSideBarSeparator(this));
|
readingListsHeaderLayout->addWidget(new YACReaderSideBarSeparator(this));
|
||||||
readingListsHeaderLayout->addSpacing(4);
|
readingListsHeaderLayout->addSpacing(4);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
//readingListsLayout->addWidget(readingListsView);
|
//readingListsLayout->addWidget(readingListsView);
|
||||||
readingListsHeaderLayout->addStretch();
|
readingListsHeaderLayout->addStretch();
|
||||||
@ -152,24 +136,9 @@ void YACReaderSideBar::paintEvent(QPaintEvent *event)
|
|||||||
{
|
{
|
||||||
Q_UNUSED(event)
|
Q_UNUSED(event)
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
|
|
||||||
painter.fillRect(0, 0, width(), height(), QColor("#F1F1F1"));
|
painter.fillRect(0, 0, width(), height(), QColor(theme.sidebarBackgroundColor));
|
||||||
#else
|
|
||||||
QPainter painter(this);
|
|
||||||
|
|
||||||
painter.fillRect(0, 0, width(), height(), QColor("#454545"));
|
|
||||||
//QWidget::paintEvent(event);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//QPixmap shadow(":/images/side_bar/shadow.png");
|
|
||||||
//painter.drawPixmap(width()-shadow.width(),0,shadow.width(),height(),shadow);
|
|
||||||
|
|
||||||
// painter.setRenderHint(QPainter::Antialiasing);
|
|
||||||
// painter.drawLine(rect().topLeft(), rect().bottomRight());
|
|
||||||
|
|
||||||
//QWidget::paintEvent(event);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void YACReaderSideBar::closeEvent(QCloseEvent *event)
|
void YACReaderSideBar::closeEvent(QCloseEvent *event)
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
|
|
||||||
|
#include "theme.h"
|
||||||
|
|
||||||
class YACReaderFoldersView;
|
class YACReaderFoldersView;
|
||||||
class YACReaderLibraryListWidget;
|
class YACReaderLibraryListWidget;
|
||||||
class YACReaderSearchLineEdit;
|
class YACReaderSearchLineEdit;
|
||||||
@ -13,7 +15,7 @@ class YACReaderReadingListsView;
|
|||||||
class YACReaderSideBarSeparator : public QWidget
|
class YACReaderSideBarSeparator : public QWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit YACReaderSideBarSeparator(QWidget *parent = 0);
|
explicit YACReaderSideBarSeparator(QWidget *parent = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event);
|
void paintEvent(QPaintEvent *event);
|
||||||
@ -23,7 +25,7 @@ class YACReaderSideBar : public QWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit YACReaderSideBar(QWidget *parent = 0);
|
explicit YACReaderSideBar(QWidget *parent = nullptr);
|
||||||
QSize sizeHint() const;
|
QSize sizeHint() const;
|
||||||
|
|
||||||
YACReaderFoldersView *foldersView;
|
YACReaderFoldersView *foldersView;
|
||||||
@ -39,9 +41,10 @@ public slots:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *);
|
void paintEvent(QPaintEvent *);
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent ( QCloseEvent * event );
|
||||||
QSettings *settings;
|
QSettings *settings;
|
||||||
QSplitter *splitter;
|
QSplitter *splitter;
|
||||||
|
Theme theme = Theme::currentTheme();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // YACREADER_SIDEBAR_H
|
#endif // YACREADER_SIDEBAR_H
|
||||||
|
Loading…
Reference in New Issue
Block a user