| 444 | } |
| 445 | |
| 446 | std::pair<UITab*, UICodeEditor*> |
| 447 | UICodeEditorSplitter::loadFileFromPathInNewTab( const std::string& path ) { |
| 448 | auto d = createCodeEditorInTabWidget( getPreferredTabWidget() ); |
| 449 | if ( d.first == nullptr || d.second == nullptr ) { |
| 450 | if ( !mTabWidgets.empty() && mTabWidgets[0]->getTabCount() > 0 ) { |
| 451 | d = createCodeEditorInTabWidget( mTabWidgets[0] ); |
| 452 | } else { |
| 453 | Log::error( "Couldn't createCodeEditorInTabWidget in " |
| 454 | "UICodeEditorSplitter::loadFileFromPathInNewTab" ); |
| 455 | return d; |
| 456 | } |
| 457 | } |
| 458 | UITabWidget* tabWidget = d.first->getTabWidget(); |
| 459 | loadFileFromPath( path, d.second ); |
| 460 | tabWidget->setTabSelected( d.first ); |
| 461 | return d; |
| 462 | } |
| 463 | |
| 464 | void UICodeEditorSplitter::loadAsyncFileFromPathInNewTab( |
| 465 | const std::string& path, std::function<void( UICodeEditor*, const std::string& )> onLoaded, |
no test coverage detected