ExtractProcess::ExtractProcess( Project *prj, bool& success, QTextCodec *codec ) : KProcIO( codec ) { success = false; // prj mustn't be 0 if ( !prj ) kdFatal() << "ExtractProcess constructor: prj is null\n"; setUseShell( true ); setWorkingDirectory( prj->directory() ); setComm( KProcess::Stderr ); enableReadSignals( true ); // TODO check if cat, tcextract and subtitle2pgm are executable *this << "cat"; uint n = prj->files().count(); QString file; for (uint i = 0; i < n; ++i ) { if ( !prj->downloadVob( i, file ) ) return; else *this << file; } *this << "|" << "tcextract" << "-x" << "ps1" << "-t" << "vob" << "-a" << prj->codeLangSelected(); *this << "|" << "subtitle2pgm" << "-v" << "-P" << "-C" << "1"; *this << "-c" << prj->coloursString() << "-o" << prj->baseName(); success = true; }
/** * Class constructor. * @param bAutoDelete If true, the object is deleted when the process * terminates (false by default) */ MakeFrontend::MakeFrontend(bool bAutoDelete) : Frontend(1, bAutoDelete) { // Execute using the user's shell setUseShell(); // Each token represent a complete line m_delim = Newline; }
KompareProcess::KompareProcess( DiffSettings* diffSettings, enum Kompare::DiffMode mode, QString source, QString destination, QString dir ) : KProcess(), m_diffSettings( diffSettings ), m_mode( mode ), m_textDecoder( 0 ) { setUseShell( true ); // connect the stdout and stderr signals connect( this, SIGNAL( receivedStdout( KProcess*, char*, int ) ), SLOT ( slotReceivedStdout( KProcess*, char*, int ) ) ); connect( this, SIGNAL( receivedStderr( KProcess*, char*, int ) ), SLOT ( slotReceivedStderr( KProcess*, char*, int ) ) ); // connect the signal that indicates that the proces has exited connect( this, SIGNAL( processExited( KProcess* ) ), SLOT ( slotProcessExited( KProcess* ) ) ); *this << "LANG=C"; // Write command and options if( m_mode == Kompare::Default ) { writeDefaultCommandLine(); } else { writeCommandLine(); } if( !dir.isEmpty() ) { QDir::setCurrent( dir ); } // Write file names *this << "--"; *this << KProcess::quote( constructRelativePath( dir, source ) ); *this << KProcess::quote( constructRelativePath( dir, destination ) ); }
/** * Executes the script using the "sh" shell. * @param sCscopePath If given, overrides the automatic check for Cscope's * path * @param sCtagsPath If given, overrides the automatic check for Ctags' * path * @param sDotPath If given, overrides the automatic check for Dot's * path * @param bCscopeOptsOnly Only verify cscope's path and options * @return true if successful, false otherwise */ bool ConfigFrontend::run(const QString& sCscopePath, const QString& sCtagsPath, const QString& sDotPath, bool bCscopeOptsOnly) { QStringList slArgs; KStandardDirs sd; QString sScript; // Execute using the user's shell setUseShell(); // Find the configuration script sScript = sd.findResource("data", "kscope/kscope_config"); if (sScript.isEmpty()) return false; // Set command line arguments slArgs << QString("sh") << sScript; // Initialise environment setEnv("CSCOPE_PATH", sCscopePath); if (bCscopeOptsOnly){ slArgs << QString("-co"); } else { setEnv("CTAGS_PATH", sCtagsPath); setEnv("DOT_PATH", sDotPath); } // Parser initialisation m_delim = Newline; m_nNextResult = CscopePath; if (!Frontend::run("sh", QStringList(slArgs))) return false; emit test(CscopePath); return true; }