Changeset 174 in PSPA


Ignore:
Timestamp:
Dec 12, 2012, 12:03:54 PM (12 years ago)
Author:
garnier
Message:

ajout de fileselecteur, manque quelques petits details

Location:
Interface_Web/trunk/pspaWT
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/include/GWt_dialog.h

    r148 r174  
    44#include <Wt/WDialog>
    55#include <Wt/WString>
     6#include <Wt/WContainerWidget>
    67
    78using namespace Wt;
     
    2223  enum  iconType { Warning, Error, Info, Wait, NoIcon };
    2324
     25  /** Add a dialog with the given container inside
     26      @param titre: A title displayed on the window title bar
     27      @param message: The message inside this dialog
     28      @param container: a valid WContainer
     29  */
     30  GWt_dialog(WString titre, WContainerWidget* container, bool modal=false);
     31
     32  /** Add a full dialog window configure with title, message, iconType and button
     33      @param titre: A title displayed on the window title bar
     34      @param message: The message inside this dialog
     35      @param icon: IconType, could be Warning, Error, Info, Wait or NoIcon
     36      @param modal: true for a blocking dialog, false for a non-blocking dialog
     37      @param okButton: true if you want a "ok" button at the end
     38  */
    2439  GWt_dialog(WString titre, std::string message, iconType icon=NoIcon, bool modal=false, bool okButton=false);
    2540};
  • Interface_Web/trunk/pspaWT/include/GWt_pspaApplication.h

    r173 r174  
    4646 WContainerWidget* contenuSections_;
    4747 list<GWt_sectionToExecute*> selectedSections_;
     48 WFileUpload* uploadFileSelectorWidget;
    4849
    4950 WText*   createTitle(const WString&);
     
    5960 void restaurer();
    6061 void chargerConfig();
     62 void openFileSelector();
    6163 void dessiner();
    6264
  • Interface_Web/trunk/pspaWT/src/GWt_LigneFaisceau.cc

    r170 r174  
    126126
    127127  message_= new GWt_dialog("Question","Are you sure you want to delete the selected item?",GWt_dialog::Warning,true,true);
    128   message_->setClosable(true);
    129128
    130129  WSignalMapper<GWt_abstractElement *> *MyMap = new WSignalMapper<GWt_abstractElement *>(this);
  • Interface_Web/trunk/pspaWT/src/GWt_dialog.cc

    r163 r174  
    77#include <Wt/WCssDecorationStyle>
    88#include "GWt_dialog.h"
     9
     10GWt_dialog::GWt_dialog(
     11 WString titre,
     12 WContainerWidget* wc,
     13 bool modal
     14):
     15  WDialog(titre)
     16{
     17
     18  // change the title bar style
     19  titleBar()->decorationStyle().setBackgroundColor (WColor(70,180,220));
     20 
     21  WContainerWidget* widgt = new WContainerWidget(contents());
     22  widgt->addWidget(wc);
     23 
     24  setClosable(true);
     25  setModal (modal);
     26}
     27
     28
    929
    1030GWt_dialog::GWt_dialog(
     
    82102 widgt->setLayout(hLayout);
    83103
     104 setClosable(true);
    84105 setModal (modal);
    85106}
  • Interface_Web/trunk/pspaWT/src/GWt_pspaApplication.cc

    r173 r174  
    6363  //  boutonLoadNew->setMinimumSize(30,30);
    6464 
    65   //  uploadWidget = new WFileUpload(w);
    66   WContainerWidget *result = new WContainerWidget();
    67   WFileUpload *const uploadWidget = new WFileUpload(result);
    68   uploadWidget->setFileTextSize(40);
    69  
    7065  // Upload when the button is clicked.
    71   boutonLoadNew->clicked().connect(uploadWidget, &WFileUpload::upload);
    72   //  boutonLoadNew->clicked().connect(boutonLoadNew, &Wt::WPushButton::disable);
    73 
    74   // Upload automatically when the user entered a file.
    75   uploadWidget->changed().connect(uploadWidget, &WFileUpload::upload);
    76   //  uploadWidget->changed().connect(boutonLoadNew, &Wt::WPushButton::disable);
    77 
    7866  // React to a succesfull upload.
    79   uploadWidget->uploaded().connect(this, &PspaApplication::chargerConfig);
    80  
    81   // React to a fileupload problem.
    82   //  upload->fileTooLarge().connect(this, &MyWidget::fileTooLarge);
    83 
     67  boutonLoadNew->clicked().connect(this, &PspaApplication::openFileSelector);
    8468
    8569
     
    8872  toolbarLayout->addWidget(boutonRestaure , 1);
    8973  toolbarLayout->addWidget(boutonLoadNew , 1);
    90   toolbarLayout->addWidget(result , 1);
    9174  boutonSauve->clicked().connect(this, &PspaApplication::sauver);
    9275  boutonRestaure->clicked().connect(this, &PspaApplication::restaurer);
     
    476459}
    477460
     461
     462void PspaApplication::openFileSelector()
     463{
     464
     465  WContainerWidget *result = new WContainerWidget();
     466  uploadFileSelectorWidget = new WFileUpload(result);
     467  uploadFileSelectorWidget->setFileTextSize(40);
     468 
     469  // Upload automatically when the user entered a file.
     470  uploadFileSelectorWidget->changed().connect(uploadFileSelectorWidget, &WFileUpload::upload);
     471  //  uploadFileSelectorWidget->changed().connect(boutonLoadNew, &Wt::WPushButton::disable);
     472 
     473  // React to a succesfull upload.
     474  uploadFileSelectorWidget->uploaded().connect(this, &PspaApplication::chargerConfig);
     475 
     476  // React to a fileupload problem.
     477  //...  upload->fileTooLarge().connect(this, &MyWidget::fileTooLarge);
     478 
     479 
     480  GWt_dialog* fileSelectorDialog = new GWt_dialog("Load a file",result,false);
     481 
     482  fileSelectorDialog->exec();
     483}
     484
     485
    478486void PspaApplication::chargerConfig()
    479487{
    480 //   std::string filename = uploadWidget->spoolFileName();
    481 //   addConsoleMessage(string("chargement de la configuration...:"+filename));
    482 }
     488  GWt_dialog*  message= new GWt_dialog("Info","The file has been correctly upload to" + uploadFileSelectorWidget->spoolFileName(),GWt_dialog::Warning,false,true);
     489 
     490  message->show();
     491}
     492
    483493
    484494void PspaApplication::faireDessin()
Note: See TracChangeset for help on using the changeset viewer.