diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 8e022183df..4947fb008f 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -117,11 +117,10 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : _frameCount(0), _fps(120.0f), _justStarted(true), - _voxelImporter(_window), + _voxelImporter(NULL), _wantToKillLocalVoxels(false), _audioScope(256, 200, true), - _avatarManager(), - _myAvatar(NULL), + _myAvatar(), _profile(QString()), _mirrorViewRect(QRect(MIRROR_VIEW_LEFT_PADDING, MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT)), _mouseX(0), @@ -1673,7 +1672,12 @@ void Application::exportVoxels() { } void Application::importVoxels() { - if (_voxelImporter.exec()) { + if (!_voxelImporter) { + _voxelImporter = new VoxelImporter(_window); + _voxelImporter->init(_settings); + } + + if (_voxelImporter->exec()) { qDebug("[DEBUG] Import succeeded."); } else { qDebug("[DEBUG] Import failed."); @@ -1813,8 +1817,6 @@ void Application::init() { _sharedVoxelSystem.changeTree(&_clipboard); delete tmpTree; - _voxelImporter.init(_settings); - _environment.init(); _glowEffect.init(); diff --git a/interface/src/Application.h b/interface/src/Application.h index d43b624e59..c83437949c 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -355,7 +355,7 @@ private: VoxelSystem _voxels; VoxelTree _clipboard; // if I copy/paste - VoxelImporter _voxelImporter; + VoxelImporter* _voxelImporter; VoxelSystem _sharedVoxelSystem; ViewFrustum _sharedVoxelSystemViewFrustum; diff --git a/interface/src/ImportDialog.cpp b/interface/src/ImportDialog.cpp index 28e39f1abd..ac7853629c 100644 --- a/interface/src/ImportDialog.cpp +++ b/interface/src/ImportDialog.cpp @@ -231,10 +231,6 @@ void ImportDialog::setLayout() { widget = findChild("treeView"); widget->setAttribute(Qt::WA_MacShowFocusRect, false); - // remove reference to treeView - widget = NULL; - widget->deleteLater(); - switchToResourcesParentIfRequired(); QFile styleSheet("resources/styles/import_dialog.qss"); if (styleSheet.open(QIODevice::ReadOnly)) { diff --git a/interface/src/VoxelImporter.cpp b/interface/src/VoxelImporter.cpp index 0011b0abb7..653d04cee4 100644 --- a/interface/src/VoxelImporter.cpp +++ b/interface/src/VoxelImporter.cpp @@ -24,15 +24,15 @@ private: const QString SETTINGS_GROUP_NAME = "VoxelImport"; const QString IMPORT_DIALOG_SETTINGS_KEY = "ImportDialogSettings"; -VoxelImporter::VoxelImporter(QWidget* parent) - : QObject(parent), - _voxelTree(true), - _importDialog(parent), - _currentTask(NULL), - _nextTask(NULL) { - - connect(&_importDialog, SIGNAL(currentChanged(QString)), SLOT(preImport())); - connect(&_importDialog, SIGNAL(accepted()), SLOT(import())); +VoxelImporter::VoxelImporter(QWidget* parent) : + QObject(parent), + _voxelTree(true), + _importDialog(parent), + _currentTask(NULL), + _nextTask(NULL) +{ + connect(&_importDialog, &QFileDialog::currentChanged, this, &VoxelImporter::preImport); + connect(&_importDialog, &QFileDialog::accepted, this, &VoxelImporter::import); } void VoxelImporter::saveSettings(QSettings* settings) {