ATLAS Offline Software
Loading...
Searching...
No Matches
VP1PartSpectController.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include "ui_partspectcontrollerform.h"
7
10#include "VP1Base/VP1Settings.h"
11
12#include <QFileDialog>
13#include <QFileInfo>
14
27
29 :theclass(the_class)
31 ,lastInputDir(VP1Settings::defaultFileSelectDirectory())
32{
33}
34
38
40 :VP1Controller(sys,"PartSpectController")
41 ,m_d(new Imp(this))
42{
43 m_d->theclass = this;
44 m_d->ui.setupUi(this);
45
46 m_d->ui.lblFileName->setText("...");
47 connect(m_d->ui.pbtnOpenFile, SIGNAL(clicked()), this, SLOT(openFile()));
48
49 connect(m_d->ui.rbtnBaryon, SIGNAL(toggled(bool)), this, SLOT(particleType()));
50 connect(m_d->ui.rbtnE, SIGNAL(toggled(bool)), this, SLOT(particleType()));
51 connect(m_d->ui.rbtnGamma, SIGNAL(toggled(bool)), this, SLOT(particleType()));
52 connect(m_d->ui.rbtnLepton, SIGNAL(toggled(bool)), this, SLOT(particleType()));
53 connect(m_d->ui.rbtnMeson, SIGNAL(toggled(bool)), this, SLOT(particleType()));
54 connect(m_d->ui.rbtnNeutron, SIGNAL(toggled(bool)), this, SLOT(particleType()));
55 connect(m_d->ui.rbtnNucleus, SIGNAL(toggled(bool)), this, SLOT(particleType()));
56 connect(m_d->ui.rbtnPi, SIGNAL(toggled(bool)), this, SLOT(particleType()));
57 connect(m_d->ui.rbtnProton, SIGNAL(toggled(bool)), this, SLOT(particleType()));
58 m_d->ui.rbtnNeutron->setChecked(true);
59 m_d->last_particleType = VP1PartSpect::Neutron;
60}
61
66
68{
69 if (s.version()!=0) {
70 message("Warning: State data in .vp1 file has unsupported version ("+str(s.version())+")");
71 return;
72 }
73
74 s.restore(m_d->ui.rbtnBaryon
75 ,m_d->ui.rbtnE
76 ,m_d->ui.rbtnGamma
77 ,m_d->ui.rbtnLepton
78 ,m_d->ui.rbtnMeson
79 ,m_d->ui.rbtnNeutron
80 ,m_d->ui.rbtnNucleus
81 ,m_d->ui.rbtnPi
82 ,m_d->ui.rbtnProton);
84}
85
86
88{
89 return 0;
90}
91
93{
94 s.save(m_d->ui.rbtnBaryon
95 ,m_d->ui.rbtnE
96 ,m_d->ui.rbtnGamma
97 ,m_d->ui.rbtnLepton
98 ,m_d->ui.rbtnMeson
99 ,m_d->ui.rbtnNeutron
100 ,m_d->ui.rbtnNucleus
101 ,m_d->ui.rbtnPi
102 ,m_d->ui.rbtnProton);
103}
104
109
111{
112 QString fileName = QFileDialog::getOpenFileName(NULL
113 ,tr("Open File")
114 ,m_d->lastInputDir
115 ,tr("Root files (*.root)"));
116 if(!fileName.isEmpty()) {
117 QFileInfo fileInfo(fileName);
118 m_d->ui.lblFileName->setText(fileInfo.fileName());
119 fileUpdated(fileName);
120 m_d->lastInputDir = fileInfo.absolutePath();
121 }
122}
123
125{
126 if(m_d->ui.rbtnBaryon->isChecked()) {
128 m_d->last_particleType = VP1PartSpect::Baryon;
129 } else if(m_d->ui.rbtnE->isChecked()) {
131 m_d->last_particleType = VP1PartSpect::E;
132 } else if(m_d->ui.rbtnGamma->isChecked()) {
134 m_d->last_particleType = VP1PartSpect::Gamma;
135 }else if(m_d->ui.rbtnLepton->isChecked()) {
137 m_d->last_particleType = VP1PartSpect::Lepton;
138 }else if(m_d->ui.rbtnMeson->isChecked()) {
140 m_d->last_particleType = VP1PartSpect::Meson;
141 }else if(m_d->ui.rbtnNeutron->isChecked()) {
143 m_d->last_particleType = VP1PartSpect::Neutron;
144 }else if(m_d->ui.rbtnNucleus->isChecked()) {
146 m_d->last_particleType = VP1PartSpect::Nucleus;
147 }else if(m_d->ui.rbtnPi->isChecked()) {
149 m_d->last_particleType = VP1PartSpect::Pi;
150 }else { // if(m_d->ui.rbtnProton->isChecked()) {
152 m_d->last_particleType = VP1PartSpect::Proton;
153 }
154}
155
156
VP1Controller(IVP1System *sys, const QString &classname)
void message(const QString &) const
VP1PartSpectController * theclass
VP1PartSpect::ParticleType last_particleType
Ui::frmPartSpectController ui
void particleTypeChanged(VP1PartSpect::ParticleType)
VP1PartSpect::ParticleType getParticleType()
VP1PartSpectController(IVP1System *sys)
void fileUpdated(const QString &)
void actualRestoreSettings(VP1Deserialise &)
void actualSaveSettings(VP1Serialise &) const