void DlgSettingsExportFormat::createCurveSelection (QGridLayout *layout, int &row)
{
  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsExportFormat::createCurveSelection";

  QLabel *labelIncluded = new QLabel (tr ("Included"));
  layout->addWidget (labelIncluded, row, 0);

  QLabel *labelExcluded = new QLabel (tr ("Not included"));
  layout->addWidget (labelExcluded, row++, 2);

  m_listIncluded = new QListWidget;
  m_listIncluded->setSortingEnabled (false); // Preserve order from Document
  m_listIncluded->setWhatsThis (tr ("List of curves to be included in the exported file.\n\n"
                                    "The order of the curves here does not affect the order in the exported file. That "
                                    "order is determined by the Curves settings."));
  m_listIncluded->setSelectionMode (QAbstractItemView::MultiSelection);
  layout->addWidget (m_listIncluded, row, 0, 4, 1);
  connect (m_listIncluded, SIGNAL (itemSelectionChanged ()), this, SLOT (slotListIncluded()));

  m_listExcluded = new QListWidget;
  m_listExcluded->setSortingEnabled (false); // Preserve order from Document
  m_listExcluded->setWhatsThis (tr ("List of curves to be excluded from the exported file"));
  m_listExcluded->setSelectionMode (QAbstractItemView::MultiSelection);
  layout->addWidget (m_listExcluded, row++, 2, 4, 1);
  connect (m_listExcluded, SIGNAL (itemSelectionChanged ()), this, SLOT (slotListExcluded()));

  m_btnInclude = new QPushButton (tr ("<<Include"));
  m_btnInclude->setEnabled (false);
  m_btnInclude->setWhatsThis (tr ("Move the currently selected curve(s) from the excluded list"));
  layout->addWidget (m_btnInclude, row++, 1);
  connect (m_btnInclude, SIGNAL (released ()), this, SLOT (slotInclude()));

  m_btnExclude = new QPushButton (tr ("Exclude>>"));
  m_btnExclude->setEnabled (false);
  m_btnExclude->setWhatsThis (tr ("Move the currently selected curve(s) from the included list"));
  layout->addWidget (m_btnExclude, row++, 1);
  connect (m_btnExclude, SIGNAL (released ()), this, SLOT (slotExclude()));

  row++;
}
Esempio n. 2
0
ExportDlg::ExportDlg(QString title, PointSets* pointSets, const CoordSettings* coord,
  const GridMeshSettings* grid, ExportSettings* xport) :
  QDialog(0, "exportdlg", true),
  pointSets(pointSets),
  coord(coord),
  grid(grid),
  xport(xport)
{
  DigitDebug::ctor(QString("exportdlg ") + QString::number((ulong) this, 16));
  
  setCaption(tr("Export Settings - [%1]%2")
    .arg(title)
    .arg(freewareCaption));

  setFixedSize(380, 650);

  // curve selection
  groupCurveSelection = new Q3GroupBox(QString(tr("Curve Selection")), this);
  CHECK_PTR_ENGAUGE(groupCurveSelection);
  groupCurveSelection->setGeometry(10, 10, 360, 150);
  
  labelIncluded = new QLabel(QString(tr("Included")), groupCurveSelection);
  CHECK_PTR_ENGAUGE(labelIncluded);
  labelIncluded->setGeometry(10, 20, 110, 20);

  labelExcluded = new QLabel(QString(tr("Not included")), groupCurveSelection);
  CHECK_PTR_ENGAUGE(labelExcluded);
  labelExcluded->setGeometry(240, 20, 110, 20);
  
  listIncluded = new Q3ListBox(groupCurveSelection);
  CHECK_PTR_ENGAUGE(listIncluded);
  listIncluded->setGeometry(10, 40, 110, 100);
  QWhatsThis::add(listIncluded, QString(tr("List of curves to be included in the exported file")));
  connect(listIncluded, SIGNAL(selectionChanged(Q3ListBoxItem*)), this, SLOT(slotIncluded(Q3ListBoxItem*)));
  
  listExcluded = new Q3ListBox(groupCurveSelection);
  CHECK_PTR_ENGAUGE(listExcluded);
  listExcluded->setGeometry(240, 40, 110, 100);
  QWhatsThis::add(listExcluded, QString(tr("List of curves to be excluded from the exported file")));
  connect(listExcluded, SIGNAL(selectionChanged(Q3ListBoxItem*)), this, SLOT(slotExcluded(Q3ListBoxItem*)));
  
  buttonInclude = new QPushButton(QString(tr("<<Include")), groupCurveSelection);
  CHECK_PTR_ENGAUGE(buttonInclude);
  buttonInclude->setGeometry(130, 40, 100, 30);
  QWhatsThis::add(buttonInclude, QString(tr("Move the currently selected curve from the excluded list "
    "to the included list")));
  connect(buttonInclude, SIGNAL(clicked()), this, SLOT(slotInclude()));
  
  buttonExclude = new QPushButton(QString(tr("Exclude>>")), groupCurveSelection);
  CHECK_PTR_ENGAUGE(buttonExclude);
  buttonExclude->setGeometry(130, 80, 100, 30);
  QWhatsThis::add(buttonExclude, QString(tr("Move the currently selected curve from the included list "
    "to the excluded list")));
  connect(buttonExclude, SIGNAL(clicked()), this, SLOT(slotExclude()));
  
  // points selection
  groupPointsSelection = new Q3ButtonGroup(QString(tr("Points Selection")), this);
  CHECK_PTR_ENGAUGE(groupPointsSelection);
  groupPointsSelection->setGeometry(10, 170, 360, 110);

  buttonXAllCurves = new QRadioButton(QString(tr("Interpolate Y's at X's from all curves")),
    groupPointsSelection);
  CHECK_PTR_ENGAUGE(buttonXAllCurves);
  buttonXAllCurves->setGeometry(10, 20, 300, 20);
  QWhatsThis::add(buttonXAllCurves, QString(tr("Exported file will have values at every unique X "
    "value from every curve. Y values will be linearly interpolated if necessary")));
  connect(buttonXAllCurves, SIGNAL(toggled(bool)), this, SLOT(slotXAllCurves(bool)));

  buttonXFirstCurve = new QRadioButton(QString(tr("Interpolate Y's at X's from first curve")),
    groupPointsSelection);
  CHECK_PTR_ENGAUGE(buttonXFirstCurve);
  buttonXFirstCurve->setGeometry(10, 40, 300, 20);
  QWhatsThis::add(buttonXFirstCurve, QString(tr("Exported file will have values at every unique X "
    "value from the first curve. Y values will be linearly interpolated if necessary")));
  connect(buttonXFirstCurve, SIGNAL(toggled(bool)), this, SLOT(slotXFirstCurve(bool)));

  buttonXGridLines = new QRadioButton(QString(tr("Interpolate Y's at grid line X's")), groupPointsSelection);
  CHECK_PTR_ENGAUGE(buttonXGridLines);
  buttonXGridLines->setGeometry(10, 60, 300, 20);
  QWhatsThis::add(buttonXGridLines, QString(tr("Exported file will have values at every unique X "
    "grid line. Y values will be linearly interpolated if necessary")));
  connect(buttonXGridLines, SIGNAL(toggled(bool)), this, SLOT(slotXGridLines(bool)));

  buttonXYAllCurves = new QRadioButton(QString(tr("Raw X's and Y's")), groupPointsSelection);
  CHECK_PTR_ENGAUGE(buttonXYAllCurves);
  buttonXYAllCurves->setGeometry(10, 80, 300, 20);
  QWhatsThis::add(buttonXYAllCurves, QString(tr("Exported file will have only original X and Y values "
    "without any interpolation")));
  connect(buttonXYAllCurves, SIGNAL(toggled(bool)), this, SLOT(slotXYAllCurves(bool)));

  // layout
  groupLayout = new Q3ButtonGroup(QString(tr("Layout")), this);
  CHECK_PTR_ENGAUGE(groupLayout);
  groupLayout->setGeometry(10, 290, 360, 70);

  buttonAllCurvesOnEachLine = new QRadioButton(QString(tr("All curves on each line")), groupLayout);
  CHECK_PTR_ENGAUGE(buttonAllCurvesOnEachLine);
  buttonAllCurvesOnEachLine->setGeometry(10, 20, 210, 20);
  QWhatsThis::add(buttonAllCurvesOnEachLine, QString(tr("Exported file will have, on each line, "
    "an X value, the Y value for the first curve, the Y value for the second curve,...")));
  connect(buttonAllCurvesOnEachLine, SIGNAL(toggled(bool)), this, SLOT(slotAllCurvesOnEachLine(bool)));

  buttonOneCurveOnEachLine = new QRadioButton(QString(tr("One curve on each line")), groupLayout);
  CHECK_PTR_ENGAUGE(buttonOneCurveOnEachLine);
  buttonOneCurveOnEachLine->setGeometry(10, 40, 210, 20);
  QWhatsThis::add(buttonOneCurveOnEachLine, QString(tr("Exported file will have all the points for "
    "the first curve, with one X-Y pair on each line, then the points for the second curve,...")));
  connect(buttonOneCurveOnEachLine, SIGNAL(toggled(bool)), this, SLOT(slotOneCurveOnEachLine(bool)));

  // delimiters
  groupDelimiters = new Q3ButtonGroup(QString(tr("Delimiters")), this);
  CHECK_PTR_ENGAUGE(groupDelimiters);
  groupDelimiters->setGeometry(10, 370, 113, 90);

  buttonCommas = new QRadioButton(QString(tr("Commas")), groupDelimiters);
  CHECK_PTR_ENGAUGE(buttonCommas);
  buttonCommas->setGeometry(10, 20, 110, 20);
  QWhatsThis::add(buttonCommas, QString(tr("Exported file will have commas between adjacent values")));
  connect(buttonCommas, SIGNAL(toggled(bool)), this, SLOT(slotCommas(bool)));

  buttonSpaces = new QRadioButton(QString(tr("Spaces")), groupDelimiters);
  CHECK_PTR_ENGAUGE(buttonSpaces);
  buttonSpaces->setGeometry(10, 40, 110, 20);
  QWhatsThis::add(buttonSpaces, QString(tr("Exported file will have spaces between adjacent values")));
  connect(buttonSpaces, SIGNAL(toggled(bool)), this, SLOT(slotSpaces(bool)));

  buttonTabs = new QRadioButton(QString(tr("Tabs")), groupDelimiters);
  CHECK_PTR_ENGAUGE(buttonTabs);
  buttonTabs->setGeometry(10, 60, 110, 20);
  QWhatsThis::add(buttonTabs, QString(tr("Exported file will have tabs between adjacent values")));
  connect(buttonTabs, SIGNAL(toggled(bool)), this, SLOT(slotTabs(bool)));

  // header
  groupHeader = new Q3ButtonGroup(QString(tr("Header")), this);
  CHECK_PTR_ENGAUGE(groupHeader);
  groupHeader->setGeometry(133, 370, 113, 90);

  buttonNone = new QRadioButton(QString(tr("None")), groupHeader);
  CHECK_PTR_ENGAUGE(buttonNone);
  buttonNone->setGeometry(10, 20, 110, 20);
  QWhatsThis::add(buttonNone, QString(tr("Exported file will have no header line")));
  connect(buttonNone, SIGNAL(toggled(bool)), this, SLOT(slotNone(bool)));

  buttonSimple = new QRadioButton(QString(tr("Simple")), groupHeader);
  CHECK_PTR_ENGAUGE(buttonSimple);
  buttonSimple->setGeometry(10, 40, 110, 20);
  QWhatsThis::add(buttonSimple, QString(tr("Exported file will have simple header line")));
  connect(buttonSimple, SIGNAL(toggled(bool)), this, SLOT(slotSimple(bool)));

  buttonGnuplot = new QRadioButton(QString(tr("Gnuplot")), groupHeader);
  CHECK_PTR_ENGAUGE(buttonGnuplot);
  buttonGnuplot->setGeometry(10, 60, 110, 20);
  QWhatsThis::add(buttonGnuplot, QString(tr("Exported file will have gnuplot header line")));
  connect(buttonGnuplot, SIGNAL(toggled(bool)), this, SLOT(slotGnuplot(bool)));

  // x label for header
  if (coord->frame == Cartesian)
    labelXThetaLabel = new QLabel(QString(tr("Header X Label")), this);
  else
    labelXThetaLabel = new QLabel(QString(tr("Header Theta Label")), this);
  CHECK_PTR_ENGAUGE(labelXThetaLabel);
  labelXThetaLabel->setGeometry(256, 390, 114, 20);

  editXThetaLabel = new QLineEdit(this);
  CHECK_PTR_ENGAUGE(editXThetaLabel);
  editXThetaLabel->setGeometry(256, 410, 110, 20);
  if (coord->frame == Cartesian)
    QWhatsThis::add(editXThetaLabel, QString(tr("Label in the header for x values")));
  else
    QWhatsThis::add(editXThetaLabel, QString(tr("Label in the header for theta values")));
  connect(editXThetaLabel, SIGNAL(textEdited(const QString&)), this, SLOT(slotXThetaLabel(const QString&)));

  // preview
  labelPreview = new QLabel(QString(tr("Preview")), this);
  CHECK_PTR_ENGAUGE(labelPreview);
  labelPreview->setGeometry(10, 470, 100, 20);

  listPreview = new Q3ListBox(this);
  CHECK_PTR_ENGAUGE(listPreview);
  listPreview->setGeometry(10, 490, 360, 110);
  QWhatsThis::add(listPreview, QString(tr("Preview window shows how current settings affect the exported file")));

  // navigation buttons
  buttonOk = new QPushButton(tr("OK"), this);
  CHECK_PTR_ENGAUGE(buttonOk);
  buttonOk->setGeometry(45, 610, 100, 30);
  connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));

  buttonCancel = new QPushButton(tr("Cancel"), this);
  CHECK_PTR_ENGAUGE(buttonCancel);
  buttonCancel->setGeometry(175, 610, 100, 30);
  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));

  buttonWhat = new QPushButton(this);
  CHECK_PTR_ENGAUGE(buttonWhat);
  buttonWhat->setPixmap(QPixmap(whatsthis_xpm));
  buttonWhat->setGeometry(305, 610, 60, 30);
  QToolTip::add(buttonWhat, QString(tr("What's this?")));
  connect(buttonWhat, SIGNAL(clicked()), this, SLOT(slotWhat()));

  resetLists();    
  toggleActions();
  updatePreview();
}