1 #include "ElementiGrafici.h" 2 #include <qapplication.h> 3 #include <qpushbutton.h> 4 #include <qlcdnumber.h> 7 #include <qstatusbar.h> 11 #include <qradiobutton.h> 12 #include <qbuttongroup.h> 13 #include <qcheckbox.h> 16 #include <QPlastiqueStyle> 18 #include <Q3ButtonGroup> 21 Finestra::Finestra(QWidget *parent,
const char *name)
22 :QWidget(parent,name){
24 QPushButton *esci =
new QPushButton(
"&Esci",
this,
"Esci");
25 esci->setFont( QFont(
"Times",18,QFont::Bold) );
26 connect(esci, SIGNAL(clicked()), qApp,SLOT(quit()) );
30 QPushButton *apri =
new QPushButton(
"&Apri",
this,
"apri");
31 connect(apri, SIGNAL(clicked() ), e1,SLOT(Apri()) );
33 QPushButton *aggiungi =
new QPushButton(
"&Aggiungi",
this,
"aggiungi");
34 connect(aggiungi, SIGNAL(clicked() ), e1,SLOT(Aggiungi()) );
36 QLineEdit *
nomeFile =
new QLineEdit(
this,
"nomeFile");
37 connect(nomeFile,SIGNAL( textChanged(
const QString &)),e1,SLOT( NomeFile(
const QString &)) );
38 connect(e1,SIGNAL( TestoCambiato(
const QString &)),nomeFile,SLOT( setText(
const QString &)) );
40 QLineEdit *
nomeConf =
new QLineEdit(
this,
"nomeConf");
41 connect(nomeConf,SIGNAL( textChanged(
const QString &)),e1,SLOT( NomeConf(
const QString &)) );
42 connect(e1,SIGNAL( ConfCambiato(
const QString &)),nomeConf,SLOT( setText(
const QString &)) );
44 QLineEdit *
nomeSalva =
new QLineEdit(
this,
"nomeSalva");
45 connect(nomeSalva,SIGNAL( textChanged(
const QString &)),e1,SLOT( NomeSalva(
const QString &)) );
46 connect(e1,SIGNAL( SalvaCambiato(
const QString &)),nomeSalva,SLOT( setText(
const QString &)) );
48 QLineEdit *
nomeTit =
new QLineEdit(
this,
"nomeTit");
49 connect(nomeTit,SIGNAL( textChanged(
const QString &)),e1,SLOT( NomeTit(
const QString &)) );
50 connect(e1,SIGNAL( TitoloCambiato(
const QString &)),nomeSalva,SLOT( setText(
const QString &)) );
52 QLineEdit *
nomeEtX =
new QLineEdit(
this,
"nomeEtX");
53 connect(nomeEtX,SIGNAL( textChanged(
const QString &)),e1,SLOT( NomeEtX(
const QString &)) );
54 connect(e1,SIGNAL( EtichettaXCambiato(
const QString &)),nomeEtX,SLOT( setText(
const QString &)) );
55 nomeEtX->setMaximumWidth(50);
58 QLineEdit *
nomeEtY =
new QLineEdit(
this,
"nomeEtY");
59 connect(nomeEtY,SIGNAL( textChanged(
const QString &)),e1,SLOT( NomeEtY(
const QString &)) );
60 connect(e1,SIGNAL( EtichettaYCambiato(
const QString &)),nomeEtY,SLOT( setText(
const QString &)) );
61 nomeEtY->setMaximumWidth(50);
63 QHBoxLayout *Etichette =
new QHBoxLayout;
64 Etichette->addWidget(nomeEtX);
65 Etichette->addWidget(nomeEtY);
66 Etichette->addStretch(1);
68 QPushButton *segnali =
new QPushButton(
"&Segnale",
this,
"segnali");
69 connect(segnali, SIGNAL(clicked() ), e1,SLOT(PuntiSegnale()) );
71 QPushButton *distr =
new QPushButton(
"&Distr",
this,
"distr");
72 connect(distr, SIGNAL(clicked() ), e1,SLOT(PuntiDistribuzione()) );
74 QPushButton *spettro =
new QPushButton(
"&Spettro",
this,
"Spettro");
75 connect(spettro, SIGNAL(clicked() ), e1,SLOT(PuntiSpettro()) );
77 QPushButton *autosim =
new QPushButton(
"&ASim",
this,
"autosim");
78 connect(autosim, SIGNAL(clicked() ), e1,SLOT(PuntiAutosimilarita()) );
81 QPushButton *autocor =
new QPushButton(
"&ACcor",
this,
"autocor");
82 connect(autocor, SIGNAL(clicked() ), e1,SLOT(PuntiAutocor()) );
84 QPushButton *normalizza =
new QPushButton(
"&Norm",
this,
"normalizza");
85 connect(normalizza, SIGNAL(clicked() ), e1,SLOT(PuntiNormalizza()) );
87 QPushButton *modulo =
new QPushButton(
"&Mod",
this,
"modulo");
88 connect(modulo, SIGNAL(clicked() ), e1,SLOT(PuntiModulo()) );
90 QPushButton *integrale =
new QPushButton(
"&Int",
this,
"integrale");
91 connect(integrale, SIGNAL(clicked() ), e1,SLOT(PuntiIntegrale()) );
93 QPushButton *derivata =
new QPushButton(
"&Der",
this,
"derivata");
94 connect(derivata, SIGNAL(clicked() ), e1,SLOT(PuntiDerivata()) );
96 QPushButton *varie =
new QPushButton(
"&Varie",
this,
"varie");
97 connect(varie, SIGNAL(clicked() ), e1,SLOT(PuntiVarie()) );
100 QPushButton *sum =
new QPushButton(
"&Sum",
this,
"sum");
101 connect(sum, SIGNAL(clicked() ), e1,SLOT(PuntiSum()) );
103 QPushButton *interRett =
new QPushButton(
"&InRett",
this,
"interRett");
104 connect(interRett, SIGNAL(clicked() ), e1,SLOT(PuntiInterRett()) );
106 QPushButton *interExp =
new QPushButton(
"&InExp",
this,
"interExp");
107 connect(interExp, SIGNAL(clicked() ), e1,SLOT(PuntiInterExp()) );
109 QPushButton *interGauss =
new QPushButton(
"&InGauss",
this,
"interGauss");
110 connect(interGauss, SIGNAL(clicked() ), e1,SLOT(PuntiInterGauss()) );
112 QPushButton *parabola =
new QPushButton(
"&Para",
this,
"parabola");
113 connect(parabola, SIGNAL(clicked() ), e1,SLOT(PuntiParabola()) );
116 QPushButton *mediaMobile =
new QPushButton(
"&mMob",
this,
"mediaMobile");
117 connect(mediaMobile, SIGNAL(clicked() ), e1,SLOT(PuntiMediaMob()) );
119 QPushButton *correlaADue =
new QPushButton(
"&Cor2",
this,
"corrADue");
120 connect(correlaADue, SIGNAL(clicked() ), e1,SLOT(PuntiCorrelaADue()) );
122 QPushButton *stampa =
new QPushButton(
"&Stampa",
this,
"stampa");
123 connect(stampa, SIGNAL(clicked() ), e1,SLOT(StampaFile()) );
125 QPushButton *salva =
new QPushButton(
"&Salva",
this,
"autocor");
126 connect(salva, SIGNAL(clicked() ), e1,SLOT(Salva()) );
128 QPushButton *ridisegna =
new QPushButton(
"&R",
this,
"ridisegna");
129 connect(ridisegna,SIGNAL(clicked() ),e1,SLOT(Ridisegna()) );
131 QRadioButton *sulSegnale =
new QRadioButton(
"Sul &segnale",
this,
"sulSegnale");
133 connect(sulSegnale,SIGNAL(toggled(
bool) ),e1,SLOT(SulSegnale(
bool)) );
134 connect(e1,SIGNAL(SegnaleGrafico(
bool) ),sulSegnale,SLOT(setChecked(
bool)) );
136 QRadioButton *sulGrafico =
new QRadioButton(
"Sul &grafico",
this,
"sulGrafico");
137 connect(sulGrafico,SIGNAL(toggled(
bool) ),e1,SLOT(SulGrafico(
bool)) );
139 Q3ButtonGroup *cosaElabora =
new Q3ButtonGroup(
"Elabora",
this,
"cosaElabora");
140 cosaElabora->setRadioButtonExclusive( TRUE );
142 cosaElabora->insert(sulSegnale,0);
143 cosaElabora->insert(sulGrafico,1);
144 cosaElabora->setButton(0);
146 QRadioButton *suX =
new QRadioButton(
"X",
this,
"X");
147 connect(suX,SIGNAL(toggled(
bool) ),e1,SLOT(SuX(
bool)) );
149 QRadioButton *suY =
new QRadioButton(
"Y",
this,
"Y");
150 connect(suY,SIGNAL(toggled(
bool) ),e1,SLOT(SuY(
bool)) );
152 QRadioButton *suDX =
new QRadioButton(
"DX",
this,
"DX");
153 connect(suDX,SIGNAL(toggled(
bool) ),e1,SLOT(SuDX(
bool)) );
155 QRadioButton *suDY =
new QRadioButton(
"DY",
this,
"DY");
156 connect(suDY,SIGNAL(toggled(
bool) ),e1,SLOT(SuDY(
bool)) );
157 Q3ButtonGroup *qualeCoord =
new Q3ButtonGroup(
this);
158 qualeCoord->setRadioButtonExclusive( TRUE );
160 qualeCoord->insert(suX,0);
161 qualeCoord->insert(suY,1);
162 qualeCoord->insert(suDX,2);
163 qualeCoord->insert(suDY,3);
164 qualeCoord->setButton(1);
166 QCheckBox *linee =
new QCheckBox(
"&Linee",
this,
"linee");
168 connect(linee,SIGNAL(clicked() ),e1,SLOT(DisegnaLinee()) );
170 QCheckBox *punti =
new QCheckBox(
"&Punti",
this,
"punti");
171 connect(punti,SIGNAL(clicked() ),e1,SLOT(DisegnaPunti()) );
173 QCheckBox *griglia =
new QCheckBox(
"&Griglia",
this,
"griglia");
174 connect(griglia,SIGNAL(clicked() ),e1,SLOT(DisegnaGriglia()) );
176 QCheckBox *riscala =
new QCheckBox(
"&Ris",
this,
"riscala");
177 connect(riscala,SIGNAL(clicked() ),e1,SLOT(SeRiscala()) );
179 QCheckBox *risTutto =
new QCheckBox(
"&Tutti",
this,
"risTutto");
180 connect(risTutto,SIGNAL(clicked() ),e1,SLOT(SeRiscalaTutto()) );
182 QCheckBox *nset =
new QCheckBox(
"&Set",
this,
"nset");
183 connect(nset,SIGNAL(clicked() ),e1,SLOT(NSet()) );
185 QCheckBox *Logx =
new QCheckBox(
"&Logx",
this,
"Logx");
186 connect(Logx,SIGNAL(clicked() ),e1,SLOT(DisegnaLogx()) );
187 connect(e1,SIGNAL(LogxCambiato(
bool) ),Logx,SLOT(setChecked(
bool)) );
189 QCheckBox *Logy =
new QCheckBox(
"&Logy",
this,
"Logy");
190 connect(Logy,SIGNAL(clicked() ),e1,SLOT(DisegnaLogy()) );
191 connect(e1,SIGNAL(LogyCambiato(
bool) ),Logy,SLOT(setChecked(
bool)) );
193 Q3ButtonGroup *cosaDisegna =
new Q3ButtonGroup(
"cosaDisegna",
this,
"cosaDisegna");
195 cosaDisegna->insert(linee,-1);
196 cosaDisegna->insert(punti,-1);
197 cosaDisegna->insert(griglia,-1);
198 cosaDisegna->insert(Logx,-1);
199 cosaDisegna->insert(Logy,-1);
200 cosaDisegna->insert(riscala,-1);
201 cosaDisegna->insert(risTutto,-1);
202 cosaDisegna->insert(nset,-1);
204 QStatusBar *Barra =
new QStatusBar(
this,
"Barra");
205 connect(e1,SIGNAL(Stato(
const QString &) ),Barra,SLOT( message(
const QString &)) );
207 QStatusBar *Barra2 =
new QStatusBar(
this,
"Barra");
208 connect(e1,SIGNAL(StatoSequenza(
const QString &) ),Barra2,SLOT( message(
const QString &)) );
210 QSpinBox *NBin =
new QSpinBox(2,1000,20,
this,
"NBin");
211 connect(NBin,SIGNAL(valueChanged(
int)),e1,SLOT(
ImpNBin(
int)) );
212 connect(e1,SIGNAL(NBinCambiati(
int)),NBin,SLOT(setValue(
int)) );
213 QLabel *etNBin =
new QLabel(
" ",
this,
"etNBin");
214 etNBin->setAlignment( Qt::AlignHCenter);
215 etNBin->setText(
"NBin");
218 QSpinBox *NMobile =
new QSpinBox(2,1000,5,
this,
"NMobile");
219 connect(NMobile,SIGNAL(valueChanged(
int)),e1,SLOT(
ImpNMobile(
int)) );
220 connect(e1,SIGNAL(NMobileCambiato(
int)),NMobile,SLOT(setValue(
int)) );
221 QLabel *etNMobile =
new QLabel(
" ",
this,
"etNMobile");
222 etNMobile->setAlignment( Qt::AlignHCenter);
223 etNMobile->setText(
"Media Mobile");
226 QSpinBox *NCorrela =
new QSpinBox(2,100,2,
this,
"NCorrela");
227 connect(NCorrela,SIGNAL(valueChanged(
int)),e1,SLOT(
ImpNCorrela(
int)) );
228 connect(e1,SIGNAL(NCorrelaCambiato(
int)),NCorrela,SLOT(setValue(
int)) );
229 QLabel *etNCorrela =
new QLabel(
" ",
this,
"etNCorrela");
230 etNCorrela->setAlignment( Qt::AlignHCenter);
231 etNCorrela->setText(
"Correla a due");
235 connect(NVisMin,SIGNAL(ValoreCambiato(
int)),e1,SLOT(
ImpNVisMin(
int)),Qt::DirectConnection);
236 connect(e1,SIGNAL(NVisMinCambiato(
int)),NVisMin,SLOT(ImpNumero(
int)) );
237 connect(e1,SIGNAL(InterVisCambiato(
int)),NVisMin,SLOT(ImpInter(
int)) );
240 connect(NVisMax,SIGNAL(ValoreCambiato(
int)),e1,SLOT(
ImpNVisMax(
int)) );
241 connect(e1,SIGNAL(NVisMaxCambiato(
int)),NVisMax,SLOT(ImpNumero(
int)) );
242 connect(e1,SIGNAL(InterVisCambiato(
int)),NVisMax,SLOT(ImpInter(
int)) );
245 connect(NElMin,SIGNAL(ValoreCambiato(
int)),e1,SLOT(
ImpNElMin(
int)) );
246 connect(e1,SIGNAL(NElMinCambiato(
int)),NElMin,SLOT(ImpNumero(
int)) );
247 connect(e1,SIGNAL(InterElCambiato(
int)),NElMin,SLOT(ImpInter(
int)) );
250 connect(NElMax,SIGNAL(ValoreCambiato(
int)),e1,SLOT(
ImpNElMax(
int)) );
251 connect(e1,SIGNAL(NElMaxCambiato(
int)),NElMax,SLOT(ImpNumero(
int)) );
252 connect(e1,SIGNAL(InterElCambiato(
int)),NElMax,SLOT(ImpInter(
int)) );
255 connect(NElMinY,SIGNAL(ValoreCambiato(
int)),e1,SLOT(ImpNElMinY(
int)) );
256 connect(e1,SIGNAL(NElMinYCambiato(
int)),NElMinY,SLOT(ImpNumero(
int)) );
257 connect(e1,SIGNAL(InterYCambiato(
int,
int)),NElMinY,SLOT(ImpInter(
int,
int)) );
260 connect(NElMaxY,SIGNAL(ValoreCambiato(
int)),e1,SLOT(ImpNElMaxY(
int)) );
261 connect(e1,SIGNAL(NElMaxYCambiato(
int)),NElMaxY,SLOT(ImpNumero(
int)) );
262 connect(e1,SIGNAL(InterYCambiato(
int,
int)),NElMaxY,SLOT(ImpInter(
int,
int)) );
265 connect(CoordX,SIGNAL(ValoreCambiato(
int)),e1,SLOT(ImpCoordX(
int)) );
266 connect(e1,SIGNAL(CoordXCambiata(
int)),CoordX,SLOT(ImpNumero(
int)) );
267 connect(e1,SIGNAL(InterCoordXCambiato(
int,
int)),CoordX,SLOT(ImpInter(
int,
int)) );
270 connect(CoordY,SIGNAL(ValoreCambiato(
int)),e1,SLOT(ImpCoordY(
int)) );
271 connect(e1,SIGNAL(CoordYCambiata(
int)),CoordY,SLOT(ImpNumero(
int)) );
272 connect(e1,SIGNAL(InterCoordYCambiato(
int,
int)),CoordY,SLOT(ImpInter(
int,
int)) );
274 QGridLayout *grid=
new QGridLayout(
this,4,4,10);
275 grid->addWidget(esci,0,0);
276 grid->addWidget(e1,1,1);
277 grid->setColStretch(1,5);
278 grid->setRowStretch(1,5);
279 grid->setColumnMinimumWidth(1,500);
280 grid->setRowMinimumHeight(1,500);
283 QHBoxLayout *Coordinate =
new QHBoxLayout;
284 Coordinate->addWidget(qualeCoord);
285 Coordinate->addSpacing(5);
286 Coordinate->addWidget(suX);
287 Coordinate->addSpacing(-10);
288 Coordinate->addWidget(suY);
289 Coordinate->addSpacing(-10);
290 Coordinate->addWidget(suDX);
291 Coordinate->addSpacing(-10);
292 Coordinate->addWidget(suDY);
294 QHBoxLayout *Disegna =
new QHBoxLayout;
295 QVBoxLayout *DisegnaSx =
new QVBoxLayout;
296 QVBoxLayout *DisegnaDx =
new QVBoxLayout;
298 DisegnaSx->addWidget(linee);
299 DisegnaSx->addSpacing(-10);
300 DisegnaSx->addWidget(punti);
301 DisegnaSx->addSpacing(-10);
302 DisegnaSx->addWidget(Logx);
303 DisegnaSx->addSpacing(-10);
304 DisegnaSx->addWidget(Logy);
305 DisegnaSx->addSpacing(-10);
306 DisegnaDx->addWidget(riscala);
307 DisegnaDx->addSpacing(-10);
308 DisegnaDx->addWidget(risTutto);
309 DisegnaDx->addSpacing(-10);
310 DisegnaDx->addWidget(nset);
311 DisegnaDx->addSpacing(-10);
312 DisegnaDx->addWidget(griglia);
313 Disegna->addLayout(DisegnaSx);
314 Disegna->addLayout(DisegnaDx);
316 QVBoxLayout *ASinistra =
new QVBoxLayout;
317 grid->addLayout(ASinistra,1,0);
319 ASinistra->addWidget(cosaElabora);
320 ASinistra->addSpacing(5);
321 ASinistra->addWidget(sulSegnale);
322 ASinistra->addWidget(sulGrafico);
323 ASinistra->addLayout(Coordinate);
324 ASinistra->addWidget(apri);
325 ASinistra->addWidget(nomeFile);
326 ASinistra->addWidget(aggiungi);
327 ASinistra->addWidget(nomeConf);
331 ASinistra->addWidget(salva);
332 ASinistra->addWidget(nomeSalva);
333 ASinistra->addWidget(stampa);
334 ASinistra->addLayout(Disegna);
336 QVBoxLayout *ASinistraGiu =
new QVBoxLayout;
337 grid->addLayout(ASinistraGiu,3,0);
338 ASinistraGiu->addWidget(Barra2);
341 QHBoxLayout *InAlto =
new QHBoxLayout;
342 grid->addLayout(InAlto,0,1);
343 InAlto->addWidget(NElMinY);
344 InAlto->addWidget(NElMaxY);
345 InAlto->addWidget(segnali);
346 InAlto->addWidget(CoordX);
347 InAlto->addWidget(CoordY);
349 QVBoxLayout *InAlto2 =
new QVBoxLayout;
350 grid->addLayout(InAlto2,0,2);
351 InAlto2->addWidget(interRett);
352 InAlto2->addSpacing(-10);
353 InAlto2->addWidget(parabola);
356 QVBoxLayout *ADestra =
new QVBoxLayout;
357 grid->addLayout(ADestra,1,2);
358 ADestra->addWidget(NBin);
359 ADestra->addSpacing(-15);
360 ADestra->addWidget(distr);
361 ADestra->addWidget(NMobile);
362 ADestra->addSpacing(-15);
363 ADestra->addWidget(mediaMobile);
364 ADestra->addWidget(NCorrela);
365 ADestra->addSpacing(-15);
366 ADestra->addWidget(correlaADue);
367 ADestra->addSpacing(-10);
368 ADestra->addWidget(spettro);
369 ADestra->addSpacing(-10);
370 ADestra->addWidget(integrale);
371 ADestra->addSpacing(-10);
372 ADestra->addWidget(derivata);
373 ADestra->addSpacing(-10);
374 ADestra->addWidget(sum);
375 ADestra->addSpacing(-10);
376 ADestra->addWidget(autosim);
377 ADestra->addSpacing(-10);
378 ADestra->addWidget(normalizza);
379 ADestra->addSpacing(-10);
380 ADestra->addWidget(modulo);
381 ADestra->addSpacing(-10);
382 ADestra->addWidget(autocor);
383 ADestra->addSpacing(-10);
384 ADestra->addWidget(interExp);
385 ADestra->addSpacing(-10);
386 ADestra->addWidget(interGauss);
388 QVBoxLayout *ADestra1 =
new QVBoxLayout;
389 grid->addLayout(ADestra1,1,4);
394 QHBoxLayout *InBasso =
new QHBoxLayout;
395 grid->addLayout(InBasso,2,1);
396 InBasso->addWidget(NVisMin);
397 InBasso->addWidget(NVisMax);
398 InBasso->addWidget(ridisegna);
399 InBasso->addWidget(NElMin);
400 InBasso->addWidget(NElMax);
402 QHBoxLayout *InBasso2 =
new QHBoxLayout;
403 grid->addLayout(InBasso2,3,1);
404 InBasso2->addWidget(Barra);
407 void Finestra::DataFile(
char **argv,
int *FileList,
int NFile){
408 e1->Apri(argv,FileList,NFile);
410 void Finestra::ConfFile(
char *FileName){
411 e1->ChooseConfFile(FileName);
char * nomeFile
Name of the current file opened.
ElementiGrafici(QWidget *parent=0, const char *name=0)
General constructor.
void ImpNCorrela(int n)
Set the bins for the point correlation.
char * nomeConf
Name of the config file.
void ImpNBin(int n)
Set NBin.
char * nomeSalva
Name of the output file.
QString nomeTit
Title name.
void ImpNElMin(int n)
Set the minimum elaboration point.
void ImpNVisMax(int n)
Set the maximum visualisation point.
QString nomeEtY
Y axis label.
QString nomeEtX
X axis label.
void ImpNVisMin(int n)
Set the minimum visualisation point.
void ImpNElMax(int n)
Set the maximum elaboration point.
void ImpNMobile(int n)
Set the bins for the running average.