Skip to content

Commit

Permalink
Make sure that parsing feedback is given in all cases (change data fi…
Browse files Browse the repository at this point in the history
…le, create new vector, loading from file and data wizard) and improve the feedback.
  • Loading branch information
brisset committed Mar 5, 2014
1 parent eb7aa03 commit 76475d2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/datasources/ascii/asciisource.cpp
Expand Up @@ -234,7 +234,7 @@ Kst::Object::UpdateType AsciiSource::internalDataSourceUpdate(bool read_complete

bool new_data = false;
if (_emitProgress) {
emitProgress(1, tr("Searching for rows ..."));
emitProgress(1, tr("Parsing %1 ...").arg(_filename));
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
QFuture<bool> future = QtConcurrent::run(&_reader, &AsciiDataReader::findAllDataRows, read_completely, &file, _fileSize, col_count);
_busy = true;
Expand All @@ -246,10 +246,10 @@ Kst::Object::UpdateType AsciiSource::internalDataSourceUpdate(bool read_complete
// TODO out of memory?
}
_busy = false;
emitProgress(50, tr("Searching for rows finished"));
emitProgress(50, tr("Finished parsing %1").arg(_filename));
} else {
ms::sleep(500);
emitProgress(1 + 49.0 * _reader.progressValue() / 100.0, tr("Searching for rows: %1").arg(QString::number(_reader.progressRows())));
emitProgress(1 + 49.0 * _reader.progressValue() / 100.0, tr("Parsing %1: %2 rows").arg(_filename).arg(QString::number(_reader.progressRows())));
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
}
}
Expand Down Expand Up @@ -293,7 +293,7 @@ int AsciiSource::readField(double *v, const QString& field, int s, int n)
{
_actualField = field;
if (_emitProgress) {
updateProgress(tr("reading field"));
updateProgress(tr("reading field ..."));
} else {
emitProgress(0, tr("Reading field: ") + field);
}
Expand Down Expand Up @@ -491,7 +491,7 @@ int AsciiSource::tryReadField(double *v, const QString& field, int s, int n)
_fileBuffer.clear();
}

updateProgress(tr("column read"));
updateProgress(tr("finished reading"));

_read_count++;
if (_read_count_max == _read_count)
Expand Down
1 change: 1 addition & 0 deletions src/libkstapp/changefiledialog.cpp
Expand Up @@ -304,6 +304,7 @@ void ChangeFileDialog::apply() {
}
// Hook the new datasource to the status message area to receive progress status
connect(_dataSource, SIGNAL(progress(int,QString)), kstApp->mainWindow(), SLOT(updateProgress(int,QString)));
_dataSource->vector().prepareRead(_selectedFilePrimitiveList->count());

// we need a list which preservs the order things are added, and a map to associate the duplicated
// primitive with its duplicate.
Expand Down
4 changes: 3 additions & 1 deletion src/libkstapp/vectordialog.cpp
Expand Up @@ -461,13 +461,15 @@ void VectorTab::clearIndexList() {


ObjectPtr VectorDialog::createNewDataVector() {
const DataSourcePtr dataSource = _vectorTab->dataSource();
DataSourcePtr dataSource = _vectorTab->dataSource();

//FIXME better validation than this please...
if (!dataSource)
return 0;

// Hook the progress signal when loading a new datasource to get feedback in case it takes long
connect(dataSource, SIGNAL(progress(int,QString)), kstApp->mainWindow(), SLOT(updateProgress(int,QString)));
dataSource->vector().prepareRead(1);

const QString field = _vectorTab->field();
const DataRange *dataRange = _vectorTab->dataRange();
Expand Down

0 comments on commit 76475d2

Please sign in to comment.