Add a theme factory to YACReaderLibrary and theme the comic vine dialog

This commit is contained in:
luisangelsm
2026-01-14 19:58:43 +01:00
parent 1cb2f50057
commit 1bd4926b25
30 changed files with 740 additions and 178 deletions

View File

@ -27,6 +27,8 @@
#include "db_helper.h"
#include "response_parser.h"
#include "theme_manager.h"
#include "QsLog.h"
ComicVineDialog::ComicVineDialog(QWidget *parent)
@ -38,6 +40,8 @@ ComicVineDialog::ComicVineDialog(QWidget *parent)
doLayout();
doStackedWidgets();
doConnections();
initTheme(this);
}
void ComicVineDialog::closeEvent(QCloseEvent *event)
@ -49,12 +53,6 @@ void ComicVineDialog::closeEvent(QCloseEvent *event)
void ComicVineDialog::doLayout()
{
setStyleSheet(""
"QDialog {background-color: #404040; }"
"");
QString dialogButtonsStyleSheet = "QPushButton {border: 1px solid #242424; background: #2e2e2e; color:white; padding: 5px 26px 5px 26px; font-size:12px;font-family:Arial; font-weight:bold;}";
skipButton = new QPushButton(tr("skip"));
backButton = new QPushButton(tr("back"));
nextButton = new QPushButton(tr("next"));
@ -66,12 +64,6 @@ void ComicVineDialog::doLayout()
closeButton->setDefault(false);
closeButton->setAutoDefault(false);
skipButton->setStyleSheet(dialogButtonsStyleSheet);
backButton->setStyleSheet(dialogButtonsStyleSheet);
nextButton->setStyleSheet(dialogButtonsStyleSheet);
searchButton->setStyleSheet(dialogButtonsStyleSheet);
closeButton->setStyleSheet(dialogButtonsStyleSheet);
content = new QStackedWidget(this);
auto mainLayout = new QVBoxLayout;
@ -274,13 +266,11 @@ void ComicVineDialog::doLoading()
QWidget *w = new QWidget;
auto l = new QVBoxLayout;
auto bw = new YACReaderBusyWidget;
busyWidget = new YACReaderBusyWidget;
loadingMessage = new QLabel;
loadingMessage->setStyleSheet("QLabel {color:white; font-size:12px;font-family:Arial;}");
l->addStretch();
l->addWidget(bw, 0, Qt::AlignHCenter);
l->addWidget(busyWidget, 0, Qt::AlignHCenter);
l->addStretch();
l->addWidget(loadingMessage);
@ -666,3 +656,19 @@ void ComicVineDialog::launchSearchComic()
// if(comicInfo.isEmpty() && comicNumber == -1)
searchVolume({ volumeInfo, 1, exactMatch });
}
void ComicVineDialog::applyTheme()
{
auto comicVineTheme = ThemeManager::instance().getCurrentTheme().comicVine;
setStyleSheet(comicVineTheme.dialogQSS);
skipButton->setStyleSheet(comicVineTheme.dialogButtonsQSS);
backButton->setStyleSheet(comicVineTheme.dialogButtonsQSS);
nextButton->setStyleSheet(comicVineTheme.dialogButtonsQSS);
searchButton->setStyleSheet(comicVineTheme.dialogButtonsQSS);
closeButton->setStyleSheet(comicVineTheme.dialogButtonsQSS);
loadingMessage->setStyleSheet(comicVineTheme.defaultLabelQSS);
busyWidget->setColor(comicVineTheme.busyIndicatorColor);
}