diff options
author | Darrell Anderson <humanreadable@yahoo.com> | 2013-05-17 12:45:40 -0500 |
---|---|---|
committer | Darrell Anderson <humanreadable@yahoo.com> | 2013-05-17 12:45:40 -0500 |
commit | 359294c33620c8328d61f67635046d7cc060530c (patch) | |
tree | f2ac08fdad8860f7bc1ac76203e31013a799fda7 /tdelirc | |
parent | 7be7990fc5770d2cbcd937772e8239167b5900c6 (diff) | |
download | tdeutils-359294c33620c8328d61f67635046d7cc060530c.tar.gz tdeutils-359294c33620c8328d61f67635046d7cc060530c.zip |
Rename kdessh -> tdessh and kdelirc -> tdelirc.
Diffstat (limited to 'tdelirc')
75 files changed, 9564 insertions, 0 deletions
diff --git a/tdelirc/AUTHORS b/tdelirc/AUTHORS new file mode 100644 index 0000000..c6474a8 --- /dev/null +++ b/tdelirc/AUTHORS @@ -0,0 +1,3 @@ +Code mostly by Gav Wood <gav@kde.org> +LIRC interface code adapted from Noatun/Infrared by Malte Starostik. + diff --git a/tdelirc/CMakeLists.txt b/tdelirc/CMakeLists.txt new file mode 100644 index 0000000..251c9db --- /dev/null +++ b/tdelirc/CMakeLists.txt @@ -0,0 +1,17 @@ +################################################# +# +# (C) 2012 Golubev Alexander +# fatzer2 (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( icons ) +add_subdirectory( irkick ) +add_subdirectory( kcmlirc ) +add_subdirectory( tdelirc ) +add_subdirectory( profiles ) +add_subdirectory( remotes ) diff --git a/tdelirc/COPYING b/tdelirc/COPYING new file mode 100644 index 0000000..c13faf0 --- /dev/null +++ b/tdelirc/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + 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 contains +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 contains 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 contains, 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 + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/tdelirc/Makefile.am b/tdelirc/Makefile.am new file mode 100644 index 0000000..1b42dee --- /dev/null +++ b/tdelirc/Makefile.am @@ -0,0 +1,3 @@ + +SUBDIRS = icons tdelirc irkick kcmlirc profiles remotes + diff --git a/tdelirc/README b/tdelirc/README new file mode 100644 index 0000000..8ae6875 --- /dev/null +++ b/tdelirc/README @@ -0,0 +1,55 @@ +tdelirc +------- + +TDELIRC is a TDE frontend for the Linux Infrared Remote Control system. It has +two aims: + +1. Provide a control center module for configuration of: + a) Application bindings to remote control buttons. + b) Actual remote controls installed (i.e. lirc configuration). + +2. Provide a system-tray applet to act as a proxy between the LIRC system and + TDE (applications), in order to launch DCOP requests (and potentially + other IPC signals) to applications (and potentially collect/display + results). + +INSTALLATION + +Nothing but the normal ./configure && make && su -c "make install". + +SETUP + +For the TDELirc system to work properly, you *must* have lircd configured and +running. If you have already had a Lirc program running, then you most likely +have Lirc set up properly. If not, be sure that you have a correct kernel module +loaded for your IR receiver (1) and that the lircd program is running (2). + +You must also have some remote controls configured in "/etc/lircd.conf". Go to +the lircd website (www.lirc.org) for more information on this. + +(1) /sbin/lsmod | grep lirc +If you see some output, you have a lirc kernel module loaded (that's not to say +it's the right module for your hardware). + +(2) ps aux | grep -v grep | grep lircd +If you see some output, you have the lircd program running. This is good. + +DESIGN + +The design of the system is really quite simple---a control center module +modifies a centralised configuration file to determine what action(s) should +be taken on a remote control's button press. + +The same(?) module also provides a front-end for the input of /etc/lircd.conf, +necessary to specify remote controls to the LIRC system. An extra (standard +format XML-based) may be provided with the remote control description to give +less sucky (lower case, no spaces/symbols) names. + +The /etc/lircd.conf frontend has not yet been implemented, though all other +features are. + +The system tray applet interfaces with LIRC in order to catch key presses on +remote controls. It is then able to communicate with and potentially start +applications through DCOP. + +Gav Wood, 2003 (gav at kde dot org). diff --git a/tdelirc/README.profile-creation b/tdelirc/README.profile-creation new file mode 100644 index 0000000..80ec429 --- /dev/null +++ b/tdelirc/README.profile-creation @@ -0,0 +1,145 @@ +How to give your KDE application IR support under KDE. +====================================================== + +by Gav Wood, 2003. + +Introduction +------------ + +All DCOP-using applications under KDE have basic lirc support, since TDELirc has +the ability to interface any button to any DCOP call. However, to give your +application the real professional touch when using it with TDELirc, I recommend +you create a profile for it. + +A profile tells TDELirc (and the user!) what the various DCOP calls do. +Essentially this is a kind of documentation for the DCOP calls. You don't have +to include all DCOP calls - just the ones that you feel would benefit end-users +the most (usually "interface adjusting" calls rather the "information gathering" +calls). + + +Method +------ + +1. DCOP + +The first thing to do is to give your application DCOP functionality. This is +*very* easy and essentially amounts to adding a declaration to each object you +want to give DCOP accessibility and adding an entry to your Makefile. I wont go +into it here as the KDE documentation already provides a suitable resource for +such information. + +Ensure you provide a full accessibility to your application's interface by DCOP, +and especially in the case of IR-interfacing, try not to have functions with too +many parameters, or with exotic types (stick to ints and QStrings where +necessary). + +2. Create a profile + +Having coded the necessary DCOP functionality into your application, the only +other thing to do is describe how it works to the user. This is done by means of +a .profile.xml document, examples of which may be found in the tdelirc/profiles +directory. A quick guide is given here: + +a) First create top level "profile" tags with the DCOP application id and KDE +service name (found in the .desktop file) as attributes of them: + + <?xml version="1.0" ?> + <!DOCTYPE profile SYSTEM "profile.dtd"> + <profile id="myapp" servicename="My Application"> + </profile> + +b) Inside populate with name and author information. If your application is not a +KUniqueApplication, you **must** declare this with an "instances" tag, giving the +attribute "unique" a value of "0" (it defaults to "1", a KUniqueApplication). You +may optionally describe the default behavior TDELirc should take should there be +more than one instance of the application, with the attribute "ifmulti" which may +take one of "dontsend" (do nothing if >1 instance), "sendtoone" (send call to one +arbitrarily chosen instance) and "sendtoall" (send to all instances). The default +is "dontsend", however, "sendtoone" may be the most useful in many circumstances. + + <?xml version="1.0" ?> + <!DOCTYPE profile SYSTEM "profile.dtd"> + <profile id="myapp" servicename="My Application"> + <name>My Application</name> + <author>Me</author> + <instances unique="0" ifmulti="sendtoone"/> + </profile> + +c) Populate the profile with action tags, for each DCOP action you want to be +available to the user. Each action tag should have DCOP object name and function +prototype. + Several optional attrubutes to specify are the key-class (an identifier to +act as an abstract binding between remote controls and applications). There are +several defined; see the DTD files for a current list. The other options, repeat +and autostart are boolean specificers to tell whether the action should repeat +or automatically start the program by default. + + <?xml version="1.0" ?> + <!DOCTYPE profile SYSTEM "profile.dtd"> + <profile id="myapp" servicename="My Application"> + <name>My Application</name> + <author>Me</author> + <instances unique="0" ifmulti="sendtoone"/> + <action objid="MyApp" prototype="void showint(short int)" + class="number" repeat="0" autostart="0"> + </action> + </profile> + +d) Give the action a name and comment: + + <?xml version="1.0" ?> + <!DOCTYPE profile SYSTEM "profile.dtd"> + <profile id="myapp" servicename="My Application"> + <name>My Application</name> + <author>Me</author> + <instances unique="0" ifmulti="sendtoone"/> + <action objid="MyApp" prototype="void showints(short int)" + class="number" repeat="0" autostart="0"> + <name>Show Integers</name> + <comment>Shows a configurable integer</comment> + </action> + </profile> + +e) Describe each argument with a comment and type attribute. Valid types are +found in the profile.dtd file. If you cant find the exact type, just use one +that is silently castable. You should declare a default value between the +default tags: + + <?xml version="1.0" ?> + <!DOCTYPE profile SYSTEM "profile.dtd"> + <profile id="myapp" servicename="My Application"> + <name>My Application</name> + <author>Me</author> + <instances unique="0" ifmulti="sendtoone"/> + <action objid="MyApp" prototype="void showints(short int)" + class="number" repeat="0" autostart="0"> + <name>Show Integers</name> + <comment>Shows a configurable integer</comment> + <argument type="int"> + <default>5</default> + <comment>The integer to be shown</comment> + </argument> + </action> + </profile> + +When you have created your profile.xml file, put in your project's main source +tree. + +3. Profile installation + +There is a data directory in KDE reserved for profiles such as these; it's path +is "$(kde_datadir)/profiles". These extra lines must therefore be added to your +Makefile.am in the directory of your profile.xml: + + profiledata_DATA = [YOURAPPHERE].profile.xml + profiledatadir = $(kde_datadir)/profiles + EXTRA_DIST = $(profiledata_DATA) + +(replace [YOURAPPHERE] with your application name---the prefix to your +profile.xml file.) + + +4. Finished + +That's it you're done! Your KDE application is now fully IR enabled. diff --git a/tdelirc/README.remote-creation b/tdelirc/README.remote-creation new file mode 100644 index 0000000..a9342c5 --- /dev/null +++ b/tdelirc/README.remote-creation @@ -0,0 +1,129 @@ +How to give your LIRC remote control TDELIRC functionality +========================================================== + +by Gav Wood, 2003. + +Introduction +------------ + +All LIRC-understandable remote controls automatically function in TDELirc. +However, to get the advanced (really cool) TDELirc stuff you'll need to create a +remote.xml file for your remote control. The files are simple and easy to create +so don't be put off. + +The function of the remote.xml file is to describe what the remote controls' +buttons do in a general manner and to provide free-form text names for them, +since LIRC only allows non-spaces, non-symbolic charecters in the remote control +definition files. + +When you're finished your remote.xml, you might want to send it to me +(gav at kde dot org) for inclusion in the distribution of TDELirc. It may soon +be possible to distribute the remote.xml files along with the lircd.conf files. + +Method +------ + +a) Start with the basic template and define the LIRC ID of the remote control. +The LIRC ID is most important, and must be the identifier (look for the line +"name <...>" after the "begin remote" line). put the text after "name" into "id" +attribute of the "remote" tag in the "lircd.conf" file ("/etc/lircd.conf"). + In addition to this, fill in the author and name tags with your name and the +"nice" name of the remote control. Any extra information you may wish to give it +(such as alternate names, multimedia bundles/system is comes with etc) may be +enclosed between optional information tags: + + <?xml version="1.0" ?> + <!DOCTYPE remote SYSTEM "remote.dtd"> + + <remote id="myremote"> + <name>My Remote Control</name> + <author>Me</author> + <information>As bundled with ACME LinTV</information> + </remote> + +This would compliment a "lircd.conf" file: + + begin remote + name myremote + ... + end remote + +b) With the hard work out of the way, just start going though each button on the +remote control. For each button, make sure the "id" attribute is the same as in +the lircd.conf file. + For each (common) button, you might also want to specify the class, which will +help TDELirc match it to any application's action. For a list of all button +classes, look in the remote.dtd file which comes with TDELirc. If the class type +is one which encompasses many buttons, for example "number", then you should also +specify which number it is in the parameter attribute. Currently, this only +actually applies to "number" - all other classes are simple and do not require a +parameter attribute. + Note: If no "class" is given, it will default to the "id". In the unlikely +case that this is not what you want, simply define it to be null (class=""). + + <?xml version="1.0" ?> + <!DOCTYPE remote SYSTEM "remote.dtd"> + + <remote id="myremote"> + <name>My Remote Control</name> + <author>Me</author> + <button id="num0" class="number" parameter="0"> + </button> + <button id="rec" class="record"> + </button> + </remote> + +This would compliment a "lircd.conf" file: + + begin remote + name myremote + ... + begin raw_codes + name num0 + ... + name rec + ... + end raw_codes + end remote + +c) The last thing to define in each of your buttons is the "nice" name. This may +be descriptive and use spaces, symbols and mixed case text, in a similar fashion +to the remote control's name. There is no need to copy the remote control's label +verbatim. If necessary expand the description to provide a readable, aethetically +pleasing label e.g. you should name the "CC" button "Closed Captions" or the "Rec" +button "Record". + + <?xml version="1.0" ?> + <!DOCTYPE remote SYSTEM "remote.dtd"> + + <remote id="myremote"> + <name>My Remote Control</name> + <author>Me</author> + <button id="num0" class="number" parameter="0"> + <name>0</name> + </button> + <button id="rec" class="record"> + <name>Record</name> + </button> + </remote> + + Note: The name of a button will automatically default to its "id", so you can +save yourself some time and effort with buttons which share the same name and id +by changing + + <button id="num0" class="number" parameter="0"> + <name>0</name> + </button> + +to the far less cluttered and simpler: + + <button id="num0" class="number" parameter="0"/> + +That's it - just save it as <id>.remote.xml, where <id> is the ID of the remote +control (*not* its name but the LIRC id!) and copy it to your TDE remotes data +directory (~/.trinity/share/apps/remotes). + + You'll probably need to restart control center before the remote definition +is recognised. + +Gav Wood <gav at kde dot org>
\ No newline at end of file diff --git a/tdelirc/TODO b/tdelirc/TODO new file mode 100644 index 0000000..a7e1044 --- /dev/null +++ b/tdelirc/TODO @@ -0,0 +1,6 @@ +general: +* Take out kdedmodule_stub.h, install by default (KDE4) + +kcmlirc: + +irkick: diff --git a/tdelirc/icons/CMakeLists.txt b/tdelirc/icons/CMakeLists.txt new file mode 100644 index 0000000..567e0a6 --- /dev/null +++ b/tdelirc/icons/CMakeLists.txt @@ -0,0 +1,12 @@ +################################################# +# +# (C) 2012 Golubev Alexander +# fatzer2 (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +tde_install_icons( DESTINATION ${DATA_INSTALL_DIR}/irkick/icons ) diff --git a/tdelirc/icons/Makefile.am b/tdelirc/icons/Makefile.am new file mode 100644 index 0000000..d2a3efc --- /dev/null +++ b/tdelirc/icons/Makefile.am @@ -0,0 +1,3 @@ +tdelirciconsdir = $(kde_datadir)/irkick/icons +tdelircicons_ICON = AUTO + diff --git a/tdelirc/irkick/CMakeLists.txt b/tdelirc/irkick/CMakeLists.txt new file mode 100644 index 0000000..d8d14d9 --- /dev/null +++ b/tdelirc/irkick/CMakeLists.txt @@ -0,0 +1,60 @@ +################################################# +# +# (C) 2012 Golubev Alexander +# fatzer2 (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( icons ) + +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/tdelirc/tdelirc + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} + ${CMAKE_BINARY_DIR}/tdelirc/tdelirc +) + + +##### irkick_common (static) #################### + +tde_add_library( irkick_common STATIC_PIC AUTOMOC + SOURCES irkick.cpp irkick.skel + irkick.stub klircclient.cpp + LINK tdeui-shared tdelirc-static +) + + +##### irkick (tdeinit) ########################## + +tde_add_tdeinit_executable( irkick AUTOMOC + SOURCES main.cpp + LINK irkick_common-static +) + + +##### icons ##################################### + +tde_install_icons( ) + + +##### other data ################################ + +install( FILES irkick.desktop + DESTINATION ${XDG_APPS_INSTALL_DIR} +) + +install( FILES irkick.desktop + DESTINATION ${AUTOSTART_INSTALL_DIR} +) + diff --git a/tdelirc/irkick/Makefile.am b/tdelirc/irkick/Makefile.am new file mode 100644 index 0000000..0e753f7 --- /dev/null +++ b/tdelirc/irkick/Makefile.am @@ -0,0 +1,42 @@ +SUBDIRS = icons + +bin_PROGRAMS = +lib_LTLIBRARIES = +noinst_LTLIBRARIES = libirkick_common.la +tdeinit_LTLIBRARIES = irkick.la + +CLEANFILES = dummy.cpp + +libirkick_common_la_LIBADD = $(LIB_TDECORE) $(LIB_TDEUI) $(LIB_KSYCOCA) ../tdelirc/libtdelirc.la +libirkick_common_la_SOURCES = main.cpp irkick.cpp irkick.skel irkick.stub klircclient.cpp + +libirkick_common_la_LDFLAGS = $(all_libraries) + +irkick_la_LIBADD = libirkick_common.la +irkick_la_SOURCES = dummy.cpp +irkick_la_LDFLAGS = $(all_libraries) -module -avoid-version + +xdg_apps_DATA = irkick.desktop + +autostartdir = $(datadir)/autostart +autostart_DATA = irkick.desktop + +messages: + $(XGETTEXT) *.cpp -o $(podir)/irkick.pot + +dummy.cpp: + echo > dummy.cpp + +#kdedservicesdir = $(kde_servicesdir)/kded +#kdedservices_DATA = irkick.desktop +#lib_LTLIBRARIES = libkded_irkick.la +#libkded_irkick_la_SOURCES = irkick.cpp irkick.skel irkick.stub klircclient.cpp +#libkded_irkick_la_LDFLAGS = $(all_libraries) -module -avoid-version +#libkded_irkick_la_LIBADD = $(LIB_TDECORE) ../tdelirc/libtdelirc.la + +noinst_HEADERS = irkick.h klircclient.h irkick_stub.h + +INCLUDES = -I$(srcdir)/../tdelirc $(all_includes) + +KDE_ICON = AUTO +METASOURCES = AUTO diff --git a/tdelirc/irkick/icons/CMakeLists.txt b/tdelirc/irkick/icons/CMakeLists.txt new file mode 100644 index 0000000..ffd9b18 --- /dev/null +++ b/tdelirc/irkick/icons/CMakeLists.txt @@ -0,0 +1,13 @@ +################################################# +# +# (C) 2012 Golubev Alexander +# fatzer2 (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +tde_install_icons( DESTINATION + ${DATA_INSTALL_DIR}/irkick/icons ) diff --git a/tdelirc/irkick/icons/Makefile.am b/tdelirc/irkick/icons/Makefile.am new file mode 100644 index 0000000..307658e --- /dev/null +++ b/tdelirc/irkick/icons/Makefile.am @@ -0,0 +1,3 @@ +irkickiconsdir = $(kde_datadir)/irkick/icons +irkickicons_ICON = AUTO + diff --git a/tdelirc/irkick/irkick.cpp b/tdelirc/irkick/irkick.cpp new file mode 100644 index 0000000..2d042f0 --- /dev/null +++ b/tdelirc/irkick/irkick.cpp @@ -0,0 +1,336 @@ +/*************************************************************************** + irkick.cpp - Implementation of the main window + ------------------- + copyright : (C) 2002 by Gav Wood + email : gav@kde.org +***************************************************************************/ + +// This program is free software. + +#include <tqwidget.h> +#include <tqdialog.h> +#include <tqtooltip.h> +#include <tqregexp.h> +#include <tqtimer.h> +#include <tqevent.h> + +#include <tdeversion.h> +#include <tdeapplication.h> +#include <tdeaction.h> +#if !(TDE_VERSION_MINOR<=1 && TDE_VERSION_RELEASE<=5) +#include <tdeactioncollection.h> +#endif +#include <ksimpleconfig.h> +#include <ksystemtray.h> +#include <kiconloader.h> +#include <kpassivepopup.h> +#include <tdemessagebox.h> +#include <tdepopupmenu.h> +#include <kdebug.h> +#include <tdelocale.h> +#include <tdeaboutdialog.h> +#include <tdeabouttde.h> +#include <twinmodule.h> +#include <twin.h> +#include <khelpmenu.h> +#include <tdeglobal.h> +#include <kstdguiitem.h> + +#include <dcopclient.h> +#include <dcopref.h> + +#include "profileserver.h" +#include "irkick.h" + +void IRKTrayIcon::mousePressEvent(TQMouseEvent *e) +{ + KSystemTray::mousePressEvent(new TQMouseEvent(TQEvent::MouseButtonPress, e->pos(), e->globalPos(), e->button() == Qt::LeftButton ? Qt::RightButton : e->button(), e->state())); +} + +IRKick::IRKick(const TQCString &obj) : TQObject(), DCOPObject(obj), npApp(TQString()) +{ + kapp->dcopClient()->setDefaultObject(obj); + theClient = new KLircClient(); + + theTrayIcon = new IRKTrayIcon(); + if(theClient->isConnected()) + { theTrayIcon->setPixmap(SmallIcon("irkick")); + TQToolTip::add(theTrayIcon, i18n("TDE Lirc Server: Ready.")); + } + else + { theTrayIcon->setPixmap(SmallIcon("irkickoff")); + TQToolTip::add(theTrayIcon, i18n("TDE Lirc Server: No infra-red remote controls found.")); + TQTimer::singleShot(10000, this, TQT_SLOT(checkLirc())); + } + theFlashOff = new TQTimer(theTrayIcon); + connect(theFlashOff, TQT_SIGNAL(timeout()), TQT_SLOT(flashOff())); + + theResetCount = 0; + slotReloadConfiguration(); + connect(theClient, TQT_SIGNAL(connectionClosed()), this, TQT_SLOT(slotClosed())); + connect(theClient, TQT_SIGNAL(remotesRead()), this, TQT_SLOT(resetModes())); + connect(theClient, TQT_SIGNAL(commandReceived(const TQString &, const TQString &, int)), this, TQT_SLOT(gotMessage(const TQString &, const TQString &, int))); + + theTrayIcon->contextMenu()->changeTitle(0, "IRKick"); + theTrayIcon->contextMenu()->insertItem(SmallIcon( "configure" ), i18n("&Configure..."), this, TQT_SLOT(slotConfigure())); + theTrayIcon->contextMenu()->insertSeparator(); + theTrayIcon->contextMenu()->insertItem(SmallIcon( "help" ), KStdGuiItem::help().text(), (new KHelpMenu(theTrayIcon, TDEGlobal::instance()->aboutData()))->menu()); + theTrayIcon->actionCollection()->action("file_quit")->disconnect(TQT_SIGNAL(activated())); + connect(theTrayIcon->actionCollection()->action("file_quit"), TQT_SIGNAL(activated()), TQT_SLOT(doQuit())); + + theTrayIcon->show(); +} + +IRKick::~IRKick() +{ + delete theTrayIcon; + for(TQMap<TQString,IRKTrayIcon *>::iterator i = currentModeIcons.begin(); i != currentModeIcons.end(); ++i) + if(*i) delete *i; +} + +void IRKick::slotClosed() +{ + theTrayIcon->setPixmap(SmallIcon("irkickoff")); + KPassivePopup::message("IRKick", i18n("The infrared system has severed its connection. Remote controls are no longer available."), SmallIcon("irkick"), theTrayIcon); + TQTimer::singleShot(1000, this, TQT_SLOT(checkLirc())); +} + +void IRKick::checkLirc() +{ + if(!theClient->isConnected()) + if(theClient->connectToLirc()) + { KPassivePopup::message("IRKick", i18n("A connection to the infrared system has been made. Remote controls may now be available."), SmallIcon("irkick"), theTrayIcon); + theTrayIcon->setPixmap(SmallIcon("irkick")); + } + else + TQTimer::singleShot(10000, this, TQT_SLOT(checkLirc())); +} + +void IRKick::flashOff() +{ + theTrayIcon->setPixmap(SmallIcon("irkick")); +} + +void IRKick::doQuit() +{ + KSimpleConfig theConfig("irkickrc"); + theConfig.setGroup("General"); + switch(KMessageBox::questionYesNoCancel(0, i18n("Should the Infrared Remote Control server start automatically when you begin TDE?"), i18n("Automatically Start?"), i18n("Start Automatically"), i18n("Do Not Start"))) + { case KMessageBox::No: theConfig.writeEntry("AutoStart", false); break; + case KMessageBox::Yes: theConfig.writeEntry("AutoStart", true); break; + case KMessageBox::Cancel: return; + } + TDEApplication::kApplication()->quit(); +} + +void IRKick::resetModes() +{ + if(theResetCount > 1) + KPassivePopup::message("IRKick", i18n("Resetting all modes."), SmallIcon("irkick"), theTrayIcon); + if(!theResetCount) + allModes.generateNulls(theClient->remotes()); + + TQStringList remotes = theClient->remotes(); + for(TQStringList::iterator i = remotes.begin(); i != remotes.end(); ++i) + { currentModes[*i] = allModes.getDefault(*i).name(); + if(theResetCount && currentModeIcons[*i]) delete currentModeIcons[*i]; + currentModeIcons[*i] = 0; + } + updateModeIcons(); + theResetCount++; +} + +void IRKick::slotReloadConfiguration() +{ + // load configuration from config file + KSimpleConfig theConfig("irkickrc"); + allActions.loadFromConfig(theConfig); + allModes.loadFromConfig(theConfig); + if(currentModes.count() && theResetCount) + resetModes(); +} + +void IRKick::slotConfigure() +{ + TDEApplication::startServiceByDesktopName("kcmlirc"); +} + +void IRKick::updateModeIcons() +{ + for(TQMap<TQString,TQString>::iterator i = currentModes.begin(); i != currentModes.end(); ++i) + { Mode mode = allModes.getMode(i.key(), i.data()); + if(mode.iconFile().isNull() || mode.iconFile().isEmpty()) + { if(currentModeIcons[i.key()]) + { delete currentModeIcons[i.key()]; + currentModeIcons[i.key()] = 0; + } + } + else + { if(!currentModeIcons[i.key()]) + { currentModeIcons[i.key()] = new IRKTrayIcon(); + currentModeIcons[i.key()]->show(); + currentModeIcons[i.key()]->contextMenu()->changeTitle(0, mode.remoteName()); + currentModeIcons[i.key()]->actionCollection()->action("file_quit")->setEnabled(false); + } + currentModeIcons[i.key()]->setPixmap(TDEIconLoader().loadIcon(mode.iconFile(), TDEIcon::Panel)); + TQToolTip::add(currentModeIcons[i.key()], mode.remoteName() + ": <b>" + mode.name() + "</b>"); + } + } +} + +bool IRKick::getPrograms(const IRAction &action, TQStringList &programs) +{ + DCOPClient *theDC = TDEApplication::dcopClient(); + programs.clear(); + + if(action.unique()) + { if(theDC->isApplicationRegistered(action.program().utf8())) + programs += action.program(); + } + else + { + TQRegExp r = TQRegExp("^" + action.program() + "-(\\d+)$"); + // find all instances... + QCStringList buf = theDC->registeredApplications(); + for(QCStringList::iterator i = buf.begin(); i != buf.end(); ++i) + { + TQString program = TQString::fromUtf8(*i); + if(program.contains(r)) + programs += program; + } + if(programs.size() > 1 && action.ifMulti() == IM_DONTSEND) + return false; + else if(programs.size() > 1 && action.ifMulti() == IM_SENDTOTOP) + { TQValueList<WId> s = KWinModule().stackingOrder(); + // go through all the (ordered) window pids + for(TQValueList<WId>::iterator i = s.fromLast(); i != s.end(); i--) + { int p = KWin::info(*i).pid; + TQString id = action.program() + "-" + TQString().setNum(p); + if(programs.contains(id)) + { programs.clear(); + programs += id; + break; + } + } + while(programs.size() > 1) programs.remove(programs.begin()); + } + else if(programs.size() > 1 && action.ifMulti() == IM_SENDTOBOTTOM) + { TQValueList<WId> s = KWinModule().stackingOrder(); + // go through all the (ordered) window pids + for(TQValueList<WId>::iterator i = s.begin(); i != s.end(); ++i) + { int p = KWin::info(*i).pid; + TQString id = action.program() + "-" + TQString().setNum(p); + if(programs.contains(id)) + { programs.clear(); + programs += id; + break; + } + } + while(programs.size() > 1) programs.remove(programs.begin()); + } + } + return true; +} + +void IRKick::executeAction(const IRAction &action) +{ + DCOPClient *theDC = TDEApplication::dcopClient(); + TQStringList programs; + + if(!getPrograms(action, programs)) return; + + // if programs.size()==0 here, then the app is definately not running. + if(action.autoStart() && !programs.size()) + { TQString sname = ProfileServer::profileServer()->getServiceName(action.program()); + if(!sname.isNull()) + { + KPassivePopup::message("IRKick", i18n("Starting <b>%1</b>...").arg(action.application()), SmallIcon("irkick"), theTrayIcon); + TDEApplication::startServiceByDesktopName(sname); + } + } + if(action.isJustStart()) return; + + if(!getPrograms(action, programs)) return; + + for(TQStringList::iterator i = programs.begin(); i != programs.end(); ++i) + { const TQString &program = *i; + if(theDC->isApplicationRegistered(program.utf8())) + { TQByteArray data; TQDataStream arg(data, IO_WriteOnly); + kdDebug() << "Sending data (" << program << ", " << action.object() << ", " << action.method().prototypeNR() << endl; + for(Arguments::const_iterator j = action.arguments().begin(); j != action.arguments().end(); ++j) + { kdDebug() << "Got argument..." << endl; + switch((*j).type()) + { case TQVariant::Int: arg << (*j).toInt(); break; + case TQVariant::CString: arg << (*j).toCString(); break; + case TQVariant::StringList: arg << (*j).toStringList(); break; + case TQVariant::UInt: arg << (*j).toUInt(); break; + case TQVariant::Bool: arg << (*j).toBool(); break; + case TQVariant::Double: arg << (*j).toDouble(); break; + default: arg << (*j).toString(); break; + } + } + theDC->send(program.utf8(), action.object().utf8(), action.method().prototypeNR().utf8(), data); + } + } +} + +void IRKick::gotMessage(const TQString &theRemote, const TQString &theButton, int theRepeatCounter) +{ + kdDebug() << "Got message: " << theRemote << ": " << theButton << " (" << theRepeatCounter << ")" << endl; + theTrayIcon->setPixmap(SmallIcon("irkickflash")); + theFlashOff->start(200, true); + if(!npApp.isNull()) + { + TQString theApp = npApp; + npApp = TQString(); + // send notifier by DCOP to npApp/npModule/npMethod(theRemote, theButton); + TQByteArray data; TQDataStream arg(data, IO_WriteOnly); + arg << theRemote << theButton; + TDEApplication::dcopClient()->send(theApp.utf8(), npModule.utf8(), npMethod.utf8(), data); + } + else + { + if(currentModes[theRemote].isNull()) currentModes[theRemote] = ""; + IRAItList l = allActions.findByModeButton(Mode(theRemote, currentModes[theRemote]), theButton); + if(!currentModes[theRemote].isEmpty()) + l += allActions.findByModeButton(Mode(theRemote, ""), theButton); + bool doBefore = true, doAfter = false; + for(IRAItList::const_iterator i = l.begin(); i != l.end(); ++i) + if((**i).isModeChange() && !theRepeatCounter) + { // mode switch + currentModes[theRemote] = (**i).modeChange(); + Mode mode = allModes.getMode(theRemote, (**i).modeChange()); + updateModeIcons(); + doBefore = (**i).doBefore(); + doAfter = (**i).doAfter(); + break; + } + + for(int after = 0; after < 2; after++) + { if(doBefore && !after || doAfter && after) + for(IRAItList::const_iterator i = l.begin(); i != l.end(); ++i) + if(!(**i).isModeChange() && ((**i).repeat() || !theRepeatCounter)) + { executeAction(**i); + } + if(!after && doAfter) + { l = allActions.findByModeButton(Mode(theRemote, currentModes[theRemote]), theButton); + if(!currentModes[theRemote].isEmpty()) + l += allActions.findByModeButton(Mode(theRemote, ""), theButton); + } + } + } +} + +void IRKick::stealNextPress(TQString app, TQString module, TQString method) +{ + npApp = app; + npModule = module; + npMethod = method; +} + +void IRKick::dontStealNextPress() +{ + npApp = TQString(); +} + +#include "irkick.moc" diff --git a/tdelirc/irkick/irkick.desktop b/tdelirc/irkick/irkick.desktop new file mode 100644 index 0000000..4f5cbb9 --- /dev/null +++ b/tdelirc/irkick/irkick.desktop @@ -0,0 +1,116 @@ +[Desktop Entry] +Type=Service +Name=IRKick +Name[sv]=IRkick +GenericName=TDE LIRC Server +GenericName[ar]=خادم LIRC لكدى +GenericName[bg]=Сървър LIRC +GenericName[br]=Servijer LIRC TDE +GenericName[bs]=TDE LIRC server +GenericName[ca]=Servidor LIRC de TDE +GenericName[cs]=LIRC server pro TDE +GenericName[cy]=Gweinydd LIRC TDE +GenericName[da]=TDE LIRC-server +GenericName[de]=TDE LIRC-Server +GenericName[el]=ΕξυπηÏετητής LIRC του TDE +GenericName[eo]=TDE LIRC-servilo +GenericName[es]=Servidor LIRC de TDE +GenericName[et]=TDE LIRC server +GenericName[eu]=TDE LIRC Zerbitzaria +GenericName[fa]=TDE LIRC کارساز +GenericName[fi]=TDE:n LIRC-palvelin +GenericName[fr]=Serveur TDE LIRC +GenericName[ga]=Freastalaà LIRC TDE +GenericName[he]=שרת ×”-LIRC של TDE +GenericName[hu]=TDE LIRC szolgáltatás +GenericName[is]=TDE LIRC þjónn +GenericName[it]=Server LIRC di TDE +GenericName[ja]=TDE LIRC サーム+GenericName[ka]=TDE LIRC სერვერი +GenericName[kk]=TDE LIRC Ñервері +GenericName[km]=ម៉ាស៊ីន​បម្រើ TDE LIRC +GenericName[lt]=TDE LIRC serveris +GenericName[nb]=TDE LIRC-tjener +GenericName[nds]=TDE LIRC-Server +GenericName[ne]=TDE LIRC सरà¥à¤à¤° +GenericName[nl]=TDE LIRC-server +GenericName[nn]=TDE LIRC-tenar +GenericName[pa]=TDE LIRC ਸਰਵਰ +GenericName[pl]=Serwer LIRC dla TDE +GenericName[pt]=Servidor de LIRC do TDE +GenericName[pt_BR]=Servidor LIRC do TDE +GenericName[ru]=Сервер LIRC Ð´Ð»Ñ TDE +GenericName[sk]=TDE LIRC server +GenericName[sl]=Strežnik TDE LIRC +GenericName[sr]=TDE-ов LIRC Ñервер +GenericName[sr@Latn]=TDE-ov LIRC server +GenericName[sv]=TDE:s LIRC-server +GenericName[ta]=TDE LIRC சேவகன௠+GenericName[tr]=TDE LIRC Sunucusu +GenericName[uk]=Сервер LIRC Ð´Ð»Ñ TDE +GenericName[uz]=TDE LIRC serveri +GenericName[uz@cyrillic]=TDE LIRC Ñервери +GenericName[zh_CN]=TDE LIRC æœåŠ¡å™¨ +GenericName[zh_TW]=TDE LIRC 伺æœå™¨ + +X-TDE-Library=irkick +X-TDE-autostart-after=panel +X-TDE-StartupNotify=false +X-DCOP-ServiceType=Unique +X-TDE-autostart-condition=irkickrc:General:AutoStart:false +Categories=Qt;TDE;Utility;X-TDE-Utilities-Peripherals; + +Exec=irkick +Icon=irkick +DocPath=irkick/index.html +Comment=TDE Linux infrared remote control server. +Comment[ar]=خادم كدى للتØكّم عن بعد بالأشعة تØت الØمراء ÙÙŠ لينكس. +Comment[bg]=Сървър за управление на диÑтанционно уÑтройÑтво Ñ Ð¸Ð½Ñ„Ñ€Ð°Ñ‡ÐµÑ€Ð²ÐµÐ½Ð¸ лъчи +Comment[bs]=TDEov server za Linux infracrveno daljinsko upravljanje (Linux Infrared Remote Control). +Comment[ca]=Servidor de control remot per infrarojos de Linux TDE. +Comment[cs]=Server dálkového ovládánà pro TDE. +Comment[cy]=Gweinydd rheolydd pell isgoch Linux TDE +Comment[da]=TDE Linux infrarød fjernbetjeningsserver. +Comment[de]=TDE Linux Infrarot Fernsteuerungsserver. +Comment[el]=ΕξυπηÏετητής τηλεχειÏιστηÏίου υπεÏÏθÏων του Linux για το TDE. +Comment[es]=Servidor de control remoto por infrarrojos de TDE +Comment[et]=TDE Linuxi infrapuna kaugjuhtimise server. +Comment[eu]=TDE Linux infrasare urruneko aginte zerbitzaria. +Comment[fa]=TDE Linuxکارساز کنترل از راه دور مادون قرمز +Comment[fi]=TDE:n Linux infrapunalla toimivien kauko-ohjainten ohjauspalvelin. +Comment[fr]=Serveur de contrôle distant infrarouge sous Linux pour TDE. +Comment[ga]=Freastalaà TDE cianrialaithe infridhearg Linux +Comment[he]=שרת לשלט רחוק עבור TDE. +Comment[hi]=केडीई लिनकà¥à¤¸ इनà¥à¤«à¥à¤°à¤¾à¤°à¥‡à¤¡ रिमोट नियंतà¥à¤°à¤£ सरà¥à¤µà¤°. +Comment[hu]=TDE Linux szolgáltatás infravörös távirányÃtók kezeléséhez +Comment[is]=TDE Linux innrauða fjarstýringarstjórnborðið +Comment[it]=Server TDE per i telecomandi ad infrarossi +Comment[ja]=TDE Linux 赤外線リモートコントãƒãƒ¼ãƒ«ã‚µãƒ¼ãƒ +Comment[ka]= TDE ლინუქსის ინფრáƒáƒ¬áƒ˜áƒ—ელი დáƒáƒ¨áƒáƒ ებული მáƒáƒ თვის სერვერი +Comment[kk]=TDE Linux инфрақызыл порт арқылы баÑқару Ñервері. +Comment[km]=ម៉ាស៊ីន​បម្រើ​បញ្ជា TDE Linux infrared ពី​ចម្ងាយ ។ +Comment[lt]=TDE Linux infraraudonųjų spindulių sÄ…sajos nuotolinio valdymo serveris +Comment[nb]=TDE Linux-tjener for infrarød fjernkontroll +Comment[nds]=TDE-Linux Infraroot-Feernbedeenkuntrullserver +Comment[ne]=TDE लिनकà¥à¤¸ अवरकà¥à¤¤ टाढाको नियनà¥à¤¤à¥à¤°à¤£ सरà¥à¤à¤° । +Comment[nl]=TDE-server voor infrarood-afstandsbediening. +Comment[nn]=TDE-tenar for infraraud fjernkontroll. +Comment[pa]=TDE ਲੀਨਕਸ ਇੰਫਰਾਰੈੱਡ ਰਿਮੋਟ ਕੰਟਰੋਲ ਸਰਵਰ ਹੈ। +Comment[pl]=Serwer obsÅ‚ugi pilotów dla TDE. +Comment[pt]=Servidor de comandos à distância por infravermelhos do TDE. +Comment[pt_BR]=servidor de controle infra-vermelho do Linux no TDE +Comment[ro]=Server de control al telecomenziilor în infraroÅŸu +Comment[ru]=Сервер ÑƒÐ¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð¸Ñ TDE через инфракраÑный порт. +Comment[sk]=TDE server pre infraÄervené vzdialené ovládanie pre Linux. +Comment[sl]=Strežnik TDE Linux za infrardeÄi daljninski upravljalnik +Comment[sr]=TDE-ов Ñервер за контролу инфрацрвених даљинÑких управљача у Linux-у. +Comment[sr@Latn]=TDE-ov server za kontrolu infracrvenih daljinskih upravljaÄa u Linux-u. +Comment[sv]=Infraröd fjärrkontrollserver +Comment[ta]=கேடிஇ லினகà¯à®¸à¯ அகசà¯à®šà®¿à®µà®ªà¯à®ªà¯ கதிர௠தொலைதூர கடà¯à®Ÿà¯à®ªà¯à®ªà®¾à®Ÿà¯à®Ÿà¯ சேவகன௠+Comment[tg]=ХидматраÑони идоракунии дурдаÑти инфраÑурхи TDE Linux. +Comment[tr]=TDE Linux kızılötesi uzaktan kontrol sunucusu. +Comment[uk]=Сервер диÑтанційного ÐºÐµÑ€ÑƒÐ²Ð°Ð½Ð½Ñ Ñ–Ð½Ñ„Ñ€Ð°Ñ‡ÐµÑ€Ð²Ð¾Ð½Ð¸Ð¼Ð¸ приÑтроÑми Ð´Ð»Ñ Linux та TDE. +Comment[uz]=Infraqizil nur bilan masofadan boshqarish serveri +Comment[uz@cyrillic]=Инфрақизил нур билан маÑофадан бошқариш Ñервери +Comment[zh_CN]=TDE Linux 红外远程控制æœåŠ¡å™¨ã€‚ +Comment[zh_TW]=TDE Linux 紅外線é™æŽ§ä¼ºæœå™¨ã€‚ diff --git a/tdelirc/irkick/irkick.h b/tdelirc/irkick/irkick.h new file mode 100644 index 0000000..786e100 --- /dev/null +++ b/tdelirc/irkick/irkick.h @@ -0,0 +1,133 @@ +/*************************************************************************** + irkick.h - Interface of the main window + copyright : (C) 2002 by Gav Wood + email : gav@kde.org + +***************************************************************************/ + +// This program is free software. + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifndef __IRKICK_H +#define __IRKICK_H + +#include <tqstring.h> + +#include <ksystemtray.h> +#include <kdedmodule.h> +#include <tdeaboutdata.h> + +#include <dcopobject.h> + +#include "modes.h" +#include "iractions.h" +#include "klircclient.h" + +class TQMouseEvent; + +class IRKTrayIcon: public KSystemTray +{ + void mousePressEvent(TQMouseEvent *e); + +public: + TDEPopupMenu* contextMenu() const { return KSystemTray::contextMenu(); } + TDEActionCollection* actionCollection() { return KSystemTray::actionCollection(); } + + IRKTrayIcon(TQWidget *parent = 0, const char *name = 0): KSystemTray(parent, name) {} +}; + +class IRKick: public TQObject, public DCOPObject +{ + Q_OBJECT +// + K_DCOP + + TQString npApp, npModule, npMethod; + TQMap<TQString, TQString> currentModes; + TQMap<TQString, IRKTrayIcon *> currentModeIcons; + IRActions allActions; + int theResetCount; + Modes allModes; + + IRKTrayIcon *theTrayIcon; + TDEAboutData *aboutData; + TQTimer *theFlashOff; + + void updateModeIcons(); + +protected: + KLircClient *theClient; + +k_dcop: + /** + * Query status of connection. + * + * @returns true if connected to lircd. + */ + virtual bool isConnected() { return theClient->isConnected(); } + + /** + * Query status of remote list. + * + * Make sure this is true before calling remotes()/buttons(...). + * + * @returns true if up to date. + */ + virtual bool haveFullList() { return theClient->haveFullList(); } + + /** + * Retrieve list of remote controls. + * + * @returns said list. + */ + virtual const TQStringList remotes() { return theClient->remotes(); } + + /** + * Retrieve list of buttons of a praticular remote control. + * + * @returns said list. + */ + virtual const TQStringList buttons(TQString theRemote) { return theClient->buttons(theRemote); } + + /** + * Sends next keypress to given application by DCOP. + * + * @param The receiving application. + * @param The receiving application module. + * @param The method name. Must have two TQString parameters. + */ + virtual void stealNextPress(TQString app, TQString module, TQString method); + + /** + * Cancels the proceedings of the previous stealNextPress call, if any. + */ + virtual void dontStealNextPress(); + + /** + * Reloads configuration from file(s) + */ + virtual void reloadConfiguration() { slotReloadConfiguration(); } + +private slots: + void gotMessage(const TQString &theRemote, const TQString &theButton, int theRepeatCounter); + void resetModes(); + void doQuit(); + void flashOff(); + void checkLirc(); + + void slotConfigure(); + void slotReloadConfiguration(); + void slotClosed(); +private: + void executeAction(const IRAction &action); + bool getPrograms(const IRAction &action, TQStringList &populous); + +public: + IRKick(const TQCString &obj); + virtual ~IRKick(); +}; + +#endif diff --git a/tdelirc/irkick/irkick.project b/tdelirc/irkick/irkick.project new file mode 100644 index 0000000..b486441 --- /dev/null +++ b/tdelirc/irkick/irkick.project @@ -0,0 +1,12 @@ +# KDE Config File +[Desktop Entry] +Encoding=UTF-8 +Type=Application +Exec=irkick -caption "%c" %i %m +Icon=irkick.png +DocPath=irkick/index.html +Comment= +Comment[de]= +Terminal=0 +Name=IRKick +Name[de]=IRKick diff --git a/tdelirc/irkick/kdedmodule_stub.h b/tdelirc/irkick/kdedmodule_stub.h new file mode 100644 index 0000000..57542d2 --- /dev/null +++ b/tdelirc/irkick/kdedmodule_stub.h @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** DCOP Stub Definition created by dcopidl2cpp from kdedmodule.kidl +** +** WARNING! All changes made in this file will be lost! +** +*****************************************************************************/ + +/* This is a machine-generated file, and may be distributed under the GPL + licence, as described in tdelibs/COPYING. +*/ + +#ifndef __KDEDMODULE_STUB__ +#define __KDEDMODULE_STUB__ + +#include <dcopstub.h> +#include <tqobject.h> +#include <dcopobject.h> +#include <dcopref.h> +#include <ksharedptr.h> + + +class KDEDModule_stub : virtual public DCOPStub +{ +public: + KDEDModule_stub( const TQCString& app, const TQCString& id ); + KDEDModule_stub( DCOPClient* client, const TQCString& app, const TQCString& id ); + explicit KDEDModule_stub( const DCOPRef& ref ); +protected: + KDEDModule_stub() : DCOPStub( never_use ) {}; +}; + + +#endif diff --git a/tdelirc/irkick/klircclient.cpp b/tdelirc/irkick/klircclient.cpp new file mode 100644 index 0000000..b7051fc --- /dev/null +++ b/tdelirc/irkick/klircclient.cpp @@ -0,0 +1,241 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: (C) 2002 by Malte Starostik +// Adaption : Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// + +#include <unistd.h> +#include <fcntl.h> +#include <cstring> +#include <sys/un.h> +#include <sys/socket.h> +#include <errno.h> + +#include <tqwidget.h> +#include <tqdialog.h> +#include <tqtooltip.h> +#include <tqsocket.h> +#include <tqsocketnotifier.h> +#include <tqfile.h> + +#include <tdeapplication.h> +#include <ksystemtray.h> +#include <kiconloader.h> +#include <kpassivepopup.h> +#include <tdemessagebox.h> +#include <tdepopupmenu.h> +#include <kdebug.h> +#include <tdelocale.h> +#include <tdeaboutdialog.h> +#include <tdeabouttde.h> + +#include <dcopclient.h> +#include <dcopref.h> + +#include "klircclient.h" + + +KLircClient::KLircClient(TQWidget *parent, const char *name) : TQObject(parent, name), theSocket(0), listIsUpToDate(false) +{ + connectToLirc(); +} + +bool KLircClient::connectToLirc() +{ + int sock = ::socket(PF_UNIX, SOCK_STREAM, 0); + if(sock == -1) return false; + + sockaddr_un addr; + addr.sun_family = AF_UNIX; + strcpy(addr.sun_path, "/dev/lircd"); + if(::connect(sock, (struct sockaddr *)(&addr), sizeof(addr)) == -1) + { ::close(sock); + // in case of mandrake... + strcpy(addr.sun_path, "/tmp/.lircd"); + if(::connect(sock, (struct sockaddr *)(&addr), sizeof(addr)) == -1) + { ::close(sock); + return false; + } + } + + theSocket = new TQSocket; + theSocket->setSocket(sock); + connect(theSocket, TQT_SIGNAL(readyRead()), TQT_SLOT(slotRead())); + connect(theSocket, TQT_SIGNAL(connectionClosed()), TQT_SLOT(slotClosed())); + updateRemotes(); + return true; +} + +KLircClient::~KLircClient() +{ +// if(theSocket) + delete theSocket; +} + +void KLircClient::slotClosed() +{ + delete theSocket; + theSocket = 0; + emit connectionClosed(); +} + +const TQStringList KLircClient::remotes() const +{ + TQStringList remotes; + for(TQMap<TQString, TQStringList>::ConstIterator i = theRemotes.begin(); i != theRemotes.end(); ++i) + remotes.append(i.key()); + remotes.sort(); + return remotes; +} + +const TQStringList KLircClient::buttons(const TQString &theRemote) const +{ + return theRemotes[theRemote]; +} + +void KLircClient::slotRead() +{ + while (theSocket->bytesAvailable()) + { + TQString line = readLine(); + if (line == "BEGIN") + { + // BEGIN + // <command> + // [SUCCESS|ERROR] + // [DATA + // n + // n lines of data] + // END + line = readLine(); + if (line == "SIGHUP") + { + // Configuration changed + do line = readLine(); + while (!line.isEmpty() && line != "END"); + updateRemotes(); + return; + } + else if (line == "LIST") + { + // remote control list + if (readLine() != "SUCCESS" || readLine() != "DATA") + { + do line = readLine(); + while (!line.isEmpty() && line != "END"); + return; + } + TQStringList remotes; + int count = readLine().toInt(); + for (int i = 0; i < count; ++i) + remotes.append(readLine()); + do line = readLine(); + while (!line.isEmpty() && line != "END"); + if (line.isEmpty()) + return; // abort on corrupt data + for (TQStringList::ConstIterator it = remotes.begin(); it != remotes.end(); ++it) + sendCommand("LIST " + *it); + return; + } + else if (line.left(4) == "LIST") + { + // button list + if (readLine() != "SUCCESS" || readLine() != "DATA") + { + do line = readLine(); + while (!line.isEmpty() && line != "END"); + return; + } + TQString remote = line.mid(5); + TQStringList buttons; + int count = readLine().toInt(); + for (int i = 0; i < count; ++i) + { + // <code> <name> + TQString btn = readLine().mid(17); + if(btn.isNull()) break; + if(btn.startsWith("'") && btn.endsWith("'")) + btn = btn.mid(1, btn.length() - 2); + buttons.append(btn); + } + theRemotes.insert(remote, buttons); + } + do line = readLine(); + while (!line.isEmpty() && line != "END"); + listIsUpToDate = true; + emit remotesRead(); + } + else + { + // <code> <repeat> <button name> <remote control name> + line.remove(0, 17); // strip code + int pos = line.find(' '); + if (pos < 0) return; + bool ok; + int repeat = line.left(pos).toInt(&ok, 16); + if (!ok) return; + line.remove(0, pos + 1); + + pos = line.find(' '); + if (pos < 0) return; + TQString btn = line.left(pos); + if(btn.startsWith("'") && btn.endsWith("'")) + btn = btn.mid(1, btn.length() - 2); + line.remove(0, pos + 1); + + emit commandReceived(line, btn, repeat); + } + } +} + +void KLircClient::updateRemotes() +{ + listIsUpToDate = false; + theRemotes.clear(); + sendCommand("LIST"); +} + +bool KLircClient::isConnected() const +{ + if(!theSocket) return false; + return theSocket->state() == TQSocket::Connected; +} + +bool KLircClient::haveFullList() const +{ + return listIsUpToDate; +} + +const TQString KLircClient::readLine() +{ + if (!theSocket->canReadLine()) + { bool timeout; + // FIXME: possible race condition - + // more might have arrived between canReadLine and waitForMore + theSocket->waitForMore(500, &timeout); + if (timeout) + { // something's wrong. there ain't no line comin! + return TQString(); + } + } + TQString line = theSocket->readLine(); + line.truncate(line.length() - 1); + return line; +} + +void KLircClient::sendCommand(const TQString &command) +{ + TQString cmd = command + "\n"; + theSocket->writeBlock(TQFile::encodeName( cmd ), cmd.length()); +} + + +#include "klircclient.moc" diff --git a/tdelirc/irkick/klircclient.h b/tdelirc/irkick/klircclient.h new file mode 100644 index 0000000..3af4637 --- /dev/null +++ b/tdelirc/irkick/klircclient.h @@ -0,0 +1,115 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef KLIRCCLIENT_H +#define KLIRCCLIENT_H + +#include <tqobject.h> +#include <tqmap.h> +#include <tqstring.h> +#include <tqstringlist.h> + +class TQSocket; +class TQSocketNotifier; + +/** +@author Malte Starostik +@author Gav Wood +*/ + +class KLircClient: public TQObject +{ + Q_OBJECT + + +private: + struct lirc_config *theConfig; + TQSocket *theSocket; + TQSocketNotifier *theNotifier; + TQMap<TQString, TQStringList> theRemotes; + bool listIsUpToDate; + + void updateRemotes(); + void sendCommand(const TQString &command); + const TQString readLine(); + +private slots: + void slotRead(); + void slotClosed(); + +signals: + /** + * Emitted when the list of controls / buttons was completely read + */ + void remotesRead(); + + /** + * Emitted when a IR command was received + * + * The arguments are the name of the remote control used, + * the name of the button pressed and the repeat counter. + * + * The signal is emitted repeatedly as long as the button + * on the remote control remains pressed. + * The repeat counter starts with 0 and increases + * every time this signal is emitted. + */ + void commandReceived(const TQString &remote, const TQString &button, int repeatCounter); + + /** + * Emitted when the Lirc connection is closed. + */ + void connectionClosed(); + +public: + /** + * Query status of connection. + * + * @returns true if connected to lircd. + */ + bool isConnected() const; + + /** + * Query status of remote list. + * + * Make sure this is true before calling remotes()/buttons(...). + * + * @returns true if up to date. + */ + bool haveFullList() const; + + /** + * Retrieve list of remote controls. + * + * @returns said list. + */ + const TQStringList remotes() const; + + /** + * Retrieve list of buttons of a praticular remote control. + * + * @returns said list. + */ + const TQStringList buttons(const TQString &theRemote) const; + + /** + * Connects to lirc. + * + * @returns true if connection is made. + */ + bool connectToLirc(); + + KLircClient(TQWidget *parent = 0, const char *name = 0); + ~KLircClient(); +}; + +#endif diff --git a/tdelirc/irkick/main.cpp b/tdelirc/irkick/main.cpp new file mode 100644 index 0000000..5d5a791 --- /dev/null +++ b/tdelirc/irkick/main.cpp @@ -0,0 +1,39 @@ +/*************************************************************************** + main.cpp - Implementation of the main window + ------------------- + copyright : (C) 2002 by Gav Wood + email : gav@kde.org +***************************************************************************/ + +// This program is free software. + +#include <tdelocale.h> +#include <tdecmdlineargs.h> +#include <twin.h> +#include <tdeaboutdata.h> +#include <tdeglobal.h> +#include <kdebug.h> +#include <kuniqueapplication.h> + +#include "irkick.h" + +extern "C" KDE_EXPORT int kdemain(int argc, char *argv[]) +{ + TDEAboutData *aboutData = new TDEAboutData("irkick", I18N_NOOP("IRKick"), VERSION, I18N_NOOP("The TDE Infrared Remote Control Server"), TDEAboutData::License_GPL, "(c) 2003, Gav Wood", 0, 0, "gav@kde.org"); + aboutData->addAuthor("Gav Wood", I18N_NOOP("Author"), "gav@kde.org", "http://www.indigoarchive.net/gav/"); + aboutData->addCredit("Malte Starostik", I18N_NOOP("Original LIRC interface code"), "malte.starostik@t-online.de"); + aboutData->addCredit("Dirk Ziegelmeier", I18N_NOOP("Ideas, concept code"), "dirk@ziegelmeier.net"); + aboutData->addCredit("Zsolt Rizsanyi", I18N_NOOP("Random patches"), "rizsanyi@myrealbox.com"); + aboutData->addCredit("Antonio Larrosa Jiménez", I18N_NOOP("Ideas"), "larrosa@kde.org"); + + TDECmdLineArgs::init( argc, argv, aboutData ); + KUniqueApplication::addCmdLineOptions(); + KUniqueApplication app; + TDEGlobal::locale()->insertCatalogue( "tdelirc" ); + app.disableSessionManagement(); + IRKick *theIRKick = new IRKick("IRKick"); + + int ret = app.exec(); + delete theIRKick; + return ret; +} diff --git a/tdelirc/kcmlirc/CMakeLists.txt b/tdelirc/kcmlirc/CMakeLists.txt new file mode 100644 index 0000000..7761e97 --- /dev/null +++ b/tdelirc/kcmlirc/CMakeLists.txt @@ -0,0 +1,47 @@ +################################################# +# +# (C) 2012 Golubev Alexander +# fatzer2 (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR}/tdelirc/irkick + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/tdelirc/irkick + ${CMAKE_SOURCE_DIR}/tdelirc/tdelirc + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} + ${CMAKE_BINARY_DIR}/tdelirc/tdelirc +) + + +##### kcm_kcmlirc (kpart) ####################### + +tde_add_kpart( kcm_kcmlirc AUTOMOC + SOURCES selectprofile.ui newmode.ui + kcmlircbase.ui kcmlirc.cpp addactionbase.ui + addaction.cpp kcmlirc.skel editactionbase.ui + editmodebase.ui editmode.cpp editaction.cpp + modeslist.cpp + LINK tdelirc-static tdeui-shared tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) + + +##### other data ################################ + +install( FILES kcmlirc.desktop + DESTINATION ${XDG_APPS_INSTALL_DIR} +) + diff --git a/tdelirc/kcmlirc/Makefile.am b/tdelirc/kcmlirc/Makefile.am new file mode 100644 index 0000000..53eb7af --- /dev/null +++ b/tdelirc/kcmlirc/Makefile.am @@ -0,0 +1,15 @@ +INCLUDES = -I../irkick -I$(srcdir)/../irkick -I$(srcdir)/../tdelirc $(all_includes) +METASOURCES = AUTO + +# Install this plugin in the KDE modules directory +kde_module_LTLIBRARIES = kcm_kcmlirc.la + +noinst_HEADERS = kcmlirc.h addaction.h addactionbase.h +kcm_kcmlirc_la_SOURCES = selectprofile.ui newmode.ui kcmlircbase.ui kcmlirc.cpp addactionbase.ui addaction.cpp kcmlirc.skel editactionbase.ui editmodebase.ui editmode.cpp editaction.cpp modeslist.cpp +kcm_kcmlirc_la_LIBADD = $(LIB_TDEUI) $(LIB_TDEFILE) ../tdelirc/libtdelirc.la +kcm_kcmlirc_la_LDFLAGS = -module -avoid-version $(all_libraries) -no-undefined + +xdg_apps_DATA = kcmlirc.desktop + +messages: rc.cpp + $(XGETTEXT) *.cpp *.h -o $(podir)/kcmlirc.pot diff --git a/tdelirc/kcmlirc/addaction.cpp b/tdelirc/kcmlirc/addaction.cpp new file mode 100644 index 0000000..8a87775 --- /dev/null +++ b/tdelirc/kcmlirc/addaction.cpp @@ -0,0 +1,375 @@ +/*************************************************************************** + * Copyright (C) 2003 by Gav Wood * + * gav@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#include <tqregexp.h> +#include <tqlabel.h> +#include <tqradiobutton.h> +#include <tqwidgetstack.h> +#include <tqcheckbox.h> +#include <tqbuttongroup.h> + +#include <kdebug.h> +#include <klineedit.h> +#include <tdelistview.h> +#include <tdeapplication.h> +#include <tdemessagebox.h> +#include <knuminput.h> +#include <keditlistbox.h> +#include <tdelocale.h> + +#include <dcopclient.h> +#include <irkick_stub.h> + +#include "prototype.h" +#include "addaction.h" +#include "profileserver.h" +#include "remoteserver.h" + +AddAction::AddAction(TQWidget *parent, const char *name, const Mode &mode): AddActionBase(parent, name), theMode(mode) +{ + connect(this, TQT_SIGNAL( selected(const TQString &) ), TQT_SLOT( updateForPageChange() )); + connect(this, TQT_SIGNAL( selected(const TQString &) ), TQT_SLOT( slotCorrectPage() )); + curPage = 0; + updateProfiles(); + updateButtons(); + updateObjects(); + updateProfileFunctions(); +} + +AddAction::~AddAction() +{ +} + + +void AddAction::slotNextParam() +{ + // TODO: go on to next parameter +} + +void AddAction::slotModeSelected() +{ + theSwitchMode->setChecked(true); +} + +void AddAction::slotCorrectPage() +{ + int lastPage = curPage; + curPage = indexOf(currentPage()); + + if(curPage == 2 && theUseProfile->isChecked()) + showPage(((TQWizard *)this)->page(lastPage > 1 ? 1 : 3)); + if((curPage == 2 || curPage == 5) && theChangeMode->isChecked()) + showPage(((TQWizard *)this)->page(lastPage > 1 ? 1 : 6)); + + if(curPage == 3 && theUseDCOP->isChecked()) + showPage(((TQWizard *)this)->page(lastPage == 4 ? 2 : 4)); + + if(curPage == 4 && ( + (theUseDCOP->isChecked() && theFunctions->currentItem() && !Prototype(theFunctions->currentItem()->text(2)).count()) || + (theUseProfile->isChecked() && (theProfileFunctions->currentItem() && !theProfileFunctions->currentItem()->text(1).toInt() || theJustStart->isChecked())) + )) + showPage(((TQWizard *)this)->page(lastPage == 5 ? (theUseDCOP->isChecked() ? 2 : 3) : 5)); +} + +void AddAction::requestNextPress() +{ + IRKick_stub("irkick", "IRKick").stealNextPress(DCOPClient::mainClient()->appId(), "KCMLirc", "gotButton(TQString, TQString)"); +} + +void AddAction::cancelRequest() +{ + IRKick_stub("irkick", "IRKick").dontStealNextPress(); +} + +void AddAction::updateButton(const TQString &remote, const TQString &button) +{ + if(theMode.remote() == remote) + { // note this isn't the "correct" way of doing it; really i should iterate throughg the items and try to find the item which when put through buttonMap[item] returns the current button name. but i cant be arsed. + theButtons->setCurrentItem(theButtons->findItem(RemoteServer::remoteServer()->getButtonName(remote, button), 0)); + theButtons->ensureItemVisible(theButtons->findItem(RemoteServer::remoteServer()->getButtonName(remote, button), 0)); + } + else + KMessageBox::error(this, i18n( "You did not select a mode of that remote control. Please use %1, " + "or revert back to select a different mode." ).arg( theMode.remoteName() ), + i18n( "Incorrect Remote Control Detected" )); + + if(indexOf(currentPage()) == 1) + requestNextPress(); +} + +void AddAction::updateButtons() +{ + theButtons->clear(); + buttonMap.clear(); + IRKick_stub IRKick("irkick", "IRKick"); + TQStringList buttons = IRKick.buttons(theMode.remote()); + for(TQStringList::iterator j = buttons.begin(); j != buttons.end(); ++j) + buttonMap[new TQListViewItem(theButtons, RemoteServer::remoteServer()->getButtonName(theMode.remote(), *j))] = *j; +} + +void AddAction::updateForPageChange() +{ + if(indexOf(currentPage()) == 1) requestNextPress(); else cancelRequest(); + switch(indexOf(currentPage())) + { case 0: break; + case 1: break; + case 2: break; + case 3: break; + case 4: break; + } + updateButtonStates(); +} + +void AddAction::updateButtonStates() +{ + switch(indexOf(currentPage())) + { case 0: setNextEnabled(currentPage(), theProfiles->currentItem() != 0 || !theUseProfile->isChecked()); break; + case 1: setNextEnabled(currentPage(), theButtons->currentItem() != 0); break; + case 2: setNextEnabled(currentPage(), theFunctions->currentItem() != 0); break; + case 3: setNextEnabled(currentPage(), theProfileFunctions->currentItem() != 0 || theJustStart->isChecked()); break; + case 4: setNextEnabled(currentPage(), true); break; + case 5: setNextEnabled(currentPage(), false); setFinishEnabled(currentPage(), true); break; + case 6: setNextEnabled(currentPage(), false); setFinishEnabled(currentPage(), theModes->currentItem() || !theSwitchMode->isChecked()); break; + } +} + +const TQStringList AddAction::getFunctions(const TQString app, const TQString obj) +{ + TQStringList ret; + DCOPClient *theClient = TDEApplication::kApplication()->dcopClient(); + QCStringList theApps = theClient->remoteFunctions(app.utf8(), obj.utf8()); + for(QCStringList::iterator i = theApps.begin(); i != theApps.end(); ++i) + if( *i != "QCStringList interfaces()" && + *i != "QCStringList functions()" && + *i != "QCStringList objects()" && + *i != "QCStringList find(TQCString)" ) + ret += TQString::fromUtf8(*i); + return ret; +} + +void AddAction::updateProfiles() +{ + ProfileServer *theServer = ProfileServer::profileServer(); + theProfiles->clear(); + profileMap.clear(); + + TQDict<Profile> dict = theServer->profiles(); + TQDictIterator<Profile> i(dict); + for(; i.current(); ++i) + profileMap[new TQListViewItem(theProfiles, i.current()->name())] = i.currentKey(); +} + +void AddAction::updateOptions() +{ + IfMulti im; + if(theUseProfile->isChecked()) + { + ProfileServer *theServer = ProfileServer::profileServer(); + if(!theProfiles->currentItem()) return; + const Profile *p = theServer->profiles()[profileMap[theProfiles->currentItem()]]; + im = p->ifMulti(); + isUnique = p->unique(); + } + else if(theUseDCOP->isChecked()) + { + if(!theObjects->selectedItem()) return; + TQListViewItem* i = theObjects->selectedItem()->parent(); + if(!i) return; + isUnique = uniqueProgramMap[i]; + TQRegExp r("(.*)-[0-9]+"); + program = r.exactMatch(nameProgramMap[i]) ? r.cap(1) : nameProgramMap[i]; + im = IM_DONTSEND; + } + else return; + + theIMLabel->setEnabled(!isUnique); + theIMGroup->setEnabled(!isUnique); + theIMLine->setEnabled(!isUnique); + theIMTop->setEnabled(!isUnique); + theDontSend->setEnabled(!isUnique); + theSendToBottom->setEnabled(!isUnique); + theSendToTop->setEnabled(!isUnique); + theSendToAll->setEnabled(!isUnique); + switch(im) + { case IM_DONTSEND: theDontSend->setChecked(true); break; + case IM_SENDTOTOP: theSendToTop->setChecked(true); break; + case IM_SENDTOBOTTOM: theSendToBottom->setChecked(true); break; + case IM_SENDTOALL: theSendToAll->setChecked(true); break; + } +} + +void AddAction::updateProfileFunctions() +{ + ProfileServer *theServer = ProfileServer::profileServer(); + theProfileFunctions->clear(); + profileFunctionMap.clear(); + if(!theProfiles->currentItem()) return; + + const Profile *p = theServer->profiles()[profileMap[theProfiles->currentItem()]]; + TQDict<ProfileAction> dict = p->actions(); + for(TQDictIterator<ProfileAction> i(dict); i.current(); ++i) + profileFunctionMap[new TQListViewItem(theProfileFunctions, i.current()->name(), TQString().setNum(i.current()->arguments().count()), i.current()->comment())] = i.currentKey(); + updateParameters(); + updateOptions(); +} + +void AddAction::updateParameters() +{ + theParameters->clear(); + theArguments.clear(); + if(theUseDCOP->isChecked() && theFunctions->currentItem()) + { + Prototype p(theFunctions->currentItem()->text(2)); + for(unsigned k = 0; k < p.count(); k++) + { new TDEListViewItem(theParameters, p.name(k).isEmpty() ? i18n( "<anonymous>" ) : p.name(k), "", p.type(k), TQString().setNum(k + 1)); + theArguments.append(TQVariant("")); + theArguments.back().cast(TQVariant::nameToType(p.type(k).utf8())); + } + } + else if(theUseProfile->isChecked() && theProfiles->currentItem()) + { + ProfileServer *theServer = ProfileServer::profileServer(); + + if(!theProfiles->currentItem()) return; + if(!theProfileFunctions->currentItem()) return; + const Profile *p = theServer->profiles()[profileMap[theProfiles->currentItem()]]; + const ProfileAction *pa = p->actions()[profileFunctionMap[theProfileFunctions->currentItem()]]; + + int index = 1; + for(TQValueList<ProfileActionArgument>::const_iterator i = pa->arguments().begin(); i != pa->arguments().end(); ++i, index++) + { theArguments.append(TQVariant((*i).getDefault())); + theArguments.back().cast(TQVariant::nameToType((*i).type().utf8())); + new TQListViewItem(theParameters, (*i).comment(), theArguments.back().toString(), (*i).type(), TQString().setNum(index)); + } + + // quicky update options too... + theRepeat->setChecked(pa->repeat()); + theAutoStart->setChecked(pa->autoStart()); + } + + updateParameter(); +} + +void AddAction::updateParameter() +{ + if(theParameters->currentItem()) + { TQString type = theParameters->currentItem()->text(2); + int index = theParameters->currentItem()->text(3).toInt() - 1; + if(type.find("int") != -1 || type.find("short") != -1 || type.find("long") != -1) + { theValue->raiseWidget(2); + theValueIntNumInput->setValue(theArguments[index].toInt()); + } + else if(type.find("double") != -1 || type.find("float") != -1) + { theValue->raiseWidget(3); + theValueDoubleNumInput->setValue(theArguments[index].toDouble()); + } + else if(type.find("bool") != -1) + { theValue->raiseWidget(1); + theValueCheckBox->setChecked(theArguments[index].toBool()); + } + else if(type.find(TQSTRINGLIST_OBJECT_NAME_STRING) != -1) + { theValue->raiseWidget(4); + TQStringList backup = theArguments[index].toStringList(); + // backup needed because calling clear will kill what ever has been saved. + theValueEditListBox->clear(); + theValueEditListBox->insertStringList(backup); + theArguments[index].asStringList() = backup; + } + else + { theValue->raiseWidget(0); + theValueLineEdit->setText(theArguments[index].toString()); + } + theCurParameter->setText(theParameters->currentItem()->text(0)); + theCurParameter->setEnabled(true); + theValue->setEnabled(true); + } + else + { theCurParameter->setText(""); + theValueLineEdit->setText(""); + theValueCheckBox->setChecked(false); + theValueIntNumInput->setValue(0); + theValueDoubleNumInput->setValue(0.0); + theCurParameter->setEnabled(false); + theValue->setEnabled(false); + } +} + +// called when the textbox/checkbox/whatever changes value +void AddAction::slotParameterChanged() +{ + if(!theParameters->currentItem()) return; + int index = theParameters->currentItem()->text(3).toInt() - 1; + TQString type = theParameters->currentItem()->text(2); + if(type.find("int") != -1 || type.find("short") != -1 || type.find("long") != -1) + theArguments[index].asInt() = theValueIntNumInput->value(); + else if(type.find("double") != -1 || type.find("float") != -1) + theArguments[index].asDouble() = theValueDoubleNumInput->value(); + else if(type.find("bool") != -1) + theArguments[index].asBool() = theValueCheckBox->isChecked(); + else if(type.find(TQSTRINGLIST_OBJECT_NAME_STRING) != -1) + theArguments[index].asStringList() = theValueEditListBox->items(); + else + theArguments[index].asString() = theValueLineEdit->text(); + + theArguments[theParameters->currentItem()->text(3).toInt() - 1].cast(TQVariant::nameToType(theParameters->currentItem()->text(2).utf8())); + updateArgument(theParameters->currentItem()); +} + +// takes theArguments[theIndex] and puts it into theItem +void AddAction::updateArgument(TQListViewItem *theItem) +{ + theItem->setText(1, theArguments[theItem->text(3).toInt() - 1].toString()); +} + +void AddAction::updateObjects() +{ + TQStringList names; + theObjects->clear(); + uniqueProgramMap.clear(); + nameProgramMap.clear(); + + DCOPClient *theClient = TDEApplication::kApplication()->dcopClient(); + QCStringList theApps = theClient->registeredApplications(); + for(QCStringList::iterator i = theApps.begin(); i != theApps.end(); ++i) + { + if(!TQString(*i).find("anonymous")) continue; + if(!TQString(*i).find(i18n( "anonymous" ))) continue; + TQRegExp r("(.*)-[0-9]+"); + TQString name = r.exactMatch(TQString(*i)) ? r.cap(1) : *i; + if(names.contains(name)) continue; + names += name; + + TDEListViewItem *a = new TDEListViewItem(theObjects, name); + uniqueProgramMap[a] = name == TQString(*i); + nameProgramMap[a] = *i; + + QCStringList theObjects = theClient->remoteObjects(*i); + for(QCStringList::iterator j = theObjects.begin(); j != theObjects.end(); ++j) + if(*j != "tdesycoca" && *j != "qt")// && getFunctions(*i, *j).count()) + new TDEListViewItem(a, *j); + } + updateFunctions(); +} + +void AddAction::updateFunctions() +{ + theFunctions->clear(); + if(theObjects->currentItem() && theObjects->currentItem()->parent()) + { TQStringList functions = getFunctions(nameProgramMap[theObjects->currentItem()->parent()], theObjects->currentItem()->text(0)); + for(TQStringList::iterator i = functions.begin(); i != functions.end(); ++i) + { Prototype p((TQString)(*i)); + new TDEListViewItem(theFunctions, p.name(), p.argumentList(), *i); + } + } + updateOptions(); +} + + +#include "addaction.moc" diff --git a/tdelirc/kcmlirc/addaction.h b/tdelirc/kcmlirc/addaction.h new file mode 100644 index 0000000..3a3f22f --- /dev/null +++ b/tdelirc/kcmlirc/addaction.h @@ -0,0 +1,74 @@ +/*************************************************************************** + * Copyright (C) 2003 by Gav Wood * + * gav@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ +#ifndef ADDACTION_H +#define ADDACTION_H + +#include <tqvaluelist.h> +#include <tqpair.h> + +#include <addactionbase.h> + +#include "mode.h" +#include "arguments.h" + +/** +@author Gav Wood +*/ + +class TQListViewItem; + +class AddAction : public AddActionBase +{ + Q_OBJECT + + + int curPage; + Mode theMode; + +public slots: + virtual void slotCorrectPage(); + virtual void slotModeSelected(); + virtual void slotNextParam(); + virtual void slotParameterChanged(); + + // connected to KCMLirc class to receive DCOP calls to tell it what button has been pressed + virtual void updateForPageChange(); + virtual void updateButton(const TQString &remote, const TQString &button); + virtual void updateButtons(); + virtual void updateFunctions(); + virtual void updateObjects(); + virtual void updateButtonStates(); + virtual void updateParameters(); + virtual void updateParameter(); + virtual void updateProfiles(); + virtual void updateProfileFunctions(); + virtual void updateOptions(); + +public: + Arguments theArguments; + TQString program; + bool isUnique; + + static const TQStringList getFunctions(const TQString app, const TQString obj); + void updateArgument(TQListViewItem *theItem); + void requestNextPress(); + void cancelRequest(); + + TQMap<TQListViewItem *, TQString> profileMap; + TQMap<TQListViewItem *, TQString> profileFunctionMap; + TQMap<TQListViewItem *, TQString> buttonMap; + TQMap<TQListViewItem *, bool> uniqueProgramMap; + TQMap<TQListViewItem *, TQString> nameProgramMap; + + AddAction(TQWidget *parent, const char *name, const Mode &mode); + ~AddAction(); +}; + +#endif diff --git a/tdelirc/kcmlirc/addactionbase.ui b/tdelirc/kcmlirc/addactionbase.ui new file mode 100644 index 0000000..dfb6f12 --- /dev/null +++ b/tdelirc/kcmlirc/addactionbase.ui @@ -0,0 +1,1608 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>AddActionBase</class> +<author>Gav Wood</author> +<widget class="TQWizard"> + <property name="name"> + <cstring>AddActionBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>723</width> + <height>593</height> + </rect> + </property> + <property name="caption"> + <string>Add Action</string> + </property> + <widget class="TQWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="title"> + <string>Select Action to Carry Out on Button Press</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <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>1</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="title"> + <string></string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>theUseProfile</cstring> + </property> + <property name="text"> + <string>I wish to select an &application below for usage:</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout14</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer13</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>81</width> + <height>31</height> + </size> + </property> + </spacer> + <widget class="TDEListView"> + <column> + <property name="text"> + <string>Applications</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>theProfiles</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>3</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer14</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>101</width> + <height>31</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer11</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>311</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>theUseDCOP</cstring> + </property> + <property name="text"> + <string>I wish to manually select a &function from a running program</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer12</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>321</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>theChangeMode</cstring> + </property> + <property name="text"> + <string>I wish to change the remote control's &mode</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>20</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </grid> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="title"> + <string>Select Button to Configure</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>theButtonText</cstring> + </property> + <property name="text"> + <string>You are attempting to configure an action for a button on [remote] (in mode [mode]). Press a button on this remote control or select from the list.</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter</set> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout6</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer12_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>110</width> + <height>41</height> + </size> + </property> + </spacer> + <widget class="TDEListView"> + <column> + <property name="text"> + <string>Button</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>theButtons</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>2</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer5</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>110</width> + <height>31</height> + </size> + </property> + </spacer> + </hbox> + </widget> + </vbox> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="title"> + <string>Select Program Function</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQSplitter"> + <property name="name"> + <cstring>splitter8</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <widget class="TDEListView"> + <column> + <property name="text"> + <string>Program</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <item> + <property name="text"> + <string>IR Kick</string> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + </item> + <item> + <property name="text"> + <string>Xine</string> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + </item> + <item> + <property name="text"> + <string>kicker</string> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + <item> + <property name="text"> + <string>kicker</string> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + </item> + </item> + <item> + <property name="text"> + <string>noatun</string> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + <item> + <property name="text"> + <string>Marquis</string> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + </item> + <item> + <property name="text"> + <string>Noatun</string> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + </item> + <item> + <property name="text"> + <string>noatun</string> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + </item> + </item> + <property name="name"> + <cstring>theObjects</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + <property name="rootIsDecorated"> + <bool>true</bool> + </property> + <property name="fullWidth"> + <bool>false</bool> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout13</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="TDEListView"> + <column> + <property name="text"> + <string>Function</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Parameter</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Prototype</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>theFunctions</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </vbox> + </widget> + </widget> + </vbox> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="title"> + <string>Select Program Function</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQButtonGroup" row="0" column="0"> + <property name="name"> + <cstring>buttonGroup4</cstring> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="title"> + <string></string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>theNotJustStart</cstring> + </property> + <property name="text"> + <string>&Perform a function in the application:</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout37</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer39</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>61</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="TDEListView"> + <column> + <property name="text"> + <string>Function</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Options</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Description</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>theProfileFunctions</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>7</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>theJustStart</cstring> + </property> + <property name="text"> + <string>&Just start the application. Do not do anything else.</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer40</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>81</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </grid> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="title"> + <string>Populate Parameters</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TDEListView"> + <column> + <property name="text"> + <string>Option Description</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Value</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Type</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Place</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>theParameters</cstring> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout35</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout34</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer32</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>111</height> + </size> + </property> + </spacer> + <widget class="TQLabel"> + <property name="name"> + <cstring>theCurParameter</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Parameter:</string> + </property> + </widget> + </vbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer27</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>146</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="TQWidgetStack"> + <property name="name"> + <cstring>theValue</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <widget class="TQWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>0</number> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <spacer> + <property name="name"> + <cstring>spacer28</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>61</height> + </size> + </property> + </spacer> + <widget class="KLineEdit"> + <property name="name"> + <cstring>theValueLineEdit</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + </widget> + </vbox> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>1</number> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <spacer> + <property name="name"> + <cstring>spacer29</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>61</height> + </size> + </property> + </spacer> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>theValueCheckBox</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </vbox> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>2</number> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <spacer> + <property name="name"> + <cstring>spacer30</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>61</height> + </size> + </property> + </spacer> + <widget class="KIntNumInput"> + <property name="name"> + <cstring>theValueIntNumInput</cstring> + </property> + </widget> + </vbox> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>3</number> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <spacer> + <property name="name"> + <cstring>spacer31</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>51</height> + </size> + </property> + </spacer> + <widget class="KDoubleNumInput"> + <property name="name"> + <cstring>theValueDoubleNumInput</cstring> + </property> + </widget> + </vbox> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>4</number> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="KEditListBox" row="0" column="0"> + <property name="name"> + <cstring>theValueEditListBox</cstring> + </property> + <property name="title"> + <string></string> + </property> + </widget> + </grid> + </widget> + </widget> + <spacer> + <property name="name"> + <cstring>spacer26</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>147</width> + <height>21</height> + </size> + </property> + </spacer> + </hbox> + </widget> + </vbox> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="title"> + <string>Finishing Up</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="font"> + <font> + <bold>1</bold> + </font> + </property> + <property name="text"> + <string>Miscellaneous Options</string> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>line1_2</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>theRepeat</cstring> + </property> + <property name="text"> + <string>This action is &repeatable if the button is held down</string> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>theAutoStart</cstring> + </property> + <property name="text"> + <string>This action causes the application to &start if not already running</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer22</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>670</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQLabel"> + <property name="name"> + <cstring>theIMTop</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="font"> + <font> + <bold>1</bold> + </font> + </property> + <property name="text"> + <string>Multiple Instances</string> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>theIMLine</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="TQLabel"> + <property name="name"> + <cstring>theIMLabel</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>This application may have multiple instances. In the case of having multiple instances at once when this action should be executed, choose a course of action:</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter</set> + </property> + </widget> + <widget class="TQButtonGroup"> + <property name="name"> + <cstring>theIMGroup</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="lineWidth"> + <number>0</number> + </property> + <property name="title"> + <string></string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>theDontSend</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>&Ignore the action</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>theSendToTop</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Send the action to the instance hi&ghest in the window stacking order</string> + </property> + </widget> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>theSendToBottom</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Send the action to the instance &lowest in window stacking order</string> + </property> + </widget> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>theSendToAll</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Send the action to &all instances</string> + </property> + </widget> + </vbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>170</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="title"> + <string>Select Required Mode Change</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQButtonGroup" row="0" column="0"> + <property name="name"> + <cstring>buttonGroup3</cstring> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="title"> + <string></string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>theSwitchMode</cstring> + </property> + <property name="text"> + <string>&Switch to mode:</string> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout13</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer8</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>131</width> + <height>31</height> + </size> + </property> + </spacer> + <widget class="TDEListView"> + <column> + <property name="text"> + <string>Mode</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>theModes</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>3</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer9</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>131</width> + <height>31</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>theExitMode</cstring> + </property> + <property name="text"> + <string>&Exit current mode</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer15_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>551</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQLabel"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string><b>Options</b></string> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>line2</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>theDoBefore</cstring> + </property> + <property name="text"> + <string>E&xecute all other actions before mode change (in original mode)</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>theDoAfter</cstring> + </property> + <property name="text"> + <string>Exec&ute all actions after mode change (in new mode)</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer10</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>30</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </grid> + </widget> +</widget> +<customwidgets> +</customwidgets> +<connections> + <connection> + <sender>theObjects</sender> + <signal>currentChanged(TQListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>updateFunctions()</slot> + </connection> + <connection> + <sender>theParameters</sender> + <signal>currentChanged(TQListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>updateParameter()</slot> + </connection> + <connection> + <sender>theFunctions</sender> + <signal>currentChanged(TQListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>updateButtonStates()</slot> + </connection> + <connection> + <sender>theSwitchMode</sender> + <signal>stateChanged(int)</signal> + <receiver>AddActionBase</receiver> + <slot>updateButtonStates()</slot> + </connection> + <connection> + <sender>theExitMode</sender> + <signal>stateChanged(int)</signal> + <receiver>AddActionBase</receiver> + <slot>updateButtonStates()</slot> + </connection> + <connection> + <sender>theChangeMode</sender> + <signal>stateChanged(int)</signal> + <receiver>AddActionBase</receiver> + <slot>updateButtonStates()</slot> + </connection> + <connection> + <sender>theUseDCOP</sender> + <signal>stateChanged(int)</signal> + <receiver>AddActionBase</receiver> + <slot>updateButtonStates()</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>stateChanged(int)</signal> + <receiver>AddActionBase</receiver> + <slot>updateButtonStates()</slot> + </connection> + <connection> + <sender>theProfiles</sender> + <signal>currentChanged(TQListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>updateButtonStates()</slot> + </connection> + <connection> + <sender>theModes</sender> + <signal>currentChanged(TQListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>updateButtonStates()</slot> + </connection> + <connection> + <sender>theModes</sender> + <signal>clicked(TQListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>slotModeSelected()</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>toggled(bool)</signal> + <receiver>theProfiles</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theValueDoubleNumInput</sender> + <signal>valueChanged(double)</signal> + <receiver>AddActionBase</receiver> + <slot>slotParameterChanged()</slot> + </connection> + <connection> + <sender>theValueIntNumInput</sender> + <signal>valueChanged(int)</signal> + <receiver>AddActionBase</receiver> + <slot>slotParameterChanged()</slot> + </connection> + <connection> + <sender>theValueLineEdit</sender> + <signal>textChanged(const TQString&)</signal> + <receiver>AddActionBase</receiver> + <slot>slotParameterChanged()</slot> + </connection> + <connection> + <sender>theValueCheckBox</sender> + <signal>toggled(bool)</signal> + <receiver>AddActionBase</receiver> + <slot>slotParameterChanged()</slot> + </connection> + <connection> + <sender>theProfileFunctions</sender> + <signal>currentChanged(TQListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>updateParameters()</slot> + </connection> + <connection> + <sender>theFunctions</sender> + <signal>currentChanged(TQListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>updateParameters()</slot> + </connection> + <connection> + <sender>theProfiles</sender> + <signal>currentChanged(TQListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>updateProfileFunctions()</slot> + </connection> + <connection> + <sender>theValueEditListBox</sender> + <signal>changed()</signal> + <receiver>AddActionBase</receiver> + <slot>slotParameterChanged()</slot> + </connection> + <connection> + <sender>theNotJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>theProfileFunctions</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theNotJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>theAutoStart</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>theAutoStart</receiver> + <slot>setChecked(bool)</slot> + </connection> + <connection> + <sender>theNotJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>theRepeat</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theNotJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>theRepeat</receiver> + <slot>setChecked(bool)</slot> + </connection> + <connection> + <sender>theProfileFunctions</sender> + <signal>currentChanged(TQListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>updateOptions()</slot> + </connection> + <connection> + <sender>theFunctions</sender> + <signal>currentChanged(TQListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>updateOptions()</slot> + </connection> + <connection> + <sender>theProfiles</sender> + <signal>doubleClicked(TQListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>next()</slot> + </connection> + <connection> + <sender>theButtons</sender> + <signal>doubleClicked(TQListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>next()</slot> + </connection> + <connection> + <sender>theFunctions</sender> + <signal>doubleClicked(TQListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>next()</slot> + </connection> + <connection> + <sender>theProfileFunctions</sender> + <signal>doubleClicked(TQListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>next()</slot> + </connection> + <connection> + <sender>theModes</sender> + <signal>doubleClicked(TQListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>accept()</slot> + </connection> +</connections> +<Q_SLOTS> + <slot>updateFunctions()</slot> + <slot>updateParameter()</slot> + <slot>updateParameters()</slot> + <slot>updateButtonStates()</slot> + <slot>updateCurrentParam(const TQString &)</slot> + <slot>slotNextParam()</slot> + <slot>slotCorrectPage()</slot> + <slot>slotModeSelected()</slot> + <slot>updateProfileFunctions()</slot> + <slot>updateForPageChange()</slot> + <slot>slotParameterChanged()</slot> + <slot>updateOptions()</slot> +</Q_SLOTS> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>tdelistview.h</includehint> + <includehint>tdelistview.h</includehint> + <includehint>tdelistview.h</includehint> + <includehint>tdelistview.h</includehint> + <includehint>tdelistview.h</includehint> + <includehint>tdelistview.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>keditlistbox.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>tdelistview.h</includehint> +</includehints> +</UI> diff --git a/tdelirc/kcmlirc/editaction.cpp b/tdelirc/kcmlirc/editaction.cpp new file mode 100644 index 0000000..8d8a0cb --- /dev/null +++ b/tdelirc/kcmlirc/editaction.cpp @@ -0,0 +1,362 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include <tqregexp.h> +#include <tqlabel.h> +#include <tqradiobutton.h> +#include <tqcombobox.h> +#include <tqcheckbox.h> +#include <tqwidgetstack.h> +#include <tqbuttongroup.h> + +#include <kdebug.h> +#include <klineedit.h> +#include <tdelistview.h> +#include <tdeapplication.h> +#include <tdemessagebox.h> +#include <knuminput.h> +#include <keditlistbox.h> + +#include <dcopclient.h> +#include <irkick_stub.h> + +#include "prototype.h" +#include "profileserver.h" +#include "remoteserver.h" +#include "editaction.h" +#include "addaction.h" + +EditAction::EditAction(IRAIt action, TQWidget *parent, const char *name) : EditActionBase(parent, name) +{ + theAction = action; + + updateApplications(); + updateDCOPApplications(); +} + +EditAction::~EditAction() +{ +} + +void EditAction::readFrom() +{ + theRepeat->setChecked((*theAction).repeat()); + theAutoStart->setChecked((*theAction).autoStart()); + theDoBefore->setChecked((*theAction).doBefore()); + theDoAfter->setChecked((*theAction).doAfter()); + theDontSend->setChecked((*theAction).ifMulti() == IM_DONTSEND); + theSendToTop->setChecked((*theAction).ifMulti() == IM_SENDTOTOP); + theSendToBottom->setChecked((*theAction).ifMulti() == IM_SENDTOBOTTOM); + theSendToAll->setChecked((*theAction).ifMulti() == IM_SENDTOALL); + + if((*theAction).isModeChange()) + { // change mode + theChangeMode->setChecked(true); + if((*theAction).object().isEmpty()) + theModes->setCurrentText(i18n("[Exit current mode]")); + else + theModes->setCurrentText((*theAction).object()); + } + else if((*theAction).isJustStart()) + { // profile action + theUseProfile->setChecked(true); + const Profile *p = ProfileServer::profileServer()->profiles()[(*theAction).program()]; + theApplications->setCurrentText(p->name()); + updateFunctions(); + updateArguments(); + theJustStart->setChecked(true); + } + else if(ProfileServer::profileServer()->getAction((*theAction).program(), (*theAction).object(), (*theAction).method().prototype())) + { // profile action + theUseProfile->setChecked(true); + const ProfileAction *a = ProfileServer::profileServer()->getAction((*theAction).program(), (*theAction).object(), (*theAction).method().prototype()); + theApplications->setCurrentText(a->profile()->name()); + updateFunctions(); + theFunctions->setCurrentText(a->name()); + arguments = (*theAction).arguments(); + updateArguments(); + theNotJustStart->setChecked(true); + } + else + { // dcop action + theUseDCOP->setChecked(true); + theDCOPApplications->setCurrentText((*theAction).program()); + updateDCOPObjects(); + theDCOPObjects->setCurrentText((*theAction).object()); + updateDCOPFunctions(); + theDCOPFunctions->setCurrentText((*theAction).method().prototype()); + arguments = (*theAction).arguments(); + updateArguments(); + } + updateOptions(); +} + +void EditAction::writeBack() +{ + if(theChangeMode->isChecked()) + { + (*theAction).setProgram(""); + if(theModes->currentText() == i18n("[Exit current mode]")) + (*theAction).setObject(""); + else + (*theAction).setObject(theModes->currentText()); + (*theAction).setDoBefore(theDoBefore->isChecked()); + (*theAction).setDoAfter(theDoAfter->isChecked()); + } + else if(theUseProfile->isChecked() && ( + ProfileServer::profileServer()->getAction(applicationMap[theApplications->currentText()], functionMap[theFunctions->currentText()]) + || + theJustStart->isChecked() && ProfileServer::profileServer()->profiles()[theApplications->currentText()] + ) + ) + { if(theJustStart->isChecked()) + { (*theAction).setProgram(ProfileServer::profileServer()->profiles()[applicationMap[theApplications->currentText()]]->id()); + (*theAction).setObject(""); + } + else + { const ProfileAction *a = ProfileServer::profileServer()->getAction(applicationMap[theApplications->currentText()], functionMap[theFunctions->currentText()]); + (*theAction).setProgram(ProfileServer::profileServer()->profiles()[applicationMap[theApplications->currentText()]]->id()); + (*theAction).setObject(a->objId()); + (*theAction).setMethod(a->prototype()); + (*theAction).setArguments(arguments); + } + } + else + { + (*theAction).setProgram(program);//theDCOPApplications->currentText()); + (*theAction).setObject(theDCOPObjects->currentText()); + (*theAction).setMethod(theDCOPFunctions->currentText()); + (*theAction).setArguments(arguments); + } + (*theAction).setRepeat(theRepeat->isChecked()); + (*theAction).setAutoStart(theAutoStart->isChecked()); + (*theAction).setUnique(isUnique); + (*theAction).setIfMulti(theDontSend->isChecked() ? IM_DONTSEND : theSendToTop->isChecked() ? IM_SENDTOTOP : theSendToBottom->isChecked() ? IM_SENDTOBOTTOM : IM_SENDTOALL); +} + +void EditAction::updateArguments() +{ + kdDebug() << k_funcinfo << endl; + if(theUseProfile->isChecked()) + { + theArguments->clear(); + const ProfileAction *a = ProfileServer::profileServer()->getAction(applicationMap[theApplications->currentText()], functionMap[theFunctions->currentText()]); + if(!a) { arguments.clear(); return; } + const TQValueList<ProfileActionArgument> &p = a->arguments(); + if(p.count() != arguments.count()) + { arguments.clear(); + for(unsigned i = 0; i < p.count(); i++) + arguments.append(TQVariant("")); + } + theArguments->setEnabled(p.count()); + for(unsigned i = 0; i < p.count(); i++) + { theArguments->insertItem(p[i].comment() + " (" + p[i].type() + ")"); + arguments[i].cast(TQVariant::nameToType(p[i].type().utf8())); + } + if(p.count()) updateArgument(0); else updateArgument(-1); + } + else if(theUseDCOP->isChecked()) + { + theArguments->clear(); + Prototype p(theDCOPFunctions->currentText()); + if(p.count() != arguments.count()) + { arguments.clear(); + for(unsigned i = 0; i < p.count(); i++) + arguments.append(TQVariant("")); + } + theArguments->setEnabled(p.count()); + for(unsigned i = 0; i < p.count(); i++) + { theArguments->insertItem(TQString(TQString().setNum(i + 1) + ": " + (p.name(i).isEmpty() ? p.type(i) : p.name(i) + " (" + p.type(i) + ")"))); + arguments[i].cast(TQVariant::nameToType(p.type(i).utf8())); + } + if(p.count()) updateArgument(0); else updateArgument(-1); + } +} + +void EditAction::updateOptions() +{ + if (theUseProfile->isChecked()) + { + ProfileServer *theServer = ProfileServer::profileServer(); + if(!theApplications->currentItem()) return; + const Profile *p = theServer->profiles()[applicationMap[theApplications->currentText()]]; + isUnique = p->unique(); + } + else if (theUseDCOP->isChecked()) + { + if(theDCOPApplications->currentText().isNull() || theDCOPApplications->currentText().isEmpty()) return; + program = theDCOPApplications->currentText(); + isUnique = uniqueProgramMap[theDCOPApplications->currentText()]; + } + else + isUnique = true; + + theIMLabel->setEnabled(!isUnique); + theIMGroup->setEnabled(!isUnique); + theDontSend->setEnabled(!isUnique); + theSendToTop->setEnabled(!isUnique); + theSendToBottom->setEnabled(!isUnique); + theSendToAll->setEnabled(!isUnique); +} + +// called when the textbox/checkbox/whatever changes value +void EditAction::slotParameterChanged() +{ + kdDebug() << "in: " << arguments[theArguments->currentItem()].toString() << endl; + int type = arguments[theArguments->currentItem()].type(); + kdDebug() << type << endl; + switch(type) + { + case TQVariant::Int: case TQVariant::UInt: + arguments[theArguments->currentItem()].asInt() = theValueIntNumInput->value(); + break; + case TQVariant::Double: + arguments[theArguments->currentItem()].asDouble() = theValueDoubleNumInput->value(); + break; + case TQVariant::Bool: + arguments[theArguments->currentItem()].asBool() = theValueCheckBox->isChecked(); + break; + case TQVariant::StringList: + arguments[theArguments->currentItem()].asStringList() = theValueEditListBox->items(); + break; + default: + arguments[theArguments->currentItem()].asString() = theValueLineEdit->text(); + } + arguments[theArguments->currentItem()].cast(TQVariant::Type(type)); + kdDebug() << "out: " << arguments[theArguments->currentItem()].toString() << endl; + +} + +void EditAction::updateArgument(int index) +{ + kdDebug() << k_funcinfo << " i: " << index << endl; + if(index >= 0) + { switch(arguments[index].type()) + { + case TQVariant::Int: case TQVariant::UInt: + theValue->raiseWidget(2); + theValueIntNumInput->setValue(arguments[index].toInt()); + break; + case TQVariant::Double: + theValue->raiseWidget(3); + theValueDoubleNumInput->setValue(arguments[index].toDouble()); + break; + case TQVariant::Bool: + theValue->raiseWidget(1); + theValueCheckBox->setChecked(arguments[index].toBool()); + break; + case TQVariant::StringList: + { theValue->raiseWidget(4); + TQStringList backup = arguments[index].toStringList(); + // backup needed because calling clear will kill what ever has been saved. + theValueEditListBox->clear(); + theValueEditListBox->insertStringList(backup); + arguments[index].asStringList() = backup; + break; + } + default: + theValue->raiseWidget(0); + theValueLineEdit->setText(arguments[index].toString()); + } + theValue->setEnabled(true); + } + else + { theValueLineEdit->setText(""); + theValueCheckBox->setChecked(false); + theValueIntNumInput->setValue(0); + theValueDoubleNumInput->setValue(0.0); + theValue->setEnabled(false); + } +} + +void EditAction::updateApplications() +{ + ProfileServer *theServer = ProfileServer::profileServer(); + theApplications->clear(); + applicationMap.clear(); + + TQDict<Profile> dict = theServer->profiles(); + TQDictIterator<Profile> i(dict); + for(; i.current(); ++i) + { theApplications->insertItem(i.current()->name()); + applicationMap[i.current()->name()] = i.currentKey(); + } + updateFunctions(); +} + +void EditAction::updateFunctions() +{ + ProfileServer *theServer = ProfileServer::profileServer(); + theFunctions->clear(); + functionMap.clear(); + if(theApplications->currentText().isNull() || theApplications->currentText().isEmpty()) return; + + const Profile *p = theServer->profiles()[applicationMap[theApplications->currentText()]]; + + TQDict<ProfileAction> dict = p->actions(); + for(TQDictIterator<ProfileAction> i(dict); i.current(); ++i) + { theFunctions->insertItem(i.current()->name()); + functionMap[i.current()->name()] = i.currentKey(); + } + updateArguments(); +} + +void EditAction::updateDCOPApplications() +{ + TQStringList names; + + theDCOPApplications->clear(); + DCOPClient *theClient = TDEApplication::kApplication()->dcopClient(); + QCStringList theApps = theClient->registeredApplications(); + for(QCStringList::iterator i = theApps.begin(); i != theApps.end(); ++i) + { + if(!TQString(*i).find("anonymous")) continue; + TQRegExp r("(.*)-[0-9]+"); + TQString name = r.exactMatch(TQString(*i)) ? r.cap(1) : *i; + if(names.contains(name)) continue; + names += name; + + theDCOPApplications->insertItem(name); + uniqueProgramMap[name] = name == TQString(*i); + nameProgramMap[name] = *i; + + + } + updateDCOPObjects(); +} + +void EditAction::updateDCOPObjects() +{ + theDCOPObjects->clear(); + DCOPClient *theClient = TDEApplication::kApplication()->dcopClient(); + if(theDCOPApplications->currentText().isNull() || theDCOPApplications->currentText().isEmpty()) return; + QCStringList theObjects = theClient->remoteObjects(nameProgramMap[theDCOPApplications->currentText()].utf8()); + if(!theObjects.size() && theDCOPApplications->currentText() == (*theAction).program()) theDCOPObjects->insertItem((*theAction).object()); + for(QCStringList::iterator j = theObjects.begin(); j != theObjects.end(); ++j) + if(*j != "tdesycoca" && *j != "qt" && AddAction::getFunctions(nameProgramMap[theDCOPApplications->currentText()], *j).count()) + theDCOPObjects->insertItem(TQString::fromUtf8(*j)); + updateDCOPFunctions(); +} + +void EditAction::updateDCOPFunctions() +{ + theDCOPFunctions->clear(); + if(theDCOPApplications->currentText().isNull() || theDCOPApplications->currentText().isEmpty()) return; + TQStringList functions = AddAction::getFunctions(nameProgramMap[theDCOPApplications->currentText()], theDCOPObjects->currentText()); + if(!functions.size() && theDCOPApplications->currentText() == (*theAction).program()) theDCOPFunctions->insertItem((*theAction).method().prototype()); + for(TQStringList::iterator i = functions.begin(); i != functions.end(); ++i) + theDCOPFunctions->insertItem(*i); + updateArguments(); +} + + +#include "editaction.moc" diff --git a/tdelirc/kcmlirc/editaction.h b/tdelirc/kcmlirc/editaction.h new file mode 100644 index 0000000..8b19b6a --- /dev/null +++ b/tdelirc/kcmlirc/editaction.h @@ -0,0 +1,56 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef EDITACTION_H +#define EDITACTION_H + +#include <tqstring.h> + +#include "iractions.h" +#include "editactionbase.h" +#include "arguments.h" + +/** +@author Gav Wood +*/ + +class EditAction : public EditActionBase +{ + Q_OBJECT + + IRAIt theAction; + TQMap<TQString, TQString> applicationMap, functionMap; + TQMap<TQString, TQString> nameProgramMap; + TQMap<TQString, bool> uniqueProgramMap; + Arguments arguments; + TQString program; + bool isUnique; + +public: + void writeBack(); + void readFrom(); + + virtual void slotParameterChanged(); + virtual void updateArgument(int index); + virtual void updateArguments(); + virtual void updateApplications(); + virtual void updateFunctions(); + virtual void updateOptions(); + virtual void updateDCOPApplications(); + virtual void updateDCOPObjects(); + virtual void updateDCOPFunctions(); + + EditAction(IRAIt action, TQWidget *parent = 0, const char *name = 0); + ~EditAction(); +}; + +#endif diff --git a/tdelirc/kcmlirc/editactionbase.ui b/tdelirc/kcmlirc/editactionbase.ui new file mode 100644 index 0000000..7e1a006 --- /dev/null +++ b/tdelirc/kcmlirc/editactionbase.ui @@ -0,0 +1,1287 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>EditActionBase</class> +<widget class="TQDialog"> + <property name="name"> + <cstring>EditActionBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>754</width> + <height>715</height> + </rect> + </property> + <property name="caption"> + <string>Edit Action</string> + </property> + <property name="sizeGripEnabled"> + <bool>true</bool> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQTabWidget"> + <property name="name"> + <cstring>tabWidget3</cstring> + </property> + <widget class="TQWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Function</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQButtonGroup"> + <property name="name"> + <cstring>buttonGroup3</cstring> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="title"> + <string></string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout40</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQComboBox" row="2" column="3"> + <property name="name"> + <cstring>theDCOPApplications</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="TQLabel" row="3" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel4_3</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>O&bject:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>theDCOPObjects</cstring> + </property> + </widget> + <widget class="TQButtonGroup" row="1" column="1" rowspan="1" colspan="3"> + <property name="name"> + <cstring>buttonGroup5</cstring> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="title"> + <string></string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="TQRadioButton" row="0" column="0"> + <property name="name"> + <cstring>theNotJustStart</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Perform function:</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="TQComboBox" row="0" column="1"> + <property name="name"> + <cstring>theFunctions</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="TQRadioButton" row="1" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>theJustStart</cstring> + </property> + <property name="text"> + <string>Just start application</string> + </property> + </widget> + </grid> + </widget> + <widget class="TQLabel" row="4" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel4_2</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Fu&nction:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>theDCOPFunctions</cstring> + </property> + </widget> + <widget class="TQLabel" row="0" column="1"> + <property name="name"> + <cstring>textLabel5</cstring> + </property> + <property name="text"> + <string>&Application:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>theApplications</cstring> + </property> + </widget> + <widget class="TQComboBox" row="0" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>theApplications</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="TQComboBox" row="4" column="3"> + <property name="name"> + <cstring>theDCOPFunctions</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> + <widget class="TQRadioButton" row="0" column="0"> + <property name="name"> + <cstring>theUseProfile</cstring> + </property> + <property name="text"> + <string>&Use application:</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="TQLabel" row="2" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel5_2</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>App&lication:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>theDCOPApplications</cstring> + </property> + </widget> + <widget class="TQRadioButton" row="2" column="0"> + <property name="name"> + <cstring>theUseDCOP</cstring> + </property> + <property name="text"> + <string>Use &DCOP:</string> + </property> + </widget> + <widget class="TQComboBox" row="3" column="3"> + <property name="name"> + <cstring>theDCOPObjects</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> + </grid> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout36</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQWidgetStack" row="0" column="2" rowspan="2" colspan="1"> + <property name="name"> + <cstring>theValue</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <widget class="TQWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>0</number> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="KLineEdit"> + <property name="name"> + <cstring>theValueLineEdit</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer35</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>91</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>1</number> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>theValueCheckBox</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer36</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>101</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>2</number> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="KIntNumInput"> + <property name="name"> + <cstring>theValueIntNumInput</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer37</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>101</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>3</number> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="KDoubleNumInput"> + <property name="name"> + <cstring>theValueDoubleNumInput</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer38</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>101</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>4</number> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="KEditListBox" row="0" column="0"> + <property name="name"> + <cstring>theValueEditListBox</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>3</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string></string> + </property> + </widget> + </grid> + </widget> + </widget> + <spacer row="1" column="0"> + <property name="name"> + <cstring>spacer33</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>111</height> + </size> + </property> + </spacer> + <widget class="TQComboBox" row="0" column="1"> + <property name="name"> + <cstring>theArguments</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>106</width> + <height>0</height> + </size> + </property> + </widget> + <spacer row="1" column="1"> + <property name="name"> + <cstring>spacer34</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>101</height> + </size> + </property> + </spacer> + <widget class="TQLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel8</cstring> + </property> + <property name="text"> + <string>A&pplication/DCOP options:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>theArguments</cstring> + </property> + </widget> + </grid> + </widget> + <spacer> + <property name="name"> + <cstring>spacer14</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>481</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout17</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>theChangeMode</cstring> + </property> + <property name="text"> + <string>Change &mode to:</string> + </property> + </widget> + <widget class="TQComboBox"> + <property name="name"> + <cstring>theModes</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer15</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>30</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </vbox> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Options</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="text"> + <string><b>DCOP/Application Action Options</b></string> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>line2</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>theRepeat</cstring> + </property> + <property name="text"> + <string>&Action repeats if button is held down</string> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>theAutoStart</cstring> + </property> + <property name="text"> + <string>&Start program/service if not already running</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer20</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>491</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQLabel"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string><b>Mode Change Options</b></string> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>line2_2</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>theDoBefore</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>E&xecute all other actions before mode change (in original mode)</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>theDoAfter</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Exec&ute all actions after mode change (in new mode)</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer22</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>670</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQLabel"> + <property name="name"> + <cstring>theIMTop</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="font"> + <font> + <bold>1</bold> + </font> + </property> + <property name="text"> + <string>Multiple Instances</string> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>theIMLine</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="TQLabel"> + <property name="name"> + <cstring>theIMLabel</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>This application may have multiple instances. In the case of having multiple instances at once when this action should be executed, choose a course of action:</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter</set> + </property> + </widget> + <widget class="TQButtonGroup"> + <property name="name"> + <cstring>theIMGroup</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="lineWidth"> + <number>0</number> + </property> + <property name="title"> + <string></string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>theDontSend</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>&Ignore the action</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>theSendToTop</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Send the action to the instance hi&ghest in window stacking order</string> + </property> + </widget> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>theSendToBottom</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Send the action to the instance &lowest in window stacking order</string> + </property> + </widget> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>theSendToAll</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Send the action to all i&nstances</string> + </property> + </widget> + </vbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>150</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </widget> + <widget class="TQLayoutWidget"> + <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> + <widget class="TQPushButton"> + <property name="name"> + <cstring>buttonHelp</cstring> + </property> + <property name="text"> + <string>&Help</string> + </property> + <property name="accel"> + <string>F1</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + <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="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQPushButton"> + <property name="name"> + <cstring>buttonOk</cstring> + </property> + <property name="text"> + <string>&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>&Cancel</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<customwidgets> +</customwidgets> +<connections> + <connection> + <sender>buttonOk</sender> + <signal>clicked()</signal> + <receiver>EditActionBase</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>buttonCancel</sender> + <signal>clicked()</signal> + <receiver>EditActionBase</receiver> + <slot>reject()</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>toggled(bool)</signal> + <receiver>theApplications</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>toggled(bool)</signal> + <receiver>theFunctions</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseDCOP</sender> + <signal>toggled(bool)</signal> + <receiver>theDCOPApplications</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseDCOP</sender> + <signal>toggled(bool)</signal> + <receiver>theDCOPObjects</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseDCOP</sender> + <signal>toggled(bool)</signal> + <receiver>theDCOPFunctions</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theChangeMode</sender> + <signal>toggled(bool)</signal> + <receiver>theModes</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theApplications</sender> + <signal>activated(const TQString&)</signal> + <receiver>EditActionBase</receiver> + <slot>updateFunctions()</slot> + </connection> + <connection> + <sender>theDCOPApplications</sender> + <signal>activated(const TQString&)</signal> + <receiver>EditActionBase</receiver> + <slot>updateDCOPObjects()</slot> + </connection> + <connection> + <sender>theDCOPObjects</sender> + <signal>activated(const TQString&)</signal> + <receiver>EditActionBase</receiver> + <slot>updateDCOPFunctions()</slot> + </connection> + <connection> + <sender>theFunctions</sender> + <signal>activated(const TQString&)</signal> + <receiver>EditActionBase</receiver> + <slot>updateArguments()</slot> + </connection> + <connection> + <sender>theDCOPFunctions</sender> + <signal>activated(const TQString&)</signal> + <receiver>EditActionBase</receiver> + <slot>updateArguments()</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>toggled(bool)</signal> + <receiver>theArguments</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseDCOP</sender> + <signal>toggled(bool)</signal> + <receiver>theArguments</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theArguments</sender> + <signal>activated(int)</signal> + <receiver>EditActionBase</receiver> + <slot>updateArgument(int)</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>clicked()</signal> + <receiver>EditActionBase</receiver> + <slot>updateArguments()</slot> + </connection> + <connection> + <sender>theUseDCOP</sender> + <signal>clicked()</signal> + <receiver>EditActionBase</receiver> + <slot>updateArguments()</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>toggled(bool)</signal> + <receiver>theAutoStart</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseDCOP</sender> + <signal>toggled(bool)</signal> + <receiver>theAutoStart</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>toggled(bool)</signal> + <receiver>theRepeat</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseDCOP</sender> + <signal>toggled(bool)</signal> + <receiver>theRepeat</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theChangeMode</sender> + <signal>toggled(bool)</signal> + <receiver>theDoAfter</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theChangeMode</sender> + <signal>toggled(bool)</signal> + <receiver>theDoBefore</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theValueDoubleNumInput</sender> + <signal>valueChanged(double)</signal> + <receiver>EditActionBase</receiver> + <slot>slotParameterChanged()</slot> + </connection> + <connection> + <sender>theValueLineEdit</sender> + <signal>textChanged(const TQString&)</signal> + <receiver>EditActionBase</receiver> + <slot>slotParameterChanged()</slot> + </connection> + <connection> + <sender>theValueCheckBox</sender> + <signal>toggled(bool)</signal> + <receiver>EditActionBase</receiver> + <slot>slotParameterChanged()</slot> + </connection> + <connection> + <sender>theValueIntNumInput</sender> + <signal>valueChanged(int)</signal> + <receiver>EditActionBase</receiver> + <slot>slotParameterChanged()</slot> + </connection> + <connection> + <sender>theValueEditListBox</sender> + <signal>changed()</signal> + <receiver>EditActionBase</receiver> + <slot>slotParameterChanged()</slot> + </connection> + <connection> + <sender>theNotJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>theFunctions</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>theAutoStart</receiver> + <slot>setChecked(bool)</slot> + </connection> + <connection> + <sender>theNotJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>theRepeat</receiver> + <slot>setChecked(bool)</slot> + </connection> + <connection> + <sender>theNotJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>theAutoStart</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theNotJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>theRepeat</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theNotJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>theArguments</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theNotJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>theValue</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>toggled(bool)</signal> + <receiver>theNotJustStart</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>toggled(bool)</signal> + <receiver>theJustStart</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>toggled(bool)</signal> + <receiver>theNotJustStart</receiver> + <slot>setChecked(bool)</slot> + </connection> + <connection> + <sender>theDCOPApplications</sender> + <signal>activated(const TQString&)</signal> + <receiver>EditActionBase</receiver> + <slot>updateOptions()</slot> + </connection> + <connection> + <sender>theApplications</sender> + <signal>activated(const TQString&)</signal> + <receiver>EditActionBase</receiver> + <slot>updateOptions()</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>toggled(bool)</signal> + <receiver>EditActionBase</receiver> + <slot>updateOptions()</slot> + </connection> + <connection> + <sender>theUseDCOP</sender> + <signal>toggled(bool)</signal> + <receiver>EditActionBase</receiver> + <slot>updateOptions()</slot> + </connection> + <connection> + <sender>theChangeMode</sender> + <signal>toggled(bool)</signal> + <receiver>EditActionBase</receiver> + <slot>updateOptions()</slot> + </connection> + <connection> + <sender>theJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>EditActionBase</receiver> + <slot>updateOptions()</slot> + </connection> + <connection> + <sender>theNotJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>EditActionBase</receiver> + <slot>updateOptions()</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel5</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseDCOP</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel5_2</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseDCOP</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel4_3</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseDCOP</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel4_2</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theChangeMode</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel8</receiver> + <slot>setDisabled(bool)</slot> + </connection> +</connections> +<tabstops> + <tabstop>tabWidget3</tabstop> + <tabstop>theUseProfile</tabstop> + <tabstop>theApplications</tabstop> + <tabstop>theFunctions</tabstop> + <tabstop>theDCOPApplications</tabstop> + <tabstop>theDCOPObjects</tabstop> + <tabstop>theDCOPFunctions</tabstop> + <tabstop>theModes</tabstop> + <tabstop>theRepeat</tabstop> + <tabstop>theAutoStart</tabstop> + <tabstop>buttonHelp</tabstop> + <tabstop>buttonOk</tabstop> + <tabstop>buttonCancel</tabstop> +</tabstops> +<Q_SLOTS> + <slot>updateFunctions()</slot> + <slot>updateApplications()</slot> + <slot>updateDCOPApplications()</slot> + <slot>updateDCOPObjects()</slot> + <slot>updateDCOPFunctions()</slot> + <slot>updateArguments()</slot> + <slot>updateArgument(int)</slot> + <slot>slotParameterChanged()</slot> + <slot>updateOptions()</slot> +</Q_SLOTS> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klineedit.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>keditlistbox.h</includehint> + <includehint>klineedit.h</includehint> +</includehints> +</UI> diff --git a/tdelirc/kcmlirc/editmode.cpp b/tdelirc/kcmlirc/editmode.cpp new file mode 100644 index 0000000..a197bb7 --- /dev/null +++ b/tdelirc/kcmlirc/editmode.cpp @@ -0,0 +1,38 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include <kicondialog.h> +#include <kiconloader.h> +#include <kpushbutton.h> + +#include "editmode.h" + +EditMode::EditMode(TQWidget *parent, const char *name, bool modal, WFlags fl) : EditModeBase(parent, name, modal, fl) +{ + theIcon->setIconType(TDEIcon::Panel, TDEIcon::Any); +} + +EditMode::~EditMode() +{ +} + +void EditMode::slotClearIcon() +{ + theIcon->resetIcon(); +} + +void EditMode::slotCheckText(const TQString &newText) +{ + theOK->setEnabled(!newText.isEmpty()); +} + +#include "editmode.moc" diff --git a/tdelirc/kcmlirc/editmode.h b/tdelirc/kcmlirc/editmode.h new file mode 100644 index 0000000..5de0836 --- /dev/null +++ b/tdelirc/kcmlirc/editmode.h @@ -0,0 +1,34 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef EDITMODE_H +#define EDITMODE_H + +#include "editmodebase.h" + +/** +@author Gav Wood +*/ +class EditMode : public EditModeBase +{ + Q_OBJECT + + +public: + void slotCheckText(const TQString &newText); + void slotClearIcon(); + + EditMode(TQWidget *parent = 0, const char *name = 0, bool modal = false, WFlags fl = 0); + ~EditMode(); +}; + +#endif diff --git a/tdelirc/kcmlirc/editmodebase.ui b/tdelirc/kcmlirc/editmodebase.ui new file mode 100644 index 0000000..b59533b --- /dev/null +++ b/tdelirc/kcmlirc/editmodebase.ui @@ -0,0 +1,303 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>EditModeBase</class> +<widget class="TQDialog"> + <property name="name"> + <cstring>EditModeBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>461</width> + <height>334</height> + </rect> + </property> + <property name="caption"> + <string>Edit Mode</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string><b>Description</b></string> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>line3_2</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout25</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel4</cstring> + </property> + <property name="text"> + <string>&Icon for system tray:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>theIcon</cstring> + </property> + </widget> + <widget class="TQLayoutWidget" row="1" column="1"> + <property name="name"> + <cstring>layout24</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer11</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>110</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="TDEIconButton"> + <property name="name"> + <cstring>theIcon</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>kPushButton9</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="pixmap"> + <pixmap>image0</pixmap> + </property> + </widget> + </hbox> + </widget> + <widget class="TQLineEdit" row="0" column="1"> + <property name="name"> + <cstring>theName</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> + <widget class="TQLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel5</cstring> + </property> + <property name="text"> + <string>&Mode name:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>theName</cstring> + </property> + </widget> + </grid> + </widget> + <spacer> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>410</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQLabel"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string><b>Behavior</b></string> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>line2</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>theDefault</cstring> + </property> + <property name="text"> + <string>Mo&de is the default for its remote control</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer9</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>90</height> + </size> + </property> + </spacer> + <widget class="Line"> + <property name="name"> + <cstring>line3</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout15</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer10</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>231</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KPushButton"> + <property name="name"> + <cstring>theOK</cstring> + </property> + <property name="text"> + <string>&OK</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>kPushButton8</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<images> + <image name="image0"> + <data format="XPM.GZ" length="620">789c7dd0cd4e84301405e03d4fd17077c438201421c647d0b834312efa03c31d0648745c18e3bbcbb905fc8d0768fa1d202dec12757f77a3925df47c322776ca75e64925fe65185e1f1eafdfa2382b15ce4b95c567517cae9cba9dc606739ae7944ac009cc2a1ce008e6599ee6f2e20016599116c223a88df6da803d589ab22e851d58d9aaae2c7800eba2d67501ee856ea6033d680b5b5ab9db08fd4c0fba8526d02e6c020de8b46d9c065bd06b7fe1850cb612f9f61fd93afaccdad1ef8ec858e74de36cbb7644fb8eb93b60583aa2be3f32b35ca1231ae68c8c8cc3d24d129aab791a3a0ecbc973dbbabc5414cab02e4bb70ecbfef88f3d7f2bb7efe52df4ef7ff9dabd5f451f45248a2d</data> + </image> +</images> +<connections> + <connection> + <sender>theName</sender> + <signal>textChanged(const TQString&)</signal> + <receiver>EditModeBase</receiver> + <slot>slotCheckText(const TQString&)</slot> + </connection> + <connection> + <sender>theOK</sender> + <signal>clicked()</signal> + <receiver>EditModeBase</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>kPushButton8</sender> + <signal>clicked()</signal> + <receiver>EditModeBase</receiver> + <slot>reject()</slot> + </connection> + <connection> + <sender>kPushButton9</sender> + <signal>clicked()</signal> + <receiver>EditModeBase</receiver> + <slot>slotClearIcon()</slot> + </connection> +</connections> +<Q_SLOTS> + <slot>slotCheckText(const TQString &)</slot> + <slot>slotClearIcon()</slot> +</Q_SLOTS> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kicondialog.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/tdelirc/kcmlirc/kcmlirc.cpp b/tdelirc/kcmlirc/kcmlirc.cpp new file mode 100644 index 0000000..bf18895 --- /dev/null +++ b/tdelirc/kcmlirc/kcmlirc.cpp @@ -0,0 +1,545 @@ +/*************************************************************************** + * Copyright (C) 2003 by Gav Wood * + * gav@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#include <tqcheckbox.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqlineedit.h> +#include <tqradiobutton.h> +#include <tqcombobox.h> +#include <tqevent.h> +#include <tqlistview.h> + +#include <kpushbutton.h> +#include <tdeapplication.h> +#include <tdelocale.h> +#include <tdeglobal.h> +#include <tdeconfig.h> +#include <kicondialog.h> +#include <kiconloader.h> +#include <kdebug.h> +#include <ksimpleconfig.h> +#include <kgenericfactory.h> +#include <tdelistview.h> +#include <tdemessagebox.h> +#include <kpushbutton.h> + +#include <dcopclient.h> +#include <dcopref.h> + +#include <irkick_stub.h> + +#include "addaction.h" +#include "newmode.h" +#include "profileserver.h" +#include "remoteserver.h" +#include "kcmlirc.h" +#include "editaction.h" +#include "editmode.h" +#include "modeslist.h" +#include "selectprofile.h" + +typedef KGenericFactory<KCMLirc, TQWidget> theFactory; +K_EXPORT_COMPONENT_FACTORY(kcmlirc, theFactory("kcmlirc")) + +KCMLirc::KCMLirc(TQWidget *parent, const char *name, TQStringList /*args*/) : DCOPObject("KCMLirc"), TDECModule(parent, name) +{ + TDEGlobal::locale()->insertCatalogue( "kcmlirc" ); + setAboutData(new TDEAboutData("kcmlirc", I18N_NOOP("TDE Lirc"), VERSION, I18N_NOOP("The TDE IR Remote Control System"), TDEAboutData::License_GPL_V2, "Copyright (c)2003 Gav Wood", I18N_NOOP("Use this to configure TDE's infrared remote control system in order to control any TDE application with your infrared remote control."), "http://www.kde.org")); + setButtons(TDECModule::Help); + setQuickHelp(i18n("<h1>Remote Controls</h1><p>This module allows you to configure bindings between your remote controls and TDE applications. Simply select your remote control and click Add under the Actions/Buttons list. If you want TDE to attempt to automatically assign buttons to a supported application's actions, try clicking the Auto-Populate button.</p><p>To view the recognised applications and remote controls, simply select the <em>Loaded Extensions</em> tab.</p>")); + bool ok; + TDEApplication::kApplication()->dcopClient()->remoteInterfaces("irkick", "IRKick", &ok); + if(!ok) + if(KMessageBox::questionYesNo(this, i18n("The Infrared Remote Control software is not currently running. This configuration module will not work properly without it. Would you like to start it now?"), i18n("Software Not Running"), i18n("Start"), i18n("Do Not Start")) == KMessageBox::Yes) + { kdDebug() << "S" << TDEApplication::startServiceByDesktopName("irkick") << endl; + KSimpleConfig theConfig("irkickrc"); + theConfig.setGroup("General"); + if(theConfig.readBoolEntry("AutoStart", true) == false) + if(KMessageBox::questionYesNo(this, i18n("Would you like the infrared remote control software to start automatically when you begin TDE?"), i18n("Automatically Start?"), i18n("Start Automatically"), i18n("Do Not Start")) == KMessageBox::Yes) + theConfig.writeEntry("AutoStart", true); + } + + TDEApplication::kApplication()->dcopClient()->remoteInterfaces("irkick", "IRKick", &ok); + kdDebug() << "OK" << ok << endl; + + + (new TQHBoxLayout(this))->setAutoAdd(true); + theKCMLircBase = new KCMLircBase(this); + connect(theKCMLircBase->theModes, TQT_SIGNAL( selectionChanged(TQListViewItem *) ), this, TQT_SLOT( updateActions() )); + connect(theKCMLircBase->theModes, TQT_SIGNAL( selectionChanged(TQListViewItem *) ), this, TQT_SLOT( updateModesStatus(TQListViewItem *) )); + connect(theKCMLircBase->theActions, TQT_SIGNAL( currentChanged(TQListViewItem *) ), this, TQT_SLOT( updateActionsStatus(TQListViewItem *) )); + connect(theKCMLircBase->theExtensions, TQT_SIGNAL( selectionChanged(TQListViewItem *) ), this, TQT_SLOT( updateInformation() )); + connect(theKCMLircBase->theModes, TQT_SIGNAL( itemRenamed(TQListViewItem *) ), this, TQT_SLOT( slotRenamed(TQListViewItem *) )); + connect(theKCMLircBase->theModes, TQT_SIGNAL(dropped(TDEListView*, TQDropEvent*, TQListViewItem*, TQListViewItem*)), this, TQT_SLOT(slotDrop(TDEListView*, TQDropEvent*, TQListViewItem*, TQListViewItem*))); + connect((TQObject *)(theKCMLircBase->theAddActions), TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotAddActions() )); + connect((TQObject *)(theKCMLircBase->theAddAction), TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotAddAction() )); + connect((TQObject *)(theKCMLircBase->theEditAction), TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotEditAction() )); + connect((TQObject *)(theKCMLircBase->theActions), TQT_SIGNAL( doubleClicked(TQListViewItem *) ), this, TQT_SLOT( slotEditAction() )); + connect((TQObject *)(theKCMLircBase->theRemoveAction), TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotRemoveAction() )); + connect((TQObject *)(theKCMLircBase->theAddMode), TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotAddMode() )); + connect((TQObject *)(theKCMLircBase->theEditMode), TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotEditMode() )); + connect((TQObject *)(theKCMLircBase->theRemoveMode), TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotRemoveMode() )); + load(); +} + +KCMLirc::~KCMLirc() +{ +} + +void KCMLirc::updateModesStatus(TQListViewItem *item) +{ + theKCMLircBase->theModes->setItemsRenameable(item && item->parent()); + theKCMLircBase->theAddActions->setEnabled(ProfileServer::profileServer()->profiles().count() && theKCMLircBase->theModes->selectedItem() && RemoteServer::remoteServer()->remotes()[modeMap[theKCMLircBase->theModes->selectedItem()].remote()]); + theKCMLircBase->theAddAction->setEnabled(item); + theKCMLircBase->theAddMode->setEnabled(item); + theKCMLircBase->theRemoveMode->setEnabled(item && item->parent()); + theKCMLircBase->theEditMode->setEnabled(item); +} + +void KCMLirc::updateActionsStatus(TQListViewItem *item) +{ + theKCMLircBase->theRemoveAction->setEnabled(item); + theKCMLircBase->theEditAction->setEnabled(item); +} + +void KCMLirc::slotRenamed(TQListViewItem *item) +{ + if(!item) return; + + if(item->parent() && item->text(0) != modeMap[item].name()) + { allActions.renameMode(modeMap[item], item->text(0)); + allModes.rename(modeMap[item], item->text(0)); + emit changed(true); + updateModes(); + } +} + +void KCMLirc::slotEditAction() +{ + if(!theKCMLircBase->theActions->currentItem()) return; + + EditAction theDialog(actionMap[theKCMLircBase->theActions->currentItem()], this); + TQListViewItem *item = theKCMLircBase->theModes->currentItem(); + if(item->parent()) item = item->parent(); + theDialog.theModes->insertItem(i18n("[Exit current mode]")); + for(item = item->firstChild(); item; item = item->nextSibling()) + theDialog.theModes->insertItem(item->text(0)); + theDialog.readFrom(); + if(theDialog.exec() == TQDialog::Accepted) { theDialog.writeBack(); emit changed(true); updateActions(); } +} + +void KCMLirc::slotAddActions() +{ + if(!theKCMLircBase->theModes->selectedItem()) return; + Mode m = modeMap[theKCMLircBase->theModes->selectedItem()]; + if(!RemoteServer::remoteServer()->remotes()[m.remote()]) return; + + SelectProfile theDialog(this, 0); + + TQMap<TQListViewItem *, Profile *> profileMap; + TQDict<Profile> dict = ProfileServer::profileServer()->profiles(); + for(TQDictIterator<Profile> i(dict); i.current(); ++i) profileMap[new TQListViewItem(theDialog.theProfiles, i.current()->name())] = i.current(); + + if(theDialog.exec() == TQDialog::Accepted && theDialog.theProfiles->currentItem()) + { autoPopulate(*(profileMap[theDialog.theProfiles->currentItem()]), *(RemoteServer::remoteServer()->remotes()[m.remote()]), m.name()); + updateActions(); + emit changed(true); + } +} + +void KCMLirc::slotAddAction() +{ + kdDebug() << k_funcinfo << endl; + if(!theKCMLircBase->theModes->selectedItem()) return; + Mode m = modeMap[theKCMLircBase->theModes->selectedItem()]; + + AddAction theDialog(this, 0, m); + connect(this, TQT_SIGNAL(haveButton(const TQString &, const TQString &)), &theDialog, TQT_SLOT(updateButton(const TQString &, const TQString &))); + + // populate the modes list box + TQListViewItem *item = theKCMLircBase->theModes->selectedItem(); + if(item->parent()) item = item->parent(); + theDialog.theModes->setEnabled(item->firstChild()); + theDialog.theSwitchMode->setEnabled(item->firstChild()); + for(item = item->firstChild(); item; item = item->nextSibling()) + { TDEListViewItem *a = new TDEListViewItem(theDialog.theModes, item->text(0)); + if(item->isSelected()) { a->setSelected(true); theDialog.theModes->setCurrentItem(a); } + } + + if(theDialog.exec() == TQDialog::Accepted && theDialog.theButtons->selectedItem()) + { IRAction a; + a.setRemote(m.remote()); + a.setMode(m.name()); + a.setButton(theDialog.buttonMap[theDialog.theButtons->selectedItem()]); + a.setRepeat(theDialog.theRepeat->isChecked()); + a.setAutoStart(theDialog.theAutoStart->isChecked()); + a.setDoBefore(theDialog.theDoBefore->isChecked()); + a.setDoAfter(theDialog.theDoAfter->isChecked()); + a.setUnique(theDialog.isUnique); + a.setIfMulti(theDialog.theDontSend->isChecked() ? IM_DONTSEND : theDialog.theSendToTop->isChecked() ? IM_SENDTOTOP : theDialog.theSendToBottom->isChecked() ? IM_SENDTOBOTTOM : IM_SENDTOALL); + // change mode? + if(theDialog.theChangeMode->isChecked()) + { + if(theDialog.theSwitchMode->isChecked() && theDialog.theModes->selectedItem()) + { + a.setProgram(""); + a.setObject(theDialog.theModes->selectedItem()->text(0)); + } + else if(theDialog.theExitMode->isChecked()) + { + a.setProgram(""); + a.setObject(""); + } + a.setAutoStart(false); + a.setRepeat(false); + } + // DCOP? + else if(theDialog.theUseDCOP->isChecked() && theDialog.theObjects->selectedItem() && theDialog.theObjects->selectedItem()->parent() && theDialog.theFunctions->selectedItem()) + { + a.setProgram(theDialog.program); + a.setObject(theDialog.theObjects->selectedItem()->text(0)); + a.setMethod(theDialog.theFunctions->selectedItem()->text(2)); + theDialog.theParameters->setSorting(3); + a.setArguments(theDialog.theArguments); + } + // profile? + else if(theDialog.theUseProfile->isChecked() && theDialog.theProfiles->selectedItem() && (theDialog.theProfileFunctions->selectedItem() || theDialog.theJustStart->isChecked())) + { + ProfileServer *theServer = ProfileServer::profileServer(); + + if(theDialog.theNotJustStart->isChecked()) + { const ProfileAction *theAction = theServer->getAction(theDialog.profileMap[theDialog.theProfiles->selectedItem()], theDialog.profileFunctionMap[theDialog.theProfileFunctions->selectedItem()]); + a.setProgram(theAction->profile()->id()); + a.setObject(theAction->objId()); + a.setMethod(theAction->prototype()); + theDialog.theParameters->setSorting(3); + a.setArguments(theDialog.theArguments); + } + else + { a.setProgram(theServer->profiles()[theDialog.profileMap[theDialog.theProfiles->selectedItem()]]->id()); + a.setObject(""); + } + } + + // save our new action + allActions.addAction(a); + updateActions(); + emit changed(true); + } +} + +void KCMLirc::slotRemoveAction() +{ + if(!theKCMLircBase->theActions->currentItem()) return; + + IRAIt i = actionMap[theKCMLircBase->theActions->currentItem()]; + allActions.erase(i); + updateActions(); + emit changed(true); +} + +void KCMLirc::autoPopulate(const Profile &profile, const Remote &remote, const TQString &mode) +{ + TQDict<RemoteButton> d = remote.buttons(); + for(TQDictIterator<RemoteButton> i(d); i.current(); ++i) + { const ProfileAction *pa = profile.searchClass(i.current()->getClass()); + if(pa) + { + IRAction a; + a.setRemote(remote.id()); + a.setMode(mode); + a.setButton(i.current()->id()); + a.setRepeat(pa->repeat()); + a.setAutoStart(pa->autoStart()); + a.setProgram(pa->profile()->id()); + a.setObject(pa->objId()); + a.setMethod(pa->prototype()); + a.setUnique(pa->profile()->unique()); + a.setIfMulti(pa->profile()->ifMulti()); + Arguments l; + // argument count should be either 0 or 1. undefined if > 1. + if(Prototype(pa->prototype()).argumentCount() == 1) + { + l.append(TQString(TQString().setNum(i.current()->parameter().toFloat() * pa->multiplier()))); + l.back().cast(TQVariant::nameToType(Prototype(pa->prototype()).type(0).utf8())); + } + a.setArguments(l); + allActions.addAction(a); + } + } +} + +void KCMLirc::slotAddMode() +{ + if(!theKCMLircBase->theModes->selectedItem()) return; + + NewMode theDialog(this, 0); + TQMap<TQListViewItem *, TQString> remoteMap; + TQListViewItem *tr = theKCMLircBase->theModes->selectedItem(); + if(tr) if(tr->parent()) tr = tr->parent(); + for(TQListViewItem *i = theKCMLircBase->theModes->firstChild(); i; i = i->nextSibling()) + { TDEListViewItem *a = new TDEListViewItem(theDialog.theRemotes, i->text(0)); + remoteMap[a] = modeMap[i].remote(); + if(i == tr) { a->setSelected(true); theDialog.theRemotes->setCurrentItem(a); } + } + if(theDialog.exec() == TQDialog::Accepted && theDialog.theRemotes->selectedItem() && !theDialog.theName->text().isEmpty()) + { + allModes.add(Mode(remoteMap[theDialog.theRemotes->selectedItem()], theDialog.theName->text())); + updateModes(); + emit changed(true); + } +} + +void KCMLirc::slotEditMode() +{ + if(!theKCMLircBase->theModes->selectedItem()) return; + + EditMode theDialog(this, 0); + + Mode &mode = modeMap[theKCMLircBase->theModes->selectedItem()]; + theDialog.theName->setEnabled(theKCMLircBase->theModes->selectedItem()->parent()); + theDialog.theName->setText(mode.name().isEmpty() ? mode.remoteName() : mode.name()); + if(!mode.iconFile().isNull()) + theDialog.theIcon->setIcon(mode.iconFile()); + else + theDialog.theIcon->resetIcon(); + theDialog.theDefault->setChecked(allModes.isDefault(mode)); + theDialog.theDefault->setEnabled(!allModes.isDefault(mode)); + + if(theDialog.exec() == TQDialog::Accepted) + { kdDebug() << "Setting icon : " << theDialog.theIcon->icon() << endl; + mode.setIconFile(theDialog.theIcon->icon().isEmpty() ? TQString() : theDialog.theIcon->icon()); + allModes.updateMode(mode); + if(!mode.name().isEmpty()) + { allActions.renameMode(mode, theDialog.theName->text()); + allModes.rename(mode, theDialog.theName->text()); + } + if(theDialog.theDefault->isChecked()) allModes.setDefault(mode); + emit changed(true); + updateModes(); + } +} + +void KCMLirc::slotRemoveMode() +{ + if(!theKCMLircBase->theModes->selectedItem()) return; + if(!theKCMLircBase->theModes->selectedItem()->parent()) return; + + if(KMessageBox::warningContinueCancel(this, i18n("Are you sure you want to remove %1 and all its actions?").arg(theKCMLircBase->theModes->selectedItem()->text(0)), i18n("Erase Actions?")) == KMessageBox::Continue) + { + allModes.erase(modeMap[theKCMLircBase->theModes->selectedItem()]); + updateModes(); + emit changed(true); + } +} + +void KCMLirc::slotSetDefaultMode() +{ + if(!theKCMLircBase->theModes->selectedItem()) return; + allModes.setDefault(modeMap[theKCMLircBase->theModes->selectedItem()]); + updateModes(); + emit changed(true); +} + +void KCMLirc::slotDrop(TDEListView *, TQDropEvent *, TQListViewItem *, TQListViewItem *after) +{ + Mode m = modeMap[after]; + + if(modeMap[theKCMLircBase->theModes->selectedItem()].remote() != m.remote()) + { + KMessageBox::error(this, i18n("You may only drag the selected items onto a mode of the same remote control"), i18n("You May Not Drag Here")); + return; + } + for(TQListViewItem *i = theKCMLircBase->theActions->firstChild(); i; i = i->nextSibling()) + if(i->isSelected()) + (*(actionMap[i])).setMode(m.name()); + + updateActions(); + emit changed(true); +} + +void KCMLirc::updateActions() +{ + IRAIt oldCurrent; + if(theKCMLircBase->theActions->selectedItem()) oldCurrent = actionMap[theKCMLircBase->theActions->selectedItem()]; + + theKCMLircBase->theActions->clear(); + actionMap.clear(); + + if(!theKCMLircBase->theModes->selectedItem()) { updateActionsStatus(0); return; } + + Mode m = modeMap[theKCMLircBase->theModes->selectedItem()]; + theKCMLircBase->theModeLabel->setText(m.remoteName() + ": " + (m.name().isEmpty() ? i18n("Actions <i>always</i> available") : i18n("Actions available only in mode <b>%1</b>").arg(m.name()))); + IRAItList l = allActions.findByMode(m); + for(IRAItList::iterator i = l.begin(); i != l.end(); ++i) + { TQListViewItem *b = new TDEListViewItem(theKCMLircBase->theActions, (**i).buttonName(), (**i).application(), (**i).function(), (**i).arguments().toString(), (**i).notes()); + actionMap[b] = *i; + if(*i == oldCurrent) { b->setSelected(true); theKCMLircBase->theActions->setCurrentItem(b); } + } + + if(theKCMLircBase->theActions->currentItem()) + theKCMLircBase->theActions->currentItem()->setSelected(true); + updateActionsStatus(theKCMLircBase->theActions->currentItem()); +} + +void KCMLirc::gotButton(TQString remote, TQString button) +{ + emit haveButton(remote, button); +} + +void KCMLirc::updateModes() +{ + Mode oldCurrent; + if(theKCMLircBase->theModes->selectedItem()) oldCurrent = modeMap[theKCMLircBase->theModes->selectedItem()]; + + theKCMLircBase->theModes->clear(); + modeMap.clear(); + + IRKick_stub IRKick("irkick", "IRKick"); + TQStringList remotes = IRKick.remotes(); + if(remotes.begin() == remotes.end()) + theKCMLircBase->theMainLabel->setMaximumSize(32767, 32767); + else + theKCMLircBase->theMainLabel->setMaximumSize(0, 0); + for(TQStringList::iterator i = remotes.begin(); i != remotes.end(); ++i) + { Mode mode = allModes.getMode(*i, ""); + TQListViewItem *a = new TDEListViewItem(theKCMLircBase->theModes, RemoteServer::remoteServer()->getRemoteName(*i), allModes.isDefault(mode) ? "Default" : "", mode.iconFile().isNull() ? "" : ""); + if(!mode.iconFile().isNull()) + a->setPixmap(2, TDEIconLoader().loadIcon(mode.iconFile(), TDEIcon::Panel)); + modeMap[a] = mode; // the null mode + if(modeMap[a] == oldCurrent) { a->setSelected(true); theKCMLircBase->theModes->setCurrentItem(a); } + a->setOpen(true); + ModeList l = allModes.getModes(*i); + for(ModeList::iterator j = l.begin(); j != l.end(); ++j) + if(!(*j).name().isEmpty()) + { TQListViewItem *b = new TDEListViewItem(a, (*j).name(), allModes.isDefault(*j) ? i18n("Default") : "", (*j).iconFile().isNull() ? "" : ""); + if(!(*j).iconFile().isNull()) + b->setPixmap(2, TDEIconLoader().loadIcon((*j).iconFile(), TDEIcon::Panel)); + modeMap[b] = *j; + if(*j == oldCurrent) { b->setSelected(true); theKCMLircBase->theModes->setCurrentItem(b); } + } + } + if(theKCMLircBase->theModes->currentItem()) + theKCMLircBase->theModes->currentItem()->setSelected(true); + updateModesStatus(theKCMLircBase->theModes->currentItem()); + updateActions(); +} + +void KCMLirc::updateExtensions() +{ + theKCMLircBase->theExtensions->clear(); + + { ProfileServer *theServer = ProfileServer::profileServer(); + TQListViewItem *a = new TQListViewItem(theKCMLircBase->theExtensions, i18n("Applications")); + a->setOpen(true); + profileMap.clear(); + TQDict<Profile> dict = theServer->profiles(); + TQDictIterator<Profile> i(dict); + for(; i.current(); ++i) + profileMap[new TQListViewItem(a, i.current()->name())] = i.currentKey(); + } + { RemoteServer *theServer = RemoteServer::remoteServer(); + TQListViewItem *a = new TQListViewItem(theKCMLircBase->theExtensions, i18n("Remote Controls")); + a->setOpen(true); + remoteMap.clear(); + TQDict<Remote> dict = theServer->remotes(); + TQDictIterator<Remote> i(dict); + for(; i.current(); ++i) + remoteMap[new TQListViewItem(a, i.current()->name())] = i.currentKey(); + } + updateInformation(); +} + +void KCMLirc::updateInformation() +{ + theKCMLircBase->theInformation->clear(); + theKCMLircBase->theInformationLabel->setText(""); + + if(!theKCMLircBase->theExtensions->selectedItem()) return; + + if(!theKCMLircBase->theExtensions->selectedItem()->parent()) + { + theKCMLircBase->theInformationLabel->setText(i18n("Information on <b>%1</b>:").arg(theKCMLircBase->theExtensions->selectedItem()->text(0))); + if(theKCMLircBase->theExtensions->selectedItem()->text(0) == i18n("Applications")) + new TQListViewItem(theKCMLircBase->theInformation, i18n("Number of Applications"), TQString().setNum(theKCMLircBase->theExtensions->selectedItem()->childCount())); + else if(theKCMLircBase->theExtensions->selectedItem()->text(0) == i18n("Remote Controls")) + new TQListViewItem(theKCMLircBase->theInformation, i18n("Number of Remote Controls"), TQString().setNum(theKCMLircBase->theExtensions->selectedItem()->childCount())); + } + else if(theKCMLircBase->theExtensions->selectedItem()->parent()->text(0) == i18n("Applications")) + { + ProfileServer *theServer = ProfileServer::profileServer(); + const Profile *p = theServer->profiles()[profileMap[theKCMLircBase->theExtensions->selectedItem()]]; + new TQListViewItem(theKCMLircBase->theInformation, i18n("Extension Name"), p->name()); + new TQListViewItem(theKCMLircBase->theInformation, i18n("Extension Author"), p->author()); + new TQListViewItem(theKCMLircBase->theInformation, i18n("Application Identifier"), p->id()); + new TQListViewItem(theKCMLircBase->theInformation, i18n("Number of Actions"), TQString().setNum(p->actions().count())); + theKCMLircBase->theInformationLabel->setText(i18n("Information on <b>%1</b>:").arg(p->name())); + } + else if(theKCMLircBase->theExtensions->selectedItem()->parent()->text(0) == i18n("Remote Controls")) + { + RemoteServer *theServer = RemoteServer::remoteServer(); + const Remote *p = theServer->remotes()[remoteMap[theKCMLircBase->theExtensions->selectedItem()]]; + new TQListViewItem(theKCMLircBase->theInformation, i18n("Extension Name"), p->name()); + new TQListViewItem(theKCMLircBase->theInformation, i18n("Extension Author"), p->author()); + new TQListViewItem(theKCMLircBase->theInformation, i18n("Remote Control Identifier"), p->id()); + new TQListViewItem(theKCMLircBase->theInformation, i18n("Number of Buttons"), TQString().setNum(p->buttons().count())); + theKCMLircBase->theInformationLabel->setText(i18n("Information on <b>%1</b>:").arg(p->name())); + } +} + +void KCMLirc::load() +{ + KSimpleConfig theConfig("irkickrc"); + allActions.loadFromConfig(theConfig); + allModes.loadFromConfig(theConfig); + allModes.generateNulls(IRKick_stub("irkick", "IRKick").remotes()); + + updateExtensions(); + updateModes(); + updateActions(); +} + +void KCMLirc::defaults() +{ + // insert your default settings code here... + emit changed(true); +} + +void KCMLirc::save() +{ + KSimpleConfig theConfig("irkickrc"); + allActions.saveToConfig(theConfig); + allModes.saveToConfig(theConfig); + + theConfig.sync(); + IRKick_stub("irkick", "IRKick").reloadConfiguration(); + + emit changed(true); +} + +void KCMLirc::configChanged() +{ + // insert your saving code here... + emit changed(true); +} + +// TODO: Take this out when I know how +extern "C" +{ + KDE_EXPORT TDECModule *create_kcmlirc(TQWidget *parent, const char *) + { TDEGlobal::locale()->insertCatalogue("kcmlirc"); + return new KCMLirc(parent, "KCMLirc"); + } +} + +#include <irkick_stub.cpp> + +#include "kcmlirc.moc" diff --git a/tdelirc/kcmlirc/kcmlirc.desktop b/tdelirc/kcmlirc/kcmlirc.desktop new file mode 100644 index 0000000..09033c1 --- /dev/null +++ b/tdelirc/kcmlirc/kcmlirc.desktop @@ -0,0 +1,119 @@ +[Desktop Entry] +Icon=irkick +Comment=Configure your remote controls for use with applications +Comment[ar]=إعداد التØكّم عن بعد لاستخدامه ÙÙŠ تطبيقاتك +Comment[bg]=ÐаÑтройване на диÑтанционното управление +Comment[bs]=Podesite vaÅ¡ daljinski upravljaÄ za upotrebu sa programima +Comment[ca]=Configura els teus controls remots per usar amb aplicacions +Comment[cs]=Nastavenà dálkových ovladaÄů +Comment[cy]=Ffurfweddu eich rheolyddion pell ar gyfer ddefnydd efo cymhwysiadau +Comment[da]=Indstil dine fjernbetjeninger til brug for programmer +Comment[de]=Einrichtung diverser Applikationen zur Bedienung mit einer Fernsteuerung +Comment[el]=Ρυθμίστε τα τηλεχειÏιστήÏια σας για χÏήση σε εφαÏμογÎÏ‚ +Comment[es]=Configurar sus controles remotos para usarlos en las aplicaciones +Comment[et]=Kaugjuhtimise seadistamine rakenduste jaoks +Comment[eu]=Konfiguratu zure urruneko kontrolak aplikazioekin erabiltzeko +Comment[fa]=برای استÙاده با کاربردها، کنترلهای از راه دورتان را پیکربندی کنید +Comment[fi]=Muokkaa kauko-ohjaimesi toimimaan ohjelmien kanssa +Comment[fr]=Configurer vos contrôleurs distants pour l'utiliser avec vos applications +Comment[ga]=Cumraigh do chuid cianrialtáin chun iad a úsáid le feidhmchláir +Comment[he]=הגדרת שלט רחוק לשימוש ×‘×™×™×©×•×ž×™× +Comment[hi]=अनà¥à¤ªà¥à¤°à¤¯à¥‹à¤—ों के साथ उपयोग के लिठअपने रिमोट नियंतà¥à¤°à¤£ को कॉनà¥à¤«à¤¼à¤¿à¤—र करें +Comment[hu]=Az infravörös távirányÃtók jellemzÅ‘i +Comment[is]=Her má stilla fjarstýringar ýmissa forrita +Comment[it]=Configura i telecomandi per l'uso con le applicazioni +Comment[ja]=アプリケーションã§ä½¿ç”¨ã™ã‚‹ãƒªãƒ¢ãƒ¼ãƒˆã‚³ãƒ³ãƒˆãƒãƒ¼ãƒ«ã‚’è¨å®š +Comment[ka]=დáƒáƒáƒ™áƒáƒœáƒ¤áƒ˜áƒ’ურირეთ თქვენი დáƒáƒ¨áƒáƒ ებული მáƒáƒ თვრáƒáƒ› პრáƒáƒ’რáƒáƒ›áƒ˜áƒ— +Comment[kk]=Қашықтан баÑқаруды қолданбалармен қолдану үшін баптау +Comment[km]=កំណážáŸ‹â€‹ážšáž…នាសម្ពáŸáž“្ធ​ការបញ្ជា​ពី​ចម្ងាយ​របស់​អ្នក សម្រាប់​ការប្រើ​ជាមួយនឹង​កម្មវិធី +Comment[lt]=Nuotolinio valdymo programomis konfigÅ«ravimas +Comment[mk]=Конфигурирајте ги вашите далечинÑки управувачи за кориÑтење Ñо апликации +Comment[nb]=Sett opp fjernkontroll for bruk mot programmer +Comment[nds]=Feernbedeners för den Bruuk mit Programmen instellen +Comment[ne]=अनà¥à¤ªà¥à¤°à¤¯à¥‹à¤—सà¤à¤— पà¥à¤°à¤¯à¥‹à¤— गरà¥à¤¨ तपाईंको टाढाको नियनà¥à¤¤à¥à¤°à¤£ कनà¥à¤«à¤¿à¤—र गरà¥à¤¨à¥à¤¹à¥‹à¤¸à¥ +Comment[nl]=Uw afstandsbedieningen instellen voor gebruik in TDE +Comment[nn]=Set opp bruken av fjernkontroll i ulike program +Comment[pa]=ਕਾਰਜਾਂ ਨਾਲ ਵਰਤਣ ਲਈ ਆਪਣੇ ਰਿਮੋਟ ਕੰਟਰੋਲ ਦੀ ਸੰਰਚਨਾ ਕਰੋ +Comment[pl]=Konfiguruje piloty do użycia w programach +Comment[pt]=Configure os seus comandos à distância para os usar nas aplicações +Comment[pt_BR]=Configura seus controles remotos para o uso com as aplicações +Comment[ro]=Configurează telecomneziile de utilizat cu aplicaÅ£ii +Comment[ru]=ÐаÑтройка удалённого ÑƒÐ¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ð¿Ñ€Ð¸Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñми +Comment[sk]=Nastavenie diaľkového ovládania pre vaÅ¡e aplikácie +Comment[sl]=Nastavite vaÅ¡ daljinski upravljalnik za uporabo v programih +Comment[sr]=ПодеÑите контроле вашег даљинÑког управљача за употребу у програмима +Comment[sr@Latn]=Podesite kontrole vaÅ¡eg daljinskog upravljaÄa za upotrebu u programima +Comment[sv]=Ställ in fjärrkontroller att använda med program +Comment[ta]=பயனà¯à®ªà®¾à®Ÿà¯à®•à®³à¯à®Ÿà®©à¯ பயனà¯à®ªà®Ÿà¯à®¤à¯à®¤ தொலைதூர கடà¯à®Ÿà¯à®ªà¯à®ªà®¾à®Ÿà¯à®•à®³à¯ˆ வடிவமை +Comment[tg]=Ба воÑитаи замимаҳо танзимкунии идоракунии дурдаÑти шумо +Comment[tr]=Uzaktan kontrol ayarlarınızı uygulamalarla kullanmak için ayarla +Comment[uk]=ÐÐ°Ð»Ð°ÑˆÑ‚ÑƒÐ²Ð°Ð½Ð½Ñ ÐµÐ»ÐµÐ¼ÐµÐ½Ñ‚Ñ–Ð² диÑтанційного ÐºÐµÑ€ÑƒÐ²Ð°Ð½Ð½Ñ Ð´Ð»Ñ Ð²Ð¸ÐºÐ¾Ñ€Ð¸ÑÑ‚Ð°Ð½Ð½Ñ Ð· програмами +Comment[zh_CN]=é…置您的远程控制以供应用程åºä½¿ç”¨ +Comment[zh_TW]=è¨å®šé™æŽ§æŒ‰éµèˆ‡æ‡‰ç”¨ç¨‹å¼çš„é—œè¯ +Exec=tdecmshell kcmlirc +Keywords=KCMLirc,kcmlirc +Keywords[bg]=диÑтанционно уÑтройÑтво, диÑтанционно, инфрачервени, лъчи, KCMLirc, kcmlirc +Keywords[nl]=kcmlirc,linux infrarood,infrarood,afstandsbediening +Keywords[pl]=KCMLirc,kcmlirc,piloty,podczerwieÅ„ +Keywords[pt]=kcmlirc +Keywords[ta]= KCMLirc,kcmlirc +Keywords[uz]=KCMLirc,kcmlirc,infraqizil nur +Keywords[uz@cyrillic]=KCMLirc,kcmlirc,инфрақизил нур +Name=Remote Controls +Name[ar]=التØكّم عن بعد +Name[bg]=ДиÑтанционно +Name[bs]=Daljinsko upravljanje +Name[ca]=Controls remots +Name[cs]=Dálková ovládánà +Name[cy]=Rheolyddion Pell +Name[da]=Fjernbetjeninger +Name[de]=Fernsteuerungen +Name[el]=ΤηλεχειÏιστήÏια +Name[eo]=Teleregiloj +Name[es]=Controles remotos +Name[et]=Kaugjuhtimine +Name[eu]=Urruneko Aginteak +Name[fa]=کنترلهای از راه دور +Name[fi]=Kauko-ohjaimet +Name[fr]=Contrôleurs distants +Name[ga]=Cianrialtáin +Name[he]=שליטה מרחוק +Name[hi]=रिमोट नियंतà¥à¤°à¤£ +Name[hu]=TávirányÃtó +Name[is]=Fjarstýringar +Name[it]=Telecomandi +Name[ja]=リモートコントãƒãƒ¼ãƒ« +Name[ka]=დáƒáƒ¨áƒáƒ ებული მáƒáƒ თვრ+Name[kk]=Қашықтан баÑқару +Name[km]=បញ្ជា​ពី​ចម្ងាយ +Name[lt]=Nuotolinis valdymas +Name[mk]=ДалечинÑки управувачи +Name[nb]=Fjernkontroll +Name[nds]=Feernbedeners +Name[ne]=टाढाको नियनà¥à¤¤à¥à¤°à¤£ +Name[nl]=Afstandsbediening +Name[nn]=Fjernkontrollar +Name[pa]=ਰਿਮੋਟ ਕੰਟਰੋਲ +Name[pl]=Piloty +Name[pt]=Comandos à Distância +Name[pt_BR]=Controles Remotos +Name[ro]=Telecomenzi +Name[ru]=Удалённое управление +Name[sk]=Diaľkový ovládaÄ +Name[sl]=Daljinski upravljalci +Name[sr]=ДаљинÑки управљачи +Name[sr@Latn]=Daljinski upravljaÄi +Name[sv]=Fjärrkontroller +Name[ta]= தொலைதூர கடà¯à®Ÿà¯à®ªà¯à®ªà®¾à®Ÿà¯à®•à®³à¯ +Name[tg]=Идоракунии ДурдаÑÑ‚ +Name[tr]=Uzaktan Kontroller +Name[uk]=Елементи диÑтанційного ÐºÐµÑ€ÑƒÐ²Ð°Ð½Ð½Ñ +Name[zh_CN]=远程控制 +Name[zh_TW]=é™æŽ§éµ +Terminal=false +Type=Application +X-TDE-FactoryName=kcmlirc +X-TDE-Library=kcmlirc +X-TDE-ModuleType=Library +DocPath=kcmlirc/index.html +Categories=Qt;TDE;X-TDE-settings-peripherals; diff --git a/tdelirc/kcmlirc/kcmlirc.h b/tdelirc/kcmlirc/kcmlirc.h new file mode 100644 index 0000000..207c995 --- /dev/null +++ b/tdelirc/kcmlirc/kcmlirc.h @@ -0,0 +1,85 @@ +/*************************************************************************** + * Copyright (C) 2003 by Gav Wood * + * gav@kde.org + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#ifndef _KCMLIRC_H_ +#define _KCMLIRC_H_ + +#include <tqstringlist.h> +#include <tqmap.h> + +#include <tdecmodule.h> + +#include <dcopobject.h> + +#include "kcmlircbase.h" +#include "iractions.h" +#include "modes.h" + +class TQListViewItem; +class TDEListView; +class TQDropEvent; +class Profile; +class Remote; + +class KCMLirc: public TDECModule, virtual public DCOPObject +{ + Q_OBJECT +// + K_DCOP + +private: + KCMLircBase *theKCMLircBase; + IRActions allActions; + Modes allModes; + TQMap<TQListViewItem *, IRAIt > actionMap; + TQMap<TQListViewItem *, Mode> modeMap; + TQMap<TQListViewItem *, TQString> profileMap, remoteMap; + + void autoPopulate(const Profile &profile, const Remote &remote, const TQString &mode); + +public slots: + void updateActions(); + void updateModesStatus(TQListViewItem *); + void updateActionsStatus(TQListViewItem *); + void updateModes(); + void updateExtensions(); + void updateInformation(); + void slotAddMode(); + void slotRemoveMode(); + void slotSetDefaultMode(); + void slotAddAction(); + void slotAddActions(); + void slotEditAction(); + void slotRemoveAction(); + void slotDrop(TDEListView *, TQDropEvent *, TQListViewItem *, TQListViewItem *after); + void slotRenamed(TQListViewItem *item); + void slotEditMode(); + +#ifndef Q_MOC_RUN +// MOC_SKIP_BEGIN +k_dcop: +// MOC_SKIP_END +#endif + // now just used as a proxy to AddAction class + virtual void gotButton(TQString remote, TQString button); +signals: + void haveButton(const TQString &remote, const TQString &button); + +public: + virtual void load(); + virtual void save(); + virtual void defaults(); + virtual void configChanged(); + + KCMLirc(TQWidget *parent = 0, const char *name = 0, TQStringList args = TQStringList()); + ~KCMLirc(); +}; + +#endif diff --git a/tdelirc/kcmlirc/kcmlircbase.ui b/tdelirc/kcmlirc/kcmlircbase.ui new file mode 100644 index 0000000..b5b21bf --- /dev/null +++ b/tdelirc/kcmlirc/kcmlircbase.ui @@ -0,0 +1,506 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>KCMLircBase</class> +<author>Gav Wood</author> +<widget class="TQWidget"> + <property name="name"> + <cstring>KCMLircBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>469</width> + <height>326</height> + </rect> + </property> + <property name="caption"> + <string>Linux Infrared Remote Control</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="TQTabWidget" row="0" column="0"> + <property name="name"> + <cstring>tabWidget2</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="TQWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Controller Functions</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>theMainLabel</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="paletteForegroundColor"> + <color> + <red>138</red> + <green>0</green> + <blue>0</blue> + </color> + </property> + <property name="font"> + <font> + <bold>1</bold> + </font> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="margin"> + <number>1</number> + </property> + <property name="text"> + <string>There are currently no remote controls available. You must first set up LIRC correctly; see www.lirc.org for more information.</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignTop</set> + </property> + </widget> + <widget class="TQSplitter"> + <property name="name"> + <cstring>splitter4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>modeLayout</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>theRemotesLabel</cstring> + </property> + <property name="text"> + <string>Remote controls and modes:</string> + </property> + </widget> + <widget class="TDEListView"> + <column> + <property name="text"> + <string>New Column</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>New Column</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>theModes</cstring> + </property> + <property name="acceptDrops"> + <bool>true</bool> + </property> + <property name="rootIsDecorated"> + <bool>true</bool> + </property> + <property name="itemsRenameable"> + <bool>true</bool> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>modeButtonLayout</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>17</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KPushButton"> + <property name="name"> + <cstring>theAddMode</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>&Add...</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>theEditMode</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>&Edit...</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>theRemoveMode</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>&Remove</string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout9</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>theModeLabel</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="TDEListView"> + <column> + <property name="text"> + <string>Button</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Program</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Function</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Options</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Notes</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>theActions</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>2</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="dragAutoScroll"> + <bool>true</bool> + </property> + <property name="selectionMode" stdset="0"> + <enum>FileManager</enum> + </property> + <property name="dragEnabled"> + <bool>true</bool> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout7</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>240</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout6</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton" row="0" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>theAddActions</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Auto-Populate...</string> + </property> + <property name="accel"> + <string></string> + </property> + </widget> + <widget class="KPushButton" row="1" column="0"> + <property name="name"> + <cstring>theAddAction</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>A&dd...</string> + </property> + </widget> + <widget class="TQPushButton" row="1" column="1"> + <property name="name"> + <cstring>theEditAction</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Ed&it...</string> + </property> + </widget> + <widget class="KPushButton" row="1" column="2"> + <property name="name"> + <cstring>theRemoveAction</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Re&move</string> + </property> + </widget> + </grid> + </widget> + </hbox> + </widget> + </vbox> + </widget> + </widget> + </vbox> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Loaded Extensions</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQSplitter" row="0" column="0"> + <property name="name"> + <cstring>splitter5</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <widget class="TDEListView"> + <column> + <property name="text"> + <string>Name</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>theExtensions</cstring> + </property> + <property name="rootIsDecorated"> + <bool>true</bool> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout9</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>theInformationLabel</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="TDEListView"> + <column> + <property name="text"> + <string>Name</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Information</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>theInformation</cstring> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + </vbox> + </widget> + </widget> + </grid> + </widget> + </widget> + </grid> +</widget> +<includes> + <include location="local" impldecl="in implementation">kcmlircbase.ui.h</include> +</includes> +<functions> + <function access="private" specifier="non virtual">init()</function> +</functions> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>tdelistview.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>tdelistview.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>tdelistview.h</includehint> + <includehint>tdelistview.h</includehint> +</includehints> +</UI> diff --git a/tdelirc/kcmlirc/kcmlircbase.ui.h b/tdelirc/kcmlirc/kcmlircbase.ui.h new file mode 100644 index 0000000..dcf2ec3 --- /dev/null +++ b/tdelirc/kcmlirc/kcmlircbase.ui.h @@ -0,0 +1,37 @@ +/*************************************************************************** + * Copyright (C) 2003 by Gav Wood * + * gav@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename functions or slots use +** TQt Designer which will update this file, preserving your code. Create an +** init() function in place of a constructor, and a destroy() function in +** place of a destructor. +*****************************************************************************/ + +#include "modeslist.h" + +void KCMLircBase::init() +{ + delete theModes; + modeLayout->removeItem(modeButtonLayout); + theModes = new ModesList(TQT_TQWIDGET(modeLayout->parent()), "theModes"); + theModes->addColumn(i18n("Remote Control")); + theModes->addColumn(i18n("Default")); + theModes->addColumn(i18n("Icon")); + theModes->setAcceptDrops(true); + theModes->setRootIsDecorated(true); + theModes->setItemsRenameable(true); + modeLayout->addWidget(theModes); + modeLayout->addLayout(modeButtonLayout); + modeLayout->invalidate(); + modeLayout->activate(); +} diff --git a/tdelirc/kcmlirc/modeslist.cpp b/tdelirc/kcmlirc/modeslist.cpp new file mode 100644 index 0000000..1665e64 --- /dev/null +++ b/tdelirc/kcmlirc/modeslist.cpp @@ -0,0 +1,33 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include <tqwidget.h> + +#include <kdebug.h> + +#include "modeslist.h" + +ModesList::ModesList(TQWidget *parent, const char *name) : TDEListView(parent, name) +{ + setAcceptDrops(true); + setDropVisualizer(false); + setDropHighlighter(true); +} + +bool ModesList::acceptDrag(TQDropEvent *) const +{ + // TODO: make safer by checking source/mime type + // TODO: make safer by only allowing drops on the correct remote control's modes + return true; +} + +#include "modeslist.moc" diff --git a/tdelirc/kcmlirc/modeslist.h b/tdelirc/kcmlirc/modeslist.h new file mode 100644 index 0000000..d6a4b25 --- /dev/null +++ b/tdelirc/kcmlirc/modeslist.h @@ -0,0 +1,34 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef MODESLIST_H +#define MODESLIST_H + +#include <tdelistview.h> + +#include <tdelistview.h> + +/** + +@author Gav Wood +*/ + +class ModesList : public TDEListView +{ + Q_OBJECT + +public: + virtual bool acceptDrag(TQDropEvent *) const; + ModesList(TQWidget *parent = 0, const char *name = 0); +}; + +#endif diff --git a/tdelirc/kcmlirc/newmode.ui b/tdelirc/kcmlirc/newmode.ui new file mode 100644 index 0000000..811b493 --- /dev/null +++ b/tdelirc/kcmlirc/newmode.ui @@ -0,0 +1,158 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>NewMode</class> +<widget class="TQDialog"> + <property name="name"> + <cstring>NewMode</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>309</width> + <height>341</height> + </rect> + </property> + <property name="caption"> + <string>New Mode</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TDEListView"> + <column> + <property name="text"> + <string>Remote Controls</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>theRemotes</cstring> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout11</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>textLabel5</cstring> + </property> + <property name="text"> + <string>Name:</string> + </property> + </widget> + <widget class="TQLineEdit"> + <property name="name"> + <cstring>theName</cstring> + </property> + </widget> + </hbox> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>line2</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout12</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer7</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>61</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="KPushButton"> + <property name="name"> + <cstring>kPushButton6</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>&OK</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>kPushButton5</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>kPushButton6</sender> + <signal>clicked()</signal> + <receiver>NewMode</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>kPushButton5</sender> + <signal>clicked()</signal> + <receiver>NewMode</receiver> + <slot>reject()</slot> + </connection> + <connection> + <sender>theName</sender> + <signal>textChanged(const TQString&)</signal> + <receiver>NewMode</receiver> + <slot>slotTextChanged(const TQString&)</slot> + </connection> +</connections> +<includes> + <include location="local" impldecl="in implementation">newmode.ui.h</include> +</includes> +<Q_SLOTS> + <slot>slotTextChanged( const TQString & newText )</slot> +</Q_SLOTS> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>tdelistview.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/tdelirc/kcmlirc/newmode.ui.h b/tdelirc/kcmlirc/newmode.ui.h new file mode 100644 index 0000000..29c4166 --- /dev/null +++ b/tdelirc/kcmlirc/newmode.ui.h @@ -0,0 +1,24 @@ +/*************************************************************************** + * Copyright (C) 2003 by Gav Wood * + * gav@kde.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename functions or slots use +** TQt Designer which will update this file, preserving your code. Create an +** init() function in place of a constructor, and a destroy() function in +** place of a destructor. +*****************************************************************************/ + + +void NewMode::slotTextChanged( const TQString &newText ) +{ + kPushButton6->setEnabled(newText != ""); +} diff --git a/tdelirc/kcmlirc/selectprofile.ui b/tdelirc/kcmlirc/selectprofile.ui new file mode 100644 index 0000000..911deb4 --- /dev/null +++ b/tdelirc/kcmlirc/selectprofile.ui @@ -0,0 +1,128 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>SelectProfile</class> +<widget class="TQDialog"> + <property name="name"> + <cstring>SelectProfile</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>263</width> + <height>328</height> + </rect> + </property> + <property name="caption"> + <string>Select Profile to Add</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TDEListView"> + <column> + <property name="text"> + <string>Profile Name</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>theProfiles</cstring> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>line8</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout47</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer53</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KPushButton"> + <property name="name"> + <cstring>kPushButton12</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>&OK</string> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>kPushButton13</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<customwidgets> +</customwidgets> +<connections> + <connection> + <sender>kPushButton12</sender> + <signal>clicked()</signal> + <receiver>SelectProfile</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>kPushButton13</sender> + <signal>clicked()</signal> + <receiver>SelectProfile</receiver> + <slot>reject()</slot> + </connection> +</connections> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>tdelistview.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/tdelirc/profiles/CMakeLists.txt b/tdelirc/profiles/CMakeLists.txt new file mode 100644 index 0000000..7fedebd --- /dev/null +++ b/tdelirc/profiles/CMakeLists.txt @@ -0,0 +1,16 @@ +################################################# +# +# (C) 2012 Golubev Alexander +# fatzer2 (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +install( FILES profile.dtd noatun.profile.xml + tdelauncher.profile.xml konqueror.profile.xml + DESTINATION ${DATA_INSTALL_DIR}/profiles +) + diff --git a/tdelirc/profiles/Makefile.am b/tdelirc/profiles/Makefile.am new file mode 100644 index 0000000..9561d73 --- /dev/null +++ b/tdelirc/profiles/Makefile.am @@ -0,0 +1,5 @@ +profiledata_DATA = profile.dtd noatun.profile.xml tdelauncher.profile.xml konqueror.profile.xml +profiledatadir = $(kde_datadir)/profiles + +EXTRA_DIST = $(profiledata_DATA) + diff --git a/tdelirc/profiles/konqueror.profile.xml b/tdelirc/profiles/konqueror.profile.xml new file mode 100644 index 0000000..0fdfdba --- /dev/null +++ b/tdelirc/profiles/konqueror.profile.xml @@ -0,0 +1,17 @@ +<?xml version="1.0"?> +<!DOCTYPE profile SYSTEM "profile.dtd"> + +<profile id="konqueror" servicename="konqueror"> + <name>Konqueror</name> + <author>Gav Wood</author> + <instances uniqueapp="0" ifmulti="sendtotop"/> + <action objid="KonquerorIface" prototype="void createNewWindow(QString)" repeat="0" autostart="0"> + <name>Create New Window</name> + <comment>Creates a new window and loads an arbitrary URL.</comment> + <argument type=TQSTRING_OBJECT_NAME_STRING><comment>The URL to load in the window initially.</comment></argument> + </action> + <action objid="MainApplication-Interface" prototype="void quit()" repeat="0" autostart="0"> + <name>Quit</name> + <comment>Closes the Konqueror window.</comment> + </action> +</profile> diff --git a/tdelirc/profiles/noatun.profile.xml b/tdelirc/profiles/noatun.profile.xml new file mode 100644 index 0000000..a9b204b --- /dev/null +++ b/tdelirc/profiles/noatun.profile.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" ?> +<!DOCTYPE profile SYSTEM "profile.dtd"> + +<profile id="noatun" servicename="noatun"> + <name>Noatun</name> + <author>Gav Wood</author> + <action objid="Noatun" prototype="void playpause()" class="pause"> + <name>Play/Pause</name> + <comment>Toggles the current track between playing and pausing.</comment> + </action> + <action objid="Noatun" prototype="void stop()" class="stop"> + <name>Stop</name> + <comment>Stops current playback, if any.</comment> + </action> + <action objid="Noatun" prototype="void clear()" class="eject"> + <name>Clear Playlist</name> + <comment>Clears the playlist of all items.</comment> + </action> + <action objid="Noatun" prototype="void back()" class="previous"> + <name>Back</name> + <comment>Skips to the start of the last track.</comment> + </action> + <action objid="Noatun" prototype="void forward()" class="next"> + <name>Forward</name> + <comment>Skips to the start of the next track.</comment> + </action> + <action objid="Noatun" prototype="void loop()"> + <name>Playback Mode</name> + <comment>Cycles through the playback modes of Noatun.</comment> + </action> + <action objid="Noatun" prototype="void play()" class="play"> + <name>Play</name> + <comment>Starts playback.</comment> + </action> + <action objid="Noatun" prototype="void removeCurrent()"> + <name>Remove Current</name> + <comment>Removes only the current track from the play list.</comment> + </action> + <action objid="Noatun" prototype="void toggleMute()" class="mute"> + <name>Mute</name> + <comment>Toggle sound muting</comment> + </action> + <action objid="Noatun" prototype="void volumeUp()" class="volumeup" repeat="1"> + <name>Volume Up</name> + <comment>Increase volume</comment> + </action> + <action objid="Noatun" prototype="void volumeDown()" class="volumedown" repeat="1"> + <name>Volume Down</name> + <comment>Decrease volume</comment> + </action> + <action objid="Noatun" prototype="void setVolume(int volume)"> + <name>Set Volume</name> + <comment>Sets the volume to a configurable amount.</comment> + <argument type="int"> + <comment>The required percentage of the volume.</comment> + <range min="0" max="100"/> + </argument> + </action> + <action objid="Noatun" prototype="void toggleListView()"> + <name>Toggle Playlist View</name> + <comment>Toggles the visiblility of the playlist window.</comment> + </action> + <action objid="Noatun" prototype="void skipto(int)"> + <name>Skip To</name> + <comment>Skips to a configurable point in the current track.</comment> + <argument type="int"> + <comment>The percentage of the track to move through.</comment> + <range min="0" max="100"/> + </argument> + </action> + <action objid="MainApplication-Interface" prototype="void quit()" class="off"> + <name>Quit</name> + <comment>Exit Noatun</comment> + </action> +</profile> diff --git a/tdelirc/profiles/profile.dtd b/tdelirc/profiles/profile.dtd new file mode 100644 index 0000000..070fd14 --- /dev/null +++ b/tdelirc/profiles/profile.dtd @@ -0,0 +1,28 @@ +<!DOCTYPE profile [ + +<!ELEMENT profile (action+, name, author)> +<!ELEMENT name (#PCDATA)> +<!ELEMENT author (#PCDATA)> +<!ELEMENT action (name, comment, argument*)> +<!ELEMENT argument (comment, range?, default?)> +<!ELEMENT comment (#PCDATA)> +<!ELEMENT type (#PCDATA)> +<!ELEMENT instances> +<!ELEMENT default (#PCDATA)> + +<!ATTLIST profile id CDATA #REQUIRED> +<!ATTLIST profile servicename CDATA #REQUIRED> +<!ATTLIST action objid CDATA #REQUIRED> +<!ATTLIST action prototype CDATA #REQUIRED> +<!ATTLIST argument type (int|QString|QCString|QStringList|bool|double) #REQUIRED> +<!ATTLIST range min CDATA #REQUIRED> +<!ATTLIST range max CDATA #REQUIRED> +<!ATTLIST action class (captions|teletext|fullscreen|scan|finetuneup|finetunedown|recall|enter|number|play|stop|pause|record|previous|next|rewind|forward|eject|mute|volumedown|volumeup|channeldown|channelup|red|yellow|green|blue|on|off) #IMPLIED> +<!ATTLIST action multiplier CDATA "1" #IMPLIED> +<!ATTLIST action repeat (0|1) "0"> +<!ATTLIST instances uniqueapp (0|1) "1" #REQUIRED> +<!ATTLIST instances ifmulti (sendtotop|sendtobottom|sendtoall|dontsend) "dontsend"> + +]> + + diff --git a/tdelirc/profiles/tdelauncher.profile.xml b/tdelirc/profiles/tdelauncher.profile.xml new file mode 100644 index 0000000..57eca31 --- /dev/null +++ b/tdelirc/profiles/tdelauncher.profile.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" ?> +<!DOCTYPE profile SYSTEM "profile.dtd"> +<profile id="tdelauncher"> + <name>TDE Program Launcher</name> + <author>Gav Wood</author> + <action objid="default" prototype="void tdeinit_exec(QString, QStringList)" repeat="0" autostart="0"> + <name>Execute</name> + <comment>Runs a program or script</comment> + <argument type=TQSTRING_OBJECT_NAME_STRING><comment>The executable name and path of the program or script to run</comment></argument> + <argument type=TQSTRINGLIST_OBJECT_NAME_STRING><comment>Parameters for the program or script</comment></argument> + </action> + <action objid="default" prototype="void tdeinit_exec_wait(QString, QStringList)" repeat="0" autostart="0"> + <name>Execute and Wait</name> + <comment>Runs a program or script and waits for it to finish</comment> + <argument type=TQSTRING_OBJECT_NAME_STRING><comment>The executable name and path of the program or script to run</comment></argument> + <argument type=TQSTRINGLIST_OBJECT_NAME_STRING><comment>Parameters for the program or script</comment></argument> + </action> +</profile> diff --git a/tdelirc/remotes/CMakeLists.txt b/tdelirc/remotes/CMakeLists.txt new file mode 100644 index 0000000..d681539 --- /dev/null +++ b/tdelirc/remotes/CMakeLists.txt @@ -0,0 +1,18 @@ +################################################# +# +# (C) 2012 Golubev Alexander +# fatzer2 (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +install( FILES RM-0010.remote.xml + cimr100.remote.xml sherwood.remote.xml + hauppauge.remote.xml sonytv.remote.xml + remote.dtd + DESTINATION ${DATA_INSTALL_DIR}/remotes +) + diff --git a/tdelirc/remotes/Makefile.am b/tdelirc/remotes/Makefile.am new file mode 100644 index 0000000..b040270 --- /dev/null +++ b/tdelirc/remotes/Makefile.am @@ -0,0 +1,6 @@ +remotedata_DATA = RM-0010.remote.xml cimr100.remote.xml sherwood.remote.xml \ + hauppauge.remote.xml sonytv.remote.xml remote.dtd +remotedatadir = $(kde_datadir)/remotes + +EXTRA_DIST = $(remotedata_DATA) + diff --git a/tdelirc/remotes/RM-0010.remote.xml b/tdelirc/remotes/RM-0010.remote.xml new file mode 100644 index 0000000..64146e5 --- /dev/null +++ b/tdelirc/remotes/RM-0010.remote.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" ?> +<!DOCTYPE remote SYSTEM "remote.dtd"> + +<remote id="RM-0010"> + <name>Leadtek CoolCommand RM-0010</name> + <author>Zsolt Rizsanyi</author> + <button id="0" class="number" parameter="0"/> + <button id="1" class="number" parameter="1"/> + <button id="2" class="number" parameter="2"/> + <button id="3" class="number" parameter="3"/> + <button id="4" class="number" parameter="4"/> + <button id="5" class="number" parameter="5"/> + <button id="6" class="number" parameter="6"/> + <button id="7" class="number" parameter="7"/> + <button id="8" class="number" parameter="8"/> + <button id="9" class="number" parameter="9"/> + <button id="POWER" class="off"><name>Power</name></button> + <button id="TV/FM"><name>TV/FM</name></button> + <button id="SCAN" class="scan"><name>Scan</name></button> + <button id="DISPLAY"><name>Display</name></button> + <button id="RECALL" class="recall"><name>Recall</name></button> + <button id="ENTER" class="enter"><name>Enter</name></button> + <button id="CC" class="captions"><name>Closed Captions</name></button> + <button id="MTS"><name>MTS</name></button> + <button id="FINE_DOWN" class="finetunedown"><name>Fine Tune Down</name></button> + <button id="FINE_UP" class="finetuneup"><name>Fine Tune Up</name></button> + <button id="VIDEO"><name>Video</name></button> + <button id="MUTE" class="mute"><name>Mute</name></button> + <button id="CH_UP" class="channelup"><name>Channel Up</name></button> + <button id="CH_DOWN" class="channeldown"><name>Channel Down</name></button> + <button id="VOL_UP" class="volumeup"><name>Volume Up</name></button> + <button id="VOL_DOWN" class="volumedown"><name>Volume Down</name></button> + <button id="FULLSCREEN" class="fullscreen"><name>Full Screen</name></button> + <button id="SLEEP"><name>Sleep</name></button> + <button id="BOSS_KEY"><name>Boss key</name></button> + <button id="RED" class="red"><name>Red</name></button> + <button id="GREEN" class="green"><name>Green</name></button> + <button id="YELLOW" class="yellow"><name>Yellow</name></button> + <button id="BLUE" class="blue"><name>Blue</name></button> + <button id="PIP"><name>Pip</name></button> + <button id="."><name>Dot (.)</name></button> + <button id="BACK" class="previous"><name>Back</name></button> + <button id="PLAY" class="play"><name>Play</name></button> + <button id="NEXT" class="next"><name>Next</name></button> + <button id="TIMESHIFT"><name>Timeshift</name></button> + <button id="STOP" class="stop"><name>Stop</name></button> + <button id="REC" class="record"><name>Record</name></button> + <button id="SNAPSHOT"><name>Snapshot</name></button> +</remote> diff --git a/tdelirc/remotes/cimr100.remote.xml b/tdelirc/remotes/cimr100.remote.xml new file mode 100644 index 0000000..5dfc36d --- /dev/null +++ b/tdelirc/remotes/cimr100.remote.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" ?> +<!DOCTYPE remote SYSTEM "remote.dtd"> + +<remote id="cimr100"> + <name>Creative CIMR-100</name> + <author>Gav Wood</author> + <button id="0" class="number" parameter="0"/> + <button id="1" class="number" parameter="1"/> + <button id="2" class="number" parameter="2"/> + <button id="3" class="number" parameter="3"/> + <button id="4" class="number" parameter="4"/> + <button id="5" class="number" parameter="5"/> + <button id="6" class="number" parameter="6"/> + <button id="7" class="number" parameter="7"/> + <button id="8" class="number" parameter="8"/> + <button id="9" class="number" parameter="9"/> + <button id="back" class="previous"><name>Back</name></button> + <button id="eject" class="eject"><name>Eject</name></button> + <button id="fastforward" class="forward"><name>Fast Forward</name></button> + <button id="mouse"><name>Mouse</name></button> + <button id="mute" class="mute"><name>Mute</name></button> + <button id="pause" class="pause"><name>Pause</name></button> + <button id="play" class="play"><name>Play</name></button> + <button id="next" class="next"><name>Next</name></button> + <button id="rewind" class="rewind"><name>Rewind</name></button> + <button id="shift"><name>Shift</name></button> + <button id="start"><name>Start</name></button> + <button id="stop" class="stop"><name>Stop</name></button> + <button id="voldown" class="volumedown"><name>Volume Down</name></button> + <button id="volup" class="volumeup"><name>Volume Up</name></button> +</remote> diff --git a/tdelirc/remotes/hauppauge.remote.xml b/tdelirc/remotes/hauppauge.remote.xml new file mode 100644 index 0000000..4d2a402 --- /dev/null +++ b/tdelirc/remotes/hauppauge.remote.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" ?> +<!DOCTYPE remote SYSTEM "remote.dtd"> + +<remote id="Hauppauge"> + <name>Hauppauge</name> + <author>Dirk Ziegelmeier</author> + <information>Bundled with WinTV PCI, PVR</information> + <button id="0" class="number" parameter="0"/> + <button id="1" class="number" parameter="1"/> + <button id="2" class="number" parameter="2"/> + <button id="3" class="number" parameter="3"/> + <button id="4" class="number" parameter="4"/> + <button id="5" class="number" parameter="5"/> + <button id="6" class="number" parameter="6"/> + <button id="7" class="number" parameter="7"/> + <button id="8" class="number" parameter="8"/> + <button id="9" class="number" parameter="9"/> + <button id="TV"><name>TV</name></button> + <button id="RADIO"><name>Radio</name></button> + <button id="CH-" class="channeldown"><name>Channel Down</name></button> + <button id="CH+" class="channelup"><name>Channel Up</name></button> + <button id="VOL-" class="volumedown"><name>Volume Down</name></button> + <button id="VOL+" class="volumeup"><name>Volume Up</name></button> + <button id="MUTE" class="mute"><name>Mute</name></button> + <button id="SOURCE"><name>Source</name></button> + <button id="FULL_SCREEN" class="fullscreen"><name>Fullscreen</name></button> + <button id="RESERVED"><name>Reserved</name></button> + <button id="MINIMIZE"><name>Minimize</name></button> +</remote> diff --git a/tdelirc/remotes/remote.dtd b/tdelirc/remotes/remote.dtd new file mode 100644 index 0000000..a09b4b6 --- /dev/null +++ b/tdelirc/remotes/remote.dtd @@ -0,0 +1,15 @@ +<!-- +<!DOCTYPE remote SYSTEM "remote.dtd"> +--> + +<!ELEMENT remote (name, author, information?, button+)> +<!ELEMENT button (name?)> +<!ELEMENT name (#PCDATA)> +<!ELEMENT author (#PCDATA)> +<!ELEMENT information (#PCDATA)> + +<!ATTLIST remote id CDATA #REQUIRED> +<!ATTLIST button id CDATA #REQUIRED> +<!ATTLIST button class (captions|teletext|fullscreen|scan|finetuneup|finetunedown|recall|enter|number|play|stop|pause|record|previous|next|rewind|forward|eject|mute|volumedown|volumeup|channeldown|channelup|red|yellow|green|blue|on|off) #IMPLIED> +<!ATTLIST button option (0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20) #IMPLIED> +<!ATTLIST button parameter CDATA #IMPLIED> diff --git a/tdelirc/remotes/sherwood.remote.xml b/tdelirc/remotes/sherwood.remote.xml new file mode 100644 index 0000000..db628ba --- /dev/null +++ b/tdelirc/remotes/sherwood.remote.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" ?> +<!DOCTYPE remote SYSTEM "remote.dtd"> + +<remote id="sherwood"> + <name>Sherwood RM-RD-61</name> + <author>Gav Wood</author> + <button id="0" class="number" parameter="0"/> + <button id="1" class="number" parameter="1"/> + <button id="2" class="number" parameter="2"/> + <button id="3" class="number" parameter="3"/> + <button id="4" class="number" parameter="4"/> + <button id="5" class="number" parameter="5"/> + <button id="6" class="number" parameter="6"/> + <button id="7" class="number" parameter="7"/> + <button id="8" class="number" parameter="8"/> + <button id="9" class="number" parameter="9"/> + <button id="6chdirect"><name>Input - 6 Channel Direct</name></button> + <button id="adjust"><name>Adjust</name></button> + <button id="auto"><name>Auto</name></button> + <button id="aux"><name>Input - Aux</name></button> + <button id="cd"><name>Input - CD</name></button> + <button id="chdown" class="channeldown"><name>Channel Down</name></button> + <button id="chup" class="channelup"><name>Channel Up</name></button> + <button id="chsel"><name>Channel Select</name></button> + <button id="decka"><name>Deck A Select</name></button> + <button id="deckb"><name>Deck B Select</name></button> + <button id="deckforward"><name>Deck - Forward</name></button> + <button id="deckpause"><name>Deck - Pause</name></button> + <button id="deckplay"><name>Deck - Play</name></button> + <button id="deckplayback"><name>Deck - Play Reverse</name></button> + <button id="deckrecord"><name>Deck - Record</name></button> + <button id="deckrewind"><name>Deck - Rewind</name></button> + <button id="deckstop"><name>Deck - Stop</name></button> + <button id="display"><name>Equalizer - Display</name></button> + <button id="displaysys"><name>System Display</name></button> + <button id="dspmode"><name>DSP Mode</name></button> + <button id="dtime"><name>Date Time</name></button> + <button id="file"><name>Equalizer - File</name></button> + <button id="masterdown"><name>Master Down</name></button> + <button id="masterup"><name>Master Up</name></button> + <button id="mute"><name>Mute</name></button> + <button id="preset"><name>Equalizer - Preset</name></button> + <button id="sleep"><name>Sleep</name></button> + <button id="stereo"><name>Stereo</name></button> + <button id="tapemon"><name>Input - Tape Monitor</name></button> + <button id="tmon"><name>Equalizer - Monitor</name></button> + <button id="ttone"><name>Test Tone</name></button> + <button id="tuner"><name>Input - Tuner</name></button> + <button id="user"><name>Equalizer - User</name></button> + <button id="video1"><name>Input - Video 1</name></button> + <button id="video2"><name>Input - Video 2</name></button> + <button id="video3"><name>Input - Video 3</name></button> + <button id="disc" class="eject"><name>CD Select</name></button> + <button id="discplay" class="play"><name>CD - Play</name></button> + <button id="discstop" class="stop"><name>CD - Stop</name></button> + <button id="discback" class="previous"><name>CD - Back</name></button> + <button id="discnext" class="next"><name>CD - Next</name></button> + <button id="discpause" class="pause"><name>CD - Pause</name></button> + <button id="discrepeat"><name>CD - Repeat</name></button> + <button id="discintro"><name>CD - Intro</name></button> +</remote> diff --git a/tdelirc/remotes/sonytv.remote.xml b/tdelirc/remotes/sonytv.remote.xml new file mode 100644 index 0000000..4e5ee97 --- /dev/null +++ b/tdelirc/remotes/sonytv.remote.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" ?> +<!DOCTYPE remote SYSTEM "remote.dtd"> + +<remote id="SONY-TV"> + <name>SonyTV</name> + <information>Bundled with some Sony TVs</information> + <author>Dirk Ziegelmeier</author> + <button id="0" class="number" parameter="0"/> + <button id="1" class="number" parameter="1"/> + <button id="2" class="number" parameter="2"/> + <button id="3" class="number" parameter="3"/> + <button id="4" class="number" parameter="4"/> + <button id="5" class="number" parameter="5"/> + <button id="6" class="number" parameter="6"/> + <button id="7" class="number" parameter="7"/> + <button id="8" class="number" parameter="8"/> + <button id="9" class="number" parameter="9"/> + <button id="TV"><name>TV</name></button> + <button id="CHANNELDOWN" class="channeldown"><name>Channel Down</name></button> + <button id="CHANNELUP" class="channelup"><name>Channel Up</name></button> + <button id="VOLUMEDOWN" class="volumedown"><name>Volume Down</name></button> + <button id="VOLUMEUP" class="volumeup"><name>Volume Up</name></button> + <button id="MUTE" class="mute"><name>Mute</name></button> + <button id="EXT"><name>EXT</name></button> + <button id="-/--"><name>-/--</name></button> + <button id="RED"><name>Red</name></button> + <button id="YELLOW"><name>Yellow</name></button> + <button id="BLUE"><name>Blue</name></button> + <button id="GREEN"><name>Green</name></button> +</remote> diff --git a/tdelirc/tdelirc/CMakeLists.txt b/tdelirc/tdelirc/CMakeLists.txt new file mode 100644 index 0000000..2893472 --- /dev/null +++ b/tdelirc/tdelirc/CMakeLists.txt @@ -0,0 +1,32 @@ +################################################# +# +# (C) 2012 Golubev Alexander +# fatzer2 (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### tdelirc (static) ########################## + +tde_add_library( tdelirc STATIC_PIC + SOURCES iraction.cpp arguments.cpp + iractions.cpp prototype.cpp modes.cpp + mode.cpp profileserver.cpp remoteserver.cpp +) + diff --git a/tdelirc/tdelirc/Makefile.am b/tdelirc/tdelirc/Makefile.am new file mode 100644 index 0000000..e488f85 --- /dev/null +++ b/tdelirc/tdelirc/Makefile.am @@ -0,0 +1,45 @@ +####### tdevelop will overwrite this part!!! (begin)########## +noinst_LTLIBRARIES = libtdelirc.la + +noinst_HEADERS = iraction.h arguments.h iractions.h prototype.h modes.h mode.h profileserver.h remoteserver.h + +libtdelirc_la_SOURCES = iraction.cpp arguments.cpp iractions.cpp prototype.cpp modes.cpp mode.cpp profileserver.cpp remoteserver.cpp +libtdelirc_la_LIBADD = $(LIB_QT) $(LIB_TDECORE) $(LIB_TDEUI) $(LIBSOCKET) + +####### tdevelop will overwrite this part!!! (end)############ +# These paths are TDE specific. Use them: +# kde_appsdir Where your application's menu entry (.desktop) should go to. +# kde_icondir Where your icon should go to - better use KDE_ICON. +# kde_sounddir Where your sounds should go to. +# kde_htmldir Where your docs should go to. (contains lang subdirs) +# kde_datadir Where you install application data. (Use a subdir) +# kde_locale Where translation files should go to. (contains lang subdirs) +# kde_cgidir Where cgi-bin executables should go to. +# kde_confdir Where config files should go to (system-wide ones with default values). +# kde_mimedir Where mimetypes .desktop files should go to. +# kde_servicesdir Where services .desktop files should go to. +# kde_servicetypesdir Where servicetypes .desktop files should go to. +# kde_toolbardir Where general toolbar icons should go to (deprecated, use KDE_ICON). +# kde_wallpaperdir Where general wallpapers should go to. +# kde_irkicksdir Where irkicks for the "New" menu (Konqueror/KDesktop) should go to. +# kde_bindir Where executables should go to. Use bin_PROGRAMS or bin_SCRIPTS. +# kde_libdir Where shared libraries should go to. Use lib_LTLIBRARIES. +# kde_moduledir Where modules (e.g. parts) should go to. Use kde_module_LTLIBRARIES. +# kde_styledir Where Qt/TDE widget styles should go to (new in KDE 3). +# kde_designerdir Where Qt Designer plugins should go to (new in KDE 3). + +# set the include path for X, qt and TDE +INCLUDES = $(all_includes) + +METASOURCES = AUTO + +# the library search path. +libtdelirc_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor + +# Uncomment the following two lines if you add a ui.rc file for your application to make use of +# KDE´s XML GUI builing +#rcdir = $(kde_datadir)/irkick +#rc_DATA = irkickui.rc + +messages: + $(XGETTEXT) *.cpp *.h -o $(podir)/tdelirc.pot diff --git a/tdelirc/tdelirc/arguments.cpp b/tdelirc/tdelirc/arguments.cpp new file mode 100644 index 0000000..fc678ce --- /dev/null +++ b/tdelirc/tdelirc/arguments.cpp @@ -0,0 +1,36 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include <tqstring.h> + +#include "arguments.h" + +Arguments::Arguments() +{ +} + +Arguments::~Arguments() +{ +} + +const TQString Arguments::toString() const +{ + TQString ret = ""; + for(Arguments::const_iterator i = begin(); i != end(); ++i) + { TQString s = (*i).toString(); + if(s.isNull()) s = "..."; + if(i != begin()) ret += ", "; + ret += s; + } + return ret; +} + diff --git a/tdelirc/tdelirc/arguments.h b/tdelirc/tdelirc/arguments.h new file mode 100644 index 0000000..dae1f5c --- /dev/null +++ b/tdelirc/tdelirc/arguments.h @@ -0,0 +1,32 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef ARGUMENTS_H +#define ARGUMENTS_H + +#include <tqvaluelist.h> +#include <tqvariant.h> + +/** +@author Gav Wood +*/ + +class Arguments : public TQValueList<TQVariant> +{ +public: + const TQString toString() const; + + Arguments(); + ~Arguments(); +}; + +#endif diff --git a/tdelirc/tdelirc/iraction.cpp b/tdelirc/tdelirc/iraction.cpp new file mode 100644 index 0000000..46b581f --- /dev/null +++ b/tdelirc/tdelirc/iraction.cpp @@ -0,0 +1,155 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// + +#include <tqvariant.h> + +#include <tdeconfig.h> +#include <tdelocale.h> + +#include "iraction.h" +#include "profileserver.h" +#include "remoteserver.h" + +IRAction::IRAction(const TQString &newProgram, const TQString &newObject, const TQString &newMethod, const Arguments &newArguments, const TQString &newRemote, const TQString &newMode, const TQString &newButton, const bool newRepeat, const bool newAutoStart, const bool newDoBefore, const bool newDoAfter, const bool newUnique, const IfMulti newIfMulti) +{ + theProgram = newProgram; + theObject = newObject; + theMethod = newMethod; + theArguments = newArguments; + theRemote = newRemote; + theMode = newMode; + theButton = newButton; + theRepeat = newRepeat; + theDoAfter = newDoAfter; + theDoBefore = newDoBefore; + theAutoStart = newAutoStart; + theUnique = newUnique; + theIfMulti = newIfMulti; +} + +const IRAction &IRAction::loadFromConfig(TDEConfig &theConfig, int index) +{ + TQString Binding = "Binding" + TQString().setNum(index); + int numArguments = theConfig.readNumEntry(Binding + "Arguments"); + theArguments.clear(); + for(int j = 0; j < numArguments; j++) + { TQVariant::Type theType = (TQVariant::Type)theConfig.readNumEntry(Binding + "ArgumentType" + TQString().setNum(j), TQVariant::String); + theArguments += theConfig.readPropertyEntry(Binding + "Argument" + TQString().setNum(j), theType == TQVariant::CString ? TQVariant::String : theType); + theArguments.last().cast(theType); + } + + theProgram = theConfig.readEntry(Binding + "Program"); + theObject = theConfig.readEntry(Binding + "Object"); + theMethod.setPrototype(theConfig.readEntry(Binding + "Method")); + theRemote = theConfig.readEntry(Binding + "Remote"); + theMode = theConfig.readEntry(Binding + "Mode"); + theButton = theConfig.readEntry(Binding + "Button"); + theRepeat = theConfig.readBoolEntry(Binding + "Repeat"); + theDoBefore = theConfig.readBoolEntry(Binding + "DoBefore"); + theDoAfter = theConfig.readBoolEntry(Binding + "DoAfter"); + theAutoStart = theConfig.readBoolEntry(Binding + "AutoStart"); + theUnique = theConfig.readBoolEntry(Binding + "Unique", true); + theIfMulti = (IfMulti)theConfig.readNumEntry(Binding + "IfMulti", IM_DONTSEND); + + return *this; +} + +void IRAction::saveToConfig(TDEConfig &theConfig, int index) const +{ + TQString Binding = "Binding" + TQString().setNum(index); + + theConfig.writeEntry(Binding + "Arguments", theArguments.count()); + for(unsigned j = 0; j < theArguments.count(); j++) + { TQVariant arg = theArguments[j]; + TQVariant::Type preType = arg.type(); + if(preType == TQVariant::CString) arg.cast(TQVariant::String); + theConfig.writeEntry(Binding + "Argument" + TQString().setNum(j), arg); + theConfig.writeEntry(Binding + "ArgumentType" + TQString().setNum(j), preType); + } + theConfig.writeEntry(Binding + "Program", theProgram); + theConfig.writeEntry(Binding + "Object", theObject); + theConfig.writeEntry(Binding + "Method", theMethod.prototype()); + theConfig.writeEntry(Binding + "Remote", theRemote); + theConfig.writeEntry(Binding + "Mode", theMode); + theConfig.writeEntry(Binding + "Button", theButton); + theConfig.writeEntry(Binding + "Repeat", theRepeat); + theConfig.writeEntry(Binding + "DoBefore", theDoBefore); + theConfig.writeEntry(Binding + "DoAfter", theDoAfter); + theConfig.writeEntry(Binding + "AutoStart", theAutoStart); + theConfig.writeEntry(Binding + "Unique", theUnique); + theConfig.writeEntry(Binding + "IfMulti", theIfMulti); +} + +const TQString IRAction::function() const +{ + ProfileServer *theServer = ProfileServer::profileServer(); + if(theProgram.isEmpty()) + if(theObject.isEmpty()) + return i18n("Exit mode"); + else + return i18n("Switch to %1").arg(theObject); + else + if(theObject.isEmpty()) + return i18n("Just start"); + else + { + const ProfileAction *a = theServer->getAction(theProgram, theObject, theMethod.prototype()); + if(a) + return a->name(); + else + return theObject + "::" + theMethod.name(); + } +} + +const TQString IRAction::notes() const +{ + + if(isModeChange()) + return TQString(theDoBefore ? i18n("Do actions before. ") : "") + + TQString(theDoAfter ? i18n("Do actions after. ") : ""); + else if(isJustStart()) + return ""; + else + return TQString(theAutoStart ? i18n("Auto-start. ") : "") + + TQString(theRepeat ? i18n("Repeatable. ") : "") + + TQString(!theUnique ? (theIfMulti == IM_DONTSEND ? i18n("Do nothing if many instances. ") + : theIfMulti == IM_SENDTOTOP ? i18n("Send to top instance. ") + : theIfMulti == IM_SENDTOBOTTOM ? i18n("Send to bottom instance. ") : i18n("Send to all instances. ")) + : ""); +} + +const TQString IRAction::application() const +{ + ProfileServer *theServer = ProfileServer::profileServer(); + if(theProgram.isEmpty()) + return ""; + else + { + const Profile *a = theServer->profiles()[theProgram]; + if(a) + return a->name(); + else + return theProgram; + } +} + +const TQString IRAction::remoteName() const +{ + return RemoteServer::remoteServer()->getRemoteName(theRemote); +} + +const TQString IRAction::buttonName() const +{ + return RemoteServer::remoteServer()->getButtonName(theRemote, theButton); +} + diff --git a/tdelirc/tdelirc/iraction.h b/tdelirc/tdelirc/iraction.h new file mode 100644 index 0000000..14d0354 --- /dev/null +++ b/tdelirc/tdelirc/iraction.h @@ -0,0 +1,88 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef IRACTION_H +#define IRACTION_H + +#include <tqstring.h> + +#include "prototype.h" +#include "arguments.h" +#include "profileserver.h" + +/** +@author Gav Wood +*/ + +class TDEConfig; + +class IRAction +{ + TQString theProgram, theObject, theRemote, theButton, theMode; + Prototype theMethod; + Arguments theArguments; + bool theRepeat, theAutoStart, theDoBefore, theDoAfter; + IfMulti theIfMulti; + bool theUnique; + +public: + // load/save convenience functions + const IRAction &loadFromConfig(TDEConfig &theConfig, int index); + void saveToConfig(TDEConfig &theConfig, int index) const; + + // may be changed to a profile-based representation in the future. + const TQString function() const; + const TQString application() const; + const TQString buttonName() const; + const TQString remoteName() const; + const TQString notes() const; + + // bog standard raw DCOP stuff + const TQString &program() const { return theProgram; } + const TQString &object() const { return theObject; } + const Prototype &method() const { return theMethod; } + const TQString &remote() const { return theRemote; } + const TQString &mode() const { return theMode; } + const TQString &button() const { return theButton; } + const Arguments arguments() const { if(theProgram != "" && theObject != "") return theArguments; return Arguments(); } + const bool repeat() const { return theRepeat; } + const bool autoStart() const { return theAutoStart; } + const IfMulti ifMulti() const { return theIfMulti; } + const bool unique() const { return theUnique; } + + const TQString &modeChange() const { return theObject; } + const bool doBefore() const { return theDoBefore; } + const bool doAfter() const { return theDoAfter; } + + bool isModeChange() const { return theProgram == ""; } + bool isJustStart() const { return theProgram != "" && theObject == ""; } + + void setProgram(const TQString &newProgram) { theProgram = newProgram; } + void setObject(const TQString &newObject) { theObject = newObject; } + void setMethod(const Prototype &newMethod) { theMethod = newMethod; } + void setRemote(const TQString &newRemote) { theRemote = newRemote; } + void setMode(const TQString &newMode) { theMode = newMode; } + void setButton(const TQString &newButton) { theButton = newButton; } + void setArguments(const Arguments &newArguments) { theArguments = newArguments; } + void setRepeat(bool newRepeat) { theRepeat = newRepeat; } + void setDoBefore(bool a) { theDoBefore = a; } + void setDoAfter(bool a) { theDoAfter = a; } + void setAutoStart(bool newAutoStart) { theAutoStart = newAutoStart; } + void setModeChange(const TQString &a) { theObject = a; } + void setIfMulti(const IfMulti a) { theIfMulti = a; } + void setUnique(const bool a) { theUnique = a; } + + IRAction(const TQString &newProgram, const TQString &newObject, const TQString &newMethod, const Arguments &newArguments, const TQString &newRemote, const TQString &newMode, const TQString &newButton, const bool newRepeat, const bool newAutoStart, const bool newDoBefore, const bool newDoAfter, const bool newUnique, const IfMulti newIfMulti); + IRAction() { theProgram = TQString(); } +}; + +#endif diff --git a/tdelirc/tdelirc/iractions.cpp b/tdelirc/tdelirc/iractions.cpp new file mode 100644 index 0000000..85d144e --- /dev/null +++ b/tdelirc/tdelirc/iractions.cpp @@ -0,0 +1,90 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include <tdeconfig.h> +#include <kdebug.h> + +#include "iractions.h" +#include "iraction.h" + +void IRActions::loadFromConfig(TDEConfig &theConfig) +{ + clear(); + int numBindings = theConfig.readNumEntry("Bindings"); + for(int i = 0; i < numBindings; i++) + addAction(IRAction().loadFromConfig(theConfig, i)); +} + +void IRActions::purgeAllBindings(TDEConfig &theConfig) +{ + int numBindings = theConfig.readNumEntry("Bindings"); + for(int i = 0; i < numBindings; i++) + { TQString Binding = "Binding" + TQString().setNum(i); + int numArguments = theConfig.readNumEntry(Binding + "Arguments"); + for(int j = 0; j < numArguments; j++) + { theConfig.deleteEntry(Binding + "Argument" + TQString().setNum(j)); + theConfig.deleteEntry(Binding + "ArgumentType" + TQString().setNum(j)); + } + theConfig.deleteEntry(Binding + "Arguments"); theConfig.deleteEntry(Binding + "Program"); + theConfig.deleteEntry(Binding + "Object"); theConfig.deleteEntry(Binding + "Method"); + theConfig.deleteEntry(Binding + "Remote"); theConfig.deleteEntry(Binding + "Button"); + theConfig.deleteEntry(Binding + "Repeat"); theConfig.deleteEntry(Binding + "Mode"); + } +} + +void IRActions::saveToConfig(TDEConfig &theConfig) +{ + int index = 0; + purgeAllBindings(theConfig); + for(iterator i = begin(); i != end(); ++i,index++) + (*i).saveToConfig(theConfig, index); + theConfig.writeEntry("Bindings", index); +} + +IRAIt IRActions::addAction(const IRAction &theAction) +{ + return append(theAction); +} + +IRAItList IRActions::findByButton(const TQString &remote, const TQString &button) +{ + IRAItList ret; + for(iterator i = begin(); i != end(); ++i) + if((*i).remote() == remote && (*i).button() == button) + ret += i; + return ret; +} + +void IRActions::renameMode(const Mode &mode, const TQString &to) +{ + for(iterator i = begin(); i != end(); ++i) + { if((*i).remote() == mode.remote() && (*i).mode() == mode.name()) (*i).setMode(to); + if((*i).isModeChange() && (*i).modeChange() == mode.name()) (*i).setModeChange(to); + } +} + +IRAItList IRActions::findByMode(const Mode &mode) +{ + IRAItList ret; + for(iterator i = begin(); i != end(); ++i) + if((*i).remote() == mode.remote() && (*i).mode() == mode.name()) ret += i; + return ret; +} + +IRAItList IRActions::findByModeButton(const Mode &mode, const TQString &button) +{ + IRAItList ret; + for(iterator i = begin(); i != end(); ++i) + if((*i).remote() == mode.remote() && (*i).mode() == mode.name() && (*i).button() == button) + ret += i; + return ret; +} diff --git a/tdelirc/tdelirc/iractions.h b/tdelirc/tdelirc/iractions.h new file mode 100644 index 0000000..4c44c46 --- /dev/null +++ b/tdelirc/tdelirc/iractions.h @@ -0,0 +1,52 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef IRACTIONS_H +#define IRACTIONS_H + +#include <tqvaluelist.h> +#include <tqpair.h> +#include <tqstring.h> +#include <tqmap.h> + +#include "iraction.h" +#include "mode.h" + +/** +@author Gav Wood +*/ + +class TDEConfig; + +typedef TQValueListIterator<IRAction> IRAIt; +typedef TQValueList<IRAIt> IRAItList; + +class IRActions: protected TQValueList<IRAction> +{ +private: + void purgeAllBindings(TDEConfig &theConfig); + +public: + IRAIt addAction(const IRAction &theAction); + IRAItList findByButton(const TQString &remote, const TQString &button); + IRAItList findByMode(const Mode &mode); + IRAItList findByModeButton(const Mode &mode, const TQString &button); + + void erase(const IRAIt &action) { TQValueList<IRAction>::erase(action); } + void renameMode(const Mode &mode, const TQString &to); + + void loadFromConfig(TDEConfig &theConfig); + void saveToConfig(TDEConfig &theConfig); +}; + + +#endif diff --git a/tdelirc/tdelirc/mode.cpp b/tdelirc/tdelirc/mode.cpp new file mode 100644 index 0000000..9402573 --- /dev/null +++ b/tdelirc/tdelirc/mode.cpp @@ -0,0 +1,51 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// + +#include <tdeconfig.h> + +#include "modes.h" +#include "mode.h" + +Mode::Mode() : theName(TQString()) +{ +} + +Mode::Mode(const TQString &remote, const TQString &name, const TQString &iconFile) +{ + theRemote = remote; + theName = name; + theIconFile = iconFile; +} + +Mode::~Mode() +{ +} + +const Mode &Mode::loadFromConfig(TDEConfig &theConfig, int index) +{ + TQString Prefix = "Mode" + TQString().setNum(index); + theName = theConfig.readEntry(Prefix + "Name"); + theRemote = theConfig.readEntry(Prefix + "Remote"); + theIconFile = theConfig.readEntry(Prefix + "IconFile"); + if(theIconFile.isEmpty()) theIconFile = TQString(); + return *this; +} + +void Mode::saveToConfig(TDEConfig &theConfig, int index) +{ + TQString Prefix = "Mode" + TQString().setNum(index); + theConfig.writeEntry(Prefix + "Name", theName); + theConfig.writeEntry(Prefix + "Remote", theRemote); + theConfig.writeEntry(Prefix + "IconFile", theIconFile); +} + diff --git a/tdelirc/tdelirc/mode.h b/tdelirc/tdelirc/mode.h new file mode 100644 index 0000000..55b7b0a --- /dev/null +++ b/tdelirc/tdelirc/mode.h @@ -0,0 +1,50 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef MODE_H +#define MODE_H + +#include <tqstring.h> + +#include "remoteserver.h" + +/** +@author Gav Wood +*/ + +class TDEConfig; + +class Mode +{ + TQString theName, theRemote, theIconFile; + +public: + void setName(const TQString &a) { theName = a; } + void setRemote(const TQString &a) { theRemote = a; } + void setIconFile(const TQString &a) { theIconFile = a; } + + const TQString &name() const { return theName; } + const TQString &remote() const { return theRemote; } + const TQString &iconFile() const { return theIconFile; } + const TQString &remoteName() const { return RemoteServer::remoteServer()->getRemoteName(theRemote); } + + const Mode &loadFromConfig(TDEConfig &theConfig, int index); + void saveToConfig(TDEConfig &theConfig, int index); + + bool operator==(const Mode &mode) const { return mode.theName == theName && mode.theRemote == theRemote; } + + Mode(); + Mode(const TQString &remote, const TQString &name, const TQString &iconFile = TQString()); + ~Mode(); +}; + +#endif diff --git a/tdelirc/tdelirc/modes.cpp b/tdelirc/tdelirc/modes.cpp new file mode 100644 index 0000000..8eedce0 --- /dev/null +++ b/tdelirc/tdelirc/modes.cpp @@ -0,0 +1,128 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include <tdeconfig.h> +#include <kdebug.h> + +#include "modes.h" +#include "mode.h" + +Modes::Modes() +{ +} + + +Modes::~Modes() +{ +} + +void Modes::loadFromConfig(TDEConfig &theConfig) +{ + clear(); + int numModes = theConfig.readNumEntry("Modes"); + for(int i = 0; i < numModes; i++) + { + add(Mode().loadFromConfig(theConfig, i)); + } + + for(iterator i = begin(); i != end(); ++i) + theDefaults[i.key()] = theConfig.readEntry("Default" + i.key()); +} + +void Modes::generateNulls(const TQStringList &theRemotes) +{ + for(TQStringList::const_iterator i = theRemotes.begin(); i != theRemotes.end(); ++i) + { if(!contains(*i) || !operator[](*i).contains("")) operator[](*i)[""] = Mode(*i, ""); + if(!theDefaults.contains(*i)) theDefaults[*i].isEmpty(); + } +} + +bool Modes::isDefault(const Mode &mode) const +{ + if(theDefaults[mode.remote()] == mode.name()) + return true; +// if(theDefaults[mode.remote()].isEmpty() || theDefaults[mode.remote()].isNull()) +// return mode.name().isEmpty(); + return false; +} + +const Mode Modes::getDefault(const TQString &remote) const +{ +// if(theDefaults[remote] == TQString()) +// return Mode(remote, ""); + if(contains(remote)) + if(operator[](remote).contains(theDefaults[remote])) + return operator[](remote)[theDefaults[remote]]; + else return Mode(remote, ""); + else return Mode(remote, ""); + +} + +void Modes::purgeAllModes(TDEConfig &theConfig) +{ + int numModes = theConfig.readNumEntry("Modes"); + for(int i = 0; i < numModes; i++) + { TQString Prefix = "Mode" + TQString().setNum(i); + theConfig.deleteEntry(Prefix + "Name"); + theConfig.deleteEntry(Prefix + "Remote"); + } +} + +void Modes::saveToConfig(TDEConfig &theConfig) +{ + int index = 0; + purgeAllModes(theConfig); + for(iterator i = begin(); i != end(); ++i) + for(TQMap<TQString, Mode>::iterator j = (*i).begin(); j != (*i).end(); ++j,index++) + (*j).saveToConfig(theConfig, index); + theConfig.writeEntry("Modes", index); + + for(iterator i = begin(); i != end(); ++i) + if(theDefaults[i.key()] == TQString()) + theConfig.writeEntry("Default" + i.key(), ""); + else + theConfig.writeEntry("Default" + i.key(), theDefaults[i.key()]); +} + +const Mode &Modes::getMode(const TQString &remote, const TQString &mode) const +{ + return operator[](remote)[mode]; +} + +ModeList Modes::getModes(const TQString &remote) const +{ + ModeList ret; + for(TQMap<TQString, Mode>::const_iterator i = operator[](remote).begin(); i != operator[](remote).end(); ++i) + ret += *i; + return ret; +} + +void Modes::erase(const Mode &mode) +{ + operator[](mode.remote()).erase(mode.name()); +} + +void Modes::add(const Mode &mode) +{ + kdDebug() << "adding a mode " << mode.name() << " to remote " << mode.remote() << endl; + operator[](mode.remote())[mode.name()] = mode; +} + +void Modes::rename(Mode &mode, const TQString name) +{ + bool was = isDefault(mode); + erase(mode); + mode.setName(name); + if(was) setDefault(mode); + add(mode); +} + diff --git a/tdelirc/tdelirc/modes.h b/tdelirc/tdelirc/modes.h new file mode 100644 index 0000000..d0de17a --- /dev/null +++ b/tdelirc/tdelirc/modes.h @@ -0,0 +1,62 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef MODES_H +#define MODES_H + +#include <tqstring.h> +#include <tqmap.h> +#include <tqpair.h> +#include <tqvaluelist.h> + +#include "mode.h" + +/** +@author Gav Wood +*/ + +class TDEConfig; + +typedef TQValueList<Mode> ModeList; + +class Modes : protected TQMap<TQString, TQMap<TQString, Mode> > +{ + void purgeAllModes(TDEConfig &theConfig); + TQMap<TQString, TQString> theDefaults; + +public: + void loadFromConfig(TDEConfig &theConfig); + void saveToConfig(TDEConfig &theConfig); + void generateNulls(const TQStringList &theRemotes); + + const Mode &getMode(const TQString &remote, const TQString &mode) const; + ModeList getModes(const TQString &remote) const; + const Mode getDefault(const TQString &remote) const; + bool isDefault(const Mode &mode) const; + + /** + * Call when you've changed a previously getMode'd mode and you want the changes + * to be recorded + **/ + void updateMode(const Mode &mode) { operator[](mode.remote())[mode.name()] = mode; } + void setDefault(const Mode &mode) { theDefaults[mode.remote()] = mode.name(); } + void erase(const Mode &mode); + void add(const Mode &mode); + + // dont use this without renaming all the modes in the actions!!! + void rename(Mode &mode, const TQString name); + + Modes(); + ~Modes(); +}; + +#endif diff --git a/tdelirc/tdelirc/profileserver.cpp b/tdelirc/tdelirc/profileserver.cpp new file mode 100644 index 0000000..ba39442 --- /dev/null +++ b/tdelirc/tdelirc/profileserver.cpp @@ -0,0 +1,159 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// + +#include <tqfile.h> +#include <tqxml.h> + +#include <tdeglobal.h> +#include <kstandarddirs.h> +#include <kdebug.h> + +#include "profileserver.h" + +ProfileServer *ProfileServer::theInstance = 0; + +ProfileServer::ProfileServer() +{ + theProfiles.setAutoDelete(true); + loadProfiles(); +} + +ProfileServer::~ProfileServer() +{ +} + +void ProfileServer::loadProfiles() +{ + TQStringList theFiles = TDEGlobal::dirs()->findAllResources("data", "profiles/*.profile.xml"); + for(TQStringList::iterator i = theFiles.begin(); i != theFiles.end(); ++i) + { kdDebug() << "Found data file: " << *i << endl; + Profile *p = new Profile(); + p->loadFromFile(*i); + theProfiles.insert(p->id(), p); + } +} + +Profile::Profile() +{ + // set up defaults + theUnique = true; + theIfMulti = IM_DONTSEND; + + theActions.setAutoDelete(true); +} + +const ProfileAction *Profile::searchClass(const TQString &c) const +{ + for(TQDictIterator<ProfileAction> i(theActions); i.current(); ++i) + if(i.current()->getClass() == c) return i; + return 0; +} + +void Profile::loadFromFile(const TQString &fileName) +{ + charBuffer = ""; + curPA = 0; + curPAA = 0; + + TQFile xmlFile(fileName); + TQXmlInputSource source(TQT_TQIODEVICE(&xmlFile)); + TQXmlSimpleReader reader; + reader.setContentHandler(this); + reader.parse(source); +} + +const ProfileAction *ProfileServer::getAction(const TQString &appId, const TQString &actionId) const +{ + if(theProfiles[appId]) + if(theProfiles[appId]->theActions[actionId]) + return theProfiles[appId]->theActions[actionId]; + return 0; +} + +const TQString &ProfileServer::getServiceName(const TQString &appId) const +{ + if(theProfiles[appId]) + return theProfiles[appId]->serviceName(); + return TQString(); +} + +const ProfileAction *ProfileServer::getAction(const TQString &appId, const TQString &objId, const TQString &prototype) const +{ + return getAction(appId, objId + "::" + prototype); +} + +bool Profile::characters(const TQString &data) +{ + charBuffer += data; + return true; +} + +bool Profile::startElement(const TQString &, const TQString &, const TQString &name, const TQXmlAttributes &attributes) +{ + if(name == "profile") + { theId = attributes.value("id"); + theServiceName = attributes.value("servicename"); + } + else if(name == "action") + { curPA = new ProfileAction; + curPA->setObjId(attributes.value("objid")); + curPA->setPrototype(attributes.value("prototype")); + curPA->setClass(attributes.value("class")); + curPA->setMultiplier(attributes.value("multiplier").isEmpty() ? 1.0 : attributes.value("multiplier").toFloat()); + curPA->setRepeat(attributes.value("repeat") == "1"); + curPA->setAutoStart(attributes.value("autostart") == "1"); + } + else if(name == "instances") + { theUnique = attributes.value("unique") == "1"; + theIfMulti = attributes.value("ifmulti") == "sendtotop" ? IM_SENDTOTOP : attributes.value("ifmulti") == "sendtobottom" ? IM_SENDTOBOTTOM : attributes.value("ifmulti") == "sendtoall" ? IM_SENDTOALL : IM_DONTSEND; + } + else if(name == "argument") + { curPA->theArguments.append(ProfileActionArgument()); + curPAA = &(curPA->theArguments.last()); + curPAA->setAction(curPA); + curPAA->setType(attributes.value("type")); + } + else if(name == "range" && curPAA) + curPAA->setRange(tqMakePair(attributes.value("min").toInt(), attributes.value("max").toInt())); + + charBuffer = ""; + return true; +} + +bool Profile::endElement(const TQString &, const TQString &, const TQString &name) +{ + if(name == "name") + if(curPA) + curPA->setName(charBuffer); + else + theName = charBuffer; + else if(name == "author") + theAuthor = charBuffer; + else if(name == "comment" && curPA && !curPAA) + curPA->setComment(charBuffer); + else if(name == "default" && curPA && curPAA) + curPAA->setDefault(charBuffer); + else if(name == "comment" && curPA && curPAA) + curPAA->setComment(charBuffer); + else if(name == "action") + { + curPA->setProfile(this); + theActions.insert(curPA->objId() + "::" + curPA->prototype(), curPA); + curPA = 0; + } + else if(name == "argument") + curPAA = 0; + + charBuffer = ""; + return true; +} diff --git a/tdelirc/tdelirc/profileserver.h b/tdelirc/tdelirc/profileserver.h new file mode 100644 index 0000000..0d9bc59 --- /dev/null +++ b/tdelirc/tdelirc/profileserver.h @@ -0,0 +1,142 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef PROFILESERVER_H +#define PROFILESERVER_H + +#include <tqpair.h> +#include <tqstring.h> +#include <tqvaluelist.h> +#include <tqmap.h> +#include <tqxml.h> +#include <tqdict.h> + +/** +@author Gav Wood +*/ + +enum IfMulti {IM_DONTSEND, IM_SENDTOALL, IM_SENDTOTOP, IM_SENDTOBOTTOM}; + +typedef TQPair<int,int> Range; + +class ProfileAction; +class Profile; + +class ProfileActionArgument +{ + TQString theComment, theType; + Range theRange; + TQString theDefault; // should be TQVariant? + const ProfileAction *parent; + + friend class Profile; +public: + const TQString &comment() const { return theComment; } + void setComment(const TQString &a) { theComment = a; } + const TQString &type() const { return theType; } + void setType(const TQString &a) { theType = a; } + const TQString &getDefault() const { return theDefault; } + void setDefault(const TQString &a) { theDefault = a; } + const Range &range() const { return theRange; } + void setRange(const Range &a) { theRange = a; } + + const ProfileAction *action() const { return parent; } + void setAction(const ProfileAction *a) { parent = a; } +}; + +class ProfileAction +{ + TQString theObjId, thePrototype, theName, theComment, theClass; + float theMultiplier; + const Profile *parent; + bool theRepeat, theAutoStart; + TQValueList<ProfileActionArgument> theArguments; + + friend class Profile; +public: + const TQString &objId() const { return theObjId; } + void setObjId(const TQString &a) { theObjId = a; } + const TQString &prototype() const { return thePrototype; } + void setPrototype(const TQString &a) { thePrototype = a; } + const TQString &name() const { return theName; } + void setName(const TQString &a) { theName = a; } + const TQString &comment() const { return theComment; } + void setComment(const TQString &a) { theComment = a; } + const TQString &getClass() const { return theClass; } + void setClass(const TQString &a) { theClass = a; } + const float multiplier() const { return theMultiplier; } + void setMultiplier(const float a) { theMultiplier = a; } + bool repeat() const { return theRepeat; } + void setRepeat(bool a) { theRepeat = a; } + bool autoStart() const { return theAutoStart; } + void setAutoStart(bool a) { theAutoStart = a; } + const TQValueList<ProfileActionArgument> &arguments() const { return theArguments; } + + const Profile *profile() const { return parent; } + void setProfile(const Profile *a) { parent = a; } +}; + +class Profile : public TQXmlDefaultHandler +{ + TQString theId, theName, theAuthor, theServiceName; + IfMulti theIfMulti; + bool theUnique; + TQString charBuffer; + + ProfileAction *curPA; + ProfileActionArgument *curPAA; + TQDict<ProfileAction> theActions; // objid+"::"+prototype => ProfileAction + + friend class ProfileServer; +public: + bool characters(const TQString &data); + bool startElement(const TQString &, const TQString &, const TQString &name, const TQXmlAttributes &attributes); + bool endElement(const TQString &, const TQString &, const TQString &name); + + const TQString &id() const { return theId; } + void setId(const TQString &a) { theId = a; } + const TQString &name() const { return theName; } + void setName(const TQString &a) { theName = a; } + const TQString &author() const { return theAuthor; } + void setAuthor(const TQString &a) { theAuthor = a; } + const bool unique() const { return theUnique; } + void setUnique(const bool a) { theUnique = a; } + const IfMulti ifMulti() const { return theIfMulti; } + void setIfMulti(const IfMulti a) { theIfMulti = a; } + const TQString &serviceName() const { if(theServiceName != TQString()) return theServiceName; return theName; } + void setServiceName(const TQString &a) { theServiceName = a; } + const TQDict<ProfileAction> &actions() const { return theActions; } + const ProfileAction *searchClass(const TQString &c) const; + + void loadFromFile(const TQString &fileName); + + Profile(); +}; + +class ProfileServer +{ + static ProfileServer *theInstance; + void loadProfiles(); + TQDict<Profile> theProfiles; // id => Profile + +public: + static ProfileServer *profileServer() { if(!theInstance) theInstance = new ProfileServer(); return theInstance; } + const TQDict<Profile> profiles() const { return theProfiles; } + const ProfileAction *getAction(const TQString &appId, const TQString &objId, const TQString &prototype) const; + const ProfileAction *getAction(const TQString &appId, const TQString &actionId) const; + const TQString &getServiceName(const TQString &appId) const; + + ProfileServer(); + ~ProfileServer(); +}; + +#endif diff --git a/tdelirc/tdelirc/prototype.cpp b/tdelirc/tdelirc/prototype.cpp new file mode 100644 index 0000000..8e2eedf --- /dev/null +++ b/tdelirc/tdelirc/prototype.cpp @@ -0,0 +1,67 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include <tqregexp.h> + +#include "prototype.h" + +Prototype::Prototype() +{ + original = ""; +} + +Prototype::Prototype(const TQString &source) +{ + original = source; + parse(); +} + +Prototype::~Prototype() +{ +} + +const TQString Prototype::argumentList() const +{ + TQString ret = ""; + for(unsigned i = 0; i < theTypes.count(); i++) + ret += (i ? ", " : "") + theTypes[i] + " " + theNames[i]; + return ret; +} + +const TQString Prototype::argumentListNN() const +{ + TQString ret = ""; + for(unsigned i = 0; i < theTypes.count(); i++) + ret += (i ? ", " : "") + theTypes[i]; + return ret; +} + +void Prototype::parse() +{ + theNames.clear(); + theTypes.clear(); + + TQRegExp main("^(.*) (\\w[\\d\\w]*)\\((.*)\\)"); + TQRegExp parameters("^\\s*([^,\\s]+)(\\s+(\\w[\\d\\w]*))?(,(.*))?$"); + + if(main.search(original) == -1) return; + theReturn = main.cap(1); + theName = main.cap(2); + + TQString args = main.cap(3); + while(parameters.search(args) != -1) + { theTypes += parameters.cap(1); + theNames += parameters.cap(3); + args = parameters.cap(5); + } +} + diff --git a/tdelirc/tdelirc/prototype.h b/tdelirc/tdelirc/prototype.h new file mode 100644 index 0000000..fa101b7 --- /dev/null +++ b/tdelirc/tdelirc/prototype.h @@ -0,0 +1,54 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef PROTOTYPE_H +#define PROTOTYPE_H + +#include <tqstringlist.h> +#include <tqpair.h> +#include <tqstring.h> + +/** +@author Gav Wood +*/ + +class Prototype +{ + TQString original, theName, theReturn; + TQStringList theNames, theTypes; + + void parse(); + +public: + unsigned count() const{ return theTypes.count(); } + const TQPair<TQString, TQString> operator[](int i) const { return tqMakePair(theTypes[i], theNames[i]); } + const TQString &name(int i) const { return theNames[i]; } + const TQString &type(int i) const { return theTypes[i]; } + const TQString &returnType() const { return theReturn; } + const TQString &name() const { return theName; } + const TQString &prototype() const { return original; } + const TQString argumentList() const; + const TQString argumentListNN() const; + const int argumentCount() { return theTypes.count(); } + const TQString prototypeNR() const { return theName + "(" + argumentListNN() + ")"; } + + void setPrototype(const TQString &source) { original = source; parse(); } + + Prototype &operator=(const TQString &source) { setPrototype(source); return *this; } + + Prototype(const TQString &source); + Prototype(); + ~Prototype(); + +}; + +#endif diff --git a/tdelirc/tdelirc/remoteserver.cpp b/tdelirc/tdelirc/remoteserver.cpp new file mode 100644 index 0000000..dafa67d --- /dev/null +++ b/tdelirc/tdelirc/remoteserver.cpp @@ -0,0 +1,109 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// + +#include <tqfile.h> +#include <tqxml.h> + +#include <tdeglobal.h> +#include <kstandarddirs.h> +#include <kdebug.h> + +#include "remoteserver.h" + +RemoteServer *RemoteServer::theInstance = 0; + +RemoteServer::RemoteServer() +{ + theRemotes.setAutoDelete(true); + loadRemotes(); +} + +RemoteServer::~RemoteServer() +{ +} + +void RemoteServer::loadRemotes() +{ + TQStringList theFiles = TDEGlobal::dirs()->findAllResources("data", "remotes/*.remote.xml"); + for(TQStringList::iterator i = theFiles.begin(); i != theFiles.end(); ++i) + { kdDebug() << "Found data file: " << *i << endl; + Remote *p = new Remote(); + p->loadFromFile(*i); + theRemotes.insert(p->id(), p); + } +} + +Remote::Remote() +{ + theButtons.setAutoDelete(true); +} + +Remote::~Remote() +{ +} + +void Remote::loadFromFile(const TQString &fileName) +{ + charBuffer = ""; + curRB = 0; + + TQFile xmlFile(fileName); + TQXmlInputSource source(TQT_TQIODEVICE(&xmlFile)); + TQXmlSimpleReader reader; + reader.setContentHandler(this); + reader.parse(source); +} + +bool Remote::characters(const TQString &data) +{ + charBuffer += data; + return true; +} + +bool Remote::startElement(const TQString &, const TQString &, const TQString &name, const TQXmlAttributes &attributes) +{ + if(name == "remote") + theId = theName = attributes.value("id"); + else if(name == "button") + { + curRB = new RemoteButton(); + curRB->setId(attributes.value("id")); + curRB->setClass(attributes.value("id")); + if(attributes.index("class") > -1) + curRB->setClass(attributes.value("class")); + curRB->setParameter(attributes.value("parameter")); + curRB->setName(attributes.value("id")); + } + + charBuffer = ""; + return true; +} + +bool Remote::endElement(const TQString &, const TQString &, const TQString &name) +{ + if(name == "name") + if(curRB) + curRB->setName(charBuffer); + else + theName = charBuffer; + else if(name == "author") + theAuthor = charBuffer; + else if(name == "button") + { + theButtons.insert(curRB->id(), curRB); + curRB = 0; + } + + charBuffer = ""; + return true; +} diff --git a/tdelirc/tdelirc/remoteserver.h b/tdelirc/tdelirc/remoteserver.h new file mode 100644 index 0000000..80891ba --- /dev/null +++ b/tdelirc/tdelirc/remoteserver.h @@ -0,0 +1,89 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef REMOTESERVER_H +#define REMOTESERVER_H + +#include <tqstring.h> +#include <tqxml.h> +#include <tqdict.h> + +/** +@author Gav Wood +*/ + + +class RemoteButton +{ + TQString theName, theId, theClass, theParameter; + + friend class Remote; +public: + void setName(const TQString &a) { theName = a; } + const TQString &name(void) const { return theName; } + void setClass(const TQString &a) { theClass = a; } + const TQString &getClass(void) const { return theClass; } + void setParameter(const TQString &a) { theParameter = a; } + const TQString ¶meter(void) const { return theParameter; } + void setId(const TQString &a) { theId = a; } + const TQString &id(void) const { return theId; } +}; + +class Remote : public TQXmlDefaultHandler +{ + TQString theName, theId, theAuthor; + TQDict<RemoteButton> theButtons; + + TQString charBuffer; + RemoteButton *curRB; + + friend class RemoteServer; +public: + bool characters(const TQString &data); + bool startElement(const TQString &, const TQString &, const TQString &name, const TQXmlAttributes &attributes); + bool endElement(const TQString &, const TQString &, const TQString &name); + + void setName(const TQString &a) { theName = a; } + const TQString &name(void) const { return theName; } + void setId(const TQString &a) { theId = a; } + const TQString &id(void) const { return theId; } + void setAuthor(const TQString &a) { theAuthor = a; } + const TQString &author(void) const { return theAuthor; } + const TQDict<RemoteButton> &buttons() const { return theButtons; } + + void loadFromFile(const TQString &fileName); + + const TQString &getButtonName(const TQString &id) const { if(theButtons[id]) return theButtons[id]->name(); return id; } + + Remote(); + ~Remote(); +}; + +class RemoteServer +{ + static RemoteServer *theInstance; + void loadRemotes(); + TQDict<Remote> theRemotes; + +public: + static RemoteServer *remoteServer() { if(!theInstance) theInstance = new RemoteServer(); return theInstance; } + + const TQDict<Remote> &remotes() const { return theRemotes; } + + const TQString &getRemoteName(const TQString &id) const { if(theRemotes[id]) return theRemotes[id]->name(); return id; } + const TQString &getButtonName(const TQString &remote, const TQString &button) const { if(theRemotes[remote]) return theRemotes[remote]->getButtonName(button); return button; } + + RemoteServer(); + ~RemoteServer(); +}; + +#endif |