Commit f9308dcc authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Fixed the wizard and removed some obsolete code.

parent e10bda6f
......@@ -509,30 +509,6 @@ GenericBuildSettingsWidget::GenericBuildSettingsWidget(GenericProject *project)
toolChainChooser->setCurrentIndex(toolChainChooser->findText(_project->toolChainId()));
fl->addRow(tr("Tool chain:"), toolChainChooser);
connect(toolChainChooser, SIGNAL(activated(QString)), _project, SLOT(setToolChainId(QString)));
// include paths
QListView *includePathsView = new QListView;
_includePathsModel = new ListModel(this);
_includePathsModel->setStringList(_project->allIncludePaths());
includePathsView->setModel(_includePathsModel);
fl->addRow(tr("Include paths:"), includePathsView);
// defines
QListView *definesView = new QListView;
_definesModel = new ListModel(this);
_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()
......@@ -556,20 +532,6 @@ 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
////////////////////////////////////////////////////////////////////////////////////
......
......@@ -171,16 +171,11 @@ 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;
};
} // namespace Internal
......
......@@ -77,6 +77,11 @@ void GenericProjectNode::refresh()
ProjectFileType,
/* generated = */ false);
QStringList files = _project->files();
files.removeAll(_project->filesFileName());
files.removeAll(_project->includesFileName());
files.removeAll(_project->configFileName());
addFileNodes(QList<FileNode *>()
<< projectFilesNode
<< projectIncludesNode
......@@ -86,7 +91,7 @@ void GenericProjectNode::refresh()
QStringList filePaths;
QHash<QString, QStringList> filesInPath;
foreach (const QString &absoluteFileName, _project->files()) {
foreach (const QString &absoluteFileName, files) {
QFileInfo fileInfo(absoluteFileName);
const QString absoluteFilePath = fileInfo.path();
......
......@@ -268,8 +268,12 @@ Core::GeneratedFiles GenericProjectWizard::generateFiles(const QWizard *w,
{
const GenericProjectWizardDialog *wizard = qobject_cast<const GenericProjectWizardDialog *>(w);
const QString projectPath = wizard->path();
const QString projectName = QFileInfo(projectPath).baseName() + QLatin1String(".creator");
const QDir dir(projectPath);
const QString projectName = QFileInfo(projectPath).baseName();
const QString creatorFileName = QFileInfo(dir, projectName + QLatin1String(".creator")).absoluteFilePath();
const QString filesFileName = QFileInfo(dir, projectName + QLatin1String(".files")).absoluteFilePath();
const QString includesFileName = QFileInfo(dir, projectName + QLatin1String(".includes")).absoluteFilePath();
const QString configFileName = QFileInfo(dir, projectName + QLatin1String(".config")).absoluteFilePath();
Core::ICore *core = Core::ICore::instance();
Core::MimeDatabase *mimeDatabase = core->mimeDatabase();
......@@ -294,18 +298,23 @@ Core::GeneratedFiles GenericProjectWizard::generateFiles(const QWizard *w,
includePaths.append(path);
}
QString projectContents;
QTextStream stream(&projectContents);
stream << "files=" << sources.join(",");
stream << endl;
stream << "includePaths=" << includePaths.join(",");
stream << endl;
Core::GeneratedFile generatedCreatorFile(creatorFileName);
generatedCreatorFile.setContents(QLatin1String("[General]\n"));
Core::GeneratedFile file(QFileInfo(dir, projectName).absoluteFilePath()); // ### fixme
file.setContents(projectContents);
Core::GeneratedFile generatedFilesFile(filesFileName);
generatedFilesFile.setContents(sources.join(QLatin1String("\n")));
Core::GeneratedFile generatedIncludesFile(includesFileName);
generatedIncludesFile.setContents(includePaths.join(QLatin1String("\n")));
Core::GeneratedFile generatedConfigFile(configFileName);
generatedConfigFile.setContents(QLatin1String("// ADD PREDEFINED MACROS HERE!\n"));
Core::GeneratedFiles files;
files.append(file);
files.append(generatedFilesFile);
files.append(generatedIncludesFile);
files.append(generatedConfigFile);
files.append(generatedCreatorFile);
return files;
}
......
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