Files
yacreader/common/themes/appearance_tab_widget.h
luisangelsm 3709b6e737
Some checks failed
Build / Initialization (push) Has been cancelled
Build / Code Format Validation (push) Has been cancelled
Build / Linux (Qt6) (push) Has been cancelled
Build / Linux (Qt6 + 7zip) (push) Has been cancelled
Build / macOS (Qt6 Universal) (push) Has been cancelled
Build / Windows x64 (Qt6) (push) Has been cancelled
Build / Windows ARM64 (Qt6) (push) Has been cancelled
Build / Docker amd64 Image (push) Has been cancelled
Build / Docker arm64 Image (push) Has been cancelled
Build / Publish Dev Builds (push) Has been cancelled
Build / Publish Release (push) Has been cancelled
Build / Publish YACReader10 Pre-release Builds (push) Has been cancelled
Format includes using clang-format
2026-03-13 18:21:38 +01:00

60 lines
1.7 KiB
C++

#ifndef APPEARANCE_TAB_WIDGET_H
#define APPEARANCE_TAB_WIDGET_H
#include "theme_variant.h"
#include <QJsonObject>
#include <QPointer>
#include <QWidget>
#include <functional>
#include <optional>
class AppearanceConfiguration;
class QComboBox;
class QPushButton;
class ThemeEditorDialog;
class ThemeRepository;
class AppearanceTabWidget : public QWidget
{
Q_OBJECT
public:
explicit AppearanceTabWidget(
AppearanceConfiguration *config,
ThemeRepository *repository,
std::function<QJsonObject()> currentThemeJson,
std::function<void(const QJsonObject &)> applyTheme,
QWidget *parent = nullptr);
private:
AppearanceConfiguration *config;
ThemeRepository *repository;
std::function<QJsonObject()> currentThemeJson;
std::function<void(const QJsonObject &)> applyTheme;
QPointer<ThemeEditorDialog> themeEditor;
// One row per picker; shown/hidden based on active mode
QWidget *lightRow = nullptr;
QWidget *darkRow = nullptr;
QWidget *customRow = nullptr;
QComboBox *lightCombo = nullptr;
QComboBox *darkCombo = nullptr;
QComboBox *customCombo = nullptr;
QPushButton *lightDeleteBtn = nullptr;
QPushButton *darkDeleteBtn = nullptr;
QPushButton *customDeleteBtn = nullptr;
// Populate a combo with themes, filtered strictly by variant (or all if nullopt).
void populateCombo(QComboBox *combo, std::optional<ThemeVariant> variantFilter, const QString &selectedId);
void repopulateCombos();
void updateDeleteButton(QComboBox *combo, QPushButton *btn);
void updateModeRows();
void importTheme();
void deleteTheme(QComboBox *combo, QPushButton *deleteBtn);
};
#endif // APPEARANCE_TAB_WIDGET_H