Skip to content
Snippets Groups Projects
Commit f781076c authored by con's avatar con
Browse files

Fixes: - Custom executable GUI cleanup

Task:     - 237690
parent b04ac61e
No related branches found
No related tags found
No related merge requests found
...@@ -54,46 +54,34 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE ...@@ -54,46 +54,34 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE
QFormLayout *layout = new QFormLayout(); QFormLayout *layout = new QFormLayout();
layout->setMargin(0); layout->setMargin(0);
m_executableLineEdit = new QLineEdit; m_executableChooser = new Core::Utils::PathChooser();
QToolButton *exectuableToolButton = new QToolButton(); m_executableChooser->setExpectedKind(Core::Utils::PathChooser::File);
exectuableToolButton->setText("..."); layout->addRow("Executable:", m_executableChooser);
QHBoxLayout *hl = new QHBoxLayout;
hl->addWidget(m_executableLineEdit);
hl->addWidget(exectuableToolButton);
layout->addRow("Executable", hl);
m_commandLineArgumentsLineEdit = new QLineEdit; 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(); m_workingDirectory = new Core::Utils::PathChooser();
QToolButton *workingDirectoryToolButton = new QToolButton(); layout->addRow("Working Directory:", m_workingDirectory);
workingDirectoryToolButton->setText("...");
hl = new QHBoxLayout;
hl->addWidget(m_workingDirectoryLineEdit);
hl->addWidget(workingDirectoryToolButton);
layout->addRow("Working Directory", hl);
setLayout(layout); setLayout(layout);
changed(); changed();
connect(m_executableLineEdit, SIGNAL(textEdited(const QString&)), connect(m_executableChooser, SIGNAL(changed()),
this, SLOT(setExecutable(const QString&))); this, SLOT(setExecutable()));
connect(m_commandLineArgumentsLineEdit, SIGNAL(textEdited(const QString&)), connect(m_commandLineArgumentsLineEdit, SIGNAL(textEdited(const QString&)),
this, SLOT(setCommandLineArguments(const QString&))); this, SLOT(setCommandLineArguments(const QString&)));
connect(m_workingDirectoryLineEdit, SIGNAL(textEdited(const QString&)), connect(m_workingDirectory, SIGNAL(changed()),
this, SLOT(setWorkingDirectory(const QString&))); this, SLOT(setWorkingDirectory()));
connect(exectuableToolButton, SIGNAL(clicked(bool)),
this, SLOT(executableToolButtonClicked()));
connect(workingDirectoryToolButton, SIGNAL(clicked(bool)),
this, SLOT(workingDirectoryToolButtonClicked()));
connect(m_runConfiguration, SIGNAL(changed()), this, SLOT(changed())); connect(m_runConfiguration, SIGNAL(changed()), this, SLOT(changed()));
} }
void CustomExecutableConfigurationWidget::setExecutable(const QString &executable) void CustomExecutableConfigurationWidget::setExecutable()
{ {
m_ignoreChange = true; m_ignoreChange = true;
m_runConfiguration->setExecutable(executable); m_runConfiguration->setExecutable(m_executableChooser->path());
m_ignoreChange = false; m_ignoreChange = false;
} }
void CustomExecutableConfigurationWidget::setCommandLineArguments(const QString &commandLineArguments) void CustomExecutableConfigurationWidget::setCommandLineArguments(const QString &commandLineArguments)
...@@ -102,47 +90,21 @@ void CustomExecutableConfigurationWidget::setCommandLineArguments(const QString ...@@ -102,47 +90,21 @@ void CustomExecutableConfigurationWidget::setCommandLineArguments(const QString
m_runConfiguration->setCommandLineArguments(commandLineArguments); m_runConfiguration->setCommandLineArguments(commandLineArguments);
m_ignoreChange = false; m_ignoreChange = false;
} }
void CustomExecutableConfigurationWidget::setWorkingDirectory(const QString &workingDirectory) void CustomExecutableConfigurationWidget::setWorkingDirectory()
{ {
m_ignoreChange = true; m_ignoreChange = true;
m_runConfiguration->setWorkingDirectory(workingDirectory); m_runConfiguration->setWorkingDirectory(m_workingDirectory->path());
m_ignoreChange = false; 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() void CustomExecutableConfigurationWidget::changed()
{ {
// We triggered the change, don't update us // We triggered the change, don't update us
if (m_ignoreChange) if (m_ignoreChange)
return; return;
m_executableLineEdit->setText(m_runConfiguration->baseExecutable()); m_executableChooser->setPath(m_runConfiguration->baseExecutable());
m_commandLineArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(m_runConfiguration->commandLineArguments())); 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) CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(Project *pro)
......
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
#include "applicationrunconfiguration.h" #include "applicationrunconfiguration.h"
#include <utils/pathchooser.h>
#include <QtGui/QToolButton> #include <QtGui/QToolButton>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
...@@ -108,18 +110,16 @@ public: ...@@ -108,18 +110,16 @@ public:
CustomExecutableConfigurationWidget(CustomExecutableRunConfiguration *rc); CustomExecutableConfigurationWidget(CustomExecutableRunConfiguration *rc);
private slots: private slots:
void changed(); void changed();
void executableToolButtonClicked();
void workingDirectoryToolButtonClicked();
void setExecutable(const QString &executable); void setExecutable();
void setCommandLineArguments(const QString &commandLineArguments); void setCommandLineArguments(const QString &commandLineArguments);
void setWorkingDirectory(const QString &workingDirectory); void setWorkingDirectory();
private: private:
bool m_ignoreChange; bool m_ignoreChange;
CustomExecutableRunConfiguration *m_runConfiguration; CustomExecutableRunConfiguration *m_runConfiguration;
QLineEdit *m_executableLineEdit; Core::Utils::PathChooser *m_executableChooser;
QLineEdit *m_commandLineArgumentsLineEdit; QLineEdit *m_commandLineArgumentsLineEdit;
QLineEdit *m_workingDirectoryLineEdit; Core::Utils::PathChooser *m_workingDirectory;
}; };
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment