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
8de914ab
Commit
8de914ab
authored
Feb 21, 2018
by
Leander Schulten
Browse files
Update Settings
set dmx data to 0 when starting make security copy of settings
parent
0fddc984
Changes
4
Show whitespace changes
Inline
Side-by-side
SettingsView.qml
View file @
8de914ab
...
...
@@ -48,6 +48,17 @@ Pane{
}
}
}
Label
{
text
:
"
Update pause for dmx in ms:
"
}
TextInputField
{
validator
:
IntValidator
{
bottom
:
10
top
:
10000
}
text
:
Settings
.
updatePauseInMs
;
onAccepted
:
Settings
.
updatePauseInMs
=
text
;
}
}
FileDialog
{
property
var
callback
;
...
...
driver.cpp
View file @
8de914ab
...
...
@@ -5,6 +5,7 @@
#include "programm.h"
#include "dmxchannelfilter.h"
#include <QDir>
#include <cstring>
HardwareInterface
*
driver
=
nullptr
;
...
...
@@ -35,6 +36,7 @@ namespace Driver {
ErrorNotifier
::
get
()
->
newError
(
s
);
});
inter
->
setSetValuesCallback
([](
unsigned
char
*
values
,
int
size
,
double
time
){
std
::
memset
(
values
,
0
,
size
);
DMXChannelFilter
::
initValues
(
values
,
size
);
Programm
::
fill
(
values
,
size
,
time
);
DMXChannelFilter
::
filterValues
(
values
,
size
);
...
...
main.cpp
View file @
8de914ab
...
...
@@ -86,7 +86,7 @@ int main(int argc, char *argv[])
Settings
settings
;
settings
.
setJsonSettingsFilePath
(
"QTJSONFile.json"
);
QFile
file
(
settings
.
getJsonSettingsFilePath
());
file
.
copy
(
settings
.
getJsonSettingsFilePath
()
+
"_"
+
QDateTime
::
currentDateTime
().
toString
(
"dd.MM.YYYY HH:mm:ss"
));
#warning Dont use IDBase<xxxxx>::getAllIDBases() in this file. It will crash the aplication when its closing
...
...
@@ -108,6 +108,11 @@ int main(int argc, char *argv[])
settings
.
connect
(
&
settings
,
&
Settings
::
driverFilePathChanged
,[
&
](){
Driver
::
loadAndStartDriver
(
settings
.
getDriverFilePath
());
});
settings
.
connect
(
&
settings
,
&
Settings
::
updatePauseInMsChanged
,[
&
](){
if
(
Driver
::
getCurrentDriver
()){
Driver
::
getCurrentDriver
()
->
setWaitTime
(
std
::
chrono
::
milliseconds
(
settings
.
getUpdatePauseInMs
()));
}
});
engine
.
rootContext
()
->
setContextProperty
(
"ModelManager"
,
new
ModelManager
());
...
...
@@ -129,7 +134,7 @@ int main(int argc, char *argv[])
// Treiber laden
#define USE_DUMMY_DRIVER
//
#define USE_DUMMY_DRIVER
#ifndef USE_DUMMY_DRIVER
if
(
!
Driver
::
loadAndStartDriver
(
settings
.
getDriverFilePath
())){
ErrorNotifier
::
showError
(
"Cant start driver."
);
...
...
settings.h
View file @
8de914ab
...
...
@@ -11,15 +11,19 @@ class Settings : public QObject
QSettings
settings
;
Q_PROPERTY
(
QString
jsonSettingsFilePath
READ
getJsonSettingsFilePath
WRITE
setJsonSettingsFilePath
NOTIFY
jsonSettingsFilePathChanged
)
Q_PROPERTY
(
QString
driverFilePath
READ
getDriverFilePath
WRITE
setDriverFilePath
NOTIFY
driverFilePathChanged
)
Q_PROPERTY
(
unsigned
int
updatePauseInMs
READ
getUpdatePauseInMs
WRITE
setUpdatePauseInMs
NOTIFY
updatePauseInMsChanged
)
public:
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
();}
void
setUpdatePauseInMs
(
unsigned
int
pause
){
settings
.
setValue
(
"driverFilePath"
,
pause
);
emit
updatePauseInMsChanged
();}
unsigned
int
getUpdatePauseInMs
()
const
{
return
settings
.
value
(
"driverFilePath"
).
toUInt
();}
signals:
void
jsonSettingsFilePathChanged
();
void
driverFilePathChanged
();
void
updatePauseInMsChanged
();
public
slots
:
};
...
...
Write
Preview
Supports
Markdown
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