Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Leander Schulten
Lichtsteuerung
Commits
01b7b1d7
Commit
01b7b1d7
authored
Jan 07, 2019
by
Leander Schulten
Browse files
Support loading of LoopPrograms
parent
682a6745
Changes
2
Hide whitespace changes
Inline
Side-by-side
programms/modulemanager.cpp
View file @
01b7b1d7
...
...
@@ -150,7 +150,10 @@ typedef Modules::Program* (*CreateProgramm)(unsigned int index);
for
(
int
counter
=
0
;
;
++
counter
){
auto
fileName
=
name
+
"____"
+
QString
::
number
(
counter
)
+
SHARED_LIB_FILE_SUFFIX
;
if
(
!
QFileInfo
::
exists
(
fileName
)
&&!
QFileInfo
::
exists
(
fileName
+
".old"
)){
Q_ASSERT
(
QFile
::
rename
(
name
,
fileName
));
if
(
!
QFile
::
rename
(
name
,
fileName
)){
auto
msg
=
(
"Renaming from "
+
name
+
" to "
+
fileName
+
" does not work"
).
toLatin1
();
qCritical
(
msg
.
data
());
}
return
fileName
;
}
}
...
...
@@ -180,7 +183,15 @@ typedef Modules::Program* (*CreateProgramm)(unsigned int index);
}
});
}
if
(
f
(
MODUL_TYPE
::
LoopProgram
)){
//loadType(lib,programms,"LoopProgramm",lastLibraryIdentifier);
loadType
(
lib
,
programms
,
"LoopProgram"
,
lastLibraryIdentifier
,[
&
](
const
auto
p
){
if
(
replaceNewInPBs
){
for
(
const
auto
&
pb
:
ProgramBlockManager
::
model
){
for
(
const
auto
&
v
:
pb
->
getUsedProgramsByName
(
p
->
name
())){
pb
->
replaceProgram
(
v
,
std
::
shared_ptr
<
Program
>
(
p
->
create
()));
}
}
}
});
}
if
(
f
(
MODUL_TYPE
::
Filter
)){
loadType
(
lib
,
filter
,
"Filter"
,
lastLibraryIdentifier
,[
&
](
const
auto
p
){
if
(
replaceNewInPBs
){
...
...
programms/modulemanager.h
View file @
01b7b1d7
...
...
@@ -8,6 +8,8 @@
#include
"consumer.hpp"
#include
<cstring>
#include
"property.hpp"
#include
"programms/loopprogram.hpp"
#include
"programms/boostloopprogramcontextswitcher.h"
#include
<QString>
#include
<QFile>
...
...
@@ -321,7 +323,16 @@ signals:
for
(
unsigned
int
i
=
0
;
i
<
getNumberOfProgramms
();
++
i
){
const
auto
name
=
getNameOfProgramm
(
i
);
const
auto
desc
=
getDescriptionOfProgramm
(
i
);
const
auto
func
=
[
=
](){
return
createProgramm
(
i
);};
std
::
function
<
Type
*
(
void
)
>
func
=
[](){
return
nullptr
;};
if
(
"LoopProgram"
s
==
Typename
){
func
=
[
=
]()
->
Type
*
{
LoopProgram
*
lp
=
static_cast
<
LoopProgram
*>
(
static_cast
<
void
*>
(
createProgramm
(
i
)));
lp
->
setContextSwitcher
(
std
::
make_unique
<
BoostLoopProgramContextSwitcher
>
());
return
static_cast
<
Type
*>
(
static_cast
<
void
*>
(
lp
));
};
}
else
{
func
=
[
=
](){
return
createProgramm
(
i
);};
}
auto
iter
=
c
.
find
({
name
,
desc
});
const
detail
::
Entry
<
Type
>
*
p
;
if
(
iter
!=
c
.
cend
()){
// remove old entry if exists
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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