source: PSPA/Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_snapshot.cc @ 442

Last change on this file since 442 was 442, checked in by lemeur, 10 years ago

ajout traitement utilisateur

File size: 2.1 KB
Line 
1
2#include "GWt_snapshot.h"
3#include "mixedTools.h"
4
5#include <Wt/WText>
6#include <Wt/WBreak>
7#include <Wt/WLineEdit>
8#include <Wt/WDialog>
9#include <Wt/WPushButton>
10
11GWt_snapshot::GWt_snapshot(GWt_elementLigneFaisceau* elemLigne, int num) : GWt_abstractElement(new elementSnapshot(num))
12{
13  elementLigneFaiseauContainer_ = elemLigne;
14  initialize();
15}
16
17void GWt_snapshot::initilializeDialog() 
18{
19  string* param = beginDialog();
20
21  new WText("name of user's program : ",dialog_->contents());
22  programFile_ = new WLineEdit(param->c_str(),dialog_->contents());
23  new WBreak(dialog_->contents());
24
25
26  new WText("name of input beam file, output from pspa : ",dialog_->contents());
27  inputBeamFile_ = new WLineEdit( (++param)->c_str(),dialog_->contents());
28  new WBreak(dialog_->contents());
29
30  new WText("name of output beam file (input for pspa) : ",dialog_->contents());
31  outputBeamFile_ = new WLineEdit( (++param)->c_str(),dialog_->contents());
32  new WBreak(dialog_->contents());
33
34  WPushButton *annule= new WPushButton("cancel",dialog_->contents()); 
35  annule->clicked().connect(dialog_,&Wt::WDialog::reject);
36  WPushButton *submit= new WPushButton("OK",dialog_->contents());
37  submit->clicked().connect(dialog_,&Wt::WDialog::accept);
38  dialog_->finished().connect(this, &GWt_snapshot::dialogDone);
39}
40
41void GWt_snapshot::dialogDone(WDialog::DialogCode code)
42{
43  if (code != Wt::WDialog::Accepted) return;
44 
45  unsigned nbParam = abstractElement_->getNbParams();
46  string* envoi = new string[nbParam+1];
47  int compteur = -1;
48 
49  envoi[++compteur] = mixedTools::intToString(nbParam);
50  envoi[++compteur] = labelEdit_->text().toUTF8();
51  envoi[++compteur] = programFile_->text().toUTF8();
52
53  envoi[++compteur] = inputBeamFile_->text().toUTF8();
54  envoi[++compteur] = outputBeamFile_->text().toUTF8();
55
56
57  if ( compteur !=  (int)nbParam ) {
58    cerr << " GWt_snapshot::dialogDone() : pb dans le nb de parametres, compteur = " << compteur << " nbParam= " << nbParam << endl;
59    return;
60  }
61
62  abstractElement_->setParametersString(envoi);
63  delete [] envoi;
64}
65
66WImage* GWt_snapshot::getImage() {
67  return image_;
68}
Note: See TracBrowser for help on using the repository browser.