ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
graphics
VP1
VP1Gui
src
VP1PluginDialog.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// //
7
// Implementation of class VP1PluginDialog //
8
// //
9
// Author: Thomas Kittelmann <Thomas.Kittelmann@cern.ch> //
10
// //
11
// Initial version: April 2007 //
12
// //
14
15
#include "
VP1Gui/VP1PluginDialog.h
"
16
#include "ui_vp1plugindialog.h"
17
#include "
VP1Gui/VP1ChannelManager.h
"
18
#include "
VP1Gui/VP1ExecutionScheduler.h
"
19
#include "
VP1Base/IVP1ChannelWidget.h
"
20
#include <QFileInfo>
21
#include <cassert>
22
23
//____________________________________________________________________
24
class
VP1PluginDialog::Imp
{
25
public
:
26
VP1PluginDialog
*
pd
{};
27
VP1ChannelManager
*
channelmanager
{};
28
VP1ExecutionScheduler
*
scheduler
{};
29
void
setInfo
();
30
QLabel *
label_selectplugin
{};
31
QComboBox *
comboBox_plugins
{};
32
QLabel *
label_fullpathtitle
{};
33
QLabel *
label_fullpath
{};
34
QLabel *
label_channels
{};
35
QPushButton *
pushButton_unload
{};
36
QTextBrowser *
textBrowser_channels
{};
37
QMap<int,QString>
index_2_fullpath
;
38
QString
unloadfile
;
39
};
40
41
//____________________________________________________________________
42
VP1PluginDialog::VP1PluginDialog
(QWidget*parent,
VP1ChannelManager
*
cm
,
VP1ExecutionScheduler
*scheduler)
43
: QDialog(parent),
m_d
(new
Imp
)
44
{
45
m_d
->pd =
this
;
46
m_d
->channelmanager=
cm
;
47
m_d
->scheduler=scheduler;
48
Ui::VP1PluginDialog ui;
49
ui.setupUi(
this
);
50
ui.textBrowser_channels->viewport()->setBackgroundRole(QPalette::NoRole);
51
m_d
->label_selectplugin = ui.label_selectplugin;
52
m_d
->comboBox_plugins = ui.comboBox_plugins;
53
m_d
->label_fullpathtitle = ui.label_fullpathtitle;
54
m_d
->label_fullpath = ui.label_fullpath;
55
m_d
->label_channels = ui.label_channels;
56
m_d
->pushButton_unload = ui.pushButton_unload;
57
m_d
->textBrowser_channels = ui.textBrowser_channels;
58
m_d
->setInfo();
59
setModal(
true
);
60
connect(
m_d
->comboBox_plugins,SIGNAL(currentIndexChanged(
int
)),
this
,SLOT(
pluginSelected
(
int
)));
61
connect(
m_d
->pushButton_unload,SIGNAL(clicked()),
this
,SLOT(
unloadclicked
()));
62
connect(scheduler,SIGNAL(refreshingStatusChanged(
bool
)),
this
,SLOT(
updateRefreshInfo
()));
63
64
}
65
66
//____________________________________________________________________
67
void
VP1PluginDialog::unloadclicked
()
68
{
69
int
i =
m_d
->comboBox_plugins->currentIndex();
70
if
(i<0)
71
return
;
72
assert(
m_d
->index_2_fullpath.contains(i));
73
m_d
->unloadfile=
m_d
->index_2_fullpath.value(i);
74
accept();
75
}
76
77
//____________________________________________________________________
78
const
QString&
VP1PluginDialog::unloadfile
()
79
{
80
return
m_d
->unloadfile;
81
}
82
83
//____________________________________________________________________
84
VP1PluginDialog::~VP1PluginDialog
()
85
{
86
delete
m_d
;
m_d
=0;
87
}
88
89
//____________________________________________________________________
90
void
VP1PluginDialog::Imp::setInfo
()
91
{
92
QStringList
files
=
channelmanager
->currentPluginFiles();
93
comboBox_plugins
->clear();
94
index_2_fullpath
.clear();
95
if
(
files
.empty()) {
96
label_selectplugin
->setEnabled(
false
);
97
comboBox_plugins
->setEnabled(
false
);
98
label_fullpathtitle
->setEnabled(
false
);
99
label_fullpath
->setEnabled(
false
);
100
label_channels
->setEnabled(
false
);
101
pushButton_unload
->setEnabled(
false
);
102
label_fullpath
->setText(
"n/a"
);
103
comboBox_plugins
->addItem(
"No plugins loaded"
);
104
textBrowser_channels
->setHtml(
""
);
105
textBrowser_channels
->setEnabled(
false
);
106
}
else
{
107
label_selectplugin
->setEnabled(
true
);
108
comboBox_plugins
->setEnabled(
true
);
109
label_fullpathtitle
->setEnabled(
true
);
110
label_fullpath
->setEnabled(
true
);
111
label_channels
->setEnabled(
true
);
112
pushButton_unload
->setEnabled(
true
);
113
textBrowser_channels
->setEnabled(
true
);
114
115
int
i(0);
116
for
(
const
QString&
file
:
files
) {
117
QFileInfo fi(
file
);
118
comboBox_plugins
->addItem(fi.fileName());
119
index_2_fullpath
.insert(i++,
file
);
120
}
121
comboBox_plugins
->setCurrentIndex(0);
122
pd
->pluginSelected(0);
123
}
124
}
125
126
//____________________________________________________________________
127
void
VP1PluginDialog::pluginSelected
(
int
i)
128
{
129
assert(i<m_d->comboBox_plugins->count());
130
assert(
m_d
->index_2_fullpath.contains(i));
131
m_d
->label_fullpath->setText(
m_d
->index_2_fullpath.value(i));
132
QStringList availablechannels =
m_d
->channelmanager->channelsInPluginFile(
m_d
->index_2_fullpath.value(i));
133
if
(availablechannels.empty()) {
134
m_d
->textBrowser_channels->setHtml(
"none"
);
135
m_d
->textBrowser_channels->setEnabled(
false
);
136
}
else
{
137
QString text;
138
for
(
const
QString& bn : availablechannels) {
139
QStringList uns =
m_d
->channelmanager->basename2UniqueNames(bn);
140
bool
refreshing=
false
;
141
for
(
const
QString& un : uns) {
142
if
(
m_d
->channelmanager->hasRefreshingSystem(un))
143
refreshing=
true
;
144
IVP1ChannelWidget
* cw =
m_d
->channelmanager->uniqueName2Channel(un);
145
assert(cw);
146
connect(cw,SIGNAL(systemRefreshInfoChanged(QString,
int
,
int
)),
this
,SLOT(
updateRefreshInfo
()));
147
}
148
m_d
->pushButton_unload->setEnabled(!
m_d
->scheduler->isRefreshing());
149
QString icontext =
m_d
->channelmanager->getIconLocation(bn);
150
text += (icontext.isEmpty()?
""
:
"<img src=\""
+icontext+
"\">"
)+
"<i>"
151
+bn+(uns.empty()?
""
:
" ["
+QString::number(uns.count())
152
+
" active"
+(refreshing?
" (refreshing)"
:
""
)+
"]"
)+
"</i><br/>"
;
153
}
154
m_d
->textBrowser_channels->setHtml(text);
155
m_d
->textBrowser_channels->setEnabled(
true
);
156
}
157
}
158
159
//____________________________________________________________________
160
void
VP1PluginDialog::updateRefreshInfo
() {
161
int
i =
m_d
->comboBox_plugins->currentIndex();
162
if
(i!=-1)
163
pluginSelected
(i);
164
}
IVP1ChannelWidget.h
cm
const double cm
Definition
Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
VP1ChannelManager.h
VP1ExecutionScheduler.h
VP1PluginDialog.h
IVP1ChannelWidget
Definition
IVP1ChannelWidget.h:34
VP1ChannelManager
Definition
VP1ChannelManager.h:27
VP1ExecutionScheduler
Definition
VP1ExecutionScheduler.h:42
VP1PluginDialog::Imp
Definition
VP1PluginDialog.cxx:24
VP1PluginDialog::Imp::channelmanager
VP1ChannelManager * channelmanager
Definition
VP1PluginDialog.cxx:27
VP1PluginDialog::Imp::label_fullpathtitle
QLabel * label_fullpathtitle
Definition
VP1PluginDialog.cxx:32
VP1PluginDialog::Imp::label_fullpath
QLabel * label_fullpath
Definition
VP1PluginDialog.cxx:33
VP1PluginDialog::Imp::index_2_fullpath
QMap< int, QString > index_2_fullpath
Definition
VP1PluginDialog.cxx:37
VP1PluginDialog::Imp::textBrowser_channels
QTextBrowser * textBrowser_channels
Definition
VP1PluginDialog.cxx:36
VP1PluginDialog::Imp::pd
VP1PluginDialog * pd
Definition
VP1PluginDialog.cxx:26
VP1PluginDialog::Imp::unloadfile
QString unloadfile
Definition
VP1PluginDialog.cxx:38
VP1PluginDialog::Imp::label_selectplugin
QLabel * label_selectplugin
Definition
VP1PluginDialog.cxx:30
VP1PluginDialog::Imp::comboBox_plugins
QComboBox * comboBox_plugins
Definition
VP1PluginDialog.cxx:31
VP1PluginDialog::Imp::setInfo
void setInfo()
Definition
VP1PluginDialog.cxx:90
VP1PluginDialog::Imp::scheduler
VP1ExecutionScheduler * scheduler
Definition
VP1PluginDialog.cxx:28
VP1PluginDialog::Imp::label_channels
QLabel * label_channels
Definition
VP1PluginDialog.cxx:34
VP1PluginDialog::Imp::pushButton_unload
QPushButton * pushButton_unload
Definition
VP1PluginDialog.cxx:35
VP1PluginDialog::unloadclicked
void unloadclicked()
Definition
VP1PluginDialog.cxx:67
VP1PluginDialog::pluginSelected
void pluginSelected(int i)
Definition
VP1PluginDialog.cxx:127
VP1PluginDialog::unloadfile
const QString & unloadfile()
Definition
VP1PluginDialog.cxx:78
VP1PluginDialog::VP1PluginDialog
VP1PluginDialog(QWidget *parent, VP1ChannelManager *, VP1ExecutionScheduler *)
Definition
VP1PluginDialog.cxx:42
VP1PluginDialog::updateRefreshInfo
void updateRefreshInfo()
Definition
VP1PluginDialog.cxx:160
VP1PluginDialog::~VP1PluginDialog
virtual ~VP1PluginDialog()
Definition
VP1PluginDialog.cxx:84
VP1PluginDialog::m_d
Imp * m_d
Definition
VP1PluginDialog.h:36
files
std::vector< std::string > files
file names and file pointers
Definition
hcg.cxx:52
file
TFile * file
Definition
tile_monitor.h:29
Generated on
for ATLAS Offline Software by
1.17.0