diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000..14c3c0a80
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,43 @@
+*.qm
+moc_*
+gen_*
+*.o
+*.gcno
+Makefile
+*.so
+*.so.*
+
+# vim swap files
+.*.swp
+BUILD_ID
+Makefile
+doc/html
+lib/*
+.moc
+.obj
+.*.swp
+*.o
+testdui
+*~
+*.tmp
+*moc_*
+*.log
+*.log.xml
+YES
+*-stamp
+*.gcov
+*.log.xml
+*.deb
+*.gcno
+*.old
+*.foo
+*.gcda
+*.pro.user
+*.app
+.DS_Store
+.dummy
+cscope.files
+cscope.out
+.gen
+build-i386
+build-armel
diff --git a/LICENSE.LGPL b/LICENSE.LGPL
new file mode 100644
index 000000000..5be4c8f20
--- /dev/null
+++ b/LICENSE.LGPL
@@ -0,0 +1,514 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+
+ The DirectUI Framework is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ Contact: Nokia Corporation (directui@nokia.com)
+
+ You may use, distribute and copy the DirectUI Framework under the terms of
+ GNU Lesser General Public License version 2.1, which is displayed below.
+
+-------------------------------------------------------------------------
+
+ 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.
+
+
+ Copyright (C)
+
+ 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.
+
+ , 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/README b/README
new file mode 100644
index 000000000..56356efb8
--- /dev/null
+++ b/README
@@ -0,0 +1,47 @@
+This source tree contains the DirectUI library
+
+Building
+========
+./configure
+make
+sudo make install
+
+The library will be installed by default with a prefix of /usr/local,
+see ./configure -help for options.
+
+The reference documentation can be built with "make doc",
+if doxygen is available.
+
+Running
+=======
+The library ships with a demo application called "widgetsgallery"
+
+The duitheme package must be installed before running any DirectUI
+applications.
+
+duitheme is available separately from http://qt.gitorious.org and can
+be installed with the following commands:
+ cd duitheme
+ qmake
+ sudo make install
+
+
+Build dependencies
+==================
+- Development headers:
+ - Qt 4.6
+ - X11
+ - Mesa or vendor specific OpenGL libraries
+- pkg-config
+
+Optional dependencies
+=====================
+
+If found, the following libraries will enable additional
+features in the DirectUI library:
+
+- ICU: I18N and L10N extensions
+- GConf2: C++ abstraction layer for gconf settings system
+- ContextKit context subscriber: Automatic rotation on supported hardware
+- GStreamer 0.10: Media widgets
+- DBus: Out of process applet support, out of process theme server support
diff --git a/README.win32 b/README.win32
new file mode 100644
index 000000000..b7368e382
--- /dev/null
+++ b/README.win32
@@ -0,0 +1,205 @@
+this README describes how to set up libdui on a windows
+computer.
+
+right now we support the MinGW GCC compiler and the
+Microsoft Visual Studio cl C++ compiler. this document
+describes how to compile libdui for both compilers.
+
+general prerequisites:
+
+- install git, i installed it from http://code.google.com/p/msysgit/
+
+- install perl, strawberry perl works for me.
+
+- install coreutils from gnuwin32.sf.net. this is needed, because
+ in the qmake build files there are some calls for the unix touch
+ command. and this package installs touch for windows.
+
+- install debugview. i got it from
+ http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx
+ it shows the qDebug statements that libdui will print when
+ something goes wrong.
+
+
+prerequisities for visual studio:
+
+- install visual studio, express version worked for me.
+
+- install a qt version with dbus support. either do it
+ on your own, or use the version that is distributed by
+ kde. go to http://winkde.org/pub/kde/ports/win32/installer/
+ and download the latest installer. then install kde.
+ you can install everything, but for this purpose it is important
+ to install the qt package and also the qt development package
+ (the header files etc.). kde for windows comes in two "versions",
+ one is compiles with visual studio express, and the other is
+ compiles with mingw. make sure you select to install the
+ msvc version.
+
+
+prerequisities for mingw:
+
+- install MinGW. the version that can be installed at the
+ installation routine of qt for windows is ok.
+
+- install a qt version with dbus support. either do it
+ on your own, or use the version that is distributed by
+ kde. go to http://winkde.org/pub/kde/ports/win32/installer/
+ and download the latest installer. then install kde.
+ you can install everything, but for this purpose it is important
+ to install the qt package and also the qt development package
+ (the header files etc.). kde for windows comes in two "versions",
+ one is compiles with visual studio express, and the other is
+ compiles with mingw. make sure you select to install the
+ mingw version.
+
+
+now you should have all the tools you need to build and execute libdui
+and its programs.
+
+# now you should check that youe environment is setup in a way
+# that the needed tools can be found. for the following commands,
+# execute them in a cmd.exe window and check if they are found.
+# (when you know konsole on linux as a shell window, try out
+# console2, you might like it: http://sourceforge.net/projects/console/ )
+touch
+perl
+git
+qmake
+
+# for mingw
+gcc
+g++
+make
+
+# for msvc
+cl
+nmake
+
+# if all the commands are found, you are fine. if not, you have to add
+# the pathes to these commands to your PATH environment variable,
+# like this:
+# set PATH=%PATH%;c:\KDE\bin
+
+now go to some directory, e.g. c:\dui. in the following i will
+list the commands needed to get a working widgets gallery.
+
+# go to this empty directory...
+c:
+cd \dui
+
+# now do a git checkout of duitheme
+git co git+ssh://git@dvcs.projects.maemo.org:af/duitheme
+
+# now install the theme files
+cd duitheme
+qmake
+
+# for msvc
+nmake
+nmake install
+
+# or for mingw
+make
+make install
+
+#for all
+cd ..
+
+# in this dir do a git checkout of libdui.
+# right now we still need the holger-msvc branch, but it
+# will be merged to master in short time.
+git co git+ssh://git@dvcs.projects.maemo.org:af/libdui
+
+# now switch to holger-msvc branch
+cd libdui
+git co -b holger-msvc origin/holger-msvc
+cd ..
+
+# sources are now in libdui.
+
+# now create build directory
+mkdir libduibuild
+
+cd libduibuild
+
+# run qmake
+qmake ..\libdui\projects.pro
+
+# for msvc:
+
+# run nmake to build it.
+nmake
+# currently this will fail with an error about a missing
+# duigen executable
+
+# actually right now under windows i was not able to build
+# the duigen executable in the same location no matter if
+# we build a debug or release build. for that the following
+# steps in between are needed. we build and "install" duigen
+# before we build the rest of libdui.
+cd duigen
+nmake
+nmake install
+cd ..
+
+# and now we continue with the normal libdui build
+nmake
+
+# now install libdui
+nmake install
+
+
+
+# for mingw
+# run make to build it.
+make
+# currently this will fail with an error about a missing
+# duigen executable
+
+# actually right now under windows i was not able to build
+# the duigen executable in the same location no matter if
+# we build a debug or release build. for that the following
+# steps in between are needed. we build and "install" duigen
+# before we build the rest of libdui.
+cd duigen
+make
+make install
+cd ..
+
+# and now we continue with the normal libdui build
+make
+
+# now install libdui
+make install
+
+
+
+# for all
+
+# now we built libdui and installed it, but the theme files
+# are not yet in the right places. let's see if widgetsgallery
+# tries to start anyway. it is expected that when you start
+# widgetsgallery, it only prints some output in the stderr channel
+# and exits again. first start the debugview program to catch
+# messages on stderr.
+debugview
+
+# now we set the PATH environment variable to contain the path to
+# the installed qt with dbus support. in this case we use the
+# KDE-on-windows version.
+set PATH=c:\d\kde\bin;%PATH%
+
+# now we add the directories which contain dui.dll and the executables.
+# qmake by default installs to /usr prefix. this is c:\usr\ under windows.
+set PATH=c:\usr\bin;c:\usr\lib;%PATH%
+
+# now everything that is needed should be in place.
+# start widgets gallery:
+widgetsgallery
+
+# now you should see the same widgets gallery window as you see
+# on linux.
+# if you do: Congratulations :-)
+# if you don't: contact me and i will try to help you:
+# holger.schroeder.ext@basyskom.de
diff --git a/benchmarks/.gitignore b/benchmarks/.gitignore
new file mode 100644
index 000000000..f96f45d01
--- /dev/null
+++ b/benchmarks/.gitignore
@@ -0,0 +1,14 @@
+mt_duibutton
+mt_duibuttongroup
+mt_duiimage
+mt_duilabel
+mt_duilist
+mt_duimenu
+mt_duitoolbar
+pt_duibutton
+pt_duiimage
+pt_duilist
+pt_duimenu
+pt_duiprogressindicator
+pt_duislider
+pt_duitoolbar
\ No newline at end of file
diff --git a/benchmarks/README.txt b/benchmarks/README.txt
new file mode 100644
index 000000000..a2499cfbf
--- /dev/null
+++ b/benchmarks/README.txt
@@ -0,0 +1,9 @@
+Some short instructions and notes on how to write performance benchmarks.
+
+1) Use pt_duibutton as a template - TODO:make a base class for common parts.
+2) Change file and class names as appropriate
+3) In the createView() method, change the cases of the switch statement to set the 'currentView' to a new instance of each view's class
+4) In the fetchNewRow() method, the header file, and the paintPerformance_data() method, change the columns/variables to what you want to use as variables to measure performance
+5) In the createController() method, create the controller and assign the properties appropriately
+6) In the createPaintDevice() method, you generally want to set the width and height of the target pixmap to the width being rendered, but sometimes not since things may be rendered outside this area (eg labels)
+7) In the paintPerformance() method, you generally only need a single call to paint() but some view's paint methods have different parameters, in which case you'll need a switch (eg in the duislider).
diff --git a/benchmarks/benchmarks.pro b/benchmarks/benchmarks.pro
new file mode 100644
index 000000000..9c6cc17a1
--- /dev/null
+++ b/benchmarks/benchmarks.pro
@@ -0,0 +1,25 @@
+TEMPLATE = subdirs
+
+SUBDIRS = \
+ mt_duibutton \
+ mt_duibuttongroup \
+ mt_duiimagewidget \
+ mt_duilist \
+ mt_duimenu \
+ mt_duitoolbar \
+ mt_duilabel \
+ \
+ pt_duiapplication \
+ pt_duibutton \
+ pt_duicomponentdata \
+ pt_duiimagewidget \
+ pt_duimenu \
+ pt_minimalduiapplication \
+ pt_minimalqtapplication \
+ pt_duiprogressindicator \
+ pt_qapplication \
+ pt_duislider \
+ pt_duitheme \
+ pt_duitoolbar \
+ pt_widgetsgallery \
+
diff --git a/benchmarks/common_top.pri b/benchmarks/common_top.pri
new file mode 100644
index 000000000..339402fc4
--- /dev/null
+++ b/benchmarks/common_top.pri
@@ -0,0 +1,30 @@
+DUISRCDIR = ../../src/
+STUBSDIR = ../stubs
+INCLUDEPATH += . $$DUISRCDIR $$STUBSDIR $$DUISRCDIR/include $$DUISRCDIR/core $$DUISRCDIR/widgets $$DUISRCDIR/workspace $$DUISRCDIR/style ../memorybenchmark/
+
+DEPENDPATH = $$INCLUDEPATH
+QMAKE_LIBDIR += ../../lib
+CONFIG += debug
+QT += testlib dbus svg
+TEMPLATE = app
+# DEFINES += QT_NO_DEBUG_OUTPUT
+DEFINES += UNIT_TEST
+target.path = $$[QT_INSTALL_LIBS]/libdui-benchmarks
+INSTALLS += target
+
+win32|macx {
+ macx {
+ QMAKE_LFLAGS += -F../../lib
+ LIBS += -framework dui
+ }
+ win32:LIBS += -L../../lib -ldui0
+} else {
+ LIBS += ../../lib/libdui.so
+}
+
+QMAKE_CXXFLAGS += -Werror
+support_files.files =
+support_files.path = $$[QT_INSTALL_LIBS]/libdui-benchmarks
+INSTALLS += support_files
+
+CONFIG-=app_bundle
diff --git a/benchmarks/memorybenchmark/memorybenchmark.h b/benchmarks/memorybenchmark/memorybenchmark.h
new file mode 100644
index 000000000..be2be6fd6
--- /dev/null
+++ b/benchmarks/memorybenchmark/memorybenchmark.h
@@ -0,0 +1,67 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef MEMORYBENCHMARK_H
+#define MEMORYBENCHMARK_H
+
+#include
+
+// Do not use these three methods, they produce
+// inaccurate results that are nonsense.
+void resetMemorySizeSnapshot();
+long int usedMemorySizeSnapshot();
+void printUsedMemorySizeSnapshot();
+
+/*!
+ \brief Begins memory benchmark, clears all counters
+ */
+void beginMemoryBenchmark();
+
+/*!
+ \brief Reports currently reserved memory after last beginMemoryBenchmark call
+ */
+size_t allocatedMemorySize();
+
+/*!
+ \brief Outputs the size of allocated memory
+ */
+void outputAllocatedMemorySize();
+
+/*!
+ \brief Finishes memory benchmark, clears counters and returns the amount of unfreed memory.
+ \param outputUnfreedMemory if true, outputs the amount of unfreed memory (in bytes)
+ */
+size_t endMemoryBenchmark(bool outputUnfreedMemory = false);
+
+/*!
+ \brief Starts to collect backtrace information from allocations, NOTE! this is a SLOW process.
+ */
+void beginBacktracing();
+
+/*!
+ \brief Stops collecting backtrace.
+ */
+void endBacktracing();
+
+/*!
+ \brief Prints out all allocated memory with backtrace information.
+ */
+void outputAllocatedMemoryBacktrace();
+#endif
+
diff --git a/benchmarks/memorybenchmark/memorybenchmark.inl b/benchmarks/memorybenchmark/memorybenchmark.inl
new file mode 100644
index 000000000..e08fc06b8
--- /dev/null
+++ b/benchmarks/memorybenchmark/memorybenchmark.inl
@@ -0,0 +1,222 @@
+#ifdef __APPLE__
+#include
+#else
+#include
+#endif
+
+#include
+
+long int usedMemorySize = 0;
+
+void resetMemorySizeSnapshot()
+{
+#ifdef __APPLE__
+ usedMemorySize = mstats().bytes_used;
+#else
+ usedMemorySize = mallinfo().uordblks;
+#endif
+}
+
+long int usedMemorySizeSnapshot()
+{
+#ifdef __APPLE__
+ return mstats().bytes_used - usedMemorySize;
+#else
+ return mallinfo().uordblks - usedMemorySize;
+#endif
+}
+
+void printUsedMemorySizeSnapshot()
+{
+ qDebug() << "Memory used: " << usedMemorySizeSnapshot() << " bytes";
+}
+
+#include "memorybenchmark.h"
+typedef struct Allocation_t
+{
+ void* address;
+ size_t size;
+ void* backtrace;
+ Allocation_t* prev;
+}Allocation;
+
+static size_t allocatedSize = 0;
+static Allocation* allocations = 0;
+static bool store_backtrace = false;
+
+pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+
+//For backtrace
+#include
+#include
+#include
+
+void demangleBacktrace(void* trace)
+{
+ if(trace == 0) {
+ printf("no backtrace");
+ return;
+ }
+
+ char** all_symbols = backtrace_symbols (&trace, 1);
+ char* symbol = all_symbols[0];
+
+ char* begin = 0, *end = 0;
+ int length = strlen(symbol);
+
+ for(int i=0; isize));
+ demangleBacktrace(allocation->backtrace);
+ printf("\n");
+ allocation = allocation->prev;
+ }
+ pthread_mutex_unlock( &mutex );
+}
+
+void* operator new (size_t size)
+{
+ pthread_mutex_lock( &mutex );
+ void *p=malloc(size);
+
+ if (p==0) {
+ pthread_mutex_unlock( &mutex );
+ throw std::bad_alloc(); // ANSI/ISO compliant behavior
+ }
+
+ allocatedSize += size;
+
+ Allocation* allocation = (Allocation*) malloc(sizeof(Allocation));
+ allocation->address = p;
+ allocation->size = size;
+ allocation->prev = 0;
+
+ if(allocations) {
+ allocation->prev = allocations;
+ }
+
+ allocations = allocation;
+ pthread_mutex_unlock( &mutex );
+
+ if(store_backtrace) {
+ void* trace[2];
+ backtrace(trace, 2);
+ allocation->backtrace = trace[1];
+ } else {
+ allocation->backtrace = 0;
+ }
+
+ return p;
+}
+
+#include
+void operator delete (void *p)
+{
+ pthread_mutex_lock( &mutex );
+
+ Allocation* lastProcessed = 0;
+ Allocation* allocation = allocations;
+
+ while(allocation) {
+ // check if this is the one we want
+ if(allocation->address == p) {
+
+ // reduce allocated size
+ allocatedSize -= allocation->size;
+
+ // keep the chain valid
+ if(lastProcessed) {
+ lastProcessed->prev = allocation->prev;
+ }
+
+ // chain pointer changing
+ if(allocation == allocations) {
+ allocations = allocation->prev;
+ }
+
+ free(allocation);
+ break;
+ } else {
+ // store this as last processed
+ lastProcessed = allocation;
+ // get next in list (we'll be traversing from back to start)
+ allocation = allocation->prev;
+ }
+ }
+ free(p);
+ pthread_mutex_unlock( &mutex );
+
+}
+
+void beginMemoryBenchmark()
+{
+ pthread_mutex_lock( &mutex );
+ while(allocations) {
+ Allocation* newhead = allocations->prev;
+ free(allocations);
+ allocations = newhead;
+ }
+
+ allocations = 0;
+ allocatedSize = 0;
+ pthread_mutex_unlock( &mutex );
+}
+
+size_t allocatedMemorySize()
+{
+ return allocatedSize;
+}
+
+void outputAllocatedMemorySize()
+{
+ qDebug() << "Used memory:" << allocatedMemorySize() << "bytes.";
+}
+
+size_t endMemoryBenchmark(bool outputUnfreedMemory)
+{
+ if(outputUnfreedMemory) {
+ qDebug() << "Unfreed memory: " << int(allocatedSize) << " bytes";
+ }
+ return allocatedSize;
+}
diff --git a/benchmarks/mt_duidialog/mt_duidialog.cpp b/benchmarks/mt_duidialog/mt_duidialog.cpp
new file mode 100644
index 000000000..142a5e55d
--- /dev/null
+++ b/benchmarks/mt_duidialog/mt_duidialog.cpp
@@ -0,0 +1,180 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include "memorybenchmark.h"
+#include "memorybenchmark.inl"
+#include "mt_duidialog.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+DuiApplication *app;
+
+void Mt_DuiDialog::initTestCase()
+{
+ int argc = 1;
+ const char *argv[argc];
+ char appName[] = "./widgetsgallery";
+ argv[0] = appName;
+ app = new DuiApplication(argc, (char **)argv);
+ DuiTheme::instance()->changeTheme("common");
+
+ // We need to ensure that QTs subsystems are up and running
+ // and do not affect to our benchmark
+ QPixmap pixmap(100, 30);
+ QPainter painter(&pixmap);
+ DuiDialog *dialog = new DuiDialog();
+ dialog->appearNow();
+ dialog->paint(&painter, NULL);
+ delete dialog;
+}
+
+void Mt_DuiDialog::cleanupTestCase()
+{
+ delete app;
+}
+
+void Mt_DuiDialog::testPlainDialog_data()
+{
+}
+
+void Mt_DuiDialog::testPlainDialog()
+{
+ /*
+ We want to measure how much memory will be used by dialog
+ when it's painted on a screen (buffer). We don't take into
+ account pixmap and painter. Also since graphics resource
+ loading is asynchronous we need to make sure that DuiTheme
+ daemon loaded all pictures.
+ */
+ QPixmap pixmap(DuiDeviceProfile::instance()->resolution());
+ QPainter painter(&pixmap);
+
+ beginMemoryBenchmark();
+
+ DuiDialog *dialog = new DuiDialog;
+ dialog->appearNow();
+
+ dialog->paint(&painter, NULL);
+
+ // Print used memory, it will be recorded in a log
+ outputAllocatedMemorySize();
+
+ // Release
+ delete dialog;
+
+ QCoreApplication::processEvents();
+
+ endMemoryBenchmark();
+}
+
+void Mt_DuiDialog::testQueryDialog_data()
+{
+ QTest::addColumn("buttonCount");
+
+ QTest::newRow("1 buttons") << 1;
+ QTest::newRow("2 button") << 2;
+ QTest::newRow("5 buttons") << 5;
+ QTest::newRow("10 buttons") << 10;
+ QTest::newRow("20 buttons") << 20;
+ QTest::newRow("50 buttons") << 50;
+ QTest::newRow("100 buttons") << 100;
+
+}
+void Mt_DuiDialog::testQueryDialog()
+{
+ QFETCH(int, buttonCount);
+
+ QPixmap pixmap(DuiDeviceProfile::instance()->resolution());
+ QPainter painter(&pixmap);
+
+ DuiButton **buttons = new DuiButton*[buttonCount];
+
+ beginMemoryBenchmark();
+
+ DuiQueryDialog *dialog = new DuiQueryDialog("Test");
+
+ for (int i = 0; i < buttonCount; ++i) {
+ buttons[i] = dialog->addButton(QString("Button ") + QString::number(i));
+ }
+ dialog->appearNow();
+
+ dialog->paint(&painter, NULL);
+
+ // Print used memory, it will be recorded in a log
+ outputAllocatedMemorySize();
+
+ // Release
+ delete dialog;
+
+ QCoreApplication::processEvents();
+
+ endMemoryBenchmark();
+
+ delete[] buttons;
+}
+
+
+void Mt_DuiDialog::testMessagebox_data()
+{
+ QTest::addColumn("buttons");
+
+ QTest::newRow("no buttons") << (int)(DuiMessageBoxModel::NoButton);
+ QTest::newRow("ok") << (int)(DuiMessageBoxModel::Ok);
+ QTest::newRow("ok & cancel") << (int)(DuiMessageBoxModel::Ok | DuiMessageBoxModel::Cancel);
+ QTest::newRow("ok & cancel & save") << (int)(DuiMessageBoxModel::Ok | DuiMessageBoxModel::Cancel | DuiMessageBoxModel::Save);
+ QTest::newRow("ok & cancel & save & discard") << (int)(DuiMessageBoxModel::Ok | DuiMessageBoxModel::Cancel | DuiMessageBoxModel::Save | DuiMessageBoxModel::Discard);
+}
+
+void Mt_DuiDialog::testMessagebox()
+{
+ QFETCH(int, buttons);
+ /*
+ We want to measure how much memory will be used by dialog
+ when it's painted on a screen (buffer). We don't take into
+ account pixmap and painter. Also since graphics resource
+ loading is asynchronous we need to make sure that DuiTheme
+ daemon loaded all pictures.
+ */
+ QPixmap pixmap(DuiDeviceProfile::instance()->resolution());
+ QPainter painter(&pixmap);
+
+ beginMemoryBenchmark();
+
+ DuiMessageBox *mb = new DuiMessageBox("Test messageBox", (DuiMessageBoxModel::Button) buttons);
+ mb->appearNow();
+
+ mb->paint(&painter, NULL);
+
+ // Print used memory, it will be recorded in a log
+ outputAllocatedMemorySize();
+
+ // Release
+ delete mb;
+
+ QCoreApplication::processEvents();
+
+ endMemoryBenchmark();
+}
+
+QTEST_APPLESS_MAIN(Mt_DuiDialog)
diff --git a/benchmarks/mt_duidialog/mt_duidialog.h b/benchmarks/mt_duidialog/mt_duidialog.h
new file mode 100644
index 000000000..2bd726dd7
--- /dev/null
+++ b/benchmarks/mt_duidialog/mt_duidialog.h
@@ -0,0 +1,42 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef MT_DUIDIALOG_H
+#define MT_DUIDIALOG_H
+
+#include
+#include
+
+class Mt_DuiDialog : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void initTestCase();
+ void cleanupTestCase();
+ void testPlainDialog();
+ void testPlainDialog_data();
+ void testQueryDialog();
+ void testQueryDialog_data();
+ void testMessagebox();
+ void testMessagebox_data();
+};
+
+#endif
+
diff --git a/benchmarks/mt_duidialog/mt_duidialog.pro b/benchmarks/mt_duidialog/mt_duidialog.pro
new file mode 100644
index 000000000..ed53e1b60
--- /dev/null
+++ b/benchmarks/mt_duidialog/mt_duidialog.pro
@@ -0,0 +1,8 @@
+include(../common_top.pri)
+INCLUDEPATH += ../../src/include
+DEPENDPATH += ../../src/include
+TARGET = mt_duidialog
+
+SOURCES += mt_duidialog.cpp
+
+HEADERS += mt_duidialog.h
diff --git a/benchmarks/mt_duiimagewidget/.gitignore b/benchmarks/mt_duiimagewidget/.gitignore
new file mode 100644
index 000000000..6312969a1
--- /dev/null
+++ b/benchmarks/mt_duiimagewidget/.gitignore
@@ -0,0 +1 @@
+mt_duiimagewidget
diff --git a/benchmarks/mt_duiimagewidget/mt_duiimagewidget.cpp b/benchmarks/mt_duiimagewidget/mt_duiimagewidget.cpp
new file mode 100644
index 000000000..a550e5687
--- /dev/null
+++ b/benchmarks/mt_duiimagewidget/mt_duiimagewidget.cpp
@@ -0,0 +1,78 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include "mt_duiimagewidget.h"
+
+#include "memorybenchmark.h"
+#include "memorybenchmark.inl"
+
+#include
+#include
+#include
+#include
+#include
+
+DuiApplication *app;
+
+void Mt_DuiImageWidget::initTestCase()
+{
+ int argc = 1;
+ char *app_name = (char *) "./mt_duiimage";
+ app = new DuiApplication(argc, &app_name);
+ DuiTheme::addPixmapDirectory(QCoreApplication::applicationDirPath());
+}
+
+void Mt_DuiImageWidget::cleanupTestCase()
+{
+ delete app;
+}
+
+void Mt_DuiImageWidget::memory300over300png()
+{
+ int width = 300, height = 300;
+ QString imagename("test");
+
+ // create pixmap paintdevice
+ QPixmap pixmap(width, height);
+ pixmap.fill(QColor(0, 0, 0, 0));
+ QPainter painter(&pixmap);
+
+ beginMemoryBenchmark();
+
+ DuiImageWidget *image = new DuiImageWidget();
+
+ image->setImage(imagename);
+ image->setGeometry(QRectF(0, 0, width, height));
+
+ while (DuiTheme::hasPendingRequests()) {
+ usleep(10000);
+ QCoreApplication::processEvents();
+ }
+
+ image->paint(&painter, NULL);
+
+ // Print used memory, it will be recorded in a log
+ outputAllocatedMemorySize();
+
+ delete image;
+ endMemoryBenchmark();
+}
+
+QTEST_APPLESS_MAIN(Mt_DuiImageWidget)
+
diff --git a/benchmarks/mt_duiimagewidget/mt_duiimagewidget.h b/benchmarks/mt_duiimagewidget/mt_duiimagewidget.h
new file mode 100644
index 000000000..33a9404d2
--- /dev/null
+++ b/benchmarks/mt_duiimagewidget/mt_duiimagewidget.h
@@ -0,0 +1,37 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef MT_DUIIMAGEWIDGET_H
+#define MT_DUIIMAGEWIDGET_H
+
+#include
+#include
+
+class Mt_DuiImageWidget : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void initTestCase();
+ void cleanupTestCase();
+ void memory300over300png();
+};
+
+#endif
+
diff --git a/benchmarks/mt_duiimagewidget/mt_duiimagewidget.pro b/benchmarks/mt_duiimagewidget/mt_duiimagewidget.pro
new file mode 100644
index 000000000..cf611d546
--- /dev/null
+++ b/benchmarks/mt_duiimagewidget/mt_duiimagewidget.pro
@@ -0,0 +1,8 @@
+
+include(../common_top.pri)
+INCLUDEPATH += ../../src/include
+DEPENDPATH += ../../src/include
+TARGET = mt_duiimagewidget
+
+SOURCES += mt_duiimagewidget.cpp
+HEADERS += mt_duiimagewidget.h
diff --git a/benchmarks/mt_duiimagewidget/test.png b/benchmarks/mt_duiimagewidget/test.png
new file mode 100755
index 000000000..23c523367
Binary files /dev/null and b/benchmarks/mt_duiimagewidget/test.png differ
diff --git a/benchmarks/mt_duiprogressindicator/mt_duiprogressindicator.cpp b/benchmarks/mt_duiprogressindicator/mt_duiprogressindicator.cpp
new file mode 100644
index 000000000..7e918b19c
--- /dev/null
+++ b/benchmarks/mt_duiprogressindicator/mt_duiprogressindicator.cpp
@@ -0,0 +1,145 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include "memorybenchmark.h"
+#include "memorybenchmark.inl"
+#include "mt_duiprogressindicator.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+DuiApplication *app;
+
+void Mt_DuiProgressIndicator::initTestCase()
+{
+ int argc = 1;
+ const char *argv[argc];
+ char appName[] = "./widgetsgallery";
+ argv[0] = appName;
+ app = new DuiApplication(argc, (char **)argv);
+ DuiTheme::instance()->changeTheme("common");
+
+ // We need to warmup QTs painters and probably
+ // some other subsystems
+ QPixmap pixmap(100, 30);
+ QPainter painter(&pixmap);
+ DuiProgressIndicator *progressindicator = new DuiProgressIndicator();
+ progressindicator->setGeometry(QRectF(0, 0, 100, 100));
+ while (DuiTheme::hasPendingRequests()) {
+ usleep(10000);
+ QCoreApplication::processEvents();
+ }
+ progressindicator->paint(&painter, NULL);
+ delete progressindicator;
+}
+
+void Mt_DuiProgressIndicator::cleanupTestCase()
+{
+ delete app;
+}
+
+void Mt_DuiProgressIndicator::memoryBenchmark()
+{
+ QFETCH(qint32, width);
+ QFETCH(qint32, height);
+ QFETCH(qint32, viewIndex);
+ QFETCH(int, count);
+
+ ViewName currentViewName = (ViewName)viewIndex;
+ DuiWidgetView *currentView;
+
+ /*
+ We want to measure how much memory will be used by progressindicator
+ when it's painted on a screen (buffer). We don't take into
+ account pixmap and painter. Also since graphics resource
+ loading is asynchronous we need to make sure that DuTheme
+ deamon loaded all pictures.
+ */
+ QPixmap pixmap(width, height);
+ QPainter painter(&pixmap);
+
+ QList progressindicators;
+
+ beginMemoryBenchmark();
+
+ // Create as many progressindicators as needed
+ for (int i = 0; i < count; ++i) {
+ DuiProgressIndicator *progressindicator = new DuiProgressIndicator();
+ progressindicator->setMinimumSize(width, height);
+ progressindicator->setMaximumSize(width, height);
+ progressindicator->setRange(0, 100);
+ progressindicator->setValue(50);
+ switch (currentViewName) {
+ case Default:
+ currentView = new DuiProgressIndicatorCircularView(progressindicator);
+ break;
+ case Bar:
+ currentView = new DuiProgressIndicatorBarView(progressindicator);
+ break;
+ default:
+ break;
+ }
+ if (currentView) {
+ progressindicator->setView(currentView); // transfers ownership to controller
+ }
+ progressindicators.append(progressindicator);
+ }
+
+ while (DuiTheme::hasPendingRequests()) {
+ usleep(10000);
+ QCoreApplication::processEvents();
+ }
+
+ // Paint all progressindicators
+ foreach(DuiProgressIndicator * progressindicator, progressindicators) {
+ progressindicator->paint(&painter, NULL);
+ }
+
+ // Print used memory, it will be recorded in a log
+ outputAllocatedMemorySize();
+
+ // Release all progressindicators
+ qDeleteAll(progressindicators);
+
+ endMemoryBenchmark();
+
+
+}
+
+void Mt_DuiProgressIndicator::memoryBenchmark_data()
+{
+ QTest::addColumn("width");
+ QTest::addColumn("height");
+ QTest::addColumn("viewIndex");
+ QTest::addColumn("count");
+
+ for (qint32 viewIndex = FirstView; viewIndex < NoViews; viewIndex++) {
+ for (int i = 1; i < 5; ++i) {
+ QTest::newRow("864x64") << 864 / 2 << 64 << viewIndex << i;
+ QTest::newRow("864x128") << 864 / 2 << 128 << viewIndex << i;
+ }
+ }
+}
+
+QTEST_APPLESS_MAIN(Mt_DuiProgressIndicator)
+
diff --git a/benchmarks/mt_duiprogressindicator/mt_duiprogressindicator.h b/benchmarks/mt_duiprogressindicator/mt_duiprogressindicator.h
new file mode 100644
index 000000000..179d3683c
--- /dev/null
+++ b/benchmarks/mt_duiprogressindicator/mt_duiprogressindicator.h
@@ -0,0 +1,47 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef MT_DUIPROGRESSINDICATOR_H
+#define MT_DUIPROGRESSINDICATOR_H
+
+#include
+#include
+
+class Mt_DuiProgressIndicator : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void initTestCase();
+ void cleanupTestCase();
+ void memoryBenchmark();
+ void memoryBenchmark_data();
+
+private:
+ enum ViewName {
+ FirstView = 0,
+ Default = 0,
+ Bar,
+ NoViews
+ };
+
+};
+
+#endif
+
diff --git a/benchmarks/mt_duiprogressindicator/mt_duiprogressindicator.pro b/benchmarks/mt_duiprogressindicator/mt_duiprogressindicator.pro
new file mode 100644
index 000000000..309855508
--- /dev/null
+++ b/benchmarks/mt_duiprogressindicator/mt_duiprogressindicator.pro
@@ -0,0 +1,7 @@
+include(../common_top.pri)
+INCLUDEPATH += ../../src/include
+DEPENDPATH += ../../src/include
+TARGET = mt_duiprogressindicator
+
+SOURCES += mt_duiprogressindicator.cpp
+HEADERS += mt_duiprogressindicator.h
diff --git a/benchmarks/performancebenchmark/emptymainloophelper.cpp b/benchmarks/performancebenchmark/emptymainloophelper.cpp
new file mode 100644
index 000000000..7d3061fa7
--- /dev/null
+++ b/benchmarks/performancebenchmark/emptymainloophelper.cpp
@@ -0,0 +1,59 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include "emptymainloophelper.h"
+
+#include
+#include
+
+#include
+
+
+EmptyMainLoopHelper::EmptyMainLoopHelper()
+{
+}
+
+void EmptyMainLoopHelper::triggerTermination(TerminationType type)
+{
+ terminationType = type;
+ QTimer::singleShot(0, this, SLOT(terminateOnEmptyMainLoop()));
+}
+
+void EmptyMainLoopHelper::terminateOnEmptyMainLoop()
+{
+ if (qApp->hasPendingEvents()) {
+ QTimer::singleShot(0, this, SLOT(terminateOnEmptyMainLoop()));
+ } else {
+ QTimer::singleShot(20, this, SLOT(terminateOnEmptyMainLoop2()));
+ }
+}
+
+void EmptyMainLoopHelper::terminateOnEmptyMainLoop2()
+{
+ if (qApp->hasPendingEvents()) {
+ QTimer::singleShot(0, this, SLOT(terminateOnEmptyMainLoop()));
+ } else {
+ if (terminationType == ExitOnEmpty) {
+ exit(0);
+ } else {
+ qApp->quit();
+ }
+ }
+}
+
diff --git a/benchmarks/performancebenchmark/emptymainloophelper.h b/benchmarks/performancebenchmark/emptymainloophelper.h
new file mode 100644
index 000000000..bb48fa29b
--- /dev/null
+++ b/benchmarks/performancebenchmark/emptymainloophelper.h
@@ -0,0 +1,58 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef EMPTYMAINLOOPHELPER_H
+#define EMPTYMAINLOOPHELPER_H
+
+#include
+
+/**
+ * \class EmptyMainLoopHelper
+ * \brief Allows to terminate the application when the main loop is empty.
+ */
+class EmptyMainLoopHelper : public QObject
+{
+ Q_OBJECT
+public:
+ enum TerminationType { ExitOnEmpty, QuitOnEmpty };
+
+ EmptyMainLoopHelper();
+
+ /**
+ * Once this method is called the application is terminated as soon as the main loop is empty.
+ * /param Defines how the application will be terminated.
+ */
+ void triggerTermination(TerminationType type);
+
+public slots:
+ /**
+ * Exit the application if main loop is empty in combination with terminateOnEmptyMainLoop2().
+ */
+ void terminateOnEmptyMainLoop();
+
+ /**
+ * Called by terminateOnEmptyMainLoop() to terminate app if main loop is really empty.
+ */
+ void terminateOnEmptyMainLoop2();
+
+private:
+ TerminationType terminationType;
+};
+
+#endif // EMPTYMAINLOOPHELPER_H
diff --git a/benchmarks/pt_duiapplication/.gitignore b/benchmarks/pt_duiapplication/.gitignore
new file mode 100644
index 000000000..c33f4e95a
--- /dev/null
+++ b/benchmarks/pt_duiapplication/.gitignore
@@ -0,0 +1 @@
+pt_duiapplication
diff --git a/benchmarks/pt_duiapplication/pt_duiapplication.cpp b/benchmarks/pt_duiapplication/pt_duiapplication.cpp
new file mode 100644
index 000000000..757f3f972
--- /dev/null
+++ b/benchmarks/pt_duiapplication/pt_duiapplication.cpp
@@ -0,0 +1,95 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include
+#include
+
+#include
+
+#include "pt_duiapplication.h"
+
+/*
+ Test how long it takes to launch an application which is quitting immediately.
+*/
+void Pt_DuiApplication::processCreation()
+{
+ executeSelf(QLatin1String("--exit-immediately"));
+}
+
+void Pt_DuiApplication::processCreationAndCtor()
+{
+ executeSelf(QLatin1String("--exit-after-qapp"));
+}
+
+void Pt_DuiApplication::ctor()
+{
+ DuiApplication *a;
+ QBENCHMARK {
+ int fakeArgc = 1;
+ char *fakeArgv[fakeArgc];
+ char appName[] = "./pt_duiapplication";
+ fakeArgv[0] = appName;
+ a = new DuiApplication(fakeArgc, fakeArgv);
+ }
+ delete a;
+}
+
+void Pt_DuiApplication::ctor2()
+{
+ DuiApplication *a;
+ QBENCHMARK {
+ int fakeArgc = 1;
+ char *fakeArgv[fakeArgc];
+ char appName[] = "./pt_duiapplication2";
+ fakeArgv[0] = appName;
+ a = new DuiApplication(fakeArgc, fakeArgv);
+ }
+ delete a;
+}
+
+void Pt_DuiApplication::executeSelf(const QLatin1String ¶meter)
+{
+ QProcess proc;
+ const QString program = "./pt_duiapplication";
+ const QStringList arguments = QStringList() << QLatin1String(parameter);
+
+ QBENCHMARK {
+ proc.start(program, arguments);
+ QVERIFY(proc.waitForStarted());
+ QVERIFY(proc.waitForFinished());
+ QCOMPARE(proc.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(proc.exitCode(), 0);
+ }
+}
+
+int main(int argc, char **argv)
+{
+ if (argc == 2 && QLatin1String("--exit-immediately") == QLatin1String(argv[1])) {
+ return 0;
+ }
+
+ if (argc == 2 && QLatin1String("--exit-after-qapp") == QLatin1String(argv[1])) {
+ DuiApplication app(argc, argv);
+ return 0;
+ }
+
+ Pt_DuiApplication test;
+ return QTest::qExec(&test, argc, argv);
+}
+
diff --git a/benchmarks/pt_duiapplication/pt_duiapplication.h b/benchmarks/pt_duiapplication/pt_duiapplication.h
new file mode 100644
index 000000000..a24b868cf
--- /dev/null
+++ b/benchmarks/pt_duiapplication/pt_duiapplication.h
@@ -0,0 +1,63 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef PT_QAPPLICATION_H
+#define PT_QAPPLICATION_H
+
+#include
+
+/**
+ * Test performance oif the DuiApplication constructor.
+ * The constructor is created in process and as part of a newly created process.
+ */
+class Pt_DuiApplication : public QObject
+{
+ Q_OBJECT
+private slots:
+ /**
+ * Test how long it takes to launch an application which is quitting immediately.
+ */
+ void processCreation();
+
+ /**
+ * Test the performance of the duiapplication constructor.
+ *
+ * This test creates a new process and thus includes process creation overhead.
+ * Callgrind results are meaningless since the child process is not traced.
+ */
+ void processCreationAndCtor();
+
+ /**
+ * Test the performance of the duiapplication constructor.
+ */
+ void ctor();
+
+ /**
+ * Execute the constructor a second time to evaluate caching possibilities.
+ */
+ void ctor2();
+
+private:
+ /**
+ * Executes the current programm with a given parameter.
+ */
+ void executeSelf(const QLatin1String ¶meter);
+};
+
+#endif // PT_QAPPLICATION_H
diff --git a/benchmarks/pt_duiapplication/pt_duiapplication.pro b/benchmarks/pt_duiapplication/pt_duiapplication.pro
new file mode 100644
index 000000000..c94f71a8f
--- /dev/null
+++ b/benchmarks/pt_duiapplication/pt_duiapplication.pro
@@ -0,0 +1,4 @@
+include(../common_top.pri)
+TARGET = pt_duiapplication
+SOURCES = pt_duiapplication.cpp
+HEADERS += pt_duiapplication.h
diff --git a/benchmarks/pt_duicomponentdata/.gitignore b/benchmarks/pt_duicomponentdata/.gitignore
new file mode 100644
index 000000000..af554a4c5
--- /dev/null
+++ b/benchmarks/pt_duicomponentdata/.gitignore
@@ -0,0 +1 @@
+pt_duicomponentdata
diff --git a/benchmarks/pt_duicomponentdata/pt_duicomponentdata.cpp b/benchmarks/pt_duicomponentdata/pt_duicomponentdata.cpp
new file mode 100644
index 000000000..c95629538
--- /dev/null
+++ b/benchmarks/pt_duicomponentdata/pt_duicomponentdata.cpp
@@ -0,0 +1,39 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include "pt_duicomponentdata.h"
+
+#include
+#include
+
+void Pt_DuiComponentData::constructor()
+{
+ int argc = 1;
+ char *argv[argc];
+ char appName[] = "./widgetsgallery";
+ argv[0] = appName;
+
+ DuiComponentData *componentData;
+ QBENCHMARK_ONCE {
+ componentData = new DuiComponentData(argc, argv, appName);
+ }
+ delete componentData;
+}
+
+QTEST_MAIN(Pt_DuiComponentData)
diff --git a/benchmarks/pt_duicomponentdata/pt_duicomponentdata.h b/benchmarks/pt_duicomponentdata/pt_duicomponentdata.h
new file mode 100644
index 000000000..dd7a3908f
--- /dev/null
+++ b/benchmarks/pt_duicomponentdata/pt_duicomponentdata.h
@@ -0,0 +1,42 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef PT_DuiComponentData_H
+#define PT_DuiComponentData_H
+
+#include
+#include
+
+class DuiComponentData;
+class DuiWidgetView;
+
+/**
+ * DuiApplication constructor spends most of its runtime creating a
+ * DuiComponentData object. This test benchmarks the DuiComponentData
+ * creation.
+ */
+class Pt_DuiComponentData : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void constructor();
+};
+
+#endif
diff --git a/benchmarks/pt_duicomponentdata/pt_duicomponentdata.pro b/benchmarks/pt_duicomponentdata/pt_duicomponentdata.pro
new file mode 100644
index 000000000..c90bf4025
--- /dev/null
+++ b/benchmarks/pt_duicomponentdata/pt_duicomponentdata.pro
@@ -0,0 +1,7 @@
+include(../common_top.pri)
+INCLUDEPATH += ../../src/include
+DEPENDPATH += $$INCLUDEPATH
+TARGET = pt_duicomponentdata
+
+SOURCES += pt_duicomponentdata.cpp
+HEADERS += pt_duicomponentdata.h
diff --git a/benchmarks/pt_duiicontestcase/pt_duiicontestcase.cpp b/benchmarks/pt_duiicontestcase/pt_duiicontestcase.cpp
new file mode 100644
index 000000000..6cc58372e
--- /dev/null
+++ b/benchmarks/pt_duiicontestcase/pt_duiicontestcase.cpp
@@ -0,0 +1,146 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "pt_duiicontestcase.h"
+
+DuiApplication *app;
+
+void Pt_DuiButton::initTestCase()
+{
+ int argc = 1;
+ const char *argv[argc];
+ char appName[] = "./eternia";
+ argv[0] = appName;
+ app = new DuiApplication(argc, (char **)argv);
+ DuiTheme::instance()->changeTheme("common");
+ DuiTheme::addPixmapDirectory("images/", true);
+
+ currentViewIndex = 0;
+}
+
+void Pt_DuiButton::cleanupTestCase()
+{
+ delete app;
+}
+
+void Pt_DuiButton::init()
+{
+ // get size dimensions for test
+ QFETCH(qint32, viewIndex);
+ QFETCH(qint32, width);
+ QFETCH(qint32, height);
+
+ this->currentViewIndex = viewIndex;
+ this->width = width;
+ this->height = height;
+
+ // create widget, set size
+ m_subject = new DuiButton();
+
+ m_subject->setObjectName("MyButton2");
+ m_subject->setText("SILENCE!");
+ m_subject->setMinimumSize(width, height);
+ m_subject->setMaximumSize(width, height);
+
+ // create wanted view
+ views[ this->currentViewIndex ] = new DuiButtonView(m_subject);
+
+ m_subject->setView(views[ this->currentViewIndex ]); // transfers ownership to controller
+ m_subject->setIconID("Icon-mute");
+
+ views[ this->currentViewIndex ]->updateStyle();
+ views[ this->currentViewIndex ]->styleUpdated();
+
+ // if this is paced above 'updateStyle()', then get a core dump; if above setView(), then no icon
+ //m_subject->setIconID("Icon-mute");
+ qDebug() << "ICONID" << m_subject->iconID();
+
+ sleep(1);
+ QCoreApplication::processEvents();
+
+ // create pixmap paintdevice
+ pixmap = new QPixmap(width, height);
+ pixmap->fill(Qt::black);
+ painter = new QPainter(pixmap);
+}
+
+void Pt_DuiButton::cleanup()
+{
+ // save a shot (for debugging)
+#define SCREENSHOT
+#ifdef SCREENSHOT
+ QString kuva;
+ QTextStream(&kuva)
+ << "view_"
+ << this->currentViewIndex
+ << "_"
+ << m_subject->size().width()
+ << "x"
+ << m_subject->size().height()
+ << ".png";
+ if (!written.contains(kuva)) {
+ pixmap->save(kuva, "png", -1);
+ written.append(kuva);
+ }
+#endif
+
+ // delete m_subject;
+ // m_subject = 0;
+ // if you call 'setView()' on this, then the controller owns the object
+ //delete view;
+ //view = 0;
+ delete painter;
+ painter = 0;
+ delete pixmap;
+ pixmap = 0;
+
+}
+
+void Pt_DuiButton::paintPerformance()
+{
+ // actual benchmark
+ //QBENCHMARK
+ {
+ views[ currentViewIndex ]->paint(painter, NULL);
+ }
+}
+
+void Pt_DuiButton::paintPerformance_data()
+{
+ QTest::addColumn("width");
+ QTest::addColumn("height");
+ QTest::addColumn("viewIndex");
+
+ QTest::newRow("864x480") << 864 << 480 << 0;
+}
+
+QTEST_APPLESS_MAIN(Pt_DuiButton)
diff --git a/benchmarks/pt_duiicontestcase/pt_duiicontestcase.h b/benchmarks/pt_duiicontestcase/pt_duiicontestcase.h
new file mode 100644
index 000000000..1090b6a6d
--- /dev/null
+++ b/benchmarks/pt_duiicontestcase/pt_duiicontestcase.h
@@ -0,0 +1,71 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef PT_DUIICONTESTCASE_H
+#define PT_DUIICONTESTCASE_H
+
+#include
+#include
+
+class DuiButton;
+class DuiButtonView;
+class DuiButtonIconView;
+class DuiButtonObjectMenuItemView;
+class DuiButtonSpinView;
+class DuiButtonViewMenuItemView;
+class DuiButtonViewMenuView;
+class DuiWidgetView;
+
+class Pt_DuiButton : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void init();
+ void cleanup();
+ void initTestCase();
+ void cleanupTestCase();
+
+ // paint handler performance
+
+ void paintPerformance();
+ void paintPerformance_data();
+
+private:
+ DuiButton *m_subject;
+ enum ViewName {
+ View = 0,
+ IconView,
+ ObjectMenuItemView,
+ SpinView,
+ ViewMenuItemView,
+ ViewMenuView,
+ NoViews
+ };
+ DuiWidgetView *views[ NoViews ];
+
+ qint32 currentViewIndex;
+ QPixmap *pixmap;
+ QPainter *painter;
+ qint32 width;
+ qint32 height;
+ QList written;
+};
+
+#endif
diff --git a/benchmarks/pt_duiicontestcase/pt_duiicontestcase.pro b/benchmarks/pt_duiicontestcase/pt_duiicontestcase.pro
new file mode 100644
index 000000000..e2010ce1b
--- /dev/null
+++ b/benchmarks/pt_duiicontestcase/pt_duiicontestcase.pro
@@ -0,0 +1,7 @@
+include(../common_top.pri)
+INCLUDEPATH += ../../src/include
+DEPENDPATH += ../../src/include
+TARGET = pt_duiicontestcase
+
+SOURCES += pt_duiicontestcase.cpp
+HEADERS += pt_duiicontestcase.h
diff --git a/benchmarks/pt_duiimagewidget/.gitignore b/benchmarks/pt_duiimagewidget/.gitignore
new file mode 100644
index 000000000..df395f070
--- /dev/null
+++ b/benchmarks/pt_duiimagewidget/.gitignore
@@ -0,0 +1 @@
+pt_duiimagewidget
diff --git a/benchmarks/pt_duiimagewidget/pt_duiimagewidget.cpp b/benchmarks/pt_duiimagewidget/pt_duiimagewidget.cpp
new file mode 100644
index 000000000..e0ee29ee3
--- /dev/null
+++ b/benchmarks/pt_duiimagewidget/pt_duiimagewidget.cpp
@@ -0,0 +1,104 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include "pt_duiimagewidget.h"
+
+#include
+#include
+#include
+#include
+#include
+
+
+DuiApplication *app;
+
+void Pt_DuiImageWidget::initTestCase()
+{
+ int argc = 1;
+ char *app_name = (char *) "./pt_duiimage";
+ app = new DuiApplication(argc, &app_name);
+ DuiTheme::addPixmapDirectory(QCoreApplication::applicationDirPath());
+
+ m_subject = new DuiImageWidget();
+}
+
+void Pt_DuiImageWidget::cleanupTestCase()
+{
+ delete m_subject;
+ delete app;
+}
+
+void Pt_DuiImageWidget::paintPerformance_data()
+{
+ //wait for the resource loading to finish
+ while (DuiTheme::instance()->hasPendingRequests()) {
+ usleep(100);
+ QCoreApplication::processEvents();
+ }
+
+ QTest::addColumn("width");
+ QTest::addColumn("height");
+ QTest::addColumn("imagename");
+
+ QTest::newRow("300x300 PNG") << 300 << 300 << "testpng";
+ QTest::newRow("300x300 SVG") << 300 << 300 << "Layer_1";
+
+ // fullscreen
+ QTest::newRow("864x480 PNG") << 864 << 480 << "testpng";
+ QTest::newRow("864x480 SVG") << 864 << 480 << "Layer_1";
+}
+
+void Pt_DuiImageWidget::paintPerformance()
+{
+ QFETCH(qint32, width);
+ QFETCH(qint32, height);
+ QFETCH(QString, imagename);
+
+ m_subject->setImage(imagename);
+ m_subject->setGeometry(QRectF(0, 0, width, height));
+
+ // create pixmap paintdevice
+ QPixmap *pixmap = new QPixmap(width, height);
+ pixmap->fill(QColor(0, 0, 0, 0));
+ QPainter *painter = new QPainter(pixmap);
+
+ // actual benchmark
+ QBENCHMARK {
+ m_subject->paint(painter, NULL);
+ }
+
+ // save a shot (for debugging)
+#ifdef SCREENSHOT
+
+ QStringList list;
+ list.append(imagename);
+ list.append(QString::number(this->m_subject->size().width()));
+ list.append(QString::number(this->m_subject->size().height()));
+
+ QString kuva = list.join("_") + ".png";
+ pixmap->save(kuva, "png", -1);
+
+#endif
+
+ delete painter;
+ delete pixmap;
+}
+
+
+QTEST_APPLESS_MAIN(Pt_DuiImageWidget)
diff --git a/benchmarks/pt_duiimagewidget/pt_duiimagewidget.h b/benchmarks/pt_duiimagewidget/pt_duiimagewidget.h
new file mode 100644
index 000000000..20cd75f8e
--- /dev/null
+++ b/benchmarks/pt_duiimagewidget/pt_duiimagewidget.h
@@ -0,0 +1,46 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef PT_DUIIMAGEWIDGET_H
+#define PT_DUIIMAGEWIDGET_H
+
+#include
+#include
+
+class DuiImageWidget;
+class DuiImageWidgetView;
+
+class Pt_DuiImageWidget : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void initTestCase();
+ void cleanupTestCase();
+
+ // paint handler performance
+ void paintPerformance();
+ void paintPerformance_data();
+
+private:
+ DuiImageWidget *m_subject;
+
+};
+
+#endif
diff --git a/benchmarks/pt_duiimagewidget/pt_duiimagewidget.pro b/benchmarks/pt_duiimagewidget/pt_duiimagewidget.pro
new file mode 100644
index 000000000..08d62511c
--- /dev/null
+++ b/benchmarks/pt_duiimagewidget/pt_duiimagewidget.pro
@@ -0,0 +1,7 @@
+include(../common_top.pri)
+INCLUDEPATH += ../../src/include ../../src/theme
+DEPENDPATH += $$INCLUDEPATH
+TARGET = pt_duiimagewidget
+
+SOURCES += pt_duiimagewidget.cpp
+HEADERS += pt_duiimagewidget.h
diff --git a/benchmarks/pt_duiimagewidget/testpng.png b/benchmarks/pt_duiimagewidget/testpng.png
new file mode 100755
index 000000000..23c523367
Binary files /dev/null and b/benchmarks/pt_duiimagewidget/testpng.png differ
diff --git a/benchmarks/pt_duiimagewidget/testsvg.svg b/benchmarks/pt_duiimagewidget/testsvg.svg
new file mode 100644
index 000000000..cfbb3f1bc
--- /dev/null
+++ b/benchmarks/pt_duiimagewidget/testsvg.svg
@@ -0,0 +1,15954 @@
+
+
+
+
diff --git a/benchmarks/pt_duilabel/pt_duilabel.cpp b/benchmarks/pt_duilabel/pt_duilabel.cpp
new file mode 100644
index 000000000..c6d25c492
--- /dev/null
+++ b/benchmarks/pt_duilabel/pt_duilabel.cpp
@@ -0,0 +1,134 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include
+#include
+#include
+#include
+#include
+
+#include "pt_duilabel.h"
+
+DuiApplication *app;
+
+void Pt_DuiLabel::initTestCase()
+{
+ int argc = 1;
+ const char *argv[argc];
+ char appName[] = "./eternia";
+ argv[0] = appName;
+ app = new DuiApplication(argc, (char **)argv);
+ DuiTheme::instance()->changeTheme("common");
+
+ currentViewIndex = 0;
+}
+
+void Pt_DuiLabel::cleanupTestCase()
+{
+ delete app;
+}
+
+void Pt_DuiLabel::init()
+{
+ // get size dimensions for test
+ QFETCH(QString, text);
+ QFETCH(qint32, viewIndex);
+
+ this->currentViewIndex = viewIndex;
+
+ // create widget, set size
+ m_subject = new DuiLabel(text);
+
+ m_subject->setMaximumWidth(864);
+
+ switch (this->currentViewIndex) {
+ case View:
+ this->currentView = new DuiLabelView(m_subject);
+ break;
+ }
+
+ this->currentView->updateStyle();
+ //this->currentView->styleUpdated();
+
+ // There is no DuiLabel::setView() so this is the one from
+ // DuiWidgetController, which is private, so need to be friends
+ m_subject->setView(this->currentView); // transfers ownership to controller
+
+ // wait for the image loading
+ usleep(1000000);
+ QCoreApplication::processEvents();
+
+ // create pixmap paintdevice
+ pixmap = new QPixmap(846, 480);
+ pixmap->fill(QColor(0, 0, 0, 0));
+ painter = new QPainter(pixmap);
+}
+
+void Pt_DuiLabel::cleanup()
+{
+ // save a shot (for debugging)
+#define SCREENSHOT
+#ifdef SCREENSHOT
+ QString kuva;
+ QTextStream(&kuva)
+ << "view_"
+ << this->currentViewIndex
+ << "_"
+ << m_subject->size().width()
+ << "x"
+ << m_subject->size().height()
+ << ".png";
+ if (!written.contains(kuva)) {
+ pixmap->save(kuva, "png", -1);
+ written.append(kuva);
+ }
+#endif
+
+ delete m_subject;
+ m_subject = 0;
+
+ delete painter;
+ painter = 0;
+ delete pixmap;
+ pixmap = 0;
+
+}
+
+void Pt_DuiLabel::paintPerformance()
+{
+ // actual benchmark
+ QBENCHMARK {
+ this->currentView->paint(painter, NULL);
+ }
+}
+
+void Pt_DuiLabel::paintPerformance_data()
+{
+ QTest::addColumn("text");
+ QTest::addColumn("viewIndex");
+
+ for (qint32 viewIndex = 0; viewIndex < NoViews; viewIndex++) {
+ // typical icon sizes
+ QTest::newRow("plaintext") << "Silence!" << viewIndex;
+ QTest::newRow("richtext") << "Silence! I kill you!" << viewIndex;
+ QTest::newRow("veryrich") << "
Very rich text, multi line label
The phrase \"to be, or not to be\" comes from William Shakespeare's Hamlet (written about 1600), act three, scene one. It is one of the most famous quotations in world literature and the best-known of this particular play...
And tables...
Cell 1
Cell 2
" << viewIndex;
+ }
+}
+
+QTEST_APPLESS_MAIN(Pt_DuiLabel)
diff --git a/benchmarks/pt_duilabel/pt_duilabel.h b/benchmarks/pt_duilabel/pt_duilabel.h
new file mode 100644
index 000000000..d2392b061
--- /dev/null
+++ b/benchmarks/pt_duilabel/pt_duilabel.h
@@ -0,0 +1,60 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef PT_DUILABEL_H
+#define PT_DUILABEL_H
+
+#include
+#include
+
+class DuiLabel;
+class DuiWidgetView;
+
+class Pt_DuiLabel : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void init();
+ void cleanup();
+ void initTestCase();
+ void cleanupTestCase();
+
+ // paint handler performance
+
+ void paintPerformance();
+ void paintPerformance_data();
+
+private:
+ DuiLabel *m_subject;
+ enum ViewName {
+ View = 0,
+ NoViews
+ };
+ DuiWidgetView *currentView;
+
+ qint32 currentViewIndex;
+ QPixmap *pixmap;
+ QPainter *painter;
+ qint32 width;
+ qint32 height;
+ QList written;
+};
+
+#endif
diff --git a/benchmarks/pt_duilabel/pt_duilabel.pro b/benchmarks/pt_duilabel/pt_duilabel.pro
new file mode 100644
index 000000000..3d3e6a0f2
--- /dev/null
+++ b/benchmarks/pt_duilabel/pt_duilabel.pro
@@ -0,0 +1,7 @@
+include(../common_top.pri)
+INCLUDEPATH += ../../src/include
+DEPENDPATH += ../../src/include
+TARGET = pt_duilabel
+
+SOURCES += pt_duilabel.cpp
+HEADERS += pt_duilabel.h
diff --git a/benchmarks/pt_duiscalableimage/pt_duiscalableimage.cpp b/benchmarks/pt_duiscalableimage/pt_duiscalableimage.cpp
new file mode 100644
index 000000000..a30ef4eb3
--- /dev/null
+++ b/benchmarks/pt_duiscalableimage/pt_duiscalableimage.cpp
@@ -0,0 +1,206 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include
+#include
+#include
+#include
+#include
+#include "duiglrenderer.h"
+
+#include "pt_duiscalableimage.h"
+
+#ifdef DUI_USE_OPENGL
+#include
+#endif
+
+DuiApplication *app;
+#ifdef DUI_USE_OPENGL
+QGLWidget *glw = NULL;
+#endif
+void Pt_DuiScalableImage::initTestCase()
+{
+ int argc = 1;
+ char *app_name = (char *) "./pt_duiscalableimage";
+ app = new DuiApplication(argc, &app_name);
+#ifdef DUI_USE_OPENGL
+ glw = new QGLWidget();
+ DuiGLRenderer::instance()->initGL(glw);
+#endif
+}
+
+void Pt_DuiScalableImage::cleanupTestCase()
+{
+#ifdef DUI_USE_OPENGL
+ delete glw;
+#endif
+ delete app;
+}
+
+void Pt_DuiScalableImage::init()
+{
+ //wait for the resource loading to finish
+ while (DuiTheme::instance()->hasPendingRequests()) {
+ usleep(100);
+ QCoreApplication::processEvents();
+ }
+}
+
+void Pt_DuiScalableImage::paintScalablePerformance_data()
+{
+ QTest::addColumn("width");
+ QTest::addColumn("height");
+ QTest::addColumn("HW");
+ QTest::addColumn("useGLRenderer");
+
+ QTest::newRow("300x300 SW") << 300 << 300 << false << false;
+ QTest::newRow("300x300 HW !DuiGLRenderer") << 300 << 300 << true << false;
+ QTest::newRow("300x300 HW DuiGLRenderer") << 300 << 300 << true << true;
+}
+
+void Pt_DuiScalableImage::paintScalablePerformance()
+{
+ QFETCH(qint32, width);
+ QFETCH(qint32, height);
+ QFETCH(bool, HW);
+ QFETCH(bool, useGLRenderer);
+
+ DuiScalableImage *image = const_cast(DuiTheme::scalableImage("stretchbutton", 11, 11, 11, 11));
+ image->enableOptimizedRendering(useGLRenderer);
+
+ QPainter painter;
+ QPixmap *pixmap = NULL;
+ if (!HW) {
+ pixmap = new QPixmap(width, height);
+ pixmap->fill(QColor(255, 255, 255, 255));
+ painter.begin(pixmap);
+ } else {
+#ifdef DUI_USE_OPENGL
+ glw->resize(width, height);
+ DuiGLRenderer::instance()->initGL(glw);
+ painter.begin(glw);
+ painter.fillRect(0, 0, width, height, QColor(255, 255, 255, 255));
+#else
+ qWarning("Cannot run HW test.");
+#endif
+ }
+
+ // actual benchmark
+ if (painter.isActive()) {
+ QBENCHMARK {
+ image->draw(0, 0, width, height, &painter);
+ }
+ painter.end();
+ }
+ // save a shot (for debugging)
+#define SCREENSHOT
+#ifdef SCREENSHOT
+ QString kuva;
+ kuva.sprintf("scalable_%d_%d_%d_%d.png", width, height, HW, useGLRenderer);
+ if (pixmap)
+ pixmap->save(kuva, "png", -1);
+ else {
+#ifdef DUI_USE_OPENGL
+ glw->grabFrameBuffer().save(kuva, "png", -1);
+#endif
+ }
+#endif
+ delete pixmap;
+ DuiTheme::releaseScalableImage(image);
+}
+
+void Pt_DuiScalableImage::paintPixmapPerformance_data()
+{
+ QTest::addColumn("width");
+ QTest::addColumn("height");
+ QTest::addColumn("HW");
+ QTest::addColumn("useGLRenderer");
+
+ QTest::newRow("300x300 SW") << 300 << 300 << false << false;
+ QTest::newRow("300x300 HW !DuiGLRenderer") << 300 << 300 << true << false;
+ QTest::newRow("300x300 HW DuiGLRenderer") << 300 << 300 << true << true;
+}
+
+
+void Pt_DuiScalableImage::paintPixmapPerformance()
+{
+ QFETCH(qint32, width);
+ QFETCH(qint32, height);
+ QFETCH(bool, HW);
+ QFETCH(bool, useGLRenderer);
+
+ const QPixmap *image = DuiTheme::pixmap("stretchbutton", QSize(width, height));
+ //glw->bindTexture(*image);
+ //((MyScalable*)image)->setUseDuiGLRenderer(useGLRenderer);
+ //wait for the resource loading to finish
+ while (DuiTheme::instance()->hasPendingRequests()) {
+ usleep(100);
+ QCoreApplication::processEvents();
+ }
+ QPainter painter;
+ QPixmap *pixmap = NULL;
+ if (!HW) {
+ pixmap = new QPixmap(width, height);
+ pixmap->fill(QColor(255, 255, 255, 255));
+ painter.begin(pixmap);
+ } else {
+#ifdef DUI_USE_OPENGL
+ glw->resize(width, height);
+ painter.begin(glw);
+ painter.fillRect(0, 0, width, height, QColor(255, 255, 255, 255));
+#else
+ qWarning("Cannot run HW test.");
+#endif
+ }
+
+ //warmup
+ //painter.drawPixmap(0, 0, *image);
+
+ // actual benchmark
+ if (painter.isActive()) {
+ if (useGLRenderer) {
+#ifdef DUI_USE_OPENGL
+ QBENCHMARK {
+ DuiGLRenderer::instance()->drawPixmap(painter.combinedTransform(), *image, 1.0);
+ }
+#endif
+ } else {
+ QBENCHMARK {
+ painter.drawPixmap(0, 0, *image);
+ }
+ }
+ painter.end();
+ }
+ // save a shot (for debugging)
+#define SCREENSHOT
+#ifdef SCREENSHOT
+ QString kuva;
+ kuva.sprintf("pixmap_%d_%d_%d_%d.png", width, height, HW, useGLRenderer);
+ if (pixmap)
+ pixmap->save(kuva, "png", -1);
+ else {
+#ifdef DUI_USE_OPENGL
+ glw->grabFrameBuffer().save(kuva, "png", -1);
+#endif
+ }
+#endif
+ delete pixmap;
+ DuiTheme::releasePixmap(image);
+}
+QTEST_APPLESS_MAIN(Pt_DuiScalableImage)
diff --git a/benchmarks/pt_duiscalableimage/pt_duiscalableimage.h b/benchmarks/pt_duiscalableimage/pt_duiscalableimage.h
new file mode 100644
index 000000000..690755fe6
--- /dev/null
+++ b/benchmarks/pt_duiscalableimage/pt_duiscalableimage.h
@@ -0,0 +1,43 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef PT_DUISCALABLEIMAGE_H
+#define PT_DUISCALABLEIMAGE_H
+
+#include
+#include
+
+class Pt_DuiScalableImage : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void init();
+ void initTestCase();
+ void cleanupTestCase();
+
+ void paintScalablePerformance();
+ void paintScalablePerformance_data();
+
+ void paintPixmapPerformance();
+ void paintPixmapPerformance_data();
+
+};
+
+#endif
diff --git a/benchmarks/pt_duiscalableimage/pt_duiscalableimage.pro b/benchmarks/pt_duiscalableimage/pt_duiscalableimage.pro
new file mode 100644
index 000000000..b68ac9c46
--- /dev/null
+++ b/benchmarks/pt_duiscalableimage/pt_duiscalableimage.pro
@@ -0,0 +1,12 @@
+include(../common_top.pri)
+INCLUDEPATH += ../../src/include ../../src/theme ../../src/painting
+DEPENDPATH += $$INCLUDEPATH
+TARGET = pt_duiscalableimage
+
+SOURCES += pt_duiscalableimage.cpp
+HEADERS += pt_duiscalableimage.h
+
+exists($$[QT_INSTALL_LIBS]/libQtOpenGL.so) {
+ QT += opengl
+}
+
diff --git a/benchmarks/pt_duitheme/.gitignore b/benchmarks/pt_duitheme/.gitignore
new file mode 100644
index 000000000..af554a4c5
--- /dev/null
+++ b/benchmarks/pt_duitheme/.gitignore
@@ -0,0 +1 @@
+pt_duicomponentdata
diff --git a/benchmarks/pt_duitheme/pt_duitheme.cpp b/benchmarks/pt_duitheme/pt_duitheme.cpp
new file mode 100644
index 000000000..f018b09ed
--- /dev/null
+++ b/benchmarks/pt_duitheme/pt_duitheme.cpp
@@ -0,0 +1,36 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include "pt_duitheme.h"
+
+#include
+#include
+
+#include
+
+void Pt_DuiTheme::constructor()
+{
+ DuiTheme *theme;
+ QBENCHMARK_ONCE {
+ theme = new DuiTheme("widgetsgallery");
+ }
+ delete theme;
+}
+
+QTEST_MAIN(Pt_DuiTheme)
diff --git a/benchmarks/pt_duitheme/pt_duitheme.h b/benchmarks/pt_duitheme/pt_duitheme.h
new file mode 100644
index 000000000..0857aaca2
--- /dev/null
+++ b/benchmarks/pt_duitheme/pt_duitheme.h
@@ -0,0 +1,39 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef PT_DUITHEME_H
+#define PT_DUITHEME_H
+
+#include
+
+class DuiComponentData;
+class DuiWidgetView;
+
+/**
+ * This test benchmarks the DuiTheme creation.
+ */
+class Pt_DuiTheme : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void constructor();
+};
+
+#endif
diff --git a/benchmarks/pt_duitheme/pt_duitheme.pro b/benchmarks/pt_duitheme/pt_duitheme.pro
new file mode 100644
index 000000000..9466e7c2f
--- /dev/null
+++ b/benchmarks/pt_duitheme/pt_duitheme.pro
@@ -0,0 +1,7 @@
+include(../common_top.pri)
+INCLUDEPATH += ../../src/include
+DEPENDPATH += $$INCLUDEPATH
+TARGET = pt_duitheme
+
+SOURCES += pt_duitheme.cpp
+HEADERS += pt_duitheme.h
diff --git a/benchmarks/pt_minimalduiapplication/.gitignore b/benchmarks/pt_minimalduiapplication/.gitignore
new file mode 100644
index 000000000..7ec3f4621
--- /dev/null
+++ b/benchmarks/pt_minimalduiapplication/.gitignore
@@ -0,0 +1 @@
+pt_minimalduiapplication
diff --git a/benchmarks/pt_minimalduiapplication/pt_minimalduiapplication.cpp b/benchmarks/pt_minimalduiapplication/pt_minimalduiapplication.cpp
new file mode 100644
index 000000000..e40727300
--- /dev/null
+++ b/benchmarks/pt_minimalduiapplication/pt_minimalduiapplication.cpp
@@ -0,0 +1,151 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include "pt_minimalduiapplication.h"
+#include "../performancebenchmark/emptymainloophelper.h"
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+#define MY_QBENCHMARK_ONCE(CODE) \
+ if (!noBenchmark) \
+ QBENCHMARK_ONCE { \
+ CODE \
+ } else { \
+ CODE \
+ }
+
+Pt_minimalduiapplication::Pt_minimalduiapplication()
+ : appearType("appear"), noBenchmark(false)
+{
+}
+
+int Pt_minimalduiapplication::executeAll()
+{
+ noBenchmark = true;
+
+ createDuiLocale();
+ createDuiApplicationWindow();
+ windowShow();
+ createDuiApplicationPage();
+ pageAppear();
+
+ // terminate as soon as startup is complete and the main loop is empty
+ EmptyMainLoopHelper mainLoopHelper;
+ mainLoopHelper.triggerTermination(EmptyMainLoopHelper::ExitOnEmpty);
+
+ return qApp->exec();
+}
+
+void Pt_minimalduiapplication::createDuiLocale()
+{
+ MY_QBENCHMARK_ONCE(
+ locale = new DuiLocale();
+ )
+}
+
+void Pt_minimalduiapplication::createDuiApplicationWindow()
+{
+ MY_QBENCHMARK_ONCE(
+ window = new DuiApplicationWindow();
+ )
+}
+
+void Pt_minimalduiapplication::windowShow()
+{
+ MY_QBENCHMARK_ONCE(
+ window->show();
+ )
+}
+
+void Pt_minimalduiapplication::createDuiApplicationPage()
+{
+ MY_QBENCHMARK_ONCE(
+ page = new DuiApplicationPage();
+ )
+}
+
+void Pt_minimalduiapplication::pageAppear()
+{
+ if (appearType == "appear") {
+ MY_QBENCHMARK_ONCE(page->appear();)
+ } else {
+ MY_QBENCHMARK_ONCE(page->appearNow();)
+ }
+}
+
+void Pt_minimalduiapplication::overallRuntime()
+{
+ executeSelf("appear");
+}
+
+void Pt_minimalduiapplication::overallRuntimeAppearNow()
+{
+ executeSelf("appearNow");
+}
+
+void Pt_minimalduiapplication::executeSelf(const QString ¶m)
+{
+ QProcess proc;
+ const QString program = QCoreApplication::applicationFilePath();
+ const QStringList arguments = QStringList() << QLatin1String("--exit-immediately") << param;
+
+ QBENCHMARK {
+ // execute ourselve and check for success
+ proc.start(program, arguments);
+ QVERIFY(proc.waitForStarted());
+ QVERIFY(proc.waitForFinished());
+ QCOMPARE(proc.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(proc.exitCode(), 0);
+ }
+}
+
+int main(int argc, char **argv)
+{
+ // fake arc and argv to use the remote theme daemon
+ int fakeArgc = 2;
+ char *fakeArgv[fakeArgc];
+ char remoteTheme[] = "-remote-theme";
+ fakeArgv[1] = remoteTheme;
+ char appName[] = "./pt_minimalduiapplication";
+ fakeArgv[0] = appName;
+
+ if (argc >= 3 && strcmp("--exit-immediately", argv[1]) == 0
+ && (strcmp("appear", argv[2]) == 0 || strcmp("appearNow", argv[2]) == 0)) {
+ // a DuiApplication can just run once. create the second one with a different name
+ char appName[] = "./pt_minimalduiapplication2";
+ fakeArgv[0] = appName;
+ DuiApplication a(fakeArgc, fakeArgv);
+
+ Pt_minimalduiapplication test;
+ test.appearType = argv[2];
+ return test.executeAll();
+ }
+
+ DuiApplication a(fakeArgc, fakeArgv);
+ Pt_minimalduiapplication test;
+
+ return QTest::qExec(&test, argc, argv);
+}
diff --git a/benchmarks/pt_minimalduiapplication/pt_minimalduiapplication.h b/benchmarks/pt_minimalduiapplication/pt_minimalduiapplication.h
new file mode 100644
index 000000000..df99d5819
--- /dev/null
+++ b/benchmarks/pt_minimalduiapplication/pt_minimalduiapplication.h
@@ -0,0 +1,63 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef PT_MINIMALDUIAPPLICATION_H
+#define PT_MINIMALDUIAPPLICATION_H
+
+#include
+
+class DuiLocale;
+class DuiApplicationWindow;
+class DuiApplicationPage;
+
+/**
+ Benchmark runtime of a simple DUI application.
+ All elements are benchmarked individually and the whole application is benchmarked at once.
+ */
+class Pt_minimalduiapplication : public QObject
+{
+ Q_OBJECT
+public:
+ Pt_minimalduiapplication();
+
+ /**
+ * Execute a whole simple DUI application by calling the slots from below.
+ */
+ int executeAll();
+
+ QString appearType;
+private slots:
+ void overallRuntime();
+ void overallRuntimeAppearNow();
+ void createDuiLocale();
+ void createDuiApplicationWindow();
+ void windowShow();
+ void createDuiApplicationPage();
+ void pageAppear();
+
+private:
+ void executeSelf(const QString ¶m);
+ bool noBenchmark;
+
+ DuiLocale *locale;
+ DuiApplicationWindow *window;
+ DuiApplicationPage *page;
+};
+
+#endif // PT_MINIMALDUIAPPLICATION_H
diff --git a/benchmarks/pt_minimalduiapplication/pt_minimalduiapplication.pro b/benchmarks/pt_minimalduiapplication/pt_minimalduiapplication.pro
new file mode 100644
index 000000000..9372a9655
--- /dev/null
+++ b/benchmarks/pt_minimalduiapplication/pt_minimalduiapplication.pro
@@ -0,0 +1,6 @@
+include(../common_top.pri)
+TARGET = pt_minimalduiapplication
+SOURCES = pt_minimalduiapplication.cpp \
+ ../performancebenchmark/emptymainloophelper.cpp
+HEADERS += pt_minimalduiapplication.h \
+ ../performancebenchmark/emptymainloophelper.h
diff --git a/benchmarks/pt_minimalqtapplication/pt_minimalqtapplication.cpp b/benchmarks/pt_minimalqtapplication/pt_minimalqtapplication.cpp
new file mode 100644
index 000000000..f8dfad6ca
--- /dev/null
+++ b/benchmarks/pt_minimalqtapplication/pt_minimalqtapplication.cpp
@@ -0,0 +1,143 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+#include "pt_minimalqtapplication.h"
+
+#define MY_QBENCHMARK_ONCE(CODE) \
+ if (!noBenchmark) \
+ QBENCHMARK_ONCE { \
+ CODE \
+ } else { \
+ CODE \
+ }
+
+Pt_minimalqtapplication::Pt_minimalqtapplication()
+ : noBenchmark(false)
+{
+}
+
+int Pt_minimalqtapplication::executeAll()
+{
+ noBenchmark = true;
+
+ createAndShowMainWindowAndGraphicsView();
+ createGraphicsScene();
+ createGLWidget();
+ setupGraphicsView();
+ drawSomething();
+
+ QTimer::singleShot(0, qApp, SLOT(quit()));
+ return qApp->exec();
+}
+
+void Pt_minimalqtapplication::createAndShowMainWindowAndGraphicsView()
+{
+ MY_QBENCHMARK_ONCE(
+ window = new QMainWindow();
+ window->show();
+
+ graphicsView = new QGraphicsView(window);
+ window->setCentralWidget(graphicsView);
+
+ )
+}
+
+void Pt_minimalqtapplication::createGraphicsScene()
+{
+ MY_QBENCHMARK_ONCE(
+ graphicsScene = new QGraphicsScene(graphicsView);
+ graphicsView->setScene(graphicsScene);
+ )
+}
+
+void Pt_minimalqtapplication::createGLWidget()
+{
+ MY_QBENCHMARK_ONCE(
+ QGLFormat fmt;
+ // disable multisampling, is enabled by default in Qt
+ fmt.setSampleBuffers(false);
+ fmt.setSamples(0);
+
+ glWidget = new QGLWidget(fmt);
+ )
+}
+
+void Pt_minimalqtapplication::setupGraphicsView()
+{
+ MY_QBENCHMARK_ONCE(
+ QSize screenSize(864, 480);
+
+ graphicsView->setOptimizationFlag(QGraphicsView::DontSavePainterState);
+ graphicsView->resize(screenSize);
+ graphicsView->setFrameStyle(0);
+ graphicsView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ graphicsView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ graphicsView->setSceneRect(QRectF(QPointF(), screenSize));
+ graphicsView->centerOn(graphicsView->sceneRect().center());
+ graphicsView->setBackgroundBrush(Qt::black);
+ )
+}
+
+void Pt_minimalqtapplication::drawSomething()
+{
+ MY_QBENCHMARK_ONCE(
+ QPen pen(Qt::green);
+ graphicsScene->addRect(QRect(50, 50, 100, 100), pen);
+ graphicsScene->addRect(QRect(150, 150, 100, 100), pen);
+ )
+}
+
+void Pt_minimalqtapplication::overallRuntime()
+{
+ QProcess proc;
+ const QString program = QCoreApplication::applicationFilePath();
+ const QStringList arguments = QStringList() << QLatin1String("--exit-immediately");
+
+ QBENCHMARK_ONCE {
+ // execute ourselve and check for success
+ proc.start(program, arguments);
+ QVERIFY(proc.waitForStarted());
+ QVERIFY(proc.waitForFinished());
+ QCOMPARE(proc.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(proc.exitCode(), 0);
+ }
+}
+
+int main(int argc, char **argv)
+{
+
+ QApplication a(argc, argv);
+ Pt_minimalqtapplication test;
+
+ if (argc >= 2 && strcmp("--exit-immediately", argv[1]) == 0) {
+ return test.executeAll();
+ }
+
+ return QTest::qExec(&test, argc, argv);
+}
diff --git a/benchmarks/pt_minimalqtapplication/pt_minimalqtapplication.h b/benchmarks/pt_minimalqtapplication/pt_minimalqtapplication.h
new file mode 100644
index 000000000..85b0779e0
--- /dev/null
+++ b/benchmarks/pt_minimalqtapplication/pt_minimalqtapplication.h
@@ -0,0 +1,63 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef PT_MINIMALQTAPPLICATION_H
+#define PT_MINIMALQTAPPLICATION_H
+
+#include
+
+class QMainWindow;
+class QGraphicsScene;
+class QGraphicsView;
+class QGLWidget;
+
+/**
+ * Benchmark runtime of a simple Qt application. It mimics a minimal DUI application and therefor
+ * creates QGraphicsView/QGraphicsscene and initializes them.
+ * All elements are benchmarked individually and the whole application is benchmarked at once.
+ */
+class Pt_minimalqtapplication : public QObject
+{
+ Q_OBJECT
+public:
+ Pt_minimalqtapplication();
+
+ /**
+ * Execute a whole simple Qt application by calling the slots from below.
+ */
+ int executeAll();
+
+private slots:
+ void overallRuntime();
+ void createAndShowMainWindowAndGraphicsView();
+ void createGraphicsScene();
+ void createGLWidget();
+ void setupGraphicsView();
+ void drawSomething();
+
+private:
+ bool noBenchmark;
+
+ QMainWindow *window;
+ QGraphicsScene *graphicsScene;
+ QGraphicsView *graphicsView;
+ QGLWidget *glWidget;
+};
+
+#endif // PT_MINIMALQTAPPLICATION_H
diff --git a/benchmarks/pt_minimalqtapplication/pt_minimalqtapplication.pro b/benchmarks/pt_minimalqtapplication/pt_minimalqtapplication.pro
new file mode 100644
index 000000000..e6f7cf64b
--- /dev/null
+++ b/benchmarks/pt_minimalqtapplication/pt_minimalqtapplication.pro
@@ -0,0 +1,7 @@
+include(../common_top.pri)
+
+QT += opengl
+
+TARGET = pt_minimalqtapplication
+SOURCES = pt_minimalqtapplication.cpp
+HEADERS += pt_minimalqtapplication.h
diff --git a/benchmarks/pt_qapplication/.gitignore b/benchmarks/pt_qapplication/.gitignore
new file mode 100644
index 000000000..142dd6bd0
--- /dev/null
+++ b/benchmarks/pt_qapplication/.gitignore
@@ -0,0 +1 @@
+pt_qapplication
diff --git a/benchmarks/pt_qapplication/pt_qapplication.cpp b/benchmarks/pt_qapplication/pt_qapplication.cpp
new file mode 100644
index 000000000..9fa210314
--- /dev/null
+++ b/benchmarks/pt_qapplication/pt_qapplication.cpp
@@ -0,0 +1,92 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include "pt_qapplication.h"
+
+#include
+#include
+
+#include
+
+void Pt_QApplication::processCreation()
+{
+ executeSelf(QLatin1String("--exit-immediately"));
+}
+
+void Pt_QApplication::processCreationAndCtor()
+{
+ executeSelf(QLatin1String("--exit-after-qapp"));
+}
+
+void Pt_QApplication::ctor()
+{
+ QApplication *a;
+ QBENCHMARK {
+ int fakeArgc = 1;
+ char *fakeArgv[fakeArgc];
+ char appName[] = "./pt_qapplication";
+ fakeArgv[0] = appName;
+ a = new QApplication(fakeArgc, fakeArgv);
+ }
+ delete a;
+}
+
+void Pt_QApplication::ctor2()
+{
+ QApplication *a;
+ QBENCHMARK {
+ int fakeArgc = 1;
+ char *fakeArgv[fakeArgc];
+ char appName[] = "./pt_qapplication2";
+ fakeArgv[0] = appName;
+ a = new QApplication(fakeArgc, fakeArgv);
+ }
+ delete a;
+}
+
+void Pt_QApplication::executeSelf(const QLatin1String ¶meter)
+{
+ QProcess proc;
+ const QString program = "./pt_qapplication";
+ const QStringList arguments = QStringList() << QLatin1String(parameter);
+
+ QBENCHMARK {
+ proc.start(program, arguments);
+ QVERIFY(proc.waitForStarted());
+ QVERIFY(proc.waitForFinished());
+ QCOMPARE(proc.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(proc.exitCode(), 0);
+ }
+}
+
+int main(int argc, char **argv)
+{
+ if (argc == 2 && QLatin1String("--exit-immediately") == QLatin1String(argv[1])) {
+ return 0;
+ }
+
+ if (argc == 2 && QLatin1String("--exit-after-qapp") == QLatin1String(argv[1])) {
+ QApplication app(argc, argv);
+ return 0;
+ }
+
+ Pt_QApplication test;
+ return QTest::qExec(&test, argc, argv);
+}
+
diff --git a/benchmarks/pt_qapplication/pt_qapplication.h b/benchmarks/pt_qapplication/pt_qapplication.h
new file mode 100644
index 000000000..be7e7f105
--- /dev/null
+++ b/benchmarks/pt_qapplication/pt_qapplication.h
@@ -0,0 +1,63 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef PT_QAPPLICATION_H
+#define PT_QAPPLICATION_H
+
+#include
+
+/**
+ * Test performance oif the QApplication constructor.
+ * The constructor is created in process and as part of a newly created process.
+ */
+class Pt_QApplication : public QObject
+{
+ Q_OBJECT
+private slots:
+ /**
+ * Test how long it takes to launch an application which is quitting immediately.
+ */
+ void processCreation();
+
+ /**
+ * Test the performance of the qapplication constructor.
+ *
+ * This test creates a new process and thus includes process creation overhead.
+ * Callgrind results are meaningless since the child process is not traced.
+ */
+ void processCreationAndCtor();
+
+ /**
+ * Test the performance of the qapplication constructor.
+ */
+ void ctor();
+
+ /**
+ * Execute the constructor a second time to evaluate caching possibilities.
+ */
+ void ctor2();
+
+private:
+ /**
+ * Executes the current programm with a given parameter.
+ */
+ void executeSelf(const QLatin1String ¶meter);
+};
+
+#endif // PT_QAPPLICATION_H
diff --git a/benchmarks/pt_qapplication/pt_qapplication.pro b/benchmarks/pt_qapplication/pt_qapplication.pro
new file mode 100644
index 000000000..adf11cb9e
--- /dev/null
+++ b/benchmarks/pt_qapplication/pt_qapplication.pro
@@ -0,0 +1,4 @@
+include(../common_top.pri)
+TARGET = pt_qapplication
+SOURCES = pt_qapplication.cpp
+HEADERS += pt_qapplication.h
diff --git a/benchmarks/pt_widgetsgallery/.gitignore b/benchmarks/pt_widgetsgallery/.gitignore
new file mode 100644
index 000000000..d17071368
--- /dev/null
+++ b/benchmarks/pt_widgetsgallery/.gitignore
@@ -0,0 +1 @@
+pt_widgetsgallery
diff --git a/benchmarks/pt_widgetsgallery/pt_widgetsgallery.cpp b/benchmarks/pt_widgetsgallery/pt_widgetsgallery.cpp
new file mode 100644
index 000000000..0911a5d92
--- /dev/null
+++ b/benchmarks/pt_widgetsgallery/pt_widgetsgallery.cpp
@@ -0,0 +1,41 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include "pt_widgetsgallery.h"
+
+#include
+
+#include
+
+void Pt_WidgetsGallery::startupTime()
+{
+ QProcess proc;
+ const QString program = "widgetsgallery";
+ const QStringList arguments = QStringList() << "-quitimmediately" << "-remote-theme";
+
+ QBENCHMARK {
+ proc.start(program, arguments);
+ QVERIFY(proc.waitForStarted());
+ QVERIFY(proc.waitForFinished());
+ QCOMPARE(proc.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(proc.exitCode(), 0);
+ }
+}
+
+QTEST_APPLESS_MAIN(Pt_WidgetsGallery)
diff --git a/benchmarks/pt_widgetsgallery/pt_widgetsgallery.h b/benchmarks/pt_widgetsgallery/pt_widgetsgallery.h
new file mode 100644
index 000000000..d82a5a0ed
--- /dev/null
+++ b/benchmarks/pt_widgetsgallery/pt_widgetsgallery.h
@@ -0,0 +1,36 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef PT_WIDGETSGALLERY_H
+#define PT_WIDGETSGALLERY_H
+
+#include
+
+class Pt_WidgetsGallery : public QObject
+{
+ Q_OBJECT
+private slots:
+
+ /**
+ * Benchmark startup time of widgetsgallery
+ */
+ void startupTime();
+};
+
+#endif // PT_WIDGETSGALLERY_H
diff --git a/benchmarks/pt_widgetsgallery/pt_widgetsgallery.pro b/benchmarks/pt_widgetsgallery/pt_widgetsgallery.pro
new file mode 100644
index 000000000..71f4f9757
--- /dev/null
+++ b/benchmarks/pt_widgetsgallery/pt_widgetsgallery.pro
@@ -0,0 +1,4 @@
+include(../common_top.pri)
+TARGET = pt_widgetsgallery
+SOURCES = pt_widgetsgallery.cpp
+HEADERS = pt_widgetsgallery.h
diff --git a/configure b/configure
new file mode 100755
index 000000000..97254f68a
--- /dev/null
+++ b/configure
@@ -0,0 +1,481 @@
+#!/bin/sh
+#
+# Configures the libdui build
+#
+# Copyright (C) 2010 Nokia Corporation.
+#
+# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+#-------------------------------------------------------------------------------
+# script initialization
+#-------------------------------------------------------------------------------
+
+# the name of this script
+relconf=`basename $0`
+# the directory of this script is the "source tree"
+relpath=`dirname $0`
+relpath=`(cd "$relpath"; /bin/pwd)`
+# the current directory is the "build tree" or "object tree"
+outpath=`/bin/pwd`
+
+#-------------------------------------------------------------------------------
+# operating system detection
+#-------------------------------------------------------------------------------
+
+# need that throughout the script
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+#-----------------------------------------------------------------------------
+# Dui version detection
+#-----------------------------------------------------------------------------
+DUI_MAJOR_VERSION=`grep -m1 DUI_MAJOR_VERSION src/dui_defines.prf |cut -f2 -d'='|sed 's/ //g'`
+DUI_MINOR_VERSION=`grep -m1 DUI_MINOR_VERSION src/dui_defines.prf |cut -f2 -d'='|sed 's/ //g'`
+DUI_PATCH_VERSION=`grep -m1 DUI_PATCH_VERSION src/dui_defines.prf |cut -f2 -d'='|sed 's/ //g'`
+DUI_VERSION=$DUI_MAJOR_VERSION.$DUI_MINOR_VERSION.$DUI_PATCH_VERSION
+
+if [ -z "$DUI_MAJOR_VERSION" ]; then
+ echo "Cannot process version from src/dui_defines.prf: $DUI_VERSION"
+ echo "Cannot proceed."
+ exit 1
+fi
+
+#-------------------------------------------------------------------------------
+# initalize variables
+#-------------------------------------------------------------------------------
+
+# initalize internal variables
+CFG_DEBUG=yes
+CFG_RELEASE=no
+CFG_OPENGL=yes
+CFG_TESTABLE=no
+CFG_COVERAGE=no
+CFG_TIMESTAMPS=no
+CFG_DEV=no
+
+DUI_DEFAULT_BUILD_PARTS="libs demos"
+CFG_BUILD_PARTS=""
+CFG_NOBUILD_PARTS=""
+
+HAVE_ICU=no
+HAVE_CONTEXTSUBSCRIBER=no
+HAVE_GCONF=no
+HAVE_GSTREAMER=no
+HAVE_DBUS=no
+
+# initalize variables used for installation
+DUI_INSTALL_PREFIX=/usr/local
+
+#-------------------------------------------------------------------------------
+# parse command line arguments
+#-------------------------------------------------------------------------------
+
+# parse the arguments, setting things to "yes" or "no"
+while [ "$#" -gt 0 ]; do
+ CURRENT_OPT="$1"
+ UNKNOWN_ARG=no
+ case "$1" in
+ #Autoconf style options
+ --enable-*)
+ VAR=`echo $1 | sed "s,^--enable-\(.*\),\1,"`
+ VAL=yes
+ ;;
+ --disable-*)
+ VAR=`echo $1 | sed "s,^--disable-\(.*\),\1,"`
+ VAL=no
+ ;;
+ --*=*)
+ VAR=`echo $1 | sed "s,^--\(.*\)=.*,\1,"`
+ VAL=`echo $1 | sed "s,^--.*=\(.*\),\1,"`
+ ;;
+ --no-*)
+ VAR=`echo $1 | sed "s,^--no-\(.*\),\1,"`
+ VAL=no
+ ;;
+ --*)
+ VAR=`echo $1 | sed "s,^--\(.*\),\1,"`
+ VAL=yes
+ ;;
+ #Qt style no options
+ -no-*)
+ VAR=`echo $1 | sed "s,^-no-\(.*\),\1,"`
+ VAL=no
+ ;;
+ #Qt style yes options
+ -h|-help|-v|-verbose|-debug|-release|-testable|-coverage|-timestamps|-dev)
+ VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
+ VAL=yes
+ ;;
+ #Qt style options that pass an argument
+ -prefix|-make|-nomake)
+ VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
+ shift
+ VAL="$1"
+ ;;
+ #Qt style complex options in one command
+ -enable-*|-disable-*)
+ VAR=`echo $1 | sed "s,^-\([^-]*\)-.*,\1,"`
+ VAL=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
+ ;;
+ #Qt Builtin/System style options
+ -no-*)
+ VAR=`echo $1 | sed "s,^-[^-]*-\(.*\),\1,"`
+ VAL=`echo $1 | sed "s,^-\([^-]*\)-.*,\1,"`
+ ;;
+ #Options that cannot be generalized
+ -opengl)
+ VAR=opengl
+ # this option may or may not be followed by an argument
+ if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
+ VAL=yes
+ else
+ shift;
+ VAL=$1
+ fi
+ ;;
+ -*)
+ VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
+ VAL="unknown"
+ ;;
+ *)
+ UNKNOWN_ARG=yes
+ ;;
+ esac
+ if [ "$UNKNOWN_ARG" = "yes" ]; then
+ echo "$1: unknown argument"
+ OPT_HELP=yes
+ ERROR=yes
+ shift
+ continue
+ fi
+ shift
+
+ UNKNOWN_OPT=no
+ case "$VAR" in
+ prefix)
+ DUI_INSTALL_PREFIX="$VAL"
+ ;;
+ nomake)
+ CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS $VAL"
+ ;;
+ make)
+ CFG_BUILD_PARTS="$CFG_BUILD_PARTS $VAL"
+ ;;
+ opengl)
+ if [ "$VAL" = "auto" ] || [ "$VAL" = "desktop" ] ||
+ [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] ||
+ [ "$VAL" = "es1cl" ] || [ "$VAL" = "es1" ] || [ "$VAL" = "es2" ]; then
+ CFG_OPENGL="$VAL"
+ else
+ UNKNOWN_OPT=yes
+ fi
+ ;;
+ release)
+ CFG_RELEASE="$VAL"
+ ;;
+ debug)
+ CFG_DEBUG="$VAL"
+ ;;
+ testable)
+ CFG_TESTABLE="$VAL"
+ ;;
+ coverage)
+ CFG_COVERAGE="$VAL"
+ ;;
+ timestamps)
+ CFG_TIMESTAMPS="$VAL"
+ ;;
+ dev)
+ CFG_DEV="yes"
+ ;;
+ h|help)
+ if [ "$VAL" = "yes" ]; then
+ OPT_HELP="$VAL"
+ else
+ UNKNOWN_OPT=yes
+ fi
+ ;;
+ v|verbose)
+ if [ "$VAL" = "yes" ]; then
+ if [ "$OPT_VERBOSE" = "$VAL" ]; then # takes two verboses to turn on qmake debugs
+ QMAKE_SWITCHES="$QMAKE_SWITCHES -d"
+ else
+ OPT_VERBOSE=yes
+ fi
+ elif [ "$VAL" = "no" ]; then
+ if [ "$OPT_VERBOSE" = "$VAL" ] && echo "$QMAKE_SWITCHES" | grep ' -d' >/dev/null 2>&1; then
+ QMAKE_SWITCHES=`echo $QMAKE_SWITCHES | sed "s, -d,,"`
+ else
+ OPT_VERBOSE=no
+ fi
+ else
+ UNKNOWN_OPT=yes
+ fi
+ ;;
+ silent)
+ CFG_SILENT="$VAL"
+ ;;
+ esac
+ if [ "$UNKNOWN_OPT" = "yes" ]; then
+ echo "${CURRENT_OPT}: invalid command-line switch"
+ OPT_HELP=yes
+ ERROR=yes
+ fi
+done
+
+if [ "$CFG_SILENT" = "yes" ]; then
+ QMAKE_CONFIG="$QMAKE_CONFIG silent"
+fi
+
+#-------------------------------------------------------------------------------
+# tests
+#-------------------------------------------------------------------------------
+
+#setup the build parts
+CFG_BUILD_PARTS="$CFG_BUILD_PARTS $DUI_DEFAULT_BUILD_PARTS"
+
+for nobuild in $CFG_NOBUILD_PARTS; do
+ CFG_BUILD_PARTS=`echo "$CFG_BUILD_PARTS" | sed "s, $nobuild,,g"`
+done
+
+if echo $CFG_BUILD_PARTS | grep -v libs >/dev/null 2>&1; then
+ echo
+ echo "WARNING: libs is a required part of the build."
+ echo
+ CFG_BUILD_PARTS="$CFG_BUILD_PARTS libs"
+fi
+
+if [ "$CFG_DEV" = "yes" ]; then
+ CFG_BUILD_PARTS="$CFG_BUILD_PARTS tests benchmarks plainqt"
+fi
+
+# Test for ICU
+which icu-config > /dev/null
+if [ $? -eq 0 ]; then
+ icu-config --exists
+ if [ $? -eq 0 ]; then
+ HAVE_ICU=yes
+ fi
+fi
+
+# Test for pkg-config enabled dependencies
+which pkg-config > /dev/null
+if [ $? -eq 0 ]; then
+
+ pkg-config --exists contextsubscriber-1.0
+ if [ $? -eq 0 ]; then
+ HAVE_CONTEXTSUBSCRIBER=yes
+ fi
+
+ pkg-config --exists gconf-2.0
+ if [ $? -eq 0 ]; then
+ HAVE_GCONF=yes
+ fi
+
+ pkg-config --exists gstreamer-0.10
+ if [ $? -eq 0 ]; then
+ HAVE_GSTREAMER=yes
+ fi
+
+ pkg-config --exists QtDBus
+ if [ $? -eq 0 ]; then
+ HAVE_DBUS=yes
+ fi
+
+fi
+
+
+
+#-------------------------------------------------------------------------------
+# help - interactive parts of the script _after_ this section please
+#-------------------------------------------------------------------------------
+
+# next, emit a usage message if something failed.
+if [ "$OPT_HELP" = "yes" ]; then
+ [ "x$ERROR" = "xyes" ] && echo
+ cat <] [-release] [-debug] [-make ]
+ [-no-make ]
+
+Installation options:
+
+ -prefix ...... This will install everything relative to
+ (default $DUI_INSTALL_PREFIX)
+
+Configure options:
+
+ The defaults (*) are usually acceptable. A plus (+) denotes a default value
+ that needs to be evaluated. If the evaluation succeeds, the feature is
+ included. Here is a short explanation of each option:
+
+ -release ........... Compile and link libdui in release mode
+ * -debug ............. Compile and link libdui with debugging turned on
+
+ -testable .......... Enable the testability plugin interface in libdui
+ -timestamps ........ Enable time debug measurements in the code
+ -coverage .......... Enable code coverage calculation
+
+Additional options:
+
+ -make ....... Add part to the list of parts to be built at make time
+ (*libs *demos plainqt tests benchmarks)
+ -nomake ..... Exclude part from the list of parts to be built
+
+ -dev ............... Compile and link with default developer options
+EOF
+
+exit 0
+
+fi
+
+#-------------------------------------------------------------------------------
+# save configuration into duiconfig.pri
+#-------------------------------------------------------------------------------
+
+DUICONFIG="$outpath/mkspecs/duiconfig.pri"
+[ -f "$DUICONFIG.tmp" ] && rm -f "$DUICONFIG.tmp"
+
+if [ "$CFG_DEBUG" = "yes" ]; then
+ DUICONFIG_CONFIG="$DUICONFIG_CONFIG debug"
+fi
+
+if [ "$CFG_RELEASE" = "yes" ]; then
+ DUICONFIG_CONFIG="$DUICONFIG_CONFIG release"
+fi
+
+
+if [ "$CFG_TESTABLE" = "yes" ]; then
+ DUICONFIG_FEATURES="$DUICONFIG_FEATURES testable"
+fi
+
+if [ "$CFG_TIMESTAMPS" = "yes" ]; then
+ DUICONFIG_FEATURES="$DUICONFIG_FEATURES timestamps"
+fi
+
+if [ "$CFG_COVERAGE" = "yes" ]; then
+ DUICONFIG_FEATURES="$DUICONFIG_FEATURES coverage"
+fi
+
+
+if [ "$HAVE_ICU" = "yes" ]; then
+ DUICONFIG_DEPS="$DUICONFIG_DEPS HAVE_ICU"
+fi
+
+if [ "$HAVE_CONTEXTSUBSCRIBER" = "yes" ]; then
+ DUICONFIG_DEPS="$DUICONFIG_DEPS HAVE_CONTEXTSUBSCRIBER"
+fi
+
+if [ "$HAVE_GCONF" = "yes" ]; then
+ DUICONFIG_DEPS="$DUICONFIG_DEPS HAVE_GCONF"
+fi
+
+if [ "$HAVE_GSTREAMER" = "yes" ]; then
+ DUICONFIG_DEPS="$DUICONFIG_DEPS HAVE_GSTREAMER"
+fi
+
+if [ "$HAVE_DBUS" = "yes" ]; then
+ DUICONFIG_DEPS="$DUICONFIG_DEPS HAVE_DBUS"
+fi
+
+
+cat >>"$DUICONFIG.tmp" < /dev/null
+ if [ $? -eq 0 ]; then
+ QMAKE_BIN=`which qmake`
+ else
+ echo "qmake was not found in your path\n"
+ fi
+elif [ -f "$QTDIR/bin/qmake" ]; then
+ QMAKE_BIN="$QTDIR/bin/qmake"
+else
+ echo "QTDIR variable was set but could not find $QTDIR/bin/qmake\n"
+fi
+
+if [ -z "$QMAKE_BIN" ]; then
+ echo "If your Qt is in a nonstandard location, try:"
+ echo "QTDIR= ./$relconf"
+ exit 1
+fi
+
+#Run qmake
+$QMAKE_BIN $QMAKE_CONFIG $QMAKE_SWITCHES
+
+#-------------------------------------------------------------------------------
+# give feedback on configuration
+#-------------------------------------------------------------------------------
+
+echo "\n\nOptional build dependencies found:"
+
+echo "ICU ...................... $HAVE_ICU"
+echo "Context Subscriber 1.0 ... $HAVE_CONTEXTSUBSCRIBER"
+echo "GConf 2.0 ................ $HAVE_GCONF"
+echo "GStreamer 0.10 ........... $HAVE_GSTREAMER"
+echo "DBus (incl. QtDBus) ...... $HAVE_DBUS"
+
+
+if [ "$CFG_DEV" = "yes" ]; then
+ echo "\n\nEnabling DirectUI developer's build\n"
+else
+ echo "\n"
+fi
+
+echo "DirectUI framework build configuration:"
+echo "Version ............. $DUI_VERSION"
+echo "Build ...............$CFG_BUILD_PARTS"
+echo "Extra features ......$DUICONFIG_FEATURES"
+echo "Release ............. $CFG_RELEASE"
+echo "Debug ............... $CFG_DEBUG"
+
+echo
+echo libdui is now configured for building. Just run \'make\'.
+if [ "$relpath" = "$DUI_INSTALL_PREFIX" ]; then
+ echo Once everything is built, libdui is installed.
+ echo You should not run \'make install\'.
+else
+ echo Once everything is built, you can run \'make install\'.
+ echo libdui will be installed into $DUI_INSTALL_PREFIX
+fi
+
+echo "\n"
diff --git a/debian/.gitignore b/debian/.gitignore
new file mode 100644
index 000000000..faf916fd7
--- /dev/null
+++ b/debian/.gitignore
@@ -0,0 +1,38 @@
+libdui-dev
+libdui-tests
+*.debhelper
+*.substvars
+libdui0
+libdui-doc
+libdui0-dbg
+libdui-l10n-ar
+libdui-l10n-de
+libdui-l10n-en
+libdui-l10n-engineering-english
+libdui-l10n-fi
+libdui-l10n-ur
+libdui-l10n-zh-cn
+libdui-benchmarks
+tmp
+files
+dui-demos
+dui-demos-eternia
+dui-demos-imageviewer
+dui-demos-widgetsgallery
+dui-demos-widgetsgallery-dbg
+dui-demos-widgetsgallery-tests
+dui-demos-widgetsgallery-l10n-ar
+dui-demos-widgetsgallery-l10n-de
+dui-demos-widgetsgallery-l10n-en
+dui-demos-widgetsgallery-l10n-engineering-english
+dui-demos-widgetsgallery-l10n-fi
+dui-demos-widgetsgallery-l10n-hu
+dui-demos-widgetsgallery-l10n-ur
+dui-demos-widgetsgallery-l10n-zh-cn
+dui-demos-appletinstallationsource
+dui-demos-appletinstallationsource-dbg
+dui-dev-tools
+dui-demos-plainqt-dbg
+dui-demos-plainqt
+dui-im-context
+
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 000000000..df57b3bee
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,182 @@
+libdui (0.19.0-1) unstable; urgency=low
+
+ * New version
+ * License changed
+
+ -- Tomas Junnonen Mon, 15 Feb 2010 13:49:00 +0200
+
+libdui (0.18.9-2) unstable; urgency=low
+
+ * New version
+ * Unit test fixes
+ * Implemented: SWP#DUI-2901
+
+ -- Tomas Junnonen Fri, 12 Feb 2010 14:30:00 +0200
+
+libdui (0.18.8-1) unstable; urgency=low
+
+ * Fixes: NB#155940 - DuiDialog crashes at times if created with DuiSceneWindow::KeepWhenDone
+ * Fixes: NB#156148 - There is no way to change theme on non linux OS
+ * Fixes: NB#153770 - Closing a window when app has multiple windows causes exit with error code 1
+ * Fixes: NB#154831 - Widgetsgallery crash on first run
+ * Fixes: NB#155361 - Removed warnings and added -Werror
+ * Fixes: NB#155726 - Asynchronously handled dialog returns wrong result
+ * Fixes: NB#154422 - Inserting rows to first group in DuiList does not update the list
+ * Fixes: NB#156073 - Widgetsgallery : Broken Query dialog, yes and no Button double caption
+ * Fixes: NB#155116 - Pannable viewport doesn't come back to the very same position
+ * Fixes: NB#152282 - DuiNavigationBar animates incorrectly when the screen is rotated
+ * Fixes: NB#154831 - Widgetsgallery -timedemo causes consistent segfault in CITA; occasionally on device
+ * Fixes: NB#154535 - Not possible to keep current window orientation angle with keepCurrentOrientation()
+ * Fixes: NB#156155 - Widgets are invisible after layout policy switch
+ * Fixes: NB#154584 - -remote-theme switch doesn't work
+ * Fixes: NB#154446 - duistylesheet.cpp
+ * Fixes: NB#154129 - DuiPopupList::scrollTo makes some items disappear
+ * Fixes: NB#154888 - performing click() on DuiComboBox is not working as expected
+ * Fixes: NB#154891 - setting the icon & icon visibility for DuiComboBox is not working properly
+ * Fixes: NB#153911 - DuiStylableWidget shouldn't require the DUI_REGISTER_WIDGET macro, or default constructor
+ * Fixes: NB#155682 - ta_duilistmod: complete List deletion causes segfault
+ * Fixes: NB#155734 - Items under the last group of DuiList are duplicated
+ * Fixes: NB#153100 - DuiList doesn't update when items are removed from a model with group headers
+ * Fixes: NB#151937 - Incorrect include files libdui-dev package
+ * Fixes: NB#155837 - DuiComboBox does not change current item text when item model is changed
+ * Fixes: NB#152740 - trid function is not marked as deprecated
+ * Fixes: NB#152994 - Width of the view menu items differ from each other
+ * Fixes: NB#155856 - Launching applications in Portrait is broken again
+ * Fixes: NB#154449 - sorting does not work correctly neither in no_NO nor nb_NO locales
+ * Fixes: NB#156115 - typo in doxygen documentation
+ * Fixes: NB#154958 - libicudata is invalid shared library -> LD_AUDIT doesn't work for anything linking it (i.e. DUI)
+ * Implemented: SWP#DUI-2143, SWP#DUI-2147, SWP#DUI-2201, SWP#DUI-2207
+ * Implemented: SWP#DUI-2145, SWP#DUI-2148, SWP#DUI-2140, SWP#DUI-2228
+ * Implemented: SWP#DUI-2135, SWP#DUI-2134, SWP#DUI-2139, SWP#DUI-2114
+ * Implemented: SWP#DUI-2051, SWP#DUI-2052, SWP#DUI-2191, SWP#DUI-2185
+ * Implemented: SWP#DUI-2186, SWP#DUI-2189, SWP#DUI-2190, SWP#DUI-2188
+ * Implemented: SWP#DUI-2187, SWP#DUI-1885, SWP#DUI-2053, SWP#DUI-2115
+ * Implemented: SWP#DUI-2132, SWP#DUI-2121, SWP#DUI-2120, SWP#DUI-2119
+ * Implemented: SWP#DUI-2117, SWP#DUI-2116, SWP#DUI-2166, SWP#DUI-2164
+ * Implemented: SWP#DUI-2162, SWP#DUI-2161, SWP#DUI-1546, SWP#DUI-2083
+ * Implemented: SWP#DUI-2169, SWP#DUI-2168
+
+ -- Tomas Junnonen Thu, 11 Feb 2010 15:26:00 +0200
+
+libdui (0.18.7-1) unstable; urgency=low
+
+ * Fixes: NB#154408 - displayExited doesn't get emitted when the DuiWindow gets closed
+ * Fixes: NB#154886 - setItemIconID() for DuiComboBox items is not working properly
+ * Fixes: NB#144088 - DuiList can't scroll to index
+ * Fixes: NB#153902 - DuiContainer crashes when ProgressIndicator is set visible and headerVisible property is toggled
+ * Fixes: NB#154433 - DuiButton's shape() is not within the button's bounding rectangle.
+ * Fixes: NB#155031 - Transaction support in DuiModel not functioning
+ * Fixes: NB#153437 - DuiTheme::pixmap() not working
+ * Fixes: NB#154878 - DuiList component does not react to some item model signals
+ * Fixes: NB#154961 - DuiList doesnt update cells correctly when deleting a row from the underlying model
+ * Fixes: NB#113828 - Documentation for DUI Theme system is out of date and/or lacking
+ * Fixes: NB#152740 - trid function is not marked as deprecated
+ * Fixes: NB#154240 - List has visual artefacts when run with Pineapple profile
+ * Fixes: NB#154907 - The background of tapped DuiContentItem in Single mode looks foggy
+ * Fixes: NB#152990 - DuiList's setColumns() doesn't work
+ * Fixes: NB#148937 - Multiple slection is not possible in the duilist in libdui15
+ * Fixes: NB#137510 - DuiGrid performance is bad
+ * Implemented: SWP#DUI-2036, SWP#DUI-2035, SWP#DUI-2034, SWP#DUI-2033
+ * Implemented: SWP#DUI-2032, SWP#DUI-2031, SWP#DUI-2086, SWP#DUI-2084
+ * Implemented: SWP#DUI-2049, SWP#DUI-2097, SWP#DUI-2046, SWP#DUI-2045
+ * Implemented: SWP#DUI-1915, SWP#DUI-1903, SWP#DUI-1904, SWP#DUI-2081
+ * Implemented: SWP#DUI-2082, SWP#DUI-2047, SWP#DUI-2096, SWP#DUI-2080
+ * Implemented: SWP#DUI-2075, SWP#DUI-2095, SWP#DUI-2074, SWP#DUI-1882
+ * Implemented: SWP#DUI-514, SWP#DUI-2054, SWP#DUI-2050, SWP#DUI-1776
+ * Implemented: SWP#DUI-1778, SWP#DUI-1880, SWP#DUI-2076, SWP#DUI-2048
+ * Implemented: SWP#DUI-1847, SWP#DUI-1503, SWP#DUI-2089, SWP#DUI-1798
+ * Implemented: SWP#DUI-2090
+
+ -- Tomas Junnonen Tue, 02 Feb 2010 10:21:00 +0200
+
+libdui (0.18.6-1) unstable; urgency=low
+
+ * Fixes: NB#149818 - Theming changes always causes segfaults
+ * Fixes: NB#154885 - DuiApplicationPage::setAutoMarginsForComponentsEnabled() does not work when page is open
+ * Fixes: NB#154860 - Theme switching doesn't work
+ * Fixes: NB#150496 - DuiDialog destructor crashes with a QGridLayoutEngine::setItemAt()
+ * Fixes: NB#153447 - Newly created widgets ignore calling hide()
+ * Fixes: NB#154005 - Page of the DuiImage in documentation tells about DuiPopupList and not DuiImage
+ * Fixes: NB#154417 - DuiList visible item update is broken when group headers are used
+ * Fixes: NB#154517 - DuiList component crahes when non-empty item model is given
+ * Unit test fixes
+
+ -- Tomas Junnonen Fri, 29 Jan 2010 17:55:00 +0200
+
+libdui (0.18.5-1) unstable; urgency=low
+
+ * Fixes: NB#153100 - DuiList doesn't update when items are removed from a model with group headers
+ * Fixes: NB#154445 - Multi column list does not refresh content (for non first columns)
+ * Fixes: NB#154304 - Crash when inserting (prepending) items into an empty DuiList
+ * Fixes: NB#154241 - WidgetsGallery does now show title area in Portrait for Pineapple target
+ * Unit test fixes
+
+ -- Tomas Junnonen Tue, 26 Jan 2010 16:50:00 +0200
+
+libdui (0.18.4-1) unstable; urgency=low
+
+ * Fixes: NB#153413 - Event cancellation does not work for DuiSlider (DuiSlider value is not reset when panning occurs)
+ * Fixes: NB#152102 - DuiLinearLayoutPolicy - make the documentation clearer about indexes
+ * Fixes: NB#153983 - DuiApplication(argc, argv) does not allow to open 2 app processes with the same name
+ * Fixes: NB#153978 - Broken applets can not be removed by clicking Remove in the broken applet dialog
+ * Unit test fixes
+
+ -- Tomas Junnonen Mon, 25 Jan 2010 11:54:00 +0200
+
+libdui (0.18.3-1) unstable; urgency=low
+
+ * Fixes: NB#151691 - Prestarted applications still visible in the switcher after lazy shutdown
+ * Fixes: NB#153483 - The background image can not be loaded for DuiInformBanner sometimes
+ * Fixes: NB#153952 - DuiApplicationPage::disappear() causes segmentation fault with DuiSceneWindow::DestroyWhenDone policy
+ * Fixes: NB#153800 - Setting application to full screen does not automatically remove toolbar offset from application page
+ * Unit test fixes
+
+ -- Tomas Junnonen Thu, 21 Jan 2010 16:58:00 +0200
+
+libdui (0.18.2-1) unstable; urgency=low
+
+ * Fixes: NB#153412 - Switch button interaction reverted in Portrait
+ * Fixes: NB#152770 - Styling system does not support QChar attributes
+ * Fixes: NB#153415 - Animations fail with recent Qt
+ * Fixes: NB#152804 - DuiList::itemClicked(QModelIndex) signal is never emitted for non DuiContentItem cells
+ * Unit test fixes
+
+ -- Tomas Junnonen Wed, 20 Jan 2010 17:01:00 +0200
+
+libdui (0.18.1-1) unstable; urgency=low
+
+ * New version
+ * Unit test fixes
+
+ -- Tomas Junnonen Tue, 19 Jan 2010 09:50:00 +0200
+
+libdui (0.18.0-1) unstable; urgency=low
+
+ * Fixes: NB#150389 - Window modal dialogs do not work
+ * Fixes: NB#143497 - Can't add views from plugins
+ * Fixes: NB#153164 - Closing windows when multiple windows in application causes segfault
+ * Fixes: NB#151200 - DuiAction::setVisible( bool ) is not handled correctly in application menu
+ * Fixes: NB#153158 - Segmentation fault when using fast list without specified cell creators
+ * Fixes: NB#150040 - dui application using filtered duigrid crashes when clicking the items before repaint of grid finished
+ * Fixes: NB#150567 - Outdated list items appear out of list when DuiList model is updated
+ * Fixes: NB#151550 - Widgets inheriting DuiStylableWidget have no obvious size to paint to
+ * Fixes: NB#153314 - When Screen.IsCovered property is set to TRUE, dui apps crash on startup.
+ * Fixes: NB#147429 - DuiWidgetView::xxxChanged() methods break fundamental Qt API conventions
+ * Fixes: NB#147904 - Closing DuiApplicationWindow causes huge CPU usage
+ * Fixes: NB#149294 - Problem with tool dui-servicefwgen in dui 0.16
+ * Fixes: NB#144564 - Delayed model initialization in DuiWidgetController
+ * Fixes: NB#152624 - Page title doesn't change after DuiApplicationPage::disappear - appear sequence
+ * Fixes: NB#149214 - Clicked signal is not working with DuiGrid and DuiList
+ * Fixes: NB#152737 - [blocker proposal] Mapcanvas fails to compile with latest dui v0.17
+ * Fixes: NB#140299 - device is flickering while virtual key board is launching(Qt 4.6.0~git20090911-0maemo1+0m6)
+ * Fixes: NB#151978 - DuiLinearLayoutPolicy ignores addStretch()
+ * Implemented: SWP#DUI-1898, SWP#DUI-1897, SWP#DUI-1899, SWP#DUI-1936
+ * Implemented: SWP#DUI-1905, SWP#DUI-1900, SWP#DUI-1819, SWP#DUI-1901, SWP#DUI-1992
+ * Implemented: SWP#DUI-1909, SWP#DUI-1935, SWP#DUI-2013, SWP#DUI-1910, SWP#DUI-1912
+ * Implemented: SWP#DUI-1913, SWP#DUI-1920, SWP#DUI-1881, SWP#DUI-1919, SWP#DUI-1879
+ * Implemented: SWP#DUI-1877, SWP#DUI-1971, SWP#DUI-1872, SWP#DUI-1882, SWP#DUI-1932
+ * Implemented: SWP#DUI-1931, SWP#DUI-1916, SWP#DUI-1702, SWP#DUI-1793, SWP#DUI-1918
+ * Implemented: SWP#DUI-1572, SWP#DUI-1794, SWP#DUI-1798, SWP#DUI-1996, SWP#DUI-1995
+ * Implemented: SWP#DUI-1964, SWP#DUI-1963, SWP#DUI-1962, SWP#DUI-1961, SWP#DUI-1960
+
+ -- Tomas Junnonen Sun, 17 Jan 2010 18:02:00 +0200
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 000000000..b8626c4cf
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+4
diff --git a/debian/control b/debian/control
new file mode 100644
index 000000000..243334df5
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,219 @@
+Source: libdui
+Section: libs
+Priority: extra
+Maintainer: Tomas Junnonen
+Build-Depends: debhelper (>= 5), libqt4-dev (>= 4.6.0), libicu-dev, libx11-dev, doxygen (>=1.5.9), libgconf2-dev, libcontextsubscriber-dev, libgstreamer0.10-dev, libgstreamer-plugins-base0.10-dev, libgles2-sgx-img-dev [arm armel], opengles-sgx-img-common-dev [arm armel], libgl-dev [i386], libgl1 [i386], libqt4-opengl-dev, pkg-config (>= 0.22), libxdamage-dev
+Standards-Version: 3.7.2
+
+Package: libdui0
+Architecture: any
+Depends: libdui-l10n-engineering-english (= ${Source-Version}), libqtcore4 (>= 4.6.0), libqtgui4 (>= 4.6.0), libqt4-dbus (>= 4.6.0), dbus-x11, ${misc:Depends}, ${launcher:Depends}, ${shlibs:Depends}, duitheme (>= 0.5.0), libxdamage1
+Provides: libdui
+Conflicts: libdui
+Suggests: libdui-l10n-ar, libdui-l10n-de, libdui-l10n-en, libdui-l10n-fi, libdui-l10n-ur, libdui-l10n-zh-cn
+Description: DirectUI library
+ libdui framework libraries
+
+Package: libdui-dev
+Section: devel
+Architecture: any
+Depends: libdui0 (= ${Source-Version}), dui-dev-tools (=${Source-Version}), libqt4-dev (>= 4.6.0), libx11-dev, libgstreamer0.10-dev, libgstreamer-plugins-base0.10-dev, libgconf2-dev, libcontextsubscriber-dev, libxdamage-dev
+Description: libdui development files
+ Development files for DirectUI
+
+Package: dui-dev-tools
+Section: devel
+Architecture: any
+Depends: ${shlibs:Depends}
+Suggests: perl (>= 5.10.0)
+Description: libdui specific development and testing tools
+ Collection of tools for testing and developing on top of libdui. Includes
+ stuff like applettester and code/mock generation.
+
+Package: dui-demos
+Section: devel
+Architecture: any
+Depends: dui-demos-widgetsgallery, dui-demos-plainqt
+Description: Demo applications for DirectUI
+ Collection of demo applications for DirectUI
+
+Package: dui-demos-widgetsgallery
+Section: devel
+Architecture: any
+Depends: libdui0 (= ${Source-Version}), dui-demos-widgetsgallery-l10n-engineering-english (= ${Source-Version})
+Suggests: dui-demos-widgetsgallery-l10n-ar, dui-demos-widgetsgallery-l10n-de, dui-demos-widgetsgallery-l10n-en, dui-demos-widgetsgallery-l10n-fi, dui-demos-widgetsgallery-l10n-ur, dui-demos-widgetsgallery-l10n-zh-cn
+Description: Demo application for DirectUI
+
+Package: dui-demos-widgetsgallery-tests
+Section: devel
+Architecture: any
+Depends: libdui0 (= ${Source-Version}), duitestrunner, dui-demos-widgetsgallery (= ${Source-Version})
+Description: Demo application for DirectUI
+
+Package: dui-demos-widgetsgallery-dbg
+Section: devel
+Architecture: any
+Depends: dui-demos-widgetsgallery (= ${Source-Version})
+Description: Demo application for DirectUI.
+ .
+ This package contains the debug symbols.
+
+Package: dui-demos-widgetsgallery-l10n-engineering-english
+Section: devel
+Architecture: any
+Enhances: dui-demos-widgetsgallery
+Replaces: dui-demos-widgetsgallery (<< 0.17.0-0)
+Description: Engineering English translations for widgetsgallery
+
+Package: dui-demos-widgetsgallery-l10n-ar
+Section: devel
+Architecture: any
+Enhances: dui-demos-widgetsgallery
+Replaces: dui-demos-widgetsgallery (<< 0.17.0-0)
+Description: Arabic translations for widgetsgallery
+
+Package: dui-demos-widgetsgallery-l10n-de
+Section: devel
+Architecture: any
+Enhances: dui-demos-widgetsgallery
+Replaces: dui-demos-widgetsgallery (<< 0.17.0-0)
+Description: German translations for widgetsgallery
+
+Package: dui-demos-widgetsgallery-l10n-en
+Section: devel
+Architecture: any
+Enhances: dui-demos-widgetsgallery
+Replaces: dui-demos-widgetsgallery (<< 0.17.0-0)
+Description: English translations for widgetsgallery
+
+Package: dui-demos-widgetsgallery-l10n-fi
+Section: devel
+Architecture: any
+Enhances: dui-demos-widgetsgallery
+Replaces: dui-demos-widgetsgallery (<< 0.17.0-0)
+Description: Finnish translations for widgetsgallery
+
+Package: dui-demos-widgetsgallery-l10n-hu
+Section: devel
+Architecture: any
+Enhances: dui-demos-widgetsgallery
+Replaces: dui-demos-widgetsgallery (<< 0.17.0-0)
+Description: Hungarian translations for widgetsgallery
+
+Package: dui-demos-widgetsgallery-l10n-ur
+Section: devel
+Architecture: any
+Enhances: dui-demos-widgetsgallery
+Replaces: dui-demos-widgetsgallery (<< 0.17.0-0)
+Description: Urdu translations for widgetsgallery
+
+Package: dui-demos-widgetsgallery-l10n-zh-cn
+Section: devel
+Architecture: any
+Enhances: dui-demos-widgetsgallery
+Replaces: dui-demos-widgetsgallery (<< 0.17.0-0)
+Description: Simplified Chinese translations for widgetsgallery
+
+Package: dui-demos-plainqt
+Section: devel
+Architecture: any
+Depends: libdui0 (= ${Source-Version})
+Replaces: dui-demos-plainqt (<< 0.16.0-1)
+Description: Demo applications showing the capabilities of the plain qt style.
+
+Package: dui-demos-plainqt-dbg
+Section: devel
+Architecture: any
+Depends: dui-demos-plainqt (= ${Source-Version})
+Replaces: dui-demos-plainqt-dbg (<< 0.16.0-1)
+Description: debug symbols of the plain qt examples
+
+Package: dui-demos-appletinstallationsource
+Section: devel
+Architecture: any
+Depends: libdui0 (= ${Source-Version})
+Description: Demo applet installation source for the applet library.
+
+Package: dui-demos-appletinstallationsource-dbg
+Section: devel
+Architecture: any
+Depends: dui-demos-appletinstallationsource (= ${Source-Version})
+Description: Debug symbols of the demo applet installation source.
+
+Package: libdui-tests
+Section: extra
+Architecture: any
+Depends: libdui0 (= ${Source-Version}), libqtgui4, testrunner, locales, ${shlibs:Depends}
+Description: libdui unit tests
+ Unit testing binaries and shellscripts for testing libdui library
+
+Package: libdui-benchmarks
+Section: extra
+Architecture: any
+Depends: libdui0 (= ${Source-Version}), ${shlibs:Depends}
+Description: libdui benchmarks
+ Benchmarking binaries for testing libdui library
+
+Package: libdui0-dbg
+Architecture: any
+Section: devel
+Depends: libdui0 (= ${Source-Version})
+Description: libdui debug package
+ libdui debug symbols.
+
+Package: libdui-doc
+Section: doc
+Architecture: all
+Description: API documentation for libdui
+
+Package: libdui-l10n-engineering-english
+Section: devel
+Architecture: any
+Enhances: libdui0
+Replaces: dui-demos-widgetsgallery (<< 0.17.0-0)
+Description: Engineering English translations for libdui
+
+Package: libdui-l10n-ar
+Section: devel
+Architecture: any
+Enhances: libdui0
+Replaces: dui-demos-widgetsgallery (<< 0.17.0-0)
+Description: Arabic translations for libdui
+
+Package: libdui-l10n-de
+Section: devel
+Architecture: any
+Enhances: libdui0
+Replaces: dui-demos-widgetsgallery (<< 0.17.0-0)
+Description: German translations for libdui
+
+Package: libdui-l10n-en
+Section: devel
+Architecture: any
+Enhances: libdui0
+Replaces: dui-demos-widgetsgallery (<< 0.17.0-0)
+Description: English translations for libdui
+
+Package: libdui-l10n-fi
+Section: devel
+Architecture: any
+Enhances: libdui0
+Replaces: dui-demos-widgetsgallery (<< 0.17.0-0)
+Description: Finnish translations for libdui
+
+Package: libdui-l10n-ur
+Section: devel
+Architecture: any
+Enhances: libdui0
+Replaces: dui-demos-widgetsgallery (<< 0.17.0-0)
+Description: Urdu translations for libdui
+
+Package: libdui-l10n-zh-cn
+Section: devel
+Architecture: any
+Enhances: libdui0
+Replaces: dui-demos-widgetsgallery (<< 0.17.0-0)
+Description: Simplified Chinese translations for libdui
+
+
+
diff --git a/debian/dui-demos-appletinstallationsource.install b/debian/dui-demos-appletinstallationsource.install
new file mode 100644
index 000000000..3e2001e9b
--- /dev/null
+++ b/debian/dui-demos-appletinstallationsource.install
@@ -0,0 +1 @@
+usr/lib/dui/appletinstallationsources/libfakeinstallationsource.so
diff --git a/debian/dui-demos-plainqt.install b/debian/dui-demos-plainqt.install
new file mode 100644
index 000000000..67ad5117a
--- /dev/null
+++ b/debian/dui-demos-plainqt.install
@@ -0,0 +1,9 @@
+usr/bin/qtstyledialogs
+usr/bin/qtstyleexample
+usr/share/applications/qtstyledialogs.desktop
+usr/share/applications/qtstyledialogs-windows-style.desktop
+usr/share/applications/qtstyleexample.desktop
+usr/share/applications/qtstyleexample-windows-style.desktop
+usr/share/dbus-1/services/com.nokia.qtstyledialogs.service
+usr/share/dbus-1/services/com.nokia.qtstyleexample.service
+usr/share/qtstyleexample/themes/style/qtstyleexample.css
diff --git a/debian/dui-demos-widgetsgallery-l10n-ar.install b/debian/dui-demos-widgetsgallery-l10n-ar.install
new file mode 100644
index 000000000..502e4c60c
--- /dev/null
+++ b/debian/dui-demos-widgetsgallery-l10n-ar.install
@@ -0,0 +1 @@
+usr/share/l10n/dui/widgetsgallery_ar.qm
diff --git a/debian/dui-demos-widgetsgallery-l10n-de.install b/debian/dui-demos-widgetsgallery-l10n-de.install
new file mode 100644
index 000000000..d6cfbfb5b
--- /dev/null
+++ b/debian/dui-demos-widgetsgallery-l10n-de.install
@@ -0,0 +1 @@
+usr/share/l10n/dui/widgetsgallery_de.qm
diff --git a/debian/dui-demos-widgetsgallery-l10n-en.install b/debian/dui-demos-widgetsgallery-l10n-en.install
new file mode 100644
index 000000000..f6778c500
--- /dev/null
+++ b/debian/dui-demos-widgetsgallery-l10n-en.install
@@ -0,0 +1 @@
+usr/share/l10n/dui/widgetsgallery_en.qm
diff --git a/debian/dui-demos-widgetsgallery-l10n-engineering-english.install b/debian/dui-demos-widgetsgallery-l10n-engineering-english.install
new file mode 100644
index 000000000..8d9bcc973
--- /dev/null
+++ b/debian/dui-demos-widgetsgallery-l10n-engineering-english.install
@@ -0,0 +1,2 @@
+usr/share/l10n/dui/widgetsgallery.qm
+usr/share/doc/dui-demos-widgetsgallery-l10n-engineering-english/widgetsgallery.ts
diff --git a/debian/dui-demos-widgetsgallery-l10n-fi.install b/debian/dui-demos-widgetsgallery-l10n-fi.install
new file mode 100644
index 000000000..3a0a4aba1
--- /dev/null
+++ b/debian/dui-demos-widgetsgallery-l10n-fi.install
@@ -0,0 +1 @@
+usr/share/l10n/dui/widgetsgallery_fi.qm
diff --git a/debian/dui-demos-widgetsgallery-l10n-hu.install b/debian/dui-demos-widgetsgallery-l10n-hu.install
new file mode 100644
index 000000000..85f9f9181
--- /dev/null
+++ b/debian/dui-demos-widgetsgallery-l10n-hu.install
@@ -0,0 +1 @@
+usr/share/l10n/dui/widgetsgallery_hu.qm
diff --git a/debian/dui-demos-widgetsgallery-l10n-ur.install b/debian/dui-demos-widgetsgallery-l10n-ur.install
new file mode 100644
index 000000000..c16f98485
--- /dev/null
+++ b/debian/dui-demos-widgetsgallery-l10n-ur.install
@@ -0,0 +1 @@
+usr/share/l10n/dui/widgetsgallery_ur.qm
diff --git a/debian/dui-demos-widgetsgallery-l10n-zh-cn.install b/debian/dui-demos-widgetsgallery-l10n-zh-cn.install
new file mode 100644
index 000000000..385dd4430
--- /dev/null
+++ b/debian/dui-demos-widgetsgallery-l10n-zh-cn.install
@@ -0,0 +1 @@
+usr/share/l10n/dui/widgetsgallery_zh_CN.qm
diff --git a/debian/dui-demos-widgetsgallery-tests.install b/debian/dui-demos-widgetsgallery-tests.install
new file mode 100644
index 000000000..0fa29f509
--- /dev/null
+++ b/debian/dui-demos-widgetsgallery-tests.install
@@ -0,0 +1 @@
+usr/share/dui-demos-widgetsgallery-tests/tests.xml
diff --git a/debian/dui-demos-widgetsgallery.dirs b/debian/dui-demos-widgetsgallery.dirs
new file mode 100644
index 000000000..0346ff3ac
--- /dev/null
+++ b/debian/dui-demos-widgetsgallery.dirs
@@ -0,0 +1,9 @@
+usr/bin
+usr/lib
+usr/share/widgetsgallery/themes
+usr/share/widgetsgallery/themes/style
+usr/share/widgetsgallery/themes/images
+usr/share/widgetsgallery/themes/images/contacts
+usr/share/widgetsgallery/themes/svg
+usr/share/themes/base/dui/widgetsgallery/feedbacks
+usr/share/applications
diff --git a/debian/dui-demos-widgetsgallery.install b/debian/dui-demos-widgetsgallery.install
new file mode 100644
index 000000000..c4f586ac2
--- /dev/null
+++ b/debian/dui-demos-widgetsgallery.install
@@ -0,0 +1,4 @@
+usr/bin/widgetsgallery
+usr/share/themes/*
+usr/share/applications/widgetsgallery.desktop
+usr/share/dbus-1/services/com.nokia.widgetsgallery.service
diff --git a/debian/dui-dev-tools.install b/debian/dui-dev-tools.install
new file mode 100644
index 000000000..342b29664
--- /dev/null
+++ b/debian/dui-dev-tools.install
@@ -0,0 +1,7 @@
+usr/bin/duimoc
+usr/bin/duigen
+usr/bin/dui-servicefwgen
+usr/bin/duiapplettester
+usr/bin/duiapplicationextensiontester
+usr/bin/duinotificationtool
+usr/bin/duinotificationstresstest
diff --git a/debian/dui-widgetsgallery-tests.dirs b/debian/dui-widgetsgallery-tests.dirs
new file mode 100644
index 000000000..089de51dc
--- /dev/null
+++ b/debian/dui-widgetsgallery-tests.dirs
@@ -0,0 +1 @@
+usr/share/dui-demos-widgetsgallery-tests
diff --git a/debian/dui-widgetsgallery-tests.install b/debian/dui-widgetsgallery-tests.install
new file mode 100644
index 000000000..0fa29f509
--- /dev/null
+++ b/debian/dui-widgetsgallery-tests.install
@@ -0,0 +1 @@
+usr/share/dui-demos-widgetsgallery-tests/tests.xml
diff --git a/debian/libdui-benchmarks.install b/debian/libdui-benchmarks.install
new file mode 100644
index 000000000..793241862
--- /dev/null
+++ b/debian/libdui-benchmarks.install
@@ -0,0 +1 @@
+usr/lib/libdui-benchmarks/*
diff --git a/debian/libdui-dev.dirs b/debian/libdui-dev.dirs
new file mode 100644
index 000000000..ba745b4bf
--- /dev/null
+++ b/debian/libdui-dev.dirs
@@ -0,0 +1,2 @@
+usr/include/dui
+usr/lib/pkgconfig
diff --git a/debian/libdui-dev.install b/debian/libdui-dev.install
new file mode 100644
index 000000000..32b42ba8d
--- /dev/null
+++ b/debian/libdui-dev.install
@@ -0,0 +1,5 @@
+usr/include/*
+usr/lib/pkgconfig/*
+usr/share/qt4/mkspecs/features/dui.prf
+usr/share/qt4/mkspecs/features/dui_defines.prf
+usr/share/qt4/mkspecs/features/translations.prf
diff --git a/debian/libdui-doc.install b/debian/libdui-doc.install
new file mode 100644
index 000000000..a2fd1d700
--- /dev/null
+++ b/debian/libdui-doc.install
@@ -0,0 +1 @@
+usr/share/doc/libdui/*
diff --git a/debian/libdui-l10n-ar.install b/debian/libdui-l10n-ar.install
new file mode 100644
index 000000000..4a4ff59fe
--- /dev/null
+++ b/debian/libdui-l10n-ar.install
@@ -0,0 +1 @@
+usr/share/l10n/dui/libdui_ar.qm
diff --git a/debian/libdui-l10n-de.install b/debian/libdui-l10n-de.install
new file mode 100644
index 000000000..dac113539
--- /dev/null
+++ b/debian/libdui-l10n-de.install
@@ -0,0 +1 @@
+usr/share/l10n/dui/libdui_de.qm
diff --git a/debian/libdui-l10n-en.install b/debian/libdui-l10n-en.install
new file mode 100644
index 000000000..ec58899d5
--- /dev/null
+++ b/debian/libdui-l10n-en.install
@@ -0,0 +1 @@
+usr/share/l10n/dui/libdui_en.qm
diff --git a/debian/libdui-l10n-engineering-english.install b/debian/libdui-l10n-engineering-english.install
new file mode 100644
index 000000000..d0d7fdac8
--- /dev/null
+++ b/debian/libdui-l10n-engineering-english.install
@@ -0,0 +1,2 @@
+usr/share/l10n/dui/libdui.qm
+usr/share/doc/libdui-l10n-engineering-english/libdui.ts
diff --git a/debian/libdui-l10n-fi.install b/debian/libdui-l10n-fi.install
new file mode 100644
index 000000000..fc5ae3558
--- /dev/null
+++ b/debian/libdui-l10n-fi.install
@@ -0,0 +1 @@
+usr/share/l10n/dui/libdui_fi.qm
diff --git a/debian/libdui-l10n-ur.install b/debian/libdui-l10n-ur.install
new file mode 100644
index 000000000..d74bd8170
--- /dev/null
+++ b/debian/libdui-l10n-ur.install
@@ -0,0 +1 @@
+usr/share/l10n/dui/libdui_ur.qm
diff --git a/debian/libdui-l10n-zh-cn.install b/debian/libdui-l10n-zh-cn.install
new file mode 100644
index 000000000..a45737ce1
--- /dev/null
+++ b/debian/libdui-l10n-zh-cn.install
@@ -0,0 +1 @@
+usr/share/l10n/dui/libdui_zh_CN.qm
diff --git a/debian/libdui-tests.dirs b/debian/libdui-tests.dirs
new file mode 100644
index 000000000..714f060ed
--- /dev/null
+++ b/debian/libdui-tests.dirs
@@ -0,0 +1,2 @@
+usr/lib/libdui-tests
+usr/share/libdui-tests
diff --git a/debian/libdui-tests.install b/debian/libdui-tests.install
new file mode 100644
index 000000000..c222af502
--- /dev/null
+++ b/debian/libdui-tests.install
@@ -0,0 +1,2 @@
+usr/share/libdui-tests/*
+usr/lib/libdui-tests/*
diff --git a/debian/libdui-tests.postinst b/debian/libdui-tests.postinst
new file mode 100644
index 000000000..0c6e28d3e
--- /dev/null
+++ b/debian/libdui-tests.postinst
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# add en_US.UTF-8 locale if not already there:
+# (this locale is needed for the test ft_duigconfitem)
+
+if ! egrep -q -E "^[[:space:]]*en_US.UTF-8[[:space:]]+UTF-8" /etc/locale.gen ; then
+ echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
+ /usr/sbin/locale-gen
+fi
diff --git a/debian/libdui0.dirs b/debian/libdui0.dirs
new file mode 100644
index 000000000..a9e6bb343
--- /dev/null
+++ b/debian/libdui0.dirs
@@ -0,0 +1,2 @@
+usr/lib/
+usr/lib/dui/applets
diff --git a/debian/libdui0.install b/debian/libdui0.install
new file mode 100644
index 000000000..7d48efcf9
--- /dev/null
+++ b/debian/libdui0.install
@@ -0,0 +1,7 @@
+usr/lib/libdui*.so*
+usr/lib/qt4/plugins/styles/libduiqtstyleplugin.so
+usr/bin/duithemedaemon
+usr/bin/duiservicemapper
+usr/share/dbus-1/services/com.nokia.servicefw.service
+usr/share/dui/shaders/*
+usr/lib/dui/applets/duiappletrunner
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 000000000..d74694b64
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,147 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Uncomment this to turn on verbose mode.
+export DH_VERBOSE=1
+
+DEBDIR = ..
+
+comma :=,
+empty :=
+space := $(empty) $(empty)
+
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+ INSTALL_PROGRAM += -s
+endif
+
+TMP_BUILD_OPTS = $(subst $(comma),$(space),$(DEB_BUILD_OPTIONS))
+
+ifneq (,$(filter parallel=%,$(TMP_BUILD_OPTS)))
+ NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(TMP_BUILD_OPTS)))
+ PARALLEL_MAKEFLAGS += -j$(NUMJOBS)
+endif
+
+
+# Enable instrumentation by setting DEB_BUILD_OPTION=coverage,...
+ifneq (,$(filter coverage,$(TMP_BUILD_OPTS)))
+ OPTIONS += -coverage
+endif
+
+# Enable instrumentation by setting DEB_BUILD_OPTION=timestamps,...
+ifneq (,$(filter timestamps,$(TMP_BUILD_OPTS)))
+ OPTIONS += -timestamps
+endif
+
+# Disable building of tests by setting DEB_BUILD_OPTION=notests,...
+ifneq (,$(filter nocheck,$(TMP_BUILD_OPTS)))
+ OPTIONS += -nomake tests
+endif
+
+# Disable building of benchmarks by setting DEB_BUILD_OPTION=nobenchmarks,...
+ifneq (,$(filter nobenchmarks,$(TMP_BUILD_OPTS)))
+ OPTIONS += -nomake benchmarks
+endif
+
+# Disable building of demos by setting DEB_BUILD_OPTION=nodemos,...
+ifneq (,$(filter nodemos,$(TMP_BUILD_OPTS)))
+ OPTIONS += -nomake demos
+endif
+
+# When doing official releases, set TESTABILITY to off. Defaults to on now
+# because integration cannot pass DEB_BUILD_OPTIONS.
+ifeq (,$(findstring notestability,$(DEB_BUILD_OPTIONS)))
+ OPTIONS += -testable
+endif
+
+QMAKE_OPTIONS += -r
+
+BUILD_DIR=build-$(shell dpkg-architecture -qDEB_BUILD_ARCH)
+
+configure: configure-stamp
+configure-stamp:
+ dh_testdir
+
+ mkdir -p $(BUILD_DIR)
+ ./configure --prefix=/usr -release -make "tests plainqt benchmarks" $(OPTIONS)
+ cd $(BUILD_DIR) && qmake $(QMAKE_OPTIONS) ../projects.pro
+
+ touch configure-stamp
+
+build: build-stamp
+build-stamp: configure-stamp
+ dh_testdir
+
+ cd $(BUILD_DIR) && make $(PARALLEL_MAKEFLAGS)
+
+ touch build-stamp
+
+clean:
+ dh_testdir
+ dh_testroot
+
+ rm -f build-stamp configure-stamp
+
+ rm -rf $(BUILD_DIR)
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_prep
+ dh_installdirs
+
+ # Add here commands to install the package into debian/tmp
+
+ #libdui-doc package
+ifeq (,$(findstring nodocs,$(DEB_BUILD_OPTIONS)))
+ cd $(BUILD_DIR) && make $(PARALLEL_MAKEFLAGS) doc
+endif
+
+ #libdui0 package
+ cd $(BUILD_DIR) && INSTALL_ROOT=$(CURDIR)/debian/tmp make $(PARALLEL_MAKEFLAGS) install
+
+ install -m 644 -D -p $(BUILD_DIR)/demos/widgetsgallery/translations/widgetsgallery.ts $(CURDIR)/debian/tmp/usr/share/doc/dui-demos-widgetsgallery-l10n-engineering-english/widgetsgallery.ts
+
+ install -m 644 -D -p $(BUILD_DIR)/src/translations/libdui.ts $(CURDIR)/debian/tmp/usr/share/doc/libdui-l10n-engineering-english/libdui.ts
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs
+ dh_installdocs
+ dh_install --sourcedir=debian/tmp -v
+# dh_installexamples
+# dh_install
+# dh_installmenu
+# dh_installdebconf
+# dh_installlogrotate
+# dh_installemacsen
+# dh_installpam
+# dh_installmime
+# dh_installinit
+# dh_installcron
+# dh_installinfo
+# dh_installman
+ dh_link
+ dh_strip -p libdui0 --dbg-package=libdui0
+ dh_strip -p dui-demos-widgetsgallery --dbg-package=dui-demos-widgetsgallery
+ dh_strip -p dui-demos-plainqt --dbg-package=dui-demos-plainqt
+ dh_strip -p libdui-tests
+ dh_compress
+ dh_fixperms
+# dh_perl
+# dh_python
+ dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb --destdir=$(DEBDIR)
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
diff --git a/demos/animatedlayout/.gitignore b/demos/animatedlayout/.gitignore
new file mode 100644
index 000000000..6f27c8f9f
--- /dev/null
+++ b/demos/animatedlayout/.gitignore
@@ -0,0 +1,3 @@
+animatedlayout
+qrc_animatedlayout.cpp
+
diff --git a/demos/animatedlayout/animatedlayout.cpp b/demos/animatedlayout/animatedlayout.cpp
new file mode 100644
index 000000000..6679dbedc
--- /dev/null
+++ b/demos/animatedlayout/animatedlayout.cpp
@@ -0,0 +1,547 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libdui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+/****************************************************************************
+**
+** This file was initially based on a part of a Qt Solutions component.
+**
+** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Solutions Commercial License Agreement provided
+** with the Software or, alternatively, in accordance with the terms
+** contained in a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** Please note Third Party Software included with Qt Solutions may impose
+** additional restrictions and it is the user's responsibility to ensure
+** that they have met the licensing requirements of the GPL, LGPL, or Qt
+** Solutions Commercial license and the relevant license of the Third
+** Party Software they are using.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+**
+****************************************************************************/
+
+#include
+#include "../../src/core/duiexport.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+//#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#define USE_INNER_FORM
+
+class AddItemButton;
+
+DuiScene *s_scene;
+QList s_policies;
+DuiFlowLayoutPolicy *s_flowLayoutPolicy;
+DuiLinearLayoutPolicy *s_innerPolicy;
+AddItemButton *s_addItemButton;
+
+/*!
+ * \class AnimatedlayoutRetranslator
+ * \brief AnimatedlayoutRetranslator is a test class to test translation on the fly
+ *
+ * This is just a simple test which will be changed soon.
+ *
+ */
+class AnimatedlayoutRetranslator : public QObject
+{
+ Q_OBJECT
+
+public slots:
+ void animatedlayoutRetranslate() {
+ qDebug() << __PRETTY_FUNCTION__;
+ DuiGConfItem languageItem("/Dui/i18n/Language");
+ QString language = languageItem.value().toString();
+ DuiLocale locale(language);
+ QString catalog = "animatedlayout";
+ locale.installTrCatalog(catalog);
+ DuiLocale::setDefault(locale);
+
+ // tell the scene and its items about the language change
+ QList items = s_scene->items();
+
+ foreach(QGraphicsItem * item, items) {
+ // call setLayoutDirection_helper() for all top-level items
+ if (!item->parentItem())
+ this->setLayoutDirection_helper(static_cast(item));
+
+ if (item->isWidget()) {
+ QGraphicsWidget *widget = static_cast(item);
+
+ QEvent ev(QEvent::LanguageChange);
+ qApp->sendEvent(widget, &ev);
+ QEvent evlayout(QEvent::LanguageChange);
+ qApp->sendEvent(widget, &evlayout);
+ }
+ }
+ }
+
+private:
+ void setLayoutDirection_helper(QGraphicsItem *item) {
+ if (item->isWidget()) {
+ QGraphicsWidget *widget = static_cast(item);
+ Qt::LayoutDirection direction = qApp->layoutDirection();
+ // if the direction has not changed or has been specified
+ // directly, do not update.
+ if (((direction == Qt::RightToLeft) == widget->testAttribute(Qt::WA_RightToLeft))
+ || widget->testAttribute(Qt::WA_SetLayoutDirection))
+ return;
+ widget->setAttribute(Qt::WA_RightToLeft, (direction == Qt::RightToLeft));
+ }
+ // Propagate this change to all children.
+ const int childItemsSize = item->childItems().size();
+ for (int i = 0; i < childItemsSize; ++i) {
+ QGraphicsItem *childItem = item->childItems().at(i);
+ setLayoutDirection_helper(childItem);
+ }
+ if (item->isWidget()) {
+ // Send the notification event to this widget item.
+ QEvent e(QEvent::LayoutDirectionChange);
+ QApplication::sendEvent(static_cast(item), &e);
+ }
+ }
+};
+
+class ContainerWidget : public QGraphicsWidget
+{
+public:
+ ContainerWidget(QGraphicsItem *parent = 0)
+ : QGraphicsWidget(parent)
+ {}
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) {
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
+ QLinearGradient linearGrad(QPointF(0, 0), QPointF(size().width() / 5, size().height() / 5));
+ linearGrad.setColorAt(0, QColor(0, 0, 0, 255));
+ linearGrad.setColorAt(1, QColor(0, 0, 0, 0));
+ painter->setPen(Qt::NoPen);
+ painter->setBrush(linearGrad);
+ painter->drawRoundedRect(0, 0, size().width() / 2, size().height() / 2, 5, 5);
+
+ QLinearGradient linearGrad2(QPointF(size().width(), 0), QPointF(size().width() * 4 / 5, size().height() / 5));
+ linearGrad2.setColorAt(0, QColor(0, 0, 0, 255));
+ linearGrad2.setColorAt(1, QColor(0, 0, 0, 0));
+ painter->setBrush(linearGrad2);
+ painter->drawRoundedRect(size().width() / 2, 0, size().width() / 2, size().height() / 2, 5, 5);
+ }
+};
+class Button : public QGraphicsWidget
+{
+ Q_OBJECT
+public:
+ Button(const QPixmap &pixmap, QGraphicsItem *parent = 0)
+ : QGraphicsWidget(parent), _pix(pixmap) {
+ setAcceptHoverEvents(true);
+ setCacheMode(DeviceCoordinateCache);
+ }
+
+ QRectF boundingRect() const {
+ return QRectF(-65, -65, 130, 130);
+ }
+
+ QPainterPath shape() const {
+ QPainterPath path;
+ path.addEllipse(boundingRect());
+ return path;
+ }
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *) {
+ bool down = option->state & QStyle::State_Sunken;
+ QRectF r = boundingRect();
+ QLinearGradient grad(r.topLeft(), r.bottomRight());
+ grad.setColorAt(down ? 1 : 0, option->state & QStyle::State_MouseOver ? Qt::white : Qt::lightGray);
+ grad.setColorAt(down ? 0 : 1, Qt::darkGray);
+ painter->setPen(Qt::darkGray);
+ painter->setBrush(grad);
+ painter->drawEllipse(r);
+ QLinearGradient grad2(r.topLeft(), r.bottomRight());
+ grad.setColorAt(down ? 1 : 0, Qt::darkGray);
+ grad.setColorAt(down ? 0 : 1, Qt::lightGray);
+ painter->setPen(Qt::NoPen);
+ painter->setBrush(grad);
+ if (down)
+ painter->translate(2, 2);
+ painter->drawEllipse(r.adjusted(5, 5, -5, -5));
+ painter->drawPixmap(-_pix.width() / 2, -_pix.height() / 2, _pix);
+ }
+
+signals:
+ void pressed();
+
+protected:
+ void mousePressEvent(QGraphicsSceneMouseEvent *) {
+ emit pressed();
+ update();
+ }
+
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *) {
+ update();
+ }
+
+private:
+ QPixmap _pix;
+};
+
+class AnimatedlayoutLabel : public DuiLabel
+{
+ Q_OBJECT
+public:
+ AnimatedlayoutLabel(const QString &messageId, DuiWidget *parent = 0)
+ : DuiLabel(parent), _messageId(messageId) {
+ this->setText(qtTrId(_messageId.toUtf8().constData()));
+ }
+protected:
+ virtual void retranslateUi() {
+ this->setText(qtTrId(_messageId.toUtf8().constData()));
+ }
+private:
+ QString _messageId;
+};
+
+class ChangePolicyObjectNameButton : public DuiButton
+{
+ Q_OBJECT
+public:
+ ChangePolicyObjectNameButton(const QString &messageId, const QString &objectName, DuiWidget *parent = 0)
+ : DuiButton(parent), _objectName(objectName), _messageId(messageId) {
+ retranslateUi();
+ }
+protected:
+ virtual void retranslateUi() {
+ this->setText(qtTrId(_messageId.toUtf8().constData()));
+ }
+
+ void mousePressEvent(QGraphicsSceneMouseEvent *event) {
+ foreach(DuiAbstractLayoutPolicy * policy, s_policies) {
+ policy->setObjectName(_objectName);
+ }
+ DuiButton::mousePressEvent(event);
+ }
+private:
+ QString _objectName;
+ QString _messageId;
+};
+
+
+class Image : public DuiImageWidget
+{
+public:
+ explicit Image(const QString &imageName, DuiWidget *parent = 0)
+ : DuiImageWidget(imageName, parent) {
+ setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
+ }
+ virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) {
+ DuiLayout *layout = dynamic_cast(parentLayoutItem());
+ if (layout) {
+ if (event && event->button() == Qt::RightButton) {
+ layout->removeItem(this);
+ deleteLater();
+ } else
+ layout->animatedDeleteItem(this);
+ }
+ }
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
+ //Paint a white background so that we completely paint the bounding box
+ painter->setPen(Qt::NoPen);
+ painter->setBrush(Qt::white);
+ painter->drawRect(QRectF(0, 0, size().width(), size().height()));
+ DuiImageWidget::paint(painter, option, widget);
+ }
+};
+
+class AddItemButton : public DuiButton
+{
+public:
+ AddItemButton(DuiWidget *parent = 0)
+ : DuiButton("+", parent)
+ {}
+protected:
+ void mousePressEvent(QGraphicsSceneMouseEvent *event) {
+ Image *item = new Image("dui-logo-red");
+ item->setObjectName("new");
+ item->setVisible(false);
+
+ s_flowLayoutPolicy->insertItem(10, item);
+ DuiButton::mousePressEvent(event);
+ }
+};
+
+
+class ChangePolicyButton : public Button
+{
+public:
+ ChangePolicyButton(const QPixmap &pixmap, DuiAbstractLayoutPolicy *policy, QGraphicsItem *parent = 0)
+ : Button(pixmap, parent), _policy(policy)
+ {}
+protected:
+ void mousePressEvent(QGraphicsSceneMouseEvent *event) {
+ _policy->activate();
+ Button::mousePressEvent(event);
+ DuiLinearLayoutPolicy *linearPolicy = dynamic_cast(_policy);
+ if (linearPolicy &&
+ linearPolicy->orientation() == Qt::Vertical)
+ s_innerPolicy->setOrientation(Qt::Horizontal);
+ else
+ s_innerPolicy->setOrientation(Qt::Vertical);
+ s_addItemButton->setVisible(_policy == s_flowLayoutPolicy);
+ }
+private:
+ DuiAbstractLayoutPolicy *_policy;
+};
+
+class View : public QGraphicsView
+{
+public:
+ View(QGraphicsScene *scene) : QGraphicsView(scene) { }
+
+protected:
+ void resizeEvent(QResizeEvent *event) {
+ QGraphicsView::resizeEvent(event);
+ fitInView(sceneRect(), Qt::KeepAspectRatio);
+ }
+};
+
+
+int main(int argc, char **argv)
+{
+ DuiApplication app(argc, argv);
+
+ AnimatedlayoutRetranslator animatedlayoutRetranslator;
+ QObject::connect(&app, SIGNAL(localeSettingsChanged()), &animatedlayoutRetranslator, SLOT(animatedlayoutRetranslate()));
+
+ QPixmap *bgPix = new QPixmap("images/background.png");
+
+ s_scene = new DuiScene;
+ int offset = 0; //sets where the background image starts tiling from
+ s_scene->setSceneRect(offset, offset, 864, 480);
+
+ //We scale the background pixmap to be a bit bigger than the actual scene because
+ //when its resized, the aspect ratio might not be exactly 1:1. It's an ugly hack
+ QGraphicsPixmapItem *background = new QGraphicsPixmapItem(bgPix->scaled(864 + 10, 480 + 10));
+ s_scene->addItem(background);
+ background->setZValue(-1);
+ background->setPos(-5, -5);
+
+ DuiLayout *layout = new DuiLayout;
+ QGraphicsWidget *form = new ContainerWidget;
+ form->setLayout(layout);
+ s_scene->addItem(form);
+ form->setGeometry(offset, offset, 864, 480);
+ form->setPreferredWidth(864);
+ form->setPreferredHeight(480);
+ form->setMaximumWidth(864);
+ form->setMaximumHeight(480);
+ form->setMinimumWidth(864);
+ form->setMinimumHeight(480);
+
+ DuiGridLayoutPolicy *gridPolicy = new DuiGridLayoutPolicy(layout);
+ DuiLinearLayoutPolicy *linearHorizontalPolicy = new DuiLinearLayoutPolicy(layout, Qt::Horizontal);
+ DuiLinearLayoutPolicy *linearVerticalPolicy = new DuiLinearLayoutPolicy(layout, Qt::Vertical);
+ s_flowLayoutPolicy = new DuiFlowLayoutPolicy(layout);
+ DuiAbstractLayoutPolicy *emptyPolicy = new DuiLinearLayoutPolicy(layout, Qt::Horizontal);
+ s_policies << linearHorizontalPolicy;
+ s_policies << linearVerticalPolicy;
+ s_policies << gridPolicy;
+ s_policies << s_flowLayoutPolicy;
+ s_policies << emptyPolicy;
+// DuiFreestyleLayoutPolicy *freestylePolicy = new DuiFreestyleLayoutPolicy(layout);
+
+ DuiLayout *innerLayout = new DuiLayout;
+#ifdef USE_INNER_FORM
+ QGraphicsWidget *innerForm = new QGraphicsWidget;
+ innerForm->setLayout(innerLayout);
+ innerForm->setContentsMargins(0, 0, 0, 0);
+ innerForm->setMaximumWidth(50);
+ innerForm->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+#endif
+ s_innerPolicy = new DuiLinearLayoutPolicy(innerLayout, Qt::Vertical);
+ innerLayout->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+
+ for (int i = 0; i < 4; ++i) {
+ Image *item = new Image("dui-logo-blue");
+ item->setObjectName("blue");
+ item->setVisible(false);
+ //add to active policy first
+ s_innerPolicy->addItem(item);
+ }
+
+ int i = 0;
+ for (int y = 0; y < 10; ++y) {
+ for (int x = 0; x < 4; ++x, ++i) {
+ Image *item = new Image("dui-logo");
+ item->setZValue(i);
+ item->setVisible(false);
+ //add to active policy first
+ if (y < 4) {
+ gridPolicy->addItem(item, y, x);
+ Q_ASSERT(item->scene());
+ linearHorizontalPolicy->addItem(item);
+ linearVerticalPolicy->addItem(item);
+// freestylePolicy->addItemAtGeometry(item, QRectF(100*x,100*y,130,130));
+ }
+ s_flowLayoutPolicy->addItem(item);
+ }
+ gridPolicy->setColumnMaximumWidth(y, 50);
+ }
+
+ //% "Hello"
+ AnimatedlayoutLabel *textlabel = new AnimatedlayoutLabel(QT_TRID_NOOP("xx_hello"));
+ textlabel->setObjectName("myLabelMultiLength");
+ textlabel->setTextElide(true);
+ gridPolicy->addItem(textlabel, 4, 0);
+ linearHorizontalPolicy->addItem(textlabel);
+ linearVerticalPolicy->addItem(textlabel);
+#ifdef USE_INNER_FORM
+ s_flowLayoutPolicy->addItem(textlabel);
+ gridPolicy->addItem(innerForm, 4, 1, 1, 1);
+ linearHorizontalPolicy->addItem(innerForm);
+ linearVerticalPolicy->addItem(innerForm);
+ s_flowLayoutPolicy->addItem(innerForm);
+#else
+ s_flowLayoutPolicy->addItem(textlabel);
+ gridPolicy->addItem(innerLayout, 4, 1, 1, 1);
+ linearHorizontalPolicy->addItem(innerLayout);
+ linearVerticalPolicy->addItem(innerLayout);
+ s_flowLayoutPolicy->addItem(innerLayout);
+#endif
+
+ Q_ASSERT(dynamic_cast(s_innerPolicy->itemAt(0))->scene());
+
+ // Buttons
+ QGraphicsWidget *buttonParent = new QGraphicsWidget;
+ QList