Commit f66df7b9 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Header cleanup in ProjectExplorer and Qt4ProjectManager

parent 5cf8673c
/**************************************************************************
**
** 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 <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
/**************************************************************************
**
** 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
......@@ -67,6 +67,7 @@
#include "projectwelcomepagewidget.h"
#include "corelistenercheckingforrunningbuild.h"
#include "buildconfiguration.h"
#include "buildconfigdialog.h"
#include "miniprojecttargetselector.h"
#include <coreplugin/basemode.h>
......@@ -102,7 +103,6 @@
#include <QtGui/QFileDialog>
#include <QtGui/QMenu>
#include <QtGui/QMessageBox>
#include <QtGui/QVBoxLayout>
Q_DECLARE_METATYPE(Core::IEditorFactory*);
Q_DECLARE_METATYPE(Core::IExternalEditor*);
......@@ -2198,77 +2198,4 @@ Internal::ProjectExplorerSettings ProjectExplorerPlugin::projectExplorerSettings
return d->m_projectExplorerSettings;
}
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);
}
}
Q_EXPORT_PLUGIN(ProjectExplorerPlugin)
......@@ -34,14 +34,10 @@
#include <extensionsystem/iplugin.h>
#include <QtCore/QSharedPointer>
#include <QtGui/QDialog>
QT_BEGIN_NAMESPACE
class QPoint;
class QAction;
class QComboBox;
class QMenu;
class QAction;
QT_END_NAMESPACE
namespace Core {
......@@ -65,32 +61,7 @@ class BuildConfiguration;
namespace Internal {
class ProjectFileFactory;
struct ProjectExplorerSettings;
class BuildConfigDialog : public QDialog
{
Q_OBJECT
public:
enum DialogResult {
ChangeBuild = 10,
Cancel = 11,
Continue = 12
};
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
}
struct ProjectExplorerPluginPrivate;
......
......@@ -76,7 +76,8 @@ HEADERS += projectexplorer.h \
targetsettingswidget.h \
doubletabwidget.h \
addtargetdialog.h \
buildenvironmentwidget.h
buildenvironmentwidget.h \
buildconfigdialog.h
SOURCES += projectexplorer.cpp \
projectwindow.cpp \
buildmanager.cpp \
......@@ -139,7 +140,8 @@ SOURCES += projectexplorer.cpp \
targetsettingswidget.cpp \
doubletabwidget.cpp \
addtargetdialog.cpp \
buildenvironmentwidget.cpp
buildenvironmentwidget.cpp \
buildconfigdialog.cpp
FORMS += processstep.ui \
editorsettingspropertiespage.ui \
runsettingspropertiespage.ui \
......
......@@ -28,6 +28,7 @@
**************************************************************************/
#include "makestep.h"
#include "ui_makestep.h"
#include "qt4project.h"
#include "qt4target.h"
......@@ -35,6 +36,8 @@
#include "qt4projectmanagerconstants.h"
#include <projectexplorer/gnumakeparser.h>
#include <projectexplorer/projectexplorer.h>
#include <extensionsystem/pluginmanager.h>
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
......@@ -206,12 +209,12 @@ void MakeStep::setUserArguments(const QStringList &arguments)
}
MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
: BuildStepConfigWidget(), m_makeStep(makeStep), m_ignoreChange(false)
: BuildStepConfigWidget(), m_ui(new Ui::MakeStep), m_makeStep(makeStep), m_ignoreChange(false)
{
m_ui.setupUi(this);
connect(m_ui.makeLineEdit, SIGNAL(textEdited(QString)),
m_ui->setupUi(this);
connect(m_ui->makeLineEdit, SIGNAL(textEdited(QString)),
this, SLOT(makeEdited()));
connect(m_ui.makeArgumentsLineEdit, SIGNAL(textEdited(QString)),
connect(m_ui->makeArgumentsLineEdit, SIGNAL(textEdited(QString)),
this, SLOT(makeArgumentsLineEdited()));
connect(makeStep, SIGNAL(userArgumentsChanged()),
......@@ -225,10 +228,15 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
this, SLOT(updateDetails()));
}
MakeStepConfigWidget::~MakeStepConfigWidget()
{
delete m_ui;
}
void MakeStepConfigWidget::updateMakeOverrideLabel()
{
Qt4BuildConfiguration *qt4bc = m_makeStep->qt4BuildConfiguration();
m_ui.makeLabel->setText(tr("Override %1:").arg(qt4bc->makeCommand()));
m_ui->makeLabel->setText(tr("Override %1:").arg(qt4bc->makeCommand()));
}
void MakeStepConfigWidget::updateDetails()
......@@ -284,7 +292,7 @@ void MakeStepConfigWidget::userArgumentsChanged()
if (m_ignoreChange)
return;
const QStringList &makeArguments = m_makeStep->userArguments();
m_ui.makeArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(makeArguments));
m_ui->makeArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(makeArguments));
updateDetails();
}
......@@ -293,16 +301,16 @@ void MakeStepConfigWidget::init()
updateMakeOverrideLabel();
const QString &makeCmd = m_makeStep->m_makeCmd;
m_ui.makeLineEdit->setText(makeCmd);
m_ui->makeLineEdit->setText(makeCmd);
const QStringList &makeArguments = m_makeStep->userArguments();
m_ui.makeArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(makeArguments));
m_ui->makeArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(makeArguments));
updateDetails();
}
void MakeStepConfigWidget::makeEdited()
{
m_makeStep->m_makeCmd = m_ui.makeLineEdit->text();
m_makeStep->m_makeCmd = m_ui->makeLineEdit->text();
updateDetails();
}
......@@ -310,7 +318,7 @@ void MakeStepConfigWidget::makeArgumentsLineEdited()
{
m_ignoreChange = true;
m_makeStep->setUserArguments(
ProjectExplorer::Environment::parseCombinedArgString(m_ui.makeArgumentsLineEdit->text()));
ProjectExplorer::Environment::parseCombinedArgString(m_ui->makeArgumentsLineEdit->text()));
m_ignoreChange = false;
updateDetails();
}
......
......@@ -30,11 +30,14 @@
#ifndef MAKESTEP_H
#define MAKESTEP_H
#include "ui_makestep.h"
#include "qtversionmanager.h"
#include <projectexplorer/abstractprocessstep.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/buildstep.h>
QT_BEGIN_NAMESPACE
namespace Ui {
class MakeStep;
}
QT_END_NAMESPACE
namespace ProjectExplorer {
class BuildStep;
......@@ -110,7 +113,9 @@ class MakeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
{
Q_OBJECT
public:
MakeStepConfigWidget(MakeStep *makeStep);
explicit MakeStepConfigWidget(MakeStep *makeStep);
virtual ~MakeStepConfigWidget();
QString displayName() const;
void init();
QString summaryText() const;
......@@ -123,7 +128,7 @@ private slots:
void updateDetails();
void userArgumentsChanged();
private:
Ui::MakeStep m_ui;
Ui::MakeStep *m_ui;
MakeStep *m_makeStep;
QString m_summaryText;
bool m_ignoreChange;
......
......@@ -36,6 +36,7 @@
#include <projectexplorer/runconfiguration.h>
#include <QtCore/QDateTime>
#include <QtCore/QStringList>
QT_FORWARD_DECLARE_CLASS(QProcess)
QT_FORWARD_DECLARE_CLASS(QWidget)
......
......@@ -54,6 +54,7 @@
#include <QtGui/QMessageBox>
#include <QtGui/QMainWindow>
#include <QtCore/QCoreApplication>
using namespace ProjectExplorer;
using namespace Qt4ProjectManager;
......
......@@ -47,7 +47,9 @@
#include <projectexplorer/persistentsettings.h>
#include <QtGui/QLabel>
#include <QtGui/QVBoxLayout>
#include <QtGui/QLineEdit>
#include <QtGui/QFormLayout>
using namespace ProjectExplorer;
using namespace Qt4ProjectManager;
......
......@@ -32,6 +32,9 @@
#include "qt4project.h"
#include "qt4target.h"
#include "qt4projectmanagerconstants.h"
#include "qt4nodes.h"
#include "qmakestep.h"
#include "makestep.h"
#include <utils/qtcassert.h>
......
......@@ -34,7 +34,6 @@
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/toolchain.h>
#include "qt4nodes.h"
namespace Qt4ProjectManager {
......@@ -42,7 +41,7 @@ class QMakeStep;
class MakeStep;
namespace Internal {
class Qt4ProFileNode;
class Qt4BuildConfigurationFactory;
class Qt4Target;
......
......@@ -58,6 +58,7 @@
#include <QtCore/QDir>
#include <QtCore/QFile>
#include <QtCore/QFileInfo>
#include <QtCore/QCoreApplication>
#include <QtGui/QPainter>
#include <QtGui/QMainWindow>
......
......@@ -45,6 +45,7 @@
#include <coreplugin/coreconstants.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <projectexplorer/buildenvironmentwidget.h>
#include <projectexplorer/customexecutablerunconfiguration.h>
#include <projectexplorer/nodesvisitor.h>
......
......@@ -30,28 +30,18 @@
#ifndef QT4PROJECT_H
#define QT4PROJECT_H
#include "profileevaluator.h"
#include "qt4nodes.h"
#include "qt4target.h"
#include "qmakestep.h"
#include "makestep.h"
#include "qtversionmanager.h"
#include <coreplugin/ifile.h>
#include <projectexplorer/applicationrunconfiguration.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectnodes.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/buildconfiguration.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <coreplugin/ifile.h>
#include <QtCore/QObject>
#include <QtCore/QList>
#include <QtCore/QStringList>
#include <QtCore/QPointer>
#include <QtCore/QMap>
#include <QtGui/QDirModel>
#include <QtCore/QFutureInterface>
#include <QtCore/QTimer>
#include <QtCore/QFuture>
QT_BEGIN_NAMESPACE
struct ProFileOption;
......@@ -64,11 +54,13 @@ namespace Internal {
class DeployHelperRunStep;
class FileItem;
class Qt4ProFileNode;
class Qt4PriFileNode;
class Qt4RunConfiguration;
class GCCPreprocessor;
struct Qt4ProjectFiles;
class Qt4ProjectConfigWidget;
class Qt4Target;
class Qt4NodesWatcher;
class CodeModelInfo
{
......
......@@ -45,6 +45,8 @@
#include <extensionsystem/pluginmanager.h>