Chris@1568: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@1568: Chris@1568: /* Chris@1568: Sonic Visualiser Chris@1568: An audio file viewer and annotation editor. Chris@1568: Centre for Digital Music, Queen Mary, University of London. Chris@1568: Chris@1568: This program is free software; you can redistribute it and/or Chris@1568: modify it under the terms of the GNU General Public License as Chris@1568: published by the Free Software Foundation; either version 2 of the Chris@1568: License, or (at your option) any later version. See the file Chris@1568: COPYING included with this distribution for more information. Chris@1568: */ Chris@1568: Chris@1568: #ifndef SV_CSV_EXPORT_DIALOG_H Chris@1568: #define SV_CSV_EXPORT_DIALOG_H Chris@1568: Chris@1568: #include Chris@1568: #include Chris@1568: Chris@1568: class QComboBox; Chris@1568: class QCheckBox; Chris@1568: class QRadioButton; Chris@1568: Chris@1568: class CSVExportDialog : public QDialog Chris@1568: { Chris@1568: Q_OBJECT Chris@1568: Chris@1568: public: Chris@1568: struct Configuration { Chris@1568: Configuration() : Chris@1568: layerName(""), Chris@1568: fileExtension("csv"), Chris@1568: isDense(false), Chris@1568: haveView(false), Chris@1568: haveSelection(false) { } Chris@1568: Chris@1568: /** Chris@1568: * Presentation name of the layer being exported. Chris@1568: */ Chris@1568: QString layerName; Chris@1568: Chris@1568: /** Chris@1568: * Extension of file being exported into. Chris@1568: */ Chris@1568: QString fileExtension; Chris@1568: Chris@1568: /** Chris@1568: * True if the model is a dense type for which timestamps are Chris@1568: * not written by default. Chris@1568: */ Chris@1568: bool isDense; Chris@1568: Chris@1568: /** Chris@1568: * True if we have a view that provides a vertical scale Chris@1568: * range, so we may want to offer a choice between exporting Chris@1568: * only the visible range or exporting full height. This Chris@1568: * choice happens to be offered only if isDense is also true. Chris@1568: */ Chris@1568: bool haveView; Chris@1568: Chris@1568: /** Chris@1568: * True if there is a selection current that the user may want Chris@1568: * to constrain export to. Chris@1568: */ Chris@1568: bool haveSelection; Chris@1568: }; Chris@1568: Chris@1568: CSVExportDialog(Configuration config, QWidget *parent); Chris@1568: Chris@1568: /** Chris@1568: * Return the column delimiter to use in the exported file. Either Chris@1568: * the default for the supplied file extension, or some other Chris@1568: * option chosen by the user. Chris@1568: */ Chris@1568: QString getDelimiter() const; Chris@1568: Chris@1568: /** Chris@1568: * Return true if we should include a header row at the top of the Chris@1568: * exported file. Chris@1568: */ Chris@1568: bool shouldIncludeHeader() const; Chris@1568: Chris@1568: /** Chris@1568: * Return true if we should write a timestamp column. This is Chris@1568: * always true for non-dense models, but is a user option for Chris@1568: * dense ones. Chris@1568: */ Chris@1568: bool shouldIncludeTimestamps() const; Chris@1568: Chris@1568: /** Chris@1568: * Return true if we should use sample frames rather than seconds Chris@1568: * for the timestamp column (and duration where present). Chris@1568: */ Chris@1568: bool shouldWriteTimeInFrames() const; Chris@1568: Chris@1568: /** Chris@1568: * Return true if we should constrain the vertical range to the Chris@1568: * visible area only. Otherwise we should export the full vertical Chris@1568: * range of the model. Chris@1568: */ Chris@1568: bool shouldConstrainToViewHeight() const; Chris@1568: Chris@1568: /** Chris@1568: * Return true if we should export the selected time range(s) Chris@1568: * only. Otherwise we should export the full length of the model. Chris@1568: */ Chris@1568: bool shouldConstrainToSelection() const; Chris@1568: Chris@1568: private: Chris@1568: Configuration m_config; Chris@1568: Chris@1568: QComboBox *m_separatorCombo; Chris@1568: QCheckBox *m_header; Chris@1568: QCheckBox *m_timestamps; Chris@1568: QRadioButton *m_seconds; Chris@1568: QRadioButton *m_frames; Chris@1568: QRadioButton *m_selectionOnly; Chris@1568: QRadioButton *m_viewOnly; Chris@1568: Chris@1568: private slots: Chris@1568: void timestampsToggled(bool); Chris@1568: }; Chris@1568: Chris@1568: #endif