void MainWindow::setWorkingDirectory(QString dir) { workingDirectory = QDir(dir); emit workingDirectoryChanged(dir); }
QbsRunConfigurationWidget::QbsRunConfigurationWidget(QbsRunConfiguration *rc, QWidget *parent) : QWidget(parent), m_rc(rc), m_ignoreChange(false), m_isShown(false) { QVBoxLayout *vboxTopLayout = new QVBoxLayout(this); vboxTopLayout->setMargin(0); QHBoxLayout *hl = new QHBoxLayout(); hl->addStretch(); m_disabledIcon = new QLabel(this); m_disabledIcon->setPixmap(QPixmap(QLatin1String(":/projectexplorer/images/compile_warning.png"))); hl->addWidget(m_disabledIcon); m_disabledReason = new QLabel(this); m_disabledReason->setVisible(false); hl->addWidget(m_disabledReason); hl->addStretch(); vboxTopLayout->addLayout(hl); m_detailsContainer = new Utils::DetailsWidget(this); m_detailsContainer->setState(Utils::DetailsWidget::NoSummary); vboxTopLayout->addWidget(m_detailsContainer); QWidget *detailsWidget = new QWidget(m_detailsContainer); m_detailsContainer->setWidget(detailsWidget); QFormLayout *toplayout = new QFormLayout(detailsWidget); toplayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); toplayout->setMargin(0); m_executableLineEdit = new QLineEdit(this); m_executableLineEdit->setEnabled(false); m_executableLineEdit->setPlaceholderText(tr("<unknown>")); toplayout->addRow(tr("Executable:"), m_executableLineEdit); QLabel *argumentsLabel = new QLabel(tr("Arguments:"), this); m_argumentsLineEdit = new QLineEdit(m_rc->rawCommandLineArguments(), this); argumentsLabel->setBuddy(m_argumentsLineEdit); toplayout->addRow(argumentsLabel, m_argumentsLineEdit); m_workingDirectoryEdit = new Utils::PathChooser(this); m_workingDirectoryEdit->setHistoryCompleter(QLatin1String("Qbs.WorkingDir.History")); m_workingDirectoryEdit->setExpectedKind(Utils::PathChooser::Directory); ProjectExplorer::EnvironmentAspect *aspect = m_rc->extraAspect<ProjectExplorer::EnvironmentAspect>(); if (aspect) { connect(aspect, SIGNAL(environmentChanged()), this, SLOT(environmentWasChanged())); environmentWasChanged(); } m_workingDirectoryEdit->setPromptDialogTitle(tr("Select Working Directory")); QToolButton *resetButton = new QToolButton(this); resetButton->setToolTip(tr("Reset to default")); resetButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_RESET))); QHBoxLayout *boxlayout = new QHBoxLayout(); boxlayout->setMargin(0); boxlayout->addWidget(m_workingDirectoryEdit); boxlayout->addWidget(resetButton); toplayout->addRow(tr("Working directory:"), boxlayout); QHBoxLayout *innerBox = new QHBoxLayout(); m_useTerminalCheck = new QCheckBox(tr("Run in terminal"), this); innerBox->addWidget(m_useTerminalCheck); innerBox->addStretch(); toplayout->addRow(QString(), innerBox); runConfigurationEnabledChange(); connect(m_workingDirectoryEdit, SIGNAL(changed(QString)), this, SLOT(workDirectoryEdited())); connect(resetButton, SIGNAL(clicked()), this, SLOT(workingDirectoryWasReset())); connect(m_argumentsLineEdit, SIGNAL(textEdited(QString)), this, SLOT(argumentsEdited(QString))); connect(m_useTerminalCheck, SIGNAL(toggled(bool)), this, SLOT(termToggled(bool))); connect(m_rc, SIGNAL(baseWorkingDirectoryChanged(QString)), this, SLOT(workingDirectoryChanged(QString))); connect(m_rc, SIGNAL(commandLineArgumentsChanged(QString)), this, SLOT(commandLineArgumentsChanged(QString))); connect(m_rc, SIGNAL(runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode)), this, SLOT(runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode))); connect(m_rc, SIGNAL(targetInformationChanged()), this, SLOT(targetInformationHasChanged()), Qt::QueuedConnection); connect(m_rc, SIGNAL(enabledChanged()), this, SLOT(runConfigurationEnabledChange())); }