Merge branch 'master' of scm.dev.nokia.troll.no:creator/mainline

This commit is contained in:
Bea Lam
2010-01-12 10:53:20 +10:00
3295 changed files with 318874 additions and 4822 deletions

View File

@@ -59,11 +59,11 @@ Core::BaseFileWizardParameters QmlNewProjectWizard::parameters()
{
static Core::BaseFileWizardParameters parameters(ProjectWizard);
parameters.setIcon(QIcon(QLatin1String(":/wizards/images/console.png")));
parameters.setName(tr("QML Application"));
parameters.setDisplayName(tr("QML Application"));
parameters.setId(QLatin1String("QA.QML Application"));
parameters.setDescription(tr("Creates a QML application."));
parameters.setCategory(QLatin1String(ProjectExplorer::Constants::PROJECT_WIZARD_CATEGORY));
parameters.setTrCategory(QCoreApplication::translate("ProjectExplorer", ProjectExplorer::Constants::PROJECT_WIZARD_TR_CATEGORY));
parameters.setDisplayCategory(QCoreApplication::translate("ProjectExplorer", ProjectExplorer::Constants::PROJECT_WIZARD_TR_CATEGORY));
return parameters;
}
@@ -74,7 +74,7 @@ QWizard *QmlNewProjectWizard::createWizardDialog(QWidget *parent,
QmlNewProjectWizardDialog *wizard = new QmlNewProjectWizardDialog(parent);
wizard->setPath(defaultPath);
wizard->setName(QmlNewProjectWizardDialog::projectName(defaultPath));
wizard->setProjectName(QmlNewProjectWizardDialog::uniqueProjectName(defaultPath));
foreach (QWizardPage *p, extensionPages)
wizard->addPage(p);
@@ -88,7 +88,7 @@ Core::GeneratedFiles QmlNewProjectWizard::generateFiles(const QWizard *w,
Q_UNUSED(errorMessage)
const QmlNewProjectWizardDialog *wizard = qobject_cast<const QmlNewProjectWizardDialog *>(w);
const QString projectName = wizard->name();
const QString projectName = wizard->projectName();
const QString projectPath = wizard->path() + QLatin1Char('/') + projectName;
const QString creatorFileName = Core::BaseFileWizard::buildFileName(projectPath,
@@ -109,8 +109,9 @@ Core::GeneratedFiles QmlNewProjectWizard::generateFiles(const QWizard *w,
<< " width: 200" << endl
<< " height: 200" << endl
<< " Text {" << endl
<< " x: 66" << endl
<< " y: 93" << endl
<< " text: \"Hello World\"" << endl
<< " anchors.centerIn: parent" << endl
<< " }" << endl
<< "}" << endl;

View File

@@ -44,7 +44,6 @@
#include <qmleditor/qmlmodelmanagerinterface.h>
#include <utils/synchronousprocess.h>
#include <utils/pathchooser.h>
#include <QtCore/QtDebug>
#include <QtCore/QDir>
@@ -166,7 +165,7 @@ QStringList QmlProject::convertToAbsoluteFiles(const QStringList &paths) const
QStringList QmlProject::files() const
{ return m_files; }
QString QmlProject::name() const
QString QmlProject::displayName() const
{
return m_projectName;
}
@@ -305,10 +304,9 @@ void QmlProjectFile::modified(ReloadBehavior *)
QmlRunConfiguration::QmlRunConfiguration(QmlProject *pro)
: ProjectExplorer::RunConfiguration(pro),
m_project(pro),
m_type(Constants::QMLRUNCONFIGURATION),
m_debugServerPort(3768)
{
setName(tr("QML Viewer"));
setDisplayName(tr("QML Viewer"));
// append creator/bin dir to search path (only useful for special creator-qml package)
const QString searchPath = QString(qgetenv("PATH"))
@@ -322,9 +320,9 @@ QmlRunConfiguration::~QmlRunConfiguration()
{
}
QString QmlRunConfiguration::type() const
QString QmlRunConfiguration::id() const
{
return m_type;
return QLatin1String(Constants::QMLRUNCONFIGURATION);
}
QString QmlRunConfiguration::viewerPath() const
@@ -476,7 +474,6 @@ void QmlRunConfiguration::restore(const ProjectExplorer::PersistentSettingsReade
}
QmlRunConfigurationFactory::QmlRunConfigurationFactory()
: m_type(Constants::QMLRUNCONFIGURATION)
{
}
@@ -484,22 +481,22 @@ QmlRunConfigurationFactory::~QmlRunConfigurationFactory()
{
}
bool QmlRunConfigurationFactory::canRestore(const QString &type) const
bool QmlRunConfigurationFactory::canRestore(const QString &id) const
{
if (type.startsWith(m_type))
if (id.startsWith(QLatin1String(Constants::QMLRUNCONFIGURATION)))
return true;
return false;
}
QStringList QmlRunConfigurationFactory::availableCreationTypes(ProjectExplorer::Project *) const
QStringList QmlRunConfigurationFactory::availableCreationIds(ProjectExplorer::Project *) const
{
return QStringList();
}
QString QmlRunConfigurationFactory::displayNameForType(const QString &type) const
QString QmlRunConfigurationFactory::displayNameForId(const QString &id) const
{
return type;
return id;
}
ProjectExplorer::RunConfiguration *QmlRunConfigurationFactory::create(ProjectExplorer::Project *project,
@@ -592,6 +589,7 @@ QmlRunControlFactory::~QmlRunControlFactory()
bool QmlRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const
{
Q_UNUSED(mode);
return (qobject_cast<QmlRunConfiguration*>(runConfiguration) != 0);
}

View File

@@ -61,7 +61,7 @@ public:
QString filesFileName() const;
virtual QString name() const;
virtual QString displayName() const;
virtual Core::IFile *file() const;
virtual Manager *projectManager() const;
virtual ProjectExplorer::IBuildConfigurationFactory *buildConfigurationFactory() const;
@@ -149,7 +149,7 @@ public:
uint debugServerPort() const;
// RunConfiguration
virtual QString type() const;
virtual QString id() const;
virtual QWidget *configurationWidget();
virtual void save(ProjectExplorer::PersistentSettingsWriter &writer) const;
@@ -164,12 +164,11 @@ private Q_SLOTS:
private:
QmlProject *m_project;
uint m_debugServerPort;
QString m_scriptFile;
QString m_qmlViewerCustomPath;
QString m_qmlViewerDefaultPath;
QString m_qmlViewerArgs;
QLatin1String m_type;
uint m_debugServerPort;
};
class QmlRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory
@@ -181,19 +180,16 @@ public:
virtual ~QmlRunConfigurationFactory();
// used to recreate the runConfigurations when restoring settings
virtual bool canRestore(const QString &type) const;
virtual bool canRestore(const QString &id) const;
// used to show the list of possible additons to a project, returns a list of types
virtual QStringList availableCreationTypes(ProjectExplorer::Project *pro) const;
virtual QStringList availableCreationIds(ProjectExplorer::Project *pro) const;
// used to translate the types to names to display to the user
virtual QString displayNameForType(const QString &type) const;
virtual QString displayNameForId(const QString &id) const;
virtual ProjectExplorer::RunConfiguration *create(ProjectExplorer::Project *project,
const QString &type);
private:
QLatin1String m_type;
const QString &id);
};
class QmlRunControl : public ProjectExplorer::RunControl {

View File

@@ -46,7 +46,8 @@ const char *const C_FILESEDITOR = ".files Editor";
// kinds
const char *const PROJECT_KIND = "QML";
const char *const FILES_EDITOR = ".qmlproject Editor";
const char *const FILES_EDITOR_ID = "Qt4.QmlProjectEditor";
const char *const FILES_EDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("OpenWith::Editors", ".qmlproject Editor");
const char *const FILES_MIMETYPE = QMLMIMETYPE;
const char *const TASK_CATEGORY_QML = "Task.Category.Qml";

View File

@@ -75,16 +75,21 @@ QStringList ProjectFilesFactory::mimeTypes() const
return m_mimeTypes;
}
QString ProjectFilesFactory::kind() const
QString ProjectFilesFactory::id() const
{
return QLatin1String(Constants::FILES_EDITOR);
return QLatin1String(Constants::FILES_EDITOR_ID);
}
QString ProjectFilesFactory::displayName() const
{
return tr(Constants::FILES_EDITOR_DISPLAY_NAME);
}
Core::IFile *ProjectFilesFactory::open(const QString &fileName)
{
Core::EditorManager *editorManager = Core::EditorManager::instance();
if (Core::IEditor *editor = editorManager->openEditor(fileName, kind()))
if (Core::IEditor *editor = editorManager->openEditor(fileName, id()))
return editor->file();
return 0;
@@ -109,9 +114,9 @@ QList<int> ProjectFilesEditable::context() const
return m_context;
}
const char *ProjectFilesEditable::kind() const
QString ProjectFilesEditable::id() const
{
return Constants::FILES_EDITOR;
return Constants::FILES_EDITOR_ID;
}
bool ProjectFilesEditable::duplicateSupported() const

View File

@@ -57,7 +57,8 @@ public:
virtual Core::IEditor *createEditor(QWidget *parent);
virtual QStringList mimeTypes() const;
virtual QString kind() const;
virtual QString id() const;
virtual QString displayName() const;
virtual Core::IFile *open(const QString &fileName);
private:
@@ -75,7 +76,7 @@ public:
virtual ~ProjectFilesEditable();
virtual QList<int> context() const;
virtual const char *kind() const;
virtual QString id() const;
virtual bool duplicateSupported() const;
virtual Core::IEditor *duplicate(QWidget *parent);

View File

@@ -33,7 +33,10 @@
#include <coreplugin/icore.h>
#include <coreplugin/uniqueidmanager.h>
#include <coreplugin/messagemanager.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h>
#include <QtDebug>
@@ -60,10 +63,23 @@ QString Manager::mimeType() const
ProjectExplorer::Project *Manager::openProject(const QString &fileName)
{
Core::MessageManager *messageManager = Core::ICore::instance()->messageManager();
messageManager->displayStatusBarMessage(tr("Loading project %1 ...").arg(fileName), 50000);
QFileInfo fileInfo(fileName);
ProjectExplorer::ProjectExplorerPlugin *projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance();
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);
return 0;
}
}
if (fileInfo.isFile()) {
QmlProject *project = new QmlProject(this, fileName);
messageManager->displayStatusBarMessage(tr("Done opening project"), 5000);
return project;
}

View File

@@ -56,7 +56,7 @@ QmlProjectWizardDialog::QmlProjectWizardDialog(QWidget *parent)
// first page
m_firstPage = new FileWizardPage;
m_firstPage->setTitle(tr("QML Project"));
m_firstPage->setNameLabel(tr("Project name:"));
m_firstPage->setFileNameLabel(tr("Project name:"));
m_firstPage->setPathLabel(tr("Location:"));
addPage(m_firstPage);
@@ -77,7 +77,7 @@ void QmlProjectWizardDialog::setPath(const QString &path)
QString QmlProjectWizardDialog::projectName() const
{
return m_firstPage->name();
return m_firstPage->fileName();
}
QmlProjectWizard::QmlProjectWizard()
@@ -91,11 +91,11 @@ Core::BaseFileWizardParameters QmlProjectWizard::parameters()
{
static Core::BaseFileWizardParameters parameters(ProjectWizard);
parameters.setIcon(QIcon(QLatin1String(":/wizards/images/console.png")));
parameters.setName(tr("Import of existing QML directory"));
parameters.setDisplayName(tr("Import of existing QML directory"));
parameters.setId(QLatin1String("QI.QML Import"));
parameters.setDescription(tr("Creates a QML project from an existing directory of QML files."));
parameters.setCategory(QLatin1String(ProjectExplorer::Constants::PROJECT_WIZARD_CATEGORY));
parameters.setTrCategory(QCoreApplication::translate("ProjectExplorer", ProjectExplorer::Constants::PROJECT_WIZARD_TR_CATEGORY));
parameters.setDisplayCategory(QCoreApplication::translate("ProjectExplorer", ProjectExplorer::Constants::PROJECT_WIZARD_TR_CATEGORY));
return parameters;
}

View File

@@ -1,3 +1,32 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** 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
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#include "qmltaskmanager.h"
#include "qmlprojectconstants.h"
#include <QDebug>
@@ -21,6 +50,7 @@ void QmlTaskManager::setTaskWindow(ProjectExplorer::TaskWindow *taskWindow)
void QmlTaskManager::documentUpdated(QmlEditor::QmlDocument::Ptr doc)
{
#if 0 // This will give way too many flickering errors in the build-results pane *when you're typing*
m_taskWindow->clearTasks(Constants::TASK_CATEGORY_QML);
foreach (const QmlJS::DiagnosticMessage &msg, doc->diagnosticMessages()) {
@@ -32,6 +62,7 @@ void QmlTaskManager::documentUpdated(QmlEditor::QmlDocument::Ptr doc)
Constants::TASK_CATEGORY_QML);
m_taskWindow->addTask(task);
}
#endif
}
} // Internal

View File

@@ -1,3 +1,32 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** 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
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef QMLTASKMANAGER_H
#define QMLTASKMANAGER_H