예제 #1
0
AsciiOpenDlg::AsciiOpenDlg(QWidget* parent)
	: QDialog(parent)
	//, Ui::AsciiOpenDialog()
	, m_ui(new Ui_AsciiOpenDialog)
	, m_skippedLines(0)
	, m_separator(' ')
	, m_averageLineSize(-1.0)
	//, m_filename()
	, m_columnsCount(0)
{
	m_ui->setupUi(this);

	//spinBoxSkipLines->setValue(0);
	m_ui->commentLinesSkippedLabel->hide();

	connect(m_ui->applyButton,			SIGNAL(clicked()),						this, SLOT(apply()));
	connect(m_ui->applyAllButton,		SIGNAL(clicked()),						this, SLOT(applyAll()));
	connect(m_ui->cancelButton,			SIGNAL(clicked()),						this, SLOT(reject()));
	connect(m_ui->lineEditSeparator,	SIGNAL(textChanged(const QString &)),	this, SLOT(onSeparatorChange(const QString &)));
	connect(m_ui->spinBoxSkipLines,		SIGNAL(valueChanged(int)),				this, SLOT(setSkippedLines(int)));

	//shortcut buttons
	connect(m_ui->toolButtonShortcutESP,		SIGNAL(clicked()), this, SLOT(shortcutButtonPressed()));
	connect(m_ui->toolButtonShortcutTAB,		SIGNAL(clicked()), this, SLOT(shortcutButtonPressed()));
	connect(m_ui->toolButtonShortcutComma,		SIGNAL(clicked()), this, SLOT(shortcutButtonPressed()));
	connect(m_ui->toolButtonShortcutDotcomma,	SIGNAL(clicked()), this, SLOT(shortcutButtonPressed()));

	m_ui->maxCloudSizeDoubleSpinBox->setMaximum(static_cast<double>(CC_MAX_NUMBER_OF_POINTS_PER_CLOUD)/1.0e6);
	m_ui->maxCloudSizeDoubleSpinBox->setValue(s_maxCloudSizeDoubleSpinBoxValue);
}
예제 #2
0
AsciiOpenDlg::AsciiOpenDlg(QString filename, QWidget* parent)
    : QDialog(parent)
    , Ui::AsciiOpenDialog()
    , m_skippedLines(0)
    , m_separator(' ')
    , m_averageLineSize(-1.0)
    , m_filename(filename)
    , m_invalidColumns(true)
    , m_columnsCount(0)
{
    setupUi(this);

    //spinBoxSkipLines->setValue(0);

    connect(buttonBox, SIGNAL(accepted()), this, SLOT(testBeforeAccept()));
    connect(lineEditSeparator, SIGNAL(textChanged(const QString &)), this, SLOT(updateTable(const QString &)));
    connect(spinBoxSkipLines, SIGNAL(valueChanged(int)), this, SLOT(setSkippedLines(int)));

    //shortcut buttons
    connect(toolButtonShortcutESP, SIGNAL(clicked()), this, SLOT(shortcutButtonPressed()));
    connect(toolButtonShortcutTAB, SIGNAL(clicked()), this, SLOT(shortcutButtonPressed()));
    connect(toolButtonShortcutComma, SIGNAL(clicked()), this, SLOT(shortcutButtonPressed()));
    connect(toolButtonShortcutDotcomma, SIGNAL(clicked()), this, SLOT(shortcutButtonPressed()));

    lineEditFileName->setText(m_filename);

    QList<QChar> separators;
    separators << QChar(' ');
    separators << QChar('\t');
    separators << QChar(',');
    separators << QChar(';');

    //We try all default separators...
    for (int i=0; i<separators.size(); ++i)
    {
        lineEditSeparator->setText(separators[i]); //this calls 'updateTable'
        //...until we find one that gives us at least 3 colums
        if (getColumnsCount()>2)
            break;
    }
}