2009-05-04 12:19:22 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
|
|
|
|
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
|
|
**
|
2009-06-17 00:01:27 +10:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
|
|
|
|
** Commercial Usage
|
|
|
|
|
**
|
|
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Nokia.
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
|
|
|
|
** 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.
|
|
|
|
|
**
|
|
|
|
|
** If you are unsure which license is appropriate for your use, please
|
2009-08-14 09:30:56 +02:00
|
|
|
** contact the sales department at http://qt.nokia.com/contact.
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef QMLPROJECT_H
|
|
|
|
|
#define QMLPROJECT_H
|
|
|
|
|
|
|
|
|
|
#include "qmlprojectmanager.h"
|
|
|
|
|
#include "qmlprojectnodes.h"
|
|
|
|
|
|
|
|
|
|
#include <projectexplorer/project.h>
|
|
|
|
|
#include <projectexplorer/projectnodes.h>
|
|
|
|
|
#include <projectexplorer/buildstep.h>
|
2009-05-04 13:38:03 +02:00
|
|
|
#include <projectexplorer/applicationrunconfiguration.h>
|
2009-05-04 12:19:22 +02:00
|
|
|
#include <coreplugin/ifile.h>
|
|
|
|
|
|
2009-05-06 16:13:44 +02:00
|
|
|
#include <QtCore/QDir>
|
2009-05-04 12:19:22 +02:00
|
|
|
|
2009-09-04 17:54:38 +02:00
|
|
|
namespace DuiEditor {
|
|
|
|
|
class DuiModelManagerInterface;
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-04 12:19:22 +02:00
|
|
|
namespace QmlProjectManager {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class QmlMakeStep;
|
|
|
|
|
class QmlProjectFile;
|
|
|
|
|
|
|
|
|
|
class QmlProject : public ProjectExplorer::Project
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
QmlProject(Manager *manager, const QString &filename);
|
|
|
|
|
virtual ~QmlProject();
|
|
|
|
|
|
|
|
|
|
QString filesFileName() const;
|
|
|
|
|
|
|
|
|
|
virtual QString name() const;
|
|
|
|
|
virtual Core::IFile *file() const;
|
2009-05-07 15:43:59 +02:00
|
|
|
virtual Manager *projectManager() const;
|
2009-05-04 12:19:22 +02:00
|
|
|
|
|
|
|
|
virtual QList<ProjectExplorer::Project *> dependsOn();
|
|
|
|
|
|
|
|
|
|
virtual bool isApplication() const;
|
2009-05-06 16:33:43 +02:00
|
|
|
virtual bool hasBuildSettings() const;
|
2009-05-04 12:19:22 +02:00
|
|
|
|
|
|
|
|
virtual ProjectExplorer::Environment environment(const QString &buildConfiguration) const;
|
|
|
|
|
virtual QString buildDirectory(const QString &buildConfiguration) const;
|
|
|
|
|
|
2009-08-06 15:31:32 +02:00
|
|
|
virtual ProjectExplorer::BuildConfigWidget *createConfigWidget();
|
|
|
|
|
virtual QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
|
2009-05-04 12:19:22 +02:00
|
|
|
|
2009-09-23 15:00:02 +02:00
|
|
|
virtual bool newBuildConfiguration(const QString &buildConfiguration);
|
2009-05-04 12:19:22 +02:00
|
|
|
virtual QmlProjectNode *rootProjectNode() const;
|
|
|
|
|
virtual QStringList files(FilesMode fileMode) const;
|
|
|
|
|
|
|
|
|
|
QStringList targets() const;
|
|
|
|
|
QmlMakeStep *makeStep() const;
|
|
|
|
|
QString buildParser(const QString &buildConfiguration) const;
|
|
|
|
|
|
|
|
|
|
enum RefreshOptions {
|
|
|
|
|
Files = 0x01,
|
|
|
|
|
Configuration = 0x02,
|
|
|
|
|
Everything = Files | Configuration
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void refresh(RefreshOptions options);
|
|
|
|
|
|
2009-05-06 16:13:44 +02:00
|
|
|
QDir projectDir() const;
|
2009-05-04 12:19:22 +02:00
|
|
|
QStringList files() const;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual void saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer);
|
2009-07-03 16:46:01 +02:00
|
|
|
virtual bool restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader &reader);
|
2009-05-04 12:19:22 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void parseProject(RefreshOptions options);
|
|
|
|
|
QStringList convertToAbsoluteFiles(const QStringList &paths) const;
|
|
|
|
|
|
|
|
|
|
Manager *m_manager;
|
|
|
|
|
QString m_fileName;
|
|
|
|
|
QString m_filesFileName;
|
|
|
|
|
QmlProjectFile *m_file;
|
|
|
|
|
QString m_projectName;
|
2009-09-04 17:54:38 +02:00
|
|
|
DuiEditor::DuiModelManagerInterface *m_modelManager;
|
2009-05-04 12:19:22 +02:00
|
|
|
|
|
|
|
|
QStringList m_files;
|
|
|
|
|
|
|
|
|
|
QmlProjectNode *m_rootNode;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class QmlProjectFile : public Core::IFile
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
QmlProjectFile(QmlProject *parent, QString fileName);
|
|
|
|
|
virtual ~QmlProjectFile();
|
|
|
|
|
|
|
|
|
|
virtual bool save(const QString &fileName = QString());
|
|
|
|
|
virtual QString fileName() const;
|
|
|
|
|
|
|
|
|
|
virtual QString defaultPath() const;
|
|
|
|
|
virtual QString suggestedFileName() const;
|
|
|
|
|
virtual QString mimeType() const;
|
|
|
|
|
|
|
|
|
|
virtual bool isModified() const;
|
|
|
|
|
virtual bool isReadOnly() const;
|
|
|
|
|
virtual bool isSaveAsAllowed() const;
|
|
|
|
|
|
|
|
|
|
virtual void modified(ReloadBehavior *behavior);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QmlProject *m_project;
|
|
|
|
|
QString m_fileName;
|
|
|
|
|
};
|
|
|
|
|
|
2009-09-25 11:35:44 +02:00
|
|
|
class QmlRunConfiguration : public ProjectExplorer::LocalApplicationRunConfiguration
|
2009-05-04 12:19:22 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2009-05-07 12:27:52 +02:00
|
|
|
QmlRunConfiguration(QmlProject *pro);
|
|
|
|
|
virtual ~QmlRunConfiguration();
|
2009-05-04 13:38:03 +02:00
|
|
|
|
|
|
|
|
virtual QString type() const;
|
|
|
|
|
virtual QString executable() const;
|
|
|
|
|
virtual RunMode runMode() const;
|
|
|
|
|
virtual QString workingDirectory() const;
|
|
|
|
|
virtual QStringList commandLineArguments() const;
|
|
|
|
|
virtual ProjectExplorer::Environment environment() const;
|
|
|
|
|
virtual QString dumperLibrary() const;
|
2009-07-15 17:41:45 +02:00
|
|
|
virtual QStringList dumperLibraryLocations() const;
|
2009-05-04 13:38:03 +02:00
|
|
|
virtual QWidget *configurationWidget();
|
|
|
|
|
|
2009-06-17 20:10:36 +02:00
|
|
|
ProjectExplorer::ToolChain::ToolChainType toolChainType() const { return ProjectExplorer::ToolChain::OTHER; }
|
|
|
|
|
|
2009-05-04 13:38:03 +02:00
|
|
|
virtual void save(ProjectExplorer::PersistentSettingsWriter &writer) const;
|
|
|
|
|
virtual void restore(const ProjectExplorer::PersistentSettingsReader &reader);
|
|
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
|
void setMainScript(const QString &scriptFile);
|
2009-05-07 12:27:52 +02:00
|
|
|
void onQmlViewerChanged();
|
2009-09-30 11:36:34 +02:00
|
|
|
void onQmlViewerArgsChanged();
|
2009-05-07 12:27:52 +02:00
|
|
|
|
2009-05-04 13:38:03 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QString mainScript() const;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QmlProject *m_project;
|
|
|
|
|
QString m_scriptFile;
|
2009-05-07 12:27:52 +02:00
|
|
|
QString m_qmlViewer;
|
2009-09-30 11:36:34 +02:00
|
|
|
QString m_qmlViewerArgs;
|
2009-05-07 12:27:52 +02:00
|
|
|
QLatin1String m_type;
|
2009-05-04 13:38:03 +02:00
|
|
|
};
|
|
|
|
|
|
2009-05-07 12:27:52 +02:00
|
|
|
class QmlRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
QmlRunConfigurationFactory();
|
|
|
|
|
virtual ~QmlRunConfigurationFactory();
|
|
|
|
|
|
|
|
|
|
// used to recreate the runConfigurations when restoring settings
|
2009-06-12 17:57:03 +02:00
|
|
|
virtual bool canRestore(const QString &type) const;
|
2009-05-07 12:27:52 +02:00
|
|
|
|
|
|
|
|
// used to show the list of possible additons to a project, returns a list of types
|
2009-06-12 17:57:03 +02:00
|
|
|
virtual QStringList availableCreationTypes(ProjectExplorer::Project *pro) const;
|
2009-05-07 12:27:52 +02:00
|
|
|
|
|
|
|
|
// used to translate the types to names to display to the user
|
2009-06-12 17:57:03 +02:00
|
|
|
virtual QString displayNameForType(const QString &type) const;
|
2009-05-07 12:27:52 +02:00
|
|
|
|
|
|
|
|
virtual QSharedPointer<ProjectExplorer::RunConfiguration> create(ProjectExplorer::Project *project,
|
|
|
|
|
const QString &type);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QLatin1String m_type;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2009-05-04 12:19:22 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace QmlProjectManager
|
|
|
|
|
|
|
|
|
|
#endif // QMLPROJECT_H
|