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