Changeset 147 in PSPA for Interface_Web/trunk/pspaWT/src
- Timestamp:
- Dec 6, 2012, 4:43:31 PM (12 years ago)
- Location:
- Interface_Web/trunk/pspaWT/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/src/GWt_dialog.cc
r145 r147 3 3 #include <Wt/WText> 4 4 #include <Wt/WBreak> 5 #include <Wt/WHBoxLayout> 5 6 #include <Wt/WPushButton> 6 7 #include "GWt_dialog.h" 7 8 8 GWt_dialog::GWt_dialog(WString titre, std::string message, bool modal, bool patienter,bool ok): 9 GWt_dialog::GWt_dialog( 10 WString titre, 11 std::string message, 12 iconType icon, 13 bool modal, 14 bool ok 15 ): 9 16 WDialog(titre) 10 17 { 11 18 12 // changement des "\n" par des <br> 13 size_t pos = message.find("\n", 0); 19 WContainerWidget* widgt = new WContainerWidget(contents()); 20 WHBoxLayout* hLayout = new WHBoxLayout(); 21 22 WImage* tImg = new WImage("icons/error.png"); 23 switch (icon) { 24 case Warning: 25 tImg->setImageLink ("icons/warning.png"); 26 tImg->setMaximumSize (70,70); 27 hLayout->addWidget(tImg); 28 break; 29 case Error: 30 tImg->setImageLink ("icons/error.png"); 31 tImg->setMaximumSize (70,70); 32 hLayout->addWidget(tImg); 33 break; 34 case Info: 35 tImg->setImageLink ("icons/info.png"); 36 tImg->setMaximumSize (70,70); 37 hLayout->addWidget(tImg); 38 break; 39 case Wait: 40 tImg->setImageLink ("icons/patienter.gif"); 41 tImg->setMaximumSize (70,70); 42 hLayout->addWidget(tImg); 43 break; 44 case NoIcon: 45 break; 46 default: 47 break; 48 } 14 49 15 while(pos != std::string::npos) { 16 new Wt::WText(message.substr(0,pos),contents()); 17 message = message.substr(pos+1); 18 pos = message.find("\n"); 19 new Wt::WBreak(contents()); 20 } 21 new Wt::WText(message,contents()); 50 WContainerWidget* right = new WContainerWidget(); 51 WVBoxLayout* vLayout = new WVBoxLayout(); 52 53 // changement des "\n" par des <br> 54 size_t pos = message.find("\n", 0); 55 56 while(pos != std::string::npos) { 57 vLayout->addWidget(new Wt::WText(message.substr(0,pos),widgt)); 58 message = message.substr(pos+1); 59 pos = message.find("\n"); 60 vLayout->addWidget(new Wt::WBreak()); 61 } 62 vLayout->addWidget(new Wt::WText(message)); 63 64 65 if (ok) { 66 vLayout->addWidget(new Wt::WBreak); 67 68 Wt::WPushButton *ok = new Wt::WPushButton("Ok"); 69 vLayout->addWidget(ok); 70 71 // this event will accept() the Dialog 72 ok->clicked().connect(this, &Wt::WDialog::accept); 73 } 74 75 right->setLayout(vLayout); 76 hLayout->addWidget(right); 22 77 23 if (patienter) { 24 new WImage("icons/patienter.gif",contents()); 25 } 26 if (ok) { 27 new Wt::WBreak(contents()); 28 29 Wt::WPushButton *ok = new Wt::WPushButton("Ok", contents()); 30 31 // this event will accept() the Dialog 32 ok->clicked().connect(this, &Wt::WDialog::accept); 33 } 34 setModal (modal); 78 widgt->setLayout(hLayout); 79 80 setModal (modal); 35 81 } 36 82 -
Interface_Web/trunk/pspaWT/src/GWt_pspaApplication.cc
r144 r147 318 318 { 319 319 addConsoleMessage(" bad section definition ! \n "); 320 GWt_dialog warningDialog("PSPA : Vérification des sections", " bad section definition !", true,false,true);320 GWt_dialog warningDialog("PSPA : Vérification des sections", " bad section definition !", GWt_dialog::Error,true,true); 321 321 warningDialog.exec(); 322 322 return; … … 332 332 { 333 333 addConsoleMessage(" bad section definition ! \n "); 334 GWt_dialog warningDialog("PSPA : Vérification des sections", " bad section definition !", true,false,true);334 GWt_dialog warningDialog("PSPA : Vérification des sections", " bad section definition !", GWt_dialog::Error, true,true); 335 335 warningDialog.exec(); 336 336 return; … … 343 343 344 344 if (!areDataCoherent()) { 345 GWt_dialog warningDialog("PSPA : Vérification des sections", " données incohérentes !", true,false,true);345 GWt_dialog warningDialog("PSPA : Vérification des sections", " données incohérentes !", GWt_dialog::Error,true,true); 346 346 warningDialog.exec(); 347 347 } … … 375 375 caMarche = false; 376 376 addConsoleMessage(diagnostic.c_str()); 377 GWt_dialog calculDialog("PSPA : Erreur lors de check execute", diagnostic , true,false,true);377 GWt_dialog calculDialog("PSPA : Erreur lors de check execute", diagnostic , GWt_dialog::Error,true,true); 378 378 calculDialog.exec(); 379 379 } … … 396 396 static_cast<GWt_globalParameters*>(globalParam_)->updateGlobals(); 397 397 398 GWt_dialog calculDialog("Calcul en cours", "Veuillez patienter...", false,true);398 GWt_dialog calculDialog("Calcul en cours", "Veuillez patienter...", GWt_dialog::Error, true,false); 399 399 calculDialog.show(); 400 400 … … 403 403 string resultat; 404 404 if ( !dtmanage_->executeAll(resultat)) { 405 GWt_dialog warningDialog("PSPA : Echec", " echec lors de l'exécution !", true,false,true);405 GWt_dialog warningDialog("PSPA : Echec", " echec lors de l'exécution !", GWt_dialog::Error, true,true); 406 406 warningDialog.exec(); 407 407 }
Note: See TracChangeset
for help on using the changeset viewer.