diff options
| author | craig <craig@11d20701-8431-0410-a711-e3c959e3b870> | 2012-01-01 11:40:09 +0000 |
|---|---|---|
| committer | craig <craig@11d20701-8431-0410-a711-e3c959e3b870> | 2012-01-01 11:40:09 +0000 |
| commit | 7ed83b6c6666eb8b6b104c211ae7e52907350372 (patch) | |
| tree | 4430b556abac0ad660a0aacf1887d77f85d8be02 /scribus/plugins/gettext/csvim/csvdia.cpp | |
| download | scribus-7ed83b6c6666eb8b6b104c211ae7e52907350372.tar.gz scribus-7ed83b6c6666eb8b6b104c211ae7e52907350372.tar.xz scribus-7ed83b6c6666eb8b6b104c211ae7e52907350372.zip | |
Branch 1.3.5 tree to 1.4.x tree, goodbye 1.3.x
git-svn-id: svn://scribus.net/branches/Version14x/Scribus@17163 11d20701-8431-0410-a711-e3c959e3b870
Diffstat (limited to 'scribus/plugins/gettext/csvim/csvdia.cpp')
| -rw-r--r-- | scribus/plugins/gettext/csvim/csvdia.cpp | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/scribus/plugins/gettext/csvim/csvdia.cpp b/scribus/plugins/gettext/csvim/csvdia.cpp new file mode 100644 index 0000000..4de3db7 --- /dev/null +++ b/scribus/plugins/gettext/csvim/csvdia.cpp @@ -0,0 +1,112 @@ +/* +For general Scribus (>=1.3.2) copyright and licensing information please refer +to the COPYING file provided with the program. Following this notice may exist +a copyright and/or license notice that predates the release of Scribus 1.3.2 +for which a new license (GPL+exception) is in place. +*/ +#include "csvdia.h" + +#include "scribusapi.h" + +#include <QVBoxLayout> +#include <QHBoxLayout> +#include <QBoxLayout> +#include <QComboBox> +#include <QCheckBox> +#include <QPushButton> +#include <QLabel> +#include <QPixmap> +#include <QString> +#include <QStringList> + +#include "util_icon.h" + +CsvDialog::CsvDialog() : QDialog(0) +{ + setModal(true); + setWindowTitle( tr("CSV Importer Options")); + setWindowIcon(QIcon(loadIcon ( "AppIcon.png" ))); + + QBoxLayout* layout = new QVBoxLayout(this); + layout->setMargin(0); + layout->setSpacing(0); + + QBoxLayout* flayout = new QHBoxLayout; + flayout->setMargin(5); + flayout->setSpacing(5); + QLabel* fdlabel = new QLabel( tr("Field delimiter:"), this); + fdlabel->setMinimumWidth(120); + flayout->addWidget(fdlabel,1); + fdelimCombo = new QComboBox(this); + fdelimCombo->setEditable(false); + QStringList fdList(","); + fdList << ";"; + fdList << tr("(TAB)"); + fdelimCombo->addItems(fdList); + fdelimCombo->setMinimumWidth(120); + flayout->addWidget(fdelimCombo,5); + layout->addLayout(flayout); + + QBoxLayout* vlayout = new QHBoxLayout; + vlayout->setMargin(5); + vlayout->setSpacing(5); + QLabel* vdlabel = new QLabel( tr("Value delimiter:"), this); + vdlabel->setMinimumWidth(120); + vlayout->addWidget(vdlabel,1); + vdelimCombo = new QComboBox(this); + vdelimCombo->setEditable(false); + QStringList vdList("\""); + vdList << "'" << tr("None", "delimiter"); + vdelimCombo->addItems(vdList); + vdelimCombo->setMinimumWidth(120); + vlayout->addWidget(vdelimCombo,5); + layout->addLayout(vlayout); + + QBoxLayout* hlayout = new QHBoxLayout; + hlayout->setMargin(5); + hlayout->setSpacing(5); + headerCheck = new QCheckBox( tr("First row is a header"), this); + hlayout->addWidget(headerCheck); + layout->addLayout(hlayout); + + QBoxLayout* blayout = new QHBoxLayout; + blayout->setMargin(5); + blayout->setSpacing(5); + blayout->addStretch(10); + okButton = new QPushButton( tr("OK"), this); + blayout->addWidget(okButton); + + cancelButton = new QPushButton( tr("Cancel"), this); + blayout->addWidget(cancelButton); + layout->addLayout(blayout); + + connect(okButton, SIGNAL(clicked()), this, SLOT(accept())); + connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); +} + +QString CsvDialog::getFDelim() +{ + if (fdelimCombo->currentText() == tr("(TAB)")) + return "\t"; + return fdelimCombo->currentText(); +} + +QString CsvDialog::getVDelim() +{ + return vdelimCombo->currentText(); +} + +bool CsvDialog::hasHeader() +{ + return headerCheck->isChecked(); +} + +bool CsvDialog::useVDelim() +{ + return vdelimCombo->currentIndex() != 2; +} + +CsvDialog::~CsvDialog() +{ + +} |
