mirror of
https://github.com/YACReader/yacreader
synced 2026-03-02 19:00:04 -05:00
Add a theme factory to YACReaderLibrary and theme the comic vine dialog
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
#include "scraper_results_paginator.h"
|
||||
#include "response_parser.h"
|
||||
#include "theme_manager.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
@ -10,27 +11,14 @@ ScraperResultsPaginator::ScraperResultsPaginator(QWidget *parent)
|
||||
{
|
||||
auto pagesButtonsLayout = new QHBoxLayout;
|
||||
|
||||
QString labelStylesheet = "QLabel {color:white; font-size:12px;font-family:Arial;}";
|
||||
|
||||
nextPage = new QToolButton;
|
||||
nextPage->setStyleSheet("QToolButton {border:none;}");
|
||||
QPixmap np(":/images/comic_vine/nextPage.png");
|
||||
nextPage->setIconSize(np.size());
|
||||
nextPage->setIcon(np);
|
||||
|
||||
previousPage = new QToolButton;
|
||||
previousPage->setStyleSheet("QToolButton {border:none;}");
|
||||
QPixmap pp(":/images/comic_vine/previousPage.png");
|
||||
previousPage->setIconSize(pp.size());
|
||||
previousPage->setIcon(pp);
|
||||
|
||||
connect(nextPage, &QAbstractButton::clicked, this, &ScraperResultsPaginator::loadNextPage);
|
||||
connect(previousPage, &QAbstractButton::clicked, this, &ScraperResultsPaginator::loadPreviousPage);
|
||||
|
||||
numElements = new QLabel(tr("Number of volumes found : %1"));
|
||||
numElements->setStyleSheet(labelStylesheet);
|
||||
numPages = new QLabel(tr("page %1 of %2"));
|
||||
numPages->setStyleSheet(labelStylesheet);
|
||||
|
||||
pagesButtonsLayout->addSpacing(15);
|
||||
pagesButtonsLayout->addWidget(numElements);
|
||||
@ -43,6 +31,8 @@ ScraperResultsPaginator::ScraperResultsPaginator(QWidget *parent)
|
||||
pagesButtonsLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
setLayout(pagesButtonsLayout);
|
||||
|
||||
initTheme(this);
|
||||
}
|
||||
|
||||
void ScraperResultsPaginator::update(const QString &json)
|
||||
@ -71,3 +61,19 @@ void ScraperResultsPaginator::setCustomLabel(const QString &label)
|
||||
{
|
||||
customLabel = label;
|
||||
}
|
||||
|
||||
void ScraperResultsPaginator::applyTheme()
|
||||
{
|
||||
auto comicVineTheme = ThemeManager::instance().getCurrentTheme().comicVine;
|
||||
|
||||
numElements->setStyleSheet(comicVineTheme.defaultLabelQSS);
|
||||
numPages->setStyleSheet(comicVineTheme.defaultLabelQSS);
|
||||
|
||||
nextPage->setStyleSheet(comicVineTheme.noBorderToolButtonQSS);
|
||||
nextPage->setIconSize(comicVineTheme.nextPageIcon.size);
|
||||
nextPage->setIcon(comicVineTheme.nextPageIcon.icon);
|
||||
|
||||
previousPage->setStyleSheet(comicVineTheme.noBorderToolButtonQSS);
|
||||
previousPage->setIconSize(comicVineTheme.previousPageIcon.size);
|
||||
previousPage->setIcon(comicVineTheme.previousPageIcon.icon);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user