Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mscr
Manage
Activity
Members
Labels
Plan
Issues
1
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs
gui
mscr
Commits
dd320527
Commit
dd320527
authored
3 years ago
by
Giacomo Strangolino
Browse files
Options
Downloads
Patches
Plain Diff
cumbia porting - ticket 14825
parent
9bb44b0f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
CHANGELOG
+4
-1
4 additions, 1 deletion
CHANGELOG
mscr.pro
+70
-4
70 additions, 4 deletions
mscr.pro
src/main.cpp
+24
-21
24 additions, 21 deletions
src/main.cpp
src/mscr.cpp
+157
-171
157 additions, 171 deletions
src/mscr.cpp
src/mscr.h
+29
-17
29 additions, 17 deletions
src/mscr.h
src/mscr.ui
+1757
-2182
1757 additions, 2182 deletions
src/mscr.ui
with
2041 additions
and
2396 deletions
CHANGELOG
+
4
−
1
View file @
dd320527
1.0.2 a. cumbia porting
b. layouts
c. fixes to writers in polar Polar attenuation
d. avoid setSource if elements are invisible
release_13: porting to qtango6 (installed in /usr/local/qtango) and qt5
...
...
This diff is collapsed.
Click to expand it.
mscr.pro
+
70
−
4
View file @
dd320527
include
(
/
usr
/
local
/
qtango
/
include
/
qtango6
/
qtango
.
pri
)
isEmpty
(
CUMBIA_ROOT
)
{
CUMBIA_ROOT
=/
usr
/
local
/
cumbia
-
libs
}
include
(
$$
{
CUMBIA_ROOT
}
/
include
/
quapps
/
quapps
.
pri
)
RESOURCES
=
mscr
.
qrc
#
CONFIG
+=
debug
|
release
DEFINES
-=
QT_NO_DEBUG_OUTPUT
RESOURCES
+=
mscr
.
qrc
SOURCES
+=
src
/
mscr
.
cpp
\
src
/
main
.
cpp
HEADERS
+=
src
/
mscr
.
h
FORMS
=
src
/
mscr
.
ui
#
cuuimake
runs
uic
#
FORMS
=
src
/
mscr
.
ui
#
#
but
we
need
to
include
ui_xxxx
.
h
file
amongst
the
headers
#
in
order
to
be
recompiled
when
it
changes
#
HEADERS
+=
\
ui_mscr
.
h
#
-
ui
:
where
to
find
cuuimake
ui_
*.
h
files
#
since
FORMS
is
not
used
#
-
src
:
where
to
find
headers
included
by
#
ui_
*.
h
(
e
.
g
.
for
custom
widget
promoted
#
from
the
Qt
designer
)
#
INCLUDEPATH
+=
ui
src
TARGET
=
mscr
-
gui
!
wasm
-
emscripten
{
TARGET
=
bin
/
$$
{
TARGET
}
}
else
{
TARGET
=
wasm
/
$$
{
TARGET
}
}
#
#
make
install
works
if
INSTALL_DIR
is
given
to
qmake
#
!
isEmpty
(
INSTALL_DIR
)
{
wasm
-
emscripten
{
inst
.
files
=
wasm
/*
} else {
inst.files = $${TARGET}
}
inst.path = $${INSTALL_DIR}
INSTALLS += inst
message("-")
message("INSTALLATION")
message(" execute `make install` to install '$PROJECT_NAME$' under $${INSTALL_DIR} ")
message("-")
} else {
message("-")
message("INSTALLATION")
message(" call qmake INSTALL_DIR=/usr/local/bin to install $PROJECT_NAME$ later with `make install` ")
message("-")
}
# unix:LIBS += -L. -lmylib
# unix:INCLUDEPATH += . ../../src
message("-")
message("NOTE")
message("You need to run cuuimake in order to build the project")
message("-")
message(" cuuimake --show-config to see cuuimake configuration options")
message(" cuuimake --configure to configure cuuimake")
message(" cuuimake -jN to execute cuuimake and then make -jN")
message(" cuuimake --make to run cuuimake and then make")
message("-")
TARGET
=
bin
/
mscr
-
gui
This diff is collapsed.
Click to expand it.
src/main.cpp
+
24
−
21
View file @
dd320527
...
...
@@ -30,37 +30,40 @@
* your version. *
***************************************************************************/
#include
<TApplication>
// #include <TApplication>
// cumbia
#include
<cumbiapool.h>
#include
<cuthreadfactoryimpl.h>
#include
<qthreadseventbridgefactory.h>
// cumbia
#include
<quapplication.h>
#include
"mscr.h"
#include
<tutil.h>
#include
<X11/Xlib.h>
#include
<QX11Info>
#include
<TSplashScreen>
#include
<elettracolors.h>
#define CVSVERSION "$Name: $"
int
main
(
int
argc
,
char
**
argv
)
{
const
char
*
cvs_version
=
CVSVERSION
;
TApplication
a
(
argc
,
argv
);
a
.
setPalette
(
EPalette
(
"fermi"
));
a
.
setApplicationVersion
(
cvs_version
);
TUtil
::
instance
()
->
setLoggingTarget
(
argv
[
0
]);
TSplashScreen
splash
;
mscr
mw
;
QuApplication
qu_app
(
argc
,
argv
);
CumbiaPool
*
cu_p
=
new
CumbiaPool
();
mscr
*
w
=
new
mscr
(
cu_p
,
0
);
if
(
argc
>
1
)
{
mw
.
setWindowTitle
(
T
Application
::
instance
()
->
arguments
()[
1
].
split
(
'/'
).
last
());
w
->
setWindowTitle
(
Qu
Application
::
instance
()
->
arguments
()[
1
].
split
(
'/'
).
last
());
// TApplication is mapped into QuApplication. DBus connection is provided by cumbia dbus plugin // ## added by qumbiaprojectwizard
}
else
{
mw
.
setWindowTitle
(
"mscr"
);
w
->
setWindowTitle
(
"mscr"
);
}
mw
.
show
();
splash
.
finish
(
&
mw
);
w
->
show
();
/* register to window manager */
Display
*
disp
=
QX11Info
::
display
();
Window
root_win
=
(
Window
)
mw
.
winId
();
Window
root_win
=
(
Window
)
w
->
winId
();
XSetCommand
(
disp
,
root_win
,
argv
,
argc
);
return
a
.
exec
();
// exec application loop
int
ret
=
qu_app
.
exec
();
// delete resources and return
delete
w
;
for
(
std
::
string
n
:
cu_p
->
names
())
if
(
cu_p
->
get
(
n
))
delete
cu_p
->
get
(
n
);
return
ret
;
}
This diff is collapsed.
Click to expand it.
src/mscr.cpp
+
157
−
171
View file @
dd320527
...
...
@@ -30,53 +30,68 @@
* your version. *
***************************************************************************/
// cumbia
#include
<cumbiapool.h>
#include
<cuserviceprovider.h>
#include
<cumacros.h>
#include
<quapps.h>
#include
<quwatcher.h>
#include
<quwriter.h>
// cumbia
#include
"mscr.h"
#include
<qtango.h>
mscr
::
mscr
(
QWidget
*
parent
)
:
QWidget
(
parent
)
{
ui
.
setupUi
(
this
);
timer
=
new
QTimer
(
this
);
connect
(
timer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
refresh
()));
connect
(
ui
.
position0_radioButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
setPosition0
()));
connect
(
ui
.
position1_radioButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
setPosition1
()));
connect
(
ui
.
position2_radioButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
setPosition2
()));
connect
(
ui
.
position3_radioButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
setPosition3
()));
connect
(
ui
.
position4_radioButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
setPosition4
()));
connect
(
ui
.
lightLevel_comboBox
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
setLightLevel
(
int
)));
connect
(
ui
.
lightLevel_comboBox_2
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
setLightLevel2
(
int
)));
DeviceData
dd
;
#include
<QTimer>
mscr
::
mscr
(
CumbiaPool
*
cumbia_pool
,
QWidget
*
parent
)
:
QWidget
(
parent
)
{
// cumbia
CuModuleLoader
mloader
(
cumbia_pool
,
&
m_ctrl_factory_pool
,
&
m_log_impl
);
cu_pool
=
cumbia_pool
;
ui
=
new
Ui
::
mscr
;
ui
->
setupUi
(
this
,
cu_pool
,
m_ctrl_factory_pool
);
foreach
(
QString
s
,
QStringList
()
<<
"gbLightLevel2"
<<
"attenuator2_groupBox"
<<
"verSlit_groupBox"
<<
"horSlit_groupBox"
)
findChild
<
QGroupBox
*>
(
s
)
->
setVisible
(
false
);
// wait for mscr status and instrument list ready
QTimer
*
tmr_checkConfigReady
=
new
QTimer
(
this
);
tmr_checkConfigReady
->
setInterval
(
500
);
tmr_checkConfigReady
->
setObjectName
(
"checkConfigTmr"
);
connect
(
tmr_checkConfigReady
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
checkConfigReady
()));
tmr_checkConfigReady
->
start
();
// mloader.modules() to get the list of loaded modules
// cumbia
if
(
QApplication
::
arguments
().
size
()
>
1
)
{
try
{
tangodev
=
QApplication
::
arguments
()[
1
];
server
=
DeviceFactory
::
instance
()
->
create
(
tangodev
);
server
->
read_attribute
(
"MscrStatus"
)
>>
mscrStatus
;
dd
=
server
->
command_inout
(
"GetInstrumentList"
);
dd
>>
instruments
;
setPolarAttenuation
();
std
::
string
contr_type
;
server
->
read_attribute
(
"ControllerType"
)
>>
contr_type
;
if
(
contr_type
.
substr
(
0
,
5
)
!=
"IFC-B"
){
//ui.tabWidget->setTabEnabled(3,false);
ui
.
tabWidget
->
removeTab
(
3
);
}
}
catch
(
Tango
::
DevFailed
&
ex
)
{
simpleLog
::
error
(
"mscr::mscr"
,
ex
.
errors
);
exit
(
1
);
}
catch
(...)
{
simpleLog
::
error
(
"mscr::mscr"
,
"Unexpected exception occurred."
);
exit
(
1
);
}
QuWatcher
*
w
=
new
QuWatcher
(
this
,
cumbia_pool
,
m_ctrl_factory_pool
);
w
->
attach
(
this
,
SLOT
(
onMscrStatus
(
const
QVector
<
bool
>&
)));
w
->
setSource
(
"$1/MscrStatus"
);
Qu1TWatcher
*
w1
=
new
Qu1TWatcher
(
this
,
cumbia_pool
,
m_ctrl_factory_pool
);
w1
->
attach
(
this
,
SLOT
(
onControllerType
(
const
QString
&
)));
w1
->
setSource
(
"$1/ControllerType"
);
Qu1TWatcher
*
w2
=
new
Qu1TWatcher
(
this
,
cumbia_pool
,
m_ctrl_factory_pool
);
w2
->
attach
(
&
m_instruments
);
w2
->
setSource
(
"$1->GetInstrumentList"
);
Qu1TWatcher
*
llw
=
new
Qu1TWatcher
(
this
,
cumbia_pool
,
m_ctrl_factory_pool
);
llw
->
attach
(
this
,
SLOT
(
onLightLevelReady
(
int
)));
llw
->
setSource
(
"$1/LightLevel"
);
// position
QuWatcher
*
pos_w
=
new
QuWatcher
(
this
,
cumbia_pool
,
m_ctrl_factory_pool
);
pos_w
->
attach
(
this
,
SLOT
(
onPositionReady
(
int
)));
// onPositionReady connects radio buttons
pos_w
->
setSource
(
"$1/Selector"
);
ui
->
qio_polar1Attenuation
->
setSource
(
"$1/Polar1Attenuation"
);
}
else
{
usage
();
exit
(
1
);
}
initWidgets
();
refresh
();
timer
->
start
(
1000
);
resize
(
minimumSizeHint
());
}
mscr
::~
mscr
()
{
...
...
@@ -90,162 +105,133 @@ void mscr::usage() {
}
void
mscr
::
initWidgets
()
{
qDebug
()
<<
__PRETTY_FUNCTION__
<<
m_mscrStatus
<<
m_instruments
;
// light level (straight)
ui
->
gbLightLevel2
->
setVisible
(
m_mscrStatus
[
3
]);
ui
->
attenuator2_groupBox
->
setVisible
(
m_mscrStatus
[
3
]);
//2
if
(
ui
->
gbLightLevel2
->
isVisible
())
{
ui
->
qulLightLevel2
->
setSource
(
"$1/LightLevel2"
);
ui
->
qio_polar2Attenuation
->
setSource
(
"$1/Polar2Attenuation"
);
QuWatcher
*
ll2w
=
new
QuWatcher
(
this
,
cu_pool
,
m_ctrl_factory_pool
);
ll2w
->
attach
(
this
,
SLOT
(
onLightLevel2Ready
(
int
)));
ll2w
->
setSource
(
"$1/LightLevel2"
);
}
ui
->
verSlit_groupBox
->
setEnabled
(
m_mscrStatus
[
6
]);
//5
ui
->
verSlit_groupBox
->
setVisible
(
m_mscrStatus
[
5
]);
//4
if
(
ui
->
verSlit_groupBox
->
isVisible
())
ui
->
qioVSlit
->
setSource
(
"$1/VerSlitPosition"
);
ui
->
stepperHorStatus_groupBox
->
setVisible
(
m_mscrStatus
[
5
]);
//4
ui
->
horSlit_groupBox
->
setEnabled
(
m_mscrStatus
[
7
]);
//4
ui
->
horSlit_groupBox
->
setVisible
(
m_mscrStatus
[
5
]);
//4
if
(
ui
->
horSlit_groupBox
->
isVisible
())
ui
->
qioHSlit
->
setSource
(
"$1/HorSlitPosition"
);
// Status tab
ui
->
polar2Status_groupBox
->
setVisible
(
m_mscrStatus
[
3
]);
//2
if
(
ui
->
polar2Status_groupBox
->
isVisible
())
ui
->
qutable_polar2Status
->
setSource
(
"$1/Polar2Status"
);
ui
->
stepperVerStatus_groupBox
->
setVisible
(
m_mscrStatus
[
5
]);
//4
if
(
ui
->
stepperVerStatus_groupBox
->
isVisible
())
ui
->
qutable_stepperVerStatus
->
setSource
(
"$1/StepperVerStatus"
);
ui
.
polar2Status_groupBox
->
setVisible
(
mscrStatus
[
3
]);
//2
ui
.
attenuator2_groupBox
->
setVisible
(
mscrStatus
[
3
]);
//2
ui
.
lightLevel_comboBox_2
->
setVisible
(
mscrStatus
[
3
]);
//2
ui
.
tLabelLightLevel_2
->
setVisible
(
mscrStatus
[
3
]);
//2
ui
.
label_41
->
setVisible
(
mscrStatus
[
3
]);
//2
ui
.
stepperVerStatus_groupBox
->
setVisible
(
mscrStatus
[
5
]);
//4
ui
.
verSlit_groupBox
->
setVisible
(
mscrStatus
[
5
]);
//4
ui
.
verSlit_groupBox
->
setEnabled
(
mscrStatus
[
6
]);
//5
ui
.
stepperHorStatus_groupBox
->
setVisible
(
mscrStatus
[
5
]);
//4
ui
.
horSlit_groupBox
->
setVisible
(
mscrStatus
[
5
]);
//4
ui
.
horSlit_groupBox
->
setEnabled
(
mscrStatus
[
7
]);
//4
ui
.
position0_radioButton
->
setText
(
QString
(
instruments
[
0
].
c_str
()));
ui
.
position1_radioButton
->
setText
(
QString
(
instruments
[
1
].
c_str
()));
if
(
instruments
.
size
()
>
2
)
{
ui
.
position2_radioButton
->
setText
(
QString
(
instruments
[
2
].
c_str
()));
ui
->
stepperHorStatus_groupBox
->
setVisible
(
m_mscrStatus
[
5
]);
//4
if
(
ui
->
stepperHorStatus_groupBox
->
isVisible
())
ui
->
qutable_stepperHorStatus
->
setSource
(
"$1/StepperHorStatus"
);
ui
->
rbp0
->
setText
(
QString
(
m_instruments
[
0
]));
ui
->
rbp1
->
setText
(
QString
(
m_instruments
[
1
]));
if
(
m_instruments
.
size
()
>
2
)
{
ui
->
rbp2
->
setText
(
QString
(
m_instruments
[
2
]));
}
else
{
ui
.
position2_radioButton
->
setHidden
(
true
);
ui
->
rbp2
->
setHidden
(
true
);
}
if
(
instruments
.
size
()
>
3
)
{
ui
.
position3_radioButton
->
setText
(
QString
(
instruments
[
3
]
.
c_str
()
));
if
(
m_
instruments
.
size
()
>
3
)
{
ui
->
rbp3
->
setText
(
QString
(
m_
instruments
[
3
]));
}
else
{
ui
.
position3_radioButton
->
setHidden
(
true
);
ui
->
rbp3
->
setHidden
(
true
);
}
if
(
instruments
.
size
()
>
4
)
{
ui
.
position4_radioButton
->
setText
(
QString
(
instruments
[
4
]
.
c_str
()
));
if
(
m_
instruments
.
size
()
>
4
)
{
ui
->
rbp4
->
setText
(
QString
(
m_
instruments
[
4
]));
}
else
{
ui
.
position4_radioButton
->
setHidden
(
true
);
ui
->
rbp4
->
setHidden
(
true
);
}
}
void
mscr
::
setPolarAttenuation
()
{
// #1
if
(
mscrStatus
[
1
])
{
// discrete
ui
.
polar1Attenuation_tReaderWriter
->
setWriterType
(
TReaderWriter
::
ComboBox
);
void
mscr
::
onControllerType
(
const
QString
&
contr_type
)
{
if
(
!
contr_type
.
startsWith
(
"IFC-B"
)){
ui
->
tabWidget
->
removeTab
(
3
);
}
ui
.
polar1Attenuation_tReaderWriter
->
setSource
(
"$1/Polar1Attenuation"
);
// #2
if
(
mscrStatus
[
2
]
and
mscrStatus
[
3
])
{
// present & discrete
ui
.
polar2Attenuation_tReaderWriter
->
setWriterType
(
TReaderWriter
::
ComboBox
);
}
ui
.
polar2Attenuation_tReaderWriter
->
setSource
(
"$1/Polar2Attenuation"
);
}
void
mscr
::
refresh
()
{
try
{
// position -------------
server
->
read_attribute
(
"Selector"
)
>>
position
;
QFont
fontNorma
,
fontBold
;
fontNorma
.
setBold
(
false
);
fontBold
.
setBold
(
true
);
qDebug
()
<<
"mscr::refresh position="
<<
position
;
ui
.
position0_radioButton
->
setFont
(
fontNorma
);
ui
.
position1_radioButton
->
setFont
(
fontNorma
);
ui
.
position2_radioButton
->
setFont
(
fontNorma
);
ui
.
position3_radioButton
->
setFont
(
fontNorma
);
ui
.
position4_radioButton
->
setFont
(
fontNorma
);
switch
(
position
)
{
case
0
:
ui
.
position0_radioButton
->
setChecked
(
true
);
ui
.
position0_radioButton
->
setFont
(
fontBold
);
break
;
case
1
:
ui
.
position1_radioButton
->
setChecked
(
true
);
ui
.
position1_radioButton
->
setFont
(
fontBold
);
break
;
case
2
:
ui
.
position2_radioButton
->
setChecked
(
true
);
ui
.
position2_radioButton
->
setFont
(
fontBold
);
break
;
case
3
:
ui
.
position3_radioButton
->
setChecked
(
true
);
ui
.
position3_radioButton
->
setFont
(
fontBold
);
break
;
case
4
:
ui
.
position4_radioButton
->
setChecked
(
true
);
ui
.
position4_radioButton
->
setFont
(
fontBold
);
}
// light -------------
short
lightLevel
;
server
->
read_attribute
(
"LightLevel"
)
>>
lightLevel
;
ui
.
lightLevel_comboBox
->
setCurrentIndex
((
int
)
lightLevel
);
// light 2 -------------
if
(
ui
.
lightLevel_comboBox_2
->
isVisible
()){
short
lightLevel2
;
server
->
read_attribute
(
"LightLevel2"
)
>>
lightLevel2
;
ui
.
lightLevel_comboBox_2
->
setCurrentIndex
((
int
)
lightLevel2
);
}
// slits -------------
vector
<
bool
>
mscrStatus
;
server
->
read_attribute
(
"MscrStatus"
)
>>
mscrStatus
;
ui
.
verSlit_groupBox
->
setEnabled
(
mscrStatus
[
5
]);
ui
.
horSlit_groupBox
->
setEnabled
(
mscrStatus
[
6
]);
}
catch
(
Tango
::
DevFailed
&
ex
)
{
simpleLog
::
error
(
"mscr::refresh"
,
ex
.
errors
);
}
catch
(...)
{
simpleLog
::
error
(
"mscr::refresh"
,
"Unexpected exception occurred on reading the attribute."
);
void
mscr
::
checkConfigReady
()
{
printf
(
"mscr::checkConfigReady() enter
\n
"
);
// init widgets when both instrument list and mscr status are ready
if
(
m_instruments
.
size
()
>
0
&&
this
->
m_mscrStatus
.
size
()
>
0
)
{
delete
findChild
<
QTimer
*
>
(
"checkConfigTmr"
);
initWidgets
();
}
}
void
mscr
::
setPosition0
()
{
if
(
position
!=
0
)
{
setPosition
(
0
);
}
}
void
mscr
::
setPosition1
()
{
if
(
position
!=
1
)
{
setPosition
(
1
);
}
void
mscr
::
onLightLevelReady
(
int
ll
)
{
ui
->
lightLevel_comboBox
->
setCurrentIndex
(
ll
);
connect
(
ui
->
lightLevel_comboBox
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
setLightLevel
(
int
)));
}
void
mscr
::
setPosition2
()
{
if
(
position
!=
2
)
{
setPosition
(
2
);
}
void
mscr
::
onLightLevel2Ready
(
int
ll
)
{
ui
->
lightLevel_comboBox_2
->
setCurrentIndex
(
ll
);
connect
(
ui
->
lightLevel_comboBox_2
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
setLightLevel2
(
int
)));
}
void
mscr
::
setPosition3
()
{
if
(
position
!=
3
)
{
setPosition
(
3
);
void
mscr
::
onPositionReady
(
int
position
)
{
QFont
fontNorma
,
fontBold
;
fontNorma
.
setBold
(
false
);
fontBold
.
setBold
(
true
);
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
QRadioButton
*
rb
=
ui
->
selector_groupBox
->
findChild
<
QRadioButton
*>
(
QString
(
"rbp%1"
).
arg
(
i
));
rb
->
disconnect
();
position
==
i
?
rb
->
setFont
(
fontBold
)
:
rb
->
setFont
(
fontNorma
);
rb
->
setChecked
(
position
==
i
);
connect
(
rb
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
onPositionRbChecked
(
bool
)));
}
}
void
mscr
::
setPosition4
()
{
if
(
position
!=
4
)
{
setPosition
(
4
);
}
void
mscr
::
onMscrStatus
(
const
QVector
<
bool
>&
s
)
{
m_mscrStatus
=
std
::
move
(
s
);
ui
->
verSlit_groupBox
->
setEnabled
(
m_mscrStatus
[
5
]);
ui
->
horSlit_groupBox
->
setEnabled
(
m_mscrStatus
[
6
]);
}
void
mscr
::
setPosition
(
short
newPosition
)
{
try
{
Tango
::
DeviceAttribute
attr
(
"Selector"
,
newPosition
);
server
->
write_attribute
(
attr
);
}
catch
(...)
{
simpleLog
::
error
(
"mscr::setPosition"
,
"Unexpected exception occurred on writing the attribute 'Selector'."
);
void
mscr
::
onPositionRbChecked
(
bool
c
)
{
if
(
c
)
{
printf
(
"mscr::onPositionRbChecked %s checked %d
\n
"
,
qstoc
(
sender
()
->
objectName
()),
c
);
int
p
=
sender
()
->
objectName
().
remove
(
"rbp"
).
toInt
();
QuWriter
*
w
=
new
QuWriter
(
this
,
cu_pool
,
m_ctrl_factory_pool
);
w
->
setAutoDestroy
(
true
);
w
->
setTarget
(
"$1/Selector"
);
w
->
execute
(
p
);
}
}
void
mscr
::
setLightLevel
(
int
newLevel
)
{
try
{
Tango
::
DeviceAttribute
attr
(
"LightLevel"
,
(
short
int
)
newLevel
);
server
->
write_attribute
(
attr
);
}
catch
(...)
{
simpleLog
::
error
(
"mscr::setLightLevel"
,
"Unexpected exception occurred on writing the attribute 'LightLevel'."
);
}
QuWriter
*
w
=
new
QuWriter
(
this
,
cu_pool
,
m_ctrl_factory_pool
);
w
->
setAutoDestroy
(
true
);
w
->
setTarget
(
"$1/LightLevel"
);
w
->
execute
(
newLevel
);
}
void
mscr
::
setLightLevel2
(
int
newLevel
)
{
try
{
Tango
::
DeviceAttribute
attr
(
"LightLevel2"
,
(
short
int
)
newLevel
);
server
->
write_attribute
(
attr
);
}
catch
(...)
{
simpleLog
::
error
(
"mscr::setLightLevel2"
,
"Unexpected exception occurred on writing the attribute 'LightLevel2'."
);
}
QuWriter
*
w
=
new
QuWriter
(
this
,
cu_pool
,
m_ctrl_factory_pool
);
w
->
setAutoDestroy
(
true
);
w
->
setTarget
(
"$1/LightLevel2"
);
w
->
execute
(
newLevel
);
}
This diff is collapsed.
Click to expand it.
src/mscr.h
+
29
−
17
View file @
dd320527
...
...
@@ -33,41 +33,53 @@
#ifndef mscr_H
#define mscr_H
// cumbia
#include
<qulogimpl.h>
#include
<cucontrolsfactorypool.h>
class
CumbiaPool
;
// cumbia
#include
"ui_mscr.h"
#include
"simpleLog.h"
#include
<device_factory.h>
class
mscr
:
public
QWidget
{
Q_OBJECT
public
slots
:
void
refresh
();
void
setPosition0
();
void
setPosition1
();
void
setPosition2
();
void
setPosition3
();
void
setPosition4
();
void
setLightLevel
(
int
);
void
setLightLevel2
(
int
);
public:
mscr
(
QWidget
*
=
NULL
);
mscr
(
CumbiaPool
*
cu_p
,
QWidget
*
=
NULL
);
~
mscr
();
void
usage
();
private:
Ui
::
mscr
ui
;
QString
tangodev
;
Tango
::
DeviceProxy
*
server
;
QTimer
*
timer
;
short
position
;
void
setPosition
(
short
);
// Ui::mscr ui;
Ui
::
mscr
*
ui
;
void
initWidgets
();
vector
<
bool
>
mscrStatus
;
vector
<
string
>
instruments
;
void
setPolarAttenuation
();
// cumbia
CumbiaPool
*
cu_pool
;
QuLogImpl
m_log_impl
;
CuControlsFactoryPool
m_ctrl_factory_pool
;
// cumbia
QVector
<
bool
>
m_mscrStatus
;
QStringList
m_instruments
;
private
slots
:
void
onControllerType
(
const
QString
&
);
void
checkConfigReady
();
void
onLightLevelReady
(
int
ll
);
void
onLightLevel2Ready
(
int
ll
);
void
onPositionReady
(
int
position
);
void
onMscrStatus
(
const
QVector
<
bool
>&
s
);
void
onPositionRbChecked
(
bool
c
);
};
#endif
This diff is collapsed.
Click to expand it.
src/mscr.ui
+
1757
−
2182
View file @
dd320527
This diff is collapsed.
Click to expand it.
Preview
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!
Save comment
Cancel
Please
register
or
sign in
to comment