Add MQTT button color option to theme manager

This commit is contained in:
Alex Spataru 2021-11-11 22:35:23 -06:00
parent 74354bb8bc
commit 48092003c0
7 changed files with 13 additions and 4 deletions

View File

@ -284,9 +284,9 @@ Control {
icon.height: 24
font.bold: true
Layout.fillWidth: true
icon.color: Cpp_ThemeManager.highlight
icon.color: Cpp_ThemeManager.mqttButton
checked: Cpp_MQTT_Client.isConnectedToHost
palette.buttonText: Cpp_ThemeManager.highlight
palette.buttonText: Cpp_ThemeManager.mqttButton
onClicked: Cpp_MQTT_Client.toggleConnection()
text: (checked ? qsTr("Disconnect") :
qsTr("Connect to broker")) + " "

View File

@ -468,10 +468,10 @@ FramelessWindow.CustomWindow {
icon.height: 24
font.bold: true
Layout.fillWidth: true
icon.color: Cpp_ThemeManager.highlight
icon.color: Cpp_ThemeManager.mqttButton
checked: Cpp_MQTT_Client.isConnectedToHost
onClicked: Cpp_MQTT_Client.toggleConnection()
palette.buttonText: Cpp_ThemeManager.highlight
palette.buttonText: Cpp_ThemeManager.mqttButton
text: (checked ? qsTr("Disconnect") : qsTr("Connect")) + " "
icon.source: checked ? "qrc:/icons/disconnect.svg" :
"qrc:/icons/connect.svg"

View File

@ -40,6 +40,7 @@
"widgetControlBackground":"#bebebe",
"connectButtonChecked":"#d72d60",
"connectButtonUnchecked":"#2eed5c",
"mqttButton":"#2eed5c",
"widgetTextPrimary":"#e6e0b2",
"widgetTextSecondary":"#517497",
"widgetWindowBackground":"#121920",

View File

@ -39,6 +39,7 @@
"csvCheckbox":"#2e895c",
"connectButtonChecked":"#d72d60",
"connectButtonUnchecked":"#2eed5c",
"mqttButton":"#1e7cf3",
"widgetTextPrimary":"#24476a",
"widgetTextSecondary":"#666666",
"widgetWindowBackground":"#f2f2f2",

View File

@ -39,6 +39,7 @@
"csvCheckbox":"#2e895c",
"connectButtonChecked":"#fe696e",
"connectButtonUnchecked":"#26cd40",
"mqttButton":"#53ab27",
"widgetTextPrimary":"#24476a",
"widgetTextSecondary":"#666666",
"widgetWindowBackground":"#e8e8e8",

View File

@ -172,6 +172,7 @@ void ThemeManager::loadTheme(const int id)
m_widgetControlBackground = QColor(colors.value("widgetControlBackground").toString());
m_connectButtonChecked = QColor(colors.value("connectButtonChecked").toString());
m_connectButtonUnchecked = QColor(colors.value("connectButtonUnchecked").toString());
m_mqttButton = QColor(colors.value("mqttButton").toString());
// clang-format on
// Read bar widget colors

View File

@ -181,6 +181,9 @@ class ThemeManager : public QObject
Q_PROPERTY(QColor connectButtonUnchecked
READ connectButtonUnchecked
NOTIFY themeChanged)
Q_PROPERTY(QColor mqttButton
READ mqttButton
NOTIFY themeChanged)
Q_PROPERTY(StringList widgetColors
READ widgetColors
NOTIFY themeChanged)
@ -243,6 +246,7 @@ public:
QColor widgetControlBackground() const;
QColor connectButtonChecked() const;
QColor connectButtonUnchecked() const;
QColor mqttButton() const;
StringList widgetColors() const;
StringList availableThemes() const;
@ -308,6 +312,7 @@ private:
QColor m_widgetControlBackground;
QColor m_connectButtonChecked;
QColor m_connectButtonUnchecked;
QColor m_mqttButton;
StringList m_widgetColors;
};
}