23 #include <QTextStream>
34 StyleSheet(QLatin1String style_sheet_name, QLatin1String file_name)
35 : styleSheetName(style_sheet_name), fileName(file_name)
37 QLatin1String styleSheetName;
38 QLatin1String fileName;
41 static inline QString read_stylesheet(
const QString &stylesheet)
43 QFile file(stylesheet);
44 file.open(QFile::ReadOnly | QFile::Text);
45 QTextStream stream(&file);
46 return stream.readAll();
55 static QString currentStyle;
56 static QLatin1String DARK_PALETTE;
57 static void resetStyle();
60 enum class StyleType {Light, Dark};
62 static const QStringList styles;
63 static const inline QString defaultStyle = QStringLiteral(
"Fusion");
64 static const QList<StyleSheet> styleSheets;
67 static void setStyle(
const QString &style_key);
68 static void setStyle(
const StyleSheet &style_sheet);
69 static void setStyle(
const QPalette &palette);
70 static QString getCurrentStyle() {
return currentStyle;}
71 static StyleType getStyleType();
72 static QPalette darkPalette();
73 static const QString& style();
75 static inline void loadStylesComboBox(QComboBox *combo_box){
76 const QSignalBlocker blocker(combo_box);
77 combo_box->addItems(Style::styles);
78 for (
const auto &style_sheet : Style::styleSheets) {
79 combo_box->addItem(style_sheet.styleSheetName);
81 combo_box->addItem(QStringLiteral(
"Dark-Palette"));
82 combo_box->model()->sort(0);
The AStyle class encapsulates style and stylesheet logic.
Definition: style.h:53
static void setup()
Setup Application style by reading from openPilotLog.ini.
Definition: style.cpp:51
A namespace to collect constants and enums used throughout the application.
Definition: paths.cpp:3
The StyleSheet struct holds the Display Name and File Name (in the resource system) for the available...
Definition: style.h:33