diff --git a/YACReader/main_window_viewer.cpp b/YACReader/main_window_viewer.cpp index 1c3e1981..a35b5246 100644 --- a/YACReader/main_window_viewer.cpp +++ b/YACReader/main_window_viewer.cpp @@ -18,7 +18,6 @@ #include "yacreader_global.h" #include "edit_shortcuts_dialog.h" #include "shortcuts_manager.h" -#include "theme_manager.h" #include "whats_new_controller.h" @@ -1556,9 +1555,9 @@ void MainWindowViewer::setLoadedComicActionsEnabled(bool enabled) a->setEnabled(enabled); } -void MainWindowViewer::applyTheme() +void MainWindowViewer::applyTheme(const Theme &theme) { - const auto toolbarTheme = ThemeManager::instance().getCurrentTheme().toolbar; + const auto toolbarTheme = theme.toolbar; if (comicToolBar) { comicToolBar->setStyleSheet(toolbarTheme.toolbarQSS); diff --git a/YACReader/main_window_viewer.h b/YACReader/main_window_viewer.h index ec6033b8..db24d2f5 100644 --- a/YACReader/main_window_viewer.h +++ b/YACReader/main_window_viewer.h @@ -174,7 +174,7 @@ private: void setMglassActionsEnabled(bool enabled); void setLoadedComicActionsEnabled(bool enabled); - void applyTheme() override; + void applyTheme(const Theme &theme) override; //! Manejadores de evento: // void resizeEvent(QResizeEvent * event); diff --git a/YACReader/page_label_widget.cpp b/YACReader/page_label_widget.cpp index afd60e9d..4a1e7cad 100644 --- a/YACReader/page_label_widget.cpp +++ b/YACReader/page_label_widget.cpp @@ -2,8 +2,6 @@ #include -#include "theme_manager.h" - PageLabelWidget::PageLabelWidget(QWidget *parent) : QWidget(parent) { @@ -111,9 +109,9 @@ void PageLabelWidget::updatePosition() move(QPoint((parent->geometry().size().width() - this->width()), -this->height())); } -void PageLabelWidget::applyTheme() +void PageLabelWidget::applyTheme(const Theme &theme) { - const auto viewerTheme = ThemeManager::instance().getCurrentTheme().viewer; + const auto viewerTheme = theme.viewer; infoBackgroundColor = viewerTheme.infoBackgroundColor; diff --git a/YACReader/page_label_widget.h b/YACReader/page_label_widget.h index f65cfd9c..1bec7c4e 100644 --- a/YACReader/page_label_widget.h +++ b/YACReader/page_label_widget.h @@ -19,7 +19,7 @@ private: protected: void paintEvent(QPaintEvent *) override; - void applyTheme() override; + void applyTheme(const Theme &theme) override; public: PageLabelWidget(QWidget *parent); diff --git a/YACReader/viewer.cpp b/YACReader/viewer.cpp index c4245827..fa7e1503 100644 --- a/YACReader/viewer.cpp +++ b/YACReader/viewer.cpp @@ -1019,11 +1019,11 @@ void Viewer::updateBackgroundColor(const QColor &color) setPalette(palette); } -void Viewer::applyTheme() +void Viewer::applyTheme(const Theme &theme) { - const auto viewerTheme = ThemeManager::instance().getCurrentTheme().viewer; + const auto viewerTheme = theme.viewer; - updateBackgroundColor(Configuration::getConfiguration().getBackgroundColor(ThemeManager::instance().getCurrentTheme().viewer.defaultBackgroundColor)); + updateBackgroundColor(Configuration::getConfiguration().getBackgroundColor(theme.viewer.defaultBackgroundColor)); const QString textColor = viewerTheme.defaultTextColor.name(QColor::HexArgb); content->setStyleSheet(QStringLiteral("QLabel { color : %1; background: transparent; }").arg(textColor)); diff --git a/YACReader/viewer.h b/YACReader/viewer.h index e7dbaa5a..0684e501 100644 --- a/YACReader/viewer.h +++ b/YACReader/viewer.h @@ -188,7 +188,7 @@ private: std::unique_ptr mouseHandler; protected: - void applyTheme() override; + void applyTheme(const Theme &theme) override; public: Viewer(QWidget *parent = nullptr); diff --git a/YACReaderLibrary/comic_vine/comic_vine_dialog.cpp b/YACReaderLibrary/comic_vine/comic_vine_dialog.cpp index d53b1e4c..2c172d1d 100644 --- a/YACReaderLibrary/comic_vine/comic_vine_dialog.cpp +++ b/YACReaderLibrary/comic_vine/comic_vine_dialog.cpp @@ -27,8 +27,6 @@ #include "db_helper.h" #include "response_parser.h" -#include "theme_manager.h" - #include "QsLog.h" ComicVineDialog::ComicVineDialog(QWidget *parent) @@ -657,9 +655,9 @@ void ComicVineDialog::launchSearchComic() searchVolume({ volumeInfo, 1, exactMatch }); } -void ComicVineDialog::applyTheme() +void ComicVineDialog::applyTheme(const Theme &theme) { - auto comicVineTheme = ThemeManager::instance().getCurrentTheme().comicVine; + auto comicVineTheme = theme.comicVine; setStyleSheet(comicVineTheme.dialogQSS); diff --git a/YACReaderLibrary/comic_vine/comic_vine_dialog.h b/YACReaderLibrary/comic_vine/comic_vine_dialog.h index b9626cd8..36468023 100644 --- a/YACReaderLibrary/comic_vine/comic_vine_dialog.h +++ b/YACReaderLibrary/comic_vine/comic_vine_dialog.h @@ -129,7 +129,7 @@ private: QString currentVolumeId; protected: - void applyTheme() override; + void applyTheme(const Theme &theme) override; }; #endif // COMIC_VINE_DIALOG_H diff --git a/YACReaderLibrary/comic_vine/scraper_checkbox.cpp b/YACReaderLibrary/comic_vine/scraper_checkbox.cpp index f7131d77..2aa78b9b 100644 --- a/YACReaderLibrary/comic_vine/scraper_checkbox.cpp +++ b/YACReaderLibrary/comic_vine/scraper_checkbox.cpp @@ -1,16 +1,14 @@ #include "scraper_checkbox.h" -#include "theme_manager.h" - ScraperCheckBox::ScraperCheckBox(const QString &text, QWidget *parent) : QCheckBox(text, parent) { initTheme(this); } -void ScraperCheckBox::applyTheme() +void ScraperCheckBox::applyTheme(const Theme &theme) { - auto comicVineTheme = ThemeManager::instance().getCurrentTheme().comicVine; + auto comicVineTheme = theme.comicVine; setStyleSheet(comicVineTheme.checkBoxQSS); } diff --git a/YACReaderLibrary/comic_vine/scraper_checkbox.h b/YACReaderLibrary/comic_vine/scraper_checkbox.h index ce2200c2..d2362650 100644 --- a/YACReaderLibrary/comic_vine/scraper_checkbox.h +++ b/YACReaderLibrary/comic_vine/scraper_checkbox.h @@ -11,7 +11,7 @@ public: ScraperCheckBox(const QString &text, QWidget *parent = nullptr); protected: - void applyTheme() override; + void applyTheme(const Theme &theme) override; }; #endif // SCRAPER_CHECKBOX_H diff --git a/YACReaderLibrary/comic_vine/scraper_lineedit.cpp b/YACReaderLibrary/comic_vine/scraper_lineedit.cpp index a5b2fc34..fb305c05 100644 --- a/YACReaderLibrary/comic_vine/scraper_lineedit.cpp +++ b/YACReaderLibrary/comic_vine/scraper_lineedit.cpp @@ -1,7 +1,5 @@ #include "scraper_lineedit.h" -#include "theme_manager.h" - #include ScraperLineEdit::ScraperLineEdit(const QString &title, QWidget *widget) @@ -20,9 +18,9 @@ void ScraperLineEdit::resizeEvent(QResizeEvent *) titleLabel->move(6, (rect().bottom() + 1 - szl.height()) / 2); } -void ScraperLineEdit::applyTheme() +void ScraperLineEdit::applyTheme(const Theme &theme) { - auto comicVineTheme = ThemeManager::instance().getCurrentTheme().comicVine; + auto comicVineTheme = theme.comicVine; titleLabel->setStyleSheet(comicVineTheme.scraperLineEditTitleLabelQSS); setStyleSheet(comicVineTheme.scraperLineEditQSS.arg(titleLabel->sizeHint().width() + 6)); diff --git a/YACReaderLibrary/comic_vine/scraper_lineedit.h b/YACReaderLibrary/comic_vine/scraper_lineedit.h index e7d41d43..977e4d0f 100644 --- a/YACReaderLibrary/comic_vine/scraper_lineedit.h +++ b/YACReaderLibrary/comic_vine/scraper_lineedit.h @@ -15,7 +15,7 @@ public: protected: void resizeEvent(QResizeEvent *) override; - void applyTheme() override; + void applyTheme(const Theme &theme) override; private: QLabel *titleLabel; diff --git a/YACReaderLibrary/comic_vine/scraper_results_paginator.cpp b/YACReaderLibrary/comic_vine/scraper_results_paginator.cpp index e2f56205..637b7fb9 100644 --- a/YACReaderLibrary/comic_vine/scraper_results_paginator.cpp +++ b/YACReaderLibrary/comic_vine/scraper_results_paginator.cpp @@ -1,6 +1,5 @@ #include "scraper_results_paginator.h" #include "response_parser.h" -#include "theme_manager.h" #include #include @@ -62,9 +61,9 @@ void ScraperResultsPaginator::setCustomLabel(const QString &label) customLabel = label; } -void ScraperResultsPaginator::applyTheme() +void ScraperResultsPaginator::applyTheme(const Theme &theme) { - auto comicVineTheme = ThemeManager::instance().getCurrentTheme().comicVine; + auto comicVineTheme = theme.comicVine; numElements->setStyleSheet(comicVineTheme.defaultLabelQSS); numPages->setStyleSheet(comicVineTheme.defaultLabelQSS); diff --git a/YACReaderLibrary/comic_vine/scraper_results_paginator.h b/YACReaderLibrary/comic_vine/scraper_results_paginator.h index d099e1af..873ece50 100644 --- a/YACReaderLibrary/comic_vine/scraper_results_paginator.h +++ b/YACReaderLibrary/comic_vine/scraper_results_paginator.h @@ -31,7 +31,7 @@ private: QString customLabel; protected: - void applyTheme() override; + void applyTheme(const Theme &theme) override; }; #endif // SCRAPER_RESULTS_PAGINATOR_H diff --git a/YACReaderLibrary/comic_vine/scraper_scroll_label.cpp b/YACReaderLibrary/comic_vine/scraper_scroll_label.cpp index 1fd4cdd3..314a7ac3 100644 --- a/YACReaderLibrary/comic_vine/scraper_scroll_label.cpp +++ b/YACReaderLibrary/comic_vine/scraper_scroll_label.cpp @@ -1,7 +1,5 @@ #include "scraper_scroll_label.h" -#include "theme_manager.h" - #include #include #include @@ -41,9 +39,9 @@ void ScraperScrollLabel::openLink(const QString &link) QDesktopServices::openUrl(QUrl("http://www.comicvine.com" + link)); } -void ScraperScrollLabel::applyTheme() +void ScraperScrollLabel::applyTheme(const Theme &theme) { - auto comicVineTheme = ThemeManager::instance().getCurrentTheme().comicVine; + auto comicVineTheme = theme.comicVine; textLabel->setStyleSheet(comicVineTheme.scraperScrollLabelTextQSS); setStyleSheet(comicVineTheme.scraperScrollLabelScrollAreaQSS); diff --git a/YACReaderLibrary/comic_vine/scraper_scroll_label.h b/YACReaderLibrary/comic_vine/scraper_scroll_label.h index 7c555d5c..f78da91a 100644 --- a/YACReaderLibrary/comic_vine/scraper_scroll_label.h +++ b/YACReaderLibrary/comic_vine/scraper_scroll_label.h @@ -23,7 +23,7 @@ private: QLabel *textLabel; protected: - void applyTheme() override; + void applyTheme(const Theme &theme) override; }; #endif // SCRAPER_SCROLL_LABEL_H diff --git a/YACReaderLibrary/comic_vine/scraper_tableview.cpp b/YACReaderLibrary/comic_vine/scraper_tableview.cpp index a9c50978..0fa134a8 100644 --- a/YACReaderLibrary/comic_vine/scraper_tableview.cpp +++ b/YACReaderLibrary/comic_vine/scraper_tableview.cpp @@ -1,7 +1,5 @@ #include "scraper_tableview.h" -#include "theme_manager.h" - #include ScraperTableView::ScraperTableView(QWidget *parent) @@ -44,9 +42,9 @@ ScraperTableView::ScraperTableView(QWidget *parent) initTheme(this); } -void ScraperTableView::applyTheme() +void ScraperTableView::applyTheme(const Theme &theme) { - auto comicVineTheme = ThemeManager::instance().getCurrentTheme().comicVine; + auto comicVineTheme = theme.comicVine; setStyleSheet(comicVineTheme.scraperTableViewQSS); } diff --git a/YACReaderLibrary/comic_vine/scraper_tableview.h b/YACReaderLibrary/comic_vine/scraper_tableview.h index 8061b8b8..98159dce 100644 --- a/YACReaderLibrary/comic_vine/scraper_tableview.h +++ b/YACReaderLibrary/comic_vine/scraper_tableview.h @@ -12,7 +12,7 @@ public: explicit ScraperTableView(QWidget *parent = nullptr); protected: - void applyTheme() override; + void applyTheme(const Theme &theme) override; }; #endif // SCRAPPER_TABLEVIEW_H diff --git a/YACReaderLibrary/comic_vine/search_single_comic.cpp b/YACReaderLibrary/comic_vine/search_single_comic.cpp index f9e44688..edf18782 100644 --- a/YACReaderLibrary/comic_vine/search_single_comic.cpp +++ b/YACReaderLibrary/comic_vine/search_single_comic.cpp @@ -1,7 +1,6 @@ #include "search_single_comic.h" #include "scraper_lineedit.h" -#include "theme_manager.h" #include #include @@ -73,9 +72,9 @@ void SearchSingleComic::clean() volumeEdit->clear(); } -void SearchSingleComic::applyTheme() +void SearchSingleComic::applyTheme(const Theme &theme) { - auto comicVineTheme = ThemeManager::instance().getCurrentTheme().comicVine; + auto comicVineTheme = theme.comicVine; label->setStyleSheet(comicVineTheme.defaultLabelQSS); } diff --git a/YACReaderLibrary/comic_vine/search_single_comic.h b/YACReaderLibrary/comic_vine/search_single_comic.h index 12195f77..e3a1bd16 100644 --- a/YACReaderLibrary/comic_vine/search_single_comic.h +++ b/YACReaderLibrary/comic_vine/search_single_comic.h @@ -29,6 +29,6 @@ private: QLabel *label; protected: - void applyTheme() override; + void applyTheme(const Theme &theme) override; }; #endif // SEARCH_SINGLE_COMIC_H diff --git a/YACReaderLibrary/comic_vine/search_volume.cpp b/YACReaderLibrary/comic_vine/search_volume.cpp index 29790686..e520f02c 100644 --- a/YACReaderLibrary/comic_vine/search_volume.cpp +++ b/YACReaderLibrary/comic_vine/search_volume.cpp @@ -2,7 +2,6 @@ #include "scraper_lineedit.h" #include "scraper_checkbox.h" -#include "theme_manager.h" #include #include @@ -48,9 +47,9 @@ QString SearchVolume::getVolumeInfo() const return volumeEdit->text(); } -void SearchVolume::applyTheme() +void SearchVolume::applyTheme(const Theme &theme) { - auto comicVineTheme = ThemeManager::instance().getCurrentTheme().comicVine; + auto comicVineTheme = theme.comicVine; label->setStyleSheet(comicVineTheme.defaultLabelQSS); } diff --git a/YACReaderLibrary/comic_vine/search_volume.h b/YACReaderLibrary/comic_vine/search_volume.h index 09ca6437..9d874273 100644 --- a/YACReaderLibrary/comic_vine/search_volume.h +++ b/YACReaderLibrary/comic_vine/search_volume.h @@ -24,7 +24,7 @@ private: QLabel *label; protected: - void applyTheme() override; + void applyTheme(const Theme &theme) override; }; #endif // SEARCH_VOLUME_H diff --git a/YACReaderLibrary/comic_vine/select_comic.cpp b/YACReaderLibrary/comic_vine/select_comic.cpp index 8c5a06a2..aa5eb668 100644 --- a/YACReaderLibrary/comic_vine/select_comic.cpp +++ b/YACReaderLibrary/comic_vine/select_comic.cpp @@ -4,7 +4,6 @@ #include "scraper_scroll_label.h" #include "scraper_tableview.h" #include "volume_comics_model.h" -#include "theme_manager.h" #include #include @@ -164,9 +163,9 @@ QString SelectComic::getSelectedComicId() return model->getComicId(tableComics->currentIndex()); } -void SelectComic::applyTheme() +void SelectComic::applyTheme(const Theme &theme) { - auto comicVineTheme = ThemeManager::instance().getCurrentTheme().comicVine; + auto comicVineTheme = theme.comicVine; label->setStyleSheet(comicVineTheme.defaultLabelQSS); cover->setStyleSheet(comicVineTheme.coverLabelQSS); diff --git a/YACReaderLibrary/comic_vine/select_comic.h b/YACReaderLibrary/comic_vine/select_comic.h index 4b1120c6..e6c7f3c8 100644 --- a/YACReaderLibrary/comic_vine/select_comic.h +++ b/YACReaderLibrary/comic_vine/select_comic.h @@ -44,7 +44,7 @@ private: ScraperResultsPaginator *paginator; protected: - void applyTheme() override; + void applyTheme(const Theme &theme) override; }; #endif // SELECT_COMIC_H diff --git a/YACReaderLibrary/comic_vine/select_volume.cpp b/YACReaderLibrary/comic_vine/select_volume.cpp index 9a190d65..2ed1656d 100644 --- a/YACReaderLibrary/comic_vine/select_volume.cpp +++ b/YACReaderLibrary/comic_vine/select_volume.cpp @@ -25,7 +25,6 @@ #include "scraper_results_paginator.h" #include "selected_volume_info.h" -#include "theme_manager.h" SelectVolume::SelectVolume(QWidget *parent) : QWidget(parent), model(0) @@ -218,9 +217,9 @@ SelectedVolumeInfo SelectVolume::getSelectedVolumeInfo() return { volumeId, numIssues, publisher, selectedVolumeDescription }; } -void SelectVolume::applyTheme() +void SelectVolume::applyTheme(const Theme &theme) { - auto comicVineTheme = ThemeManager::instance().getCurrentTheme().comicVine; + auto comicVineTheme = theme.comicVine; label->setStyleSheet(comicVineTheme.defaultLabelQSS); cover->setStyleSheet(comicVineTheme.coverLabelQSS); diff --git a/YACReaderLibrary/comic_vine/select_volume.h b/YACReaderLibrary/comic_vine/select_volume.h index f4e06d1b..be50d2bb 100644 --- a/YACReaderLibrary/comic_vine/select_volume.h +++ b/YACReaderLibrary/comic_vine/select_volume.h @@ -53,7 +53,7 @@ private: ScraperResultsPaginator *paginator; protected: - void applyTheme() override; + void applyTheme(const Theme &theme) override; }; #endif // SELECT_VOLUME_H diff --git a/YACReaderLibrary/comic_vine/series_question.cpp b/YACReaderLibrary/comic_vine/series_question.cpp index 80b43bf3..caab57fe 100644 --- a/YACReaderLibrary/comic_vine/series_question.cpp +++ b/YACReaderLibrary/comic_vine/series_question.cpp @@ -1,7 +1,5 @@ #include "series_question.h" -#include "theme_manager.h" - #include #include #include @@ -40,9 +38,9 @@ void SeriesQuestion::setYes(bool y) yes->setChecked(y); } -void SeriesQuestion::applyTheme() +void SeriesQuestion::applyTheme(const Theme &theme) { - auto comicVineTheme = ThemeManager::instance().getCurrentTheme().comicVine; + auto comicVineTheme = theme.comicVine; questionLabel->setStyleSheet(comicVineTheme.defaultLabelQSS); yes->setStyleSheet(comicVineTheme.radioButtonQSS); diff --git a/YACReaderLibrary/comic_vine/series_question.h b/YACReaderLibrary/comic_vine/series_question.h index b354fb5c..26b850c0 100644 --- a/YACReaderLibrary/comic_vine/series_question.h +++ b/YACReaderLibrary/comic_vine/series_question.h @@ -23,7 +23,7 @@ private: QRadioButton *no; protected: - void applyTheme() override; + void applyTheme(const Theme &theme) override; }; #endif // SERIES_QUESTION_H diff --git a/YACReaderLibrary/comic_vine/sort_volume_comics.cpp b/YACReaderLibrary/comic_vine/sort_volume_comics.cpp index 40f6d097..d44774d4 100644 --- a/YACReaderLibrary/comic_vine/sort_volume_comics.cpp +++ b/YACReaderLibrary/comic_vine/sort_volume_comics.cpp @@ -45,9 +45,9 @@ void ScrapperToolButton::paintEvent(QPaintEvent *e) QPushButton::paintEvent(e); } -void ScrapperToolButton::applyTheme() +void ScrapperToolButton::applyTheme(const Theme &theme) { - auto comicVineTheme = ThemeManager::instance().getCurrentTheme().comicVine; + auto comicVineTheme = theme.comicVine; setStyleSheet(comicVineTheme.scraperToolButtonQSS); fillColor = comicVineTheme.scraperToolButtonFillColor; update(); @@ -265,9 +265,9 @@ QList> SortVolumeComics::getMatchingInfo() return l; } -void SortVolumeComics::applyTheme() +void SortVolumeComics::applyTheme(const Theme &theme) { - auto comicVineTheme = ThemeManager::instance().getCurrentTheme().comicVine; + auto comicVineTheme = theme.comicVine; label->setStyleSheet(comicVineTheme.defaultLabelQSS); sortLabel->setStyleSheet(comicVineTheme.defaultLabelQSS); diff --git a/YACReaderLibrary/comic_vine/sort_volume_comics.h b/YACReaderLibrary/comic_vine/sort_volume_comics.h index 5e891337..c3a1a160 100644 --- a/YACReaderLibrary/comic_vine/sort_volume_comics.h +++ b/YACReaderLibrary/comic_vine/sort_volume_comics.h @@ -32,7 +32,7 @@ public: protected: void paintEvent(QPaintEvent *e) override; - void applyTheme() override; + void applyTheme(const Theme &theme) override; private: Appearance appearance; @@ -85,7 +85,7 @@ private: ScraperResultsPaginator *paginator; protected: - void applyTheme() override; + void applyTheme(const Theme &theme) override; }; #endif // SORT_VOLUME_COMICS_H diff --git a/YACReaderLibrary/comic_vine/title_header.cpp b/YACReaderLibrary/comic_vine/title_header.cpp index 77931b57..06585908 100644 --- a/YACReaderLibrary/comic_vine/title_header.cpp +++ b/YACReaderLibrary/comic_vine/title_header.cpp @@ -1,7 +1,5 @@ #include "title_header.h" -#include "theme_manager.h" - #include #include #include @@ -49,9 +47,9 @@ void TitleHeader::showButtons(bool show) } } -void TitleHeader::applyTheme() +void TitleHeader::applyTheme(const Theme &theme) { - auto comicVineTheme = ThemeManager::instance().getCurrentTheme().comicVine; + auto comicVineTheme = theme.comicVine; mainTitleLabel->setStyleSheet(comicVineTheme.titleLabelQSS); subTitleLabel->setStyleSheet(comicVineTheme.defaultLabelQSS); diff --git a/YACReaderLibrary/comic_vine/title_header.h b/YACReaderLibrary/comic_vine/title_header.h index 01956e40..7ce33d6c 100644 --- a/YACReaderLibrary/comic_vine/title_header.h +++ b/YACReaderLibrary/comic_vine/title_header.h @@ -22,7 +22,7 @@ private: QLabel *subTitleLabel; protected: - void applyTheme() override; + void applyTheme(const Theme &theme) override; }; #endif // TITLE_HEADER_H diff --git a/common/themes/themable.h b/common/themes/themable.h index fd5f3912..1915bee8 100644 --- a/common/themes/themable.h +++ b/common/themes/themable.h @@ -12,13 +12,13 @@ protected: &ThemeManager::themeChanged, owner, [this]() { - applyTheme(); + applyTheme(ThemeManager::instance().getCurrentTheme()); }); - applyTheme(); + applyTheme(ThemeManager::instance().getCurrentTheme()); } - virtual void applyTheme() = 0; + virtual void applyTheme(const Theme &theme) = 0; }; #endif // THEMABLE_H