@@ -1,4 +1,4 | |||
|
1 |
// checksum 0x |
|
|
1 | // checksum 0xbd34 version 0x80016 | |
|
2 | 2 | /* |
|
3 | 3 | This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
4 | 4 | QmlApplicationViewer is a convenience class containing mobile device specific |
@@ -10,12 +10,12 | |||
|
10 | 10 | |
|
11 | 11 | #include "qmlapplicationviewer.h" |
|
12 | 12 | |
|
13 |
#include <Q |
|
|
14 |
#include <Q |
|
|
15 | #include <QtDeclarative/QDeclarativeComponent> | |
|
16 | #include <QtDeclarative/QDeclarativeEngine> | |
|
17 | #include <QtDeclarative/QDeclarativeContext> | |
|
13 | #include <QDir> | |
|
14 | #include <QFileInfo> | |
|
18 | 15 | #include <QApplication> |
|
16 | #include <QDeclarativeComponent> | |
|
17 | #include <QDeclarativeEngine> | |
|
18 | #include <QDeclarativeContext> | |
|
19 | 19 | |
|
20 | 20 | #include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN |
|
21 | 21 | |
@@ -50,63 +50,47 static QmlJsDebuggingEnabler enableDebuggingHelper; | |||
|
50 | 50 | |
|
51 | 51 | class QmlApplicationViewerPrivate |
|
52 | 52 | { |
|
53 | QmlApplicationViewerPrivate(QDeclarativeView *view_) : view(view_) {} | |
|
54 | ||
|
55 | 53 | QString mainQmlFile; |
|
56 | QDeclarativeView *view; | |
|
57 | 54 | friend class QmlApplicationViewer; |
|
58 | QString adjustPath(const QString &path); | |
|
55 | static QString adjustPath(const QString &path); | |
|
59 | 56 | }; |
|
60 | 57 | |
|
61 | 58 | QString QmlApplicationViewerPrivate::adjustPath(const QString &path) |
|
62 | 59 | { |
|
63 | #ifdef Q_OS_UNIX | |
|
64 | 60 | #ifdef Q_OS_MAC |
|
65 | 61 | if (!QDir::isAbsolutePath(path)) |
|
66 | return QCoreApplication::applicationDirPath() | |
|
67 | + QLatin1String("/../Resources/") + path; | |
|
68 | #else | |
|
69 | QString pathInInstallDir; | |
|
70 | const QString applicationDirPath = QCoreApplication::applicationDirPath(); | |
|
71 | pathInInstallDir = QString::fromAscii("%1/../%2").arg(applicationDirPath, path); | |
|
72 | ||
|
62 | return QString::fromLatin1("%1/../Resources/%2") | |
|
63 | .arg(QCoreApplication::applicationDirPath(), path); | |
|
64 | #elif defined(Q_OS_QNX) | |
|
65 | if (!QDir::isAbsolutePath(path)) | |
|
66 | return QString::fromLatin1("app/native/%1").arg(path); | |
|
67 | #elif !defined(Q_OS_ANDROID) | |
|
68 | QString pathInInstallDir = | |
|
69 | QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); | |
|
70 | if (QFileInfo(pathInInstallDir).exists()) | |
|
71 | return pathInInstallDir; | |
|
72 | pathInInstallDir = | |
|
73 | QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path); | |
|
73 | 74 | if (QFileInfo(pathInInstallDir).exists()) |
|
74 | 75 | return pathInInstallDir; |
|
75 | #endif | |
|
76 | 76 | #endif |
|
77 | 77 | return path; |
|
78 | 78 | } |
|
79 | 79 | |
|
80 | 80 | QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) |
|
81 | 81 | : QDeclarativeView(parent) |
|
82 |
, d(new QmlApplicationViewerPrivate( |
|
|
82 | , d(new QmlApplicationViewerPrivate()) | |
|
83 | 83 | { |
|
84 | 84 | connect(engine(), SIGNAL(quit()), SLOT(close())); |
|
85 | 85 | setResizeMode(QDeclarativeView::SizeRootObjectToView); |
|
86 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in | |
|
87 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 | |
|
88 | #if !defined(NO_JSDEBUGGER) | |
|
89 | new QmlJSDebugger::JSDebuggerAgent(d->view->engine()); | |
|
90 | #endif | |
|
91 | #if !defined(NO_QMLOBSERVER) | |
|
92 | new QmlJSDebugger::QDeclarativeViewObserver(d->view, d->view); | |
|
93 | #endif | |
|
94 | #endif | |
|
95 | } | |
|
96 | 86 | |
|
97 | QmlApplicationViewer::QmlApplicationViewer(QDeclarativeView *view, QWidget *parent) | |
|
98 | : QDeclarativeView(parent) | |
|
99 | , d(new QmlApplicationViewerPrivate(view)) | |
|
100 | { | |
|
101 | connect(view->engine(), SIGNAL(quit()), view, SLOT(close())); | |
|
102 | view->setResizeMode(QDeclarativeView::SizeRootObjectToView); | |
|
103 | 87 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in |
|
104 | 88 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 |
|
105 | 89 | #if !defined(NO_JSDEBUGGER) |
|
106 |
new QmlJSDebugger::JSDebuggerAgent( |
|
|
90 | new QmlJSDebugger::JSDebuggerAgent(engine()); | |
|
107 | 91 | #endif |
|
108 | 92 | #if !defined(NO_QMLOBSERVER) |
|
109 |
new QmlJSDebugger::QDeclarativeViewObserver( |
|
|
93 | new QmlJSDebugger::QDeclarativeViewObserver(this, this); | |
|
110 | 94 | #endif |
|
111 | 95 | #endif |
|
112 | 96 | } |
@@ -118,75 +102,68 QmlApplicationViewer::~QmlApplicationViewer() | |||
|
118 | 102 | |
|
119 | 103 | QmlApplicationViewer *QmlApplicationViewer::create() |
|
120 | 104 | { |
|
121 | #ifdef HARMATTAN_BOOSTER | |
|
122 | return new QmlApplicationViewer(MDeclarativeCache::qDeclarativeView(), 0); | |
|
123 | #else | |
|
124 | 105 | return new QmlApplicationViewer(); |
|
125 | #endif | |
|
126 | 106 | } |
|
127 | 107 | |
|
128 | 108 | void QmlApplicationViewer::setMainQmlFile(const QString &file) |
|
129 | 109 | { |
|
130 |
d->mainQmlFile = |
|
|
131 | d->view->setSource(QUrl::fromLocalFile(d->mainQmlFile)); | |
|
110 | d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); | |
|
111 | #ifdef Q_OS_ANDROID | |
|
112 | setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile)); | |
|
113 | #else | |
|
114 | setSource(QUrl::fromLocalFile(d->mainQmlFile)); | |
|
115 | #endif | |
|
132 | 116 | } |
|
133 | 117 | |
|
134 | 118 | void QmlApplicationViewer::addImportPath(const QString &path) |
|
135 | 119 | { |
|
136 |
|
|
|
120 | engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); | |
|
137 | 121 | } |
|
138 | 122 | |
|
139 |
|
|
|
140 | //{ | |
|
141 | //#if defined(Q_OS_SYMBIAN) | |
|
142 | // // If the version of Qt on the device is < 4.7.2, that attribute won't work | |
|
143 | // if (orientation != ScreenOrientationAuto) { | |
|
144 | // const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.')); | |
|
145 | // if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { | |
|
146 | // qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); | |
|
147 | // return; | |
|
148 |
|
|
|
149 | // } | |
|
150 | //#endif // Q_OS_SYMBIAN | |
|
151 | ||
|
152 | // Qt::WidgetAttribute attribute; | |
|
153 | // switch (orientation) { | |
|
154 | //#if QT_VERSION < 0x040702 | |
|
155 | // // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |
|
156 | // case ScreenOrientationLockPortrait: | |
|
157 | // attribute = static_cast<Qt::WidgetAttribute>(128); | |
|
158 | // break; | |
|
159 | // case ScreenOrientationLockLandscape: | |
|
160 | // attribute = static_cast<Qt::WidgetAttribute>(129); | |
|
161 | // break; | |
|
162 | // default: | |
|
163 | // case ScreenOrientationAuto: | |
|
164 | // attribute = static_cast<Qt::WidgetAttribute>(130); | |
|
165 | // break; | |
|
166 | //#else // QT_VERSION < 0x040702 | |
|
167 | // case ScreenOrientationLockPortrait: | |
|
168 | // attribute = Qt::WA_LockPortraitOrientation; | |
|
169 | // break; | |
|
170 | // case ScreenOrientationLockLandscape: | |
|
171 | // attribute = Qt::WA_LockLandscapeOrientation; | |
|
172 | // break; | |
|
173 | // default: | |
|
174 | // case ScreenOrientationAuto: | |
|
175 | // attribute = Qt::WA_AutoOrientation; | |
|
176 | // break; | |
|
177 | //#endif // QT_VERSION < 0x040702 | |
|
178 | // }; | |
|
179 | // setAttribute(attribute, true); | |
|
180 | //} | |
|
123 | void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) | |
|
124 | { | |
|
125 | #if QT_VERSION < 0x050000 | |
|
126 | Qt::WidgetAttribute attribute; | |
|
127 | switch (orientation) { | |
|
128 | #if QT_VERSION < 0x040702 | |
|
129 | // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |
|
130 | case ScreenOrientationLockPortrait: | |
|
131 | attribute = static_cast<Qt::WidgetAttribute>(128); | |
|
132 | break; | |
|
133 | case ScreenOrientationLockLandscape: | |
|
134 | attribute = static_cast<Qt::WidgetAttribute>(129); | |
|
135 | break; | |
|
136 | default: | |
|
137 | case ScreenOrientationAuto: | |
|
138 | attribute = static_cast<Qt::WidgetAttribute>(130); | |
|
139 | break; | |
|
140 | #else // QT_VERSION < 0x040702 | |
|
141 | case ScreenOrientationLockPortrait: | |
|
142 | attribute = Qt::WA_LockPortraitOrientation; | |
|
143 | break; | |
|
144 | case ScreenOrientationLockLandscape: | |
|
145 | attribute = Qt::WA_LockLandscapeOrientation; | |
|
146 | break; | |
|
147 | default: | |
|
148 | case ScreenOrientationAuto: | |
|
149 | attribute = Qt::WA_AutoOrientation; | |
|
150 | break; | |
|
151 | #endif // QT_VERSION < 0x040702 | |
|
152 | }; | |
|
153 | setAttribute(attribute, true); | |
|
154 | #else // QT_VERSION < 0x050000 | |
|
155 | Q_UNUSED(orientation) | |
|
156 | #endif // QT_VERSION < 0x050000 | |
|
157 | } | |
|
181 | 158 | |
|
182 | 159 | void QmlApplicationViewer::showExpanded() |
|
183 | 160 | { |
|
184 |
#if defined( |
|
|
185 |
|
|
|
186 | #elif defined(Q_WS_MAEMO_5) | |
|
187 |
|
|
|
161 | #if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR) | |
|
162 | showFullScreen(); | |
|
163 | #elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX) | |
|
164 | showMaximized(); | |
|
188 | 165 | #else |
|
189 |
|
|
|
166 | show(); | |
|
190 | 167 | #endif |
|
191 | 168 | } |
|
192 | 169 |
@@ -1,4 +1,4 | |||
|
1 |
// checksum 0x |
|
|
1 | // checksum 0xc67a version 0x80016 | |
|
2 | 2 | /* |
|
3 | 3 | This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
4 | 4 | QmlApplicationViewer is a convenience class containing mobile device specific |
@@ -11,7 +11,7 | |||
|
11 | 11 | #ifndef QMLAPPLICATIONVIEWER_H |
|
12 | 12 | #define QMLAPPLICATIONVIEWER_H |
|
13 | 13 | |
|
14 |
#include <Q |
|
|
14 | #include <QDeclarativeView> | |
|
15 | 15 | |
|
16 | 16 | class QmlApplicationViewer : public QDeclarativeView |
|
17 | 17 | { |
@@ -32,13 +32,12 public: | |||
|
32 | 32 | void setMainQmlFile(const QString &file); |
|
33 | 33 | void addImportPath(const QString &path); |
|
34 | 34 | |
|
35 |
// Note that this will only have an effect on |
|
|
36 |
|
|
|
35 | // Note that this will only have an effect on Fremantle. | |
|
36 | void setOrientation(ScreenOrientation orientation); | |
|
37 | 37 | |
|
38 | 38 | void showExpanded(); |
|
39 | 39 | |
|
40 | 40 | private: |
|
41 | explicit QmlApplicationViewer(QDeclarativeView *view, QWidget *parent); | |
|
42 | 41 | class QmlApplicationViewerPrivate *d; |
|
43 | 42 | }; |
|
44 | 43 |
@@ -1,4 +1,4 | |||
|
1 |
// checksum 0x |
|
|
1 | // checksum 0xbd34 version 0x80016 | |
|
2 | 2 | /* |
|
3 | 3 | This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
4 | 4 | QmlApplicationViewer is a convenience class containing mobile device specific |
@@ -10,12 +10,12 | |||
|
10 | 10 | |
|
11 | 11 | #include "qmlapplicationviewer.h" |
|
12 | 12 | |
|
13 |
#include <Q |
|
|
14 |
#include <Q |
|
|
15 | #include <QtDeclarative/QDeclarativeComponent> | |
|
16 | #include <QtDeclarative/QDeclarativeEngine> | |
|
17 | #include <QtDeclarative/QDeclarativeContext> | |
|
13 | #include <QDir> | |
|
14 | #include <QFileInfo> | |
|
18 | 15 | #include <QApplication> |
|
16 | #include <QDeclarativeComponent> | |
|
17 | #include <QDeclarativeEngine> | |
|
18 | #include <QDeclarativeContext> | |
|
19 | 19 | |
|
20 | 20 | #include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN |
|
21 | 21 | |
@@ -50,63 +50,47 static QmlJsDebuggingEnabler enableDebuggingHelper; | |||
|
50 | 50 | |
|
51 | 51 | class QmlApplicationViewerPrivate |
|
52 | 52 | { |
|
53 | QmlApplicationViewerPrivate(QDeclarativeView *view_) : view(view_) {} | |
|
54 | ||
|
55 | 53 | QString mainQmlFile; |
|
56 | QDeclarativeView *view; | |
|
57 | 54 | friend class QmlApplicationViewer; |
|
58 | QString adjustPath(const QString &path); | |
|
55 | static QString adjustPath(const QString &path); | |
|
59 | 56 | }; |
|
60 | 57 | |
|
61 | 58 | QString QmlApplicationViewerPrivate::adjustPath(const QString &path) |
|
62 | 59 | { |
|
63 | #ifdef Q_OS_UNIX | |
|
64 | 60 | #ifdef Q_OS_MAC |
|
65 | 61 | if (!QDir::isAbsolutePath(path)) |
|
66 | return QCoreApplication::applicationDirPath() | |
|
67 | + QLatin1String("/../Resources/") + path; | |
|
68 | #else | |
|
69 | QString pathInInstallDir; | |
|
70 | const QString applicationDirPath = QCoreApplication::applicationDirPath(); | |
|
71 | pathInInstallDir = QString::fromAscii("%1/../%2").arg(applicationDirPath, path); | |
|
72 | ||
|
62 | return QString::fromLatin1("%1/../Resources/%2") | |
|
63 | .arg(QCoreApplication::applicationDirPath(), path); | |
|
64 | #elif defined(Q_OS_QNX) | |
|
65 | if (!QDir::isAbsolutePath(path)) | |
|
66 | return QString::fromLatin1("app/native/%1").arg(path); | |
|
67 | #elif !defined(Q_OS_ANDROID) | |
|
68 | QString pathInInstallDir = | |
|
69 | QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); | |
|
70 | if (QFileInfo(pathInInstallDir).exists()) | |
|
71 | return pathInInstallDir; | |
|
72 | pathInInstallDir = | |
|
73 | QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path); | |
|
73 | 74 | if (QFileInfo(pathInInstallDir).exists()) |
|
74 | 75 | return pathInInstallDir; |
|
75 | #endif | |
|
76 | 76 | #endif |
|
77 | 77 | return path; |
|
78 | 78 | } |
|
79 | 79 | |
|
80 | 80 | QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) |
|
81 | 81 | : QDeclarativeView(parent) |
|
82 |
, d(new QmlApplicationViewerPrivate( |
|
|
82 | , d(new QmlApplicationViewerPrivate()) | |
|
83 | 83 | { |
|
84 | 84 | connect(engine(), SIGNAL(quit()), SLOT(close())); |
|
85 | 85 | setResizeMode(QDeclarativeView::SizeRootObjectToView); |
|
86 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in | |
|
87 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 | |
|
88 | #if !defined(NO_JSDEBUGGER) | |
|
89 | new QmlJSDebugger::JSDebuggerAgent(d->view->engine()); | |
|
90 | #endif | |
|
91 | #if !defined(NO_QMLOBSERVER) | |
|
92 | new QmlJSDebugger::QDeclarativeViewObserver(d->view, d->view); | |
|
93 | #endif | |
|
94 | #endif | |
|
95 | } | |
|
96 | 86 | |
|
97 | QmlApplicationViewer::QmlApplicationViewer(QDeclarativeView *view, QWidget *parent) | |
|
98 | : QDeclarativeView(parent) | |
|
99 | , d(new QmlApplicationViewerPrivate(view)) | |
|
100 | { | |
|
101 | connect(view->engine(), SIGNAL(quit()), view, SLOT(close())); | |
|
102 | view->setResizeMode(QDeclarativeView::SizeRootObjectToView); | |
|
103 | 87 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in |
|
104 | 88 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 |
|
105 | 89 | #if !defined(NO_JSDEBUGGER) |
|
106 |
new QmlJSDebugger::JSDebuggerAgent( |
|
|
90 | new QmlJSDebugger::JSDebuggerAgent(engine()); | |
|
107 | 91 | #endif |
|
108 | 92 | #if !defined(NO_QMLOBSERVER) |
|
109 |
new QmlJSDebugger::QDeclarativeViewObserver( |
|
|
93 | new QmlJSDebugger::QDeclarativeViewObserver(this, this); | |
|
110 | 94 | #endif |
|
111 | 95 | #endif |
|
112 | 96 | } |
@@ -118,75 +102,68 QmlApplicationViewer::~QmlApplicationViewer() | |||
|
118 | 102 | |
|
119 | 103 | QmlApplicationViewer *QmlApplicationViewer::create() |
|
120 | 104 | { |
|
121 | #ifdef HARMATTAN_BOOSTER | |
|
122 | return new QmlApplicationViewer(MDeclarativeCache::qDeclarativeView(), 0); | |
|
123 | #else | |
|
124 | 105 | return new QmlApplicationViewer(); |
|
125 | #endif | |
|
126 | 106 | } |
|
127 | 107 | |
|
128 | 108 | void QmlApplicationViewer::setMainQmlFile(const QString &file) |
|
129 | 109 | { |
|
130 |
d->mainQmlFile = |
|
|
131 | d->view->setSource(QUrl::fromLocalFile(d->mainQmlFile)); | |
|
110 | d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); | |
|
111 | #ifdef Q_OS_ANDROID | |
|
112 | setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile)); | |
|
113 | #else | |
|
114 | setSource(QUrl::fromLocalFile(d->mainQmlFile)); | |
|
115 | #endif | |
|
132 | 116 | } |
|
133 | 117 | |
|
134 | 118 | void QmlApplicationViewer::addImportPath(const QString &path) |
|
135 | 119 | { |
|
136 |
|
|
|
120 | engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); | |
|
137 | 121 | } |
|
138 | 122 | |
|
139 |
|
|
|
140 | //{ | |
|
141 | //#if defined(Q_OS_SYMBIAN) | |
|
142 | // // If the version of Qt on the device is < 4.7.2, that attribute won't work | |
|
143 | // if (orientation != ScreenOrientationAuto) { | |
|
144 | // const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.')); | |
|
145 | // if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { | |
|
146 | // qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); | |
|
147 | // return; | |
|
148 |
|
|
|
149 | // } | |
|
150 | //#endif // Q_OS_SYMBIAN | |
|
151 | ||
|
152 | // Qt::WidgetAttribute attribute; | |
|
153 | // switch (orientation) { | |
|
154 | //#if QT_VERSION < 0x040702 | |
|
155 | // // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |
|
156 | // case ScreenOrientationLockPortrait: | |
|
157 | // attribute = static_cast<Qt::WidgetAttribute>(128); | |
|
158 | // break; | |
|
159 | // case ScreenOrientationLockLandscape: | |
|
160 | // attribute = static_cast<Qt::WidgetAttribute>(129); | |
|
161 | // break; | |
|
162 | // default: | |
|
163 | // case ScreenOrientationAuto: | |
|
164 | // attribute = static_cast<Qt::WidgetAttribute>(130); | |
|
165 | // break; | |
|
166 | //#else // QT_VERSION < 0x040702 | |
|
167 | // case ScreenOrientationLockPortrait: | |
|
168 | // attribute = Qt::WA_LockPortraitOrientation; | |
|
169 | // break; | |
|
170 | // case ScreenOrientationLockLandscape: | |
|
171 | // attribute = Qt::WA_LockLandscapeOrientation; | |
|
172 | // break; | |
|
173 | // default: | |
|
174 | // case ScreenOrientationAuto: | |
|
175 | // attribute = Qt::WA_AutoOrientation; | |
|
176 | // break; | |
|
177 | //#endif // QT_VERSION < 0x040702 | |
|
178 | // }; | |
|
179 | // setAttribute(attribute, true); | |
|
180 | //} | |
|
123 | void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) | |
|
124 | { | |
|
125 | #if QT_VERSION < 0x050000 | |
|
126 | Qt::WidgetAttribute attribute; | |
|
127 | switch (orientation) { | |
|
128 | #if QT_VERSION < 0x040702 | |
|
129 | // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |
|
130 | case ScreenOrientationLockPortrait: | |
|
131 | attribute = static_cast<Qt::WidgetAttribute>(128); | |
|
132 | break; | |
|
133 | case ScreenOrientationLockLandscape: | |
|
134 | attribute = static_cast<Qt::WidgetAttribute>(129); | |
|
135 | break; | |
|
136 | default: | |
|
137 | case ScreenOrientationAuto: | |
|
138 | attribute = static_cast<Qt::WidgetAttribute>(130); | |
|
139 | break; | |
|
140 | #else // QT_VERSION < 0x040702 | |
|
141 | case ScreenOrientationLockPortrait: | |
|
142 | attribute = Qt::WA_LockPortraitOrientation; | |
|
143 | break; | |
|
144 | case ScreenOrientationLockLandscape: | |
|
145 | attribute = Qt::WA_LockLandscapeOrientation; | |
|
146 | break; | |
|
147 | default: | |
|
148 | case ScreenOrientationAuto: | |
|
149 | attribute = Qt::WA_AutoOrientation; | |
|
150 | break; | |
|
151 | #endif // QT_VERSION < 0x040702 | |
|
152 | }; | |
|
153 | setAttribute(attribute, true); | |
|
154 | #else // QT_VERSION < 0x050000 | |
|
155 | Q_UNUSED(orientation) | |
|
156 | #endif // QT_VERSION < 0x050000 | |
|
157 | } | |
|
181 | 158 | |
|
182 | 159 | void QmlApplicationViewer::showExpanded() |
|
183 | 160 | { |
|
184 |
#if defined( |
|
|
185 |
|
|
|
186 | #elif defined(Q_WS_MAEMO_5) | |
|
187 |
|
|
|
161 | #if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR) | |
|
162 | showFullScreen(); | |
|
163 | #elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX) | |
|
164 | showMaximized(); | |
|
188 | 165 | #else |
|
189 |
|
|
|
166 | show(); | |
|
190 | 167 | #endif |
|
191 | 168 | } |
|
192 | 169 |
@@ -1,4 +1,4 | |||
|
1 |
// checksum 0x |
|
|
1 | // checksum 0xc67a version 0x80016 | |
|
2 | 2 | /* |
|
3 | 3 | This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
4 | 4 | QmlApplicationViewer is a convenience class containing mobile device specific |
@@ -11,7 +11,7 | |||
|
11 | 11 | #ifndef QMLAPPLICATIONVIEWER_H |
|
12 | 12 | #define QMLAPPLICATIONVIEWER_H |
|
13 | 13 | |
|
14 |
#include <Q |
|
|
14 | #include <QDeclarativeView> | |
|
15 | 15 | |
|
16 | 16 | class QmlApplicationViewer : public QDeclarativeView |
|
17 | 17 | { |
@@ -32,13 +32,12 public: | |||
|
32 | 32 | void setMainQmlFile(const QString &file); |
|
33 | 33 | void addImportPath(const QString &path); |
|
34 | 34 | |
|
35 |
// Note that this will only have an effect on |
|
|
36 |
|
|
|
35 | // Note that this will only have an effect on Fremantle. | |
|
36 | void setOrientation(ScreenOrientation orientation); | |
|
37 | 37 | |
|
38 | 38 | void showExpanded(); |
|
39 | 39 | |
|
40 | 40 | private: |
|
41 | explicit QmlApplicationViewer(QDeclarativeView *view, QWidget *parent); | |
|
42 | 41 | class QmlApplicationViewerPrivate *d; |
|
43 | 42 | }; |
|
44 | 43 |
@@ -1,4 +1,4 | |||
|
1 |
// checksum 0x |
|
|
1 | // checksum 0xbd34 version 0x80016 | |
|
2 | 2 | /* |
|
3 | 3 | This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
4 | 4 | QmlApplicationViewer is a convenience class containing mobile device specific |
@@ -10,12 +10,12 | |||
|
10 | 10 | |
|
11 | 11 | #include "qmlapplicationviewer.h" |
|
12 | 12 | |
|
13 |
#include <Q |
|
|
14 |
#include <Q |
|
|
15 | #include <QtDeclarative/QDeclarativeComponent> | |
|
16 | #include <QtDeclarative/QDeclarativeEngine> | |
|
17 | #include <QtDeclarative/QDeclarativeContext> | |
|
13 | #include <QDir> | |
|
14 | #include <QFileInfo> | |
|
18 | 15 | #include <QApplication> |
|
16 | #include <QDeclarativeComponent> | |
|
17 | #include <QDeclarativeEngine> | |
|
18 | #include <QDeclarativeContext> | |
|
19 | 19 | |
|
20 | 20 | #include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN |
|
21 | 21 | |
@@ -50,63 +50,47 static QmlJsDebuggingEnabler enableDebuggingHelper; | |||
|
50 | 50 | |
|
51 | 51 | class QmlApplicationViewerPrivate |
|
52 | 52 | { |
|
53 | QmlApplicationViewerPrivate(QDeclarativeView *view_) : view(view_) {} | |
|
54 | ||
|
55 | 53 | QString mainQmlFile; |
|
56 | QDeclarativeView *view; | |
|
57 | 54 | friend class QmlApplicationViewer; |
|
58 | QString adjustPath(const QString &path); | |
|
55 | static QString adjustPath(const QString &path); | |
|
59 | 56 | }; |
|
60 | 57 | |
|
61 | 58 | QString QmlApplicationViewerPrivate::adjustPath(const QString &path) |
|
62 | 59 | { |
|
63 | #ifdef Q_OS_UNIX | |
|
64 | 60 | #ifdef Q_OS_MAC |
|
65 | 61 | if (!QDir::isAbsolutePath(path)) |
|
66 | return QCoreApplication::applicationDirPath() | |
|
67 | + QLatin1String("/../Resources/") + path; | |
|
68 | #else | |
|
69 | QString pathInInstallDir; | |
|
70 | const QString applicationDirPath = QCoreApplication::applicationDirPath(); | |
|
71 | pathInInstallDir = QString::fromAscii("%1/../%2").arg(applicationDirPath, path); | |
|
72 | ||
|
62 | return QString::fromLatin1("%1/../Resources/%2") | |
|
63 | .arg(QCoreApplication::applicationDirPath(), path); | |
|
64 | #elif defined(Q_OS_QNX) | |
|
65 | if (!QDir::isAbsolutePath(path)) | |
|
66 | return QString::fromLatin1("app/native/%1").arg(path); | |
|
67 | #elif !defined(Q_OS_ANDROID) | |
|
68 | QString pathInInstallDir = | |
|
69 | QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); | |
|
70 | if (QFileInfo(pathInInstallDir).exists()) | |
|
71 | return pathInInstallDir; | |
|
72 | pathInInstallDir = | |
|
73 | QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path); | |
|
73 | 74 | if (QFileInfo(pathInInstallDir).exists()) |
|
74 | 75 | return pathInInstallDir; |
|
75 | #endif | |
|
76 | 76 | #endif |
|
77 | 77 | return path; |
|
78 | 78 | } |
|
79 | 79 | |
|
80 | 80 | QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) |
|
81 | 81 | : QDeclarativeView(parent) |
|
82 |
, d(new QmlApplicationViewerPrivate( |
|
|
82 | , d(new QmlApplicationViewerPrivate()) | |
|
83 | 83 | { |
|
84 | 84 | connect(engine(), SIGNAL(quit()), SLOT(close())); |
|
85 | 85 | setResizeMode(QDeclarativeView::SizeRootObjectToView); |
|
86 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in | |
|
87 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 | |
|
88 | #if !defined(NO_JSDEBUGGER) | |
|
89 | new QmlJSDebugger::JSDebuggerAgent(d->view->engine()); | |
|
90 | #endif | |
|
91 | #if !defined(NO_QMLOBSERVER) | |
|
92 | new QmlJSDebugger::QDeclarativeViewObserver(d->view, d->view); | |
|
93 | #endif | |
|
94 | #endif | |
|
95 | } | |
|
96 | 86 | |
|
97 | QmlApplicationViewer::QmlApplicationViewer(QDeclarativeView *view, QWidget *parent) | |
|
98 | : QDeclarativeView(parent) | |
|
99 | , d(new QmlApplicationViewerPrivate(view)) | |
|
100 | { | |
|
101 | connect(view->engine(), SIGNAL(quit()), view, SLOT(close())); | |
|
102 | view->setResizeMode(QDeclarativeView::SizeRootObjectToView); | |
|
103 | 87 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in |
|
104 | 88 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 |
|
105 | 89 | #if !defined(NO_JSDEBUGGER) |
|
106 |
new QmlJSDebugger::JSDebuggerAgent( |
|
|
90 | new QmlJSDebugger::JSDebuggerAgent(engine()); | |
|
107 | 91 | #endif |
|
108 | 92 | #if !defined(NO_QMLOBSERVER) |
|
109 |
new QmlJSDebugger::QDeclarativeViewObserver( |
|
|
93 | new QmlJSDebugger::QDeclarativeViewObserver(this, this); | |
|
110 | 94 | #endif |
|
111 | 95 | #endif |
|
112 | 96 | } |
@@ -118,75 +102,68 QmlApplicationViewer::~QmlApplicationViewer() | |||
|
118 | 102 | |
|
119 | 103 | QmlApplicationViewer *QmlApplicationViewer::create() |
|
120 | 104 | { |
|
121 | #ifdef HARMATTAN_BOOSTER | |
|
122 | return new QmlApplicationViewer(MDeclarativeCache::qDeclarativeView(), 0); | |
|
123 | #else | |
|
124 | 105 | return new QmlApplicationViewer(); |
|
125 | #endif | |
|
126 | 106 | } |
|
127 | 107 | |
|
128 | 108 | void QmlApplicationViewer::setMainQmlFile(const QString &file) |
|
129 | 109 | { |
|
130 |
d->mainQmlFile = |
|
|
131 | d->view->setSource(QUrl::fromLocalFile(d->mainQmlFile)); | |
|
110 | d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); | |
|
111 | #ifdef Q_OS_ANDROID | |
|
112 | setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile)); | |
|
113 | #else | |
|
114 | setSource(QUrl::fromLocalFile(d->mainQmlFile)); | |
|
115 | #endif | |
|
132 | 116 | } |
|
133 | 117 | |
|
134 | 118 | void QmlApplicationViewer::addImportPath(const QString &path) |
|
135 | 119 | { |
|
136 |
|
|
|
120 | engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); | |
|
137 | 121 | } |
|
138 | 122 | |
|
139 |
|
|
|
140 | //{ | |
|
141 | //#if defined(Q_OS_SYMBIAN) | |
|
142 | // // If the version of Qt on the device is < 4.7.2, that attribute won't work | |
|
143 | // if (orientation != ScreenOrientationAuto) { | |
|
144 | // const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.')); | |
|
145 | // if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { | |
|
146 | // qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); | |
|
147 | // return; | |
|
148 |
|
|
|
149 | // } | |
|
150 | //#endif // Q_OS_SYMBIAN | |
|
151 | ||
|
152 | // Qt::WidgetAttribute attribute; | |
|
153 | // switch (orientation) { | |
|
154 | //#if QT_VERSION < 0x040702 | |
|
155 | // // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |
|
156 | // case ScreenOrientationLockPortrait: | |
|
157 | // attribute = static_cast<Qt::WidgetAttribute>(128); | |
|
158 | // break; | |
|
159 | // case ScreenOrientationLockLandscape: | |
|
160 | // attribute = static_cast<Qt::WidgetAttribute>(129); | |
|
161 | // break; | |
|
162 | // default: | |
|
163 | // case ScreenOrientationAuto: | |
|
164 | // attribute = static_cast<Qt::WidgetAttribute>(130); | |
|
165 | // break; | |
|
166 | //#else // QT_VERSION < 0x040702 | |
|
167 | // case ScreenOrientationLockPortrait: | |
|
168 | // attribute = Qt::WA_LockPortraitOrientation; | |
|
169 | // break; | |
|
170 | // case ScreenOrientationLockLandscape: | |
|
171 | // attribute = Qt::WA_LockLandscapeOrientation; | |
|
172 | // break; | |
|
173 | // default: | |
|
174 | // case ScreenOrientationAuto: | |
|
175 | // attribute = Qt::WA_AutoOrientation; | |
|
176 | // break; | |
|
177 | //#endif // QT_VERSION < 0x040702 | |
|
178 | // }; | |
|
179 | // setAttribute(attribute, true); | |
|
180 | //} | |
|
123 | void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) | |
|
124 | { | |
|
125 | #if QT_VERSION < 0x050000 | |
|
126 | Qt::WidgetAttribute attribute; | |
|
127 | switch (orientation) { | |
|
128 | #if QT_VERSION < 0x040702 | |
|
129 | // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |
|
130 | case ScreenOrientationLockPortrait: | |
|
131 | attribute = static_cast<Qt::WidgetAttribute>(128); | |
|
132 | break; | |
|
133 | case ScreenOrientationLockLandscape: | |
|
134 | attribute = static_cast<Qt::WidgetAttribute>(129); | |
|
135 | break; | |
|
136 | default: | |
|
137 | case ScreenOrientationAuto: | |
|
138 | attribute = static_cast<Qt::WidgetAttribute>(130); | |
|
139 | break; | |
|
140 | #else // QT_VERSION < 0x040702 | |
|
141 | case ScreenOrientationLockPortrait: | |
|
142 | attribute = Qt::WA_LockPortraitOrientation; | |
|
143 | break; | |
|
144 | case ScreenOrientationLockLandscape: | |
|
145 | attribute = Qt::WA_LockLandscapeOrientation; | |
|
146 | break; | |
|
147 | default: | |
|
148 | case ScreenOrientationAuto: | |
|
149 | attribute = Qt::WA_AutoOrientation; | |
|
150 | break; | |
|
151 | #endif // QT_VERSION < 0x040702 | |
|
152 | }; | |
|
153 | setAttribute(attribute, true); | |
|
154 | #else // QT_VERSION < 0x050000 | |
|
155 | Q_UNUSED(orientation) | |
|
156 | #endif // QT_VERSION < 0x050000 | |
|
157 | } | |
|
181 | 158 | |
|
182 | 159 | void QmlApplicationViewer::showExpanded() |
|
183 | 160 | { |
|
184 |
#if defined( |
|
|
185 |
|
|
|
186 | #elif defined(Q_WS_MAEMO_5) | |
|
187 |
|
|
|
161 | #if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR) | |
|
162 | showFullScreen(); | |
|
163 | #elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX) | |
|
164 | showMaximized(); | |
|
188 | 165 | #else |
|
189 |
|
|
|
166 | show(); | |
|
190 | 167 | #endif |
|
191 | 168 | } |
|
192 | 169 |
@@ -1,4 +1,4 | |||
|
1 |
// checksum 0x |
|
|
1 | // checksum 0xc67a version 0x80016 | |
|
2 | 2 | /* |
|
3 | 3 | This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
4 | 4 | QmlApplicationViewer is a convenience class containing mobile device specific |
@@ -11,7 +11,7 | |||
|
11 | 11 | #ifndef QMLAPPLICATIONVIEWER_H |
|
12 | 12 | #define QMLAPPLICATIONVIEWER_H |
|
13 | 13 | |
|
14 |
#include <Q |
|
|
14 | #include <QDeclarativeView> | |
|
15 | 15 | |
|
16 | 16 | class QmlApplicationViewer : public QDeclarativeView |
|
17 | 17 | { |
@@ -32,13 +32,12 public: | |||
|
32 | 32 | void setMainQmlFile(const QString &file); |
|
33 | 33 | void addImportPath(const QString &path); |
|
34 | 34 | |
|
35 |
// Note that this will only have an effect on |
|
|
36 |
|
|
|
35 | // Note that this will only have an effect on Fremantle. | |
|
36 | void setOrientation(ScreenOrientation orientation); | |
|
37 | 37 | |
|
38 | 38 | void showExpanded(); |
|
39 | 39 | |
|
40 | 40 | private: |
|
41 | explicit QmlApplicationViewer(QDeclarativeView *view, QWidget *parent); | |
|
42 | 41 | class QmlApplicationViewerPrivate *d; |
|
43 | 42 | }; |
|
44 | 43 |
@@ -1,4 +1,4 | |||
|
1 |
// checksum 0x |
|
|
1 | // checksum 0xbd34 version 0x80016 | |
|
2 | 2 | /* |
|
3 | 3 | This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
4 | 4 | QmlApplicationViewer is a convenience class containing mobile device specific |
@@ -10,12 +10,12 | |||
|
10 | 10 | |
|
11 | 11 | #include "qmlapplicationviewer.h" |
|
12 | 12 | |
|
13 |
#include <Q |
|
|
14 |
#include <Q |
|
|
15 | #include <QtDeclarative/QDeclarativeComponent> | |
|
16 | #include <QtDeclarative/QDeclarativeEngine> | |
|
17 | #include <QtDeclarative/QDeclarativeContext> | |
|
13 | #include <QDir> | |
|
14 | #include <QFileInfo> | |
|
18 | 15 | #include <QApplication> |
|
16 | #include <QDeclarativeComponent> | |
|
17 | #include <QDeclarativeEngine> | |
|
18 | #include <QDeclarativeContext> | |
|
19 | 19 | |
|
20 | 20 | #include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN |
|
21 | 21 | |
@@ -50,63 +50,47 static QmlJsDebuggingEnabler enableDebuggingHelper; | |||
|
50 | 50 | |
|
51 | 51 | class QmlApplicationViewerPrivate |
|
52 | 52 | { |
|
53 | QmlApplicationViewerPrivate(QDeclarativeView *view_) : view(view_) {} | |
|
54 | ||
|
55 | 53 | QString mainQmlFile; |
|
56 | QDeclarativeView *view; | |
|
57 | 54 | friend class QmlApplicationViewer; |
|
58 | QString adjustPath(const QString &path); | |
|
55 | static QString adjustPath(const QString &path); | |
|
59 | 56 | }; |
|
60 | 57 | |
|
61 | 58 | QString QmlApplicationViewerPrivate::adjustPath(const QString &path) |
|
62 | 59 | { |
|
63 | #ifdef Q_OS_UNIX | |
|
64 | 60 | #ifdef Q_OS_MAC |
|
65 | 61 | if (!QDir::isAbsolutePath(path)) |
|
66 | return QCoreApplication::applicationDirPath() | |
|
67 | + QLatin1String("/../Resources/") + path; | |
|
68 | #else | |
|
69 | QString pathInInstallDir; | |
|
70 | const QString applicationDirPath = QCoreApplication::applicationDirPath(); | |
|
71 | pathInInstallDir = QString::fromAscii("%1/../%2").arg(applicationDirPath, path); | |
|
72 | ||
|
62 | return QString::fromLatin1("%1/../Resources/%2") | |
|
63 | .arg(QCoreApplication::applicationDirPath(), path); | |
|
64 | #elif defined(Q_OS_QNX) | |
|
65 | if (!QDir::isAbsolutePath(path)) | |
|
66 | return QString::fromLatin1("app/native/%1").arg(path); | |
|
67 | #elif !defined(Q_OS_ANDROID) | |
|
68 | QString pathInInstallDir = | |
|
69 | QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); | |
|
70 | if (QFileInfo(pathInInstallDir).exists()) | |
|
71 | return pathInInstallDir; | |
|
72 | pathInInstallDir = | |
|
73 | QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path); | |
|
73 | 74 | if (QFileInfo(pathInInstallDir).exists()) |
|
74 | 75 | return pathInInstallDir; |
|
75 | #endif | |
|
76 | 76 | #endif |
|
77 | 77 | return path; |
|
78 | 78 | } |
|
79 | 79 | |
|
80 | 80 | QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) |
|
81 | 81 | : QDeclarativeView(parent) |
|
82 |
, d(new QmlApplicationViewerPrivate( |
|
|
82 | , d(new QmlApplicationViewerPrivate()) | |
|
83 | 83 | { |
|
84 | 84 | connect(engine(), SIGNAL(quit()), SLOT(close())); |
|
85 | 85 | setResizeMode(QDeclarativeView::SizeRootObjectToView); |
|
86 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in | |
|
87 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 | |
|
88 | #if !defined(NO_JSDEBUGGER) | |
|
89 | new QmlJSDebugger::JSDebuggerAgent(d->view->engine()); | |
|
90 | #endif | |
|
91 | #if !defined(NO_QMLOBSERVER) | |
|
92 | new QmlJSDebugger::QDeclarativeViewObserver(d->view, d->view); | |
|
93 | #endif | |
|
94 | #endif | |
|
95 | } | |
|
96 | 86 | |
|
97 | QmlApplicationViewer::QmlApplicationViewer(QDeclarativeView *view, QWidget *parent) | |
|
98 | : QDeclarativeView(parent) | |
|
99 | , d(new QmlApplicationViewerPrivate(view)) | |
|
100 | { | |
|
101 | connect(view->engine(), SIGNAL(quit()), view, SLOT(close())); | |
|
102 | view->setResizeMode(QDeclarativeView::SizeRootObjectToView); | |
|
103 | 87 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in |
|
104 | 88 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 |
|
105 | 89 | #if !defined(NO_JSDEBUGGER) |
|
106 |
new QmlJSDebugger::JSDebuggerAgent( |
|
|
90 | new QmlJSDebugger::JSDebuggerAgent(engine()); | |
|
107 | 91 | #endif |
|
108 | 92 | #if !defined(NO_QMLOBSERVER) |
|
109 |
new QmlJSDebugger::QDeclarativeViewObserver( |
|
|
93 | new QmlJSDebugger::QDeclarativeViewObserver(this, this); | |
|
110 | 94 | #endif |
|
111 | 95 | #endif |
|
112 | 96 | } |
@@ -118,75 +102,68 QmlApplicationViewer::~QmlApplicationViewer() | |||
|
118 | 102 | |
|
119 | 103 | QmlApplicationViewer *QmlApplicationViewer::create() |
|
120 | 104 | { |
|
121 | #ifdef HARMATTAN_BOOSTER | |
|
122 | return new QmlApplicationViewer(MDeclarativeCache::qDeclarativeView(), 0); | |
|
123 | #else | |
|
124 | 105 | return new QmlApplicationViewer(); |
|
125 | #endif | |
|
126 | 106 | } |
|
127 | 107 | |
|
128 | 108 | void QmlApplicationViewer::setMainQmlFile(const QString &file) |
|
129 | 109 | { |
|
130 |
d->mainQmlFile = |
|
|
131 | d->view->setSource(QUrl::fromLocalFile(d->mainQmlFile)); | |
|
110 | d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); | |
|
111 | #ifdef Q_OS_ANDROID | |
|
112 | setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile)); | |
|
113 | #else | |
|
114 | setSource(QUrl::fromLocalFile(d->mainQmlFile)); | |
|
115 | #endif | |
|
132 | 116 | } |
|
133 | 117 | |
|
134 | 118 | void QmlApplicationViewer::addImportPath(const QString &path) |
|
135 | 119 | { |
|
136 |
|
|
|
120 | engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); | |
|
137 | 121 | } |
|
138 | 122 | |
|
139 |
|
|
|
140 | //{ | |
|
141 | //#if defined(Q_OS_SYMBIAN) | |
|
142 | // // If the version of Qt on the device is < 4.7.2, that attribute won't work | |
|
143 | // if (orientation != ScreenOrientationAuto) { | |
|
144 | // const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.')); | |
|
145 | // if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { | |
|
146 | // qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); | |
|
147 | // return; | |
|
148 |
|
|
|
149 | // } | |
|
150 | //#endif // Q_OS_SYMBIAN | |
|
151 | ||
|
152 | // Qt::WidgetAttribute attribute; | |
|
153 | // switch (orientation) { | |
|
154 | //#if QT_VERSION < 0x040702 | |
|
155 | // // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |
|
156 | // case ScreenOrientationLockPortrait: | |
|
157 | // attribute = static_cast<Qt::WidgetAttribute>(128); | |
|
158 | // break; | |
|
159 | // case ScreenOrientationLockLandscape: | |
|
160 | // attribute = static_cast<Qt::WidgetAttribute>(129); | |
|
161 | // break; | |
|
162 | // default: | |
|
163 | // case ScreenOrientationAuto: | |
|
164 | // attribute = static_cast<Qt::WidgetAttribute>(130); | |
|
165 | // break; | |
|
166 | //#else // QT_VERSION < 0x040702 | |
|
167 | // case ScreenOrientationLockPortrait: | |
|
168 | // attribute = Qt::WA_LockPortraitOrientation; | |
|
169 | // break; | |
|
170 | // case ScreenOrientationLockLandscape: | |
|
171 | // attribute = Qt::WA_LockLandscapeOrientation; | |
|
172 | // break; | |
|
173 | // default: | |
|
174 | // case ScreenOrientationAuto: | |
|
175 | // attribute = Qt::WA_AutoOrientation; | |
|
176 | // break; | |
|
177 | //#endif // QT_VERSION < 0x040702 | |
|
178 | // }; | |
|
179 | // setAttribute(attribute, true); | |
|
180 | //} | |
|
123 | void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) | |
|
124 | { | |
|
125 | #if QT_VERSION < 0x050000 | |
|
126 | Qt::WidgetAttribute attribute; | |
|
127 | switch (orientation) { | |
|
128 | #if QT_VERSION < 0x040702 | |
|
129 | // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |
|
130 | case ScreenOrientationLockPortrait: | |
|
131 | attribute = static_cast<Qt::WidgetAttribute>(128); | |
|
132 | break; | |
|
133 | case ScreenOrientationLockLandscape: | |
|
134 | attribute = static_cast<Qt::WidgetAttribute>(129); | |
|
135 | break; | |
|
136 | default: | |
|
137 | case ScreenOrientationAuto: | |
|
138 | attribute = static_cast<Qt::WidgetAttribute>(130); | |
|
139 | break; | |
|
140 | #else // QT_VERSION < 0x040702 | |
|
141 | case ScreenOrientationLockPortrait: | |
|
142 | attribute = Qt::WA_LockPortraitOrientation; | |
|
143 | break; | |
|
144 | case ScreenOrientationLockLandscape: | |
|
145 | attribute = Qt::WA_LockLandscapeOrientation; | |
|
146 | break; | |
|
147 | default: | |
|
148 | case ScreenOrientationAuto: | |
|
149 | attribute = Qt::WA_AutoOrientation; | |
|
150 | break; | |
|
151 | #endif // QT_VERSION < 0x040702 | |
|
152 | }; | |
|
153 | setAttribute(attribute, true); | |
|
154 | #else // QT_VERSION < 0x050000 | |
|
155 | Q_UNUSED(orientation) | |
|
156 | #endif // QT_VERSION < 0x050000 | |
|
157 | } | |
|
181 | 158 | |
|
182 | 159 | void QmlApplicationViewer::showExpanded() |
|
183 | 160 | { |
|
184 |
#if defined( |
|
|
185 |
|
|
|
186 | #elif defined(Q_WS_MAEMO_5) | |
|
187 |
|
|
|
161 | #if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR) | |
|
162 | showFullScreen(); | |
|
163 | #elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX) | |
|
164 | showMaximized(); | |
|
188 | 165 | #else |
|
189 |
|
|
|
166 | show(); | |
|
190 | 167 | #endif |
|
191 | 168 | } |
|
192 | 169 |
@@ -1,4 +1,4 | |||
|
1 |
// checksum 0x |
|
|
1 | // checksum 0xc67a version 0x80016 | |
|
2 | 2 | /* |
|
3 | 3 | This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
4 | 4 | QmlApplicationViewer is a convenience class containing mobile device specific |
@@ -11,7 +11,7 | |||
|
11 | 11 | #ifndef QMLAPPLICATIONVIEWER_H |
|
12 | 12 | #define QMLAPPLICATIONVIEWER_H |
|
13 | 13 | |
|
14 |
#include <Q |
|
|
14 | #include <QDeclarativeView> | |
|
15 | 15 | |
|
16 | 16 | class QmlApplicationViewer : public QDeclarativeView |
|
17 | 17 | { |
@@ -32,13 +32,12 public: | |||
|
32 | 32 | void setMainQmlFile(const QString &file); |
|
33 | 33 | void addImportPath(const QString &path); |
|
34 | 34 | |
|
35 |
// Note that this will only have an effect on |
|
|
36 |
|
|
|
35 | // Note that this will only have an effect on Fremantle. | |
|
36 | void setOrientation(ScreenOrientation orientation); | |
|
37 | 37 | |
|
38 | 38 | void showExpanded(); |
|
39 | 39 | |
|
40 | 40 | private: |
|
41 | explicit QmlApplicationViewer(QDeclarativeView *view, QWidget *parent); | |
|
42 | 41 | class QmlApplicationViewerPrivate *d; |
|
43 | 42 | }; |
|
44 | 43 |
@@ -1,4 +1,4 | |||
|
1 |
// checksum 0x |
|
|
1 | // checksum 0xbd34 version 0x80016 | |
|
2 | 2 | /* |
|
3 | 3 | This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
4 | 4 | QmlApplicationViewer is a convenience class containing mobile device specific |
@@ -10,12 +10,12 | |||
|
10 | 10 | |
|
11 | 11 | #include "qmlapplicationviewer.h" |
|
12 | 12 | |
|
13 |
#include <Q |
|
|
14 |
#include <Q |
|
|
15 | #include <QtDeclarative/QDeclarativeComponent> | |
|
16 | #include <QtDeclarative/QDeclarativeEngine> | |
|
17 | #include <QtDeclarative/QDeclarativeContext> | |
|
13 | #include <QDir> | |
|
14 | #include <QFileInfo> | |
|
18 | 15 | #include <QApplication> |
|
16 | #include <QDeclarativeComponent> | |
|
17 | #include <QDeclarativeEngine> | |
|
18 | #include <QDeclarativeContext> | |
|
19 | 19 | |
|
20 | 20 | #include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN |
|
21 | 21 | |
@@ -50,63 +50,47 static QmlJsDebuggingEnabler enableDebuggingHelper; | |||
|
50 | 50 | |
|
51 | 51 | class QmlApplicationViewerPrivate |
|
52 | 52 | { |
|
53 | QmlApplicationViewerPrivate(QDeclarativeView *view_) : view(view_) {} | |
|
54 | ||
|
55 | 53 | QString mainQmlFile; |
|
56 | QDeclarativeView *view; | |
|
57 | 54 | friend class QmlApplicationViewer; |
|
58 | QString adjustPath(const QString &path); | |
|
55 | static QString adjustPath(const QString &path); | |
|
59 | 56 | }; |
|
60 | 57 | |
|
61 | 58 | QString QmlApplicationViewerPrivate::adjustPath(const QString &path) |
|
62 | 59 | { |
|
63 | #ifdef Q_OS_UNIX | |
|
64 | 60 | #ifdef Q_OS_MAC |
|
65 | 61 | if (!QDir::isAbsolutePath(path)) |
|
66 | return QCoreApplication::applicationDirPath() | |
|
67 | + QLatin1String("/../Resources/") + path; | |
|
68 | #else | |
|
69 | QString pathInInstallDir; | |
|
70 | const QString applicationDirPath = QCoreApplication::applicationDirPath(); | |
|
71 | pathInInstallDir = QString::fromAscii("%1/../%2").arg(applicationDirPath, path); | |
|
72 | ||
|
62 | return QString::fromLatin1("%1/../Resources/%2") | |
|
63 | .arg(QCoreApplication::applicationDirPath(), path); | |
|
64 | #elif defined(Q_OS_QNX) | |
|
65 | if (!QDir::isAbsolutePath(path)) | |
|
66 | return QString::fromLatin1("app/native/%1").arg(path); | |
|
67 | #elif !defined(Q_OS_ANDROID) | |
|
68 | QString pathInInstallDir = | |
|
69 | QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); | |
|
70 | if (QFileInfo(pathInInstallDir).exists()) | |
|
71 | return pathInInstallDir; | |
|
72 | pathInInstallDir = | |
|
73 | QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path); | |
|
73 | 74 | if (QFileInfo(pathInInstallDir).exists()) |
|
74 | 75 | return pathInInstallDir; |
|
75 | #endif | |
|
76 | 76 | #endif |
|
77 | 77 | return path; |
|
78 | 78 | } |
|
79 | 79 | |
|
80 | 80 | QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) |
|
81 | 81 | : QDeclarativeView(parent) |
|
82 |
, d(new QmlApplicationViewerPrivate( |
|
|
82 | , d(new QmlApplicationViewerPrivate()) | |
|
83 | 83 | { |
|
84 | 84 | connect(engine(), SIGNAL(quit()), SLOT(close())); |
|
85 | 85 | setResizeMode(QDeclarativeView::SizeRootObjectToView); |
|
86 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in | |
|
87 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 | |
|
88 | #if !defined(NO_JSDEBUGGER) | |
|
89 | new QmlJSDebugger::JSDebuggerAgent(d->view->engine()); | |
|
90 | #endif | |
|
91 | #if !defined(NO_QMLOBSERVER) | |
|
92 | new QmlJSDebugger::QDeclarativeViewObserver(d->view, d->view); | |
|
93 | #endif | |
|
94 | #endif | |
|
95 | } | |
|
96 | 86 | |
|
97 | QmlApplicationViewer::QmlApplicationViewer(QDeclarativeView *view, QWidget *parent) | |
|
98 | : QDeclarativeView(parent) | |
|
99 | , d(new QmlApplicationViewerPrivate(view)) | |
|
100 | { | |
|
101 | connect(view->engine(), SIGNAL(quit()), view, SLOT(close())); | |
|
102 | view->setResizeMode(QDeclarativeView::SizeRootObjectToView); | |
|
103 | 87 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in |
|
104 | 88 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 |
|
105 | 89 | #if !defined(NO_JSDEBUGGER) |
|
106 |
new QmlJSDebugger::JSDebuggerAgent( |
|
|
90 | new QmlJSDebugger::JSDebuggerAgent(engine()); | |
|
107 | 91 | #endif |
|
108 | 92 | #if !defined(NO_QMLOBSERVER) |
|
109 |
new QmlJSDebugger::QDeclarativeViewObserver( |
|
|
93 | new QmlJSDebugger::QDeclarativeViewObserver(this, this); | |
|
110 | 94 | #endif |
|
111 | 95 | #endif |
|
112 | 96 | } |
@@ -118,75 +102,68 QmlApplicationViewer::~QmlApplicationViewer() | |||
|
118 | 102 | |
|
119 | 103 | QmlApplicationViewer *QmlApplicationViewer::create() |
|
120 | 104 | { |
|
121 | #ifdef HARMATTAN_BOOSTER | |
|
122 | return new QmlApplicationViewer(MDeclarativeCache::qDeclarativeView(), 0); | |
|
123 | #else | |
|
124 | 105 | return new QmlApplicationViewer(); |
|
125 | #endif | |
|
126 | 106 | } |
|
127 | 107 | |
|
128 | 108 | void QmlApplicationViewer::setMainQmlFile(const QString &file) |
|
129 | 109 | { |
|
130 |
d->mainQmlFile = |
|
|
131 | d->view->setSource(QUrl::fromLocalFile(d->mainQmlFile)); | |
|
110 | d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); | |
|
111 | #ifdef Q_OS_ANDROID | |
|
112 | setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile)); | |
|
113 | #else | |
|
114 | setSource(QUrl::fromLocalFile(d->mainQmlFile)); | |
|
115 | #endif | |
|
132 | 116 | } |
|
133 | 117 | |
|
134 | 118 | void QmlApplicationViewer::addImportPath(const QString &path) |
|
135 | 119 | { |
|
136 |
|
|
|
120 | engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); | |
|
137 | 121 | } |
|
138 | 122 | |
|
139 |
|
|
|
140 | //{ | |
|
141 | //#if defined(Q_OS_SYMBIAN) | |
|
142 | // // If the version of Qt on the device is < 4.7.2, that attribute won't work | |
|
143 | // if (orientation != ScreenOrientationAuto) { | |
|
144 | // const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.')); | |
|
145 | // if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { | |
|
146 | // qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); | |
|
147 | // return; | |
|
148 |
|
|
|
149 | // } | |
|
150 | //#endif // Q_OS_SYMBIAN | |
|
151 | ||
|
152 | // Qt::WidgetAttribute attribute; | |
|
153 | // switch (orientation) { | |
|
154 | //#if QT_VERSION < 0x040702 | |
|
155 | // // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |
|
156 | // case ScreenOrientationLockPortrait: | |
|
157 | // attribute = static_cast<Qt::WidgetAttribute>(128); | |
|
158 | // break; | |
|
159 | // case ScreenOrientationLockLandscape: | |
|
160 | // attribute = static_cast<Qt::WidgetAttribute>(129); | |
|
161 | // break; | |
|
162 | // default: | |
|
163 | // case ScreenOrientationAuto: | |
|
164 | // attribute = static_cast<Qt::WidgetAttribute>(130); | |
|
165 | // break; | |
|
166 | //#else // QT_VERSION < 0x040702 | |
|
167 | // case ScreenOrientationLockPortrait: | |
|
168 | // attribute = Qt::WA_LockPortraitOrientation; | |
|
169 | // break; | |
|
170 | // case ScreenOrientationLockLandscape: | |
|
171 | // attribute = Qt::WA_LockLandscapeOrientation; | |
|
172 | // break; | |
|
173 | // default: | |
|
174 | // case ScreenOrientationAuto: | |
|
175 | // attribute = Qt::WA_AutoOrientation; | |
|
176 | // break; | |
|
177 | //#endif // QT_VERSION < 0x040702 | |
|
178 | // }; | |
|
179 | // setAttribute(attribute, true); | |
|
180 | //} | |
|
123 | void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) | |
|
124 | { | |
|
125 | #if QT_VERSION < 0x050000 | |
|
126 | Qt::WidgetAttribute attribute; | |
|
127 | switch (orientation) { | |
|
128 | #if QT_VERSION < 0x040702 | |
|
129 | // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |
|
130 | case ScreenOrientationLockPortrait: | |
|
131 | attribute = static_cast<Qt::WidgetAttribute>(128); | |
|
132 | break; | |
|
133 | case ScreenOrientationLockLandscape: | |
|
134 | attribute = static_cast<Qt::WidgetAttribute>(129); | |
|
135 | break; | |
|
136 | default: | |
|
137 | case ScreenOrientationAuto: | |
|
138 | attribute = static_cast<Qt::WidgetAttribute>(130); | |
|
139 | break; | |
|
140 | #else // QT_VERSION < 0x040702 | |
|
141 | case ScreenOrientationLockPortrait: | |
|
142 | attribute = Qt::WA_LockPortraitOrientation; | |
|
143 | break; | |
|
144 | case ScreenOrientationLockLandscape: | |
|
145 | attribute = Qt::WA_LockLandscapeOrientation; | |
|
146 | break; | |
|
147 | default: | |
|
148 | case ScreenOrientationAuto: | |
|
149 | attribute = Qt::WA_AutoOrientation; | |
|
150 | break; | |
|
151 | #endif // QT_VERSION < 0x040702 | |
|
152 | }; | |
|
153 | setAttribute(attribute, true); | |
|
154 | #else // QT_VERSION < 0x050000 | |
|
155 | Q_UNUSED(orientation) | |
|
156 | #endif // QT_VERSION < 0x050000 | |
|
157 | } | |
|
181 | 158 | |
|
182 | 159 | void QmlApplicationViewer::showExpanded() |
|
183 | 160 | { |
|
184 |
#if defined( |
|
|
185 |
|
|
|
186 | #elif defined(Q_WS_MAEMO_5) | |
|
187 |
|
|
|
161 | #if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR) | |
|
162 | showFullScreen(); | |
|
163 | #elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX) | |
|
164 | showMaximized(); | |
|
188 | 165 | #else |
|
189 |
|
|
|
166 | show(); | |
|
190 | 167 | #endif |
|
191 | 168 | } |
|
192 | 169 |
@@ -1,4 +1,4 | |||
|
1 |
// checksum 0x |
|
|
1 | // checksum 0xc67a version 0x80016 | |
|
2 | 2 | /* |
|
3 | 3 | This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
4 | 4 | QmlApplicationViewer is a convenience class containing mobile device specific |
@@ -11,7 +11,7 | |||
|
11 | 11 | #ifndef QMLAPPLICATIONVIEWER_H |
|
12 | 12 | #define QMLAPPLICATIONVIEWER_H |
|
13 | 13 | |
|
14 |
#include <Q |
|
|
14 | #include <QDeclarativeView> | |
|
15 | 15 | |
|
16 | 16 | class QmlApplicationViewer : public QDeclarativeView |
|
17 | 17 | { |
@@ -32,13 +32,12 public: | |||
|
32 | 32 | void setMainQmlFile(const QString &file); |
|
33 | 33 | void addImportPath(const QString &path); |
|
34 | 34 | |
|
35 |
// Note that this will only have an effect on |
|
|
36 |
|
|
|
35 | // Note that this will only have an effect on Fremantle. | |
|
36 | void setOrientation(ScreenOrientation orientation); | |
|
37 | 37 | |
|
38 | 38 | void showExpanded(); |
|
39 | 39 | |
|
40 | 40 | private: |
|
41 | explicit QmlApplicationViewer(QDeclarativeView *view, QWidget *parent); | |
|
42 | 41 | class QmlApplicationViewerPrivate *d; |
|
43 | 42 | }; |
|
44 | 43 |
@@ -1,4 +1,4 | |||
|
1 |
// checksum 0x |
|
|
1 | // checksum 0xbd34 version 0x80016 | |
|
2 | 2 | /* |
|
3 | 3 | This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
4 | 4 | QmlApplicationViewer is a convenience class containing mobile device specific |
@@ -13,9 +13,10 | |||
|
13 | 13 | #include <QDir> |
|
14 | 14 | #include <QFileInfo> |
|
15 | 15 | #include <QApplication> |
|
16 |
#include <Q |
|
|
17 |
#include <Q |
|
|
18 |
#include <Q |
|
|
16 | #include <QDeclarativeComponent> | |
|
17 | #include <QDeclarativeEngine> | |
|
18 | #include <QDeclarativeContext> | |
|
19 | ||
|
19 | 20 | #include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN |
|
20 | 21 | |
|
21 | 22 | #ifdef HARMATTAN_BOOSTER |
@@ -56,17 +57,22 class QmlApplicationViewerPrivate | |||
|
56 | 57 | |
|
57 | 58 | QString QmlApplicationViewerPrivate::adjustPath(const QString &path) |
|
58 | 59 | { |
|
59 | #ifdef Q_OS_UNIX | |
|
60 | 60 | #ifdef Q_OS_MAC |
|
61 | 61 | if (!QDir::isAbsolutePath(path)) |
|
62 | 62 | return QString::fromLatin1("%1/../Resources/%2") |
|
63 | 63 | .arg(QCoreApplication::applicationDirPath(), path); |
|
64 | #else | |
|
65 | const QString pathInInstallDir = | |
|
64 | #elif defined(Q_OS_QNX) | |
|
65 | if (!QDir::isAbsolutePath(path)) | |
|
66 | return QString::fromLatin1("app/native/%1").arg(path); | |
|
67 | #elif !defined(Q_OS_ANDROID) | |
|
68 | QString pathInInstallDir = | |
|
66 | 69 | QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); |
|
67 | 70 | if (QFileInfo(pathInInstallDir).exists()) |
|
68 | 71 | return pathInInstallDir; |
|
69 | #endif | |
|
72 | pathInInstallDir = | |
|
73 | QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path); | |
|
74 | if (QFileInfo(pathInInstallDir).exists()) | |
|
75 | return pathInInstallDir; | |
|
70 | 76 | #endif |
|
71 | 77 | return path; |
|
72 | 78 | } |
@@ -77,6 +83,7 QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) | |||
|
77 | 83 | { |
|
78 | 84 | connect(engine(), SIGNAL(quit()), SLOT(close())); |
|
79 | 85 | setResizeMode(QDeclarativeView::SizeRootObjectToView); |
|
86 | ||
|
80 | 87 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in |
|
81 | 88 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 |
|
82 | 89 | #if !defined(NO_JSDEBUGGER) |
@@ -101,7 +108,11 QmlApplicationViewer *QmlApplicationViewer::create() | |||
|
101 | 108 | void QmlApplicationViewer::setMainQmlFile(const QString &file) |
|
102 | 109 | { |
|
103 | 110 | d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); |
|
111 | #ifdef Q_OS_ANDROID | |
|
112 | setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile)); | |
|
113 | #else | |
|
104 | 114 | setSource(QUrl::fromLocalFile(d->mainQmlFile)); |
|
115 | #endif | |
|
105 | 116 | } |
|
106 | 117 | |
|
107 | 118 | void QmlApplicationViewer::addImportPath(const QString &path) |
@@ -109,54 +120,47 void QmlApplicationViewer::addImportPath(const QString &path) | |||
|
109 | 120 | engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); |
|
110 | 121 | } |
|
111 | 122 | |
|
112 |
|
|
|
113 | //{ | |
|
114 | //#if defined(Q_OS_SYMBIAN) | |
|
115 | // // If the version of Qt on the device is < 4.7.2, that attribute won't work | |
|
116 | // if (orientation != ScreenOrientationAuto) { | |
|
117 | // const QStringList v = QString::fromLatin1(qVersion()).split(QLatin1Char('.')); | |
|
118 | // if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { | |
|
119 | // qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); | |
|
120 | // return; | |
|
121 |
|
|
|
122 | // } | |
|
123 | //#endif // Q_OS_SYMBIAN | |
|
124 | ||
|
125 | // Qt::WidgetAttribute attribute; | |
|
126 | // switch (orientation) { | |
|
127 | //#if QT_VERSION < 0x040702 | |
|
128 | // // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |
|
129 | // case ScreenOrientationLockPortrait: | |
|
130 | // attribute = static_cast<Qt::WidgetAttribute>(128); | |
|
131 | // break; | |
|
132 | // case ScreenOrientationLockLandscape: | |
|
133 | // attribute = static_cast<Qt::WidgetAttribute>(129); | |
|
134 | // break; | |
|
135 | // default: | |
|
136 | // case ScreenOrientationAuto: | |
|
137 | // attribute = static_cast<Qt::WidgetAttribute>(130); | |
|
138 | // break; | |
|
139 | //#else // QT_VERSION < 0x040702 | |
|
140 | // case ScreenOrientationLockPortrait: | |
|
141 | // attribute = Qt::WA_LockPortraitOrientation; | |
|
142 | // break; | |
|
143 | // case ScreenOrientationLockLandscape: | |
|
144 | // attribute = Qt::WA_LockLandscapeOrientation; | |
|
145 | // break; | |
|
146 | // default: | |
|
147 | // case ScreenOrientationAuto: | |
|
148 | // attribute = Qt::WA_AutoOrientation; | |
|
149 | // break; | |
|
150 | //#endif // QT_VERSION < 0x040702 | |
|
151 | // }; | |
|
152 | // setAttribute(attribute, true); | |
|
153 | //} | |
|
123 | void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) | |
|
124 | { | |
|
125 | #if QT_VERSION < 0x050000 | |
|
126 | Qt::WidgetAttribute attribute; | |
|
127 | switch (orientation) { | |
|
128 | #if QT_VERSION < 0x040702 | |
|
129 | // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |
|
130 | case ScreenOrientationLockPortrait: | |
|
131 | attribute = static_cast<Qt::WidgetAttribute>(128); | |
|
132 | break; | |
|
133 | case ScreenOrientationLockLandscape: | |
|
134 | attribute = static_cast<Qt::WidgetAttribute>(129); | |
|
135 | break; | |
|
136 | default: | |
|
137 | case ScreenOrientationAuto: | |
|
138 | attribute = static_cast<Qt::WidgetAttribute>(130); | |
|
139 | break; | |
|
140 | #else // QT_VERSION < 0x040702 | |
|
141 | case ScreenOrientationLockPortrait: | |
|
142 | attribute = Qt::WA_LockPortraitOrientation; | |
|
143 | break; | |
|
144 | case ScreenOrientationLockLandscape: | |
|
145 | attribute = Qt::WA_LockLandscapeOrientation; | |
|
146 | break; | |
|
147 | default: | |
|
148 | case ScreenOrientationAuto: | |
|
149 | attribute = Qt::WA_AutoOrientation; | |
|
150 | break; | |
|
151 | #endif // QT_VERSION < 0x040702 | |
|
152 | }; | |
|
153 | setAttribute(attribute, true); | |
|
154 | #else // QT_VERSION < 0x050000 | |
|
155 | Q_UNUSED(orientation) | |
|
156 | #endif // QT_VERSION < 0x050000 | |
|
157 | } | |
|
154 | 158 | |
|
155 | 159 | void QmlApplicationViewer::showExpanded() |
|
156 | 160 | { |
|
157 |
#if defined( |
|
|
161 | #if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR) | |
|
158 | 162 | showFullScreen(); |
|
159 | #elif defined(Q_WS_MAEMO_5) | |
|
163 | #elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX) | |
|
160 | 164 | showMaximized(); |
|
161 | 165 | #else |
|
162 | 166 | show(); |
@@ -1,4 +1,4 | |||
|
1 |
// checksum 0x |
|
|
1 | // checksum 0xc67a version 0x80016 | |
|
2 | 2 | /* |
|
3 | 3 | This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
4 | 4 | QmlApplicationViewer is a convenience class containing mobile device specific |
@@ -11,7 +11,7 | |||
|
11 | 11 | #ifndef QMLAPPLICATIONVIEWER_H |
|
12 | 12 | #define QMLAPPLICATIONVIEWER_H |
|
13 | 13 | |
|
14 |
#include <Q |
|
|
14 | #include <QDeclarativeView> | |
|
15 | 15 | |
|
16 | 16 | class QmlApplicationViewer : public QDeclarativeView |
|
17 | 17 | { |
@@ -32,8 +32,8 public: | |||
|
32 | 32 | void setMainQmlFile(const QString &file); |
|
33 | 33 | void addImportPath(const QString &path); |
|
34 | 34 | |
|
35 |
// Note that this will only have an effect on |
|
|
36 |
|
|
|
35 | // Note that this will only have an effect on Fremantle. | |
|
36 | void setOrientation(ScreenOrientation orientation); | |
|
37 | 37 | |
|
38 | 38 | void showExpanded(); |
|
39 | 39 |
@@ -1,4 +1,4 | |||
|
1 |
# checksum 0x |
|
|
1 | # checksum 0x77b version 0x80016 | |
|
2 | 2 | # This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
3 | 3 | # The code below adds the QmlApplicationViewer to the project and handles the |
|
4 | 4 | # activation of QML debugging. |
@@ -22,7 +22,7 contains(CONFIG,qdeclarative-boostable):contains(MEEGO_EDITION,harmattan) { | |||
|
22 | 22 | DEFINES += HARMATTAN_BOOSTER |
|
23 | 23 | } |
|
24 | 24 | # This file was generated by an application wizard of Qt Creator. |
|
25 |
# The code below handles deployment to |
|
|
25 | # The code below handles deployment to Android and Maemo, aswell as copying | |
|
26 | 26 | # of the application data to shadow build directories on desktop. |
|
27 | 27 | # It is recommended not to modify this file, since newer versions of Qt Creator |
|
28 | 28 | # may offer an updated version of it. |
@@ -30,7 +30,11 contains(CONFIG,qdeclarative-boostable):contains(MEEGO_EDITION,harmattan) { | |||
|
30 | 30 | defineTest(qtcAddDeployment) { |
|
31 | 31 | for(deploymentfolder, DEPLOYMENTFOLDERS) { |
|
32 | 32 | item = item$${deploymentfolder} |
|
33 | greaterThan(QT_MAJOR_VERSION, 4) { | |
|
34 | itemsources = $${item}.files | |
|
35 | } else { | |
|
33 | 36 | itemsources = $${item}.sources |
|
37 | } | |
|
34 | 38 | $$itemsources = $$eval($${deploymentfolder}.source) |
|
35 | 39 | itempath = $${item}.path |
|
36 | 40 | $$itempath= $$eval($${deploymentfolder}.target) |
@@ -41,9 +45,28 for(deploymentfolder, DEPLOYMENTFOLDERS) { | |||
|
41 | 45 | |
|
42 | 46 | MAINPROFILEPWD = $$PWD |
|
43 | 47 | |
|
44 | symbian { | |
|
45 | isEmpty(ICON):exists($${TARGET}.svg):ICON = $${TARGET}.svg | |
|
46 | isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 | |
|
48 | android { | |
|
49 | for(deploymentfolder, DEPLOYMENTFOLDERS) { | |
|
50 | item = item$${deploymentfolder} | |
|
51 | itemfiles = $${item}.files | |
|
52 | $$itemfiles = $$eval($${deploymentfolder}.source) | |
|
53 | itempath = $${item}.path | |
|
54 | $$itempath = /assets/$$eval($${deploymentfolder}.target) | |
|
55 | export($$itemfiles) | |
|
56 | export($$itempath) | |
|
57 | INSTALLS += $$item | |
|
58 | } | |
|
59 | ||
|
60 | x86 { | |
|
61 | target.path = /libs/x86 | |
|
62 | } else: armeabi-v7a { | |
|
63 | target.path = /libs/armeabi-v7a | |
|
64 | } else { | |
|
65 | target.path = /libs/armeabi | |
|
66 | } | |
|
67 | ||
|
68 | export(target.path) | |
|
69 | INSTALLS += target | |
|
47 | 70 | } else:win32 { |
|
48 | 71 | copyCommand = |
|
49 | 72 | for(deploymentfolder, DEPLOYMENTFOLDERS) { |
@@ -141,8 +164,6 symbian { | |||
|
141 | 164 | export (ICON) |
|
142 | 165 | export (INSTALLS) |
|
143 | 166 | export (DEPLOYMENT) |
|
144 | export (TARGET.EPOCHEAPSIZE) | |
|
145 | export (TARGET.CAPABILITY) | |
|
146 | 167 | export (LIBS) |
|
147 | 168 | export (QMAKE_EXTRA_TARGETS) |
|
148 | 169 | } |
@@ -1,4 +1,4 | |||
|
1 |
// checksum 0x |
|
|
1 | // checksum 0xbd34 version 0x80016 | |
|
2 | 2 | /* |
|
3 | 3 | This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
4 | 4 | QmlApplicationViewer is a convenience class containing mobile device specific |
@@ -10,12 +10,12 | |||
|
10 | 10 | |
|
11 | 11 | #include "qmlapplicationviewer.h" |
|
12 | 12 | |
|
13 |
#include <Q |
|
|
14 |
#include <Q |
|
|
15 | #include <QtDeclarative/QDeclarativeComponent> | |
|
16 | #include <QtDeclarative/QDeclarativeEngine> | |
|
17 | #include <QtDeclarative/QDeclarativeContext> | |
|
13 | #include <QDir> | |
|
14 | #include <QFileInfo> | |
|
18 | 15 | #include <QApplication> |
|
16 | #include <QDeclarativeComponent> | |
|
17 | #include <QDeclarativeEngine> | |
|
18 | #include <QDeclarativeContext> | |
|
19 | 19 | |
|
20 | 20 | #include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN |
|
21 | 21 | |
@@ -50,63 +50,47 static QmlJsDebuggingEnabler enableDebuggingHelper; | |||
|
50 | 50 | |
|
51 | 51 | class QmlApplicationViewerPrivate |
|
52 | 52 | { |
|
53 | QmlApplicationViewerPrivate(QDeclarativeView *view_) : view(view_) {} | |
|
54 | ||
|
55 | 53 | QString mainQmlFile; |
|
56 | QDeclarativeView *view; | |
|
57 | 54 | friend class QmlApplicationViewer; |
|
58 | QString adjustPath(const QString &path); | |
|
55 | static QString adjustPath(const QString &path); | |
|
59 | 56 | }; |
|
60 | 57 | |
|
61 | 58 | QString QmlApplicationViewerPrivate::adjustPath(const QString &path) |
|
62 | 59 | { |
|
63 | #ifdef Q_OS_UNIX | |
|
64 | 60 | #ifdef Q_OS_MAC |
|
65 | 61 | if (!QDir::isAbsolutePath(path)) |
|
66 | return QCoreApplication::applicationDirPath() | |
|
67 | + QLatin1String("/../Resources/") + path; | |
|
68 | #else | |
|
69 | QString pathInInstallDir; | |
|
70 | const QString applicationDirPath = QCoreApplication::applicationDirPath(); | |
|
71 | pathInInstallDir = QString::fromAscii("%1/../%2").arg(applicationDirPath, path); | |
|
72 | ||
|
62 | return QString::fromLatin1("%1/../Resources/%2") | |
|
63 | .arg(QCoreApplication::applicationDirPath(), path); | |
|
64 | #elif defined(Q_OS_QNX) | |
|
65 | if (!QDir::isAbsolutePath(path)) | |
|
66 | return QString::fromLatin1("app/native/%1").arg(path); | |
|
67 | #elif !defined(Q_OS_ANDROID) | |
|
68 | QString pathInInstallDir = | |
|
69 | QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); | |
|
70 | if (QFileInfo(pathInInstallDir).exists()) | |
|
71 | return pathInInstallDir; | |
|
72 | pathInInstallDir = | |
|
73 | QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path); | |
|
73 | 74 | if (QFileInfo(pathInInstallDir).exists()) |
|
74 | 75 | return pathInInstallDir; |
|
75 | #endif | |
|
76 | 76 | #endif |
|
77 | 77 | return path; |
|
78 | 78 | } |
|
79 | 79 | |
|
80 | 80 | QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) |
|
81 | 81 | : QDeclarativeView(parent) |
|
82 |
, d(new QmlApplicationViewerPrivate( |
|
|
82 | , d(new QmlApplicationViewerPrivate()) | |
|
83 | 83 | { |
|
84 | 84 | connect(engine(), SIGNAL(quit()), SLOT(close())); |
|
85 | 85 | setResizeMode(QDeclarativeView::SizeRootObjectToView); |
|
86 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in | |
|
87 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 | |
|
88 | #if !defined(NO_JSDEBUGGER) | |
|
89 | new QmlJSDebugger::JSDebuggerAgent(d->view->engine()); | |
|
90 | #endif | |
|
91 | #if !defined(NO_QMLOBSERVER) | |
|
92 | new QmlJSDebugger::QDeclarativeViewObserver(d->view, d->view); | |
|
93 | #endif | |
|
94 | #endif | |
|
95 | } | |
|
96 | 86 | |
|
97 | QmlApplicationViewer::QmlApplicationViewer(QDeclarativeView *view, QWidget *parent) | |
|
98 | : QDeclarativeView(parent) | |
|
99 | , d(new QmlApplicationViewerPrivate(view)) | |
|
100 | { | |
|
101 | connect(view->engine(), SIGNAL(quit()), view, SLOT(close())); | |
|
102 | view->setResizeMode(QDeclarativeView::SizeRootObjectToView); | |
|
103 | 87 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in |
|
104 | 88 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 |
|
105 | 89 | #if !defined(NO_JSDEBUGGER) |
|
106 |
new QmlJSDebugger::JSDebuggerAgent( |
|
|
90 | new QmlJSDebugger::JSDebuggerAgent(engine()); | |
|
107 | 91 | #endif |
|
108 | 92 | #if !defined(NO_QMLOBSERVER) |
|
109 |
new QmlJSDebugger::QDeclarativeViewObserver( |
|
|
93 | new QmlJSDebugger::QDeclarativeViewObserver(this, this); | |
|
110 | 94 | #endif |
|
111 | 95 | #endif |
|
112 | 96 | } |
@@ -118,75 +102,68 QmlApplicationViewer::~QmlApplicationViewer() | |||
|
118 | 102 | |
|
119 | 103 | QmlApplicationViewer *QmlApplicationViewer::create() |
|
120 | 104 | { |
|
121 | #ifdef HARMATTAN_BOOSTER | |
|
122 | return new QmlApplicationViewer(MDeclarativeCache::qDeclarativeView(), 0); | |
|
123 | #else | |
|
124 | 105 | return new QmlApplicationViewer(); |
|
125 | #endif | |
|
126 | 106 | } |
|
127 | 107 | |
|
128 | 108 | void QmlApplicationViewer::setMainQmlFile(const QString &file) |
|
129 | 109 | { |
|
130 |
d->mainQmlFile = |
|
|
131 | d->view->setSource(QUrl::fromLocalFile(d->mainQmlFile)); | |
|
110 | d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); | |
|
111 | #ifdef Q_OS_ANDROID | |
|
112 | setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile)); | |
|
113 | #else | |
|
114 | setSource(QUrl::fromLocalFile(d->mainQmlFile)); | |
|
115 | #endif | |
|
132 | 116 | } |
|
133 | 117 | |
|
134 | 118 | void QmlApplicationViewer::addImportPath(const QString &path) |
|
135 | 119 | { |
|
136 |
|
|
|
120 | engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); | |
|
137 | 121 | } |
|
138 | 122 | |
|
139 |
|
|
|
140 | //{ | |
|
141 | //#if defined(Q_OS_SYMBIAN) | |
|
142 | // // If the version of Qt on the device is < 4.7.2, that attribute won't work | |
|
143 | // if (orientation != ScreenOrientationAuto) { | |
|
144 | // const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.')); | |
|
145 | // if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { | |
|
146 | // qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); | |
|
147 | // return; | |
|
148 |
|
|
|
149 | // } | |
|
150 | //#endif // Q_OS_SYMBIAN | |
|
151 | ||
|
152 | // Qt::WidgetAttribute attribute; | |
|
153 | // switch (orientation) { | |
|
154 | //#if QT_VERSION < 0x040702 | |
|
155 | // // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |
|
156 | // case ScreenOrientationLockPortrait: | |
|
157 | // attribute = static_cast<Qt::WidgetAttribute>(128); | |
|
158 | // break; | |
|
159 | // case ScreenOrientationLockLandscape: | |
|
160 | // attribute = static_cast<Qt::WidgetAttribute>(129); | |
|
161 | // break; | |
|
162 | // default: | |
|
163 | // case ScreenOrientationAuto: | |
|
164 | // attribute = static_cast<Qt::WidgetAttribute>(130); | |
|
165 | // break; | |
|
166 | //#else // QT_VERSION < 0x040702 | |
|
167 | // case ScreenOrientationLockPortrait: | |
|
168 | // attribute = Qt::WA_LockPortraitOrientation; | |
|
169 | // break; | |
|
170 | // case ScreenOrientationLockLandscape: | |
|
171 | // attribute = Qt::WA_LockLandscapeOrientation; | |
|
172 | // break; | |
|
173 | // default: | |
|
174 | // case ScreenOrientationAuto: | |
|
175 | // attribute = Qt::WA_AutoOrientation; | |
|
176 | // break; | |
|
177 | //#endif // QT_VERSION < 0x040702 | |
|
178 | // }; | |
|
179 | // setAttribute(attribute, true); | |
|
180 | //} | |
|
123 | void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) | |
|
124 | { | |
|
125 | #if QT_VERSION < 0x050000 | |
|
126 | Qt::WidgetAttribute attribute; | |
|
127 | switch (orientation) { | |
|
128 | #if QT_VERSION < 0x040702 | |
|
129 | // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |
|
130 | case ScreenOrientationLockPortrait: | |
|
131 | attribute = static_cast<Qt::WidgetAttribute>(128); | |
|
132 | break; | |
|
133 | case ScreenOrientationLockLandscape: | |
|
134 | attribute = static_cast<Qt::WidgetAttribute>(129); | |
|
135 | break; | |
|
136 | default: | |
|
137 | case ScreenOrientationAuto: | |
|
138 | attribute = static_cast<Qt::WidgetAttribute>(130); | |
|
139 | break; | |
|
140 | #else // QT_VERSION < 0x040702 | |
|
141 | case ScreenOrientationLockPortrait: | |
|
142 | attribute = Qt::WA_LockPortraitOrientation; | |
|
143 | break; | |
|
144 | case ScreenOrientationLockLandscape: | |
|
145 | attribute = Qt::WA_LockLandscapeOrientation; | |
|
146 | break; | |
|
147 | default: | |
|
148 | case ScreenOrientationAuto: | |
|
149 | attribute = Qt::WA_AutoOrientation; | |
|
150 | break; | |
|
151 | #endif // QT_VERSION < 0x040702 | |
|
152 | }; | |
|
153 | setAttribute(attribute, true); | |
|
154 | #else // QT_VERSION < 0x050000 | |
|
155 | Q_UNUSED(orientation) | |
|
156 | #endif // QT_VERSION < 0x050000 | |
|
157 | } | |
|
181 | 158 | |
|
182 | 159 | void QmlApplicationViewer::showExpanded() |
|
183 | 160 | { |
|
184 |
#if defined( |
|
|
185 |
|
|
|
186 | #elif defined(Q_WS_MAEMO_5) | |
|
187 |
|
|
|
161 | #if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR) | |
|
162 | showFullScreen(); | |
|
163 | #elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX) | |
|
164 | showMaximized(); | |
|
188 | 165 | #else |
|
189 |
|
|
|
166 | show(); | |
|
190 | 167 | #endif |
|
191 | 168 | } |
|
192 | 169 |
@@ -1,4 +1,4 | |||
|
1 |
// checksum 0x |
|
|
1 | // checksum 0xc67a version 0x80016 | |
|
2 | 2 | /* |
|
3 | 3 | This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
4 | 4 | QmlApplicationViewer is a convenience class containing mobile device specific |
@@ -11,7 +11,7 | |||
|
11 | 11 | #ifndef QMLAPPLICATIONVIEWER_H |
|
12 | 12 | #define QMLAPPLICATIONVIEWER_H |
|
13 | 13 | |
|
14 |
#include <Q |
|
|
14 | #include <QDeclarativeView> | |
|
15 | 15 | |
|
16 | 16 | class QmlApplicationViewer : public QDeclarativeView |
|
17 | 17 | { |
@@ -32,13 +32,12 public: | |||
|
32 | 32 | void setMainQmlFile(const QString &file); |
|
33 | 33 | void addImportPath(const QString &path); |
|
34 | 34 | |
|
35 |
// Note that this will only have an effect on |
|
|
36 |
|
|
|
35 | // Note that this will only have an effect on Fremantle. | |
|
36 | void setOrientation(ScreenOrientation orientation); | |
|
37 | 37 | |
|
38 | 38 | void showExpanded(); |
|
39 | 39 | |
|
40 | 40 | private: |
|
41 | explicit QmlApplicationViewer(QDeclarativeView *view, QWidget *parent); | |
|
42 | 41 | class QmlApplicationViewerPrivate *d; |
|
43 | 42 | }; |
|
44 | 43 |
@@ -1,4 +1,4 | |||
|
1 |
// checksum 0x |
|
|
1 | // checksum 0xbd34 version 0x80016 | |
|
2 | 2 | /* |
|
3 | 3 | This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
4 | 4 | QmlApplicationViewer is a convenience class containing mobile device specific |
@@ -12,10 +12,10 | |||
|
12 | 12 | |
|
13 | 13 | #include <QDir> |
|
14 | 14 | #include <QFileInfo> |
|
15 | #include <QtDeclarative/QDeclarativeComponent> | |
|
16 | #include <QtDeclarative/QDeclarativeEngine> | |
|
17 | #include <QtDeclarative/QDeclarativeContext> | |
|
18 | 15 | #include <QApplication> |
|
16 | #include <QDeclarativeComponent> | |
|
17 | #include <QDeclarativeEngine> | |
|
18 | #include <QDeclarativeContext> | |
|
19 | 19 | |
|
20 | 20 | #include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN |
|
21 | 21 | |
@@ -57,17 +57,22 class QmlApplicationViewerPrivate | |||
|
57 | 57 | |
|
58 | 58 | QString QmlApplicationViewerPrivate::adjustPath(const QString &path) |
|
59 | 59 | { |
|
60 | #ifdef Q_OS_UNIX | |
|
61 | 60 | #ifdef Q_OS_MAC |
|
62 | 61 | if (!QDir::isAbsolutePath(path)) |
|
63 | 62 | return QString::fromLatin1("%1/../Resources/%2") |
|
64 | 63 | .arg(QCoreApplication::applicationDirPath(), path); |
|
65 | #else | |
|
66 | const QString pathInInstallDir = | |
|
64 | #elif defined(Q_OS_QNX) | |
|
65 | if (!QDir::isAbsolutePath(path)) | |
|
66 | return QString::fromLatin1("app/native/%1").arg(path); | |
|
67 | #elif !defined(Q_OS_ANDROID) | |
|
68 | QString pathInInstallDir = | |
|
67 | 69 | QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); |
|
68 | 70 | if (QFileInfo(pathInInstallDir).exists()) |
|
69 | 71 | return pathInInstallDir; |
|
70 | #endif | |
|
72 | pathInInstallDir = | |
|
73 | QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path); | |
|
74 | if (QFileInfo(pathInInstallDir).exists()) | |
|
75 | return pathInInstallDir; | |
|
71 | 76 | #endif |
|
72 | 77 | return path; |
|
73 | 78 | } |
@@ -78,6 +83,7 QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) | |||
|
78 | 83 | { |
|
79 | 84 | connect(engine(), SIGNAL(quit()), SLOT(close())); |
|
80 | 85 | setResizeMode(QDeclarativeView::SizeRootObjectToView); |
|
86 | ||
|
81 | 87 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in |
|
82 | 88 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 |
|
83 | 89 | #if !defined(NO_JSDEBUGGER) |
@@ -102,7 +108,11 QmlApplicationViewer *QmlApplicationViewer::create() | |||
|
102 | 108 | void QmlApplicationViewer::setMainQmlFile(const QString &file) |
|
103 | 109 | { |
|
104 | 110 | d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); |
|
111 | #ifdef Q_OS_ANDROID | |
|
112 | setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile)); | |
|
113 | #else | |
|
105 | 114 | setSource(QUrl::fromLocalFile(d->mainQmlFile)); |
|
115 | #endif | |
|
106 | 116 | } |
|
107 | 117 | |
|
108 | 118 | void QmlApplicationViewer::addImportPath(const QString &path) |
@@ -110,54 +120,47 void QmlApplicationViewer::addImportPath(const QString &path) | |||
|
110 | 120 | engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); |
|
111 | 121 | } |
|
112 | 122 | |
|
113 |
|
|
|
114 | //{ | |
|
115 | //#if defined(Q_OS_SYMBIAN) | |
|
116 | // // If the version of Qt on the device is < 4.7.2, that attribute won't work | |
|
117 | // if (orientation != ScreenOrientationAuto) { | |
|
118 | // const QStringList v = QString::fromLatin1(qVersion()).split(QLatin1Char('.')); | |
|
119 | // if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { | |
|
120 | // qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); | |
|
121 | // return; | |
|
122 |
|
|
|
123 | // } | |
|
124 | //#endif // Q_OS_SYMBIAN | |
|
125 | ||
|
126 | // Qt::WidgetAttribute attribute; | |
|
127 | // switch (orientation) { | |
|
128 | //#if QT_VERSION < 0x040702 | |
|
129 | // // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |
|
130 | // case ScreenOrientationLockPortrait: | |
|
131 | // attribute = static_cast<Qt::WidgetAttribute>(128); | |
|
132 | // break; | |
|
133 | // case ScreenOrientationLockLandscape: | |
|
134 | // attribute = static_cast<Qt::WidgetAttribute>(129); | |
|
135 | // break; | |
|
136 | // default: | |
|
137 | // case ScreenOrientationAuto: | |
|
138 | // attribute = static_cast<Qt::WidgetAttribute>(130); | |
|
139 | // break; | |
|
140 | //#else // QT_VERSION < 0x040702 | |
|
141 | // case ScreenOrientationLockPortrait: | |
|
142 | // attribute = Qt::WA_LockPortraitOrientation; | |
|
143 | // break; | |
|
144 | // case ScreenOrientationLockLandscape: | |
|
145 | // attribute = Qt::WA_LockLandscapeOrientation; | |
|
146 | // break; | |
|
147 | // default: | |
|
148 | // case ScreenOrientationAuto: | |
|
149 | // attribute = Qt::WA_AutoOrientation; | |
|
150 | // break; | |
|
151 | //#endif // QT_VERSION < 0x040702 | |
|
152 | // }; | |
|
153 | // setAttribute(attribute, true); | |
|
154 | //} | |
|
123 | void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) | |
|
124 | { | |
|
125 | #if QT_VERSION < 0x050000 | |
|
126 | Qt::WidgetAttribute attribute; | |
|
127 | switch (orientation) { | |
|
128 | #if QT_VERSION < 0x040702 | |
|
129 | // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |
|
130 | case ScreenOrientationLockPortrait: | |
|
131 | attribute = static_cast<Qt::WidgetAttribute>(128); | |
|
132 | break; | |
|
133 | case ScreenOrientationLockLandscape: | |
|
134 | attribute = static_cast<Qt::WidgetAttribute>(129); | |
|
135 | break; | |
|
136 | default: | |
|
137 | case ScreenOrientationAuto: | |
|
138 | attribute = static_cast<Qt::WidgetAttribute>(130); | |
|
139 | break; | |
|
140 | #else // QT_VERSION < 0x040702 | |
|
141 | case ScreenOrientationLockPortrait: | |
|
142 | attribute = Qt::WA_LockPortraitOrientation; | |
|
143 | break; | |
|
144 | case ScreenOrientationLockLandscape: | |
|
145 | attribute = Qt::WA_LockLandscapeOrientation; | |
|
146 | break; | |
|
147 | default: | |
|
148 | case ScreenOrientationAuto: | |
|
149 | attribute = Qt::WA_AutoOrientation; | |
|
150 | break; | |
|
151 | #endif // QT_VERSION < 0x040702 | |
|
152 | }; | |
|
153 | setAttribute(attribute, true); | |
|
154 | #else // QT_VERSION < 0x050000 | |
|
155 | Q_UNUSED(orientation) | |
|
156 | #endif // QT_VERSION < 0x050000 | |
|
157 | } | |
|
155 | 158 | |
|
156 | 159 | void QmlApplicationViewer::showExpanded() |
|
157 | 160 | { |
|
158 |
#if defined( |
|
|
161 | #if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR) | |
|
159 | 162 | showFullScreen(); |
|
160 | #elif defined(Q_WS_MAEMO_5) | |
|
163 | #elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX) | |
|
161 | 164 | showMaximized(); |
|
162 | 165 | #else |
|
163 | 166 | show(); |
@@ -1,4 +1,4 | |||
|
1 |
// checksum 0x |
|
|
1 | // checksum 0xc67a version 0x80016 | |
|
2 | 2 | /* |
|
3 | 3 | This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
4 | 4 | QmlApplicationViewer is a convenience class containing mobile device specific |
@@ -32,8 +32,8 public: | |||
|
32 | 32 | void setMainQmlFile(const QString &file); |
|
33 | 33 | void addImportPath(const QString &path); |
|
34 | 34 | |
|
35 |
// Note that this will only have an effect on |
|
|
36 |
|
|
|
35 | // Note that this will only have an effect on Fremantle. | |
|
36 | void setOrientation(ScreenOrientation orientation); | |
|
37 | 37 | |
|
38 | 38 | void showExpanded(); |
|
39 | 39 |
@@ -1,4 +1,4 | |||
|
1 |
# checksum 0x |
|
|
1 | # checksum 0x77b version 0x80016 | |
|
2 | 2 | # This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
3 | 3 | # The code below adds the QmlApplicationViewer to the project and handles the |
|
4 | 4 | # activation of QML debugging. |
@@ -22,7 +22,7 contains(CONFIG,qdeclarative-boostable):contains(MEEGO_EDITION,harmattan) { | |||
|
22 | 22 | DEFINES += HARMATTAN_BOOSTER |
|
23 | 23 | } |
|
24 | 24 | # This file was generated by an application wizard of Qt Creator. |
|
25 |
# The code below handles deployment to |
|
|
25 | # The code below handles deployment to Android and Maemo, aswell as copying | |
|
26 | 26 | # of the application data to shadow build directories on desktop. |
|
27 | 27 | # It is recommended not to modify this file, since newer versions of Qt Creator |
|
28 | 28 | # may offer an updated version of it. |
@@ -30,7 +30,11 contains(CONFIG,qdeclarative-boostable):contains(MEEGO_EDITION,harmattan) { | |||
|
30 | 30 | defineTest(qtcAddDeployment) { |
|
31 | 31 | for(deploymentfolder, DEPLOYMENTFOLDERS) { |
|
32 | 32 | item = item$${deploymentfolder} |
|
33 | greaterThan(QT_MAJOR_VERSION, 4) { | |
|
34 | itemsources = $${item}.files | |
|
35 | } else { | |
|
33 | 36 | itemsources = $${item}.sources |
|
37 | } | |
|
34 | 38 | $$itemsources = $$eval($${deploymentfolder}.source) |
|
35 | 39 | itempath = $${item}.path |
|
36 | 40 | $$itempath= $$eval($${deploymentfolder}.target) |
@@ -41,9 +45,28 for(deploymentfolder, DEPLOYMENTFOLDERS) { | |||
|
41 | 45 | |
|
42 | 46 | MAINPROFILEPWD = $$PWD |
|
43 | 47 | |
|
44 | symbian { | |
|
45 | isEmpty(ICON):exists($${TARGET}.svg):ICON = $${TARGET}.svg | |
|
46 | isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 | |
|
48 | android { | |
|
49 | for(deploymentfolder, DEPLOYMENTFOLDERS) { | |
|
50 | item = item$${deploymentfolder} | |
|
51 | itemfiles = $${item}.files | |
|
52 | $$itemfiles = $$eval($${deploymentfolder}.source) | |
|
53 | itempath = $${item}.path | |
|
54 | $$itempath = /assets/$$eval($${deploymentfolder}.target) | |
|
55 | export($$itemfiles) | |
|
56 | export($$itempath) | |
|
57 | INSTALLS += $$item | |
|
58 | } | |
|
59 | ||
|
60 | x86 { | |
|
61 | target.path = /libs/x86 | |
|
62 | } else: armeabi-v7a { | |
|
63 | target.path = /libs/armeabi-v7a | |
|
64 | } else { | |
|
65 | target.path = /libs/armeabi | |
|
66 | } | |
|
67 | ||
|
68 | export(target.path) | |
|
69 | INSTALLS += target | |
|
47 | 70 | } else:win32 { |
|
48 | 71 | copyCommand = |
|
49 | 72 | for(deploymentfolder, DEPLOYMENTFOLDERS) { |
@@ -141,8 +164,6 symbian { | |||
|
141 | 164 | export (ICON) |
|
142 | 165 | export (INSTALLS) |
|
143 | 166 | export (DEPLOYMENT) |
|
144 | export (TARGET.EPOCHEAPSIZE) | |
|
145 | export (TARGET.CAPABILITY) | |
|
146 | 167 | export (LIBS) |
|
147 | 168 | export (QMAKE_EXTRA_TARGETS) |
|
148 | 169 | } |
@@ -1,4 +1,4 | |||
|
1 |
// checksum 0x |
|
|
1 | // checksum 0xbd34 version 0x80016 | |
|
2 | 2 | /* |
|
3 | 3 | This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
4 | 4 | QmlApplicationViewer is a convenience class containing mobile device specific |
@@ -10,12 +10,12 | |||
|
10 | 10 | |
|
11 | 11 | #include "qmlapplicationviewer.h" |
|
12 | 12 | |
|
13 |
#include <Q |
|
|
14 |
#include <Q |
|
|
15 | #include <QtDeclarative/QDeclarativeComponent> | |
|
16 | #include <QtDeclarative/QDeclarativeEngine> | |
|
17 | #include <QtDeclarative/QDeclarativeContext> | |
|
13 | #include <QDir> | |
|
14 | #include <QFileInfo> | |
|
18 | 15 | #include <QApplication> |
|
16 | #include <QDeclarativeComponent> | |
|
17 | #include <QDeclarativeEngine> | |
|
18 | #include <QDeclarativeContext> | |
|
19 | 19 | |
|
20 | 20 | #include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN |
|
21 | 21 | |
@@ -50,63 +50,47 static QmlJsDebuggingEnabler enableDebuggingHelper; | |||
|
50 | 50 | |
|
51 | 51 | class QmlApplicationViewerPrivate |
|
52 | 52 | { |
|
53 | QmlApplicationViewerPrivate(QDeclarativeView *view_) : view(view_) {} | |
|
54 | ||
|
55 | 53 | QString mainQmlFile; |
|
56 | QDeclarativeView *view; | |
|
57 | 54 | friend class QmlApplicationViewer; |
|
58 | QString adjustPath(const QString &path); | |
|
55 | static QString adjustPath(const QString &path); | |
|
59 | 56 | }; |
|
60 | 57 | |
|
61 | 58 | QString QmlApplicationViewerPrivate::adjustPath(const QString &path) |
|
62 | 59 | { |
|
63 | #ifdef Q_OS_UNIX | |
|
64 | 60 | #ifdef Q_OS_MAC |
|
65 | 61 | if (!QDir::isAbsolutePath(path)) |
|
66 | return QCoreApplication::applicationDirPath() | |
|
67 | + QLatin1String("/../Resources/") + path; | |
|
68 | #else | |
|
69 | QString pathInInstallDir; | |
|
70 | const QString applicationDirPath = QCoreApplication::applicationDirPath(); | |
|
71 | pathInInstallDir = QString::fromAscii("%1/../%2").arg(applicationDirPath, path); | |
|
72 | ||
|
62 | return QString::fromLatin1("%1/../Resources/%2") | |
|
63 | .arg(QCoreApplication::applicationDirPath(), path); | |
|
64 | #elif defined(Q_OS_QNX) | |
|
65 | if (!QDir::isAbsolutePath(path)) | |
|
66 | return QString::fromLatin1("app/native/%1").arg(path); | |
|
67 | #elif !defined(Q_OS_ANDROID) | |
|
68 | QString pathInInstallDir = | |
|
69 | QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); | |
|
70 | if (QFileInfo(pathInInstallDir).exists()) | |
|
71 | return pathInInstallDir; | |
|
72 | pathInInstallDir = | |
|
73 | QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path); | |
|
73 | 74 | if (QFileInfo(pathInInstallDir).exists()) |
|
74 | 75 | return pathInInstallDir; |
|
75 | #endif | |
|
76 | 76 | #endif |
|
77 | 77 | return path; |
|
78 | 78 | } |
|
79 | 79 | |
|
80 | 80 | QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) |
|
81 | 81 | : QDeclarativeView(parent) |
|
82 |
, d(new QmlApplicationViewerPrivate( |
|
|
82 | , d(new QmlApplicationViewerPrivate()) | |
|
83 | 83 | { |
|
84 | 84 | connect(engine(), SIGNAL(quit()), SLOT(close())); |
|
85 | 85 | setResizeMode(QDeclarativeView::SizeRootObjectToView); |
|
86 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in | |
|
87 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 | |
|
88 | #if !defined(NO_JSDEBUGGER) | |
|
89 | new QmlJSDebugger::JSDebuggerAgent(d->view->engine()); | |
|
90 | #endif | |
|
91 | #if !defined(NO_QMLOBSERVER) | |
|
92 | new QmlJSDebugger::QDeclarativeViewObserver(d->view, d->view); | |
|
93 | #endif | |
|
94 | #endif | |
|
95 | } | |
|
96 | 86 | |
|
97 | QmlApplicationViewer::QmlApplicationViewer(QDeclarativeView *view, QWidget *parent) | |
|
98 | : QDeclarativeView(parent) | |
|
99 | , d(new QmlApplicationViewerPrivate(view)) | |
|
100 | { | |
|
101 | connect(view->engine(), SIGNAL(quit()), view, SLOT(close())); | |
|
102 | view->setResizeMode(QDeclarativeView::SizeRootObjectToView); | |
|
103 | 87 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in |
|
104 | 88 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 |
|
105 | 89 | #if !defined(NO_JSDEBUGGER) |
|
106 |
new QmlJSDebugger::JSDebuggerAgent( |
|
|
90 | new QmlJSDebugger::JSDebuggerAgent(engine()); | |
|
107 | 91 | #endif |
|
108 | 92 | #if !defined(NO_QMLOBSERVER) |
|
109 |
new QmlJSDebugger::QDeclarativeViewObserver( |
|
|
93 | new QmlJSDebugger::QDeclarativeViewObserver(this, this); | |
|
110 | 94 | #endif |
|
111 | 95 | #endif |
|
112 | 96 | } |
@@ -118,75 +102,68 QmlApplicationViewer::~QmlApplicationViewer() | |||
|
118 | 102 | |
|
119 | 103 | QmlApplicationViewer *QmlApplicationViewer::create() |
|
120 | 104 | { |
|
121 | #ifdef HARMATTAN_BOOSTER | |
|
122 | return new QmlApplicationViewer(MDeclarativeCache::qDeclarativeView(), 0); | |
|
123 | #else | |
|
124 | 105 | return new QmlApplicationViewer(); |
|
125 | #endif | |
|
126 | 106 | } |
|
127 | 107 | |
|
128 | 108 | void QmlApplicationViewer::setMainQmlFile(const QString &file) |
|
129 | 109 | { |
|
130 |
d->mainQmlFile = |
|
|
131 | d->view->setSource(QUrl::fromLocalFile(d->mainQmlFile)); | |
|
110 | d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); | |
|
111 | #ifdef Q_OS_ANDROID | |
|
112 | setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile)); | |
|
113 | #else | |
|
114 | setSource(QUrl::fromLocalFile(d->mainQmlFile)); | |
|
115 | #endif | |
|
132 | 116 | } |
|
133 | 117 | |
|
134 | 118 | void QmlApplicationViewer::addImportPath(const QString &path) |
|
135 | 119 | { |
|
136 |
|
|
|
120 | engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); | |
|
137 | 121 | } |
|
138 | 122 | |
|
139 |
|
|
|
140 | //{ | |
|
141 | //#if defined(Q_OS_SYMBIAN) | |
|
142 | // // If the version of Qt on the device is < 4.7.2, that attribute won't work | |
|
143 | // if (orientation != ScreenOrientationAuto) { | |
|
144 | // const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.')); | |
|
145 | // if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { | |
|
146 | // qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); | |
|
147 | // return; | |
|
148 |
|
|
|
149 | // } | |
|
150 | //#endif // Q_OS_SYMBIAN | |
|
151 | ||
|
152 | // Qt::WidgetAttribute attribute; | |
|
153 | // switch (orientation) { | |
|
154 | //#if QT_VERSION < 0x040702 | |
|
155 | // // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |
|
156 | // case ScreenOrientationLockPortrait: | |
|
157 | // attribute = static_cast<Qt::WidgetAttribute>(128); | |
|
158 | // break; | |
|
159 | // case ScreenOrientationLockLandscape: | |
|
160 | // attribute = static_cast<Qt::WidgetAttribute>(129); | |
|
161 | // break; | |
|
162 | // default: | |
|
163 | // case ScreenOrientationAuto: | |
|
164 | // attribute = static_cast<Qt::WidgetAttribute>(130); | |
|
165 | // break; | |
|
166 | //#else // QT_VERSION < 0x040702 | |
|
167 | // case ScreenOrientationLockPortrait: | |
|
168 | // attribute = Qt::WA_LockPortraitOrientation; | |
|
169 | // break; | |
|
170 | // case ScreenOrientationLockLandscape: | |
|
171 | // attribute = Qt::WA_LockLandscapeOrientation; | |
|
172 | // break; | |
|
173 | // default: | |
|
174 | // case ScreenOrientationAuto: | |
|
175 | // attribute = Qt::WA_AutoOrientation; | |
|
176 | // break; | |
|
177 | //#endif // QT_VERSION < 0x040702 | |
|
178 | // }; | |
|
179 | // setAttribute(attribute, true); | |
|
180 | //} | |
|
123 | void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) | |
|
124 | { | |
|
125 | #if QT_VERSION < 0x050000 | |
|
126 | Qt::WidgetAttribute attribute; | |
|
127 | switch (orientation) { | |
|
128 | #if QT_VERSION < 0x040702 | |
|
129 | // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |
|
130 | case ScreenOrientationLockPortrait: | |
|
131 | attribute = static_cast<Qt::WidgetAttribute>(128); | |
|
132 | break; | |
|
133 | case ScreenOrientationLockLandscape: | |
|
134 | attribute = static_cast<Qt::WidgetAttribute>(129); | |
|
135 | break; | |
|
136 | default: | |
|
137 | case ScreenOrientationAuto: | |
|
138 | attribute = static_cast<Qt::WidgetAttribute>(130); | |
|
139 | break; | |
|
140 | #else // QT_VERSION < 0x040702 | |
|
141 | case ScreenOrientationLockPortrait: | |
|
142 | attribute = Qt::WA_LockPortraitOrientation; | |
|
143 | break; | |
|
144 | case ScreenOrientationLockLandscape: | |
|
145 | attribute = Qt::WA_LockLandscapeOrientation; | |
|
146 | break; | |
|
147 | default: | |
|
148 | case ScreenOrientationAuto: | |
|
149 | attribute = Qt::WA_AutoOrientation; | |
|
150 | break; | |
|
151 | #endif // QT_VERSION < 0x040702 | |
|
152 | }; | |
|
153 | setAttribute(attribute, true); | |
|
154 | #else // QT_VERSION < 0x050000 | |
|
155 | Q_UNUSED(orientation) | |
|
156 | #endif // QT_VERSION < 0x050000 | |
|
157 | } | |
|
181 | 158 | |
|
182 | 159 | void QmlApplicationViewer::showExpanded() |
|
183 | 160 | { |
|
184 |
#if defined( |
|
|
185 |
|
|
|
186 | #elif defined(Q_WS_MAEMO_5) | |
|
187 |
|
|
|
161 | #if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR) | |
|
162 | showFullScreen(); | |
|
163 | #elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX) | |
|
164 | showMaximized(); | |
|
188 | 165 | #else |
|
189 |
|
|
|
166 | show(); | |
|
190 | 167 | #endif |
|
191 | 168 | } |
|
192 | 169 |
@@ -1,4 +1,4 | |||
|
1 |
// checksum 0x |
|
|
1 | // checksum 0xc67a version 0x80016 | |
|
2 | 2 | /* |
|
3 | 3 | This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
4 | 4 | QmlApplicationViewer is a convenience class containing mobile device specific |
@@ -11,7 +11,7 | |||
|
11 | 11 | #ifndef QMLAPPLICATIONVIEWER_H |
|
12 | 12 | #define QMLAPPLICATIONVIEWER_H |
|
13 | 13 | |
|
14 |
#include <Q |
|
|
14 | #include <QDeclarativeView> | |
|
15 | 15 | |
|
16 | 16 | class QmlApplicationViewer : public QDeclarativeView |
|
17 | 17 | { |
@@ -32,13 +32,12 public: | |||
|
32 | 32 | void setMainQmlFile(const QString &file); |
|
33 | 33 | void addImportPath(const QString &path); |
|
34 | 34 | |
|
35 |
// Note that this will only have an effect on |
|
|
36 |
|
|
|
35 | // Note that this will only have an effect on Fremantle. | |
|
36 | void setOrientation(ScreenOrientation orientation); | |
|
37 | 37 | |
|
38 | 38 | void showExpanded(); |
|
39 | 39 | |
|
40 | 40 | private: |
|
41 | explicit QmlApplicationViewer(QDeclarativeView *view, QWidget *parent); | |
|
42 | 41 | class QmlApplicationViewerPrivate *d; |
|
43 | 42 | }; |
|
44 | 43 |
@@ -1,4 +1,4 | |||
|
1 |
// checksum 0x |
|
|
1 | // checksum 0xbd34 version 0x80016 | |
|
2 | 2 | /* |
|
3 | 3 | This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
4 | 4 | QmlApplicationViewer is a convenience class containing mobile device specific |
@@ -10,12 +10,12 | |||
|
10 | 10 | |
|
11 | 11 | #include "qmlapplicationviewer.h" |
|
12 | 12 | |
|
13 |
#include <Q |
|
|
14 |
#include <Q |
|
|
15 | #include <QtDeclarative/QDeclarativeComponent> | |
|
16 | #include <QtDeclarative/QDeclarativeEngine> | |
|
17 | #include <QtDeclarative/QDeclarativeContext> | |
|
13 | #include <QDir> | |
|
14 | #include <QFileInfo> | |
|
18 | 15 | #include <QApplication> |
|
16 | #include <QDeclarativeComponent> | |
|
17 | #include <QDeclarativeEngine> | |
|
18 | #include <QDeclarativeContext> | |
|
19 | 19 | |
|
20 | 20 | #include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN |
|
21 | 21 | |
@@ -50,63 +50,47 static QmlJsDebuggingEnabler enableDebuggingHelper; | |||
|
50 | 50 | |
|
51 | 51 | class QmlApplicationViewerPrivate |
|
52 | 52 | { |
|
53 | QmlApplicationViewerPrivate(QDeclarativeView *view_) : view(view_) {} | |
|
54 | ||
|
55 | 53 | QString mainQmlFile; |
|
56 | QDeclarativeView *view; | |
|
57 | 54 | friend class QmlApplicationViewer; |
|
58 | QString adjustPath(const QString &path); | |
|
55 | static QString adjustPath(const QString &path); | |
|
59 | 56 | }; |
|
60 | 57 | |
|
61 | 58 | QString QmlApplicationViewerPrivate::adjustPath(const QString &path) |
|
62 | 59 | { |
|
63 | #ifdef Q_OS_UNIX | |
|
64 | 60 | #ifdef Q_OS_MAC |
|
65 | 61 | if (!QDir::isAbsolutePath(path)) |
|
66 | return QCoreApplication::applicationDirPath() | |
|
67 | + QLatin1String("/../Resources/") + path; | |
|
68 | #else | |
|
69 | QString pathInInstallDir; | |
|
70 | const QString applicationDirPath = QCoreApplication::applicationDirPath(); | |
|
71 | pathInInstallDir = QString::fromAscii("%1/../%2").arg(applicationDirPath, path); | |
|
72 | ||
|
62 | return QString::fromLatin1("%1/../Resources/%2") | |
|
63 | .arg(QCoreApplication::applicationDirPath(), path); | |
|
64 | #elif defined(Q_OS_QNX) | |
|
65 | if (!QDir::isAbsolutePath(path)) | |
|
66 | return QString::fromLatin1("app/native/%1").arg(path); | |
|
67 | #elif !defined(Q_OS_ANDROID) | |
|
68 | QString pathInInstallDir = | |
|
69 | QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); | |
|
70 | if (QFileInfo(pathInInstallDir).exists()) | |
|
71 | return pathInInstallDir; | |
|
72 | pathInInstallDir = | |
|
73 | QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path); | |
|
73 | 74 | if (QFileInfo(pathInInstallDir).exists()) |
|
74 | 75 | return pathInInstallDir; |
|
75 | #endif | |
|
76 | 76 | #endif |
|
77 | 77 | return path; |
|
78 | 78 | } |
|
79 | 79 | |
|
80 | 80 | QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) |
|
81 | 81 | : QDeclarativeView(parent) |
|
82 |
, d(new QmlApplicationViewerPrivate( |
|
|
82 | , d(new QmlApplicationViewerPrivate()) | |
|
83 | 83 | { |
|
84 | 84 | connect(engine(), SIGNAL(quit()), SLOT(close())); |
|
85 | 85 | setResizeMode(QDeclarativeView::SizeRootObjectToView); |
|
86 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in | |
|
87 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 | |
|
88 | #if !defined(NO_JSDEBUGGER) | |
|
89 | new QmlJSDebugger::JSDebuggerAgent(d->view->engine()); | |
|
90 | #endif | |
|
91 | #if !defined(NO_QMLOBSERVER) | |
|
92 | new QmlJSDebugger::QDeclarativeViewObserver(d->view, d->view); | |
|
93 | #endif | |
|
94 | #endif | |
|
95 | } | |
|
96 | 86 | |
|
97 | QmlApplicationViewer::QmlApplicationViewer(QDeclarativeView *view, QWidget *parent) | |
|
98 | : QDeclarativeView(parent) | |
|
99 | , d(new QmlApplicationViewerPrivate(view)) | |
|
100 | { | |
|
101 | connect(view->engine(), SIGNAL(quit()), view, SLOT(close())); | |
|
102 | view->setResizeMode(QDeclarativeView::SizeRootObjectToView); | |
|
103 | 87 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in |
|
104 | 88 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 |
|
105 | 89 | #if !defined(NO_JSDEBUGGER) |
|
106 |
new QmlJSDebugger::JSDebuggerAgent( |
|
|
90 | new QmlJSDebugger::JSDebuggerAgent(engine()); | |
|
107 | 91 | #endif |
|
108 | 92 | #if !defined(NO_QMLOBSERVER) |
|
109 |
new QmlJSDebugger::QDeclarativeViewObserver( |
|
|
93 | new QmlJSDebugger::QDeclarativeViewObserver(this, this); | |
|
110 | 94 | #endif |
|
111 | 95 | #endif |
|
112 | 96 | } |
@@ -118,75 +102,68 QmlApplicationViewer::~QmlApplicationViewer() | |||
|
118 | 102 | |
|
119 | 103 | QmlApplicationViewer *QmlApplicationViewer::create() |
|
120 | 104 | { |
|
121 | #ifdef HARMATTAN_BOOSTER | |
|
122 | return new QmlApplicationViewer(MDeclarativeCache::qDeclarativeView(), 0); | |
|
123 | #else | |
|
124 | 105 | return new QmlApplicationViewer(); |
|
125 | #endif | |
|
126 | 106 | } |
|
127 | 107 | |
|
128 | 108 | void QmlApplicationViewer::setMainQmlFile(const QString &file) |
|
129 | 109 | { |
|
130 |
d->mainQmlFile = |
|
|
131 | d->view->setSource(QUrl::fromLocalFile(d->mainQmlFile)); | |
|
110 | d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); | |
|
111 | #ifdef Q_OS_ANDROID | |
|
112 | setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile)); | |
|
113 | #else | |
|
114 | setSource(QUrl::fromLocalFile(d->mainQmlFile)); | |
|
115 | #endif | |
|
132 | 116 | } |
|
133 | 117 | |
|
134 | 118 | void QmlApplicationViewer::addImportPath(const QString &path) |
|
135 | 119 | { |
|
136 |
|
|
|
120 | engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); | |
|
137 | 121 | } |
|
138 | 122 | |
|
139 |
|
|
|
140 | //{ | |
|
141 | //#if defined(Q_OS_SYMBIAN) | |
|
142 | // // If the version of Qt on the device is < 4.7.2, that attribute won't work | |
|
143 | // if (orientation != ScreenOrientationAuto) { | |
|
144 | // const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.')); | |
|
145 | // if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { | |
|
146 | // qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); | |
|
147 | // return; | |
|
148 |
|
|
|
149 | // } | |
|
150 | //#endif // Q_OS_SYMBIAN | |
|
151 | ||
|
152 | // Qt::WidgetAttribute attribute; | |
|
153 | // switch (orientation) { | |
|
154 | //#if QT_VERSION < 0x040702 | |
|
155 | // // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |
|
156 | // case ScreenOrientationLockPortrait: | |
|
157 | // attribute = static_cast<Qt::WidgetAttribute>(128); | |
|
158 | // break; | |
|
159 | // case ScreenOrientationLockLandscape: | |
|
160 | // attribute = static_cast<Qt::WidgetAttribute>(129); | |
|
161 | // break; | |
|
162 | // default: | |
|
163 | // case ScreenOrientationAuto: | |
|
164 | // attribute = static_cast<Qt::WidgetAttribute>(130); | |
|
165 | // break; | |
|
166 | //#else // QT_VERSION < 0x040702 | |
|
167 | // case ScreenOrientationLockPortrait: | |
|
168 | // attribute = Qt::WA_LockPortraitOrientation; | |
|
169 | // break; | |
|
170 | // case ScreenOrientationLockLandscape: | |
|
171 | // attribute = Qt::WA_LockLandscapeOrientation; | |
|
172 | // break; | |
|
173 | // default: | |
|
174 | // case ScreenOrientationAuto: | |
|
175 | // attribute = Qt::WA_AutoOrientation; | |
|
176 | // break; | |
|
177 | //#endif // QT_VERSION < 0x040702 | |
|
178 | // }; | |
|
179 | // setAttribute(attribute, true); | |
|
180 | //} | |
|
123 | void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) | |
|
124 | { | |
|
125 | #if QT_VERSION < 0x050000 | |
|
126 | Qt::WidgetAttribute attribute; | |
|
127 | switch (orientation) { | |
|
128 | #if QT_VERSION < 0x040702 | |
|
129 | // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |
|
130 | case ScreenOrientationLockPortrait: | |
|
131 | attribute = static_cast<Qt::WidgetAttribute>(128); | |
|
132 | break; | |
|
133 | case ScreenOrientationLockLandscape: | |
|
134 | attribute = static_cast<Qt::WidgetAttribute>(129); | |
|
135 | break; | |
|
136 | default: | |
|
137 | case ScreenOrientationAuto: | |
|
138 | attribute = static_cast<Qt::WidgetAttribute>(130); | |
|
139 | break; | |
|
140 | #else // QT_VERSION < 0x040702 | |
|
141 | case ScreenOrientationLockPortrait: | |
|
142 | attribute = Qt::WA_LockPortraitOrientation; | |
|
143 | break; | |
|
144 | case ScreenOrientationLockLandscape: | |
|
145 | attribute = Qt::WA_LockLandscapeOrientation; | |
|
146 | break; | |
|
147 | default: | |
|
148 | case ScreenOrientationAuto: | |
|
149 | attribute = Qt::WA_AutoOrientation; | |
|
150 | break; | |
|
151 | #endif // QT_VERSION < 0x040702 | |
|
152 | }; | |
|
153 | setAttribute(attribute, true); | |
|
154 | #else // QT_VERSION < 0x050000 | |
|
155 | Q_UNUSED(orientation) | |
|
156 | #endif // QT_VERSION < 0x050000 | |
|
157 | } | |
|
181 | 158 | |
|
182 | 159 | void QmlApplicationViewer::showExpanded() |
|
183 | 160 | { |
|
184 |
#if defined( |
|
|
185 |
|
|
|
186 | #elif defined(Q_WS_MAEMO_5) | |
|
187 |
|
|
|
161 | #if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR) | |
|
162 | showFullScreen(); | |
|
163 | #elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX) | |
|
164 | showMaximized(); | |
|
188 | 165 | #else |
|
189 |
|
|
|
166 | show(); | |
|
190 | 167 | #endif |
|
191 | 168 | } |
|
192 | 169 |
@@ -1,4 +1,4 | |||
|
1 |
// checksum 0x |
|
|
1 | // checksum 0xc67a version 0x80016 | |
|
2 | 2 | /* |
|
3 | 3 | This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
4 | 4 | QmlApplicationViewer is a convenience class containing mobile device specific |
@@ -11,7 +11,7 | |||
|
11 | 11 | #ifndef QMLAPPLICATIONVIEWER_H |
|
12 | 12 | #define QMLAPPLICATIONVIEWER_H |
|
13 | 13 | |
|
14 |
#include <Q |
|
|
14 | #include <QDeclarativeView> | |
|
15 | 15 | |
|
16 | 16 | class QmlApplicationViewer : public QDeclarativeView |
|
17 | 17 | { |
@@ -32,13 +32,12 public: | |||
|
32 | 32 | void setMainQmlFile(const QString &file); |
|
33 | 33 | void addImportPath(const QString &path); |
|
34 | 34 | |
|
35 |
// Note that this will only have an effect on |
|
|
36 |
|
|
|
35 | // Note that this will only have an effect on Fremantle. | |
|
36 | void setOrientation(ScreenOrientation orientation); | |
|
37 | 37 | |
|
38 | 38 | void showExpanded(); |
|
39 | 39 | |
|
40 | 40 | private: |
|
41 | explicit QmlApplicationViewer(QDeclarativeView *view, QWidget *parent); | |
|
42 | 41 | class QmlApplicationViewerPrivate *d; |
|
43 | 42 | }; |
|
44 | 43 |
@@ -1,4 +1,4 | |||
|
1 |
// checksum 0x |
|
|
1 | // checksum 0xbd34 version 0x80016 | |
|
2 | 2 | /* |
|
3 | 3 | This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
4 | 4 | QmlApplicationViewer is a convenience class containing mobile device specific |
@@ -10,12 +10,12 | |||
|
10 | 10 | |
|
11 | 11 | #include "qmlapplicationviewer.h" |
|
12 | 12 | |
|
13 |
#include <Q |
|
|
14 |
#include <Q |
|
|
15 | #include <QtDeclarative/QDeclarativeComponent> | |
|
16 | #include <QtDeclarative/QDeclarativeEngine> | |
|
17 | #include <QtDeclarative/QDeclarativeContext> | |
|
13 | #include <QDir> | |
|
14 | #include <QFileInfo> | |
|
18 | 15 | #include <QApplication> |
|
16 | #include <QDeclarativeComponent> | |
|
17 | #include <QDeclarativeEngine> | |
|
18 | #include <QDeclarativeContext> | |
|
19 | 19 | |
|
20 | 20 | #include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN |
|
21 | 21 | |
@@ -50,63 +50,47 static QmlJsDebuggingEnabler enableDebuggingHelper; | |||
|
50 | 50 | |
|
51 | 51 | class QmlApplicationViewerPrivate |
|
52 | 52 | { |
|
53 | QmlApplicationViewerPrivate(QDeclarativeView *view_) : view(view_) {} | |
|
54 | ||
|
55 | 53 | QString mainQmlFile; |
|
56 | QDeclarativeView *view; | |
|
57 | 54 | friend class QmlApplicationViewer; |
|
58 | QString adjustPath(const QString &path); | |
|
55 | static QString adjustPath(const QString &path); | |
|
59 | 56 | }; |
|
60 | 57 | |
|
61 | 58 | QString QmlApplicationViewerPrivate::adjustPath(const QString &path) |
|
62 | 59 | { |
|
63 | #ifdef Q_OS_UNIX | |
|
64 | 60 | #ifdef Q_OS_MAC |
|
65 | 61 | if (!QDir::isAbsolutePath(path)) |
|
66 | return QCoreApplication::applicationDirPath() | |
|
67 | + QLatin1String("/../Resources/") + path; | |
|
68 | #else | |
|
69 | QString pathInInstallDir; | |
|
70 | const QString applicationDirPath = QCoreApplication::applicationDirPath(); | |
|
71 | pathInInstallDir = QString::fromAscii("%1/../%2").arg(applicationDirPath, path); | |
|
72 | ||
|
62 | return QString::fromLatin1("%1/../Resources/%2") | |
|
63 | .arg(QCoreApplication::applicationDirPath(), path); | |
|
64 | #elif defined(Q_OS_QNX) | |
|
65 | if (!QDir::isAbsolutePath(path)) | |
|
66 | return QString::fromLatin1("app/native/%1").arg(path); | |
|
67 | #elif !defined(Q_OS_ANDROID) | |
|
68 | QString pathInInstallDir = | |
|
69 | QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); | |
|
70 | if (QFileInfo(pathInInstallDir).exists()) | |
|
71 | return pathInInstallDir; | |
|
72 | pathInInstallDir = | |
|
73 | QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path); | |
|
73 | 74 | if (QFileInfo(pathInInstallDir).exists()) |
|
74 | 75 | return pathInInstallDir; |
|
75 | #endif | |
|
76 | 76 | #endif |
|
77 | 77 | return path; |
|
78 | 78 | } |
|
79 | 79 | |
|
80 | 80 | QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) |
|
81 | 81 | : QDeclarativeView(parent) |
|
82 |
, d(new QmlApplicationViewerPrivate( |
|
|
82 | , d(new QmlApplicationViewerPrivate()) | |
|
83 | 83 | { |
|
84 | 84 | connect(engine(), SIGNAL(quit()), SLOT(close())); |
|
85 | 85 | setResizeMode(QDeclarativeView::SizeRootObjectToView); |
|
86 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in | |
|
87 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 | |
|
88 | #if !defined(NO_JSDEBUGGER) | |
|
89 | new QmlJSDebugger::JSDebuggerAgent(d->view->engine()); | |
|
90 | #endif | |
|
91 | #if !defined(NO_QMLOBSERVER) | |
|
92 | new QmlJSDebugger::QDeclarativeViewObserver(d->view, d->view); | |
|
93 | #endif | |
|
94 | #endif | |
|
95 | } | |
|
96 | 86 | |
|
97 | QmlApplicationViewer::QmlApplicationViewer(QDeclarativeView *view, QWidget *parent) | |
|
98 | : QDeclarativeView(parent) | |
|
99 | , d(new QmlApplicationViewerPrivate(view)) | |
|
100 | { | |
|
101 | connect(view->engine(), SIGNAL(quit()), view, SLOT(close())); | |
|
102 | view->setResizeMode(QDeclarativeView::SizeRootObjectToView); | |
|
103 | 87 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in |
|
104 | 88 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 |
|
105 | 89 | #if !defined(NO_JSDEBUGGER) |
|
106 |
new QmlJSDebugger::JSDebuggerAgent( |
|
|
90 | new QmlJSDebugger::JSDebuggerAgent(engine()); | |
|
107 | 91 | #endif |
|
108 | 92 | #if !defined(NO_QMLOBSERVER) |
|
109 |
new QmlJSDebugger::QDeclarativeViewObserver( |
|
|
93 | new QmlJSDebugger::QDeclarativeViewObserver(this, this); | |
|
110 | 94 | #endif |
|
111 | 95 | #endif |
|
112 | 96 | } |
@@ -118,75 +102,68 QmlApplicationViewer::~QmlApplicationViewer() | |||
|
118 | 102 | |
|
119 | 103 | QmlApplicationViewer *QmlApplicationViewer::create() |
|
120 | 104 | { |
|
121 | #ifdef HARMATTAN_BOOSTER | |
|
122 | return new QmlApplicationViewer(MDeclarativeCache::qDeclarativeView(), 0); | |
|
123 | #else | |
|
124 | 105 | return new QmlApplicationViewer(); |
|
125 | #endif | |
|
126 | 106 | } |
|
127 | 107 | |
|
128 | 108 | void QmlApplicationViewer::setMainQmlFile(const QString &file) |
|
129 | 109 | { |
|
130 |
d->mainQmlFile = |
|
|
131 | d->view->setSource(QUrl::fromLocalFile(d->mainQmlFile)); | |
|
110 | d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); | |
|
111 | #ifdef Q_OS_ANDROID | |
|
112 | setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile)); | |
|
113 | #else | |
|
114 | setSource(QUrl::fromLocalFile(d->mainQmlFile)); | |
|
115 | #endif | |
|
132 | 116 | } |
|
133 | 117 | |
|
134 | 118 | void QmlApplicationViewer::addImportPath(const QString &path) |
|
135 | 119 | { |
|
136 |
|
|
|
120 | engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); | |
|
137 | 121 | } |
|
138 | 122 | |
|
139 |
|
|
|
140 | //{ | |
|
141 | //#if defined(Q_OS_SYMBIAN) | |
|
142 | // // If the version of Qt on the device is < 4.7.2, that attribute won't work | |
|
143 | // if (orientation != ScreenOrientationAuto) { | |
|
144 | // const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.')); | |
|
145 | // if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { | |
|
146 | // qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); | |
|
147 | // return; | |
|
148 |
|
|
|
149 | // } | |
|
150 | //#endif // Q_OS_SYMBIAN | |
|
151 | ||
|
152 | // Qt::WidgetAttribute attribute; | |
|
153 | // switch (orientation) { | |
|
154 | //#if QT_VERSION < 0x040702 | |
|
155 | // // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |
|
156 | // case ScreenOrientationLockPortrait: | |
|
157 | // attribute = static_cast<Qt::WidgetAttribute>(128); | |
|
158 | // break; | |
|
159 | // case ScreenOrientationLockLandscape: | |
|
160 | // attribute = static_cast<Qt::WidgetAttribute>(129); | |
|
161 | // break; | |
|
162 | // default: | |
|
163 | // case ScreenOrientationAuto: | |
|
164 | // attribute = static_cast<Qt::WidgetAttribute>(130); | |
|
165 | // break; | |
|
166 | //#else // QT_VERSION < 0x040702 | |
|
167 | // case ScreenOrientationLockPortrait: | |
|
168 | // attribute = Qt::WA_LockPortraitOrientation; | |
|
169 | // break; | |
|
170 | // case ScreenOrientationLockLandscape: | |
|
171 | // attribute = Qt::WA_LockLandscapeOrientation; | |
|
172 | // break; | |
|
173 | // default: | |
|
174 | // case ScreenOrientationAuto: | |
|
175 | // attribute = Qt::WA_AutoOrientation; | |
|
176 | // break; | |
|
177 | //#endif // QT_VERSION < 0x040702 | |
|
178 | // }; | |
|
179 | // setAttribute(attribute, true); | |
|
180 | //} | |
|
123 | void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) | |
|
124 | { | |
|
125 | #if QT_VERSION < 0x050000 | |
|
126 | Qt::WidgetAttribute attribute; | |
|
127 | switch (orientation) { | |
|
128 | #if QT_VERSION < 0x040702 | |
|
129 | // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |
|
130 | case ScreenOrientationLockPortrait: | |
|
131 | attribute = static_cast<Qt::WidgetAttribute>(128); | |
|
132 | break; | |
|
133 | case ScreenOrientationLockLandscape: | |
|
134 | attribute = static_cast<Qt::WidgetAttribute>(129); | |
|
135 | break; | |
|
136 | default: | |
|
137 | case ScreenOrientationAuto: | |
|
138 | attribute = static_cast<Qt::WidgetAttribute>(130); | |
|
139 | break; | |
|
140 | #else // QT_VERSION < 0x040702 | |
|
141 | case ScreenOrientationLockPortrait: | |
|
142 | attribute = Qt::WA_LockPortraitOrientation; | |
|
143 | break; | |
|
144 | case ScreenOrientationLockLandscape: | |
|
145 | attribute = Qt::WA_LockLandscapeOrientation; | |
|
146 | break; | |
|
147 | default: | |
|
148 | case ScreenOrientationAuto: | |
|
149 | attribute = Qt::WA_AutoOrientation; | |
|
150 | break; | |
|
151 | #endif // QT_VERSION < 0x040702 | |
|
152 | }; | |
|
153 | setAttribute(attribute, true); | |
|
154 | #else // QT_VERSION < 0x050000 | |
|
155 | Q_UNUSED(orientation) | |
|
156 | #endif // QT_VERSION < 0x050000 | |
|
157 | } | |
|
181 | 158 | |
|
182 | 159 | void QmlApplicationViewer::showExpanded() |
|
183 | 160 | { |
|
184 |
#if defined( |
|
|
185 |
|
|
|
186 | #elif defined(Q_WS_MAEMO_5) | |
|
187 |
|
|
|
161 | #if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR) | |
|
162 | showFullScreen(); | |
|
163 | #elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX) | |
|
164 | showMaximized(); | |
|
188 | 165 | #else |
|
189 |
|
|
|
166 | show(); | |
|
190 | 167 | #endif |
|
191 | 168 | } |
|
192 | 169 |
@@ -1,4 +1,4 | |||
|
1 |
// checksum 0x |
|
|
1 | // checksum 0xc67a version 0x80016 | |
|
2 | 2 | /* |
|
3 | 3 | This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
4 | 4 | QmlApplicationViewer is a convenience class containing mobile device specific |
@@ -11,7 +11,7 | |||
|
11 | 11 | #ifndef QMLAPPLICATIONVIEWER_H |
|
12 | 12 | #define QMLAPPLICATIONVIEWER_H |
|
13 | 13 | |
|
14 |
#include <Q |
|
|
14 | #include <QDeclarativeView> | |
|
15 | 15 | |
|
16 | 16 | class QmlApplicationViewer : public QDeclarativeView |
|
17 | 17 | { |
@@ -32,13 +32,12 public: | |||
|
32 | 32 | void setMainQmlFile(const QString &file); |
|
33 | 33 | void addImportPath(const QString &path); |
|
34 | 34 | |
|
35 |
// Note that this will only have an effect on |
|
|
36 |
|
|
|
35 | // Note that this will only have an effect on Fremantle. | |
|
36 | void setOrientation(ScreenOrientation orientation); | |
|
37 | 37 | |
|
38 | 38 | void showExpanded(); |
|
39 | 39 | |
|
40 | 40 | private: |
|
41 | explicit QmlApplicationViewer(QDeclarativeView *view, QWidget *parent); | |
|
42 | 41 | class QmlApplicationViewerPrivate *d; |
|
43 | 42 | }; |
|
44 | 43 |
General Comments 0
You need to be logged in to leave comments.
Login now