ATLAS Offline Software
Loading...
Searching...
No Matches
VP1PluginDialog.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 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
16#include "ui_vp1plugindialog.h"
20#include <QFileInfo>
21#include <cassert>
22
23//____________________________________________________________________
40
41//____________________________________________________________________
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//____________________________________________________________________
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//____________________________________________________________________
79{
80 return m_d->unloadfile;
81}
82
83//____________________________________________________________________
88
89//____________________________________________________________________
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//____________________________________________________________________
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//____________________________________________________________________
161 int i = m_d->comboBox_plugins->currentIndex();
162 if (i!=-1)
164}
VP1ChannelManager * channelmanager
QMap< int, QString > index_2_fullpath
QTextBrowser * textBrowser_channels
VP1PluginDialog * pd
VP1ExecutionScheduler * scheduler
QPushButton * pushButton_unload
void pluginSelected(int i)
const QString & unloadfile()
VP1PluginDialog(QWidget *parent, VP1ChannelManager *, VP1ExecutionScheduler *)
virtual ~VP1PluginDialog()
std::vector< std::string > files
file names and file pointers
Definition hcg.cxx:50
TFile * file