From 1ff82ca8e45f0ca02d52f31b49f03ba6f66b69bb Mon Sep 17 00:00:00 2001 From: Tobias Hunger <tobias.hunger@nokia.com> Date: Fri, 26 Nov 2010 17:10:25 +0100 Subject: [PATCH] Remove warning about invalid run configurations Reviewed-by: dt --- .../projectexplorer/buildconfigdialog.cpp | 120 ------------------ .../projectexplorer/buildconfigdialog.h | 73 ----------- .../projectexplorer/projectexplorer.cpp | 32 +---- src/plugins/projectexplorer/projectexplorer.h | 2 - .../projectexplorer/projectexplorer.pro | 2 - 5 files changed, 2 insertions(+), 227 deletions(-) delete mode 100644 src/plugins/projectexplorer/buildconfigdialog.cpp delete mode 100644 src/plugins/projectexplorer/buildconfigdialog.h diff --git a/src/plugins/projectexplorer/buildconfigdialog.cpp b/src/plugins/projectexplorer/buildconfigdialog.cpp deleted file mode 100644 index 32e018ec458..00000000000 --- a/src/plugins/projectexplorer/buildconfigdialog.cpp +++ /dev/null @@ -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 diff --git a/src/plugins/projectexplorer/buildconfigdialog.h b/src/plugins/projectexplorer/buildconfigdialog.h deleted file mode 100644 index a3e4066badd..00000000000 --- a/src/plugins/projectexplorer/buildconfigdialog.h +++ /dev/null @@ -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 diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index e9e0a77e436..027e3991557 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -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()) - return; - } + 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(); diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h index 324a9049f5d..031f3dc7cd7 100644 --- a/src/plugins/projectexplorer/projectexplorer.h +++ b/src/plugins/projectexplorer/projectexplorer.h @@ -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); diff --git a/src/plugins/projectexplorer/projectexplorer.pro b/src/plugins/projectexplorer/projectexplorer.pro index 11b3873315d..33364198821 100644 --- a/src/plugins/projectexplorer/projectexplorer.pro +++ b/src/plugins/projectexplorer/projectexplorer.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 \ -- GitLab