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 | |
---|
11 | GWt_snapshot::GWt_snapshot(GWt_elementLigneFaisceau* elemLigne) : GWt_abstractElement(new elementSnapshot()) |
---|
12 | { |
---|
13 | elementLigneFaiseauContainer_ = elemLigne; |
---|
14 | initialize(); |
---|
15 | } |
---|
16 | |
---|
17 | void GWt_snapshot::initilializeDialog() |
---|
18 | { |
---|
19 | string* param = beginDialog(); |
---|
20 | |
---|
21 | new WText("name of file for snapshot : ",dialog_->contents()); |
---|
22 | snapshotFile_ = new WLineEdit(param->c_str(),dialog_->contents()); |
---|
23 | new WBreak(dialog_->contents()); |
---|
24 | |
---|
25 | WPushButton *annule= new WPushButton("cancel",dialog_->contents()); |
---|
26 | annule->clicked().connect(dialog_,&Wt::WDialog::reject); |
---|
27 | WPushButton *submit= new WPushButton("OK",dialog_->contents()); |
---|
28 | submit->clicked().connect(dialog_,&Wt::WDialog::accept); |
---|
29 | dialog_->finished().connect(this, &GWt_snapshot::dialogDone); |
---|
30 | } |
---|
31 | |
---|
32 | void GWt_snapshot::dialogDone(WDialog::DialogCode code) |
---|
33 | { |
---|
34 | if (code != Wt::WDialog::Accepted) return; |
---|
35 | |
---|
36 | unsigned nbParam = abstractElement_->getNbParams(); |
---|
37 | string* envoi = new string[nbParam+1]; |
---|
38 | int compteur = -1; |
---|
39 | |
---|
40 | envoi[++compteur] = mixedTools::intToString(nbParam); |
---|
41 | envoi[++compteur] = labelEdit_->text().toUTF8(); |
---|
42 | envoi[++compteur] = snapshotFile_->text().toUTF8(); |
---|
43 | if ( compteur != (int)nbParam ) { |
---|
44 | cerr << " GWt_snapshot::dialogDone() : pb dans le nb de parametres, compteur = " << compteur << " nbParam= " << nbParam << endl; |
---|
45 | return; |
---|
46 | } |
---|
47 | |
---|
48 | abstractElement_->setParametersString(envoi); |
---|
49 | delete [] envoi; |
---|
50 | } |
---|
51 | |
---|
52 | WImage* GWt_snapshot::getImage() { |
---|
53 | return image_; |
---|
54 | } |
---|