コード例 #1
0
ファイル: mainwindow.cpp プロジェクト: EPeillard/qgo
void MainWindow::slot_fileOpen()
{
    QFileDialog *dialog = new QFileDialog(this);
    dialog->setOption(QFileDialog::DontUseNativeDialog, true);
    SGFPreview *previewWidget = new SGFPreview(dialog);
    QGridLayout *layout = (QGridLayout*)dialog->layout();
    layout->addWidget(previewWidget, 1, 3);
    connect(dialog,SIGNAL(currentChanged(QString)),previewWidget,SLOT(setPath(QString)));
    connect(dialog,SIGNAL(fileSelected(QString)),this,SLOT(openSGF(QString)));
    dialog->setNameFilter("Smart Game Format (*.sgf *.SGF)");
    dialog->setFileMode(QFileDialog::ExistingFile);
    dialog->exec();
    delete dialog;
}
コード例 #2
0
void PluginGeneratorGUI::saveAsXMLPlugin()
{
	QFileDialog* saveDiag = new QFileDialog(this,tr("Save XML Plugin File"),finfo.absolutePath(), tr("MeshLab XML Plugin (*.xml)"));
#if defined(Q_OS_MAC)
	saveDiag->setOption(QFileDialog::DontUseNativeDialog,true);
#endif
	QLabel* namelab = new QLabel(tr("JScript Plugin Name"),saveDiag);
	QLineEdit* jsline= new QLineEdit(plugscriptname,saveDiag);
	QLabel* authlab = new QLabel(tr("Author Name"),saveDiag);
	QLineEdit* authline= new QLineEdit(author,saveDiag);
	QLabel* maillab = new QLabel(tr("Author e-Mail"),saveDiag);
	QLineEdit* mailline= new QLineEdit(mail,saveDiag);
	QCheckBox* cpp = new QCheckBox(tr("Generate *.cpp,*.h"),saveDiag);
	cpp->setChecked(false);

	QGridLayout* layout = (QGridLayout*) saveDiag->layout();
	layout->addWidget(namelab,4,0);
	layout->addWidget(jsline,4,1);
	layout->addWidget(authlab,5,0);
	layout->addWidget(authline,5,1);
	layout->addWidget(maillab,6,0);
	layout->addWidget(mailline,6,1);
	layout->addWidget(cpp,7,1);

	saveDiag->setAcceptMode(QFileDialog::AcceptSave);
	saveDiag->exec();
	plugscriptname = jsline->text();
	author = authline->text();
	mail = mailline->text();
	QStringList files = saveDiag->selectedFiles();
	if (files.size() != 1)
		return;
	QString fileName = files[0];
	save(fileName,cpp->isChecked());
	/*for(int ii = 0;ii < tabs->count();++ii)
	{
		XMLFilterInfo::XMLMap mp;
		collectFilterInfo(mp);
		ls.push_back(mp);
	}*/
	delete saveDiag;
}
コード例 #3
0
QString QmitkToFRecorderWidget::getSaveFileName(mitk::ToFImageWriter::ToFImageType& tofImageType,
                                     bool& distanceImageSelected,
                                     bool& amplitudeImageSelected,
                                     bool& intensityImageSelected,
                                     bool& rgbImageSelected,
                                     bool& rawDataSelected,
                                     QWidget *parent,
                                     const QString &caption,
                                     const QString &dir,
                                     const QString &filter,
                                     QString *selectedFilter,
                                     QFileDialog::Options options
                                     )
{
  QString selectedFileName = "";
  QComboBox* combo = new QComboBox;
  combo->addItem("3D");
  combo->addItem("2D + t");

  QHBoxLayout* checkBoxGroup = new QHBoxLayout();

  QCheckBox* distanceImageCheckBox = new QCheckBox;
  distanceImageCheckBox->setText("Distance image");
  distanceImageCheckBox->setChecked(distanceImageSelected);
  QCheckBox* amplitudeImageCheckBox = new QCheckBox;
  amplitudeImageCheckBox->setText("Amplitude image");
  amplitudeImageCheckBox->setChecked(amplitudeImageSelected);
  QCheckBox* intensityImageCheckBox = new QCheckBox;
  intensityImageCheckBox->setText("Intensity image");
  intensityImageCheckBox->setChecked(intensityImageSelected);
  QCheckBox* rgbImageCheckBox = new QCheckBox;
  rgbImageCheckBox->setText("RGB image");
  rgbImageCheckBox->setChecked(rgbImageSelected);
  QCheckBox* rawDataCheckBox = new QCheckBox;
  rawDataCheckBox->setText("Raw data");
  rawDataCheckBox->setChecked(false);
  rawDataCheckBox->setEnabled(false);

  checkBoxGroup->addWidget(distanceImageCheckBox);
  checkBoxGroup->addWidget(amplitudeImageCheckBox);
  checkBoxGroup->addWidget(intensityImageCheckBox);
  checkBoxGroup->addWidget(rgbImageCheckBox);
  checkBoxGroup->addWidget(rawDataCheckBox);

  QFileDialog* fileDialog = new QFileDialog(parent, caption, dir, filter);

  QLayout* layout = fileDialog->layout();
  QGridLayout* gridbox = qobject_cast<QGridLayout*>(layout);

  if (gridbox)
  {
    gridbox->addWidget(new QLabel("ToF-Image type:"));
    gridbox->addWidget(combo);
    int lastRow = gridbox->rowCount();
    gridbox->addLayout(checkBoxGroup, lastRow, 0, 1, -1);
  }

  fileDialog->setLayout(gridbox);
  fileDialog->setAcceptMode(QFileDialog::AcceptSave);

  if (selectedFilter)
  {
    fileDialog->selectNameFilter(*selectedFilter);
  }

  if (fileDialog->exec() == QDialog::Accepted)
  {
    if (selectedFilter)
    {
      *selectedFilter = fileDialog->selectedFilter();
    }

    if (combo->currentIndex() == 0)
    {
      tofImageType = mitk::ToFImageWriter::ToFImageType3D;
    }

    else
    {
      tofImageType = mitk::ToFImageWriter::ToFImageType2DPlusT;
    }

    distanceImageSelected = distanceImageCheckBox->isChecked();
    amplitudeImageSelected = amplitudeImageCheckBox->isChecked();
    intensityImageSelected = intensityImageCheckBox->isChecked();
    rgbImageSelected = rgbImageCheckBox->isChecked();
    rawDataSelected = rawDataCheckBox->isChecked();

    selectedFileName = fileDialog->selectedFiles().value(0);
  }

  delete fileDialog;
  return selectedFileName;
}