Commit 02433eff authored by Matthias Puchner's avatar Matthias Puchner
Browse files

show waitcursor for potentially long-lasting processings

parent 2f423565
......@@ -27,6 +27,7 @@
#include "GUI/coregui/mainwindow/AppSvc.h"
#include "GUI/coregui/mainwindow/projectmanager.h"
#include "GUI/coregui/utils/GUIHelpers.h"
#include <QApplication>
#include <QFileDialog>
#include <QFileInfo>
#include <QMessageBox>
......@@ -142,9 +143,11 @@ QString ImportDataUtils::Import1dData(RealDataItem* realDataItem,
loader->initWithDefaultImportSettings();
loader->setRealDataItem(realDataItem);
realDataItem->setDataLoader(loader);
QApplication::setOverrideCursor(Qt::WaitCursor);
loader->setFileContents(fileContent);
loader->guessSettings();
const QString errorText = loader->processContents();
QApplication::restoreOverrideCursor();
if (!errorText.isEmpty())
return errorText;
......
......@@ -234,8 +234,10 @@ void SpecularDataImportWidget::onFormatSelectionChanged()
m_loader->setFileContents(realDataItem()->dataLoader()->fileContent());
realDataItem()->setDataLoader(m_loader);
m_loader->setRealDataItem(realDataItem());
QApplication::setOverrideCursor(Qt::WaitCursor);
m_loader->guessSettings();
const QString errorText = m_loader->processContents();
QApplication::restoreOverrideCursor();
if (!errorText.isEmpty()) {
// #baimport + use old loader again (make a clone before adding the new to realDataItem)??
......@@ -245,11 +247,12 @@ void SpecularDataImportWidget::onFormatSelectionChanged()
updatePropertiesEdits();
updatePreview();
connect(m_loader, &AbstractDataLoader::importSettingsChanged, this,
&SpecularDataImportWidget::updatePreview);
&SpecularDataImportWidget::onPropertiesChanged);
}
void SpecularDataImportWidget::updatePreview()
{
QApplication::setOverrideCursor(Qt::WaitCursor);
m_ui->plotWidget->clearGraphs();
if (m_loader) {
......@@ -270,6 +273,10 @@ void SpecularDataImportWidget::updatePreview()
const auto processedSections = resultModel->sectionsOfColumnType(
AbstractDataLoaderResultModel::ColumnType::processed);
QSignalBlocker b1(m_ui->originalRowCheckBox);
QSignalBlocker b2(m_ui->rawDataCheckBox);
QSignalBlocker b3(m_ui->calculatedDataCheckBox);
if (originalSections.isEmpty()) {
m_ui->originalRowCheckBox->setChecked(false);
m_ui->originalRowCheckBox->setEnabled(false);
......@@ -314,6 +321,7 @@ void SpecularDataImportWidget::updatePreview()
}
m_ui->plotWidget->replot();
QApplication::restoreOverrideCursor();
}
void SpecularDataImportWidget::onCreateNewFormatButton()
......@@ -334,7 +342,9 @@ void SpecularDataImportWidget::onCreateNewFormatButton()
void SpecularDataImportWidget::onPropertiesChanged()
{
m_loader->applyImportSettings(); // #baimport: may be duplicate
QApplication::setOverrideCursor(Qt::WaitCursor);
m_loader->processContents();
QApplication::restoreOverrideCursor();
// If there is a linked instrument, any change in import settings can break the compatibility.
// Therefore check the compatibility and break the link if necessary
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment