summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/declarative/extra/extra.pri6
-rw-r--r--src/declarative/extra/qmltimer.cpp97
-rw-r--r--src/declarative/extra/qmltimer.h80
-rw-r--r--src/declarative/fx/qfxflickable.h2
-rw-r--r--src/declarative/fx/qfxgridview.h2
-rw-r--r--src/declarative/qml/qmlcomponent.h4
6 files changed, 185 insertions, 6 deletions
diff --git a/src/declarative/extra/extra.pri b/src/declarative/extra/extra.pri
index 83978f1..2590fbc 100644
--- a/src/declarative/extra/extra.pri
+++ b/src/declarative/extra/extra.pri
@@ -1,12 +1,14 @@
SOURCES += \
extra/qnumberformat.cpp \
extra/qmlnumberformatter.cpp \
- extra/qfxintegermodel.cpp
+ extra/qfxintegermodel.cpp \
+ extra/qmltimer.cpp
HEADERS += \
extra/qnumberformat.h \
extra/qmlnumberformatter.h \
- extra/qfxintegermodel.h
+ extra/qfxintegermodel.h \
+ extra/qmltimer.h
contains(QT_CONFIG, xmlpatterns) {
QT+=xmlpatterns
diff --git a/src/declarative/extra/qmltimer.cpp b/src/declarative/extra/qmltimer.cpp
new file mode 100644
index 0000000..1e1a6de
--- /dev/null
+++ b/src/declarative/extra/qmltimer.cpp
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "QtCore/qpauseanimation.h"
+#include "private/qobject_p.h"
+#include "qmltimer.h"
+#include "qdebug.h"
+
+QT_BEGIN_NAMESPACE
+
+QML_DEFINE_TYPE(QmlTimer,Timer)
+
+class QmlTimerPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QmlTimer)
+public:
+ QmlTimerPrivate() : interval(1000) {}
+ int interval;
+ QPauseAnimation pause;
+};
+
+QmlTimer::QmlTimer(QObject *parent)
+ : QObject(*(new QmlTimerPrivate), parent)
+{
+ Q_D(QmlTimer);
+ connect(&d->pause, SIGNAL(currentLoopChanged(int)), this, SLOT(ticked()));
+ d->pause.setLoopCount(-1);
+ d->pause.setDuration(d->interval);
+}
+
+void QmlTimer::setInterval(int interval)
+{
+ Q_D(QmlTimer);
+ if (interval != d->interval) {
+ d->interval = interval;
+ d->pause.setDuration(d->interval);
+ d->pause.start();
+ }
+}
+
+int QmlTimer::interval() const
+{
+ Q_D(const QmlTimer);
+ return d->interval;
+}
+
+void QmlTimer::componentComplete()
+{
+ Q_D(QmlTimer);
+ if (d->pause.state() != QAbstractAnimation::Running)
+ d->pause.start();
+}
+
+void QmlTimer::ticked()
+{
+ emit timeout();
+}
+
+QT_END_NAMESPACE
diff --git a/src/declarative/extra/qmltimer.h b/src/declarative/extra/qmltimer.h
new file mode 100644
index 0000000..75603c6
--- /dev/null
+++ b/src/declarative/extra/qmltimer.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMLTIMER_H
+#define QMLTIMER_H
+
+#include <QtDeclarative/qfxglobal.h>
+#include <QtCore/qobject.h>
+#include <QtDeclarative/qml.h>
+
+QT_BEGIN_HEADER
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Declarative)
+
+class QmlTimerPrivate;
+class Q_DECLARATIVE_EXPORT QmlTimer : public QObject, public QmlParserStatus
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QmlTimer)
+ Q_PROPERTY(int interval READ interval WRITE setInterval)
+
+public:
+ QmlTimer(QObject *parent=0);
+
+ void setInterval(int interval);
+ int interval() const;
+
+protected:
+ void componentComplete();
+
+Q_SIGNALS:
+ void timeout();
+
+private Q_SLOTS:
+ void ticked();
+};
+QML_DECLARE_TYPE(QmlTimer)
+
+QT_END_NAMESPACE
+QT_END_HEADER
+#endif
diff --git a/src/declarative/fx/qfxflickable.h b/src/declarative/fx/qfxflickable.h
index 77aaf50..2c858bc 100644
--- a/src/declarative/fx/qfxflickable.h
+++ b/src/declarative/fx/qfxflickable.h
@@ -115,7 +115,7 @@ public:
bool isLocked() const;
void setLocked(bool);
- Q_ENUMS(DragMode);
+ Q_ENUMS(DragMode)
enum DragMode { Hard, Elastic };
DragMode dragMode() const;
void setDragMode(DragMode mode);
diff --git a/src/declarative/fx/qfxgridview.h b/src/declarative/fx/qfxgridview.h
index 1514451..19c21c4 100644
--- a/src/declarative/fx/qfxgridview.h
+++ b/src/declarative/fx/qfxgridview.h
@@ -92,7 +92,7 @@ public:
bool autoHighlight() const;
void setAutoHighlight(bool);
- Q_ENUMS(Flow);
+ Q_ENUMS(Flow)
enum Flow { LeftToRight, TopToBottom };
Flow flow() const;
void setFlow(Flow);
diff --git a/src/declarative/qml/qmlcomponent.h b/src/declarative/qml/qmlcomponent.h
index fe0c422..ae2f362 100644
--- a/src/declarative/qml/qmlcomponent.h
+++ b/src/declarative/qml/qmlcomponent.h
@@ -71,7 +71,7 @@ public:
const QUrl &baseUrl=QUrl(), QObject *parent=0);
virtual ~QmlComponent();
- Q_ENUMS( Status );
+ Q_ENUMS(Status)
enum Status { Null, Ready, Loading, Error };
Status status() const;
@@ -104,7 +104,7 @@ private:
friend class QmlVME;
friend struct QmlCompositeTypeData;
};
-Q_DECLARE_METATYPE(QmlComponent::Status);
+Q_DECLARE_METATYPE(QmlComponent::Status)
QML_DECLARE_TYPE(QmlComponent)
QT_END_NAMESPACE