Commit 23a2d203 authored by Leander Schulten's avatar Leander Schulten
Browse files

Develop Userinterface

parent dc054ce5
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
import QtGraphicalEffects 1.0
import custom.licht.template 1.0
import custom.licht 1.0
ControlItemTemplate{
moveable: UserManagment.currentUser.havePermission(Permission.MOVE_CONTROL_ITEM);
id:item
property bool pressed: false
onPressedChanged:{
if(pressed){
rectangle.color="#C7C7FF";
}else{
rectangle.color="white";
}
}
Rectangle{
id:rectangle
anchors.fill: parent
border.width: 1
border.color: "blue"
radius: 3
layer.enabled: true;
layer.effect: FastBlur{
id: meinBlur
radius: 8
}
Behavior on color{
ColorAnimation {
duration: 200
}
}
}
onSettingVisibleChange: settings.opacity = visible
Image {
opacity: 0
id: settings
width: 18
height: 18
anchors.top: parent.top
anchors.right: parent.right
source: "icons/ic_settings_black_24px.svg"
visible: popup!==null
Behavior on rotation{
NumberAnimation{
}
}
Behavior on opacity{
NumberAnimation{
}
}
MouseArea{
anchors.fill: parent
hoverEnabled: true
onEntered: settings.rotation=90
onExited: settings.rotation=0
onClicked: {
var pos = mapToItem(parent.parent,mouse.x,mouse.y);
popup.x = pos.x;
popup.y = pos.y;
popup.open();
}
}
}
Item {
x:0;
y:0;
}
Behavior on x{
NumberAnimation{
easing.type: Easing.OutExpo
}
}
Behavior on y{
NumberAnimation{
easing.type: Easing.OutExpo
}
}
onOpenPopup: {
menu.x = x;
menu.y = y;
menu.open();
}
Menu{
id: menu
MenuItem{
visible: popup!==null
height: visible*implicitHeight
text: "Settings"
onClicked: {
popup.x = menu.x;
popup.y = menu.y;
popup.open();
}
}
MenuItem{
text: "Delete"
onClicked: {
item.parent=null;
delete item;
}
}
}
property Popup popup;
}
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
import QtGraphicalEffects 1.0
Item {
property int blockWidth: 1
property int blockHeight: 1
onBlockWidthChanged: width=blockWidth*50
onBlockHeightChanged: height=blockHeight*50
width: 50
height: 50
}
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.0
import QtGraphicalEffects 1.0
import custom.licht 1.0
ControlPanel{
onExitMenuArea: programm.width = programm.height
menuHeight: height-switchGroup.y
menuWidth: width-programm.x
RoundButton{
visible: UserManagment.currentUser.havePermission(Permission.ADD_CONTROL_ITEM);
id:programm
text: "+"
z:2
anchors.margins: 5
anchors.bottom: parent.bottom
anchors.right: parent.right
onHoveredChanged: if(hovered)width=150;
Behavior on width {
NumberAnimation{
duration: 150
easing.type: Easing.OutQuad
onRunningChanged: {
if(running)
textAnimation.start();
if(running&&!programm.hovered){
textAnimation.newText="Add Programm";
dimmerGroup.y = programm.y;
switchGroup.y = programm.y;
}else if(!running&&programm.hovered){
textAnimation.newText="+";
dimmerGroup.y = programm.y-programm.height;
switchGroup.y = programm.y-programm.height*2;
}
}
}
}
onYChanged: {
if(width!=height){
dimmerGroup.y = programm.y-programm.height
switchGroup.y = programm.y-programm.height*2;
}else{
dimmerGroup.y = programm.y;
switchGroup.y = programm.y;
}
}
SequentialAnimation {
id:textAnimation
property alias newText: setText.value
NumberAnimation{
target: programm.contentItem
property: "opacity"
duration: 60
from: 1
to: 0
easing.type: Easing.Linear
}
PauseAnimation {
duration: 30
}
PropertyAction {
id:setText
target: programm;
property: "text"
}
NumberAnimation{
target: programm.contentItem
property: "opacity"
duration: 60
from: 0
to: 1
easing.type: Easing.Linear
}
}
}
RoundButton{
visible: UserManagment.currentUser.havePermission(Permission.ADD_CONTROL_ITEM);
z:1.3
id: switchGroup
text:"Switchgroup"
anchors.right: programm.right
anchors.left: programm.left
Behavior on y{
NumberAnimation{duration: 100}
}
onClicked: addSwitchGroupControl()
}
RoundButton{
visible: UserManagment.currentUser.havePermission(Permission.ADD_CONTROL_ITEM);
z:1.3
id: dimmerGroup
text:"Dimmergroup"
anchors.right: programm.right
anchors.left: programm.left
Behavior on y{
NumberAnimation{duration: 100}
}
onClicked: addDimmerGroupControl()
}
}
......@@ -7,6 +7,8 @@ ModelView{
id:modelView
model:devicePrototypeModel
addButton.text: "Add Prototype"
removeButton.text: "Remove Prototype"
ListView{
clip:true
Layout.column: 2
......@@ -21,7 +23,7 @@ ModelView{
onClicked: channelView.currentIndex = index
TextInputField{
x:parent.implicitWidth-15
anchors.baseline: parent.baseline
anchors.verticalCenter: parent.verticalCenter
visible: true
text : name
underlineColor: parent.ListView.isCurrentItem?"lightgreen":"lightgrey"
......@@ -45,13 +47,13 @@ ModelView{
Layout.fillWidth: true
Button{
Layout.fillWidth: true
text:"+"
text:"Add Channel"
font.pixelSize: 15
onClicked: modelView.currentItem.data.pushChannel("te34324324327st")
}
Button{
Layout.fillWidth: true
text:"-"
text:"Remove Channel"
font.pixelSize: 15
onClicked: modelView.currentItem.data.popChannel()
}
......
......@@ -2,12 +2,20 @@ import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
import QtQuick.Dialogs 1.2
import custom.licht 1.0
ModelView{
id: deviceModelView
model:deviceModel
rows: 7
onAddClicked:dialog.visible = true
addButtonEnabled: UserManagment.currentUser.havePermission(Permission.ADD_DEVICE)
removeButtonEnabled: UserManagment.currentUser.havePermission(Permission.REMOVE_DEVICE)
nameInputEnabled: UserManagment.currentUser.havePermission(Permission.CHANGE_NAME)
descriptionInputEnabled: UserManagment.currentUser.havePermission(Permission.CHANGE_NAME)
addButton.text: "Add Device"
removeButton.text: "Remove Device"
Text{
Layout.row: 2
Layout.column: 2
......@@ -18,6 +26,7 @@ ModelView{
TextInputField{
Layout.row: 2
Layout.column: 3
enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_DEVICE_DMX_CHANNEL);
text: parent.currentItem.data.startDMXChannel
validator: IntValidator{
bottom: 0
......@@ -57,6 +66,7 @@ ModelView{
font.pixelSize: 15
}
TextInputField{
enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_POSITION);
Layout.minimumWidth: 50
text:deviceModelView.currentItem.data.position.x
validator: IntValidator{}
......@@ -68,6 +78,7 @@ ModelView{
font.pixelSize: 15
}
TextInputField{
enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_POSITION);
text:deviceModelView.currentItem.data.position.y
validator: IntValidator{}
onTextChanged: deviceModelView.currentItem.data.position.y = text.length?text:0
......
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
import QtGraphicalEffects 1.0
import custom.licht 1.0
ControlItem{
id:item
blockWidth: 1
blockHeight: 4
ControlItemBlock{
blockWidth: 1
Label{
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: controlData?controlData.name:"null"
elide: "ElideRight"
font.pointSize: 12
}
}
ControlItemBlock{
blockHeight: 3
Slider{
anchors.fill: parent
anchors.bottomMargin: 20
anchors.topMargin: -15
anchors.leftMargin: 10
anchors.rightMargin: 10
orientation: "Vertical"
from: 0
to: 255
stepSize: 1
Text {
text: parent.value.toFixed(0)
anchors.top:parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
}
}
}
popup: Popup{
id:popup
ColumnLayout{
RowLayout{
Label{
text:"Name : "
horizontalAlignment: TextInput.AlignRight
}
TextInput{
enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_GROUP_NAME);
Layout.fillWidth: true
text:controlData?controlData.name:"null";
onTextChanged: if(controlData)controlData.name=text;
}
}
Rectangle{
anchors.left: parent.left
anchors.right: parent.right
height: 1
color: "black"
}
RowLayout{
enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_MIN_MAX_MAPPING);
ColumnLayout{
Text {
text: qsTr("Min")
font.underline: true
anchors.horizontalCenter: parent.horizontalCenter
}
RadioButton{
text: "Remap"
checked: controlData?controlData.minOperation==1/*REMAP*/:false
onCheckedChanged: controlData.minOperation = 1
}
RadioButton{
text: "Cut"
checked: controlData?controlData.minOperation==0/*CUT*/:false
onCheckedChanged: controlData.minOperation = 0
}
}
ColumnLayout{
Text {
text: qsTr("Max")
font.underline: true
anchors.horizontalCenter: parent.horizontalCenter
}
RadioButton{
text: "Remap"
checked: controlData?controlData.maxOperation==1/*REMAP*/:false
onCheckedChanged: controlData.maxOperation = 1
}
RadioButton{
text: "Cut"
checked: controlData?controlData.maxOperation==0/*CUT*/:false
onCheckedChanged: controlData.maxOperation = 0
}
}
}
RangeSlider{
enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_MIN_MAX_MAPPING);
id: rangeSlider
from: 0
to: 255
stepSize: 1
first.value: controlData?controlData.minValue:0;
second.value: controlData?controlData.maxValue:255;
first.onValueChanged: controlData.minValue = first.value
second.onValueChanged: if(controlData)controlData.maxValue = second.value
Text {
text: rangeSlider.first.value.toFixed(0)
anchors.bottom: rangeSlider.first.handle.top
anchors.horizontalCenter: rangeSlider.first.handle.horizontalCenter
anchors.bottomMargin: 2
}
Text {
text: rangeSlider.second.value.toFixed(0)
anchors.bottom: rangeSlider.second.handle.top
anchors.horizontalCenter: rangeSlider.second.handle.horizontalCenter
anchors.bottomMargin: 2
}
}
ComboBox{
enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_MIN_MAX_MAPPING);
model: ["Use value as default","Override with value"]
currentIndex: controlData?controlData.override:0
onCurrentIndexChanged: {
if(controlData)controlData.override = (currentIndex===1)
}
anchors.left: parent.left
anchors.right: parent.right
}
RowLayout{
Label{
text:"Geräte : "
}
TextInputField{
Layout.fillWidth: true
id:search
}
}
ListView{
enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_GROUP_DEVICES);
width: 200
height: 125
clip:true
model: controlData?controlData.groupModel:null
delegate: CheckDelegate{
width: 200
text: itemData.name
visible: itemData.name.startsWith(search.text,Qt.CaseInsensitive)
checked: use
onCheckedChanged: use = checked
}
}
}
closePolicy: Popup.CloseOnPressOutside
}
}
......@@ -27,7 +27,16 @@ SOURCES += main.cpp \
syncservice.cpp \
usermanagment.cpp \
channelprogrammeditor.cpp \
modelmanager.cpp
modelmanager.cpp \
mapview.cpp \
polygon.cpp \
mapeditor.cpp \
gridbackground.cpp \
modelvector.cpp \
controlpanel.cpp \
controlitem.cpp \
controlitemdata.cpp \
dmxinterface.cpp
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked deprecated (the exact warnings
......@@ -54,7 +63,16 @@ HEADERS += \
dmxchannelfilter.h \
usermanagment.h \
channelprogrammeditor.h \
modelmanager.h
modelmanager.h \
mapview.h \
polygon.h \
mapeditor.h \
gridbackground.h \
modelvector.h \
controlpanel.h \
controlitem.h \
controlitemdata.h \
HardwareInterface.h
# Default rules for deployment.
......
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
import QtQuick.Dialogs 1.2
import custom.licht 1.0
Item{
property alias currentItem : listView.currentItem
ListView{
anchors.left: parent.left
anchors.top: parent.top
anchors.right: parent.right
anchors.bottom: buttonAdd.top
id:listView
highlightMoveDuration: 100
highlightResizeDuration: 100
model:userModel
highlight: Rectangle{
color: "lightblue"
}
highlightFollowsCurrentItem: true
delegate:
SwipeDelegate{
swipe.left: Label {
id: deleteLabel
text: qsTr("Delete")
color: "white"
verticalAlignment: Label.AlignVCenter
padding: 12
height: parent.height
//SwipeDelegate.onClicked:
background: Rectangle {
color: deleteLabel.SwipeDelegate.pressed ? Qt.darker("tomato", 1.1) : "tomato"
}
}
Timer{
id:closeTimer
interval: 2000
onTriggered: parent.swipe.close()
}
swipe.onOpened: {
closeTimer.running = true;
}
swipe.enabled: itemData !== UserManagment.defaultUser && UserManagment.currentUser.havePermission(Permission.Admin);
anchors.margins: 5
clip:true
width: parent.width
Component.onCompleted: {
background.color = Qt.binding(function(){return UserManagment.currentUser === itemData?"lightblue":"white";});
}
Behavior on height {
NumberAnimation{
duration: 500
easing.type: Easing.OutQuart
}
}
TextInputField{
anchors.verticalCenter: parent.contentItem.verticalCenter
x: parent.contentItem.x + 10
text: itemData.name
width: Math.max(implicitWidth+20,70)
enabled: (UserManagment.currentUser.havePermission(Permission.Admin) || itemData === UserManagment.currentUser)&&itemData!==UserManagment.getDefaultUser()
}
Button{
visible: UserManagment.currentUser.havePermission(Permission.Admin);
text:"Change Permissions"
anchors.right: buttonChangePassword.left
anchors.top: buttonChangePassword.top
anchors.bottom: buttonChangePassword.bottom
anchors.rightMargin: 5
onClicked: {
permissionsView.model = itemData.permissionModel;
permissionDialog.visible = true;
}
}
Button{
id:buttonChangePassword
visible: itemData === UserManagment.currentUser && itemData !== UserManagment.defaultUser;
text: "Change Password"
anchors.right: buttonLogin.left
anchors.top: buttonLogin.top
anchors.bottom: buttonLogin.bottom
anchors.rightMargin: 5
}
Button{