| 462 | } |
| 463 | |
| 464 | void UICodeEditorSplitter::loadAsyncFileFromPathInNewTab( |
| 465 | const std::string& path, std::function<void( UICodeEditor*, const std::string& )> onLoaded, |
| 466 | UITabWidget* tabWidget ) { |
| 467 | if ( !mThreadPool ) { |
| 468 | Log::error( "UICodeEditorSplitter::loadAsyncFileFromPathInNewTab loading file async " |
| 469 | "without thread pool." ); |
| 470 | loadFileFromPathInNewTab( path ); |
| 471 | return; |
| 472 | } |
| 473 | auto d = createCodeEditorInTabWidget( tabWidget ); |
| 474 | if ( d.first == nullptr || d.second == nullptr ) { |
| 475 | if ( !mTabWidgets.empty() && mTabWidgets[0]->getTabCount() > 0 ) { |
| 476 | d = createCodeEditorInTabWidget( mTabWidgets[0] ); |
| 477 | } else { |
| 478 | Log::error( "Couldn't createCodeEditorInTabWidget in " |
| 479 | "UICodeEditorSplitter::loadAsyncFileFromPathInNewTab" ); |
| 480 | return; |
| 481 | } |
| 482 | } |
| 483 | UITab* addedTab = d.first; |
| 484 | loadAsyncFileFromPath( path, d.second, onLoaded ); |
| 485 | tabWidget->setTabSelected( addedTab ); |
| 486 | } |
| 487 | |
| 488 | void UICodeEditorSplitter::loadAsyncFileFromPathInNewTab( |
| 489 | const std::string& path, std::function<void( UICodeEditor*, const std::string& )> onLoaded ) { |
no test coverage detected