diff options
125 files changed, 5166 insertions, 1479 deletions
diff --git a/LGPL_EXCEPTION.TXT b/LGPL_EXCEPTION.TXT new file mode 100644 index 0000000..a54c00e --- /dev/null +++ b/LGPL_EXCEPTION.TXT @@ -0,0 +1,22 @@ +Nokia Qt LGPL Exception version 1.1 + +As an additional permission to the GNU Lesser General Public License version +2.1, the object code form of a "work that uses the Library" may incorporate +material from a header file that is part of the Library. You may distribute +such object code under terms of your choice, provided that: + (i) the header files of the Library have not been modified; and + (ii) the incorporated material is limited to numerical parameters, data + structure layouts, accessors, macros, inline functions and + templates; and + (iii) you comply with the terms of Section 6 of the GNU Lesser General + Public License version 2.1. + +Moreover, you may apply this exception to a modified version of the Library, +provided that such modification does not involve copying material from the +Library into the modified Library's header files unless such material is +limited to (i) numerical parameters; (ii) data structure layouts; +(iii) accessors; and (iv) small macros, templates and inline functions of +five lines or less in length. + +Furthermore, you are not required to apply this additional permission to a +modified version of the Library. diff --git a/LICENSE.LGPL b/LICENSE.LGPL new file mode 100644 index 0000000..602bfc9 --- /dev/null +++ b/LICENSE.LGPL @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/models/maemoFremantle/maemoFremantle.config b/models/maemoFremantle/maemoFremantle.config index f2457ac..a13ce35 100644 --- a/models/maemoFremantle/maemoFremantle.config +++ b/models/maemoFremantle/maemoFremantle.config @@ -9,8 +9,10 @@ defaultFontSize:18 forceDpi:96 menuImage:leftUp,fremantle_leftup.png availableGeometry:leftUp,0,56,480,744 +portraitOrientation:leftUp menuImage:topUp,fremantle_topup.png availableGeometry:topUp,0,57,800,423 +landscapeOrientation:topUp maemoNavigationButtonLandscape:691,0 maemoNavigationButtonPortrait:371,0 maemoNavigationButtonClose:fremantle_close.png diff --git a/models/symbian3/N8_3D_back.png b/models/symbian3/N8_3D_back.png Binary files differdeleted file mode 100644 index 5238a10..0000000 --- a/models/symbian3/N8_3D_back.png +++ /dev/null diff --git a/models/symbian3/N8_3D_bottom.png b/models/symbian3/N8_3D_bottom.png Binary files differdeleted file mode 100644 index 19d8fba..0000000 --- a/models/symbian3/N8_3D_bottom.png +++ /dev/null diff --git a/models/symbian3/N8_3D_front.png b/models/symbian3/N8_3D_front.png Binary files differdeleted file mode 100644 index 113d99c..0000000 --- a/models/symbian3/N8_3D_front.png +++ /dev/null diff --git a/models/symbian3/N8_3D_right.png b/models/symbian3/N8_3D_right.png Binary files differdeleted file mode 100644 index c3b8121..0000000 --- a/models/symbian3/N8_3D_right.png +++ /dev/null diff --git a/models/symbian3/N8_3D_top.png b/models/symbian3/N8_3D_top.png Binary files differdeleted file mode 100644 index 6d5d30a..0000000 --- a/models/symbian3/N8_3D_top.png +++ /dev/null diff --git a/models/symbian3/symbian3.config b/models/symbian3/symbian3.config index d4f9dd7..b0cc5bc 100644 --- a/models/symbian3/symbian3.config +++ b/models/symbian3/symbian3.config @@ -9,8 +9,10 @@ defaultFontSize:7 style:s60,nseriesblack menuImage:topUp,N8_portrait.png availableGeometry:topUp,0,92,360,487 +portraitOrientation:topUp menuImage:rightUp,N8_landscape.png availableGeometry:rightUp,0,45,640,270 +landscapeOrientation:rightUp symbianSoftKeyButton:topUp,0,0,580,180,60 symbianSoftKeyButton:topUp,1,180,580,180,60 symbianSoftKeyButton:rightUp,0,0,316,212,44 diff --git a/models/symbianNonTouch/symbianNonTouch.config b/models/symbianNonTouch/symbianNonTouch.config index f50bdeb..faa3abb 100644 --- a/models/symbianNonTouch/symbianNonTouch.config +++ b/models/symbianNonTouch/symbianNonTouch.config @@ -36,6 +36,8 @@ menuImage:rightUp,n95rightup.png menuImage:topUp,n95topup.png availableGeometry:rightUp,0,21,320,198 availableGeometry:topUp,0,58,240,235 +portraitOrientation:topUp +landscapeOrientation:rightUp symbianSoftKeyButton:topUp,0,0,293,120,27 symbianSoftKeyButton:topUp,1,120,293,120,27 symbianSoftKeyButton:rightUp,1,220,0,100,21 diff --git a/models/symbianTouch/symbianTouch.config b/models/symbianTouch/symbianTouch.config index aa51559..e9b3a56 100644 --- a/models/symbianTouch/symbianTouch.config +++ b/models/symbianTouch/symbianTouch.config @@ -12,8 +12,10 @@ button:Key_Call,,165,864,42,66 button:Key_Hangup,,255,858,43,78 menuImage:topUp,menu_topup.png availableGeometry:topUp,0,92,360,487 +portraitOrientation:topUp menuImage:rightUp,menu_rightup.png availableGeometry:rightUp,0,73,502,288 +landscapeOrientation:rightUp symbianSoftKeyButton:topUp,0,0,579,180,61 symbianSoftKeyButton:topUp,1,180,579,180,61 symbianSoftKeyButton:rightUp,1,503,0,137,72 diff --git a/scripts/gestures/touch.qs b/scripts/gestures/touch.qs new file mode 100644 index 0000000..bcdb252 --- /dev/null +++ b/scripts/gestures/touch.qs @@ -0,0 +1,12 @@ +var initial1 = input.mouseX() - 100; +var initial2 = input.mouseX() + 100; + +touch.beginTouch(0, initial1, 100); +touch.beginTouch(1, initial2, 100); +for (var i = 1; i < 50; i++) { + touch.updateTouch(0, initial1 + i, 100); + touch.updateTouch(1, initial2 - i, 100); + yield(100); +} +touch.endTouch(0, initial1 + 50, 100); +touch.endTouch(1, initial2 - 50, 100); diff --git a/src/main.cpp b/src/main.cpp index ff60ac3..261a4c4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ @@ -33,6 +37,14 @@ #include "qsimulatordata_p.h" #include "messaging.h" +#ifdef Q_OS_UNIX + extern "C" { + #include <sys/types.h> + #include <sys/ipc.h> + #include <sys/shm.h> + } +#endif + #include <QtCore/QDebug> #include <QtCore/QDir> #include <QtCore/QSettings> @@ -73,7 +85,7 @@ static void registerSimulator(const QString &location) settings->beginGroup(SIMULATOR_APP_QT_VERSIONS_KEY); QList<QString> supportedQtVersion; - supportedQtVersion << "4.7.1.0" << "4.7.2.0" << "4.7.3.0"; + supportedQtVersion << "4.7.4.0"; foreach(const QString &version, supportedQtVersion) { QList<QString> simulators; QVariant value = settings->value(version); @@ -95,8 +107,47 @@ static void registerSimulator(const QString &location) settings->setValue(dataKey, appDataLocation); } +void cleanupUnusedSharedMemory() +{ +#ifdef Q_OS_UNIX + // This code depends on the implementation of QSharedMemory + QDir tmp(QDir::tempPath()); + QStringList possibleFiles = tmp.entryList(QStringList("qipc_sharedmemory_QTSIMULATORSHAREDMEMORY*"), QDir::Files); + + foreach (QString fileName, possibleFiles) { + int unix_key = ::ftok(QFile::encodeName(tmp.absoluteFilePath(fileName)).constData(), 'Q'); + + // Get the number of current attachments + int id = ::shmget(unix_key, 0, 0444); + + struct shmid_ds shmid_ds; + if (0 != ::shmctl(id, IPC_STAT, &shmid_ds)) { + qWarning("getting the number of current attachments failed"); + continue; + } + + // If there are no attachments then remove it. + if (shmid_ds.shm_nattch == 0) { + // mark for removal + if (-1 == ::shmctl(id, IPC_RMID, &shmid_ds)) { + qWarning("mark shared memory segment for removal failed"); + continue; + } + + // remove file + if (!tmp.remove(fileName)) { + qWarning("could not remove shared memory segment 'file'"); + continue; + } + qDebug() << "superfluous shared memory segment removed"; + } + } +#endif +} int main(int argc, char **argv) { + cleanupUnusedSharedMemory(); + QCoreApplication::setOrganizationName(SIMULATOR_APP_VENDOR); QCoreApplication::setApplicationName(SIMULATOR_APP_NAME); @@ -180,7 +231,7 @@ int main(int argc, char **argv) } if (!isFirstInstance) { - // activate running instance? + app.sendMessage(QString("activate")); return 0; } @@ -188,6 +239,7 @@ int main(int argc, char **argv) app.initialize(); MainWindow main; + app.setActivationWindow(&main); QObject::connect(&app, SIGNAL(messageReceived(QString)), &main, SLOT(handleMessage(QString))); main.show(); return app.exec(); diff --git a/src/mobility/contacts.cpp b/src/mobility/contacts.cpp index b75a3e9..fbe05eb 100644 --- a/src/mobility/contacts.cpp +++ b/src/mobility/contacts.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/mobility/contacts.h b/src/mobility/contacts.h index ffa6671..a851e1c 100644 --- a/src/mobility/contacts.h +++ b/src/mobility/contacts.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/mobility/feedback.cpp b/src/mobility/feedback.cpp index 108f3d7..d6288e6 100644 --- a/src/mobility/feedback.cpp +++ b/src/mobility/feedback.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/mobility/feedback.h b/src/mobility/feedback.h index b520f56..9732b9a 100644 --- a/src/mobility/feedback.h +++ b/src/mobility/feedback.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/mobility/messaging.cpp b/src/mobility/messaging.cpp index 8b7ebeb..722160e 100644 --- a/src/mobility/messaging.cpp +++ b/src/mobility/messaging.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/mobility/messaging.h b/src/mobility/messaging.h index ad55c9c..a60637c 100644 --- a/src/mobility/messaging.h +++ b/src/mobility/messaging.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/mobility/mobilitydata.cpp b/src/mobility/mobilitydata.cpp index 9b2c82a..287b4e7 100644 --- a/src/mobility/mobilitydata.cpp +++ b/src/mobility/mobilitydata.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ @@ -51,6 +55,7 @@ MobilityData::MobilityData(QObject *parent) , mMessaging(new Messaging(this)) , mSensorsUi(0) , mCameraUi(0) + , mNfcUi(0) , mInitialized(false) { } @@ -73,18 +78,19 @@ void MobilityData::setInitialSensorsData() { SensorsUi::SensorsData sensors; sensors.ambientLightLevel = SensorsScriptInterface::Light; + sensors.lux = 100.0; sensors.accelerometerX = 0; sensors.accelerometerY = 9.8; sensors.accelerometerZ = 0; - sensors.magnetometerX = 0.5; - sensors.magnetometerY = 0.5; - sensors.magnetometerZ = 0.5; + sensors.magnetometerX = 0; + sensors.magnetometerY = 0; + sensors.magnetometerZ = 30; sensors.magnetometerCalibrationLevel = 0.85; sensors.compassCalibrationLevel = 0.85; - sensors.compassAzimuth = 132.65; + sensors.compassAzimuth = 0; sensors.proximitySensorClose = true; diff --git a/src/mobility/mobilitydata.h b/src/mobility/mobilitydata.h index 6e67a6b..b4c280c 100644 --- a/src/mobility/mobilitydata.h +++ b/src/mobility/mobilitydata.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ @@ -45,6 +49,7 @@ #include "sensorsui.h" #include "cameraui.h" #include "deviceitem.h" +#include "nfcui.h" #include <remotecontrolwidget/locationui.h> @@ -65,6 +70,7 @@ public: Messaging *mMessaging; SensorsUi *mSensorsUi; CameraUi *mCameraUi; + NfcUi *mNfcUi; void setInitialData(); diff --git a/src/mobility/mobilitymanager.cpp b/src/mobility/mobilitymanager.cpp index f1f14b2..888ea64 100644 --- a/src/mobility/mobilitymanager.cpp +++ b/src/mobility/mobilitymanager.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ @@ -336,6 +340,12 @@ void MobilityClient::sendSensorsData(const SensorsUi::SensorsData &data) QtSimulatorPrivate::RemoteMetacall<void>::call(mSendSocket, QtSimulatorPrivate::NoSync, "setAmbientLightData", ambientData); + QLightReadingData lightData; + lightData.lux = data.lux; + lightData.timestamp = timestampToSend; + QtSimulatorPrivate::RemoteMetacall<void>::call(mSendSocket, QtSimulatorPrivate::NoSync, + "setLightData", lightData); + QAccelerometerReadingData accelermometerData; accelermometerData.x = data.accelerometerX; accelermometerData.y = data.accelerometerY; @@ -345,9 +355,9 @@ void MobilityClient::sendSensorsData(const SensorsUi::SensorsData &data) "setAccelerometerData", accelermometerData); QMagnetometerReadingData magnetometerData; - magnetometerData.x = data.magnetometerX; - magnetometerData.y = data.magnetometerY; - magnetometerData.z = data.magnetometerZ; + magnetometerData.x = data.magnetometerX * 1e-6; // scale to Teslas + magnetometerData.y = data.magnetometerY * 1e-6; + magnetometerData.z = data.magnetometerZ * 1e-6; magnetometerData.calibrationLevel = data.magnetometerCalibrationLevel; magnetometerData.timestamp = timestampToSend; QtSimulatorPrivate::RemoteMetacall<void>::call(mSendSocket, QtSimulatorPrivate::NoSync, @@ -496,6 +506,14 @@ void MobilityClient::setRequestsSensors() "initialSensorsDataSent"); } +void MobilityClient::setRequestsNfc() +{ + connect(mMobilityServer->mMobility->mNfcUi, SIGNAL(targetEnteringProximity(QByteArray)), + SLOT(sendNfcTargetEnteringProximity(QByteArray))); + connect(mMobilityServer->mMobility->mNfcUi, SIGNAL(targetLeavingProximity(QByteArray)), + SLOT(sendNfcTargetLeavingProximity(QByteArray))); +} + void MobilityClient::setRequestsOrganizer() { QOrganizerManager *manager = mMobilityServer->mMobility->mOrganizer->manager(); @@ -552,7 +570,7 @@ void MobilityClient::setRequestsDocGallery() connect(mMobilityServer->mMobility->mDocGalleryUi, SIGNAL(docGalleryDataChanged(QtMobility::DocGallerySimulatorData)), this, SLOT(sendDocGallery(QtMobility::DocGallerySimulatorData))); - sendDocGallery(mMobilityServer->mMobility->mDocGalleryUi->data); + sendDocGallery(mMobilityServer->mMobility->mDocGalleryUi->data()); QtSimulatorPrivate::RemoteMetacall<void>::call(mSendSocket, QtSimulatorPrivate::NoSync, "initialDocGalleryDataSent"); } @@ -649,6 +667,11 @@ Simulator::SaveRelationshipReply MobilityClient::requestSaveRelationship(const Q return reply; } +QByteArray MobilityClient::nfcSendCommand(const QByteArray &command) +{ + return mMobilityServer->mMobility->mNfcUi->processCommand(command); +} + int MobilityClient::requestRemoveRelationship(const QContactRelationship &relationship) { // execute change and notify other clients in the process @@ -974,3 +997,15 @@ void MobilityClient::sendEffectStateChange(int effectId, QtMobility::QFeedbackEf QtSimulatorPrivate::RemoteMetacall<void>::call(mSendSocket, QtSimulatorPrivate::NoSync, "setFeedbackEffectState", effectId, static_cast<int>(state)); } + +void MobilityClient::sendNfcTargetEnteringProximity(const QByteArray &uid) +{ + QtSimulatorPrivate::RemoteMetacall<void>::call(mSendSocket, QtSimulatorPrivate::NoSync, + "targetEnteringProximity", uid); +} + +void MobilityClient::sendNfcTargetLeavingProximity(const QByteArray &uid) +{ + QtSimulatorPrivate::RemoteMetacall<void>::call(mSendSocket, QtSimulatorPrivate::NoSync, + "targetLeavingProximity", uid); +} diff --git a/src/mobility/mobilitymanager.h b/src/mobility/mobilitymanager.h index 54be88c..d5ab70f 100644 --- a/src/mobility/mobilitymanager.h +++ b/src/mobility/mobilitymanager.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ @@ -117,6 +121,9 @@ public slots: void sendCameraRemoved(const QString &name); void sendCameraChanged(const QString &name, const CameraUi::CameraData::CameraDetails &newDetails); + void sendNfcTargetEnteringProximity(const QByteArray &uid); + void sendNfcTargetLeavingProximity(const QByteArray &uid); + private slots: void disconnect(); void readyRead(); @@ -142,6 +149,7 @@ private slots: void setRequestsLocationInfo(); void setRequestsContactInfo(); void setRequestsSensors(); + void setRequestsNfc(); void setRequestsOrganizer(); void setRequestsFeedback(); void setRequestsDocGallery(); @@ -171,6 +179,8 @@ private slots: void setFeedbackEffectDuration(int effectId, int duration); void setFeedbackActuatorEnabled(int actuatorId, bool enabled); + QByteArray nfcSendCommand(const QByteArray &command); + private: void syncOrganizerDetailDefinitions(); diff --git a/src/mobility/organizer.cpp b/src/mobility/organizer.cpp index 13165c5..3bb065b 100644 --- a/src/mobility/organizer.cpp +++ b/src/mobility/organizer.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/mobility/organizer.h b/src/mobility/organizer.h index 94afe04..bb660c7 100644 --- a/src/mobility/organizer.h +++ b/src/mobility/organizer.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/mobility/organizertreemodel.cpp b/src/mobility/organizertreemodel.cpp index bca8f8a..0f410db 100644 --- a/src/mobility/organizertreemodel.cpp +++ b/src/mobility/organizertreemodel.cpp @@ -1,3 +1,36 @@ +/************************************************************************** +** +** This file is part of Qt Simulator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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. +** +**************************************************************************/ + #include "organizertreemodel.h" #ifdef QT_DEBUG #include <modeltest.h> diff --git a/src/mobility/organizertreemodel.h b/src/mobility/organizertreemodel.h index 88e56b0..ab7640e 100644 --- a/src/mobility/organizertreemodel.h +++ b/src/mobility/organizertreemodel.h @@ -1,3 +1,36 @@ +/************************************************************************** +** +** This file is part of Qt Simulator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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. +** +**************************************************************************/ + #ifndef ORGANIZERTREEMODEL_H #define ORGANIZERTREEMODEL_H diff --git a/src/modeltest/modeltest.cpp b/src/modeltest/modeltest.cpp index 377577a..79bc47d 100644 --- a/src/modeltest/modeltest.cpp +++ b/src/modeltest/modeltest.cpp @@ -1,25 +1,35 @@ -/**************************************************************************** +/************************************************************************** ** -** Copyright (C) 2007 Trolltech ASA. All rights reserved. +** This file is part of Qt Simulator ** -** This file is part of the Qt Concurrent project on Trolltech Labs. +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** -** This file may be used under the terms of the GNU General Public -** License version 2.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of -** this file. Please review the following information to ensure GNU -** General Public Licensing requirements will be met: -** http://www.trolltech.com/products/qt/opensource.html +** Contact: Nokia Corporation (qt-info@nokia.com) ** -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://www.trolltech.com/products/qt/licensing.html or contact the -** sales department at sales@trolltech.com. +** No Commercial Usage ** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** 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. +** +**************************************************************************/ #include <QtGui/QtGui> diff --git a/src/modeltest/modeltest.h b/src/modeltest/modeltest.h index 38b6b2b..e9b1547 100644 --- a/src/modeltest/modeltest.h +++ b/src/modeltest/modeltest.h @@ -1,25 +1,35 @@ -/**************************************************************************** +/************************************************************************** ** -** Copyright (C) 2007 Trolltech ASA. All rights reserved. +** This file is part of Qt Simulator ** -** This file is part of the Qt Concurrent project on Trolltech Labs. +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** -** This file may be used under the terms of the GNU General Public -** License version 2.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of -** this file. Please review the following information to ensure GNU -** General Public Licensing requirements will be met: -** http://www.trolltech.com/products/qt/opensource.html +** Contact: Nokia Corporation (qt-info@nokia.com) ** -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://www.trolltech.com/products/qt/licensing.html or contact the -** sales department at sales@trolltech.com. +** No Commercial Usage ** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** 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. +** +**************************************************************************/ #ifndef MODELTEST_H #define MODELTEST_H diff --git a/src/other/application.cpp b/src/other/application.cpp index 8645779..1352bda 100644 --- a/src/other/application.cpp +++ b/src/other/application.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/other/application.h b/src/other/application.h index 3927006..9a7b8fb 100644 --- a/src/other/application.h +++ b/src/other/application.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/other/applicationmanager.cpp b/src/other/applicationmanager.cpp index b59a534..dd3b63e 100644 --- a/src/other/applicationmanager.cpp +++ b/src/other/applicationmanager.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ @@ -386,6 +390,8 @@ void ApplicationManager::updateDisplayInformation(const QSize &resolution, const foreach (Application *application, mApps) QtSimulatorPrivate::RemoteMetacall<void>::call(application->socket(), QtSimulatorPrivate::NoSync, "updateDisplayInformation"); + double newSoftKeyTextSize = 1.0 * mDisplayInfo.defaultFontSize / mDisplayInfo.hostDpi.width() * mDisplayInfo.dpi.width(); + emit softkeyTextSizeChanged(newSoftKeyTextSize); } void ApplicationManager::updateMobilityVersion(int appId, VersionStruct version) diff --git a/src/other/applicationmanager.h b/src/other/applicationmanager.h index b42c674..7770545 100644 --- a/src/other/applicationmanager.h +++ b/src/other/applicationmanager.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ @@ -68,6 +72,7 @@ signals: void applicationTimedOut(int id); void firstAppRegistered(); void lastAppUnregistered(); + void softkeyTextSizeChanged(double newSize); public slots: void handleConnection(); diff --git a/src/other/configurationreader.cpp b/src/other/configurationreader.cpp index dd92c19..e532580 100644 --- a/src/other/configurationreader.cpp +++ b/src/other/configurationreader.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ @@ -228,6 +232,17 @@ bool ConfigurationReader::processLine(const QByteArray &line, DeviceData *device } deviceData->menus[orientation].pixmapPath = mCurrentDir->filePath(values[1]); deviceData->supportedOrientations |= orientation; + } else if (parameter == "landscapeOrientation" || parameter == "portraitOrientation"){ + bool orientationOk = false; + Orientation orientation = stringToOrientation(value, &orientationOk); + if (!orientationOk) { + errorMsg = tr("ConfigurationReader: unknown orientation: %1").arg(QString(value)); + return false; + } + if (parameter == "landscapeOrientation") + deviceData->landscapeOrientation = orientation; + else + deviceData->portraitOrientation = orientation; } else return false; return true; diff --git a/src/other/configurationreader.h b/src/other/configurationreader.h index 7e10adc..fcdaff5 100644 --- a/src/other/configurationreader.h +++ b/src/other/configurationreader.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/other/deviceitem.cpp b/src/other/deviceitem.cpp index 175a03d..e02bdd0 100644 --- a/src/other/deviceitem.cpp +++ b/src/other/deviceitem.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ @@ -43,6 +47,7 @@ DeviceItem::DeviceItem(QGraphicsItem *parent) : QGraphicsObject(parent) , mDeviceOrientation(topUp) , mScreenOrientation(topUp) + , mFixedOrientation(Qt::WA_AutoOrientation) , mDisplay(0) , mMockup(0) , mMaemoNavigationButton(0) @@ -68,59 +73,10 @@ DeviceItem::DeviceItem(QGraphicsItem *parent) const int rotationDuration = 250; - stateHash[topUp] = new QState; - stateHash[topDown] = new QState; - stateHash[leftUp] = new QState; - stateHash[rightUp] = new QState; - delegationState = new QState; - - stateHash[topUp]->assignProperty(this, "rotation", 0); - stateHash[topDown]->assignProperty(this, "rotation", 180); - stateHash[leftUp]->assignProperty(this, "rotation", 90); - stateHash[rightUp]->assignProperty(this, "rotation", 270); - - connect(delegationState, SIGNAL(exited()), this, SLOT(startRotate())); - connect(delegationState, SIGNAL(entered()), this, SLOT(initiateRotate())); - - stateHash[topUp]->addTransition(this, "rotationSignal()", delegationState); - QSignalTransition *toTopUpTransition = delegationState->addTransition(this, "rotateToTopUp()", stateHash[topUp]); - QPropertyAnimation *toTopUpAnimation = new QPropertyAnimation(this, "rotation", this); - toTopUpAnimation->setDuration(rotationDuration); - toTopUpTransition->addAnimation(toTopUpAnimation); - connect(toTopUpAnimation, SIGNAL(finished()), this, SLOT(newViewSize())); - connect(toTopUpAnimation, SIGNAL(finished()), this, SLOT(updateScreenOrientation())); - - stateHash[topDown]->addTransition(this, "rotationSignal()", delegationState); - QSignalTransition *toTopDownTransition = delegationState->addTransition(this, "rotateToTopDown()", stateHash[topDown]); - QPropertyAnimation *toTopDownAnimation = new QPropertyAnimation(this, "rotation", this); - toTopDownAnimation->setDuration(rotationDuration); - toTopDownTransition->addAnimation(toTopDownAnimation); - connect(toTopDownAnimation, SIGNAL(finished()), this, SLOT(newViewSize())); - connect(toTopDownAnimation, SIGNAL(finished()), this, SLOT(updateScreenOrientation())); - - stateHash[leftUp]->addTransition(this, "rotationSignal()", delegationState); - QSignalTransition *toLeftUpTransition = delegationState->addTransition(this, "rotateToLeftUp()", stateHash[leftUp]); - QPropertyAnimation *toLeftUpAnimation = new QPropertyAnimation(this, "rotation", this); - toLeftUpAnimation->setDuration(rotationDuration); - toLeftUpTransition->addAnimation(toLeftUpAnimation); - connect(toLeftUpAnimation, SIGNAL(finished()), this, SLOT(newViewSize())); - connect(toLeftUpAnimation, SIGNAL(finished()), this, SLOT(updateScreenOrientation())); - - stateHash[rightUp]->addTransition(this, "rotationSignal()", delegationState); - QSignalTransition *toRightUpTransition = delegationState->addTransition(this, "rotateToRightUp()", stateHash[rightUp]); - QPropertyAnimation *toRightUpAnimation = new QPropertyAnimation(this, "rotation", this); - toRightUpAnimation->setDuration(rotationDuration); - toRightUpTransition->addAnimation(toRightUpAnimation); - connect(toRightUpAnimation, SIGNAL(finished()), this, SLOT(newViewSize())); - connect(toRightUpAnimation, SIGNAL(finished()), this, SLOT(updateScreenOrientation())); - - mStateMachine.addState(stateHash[topUp]); - mStateMachine.setInitialState(stateHash[topUp]); - mStateMachine.addState(stateHash[topDown]); - mStateMachine.addState(stateHash[leftUp]); - mStateMachine.addState(stateHash[rightUp]); - mStateMachine.addState(delegationState); - mStateMachine.start(); + mDefaultAnimation = new QPropertyAnimation(this, "rotation", this); + mDefaultAnimation->setDuration(rotationDuration); + connect(mDefaultAnimation, SIGNAL(finished()), this, SLOT(newViewSize())); + connect(mDefaultAnimation, SIGNAL(finished()), this, SLOT(updateScreenOrientation())); } DeviceItem::~DeviceItem() @@ -232,14 +188,14 @@ void DeviceItem::changeOrientation(Orientation newOrientation, bool rotateScreen { bool animatedRotate = needsAnimation(mDeviceOrientation, newOrientation); mDeviceOrientation = newOrientation; - if (rotateScreen) { + if (mFixedOrientation == Qt::WA_AutoOrientation && rotateScreen) { mScreenOrientation = newOrientation; if (!animatedRotate) updateScreenOrientation(); } if (animatedRotate) - emit rotationSignal(); + initiateRotate(); emit orientationChanged(newOrientation); } @@ -253,14 +209,24 @@ bool DeviceItem::needsAnimation(Orientation oldValue, Orientation newValue) void DeviceItem::setInitialRotation(Orientation device, Orientation screen) { - if (mStateMachine.isRunning()) - return; mDeviceOrientation = device; mScreenOrientation = screen; - setRotation(stateHash[device]->property("rotation").toInt()); + switch (device) { + case topUp: + setRotation(0); + break; + case topDown: + setRotation(180); + break; + case leftUp: + setRotation(90); + break; + case rightUp: + setRotation(-90); + break; + } newViewSize(); updateScreenOrientation(); - mStateMachine.setInitialState(stateHash[device]); emit orientationChanged(device); } @@ -268,9 +234,15 @@ void DeviceItem::updateScreenOrientation() { QSize newResolution = mDeviceData.resolution; - // switch to a valid screen orientation if invalid - if (!(mScreenOrientation & mDeviceData.supportedOrientations) && !mDeviceData.menus.isEmpty()) - mScreenOrientation = mDeviceData.menus.begin().key(); + if (mFixedOrientation == Qt::WA_AutoOrientation) { + // switch to a valid screen orientation if invalid + if (!(mScreenOrientation & mDeviceData.supportedOrientations) && !mDeviceData.menus.isEmpty()) + mScreenOrientation = mDeviceData.menus.begin().key(); + } else if (mFixedOrientation == Qt::WA_LockLandscapeOrientation) { + mScreenOrientation = mDeviceData.landscapeOrientation; + } else if (mFixedOrientation == Qt::WA_LockPortraitOrientation) { + mScreenOrientation = mDeviceData.portraitOrientation; + } switch (mScreenOrientation) { case topUp: @@ -310,28 +282,26 @@ void DeviceItem::updateScreenOrientation() void DeviceItem::initiateRotate() { + // set the view to the maximum size + int rotationSide = rotationSideLength() * scale(); + setPos(rotationSide/2, rotationSide/2); + emit viewSizeRequired(QSize(rotationSide, rotationSide)); + switch (mDeviceOrientation) { case topUp: - emit rotateToTopUp(); + mDefaultAnimation->setEndValue(0); break; case topDown: - emit rotateToTopDown(); + mDefaultAnimation->setEndValue(180); break; case leftUp: - emit rotateToLeftUp(); + mDefaultAnimation->setEndValue(90); break; case rightUp: - emit rotateToRightUp(); + mDefaultAnimation->setEndValue(-90); break; } -} - -void DeviceItem::startRotate() -{ - // set the view to the maximum size - int rotationSide = rotationSideLength() * scale(); - setPos(rotationSide/2, rotationSide/2); - emit viewSizeRequired(QSize(rotationSide, rotationSide)); + mDefaultAnimation->start(); } void DeviceItem::changeScaleFactor(qreal newScaleFactor) @@ -350,6 +320,13 @@ void DeviceItem::setSymbianSoftKeyText(int buttonNumber, const QString &text) } } +void DeviceItem::setSymbianSoftKeyTextSize(double size) +{ + foreach (SymbianSoftKeyButton *b, mSymbianSoftKeyButtons) { + b->setTextSize(size); + } +} + void DeviceItem::setMaemoNavigationMode(MaemoNavigationMode mode) { if (mode == maemoClose && mDeviceData.maemoClosePixmap) @@ -561,6 +538,7 @@ void KeyButton::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) SymbianSoftKeyButton::SymbianSoftKeyButton(const SymbianSoftKeyButtonData &button, QGraphicsItem *parent) : QGraphicsObject(parent) , mButton(button) + , mTextSize(12) , mMouseOver(false) { setFlag(QGraphicsItem::ItemIsFocusable); @@ -585,6 +563,9 @@ void SymbianSoftKeyButton::paint(QPainter *painter, const QStyleOptionGraphicsIt Q_UNUSED(option); Q_UNUSED(widget); painter->setPen(Qt::white); + QFont f = painter->font(); + f.setPointSizeF(mTextSize); + painter->setFont(f); painter->drawText(boundingRect(), Qt::AlignHCenter | Qt::AlignVCenter, mText); if (mMouseOver) { painter->setPen(Qt::NoPen); @@ -609,6 +590,12 @@ QString SymbianSoftKeyButton::text() const return mText; } +void SymbianSoftKeyButton::setTextSize(double size) +{ + mTextSize = size; + update(); +} + void SymbianSoftKeyButton::hoverEnterEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); @@ -633,3 +620,10 @@ void SymbianSoftKeyButton::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_UNUSED(event); emit clicked(mButton.buttonNumber); } + +void DeviceItem::updateOrientation(Qt::WidgetAttribute orientation) +{ + mFixedOrientation = orientation; + updateScreenOrientation(); + emit orientationLocked(orientation != Qt::WA_AutoOrientation); +} diff --git a/src/other/deviceitem.h b/src/other/deviceitem.h index 81b3d9e..e5d98da 100644 --- a/src/other/deviceitem.h +++ b/src/other/deviceitem.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ @@ -79,6 +83,8 @@ struct DeviceData : diagonalInInch(0.) , defaultFontSize(12) , forceDpi(-1) + , landscapeOrientation(topUp) + , portraitOrientation(topUp) {} QString name; @@ -102,10 +108,13 @@ struct DeviceData SupportedOrientations supportedOrientations; QHash<Orientation, MenuData> menus; QList<SymbianSoftKeyButtonData> symbianSoftKeys; + Orientation landscapeOrientation; + Orientation portraitOrientation; }; class DisplayWidget; class QState; +class QPropertyAnimation; class MenuPixmapItem: public QGraphicsPixmapItem { @@ -199,6 +208,8 @@ public: void setText(const QString &text); QString text() const; + void setTextSize(double size); + protected: virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event); virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); @@ -211,6 +222,7 @@ signals: private: SymbianSoftKeyButtonData mButton; QString mText; + double mTextSize; bool mMouseOver; }; @@ -233,9 +245,11 @@ public: public slots: void changeDevice(const DeviceData &data); void changeOrientation(Orientation newOrientation, bool rotateScreen); + void updateOrientation(Qt::WidgetAttribute orientation); void setInitialRotation(Orientation device, Orientation screen); void changeScaleFactor(qreal newScaleFactor); void setSymbianSoftKeyText(int buttonNumber, const QString &text); + void setSymbianSoftKeyTextSize(double); void setMaemoNavigationMode(MaemoNavigationMode mode); protected: @@ -251,6 +265,7 @@ private: Orientation mDeviceOrientation; Orientation mScreenOrientation; + Qt::WidgetAttribute mFixedOrientation; DeviceData mDeviceData; @@ -259,10 +274,7 @@ private: DisplayWidget *mDisplay; QGraphicsPixmapItem *mMockup; - QStateMachine mStateMachine; - QHash<Orientation, QState*> stateHash; - QState *delegationState; - + QPropertyAnimation *mDefaultAnimation; QPoint mDragOffset; QList<KeyButton*> mButtons; @@ -273,19 +285,10 @@ private: private slots: void initiateRotate(); - void startRotate(); void newViewSize(); void updateScreenOrientation(); signals: - void rotationSignal(); - void rotationSignal(Orientation newOrientation); - void rotateToTopUp(); - void rotateToTopDown(); - void rotateToLeftUp(); - void rotateToRightUp(); - void rotateToFaceUp(); - void rotateToFaceDown(); void sizeChanged(const QSize &size); void drag(const QPoint &to); // to is the new top-left point of the view in screen coordinates void viewSizeRequired(const QSize &size); @@ -300,6 +303,9 @@ signals: void symbianSoftKeyClicked(int buttonNr); void orientationChanged(Orientation to); + void orientationLocked(bool locked); + + friend class InputScriptInterface; }; #endif //DEVICEITEM_H diff --git a/src/other/displaywidget.cpp b/src/other/displaywidget.cpp index 95e43fa..6a97487 100644 --- a/src/other/displaywidget.cpp +++ b/src/other/displaywidget.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/other/displaywidget.h b/src/other/displaywidget.h index 6064482..4c3d45a 100644 --- a/src/other/displaywidget.h +++ b/src/other/displaywidget.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/other/inputfilter.cpp b/src/other/inputfilter.cpp new file mode 100644 index 0000000..ebec8aa --- /dev/null +++ b/src/other/inputfilter.cpp @@ -0,0 +1,120 @@ +/************************************************************************** +** +** This file is part of Qt Simulator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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. +** +**************************************************************************/ + +#include "inputfilter.h" +#include "mouseindicator.h" +#include "qsimulatordata_p.h" +#include "widget.h" +#include "displaywidget.h" +#include "application.h" + +#include <QtGui/QGraphicsSceneEvent> + +InputFilter::InputFilter(QGraphicsItem *parent) + : QGraphicsItem(parent) +{ +} + +InputFilter::~InputFilter() +{ + removeValuePoints(); +} + +QRectF InputFilter::boundingRect() const +{ + return QRectF(); +} + +void InputFilter::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +{ + Q_UNUSED(painter) + Q_UNUSED(option) + Q_UNUSED(widget) +} + +QtSimulatorPrivate::TouchEventData InputFilter::createTouchEventFromMouseEvent(Widget *widget, + QGraphicsSceneMouseEvent *mouseEvent) +{ + DisplayWidget *display = widget->owner->display(); + QtSimulatorPrivate::TouchEventData touchEvent; + switch (mouseEvent->type()) { + case QEvent::GraphicsSceneMousePress: + touchEvent.type = static_cast<int>(QEvent::TouchBegin); + touchEvent.touchPointStates = Qt::TouchPointPressed; + break; + case QEvent::GraphicsSceneMouseMove: + touchEvent.type = static_cast<int>(QEvent::TouchUpdate); + touchEvent.touchPointStates = Qt::TouchPointMoved; + break; + case QEvent::GraphicsSceneMouseRelease: + touchEvent.type = static_cast<int>(QEvent::TouchEnd); + touchEvent.touchPointStates = Qt::TouchPointReleased; + break; + default: + break; + } + touchEvent.deviceType = QTouchEvent::TouchScreen; + touchEvent.modifiers = Qt::NoModifier; + QList<QtSimulatorPrivate::TouchPointData> touchPointList; + int id = 0; + foreach (const MouseIndicator *valuePoint, mValuePoints) { + QtSimulatorPrivate::TouchPointData touchPoint; + QSizeF size = valuePoint->rect().size(); + touchPoint.id = ++id; + touchPoint.rect = QRectF(valuePoint->center(), size); + touchPoint.sceneRect = QRectF(widget->mapToScene(valuePoint->center()), size); + touchPoint.screenRect = QRectF(widget->mapToItem(display, valuePoint->center()), size); + touchPoint.normalizedPos = QPointF(touchPoint.screenRect.center().x() / display->width(), + touchPoint.screenRect.center().y() / display->height()); + touchPoint.startPos = valuePoint->startPos(); + touchPoint.startScenePos = widget->mapToScene(valuePoint->startPos()); + touchPoint.startScreenPos = widget->mapToItem(display, valuePoint->startPos()); + touchPoint.startNormalizedPos = QPointF(touchPoint.startScreenPos.x() / display->width(), + touchPoint.startScreenPos.y() / display->height()); + touchPoint.lastPos = valuePoint->lastCenter(); + touchPoint.lastScenePos = widget->mapToScene(valuePoint->lastCenter()); + touchPoint.lastScreenPos = widget->mapToItem(display, valuePoint->lastCenter()); + touchPoint.lastNormalizedPos = QPointF(touchPoint.lastScreenPos.x() / display->width(), + touchPoint.lastScreenPos.y() / display->height()); + touchPoint.pressure = .75; + touchPointList.append(touchPoint); + } + touchEvent.touchPoints = touchPointList; + return touchEvent; +} + +void InputFilter::removeValuePoints() +{ + qDeleteAll(mValuePoints); + mValuePoints.clear(); +} diff --git a/src/other/inputfilter.h b/src/other/inputfilter.h new file mode 100644 index 0000000..6be1a2f --- /dev/null +++ b/src/other/inputfilter.h @@ -0,0 +1,60 @@ +/************************************************************************** +** +** This file is part of Qt Simulator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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. +** +**************************************************************************/ + +#ifndef INPUTFILTER_H +#define INPUTFILTER_H + +#include "qsimulatordata_p.h" +#include <QGraphicsItem> + +class Widget; +class QGraphicsSceneMouseEvent; +class MouseIndicator; +class InputFilter : public QGraphicsItem +{ +public: + InputFilter(QGraphicsItem *parent = 0); + ~InputFilter(); + +protected: + virtual QRectF boundingRect() const; + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + + QList<MouseIndicator *> mValuePoints; + + QtSimulatorPrivate::TouchEventData createTouchEventFromMouseEvent(Widget *widget, + QGraphicsSceneMouseEvent *mouseEvent); + void removeValuePoints(); +}; + +#endif // INPUTFILTER_H diff --git a/src/other/mouseindicator.cpp b/src/other/mouseindicator.cpp new file mode 100644 index 0000000..c6af699 --- /dev/null +++ b/src/other/mouseindicator.cpp @@ -0,0 +1,86 @@ +/************************************************************************** +** +** This file is part of Qt Simulator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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. +** +**************************************************************************/ + +#include "mouseindicator.h" + +#include <QtGui/QBrush> +#include <QtGui/QCursor> + +MouseIndicator::MouseIndicator(QGraphicsItem *parent) + : QGraphicsEllipseItem(parent) +{ +} + +MouseIndicator::MouseIndicator(qreal x, qreal y, QGraphicsItem *parent) + : QGraphicsEllipseItem(0, 0, 15, 15, parent) +{ + setCenter(QPointF(x, y)); + setBrush(Qt::red); + setCursor(Qt::OpenHandCursor); +} + +MouseIndicator::MouseIndicator(QPointF center, QGraphicsItem *parent) + : QGraphicsEllipseItem(0, 0, 15, 15, parent) +{ + setCenter(center); + setBrush(Qt::red); + setCursor(Qt::OpenHandCursor); +} + +MouseIndicator::~MouseIndicator() +{ +} + +QPointF MouseIndicator::center() const +{ + return pos() + QPointF(rect().width(), rect().height()) / 2; +} + +void MouseIndicator::setCenter(const QPointF &newCenter) +{ + mLastCenter = center(); + setPos(newCenter - QPointF(rect().width(), rect().height()) / 2); +} + +QPointF MouseIndicator::startPos() const +{ + return mStartPosition; +} + +void MouseIndicator::setStartPos(const QPointF &startPos) +{ + mLastCenter = startPos; + mStartPosition = startPos; +} + + diff --git a/src/other/mouseindicator.h b/src/other/mouseindicator.h new file mode 100644 index 0000000..59aeb51 --- /dev/null +++ b/src/other/mouseindicator.h @@ -0,0 +1,59 @@ +/************************************************************************** +** +** This file is part of Qt Simulator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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. +** +**************************************************************************/ + +#ifndef MOUSEINDICATOR_H +#define MOUSEINDICATOR_H + +#include <QtGui/QGraphicsEllipseItem> + +class MouseIndicator : public QGraphicsEllipseItem +{ +public: + MouseIndicator(QGraphicsItem *parent = 0); + MouseIndicator(qreal centerX, qreal centerY, QGraphicsItem *parent = 0); + MouseIndicator(QPointF center, QGraphicsItem *parent = 0); + virtual ~MouseIndicator(); + + QPointF center() const; + void setCenter(const QPointF &newCenter); + QPointF lastCenter() const { return mLastCenter; } + + QPointF startPos() const; + void setStartPos(const QPointF &startPos); + +private: + QPointF mStartPosition; + QPointF mLastCenter; +}; + +#endif // MOUSEINDICATOR_H diff --git a/src/other/other.pri b/src/other/other.pri index b83c43c..45f2619 100644 --- a/src/other/other.pri +++ b/src/other/other.pri @@ -9,7 +9,13 @@ SOURCES += application.cpp \ displaywidget.cpp \ phononmanager.cpp \ widgetmanager.cpp \ - widget.cpp + widget.cpp \ + mouseindicator.cpp \ + inputfilter.cpp \ + pinchmodefilter.cpp \ + panmodefilter.cpp \ + swipemodefilter.cpp + HEADERS += application.h \ applicationmanager.h \ configurationreader.h \ @@ -17,7 +23,12 @@ HEADERS += application.h \ displaywidget.h \ phononmanager.h \ widgetmanager.h \ - widget.h + widget.h \ + mouseindicator.h \ + inputfilter.h \ + pinchmodefilter.h \ + panmodefilter.h \ + swipemodefilter.h contains(QT_CONFIG, phonon) { SOURCES += \ diff --git a/src/other/panmodefilter.cpp b/src/other/panmodefilter.cpp new file mode 100644 index 0000000..49d8be0 --- /dev/null +++ b/src/other/panmodefilter.cpp @@ -0,0 +1,133 @@ +/************************************************************************** +** +** This file is part of Qt Simulator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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. +** +**************************************************************************/ + +#include "panmodefilter.h" +#include "mouseindicator.h" +#include "widget.h" +#include "application.h" + +#include <QtGui/QGraphicsSceneEvent> + +PanModeFilter::PanModeFilter(QGraphicsItem *parent) + : InputFilter(parent) + , mState(setFirstPoint) +{ +} + +PanModeFilter::~PanModeFilter() +{ +} + +bool PanModeFilter::sceneEventFilter(QGraphicsItem *watched, QEvent *event) +{ + Widget *widget = static_cast<Widget *>(watched); + QGraphicsSceneMouseEvent *ev = 0; + QtSimulatorPrivate::TouchEventData touchEvent; + switch (event->type()) { + case QEvent::GraphicsSceneMousePress: + ev = static_cast<QGraphicsSceneMouseEvent *>(event); + switch (mState) { + case setFirstPoint: + mState = updateFirstPoint; + mValuePoints.append(new MouseIndicator(ev->pos(), widget)); + mValuePoints[0]->setCursor(Qt::ClosedHandCursor); + return true; + case setSecondPoint: + if (mValuePoints[0]->contains(mapToItem(mValuePoints[0], ev->pos()))) { + mState = updateFirstPoint; + mValuePoints[0]->setCursor(Qt::ClosedHandCursor); + } else { + mValuePoints.append(new MouseIndicator(ev->pos(), this)); + mValuePoints[1]->setCursor(Qt::ClosedHandCursor); + mPanDiff = ev->pos() - mValuePoints[0]->center(); + mValuePoints[0]->setStartPos(mValuePoints[0]->center()); + mValuePoints[1]->setStartPos(mValuePoints[1]->center()); + mState = updateSecondPoint; + touchEvent = createTouchEventFromMouseEvent(widget, ev); + QtSimulatorPrivate::RemoteMetacall<void>::call(widget->owner->socket(), + QtSimulatorPrivate::NoSync, + "dispatchTouchEvent", + widget->widgetId, + touchEvent); + } + return true; + default: + return true; + } + break; + case QEvent::GraphicsSceneMouseRelease: + ev = static_cast<QGraphicsSceneMouseEvent *>(event); + switch (mState) { + case updateFirstPoint: + mState = setSecondPoint; + mValuePoints[0]->setCursor(Qt::OpenHandCursor); + return true; + case updateSecondPoint: + touchEvent = createTouchEventFromMouseEvent(widget, ev); + QtSimulatorPrivate::RemoteMetacall<void>::call(widget->owner->socket(), + QtSimulatorPrivate::NoSync, + "dispatchTouchEvent", + widget->widgetId, + touchEvent); + removeValuePoints(); + mState = setFirstPoint; + return true; + default: + return true; + } + break; + case QEvent::GraphicsSceneMouseMove: + ev = static_cast<QGraphicsSceneMouseEvent *>(event); + switch (mState) { + case updateFirstPoint: + mValuePoints[0]->setCenter(ev->pos()); + return true; + case updateSecondPoint: + mValuePoints[1]->setCenter(ev->pos()); + mValuePoints[0]->setCenter(mValuePoints[1]->center() - mPanDiff); + touchEvent = createTouchEventFromMouseEvent(widget, ev); + QtSimulatorPrivate::RemoteMetacall<void>::call(widget->owner->socket(), + QtSimulatorPrivate::NoSync, + "dispatchTouchEvent", + widget->widgetId, + touchEvent); + return true; + default: + return true; + } + break; + default: + break; + } + return false; +} diff --git a/src/other/panmodefilter.h b/src/other/panmodefilter.h new file mode 100644 index 0000000..c21de7e --- /dev/null +++ b/src/other/panmodefilter.h @@ -0,0 +1,59 @@ +/************************************************************************** +** +** This file is part of Qt Simulator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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. +** +**************************************************************************/ + +#ifndef PANMODEFILTER_H +#define PANMODEFILTER_H + +#include "inputfilter.h" + +class QPointF; +class PanModeFilter : public InputFilter +{ +public: + PanModeFilter(QGraphicsItem *parent = 0); + ~PanModeFilter(); + +protected: + virtual bool sceneEventFilter(QGraphicsItem *watched, QEvent *event); + +private: + QPointF mPanDiff; + enum FilterState { + setFirstPoint, + updateFirstPoint, + setSecondPoint, + updateSecondPoint + } mState; +}; + +#endif // PANMODEFILTER_H diff --git a/src/other/phononmanager.cpp b/src/other/phononmanager.cpp index 110b18e..cb2bcb9 100644 --- a/src/other/phononmanager.cpp +++ b/src/other/phononmanager.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/other/phononmanager.h b/src/other/phononmanager.h index ee5197d..c626815 100644 --- a/src/other/phononmanager.h +++ b/src/other/phononmanager.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/other/phononsignalbridges.cpp b/src/other/phononsignalbridges.cpp index 10bb731..73892a9 100644 --- a/src/other/phononsignalbridges.cpp +++ b/src/other/phononsignalbridges.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/other/phononsignalbridges.h b/src/other/phononsignalbridges.h index ab6a166..b5f6d59 100644 --- a/src/other/phononsignalbridges.h +++ b/src/other/phononsignalbridges.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/other/phononvideowidget.cpp b/src/other/phononvideowidget.cpp index f3367c8..6b607b0 100644 --- a/src/other/phononvideowidget.cpp +++ b/src/other/phononvideowidget.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/other/phononvideowidget.h b/src/other/phononvideowidget.h index 8e0af97..031758d 100644 --- a/src/other/phononvideowidget.h +++ b/src/other/phononvideowidget.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/other/pinchmodefilter.cpp b/src/other/pinchmodefilter.cpp new file mode 100644 index 0000000..aae7616 --- /dev/null +++ b/src/other/pinchmodefilter.cpp @@ -0,0 +1,142 @@ +/************************************************************************** +** +** This file is part of Qt Simulator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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. +** +**************************************************************************/ + +#include "pinchmodefilter.h" +#include "mouseindicator.h" +#include "widget.h" +#include "application.h" + +#include <QtGui/QGraphicsSceneEvent> + +PinchModeFilter::PinchModeFilter(QGraphicsItem *parent) + : InputFilter(parent) + , mState(setReferencePoint) +{ + mReferencePoint = new MouseIndicator(0, 0, this); + mReferencePoint->setVisible(false); + mReferencePoint->setBrush(Qt::gray); +} + +PinchModeFilter::~PinchModeFilter() +{ +} + +bool PinchModeFilter::sceneEventFilter(QGraphicsItem *watched, QEvent *event) +{ + Widget *widget = static_cast<Widget *>(watched); + QGraphicsSceneMouseEvent *ev = 0; + QtSimulatorPrivate::TouchEventData touchEvent; + QPointF diff; + switch (event->type()) { + case QEvent::GraphicsSceneMousePress: + ev = static_cast<QGraphicsSceneMouseEvent *>(event); + switch (mState) { + case setReferencePoint: + mState = updateReferencePoint; + mReferencePoint->setCursor(Qt::ClosedHandCursor); + mReferencePoint->setCenter(ev->pos()); + mReferencePoint->setVisible(true); + return true; + case setTouchPoints: + if (mReferencePoint->contains(mapToItem(mReferencePoint, ev->pos()))) { + mReferencePoint->setCursor(Qt::ClosedHandCursor); + mState = updateReferencePoint; + } else { + mValuePoints.append(new MouseIndicator(ev->pos(), widget)); + mValuePoints[0]->setStartPos(mValuePoints[0]->center()); + mValuePoints[0]->setCursor(Qt::ClosedHandCursor); + QPointF diff = ev->pos() - mReferencePoint->center(); + mValuePoints.append(new MouseIndicator(mReferencePoint->center() - diff, widget)); + mValuePoints[1]->setStartPos(mValuePoints[1]->center()); + mState = updateTouchPoints; + touchEvent = createTouchEventFromMouseEvent(widget, ev); + QtSimulatorPrivate::RemoteMetacall<void>::call(widget->owner->socket(), + QtSimulatorPrivate::NoSync, + "dispatchTouchEvent", + widget->widgetId, + touchEvent); + } + return true; + default: + return true; + } + break; + case QEvent::GraphicsSceneMouseRelease: + ev = static_cast<QGraphicsSceneMouseEvent *>(event); + switch (mState) { + case updateReferencePoint: + mReferencePoint->setCursor(Qt::OpenHandCursor); + mState = setTouchPoints; + return true; + case updateTouchPoints: + touchEvent = createTouchEventFromMouseEvent(widget, ev); + QtSimulatorPrivate::RemoteMetacall<void>::call(widget->owner->socket(), + QtSimulatorPrivate::NoSync, + "dispatchTouchEvent", + widget->widgetId, + touchEvent); + + removeValuePoints(); + mReferencePoint->setVisible(false); + mState = setReferencePoint; + return true; + default: + return true; + } + break; + case QEvent::GraphicsSceneMouseMove: + ev = static_cast<QGraphicsSceneMouseEvent *>(event); + switch (mState) { + case updateReferencePoint: + mReferencePoint->setCenter(ev->pos()); + return true; + case updateTouchPoints: + mValuePoints[0]->setCenter(ev->pos()); + diff = ev->pos() - mReferencePoint->center(); + mValuePoints[1]->setCenter(mReferencePoint->center() - diff); + touchEvent = createTouchEventFromMouseEvent(widget, ev); + QtSimulatorPrivate::RemoteMetacall<void>::call(widget->owner->socket(), + QtSimulatorPrivate::NoSync, + "dispatchTouchEvent", + widget->widgetId, + touchEvent); + return true; + default: + return true; + } + break; + default: + break; + } + return false; +} diff --git a/src/other/pinchmodefilter.h b/src/other/pinchmodefilter.h new file mode 100644 index 0000000..ff3544b --- /dev/null +++ b/src/other/pinchmodefilter.h @@ -0,0 +1,59 @@ +/************************************************************************** +** +** This file is part of Qt Simulator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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. +** +**************************************************************************/ + +#ifndef PINCHMODEFILTER_H +#define PINCHMODEFILTER_H + +#include "inputfilter.h" + +class PinchModeFilter : public InputFilter +{ +public: + PinchModeFilter(QGraphicsItem *parent = 0); + ~PinchModeFilter(); + +protected: + virtual bool sceneEventFilter(QGraphicsItem *watched, QEvent *event); + +private: + MouseIndicator *mReferencePoint; + + enum FilterState { + setReferencePoint, + updateReferencePoint, + setTouchPoints, + updateTouchPoints + } mState; +}; + +#endif // PINCHMODEFILTER_H diff --git a/src/other/swipemodefilter.cpp b/src/other/swipemodefilter.cpp new file mode 100644 index 0000000..6d5593d --- /dev/null +++ b/src/other/swipemodefilter.cpp @@ -0,0 +1,160 @@ +/************************************************************************** +** +** This file is part of Qt Simulator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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. +** +**************************************************************************/ + +#include "swipemodefilter.h" +#include "mouseindicator.h" +#include "widget.h" +#include "application.h" + +#include <QtGui/QGraphicsSceneEvent> + +SwipeModeFilter::SwipeModeFilter(QGraphicsItem *parent) + : InputFilter(parent) + , mState(setFirstPoint) +{ +} + +SwipeModeFilter::~SwipeModeFilter() +{ +} + +bool SwipeModeFilter::sceneEventFilter(QGraphicsItem *watched, QEvent *event) +{ + Widget *widget = static_cast<Widget *>(watched); + QGraphicsSceneMouseEvent *ev = 0; + QtSimulatorPrivate::TouchEventData touchEvent; + switch (event->type()) { + case QEvent::GraphicsSceneMousePress: + ev = static_cast<QGraphicsSceneMouseEvent *>(event); + switch (mState) { + case setFirstPoint: + mState = updateFirstPoint; + mValuePoints.append(new MouseIndicator(ev->pos(), this)); + mValuePoints[0]->setCursor(Qt::ClosedHandCursor); + return true; + case setSecondPoint: + if (mValuePoints[0]->contains(mapToItem(mValuePoints[0], ev->pos()))) { + mState = updateFirstPoint; + mValuePoints[0]->setCursor(Qt::ClosedHandCursor); + } else { + mState = updateSecondPoint; + mValuePoints.append(new MouseIndicator(ev->pos(), this)); + mValuePoints[1]->setCursor(Qt::ClosedHandCursor); + } + return true; + break; + case setThirdPoint: + if (mValuePoints[0]->contains(mapToItem(mValuePoints[0], ev->pos()))) { + mState = updateFirstPoint; + mValuePoints[0]->setCursor(Qt::ClosedHandCursor); + } else if (mValuePoints[1]->contains(mapToItem(mValuePoints[1], ev->pos()))) { + mState = updateSecondPoint; + mValuePoints[1]->setCursor(Qt::ClosedHandCursor); + } else { + mValuePoints.append(new MouseIndicator(ev->pos(), this)); + mValuePoints[2]->setCursor(Qt::ClosedHandCursor); + mDiff1 = ev->pos() - mValuePoints[0]->center(); + mDiff2 = ev->pos() - mValuePoints[1]->center(); + mValuePoints[0]->setStartPos(mValuePoints[0]->center()); + mValuePoints[1]->setStartPos(mValuePoints[1]->center()); + mValuePoints[2]->setStartPos(mValuePoints[2]->center()); + mState = updateThirdPoint; + QtSimulatorPrivate::TouchEventData touchEvent = createTouchEventFromMouseEvent(widget, ev); + QtSimulatorPrivate::RemoteMetacall<void>::call(widget->owner->socket(), + QtSimulatorPrivate::NoSync, + "dispatchTouchEvent", + widget->widgetId, + touchEvent); + } + return true; + default: + return true; + } + break; + case QEvent::GraphicsSceneMouseRelease: + ev = static_cast<QGraphicsSceneMouseEvent *>(event); + switch (mState) { + case updateFirstPoint: + if (mValuePoints.length() == 1) + mState = setSecondPoint; + else + mState = setThirdPoint; + mValuePoints[0]->setCursor(Qt::OpenHandCursor); + return true; + case updateSecondPoint: + mState = setThirdPoint; + mValuePoints[1]->setCursor(Qt::OpenHandCursor); + return true; + case updateThirdPoint: + touchEvent = createTouchEventFromMouseEvent(widget, ev); + QtSimulatorPrivate::RemoteMetacall<void>::call(widget->owner->socket(), + QtSimulatorPrivate::NoSync, + "dispatchTouchEvent", + widget->widgetId, + touchEvent); + removeValuePoints(); + mState = setFirstPoint; + return true; + default: + return true; + } + break; + case QEvent::GraphicsSceneMouseMove: + ev = static_cast<QGraphicsSceneMouseEvent *>(event); + switch (mState) { + case updateFirstPoint: + mValuePoints[0]->setCenter(ev->pos()); + return true; + case updateSecondPoint: + mValuePoints[1]->setCenter(ev->pos()); + return true; + case updateThirdPoint: { + mValuePoints[2]->setCenter(ev->pos()); + mValuePoints[1]->setCenter(mValuePoints[2]->center() - mDiff1); + mValuePoints[0]->setCenter(mValuePoints[2]->center() - mDiff2); + QtSimulatorPrivate::TouchEventData touchEvent = createTouchEventFromMouseEvent(widget, ev); + QtSimulatorPrivate::RemoteMetacall<void>::call(widget->owner->socket(), + QtSimulatorPrivate::NoSync, + "dispatchTouchEvent", + widget->widgetId, + touchEvent); + return true; + } default: + return true; + } + break; + default: + break; + } + return false; +} diff --git a/src/other/swipemodefilter.h b/src/other/swipemodefilter.h new file mode 100644 index 0000000..9e4a956 --- /dev/null +++ b/src/other/swipemodefilter.h @@ -0,0 +1,62 @@ +/************************************************************************** +** +** This file is part of Qt Simulator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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. +** +**************************************************************************/ + +#ifndef SWIPEMODEFILTER_H +#define SWIPEMODEFILTER_H + +#include "inputfilter.h" + +class QPointF; +class SwipeModeFilter : public InputFilter +{ +public: + SwipeModeFilter(QGraphicsItem *parent = 0); + ~SwipeModeFilter(); + +protected: + virtual bool sceneEventFilter(QGraphicsItem *watched, QEvent *event); + +private: + QPointF mDiff1; + QPointF mDiff2; + enum FilterState { + setFirstPoint, + updateFirstPoint, + setSecondPoint, + updateSecondPoint, + setThirdPoint, + updateThirdPoint + } mState; +}; + +#endif // SWIPEMODEFILTER_H diff --git a/src/other/widget.cpp b/src/other/widget.cpp index 7e16891..9510d79 100644 --- a/src/other/widget.cpp +++ b/src/other/widget.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ @@ -32,6 +36,11 @@ #include "application.h" #include "displaywidget.h" #include "qsimulatordata_p.h" +#include "mouseindicator.h" +#include "widgetmanager.h" +#include "pinchmodefilter.h" +#include "panmodefilter.h" +#include "swipemodefilter.h" #ifndef QT_NO_PHONON #include "phononvideowidget.h" @@ -44,6 +53,7 @@ #include <QtGui/QPainter> #include <QtGui/QGraphicsSceneMouseEvent> #include <QtGui/QGraphicsScene> +#include <QtGui/QTouchEvent> class Sleeper : QThread { @@ -64,6 +74,7 @@ Widget::Widget(QRect geometry, QImage::Format f, const QString &t, Application* , widgetId(id) , title(t) , owner(who) + , mManager(0) , memory(0) , width(geometry.width()) , height(geometry.height()) @@ -72,7 +83,10 @@ Widget::Widget(QRect geometry, QImage::Format f, const QString &t, Application* , wantsUpdate(false) , memoryFilled(false) , mMaemo5Stacked(false) + , mOrientation(Qt::WA_AutoOrientation) , mSharedMemoryName(sharedMemoryName) + , mMouseInputMode(MultiPointTouchUi::defaultMode) + , mFilterItem(0) { //Commented out, in order to be //able to easily re-enable mouse tracking @@ -181,35 +195,68 @@ void Widget::setGeometry(QRect g) void Widget::mousePressEvent(QGraphicsSceneMouseEvent* ev) { - handleMouseEvent(QEvent::MouseButtonPress, ev); + switch (mMouseInputMode) { + case MultiPointTouchUi::defaultMode: + handleMouseEvent(QEvent::MouseButtonPress, ev); + break; + case MultiPointTouchUi::freeMode: + mManager->runCurrentGestureScript(); + break; + default: + break; + } } void Widget::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* ev) { - handleMouseEvent(QEvent::MouseButtonDblClick, ev); + switch (mMouseInputMode) { + case MultiPointTouchUi::defaultMode: + handleMouseEvent(QEvent::MouseButtonDblClick, ev); + break; + default: + break; + } } void Widget::mouseReleaseEvent(QGraphicsSceneMouseEvent* ev) { - handleMouseEvent(QEvent::MouseButtonRelease, ev); + switch (mMouseInputMode) { + case MultiPointTouchUi::defaultMode: + handleMouseEvent(QEvent::MouseButtonRelease, ev); + break; + default: + break; + } } void Widget::mouseMoveEvent(QGraphicsSceneMouseEvent* ev) { - handleMouseEvent(QEvent::MouseMove, ev); + switch (mMouseInputMode) { + case MultiPointTouchUi::defaultMode: + handleMouseEvent(QEvent::MouseMove, ev); + break; + default: + break; + } } void Widget::hoverMoveEvent(QGraphicsSceneHoverEvent *ev) { - QtSimulatorPrivate::RemoteMetacall<void>::call(owner->socket(), QtSimulatorPrivate::NoSync, - "dispatchMouseEvent", - widgetId, - static_cast<int>(QEvent::MouseMove), - mapToItem(owner->display(), ev->pos() - offset).toPoint(), - static_cast<int>(Qt::NoButton), - static_cast<int>(Qt::NoButton), - static_cast<int>(ev->modifiers())); - ev->accept(); + switch (mMouseInputMode) { + case MultiPointTouchUi::defaultMode: + QtSimulatorPrivate::RemoteMetacall<void>::call(owner->socket(), QtSimulatorPrivate::NoSync, + "dispatchMouseEvent", + widgetId, + static_cast<int>(QEvent::MouseMove), + mapToItem(owner->display(), ev->pos() - offset).toPoint(), + static_cast<int>(Qt::NoButton), + static_cast<int>(Qt::NoButton), + static_cast<int>(ev->modifiers())); + ev->accept(); + break; + default: + break; + } } void Widget::handleMouseEvent(QEvent::Type type, QGraphicsSceneMouseEvent *ev) @@ -220,13 +267,13 @@ void Widget::handleMouseEvent(QEvent::Type type, QGraphicsSceneMouseEvent *ev) } QtSimulatorPrivate::RemoteMetacall<void>::call(owner->socket(), QtSimulatorPrivate::NoSync, - "dispatchMouseEvent", - widgetId, - static_cast<int>(type), - mapToItem(owner->display(), ev->pos() - offset).toPoint(), - static_cast<int>(ev->button()), - static_cast<int>(ev->buttons()), - static_cast<int>(ev->modifiers())); + "dispatchMouseEvent", + widgetId, + static_cast<int>(type), + mapToItem(owner->display(), ev->pos() - offset).toPoint(), + static_cast<int>(ev->button()), + static_cast<int>(ev->buttons()), + static_cast<int>(ev->modifiers())); ev->accept(); } @@ -259,6 +306,46 @@ void Widget::handleKeyEvent(QKeyEvent* ev) ev->accept(); } +void Widget::event(QEvent *e) +{ + if (e->type() == QEvent::TouchBegin + || e->type() == QEvent::TouchUpdate + || e->type() == QEvent::TouchEnd) { + QTouchEvent *ev = static_cast<QTouchEvent *>(e); + QtSimulatorPrivate::TouchEventData touchEventData; + touchEventData.type = static_cast<int>(ev->type()); + touchEventData.deviceType = static_cast<int>(ev->deviceType()); + touchEventData.modifiers = static_cast<int>(ev->modifiers()); + touchEventData.touchPointStates = static_cast<int>(ev->touchPointStates()); + foreach (const QTouchEvent::TouchPoint &tp, ev->touchPoints()) { + QtSimulatorPrivate::TouchPointData touchPoint; + touchPoint.id = tp.id(); + touchPoint.state = tp.state(); + touchPoint.rect = tp.rect(); + touchPoint.sceneRect = tp.sceneRect(); + touchPoint.screenRect = tp.screenRect(); + touchPoint.normalizedPos = tp.normalizedPos(); + touchPoint.startPos = tp.startPos(); + touchPoint.startScenePos = tp.startScenePos(); + touchPoint.startScreenPos = tp.startScreenPos(); + touchPoint.startNormalizedPos = tp.startNormalizedPos(); + touchPoint.lastPos = tp.lastPos(); + touchPoint.lastScenePos = tp.lastScenePos(); + touchPoint.lastScreenPos = tp.lastScreenPos(); + touchPoint.lastNormalizedPos = tp.lastNormalizedPos(); + touchPoint.pressure = tp.pressure(); + touchEventData.touchPoints.append(touchPoint); + } + + QtSimulatorPrivate::RemoteMetacall<void>::call(owner->socket(), QtSimulatorPrivate::NoSync, + "dispatchTouchEvent", + widgetId, + touchEventData); + ev->accept(); + } +} + + void Widget::updateOffset(const QPoint &newOffset) { if (offset != newOffset) { @@ -288,3 +375,30 @@ void Widget::setWidgetVisible(bool visible) mWidgetVisible = visible; update(); } + +void Widget::setMouseInputMode(MultiPointTouchUi::InputMode newMode) +{ + if (mFilterItem) { + removeSceneEventFilter(mFilterItem); + delete mFilterItem; + mFilterItem = 0; + } + switch (newMode) { + case MultiPointTouchUi::pinchMode: + mFilterItem = new PinchModeFilter(this); + installSceneEventFilter(mFilterItem); + break; + case MultiPointTouchUi::panMode: + mFilterItem = new PanModeFilter(this); + installSceneEventFilter(mFilterItem); + break; + case MultiPointTouchUi::swipeMode: + mFilterItem = new SwipeModeFilter(this); + installSceneEventFilter(mFilterItem); + break; + default: + break; + } + + mMouseInputMode = newMode; +} diff --git a/src/other/widget.h b/src/other/widget.h index 087a136..782adec 100644 --- a/src/other/widget.h +++ b/src/other/widget.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,14 +22,20 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ #ifndef WIDGET_H #define WIDGET_H +#include "multipointtouchui.h" + #include <QtGui/QGraphicsItem> #include <QtGui/QtEvents> @@ -37,6 +43,12 @@ class Application; class QSharedMemory; class QString; class QMenuBar; +class MouseIndicator; +class WidgetManager; +namespace QtSimulatorPrivate { +struct TouchEventData; +struct TouchPointData; +} class Widget : public QGraphicsItem { @@ -71,6 +83,9 @@ public: void setMenuBar(QMenuBar* menuBar) { mMenuBar = menuBar; } bool maemo5Stacked() { return mMaemo5Stacked; } void setMaemo5Stacked(bool stacked) { mMaemo5Stacked = stacked; } + Qt::WidgetAttribute orientation() { return mOrientation; } + void setOrientation(Qt::WidgetAttribute orientation) { mOrientation = orientation; } + void setMouseInputMode(MultiPointTouchUi::InputMode newMode); protected: virtual void mousePressEvent(QGraphicsSceneMouseEvent* ev); @@ -80,11 +95,13 @@ protected: virtual void hoverMoveEvent(QGraphicsSceneHoverEvent* ev); virtual void keyPressEvent(QKeyEvent* ev); virtual void keyReleaseEvent(QKeyEvent* ev); + virtual void event(QEvent* e); void handleMouseEvent(QEvent::Type type, QGraphicsSceneMouseEvent* ev); void handleKeyEvent(QKeyEvent* ev); private: friend class WidgetManager; + WidgetManager *mManager; friend class DisplayWidget; QSharedMemory *memory; @@ -96,10 +113,16 @@ private: bool wantsUpdate; bool memoryFilled; bool mMaemo5Stacked; + Qt::WidgetAttribute mOrientation; // can't use QGraphicsItem::isVisible because we need to support visible children of // invisible parents bool mWidgetVisible; QString mSharedMemoryName; + + //Multipoint-touch + MultiPointTouchUi::InputMode mMouseInputMode; + + QGraphicsItem *mFilterItem; }; #endif // WIDGET_H diff --git a/src/other/widgetmanager.cpp b/src/other/widgetmanager.cpp index b9e647f..51aeef2 100644 --- a/src/other/widgetmanager.cpp +++ b/src/other/widgetmanager.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ @@ -39,6 +43,7 @@ #include <QtGui/QWidget> #include <QtGui/QTableWidget> #include <QtGui/QLayout> +#include <QtGui/QGraphicsScene> namespace { int gWidgetIdCounter = 100; // 0 is the desktop. @@ -59,6 +64,7 @@ WidgetManager::WidgetManager(DisplayWidget *dw, QObject *parent) , mFocusWidget(0) , mSharedMemoryIndex(qrand()) , mSymbianSoftKeysSupported(false) + , mCurrentMouseInputMode(MultiPointTouchUi::defaultMode) { // Some client applications repaint themselves continuously and send an inordinate amount // of paint events. If we call update for every one of these, the event loop stalls on unix @@ -81,6 +87,8 @@ WidgetManager::WidgetManager(DisplayWidget *dw, QObject *parent) connect(this, SIGNAL(topWidgetChanged(Widget*)), this, SLOT(updateSymbianSoftKeys())); connect(this, SIGNAL(topWidgetChanged(Widget*)), this, SLOT(maybeFullscreen(Widget *))); connect(this, SIGNAL(topWidgetChanged(Widget*)), this, SLOT(updateMaemoNavigate(Widget*))); + connect(this, SIGNAL(topWidgetChanged(Widget*)), this, SLOT(handleTopOrientation(Widget*))); + mScriptInterface = new TouchScriptInterface(this); } WidgetManager::~WidgetManager() @@ -172,8 +180,10 @@ QtSimulatorPrivate::NewWindowInfo WidgetManager::create( geometry.size()); Widget *w = new Widget(geometry, mImageFormat, title, app, gWidgetIdCounter++, sharedMemoryName, parent); + w->mManager = this; w->setWidgetVisible(false); w->offset = mOffset; + w->setMouseInputMode(mCurrentMouseInputMode); widgets.push_front(w); setHighestZ(w); @@ -413,6 +423,14 @@ void WidgetManager::setMaemo5StackedWindowFlag(int id, bool stacked) w->setMaemo5Stacked(stacked); } +void WidgetManager::setAcceptsTouchEvents(int id, bool accept) +{ + Widget *w = widgetForId(id); + if (!w) + return; + w->setAcceptsHoverEvents(accept); +} + void WidgetManager::handleUpdateRequests() { foreach (Widget *w, widgets) { @@ -655,3 +673,160 @@ QString WidgetManager::freeSharedMemoryName() qFatal("Could not find a free shared memory area"); return QString(); } + +void WidgetManager::setOrientationAttribute(int id, int orientation, bool on) +{ + Qt::WidgetAttribute realOrientation = static_cast<Qt::WidgetAttribute>(orientation); + switch (realOrientation) { + case Qt::WA_LockLandscapeOrientation: + case Qt::WA_LockPortraitOrientation: + case Qt::WA_AutoOrientation: + break; + default: + return; + } + + Widget* w = widgetForId(id); + if (!w) + return; + if (w->orientation() == realOrientation && !on) + realOrientation = Qt::WA_AutoOrientation; + w->setOrientation(realOrientation); + if (topWidget() == w) { + emit topOrientationChanged(realOrientation); + } +} + +void WidgetManager::handleTopOrientation(Widget *topWidget) +{ + if (!topWidget) + emit topOrientationChanged(Qt::WA_AutoOrientation); + else + emit topOrientationChanged(topWidget->orientation()); +} + +void WidgetManager::setMouseInputMode(MultiPointTouchUi::InputMode newMode) +{ + mCurrentMouseInputMode = newMode; + foreach (Widget* w, widgets) + w->setMouseInputMode(newMode); +} + +TouchScriptInterface::TouchScriptInterface(WidgetManager *wm) + : QObject(wm) + , mWidgetManager(wm) +{ +} + +TouchScriptInterface::~TouchScriptInterface() +{ +} + +QtSimulatorPrivate::TouchPointData TouchScriptInterface::updateTouchPoint(const QtSimulatorPrivate::TouchPointData &touchPoint, + QEvent::Type touchType, const QPointF ¢er, const QSizeF &size) +{ + QtSimulatorPrivate::TouchPointData newTouchPoint; + DisplayWidget *displayWidget = mWidgetManager->display(); + + switch (touchType) { + case QEvent::TouchBegin: + newTouchPoint.startPos = newTouchPoint.lastPos = center; + newTouchPoint.startScenePos = newTouchPoint.lastScenePos = displayWidget->mapToScene(center); + newTouchPoint.startScreenPos = newTouchPoint.lastScreenPos = displayWidget->mapToItem(displayWidget, center); + newTouchPoint.startNormalizedPos = newTouchPoint.lastNormalizedPos = QPointF(newTouchPoint.startScreenPos.x() / displayWidget->width(), + newTouchPoint.startScreenPos.y() / displayWidget->height()); + break; + case QEvent::TouchUpdate: + newTouchPoint.startPos = touchPoint.startPos; + newTouchPoint.startScenePos = touchPoint.startScenePos; + newTouchPoint.startScreenPos = touchPoint.startScreenPos; + newTouchPoint.startNormalizedPos = touchPoint.startNormalizedPos; + newTouchPoint.lastPos = touchPoint.rect.center(); + newTouchPoint.lastScenePos = displayWidget->mapToScene(touchPoint.rect.center()); + newTouchPoint.lastScreenPos = displayWidget->mapToItem(displayWidget, touchPoint.rect.center()); + newTouchPoint.lastNormalizedPos = QPointF(newTouchPoint.lastScreenPos.x() / displayWidget->width(), + newTouchPoint.lastScreenPos.y() / displayWidget->height()); + break; + default: + return touchPoint; + } + newTouchPoint.rect = QRectF(center - QPointF(size.width() / 2, size.height() / 2), size); + newTouchPoint.sceneRect = QRectF(displayWidget->mapToScene(center - QPointF(size.width() / 2, size.height() / 2)), size); + newTouchPoint.screenRect = QRectF(displayWidget->mapToItem(displayWidget, center - QPointF(size.width() / 2, size.height() / 2)), size); + newTouchPoint.normalizedPos = QPointF((newTouchPoint.screenRect.center().x() - size.width() / 2) / displayWidget->width(), + (newTouchPoint.screenRect.center().y() - size.height() / 2) / displayWidget->height()); + + newTouchPoint.pressure = .75; + return newTouchPoint; +} + +void TouchScriptInterface::beginTouch(int id, int x, int y) +{ + fireTouchEvent(id, x, y, QEvent::TouchBegin); +} + +void TouchScriptInterface::updateTouch(int id, int x, int y) +{ + fireTouchEvent(id, x, y, QEvent::TouchUpdate); +} + +void TouchScriptInterface::endTouch(int id, int x, int y) +{ + fireTouchEvent(id, x, y, QEvent::TouchEnd); +} + +void TouchScriptInterface::fireTouchEvent(int id, int x, int y, QEvent::Type type) +{ + Widget *widget = mWidgetManager->widgetForId(mWidgetManager->widgetAt(QPoint(x, y))); + if (!widget) + return; + QtSimulatorPrivate::TouchPointData point; + int i = 0; + bool found = false; + for (;i < data.touchPoints.length(); ++i) { + if (data.touchPoints.at(i).id == id) { + found = true; + point = data.touchPoints.at(i); + break; + } + } + point = updateTouchPoint(point, type, QPointF(x, y), QSizeF(15, 15)); + point.id = id; + if (found) + data.touchPoints[i] = point; + else { + data.touchPoints.append(point); + } + data.type = static_cast<int>(type); + switch (type) { + case QEvent::TouchBegin: + data.touchPointStates = Qt::TouchPointPressed; + break; + case QEvent::TouchUpdate: + data.touchPointStates = Qt::TouchPointMoved; + break; + case QEvent::TouchEnd: + data.touchPointStates = Qt::TouchPointReleased; + data.touchPoints.takeAt(i); + break; + default: + break; + } + data.deviceType = QTouchEvent::TouchScreen; + data.modifiers = Qt::NoModifier; + QtSimulatorPrivate::RemoteMetacall<void>::call(widget->owner->socket(), + QtSimulatorPrivate::NoSync, + "dispatchTouchEvent", + widget->widgetId, + data); +} + +void WidgetManager::runCurrentGestureScript() +{ + emit gestureScriptRequested(mCurrentGesturePath); +} + +void WidgetManager::setCurrentGesturePath(const QString &path) +{ + mCurrentGesturePath = path; +} diff --git a/src/other/widgetmanager.h b/src/other/widgetmanager.h index 84131cf..d0c892b 100644 --- a/src/other/widgetmanager.h +++ b/src/other/widgetmanager.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ @@ -32,6 +36,7 @@ #include "deviceitem.h" #include "qsimulatordata_p.h" +#include "multipointtouchui.h" #include <QtGui/QImage> #include <QtCore/QObject> @@ -44,6 +49,27 @@ class QRect; class QTableWidget; class QWidget; class QMenuBar; +class WidgetManager; + +class TouchScriptInterface : public QObject { + Q_OBJECT +public: + TouchScriptInterface(WidgetManager *wm); + virtual ~TouchScriptInterface(); + + Q_INVOKABLE void beginTouch(int id, int x, int y); + Q_INVOKABLE void updateTouch(int id, int x, int y); + Q_INVOKABLE void endTouch(int id, int x, int y); + +private: + QtSimulatorPrivate::TouchPointData updateTouchPoint(const QtSimulatorPrivate::TouchPointData &touchPoint, + QEvent::Type touchType, const QPointF ¢er, + const QSizeF &size); + void fireTouchEvent(int id, int x, int y, QEvent::Type type); + + WidgetManager *mWidgetManager; + QtSimulatorPrivate::TouchEventData data; +}; class WidgetManager : public QObject { @@ -63,6 +89,7 @@ public: QtSimulatorPrivate::NewWindowInfo create( int parentWidgetId, QRect geometry, const QString &title, Application *app); + void runCurrentGestureScript(); public slots: int widgetAt(const QPoint &position) const; @@ -83,6 +110,8 @@ public slots: void setWidgetOpacity(int id, double opacity); void setWidgetParent(int id, int newParentId); void setMaemo5StackedWindowFlag(int id, bool stacked); + void setOrientationAttribute(int id, int orientation, bool on); + void setAcceptsTouchEvents(int id, bool accept); void onApplicationUnregistered(int appId); @@ -94,16 +123,23 @@ public slots: void changeOffset(const QPoint &offset); void updateSymbianSoftKeys(); + void setMouseInputMode(MultiPointTouchUi::InputMode newMode); + void setCurrentGesturePath(const QString &path); + + TouchScriptInterface *scriptInterface() const { return mScriptInterface; } private slots: void handleUpdateRequests(); void updateMaemoNavigate(Widget *topWidget); void maybeFullscreen(Widget *topWidget); + void handleTopOrientation(Widget *topWidget); signals: void topWidgetChanged(Widget *); + void topOrientationChanged(Qt::WidgetAttribute orientation); void symbianSoftKeyTextChanged(int buttonNr, QString text); void maemoNavigationChanged(MaemoNavigationMode mode); + void gestureScriptRequested(const QString &filePath); private: void updateLogItem(int id); @@ -122,6 +158,11 @@ private: QImage::Format mImageFormat; bool mSymbianSoftKeysSupported; + MultiPointTouchUi::InputMode mCurrentMouseInputMode; + + friend class TouchScriptInterface; + TouchScriptInterface *mScriptInterface; + QString mCurrentGesturePath; }; #endif diff --git a/src/shared/qtlockedfile/qtlockedfile.cpp b/src/shared/qtlockedfile/qtlockedfile.cpp index 9277510..b87eb20 100644 --- a/src/shared/qtlockedfile/qtlockedfile.cpp +++ b/src/shared/qtlockedfile/qtlockedfile.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/shared/qtlockedfile/qtlockedfile.h b/src/shared/qtlockedfile/qtlockedfile.h index 1a438e7..13b2589 100644 --- a/src/shared/qtlockedfile/qtlockedfile.h +++ b/src/shared/qtlockedfile/qtlockedfile.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/shared/qtlockedfile/qtlockedfile_unix.cpp b/src/shared/qtlockedfile/qtlockedfile_unix.cpp index 76eb151..675e3c6 100644 --- a/src/shared/qtlockedfile/qtlockedfile_unix.cpp +++ b/src/shared/qtlockedfile/qtlockedfile_unix.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/shared/qtlockedfile/qtlockedfile_win.cpp b/src/shared/qtlockedfile/qtlockedfile_win.cpp index 758055f..4d73c57 100644 --- a/src/shared/qtlockedfile/qtlockedfile_win.cpp +++ b/src/shared/qtlockedfile/qtlockedfile_win.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/shared/qtsingleapplication/qtlocalpeer.cpp b/src/shared/qtsingleapplication/qtlocalpeer.cpp index 45b130c..9dcc247 100644 --- a/src/shared/qtsingleapplication/qtlocalpeer.cpp +++ b/src/shared/qtsingleapplication/qtlocalpeer.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/shared/qtsingleapplication/qtlocalpeer.h b/src/shared/qtsingleapplication/qtlocalpeer.h index c708b9b..6665c18 100644 --- a/src/shared/qtsingleapplication/qtlocalpeer.h +++ b/src/shared/qtsingleapplication/qtlocalpeer.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/shared/qtsingleapplication/qtsingleapplication.cpp b/src/shared/qtsingleapplication/qtsingleapplication.cpp index 2032471..fc452db 100644 --- a/src/shared/qtsingleapplication/qtsingleapplication.cpp +++ b/src/shared/qtsingleapplication/qtsingleapplication.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,17 +22,30 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ #include "qtsingleapplication.h" #include "qtlocalpeer.h" +#ifdef Q_OS_WIN +#include <Windows.h> +#endif + #include <QtGui/QWidget> #include <QtGui/QFileOpenEvent> +#if defined(Q_WS_X11) +#include <private/qt_x11_p.h> +#include <QtGui/QX11Info> +#endif + namespace SharedTools { void QtSingleApplication::sysInit(const QString &appId) @@ -128,13 +141,36 @@ QWidget* QtSingleApplication::activationWindow() const return actWin; } - void QtSingleApplication::activateWindow() { if (actWin) { actWin->setWindowState(actWin->windowState() & ~Qt::WindowMinimized); actWin->raise(); actWin->activateWindow(); +#ifdef Q_OS_WIN + WId winId = actWin->winId(); + DWORD foregroundPId = GetWindowThreadProcessId(GetForegroundWindow(), NULL); + DWORD myPId = GetWindowThreadProcessId(winId, NULL); + if (foregroundPId != myPId) { + AttachThreadInput(foregroundPId, myPId, true); + BringWindowToTop(winId); + AttachThreadInput(foregroundPId, myPId, false); + } +#elif defined(Q_WS_X11) + XEvent xev; + xev.xclient.type = ClientMessage; + xev.xclient.message_type = ATOM(_NET_ACTIVE_WINDOW); + xev.xclient.display = X11->display; + xev.xclient.window = actWin->winId(); + xev.xclient.format = 32; + xev.xclient.data.l[0] = 2; // from pager/user + xev.xclient.data.l[1] = X11->time; + xev.xclient.data.l[2] = 0; // currently active window + xev.xclient.data.l[3] = 0; // unused + xev.xclient.data.l[4] = 0; // unused + XSendEvent(X11->display, QX11Info::appRootWindow(actWin->x11Info().screen()), False, + SubstructureRedirectMask | SubstructureNotifyMask, &xev); +#endif } } diff --git a/src/shared/qtsingleapplication/qtsingleapplication.h b/src/shared/qtsingleapplication/qtsingleapplication.h index 0fbd77b..b3da641 100644 --- a/src/shared/qtsingleapplication/qtsingleapplication.h +++ b/src/shared/qtsingleapplication/qtsingleapplication.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ @@ -45,6 +49,7 @@ public: QtSingleApplication(Display *dpy, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0); QtSingleApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0); #endif + static QtSingleApplication *instance() { return qobject_cast<QtSingleApplication *>(qApp); } bool isRunning(); QString id() const; diff --git a/src/shared/qtsingleapplication/qtsinglecoreapplication.cpp b/src/shared/qtsingleapplication/qtsinglecoreapplication.cpp index 5cbb606..13ebae5 100644 --- a/src/shared/qtsingleapplication/qtsinglecoreapplication.cpp +++ b/src/shared/qtsingleapplication/qtsinglecoreapplication.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/shared/qtsingleapplication/qtsinglecoreapplication.h b/src/shared/qtsingleapplication/qtsinglecoreapplication.h index 275c520..71005d5 100644 --- a/src/shared/qtsingleapplication/qtsinglecoreapplication.h +++ b/src/shared/qtsingleapplication/qtsinglecoreapplication.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/src.pri b/src/src.pri index b910ff6..3458f7f 100644 --- a/src/src.pri +++ b/src/src.pri @@ -30,6 +30,7 @@ INCLUDEPATH += \ $$QT_MOBILITY_SOURCE_PATH/src/multimedia \ $$QT_MOBILITY_SOURCE_PATH/src/organizer \ $$QT_MOBILITY_SOURCE_PATH/src/feedback \ + $$QT_MOBILITY_SOURCE_PATH/src/connectivity/nfc \ $$QT_MOBILITY_SOURCE_PATH/plugins/sensors/simulator \ $$QT_MOBILITY_SOURCE_PATH/plugins/organizer/simulator \ $$QT_MOBILITY_SOURCE_PATH/plugins/feedback/simulator @@ -41,7 +42,8 @@ SOURCES += $$QT_MOBILITY_SOURCE_PATH/src/systeminfo/qsysteminfodata_simulator.cp $$QT_MOBILITY_SOURCE_PATH/plugins/organizer/simulator/qorganizerdata_simulator.cpp \ $$QT_MOBILITY_SOURCE_PATH/plugins/feedback/simulator/qfeedbackdata_simulator.cpp \ $$QT_MOBILITY_SOURCE_PATH/src/gallery/simulator/docgallerysimulatordata.cpp \ - $$QT_MOBILITY_SOURCE_PATH/plugins/multimedia/simulator/qsimulatormultimediadata.cpp + $$QT_MOBILITY_SOURCE_PATH/plugins/multimedia/simulator/qsimulatormultimediadata.cpp \ + $$QT_MOBILITY_SOURCE_PATH/src/connectivity/nfc/targetemulator.cpp HEADERS += $$QT_MOBILITY_SOURCE_PATH/src/systeminfo/qsysteminfodata_simulator_p.h \ $$QT_MOBILITY_SOURCE_PATH/src/location/qlocationdata_simulator_p.h \ $$QT_MOBILITY_SOURCE_PATH/src/contacts/engines/qcontactmemorybackenddata_simulator_p.h \ @@ -49,7 +51,8 @@ HEADERS += $$QT_MOBILITY_SOURCE_PATH/src/systeminfo/qsysteminfodata_simulator_p. $$QT_MOBILITY_SOURCE_PATH/plugins/organizer/simulator/qorganizerdata_simulator_p.h \ $$QT_MOBILITY_SOURCE_PATH/plugins/feedback/simulator/qfeedbackdata_simulator_p.h \ $$QT_MOBILITY_SOURCE_PATH/src/gallery/simulator/docgallerysimulatordata.h \ - $$QT_MOBILITY_SOURCE_PATH/plugins/multimedia/simulator/qsimulatormultimediadata_p.h + $$QT_MOBILITY_SOURCE_PATH/plugins/multimedia/simulator/qsimulatormultimediadata_p.h \ + $$QT_MOBILITY_SOURCE_PATH/src/connectivity/nfc/targetemulator_p.h OTHER_FILES += \ $$QT_MOBILITY_SOURCE_PATH/src/mobilitysimulator/mobilityconnection.cpp \ diff --git a/src/ui/accelerometercontrol.cpp b/src/ui/accelerometercontrol.cpp index 3f5ea8f..b9ebb97 100644 --- a/src/ui/accelerometercontrol.cpp +++ b/src/ui/accelerometercontrol.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ @@ -41,9 +45,16 @@ static QVector3D accelerometerY(0, 1, 0); static QVector3D accelerometerZ(0, 0, -1); static QVector3D unrotatedGravity(0, 1, 0); +static const double kEarthGravity = 9.8; +static const double kEarthMagneticFieldStrength = 30; +static const double kZero = 1e-4; + AccelerometerControl::AccelerometerControl(QWidget *parent) - : QGLWidget(parent), mGravity(9.8) + : QGLWidget(parent), mGravity(kEarthGravity), mMagneticFieldStrength(kEarthMagneticFieldStrength) { + QMatrix4x4 qtMatrix; + qtMatrix.rotate(90, QVector3D(1, 0, 0)); // angle down to point at the horizon + mNorthVector = qtMatrix.map(unrotatedGravity); // give us a vector that represents where North is } void AccelerometerControl::setValue(const QVector3D &newValue) @@ -59,12 +70,16 @@ void AccelerometerControl::setValue(const QVector3D &newValue) mRotation = QQuaternion(); } else if(dot < -0.999) { mRotation = QQuaternion::fromAxisAndAngle(0, 0, 1, 180); + } else if (target.z() == -1) { + // special case for face down (mirror of face up, not with the top pointing down) + mRotation = QQuaternion(0.0, 0.0, -0.707107, -0.707107); } else { // we want the quaternion that transforms target into up QVector3D cross = QVector3D::crossProduct(target, accelerometerY); mRotation = QQuaternion::fromAxisAndAngle(cross, qAcos(dot) * 180 / M_PI); } + updateAzimuth(); updateGL(); } @@ -73,32 +88,30 @@ void AccelerometerControl::initializeGL() glEnable(GL_DEPTH_TEST); glEnable(GL_TEXTURE_2D); - QDir n8ModelDir(QCoreApplication::applicationDirPath()); - n8ModelDir.cd("models/symbian3"); - QImage frontImg(n8ModelDir.absoluteFilePath("N8_3D_front.png")); - QImage backImg(n8ModelDir.absoluteFilePath("N8_3D_back.png")); - QImage rightImg(n8ModelDir.absoluteFilePath("N8_3D_right.png")); - QImage topImg(n8ModelDir.absoluteFilePath("N8_3D_top.png")); - QImage bottomImg(n8ModelDir.absoluteFilePath("N8_3D_bottom.png")); + QImage frontImg(":ui/textures/N8_3D_front.png"); + QImage backImg(":ui/textures/N8_3D_back.png"); + QImage rightImg(":ui/textures/N8_3D_right.png"); + QImage topImg(":ui/textures/N8_3D_top.png"); + QImage bottomImg(":ui/textures/N8_3D_bottom.png"); mFrontPortraitTexture = bindTexture(frontImg); mBackPortraitTexture = bindTexture(backImg); mLeftPortraitTexture = bindTexture(rightImg); mRightPortraitTexture = bindTexture(rightImg); mTopPortraitTexture = bindTexture(topImg); mBottomPortraitTexture = bindTexture(bottomImg); - QDir n900ModelDir(QCoreApplication::applicationDirPath()); - n900ModelDir.cd("models/maemoFremantle"); - frontImg = QImage(n900ModelDir.absoluteFilePath("N900.png")); - backImg = QImage(n900ModelDir.absoluteFilePath("N900_back.png")); - rightImg = QImage(n900ModelDir.absoluteFilePath("N900_left.png")); - topImg = QImage(n900ModelDir.absoluteFilePath("N900_top.png")); - bottomImg = QImage(n900ModelDir.absoluteFilePath("N900_top.png")); + frontImg = QImage(":ui/textures/N900_front.png"); + backImg = QImage(":ui/textures/N900_back.png"); + rightImg = QImage(":ui/textures/N900_left.png"); + topImg = QImage(":ui/textures/N900_top.png"); + bottomImg = QImage(":ui/textures/N900_top.png"); mFrontLandscapeTexture = bindTexture(frontImg); mBackLandscapeTexture = bindTexture(backImg); mLeftLandscapeTexture = bindTexture(rightImg); mRightLandscapeTexture = bindTexture(rightImg); mTopLandscapeTexture = bindTexture(topImg); mBottomLandscapeTexture = bindTexture(topImg); + QImage northImg(":ui/icons/north.png"); + mNorthTexture = bindTexture(northImg); } void AccelerometerControl::resizeGL(int w, int h) @@ -207,25 +220,30 @@ void AccelerometerControl::drawMobile() glBindTexture(GL_TEXTURE_2D, mFrontTexture); glBegin(GL_QUADS); glColor3f(1, 1, 1); - glTexCoord2f(1, 0); + glTexCoord2f(0, 0); glVertex3f(-width, -height, -depth); - glTexCoord2f(1, 1); - glVertex3f(-width, height, -depth); glTexCoord2f(0, 1); + glVertex3f(-width, height, -depth); + glTexCoord2f(1, 1); glVertex3f(width, height, -depth); - glTexCoord2f(0, 0); + glTexCoord2f(1, 0); glVertex3f(width, -height, -depth); glEnd(); } -static void drawGround() +void AccelerometerControl::drawGround() { + glBindTexture(GL_TEXTURE_2D, mNorthTexture); glBegin(GL_QUADS); glColor3d(0.3, 0.3, 0.3); qreal extends = 1.5; + glTexCoord2f(0, 0); glVertex3f(-extends, -1, -extends); + glTexCoord2f(0, 1); glVertex3f(-extends, -1, extends); + glTexCoord2f(1, 1); glVertex3f(extends, -1, extends); + glTexCoord2f(1, 0); glVertex3f(extends, -1, -extends); glEnd(); } @@ -269,6 +287,7 @@ void AccelerometerControl::mouseMoveEvent(QMouseEvent *event) mOldMousePosition = event->pos(); emit valueChanged(value()); + updateAzimuth(); updateGL(); } @@ -304,7 +323,60 @@ QVector3D AccelerometerControl::value() const newValue.setX(QVector3D::dotProduct(mRotation.conjugate().rotatedVector(accelerometerX), unrotatedGravity)); newValue.setY(QVector3D::dotProduct(mRotation.conjugate().rotatedVector(accelerometerY), unrotatedGravity)); newValue.setZ(QVector3D::dotProduct(mRotation.conjugate().rotatedVector(accelerometerZ), unrotatedGravity)); + // remove rounding errors + if (qAbs(newValue.x()) < kZero) newValue.setX(0); + if (qAbs(newValue.y()) < kZero) newValue.setY(0); + if (qAbs(newValue.z()) < kZero) newValue.setZ(0); newValue *= mGravity; + return newValue; +} + +void AccelerometerControl::updateAzimuth() +{ + emit magneticFieldChanged(magneticField()); + emit azimuthChanged(azimuth()); +} + +qreal AccelerometerControl::azimuth() const +{ + // Generate an azimuth value based on the position + QVector3D grav = value(); + QVector3D mag = magneticField(); + QVector3D dev = mRotation.vector().normalized(); + qreal heading; + if (grav.z() > 0) { + // Face up + heading = (1 - qAbs(dev.x())) * 180; + // correct for 360 degrees of rotation + if (mag.x() < 0) heading = 360 - heading; + // rotate in the correct direction! + heading = 360 - heading; + } else { + // Face down + heading = qAbs(dev.x()) * 180; + // correct for 360 degrees of rotation + if (mag.x() < 0) heading = 360 - heading; + } + // May be too big + while (heading > 360) heading -= 360; + // report 360 as 0 + if (heading == 360) heading = 0; + // report tiny numbers as 0 + if (heading < kZero) heading = 0; + return heading; +} +QVector3D AccelerometerControl::magneticField() const +{ + QVector3D newValue; + newValue.setX(QVector3D::dotProduct(mRotation.conjugate().rotatedVector(accelerometerX), mNorthVector)); + newValue.setY(QVector3D::dotProduct(mRotation.conjugate().rotatedVector(accelerometerY), mNorthVector)); + newValue.setZ(QVector3D::dotProduct(mRotation.conjugate().rotatedVector(accelerometerZ), mNorthVector)); + // remove rounding errors + if (qAbs(newValue.x()) < kZero) newValue.setX(0); + if (qAbs(newValue.y()) < kZero) newValue.setY(0); + if (qAbs(newValue.z()) < kZero) newValue.setZ(0); + newValue *= mMagneticFieldStrength; return newValue; } + diff --git a/src/ui/accelerometercontrol.h b/src/ui/accelerometercontrol.h index ff0631c..591cbd5 100644 --- a/src/ui/accelerometercontrol.h +++ b/src/ui/accelerometercontrol.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ @@ -43,8 +47,13 @@ public: void setDeviceOrientation(bool portrait); QVector3D value() const; + QVector3D magneticField() const; + double azimuth() const; + signals: void valueChanged(const QVector3D &value); + void magneticFieldChanged(const QVector3D &value); + void azimuthChanged(double azimuth); public slots: void setValue(const QVector3D &value); @@ -59,12 +68,17 @@ protected: private: void drawMobile(); + void drawGround(); + void updateAzimuth(); private: QPoint mOldMousePosition; QQuaternion mRotation; qreal mGravity; bool mDefaultPortrait; + QVector3D mNorthVector; + double mMagneticFieldStrength; + double mAzimuth; GLuint mFrontTexture; GLuint mBackTexture; @@ -72,6 +86,7 @@ private: GLuint mRightTexture; GLuint mTopTexture; GLuint mBottomTexture; + GLuint mNorthTexture; GLuint mFrontPortraitTexture; GLuint mBackPortraitTexture; diff --git a/src/ui/applicationtablewidget.cpp b/src/ui/applicationtablewidget.cpp index d607021..898dffc 100644 --- a/src/ui/applicationtablewidget.cpp +++ b/src/ui/applicationtablewidget.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/ui/applicationtablewidget.h b/src/ui/applicationtablewidget.h index 1953b42..935785a 100644 --- a/src/ui/applicationtablewidget.h +++ b/src/ui/applicationtablewidget.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/ui/applicationui.cpp b/src/ui/applicationui.cpp new file mode 100644 index 0000000..316b323 --- /dev/null +++ b/src/ui/applicationui.cpp @@ -0,0 +1,99 @@ +/************************************************************************** +** +** This file is part of Qt Simulator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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. +** +**************************************************************************/ + +#include "applicationui.h" + +#include <remotecontrolwidget/optionsitem.h> +#include <QtGui/QLineEdit> +#include <QtGui/QHBoxLayout> +#include <QtGui/QPushButton> +#include <QtGui/QMenuBar> +#include "widget.h" + +ApplicationUi::ApplicationUi(QWidget *parent) : + ToolBoxPage(parent) +{ + QStringList tags; + QList<OptionsItem *> optionsList; + OptionsItem *item; + + mWidgetTitle = new QLineEdit(); + mWidgetTitle->setReadOnly(true); + item = new OptionsItem(tr("Topmost widget's title"), mWidgetTitle); + item->setTags(QStringList() << "topmost" << "wigdet" << "title"); + optionsList << item; + + QWidget *widget = new QWidget; + mMenuLayout = new QHBoxLayout(); + widget->setLayout(mMenuLayout); + item = new OptionsItem(tr("Application's menubar"), widget); + item->setTags(QStringList() << "menubar"); + optionsList << item; + + QPushButton *exitButton = new QPushButton(tr("Quit")); + item->setTags(QStringList() << "quit"); + item = new OptionsItem(tr("Quit current application"), exitButton); + optionsList << item; + + connect(exitButton, SIGNAL(clicked()), SIGNAL(exitButtonClicked())); + + setTitle(tr("Application")); + setOptions(optionsList); +} + +void ApplicationUi::updateMenuBarWidget(Widget *menuBarWidget) +{ + QMenuBar *menuBar = 0; + if (menuBarWidget) { + menuBar = menuBarWidget->menuBar(); + mWidgetTitle->setText(menuBarWidget->title); + } else { + mWidgetTitle->setText(QString()); + } + + if (mMenuBar == menuBar) + return; + + if (mMenuBar) { + mMenuBar->hide(); + mMenuLayout->removeWidget(mMenuBar); + } + + mMenuBar = menuBar; + if (!menuBar) + return; + + mMenuLayout->insertWidget(0, mMenuBar); + mMenuBar->show(); +} + diff --git a/src/ui/applicationui.h b/src/ui/applicationui.h new file mode 100644 index 0000000..1785f2f --- /dev/null +++ b/src/ui/applicationui.h @@ -0,0 +1,65 @@ +/************************************************************************** +** +** This file is part of Qt Simulator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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. +** +**************************************************************************/ + +#ifndef APPLICATIONUI_H +#define APPLICATIONUI_H + +#include <remotecontrolwidget/toolbox.h> +#include <QtCore/QPointer> + +class QLineEdit; +class QHBoxLayout; +class Widget; +class QMenuBar; + +class ApplicationUi : public ToolBoxPage +{ + Q_OBJECT +public: + explicit ApplicationUi(QWidget *parent = 0); + +public slots: + void updateMenuBarWidget(Widget *menuBarWidget); + +signals: + void exitButtonClicked(); + +private: + QLineEdit *mWidgetTitle; + QHBoxLayout *mMenuLayout; + QPointer<QMenuBar> mMenuBar; + + +}; + +#endif // APPLICATIONUI_H diff --git a/src/ui/cameraui.cpp b/src/ui/cameraui.cpp index fe65ee5..1aa127c 100644 --- a/src/ui/cameraui.cpp +++ b/src/ui/cameraui.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,13 +22,18 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ #include "cameraui.h" #include "configurationwidget.h" +#include <remotecontrolwidget/optionsitem.h> #include <QtCore/QMetaEnum> #include <QtGui/QComboBox> diff --git a/src/ui/cameraui.h b/src/ui/cameraui.h index d2f64bf..38cf177 100644 --- a/src/ui/cameraui.h +++ b/src/ui/cameraui.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ @@ -35,7 +39,6 @@ #include <remotecontrolwidget/toolbox.h> -class ConfigurationWidget; class QComboBox; class QLineEdit; class QPushButton; diff --git a/src/ui/configurationwidget.cpp b/src/ui/configurationwidget.cpp index 12c094a..f82519f 100644 --- a/src/ui/configurationwidget.cpp +++ b/src/ui/configurationwidget.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,531 +22,31 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ #include "configurationwidget.h" -#include "ui_inspector.h" -#include "configurationreader.h" -#include "qsimulatordata_p.h" -#include "viewconfiguration.h" -#include "widget.h" -#include "application.h" -#include "deviceitem.h" - -#include <qmath.h> -#include <QtCore/QSettings> -#include <QtCore/QThread> -#include <QtCore/QDir> -#include <QtCore/QMetaEnum> -#include <QtGui/QDesktopWidget> -#include <QtGui/QScrollBar> -#include <QtGui/QMessageBox> -#include <QtGui/QToolButton> #include <QtGui/QCloseEvent> -#include <QtGui/QMenuBar> -#include <QtGui/QPushButton> - -Q_DECLARE_METATYPE(Orientation); -ConfigurationWidget::ConfigurationWidget(const DeviceItem *deviceItem, QWidget *parent) +ConfigurationWidget::ConfigurationWidget(QWidget *parent) : RemoteControlWidget(parent) - , ui_inspector(new Ui_Inspector) - , mCorrectionFactor(1) - , mViewConfiguration(0) - , mDeviceItem(deviceItem) { - qRegisterMetaType<Orientation>(); - - QDesktopWidget *desktop = QApplication::desktop(); - mLogicalDpi.setWidth(desktop->logicalDpiX()); - mLogicalDpi.setHeight(desktop->logicalDpiY()); - setWindowTitle(tr("Qt Simulator Control")); - - mScriptInterface = new SimulatorScriptInterface(this); - - initializeApplicationArea(); - initializeViewArea(); } ConfigurationWidget::~ConfigurationWidget() { } -void ConfigurationWidget::initializeViewArea() -{ - QWidget *target = new QWidget(); - ui_inspector->setupUi(target); - - mOrientationButtons = new QButtonGroup; - mOrientationButtons->setParent(ui_inspector->topUp->parent()); - mOrientationButtons->addButton(ui_inspector->topUp, static_cast<int>(topUp)); - mOrientationButtons->addButton(ui_inspector->rightUp, static_cast<int>(rightUp)); - mOrientationButtons->addButton(ui_inspector->topDown, static_cast<int>(topDown)); - mOrientationButtons->addButton(ui_inspector->leftUp, static_cast<int>(leftUp)); - connect(mOrientationButtons, SIGNAL(buttonClicked(int)), this, SLOT(changeOrientation(int))); - - updateOrientationsButtonsIcons(false); - - connect(ui_inspector->scaleSlider, SIGNAL(valueChanged(int)), this, SLOT(changeScaleFactor(int))); - connect(ui_inspector->deviceListView, SIGNAL(currentIndexChanged(int)), this, SLOT(changeDeviceSelection(int))); - - connect(ui_inspector->rotateScreen, SIGNAL(toggled(bool)), - this, SLOT(rotateScreenToggled())); - - mViewPage = new PageWidget(tr("View"), target); - mViewPage->setHideable(true); - mViewPage->setHasAdvancedButton(true); - mViewPage->advancedButton()->setToolTip(tr("Configure DPI correction")); - - connect(mViewPage, SIGNAL(advancedButtonClicked()), SLOT(showViewConfiguration())); - addPage(mViewPage); -} - -void ConfigurationWidget::initializeApplicationArea() -{ - QWidget *target = new QWidget(); - QFormLayout *innerLayout = new QFormLayout(); - mWidgetTitle = new QLineEdit(); - mWidgetTitle->setReadOnly(true); - innerLayout->addRow(tr("Topmost widget's title"), mWidgetTitle); - mMenuLayout = new QHBoxLayout(); - innerLayout->addRow(tr("Application's menubar"), mMenuLayout); - QPushButton *exitButton = new QPushButton(tr("Quit")); - connect(exitButton, SIGNAL(clicked()), SIGNAL(exitButtonClicked())); - innerLayout->addRow(tr("Quit current application"), exitButton); - target->setLayout(innerLayout); - - mAppPage = new PageWidget(tr("Application"), target); - mAppPage->setHideable(true); - mAppPage->hideContent(); - addPage(mAppPage); -} - -int ConfigurationWidget::currentDeviceIndex() const -{ - return ui_inspector->deviceListView->currentIndex(); -} - -QString ConfigurationWidget::currentDeviceName() const -{ - return ui_inspector->deviceListView->currentText(); -} - -void ConfigurationWidget::changeDeviceSelection(int newIndex) -{ - ui_inspector->deviceListView->setCurrentIndex(newIndex); - const DeviceData &newData = deviceList.at(newIndex); - emit deviceSelectionChanged(newData); - updateOrientationButtons(newData); - changeScaleFactor(ui_inspector->scaleSlider->value()); -} - -void ConfigurationWidget::updateMenuBarWidget(Widget *menuBarWidget) -{ - QMenuBar *menuBar = 0; - if (menuBarWidget) { - menuBar = menuBarWidget->menuBar(); - mWidgetTitle->setText(menuBarWidget->title); - } else { - mWidgetTitle->setText(QString()); - } - - if (mMenuBar == menuBar) - return; - - if (mMenuBar) { - mMenuBar->hide(); - mMenuLayout->removeWidget(mMenuBar); - } - - mMenuBar = menuBar; - if (!menuBar) - return; - - mMenuLayout->insertWidget(0, mMenuBar); - mMenuBar->show(); -} - -void ConfigurationWidget::updateOrientationButtonsState(Orientation orientation) -{ - mOrientationButtons->button(orientation)->setChecked(true); -} - -void ConfigurationWidget::updateOrientationsButtonsIcons(bool standardOrientationPortrait) -{ - if (standardOrientationPortrait) { - ui_inspector->topUp->setIcon(QIcon(":/ui/icons/topup.png")); - ui_inspector->topDown->setIcon(QIcon(":/ui/icons/topdown.png")); - ui_inspector->leftUp->setIcon(QIcon(":/ui/icons/leftup.png")); - ui_inspector->rightUp->setIcon(QIcon(":/ui/icons/rightup.png")); - } else { - ui_inspector->topUp->setIcon(QIcon(":/ui/icons/topup_landscape.png")); - ui_inspector->topDown->setIcon(QIcon(":/ui/icons/topdown_landscape.png")); - ui_inspector->leftUp->setIcon(QIcon(":/ui/icons/leftup_landscape.png")); - ui_inspector->rightUp->setIcon(QIcon(":/ui/icons/rightup_landscape.png")); - } -} - -void ConfigurationWidget::updateOrientationButtons(const DeviceData &data) -{ - const bool rotateScreen = ui_inspector->rotateScreen->isChecked(); - - // workaround for calling this from another thread (scripts): - // always perform the setEnabled calls in the gui thread - - // setEnabled calls sendEvent! - QMetaObject::invokeMethod(this, "enableRotationButtons", Qt::QueuedConnection, - Q_ARG(bool, rotateScreen), Q_ARG(int, data.supportedOrientations)); - - if (!mOrientationButtons->checkedButton()->isEnabled() && !data.menus.isEmpty()) { - Orientation fallback = data.menus.begin().key(); - if (data.supportedOrientations & fallback) - mOrientationButtons->button(fallback)->click(); - } -} - -void ConfigurationWidget::rotateScreenToggled() -{ - updateOrientationButtons(deviceList.at(currentDeviceIndex())); - - emit orientationChangeRequested(static_cast<Orientation>(mOrientationButtons->checkedId()), - ui_inspector->rotateScreen->isChecked()); -} - -void ConfigurationWidget::initializeSelection() -{ - if (deviceList.count() == 0) - return; - - ui_inspector->deviceListView->setCurrentIndex(0); - changeDeviceSelection(0); -} - -void ConfigurationWidget::changeScaleFactor(int sliderPosition) -{ - int index = currentDeviceIndex(); - if (index < 0 || index >= deviceList.size()) - return; - - const DeviceData &data = deviceList.at(index); - qreal pixelDiagonal = sqrt(pow((qreal)data.resolution.width(), 2) + pow((qreal)data.resolution.height(), 2)); - qreal displayWidthInInch = data.diagonalInInch / pixelDiagonal * data.resolution.width(); - - qreal minimalScale = mLogicalDpi.width() * displayWidthInInch / data.resolution.width() * mCorrectionFactor; - - emit scaleFactorChanged((minimalScale + qreal(sliderPosition) / 100. * (1. - minimalScale))); -} - -void ConfigurationWidget::changeCorrectionFactor(qreal newFactor) -{ - mCorrectionFactor = newFactor; - changeScaleFactor(ui_inspector->scaleSlider->value()); -} - void ConfigurationWidget::closeEvent(QCloseEvent *event) { event->ignore(); emit closeMainWindow(); } -void ConfigurationWidget::writeSettings(const QString &vendor, const QString &name) const -{ - RemoteControlWidget::writeSettings(vendor, name); - - QSettings settings(vendor, name); - - settings.beginGroup("ConfigurationWidget"); - settings.setValue("scale", ui_inspector->scaleSlider->value()); - settings.setValue("corrfactor", mCorrectionFactor); - settings.setValue("viewPageVisible", mViewPage->isContentVisible()); - settings.setValue("appPageVisible", mAppPage->isContentVisible()); - settings.setValue("rotateScreen", ui_inspector->rotateScreen->isChecked()); - - int index = currentDeviceIndex(); - if (index >= 0 && index < deviceList.size()) - settings.setValue("device", deviceList.at(index).name); - - settings.endGroup(); -} - -void ConfigurationWidget::readSettings(const QString &vendor, const QString &name) -{ - RemoteControlWidget::readSettings(vendor, name); - - QSettings settings(vendor, name); - - settings.beginGroup("ConfigurationWidget"); - - bool deviceFound = false; - if (settings.contains("device")) { - QString deviceName = settings.value("device").toString(); - for (int i = 0; i < deviceList.size(); ++i) { - if (deviceList.at(i).name == deviceName) { - ui_inspector->deviceListView->setCurrentIndex(i); - changeDeviceSelection(i); - deviceFound = true; - break; - } - } - } - if (!deviceFound) - initializeSelection(); - - if (settings.contains("scale")) - ui_inspector->scaleSlider->setValue(settings.value("scale").toInt()); - if (settings.contains("corrfactor")) { - changeCorrectionFactor(settings.value("corrfactor").toDouble()); - } - if (settings.contains("viewPageVisible")) { - bool viewPageVisible = settings.value("viewPageVisible").toBool(); - if (viewPageVisible) - mViewPage->showContent(); - else - mViewPage->hideContent(); - } - if (settings.contains("appPageVisible")) { - bool appPageVisible = settings.value("appPageVisible").toBool(); - if (appPageVisible) - mAppPage->showContent(); - else - mAppPage->hideContent(); - } - if (settings.contains("rotateScreen")) - ui_inspector->rotateScreen->setChecked(settings.value("rotateScreen").toBool()); - - settings.endGroup(); -} - -void ConfigurationWidget::showViewConfiguration() -{ - if (!mViewConfiguration) { - mViewConfiguration = new ViewConfiguration(mCorrectionFactor, this); - connect(mViewConfiguration, SIGNAL(correctionFactorChanged(qreal)), SLOT(changeCorrectionFactor(qreal))); - } - - mViewConfiguration->exec(); - -} - -void ConfigurationWidget::changeOrientation(int orientation) -{ - emit orientationChangeRequested(static_cast<Orientation>(orientation), ui_inspector->rotateScreen->isChecked()); -} - -bool ConfigurationWidget::initializeDeviceList() -{ - QDir modelsDir("models"); - if (!modelsDir.exists()) { - QMessageBox errorMsg; - errorMsg.setWindowTitle(tr("Folder does not exist")); - errorMsg.setText(tr("The \"%1\" folder could not be located in the installation directory.").arg(modelsDir.dirName())); - errorMsg.setIcon(QMessageBox::Critical); - errorMsg.exec(); - return false; - } - - ConfigurationReader confReader; - deviceList.clear(); - bool noErrors = confReader.processDir(&modelsDir, deviceList); - if (!noErrors && !deviceList.isEmpty()) { - QMessageBox msgbox; - msgbox.setWindowTitle(tr("Errors occurred while reading device configurations")); - msgbox.setText(confReader.errorMessageLines()); - msgbox.setIcon(QMessageBox::Critical); - msgbox.exec(); - } - - if (deviceList.isEmpty()) { - QMessageBox errorMsg; - errorMsg.setWindowTitle(tr("Devices could not be found")); - QString msg; - if (!noErrors) { - msg = confReader.errorMessageLines(); - } - msg += tr("No valid device configuration files (.config) could be found in the \"%1\" folder.").arg(modelsDir.dirName()); - errorMsg.setText(msg); - errorMsg.setIcon(QMessageBox::Critical); - errorMsg.exec(); - return false; - } - - foreach (const DeviceData &data, deviceList) - ui_inspector->deviceListView->addItem(data.name); - return true; -} - -SimulatorScriptInterface *ConfigurationWidget::scriptInterface() -{ - return mScriptInterface; -} - -SimulatorScriptInterface::SimulatorScriptInterface(ConfigurationWidget *ui) - : QObject(ui), ui(ui) -{ - int enumIndex = metaObject()->indexOfEnumerator("Orientation"); - QMetaEnum metaEnum = metaObject()->enumerator(enumIndex); - for (int i = 0; i < metaEnum.keyCount(); ++i) - setProperty(metaEnum.key(i), metaEnum.key(i)); -} - -SimulatorScriptInterface::~SimulatorScriptInterface() -{ -} - -/*! - \class SimulatorScriptInterface - \brief Exposed as simulator. -*/ - -/*! - \property SimulatorScriptInterface::zoom - - \brief the device scaling - - The value can be between between 0 for real-world size and 100 for pixel equivalence. - -*/ -int SimulatorScriptInterface::zoom() const -{ - return ui->ui_inspector->scaleSlider->value(); -} - -void SimulatorScriptInterface::setZoom(int z) -{ - if (z < 0) - z = 0; - else if (z > 100) - z = 100; - ui->ui_inspector->scaleSlider->setValue(z); -} - -/*! - Returns the index of the current device. - - \sa setDevice(), deviceCount() -*/ -int SimulatorScriptInterface::currentDeviceIndex() const -{ - return ui->currentDeviceIndex(); -} - -/*! - Returns the name of the current device. - - \sa setDevice() -*/ -QString SimulatorScriptInterface::currentDeviceName() const -{ - return ui->currentDeviceName(); -} - -/*! - Returns the number of available device models. - - \sa setDevice(), currentDeviceIndex() -*/ -int SimulatorScriptInterface::deviceCount() const -{ - return ui->deviceList.size(); -} - -/*! - Sets the current device to the one with \a index. - - \sa deviceCount(), currentDeviceIndex() -*/ -void SimulatorScriptInterface::setDevice(int index) -{ - ui->changeDeviceSelection(index); -} - -/*! - Sets the current device to be the one identified by \a dev. - - \sa currentDeviceName() -*/ -void SimulatorScriptInterface::setDevice(const QString &dev) -{ - const QList<DeviceData> &devices = ui->deviceList; - for (int i = 0; i < devices.size(); ++i) { - if (devices.at(i).name == dev) { - ui->changeDeviceSelection(i); - break; - } - } -} - -/*! - Rotates the current device, and - optionally - the screen. Returns true on success. -*/ -bool SimulatorScriptInterface::setDeviceOrientation(QString newOrientation, bool rotateScreen) -{ - const int enumIndex = metaObject()->indexOfEnumerator("Orientation"); - const QMetaEnum metaEnum = metaObject()->enumerator(enumIndex); - - int orientation = metaEnum.keyToValue(newOrientation.toLatin1()); - - if (QAbstractButton *button = ui->mOrientationButtons->button(orientation)) { - ui->ui_inspector->rotateScreen->setChecked(rotateScreen); - if (!button->isEnabled()) - return false; - button->click(); - return true; - } - return false; -} - -/*! - Returns the current device orientation. -*/ -QString SimulatorScriptInterface::deviceOrientation() const -{ - const int enumIndex = metaObject()->indexOfEnumerator("Orientation"); - const QMetaEnum metaEnum = metaObject()->enumerator(enumIndex); - - return metaEnum.valueToKey(ui->mDeviceItem->deviceOrientation()); -} - -/*! - Returns the current screen orientation. -*/ -QString SimulatorScriptInterface::screenOrientation() const -{ - const int enumIndex = metaObject()->indexOfEnumerator("Orientation"); - const QMetaEnum metaEnum = metaObject()->enumerator(enumIndex); - - return metaEnum.valueToKey(ui->mDeviceItem->screenOrientation()); -} - -/*! - Returns the list of screen orientations. -*/ -QStringList SimulatorScriptInterface::supportedScreenOrientations() const -{ - const int enumIndex = metaObject()->indexOfEnumerator("Orientation"); - const QMetaEnum metaEnum = metaObject()->enumerator(enumIndex); - - QStringList ret; - foreach (::Orientation o, ui->mDeviceItem->supportedScreenOrientations()) - ret.append(metaEnum.valueToKey(o)); - - return ret; -} - -void ConfigurationWidget::enableRotationButtons(bool rotateScreen, int supportedOrientations) -{ - if (!rotateScreen) { - ui_inspector->topUp->setEnabled(true); - ui_inspector->leftUp->setEnabled(true); - ui_inspector->rightUp->setEnabled(true); - ui_inspector->topDown->setEnabled(true); - } else { - ui_inspector->topUp->setEnabled(supportedOrientations & topUp); - ui_inspector->leftUp->setEnabled(supportedOrientations & leftUp); - ui_inspector->rightUp->setEnabled(supportedOrientations & rightUp); - ui_inspector->topDown->setEnabled(supportedOrientations & topDown); - } -} diff --git a/src/ui/configurationwidget.h b/src/ui/configurationwidget.h index 5eadc88..6d7b1a5 100644 --- a/src/ui/configurationwidget.h +++ b/src/ui/configurationwidget.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,146 +22,32 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ #ifndef CONFIGURATIONWIDGET_H #define CONFIGURATIONWIDGET_H -#include "deviceitem.h" - #include <remotecontrolwidget/remotecontrolwidget.h> -#include <QtGui/QWidget> -#include <QtCore/QPointer> - -class Ui_Inspector; -class OptionsItem; -class FilterLineEdit; -class MobilityData; -class ToolBox; -class ToolBoxPage; -class StyledBar; -class QToolButton; -class QMenuBar; -class ViewConfiguration; -class QLineEdit; -class QPushButton; -class QButtonGroup; -class Widget; -class DeviceItem; -class SimulatorScriptInterface; - class ConfigurationWidget: public RemoteControlWidget { Q_OBJECT public: - explicit ConfigurationWidget(const DeviceItem *deviceItem, QWidget *parent = 0); + explicit ConfigurationWidget(QWidget *parent = 0); ~ConfigurationWidget(); - SimulatorScriptInterface *scriptInterface(); - - void initializeSelection(); - - int currentDeviceIndex() const; - QString currentDeviceName() const; - - bool initializeDeviceList(); - - virtual void writeSettings(const QString &vendor, const QString &name) const; - virtual void readSettings(const QString &vendor, const QString &name); - -public slots: - void changeDeviceSelection(int newIndex); - void updateMenuBarWidget(Widget *menuBarWidget); - void updateOrientationButtonsState(Orientation orientation); - void updateOrientationsButtonsIcons(bool standardOrientationPortrait); - signals: - void deviceSelectionChanged(const DeviceData &data); - void scaleFactorChanged(qreal newScaleFactor); - void orientationChangeRequested(Orientation newOrientation, bool rotateScreen); - void rotateRequested(); void closeMainWindow(); - void exitButtonClicked(); protected: virtual void closeEvent(QCloseEvent *event); - -private slots: - void changeScaleFactor(int sliderPosition); - void changeCorrectionFactor(qreal); - void changeOrientation(int orientation); - void showViewConfiguration(); - void updateOrientationButtons(const DeviceData &data); - void rotateScreenToggled(); - -private: - void initializeViewArea(); - void initializeApplicationArea(); - Q_INVOKABLE void enableRotationButtons(bool rotateScreen, int supportedOrientations); - - QList<DeviceData> deviceList; - - Ui_Inspector *ui_inspector; - QButtonGroup *mOrientationButtons; - - qreal mCorrectionFactor; - QSize mLogicalDpi; - - QToolButton *viewButton; - - ViewConfiguration *mViewConfiguration; - QHBoxLayout *mMenuLayout; - QLineEdit *mWidgetTitle; - - PageWidget *mAppPage; - PageWidget *mViewPage; - - QPointer<QMenuBar> mMenuBar; - - const DeviceItem *mDeviceItem; - - SimulatorScriptInterface *mScriptInterface; - friend class SimulatorScriptInterface; -}; - -class SimulatorScriptInterface : public QObject -{ - Q_OBJECT -public: - SimulatorScriptInterface(ConfigurationWidget *ui); - virtual ~SimulatorScriptInterface(); - - // must mimic ::Orientation - enum Orientation { - topUp = 0x0000001, - topDown = 0x0000002, - leftUp = 0x0000004, - rightUp = 0x0000008, - }; - Q_ENUMS(Orientation); - - Q_PROPERTY(int zoom READ zoom WRITE setZoom) - - int zoom() const; - void setZoom(int z); - - Q_INVOKABLE int currentDeviceIndex() const; - Q_INVOKABLE QString currentDeviceName() const; - Q_INVOKABLE int deviceCount() const; - Q_INVOKABLE void setDevice(const QString &dev); - Q_INVOKABLE void setDevice(int index); - - Q_INVOKABLE QString deviceOrientation() const; - Q_INVOKABLE QString screenOrientation() const; - Q_INVOKABLE QStringList supportedScreenOrientations() const; - Q_INVOKABLE bool setDeviceOrientation(QString orientation, bool rotateScreen); - -private: - ConfigurationWidget *ui; }; #endif //CONFIGURATIONWIDGET_H diff --git a/src/ui/contactsui.cpp b/src/ui/contactsui.cpp index c408253..7139753 100644 --- a/src/ui/contactsui.cpp +++ b/src/ui/contactsui.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ @@ -57,6 +61,8 @@ ContactsUi::ContactsUi(Contacts *contacts, QWidget *parent) mContactList->setColumnWidth(0, mContactList->width() - mContactList->frameWidth()); mContactList->setHorizontalHeaderLabels(QStringList(tr("Name"))); mContactList->horizontalHeaderItem(0)->setTextAlignment(Qt::AlignLeft); + mContactList->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); + mContactList->setEditTriggers(QAbstractItemView::NoEditTriggers); OptionsItem *item = new OptionsItem("", mContactList, true); optionsList << item; diff --git a/src/ui/contactsui.h b/src/ui/contactsui.h index 1576037..3844a34 100644 --- a/src/ui/contactsui.h +++ b/src/ui/contactsui.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ @@ -34,7 +38,6 @@ #include <QtCore/QObject> -class ConfigurationWidget; class Contacts; class QTableWidget; diff --git a/src/ui/docgalleryui.cpp b/src/ui/docgalleryui.cpp index 1ef59cd..3a67243 100644 --- a/src/ui/docgalleryui.cpp +++ b/src/ui/docgalleryui.cpp @@ -1,4 +1,38 @@ +/************************************************************************** +** +** This file is part of Qt Simulator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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. +** +**************************************************************************/ + #include "docgalleryui.h" +#include <remotecontrolwidget/optionsitem.h> #include <QtGui/QTreeWidget> #include <QtGui/QPushButton> @@ -7,6 +41,7 @@ #include <QtGui/QApplication> #include <QtGui/QDesktopServices> #include <QtCore/QUrl> +#include <QtCore/QtConcurrentRun> DocGalleryUi::DocGalleryUi(QWidget *parent) : ToolBoxPage(parent) @@ -14,23 +49,24 @@ DocGalleryUi::DocGalleryUi(QWidget *parent) : QStringList tags; QList<OptionsItem *> optionsList; - docGalleryTreeWidget = new QTreeWidget(); + mDocGalleryTreeWidget = new QTreeWidget(); QStringList items; items << "FileName" << "" << "" << "" << ""; - docGalleryTreeWidget->setHeaderLabels(items); - docGalleryTreeWidget->setColumnCount(5); - docGalleryTreeWidget->setColumnWidth(1, 50); - docGalleryTreeWidget->setColumnWidth(2, 50); - connect(docGalleryTreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(openItem(QTreeWidgetItem*, int))); + mDocGalleryTreeWidget->setHeaderLabels(items); + mDocGalleryTreeWidget->setColumnCount(5); + mDocGalleryTreeWidget->setColumnWidth(1, 50); + mDocGalleryTreeWidget->setColumnWidth(2, 50); + mDocGalleryTreeWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); + connect(mDocGalleryTreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(openItem(QTreeWidgetItem*, int))); - artistHead = new QTreeWidgetItem(docGalleryTreeWidget); - artistHead->setText(0, QLatin1String("Artists")); - imageHead = new QTreeWidgetItem(docGalleryTreeWidget); - imageHead->setText(0, QLatin1String("Images")); + mArtistHead = new QTreeWidgetItem(mDocGalleryTreeWidget); + mArtistHead->setText(0, QLatin1String("Artists")); + mImageHead = new QTreeWidgetItem(mDocGalleryTreeWidget); + mImageHead->setText(0, QLatin1String("Images")); addStandardItems(); - OptionsItem *item = new OptionsItem("", docGalleryTreeWidget, true); + OptionsItem *item = new OptionsItem("", mDocGalleryTreeWidget, true); tags << QLatin1String("Artist") << QLatin1String("Document") << QLatin1String("Video") << QLatin1String("Images"); item->setTags(tags); optionsList << item; @@ -41,37 +77,60 @@ DocGalleryUi::DocGalleryUi(QWidget *parent) : void DocGalleryUi::addStandardItems() { - data.images.clear(); - data.artists.clear(); + mData.images.clear(); + mData.artists.clear(); // Add some images QString modelPath = qApp->applicationDirPath() + "/models"; - QDirIterator it(modelPath, QDirIterator::Subdirectories); - QLocale locale; + + mImageReaderWatcher.setFuture(QtConcurrent::run(this, &DocGalleryUi::readImages, modelPath)); + connect(&mImageReaderWatcher, SIGNAL(finished()), this, SLOT(finishReadingImages())); +} + +void DocGalleryUi::openItem(QTreeWidgetItem *widgetItem, int) +{ + QDesktopServices::openUrl(QUrl::fromLocalFile(widgetItem->text(0))); +} + +QtMobility::DocGallerySimulatorData DocGalleryUi::data() const +{ + return mData; +} + +QList<QtMobility::DocGalleryImageItem> DocGalleryUi::readImages(const QString &directory) +{ + QList<QtMobility::DocGalleryImageItem> results; + QDirIterator it(directory, QDirIterator::Subdirectories); while (it.hasNext()) { QString item = it.next(); QImage image(item); if (image.isNull()) continue; - QTreeWidgetItem* treeItem = new QTreeWidgetItem(imageHead); - treeItem->setText(0, item); - treeItem->setText(1, locale.toString(image.width())); - treeItem->setText(2, locale.toString(image.height())); - treeItem->setText(3, QLatin1String("Some model image")); - treeItem->setText(4, QLatin1String("Simulator Model")); QtMobility::DocGalleryImageItem imageItem; imageItem.fileName = item; imageItem.width = image.width(); imageItem.height = image.height(); - imageItem.title = treeItem->text(3); - imageItem.tags = treeItem->text(4); - data.images.append(imageItem); + imageItem.title = QLatin1String("Some model image"); + imageItem.tags = QLatin1String("Simulator Model"); + results.append(imageItem); } + return results; } -void DocGalleryUi::openItem(QTreeWidgetItem *widgetItem, int) +void DocGalleryUi::finishReadingImages() { - QDesktopServices::openUrl(QUrl::fromLocalFile(widgetItem->text(0))); + QList<QtMobility::DocGalleryImageItem> imageList = mImageReaderWatcher.future().result(); + foreach (const QtMobility::DocGalleryImageItem &item, imageList) { + QLocale locale; + QTreeWidgetItem* treeItem = new QTreeWidgetItem(mImageHead); + treeItem->setText(0, item.fileName); + treeItem->setText(1, locale.toString(item.width)); + treeItem->setText(2, locale.toString(item.height)); + treeItem->setText(3, item.title); + treeItem->setText(4, item.tags); + mData.images.append(item); + } + emit docGalleryDataChanged(mData); } #include "moc_docgalleryui.cpp" diff --git a/src/ui/docgalleryui.h b/src/ui/docgalleryui.h index 7ae56bb..54d1f45 100644 --- a/src/ui/docgalleryui.h +++ b/src/ui/docgalleryui.h @@ -1,9 +1,42 @@ +/************************************************************************** +** +** This file is part of Qt Simulator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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. +** +**************************************************************************/ + #ifndef DOCGALLERYUI_H #define DOCGALLERYUI_H -#include <QObject> #include <remotecontrolwidget/toolbox.h> #include <gallery/simulator/docgallerysimulatordata.h> +#include <QtCore/QFutureWatcher> #include <QtGui/QTreeWidget> @@ -12,20 +45,26 @@ class DocGalleryUi : public ToolBoxPage Q_OBJECT public: explicit DocGalleryUi(QWidget *parent = 0); + QtMobility::DocGallerySimulatorData data() const; signals: - void docGalleryDataChanged(const QtMobility::DocGallerySimulatorData &data); + void docGalleryDataChanged(const QtMobility::DocGallerySimulatorData &mData); public slots: void openItem(QTreeWidgetItem*, int); +private slots: + void finishReadingImages(); + private: - friend class MobilityClient; - QtMobility::DocGallerySimulatorData data; void addStandardItems(); - QTreeWidget* docGalleryTreeWidget; - QTreeWidgetItem* artistHead; - QTreeWidgetItem* imageHead; + QList<QtMobility::DocGalleryImageItem> readImages(const QString &directory); + + QtMobility::DocGallerySimulatorData mData; + QTreeWidget* mDocGalleryTreeWidget; + QTreeWidgetItem* mArtistHead; + QTreeWidgetItem* mImageHead; + QFutureWatcher< QList<QtMobility::DocGalleryImageItem> > mImageReaderWatcher; }; #endif // DOCGALLERYUI_H diff --git a/src/ui/feedbackui.cpp b/src/ui/feedbackui.cpp index 15f07c4..05036d3 100644 --- a/src/ui/feedbackui.cpp +++ b/src/ui/feedbackui.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,13 +22,18 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ #include "feedbackui.h" #include "feedback.h" +#include <remotecontrolwidget/optionsitem.h> #include <QtGui/QComboBox> #include <QtGui/QBoxLayout> diff --git a/src/ui/feedbackui.h b/src/ui/feedbackui.h index 0bb58b4..c923156 100644 --- a/src/ui/feedbackui.h +++ b/src/ui/feedbackui.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/ui/icons/north.png b/src/ui/icons/north.png Binary files differnew file mode 100644 index 0000000..65c69e4 --- /dev/null +++ b/src/ui/icons/north.png diff --git a/src/ui/inputscriptinterface.cpp b/src/ui/inputscriptinterface.cpp new file mode 100644 index 0000000..06f9c64 --- /dev/null +++ b/src/ui/inputscriptinterface.cpp @@ -0,0 +1,223 @@ +#include "inputscriptinterface.h" +#include "mainwindow.h" +#include "displaywidget.h" + +#include <QtCore/QMetaEnum> +#include <QtGui/QApplication> +#include <QtGui/QGraphicsView> + +InputScriptInterface::InputScriptInterface(MainWindow *ui, QWidget *viewport) + : QObject(ui) + , mUi(ui) + , mViewport(viewport) + , mPressedButtons(NoButton) +{ + int enumIndex = metaObject()->indexOfEnumerator("MouseButton"); + QMetaEnum metaEnum = metaObject()->enumerator(enumIndex); + for (int i = 0; i < metaEnum.keyCount(); ++i) + setProperty(metaEnum.key(i), metaEnum.value(i)); +} + +InputScriptInterface::~InputScriptInterface() +{ +} + +void InputScriptInterface::mousePress(MouseButton button, qint32 x, qint32 y) +{ + mousePress(button, x, y, false); +} + +void InputScriptInterface::mousePress(MouseButton button, qint32 x, qint32 y, bool doubleClick) +{ + mPressedButtons |= static_cast<Qt::MouseButton>(button); + QPoint pos = mapPositionToDevice(QPoint(x, y)); + QEvent::Type type; + if (doubleClick) + type = QEvent::MouseButtonDblClick; + else + type = QEvent::MouseButtonPress; + QMouseEvent *event = new QMouseEvent(type, pos, + static_cast<Qt::MouseButton>(button), + static_cast<Qt::MouseButtons>(mPressedButtons), + Qt::NoModifier); + qApp->postEvent(mViewport, event); +} + +void InputScriptInterface::mouseMove(qint32 x, qint32 y) +{ + QPoint pos = mapPositionToDevice(QPoint(x, y)); + QMouseEvent *event = new QMouseEvent(QEvent::MouseMove, pos, + Qt::NoButton, + static_cast<Qt::MouseButtons>(mPressedButtons), + Qt::NoModifier); + qApp->postEvent(mViewport, event); +} + +void InputScriptInterface::mouseRelease(MouseButton button, qint32 x, qint32 y) +{ + mPressedButtons &= ~static_cast<Qt::MouseButton>(button); + QPoint pos = mapPositionToDevice(QPoint(x, y)); + QMouseEvent *event = new QMouseEvent(QEvent::MouseButtonRelease, pos, + static_cast<Qt::MouseButton>(button), + static_cast<Qt::MouseButtons>(mPressedButtons), + Qt::NoModifier); + qApp->postEvent(mViewport, event); +} + +void InputScriptInterface::click(qint32 x, qint32 y) +{ + mousePress(LeftButton, x, y); + mouseRelease(LeftButton, x, y); +} + +void InputScriptInterface::doubleClick(qint32 x, qint32 y) +{ + click(x, y); + mousePress(LeftButton, x, y, true); + mouseRelease(LeftButton, x, y); +} + +void InputScriptInterface::rightClick(qint32 x, qint32 y) +{ + mousePress(RightButton, x, y); + mouseRelease(RightButton, x, y); +} + + +QPoint InputScriptInterface::mapPositionToDevice(const QPoint &position) const +{ + DeviceData d = mUi->deviceItem()->mDeviceData; + QPoint returnedPosition; + + switch (mUi->deviceItem()->screenOrientation()) { + case topUp: + switch (mUi->deviceItem()->deviceOrientation()) { + case topUp: + returnedPosition = position + d.offset + d.availableGeometry.topLeft(); + break; + case topDown: + returnedPosition.setX(d.mockup->width() - d.offset.x() - d.availableGeometry.x() - position.x()); + returnedPosition.setY(d.mockup->height() - d.offset.y() - d.availableGeometry.y() - position.y()); + break; + case leftUp: + returnedPosition.setX(d.mockup->height() - d.offset.y() - d.availableGeometry.y() - position.y()); + returnedPosition.setY(d.offset.x() + d.availableGeometry.x() + position.x()); + break; + case rightUp: + returnedPosition.setX(d.offset.y() + d.availableGeometry.y() + position.y()); + returnedPosition.setY(d.mockup->width() - d.offset.x() - d.availableGeometry.x() - position.x()); + break; + } + break; + case topDown: + switch (mUi->deviceItem()->deviceOrientation()) { + case topUp: + returnedPosition.setX(d.offset.x() + d.resolution.width() - d.availableGeometry.x() - position.x()); + returnedPosition.setY(d.mockup->height() - d.offset.y() - d.availableGeometry.y() - position.y()); + break; + case topDown: + returnedPosition.setX(d.mockup->width() - d.offset.x() - d.resolution.width() + d.availableGeometry.x() + position.x()); + returnedPosition.setY(d.mockup->height() - d.offset.y() - d.resolution.height() + d.availableGeometry.y() + position.y()); + break; + case leftUp: + returnedPosition.setX(d.mockup->height() - d.offset.y() - d.resolution.height() + d.availableGeometry.y() + position.y()); + returnedPosition.setY(d.offset.x() +d.resolution.width() - d.availableGeometry.x() - position.x()); + break; + case rightUp: + returnedPosition.setX(d.offset.y() + d.resolution.height() - d.availableGeometry.y() - position.y()); + returnedPosition.setY(d.mockup->width() - d.offset.x() - d.resolution.width() + d.availableGeometry.x() + position.x()); + break; + } + break; + case leftUp: + switch (mUi->deviceItem()->deviceOrientation()) { + case topUp: + returnedPosition.setX(d.offset.x() + d.availableGeometry.y() + position.y()); + returnedPosition.setY(d.offset.y() + d.resolution.height() - d.availableGeometry.x() - position.x()); + break; + case topDown: + returnedPosition.setX(d.mockup->width() - d.offset.x() - d.availableGeometry.y() - position.y()); + returnedPosition.setY(d.mockup->height() - d.offset.y() - d.resolution.height() + d.availableGeometry.x() + position.x()); + break; + case leftUp: + returnedPosition.setX(d.mockup->height() - d.offset.y() - d.resolution.height() + d.availableGeometry.x() + position.x()); + returnedPosition.setY(d.offset.x() + d.availableGeometry.y() + position.y()); + break; + case rightUp: + returnedPosition.setX(d.offset.y() + d.resolution.height() - d.availableGeometry.x() - position.x()); + returnedPosition.setY(d.mockup->width() - d.offset.x() - d.availableGeometry.y() - position.y()); + break; + } + break; + case rightUp: + switch (mUi->deviceItem()->deviceOrientation()) { + case topUp: + returnedPosition.setX(d.offset.x() + d.resolution.width() - d.availableGeometry.y() - position.y()); + returnedPosition.setY(d.offset.y() + d.availableGeometry.x() + position.x()); + break; + case topDown: + returnedPosition.setX(d.mockup->width() - d.offset.x() - d.resolution.width() + d.availableGeometry.y() + position.y()); + returnedPosition.setY(d.mockup->height() - d.offset.y() - d.availableGeometry.x() - position.x()); + break; + case leftUp: + returnedPosition.setX(d.mockup->height() - d.offset.y() - d.availableGeometry.x() - position.x()); + returnedPosition.setY(d.offset.x() +d.resolution.width() - d.availableGeometry.y() - position.y()); + break; + case rightUp: + returnedPosition.setX(d.offset.y() + d.availableGeometry.left() + position.x()); + returnedPosition.setY(d.mockup->width() - d.offset.x() - d.resolution.width() + d.availableGeometry.y() + position.y()); + break; + } + break; + } + return returnedPosition; +} + +void InputScriptInterface::keyPress(QChar c) +{ + QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, c.unicode(), Qt::NoModifier, QString(c)); + qApp->postEvent(mViewport, event); +} + +void InputScriptInterface::keyRelease(QChar c) +{ + QKeyEvent *event = new QKeyEvent(QEvent::KeyRelease, c.unicode(), Qt::NoModifier, QString(c)); + qApp->postEvent(mViewport, event); +} + +void InputScriptInterface::type(QChar c) +{ + keyPress(c); + keyRelease(c); +} + +void InputScriptInterface::type(const QString &string) +{ + foreach (const QChar &c, string) { + type(c); + } +} + +int InputScriptInterface::mouseX() const +{ + QPointF pos = mView->mapFromGlobal(QCursor::pos()); + pos = mDisplay->mapFromScene(pos); + return pos.x() - mUi->deviceItem()->mDeviceData.availableGeometry.x(); +} + +int InputScriptInterface::mouseY() const +{ + QPointF pos = mView->mapFromGlobal(QCursor::pos()); + pos = mDisplay->mapFromScene(pos); + return pos.y() - mUi->deviceItem()->mDeviceData.availableGeometry.y(); +} + +void InputScriptInterface::setView(QGraphicsView *view) +{ + mView = view; +} + +void InputScriptInterface::setDisplay(DisplayWidget *display) +{ + mDisplay = display; +} diff --git a/src/ui/inputscriptinterface.h b/src/ui/inputscriptinterface.h new file mode 100644 index 0000000..4feb057 --- /dev/null +++ b/src/ui/inputscriptinterface.h @@ -0,0 +1,64 @@ +#ifndef INPUTSCRIPTINTERFACE_H +#define INPUTSCRIPTINTERFACE_H + +#include <QtCore/QObject> +#include <QtCore/QPoint> + +class MainWindow; +class QGraphicsView; +class DisplayWidget; + +class InputScriptInterface : public QObject +{ + Q_OBJECT +public: + // depends on order of items + // has to match Qt::MouseButton + enum MouseButton { + NoButton = 0x00000000, + LeftButton = 0x00000001, + RightButton = 0x00000002, + MidButton = 0x00000004, // ### Qt 5: remove me + MiddleButton = MidButton, + XButton1 = 0x00000008, + XButton2 = 0x00000010, + MouseButtonMask = 0x000000ff + }; + Q_ENUMS(MouseButton); + Q_DECLARE_FLAGS(MouseButtons, MouseButton) + + InputScriptInterface(MainWindow *mUi, QWidget *viewport); + virtual ~InputScriptInterface(); + + void setView(QGraphicsView *view); + void setDisplay(DisplayWidget *display); + + Q_INVOKABLE void mousePress(MouseButton button, qint32 x, qint32 y); + Q_INVOKABLE void mouseMove(qint32 x, qint32 y); + Q_INVOKABLE void mouseRelease(MouseButton button, qint32 x, qint32 y); + + Q_INVOKABLE int mouseX() const; + Q_INVOKABLE int mouseY() const; + + Q_INVOKABLE void click(qint32 x, qint32 y); + Q_INVOKABLE void doubleClick(qint32 x, qint32 y); + Q_INVOKABLE void rightClick(qint32 x, qint32 y); + + Q_INVOKABLE void keyPress(QChar c); + Q_INVOKABLE void keyRelease(QChar c); + Q_INVOKABLE void type(const QString &string); + +private: + void type(QChar c); + void mousePress(MouseButton button, qint32 x, qint32 y, bool doubleClick); + QPoint mapPositionToDevice(const QPoint &position) const; + QPoint mapPositionToScreen(const QPoint &position) const; + + MainWindow *mUi; + QWidget *mViewport; + Qt::MouseButtons mPressedButtons; + QGraphicsView *mView; + DisplayWidget *mDisplay; +}; + +#endif // INPUTSCRIPTINTERFACE_H diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index b1fb054..3e07a7e 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ @@ -35,7 +39,10 @@ #include "widgetmanager.h" #include "mobilitymanager.h" #include "mobilitydata.h" +#include "qtsingleapplication.h" +#include "viewui.h" +#include "applicationui.h" #include "contactsui.h" #include "systeminfogenericui.h" #include "systeminfonetworkui.h" @@ -46,6 +53,8 @@ #include "feedbackui.h" #include "docgalleryui.h" #include "cameraui.h" +#include "nfcui.h" +#include "inputscriptinterface.h" #include <remotecontrolwidget/locationui.h> #include <remotecontrolwidget/scriptui.h> @@ -77,7 +86,7 @@ #endif // VERSION UPDATE -const VersionStruct simulatorVersion(1, 1, 0, 0); +const VersionStruct simulatorVersion(1, 1, 0, 1); // Increment this value if the scripts that come bundled with the Simulator // have changed and the user should be asked whether he wants to copy them @@ -89,7 +98,7 @@ MainWindow::MainWindow(QWidget *parent) , view(0) , config(0) , applicationManager(0) - , deviceItem(0) + , mDeviceItem(0) , debugWindow(0) , startupError(false) { @@ -125,9 +134,9 @@ MainWindow::MainWindow(QWidget *parent) scene = new QGraphicsScene(this); - deviceItem = new DeviceItem; + mDeviceItem = new DeviceItem; - scene->addItem(deviceItem); + scene->addItem(mDeviceItem); view = new QGraphicsView(scene); view->setOptimizationFlag(QGraphicsView::DontSavePainterState); @@ -141,23 +150,25 @@ MainWindow::MainWindow(QWidget *parent) phononManager->setObjectName("PhononManager"); applicationManager->setPhononManager(phononManager); - WidgetManager *widgetManager = new WidgetManager(deviceItem->display(), this); + WidgetManager *widgetManager = new WidgetManager(mDeviceItem->display(), this); applicationManager->setWidgetManager(widgetManager); connect(applicationManager, SIGNAL(applicationRegistered(Application*)), this, SLOT(activateWindow())); connect(applicationManager, SIGNAL(applicationUnRegistered(int)), widgetManager, SLOT(onApplicationUnregistered(int))); - connect(widgetManager, SIGNAL(symbianSoftKeyTextChanged(int,QString)), deviceItem, SLOT(setSymbianSoftKeyText(int,QString))); - connect(widgetManager, SIGNAL(maemoNavigationChanged(MaemoNavigationMode)), deviceItem, SLOT(setMaemoNavigationMode(MaemoNavigationMode))); - connect(deviceItem, SIGNAL(deviceChanged(QSize,DeviceData)), applicationManager, SLOT(updateDisplayInformation(QSize,DeviceData))); - connect(deviceItem, SIGNAL(drag(QPoint)), this, SLOT(dragFromView(QPoint))); - connect(deviceItem, SIGNAL(viewSizeRequired(QSize)), this, SLOT(setViewSize(QSize))); - connect(deviceItem, SIGNAL(buttonPressed(Qt::Key, QString)), widgetManager, SLOT(sendKeyPress(Qt::Key, QString))); - connect(deviceItem, SIGNAL(buttonReleased(Qt::Key)), widgetManager, SLOT(sendKeyRelease(Qt::Key))); - connect(deviceItem, SIGNAL(closeWindowPressed()), widgetManager, SLOT(closeCurrentWindow())); - connect(deviceItem, SIGNAL(symbianSoftKeyClicked(int)), widgetManager, SLOT(triggerSymbianSoftKeyAction(int))); - connect(deviceItem, SIGNAL(offsetChanged(const QPoint &)), widgetManager, SLOT(changeOffset(const QPoint &))); - connect(deviceItem, SIGNAL(deviceChanged(QSize,DeviceData)), widgetManager, SLOT(updateSymbianSoftKeys())); - connect(deviceItem, SIGNAL(orientationChanged(Orientation)), mobility, SLOT(rotateDevice(Orientation))); + connect(applicationManager, SIGNAL(softkeyTextSizeChanged(double)), mDeviceItem, SLOT(setSymbianSoftKeyTextSize(double))); + connect(widgetManager, SIGNAL(symbianSoftKeyTextChanged(int,QString)), mDeviceItem, SLOT(setSymbianSoftKeyText(int,QString))); + connect(widgetManager, SIGNAL(maemoNavigationChanged(MaemoNavigationMode)), mDeviceItem, SLOT(setMaemoNavigationMode(MaemoNavigationMode))); + connect(widgetManager, SIGNAL(topOrientationChanged(Qt::WidgetAttribute)), mDeviceItem, SLOT(updateOrientation(Qt::WidgetAttribute))); + connect(mDeviceItem, SIGNAL(deviceChanged(QSize,DeviceData)), applicationManager, SLOT(updateDisplayInformation(QSize,DeviceData))); + connect(mDeviceItem, SIGNAL(drag(QPoint)), this, SLOT(dragFromView(QPoint))); + connect(mDeviceItem, SIGNAL(viewSizeRequired(QSize)), this, SLOT(setViewSize(QSize))); + connect(mDeviceItem, SIGNAL(buttonPressed(Qt::Key, QString)), widgetManager, SLOT(sendKeyPress(Qt::Key, QString))); + connect(mDeviceItem, SIGNAL(buttonReleased(Qt::Key)), widgetManager, SLOT(sendKeyRelease(Qt::Key))); + connect(mDeviceItem, SIGNAL(closeWindowPressed()), widgetManager, SLOT(closeCurrentWindow())); + connect(mDeviceItem, SIGNAL(symbianSoftKeyClicked(int)), widgetManager, SLOT(triggerSymbianSoftKeyAction(int))); + connect(mDeviceItem, SIGNAL(offsetChanged(const QPoint &)), widgetManager, SLOT(changeOffset(const QPoint &))); + connect(mDeviceItem, SIGNAL(deviceChanged(QSize,DeviceData)), widgetManager, SLOT(updateSymbianSoftKeys())); + connect(mDeviceItem, SIGNAL(orientationChanged(Orientation)), mobility, SLOT(rotateDevice(Orientation))); connect(mobilityServer, SIGNAL(applicationConnected(int, VersionStruct)), applicationManager, SLOT(updateMobilityVersion(int, VersionStruct))); @@ -174,69 +185,84 @@ MainWindow::MainWindow(QWidget *parent) debugWindow->setLayout(layout); // Setup configuration window. - config = new ConfigurationWidget(deviceItem, this); + config = new ConfigurationWidget(this); config->setWindowFlags(Qt::Window); - if (!config->initializeDeviceList()) { + connect(mDeviceItem, SIGNAL(sizeChanged(const QSize &)), this, SLOT(setSizeToDevice(const QSize &))); + connect(config, SIGNAL(closeMainWindow()), this, SLOT(close())); + + scriptAdapter = new ScriptAdapter(this); + + // build ui pages + ViewUi *viewUi = new ViewUi(mDeviceItem, this); + if (!viewUi->initializeDeviceList()) { QTimer::singleShot(0, this, SLOT(close())); startupError = true; return; } - connect(widgetManager, SIGNAL(topWidgetChanged(Widget *)), config, SLOT(updateMenuBarWidget(Widget *))); - connect(config, SIGNAL(deviceSelectionChanged(const DeviceData &)), deviceItem, SLOT(changeDevice(const DeviceData &))); - connect(deviceItem, SIGNAL(sizeChanged(const QSize &)), this, SLOT(setSizeToDevice(const QSize &))); - connect(deviceItem, SIGNAL(orientationChanged(Orientation)), config, SLOT(updateOrientationButtonsState(Orientation))); - connect(deviceItem, SIGNAL(deviceChanged(bool)), config, SLOT(updateOrientationsButtonsIcons(bool))); - connect(config, SIGNAL(closeMainWindow()), this, SLOT(close())); - connect(config, SIGNAL(orientationChangeRequested(Orientation, bool)), - deviceItem, SLOT(changeOrientation(Orientation, bool))); - connect(config, SIGNAL(scaleFactorChanged(qreal)), deviceItem, SLOT(changeScaleFactor(qreal))); - connect(config, SIGNAL(exitButtonClicked()), applicationManager, SLOT(killCurrentApplication())); + config->addPage(viewUi); + connect(mDeviceItem, SIGNAL(orientationLocked(bool)), viewUi, SLOT(setOrientationLocked(bool))); - scriptAdapter = new ScriptAdapter(this); + ApplicationUi *applicationUi = new ApplicationUi(this); + config->addPage(applicationUi); + connect(applicationUi, SIGNAL(exitButtonClicked()), applicationManager, SLOT(killCurrentApplication())); + connect(widgetManager, SIGNAL(topWidgetChanged(Widget *)), applicationUi, SLOT(updateMenuBarWidget(Widget *))); - // build ui pages GenericSystemInfoUi *genericSystemInfoUi = new GenericSystemInfoUi(this); mobility->mSystemInfoGenericUi = genericSystemInfoUi; - config->addSimulateSubPage(genericSystemInfoUi); + config->addPage(genericSystemInfoUi); StorageSystemInfoUi *storageSystemInfoUi = new StorageSystemInfoUi(this); mobility->mSystemInfoStorageUi = storageSystemInfoUi; - config->addSimulateSubPage(storageSystemInfoUi); + config->addPage(storageSystemInfoUi); NetworkSystemInfoUi *networkSystemInfoUi = new NetworkSystemInfoUi(this); mobility->mSystemInfoNetworkUi = networkSystemInfoUi; - config->addSimulateSubPage(networkSystemInfoUi); + config->addPage(networkSystemInfoUi); LocationUi *locationUi = new LocationUi(this); mobility->mLocationUi = locationUi; - config->addSimulateSubPage(locationUi); + config->addPage(locationUi); - config->addSimulateSubPage(new ContactsUi(mobility->mContacts, this)); - config->addSimulateSubPage(new MessagingUi(mobility, this)); + config->addPage(new ContactsUi(mobility->mContacts, this)); + config->addPage(new MessagingUi(mobility, this)); SensorsUi *sensorsUi = new SensorsUi(this); mobility->mSensorsUi = sensorsUi; - config->addSimulateSubPage(sensorsUi); - connect(deviceItem, SIGNAL(deviceChanged(bool)), sensorsUi, SLOT(updateDeviceDefaultOrientation(bool))); + config->addPage(sensorsUi); + connect(mDeviceItem, SIGNAL(deviceChanged(bool)), sensorsUi, SLOT(updateDeviceDefaultOrientation(bool))); OrganizerUi *organizerUi = new OrganizerUi(mobility->mOrganizer, this); - config->addSimulateSubPage(organizerUi); + config->addPage(organizerUi); FeedbackUi *feedbackUi = new FeedbackUi(mobility->mFeedback, this); - config->addSimulateSubPage(feedbackUi); + config->addPage(feedbackUi); DocGalleryUi *docgalleryUi = new DocGalleryUi(this); mobility->mDocGalleryUi = docgalleryUi; - config->addSimulateSubPage(docgalleryUi); + config->addPage(docgalleryUi); CameraUi *cameraUi = new CameraUi(this); mobility->mCameraUi = cameraUi; - config->addSimulateSubPage(cameraUi); + config->addPage(cameraUi); + + NfcUi *nfcUi = new NfcUi(this); + mobility->mNfcUi = nfcUi; + config->addPage(nfcUi); + + mTouchUi = new MultiPointTouchUi(this); + mTouchUi->setGestureScriptPath(userResourcePath() + "/scripts/gestures"); + config->addPage(mTouchUi); + connect(mTouchUi, SIGNAL(inputModeChanged(MultiPointTouchUi::InputMode)), + widgetManager, SLOT(setMouseInputMode(MultiPointTouchUi::InputMode))); + connect(this, SIGNAL(mouseInputModeChanged(MultiPointTouchUi::InputMode)), + mTouchUi, SLOT(setInputMode(MultiPointTouchUi::InputMode))); + connect(mTouchUi, SIGNAL(customGesturePathChanged(QString)), + widgetManager, SLOT(setCurrentGesturePath(QString))); ScriptUi *scriptUi = new ScriptUi(scriptAdapter, this); FavoriteScriptButton *scriptButton = new FavoriteScriptButton(this); setupScriptDirectories(scriptUi, scriptButton); - config->addSimulateSubPage(scriptUi); + config->addPage(scriptUi); NetworkModeButton *networkModeButton = new NetworkModeButton(this); connect(networkModeButton, SIGNAL(networkModeChanged(NetworkModeButton::NetworkMode)), @@ -271,29 +297,40 @@ MainWindow::MainWindow(QWidget *parent) scriptAdapter, SLOT(run(QString))); config->addMenuButton(scriptButton); + InputScriptInterface *inputScriptInterface = new InputScriptInterface(this, view->viewport()); + inputScriptInterface->setView(view); + inputScriptInterface->setDisplay(deviceItem()->display()); + // register script interfaces - scriptAdapter->addScriptInterface("simulator", config->scriptInterface()); + scriptAdapter->addScriptInterface("simulator", viewUi->scriptInterface()); scriptAdapter->addScriptInterface("sensors", sensorsUi->scriptInterface()); scriptAdapter->addScriptInterface("location", locationUi->scriptInterface()); scriptAdapter->addScriptInterface("sysinfo.generic", genericSystemInfoUi->scriptInterface()); scriptAdapter->addScriptInterface("sysinfo.network", networkSystemInfoUi->scriptInterface()); scriptAdapter->addScriptInterface("sysinfo.storage", storageSystemInfoUi->scriptInterface()); scriptAdapter->addScriptInterface("camera", cameraUi->scriptInterface()); + scriptAdapter->addScriptInterface("input", inputScriptInterface); + scriptAdapter->addScriptInterface("touch", widgetManager->scriptInterface()); - connect(config, SIGNAL(deviceSelectionChanged(const DeviceData &)), SLOT(callDeviceScript(const DeviceData &))); + connect(viewUi, SIGNAL(deviceSelectionChanged(const DeviceData &)), SLOT(callDeviceScript(const DeviceData &))); + connect(widgetManager, SIGNAL(gestureScriptRequested(QString)), scriptAdapter, SLOT(run(QString))); config->setWindowFlags(Qt::Tool); - config->readSettings(QCoreApplication::organizationName(), QCoreApplication::applicationName()); + + // read settings + QSettings settings(QCoreApplication::organizationName(), QCoreApplication::applicationName()); + mTouchUi->readSettings(settings); mobility->setInitialData(); config->show(); + config->readSettings(settings); // Filter to show debug window on special key press. view->installEventFilter(this); view->setFocus(); - readSettings(); + readSettings(settings); scriptAdapter->runAutostartScripts(); } @@ -311,6 +348,17 @@ bool MainWindow::eventFilter(QObject *watched, QEvent *event) && keyEvent->modifiers() & Qt::ControlModifier) { debugWindow->show(); + } else if (keyEvent->modifiers() & Qt::AltModifier) { + if (keyEvent->key() == Qt::Key_1) + emit mouseInputModeChanged(MultiPointTouchUi::defaultMode); + else if (keyEvent->key() == Qt::Key_2) + emit mouseInputModeChanged(MultiPointTouchUi::pinchMode); + else if (keyEvent->key() == Qt::Key_3) + emit mouseInputModeChanged(MultiPointTouchUi::panMode); + else if (keyEvent->key() == Qt::Key_4) + emit mouseInputModeChanged(MultiPointTouchUi::swipeMode); + else if (keyEvent->key() == Qt::Key_5) + emit mouseInputModeChanged(MultiPointTouchUi::freeMode); } } } @@ -327,8 +375,10 @@ void MainWindow::closeEvent(QCloseEvent *event) } if (!startupError) { - writeSettings(); - config->writeSettings(QCoreApplication::organizationName(), QCoreApplication::applicationName()); + QSettings settings(QCoreApplication::organizationName(), QCoreApplication::applicationName()); + writeSettings(settings); + config->writeSettings(settings); + mTouchUi->writeSettings(settings); } } @@ -399,23 +449,19 @@ void MainWindow::setViewSize(const QSize &size) view->centerOn(size.width() / 2, size.height() / 2); } -void MainWindow::writeSettings() const +void MainWindow::writeSettings(QSettings &settings) const { - QSettings settings; - settings.beginGroup("MainWindow"); settings.setValue("pos", pos()); - int deviceOrientation = static_cast<int>(deviceItem->deviceOrientation()); + int deviceOrientation = static_cast<int>(mDeviceItem->deviceOrientation()); settings.setValue("deviceOrientation", deviceOrientation); - int screenOrientation = static_cast<int>(deviceItem->screenOrientation()); + int screenOrientation = static_cast<int>(mDeviceItem->screenOrientation()); settings.setValue("screenOrientation", screenOrientation); settings.endGroup(); } -void MainWindow::readSettings() +void MainWindow::readSettings(QSettings &settings) { - QSettings settings; - settings.beginGroup("MainWindow"); QPoint positionToSet; if (settings.contains("pos")) @@ -437,8 +483,8 @@ void MainWindow::readSettings() if (orientationInt != 0) screenOrientation = static_cast<Orientation>(orientationInt); } - deviceItem->setInitialRotation(deviceOrientation, screenOrientation); - deviceItem->setMaemoNavigationMode(maemoClose); + mDeviceItem->setInitialRotation(deviceOrientation, screenOrientation); + mDeviceItem->setMaemoNavigationMode(maemoClose); settings.endGroup(); } @@ -551,7 +597,7 @@ void MainWindow::callDeviceScript(const DeviceData &newDevice) void MainWindow::activateWindow() { - QWidget::activateWindow(); + SharedTools::QtSingleApplication::instance()->activateWindow(); } void MainWindow::changeEvent(QEvent* e) diff --git a/src/ui/mainwindow.h b/src/ui/mainwindow.h index 41bf185..94dcb77 100644 --- a/src/ui/mainwindow.h +++ b/src/ui/mainwindow.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ @@ -32,6 +36,7 @@ #include "deviceitem.h" #include <QtGui/QWidget> #include "qsimulatordata_p.h" +#include "multipointtouchui.h" class DeviceItem; class ApplicationManager; @@ -42,6 +47,8 @@ class QGraphicsView; class QGraphicsScene; class ScriptUi; class FavoriteScriptButton; +class InputScriptInterface; +class QSettings; extern const VersionStruct simulatorVersion; @@ -56,6 +63,7 @@ public: virtual bool eventFilter(QObject *watched, QEvent *event); virtual void closeEvent(QCloseEvent *event); + DeviceItem *deviceItem() const { return mDeviceItem; } QString userResourcePath() const; public slots: @@ -70,9 +78,12 @@ private slots: void callDeviceScript(const DeviceData &newDevice); void activateWindow(); +signals: + void mouseInputModeChanged(MultiPointTouchUi::InputMode); + private: - void writeSettings() const; - void readSettings(); + void writeSettings(QSettings &) const; + void readSettings(QSettings &); void setupScriptDirectories(ScriptUi *ui, FavoriteScriptButton *button); private: @@ -81,12 +92,14 @@ private: ConfigurationWidget *config; ApplicationManager *applicationManager; - DeviceItem *deviceItem; + DeviceItem *mDeviceItem; MobilityServer *mobilityServer; ScriptAdapter *scriptAdapter; + MultiPointTouchUi *mTouchUi; + QWidget *debugWindow; bool startupError; diff --git a/src/ui/messagingui.cpp b/src/ui/messagingui.cpp index 6ebc22e..c5c993d 100644 --- a/src/ui/messagingui.cpp +++ b/src/ui/messagingui.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/ui/messagingui.h b/src/ui/messagingui.h index 372f7bf..09ff27b 100644 --- a/src/ui/messagingui.h +++ b/src/ui/messagingui.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ @@ -35,7 +39,6 @@ #include <QtCore/QObject> class MobilityData; -class ConfigurationWidget; class MessagingUi : public ToolBoxPage { diff --git a/src/ui/multipointtouchui.cpp b/src/ui/multipointtouchui.cpp new file mode 100644 index 0000000..1cf500c --- /dev/null +++ b/src/ui/multipointtouchui.cpp @@ -0,0 +1,157 @@ +/************************************************************************** +** +** This file is part of Qt Simulator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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. +** +**************************************************************************/ + +#include "multipointtouchui.h" +#include <remotecontrolwidget/optionsitem.h> + +#include <QtCore/QSettings> +#include <QtGui/QVBoxLayout> +#include <QtGui/QButtonGroup> +#include <QtGui/QRadioButton> +#include <QtGui/QLineEdit> +#include <QtGui/QPushButton> +#include <QtGui/QFileDialog> + +MultiPointTouchUi::MultiPointTouchUi(QWidget *parent) : + ToolBoxPage(parent) +{ + QStringList tags; + QList<OptionsItem *> optionsList; + tags << tr("multi point touch"); + + mDefaultRadio = new QRadioButton(tr("Default mode") + " (Alt+1)"); + mPinchRadio = new QRadioButton(tr("Pinch mode") + " (Alt+2)"); + mPanRadio = new QRadioButton(tr("Pan mode") + " (Alt+3)"); + mSwipeRadio = new QRadioButton(tr("Swipe mode") + " (Alt+4)"); + mFreeRadio = new QRadioButton(tr("Free mode") + " (Alt+5)"); + mCustomLineEdit = new QLineEdit(); + QPushButton *loadButton = new QPushButton(tr("Browse")); + connect(loadButton, SIGNAL(clicked()), this, SLOT(getCustomGesturePath())); + connect (mCustomLineEdit, SIGNAL(editingFinished()), SLOT(emitCustomGesturePathChanged())); + + QButtonGroup *buttonGroup = new QButtonGroup(this); + buttonGroup->addButton(mDefaultRadio, 0); + buttonGroup->addButton(mPinchRadio, 1); + buttonGroup->addButton(mPanRadio, 2); + buttonGroup->addButton(mSwipeRadio, 3); + buttonGroup->addButton(mFreeRadio, 4); + mDefaultRadio->setChecked(true); + + QHBoxLayout *hLayout = new QHBoxLayout(); + hLayout->addWidget(mFreeRadio); + hLayout->addWidget(mCustomLineEdit); + hLayout->addWidget(loadButton); + + QVBoxLayout *vLayout = new QVBoxLayout(); + vLayout->addWidget(mDefaultRadio); + vLayout->addWidget(mPinchRadio); + vLayout->addWidget(mPanRadio); + vLayout->addWidget(mSwipeRadio); + vLayout->addLayout(hLayout); + QWidget *widget = new QWidget; + widget->setLayout(vLayout); + + connect(buttonGroup, SIGNAL(buttonClicked(int)), SLOT(emitInputModeChanged(int))); + OptionsItem *item = new OptionsItem(tr(""), widget, true); + optionsList << item; + setTitle(tr("Multipoint-touch")); + setOptions(optionsList); +} + +MultiPointTouchUi::~MultiPointTouchUi() +{ +} + +void MultiPointTouchUi::emitInputModeChanged(int newMode) +{ + emit inputModeChanged(static_cast<InputMode>(newMode)); +} + +void MultiPointTouchUi::setInputMode(MultiPointTouchUi::InputMode inputMode) +{ + switch (inputMode) { + case defaultMode: + mDefaultRadio->setChecked(true); + break; + case pinchMode: + mPinchRadio->setChecked(true); + break; + case panMode: + mPanRadio->setChecked(true); + break; + case swipeMode: + mSwipeRadio->setChecked(true); + break; + case freeMode: + mFreeRadio->setChecked(true); + break; + } + emit inputModeChanged(inputMode); +} + +void MultiPointTouchUi::getCustomGesturePath() +{ + mCustomLineEdit->setText(QFileDialog::getOpenFileName(this, tr("Choose gesture script"), + mGestureScriptPath, tr("Qt scripts (*.js *.qs)"))); + emitCustomGesturePathChanged(); +} + +void MultiPointTouchUi::emitCustomGesturePathChanged() +{ + emit customGesturePathChanged(mCustomLineEdit->text()); +} + +void MultiPointTouchUi::setGestureScriptPath(const QString &path) +{ + mGestureScriptPath = path; +} + +void MultiPointTouchUi::writeSettings(QSettings &settings) const +{ + ToolBoxPage::writeSettings(settings); + if (!QFile::exists(mCustomLineEdit->text())) + return; + + settings.beginGroup(title()); + settings.setValue("customGesturePath", mCustomLineEdit->text()); + settings.endGroup(); +} + +void MultiPointTouchUi::readSettings(QSettings &settings) +{ + ToolBoxPage::readSettings(settings); + settings.beginGroup(title()); + if (settings.contains("customGesturePath")) + mCustomLineEdit->setText(settings.value("customGesturePath").toString()); + settings.endGroup(); +} diff --git a/src/ui/multipointtouchui.h b/src/ui/multipointtouchui.h new file mode 100644 index 0000000..a427366 --- /dev/null +++ b/src/ui/multipointtouchui.h @@ -0,0 +1,89 @@ +/************************************************************************** +** +** This file is part of Qt Simulator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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. +** +**************************************************************************/ + +#ifndef MULTIPOINTTOUCHUI_H +#define MULTIPOINTTOUCHUI_H + +#include <QtCore/QObject> + +#include <remotecontrolwidget/toolbox.h> + +class MultiPointTouchUi; +class QRadioButton; +class QLineEdit; + +class MultiPointTouchUi : public ToolBoxPage +{ + Q_OBJECT +public: + enum InputMode { + defaultMode, + pinchMode, + panMode, + swipeMode, + freeMode + }; + + explicit MultiPointTouchUi(QWidget *parent = 0); + virtual ~MultiPointTouchUi(); + + void setGestureScriptPath(const QString &path); + void writeSettings(QSettings &settings) const; + void readSettings(QSettings &settings); + +signals: + void inputModeChanged(MultiPointTouchUi::InputMode newMode); + void customGesturePathChanged(const QString &path); + +private slots: + void emitInputModeChanged(int newMode); + void emitCustomGesturePathChanged(); + void getCustomGesturePath(); + +public slots: + void setInputMode(MultiPointTouchUi::InputMode inputMode); + +private: + InputMode mInputMode; + + QRadioButton *mDefaultRadio; + QRadioButton *mPinchRadio; + QRadioButton *mPanRadio; + QRadioButton *mSwipeRadio; + QRadioButton *mFreeRadio; + + QLineEdit *mCustomLineEdit; + QString mGestureScriptPath; +}; + +#endif // MULTIPOINTTOUCHUI_H diff --git a/src/ui/nfcui.cpp b/src/ui/nfcui.cpp new file mode 100644 index 0000000..6fd05ad --- /dev/null +++ b/src/ui/nfcui.cpp @@ -0,0 +1,213 @@ +/************************************************************************** +** +** This file is part of Qt Simulator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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. +** +**************************************************************************/ + + +#include "nfcui.h" +#include "targetemulator_p.h" +#include <remotecontrolwidget/optionsitem.h> + +#include <QtCore/QModelIndex> +#include <QtCore/QDirIterator> +#include <QtCore/QSettings> + +#include <QtGui/QListWidget> +#include <QtGui/QPushButton> + +#include <QtCore/QDebug> + +class NfcTargetItem : public QListWidgetItem +{ +public: + NfcTargetItem(); + virtual ~NfcTargetItem(); + + enum Roles { + NameRole = Qt::DisplayRole, + InProximity = Qt::UserRole + }; + + QVariant data(int role) const; + void setData(int role, const QVariant &value); + + TagBase *tag() const; + void setTag(TagBase *tag); + +private: + TagBase *m_tag; +}; + +NfcTargetItem::NfcTargetItem() +: m_tag(0) +{ + setData(InProximity, false); +} + +NfcTargetItem::~NfcTargetItem() +{ +} + +QVariant NfcTargetItem::data(int role) const +{ + if (role == NameRole && QListWidgetItem::data(InProximity).toBool()) { + return NfcUi::tr("%1 (in proximity)").arg(QListWidgetItem::data(NameRole).toString()); + } + + return QListWidgetItem::data(role); +} + +void NfcTargetItem::setData(int role, const QVariant &value) +{ + QListWidgetItem::setData(role, value); +} + +TagBase *NfcTargetItem::tag() const +{ + return m_tag; +} + +void NfcTargetItem::setTag(TagBase *tag) +{ + m_tag = tag; +} + +NfcUi::NfcUi(QWidget *parent) +: ToolBoxPage(parent) +{ + QList<OptionsItem *> optionsList; + + mTargets = new QListWidget(); + mTargets->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); + connect(mTargets, SIGNAL(activated(QModelIndex)), SLOT(targetActivated(QModelIndex))); + + QDirIterator nfcTargets("stubdata/nfctargets", QStringList(QLatin1String("*.nfc")), + QDir::Files); + while (nfcTargets.hasNext()) { + const QString targetFilename = nfcTargets.next(); + + QSettings target(targetFilename, QSettings::IniFormat); + + NfcTargetItem *targetItem = new NfcTargetItem; + + target.beginGroup(QLatin1String("Target")); + targetItem->setData(NfcTargetItem::NameRole, + target.value(QLatin1String("Name")).toString()); + + + const QString tagType = target.value(QLatin1String("Type")).toString(); + + target.endGroup(); + + if (tagType == QLatin1String("TagType1")) { + NfcTagType1 *tag = new NfcTagType1; + tag->load(&target); + targetItem->setTag(tag); + } else { + qWarning("Unknown tag type %s\n", qPrintable(tagType)); + } + + mTargets->addItem(targetItem); + } + + optionsList << new OptionsItem(tr("Targets"), mTargets); + + mReset = new QPushButton(tr("Reset Target")); + mReset->setToolTip(tr("Resets the selected target factory defaults.")); + connect(mReset, SIGNAL(clicked()), this, SLOT(resetTarget())); + + optionsList <<new OptionsItem(QString(), mReset, true); + + setTitle(tr("NFC")); + setOptions(optionsList); +} + +NfcUi::~NfcUi() +{ +} + +QByteArray NfcUi::processCommand(const QByteArray &command) +{ + QByteArray response; + bool collision = false; + + for (int i = 0; i < mTargets->count(); ++i) { + NfcTargetItem *targetItem = static_cast<NfcTargetItem *>(mTargets->item(i)); + // check if target is in proximity + if (!targetItem->data(NfcTargetItem::InProximity).toBool()) + continue; + + QByteArray targetResponse = targetItem->tag()->processCommand(command); + + // skip if target didn't respond (e.g. UID mismatch) + if (targetResponse.isEmpty()) + continue; + + if (response.isEmpty()) { + response = targetResponse; + } else { + collision = true; + qWarning("Collision detected, multiple NFC targets responded."); + } + } + + if (collision) + return QByteArray(); + + return response; +} + +void NfcUi::targetActivated(const QModelIndex &index) +{ + // toggle in proximity + NfcTargetItem *targetItem = static_cast<NfcTargetItem *>(mTargets->item(index.row())); + if (targetItem) { + if (targetItem->data(NfcTargetItem::InProximity).toBool()) { + targetItem->setData(NfcTargetItem::InProximity, false); + emit targetLeavingProximity(targetItem->tag()->uid()); + } else { + targetItem->setData(NfcTargetItem::InProximity, true); + emit targetEnteringProximity(targetItem->tag()->uid()); + } + } +} + +void NfcUi::resetTarget() +{ + NfcTargetItem *targetItem = static_cast<NfcTargetItem *>(mTargets->currentItem()); + if (targetItem) { + if (targetItem->data(NfcTargetItem::InProximity).toBool()) + targetItem->setData(NfcTargetItem::InProximity, false); + + qDebug() << "Need to reset" << targetItem->data(NfcTargetItem::NameRole).toString(); + } +} + diff --git a/src/ui/nfcui.h b/src/ui/nfcui.h new file mode 100644 index 0000000..d0180f8 --- /dev/null +++ b/src/ui/nfcui.h @@ -0,0 +1,66 @@ +/************************************************************************** +** +** This file is part of Qt Simulator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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. +** +**************************************************************************/ + +#ifndef NFCUI_H +#define NFCUI_H + +#include <remotecontrolwidget/toolbox.h> + +class QListWidget; +class QModelIndex; +class QPushButton; + +class NfcUi : public ToolBoxPage +{ + Q_OBJECT + +public: + explicit NfcUi(QWidget *parent = 0); + virtual ~NfcUi(); + + QByteArray processCommand(const QByteArray &command); + +signals: + void targetEnteringProximity(const QByteArray &uid); + void targetLeavingProximity(const QByteArray &uid); + +private slots: + void targetActivated(const QModelIndex &index); + void resetTarget(); + +private: + QListWidget *mTargets; + QPushButton *mReset; +}; + +#endif // NFCUI_H diff --git a/src/ui/organizerui.cpp b/src/ui/organizerui.cpp index 497a2ba..f92b943 100644 --- a/src/ui/organizerui.cpp +++ b/src/ui/organizerui.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,16 +22,19 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ #include "organizerui.h" #include "organizer.h" #include "organizertreemodel.h" - -//#include <remotecontrolwidget/optionsitem.h> +#include <remotecontrolwidget/optionsitem.h> #include <QtCore/QList> #include <QtGui/QPushButton> @@ -51,6 +54,7 @@ OrganizerUi::OrganizerUi(Organizer *organizer, QWidget *parent) QTreeView *organizerTreeView = new QTreeView(); organizerTreeView->setModel(m_organizer->organizerModel()); organizerTreeView->setHeaderHidden(true); + organizerTreeView->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); OptionsItem *item = new OptionsItem("", organizerTreeView, true); optionsList << item; diff --git a/src/ui/organizerui.h b/src/ui/organizerui.h index 0ba1604..c3e3456 100644 --- a/src/ui/organizerui.h +++ b/src/ui/organizerui.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/ui/sensorsui.cpp b/src/ui/sensorsui.cpp index d862fd8..323a702 100644 --- a/src/ui/sensorsui.cpp +++ b/src/ui/sensorsui.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,14 +22,19 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ #include "sensorsui.h" #include "configurationwidget.h" #include "accelerometercontrol.h" +#include <remotecontrolwidget/optionsitem.h> #include <QtCore/QMetaEnum> #include <QtGui/QComboBox> @@ -125,6 +130,7 @@ void SensorDoubleEdit::updateSlider() SensorsUi::SensorsUi(QWidget *parent) : ToolBoxPage(parent) , mAmbientLightBox(0) + , mLightEdit(0) , mAccelerometerXEdit(0) , mAccelerometerYEdit(0) , mAccelerometerZEdit(0) @@ -145,10 +151,19 @@ SensorsUi::SensorsUi(QWidget *parent) QList<OptionsItem *> optionsList; mAmbientLightBox = new QComboBox(); - connect(mAmbientLightBox, SIGNAL(activated(int)), SLOT(emitSensorsDataChange())); + connect(mAmbientLightBox, SIGNAL(activated(int)), SLOT(ambientLightChanged())); OptionsItem *item = new OptionsItem(tr("Ambient light"), mAmbientLightBox); optionsList << item; + mLightEdit = new SensorDoubleEdit(); + mLightEdit->setRange(0, 5000); + mLightEdit->setDecimalPlaces(0); + item = new OptionsItem(tr("Light (LUX)"), mLightEdit); + connect(mLightEdit, SIGNAL(valueChanged(double)), SLOT(lightChanged())); + item->setTags(tags); + item->setAdvanced(true); + optionsList << item; + { QWidget *control = new QWidget; QVBoxLayout *vlayout = new QVBoxLayout; @@ -189,7 +204,7 @@ SensorsUi::SensorsUi(QWidget *parent) control->setLayout(vlayout); - item = new OptionsItem(tr("Accelerometer"), control); + item = new OptionsItem(tr("Orientation"), control); item->setTags(tags); optionsList << item; } @@ -221,8 +236,10 @@ SensorsUi::SensorsUi(QWidget *parent) item->setAdvanced(true); optionsList << item; + connect(mAccelerometerControl, SIGNAL(magneticFieldChanged(QVector3D)), SLOT(setMagnetometerValue(QVector3D))); + mMagnetometerXEdit = new SensorDoubleEdit(); - mMagnetometerXEdit->setRange(0, 1); + mMagnetometerXEdit->setRange(-30, 30); mMagnetometerXEdit->setDecimalPlaces(2); item = new OptionsItem(tr("Magnetometer x"), mMagnetometerXEdit); connect(mMagnetometerXEdit, SIGNAL(valueChanged(double)), SLOT(emitSensorsDataChange())); @@ -231,7 +248,7 @@ SensorsUi::SensorsUi(QWidget *parent) optionsList << item; mMagnetometerYEdit = new SensorDoubleEdit(); - mMagnetometerYEdit->setRange(0, 1); + mMagnetometerYEdit->setRange(-30, 30); mMagnetometerYEdit->setDecimalPlaces(2); item = new OptionsItem(tr("Magnetometer y"), mMagnetometerYEdit); connect(mMagnetometerYEdit, SIGNAL(valueChanged(double)), SLOT(emitSensorsDataChange())); @@ -240,7 +257,7 @@ SensorsUi::SensorsUi(QWidget *parent) optionsList << item; mMagnetometerZEdit = new SensorDoubleEdit(); - mMagnetometerZEdit->setRange(0, 1); + mMagnetometerZEdit->setRange(-30, 30); mMagnetometerZEdit->setDecimalPlaces(2); item = new OptionsItem(tr("Magnetometer z"), mMagnetometerZEdit); connect(mMagnetometerZEdit, SIGNAL(valueChanged(double)), SLOT(emitSensorsDataChange())); @@ -260,8 +277,9 @@ SensorsUi::SensorsUi(QWidget *parent) mCompassAzimuthEdit = new SensorDoubleEdit(); mCompassAzimuthEdit->setRange(0, 360); mCompassAzimuthEdit->setDecimalPlaces(2); - item = new OptionsItem(tr("Compass azimuth"), mCompassAzimuthEdit); + item = new OptionsItem(tr("Compass Azimuth"), mCompassAzimuthEdit); connect(mCompassAzimuthEdit, SIGNAL(valueChanged(double)), SLOT(emitSensorsDataChange())); + connect(mAccelerometerControl, SIGNAL(azimuthChanged(double)), mCompassAzimuthEdit, SLOT(setValue(double))); item->setTags(tags); optionsList << item; @@ -321,6 +339,7 @@ SensorsUi::SensorsData SensorsUi::sensorsData() const { SensorsUi::SensorsData data; data.ambientLightLevel = static_cast<SensorsScriptInterface::LightLevel>(mAmbientLightBox->currentIndex()); + data.lux = mLightEdit->value(); data.accelerometerX = mAccelerometerXEdit->value(); data.accelerometerY = mAccelerometerYEdit->value(); data.accelerometerZ = mAccelerometerZEdit->value(); @@ -345,6 +364,7 @@ void SensorsUi::setSensorsData(const SensorsUi::SensorsData &data) void SensorsUi::setDisplayedSensorsData(const SensorsUi::SensorsData &data) { mAmbientLightBox->setCurrentIndex(data.ambientLightLevel); + mLightEdit->setValue(data.lux); mAccelerometerXEdit->setValue(data.accelerometerX); mAccelerometerYEdit->setValue(data.accelerometerY); mAccelerometerZEdit->setValue(data.accelerometerZ); @@ -376,6 +396,14 @@ void SensorsUi::setAccelerometerValue(const QVector3D &value) emit sensorsDataChanged(sensorsData()); } +void SensorsUi::setMagnetometerValue(const QVector3D &value) +{ + mMagnetometerXEdit->setValue(value.x(), true); + mMagnetometerYEdit->setValue(value.y(), true); + mMagnetometerZEdit->setValue(value.z(), true); + emit sensorsDataChanged(sensorsData()); +} + void SensorsUi::initializeAmbientLightOptions() { mAmbientLightBox->clear(); @@ -460,7 +488,7 @@ void SensorsScriptInterface::setAmbientLightLevel(const LightLevel &data) int index = static_cast<int>(data); if (ui->mAmbientLightBox->currentIndex() != index) { ui->mAmbientLightBox->setCurrentIndex(index); - ui->emitSensorsDataChange(); + ui->ambientLightChanged(); } } @@ -471,6 +499,20 @@ SensorsScriptInterface::LightLevel SensorsScriptInterface::ambientLightLevel() c return lightLevel; } +void SensorsScriptInterface::setLux(double lux) +{ + if (ui->mLightEdit->value() != lux) { + ui->mLightEdit->setValue(lux); + ui->lightChanged(); + } + +} + +double SensorsScriptInterface::lux() const +{ + return ui->mLightEdit->value(); +} + void SensorsScriptInterface::setAccelerometerX(double x) { if (ui->mAccelerometerXEdit->value() != x) { @@ -646,3 +688,65 @@ void SensorsUi::updateDeviceDefaultOrientation(bool isPortrait) mOrientationButtons.at(5)->setIcon(QIcon(":/ui/icons/facedown_landscape.png")); } } + +// Defines the min and max lux values that a given level has. +// These are used to add histeresis to the sensor. +// If the previous level is below a level, the lux must be at or above the minimum. +// If the previous level is above a level, the lux muyt be at or below the maximum. +static struct { + int min; + int max; +} limits[] = { + { 0, 0 }, // Undefined (not used) + { 0, 5 }, // Dark + { 10, 50 }, // Twilight + { 100, 200 }, // Light + { 500, 2000 }, // Bright + { 5000, 0 } // Sunny +}; + +void SensorsUi::ambientLightChanged() +{ + int lightLevel = mAmbientLightBox->currentIndex(); + qreal lux = limits[lightLevel].min; + mLightEdit->setValue(lux); + emitSensorsDataChange(); +} + +void SensorsUi::lightChanged() +{ + // It's unweildly dealing with these constants so make some + // local aliases that are shorter. This makes the code below + // much easier to read. + enum { + Undefined = 0, + Dark, + Twilight, + Light, + Bright, + Sunny + }; + + int lightLevel = mAmbientLightBox->currentIndex(); + qreal lux = mLightEdit->value(); + + if (lux != 0 || lightLevel != Undefined) { + // Check for change direction to allow for histeresis + if (lightLevel < Sunny && lux >= limits[Sunny ].min) lightLevel = Sunny; + else if (lightLevel < Bright && lux >= limits[Bright ].min) lightLevel = Bright; + else if (lightLevel < Light && lux >= limits[Light ].min) lightLevel = Light; + else if (lightLevel < Twilight && lux >= limits[Twilight].min) lightLevel = Twilight; + else if (lightLevel < Dark && lux >= limits[Dark ].min) lightLevel = Dark; + else if (lightLevel > Dark && lux <= limits[Dark ].max) lightLevel = Dark; + else if (lightLevel > Twilight && lux <= limits[Twilight].max) lightLevel = Twilight; + else if (lightLevel > Light && lux <= limits[Light ].max) lightLevel = Light; + else if (lightLevel > Bright && lux <= limits[Bright ].max) lightLevel = Bright; + } + + if (mAmbientLightBox->currentIndex() != lightLevel) { + mAmbientLightBox->setCurrentIndex(lightLevel); + } + + emitSensorsDataChange(); +} + diff --git a/src/ui/sensorsui.h b/src/ui/sensorsui.h index c2e1d6f..f5b6547 100644 --- a/src/ui/sensorsui.h +++ b/src/ui/sensorsui.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ @@ -36,7 +40,6 @@ #include <remotecontrolwidget/toolbox.h> -class ConfigurationWidget; class Sensors; class QComboBox; class QLineEdit; @@ -54,7 +57,9 @@ public: SensorDoubleEdit(QWidget *parent = 0); double value() const; +public slots: void setValue(double newValue, bool skipSignal = false); +public: void setRange(double min, double max); QPair<double, double> range() const; @@ -102,6 +107,7 @@ public: virtual ~SensorsScriptInterface(); Q_PROPERTY(LightLevel ambientLightLevel READ ambientLightLevel WRITE setAmbientLightLevel) + Q_PROPERTY(double lux READ lux WRITE setLux) Q_PROPERTY(double accelerometerX READ accelerometerX WRITE setAccelerometerX) Q_PROPERTY(double accelerometerY READ accelerometerY WRITE setAccelerometerY) Q_PROPERTY(double accelerometerZ READ accelerometerZ WRITE setAccelerometerZ) @@ -121,6 +127,8 @@ public: void setAmbientLightLevel(const LightLevel &data); LightLevel ambientLightLevel() const; + void setLux(double lux); + double lux() const; void setAccelerometerX(double x); double accelerometerX() const; @@ -168,6 +176,7 @@ class SensorsUi : public ToolBoxPage public: struct SensorsData { int ambientLightLevel; + double lux; double accelerometerX; double accelerometerY; double accelerometerZ; @@ -193,6 +202,8 @@ public slots: void setSensorsData(const SensorsUi::SensorsData &data); void setDisplayedSensorsData(const SensorsUi::SensorsData &data); void updateDeviceDefaultOrientation(bool isPortrait); + void ambientLightChanged(); + void lightChanged(); signals: void sensorsDataChanged(const SensorsUi::SensorsData &data) const; @@ -200,6 +211,7 @@ signals: private slots: void emitSensorsDataChange() const; void setAccelerometerValue(const QVector3D &value); + void setMagnetometerValue(const QVector3D &value); void updateTimeEditDisabled(); void updateProximityButtonText(); @@ -220,6 +232,7 @@ private: QDateTime getTimestamp() const; QComboBox *mAmbientLightBox; + SensorDoubleEdit *mLightEdit; SensorDoubleEdit *mAccelerometerXEdit; SensorDoubleEdit *mAccelerometerYEdit; diff --git a/src/ui/systeminfogenericui.cpp b/src/ui/systeminfogenericui.cpp index 1830a93..14140ab 100644 --- a/src/ui/systeminfogenericui.cpp +++ b/src/ui/systeminfogenericui.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,12 +22,17 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ #include "systeminfogenericui.h" +#include <remotecontrolwidget/optionsitem.h> #include <QtCore/QMetaEnum> #include <QtGui/QPushButton> diff --git a/src/ui/systeminfogenericui.h b/src/ui/systeminfogenericui.h index 30013dc..f5bed3a 100644 --- a/src/ui/systeminfogenericui.h +++ b/src/ui/systeminfogenericui.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/ui/systeminfonetworkui.cpp b/src/ui/systeminfonetworkui.cpp index 9f0104a..a1e704f 100644 --- a/src/ui/systeminfonetworkui.cpp +++ b/src/ui/systeminfonetworkui.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,12 +22,17 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ #include "systeminfonetworkui.h" +#include <remotecontrolwidget/optionsitem.h> #include <QtCore/QMetaEnum> #include <QtGui/QPushButton> diff --git a/src/ui/systeminfonetworkui.h b/src/ui/systeminfonetworkui.h index 8fdbab5..1323e4e 100644 --- a/src/ui/systeminfonetworkui.h +++ b/src/ui/systeminfonetworkui.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ @@ -36,7 +40,6 @@ #include <QtCore/QObject> -class ConfigurationWidget; class NetworkModeButton; class SignalStrengthButton; class QLineEdit; diff --git a/src/ui/systeminfostorageui.cpp b/src/ui/systeminfostorageui.cpp index e0f7961..93a698d 100644 --- a/src/ui/systeminfostorageui.cpp +++ b/src/ui/systeminfostorageui.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,12 +22,17 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ #include "systeminfostorageui.h" +#include <remotecontrolwidget/optionsitem.h> #include <QtCore/QMetaEnum> #include <QtGui/QPushButton> diff --git a/src/ui/systeminfostorageui.h b/src/ui/systeminfostorageui.h index 734a890..de55ebe 100644 --- a/src/ui/systeminfostorageui.h +++ b/src/ui/systeminfostorageui.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/ui/textures/N8_3D_back.png b/src/ui/textures/N8_3D_back.png Binary files differnew file mode 100644 index 0000000..dd54be0 --- /dev/null +++ b/src/ui/textures/N8_3D_back.png diff --git a/src/ui/textures/N8_3D_bottom.png b/src/ui/textures/N8_3D_bottom.png Binary files differnew file mode 100644 index 0000000..d3ce564 --- /dev/null +++ b/src/ui/textures/N8_3D_bottom.png diff --git a/src/ui/textures/N8_3D_front.png b/src/ui/textures/N8_3D_front.png Binary files differnew file mode 100644 index 0000000..b799386 --- /dev/null +++ b/src/ui/textures/N8_3D_front.png diff --git a/src/ui/textures/N8_3D_right.png b/src/ui/textures/N8_3D_right.png Binary files differnew file mode 100644 index 0000000..caf8470 --- /dev/null +++ b/src/ui/textures/N8_3D_right.png diff --git a/src/ui/textures/N8_3D_top.png b/src/ui/textures/N8_3D_top.png Binary files differnew file mode 100644 index 0000000..67deee5 --- /dev/null +++ b/src/ui/textures/N8_3D_top.png diff --git a/src/ui/textures/N900_back.png b/src/ui/textures/N900_back.png Binary files differnew file mode 100644 index 0000000..dc74ee1 --- /dev/null +++ b/src/ui/textures/N900_back.png diff --git a/src/ui/textures/N900_front.png b/src/ui/textures/N900_front.png Binary files differnew file mode 100644 index 0000000..212d6c9 --- /dev/null +++ b/src/ui/textures/N900_front.png diff --git a/src/ui/textures/N900_left.png b/src/ui/textures/N900_left.png Binary files differnew file mode 100644 index 0000000..73855c8 --- /dev/null +++ b/src/ui/textures/N900_left.png diff --git a/src/ui/textures/N900_top.png b/src/ui/textures/N900_top.png Binary files differnew file mode 100644 index 0000000..79326eb --- /dev/null +++ b/src/ui/textures/N900_top.png diff --git a/src/ui/ui.pri b/src/ui/ui.pri index 563f032..f9fc534 100644 --- a/src/ui/ui.pri +++ b/src/ui/ui.pri @@ -14,7 +14,13 @@ HEADERS += applicationtablewidget.h \ organizerui.h \ feedbackui.h \ docgalleryui.h \ - cameraui.h + cameraui.h \ + nfcui.h \ + inputscriptinterface.h \ + applicationui.h \ + viewui.h \ + multipointtouchui.h + SOURCES += applicationtablewidget.cpp \ mainwindow.cpp \ configurationwidget.cpp \ @@ -29,7 +35,13 @@ SOURCES += applicationtablewidget.cpp \ organizerui.cpp \ feedbackui.cpp \ docgalleryui.cpp \ - cameraui.cpp + cameraui.cpp \ + nfcui.cpp \ + inputscriptinterface.cpp \ + applicationui.cpp \ + viewui.cpp \ + multipointtouchui.cpp + FORMS += inspector.ui \ viewconfiguration.ui diff --git a/src/ui/ui.qrc b/src/ui/ui.qrc index 4c9a842..d1b54d8 100644 --- a/src/ui/ui.qrc +++ b/src/ui/ui.qrc @@ -13,5 +13,15 @@ <file>icons/topup_landscape.png</file> <file>icons/facedown_landscape.png</file> <file>icons/faceup_landscape.png</file> + <file>textures/N8_3D_back.png</file> + <file>textures/N8_3D_bottom.png</file> + <file>textures/N8_3D_front.png</file> + <file>textures/N8_3D_right.png</file> + <file>textures/N8_3D_top.png</file> + <file>textures/N900_back.png</file> + <file>textures/N900_front.png</file> + <file>textures/N900_left.png</file> + <file>textures/N900_top.png</file> + <file>icons/north.png</file> </qresource> </RCC> diff --git a/src/ui/viewconfiguration.cpp b/src/ui/viewconfiguration.cpp index 67ce64b..cbe133e 100644 --- a/src/ui/viewconfiguration.cpp +++ b/src/ui/viewconfiguration.cpp @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/ui/viewconfiguration.h b/src/ui/viewconfiguration.h index cfec72e..7625ebf 100644 --- a/src/ui/viewconfiguration.h +++ b/src/ui/viewconfiguration.h @@ -2,16 +2,16 @@ ** ** This file is part of Qt Simulator ** -** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** Commercial Usage +** No Commercial Usage ** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** 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 ** @@ -22,8 +22,12 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. +** 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. ** **************************************************************************/ diff --git a/src/ui/viewui.cpp b/src/ui/viewui.cpp new file mode 100644 index 0000000..726d58c --- /dev/null +++ b/src/ui/viewui.cpp @@ -0,0 +1,489 @@ +/************************************************************************** +** +** This file is part of Qt Simulator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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. +** +**************************************************************************/ + +#include <qmath.h> +#include "viewui.h" +#include "viewconfiguration.h" +#include "ui_inspector.h" +#include "configurationreader.h" +#include <remotecontrolwidget/optionsitem.h> + +#include <QtCore/QSettings> +#include <QtGui/QDesktopWidget> +#include <QtCore/QDir> +#include <QtGui/QMessageBox> +#include <QtCore/QMetaEnum> +#include <QtGui/QPushButton> + +Q_DECLARE_METATYPE(Orientation); + +ViewUi::ViewUi(const DeviceItem *deviceItem, QWidget *parent) : + ToolBoxPage(parent) + , mCorrectionFactor(1) + , mViewConfiguration(0) + , ui_inspector(new Ui_Inspector) + , mScriptInterface(0) + , mDeviceItem(deviceItem) + , mOrientationLocked(false) +{ + qRegisterMetaType<Orientation>(); + + QDesktopWidget *desktop = QApplication::desktop(); + mLogicalDpi.setWidth(desktop->logicalDpiX()); + mLogicalDpi.setHeight(desktop->logicalDpiY()); + + mScriptInterface = new ViewScriptInterface(this); + + QStringList tags; + QList<OptionsItem *> optionsList; + OptionsItem *item; + + QWidget *target = new QWidget(); + ui_inspector->setupUi(target); + item = new OptionsItem(QString(),target, true); + item->setTags(QStringList() << tr("models") << tr("rotation") << tr("size") << tr("scale")); + optionsList << item; + + mOrientationButtons = new QButtonGroup; + mOrientationButtons->setParent(ui_inspector->topUp->parent()); + mOrientationButtons->addButton(ui_inspector->topUp, static_cast<int>(topUp)); + mOrientationButtons->addButton(ui_inspector->rightUp, static_cast<int>(rightUp)); + mOrientationButtons->addButton(ui_inspector->topDown, static_cast<int>(topDown)); + mOrientationButtons->addButton(ui_inspector->leftUp, static_cast<int>(leftUp)); + connect(mOrientationButtons, SIGNAL(buttonClicked(int)), this, SLOT(changeOrientation(int))); + updateOrientationsButtonsIcons(false); + + QPushButton *dpiButton = new QPushButton(tr("Configure DPI correction")); + item = new OptionsItem(QString(), dpiButton, true); + item->setTags(QStringList() << tr("dpi")); + optionsList << item; + connect(dpiButton, SIGNAL(clicked()), SLOT(showViewConfiguration())); + + connect(ui_inspector->scaleSlider, SIGNAL(valueChanged(int)), this, SLOT(changeScaleFactor(int))); + connect(ui_inspector->deviceListView, SIGNAL(currentIndexChanged(int)), this, SLOT(changeDeviceSelection(int))); + connect(ui_inspector->rotateScreen, SIGNAL(toggled(bool)), this, SLOT(rotateScreenToggled())); + connect(this, SIGNAL(deviceSelectionChanged(const DeviceData &)), mDeviceItem, SLOT(changeDevice(const DeviceData &))); + connect(this, SIGNAL(scaleFactorChanged(qreal)), mDeviceItem, SLOT(changeScaleFactor(qreal))); + connect(this, SIGNAL(orientationChangeRequested(Orientation, bool)), + mDeviceItem, SLOT(changeOrientation(Orientation, bool))); + connect(mDeviceItem, SIGNAL(orientationChanged(Orientation)), this, SLOT(updateOrientationButtonsState(Orientation))); + connect(mDeviceItem, SIGNAL(deviceChanged(bool)), this, SLOT(updateOrientationsButtonsIcons(bool))); + + setTitle(tr("Model")); + setOptions(optionsList); +} + +int ViewUi::currentDeviceIndex() const +{ + return ui_inspector->deviceListView->currentIndex(); +} + +QString ViewUi::currentDeviceName() const +{ + return ui_inspector->deviceListView->currentText(); +} + +void ViewUi::changeDeviceSelection(int newIndex) +{ + ui_inspector->deviceListView->setCurrentIndex(newIndex); + const DeviceData &newData = deviceList.at(newIndex); + emit deviceSelectionChanged(newData); + updateOrientationButtons(newData); + changeScaleFactor(ui_inspector->scaleSlider->value()); +} + +void ViewUi::updateOrientationButtonsState(Orientation orientation) +{ + mOrientationButtons->button(orientation)->setChecked(true); +} + +void ViewUi::updateOrientationsButtonsIcons(bool standardOrientationPortrait) +{ + if (standardOrientationPortrait) { + ui_inspector->topUp->setIcon(QIcon(":/ui/icons/topup.png")); + ui_inspector->topDown->setIcon(QIcon(":/ui/icons/topdown.png")); + ui_inspector->leftUp->setIcon(QIcon(":/ui/icons/leftup.png")); + ui_inspector->rightUp->setIcon(QIcon(":/ui/icons/rightup.png")); + } else { + ui_inspector->topUp->setIcon(QIcon(":/ui/icons/topup_landscape.png")); + ui_inspector->topDown->setIcon(QIcon(":/ui/icons/topdown_landscape.png")); + ui_inspector->leftUp->setIcon(QIcon(":/ui/icons/leftup_landscape.png")); + ui_inspector->rightUp->setIcon(QIcon(":/ui/icons/rightup_landscape.png")); + } +} + +void ViewUi::updateOrientationButtons(const DeviceData &data) +{ + const bool rotateScreen = ui_inspector->rotateScreen->isChecked(); + + if (!rotateScreen || mOrientationLocked) { + ui_inspector->topUp->setEnabled(true); + ui_inspector->leftUp->setEnabled(true); + ui_inspector->rightUp->setEnabled(true); + ui_inspector->topDown->setEnabled(true); + } else { + ui_inspector->topUp->setEnabled(data.supportedOrientations & topUp); + ui_inspector->leftUp->setEnabled(data.supportedOrientations & leftUp); + ui_inspector->rightUp->setEnabled(data.supportedOrientations & rightUp); + ui_inspector->topDown->setEnabled(data.supportedOrientations & topDown); + } + + if (!mOrientationButtons->checkedButton()->isEnabled() && !data.menus.isEmpty() && !mOrientationLocked) { + Orientation fallback = data.menus.begin().key(); + if (data.supportedOrientations & fallback) + mOrientationButtons->button(fallback)->click(); + } +} + +void ViewUi::rotateScreenToggled() +{ + updateOrientationButtons(deviceList.at(currentDeviceIndex())); + + emit orientationChangeRequested(static_cast<Orientation>(mOrientationButtons->checkedId()), + ui_inspector->rotateScreen->isChecked()); +} + +void ViewUi::initializeSelection() +{ + if (deviceList.count() == 0) + return; + + ui_inspector->deviceListView->setCurrentIndex(0); + changeDeviceSelection(0); +} + +void ViewUi::changeScaleFactor(int sliderPosition) +{ + int index = currentDeviceIndex(); + if (index < 0 || index >= deviceList.size()) + return; + + const DeviceData &data = deviceList.at(index); + qreal pixelDiagonal = sqrt(pow((qreal)data.resolution.width(), 2) + pow((qreal)data.resolution.height(), 2)); + qreal displayWidthInInch = data.diagonalInInch / pixelDiagonal * data.resolution.width(); + + qreal minimalScale = mLogicalDpi.width() * displayWidthInInch / data.resolution.width() * mCorrectionFactor; + + emit scaleFactorChanged((minimalScale + qreal(sliderPosition) / 100. * (1. - minimalScale))); +} + +void ViewUi::changeCorrectionFactor(qreal newFactor) +{ + mCorrectionFactor = newFactor; + changeScaleFactor(ui_inspector->scaleSlider->value()); +} + +void ViewUi::writeSettings(QSettings &settings) const +{ + ToolBoxPage::writeSettings(settings); + + settings.beginGroup("ViewUiWidget"); + settings.setValue("scale", ui_inspector->scaleSlider->value()); + settings.setValue("corrfactor", mCorrectionFactor); + settings.setValue("viewPageVisible", isContentVisible()); + settings.setValue("rotateScreen", ui_inspector->rotateScreen->isChecked()); + + int index = currentDeviceIndex(); + if (index >= 0 && index < deviceList.size()) + settings.setValue("device", deviceList.at(index).name); + + settings.endGroup(); +} + +void ViewUi::readSettings(QSettings &settings) +{ + ToolBoxPage::readSettings(settings); + + settings.beginGroup("ViewUiWidget"); + + bool deviceFound = false; + if (settings.contains("device")) { + QString deviceName = settings.value("device").toString(); + for (int i = 0; i < deviceList.size(); ++i) { + if (deviceList.at(i).name == deviceName) { + ui_inspector->deviceListView->setCurrentIndex(i); + changeDeviceSelection(i); + deviceFound = true; + break; + } + } + } + if (!deviceFound) + initializeSelection(); + + if (settings.contains("scale")) + ui_inspector->scaleSlider->setValue(settings.value("scale").toInt()); + if (settings.contains("corrfactor")) { + changeCorrectionFactor(settings.value("corrfactor").toDouble()); + } + if (settings.contains("viewPageVisible")) { + bool viewPageVisible = settings.value("viewPageVisible").toBool(); + if (viewPageVisible) + showContent(true); + else + showContent(false); + } + if (settings.contains("rotateScreen")) + ui_inspector->rotateScreen->setChecked(settings.value("rotateScreen").toBool()); + + settings.endGroup(); +} + +void ViewUi::changeOrientation(int orientation) +{ + emit orientationChangeRequested(static_cast<Orientation>(orientation), ui_inspector->rotateScreen->isChecked()); +} + +ViewScriptInterface *ViewUi::scriptInterface() const +{ + return mScriptInterface; +} + + +bool ViewUi::initializeDeviceList() +{ + QDir modelsDir("models"); + if (!modelsDir.exists()) { + QMessageBox errorMsg; + errorMsg.setWindowTitle(tr("Folder does not exist")); + errorMsg.setText(tr("The \"%1\" folder could not be located in the installation directory.").arg(modelsDir.dirName())); + errorMsg.setIcon(QMessageBox::Critical); + errorMsg.exec(); + return false; + } + + ConfigurationReader confReader; + deviceList.clear(); + bool noErrors = confReader.processDir(&modelsDir, deviceList); + if (!noErrors && !deviceList.isEmpty()) { + QMessageBox msgbox; + msgbox.setWindowTitle(tr("Errors occurred while reading device configurations")); + msgbox.setText(confReader.errorMessageLines()); + msgbox.setIcon(QMessageBox::Critical); + msgbox.exec(); + } + + if (deviceList.isEmpty()) { + QMessageBox errorMsg; + errorMsg.setWindowTitle(tr("Devices could not be found")); + QString msg; + if (!noErrors) { + msg = confReader.errorMessageLines(); + } + msg += tr("No valid device configuration files (.config) could be found in the \"%1\" folder.").arg(modelsDir.dirName()); + errorMsg.setText(msg); + errorMsg.setIcon(QMessageBox::Critical); + errorMsg.exec(); + return false; + } + + foreach (const DeviceData &data, deviceList) + ui_inspector->deviceListView->addItem(data.name); + return true; +} + +void ViewUi::showViewConfiguration() +{ + if (!mViewConfiguration) { + mViewConfiguration = new ViewConfiguration(mCorrectionFactor, this); + connect(mViewConfiguration, SIGNAL(correctionFactorChanged(qreal)), SLOT(changeCorrectionFactor(qreal))); + } + + mViewConfiguration->exec(); +} + +void ViewUi::setOrientationLocked(bool locked) +{ + mOrientationLocked = locked; + ui_inspector->rotateScreen->setDisabled(locked); + updateOrientationButtons(deviceList.at(currentDeviceIndex())); + if (!locked) { + emit orientationChangeRequested(static_cast<Orientation>(mOrientationButtons->checkedId()), + ui_inspector->rotateScreen->isChecked()); + } +} + + +/*! + \class ViewScriptInterface + \brief Exposed as simulator. +*/ + +/*! + \property ViewScriptInterface::zoom + + \brief the device scaling + + The value can be between between 0 for real-world size and 100 for pixel equivalence. + +*/ +ViewScriptInterface::ViewScriptInterface(ViewUi *ui) + : QObject(ui), ui(ui) +{ + int enumIndex = metaObject()->indexOfEnumerator("Orientation"); + QMetaEnum metaEnum = metaObject()->enumerator(enumIndex); + for (int i = 0; i < metaEnum.keyCount(); ++i) + setProperty(metaEnum.key(i), metaEnum.key(i)); +} + +ViewScriptInterface::~ViewScriptInterface() +{ +} + +int ViewScriptInterface::zoom() const +{ + return ui->ui_inspector->scaleSlider->value(); +} + +void ViewScriptInterface::setZoom(int z) +{ + if (z < 0) + z = 0; + else if (z > 100) + z = 100; + ui->ui_inspector->scaleSlider->setValue(z); +} + +/*! + Returns the index of the current device. + + \sa setDevice(), deviceCount() +*/ +int ViewScriptInterface::currentDeviceIndex() const +{ + return ui->currentDeviceIndex(); +} + +/*! + Returns the name of the current device. + + \sa setDevice() +*/ +QString ViewScriptInterface::currentDeviceName() const +{ + return ui->currentDeviceName(); +} + +/*! + Returns the number of available device models. + + \sa setDevice(), currentDeviceIndex() +*/ +int ViewScriptInterface::deviceCount() const +{ + return ui->deviceList.size(); +} + +/*! + Sets the current device to the one with \a index. + + \sa deviceCount(), currentDeviceIndex() +*/ +void ViewScriptInterface::setDevice(int index) +{ + ui->changeDeviceSelection(index); +} + +/*! + Sets the current device to be the one identified by \a dev. + + \sa currentDeviceName() +*/ +void ViewScriptInterface::setDevice(const QString &dev) +{ + const QList<DeviceData> &devices = ui->deviceList; + for (int i = 0; i < devices.size(); ++i) { + if (devices.at(i).name == dev) { + ui->changeDeviceSelection(i); + break; + } + } +} + +/*! + Rotates the current device, and - optionally - the screen. Returns true on success. +*/ +bool ViewScriptInterface::setDeviceOrientation(QString newOrientation, bool rotateScreen) +{ + const int enumIndex = metaObject()->indexOfEnumerator("Orientation"); + const QMetaEnum metaEnum = metaObject()->enumerator(enumIndex); + + int orientation = metaEnum.keyToValue(newOrientation.toLatin1()); + + if (QAbstractButton *button = ui->mOrientationButtons->button(orientation)) { + ui->ui_inspector->rotateScreen->setChecked(rotateScreen); + if (!button->isEnabled()) + return false; + button->click(); + return true; + } + return false; +} + +/*! + Returns the current device orientation. +*/ +QString ViewScriptInterface::deviceOrientation() const +{ + const int enumIndex = metaObject()->indexOfEnumerator("Orientation"); + const QMetaEnum metaEnum = metaObject()->enumerator(enumIndex); + + return metaEnum.valueToKey(ui->mDeviceItem->deviceOrientation()); +} + +/*! + Returns the current screen orientation. +*/ +QString ViewScriptInterface::screenOrientation() const +{ + const int enumIndex = metaObject()->indexOfEnumerator("Orientation"); + const QMetaEnum metaEnum = metaObject()->enumerator(enumIndex); + + return metaEnum.valueToKey(ui->mDeviceItem->screenOrientation()); +} + +/*! + Returns the list of screen orientations. +*/ +QStringList ViewScriptInterface::supportedScreenOrientations() const +{ + const int enumIndex = metaObject()->indexOfEnumerator("Orientation"); + const QMetaEnum metaEnum = metaObject()->enumerator(enumIndex); + + QStringList ret; + foreach (::Orientation o, ui->mDeviceItem->supportedScreenOrientations()) + ret.append(metaEnum.valueToKey(o)); + + return ret; +} + diff --git a/src/ui/viewui.h b/src/ui/viewui.h new file mode 100644 index 0000000..23a92c5 --- /dev/null +++ b/src/ui/viewui.h @@ -0,0 +1,130 @@ +/************************************************************************** +** +** This file is part of Qt Simulator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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. +** +**************************************************************************/ + +#ifndef VIEWUI_H +#define VIEWUI_H + +#include "deviceitem.h" +#include <remotecontrolwidget/toolbox.h> + +class Ui_Inspector; +class QButtonGroup; +class ViewConfiguration; +class ViewScriptInterface; + +class ViewUi : public ToolBoxPage +{ + Q_OBJECT +public: + explicit ViewUi(const DeviceItem *deviceItem, QWidget *parent = 0); + + QString currentDeviceName() const; + int currentDeviceIndex() const; + void initializeSelection(); + bool initializeDeviceList(); + ViewScriptInterface * scriptInterface() const; + void writeSettings(QSettings &) const; + void readSettings(QSettings &); + + +signals: + void deviceSelectionChanged(const DeviceData &data); + void orientationChangeRequested(Orientation newOrientation, bool rotateScreen); + void scaleFactorChanged(qreal newScaleFactor); + void rotateRequested(); + +public slots: + void changeDeviceSelection(int newIndex); + void updateOrientationButtonsState(Orientation orientation); + void updateOrientationsButtonsIcons(bool standardOrientationPortrait); + void setOrientationLocked(bool locked); + +private slots: + void updateOrientationButtons(const DeviceData &data); + void rotateScreenToggled(); + void changeScaleFactor(int sliderPosition); + void changeCorrectionFactor(qreal); + void changeOrientation(int orientation); + void showViewConfiguration(); + +private: + qreal mCorrectionFactor; + ViewConfiguration *mViewConfiguration; + QSize mLogicalDpi; + Ui_Inspector *ui_inspector; + QButtonGroup *mOrientationButtons; + ViewScriptInterface *mScriptInterface; + QList<DeviceData> deviceList; + const DeviceItem *mDeviceItem; + bool mOrientationLocked; + + friend class ViewScriptInterface; +}; + +class ViewScriptInterface : public QObject +{ + Q_OBJECT +public: + ViewScriptInterface(ViewUi *ui); + virtual ~ViewScriptInterface(); + + // must mimic ::Orientation + enum Orientation { + topUp = 0x0000001, + topDown = 0x0000002, + leftUp = 0x0000004, + rightUp = 0x0000008, + }; + Q_ENUMS(Orientation); + + Q_PROPERTY(int zoom READ zoom WRITE setZoom) + + int zoom() const; + void setZoom(int z); + + Q_INVOKABLE int currentDeviceIndex() const; + Q_INVOKABLE QString currentDeviceName() const; + Q_INVOKABLE int deviceCount() const; + Q_INVOKABLE void setDevice(const QString &dev); + Q_INVOKABLE void setDevice(int index); + + Q_INVOKABLE QString deviceOrientation() const; + Q_INVOKABLE QString screenOrientation() const; + Q_INVOKABLE QStringList supportedScreenOrientations() const; + Q_INVOKABLE bool setDeviceOrientation(QString orientation, bool rotateScreen); + +private: + ViewUi *ui; +}; + +#endif // VIEWUI_H diff --git a/stubdata/nfctargets/Qt Labs Website Tag.nfc b/stubdata/nfctargets/Qt Labs Website Tag.nfc new file mode 100644 index 0000000..6840fbd --- /dev/null +++ b/stubdata/nfctargets/Qt Labs Website Tag.nfc @@ -0,0 +1,8 @@ +[Target] +Name=Qt Labs Website Tag +Type=TagType1 + +[TagType1] +HR0=17 +HR1=0 +Data=@ByteArray(wfUD3\"\x11\0\xe1\x10\xe\0\x3(\x91\x1\rT\x5\x65n_USQt LabsQ\x1\x13U\x3labs.qt.nokia.com/\xfe\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x1`\0\0\0\0\0\0) diff --git a/stubdata/nfctargets/Qt Website Tag.nfc b/stubdata/nfctargets/Qt Website Tag.nfc new file mode 100644 index 0000000..1a6c92d --- /dev/null +++ b/stubdata/nfctargets/Qt Website Tag.nfc @@ -0,0 +1,9 @@ +[Target] +Name=Qt Website Tag +UID=11:22:33:44:55:66:77 +Type=TagType1 + +[TagType1] +HR0=18 +HR1=0 +Data="@ByteArray(\x11\"3DUfw\0\xe1\x10\xff\0\x3\xff\x4*\x82\t\0\0\x3\xc0image/png\x89PNG\r\n\x1a\n\0\0\0\rIHDR\0\0\0\x39\0\0\0\x43\b\x3\0\0\0\x11\x7f]\x10\0\0\0\x1sRGB\0\xae\xce\x1c\xe9\0\0\0\xc0PLTE\x2\x43\x11\x2\x46\x1a\x4I\b\x1I#\0K\x1e\x11K'\0\0\0\0\0\0\0\0\0\x1`\0\0\0\0\0\0\0\0\0\0\0\0\0\0T\x1a\x1V\v\x10S,\x10`#\x1eZ8\xen\x10*cA\x13q\0\x1bv\x13:qO,\x82\x16\x39\x80\x42.\x8c\x1b.\x91\xfO\x7f\x63.\x95\x3;\x96\"8\x9b\x18\x36\x9f\x2^\x8bpB\xa2\x1a\x45\xa4\x1d\x43\xab\x17J\xa9\"M\xaa\x18m\x99}N\xb2\x14V\xae\x32\x80\xa1\x8bj\xadY`\xb3\x43x\xafos\xbcQy\xbeZ\x93\xb1\x9f{\xbf\x64\x92\xba\x8f\x88\xc5i\x9e\xbc\xa8\x93\xcbz\x9b\xce\x88\xb7\xcd\xbf\xba\xd0\xc2\xb1\xda\x9a\xb3\xdb\xa4\xcb\xd9\xcd\xc2\xe1\xb0\xc8\xe4\xba\xcc\xe8\xc5\xdb\xe5\xdf\xdb\xee\xd3\xe0\xf4\xd0\xe9\xf0\xec\xe8\xf3\xe1\xeb\xf6\xea\xf7\xfa\xf6\xfc\xfe\xfb\xfe\xff\xfc\xfe\x35:\x8c\0\0\0\x1\x62KGD\0\x88\x5\x1dH\0\0\0\tpHYs\0\0\v\x13\0\0\v\x13\x1\0\x9a\x9c\x18\0\0\0\atIME\a\xda\n\x1c\x5\f\t\xfc\xacP,\0\0\x2yIDATH\xc7\xed\x97k{\xda \x14\xc7\xf1\xb2\xdaj\x1b\x9dNE!q\xb4\xce\xe8\x66\xb4\xad\xb9\x38\x3\xe5\xfb\x7f\xab\x2\x41\x1bS\r\xb8\xe7\xd9\x9e\xbd\xf0\xbcJb~\xf9\xc3\xb9q\x4\xfcO\r\\\xc9\xff\x9e\x64\xec_k\xb2\xe7\xc7\xc9\x8f\xc5l\xb1\n\xb7\xf4\"2i\x83j\xf\x66\xe6N\xfd \x8c\xa9\x1d\xb9k\x82\xfa\x10#m\x12\x1fK\xfe\x35NM\xe4\b\xd4\x9c\x3\x98\xe3!\"\x8ag\xe7\xc8\xddm\xbd\xde\xf3\xd0)\x1bK}Df\xc1k\x94\xe3\xf\xe4\x6TnP\xa9\x65\xfa\xdbO\xe4\xdaHfxt\x82\xac\xe7I\xf7\x1c\x19\x97\x93\x18\xf6\x91\xeb\x8a\xf5]Jz\xf_\x97\t\xa5\xdb\xd0\xd7,\x96.\xb2!\x1b\xa3\x37\xfd\x34&\n\xed<\xf9S\x1b\xb2\x31\xfa\x88Z*P\xdc\xfd\x92\xf0\xd4Lb\xa7\xb9S\xcc\xcf\x39\xe3\x8cG\x82l\xdds\x1b\x12\x81G\x1\b\xb1~\xe3\x9b\xfc\xc1\x87\x9e\\D\xea\x9aH\xdc\xa9%\xf2>\x80\xde\0\xac\x95\xe8\x10\xcc\x5\t\x95\xb7\xca\xc8\x46[\xddO\xc7\xc8\x13\xa2\x42\xfdn\x92\x88\xe5\xd3U\xe0\x1bV[\x9d\xc8\xd7\xa9X\x9c\xda\x1f\xe7m\xf5@\xd8\xb6\x9c\x94Kc\xd9[\xd8\xb9\x95>\x9a\xd8\x91XnN\x6\x12\xea-3\x1e\xb6\x64\x94\xe8j\x15\x94\x93\xdd\xca\x46\xde\x46P_3\xfe\xfb\xa1\xc9,<\x84;\x95\xa4H:Mn\x11\x95}P\xc2O$\xfa\x8b\xe4\xb9\xd5\x1a\xc9\x13\x1e\xb2$\a\xe0\xb9\x18\x15G\xf9\xd6\x44zC\xb0<dB\xa7\xb6\x13\xd7/v\xa4\xc8>U*4\xab\x37\x99<\xc1\x83\x1d\xe9\x65\xb5\xc5\xc9!og\x96\x9aZ\x88/ r\xab#!O\x89&\xb1\xa9\xcat\xe2\x86\x87\xfaT\xdfz\xe3~\xe7\xc9-\xdf\xa7\xaeJ\xee\xf7\xb3~\xe4\xc3\xaeJ\xe\xb6\x63\xc4\xd0\x87\x6\x95\xb5\x42\xd7\x42[H\x8avYU\x85\xc7\x99\xe8\x66\xa5}H\xb5\xb0\xfd\xc9#\x13\x1dw\xef\x96\x8c\xa5\xd1/c\xd7\xf4\x9c\xfb\x8d~\x1a\xb9\xd2-\x18\xf5\bA\xa6>\xa4T{\xad\xd1&kc\xfb\x8f\x8d\xa1\xdd\xb9\x82\xbe\x37T(W\xf0\xd2\x13\tyY\xb1\xb1`ZD\xb7\xa6SP'\xa1\xf2g\xde\b3\x91\"\xdb\xd5N\v$\f\xb8QS\x86\"\xa5\x34&G \xa1\x66\x32;}\vc\xc2\x34\xe5\xdc\x66Np\x8f\x46\v1\x9a\xc4'\xa7\x9aS\x13\x6\xfc`\xd2\xf3\x93\xd4\xf1T\x93g\x98i\x6\x9b\x83\x9b#\xe6%J\x99\xe5\xc4\xb8\xac\xf6\xed\x98\"\xc9\xf8za\xc7\\\xffu\\\xc9\xbc\xbd\x3\x80M\xdfk\x14\xf5\x10\xdf\0\0\0\0IEND\xae\x42`\x82\x11\x1\x10T\x5\x65n_USQt Website\x11\x1\x1dT\x5ja_JPQt\xe3\x81\xae\xe3\x83\x9b\xe3\x83\xbc\xe3\x83\xa0\xe3\x83\x9a\xe3\x83\xbc\xe3\x82\xb8\x11\x1\x10T\x5nb_NOQt WebsideQ\x1\xeU\x3qt.nokia.com/\xfe\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0)" |