Commit fb835713 authored by Kai Koehne's avatar Kai Koehne
Browse files

Remove support for old .qmlproject file format

We used to fail back to the old format if the .qmlproject file
was invalid. Anyhow, this lead to weird effects ... better disable
it explicitly.

That no warning is shown right now when loading an invalid qmlproject
file is a bug in coreplugin.
parent 20ec3022
......@@ -31,6 +31,9 @@
#include "qmlprojectfile.h"
#include "qmlprojectmanagerconstants.h"
#include "fileformat/qmlprojectitem.h"
#include <coreplugin/icore.h>
#include <coreplugin/messagemanager.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/filewatcher.h>
#include <qmljseditor/qmljsmodelmanagerinterface.h>
......@@ -77,30 +80,6 @@ QDir QmlProject::projectDir() const
QString QmlProject::filesFileName() const
{ return m_fileName; }
static QStringList readLines(const QString &absoluteFileName)
{
QStringList lines;
QFile file(absoluteFileName);
if (file.open(QFile::ReadOnly)) {
QTextStream stream(&file);
forever {
QString line = stream.readLine();
if (line.isNull())
break;
line = line.trimmed();
if (line.isEmpty())
continue;
lines.append(line);
}
}
return lines;
}
void QmlProject::parseProject(RefreshOptions options)
{
if (options & Files) {
......@@ -116,10 +95,9 @@ void QmlProject::parseProject(RefreshOptions options)
m_projectItem = qobject_cast<QmlProjectItem*>(component->create());
connect(m_projectItem.data(), SIGNAL(qmlFilesChanged()), this, SLOT(refreshFiles()));
} else {
qWarning() << m_fileName << "is not valid qml file, falling back to old format ...";
m_files = convertToAbsoluteFiles(readLines(filesFileName()));
m_files.removeDuplicates();
m_modelManager->updateSourceFiles(m_files);
Core::MessageManager *messageManager = Core::ICore::instance()->messageManager();
messageManager->printToOutputPane(tr("Error while loading project file!"));
messageManager->printToOutputPane(component->errorsString(), true);
}
}
}
......@@ -173,6 +151,11 @@ QStringList QmlProject::files() const
return files;
}
bool QmlProject::validProjectFile() const
{
return !m_projectItem.isNull();
}
QStringList QmlProject::libraryPaths() const
{
QStringList libraryPaths;
......
......@@ -85,6 +85,8 @@ public:
Internal::QmlProjectNode *rootProjectNode() const;
QStringList files(FilesMode fileMode) const;
bool validProjectFile() const;
enum RefreshOption {
ProjectFile = 0x01,
Files = 0x02,
......
......@@ -73,16 +73,14 @@ ProjectExplorer::Project *Manager::openProject(const QString &fileName)
foreach (ProjectExplorer::Project *pi, projectExplorer->session()->projects()) {
if (fileName == pi->file()->fileName()) {
messageManager->printToOutputPane(tr("Failed opening project '%1': Project already open").arg(QDir::toNativeSeparators(fileName)));
messageManager->displayStatusBarMessage(tr("Failed opening project"), 5000);
messageManager->printToOutputPanePopup(tr("Failed opening project '%1': Project already open")
.arg(QDir::toNativeSeparators(fileName)));
return 0;
}
}
if (fileInfo.isFile()) {
QmlProject *project = new QmlProject(this, fileName);
messageManager->displayStatusBarMessage(tr("Done opening project"), 5000);
return project;
return new QmlProject(this, fileName);
}
return 0;
......
Supports Markdown
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