forked from qt-creator/qt-creator
Remove warning about invalid run configurations
Reviewed-by: dt
This commit is contained in:
@@ -1,120 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "buildconfigdialog.h"
|
||||
#include "project.h"
|
||||
#include "runconfiguration.h"
|
||||
#include "buildconfiguration.h"
|
||||
#include "target.h"
|
||||
|
||||
#include <QtGui/QVBoxLayout>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QDialogButtonBox>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QFormLayout>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
namespace Internal {
|
||||
|
||||
BuildConfigDialog::BuildConfigDialog(Project *project, QWidget *parent)
|
||||
: QDialog(parent),
|
||||
m_project(project)
|
||||
{
|
||||
QVBoxLayout *vlayout = new QVBoxLayout;
|
||||
setLayout(vlayout);
|
||||
QDialogButtonBox *buttonBox = new QDialogButtonBox;
|
||||
m_changeBuildConfiguration = buttonBox->addButton(tr("Change build configuration && continue"),
|
||||
QDialogButtonBox::ActionRole);
|
||||
m_cancel = buttonBox->addButton(tr("Cancel"),
|
||||
QDialogButtonBox::RejectRole);
|
||||
m_justContinue = buttonBox->addButton(tr("Continue anyway"),
|
||||
QDialogButtonBox::AcceptRole);
|
||||
connect(m_changeBuildConfiguration, SIGNAL(clicked()), this, SLOT(buttonClicked()));
|
||||
connect(m_cancel, SIGNAL(clicked()), this, SLOT(buttonClicked()));
|
||||
connect(m_justContinue, SIGNAL(clicked()), this, SLOT(buttonClicked()));
|
||||
setWindowTitle(tr("Run configuration does not match build configuration"));
|
||||
QLabel *shortText = new QLabel(tr(
|
||||
"The active build configuration builds a target "
|
||||
"that cannot be used by the active run configuration."
|
||||
));
|
||||
vlayout->addWidget(shortText);
|
||||
QLabel *descriptiveText = new QLabel(tr(
|
||||
"This can happen if the active build configuration "
|
||||
"uses the wrong Qt version and/or tool chain for the active run configuration "
|
||||
"(for example, running in Symbian emulator requires building with the WINSCW tool chain)."
|
||||
));
|
||||
descriptiveText->setWordWrap(true);
|
||||
vlayout->addWidget(descriptiveText);
|
||||
m_configCombo = new QComboBox;
|
||||
|
||||
RunConfiguration *activeRun = m_project->activeTarget()->activeRunConfiguration();
|
||||
foreach (BuildConfiguration *config, m_project->activeTarget()->buildConfigurations()) {
|
||||
if (activeRun->isEnabled(config)) {
|
||||
m_configCombo->addItem(config->displayName(), QVariant::fromValue(config));
|
||||
}
|
||||
}
|
||||
if (m_configCombo->count() == 0) {
|
||||
m_configCombo->addItem(tr("No valid build configuration found."));
|
||||
m_configCombo->setEnabled(false);
|
||||
m_changeBuildConfiguration->setEnabled(false);
|
||||
}
|
||||
|
||||
QFormLayout *formlayout = new QFormLayout;
|
||||
formlayout->addRow(tr("Active run configuration"),
|
||||
// ^ avoiding a new translatable string for active run configuration
|
||||
new QLabel(activeRun->displayName()));
|
||||
formlayout->addRow(tr("Choose build configuration:"), m_configCombo);
|
||||
vlayout->addLayout(formlayout);
|
||||
vlayout->addWidget(buttonBox);
|
||||
m_cancel->setDefault(true);
|
||||
}
|
||||
|
||||
BuildConfiguration *BuildConfigDialog::selectedBuildConfiguration() const
|
||||
{
|
||||
int index = m_configCombo->currentIndex();
|
||||
if (index < 0)
|
||||
return 0;
|
||||
return m_configCombo->itemData(index, Qt::UserRole).value<BuildConfiguration*>();
|
||||
}
|
||||
|
||||
void BuildConfigDialog::buttonClicked()
|
||||
{
|
||||
QPushButton *button = qobject_cast<QPushButton *>(sender());
|
||||
if (button == m_changeBuildConfiguration) {
|
||||
done(ChangeBuild);
|
||||
} else if (button == m_cancel) {
|
||||
done(Cancel);
|
||||
} else if (button == m_justContinue) {
|
||||
done(Continue);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ProjectExplorer
|
||||
@@ -1,73 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef BUILDCONFIGDIALOG_H
|
||||
#define BUILDCONFIGDIALOG_H
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAction;
|
||||
class QComboBox;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class Project;
|
||||
class BuildConfiguration;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class BuildConfigDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum DialogResult {
|
||||
ChangeBuild = 10,
|
||||
Cancel = 11,
|
||||
Continue = 12
|
||||
};
|
||||
explicit BuildConfigDialog(Project *project, QWidget *parent = 0);
|
||||
|
||||
BuildConfiguration *selectedBuildConfiguration() const;
|
||||
|
||||
private slots:
|
||||
void buttonClicked();
|
||||
|
||||
private:
|
||||
Project *m_project;
|
||||
QPushButton *m_changeBuildConfiguration;
|
||||
QPushButton *m_cancel;
|
||||
QPushButton *m_justContinue;
|
||||
QComboBox *m_configCombo;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
#endif // BUILDCONFIGDIALOG_H
|
||||
@@ -73,7 +73,6 @@
|
||||
#include "projectwelcomepagewidget.h"
|
||||
#include "corelistenercheckingforrunningbuild.h"
|
||||
#include "buildconfiguration.h"
|
||||
#include "buildconfigdialog.h"
|
||||
#include "miniprojecttargetselector.h"
|
||||
#include "taskhub.h"
|
||||
#include "publishing/ipublishingwizardfactory.h"
|
||||
@@ -1749,10 +1748,8 @@ void ProjectExplorerPlugin::runProject(Project *pro, QString mode)
|
||||
if (!pro)
|
||||
return;
|
||||
|
||||
if (!pro->activeTarget()->activeRunConfiguration()->isEnabled()) {
|
||||
if (!showBuildConfigDialog())
|
||||
if (!pro->activeTarget()->activeRunConfiguration()->isEnabled())
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList stepIds;
|
||||
if (d->m_projectExplorerSettings.deployBeforeRun) {
|
||||
@@ -1776,31 +1773,6 @@ void ProjectExplorerPlugin::runProject(Project *pro, QString mode)
|
||||
emit updateRunActions();
|
||||
}
|
||||
|
||||
bool ProjectExplorerPlugin::showBuildConfigDialog()
|
||||
{
|
||||
Project *pro = startupProject();
|
||||
BuildConfigDialog *dialog = new BuildConfigDialog(pro,
|
||||
Core::ICore::instance()->mainWindow());
|
||||
dialog->exec();
|
||||
BuildConfiguration *otherConfig = dialog->selectedBuildConfiguration();
|
||||
int result = dialog->result();
|
||||
dialog->deleteLater();
|
||||
switch (result) {
|
||||
case BuildConfigDialog::ChangeBuild:
|
||||
if (otherConfig) {
|
||||
pro->activeTarget()->setActiveBuildConfiguration(otherConfig);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case BuildConfigDialog::Cancel:
|
||||
return false;
|
||||
case BuildConfigDialog::Continue:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::runControlFinished()
|
||||
{
|
||||
emit updateRunActions();
|
||||
|
||||
@@ -234,8 +234,6 @@ private:
|
||||
bool hasBuildSettings(Project *pro);
|
||||
bool hasDeploySettings(Project *pro);
|
||||
|
||||
bool showBuildConfigDialog();
|
||||
|
||||
void setCurrent(Project *project, QString filePath, Node *node);
|
||||
|
||||
QStringList allFilesWithDependencies(Project *pro);
|
||||
|
||||
@@ -85,7 +85,6 @@ HEADERS += projectexplorer.h \
|
||||
targetsettingswidget.h \
|
||||
doubletabwidget.h \
|
||||
buildenvironmentwidget.h \
|
||||
buildconfigdialog.h \
|
||||
ldparser.h \
|
||||
linuxiccparser.h \
|
||||
outputformatter.h \
|
||||
@@ -170,7 +169,6 @@ SOURCES += projectexplorer.cpp \
|
||||
targetsettingswidget.cpp \
|
||||
doubletabwidget.cpp \
|
||||
buildenvironmentwidget.cpp \
|
||||
buildconfigdialog.cpp \
|
||||
ldparser.cpp \
|
||||
linuxiccparser.cpp \
|
||||
outputformatter.cpp \
|
||||
|
||||
Reference in New Issue
Block a user