summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcon <qtc-committer@nokia.com>2009-01-29 15:48:54 +0100
committercon <qtc-committer@nokia.com>2009-01-29 15:49:38 +0100
commitf781076c5a8caa5db7ecfaa02cd0a0e6ec0f0d75 (patch)
tree07ee2f6dfb19bd2e6cd2f0e999f39e682498666e /src
parentb04ac61ef00b001a23dfed9ff7bbf6162291b1e4 (diff)
downloadqt-creator-f781076c5a8caa5db7ecfaa02cd0a0e6ec0f0d75.tar.gz
Fixes: - Custom executable GUI cleanup
Task: - 237690
Diffstat (limited to 'src')
-rw-r--r--src/plugins/projectexplorer/customexecutablerunconfiguration.cpp72
-rw-r--r--src/plugins/projectexplorer/customexecutablerunconfiguration.h12
2 files changed, 23 insertions, 61 deletions
diff --git a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp
index 4012cee8e1..3bd7472601 100644
--- a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp
+++ b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp
@@ -54,46 +54,34 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE
QFormLayout *layout = new QFormLayout();
layout->setMargin(0);
- m_executableLineEdit = new QLineEdit;
- QToolButton *exectuableToolButton = new QToolButton();
- exectuableToolButton->setText("...");
- QHBoxLayout *hl = new QHBoxLayout;
- hl->addWidget(m_executableLineEdit);
- hl->addWidget(exectuableToolButton);
- layout->addRow("Executable", hl);
+ m_executableChooser = new Core::Utils::PathChooser();
+ m_executableChooser->setExpectedKind(Core::Utils::PathChooser::File);
+ layout->addRow("Executable:", m_executableChooser);
m_commandLineArgumentsLineEdit = new QLineEdit;
- layout->addRow("Arguments", m_commandLineArgumentsLineEdit);
+ m_commandLineArgumentsLineEdit->setMinimumWidth(200); // this shouldn't be fixed here...
+ layout->addRow("Arguments:", m_commandLineArgumentsLineEdit);
- m_workingDirectoryLineEdit = new QLineEdit();
- QToolButton *workingDirectoryToolButton = new QToolButton();
- workingDirectoryToolButton->setText("...");
- hl = new QHBoxLayout;
- hl->addWidget(m_workingDirectoryLineEdit);
- hl->addWidget(workingDirectoryToolButton);
- layout->addRow("Working Directory", hl);
+ m_workingDirectory = new Core::Utils::PathChooser();
+ layout->addRow("Working Directory:", m_workingDirectory);
setLayout(layout);
changed();
- connect(m_executableLineEdit, SIGNAL(textEdited(const QString&)),
- this, SLOT(setExecutable(const QString&)));
+ connect(m_executableChooser, SIGNAL(changed()),
+ this, SLOT(setExecutable()));
connect(m_commandLineArgumentsLineEdit, SIGNAL(textEdited(const QString&)),
this, SLOT(setCommandLineArguments(const QString&)));
- connect(m_workingDirectoryLineEdit, SIGNAL(textEdited(const QString&)),
- this, SLOT(setWorkingDirectory(const QString&)));
- connect(exectuableToolButton, SIGNAL(clicked(bool)),
- this, SLOT(executableToolButtonClicked()));
- connect(workingDirectoryToolButton, SIGNAL(clicked(bool)),
- this, SLOT(workingDirectoryToolButtonClicked()));
+ connect(m_workingDirectory, SIGNAL(changed()),
+ this, SLOT(setWorkingDirectory()));
connect(m_runConfiguration, SIGNAL(changed()), this, SLOT(changed()));
}
-void CustomExecutableConfigurationWidget::setExecutable(const QString &executable)
+void CustomExecutableConfigurationWidget::setExecutable()
{
m_ignoreChange = true;
- m_runConfiguration->setExecutable(executable);
+ m_runConfiguration->setExecutable(m_executableChooser->path());
m_ignoreChange = false;
}
void CustomExecutableConfigurationWidget::setCommandLineArguments(const QString &commandLineArguments)
@@ -102,47 +90,21 @@ void CustomExecutableConfigurationWidget::setCommandLineArguments(const QString
m_runConfiguration->setCommandLineArguments(commandLineArguments);
m_ignoreChange = false;
}
-void CustomExecutableConfigurationWidget::setWorkingDirectory(const QString &workingDirectory)
+void CustomExecutableConfigurationWidget::setWorkingDirectory()
{
m_ignoreChange = true;
- m_runConfiguration->setWorkingDirectory(workingDirectory);
+ m_runConfiguration->setWorkingDirectory(m_workingDirectory->path());
m_ignoreChange = false;
}
-void CustomExecutableConfigurationWidget::executableToolButtonClicked()
-{
- QString newValue;
- QString executableFilter;
-#ifdef Q_OS_WIN
- executableFilter = "Executable (*.exe)";
-#endif
- newValue = QFileDialog::getOpenFileName(this, "Executable", "", executableFilter);
- if (!newValue.isEmpty()) {
- m_executableLineEdit->setText(newValue);
- setExecutable(newValue);
- }
-}
-
-void CustomExecutableConfigurationWidget::workingDirectoryToolButtonClicked()
-{
- QString newValue;
- QString executableFilter;
-
- newValue = QFileDialog::getExistingDirectory(this, "Directory", m_workingDirectoryLineEdit->text());
- if (newValue.isEmpty()) {
- m_workingDirectoryLineEdit->setText(newValue);
- setWorkingDirectory(newValue);
- }
-}
-
void CustomExecutableConfigurationWidget::changed()
{
// We triggered the change, don't update us
if (m_ignoreChange)
return;
- m_executableLineEdit->setText(m_runConfiguration->baseExecutable());
+ m_executableChooser->setPath(m_runConfiguration->baseExecutable());
m_commandLineArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(m_runConfiguration->commandLineArguments()));
- m_workingDirectoryLineEdit->setText(m_runConfiguration->baseWorkingDirectory());
+ m_workingDirectory->setPath(m_runConfiguration->baseWorkingDirectory());
}
CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(Project *pro)
diff --git a/src/plugins/projectexplorer/customexecutablerunconfiguration.h b/src/plugins/projectexplorer/customexecutablerunconfiguration.h
index 52cbedd51c..f2f05cb0b2 100644
--- a/src/plugins/projectexplorer/customexecutablerunconfiguration.h
+++ b/src/plugins/projectexplorer/customexecutablerunconfiguration.h
@@ -36,6 +36,8 @@
#include "applicationrunconfiguration.h"
+#include <utils/pathchooser.h>
+
#include <QtGui/QToolButton>
QT_BEGIN_NAMESPACE
@@ -108,18 +110,16 @@ public:
CustomExecutableConfigurationWidget(CustomExecutableRunConfiguration *rc);
private slots:
void changed();
- void executableToolButtonClicked();
- void workingDirectoryToolButtonClicked();
- void setExecutable(const QString &executable);
+ void setExecutable();
void setCommandLineArguments(const QString &commandLineArguments);
- void setWorkingDirectory(const QString &workingDirectory);
+ void setWorkingDirectory();
private:
bool m_ignoreChange;
CustomExecutableRunConfiguration *m_runConfiguration;
- QLineEdit *m_executableLineEdit;
+ Core::Utils::PathChooser *m_executableChooser;
QLineEdit *m_commandLineArgumentsLineEdit;
- QLineEdit *m_workingDirectoryLineEdit;
+ Core::Utils::PathChooser *m_workingDirectory;
};
}
}