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
d8bfa9ae
Commit
d8bfa9ae
authored
Feb 21, 2018
by
Leander Schulten
Browse files
Fix Bugs and add error checking
parent
363cb422
Changes
2
Hide whitespace changes
Inline
Side-by-side
programm.cpp
View file @
d8bfa9ae
...
...
@@ -41,8 +41,8 @@ Programm::Programm(const QJsonObject &o):NamedObject(o,&syncServiceClassName),ID
}
void
Programm
::
addDeviceProgramm
(
const
QJsonObject
&
o
){
programms
.
push_back
(
new
DeviceProgramm
(
IDBase
<
Device
>::
getIDBaseObjectByID
(
o
[
"device"
]
.
toString
().
toLong
()
),
IDBase
<
ProgrammPrototype
>::
getIDBaseObjectByID
(
o
[
"programmPrototype"
]
.
toString
().
toLong
()
),
programms
.
push_back
(
new
DeviceProgramm
(
IDBase
<
Device
>::
getIDBaseObjectByID
(
o
[
"device"
]),
IDBase
<
ProgrammPrototype
>::
getIDBaseObjectByID
(
o
[
"programmPrototype"
]),
o
[
"offset"
].
toDouble
()));
emit
deviceProgrammAdded
(
programms
.
back
());
connect
(
programms
.
back
(),
&
DeviceProgramm
::
destroyed
,
this
,
&
Programm
::
deviceProgrammDeleted
);
...
...
programm.h
View file @
d8bfa9ae
...
...
@@ -36,7 +36,13 @@ public:
*/
Q_SLOT
void
setSpeed
(
double
s
){
if
(
s
==
speed
)
return
;
speed
=
s
;
emit
speedChanged
(
speed
);}
double
getSpeed
()
const
{
return
speed
;}
DeviceProgramm
(
Device
*
device
,
ProgrammPrototype
*
programmPrototype
,
double
offset
)
:
QObject
(
device
),
programmPrototype
(
programmPrototype
),
offset
(
offset
),
device
(
device
){
connect
(
programmPrototype
,
&
ProgrammPrototype
::
destroyed
,
this
,
&
DeviceProgramm
::
programmPrototypeDeleted
);}
DeviceProgramm
(
Device
*
device
,
ProgrammPrototype
*
programmPrototype
,
double
offset
)
:
QObject
(
device
),
programmPrototype
(
programmPrototype
),
offset
(
offset
),
device
(
device
){
if
(
!
device
)
throw
new
std
::
runtime_error
(
"Nullpointer Exception: device is nullptr"
);
if
(
!
programmPrototype
)
throw
new
std
::
runtime_error
(
"Nullpointer Exception: programmPrototype is nullptr"
);
connect
(
programmPrototype
,
&
ProgrammPrototype
::
destroyed
,
this
,
&
DeviceProgramm
::
programmPrototypeDeleted
);
}
bool
setProgrammPrototype
(
ProgrammPrototype
*
p
){
if
(
p
->
devicePrototype
!=
device
->
prototype
){
return
false
;
...
...
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