Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
preinjectorhv-gui
Manage
Activity
Members
Labels
Plan
Issues
0
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
preinjectorhv-gui
Commits
e85459df
Commit
e85459df
authored
4 years ago
by
Lucio Zambon
Browse files
Options
Downloads
Patches
Plain Diff
Add new file
parent
1c7c49c5
Branches
master
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main.cpp
+80
-0
80 additions, 0 deletions
src/main.cpp
with
80 additions
and
0 deletions
src/main.cpp
0 → 100644
+
80
−
0
View file @
e85459df
/***************************************************************************
* Copyright (C) 2006 by LZ *
* *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include
<TApplication>
#include
"hv.h"
#include
<X11/Xlib.h>
#include
<QX11Info>
#include
<tutil.h>
#include
<QMessageBox>
int
main
(
int
argc
,
char
**
argv
)
{
TApplication
a
(
argc
,
argv
);
TUtil
::
instance
()
->
setLoggingTarget
(
argv
[
0
]);
if
(
argc
<
2
)
{
QMessageBox
::
information
(
0
,
"Error in startup parameters"
,
QString
(
"Error starting the program
\"
%1
\"\n
Usage:
\n
"
"%1 modulator_number
\n
"
"modulator_number: [1|2]
\n
"
).
arg
(
argv
[
0
]).
arg
(
argv
[
0
]));
exit
(
EXIT_FAILURE
);
}
/*
Rewrite parameters passed from command line. This is due to an unfair
constraint which limit the command line parameters to any Tango device
i.e. you can use parameters to connect a panel to whichever device
regardless of any assumption done by widgets in panel, but you cannot
pass any other type of parameter for whichever pursue it can be usefull.
The trick used here is to parse the appropriate command line parameters
and rewrite them in order to satisfy the completely misconceived
assumptions done by the method replaceWildcards()
*/
QString
paramString
;
if
(
!
strcmp
(
argv
[
1
],
"1"
))
{
paramString
=
"p/mod/ross_p1 p/mod/hv_p1 p/mod/general_p1 booster/interlock/mod1"
;
}
else
if
(
!
strcmp
(
argv
[
1
],
"2"
))
{
paramString
=
"p/mod/ross_p2 p/mod/hv_p2 p/mod/general_p2 booster/interlock/mod2"
;
}
else
if
(
!
strcmp
(
argv
[
1
],
"10"
))
{
paramString
=
"f/mod/ross_f10 f/mod/hv_f10 f/mod/general_f10 f/mod/intlk_f10"
;
}
else
{
QMessageBox
::
information
(
0
,
"Error in startup parameters"
,
QString
(
"Error starting the program
\"
%1 %2
\"\n
Usage:
\n
"
"%1 modulator_number
\n
"
"modulator_number: [1|2]
\n
"
).
arg
(
argv
[
0
]).
arg
(
argv
[
1
]));
exit
(
EXIT_FAILURE
);
}
QStringList
paramArray
=
paramString
.
split
(
" "
);
hv
mw
;
// TUtil::replaceWildcards(mw.children(), a.arguments());
TUtil
::
replaceWildcards
(
mw
.
children
(),
paramArray
);
mw
.
setWindowTitle
(
QString
(
"Mod %1 HV"
).
arg
(
qApp
->
arguments
().
at
(
1
)));
mw
.
show
();
/* register to window manager */
Display
*
disp
=
QX11Info
::
display
();
Window
root_win
=
(
Window
)
mw
.
winId
();
XSetCommand
(
disp
,
root_win
,
QApplication
::
argv
(),
QApplication
::
argc
());
return
a
.
exec
();
}
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