From b9bc59741d357b6210bbd6d15ad1ed68cedd91bb Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Fri, 23 Apr 2010 15:54:10 +0200 Subject: [PATCH 2/4] Move QML code to accomodate space for Symbian file handling. Part of several commits. Task-number: QTBUG-9972 --- tests/auto/declarative/examples/examples.pro | 2 +- tools/qml/Info_mac.plist | 16 - tools/qml/content/Browser.qml | 241 ----- tools/qml/content/images/folder.png | Bin 1841 -> 0 bytes tools/qml/content/images/titlebar.png | Bin 1436 -> 0 bytes tools/qml/content/images/titlebar.sci | 5 - tools/qml/content/images/up.png | Bin 662 -> 0 bytes tools/qml/deviceorientation.cpp | 75 -- tools/qml/deviceorientation.h | 74 -- tools/qml/deviceorientation_maemo.cpp | 136 --- tools/qml/main.cpp | 395 ------- tools/qml/proxysettings.cpp | 110 -- tools/qml/proxysettings.h | 71 -- tools/qml/proxysettings.ui | 115 -- tools/qml/qdeclarativefolderlistmodel.cpp | 420 -------- tools/qml/qdeclarativefolderlistmodel.h | 127 --- tools/qml/qdeclarativetester.cpp | 406 ------- tools/qml/qdeclarativetester.h | 286 ----- tools/qml/qml.pri | 29 - tools/qml/qml.pro | 40 +- tools/qml/qml/Info_mac.plist | 16 + tools/qml/qml/content/Browser.qml | 241 +++++ tools/qml/qml/content/images/folder.png | Bin 0 -> 1841 bytes tools/qml/qml/content/images/titlebar.png | Bin 0 -> 1436 bytes tools/qml/qml/content/images/titlebar.sci | 5 + tools/qml/qml/content/images/up.png | Bin 0 -> 662 bytes tools/qml/qml/deviceorientation.cpp | 75 ++ tools/qml/qml/deviceorientation.h | 74 ++ tools/qml/qml/deviceorientation_maemo.cpp | 136 +++ tools/qml/qml/main.cpp | 395 +++++++ tools/qml/qml/proxysettings.cpp | 110 ++ tools/qml/qml/proxysettings.h | 71 ++ tools/qml/qml/proxysettings.ui | 115 ++ tools/qml/qml/qdeclarativefolderlistmodel.cpp | 420 ++++++++ tools/qml/qml/qdeclarativefolderlistmodel.h | 127 +++ tools/qml/qml/qdeclarativetester.cpp | 406 +++++++ tools/qml/qml/qdeclarativetester.h | 286 +++++ tools/qml/qml/qml.pri | 29 + tools/qml/qml/qml.pro | 39 + tools/qml/qml/qmlruntime.cpp | 1413 +++++++++++++++++++++++++ tools/qml/qml/qmlruntime.h | 197 ++++ tools/qml/qml/qmlruntime.qrc | 9 + tools/qml/qml/recopts.ui | 513 +++++++++ tools/qml/qmlruntime.cpp | 1413 ------------------------- tools/qml/qmlruntime.h | 197 ---- tools/qml/qmlruntime.qrc | 9 - tools/qml/recopts.ui | 513 --------- 47 files changed, 4679 insertions(+), 4678 deletions(-) delete mode 100644 tools/qml/Info_mac.plist delete mode 100644 tools/qml/content/Browser.qml delete mode 100644 tools/qml/content/images/folder.png delete mode 100644 tools/qml/content/images/titlebar.png delete mode 100644 tools/qml/content/images/titlebar.sci delete mode 100644 tools/qml/content/images/up.png delete mode 100644 tools/qml/deviceorientation.cpp delete mode 100644 tools/qml/deviceorientation.h delete mode 100644 tools/qml/deviceorientation_maemo.cpp delete mode 100644 tools/qml/main.cpp delete mode 100644 tools/qml/proxysettings.cpp delete mode 100644 tools/qml/proxysettings.h delete mode 100644 tools/qml/proxysettings.ui delete mode 100644 tools/qml/qdeclarativefolderlistmodel.cpp delete mode 100644 tools/qml/qdeclarativefolderlistmodel.h delete mode 100644 tools/qml/qdeclarativetester.cpp delete mode 100644 tools/qml/qdeclarativetester.h delete mode 100644 tools/qml/qml.pri create mode 100644 tools/qml/qml/Info_mac.plist create mode 100644 tools/qml/qml/content/Browser.qml create mode 100644 tools/qml/qml/content/images/folder.png create mode 100644 tools/qml/qml/content/images/titlebar.png create mode 100644 tools/qml/qml/content/images/titlebar.sci create mode 100644 tools/qml/qml/content/images/up.png create mode 100644 tools/qml/qml/deviceorientation.cpp create mode 100644 tools/qml/qml/deviceorientation.h create mode 100644 tools/qml/qml/deviceorientation_maemo.cpp create mode 100644 tools/qml/qml/main.cpp create mode 100644 tools/qml/qml/proxysettings.cpp create mode 100644 tools/qml/qml/proxysettings.h create mode 100644 tools/qml/qml/proxysettings.ui create mode 100644 tools/qml/qml/qdeclarativefolderlistmodel.cpp create mode 100644 tools/qml/qml/qdeclarativefolderlistmodel.h create mode 100644 tools/qml/qml/qdeclarativetester.cpp create mode 100644 tools/qml/qml/qdeclarativetester.h create mode 100644 tools/qml/qml/qml.pri create mode 100644 tools/qml/qml/qml.pro create mode 100644 tools/qml/qml/qmlruntime.cpp create mode 100644 tools/qml/qml/qmlruntime.h create mode 100644 tools/qml/qml/qmlruntime.qrc create mode 100644 tools/qml/qml/recopts.ui delete mode 100644 tools/qml/qmlruntime.cpp delete mode 100644 tools/qml/qmlruntime.h delete mode 100644 tools/qml/qmlruntime.qrc delete mode 100644 tools/qml/recopts.ui diff --git a/tests/auto/declarative/examples/examples.pro b/tests/auto/declarative/examples/examples.pro index 4c32524..6e6734d 100644 --- a/tests/auto/declarative/examples/examples.pro +++ b/tests/auto/declarative/examples/examples.pro @@ -4,7 +4,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_examples.cpp -include(../../../../tools/qml/qml.pri) +include(../../../../tools/qml/qml/qml.pri) DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tools/qml/Info_mac.plist b/tools/qml/Info_mac.plist deleted file mode 100644 index ce4ebe3..0000000 --- a/tools/qml/Info_mac.plist +++ /dev/null @@ -1,16 +0,0 @@ - - - - - CFBundleIdentifier - com.nokia.qt.qml - CFBundlePackageType - APPL - CFBundleGetInfoString - Created by Qt/QMake - CFBundleSignature - @TYPEINFO@ - CFBundleExecutable - @EXECUTABLE@ - - diff --git a/tools/qml/content/Browser.qml b/tools/qml/content/Browser.qml deleted file mode 100644 index 8882d5a..0000000 --- a/tools/qml/content/Browser.qml +++ /dev/null @@ -1,241 +0,0 @@ -import Qt 4.6 - -Rectangle { - id: root - property bool keyPressed: false - property variant folders: folders1 - property variant view: view1 - width: 320 - height: 480 - color: palette.window - - FolderListModel { - id: folders1 - nameFilters: [ "*.qml" ] - folder: qmlViewerFolder - } - FolderListModel { - id: folders2 - nameFilters: [ "*.qml" ] - folder: qmlViewerFolder - } - - SystemPalette { id: palette } - - function down(path) { - if (folders == folders1) { - view = view2 - folders = folders2; - view1.state = "exitLeft"; - } else { - view = view1 - folders = folders1; - view2.state = "exitLeft"; - } - view.x = root.width; - view.state = "current"; - view.focus = true; - folders.folder = path; - } - function up() { - var path = folders.parentFolder; - if (folders == folders1) { - view = view2 - folders = folders2; - view1.state = "exitRight"; - } else { - view = view1 - folders = folders1; - view2.state = "exitRight"; - } - view.x = -root.width; - view.state = "current"; - view.focus = true; - folders.folder = path; - } - - Component { - id: folderDelegate - Rectangle { - id: wrapper - function launch() { - if (folders.isFolder(index)) { - down(filePath); - } else { - qmlViewer.launch(filePath); - } - } - width: root.width - height: 52 - color: "transparent" - Rectangle { - id: highlight; visible: false - anchors.fill: parent - gradient: Gradient { - GradientStop { id: t1; position: 0.0; color: palette.highlight } - GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) } - } - } - Item { - width: 48; height: 48 - Image { source: "images/folder.png"; anchors.centerIn: parent; visible: folders.isFolder(index)} - } - Text { - id: nameText - anchors.fill: parent; verticalAlignment: Text.AlignVCenter - text: fileName - anchors.leftMargin: 54 - font.pixelSize: 32 - color: (wrapper.ListView.isCurrentItem && root.keyPressed) ? palette.highlightedText : palette.windowText - } - MouseArea { - id: mouseRegion - anchors.fill: parent - onClicked: { launch() } - } - states: [ - State { - name: "pressed" - when: mouseRegion.pressed - PropertyChanges { target: highlight; visible: true } - PropertyChanges { target: nameText; color: palette.highlightedText } - } - ] - } - } - - ListView { - id: view1 - anchors.top: titleBar.bottom - anchors.bottom: parent.bottom - x: 0 - width: parent.width - model: folders1 - delegate: folderDelegate - highlight: Rectangle { color: palette.highlight; visible: root.keyPressed && view1.count != 0 } - highlightMoveSpeed: 1000 - pressDelay: 100 - focus: true - state: "current" - states: [ - State { - name: "current" - PropertyChanges { target: view1; x: 0 } - }, - State { - name: "exitLeft" - PropertyChanges { target: view1; x: -root.width } - }, - State { - name: "exitRight" - PropertyChanges { target: view1; x: root.width } - } - ] - transitions: [ - Transition { - to: "current" - SequentialAnimation { - NumberAnimation { properties: "x"; duration: 250 } - } - }, - Transition { - NumberAnimation { properties: "x"; duration: 250 } - NumberAnimation { properties: "x"; duration: 250 } - } - ] - Keys.onPressed: { root.keyPressed = true; } - } - - ListView { - id: view2 - anchors.top: titleBar.bottom - anchors.bottom: parent.bottom - x: parent.width - width: parent.width - model: folders2 - delegate: folderDelegate - highlight: Rectangle { color: palette.highlight; visible: root.keyPressed && view2.count != 0 } - highlightMoveSpeed: 1000 - pressDelay: 100 - states: [ - State { - name: "current" - PropertyChanges { target: view2; x: 0 } - }, - State { - name: "exitLeft" - PropertyChanges { target: view2; x: -root.width } - }, - State { - name: "exitRight" - PropertyChanges { target: view2; x: root.width } - } - ] - transitions: [ - Transition { - to: "current" - SequentialAnimation { - NumberAnimation { properties: "x"; duration: 250 } - } - }, - Transition { - NumberAnimation { properties: "x"; duration: 250 } - } - ] - Keys.onPressed: { root.keyPressed = true; } - } - - Keys.onPressed: { - root.keyPressed = true; - if (event.key == Qt.Key_Return || event.key == Qt.Key_Select || event.key == Qt.Key_Right) { - view.currentItem.launch(); - event.accepted = true; - } else if (event.key == Qt.Key_Left) { - up(); - } - } - - BorderImage { - source: "images/titlebar.sci"; - width: parent.width; - height: 52 - y: -7 - id: titleBar - - Rectangle { - id: upButton - width: 48 - height: titleBar.height - 7 - color: "transparent" - - Image { anchors.centerIn: parent; source: "images/up.png" } - MouseArea { id: upRegion; anchors.centerIn: parent - width: 56 - height: 56 - onClicked: if (folders.parentFolder != "") up() - } - states: [ - State { - name: "pressed" - when: upRegion.pressed - PropertyChanges { target: upButton; color: palette.highlight } - } - ] - } - Rectangle { - color: "gray" - x: 48 - width: 1 - height: 44 - } - - Text { - anchors.left: upButton.right; anchors.right: parent.right; height: parent.height - anchors.leftMargin: 4; anchors.rightMargin: 4 - text: folders.folder - color: "white" - elide: Text.ElideLeft; horizontalAlignment: Text.AlignRight; verticalAlignment: Text.AlignVCenter - font.pixelSize: 32 - } - } -} diff --git a/tools/qml/content/images/folder.png b/tools/qml/content/images/folder.png deleted file mode 100644 index e53e2ad464eb993256a6c3567fc940498e26fc8b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1841 zcmV-12hRA3P)9|L49p`#xU4GZ@fvQeveOhMvleo>008ifO8IGNhL6l< z{aUZrfA(%cEtd36rDb`~5h&i@?>h4N=Z>SC^MS7v0Pr3AhPvW{!YtC8Kp67{Yezaio**gBp{PBs5AnA1STdDNvaJP%raE3$dUQ|HILYASttAYhF-m+ z1X3^@i%$v6MXS}KsHp7LSdt_-oeqrph9OBFgo7@S-~zFD(&qs{5P`b-Jf+v;->=iD z|3%Z=kcgH7c&w;6`{x#mRh652Kgvq0(9qC`^78U|1I{KAiNHDFfZKBeLCJ$~#D!?$ z1{k|@LBoR*j{ND=2mw$P6l5RTw5iFSo0q0EnKh!>tc4^+;JP`6D_2~&bZG#qn_AG; z_Bhhh(-$NI0MTd^gM&_txSR+C+>pXI5s3~06b1mixaYW+Y&Oeldw%`YHdA_tO*hV5 z5^)iizi{LI6Bkfjy$U;b{uFApdch*o#9}cx9DO*~{TFcN!H%aph8bf*tHC_~%K?B1 zF%%XV@#AM2q1Cz3`p_D@@=816@%d|=3{ezeu`EF>sz7jD1ULs9^N)3Y+I@LJ0f-VP zt4znv-Rm$k@+q2|>(SZSnUaJc2p|#=i^ajg!CW`}`~LdoC!UmohzUHn%8DJk*Q2ZJ zD89L-5e|nVbpZ}A&Ux>3hs!fICZ)6z08pwpS~lA7#FO=S;>oQza^!GI0ssdCfKWKP z|NRp^;gk)gNXw96=WaXx+5Ils+8#qF6q@&5A_72&#S-8g!~h@|2p@X)*!i*lRsaBq zMX{l^01Zt`v96^Ny}iBj-pfcpJU-d<3;;Oi{>VhE`|=k<_u_y=A_i+V!?VBmHlBZB z7uwrjPA*Gqst2Y@003^6fA8CGrPhq|A;^OG!H=5J*LMzk_wGq%fcRtyW&}9rU6(En z2EFbG5{WxcNvSds^`rG$r5GOW#leFIZkwAa!K@4bKp+t6xbo#qIIo4^aZMmP&tGk! zL?!}wcuNh=fA#@7JO4H#z@`Q0c7gHn(2Kv_cl5Kvhd<Kj7jHJ9 zuov4NZN#y6-oU9-T>vJx;-m<>{XD=q_XDURqKq?VF8;2tFlV!UL#>dPYk^G8pf`%p z>O>HwCJ~TsVEf}O*tKH^y1G7rD9WY;h|N6@OpCYxY#}1*>ACuh&6f4cRSl)u2Oe0C zQI80nUWDEtLJ${j5)2KXq%<4d-QBk`K*T`Fj^)W9qLmq$hJ)2r1^2IOsUfXK4UJBO z-Y7z$U|$^ofb+T^AALBCt=k^K$*#9?sN)@1(hMYnbAA@Uaw0OFJlV6qxH$K_>+Q9| z((J`hC>ab!8PrExm=j+6TJw= zl9%VqX$OV|WiXm!c;mJA-1j6fOQb3z)6h{@TUfewT{UUcD(LhgbVeCuvfD)>;W+-# zei}ukIr!u2C%ztmSt5F+Qub0=`F)St*Vl?xYbMm1$*d?Pll()iNj)lMSoUiEv&Y$M4(!4!6tiUT_np3g`R)fCEHSws^6rqpq&7 za?P4*QmYlvXq7OTwD5Yy>3^1ixe$?7rIzojD9_(+x7Uiku^|3@_+vjf=l}PMh`wjD fEpp4{;>3Rd&!+YNzwAbe00000NkvXXu0mjfMH*<- diff --git a/tools/qml/content/images/titlebar.png b/tools/qml/content/images/titlebar.png deleted file mode 100644 index 51c90082d052a94af34488ca9a13842122f7d7a4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1436 zcmV;N1!MY&P)00001b5ch_0Itp) z=>Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXW1 z0xv7!9LBW(000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2HM@dakSAh-}000E{NklLiq!w7*fp`1oo9~;MC5Hkm0Ga8f)%S;LHn|^l4>W+QI@MK<0LU%? zTCN^g=1tdNq`Dpph=PESv9&Y_yal)K%ETFKXCtR`vY67D3wB9@+&cbGgIArTN6+wSAX zkGy^RmUr*o{T4#Fkk#tskC!ih`Tfb0Cxj5Vy1F8SK-YDE!#OZB%*L~eNSa)23&d?U zSw1i0>gRr9IT1mtHP62Lmb0@nE-o&3^XAQ;^5Vq{d;a`6A3l8G`uZB@98Hs4A;w4} zZZ8P$T;_Us-Wa3LiY3JoBbsA{322^IDj+WNr!^z_J?9)<*YWV-LmoYP#Ov3u@#p8~ zTwPspd3nidwF01RTNaB2BC@r4CKHDcwm?9#oSA`>USgwAW7e}#gkM0Yvk41^nr1^7 z&N;5HuQ@q6;px+-_|@_O@8ADLBaYYwR2A=iy0?Jz0cyTE=eGiSB!O3eXvr9oHkkl) zJria&VhTXjdXO$lOS6-T2wfXkEEZf|Uh??yV|9$6 z$kf}E2}3pUBO*h1vm}>TF;RnPvP?}ajZsZ(s`c^F`G#o9X1&4r25)A>7;$dUeu#sd zH0nr`HO-^wWQOLC8t2no3_(Fez${xkBmh=yunfEn^?XuQ?3Ij+Zzn(@H!pav#Pqq_?!|nMq-S~Ct{2l-QZ~b zHR{$P`zF6tD!u{4zWIxhQbJa`7!wn!ntVca%bFsRXx#Sb;tV@Ca^rcTGS~=!F~4Rd zD^=}7d=H{l@KpDMcDE-MbeynXOK|hy7X0?B$O;vFv(d|Qf^dRaKe_z@t5t}6@ZhHA%GI8viucfZ4DLUOJ z%g-f2H+QV4licii=|7xc|4$k9K5-Z1_4nOT1!U>l1aAsHPx#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXS@ z05=qo0T_V*00I_CL_t(I%e|D(YZE~f$3JgoH`$m3@}o^mwTd1D5%pxX218XWdhp;M zphw$_)RW%4D|qkCKfwP$5EMK}QN)v=2r5-cHEDiqlbY=8dgyK&(l+YF2ag$;na}&a znfC_%qgkPkH2sJ5QY@}-Yg;ZEFX#X(fcaM?6REVlc=77N&h=Z9y~D@!Q=kIG{#KD_ zEd?iG-8nbA|7LkM?d-`_bvn~K;I=us*5re4_&%&`8%S#@WOB~KsY-Ef`a)9sdKu%p zWb&x&7?W<36YU1?e8V@u-wjkurtG_?%7wYgO7?ZTI&zzW?CftG*>O<*2)0;~i6V8sT22XsZi zk^oBus4yj^Ktg5VUKdyc`am#T`ax75I*cAclmex}R)P>jK~3~(JNA$eAihC-5CH`U z8*?qet_?YCeyi2~`Qmwd%yl;oiwc1P{XQ5&ElO!C_;z!E8^H0fuk;S-F9DB%c61do w;_HY3aljr{4D`a++EgVYx?e`D2SX#j0sXq9GS=auNdN!<07*qoM6N<$g8bnhMgRZ+ diff --git a/tools/qml/deviceorientation.cpp b/tools/qml/deviceorientation.cpp deleted file mode 100644 index e7c70d5..0000000 --- a/tools/qml/deviceorientation.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "deviceorientation.h" - -QT_USE_NAMESPACE - -class DefaultDeviceOrientation : public DeviceOrientation -{ - Q_OBJECT -public: - DefaultDeviceOrientation() : DeviceOrientation(), m_orientation(DeviceOrientation::Portrait) {} - - Orientation orientation() const { - return m_orientation; - } - - void setOrientation(Orientation o) { - if (o != m_orientation) { - m_orientation = o; - emit orientationChanged(); - } - } - - Orientation m_orientation; -}; - -DeviceOrientation* DeviceOrientation::instance() -{ - static DefaultDeviceOrientation *o = 0; - if (!o) - o = new DefaultDeviceOrientation; - return o; -} - -#include "deviceorientation.moc" - diff --git a/tools/qml/deviceorientation.h b/tools/qml/deviceorientation.h deleted file mode 100644 index d209005..0000000 --- a/tools/qml/deviceorientation.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef ORIENTATION_H -#define ORIENTATION_H - -#include - -QT_BEGIN_NAMESPACE - -class DeviceOrientationPrivate; -class DeviceOrientation : public QObject -{ - Q_OBJECT - Q_ENUMS(Orientation) -public: - enum Orientation { UnknownOrientation, Portrait, Landscape }; - virtual Orientation orientation() const = 0; - virtual void setOrientation(Orientation) = 0; - - static DeviceOrientation *instance(); - -signals: - void orientationChanged(); - -protected: - DeviceOrientation() {} - -private: - DeviceOrientationPrivate *d_ptr; - friend class DeviceOrientationPrivate; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qml/deviceorientation_maemo.cpp b/tools/qml/deviceorientation_maemo.cpp deleted file mode 100644 index 9f12f3d..0000000 --- a/tools/qml/deviceorientation_maemo.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "deviceorientation.h" -#include -#include - -class MaemoOrientation : public DeviceOrientation -{ - Q_OBJECT -public: - MaemoOrientation() - : DeviceOrientation(),m_current(Portrait), m_lastSeen(Portrait), m_lastSeenCount(0) - { - m_current = get(); - if (m_current == UnknownOrientation) - m_current = Portrait; - - startTimer(100); - } - - Orientation orientation() const { - return m_current; - } - - void setOrientation(Orientation) { } - -protected: - virtual void timerEvent(QTimerEvent *) - { - Orientation c = get(); - - if (c == m_lastSeen) { - m_lastSeenCount++; - } else { - m_lastSeenCount = 0; - m_lastSeen = c; - } - - if (m_lastSeen != UnknownOrientation && m_lastSeen != m_current && m_lastSeenCount > 4) { - m_current = m_lastSeen; - emit orientationChanged(); - printf("%d\n", m_current); - } - } - -signals: - void changed(); - -private: - Orientation m_current; - Orientation m_lastSeen; - int m_lastSeenCount; - - Orientation get() - { - Orientation o = UnknownOrientation; - - int ax, ay, az; - - read(&ax, &ay, &az); - - if (abs(az) > 850) { - o = UnknownOrientation; - } else if (ax < -750) { - o = Portrait; - } else if (ay < -750) { - o = Landscape; - } - - return o; - } - - int read(int *ax,int *ay,int *az) - { - static const char *accel_filename = "/sys/class/i2c-adapter/i2c-3/3-001d/coord"; - - FILE *fd; - int rs; - fd = fopen(accel_filename, "r"); - if(fd==NULL){ printf("liqaccel, cannot open for reading\n"); return -1;} - rs=fscanf((FILE*) fd,"%i %i %i",ax,ay,az); - fclose(fd); - if(rs != 3){ printf("liqaccel, cannot read information\n"); return -2;} - return 0; - } -}; - - -DeviceOrientation* DeviceOrientation::instance() -{ - static MaemoOrientation *o = 0; - if (!o) - o = new MaemoOrientation; - return o; -} - -#include "deviceorientation_maemo.moc" diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp deleted file mode 100644 index 45c2b85..0000000 --- a/tools/qml/main.cpp +++ /dev/null @@ -1,395 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdeclarative.h" -#include "qmlruntime.h" -#include "qdeclarativeengine.h" -#include -#include -#include -#include -#include -#include "qdeclarativetester.h" -#include "qdeclarativefolderlistmodel.h" - -QT_USE_NAMESPACE - -#if defined (Q_OS_SYMBIAN) -#include -#include -#include -#include - -void myMessageOutput(QtMsgType type, const char *msg) -{ - static int fd = -1; - if (fd == -1) - fd = ::open("E:\\qml.log", O_WRONLY | O_CREAT); - - ::write(fd, msg, strlen(msg)); - ::write(fd, "\n", 1); - ::fsync(fd); - - switch (type) { - case QtFatalMsg: - abort(); - } -} -#endif - -void usage() -{ - qWarning("Usage: qml [options] "); - qWarning(" "); - qWarning(" options:"); - qWarning(" -v, -version ............................. display version"); - qWarning(" -frameless ............................... run with no window frame"); - qWarning(" -maximized................................ run maximized"); - qWarning(" -fullscreen............................... run fullscreen"); - qWarning(" -stayontop................................ keep viewer window on top"); - qWarning(" -skin ...................... run with a skin window frame"); - qWarning(" \"list\" for a list of built-ins"); - qWarning(" -resizeview .............................. resize the view, not the skin"); - qWarning(" -qmlbrowser .............................. use a QML-based file browser"); - qWarning(" -recordfile ..................... set video recording file"); - qWarning(" - ImageMagick 'convert' for GIF)"); - qWarning(" - png file for raw frames"); - qWarning(" - 'ffmpeg' for other formats"); - qWarning(" -recorddither ordered|threshold|floyd .... set GIF dither recording mode"); - qWarning(" -recordrate ........................ set recording frame rate"); - qWarning(" -record arg .............................. add a recording process argument"); - qWarning(" -autorecord [from-] ...... set recording to start and stop"); - qWarning(" -devicekeys .............................. use numeric keys (see F1)"); - qWarning(" -dragthreshold .................... set mouse drag threshold size"); - qWarning(" -netcache ......................... set disk cache to size bytes"); - qWarning(" -translation ........... set the language to run in"); - qWarning(" -I ........................... prepend to the module import search path,"); - qWarning(" display path if is empty"); - qWarning(" -P ........................... prepend to the plugin search path"); - qWarning(" -opengl .................................. use a QGLWidget for the viewport"); - qWarning(" -script ........................... set the script to use"); - qWarning(" -scriptopts |help ............... set the script options to use"); - - qWarning(" "); - qWarning(" Press F1 for interactive help"); - exit(1); -} - -void scriptOptsUsage() -{ - qWarning("Usage: qml -scriptopts