Commit 6a9ff4e6 authored by Tomaz  Canabrava's avatar Tomaz Canabrava Committed by Tomaz Canabrava
Browse files

Add a run button to execute the current text on the script area

parent 4750ece6
......@@ -177,6 +177,13 @@
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btnRun">
<property name="text">
<string>Run</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnAdd">
<property name="text">
......
......@@ -30,6 +30,8 @@ QuickCommandsWidget::QuickCommandsWidget(QWidget *parent)
connect(ui->btnSave, &QPushButton::clicked, this, &QuickCommandsWidget::saveCommand);
connect(ui->btnUpdate, &QPushButton::clicked, this, &QuickCommandsWidget::updateCommand);
connect(ui->btnCancel, &QPushButton::clicked, this, &QuickCommandsWidget::viewMode);
connect(ui->btnRun, &QPushButton::clicked, this, &QuickCommandsWidget::runCommand);
connect(ui->invertFilter, &QPushButton::clicked, priv->filterModel, &FilterModel::setInvertFilter);
connect(ui->filterLine, &QLineEdit::textChanged, this, [this] {
......@@ -149,6 +151,16 @@ void QuickCommandsWidget::invokeCommand(const QModelIndex &idx)
}
}
void QuickCommandsWidget::runCommand()
{
qDebug() << "Running";
const QString command = ui->command->toPlainText();
priv->controller->session()->sendTextToTerminal(command, QLatin1Char('\r'));
if (priv->controller->session()->views().count()) {
priv->controller->session()->views().at(0)->setFocus();
}
}
void QuickCommandsWidget::triggerEdit()
{
const auto sourceIdx = priv->filterModel->mapToSource(ui->commandsTreeView->currentIndex());
......
......@@ -36,6 +36,10 @@ public:
Q_SLOT void updateCommand();
Q_SLOT void invokeCommand(const QModelIndex &idx);
// Run a command from the currently selected Tree element
Q_SLOT void runCommand();
// Run the command from the Text Area
Q_SLOT void triggerEdit();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment