External Tools: Show effective arguments

Expand variables to demonstrate what the arguments will be like

Change-Id: I32aed8aed38ada32b0ac6590772ed4d054bd463f
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
Orgad Shaneh
2012-12-30 22:02:44 +02:00
committed by Orgad Shaneh
parent 339b7ba203
commit 9e1d730f4b
3 changed files with 45 additions and 17 deletions

View File

@@ -32,9 +32,11 @@
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/variablechooser.h>
#include <coreplugin/variablemanager.h>
#include <QTextStream>
#include <QFile>
@@ -417,6 +419,7 @@ ExternalToolConfig::ExternalToolConfig(QWidget *parent) :
connect(ui->executable, SIGNAL(editingFinished()), this, SLOT(updateCurrentItem()));
connect(ui->executable, SIGNAL(browsingFinished()), this, SLOT(updateCurrentItem()));
connect(ui->arguments, SIGNAL(editingFinished()), this, SLOT(updateCurrentItem()));
connect(ui->arguments, SIGNAL(editingFinished()), this, SLOT(updateEffectiveArguments()));
connect(ui->workingDirectory, SIGNAL(editingFinished()), this, SLOT(updateCurrentItem()));
connect(ui->workingDirectory, SIGNAL(browsingFinished()), this, SLOT(updateCurrentItem()));
connect(ui->outputBehavior, SIGNAL(activated(int)), this, SLOT(updateCurrentItem()));
@@ -556,6 +559,7 @@ void ExternalToolConfig::showInfoForItem(const QModelIndex &index)
ui->description->setCursorPosition(0);
ui->arguments->setCursorPosition(0);
updateEffectiveArguments();
}
QMap<QString, QList<ExternalTool *> > ExternalToolConfig::tools() const
@@ -602,3 +606,9 @@ void ExternalToolConfig::addCategory()
ui->toolTree->selectionModel()->setCurrentIndex(index, QItemSelectionModel::SelectCurrent);
ui->toolTree->edit(index);
}
void ExternalToolConfig::updateEffectiveArguments()
{
ui->effectiveArguments->setText(Utils::QtcProcess::expandMacros(ui->arguments->text(),
Core::VariableManager::instance()->macroExpander()));
}

View File

@@ -108,6 +108,7 @@ private slots:
void addTool();
void removeTool();
void addCategory();
void updateEffectiveArguments();
private:
Ui::ExternalToolConfig *ui;

View File

@@ -131,20 +131,37 @@
<widget class="QLineEdit" name="arguments"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="effectiveArgumentsLabel">
<property name="text">
<string>Effective Arguments:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="effectiveArguments">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="workingDirectoryLabel">
<property name="text">
<string>Working directory:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="1">
<widget class="Utils::PathChooser" name="workingDirectory">
<property name="expectedKind">
<enum>Utils::PathChooser::Directory</enum>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QLabel" name="outputLabel">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;
@@ -157,7 +174,7 @@
</property>
</widget>
</item>
<item row="4" column="1">
<item row="5" column="1">
<widget class="QComboBox" name="outputBehavior">
<item>
<property name="text">
@@ -176,7 +193,7 @@
</item>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QLabel" name="errorOutputLabel">
<property name="toolTip">
<string>&lt;html&gt;&lt;head&gt;&lt;body&gt;
@@ -191,7 +208,7 @@
</property>
</widget>
</item>
<item row="5" column="1">
<item row="6" column="1">
<widget class="QComboBox" name="errorOutputBehavior">
<item>
<property name="text">
@@ -210,7 +227,17 @@
</item>
</widget>
</item>
<item row="7" column="0">
<item row="7" column="1">
<widget class="QCheckBox" name="modifiesDocumentCheckbox">
<property name="toolTip">
<string>If the tool modifies the current document, set this flag to ensure that the document is saved before running the tool and is reloaded after the tool finished.</string>
</property>
<property name="text">
<string>Modifies current document</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="inputLabel">
<property name="toolTip">
<string>Text to pass to the executable via standard input. Leave empty if the executable should not receive any input.</string>
@@ -220,23 +247,13 @@
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<widget class="QPlainTextEdit" name="inputText">
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QCheckBox" name="modifiesDocumentCheckbox">
<property name="toolTip">
<string>If the tool modifies the current document, set this flag to ensure that the document is saved before running the tool and is reloaded after the tool finished.</string>
</property>
<property name="text">
<string>Modifies current document</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>