forked from qt-creator/qt-creator
ProjectExplorer: Use BuildConfiguration instead of Target
... in AddRunConfigDialog. Change-Id: I1a8f2ddaafaa345b157634a1a0391688bb5a372b Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -3,9 +3,9 @@
|
||||
|
||||
#include "addrunconfigdialog.h"
|
||||
|
||||
#include "buildconfiguration.h"
|
||||
#include "project.h"
|
||||
#include "projectexplorertr.h"
|
||||
#include "target.h"
|
||||
|
||||
#include <utils/itemviews.h>
|
||||
#include <utils/fancylineedit.h>
|
||||
@@ -30,9 +30,9 @@ const Qt::ItemDataRole IsCustomRole = Qt::UserRole;
|
||||
class CandidateTreeItem : public TreeItem
|
||||
{
|
||||
public:
|
||||
CandidateTreeItem(const RunConfigurationCreationInfo &rci, const Target *target)
|
||||
: m_creationInfo(rci), m_projectRoot(target->project()->projectDirectory()),
|
||||
m_displayName(target->macroExpander()->expand(rci.displayName))
|
||||
CandidateTreeItem(const RunConfigurationCreationInfo &rci, const BuildConfiguration *bc)
|
||||
: m_creationInfo(rci), m_projectRoot(bc->project()->projectDirectory()),
|
||||
m_displayName(bc->macroExpander()->expand(rci.displayName))
|
||||
{ }
|
||||
|
||||
RunConfigurationCreationInfo creationInfo() const { return m_creationInfo; }
|
||||
@@ -64,12 +64,12 @@ private:
|
||||
class CandidatesModel : public TreeModel<TreeItem, CandidateTreeItem>
|
||||
{
|
||||
public:
|
||||
CandidatesModel(Target *target, QObject *parent) : TreeModel(parent)
|
||||
CandidatesModel(BuildConfiguration *bc, QObject *parent) : TreeModel(parent)
|
||||
{
|
||||
setHeader({Tr::tr("Name"), Tr::tr("Source")});
|
||||
for (const RunConfigurationCreationInfo &rci
|
||||
: RunConfigurationFactory::creatorsForTarget(target)) {
|
||||
rootItem()->appendChild(new CandidateTreeItem(rci, target));
|
||||
: RunConfigurationFactory::creatorsForTarget(bc->target())) {
|
||||
rootItem()->appendChild(new CandidateTreeItem(rci, bc));
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -108,11 +108,11 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
AddRunConfigDialog::AddRunConfigDialog(Target *target, QWidget *parent)
|
||||
AddRunConfigDialog::AddRunConfigDialog(BuildConfiguration *bc, QWidget *parent)
|
||||
: QDialog(parent), m_view(new CandidatesTreeView(this))
|
||||
{
|
||||
setWindowTitle(Tr::tr("Create Run Configuration"));
|
||||
const auto model = new CandidatesModel(target, this);
|
||||
const auto model = new CandidatesModel(bc, this);
|
||||
const auto proxyModel = new ProxyModel(this);
|
||||
proxyModel->setSourceModel(model);
|
||||
const auto filterEdit = new FancyLineEdit(this);
|
||||
|
@@ -9,16 +9,13 @@
|
||||
|
||||
namespace Utils { class TreeView; }
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class Target;
|
||||
|
||||
namespace Internal {
|
||||
namespace ProjectExplorer::Internal {
|
||||
|
||||
class AddRunConfigDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AddRunConfigDialog(Target *target, QWidget *parent);
|
||||
AddRunConfigDialog(BuildConfiguration *bc, QWidget *parent);
|
||||
|
||||
RunConfigurationCreationInfo creationInfo() const { return m_creationInfo; }
|
||||
|
||||
@@ -29,5 +26,4 @@ private:
|
||||
RunConfigurationCreationInfo m_creationInfo;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ProjectExplorer
|
||||
} // namespace ProjectExplorer::Internal
|
||||
|
@@ -157,7 +157,7 @@ RunSettingsWidget::RunSettingsWidget(Target *target) :
|
||||
|
||||
void RunSettingsWidget::showAddRunConfigDialog()
|
||||
{
|
||||
AddRunConfigDialog dlg(m_target, this);
|
||||
AddRunConfigDialog dlg(m_target->activeBuildConfiguration(), this);
|
||||
if (dlg.exec() != QDialog::Accepted)
|
||||
return;
|
||||
RunConfigurationCreationInfo rci = dlg.creationInfo();
|
||||
|
Reference in New Issue
Block a user