Skip to content
Snippets Groups Projects
Commit a2424b55 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

connect...

parent e62bc063
No related branches found
No related tags found
1 merge request!1649Generic legacy 1D tables can again be read, now using new modal format dialog (#601)
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include <string> #include <string>
enum QUnit { over_nm, over_angstrom };
//! This parameterization can be set interactively by GUI users. //! This parameterization can be set interactively by GUI users.
//! Therefore, exceptionally, indices are counting from 1, not from 0. //! Therefore, exceptionally, indices are counting from 1, not from 0.
...@@ -29,7 +31,7 @@ struct ImportSettings1D { ...@@ -29,7 +31,7 @@ struct ImportSettings1D {
size_t col_sR; //!< column number of sigma R, or 0 size_t col_sR; //!< column number of sigma R, or 0
size_t col_dQ; //!< column number of delta Q, or 0 size_t col_dQ; //!< column number of delta Q, or 0
size_t col_lambda; //!< column number of wavelength, or 0 size_t col_lambda; //!< column number of wavelength, or 0
QUnit qUnit {over_nm};
// bool operator!=(const ImportSettings& other) const; // bool operator!=(const ImportSettings& other) const;
// QByteArray serialize() const; // QByteArray serialize() const;
// void deserialize(const QByteArray& data); // void deserialize(const QByteArray& data);
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
// ************************************************************************************************ // ************************************************************************************************
#include "GUI/View/Import/Legacy1dDialog.h" #include "GUI/View/Import/Legacy1dDialog.h"
#include "Device/IO/ImportSettings.h"
#include <QCheckBox> #include <QCheckBox>
#include <QComboBox> #include <QComboBox>
#include <QFormLayout> #include <QFormLayout>
...@@ -26,6 +25,8 @@ ...@@ -26,6 +25,8 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QtGui> #include <QtGui>
ImportSettings1D Legacy1dDialog::Msettings = legacy1D_3cols;
Legacy1dDialog::Legacy1dDialog() Legacy1dDialog::Legacy1dDialog()
: m_allowFactors(false) : m_allowFactors(false)
{ {
...@@ -57,34 +58,46 @@ Legacy1dDialog::Legacy1dDialog() ...@@ -57,34 +58,46 @@ Legacy1dDialog::Legacy1dDialog()
auto form211 = new QFormLayout; auto form211 = new QFormLayout;
w21->setLayout(form211); w21->setLayout(form211);
m_separatorCombo = new QComboBox;
form211->addRow("Separator:", m_separatorCombo);
m_separatorCombo->addItem("TAB");
m_separatorCombo->addItem("SPACE");
m_separatorCombo->addItem(",");
m_separatorCombo->addItem(";");
m_linesToSkipEdit = new QLineEdit; m_linesToSkipEdit = new QLineEdit;
m_linesToSkipEdit->setPlaceholderText("Example: 1-5, 12");
form211->addRow("Ignore line numbers:", m_linesToSkipEdit); form211->addRow("Ignore line numbers:", m_linesToSkipEdit);
if (Msettings.linesToSkip.empty())
m_linesToSkipEdit->setPlaceholderText("Example: 1-5, 12");
else
m_linesToSkipEdit->setText(QString::fromStdString(Msettings.linesToSkip));
connect(m_linesToSkipEdit, &QLineEdit::textEdited,
[&p = Msettings](const QString& text) { p.linesToSkip = text.toStdString(); });
m_headerPrefixEdit = new QLineEdit; m_headerPrefixEdit = new QLineEdit;
m_headerPrefixEdit->setPlaceholderText("#,//");
form211->addRow("Ignore lines starting with:", m_headerPrefixEdit); form211->addRow("Ignore lines starting with:", m_headerPrefixEdit);
if (Msettings.headerPrefix.empty())
m_headerPrefixEdit->setPlaceholderText("#,//");
else
m_headerPrefixEdit->setText(QString::fromStdString(Msettings.headerPrefix));
connect(m_headerPrefixEdit, &QLineEdit::textEdited,
[&p = Msettings](const QString& text) { p.headerPrefix = text.toStdString(); });
m_separatorCombo = new QComboBox;
form211->addRow("Separator:", m_separatorCombo);
m_separatorCombo->addItem("SPACE");
m_separatorCombo->addItem("TAB");
m_separatorCombo->addItem(",");
m_separatorCombo->addItem(";");
m_separatorCombo->setCurrentText(QString::fromStdString(Msettings.separator));
connect(m_separatorCombo, &QComboBox::currentTextChanged,
[&p = Msettings](const QString& text) { p.separator = text.toStdString(); });
m_qUnitCombo = new QComboBox; m_qUnitCombo = new QComboBox;
form211->addRow("Q given in units of:", m_qUnitCombo); form211->addRow("Q given in units of:", m_qUnitCombo);
m_qUnitCombo->addItem("1/nm"); m_qUnitCombo->addItem("1/nm");
m_qUnitCombo->addItem("1/Å"); m_qUnitCombo->addItem("1/Å");
m_qUnitCombo->setCurrentIndex((int)Msettings.qUnit);
connect(m_qUnitCombo, &QComboBox::currentIndexChanged,
[&p = Msettings](int i) { p.qUnit = (QUnit)i; });
auto buttonline = new QHBoxLayout; auto buttonline = new QHBoxLayout;
vbox->addLayout(buttonline); vbox->addLayout(buttonline);
auto cancelButton = new QPushButton("Cancel"); auto okButton = new QPushButton("OK");
buttonline->addWidget(cancelButton);
connect(cancelButton, &QPushButton::clicked, this, &Legacy1dDialog::reject);
auto okButton = new QPushButton("Save");
buttonline->addWidget(okButton); buttonline->addWidget(okButton);
okButton->setDefault(true); okButton->setDefault(true);
connect(okButton, &QPushButton::clicked, this, &Legacy1dDialog::accept); connect(okButton, &QPushButton::clicked, this, &Legacy1dDialog::accept);
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#ifndef BORNAGAIN_GUI_VIEW_IMPORT_LEGACY1DDIALOG_H #ifndef BORNAGAIN_GUI_VIEW_IMPORT_LEGACY1DDIALOG_H
#define BORNAGAIN_GUI_VIEW_IMPORT_LEGACY1DDIALOG_H #define BORNAGAIN_GUI_VIEW_IMPORT_LEGACY1DDIALOG_H
#include "Device/IO/ImportSettings.h"
#include <QDialog> #include <QDialog>
//! Properties widget for the QREDataLoader //! Properties widget for the QREDataLoader
...@@ -56,6 +57,8 @@ private: ...@@ -56,6 +57,8 @@ private:
static const int columnColumn = 3; static const int columnColumn = 3;
static const int factorLabelColumn = 4; static const int factorLabelColumn = 4;
static const int factorColumn = factorLabelColumn + 1; static const int factorColumn = factorLabelColumn + 1;
static ImportSettings1D Msettings;
}; };
#endif // BORNAGAIN_GUI_VIEW_IMPORT_LEGACY1DDIALOG_H #endif // BORNAGAIN_GUI_VIEW_IMPORT_LEGACY1DDIALOG_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment