forked from qt-creator/qt-creator
Reintroduced a way to edit project dependencies
Dependencies between projects can now be edited in the Projects mode. You can simply check for each project the projects that it depends on, and they will be built first. A message box pops up when you try to create a circular dependency. Could use some testing.
This commit is contained in:
@@ -563,7 +563,7 @@ TextEditor::ITextEditor *BookmarkManager::currentTextEditor() const
|
||||
}
|
||||
|
||||
/* Returns the current session. */
|
||||
SessionManager* BookmarkManager::sessionManager() const
|
||||
SessionManager *BookmarkManager::sessionManager() const
|
||||
{
|
||||
ExtensionSystem::PluginManager *pm = m_core->pluginManager();
|
||||
ProjectExplorerPlugin *pe = pm->getObject<ProjectExplorerPlugin>();
|
||||
|
@@ -215,11 +215,6 @@ ProjectExplorer::IProjectManager *CMakeProject::projectManager() const
|
||||
return m_manager;
|
||||
}
|
||||
|
||||
QList<Core::IFile *> CMakeProject::dependencies()
|
||||
{
|
||||
return QList<Core::IFile *>();
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::Project *> CMakeProject::dependsOn()
|
||||
{
|
||||
return QList<Project *>();
|
||||
|
@@ -73,7 +73,6 @@ public:
|
||||
virtual Core::IFile *file() const;
|
||||
virtual ProjectExplorer::IProjectManager *projectManager() const;
|
||||
|
||||
virtual QList<Core::IFile *> dependencies(); //NBS TODO remove
|
||||
virtual QList<ProjectExplorer::Project *> dependsOn(); //NBS TODO implement dependsOn
|
||||
|
||||
virtual bool isApplication() const;
|
||||
|
@@ -66,7 +66,7 @@ class PROJECTEXPLORER_EXPORT IBuildParserFactory
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
IBuildParserFactory() {};
|
||||
IBuildParserFactory() {}
|
||||
virtual ~IBuildParserFactory();
|
||||
virtual bool canCreate(const QString & name) const = 0;
|
||||
virtual BuildParserInterface * create(const QString & name) const = 0;
|
||||
|
@@ -1,245 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#include "dependenciesdialog.h"
|
||||
#include "project.h"
|
||||
#include "session.h"
|
||||
|
||||
#include <QtCore/QVector>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QAbstractTableModel>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QHeaderView>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
namespace Internal {
|
||||
|
||||
// ------ DependencyModel
|
||||
|
||||
class DependencyModel : public QAbstractTableModel {
|
||||
public:
|
||||
typedef ProjectExplorer::Project Project;
|
||||
typedef DependenciesDialog::ProjectList ProjectList;
|
||||
|
||||
DependencyModel(SessionManager *sln, const ProjectList &projectList, QObject * parent = 0);
|
||||
|
||||
virtual int rowCount(const QModelIndex&) const { return m_projects.size(); }
|
||||
virtual int columnCount(const QModelIndex&) const { return m_projects.size(); }
|
||||
|
||||
virtual QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const;
|
||||
bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
|
||||
|
||||
virtual Qt::ItemFlags flags ( const QModelIndex & index ) const;
|
||||
|
||||
QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
|
||||
|
||||
// Apply changed items
|
||||
unsigned apply(SessionManager *sln) const;
|
||||
|
||||
void resetDependencies();
|
||||
|
||||
private:
|
||||
|
||||
struct Entry {
|
||||
Entry(SessionManager *sln, Project *rootProject, Project *dependentProject);
|
||||
Entry() : m_dependentProject(0), m_dependent(false), m_defaultValue(false), m_canAddDependency(false) {}
|
||||
Project* m_dependentProject;
|
||||
bool m_dependent;
|
||||
bool m_defaultValue;
|
||||
bool m_canAddDependency;
|
||||
};
|
||||
|
||||
// column
|
||||
typedef QVector<Entry> ProjectDependencies;
|
||||
typedef QList<ProjectDependencies> Projects;
|
||||
Projects m_projects;
|
||||
ProjectList m_projectList;
|
||||
};
|
||||
|
||||
DependencyModel::Entry::Entry(SessionManager *sln,
|
||||
Project *rootProject,
|
||||
Project *dependentProject) :
|
||||
m_dependentProject(dependentProject),
|
||||
m_dependent(sln->hasDependency(rootProject, dependentProject)),
|
||||
m_defaultValue(m_dependent),
|
||||
m_canAddDependency(sln->canAddDependency(rootProject, dependentProject))
|
||||
{
|
||||
}
|
||||
|
||||
DependencyModel::DependencyModel(SessionManager *sln,
|
||||
const ProjectList &projectList,
|
||||
QObject * parent) :
|
||||
QAbstractTableModel(parent),
|
||||
m_projectList(projectList)
|
||||
{
|
||||
const int count = projectList.size();
|
||||
for (int p = 0; p < count; p++) {
|
||||
Project *rootProject = projectList.at(p);
|
||||
ProjectDependencies dependencies;
|
||||
dependencies.reserve(count);
|
||||
for (int d = 0; d < count ; d++)
|
||||
dependencies.push_back(p == d ? Entry() : Entry(sln, rootProject, projectList.at(d)));
|
||||
|
||||
m_projects += dependencies;
|
||||
}
|
||||
}
|
||||
|
||||
QVariant DependencyModel::data ( const QModelIndex & index, int role ) const
|
||||
{
|
||||
static const QVariant empty = QVariant(QString());
|
||||
// TO DO: find a checked icon
|
||||
static const QVariant checked = QVariant(QString(QLatin1Char('x')));
|
||||
|
||||
const int p = index.column();
|
||||
const int d = index.row();
|
||||
switch (role) {
|
||||
case Qt::EditRole:
|
||||
return QVariant(m_projects[p][d].m_dependent);
|
||||
case Qt::DisplayRole:
|
||||
return m_projects[p][d].m_dependent ? checked : empty;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
bool DependencyModel::setData ( const QModelIndex & index, const QVariant & value, int role)
|
||||
{
|
||||
switch (role) {
|
||||
case Qt::EditRole: {
|
||||
const int p = index.column();
|
||||
const int d = index.row();
|
||||
if (d == p)
|
||||
return false;
|
||||
Entry &e(m_projects[p][d]);
|
||||
e.m_dependent = value.toBool();
|
||||
emit dataChanged(index, index);
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Qt::ItemFlags DependencyModel::flags ( const QModelIndex & index ) const
|
||||
{
|
||||
const int p = index.column();
|
||||
const int d = index.row();
|
||||
|
||||
if (d == p)
|
||||
return 0;
|
||||
|
||||
const Entry &e(m_projects[p][d]);
|
||||
Qt::ItemFlags rc = Qt::ItemIsEnabled|Qt::ItemIsUserCheckable | Qt::ItemIsSelectable;
|
||||
if (e.m_canAddDependency)
|
||||
rc |= Qt::ItemIsEditable;
|
||||
return rc;
|
||||
}
|
||||
|
||||
QVariant DependencyModel::headerData ( int section, Qt::Orientation , int role ) const
|
||||
{
|
||||
switch (role) {
|
||||
case Qt::DisplayRole:
|
||||
return QVariant(m_projectList.at(section)->name());
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
void DependencyModel::resetDependencies()
|
||||
{
|
||||
if (const int count = m_projectList.size()) {
|
||||
for (int p = 0; p < count; p++)
|
||||
for (int d = 0; d < count; d++)
|
||||
m_projects[p][d].m_dependent = false;
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
unsigned DependencyModel::apply(SessionManager *sln) const
|
||||
{
|
||||
unsigned rc = 0;
|
||||
const int count = m_projectList.size();
|
||||
for (int p = 0; p < count; p++) {
|
||||
Project *rootProject = m_projectList.at(p);
|
||||
for (int d = 0; d < count; d++) {
|
||||
if (d != p) {
|
||||
const Entry &e(m_projects[p][d]);
|
||||
if (e.m_dependent != e. m_defaultValue) {
|
||||
rc++;
|
||||
if (e.m_dependent) {
|
||||
sln->addDependency(rootProject, e.m_dependentProject);
|
||||
} else {
|
||||
sln->removeDependency(rootProject, e.m_dependentProject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
// ------ DependenciesDialog
|
||||
DependenciesDialog::DependenciesDialog(QWidget *parent, SessionManager *sln) :
|
||||
QDialog(parent),
|
||||
m_sln(sln),
|
||||
m_projectList(m_sln->projects()),
|
||||
m_model(new DependencyModel(sln, m_projectList))
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
m_ui.buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
||||
QPushButton *resetButton = m_ui.buttonBox->addButton (QDialogButtonBox::Reset);
|
||||
connect(resetButton, SIGNAL(clicked()), this, SLOT(reset()));
|
||||
|
||||
m_ui.dependencyTable->setModel(m_model);
|
||||
}
|
||||
|
||||
void DependenciesDialog::accept()
|
||||
{
|
||||
m_model->apply(m_sln);
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void DependenciesDialog::reset()
|
||||
{
|
||||
m_model->resetDependencies();
|
||||
}
|
||||
|
||||
DependenciesDialog::~DependenciesDialog()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -1,84 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ProjectExplorer::Internal::DependenciesDialog</class>
|
||||
<widget class="QDialog" name="ProjectExplorer::Internal::DependenciesDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>492</width>
|
||||
<height>435</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Project Dependencies</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTableView" name="dependencyTable">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>ProjectExplorer::Internal::DependenciesDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>142</x>
|
||||
<y>285</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>142</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>ProjectExplorer::Internal::DependenciesDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>142</x>
|
||||
<y>285</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>142</x>
|
||||
<y>155</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
217
src/plugins/projectexplorer/dependenciespanel.cpp
Normal file
217
src/plugins/projectexplorer/dependenciespanel.cpp
Normal file
@@ -0,0 +1,217 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#include "dependenciespanel.h"
|
||||
#include "project.h"
|
||||
#include "session.h"
|
||||
|
||||
#include <coreplugin/fileiconprovider.h>
|
||||
|
||||
#include <QtCore/QVector>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QAbstractListModel>
|
||||
#include <QtGui/QHeaderView>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QPushButton>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
namespace Internal {
|
||||
|
||||
///
|
||||
/// DependenciesModel
|
||||
///
|
||||
|
||||
class DependenciesModel : public QAbstractListModel
|
||||
{
|
||||
public:
|
||||
DependenciesModel(SessionManager *session, Project *project, QObject *parent = 0);
|
||||
|
||||
int rowCount(const QModelIndex &index) const;
|
||||
int columnCount(const QModelIndex &index) const;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
|
||||
private:
|
||||
SessionManager *m_session;
|
||||
Project *m_project;
|
||||
QList<Project *> m_projects;
|
||||
};
|
||||
|
||||
DependenciesModel::DependenciesModel(SessionManager *session,
|
||||
Project *project,
|
||||
QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
, m_session(session)
|
||||
, m_project(project)
|
||||
, m_projects(session->projects())
|
||||
{
|
||||
// We can't select ourselves as a dependency
|
||||
m_projects.removeAll(m_project);
|
||||
}
|
||||
|
||||
int DependenciesModel::rowCount(const QModelIndex &index) const
|
||||
{
|
||||
return index.isValid() ? 0 : m_projects.size();
|
||||
}
|
||||
|
||||
int DependenciesModel::columnCount(const QModelIndex &index) const
|
||||
{
|
||||
return index.isValid() ? 0 : 1;
|
||||
}
|
||||
|
||||
QVariant DependenciesModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
const Project *p = m_projects.at(index.row());
|
||||
|
||||
switch (role) {
|
||||
case Qt::DisplayRole:
|
||||
return p->name();
|
||||
case Qt::CheckStateRole:
|
||||
return m_session->hasDependency(m_project, p) ? Qt::Checked : Qt::Unchecked;
|
||||
case Qt::DecorationRole:
|
||||
return Core::FileIconProvider::instance()->icon(QFileInfo(p->file()->fileName()));
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
|
||||
bool DependenciesModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
qDebug() << index << value << role << value.toBool();
|
||||
|
||||
if (role == Qt::CheckStateRole) {
|
||||
const Project *p = m_projects.at(index.row());
|
||||
const Qt::CheckState c = static_cast<Qt::CheckState>(value.toInt());
|
||||
|
||||
if (c == Qt::Checked) {
|
||||
if (m_session->addDependency(m_project, p)) {
|
||||
emit dataChanged(index, index);
|
||||
return true;
|
||||
} else {
|
||||
QMessageBox::warning(0, tr("Unable to add dependency"),
|
||||
tr("This would create a circular dependency."));
|
||||
}
|
||||
} else if (c == Qt::Unchecked) {
|
||||
if (m_session->hasDependency(m_project, p)) {
|
||||
m_session->removeDependency(m_project, p);
|
||||
emit dataChanged(index, index);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Qt::ItemFlags DependenciesModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
Qt::ItemFlags rc = QAbstractListModel::flags(index);
|
||||
if (index.column() == 0)
|
||||
rc |= Qt::ItemIsUserCheckable | Qt::ItemIsEditable;
|
||||
return rc;
|
||||
}
|
||||
|
||||
///
|
||||
/// DependenciesWidget
|
||||
///
|
||||
|
||||
class DependenciesWidget : public QWidget
|
||||
{
|
||||
public:
|
||||
DependenciesWidget(SessionManager *session, Project *project,
|
||||
QWidget *parent = 0);
|
||||
|
||||
private:
|
||||
Ui::DependenciesWidget m_ui;
|
||||
SessionManager *m_session;
|
||||
DependenciesModel *m_model;
|
||||
};
|
||||
|
||||
DependenciesWidget::DependenciesWidget(SessionManager *session,
|
||||
Project *project,
|
||||
QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_session(session)
|
||||
, m_model(new DependenciesModel(session, project, this))
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
m_ui.dependenciesView->setModel(m_model);
|
||||
m_ui.dependenciesView->setHeaderHidden(true);
|
||||
}
|
||||
|
||||
///
|
||||
/// DependenciesPanel
|
||||
///
|
||||
|
||||
DependenciesPanel::DependenciesPanel(SessionManager *session, Project *project)
|
||||
: PropertiesPanel()
|
||||
, m_widget(new DependenciesWidget(session, project))
|
||||
{
|
||||
}
|
||||
|
||||
DependenciesPanel::~DependenciesPanel()
|
||||
{
|
||||
delete m_widget;
|
||||
}
|
||||
|
||||
QString DependenciesPanel::name() const
|
||||
{
|
||||
return tr("Dependencies");
|
||||
}
|
||||
|
||||
QWidget *DependenciesPanel::widget()
|
||||
{
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
///
|
||||
/// DependenciesPanelFactory
|
||||
///
|
||||
|
||||
DependenciesPanelFactory::DependenciesPanelFactory(SessionManager *session)
|
||||
: m_session(session)
|
||||
{
|
||||
}
|
||||
|
||||
bool DependenciesPanelFactory::supports(Project * /* project */)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
PropertiesPanel *DependenciesPanelFactory::createPanel(Project *project)
|
||||
{
|
||||
return new DependenciesPanel(m_session, project);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ProjectExplorer
|
@@ -34,9 +34,10 @@
|
||||
#ifndef DEPENDENCIESDIALOG_H
|
||||
#define DEPENDENCIESDIALOG_H
|
||||
|
||||
#include "ui_dependenciesdialog.h"
|
||||
#include "iprojectproperties.h"
|
||||
#include "ui_dependenciespanel.h"
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
@@ -45,27 +46,32 @@ class SessionManager;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class DependencyModel;
|
||||
class DependenciesWidget;
|
||||
|
||||
// NBS kill DependenciesDialog?
|
||||
class DependenciesDialog : public QDialog
|
||||
class DependenciesPanelFactory : public IPanelFactory
|
||||
{
|
||||
public:
|
||||
DependenciesPanelFactory(SessionManager *session);
|
||||
|
||||
bool supports(Project *project);
|
||||
PropertiesPanel *createPanel(Project *project);
|
||||
|
||||
private:
|
||||
SessionManager *m_session;
|
||||
};
|
||||
|
||||
|
||||
class DependenciesPanel : public PropertiesPanel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef QList<ProjectExplorer::Project *> ProjectList;
|
||||
|
||||
DependenciesDialog(QWidget *parent, SessionManager *sln);
|
||||
virtual ~DependenciesDialog();
|
||||
|
||||
public slots:
|
||||
virtual void accept();
|
||||
void reset();
|
||||
DependenciesPanel(SessionManager *session, Project *project);
|
||||
~DependenciesPanel();
|
||||
QString name() const;
|
||||
QWidget *widget();
|
||||
|
||||
private:
|
||||
Ui::DependenciesDialog m_ui;
|
||||
SessionManager *m_sln;
|
||||
ProjectList m_projectList;
|
||||
DependencyModel *m_model;
|
||||
DependenciesWidget *m_widget;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
44
src/plugins/projectexplorer/dependenciespanel.ui
Normal file
44
src/plugins/projectexplorer/dependenciespanel.ui
Normal file
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ProjectExplorer::Internal::DependenciesWidget</class>
|
||||
<widget class="QWidget" name="ProjectExplorer::Internal::DependenciesWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>502</width>
|
||||
<height>375</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Project Dependencies</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QTreeView" name="dependenciesView"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Project Dependencies:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@@ -73,7 +73,6 @@ private slots:
|
||||
void currentEncodingChanged(int index);
|
||||
|
||||
private:
|
||||
|
||||
Ui::EditorSettingsPropertiesPage m_ui;
|
||||
Project *m_project;
|
||||
QList<QTextCodec *> m_codecs;
|
||||
|
@@ -39,8 +39,6 @@
|
||||
|
||||
#include <coreplugin/icontext.h>
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class PropertiesPanel;
|
||||
@@ -57,7 +55,7 @@ class PROJECTEXPLORER_EXPORT PropertiesPanel : public Core::IContext
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
virtual void finish() {};
|
||||
virtual void finish() {}
|
||||
virtual QString name() const = 0;
|
||||
|
||||
// IContext
|
||||
|
@@ -46,7 +46,6 @@
|
||||
#include <QtCore/QTextCodec>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using ExtensionSystem::PluginManager;
|
||||
|
||||
Project::Project()
|
||||
: m_activeRunConfiguration(0),
|
||||
@@ -54,6 +53,14 @@ Project::Project()
|
||||
{
|
||||
}
|
||||
|
||||
Project::~Project()
|
||||
{
|
||||
qDeleteAll(m_buildSteps);
|
||||
qDeleteAll(m_cleanSteps);
|
||||
qDeleteAll(m_buildConfigurationValues);
|
||||
delete m_editorConfiguration;
|
||||
}
|
||||
|
||||
void Project::insertBuildStep(int position, BuildStep *step)
|
||||
{
|
||||
m_buildSteps.insert(position, step);
|
||||
@@ -508,14 +515,3 @@ void Project::setDisplayNameFor(const QString &buildConfiguration, const QString
|
||||
}
|
||||
emit buildConfigurationDisplayNameChanged(buildConfiguration);
|
||||
}
|
||||
|
||||
|
||||
Project::~Project()
|
||||
{
|
||||
qDeleteAll(m_buildSteps);
|
||||
qDeleteAll(m_cleanSteps);
|
||||
qDeleteAll(m_buildConfigurationValues);
|
||||
delete m_editorConfiguration;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -31,7 +31,6 @@
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef PROJECT_H
|
||||
#define PROJECT_H
|
||||
|
||||
@@ -50,7 +49,7 @@
|
||||
#include <QtGui/QIcon>
|
||||
|
||||
namespace Core {
|
||||
class IFile;
|
||||
class IFile;
|
||||
}
|
||||
|
||||
namespace ProjectExplorer {
|
||||
@@ -68,8 +67,7 @@ class PROJECTEXPLORER_EXPORT Project
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// Roles to be implemented by all models that are exported
|
||||
// via model()
|
||||
// Roles to be implemented by all models that are exported via model()
|
||||
enum ModelRoles {
|
||||
// Absolute file path
|
||||
FilePathRole = QFileSystemModel::FilePathRole
|
||||
@@ -82,12 +80,11 @@ public:
|
||||
virtual Core::IFile *file() const = 0;
|
||||
virtual IProjectManager *projectManager() const = 0;
|
||||
|
||||
virtual QList<Core::IFile *> dependencies() = 0; //NBS TODO remove
|
||||
virtual QList<Project *> dependsOn() = 0; //NBS TODO implement dependsOn
|
||||
|
||||
virtual bool isApplication() const = 0;
|
||||
|
||||
//Build/Clean Step functions
|
||||
// Build/Clean Step functions
|
||||
QList<BuildStep *> buildSteps() const;
|
||||
void insertBuildStep(int position, BuildStep *step);
|
||||
void removeBuildStep(int position);
|
||||
@@ -97,7 +94,7 @@ public:
|
||||
void insertCleanStep(int position, BuildStep *step);
|
||||
void removeCleanStep(int position);
|
||||
|
||||
//Build configuration
|
||||
// Build configuration
|
||||
void addBuildConfiguration(const QString &name);
|
||||
void removeBuildConfiguration(const QString &name);
|
||||
void copyBuildConfiguration(const QString &source, const QString &dest);
|
||||
@@ -133,8 +130,9 @@ public:
|
||||
virtual BuildStepConfigWidget *createConfigWidget() = 0;
|
||||
virtual QList<BuildStepConfigWidget*> subConfigWidgets();
|
||||
|
||||
// This method is called for new build configurations
|
||||
// You should probably set some default values in this method
|
||||
/* This method is called for new build configurations. You should probably
|
||||
* set some default values in this method.
|
||||
*/
|
||||
virtual void newBuildConfiguration(const QString &buildConfiguration) = 0;
|
||||
|
||||
virtual ProjectNode *rootProjectNode() const = 0;
|
||||
@@ -150,19 +148,22 @@ signals:
|
||||
void buildConfigurationDisplayNameChanged(const QString &buildConfiguraiton);
|
||||
|
||||
protected:
|
||||
// This method is called when the project .user file is saved.
|
||||
// Simply call writer.saveValue() for each value you want to save
|
||||
// Make sure to always call your base class implementation
|
||||
// Note: All the values from the project/buildsteps and buildconfigurations
|
||||
// are automatically stored.
|
||||
/* This method is called when the project .user file is saved. Simply call
|
||||
* writer.saveValue() for each value you want to save. Make sure to always
|
||||
* call your base class implementation.
|
||||
*
|
||||
* Note: All the values from the project/buildsteps and buildconfigurations
|
||||
* are automatically stored.
|
||||
*/
|
||||
virtual void saveSettingsImpl(PersistentSettingsWriter &writer);
|
||||
// This method is called when the project is opened
|
||||
// You can retrieve all the values you saved in saveSettingsImpl()
|
||||
// in this method.
|
||||
|
||||
// Note: This function is also called if there is no .user file
|
||||
// You should probably add some default build and run settings to the project
|
||||
// so that it can be build and run
|
||||
/* This method is called when the project is opened. You can retrieve all
|
||||
* the values you saved in saveSettingsImpl() in this method.
|
||||
*
|
||||
* Note: This function is also called if there is no .user file. You should
|
||||
* probably add some default build and run settings to the project so that
|
||||
* it can be build and run.
|
||||
*/
|
||||
virtual void restoreSettingsImpl(PersistentSettingsReader &reader);
|
||||
|
||||
private:
|
||||
@@ -181,4 +182,4 @@ private:
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
#endif // PROJECTINTERFACE_H
|
||||
#endif // PROJECT_H
|
||||
|
@@ -34,12 +34,13 @@
|
||||
#include "applicationrunconfiguration.h"
|
||||
#include "allprojectsfilter.h"
|
||||
#include "allprojectsfind.h"
|
||||
#include "currentprojectfind.h"
|
||||
#include "buildmanager.h"
|
||||
#include "buildsettingspropertiespage.h"
|
||||
#include "editorsettingspropertiespage.h"
|
||||
#include "currentprojectfind.h"
|
||||
#include "currentprojectfilter.h"
|
||||
#include "customexecutablerunconfiguration.h"
|
||||
#include "editorsettingspropertiespage.h"
|
||||
#include "dependenciespanel.h"
|
||||
#include "foldernavigationwidget.h"
|
||||
#include "iprojectmanager.h"
|
||||
#include "metatypedeclarations.h"
|
||||
@@ -215,6 +216,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList & /*arguments*/, QStrin
|
||||
addAutoReleasedObject(new BuildSettingsPanelFactory);
|
||||
addAutoReleasedObject(new RunSettingsPanelFactory);
|
||||
addAutoReleasedObject(new EditorSettingsPanelFactory);
|
||||
addAutoReleasedObject(new DependenciesPanelFactory(m_session));
|
||||
|
||||
ProcessStepFactory *processStepFactory = new ProcessStepFactory;
|
||||
addAutoReleasedObject(processStepFactory);
|
||||
@@ -485,11 +487,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList & /*arguments*/, QStrin
|
||||
mbuild->addAction(cmd, Constants::G_BUILD_SESSION);
|
||||
msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD);
|
||||
|
||||
// dependencies action
|
||||
m_dependenciesAction = new QAction(tr("Edit Dependencies..."), this);
|
||||
cmd = am->registerAction(m_dependenciesAction, Constants::DEPENDENCIES, globalcontext);
|
||||
mbuild->addAction(cmd, Constants::G_BUILD_SESSION);
|
||||
|
||||
// build action
|
||||
m_buildAction = new QAction(tr("Build Project"), this);
|
||||
cmd = am->registerAction(m_buildAction, Constants::BUILD, globalcontext);
|
||||
@@ -622,7 +619,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList & /*arguments*/, QStrin
|
||||
connect(m_runActionContextMenu, SIGNAL(triggered()), this, SLOT(runProjectContextMenu()));
|
||||
connect(m_cancelBuildAction, SIGNAL(triggered()), this, SLOT(cancelBuild()));
|
||||
connect(m_debugAction, SIGNAL(triggered()), this, SLOT(debugProject()));
|
||||
connect(m_dependenciesAction, SIGNAL(triggered()), this, SLOT(editDependencies()));
|
||||
connect(m_unloadAction, SIGNAL(triggered()), this, SLOT(unloadProject()));
|
||||
connect(m_clearSession, SIGNAL(triggered()), this, SLOT(clearSession()));
|
||||
connect(m_taskAction, SIGNAL(triggered()), this, SLOT(goToTaskWindow()));
|
||||
@@ -701,7 +697,7 @@ void ProjectExplorerPlugin::unloadProject()
|
||||
|
||||
QList<Core::IFile*> filesToSave;
|
||||
filesToSave << fi;
|
||||
filesToSave << m_currentProject->dependencies();
|
||||
// FIXME: What we want here is to check whether we need to safe any of the pro/pri files in this project
|
||||
|
||||
// check the number of modified files
|
||||
int readonlycount = 0;
|
||||
@@ -1203,13 +1199,13 @@ void ProjectExplorerPlugin::updateActions()
|
||||
m_rebuildSessionAction->setEnabled(hasProjects && !building);
|
||||
m_cleanSessionAction->setEnabled(hasProjects && !building);
|
||||
m_cancelBuildAction->setEnabled(building);
|
||||
m_dependenciesAction->setEnabled(hasProjects && !building);
|
||||
|
||||
updateRunAction();
|
||||
|
||||
updateTaskActions();
|
||||
}
|
||||
|
||||
|
||||
// NBS TODO check projectOrder()
|
||||
// what we want here is all the projects pro depends on
|
||||
QStringList ProjectExplorerPlugin::allFilesWithDependencies(Project *pro)
|
||||
@@ -1467,14 +1463,6 @@ void ProjectExplorerPlugin::cancelBuild()
|
||||
m_buildManager->cancel();
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::editDependencies()
|
||||
{
|
||||
if (debug)
|
||||
qDebug() << "ProjectExplorerPlugin::editDependencies";
|
||||
|
||||
m_session->editDependencies();
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::addToRecentProjects(const QString &fileName)
|
||||
{
|
||||
if (debug)
|
||||
|
@@ -138,7 +138,6 @@ private slots:
|
||||
void cleanSession();
|
||||
void cancelBuild();
|
||||
void debugProject();
|
||||
void editDependencies();
|
||||
void loadAction();
|
||||
void unloadProject();
|
||||
void clearSession();
|
||||
@@ -228,7 +227,6 @@ private:
|
||||
QAction *m_runActionContextMenu;
|
||||
QAction *m_cancelBuildAction;
|
||||
QAction *m_debugAction;
|
||||
QAction *m_dependenciesAction;
|
||||
QAction *m_taskAction;
|
||||
QAction *m_addNewFileAction;
|
||||
QAction *m_addExistingFilesAction;
|
||||
|
@@ -15,7 +15,7 @@ HEADERS += projectexplorer.h \
|
||||
persistentsettings.h \
|
||||
projectfilewizardextension.h \
|
||||
session.h \
|
||||
dependenciesdialog.h \
|
||||
dependenciespanel.h \
|
||||
allprojectsfilter.h \
|
||||
buildparserinterface.h \
|
||||
projectexplorerconstants.h \
|
||||
@@ -62,7 +62,7 @@ SOURCES += projectexplorer.cpp \
|
||||
persistentsettings.cpp \
|
||||
projectfilewizardextension.cpp \
|
||||
session.cpp \
|
||||
dependenciesdialog.cpp \
|
||||
dependenciespanel.cpp \
|
||||
allprojectsfilter.cpp \
|
||||
currentprojectfilter.cpp \
|
||||
scriptwrappers.cpp \
|
||||
@@ -94,7 +94,7 @@ SOURCES += projectexplorer.cpp \
|
||||
nodesvisitor.cpp \
|
||||
projectmodels.cpp \
|
||||
currentprojectfind.cpp
|
||||
FORMS += dependenciesdialog.ui \
|
||||
FORMS += dependenciespanel.ui \
|
||||
buildsettingspropertiespage.ui \
|
||||
processstep.ui \
|
||||
editorsettingspropertiespage.ui \
|
||||
|
@@ -33,7 +33,6 @@
|
||||
|
||||
#include "session.h"
|
||||
|
||||
#include "dependenciesdialog.h"
|
||||
#include "project.h"
|
||||
#include "projectexplorer.h"
|
||||
#include "projectexplorerconstants.h"
|
||||
@@ -59,6 +58,7 @@
|
||||
#include <QtCore/QFuture>
|
||||
#include <QtCore/QSettings>
|
||||
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QMessageBox>
|
||||
|
||||
@@ -118,7 +118,6 @@ private:
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using Internal::SessionFile;
|
||||
using Internal::DependenciesDialog;
|
||||
|
||||
|
||||
void SessionFile::sessionLoadingProgress()
|
||||
@@ -452,7 +451,28 @@ bool SessionManager::recursiveDependencyCheck(const QString &newDep, const QStri
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SessionManager::hasDependency(Project *project, Project *depProject) const
|
||||
/*
|
||||
* TODO: The dependency management exposes an interface based on projects, but
|
||||
* is internally purely string based. This is suboptimal. Probably it would be
|
||||
* nicer to map the filenames to projects on load and only map it back to
|
||||
* filenames when saving.
|
||||
*/
|
||||
|
||||
QList<Project *> SessionManager::dependencies(const Project *project) const
|
||||
{
|
||||
const QString &proName = project->file()->fileName();
|
||||
const QStringList &proDeps = m_file->m_depMap.value(proName);
|
||||
|
||||
QList<Project *> projects;
|
||||
foreach (const QString &dep, proDeps) {
|
||||
if (Project *pro = projectForFile(dep))
|
||||
projects += pro;
|
||||
}
|
||||
|
||||
return projects;
|
||||
}
|
||||
|
||||
bool SessionManager::hasDependency(const Project *project, const Project *depProject) const
|
||||
{
|
||||
const QString &proName = project->file()->fileName();
|
||||
const QString &depName = depProject->file()->fileName();
|
||||
@@ -461,7 +481,7 @@ bool SessionManager::hasDependency(Project *project, Project *depProject) const
|
||||
return proDeps.contains(depName);
|
||||
}
|
||||
|
||||
bool SessionManager::canAddDependency(Project *project, Project *depProject) const
|
||||
bool SessionManager::canAddDependency(const Project *project, const Project *depProject) const
|
||||
{
|
||||
const QString &newDep = project->file()->fileName();
|
||||
const QString &checkDep = depProject->file()->fileName();
|
||||
@@ -469,7 +489,7 @@ bool SessionManager::canAddDependency(Project *project, Project *depProject) con
|
||||
return recursiveDependencyCheck(newDep, checkDep);
|
||||
}
|
||||
|
||||
bool SessionManager::addDependency(Project *project, Project *depProject)
|
||||
bool SessionManager::addDependency(const Project *project, const Project *depProject)
|
||||
{
|
||||
const QString &proName = project->file()->fileName();
|
||||
const QString &depName = depProject->file()->fileName();
|
||||
@@ -487,6 +507,20 @@ bool SessionManager::addDependency(Project *project, Project *depProject)
|
||||
return true;
|
||||
}
|
||||
|
||||
void SessionManager::removeDependency(const Project *project, const Project *depProject)
|
||||
{
|
||||
const QString &proName = project->file()->fileName();
|
||||
const QString &depName = depProject->file()->fileName();
|
||||
|
||||
QStringList proDeps = m_file->m_depMap.value(proName);
|
||||
proDeps.removeAll(depName);
|
||||
if (proDeps.isEmpty()) {
|
||||
m_file->m_depMap.remove(proName);
|
||||
} else {
|
||||
m_file->m_depMap[proName] = proDeps;
|
||||
}
|
||||
}
|
||||
|
||||
void SessionManager::setStartupProject(Project *startupProject)
|
||||
{
|
||||
if (debug)
|
||||
@@ -505,21 +539,6 @@ Project *SessionManager::startupProject() const
|
||||
return m_file->m_startupProject;
|
||||
}
|
||||
|
||||
void SessionManager::removeDependency(Project *project,
|
||||
Project *depProject)
|
||||
{
|
||||
const QString &proName = project->file()->fileName();
|
||||
const QString &depName = depProject->file()->fileName();
|
||||
|
||||
QStringList proDeps = m_file->m_depMap.value(proName);
|
||||
proDeps.removeAll(depName);
|
||||
if (proDeps.isEmpty()) {
|
||||
m_file->m_depMap.remove(proName);
|
||||
} else {
|
||||
m_file->m_depMap[proName] = proDeps;
|
||||
}
|
||||
}
|
||||
|
||||
void SessionManager::addProject(Project *project)
|
||||
{
|
||||
addProjects(QList<Project*>() << project);
|
||||
@@ -702,12 +721,6 @@ bool SessionManager::clear()
|
||||
return success;
|
||||
}
|
||||
|
||||
void SessionManager::editDependencies()
|
||||
{
|
||||
DependenciesDialog dlg(0, this);
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
const QList<Project *> &SessionManager::projects() const
|
||||
{
|
||||
return m_file->m_projects;
|
||||
|
@@ -123,16 +123,13 @@ public:
|
||||
void removeProject(Project *project);
|
||||
void removeProjects(QList<Project *> remove);
|
||||
|
||||
void editDependencies();
|
||||
void setStartupProject(Project *startupProject);
|
||||
|
||||
// NBS think about dependency management again.
|
||||
// Probably kill these here
|
||||
bool canAddDependency(Project *project, Project *depProject) const;
|
||||
bool hasDependency(Project *project, Project *depProject) const;
|
||||
// adds the 'requiredProject' as a dependency to 'project'
|
||||
bool addDependency(Project *project, Project *depProject);
|
||||
void removeDependency(Project *project, Project *depProject);
|
||||
QList<Project *> dependencies(const Project *project) const;
|
||||
bool hasDependency(const Project *project, const Project *depProject) const;
|
||||
bool canAddDependency(const Project *project, const Project *depProject) const;
|
||||
bool addDependency(const Project *project, const Project *depProject);
|
||||
void removeDependency(const Project *project, const Project *depProject);
|
||||
|
||||
Core::IFile *file() const;
|
||||
Project *startupProject() const;
|
||||
|
@@ -569,17 +569,6 @@ QStringList Qt4Project::files(FilesMode fileMode) const
|
||||
return files;
|
||||
}
|
||||
|
||||
QList<Core::IFile *> Qt4Project::dependencies()
|
||||
{
|
||||
QList<Core::IFile *> result;
|
||||
// TODO profile cache is no longer
|
||||
// ProFileCache *cache = m_manager->proFileCache();
|
||||
// foreach (const QString &file, cache->dependencies(m_rootProjectNode)) {
|
||||
// result << cache->fileInterface(file);
|
||||
// }
|
||||
return result;
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::Project*> Qt4Project::dependsOn()
|
||||
{
|
||||
// NBS implement dependsOn
|
||||
|
@@ -74,7 +74,12 @@ using ProjectExplorer::ResourceType;
|
||||
using ProjectExplorer::UnknownFileType;
|
||||
|
||||
// Known file types of a Qt 4 project
|
||||
static const char* qt4FileTypes[] = {"CppHeaderFiles", "CppSourceFiles", "Qt4FormFiles", "Qt4ResourceFiles" };
|
||||
static const char* qt4FileTypes[] = {
|
||||
"CppHeaderFiles",
|
||||
"CppSourceFiles",
|
||||
"Qt4FormFiles",
|
||||
"Qt4ResourceFiles"
|
||||
};
|
||||
|
||||
Qt4Manager::Qt4Manager(Qt4ProjectManagerPlugin *plugin, Core::ICore *core) :
|
||||
m_mimeType(QLatin1String(Qt4ProjectManager::Constants::PROFILE_MIMETYPE)),
|
||||
|
Reference in New Issue
Block a user