diff --git a/src/qt/palladium.qrc b/src/qt/palladium.qrc index 2da8ed2..3b2bed8 100644 --- a/src/qt/palladium.qrc +++ b/src/qt/palladium.qrc @@ -83,4 +83,8 @@ res/movies/spinner-034.png res/movies/spinner-035.png + + + res/styles/dark.qss + diff --git a/src/qt/palladiumgui.cpp b/src/qt/palladiumgui.cpp index f8f5b59..4e31fad 100644 --- a/src/qt/palladiumgui.cpp +++ b/src/qt/palladiumgui.cpp @@ -61,6 +61,8 @@ #include #include +#include +#include const std::string PalladiumGUI::DEFAULT_UIPLATFORM = #if defined(Q_OS_MAC) @@ -79,7 +81,25 @@ PalladiumGUI::PalladiumGUI(interfaces::Node& node, const PlatformStyle *_platfor platformStyle(_platformStyle), m_network_style(networkStyle) { + +// --- DARK MODE AUTO-LOAD --- QSettings settings; + bool isDark = settings.value("darkModeEnabled", false).toBool(); + if (isDark) { + // Stylesheet laden + QFile f(":/res/styles/dark.qss"); + if (f.open(QFile::ReadOnly | QFile::Text)) { + QTextStream ts(&f); + qApp->setStyleSheet(ts.readAll()); + f.close(); + } + // Wichtig: Den Haken im Menü setzen! + if(themeAction) { + themeAction->setChecked(true); + } + } + + //QSettings settings; if (!restoreGeometry(settings.value("MainWindowGeometry").toByteArray())) { // Restore failed (perhaps missing setting), center the window move(QGuiApplication::primaryScreen()->availableGeometry().center() - frameGeometry().center()); @@ -414,6 +434,10 @@ void PalladiumGUI::createActions() connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C), this), &QShortcut::activated, this, &PalladiumGUI::showDebugWindowActivateConsole); connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_D), this), &QShortcut::activated, this, &PalladiumGUI::showDebugWindow); + + themeAction = new QAction(tr("&Dark Mode"), this); + themeAction->setCheckable(true); + connect(themeAction, SIGNAL(triggered()), this, SLOT(toggleTheme())); } void PalladiumGUI::createMenuBar() @@ -506,6 +530,8 @@ void PalladiumGUI::createMenuBar() help->addSeparator(); help->addAction(aboutAction); help->addAction(aboutQtAction); + + settings->addAction(themeAction); } void PalladiumGUI::createToolBars() @@ -1463,3 +1489,23 @@ void UnitDisplayStatusBarControl::onMenuSelection(QAction* action) optionsModel->setDisplayUnit(action->data()); } } +void PalladiumGUI::toggleTheme() +{ + QSettings settings; + if (themeAction->isChecked()) { + // 1. Dark Mode laden + QFile f(":/res/styles/dark.qss"); + if (f.open(QFile::ReadOnly | QFile::Text)) { + QTextStream ts(&f); + qApp->setStyleSheet(ts.readAll()); + f.close(); + } + // 2. Speichern, dass er an ist + settings.setValue("darkModeEnabled", true); + } else { + // 1. Standard Theme (Weiß) + qApp->setStyleSheet(""); + // 2. Speichern, dass er aus ist + settings.setValue("darkModeEnabled", false); + } +} diff --git a/src/qt/palladiumgui.h b/src/qt/palladiumgui.h index 5d2b3a7..6cc6fde 100644 --- a/src/qt/palladiumgui.h +++ b/src/qt/palladiumgui.h @@ -153,7 +153,7 @@ private: QAction* m_close_wallet_action{nullptr}; QAction* m_wallet_selector_label_action = nullptr; QAction* m_wallet_selector_action = nullptr; - + QAction *themeAction; QLabel *m_wallet_selector_label = nullptr; QComboBox* m_wallet_selector = nullptr; @@ -308,6 +308,8 @@ public Q_SLOTS: void setTrayIconVisible(bool); void showModalOverlay(); + + void toggleTheme(); }; class UnitDisplayStatusBarControl : public QLabel diff --git a/src/qt/res/styles/dark.qss b/src/qt/res/styles/dark.qss new file mode 100644 index 0000000..abe9bd4 --- /dev/null +++ b/src/qt/res/styles/dark.qss @@ -0,0 +1,146 @@ +/* ======================================================= + PALLADIUM CORE DARK THEME (dark.qss) + ======================================================= */ + +/* --- GRUNDLAGEN --- */ +QWidget { + background-color: #2D2D2D; + color: #E0E0E0; + selection-background-color: #007BFF; + selection-color: #FFFFFF; + outline: none; +} + +/* --- MENÜLEISTE (Oben: File, Settings...) --- */ +QMenuBar { + background-color: #2D2D2D; + color: #E0E0E0; + border-bottom: 1px solid #3A3A3A; +} + +QMenuBar::item { + background-color: transparent; + padding: 6px 10px; +} + +QMenuBar::item:selected { + background-color: #3A3A3A; +} + +QMenu { + background-color: #2D2D2D; + border: 1px solid #555; +} + +QMenu::item { + padding: 5px 20px; +} + +QMenu::item:selected { + background-color: #007BFF; + color: white; +} + +/* --- TOOLBAR (Die Icons oben) --- */ +/* Wir machen sie etwas heller, damit schwarze Icons sichtbar bleiben */ +QToolBar { + background-color: #3D3D3D; + border-bottom: 1px solid #3A3A3A; + padding: 2px; + spacing: 5px; +} + +QToolButton { + background-color: transparent; + border: 1px solid transparent; + border-radius: 4px; + padding: 4px; + color: #E0E0E0; +} + +QToolButton:hover { + background-color: #4D4D4D; + border: 1px solid #555; +} + +QToolButton:checked { + background-color: #007BFF; + color: white; +} + +/* --- TABS (Overview, Send, Receive) --- */ +QTabWidget::pane { + border: 1px solid #3A3A3A; +} + +QTabBar::tab { + background: #1E1E1E; + color: #AAAAAA; + padding: 8px 20px; + border: 1px solid #3A3A3A; + border-bottom: none; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + margin-right: 2px; +} + +QTabBar::tab:selected { + background: #2D2D2D; /* Gleiche Farbe wie Hintergrund */ + color: #FFFFFF; + border-bottom: 1px solid #2D2D2D; /* "Verbindet" den Tab mit dem Inhalt */ + font-weight: bold; +} + +/* --- EINGABEFELDER --- */ +QLineEdit, QTextEdit, QPlainTextEdit, QSpinBox, QDoubleSpinBox { + background-color: #1E1E1E; + color: #FFFFFF; + border: 1px solid #3A3A3A; + border-radius: 3px; + padding: 4px; +} + +QLineEdit:focus { + border: 1px solid #007BFF; +} + +/* --- LISTEN & TABELLEN (Transaktionen) --- */ +QTableView, QListView, QTreeWidget { + background-color: #1E1E1E; + alternate-background-color: #252525; + color: #E0E0E0; + gridline-color: #333; + border: 1px solid #3A3A3A; +} + +QHeaderView::section { + background-color: #333; + color: #E0E0E0; + padding: 4px; + border: 1px solid #444; +} + +/* --- BUTTONS --- */ +QPushButton { + background-color: #444; + border: 1px solid #555; + border-radius: 4px; + padding: 5px 15px; + color: white; +} + +QPushButton:hover { + background-color: #555; +} + +QPushButton:pressed { + background-color: #007BFF; + border-color: #007BFF; +} + +/* --- STATUSBAR (Unten) --- */ +QStatusBar { + background-color: #2D2D2D; + color: #888; + border-top: 1px solid #3A3A3A; +}