diff --git a/share/qtcreator/templates/wizards/qml-runtime/object.cpp b/share/qtcreator/templates/wizards/qml-runtime/object.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f2d9eb39d08033e639662ac86fbc7f02204d4049 --- /dev/null +++ b/share/qtcreator/templates/wizards/qml-runtime/object.cpp @@ -0,0 +1,63 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2010 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 <QtCore/QTime> +#include <QtDeclarative/qdeclarative.h> + +#include "%ObjectName%.h" + +%ObjectName%::%ObjectName%(QObject *parent): + QObject(parent) +{ + timer = new QTimer(this); + timer->setInterval(750); + connect(timer, SIGNAL(timeout()), this, SLOT(timerFired())); + timer->start(); +} + +QString %ObjectName%::text() const +{ + return theText; +} + +void %ObjectName%::setText(const QString &text) +{ + if (theText != text) { + theText = text; + emit textChanged(theText); + } +} + +void %ObjectName%::timerFired() +{ + QTime t = QTime::currentTime(); + setText(t.toString(QLatin1String("HH:mm:ss"))); +} + +QML_DECLARE_TYPE(%ObjectName%); diff --git a/share/qtcreator/templates/wizards/qml-runtime/object.h b/share/qtcreator/templates/wizards/qml-runtime/object.h new file mode 100644 index 0000000000000000000000000000000000000000..50898b454ce4076bd8d3f17ba2017eaff869e68d --- /dev/null +++ b/share/qtcreator/templates/wizards/qml-runtime/object.h @@ -0,0 +1,62 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2010 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 EXAMPLEITEM_H +#define EXAMPLEITEM_H + +#include <QtCore/QObject> +#include <QtCore/QString> +#include <QtCore/QTimer> + +class %ObjectName% : public QObject +{ + Q_OBJECT + + Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) + +public: + %ObjectName%(QObject *parent = 0); + + QString text() const; + void setText(const QString &text); + +signals: + void textChanged(const QString &newText); + +private slots: + void timerFired(); + +private: + QString theText; + QTimer *timer; + + Q_DISABLE_COPY(%ObjectName%) +}; + +#endif // EXAMPLEITEM_H diff --git a/share/qtcreator/templates/wizards/qml-runtime/plugin.cpp b/share/qtcreator/templates/wizards/qml-runtime/plugin.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ec2a0a1d50efb8bebdb7db70075585e41bad3154 --- /dev/null +++ b/share/qtcreator/templates/wizards/qml-runtime/plugin.cpp @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "%ProjectName%.h" +#include "%ObjectName%.h" + +void %ProjectName%::registerTypes(const char *uri) +{ + Q_UNUSED(uri); + + QML_REGISTER_TYPE(%ProjectName%,1,0,%ObjectName%,%ObjectName%); +} + +Q_EXPORT_PLUGIN(%ProjectName%); diff --git a/share/qtcreator/templates/wizards/qml-runtime/plugin.h b/share/qtcreator/templates/wizards/qml-runtime/plugin.h new file mode 100644 index 0000000000000000000000000000000000000000..d42a3c51239fc6be0ac4db2cf7e48103f4a1463f --- /dev/null +++ b/share/qtcreator/templates/wizards/qml-runtime/plugin.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef EXAMPLECOREPLUGIN_H +#define EXAMPLECOREPLUGIN_H + +#include <QtDeclarative/qdeclarative.h> +#include <QtDeclarative/QDeclarativeExtensionPlugin> + +class %ProjectName% : public QDeclarativeExtensionPlugin +{ + Q_OBJECT + +public: + void registerTypes(const char *uri); +}; + +#endif // EXAMPLECOREPLUGIN_H diff --git a/share/qtcreator/templates/wizards/qml-runtime/project.pro b/share/qtcreator/templates/wizards/qml-runtime/project.pro new file mode 100644 index 0000000000000000000000000000000000000000..72bb0c1e0e3e597c20771c883b8d98eeda3f6afb --- /dev/null +++ b/share/qtcreator/templates/wizards/qml-runtime/project.pro @@ -0,0 +1,18 @@ +TEMPLATE = lib +TARGET = %ProjectName% +QT += declarative +CONFIG += qt plugin + +TARGET = $$qtLibraryTarget($$TARGET) +DESTDIR = %ProjectName% + +# Input +SOURCES += \ + %ProjectName%.cpp \ + %ObjectName%.cpp + +OTHER_FILES=%ProjectName%/qmldir + +HEADERS += \ + %ProjectName%.h \ + %ObjectName%.h diff --git a/share/qtcreator/templates/wizards/qml-runtime/qmldir b/share/qtcreator/templates/wizards/qml-runtime/qmldir new file mode 100644 index 0000000000000000000000000000000000000000..ee07ff6b101cdf13a5b717960901eecade844126 --- /dev/null +++ b/share/qtcreator/templates/wizards/qml-runtime/qmldir @@ -0,0 +1 @@ +plugin %ProjectName% diff --git a/share/qtcreator/templates/wizards/qml-runtime/wizard.xml b/share/qtcreator/templates/wizards/qml-runtime/wizard.xml new file mode 100644 index 0000000000000000000000000000000000000000..14db77f70e3ba71411194cebde280fc0261b6d9d --- /dev/null +++ b/share/qtcreator/templates/wizards/qml-runtime/wizard.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2010 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. +** +**************************************************************************/ + +Custom project wizard configuration example file. Note that by convention, +the project file goes last. +The "class" and "firstpage" attributes specify that it is a Qt 4 wizard and +leave room for the Qt 4 target page. +--> +<wizard version="1" kind="project" + class="qt4project" firstpage="10" + id="QmlRuntimePlugin" category="F.Projects"> + <description>Creates a plug-in for the QML runtime.</description> + <displayName>QML Runtime Plug-in</displayName> + <displayCategory>QML Runtime Plug-in</displayCategory> + <files> + <file source="qmldir" target="%ProjectName%/qmldir"/> + <file source="plugin.h" target="%ProjectName%.h"/> + <file source="plugin.cpp" target="%ProjectName%.cpp"/> + <file source="object.h" target="%ObjectName%.h"/> + <file source="object.cpp" target="%ObjectName%.cpp"/> + <file source="project.pro" target="%ProjectName%.pro"/> + </files> + <!-- Create a 2nd wizard page with parameters --> + <fieldpagetitle>QML Runtime Plug-in Parameters</fieldpagetitle> + <fields> + <field mandatory="false" name="ObjectName"> + <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9_]+$' defaulttext="ExampleObject"/> + <fielddescription>Example Object Class-name:</fielddescription> + </field> + </fields> +</wizard>