| 1 |
|
#include "manualcommands.h" |
| 2 |
|
#include "ui_manualcommands.h" |
| 3 |
– |
#include <QDebug> |
| 3 |
|
|
| 4 |
|
ManualCommands::ManualCommands(QWidget *parent) : |
| 5 |
|
QMainWindow(parent), |
| 6 |
|
ui(new Ui::ManualCommands) |
| 7 |
|
{ |
| 8 |
|
ui->setupUi(this); |
| 9 |
< |
this->setAttribute(Qt::WA_DeleteOnClose,true); //destroy itself once finished. |
| 9 |
> |
this->setAttribute(Qt::WA_DeleteOnClose, true); //destroy itself once finished. |
| 10 |
|
this->myProcess = new QProcess(); |
| 11 |
|
this->myProcess->setProcessChannelMode(QProcess::MergedChannels); |
| 12 |
|
this->myProcess->setWorkingDirectory(UtilVago::getAppPath()); |
| 32 |
|
|
| 33 |
|
void ManualCommands::executeCommand(){ |
| 34 |
|
|
| 35 |
+ |
QString toolExecutable; |
| 36 |
+ |
|
| 37 |
+ |
if(ui->cbTargetTool->currentText() == "OniSplit"){ |
| 38 |
+ |
toolExecutable = UtilVago::getOniSplitExecutable(); |
| 39 |
+ |
} |
| 40 |
+ |
else{ |
| 41 |
+ |
toolExecutable = UtilVago::getXmlToolsExecutable(); |
| 42 |
+ |
} |
| 43 |
+ |
|
| 44 |
|
QString command=ui->leManualCommand->text().trimmed(); |
| 45 |
|
|
| 46 |
|
if(command.isEmpty()){ |
| 69 |
|
} |
| 70 |
|
} |
| 71 |
|
|
| 72 |
< |
QString var = UtilVago::getOniSplitExecutable() +" "+ui->leManualCommand->text(); |
| 65 |
< |
|
| 66 |
< |
this->myProcess->start(UtilVago::getOniSplitExecutable()+" "+ui->leManualCommand->text()); |
| 72 |
> |
this->myProcess->start(toolExecutable+" "+ui->leManualCommand->text()); |
| 73 |
|
this->myProcess->waitForFinished(120000); //wait 2 minutes at maximum |
| 74 |
< |
ui->ptOutput->appendPlainText("> "+command); |
| 74 |
> |
ui->ptOutput->appendPlainText("> " + ui->cbTargetTool->currentText() + " " + command); |
| 75 |
|
ui->ptOutput->appendPlainText(this->myProcess->readAll()); |
| 76 |
|
ui->ptOutput->ensureCursorVisible(); |
| 77 |
|
ui->ptOutput->verticalScrollBar()->setValue( ui->ptOutput->verticalScrollBar()->maximum() ); |