コード例 #1
0
void ProfileList::openEditDialog(db::Preset preset)
{
  _dialog = new Wt::WDialog("Edit Preset", this);
  _dialog->setClosable(true);
  ProfileEditor * editor = new ProfileEditor(preset,_dialog->contents());

  Wt::WPushButton *ok = new Wt::WPushButton("Analyze & Save", _dialog->footer());
  ok->setDefault(true);
  ok->clicked().connect(editor, &ProfileEditor::saveProfile);

  Wt::WPushButton *cancel = new Wt::WPushButton("Cancel", _dialog->footer());
  cancel->clicked().connect(_dialog, &Wt::WDialog::reject);
  editor->_presetSaved.connect(this, &ProfileList::dialogSave);

  _dialog->show();
}
コード例 #2
0
std::string ProfileEditor::checkJsonProfile(JSONNode&root) {
  std::string result;
  /*check the root conatins required data*/
  if (!root.contains("name")) {
    result = "no profile name given!";
  } else if (!root.contains("format")) {
    result = "no format attribute found!";
  } else if (!root.contains("video")) {
    result = "no video attribute found!";
  } else if (!root.contains("audio")) {
    result = "no audio attribute found!";
  } else if (!root["format"].contains("id")) {
    result = "no id attribute found in attribute \"format\"!";
  } else if (!root["video"].contains("id")) {
    result = "no id attribute found in attribute \"video\"!";
  } else if (!root["audio"].contains("id")) {
    result = "no id attribute found in attribute \"audio\"!";
  }else{
    //Wt::WApplication::instance()->attachThread(true);

    analyzerDialog=new Wt::WDialog(this);
    analyzerDialog->setWidth(800);
    analyzerDialog->setHeight(500);
    progressBar=new Wt::WProgressBar();
    progressBar->setMinimum(0);
    progressBar->setMaximum(250);

    fpsText=new Wt::WText("FPS");
    psnrText=new Wt::WText("PSNR");
    Wt::WVBoxLayout *vbox = new Wt::WVBoxLayout();
    analyzerDialog->contents()->setLayout(vbox);

    chart=new Wt::Chart::WCartesianChart();
    chart->resize(700,350);
    //chart->setHidden(true);
    vbox->addWidget(progressBar);
    vbox->addWidget(fpsText);
    vbox->addWidget(psnrText);
    vbox->addWidget(chart);


    analyzerDialog->show();


    //app->enableUpdates();
    LOGDEBUG("thread attached");
    _verifier=new org::esb::plugin::PresetVerifier();
    _verifier->progress=boost::bind(&ProfileEditor::progress, this, _1);
    _verifier->completed=boost::bind(&ProfileEditor::completed, this, _1);

    Wt::WPushButton *ok = new Wt::WPushButton("Close", analyzerDialog->footer());
    ok->setDefault(true);
    ok->setEnabled(false);
    ok->clicked().connect(this, &ProfileEditor::closeAnalyzer);

    _selfApp=Wt::WApplication::instance();
    _selfApp->enableUpdates();
    a=0;
    go(org::esb::plugin::PresetVerifier::verify, _verifier, root, true, true);

    //verifier.verify(root);
    //analyzerDialog->reject();
    //go(ProfileEditor::startAnalyzeThread, this, root, Wt::WApplication::instance());
  }
  return result;
}