Skip to content

Commit

Permalink
qmlui: add dedicated panel for fanning settings
Browse files Browse the repository at this point in the history
  • Loading branch information
mcallegari committed Oct 17, 2019
1 parent 45f91f4 commit b8f0827
Show file tree
Hide file tree
Showing 5 changed files with 227 additions and 35 deletions.
202 changes: 202 additions & 0 deletions qmlui/qml/PaletteFanningBox.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
/*
Q Light Controller Plus
PaletteFanningBox.qml
Copyright (c) Massimo Callegari
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import QtQuick 2.0
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.1

import org.qlcplus.classes 1.0
import "."

Rectangle
{
id: boxRoot
width: 330
height: UISettings.iconSizeMedium
color: "transparent"

property int paletteType: QLCPalette.Dimmer
property int value1: 0
property int value2: 0

function showPalettePopup()
{
palettePopup.type = boxRoot.paletteType
palettePopup.value1 = boxRoot.value1
palettePopup.value2 = boxRoot.value2
palettePopup.open()
palettePopup.focusEditItem()
}

function stringFromType()
{
switch(curveButton.currentValue)
{
case QLCPalette.Flat: return qsTr("Flat")
case QLCPalette.Linear: return qsTr("Linear")
case QLCPalette.Square: return qsTr("Square")
case QLCPalette.Saw: return qsTr("Saw")
case QLCPalette.Sine: return qsTr("Sine")
}
}

PopupCreatePalette
{
id: palettePopup
}

RowLayout
{
width: boxRoot.width
height: UISettings.iconSizeMedium

IconButton
{
id: fanningButton
width: UISettings.iconSizeMedium
height: width
imgSource: "qrc:/fanning.svg"
tooltip: qsTr("Show/Hide fanning options")
checkable: true
checked: false
}

Rectangle
{
color: "transparent"
Layout.fillWidth: true
height: UISettings.iconSizeMedium
}

IconButton
{
width: UISettings.iconSizeMedium
height: width
imgSource: "qrc:/palette.svg"
tooltip: qsTr("Create a new palette")
onClicked: boxRoot.showPalettePopup()
}
}

Rectangle
{
visible: fanningButton.checked
y: UISettings.iconSizeMedium + 2
width: paramsGrid.width + 10
height: paramsGrid.height + 10
color: UISettings.bgMedium
border.color: UISettings.bgLight
border.width: 2

GridLayout
{
id: paramsGrid
columns: 2
x: 5
y: 5

// row 1
IconPopupButton
{
id: curveButton
implicitWidth: UISettings.iconSizeMedium
implicitHeight: implicitWidth

ListModel
{
id: curveModel
ListElement { mLabel: qsTr("Flat"); mIcon: "qrc:/algo-flat.svg"; mValue: QLCPalette.Flat }
ListElement { mLabel: qsTr("Linear"); mIcon: "qrc:/algo-linear.svg"; mValue: QLCPalette.Linear }
ListElement { mLabel: qsTr("Square"); mIcon: "qrc:/algo-square.svg"; mValue: QLCPalette.Square }
ListElement { mLabel: qsTr("Saw"); mIcon: "qrc:/algo-saw.svg"; mValue: QLCPalette.Saw }
ListElement { mLabel: qsTr("Sine"); mIcon: "qrc:/algo-sine.svg"; mValue: QLCPalette.Sine }
}
model: curveModel

//currentValue: efxEditor.runOrder
//onValueChanged: efxEditor.runOrder = value
}

RobotoText
{
height: UISettings.iconSizeMedium
label: stringFromType()
}

// row 2
RobotoText
{
height: UISettings.iconSizeMedium
label: qsTr("Amount")
}
CustomSpinBox
{
from: 0
to: 100
value: 100
suffix: "%"
}

// row 3
RowLayout
{
Layout.columnSpan: 2
visible: boxRoot.paletteType === QLCPalette.Pan ||
boxRoot.paletteType === QLCPalette.Tilt ||
boxRoot.paletteType === QLCPalette.PanTilt ? true : false

CustomCheckBox
{
implicitHeight: UISettings.iconSizeMedium
implicitWidth: implicitHeight
checked: true
}
RobotoText
{
label: "Pan"
}
CustomCheckBox
{
implicitHeight: UISettings.iconSizeMedium
implicitWidth: implicitHeight
checked: true
}
RobotoText
{
label: "Tilt"
}
}

// row 4
RobotoText
{
label: qsTr("Value")
}
CustomSpinBox
{
visible: boxRoot.paletteType != QLCPalette.Color
from: 0
to: 255
suffix: boxRoot.paletteType === QLCPalette.Pan ||
boxRoot.paletteType === QLCPalette.Tilt ||
boxRoot.paletteType === QLCPalette.PanTilt ? "°" : ""
}
} // GridLayout
} // Rectangle
}
23 changes: 7 additions & 16 deletions qmlui/qml/fixturesfunctions/IntensityTool.qml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ Rectangle
property bool dmxValues: true
property alias currentValue: spinBox.value

signal requestPalettePopup(int type, int value)

onCurrentValueChanged:
{
if (dmxValues)
Expand Down Expand Up @@ -94,7 +92,7 @@ Rectangle
color: "transparent"
x: (parent.width - width) / 2
width: intRoot.width * 0.75
height: intRoot.height - (UISettings.listItemHeight * 3) - 20
height: intRoot.height - (UISettings.listItemHeight * 2) - UISettings.iconSizeMedium - 20

Image
{
Expand Down Expand Up @@ -146,7 +144,7 @@ Rectangle

Row
{
x: 10
x: 5
height: UISettings.listItemHeight
spacing: 5

Expand Down Expand Up @@ -181,19 +179,12 @@ Rectangle
}
}

Row
PaletteFanningBox
{
x: 10
height: UISettings.listItemHeight

IconButton
{
width: height
height: UISettings.listItemHeight
imgSource: "qrc:/palette.svg"
tooltip: qsTr("Create a new palette")
onClicked: intRoot.requestPalettePopup(QLCPalette.Dimmer, intRoot.currentValue)
}
x: 5
width: intRoot.width - 10
paletteType: QLCPalette.Dimmer
value1: intRoot.currentValue
}
}
}
Expand Down
15 changes: 0 additions & 15 deletions qmlui/qml/fixturesfunctions/LeftPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,6 @@ SidePanel
item.height = Qt.binding(function() { return leftSidePanel.height })
}

function showPalettePopup(type, value1, value2)
{
palettePopup.type = type
palettePopup.value1 = value1
palettePopup.value2 = value2
palettePopup.open()
palettePopup.focusEditItem()
}

Rectangle
{
id: sideBar
Expand Down Expand Up @@ -141,7 +132,6 @@ SidePanel
x: leftSidePanel.width
y: UISettings.bigItemHeight
visible: false
onRequestPalettePopup: leftSidePanel.showPalettePopup(type, value, 0)
}
}

Expand Down Expand Up @@ -352,9 +342,4 @@ SidePanel
}
} // ColumnLayout
} // Rectangle

PopupCreatePalette
{
id: palettePopup
}
}
21 changes: 17 additions & 4 deletions qmlui/qml/fixturesfunctions/PositionTool.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ import QtQuick.Layouts 1.0
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2

import org.qlcplus.classes 1.0
import "CanvasDrawFunctions.js" as DrawFuncs
import "."

Rectangle
{
id: posToolRoot
width: UISettings.bigItemHeight * 2.2
height: UISettings.bigItemHeight * 3.3
height: UISettings.bigItemHeight * 3.5
color: UISettings.bgMedium
border.color: UISettings.bgLight
border.width: 2
Expand All @@ -40,8 +41,8 @@ Rectangle
property int panDegrees: 0
property int tiltDegrees: 0

onPanDegreesChanged: fixtureManager.setPanValue(panDegrees)
onTiltDegreesChanged: fixtureManager.setTiltValue(tiltDegrees)
onPanDegreesChanged: contextManager.setPositionValue(QLCChannel.Pan, panDegrees)
onTiltDegreesChanged: contextManager.setPositionValue(QLCChannel.Tilt, tiltDegrees)

onPanMaxDegreesChanged: gCanvas.requestPaint()
onTiltMaxDegreesChanged: gCanvas.requestPaint()
Expand Down Expand Up @@ -198,6 +199,7 @@ Rectangle
// row 1
RobotoText
{
height: UISettings.listItemHeight
label: "Pan"
}

Expand Down Expand Up @@ -247,6 +249,7 @@ Rectangle
// row 2
RobotoText
{
height: UISettings.listItemHeight
label: "Tilt"
}

Expand Down Expand Up @@ -304,5 +307,15 @@ Rectangle
}
}
}
}

// row 3
PaletteFanningBox
{
Layout.columnSpan: 4
Layout.fillWidth: true
paletteType: QLCPalette.PanTilt
value1: posToolRoot.panDegrees
value2: posToolRoot.tiltDegrees
}
} // GridLayout
}
1 change: 1 addition & 0 deletions qmlui/qmlui.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<file alias="MainView.qml">qml/MainView.qml</file>
<file alias="MenuBarEntry.qml">qml/MenuBarEntry.qml</file>
<file alias="MultiColorBox.qml">qml/MultiColorBox.qml</file>
<file alias="PaletteFanningBox.qml">qml/PaletteFanningBox.qml</file>
<file alias="QLCPlusFader.qml">qml/QLCPlusFader.qml</file>
<file alias="QLCPlusKnob.qml">qml/QLCPlusKnob.qml</file>
<file alias="RobotoText.qml">qml/RobotoText.qml</file>
Expand Down

0 comments on commit b8f0827

Please sign in to comment.