@ -21,7 +21,7 @@
@@ -21,7 +21,7 @@
# include <QProcess>
Command : : Command ( ) :
m_currentProcess ( 0 ) ,
m_currentProcess ( nullptr ) ,
m_currentProcessState ( QProcess : : NotRunning ) ,
m_isInError ( false ) ,
m_currentProcessError ( QProcess : : UnknownError ) ,
@ -30,10 +30,8 @@ Command::Command() :
@@ -30,10 +30,8 @@ Command::Command() :
m_currentProcessExitStatus ( QProcess : : NormalExit ) ,
m_currentProcessPid ( 0 )
{
m_currentProcessStartTimeStamp . tv_sec = 0 ;
m_currentProcessStartTimeStamp . tv_usec = 0 ;
m_currentProcessFinishTimeStamp . tv_sec = 0 ;
m_currentProcessFinishTimeStamp . tv_usec = 0 ;
m_currentProcessStartTimeStamp = 0 ;
m_currentProcessFinishTimeStamp = 0 ;
resetToDefaults ( ) ;
}
@ -48,7 +46,7 @@ Command::Command(const Command& command) :
@@ -48,7 +46,7 @@ Command::Command(const Command& command) :
m_keyModifiers ( command . m_keyModifiers ) ,
m_associateKey ( command . m_associateKey ) ,
m_release ( command . m_release ) ,
m_currentProcess ( 0 ) ,
m_currentProcess ( nullptr ) ,
m_currentProcessState ( QProcess : : NotRunning ) ,
m_isInError ( false ) ,
m_currentProcessError ( QProcess : : UnknownError ) ,
@ -57,10 +55,8 @@ Command::Command(const Command& command) :
@@ -57,10 +55,8 @@ Command::Command(const Command& command) :
m_currentProcessExitStatus ( QProcess : : NormalExit ) ,
m_currentProcessPid ( 0 )
{
m_currentProcessStartTimeStamp . tv_sec = 0 ;
m_currentProcessStartTimeStamp . tv_usec = 0 ;
m_currentProcessFinishTimeStamp . tv_sec = 0 ;
m_currentProcessFinishTimeStamp . tv_usec = 0 ;
m_currentProcessStartTimeStamp = 0 ;
m_currentProcessFinishTimeStamp = 0 ;
}
Command : : ~ Command ( )
@ -85,7 +81,7 @@ void Command::resetToDefaults()
@@ -85,7 +81,7 @@ void Command::resetToDefaults()
m_command = " " ;
m_argString = " " ;
m_key = static_cast < Qt : : Key > ( 0 ) ;
m_keyModifiers = Qt : : NoModifier ,
m_keyModifiers = Qt : : NoModifier ;
m_associateKey = false ;
m_release = false ;
}
@ -202,7 +198,7 @@ void Command::run(const QString& apiAddress, int apiPort, int deviceSetIndex)
@@ -202,7 +198,7 @@ void Command::run(const QString& apiAddress, int apiPort, int deviceSetIndex)
connect ( m_currentProcess , SIGNAL ( stateChanged ( QProcess : : ProcessState ) ) , this , SLOT ( processStateChanged ( QProcess : : ProcessState ) ) ) ;
m_currentProcess - > setProcessChannelMode ( QProcess : : MergedChannels ) ;
gettimeofday ( & m_currentProcessStartTimeStamp , 0 ) ;
m_currentProcessStartTimeStamp = clock ( ) ;
m_currentProcess - > start ( m_currentProcessCommandLine ) ;
}
@ -258,7 +254,7 @@ void Command::processStateChanged(QProcess::ProcessState newState)
@@ -258,7 +254,7 @@ void Command::processStateChanged(QProcess::ProcessState newState)
void Command : : processError ( QProcess : : ProcessError error )
{
//qDebug("Command::processError: %d state: %d", error, m_currentProcessState);
gettimeofday ( & m_currentProcessFinishTimeStamp , 0 ) ;
m_currentProcessFinishTimeStamp = clock ( ) ;
m_currentProcessError = error ;
m_isInError = true ;
@ -275,14 +271,14 @@ void Command::processError(QProcess::ProcessError error)
@@ -275,14 +271,14 @@ void Command::processError(QProcess::ProcessError error)
disconnect ( m_currentProcess , SIGNAL ( stateChanged ( QProcess : : ProcessState ) ) , this , SLOT ( processStateChanged ( QProcess : : ProcessState ) ) ) ;
m_currentProcess - > deleteLater ( ) ; // make sure other threads can still access it until all events have been processed
m_currentProcess = 0 ; // for this thread it can assume it was deleted
m_currentProcess = nullptr ; // for this thread it can assume it was deleted
}
}
void Command : : processFinished ( int exitCode , QProcess : : ExitStatus exitStatus )
{
//qDebug("Command::processFinished: (%d) %d", exitCode, exitStatus);
gettimeofday ( & m_currentProcessFinishTimeStamp , 0 ) ;
m_currentProcessFinishTimeStamp = clock ( ) ;
m_currentProcessExitCode = exitCode ;
m_currentProcessExitStatus = exitStatus ;
m_hasExited = true ;
@ -297,5 +293,5 @@ void Command::processFinished(int exitCode, QProcess::ExitStatus exitStatus)
@@ -297,5 +293,5 @@ void Command::processFinished(int exitCode, QProcess::ExitStatus exitStatus)
disconnect ( m_currentProcess , SIGNAL ( stateChanged ( QProcess : : ProcessState ) ) , this , SLOT ( processStateChanged ( QProcess : : ProcessState ) ) ) ;
m_currentProcess - > deleteLater ( ) ; // make sure other threads can still access it until all events have been processed
m_currentProcess = 0 ; // for this thread it can assume it was deleted
m_currentProcess = nullptr ; // for this thread it can assume it was deleted
}