diff --git a/qml/DisplaySettings.qml b/qml/DisplaySettings.qml index e77005aef..dfe2c0d74 100644 --- a/qml/DisplaySettings.qml +++ b/qml/DisplaySettings.qml @@ -7,6 +7,7 @@ import QtQuick.Layouts 1.3 import Qt.labs.settings 1.0 import SettingsManager 1.0 +import StyleManager 1.0 Item { id: displaySettings @@ -74,13 +75,7 @@ Item { Layout.columnSpan: 4 Layout.fillWidth: true model: ["Dark", "Light"] - onCurrentTextChanged: { - if (currentIndex) { - Style.useLightStyle() - } else { - Style.useDarkStyle() - } - } + onCurrentTextChanged: StyleManager.isDark = !currentIndex } CheckBox { diff --git a/qml/Ping1DVisualizer.qml b/qml/Ping1DVisualizer.qml index 730c7d9c5..0dd98bbc9 100644 --- a/qml/Ping1DVisualizer.qml +++ b/qml/Ping1DVisualizer.qml @@ -7,6 +7,7 @@ import Qt.labs.settings 1.0 import Waterfall 1.0 import SettingsManager 1.0 +import StyleManager 1.0 Item { id: visualizer @@ -52,7 +53,7 @@ Item { transform: Rotation { origin.x: height/2; angle: 90} gradient: Gradient { GradientStop { position: 0.3; color: "transparent" } - GradientStop { position: 0.5; color: Style.primaryColor } // Not working with material + GradientStop { position: 0.5; color: StyleManager.secondaryColor } // Not working with material GradientStop { position: 0.8; color: "transparent" } } diff --git a/qml/PingItem.qml b/qml/PingItem.qml index 2e0b588c1..44fe5b56c 100644 --- a/qml/PingItem.qml +++ b/qml/PingItem.qml @@ -3,6 +3,8 @@ import QtQuick.Controls 1.2 import QtQuick.Controls.Material 2.2 import QtGraphicalEffects 1.0 +import StyleManager 1.0 + Item { id: pingItem z: 1 @@ -23,8 +25,8 @@ Item { property int animationType: Easing.Linear property bool clicked: false property var color: hideItem ? colorUnselected : colorSelected - property var colorSelected: Style.isDark ? Qt.rgba(0,0,0,0.75) : Qt.rgba(1,1,1,0.75) - property var colorUnselected: Style.isDark ? Qt.rgba(0,0,0,0.5) : Qt.rgba(1,1,1,0.5) + property var colorSelected: StyleManager.isDark ? Qt.rgba(0,0,0,0.75) : Qt.rgba(1,1,1,0.75) + property var colorUnselected: StyleManager.isDark ? Qt.rgba(0,0,0,0.5) : Qt.rgba(1,1,1,0.5) property real finalAngle: 180 property var finalAngleValue: spin && !pingpong ? 360 : finalAngle property var hoverParent: undefined diff --git a/qml/Style.qml b/qml/Style.qml deleted file mode 100644 index af99b884b..000000000 --- a/qml/Style.qml +++ /dev/null @@ -1,20 +0,0 @@ -// Style.qml -pragma Singleton -import QtQuick 2.11 -import QtQuick.Controls.Material 2.2 - -QtObject { - property color dark: "black" - property color light: "linen" - property bool isDark: true - property color primaryColor: isDark ? light : dark - property int theme: isDark ? Material.Dark : Material.Light - - function useLightStyle() { - isDark = false - } - - function useDarkStyle() { - isDark = true - } -} diff --git a/qml/main.qml b/qml/main.qml index 1ab8ea8a3..df896666d 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -6,6 +6,8 @@ import QtGraphicalEffects 1.0 import Qt.labs.settings 1.0 import QtQuick.Controls.Material 2.1 +import StyleManager 1.0 + ApplicationWindow { id: window objectName: "window" @@ -14,8 +16,8 @@ ApplicationWindow { height: 600 width: 800 - Material.theme: Style.theme - Material.primary: Style.primaryColor + Material.theme: StyleManager.theme + Material.primary: StyleManager.primaryColor Material.accent: Material.Blue Material.foreground: Material.Blue diff --git a/qml/qmldir b/qml/qmldir index 5d0df36ed..e69de29bb 100644 --- a/qml/qmldir +++ b/qml/qmldir @@ -1 +0,0 @@ -singleton Style 1.0 Style.qml \ No newline at end of file diff --git a/resources.qrc b/resources.qrc index 7c9b5062f..64c5ccf84 100644 --- a/resources.qrc +++ b/resources.qrc @@ -19,7 +19,6 @@ qml/PingPopup.qml qml/PingRelease.qml qml/PingStatus.qml - qml/Style.qml qml/ValueReadout.qml qml/PingTextField.qml