From: APTX Date: Wed, 23 Sep 2009 13:14:43 +0000 (+0200) Subject: - Port to the State machine classes from 4.6.0. X-Git-Url: https://gitweb.aptx.org/?a=commitdiff_plain;h=e2c0c11cae0971ec470eeb3012dc993eb780d39f;p=aniplayer-old.git - Port to the State machine classes from 4.6.0. - Remove qtstatemachine-solution lib. --- diff --git a/lib/anidbudpclient/anidbudpclient.pro b/lib/anidbudpclient/anidbudpclient.pro index 9575960..9f2968b 100644 --- a/lib/anidbudpclient/anidbudpclient.pro +++ b/lib/anidbudpclient/anidbudpclient.pro @@ -57,5 +57,3 @@ CONV_HEADERS += include/AniDBUdpClient/Client \ include/AniDBUdpClient/UptimeCommand \ include/AniDBUdpClient/Hash \ include/AniDBUdpClient/UptimeCommand \ - -include(../../lib/qtstatemachine/src/qtstatemachine.pri) diff --git a/lib/anidbudpclient/client.cpp b/lib/anidbudpclient/client.cpp index 151d856..4acb117 100644 --- a/lib/anidbudpclient/client.cpp +++ b/lib/anidbudpclient/client.cpp @@ -1,9 +1,8 @@ #include "client.h" -#include -#include -#include -#include +#include +#include +#include #include #include @@ -52,20 +51,20 @@ qDebug() << "Api instance init!"; setFloodInterval(5); - stateMachine = new QtStateMachine(this); - - errorState = new QtState; - disconnectedState = new QtState; - connectingState = new QtState; - connectedState = new QtState; - authenticatingState = new QtState(connectedState); - idleState = new QtState(connectedState); - idleTimeoutState = new QtState(connectedState); - sendState = new QtState(connectedState); - waitState = new QtState(connectedState); - recieveState = new QtState; - recieveFailState = new QtState; - connectedHistoryState = connectedState->addHistoryState(); + stateMachine = new QStateMachine(this); + + errorState = new QState; + disconnectedState = new QState; + connectingState = new QState; + connectedState = new QState; + authenticatingState = new QState(connectedState); + idleState = new QState(connectedState); + idleTimeoutState = new QState(connectedState); + sendState = new QState(connectedState); + waitState = new QState(connectedState); + recieveState = new QState; + recieveFailState = new QState; + connectedHistoryState = new QHistoryState(connectedState); stateMachine->addState(errorState); stateMachine->addState(disconnectedState); @@ -111,19 +110,19 @@ qDebug() << "Api instance init!"; // ------------ END Transitions ------------------- // ------------- Methods --------------------- - errorState->invokeMethodOnEntry(this, "enterErrorState"); - disconnectedState->invokeMethodOnEntry(this, "enterDisconnectedState"); - connectingState->invokeMethodOnEntry(this, "enterConnectingState"); - connectedState->invokeMethodOnEntry(this, "enterConnectedState"); - authenticatingState->invokeMethodOnEntry(this, "enterAuthenticatingState"); - sendState->invokeMethodOnEntry(this, "enterSendState"); - waitState->invokeMethodOnEntry(this, "enterWaitState"); - idleState->invokeMethodOnEntry(this, "enterIdleState"); - idleState->invokeMethodOnExit(this, "exitIdleState"); - idleTimeoutState->invokeMethodOnEntry(this, "enterIdleTiemoutState"); - - recieveState->invokeMethodOnEntry(this, "enterRecieveState"); - recieveFailState->invokeMethodOnEntry(this, "enterRecieveFailState"); + QObject::connect(errorState, SIGNAL(entered()), this, SLOT(enterErrorState())); + QObject::connect(disconnectedState, SIGNAL(entered()), this, SLOT(enterDisconnectedState())); + QObject::connect(connectingState, SIGNAL(entered()), this, SLOT(enterConnectingState())); + QObject::connect(connectedState, SIGNAL(entered()), this, SLOT(enterConnectedState())); + QObject::connect(authenticatingState, SIGNAL(entered()), this, SLOT(enterAuthenticatingState())); + QObject::connect(sendState, SIGNAL(entered()), this, SLOT(enterSendState())); + QObject::connect(waitState, SIGNAL(entered()), this, SLOT(enterWaitState())); + QObject::connect(idleState, SIGNAL(entered()), this, SLOT(enterIdleState())); + QObject::connect(idleState, SIGNAL(exited()), this, SLOT(exitIdleState())); + QObject::connect(idleTimeoutState, SIGNAL(entered()), this, SLOT(enterIdleTiemoutState())); + + QObject::connect(recieveState, SIGNAL(entered()), this, SLOT(enterRecieveState())); + QObject::connect(recieveFailState, SIGNAL(entered()), this, SLOT(enterRecieveFailState())); // ------------ END Methods ------------------- stateMachine->start(); diff --git a/lib/anidbudpclient/client.h b/lib/anidbudpclient/client.h index 728ba49..6f5b854 100644 --- a/lib/anidbudpclient/client.h +++ b/lib/anidbudpclient/client.h @@ -12,9 +12,9 @@ #include "anidbudpclient_global.h" #include "authcommand.h" -class QtStateMachine; -class QtState; -class QtHistoryState; +class QStateMachine; +class QState; +class QHistoryState; class QUdpSocket; class QTimer; @@ -208,22 +208,22 @@ private: static const int UDP_API_COMMAND_TIMEOUT = 10; - QtStateMachine *stateMachine; - QtState *errorState; - QtState *disconnectedState; - QtState *connectingState; - QtState *connectedState; - QtState *authenticatingState; + QStateMachine *stateMachine; + QState *errorState; + QState *disconnectedState; + QState *connectingState; + QState *connectedState; + QState *authenticatingState; - QtState *idleState; - QtState *idleTimeoutState; - QtState *sendState; - QtState *waitState; + QState *idleState; + QState *idleTimeoutState; + QState *sendState; + QState *waitState; - QtState *recieveState; - QtState *recieveFailState; + QState *recieveState; + QState *recieveFailState; - QtHistoryState *connectedHistoryState; + QHistoryState *connectedHistoryState; }; class CommandData : QObject diff --git a/lib/qtstatemachine/.licenseAccepted b/lib/qtstatemachine/.licenseAccepted deleted file mode 100644 index d788f0d..0000000 --- a/lib/qtstatemachine/.licenseAccepted +++ /dev/null @@ -1 +0,0 @@ -license accepted diff --git a/lib/qtstatemachine/INSTALL.TXT b/lib/qtstatemachine/INSTALL.TXT deleted file mode 100644 index 8d41864..0000000 --- a/lib/qtstatemachine/INSTALL.TXT +++ /dev/null @@ -1,254 +0,0 @@ -INSTALLATION INSTRUCTIONS - -These instructions refer to the package you are installing as -some-package.tar.gz or some-package.zip. The .zip file is intended for use -on Windows. - -The directory you choose for the installation will be referred to as -your-install-dir. - -Note to Qt Visual Studio Integration users: In the instructions below, -instead of building from command line with nmake, you can use the menu -command 'Qt->Open Solution from .pro file' on the .pro files in the -example and plugin directories, and then build from within Visual -Studio. - -Unpacking and installation --------------------------- - -1. Unpacking the archive (if you have not done so already). - - On Unix and Mac OS X (in a terminal window): - - cd your-install-dir - gunzip some-package.tar.gz - tar xvf some-package.tar - - This creates the subdirectory some-package containing the files. - - On Windows: - - Unpack the .zip archive by right-clicking it in explorer and - choosing "Extract All...". If your version of Windows does not - have zip support, you can use the infozip tools available - from www.info-zip.org. - - If you are using the infozip tools (in a command prompt window): - cd your-install-dir - unzip some-package.zip - -2. Configuring the package. - - The configure script is called "configure" on unix/mac and - "configure.bat" on Windows. It should be run from a command line - after cd'ing to the package directory. - - You can choose whether you want to use the component by including - its source code directly into your project, or build the component - as a dynamic shared library (DLL) that is loaded into the - application at run-time. The latter may be preferable for - technical or licensing (LGPL) reasons. If you want to build a DLL, - run the configure script with the argument "-library". Also see - the note about usage below. - - (Components that are Qt plugins, e.g. styles and image formats, - are by default built as a plugin DLL.) - - The configure script will prompt you in some cases for further - information. Answer these questions and carefully read the license text - before accepting the license conditions. The package cannot be used if - you do not accept the license conditions. - -3. Building the component and examples (when required). - - If a DLL is to be built, or if you would like to build the - examples, next give the commands - - qmake - make [or nmake if your are using Microsoft Visual C++] - - The example program(s) can be found in the directory called - "examples" or "example". - - Components that are Qt plugins, e.g. styles and image formats, are - ready to be used as soon as they are built, so the rest of this - installation instruction can be skipped. - -4. Building the Qt Designer plugin (optional). - - Some of the widget components are provided with plugins for Qt - Designer. To build and install the plugin, cd into the - some-package/plugin directory and give the commands - - qmake - make [or nmake if your are using Microsoft Visual C++] - - Restart Qt Designer to make it load the new widget plugin. - - Note: If you are using the built-in Qt Designer from the Qt Visual - Studio Integration, you will need to manually copy the plugin DLL - file, i.e. copy - %QTDIR%\plugins\designer\some-component.dll - to the Qt Visual Studio Integration plugin path, typically: - C:\Program Files\Trolltech\Qt VS Integration\plugins - - Note: If you for some reason are using a Qt Designer that is built - in debug mode, you will need to build the plugin in debug mode - also. Edit the file plugin.pro in the plugin directory, changing - 'release' to 'debug' in the CONFIG line, before running qmake. - - - -Solutions components are intended to be used directly from the package -directory during development, so there is no 'make install' procedure. - - -Using a component in your project ---------------------------------- - -To use this component in your project, add the following line to the -project's .pro file (or do the equivalent in your IDE): - - include(your-install-dir/some-package/src/some-package.pri) - -This adds the package's sources and headers to the SOURCES and HEADERS -project variables respectively (or, if the component has been -configured as a DLL, it adds that library to the LIBS variable), and -updates INCLUDEPATH to contain the package's src -directory. Additionally, the .pri file may include some dependencies -needed by the package. - -To include a header file from the package in your sources, you can now -simply use: - - #include - -or alternatively, in pre-Qt 4 style: - - #include - -Refer to the documentation to see the classes and headers this -components provides. - - - -Install documentation (optional) --------------------------------- - -The HTML documentation for the package's classes is located in the -your-install-dir/some-package/doc/html/index.html. You can open this -file and read the documentation with any web browser. - -To install the documentation into Qt Assistant (for Qt version 4.4 and -later): - -1. In Assistant, open the Edit->Preferences dialog and choose the - Documentation tab. Click the Add... button and select the file - your-install-dir/some-package/doc/html/some-package.qch - -For Qt versions prior to 4.4, do instead the following: - -1. The directory your-install-dir/some-package/doc/html contains a - file called some-package.dcf. Execute the following commands in a - shell, command prompt or terminal window: - - cd your-install-dir/some-package/doc/html/ - assistant -addContentFile some-package.dcf - -The next time you start Qt Assistant, you can access the package's -documentation. - - -Removing the documentation from assistant ------------------------------------------ - -If you have installed the documentation into Qt Assistant, and want to uninstall it, do as follows, for Qt version 4.4 and later: - -1. In Assistant, open the Edit->Preferences dialog and choose the - Documentation tab. In the list of Registered Documentation, select - the item com.trolltech.qtsolutions.some-package_version, and click - the Remove button. - -For Qt versions prior to 4.4, do instead the following: - -1. The directory your-install-dir/some-package/doc/html contains a - file called some-package.dcf. Execute the following commands in a - shell, command prompt or terminal window: - - cd your-install-dir/some-package/doc/html/ - assistant -removeContentFile some-package.dcf - - - -Using the component as a DLL ----------------------------- - -1. Normal components - - The shared library (DLL) is built and placed in the - some-package/lib directory. It is intended to be used directly - from there during development. When appropriate, both debug and - release versions are built, since the run-time linker will in some - cases refuse to load a debug-built DLL into a release-built - application or vice versa. - - The following steps are taken by default to help the dynamic - linker to locate the DLL at run-time (during development): - - Unix: The some-package.pri file will add linker instructions to - add the some-package/lib directory to the rpath of the - executable. (When distributing, or if your system does not support - rpath, you can copy the shared library to another place that is - searched by the dynamic linker, e.g. the "lib" directory of your - Qt installation.) - - Mac: The full path to the library is hardcoded into the library - itself, from where it is copied into the executable at link time, - and ready by the dynamic linker at run-time. (When distributing, - you will want to edit these hardcoded paths in the same way as for - the Qt DLLs. Refer to the document "Deploying an Application on - Mac OS X" in the Qt Reference Documentation.) - - Windows: the .dll file(s) are copied into the "bin" directory of - your Qt installation. The Qt installation will already have set up - that directory to be searched by the dynamic linker. - - -2. Plugins - - For Qt Solutions plugins (e.g. image formats), both debug and - release versions of the plugin are built by default when - appropriate, since in some cases the release Qt library will not - load a debug plugin, and vice versa. The plugins are automatically - copied into the plugins directory of your Qt installation when - built, so no further setup is required. - - Plugins may also be built statically, i.e. as a library that will be - linked into your application executable, and so will not need to - be redistributed as a separate plugin DLL to end users. Static - building is required if Qt itself is built statically. To do it, - just add "static" to the CONFIG variable in the plugin/plugin.pro - file before building. Refer to the "Static Plugins" section in the - chapter "How to Create Qt Plugins" for explanation of how to use a - static plugin in your application. The source code of the example - program(s) will also typically contain the relevant instructions - as comments. - - - -Uninstalling ------------- - - The following command will remove any fils that have been - automatically placed outside the package directory itself during - installation and building - - make distclean [or nmake if your are using Microsoft Visual C++] - - If Qt Assistant documentation or Qt Designer plugins have been - installed, they can be uninstalled manually, ref. above. - - -Enjoy! :) - -- The Qt Solutions Team. diff --git a/lib/qtstatemachine/LGPL_EXCEPTION.txt b/lib/qtstatemachine/LGPL_EXCEPTION.txt deleted file mode 100644 index 0b56ff1..0000000 --- a/lib/qtstatemachine/LGPL_EXCEPTION.txt +++ /dev/null @@ -1,10 +0,0 @@ -Nokia Qt LGPL Exception version 1.0 - -As a special exception to the GNU Lesser General Public License -version 2.1, the object code form of a "work that uses the Library" -may incorporate material from a header file that is part of the -Library. You may distribute such object code under terms of your -choice, provided that the incorporated material (i) does not exceed -more than 5% of the total size of the Library; and (ii) is limited to -numerical parameters, data structure layouts, accessors, macros, -inline functions and templates. diff --git a/lib/qtstatemachine/LICENSE.GPL3 b/lib/qtstatemachine/LICENSE.GPL3 deleted file mode 100644 index 94a9ed0..0000000 --- a/lib/qtstatemachine/LICENSE.GPL3 +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, 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 -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If 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 convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU 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 -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "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 PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state 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 program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/lib/qtstatemachine/LICENSE.LGPL b/lib/qtstatemachine/LICENSE.LGPL deleted file mode 100644 index 5ab7695..0000000 --- a/lib/qtstatemachine/LICENSE.LGPL +++ /dev/null @@ -1,504 +0,0 @@ - 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/lib/qtstatemachine/README.TXT b/lib/qtstatemachine/README.TXT deleted file mode 100644 index 091571b..0000000 --- a/lib/qtstatemachine/README.TXT +++ /dev/null @@ -1,10 +0,0 @@ -Qt State Machine Framework v1.1 - -This component adds an API for creating hierarchical finite state -machines. Note that this solution is experimental and work in -progress: No backwards compatibility (source nor binary) is -provided. - -The State Machine Framework lets you define and run state -machines. It also includes tools to load or compile SCXML files. - diff --git a/lib/qtstatemachine/buildlib/buildlib.pro b/lib/qtstatemachine/buildlib/buildlib.pro deleted file mode 100644 index d9e2758..0000000 --- a/lib/qtstatemachine/buildlib/buildlib.pro +++ /dev/null @@ -1,13 +0,0 @@ -TEMPLATE=lib -CONFIG += qt dll qtstatemachine-buildlib -mac:CONFIG += absolute_library_soname -win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release build_all -include(../src/qtstatemachine.pri) -TARGET = $$QTSTATEMACHINE_LIBNAME -DESTDIR = $$QTSTATEMACHINE_LIBDIR -win32 { - DLLDESTDIR = $$[QT_INSTALL_BINS] - QMAKE_DISTCLEAN += $$[QT_INSTALL_BINS]\\$${QTSTATEMACHINE_LIBNAME}.dll -} -target.path = $$DESTDIR -INSTALLS += target diff --git a/lib/qtstatemachine/common.pri b/lib/qtstatemachine/common.pri deleted file mode 100644 index e0b2a6e..0000000 --- a/lib/qtstatemachine/common.pri +++ /dev/null @@ -1,6 +0,0 @@ -infile(config.pri, SOLUTIONS_LIBRARY, yes): CONFIG += qtstatemachine-uselib -TEMPLATE += fakelib -QTSTATEMACHINE_LIBNAME = $$qtLibraryTarget(QtSolutions_StateMachineFramework-1.1) -TEMPLATE -= fakelib -QTSTATEMACHINE_LIBDIR = $$PWD/lib -unix:qtstatemachine-uselib:!qtstatemachine-buildlib:QMAKE_RPATHDIR += $$QTSTATEMACHINE_LIBDIR diff --git a/lib/qtstatemachine/config.pri b/lib/qtstatemachine/config.pri deleted file mode 100644 index 8d70e45..0000000 --- a/lib/qtstatemachine/config.pri +++ /dev/null @@ -1 +0,0 @@ -SOLUTIONS_LIBRARY = no diff --git a/lib/qtstatemachine/configure.bat b/lib/qtstatemachine/configure.bat deleted file mode 100644 index 7ce1985..0000000 --- a/lib/qtstatemachine/configure.bat +++ /dev/null @@ -1,134 +0,0 @@ -@echo off - -rem -rem "Main" -rem - -if not "%1"=="" ( - if not "%1"=="-library" ( - call :PrintUsage - goto EOF - ) -) - -rem only ask to accept the license text once -if exist .licenseAccepted goto HandleArgs - -rem determine if free or commercial package -set edition=commercial -if exist LICENSE.LGPL. set edition=free - -if %edition%==free ( - call :HandleFree -) else ( - call :RegionLoop - call :Comm -) -echo . - -if not exist .licenseAccepted ( - echo You are not licensed to use this software. - goto EOF -) - -:HandleArgs -if exist config.pri. del config.pri -if "%1"=="-library" ( - echo Configuring to build this component as a dynamic library. - echo SOLUTIONS_LIBRARY = yes > config.pri -) - -echo . -echo This component is now configured. -echo . -echo To build the component library (if requested) and example(s), -echo run qmake and your make or nmake command. -echo . -echo To remove or reconfigure, run make (nmake) distclean. -echo . - -goto EOF - -rem -rem "License acceptance loops" -rem - -:RegionLoop - echo . - echo Please choose your region. - echo . - echo Type 1 for North or South America. - echo Type 2 for anywhere outside North and South America. - echo . - set /p region=Select: - if %region%==1 ( - set licenseFile=LICENSE.US - goto EOF - ) - if %region%==2 ( - set licenseFile=LICENSE.NO - goto EOF - ) -goto RegionLoop - -:HandleFree - echo . - echo You are licensed to use this software under the terms of - echo the GNU General Public License (GPL) version 3, or - echo the GNU Lesser General Public License (LGPL) version 2.1 - echo with certain additional extra rights as specified in the - echo Nokia Qt LGPL Exception version 1.0. - echo . - echo Type 'G' to view the GNU General Public License (GPL) version 3 - echo Type 'L' to view the GNU Lesser General Public License (LGPL) version 2.1 - echo Type 'E' to view the Nokia Qt LGPL Exception version 1.0. - echo Type 'yes' to accept this license offer. - echo Type 'no' to decline this license offer. - echo . - set /p answer=Do you accept the terms of this license? - - if %answer%==no goto EOF - if %answer%==yes ( - echo license accepted > .licenseAccepted - goto EOF - ) - if %answer%==g more LICENSE.GPL3 - if %answer%==G more LICENSE.GPL3 - if %answer%==l more LICENSE.LGPL - if %answer%==L more LICENSE.LGPL - if %answer%==e more LGPL_EXCEPTION.txt - if %answer%==E more LGPL_EXCEPTION.txt -goto HandleFree - -:Comm - echo . - echo License Agreement - echo . - echo Type '?' to view the Qt Solutions Commercial License. - echo Type 'yes' to accept this license offer. - echo Type 'no' to decline this license offer. - echo . - set /p answer=Do you accept the terms of this license? - - if %answer%==no goto EOF - if %answer%==yes ( - echo license accepted > .licenseAccepted - copy %licenseFile% LICENSE - del LICENSE.US - del LICENSE.NO - goto EOF - ) - if %answer%==? more %licenseFile% -goto Comm - -:PrintUsage -echo Usage: configure.bat [-library] -echo . -echo -library: Build the component as a dynamic library (DLL). Default is to -echo include the component source directly in the application. -echo A DLL may be preferable for technical or licensing (LGPL) reasons. -echo . -goto EOF - - -:EOF diff --git a/lib/qtstatemachine/doc/external-resources.qdoc b/lib/qtstatemachine/doc/external-resources.qdoc deleted file mode 100644 index bd75435..0000000 --- a/lib/qtstatemachine/doc/external-resources.qdoc +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -/*! - \externalpage http://www.w3.org/TR/scxml/ - \title State Chart XML: State Machine Notation for Control Abstraction -*/ - -/*! - \externalpage http://www.wisdom.weizmann.ac.il/~dharel/SCANNED.PAPERS/Statecharts.pdf - \title Statecharts: A visual formalism for complex systems -*/ diff --git a/lib/qtstatemachine/doc/groups.qdoc b/lib/qtstatemachine/doc/groups.qdoc deleted file mode 100644 index 6ca1f57..0000000 --- a/lib/qtstatemachine/doc/groups.qdoc +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -/*! - \group statemachine - - \title State Machine Classes - \brief Classes for constructing and executing state graphs. - - These classes are provided by \l{The State Machine Framework} for creating - event-driven state machines. -*/ - -/*! - \group sctools - - \title Statechart Tools (SCXML) Classes - \brief Classes for loading SCXML files and running state-machines with script - - These classes allow loading of state-machines in runtime or compile time - from SCXML, and provides a scripting environment for the loaded state machine. - - See \l {scxml.html}{Using SCXML files with the Qt State Machine} for more info. - -*/ \ No newline at end of file diff --git a/lib/qtstatemachine/doc/html/classic.css b/lib/qtstatemachine/doc/html/classic.css deleted file mode 100644 index 0ff9e7d..0000000 --- a/lib/qtstatemachine/doc/html/classic.css +++ /dev/null @@ -1,131 +0,0 @@ -h3.fn,span.fn -{ - margin-left: 1cm; - text-indent: -1cm; -} - -a:link -{ - color: #004faf; - text-decoration: none -} - -a:visited -{ - color: #672967; - text-decoration: none -} - -a.obsolete -{ - color: #661100; - text-decoration: none -} - -a.compat -{ - color: #661100; - text-decoration: none -} - -a.obsolete:visited -{ - color: #995500; - text-decoration: none -} - -a.compat:visited -{ - color: #995500; - text-decoration: none -} - -td.postheader -{ - font-family: sans-serif -} - -tr.address -{ - font-family: sans-serif -} - -body -{ - background: #ffffff; - color: black -} - -table tr.odd { - background: #f0f0f0; - color: black; -} - -table tr.even { - background: #e4e4e4; - color: black; -} - -table.annotated th { - padding: 3px; - text-align: left -} - -table.annotated td { - padding: 3px; -} - -table tr pre -{ - padding-top: none; - padding-bottom: none; - padding-left: none; - padding-right: none; - border: none; - background: none -} - -tr.qt-style -{ - background: #a2c511; - color: black -} - -body pre -{ - padding: 0.2em; - border: #e7e7e7 1px solid; - background: #f1f1f1; - color: black -} - -span.preprocessor, span.preprocessor a -{ - color: darkblue; -} - -span.comment -{ - color: darkred; - font-style: italic -} - -span.string,span.char -{ - color: darkgreen; -} - -.title -{ - text-align: center -} - -.subtitle -{ - font-size: 0.8em -} - -.small-subtitle -{ - font-size: 0.65em -} diff --git a/lib/qtstatemachine/doc/html/images/qt-logo.png b/lib/qtstatemachine/doc/html/images/qt-logo.png deleted file mode 100644 index 794162f..0000000 Binary files a/lib/qtstatemachine/doc/html/images/qt-logo.png and /dev/null differ diff --git a/lib/qtstatemachine/doc/html/images/statemachine-button-history.png b/lib/qtstatemachine/doc/html/images/statemachine-button-history.png deleted file mode 100644 index cd66478..0000000 Binary files a/lib/qtstatemachine/doc/html/images/statemachine-button-history.png and /dev/null differ diff --git a/lib/qtstatemachine/doc/html/images/statemachine-button-nested.png b/lib/qtstatemachine/doc/html/images/statemachine-button-nested.png deleted file mode 100644 index 60360d1..0000000 Binary files a/lib/qtstatemachine/doc/html/images/statemachine-button-nested.png and /dev/null differ diff --git a/lib/qtstatemachine/doc/html/images/statemachine-button.png b/lib/qtstatemachine/doc/html/images/statemachine-button.png deleted file mode 100644 index 75d9e53..0000000 Binary files a/lib/qtstatemachine/doc/html/images/statemachine-button.png and /dev/null differ diff --git a/lib/qtstatemachine/doc/html/images/statemachine-finished.png b/lib/qtstatemachine/doc/html/images/statemachine-finished.png deleted file mode 100644 index 802621e..0000000 Binary files a/lib/qtstatemachine/doc/html/images/statemachine-finished.png and /dev/null differ diff --git a/lib/qtstatemachine/doc/html/images/statemachine-nonparallel.png b/lib/qtstatemachine/doc/html/images/statemachine-nonparallel.png deleted file mode 100644 index 1fe60d8..0000000 Binary files a/lib/qtstatemachine/doc/html/images/statemachine-nonparallel.png and /dev/null differ diff --git a/lib/qtstatemachine/doc/html/images/statemachine-parallel.png b/lib/qtstatemachine/doc/html/images/statemachine-parallel.png deleted file mode 100644 index 1868792..0000000 Binary files a/lib/qtstatemachine/doc/html/images/statemachine-parallel.png and /dev/null differ diff --git a/lib/qtstatemachine/doc/html/index.html b/lib/qtstatemachine/doc/html/index.html deleted file mode 100644 index 1120592..0000000 --- a/lib/qtstatemachine/doc/html/index.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - Qt State Machine Framework - - - - - - - -
  Home

Qt State Machine Framework
-

- -

Description

-

This component adds an API for creating hierarchical finite state machines. Note that this solution is experimental and work in progress: No backwards compatibility (source nor binary) is provided.

-

The State Machine Framework lets you define and run state machines. It also includes tools to load or compile SCXML files.

- -

Overview

- - -

Classes

- - -

Tested platforms

-
    -
  • Qt 4.4, 4.5 / Windows XP / MSVC.NET 2005
  • -
  • Qt 4.4, 4.5 / Linux / gcc
  • -
  • Qt 4.4, 4.5 / MacOS X 10.5 / gcc
  • -
-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtabstractstate-members.html b/lib/qtstatemachine/doc/html/qtabstractstate-members.html deleted file mode 100644 index 4063779..0000000 --- a/lib/qtstatemachine/doc/html/qtabstractstate-members.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - List of All Members for QtAbstractState - - - - - - - -
  Home

List of All Members for QtAbstractState

-

This is the complete list of members for QtAbstractState, including inherited members.

-

- -
-

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtabstractstate.html b/lib/qtstatemachine/doc/html/qtabstractstate.html deleted file mode 100644 index f064938..0000000 --- a/lib/qtstatemachine/doc/html/qtabstractstate.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - QtAbstractState Class Reference - - - - - - - -
  Home

QtAbstractState Class Reference
[QtCore module] -

-

The QtAbstractState class is the base class of states of a QtStateMachine. More...

-
 #include <QtAbstractState>

Inherits QObject.

-

Inherited by QtActionState and QtHistoryState.

-

This class was introduced in qtstatemachine 4.6.

- - -

Public Types

-
    -
  • enum RestorePolicy { GlobalRestorePolicy, DoNotRestoreProperties, RestoreProperties }
  • -
- -

Properties

- -
    -
  • 1 property inherited from QObject
  • -
- -

Public Functions

- -
    -
  • 29 public functions inherited from QObject
  • -
- -

Protected Functions

- -
    -
  • 7 protected functions inherited from QObject
  • -
-

Additional Inherited Members

-
    -
  • 1 public slot inherited from QObject
  • -
  • 1 signal inherited from QObject
  • -
  • 1 public type inherited from QObject
  • -
  • 4 static public members inherited from QObject
  • -
  • 2 protected variables inherited from QObject
  • -
- -
-

Detailed Description

-

The QtAbstractState class is the base class of states of a QtStateMachine.

-

The QtAbstractState class is the abstract base class of states that are part of a QtStateMachine. It defines the interface that all state objects have in common. QtAbstractState is part of The State Machine Framework.

-

The assignProperty() function is used for defining property assignments that should be performed when a state is entered.

-

The parentState() function returns the state's parent state.

- -

Subclassing

-

The onEntry() function is called when the state is entered; reimplement this function to perform custom processing when the state is entered.

-

The onExit() function is called when the state is exited; reimplement this function to perform custom processing when the state is exited.

-
-

Member Type Documentation

-

enum QtAbstractState::RestorePolicy

-

This enum specifies the restore policy type for a state. The restore policy takes effect when the machine enters a state which sets one or more properties. If the restore policy of the state is set to RestoreProperties, the state machine will save the original value of the property before the new value is set.

-

Later, when the machine either enters a state which has its restore policy set to DoNotRestoreProperties or when it enters a state which does not set a value for the given property, the property will automatically be restored to its initial value.

-

Only one initial value will be saved for any given property. If a value for a property has already been saved by the state machine, it will not be overwritten until the property has been successfully restored. Once the property has been restored, the state machine will clear the initial value until it enters a new state which sets the property and which has RestoreProperties as its restore policy.

-

- - - - -
ConstantValueDescription
QtAbstractState::GlobalRestorePolicy0The restore policy for the state should be retrieved using QtStateMachine::globalRestorePolicy()
QtAbstractState::DoNotRestoreProperties1The state machine should not save the initial values of properties set in the state and restore them later.
QtAbstractState::RestoreProperties2The state machine should save the initial values of properties set in the state and restore them later.

-

See also setRestorePolicy(), restorePolicy(), and QtAbstractState::assignProperty().

-
-

Property Documentation

-

restorePolicy : RestorePolicy

-

This property holds the restore policy of this state.

-

Access functions:

-
    -
  • RestorePolicy restorePolicy () const
  • -
  • void setRestorePolicy ( RestorePolicy restorePolicy )
  • -
-
-

Member Function Documentation

-

QtAbstractState::QtAbstractState ( QtState * parent = 0 )   [protected]

-

Constructs a new state with the given parent state.

-

QtAbstractState::~QtAbstractState ()

-

Destroys this state.

-

void QtAbstractState::assignProperty ( QObject * object, const char * name, const QVariant & value )

-

Instructs this state to set the property with the given name of the given object to the given value when the state is entered.

-

void QtAbstractState::onEntry ()   [pure virtual protected]

-

This function is called when the state is entered. Reimplement this function to perform custom processing when the state is entered.

-

void QtAbstractState::onExit ()   [pure virtual protected]

-

This function is called when the state is exited. Reimplement this function to perform custom processing when the state is exited.

-

QtState * QtAbstractState::parentState () const

-

Returns this state's parent state, or 0 if the state has no parent state.

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtabstracttransition-members.html b/lib/qtstatemachine/doc/html/qtabstracttransition-members.html deleted file mode 100644 index fe9a2e1..0000000 --- a/lib/qtstatemachine/doc/html/qtabstracttransition-members.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - List of All Members for QtAbstractTransition - - - - - - - -
  Home

List of All Members for QtAbstractTransition

-

This is the complete list of members for QtAbstractTransition, including inherited members.

-

- -
-

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtabstracttransition.html b/lib/qtstatemachine/doc/html/qtabstracttransition.html deleted file mode 100644 index a0199d3..0000000 --- a/lib/qtstatemachine/doc/html/qtabstracttransition.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - QtAbstractTransition Class Reference - - - - - - - -
  Home

QtAbstractTransition Class Reference
[QtCore module] -

-

The QtAbstractTransition class is the base class of transitions between QtAbstractState objects. More...

-
 #include <QtAbstractTransition>

Inherits QObject.

-

Inherited by QtTransition.

-

This class was introduced in qtstatemachine 4.6.

- - -

Properties

- -
    -
  • 1 property inherited from QObject
  • -
- -

Public Functions

- -
    -
  • 29 public functions inherited from QObject
  • -
- -

Protected Functions

- -
    -
  • 7 protected functions inherited from QObject
  • -
-

Additional Inherited Members

-
    -
  • 1 public slot inherited from QObject
  • -
  • 1 signal inherited from QObject
  • -
  • 1 public type inherited from QObject
  • -
  • 4 static public members inherited from QObject
  • -
  • 2 protected variables inherited from QObject
  • -
- -
-

Detailed Description

-

The QtAbstractTransition class is the base class of transitions between QtAbstractState objects.

-

The QtAbstractTransition class is the abstract base class of transitions between states (QtAbstractState objects) of a QtStateMachine. QtAbstractTransition is part of The State Machine Framework.

-

The QtTransition class provides a default (action-based) implementation of the QtAbstractTransition interface.

-

The sourceState() function returns the source of the transition. The targetStates() function returns the targets of the transition.

-

Transitions can cause animations to be played. Use the addAnimation() function to add an animation to the transition.

- -

Subclassing

-

The eventTest() function is called by the state machine to determine whether an event should trigger the transition. In your reimplementation you typically check the event type and cast the event object to the proper type, and check that one or more properties of the event meet your criteria.

-

The onTransition() function is called when the transition is triggered; reimplement this function to perform custom processing for the transition.

-
-

Property Documentation

-

source : QtState * const

-

This property holds the source state (parent) of this transition.

-

Access functions:

-
    -
  • QtState * sourceState () const
  • -
-

target : QtAbstractState *

-

This property holds the target state of this transition.

-

Access functions:

-
    -
  • QtAbstractState * targetState () const
  • -
  • void setTargetState ( QtAbstractState * target )
  • -
-

targets : QList<QtAbstractState *>

-

This property holds the target states of this transition.

-

If multiple states are specified, all must be descendants of the same parallel group state.

-

Access functions:

-
    -
  • QList<QtAbstractState *> targetStates () const
  • -
  • void setTargetStates ( const QList<QtAbstractState *> & targets )
  • -
-
-

Member Function Documentation

-

QtAbstractTransition::QtAbstractTransition ( QtState * sourceState = 0 )

-

Constructs a new QtAbstractTransition object with the given sourceState.

-

QtAbstractTransition::QtAbstractTransition ( const QList<QtAbstractState *> & targets, QtState * sourceState = 0 )

-

Constructs a new QtAbstractTransition object with the given targets and sourceState.

-

QtAbstractTransition::~QtAbstractTransition ()   [virtual]

-

Destroys this transition.

-

void QtAbstractTransition::addAnimation ( QAbstractAnimation * animation )

-

Adds the given animation to this transition. The transition does not take ownership of the animation.

-

See also removeAnimation() and animations().

-

QList<QAbstractAnimation *> QtAbstractTransition::animations () const

-

Returns the list of animations associated with this transition, or an empty list if it has no animations.

-

See also addAnimation().

-

bool QtAbstractTransition::eventTest ( QEvent * event ) const   [pure virtual protected]

-

This function is called to determine whether the given event should cause this transition to trigger. Reimplement this function and return true if the event should trigger the transition, otherwise return false.

-

void QtAbstractTransition::onTransition ()   [pure virtual protected]

-

This function is called when the transition is triggered. Reimplement this function to perform custom processing when the transition is triggered.

-

void QtAbstractTransition::removeAnimation ( QAbstractAnimation * animation )

-

Removes the given animation from this transition.

-

See also addAnimation().

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtactionstate-members.html b/lib/qtstatemachine/doc/html/qtactionstate-members.html deleted file mode 100644 index 2d424e6..0000000 --- a/lib/qtstatemachine/doc/html/qtactionstate-members.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - List of All Members for QtActionState - - - - - - - -
  Home

List of All Members for QtActionState

-

This is the complete list of members for QtActionState, including inherited members.

-

- -
-

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtactionstate.html b/lib/qtstatemachine/doc/html/qtactionstate.html deleted file mode 100644 index b837c3c..0000000 --- a/lib/qtstatemachine/doc/html/qtactionstate.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - QtActionState Class Reference - - - - - - - -
  Home

QtActionState Class Reference
[QtCore module] -

-

The QtActionState class provides an action-based state. More...

-
 #include <QtActionState>

Inherits QtAbstractState.

-

Inherited by QtFinalState and QtState.

-

This class was introduced in qtstatemachine 4.6.

- - -

Public Functions

- - -

Additional Inherited Members

- - -
-

Detailed Description

-

The QtActionState class provides an action-based state.

-

QtActionState executes state actions when the state is entered and exited. QtActionState is part of The State Machine Framework.

-

You can add actions to a state with the addEntryAction() and addExitAction() functions. The state executes the actions when the state is entered and exited, respectively.

-

The invokeMethodOnEntry() and invokeMethodOnExit() functions are used for defining method invocations that should be performed when a state is entered and exited, respectively.

-
 QtState *s2 = new QtState();
- s2->invokeMethodOnEntry(&label, "showMaximized");
- machine.addState(s2);
-

See also QtStateAction.

-
-

Member Function Documentation

-

QtActionState::QtActionState ( QtState * parent = 0 )

-

Constructs a new action state with the given parent state.

-

QtActionState::~QtActionState ()

-

Destroys this action state.

-

void QtActionState::addEntryAction ( QtStateAction * action )

-

Adds the given action to this state. The action will be executed when this state is entered. The state takes ownership of the action.

-

See also addExitAction() and removeEntryAction().

-

void QtActionState::addExitAction ( QtStateAction * action )

-

Adds the given action to this state. The action will be executed when this state is exited. The state takes ownership of the action.

-

See also addEntryAction() and removeExitAction().

-

QList<QtStateAction *> QtActionState::entryActions () const

-

Returns this state's entry actions.

-

See also addEntryAction() and exitActions().

-

QList<QtStateAction *> QtActionState::exitActions () const

-

Returns this state's exit actions.

-

See also addExitAction() and entryActions().

-

void QtActionState::invokeMethodOnEntry ( QObject * object, const char * method, const QList<QVariant> & arguments = QList<QVariant> () )

-

Instructs this state to invoke the given method of the given object with the given arguments when the state is entered. This function will create a QtStateInvokeMethodAction object and add it to the entry actions of the state.

-

See also invokeMethodOnExit() and addEntryAction().

-

void QtActionState::invokeMethodOnExit ( QObject * object, const char * method, const QList<QVariant> & arguments = QList<QVariant> () )

-

Instructs this state to invoke the given method of the given object with the given arguments when the state is exited. This function will create a QtStateInvokeMethodAction object and add it to the exit actions of the state.

-

See also invokeMethodOnEntry() and addExitAction().

-

void QtActionState::removeEntryAction ( QtStateAction * action )

-

Removes the given entry action from this state. The state releases ownership of the action.

-

See also addEntryAction().

-

void QtActionState::removeExitAction ( QtStateAction * action )

-

Removes the given exit action from this state. The state releases ownership of the action.

-

See also addExitAction().

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qteventtransition-members.html b/lib/qtstatemachine/doc/html/qteventtransition-members.html deleted file mode 100644 index e502108..0000000 --- a/lib/qtstatemachine/doc/html/qteventtransition-members.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - List of All Members for QtEventTransition - - - - - - - -
  Home

List of All Members for QtEventTransition

-

This is the complete list of members for QtEventTransition, including inherited members.

-

- -
-

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qteventtransition.html b/lib/qtstatemachine/doc/html/qteventtransition.html deleted file mode 100644 index 7c4e7a9..0000000 --- a/lib/qtstatemachine/doc/html/qteventtransition.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - QtEventTransition Class Reference - - - - - - - -
  Home

QtEventTransition Class Reference
[QtCore module] -

-

The QtEventTransition class provides a QObject-specific transition for Qt events. More...

-
 #include <QtEventTransition>

Inherits QtTransition.

-

This class was introduced in qtstatemachine 4.6.

- - -

Properties

- - - -

Public Functions

- - - -

Protected Functions

- - -

Additional Inherited Members

-
    -
  • 1 public slot inherited from QObject
  • -
  • 1 signal inherited from QObject
  • -
  • 1 public type inherited from QObject
  • -
  • 4 static public members inherited from QObject
  • -
  • 2 protected variables inherited from QObject
  • -
- -
-

Detailed Description

-

The QtEventTransition class provides a QObject-specific transition for Qt events.

-

A QtEventTransition object binds an event to a particular QObject. QtEventTransition is part of The State Machine Framework.

-

Example:

-
 QPushButton *button = ...;
- QtState *s1 = ...;
- QtState *s2 = ...;
- // If in s1 and the button receives an Enter event, transition to s2
- QtEventTransition *enterTransition = new QtEventTransition(button, QEvent::Enter);
- enterTransition->setTargetState(s2);
- s1->addTransition(enterTransition);
- // If in s2 and the button receives an Exit event, transition back to s1
- QtEventTransition *leaveTransition = new QtEventTransition(button, QEvent::Leave);
- leaveTransition->setTargetState(s1);
- s2->addTransition(leaveTransition);
- -

Subclassing

-

Many event classes have attributes in addition to the event type itself. The testEventCondition() function can be reimplemented to check attributes of an event instance in order to determine whether the transition should be triggered or not.

-

See also QtState::addTransition().

-
-

Property Documentation

-

eventType : QEvent::Type

-

This property holds the type of event that this event transition is associated with.

-

Access functions:

-
    -
  • QEvent::Type eventType () const
  • -
  • void setEventType ( QEvent::Type type )
  • -
-

object : QObject *

-

This property holds the event source that this event transition is associated with.

-

Access functions:

-
    -
  • QObject * eventSource () const
  • -
  • void setEventSource ( QObject * object )
  • -
-
-

Member Function Documentation

-

QtEventTransition::QtEventTransition ( QtState * sourceState = 0 )

-

Constructs a new QtEventTransition object with the given sourceState.

-

QtEventTransition::QtEventTransition ( QObject * object, QEvent::Type type, QtState * sourceState = 0 )

-

Constructs a new QtEventTransition object associated with events of the given type for the given object, and with the given sourceState.

-

QtEventTransition::QtEventTransition ( QObject * object, QEvent::Type type, const QList<QtAbstractState *> & targets, QtState * sourceState = 0 )

-

Constructs a new QtEventTransition object associated with events of the given type for the given object. The transition has the given targets and sourceState.

-

QtEventTransition::~QtEventTransition ()

-

Destroys this QObject event transition.

-

bool QtEventTransition::testEventCondition ( QEvent * event ) const   [virtual protected]

-

Tests an instance of an event associated with this event transition and returns true if the transition should be taken, otherwise returns false. The type of the given event will be eventType().

-

Reimplement this function if you have custom conditions associated with the transition. The default implementation always returns true.

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtfinalstate-members.html b/lib/qtstatemachine/doc/html/qtfinalstate-members.html deleted file mode 100644 index 9777fd0..0000000 --- a/lib/qtstatemachine/doc/html/qtfinalstate-members.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - List of All Members for QtFinalState - - - - - - - -
  Home

List of All Members for QtFinalState

-

This is the complete list of members for QtFinalState, including inherited members.

-

- -
-

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtfinalstate.html b/lib/qtstatemachine/doc/html/qtfinalstate.html deleted file mode 100644 index 209b469..0000000 --- a/lib/qtstatemachine/doc/html/qtfinalstate.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - QtFinalState Class Reference - - - - - - - -
  Home

QtFinalState Class Reference
[QtCore module] -

-

The QtFinalState class provides a final state. More...

-
 #include <QtFinalState>

Inherits QtActionState.

-

This class was introduced in qtstatemachine 4.6.

- - -

Public Functions

- - -

Additional Inherited Members

- - -
-

Detailed Description

-

The QtFinalState class provides a final state.

-

A final state is used to communicate that (part of) a QtStateMachine has finished its work. When a final top-level state is entered, the state machine's finished() signal is emitted. In general, when a final substate (a child of a QtState) is entered, a QtStateFinishedEvent is generated for the final state's parent state. QtFinalState is part of The State Machine Framework.

-

To use a final state, you create a QtFinalState object and add a transition to it from another state. Example:

-
 QPushButton button;
-
- QtStateMachine machine;
- QtState *s1 = new QtState();
- QtFinalState *s2 = new QtFinalState();
- s1->addTransition(&button, SIGNAL(clicked()), s2);
- machine.addState(s1);
- machine.addState(s2);
-
- QObject::connect(&machine, SIGNAL(finished()), QApplication::instance(), SLOT(quit()));
- machine.setInitialState(s1);
- machine.start();
-

See also QtStateFinishedTransition.

-
-

Member Function Documentation

-

QtFinalState::QtFinalState ( QtState * parent = 0 )

-

Constructs a new QtFinalState object with the given parent state.

-

QtFinalState::~QtFinalState ()

-

Destroys this final state.

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qthistorystate-members.html b/lib/qtstatemachine/doc/html/qthistorystate-members.html deleted file mode 100644 index 5d5854b..0000000 --- a/lib/qtstatemachine/doc/html/qthistorystate-members.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - List of All Members for QtHistoryState - - - - - - - -
  Home

List of All Members for QtHistoryState

-

This is the complete list of members for QtHistoryState, including inherited members.

-

- -
-

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qthistorystate.html b/lib/qtstatemachine/doc/html/qthistorystate.html deleted file mode 100644 index 2be41b9..0000000 --- a/lib/qtstatemachine/doc/html/qthistorystate.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - QtHistoryState Class Reference - - - - - - - -
  Home

QtHistoryState Class Reference
[QtCore module] -

-

The QtHistoryState class provides a means of returning to a previously active substate. More...

-
 #include <QtHistoryState>

Inherits QtAbstractState.

-

This class was introduced in qtstatemachine 4.6.

- - -

Public Functions

- - -

Additional Inherited Members

- - -
-

Detailed Description

-

The QtHistoryState class provides a means of returning to a previously active substate.

-

A history state is a pseudo-state that represents the child state that the parent state was in the last time the parent state was exited. A transition with a history state as its target is in fact a transition to one of the other child states of the parent state. QtHistoryState is part of The State Machine Framework.

-

Use QtState::addHistoryState() to construct a history state. Use the setDefaultState() function to set the state that should be entered if the parent state has never been entered. Example:

-
 QtStateMachine machine;
-
- QtState *s1 = new QtState();
- QtState *s11 = new QtState(s1);
- QtState *s12 = new QtState(s1);
-
- QtState *s1h = s1->addHistoryState();
- s1h->setDefaultState(s11);
-
- machine.addState(s1);
-
- QtState *s2 = new QtState();
- machine.addState(s2);
-
- QPushButton *button = new QPushButton();
- // Clicking the button will cause the state machine to enter the child state
- // that s1 was in the last time s1 was exited, or the history state's default
- // state if s1 has never been entered.
- s1->addTransition(button, SIGNAL(clicked()), s1h);
-
-

Member Function Documentation

-

QtHistoryState::~QtHistoryState ()

-

Destroys this history state.

-

QtAbstractState * QtHistoryState::defaultState () const

-

Returns this history state's default state. The default state indicates the state to transition to if the parent state has never been entered before.

-

See also setDefaultState().

-

void QtHistoryState::setDefaultState ( QtAbstractState * state )

-

Sets this history state's default state to be the given state. state must be a sibling of this history state.

-

See also defaultState().

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtscriptedevent-members.html b/lib/qtstatemachine/doc/html/qtscriptedevent-members.html deleted file mode 100644 index bd39b5f..0000000 --- a/lib/qtstatemachine/doc/html/qtscriptedevent-members.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - List of All Members for QtScriptedEvent - - - - - - - -
  Home

List of All Members for QtScriptedEvent

-

This is the complete list of members for QtScriptedEvent, including inherited members.

-

- -
-

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtscriptedevent-metadata-members.html b/lib/qtstatemachine/doc/html/qtscriptedevent-metadata-members.html deleted file mode 100644 index 8d02640..0000000 --- a/lib/qtstatemachine/doc/html/qtscriptedevent-metadata-members.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - List of All Members for MetaData - - - - - - - -
  Home

List of All Members for MetaData

-

This is the complete list of members for QtScriptedEvent::MetaData, including inherited members.

- -


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtscriptedevent-metadata.html b/lib/qtstatemachine/doc/html/qtscriptedevent-metadata.html deleted file mode 100644 index 7eddbe1..0000000 --- a/lib/qtstatemachine/doc/html/qtscriptedevent-metadata.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - MetaData Class Reference - - - - - - - -
  Home

MetaData Class Reference
(QtScriptedEvent::MetaData)
-

- - -

Public Types

-
    -
  • enum Kind { Platform, Internal, External }
  • -
- -
-

Member Type Documentation

-

enum MetaData::Kind

-

This enum specifies the kind (or context) of the event.

-

- - - - -
ConstantValueDescription
QtScriptedEvent::MetaData::Platform0An event coming from the itself, such as a script error.
QtScriptedEvent::MetaData::Internal1An event sent with a <raise> or <send target="_internal">.
QtScriptedEvent::MetaData::External2An event sent from an invoker, directly from C++, or from a <send target="scxml"> element.

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtscriptedevent.html b/lib/qtstatemachine/doc/html/qtscriptedevent.html deleted file mode 100644 index 455fde5..0000000 --- a/lib/qtstatemachine/doc/html/qtscriptedevent.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - QtScriptedEvent Class Reference - - - - - - - -
  Home

QtScriptedEvent Class Reference

-

The QtScriptedEvent class stands for a general named event with a list of parameter names and parameter values. More...

-
 #include <QtScriptedEvent>

Inherits QEvent.

- - -

Public Types

- - -

Public Functions

-
    -
  • QtScriptedEvent ( const QString & name, const QStringList & paramNames = QStringList(), const QVariantList & paramValues = QVariantList(), const QScriptValue & content = QScriptValue() )
  • -
  • QScriptValue content () const
  • -
  • QString eventName () const
  • -
  • QVariant param ( const QString & name ) const
  • -
  • QStringList paramNames () const
  • -
  • QVariantList paramValues () const
  • -
-
    -
  • 6 public functions inherited from QEvent
  • -
- -

Static Public Members

- -
    -
  • 1 static public member inherited from QEvent
  • -
-

Additional Inherited Members

-
    -
  • 1 property inherited from QEvent
  • -
  • 2 protected variables inherited from QEvent
  • -
- -
-

Detailed Description

-

The QtScriptedEvent class stands for a general named event with a list of parameter names and parameter values.

-

Encapsulates an event that conforms to the SCXML definition of events.

-
-

Member Function Documentation

-

QtScriptedEvent::QtScriptedEvent ( const QString & name, const QStringList & paramNames = QStringList(), const QVariantList & paramValues = QVariantList(), const QScriptValue & content = QScriptValue() )

-

Creates a QtScriptedEvent named name, with parameter names paramNames, parameter values paramValues, and a QtScript object content as an additional parameter.

-

QScriptValue QtScriptedEvent::content () const

-

Return a QtScript object that can be passed as an additional parameter.

-

QString QtScriptedEvent::eventName () const

-

Returns the name of the event.

-

QEvent::Type QtScriptedEvent::eventType ()   [static]

-

Returns a statically-generated event type to be used by SCXML events.

-

QVariant QtScriptedEvent::param ( const QString & name ) const

-

Returns the parameter value equivalent to parameter name.

-

QStringList QtScriptedEvent::paramNames () const

-

Return a list containing the parameter names.

-

QVariantList QtScriptedEvent::paramValues () const

-

Return a list containing the parameter values.

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtscriptedstatemachine-members.html b/lib/qtstatemachine/doc/html/qtscriptedstatemachine-members.html deleted file mode 100644 index 352bfd3..0000000 --- a/lib/qtstatemachine/doc/html/qtscriptedstatemachine-members.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - List of All Members for QtScriptedStateMachine - - - - - - - -
  Home

List of All Members for QtScriptedStateMachine

-

This is the complete list of members for QtScriptedStateMachine, including inherited members.

-

- -
-

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtscriptedstatemachine.html b/lib/qtstatemachine/doc/html/qtscriptedstatemachine.html deleted file mode 100644 index e99a5fb..0000000 --- a/lib/qtstatemachine/doc/html/qtscriptedstatemachine.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - QtScriptedStateMachine Class Reference - - - - - - - -
  Home

QtScriptedStateMachine Class Reference

-

The QtScriptedStateMachine class provides a way to use scripting with the Qt State Machine Framework. More...

-
 #include <QtScriptedStateMachine>

Inherits QtStateMachine.

-

Note: All the functions in this class are reentrant.

- - -

Properties

- - - -

Public Functions

- - - -

Public Slots

- - - -

Signals

- - - -

Static Public Members

-
    -
  • QtScriptedStateMachine * load ( const QString & filename, QObject * o = NULL )
  • -
-
    -
  • 4 static public members inherited from QObject
  • -
-

Additional Inherited Members

-
    -
  • 1 public type inherited from QObject
  • -
  • 7 protected functions inherited from QObject
  • -
  • 2 protected variables inherited from QObject
  • -
- -
-

Detailed Description

-

The QtScriptedStateMachine class provides a way to use scripting with the Qt State Machine Framework.

-

Though can be used alone, QtScriptedStateMachine is mainly a runtime helper to using the state-machine framework with SCXML files.

-

See also QtStateMachine.

-
-

Property Documentation

-

baseUrl : QUrl

-

The url used to resolve scripts and invoke urls.

-

Access functions:

-
    -
  • QUrl baseUrl () const
  • -
  • void setBaseUrl ( const QUrl & )
  • -
-
-

Member Function Documentation

-

QtScriptedStateMachine::QtScriptedStateMachine ( QObject * parent = NULL )

-

Creates a new QtScriptedStateMachine object, with parent parent.

-

void QtScriptedStateMachine::eventTriggered ( const QString & name )   [signal]

-

This signal is emitted when external event name is handled in the state machine.

-

void QtScriptedStateMachine::executeScript ( const QString & s )   [slot]

-

Executes script s in the attached script engine. If the script fails, a "error.illegalvalue" event is posted to the state machine.

-

QtScriptedStateMachine * QtScriptedStateMachine::load ( const QString & filename, QObject * o = NULL )   [static]

-

Loads a state machine from an scxml file located at filename, with parent object o.

-

void QtScriptedStateMachine::postNamedEvent ( const QString & event )   [slot]

-

Posts a QtScriptedEvent named event, with no payload.

-

See also QtScriptedEvent.

-

void QtScriptedStateMachine::registerInvokerFactory ( QtSsmInvokerFactory * f )

-

Enabled invoker factory f to be called from <invoke /> tags.

-

void QtScriptedStateMachine::registerObject ( QObject * o, const QString & name = QString(), bool recursive = false )

-

Registers object o to the script engine attached to the state machine. The object can be accessible from global variable name. If name is not provided, the object's name is used. If recursive is true, all the object's decendants are registered as global objects, with their respective object names as variable names.

-

QScriptEngine * QtScriptedStateMachine::scriptEngine () const

-

Returns the script engine attached to the state-machine.

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtscriptedtransition-members.html b/lib/qtstatemachine/doc/html/qtscriptedtransition-members.html deleted file mode 100644 index e4ba752..0000000 --- a/lib/qtstatemachine/doc/html/qtscriptedtransition-members.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - List of All Members for QtScriptedTransition - - - - - - - -
  Home

List of All Members for QtScriptedTransition

-

This is the complete list of members for QtScriptedTransition, including inherited members.

-

- -
-

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtscriptedtransition.html b/lib/qtstatemachine/doc/html/qtscriptedtransition.html deleted file mode 100644 index 296ad21..0000000 --- a/lib/qtstatemachine/doc/html/qtscriptedtransition.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - QtScriptedTransition Class Reference - - - - - - - -
  Home

QtScriptedTransition Class Reference

-

The QtScriptedTransition class stands for a transition that responds to QtScriptedEvent, and can be made conditional with a conditionExpression. Equivalent to the SCXML transition tag. More...

-
 #include <QtScriptedTransition>

Inherits QtTransition.

- - -

Properties

- - - -

Public Functions

- - -

Additional Inherited Members

-
    -
  • 1 public slot inherited from QObject
  • -
  • 1 signal inherited from QObject
  • -
  • 1 public type inherited from QObject
  • -
  • 4 static public members inherited from QObject
  • -
  • 2 protected functions inherited from QtAbstractTransition
  • -
  • 7 protected functions inherited from QObject
  • -
  • 2 protected variables inherited from QObject
  • -
- -
-

Detailed Description

-

The QtScriptedTransition class stands for a transition that responds to QtScriptedEvent, and can be made conditional with a conditionExpression. Equivalent to the SCXML transition tag.

-
-

Property Documentation

-

conditionExpression : QString

-

A QtScript expression that's evaluated to test whether the transition needs to be invoked.

-

Access functions:

-
    -
  • QString conditionExpression () const
  • -
  • void setConditionExpression ( const QString & c )
  • -
-

eventPrefix : QString

-

The event prefix to be used when testing if the transition needs to be invoked. Uses SCXML prefix matching. Use * to handle any event.

-

Access functions:

-
    -
  • QString eventPrefix () const
  • -
  • void setEventPrefix ( const QString & e )
  • -
-
-

Member Function Documentation

-

QtScriptedTransition::QtScriptedTransition ( QtState * state, QtScriptedStateMachine * machine )

-

Creates a new QtScriptedTransition from state, that uses machine to evaluate the conditions.

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtsignalevent-members.html b/lib/qtstatemachine/doc/html/qtsignalevent-members.html deleted file mode 100644 index dc9191b..0000000 --- a/lib/qtstatemachine/doc/html/qtsignalevent-members.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - List of All Members for QtSignalEvent - - - - - - - -
  Home

List of All Members for QtSignalEvent

-

This is the complete list of members for QtSignalEvent, including inherited members.

- -


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtsignalevent.html b/lib/qtstatemachine/doc/html/qtsignalevent.html deleted file mode 100644 index a19ef9b..0000000 --- a/lib/qtstatemachine/doc/html/qtsignalevent.html +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - QtSignalEvent Class Reference - - - - - - - -
  Home

QtSignalEvent Class Reference
[QtCore module] -

-

The QtSignalEvent class represents a Qt signal event. More...

-
 #include <QtSignalEvent>

Inherits QEvent.

-

This class was introduced in qtstatemachine 4.6.

- - -

Public Functions

- -
    -
  • 6 public functions inherited from QEvent
  • -
-

Additional Inherited Members

-
    -
  • 1 property inherited from QEvent
  • -
  • 1 static public member inherited from QEvent
  • -
  • 2 protected variables inherited from QEvent
  • -
- -
-

Detailed Description

-

The QtSignalEvent class represents a Qt signal event.

-

A signal event is generated by a QtStateMachine in response to a Qt signal. The QtSignalTransition class provides a transition associated with a signal event. QtSignalEvent is part of The State Machine Framework.

-

The sender() function returns the object that generated the signal. The signalIndex() function returns the index of the signal. The arguments() function returns the arguments of the signal.

-

See also QtSignalTransition.

-
-

Member Function Documentation

-

QtSignalEvent::~QtSignalEvent ()

-

Destroys this QtSignalEvent.

-

QList<QVariant> QtSignalEvent::arguments () const

-

Returns the arguments of the signal.

-

const QObject * QtSignalEvent::sender () const

-

Returns the object that emitted the signal.

-

See also QObject::sender().

-

int QtSignalEvent::signalIndex () const

-

Returns the index of the signal.

-

See also QMetaObject::indexOfSignal().

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtsignaltransition-members.html b/lib/qtstatemachine/doc/html/qtsignaltransition-members.html deleted file mode 100644 index b175b98..0000000 --- a/lib/qtstatemachine/doc/html/qtsignaltransition-members.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - List of All Members for QtSignalTransition - - - - - - - -
  Home

List of All Members for QtSignalTransition

-

This is the complete list of members for QtSignalTransition, including inherited members.

-

- -
-

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtsignaltransition.html b/lib/qtstatemachine/doc/html/qtsignaltransition.html deleted file mode 100644 index 137b1d3..0000000 --- a/lib/qtstatemachine/doc/html/qtsignaltransition.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - QtSignalTransition Class Reference - - - - - - - -
  Home

QtSignalTransition Class Reference
[QtCore module] -

-

The QtSignalTransition class provides a transition based on a Qt signal. More...

-
 #include <QtSignalTransition>

Inherits QtTransition.

-

This class was introduced in qtstatemachine 4.6.

- - -

Properties

- - - -

Public Functions

- - -

Additional Inherited Members

-
    -
  • 1 public slot inherited from QObject
  • -
  • 1 signal inherited from QObject
  • -
  • 1 public type inherited from QObject
  • -
  • 4 static public members inherited from QObject
  • -
  • 2 protected functions inherited from QtAbstractTransition
  • -
  • 7 protected functions inherited from QObject
  • -
  • 2 protected variables inherited from QObject
  • -
- -
-

Detailed Description

-

The QtSignalTransition class provides a transition based on a Qt signal.

-

Typically you would use the overload of QtState::addTransition() that takes a sender and signal as arguments, rather than creating QtSignalTransition objects directly. QtSignalTransition is part of The State Machine Framework.

-

You can subclass QtSignalTransition and reimplement eventTest() to make a signal transition conditional; the event object passed to eventTest() will be a QtSignalEvent object. Example:

-
 class CheckedTransition : public QtSignalTransition
- {
- public:
-     CheckedTransition(QCheckBox *check)
-         : QtSignalTransition(check, SIGNAL(stateChanged(int))) {}
- protected:
-     bool eventTest(QEvent *e) const {
-         if (!QtSignalTransition::eventTest(e))
-             return false;
-         QtSignalEvent *se = static_cast<QtSignalEvent*>(e);
-         return (se->arguments().at(0).toInt() == Qt::Checked);
-     }
- };
-
- ...
-
- QCheckBox *check = new QCheckBox();
- check->setTristate(true);
-
- QtState *s1 = new QtState();
- QtState *s2 = new QtState();
- CheckedTransition *t1 = new CheckedTransition(check);
- t1->setTargetState(s2);
- s1->addTransition(t1);
-
-

Property Documentation

-

object : QObject *

-

This property holds the sender object that this signal transition is associated with.

-

Access functions:

-
    -
  • QObject * senderObject () const
  • -
  • void setSenderObject ( QObject * sender )
  • -
-

signal : QByteArray

-

This property holds the signal that this signal transition is associated with.

-

Access functions:

-
    -
  • QByteArray signal () const
  • -
  • void setSignal ( const QByteArray & signal )
  • -
-
-

Member Function Documentation

-

QtSignalTransition::QtSignalTransition ( QtState * sourceState = 0 )

-

Constructs a new signal transition with the given sourceState.

-

QtSignalTransition::QtSignalTransition ( QObject * sender, const char * signal, QtState * sourceState = 0 )

-

Constructs a new signal transition associated with the given signal of the given sender, and with the given sourceState.

-

QtSignalTransition::QtSignalTransition ( QObject * sender, const char * signal, const QList<QtAbstractState *> & targets, QtState * sourceState = 0 )

-

Constructs a new signal transition associated with the given signal of the given sender. The transition has the given targets and sourceState.

-

QtSignalTransition::~QtSignalTransition ()

-

Destroys this signal transition.

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtssminvoker-members.html b/lib/qtstatemachine/doc/html/qtssminvoker-members.html deleted file mode 100644 index 7020b63..0000000 --- a/lib/qtstatemachine/doc/html/qtssminvoker-members.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - List of All Members for QtSsmInvoker - - - - - - - -
  Home

List of All Members for QtSsmInvoker

-

This is the complete list of members for QtSsmInvoker, including inherited members.

-

- -
-

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtssminvoker.html b/lib/qtstatemachine/doc/html/qtssminvoker.html deleted file mode 100644 index 9b142f8..0000000 --- a/lib/qtstatemachine/doc/html/qtssminvoker.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - QtSsmInvoker Class Reference - - - - - - - -
  Home

QtSsmInvoker Class Reference

-

The QtSsmInvoker class an invoker, which the state-machine context can activate or cancel with an <invoke> tag. More...

-
 #include <QtSsmInvoker>

Inherits QObject.

- - -

Public Functions

- -
    -
  • 29 public functions inherited from QObject
  • -
- -

Public Slots

- -
    -
  • 1 public slot inherited from QObject
  • -
- -

Protected Functions

- -
    -
  • 7 protected functions inherited from QObject
  • -
- -

Protected Slots

- -

Additional Inherited Members

-
    -
  • 1 property inherited from QObject
  • -
  • 1 signal inherited from QObject
  • -
  • 1 public type inherited from QObject
  • -
  • 4 static public members inherited from QObject
  • -
  • 2 protected variables inherited from QObject
  • -
- -
-

Detailed Description

-

The QtSsmInvoker class an invoker, which the state-machine context can activate or cancel with an <invoke> tag.

-

An invoker is a object that represents an external component that the state machine can activate when the encompassing state is entered, or cancel when the encompassing state is exited from.

-
-

Member Function Documentation

-

QtSsmInvoker::QtSsmInvoker ( QtScriptedEvent * ievent, QtStateMachine * parent )   [protected]

-

When reimplementing the constructor, always use the two parameters (ievent and parent), as they're called from QtSsmInvokerFactory.

-

QtSsmInvoker::~QtSsmInvoker ()   [virtual]

-

void QtSsmInvoker::activate ()   [pure virtual slot]

-

This function is called when the encompassing state is entered. The call to this function from the state-machine context is asynchronous, to make sure that the state is not exited during the same step in which it's entered.

-

void QtSsmInvoker::cancel ()   [virtual slot]

-

Reimplement this function to allow for asynchronous cancellation of the invoker. It's the invoker's responsibility to delete itself after this function has been called. The default implementation deletes the invoker.

-

QtScriptedStateMachine * QtSsmInvoker::parentStateMachine ()   [protected]

-

Returns the state machine encompassing the invoker.

-

void QtSsmInvoker::postParentEvent ( QtScriptedEvent * e )   [protected]

-

Posts an event e to the state machine encompassing the invoker.

-

void QtSsmInvoker::postParentEvent ( const QString & e )   [protected slot]

-

This is an overloaded member function, provided for convenience.

-

Posts a QtScriptedEvent named e to the encompassing state machine.

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtstate-members.html b/lib/qtstatemachine/doc/html/qtstate-members.html deleted file mode 100644 index e531347..0000000 --- a/lib/qtstatemachine/doc/html/qtstate-members.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - List of All Members for QtState - - - - - - - -
  Home

List of All Members for QtState

-

This is the complete list of members for QtState, including inherited members.

-

- -
-

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtstate.html b/lib/qtstatemachine/doc/html/qtstate.html deleted file mode 100644 index b205adc..0000000 --- a/lib/qtstatemachine/doc/html/qtstate.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - QtState Class Reference - - - - - - - -
  Home

QtState Class Reference
[QtCore module] -

-

The QtState class provides a general-purpose state for QtStateMachine. More...

-
 #include <QtState>

Inherits QtActionState.

-

This class was introduced in qtstatemachine 4.6.

- - -

Public Types

-
    -
  • enum HistoryType { ShallowHistory, DeepHistory }
  • -
  • enum Type { Normal, ParallelGroup }
  • -
- -

Public Functions

- - -

Additional Inherited Members

- - -
-

Detailed Description

-

The QtState class provides a general-purpose state for QtStateMachine.

-

QtState objects can have child states, and can have transitions to other states. QtState is part of The State Machine Framework.

-

The addTransition() function adds a transition. The removeTransition() function removes a transition.

- -

States with Child States

-

For non-parallel state groups, the setInitialState() function must be called to set the initial state. The child states are mutually exclusive states, and the state machine needs to know which child state to enter when the parent state is the target of a transition.

-

The addHistoryState() function adds a history state.

-

The addFinishedTransition() function creates and adds a transition that's triggered when a final child state is entered.

-

The setErrorState() sets the state's error state. The error state is the state that the state machine will transition to if an error is detected when attempting to enter the state (e.g. because no initial state has been set).

-
-

Member Type Documentation

-

enum QtState::HistoryType

-

This enum specifies the type of history that a QtHistoryState records.

-

- - - -
ConstantValueDescription
QtState::ShallowHistory0Only the immediate child states of the parent state are recorded. In this case a transition with the history state as its target will end up in the immediate child state that the parent was in the last time it was exited. This is the default.
QtState::DeepHistory1Nested states are recorded. In this case a transition with the history state as its target will end up in the most deeply nested descendant state the parent was in the last time it was exited.

-

enum QtState::Type

-

This enum specifies the type of a state.

-

- - - -
ConstantValueDescription
QtState::Normal0A normal state. If the state has no child states, it is an atomic state; otherwise, the child states are mutually exclusive and an initial state must be set by calling QtState::setInitialState().
QtState::ParallelGroup1The state is a parallel group state. When a parallel group state is entered, all its child states are entered in parallel.

-
-

Member Function Documentation

-

QtState::QtState ( QtState * parent = 0 )

-

Constructs a new state with the given parent state.

-

QtState::QtState ( Type type, QtState * parent = 0 )

-

Constructs a new state of the given type with the given parent state.

-

QtState::~QtState ()

-

Destroys this state.

-

QtStateFinishedTransition * QtState::addFinishedTransition ( QtAbstractState * target )

-

Adds a transition that's triggered by the finished event of this state, and returns the new QtStateFinishedTransition object. The transition has the given target state.

-

See also QtStateFinishedEvent.

-

QtHistoryState * QtState::addHistoryState ( HistoryType type = ShallowHistory )

-

Creates a history state of the given type for this state and returns the new state. The history state becomes a child of this state.

-

void QtState::addTransition ( QtAbstractTransition * transition )

-

Adds the given transition. The transition has this state as the source. This state takes ownership of the transition.

-

QtSignalTransition * QtState::addTransition ( QObject * sender, const char * signal, QtAbstractState * target )

-

This is an overloaded member function, provided for convenience.

-

Adds a transition associated with the given signal of the given sender object, and returns the new QtSignalTransition object. The transition has this state as the source, and the given target as the target state.

-

QtAbstractTransition * QtState::addTransition ( QtAbstractState * target )

-

This is an overloaded member function, provided for convenience.

-

Adds an unconditional transition from this state to the given target state, and returns then new transition object.

-

QtAbstractState * QtState::errorState () const

-

Returns this state group's error state.

-

See also QtStateMachine::errorState() and QtStateMachine::setErrorState().

-

QtAbstractState * QtState::initialState () const

-

Returns this state's initial state, or 0 if the state has no initial state.

-

See also setInitialState().

-

void QtState::removeTransition ( QtAbstractTransition * transition )

-

Removes the given transition from this state. The state releases ownership of the transition.

-

See also addTransition().

-

void QtState::setErrorState ( QtAbstractState * state )

-

Sets this state's error state to be the given state. If the error state is not set, or if it is set to 0, the state will inherit its parent's error state recursively.

-

See also QtStateMachine::setErrorState() and QtStateMachine::errorState().

-

void QtState::setInitialState ( QtAbstractState * state )

-

Sets this state's initial state to be the given state. state has to be a child of this state.

-

See also initialState().

-

QList<QtAbstractTransition *> QtState::transitions () const

-

Returns the list of transitions from this state, or an empty list if there are no transitions from this state.

-

See also addTransition() and removeTransition().

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtstateaction-members.html b/lib/qtstatemachine/doc/html/qtstateaction-members.html deleted file mode 100644 index 07bec8e..0000000 --- a/lib/qtstatemachine/doc/html/qtstateaction-members.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - List of All Members for QtStateAction - - - - - - - -
  Home

List of All Members for QtStateAction

-

This is the complete list of members for QtStateAction, including inherited members.

-

- -
-

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtstateaction.html b/lib/qtstatemachine/doc/html/qtstateaction.html deleted file mode 100644 index b41ec17..0000000 --- a/lib/qtstatemachine/doc/html/qtstateaction.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - QtStateAction Class Reference - - - - - - - -
  Home

QtStateAction Class Reference
[QtCore module] -

-

The QtStateAction class is the base class of QtState actions. More...

-
 #include <QtStateAction>

Inherits QObject.

-

Inherited by QtStateInvokeMethodAction.

-

This class was introduced in qtstatemachine 4.6.

- - -

Public Functions

- -
    -
  • 29 public functions inherited from QObject
  • -
- -

Protected Functions

- -
    -
  • 7 protected functions inherited from QObject
  • -
-

Additional Inherited Members

-
    -
  • 1 property inherited from QObject
  • -
  • 1 public slot inherited from QObject
  • -
  • 1 signal inherited from QObject
  • -
  • 1 public type inherited from QObject
  • -
  • 4 static public members inherited from QObject
  • -
  • 2 protected variables inherited from QObject
  • -
- -
-

Detailed Description

-

The QtStateAction class is the base class of QtState actions.

-

A state action is added to a state by calling QtActionState::addEntryAction() or QtActionState::addExitAction(). QtStateAction is part of The State Machine Framework.

- -

Subclassing

-

Subclasses must implement the execute() function.

-
-

Member Function Documentation

-

QtStateAction::QtStateAction ( QObject * parent = 0 )   [protected]

-

Constructs a new QtStateAction object with the given parent.

-

QtStateAction::~QtStateAction ()

-

Destroys this QtStateAction object.

-

void QtStateAction::execute ()   [pure virtual protected]

-

Executes this action.

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtstatefinishedevent-members.html b/lib/qtstatemachine/doc/html/qtstatefinishedevent-members.html deleted file mode 100644 index 6c056d3..0000000 --- a/lib/qtstatemachine/doc/html/qtstatefinishedevent-members.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - List of All Members for QtStateFinishedEvent - - - - - - - -
  Home

List of All Members for QtStateFinishedEvent

-

This is the complete list of members for QtStateFinishedEvent, including inherited members.

- -


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtstatefinishedevent.html b/lib/qtstatemachine/doc/html/qtstatefinishedevent.html deleted file mode 100644 index 503f5d4..0000000 --- a/lib/qtstatemachine/doc/html/qtstatefinishedevent.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - QtStateFinishedEvent Class Reference - - - - - - - -
  Home

QtStateFinishedEvent Class Reference
[QtCore module] -

-

The QtStateFinishedEvent class contains parameters that describe a state that has finished. More...

-
 #include <QtStateFinishedEvent>

Inherits QEvent.

-

This class was introduced in qtstatemachine 4.6.

- - -

Public Functions

- -
    -
  • 6 public functions inherited from QEvent
  • -
-

Additional Inherited Members

-
    -
  • 1 property inherited from QEvent
  • -
  • 1 static public member inherited from QEvent
  • -
  • 2 protected variables inherited from QEvent
  • -
- -
-

Detailed Description

-

The QtStateFinishedEvent class contains parameters that describe a state that has finished.

-

A state is finished when one of its final child states (a QtFinalState) is entered; this will cause a QtStateFinishedEvent to be generated by the state machine. QtStateFinishedEvent is part of The State Machine Framework.

-

Typically you do not create QtStateFinishedEvent objects yourself, but rather use QtStateFinishedTransition to create a transition that's triggered by a state's finished event.

-

See also QtStateFinishedTransition.

-
-

Member Function Documentation

-

QtStateFinishedEvent::~QtStateFinishedEvent ()

-

Destroys this QtStateFinishedEvent.

-

QtState * QtStateFinishedEvent::state () const

-

Returns the state associated with this QtStateFinishedEvent.

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtstatefinishedtransition-members.html b/lib/qtstatemachine/doc/html/qtstatefinishedtransition-members.html deleted file mode 100644 index d9da830..0000000 --- a/lib/qtstatemachine/doc/html/qtstatefinishedtransition-members.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - List of All Members for QtStateFinishedTransition - - - - - - - -
  Home

List of All Members for QtStateFinishedTransition

-

This is the complete list of members for QtStateFinishedTransition, including inherited members.

-

- -
-

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtstatefinishedtransition.html b/lib/qtstatemachine/doc/html/qtstatefinishedtransition.html deleted file mode 100644 index 570cdf8..0000000 --- a/lib/qtstatemachine/doc/html/qtstatefinishedtransition.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - QtStateFinishedTransition Class Reference - - - - - - - -
  Home

QtStateFinishedTransition Class Reference
[QtCore module] -

-

The QtStateFinishedTransition class provides a transition that triggers when a state is finished. More...

-
 #include <QtStateFinishedTransition>

Inherits QtTransition.

- - -

Properties

- - - -

Public Functions

- - -

Additional Inherited Members

-
    -
  • 1 public slot inherited from QObject
  • -
  • 1 signal inherited from QObject
  • -
  • 1 public type inherited from QObject
  • -
  • 4 static public members inherited from QObject
  • -
  • 2 protected functions inherited from QtAbstractTransition
  • -
  • 7 protected functions inherited from QObject
  • -
  • 2 protected variables inherited from QObject
  • -
- -
-

Detailed Description

-

The QtStateFinishedTransition class provides a transition that triggers when a state is finished.

-

A state is finished when one of its final child states (a QtFinalState) is entered; this will cause a QtStateFinishedEvent to be generated. The QtStateFinishedTransition class provides a way of associating a transition with such an event. QtStateFinishedTransition is part of The State Machine Framework.

-
 QtStateMachine machine;
- QtState *s1 = new QtState(machine.rootState());
- QtState *s11 = new QtState(s1);
- QtFinalState *s12 = new QtFinalState(s1);
- s11->addTransition(s12);
-
- QtState *s2 = new QtState(machine.rootState());
- QtStateFinishedTransition *finishedTransition = new QtStateFinishedTransition(s1);
- finishedTransition->setTargetState(s2);
- s1->addTransition(finishedTransition);
-

See also QtState::addFinishedTransition() and QtStateFinishedEvent.

-
-

Property Documentation

-

state : QtState *

-

This property holds the state whose QtStateFinishedEvent this transition is associated with.

-

Access functions:

-
    -
  • QtState * state () const
  • -
  • void setState ( QtState * state )
  • -
-
-

Member Function Documentation

-

QtStateFinishedTransition::QtStateFinishedTransition ( QtState * sourceState = 0 )

-

Constructs a new QtStateFinishedTransition object that has the given sourceState.

-

QtStateFinishedTransition::QtStateFinishedTransition ( QtState * state, const QList<QtAbstractState *> & targets, QtState * sourceState = 0 )

-

Constructs a new QtStateFinishedTransition object associated with the given state, and that has the given targets and sourceState.

-

QtStateFinishedTransition::~QtStateFinishedTransition ()

-

Destroys this QtStateFinishedTransition.

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtstateinvokemethodaction-members.html b/lib/qtstatemachine/doc/html/qtstateinvokemethodaction-members.html deleted file mode 100644 index e441697..0000000 --- a/lib/qtstatemachine/doc/html/qtstateinvokemethodaction-members.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - List of All Members for QtStateInvokeMethodAction - - - - - - - -
  Home

List of All Members for QtStateInvokeMethodAction

-

This is the complete list of members for QtStateInvokeMethodAction, including inherited members.

-

- -
-

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtstateinvokemethodaction.html b/lib/qtstatemachine/doc/html/qtstateinvokemethodaction.html deleted file mode 100644 index 033eee1..0000000 --- a/lib/qtstatemachine/doc/html/qtstateinvokemethodaction.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - QtStateInvokeMethodAction Class Reference - - - - - - - -
  Home

QtStateInvokeMethodAction Class Reference
[QtCore module] -

-

The QtStateInvokeMethodAction class provides an invoke method action for QObjects. More...

-
 #include <QtStateInvokeMethodAction>

Inherits QtStateAction.

-

This class was introduced in qtstatemachine 4.6.

- - -

Properties

- -
    -
  • 1 property inherited from QObject
  • -
- -

Public Functions

- -
    -
  • 29 public functions inherited from QObject
  • -
-

Additional Inherited Members

-
    -
  • 1 public slot inherited from QObject
  • -
  • 1 signal inherited from QObject
  • -
  • 1 public type inherited from QObject
  • -
  • 4 static public members inherited from QObject
  • -
  • 1 protected function inherited from QtStateAction
  • -
  • 7 protected functions inherited from QObject
  • -
  • 2 protected variables inherited from QObject
  • -
- -
-

Detailed Description

-

The QtStateInvokeMethodAction class provides an invoke method action for QObjects.

-

The QtStateInvokeMethodAction class provides an action that calls a method of a QObject when a QtState is entered or exited. QtStateInvokeMethodAction is part of The State Machine Framework.

-

Typically you don't construct QtStateInvokeMethodAction objects directly, but rather call the QtState::invokeMethodOnEntry() function or the QtState::invokeMethodOnExit() function.

-
-

Property Documentation

-

arguments : QVariantList

-

This property holds the arguments to the method this action invokes.

-

Access functions:

-
    -
  • QVariantList arguments () const
  • -
  • void setArguments ( const QVariantList & arguments )
  • -
-

methodName : QByteArray

-

This property holds the name of the method this action invokes.

-

Access functions:

-
    -
  • QByteArray methodName () const
  • -
  • void setMethodName ( const QByteArray & methodName )
  • -
-

target : QObject *

-

This property holds the object on which this action invokes a method.

-

Access functions:

-
    -
  • QObject * targetObject () const
  • -
  • void setTargetObject ( QObject * target )
  • -
-
-

Member Function Documentation

-

QtStateInvokeMethodAction::QtStateInvokeMethodAction ( QObject * target, const QByteArray & methodName, QObject * parent = 0 )

-

Constructs a new QtStateInvokeMethodAction object for the method named methodName of the given target object, with the given parent.

-

QtStateInvokeMethodAction::QtStateInvokeMethodAction ( QObject * target, const QByteArray & methodName, const QList<QVariant> & args, QObject * parent = 0 )

-

Constructs a new QtStateInvokeMethodAction object for the method named methodName of the given target object, with the given arguments, args, and with the given parent.

-

QtStateInvokeMethodAction::QtStateInvokeMethodAction ( QObject * parent = 0 )

-

Constructs a new QtStateInvokeMethodAction object with the given parent.

-

QtStateInvokeMethodAction::~QtStateInvokeMethodAction ()

-

Destroys this QtStateInvokeMethodAction object.

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtstatemachine-members.html b/lib/qtstatemachine/doc/html/qtstatemachine-members.html deleted file mode 100644 index 1e7099e..0000000 --- a/lib/qtstatemachine/doc/html/qtstatemachine-members.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - List of All Members for QtStateMachine - - - - - - - -
  Home

List of All Members for QtStateMachine

-

This is the complete list of members for QtStateMachine, including inherited members.

-

- -
-

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtstatemachine.dcf b/lib/qtstatemachine/doc/html/qtstatemachine.dcf deleted file mode 100644 index b1bb569..0000000 --- a/lib/qtstatemachine/doc/html/qtstatemachine.dcf +++ /dev/null @@ -1,231 +0,0 @@ - - -
-
- MetaData - Kind - QtScriptedEvent::MetaData::Internal - QtScriptedEvent::MetaData::External - QtScriptedEvent::MetaData::Platform -
-
-
- QtAbstractState - RestorePolicy - QtAbstractState::GlobalRestorePolicy - QtAbstractState::RestoreProperties - QtAbstractState::DoNotRestoreProperties - restorePolicy - setRestorePolicy - assignProperty - onEntry - onExit - parentState -
-
-
- QtAbstractTransition - source - sourceState - target - targetState - setTargetState - targets - targetStates - setTargetStates - addAnimation - animations - eventTest - onTransition - removeAnimation -
-
-
- QtActionState - addEntryAction - addExitAction - entryActions - exitActions - invokeMethodOnEntry - invokeMethodOnExit - removeEntryAction - removeExitAction -
-
-
- QtEventTransition - eventType - setEventType - object - eventSource - setEventSource - testEventCondition -
-
-
- QtFinalState -
-
-
- QtHistoryState - defaultState - setDefaultState -
-
-
- QtScriptedEvent - content - eventName - eventType - param - paramNames - paramValues -
-
-
- QtScriptedStateMachine - baseUrl - setBaseUrl - eventTriggered - executeScript - load - postNamedEvent - registerInvokerFactory - registerObject - scriptEngine -
-
-
- QtScriptedTransition - conditionExpression - setConditionExpression - eventPrefix - setEventPrefix -
-
-
- QtSignalEvent - arguments - sender - signalIndex -
-
-
- QtSignalTransition - object - senderObject - setSenderObject - signal - setSignal -
-
-
- QtSsmInvoker - activate - cancel - parentStateMachine - postParentEvent -
-
-
- QtState - HistoryType - QtState::DeepHistory - QtState::ShallowHistory - Type - QtState::ParallelGroup - QtState::Normal - addFinishedTransition - addHistoryState - addTransition - errorState - initialState - removeTransition - setErrorState - setInitialState - transitions -
-
-
- QtStateAction - execute -
-
-
- QtStateFinishedEvent - state -
-
-
- QtStateFinishedTransition - state - setState -
-
-
- QtStateInvokeMethodAction - arguments - setArguments - methodName - setMethodName - target - targetObject - setTargetObject -
-
-
- QtStateMachine - Error - QtStateMachine::NoError - QtStateMachine::NoInitialStateError - QtStateMachine::NoDefaultStateInHistoryState - errorState - setErrorState - errorString - initialState - setInitialState - rootState - addState - animationsFinished - clearError - error - finished - globalRestorePolicy - postEvent - removeState - setGlobalRestorePolicy - start - started - states - stop - stopped -
-
-
- QtTransition - actions - addAction - invokeMethodOnTransition - removeAction -
-
-
-
-
- Qt State Machine Framework -
-
- State Machine Classes -
-
- Statechart Tools (SCXML) Classes -
-
- The State Machine Framework -
-
- Using SCXML files in Qt -
-
-
- diff --git a/lib/qtstatemachine/doc/html/qtstatemachine.html b/lib/qtstatemachine/doc/html/qtstatemachine.html deleted file mode 100644 index 08570a1..0000000 --- a/lib/qtstatemachine/doc/html/qtstatemachine.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - - - QtStateMachine Class Reference - - - - - - - -
  Home

QtStateMachine Class Reference
[QtCore module] -

-

The QtStateMachine class provides a hierarchical finite state machine. More...

-
 #include <QtStateMachine>

Inherits QObject.

-

Inherited by QtScriptedStateMachine.

-

Note: All the functions in this class are reentrant.

-

This class was introduced in qtstatemachine 4.6.

- - -

Public Types

-
    -
  • enum Error { NoError, NoInitialStateError, NoDefaultStateInHistoryState }
  • -
- -

Properties

- -
    -
  • 1 property inherited from QObject
  • -
- -

Public Functions

- -
    -
  • 29 public functions inherited from QObject
  • -
- -

Public Slots

- -
    -
  • 1 public slot inherited from QObject
  • -
- -

Signals

- -
    -
  • 1 signal inherited from QObject
  • -
-

Additional Inherited Members

-
    -
  • 1 public type inherited from QObject
  • -
  • 4 static public members inherited from QObject
  • -
  • 7 protected functions inherited from QObject
  • -
  • 2 protected variables inherited from QObject
  • -
- -
-

Detailed Description

-

The QtStateMachine class provides a hierarchical finite state machine.

-

The QtStateMachine class provides a hierarchical finite state machine based on Statecharts concepts and notation. QtStateMachine is part of The State Machine Framework.

-

A state machine manages a set of states (QtAbstractState objects) and transitions (QtAbstractTransition objects) between those states; the states and the transitions collectively define a state graph. Once a state graph has been defined, the state machine can execute it. QtStateMachine's execution algorithm is based on the State Chart XML (SCXML) algorithm.

-

The QtState class provides a state that you can use to set properties and invoke methods on QObjects when the state is entered or exited. This is typically used in conjunction with signals; the signals determine the flow of the state graph, whereas the states' property assignments and method invocations are the actions.

-

Use the addState() function to add a state to the state machine; alternatively, pass the machine's rootState() to the state constructor. Use the removeState() function to remove a state from the state machine.

-

The following snippet shows a state machine that will finish when a button is clicked:

-
 QPushButton button;
-
- QtStateMachine machine;
- QtState *s1 = new QtState();
- s1->assignProperty(&button, "text", "Click me");
-
- QtFinalState *s2 = new QtFinalState();
- s1->addTransition(&button, SIGNAL(clicked()), s2);
-
- machine.addState(s1);
- machine.addState(s2);
- machine.setInitialState(s1);
- machine.start();
-

The setInitialState() function sets the state machine's initial state; this state is entered when the state machine is started.

-

The start() function starts the state machine. The state machine executes asynchronously, i.e. you need to run an event loop in order for it to make progress. The started() signal is emitted when the state machine has entered the initial state.

-

The state machine processes events and takes transitions until a top-level final state is entered; the state machine then emits the finished() signal.

-

The stop() function stops the state machine. The stopped() signal is emitted when the state machine has stopped.

-

The postEvent() function posts an event to the state machine. This is useful when you are using custom events to trigger transitions.

-

The rootState() function returns the state machine's root state. All top-level states have the root state as their parent.

-

See also QtAbstractState and QtAbstractTransition.

-
-

Member Type Documentation

-

enum QtStateMachine::Error

-

This enum type defines errors that can occur in the state machine at run time. When the state machine encounters an unrecoverable error at run time, it will set the error code returned by error(), the error message returned by errorString(), and enter an error state based on the context of the error.

-

- - - - -
ConstantValueDescription
QtStateMachine::NoError0No error has occurred.
QtStateMachine::NoInitialStateError1The machine has entered a QtState with children which does not have an initial state set. The context of this error is the state which is missing an initial state.
QtStateMachine::NoDefaultStateInHistoryState2The machine has entered a QtHistoryState which does not have a default state set. The context of this error is the QtHistoryState which is missing a default state.

-

See also setErrorState().

-
-

Property Documentation

-

errorState : QtAbstractState *

-

This property holds the error state of this state machine.

-

Access functions:

-
    -
  • QtAbstractState * errorState () const
  • -
  • void setErrorState ( QtAbstractState * state )
  • -
-

errorString : const QString

-

This property holds the error string of this state machine.

-

Access functions:

-
    -
  • QString errorString () const
  • -
-

initialState : QtAbstractState *

-

This property holds the initial state of this state machine.

-

Access functions:

-
    -
  • QtAbstractState * initialState () const
  • -
  • void setInitialState ( QtAbstractState * state )
  • -
-

rootState : QtState * const

-

This property holds the root state of this state machine.

-

Access functions:

-
    -
  • QtState * rootState () const
  • -
-
-

Member Function Documentation

-

QtStateMachine::QtStateMachine ( QObject * parent = 0 )

-

Constructs a new state machine with the given parent.

-

QtStateMachine::~QtStateMachine ()

-

Destroys this state machine.

-

void QtStateMachine::addState ( QtAbstractState * state )

-

Adds the given state to this state machine. The state becomes a top-level state (i.e. a child of the rootState()).

-

If the state is already in a different machine, it will first be removed from its old machine, and then added to this machine.

-

See also removeState() and rootState().

-

void QtStateMachine::animationsFinished ()   [signal]

-

This signal is emitted when the state machine has finished playing all animations associated with the latest transition (i.e., all properties have reached their target values).

-

void QtStateMachine::clearError ()

-

Clears the error string and error code of the state machine.

-

Error QtStateMachine::error () const

-

Returns the error code of the last error that occurred in the state machine.

-

void QtStateMachine::finished ()   [signal]

-

This signal is emitted when the state machine has reached a top-level final state.

-

See also QtStateMachine::started().

-

QtAbstractState::RestorePolicy QtStateMachine::globalRestorePolicy () const

-

Returns the global restore policy of the state machine.

-

See also setGlobalRestorePolicy() and QtActionState::restorePolicy().

-

void QtStateMachine::postEvent ( QEvent * event, int delay = 0 )

-

Posts the given event for processing by this state machine, with a delay of delay milliseconds.

-

This function returns immediately. The event is added to the state machine's event queue. Events are processed in the order posted. The state machine takes ownership of the event and deletes it once it has been processed.

-

You can only post events when the state machine is running.

-

void QtStateMachine::removeState ( QtAbstractState * state )

-

Removes the given state from this state machine. The state machine releases ownership of the state.

-

See also addState().

-

void QtStateMachine::setGlobalRestorePolicy ( QtAbstractState::RestorePolicy restorePolicy )

-

Sets the global restore policy of the state machine to restorePolicy. The default global restore policy is QtAbstractState::DoNotRestoreProperties.

-

The global restore policy cannot be set to QtAbstractState::GlobalRestorePolicy.

-

See also globalRestorePolicy() and QtAbstractState::setRestorePolicy().

-

void QtStateMachine::start ()   [slot]

-

Starts this state machine. The machine will reset its configuration and transition to the initial state. When a final top-level state is entered, the machine will emit the finished() signal.

-

See also started(), finished(), stop(), and initialState().

-

void QtStateMachine::started ()   [signal]

-

This signal is emitted when the state machine has entered its initial state.

-

See also QtStateMachine::finished() and QtStateMachine::start().

-

QList<QtAbstractState *> QtStateMachine::states () const

-

Returns the list of this state machine's states, or an empty list if the state machine has no states.

-

void QtStateMachine::stop ()   [slot]

-

Stops this state machine.

-

See also stopped().

-

void QtStateMachine::stopped ()   [signal]

-

This signal is emitted when the state machine has stopped.

-

See also QtStateMachine::stop().

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qtstatemachine.index b/lib/qtstatemachine/doc/html/qtstatemachine.index deleted file mode 100644 index d15a466..0000000 --- a/lib/qtstatemachine/doc/html/qtstatemachine.index +++ /dev/null @@ -1,529 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/qtstatemachine/doc/html/qtstatemachine.qch b/lib/qtstatemachine/doc/html/qtstatemachine.qch deleted file mode 100644 index 4cfcea4..0000000 Binary files a/lib/qtstatemachine/doc/html/qtstatemachine.qch and /dev/null differ diff --git a/lib/qtstatemachine/doc/html/qtstatemachine.qhp b/lib/qtstatemachine/doc/html/qtstatemachine.qhp deleted file mode 100644 index 696a433..0000000 --- a/lib/qtstatemachine/doc/html/qtstatemachine.qhp +++ /dev/null @@ -1,234 +0,0 @@ - - - com.trolltech.qtsolutions.qtstatemachine_1.1 - qdoc - - qt - solutions - qtstatemachine - - - qt - solutions - qtstatemachine - -
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - qthistorystate.html - qtsignaltransition.html - qtstatefinishedevent.html - qtscriptedstatemachine.html - sctools.html - qtscriptedtransition.html - qteventtransition.html - scxml.html - qtsignalevent.html - qtabstracttransition.html - qtscriptedevent.html - qttransition.html - statemachine.html - images/statemachine-nonparallel.png - images/statemachine-button-nested.png - images/statemachine-finished.png - qtactionstate.html - index.html - qtstatefinishedtransition.html - qtstateinvokemethodaction.html - qtabstractstate.html - qtfinalstate.html - images/statemachine-button-history.png - qtssminvoker.html - qtscriptedevent-metadata.html - qtstateaction.html - qtstate.html - statemachine-api.html - images/statemachine-parallel.png - qtstatemachine.html - images/statemachine-button.png - images/statemachine-button-history.png - images/statemachine-nonparallel.png - images/statemachine-parallel.png - classic.css - images/qt-logo.png - images/statemachine-finished.png - images/statemachine-button.png - images/statemachine-button-nested.png - -
-
diff --git a/lib/qtstatemachine/doc/html/qttransition-members.html b/lib/qtstatemachine/doc/html/qttransition-members.html deleted file mode 100644 index 4e103b7..0000000 --- a/lib/qtstatemachine/doc/html/qttransition-members.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - List of All Members for QtTransition - - - - - - - -
  Home

List of All Members for QtTransition

-

This is the complete list of members for QtTransition, including inherited members.

-

- -
-

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/qttransition.html b/lib/qtstatemachine/doc/html/qttransition.html deleted file mode 100644 index 9656517..0000000 --- a/lib/qtstatemachine/doc/html/qttransition.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - QtTransition Class Reference - - - - - - - -
  Home

QtTransition Class Reference
[QtCore module] -

-

The QtTransition class provides an action-based transition. More...

-
 #include <QtTransition>

Inherits QtAbstractTransition.

-

Inherited by QtEventTransition, QtScriptedTransition, QtSignalTransition, and QtStateFinishedTransition.

-

This class was introduced in qtstatemachine 4.6.

- - -

Public Functions

- - -

Additional Inherited Members

- - -
-

Detailed Description

-

The QtTransition class provides an action-based transition.

-

QtTransition provides an action-based transition; you add actions with the addAction() function. The transition executes the actions when the transition is triggered. QtTransition is part of The State Machine Framework.

-

The invokeMethodOnTransition() function is used for defining method invocations that should be performed when a transition is taken.

-
 QtStateMachine machine;
- QtState *s1 = new QtState();
- machine.addState(s1);
- QtTransition *t1 = new QtTransition();
- QLabel label;
- t1->invokeMethodOnTransition(&label, "clear");
- QtState *s2 = new QtState();
- machine.addState(s2);
- t1->setTargetState(s2);
- s1->addTransition(t1);
-

Actions are executed in the order in which they were added.

-

See also QtState::addTransition() and QtStateAction.

-
-

Member Function Documentation

-

QtTransition::QtTransition ( QtState * sourceState = 0 )

-

Constructs a new QtTransition object with the given sourceState.

-

QtTransition::QtTransition ( const QList<QtAbstractState *> & targets, QtState * sourceState = 0 )

-

Constructs a new QtTransition object with the given targets and sourceState.

-

QtTransition::~QtTransition ()

-

Destroys this transition.

-

QList<QtStateAction *> QtTransition::actions () const

-

Returns this transitions's actions, or an empty list if the transition has no actions.

-

See also addAction().

-

void QtTransition::addAction ( QtStateAction * action )

-

Adds the given action to this transition. The action will be executed when the transition is triggered. The transition takes ownership of the action.

-

See also removeAction().

-

void QtTransition::invokeMethodOnTransition ( QObject * object, const char * method, const QList<QVariant> & arguments = QList<QVariant> () )

-

Instructs this QtTransition to invoke the given method of the given object with the given arguments when the transition is taken. This function will create a QtStateInvokeMethodAction object and add it to the actions of the transition.

-

void QtTransition::removeAction ( QtStateAction * action )

-

Removes the given action from this transition. The transition releases ownership of the action.

-

See also addAction().

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/sctools.html b/lib/qtstatemachine/doc/html/sctools.html deleted file mode 100644 index 9f6e996..0000000 --- a/lib/qtstatemachine/doc/html/sctools.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - Statechart Tools (SCXML) Classes - - - - - - - -
  Home

Statechart Tools (SCXML) Classes
-

-

These classes allow loading of state-machines in runtime or compile time from SCXML, and provides a scripting environment for the loaded state machine.

-

See Using SCXML files with the Qt State Machine for more info.

-

- - - - -
QtScriptedEventStands for a general named event with a list of parameter names and parameter values
QtScriptedStateMachineWay to use scripting with the Qt State Machine Framework
QtScriptedTransitionStands for a transition that responds to QtScriptedEvent, and can be made conditional with a
QtSsmInvokerInvoker, which the state-machine context can activate or cancel with an <invoke> tag

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/scxml.html b/lib/qtstatemachine/doc/html/scxml.html deleted file mode 100644 index 9a210ba..0000000 --- a/lib/qtstatemachine/doc/html/scxml.html +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - Using SCXML files in Qt - - - - - - - -
  Home

Using SCXML files in Qt
-

- -

The sctools module allows loading SCXML files into a QtScriptedStateMachine object.

-

The files that the tool can load conform to the State Chart XML (SCXML) standard.

- -

Getting Started with Qt & SCXML

-
    -
  • First of all, make yourself familiar with the SCXML specification.
  • -
  • Read this document to understand how to enable SCXML files in your project, and how to load SCXML files in runtime/build-time.
  • -
  • Go over the blackjack, calc and mediaplayer examples for usage demonstration.
  • -
- -

Enabling the QtScriptedStateMachine class

-

The QtScriptedStateMachine class is enabled automatically when the script module is enabled.

- -

Using the QtScriptedStateMachine class

-

QtScriptedStateMachine is a subclass of QtStateMachine. QtStateMachine actually includes most of the "interesting" API, while QtScriptedStateMachine adds the missing parts to support SCXML.

-

Most of the interaction with QtScriptedStateMachine occurs after the state-machine is loaded, and before it's started. The interesting functionalities of QtScriptedStateMachine are:

- -

Working with the script engine

-

The main feature of QtScriptedStateMachine is that it includes a single QScriptEngine object that's shared between all state actions and transitions. That's what allows the states to rely on a single data context for evaluating conditions and executing the entry/exit/transition actions.

-

A very useful function is QtScriptedStateMachine::registerObject(), which allows you to add an object (and optionally all its descendants) to the scripting context. QtScriptedStateMachine::scriptEngine() allows you to manipulate the scripting context directly. Use the mediaplayer example as a reference for using the registerObject function.

- -

Connecting the state-machine to signals/slots

-

A simpler way to interact with the state machine is through signals and slots. The slot QtScriptedStateMachine::postNamedEvent() and the signal QtScriptedStateMachine::eventTriggered() allow for a simple interaction with the state machine, as you can connect signals to postNamedEvent and eventTriggered to and signal/slot.

-

There are no entered/exited signals from states, as that would make the state-machines less deterministic and would create results that are difficult to manage and predict (does the signal get emitted before, after or during the normal execution list?)

-

The calc example shows the usage of QtScriptedStateMachine::postNamedEvent().

- -

Extending the state-machine with custom invokers

-

A custom invoker allows you to write your own invoke tags, and implement specific invoke types, as described in the SCXML standard.

-

To create a custom invoker, you must subclass from QtSsmInvoker, and implement at least:

- -

When these terms are met, you can create an invoke-factory, and register it to the state machine. Example:

-
     #include <QtScriptedStateMachine>
-
-     class MyInvoker : public QtSsmInvoker
-     {
-         Q_OBJECT
-         public:
-             MyInvoker(QtScriptedEvent* ievent, QtScriptedStateMachine* p) : QtSsmInvoker(ievent,p),menu(0)
-             {
-             }
-             static void initInvokerFactory(QtScriptedStateMachine* machine)
-             {
-                 machine->scriptEngine()->globalObject().setProperty("some-name",someValue);
-             }
-             static bool isTypeSupported (const QString & s) { return s== "my-type"; }
-         public Q_SLOTS:
-             void activate ()
-             {
-                 doSomeStuff ();
-             }
-     };
- ...
-     static QSsmAutoInvokerFactory<MyInvoker> _s_factory;
-     myScriptedStateMachine->registerInvoker(&_s_factory);
-

The initEvent protected member can be used to access the parameters given to the invoker by the calling state machine. QtSsmInvoker::postParentEvent() allows sending events back to the calling state machine.

- -

Loading SCXML files at runtime

-

To load SCXML files in runtime, the static function QtScriptedStateMachine::load() must be used. Note that this function requires the xmlpatterns and xml modules to be enabled. QtScriptedStateMachine::load() it creates a new QtScriptedStateMachine object. An example code would be:

-
 #include "qscriptedstatemachine.h"
-
- // some code
- QtScriptedStateMachine* stateMachine = QtScriptedStateMachine::load ("path-to-some-file.scxml");
- // ... register some objects, handle some stuff in the script engine...
- stateMachine->start ();
- -

Supported SCXML tags and features

-

Though most of the SCXML features are supported in this implementation, the support is incomplete, partially because the spec itself is still evolving. This documentation tries to capture most of the gaps and differences.

- -

Fully supported elements

-

The tags state, parallel, final, onentry, onexit, raise, if, elseif, else, log, cancel, datamodel,data, assign, param, ands anchor are fully supported according to the scxml spec.

- -

Partially supported elements

-
    -
  • scxml: The attributes version, profile and exmode are ignored.
  • -
  • initial: Treated as a regular state that's marked as initial for the parent state.
  • -
  • history: Actions in the history's default transition are ignored.
  • -
  • content: Supports only JSON data, not XML.
  • -
  • send: only the scxml target type is supported. The id attribute is ignored.
  • -
  • invoke: the autoforward and id tags are ignored.
  • -
- -

Unsupported elements

-

The elements donedata, finalize and validate are not supported. Also, the local/global script scoping functionality is not implemented.

- -

Extras

- -
Signal transitions
-

To declare a signal transition, use a transition tag with a q-signal uri scheme. Example:

-
     <transition target="someState" event="q-signal:someObject.someSignal()" />
- -
Property binding
-

The q-binding invoker can be used to setup properties on entry, that are restored on exit. Note that if the properties are changed externally while the state is active, the properties would still be restored.

-

The binding invoke element accepts a content tag with a JSON array, of which each element is a 3-item array: [object, property-name, property-value].

-

Example:

-
      <invoke type="q-bindings"><content>
-                     [[myObject,"someProperty",someValue1 + someValue2],
-                     [myObject,"text","hello"]]
-      </content></invoke>
- -
Menus
-

A custom invoker added to the solution is the "q-menu" invoker. This invoker allows you to display a QMenu and listen to its events. The q-menu invoker should a content tag, which includes an expression evaluating to an ecmascript object defining the menu. Note that support for menus is currently experimental, and the mediaplayer example demonstrates its use.

- -
Message Boxes
-

Similar to q-menus, the "q-messagebox" invoker lets you show a QMessageBox and react to the user interactions with it.

-

The q-messagebox invoker accepts an ecmascript object that contains name/value pairs for the QMessageBox properties.

-

Example:

-
         <invoke type="q-messagebox">
-             <content>
-                 {
-                   "parent" : myParentWidget,
-                   "icon" : QMessageBox.Question,
-                   "windowTitle" : "Would you like to exit?",
-                   "text" : "Are you sure?",
-                   "standardButtons" : QMessageBox.Yes|QMessageBox.No
-                 }
-             </content>
-         </invoke>
-

See the blackjack example for reference.

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/statemachine-api.html b/lib/qtstatemachine/doc/html/statemachine-api.html deleted file mode 100644 index 97cca33..0000000 --- a/lib/qtstatemachine/doc/html/statemachine-api.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - The State Machine Framework - - - - - - - -
  Home

The State Machine Framework
-

- -

The State Machine framework provides classes for creating and executing state graphs. The concepts and notation are based on those from Harel's Statecharts, which is also the basis of UML state diagrams. The semantics of state machine execution are based on State Chart XML (SCXML).

-

Statecharts provide a graphical way of modeling how a system reacts to stimuli. This is done by defining the possible states that the system can be in, and how the system can move from one state to another (transitions between states). A key characteristic of event-driven systems (such as Qt applications) is that behavior often depends not only on the last or current event, but also the events that preceded it. With statecharts, this information is easy to express.

-

The State Machine framework provides an API and execution model that can be used to effectively embed the elements and semantics of statecharts in Qt applications. The framework integrates tightly with Qt's existing event system and meta-object system; for example, transitions between states can be triggered by signals, and states can be configured to set properties and invoke methods on QObjects.

- -

A Simple State Machine

-

To demonstrate the core functionality of the State Machine API, let's look at a small example: A state machine with three states, s1, s2 and s3. The state machine is controlled by a single QPushButton; when the button is clicked, the machine transitions to another state. Initially, the state machine is in state s1. The statechart for this machine is as follows:

-

The following snippet shows the code needed to create such a state machine.

-
 QtStateMachine machine;
- QtState *s1 = new QtState();
- QtState *s2 = new QtState();
- QtState *s3 = new QtState();
-
- s1->addTransition(button, SIGNAL(clicked()), s2);
- s2->addTransition(button, SIGNAL(clicked()), s3);
- s3->addTransition(button, SIGNAL(clicked()), s1);
-
- machine.addState(s1);
- machine.addState(s2);
- machine.addState(s3);
- machine.setInitialState(s1);
-
- machine.start();
-

Once the state machine has been set up, you need to start it by calling QtStateMachine::start(). The state machine executes asynchronously, i.e. it becomes part of your application's event loop.

-

The above state machine is perfectly fine, but it doesn't do anything; it merely transitions from one state to another. The QtAbstractState::assignProperty() function can be used to have a state set a property of a QObject when the state is entered. In the following snippet, the value that should be assigned to a QLabel's text property is specified for each state:

-
 s1->assignProperty(label, "text", "In state s1");
- s2->assignProperty(label, "text", "In state s2");
- s3->assignProperty(label, "text", "In state s3");
-

When any of the states is entered, the label's text will be changed accordingly.

-

The QtActionState::invokeMethodOnEntry() function can be used to have a state invoke a method (a slot) of a QObject when the state is entered. In the following snippet, the button's showMaximized() slot will be called when state s3 is entered:

-
 s2->invokeMethodOnEntry(button, "showMaximized");
- -

Sharing Transitions By Grouping States

-

The state machine defined in the previous section never finishes. In order for a state machine to be able to finish, it needs to have a top-level final state. When the state machine enters a top-level final state, the machine will emit the finished() signal and halt.

-

Assume we wanted the user to be able to quit the application at any time by clicking a Quit button. In order to achieve this, we need to create a final state and make it the target of a transition associated with the Quit button's clicked() signal. We could add a transition from each of s1, s2 and s3; however, this seems redundant, and one would also have to remember to add such a transition from every new state that is added in the future.

-

We can achieve the same behavior (namely that clicking the Quit button quits the state machine, regardless of which state the state machine is in) by grouping states s1, s2 and s3. This is done by creating a new top-level state and making the three original states children of the new state. The following diagram shows the new state machine.

-

The three original states have been renamed s11, s12 and s13 to reflect that they are now children of the new top-level state, s1. Child states implicitly inherit the transitions of their parent state. This means it is now sufficient to add a single transition from s1 to the final state s2. New states added to s1 will also automatically inherit this transition.

-

All that's needed to group states is to specify the proper parent when the state is created. You also need to specify which of the child states is the initial one (i.e. which child state the state machine should enter when the parent state is the target of a transition).

-
 QtState *s1 = new QtState();
- QtState *s11 = new QtState(s1);
- QtState *s12 = new QtState(s1);
- QtState *s13 = new QtState(s1);
- s1->setInitialState(s11);
- machine.addState(s1);
-
 QtFinalState *s2 = new QtFinalState();
- s1->addTransition(quitButton, SIGNAL(clicked()), s2);
- machine.addState(s2);
-
- QObject::connect(&machine, SIGNAL(finished()), QApplication::instance(), SLOT(quit()));
-

In this case we want the application to quit when the state machine is finished, so the machine's finished() signal is connected to the application's quit() slot.

-

A child state can override an inherited transition. For example, the following code adds a transition that effectively causes the Quit button to be ignored when the state machine is in state s12.

-
 s12>addTransition(quitButton, SIGNAL(clicked()), s12);
- -

Using History States to Save and Restore the Current State

-

Imagine that we wanted to add an "interrupt" mechanism to the example discussed in the previous section; the user should be able to click a button to have the state machine perform some non-related task, after which the state machine should resume whatever it was doing before (i.e. return to the old state, which is one of s11, s12 and s13 in this case).

-

Such behavior can easily be modeled using history states. A history state (QtHistoryState object) is a pseudo-state that represents the child state that the parent state was in the last time the parent state was exited.

-

A history state is created as a child of the state for which we wish to record the current child state; when the state machine detects the presence of such a state at runtime, it automatically records the current (real) child state when the parent state is exited. A transition to the history state is in fact a transition to the child state that the state machine had previously saved; the state machine automatically "forwards" the transition to the real child state.

-

The following diagram shows the state machine after the interrupt mechanism has been added.

-

The following code shows how it can be implemented; in this example we simply display a message box when s3 is entered, then immediately return to the previous child state of s1 via the history state.

-
 QtHistoryState *s1h = s1->addHistoryState();
-
- QtState *s3 = new QtState();
- s3->assignProperty(label, "text", "In s3");
- QMessageBox mbox;
- mbox.addButton(QMessageBox::Ok);
- mbox.setText("Interrupted!");
- mbox.setIcon(QMessageBox::Information);
- s3->invokeMethodOnEntry(&mbox, "exec");
- s3->addTransition(s1h);
- machine.addState(s3);
-
- s1->addTransition(interruptButton, SIGNAL(clicked()), s3);
- -

Using Parallel States to Avoid a Combinatorial Explosion of States

-

Assume that you wanted to model a set of mutually exclusive properties of a car in a single state machine. Let's say the properties we are interested in are Clean vs Dirty, and Moving vs Not moving. It would take four mutually exclusive states and eight transitions to be able to represent and freely move between all possible combinations.

-

If we added a third property (say, Red vs Blue), the total number of states would double, to eight; and if we added a fourth property (say, Enclosed vs Convertible), the total number of states would double again, to 16.

-

Using parallel states, the total number of states and transitions grows linearly as we add more properties, instead of exponentially. Furthermore, states can be added to or removed from the parallel state without affecting any of their sibling states.

-

To create a parallel state group, pass QtState::ParallelStateGroup to the QtState constructor.

-
 QtState *s1 = new QtState(QtState::ParallelStateGroup);
- // s11 and s12 will be entered in parallel
- QtState *s11 = new QtState(s1);
- QtState *s12 = new QtState(s1);
- -

Detecting that a Composite State has Finished

-

A child state can be final; when a final child state is entered, a QtStateFinishedEvent is generated for the parent state. You can use the QtStateFinishedTransition class to trigger a transition based on this event.

-

This is useful when you want to hide the internal details of a state; i.e. the only thing the outside world should be able to do is enter the state, and get a notification when the state has finished (i.e. when a final child state has been entered).

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/html/statemachine.html b/lib/qtstatemachine/doc/html/statemachine.html deleted file mode 100644 index 71b1e3f..0000000 --- a/lib/qtstatemachine/doc/html/statemachine.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - State Machine Classes - - - - - - - -
  Home

State Machine Classes
-

-

These classes are provided by The State Machine Framework for creating event-driven state machines.

-

- - - - - - - - - - - - - - - -
QtAbstractStateThe base class of states of a QtStateMachine
QtAbstractTransitionThe base class of transitions between QtAbstractState objects
QtActionStateAction-based state
QtEventTransitionQObject-specific transition for Qt events
QtFinalStateFinal state
QtHistoryStateMeans of returning to a previously active substate
QtSignalEventRepresents a Qt signal event
QtSignalTransitionTransition based on a Qt signal
QtStateGeneral-purpose state for QtStateMachine
QtStateActionThe base class of QtState actions
QtStateFinishedEventContains parameters that describe a state that has finished
QtStateFinishedTransitionTransition that triggers when a state is finished
QtStateInvokeMethodActionInvoke method action for QObjects
QtStateMachineHierarchical finite state machine
QtTransitionAction-based transition

-


- - - - -
Copyright © 2009 NokiaTrademarks
Qt Solutions
- diff --git a/lib/qtstatemachine/doc/images/qt-logo.png b/lib/qtstatemachine/doc/images/qt-logo.png deleted file mode 100644 index 794162f..0000000 Binary files a/lib/qtstatemachine/doc/images/qt-logo.png and /dev/null differ diff --git a/lib/qtstatemachine/doc/images/statemachine-button-history.png b/lib/qtstatemachine/doc/images/statemachine-button-history.png deleted file mode 100644 index cd66478..0000000 Binary files a/lib/qtstatemachine/doc/images/statemachine-button-history.png and /dev/null differ diff --git a/lib/qtstatemachine/doc/images/statemachine-button-nested.png b/lib/qtstatemachine/doc/images/statemachine-button-nested.png deleted file mode 100644 index 60360d1..0000000 Binary files a/lib/qtstatemachine/doc/images/statemachine-button-nested.png and /dev/null differ diff --git a/lib/qtstatemachine/doc/images/statemachine-button.png b/lib/qtstatemachine/doc/images/statemachine-button.png deleted file mode 100644 index 75d9e53..0000000 Binary files a/lib/qtstatemachine/doc/images/statemachine-button.png and /dev/null differ diff --git a/lib/qtstatemachine/doc/images/statemachine-finished.png b/lib/qtstatemachine/doc/images/statemachine-finished.png deleted file mode 100644 index 802621e..0000000 Binary files a/lib/qtstatemachine/doc/images/statemachine-finished.png and /dev/null differ diff --git a/lib/qtstatemachine/doc/images/statemachine-nonparallel.png b/lib/qtstatemachine/doc/images/statemachine-nonparallel.png deleted file mode 100644 index 1fe60d8..0000000 Binary files a/lib/qtstatemachine/doc/images/statemachine-nonparallel.png and /dev/null differ diff --git a/lib/qtstatemachine/doc/images/statemachine-parallel.png b/lib/qtstatemachine/doc/images/statemachine-parallel.png deleted file mode 100644 index 1868792..0000000 Binary files a/lib/qtstatemachine/doc/images/statemachine-parallel.png and /dev/null differ diff --git a/lib/qtstatemachine/doc/index.qdoc b/lib/qtstatemachine/doc/index.qdoc deleted file mode 100644 index ea81808..0000000 --- a/lib/qtstatemachine/doc/index.qdoc +++ /dev/null @@ -1,41 +0,0 @@ -/*! - \page index.html - \title Qt State Machine Framework - - \section1 Description - - This component adds an API for creating hierarchical finite state machines. - Note that this solution is experimental and work in progress: - No backwards compatibility (source nor binary) is provided. - - - - The State Machine Framework lets you define and run state machines. - It also includes tools to load or compile SCXML files. - - - - \section1 Overview - \list - \i \link statemachine-api.html The State Machine Framework \endlink \i \link scxml.html Using SCXML Files With The State Machine Framework \endlink \endlist - - \section1 Classes - \list - \i QtAbstractState \i QtAbstractTransition \i QtActionState \i QtEventTransition \i QtFinalState \i QtHistoryState \i QtSignalTransition \i QtState \i QtStateAction \i QtStateFinishedEvent \i QtStateFinishedTransition \i QtStateInvokeMethodAction \i QtStateMachine \i QtTransition \i QtScriptedStateMachine \i QtScriptedEvent \i QtScriptedTransition \i QtSsmInvoker\endlist - - - - - - - \section1 Tested platforms - \list - \i Qt 4.4, 4.5 / Windows XP / MSVC.NET 2005 - \i Qt 4.4, 4.5 / Linux / gcc - \i Qt 4.4, 4.5 / MacOS X 10.5 / gcc - \endlist - - - - - */ \ No newline at end of file diff --git a/lib/qtstatemachine/doc/scxml.qdoc b/lib/qtstatemachine/doc/scxml.qdoc deleted file mode 100644 index 8020432..0000000 --- a/lib/qtstatemachine/doc/scxml.qdoc +++ /dev/null @@ -1,254 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -/*! - \page scxml.html - \title Using SCXML files in Qt - \ingroup sctools - \brief An overview of the sctools module, which allows loading scripted state charts with SCXML - - \tableofcontents - - The sctools module allows loading SCXML files into a QtScriptedStateMachine object. - - The files that the tool can load conform to the \l{State Chart XML: State Machine Notation for Control Abstraction}{State Chart XML (SCXML)} standard. - - \section1 Getting Started with Qt & SCXML - \list - \i First of all, make yourself familiar with the \l{State Chart XML: State Machine Notation for Control Abstraction}{SCXML specification}. - \i Read this document to understand how to enable SCXML files in your project, and how to load SCXML files in runtime/build-time. - \i Go over the blackjack, calc and mediaplayer examples for usage demonstration. - \endlist - - \section1 Enabling the QtScriptedStateMachine class - - The \l QtScriptedStateMachine class is enabled automatically when the script module is enabled. - - \section1 Using the QtScriptedStateMachine class - - QtScriptedStateMachine is a subclass of QtStateMachine. QtStateMachine actually includes most of the - "interesting" API, while QtScriptedStateMachine adds the missing parts to support SCXML. - - Most of the interaction with QtScriptedStateMachine occurs after the state-machine is loaded, - and before it's started. - The interesting functionalities of QtScriptedStateMachine are: - \section2 Working with the script engine - - The main feature of \l QtScriptedStateMachine is that it includes a single \a QScriptEngine object that's - shared between all state actions and transitions. That's what allows the states to rely on a single - data context for evaluating conditions and executing the entry/exit/transition actions. - - A very useful function is \l QtScriptedStateMachine::registerObject(), which allows you to add an object - (and optionally all its descendants) to the scripting context. - \l QtScriptedStateMachine::scriptEngine() allows you to manipulate the scripting context directly. - Use the mediaplayer example as a reference for using the registerObject function. - - - \section2 Connecting the state-machine to signals/slots - - A simpler way to interact with the state machine is through signals and slots. - The slot \l QtScriptedStateMachine::postNamedEvent() and the signal \l QtScriptedStateMachine::eventTriggered() - allow for a simple interaction with the state machine, as you can connect signals to postNamedEvent - and eventTriggered to and signal/slot. - - There are no entered/exited signals from states, as that would make the state-machines less deterministic - and would create results that are difficult to manage and predict (does the signal get emitted before, - after or during the normal execution list?) - - The calc example shows the usage of \l QtScriptedStateMachine::postNamedEvent(). - - \section2 Extending the state-machine with custom invokers - - A custom invoker allows you to write your own \l{http://www.w3.org/TR/scxml/#Invoke}{invoke} tags, and implement specific invoke types, - as described in the SCXML standard. - - To create a custom invoker, you must subclass from \l QtSsmInvoker, and implement at least: - \list - \i A constructor with \l QtScriptedEvent and \l QtStateMachine arguments - \i The \l QtSsmInvoker::activate() function - \i A static bool isTypeSupportedString(QString) function, conforms to the \l {http://www.w3.org/TR/scxml/#Invoke}{invoke} element's type attribute - \i A static void initInvokerFactory(QtScriptedStateMachine*) function, allows some initialization (like adding properties to the script engine) - \endlist - - - When these terms are met, you can create an invoke-factory, and register it to the state machine. - Example: - \code - #include - - class MyInvoker : public QtSsmInvoker - { - Q_OBJECT - public: - MyInvoker(QtScriptedEvent* ievent, QtScriptedStateMachine* p) : QtSsmInvoker(ievent,p),menu(0) - { - } - static void initInvokerFactory(QtScriptedStateMachine* machine) - { - machine->scriptEngine()->globalObject().setProperty("some-name",someValue); - } - static bool isTypeSupported (const QString & s) { return s== "my-type"; } - public Q_SLOTS: - void activate () - { - doSomeStuff (); - } - }; - ... - static QSsmAutoInvokerFactory _s_factory; - myScriptedStateMachine->registerInvoker(&_s_factory); - - \endcode - - The initEvent protected member can be used to access the parameters - given to the invoker by the calling state machine. \l QtSsmInvoker::postParentEvent() - allows sending events back to the calling state machine. - - - - - - \section1 Loading SCXML files at runtime - - To load SCXML files in runtime, the static function \l QtScriptedStateMachine::load() must be used. - Note that this function requires the xmlpatterns and xml modules to be enabled. - \l QtScriptedStateMachine::load() it creates a new \l QtScriptedStateMachine object. - An example code would be: - -\code - #include "qscriptedstatemachine.h" - - // some code - QtScriptedStateMachine* stateMachine = QtScriptedStateMachine::load ("path-to-some-file.scxml"); - // ... register some objects, handle some stuff in the script engine... - stateMachine->start (); -\endcode - - - \section1 Supported SCXML tags and features - -Though most of the SCXML features are supported in this implementation, the support is incomplete, -partially because the spec itself is still evolving. This documentation tries to capture most of the -gaps and differences. - - \section2 Fully supported elements - The tags \l {http://www.w3.org/TR/scxml/#state}{state}, \l {http://www.w3.org/TR/scxml/#parallel}{parallel}, \l {http://www.w3.org/TR/scxml/#final}{final}, \l {http://www.w3.org/TR/scxml/#onentry}{onentry}, \l {http://www.w3.org/TR/scxml/#onexit}{onexit}, \l {http://www.w3.org/TR/scxml/#raise}{raise}, \l {http://www.w3.org/TR/scxml/#if}{if}, \l {http://www.w3.org/TR/scxml/#elseif}{elseif}, \l {http://www.w3.org/TR/scxml/#else}{else}, \l {http://www.w3.org/TR/scxml/#log}{log}, \l {http://www.w3.org/TR/scxml/#cancel}{cancel}, \l {http://www.w3.org/TR/scxml/#datamodel}{datamodel},\l {http://www.w3.org/TR/scxml/#data}{data}, \l {http://www.w3.org/TR/scxml/#assign}{assign}, \l {http://www.w3.org/TR/scxml/#param}{param}, ands \l {http://www.w3.org/TR/scxml/#anchor}{anchor} are fully supported according to the scxml spec. - - \section2 Partially supported elements - \list - \i \l {http://www.w3.org/TR/scxml/#scxml}{scxml}: The attributes version, profile and exmode are ignored. - \i \l {http://www.w3.org/TR/scxml/#initial}{initial}: Treated as a regular state that's marked as initial for the parent state. - \i \l {http://www.w3.org/TR/scxml/#history}{history}: Actions in the history's default transition are ignored. - \i \l {http://www.w3.org/TR/scxml/#content}{content}: Supports only JSON data, not XML. - \i \l {http://www.w3.org/TR/scxml/#send}{send}: only the scxml target type is supported. The id attribute is ignored. - \i \l {http://www.w3.org/TR/scxml/#invoke}{invoke}: the autoforward and id tags are ignored. - \endlist - - \section2 Unsupported elements - The elements \l {http://www.w3.org/TR/scxml/#Donedata}{donedata}, \l {http://www.w3.org/TR/scxml/#Finalize}{finalize} and \l {http://www.w3.org/TR/scxml/#Validate}{validate} are not supported. - Also, the local/global script scoping functionality is not implemented. - - \section2 Extras - \section3 Signal transitions - To declare a signal transition, use a transition tag with a q-signal uri scheme. - Example: - \code - - \endcode - - \section3 Property binding - The q-binding invoker can be used to setup properties on entry, that are restored on exit. - Note that if the properties are changed externally while the state is active, the properties - would still be restored. - - The binding invoke element accepts a content tag with a JSON array, of which each element is a 3-item - array: [object, property-name, property-value]. - - Example: - - \code - - [[myObject,"someProperty",someValue1 + someValue2], - [myObject,"text","hello"]] - - \endcode - - \section3 Menus - A custom invoker added to the solution is the "q-menu" invoker. This invoker allows you to display a - QMenu and listen to its events. - The q-menu invoker should a content tag, which includes an expression evaluating to an ecmascript - object defining the menu. - Note that support for menus is currently experimental, and the mediaplayer example demonstrates its use. - - \section3 Message Boxes - Similar to q-menus, the "q-messagebox" invoker lets you show a QMessageBox and react to - the user interactions with it. - - The q-messagebox invoker accepts an ecmascript object that contains name/value pairs for the QMessageBox - properties. - - Example: - \code - - - { - "parent" : myParentWidget, - "icon" : QMessageBox.Question, - "windowTitle" : "Would you like to exit?", - "text" : "Are you sure?", - "standardButtons" : QMessageBox.Yes|QMessageBox.No - } - - - \endcode - - See the blackjack example for reference. - - - - - - */ diff --git a/lib/qtstatemachine/doc/statemachine.qdoc b/lib/qtstatemachine/doc/statemachine.qdoc deleted file mode 100644 index 9f329d0..0000000 --- a/lib/qtstatemachine/doc/statemachine.qdoc +++ /dev/null @@ -1,307 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -/*! - \page statemachine-api.html - \title The State Machine Framework - \brief An overview of the State Machine framework for constructing and executing state graphs. - - \tableofcontents - - The State Machine framework provides classes for creating and executing - state graphs. The concepts and notation are based on those from Harel's - \l{Statecharts: A visual formalism for complex systems}{Statecharts}, which - is also the basis of UML state diagrams. The semantics of state machine - execution are based on \l{State Chart XML: State Machine Notation for - Control Abstraction}{State Chart XML (SCXML)}. - - Statecharts provide a graphical way of modeling how a system reacts to - stimuli. This is done by defining the possible \e states that the system can - be in, and how the system can move from one state to another (\e transitions - between states). A key characteristic of event-driven systems (such as Qt - applications) is that behavior often depends not only on the last or current - event, but also the events that preceded it. With statecharts, this - information is easy to express. - - The State Machine framework provides an API and execution model that can be - used to effectively embed the elements and semantics of statecharts in Qt - applications. The framework integrates tightly with Qt's existing event - system and meta-object system; for example, transitions between states can - be triggered by signals, and states can be configured to set properties and - invoke methods on QObjects. - - \section1 A Simple State Machine - - To demonstrate the core functionality of the State Machine API, let's look - at a small example: A state machine with three states, \c s1, \c s2 and \c - s3. The state machine is controlled by a single QPushButton; when the button - is clicked, the machine transitions to another state. Initially, the state - machine is in state \c s1. The statechart for this machine is as follows: - - \img statemachine-button.png - \omit - \caption This is a caption - \endomit - - The following snippet shows the code needed to create such a state machine. - - \code - QtStateMachine machine; - QtState *s1 = new QtState(); - QtState *s2 = new QtState(); - QtState *s3 = new QtState(); - - s1->addTransition(button, SIGNAL(clicked()), s2); - s2->addTransition(button, SIGNAL(clicked()), s3); - s3->addTransition(button, SIGNAL(clicked()), s1); - - machine.addState(s1); - machine.addState(s2); - machine.addState(s3); - machine.setInitialState(s1); - - machine.start(); - \endcode - - Once the state machine has been set up, you need to start it by calling - QtStateMachine::start(). The state machine executes asynchronously, i.e. it - becomes part of your application's event loop. - - The above state machine is perfectly fine, but it doesn't \e do anything; it - merely transitions from one state to another. The - QtAbstractState::assignProperty() function can be used to have a state set a - property of a QObject when the state is entered. In the following snippet, - the value that should be assigned to a QLabel's text property is specified - for each state: - - \code - s1->assignProperty(label, "text", "In state s1"); - s2->assignProperty(label, "text", "In state s2"); - s3->assignProperty(label, "text", "In state s3"); - \endcode - - When any of the states is entered, the label's text will be changed - accordingly. - - The QtActionState::invokeMethodOnEntry() function can be used to have a state - invoke a method (a slot) of a QObject when the state is entered. In the - following snippet, the button's showMaximized() slot will be called when - state \c s3 is entered: - - \code - s2->invokeMethodOnEntry(button, "showMaximized"); - \endcode - - \section1 Sharing Transitions By Grouping States - - The state machine defined in the previous section never finishes. In order - for a state machine to be able to finish, it needs to have a top-level \e - final state. When the state machine enters a top-level final state, the - machine will emit the finished() signal and halt. - - Assume we wanted the user to be able to quit the application at any time by - clicking a Quit button. In order to achieve this, we need to create a final - state and make it the target of a transition associated with the Quit - button's clicked() signal. We could add a transition from each of \c s1, \c - s2 and \c s3; however, this seems redundant, and one would also have to - remember to add such a transition from every new state that is added in the - future. - - We can achieve the same behavior (namely that clicking the Quit button quits - the state machine, regardless of which state the state machine is in) by - grouping states \c s1, \c s2 and \c s3. This is done by creating a new - top-level state and making the three original states children of the new - state. The following diagram shows the new state machine. - - \img statemachine-button-nested.png - \omit - \caption This is a caption - \endomit - - The three original states have been renamed \c s11, \c s12 and \c s13 to - reflect that they are now children of the new top-level state, \c s1. Child - states implicitly inherit the transitions of their parent state. This means - it is now sufficient to add a single transition from \c s1 to the final - state \c s2. New states added to \c s1 will also automatically inherit this - transition. - - All that's needed to group states is to specify the proper parent when the - state is created. You also need to specify which of the child states is the - initial one (i.e. which child state the state machine should enter when the - parent state is the target of a transition). - - \code - QtState *s1 = new QtState(); - QtState *s11 = new QtState(s1); - QtState *s12 = new QtState(s1); - QtState *s13 = new QtState(s1); - s1->setInitialState(s11); - machine.addState(s1); - \endcode - - \code - QtFinalState *s2 = new QtFinalState(); - s1->addTransition(quitButton, SIGNAL(clicked()), s2); - machine.addState(s2); - - QObject::connect(&machine, SIGNAL(finished()), QApplication::instance(), SLOT(quit())); - \endcode - - In this case we want the application to quit when the state machine is - finished, so the machine's finished() signal is connected to the - application's quit() slot. - - A child state can override an inherited transition. For example, the - following code adds a transition that effectively causes the Quit button to - be ignored when the state machine is in state \c s12. - - \code - s12>addTransition(quitButton, SIGNAL(clicked()), s12); - \endcode - - \section1 Using History States to Save and Restore the Current State - - Imagine that we wanted to add an "interrupt" mechanism to the example - discussed in the previous section; the user should be able to click a button - to have the state machine perform some non-related task, after which the - state machine should resume whatever it was doing before (i.e. return to the - old state, which is one of \c s11, \c s12 and \c s13 in this case). - - Such behavior can easily be modeled using \e{history states}. A history - state (QtHistoryState object) is a pseudo-state that represents the child - state that the parent state was in the last time the parent state was - exited. - - A history state is created as a child of the state for which we wish to - record the current child state; when the state machine detects the presence - of such a state at runtime, it automatically records the current (real) - child state when the parent state is exited. A transition to the history - state is in fact a transition to the child state that the state machine had - previously saved; the state machine automatically "forwards" the transition - to the real child state. - - The following diagram shows the state machine after the interrupt mechanism - has been added. - - \img statemachine-button-history.png - \omit - \caption This is a caption - \endomit - - The following code shows how it can be implemented; in this example we - simply display a message box when \c s3 is entered, then immediately return - to the previous child state of \c s1 via the history state. - - \code - QtHistoryState *s1h = s1->addHistoryState(); - - QtState *s3 = new QtState(); - s3->assignProperty(label, "text", "In s3"); - QMessageBox mbox; - mbox.addButton(QMessageBox::Ok); - mbox.setText("Interrupted!"); - mbox.setIcon(QMessageBox::Information); - s3->invokeMethodOnEntry(&mbox, "exec"); - s3->addTransition(s1h); - machine.addState(s3); - - s1->addTransition(interruptButton, SIGNAL(clicked()), s3); - \endcode - - \section1 Using Parallel States to Avoid a Combinatorial Explosion of States - - Assume that you wanted to model a set of mutually exclusive properties of a - car in a single state machine. Let's say the properties we are interested in - are Clean vs Dirty, and Moving vs Not moving. It would take four mutually - exclusive states and eight transitions to be able to represent and freely - move between all possible combinations. - - \img statemachine-nonparallel.png - \omit - \caption This is a caption - \endomit - - If we added a third property (say, Red vs Blue), the total number of states - would double, to eight; and if we added a fourth property (say, Enclosed vs - Convertible), the total number of states would double again, to 16. - - Using parallel states, the total number of states and transitions grows - linearly as we add more properties, instead of exponentially. Furthermore, - states can be added to or removed from the parallel state without affecting - any of their sibling states. - - \img statemachine-parallel.png - \omit - \caption This is a caption - \endomit - - To create a parallel state group, pass QtState::ParallelStateGroup to the - QtState constructor. - - \code - QtState *s1 = new QtState(QtState::ParallelStateGroup); - // s11 and s12 will be entered in parallel - QtState *s11 = new QtState(s1); - QtState *s12 = new QtState(s1); - \endcode - - \section1 Detecting that a Composite State has Finished - - A child state can be final; when a final child state is entered, a - QtStateFinishedEvent is generated for the parent state. You can use the - QtStateFinishedTransition class to trigger a transition based on this event. - - \img statemachine-finished.png - \omit - \caption This is a caption - \endomit - - This is useful when you want to hide the internal details of a state; - i.e. the only thing the outside world should be able to do is enter the - state, and get a notification when the state has finished (i.e. when a final - child state has been entered). - - */ diff --git a/lib/qtstatemachine/examples/blackjack/bj.qrc b/lib/qtstatemachine/examples/blackjack/bj.qrc deleted file mode 100644 index 6e39934..0000000 --- a/lib/qtstatemachine/examples/blackjack/bj.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - blackjack.scxml - - diff --git a/lib/qtstatemachine/examples/blackjack/blackjack.pro b/lib/qtstatemachine/examples/blackjack/blackjack.pro deleted file mode 100644 index 29c7351..0000000 --- a/lib/qtstatemachine/examples/blackjack/blackjack.pro +++ /dev/null @@ -1,14 +0,0 @@ -# ------------------------------------------------- -# Project created by QtCreator 2008-12-16T16:32:05 -# ------------------------------------------------- -QT += script -DEPENDPATH += . -INCLUDEPATH += . -TARGET = blackjack -CONFIG += console -CONFIG -= app_bundle -TEMPLATE = app -SOURCES += main.cpp -include($$PWD/../../src/qtstatemachine.pri) -FORMS += blackjack.ui -RESOURCES += bj.qrc diff --git a/lib/qtstatemachine/examples/blackjack/blackjack.scxml b/lib/qtstatemachine/examples/blackjack/blackjack.scxml deleted file mode 100644 index 6c98eb5..0000000 --- a/lib/qtstatemachine/examples/blackjack/blackjack.scxml +++ /dev/null @@ -1,305 +0,0 @@ - - - - - - - - - - - [[welcomeLabel,"text","Welcome to Blackjack"]] - - - - - - - - - - - - - { - "parent" : gameWidget, - "icon" : QMessageBox.Question, - "windowTitle" : "Exit Blackjack", - "text" : "Are you sure?", - "standardButtons" : - QMessageBox.Yes|QMessageBox.No - } - - - - - - - - - - - - - - - - - [ - [betEdit,"enabled",true], - [betButton,"enabled",true], - [surrenderButton,"enabled",true], - [welcomeLabel,"text","Please place your bet"] - ] - - - - - - - - - - - - { - "parent" : betEdit, - "icon" : QMessageBox.Warning, - "windowTitle" : "Bet is Too High", - "text" : "Please Place Another Bet", - "standardButtons" : - QMessageBox.Ok - } - - - - - - - - - - - - - - - - - - - - - [ - [welcomeLabel,"text","Hit/Stand?"], - [hitButton,"enabled",true], - [standButton,"enabled",true] - ] - - - - - - - - - - - - - - - - - - - - - - [[welcomeLabel,"text","Game Over"]] - - - - - - - [[newRoundButton,"enabled",true]] - - - - - - - - - - - [[welcomeLabel,"text","You Won!"]] - - - [[welcomeLabel,"text","You Lost..."]] - - - - [[welcomeLabel,"text","You It's a draw."]] - - - - - - - - - - - - - diff --git a/lib/qtstatemachine/examples/blackjack/blackjack.ui b/lib/qtstatemachine/examples/blackjack/blackjack.ui deleted file mode 100644 index 187ec62..0000000 --- a/lib/qtstatemachine/examples/blackjack/blackjack.ui +++ /dev/null @@ -1,174 +0,0 @@ - - - gameWidget - - - - 0 - 0 - 520 - 173 - - - - SCXML Blackjack Example - - - - - - - 6 - - - 9 - - - - - - 18 - - - - - - - - - - - - 16 - - - - color:#660033 - - - - - - - - - - 6 - - - 0 - - - - - Points: - - - - - - - color:#339999 - - - - - - - - - - false - - - 10 - - - false - - - - - - - false - - - Bet - - - - - - - - - 6 - - - 0 - - - - - true - - - New Game - - - - - - - false - - - New Round - - - - - - - false - - - Surrender - - - - - - - false - - - Hit - - - - - - - false - - - Stand - - - - - - - Exit - - - - - - - - - - diff --git a/lib/qtstatemachine/examples/blackjack/main.cpp b/lib/qtstatemachine/examples/blackjack/main.cpp deleted file mode 100644 index e8ea625..0000000 --- a/lib/qtstatemachine/examples/blackjack/main.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** This file is 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 -#include "ui_blackjack.h" -#include -#include -#include -#include -#include "qscriptedstatemachine.h" -#include "time.h" - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - srand(clock()); - QtScriptedStateMachine *sm = QtScriptedStateMachine::load(":/blackjack.scxml"); - QObject::connect (sm, SIGNAL(finished()), &a, SLOT(quit())); - QMessageBox b; - QWidget* wdg = new QWidget(); - Ui::gameWidget gw; - gw.setupUi(wdg); - sm->registerObject(wdg,"gameWidget",true); - wdg->show(); - sm->start(); - return a.exec(); -} diff --git a/lib/qtstatemachine/examples/calc/calc.cpp b/lib/qtstatemachine/examples/calc/calc.cpp deleted file mode 100644 index 2c676c3..0000000 --- a/lib/qtstatemachine/examples/calc/calc.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** This file is 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 "calc.h" -#include "ui_calc.h" -#include -CalcWidget::CalcWidget(QWidget *parent) - : QWidget(parent) -{ - setupUi(this); - QSignalMapper* mapper = new QSignalMapper(this); - connect (mapper, SIGNAL(mapped(QString)), this, SIGNAL(command(QString))); - QList buttons = findChildren(); - foreach (QAbstractButton* b, buttons) { - connect (b, SIGNAL(clicked()), mapper, SLOT(map())); - } - mapper->setMapping(button0,"DIGIT.0"); - mapper->setMapping(button1,"DIGIT.1"); - mapper->setMapping(button2,"DIGIT.2"); - mapper->setMapping(button3,"DIGIT.3"); - mapper->setMapping(button4,"DIGIT.4"); - mapper->setMapping(button5,"DIGIT.5"); - mapper->setMapping(button6,"DIGIT.6"); - mapper->setMapping(button7,"DIGIT.7"); - mapper->setMapping(button8,"DIGIT.8"); - mapper->setMapping(button9,"DIGIT.9"); - mapper->setMapping(buttonEq,"EQUALS"); - mapper->setMapping(buttonCE,"CE"); - mapper->setMapping(buttonC,"C"); - mapper->setMapping(buttonPoint,"POINT"); - mapper->setMapping(buttonPlus,"OPER.PLUS"); - mapper->setMapping(buttonStar,"OPER.STAR"); - mapper->setMapping(buttonMinus,"OPER.MINUS"); - mapper->setMapping(buttonDiv,"OPER.DIV"); -} -CalcWidget::~CalcWidget() -{ -} diff --git a/lib/qtstatemachine/examples/calc/calc.h b/lib/qtstatemachine/examples/calc/calc.h deleted file mode 100644 index db50ce8..0000000 --- a/lib/qtstatemachine/examples/calc/calc.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef CALC_H -#define CALC_H - -#include -#include "ui_calc.h" - -class CalcWidget : public QWidget, public Ui::CalcClass -{ - Q_OBJECT - -public: - CalcWidget(QWidget *parent = 0); - ~CalcWidget(); - -Q_SIGNALS: - void command(const QString &); -}; - -#endif // CALC_H diff --git a/lib/qtstatemachine/examples/calc/calc.pro b/lib/qtstatemachine/examples/calc/calc.pro deleted file mode 100644 index ff274c2..0000000 --- a/lib/qtstatemachine/examples/calc/calc.pro +++ /dev/null @@ -1,16 +0,0 @@ -# ------------------------------------------------- -# Project created by QtCreator 2008-12-25T19:50:44 -# ------------------------------------------------- - -TARGET = calc -TEMPLATE = app -win32: CONFIG += console -mac:CONFIG -= app_bundle -QT = core gui script -include($$PWD/../../src/qtstatemachine.pri) - -# Input -SOURCES += main.cpp calc.cpp -HEADERS += calc.h -FORMS += calc.ui -RESOURCES += calc.qrc diff --git a/lib/qtstatemachine/examples/calc/calc.qrc b/lib/qtstatemachine/examples/calc/calc.qrc deleted file mode 100644 index 04b1be3..0000000 --- a/lib/qtstatemachine/examples/calc/calc.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - calc.scxml - - diff --git a/lib/qtstatemachine/examples/calc/calc.scxml b/lib/qtstatemachine/examples/calc/calc.scxml deleted file mode 100644 index 35a9b9e..0000000 --- a/lib/qtstatemachine/examples/calc/calc.scxml +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib/qtstatemachine/examples/calc/calc.ui b/lib/qtstatemachine/examples/calc/calc.ui deleted file mode 100644 index 0e2a651..0000000 --- a/lib/qtstatemachine/examples/calc/calc.ui +++ /dev/null @@ -1,187 +0,0 @@ - - - CalcClass - - - - 0 - 0 - 419 - 156 - - - - - 419 - 400 - - - - SCXML Calculator - - - * {background-color:black;color:white} -button {border-width:3; } - - - - - - -background-color: #CCCCCC; -color: black; -font: 12pt "Courier New"; - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 6 - - - - - 4 - - - - - - - 1 - - - - - - - color:red;font-weight:bold - - - CE - - - - - - - 9 - - - - - - - 5 - - - - - - - 7 - - - - - - - 2 - - - - - - - 0 - - - - - - - 6 - - - - - - - 3 - - - - - - - . - - - - - - - + - - - - - - - - - - - - - - - * - - - - - - - / - - - - - - - = - - - - - - - 8 - - - - - - - color: red; font-weight:bold - - - C - - - - - - - - - - - diff --git a/lib/qtstatemachine/examples/calc/main.cpp b/lib/qtstatemachine/examples/calc/main.cpp deleted file mode 100644 index 0cdab14..0000000 --- a/lib/qtstatemachine/examples/calc/main.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** This file is 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 "calc.h" -#include "qscriptedstatemachine.h" -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - QtScriptedStateMachine *sm = QtScriptedStateMachine::load(":/calc.scxml"); - CalcWidget w; - sm->registerObject(&w,"",true); - QObject::connect (&w, SIGNAL(command(QString)), sm, SLOT(postNamedEvent(QString))); - w.show(); - sm->start(); - return a.exec(); -} diff --git a/lib/qtstatemachine/examples/clockticking/clockticking.pro b/lib/qtstatemachine/examples/clockticking/clockticking.pro deleted file mode 100644 index 6d5f8aa..0000000 --- a/lib/qtstatemachine/examples/clockticking/clockticking.pro +++ /dev/null @@ -1,11 +0,0 @@ -QT = core -TEMPLATE = app -TARGET = -win32: CONFIG += console -mac:CONFIG -= app_bundle -DEPENDPATH += . -INCLUDEPATH += . - -# Input -SOURCES += main.cpp -include(../../src/qtstatemachine.pri) diff --git a/lib/qtstatemachine/examples/clockticking/main.cpp b/lib/qtstatemachine/examples/clockticking/main.cpp deleted file mode 100644 index f34674a..0000000 --- a/lib/qtstatemachine/examples/clockticking/main.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/**************************************************************************** -** -** This file is 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 -#ifdef QT_STATEMACHINE_SOLUTION -#include -#include -#include -#endif - -class ClockEvent : public QEvent -{ -public: - ClockEvent() : QEvent(QEvent::Type(QEvent::User+2)) - {} -}; - -class ClockState : public QtState -{ -public: - ClockState(QtStateMachine *machine, QtState *parent) - : QtState(parent), m_machine(machine) {} - -protected: - virtual void onEntry() - { - fprintf(stdout, "ClockState entered; posting the initial tick\n"); - m_machine->postEvent(new ClockEvent()); - } - -private: - QtStateMachine *m_machine; -}; - -class ClockTransition : public QtAbstractTransition -{ -public: - ClockTransition(QtStateMachine *machine) - : QtAbstractTransition(), m_machine(machine) { } - -protected: - virtual bool eventTest(QEvent *e) const { - return (e->type() == QEvent::User+2); - } - virtual void onTransition() - { - fprintf(stdout, "ClockTransition triggered; posting another tick with a delay of 1 second\n"); - m_machine->postEvent(new ClockEvent(), 1000); - } - -private: - QtStateMachine *m_machine; -}; - -class ClockListener : public QtAbstractTransition -{ -public: - ClockListener() - : QtAbstractTransition() {} - -protected: - virtual bool eventTest(QEvent *e) const { - return (e->type() == QEvent::User+2); - } - virtual void onTransition() - { - fprintf(stdout, "ClockListener heard a tick!\n"); - } -}; - -int main(int argc, char **argv) -{ - QCoreApplication app(argc, argv); - - QtStateMachine machine; - QtState *group = new QtState(QtState::ParallelGroup); - group->setObjectName("group"); - - ClockState *clock = new ClockState(&machine, group); - clock->setObjectName("clock"); - clock->addTransition(new ClockTransition(&machine)); - - QtState *listener = new QtState(group); - listener->setObjectName("listener"); - listener->addTransition(new ClockListener()); - - machine.addState(group); - machine.setInitialState(group); - machine.start(); - - return app.exec(); -} diff --git a/lib/qtstatemachine/examples/composition/composition.pro b/lib/qtstatemachine/examples/composition/composition.pro deleted file mode 100644 index c5d5a5f..0000000 --- a/lib/qtstatemachine/examples/composition/composition.pro +++ /dev/null @@ -1,8 +0,0 @@ -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . - -# Input -SOURCES += main.cpp -include(../../src/qtstatemachine.pri) diff --git a/lib/qtstatemachine/examples/composition/main.cpp b/lib/qtstatemachine/examples/composition/main.cpp deleted file mode 100644 index a251a48..0000000 --- a/lib/qtstatemachine/examples/composition/main.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** This file is 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 -#ifdef QT_STATEMACHINE_SOLUTION -#include -#include -#include -#endif - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - QLabel label; - label.setAlignment(Qt::AlignCenter); - - QtStateMachine machine; - - QtState *s1 = new QtState(); - s1->setObjectName("s1"); - s1->assignProperty(&label, "text", "In S1, hang on..."); - s1->assignProperty(&label, "geometry", QRect(100, 100, 200, 100)); - - QtState *s1_timer = new QtState(s1); - s1_timer->setObjectName("s1_timer"); - QTimer t1; - t1.setInterval(2000); - s1_timer->invokeMethodOnEntry(&t1, "start"); - QtFinalState *s1_done = new QtFinalState(s1); - s1_done->setObjectName("s1_done"); - s1_timer->addTransition(&t1, SIGNAL(timeout()), s1_done); - s1->setInitialState(s1_timer); - - QtState *s2 = new QtState(); - s2->setObjectName("s2"); - s2->assignProperty(&label, "text", "In S2, I'm gonna quit on you..."); - s2->assignProperty(&label, "geometry", QRect(300, 300, 300, 100)); -// s2->invokeMethodOnEntry(&label, "setNum", QList() << 123); -// s2->invokeMethodOnEntry(&label, "showMaximized"); - - QtState *s2_timer = new QtState(s2); - s2_timer->setObjectName("s2_timer"); - QTimer t2; - t2.setInterval(2000); - s2_timer->invokeMethodOnEntry(&t2, "start"); - QtFinalState *s2_done = new QtFinalState(s2); - s2_done->setObjectName("s2_done"); - s2_timer->addTransition(&t2, SIGNAL(timeout()), s2_done); - s2->setInitialState(s2_timer); - - s1->addFinishedTransition(s2); - - QtFinalState *s3 = new QtFinalState(); - s3->setObjectName("s3"); - s2->addFinishedTransition(s3); - - machine.addState(s1); - machine.addState(s2); - machine.addState(s3); - machine.setInitialState(s1); - QObject::connect(&machine, SIGNAL(finished()), &app, SLOT(quit())); - machine.start(); - - label.show(); - return app.exec(); -} diff --git a/lib/qtstatemachine/examples/eventtransitions/eventtransitions.pro b/lib/qtstatemachine/examples/eventtransitions/eventtransitions.pro deleted file mode 100644 index c5d5a5f..0000000 --- a/lib/qtstatemachine/examples/eventtransitions/eventtransitions.pro +++ /dev/null @@ -1,8 +0,0 @@ -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . - -# Input -SOURCES += main.cpp -include(../../src/qtstatemachine.pri) diff --git a/lib/qtstatemachine/examples/eventtransitions/main.cpp b/lib/qtstatemachine/examples/eventtransitions/main.cpp deleted file mode 100644 index 238cca8..0000000 --- a/lib/qtstatemachine/examples/eventtransitions/main.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** This file is 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 -#ifdef QT_STATEMACHINE_SOLUTION -#include -#include -#include -#endif - -class Window : public QWidget -{ -public: - Window(QWidget *parent = 0) - : QWidget(parent) - { - QPushButton *button = new QPushButton(this); - button->setGeometry(QRect(100, 100, 100, 100)); - - QtStateMachine *machine = new QtStateMachine(this); - - QtState *s1 = new QtState(); - s1->assignProperty(button, "text", "Outside"); - - QtState *s2 = new QtState(); - s2->assignProperty(button, "text", "Inside"); - - QtEventTransition *enterTransition = new QtEventTransition(button, QEvent::Enter); - enterTransition->setTargetState(s2); - s1->addTransition(enterTransition); - - QtEventTransition *leaveTransition = new QtEventTransition(button, QEvent::Leave); - leaveTransition->setTargetState(s1); - s2->addTransition(leaveTransition); - - QtState *s3 = new QtState(); - s3->assignProperty(button, "text", "Pressing..."); - - QtEventTransition *pressTransition = new QtEventTransition(button, QEvent::MouseButtonPress); - pressTransition->setTargetState(s3); - s2->addTransition(pressTransition); - - QtEventTransition *releaseTransition = new QtEventTransition(button, QEvent::MouseButtonRelease); - releaseTransition->setTargetState(s2); - s3->addTransition(releaseTransition); - - machine->addState(s1); - machine->addState(s2); - machine->addState(s3); - machine->setInitialState(s1); - QObject::connect(machine, SIGNAL(finished()), qApp, SLOT(quit())); - machine->start(); - } -}; - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - extern int qRegisterGuiStateMachine(); - qRegisterGuiStateMachine(); - Window window; - window.resize(300, 300); - window.show(); - - return app.exec(); -} diff --git a/lib/qtstatemachine/examples/examples.pro b/lib/qtstatemachine/examples/examples.pro deleted file mode 100644 index 5380a55..0000000 --- a/lib/qtstatemachine/examples/examples.pro +++ /dev/null @@ -1,17 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = \ - clockticking \ - composition \ - eventtransitions \ - factorial \ - helloworld \ - pauseandresume \ - pingpong \ - trafficlight \ - twowaybutton \ - calc \ - blackjack - -contains(QT_CONFIG,phonon) { - SUBDIRS += mediaplayer -} diff --git a/lib/qtstatemachine/examples/factorial/factorial.pro b/lib/qtstatemachine/examples/factorial/factorial.pro deleted file mode 100644 index 9b941c0..0000000 --- a/lib/qtstatemachine/examples/factorial/factorial.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = app -TARGET = -QT = core -win32: CONFIG += console -mac:CONFIG -= app_bundle -DEPENDPATH += . -INCLUDEPATH += . - -# Input -SOURCES += main.cpp -include(../../src/qtstatemachine.pri) diff --git a/lib/qtstatemachine/examples/factorial/main.cpp b/lib/qtstatemachine/examples/factorial/main.cpp deleted file mode 100644 index bd1fb0d..0000000 --- a/lib/qtstatemachine/examples/factorial/main.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/**************************************************************************** -** -** This file is 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 -#ifdef QT_STATEMACHINE_SOLUTION -#include -#include -#include -#include -#endif - -class Factorial : public QObject -{ - Q_OBJECT - Q_PROPERTY(int x READ x WRITE setX) - Q_PROPERTY(int fac READ fac WRITE setFac) -public: - Factorial(QObject *parent = 0) - : QObject(parent) - { - m_fac = 1; - m_x = -1; - } - - int x() const - { - return m_x; - } - - void setX(int x) - { - if (x == m_x) - return; - m_x = x; - emit xChanged(); - } - - int fac() const - { - return m_fac; - } - - void setFac(int fac) - { - m_fac = fac; - } - -Q_SIGNALS: - void xChanged(); - -private: - int m_x; - int m_fac; -}; - -class FactorialLoopTransition : public QtSignalTransition -{ -public: - FactorialLoopTransition(Factorial *fact) - : QtSignalTransition(fact, SIGNAL(xChanged())), m_fact(fact) - {} - - virtual bool eventTest(QEvent *) const - { - return m_fact->property("x").toInt() > 1; - } - - virtual void onTransition() - { - int x = m_fact->property("x").toInt(); - int fac = m_fact->property("fac").toInt(); - m_fact->setProperty("fac", x * fac); - m_fact->setProperty("x", x - 1); - } - -private: - Factorial *m_fact; -}; - -class FactorialDoneTransition : public QtSignalTransition -{ -public: - FactorialDoneTransition(Factorial *fact) - : QtSignalTransition(fact, SIGNAL(xChanged())), m_fact(fact) - {} - - virtual bool eventTest(QEvent *) const - { - return m_fact->property("x").toInt() <= 1; - } - - virtual void onTransition() - { - fprintf(stdout, "%d\n", m_fact->property("fac").toInt()); - } - -private: - Factorial *m_fact; -}; - -int main(int argc, char **argv) -{ - QCoreApplication app(argc, argv); - - Factorial factorial; - - QtStateMachine machine; - - QtState *computing = new QtState(machine.rootState()); - computing->addTransition(new FactorialLoopTransition(&factorial)); - - QtFinalState *done = new QtFinalState(machine.rootState()); - FactorialDoneTransition *doneTransition = new FactorialDoneTransition(&factorial); - doneTransition->setTargetState(done); - computing->addTransition(doneTransition); - - QtState *initialize = new QtState(machine.rootState()); - initialize->assignProperty(&factorial, "x", 6); - FactorialLoopTransition *enterLoopTransition = new FactorialLoopTransition(&factorial); - enterLoopTransition->setTargetState(computing); - initialize->addTransition(enterLoopTransition); - - QObject::connect(&machine, SIGNAL(finished()), &app, SLOT(quit())); - - machine.setInitialState(initialize); - machine.start(); - - return app.exec(); -} - -#include "main.moc" diff --git a/lib/qtstatemachine/examples/helloworld/helloworld.pro b/lib/qtstatemachine/examples/helloworld/helloworld.pro deleted file mode 100644 index 9b941c0..0000000 --- a/lib/qtstatemachine/examples/helloworld/helloworld.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = app -TARGET = -QT = core -win32: CONFIG += console -mac:CONFIG -= app_bundle -DEPENDPATH += . -INCLUDEPATH += . - -# Input -SOURCES += main.cpp -include(../../src/qtstatemachine.pri) diff --git a/lib/qtstatemachine/examples/helloworld/main.cpp b/lib/qtstatemachine/examples/helloworld/main.cpp deleted file mode 100644 index 3765338..0000000 --- a/lib/qtstatemachine/examples/helloworld/main.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** This file is 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 -#ifdef QT_STATEMACHINE_SOLUTION -#include -#include -#include -#endif - -class S0 : public QtState -{ -public: - S0(QtState *parent = 0) - : QtState(parent) {} - - virtual void onEntry() - { - fprintf(stdout, "Hello world!\n"); - } -}; - -int main(int argc, char **argv) -{ - QCoreApplication app(argc, argv); - - QtStateMachine machine; - QtState *s0 = new S0(); - QtFinalState *s1 = new QtFinalState(); - s0->addTransition(s1); - - machine.addState(s0); - machine.addState(s1); - machine.setInitialState(s0); - - QObject::connect(&machine, SIGNAL(finished()), QCoreApplication::instance(), SLOT(quit())); - machine.start(); - - return app.exec(); -} diff --git a/lib/qtstatemachine/examples/mediaplayer/main.cpp b/lib/qtstatemachine/examples/mediaplayer/main.cpp deleted file mode 100644 index edac5f2..0000000 --- a/lib/qtstatemachine/examples/mediaplayer/main.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** This file is 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 "qscriptedstatemachine.h" -#include "spview.h" -#include "spmodel.h" -#include "spengine.h" -#include "spharvester.h" -#include "math.h" -#include "time.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -int main( int argc, char **argv) -{ - QApplication app(argc, argv); - QString dir; - bool recurse; - if (argc > 1) { - dir = QString(argv[1]); - if (argc > 2) - { - recurse = !strcmp(argv[2],"-recurse"); - } - } else { - printf("Usage: stateplayer directory [-recurse]"); - return 0; - } - - app.setApplicationName("SCXML-mediaplayer"); - - SPView* view = new SPView(NULL); - QtScriptedStateMachine *sm = QtScriptedStateMachine::load(":/mediaplayer.scxml"); - QObject::connect (sm, SIGNAL(finished()), &app, SLOT(quit())); - SPModel* model= new SPModel(NULL); - view->setModel(model); - model->setObjectName("model"); - SPEngine* engine = new SPEngine(sm); - engine->setObjectName("engine"); - SPHarvester* harvester = new SPHarvester (view); - QObject::connect (harvester, SIGNAL(foundTrack(SongData)), model, SLOT(addSong(SongData))); - harvester->harvest(dir,recurse); - view->setObjectName("view"); - sm->registerObject(model); - sm->registerObject(engine); - sm->registerObject(view,"",true); - view->show (); - sm->start (); - return app.exec (); -} diff --git a/lib/qtstatemachine/examples/mediaplayer/mediaplayer.pro b/lib/qtstatemachine/examples/mediaplayer/mediaplayer.pro deleted file mode 100644 index 355da25..0000000 --- a/lib/qtstatemachine/examples/mediaplayer/mediaplayer.pro +++ /dev/null @@ -1,23 +0,0 @@ -TEMPLATE = app -TARGET = scxmlplayer -QT += script \ - sql \ - phonon -include($$PWD/../../src/qtstatemachine.pri) - -HEADERS += spmodel.h \ - spengine.h \ - spview.h \ - spharvester.h \ - songdata.h -SOURCES += main.cpp \ - spmodel.cpp \ - spengine.cpp \ - spview.cpp \ - spharvester.cpp -FORMS += mediaplayer.ui -RESOURCES += mediaplayer.qrc -win32:CONFIG += console -mac:CONFIG -= app_bundle -INCLUDEPATH += . -DEPENDPATH += . diff --git a/lib/qtstatemachine/examples/mediaplayer/mediaplayer.qrc b/lib/qtstatemachine/examples/mediaplayer/mediaplayer.qrc deleted file mode 100644 index ff8226f..0000000 --- a/lib/qtstatemachine/examples/mediaplayer/mediaplayer.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - mediaplayer.scxml - - diff --git a/lib/qtstatemachine/examples/mediaplayer/mediaplayer.scxml b/lib/qtstatemachine/examples/mediaplayer/mediaplayer.scxml deleted file mode 100644 index 323d9c9..0000000 --- a/lib/qtstatemachine/examples/mediaplayer/mediaplayer.scxml +++ /dev/null @@ -1,240 +0,0 @@ - - - - - [[listView,'styleSheet','QListView {font-size:20px}']] - - - - - - [[stackedWidget,"currentIndex",0]] - - - - - - - { "parent" : listView, "windowTitle" : - "Music Player", "styleSheet" : "QMenu {font-size:24px; width: 505;height:1000;}" + - "QMenu::item:hover {background-color: blue;color: black;}", - "children": function() { var c = [ - {"type" : "action","id" : "artists", "text" : "Artists" }, - {"type" : "action", "id" : "albums", "text" : "Albums" }, - {"type" : "action", "id" : "genres", "text" : "Genres" }, - {"type" : "action", "id" : "allsongs", "text" : "All Songs" }]; - if (model.currentSongTitle != '') - c[c.length] = {type: "action", id: "curplaying", text: model.currentSongTitle}; - return c; }() - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [ - [selectButton,"enabled",false], - [playingLabel,"text",model.currentSongTitle], - [midLabel,"text",model.currentSongArtist], - [posSlider,"minimum",0], - [posSlider,"maximum",engine.totalTime], - [stackedWidget,"currentIndex",1] - ] - - - - - - - - - - - - - - - - - - - - - - - - - [[stopButton,"enabled",false]] - - - - - [[stopButton,"enabled",true]] - - - - - - - [[playButton,"text","Pause"]] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [[stopButton,"enabled",false], - [playButton,"enabled",false], - [prevButton,"enabled",false], - [nextButton,"enabled",false]] - - - - - - - - diff --git a/lib/qtstatemachine/examples/mediaplayer/mediaplayer.ui b/lib/qtstatemachine/examples/mediaplayer/mediaplayer.ui deleted file mode 100644 index dbbc6fd..0000000 --- a/lib/qtstatemachine/examples/mediaplayer/mediaplayer.ui +++ /dev/null @@ -1,145 +0,0 @@ - - - mediaPlayerWidget - - - - 0 - 0 - 394 - 287 - - - - SCXML Media Player - - - - - - 0 - - - - - - - - - - - - - 0 - 50 - 291 - 61 - - - - QLabel {font-size: 24px; color: #336699} - - - TextLabel - - - - - - 0 - 120 - 291 - 21 - - - - TextLabel - - - - - - 0 - 180 - 301 - 16 - - - - 0 - - - Qt::Horizontal - - - - - - - - - - - - Home - - - - - - - Play - - - - - - - Prev - - - - - - - Next - - - - - - - Stop - - - - - - - Qt::Vertical - - - - - - - Select - - - - - - - Back - - - - - - - - - - - - diff --git a/lib/qtstatemachine/examples/mediaplayer/songdata.h b/lib/qtstatemachine/examples/mediaplayer/songdata.h deleted file mode 100644 index ad321d1..0000000 --- a/lib/qtstatemachine/examples/mediaplayer/songdata.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef SONGDATA_H -#define SONGDATA_H - -#include - -struct SongData -{ - QString url; - QString title; - QString album; - QString artist; - QStringList genres; - int trackNumber; -}; -#endif diff --git a/lib/qtstatemachine/examples/mediaplayer/spengine.cpp b/lib/qtstatemachine/examples/mediaplayer/spengine.cpp deleted file mode 100644 index 092c5c9..0000000 --- a/lib/qtstatemachine/examples/mediaplayer/spengine.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/**************************************************************************** -** -** This file is 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 "spengine.h" -#include - -using namespace Phonon; - -class SPEnginePvt -{ - public: - MediaObject* mediaObject; - AudioOutput* audioOutput; -}; -void SPEngine::clearQueue() -{ - pvt->mediaObject->clearQueue(); -} - -int SPEngine::currentTime() const -{ - return pvt->mediaObject->currentTime (); -} -int SPEngine::totalTime() const -{ - return pvt->mediaObject->totalTime(); -} - -void SPEngine::enqueue (const QUrl & u) -{ - pvt->mediaObject->enqueue(MediaSource(u)); -} -void SPEngine::setTrack(const QUrl & u) -{ - pvt->mediaObject->setCurrentSource(MediaSource(u)); -} -void SPEngine::play() -{ - pvt->mediaObject->play (); -} - -void SPEngine::pause() -{ - pvt->mediaObject->pause (); -} - -void SPEngine::stop() -{ - pvt->mediaObject->stop(); -} - -void SPEngine::seek(qint64 pos) -{ - pvt->mediaObject->seek(pos); -} - -void SPEngine::setVolume(int v) -{ - pvt->audioOutput->setVolume((qreal)v/100); -} - -void SPEngine::onVolumeChanged(qreal r) -{ - emit volumeChanged(r*100); -} -int SPEngine::volume() const -{ - return pvt->audioOutput->volume()*100; -} - -SPEngine::SPEngine(QObject* p) : QObject(p) -{ - pvt = new SPEnginePvt; - pvt->mediaObject = new Phonon::MediaObject(this); - pvt->audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); - createPath (pvt->mediaObject, pvt->audioOutput); - pvt->mediaObject->setTickInterval(500); - connect (pvt->mediaObject, SIGNAL(aboutToFinish()), this, SIGNAL(aboutToFinish())); - connect (pvt->mediaObject, SIGNAL(tick(qint64)), this, SIGNAL(tick(qint64))); - connect (pvt->mediaObject, SIGNAL(totalTimeChanged(qint64)), this, SIGNAL(totalTimeChanged(qint64))); - connect (pvt->audioOutput, SIGNAL(volumeChanged(qreal)), this, SLOT(onVolumeChanged(qreal))); -} - -SPEngine::~SPEngine () -{ - delete pvt; -} diff --git a/lib/qtstatemachine/examples/mediaplayer/spengine.h b/lib/qtstatemachine/examples/mediaplayer/spengine.h deleted file mode 100644 index 40db83f..0000000 --- a/lib/qtstatemachine/examples/mediaplayer/spengine.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef SPENGINE_H -#define SPENGINE_H -#include -#include -class SPEngine : public QObject -{ - Q_OBJECT - Q_PROPERTY(int totalTime READ totalTime) - Q_PROPERTY(int currentTime READ currentTime) - Q_PROPERTY(int volume READ volume WRITE setVolume) - - Q_SIGNALS: - void aboutToFinish(); - void tick(qint64); - void totalTimeChanged(qint64); - void volumeChanged(int); - - public Q_SLOTS: - void clearQueue(); - void enqueue (const QUrl &); - void setTrack(const QUrl &); - void play(); - void pause(); - void seek(qint64); - void stop (); - - protected Q_SLOTS: - void onVolumeChanged(qreal); - - public: - SPEngine(QObject*); - virtual ~SPEngine (); - int currentTime () const; - int totalTime () const; - void setVolume(int); - int volume () const; - - private: - class SPEnginePvt* pvt; -}; -#endif diff --git a/lib/qtstatemachine/examples/mediaplayer/spharvester.cpp b/lib/qtstatemachine/examples/mediaplayer/spharvester.cpp deleted file mode 100644 index f52e5ef..0000000 --- a/lib/qtstatemachine/examples/mediaplayer/spharvester.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** This file is 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 "spharvester.h" -#include -#include -#include -#include -#include - -using namespace Phonon; - -struct SPHarvesterPvt -{ - MediaObject* mediaObject; - QQueue pathQueue; -}; - -SPHarvester::SPHarvester(QObject* o) : QObject(o) -{ - pvt = new SPHarvesterPvt; - pvt->mediaObject = new MediaObject(this); - connect (pvt->mediaObject, SIGNAL(metaDataChanged()), this, SLOT(readMetaData ())); -} - -SPHarvester::~SPHarvester() -{ - delete pvt; -} - -void SPHarvester::harvest (const QString & directory, bool recurse) -{ - QDir d (directory); - QFileInfoList l = d.entryInfoList(QStringList() << "*.mp3",recurse ? QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Files : QDir::Files); - foreach (QFileInfo fi, l) { - if (fi.isDir()) { - harvest (fi.absoluteFilePath(), recurse); - } else { - pvt->pathQueue.enqueue(fi.absoluteFilePath()); - } - } - harvestNext (); -} - -void SPHarvester::harvestNext () -{ - if (pvt->pathQueue.empty()) - emit done(); - else { - QString s = pvt->pathQueue.dequeue(); - pvt->mediaObject->setCurrentSource(MediaSource(s)); - } -} - -void SPHarvester::readMetaData () -{ - QStringList albums = pvt->mediaObject->metaData("ALBUM"); - QStringList titles = pvt->mediaObject->metaData("TITLE"); - QStringList artists = pvt->mediaObject->metaData("ARTIST"); - QStringList trackNums = pvt->mediaObject->metaData("TRACKNUMBER"); - SongData sd; - sd.url = pvt->mediaObject->currentSource().url().toString(); - sd.album = albums.count() ? albums[0] : "Unknown Album"; - sd.artist = artists.count() ? artists[0] : "Unknown Artist"; - sd.trackNumber = trackNums.count() ? trackNums[0].toInt() : 0; - sd.genres = pvt->mediaObject->metaData("GENRE"); - sd.title = titles.count() ? titles[0] : QFileInfo(sd.url).baseName(); - - emit foundTrack(sd); - harvestNext (); -} diff --git a/lib/qtstatemachine/examples/mediaplayer/spharvester.h b/lib/qtstatemachine/examples/mediaplayer/spharvester.h deleted file mode 100644 index a75d535..0000000 --- a/lib/qtstatemachine/examples/mediaplayer/spharvester.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef SPHARVESTER_H -#define SPHARVESTER_H - -#include "songdata.h" -class SPHarvester : public QObject -{ - Q_OBJECT -public: - SPHarvester(QObject* o = NULL); - virtual ~SPHarvester (); -public slots: - void harvest (const QString & directory, bool recurse = true); - -private slots: - void harvestNext (); - void readMetaData(); -signals: - void foundTrack (const SongData & d); - void done (); - -private: - class SPHarvesterPvt* pvt; -}; - -#endif // _H diff --git a/lib/qtstatemachine/examples/mediaplayer/spmodel.cpp b/lib/qtstatemachine/examples/mediaplayer/spmodel.cpp deleted file mode 100644 index bdfd5ec..0000000 --- a/lib/qtstatemachine/examples/mediaplayer/spmodel.cpp +++ /dev/null @@ -1,320 +0,0 @@ -/**************************************************************************** -** -** This file is 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 "spmodel.h" -#include -#include -#include -#include -// an SQL query model that always as column (0) as uid and column (1) as display -class SPSqlQueryModel : public QSqlQueryModel -{ - Q_OBJECT - public: - SPSqlQueryModel (QObject* o = NULL): QSqlQueryModel (o) {} - virtual QVariant data(const QModelIndex & index, int role) const - { - QModelIndex idx(index); - if (role == Qt::DisplayRole && query().record().count() > 1) { - idx = idx.sibling(idx.row(),1); - } else if (role == Qt::UserRole) - role = Qt::DisplayRole; - return QSqlQueryModel::data(idx,role); - } -}; - - -class SPModelPvt -{ - public: - SPSqlQueryModel - artistModel, - albumModel, - songModel, - playlistModel, genreModel; - - QSqlQuery artistQuery, albumQuery, songQuery, playlistQuery, genreQuery, playingQuery; - -}; - -SPModel::SPModel(QObject* o) - :QObject(o) -{ - QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); - db.setDatabaseName("sqlite.db"); - if (!db.open()) { - QMessageBox::critical(0, qApp->tr("Cannot open database"), - qApp->tr("Unable to establish a database connection.\n" - "This example needs SQLite support. Please read " - "the Qt SQL driver documentation for information how " - "to build it.\n\n" - "Click Cancel to exit."), QMessageBox::Cancel); - } - - db.exec("CREATE TABLE IF NOT EXISTS songs (song_url VARCHAR(1024) PRIMARY KEY, song_title VARCHAR(1024), song_artist VARCHAR(1024), song_album VARCHAR(1024), song_track_index SMALLINT)"); - db.exec("DROP TABLE genres"); - db.exec("CREATE TABLE IF NOT EXISTS genres (genre_title VARCHAR(64), genre_song_url VARCHAR(1024))"); -// db.exec("CREATE TABLE IF NOT EXISTS playlists (playlist_id VARACHAR(256) PRIMARY KEY, playlist_title VARCHAR(1024))"); -// db.exec("CREATE TABLE IF NOT EXISTS playlist_songs (playlist_song_id BIGINT PRIMARY KEY, playlist_song_playlist - - pvt = new SPModelPvt; - pvt->artistQuery = QSqlQuery("SELECT DISTINCT song_artist FROM songs"); - pvt->albumQuery = QSqlQuery("SELECT DISTINCT song_album FROM songs"); - pvt->playlistQuery = QSqlQuery("SELECT playlist_url, playlist_title FROM playlists"); - pvt->songQuery = QSqlQuery("SELECT song_url, song_title from songs"); - pvt->genreQuery = QSqlQuery("SELECT DISTINCT genre_title from genres"); - QSqlQuery q; -// q.exec("SELECT DISTINCT song_url,song_title FROM songs, genres WHERE genre_song_url=song_url AND genre_title='All'"); - q.exec("SELECT * from genres"); - while (q.next()) { - qDebug () << q.value(0); - } -} - -void SPModel::addSong ( const SongData & data) -{ - - QSqlQuery q; - q.prepare("SELECT count(*) FROM songs WHERE song_url=:url"); - q.bindValue(":url",data.url); - bool inserting = true; - if (q.exec()) { - q.next(); - inserting = q.value(0).toInt() == 0; - } - if (inserting) { - q.prepare ("INSERT INTO songs (song_url, song_title, song_artist, song_album, song_track_index) VALUES (:url, :title, :artist, :album, :track)"); - } else { - q.prepare("UPDATE songs SET song_title=:title, song_album=:album, song_track_index=:track WHERE song_url=:url "); - } - q.bindValue(":url",data.url); - q.bindValue(":title",data.title); - q.bindValue(":artist",data.artist); - q.bindValue(":album",data.album); - q.bindValue(":track",data.trackNumber); - q.exec(); - - q.prepare ("DELETE FROM genres WHERE genre_song_url=:url"); - q.bindValue(":url",data.url); - q.exec(); - - q.prepare ("INSERT INTO genres (genre_song_url, genre_title) VALUES(:url, :genre)"); - q.bindValue(":url",data.url); - QStringList gn = data.genres; - gn << "All"; - foreach (QString g, gn) { - q.bindValue(":genre",g); - q.exec (); - } - - if (inserting) { - emit albumChanged(data.album); - emit songListChanged(); - emit artistChanged(data.artist); - foreach (QString g, data.genres) { - emit genreChanged(g); - } - } - - -} - - -SPModel::~SPModel() -{ - delete pvt; -} - -int SPModel::albumCount() const -{ - return pvt->albumModel.rowCount(); -} - -void SPModel::clearAlbumFilter () -{ - pvt->albumQuery = QSqlQuery ("SELECT DISTINCT song_album FROM songs "); -} -void SPModel::clearSongFilter () -{ - pvt->songQuery = QSqlQuery ("SELECT song_url, song_title FROM songs"); -} -void SPModel::loadArtists () -{ - pvt->artistQuery.exec (); - pvt->artistModel.setQuery(pvt->artistQuery); -} -void SPModel::filterAlbumsByArtist(const QString & artist) -{ - pvt->albumQuery.prepare("SELECT DISTINCT song_album FROM songs WHERE song_artist=:artist"); - pvt->albumQuery.bindValue(":artist",artist); -} -void SPModel::filterSongsByAlbum(const QString & album) -{ - pvt->albumQuery.prepare("SELECT song_url,song_title, song_track_index FROM songs WHERE song_album=:album ORDER BY song_track_index"); - pvt->albumQuery.bindValue(":album",album); -} -void SPModel::loadGenres () -{ - pvt->genreQuery.exec(); - pvt->genreModel.setQuery(pvt->genreQuery); -} - -void SPModel::filterSongsByGenre(const QString & genre) -{ - pvt->songQuery.prepare ("SELECT DISTINCT song_url,song_title FROM songs, genres WHERE genre_song_url=song_url AND genre_title=:genre"); - pvt->songQuery.bindValue(":genre",genre); -} -void SPModel::loadPlaylists() -{ - pvt->playlistQuery.exec (); - pvt->playlistModel.setQuery(pvt->playlistQuery); -} -void SPModel::loadAlbums() -{ - pvt->albumQuery.exec (); - pvt->albumModel.setQuery(pvt->albumQuery); -} -void SPModel::filterSongsByPlaylist(const QString & uid) -{ - pvt->songQuery.prepare("SELECT DISTINCT song_url, song_title, playlist_song_index FROM playlist_songs INNER JOIN songs ON playlist_song_url=song_url WHERE playlist_id=:playlist ORDER BY playlist_song_index"); - pvt->songQuery.bindValue(":playlist",uid); -} -void SPModel::loadSongs () -{ - pvt->songQuery.exec (); - pvt->songModel.setQuery(pvt->songQuery); -} -QUrl SPModel::currentSong() -{ - if (pvt->playingQuery.isValid()) - return QUrl(pvt->playingQuery.value(0).toString()); - else - return QUrl(); -} -QString SPModel::currentSongTitle() -{ - if (pvt->playingQuery.isValid()) - return pvt->playingQuery.value(1).toString(); - else - return QString(); -} -QString SPModel::currentSongArtist() -{ - QSqlQuery q; - q.prepare("SELECT song_artist FROM songs WHERE song_url=:url"); - q.bindValue(":url",currentSong().toString()); - q.exec(); - q.next(); - return q.value(0).toString(); -} -QString SPModel::currentSongAlbum() -{ - QSqlQuery q; - q.prepare("SELECT song_album FROM songs WHERE song_url=:url"); - q.bindValue(":url",currentSong().toString()); - q.exec(); - q.next(); - return q.value(0).toString(); -} - -void SPModel::selectSong (const QString & s) -{ - pvt->playingQuery = QSqlQuery(pvt->songQuery.executedQuery ()); - - while (pvt->playingQuery.next()) { - if (pvt->playingQuery.value(0).toString() == s) { - emit songChanged (); - return; - } - } - emit endOfList (); -} - -void SPModel::reset () -{ - pvt->playingQuery = QSqlQuery(pvt->songQuery.executedQuery ()); - pvt->playingQuery.exec(); -} - -void SPModel::gotoNext() -{ - if (pvt->playingQuery.next()) { - emit songChanged (); - }else - emit endOfList (); -} -void SPModel::gotoPrev() -{ - if (pvt->playingQuery.previous()) - emit songChanged (); - else - emit endOfList (); -} - - - -QAbstractItemModel* SPModel::albumsItemModel() const -{ - return &pvt->albumModel; -} -QAbstractItemModel* SPModel::genresItemModel() const -{ - return &pvt->genreModel; -} -QAbstractItemModel* SPModel::songsItemModel() const -{ - return &pvt->songModel; -} -QAbstractItemModel* SPModel::playlistsItemModel() const -{ - return &pvt->playlistModel; -} -QAbstractItemModel* SPModel::artistsItemModel() const -{ - return &pvt->artistModel; -} - -#include diff --git a/lib/qtstatemachine/examples/mediaplayer/spmodel.h b/lib/qtstatemachine/examples/mediaplayer/spmodel.h deleted file mode 100644 index 83035b1..0000000 --- a/lib/qtstatemachine/examples/mediaplayer/spmodel.h +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef SPMODEL_H -#define SPMODEL_H -#include -#include -#include -#include "songdata.h" - -class SPModel : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QUrl currentSong READ currentSong) - Q_PROPERTY(QString currentSongTitle READ currentSongTitle) - Q_PROPERTY(QString currentSongArtist READ currentSongArtist) - Q_PROPERTY(QString currentSongAlbum READ currentSongAlbum) - Q_PROPERTY(int albumCount READ albumCount) - - - public slots: - void clearAlbumFilter (); - void clearSongFilter (); - void loadArtists (); - void filterAlbumsByArtist(const QString & name); - void loadGenres (); - void filterSongsByGenre(const QString & genre); - void loadPlaylists(); - void loadAlbums(); - void filterSongsByPlaylist(const QString & uid); - void filterSongsByAlbum(const QString & name); - void loadSongs (); - void selectSong (const QString &); - void gotoNext(); - void gotoPrev(); - void addSong (const SongData &); - void reset (); - - signals: - void albumChanged(const QString &); - void artistChanged(const QString &); - void genreChanged(const QString &); - void songListChanged(); - void songChanged (); - void endOfList (); - - public: - SPModel(QObject*); - virtual ~SPModel (); - - QUrl currentSong(); - QString currentSongTitle (); - QString currentSongArtist(); - QString currentSongAlbum(); - QAbstractItemModel* albumsItemModel() const; - QAbstractItemModel* genresItemModel() const; - QAbstractItemModel* songsItemModel() const; - QAbstractItemModel* playlistsItemModel() const; - QAbstractItemModel* artistsItemModel() const; - int albumCount() const; - - private: - class SPModelPvt* pvt; -}; - -#endif diff --git a/lib/qtstatemachine/examples/mediaplayer/spview.cpp b/lib/qtstatemachine/examples/mediaplayer/spview.cpp deleted file mode 100644 index 415d31d..0000000 --- a/lib/qtstatemachine/examples/mediaplayer/spview.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************** -** -** This file is 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 "spview.h" -#include "spmodel.h" -#include -#include - -class SPViewPvt -{ - public: - SPModel* model; -}; - - -class SPItemDelegate : public QItemDelegate -{ - Q_OBJECT - -public: - SPItemDelegate(QObject* o) : QItemDelegate(o) {} - - virtual void paint (QPainter* p, QStyleOptionViewItem & option, const QModelIndex & index) const - { - QString disp = index.data(Qt::DisplayRole).toString(); - drawBackground(p,option,index); - drawDisplay(p,option,option.rect,disp); - } -}; - -void SPView::setModel (SPModel* m) -{ - pvt->model = m; -} - -void SPView::showAlbums () -{ - listView->setModel (pvt->model->albumsItemModel()); -} - -void SPView::showArtists () -{ - listView->setModel (pvt->model->artistsItemModel()); -} - -void SPView::showGenres () -{ - QAbstractItemModel* model = pvt->model->genresItemModel(); - listView->setModel (model); -} - -void SPView::showSongs () -{ - listView->setModel (pvt->model->songsItemModel()); -} - -void SPView::showPlaylists() -{ - listView->setModel (pvt->model->playlistsItemModel()); -} - - -SPView::SPView(QWidget* w) : QWidget (w) -{ - pvt = new SPViewPvt; - setupUi(this); - listView->setItemDelegate(new SPItemDelegate(this)); -} - -QString SPView::currentItem() const -{ - QVariant v = listView->model()->data(listView->currentIndex(),Qt::UserRole); - if (v.isNull()) - v = listView->currentIndex().data(Qt::DisplayRole); - return v.toString (); -} - -int SPView::itemCount () const -{ - return listView->model()->rowCount (); -} -int SPView::currentIndex() const -{ - return listView->currentIndex().row(); -} - -void SPView::setTotalTime (int t) -{ - posSlider->setMaximum(t); -} -void SPView::setCurrentTime (int t) -{ - posSlider->setValue (t); -} - -SPView::~SPView () -{ - delete pvt; -} -#include "spview.moc" diff --git a/lib/qtstatemachine/examples/mediaplayer/spview.h b/lib/qtstatemachine/examples/mediaplayer/spview.h deleted file mode 100644 index 53bc298..0000000 --- a/lib/qtstatemachine/examples/mediaplayer/spview.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef SPVIEW_H -#define SPVIEW_H -#include -#include -#include "spmodel.h" -#include "ui_mediaplayer.h" - -class SPView : public QWidget, public virtual Ui::mediaPlayerWidget -{ - Q_OBJECT - Q_PROPERTY(QString currentItem READ currentItem) - Q_PROPERTY(int itemCount READ itemCount) - Q_PROPERTY(int currentIndex READ currentIndex) - public slots: - void setModel (SPModel*); - void showAlbums (); - void showArtists (); - void showGenres (); - void showSongs (); - void showPlaylists(); - void setTotalTime (int); - void setCurrentTime (int); - - - public: - SPView(QWidget*); - virtual ~SPView (); - QString currentItem () const; - int itemCount () const; - int currentIndex() const; - - private: - class SPViewPvt* pvt; -}; - -#endif diff --git a/lib/qtstatemachine/examples/pauseandresume/main.cpp b/lib/qtstatemachine/examples/pauseandresume/main.cpp deleted file mode 100644 index f75a93c..0000000 --- a/lib/qtstatemachine/examples/pauseandresume/main.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** This file is 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 -#ifdef QT_STATEMACHINE_SOLUTION -#include -#include -#include -#include -#endif - -class Window : public QWidget -{ -public: - Window(QWidget *parent = 0) - : QWidget(parent) - { - QPushButton *pb = new QPushButton("Go"); - QPushButton *pauseButton = new QPushButton("Pause"); - QPushButton *quitButton = new QPushButton("Quit"); - QVBoxLayout *vbox = new QVBoxLayout(this); - vbox->addWidget(pb); - vbox->addWidget(pauseButton); - vbox->addWidget(quitButton); - - QtStateMachine *machine = new QtStateMachine(this); - - QtState *process = new QtState(machine->rootState()); - process->setObjectName("process"); - - QtState *s1 = new QtState(process); - s1->setObjectName("s1"); - QtState *s2 = new QtState(process); - s2->setObjectName("s2"); - s1->addTransition(pb, SIGNAL(clicked()), s2); - s2->addTransition(pb, SIGNAL(clicked()), s1); - - QtHistoryState *h = process->addHistoryState(); - h->setDefaultState(s1); - - QtState *interrupted = new QtState(machine->rootState()); - interrupted->setObjectName("interrupted"); - QtFinalState *terminated = new QtFinalState(machine->rootState()); - terminated->setObjectName("terminated"); - interrupted->addTransition(pauseButton, SIGNAL(clicked()), h); - interrupted->addTransition(quitButton, SIGNAL(clicked()), terminated); - - process->addTransition(pauseButton, SIGNAL(clicked()), interrupted); - process->addTransition(quitButton, SIGNAL(clicked()), terminated); - - process->setInitialState(s1); - machine->setInitialState(process); - QObject::connect(machine, SIGNAL(finished()), QApplication::instance(), SLOT(quit())); - machine->start(); - } -}; - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - Window win; - win.show(); - return app.exec(); -} diff --git a/lib/qtstatemachine/examples/pauseandresume/pauseandresume.pro b/lib/qtstatemachine/examples/pauseandresume/pauseandresume.pro deleted file mode 100644 index c5d5a5f..0000000 --- a/lib/qtstatemachine/examples/pauseandresume/pauseandresume.pro +++ /dev/null @@ -1,8 +0,0 @@ -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . - -# Input -SOURCES += main.cpp -include(../../src/qtstatemachine.pri) diff --git a/lib/qtstatemachine/examples/pingpong/main.cpp b/lib/qtstatemachine/examples/pingpong/main.cpp deleted file mode 100644 index 82cd172..0000000 --- a/lib/qtstatemachine/examples/pingpong/main.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************************** -** -** This file is 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 -#ifdef QT_STATEMACHINE_SOLUTION -#include -#include -#include -#endif - -class PingEvent : public QEvent -{ -public: - PingEvent() : QEvent(QEvent::Type(QEvent::User+2)) - {} -}; - -class PongEvent : public QEvent -{ -public: - PongEvent() : QEvent(QEvent::Type(QEvent::User+3)) - {} -}; - -class Pinger : public QtState -{ -public: - Pinger(QtStateMachine *machine, QtState *parent) - : QtState(parent), m_machine(machine) {} - -protected: - virtual void onEntry() - { - m_machine->postEvent(new PingEvent()); - fprintf(stdout, "ping?\n"); - } - -private: - QtStateMachine *m_machine; -}; - -class PongTransition : public QtAbstractTransition -{ -public: - PongTransition(QtStateMachine *machine) - : QtAbstractTransition(), m_machine(machine) {} - -protected: - virtual bool eventTest(QEvent *e) const { - return (e->type() == QEvent::User+3); - } - virtual void onTransition() - { - m_machine->postEvent(new PingEvent(), 500); - fprintf(stdout, "ping?\n"); - } - -private: - QtStateMachine *m_machine; -}; - -class PingTransition : public QtAbstractTransition -{ -public: - PingTransition(QtStateMachine *machine) - : QtAbstractTransition(), m_machine(machine) {} - -protected: - virtual bool eventTest(QEvent *e) const { - return (e->type() == QEvent::User+2); - } - virtual void onTransition() - { - m_machine->postEvent(new PongEvent(), 500); - fprintf(stdout, "pong!\n"); - } - -private: - QtStateMachine *m_machine; -}; - -int main(int argc, char **argv) -{ - QCoreApplication app(argc, argv); - - QtStateMachine machine; - QtState *group = new QtState(QtState::ParallelGroup); - group->setObjectName("group"); - - Pinger *pinger = new Pinger(&machine, group); - pinger->setObjectName("pinger"); - pinger->addTransition(new PongTransition(&machine)); - - QtState *ponger = new QtState(group); - ponger->setObjectName("ponger"); - ponger->addTransition(new PingTransition(&machine)); - - machine.addState(group); - machine.setInitialState(group); - machine.start(); - - return app.exec(); -} diff --git a/lib/qtstatemachine/examples/pingpong/pingpong.pro b/lib/qtstatemachine/examples/pingpong/pingpong.pro deleted file mode 100644 index 6d5f8aa..0000000 --- a/lib/qtstatemachine/examples/pingpong/pingpong.pro +++ /dev/null @@ -1,11 +0,0 @@ -QT = core -TEMPLATE = app -TARGET = -win32: CONFIG += console -mac:CONFIG -= app_bundle -DEPENDPATH += . -INCLUDEPATH += . - -# Input -SOURCES += main.cpp -include(../../src/qtstatemachine.pri) diff --git a/lib/qtstatemachine/examples/trafficlight/main.cpp b/lib/qtstatemachine/examples/trafficlight/main.cpp deleted file mode 100644 index 7749854..0000000 --- a/lib/qtstatemachine/examples/trafficlight/main.cpp +++ /dev/null @@ -1,197 +0,0 @@ -/**************************************************************************** -** -** This file is 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 -#ifdef QT_STATEMACHINE_SOLUTION -#include -#include -#include -#endif - -//! [0] -class LightWidget : public QWidget -{ - Q_OBJECT - Q_PROPERTY(bool on READ isOn WRITE setOn) -public: - LightWidget(const QColor &color, QWidget *parent = 0) - : QWidget(parent), m_color(color), m_on(false) {} - - bool isOn() const - { return m_on; } - void setOn(bool on) - { - if (on == m_on) - return; - m_on = on; - update(); - } - -public slots: - void turnOff() { setOn(false); } - void turnOn() { setOn(true); } - -protected: - virtual void paintEvent(QPaintEvent *) - { - if (!m_on) - return; - QPainter painter(this); - painter.setRenderHint(QPainter::Antialiasing); - painter.setBrush(m_color); - painter.drawEllipse(0, 0, width(), height()); - } - -private: - QColor m_color; - bool m_on; -}; -//! [0] - -//! [1] -class LightState : public QtState -{ -public: - LightState(LightWidget *light, int duration, QtState *parent = 0) - : QtState(parent) - { - QTimer *timer = new QTimer(this); - timer->setInterval(duration); - timer->setSingleShot(true); - QtState *timing = new QtState(this); - timing->invokeMethodOnEntry(light, "turnOn"); - timing->invokeMethodOnEntry(timer, "start"); - timing->invokeMethodOnExit(light, "turnOff"); - QtFinalState *done = new QtFinalState(this); - timing->addTransition(timer, SIGNAL(timeout()), done); - setInitialState(timing); - } -}; -//! [1] - -//! [2] -class TrafficLightWidget : public QWidget -{ -public: - TrafficLightWidget(QWidget *parent = 0) - : QWidget(parent) - { - QVBoxLayout *vbox = new QVBoxLayout(this); - m_red = new LightWidget(Qt::red); - vbox->addWidget(m_red); - m_yellow = new LightWidget(Qt::yellow); - vbox->addWidget(m_yellow); - m_green = new LightWidget(Qt::green); - vbox->addWidget(m_green); - QPalette pal = palette(); - pal.setColor(QPalette::Background, Qt::black); - setPalette(pal); - setAutoFillBackground(true); - } - - LightWidget *redLight() const - { return m_red; } - LightWidget *yellowLight() const - { return m_yellow; } - LightWidget *greenLight() const - { return m_green; } - -private: - LightWidget *m_red; - LightWidget *m_yellow; - LightWidget *m_green; -}; -//! [2] - -//! [3] -class TrafficLight : public QWidget -{ -public: - TrafficLight(QWidget *parent = 0) - : QWidget(parent) - { - QVBoxLayout *vbox = new QVBoxLayout(this); - TrafficLightWidget *widget = new TrafficLightWidget(); - vbox->addWidget(widget); - - QtStateMachine *machine = new QtStateMachine(this); - LightState *redGoingYellow = new LightState(widget->redLight(), 3000); - redGoingYellow->setObjectName("redGoingYellow"); - LightState *yellowGoingGreen = new LightState(widget->yellowLight(), 1000); - yellowGoingGreen->setObjectName("yellowGoingGreen"); - redGoingYellow->addFinishedTransition(yellowGoingGreen); - LightState *greenGoingYellow = new LightState(widget->greenLight(), 3000); - greenGoingYellow->setObjectName("greenGoingYellow"); - yellowGoingGreen->addFinishedTransition(greenGoingYellow); - LightState *yellowGoingRed = new LightState(widget->yellowLight(), 1000); - yellowGoingRed->setObjectName("yellowGoingRed"); - greenGoingYellow->addFinishedTransition(yellowGoingRed); - yellowGoingRed->addFinishedTransition(redGoingYellow); - - machine->addState(redGoingYellow); - machine->addState(yellowGoingGreen); - machine->addState(greenGoingYellow); - machine->addState(yellowGoingRed); - machine->setInitialState(redGoingYellow); - machine->start(); - } -}; -//! [3] - -//! [4] -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - - TrafficLight widget; - widget.resize(120, 300); - widget.show(); - - return app.exec(); -} -//! [4] - -#include "main.moc" diff --git a/lib/qtstatemachine/examples/trafficlight/trafficlight.pro b/lib/qtstatemachine/examples/trafficlight/trafficlight.pro deleted file mode 100644 index a60bd22..0000000 --- a/lib/qtstatemachine/examples/trafficlight/trafficlight.pro +++ /dev/null @@ -1,13 +0,0 @@ -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . - -SOURCES += main.cpp - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/trafficlight -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS trafficlight.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/statemachine/trafficlight -INSTALLS += target sources -include(../../src/qtstatemachine.pri) diff --git a/lib/qtstatemachine/examples/twowaybutton/main.cpp b/lib/qtstatemachine/examples/twowaybutton/main.cpp deleted file mode 100644 index 23f19c3..0000000 --- a/lib/qtstatemachine/examples/twowaybutton/main.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** This file is 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 -#ifdef QT_STATEMACHINE_SOLUTION -#include -#include -#endif - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - - QPushButton button; - - QtStateMachine machine; - QtState *first = new QtState(); - first->setObjectName("first"); - - QtState *off = new QtState(); - off->assignProperty(&button, "text", "Off"); - off->setObjectName("off"); - first->addTransition(off); - - QtState *on = new QtState(); - on->setObjectName("on"); - on->assignProperty(&button, "text", "On"); - off->addTransition(&button, SIGNAL(clicked()), on); - on->addTransition(&button, SIGNAL(clicked()), off); - - machine.addState(first); - machine.addState(off); - machine.addState(on); - machine.setInitialState(first); - machine.start(); - - button.resize(100, 50); - button.show(); - return app.exec(); -} diff --git a/lib/qtstatemachine/examples/twowaybutton/twowaybutton.pro b/lib/qtstatemachine/examples/twowaybutton/twowaybutton.pro deleted file mode 100644 index c5d5a5f..0000000 --- a/lib/qtstatemachine/examples/twowaybutton/twowaybutton.pro +++ /dev/null @@ -1,8 +0,0 @@ -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . - -# Input -SOURCES += main.cpp -include(../../src/qtstatemachine.pri) diff --git a/lib/qtstatemachine/lib/QtSolutions_StateMachineFramework-1.1.lib b/lib/qtstatemachine/lib/QtSolutions_StateMachineFramework-1.1.lib deleted file mode 100644 index a0d744e..0000000 Binary files a/lib/qtstatemachine/lib/QtSolutions_StateMachineFramework-1.1.lib and /dev/null differ diff --git a/lib/qtstatemachine/lib/QtSolutions_StateMachineFramework-1.1d.lib b/lib/qtstatemachine/lib/QtSolutions_StateMachineFramework-1.1d.lib deleted file mode 100644 index 670cb75..0000000 Binary files a/lib/qtstatemachine/lib/QtSolutions_StateMachineFramework-1.1d.lib and /dev/null differ diff --git a/lib/qtstatemachine/qtstatemachine.pro b/lib/qtstatemachine/qtstatemachine.pro deleted file mode 100644 index c16c339..0000000 --- a/lib/qtstatemachine/qtstatemachine.pro +++ /dev/null @@ -1,5 +0,0 @@ -TEMPLATE=subdirs -CONFIG += ordered -include(common.pri) -qtstatemachine-uselib: SUBDIRS=buildlib -SUBDIRS+=examples \ No newline at end of file diff --git a/lib/qtstatemachine/src/QtAbstractState b/lib/qtstatemachine/src/QtAbstractState deleted file mode 100644 index 547fdec..0000000 --- a/lib/qtstatemachine/src/QtAbstractState +++ /dev/null @@ -1 +0,0 @@ -#include "qabstractstate.h" diff --git a/lib/qtstatemachine/src/QtAbstractTransition b/lib/qtstatemachine/src/QtAbstractTransition deleted file mode 100644 index 63635d6..0000000 --- a/lib/qtstatemachine/src/QtAbstractTransition +++ /dev/null @@ -1 +0,0 @@ -#include "qabstracttransition.h" diff --git a/lib/qtstatemachine/src/QtActionState b/lib/qtstatemachine/src/QtActionState deleted file mode 100644 index 7d97612..0000000 --- a/lib/qtstatemachine/src/QtActionState +++ /dev/null @@ -1 +0,0 @@ -#include "qactionstate.h" diff --git a/lib/qtstatemachine/src/QtEventTransition b/lib/qtstatemachine/src/QtEventTransition deleted file mode 100644 index df9701d..0000000 --- a/lib/qtstatemachine/src/QtEventTransition +++ /dev/null @@ -1 +0,0 @@ -#include "qeventtransition.h" diff --git a/lib/qtstatemachine/src/QtFinalState b/lib/qtstatemachine/src/QtFinalState deleted file mode 100644 index ed5cae2..0000000 --- a/lib/qtstatemachine/src/QtFinalState +++ /dev/null @@ -1 +0,0 @@ -#include "qfinalstate.h" diff --git a/lib/qtstatemachine/src/QtHistoryState b/lib/qtstatemachine/src/QtHistoryState deleted file mode 100644 index a8b4d85..0000000 --- a/lib/qtstatemachine/src/QtHistoryState +++ /dev/null @@ -1 +0,0 @@ -#include "qhistorystate.h" diff --git a/lib/qtstatemachine/src/QtScriptedEvent b/lib/qtstatemachine/src/QtScriptedEvent deleted file mode 100644 index 499c608..0000000 --- a/lib/qtstatemachine/src/QtScriptedEvent +++ /dev/null @@ -1 +0,0 @@ -#include "qscriptedstatemachine.h" diff --git a/lib/qtstatemachine/src/QtScriptedStateMachine b/lib/qtstatemachine/src/QtScriptedStateMachine deleted file mode 100644 index 499c608..0000000 --- a/lib/qtstatemachine/src/QtScriptedStateMachine +++ /dev/null @@ -1 +0,0 @@ -#include "qscriptedstatemachine.h" diff --git a/lib/qtstatemachine/src/QtScriptedTransition b/lib/qtstatemachine/src/QtScriptedTransition deleted file mode 100644 index 499c608..0000000 --- a/lib/qtstatemachine/src/QtScriptedTransition +++ /dev/null @@ -1 +0,0 @@ -#include "qscriptedstatemachine.h" diff --git a/lib/qtstatemachine/src/QtSignalEvent b/lib/qtstatemachine/src/QtSignalEvent deleted file mode 100644 index c6a13c3..0000000 --- a/lib/qtstatemachine/src/QtSignalEvent +++ /dev/null @@ -1 +0,0 @@ -#include "qsignalevent.h" diff --git a/lib/qtstatemachine/src/QtSignalTransition b/lib/qtstatemachine/src/QtSignalTransition deleted file mode 100644 index 314d6a2..0000000 --- a/lib/qtstatemachine/src/QtSignalTransition +++ /dev/null @@ -1 +0,0 @@ -#include "qsignaltransition.h" diff --git a/lib/qtstatemachine/src/QtSsmAutoInvokerFactory b/lib/qtstatemachine/src/QtSsmAutoInvokerFactory deleted file mode 100644 index 499c608..0000000 --- a/lib/qtstatemachine/src/QtSsmAutoInvokerFactory +++ /dev/null @@ -1 +0,0 @@ -#include "qscriptedstatemachine.h" diff --git a/lib/qtstatemachine/src/QtSsmInvoker b/lib/qtstatemachine/src/QtSsmInvoker deleted file mode 100644 index 499c608..0000000 --- a/lib/qtstatemachine/src/QtSsmInvoker +++ /dev/null @@ -1 +0,0 @@ -#include "qscriptedstatemachine.h" diff --git a/lib/qtstatemachine/src/QtState b/lib/qtstatemachine/src/QtState deleted file mode 100644 index 79e85e6..0000000 --- a/lib/qtstatemachine/src/QtState +++ /dev/null @@ -1 +0,0 @@ -#include "qstate.h" diff --git a/lib/qtstatemachine/src/QtStateAction b/lib/qtstatemachine/src/QtStateAction deleted file mode 100644 index 1236ac4..0000000 --- a/lib/qtstatemachine/src/QtStateAction +++ /dev/null @@ -1 +0,0 @@ -#include "qstateaction.h" diff --git a/lib/qtstatemachine/src/QtStateFinishedEvent b/lib/qtstatemachine/src/QtStateFinishedEvent deleted file mode 100644 index 8e0e154..0000000 --- a/lib/qtstatemachine/src/QtStateFinishedEvent +++ /dev/null @@ -1 +0,0 @@ -#include "qstatefinishedevent.h" diff --git a/lib/qtstatemachine/src/QtStateFinishedTransition b/lib/qtstatemachine/src/QtStateFinishedTransition deleted file mode 100644 index 734b842..0000000 --- a/lib/qtstatemachine/src/QtStateFinishedTransition +++ /dev/null @@ -1 +0,0 @@ -#include "qstatefinishedtransition.h" diff --git a/lib/qtstatemachine/src/QtStateInvokeMethodAction b/lib/qtstatemachine/src/QtStateInvokeMethodAction deleted file mode 100644 index 1236ac4..0000000 --- a/lib/qtstatemachine/src/QtStateInvokeMethodAction +++ /dev/null @@ -1 +0,0 @@ -#include "qstateaction.h" diff --git a/lib/qtstatemachine/src/QtStateMachine b/lib/qtstatemachine/src/QtStateMachine deleted file mode 100644 index e749184..0000000 --- a/lib/qtstatemachine/src/QtStateMachine +++ /dev/null @@ -1 +0,0 @@ -#include "qstatemachine.h" diff --git a/lib/qtstatemachine/src/QtTransition b/lib/qtstatemachine/src/QtTransition deleted file mode 100644 index aae48c9..0000000 --- a/lib/qtstatemachine/src/QtTransition +++ /dev/null @@ -1 +0,0 @@ -#include "qtransition.h" diff --git a/lib/qtstatemachine/src/qabstractstate.cpp b/lib/qtstatemachine/src/qabstractstate.cpp deleted file mode 100644 index 6e9ec8a..0000000 --- a/lib/qtstatemachine/src/qabstractstate.cpp +++ /dev/null @@ -1,271 +0,0 @@ -/**************************************************************************** -** -** This file is 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 "qabstractstate.h" -#include "qabstractstate_p.h" -#include "qstatemachine.h" -#include "qstatemachine_p.h" -#include "qstate.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QtAbstractState - - \brief The QtAbstractState class is the base class of states of a QtStateMachine. - - \since 4.6 - \ingroup statemachine - - The QtAbstractState class is the abstract base class of states that are part - of a QtStateMachine. It defines the interface that all state objects have in - common. QtAbstractState is part of \l{The State Machine Framework}. - - The assignProperty() function is used for defining property assignments that - should be performed when a state is entered. - - The parentState() function returns the state's parent state. - - \section1 Subclassing - - The onEntry() function is called when the state is entered; reimplement this - function to perform custom processing when the state is entered. - - The onExit() function is called when the state is exited; reimplement this - function to perform custom processing when the state is exited. -*/ - -/*! - \enum QtAbstractState::RestorePolicy - - This enum specifies the restore policy type for a state. The restore policy - takes effect when the machine enters a state which sets one or more - properties. If the restore policy of the state is set to RestoreProperties, - the state machine will save the original value of the property before the - new value is set. - - Later, when the machine either enters a state which has its restore policy - set to DoNotRestoreProperties or when it enters a state which does not set - a value for the given property, the property will automatically be restored - to its initial value. - - Only one initial value will be saved for any given property. If a value for a property has - already been saved by the state machine, it will not be overwritten until the property has been - successfully restored. Once the property has been restored, the state machine will clear the - initial value until it enters a new state which sets the property and which has RestoreProperties - as its restore policy. - - \value GlobalRestorePolicy The restore policy for the state should be retrieved using - QtStateMachine::globalRestorePolicy() - \value DoNotRestoreProperties The state machine should not save the initial values of properties - set in the state and restore them later. - \value RestoreProperties The state machine should save the initial values of properties - set in the state and restore them later. - - - \sa setRestorePolicy(), restorePolicy(), QtAbstractState::assignProperty() -*/ - -/*! - \property QtAbstractState::restorePolicy - - \brief the restore policy of this state -*/ - -QtAbstractStatePrivate::QtAbstractStatePrivate() - : restorePolicy(QtAbstractState::GlobalRestorePolicy) -{ -} - -QtAbstractStatePrivate *QtAbstractStatePrivate::get(QtAbstractState *q) -{ - return q->d_func(); -} - -const QtAbstractStatePrivate *QtAbstractStatePrivate::get(const QtAbstractState *q) -{ - return q->d_func(); -} - -QtStateMachine *QtAbstractStatePrivate::machine() const -{ - Q_Q(const QtAbstractState); - QObject *par = q->parent(); - while (par != 0) { - if (QtStateMachine *mach = qobject_cast(par)) - return mach; - par = par->parent(); - } - return 0; -} - -void QtAbstractStatePrivate::callOnEntry() -{ - Q_Q(QtAbstractState); - q->onEntry(); -} - -void QtAbstractStatePrivate::callOnExit() -{ - Q_Q(QtAbstractState); - q->onExit(); -} - -/*! - Constructs a new state with the given \a parent state. -*/ -QtAbstractState::QtAbstractState(QtState *parent) - : QObject( -#ifndef QT_STATEMACHINE_SOLUTION - *new QtAbstractStatePrivate, -#endif - parent) -#ifdef QT_STATEMACHINE_SOLUTION - , d_ptr(new QtAbstractStatePrivate) -#endif -{ -#ifdef QT_STATEMACHINE_SOLUTION - d_ptr->q_ptr = this; -#endif -} - -/*! - \internal -*/ -QtAbstractState::QtAbstractState(QtAbstractStatePrivate &dd, QtState *parent) - : QObject( -#ifndef QT_STATEMACHINE_SOLUTION - dd, -#endif - parent) -#ifdef QT_STATEMACHINE_SOLUTION - , d_ptr(&dd) -#endif -{ -#ifdef QT_STATEMACHINE_SOLUTION - d_ptr->q_ptr = this; -#endif -} - -/*! - Destroys this state. -*/ -QtAbstractState::~QtAbstractState() -{ -#ifdef QT_STATEMACHINE_SOLUTION - delete d_ptr; -#endif -} - -/*! - Returns this state's parent state, or 0 if the state has no parent state. -*/ -QtState *QtAbstractState::parentState() const -{ - return qobject_cast(parent()); -} - -/*! - Instructs this state to set the property with the given \a name of the given - \a object to the given \a value when the state is entered. -*/ -void QtAbstractState::assignProperty(QObject *object, const char *name, - const QVariant &value) -{ - Q_D(QtAbstractState); - for (int i = 0; i < d->propertyAssignments.size(); ++i) { - QPropertyAssignment &assn = d->propertyAssignments[i]; - if ((assn.object == object) && (assn.propertyName == name)) { - assn.value = value; - return; - } - } - d->propertyAssignments.append(QPropertyAssignment(object, name, value)); -} - -/*! - Sets the restore policy of this state to \a restorePolicy. - - The default restore policy is QtAbstractState::GlobalRestorePolicy. -*/ -void QtAbstractState::setRestorePolicy(RestorePolicy restorePolicy) -{ - Q_D(QtAbstractState); - d->restorePolicy = restorePolicy; -} - -/*! - Returns the restore policy for this state. -*/ -QtAbstractState::RestorePolicy QtAbstractState::restorePolicy() const -{ - Q_D(const QtAbstractState); - return d->restorePolicy; -} - -/*! - \fn QtAbstractState::onExit() - - This function is called when the state is exited. Reimplement this function - to perform custom processing when the state is exited. -*/ - -/*! - \fn QtAbstractState::onEntry() - - This function is called when the state is entered. Reimplement this function - to perform custom processing when the state is entered. -*/ - -/*! - \reimp -*/ -bool QtAbstractState::event(QEvent *e) -{ - return QObject::event(e); -} - -QT_END_NAMESPACE diff --git a/lib/qtstatemachine/src/qabstractstate.h b/lib/qtstatemachine/src/qabstractstate.h deleted file mode 100644 index dfc93e3..0000000 --- a/lib/qtstatemachine/src/qabstractstate.h +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QABSTRACTSTATE_H -#define QABSTRACTSTATE_H - -#include "qtstatemachineglobal.h" -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Core) - -class QtState; - -class QtAbstractStatePrivate; -class Q_STATEMACHINE_CORE_EXPORT QtAbstractState : public QObject -{ - Q_OBJECT - Q_ENUMS(RestorePolicy) - Q_PROPERTY(RestorePolicy restorePolicy READ restorePolicy WRITE setRestorePolicy) -public: - enum RestorePolicy { - GlobalRestorePolicy, - DoNotRestoreProperties, - RestoreProperties - }; - - ~QtAbstractState(); - - QtState *parentState() const; - - void assignProperty(QObject *object, const char *name, - const QVariant &value); - - void setRestorePolicy(RestorePolicy restorePolicy); - RestorePolicy restorePolicy() const; - -protected: - QtAbstractState(QtState *parent = 0); - - virtual void onEntry() = 0; - virtual void onExit() = 0; - - bool event(QEvent *e); - -protected: -#ifdef QT_STATEMACHINE_SOLUTION - QtAbstractStatePrivate *d_ptr; -#endif - QtAbstractState(QtAbstractStatePrivate &dd, QtState *parent); - -private: - Q_DISABLE_COPY(QtAbstractState) - Q_DECLARE_PRIVATE(QtAbstractState) -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/lib/qtstatemachine/src/qabstractstate_p.h b/lib/qtstatemachine/src/qabstractstate_p.h deleted file mode 100644 index 90079ff..0000000 --- a/lib/qtstatemachine/src/qabstractstate_p.h +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QABSTRACTSTATE_P_H -#define QABSTRACTSTATE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#ifndef QT_STATEMACHINE_SOLUTION -#include -#endif - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QtAbstractTransition; -class QtHistoryState; -class QtStateMachine; - -struct QPropertyAssignment -{ - QPropertyAssignment(QObject *o, const QByteArray &n, - const QVariant &v, bool es = true) - : object(o), propertyName(n), value(v), explicitlySet(es) - {} - QObject *object; - QByteArray propertyName; - QVariant value; - bool explicitlySet; -}; - -class QtAbstractState; -class Q_STATEMACHINE_CORE_EXPORT QtAbstractStatePrivate -#ifndef QT_STATEMACHINE_SOLUTION - : public QObjectPrivate -#endif -{ - Q_DECLARE_PUBLIC(QtAbstractState) - -public: - QtAbstractStatePrivate(); - - static QtAbstractStatePrivate *get(QtAbstractState *q); - static const QtAbstractStatePrivate *get(const QtAbstractState *q); - - QtStateMachine *machine() const; - - void callOnEntry(); - void callOnExit(); - - QtAbstractState::RestorePolicy restorePolicy; - QList propertyAssignments; - -#ifdef QT_STATEMACHINE_SOLUTION - QtAbstractState *q_ptr; -#endif -}; - -QT_END_NAMESPACE - -#endif diff --git a/lib/qtstatemachine/src/qabstracttransition.cpp b/lib/qtstatemachine/src/qabstracttransition.cpp deleted file mode 100644 index e946f11..0000000 --- a/lib/qtstatemachine/src/qabstracttransition.cpp +++ /dev/null @@ -1,367 +0,0 @@ -/**************************************************************************** -** -** This file is 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 "qabstracttransition.h" -#include "qabstracttransition_p.h" -#include "qabstractstate.h" -#include "qstate.h" -#include "qstatemachine.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QtAbstractTransition - - \brief The QtAbstractTransition class is the base class of transitions between QtAbstractState objects. - - \since 4.6 - \ingroup statemachine - - The QtAbstractTransition class is the abstract base class of transitions - between states (QtAbstractState objects) of a - QtStateMachine. QtAbstractTransition is part of \l{The State Machine - Framework}. - - The QtTransition class provides a default (action-based) implementation of - the QtAbstractTransition interface. - - The sourceState() function returns the source of the transition. The - targetStates() function returns the targets of the transition. - - Transitions can cause animations to be played. Use the addAnimation() - function to add an animation to the transition. - - \section1 Subclassing - - The eventTest() function is called by the state machine to determine whether - an event should trigger the transition. In your reimplementation you - typically check the event type and cast the event object to the proper type, - and check that one or more properties of the event meet your criteria. - - The onTransition() function is called when the transition is triggered; - reimplement this function to perform custom processing for the transition. -*/ - -/*! - \property QtAbstractTransition::source - - \brief the source state (parent) of this transition -*/ - -/*! - \property QtAbstractTransition::target - - \brief the target state of this transition -*/ - -/*! - \property QtAbstractTransition::targets - - \brief the target states of this transition - - If multiple states are specified, all must be descendants of the same - parallel group state. -*/ - -QtAbstractTransitionPrivate::QtAbstractTransitionPrivate() -{ -} - -QtAbstractTransitionPrivate *QtAbstractTransitionPrivate::get(QtAbstractTransition *q) -{ - return q->d_func(); -} - -const QtAbstractTransitionPrivate *QtAbstractTransitionPrivate::get(const QtAbstractTransition *q) -{ - return q->d_func(); -} - -QtStateMachine *QtAbstractTransitionPrivate::machine() const -{ - Q_Q(const QtAbstractTransition); - QObject *par = q->parent(); - while (par != 0) { - if (QtStateMachine *mach = qobject_cast(par)) - return mach; - par = par->parent(); - } - return 0; -} - -bool QtAbstractTransitionPrivate::callEventTest(QEvent *e) const -{ - Q_Q(const QtAbstractTransition); - return q->eventTest(e); -} - -void QtAbstractTransitionPrivate::callOnTransition() -{ - Q_Q(QtAbstractTransition); - q->onTransition(); -} - -QtState *QtAbstractTransitionPrivate::sourceState() const -{ - Q_Q(const QtAbstractTransition); - return qobject_cast(q->parent()); -} - -/*! - Constructs a new QtAbstractTransition object with the given \a sourceState. -*/ -QtAbstractTransition::QtAbstractTransition(QtState *sourceState) - : QObject( -#ifndef QT_STATEMACHINE_SOLUTION - *new QtAbstractTransitionPrivate, -#endif - sourceState) -#ifdef QT_STATEMACHINE_SOLUTION - , d_ptr(new QtAbstractTransitionPrivate) -#endif -{ -#ifdef QT_STATEMACHINE_SOLUTION - d_ptr->q_ptr = this; -#endif -} - -/*! - Constructs a new QtAbstractTransition object with the given \a targets and \a - sourceState. -*/ -QtAbstractTransition::QtAbstractTransition(const QList &targets, - QtState *sourceState) - : QObject( -#ifndef QT_STATEMACHINE_SOLUTION - *new QtAbstractTransitionPrivate, -#endif - sourceState) -#ifdef QT_STATEMACHINE_SOLUTION - , d_ptr(new QtAbstractTransitionPrivate) -#endif -{ -#ifdef QT_STATEMACHINE_SOLUTION - d_ptr->q_ptr = this; -#endif - Q_D(QtAbstractTransition); - d->targetStates = targets; -} - -/*! - \internal -*/ -QtAbstractTransition::QtAbstractTransition(QtAbstractTransitionPrivate &dd, - QtState *parent) - : QObject( -#ifndef QT_STATEMACHINE_SOLUTION - dd, -#endif - parent) -#ifdef QT_STATEMACHINE_SOLUTION - , d_ptr(&dd) -#endif -{ -#ifdef QT_STATEMACHINE_SOLUTION - d_ptr->q_ptr = this; -#endif -} - -/*! - \internal -*/ -QtAbstractTransition::QtAbstractTransition(QtAbstractTransitionPrivate &dd, - const QList &targets, - QtState *parent) - : QObject( -#ifndef QT_STATEMACHINE_SOLUTION - dd, -#endif - parent) -#ifdef QT_STATEMACHINE_SOLUTION - , d_ptr(&dd) -#endif -{ -#ifdef QT_STATEMACHINE_SOLUTION - d_ptr->q_ptr = this; -#endif - Q_D(QtAbstractTransition); - d->targetStates = targets; -} - -/*! - Destroys this transition. -*/ -QtAbstractTransition::~QtAbstractTransition() -{ -#ifdef QT_STATEMACHINE_SOLUTION - delete d_ptr; -#endif -} - -/*! - Returns the source state of this transition, or 0 if this transition has no - source state. -*/ -QtState *QtAbstractTransition::sourceState() const -{ - Q_D(const QtAbstractTransition); - return d->sourceState(); -} - -/*! - Returns the target state of this transition, or 0 if the transition has no - target. -*/ -QtAbstractState *QtAbstractTransition::targetState() const -{ - Q_D(const QtAbstractTransition); - if (d->targetStates.isEmpty()) - return 0; - return d->targetStates.first(); -} - -/*! - Sets the \a target state of this transition. -*/ -void QtAbstractTransition::setTargetState(QtAbstractState* target) -{ - Q_D(QtAbstractTransition); - if (!target) - d->targetStates.clear(); - else - d->targetStates = QList() << target; -} - -/*! - Returns the target states of this transition, or an empty list if this - transition has no target states. -*/ -QList QtAbstractTransition::targetStates() const -{ - Q_D(const QtAbstractTransition); - return d->targetStates; -} - -/*! - Sets the target states of this transition to be the given \a targets. -*/ -void QtAbstractTransition::setTargetStates(const QList &targets) -{ - Q_D(QtAbstractTransition); - d->targetStates = targets; -} - -#ifndef QT_NO_ANIMATION - -/*! - Adds the given \a animation to this transition. - The transition does not take ownership of the animation. - - \sa removeAnimation(), animations() -*/ -void QtAbstractTransition::addAnimation(QAbstractAnimation *animation) -{ - Q_D(QtAbstractTransition); - if (!animation) { - qWarning("QtAbstractTransition::addAnimation: cannot add null animation"); - return; - } - d->animations.append(animation); -} - -/*! - Removes the given \a animation from this transition. - - \sa addAnimation() -*/ -void QtAbstractTransition::removeAnimation(QAbstractAnimation *animation) -{ - Q_D(QtAbstractTransition); - if (!animation) { - qWarning("QtAbstractTransition::removeAnimation: cannot remove null animation"); - return; - } - d->animations.removeOne(animation); -} - -/*! - Returns the list of animations associated with this transition, or an empty - list if it has no animations. - - \sa addAnimation() -*/ -QList QtAbstractTransition::animations() const -{ - Q_D(const QtAbstractTransition); - return d->animations; -} - -#endif - -/*! - \fn QtAbstractTransition::eventTest(QEvent *event) const - - This function is called to determine whether the given \a event should cause - this transition to trigger. Reimplement this function and return true if the - event should trigger the transition, otherwise return false. -*/ - -/*! - \fn QtAbstractTransition::onTransition() - - This function is called when the transition is triggered. Reimplement this - function to perform custom processing when the transition is triggered. -*/ - -/*! - \reimp -*/ -bool QtAbstractTransition::event(QEvent *e) -{ - return QObject::event(e); -} - -QT_END_NAMESPACE diff --git a/lib/qtstatemachine/src/qabstracttransition.h b/lib/qtstatemachine/src/qabstracttransition.h deleted file mode 100644 index b920eaa..0000000 --- a/lib/qtstatemachine/src/qabstracttransition.h +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QABSTRACTTRANSITION_H -#define QABSTRACTTRANSITION_H - -#include "qtstatemachineglobal.h" -#include - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Core) - -class QEvent; -class QtAbstractState; -class QtState; - -#ifndef QT_NO_ANIMATION -class QAbstractAnimation; -#endif - -class QtAbstractTransitionPrivate; -class Q_STATEMACHINE_CORE_EXPORT QtAbstractTransition : public QObject -{ - Q_OBJECT - Q_PROPERTY(QtState* source READ sourceState) - Q_PROPERTY(QtAbstractState* target READ targetState WRITE setTargetState) - Q_PROPERTY(QList targets READ targetStates WRITE setTargetStates) -public: - QtAbstractTransition(QtState *sourceState = 0); - QtAbstractTransition(const QList &targets, QtState *sourceState = 0); - virtual ~QtAbstractTransition(); - - QtState *sourceState() const; - QtAbstractState *targetState() const; - void setTargetState(QtAbstractState* target); - QList targetStates() const; - void setTargetStates(const QList &targets); - -#ifndef QT_NO_ANIMATION - void addAnimation(QAbstractAnimation *animation); - void removeAnimation(QAbstractAnimation *animation); - QList animations() const; -#endif - -protected: - virtual bool eventTest(QEvent *event) const = 0; - - virtual void onTransition() = 0; - - bool event(QEvent *e); - -protected: -#ifdef QT_STATEMACHINE_SOLUTION - QtAbstractTransitionPrivate *d_ptr; -#endif - QtAbstractTransition(QtAbstractTransitionPrivate &dd, QtState *parent); - QtAbstractTransition(QtAbstractTransitionPrivate &dd, - const QList &targets, QtState *parent); - -private: - Q_DISABLE_COPY(QtAbstractTransition) - Q_DECLARE_PRIVATE(QtAbstractTransition) -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/lib/qtstatemachine/src/qabstracttransition_p.h b/lib/qtstatemachine/src/qabstracttransition_p.h deleted file mode 100644 index 4e13ba6..0000000 --- a/lib/qtstatemachine/src/qabstracttransition_p.h +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QABSTRACTTRANSITION_P_H -#define QABSTRACTTRANSITION_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#ifndef QT_STATEMACHINE_SOLUTION -#include -#endif - -#include - -QT_BEGIN_NAMESPACE - -class QtAbstractState; -class QtState; -class QtStateMachine; - -class QtAbstractTransition; -class Q_STATEMACHINE_CORE_EXPORT QtAbstractTransitionPrivate -#ifndef QT_STATEMACHINE_SOLUTION - : public QObjectPrivate -#endif -{ - Q_DECLARE_PUBLIC(QtAbstractTransition) -public: - QtAbstractTransitionPrivate(); - - static QtAbstractTransitionPrivate *get(QtAbstractTransition *q); - static const QtAbstractTransitionPrivate *get(const QtAbstractTransition *q); - - bool callEventTest(QEvent *e) const; - void callOnTransition(); - QtState *sourceState() const; - QtStateMachine *machine() const; - - QList targetStates; - -#ifndef QT_NO_ANIMATION - QList animations; -#endif - -#ifdef QT_STATEMACHINE_SOLUTION - QtAbstractTransition *q_ptr; -#endif -}; - -QT_END_NAMESPACE - -#endif diff --git a/lib/qtstatemachine/src/qactionstate.cpp b/lib/qtstatemachine/src/qactionstate.cpp deleted file mode 100644 index effd0fc..0000000 --- a/lib/qtstatemachine/src/qactionstate.cpp +++ /dev/null @@ -1,298 +0,0 @@ -/**************************************************************************** -** -** This file is 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 "qactionstate.h" -#include "qactionstate_p.h" -#include "qstateaction.h" -#include "qstateaction_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QtActionState - - \brief The QtActionState class provides an action-based state. - - \since 4.6 - \ingroup statemachine - - QtActionState executes \l{QtStateAction}{state actions} when the state is - entered and exited. QtActionState is part of \l{The State Machine Framework}. - - You can add actions to a state with the addEntryAction() and addExitAction() - functions. The state executes the actions when the state is entered and - exited, respectively. - - The invokeMethodOnEntry() and invokeMethodOnExit() functions are used for - defining method invocations that should be performed when a state is entered - and exited, respectively. - - \code - QtState *s2 = new QtState(); - s2->invokeMethodOnEntry(&label, "showMaximized"); - machine.addState(s2); - \endcode - - \sa QtStateAction -*/ - -QtActionStatePrivate::QtActionStatePrivate() -{ -} - -QtActionStatePrivate::~QtActionStatePrivate() -{ -} - -QtActionStatePrivate *QtActionStatePrivate::get(QtActionState *q) -{ - return q->d_func(); -} - -const QtActionStatePrivate *QtActionStatePrivate::get(const QtActionState *q) -{ - return q->d_func(); -} - -QList QtActionStatePrivate::entryActions() const -{ - QList result; - QList::const_iterator it; -#ifdef QT_STATEMACHINE_SOLUTION - const QObjectList &children = q_func()->children(); -#endif - for (it = children.constBegin(); it != children.constEnd(); ++it) { - QtStateAction *act = qobject_cast(*it); - if (act && (QtStateActionPrivate::get(act)->when == QtStateActionPrivate::ExecuteOnEntry)) - result.append(act); - } - return result; -} - -QList QtActionStatePrivate::exitActions() const -{ - QList result; - QList::const_iterator it; -#ifdef QT_STATEMACHINE_SOLUTION - const QObjectList &children = q_func()->children(); -#endif - for (it = children.constBegin(); it != children.constEnd(); ++it) { - QtStateAction *act = qobject_cast(*it); - if (act && (QtStateActionPrivate::get(act)->when == QtStateActionPrivate::ExecuteOnExit)) - result.append(act); - } - return result; -} - -/*! - Constructs a new action state with the given \a parent state. -*/ -QtActionState::QtActionState(QtState *parent) - : QtAbstractState(*new QtActionStatePrivate, parent) -{ -} - -/*! - \internal -*/ -QtActionState::QtActionState(QtActionStatePrivate &dd, - QtState *parent) - : QtAbstractState(dd, parent) -{ -} - -/*! - Destroys this action state. -*/ -QtActionState::~QtActionState() -{ -} - -/*! - Instructs this state to invoke the given \a method of the given \a object - with the given \a arguments when the state is entered. This function will - create a QtStateInvokeMethodAction object and add it to the entry actions of - the state. - - \sa invokeMethodOnExit(), addEntryAction() -*/ -void QtActionState::invokeMethodOnEntry(QObject *object, const char *method, - const QList &arguments) -{ - addEntryAction(new QtStateInvokeMethodAction(object, method, arguments)); -} - -/*! - Instructs this state to invoke the given \a method of the given \a object - with the given \a arguments when the state is exited. This function will - create a QtStateInvokeMethodAction object and add it to the exit actions of - the state. - - \sa invokeMethodOnEntry(), addExitAction() -*/ -void QtActionState::invokeMethodOnExit(QObject *object, const char *method, - const QList &arguments) -{ - addExitAction(new QtStateInvokeMethodAction(object, method, arguments)); -} - -/*! - Adds the given \a action to this state. The action will be executed when - this state is entered. The state takes ownership of the action. - - \sa addExitAction(), removeEntryAction() -*/ -void QtActionState::addEntryAction(QtStateAction *action) -{ - if (!action) { - qWarning("QtActionState::addEntryAction: cannot add null action"); - return; - } - action->setParent(this); - QtStateActionPrivate::get(action)->when = QtStateActionPrivate::ExecuteOnEntry; -} - -/*! - Adds the given \a action to this state. The action will be executed when - this state is exited. The state takes ownership of the action. - - \sa addEntryAction(), removeExitAction() -*/ -void QtActionState::addExitAction(QtStateAction *action) -{ - if (!action) { - qWarning("QtActionState::addExitAction: cannot add null action"); - return; - } - action->setParent(this); - QtStateActionPrivate::get(action)->when = QtStateActionPrivate::ExecuteOnExit; -} - -/*! - Removes the given entry \a action from this state. The state releases - ownership of the action. - - \sa addEntryAction() -*/ -void QtActionState::removeEntryAction(QtStateAction *action) -{ - if (!action) { - qWarning("QtActionState::removeEntryAction: cannot remove null action"); - return; - } - if (action->parent() == this) - action->setParent(0); -} - -/*! - Removes the given exit \a action from this state. The state releases - ownership of the action. - - \sa addExitAction() -*/ -void QtActionState::removeExitAction(QtStateAction *action) -{ - if (!action) { - qWarning("QtActionState::removeExitAction: cannot remove null action"); - return; - } - if (action->parent() == this) - action->setParent(0); -} - -/*! - Returns this state's entry actions. - - \sa addEntryAction(), exitActions() -*/ -QList QtActionState::entryActions() const -{ - Q_D(const QtActionState); - return d->entryActions(); -} - -/*! - Returns this state's exit actions. - - \sa addExitAction(), entryActions() -*/ -QList QtActionState::exitActions() const -{ - Q_D(const QtActionState); - return d->exitActions(); -} - -/*! - \reimp -*/ -void QtActionState::onEntry() -{ - Q_D(QtActionState); - QList actions = d->entryActions(); - for (int i = 0; i < actions.size(); ++i) - QtStateActionPrivate::get(actions.at(i))->callExecute(); -} - -/*! - \reimp -*/ -void QtActionState::onExit() -{ - Q_D(QtActionState); - QList actions = d->exitActions(); - for (int i = 0; i < actions.size(); ++i) - QtStateActionPrivate::get(actions.at(i))->callExecute(); -} - -/*! - \reimp -*/ -bool QtActionState::event(QEvent *e) -{ - return QtAbstractState::event(e); -} - -QT_END_NAMESPACE diff --git a/lib/qtstatemachine/src/qactionstate.h b/lib/qtstatemachine/src/qactionstate.h deleted file mode 100644 index 559cef9..0000000 --- a/lib/qtstatemachine/src/qactionstate.h +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QACTIONSTATE_H -#define QACTIONSTATE_H - -#include "qtstatemachineglobal.h" -#ifndef QT_STATEMACHINE_SOLUTION -#include -#else -#include "qabstractstate.h" -#endif - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Core) - -class QtStateAction; - -class QtActionStatePrivate; -class Q_STATEMACHINE_CORE_EXPORT QtActionState : public QtAbstractState -{ - Q_OBJECT -public: - QtActionState(QtState *parent = 0); - ~QtActionState(); - - void invokeMethodOnEntry(QObject *object, const char *method, - const QList &args = QList()); - void invokeMethodOnExit(QObject *object, const char *method, - const QList &args = QList()); - - void addEntryAction(QtStateAction *action); - void addExitAction(QtStateAction *action); - - void removeEntryAction(QtStateAction *action); - void removeExitAction(QtStateAction *action); - - QList entryActions() const; - QList exitActions() const; - -protected: - void onEntry(); - void onExit(); - - bool event(QEvent *e); - -protected: - QtActionState(QtActionStatePrivate &dd, QtState *parent); - -private: - Q_DISABLE_COPY(QtActionState) - Q_DECLARE_PRIVATE(QtActionState) -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/lib/qtstatemachine/src/qactionstate_p.h b/lib/qtstatemachine/src/qactionstate_p.h deleted file mode 100644 index db85572..0000000 --- a/lib/qtstatemachine/src/qactionstate_p.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QACTIONSTATE_P_H -#define QACTIONSTATE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qabstractstate_p.h" -#include "qactionstate.h" - -#include - -QT_BEGIN_NAMESPACE - -class QtStateAction; - -class QtActionState; -class Q_STATEMACHINE_CORE_EXPORT QtActionStatePrivate : public QtAbstractStatePrivate -{ - Q_DECLARE_PUBLIC(QtActionState) - -public: - QtActionStatePrivate(); - ~QtActionStatePrivate(); - - static QtActionStatePrivate *get(QtActionState *q); - static const QtActionStatePrivate *get(const QtActionState *q); - - QList entryActions() const; - QList exitActions() const; -}; - -QT_END_NAMESPACE - -#endif diff --git a/lib/qtstatemachine/src/qboundevent_p.h b/lib/qtstatemachine/src/qboundevent_p.h deleted file mode 100644 index 9bae01c..0000000 --- a/lib/qtstatemachine/src/qboundevent_p.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QBOUNDEVENT_P_H -#define QBOUNDEVENT_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -QT_BEGIN_NAMESPACE - -class QtBoundEvent : public QEvent -{ -public: - QtBoundEvent(QObject *object, QEvent *event) -#ifdef QT_STATEMACHINE_SOLUTION - : QEvent(QEvent::Type(QEvent::User-3)), -#else - : QEvent(QEvent::Bound), -#endif - m_object(object), m_event(event) {} - ~QtBoundEvent() {} - - inline QObject *object() const { return m_object; } - inline QEvent *event() const { return m_event; } - -private: - QObject *m_object; - QEvent *m_event; -}; - -QT_END_NAMESPACE - -#endif diff --git a/lib/qtstatemachine/src/qeventtransition.cpp b/lib/qtstatemachine/src/qeventtransition.cpp deleted file mode 100644 index a84c1e4..0000000 --- a/lib/qtstatemachine/src/qeventtransition.cpp +++ /dev/null @@ -1,297 +0,0 @@ -/**************************************************************************** -** -** This file is 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 "qeventtransition.h" -#include "qeventtransition_p.h" -#include "qboundevent_p.h" -#include "qstate.h" -#include "qstate_p.h" -#include "qstatemachine.h" -#include "qstatemachine_p.h" -#include - -QT_BEGIN_NAMESPACE - -/*! - \class QtEventTransition - - \brief The QtEventTransition class provides a QObject-specific transition for Qt events. - - \since 4.6 - \ingroup statemachine - - A QtEventTransition object binds an event to a particular QObject. - QtEventTransition is part of \l{The State Machine Framework}. - - Example: - - \code - QPushButton *button = ...; - QtState *s1 = ...; - QtState *s2 = ...; - // If in s1 and the button receives an Enter event, transition to s2 - QtEventTransition *enterTransition = new QtEventTransition(button, QEvent::Enter); - enterTransition->setTargetState(s2); - s1->addTransition(enterTransition); - // If in s2 and the button receives an Exit event, transition back to s1 - QtEventTransition *leaveTransition = new QtEventTransition(button, QEvent::Leave); - leaveTransition->setTargetState(s1); - s2->addTransition(leaveTransition); - \endcode - - \section1 Subclassing - - Many event classes have attributes in addition to the event type itself. - The testEventCondition() function can be reimplemented to check attributes - of an event instance in order to determine whether the transition should be - triggered or not. - - \sa QtState::addTransition() -*/ - -/*! - \property QtEventTransition::object - - \brief the event source that this event transition is associated with -*/ - -/*! - \property QtEventTransition::eventType - - \brief the type of event that this event transition is associated with -*/ -QtEventTransitionPrivate::QtEventTransitionPrivate() -{ - object = 0; - eventType = QEvent::None; - registered = false; -} - -QtEventTransitionPrivate *QtEventTransitionPrivate::get(QtEventTransition *q) -{ - return q->d_func(); -} - -void QtEventTransitionPrivate::invalidate() -{ - Q_Q(QtEventTransition); - if (registered) { - QtState *source = sourceState(); - QtStatePrivate *source_d = QtStatePrivate::get(source); - QtStateMachinePrivate *mach = QtStateMachinePrivate::get(source_d->machine()); - if (mach) { - mach->unregisterEventTransition(q); - if (mach->configuration.contains(source)) - mach->registerEventTransition(q); - } - } -} - -/*! - Constructs a new QtEventTransition object with the given \a sourceState. -*/ -QtEventTransition::QtEventTransition(QtState *sourceState) - : QtTransition(*new QtEventTransitionPrivate, sourceState) -{ -} - -/*! - Constructs a new QtEventTransition object associated with events of the given - \a type for the given \a object, and with the given \a sourceState. -*/ -QtEventTransition::QtEventTransition(QObject *object, QEvent::Type type, - QtState *sourceState) - : QtTransition(*new QtEventTransitionPrivate, sourceState) -{ - Q_D(QtEventTransition); - d->registered = false; - d->object = object; - d->eventType = type; -} - -/*! - Constructs a new QtEventTransition object associated with events of the given - \a type for the given \a object. The transition has the given \a targets and - \a sourceState. -*/ -QtEventTransition::QtEventTransition(QObject *object, QEvent::Type type, - const QList &targets, - QtState *sourceState) - : QtTransition(*new QtEventTransitionPrivate, targets, sourceState) -{ - Q_D(QtEventTransition); - d->registered = false; - d->object = object; - d->eventType = type; -} - -/*! - \internal -*/ -QtEventTransition::QtEventTransition(QtEventTransitionPrivate &dd, QtState *parent) - : QtTransition(dd, parent) -{ -} - -/*! - \internal -*/ -QtEventTransition::QtEventTransition(QtEventTransitionPrivate &dd, QObject *object, - QEvent::Type type, QtState *parent) - : QtTransition(dd, parent) -{ - Q_D(QtEventTransition); - d->registered = false; - d->object = object; - d->eventType = type; -} - -/*! - \internal -*/ -QtEventTransition::QtEventTransition(QtEventTransitionPrivate &dd, QObject *object, - QEvent::Type type, const QList &targets, - QtState *parent) - : QtTransition(dd, targets, parent) -{ - Q_D(QtEventTransition); - d->registered = false; - d->object = object; - d->eventType = type; -} - -/*! - Destroys this QObject event transition. -*/ -QtEventTransition::~QtEventTransition() -{ -} - -/*! - Returns the event type that this event transition is associated with. -*/ -QEvent::Type QtEventTransition::eventType() const -{ - Q_D(const QtEventTransition); - return d->eventType; -} - -/*! - Sets the event \a type that this event transition is associated with. -*/ -void QtEventTransition::setEventType(QEvent::Type type) -{ - Q_D(QtEventTransition); - if (d->eventType == type) - return; - d->eventType = type; - d->invalidate(); -} - -/*! - Returns the event source associated with this event transition. -*/ -QObject *QtEventTransition::eventSource() const -{ - Q_D(const QtEventTransition); - return d->object; -} - -/*! - Sets the event source associated with this event transition to be the given - \a object. -*/ -void QtEventTransition::setEventSource(QObject *object) -{ - Q_D(QtEventTransition); - if (d->object == object) - return; - d->object = object; - d->invalidate(); -} - -/*! - \reimp -*/ -bool QtEventTransition::eventTest(QEvent *event) const -{ - Q_D(const QtEventTransition); -#ifdef QT_STATEMACHINE_SOLUTION - if (event->type() == QEvent::Type(QEvent::User-3)) { -#else - if (event->type() == QEvent::Bound) { -#endif - QtBoundEvent *oe = static_cast(event); - return (oe->object() == d->object) - && (oe->event()->type() == d->eventType) - && testEventCondition(oe->event()); - } - return false; -} - -/*! - Tests an instance of an event associated with this event transition and - returns true if the transition should be taken, otherwise returns false. - The type of the given \a event will be eventType(). - - Reimplement this function if you have custom conditions associated with - the transition. The default implementation always returns true. -*/ -bool QtEventTransition::testEventCondition(QEvent *event) const -{ - Q_UNUSED(event); - return true; -} - -/*! - \reimp -*/ -bool QtEventTransition::event(QEvent *e) -{ - return QtTransition::event(e); -} - -QT_END_NAMESPACE diff --git a/lib/qtstatemachine/src/qeventtransition.h b/lib/qtstatemachine/src/qeventtransition.h deleted file mode 100644 index 3bc80cc..0000000 --- a/lib/qtstatemachine/src/qeventtransition.h +++ /dev/null @@ -1,105 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QEVENTTRANSITION_H -#define QEVENTTRANSITION_H - -#include "qtstatemachineglobal.h" -#include "qtransition.h" -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Core) - -class QtEventTransitionPrivate; -class Q_STATEMACHINE_CORE_EXPORT QtEventTransition : public QtTransition -{ - Q_OBJECT - Q_PROPERTY(QObject* object READ eventSource WRITE setEventSource) -#ifndef QT_STATEMACHINE_SOLUTION - Q_PROPERTY(QEvent::Type eventType READ eventType WRITE setEventType) -#endif -public: - QtEventTransition(QtState *sourceState = 0); - QtEventTransition(QObject *object, QEvent::Type type, QtState *sourceState = 0); - QtEventTransition(QObject *object, QEvent::Type type, - const QList &targets, QtState *sourceState = 0); - ~QtEventTransition(); - - QObject *eventSource() const; - void setEventSource(QObject *object); - - QEvent::Type eventType() const; - void setEventType(QEvent::Type type); - -protected: - virtual bool testEventCondition(QEvent *event) const; // ### name - - bool eventTest(QEvent *event) const; - - bool event(QEvent *e); - -protected: - QtEventTransition(QtEventTransitionPrivate &dd, QtState *parent); - QtEventTransition(QtEventTransitionPrivate &dd, QObject *object, - QEvent::Type type, QtState *parent); - QtEventTransition(QtEventTransitionPrivate &dd, QObject *object, - QEvent::Type type, const QList &targets, - QtState *parent); - -private: - Q_DISABLE_COPY(QtEventTransition) - Q_DECLARE_PRIVATE(QtEventTransition) -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/lib/qtstatemachine/src/qeventtransition_p.h b/lib/qtstatemachine/src/qeventtransition_p.h deleted file mode 100644 index 34e4172..0000000 --- a/lib/qtstatemachine/src/qeventtransition_p.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QEVENTTRANSITION_P_H -#define QEVENTTRANSITION_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qtransition_p.h" - -QT_BEGIN_NAMESPACE - -class QtEventTransition; -class Q_STATEMACHINE_CORE_EXPORT QtEventTransitionPrivate : public QtTransitionPrivate -{ - Q_DECLARE_PUBLIC(QtEventTransition) -public: - QtEventTransitionPrivate(); - - static QtEventTransitionPrivate *get(QtEventTransition *q); - - void invalidate(); - - bool registered; - QObject *object; - QEvent::Type eventType; -}; - -QT_END_NAMESPACE - -#endif diff --git a/lib/qtstatemachine/src/qfinalstate.cpp b/lib/qtstatemachine/src/qfinalstate.cpp deleted file mode 100644 index 4c91ffa..0000000 --- a/lib/qtstatemachine/src/qfinalstate.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/**************************************************************************** -** -** This file is 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 "qfinalstate.h" -#include "qactionstate_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QtFinalState - - \brief The QtFinalState class provides a final state. - - \since 4.6 - \ingroup statemachine - - A final state is used to communicate that (part of) a QtStateMachine has - finished its work. When a final top-level state is entered, the state - machine's \l{QtStateMachine::finished()}{finished}() signal is emitted. In - general, when a final substate (a child of a QtState) is entered, a - QtStateFinishedEvent is generated for the final state's parent - state. QtFinalState is part of \l{The State Machine Framework}. - - To use a final state, you create a QtFinalState object and add a transition - to it from another state. Example: - - \code - QPushButton button; - - QtStateMachine machine; - QtState *s1 = new QtState(); - QtFinalState *s2 = new QtFinalState(); - s1->addTransition(&button, SIGNAL(clicked()), s2); - machine.addState(s1); - machine.addState(s2); - - QObject::connect(&machine, SIGNAL(finished()), QApplication::instance(), SLOT(quit())); - machine.setInitialState(s1); - machine.start(); - \endcode - - \sa QtStateFinishedTransition -*/ - -class QtFinalStatePrivate : public QtActionStatePrivate -{ - Q_DECLARE_PUBLIC(QtFinalState) - -public: - QtFinalStatePrivate(); -}; - -QtFinalStatePrivate::QtFinalStatePrivate() -{ -} - -/*! - Constructs a new QtFinalState object with the given \a parent state. -*/ -QtFinalState::QtFinalState(QtState *parent) - : QtActionState(*new QtFinalStatePrivate, parent) -{ -} - -/*! - Destroys this final state. -*/ -QtFinalState::~QtFinalState() -{ -} - -/*! - \reimp -*/ -void QtFinalState::onEntry() -{ - QtActionState::onEntry(); -} - -/*! - \reimp -*/ -void QtFinalState::onExit() -{ - QtActionState::onExit(); -} - -/*! - \reimp -*/ -bool QtFinalState::event(QEvent *e) -{ - return QtActionState::event(e); -} - -QT_END_NAMESPACE diff --git a/lib/qtstatemachine/src/qfinalstate.h b/lib/qtstatemachine/src/qfinalstate.h deleted file mode 100644 index c6ffe5f..0000000 --- a/lib/qtstatemachine/src/qfinalstate.h +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QFINALSTATE_H -#define QFINALSTATE_H - -#include "qtstatemachineglobal.h" -#ifndef QT_STATEMACHINE_SOLUTION -#include -#else -#include "qactionstate.h" -#endif - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Core) - -class QtFinalStatePrivate; -class Q_STATEMACHINE_CORE_EXPORT QtFinalState : public QtActionState -{ - Q_OBJECT -public: - QtFinalState(QtState *parent = 0); - ~QtFinalState(); - -protected: - void onEntry(); - void onExit(); - - bool event(QEvent *e); - -private: - Q_DISABLE_COPY(QtFinalState) - Q_DECLARE_PRIVATE(QtFinalState) -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/lib/qtstatemachine/src/qguistatemachine.cpp b/lib/qtstatemachine/src/qguistatemachine.cpp deleted file mode 100644 index f736339..0000000 --- a/lib/qtstatemachine/src/qguistatemachine.cpp +++ /dev/null @@ -1,569 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifdef QT_STATEMACHINE_SOLUTION -#include "qstatemachine.h" -#include "qstatemachine_p.h" -#else -#include -#include -#endif -#include -#include - -QT_BEGIN_NAMESPACE - -Q_STATEMACHINE_CORE_EXPORT const QtStateMachinePrivate::Handler *qcoreStateMachineHandler(); - -static QEvent *cloneEvent(QEvent *e) -{ - switch (e->type()) { - case QEvent::MouseButtonPress: - case QEvent::MouseButtonRelease: - case QEvent::MouseButtonDblClick: - case QEvent::MouseMove: - return new QMouseEvent(*static_cast(e)); - case QEvent::KeyPress: - case QEvent::KeyRelease: - return new QKeyEvent(*static_cast(e)); - case QEvent::FocusIn: - case QEvent::FocusOut: - return new QFocusEvent(*static_cast(e)); - case QEvent::Enter: - return new QEvent(*e); - case QEvent::Leave: - return new QEvent(*e); - break; - case QEvent::Paint: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::Move: - return new QMoveEvent(*static_cast(e)); - case QEvent::Resize: - return new QResizeEvent(*static_cast(e)); - case QEvent::Create: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::Destroy: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::Show: - return new QShowEvent(*static_cast(e)); - case QEvent::Hide: - return new QHideEvent(*static_cast(e)); - case QEvent::Close: - return new QCloseEvent(*static_cast(e)); - case QEvent::Quit: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::ParentChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::ParentAboutToChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::ThreadChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::WindowActivate: - case QEvent::WindowDeactivate: - return new QEvent(*e); - - case QEvent::ShowToParent: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::HideToParent: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::Wheel: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::WindowTitleChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::WindowIconChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::ApplicationWindowIconChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::ApplicationFontChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::ApplicationLayoutDirectionChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::ApplicationPaletteChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::PaletteChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::Clipboard: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::Speech: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::MetaCall: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::SockAct: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::WinEventAct: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::DeferredDelete: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::DragEnter: - return new QDragEnterEvent(*static_cast(e)); - case QEvent::DragMove: - return new QDragMoveEvent(*static_cast(e)); - case QEvent::DragLeave: - return new QDragLeaveEvent(*static_cast(e)); - case QEvent::Drop: - return new QDropEvent(*static_cast(e)); - case QEvent::DragResponse: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::ChildAdded: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::ChildPolished: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; -#ifdef QT3_SUPPORT - case QEvent::ChildInsertedRequest: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::ChildInserted: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::LayoutHint: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; -#endif - case QEvent::ChildRemoved: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::ShowWindowRequest: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::PolishRequest: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::Polish: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::LayoutRequest: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::UpdateRequest: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::UpdateLater: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::EmbeddingControl: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::ActivateControl: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::DeactivateControl: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::ContextMenu: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::InputMethod: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::AccessibilityPrepare: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::TabletMove: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::LocaleChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::LanguageChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::LayoutDirectionChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::Style: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::TabletPress: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::TabletRelease: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::OkRequest: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::HelpRequest: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::IconDrag: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::FontChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::EnabledChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::ActivationChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::StyleChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::IconTextChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::ModifiedChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::MouseTrackingChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::WindowBlocked: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::WindowUnblocked: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::WindowStateChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::ToolTip: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::WhatsThis: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::StatusTip: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::ActionChanged: - case QEvent::ActionAdded: - case QEvent::ActionRemoved: - return new QActionEvent(*static_cast(e)); - - case QEvent::FileOpen: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::Shortcut: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::ShortcutOverride: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - -#ifdef QT3_SUPPORT - case QEvent::Accel: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::AccelAvailable: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; -#endif - - case QEvent::WhatsThisClicked: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::ToolBarChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::ApplicationActivate: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::ApplicationDeactivate: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::QueryWhatsThis: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::EnterWhatsThisMode: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::LeaveWhatsThisMode: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::ZOrderChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::HoverEnter: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::HoverLeave: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::HoverMove: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::AccessibilityHelp: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::AccessibilityDescription: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - -#ifdef QT_KEYPAD_NAVIGATION - case QEvent::EnterEditFocus: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::LeaveEditFocus: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; -#endif - case QEvent::AcceptDropsChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::MenubarUpdated: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::ZeroTimerEvent: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::GraphicsSceneMouseMove: - case QEvent::GraphicsSceneMousePress: - case QEvent::GraphicsSceneMouseRelease: - case QEvent::GraphicsSceneMouseDoubleClick: { - QGraphicsSceneMouseEvent *me = static_cast(e); - QGraphicsSceneMouseEvent *me2 = new QGraphicsSceneMouseEvent(me->type()); - me2->setWidget(me->widget()); - me2->setPos(me->pos()); - me2->setScenePos(me->scenePos()); - me2->setScreenPos(me->screenPos()); -// ### for all buttons - me2->setButtonDownPos(Qt::LeftButton, me->buttonDownPos(Qt::LeftButton)); - me2->setButtonDownPos(Qt::RightButton, me->buttonDownPos(Qt::RightButton)); - me2->setButtonDownScreenPos(Qt::LeftButton, me->buttonDownScreenPos(Qt::LeftButton)); - me2->setButtonDownScreenPos(Qt::RightButton, me->buttonDownScreenPos(Qt::RightButton)); - me2->setLastPos(me->lastPos()); - me2->setLastScenePos(me->lastScenePos()); - me2->setLastScreenPos(me->lastScreenPos()); - me2->setButtons(me->buttons()); - me2->setButton(me->button()); - me2->setModifiers(me->modifiers()); - return me2; - } - - case QEvent::GraphicsSceneContextMenu: { - QGraphicsSceneContextMenuEvent *me = static_cast(e); - QGraphicsSceneContextMenuEvent *me2 = new QGraphicsSceneContextMenuEvent(me->type()); - me2->setWidget(me->widget()); - me2->setPos(me->pos()); - me2->setScenePos(me->scenePos()); - me2->setScreenPos(me->screenPos()); - me2->setModifiers(me->modifiers()); - me2->setReason(me->reason()); - return me2; - } - - case QEvent::GraphicsSceneHoverEnter: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::GraphicsSceneHoverMove: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::GraphicsSceneHoverLeave: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::GraphicsSceneHelp: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::GraphicsSceneDragEnter: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::GraphicsSceneDragMove: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::GraphicsSceneDragLeave: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::GraphicsSceneDrop: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::GraphicsSceneWheel: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::KeyboardLayoutChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::DynamicPropertyChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::TabletEnterProximity: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::TabletLeaveProximity: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::NonClientAreaMouseMove: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::NonClientAreaMouseButtonPress: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::NonClientAreaMouseButtonRelease: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::NonClientAreaMouseButtonDblClick: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::MacSizeChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::ContentsRectChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::MacGLWindowChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::FutureCallOut: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::GraphicsSceneResize: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::GraphicsSceneMove: { - QGraphicsSceneMoveEvent *me = static_cast(e); - QGraphicsSceneMoveEvent *me2 = new QGraphicsSceneMoveEvent(); - me2->setWidget(me->widget()); - me2->setNewPos(me->newPos()); - me2->setOldPos(me->oldPos()); - return me2; - } - - case QEvent::CursorChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::ToolTipChange: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::NetworkReplyUpdated: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - - case QEvent::GrabMouse: - case QEvent::UngrabMouse: - case QEvent::GrabKeyboard: - case QEvent::UngrabKeyboard: - return new QEvent(*e); - -#if defined(QT_MAC_USE_COCOA) && (QT_VERSION >= 0x040500) - case QEvent::CocoaRequestModal: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; -#endif - case QEvent::User: - case QEvent::MaxUser: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - default: - ; - } - return qcoreStateMachineHandler()->cloneEvent(e); -} - -const QtStateMachinePrivate::Handler qt_gui_statemachine_handler = { - cloneEvent -}; - -static const QtStateMachinePrivate::Handler *qt_guistatemachine_last_handler = 0; -Q_STATEMACHINE_CORE_EXPORT int qRegisterGuiStateMachine() -{ - qt_guistatemachine_last_handler = QtStateMachinePrivate::handler; - QtStateMachinePrivate::handler = &qt_gui_statemachine_handler; - return 1; -} -Q_CONSTRUCTOR_FUNCTION(qRegisterGuiStateMachine) - -Q_STATEMACHINE_CORE_EXPORT int qUnregisterGuiStateMachine() -{ - QtStateMachinePrivate::handler = qt_guistatemachine_last_handler; - return 1; -} -Q_DESTRUCTOR_FUNCTION(qUnregisterGuiStateMachine) - -QT_END_NAMESPACE diff --git a/lib/qtstatemachine/src/qhistorystate.cpp b/lib/qtstatemachine/src/qhistorystate.cpp deleted file mode 100644 index 2e8f760..0000000 --- a/lib/qtstatemachine/src/qhistorystate.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/**************************************************************************** -** -** This file is 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 "qhistorystate.h" -#include "qhistorystate_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QtHistoryState - - \brief The QtHistoryState class provides a means of returning to a previously active substate. - - \since 4.6 - \ingroup statemachine - - A history state is a pseudo-state that represents the child state that the - parent state was in the last time the parent state was exited. A transition - with a history state as its target is in fact a transition to one of the - other child states of the parent state. QtHistoryState is part of \l{The - State Machine Framework}. - - Use QtState::addHistoryState() to construct a history state. Use the - setDefaultState() function to set the state that should be entered if the - parent state has never been entered. Example: - - \code - QtStateMachine machine; - - QtState *s1 = new QtState(); - QtState *s11 = new QtState(s1); - QtState *s12 = new QtState(s1); - - QtState *s1h = s1->addHistoryState(); - s1h->setDefaultState(s11); - - machine.addState(s1); - - QtState *s2 = new QtState(); - machine.addState(s2); - - QPushButton *button = new QPushButton(); - // Clicking the button will cause the state machine to enter the child state - // that s1 was in the last time s1 was exited, or the history state's default - // state if s1 has never been entered. - s1->addTransition(button, SIGNAL(clicked()), s1h); - \endcode -*/ - -QtHistoryStatePrivate::QtHistoryStatePrivate() - : defaultState(0) -{ -} - -QtHistoryState *QtHistoryStatePrivate::create(QtState::HistoryType type, - QtState *parent) -{ - return new QtHistoryState(type, parent); -} - -QtHistoryStatePrivate *QtHistoryStatePrivate::get(QtHistoryState *q) -{ - return q->d_func(); -} - -const QtHistoryStatePrivate *QtHistoryStatePrivate::get(const QtHistoryState *q) -{ - return q->d_func(); -} - -/*! - \internal - - Constructs a new history state of the given \a type, with the given \a - parent state. -*/ -QtHistoryState::QtHistoryState(QtState::HistoryType type, QtState *parent) - : QtAbstractState(*new QtHistoryStatePrivate, parent) -{ - Q_D(QtHistoryState); - d->historyType = type; -} - -/*! - Destroys this history state. -*/ -QtHistoryState::~QtHistoryState() -{ -} - -/*! - Returns this history state's default state. The default state indicates the - state to transition to if the parent state has never been entered before. -*/ -QtAbstractState *QtHistoryState::defaultState() const -{ - Q_D(const QtHistoryState); - return d->defaultState; -} - -/*! - Sets this history state's default state to be the given \a state. - \a state must be a sibling of this history state. -*/ -void QtHistoryState::setDefaultState(QtAbstractState *state) -{ - Q_D(QtHistoryState); - if (state && state->parentState() != parentState()) { - qWarning("QtHistoryState::setDefaultState: state %p does not belong " - "to this history state's group (%p)", state, parentState()); - return; - } - d->defaultState = state; -} - -/*! - \reimp -*/ -void QtHistoryState::onEntry() -{ -} - -/*! - \reimp -*/ -void QtHistoryState::onExit() -{ -} - -/*! - \reimp -*/ -bool QtHistoryState::event(QEvent *e) -{ - return QtAbstractState::event(e); -} - -QT_END_NAMESPACE diff --git a/lib/qtstatemachine/src/qhistorystate.h b/lib/qtstatemachine/src/qhistorystate.h deleted file mode 100644 index c116678..0000000 --- a/lib/qtstatemachine/src/qhistorystate.h +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QHISTORYSTATE_H -#define QHISTORYSTATE_H - -#include "qtstatemachineglobal.h" -#ifndef QT_STATEMACHINE_SOLUTION -#include -#else -#include "qstate.h" -#endif - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Core) - -class QtHistoryStatePrivate; -class Q_STATEMACHINE_CORE_EXPORT QtHistoryState : public QtAbstractState -{ - Q_OBJECT -public: - ~QtHistoryState(); - - QtAbstractState *defaultState() const; - void setDefaultState(QtAbstractState *state); - -protected: - void onEntry(); - void onExit(); - - bool event(QEvent *e); - -private: - QtHistoryState(QtState::HistoryType type, - QtState *parent = 0); - -private: - Q_DISABLE_COPY(QtHistoryState) - Q_DECLARE_PRIVATE(QtHistoryState) -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/lib/qtstatemachine/src/qhistorystate_p.h b/lib/qtstatemachine/src/qhistorystate_p.h deleted file mode 100644 index e4acb65..0000000 --- a/lib/qtstatemachine/src/qhistorystate_p.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QHISTORYSTATE_P_H -#define QHISTORYSTATE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qabstractstate_p.h" - -#include - -QT_BEGIN_NAMESPACE - -class QtHistoryState; -class QtHistoryStatePrivate : public QtAbstractStatePrivate -{ - Q_DECLARE_PUBLIC(QtHistoryState) - -public: - QtHistoryStatePrivate(); - - static QtHistoryState *create(QtState::HistoryType type, - QtState *parent); - - static QtHistoryStatePrivate *get(QtHistoryState *q); - static const QtHistoryStatePrivate *get(const QtHistoryState *q); - - QtAbstractState *defaultState; - QtState::HistoryType historyType; - QList configuration; -}; - -QT_END_NAMESPACE - -#endif diff --git a/lib/qtstatemachine/src/qscriptedstatemachine.cpp b/lib/qtstatemachine/src/qscriptedstatemachine.cpp deleted file mode 100644 index d76bc53..0000000 --- a/lib/qtstatemachine/src/qscriptedstatemachine.cpp +++ /dev/null @@ -1,1386 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -/*! - \class QtScriptedStateMachine - \reentrant - - \brief The QtScriptedStateMachine class provides a way to use scripting with the Qt State Machine Framework. - - \ingroup sctools - - Though can be used alone, QtScriptedStateMachine is mainly a runtime helper to using the - state-machine framework with SCXML files. - - - \sa QtStateMachine -*/ - -#include "qscriptedstatemachine.h" -#include -#include -#include "qstatefinishedevent.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "qhistorystate.h" -#include "qabstracttransition_p.h" -#include "qfinalstate.h" -#include "qabstractstate.h" -#ifdef QT_GUI_LIB -#include "qssmguiinvokers_p.h" -#endif - - -class QtScriptedStateMachinePrivate -{ - public: - - enum { MaxSnapshots = 200}; - - struct AnchorSnapshot - { - QtAbstractState* state; - QString location; - QScriptValue snapshot; - QString anchorType; - }; - - - QScriptEngine* scriptEng; - QList invokerFactories; - QUrl burl; - QString sessionID; - QString startScript; - - - QStack snapshotStack; - QMultiHash anchorTransitions; - QHash curSnapshot; - - - static QHash sessions; -}; -QHash QtScriptedStateMachinePrivate::sessions; - -class QtSsmTimer : public QObject -{ - Q_OBJECT - public: - QtSsmTimer(QScriptEngine* engine, const QScriptValue & scr, int delay) : QObject(engine),script(scr) - { - startTimer(delay); - } - protected: - void timerEvent(QTimerEvent*) - { - if (script.isFunction()) - script.call(); - else if (script.isString()) - script.engine()->evaluate(script.toString()); - } - - private: - QScriptValue script; - -}; - -static QScriptValue _q_deepCopy(const QScriptValue & val) -{ - if (val.isObject() || val.isArray()) { - QScriptValue v = val.isArray() ? val.engine()->newArray() : val.engine()->newObject(); - v.setData(val.data()); - QScriptValueIterator it (val); - while (it.hasNext()) { - it.next(); - v.setProperty(it.name(), _q_deepCopy(it.value())); - } - return v; - } else - return val; -} - - -struct QtScriptedStateMachineFunctions -{ -static QScriptValue cssTime(QScriptContext *context, QScriptEngine *engine) -{ - QString str; - if (context->argumentCount() > 0) - str = context->argument(0).toString(); - if (str == "") { - return qScriptValueFromValue(engine,0); - } - else if (str.endsWith("ms")) { - return qScriptValueFromValue(engine,(str.left(str.length()-2).toInt())); - } - else if (str.endsWith("s")) { - return qScriptValueFromValue(engine,(str.left(str.length()-1).toInt())*1000); - } - else { - return qScriptValueFromValue(engine, (str.toInt())); - } -} -static QScriptValue setTimeout(QScriptContext *context, QScriptEngine *engine) -{ - if (context->argumentCount() < 2) - return QScriptValue(); - int timeout = context->argument(1).toInt32(); - QtSsmTimer* tmr = new QtSsmTimer(engine,context->argument(0),timeout); - return engine->newQObject(tmr); -} -static QScriptValue script_print(QScriptContext *context, QScriptEngine *) -{ - if (context->argumentCount() > 0) - qDebug() << context->argument(0).toString(); - return QScriptValue(); -} -static QScriptValue clearTimeout(QScriptContext *context, QScriptEngine *) -{ - if (context->argumentCount() > 0) { - QObject* obj = context->argument(0).toQObject(); - obj->deleteLater(); - } - return QScriptValue(); -} - -static QScriptValue deepCopy(QScriptContext *context, QScriptEngine *) -{ - if (context->argumentCount() == 0) - return QScriptValue(); - else - return _q_deepCopy(context->argument(0)); -} - -static QScriptValue receiveSignal(QScriptContext *context, QScriptEngine *engine) -{ - QString eventName = context->thisObject().property("e").toString(); - if (!eventName.isEmpty()) { - QtScriptedStateMachine* ssm = qobject_cast(engine->globalObject().property("SMUTIL_stateMachine").toQObject()); - if (ssm) { - QStringList pnames; - QVariantList pvals; - for (int i=0; i < context->argumentCount(); ++i) { - pnames << QString::number(i); - pvals << context->argument(i).toVariant(); - } - QtScriptedEvent* ev = new QtScriptedEvent(eventName,pnames,pvals,QScriptValue()); - ev->metaData.kind = QtScriptedEvent::MetaData::Platform; - ssm->postEvent(ev); - } - } - return QScriptValue(); -} - -static QScriptValue postEvent(QScriptContext *context, QScriptEngine *engine) -{ - QtScriptedStateMachine* ssm = qobject_cast(engine->globalObject().property("SMUTIL_stateMachine").toQObject()); - if (ssm) { - QString eventName,target,type; - QStringList pnames; - QVariantList pvals; - QScriptValue cnt; - if (context->argumentCount() > 0) - eventName = context->argument(0).toString(); - if (context->argumentCount() > 1) - target = context->argument(1).toString(); - if (context->argumentCount() > 2) - type = context->argument(2).toString(); - - if (!eventName.isEmpty() || !target.isEmpty()) { - if (context->argumentCount() > 3) - qScriptValueToSequence(context->argument(3),pnames); - if (context->argumentCount() > 4) { - QScriptValueIterator it (context->argument(4)); - while (it.hasNext()) { - it.next(); - pvals.append(it.value().toVariant()); - } - } if (context->argumentCount() > 5) - cnt = context->argument(5); - QtScriptedEvent* ev = new QtScriptedEvent(eventName,pnames,pvals,cnt); - if (type == "scxml" || type == "") { - bool ok = true; - if (target == "_internal") { - ev->metaData.kind = QtScriptedEvent::MetaData::Internal; - ssm->postInternalEvent(ev); - } else if (target == "scxml" || target == "") { - ev->metaData.kind = QtScriptedEvent::MetaData::External; - ssm->postEvent(ev); - } else if (target == "_parent") { - QtSsmInvoker* p = qobject_cast(ssm->parent()); - if (p) - p->postParentEvent(ev); - else - ok = false; - } else { - QtScriptedStateMachine* session = QtScriptedStateMachinePrivate::sessions[target]; - if (session) { - session->postEvent(ev); - } else - ok = false; - } - if (!ok) - ssm->postNamedEvent("error.targetunavailable"); - - } else { - ssm->postNamedEvent("error.send.typeinvalid"); - } - } - } - return QScriptValue(); -} - -// SMUTIL_invoke (type, target, paramNames, paramValues, content) -static QScriptValue invoke(QScriptContext *context, QScriptEngine *engine) -{ - QtScriptedStateMachine* ssm = qobject_cast(engine->globalObject().property("SMUTIL_stateMachine").toQObject()); - if (ssm) { - QString type,target; - QStringList pnames; - QVariantList pvals; - QScriptValue cnt; - if (context->argumentCount() > 0) - type = context->argument(0).toString(); - if (type.isEmpty()) - type = "scxml"; - if (context->argumentCount() > 1) - target = context->argument(1).toString(); - if (context->argumentCount() > 2) - qScriptValueToSequence(context->argument(2),pnames); - if (context->argumentCount() > 3) { - QScriptValueIterator it (context->argument(3)); - while (it.hasNext()) { - it.next(); - pvals.append(it.value().toVariant()); - } - } if (context->argumentCount() > 4) - cnt = context->argument(4); - - - - QtSsmInvokerFactory* invf = NULL; - for (int i=0; i < ssm->pvt->invokerFactories.count() && invf == NULL; ++i) - if (ssm->pvt->invokerFactories[i]->isTypeSupported(type)) - invf = ssm->pvt->invokerFactories[i]; - if (invf) { - QtScriptedEvent* ev = new QtScriptedEvent("",pnames,pvals,cnt); - ev->metaData.origin = ssm->baseUrl(); - ev->metaData.target = target; - ev->metaData.targetType = type; - ev->metaData.originType = "scxml"; - ev->metaData.kind = QtScriptedEvent::MetaData::External; - QtSsmInvoker* inv = invf->createInvoker(ev,ssm); - if (inv) - inv->activate(); - return engine->newQObject(inv); - } else { - ssm->postNamedEvent("error.invalidtargettype"); - } - - } - return QScriptValue(); -} - - -static QScriptValue isInState(QScriptContext *context, QScriptEngine *engine) -{ - QtScriptedStateMachine* ssm = qobject_cast(engine->globalObject().property("SMUTIL_stateMachine").toQObject()); - if (ssm) { - if (context->argumentCount() > 0) { - QString name = context->argument(0).toString(); - if (!name.isEmpty()) { - QSet cfg = ssm->configuration(); - foreach (QtAbstractState* st, cfg) { - if (st->objectName() == name) - return qScriptValueFromValue(engine,true); - } - } - } - } - return qScriptValueFromValue(engine,false); - -} - -}; -/*! - \class QtScriptedEvent - \brief The QtScriptedEvent class stands for a general named event with a list of parameter names and parameter values. - - Encapsulates an event that conforms to the SCXML definition of events. - - \ingroup sctools - -*/ -/*! \enum QtScriptedEvent::MetaData::Kind - - This enum specifies the kind (or context) of the event. - \value Platform An event coming from the itself, such as a script error. - \value Internal An event sent with a or . - \value External An event sent from an invoker, directly from C++, or from a element. -*/ - -/*! - Returns the name of the event. - */ - QString QtScriptedEvent::eventName() const -{ - return ename; -} - /*! - Return a list containing the parameter names. - */ -QStringList QtScriptedEvent::paramNames () const -{ - return pnames; -} - /*! - Return a list containing the parameter values. - */ -QVariantList QtScriptedEvent::paramValues () const -{ - return pvals; -} - /*! - Return a QtScript object that can be passed as an additional parameter. - */ -QScriptValue QtScriptedEvent::content () const -{ - return cnt; -} - /*! - Returns the parameter value equivalent to parameter \a name. - */ -QVariant QtScriptedEvent::param (const QString & name) const -{ - int idx = pnames.indexOf(name); - if (idx >= 0) - return pvals[idx]; - else - return QVariant(); -} -/*! - Creates a QtScriptedEvent named \a name, with parameter names \a paramNames, parameter values \a paramValues, and - a QtScript object \a content as an additional parameter. -*/ -QtScriptedEvent::QtScriptedEvent( - const QString & name, - const QStringList & paramNames, - const QVariantList & paramValues, - const QScriptValue & content) - - : QEvent(QtScriptedEvent::eventType()),ename(name),pnames(paramNames),pvals(paramValues),cnt(content) -{ - metaData.kind = MetaData::Internal; -} - -/*! \class QtScriptedTransition - \brief The QtScriptedTransition class stands for a transition that responds to QtScriptedEvent, and can be made conditional with a \l conditionExpression. - Equivalent to the SCXML transition tag. - - \ingroup sctools - */ -/*! \property QtScriptedTransition::eventPrefix - The event prefix to be used when testing if the transition needs to be invoked. - Uses SCXML prefix matching. Use * to handle any event. - */ -/*! \property QtScriptedTransition::conditionExpression - A QtScript expression that's evaluated to test whether the transition needs to be invoked. - */ - -/*! - Creates a new QtScriptedTransition from \a state, that uses \a machine to evaluate the conditions. - */ -QtScriptedTransition::QtScriptedTransition (QtState* state,QtScriptedStateMachine* machine) - : QtTransition(state),ssm(machine) -{ -} - -/*! - \internal - */ -bool QtScriptedTransition::eventTest(QEvent *e) const -{ - QScriptEngine* engine = ssm->scriptEngine(); - QString ev; - - if (e) { - if (e->type() == QtScriptedEvent::eventType()) { - ev = ((QtScriptedEvent*)e)->eventName(); - } else if (e->type() == QEvent::Type(QEvent::User-2)) { - ev = QString("done.state.") + ((QtStateFinishedEvent*)e)->state()->objectName(); - } - if (!(eventPrefix() == "*" || eventPrefix() == ev || ev.startsWith(eventPrefix()+"."))) - return false; - } - - - if (!conditionExpression().isEmpty()) { - - QScriptValue v = engine->evaluate(conditionExpression(),ssm->baseUrl().toLocalFile()); - if (engine->hasUncaughtException()) { - - qDebug() << engine->uncaughtException().toString(); - QtScriptedEvent* e = new QtScriptedEvent("error.illegalcond", - QStringList()<< "error" << "expr" << "line" << "backtrace", - QVariantList() - << QVariant(engine->uncaughtException().toString()) - << QVariant(conditionExpression()) - << QVariant(engine->uncaughtExceptionLineNumber()) - << QVariant(engine->uncaughtExceptionBacktrace())); - e->metaData.kind = QtScriptedEvent::MetaData::Platform; - ssm->postEvent(e); - engine->clearExceptions(); - return false; - } - return v.toBoolean(); - } - - return true; -} - -class QtSsmDefaultInvoker : public QtSsmInvoker -{ - Q_OBJECT - - public: - QtSsmDefaultInvoker(QtScriptedEvent* ievent, QtScriptedStateMachine* p) : QtSsmInvoker(ievent,p),childSm(0) - { - childSm = QtScriptedStateMachine::load (ievent->metaData.origin.resolved(ievent->metaData.target).toLocalFile(),this); - if (childSm == NULL) { - postParentEvent("error.targetunavailable"); - } else { - connect(childSm,SIGNAL(finished()),this,SLOT(deleteLater())); - - } - - } - - static void initInvokerFactory(QtScriptedStateMachine*) {} - - static bool isTypeSupported(const QString & t) { return t.isEmpty() || t.toLower() == "scxml"; } - - public Q_SLOTS: - void activate () - { - if (childSm) - childSm->start(); - } - - void cancel () - { - if (childSm) - childSm->stop(); - - } - - private: - QtScriptedStateMachine* childSm; -}; -class QtSsmBindingInvoker : public QtSsmInvoker -{ - Q_OBJECT - QScriptValue content; - QScriptValue stored; - - public: - QtSsmBindingInvoker(QtScriptedEvent* ievent, QtScriptedStateMachine* p) : QtSsmInvoker(ievent,p) - { - } - - static void initInvokerFactory(QtScriptedStateMachine*) {} - - static bool isTypeSupported(const QString & t) { return t.toLower() == "q-bindings"; } - - public Q_SLOTS: - void activate () - { - QScriptEngine* engine = ((QtScriptedStateMachine*)parent())->scriptEngine(); - QScriptValue content = initEvent->content(); - if (content.isArray()) { - stored = content.engine()->newArray(content.property("length").toInt32()); - - QScriptValueIterator it (content); - for (int i=0; it.hasNext(); ++i) { - it.next(); - if (it.value().isArray()) { - QScriptValue object = it.value().property(0); - QString property = it.value().property(1).toString(); - QScriptValue val = it.value().property(2); - QScriptValue arr = engine->newArray(3); - arr.setProperty("0",it.value().property(0)); - arr.setProperty("1",it.value().property(1)); - if (object.isQObject()) { - QObject* o = object.toQObject(); - arr.setProperty("2",engine->newVariant(o->property(property.toAscii().constData()))); - o->setProperty(property.toAscii().constData(),val.toVariant()); - } else if (object.isObject()) { - arr.setProperty("2",object.property(property)); - object.setProperty(property,val); - } - stored.setProperty(i,arr); - } - } - } - } - - void cancel () - { - if (stored.isArray()) { - QScriptValueIterator it (stored); - while (it.hasNext()) { - it.next(); - if (it.value().isArray()) { - QScriptValue object = it.value().property(0); - QString property = it.value().property(1).toString(); - QScriptValue val = it.value().property(2); - if (object.isQObject()) { - QObject* o = object.toQObject(); - o->setProperty(property.toAscii().constData(),val.toVariant()); - } else if (object.isObject()) { - object.setProperty(property,val); - } - } - } - } - } -}; - -/*! -\fn QtSsmInvoker::~QtSsmInvoker() -*/ - - -/*! -\fn QtScriptedStateMachine::eventTriggered(const QString & name) - -This signal is emitted when external event \a name is handled in the state machine. -*/ - -/*! - Creates a new QtScriptedStateMachine object, with parent \a parent. - */ - -QtScriptedStateMachine::QtScriptedStateMachine(QObject* parent) - : QtStateMachine(parent) -{ - pvt = new QtScriptedStateMachinePrivate; - pvt->scriptEng = new QScriptEngine(this); - QScriptValue glob = pvt->scriptEng->globalObject(); - QScriptValue utilObj = pvt->scriptEng->newObject(); - glob.setProperty("SMUTIL_clone",pvt->scriptEng->newFunction(QtScriptedStateMachineFunctions::deepCopy)); - glob.setProperty("In",pvt->scriptEng->newFunction(QtScriptedStateMachineFunctions::isInState)); - glob.setProperty("_rcvSig",pvt->scriptEng->newFunction(QtScriptedStateMachineFunctions::receiveSignal)); - glob.setProperty("print",pvt->scriptEng->newFunction(QtScriptedStateMachineFunctions::script_print)); - glob.setProperty("SMUTIL_postEvent",pvt->scriptEng->newFunction(QtScriptedStateMachineFunctions::postEvent)); - glob.setProperty("SMUTIL_invoke",pvt->scriptEng->newFunction(QtScriptedStateMachineFunctions::invoke)); - glob.setProperty("SMUTIL_cssTime",pvt->scriptEng->newFunction(QtScriptedStateMachineFunctions::cssTime)); - glob.setProperty("SMUTIL_stateMachine",pvt->scriptEng->newQObject(this)); - glob.setProperty("setTimeout",pvt->scriptEng->newFunction(QtScriptedStateMachineFunctions::setTimeout)); - glob.setProperty("clearTimeout",pvt->scriptEng->newFunction(QtScriptedStateMachineFunctions::clearTimeout)); - QScriptValue dmObj = pvt->scriptEng->newObject(); - glob.setProperty("_data",pvt->scriptEng->newObject()); - glob.setProperty("_global",pvt->scriptEng->globalObject()); - glob.setProperty("connectSignalToEvent",pvt->scriptEng->evaluate("function(sig,ev) {sig.connect({'e':ev},_rcvSig);}")); - static QtSsmAutoInvokerFactory _s_defaultInvokerFactory; - static QtSsmAutoInvokerFactory _s_bindingInvokerFactory; - registerInvokerFactory(&_s_defaultInvokerFactory); - registerInvokerFactory(&_s_bindingInvokerFactory); - connect(this,SIGNAL(started()),this,SLOT(registerSession())); - connect(this,SIGNAL(stopped()),this,SLOT(unregisterSession())); -#ifdef QT_GUI_LIB - static QtSsmAutoInvokerFactory _s_msgboxInvokerFactory; - static QtSsmAutoInvokerFactory _s_menuInvokerFactory; - registerInvokerFactory(&_s_msgboxInvokerFactory); - registerInvokerFactory(&_s_menuInvokerFactory); -#endif -} - -/*! \internal */ -void QtScriptedStateMachine::beginSelectTransitions(QEvent* ev) -{ - QScriptValue eventObj = pvt->scriptEng->newObject(); - if (ev) { - if (ev->type() == QtScriptedEvent::eventType()) { - QtScriptedEvent* se = (QtScriptedEvent*)ev; - eventObj.setProperty("name",qScriptValueFromValue(pvt->scriptEng,se->eventName())); - eventObj.setProperty("target",qScriptValueFromValue(pvt->scriptEng,QVariant::fromValue(se->metaData.target))); - eventObj.setProperty("targettype",qScriptValueFromValue(pvt->scriptEng,se->metaData.targetType)); - eventObj.setProperty("invokeid",qScriptValueFromValue(pvt->scriptEng,se->metaData.invokeID)); - eventObj.setProperty("origin",QScriptValue(qScriptValueFromValue(pvt->scriptEng,QVariant::fromValue(se->metaData.origin)))); - eventObj.setProperty("originType",qScriptValueFromValue(pvt->scriptEng,se->metaData.originType)); - switch (se->metaData.kind) { - case QtScriptedEvent::MetaData::Internal: - eventObj.setProperty("kind",qScriptValueFromValue(pvt->scriptEng, "internal")); - break; - case QtScriptedEvent::MetaData::External: - eventObj.setProperty("kind",qScriptValueFromValue(pvt->scriptEng, "external")); - break; - case QtScriptedEvent::MetaData::Platform: - eventObj.setProperty("kind",qScriptValueFromValue(pvt->scriptEng, "platform")); - default: - break; - - } - - QScriptValue dataObj = pvt->scriptEng->newObject(); - int i=0; - foreach (QString s, se->paramNames()) { - QScriptValue v = qScriptValueFromValue(pvt->scriptEng, se->paramValues()[i]); - dataObj.setProperty(QString::number(i),v); - dataObj.setProperty(s,v); - ++i; - } - eventObj.setProperty("data",dataObj); - emit eventTriggered(se->eventName()); - } else if (ev->type() == QEvent::Type(QEvent::User-2)) { - QString n = QString("done.state.")+((QtStateFinishedEvent*)ev)->state()->objectName(); - eventObj.setProperty("name",qScriptValueFromValue(pvt->scriptEng, n)); - emit eventTriggered(n); - } - } - scriptEngine()->globalObject().setProperty("_event",eventObj); - - QHash curTargets; - - for (int i = pvt->snapshotStack.size()-1; i >= 0 && curTargets.size() < pvt->anchorTransitions.keys().size(); --i) { - if (!curTargets.contains(pvt->snapshotStack.at(i).anchorType)) { - curTargets[pvt->snapshotStack.at(i).anchorType] = pvt->snapshotStack.at(i).state; - } - } - for (QMultiHash::const_iterator it = pvt->anchorTransitions.constBegin(); it != pvt->anchorTransitions.constEnd(); ++it) { - it.value()->setTargetState(curTargets[it.key()]); - } - -} - -/*! \internal */ -void QtScriptedStateMachine::endMicrostep(QEvent*) -{ - scriptEngine()->globalObject().setProperty("_event",QScriptValue()); - for (QHash::iterator - it = pvt->curSnapshot.begin(); - it != pvt->curSnapshot.end(); ++it) { - - pvt->snapshotStack.push(it.value()); - - } - if (pvt->snapshotStack.size() > QtScriptedStateMachinePrivate::MaxSnapshots) { - pvt->snapshotStack.remove(0,pvt->snapshotStack.size()-100); - } - pvt->curSnapshot.clear(); -} - -/*! Returns the script engine attached to the state-machine. */ -QScriptEngine* QtScriptedStateMachine::scriptEngine () const -{ - return pvt->scriptEng; -} - -/*! - Registers object \a o to the script engine attached to the state machine. - The object can be accessible from global variable \a name. If \a name is not provided, - the object's name is used. If \a recursive is true, all the object's decendants are registered - as global objects, with their respective object names as variable names. -*/ -void QtScriptedStateMachine::registerObject (QObject* o, const QString & name, bool recursive) -{ - QString n(name); - if (n.isEmpty()) - n = o->objectName(); - if (!n.isEmpty()) - pvt->scriptEng->globalObject().setProperty(n,pvt->scriptEng->newQObject(o)); - if (recursive) { - QObjectList ol = o->findChildren(); - foreach (QObject* oo, ol) { - if (!oo->objectName().isEmpty()) - registerObject(oo); - } - } -} - -/*! - Posts a QtScriptedEvent named \a event, with no payload. - \sa QtScriptedEvent - */ -void QtScriptedStateMachine::postNamedEvent(const QString & event) -{ - QtScriptedEvent* e = new QtScriptedEvent(event); - e->metaData.kind = QtScriptedEvent::MetaData::External; - postEvent(e); -} -/*! - Executes script \a s in the attached script engine. - If the script fails, a "error.illegalvalue" event is posted to the state machine. -*/ - -void QtScriptedStateMachine::executeScript (const QString & s) -{ - pvt->scriptEng->evaluate (s,baseUrl().toLocalFile()); - if (pvt->scriptEng->hasUncaughtException()) { - QtScriptedEvent* e = new QtScriptedEvent("error.illegalvalue", - QStringList()<< "error" << "expr" << "line" << "backtrace", - QVariantList() - << QVariant(pvt->scriptEng->uncaughtException().toString()) - << QVariant(s) - << QVariant(pvt->scriptEng->uncaughtExceptionLineNumber()) - << QVariant(pvt->scriptEng->uncaughtExceptionBacktrace())); - e->metaData.kind = QtScriptedEvent::MetaData::Platform; - postEvent(e); - pvt->scriptEng->clearExceptions(); - } -} - -/*! - Enabled invoker factory \a f to be called from tags. - */ - -void QtScriptedStateMachine::registerInvokerFactory (QtSsmInvokerFactory* f) -{ - pvt->invokerFactories << f; - f->init(this); -} - -/*! \class QtSsmInvoker - \brief The QtSsmInvoker class an invoker, which the state-machine context can activate or cancel - with an tag. - - \ingroup sctools - - An invoker is a object that represents an external component that the state machine - can activate when the encompassing state is entered, or cancel when the encompassing - state is exited from. - */ - -/*! \fn QtSsmInvoker::QtSsmInvoker(QtScriptedEvent* ievent, QtStateMachine* parent) - When reimplementing the constructor, always use the two parameters (\a ievent and \a parent), - as they're called from QtSsmInvokerFactory. -*/ - -/*! \fn QtSsmInvoker::activate() - This function is called when the encompassing state is entered. - The call to this function from the state-machine context is asynchronous, to make sure - that the state is not exited during the same step in which it's entered. - -*/ - -/*! \fn QtSsmInvoker::cancel() - Reimplement this function to allow for asynchronous cancellation of the invoker. - It's the invoker's responsibility to delete itself after this function has been called. - The default implementation deletes the invoker. -*/ - -/*! \fn QtScriptedStateMachine* QtSsmInvoker::parentStateMachine() - Returns the state machine encompassing the invoker. - */ - -/*! - Posts an event \a e to the state machine encompassing the invoker. - */ -void QtSsmInvoker::postParentEvent (QtScriptedEvent* e) -{ - e->metaData.origin = initEvent->metaData.target; - e->metaData.target = initEvent->metaData.origin; - e->metaData.originType = initEvent->metaData.targetType; - e->metaData.targetType = initEvent->metaData.originType; - e->metaData.kind = QtScriptedEvent::MetaData::External; - e->metaData.invokeID = initEvent->metaData.invokeID; - parentStateMachine()->postEvent(e); -} -/*! \overload - Posts a QtScriptedEvent named \a e to the encompassing state machine. - */ -void QtSsmInvoker::postParentEvent(const QString & e) -{ - QtScriptedEvent* ev = new QtScriptedEvent(e); - ev->metaData.kind = QtScriptedEvent::MetaData::External; - postParentEvent(ev); -} -/*! \internal */ -QtScriptedStateMachine::~QtScriptedStateMachine() -{ - delete pvt; -} - -QtSsmInvoker::~QtSsmInvoker() -{ - postParentEvent("CancelResponse"); -} -/*! - \property QtScriptedStateMachine::baseUrl - The url used to resolve scripts and invoke urls. -*/ -QUrl QtScriptedStateMachine::baseUrl() const -{ - return pvt->burl; -} - -void QtScriptedStateMachine::setBaseUrl(const QUrl & u) -{ - pvt->burl = u; -} - -void QtScriptedStateMachine::registerSession() -{ - pvt->sessionID = QUuid::createUuid().toString(); - pvt->sessions[pvt->sessionID] = this; - pvt->scriptEng->globalObject().setProperty("_sessionid",qScriptValueFromValue(scriptEngine(), pvt->sessionID)); - executeScript(pvt->startScript); -} - -void QtScriptedStateMachine::unregisterSession() -{ - pvt->scriptEng->globalObject().setProperty("_sessionid",QScriptValue()); - pvt->sessions.remove(pvt->sessionID); -} - -/*! - Returns a statically-generated event type to be used by SCXML events. -*/ -QEvent::Type QtScriptedEvent::eventType() -{ - static QEvent::Type _t = (QEvent::Type)QEvent::registerEventType(QEvent::User+200); - return _t; -} -const char SCXML_NAMESPACE [] = "http://www.w3.org/2005/07/scxml"; - - - -struct ScTransitionInfo -{ - - QtScriptedTransition* transition; - QStringList targets; - QString anchor; - QtStateAction* action; - ScTransitionInfo() : action(0) {} -}; - -struct ScStateInfo -{ - QString initial; -}; - -struct ScHistoryInfo -{ - QtHistoryState* hstate; - QString defaultStateID; -}; - -struct ScExecContext -{ - QtScriptedStateMachine* sm; - QString script; - enum {None, StateEntry,StateExit,Transition } type; - QtScriptedTransition* trans; - QtActionState* state; - ScExecContext() : sm(NULL),type(None),trans(NULL),state(NULL) - { - } - - void applyScript() - { - if (!script.isEmpty()) { - QtStateAction* a = new QtStateInvokeMethodAction(sm,"executeScript",QVariantList()<addEntryAction(a); - break; - case StateExit: - state->addExitAction(a); - break; - case Transition: - trans->addAction(a); - break; - default: - delete a; - break; - } - } - } -}; - -class QtScStreamLoader -{ - public: - QtScriptedStateMachine* stateMachine; - - QList transitions; - QHash stateInfo; - QList historyInfo; - QHash stateByID; - QSet signalEvents; - void loadState (QtState* state, QIODevice* dev, const QString & stateID,const QString & filename); - QtScriptedStateMachine* load (QIODevice* device, QObject* obj = NULL, const QString & filename = ""); - - QScriptValue evaluateFile (const QString & fn) - { - QFile f (fn); - f.open(QIODevice::ReadOnly); - return stateMachine->scriptEngine()->evaluate(QString::fromUtf8(f.readAll()),fn); - } -}; - -class QtStateSaveAnchorAction : public QtStateAction -{ - public: - QtScriptedStateMachine* sm; - QtScriptedStateMachinePrivate* pvt; - QtScriptedStateMachinePrivate::AnchorSnapshot anchorSnapshot; - QtStateSaveAnchorAction(QtScriptedStateMachine* p,QtScriptedStateMachinePrivate* pv, - const QString & type, const QString & loc, - QtAbstractState* s) : - QtStateAction(p),sm(p),pvt(pv) - { - anchorSnapshot.anchorType = type; - anchorSnapshot.location = loc; - anchorSnapshot.state = s; - } - - virtual void execute () - { - if (!anchorSnapshot.location.isEmpty()) { - anchorSnapshot.snapshot = _q_deepCopy(sm->scriptEngine()->evaluate(anchorSnapshot.location)); - } - pvt->curSnapshot[anchorSnapshot.anchorType] = anchorSnapshot; - } -}; - -class QtStateRestoreAnchorAction : public QtStateAction -{ - public: - QtScriptedStateMachine* sm; - QtScriptedStateMachinePrivate* pvt; - QString anchorType; - QtStateRestoreAnchorAction(QtScriptedStateMachine* p,QtScriptedStateMachinePrivate* pv, - const QString & type) : - QtStateAction(p),sm(p),pvt(pv),anchorType(type) - { - - } - - virtual void execute () - { - pvt->curSnapshot.clear(); - while (!pvt->snapshotStack.isEmpty()) { - QtScriptedStateMachinePrivate::AnchorSnapshot s = pvt->snapshotStack.pop(); - if (s.anchorType == anchorType) { - if (s.location != "") { - sm->scriptEngine()->globalObject().setProperty("_snapshot",s.snapshot); - sm->scriptEngine()->evaluate(QString ("%1 = _snapshot;").arg(s.location)); - sm->scriptEngine()->globalObject().setProperty("_snapshot",QScriptValue()); - } - break; - } - } - } -}; - -static QString sanitize (const QString & str) -{ - return QString("eval(unescape(\"%1\"))"). - arg(QString::fromAscii(str.trimmed().toUtf8().toPercentEncoding(QByteArray("[]()<>;:#/'`_-., \t@!^&*{}")))); -} -static QString sanitize (const QStringRef & str) -{ - return sanitize(str.toString()); -} - -void QtScStreamLoader::loadState ( - QtState* stateParam, - QIODevice *dev, - const QString & stateID, - const QString & filename) -{ - QXmlStreamReader r (dev); - QtState* curState = NULL; - ScExecContext curExecContext; - curExecContext.sm = stateMachine; - QtState* topLevelState = NULL; - QtHistoryState* curHistoryState = NULL; - QString initialID = ""; - QString idLocation; - QtScriptedTransition* curTransition = NULL; - bool inRoot = true; - while (!r.atEnd()) { - r.readNext(); - if (r.hasError()) { - qDebug() << QString("SCXML read error at line %1, column %2: %3").arg(r.lineNumber()).arg(r. columnNumber()).arg(r.errorString()); - return; - } - if (r.namespaceUri() == SCXML_NAMESPACE || r.namespaceUri() == "") { - if (r.isStartElement()) { - if (r.name().toString().compare("scxml",Qt::CaseInsensitive) == 0) { - if (stateID == "") { - topLevelState = curState = stateParam; - stateInfo[curState].initial = r.attributes().value("initial").toString(); - if (curState == stateMachine->rootState()) { - stateMachine->scriptEngine()->globalObject().setProperty("_name",qScriptValueFromValue(stateMachine->scriptEngine(),r.attributes().value("name").toString())); - } - - } - } else if (r.name().toString().compare("state",Qt::CaseInsensitive) == 0 || r.name().toString().compare("parallel",Qt::CaseInsensitive) == 0) { - inRoot = false; - QString id = r.attributes().value("id").toString(); - QtState* newState = NULL; - if (curState) { - newState= new QtState(r.name().toString().compare("parallel",Qt::CaseInsensitive) == 0 ? QtState::ParallelGroup : QtState::Normal, - curState); - } else if (id == stateID) { - topLevelState = newState = stateParam; - - } - if (newState) { - stateInfo[newState].initial = r.attributes().value("initial").toString(); - newState->setObjectName(id); - if (!id.isEmpty() && stateInfo[curState].initial == id) { - - if (curState == stateMachine->rootState()) - stateMachine->setInitialState(newState); - else - curState->setInitialState(newState); - } - QString src = r.attributes().value("src").toString(); - if (!src.isEmpty()) { - int refidx = src.indexOf('#'); - QString srcfile, refid; - if (refidx > 0) { - srcfile = src.left(refidx); - refid = src.mid(refidx+1); - } else - srcfile = src; - srcfile = QDir::cleanPath( QFileInfo(filename).dir().absoluteFilePath(srcfile)); - QFile newFile (srcfile); - if (newFile.exists()) { - newFile.open(QIODevice::ReadOnly); - loadState(newState,&newFile,refid,srcfile); - } - } - initialID = r.attributes().value("initial").toString(); - stateByID[id] = newState; - curState = newState; - curExecContext.state = newState; - } - - } else if (r.name().toString().compare("initial",Qt::CaseInsensitive) == 0) { - if (curState && stateInfo[curState].initial == "") { - QtState* newState = new QtState(curState); - curState->setInitialState(newState); - } - } else if (r.name().toString().compare("history",Qt::CaseInsensitive) == 0) { - if (curState) { - QString id = r.attributes().value("id").toString(); - curHistoryState = curState->addHistoryState(r.attributes().value("type") == "shallow" ? QtState::ShallowHistory : QtState::DeepHistory); - curHistoryState->setObjectName(id); - stateByID[id] = curHistoryState; - } - } else if (r.name().toString().compare("final",Qt::CaseInsensitive) == 0) { - if (curState) { - QString id = r.attributes().value("id").toString(); - QtFinalState* f = new QtFinalState(curState); - f->setObjectName(id); - curExecContext.state = f; - stateByID[id] = f; - } - } else if (r.name().toString().compare("script",Qt::CaseInsensitive) == 0) { - QString txt = r.readElementText().trimmed(); - if (curExecContext.type == ScExecContext::None && curState == topLevelState) { - stateMachine->executeScript(txt); - } else - curExecContext.script += txt; - } else if (r.name().toString().compare("log",Qt::CaseInsensitive) == 0) { - curExecContext.script += - QString("print('[' + %1 + '][' + %2 + ']' + %3)") - .arg(sanitize(r.attributes().value("label"))) - .arg(sanitize(r.attributes().value("level"))) - .arg(sanitize(r.attributes().value("expr"))); - - } else if (r.name().toString().compare("assign",Qt::CaseInsensitive) == 0) { - QString locattr = r.attributes().value("location").toString(); - if (locattr.isEmpty()) { - locattr = r.attributes().value("dataid").toString(); - if (!locattr.isEmpty()) - locattr = "_data." + locattr; - } - if (!locattr.isEmpty()) { - curExecContext.script += QString ("%1 = %2;").arg(locattr).arg(sanitize(r.attributes().value("expr"))); - } - } else if (r.name().toString().compare("if",Qt::CaseInsensitive) == 0) { - curExecContext.script += QString("if (%1) {").arg(sanitize(r.attributes().value("cond"))); - } else if (r.name().toString().compare("elseif",Qt::CaseInsensitive) == 0) { - curExecContext.script += QString("} elseif (%1) {").arg(sanitize(r.attributes().value("cond"))); - } else if (r.name().toString().compare("else",Qt::CaseInsensitive) == 0) { - curExecContext.script += " } else { "; - } else if (r.name().toString().compare("cancel",Qt::CaseInsensitive) == 0) { - curExecContext.script += QString("clearTimeout (%1)").arg(sanitize(r.attributes().value("id"))); - } else if (r.name().toString().compare("onentry",Qt::CaseInsensitive) == 0) { - curExecContext.type = ScExecContext::StateEntry; - curExecContext.script = ""; - } else if (r.name().toString().compare("onexit",Qt::CaseInsensitive) == 0) { - curExecContext.type = ScExecContext::StateExit; - curExecContext.script = ""; - } else if (r.name().toString().compare("raise",Qt::CaseInsensitive) == 0 || r.name().toString().compare("event",Qt::CaseInsensitive) == 0 ) { - QString ev = r.attributes().value("event").toString(); - if (ev.isEmpty()) - ev = r.attributes().value("name").toString(); - curExecContext.script += - QString("{" - "var paramNames = []; var paramValues = []; " - "var content = ''; var eventName='%1'; " - "var target = '_internal'; var targetType = 'scxml'; ").arg(ev); - - } else if (r.name().toString().compare("send",Qt::CaseInsensitive) == 0) { - QString type = r.attributes().value("type").toString(); - if (type.isEmpty()) - type = r.attributes().value("targettype").toString(); - curExecContext.script += - QString("{" - "var paramNames = [%1]; var paramValues = []; " - "var content = ''; var eventName=%2; " - "var targetType = %3; var target = %4;") - .arg(r.attributes().value("namelist").toString().replace(" ",",")) - .arg(sanitize(r.attributes().value("event").toString())) - .arg(type.isEmpty() ? "'scxml'" : sanitize(r.attributes().value("type"))) - .arg(r.attributes().value("target").length() ? sanitize(r.attributes().value("target")) : "''"); - idLocation = r.attributes().value("idlocation").toString(); - if (idLocation.isEmpty()) - idLocation = r.attributes().value("sendid").toString(); - - curExecContext.script += QString("var delay = %1; ").arg(r.attributes().value("delay").length() - ? QString("SMUTIL_cssTime(%1)").arg(sanitize(r.attributes().value("delay"))) - : "0"); - } else if (r.name().toString().compare("invoke",Qt::CaseInsensitive) == 0) { - idLocation = r.attributes().value("idlocation").toString(); - if (idLocation.isEmpty()) - idLocation = r.attributes().value("invokeid").toString(); - curState->addExitAction(new QtStateInvokeMethodAction(stateMachine,"executeScript",QVariantList() << - QString("invoke_%1.cancel();").arg(curState->objectName()))); - - QString type = r.attributes().value("type").toString(); - if (type.isEmpty()) - type = r.attributes().value("targettype").toString(); - curExecContext.type = ScExecContext::StateEntry; - curExecContext.state = curState; - curExecContext.script = - QString("{" - "var paramNames = []; var paramValues = []; " - "var content = ''; " - "var srcType = \"%1\"; var src = %2;") - .arg(type.length() ? type : "scxml") - .arg(r.attributes().value("src").length() ? sanitize(r.attributes().value("target")) : "\"\""); - - - } else if (r.name().toString().compare("transition",Qt::CaseInsensitive) == 0) { - if (curHistoryState) { - ScHistoryInfo inf; - inf.hstate = curHistoryState; - inf.defaultStateID = r.attributes().value("target").toString(); - historyInfo.append(inf); - } else { - ScTransitionInfo inf; - inf.targets = r.attributes().value("target").toString().split(' '); - curExecContext.type = ScExecContext::Transition; - curExecContext.script = ""; - curTransition = new QtScriptedTransition(curState,stateMachine); - curTransition->setConditionExpression(r.attributes().value("cond").toString()); - curTransition->setEventPrefix(r.attributes().value("event").toString()); - curExecContext.trans = curTransition; - QString anc = r.attributes().value("anchor").toString(); - if (!anc.isEmpty()) { - stateMachine->pvt->anchorTransitions.insert(anc,curTransition); - curTransition->addAction(new QtStateRestoreAnchorAction(stateMachine,stateMachine->pvt,anc)); - } - inf.transition = curTransition; - transitions.append(inf); - if (curTransition->eventPrefix().startsWith("q-signal:")) { - signalEvents.insert(curTransition->eventPrefix()); - } - curTransition->setObjectName(QString ("%1 to %2 on %3 if %4 (anchor=%5)").arg(curState->objectName()).arg(inf.targets.join(" ")).arg(curTransition->eventPrefix()).arg(curTransition->conditionExpression()).arg(anc)); - } - } else if (r.name().toString().compare("anchor",Qt::CaseInsensitive) == 0) { - curState->addExitAction(new QtStateSaveAnchorAction(stateMachine,stateMachine->pvt,r.attributes().value("type").toString(),r.attributes().value("snapshot").toString(),curState)); - } else if (r.name().toString().compare("data",Qt::CaseInsensitive) == 0) { - QScriptValue val = qScriptValueFromValue(stateMachine->scriptEngine(),"") ; - QString id = r.attributes().value("id").toString(); - if (r.attributes().value("src").length()) - val = evaluateFile(QFileInfo(filename).dir().absoluteFilePath(r.attributes().value("src").toString())); - else { - if (r.attributes().value("expr").length()) { - val = stateMachine->scriptEngine()->evaluate(r.attributes().value("expr").toString()); - } else { - QString t = r.readElementText(); - if (!t.isEmpty()) - val = stateMachine->scriptEngine()->evaluate(t); - } - } - stateMachine->scriptEngine()->evaluate("_data") - .setProperty(id,val); - } else if (r.name().toString().compare("param",Qt::CaseInsensitive) == 0) { - curExecContext.script += - QString("paramNames[paramNames.length] = \"%1\";") - .arg(r.attributes().value("name").toString()); - curExecContext.script += - QString("paramValues[paramValues.length] = %1;") - .arg(sanitize(r.attributes().value("expr"))); - - } else if (r.name().toString().compare("content",Qt::CaseInsensitive) == 0) { - curExecContext.script += QString("content = %1; ").arg(sanitize(r.readElementText())); - } - } else if (r.isEndElement()) { - if (r.name().toString().compare("state",Qt::CaseInsensitive) == 0 || r.name().toString().compare("parallel",Qt::CaseInsensitive) == 0) { - if (curState == topLevelState) { - return; - } else { - curState = qobject_cast(curState->parent()); - curExecContext.state = curState; - } - } else if (r.name().toString().compare("history",Qt::CaseInsensitive) == 0) { - curHistoryState = NULL; - } else if (r.name().toString().compare("final",Qt::CaseInsensitive) == 0) { - curExecContext.state = (QtActionState*)curExecContext.state->parent(); - } else if (r.name().toString().compare("send",Qt::CaseInsensitive) == 0) { - if (!idLocation.isEmpty()) - curExecContext.script += idLocation + " = "; - curExecContext.script += QString("setTimeout(function() { " - "SMUTIL_postEvent(" - "eventName,target,targetType,paramNames,paramValues,content" - ");" - "}, delay); }"); - idLocation = ""; - } else if (r.name().toString().compare("raise",Qt::CaseInsensitive) == 0) { - curExecContext.script += "SMUTIL_postEvent(eventName,target,targetType,paramNames,paramValues,content); }"; - } else if ( - r.name().toString().compare("onentry",Qt::CaseInsensitive) == 0 - || r.name().toString().compare("onexit",Qt::CaseInsensitive) == 0 - || r.name().toString().compare("scxml",Qt::CaseInsensitive) == 0) { - curExecContext.state = curState; - curExecContext.type = r.name().toString().compare("onexit",Qt::CaseInsensitive)==0 ? ScExecContext::StateExit : ScExecContext::StateEntry; - curExecContext.applyScript(); - curExecContext.type = ScExecContext::None; - } else if (r.name().toString().compare("transition",Qt::CaseInsensitive) == 0) { - if (!curHistoryState) { - curExecContext.trans = curTransition; - curExecContext.type = ScExecContext::Transition; - curExecContext.applyScript(); - } - - ScTransitionInfo* ti = &(transitions.last()); - if (!curExecContext.script.isEmpty() && ti->anchor != "") - ti->action = new QtStateInvokeMethodAction(stateMachine,"executeScript",QVariantList() << curExecContext.script); - curExecContext.type = ScExecContext::None; - } else if (r.name().toString().compare("invoke",Qt::CaseInsensitive) == 0) { - curExecContext.script += QString("invoke_%1 = SMUTIL_invoke(srcType,src,paramNames,paramValues,content); }").arg(curState->objectName()); - if (!idLocation.isEmpty()) { - curExecContext.script += QString("%1 = invoke_%2;").arg(idLocation).arg(curState->objectName()); - } - curExecContext.state = curState; - curExecContext.type = ScExecContext::StateEntry; - curExecContext.applyScript(); - idLocation = ""; - curExecContext.type = ScExecContext::None; - } - } - } - } -} - - -QtScriptedStateMachine* QtScStreamLoader::load(QIODevice* device, QObject* obj, const QString & filename) -{ - stateMachine = new QtScriptedStateMachine(obj); - // traverse through the states - loadState(stateMachine->rootState(),device,"",filename); - - // resolve history default state - foreach (ScHistoryInfo h, historyInfo) { - h.hstate->setDefaultState(stateByID[h.defaultStateID]); - } - foreach (QString s, signalEvents) { - QString sig = s; - sig = sig.mid(sig.indexOf(':')+1); - sig = sig.left(sig.indexOf('(')); - QString scr = QString("%1.connect({e:\"%2\"},_rcvSig);\n").arg(sig).arg(s); - stateMachine->pvt->startScript += scr; - } - - // resolve transitions - - foreach (ScTransitionInfo t, transitions) { - QList states; - if (!t.targets.isEmpty()) { - foreach (QString s, t.targets) { - if (!s.trimmed().isEmpty()) { - QtAbstractState* st = stateByID[s]; - if (st) - states.append(st); - } - } - t.transition->setTargetStates(states); - } - } - - return stateMachine; -} - -/*! - Loads a state machine from an scxml file located at \a filename, with parent object \a o. - */ -QtScriptedStateMachine* QtScriptedStateMachine::load (const QString & filename, QObject* o) -{ - QtScStreamLoader l; - QFile f (filename); - f.open(QIODevice::ReadOnly); - return l.load(&f,o,filename); -} - -#include "qscriptedstatemachine.moc" diff --git a/lib/qtstatemachine/src/qscriptedstatemachine.h b/lib/qtstatemachine/src/qscriptedstatemachine.h deleted file mode 100644 index 3d9d9a3..0000000 --- a/lib/qtstatemachine/src/qscriptedstatemachine.h +++ /dev/null @@ -1,207 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - - -#ifndef QSCRIPTEDSTATEMACHINE_H -#define QSCRIPTEDSTATEMACHINE_H -#ifndef QT_NO_SCRIPT -#include "qstatemachine.h" -#include "qstateaction.h" -#include "qtransition.h" -#include "qstate.h" -#include -#include -#include -#include -#include - -#ifndef Q_SCTOOLS_EXPORT -#define Q_SCTOOLS_EXPORT Q_STATEMACHINE_CORE_EXPORT -#endif - -class QScriptEngine; -class QtScriptedStateMachine; -class QSignalMapper; -class Q_SCTOOLS_EXPORT QtScriptedEvent : public QEvent -{ - public: - static QEvent::Type eventType(); - QString eventName() const; - QStringList paramNames () const; - QVariantList paramValues () const; - QScriptValue content () const; - QVariant param (const QString & name) const; - QtScriptedEvent ( - const QString & name, - const QStringList & paramNames = QStringList(), - const QVariantList & paramValues = QVariantList(), - const QScriptValue & content = QScriptValue()); - - struct MetaData - { - QUrl origin,target; - QString originType, targetType; - QString invokeID; - enum Kind { Platform, Internal, External } kind; - }; - - MetaData metaData; - - private: - QString ename; - QStringList pnames; - QVariantList pvals; - QScriptValue cnt; -}; - - -class Q_SCTOOLS_EXPORT QtScriptedTransition : public QtTransition -{ - Q_OBJECT - Q_PROPERTY(QString conditionExpression READ conditionExpression WRITE setConditionExpression) - Q_PROPERTY(QString eventPrefix READ eventPrefix WRITE setEventPrefix) - - public: - QtScriptedTransition (QtState* state, QtScriptedStateMachine* machine); - - QString conditionExpression () const { return cond; } - void setConditionExpression (const QString & c) { cond = c; } - QString eventPrefix () const { return ev; } - void setEventPrefix (const QString & e) { ev = e; } - - protected: - bool eventTest(QEvent*) const; - private: - QtScriptedStateMachine* ssm; - QString ev,cond; -}; - -class Q_SCTOOLS_EXPORT QtSsmInvoker : public QObject -{ - Q_OBJECT - - protected: - QtSsmInvoker(QtScriptedEvent* ievent, QtStateMachine* p) : QObject(p), initEvent(ievent) {} - - public: - virtual ~QtSsmInvoker(); - - public Q_SLOTS: - virtual void activate() = 0; - virtual void cancel() { deleteLater(); } - - protected Q_SLOTS: - void postParentEvent (const QString & event); - - protected: - QtScriptedStateMachine* parentStateMachine() { return (QtScriptedStateMachine*)parent(); } - void postParentEvent (QtScriptedEvent* ev); - QtScriptedEvent* initEvent; - - friend struct QtScriptedStateMachineFunctions; -}; - -struct Q_SCTOOLS_EXPORT QtSsmInvokerFactory -{ - virtual QtSsmInvoker* createInvoker (QtScriptedEvent* event, QtScriptedStateMachine* stateMachine) = 0; - virtual bool isTypeSupported (const QString & type) const = 0; - virtual void init (QtScriptedStateMachine*) = 0; -}; - -template -class Q_SCTOOLS_EXPORT QtSsmAutoInvokerFactory : public QtSsmInvokerFactory -{ - QtSsmInvoker* createInvoker (QtScriptedEvent* _e, QtScriptedStateMachine* _sm) { return new T(_e,_sm); } - bool isTypeSupported(const QString & _s) const { return T::isTypeSupported(_s); } - void init (QtScriptedStateMachine* sm) { T::initInvokerFactory(sm); } -}; - - -class Q_SCTOOLS_EXPORT QtScriptedStateMachine : public QtStateMachine -{ - Q_OBJECT - - Q_PROPERTY(QUrl baseUrl READ baseUrl WRITE setBaseUrl) - - - public: - QtScriptedStateMachine(QObject* o = NULL); - virtual ~QtScriptedStateMachine(); - protected: - // overloaded to store the event for the script environment's use (_event), and to convert - // StateFinished events to "done." named events - virtual void beginSelectTransitions(QEvent*); - virtual void endMicrostep(QEvent*); - - public: - QScriptEngine* scriptEngine () const; - void registerObject (QObject* object, const QString & name = QString(), bool recursive = false); - void registerInvokerFactory (QtSsmInvokerFactory* f); - void setBaseUrl (const QUrl &); - QUrl baseUrl () const; - static QtScriptedStateMachine* load (const QString & filename, QObject* o = NULL); - - public Q_SLOTS: - void postNamedEvent(const QString &); - void executeScript (const QString &); - - private Q_SLOTS: - void registerSession(); - void unregisterSession(); - - Q_SIGNALS: - void eventTriggered(const QString &); - - - - private: - class QtScriptedStateMachinePrivate* pvt; - friend class QtScStreamLoader; - friend struct QtScriptedStateMachineFunctions; -}; - -#endif -#endif // QtScriptedSTATEMACHINE_H diff --git a/lib/qtstatemachine/src/qsignalevent.h b/lib/qtstatemachine/src/qsignalevent.h deleted file mode 100644 index a3ee7d3..0000000 --- a/lib/qtstatemachine/src/qsignalevent.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QSIGNALEVENT_H -#define QSIGNALEVENT_H - -#include "qtstatemachineglobal.h" -#include - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Core) - -class Q_STATEMACHINE_CORE_EXPORT QtSignalEvent : public QEvent -{ -public: - QtSignalEvent(const QObject *sender, int signalIndex, - const QList &arguments); - ~QtSignalEvent(); - - inline const QObject *sender() const { return m_sender; } - inline int signalIndex() const { return m_signalIndex; } - inline QList arguments() const { return m_arguments; } - -private: - const QObject *m_sender; - int m_signalIndex; - QList m_arguments; -}; - -QT_END_NAMESPACE - -#endif diff --git a/lib/qtstatemachine/src/qsignaleventgenerator_p.h b/lib/qtstatemachine/src/qsignaleventgenerator_p.h deleted file mode 100644 index 1b411a0..0000000 --- a/lib/qtstatemachine/src/qsignaleventgenerator_p.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QSIGNALEVENTGENERATOR_P_H -#define QSIGNALEVENTGENERATOR_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -QT_BEGIN_NAMESPACE - -class QtStateMachine; - -class QtSignalEventGenerator : public QObject -{ -public: - QtSignalEventGenerator( -#ifdef QT_STATEMACHINE_SOLUTION - int signalIndex, -#endif - QtStateMachine *parent); - - static const QMetaObject staticMetaObject; - virtual const QMetaObject *metaObject() const; - virtual void *qt_metacast(const char *); - virtual int qt_metacall(QMetaObject::Call, int, void **argv); - -private: -#ifdef QT_STATEMACHINE_SOLUTION - int signalIndex; -#endif - Q_DISABLE_COPY(QtSignalEventGenerator) -}; - -QT_END_NAMESPACE - -#endif diff --git a/lib/qtstatemachine/src/qsignaltransition.cpp b/lib/qtstatemachine/src/qsignaltransition.cpp deleted file mode 100644 index ec74e31..0000000 --- a/lib/qtstatemachine/src/qsignaltransition.cpp +++ /dev/null @@ -1,258 +0,0 @@ -/**************************************************************************** -** -** This file is 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 "qsignaltransition.h" -#include "qsignaltransition_p.h" -#include "qsignalevent.h" -#include "qstate.h" -#include "qstate_p.h" -#include "qstatemachine.h" -#include "qstatemachine_p.h" -#include - -QT_BEGIN_NAMESPACE - -/*! - \class QtSignalTransition - - \brief The QtSignalTransition class provides a transition based on a Qt signal. - - \since 4.6 - \ingroup statemachine - - Typically you would use the overload of QtState::addTransition() that takes a - sender and signal as arguments, rather than creating QtSignalTransition - objects directly. QtSignalTransition is part of \l{The State Machine - Framework}. - - You can subclass QtSignalTransition and reimplement eventTest() to make a - signal transition conditional; the event object passed to eventTest() will - be a QtSignalEvent object. Example: - - \code - class CheckedTransition : public QtSignalTransition - { - public: - CheckedTransition(QCheckBox *check) - : QtSignalTransition(check, SIGNAL(stateChanged(int))) {} - protected: - bool eventTest(QEvent *e) const { - if (!QtSignalTransition::eventTest(e)) - return false; - QtSignalEvent *se = static_cast(e); - return (se->arguments().at(0).toInt() == Qt::Checked); - } - }; - - ... - - QCheckBox *check = new QCheckBox(); - check->setTristate(true); - - QtState *s1 = new QtState(); - QtState *s2 = new QtState(); - CheckedTransition *t1 = new CheckedTransition(check); - t1->setTargetState(s2); - s1->addTransition(t1); - \endcode -*/ - -/*! - \property QtSignalTransition::object - - \brief the sender object that this signal transition is associated with -*/ - -/*! - \property QtSignalTransition::signal - - \brief the signal that this signal transition is associated with -*/ - -QtSignalTransitionPrivate::QtSignalTransitionPrivate() -{ - sender = 0; - signalIndex = -1; -} - -QtSignalTransitionPrivate *QtSignalTransitionPrivate::get(QtSignalTransition *q) -{ - return q->d_func(); -} - -void QtSignalTransitionPrivate::invalidate() -{ - Q_Q(QtSignalTransition); - if (signalIndex != -1) { - QtState *source = sourceState(); - QtStatePrivate *source_d = QtStatePrivate::get(source); - QtStateMachinePrivate *mach = QtStateMachinePrivate::get(source_d->machine()); - if (mach) { - mach->unregisterSignalTransition(q); - if (mach->configuration.contains(source)) - mach->registerSignalTransition(q); - } - } -} - -/*! - Constructs a new signal transition with the given \a sourceState. -*/ -QtSignalTransition::QtSignalTransition(QtState *sourceState) - : QtTransition(*new QtSignalTransitionPrivate, sourceState) -{ -} - -/*! - Constructs a new signal transition associated with the given \a signal of - the given \a sender, and with the given \a sourceState. -*/ -QtSignalTransition::QtSignalTransition(QObject *sender, const char *signal, - QtState *sourceState) - : QtTransition(*new QtSignalTransitionPrivate, sourceState) -{ - Q_D(QtSignalTransition); - d->sender = sender; - d->signal = signal; -} - -/*! - Constructs a new signal transition associated with the given \a signal of - the given \a sender. The transition has the given \a targets and \a - sourceState. -*/ -QtSignalTransition::QtSignalTransition(QObject *sender, const char *signal, - const QList &targets, - QtState *sourceState) - : QtTransition(*new QtSignalTransitionPrivate, targets, sourceState) -{ - Q_D(QtSignalTransition); - d->sender = sender; - d->signal = signal; -} - -/*! - Destroys this signal transition. -*/ -QtSignalTransition::~QtSignalTransition() -{ -} - -/*! - Returns the sender object associated with this signal transition. -*/ -QObject *QtSignalTransition::senderObject() const -{ - Q_D(const QtSignalTransition); - return d->sender; -} - -/*! - Sets the \a sender object associated with this signal transition. -*/ -void QtSignalTransition::setSenderObject(QObject *sender) -{ - Q_D(QtSignalTransition); - if (sender == d->sender) - return; - d->sender = sender; - d->invalidate(); -} - -/*! - Returns the signal associated with this signal transition. -*/ -QByteArray QtSignalTransition::signal() const -{ - Q_D(const QtSignalTransition); - return d->signal; -} - -/*! - Sets the \a signal associated with this signal transition. -*/ -void QtSignalTransition::setSignal(const QByteArray &signal) -{ - Q_D(QtSignalTransition); - if (signal == d->signal) - return; - d->signal = signal; - d->invalidate(); -} - -/*! - \reimp - - The \a event is a QtSignalEvent object. The default implementation returns - true if the event's sender and signal index match this transition, and - returns false otherwise. -*/ -bool QtSignalTransition::eventTest(QEvent *event) const -{ - Q_D(const QtSignalTransition); -#ifndef QT_STATEMACHINE_SOLUTION - if (event->type() == QEvent::Signal) { -#else - if (event->type() == QEvent::Type(QEvent::User-1)) { -#endif - if (d->signalIndex == -1) - return false; - QtSignalEvent *se = static_cast(event); - return (se->sender() == d->sender) - && (se->signalIndex() == d->signalIndex); - } - return false; -} - -/*! - \reimp -*/ -bool QtSignalTransition::event(QEvent *e) -{ - return QtTransition::event(e); -} - -QT_END_NAMESPACE diff --git a/lib/qtstatemachine/src/qsignaltransition.h b/lib/qtstatemachine/src/qsignaltransition.h deleted file mode 100644 index 7542227..0000000 --- a/lib/qtstatemachine/src/qsignaltransition.h +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QSIGNALTRANSITION_H -#define QSIGNALTRANSITION_H - -#include "qtstatemachineglobal.h" -#ifndef QT_STATEMACHINE_SOLUTION -#include -#else -#include "qtransition.h" -#endif - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Core) - -class QtSignalTransitionPrivate; -class Q_STATEMACHINE_CORE_EXPORT QtSignalTransition : public QtTransition -{ - Q_OBJECT - Q_PROPERTY(QObject* object READ senderObject WRITE setSenderObject) - Q_PROPERTY(QByteArray signal READ signal WRITE setSignal) -public: - QtSignalTransition(QtState *sourceState = 0); - QtSignalTransition(QObject *sender, const char *signal, - QtState *sourceState = 0); - QtSignalTransition(QObject *sender, const char *signal, - const QList &targets, - QtState *sourceState = 0); - ~QtSignalTransition(); - - QObject *senderObject() const; - void setSenderObject(QObject *sender); - - QByteArray signal() const; - void setSignal(const QByteArray &signal); - -protected: - bool eventTest(QEvent *event) const; - - bool event(QEvent *e); - -private: - Q_DISABLE_COPY(QtSignalTransition) - Q_DECLARE_PRIVATE(QtSignalTransition) -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/lib/qtstatemachine/src/qsignaltransition_p.h b/lib/qtstatemachine/src/qsignaltransition_p.h deleted file mode 100644 index c64785d..0000000 --- a/lib/qtstatemachine/src/qsignaltransition_p.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QSIGNALTRANSITION_P_H -#define QSIGNALTRANSITION_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qtransition_p.h" - -QT_BEGIN_NAMESPACE - -class QtSignalTransition; -class QtSignalTransitionPrivate : public QtTransitionPrivate -{ - Q_DECLARE_PUBLIC(QtSignalTransition) -public: - QtSignalTransitionPrivate(); - - static QtSignalTransitionPrivate *get(QtSignalTransition *q); - - void invalidate(); - - QObject *sender; - QByteArray signal; - int signalIndex; -}; - -QT_END_NAMESPACE - -#endif diff --git a/lib/qtstatemachine/src/qssmguiinvokers.cpp b/lib/qtstatemachine/src/qssmguiinvokers.cpp deleted file mode 100644 index 0cfea58..0000000 --- a/lib/qtstatemachine/src/qssmguiinvokers.cpp +++ /dev/null @@ -1,217 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -/**************************************************************************** -** -** This file is 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 "qssmguiinvokers_p.h" -#include -#include -#include -#include -#include -#include -/* - - { "parent" : parentObject, - "trackHovers" : true/false - "children": {{"type": "action", "text": "",}, - {"type": "menu"}, - {"type": "separator"} }, - */ -namespace -{ - void traverseMenu (QMenu* menu, QScriptValue value, QSignalMapper* clickMap, QSignalMapper* hoverMap, bool trackHover) - { - QScriptValueIterator it (value); - while (it.hasNext()) { - it.next(); - if (it.name() == "trackHover") { - trackHover = it.value().toBoolean(); - } else if (it.name() == "parent") { - } else if (it.name() == "children") { - QScriptValueIterator cit (it.value()); - while (cit.hasNext()) { - cit.next(); - QString type = cit.value().property("type").toString(); - if (type == "action") { - QAction* act = menu->addAction(""); - QScriptValueIterator ait (cit.value()); - while (ait.hasNext()) { - ait.next(); - if (ait.name() != "type") { - act->setProperty(ait.name().toAscii().constData(),ait.value().toVariant()); - } - } - QObject::connect(act,SIGNAL(triggered()),clickMap,SLOT(map())); - clickMap->setMapping(act,QString("menu.action." + cit.value().property("id").toString())); - if (trackHover) { - QObject::connect(act,SIGNAL(hovered()),hoverMap,SLOT(map())); - hoverMap->setMapping(act,QString("menu.hover." + cit.value().property("id").toString())); - } - } else if (type == "menu") { - traverseMenu(menu->addMenu(""),it.value(),clickMap,hoverMap,trackHover); - } else if (type == "separator") { - menu->addSeparator(); - } - } - } else { - menu->setProperty(it.name().toAscii().constData(),it.value().toVariant()); - } - } - } -}; - -void QtSsmMenuInvoker::activate () -{ - QtScriptedEvent* ie = initEvent; - QScriptValue v = ie->content(); - QWidget* parent = qobject_cast(v.property("parent").toQObject()); - menu = new QMenu(parent); - QSignalMapper* clickMap = new QSignalMapper(this); - QSignalMapper* hoverMap = new QSignalMapper(this); - connect (clickMap,SIGNAL(mapped(QString)), this, SLOT(postParentEvent(QString))); - connect (hoverMap,SIGNAL(mapped(QString)), this, SLOT(postParentEvent(QString))); - traverseMenu(menu,v,clickMap,hoverMap,false); - menu->setParent(parent,Qt::Widget); - menu->move(QPoint(0,0)); - menu->resize(parent->size()); - menu->show(); -} -void QtSsmMenuInvoker::cancel () -{ - if (menu) - menu->deleteLater(); - QtSsmInvoker::cancel(); -} - -Q_SCRIPT_DECLARE_QMETAOBJECT(QMenu,QWidget*) -Q_SCRIPT_DECLARE_QMETAOBJECT(QMessageBox,QWidget*) - void QtSsmMenuInvoker::initInvokerFactory(QtScriptedStateMachine* sm) - { - QScriptEngine* se = sm->scriptEngine(); - se->globalObject().setProperty("QMenu",qScriptValueFromQMetaObject(se)); - } - void QtSsmMessageBoxInvoker::initInvokerFactory(QtScriptedStateMachine* sm) - { - QScriptEngine* se = sm->scriptEngine(); - se->globalObject().setProperty("QMessageBox",qScriptValueFromQMetaObject(se)); - } - -void QtSsmMessageBoxInvoker::onFinished(int n) { - postParentEvent(new QtScriptedEvent("q-messagebox.finished",QStringList()<<"result",QVariantList()<content(); - QWidget* parent = qobject_cast(v.property("parent").toQObject()); - messageBox = new QMessageBox(parent); - messageBox->setModal(false); - QScriptValueIterator it (v); - while (it.hasNext()) { - it.next(); - if (it.name() == "standardButtons") { - messageBox->setStandardButtons((QMessageBox::StandardButtons)it.value().toInt32()); - } else if (it.name() == "icon") { - messageBox->setIcon((QMessageBox::Icon)it.value().toInt32()); - } else if (it.name() != "parent") { - messageBox->setProperty(it.name().toAscii().constData(),it.value().toVariant()); - } - } - connect(messageBox,SIGNAL(finished(int)),this,SLOT(onFinished(int))); - messageBox->show (); -} - -void QtSsmMessageBoxInvoker::cancel() -{ - messageBox->deleteLater(); - QtSsmInvoker::cancel(); -} diff --git a/lib/qtstatemachine/src/qssmguiinvokers_p.h b/lib/qtstatemachine/src/qssmguiinvokers_p.h deleted file mode 100644 index 5338a81..0000000 --- a/lib/qtstatemachine/src/qssmguiinvokers_p.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QSSMGUIINVOKERS_P_H -#define QSSMGUIINVOKERS_P_H - -#include "qscriptedstatemachine.h" -class QMenu; -class QMessageBox; - -class QtSsmMenuInvoker: public QtSsmInvoker -{ - Q_OBJECT - - public: - QtSsmMenuInvoker(QtScriptedEvent* ievent, QtScriptedStateMachine* p) : QtSsmInvoker(ievent,p),menu(0) - { - } - static void initInvokerFactory(QtScriptedStateMachine*); - static bool isTypeSupported (const QString & s) { return s== "q-menu"; } - public Q_SLOTS: - void activate (); - void cancel (); - - private: - QMenu* menu; -}; - - -class QtSsmMessageBoxInvoker: public QtSsmInvoker -{ - Q_OBJECT - - public: - QtSsmMessageBoxInvoker(QtScriptedEvent* ievent, QtScriptedStateMachine* p) : QtSsmInvoker(ievent,p),messageBox(0) - { - } - - static void initInvokerFactory(QtScriptedStateMachine*); - static bool isTypeSupported (const QString & s) { return s== "q-messagebox"; } - public Q_SLOTS: - void activate (); - void cancel (); - - private Q_SLOTS: - void onFinished (int); - private: - QMessageBox* messageBox; -}; - -#endif // QSSMGUIINVOKERS_P_H diff --git a/lib/qtstatemachine/src/qstate.cpp b/lib/qtstatemachine/src/qstate.cpp deleted file mode 100644 index bb5ad28..0000000 --- a/lib/qtstatemachine/src/qstate.cpp +++ /dev/null @@ -1,439 +0,0 @@ -/**************************************************************************** -** -** This file is 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 "qstate.h" -#include "qstate_p.h" -#include "qhistorystate.h" -#include "qhistorystate_p.h" -#include "qabstracttransition.h" -#include "qabstracttransition_p.h" -#include "qsignaltransition.h" -#include "qstatefinishedtransition.h" -#include "qstatemachine.h" -#include "qstatemachine_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QtState - - \brief The QtState class provides a general-purpose state for QtStateMachine. - - \since 4.6 - \ingroup statemachine - - QtState objects can have child states, and can have transitions to other - states. QtState is part of \l{The State Machine Framework}. - - The addTransition() function adds a transition. The removeTransition() - function removes a transition. - - \section1 States with Child States - - For non-parallel state groups, the setInitialState() function must be called - to set the initial state. The child states are mutually exclusive states, - and the state machine needs to know which child state to enter when the - parent state is the target of a transition. - - The addHistoryState() function adds a history state. - - The addFinishedTransition() function creates and adds a transition that's - triggered when a final child state is entered. - - The setErrorState() sets the state's error state. The error state is the - state that the state machine will transition to if an error is detected when - attempting to enter the state (e.g. because no initial state has been set). -*/ - -/*! - \enum QtState::Type - - This enum specifies the type of a state. - - \value Normal A normal state. If the state has no child states, it is an - atomic state; otherwise, the child states are mutually exclusive and an - initial state must be set by calling QtState::setInitialState(). - - \value ParallelGroup The state is a parallel group state. When a parallel - group state is entered, all its child states are entered in parallel. -*/ - -/*! - \enum QtState::HistoryType - - This enum specifies the type of history that a QtHistoryState records. - - \value ShallowHistory Only the immediate child states of the parent state - are recorded. In this case a transition with the history state as its - target will end up in the immediate child state that the parent was in the - last time it was exited. This is the default. - - \value DeepHistory Nested states are recorded. In this case a transition - with the history state as its target will end up in the most deeply nested - descendant state the parent was in the last time it was exited. -*/ - -QtStatePrivate::QtStatePrivate() - : errorState(0), isParallelGroup(false), initialState(0) -{ -} - -QtStatePrivate::~QtStatePrivate() -{ -} - -QtStatePrivate *QtStatePrivate::get(QtState *q) -{ - if (!q) - return 0; - return q->d_func(); -} - -const QtStatePrivate *QtStatePrivate::get(const QtState *q) -{ - if (!q) - return 0; - return q->d_func(); -} - -/*! - Constructs a new state with the given \a parent state. -*/ -QtState::QtState(QtState *parent) - : QtActionState(*new QtStatePrivate, parent) -{ -} - -/*! - Constructs a new state of the given \a type with the given \a parent state. -*/ -QtState::QtState(Type type, QtState *parent) - : QtActionState(*new QtStatePrivate, parent) -{ - Q_D(QtState); - d->isParallelGroup = (type == ParallelGroup); -} - -/*! - \internal -*/ -QtState::QtState(QtStatePrivate &dd, QtState *parent) - : QtActionState(dd, parent) -{ -} - -/*! - Destroys this state. -*/ -QtState::~QtState() -{ -} - -QList QtStatePrivate::childStates() const -{ - QList result; - QList::const_iterator it; -#ifdef QT_STATEMACHINE_SOLUTION - const QObjectList &children = q_func()->children(); -#endif - for (it = children.constBegin(); it != children.constEnd(); ++it) { - QtAbstractState *s = qobject_cast(*it); - if (!s || qobject_cast(s)) - continue; - result.append(s); - } - return result; -} - -QList QtStatePrivate::historyStates() const -{ - QList result; - QList::const_iterator it; -#ifdef QT_STATEMACHINE_SOLUTION - const QObjectList &children = q_func()->children(); -#endif - for (it = children.constBegin(); it != children.constEnd(); ++it) { - QtHistoryState *h = qobject_cast(*it); - if (h) - result.append(h); - } - return result; -} - -QList QtStatePrivate::transitions() const -{ - QList result; - QList::const_iterator it; -#ifdef QT_STATEMACHINE_SOLUTION - const QObjectList &children = q_func()->children(); -#endif - for (it = children.constBegin(); it != children.constEnd(); ++it) { - QtAbstractTransition *t = qobject_cast(*it); - if (t) - result.append(t); - } - return result; -} - -/*! - Returns this state group's error state. - - \sa QtStateMachine::errorState(), QtStateMachine::setErrorState() -*/ -QtAbstractState *QtState::errorState() const -{ - Q_D(const QtState); - return d->errorState; -} - -/*! - Sets this state's error state to be the given \a state. If the error state - is not set, or if it is set to 0, the state will inherit its parent's error - state recursively. - - \sa QtStateMachine::setErrorState(), QtStateMachine::errorState() -*/ -void QtState::setErrorState(QtAbstractState *state) -{ - Q_D(QtState); - if (state != 0 && QtAbstractStatePrivate::get(state)->machine() != d->machine()) { - qWarning("QtState::setErrorState: error state cannot belong " - "to a different state machine"); - return; - } - - d->errorState = state; -} - -/*! - Adds the given \a transition. The transition has this state as the source. - This state takes ownership of the transition. -*/ -void QtState::addTransition(QtAbstractTransition *transition) -{ - Q_D(QtState); - if (!transition) { - qWarning("QtState::addTransition: cannot add null transition"); - return; - } - const QList &targets = QtAbstractTransitionPrivate::get(transition)->targetStates; - for (int i = 0; i < targets.size(); ++i) { - QtAbstractState *t = targets.at(i); - if (!t) { - qWarning("QtState::addTransition: cannot add transition to null state"); - return; - } - if ((QtAbstractStatePrivate::get(t)->machine() != d->machine()) - && QtAbstractStatePrivate::get(t)->machine() && d->machine()) { - qWarning("QtState::addTransition: cannot add transition " - "to a state in a different state machine"); - return; - } - } - transition->setParent(this); -} - -/*! - Adds a transition associated with the given \a signal of the given \a sender - object, and returns the new QtSignalTransition object. The transition has - this state as the source, and the given \a target as the target state. -*/ -QtSignalTransition *QtState::addTransition(QObject *sender, const char *signal, - QtAbstractState *target) -{ - if (!sender) { - qWarning("QtState::addTransition: sender cannot be null"); - return 0; - } - if (!signal) { - qWarning("QtState::addTransition: signal cannot be null"); - return 0; - } - QtSignalTransition *trans = new QtSignalTransition(sender, signal, QList() << target); - addTransition(trans); - return trans; -} - -/*! - Adds a transition that's triggered by the finished event of this state, and - returns the new QtStateFinishedTransition object. The transition has the - given \a target state. - - \sa QtStateFinishedEvent -*/ -QtStateFinishedTransition *QtState::addFinishedTransition(QtAbstractState *target) -{ - QtStateFinishedTransition *trans = new QtStateFinishedTransition(this, QList() << target); - addTransition(trans); - return trans; -} - -namespace { - -// ### Make public? -class UnconditionalTransition : public QtAbstractTransition -{ -public: - UnconditionalTransition(QtAbstractState *target) - : QtAbstractTransition(QList() << target) {} -protected: - void onTransition() {} - bool eventTest(QEvent *) const { return true; } -}; - -} // namespace - -/*! - Adds an unconditional transition from this state to the given \a target - state, and returns then new transition object. -*/ -QtAbstractTransition *QtState::addTransition(QtAbstractState *target) -{ - UnconditionalTransition *trans = new UnconditionalTransition(target); - addTransition(trans); - return trans; -} - -/*! - Removes the given \a transition from this state. The state releases - ownership of the transition. - - \sa addTransition() -*/ -void QtState::removeTransition(QtAbstractTransition *transition) -{ - Q_D(QtState); - if (!transition) { - qWarning("QtState::removeTransition: cannot remove null transition"); - return; - } - if (transition->sourceState() != this) { - qWarning("QtState::removeTransition: transition %p's source state (%p)" - " is different from this state (%p)", - transition, transition->sourceState(), this); - return; - } - QtStateMachinePrivate *mach = QtStateMachinePrivate::get(d->machine()); - if (mach) - mach->unregisterTransition(transition); - transition->setParent(0); -} - -/*! - Returns the list of transitions from this state, or an empty list if there - are no transitions from this state. - - \sa addTransition(), removeTransition() -*/ -QList QtState::transitions() const -{ - Q_D(const QtState); - return d->transitions(); -} - -/*! - Creates a history state of the given \a type for this state and returns the - new state. The history state becomes a child of this state. -*/ -QtHistoryState *QtState::addHistoryState(HistoryType type) -{ - return QtHistoryStatePrivate::create(type, this); -} - -/*! - \reimp -*/ -void QtState::onEntry() -{ - QtActionState::onEntry(); -} - -/*! - \reimp -*/ -void QtState::onExit() -{ - QtActionState::onExit(); -} - -/*! - Returns this state's initial state, or 0 if the state has no initial state. -*/ -QtAbstractState *QtState::initialState() const -{ - Q_D(const QtState); - return d->initialState; -} - -/*! - Sets this state's initial state to be the given \a state. - \a state has to be a child of this state. -*/ -void QtState::setInitialState(QtAbstractState *state) -{ - Q_D(QtState); - if (d->isParallelGroup) { - qWarning("QtState::setInitialState: ignoring attempt to set initial state " - "of parallel state group %p", this); - return; - } - if (state && (state->parentState() != this)) { - qWarning("QtState::setInitialState: state %p is not a child of this state (%p)", - state, this); - return; - } - d->initialState = state; -} - -/*! - \reimp -*/ -bool QtState::event(QEvent *e) -{ - return QtActionState::event(e); -} - -QT_END_NAMESPACE diff --git a/lib/qtstatemachine/src/qstate.h b/lib/qtstatemachine/src/qstate.h deleted file mode 100644 index 4c35b04..0000000 --- a/lib/qtstatemachine/src/qstate.h +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QSTATE_H -#define QSTATE_H - -#include "qtstatemachineglobal.h" -#ifndef QT_STATEMACHINE_SOLUTION -#include -#else -#include "qactionstate.h" -#endif - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Core) - -class QtAbstractTransition; -class QtHistoryState; -class QtSignalTransition; -class QtStateFinishedTransition; - -class QtStatePrivate; -class Q_STATEMACHINE_CORE_EXPORT QtState : public QtActionState -{ - Q_OBJECT -public: - enum Type { - Normal, - ParallelGroup - }; - - enum HistoryType { - ShallowHistory, - DeepHistory - }; - - QtState(QtState *parent = 0); - QtState(Type type, QtState *parent = 0); - ~QtState(); - - QtAbstractState *errorState() const; - void setErrorState(QtAbstractState *state); - - void addTransition(QtAbstractTransition *transition); - QtSignalTransition *addTransition(QObject *sender, const char *signal, QtAbstractState *target); - QtAbstractTransition *addTransition(QtAbstractState *target); - QtStateFinishedTransition *addFinishedTransition(QtAbstractState *target); - void removeTransition(QtAbstractTransition *transition); - QList transitions() const; - - QtHistoryState *addHistoryState(HistoryType type = ShallowHistory); - - QtAbstractState *initialState() const; - void setInitialState(QtAbstractState *state); - -protected: - void onEntry(); - void onExit(); - - bool event(QEvent *e); - -protected: - QtState(QtStatePrivate &dd, QtState *parent); - -private: - Q_DISABLE_COPY(QtState) - Q_DECLARE_PRIVATE(QtState) -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/lib/qtstatemachine/src/qstate_p.h b/lib/qtstatemachine/src/qstate_p.h deleted file mode 100644 index 48c25a1..0000000 --- a/lib/qtstatemachine/src/qstate_p.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QSTATE_P_H -#define QSTATE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qactionstate_p.h" - -#include - -QT_BEGIN_NAMESPACE - -class QtState; -class Q_STATEMACHINE_CORE_EXPORT QtStatePrivate : public QtActionStatePrivate -{ - Q_DECLARE_PUBLIC(QtState) -public: - QtStatePrivate(); - ~QtStatePrivate(); - - static QtStatePrivate *get(QtState *q); - static const QtStatePrivate *get(const QtState *q); - - QList childStates() const; - QList historyStates() const; - QList transitions() const; - - QtAbstractState *errorState; - bool isParallelGroup; - QtAbstractState *initialState; -}; - -QT_END_NAMESPACE - -#endif diff --git a/lib/qtstatemachine/src/qstateaction.cpp b/lib/qtstatemachine/src/qstateaction.cpp deleted file mode 100644 index 62fae34..0000000 --- a/lib/qtstatemachine/src/qstateaction.cpp +++ /dev/null @@ -1,361 +0,0 @@ -/**************************************************************************** -** -** This file is 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 "qstateaction.h" -#include "qstateaction_p.h" -#include -#include - -QT_BEGIN_NAMESPACE - -QtStateActionPrivate::QtStateActionPrivate() -{ - when = ExecuteOnEntry; -} - -QtStateActionPrivate::~QtStateActionPrivate() -{ -} - -QtStateActionPrivate *QtStateActionPrivate::get(QtStateAction *q) -{ - return q->d_func(); -} - -void QtStateActionPrivate::callExecute() -{ - Q_Q(QtStateAction); - q->execute(); -} - -/*! - \class QtStateAction - - \brief The QtStateAction class is the base class of QtState actions. - - \since 4.6 - \ingroup statemachine - - A state action is added to a state by calling QtActionState::addEntryAction() - or QtActionState::addExitAction(). QtStateAction is part of \l{The State - Machine Framework}. - - \section1 Subclassing - - Subclasses must implement the execute() function. -*/ - -/*! - Constructs a new QtStateAction object with the given \a parent. -*/ -QtStateAction::QtStateAction(QObject *parent) - : QObject( -#ifndef QT_STATEMACHINE_SOLUTION - *new QtStateActionPrivate, -#endif - parent) -#ifdef QT_STATEMACHINE_SOLUTION - , d_ptr(new QtStateActionPrivate) -#endif -{ -#ifdef QT_STATEMACHINE_SOLUTION - d_ptr->q_ptr = this; -#endif -} - -/*! - \internal -*/ -QtStateAction::QtStateAction(QtStateActionPrivate &dd, QObject *parent) - : QObject( -#ifndef QT_STATEMACHINE_SOLUTION - dd, -#endif - parent) -#ifdef QT_STATEMACHINE_SOLUTION - , d_ptr(&dd) -#endif -{ -#ifdef QT_STATEMACHINE_SOLUTION - d_ptr->q_ptr = this; -#endif -} - -/*! - Destroys this QtStateAction object. -*/ -QtStateAction::~QtStateAction() -{ -#ifdef QT_STATEMACHINE_SOLUTION - delete d_ptr; -#endif -} - -/*! - \fn QtStateAction::execute() - - Executes this action. -*/ - -/*! - \reimp -*/ -bool QtStateAction::event(QEvent *e) -{ - return QObject::event(e); -} - -QtStateInvokeMethodActionPrivate *QtStateInvokeMethodActionPrivate::get(QtStateInvokeMethodAction *q) -{ - return q->d_func(); -} - -/*! - \class QtStateInvokeMethodAction - - \brief The QtStateInvokeMethodAction class provides an invoke method action for QObjects. - - \since 4.6 - \ingroup statemachine - - The QtStateInvokeMethodAction class provides an action that calls a method of - a QObject when a QtState is entered or exited. QtStateInvokeMethodAction is - part of \l{The State Machine Framework}. - - Typically you don't construct QtStateInvokeMethodAction objects directly, but - rather call the QtState::invokeMethodOnEntry() function or the - QtState::invokeMethodOnExit() function. -*/ - -/*! - \property QtStateInvokeMethodAction::arguments - - \brief the arguments to the method this action invokes -*/ - -/*! - \property QtStateInvokeMethodAction::methodName - - \brief the name of the method this action invokes -*/ - -/*! - \property QtStateInvokeMethodAction::target - - \brief the object on which this action invokes a method -*/ - -/*! - Constructs a new QtStateInvokeMethodAction object for the method named \a - methodName of the given \a target object, with the given \a parent. -*/ -QtStateInvokeMethodAction::QtStateInvokeMethodAction( - QObject *target, const QByteArray &methodName, QObject *parent) - : QtStateAction(*new QtStateInvokeMethodActionPrivate, parent) -{ - Q_D(QtStateInvokeMethodAction); - d->target = target; - d->methodName = methodName; - d->methodIndex = -1; -} - -/*! - Constructs a new QtStateInvokeMethodAction object for the method named \a - methodName of the given \a target object, with the given arguments, \a args, - and with the given \a parent. -*/ -QtStateInvokeMethodAction::QtStateInvokeMethodAction( - QObject *target, const QByteArray &methodName, - const QList &args, QObject *parent) - : QtStateAction(*new QtStateInvokeMethodActionPrivate, parent) -{ - Q_D(QtStateInvokeMethodAction); - d->target = target; - d->methodName = methodName; - d->methodIndex = -1; - d->args = args; -} - -/*! - Constructs a new QtStateInvokeMethodAction object with the given \a parent. -*/ -QtStateInvokeMethodAction::QtStateInvokeMethodAction(QObject *parent) - : QtStateAction(*new QtStateInvokeMethodActionPrivate, parent) -{ - Q_D(QtStateInvokeMethodAction); - d->target = 0; - d->methodIndex = -1; -} - -/*! - Destroys this QtStateInvokeMethodAction object. -*/ -QtStateInvokeMethodAction::~QtStateInvokeMethodAction() -{ -} - -/*! - \reimp -*/ -void QtStateInvokeMethodAction::execute() -{ - Q_D(QtStateInvokeMethodAction); - if (!d->target) - return; - - if (d->methodIndex == -1) { - QVarLengthArray sig; - int len = d->methodName.length(); - if (len <= 0) - return; - sig.append(d->methodName, len); - sig.append('('); - - int paramCount; - for (paramCount = 0; paramCount < d->args.size() && paramCount < 10; ++paramCount) { - const char *tn = d->args.at(paramCount).typeName(); - len = qstrlen(tn); - if (len <= 0) - break; - sig.append(tn, len); - sig.append(','); - } - if (paramCount == 0) - sig.append(')'); // no parameters - else - sig[sig.size() - 1] = ')'; - sig.append('\0'); - - const QMetaObject *meta = d->target->metaObject(); - int idx = meta->indexOfMethod(sig.constData()); - if (idx < 0) { - QByteArray norm = QMetaObject::normalizedSignature(sig.constData()); - idx = meta->indexOfMethod(norm.constData()); - if ((idx < 0) || (idx >= meta->methodCount())) { - qWarning("InvokeMethodAction: unable to find method '%s' of %s(%p)", - sig.constData(), meta->className(), d->target); - return; - } - } - d->methodIndex = idx; - } - - void *param[11]; - param[0] = 0; // return value - for (int i = 0; i < 10; ++i) - param[i+1] = (i < d->args.size()) ? const_cast(d->args.at(i).constData()) : (void*)0; - (void)d->target->qt_metacall(QMetaObject::InvokeMetaMethod, d->methodIndex, param); -} - -/*! - Returns the object on which this action invokes a method. -*/ -QObject *QtStateInvokeMethodAction::targetObject() const -{ - Q_D(const QtStateInvokeMethodAction); - return d->target; -} - -/*! - Sets the object on which this action invokes a method. -*/ -void QtStateInvokeMethodAction::setTargetObject(QObject *target) -{ - Q_D(QtStateInvokeMethodAction); - d->target = target; -} - -/*! - Returns the name of the method this action will invoke. -*/ -QByteArray QtStateInvokeMethodAction::methodName() const -{ - Q_D(const QtStateInvokeMethodAction); - return d->methodName; -} - -/*! - Sets the name of the method this action will invoke. -*/ -void QtStateInvokeMethodAction::setMethodName(const QByteArray &methodName) -{ - Q_D(QtStateInvokeMethodAction); - if (methodName != d->methodName) { - d->methodName = methodName; - d->methodIndex = -1; - } -} - -/*! - Returns the arguments to the method this action will invoke. -*/ -QVariantList QtStateInvokeMethodAction::arguments() const -{ - Q_D(const QtStateInvokeMethodAction); - return d->args; -} - -/*! - Sets the arguments to the method this action will invoke. -*/ -void QtStateInvokeMethodAction::setArguments(const QVariantList &arguments) -{ - Q_D(QtStateInvokeMethodAction); - if (d->args != arguments) { - d->args = arguments; - d->methodIndex = -1; - } -} - -/*! - \reimp -*/ -bool QtStateInvokeMethodAction::event(QEvent *e) -{ - return QtStateAction::event(e); -} - -QT_END_NAMESPACE diff --git a/lib/qtstatemachine/src/qstateaction.h b/lib/qtstatemachine/src/qstateaction.h deleted file mode 100644 index 383f4e2..0000000 --- a/lib/qtstatemachine/src/qstateaction.h +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QSTATEACTION_H -#define QSTATEACTION_H - -#include "qtstatemachineglobal.h" -#include - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Core) - -class QtStateActionPrivate; -class Q_STATEMACHINE_CORE_EXPORT QtStateAction : public QObject -{ - Q_OBJECT -public: - ~QtStateAction(); - -protected: - QtStateAction(QObject *parent = 0); - - virtual void execute() = 0; - - bool event(QEvent *e); - -protected: -#ifdef QT_STATEMACHINE_SOLUTION - QtStateActionPrivate *d_ptr; -#endif - QtStateAction(QtStateActionPrivate &dd, QObject *parent); - -private: - Q_DISABLE_COPY(QtStateAction) - Q_DECLARE_PRIVATE(QtStateAction) -}; - -class QtStateInvokeMethodActionPrivate; -class Q_STATEMACHINE_CORE_EXPORT QtStateInvokeMethodAction : public QtStateAction -{ - Q_OBJECT - Q_PROPERTY(QObject* target READ targetObject WRITE setTargetObject) - Q_PROPERTY(QByteArray methodName READ methodName WRITE setMethodName) - Q_PROPERTY(QVariantList arguments READ arguments WRITE setArguments) -public: - QtStateInvokeMethodAction(QObject *target, const QByteArray &methodName, - QObject *parent = 0); - QtStateInvokeMethodAction(QObject *target, const QByteArray &methodName, - const QList &args, QObject *parent = 0); - QtStateInvokeMethodAction(QObject *parent = 0); - ~QtStateInvokeMethodAction(); - - QObject *targetObject() const; - void setTargetObject(QObject *target); - - QByteArray methodName() const; - void setMethodName(const QByteArray &methodName); - - QVariantList arguments() const; - void setArguments(const QVariantList &arguments); - -protected: - void execute(); - - bool event(QEvent *e); - -private: - Q_DISABLE_COPY(QtStateInvokeMethodAction) - Q_DECLARE_PRIVATE(QtStateInvokeMethodAction) -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/lib/qtstatemachine/src/qstateaction_p.h b/lib/qtstatemachine/src/qstateaction_p.h deleted file mode 100644 index 15db99f..0000000 --- a/lib/qtstatemachine/src/qstateaction_p.h +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QSTATEACTION_P_H -#define QSTATEACTION_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#ifndef QT_STATEMACHINE_SOLUTION -#include -#endif - -QT_BEGIN_NAMESPACE - -class QtStateAction; -class QtStateActionPrivate -#ifndef QT_STATEMACHINE_SOLUTION - : public QObjectPrivate -#endif -{ - Q_DECLARE_PUBLIC(QtStateAction) -public: - QtStateActionPrivate(); - ~QtStateActionPrivate(); - - static QtStateActionPrivate *get(QtStateAction *q); - - void callExecute(); - - enum When { - ExecuteOnEntry, - ExecuteOnExit - }; - - When when; - -#ifdef QT_STATEMACHINE_SOLUTION - QtStateAction *q_ptr; -#endif -}; - -class QtStateInvokeMethodAction; -class QtStateInvokeMethodActionPrivate : public QtStateActionPrivate -{ - Q_DECLARE_PUBLIC(QtStateInvokeMethodAction) -public: - QtStateInvokeMethodActionPrivate() {} - ~QtStateInvokeMethodActionPrivate() {} - - static QtStateInvokeMethodActionPrivate *get(QtStateInvokeMethodAction *q); - - QObject *target; - QByteArray methodName; - int methodIndex; - QList args; -}; - -QT_END_NAMESPACE - -#endif diff --git a/lib/qtstatemachine/src/qstatefinishedevent.h b/lib/qtstatemachine/src/qstatefinishedevent.h deleted file mode 100644 index cff1213..0000000 --- a/lib/qtstatemachine/src/qstatefinishedevent.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QSTATEFINISHEDEVENT_H -#define QSTATEFINISHEDEVENT_H - -#include "qtstatemachineglobal.h" -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Core) - -class QtState; - -class Q_STATEMACHINE_CORE_EXPORT QtStateFinishedEvent : public QEvent -{ -public: - QtStateFinishedEvent(QtState *state); - ~QtStateFinishedEvent(); - - QtState *state() const; - -private: - QtState *m_state; - void *d; -}; - -QT_END_NAMESPACE - -#endif diff --git a/lib/qtstatemachine/src/qstatefinishedtransition.cpp b/lib/qtstatemachine/src/qstatefinishedtransition.cpp deleted file mode 100644 index 792edda..0000000 --- a/lib/qtstatemachine/src/qstatefinishedtransition.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/**************************************************************************** -** -** This file is 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 "qstatefinishedtransition.h" -#include "qstatefinishedevent.h" -#include "qtransition_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QtStateFinishedTransition - - \brief The QtStateFinishedTransition class provides a transition that triggers when a state is finished. - - \ingroup statemachine - - A state is finished when one of its final child states (a QtFinalState) is - entered; this will cause a QtStateFinishedEvent to be generated. The - QtStateFinishedTransition class provides a way of associating a transition - with such an event. QtStateFinishedTransition is part of \l{The State Machine - Framework}. - - \code - QtStateMachine machine; - QtState *s1 = new QtState(machine.rootState()); - QtState *s11 = new QtState(s1); - QtFinalState *s12 = new QtFinalState(s1); - s11->addTransition(s12); - - QtState *s2 = new QtState(machine.rootState()); - QtStateFinishedTransition *finishedTransition = new QtStateFinishedTransition(s1); - finishedTransition->setTargetState(s2); - s1->addTransition(finishedTransition); - \endcode - - \sa QtState::addFinishedTransition(), QtStateFinishedEvent -*/ - -/*! - \property QtStateFinishedTransition::state - - \brief the state whose QtStateFinishedEvent this transition is associated with -*/ - -class QtStateFinishedTransitionPrivate : public QtTransitionPrivate -{ - Q_DECLARE_PUBLIC(QtStateFinishedTransition) -public: - QtStateFinishedTransitionPrivate(); - - static QtStateFinishedTransitionPrivate *get(QtStateFinishedTransition *q); - - QtState *state; -}; - -QtStateFinishedTransitionPrivate::QtStateFinishedTransitionPrivate() -{ - state = 0; -} - -QtStateFinishedTransitionPrivate *QtStateFinishedTransitionPrivate::get(QtStateFinishedTransition *q) -{ - return q->d_func(); -} - -/*! - Constructs a new QtStateFinishedTransition object that has the given \a - sourceState. -*/ -QtStateFinishedTransition::QtStateFinishedTransition(QtState *sourceState) - : QtTransition(*new QtStateFinishedTransitionPrivate, sourceState) -{ -} - -/*! - Constructs a new QtStateFinishedTransition object associated with the given - \a state, and that has the given \a targets and \a sourceState. -*/ -QtStateFinishedTransition::QtStateFinishedTransition( - QtState *state, const QList &targets, QtState *sourceState) - : QtTransition(*new QtStateFinishedTransitionPrivate, targets, sourceState) -{ - Q_D(QtStateFinishedTransition); - d->state = state; -} - -/*! - Destroys this QtStateFinishedTransition. -*/ -QtStateFinishedTransition::~QtStateFinishedTransition() -{ -} - -/*! - Returns the state associated with this QtStateFinishedTransition. -*/ -QtState *QtStateFinishedTransition::state() const -{ - Q_D(const QtStateFinishedTransition); - return d->state; -} - -/*! - Sets the \a state associated with this QtStateFinishedTransition. -*/ -void QtStateFinishedTransition::setState(QtState *state) -{ - Q_D(QtStateFinishedTransition); - d->state = state; -} - -/*! - \reimp -*/ -bool QtStateFinishedTransition::eventTest(QEvent *event) const -{ - Q_D(const QtStateFinishedTransition); -#ifndef QT_STATEMACHINE_SOLUTION - if (event->type() == QEvent::StateFinished) { -#else - if (event->type() == QEvent::Type(QEvent::User-2)) { -#endif - QtStateFinishedEvent *sfe = static_cast(event); - return (sfe->state() == d->state); - } - return false; -} - -/*! - \reimp -*/ -bool QtStateFinishedTransition::event(QEvent *e) -{ - return QtTransition::event(e); -} - -QT_END_NAMESPACE diff --git a/lib/qtstatemachine/src/qstatefinishedtransition.h b/lib/qtstatemachine/src/qstatefinishedtransition.h deleted file mode 100644 index 3c495b8..0000000 --- a/lib/qtstatemachine/src/qstatefinishedtransition.h +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QSTATEFINISHEDTRANSITION_H -#define QSTATEFINISHEDTRANSITION_H - -#include "qtstatemachineglobal.h" -#ifndef QT_STATEMACHINE_SOLUTION -#include -#else -#include "qtransition.h" -#endif - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Core) - -class QtState; - -class QtStateFinishedTransitionPrivate; -class Q_STATEMACHINE_CORE_EXPORT QtStateFinishedTransition : public QtTransition -{ - Q_OBJECT - Q_PROPERTY(QtState* state READ state WRITE setState) -public: - QtStateFinishedTransition(QtState *sourceState = 0); - QtStateFinishedTransition(QtState *state, const QList &targets, - QtState *sourceState = 0); - ~QtStateFinishedTransition(); - - QtState *state() const; // ### name - void setState(QtState *state); - -protected: - bool eventTest(QEvent *event) const; - - bool event(QEvent *e); - -private: - Q_DISABLE_COPY(QtStateFinishedTransition) - Q_DECLARE_PRIVATE(QtStateFinishedTransition) -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/lib/qtstatemachine/src/qstatemachine.cpp b/lib/qtstatemachine/src/qstatemachine.cpp deleted file mode 100644 index 14222b9..0000000 --- a/lib/qtstatemachine/src/qstatemachine.cpp +++ /dev/null @@ -1,2037 +0,0 @@ -/**************************************************************************** -** -** This file is 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 "qstatemachine.h" -#include "qstatemachine_p.h" -#include "qabstracttransition.h" -#include "qabstracttransition_p.h" -#include "qsignaltransition.h" -#include "qsignaltransition_p.h" -#include "qsignalevent.h" -#include "qsignaleventgenerator_p.h" -#include "qabstractstate.h" -#include "qabstractstate_p.h" -#include "qactionstate.h" -#include "qactionstate_p.h" -#include "qfinalstate.h" -#include "qhistorystate.h" -#include "qhistorystate_p.h" -#include "qstatefinishedevent.h" -#include "qstatefinishedtransition.h" -#include "qstate.h" -#include "qstate_p.h" -#include "qstateaction.h" -#include "qstateaction_p.h" -#ifndef QT_STATEMACHINE_SOLUTION -#include "private/qobject_p.h" -#include "private/qthread_p.h" -#endif - -#ifndef QT_NO_STATEMACHINE_EVENTFILTER -#include "qeventtransition.h" -#include "qeventtransition_p.h" -#include "qboundevent_p.h" -#endif - -#ifndef QT_NO_ANIMATION -#include "qpropertyanimation.h" -#include "qanimationgroup.h" -# ifndef QT_STATEMACHINE_SOLUTION -# include -# else -# include "qvariantanimation_p.h" -# endif -#endif - -#include -#include - -QT_BEGIN_NAMESPACE - -/*! - \class QtStateMachine - \reentrant - - \brief The QtStateMachine class provides a hierarchical finite state machine. - - \since 4.6 - \ingroup statemachine - - The QtStateMachine class provides a hierarchical finite state machine based - on \l{Statecharts: A visual formalism for complex systems}{Statecharts} - concepts and notation. QtStateMachine is part of \l{The State Machine - Framework}. - - A state machine manages a set of states (QtAbstractState objects) and - transitions (QtAbstractTransition objects) between those states; the states - and the transitions collectively define a state graph. Once a state graph - has been defined, the state machine can execute it. QtStateMachine's - execution algorithm is based on the \l{State Chart XML: State Machine - Notation for Control Abstraction}{State Chart XML (SCXML)} algorithm. - - The QtState class provides a state that you can use to set properties and - invoke methods on QObjects when the state is entered or exited. This is - typically used in conjunction with \l{Signals and Slots}{signals}; the - signals determine the flow of the state graph, whereas the states' property - assignments and method invocations are the actions. - - Use the addState() function to add a state to the state machine; - alternatively, pass the machine's rootState() to the state constructor. Use - the removeState() function to remove a state from the state machine. - - The following snippet shows a state machine that will finish when a button - is clicked: - - \code - QPushButton button; - - QtStateMachine machine; - QtState *s1 = new QtState(); - s1->assignProperty(&button, "text", "Click me"); - - QtFinalState *s2 = new QtFinalState(); - s1->addTransition(&button, SIGNAL(clicked()), s2); - - machine.addState(s1); - machine.addState(s2); - machine.setInitialState(s1); - machine.start(); - \endcode - - The setInitialState() function sets the state machine's initial state; this - state is entered when the state machine is started. - - The start() function starts the state machine. The state machine executes - asynchronously, i.e. you need to run an event loop in order for it to make - progress. The started() signal is emitted when the state machine has entered - the initial state. - - The state machine processes events and takes transitions until a top-level - final state is entered; the state machine then emits the finished() signal. - - The stop() function stops the state machine. The stopped() signal is emitted - when the state machine has stopped. - - The postEvent() function posts an event to the state machine. This is useful - when you are using custom events to trigger transitions. - - The rootState() function returns the state machine's root state. All - top-level states have the root state as their parent. - - \sa QtAbstractState, QtAbstractTransition -*/ - -/*! - \property QtStateMachine::rootState - - \brief the root state of this state machine -*/ - -/*! - \property QtStateMachine::initialState - - \brief the initial state of this state machine -*/ - -/*! - \property QtStateMachine::errorState - - \brief the error state of this state machine -*/ - -/*! - \property QtStateMachine::errorString - - \brief the error string of this state machine -*/ - -// #define QSTATEMACHINE_DEBUG - -QtStateMachinePrivate::QtStateMachinePrivate() -{ - state = NotRunning; - processing = false; - processingScheduled = false; - stop = false; - error = QtStateMachine::NoError; - globalRestorePolicy = QtAbstractState::DoNotRestoreProperties; - rootState = 0; - initialErrorStateForRoot = 0; -#ifndef QT_STATEMACHINE_SOLUTION - signalEventGenerator = 0; -#endif -} - -QtStateMachinePrivate::~QtStateMachinePrivate() -{ - qDeleteAll(internalEventQueue); - qDeleteAll(externalEventQueue); -} - -QtStateMachinePrivate *QtStateMachinePrivate::get(QtStateMachine *q) -{ - if (q) - return q->d_func(); - return 0; -} - -static QEvent *cloneEvent(QEvent *e) -{ - switch (e->type()) { - case QEvent::None: - return new QEvent(*e); - case QEvent::Timer: - return new QTimerEvent(*static_cast(e)); - default: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - } - return 0; -} - -const QtStateMachinePrivate::Handler qt_kernel_statemachine_handler = { - cloneEvent -}; - -const QtStateMachinePrivate::Handler *QtStateMachinePrivate::handler = &qt_kernel_statemachine_handler; - -Q_STATEMACHINE_CORE_EXPORT const QtStateMachinePrivate::Handler *qcoreStateMachineHandler() -{ - return &qt_kernel_statemachine_handler; -} - -bool QtStateMachinePrivate::stateEntryLessThan(QtAbstractState *s1, QtAbstractState *s2) -{ - if (s1->parent() == s2->parent()) { - return s1->children().indexOf(s1) - < s2->children().indexOf(s2); - } else if (isDescendantOf(s1, s2)) { - return false; - } else if (isDescendantOf(s2, s1)) { - return true; - } else { - // ### fixme - return s1 < s2; - } -} - -bool QtStateMachinePrivate::stateExitLessThan(QtAbstractState *s1, QtAbstractState *s2) -{ - if (s1->parent() == s2->parent()) { - return s1->children().indexOf(s1) - < s2->children().indexOf(s2); - } else if (isDescendantOf(s1, s2)) { - return true; - } else if (isDescendantOf(s2, s1)) { - return false; - } else { - // ### fixme - return s2 < s1; - } -} - -QtState *QtStateMachinePrivate::findLCA(const QList &states) -{ - if (states.isEmpty()) - return 0; - QList ancestors = properAncestors(states.at(0), 0); - for (int i = 0; i < ancestors.size(); ++i) { - QtState *anc = ancestors.at(i); - bool ok = true; - for (int j = states.size() - 1; (j > 0) && ok; --j) { - const QtAbstractState *s = states.at(j); - if (!isDescendantOf(s, anc)) - ok = false; - } - if (ok) - return anc; - } - return 0; -} - -bool QtStateMachinePrivate::isPreempted(const QtAbstractState *s, const QSet &transitions) const -{ - QSet::const_iterator it; - for (it = transitions.constBegin(); it != transitions.constEnd(); ++it) { - QtAbstractTransition *t = *it; - QList lst = t->targetStates(); - if (!lst.isEmpty()) { - lst.prepend(t->sourceState()); - QtAbstractState *lca = findLCA(lst); - if (isDescendantOf(s, lca)) { -#ifdef QSTATEMACHINE_DEBUG - qDebug() << q_func() << ":" << transitions << "preempts selection of a transition from" - << s << "because" << s << "is a descendant of" << lca; -#endif - return true; - } - } - } - return false; -} - -QSet QtStateMachinePrivate::selectTransitions(QEvent *event) const -{ - Q_Q(const QtStateMachine); - QSet enabledTransitions; - QSet::const_iterator it; - const_cast(q)->beginSelectTransitions(event); - for (it = configuration.constBegin(); it != configuration.constEnd(); ++it) { - QtAbstractState *state = *it; - if (!isAtomic(state)) - continue; - if (isPreempted(state, enabledTransitions)) - continue; - QList lst = properAncestors(state, 0); - if (QtState *grp = qobject_cast(state)) - lst.prepend(grp); - bool found = false; - for (int j = 0; (j < lst.size()) && !found; ++j) { - QtState *s = lst.at(j); - QList transitions = QtStatePrivate::get(s)->transitions(); - for (int k = 0; k < transitions.size(); ++k) { - QtAbstractTransition *t = transitions.at(k); - if (QtAbstractTransitionPrivate::get(t)->callEventTest(event)) { -#ifdef QSTATEMACHINE_DEBUG - qDebug() << q << ": selecting transition" << t; -#endif - enabledTransitions.insert(t); - found = true; - break; - } - } - } - } - const_cast(q)->endSelectTransitions(event); - return enabledTransitions; -} - -void QtStateMachinePrivate::microstep(const QList &enabledTransitions) -{ -#ifdef QSTATEMACHINE_DEBUG - qDebug() << q_func() << ": begin microstep( enabledTransitions:" << enabledTransitions << ")"; - qDebug() << q_func() << ": configuration before exiting states:" << configuration; -#endif - exitStates(enabledTransitions); -#ifdef QSTATEMACHINE_DEBUG - qDebug() << q_func() << ": configuration after exiting states:" << configuration; -#endif - executeTransitionContent(enabledTransitions); - QList enteredStates = enterStates(enabledTransitions); - applyProperties(enabledTransitions, enteredStates); -#ifdef QSTATEMACHINE_DEBUG - qDebug() << q_func() << ": configuration after entering states:" << configuration; - qDebug() << q_func() << ": end microstep"; -#endif -} - -QList QtStateMachinePrivate::exitStates(const QList &enabledTransitions) -{ -// qDebug() << "exitStates(" << enabledTransitions << ")"; - QSet statesToExit; -// QSet statesToSnapshot; - for (int i = 0; i < enabledTransitions.size(); ++i) { - QtAbstractTransition *t = enabledTransitions.at(i); - QList lst = t->targetStates(); - if (lst.isEmpty()) - continue; - lst.prepend(t->sourceState()); - QtAbstractState *lca = findLCA(lst); - { - QSet::const_iterator it; - for (it = configuration.constBegin(); it != configuration.constEnd(); ++it) { - QtAbstractState *s = *it; - if (isDescendantOf(s, lca)) - statesToExit.insert(s); - } - } - } - QList statesToExit_sorted = statesToExit.toList(); - qSort(statesToExit_sorted.begin(), statesToExit_sorted.end(), stateExitLessThan); - for (int i = 0; i < statesToExit_sorted.size(); ++i) { - QtAbstractState *s = statesToExit_sorted.at(i); - if (QtState *grp = qobject_cast(s)) { - QList hlst = QtStatePrivate::get(grp)->historyStates(); - for (int j = 0; j < hlst.size(); ++j) { - QtHistoryState *h = hlst.at(j); - QtHistoryStatePrivate::get(h)->configuration.clear(); - QSet::const_iterator it; - for (it = configuration.constBegin(); it != configuration.constEnd(); ++it) { - QtAbstractState *s0 = *it; - if (QtHistoryStatePrivate::get(h)->historyType == QtState::DeepHistory) { - if (isAtomic(s0) && isDescendantOf(s0, s)) - QtHistoryStatePrivate::get(h)->configuration.append(s0); - } else if (s0->parentState() == s) { - QtHistoryStatePrivate::get(h)->configuration.append(s0); - } - } -#ifdef QSTATEMACHINE_DEBUG - qDebug() << q_func() << ": recorded" << ((QtHistoryStatePrivate::get(h)->historyType == QtState::DeepHistory) ? "deep" : "shallow") - << "history for" << s << "in" << h << ":" << QtHistoryStatePrivate::get(h)->configuration; -#endif - } - } - } - for (int i = 0; i < statesToExit_sorted.size(); ++i) { - QtAbstractState *s = statesToExit_sorted.at(i); -#ifdef QSTATEMACHINE_DEBUG - qDebug() << q_func() << ": exiting" << s; -#endif - QtAbstractStatePrivate::get(s)->callOnExit(); - configuration.remove(s); - } - return statesToExit_sorted; -} - -void QtStateMachinePrivate::executeTransitionContent(const QList &enabledTransitions) -{ - for (int i = 0; i < enabledTransitions.size(); ++i) { - QtAbstractTransition *t = enabledTransitions.at(i); -#ifdef QSTATEMACHINE_DEBUG - qDebug() << q_func() << ": triggering" << t; -#endif - QtAbstractTransitionPrivate::get(t)->callOnTransition(); - } -} - -QList QtStateMachinePrivate::enterStates(const QList &enabledTransitions) -{ -#ifdef QSTATEMACHINE_DEBUG - Q_Q(QtStateMachine); -#endif -// qDebug() << "enterStates(" << enabledTransitions << ")"; - QSet statesToEnter; - QSet statesForDefaultEntry; - - for (int i = 0; i < enabledTransitions.size(); ++i) { - QtAbstractTransition *t = enabledTransitions.at(i); - QList lst = t->targetStates(); - if (lst.isEmpty()) - continue; - lst.prepend(t->sourceState()); - QtState *lca = findLCA(lst); - for (int j = 1; j < lst.size(); ++j) { - QtAbstractState *s = lst.at(j); - if (QtHistoryState *h = qobject_cast(s)) { - QList hconf = QtHistoryStatePrivate::get(h)->configuration; - if (!hconf.isEmpty()) { - for (int k = 0; k < hconf.size(); ++k) { - QtAbstractState *s0 = hconf.at(k); - addStatesToEnter(s0, lca, statesToEnter, statesForDefaultEntry); - } -#ifdef QSTATEMACHINE_DEBUG - qDebug() << q << ": restoring" - << ((QtHistoryStatePrivate::get(h)->historyType == QtState::DeepHistory) ? "deep" : "shallow") - << "history from" << s << ":" << hconf; -#endif - } else { - QList hlst; - if (QtHistoryStatePrivate::get(h)->defaultState) - hlst.append(QtHistoryStatePrivate::get(h)->defaultState); - if (hlst.isEmpty()) { - setError(QtStateMachine::NoDefaultStateInHistoryState, h); - } else { - for (int k = 0; k < hlst.size(); ++k) { - QtAbstractState *s0 = hlst.at(k); - addStatesToEnter(s0, lca, statesToEnter, statesForDefaultEntry); - } -#ifdef QSTATEMACHINE_DEBUG - qDebug() << q << ": initial history targets for" << s << ":" << hlst; -#endif - } - } - } else { - addStatesToEnter(s, lca, statesToEnter, statesForDefaultEntry); - } - if (isParallel(lca)) { - QList lcac = QtStatePrivate::get(lca)->childStates(); - foreach (QtAbstractState* child,lcac) { - if (!statesToEnter.contains(child)) { - addStatesToEnter(child,lca,statesToEnter,statesForDefaultEntry); - } - } - } - } - } - - // Did an error occur while selecting transitions? Then we enter the error state. - if (!pendingErrorStates.isEmpty()) { - statesToEnter.clear(); - statesToEnter = pendingErrorStates; - statesForDefaultEntry = pendingErrorStatesForDefaultEntry; - pendingErrorStates.clear(); - pendingErrorStatesForDefaultEntry.clear(); - } - - QList statesToEnter_sorted = statesToEnter.toList(); - qSort(statesToEnter_sorted.begin(), statesToEnter_sorted.end(), stateEntryLessThan); - - for (int i = 0; i < statesToEnter_sorted.size(); ++i) { - QtAbstractState *s = statesToEnter_sorted.at(i); -#ifdef QSTATEMACHINE_DEBUG - qDebug() << q << ": entering" << s; -#endif - configuration.insert(s); - registerTransitions(s); - QtAbstractStatePrivate::get(s)->callOnEntry(); - if (statesForDefaultEntry.contains(s)) { - // ### executeContent(s.initial.transition.children()) - } - if (isFinal(s)) { - QtState *parent = s->parentState(); - if (parent) { - QtState *grandparent = parent->parentState(); -#ifdef QSTATEMACHINE_DEBUG - qDebug() << q << ": posting finished event for" << parent; -#endif - internalEventQueue.append(new QtStateFinishedEvent(parent)); - if (grandparent && isParallel(grandparent)) { - bool allChildStatesFinal = true; - QList childStates = QtStatePrivate::get(grandparent)->childStates(); - for (int j = 0; j < childStates.size(); ++j) { - QtAbstractState *cs = childStates.at(j); - if (!isInFinalState(cs)) { - allChildStatesFinal = false; - break; - } - } - if (allChildStatesFinal) { -#ifdef QSTATEMACHINE_DEBUG - qDebug() << q << ": posting finished event for" << grandparent; -#endif - internalEventQueue.append(new QtStateFinishedEvent(grandparent)); - } - } - } - } - } - { - QSet::const_iterator it; - for (it = configuration.constBegin(); it != configuration.constEnd(); ++it) { - if (isFinal(*it) && (*it)->parentState() == rootState) { - processing = false; - stopProcessingReason = Finished; - break; - } - } - } -// qDebug() << "configuration:" << configuration.toList(); - return statesToEnter_sorted; -} - -void QtStateMachinePrivate::addStatesToEnter(QtAbstractState *s, QtState *root, - QSet &statesToEnter, - QSet &statesForDefaultEntry) -{ - statesToEnter.insert(s); - if (isParallel(s)) { - QtState *grp = qobject_cast(s); - QList lst = QtStatePrivate::get(grp)->childStates(); - for (int i = 0; i < lst.size(); ++i) { - QtAbstractState *child = lst.at(i); - addStatesToEnter(child, grp, statesToEnter, statesForDefaultEntry); - } - } else if (isCompound(s)) { - statesForDefaultEntry.insert(s); - QtState *grp = qobject_cast(s); - QtAbstractState *initial = grp->initialState(); - if (initial != 0) { - addStatesToEnter(initial, grp, statesToEnter, statesForDefaultEntry); - } else { - setError(QtStateMachine::NoInitialStateError, grp); - return; - } - } - QList ancs = properAncestors(s, root); - for (int i = 0; i < ancs.size(); ++i) { - QtState *anc = ancs.at(i); - if (!anc->parentState()) - continue; - statesToEnter.insert(anc); - if (isParallel(anc)) { - QList lst = QtStatePrivate::get(anc)->childStates(); - for (int j = 0; j < lst.size(); ++j) { - QtAbstractState *child = lst.at(j); - bool hasDescendantInList = false; - QSet::const_iterator it; - for (it = statesToEnter.constBegin(); it != statesToEnter.constEnd(); ++it) { - if (isDescendantOf(*it, child)) { - hasDescendantInList = true; - break; - } - } - if (!hasDescendantInList) - addStatesToEnter(child, anc, statesToEnter, statesForDefaultEntry); - } - } - } -} - -void QtStateMachinePrivate::applyProperties(const QList &transitionList, - const QList &enteredStates) -{ -#ifndef QT_NO_ANIMATION - Q_Q(QtStateMachine); - // Gracefully terminate playing animations. - for (int i = 0; i < playingAnimations.size(); ++i) - playingAnimations.at(i)->stop(); - playingAnimations.clear(); - for (int i = 0; i < resetEndValues.size(); ++i) - qobject_cast(resetEndValues.at(i))->setEndValue(QVariant()); // ### generalize - resetEndValues.clear(); - - // Find the animations to use for the state change. - QList selectedAnimations; - for (int i = 0; i < transitionList.size(); ++i) - selectedAnimations << transitionList.at(i)->animations(); -#else - Q_UNUSED(transitionList); -#endif - - // Process the SetProperty definitions of the entered states. - QList propertyAssignments; - QHash pendingRestorables = registeredRestorables; - for (int i = 0; i < enteredStates.size(); ++i) { - QtAbstractState *s = enteredStates.at(i); - - QtAbstractState::RestorePolicy restorePolicy = s->restorePolicy(); - if (restorePolicy == QtAbstractState::GlobalRestorePolicy) - restorePolicy = globalRestorePolicy; - - QList assignments = QtAbstractStatePrivate::get(s)->propertyAssignments; - for (int j = 0; j < assignments.size(); ++j) { - const QPropertyAssignment &assn = assignments.at(j); - if (restorePolicy == QtAbstractState::RestoreProperties) { - registerRestorable(assn.object, assn.propertyName); - } - pendingRestorables.remove(RestorableId(assn.object, assn.propertyName)); - propertyAssignments.append(assn); - } - } - propertyAssignments << restorablesToPropertyList(pendingRestorables); - -#ifndef QT_NO_ANIMATION - // Set the animated properties that did not finish animating and that are not - // set in the new state. - for (int i = 0; i < propertiesForAnimations.size(); ++i) { - QPropertyAssignment assn = propertiesForAnimations.at(i).second; - bool found = false; - for (int j = 0; j < propertyAssignments.size(); ++j) { - if ((propertyAssignments.at(j).object == assn.object) - && (propertyAssignments.at(j).propertyName == assn.propertyName)) { - found = true; - break; - } - } - if (!found) { - assn.object->setProperty(assn.propertyName, assn.value); - } - } - - // Initialize animations from SetProperty definitions. - propertiesForAnimations.clear(); - for (int i = 0; i < selectedAnimations.size(); ++i) { - QAbstractAnimation *anim = selectedAnimations.at(i); - QList::iterator it; - for (it = propertyAssignments.begin(); it != propertyAssignments.end(); ) { - QPair, QList > ret; - ret = initializeAnimation(anim, *it); - QList handlers = ret.first; - if (!handlers.isEmpty()) { - for (int j = 0; j < handlers.size(); ++j) - propertiesForAnimations.append(qMakePair(handlers.at(j), *it)); - it = propertyAssignments.erase(it); - } else { - ++it; - } - resetEndValues << ret.second; - } - - // We require that at least one animation is valid. - // ### generalize - QList variantAnims = qFindChildren(anim); - if (QVariantAnimation *va = qobject_cast(anim)) - variantAnims.append(va); - bool hasValidEndValue = false; - for (int j = 0; j < variantAnims.size(); ++j) { - if (variantAnims.at(j)->endValue().isValid()) { - hasValidEndValue = true; - break; - } - } - - if (hasValidEndValue) { - QObject::disconnect(anim, SIGNAL(finished()), q, SLOT(_q_animationFinished())); - QObject::connect(anim, SIGNAL(finished()), q, SLOT(_q_animationFinished())); - anim->start(); - playingAnimations.append(anim); - } - } -#endif // !QT_NO_ANIMATION - - // Immediately set the properties that are not animated. - for (int i = 0; i < propertyAssignments.size(); ++i) { - const QPropertyAssignment &assn = propertyAssignments.at(i); - assn.object->setProperty(assn.propertyName, assn.value); - } -} - -bool QtStateMachinePrivate::isFinal(const QtAbstractState *s) -{ - return qobject_cast(s) != 0; -} - -bool QtStateMachinePrivate::isParallel(const QtAbstractState *s) -{ - const QtState *ss = qobject_cast(s); - return ss && QtStatePrivate::get(ss)->isParallelGroup; -} - -bool QtStateMachinePrivate::isCompound(const QtAbstractState *s) -{ - const QtState *group = qobject_cast(s); - if (!group) - return false; - return (!isParallel(group) && !QtStatePrivate::get(group)->childStates().isEmpty()) - || (qobject_cast(group->parent()) != 0); -} - -bool QtStateMachinePrivate::isAtomic(const QtAbstractState *s) -{ - const QtState *ss = qobject_cast(s); - return (ss && !QtStatePrivate::get(ss)->isParallelGroup - && QtStatePrivate::get(ss)->childStates().isEmpty()) - || isFinal(s); -} - - -bool QtStateMachinePrivate::isDescendantOf(const QtAbstractState *state, const QtAbstractState *other) -{ - Q_ASSERT(state != 0); - for (QtAbstractState *s = state->parentState(); s != 0; s = s->parentState()) { - if (s == other) - return true; - } - return false; -} - -QList QtStateMachinePrivate::properAncestors(const QtAbstractState *state, const QtState *upperBound) -{ - Q_ASSERT(state != 0); - QList result; - for (QtState *s = state->parentState(); s && s != upperBound; s = s->parentState()) { - result.append(s); - } - return result; -} - -bool QtStateMachinePrivate::isInFinalState(QtAbstractState* s) const -{ - if (isCompound(s)) { - QtState *grp = qobject_cast(s); - QList lst = QtStatePrivate::get(grp)->childStates(); - for (int i = 0; i < lst.size(); ++i) { - QtAbstractState *cs = lst.at(i); - if (isFinal(cs) && configuration.contains(cs)) - return true; - } - return false; - } else if (isParallel(s)) { - QtState *grp = qobject_cast(s); - QList lst = QtStatePrivate::get(grp)->childStates(); - for (int i = 0; i < lst.size(); ++i) { - QtAbstractState *cs = lst.at(i); - if (!isInFinalState(cs)) - return false; - } - return true; - } - else - return false; -} - -void QtStateMachinePrivate::registerRestorable(QObject *object, const QByteArray &propertyName) -{ - RestorableId id(object, propertyName); - if (!registeredRestorables.contains(id)) - registeredRestorables.insert(id, object->property(propertyName)); -} - -QList QtStateMachinePrivate::restorablesToPropertyList(const QHash &restorables) const -{ - QList result; - QHash::const_iterator it; - for (it = restorables.constBegin(); it != restorables.constEnd(); ++it) { -// qDebug() << "restorable:" << it.key().first << it.key().second << it.value(); - result.append(QPropertyAssignment(it.key().first, it.key().second, it.value(), /*explicitlySet=*/false)); - } - return result; -} - -/*! - \internal - Returns true if the variable with the given \a id has been registered for restoration. -*/ -bool QtStateMachinePrivate::hasRestorable(QObject *object, const QByteArray &propertyName) const -{ - return registeredRestorables.contains(RestorableId(object, propertyName)); -} - -QVariant QtStateMachinePrivate::restorableValue(QObject *object, const QByteArray &propertyName) const -{ - return registeredRestorables.value(RestorableId(object, propertyName), QVariant()); -} - - -/*! - \internal - Unregisters the variable identified by \a id -*/ -void QtStateMachinePrivate::unregisterRestorable(QObject *object, const QByteArray &propertyName) -{ -// qDebug() << "unregisterRestorable(" << object << propertyName << ")"; - RestorableId id(object, propertyName); - registeredRestorables.remove(id); -} - -QtAbstractState *QtStateMachinePrivate::findErrorState(QtAbstractState *context) -{ - // If the user sets the root state's error state to 0, we return the initial error state - if (context == 0) - return initialErrorStateForRoot; - - // Find error state recursively in parent hierarchy if not set explicitly for context state - QtAbstractState *errorState = 0; - QtState *s = qobject_cast(context); - if (s) { - errorState = s->errorState(); - if (!errorState) - errorState = findErrorState(s->parentState()); - return errorState; - } - - return errorState; -} - -void QtStateMachinePrivate::setError(QtStateMachine::Error errorCode, QtAbstractState *currentContext) -{ - error = errorCode; - - switch (errorCode) { - case QtStateMachine::NoInitialStateError: - Q_ASSERT(currentContext != 0); - - errorString = QtStateMachine::tr("Missing initial state in compound state '%1'") - .arg(currentContext->objectName()); - - break; - case QtStateMachine::NoDefaultStateInHistoryState: - Q_ASSERT(currentContext != 0); - - errorString = QtStateMachine::tr("Missing default state in history state '%1'") - .arg(currentContext->objectName()); - break; - default: - errorString = QtStateMachine::tr("Unknown error"); - }; - - pendingErrorStates.clear(); - pendingErrorStatesForDefaultEntry.clear(); - - QtAbstractState *currentErrorState = findErrorState(currentContext); - - // Avoid infinite loop if the error state itself has an error - if (currentContext == currentErrorState) { - Q_ASSERT(currentContext != initialErrorStateForRoot); // RootErrorState is broken - currentErrorState = initialErrorStateForRoot; - } - - if (currentErrorState) { - QtState *lca = findLCA(QList() << currentErrorState << currentContext); - addStatesToEnter(currentErrorState, lca, pendingErrorStates, pendingErrorStatesForDefaultEntry); - } -} - -#ifndef QT_NO_ANIMATION - -QPair, QList > -QtStateMachinePrivate::initializeAnimation(QAbstractAnimation *abstractAnimation, - const QPropertyAssignment &prop) -{ - QList handledAnimations; - QList localResetEndValues; - QAnimationGroup *group = qobject_cast(abstractAnimation); - if (group) { - for (int i = 0; i < group->animationCount(); ++i) { - QAbstractAnimation *animationChild = group->animationAt(i); - QPair, QList > ret; - ret = initializeAnimation(animationChild, prop); - handledAnimations << ret.first; - localResetEndValues << ret.second; - } - } else { - QPropertyAnimation *animation = qobject_cast(abstractAnimation); - if (animation != 0 - && prop.object == animation->targetObject() - && prop.propertyName == animation->propertyName()) { - - if (!animation->startValue().isValid()) { - QByteArray propertyName = animation->propertyName(); - QVariant currentValue = animation->targetObject()->property(propertyName); - - QVariantAnimationPrivate::get(animation)->setDefaultStartValue(currentValue); - } - - // Only change end value if it is undefined - if (!animation->endValue().isValid()) { - animation->setEndValue(prop.value); - localResetEndValues.append(animation); - } - handledAnimations.append(animation); - } - } - return qMakePair(handledAnimations, localResetEndValues); -} - -static bool isAncestorOf(QObject *anc, QObject *o) -{ - for (o = o->parent() ; o != 0; o = o->parent()) { - if (o == anc) - return true; - } - return false; -} - -void QtStateMachinePrivate::_q_animationFinished() -{ - Q_Q(QtStateMachine); - QAbstractAnimation *animation = qobject_cast(q->sender()); - Q_ASSERT(animation != 0); - QList >::iterator it; - for (it = propertiesForAnimations.begin(); it != propertiesForAnimations.end(); ) { - QAbstractAnimation *a = (*it).first; - if (a == animation || isAncestorOf(animation, a)) { - QPropertyAssignment assn = (*it).second; - assn.object->setProperty(assn.propertyName, assn.value); - if (!assn.explicitlySet) - unregisterRestorable(assn.object, assn.propertyName); - it = propertiesForAnimations.erase(it); - } else { - ++it; - } - } - - playingAnimations.removeOne(animation); - if (playingAnimations.isEmpty()) - emit q->animationsFinished(); -} - -#endif // !QT_NO_ANIMATION - -namespace { - -class StartState : public QtState -{ -public: - StartState(QtState *parent) - : QtState(parent) {} -protected: - void onEntry() {} - void onExit() {} -}; - -class InitialTransition : public QtAbstractTransition -{ -public: - InitialTransition(QtAbstractState *target) - : QtAbstractTransition(QList() << target) {} -protected: - virtual bool eventTest(QEvent *) const { return true; } - virtual void onTransition() {} -}; - -} // namespace - -void QtStateMachinePrivate::_q_start() -{ - Q_Q(QtStateMachine); - Q_ASSERT(state == Starting); - if (!rootState) { - state = NotRunning; - return; - } - QtAbstractState *initial = rootState->initialState(); - if (initial == 0) - setError(QtStateMachine::NoInitialStateError, rootState); - - configuration.clear(); - qDeleteAll(internalEventQueue); - internalEventQueue.clear(); - qDeleteAll(externalEventQueue); - externalEventQueue.clear(); - -#ifdef QSTATEMACHINE_DEBUG - qDebug() << q << ": starting"; -#endif - state = Running; - processingScheduled = true; // we call _q_process() below - emit q->started(); - - StartState *start = new StartState(rootState); - QtAbstractTransition *initialTransition = new InitialTransition(initial); - start->addTransition(initialTransition); - QList transitions; - transitions.append(initialTransition); - executeTransitionContent(transitions); - enterStates(transitions); - applyProperties(transitions, QList() << initial); - delete start; - -#ifdef QSTATEMACHINE_DEBUG - qDebug() << q << ": initial configuration:" << configuration; -#endif - _q_process(); -} - -void QtStateMachinePrivate::_q_process() -{ - Q_Q(QtStateMachine); - Q_ASSERT(state == Running); - Q_ASSERT(!processing); - processing = true; - processingScheduled = false; -#ifdef QSTATEMACHINE_DEBUG - qDebug() << q << ": starting the event processing loop"; -#endif - while (processing) { - if (stop) { - stop = false; - processing = false; - stopProcessingReason = Stopped; - break; - } - QSet enabledTransitions; - QEvent *e = new QEvent(QEvent::None); - enabledTransitions = selectTransitions(e); - if (enabledTransitions.isEmpty()) { - delete e; - e = 0; - } - if (enabledTransitions.isEmpty() && !internalEventQueue.isEmpty()) { - e = internalEventQueue.takeFirst(); -#ifdef QSTATEMACHINE_DEBUG - qDebug() << q << ": dequeued internal event" << e << "of type" << e->type(); -#endif - enabledTransitions = selectTransitions(e); - if (enabledTransitions.isEmpty()) { - delete e; - e = 0; - } - } - if (enabledTransitions.isEmpty()) { - if (externalEventQueue.isEmpty()) { - if (internalEventQueue.isEmpty()) { - processing = false; - stopProcessingReason = EventQueueEmpty; - } - } else { - e = externalEventQueue.takeFirst(); -#ifdef QSTATEMACHINE_DEBUG - qDebug() << q << ": dequeued external event" << e << "of type" << e->type(); -#endif - enabledTransitions = selectTransitions(e); - if (enabledTransitions.isEmpty()) { - delete e; - e = 0; - } - } - } - if (!enabledTransitions.isEmpty()) { - q->beginMicrostep(e); - microstep(enabledTransitions.toList()); - q->endMicrostep(e); - } -#ifdef QSTATEMACHINE_DEBUG - else { - qDebug() << q << ": no transitions enabled"; - } -#endif - delete e; - } -#ifdef QSTATEMACHINE_DEBUG - qDebug() << q << ": finished the event processing loop"; -#endif - switch (stopProcessingReason) { - case EventQueueEmpty: - break; - case Finished: - state = NotRunning; - emit q->finished(); - break; - case Stopped: - state = NotRunning; - emit q->stopped(); - break; - } -} - -void QtStateMachinePrivate::scheduleProcess() -{ - if ((state != Running) || processing || processingScheduled) - return; - processingScheduled = true; - QMetaObject::invokeMethod(q_func(), "_q_process", Qt::QueuedConnection); -} - -void QtStateMachinePrivate::registerTransitions(QtAbstractState *state) -{ - QtState *group = qobject_cast(state); - if (!group) - return; - QList transitions = QtStatePrivate::get(group)->transitions(); - for (int i = 0; i < transitions.size(); ++i) { - QtAbstractTransition *t = transitions.at(i); - if (QtSignalTransition *st = qobject_cast(t)) { - registerSignalTransition(st); - } -#ifndef QT_NO_STATEMACHINE_EVENTFILTER - else if (QtEventTransition *oet = qobject_cast(t)) { - registerEventTransition(oet); - } -#endif - } -} - -void QtStateMachinePrivate::unregisterTransition(QtAbstractTransition *transition) -{ - if (QtSignalTransition *st = qobject_cast(transition)) { - unregisterSignalTransition(st); - } -#ifndef QT_NO_STATEMACHINE_EVENTFILTER - else if (QtEventTransition *oet = qobject_cast(transition)) { - unregisterEventTransition(oet); - } -#endif -} - -#ifndef QT_STATEMACHINE_SOLUTION - -static int senderSignalIndex(const QObject *sender) -{ - QObjectPrivate *d = QObjectPrivate::get(const_cast(sender)); - QMutexLocker(&d->threadData->mutex); - if (!d->currentSender) - return -1; - - // Return -1 if d->currentSender isn't in d->senders - bool found = false; - for (int i = 0; !found && i < d->senders.count(); ++i) - found = (d->senders.at(i).sender == d->currentSender->sender); - if (!found) - return -1; - return d->currentSender->signal; -} - -#endif - -void QtStateMachinePrivate::registerSignalTransition(QtSignalTransition *transition) -{ - Q_Q(QtStateMachine); - if (QtSignalTransitionPrivate::get(transition)->signalIndex != -1) - return; // already registered - QObject *sender = QtSignalTransitionPrivate::get(transition)->sender; - if (!sender) - return; - QByteArray signal = QtSignalTransitionPrivate::get(transition)->signal; - if (signal.startsWith('0'+QSIGNAL_CODE)) - signal.remove(0, 1); - int signalIndex = sender->metaObject()->indexOfSignal(signal); - if (signalIndex == -1) { - qWarning("QtSignalTransition: no such signal: %s::%s", - sender->metaObject()->className(), signal.constData()); - return; - } - QList &connectedSignalIndexes = connections[sender]; - if (!connectedSignalIndexes.contains(signalIndex)) { -#ifndef QT_STATEMACHINE_SOLUTION - if (!signalEventGenerator) - signalEventGenerator = new QtSignalEventGenerator(q); -#else - QtSignalEventGenerator *signalEventGenerator = new QtSignalEventGenerator(signalIndex, q); -#endif - bool ok = QMetaObject::connect(sender, signalIndex, signalEventGenerator, - signalEventGenerator->metaObject()->methodOffset()); - if (!ok) { -#ifdef QSTATEMACHINE_DEBUG - qDebug() << q << ": FAILED to add signal transition from" << transition->sourceState() - << ": ( sender =" << sender << ", signal =" << (signal.mid(1)) - << ", targets =" << transition->targetStates() << ")"; -#endif - return; - } - connectedSignalIndexes.append(signalIndex); - } - QtSignalTransitionPrivate::get(transition)->signalIndex = signalIndex; -#ifdef QSTATEMACHINE_DEBUG - qDebug() << q << ": added signal transition from" << transition->sourceState() - << ": ( sender =" << sender << ", signal =" << (signal.mid(1)) - << ", targets =" << transition->targetStates() << ")"; -#endif -} - -void QtStateMachinePrivate::unregisterSignalTransition(QtSignalTransition *transition) -{ - int signalIndex = QtSignalTransitionPrivate::get(transition)->signalIndex; - if (signalIndex == -1) - return; // not registered -#ifndef QT_STATEMACHINE_SOLUTION - const QObject *sender = QtSignalTransitionPrivate::get(transition)->sender; - QList &connectedSignalIndexes = connections[sender]; - Q_ASSERT(connectedSignalIndexes.contains(signalIndex)); - Q_ASSERT(signalEventGenerator != 0); - bool ok = QMetaObject::disconnect(sender, signalIndex, signalEventGenerator, - signalEventGenerator->metaObject()->methodOffset()); - if (ok) { - connectedSignalIndexes.removeOne(signalIndex); - if (connectedSignalIndexes.isEmpty()) - connections.remove(sender); - QtSignalTransitionPrivate::get(transition)->signalIndex = -1; - } -#endif -} - -#ifndef QT_NO_STATEMACHINE_EVENTFILTER -void QtStateMachinePrivate::registerEventTransition(QtEventTransition *transition) -{ - Q_Q(QtStateMachine); - if (QtEventTransitionPrivate::get(transition)->registered) - return; - if (transition->eventType() >= QEvent::User) { - qWarning("QObject event transitions are not supported for custom types"); - return; - } - QObject *object = QtEventTransitionPrivate::get(transition)->object; - if (!object) - return; -#ifndef QT_STATEMACHINE_SOLUTION - QObjectPrivate *od = QObjectPrivate::get(object); - if (!od->eventFilters.contains(q)) -#endif - object->installEventFilter(q); - qobjectEvents[object].insert(transition->eventType()); - QtEventTransitionPrivate::get(transition)->registered = true; -#ifdef QSTATEMACHINE_DEBUG - qDebug() << q << ": added event transition from" << transition->sourceState() - << ": ( object =" << object << ", event =" << transition->eventType() - << ", targets =" << transition->targetStates() << ")"; -#endif -} - -void QtStateMachinePrivate::unregisterEventTransition(QtEventTransition *transition) -{ - Q_Q(QtStateMachine); - if (!QtEventTransitionPrivate::get(transition)->registered) - return; - QObject *object = QtEventTransitionPrivate::get(transition)->object; - QSet &events = qobjectEvents[object]; - events.remove(transition->eventType()); - if (events.isEmpty()) { - qobjectEvents.remove(object); - object->removeEventFilter(q); - } - QtEventTransitionPrivate::get(transition)->registered = false; -} -#endif - -void QtStateMachinePrivate::handleTransitionSignal(const QObject *sender, int signalIndex, - void **argv) -{ - const QList &connectedSignalIndexes = connections[sender]; - Q_ASSERT(connectedSignalIndexes.contains(signalIndex)); - const QMetaObject *meta = sender->metaObject(); - QMetaMethod method = meta->method(signalIndex); - QList parameterTypes = method.parameterTypes(); - int argc = parameterTypes.count(); - QList vargs; - for (int i = 0; i < argc; ++i) { - int type = QMetaType::type(parameterTypes.at(i)); - vargs.append(QVariant(type, argv[i+1])); - } - -#ifdef QSTATEMACHINE_DEBUG - qDebug() << q_func() << ": sending signal event ( sender =" << sender - << ", signal =" << sender->metaObject()->method(signalIndex).signature() << ")"; -#endif - internalEventQueue.append(new QtSignalEvent(sender, signalIndex, vargs)); - scheduleProcess(); -} - -/*! - Constructs a new state machine with the given \a parent. -*/ -QtStateMachine::QtStateMachine(QObject *parent) - : QObject( -#ifndef QT_STATEMACHINE_SOLUTION - *new QtStateMachinePrivate, -#endif - parent) -#ifdef QT_STATEMACHINE_SOLUTION - , d_ptr(new QtStateMachinePrivate) -#endif -{ -#ifdef QT_STATEMACHINE_SOLUTION - d_ptr->q_ptr = this; -#endif -} - -/*! - \internal -*/ -QtStateMachine::QtStateMachine(QtStateMachinePrivate &dd, QObject *parent) - : QObject( -#ifndef QT_STATEMACHINE_SOLUTION - dd, -#endif - parent) -#ifdef QT_STATEMACHINE_SOLUTION - , d_ptr(&dd) -#endif -{ -#ifdef QT_STATEMACHINE_SOLUTION - d_ptr->q_ptr = this; -#endif -} - -/*! - Destroys this state machine. -*/ -QtStateMachine::~QtStateMachine() -{ -#ifdef QT_STATEMACHINE_SOLUTION - delete d_ptr; -#endif -} - -namespace { - -class RootErrorState : public QtAbstractState -{ -public: - RootErrorState(QtState *parent) - : QtAbstractState(parent) - { - setObjectName(QString::fromLatin1("DefaultErrorState")); - } - - void onEntry() - { - QtAbstractStatePrivate *d = QtAbstractStatePrivate::get(this); - QtStateMachine *machine = d->machine(); - - qWarning("Unrecoverable error detected in running state machine: %s", - qPrintable(machine->errorString())); - } - - void onExit() {} -}; - -class RootState : public QtState -{ -public: - RootState(QtState *parent) - : QtState(parent) - { - } - - void onEntry() {} - void onExit() {} -}; - -} // namespace - -/*! - Returns this state machine's root state. -*/ -QtState *QtStateMachine::rootState() const -{ - Q_D(const QtStateMachine); - if (!d->rootState) { - const_cast(d)->rootState = new RootState(0); - const_cast(d)->initialErrorStateForRoot = new RootErrorState(d->rootState); - d->rootState->setParent(const_cast(this)); - d->rootState->setErrorState(d->initialErrorStateForRoot); - } - return d->rootState; -} - -/*! - Returns the error state of the state machine's root state. - - \sa QtState::errorState() -*/ -QtAbstractState *QtStateMachine::errorState() const -{ - return rootState()->errorState(); -} - -/*! - Sets the error state of this state machine's root state to be \a state. When a running state - machine encounters an error which puts it in an undefined state, it will enter an error state - based on the context of the error that occurred. It will enter this state regardless of what - is currently in the event queue. - - If the erroneous state has an error state set, this will be entered by the machine. If no error - state has been set, the state machine will search the parent hierarchy recursively for an - error state. The error state of the root state can thus be seen as a global error state that - applies for the states for which a more specific error state has not been set. - - Before entering the error state, the state machine will set the error code returned by error() and - error message returned by errorString(). - - The default error state will print a warning to the console containing the information returned by - errorString(). By setting a new error state on either the state machine itself, or on specific - states, you can fine tune error handling in the state machine. - - If the root state's error state is set to 0, or if the error state selected by the machine itself - contains an error, the default error state will be used. - - \sa QtState::setErrorState(), rootState() -*/ -void QtStateMachine::setErrorState(QtAbstractState *state) -{ - rootState()->setErrorState(state); -} - -/*! \enum QtStateMachine::Error - - This enum type defines errors that can occur in the state machine at run time. When the state - machine encounters an unrecoverable error at run time, it will set the error code returned - by error(), the error message returned by errorString(), and enter an error state based on - the context of the error. - - \value NoError No error has occurred. - \value NoInitialStateError The machine has entered a QtState with children which does not have an - initial state set. The context of this error is the state which is missing an initial - state. - \value NoDefaultStateInHistoryState The machine has entered a QtHistoryState which does not have - a default state set. The context of this error is the QtHistoryState which is missing a - default state. - - \sa setErrorState() -*/ - -/*! - Returns the error code of the last error that occurred in the state machine. -*/ -QtStateMachine::Error QtStateMachine::error() const -{ - Q_D(const QtStateMachine); - return d->error; -} - -/*! - Returns the error string of the last error that occurred in the state machine. -*/ -QString QtStateMachine::errorString() const -{ - Q_D(const QtStateMachine); - return d->errorString; -} - -/*! - Clears the error string and error code of the state machine. -*/ -void QtStateMachine::clearError() -{ - Q_D(QtStateMachine); - d->errorString.clear(); - d->error = NoError; -} - -/*! - Returns the global restore policy of the state machine. - - \sa QtActionState::restorePolicy() -*/ -QtActionState::RestorePolicy QtStateMachine::globalRestorePolicy() const -{ - Q_D(const QtStateMachine); - return d->globalRestorePolicy; -} - -/*! - Sets the global restore policy of the state machine to \a restorePolicy. The default global - restore policy is QtAbstractState::DoNotRestoreProperties. - - The global restore policy cannot be set to QtAbstractState::GlobalRestorePolicy. - - \sa QtAbstractState::setRestorePolicy() -*/ -void QtStateMachine::setGlobalRestorePolicy(QtAbstractState::RestorePolicy restorePolicy) -{ - Q_D(QtStateMachine); - if (restorePolicy == QtState::GlobalRestorePolicy) { - qWarning("QtStateMachine::setGlobalRestorePolicy: Cannot set global restore policy to " - "GlobalRestorePolicy"); - return; - } - - d->globalRestorePolicy = restorePolicy; -} - -/*! - Returns this state machine's initial state, or 0 if no initial state has - been set. -*/ -QtAbstractState *QtStateMachine::initialState() const -{ - Q_D(const QtStateMachine); - if (!d->rootState) - return 0; - return d->rootState->initialState(); -} - -/*! - Sets this state machine's initial \a state. -*/ -void QtStateMachine::setInitialState(QtAbstractState *state) -{ - Q_D(QtStateMachine); - if (!d->rootState) { - if (!state) - return; - rootState()->setInitialState(state); - } - d->rootState->setInitialState(state); -} - -/*! - Adds the given \a state to this state machine. The state becomes a top-level - state (i.e. a child of the rootState()). - - If the state is already in a different machine, it will first be removed - from its old machine, and then added to this machine. - - \sa removeState(), rootState() -*/ -void QtStateMachine::addState(QtAbstractState *state) -{ - if (!state) { - qWarning("QtStateMachine::addState: cannot add null state"); - return; - } - if (QtAbstractStatePrivate::get(state)->machine() == this) { - qWarning("QtStateMachine::addState: state has already been added to this machine"); - return; - } - state->setParent(rootState()); -} - -/*! - Removes the given \a state from this state machine. The state machine - releases ownership of the state. - - \sa addState() -*/ -void QtStateMachine::removeState(QtAbstractState *state) -{ - if (!state) { - qWarning("QtStateMachine::removeState: cannot remove null state"); - return; - } - if (QtAbstractStatePrivate::get(state)->machine() != this) { - qWarning("QtStateMachine::removeState: state %p's machine (%p)" - " is different from this machine (%p)", - state, QtAbstractStatePrivate::get(state)->machine(), this); - return; - } - state->setParent(0); -} - -/*! - Starts this state machine. - The machine will reset its configuration and transition to the initial - state. When a final top-level state is entered, the machine will emit the - finished() signal. - - \sa started(), finished(), stop(), initialState() -*/ -void QtStateMachine::start() -{ - Q_D(QtStateMachine); - - if (rootState()->initialState() == 0) { - qWarning("QtStateMachine::start: No initial state set for machine. Refusing to start."); - return; - } - - switch (d->state) { - case QtStateMachinePrivate::NotRunning: - d->state = QtStateMachinePrivate::Starting; - QMetaObject::invokeMethod(this, "_q_start", Qt::QueuedConnection); - break; - case QtStateMachinePrivate::Starting: - break; - case QtStateMachinePrivate::Running: - qWarning("QtStateMachine::start(): already running"); - break; - } -} - -/*! - Stops this state machine. - - \sa stopped() -*/ -void QtStateMachine::stop() -{ - Q_D(QtStateMachine); - switch (d->state) { - case QtStateMachinePrivate::NotRunning: - break; - case QtStateMachinePrivate::Starting: - // the machine will exit as soon as it enters the event processing loop - d->stop = true; - break; - case QtStateMachinePrivate::Running: - d->stop = true; - d->scheduleProcess(); - break; - } -} - -/*! - Posts the given \a event for processing by this state machine, with a delay - of \a delay milliseconds. - - This function returns immediately. The event is added to the state machine's - event queue. Events are processed in the order posted. The state machine - takes ownership of the event and deletes it once it has been processed. - - You can only post events when the state machine is running. -*/ -void QtStateMachine::postEvent(QEvent *event, int delay) -{ - Q_D(QtStateMachine); - if (d->state != QtStateMachinePrivate::Running) { - qWarning("QtStateMachine::postEvent: cannot post event when the state machine is not running"); - return; - } -#ifdef QSTATEMACHINE_DEBUG - qDebug() << this << ": posting external event" << event << "with delay" << delay; -#endif - if (delay) { - int tid = startTimer(delay); - d->delayedEvents[tid] = event; - } else { - d->externalEventQueue.append(event); - d->scheduleProcess(); - } -} - -/*! - \internal - - Posts the given internal \a event for processing by this state machine. -*/ -void QtStateMachine::postInternalEvent(QEvent *event) -{ - Q_D(QtStateMachine); -#ifdef QSTATEMACHINE_DEBUG - qDebug() << this << ": posting internal event" << event; -#endif - d->internalEventQueue.append(event); - d->scheduleProcess(); -} - -/*! - Returns the list of this state machine's states, or an empty list if the - state machine has no states. -*/ -QList QtStateMachine::states() const -{ - return QtStatePrivate::get(rootState())->childStates(); -} - -/*! - \internal - - Returns the maximal consistent set of states (including parallel and final - states) that this state machine is currently in. If a state \c s is in the - configuration, it is always the case that the parent of \c s is also in - c. Note, however, that the rootState() is not an explicit member of the - configuration. -*/ -QSet QtStateMachine::configuration() const -{ - Q_D(const QtStateMachine); - return d->configuration; -} - -/*! - \fn QtStateMachine::started() - - This signal is emitted when the state machine has entered its initial state. - - \sa QtStateMachine::finished(), QtStateMachine::start() -*/ - -/*! - \fn QtStateMachine::finished() - - This signal is emitted when the state machine has reached a top-level final - state. - - \sa QtStateMachine::started() -*/ - -/*! - \fn QtStateMachine::stopped() - - This signal is emitted when the state machine has stopped. - - \sa QtStateMachine::stop() -*/ - -#ifndef QT_NO_ANIMATION - -/*! - \fn QtStateMachine::animationsFinished() - - This signal is emitted when the state machine has finished playing all - animations associated with the latest transition (i.e., all properties have - reached their target values). -*/ - -#endif - -/*! - \reimp -*/ -bool QtStateMachine::event(QEvent *e) -{ - Q_D(QtStateMachine); - if (e->type() == QEvent::Timer) { - QTimerEvent *te = static_cast(e); - int tid = te->timerId(); - if (d->delayedEvents.contains(tid)) { - killTimer(tid); - QEvent *ee = d->delayedEvents.take(tid); - d->externalEventQueue.append(ee); - d->scheduleProcess(); - return true; - } - } else if (e->type() == QEvent::ChildAdded) { - QChildEvent *ce = static_cast(e); - if (QtAbstractState *state = qobject_cast(ce->child())) { - if (state != rootState()) { - state->setParent(rootState()); - return true; - } - } - } - return QObject::event(e); -} - -#ifndef QT_NO_STATEMACHINE_EVENTFILTER -/*! - \reimp -*/ -bool QtStateMachine::eventFilter(QObject *watched, QEvent *event) -{ - Q_D(QtStateMachine); - Q_ASSERT(d->qobjectEvents.contains(watched)); - if (d->qobjectEvents[watched].contains(event->type())) - postEvent(new QtBoundEvent(watched, d->handler->cloneEvent(event))); - return false; -} -#endif - -/*! - \internal - - This function is called when the state machine is about to select - transitions based on the given \a event. - - The default implementation does nothing. -*/ -void QtStateMachine::beginSelectTransitions(QEvent *event) -{ - Q_UNUSED(event); -} - -/*! - \internal - - This function is called when the state machine has finished selecting - transitions based on the given \a event. - - The default implementation does nothing. -*/ -void QtStateMachine::endSelectTransitions(QEvent *event) -{ - Q_UNUSED(event); -} - -/*! - \internal - - This function is called when the state machine is about to do a microstep. - - The default implementation does nothing. -*/ -void QtStateMachine::beginMicrostep(QEvent *event) -{ - Q_UNUSED(event); -} - -/*! - \internal - - This function is called when the state machine has finished doing a - microstep. - - The default implementation does nothing. -*/ -void QtStateMachine::endMicrostep(QEvent *event) -{ - Q_UNUSED(event); -} - -static const uint qt_meta_data_QtSignalEventGenerator[] = { - - // content: - 2, // revision - 0, // classname - 0, 0, // classinfo - 1, 12, // methods - 0, 0, // properties - 0, 0, // enums/sets - 0, 0, // constructors - - // slots: signature, parameters, type, tag, flags - 23, 22, 22, 22, 0x0a, - - 0 // eod -}; - -static const char qt_meta_stringdata_QtSignalEventGenerator[] = { - "QtSignalEventGenerator\0\0execute()\0" -}; - -const QMetaObject QtSignalEventGenerator::staticMetaObject = { - { &QObject::staticMetaObject, qt_meta_stringdata_QtSignalEventGenerator, - qt_meta_data_QtSignalEventGenerator, 0 } -}; - -const QMetaObject *QtSignalEventGenerator::metaObject() const -{ - return &staticMetaObject; -} - -void *QtSignalEventGenerator::qt_metacast(const char *_clname) -{ - if (!_clname) return 0; - if (!strcmp(_clname, qt_meta_stringdata_QtSignalEventGenerator)) - return static_cast(const_cast< QtSignalEventGenerator*>(this)); - return QObject::qt_metacast(_clname); -} - -int QtSignalEventGenerator::qt_metacall(QMetaObject::Call _c, int _id, void **_a) -{ - _id = QObject::qt_metacall(_c, _id, _a); - if (_id < 0) - return _id; - if (_c == QMetaObject::InvokeMetaMethod) { - switch (_id) { - case 0: { -#ifndef QT_STATEMACHINE_SOLUTION -// ### in Qt 4.6 we can use QObject::senderSignalIndex() - int signalIndex = senderSignalIndex(this); - Q_ASSERT(signalIndex != -1); -#endif - QtStateMachine *machine = qobject_cast(parent()); - QtStateMachinePrivate::get(machine)->handleTransitionSignal(sender(), signalIndex, _a); - break; - } - default: ; - } - _id -= 1; - } - return _id; -} - -QtSignalEventGenerator::QtSignalEventGenerator( -#ifdef QT_STATEMACHINE_SOLUTION - int sigIdx, -#endif - QtStateMachine *parent) - : QObject(parent) -#ifdef QT_STATEMACHINE_SOLUTION - , signalIndex(sigIdx) -#endif -{ -} - -/*! - \class QtSignalEvent - - \brief The QtSignalEvent class represents a Qt signal event. - - \since 4.6 - \ingroup statemachine - - A signal event is generated by a QtStateMachine in response to a Qt - signal. The QtSignalTransition class provides a transition associated with a - signal event. QtSignalEvent is part of \l{The State Machine Framework}. - - The sender() function returns the object that generated the signal. The - signalIndex() function returns the index of the signal. The arguments() - function returns the arguments of the signal. - - \sa QtSignalTransition -*/ - -/*! - \internal - - Constructs a new QtSignalEvent object with the given \a sender, \a - signalIndex and \a arguments. -*/ -QtSignalEvent::QtSignalEvent(const QObject *sender, int signalIndex, - const QList &arguments) - : -#ifndef QT_STATEMACHINE_SOLUTION - QEvent(QEvent::Signal) -#else - QEvent(QEvent::Type(QEvent::User-1)) -#endif - , m_sender(sender), m_signalIndex(signalIndex), m_arguments(arguments) -{ -} - -/*! - Destroys this QtSignalEvent. -*/ -QtSignalEvent::~QtSignalEvent() -{ -} - -/*! - \fn QtSignalEvent::sender() const - - Returns the object that emitted the signal. - - \sa QObject::sender() -*/ - -/*! - \fn QtSignalEvent::signalIndex() const - - Returns the index of the signal. - - \sa QMetaObject::indexOfSignal() -*/ - -/*! - \fn QtSignalEvent::arguments() const - - Returns the arguments of the signal. -*/ - -/*! - \class QtStateFinishedEvent - - \brief The QtStateFinishedEvent class contains parameters that describe a state that has finished. - - \since 4.6 - \ingroup statemachine - - A state is finished when one of its final child states (a QtFinalState) is - entered; this will cause a QtStateFinishedEvent to be generated by the state - machine. QtStateFinishedEvent is part of \l{The State Machine Framework}. - - Typically you do not create QtStateFinishedEvent objects yourself, but rather - use QtStateFinishedTransition to create a transition that's triggered by a - state's finished event. - - \sa QtStateFinishedTransition -*/ - -/*! - \internal - - Constructs a new QtStateFinishedEvent object associated with the given \a state. -*/ -QtStateFinishedEvent::QtStateFinishedEvent(QtState *state) - : -#ifndef QT_STATEMACHINE_SOLUTION - QEvent(StateFinished) -#else - QEvent(QEvent::Type(QEvent::User-2)) -#endif - , m_state(state) -{ -} - -/*! - Destroys this QtStateFinishedEvent. -*/ -QtStateFinishedEvent::~QtStateFinishedEvent() -{ -} - -/*! - Returns the state associated with this QtStateFinishedEvent. -*/ -QtState *QtStateFinishedEvent::state() const -{ - return m_state; -} - -QT_END_NAMESPACE - -#include "moc_qstatemachine.cpp" diff --git a/lib/qtstatemachine/src/qstatemachine.h b/lib/qtstatemachine/src/qstatemachine.h deleted file mode 100644 index 92ced4f..0000000 --- a/lib/qtstatemachine/src/qstatemachine.h +++ /dev/null @@ -1,161 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QSTATEMACHINE_H -#define QSTATEMACHINE_H - -#include "qtstatemachineglobal.h" -#ifndef QT_STATEMACHINE_SOLUTION -# include -#else -# include "qactionstate.h" -#endif - -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Core) - -class QEvent; -class QtAbstractState; -class QtState; - -class QtStateMachinePrivate; -class Q_STATEMACHINE_CORE_EXPORT QtStateMachine : public QObject -{ - Q_OBJECT - Q_PROPERTY(QtState* rootState READ rootState) - Q_PROPERTY(QtAbstractState* initialState READ initialState WRITE setInitialState) - Q_PROPERTY(QtAbstractState* errorState READ errorState WRITE setErrorState) - Q_PROPERTY(QString errorString READ errorString) -public: - - enum Error { - NoError, - NoInitialStateError, - NoDefaultStateInHistoryState, - }; - - QtStateMachine(QObject *parent = 0); - ~QtStateMachine(); - - void addState(QtAbstractState *state); - void removeState(QtAbstractState *state); - - QtState *rootState() const; - - QtAbstractState *initialState() const; - void setInitialState(QtAbstractState *state); - - QtAbstractState *errorState() const; - void setErrorState(QtAbstractState *state); - - Error error() const; - QString errorString() const; - void clearError(); - - QtAbstractState::RestorePolicy globalRestorePolicy() const; - void setGlobalRestorePolicy(QtAbstractState::RestorePolicy restorePolicy); - - void postEvent(QEvent *event, int delay = 0); - - QList states() const; - QSet configuration() const; - -#ifndef QT_NO_STATEMACHINE_EVENTFILTER - bool eventFilter(QObject *watched, QEvent *event); -#endif - -public Q_SLOTS: - void start(); - void stop(); - -Q_SIGNALS: - void started(); - void stopped(); - void finished(); - -#ifndef QT_NO_ANIMATION - void animationsFinished(); -#endif - -protected: - void postInternalEvent(QEvent *event); - - virtual void beginSelectTransitions(QEvent *event); - virtual void endSelectTransitions(QEvent *event); - - virtual void beginMicrostep(QEvent *event); - virtual void endMicrostep(QEvent *event); - - bool event(QEvent *e); - -protected: -#ifdef QT_STATEMACHINE_SOLUTION - QtStateMachinePrivate *d_ptr; -#endif - QtStateMachine(QtStateMachinePrivate &dd, QObject *parent); - -private: - Q_DISABLE_COPY(QtStateMachine) - Q_DECLARE_PRIVATE(QtStateMachine) - Q_PRIVATE_SLOT(d_func(), void _q_start()) - Q_PRIVATE_SLOT(d_func(), void _q_process()) -#ifndef QT_NO_ANIMATION - Q_PRIVATE_SLOT(d_func(), void _q_animationFinished()) -#endif -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/lib/qtstatemachine/src/qstatemachine_p.h b/lib/qtstatemachine/src/qstatemachine_p.h deleted file mode 100644 index 1995a80..0000000 --- a/lib/qtstatemachine/src/qstatemachine_p.h +++ /dev/null @@ -1,219 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QSTATEMACHINE_P_H -#define QSTATEMACHINE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#ifndef QT_STATEMACHINE_SOLUTION -#include -#endif -#include -#include -#include -#include -#include - -#include "qabstractstate_p.h" - -QT_BEGIN_NAMESPACE - -class QEvent; -#ifndef QT_NO_STATEMACHINE_EVENTFILTER -class QtEventTransition; -#endif -class QtSignalEventGenerator; -class QtSignalTransition; -class QtAbstractState; -class QtAbstractTransition; -class QtState; - -#ifndef QT_NO_ANIMATION -class QAbstractAnimation; -#endif - -class QtStateMachine; -class Q_STATEMACHINE_CORE_EXPORT QtStateMachinePrivate -#ifndef QT_STATEMACHINE_SOLUTION - : public QObjectPrivate -#endif -{ - Q_DECLARE_PUBLIC(QtStateMachine) -public: - enum State { - NotRunning, - Starting, - Running - }; - enum StopProcessingReason { - EventQueueEmpty, - Finished, - Stopped - }; - - QtStateMachinePrivate(); - ~QtStateMachinePrivate(); - - static QtStateMachinePrivate *get(QtStateMachine *q); - - static QtState *findLCA(const QList &states); - - static bool stateEntryLessThan(QtAbstractState *s1, QtAbstractState *s2); - static bool stateExitLessThan(QtAbstractState *s1, QtAbstractState *s2); - - QtAbstractState *findErrorState(QtAbstractState *context); - void setError(QtStateMachine::Error error, QtAbstractState *currentContext); - - // private slots - void _q_start(); - void _q_process(); -#ifndef QT_NO_ANIMATION - void _q_animationFinished(); -#endif - - void microstep(const QList &transitionList); - bool isPreempted(const QtAbstractState *s, const QSet &transitions) const; - QSet selectTransitions(QEvent *event) const; - QList exitStates(const QList &transitionList); - void executeTransitionContent(const QList &transitionList); - QList enterStates(const QList &enabledTransitions); - void addStatesToEnter(QtAbstractState *s, QtState *root, - QSet &statesToEnter, - QSet &statesForDefaultEntry); - - void applyProperties(const QList &transitionList, - const QList &enteredStates); - - bool isInFinalState(QtAbstractState *s) const; - static bool isFinal(const QtAbstractState *s); - static bool isParallel(const QtAbstractState *s); - static bool isCompound(const QtAbstractState *s); - static bool isAtomic(const QtAbstractState *s); - static bool isDescendantOf(const QtAbstractState *s, const QtAbstractState *other); - static QList properAncestors(const QtAbstractState *s, const QtState *upperBound); - - void registerTransitions(QtAbstractState *state); - void registerSignalTransition(QtSignalTransition *transition); - void unregisterSignalTransition(QtSignalTransition *transition); -#ifndef QT_NO_STATEMACHINE_EVENTFILTER - void registerEventTransition(QtEventTransition *transition); - void unregisterEventTransition(QtEventTransition *transition); -#endif - void unregisterTransition(QtAbstractTransition *transition); - void handleTransitionSignal(const QObject *sender, int signalIndex, - void **args); - void scheduleProcess(); - - typedef QPair RestorableId; - QHash registeredRestorables; - void registerRestorable(QObject *object, const QByteArray &propertyName); - void unregisterRestorable(QObject *object, const QByteArray &propertyName); - bool hasRestorable(QObject *object, const QByteArray &propertyName) const; - QVariant restorableValue(QObject *object, const QByteArray &propertyName) const; - QList restorablesToPropertyList(const QHash &restorables) const; - - State state; - bool processing; - bool processingScheduled; - bool stop; - StopProcessingReason stopProcessingReason; - QtState *rootState; - QSet configuration; - QList internalEventQueue; - QList externalEventQueue; - - QtStateMachine::Error error; - QtActionState::RestorePolicy globalRestorePolicy; - - QString errorString; - QSet pendingErrorStates; - QSet pendingErrorStatesForDefaultEntry; - QtAbstractState *initialErrorStateForRoot; - -#ifndef QT_NO_ANIMATION - QPair, QList > - initializeAnimation(QAbstractAnimation *abstractAnimation, - const QPropertyAssignment &prop); - - QList > propertiesForAnimations; - QList playingAnimations; - QList resetEndValues; -#endif - -#ifndef QT_STATEMACHINE_SOLUTION - QtSignalEventGenerator *signalEventGenerator; -#endif - QHash > connections; -#ifndef QT_NO_STATEMACHINE_EVENTFILTER - QHash > qobjectEvents; -#endif - QHash delayedEvents; - - typedef QEvent* (*f_cloneEvent)(QEvent*); - struct Handler { - f_cloneEvent cloneEvent; - }; - - static const Handler *handler; - -#ifdef QT_STATEMACHINE_SOLUTION - QtStateMachine *q_ptr; -#endif -}; - -QT_END_NAMESPACE - -#endif diff --git a/lib/qtstatemachine/src/qtransition.cpp b/lib/qtstatemachine/src/qtransition.cpp deleted file mode 100644 index 5a32dce..0000000 --- a/lib/qtstatemachine/src/qtransition.cpp +++ /dev/null @@ -1,235 +0,0 @@ -/**************************************************************************** -** -** This file is 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 "qtransition.h" -#include "qtransition_p.h" -#include "qstateaction.h" -#include "qstateaction_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QtTransition - - \brief The QtTransition class provides an action-based transition. - - \since 4.6 - \ingroup statemachine - - QtTransition provides an action-based transition; you add actions with the - addAction() function. The transition executes the actions when the - transition is triggered. QtTransition is part of \l{The State Machine - Framework}. - - The invokeMethodOnTransition() function is used for defining method - invocations that should be performed when a transition is taken. - - \code - QtStateMachine machine; - QtState *s1 = new QtState(); - machine.addState(s1); - QtTransition *t1 = new QtTransition(); - QLabel label; - t1->invokeMethodOnTransition(&label, "clear"); - QtState *s2 = new QtState(); - machine.addState(s2); - t1->setTargetState(s2); - s1->addTransition(t1); - \endcode - - Actions are executed in the order in which they were added. - - \sa QtState::addTransition(), QtStateAction -*/ - -QtTransitionPrivate::QtTransitionPrivate() -{ -} - -QtTransitionPrivate::~QtTransitionPrivate() -{ -} - -QtTransitionPrivate *QtTransitionPrivate::get(QtTransition *q) -{ - return q->d_func(); -} - -const QtTransitionPrivate *QtTransitionPrivate::get(const QtTransition *q) -{ - return q->d_func(); -} - -QList QtTransitionPrivate::actions() const -{ - QList result; - QList::const_iterator it; -#ifdef QT_STATEMACHINE_SOLUTION - const QObjectList &children = q_func()->children(); -#endif - for (it = children.constBegin(); it != children.constEnd(); ++it) { - QtStateAction *s = qobject_cast(*it); - if (s) - result.append(s); - } - return result; -} - -/*! - Constructs a new QtTransition object with the given \a sourceState. -*/ -QtTransition::QtTransition(QtState *sourceState) - : QtAbstractTransition(*new QtTransitionPrivate, sourceState) -{ -} - -/*! - Constructs a new QtTransition object with the given \a targets and \a - sourceState. -*/ -QtTransition::QtTransition(const QList &targets, QtState *sourceState) - : QtAbstractTransition(*new QtTransitionPrivate, targets, sourceState) -{ -} - -/*! - \internal -*/ -QtTransition::QtTransition(QtTransitionPrivate &dd, QtState *parent) - : QtAbstractTransition(dd, parent) -{ -} - -/*! - \internal -*/ -QtTransition::QtTransition(QtTransitionPrivate &dd, const QList &targets, QtState *parent) - : QtAbstractTransition(dd, targets, parent) -{ -} - -/*! - Destroys this transition. -*/ -QtTransition::~QtTransition() -{ -} - -/*! - Instructs this QtTransition to invoke the given \a method of the given \a - object with the given \a arguments when the transition is taken. This - function will create a QtStateInvokeMethodAction object and add it to the - actions of the transition. -*/ -void QtTransition::invokeMethodOnTransition(QObject *object, const char *method, - const QList &arguments) -{ - addAction(new QtStateInvokeMethodAction(object, method, arguments)); -} - -/*! - Adds the given \a action to this transition. - The action will be executed when the transition is triggered. - The transition takes ownership of the action. - - \sa removeAction() -*/ -void QtTransition::addAction(QtStateAction *action) -{ - if (!action) { - qWarning("QtTransition::addAction: cannot add null action"); - return; - } - action->setParent(this); -} - -/*! - Removes the given \a action from this transition. - The transition releases ownership of the action. - - \sa addAction() -*/ -void QtTransition::removeAction(QtStateAction *action) -{ - if (!action) { - qWarning("QtTransition::removeAction: cannot remove null action"); - return; - } - action->setParent(0); -} - -/*! - Returns this transitions's actions, or an empty list if the transition has - no actions. - - \sa addAction() -*/ -QList QtTransition::actions() const -{ - Q_D(const QtTransition); - return d->actions(); -} - -/*! - \reimp -*/ -void QtTransition::onTransition() -{ - Q_D(QtTransition); - QList actions = d->actions(); - for (int i = 0; i < actions.size(); ++i) - QtStateActionPrivate::get(actions.at(i))->callExecute(); -} - -/*! - \reimp -*/ -bool QtTransition::event(QEvent *e) -{ - return QtAbstractTransition::event(e); -} - -QT_END_NAMESPACE diff --git a/lib/qtstatemachine/src/qtransition.h b/lib/qtstatemachine/src/qtransition.h deleted file mode 100644 index ea7337f..0000000 --- a/lib/qtstatemachine/src/qtransition.h +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QTRANSITION_H -#define QTRANSITION_H - -#include "qtstatemachineglobal.h" -#ifndef QT_STATEMACHINE_SOLUTION -#include -#else -#include "qabstracttransition.h" -#endif - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Core) - -class QtStateAction; - -class QtTransitionPrivate; -class Q_STATEMACHINE_CORE_EXPORT QtTransition : public QtAbstractTransition -{ - Q_OBJECT -public: - QtTransition(QtState *sourceState = 0); - QtTransition(const QList &targets, QtState *sourceState = 0); - ~QtTransition(); - - void invokeMethodOnTransition(QObject *object, const char *method, - const QList &args = QList()); - - void addAction(QtStateAction *action); - void removeAction(QtStateAction *action); - QList actions() const; - -protected: - virtual void onTransition(); - - bool event(QEvent *e); - -protected: - QtTransition(QtTransitionPrivate &dd, QtState *parent); - QtTransition(QtTransitionPrivate &dd, const QList &targets, QtState *parent); - -private: - Q_DISABLE_COPY(QtTransition) - Q_DECLARE_PRIVATE(QtTransition) -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/lib/qtstatemachine/src/qtransition_p.h b/lib/qtstatemachine/src/qtransition_p.h deleted file mode 100644 index 2451101..0000000 --- a/lib/qtstatemachine/src/qtransition_p.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QTRANSITION_P_H -#define QTRANSITION_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qabstracttransition_p.h" - -#include - -QT_BEGIN_NAMESPACE - -class QtStateAction; - -class QtTransition; -class Q_STATEMACHINE_CORE_EXPORT QtTransitionPrivate : public QtAbstractTransitionPrivate -{ - Q_DECLARE_PUBLIC(QtTransition) -public: - QtTransitionPrivate(); - ~QtTransitionPrivate(); - - static QtTransitionPrivate *get(QtTransition *q); - static const QtTransitionPrivate *get(const QtTransition *q); - - QList actions() const; -}; - -QT_END_NAMESPACE - -#endif diff --git a/lib/qtstatemachine/src/qtstatemachine.pri b/lib/qtstatemachine/src/qtstatemachine.pri deleted file mode 100644 index 33ded7f..0000000 --- a/lib/qtstatemachine/src/qtstatemachine.pri +++ /dev/null @@ -1,17 +0,0 @@ -include(../common.pri) -INCLUDEPATH += $$PWD -DEPENDPATH += $$PWD -DEFINES += QT_STATEMACHINE_SOLUTION -DEFINES += QT_NO_ANIMATION - -qtstatemachine-uselib:!qtstatemachine-buildlib { - LIBS += -L$$QTSTATEMACHINE_LIBDIR -l$$QTSTATEMACHINE_LIBNAME -} else { - qtstatemachine-buildlib: QT += script gui - include($$PWD/statemachine.pri) -} - -win32 { - contains(TEMPLATE, lib):contains(CONFIG, shared):DEFINES += Q_STATEMACHINE_CORE_EXPORT=__declspec(dllexport) Q_STATEMACHINE_GUI_EXPORT=__declspec(dllexport) - else:qtstatemachine-uselib:DEFINES += Q_STATEMACHINE_CORE_EXPORT=__declspec(dllimport) Q_STATEMACHINE_GUI_EXPORT=__declspec(dllimport) -} diff --git a/lib/qtstatemachine/src/qtstatemachineglobal.h b/lib/qtstatemachine/src/qtstatemachineglobal.h deleted file mode 100644 index 9fd0228..0000000 --- a/lib/qtstatemachine/src/qtstatemachineglobal.h +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** This file is 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. -** -****************************************************************************/ - -#ifndef QTSTATEMACHINEGLOBAL_H -#define QTSTATEMACHINEGLOBAL_H - -#if !defined(Q_STATEMACHINE_CORE_EXPORT) -#define Q_STATEMACHINE_CORE_EXPORT -#endif - -#if !defined(Q_STATEMACHINE_GUI_EXPORT) -#define Q_STATEMACHINE_GUI_EXPORT -#endif - -#endif diff --git a/lib/qtstatemachine/src/statemachine.pri b/lib/qtstatemachine/src/statemachine.pri deleted file mode 100644 index 5d605c4..0000000 --- a/lib/qtstatemachine/src/statemachine.pri +++ /dev/null @@ -1,56 +0,0 @@ -HEADERS += $$PWD/qstatemachine.h \ - $$PWD/qstatemachine_p.h \ - $$PWD/qstateaction.h \ - $$PWD/qstateaction_p.h \ - $$PWD/qsignaleventgenerator_p.h \ - $$PWD/qabstractstate.h \ - $$PWD/qabstractstate_p.h \ - $$PWD/qactionstate.h \ - $$PWD/qactionstate_p.h \ - $$PWD/qstate.h \ - $$PWD/qstate_p.h \ - $$PWD/qfinalstate.h \ - $$PWD/qhistorystate.h \ - $$PWD/qhistorystate_p.h \ - $$PWD/qabstracttransition.h \ - $$PWD/qabstracttransition_p.h \ - $$PWD/qtransition.h \ - $$PWD/qtransition_p.h \ - $$PWD/qstatefinishedevent.h \ - $$PWD/qstatefinishedtransition.h \ - $$PWD/qsignalevent.h \ - $$PWD/qsignaltransition.h \ - $$PWD/qsignaltransition_p.h - -SOURCES += $$PWD/qstatemachine.cpp \ - $$PWD/qstateaction.cpp \ - $$PWD/qabstractstate.cpp \ - $$PWD/qactionstate.cpp \ - $$PWD/qstate.cpp \ - $$PWD/qfinalstate.cpp \ - $$PWD/qhistorystate.cpp \ - $$PWD/qabstracttransition.cpp \ - $$PWD/qtransition.cpp \ - $$PWD/qstatefinishedtransition.cpp \ - $$PWD/qsignaltransition.cpp - -!contains(DEFINES, QT_NO_STATEMACHINE_EVENTFILTER) { -HEADERS += $$PWD/qboundevent_p.h \ - $$PWD/qeventtransition.h \ - $$PWD/qeventtransition_p.h -SOURCES += $$PWD/qeventtransition.cpp -} - -contains(QT, script) { - HEADERS += $$PWD/qscriptedstatemachine.h - SOURCES += $$PWD/qscriptedstatemachine.cpp - - contains(QT,gui) { - SOURCES += $$PWD/qssmguiinvokers.cpp - HEADERS += $$PWD/qssmguiinvokers_p.h - } -} - -contains(QT, gui) { -SOURCES += $$PWD/qguistatemachine.cpp -}