summaryrefslogtreecommitdiffstats
path: root/tqtinterface/qt4/tools/qvfb
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-07-10 15:17:53 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-07-10 15:17:53 -0500
commitdda8474928bd7276e1fad8fb7a601e7c83ff2bc2 (patch)
tree7f83910598b33b12730035f086df20b5a53ab99c /tqtinterface/qt4/tools/qvfb
parent6260b6178868c03aab1644bf93b0ef043654bdb0 (diff)
downloadexperimental-dda8474928bd7276e1fad8fb7a601e7c83ff2bc2.tar.gz
experimental-dda8474928bd7276e1fad8fb7a601e7c83ff2bc2.zip
Added TQt4 HEAD
Diffstat (limited to 'tqtinterface/qt4/tools/qvfb')
-rw-r--r--tqtinterface/qt4/tools/qvfb/LICENSE.GPL280
-rw-r--r--tqtinterface/qt4/tools/qvfb/README55
-rw-r--r--tqtinterface/qt4/tools/qvfb/config.ui1684
-rw-r--r--tqtinterface/qt4/tools/qvfb/gammaview.h49
-rw-r--r--tqtinterface/qt4/tools/qvfb/images/logo.pngbin0 -> 714 bytes
-rw-r--r--tqtinterface/qt4/tools/qvfb/main.cpp97
-rw-r--r--tqtinterface/qt4/tools/qvfb/pda.skin15
-rw-r--r--tqtinterface/qt4/tools/qvfb/pda_down.pngbin0 -> 94345 bytes
-rw-r--r--tqtinterface/qt4/tools/qvfb/pda_up.pngbin0 -> 92698 bytes
-rw-r--r--tqtinterface/qt4/tools/qvfb/qanimationwriter.cpp414
-rw-r--r--tqtinterface/qt4/tools/qvfb/qanimationwriter.h59
-rw-r--r--tqtinterface/qt4/tools/qvfb/qvfb.cpp389
-rw-r--r--tqtinterface/qt4/tools/qvfb/qvfb.h91
-rw-r--r--tqtinterface/qt4/tools/qvfb/qvfb.pro11
-rw-r--r--tqtinterface/qt4/tools/qvfb/qvfbratedlg.cpp80
-rw-r--r--tqtinterface/qt4/tools/qvfb/qvfbratedlg.h59
-rw-r--r--tqtinterface/qt4/tools/qvfb/qvfbview.cpp615
-rw-r--r--tqtinterface/qt4/tools/qvfb/qvfbview.h126
-rw-r--r--tqtinterface/qt4/tools/qvfb/skin.cpp174
-rw-r--r--tqtinterface/qt4/tools/qvfb/skin.h78
20 files changed, 4276 insertions, 0 deletions
diff --git a/tqtinterface/qt4/tools/qvfb/LICENSE.GPL b/tqtinterface/qt4/tools/qvfb/LICENSE.GPL
new file mode 100644
index 0000000..149f4ac
--- /dev/null
+++ b/tqtinterface/qt4/tools/qvfb/LICENSE.GPL
@@ -0,0 +1,280 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin Steet, 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.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) 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
+this service 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 make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. 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.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which tqcontains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+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 Program or any portion
+of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part tqcontains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+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 Program, 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 Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) 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; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it tqcontains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code 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.
+
+If distribution of executable or 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 counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program 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.
+
+ 5. 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 Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program 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 to
+this License.
+
+ 7. 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 Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program 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 Program.
+
+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.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program 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.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the 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 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 Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, 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
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
+
+ 12. 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 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.
+
+ END OF TERMS AND CONDITIONS
diff --git a/tqtinterface/qt4/tools/qvfb/README b/tqtinterface/qt4/tools/qvfb/README
new file mode 100644
index 0000000..a4fac58
--- /dev/null
+++ b/tqtinterface/qt4/tools/qvfb/README
@@ -0,0 +1,55 @@
+Qt/Embedded Virtual Framebuffer
+===============================
+
+Please note that the qvfb program needs to be compiled with the X11 version
+of Qt.
+
+The virtual frame buffer allows a Qt/Embedded program to be developed on your
+desktop machine, without switching between consoles and X11. The virtual
+framebuffer consists of a shared memory region (the virtual frame buffer)
+and a utility to display the framebuffer in a window. The display is updated
+periodically, so you will see discrete snapshots of the framebuffer rather
+than each individual drawing operation. For this reason drawing problems
+such as flickering may not be aptqparent until the program is run using a real
+framebuffer.
+
+To use the virtual framebuffer:
+
+1. Ensure QT_NO_QWS_VFB is not set in qconfig.h (when you configure Qt,
+ add the -qvfb option).
+2. Start qvfb (qvfb should be compiled as a normal Qt/X11 application,
+ NOT as a Qt/Embedded application!).
+3. Start a Qt/Embedded server (i.e. construct QApplication with
+ QApplication::GuiServer flag, or run a client with the -qws option).
+
+qvfb supports the following command line options:
+
+[-width width] the width of the virtual framebuffer (default: 240).
+[-height height] the height of the virtual framebuffer (default: 320).
+[-depth depth] the depth of the virtual framebuffer (1,4,8 or 32, default: 8).
+[-nocursor] do not display the X11 cursor in the framebuffer window.
+[-qwsdisplay] the Qt/Embedded display ID, e.g. -qwsdisplay :1 (default :0).
+[-skin skinfile] tells qvfb to load a skin file, e.g. -skin pda.skin
+
+Please refer to the file "pda.skin" for an example of what a skin file looks like.
+The format for skin files is:
+ Image filename of skin with buttons in their up positions
+ Image filename of skin with buttons in their down positions
+ X offset of top left corner of the virtual screen on the skin image
+ Y offset of top left corner of the virtual screen on the skin image
+ Width of the virtual screen on the skin image
+ Height of the virtual screen on the skin image
+ Transparancy level of the Virtual Frame Buffer
+ Number of defined button regions
+Then for each button region the format is:
+ Button identifier
+ Qt scan codes to generate for the button
+ Top left X coordinate of the button region
+ Top left Y coordinate of the button region
+ Bottom right X coordinate of the button region
+ Bottom right Y coordinate of the button region
+
+The virtual framebuffer is a development tool only. No security issues have
+been considered in the virtual framebuffer design. It should not be used
+in a production environment and QT_NO_QWS_VFB should always be in force
+in production libraries.
diff --git a/tqtinterface/qt4/tools/qvfb/config.ui b/tqtinterface/qt4/tools/qvfb/config.ui
new file mode 100644
index 0000000..f7a8b6c
--- /dev/null
+++ b/tqtinterface/qt4/tools/qvfb/config.ui
@@ -0,0 +1,1684 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>Config</class>
+<comment>*********************************************************************
+** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA.
+**
+** This file is part of the Qt/Embedded virtual framebuffer.
+**
+** This file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free
+** Software Foundation and appearing in the files LICENSE.GPL2
+** and LICENSE.GPL3 included in the packaging of this file.
+** Alternatively you may (at your option) use any later version
+** of the GNU General Public License if such license has been
+** publicly approved by Trolltech ASA (or its successors, if any)
+** and the KDE Free Qt Foundation.
+**
+** Please review the following information to ensure GNU General
+** Public Licensing requirements will be met:
+** http://trolltech.com/products/qt/licenses/licensing/opensource/.
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
+** or contact the sales department at sales@trolltech.com.
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with
+** the Software.
+**
+** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
+** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
+** herein.
+**
+*********************************************************************</comment>
+<widget class="TQDialog">
+ <property name="name">
+ <cstring>Config</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>481</width>
+ <height>645</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Configure</string>
+ </property>
+ <property name="icon">
+ <pixmap>logo.png</pixmap>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="TQButtonGroup" row="0" column="1">
+ <property name="name">
+ <cstring>ButtonGroup2</cstring>
+ </property>
+ <property name="title">
+ <string>Depth</string>
+ </property>
+ <widget class="TQRadioButton">
+ <property name="name">
+ <cstring>depth_1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>11</x>
+ <y>19</y>
+ <width>229</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>1 bit monochrome</string>
+ </property>
+ </widget>
+ <widget class="TQRadioButton">
+ <property name="name">
+ <cstring>depth_4gray</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>11</x>
+ <y>44</y>
+ <width>229</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>4 bit grayscale</string>
+ </property>
+ </widget>
+ <widget class="TQRadioButton">
+ <property name="name">
+ <cstring>depth_8</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>11</x>
+ <y>69</y>
+ <width>229</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>8 bit</string>
+ </property>
+ </widget>
+ <widget class="TQRadioButton">
+ <property name="name">
+ <cstring>depth_12</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>11</x>
+ <y>94</y>
+ <width>229</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>12 (16) bit</string>
+ </property>
+ </widget>
+ <widget class="TQRadioButton">
+ <property name="name">
+ <cstring>depth_16</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>11</x>
+ <y>119</y>
+ <width>229</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>16 bit</string>
+ </property>
+ </widget>
+ <widget class="TQRadioButton">
+ <property name="name">
+ <cstring>depth_32</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>11</x>
+ <y>144</y>
+ <width>229</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>32 bit</string>
+ </property>
+ </widget>
+ </widget>
+ <widget class="TQLayoutWidget" row="4" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="TQPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="TQCheckBox" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>touchScreen</cstring>
+ </property>
+ <property name="text">
+ <string>Emulate touch screen (no mouse move).</string>
+ </property>
+ </widget>
+ <widget class="TQGroupBox" row="3" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>GroupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Gamma</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="TQLabel" row="6" column="0">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Blue</string>
+ </property>
+ </widget>
+ <widget class="TQSlider" row="6" column="1">
+ <property name="name">
+ <cstring>bslider</cstring>
+ </property>
+ <property name="palette">
+ <palette>
+ <active>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>127</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>63</red>
+ <green>63</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>170</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </active>
+ <disabled>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>127</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>38</red>
+ <green>38</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>170</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </disabled>
+ <inactive>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>127</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>38</red>
+ <green>38</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>170</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </inactive>
+ </palette>
+ </property>
+ <property name="maxValue">
+ <number>400</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="6" column="2">
+ <property name="name">
+ <cstring>blabel</cstring>
+ </property>
+ <property name="text">
+ <string>1.0</string>
+ </property>
+ </widget>
+ <spacer row="5" column="1">
+ <property name="name">
+ <cstring>Spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQLabel" row="4" column="0">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Green</string>
+ </property>
+ </widget>
+ <widget class="TQSlider" row="4" column="1">
+ <property name="name">
+ <cstring>gslider</cstring>
+ </property>
+ <property name="palette">
+ <palette>
+ <active>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>255</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>255</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>63</red>
+ <green>255</green>
+ <blue>63</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>127</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>170</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </active>
+ <disabled>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>255</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>255</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>38</red>
+ <green>255</green>
+ <blue>38</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>127</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>170</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </disabled>
+ <inactive>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>255</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>255</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>38</red>
+ <green>255</green>
+ <blue>38</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>127</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>170</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </inactive>
+ </palette>
+ </property>
+ <property name="maxValue">
+ <number>400</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="4" column="2">
+ <property name="name">
+ <cstring>glabel</cstring>
+ </property>
+ <property name="text">
+ <string>1.0</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel7</cstring>
+ </property>
+ <property name="text">
+ <string>All</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="2">
+ <property name="name">
+ <cstring>TextLabel8</cstring>
+ </property>
+ <property name="text">
+ <string>1.0</string>
+ </property>
+ </widget>
+ <widget class="TQSlider" row="0" column="1">
+ <property name="name">
+ <cstring>gammaslider</cstring>
+ </property>
+ <property name="palette">
+ <palette>
+ <active>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>127</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>170</red>
+ <green>170</green>
+ <blue>170</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </active>
+ <disabled>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>127</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>170</red>
+ <green>170</green>
+ <blue>170</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </disabled>
+ <inactive>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>127</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>170</red>
+ <green>170</green>
+ <blue>170</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </inactive>
+ </palette>
+ </property>
+ <property name="maxValue">
+ <number>400</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Red</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="2" column="2">
+ <property name="name">
+ <cstring>rlabel</cstring>
+ </property>
+ <property name="text">
+ <string>1.0</string>
+ </property>
+ </widget>
+ <widget class="TQSlider" row="2" column="1">
+ <property name="name">
+ <cstring>rslider</cstring>
+ </property>
+ <property name="palette">
+ <palette>
+ <active>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>127</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>63</green>
+ <blue>63</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>170</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </active>
+ <disabled>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>127</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>38</green>
+ <blue>38</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>170</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </disabled>
+ <inactive>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>127</green>
+ <blue>127</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>38</green>
+ <blue>38</blue>
+ </color>
+ <color>
+ <red>127</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>170</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>10</red>
+ <green>95</green>
+ <blue>137</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </inactive>
+ </palette>
+ </property>
+ <property name="maxValue">
+ <number>400</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <spacer row="3" column="1">
+ <property name="name">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="1" column="1">
+ <property name="name">
+ <cstring>Spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQPushButton" row="8" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>PushButton3</cstring>
+ </property>
+ <property name="text">
+ <string>Set all to 1.0</string>
+ </property>
+ </widget>
+ <widget class="GammaView" row="0" column="3" rowspan="9" colspan="1">
+ <property name="name">
+ <cstring>MyCustomWidget1</cstring>
+ </property>
+ </widget>
+ <spacer row="7" column="1">
+ <property name="name">
+ <cstring>Spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="tqsizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <widget class="TQButtonGroup" row="0" column="0">
+ <property name="name">
+ <cstring>ButtonGroup1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Size</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="TQRadioButton">
+ <property name="name">
+ <cstring>size_240_320</cstring>
+ </property>
+ <property name="text">
+ <string>240x320 "PDA"</string>
+ </property>
+ </widget>
+ <widget class="TQRadioButton">
+ <property name="name">
+ <cstring>size_320_240</cstring>
+ </property>
+ <property name="text">
+ <string>320x240 "TV"</string>
+ </property>
+ </widget>
+ <widget class="TQRadioButton">
+ <property name="name">
+ <cstring>size_640_480</cstring>
+ </property>
+ <property name="text">
+ <string>640x480 "VGA"</string>
+ </property>
+ </widget>
+ <widget class="TQLayoutWidget">
+ <property name="name">
+ <cstring>Layout1_2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="TQRadioButton">
+ <property name="name">
+ <cstring>size_custom</cstring>
+ </property>
+ <property name="text">
+ <string>Custom</string>
+ </property>
+ </widget>
+ <widget class="TQSpinBox">
+ <property name="name">
+ <cstring>size_width</cstring>
+ </property>
+ <property name="maxValue">
+ <number>1280</number>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="lineStep">
+ <number>16</number>
+ </property>
+ <property name="value">
+ <number>400</number>
+ </property>
+ </widget>
+ <widget class="TQSpinBox">
+ <property name="name">
+ <cstring>size_height</cstring>
+ </property>
+ <property name="maxValue">
+ <number>1024</number>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="lineStep">
+ <number>16</number>
+ </property>
+ <property name="value">
+ <number>300</number>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="TQLayoutWidget">
+ <property name="name">
+ <cstring>Layout8</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="TQRadioButton">
+ <property name="name">
+ <cstring>size_skin</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Skin</string>
+ </property>
+ </widget>
+ <widget class="TQComboBox">
+ <item>
+ <property name="text">
+ <string>pda.skin</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>ipaq.skin</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>qpe.skin</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>cassiopeia.skin</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>other.skin</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>skin</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="TQLabel" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;p&gt;Note that any applications using the virtual framebuffer will be terminated if you change the Size or Depth &lt;i&gt;above&lt;/i&gt;. You may freely modify the Gamma &lt;i&gt;below&lt;/i&gt;.</string>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>GammaView</class>
+ <header location="local">gammaview.h</header>
+ <sizehint>
+ <width>64</width>
+ <height>64</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>3</hordata>
+ <verdata>3</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>Config</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>Config</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<pixmapinproject/>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/tqtinterface/qt4/tools/qvfb/gammaview.h b/tqtinterface/qt4/tools/qvfb/gammaview.h
new file mode 100644
index 0000000..2acd3da
--- /dev/null
+++ b/tqtinterface/qt4/tools/qvfb/gammaview.h
@@ -0,0 +1,49 @@
+/**********************************************************************
+** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA.
+**
+** This file is part of TQt/Embedded virtual framebuffer.
+**
+** This file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free
+** Software Foundation and appearing in the files LICENSE.GPL2
+** and LICENSE.GPL3 included in the packaging of this file.
+** Alternatively you may (at your option) use any later version
+** of the GNU General Public License if such license has been
+** publicly approved by Trolltech ASA (or its successors, if any)
+** and the KDE Free TQt Foundation.
+**
+** Please review the following information to ensure GNU General
+** Public Licensing requirements will be met:
+** http://trolltech.com/products/qt/licenses/licensing/opensource/.
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
+** or contact the sales department at sales@trolltech.com.
+**
+** Licensees holding valid TQt Commercial licenses may use this file in
+** accordance with the TQt Commercial License Agreement provided with
+** the Software.
+**
+** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
+** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
+** herein.
+**
+**********************************************************************/
+
+#ifndef GAMMAVIEW_H
+#define GAMMAVIEW_H
+
+#include <tqwidget.h>
+
+class GammaView: public TQWidget
+{
+ TQ_OBJECT
+public:
+ GammaView( TQWidget *tqparent = 0,
+ const char *name = 0, WFlags f = 0 ) :
+ TQWidget(tqparent,name,f)
+ { }
+};
+
+#endif
diff --git a/tqtinterface/qt4/tools/qvfb/images/logo.png b/tqtinterface/qt4/tools/qvfb/images/logo.png
new file mode 100644
index 0000000..0cb2b68
--- /dev/null
+++ b/tqtinterface/qt4/tools/qvfb/images/logo.png
Binary files differ
diff --git a/tqtinterface/qt4/tools/qvfb/main.cpp b/tqtinterface/qt4/tools/qvfb/main.cpp
new file mode 100644
index 0000000..8a11a44
--- /dev/null
+++ b/tqtinterface/qt4/tools/qvfb/main.cpp
@@ -0,0 +1,97 @@
+/**********************************************************************
+** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA.
+**
+** This file is part of TQt/Embedded virtual framebuffer.
+**
+** This file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free
+** Software Foundation and appearing in the files LICENSE.GPL2
+** and LICENSE.GPL3 included in the packaging of this file.
+** Alternatively you may (at your option) use any later version
+** of the GNU General Public License if such license has been
+** publicly approved by Trolltech ASA (or its successors, if any)
+** and the KDE Free TQt Foundation.
+**
+** Please review the following information to ensure GNU General
+** Public Licensing requirements will be met:
+** http://trolltech.com/products/qt/licenses/licensing/opensource/.
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
+** or contact the sales department at sales@trolltech.com.
+**
+** Licensees holding valid TQt Commercial licenses may use this file in
+** accordance with the TQt Commercial License Agreement provided with
+** the Software.
+**
+** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
+** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
+** herein.
+**
+**********************************************************************/
+
+#include "tqvfb.h"
+
+#include <tqapplication.h>
+#include <tqpainter.h>
+#include <tqregexp.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+
+void usage( const char *app )
+{
+ printf( "Usage: %s [-width width] [-height height] [-depth depth] "
+ "[-nocursor] [-qwsdisplay :id]\n"
+ "Supported depths: 1, 4, 8, 32\n", app );
+}
+
+int main( int argc, char *argv[] )
+{
+ TQApplication app( argc, argv );
+
+ int width = 240;
+ int height = 320;
+ int depth = 32;
+ bool cursor = TRUE;
+ TQString displaySpec( ":0" );
+ TQString skin;
+
+ for ( int i = 1; i < argc; i++ ){
+ TQString arg = argv[i];
+ if ( arg == "-width" ) {
+ width = atoi( argv[++i] );
+ } else if ( arg == "-height" ) {
+ height = atoi( argv[++i] );
+ } else if ( arg == "-skin" ) {
+ skin = argv[++i];
+ } else if ( arg == "-depth" ) {
+ depth = atoi( argv[++i] );
+ } else if ( arg == "-nocursor" ) {
+ cursor = FALSE;
+ } else if ( arg == "-qwsdisplay" ) {
+ displaySpec = argv[++i];
+ } else {
+ printf( "Unknown parameter %s\n", arg.latin1() );
+ usage( argv[0] );
+ exit(1);
+ }
+ }
+
+ int displayId = 0;
+ TQRegExp rx( ":[0-9]" );
+ int m = rx.search( displaySpec, 0 );
+ if ( m >= 0 ) {
+ displayId = displaySpec.mid( m+1, rx.matchedLength()-1 ).toInt();
+ }
+
+ qDebug( "Using display %d", displayId );
+
+ TQVFb mw( displayId, width, height, depth, skin );
+ app.setMainWidget( &mw );
+ mw.enableCursor(cursor);
+ mw.show();
+
+ return app.exec();
+}
diff --git a/tqtinterface/qt4/tools/qvfb/pda.skin b/tqtinterface/qt4/tools/qvfb/pda.skin
new file mode 100644
index 0000000..135e6b6
--- /dev/null
+++ b/tqtinterface/qt4/tools/qvfb/pda.skin
@@ -0,0 +1,15 @@
+pda_up.png pda_down.png
+57 81
+240 320
+0.5
+11
+"Power" 0x100a 277 36 302 57
+"F1" 0x1030 52 439 81 470
+"F2" 0x1031 101 422 130 451
+"F3" 0x1032 232 423 260 452
+"F4" 0x1033 279 445 309 473
+"Left" 0x1012 155 438 176 472
+"Down" 0x1015 169 471 203 486
+"Right" 0x1014 193 448 215 472
+"Up" 0x1013 166 427 199 451
+"Enter" 0x1005 177 448 193 468
diff --git a/tqtinterface/qt4/tools/qvfb/pda_down.png b/tqtinterface/qt4/tools/qvfb/pda_down.png
new file mode 100644
index 0000000..bc1f5ee
--- /dev/null
+++ b/tqtinterface/qt4/tools/qvfb/pda_down.png
Binary files differ
diff --git a/tqtinterface/qt4/tools/qvfb/pda_up.png b/tqtinterface/qt4/tools/qvfb/pda_up.png
new file mode 100644
index 0000000..05e97df
--- /dev/null
+++ b/tqtinterface/qt4/tools/qvfb/pda_up.png
Binary files differ
diff --git a/tqtinterface/qt4/tools/qvfb/qanimationwriter.cpp b/tqtinterface/qt4/tools/qvfb/qanimationwriter.cpp
new file mode 100644
index 0000000..b3917f4
--- /dev/null
+++ b/tqtinterface/qt4/tools/qvfb/qanimationwriter.cpp
@@ -0,0 +1,414 @@
+/**********************************************************************
+** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA.
+**
+** This file is part of TQt/Embedded virtual framebuffer.
+**
+** This file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free
+** Software Foundation and appearing in the files LICENSE.GPL2
+** and LICENSE.GPL3 included in the packaging of this file.
+** Alternatively you may (at your option) use any later version
+** of the GNU General Public License if such license has been
+** publicly approved by Trolltech ASA (or its successors, if any)
+** and the KDE Free TQt Foundation.
+**
+** Please review the following information to ensure GNU General
+** Public Licensing requirements will be met:
+** http://trolltech.com/products/qt/licenses/licensing/opensource/.
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
+** or contact the sales department at sales@trolltech.com.
+**
+** Licensees holding valid TQt Commercial licenses may use this file in
+** accordance with the TQt Commercial License Agreement provided with
+** the Software.
+**
+** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
+** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
+** herein.
+**
+**********************************************************************/
+
+#include "tqanimationwriter.h"
+
+#define TQT_CLEAN_NAMESPACE
+#include <tqfile.h>
+
+#include <png.h>
+#include <netinet/in.h> // for htonl
+
+class TQAnimationWriterData {
+public:
+ TQAnimationWriterData(TQIODevice* d) : dev(d)
+ {
+ framerate = 1000;
+ }
+ void setFrameRate(int d) { framerate = d; }
+ virtual ~TQAnimationWriterData() { }
+ virtual void setImage(const TQImage& src)=0;
+ virtual bool canCompose() const { return FALSE; }
+ virtual void composeImage(const TQImage&, const TQPoint& ) { }
+
+protected:
+ int framerate;
+ TQIODevice* dev;
+};
+
+
+class TQAnimationWriterMNG : public TQAnimationWriterData {
+ bool first;
+ png_structp png_ptr;
+ png_infop info_ptr;
+public:
+ TQAnimationWriterMNG(TQIODevice* d) : TQAnimationWriterData(d)
+ {
+ first = TRUE;
+ begin_png();
+ }
+
+ ~TQAnimationWriterMNG()
+ {
+ if ( first ) {
+ // Eh? Not images.
+ TQImage dummy(1,1,32);
+ setImage(dummy);
+ }
+ writeMEND();
+ end_png();
+ }
+
+ void begin_png()
+ {
+ png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,0,0,0);
+ info_ptr = png_create_info_struct(png_ptr);
+ png_set_compression_level(png_ptr,9);
+ png_set_write_fn(png_ptr, (void*)this, write, 0);
+ }
+
+ void end_png()
+ {
+ png_destroy_write_struct(&png_ptr, &info_ptr);
+ }
+
+
+ static void write( png_structp png_ptr, png_bytep data, png_size_t length)
+ {
+ TQAnimationWriterMNG* that = (TQAnimationWriterMNG*)png_get_io_ptr(png_ptr);
+ /*uint nw =*/ that->dev->writeBlock((const char*)data,length);
+ }
+
+ void writePNG(const TQImage& image)
+ {
+ info_ptr->channels = 4;
+ png_set_sig_bytes(png_ptr, 8); // Pretend we already wrote the sig
+ png_set_IHDR(png_ptr, info_ptr, image.width(), image.height(),
+ 8, image.hasAlphaBuffer()
+ ? PNG_COLOR_TYPE_RGB_ALPHA : PNG_COLOR_TYPE_RGB,
+ 0, 0, 0);
+ png_write_info(png_ptr, info_ptr);
+ if ( !image.hasAlphaBuffer() )
+ png_set_filler(png_ptr, 0,
+ TQImage::systemByteOrder() == TQImage::BigEndian ?
+ PNG_FILLER_BEFORE : PNG_FILLER_AFTER);
+ //if ( TQImage::systemByteOrder() == TQImage::BigEndian ) {
+ //png_set_swap_alpha(png_ptr);
+ //}
+ if ( TQImage::systemByteOrder() == TQImage::LittleEndian ) {
+ png_set_bgr(png_ptr);
+ }
+
+ png_bytep* row_pointers;
+ uint height = image.height();
+ uchar** jt = image.jumpTable();
+ row_pointers=new png_bytep[height];
+ uint y;
+ for (y=0; y<height; y++) {
+ row_pointers[y]=jt[y];
+ }
+ png_write_image(png_ptr, row_pointers);
+ delete [] row_pointers;
+ png_write_end(png_ptr, info_ptr);
+ end_png();
+ begin_png();
+ }
+
+ void writeMHDR( const TQSize& size, int framerate )
+ {
+ dev->writeBlock("\212MNG\r\n\032\n", 8);
+
+ struct {
+ int width;
+ int height;
+ int framerate;
+ int a,b,c;
+ int profile;
+ } chunk;
+ chunk.width = htonl(size.width());
+ chunk.height = htonl(size.height());
+ chunk.framerate = htonl(framerate);
+ chunk.a=0;
+ chunk.b=0;
+ chunk.c=0;
+ chunk.profile= htonl(0x00000003);
+
+ png_write_chunk(png_ptr, (png_byte*)"MHDR", (png_byte*)&chunk, sizeof(chunk));
+ }
+
+ void writeMEND()
+ {
+ png_write_chunk(png_ptr, (png_byte*)"MEND", 0, 0);
+ }
+
+ void writeDEFI( const TQPoint& offset, const TQSize& size )
+ {
+ struct {
+ ushort o;
+ uchar s;
+ uchar concrete;
+ int x,y;
+ int lc,rc,tc,bc;
+ } chunk;
+ chunk.o=0;
+ chunk.s=0;
+ chunk.concrete=1;
+ chunk.x=htonl(offset.x());
+ chunk.y=htonl(offset.y());
+ chunk.lc=0;
+ chunk.rc=0;
+ chunk.tc=htonl(INT_MAX);
+ chunk.bc=htonl(INT_MAX);
+
+ png_write_chunk(png_ptr, (png_byte*)"DEFI", (png_byte*)&chunk, sizeof(chunk));
+ }
+
+ void writeFRAM( const TQSize& size )
+ {
+ struct {
+ uchar mode;
+ uchar n;
+ uchar nu;
+ uchar d;
+ uchar t;
+ uchar clip;
+ uchar s;
+ uchar deltatype;
+ uint left;
+ uint right;
+ uint top;
+ uint bottom;
+ } chunk;
+ chunk.mode=1;
+ chunk.n='a';
+ chunk.nu=0;
+ chunk.d=0;
+ chunk.clip=1;
+ chunk.t=0;
+ chunk.s=0;
+ chunk.deltatype=0;
+ chunk.left=0;
+ chunk.right=htonl(size.width());
+ chunk.top=0;
+ chunk.bottom=htonl(size.height());
+
+ png_write_chunk(png_ptr, (png_byte*)"FRAM", (png_byte*)&chunk, sizeof(chunk));
+ }
+
+ void writeMOVE( const TQPoint& offset )
+ {
+ struct {
+ uchar filler[3];
+ uchar z[5];
+ int x,y;
+ } chunk;
+ memset(chunk.z,0,5);
+ chunk.x=htonl(offset.x());
+ chunk.y=htonl(offset.y());
+
+ png_write_chunk(png_ptr, (png_byte*)"MOVE", ((png_byte*)&chunk)+3, sizeof(chunk)-3);
+ }
+
+ void setImage(const TQImage& src)
+ {
+ if ( first ) {
+ first = FALSE;
+ writeMHDR(src.size(),framerate);
+ }
+ composeImage(src,TQPoint(0,0));
+ }
+
+ bool canCompose() const { return TRUE; }
+
+ void composeImage(const TQImage& src, const TQPoint& offset)
+ {
+ writeMOVE(offset);
+ //writeFRAM(src.size());
+ writePNG(src);
+ }
+};
+
+TQAnimationWriter::TQAnimationWriter( const TQString& filename, const char* format )
+{
+ if ( TQCString(format) != "MNG" ) {
+ qWarning("Format \"%s\" not supported, only MNG", format);
+ dev = 0;
+ d = 0;
+ } else {
+ TQFile *f = new TQFile(filename);
+ f->open(IO_WriteOnly);
+ dev = f;
+ d = new TQAnimationWriterMNG(dev);
+ }
+}
+
+bool TQAnimationWriter::okay() const
+{
+ return dev && dev->status() == IO_Ok;
+}
+
+TQAnimationWriter::~TQAnimationWriter()
+{
+ delete d;
+ delete dev;
+}
+
+void TQAnimationWriter::setFrameRate(int r)
+{
+ if (d) d->setFrameRate(r);
+}
+
+void TQAnimationWriter::appendFrame(const TQImage& frm, const TQPoint& offset)
+{
+ TQImage frame = frm.convertDepth(32);
+ const int alignx = 1;
+ if ( dev ) {
+ if ( prev.isNull() || !d->canCompose() ) {
+ d->setImage(frame);
+ } else {
+ bool done;
+ int minx, maxx, miny, maxy;
+ int w = frame.width();
+ int h = frame.height();
+
+ TQRgb** jt = (TQRgb**)frame.jumpTable();
+ TQRgb** pjt = (TQRgb**)prev.jumpTable() + offset.y();
+
+ // Find left edge of change
+ done = FALSE;
+ for (minx = 0; minx < w && !done; minx++) {
+ for (int ty = 0; ty < h; ty++) {
+ if ( jt[ty][minx] != pjt[ty][minx+offset.x()] ) {
+ done = TRUE;
+ break;
+ }
+ }
+ }
+ minx--;
+
+ // Find right edge of change
+ done = FALSE;
+ for (maxx = w-1; maxx >= 0 && !done; maxx--) {
+ for (int ty = 0; ty < h; ty++) {
+ if ( jt[ty][maxx] != pjt[ty][maxx+offset.x()] ) {
+ done = TRUE;
+ break;
+ }
+ }
+ }
+ maxx++;
+
+ // Find top edge of change
+ done = FALSE;
+ for (miny = 0; miny < h && !done; miny++) {
+ for (int tx = 0; tx < w; tx++) {
+ if ( jt[miny][tx] != pjt[miny][tx+offset.x()] ) {
+ done = TRUE;
+ break;
+ }
+ }
+ }
+ miny--;
+
+ // Find right edge of change
+ done = FALSE;
+ for (maxy = h-1; maxy >= 0 && !done; maxy--) {
+ for (int tx = 0; tx < w; tx++) {
+ if ( jt[maxy][tx] != pjt[maxy][tx+offset.x()] ) {
+ done = TRUE;
+ break;
+ }
+ }
+ }
+ maxy++;
+
+ if ( minx > maxx ) minx=maxx=0;
+ if ( miny > maxy ) miny=maxy=0;
+
+ if ( alignx > 1 ) {
+ minx -= minx % alignx;
+ maxx = maxx - maxx % alignx + alignx - 1;
+ }
+
+ int dw = maxx-minx+1;
+ int dh = maxy-miny+1;
+
+ TQImage diff(dw, dh, 32);
+
+ diff.setAlphaBuffer(TRUE);
+ int x, y;
+ for (y = 0; y < dh; y++) {
+ TQRgb* li = (TQRgb*)frame.scanLine(y+miny)+minx;
+ TQRgb* lp = (TQRgb*)prev.scanLine(y+miny+offset.y())+minx+offset.x();
+ TQRgb* ld = (TQRgb*)diff.scanLine(y);
+ if ( alignx ) {
+ for (x = 0; x < dw; x+=alignx) {
+ int i;
+ for (i=0; i<alignx; i++) {
+ if ( li[x+i] != lp[x+i] )
+ break;
+ }
+ if ( i == alignx ) {
+ // All the same
+ for (i=0; i<alignx; i++) {
+ ld[x+i] = tqRgba(0,0,0,0);
+ }
+ } else {
+ // Some different
+ for (i=0; i<alignx; i++) {
+ ld[x+i] = 0xff000000 | li[x+i];
+ }
+ }
+ }
+ } else {
+ for (x = 0; x < dw; x++) {
+ if ( li[x] != lp[x] )
+ ld[x] = 0xff000000 | li[x];
+ else
+ ld[x] = tqRgba(0,0,0,0);
+ }
+ }
+ }
+qDebug("%d,%d %d,%d",minx,miny,offset.x(),offset.y());
+ d->composeImage(diff,TQPoint(minx,miny)+offset);
+ }
+ if ( prev.isNull() || prev.size() == frame.size() && offset == TQPoint(0,0) ) {
+ prev = frame;
+ } else {
+ bitBlt(&prev,offset.x(),offset.y(),&frame,0,0,frame.width(),frame.height());
+ }
+ }
+}
+
+void TQAnimationWriter::appendFrame(const TQImage& frm)
+{
+ appendFrame(frm,TQPoint(0,0));
+}
+
+void TQAnimationWriter::appendBlankFrame()
+{
+ TQImage i(1,1,32);
+ i.setAlphaBuffer(TRUE);
+ i.fill(0);
+ d->composeImage(i,TQPoint(0,0));
+}
diff --git a/tqtinterface/qt4/tools/qvfb/qanimationwriter.h b/tqtinterface/qt4/tools/qvfb/qanimationwriter.h
new file mode 100644
index 0000000..7ba107d
--- /dev/null
+++ b/tqtinterface/qt4/tools/qvfb/qanimationwriter.h
@@ -0,0 +1,59 @@
+/**********************************************************************
+** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA.
+**
+** This file is part of TQt/Embedded virtual framebuffer.
+**
+** This file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free
+** Software Foundation and appearing in the files LICENSE.GPL2
+** and LICENSE.GPL3 included in the packaging of this file.
+** Alternatively you may (at your option) use any later version
+** of the GNU General Public License if such license has been
+** publicly approved by Trolltech ASA (or its successors, if any)
+** and the KDE Free TQt Foundation.
+**
+** Please review the following information to ensure GNU General
+** Public Licensing requirements will be met:
+** http://trolltech.com/products/qt/licenses/licensing/opensource/.
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
+** or contact the sales department at sales@trolltech.com.
+**
+** Licensees holding valid TQt Commercial licenses may use this file in
+** accordance with the TQt Commercial License Agreement provided with
+** the Software.
+**
+** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
+** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
+** herein.
+**
+**********************************************************************/
+
+#ifndef TQANIMATIONWRITER_H
+#define TQANIMATIONWRITER_H
+
+#include <tqimage.h>
+
+class TQAnimationWriterData;
+
+class TQAnimationWriter
+{
+public:
+ TQAnimationWriter( const TQString& filename, const char* format="MNG" );
+ ~TQAnimationWriter();
+
+ bool okay() const;
+ void setFrameRate(int);
+ void appendBlankFrame();
+ void appendFrame(const TQImage&);
+ void appendFrame(const TQImage&, const TQPoint& offset);
+
+private:
+ TQImage prev;
+ TQIODevice* dev;
+ TQAnimationWriterData* d;
+};
+
+#endif
diff --git a/tqtinterface/qt4/tools/qvfb/qvfb.cpp b/tqtinterface/qt4/tools/qvfb/qvfb.cpp
new file mode 100644
index 0000000..8fb4cb1
--- /dev/null
+++ b/tqtinterface/qt4/tools/qvfb/qvfb.cpp
@@ -0,0 +1,389 @@
+/**********************************************************************
+** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA.
+**
+** This file is part of TQt/Embedded virtual framebuffer.
+**
+** This file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free
+** Software Foundation and appearing in the files LICENSE.GPL2
+** and LICENSE.GPL3 included in the packaging of this file.
+** Alternatively you may (at your option) use any later version
+** of the GNU General Public License if such license has been
+** publicly approved by Trolltech ASA (or its successors, if any)
+** and the KDE Free TQt Foundation.
+**
+** Please review the following information to ensure GNU General
+** Public Licensing requirements will be met:
+** http://trolltech.com/products/qt/licenses/licensing/opensource/.
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
+** or contact the sales department at sales@trolltech.com.
+**
+** Licensees holding valid TQt Commercial licenses may use this file in
+** accordance with the TQt Commercial License Agreement provided with
+** the Software.
+**
+** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
+** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
+** herein.
+**
+**********************************************************************/
+
+#include "tqvfb.h"
+#include "tqvfbview.h"
+#include "tqvfbratedlg.h"
+#include "config.h"
+#include "skin.h"
+
+#include <tqmenubar.h>
+#include <tqpopupmenu.h>
+#include <tqapplication.h>
+#include <tqmessagebox.h>
+#include <tqcombobox.h>
+#include <tqlabel.h>
+#include <tqfiledialog.h>
+#include <tqslider.h>
+#include <tqspinbox.h>
+#include <tqradiobutton.h>
+#include <tqimage.h>
+#include <tqpixmap.h>
+#include <tqcursor.h>
+#include <tqdragobject.h>
+#include <tqcheckbox.h>
+
+TQVFb::TQVFb( int display_id, int w, int h, int d, const TQString &skin, TQWidget *tqparent,
+ const char *name, uint flags )
+ : TQMainWindow( tqparent, name, flags )
+{
+ const TQMimeSource *m = TQMimeSourceFactory::defaultFactory()->data( "logo.png" );
+ if ( m ) {
+ TQPixmap pix;
+ TQImageDrag::decode( m, pix );
+ setIcon( pix );
+ }
+
+ imagesave = new TQFileDialog( this, 0, TRUE );
+
+ rateDlg = 0;
+ view = 0;
+ init( display_id, w, h, d, skin );
+ createMenu( menuBar() );
+ adjustSize();
+}
+
+TQVFb::~TQVFb()
+{
+}
+
+void TQVFb::popupMenu()
+{
+ TQPopupMenu *pm = new TQPopupMenu( this );
+ createMenu( pm );
+ pm->exec(TQCursor::pos());
+}
+
+void TQVFb::init( int display_id, int w, int h, int d, const TQString &skin_name )
+{
+ setCaption( TQString("Virtual framebuffer %1x%2 %3bpp Display :%4")
+ .arg(w).arg(h).arg(d).arg(display_id) );
+ delete view;
+
+ if ( !skin_name.isEmpty() && TQFile::exists(skin_name) ) {
+ bool vis = isVisible();
+ if ( vis ) hide();
+ menuBar()->hide();
+ Skin *skin = new Skin( this, skin_name, w, h );
+ view = new TQVFbView( display_id, w, h, d, skin );
+ skin->setView( view );
+ view->setMargin( 0 );
+ view->setFrameStyle( TQFrame::NoFrame );
+ view->setFixedSize( w, h );
+ setCentralWidget( skin );
+ adjustSize();
+ view->show();
+ if ( vis ) show();
+ } else {
+ if ( !currentSkin.isEmpty() ) {
+ clearMask();
+ reparent( 0, 0, pos(), TRUE );
+ }
+ menuBar()->show();
+ view = new TQVFbView( display_id, w, h, d, this );
+ view->setMargin( 0 );
+ view->setFrameStyle( TQFrame::NoFrame );
+ setCentralWidget( view );
+ resize( tqsizeHint() );
+ view->show();
+ }
+
+ currentSkin = skin_name;
+}
+
+void TQVFb::enableCursor( bool e )
+{
+ view->viewport()->setCursor( e ? ArrowCursor : BlankCursor );
+ viewMenu->setItemChecked( cursorId, e );
+}
+
+void TQVFb::createMenu(TQMenuData *menu)
+{
+ TQPopupMenu *file = new TQPopupMenu( this );
+ file->insertItem( "&Configure...", this, TQT_SLOT(configure()), ALT+CTRL+Key_C );
+ file->insertSeparator();
+ file->insertItem( "&Save image...", this, TQT_SLOT(saveImage()), ALT+CTRL+Key_S );
+ file->insertItem( "&Animation...", this, TQT_SLOT(toggleAnimation()), ALT+CTRL+Key_A );
+ file->insertSeparator();
+ file->insertItem( "&Quit", tqApp, TQT_SLOT(quit()) );
+
+ menu->insertItem( "&File", file );
+
+ viewMenu = new TQPopupMenu( this );
+ viewMenu->setCheckable( TRUE );
+ cursorId = viewMenu->insertItem( "Show &Cursor", this, TQT_SLOT(toggleCursor()) );
+ enableCursor(TRUE);
+ viewMenu->insertItem( "&Refresh Rate...", this, TQT_SLOT(changeRate()) );
+ viewMenu->insertSeparator();
+ viewMenu->insertItem( "Zoom scale &1", this, TQT_SLOT(setZoom1()) );
+ viewMenu->insertItem( "Zoom scale &2", this, TQT_SLOT(setZoom2()) );
+ viewMenu->insertItem( "Zoom scale &3", this, TQT_SLOT(setZoom3()) );
+ viewMenu->insertItem( "Zoom scale &4", this, TQT_SLOT(setZoom4()) );
+ viewMenu->insertItem( "Zoom scale &0.5", this, TQT_SLOT(setZoomHalf()) );
+
+ menu->insertItem( "&View", viewMenu );
+
+ TQPopupMenu *help = new TQPopupMenu( this );
+ help->insertItem("&About", this, TQT_SLOT(about()));
+ help->insertItem("About &TQt", this, TQT_SLOT(aboutTQt()));
+ menu->insertSeparator();
+ menu->insertItem( "&Help", help );
+}
+
+void TQVFb::setZoom(double z)
+{
+ view->setZoom(z);
+}
+
+void TQVFb::setZoomHalf()
+{
+ setZoom(0.5);
+}
+
+void TQVFb::setZoom1()
+{
+ setZoom(1);
+}
+
+void TQVFb::setZoom2()
+{
+ setZoom(2);
+}
+
+void TQVFb::setZoom3()
+{
+ setZoom(3);
+}
+
+void TQVFb::setZoom4()
+{
+ setZoom(4);
+}
+
+void TQVFb::saveImage()
+{
+ TQImage img = view->image();
+ TQString filename = imagesave->getSaveFileName("snapshot.png", "*.png", this, "", "Save Image");
+ if ( !!filename )
+ img.save(filename,"PNG");
+}
+
+void TQVFb::toggleAnimation()
+{
+ if ( view->animating() ) {
+ view->stopAnimation();
+ } else {
+ TQString filename = imagesave->getSaveFileName("animation.mng", "*.mng", this, "", "Save animation");
+ if ( !filename ) {
+ view->stopAnimation();
+ } else {
+ view->startAnimation(filename);
+ }
+ }
+}
+
+void TQVFb::toggleCursor()
+{
+ enableCursor( !viewMenu->isItemChecked( cursorId ) );
+}
+
+void TQVFb::changeRate()
+{
+ if ( !rateDlg ) {
+ rateDlg = new TQVFbRateDialog( view->rate(), this );
+ connect( rateDlg, TQT_SIGNAL(updateRate(int)), view, TQT_SLOT(setRate(int)) );
+ }
+
+ rateDlg->show();
+}
+
+void TQVFb::about()
+{
+#if defined( TQ_WS_MAC )
+ TQString platform("Mac OS X");
+ TQString qt("Mac");
+#elif defined( TQ_WS_WIN )
+ TQString platform("Windows");
+ TQString qt("Windows");
+#else
+ TQString platform("X11");
+ TQString qt("X11");
+#endif
+ TQMessageBox::about(this, "About TQVFB",
+ "<p><b><font size=+2>TQt/Embedded Virtual " + platform + " Framebuffer</font></b></p>"
+ "<p></p>"
+ "<p>Version 1.0</p>"
+ "<p>Copyright (C) 2001-2008 Trolltech ASA. All rights reserved.</p>"
+ "<p></p>"
+ "<p>This program is licensed to you under the terms of the GNU General "
+ "Public License Version 2 as published by the Free Software Foundation. This "
+ "gives you legal permission to copy, distribute and/or modify this software "
+ "under certain conditions. For details, see the file 'LICENSE.GPL' that came with "
+ "this software distribution. If you did not get the file, send email to "
+ "info@trolltech.com.</p>\n\n<p>The program is provided AS IS with NO WARRANTY "
+ "OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS "
+ "FOR A PARTICULAR PURPOSE.</p>"
+ );
+}
+
+void TQVFb::aboutTQt()
+{
+ TQMessageBox::aboutTQt( this, tr("TQVFB") );
+}
+
+void TQVFb::configure()
+{
+ config = new Config(this,0,TRUE);
+
+ int w = view->displayWidth();
+ int h = view->displayHeight();
+ TQString skin;
+ config->size_width->setValue(w);
+ config->size_height->setValue(h);
+ config->size_custom->setChecked(TRUE); // unless changed by settings below
+ config->size_240_320->setChecked(w==240&&h==320);
+ config->size_320_240->setChecked(w==320&&h==240);
+ config->size_640_480->setChecked(w==640&&h==480);
+ config->skin->setEditable(TRUE);
+ if (!currentSkin.isNull()) {
+ config->size_skin->setChecked(TRUE);
+ config->skin->setEditText(currentSkin);
+ }
+ config->touchScreen->setChecked(view->touchScreenEmulation());
+ config->depth_1->setChecked(view->displayDepth()==1);
+ config->depth_4gray->setChecked(view->displayDepth()==4);
+ config->depth_8->setChecked(view->displayDepth()==8);
+ config->depth_12->setChecked(view->displayDepth()==12);
+ config->depth_16->setChecked(view->displayDepth()==16);
+ config->depth_32->setChecked(view->displayDepth()==32);
+ if ( view->gammaRed() == view->gammaGreen() && view->gammaGreen() == view->gammaBlue() ) {
+ config->gammaslider->setValue(int(view->gammaRed()*400));
+ config->rslider->setValue(100);
+ config->gslider->setValue(100);
+ config->bslider->setValue(100);
+ } else {
+ config->gammaslider->setValue(100);
+ config->rslider->setValue(int(view->gammaRed()*400));
+ config->gslider->setValue(int(view->gammaGreen()*400));
+ config->bslider->setValue(int(view->gammaBlue()*400));
+ }
+ connect(config->gammaslider, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(setGamma400(int)));
+ connect(config->rslider, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(setR400(int)));
+ connect(config->gslider, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(setG400(int)));
+ connect(config->bslider, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(setB400(int)));
+ updateGammaLabels();
+
+ double ogr=view->gammaRed(), ogg=view->gammaGreen(), ogb=view->gammaBlue();
+
+ if ( config->exec() ) {
+ int id = view->displayId(); // not settable yet
+ if ( config->size_240_320->isChecked() ) {
+ w=240; h=320;
+ } else if ( config->size_320_240->isChecked() ) {
+ w=320; h=240;
+ } else if ( config->size_640_480->isChecked() ) {
+ w=640; h=480;
+ } else if ( config->size_skin->isChecked() ) {
+ skin = config->skin->currentText();
+ } else {
+ w=config->size_width->value();
+ h=config->size_height->value();
+ }
+ int d;
+ if ( config->depth_1->isChecked() )
+ d=1;
+ else if ( config->depth_4gray->isChecked() )
+ d=4;
+ else if ( config->depth_8->isChecked() )
+ d=8;
+ else if ( config->depth_12->isChecked() )
+ d=12;
+ else if ( config->depth_16->isChecked() )
+ d=16;
+ else
+ d=32;
+
+ if ( w != view->displayWidth() || h != view->displayHeight()
+ || d != view->displayDepth() || skin != currentSkin )
+ init( id, w, h, d, skin );
+ view->setTouchscreenEmulation( config->touchScreen->isChecked() );
+ } else {
+ view->setGamma(ogr, ogg, ogb);
+ }
+
+ delete config;
+ config=0;
+}
+
+void TQVFb::setGamma400(int n)
+{
+ double g = n/100.0;
+ view->setGamma(config->rslider->value()/100.0*g,
+ config->gslider->value()/100.0*g,
+ config->bslider->value()/100.0*g);
+ updateGammaLabels();
+}
+
+void TQVFb::setR400(int n)
+{
+ double g = n/100.0;
+ view->setGamma(config->rslider->value()/100.0*g,
+ view->gammaGreen(),
+ view->gammaBlue());
+ updateGammaLabels();
+}
+
+void TQVFb::setG400(int n)
+{
+ double g = n/100.0;
+ view->setGamma(view->gammaRed(),
+ config->gslider->value()/100.0*g,
+ view->gammaBlue());
+ updateGammaLabels();
+}
+
+void TQVFb::setB400(int n)
+{
+ double g = n/100.0;
+ view->setGamma(view->gammaRed(),
+ view->gammaGreen(),
+ config->bslider->value()/100.0*g);
+ updateGammaLabels();
+}
+
+void TQVFb::updateGammaLabels()
+{
+ config->rlabel->setText(TQString::number(view->gammaRed(),'g',2));
+ config->glabel->setText(TQString::number(view->gammaGreen(),'g',2));
+ config->blabel->setText(TQString::number(view->gammaBlue(),'g',2));
+}
diff --git a/tqtinterface/qt4/tools/qvfb/qvfb.h b/tqtinterface/qt4/tools/qvfb/qvfb.h
new file mode 100644
index 0000000..5906232
--- /dev/null
+++ b/tqtinterface/qt4/tools/qvfb/qvfb.h
@@ -0,0 +1,91 @@
+/**********************************************************************
+** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA.
+**
+** This file is part of TQt/Embedded virtual framebuffer.
+**
+** This file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free
+** Software Foundation and appearing in the files LICENSE.GPL2
+** and LICENSE.GPL3 included in the packaging of this file.
+** Alternatively you may (at your option) use any later version
+** of the GNU General Public License if such license has been
+** publicly approved by Trolltech ASA (or its successors, if any)
+** and the KDE Free TQt Foundation.
+**
+** Please review the following information to ensure GNU General
+** Public Licensing requirements will be met:
+** http://trolltech.com/products/qt/licenses/licensing/opensource/.
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
+** or contact the sales department at sales@trolltech.com.
+**
+** Licensees holding valid TQt Commercial licenses may use this file in
+** accordance with the TQt Commercial License Agreement provided with
+** the Software.
+**
+** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
+** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
+** herein.
+**
+**********************************************************************/
+
+#include <tqmainwindow.h>
+
+class TQVFbView;
+class TQVFbRateDialog;
+class TQPopupMenu;
+class TQMenuData;
+class TQFileDialog;
+class Config;
+
+class TQVFb: public TQMainWindow
+{
+ TQ_OBJECT
+public:
+ TQVFb( int display_id, int w, int h, int d, const TQString &skin, TQWidget *tqparent = 0,
+ const char *name = 0, uint wflags = 0 );
+ ~TQVFb();
+
+ void enableCursor( bool e );
+ void popupMenu();
+
+protected Q_SLOTS:
+ void saveImage();
+ void toggleAnimation();
+ void toggleCursor();
+ void changeRate();
+ void about();
+ void aboutTQt();
+
+ void configure();
+
+ void setZoom(double);
+ void setZoom1();
+ void setZoom2();
+ void setZoom3();
+ void setZoom4();
+ void setZoomHalf();
+
+protected:
+ void createMenu(TQMenuData *menu);
+
+private:
+ void init( int display_id, int w, int h, int d, const TQString &skin );
+ TQVFbView *view;
+ TQVFbRateDialog *rateDlg;
+ TQFileDialog* imagesave;
+ TQPopupMenu *viewMenu;
+ int cursorId;
+ Config* config;
+ TQString currentSkin;
+
+private Q_SLOTS:
+ void setGamma400(int n);
+ void setR400(int n);
+ void setG400(int n);
+ void setB400(int n);
+ void updateGammaLabels();
+};
+
diff --git a/tqtinterface/qt4/tools/qvfb/qvfb.pro b/tqtinterface/qt4/tools/qvfb/qvfb.pro
new file mode 100644
index 0000000..7896e7c
--- /dev/null
+++ b/tqtinterface/qt4/tools/qvfb/qvfb.pro
@@ -0,0 +1,11 @@
+TEMPLATE = app
+CONFIG += qt warn_on release
+HEADERS = qvfb.h qvfbview.h qvfbratedlg.h qanimationwriter.h \
+ gammaview.h skin.h
+SOURCES = qvfb.cpp qvfbview.cpp qvfbratedlg.cpp \
+ main.cpp qanimationwriter.cpp skin.cpp
+INTERFACES = config.ui
+IMAGES = images/logo.png
+TARGET = qvfb
+INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/libpng $$QT_SOURCE_TREE/src/3rdparty/zlib
+DEPENDPATH = ../../include
diff --git a/tqtinterface/qt4/tools/qvfb/qvfbratedlg.cpp b/tqtinterface/qt4/tools/qvfb/qvfbratedlg.cpp
new file mode 100644
index 0000000..9a61c37
--- /dev/null
+++ b/tqtinterface/qt4/tools/qvfb/qvfbratedlg.cpp
@@ -0,0 +1,80 @@
+/**********************************************************************
+** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA.
+**
+** This file is part of TQt/Embedded virtual framebuffer.
+**
+** This file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free
+** Software Foundation and appearing in the files LICENSE.GPL2
+** and LICENSE.GPL3 included in the packaging of this file.
+** Alternatively you may (at your option) use any later version
+** of the GNU General Public License if such license has been
+** publicly approved by Trolltech ASA (or its successors, if any)
+** and the KDE Free TQt Foundation.
+**
+** Please review the following information to ensure GNU General
+** Public Licensing requirements will be met:
+** http://trolltech.com/products/qt/licenses/licensing/opensource/.
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
+** or contact the sales department at sales@trolltech.com.
+**
+** Licensees holding valid TQt Commercial licenses may use this file in
+** accordance with the TQt Commercial License Agreement provided with
+** the Software.
+**
+** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
+** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
+** herein.
+**
+**********************************************************************/
+
+#include "tqvfbratedlg.h"
+
+#include <tqlayout.h>
+#include <tqlabel.h>
+#include <tqslider.h>
+#include <tqpushbutton.h>
+
+TQVFbRateDialog::TQVFbRateDialog( int rate, TQWidget *tqparent, const char *name,
+ bool modal )
+ : TQDialog( tqparent, name, modal )
+{
+ oldRate = rate;
+
+ TQVBoxLayout *tl = new TQVBoxLayout( this, 5 );
+
+ TQLabel *label = new TQLabel( "Target frame rate:", this );
+ tl->addWidget( label );
+
+ TQHBoxLayout *hl = new TQHBoxLayout( tl );
+ rateSlider = new TQSlider( 1, 100, 10, rate, TQSlider::Horizontal, this );
+ hl->addWidget( rateSlider );
+ connect( rateSlider, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(rateChanged(int)) );
+ rateLabel = new TQLabel( TQString( "%1fps" ).arg(rate), this );
+ hl->addWidget( rateLabel );
+
+ hl = new TQHBoxLayout( tl );
+ TQPushButton *pb = new TQPushButton( "OK", this );
+ connect( pb, TQT_SIGNAL(clicked()), this, TQT_SLOT(accept()) );
+ hl->addWidget( pb );
+ pb = new TQPushButton( "Cancel", this );
+ connect( pb, TQT_SIGNAL(clicked()), this, TQT_SLOT(cancel()) );
+ hl->addWidget( pb );
+}
+
+void TQVFbRateDialog::rateChanged( int r )
+{
+ if ( rateSlider->value() != r )
+ rateSlider->setValue( r );
+ rateLabel->setText( TQString( "%1fps" ).arg(r) );
+ emit updateRate(r);
+}
+
+void TQVFbRateDialog::cancel()
+{
+ rateChanged( oldRate );
+ reject();
+}
diff --git a/tqtinterface/qt4/tools/qvfb/qvfbratedlg.h b/tqtinterface/qt4/tools/qvfb/qvfbratedlg.h
new file mode 100644
index 0000000..387c28b
--- /dev/null
+++ b/tqtinterface/qt4/tools/qvfb/qvfbratedlg.h
@@ -0,0 +1,59 @@
+/**********************************************************************
+** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA.
+**
+** This file is part of TQt/Embedded virtual framebuffer.
+**
+** This file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free
+** Software Foundation and appearing in the files LICENSE.GPL2
+** and LICENSE.GPL3 included in the packaging of this file.
+** Alternatively you may (at your option) use any later version
+** of the GNU General Public License if such license has been
+** publicly approved by Trolltech ASA (or its successors, if any)
+** and the KDE Free TQt Foundation.
+**
+** Please review the following information to ensure GNU General
+** Public Licensing requirements will be met:
+** http://trolltech.com/products/qt/licenses/licensing/opensource/.
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
+** or contact the sales department at sales@trolltech.com.
+**
+** Licensees holding valid TQt Commercial licenses may use this file in
+** accordance with the TQt Commercial License Agreement provided with
+** the Software.
+**
+** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
+** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
+** herein.
+**
+**********************************************************************/
+
+#include <tqdialog.h>
+
+class TQLabel;
+class TQSlider;
+
+class TQVFbRateDialog : public TQDialog
+{
+ TQ_OBJECT
+public:
+ TQVFbRateDialog( int value, TQWidget *tqparent=0, const char *name=0,
+ bool modal=FALSE );
+
+Q_SIGNALS:
+ void updateRate( int r );
+
+protected Q_SLOTS:
+ void rateChanged( int r );
+ void cancel();
+
+private:
+ TQLabel *rateLabel;
+ TQSlider *rateSlider;
+ int oldRate;
+};
+
+
diff --git a/tqtinterface/qt4/tools/qvfb/qvfbview.cpp b/tqtinterface/qt4/tools/qvfb/qvfbview.cpp
new file mode 100644
index 0000000..f7d0669
--- /dev/null
+++ b/tqtinterface/qt4/tools/qvfb/qvfbview.cpp
@@ -0,0 +1,615 @@
+/**********************************************************************
+** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA.
+**
+** This file is part of TQt/Embedded virtual framebuffer.
+**
+** This file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free
+** Software Foundation and appearing in the files LICENSE.GPL2
+** and LICENSE.GPL3 included in the packaging of this file.
+** Alternatively you may (at your option) use any later version
+** of the GNU General Public License if such license has been
+** publicly approved by Trolltech ASA (or its successors, if any)
+** and the KDE Free TQt Foundation.
+**
+** Please review the following information to ensure GNU General
+** Public Licensing requirements will be met:
+** http://trolltech.com/products/qt/licenses/licensing/opensource/.
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
+** or contact the sales department at sales@trolltech.com.
+**
+** Licensees holding valid TQt Commercial licenses may use this file in
+** accordance with the TQt Commercial License Agreement provided with
+** the Software.
+**
+** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
+** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
+** herein.
+**
+**********************************************************************/
+
+#include "tqglobal.h"
+#if !defined( TQ_WS_TQWS ) || defined( TQT_NO_TQWS_MULTIPROCESS )
+#define TQLock TQWSSemaphore
+#undef TQT_NO_TQWS_MULTIPROCESS
+#include "../../src/kernel/qlock.cpp"
+#else
+#include "tqlock_p.h"
+#endif
+
+#include "tqvfbview.h"
+#include "tqvfbhdr.h"
+
+#define TQTE_PIPE "TQtEmbedded-%1"
+
+#include <tqapplication.h>
+#include <tqimage.h>
+#include <tqbitmap.h>
+#include <tqtimer.h>
+#include <tqwmatrix.h>
+#include <tqpainter.h>
+#include "tqanimationwriter.h"
+
+#include <unistd.h>
+#include <sys/ipc.h>
+#include <sys/types.h>
+#include <sys/shm.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <math.h>
+
+//#define TQT_TQWS_EXPERIMENTAL_REVERSE_BIT_ENDIANNESS
+
+TQVFbView::TQVFbView( int display_id, int w, int h, int d, TQWidget *tqparent,
+ const char *name, uint flags )
+ : TQScrollView( tqparent, name, flags ), emulateTouchscreen(FALSE), qwslock(NULL)
+{
+ displayid = display_id;
+ viewport()->setMouseTracking( TRUE );
+ viewport()->setFocusPolicy( StrongFocus );
+ zm = 1;
+ animation = 0;
+ int actualdepth=d;
+
+ switch ( d ) {
+ case 12:
+ actualdepth=16;
+ break;
+ case 1:
+ case 4:
+ case 8:
+ case 16:
+ case 32:
+ break;
+
+ default:
+ qFatal( "Unsupported bit depth %d\n", d );
+ }
+
+ mousePipe = TQString(TQT_VFB_MOUSE_PIPE).arg(display_id);
+ keyboardPipe = TQString(TQT_VFB_KEYBOARD_PIPE).arg(display_id);
+
+ unlink( mousePipe.latin1() );
+ mkfifo( mousePipe.latin1(), 0666 );
+
+ mouseFd = open( mousePipe.latin1(), O_RDWR | O_NDELAY );
+ if ( mouseFd == -1 ) {
+ qFatal( "Cannot open mouse pipe" );
+ }
+
+ unlink( keyboardPipe );
+ mkfifo( keyboardPipe, 0666 );
+ keyboardFd = open( keyboardPipe, O_RDWR | O_NDELAY );
+ if ( keyboardFd == -1 ) {
+ qFatal( "Cannot open keyboard pipe" );
+ }
+
+ key_t key = ftok( mousePipe.latin1(), 'b' );
+
+ int bpl;
+ if ( d == 1 )
+ bpl = (w*d+7)/8;
+ else
+ bpl = ((w*actualdepth+31)/32)*4;
+
+ int dataSize = bpl * h + sizeof( TQVFbHeader );
+ shmId = shmget( key, dataSize, IPC_CREAT|0666);
+ if ( shmId != -1 )
+ data = (unsigned char *)shmat( shmId, 0, 0 );
+ else {
+ struct shmid_ds shm;
+ shmctl( shmId, IPC_RMID, &shm );
+ shmId = shmget( key, dataSize, IPC_CREAT|0666);
+ data = (unsigned char *)shmat( shmId, 0, 0 );
+ }
+
+ if ( (int)data == -1 )
+ qFatal( "Cannot attach to shared memory" );
+
+ hdr = (TQVFbHeader *)data;
+ hdr->width = w;
+ hdr->height = h;
+ viewdepth = d;
+ hdr->depth = actualdepth;
+ hdr->linestep = bpl;
+ hdr->numcols = 0;
+ hdr->dataoffset = sizeof( TQVFbHeader );
+ hdr->update = TQRect();
+
+ resizeContents( w, h );
+
+ timer = new TQTimer( this );
+ connect( timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(timeout()) );
+
+ gammatable=0;
+ setGamma(1.0,1.0,1.0);
+ setRate( 30 );
+}
+
+TQVFbView::~TQVFbView()
+{
+ stopAnimation();
+ sendKeyboardData( 0, 0, 0, TRUE, FALSE ); // magic die key
+ delete qwslock;
+ struct shmid_ds shm;
+ shmdt( (char*)data );
+ shmctl( shmId, IPC_RMID, &shm );
+ ::close( mouseFd );
+ ::close( keyboardFd );
+ unlink( mousePipe );
+ unlink( keyboardPipe );
+}
+
+TQSize TQVFbView::tqsizeHint() const
+{
+ int f = 2 * frameWidth();
+ return TQSize( contentsWidth() + f, contentsHeight() + f );
+}
+
+void TQVFbView::setGamma(double gr, double gg, double gb)
+{
+ if ( viewdepth < 12 )
+ return; // not implemented
+
+ gred=gr; ggreen=gg; gblue=gb;
+
+ switch ( viewdepth ) {
+ case 12:
+ rsh = 12;
+ gsh = 7;
+ bsh = 1;
+ rmax = 15;
+ gmax = 15;
+ bmax = 15;
+ break;
+ case 16:
+ rsh = 11;
+ gsh = 5;
+ bsh = 0;
+ rmax = 31;
+ gmax = 63;
+ bmax = 31;
+ break;
+ case 32:
+ rsh = 16;
+ gsh = 8;
+ bsh = 0;
+ rmax = 255;
+ gmax = 255;
+ bmax = 255;
+ }
+ int mm = TQMAX(rmax,TQMAX(gmax,bmax))+1;
+ if ( gammatable )
+ delete [] gammatable;
+ gammatable = new TQRgb[mm];
+ for (int i=0; i<mm; i++) {
+ int r = int(pow(i,gr)*255/rmax);
+ int g = int(pow(i,gg)*255/gmax);
+ int b = int(pow(i,gb)*255/bmax);
+ if ( r > 255 ) r = 255;
+ if ( g > 255 ) g = 255;
+ if ( b > 255 ) b = 255;
+ gammatable[i] = tqRgb(r,g,b);
+//qDebug("%d: %d,%d,%d",i,r,g,b);
+ }
+
+ setDirty(rect());
+}
+
+void TQVFbView::getGamma(int i, TQRgb& rgb)
+{
+ if ( i > 255 ) i = 255;
+ if ( i < 0 ) i = 0;
+ rgb = tqRgb(tqRed(gammatable[i*rmax/255]),
+ tqGreen(gammatable[i*rmax/255]),
+ tqBlue(gammatable[i*rmax/255]));
+}
+
+int TQVFbView::displayId() const
+{
+ return displayid;
+}
+
+int TQVFbView::displayWidth() const
+{
+ return hdr->width;
+}
+
+int TQVFbView::displayHeight() const
+{
+ return hdr->height;
+}
+
+int TQVFbView::displayDepth() const
+{
+ return viewdepth;
+}
+
+void TQVFbView::setZoom( double z )
+{
+ if ( zm != z ) {
+ zm = z;
+ setDirty(TQRect(0,0,hdr->width,hdr->height));
+ resizeContents( int(hdr->width*z), int(hdr->height*z) );
+ updateGeometry();
+ tqApp->sendPostedEvents();
+ tqtopLevelWidget()->adjustSize();
+ drawScreen();
+ }
+}
+
+void TQVFbView::setRate( int r )
+{
+ refreshRate = r;
+ timer->start( 1000/r );
+}
+
+#ifndef TQ_WS_TQWS
+// Get the name of the directory where TQt/Embedded temporary data should
+// live.
+static TQString qws_dataDir()
+{
+ TQString username = "unknown";
+ const char *logname = getenv("LOGNAME");
+ if ( logname )
+ username = logname;
+
+ TQString dataDir = "/tmp/qtembedded-" + username;
+ if ( mkdir( dataDir.latin1(), 0700 ) ) {
+ if ( errno != EEXIST ) {
+ qFatal( TQString("Cannot create TQt/Embedded data directory: %1")
+ .arg( dataDir ) );
+ }
+ }
+
+ struct stat buf;
+ if ( lstat( dataDir.latin1(), &buf ) )
+ qFatal( TQString( "stat failed for TQt/Embedded data directory: %1" )
+ .arg( dataDir ) );
+
+ if ( !S_ISDIR( buf.st_mode ) )
+ qFatal( TQString( "%1 is not a directory" ).arg( dataDir ) );
+
+ if ( buf.st_uid != getuid() )
+ qFatal( TQString( "TQt/Embedded data directory is not owned by user %1" )
+ .arg( getuid() ) );
+
+ if ( (buf.st_mode & 0677) != 0600 )
+ qFatal( TQString( "TQt/Embedded data directory has incorrect permissions: %1" )
+ .arg( dataDir ) );
+
+ dataDir += "/";
+
+ return dataDir;
+}
+#endif
+
+void TQVFbView::initLock()
+{
+ TQString username = "unknown";
+ const char *logname = getenv("LOGNAME");
+ if ( logname )
+ username = logname;
+ qwslock = new TQLock(qws_dataDir() + TQString( TQTE_PIPE ).arg( displayid ),
+ 'd', TRUE);
+}
+
+void TQVFbView::lock()
+{
+ if ( !qwslock )
+ initLock();
+ qwslock->lock(TQLock::Read);
+}
+
+void TQVFbView::unlock()
+{
+ if ( qwslock )
+ qwslock->unlock();
+}
+
+void TQVFbView::sendMouseData( const TQPoint &pos, int buttons )
+{
+ write( mouseFd, &pos, sizeof( TQPoint ) );
+ write( mouseFd, &buttons, sizeof( int ) );
+}
+
+void TQVFbView::sendKeyboardData( int tqunicode, int keycode, int modifiers,
+ bool press, bool repeat )
+{
+ TQVFbKeyData kd;
+ kd.tqunicode = tqunicode | (keycode << 16);
+ kd.modifiers = modifiers;
+ kd.press = press;
+ kd.repeat = repeat;
+ write( keyboardFd, &kd, sizeof( TQVFbKeyData ) );
+}
+
+void TQVFbView::timeout()
+{
+ lock();
+ if ( animation ) {
+ TQRect r( hdr->update );
+ r = r.intersect( TQRect(0, 0, hdr->width, hdr->height ) );
+ if ( r.isEmpty() ) {
+ animation->appendBlankFrame();
+ } else {
+ int l;
+ TQImage img = getBuffer( r, l );
+ animation->appendFrame(img,TQPoint(r.x(),r.y()));
+ }
+ }
+ if ( hdr->dirty ) {
+ drawScreen();
+ }
+ unlock();
+}
+
+TQImage TQVFbView::getBuffer( const TQRect &r, int &leading ) const
+{
+ switch ( viewdepth ) {
+ case 12:
+ case 16: {
+ static unsigned char *imgData = 0;
+ if ( !imgData ) {
+ int bpl = ((hdr->width*32+31)/32)*4;
+ imgData = new unsigned char [ bpl * hdr->height ];
+ }
+ TQImage img( imgData, r.width(), r.height(), 32, 0, 0, TQImage::IgnoreEndian );
+ const int rsh = viewdepth == 12 ? 12 : 11;
+ const int gsh = viewdepth == 12 ? 7 : 5;
+ const int bsh = viewdepth == 12 ? 1 : 0;
+ const int rmax = viewdepth == 12 ? 15 : 31;
+ const int gmax = viewdepth == 12 ? 15 : 63;
+ const int bmax = viewdepth == 12 ? 15 : 31;
+ for ( int row = 0; row < r.height(); row++ ) {
+ TQRgb *dptr = (TQRgb*)img.scanLine( row );
+ ushort *sptr = (ushort*)(data + hdr->dataoffset + (r.y()+row)*hdr->linestep);
+ sptr += r.x();
+#ifdef TQT_TQWS_REVERSE_BYTE_ENDIANNESS
+ for ( int col=0; col < r.width()/2; col++ ) {
+#else
+ for ( int col=0; col < r.width(); col++ ) {
+#endif
+ ushort s = *sptr++;
+#ifdef TQT_TQWS_REVERSE_BYTE_ENDIANNESS
+ ushort s2 = *sptr++;
+ *dptr++ = tqRgb(tqRed(gammatable[(s2>>rsh)&rmax]),tqGreen(gammatable[(s2>>gsh)&gmax]),tqBlue(gammatable[(s2>>bsh)&bmax]));
+#endif
+ *dptr++ = tqRgb(tqRed(gammatable[(s>>rsh)&rmax]),tqGreen(gammatable[(s>>gsh)&gmax]),tqBlue(gammatable[(s>>bsh)&bmax]));
+ //*dptr++ = tqRgb(((s>>rsh)&rmax)*255/rmax,((s>>gsh)&gmax)*255/gmax,((s>>bsh)&bmax)*255/bmax);
+ }
+ }
+ leading = 0;
+ return img;
+ }
+ case 4: {
+ static unsigned char *imgData = 0;
+ if ( !imgData ) {
+ int bpl = ((hdr->width*8+31)/32)*4;
+ imgData = new unsigned char [ bpl * hdr->height ];
+ }
+ TQImage img( imgData, r.width(), r.height(), 8, hdr->clut, 16,
+ TQImage::IgnoreEndian );
+ for ( int row = 0; row < r.height(); row++ ) {
+ unsigned char *dptr = img.scanLine( row );
+ unsigned char *sptr = data + hdr->dataoffset + (r.y()+row)*hdr->linestep;
+ sptr += r.x()/2;
+ int col = 0;
+#ifdef TQT_TQWS_EXPERIMENTAL_REVERSE_BIT_ENDIANNESS
+ if ( r.x() & 1 ) {
+ *dptr++ = *sptr++ & 0x0f;
+ col++;
+ }
+ for ( ; col < r.width()-1; col+=2 ) {
+ unsigned char s = *sptr++;
+ *dptr++ = s >> 4;
+ *dptr++ = s & 0x0f;
+ }
+ if ( !(r.right() & 1) )
+ *dptr = *sptr >> 4;
+#else
+ if ( r.x() & 1 ) {
+ *dptr++ = *sptr++ >> 4;
+ col++;
+ }
+ for ( ; col < r.width()-1; col+=2 ) {
+ unsigned char s = *sptr++;
+ *dptr++ = s & 0x0f;
+ *dptr++ = s >> 4;
+ }
+ if ( !(r.right() & 1) )
+ *dptr = *sptr & 0x0f;
+#endif
+ }
+ leading = 0;
+ return img;
+ }
+ case 32: {
+ leading = r.x();
+ return TQImage( data + hdr->dataoffset + r.y() * hdr->linestep,
+ hdr->width, r.height(), hdr->depth, 0,
+ 0, TQImage::LittleEndian );
+ }
+ case 8: {
+ leading = r.x();
+ return TQImage( data + hdr->dataoffset + r.y() * hdr->linestep,
+ hdr->width, r.height(), hdr->depth, hdr->clut,
+ 256, TQImage::LittleEndian );
+ }
+ case 1: {
+ leading = r.x();
+ return TQImage( data + hdr->dataoffset + r.y() * hdr->linestep,
+ hdr->width, r.height(), hdr->depth, hdr->clut,
+#ifndef TQT_TQWS_EXPERIMENTAL_REVERSE_BIT_ENDIANNESS
+ 0, TQImage::LittleEndian );
+#else
+ 0, TQImage::BigEndian );
+#endif
+ }
+ }
+ return TQImage();
+}
+
+void TQVFbView::drawScreen()
+{
+ TQPainter p( viewport() );
+
+ p.translate( -contentsX(), -contentsY() );
+
+ lock();
+ TQRect r( hdr->update );
+ hdr->dirty = FALSE;
+ hdr->update = TQRect();
+ // qDebug( "update %d, %d, %dx%d", r.y(), r.x(), r.width(), r.height() );
+ r = r.intersect( TQRect(0, 0, hdr->width, hdr->height ) );
+ if ( !r.isEmpty() ) {
+ if ( int(zm) != zm ) {
+ r.rLeft() = int(int(r.left()*zm)/zm);
+ r.rTop() = int(int(r.top()*zm)/zm);
+ r.rRight() = int(int(r.right()*zm+zm+0.0000001)/zm+1.9999);
+ r.rBottom() = int(int(r.bottom()*zm+zm+0.0000001)/zm+1.9999);
+ r.rRight() = TQMIN(r.right(),hdr->width-1);
+ r.rBottom() = TQMIN(r.bottom(),hdr->height-1);
+ }
+ int leading;
+ TQImage img( getBuffer( r, leading ) );
+ TQPixmap pm;
+ if ( zm == 1 ) {
+ pm.convertFromImage( img );
+ } else if ( int(zm) == zm ) {
+ TQWMatrix m;
+ m.scale(zm,zm);
+ pm.convertFromImage( img );
+ pm = pm.xForm(m);
+ } else {
+ pm.convertFromImage( img.smoothScale(int(img.width()*zm),int(img.height()*zm)) );
+ }
+ unlock();
+ p.setPen( black );
+ p.setBrush( white );
+ p.drawPixmap( int(r.x()*zm), int(r.y()*zm), pm,
+ int(leading*zm), 0, pm.width(), pm.height() );
+ } else {
+ unlock();
+ }
+}
+
+bool TQVFbView::eventFilter( TQObject *obj, TQEvent *e )
+{
+ if ( obj == viewport() &&
+ (e->type() == TQEvent::FocusIn || e->type() == TQEvent::FocusOut) )
+ return TRUE;
+
+ return TQScrollView::eventFilter( obj, e );
+}
+
+void TQVFbView::viewportPaintEvent( TQPaintEvent *pe )
+{
+ TQRect r( pe->rect() );
+ r.moveBy( contentsX(), contentsY() );
+ r = TQRect(int(r.x()/zm),int(r.y()/zm),
+ int(r.width()/zm)+1,int(r.height()/zm)+1);
+ setDirty(r);
+ drawScreen();
+}
+
+void TQVFbView::setDirty( const TQRect& r )
+{
+ lock();
+ hdr->update |= r;
+ hdr->dirty = TRUE;
+ unlock();
+}
+
+void TQVFbView::contentsMousePressEvent( TQMouseEvent *e )
+{
+ sendMouseData( e->pos()/zm, e->stateAfter() );
+}
+
+void TQVFbView::contentsMouseDoubleClickEvent( TQMouseEvent *e )
+{
+ sendMouseData( e->pos()/zm, e->stateAfter() );
+}
+
+void TQVFbView::contentsMouseReleaseEvent( TQMouseEvent *e )
+{
+ sendMouseData( e->pos()/zm, e->stateAfter() );
+}
+
+void TQVFbView::contentsMouseMoveEvent( TQMouseEvent *e )
+{
+ if ( !emulateTouchscreen || (e->state() & MouseButtonMask ) )
+ sendMouseData( e->pos()/zm, e->state() );
+}
+
+
+
+void TQVFbView::keyPressEvent( TQKeyEvent *e )
+{
+ sendKeyboardData(e->text()[0].tqunicode(), e->key(),
+ e->stateAfter()&(ShiftButton|ControlButton|AltButton),
+ TRUE, e->isAutoRepeat());
+}
+
+void TQVFbView::keyReleaseEvent( TQKeyEvent *e )
+{
+ sendKeyboardData(e->ascii(), e->key(),
+ e->stateAfter()&(ShiftButton|ControlButton|AltButton),
+ FALSE, e->isAutoRepeat());
+}
+
+
+TQImage TQVFbView::image() const
+{
+ ((TQVFbView*)this)->lock();
+ int l;
+ TQImage r = getBuffer( TQRect(0, 0, hdr->width, hdr->height), l ).copy();
+ ((TQVFbView*)this)->unlock();
+ return r;
+}
+
+void TQVFbView::startAnimation( const TQString& filename )
+{
+ delete animation;
+ animation = new TQAnimationWriter(filename,"MNG");
+ animation->setFrameRate(refreshRate);
+ animation->appendFrame(TQImage(data + hdr->dataoffset,
+ hdr->width, hdr->height, hdr->depth, hdr->clut,
+ 256, TQImage::LittleEndian));
+}
+
+void TQVFbView::stopAnimation()
+{
+ delete animation;
+ animation = 0;
+}
+
+void TQVFbView::setTouchscreenEmulation( bool b )
+{
+ emulateTouchscreen = b;
+}
diff --git a/tqtinterface/qt4/tools/qvfb/qvfbview.h b/tqtinterface/qt4/tools/qvfb/qvfbview.h
new file mode 100644
index 0000000..df5adcc
--- /dev/null
+++ b/tqtinterface/qt4/tools/qvfb/qvfbview.h
@@ -0,0 +1,126 @@
+/**********************************************************************
+** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA.
+**
+** This file is part of TQt/Embedded virtual framebuffer.
+**
+** This file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free
+** Software Foundation and appearing in the files LICENSE.GPL2
+** and LICENSE.GPL3 included in the packaging of this file.
+** Alternatively you may (at your option) use any later version
+** of the GNU General Public License if such license has been
+** publicly approved by Trolltech ASA (or its successors, if any)
+** and the KDE Free TQt Foundation.
+**
+** Please review the following information to ensure GNU General
+** Public Licensing requirements will be met:
+** http://trolltech.com/products/qt/licenses/licensing/opensource/.
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
+** or contact the sales department at sales@trolltech.com.
+**
+** Licensees holding valid TQt Commercial licenses may use this file in
+** accordance with the TQt Commercial License Agreement provided with
+** the Software.
+**
+** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
+** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
+** herein.
+**
+**********************************************************************/
+
+#include <tqscrollview.h>
+
+class TQImage;
+class TQTimer;
+class TQAnimationWriter;
+class TQLock;
+struct TQVFbHeader;
+
+class TQVFbView : public TQScrollView
+{
+ TQ_OBJECT
+public:
+ TQVFbView( int display_id, int w, int h, int d, TQWidget *tqparent = 0,
+ const char *name = 0, uint wflags = 0 );
+ ~TQVFbView();
+
+ int displayId() const;
+ int displayWidth() const;
+ int displayHeight() const;
+ int displayDepth() const;
+
+ bool touchScreenEmulation() const { return emulateTouchscreen; }
+ int rate() { return refreshRate; }
+ bool animating() const { return !!animation; }
+ TQImage image() const;
+
+ void setGamma(double gr, double gg, double gb);
+ double gammaRed() const { return gred; }
+ double gammaGreen() const { return ggreen; }
+ double gammaBlue() const { return gblue; }
+ void getGamma(int i, TQRgb& rgb);
+ void skinKeyPressEvent( TQKeyEvent *e ) { keyPressEvent(e); }
+ void skinKeyReleaseEvent( TQKeyEvent *e ) { keyReleaseEvent(e); }
+
+ double zoom() const { return zm; }
+
+ TQSize tqsizeHint() const;
+public Q_SLOTS:
+ void setTouchscreenEmulation( bool );
+
+ void setRate( int );
+ void setZoom( double );
+ void startAnimation( const TQString& );
+ void stopAnimation();
+
+protected Q_SLOTS:
+ void timeout();
+
+protected:
+ void initLock();
+ void lock();
+ void unlock();
+ TQImage getBuffer( const TQRect &r, int &leading ) const;
+ void drawScreen();
+ void sendMouseData( const TQPoint &pos, int buttons );
+ void sendKeyboardData( int tqunicode, int keycode, int modifiers,
+ bool press, bool repeat );
+ virtual bool eventFilter( TQObject *obj, TQEvent *e );
+ virtual void viewportPaintEvent( TQPaintEvent *pe );
+ virtual void contentsMousePressEvent( TQMouseEvent *e );
+ virtual void contentsMouseDoubleClickEvent( TQMouseEvent *e );
+ virtual void contentsMouseReleaseEvent( TQMouseEvent *e );
+ virtual void contentsMouseMoveEvent( TQMouseEvent *e );
+ virtual void keyPressEvent( TQKeyEvent *e );
+ virtual void keyReleaseEvent( TQKeyEvent *e );
+
+private:
+ bool emulateTouchscreen;
+ void setDirty( const TQRect& );
+ int shmId;
+ unsigned char *data;
+ TQVFbHeader *hdr;
+ int viewdepth; // "faked" depth
+ int rsh;
+ int gsh;
+ int bsh;
+ int rmax;
+ int gmax;
+ int bmax;
+ double gred, ggreen, gblue;
+ TQRgb* gammatable;
+ TQLock *qwslock;
+ TQTimer *timer;
+ int mouseFd;
+ int keyboardFd;
+ int refreshRate;
+ TQString mousePipe;
+ TQString keyboardPipe;
+ TQAnimationWriter *animation;
+ int displayid;
+ double zm;
+};
+
diff --git a/tqtinterface/qt4/tools/qvfb/skin.cpp b/tqtinterface/qt4/tools/qvfb/skin.cpp
new file mode 100644
index 0000000..da6304b
--- /dev/null
+++ b/tqtinterface/qt4/tools/qvfb/skin.cpp
@@ -0,0 +1,174 @@
+/**********************************************************************
+** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA.
+**
+** This file is part of TQt/Embedded virtual framebuffer.
+**
+** This file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free
+** Software Foundation and appearing in the files LICENSE.GPL2
+** and LICENSE.GPL3 included in the packaging of this file.
+** Alternatively you may (at your option) use any later version
+** of the GNU General Public License if such license has been
+** publicly approved by Trolltech ASA (or its successors, if any)
+** and the KDE Free TQt Foundation.
+**
+** Please review the following information to ensure GNU General
+** Public Licensing requirements will be met:
+** http://trolltech.com/products/qt/licenses/licensing/opensource/.
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
+** or contact the sales department at sales@trolltech.com.
+**
+** Licensees holding valid TQt Commercial licenses may use this file in
+** accordance with the TQt Commercial License Agreement provided with
+** the Software.
+**
+** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
+** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
+** herein.
+**
+**********************************************************************/
+
+#include "skin.h"
+#include "tqvfb.h"
+#include "tqvfbview.h"
+
+#include <tqbitmap.h>
+#include <tqpixmap.h>
+#include <tqtextstream.h>
+#include <tqfile.h>
+#include <tqpainter.h>
+#ifdef TQ_WS_MAC
+# include <tqt_mac.h>
+#endif
+
+Skin::Skin( TQVFb *p, const TQString &skinFile, int &viewW, int &viewH ) : TQWidget(p)
+{
+ TQFile f( skinFile );
+ f.open( IO_ReadOnly );
+ TQTextStream ts( &f );
+ ts >> skinImageUpFileName;
+ ts >> skinImageDownFileName;
+ ts >> viewX1;
+ ts >> viewY1;
+ ts >> viewW;
+ ts >> viewH;
+ ts >> transparancy;
+ ts >> numberOfAreas;
+// Debug the skin file parsing
+// printf("read: -%s- -%i- -%i- -%i-\n", skinImage.latin1(), viewX1, viewY1, numberOfAreas );
+ areas = new ButtonAreas[numberOfAreas];
+
+ for (int i = 0; i < numberOfAreas; i++) {
+ ts >> areas[i].name;
+ ts >> areas[i].keyCode;
+ ts >> areas[i].x1;
+ ts >> areas[i].y1;
+ ts >> areas[i].x2;
+ ts >> areas[i].y2;
+// Debug the skin file parsing
+// printf("read: -%s- -%i- -%i- -%i- -%i- -%i-\n", areas[i].name.latin1(),
+// areas[i].keyCode, areas[i].x1, areas[i].y1, areas[i].x2, areas[i].y2 );
+ }
+
+ tqparent = p;
+ skinImageUp = new TQPixmap( skinImageUpFileName );
+ skinImageDown = new TQPixmap( skinImageDownFileName );
+// setPixmap( ipaq );
+ setFixedSize( skinImageUp->size() );
+ TQBitmap tqmask = skinImageUp->createHeuristicMask();
+ int wf = WStyle_Customize | WType_TopLevel | WStyle_NoBorder;
+ tqparent->reparent( 0, wf, pos(), TRUE );
+ tqparent->setMask( tqmask );
+ tqparent->setFixedSize( skinImageUp->size() );
+ buttonPressed = FALSE;
+ buttonIndex = 0;
+}
+
+
+Skin::~Skin( )
+{
+}
+
+
+void Skin::setView( TQVFbView *v )
+{
+ view = v;
+ view->move( viewX1, viewY1 );
+#ifdef TQ_WS_MAC
+ TQMacSavedPortInfo::setAlphaTransparancy(view, transparancy);
+#endif
+}
+
+
+void Skin::paintEvent( TQPaintEvent * )
+{
+ TQPainter p( this );
+// printf("read: -%s-\n", skinImageUp.latin1());
+ if (skinImageUp)
+ p.drawPixmap( 0, 0, *skinImageUp );
+ if (buttonPressed == TRUE) {
+ ButtonAreas *ba = &areas[buttonIndex];
+ if (skinImageDown)
+ p.drawPixmap( ba->x1, ba->y1, *skinImageDown, ba->x1, ba->y1, ba->x2 - ba->x1, ba->y2 - ba->y1 );
+ }
+}
+
+
+void Skin::mousePressEvent( TQMouseEvent *e )
+{
+ if (e->button() == RightButton) {
+ tqparent->popupMenu();
+ } else {
+ buttonPressed = FALSE;
+
+ for (int i = 0; i < numberOfAreas; i++) {
+ TQPoint p1( areas[i].x1, areas[i].y1 );
+ TQPoint p2( areas[i].x2, areas[i].y2 );
+ TQRect r( p1, p2 );
+ if ( r.tqcontains( e->pos() ) ) {
+ buttonPressed = TRUE;
+ buttonIndex = i;
+ buttonCode = areas[buttonIndex].keyCode;
+ TQKeyEvent keyEvent( TQEvent::KeyPress, buttonCode, 0, 0 );
+ if (view)
+ view->skinKeyPressEvent( &keyEvent );
+// Debug message to be sure we are clicking the right areas
+// printf("%s clicked\n", areas[i].name);
+ ButtonAreas *ba = &areas[buttonIndex];
+ tqrepaint( ba->x1, ba->y1, ba->x2 - ba->x1, ba->y2 - ba->y1, FALSE );
+ continue;
+ }
+ }
+
+// This is handy for tqfinding the areas to define rectangles for new skins
+// printf("Clicked in %i,%i\n", e->pos().x(), e->pos().y());
+ clickPos = e->pos();
+ }
+}
+
+
+void Skin::mouseMoveEvent( TQMouseEvent *e )
+{
+ if ( buttonPressed == FALSE ) {
+ TQPoint newpos = e->globalPos() - clickPos;
+ tqparent->move( newpos );
+ }
+}
+
+
+void Skin::mouseReleaseEvent( TQMouseEvent * )
+{
+ if ( buttonPressed ) {
+ TQKeyEvent keyEvent( TQEvent::KeyRelease, buttonCode, 0, 0 );
+ if (view)
+ view->skinKeyReleaseEvent( &keyEvent );
+ buttonPressed = FALSE;
+ ButtonAreas *ba = &areas[buttonIndex];
+ tqrepaint( ba->x1, ba->y1, ba->x2 - ba->x1, ba->y2 - ba->y1, FALSE );
+ }
+}
+
+
diff --git a/tqtinterface/qt4/tools/qvfb/skin.h b/tqtinterface/qt4/tools/qvfb/skin.h
new file mode 100644
index 0000000..5c5d112
--- /dev/null
+++ b/tqtinterface/qt4/tools/qvfb/skin.h
@@ -0,0 +1,78 @@
+/**********************************************************************
+** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA.
+**
+** This file is part of TQt/Embedded virtual framebuffer.
+**
+** This file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free
+** Software Foundation and appearing in the files LICENSE.GPL2
+** and LICENSE.GPL3 included in the packaging of this file.
+** Alternatively you may (at your option) use any later version
+** of the GNU General Public License if such license has been
+** publicly approved by Trolltech ASA (or its successors, if any)
+** and the KDE Free TQt Foundation.
+**
+** Please review the following information to ensure GNU General
+** Public Licensing requirements will be met:
+** http://trolltech.com/products/qt/licenses/licensing/opensource/.
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
+** or contact the sales department at sales@trolltech.com.
+**
+** Licensees holding valid TQt Commercial licenses may use this file in
+** accordance with the TQt Commercial License Agreement provided with
+** the Software.
+**
+** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
+** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
+** herein.
+**
+**********************************************************************/
+
+#include <tqwidget.h>
+
+
+class TQVFb;
+class TQVFbView;
+
+
+class Skin : public TQWidget
+{
+public:
+ Skin( TQVFb *p, const TQString &skinFile, int &viewW, int &viewH );
+ ~Skin( );
+ void setView( TQVFbView *v );
+protected:
+ virtual void paintEvent( TQPaintEvent * );
+ virtual void mousePressEvent( TQMouseEvent *e );
+ virtual void mouseMoveEvent( TQMouseEvent *e );
+ virtual void mouseReleaseEvent( TQMouseEvent * );
+private:
+ TQVFb *tqparent;
+ TQVFbView *view;
+ TQPoint clickPos;
+ bool buttonPressed;
+ int buttonCode;
+ int buttonIndex;
+ float transparancy;
+
+ TQString skinImageUpFileName;
+ TQString skinImageDownFileName;
+ TQPixmap *skinImageUp;
+ TQPixmap *skinImageDown;
+ int viewX1, viewY1;
+ int numberOfAreas;
+
+ typedef struct {
+ TQString name;
+ int keyCode;
+ int x1, y1;
+ int x2, y2;
+ } ButtonAreas;
+
+ ButtonAreas *areas;
+};
+
+