From: <sv...@va...> - 2010-10-18 20:51:34
|
Author: cerion Date: 2010-10-18 21:51:25 +0100 (Mon, 18 Oct 2010) New Revision: 520 Log: actually start up a process (run valgrind / view-log / ...) from the command line, rather than just pretending to. Modified: trunk/src/main.cpp trunk/src/mainwindow.cpp trunk/src/mainwindow.h trunk/src/objects/tool_object.cpp trunk/src/objects/tool_object.h trunk/src/objects/valkyrie_object.cpp trunk/src/objects/valkyrie_object.h trunk/src/toolview/toolview.h Modified: trunk/src/main.cpp =================================================================== --- trunk/src/main.cpp 2010-10-17 19:58:19 UTC (rev 519) +++ trunk/src/main.cpp 2010-10-18 20:51:25 UTC (rev 520) @@ -43,6 +43,7 @@ int exit_status = EXIT_SUCCESS; QApplication* app = 0; MainWindow* vkWin = 0; + VGTOOL::ToolProcessId startProcess = VGTOOL::PROC_NONE; // ------------------------------------------------------------ // Create all VkObjects: Vk[ Vg[ Tools[] ] ] @@ -113,8 +114,13 @@ vkWin->showToolView( VGTOOL::ID_MEMCHECK ); vkWin->show(); + + // start up a process (run valgrind / view-log / ...) from the command line. + startProcess = valkyrie.getStartToolProcess(); + if ( startProcess != VGTOOL::PROC_NONE ) { + vkWin->runTool( startProcess ); + } - qApp->processEvents(); // ------------------------------------------------------------ Modified: trunk/src/mainwindow.cpp =================================================================== --- trunk/src/mainwindow.cpp 2010-10-17 19:58:19 UTC (rev 519) +++ trunk/src/mainwindow.cpp 2010-10-18 20:51:25 UTC (rev 520) @@ -527,8 +527,8 @@ // + ToolObject::saveParsedOutput()... // view starts tool processes via this signal - connect( nextView, SIGNAL( run( int ) ), - this, SLOT( runTool( int ) ) ); + connect( nextView, SIGNAL( run( VGTOOL::ToolProcessId ) ), + this, SLOT( runTool( VGTOOL::ToolProcessId ) ) ); // add view to the stack toolViewStack->addView( nextView ); @@ -1005,13 +1005,13 @@ /*! Run the valgrind tool process. */ -void MainWindow::runTool( int procId ) +void MainWindow::runTool( VGTOOL::ToolProcessId procId ) { VGTOOL::ToolID tId = toolViewStack->currentToolId(); cerr << "MainWindow::runTool( tool: " << tId << ", proc: " << procId << " )" << endl; - vk_assert( procId >= 0 ); + vk_assert( procId > VGTOOL::PROC_NONE ); // don't come in here if there's no current view if ( !toolViewStack->isVisible() ) { @@ -1020,6 +1020,21 @@ return; } + if ( procId == VGTOOL::PROC_VALGRIND ) { + // Valkyrie may have been started with no executable + // specified. If so, show msgbox, then options dialog + if ( vkCfgProj->value( "valkyrie/binary" ).toString().isEmpty() ) { + + vkInfo( this, "Run Valgrind: No program specified", + "Please specify (via Options->Valkyrie->Binary)<br>" + "the path to the program you wish to run, along<br>" + "with any arguments required" ); + openOptions(); + + return; + } + } + // last process might not be done ... if ( !valkyrie->queryToolDone( tId ) ) { cerr << "Warning: Last process not finished" << endl; @@ -1040,26 +1055,6 @@ */ void MainWindow::runValgrind() { - cerr << "MainWindow::runValgrind()" << endl; - - // don't come in here if there's no current view - if ( !toolViewStack->isVisible() ) { - return; - } - - // Valkyrie may have been started with no executable - // specified. If so, show msgbox, then options dialog - if ( vkCfgProj->value( "valkyrie/binary" ).toString().isEmpty() ) { - - vkInfo( this, "Run Valgrind: No program specified", - "Please specify (via Options->Valkyrie->Binary)<br>" - "the path to the program you wish to run, along<br>" - "with any arguments required" ); - openOptions(); - - return; - } - runTool( VGTOOL::PROC_VALGRIND ); } Modified: trunk/src/mainwindow.h =================================================================== --- trunk/src/mainwindow.h 2010-10-17 19:58:19 UTC (rev 519) +++ trunk/src/mainwindow.h 2010-10-18 20:51:25 UTC (rev 520) @@ -56,8 +56,9 @@ public slots: void setStatus( QString msg ); void showToolView( VGTOOL::ToolID toolId ); + void runTool( VGTOOL::ToolProcessId procId ); void openOptions(); - + private: void setupLayout(); void setupActions(); @@ -77,7 +78,6 @@ void openRecentProject(); void saveAsProject(); void closeToolView(); - void runTool( int procId ); void runValgrind(); void stopTool(); void openHandBook(); Modified: trunk/src/objects/tool_object.cpp =================================================================== --- trunk/src/objects/tool_object.cpp 2010-10-17 19:58:19 UTC (rev 519) +++ trunk/src/objects/tool_object.cpp 2010-10-18 20:51:25 UTC (rev 520) @@ -227,7 +227,8 @@ Start a process - Slot, called from the ToolView */ -bool ToolObject::start( int procId, QStringList vgflags, QString logfile ) +bool ToolObject::start( VGTOOL::ToolProcessId procId, + QStringList vgflags, QString logfile ) { //cerr << "ToolObject::start(): " << procId << endl; this->saveFname = logfile; Modified: trunk/src/objects/tool_object.h =================================================================== --- trunk/src/objects/tool_object.h 2010-10-17 19:58:19 UTC (rev 519) +++ trunk/src/objects/tool_object.h 2010-10-18 20:51:25 UTC (rev 520) @@ -60,7 +60,8 @@ ToolView* createView( QWidget* parent ); ToolView* view(); - bool start( int procId, QStringList vgflags, QString logfile ); + bool start( VGTOOL::ToolProcessId procId, + QStringList vgflags, QString logfile ); // void stop(); bool queryDone(); bool isRunning(); Modified: trunk/src/objects/valkyrie_object.cpp =================================================================== --- trunk/src/objects/valkyrie_object.cpp 2010-10-17 19:58:19 UTC (rev 519) +++ trunk/src/objects/valkyrie_object.cpp 2010-10-18 20:51:25 UTC (rev 520) @@ -48,6 +48,7 @@ // init valgrind m_valgrind = new Valgrind(); + m_startToolProcess = VGTOOL::PROC_NONE; } @@ -331,7 +332,7 @@ VALKYRIE::VIEW_LOG, this->objectName(), "view-log", - 'v', + 'l', "<file>", "", "", @@ -565,12 +566,14 @@ if ( !argval.isEmpty() ) { // see if we have a logfile with at least R permissions: argval = fileCheck( &errval, argval, true ); + m_startToolProcess = VGTOOL::PROC_PARSE_LOG; } break; case VALKYRIE::BINARY: if ( !argval.isEmpty() ) { // see if we have a binary with at least X permissions: argval = fileCheck( &errval, argval, false, false, true ); + m_startToolProcess = VGTOOL::PROC_VALGRIND; } break; case VALKYRIE::BIN_FLAGS: @@ -694,7 +697,7 @@ /*! Run the tool with given process id. */ -bool Valkyrie::runTool( VGTOOL::ToolID tId, int procId ) +bool Valkyrie::runTool( VGTOOL::ToolID tId, VGTOOL::ToolProcessId procId ) { cerr << "Valkyrie::runTool( " << tId << ", " << procId << ")" << endl; Modified: trunk/src/objects/valkyrie_object.h =================================================================== --- trunk/src/objects/valkyrie_object.h 2010-10-17 19:58:19 UTC (rev 519) +++ trunk/src/objects/valkyrie_object.h 2010-10-18 20:51:25 UTC (rev 520) @@ -78,7 +78,7 @@ Valkyrie(); ~Valkyrie(); - bool runTool( VGTOOL::ToolID tId, int procId ); + bool runTool( VGTOOL::ToolID tId, VGTOOL::ToolProcessId procId ); void stopTool( VGTOOL::ToolID tId ); bool queryToolDone( VGTOOL::ToolID tId ); @@ -98,6 +98,10 @@ Valgrind* valgrind() { return m_valgrind; } + + VGTOOL::ToolProcessId getStartToolProcess() { + return m_startToolProcess; + } VkOption* findOption( QString& optKey ); //TODO: needed? @@ -115,6 +119,7 @@ private: Valgrind* m_valgrind; + VGTOOL::ToolProcessId m_startToolProcess; }; #endif // __VALKYRIE_OBJECT_H Modified: trunk/src/toolview/toolview.h =================================================================== --- trunk/src/toolview/toolview.h 2010-10-17 19:58:19 UTC (rev 519) +++ trunk/src/toolview/toolview.h 2010-10-18 20:51:25 UTC (rev 520) @@ -96,7 +96,7 @@ signals: // start appropriate process for given runState - void run( int procId ); + void run( VGTOOL::ToolProcessId procId ); void logFileChosen( QString logFilename ); protected: |