bool ClipboardScriptingInterface::importVoxels() { qDebug() << "Importing ... "; QEventLoop loop; connect(Application::getInstance(), SIGNAL(importDone()), &loop, SLOT(quit())); emit readyToImport(); loop.exec(); return Application::getInstance()->getImportSucceded(); }
void VoxelImportDialog::setMode(dialogMode mode) { dialogMode previousMode = _mode; _mode = mode; switch (_mode) { case importMode: _progressBar.setValue(0); _importButton.setEnabled(true); _importButton.setText(IMPORT_BUTTON_NAME); findChild<QWidget*>("sidebar")->setEnabled(true); findChild<QWidget*>("treeView")->setEnabled(true); findChild<QWidget*>("backButton")->setEnabled(true); findChild<QWidget*>("forwardButton")->setEnabled(true); findChild<QWidget*>("toParentButton")->setEnabled(true); break; case loadingMode: // Connect to VoxelImporter signals connect(_importer, SIGNAL(importProgress(int)), this, SLOT(updateProgressBar(int))); connect(_importer, SIGNAL(importDone()), this, SLOT(afterImport())); _importButton.setEnabled(false); _importButton.setText(LOADING_BUTTON_NAME); findChild<QWidget*>("sidebar")->setEnabled(false); findChild<QWidget*>("treeView")->setEnabled(false); findChild<QWidget*>("backButton")->setEnabled(false); findChild<QWidget*>("forwardButton")->setEnabled(false); findChild<QWidget*>("toParentButton")->setEnabled(false); break; case finishedMode: if (previousMode == loadingMode) { // Disconnect from VoxelImporter signals disconnect(_importer, SIGNAL(importProgress(int)), this, SLOT(setProgressBarValue(int))); disconnect(_importer, SIGNAL(importDone()), this, SLOT(afterImport())); } setMode(importMode); break; }
bool ClipboardScriptingInterface::importVoxels(const QString& filename) { qDebug() << "Importing ... "; VoxelImporter* importer = Application::getInstance()->getVoxelImporter(); if (!importer->validImportFile(filename)) { return false; } QEventLoop loop; connect(importer, SIGNAL(importDone()), &loop, SLOT(quit())); importer->import(filename); loop.exec(); return true; }
void GUIWidget::importThread () { importStart(); CSVFunction f(this); connect(&f, SIGNAL(signalMessage(QString)), _log, SLOT(append(const QString &))); int rc = f.import(_csvButton->files(), _format->text(), _dateFormat->text(), _delimiter->currentText(), _type->currentText(), _exchange->text(), _filename->isChecked()); importDone(); }