19 #include <QVBoxLayout> 20 #include <QGridLayout> 23 #include <QDialogButtonBox> 24 #include <QRadioButton> 25 #include <QButtonGroup> 39 setWindowTitle(tr(
"Export Layer"));
41 QString intro = tr(
"Exporting layer \"%1\" to %2 file.")
45 QVBoxLayout *vbox =
new QVBoxLayout;
47 QLabel *label =
new QLabel(intro);
48 label->setWordWrap(
true);
49 vbox->addWidget(label);
53 vbox->addSpacing(space);
55 QGroupBox *rowColGroup =
new QGroupBox(tr(
"Row and column options:"));
56 QGridLayout *rowColLayout =
new QGridLayout;
57 rowColGroup->setLayout(rowColLayout);
59 vector<pair<QString, QChar>> separators {
68 QChar defaultSeparator =
',';
70 defaultSeparator =
'\t';
73 rowColLayout->addWidget(
new QLabel(tr(
"Column separator:")));
75 for (
auto p: separators) {
76 if (p.second ==
'\t' || p.second ==
' ') {
82 if (p.second == defaultSeparator) {
88 rowColLayout->setColumnStretch(2, 10);
91 (tr(
"Include a header row before the data rows"));
93 (tr(
"Include a timestamp column before the data columns"));
94 rowColLayout->addWidget(
m_header, 1, 0, 1, 3);
102 vbox->addWidget(rowColGroup);
104 vbox->addSpacing(space);
106 QGroupBox *framesGroup =
new QGroupBox
107 (tr(
"Timing format:"));
110 (tr(
"Write times in seconds"));
112 (tr(
"Write times in audio sample frames"));
115 QVBoxLayout *framesLayout =
new QVBoxLayout;
118 framesGroup->setLayout(framesLayout);
119 vbox->addWidget(framesGroup);
121 vbox->addSpacing(space);
128 QGroupBox *rangeGroup =
new QGroupBox
129 (tr(
"Range to export:"));
131 QButtonGroup *selectionGroup =
new QButtonGroup(rangeGroup);
132 QButtonGroup *viewGroup =
new QButtonGroup(rangeGroup);
135 (tr(
"Export only the current selection"));
136 QRadioButton *fullDuration =
new QRadioButton
137 (tr(
"Export the full duration of the layer"));
140 selectionGroup->addButton(fullDuration);
146 fullDuration->setEnabled(
false);
147 fullDuration->setChecked(
true);
150 QVBoxLayout *rangeLayout =
new QVBoxLayout;
152 rangeLayout->addWidget(fullDuration);
157 (tr(
"Export only the height of the visible view"));
158 QRadioButton *fullHeight =
new QRadioButton
159 (tr(
"Export the full height of the layer"));
162 viewGroup->addButton(fullHeight);
166 rangeLayout->addSpacing(space);
169 rangeLayout->addWidget(fullHeight);
175 rangeGroup->setLayout(rangeLayout);
176 vbox->addWidget(rangeGroup);
178 vbox->addSpacing(space);
180 QDialogButtonBox *bb =
new QDialogButtonBox(QDialogButtonBox::Ok |
181 QDialogButtonBox::Cancel);
183 connect(bb, SIGNAL(accepted()),
this, SLOT(accept()));
184 connect(bb, SIGNAL(rejected()),
this, SLOT(reject()));
bool shouldIncludeHeader() const
Return true if we should include a header row at the top of the exported file.
QRadioButton * m_selectionOnly
bool shouldConstrainToSelection() const
Return true if we should export the selected time range(s) only.
static int scalePixelSize(int pixels)
Take a "design pixel" size and scale it for the actual display.
bool shouldConstrainToViewHeight() const
Return true if we should constrain the vertical range to the visible area only.
bool haveView
True if we have a view that provides a vertical scale range, so we may want to offer a choice between...
bool shouldIncludeTimestamps() const
Return true if we should write a timestamp column.
bool shouldWriteTimeInFrames() const
Return true if we should use sample frames rather than seconds for the timestamp column (and duration...
QString getDelimiter() const
Return the column delimiter to use in the exported file.
bool haveSelection
True if there is a selection current that the user may want to constrain export to.
QString fileExtension
Extension of file being exported into.
void timestampsToggled(bool)
bool isDense
True if the model is a dense type for which timestamps are not written by default.
QComboBox * m_separatorCombo
QString layerName
Presentation name of the layer being exported.
QRadioButton * m_viewOnly
CSVExportDialog(Configuration config, QWidget *parent)
!! todo: remember & re-apply last set of options chosen for this layer type