|  | 
| 10 | 10 | #include "../base/task_manager.h" | 
| 11 | 11 | #include "../gui/gui_application.h" | 
| 12 | 12 | #include "../qtcommon/filepath_conv.h" | 
|  | 13 | +#include "../qtcommon/qtcore_utils.h" | 
| 13 | 14 | #include "../qtcommon/qstring_conv.h" | 
| 14 | 15 | #include "app_module.h" | 
| 15 | 16 | #include "recent_files.h" | 
|  | 
| 20 | 21 | #include <QtCore/QtDebug> | 
| 21 | 22 | #include <QtCore/QElapsedTimer> | 
| 22 | 23 | #include <QtCore/QMimeData> | 
| 23 |  | -#include <QtCore/QTimer> | 
| 24 | 24 | #include <QtGui/QDragEnterEvent> | 
| 25 | 25 | #include <QtGui/QDropEvent> | 
| 26 | 26 | #include <QtWidgets/QApplication> | 
| @@ -203,7 +203,7 @@ void FileCommandTools::openDocumentsFromList(IAppContext* context, Span<const Fi | 
| 203 | 203 |                         .execute(); | 
| 204 | 204 |                 if (okImport) { | 
| 205 | 205 |                     appModule->emitInfo(fmt::format(Command::textIdTr("Import time: {}ms"), chrono.elapsed())); | 
| 206 |  | -                    QTimer::singleShot(0, context, [=]{ | 
|  | 206 | +                    QtCoreUtils::runJobOnMainThread([=]{ | 
| 207 | 207 |                         appModule->prependRecentFile(fp, context->guiApp()->findGuiDocument(newDocId)); | 
| 208 | 208 |                     }); | 
| 209 | 209 |                 } | 
| @@ -234,18 +234,19 @@ void FileCommandTools::importInDocument( | 
| 234 | 234 |         chrono.start(); | 
| 235 | 235 | 
 | 
| 236 | 236 |         auto doc = appModule->application()->findDocumentByIdentifier(targetDocId); | 
| 237 |  | -        const bool okImport = appModule->ioSystem()->importInDocument() | 
| 238 |  | -                                  .targetDocument(doc) | 
| 239 |  | -                                  .withFilepaths(listFilePaths) | 
| 240 |  | -                                  .withParametersProvider(appModule) | 
| 241 |  | -                                  .withEntityPostProcess([=](TDF_Label labelEntity, TaskProgress* progress) { | 
| 242 |  | -                                      appModule->computeBRepMesh(labelEntity, progress); | 
| 243 |  | -                                  }) | 
| 244 |  | -                                  .withEntityPostProcessRequiredIf(&IO::formatProvidesBRep) | 
| 245 |  | -                                  .withEntityPostProcessInfoProgress(20, Command::textIdTr("Mesh BRep shapes")) | 
| 246 |  | -                                  .withMessenger(appModule) | 
| 247 |  | -                                  .withTaskProgress(progress) | 
| 248 |  | -                                  .execute(); | 
|  | 237 | +        const bool okImport = | 
|  | 238 | +                appModule->ioSystem()->importInDocument() | 
|  | 239 | +                .targetDocument(doc) | 
|  | 240 | +                .withFilepaths(listFilePaths) | 
|  | 241 | +                .withParametersProvider(appModule) | 
|  | 242 | +                .withEntityPostProcess([=](TDF_Label labelEntity, TaskProgress* progress) { | 
|  | 243 | +                    appModule->computeBRepMesh(labelEntity, progress); | 
|  | 244 | +                }) | 
|  | 245 | +                .withEntityPostProcessRequiredIf(&IO::formatProvidesBRep) | 
|  | 246 | +                .withEntityPostProcessInfoProgress(20, Command::textIdTr("Mesh BRep shapes")) | 
|  | 247 | +                .withMessenger(appModule) | 
|  | 248 | +                .withTaskProgress(progress) | 
|  | 249 | +                .execute(); | 
| 249 | 250 |         if (okImport) | 
| 250 | 251 |             appModule->emitInfo(fmt::format(Command::textIdTr("Import time: {}ms"), chrono.elapsed())); | 
| 251 | 252 |     }); | 
|  | 
0 commit comments