Skip to content

Commit

Permalink
qml: Use StyleManager in place of Style
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
  • Loading branch information
patrickelectric authored and jaxxzer committed Nov 7, 2018
1 parent c42a2ed commit fd3b654
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 34 deletions.
9 changes: 2 additions & 7 deletions qml/DisplaySettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion qml/Ping1DVisualizer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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" }
}

Expand Down
6 changes: 4 additions & 2 deletions qml/PingItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
20 changes: 0 additions & 20 deletions qml/Style.qml

This file was deleted.

6 changes: 4 additions & 2 deletions qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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

Expand Down
1 change: 0 additions & 1 deletion qml/qmldir
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
singleton Style 1.0 Style.qml
1 change: 0 additions & 1 deletion resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<file alias="PingPopup.qml">qml/PingPopup.qml</file>
<file alias="PingRelease.qml">qml/PingRelease.qml</file>
<file alias="PingStatus.qml">qml/PingStatus.qml</file>
<file alias="Style.qml">qml/Style.qml</file>
<file alias="ValueReadout.qml">qml/ValueReadout.qml</file>
<file alias="PingTextField.qml">qml/PingTextField.qml</file>
</qresource>
Expand Down

0 comments on commit fd3b654

Please sign in to comment.