qmlprojectfile.cpp 2.73 KB
Newer Older
hjk's avatar
hjk committed
1
/****************************************************************************
Tobias Hunger's avatar
Tobias Hunger committed
2
**
3
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
hjk's avatar
hjk committed
4
** Contact: http://www.qt-project.org/legal
Tobias Hunger's avatar
Tobias Hunger committed
5
**
hjk's avatar
hjk committed
6
** This file is part of Qt Creator.
Tobias Hunger's avatar
Tobias Hunger committed
7
**
hjk's avatar
hjk committed
8 9 10 11 12 13 14
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
Tobias Hunger's avatar
Tobias Hunger committed
15 16
**
** GNU Lesser General Public License Usage
hjk's avatar
hjk committed
17 18 19 20 21 22 23 24 25
** 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.
**
** In addition, as a special exception, Digia gives you certain additional
** rights.  These rights are described in the Digia Qt LGPL Exception
con's avatar
con committed
26 27
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
hjk's avatar
hjk committed
28
****************************************************************************/
Tobias Hunger's avatar
Tobias Hunger committed
29

Kai Koehne's avatar
Kai Koehne committed
30 31 32
#include "qmlprojectfile.h"
#include "qmlproject.h"
#include "qmlprojectconstants.h"
33
#include <utils/qtcassert.h>
Tobias Hunger's avatar
Tobias Hunger committed
34 35 36 37

namespace QmlProjectManager {
namespace Internal {

Kai Koehne's avatar
Kai Koehne committed
38
QmlProjectFile::QmlProjectFile(QmlProject *parent, QString fileName)
39
    : Core::IDocument(parent),
40
      m_project(parent)
41 42 43
{
    QTC_CHECK(m_project);
    QTC_CHECK(!fileName.isEmpty());
44
    setId("Qml.ProjectFile");
hjk's avatar
hjk committed
45
    setMimeType(QLatin1String(Constants::QMLPROJECT_MIMETYPE));
46
    setFilePath(fileName);
47
}
Tobias Hunger's avatar
Tobias Hunger committed
48

Kai Koehne's avatar
Kai Koehne committed
49
QmlProjectFile::~QmlProjectFile()
50 51
{
}
Tobias Hunger's avatar
Tobias Hunger committed
52

53
bool QmlProjectFile::save(QString *, const QString &, bool)
Tobias Hunger's avatar
Tobias Hunger committed
54
{
Kai Koehne's avatar
Kai Koehne committed
55 56
    return false;
}
Tobias Hunger's avatar
Tobias Hunger committed
57

Kai Koehne's avatar
Kai Koehne committed
58 59 60 61
QString QmlProjectFile::defaultPath() const
{
    return QString();
}
Tobias Hunger's avatar
Tobias Hunger committed
62

Kai Koehne's avatar
Kai Koehne committed
63 64 65 66
QString QmlProjectFile::suggestedFileName() const
{
    return QString();
}
Tobias Hunger's avatar
Tobias Hunger committed
67

Kai Koehne's avatar
Kai Koehne committed
68
bool QmlProjectFile::isModified() const
Tobias Hunger's avatar
Tobias Hunger committed
69
{
Kai Koehne's avatar
Kai Koehne committed
70 71
    return false;
}
Tobias Hunger's avatar
Tobias Hunger committed
72

Kai Koehne's avatar
Kai Koehne committed
73 74 75 76
bool QmlProjectFile::isSaveAsAllowed() const
{
    return false;
}
Tobias Hunger's avatar
Tobias Hunger committed
77

78
Core::IDocument::ReloadBehavior QmlProjectFile::reloadBehavior(ChangeTrigger state, ChangeType type) const
Kai Koehne's avatar
Kai Koehne committed
79
{
80 81 82 83 84
    Q_UNUSED(state)
    Q_UNUSED(type)
    return BehaviorSilent;
}

85
bool QmlProjectFile::reload(QString *errorString, ReloadFlag flag, ChangeType type)
86
{
87
    Q_UNUSED(errorString)
88
    Q_UNUSED(flag)
89 90 91 92

    if (type == TypeContents)
        m_project->refreshProjectFile();

93
    return true;
Kai Koehne's avatar
Kai Koehne committed
94
}
Tobias Hunger's avatar
Tobias Hunger committed
95 96 97

} // namespace Internal
} // namespace QmlProjectManager