diff --git a/.ecode/project_build.json b/.ecode/project_build.json index 291433920..9d1547eaa 100644 --- a/.ecode/project_build.json +++ b/.ecode/project_build.json @@ -72,7 +72,7 @@ }, "run": [ { - "args": "-x", + "args": "-v", "command": "${project_root}/bin/ecode-debug", "name": "ecode-debug", "working_dir": "${project_root}/bin/" diff --git a/include/eepp/system/log.hpp b/include/eepp/system/log.hpp index 99d628af9..a618f76e5 100644 --- a/include/eepp/system/log.hpp +++ b/include/eepp/system/log.hpp @@ -42,10 +42,10 @@ class EE_API Log : protected Mutex { #endif } - static Log* create( const std::string& logPath, const LogLevel& level, bool consoleOutput, + static Log* create( const std::string& logPath, const LogLevel& level, bool stdOutLog, bool liveWrite ); - static Log* create( const LogLevel& level, bool consoleOutput, bool liveWrite ); + static Log* create( const LogLevel& level, bool stdOutLog, bool liveWrite ); virtual ~Log(); @@ -210,12 +210,12 @@ class EE_API Log : protected Mutex { protected: Log(); - Log( const std::string& logPath, const LogLevel& level, bool consoleOutput, bool liveWrite ); + Log( const std::string& logPath, const LogLevel& level, bool stdOutLog, bool liveWrite ); std::string mData; std::string mFilePath; bool mSave; - bool mConsoleOutput; + bool mStdOutEnabled; bool mLiveWrite; bool mKeepLog{ false }; LogLevel mLogLevelThreshold{ getDefaultLogLevel() }; diff --git a/include/eepp/ui/models/filesystemmodel.hpp b/include/eepp/ui/models/filesystemmodel.hpp index d011d09c0..f297b0033 100644 --- a/include/eepp/ui/models/filesystemmodel.hpp +++ b/include/eepp/ui/models/filesystemmodel.hpp @@ -115,6 +115,8 @@ class EE_API FileSystemModel : public Model { FileSystemModel::Node* childWithPathExists( const std::string& path ); + const Uint32& getHash() { return mHash; } + private: friend class FileSystemModel; @@ -132,6 +134,7 @@ class EE_API FileSystemModel : public Model { std::vector mChildren; bool mHasTraversed{ false }; bool mInfoDirty{ true }; + Uint32 mHash{ 0 }; ModelIndex index( const FileSystemModel& model, int column ) const; diff --git a/src/eepp/system/log.cpp b/src/eepp/system/log.cpp index 298de793c..0897d12d7 100644 --- a/src/eepp/system/log.cpp +++ b/src/eepp/system/log.cpp @@ -28,37 +28,37 @@ std::unordered_map Log::getMapFlag() { { "assert", LogLevel::Assert } }; } -Log* Log::create( const std::string& logPath, const LogLevel& level, bool consoleOutput, +Log* Log::create( const std::string& logPath, const LogLevel& level, bool stdOutLog, bool liveWrite ) { if ( NULL == ms_singleton ) { - ms_singleton = eeNew( Log, ( logPath, level, consoleOutput, liveWrite ) ); + ms_singleton = eeNew( Log, ( logPath, level, stdOutLog, liveWrite ) ); } else { ms_singleton->setLogLevelThreshold( level ); - ms_singleton->setLogToStdOut( consoleOutput ); + ms_singleton->setLogToStdOut( stdOutLog ); ms_singleton->setLiveWrite( liveWrite ); } return ms_singleton; } -Log* Log::create( const LogLevel& level, bool consoleOutput, bool liveWrite ) { +Log* Log::create( const LogLevel& level, bool stdOutLog, bool liveWrite ) { if ( NULL == ms_singleton ) { - ms_singleton = eeNew( Log, ( "", level, consoleOutput, liveWrite ) ); + ms_singleton = eeNew( Log, ( "", level, stdOutLog, liveWrite ) ); } else { ms_singleton->setLogLevelThreshold( level ); - ms_singleton->setLogToStdOut( consoleOutput ); + ms_singleton->setLogToStdOut( stdOutLog ); ms_singleton->setLiveWrite( liveWrite ); } return ms_singleton; } -Log::Log() : mSave( false ), mConsoleOutput( false ), mLiveWrite( false ), mFS( NULL ) { +Log::Log() : mSave( false ), mStdOutEnabled( false ), mLiveWrite( false ), mFS( NULL ) { writel( LogLevel::Info, "eepp initialized" ); } -Log::Log( const std::string& logPath, const LogLevel& level, bool consoleOutput, bool liveWrite ) : +Log::Log( const std::string& logPath, const LogLevel& level, bool stdOutLog, bool liveWrite ) : mFilePath( logPath ), mSave( false ), - mConsoleOutput( consoleOutput ), + mStdOutEnabled( stdOutLog ), mLiveWrite( liveWrite ), mLogLevelThreshold( level ), mFS( NULL ) { @@ -123,7 +123,7 @@ void Log::write( const std::string_view& text ) { writeToReaders( text ); - if ( mConsoleOutput ) { + if ( mStdOutEnabled ) { #if EE_PLATFORM == EE_PLATFORM_ANDROID __android_log_print( ANDROID_LOG_INFO, "eepp", "%s", text.data() ); #elif defined( EE_COMPILER_MSVC ) @@ -133,7 +133,7 @@ void Log::write( const std::string_view& text ) { OutputDebugString( text.c_str() ); #endif #else - std::cout << text; + std::cout << text << std::flush; #endif } @@ -189,7 +189,7 @@ void Log::writel( const std::string_view& text ) { writeToReaders( text ); writeToReaders( "\n" ); - if ( mConsoleOutput ) { + if ( mStdOutEnabled ) { #if EE_PLATFORM == EE_PLATFORM_ANDROID __android_log_print( ANDROID_LOG_INFO, "eepp", "%s\n", text.data() ); #elif defined( EE_COMPILER_MSVC ) @@ -241,13 +241,13 @@ const std::string& Log::getBuffer() const { } const bool& Log::isLoggingToStdOut() const { - return mConsoleOutput; + return mStdOutEnabled; } void Log::setLogToStdOut( const bool& output ) { - bool OldOutput = mConsoleOutput; + bool OldOutput = mStdOutEnabled; - mConsoleOutput = output; + mStdOutEnabled = output; if ( !OldOutput && output && !mData.empty() ) { lock(); diff --git a/src/eepp/ui/models/filesystemmodel.cpp b/src/eepp/ui/models/filesystemmodel.cpp index 56e7ab3ab..2c5d025e7 100644 --- a/src/eepp/ui/models/filesystemmodel.cpp +++ b/src/eepp/ui/models/filesystemmodel.cpp @@ -19,6 +19,7 @@ FileSystemModel::Node::Node( const std::string& rootPath, const FileSystemModel& mInfoDirty = false; mName = FileSystem::fileNameFromPath( mInfo.getFilepath() ); mMimeType = ""; + mHash = String::hash( mName ); traverseIfNeeded( model ); } @@ -26,6 +27,7 @@ FileSystemModel::Node::Node( FileInfo&& info, FileSystemModel::Node* parent ) : mParent( parent ), mInfo( info ) { mInfoDirty = false; mName = FileSystem::fileNameFromPath( mInfo.getFilepath() ); + mHash = String::hash( mName ); updateMimeType(); } @@ -99,7 +101,6 @@ FileSystemModel::Node* FileSystemModel::Node::createChild( const std::string& ch const FileSystemModel& model ) { std::string childPath( mInfo.getDirectoryPath() + childName ); FileInfo file( childPath, false ); - auto child = eeNew( Node, ( std::move( file ), this ) ); if ( model.getDisplayConfig().ignoreHidden && file.isHidden() ) return nullptr; @@ -107,7 +108,13 @@ FileSystemModel::Node* FileSystemModel::Node::createChild( const std::string& ch if ( model.getMode() == Mode::DirectoriesOnly && !file.isDirectory() ) return nullptr; - return child; + auto hash = String::hash( childName ); + + for ( auto node : mChildren ) + if ( node->mParent == this && node->mHash == hash ) + return nullptr; + + return eeNew( Node, ( std::move( file ), this ) ); } void FileSystemModel::Node::rename( const FileInfo& file ) { diff --git a/src/tools/ecode/ecode.cpp b/src/tools/ecode/ecode.cpp index 3af60bf24..15c924d7a 100644 --- a/src/tools/ecode/ecode.cpp +++ b/src/tools/ecode/ecode.cpp @@ -2034,50 +2034,51 @@ std::map App::getDefaultKeybindings() { std::map App::getLocalKeybindings() { return { { { KEY_RETURN, KEYMOD_LALT | KEYMOD_LCTRL }, "fullscreen-toggle" }, - { { KEY_F3, KEYMOD_NONE }, "repeat-find" }, - { { KEY_F3, KEYMOD_SHIFT }, "find-prev" }, - { { KEY_F12, KEYMOD_NONE }, "console-toggle" }, - { { KEY_F, KeyMod::getDefaultModifier() }, "find-replace" }, - { { KEY_Q, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "close-app" }, - { { KEY_O, KeyMod::getDefaultModifier() }, "open-file" }, - { { KEY_W, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "download-file-web" }, - { { KEY_O, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "open-folder" }, - { { KEY_F11, KEYMOD_NONE }, "debug-widget-tree-view" }, - { { KEY_K, KeyMod::getDefaultModifier() }, "open-locatebar" }, - { { KEY_P, KeyMod::getDefaultModifier() }, "open-command-palette" }, - { { KEY_F, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "open-global-search" }, - { { KEY_L, KeyMod::getDefaultModifier() }, "go-to-line" }, + { { KEY_F3, KEYMOD_NONE }, "repeat-find" }, { { KEY_F3, KEYMOD_SHIFT }, "find-prev" }, + { { KEY_F12, KEYMOD_NONE }, "console-toggle" }, + { { KEY_F, KeyMod::getDefaultModifier() }, "find-replace" }, + { { KEY_Q, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "close-app" }, + { { KEY_O, KeyMod::getDefaultModifier() }, "open-file" }, + { { KEY_W, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "download-file-web" }, + { { KEY_O, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "open-folder" }, + { { KEY_F11, KEYMOD_NONE }, "debug-widget-tree-view" }, + { { KEY_K, KeyMod::getDefaultModifier() }, "open-locatebar" }, + { { KEY_P, KeyMod::getDefaultModifier() }, "open-command-palette" }, + { { KEY_F, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "open-global-search" }, + { { KEY_L, KeyMod::getDefaultModifier() }, "go-to-line" }, #if EE_PLATFORM == EE_PLATFORM_MACOS - { { KEY_M, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "menu-toggle" }, + { { KEY_M, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "menu-toggle" }, #else - { { KEY_M, KeyMod::getDefaultModifier() }, "menu-toggle" }, + { { KEY_M, KeyMod::getDefaultModifier() }, "menu-toggle" }, #endif - { { KEY_S, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "save-all" }, - { { KEY_F9, KEYMOD_LALT }, "switch-side-panel" }, - { { KEY_J, KeyMod::getDefaultModifier() | KEYMOD_LALT | KEYMOD_SHIFT }, - "terminal-split-left" }, - { { KEY_L, KeyMod::getDefaultModifier() | KEYMOD_LALT | KEYMOD_SHIFT }, - "terminal-split-right" }, - { { KEY_I, KeyMod::getDefaultModifier() | KEYMOD_LALT | KEYMOD_SHIFT }, - "terminal-split-top" }, - { { KEY_K, KeyMod::getDefaultModifier() | KEYMOD_LALT | KEYMOD_SHIFT }, - "terminal-split-bottom" }, - { { KEY_S, KeyMod::getDefaultModifier() | KEYMOD_LALT | KEYMOD_SHIFT }, - "terminal-split-swap" }, - { { KEY_T, KeyMod::getDefaultModifier() | KEYMOD_LALT | KEYMOD_SHIFT }, - "reopen-closed-tab" }, - { { KEY_1, KEYMOD_LALT }, "toggle-status-locate-bar" }, - { { KEY_2, KEYMOD_LALT }, "toggle-status-global-search-bar" }, - { { KEY_3, KEYMOD_LALT }, "toggle-status-terminal" }, - { { KEY_4, KEYMOD_LALT }, "toggle-status-build-output" }, - { { KEY_5, KEYMOD_LALT }, "toggle-status-app-output" }, - { { KEY_B, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "project-build-start" }, - { { KEY_C, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "project-build-cancel" }, - { { KEY_F5 }, "project-run-executable" }, - { { KEY_O, KEYMOD_LALT | KEYMOD_SHIFT }, "show-open-documents" }, - { { KEY_K, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "open-workspace-symbol-search" }, - { { KEY_P, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "open-document-symbol-search" }, - { { KEY_N, KEYMOD_SHIFT | KEYMOD_LALT }, "create-new-window" }, + { { KEY_S, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "save-all" }, + { { KEY_F9, KEYMOD_LALT }, "switch-side-panel" }, + { { KEY_J, KeyMod::getDefaultModifier() | KEYMOD_LALT | KEYMOD_SHIFT }, + "terminal-split-left" }, + { { KEY_L, KeyMod::getDefaultModifier() | KEYMOD_LALT | KEYMOD_SHIFT }, + "terminal-split-right" }, + { { KEY_I, KeyMod::getDefaultModifier() | KEYMOD_LALT | KEYMOD_SHIFT }, + "terminal-split-top" }, + { { KEY_K, KeyMod::getDefaultModifier() | KEYMOD_LALT | KEYMOD_SHIFT }, + "terminal-split-bottom" }, + { { KEY_S, KeyMod::getDefaultModifier() | KEYMOD_LALT | KEYMOD_SHIFT }, + "terminal-split-swap" }, + { { KEY_T, KeyMod::getDefaultModifier() | KEYMOD_LALT | KEYMOD_SHIFT }, + "reopen-closed-tab" }, + { { KEY_1, KEYMOD_LALT }, "toggle-status-locate-bar" }, + { { KEY_2, KEYMOD_LALT }, "toggle-status-global-search-bar" }, + { { KEY_3, KEYMOD_LALT }, "toggle-status-terminal" }, + { { KEY_4, KEYMOD_LALT }, "toggle-status-build-output" }, + { { KEY_5, KEYMOD_LALT }, "toggle-status-app-output" }, + { { KEY_B, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "project-build-start" }, + { { KEY_C, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "project-build-cancel" }, + { { KEY_F5, KEYMOD_NONE }, "project-build-and-run" }, + { { KEY_O, KEYMOD_LALT | KEYMOD_SHIFT }, "show-open-documents" }, + { { KEY_K, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, + "open-workspace-symbol-search" }, + { { KEY_P, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, + "open-document-symbol-search" }, + { { KEY_N, KEYMOD_SHIFT | KEYMOD_LALT }, "create-new-window" }, }; } @@ -2086,13 +2087,13 @@ std::map App::getLocalKeybindings() { std::map App::getMigrateKeybindings() { return { { "fullscreen-toggle", "alt+return" }, { "switch-to-tab-1", "alt+1" }, - { "switch-to-tab-2", "alt+2" }, { "switch-to-tab-3", "alt+3" }, - { "switch-to-tab-4", "alt+4" }, { "switch-to-tab-5", "alt+5" }, - { "switch-to-tab-6", "alt+6" }, { "switch-to-tab-7", "alt+7" }, - { "switch-to-tab-8", "alt+8" }, { "switch-to-tab-9", "alt+9" }, - { "switch-to-last-tab", "alt+0" }, + { "switch-to-tab-2", "alt+2" }, { "switch-to-tab-3", "alt+3" }, + { "switch-to-tab-4", "alt+4" }, { "switch-to-tab-5", "alt+5" }, + { "switch-to-tab-6", "alt+6" }, { "switch-to-tab-7", "alt+7" }, + { "switch-to-tab-8", "alt+8" }, { "switch-to-tab-9", "alt+9" }, + { "switch-to-last-tab", "alt+0" }, #if EE_PLATFORM == EE_PLATFORM_MACOS - { "menu-toggle", "mod+shift+m" }, + { "menu-toggle", "mod+shift+m" }, #endif }; } @@ -2111,6 +2112,7 @@ std::vector App::getUnlockedCommands() { "open-global-search", "project-build-start", "project-build-cancel", + "project-build-and-run", "project-run-executable", "toggle-status-locate-bar", "toggle-status-global-search-bar", diff --git a/src/tools/ecode/ecode.hpp b/src/tools/ecode/ecode.hpp index f6d52beef..c2f10d033 100644 --- a/src/tools/ecode/ecode.hpp +++ b/src/tools/ecode/ecode.hpp @@ -262,7 +262,12 @@ class App : public UICodeEditorSplitter::Client { } ); t.setCommand( "project-run-executable", [this] { if ( mProjectBuildManager && mStatusAppOutputController ) - mProjectBuildManager->runCurrentConfig( mStatusAppOutputController.get() ); + mProjectBuildManager->runCurrentConfig( mStatusAppOutputController.get(), false ); + } ); + t.setCommand( "project-build-and-run", [this] { + if ( mProjectBuildManager && mStatusAppOutputController ) + mProjectBuildManager->runCurrentConfig( mStatusAppOutputController.get(), true, + mStatusBuildOutputController.get() ); } ); t.setCommand( "project-stop-executable", [this] { if ( mProjectBuildManager && mProjectBuildManager->isRunningApp() ) diff --git a/src/tools/ecode/projectbuild.cpp b/src/tools/ecode/projectbuild.cpp index 4db5bf7e4..df306b9b5 100644 --- a/src/tools/ecode/projectbuild.cpp +++ b/src/tools/ecode/projectbuild.cpp @@ -1,5 +1,5 @@ -#include "projectbuild.hpp" #include "ecode.hpp" +#include "projectbuild.hpp" #include "statusbuildoutputcontroller.hpp" #include "uibuildsettings.hpp" #include @@ -665,7 +665,8 @@ void ProjectBuildManager::setConfig( const ProjectBuildConfiguration& config ) { } } -void ProjectBuildManager::buildCurrentConfig( StatusBuildOutputController* sboc ) { +void ProjectBuildManager::buildCurrentConfig( StatusBuildOutputController* sboc, + std::function doneFn ) { if ( sboc && !isBuilding() && !getBuilds().empty() ) { const ProjectBuild* build = nullptr; for ( const auto& buildIt : getBuilds() ) @@ -675,7 +676,7 @@ void ProjectBuildManager::buildCurrentConfig( StatusBuildOutputController* sboc if ( build ) { mApp->saveAll(); sboc->runBuild( build->getName(), mConfig.buildType, - getOutputParser( build->getName() ) ); + getOutputParser( build->getName() ), false, doneFn ); } } } @@ -693,8 +694,19 @@ void ProjectBuildManager::cleanCurrentConfig( StatusBuildOutputController* sboc } } -void ProjectBuildManager::runCurrentConfig( StatusAppOutputController* saoc ) { - if ( !mRunning && !isRunningApp() && !getBuilds().empty() ) { +void ProjectBuildManager::runCurrentConfig( StatusAppOutputController* saoc, bool build, + StatusBuildOutputController* sboc ) { + if ( build ) { + buildCurrentConfig( sboc, [this, saoc]( int ) { + mApp->getUISceneNode()->runOnMainThread( [saoc, this] { runConfig( saoc ); } ); + } ); + } else { + runConfig( saoc ); + } +} + +void ProjectBuildManager::runConfig( StatusAppOutputController* saoc ) { + if ( !isRunningApp() && !getBuilds().empty() ) { BoolScopedOp op( mRunning, true ); const ProjectBuild* build = nullptr; for ( const auto& buildIt : getBuilds() ) @@ -823,7 +835,7 @@ void ProjectBuildManager::runBuild( const std::string& buildName, const std::str if ( mProcess->create( cmd.cmd, cmd.args, options, toUnorderedMap( res.envs ), cmd.workingDir ) ) { - std::string buffer( 1024, '\0' ); + std::string buffer( 4096, '\0' ); unsigned bytesRead = 0; int returnCode; do { @@ -890,7 +902,6 @@ void ProjectBuildManager::runApp( const ProjectBuildCommand& cmd, const ProjectB const ProjectBuildCommandsRes& res, const ProjectBuildProgressFn& progressFn, const ProjectBuildDoneFn& doneFn ) { - BoolScopedOp scopedOp( mRunningApp, true ); Clock clock; auto printElapsed = [&clock, &i18n, &progressFn]() { @@ -929,7 +940,7 @@ void ProjectBuildManager::runApp( const ProjectBuildCommand& cmd, const ProjectB if ( mProcess->create( cmd.cmd, cmd.args, options, toUnorderedMap( res.envs ), cmd.workingDir ) ) { - std::string buffer( 1024, '\0' ); + std::string buffer( 4096, '\0' ); unsigned bytesRead = 0; int returnCode; do { @@ -1111,7 +1122,7 @@ void ProjectBuildManager::updateSidePanelTab() { if ( isRunningApp() ) { cancelRun(); } else { - runCurrentConfig( mApp->getStatusAppOutputController() ); + runCurrentConfig( mApp->getStatusAppOutputController(), false ); } } ); } diff --git a/src/tools/ecode/projectbuild.hpp b/src/tools/ecode/projectbuild.hpp index 193804bdc..17d0c8961 100644 --- a/src/tools/ecode/projectbuild.hpp +++ b/src/tools/ecode/projectbuild.hpp @@ -72,6 +72,20 @@ class StatusAppOutputController; } ] }, + "run": [ + { + "args": "-x", + "command": "${project_root}/bin/ecode-debug", + "name": "ecode-debug", + "working_dir": "${project_root}/bin/" + }, + { + "args": "-x", + "command": "${project_root}/bin/ecode", + "name": "ecode-release", + "working_dir": "${project_root}/bin/" + } + ], "var": { "build_dir": "${project_root}/make/${os}" } @@ -254,9 +268,9 @@ class ProjectBuildManager { const ProjectBuildProgressFn& progressFn = {}, const ProjectBuildDoneFn& doneFn = {}, bool isClean = false ); - ProjectBuildCommandsRes run(const ProjectBuildCommand& runData, const ProjectBuildi18nFn& i18n, - const ProjectBuildProgressFn& progressFn = {}, - const ProjectBuildDoneFn& doneFn = {} ); + ProjectBuildCommandsRes run( const ProjectBuildCommand& runData, const ProjectBuildi18nFn& i18n, + const ProjectBuildProgressFn& progressFn = {}, + const ProjectBuildDoneFn& doneFn = {} ); ProjectBuildCommandsRes generateBuildCommands( const std::string& buildName, const ProjectBuildi18nFn& i18n, @@ -287,7 +301,7 @@ class ProjectBuildManager { bool isBuilding() const { return mBuilding; } - bool isRunningApp() const { return mRunningApp; } + bool isRunningApp() const { return mRunning; } void cancelBuild(); @@ -297,11 +311,13 @@ class ProjectBuildManager { void setConfig( const ProjectBuildConfiguration& config ); - void buildCurrentConfig( StatusBuildOutputController* sboc ); + void buildCurrentConfig( StatusBuildOutputController* sboc, + std::function doneFn = {} ); void cleanCurrentConfig( StatusBuildOutputController* sboc ); - void runCurrentConfig( StatusAppOutputController* sboc ); + void runCurrentConfig( StatusAppOutputController* saoc, bool build, + StatusBuildOutputController* sboc = nullptr ); protected: std::string mProjectRoot; @@ -322,7 +338,6 @@ class ProjectBuildManager { bool mCancelBuild{ false }; bool mCancelRun{ false }; bool mRunning{ false }; - bool mRunningApp{ false }; std::unordered_map> mCbs; void runBuild( const std::string& buildName, const std::string& buildType, @@ -355,6 +370,8 @@ class ProjectBuildManager { void addBuild( UIWidget* buildTab ); void editBuild( std::string buildName, UIWidget* buildTab ); + + void runConfig( StatusAppOutputController* saoc ); }; } // namespace ecode diff --git a/src/tools/ecode/statusbuildoutputcontroller.cpp b/src/tools/ecode/statusbuildoutputcontroller.cpp index 0368784fd..106e629c2 100644 --- a/src/tools/ecode/statusbuildoutputcontroller.cpp +++ b/src/tools/ecode/statusbuildoutputcontroller.cpp @@ -102,7 +102,8 @@ static void safeInsertBuffer( TextDocument& doc, const std::string& buffer ) { void StatusBuildOutputController::runBuild( const std::string& buildName, const std::string& buildType, const ProjectBuildOutputParser& outputParser, - bool isClean ) { + bool isClean, + std::function doneFn ) { if ( nullptr == mApp->getProjectBuildManager() ) return; @@ -220,7 +221,8 @@ void StatusBuildOutputController::runBuild( const std::string& buildName, } } while ( !buffer.empty() ); }, - [this, updateBuildButton, isClean]( auto exitCode, const ProjectBuildCommand* cmd ) { + [this, updateBuildButton, isClean, doneFn]( auto exitCode, + const ProjectBuildCommand* cmd ) { if ( !mCurLineBuffer.empty() && nullptr != cmd ) searchFindAndAddStatusResult( mPatternHolder, mCurLineBuffer, cmd ); String buffer; @@ -245,12 +247,17 @@ void StatusBuildOutputController::runBuild( const std::string& buildName, if ( !mApp->getWindow()->hasFocus() ) mApp->getWindow()->flash( WindowFlashOperation::UntilFocused ); + + if ( doneFn ) + doneFn( exitCode ); }, isClean ); if ( !res.isValid() ) { mApp->getNotificationCenter()->addNotification( res.errorMsg ); updateBuildButton(); + if ( doneFn ) + doneFn( EXIT_FAILURE ); } } diff --git a/src/tools/ecode/statusbuildoutputcontroller.hpp b/src/tools/ecode/statusbuildoutputcontroller.hpp index 5d3c5b8aa..16a796e49 100644 --- a/src/tools/ecode/statusbuildoutputcontroller.hpp +++ b/src/tools/ecode/statusbuildoutputcontroller.hpp @@ -42,7 +42,8 @@ class StatusBuildOutputController : public StatusBarElement { virtual ~StatusBuildOutputController(){}; void runBuild( const std::string& buildName, const std::string& buildType, - const ProjectBuildOutputParser& outputParser = {}, bool isClean = false ); + const ProjectBuildOutputParser& outputParser = {}, bool isClean = false, + std::function doneFn = {} ); UIWidget* getWidget(); diff --git a/src/tools/ecode/terminalmanager.cpp b/src/tools/ecode/terminalmanager.cpp index 11d559abb..286f173e7 100644 --- a/src/tools/ecode/terminalmanager.cpp +++ b/src/tools/ecode/terminalmanager.cpp @@ -561,7 +561,7 @@ void TerminalManager::setKeybindings( UITerminal* term ) { "debug-draw-boxes-toggle", "debug-draw-debug-data", "debug-widget-tree-view", "open-locatebar", "open-command-palette", "open-global-search", "menu-toggle", "console-toggle", "go-to-line", "editor-go-back", "editor-go-forward", - "project-run-executable" } ); + "project-run-executable", "project-build-and-run" } ); } } // namespace ecode