22 QShortcut *helpF1 =
new QShortcut(Qt::Key_F1,
this);
23 connect(helpF1, SIGNAL(activated()),
this, SLOT(
help()));
32 QVBoxLayout *leftLayout =
new QVBoxLayout;
38 left->setLayout(leftLayout);
42 vSplitter->setOrientation( Qt::Vertical );
49 vSizes << 650 << 500 << 450 << 400;
62 "<font size=5><b>Marlin - Graphical User Interface</b></font><br><br>"
63 "<font size=4>This application lets you \"repair\" or create "
64 "new Steering Files for Marlin.</font><br><br><br>"
66 "<font color=#FB0000>Please be aware that comments made in the original steering files will get lost in the saving process.<br>"
67 "Processors that are not installed in your Marlin binary are not editable in this application and loose "
68 "their parameter's descriptions and types.<br>"
69 "Extra parameters that aren't categorized as default in a processor also loose their description and type.</font><br><br><br>"
71 "In order for this application to work correctly you should first check if all processors found in the "
72 "steering file are installed in your Marlin binary.<br>This can easily be check by running \"Marlin -c SteeringFile.xml\"<br><br><br>"
73 "If you have comments or suggestions please take a look at the ILC Forum<br>under the Marlin section at "
74 "<a href=\"http://forum.linearcollider.org\">http://forum.linearcollider.org</a>. Thanks <br><br>"
75 "Author: Jan Engels @ DESY -IT-"
80 "You made changes that will get lost.\nDo you want to save your changes?\n\n"
82 "Please be aware that comments made in the original steering files will get lost in the saving process.\n"
83 "Processors that are not installed in your Marlin binary will loose their parameter's descriptions and types as well.\n"
84 "Extra parameters that aren't categorized as default in a processor also loose their description and type.\n\n"
90 defLab->setAlignment(Qt::AlignCenter);
91 setCentralWidget(defLab);
98 setWindowTitle(tr(
"Marlin GUI"));
117 int ret = QMessageBox::warning(
this, tr(
"Exit Marlin GUI"),
saveChangesMsg,
119 QMessageBox::No | QMessageBox::Default,
120 QMessageBox::Cancel | QMessageBox::Escape);
122 if( ret == QMessageBox::Yes ){
126 else if( ret == QMessageBox::No ){
140 QMenu *fileMenu = menuBar()->addMenu(tr(
"&File"));
141 QAction *newAction = fileMenu->addAction(tr(
"&New..."));
142 newAction->setShortcut(QKeySequence(tr(
"Ctrl+N")));
143 QAction *openAction = fileMenu->addAction(tr(
"&Open..."));
144 openAction->setShortcut(QKeySequence(tr(
"Ctrl+O")));
145 QAction *saveAction = fileMenu->addAction(tr(
"&Save..."));
146 saveAction->setShortcut(QKeySequence(tr(
"Ctrl+S")));
147 QAction *saveasAction = fileMenu->addAction(tr(
"Save &As..."));
148 saveasAction->setShortcut(QKeySequence(tr(
"Ctrl+A")));
149 fileMenu->addSeparator();
150 QAction *quitAction = fileMenu->addAction(tr(
"E&xit"));
151 quitAction->setShortcut(QKeySequence(tr(
"Ctrl+X")));
153 connect(newAction, SIGNAL(triggered()),
this, SLOT(
newXMLFile()));
154 connect(openAction, SIGNAL(triggered()),
this, SLOT(
openXMLFile()));
155 connect(saveAction, SIGNAL(triggered()),
this, SLOT(
saveXMLFile()));
156 connect(saveasAction, SIGNAL(triggered()),
this, SLOT(
saveAsXMLFile()));
157 connect(quitAction, SIGNAL(triggered()),
this, SLOT(close()));
160 foreach (QString styleName, QStyleFactory::keys()) {
162 action->setText(tr(
"%1 Style").arg(styleName));
163 action->setData(styleName);
164 action->setCheckable(
true);
165 connect(action, SIGNAL(triggered(
bool)),
this, SLOT(
changeStyle(
bool)));
168 QMenu *viewMenu = menuBar()->addMenu(tr(
"&View"));
170 viewMenu->addAction(action);
172 QMenu *aboutMenu = menuBar()->addMenu(tr(
"&Help"));
173 QAction *aboutGUIAction = aboutMenu->addAction(tr(
"About &Marlin GUI..."));
174 QAction *aboutQTAction = aboutMenu->addAction(tr(
"About &QT..."));
175 QAction *helpAction = aboutMenu->addAction(tr(
"&Help..."));
177 connect(aboutGUIAction, SIGNAL(triggered()),
this, SLOT(
aboutGUI()));
178 connect(aboutQTAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
179 connect(helpAction, SIGNAL(triggered()),
this, SLOT(
help()));
183 QMessageBox::about(
this, tr(
"About Marlin GUI"),
aboutGUIMsg);
192 help=
new GUIHelp(
"/gui/help/html/conditions.html",
this, Qt::Dialog );
207 labels << tr(
"Condition");
209 condTable->setHorizontalHeaderLabels(labels);
210 condTable->horizontalHeader()->resizeSection(0, 500);
211 condTable->setSelectionBehavior(QAbstractItemView::SelectRows);
212 condTable->setSelectionMode(QAbstractItemView::SingleSelection);
213 condTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
218 QPushButton *addCond =
new QPushButton(tr(
"&Insert"));
219 QPushButton *editCond =
new QPushButton(tr(
"Edit"));
220 QPushButton *remCond =
new QPushButton(tr(
"Remove"));
222 addCond->setToolTip(tr(
"Insert New Condition"));
223 editCond->setToolTip(tr(
"Edit selected Condition"));
224 remCond->setToolTip(tr(
"Remove Selected Condition"));
226 connect(addCond, SIGNAL(clicked()),
this, SLOT(
addCondition()));
227 connect(editCond, SIGNAL(clicked()),
this, SLOT(
editCondition()));
228 connect(remCond, SIGNAL(clicked()),
this, SLOT(
remCondition()));
231 QVBoxLayout *condButtonsLayout =
new QVBoxLayout;
232 condButtonsLayout->addWidget(addCond);
233 condButtonsLayout->addWidget(editCond);
234 condButtonsLayout->addWidget(remCond);
236 QGroupBox *condButtons =
new QGroupBox(tr(
"Operations"));
237 condButtons->setLayout( condButtonsLayout );
238 condButtons->setFixedWidth( 120 );
241 QGridLayout *condLayout =
new QGridLayout;
243 condLayout->addWidget(condButtons,0,1,Qt::AlignTop);
246 condGBox =
new QGroupBox(tr(
"Edit Conditions List"));
258 labels << tr(
"Name") << tr(
"Type");
260 aProcTable->setHorizontalHeaderLabels(labels);
261 aProcTable->horizontalHeader()->setClickable(
true);
262 aProcTable->horizontalHeader()->resizeSection(0, 220);
263 aProcTable->horizontalHeader()->resizeSection(1, 220);
265 aProcTable->setSelectionBehavior(QAbstractItemView::SelectRows);
266 aProcTable->setSelectionMode(QAbstractItemView::SingleSelection);
270 connect(
aProcTable->horizontalHeader(), SIGNAL(sectionDoubleClicked(
int)),
this, SLOT(
selectColumn(
int)));
276 QPushButton *addAProc =
new QPushButton(tr(
"&Add"));
277 QPushButton *editAProc =
new QPushButton(tr(
"&Edit"));
278 QPushButton *remAProc =
new QPushButton(tr(
"Delete"));
279 QPushButton *deactProc =
new QPushButton(tr(
"Dea&ctivate"));
280 QPushButton *mvAProcUp =
new QPushButton(tr(
"Move &Up"));
281 QPushButton *mvAProcDn =
new QPushButton(tr(
"Move &Down"));
282 showCond =
new QPushButton(tr(
"&Show Cond."));
286 addAProc->setToolTip(tr(
"Add New Processor"));
287 editAProc->setToolTip(tr(
"Edit Selected Processor"));
288 remAProc->setToolTip(tr(
"Delete Selected Processor"));
289 deactProc->setToolTip(tr(
"Deactivate Selected Processor"));
290 mvAProcUp->setToolTip(tr(
"Move Selected Processor Up"));
291 mvAProcDn->setToolTip(tr(
"Move Selected Processor Down"));
292 showCond->setToolTip(tr(
"Show/Hide Conditions"));
294 connect(addAProc, SIGNAL(clicked()),
this, SLOT(
addAProcessor()));
295 connect(editAProc, SIGNAL(clicked()),
this, SLOT(
editAProcessor()));
296 connect(remAProc, SIGNAL(clicked()),
this, SLOT(
remAProcessor()));
303 QVBoxLayout *aProcButtonsLayout =
new QVBoxLayout;
304 aProcButtonsLayout->addWidget(addAProc);
305 aProcButtonsLayout->addWidget(editAProc);
306 aProcButtonsLayout->addWidget(remAProc);
307 aProcButtonsLayout->addWidget(deactProc);
308 aProcButtonsLayout->addWidget(mvAProcUp);
309 aProcButtonsLayout->addWidget(mvAProcDn);
310 aProcButtonsLayout->addWidget(
showCond);
319 QGridLayout *aProcLayout =
new QGridLayout;
324 aProcGBox =
new QGroupBox(tr(
"Active Processors"));
333 labels << tr(
"Name") << tr(
"Type");
335 iProcTable->setHorizontalHeaderLabels(labels);
336 iProcTable->horizontalHeader()->resizeSection(0, 220);
337 iProcTable->horizontalHeader()->resizeSection(1, 220);
339 iProcTable->setSelectionBehavior(QAbstractItemView::SelectRows);
340 iProcTable->setSelectionMode(QAbstractItemView::SingleSelection);
345 QPushButton *editIProc =
new QPushButton(tr(
"Edit"));
346 QPushButton *remIProc =
new QPushButton(tr(
"Delete"));
347 QPushButton *actProc =
new QPushButton(tr(
"Activate"));
349 editIProc->setToolTip(tr(
"Edit Selected Processor"));
350 remIProc->setToolTip(tr(
"Delete Selected Processor"));
351 actProc->setToolTip(tr(
"Activate Selected Processor"));
353 connect(editIProc, SIGNAL(clicked()),
this, SLOT(
editIProcessor()));
354 connect(remIProc, SIGNAL(clicked()),
this, SLOT(
remIProcessor()));
358 QVBoxLayout *iProcButtonsLayout =
new QVBoxLayout;
359 iProcButtonsLayout->addWidget(actProc);
360 iProcButtonsLayout->addWidget(editIProc);
361 iProcButtonsLayout->addWidget(remIProc);
369 QGridLayout *iProcLayout =
new QGridLayout;
374 iProcGBox =
new QGroupBox(tr(
"Inactive Processors"));
383 labels << tr(
"Name") << tr(
"Type") << tr(
"LCIO File");
386 lcioColsTable->setSelectionMode(QAbstractItemView::NoSelection);
393 lcioColsTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
396 QVBoxLayout *lcioColsLayout =
new QVBoxLayout;
400 lcioColsGBox =
new QGroupBox(tr(
"List of all Collections Found in LCIO Files"));
410 QPushButton *mvFileUp =
new QPushButton(tr(
"Move Up"));
411 QPushButton *mvFileDn =
new QPushButton(tr(
"Move Down"));
412 QPushButton *addFile =
new QPushButton(tr(
"Add"));
413 QPushButton *remFile =
new QPushButton(tr(
"Remove"));
415 addFile->setToolTip(tr(
"Add New LCIO File"));
416 remFile->setToolTip(tr(
"Remove Selected LCIO File"));
417 mvFileUp->setToolTip(tr(
"Move Selected File Up"));
418 mvFileDn->setToolTip(tr(
"Move Selected File Down"));
420 connect(addFile, SIGNAL(clicked()),
this, SLOT(
addLCIOFile()));
421 connect(remFile, SIGNAL(clicked()),
this, SLOT(
remLCIOFile()));
422 connect(mvFileUp, SIGNAL(clicked()),
this, SLOT(
moveLCIOFileUp()));
426 QVBoxLayout *lcioButtonsLayout =
new QVBoxLayout;
427 lcioButtonsLayout->addWidget(addFile);
428 lcioButtonsLayout->addWidget(remFile);
429 lcioButtonsLayout->addWidget(mvFileUp);
430 lcioButtonsLayout->addWidget(mvFileDn);
433 lcioButtons->setLayout( lcioButtonsLayout );
436 QLabel *cwdl =
new QLabel(
"CWD: " );
437 QLineEdit *cwdle =
new QLineEdit(QDir::currentPath());
438 cwdle->setReadOnly(
true );
441 QHBoxLayout *cwdLayout =
new QHBoxLayout;
442 cwdLayout->addWidget(cwdl);
443 cwdLayout->addWidget(cwdle);
445 cwdWdg->setLayout( cwdLayout );
447 cwdWdg->setToolTip(tr(
"Current Working Directory: LCIO Files in the same directory branch of this path are added with relative paths"));
450 QGridLayout *lcioFilesLayout =
new QGridLayout;
451 lcioFilesLayout->addWidget(cwdWdg,0,0);
453 lcioFilesLayout->addWidget(lcioButtons,1,1,Qt::AlignTop);
456 lcioFilesGBox =
new QGroupBox(tr(
"Global Section LCIO Files"));
467 labels << tr(
"Parameter Name") << tr(
"Parameter Value");
477 QPushButton *gearButton =
new QPushButton(tr(
"Browse for GEAR File"));
478 connect(gearButton, SIGNAL(clicked()),
this, SLOT(
changeGearFile()));
481 QVBoxLayout *globalParametersLayout =
new QVBoxLayout;
483 globalParametersLayout->addWidget(gearButton);
486 QGroupBox *globalParametersGBox =
new QGroupBox(tr(
"Global Section Parameters"));
487 globalParametersGBox->setLayout(globalParametersLayout);
490 QVBoxLayout *globalSectionLayout =
new QVBoxLayout;
492 globalSectionLayout->addWidget(globalParametersGBox);
502 hideProcs =
new QPushButton(tr(
"Hide Inactive Processors"));
503 hideErrors =
new QPushButton(tr(
"Hide Active Processor Errors"));
507 hideProcs->setToolTip(tr(
"Hide/Show Inactive Processors"));
508 hideErrors->setToolTip(tr(
"Hide/Show Active Processor Errors"));
514 QHBoxLayout *viewButtonsLayout =
new QHBoxLayout;
529 QVBoxLayout *aProcErrorsLayout =
new QVBoxLayout;
533 aProcErrorsGBox =
new QGroupBox(tr(
"Error Description for selected Active Processor"));
550 errors+=(*p).c_str();
553 QMessageBox::warning(
this,
554 tr(
"Errors Occured loading Steering File"),
565 if( filen.
find(
".xml",0) == std::string::npos ){
572 std::cout <<
"Marlin steering file [" << filen <<
"] loaded successfully into the GUI\n";
574 QString title=
"Marlin GUI - ";
575 QFileInfo xmlFile(filen.c_str());
576 title+=xmlFile.absoluteFilePath();
577 setWindowTitle(title);
585 cmd+=
" >/dev/null 2>/dev/null";
587 if( system( cmd.
c_str() ) ){
593 if( system( cmd.
c_str() ) ){
594 std::cerr <<
"Marlin GUI::setMarlinSteerCheck: Error creating backup file!!\n";
621 for(
unsigned int i=0; i<paramKeys.
size(); i++ ){
631 for(
unsigned int j=0; j<paramValues.
size(); j++ ){
632 str+=paramValues[j].c_str();
636 QTableWidgetItem *item0 =
new QTableWidgetItem( paramKeys[i].c_str() );
637 QTableWidgetItem *item1 =
new QTableWidgetItem( str );
639 if(paramKeys[i]==
"GearXMLFile"){
640 QFileInfo gearInfo(paramValues[0].c_str());
641 item1->setBackgroundColor( ( !gearInfo.exists() ? QColor(184,16,0,180) : QColor(32,140,64,180)) );
642 item1->setFlags(item0->flags() & ~Qt::ItemIsEditable);
645 item0->setFlags(item0->flags() & ~Qt::ItemIsEditable);
660 QTableWidgetItem *item =
new QTableWidgetItem((*p).c_str());
680 QTableWidgetItem *item0 =
new QTableWidgetItem(
msc->
getLCIOCols()[i]->getValue().c_str());
681 QTableWidgetItem *item1 =
new QTableWidgetItem(
msc->
getLCIOCols()[i]->getType().c_str());
682 QTableWidgetItem *item2 =
new QTableWidgetItem(
msc->
getLCIOCols()[i]->getName().c_str());
704 if( row>=0 && row<=t->count() ){
705 if( row==t->count() ){ row--; }
706 t->setCurrentRow( row );
707 t->setItemSelected( t->item(row), true );
722 for(
int i=0; i<numCond; i++ ){
739 aProcTable->horizontalHeader()->resizeSection(i, 25);
740 aProcTable->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
744 labels << tr(
"Name") << tr(
"Type");
745 aProcTable->setHorizontalHeaderLabels(labels);
746 aProcTable->horizontalHeader()->resizeSection( numCond, 220);
747 aProcTable->horizontalHeader()->resizeSection( numCond+1, 220);
754 QTableWidgetItem *item0 =
new QTableWidgetItem(
msc->
getAProcs()[i]->getName().c_str());
755 QTableWidgetItem *item1 =
new QTableWidgetItem(
msc->
getAProcs()[i]->getType().c_str());
757 item0->setToolTip( QString(
msc->
getAProcs()[i]->getDescription().c_str() ));
758 item1->setToolTip( QString(
msc->
getAProcs()[i]->getDescription().c_str() ));
760 item1->setFlags(item1->flags() & ~Qt::ItemIsEditable);
765 item0->setBackgroundColor( (
msc->
getAProcs()[i]->hasErrors() ? QColor(184,16,0,180) : QColor(32,140,64,180)) );
766 item1->setBackgroundColor( (
msc->
getAProcs()[i]->hasErrors() ? QColor(184,16,0,180) : QColor(32,140,64,180)) );
768 for(
int j=0; j<numCond; j++ ){
769 QTableWidgetItem *item =
new QTableWidgetItem;
770 item->setFlags(item->flags() & ~Qt::ItemIsEditable);
793 QTableWidgetItem *item0 =
new QTableWidgetItem(
msc->
getIProcs()[i]->getName().c_str());
794 QTableWidgetItem *item1 =
new QTableWidgetItem(
msc->
getIProcs()[i]->getType().c_str());
796 item0->setToolTip( QString(
msc->
getIProcs()[i]->getDescription().c_str() ));
797 item1->setToolTip( QString(
msc->
getIProcs()[i]->getDescription().c_str() ));
799 item1->setFlags(item1->flags() & ~Qt::ItemIsEditable);
804 item0->setBackgroundColor( (
msc->
getIProcs()[i]->isInstalled() ? QColor(255,255,255) : QColor(128,128,128)) );
805 item1->setBackgroundColor( (
msc->
getIProcs()[i]->isInstalled() ? QColor(255,255,255) : QColor(128,128,128)) );
806 item0->setTextColor( (
msc->
getIProcs()[i]->isInstalled() ? QColor(0,0,0) : QColor(200,200,200)) );
807 item1->setTextColor( (
msc->
getIProcs()[i]->isInstalled() ? QColor(0,0,0) : QColor(200,200,200)) );
818 if( col < aProcTable->columnCount()-2){
819 QTableWidgetItem *item =
aProcTable->item(row, col);
820 if(item->checkState() == Qt::Checked){
850 if( row>=0 && row<=t->rowCount() ){
851 if( row==t->rowCount() ){ row--; }
852 t->setCurrentCell( row, 0 );
853 t->setItemSelected( t->currentItem(), true );
859 if( row>=0 && col ==
aProcTable->columnCount() - 1 ){
891 for(
int i=0; i<numCond; i++ ){
895 showCond->setText(tr(
"&Hide Cond."));
907 for(
int i=0; i<numCond; i++ ){
911 showCond->setText(tr(
"&Show Cond."));
930 hideProcs->setText(tr(
"Show Inactive Processors"));
935 hideProcs->setText(tr(
"Hide Inactive Processors"));
944 hideErrors->setText(tr(
"Show Active Processor Errors"));
949 hideErrors->setText(tr(
"Hide Active Processor Errors"));
960 pal.setColor(QPalette::Highlight,
msc->
getAProcs()[row]->hasErrors() ? QColor(184,16,0,180) : QColor(32,140,64,220) );
992 if( row >= 0 && row < condTable->rowCount() ){
1005 int ret = QMessageBox::warning(
this, tr(
"Delete Condition"),
1006 tr(
"Delete selected condition?\nThe condition will also be removed from every processor afected by it!!\n"),
1007 QMessageBox::Yes | QMessageBox::Default,
1008 QMessageBox::No | QMessageBox::Escape);
1010 if( ret == QMessageBox::Yes ){
1030 if( pos >= 0 && pos < aProcTable->rowCount() ){
1032 int ret = QMessageBox::warning(
this, tr(
"Delete Processor"),
1033 tr(
"Delete selected processor?\nAll parameter values for this processor will also be deleted!!\n"
1034 "If you don't want this processor to be executed, but still keep it's parameter values saved, "
1035 "try the \"Deactivate\" button instead."),
1036 QMessageBox::Yes | QMessageBox::Default,
1037 QMessageBox::No | QMessageBox::Escape);
1039 if( ret == QMessageBox::No ){
1052 if( pos >= 0 && pos < iProcTable->rowCount() ){
1054 int ret = QMessageBox::warning(
this, tr(
"Delete Processor"),
1055 tr(
"Delete selected processor?\nAll parameter values for this processor will also be deleted!!"),
1056 QMessageBox::Yes | QMessageBox::Default,
1057 QMessageBox::No | QMessageBox::Escape);
1059 if( ret == QMessageBox::No ){
1083 if( pos >= 0 &&
msc->
getAProcs()[pos]->isInstalled() ){
1090 dg.setWindowState( Qt::WindowMaximized);
1114 dg.setWindowState( Qt::WindowMaximized);
1125 QMessageBox::warning(
this, tr(
"Activate Processor"),
1126 tr(
"Sorry, you cannot edit this processor because it is not installed in your Marlin binary.\n"
1127 "Install it first and then try again")
1144 QMessageBox::warning(
this, tr(
"Activate Processor"),
1145 tr(
"Sorry, you cannot activate this processor because it is not installed in your Marlin binary.\n"
1146 "Install it first and then try again")
1176 if( pos < aProcTable->rowCount() - 1 ){
1196 if( pos < lcioFilesList->count() - 1 ){
1205 QString absFileName = QFileDialog::getOpenFileName(
this, tr(
"Choose a Gear file"),
"",
"*.xml", 0, QFileDialog::DontResolveSymlinks);
1207 if( !absFileName.isEmpty() ){
1218 if(currentPath[0]==filePath[0]){
1219 fileName = dir.relativeFilePath(absFileName);
1223 fileName = absFileName;
1233 statusBar()->showMessage(tr(
"Changed GEAR File to %1").arg(fileName), 2000);
1236 file.
push_back( fileName.toStdString() );
1245 QString absFileName = QFileDialog::getOpenFileName(
this, tr(
"Choose an LCIO file"),
"",
"*.slcio", 0, QFileDialog::DontResolveSymlinks);
1263 if( !absFileName.isEmpty() ){
1274 if(currentPath[0]==filePath[0]){
1275 fileName = dir.relativeFilePath(absFileName);
1279 fileName = absFileName;
1282 QDir newFile(absFileName);
1283 QFileInfo newFileI(absFileName);
1287 if((newFile.canonicalPath() == existingFile.canonicalPath()) ||
1288 (newFileI.fileName() == existingFileI.fileName()) ){
1289 QString error=
"Error opening LCIO file [";
1291 error+=
"]. This file has already been opened!!";
1292 QMessageBox::critical(
this, tr(
"Error Opening LCIO File"), error );
1297 statusBar()->showMessage(tr(
"Added LCIO File %1").arg(fileName), 2000);
1309 statusBar()->showMessage(tr(
"Removed LCIO File %1").arg(
lcioFilesList->currentItem()->text()), 2000);
1320 int ret = QMessageBox::warning(
this, tr(
"Exit Marlin GUI"),
saveChangesMsg,
1322 QMessageBox::No | QMessageBox::Default,
1323 QMessageBox::Cancel | QMessageBox::Escape);
1325 if( ret == QMessageBox::Yes ){
1328 else if( ret == QMessageBox::Cancel ){
1333 QString fileName = QFileDialog::getOpenFileName(
this,
1334 tr(
"Choose a Marlin Steering File to open..."),
1335 QDir::currentPath(),
1339 if( !fileName.isEmpty() ){
1340 QFileInfo xmlFile(fileName);
1342 QDir dir(QDir::currentPath());
1344 fileName = dir.relativeFilePath(xmlFile.absoluteFilePath());
1347 statusBar()->showMessage(tr(
"Loaded %1").arg(fileName), 2000);
1358 int ret = QMessageBox::warning(
this, tr(
"Exit Marlin GUI"),
saveChangesMsg,
1360 QMessageBox::No | QMessageBox::Default,
1361 QMessageBox::Cancel | QMessageBox::Escape);
1363 if( ret == QMessageBox::Yes ){
1366 else if( ret == QMessageBox::Cancel ){
1372 _file=
"Untitled.xml";
1375 setWindowTitle(tr(
"Marlin GUI - Untitled.xml"));
1400 cmd+=
" >/dev/null 2>/dev/null";
1404 msg+=
" already exists. Do you want to replace it?";
1405 int ret = QMessageBox::warning(
this, tr(
"Save"), msg,
1407 QMessageBox::No | QMessageBox::Default);
1408 if( ret == QMessageBox::No ){
1419 QMessageBox::critical(
this,
1420 tr(
"Error Saving File"),
1421 tr(
"Sorry, there was an error saving the file. Please choose another file.")
1428 statusBar()->showMessage(tr(
"Saved %1").arg(QString(
_file.
c_str())), 2000);
1438 QFileDialog *fd =
new QFileDialog(
this, tr(
"Save file as"), QDir::currentPath(),
"*.xml");
1440 fd->setDefaultSuffix(
"xml" );
1441 fd->setAcceptMode( QFileDialog::AcceptSave );
1442 fd->setFileMode( QFileDialog::AnyFile );
1443 fd->setResolveSymlinks(
false );
1444 fd->setFilter(
"*.xml" );
1449 fileName=fd->selectedFiles().at(0);
1452 if( !fileName.isEmpty() ){
1455 if( !fileName.contains(
".xml", Qt::CaseInsensitive ) ){
1457 error=
"Sorry, you have tried to save the file with an extension different than \".xml\"\n"
1458 "Marlin GUI does not support other extensions than the xml one.. \nThe filename you've chosen (";
1460 error+=
") was therefore renamed to (";
1464 QMessageBox::critical(
this,
1465 tr(
"Error Saving File"),
1476 QString title=
"Marlin GUI - ";
1478 setWindowTitle(title);
1480 _file=fileName.toStdString();
1492 QString styleName = action->data().toString();
1493 QStyle *candidate = QStyleFactory::create(styleName);
1494 Q_ASSERT(candidate);
1495 if(candidate->metaObject()->className() == QApplication::style()->metaObject()->className()){
1505 if (!checked){
return; }
1506 QAction *action = qobject_cast<QAction *>(sender());
1507 QStyle *style = QStyleFactory::create(action->data().toString());
1509 QApplication::setStyle(style);
QGroupBox * iProcButtonsGBox
QGroupBox * aProcButtonsGBox
QListWidget * lcioFilesList
QTableWidget * globalSectionTable
void showConditions(bool checked)
void selectRow(QTableWidget *t, int row, bool colors=false)
void selectionChanged(int row)
void remProcessor(unsigned int index, bool status)
Remove processor with the given status at the given index.
void setMarlinSteerCheck(const char *filename=NULL)
sSet & getPConditions()
Returns a set with all the processor's conditions.
this class is a Marlin Steering File consistency check Tool.
ColVec & getLCIOCols() const
Returns the collections read from LCIO files.
void updateIProcessors(int pos=-1)
@ class Small delegate class for changing active processor's names
void remCondition(const std::string &condition)
Removes the given condition.
std::shared_ptr< StringParameters > getGlobalParameters()
Returns the Global Parameters.
QTableWidget * aProcTable
void hideIProcessors(bool checked)
handles information about marlin processors and their collections needed by MarlinSteerCheck ...
const std::string getCondition(unsigned int index)
Returns the condition for a given index.
QActionGroup * styleActionGroup
void deactivateProcessor()
void activateProcessor(unsigned int index)
Activate processor at the given index.
void hideAProcErrors(bool checked)
void editAProcessor(int row=-1)
void changeStyle(bool checked)
void selectColumn(int col)
virtual void closeEvent(QCloseEvent *e)
QGroupBox * globalSectionGBox
@ class Small delegate class for changing inactive processor's names
void updateGlobalSection()
sSet & getErrors()
Returns a set with all the errors found after performing a consistency check.
ProcVec & getIProcs()
Returns the Inactive Processors.
bool saveAsXMLFile(const std::string &file)
Saves the data to an XML file with the given name Returns false if error occured. ...
QGroupBox * aProcErrorsGBox
QGroupBox * lcioFilesGBox
void consistencyCheck()
Performs a check at all active processors to search for unavailable collections.
QTableWidget * iProcTable
CMProcessor * getMProcs()
Returns the Marlin Processors.
void tokenize(const std::string str, StringVec &tokens, const std::string &delimiters=" ")
void changeProcessorPos(unsigned int pos, unsigned int newPos)
Change the active processor at the given index to the new given position.
void updateAProcessors(int pos=-1)
void dumpColErrors(unsigned int i, std::ostream &stream, bool separators=false)
Writes the collection errors for the active processor with given index to the given stream...
void deactivateProcessor(unsigned int index)
Deactivate processor at the given index.
void selectLCIORow(QListWidget *t, int row)
QTableWidget * lcioColsTable
ProcVec & getAProcs()
Returns the Active Processors.
StringVec & getLCIOFiles()
Returns the names of the LCIO files found in the global section.
void updateFiles(int pos=-1)
void procTypeDC(int row, int col)
void changeLCIOFilePos(unsigned int pos, unsigned int newPos)
Change the LCIO File at the given index to the new given position.
int addLCIOFile(const std::string &file)
Add LCIO file and read all collections inside it.
void remLCIOFile(const std::string &file)
Remove LCIO file and all collections associated to it.
void conditionChanged(int row, int col)
QGroupBox * viewButtonsGBox
void updateConds(int pos=-1)