Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Leander Schulten
Lichtsteuerung
Commits
96dffbed
Commit
96dffbed
authored
Feb 20, 2018
by
Leander Schulten
Browse files
Add driver file path setting
parent
f72cffc3
Changes
6
Hide whitespace changes
Inline
Side-by-side
SettingsView.qml
0 → 100644
View file @
96dffbed
import
QtQuick
2.7
import
QtQuick
.
Controls
2.2
import
QtQuick
.
Layouts
1.0
import
QtQuick
.
Dialogs
1.2
Pane
{
GridLayout
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
rowSpacing
:
20
columns
:
2
Label
{
text
:
"
Settings file path:
"
}
TextInputField
{
text
:
Settings
.
jsonSettingsFilePath
onAccepted
:
Settings
.
jsonSettingsFilePath
=
text
;
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
fileDialog
.
folder
=
Settings
.
jsonSettingsFilePath
;
fileDialog
.
open
();
fileDialog
.
addSelection
(
Settings
.
jsonSettingsFilePath
);
}
}
}
Label
{
Layout.fillWidth
:
true
text
:
"
Driver file path:
"
}
TextInputField
{
Layout.fillWidth
:
true
text
:
Settings
.
driverFilePath
onAccepted
:
Settings
.
driverFilePath
=
text
;
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
fileDialog
.
folder
=
Settings
.
driverFilePath
;
fileDialog
.
open
();
fileDialog
.
addSelection
(
Settings
.
driverFilePath
);
}
}
}
}
FileDialog
{
id
:
fileDialog
title
:
"
Please choose a file
"
onAccepted
:
{
}
}
}
main.cpp
View file @
96dffbed
...
...
@@ -126,7 +126,7 @@ int main(int argc, char *argv[])
// Treiber laden
#if defined(Q_OS_WIN)
QString
driverFilepath
=
"USBDMXDriver"
;
QString
driverFilepath
=
settings
.
getDriverFilePath
()
;
typedef
HardwareInterface
*
(
*
getDriverFunc
)();
getDriverFunc
getDriver
=
reinterpret_cast
<
getDriverFunc
>
(
QLibrary
::
resolve
(
driverFilepath
,
"getDriver"
));
if
(
getDriver
!=
nullptr
){
...
...
main.qml
View file @
96dffbed
...
...
@@ -44,6 +44,10 @@ ApplicationWindow {
text
:
qsTr
(
"
Login
"
)
Component.onCompleted
:
tabBar
.
currentIndex
=
6
}
TabButton
{
text
:
qsTr
(
"
Settings
"
)
enabled
:
UserManagment
.
currentUser
.
havePermission
(
Permission
.
SETTINGS_TAB
);
}
}
SwipeView
{
...
...
@@ -69,6 +73,8 @@ ApplicationWindow {
height
:
400
}
LoginView
{}
SettingsView
{}
}
MessageDialog
{
...
...
qml.qrc
View file @
96dffbed
...
...
@@ -35,5 +35,6 @@
<file>SwitchGroupControl.qml</file>
<file>DimmerGroupControl.qml</file>
<file>LoginView.qml</file>
<file>SettingsView.qml</file>
</qresource>
</RCC>
settings.h
View file @
96dffbed
...
...
@@ -10,12 +10,16 @@ class Settings : public QObject
Q_OBJECT
QSettings
settings
;
Q_PROPERTY
(
QString
jsonSettingsFilePath
READ
getJsonSettingsFilePath
WRITE
setJsonSettingsFilePath
NOTIFY
jsonSettingsFilePathChanged
)
Q_PROPERTY
(
QString
driverFilePath
READ
getDriverFilePath
WRITE
setDriverFilePath
NOTIFY
driverFilePathChanged
)
public:
explicit
Settings
(
QObject
*
parent
=
nullptr
);
explicit
Settings
(
QObject
*
parent
=
nullptr
);
void
setJsonSettingsFilePath
(
QString
file
){
if
(
!
QFile
::
exists
(
file
))
return
;
settings
.
setValue
(
"jsonSettingsFilePath"
,
file
);
emit
jsonSettingsFilePathChanged
();}
QString
getJsonSettingsFilePath
()
const
{
return
settings
.
value
(
"jsonSettingsFilePath"
).
toString
();}
void
setDriverFilePath
(
QString
file
){
if
(
!
QFile
::
exists
(
file
))
return
;
settings
.
setValue
(
"driverFilePath"
,
file
);
emit
driverFilePathChanged
();}
QString
getDriverFilePath
()
const
{
return
settings
.
value
(
"driverFilePath"
).
toString
();}
signals:
void
jsonSettingsFilePathChanged
();
void
driverFilePathChanged
();
public
slots
:
};
...
...
usermanagment.h
View file @
96dffbed
...
...
@@ -32,12 +32,12 @@ public:
* @brief The Permission enum contains all Permissions a User can have
*/
enum
Permission
{
Admin
,
Read
,
Write
,
ADD_DEVICE
,
REMOVE_DEVICE
,
CHANGE_POSITION
,
CHANGE_NAME
,
CHANGE_DEVICE_DMX_CHANNEL
,
DEVICE_TAB
,
DEVICE_PROTOTYPE_TAB
,
PROGRAMM_PROTOTYPE_TAY
,
PROGRAMM_TAB
,
MOVE_CONTROL_ITEM
,
ADD_CONTROL_ITEM
,
CHANGE_GROUP_NAME
,
CHANGE_GROUP_DEVICES
,
CHANGE_MIN_MAX_MAPPING
,
CHANGE_TIMEOUTS
,
REMOVE_CONTROL_ITEM
,
LAST_PERMISSION
Admin
=
0
,
Read
=
1
,
Write
=
2
,
ADD_DEVICE
=
3
,
REMOVE_DEVICE
=
4
,
CHANGE_POSITION
=
5
,
CHANGE_NAME
=
6
,
CHANGE_DEVICE_DMX_CHANNEL
=
7
,
DEVICE_TAB
=
8
,
DEVICE_PROTOTYPE_TAB
=
9
,
PROGRAMM_PROTOTYPE_TAY
=
10
,
PROGRAMM_TAB
=
11
,
MOVE_CONTROL_ITEM
=
12
,
ADD_CONTROL_ITEM
=
13
,
CHANGE_GROUP_NAME
=
14
,
CHANGE_GROUP_DEVICES
=
15
,
CHANGE_MIN_MAX_MAPPING
=
16
,
CHANGE_TIMEOUTS
=
17
,
REMOVE_CONTROL_ITEM
=
18
,
SETTINGS_TAB
=
19
,
LAST_PERMISSION
=
20
};
Q_ENUM
(
Permission
)
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment