Commit 37f7e5db authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Added a way to refresh the project.

parent 752a6413
......@@ -50,6 +50,7 @@
#include <QtGui/QComboBox>
#include <QtGui/QStringListModel>
#include <QtGui/QListWidget>
#include <QtGui/QPushButton>
using namespace GenericProjectManager;
using namespace GenericProjectManager::Internal;
......@@ -198,6 +199,9 @@ void GenericProject::setIncludePaths(const QStringList &includePaths)
QStringList GenericProject::defines() const
{ return _defines; }
void GenericProject::setDefines(const QStringList &defines)
{ _defines = defines; }
void GenericProject::setToolChainId(const QString &toolChainId)
{
using namespace ProjectExplorer;
......@@ -446,6 +450,15 @@ GenericBuildSettingsWidget::GenericBuildSettingsWidget(GenericProject *project)
_definesModel->setStringList(_project->defines());
definesView->setModel(_definesModel);
fl->addRow(tr("Defines:"), definesView);
_applyButton = new QPushButton(tr("Apply"));
_applyButton->setEnabled(false);
fl->addRow(QString(), _applyButton);
connect(_applyButton, SIGNAL(clicked()), this, SLOT(applyChanges()));
connect(_includePathsModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
this, SLOT(markDirty()));
connect(_definesModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
this, SLOT(markDirty()));
}
GenericBuildSettingsWidget::~GenericBuildSettingsWidget()
......@@ -469,6 +482,19 @@ void GenericBuildSettingsWidget::buildDirectoryChanged()
_project->setValue(_buildConfiguration, "buildDirectory", _pathChooser->path());
}
void GenericBuildSettingsWidget::markDirty()
{
_applyButton->setEnabled(true);
}
void GenericBuildSettingsWidget::applyChanges()
{
_project->setIncludePaths(_includePathsModel->stringList());
_project->setDefines(_definesModel->stringList());
_project->refresh();
_applyButton->setEnabled(false);
}
////////////////////////////////////////////////////////////////////////////////////
// GenericProjectFile
......
......@@ -42,6 +42,7 @@
#include <utils/pathchooser.h>
QT_BEGIN_NAMESPACE
class QPushButton;
class QStringListModel;
QT_END_NAMESPACE
......@@ -85,13 +86,16 @@ public:
QStringList includePaths() const;
void setIncludePaths(const QStringList &includePaths);
QStringList files() const;
QStringList generated() const;
QStringList defines() const;
void setDefines(const QStringList &defines);
QStringList files() const;
QStringList generated() const;
QString toolChainId() const;
public Q_SLOTS:
void setToolChainId(const QString &toolChainId);
void refresh();
protected:
virtual void saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer);
......@@ -99,7 +103,6 @@ protected:
private:
void parseProject();
void refresh();
Manager *_manager;
QString _fileName;
......@@ -156,11 +159,14 @@ public:
private Q_SLOTS:
void buildDirectoryChanged();
void markDirty();
void applyChanges();
private:
GenericProject *_project;
Core::Utils::PathChooser *_pathChooser;
QString _buildConfiguration;
QPushButton *_applyButton;
QStringListModel *_includePathsModel;
QStringListModel *_definesModel;
};
......
......@@ -30,6 +30,8 @@
#include "genericprojectnodes.h"
#include "genericproject.h"
#include <projectexplorer/projectexplorer.h>
#include <QDir>
#include <QFileInfo>
#include <QSettings>
......@@ -61,6 +63,8 @@ void GenericProjectNode::refresh()
removeFileNodes(fileNodes(), this);
removeFolderNodes(subFolderNodes(), this);
ProjectExplorerPlugin::instance()->setCurrentNode(0); // ### remove me
FileNode *projectFileNode = new FileNode(projectFilePath(), ProjectFileType,
/* generated = */ false);
......@@ -96,6 +100,8 @@ void GenericProjectNode::refresh()
addFileNodes(fileNodes, folder);
}
_folderByName.clear();
}
ProjectExplorer::FolderNode *GenericProjectNode::findOrCreateFolderByName(const QStringList &components, int end)
......
......@@ -78,7 +78,6 @@ private:
private:
GenericProject *_project;
Core::IFile *_projectFile;
QHash<QString, FolderNode *> _folderByName;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment