diff options
Diffstat (limited to 'kopete/plugins/motionautoaway')
-rw-r--r-- | kopete/plugins/motionautoaway/COPYING.motion | 339 | ||||
-rw-r--r-- | kopete/plugins/motionautoaway/Makefile.am | 24 | ||||
-rw-r--r-- | kopete/plugins/motionautoaway/configure.in.in | 18 | ||||
-rw-r--r-- | kopete/plugins/motionautoaway/kopete_motionaway.desktop | 115 | ||||
-rw-r--r-- | kopete/plugins/motionautoaway/kopete_motionaway_config.desktop | 111 | ||||
-rw-r--r-- | kopete/plugins/motionautoaway/motionawayconfig.kcfg | 25 | ||||
-rw-r--r-- | kopete/plugins/motionautoaway/motionawayconfig.kcfgc | 8 | ||||
-rw-r--r-- | kopete/plugins/motionautoaway/motionawayplugin.cpp | 308 | ||||
-rw-r--r-- | kopete/plugins/motionautoaway/motionawayplugin.h | 93 | ||||
-rw-r--r-- | kopete/plugins/motionautoaway/motionawaypreferences.cpp | 70 | ||||
-rw-r--r-- | kopete/plugins/motionautoaway/motionawaypreferences.h | 45 | ||||
-rw-r--r-- | kopete/plugins/motionautoaway/motionawayprefs.ui | 297 |
12 files changed, 1453 insertions, 0 deletions
diff --git a/kopete/plugins/motionautoaway/COPYING.motion b/kopete/plugins/motionautoaway/COPYING.motion new file mode 100644 index 00000000..96bdc086 --- /dev/null +++ b/kopete/plugins/motionautoaway/COPYING.motion @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 + + Appendix: 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) 19yy <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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, 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) 19yy 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/kopete/plugins/motionautoaway/Makefile.am b/kopete/plugins/motionautoaway/Makefile.am new file mode 100644 index 00000000..ff2c5bd8 --- /dev/null +++ b/kopete/plugins/motionautoaway/Makefile.am @@ -0,0 +1,24 @@ +METASOURCES = AUTO + +AM_CPPFLAGS = $(KOPETE_INCLUDES) $(all_includes) + +kde_module_LTLIBRARIES = kopete_motionaway.la kcm_kopete_motionaway.la + +kopete_motionaway_la_SOURCES = motionawayplugin.cpp motionawayconfig.kcfgc +kopete_motionaway_la_LDFLAGS = -module $(KDE_PLUGIN) +kopete_motionaway_la_LIBADD = ../../libkopete/libkopete.la + +kcm_kopete_motionaway_la_SOURCES = motionawayprefs.ui motionawaypreferences.cpp motionawayconfig.kcfgc +kcm_kopete_motionaway_la_LDFLAGS = -module -no-undefined $(KDE_PLUGIN) $(all_libraries) +kcm_kopete_motionaway_la_LIBADD = $(LIB_KOPETECOMPAT) $(LIB_KUTILS) + + + +service_DATA = kopete_motionaway.desktop +servicedir = $(kde_servicesdir) + +kcm_DATA = kopete_motionaway_config.desktop +kcmdir = $(kde_servicesdir)/kconfiguredialog +kde_kcfg_DATA = motionawayconfig.kcfg + + diff --git a/kopete/plugins/motionautoaway/configure.in.in b/kopete/plugins/motionautoaway/configure.in.in new file mode 100644 index 00000000..5533607f --- /dev/null +++ b/kopete/plugins/motionautoaway/configure.in.in @@ -0,0 +1,18 @@ +dnl Only compile motionautoaway on Linux (needs video4linux) + +dnl Disabled for now. It breaks with patched Linux 2.4 kernels and +dnl vanilla Linux 2.5 and 2.6 kernels + +#AC_MSG_CHECKING([if motionautoaway plugin should be compiled]) + +#if test "x`uname`" = "xLinux"; then +# COMPILEMOTION=true +# AC_SUBST(COMPILEMOTION) +# AC_MSG_RESULT([yes]) +#else + COMPILEMOTION= +# AC_SUBST(COMPILEMOTION) +# AC_MSG_RESULT([no]) +#fi + +AM_CONDITIONAL(include_motionautoaway, test -n "$COMPILEMOTION") diff --git a/kopete/plugins/motionautoaway/kopete_motionaway.desktop b/kopete/plugins/motionautoaway/kopete_motionaway.desktop new file mode 100644 index 00000000..93c8d617 --- /dev/null +++ b/kopete/plugins/motionautoaway/kopete_motionaway.desktop @@ -0,0 +1,115 @@ +[Desktop Entry] +Type=Service +X-Kopete-Version=1000900 +ServiceTypes=Kopete/Plugin +X-KDE-Library=kopete_motionaway +X-KDE-PluginInfo-Author=Duncan Mac-Vicar Prett +X-KDE-PluginInfo-Name=kopete_motionaway +X-KDE-PluginInfo-Version=0.8.0 +X-KDE-PluginInfo-Website=http://kopete.kde.org +X-KDE-PluginInfo-Category=Plugins +X-KDE-PluginInfo-Depends= +X-KDE-PluginInfo-License=GPL +X-KDE-PluginInfo-EnabledByDefault=false +Name=Motion Auto-Away +Name[ar]=حركة التبعيد التلقائية +Name[bg]=Промяна на състоянието +Name[bn]=চলাচল স্বয়ংক্রীয়-অনুপস্থিতি +Name[bs]=Auto-odsutnost na osnovu kretanja +Name[ca]=Auto-absent per moviment +Name[cs]=Nepřítomnost podle pohybu +Name[cy]=Dim Yma (Dim Symudiad) +Name[da]=Bevægelses-auto-borte +Name[de]=Auto-Abwesenheit +Name[el]=Αυτόματη μετάβαση σε απουσία +Name[es]=Ausencia automática por movimiento +Name[et]=Automaatne äraolek +Name[eu]=Auto-urrunduta +Name[fa]=حرکت خودکار دور +Name[fi]=Liikeen perusteella poistuminen +Name[fr]=Détection de mouvement +Name[gl]=Auto-alonxamento +Name[he]=מסמן "לא נמצא" בהתאם לתנועה +Name[hi]=मोशन आटो अवे +Name[hr]=Automatska odsutnost u nedostatku pokreta +Name[hu]=A távollét érzékelése mozgásdetektálással +Name[it]=Automaticamente "assente" se inutilizzato +Name[ja]=自動不在時の動作 +Name[ka]=ავტო-გასვლა +Name[kk]=Орында жоқ күйін автоорнату +Name[km]=ចលនាស្វ័យប្រវត្តិ ពេលមិននៅ +Name[lt]=Judėjimas „Pasitraukęs“ +Name[mk]=Авто-отсутен за движење +Name[nb]=Bli borte automatisk +Name[nds]=Auto-Wegwesen +Name[ne]=चाल स्वत: बाहिर +Name[nl]=Automatisch afwezig +Name[nn]=Bli vekke automatisk +Name[pl]=Wykrywanie nieaktywności za pomocą czujnika ruchu +Name[pt]=Ausência Automática por Movimento +Name[pt_BR]=Ausente Automático +Name[ru]=Автоопределение отсутствия +Name[sk]=Automatická prítomnosť podľa pohybu +Name[sl]=Samo-odsotnost (premikanje) +Name[sr]=Аутоматска одсутност без покретâ +Name[sr@Latn]=Automatska odsutnost bez pokretâ +Name[sv]=Automatisk rörelsefrånvaro +Name[ta]=அகராதி +Name[tg]=Ҳаракати Ақибгардии Худкор +Name[tr]=Otomatik Uzakta Hareketi +Name[uk]=Автовиявлення відсутності +Name[zh_CN]=自动离开 +Name[zh_HK]=動作感應器 +Name[zh_TW]=動作偵測自動離開 +Comment=Sets away status when not detecting movement near the computer +Comment[ar]=يحول وضع الاتصال إلى في الخارج عندما لا يتم تحديد تعاملات مع الكومبيوتر +Comment[bg]=Промяна на състоянието, когато няма активност от страна на потребителя +Comment[bn]=যখন কম্পিউটারের কাছে কোনও চলাচল অনুভূত হয়না তখন অনুপস্থিত অবস্থা নিযুক্ত করে +Comment[bs]=Postavlja status odsutnosti ako nije detektovano kretanje u blizini računara +Comment[ca]=Estableix l'estatus d'absent en no detectar moviment a l'ordinador +Comment[cs]=Nastaví automaticky stav "nepřítomen" při absenci pohybu +Comment[cy]=Gosod cyflwr i "i fwrdd" os na chanfyddir symudiad wrth ymyl y cyfrifiadur +Comment[da]=Sætter borte-status når ingen bevægelse detekteres nær computeren +Comment[de]=Setzt automatisch den Status auf abwesend, wenn keine Aktivität am Rechner feststellbar ist +Comment[el]=Ορίζει την κατάσταση σε απουσία όταν δεν ανιχνεύει κίνηση κοντά στον υπολογιστή +Comment[es]=Se pone en estado Ausente cuando no se detecte movimiento cerca de su equipo +Comment[et]=Määrab äraoleku staatuse, kui arvuti juures mingit elutegevust ei täheldata +Comment[eu]=Ezarri urrunduta egoera konputagailuan mugimendurik ez dagoenean +Comment[fa]=اگر هیچ حرکتی نزدیک رایانۀ شما آشکار نشود، وضعیت را کنار میگذارد +Comment[fi]=Asettaa poissaolevaksi, jos koneen lähistöllä ei havaita liikettä +Comment[fr]=Active l'état absent lorsque aucune activité n'est détectée près de l'ordinateur +Comment[gl]=Pónse en estado alonxado cando non se detectan movementos preto do seu ordenador +Comment[he]=מגדיר מצב "לא נמצא" בעת חוסר פעילות על המחשב +Comment[hi]=जब कम्प्यूटर के आसपास गतिविधि पता नहीं लगता है तो स्थिति को दूर नियत करता है +Comment[hr]=Postavlja status „odsutan“ kada ne detektira pomicanje u blizini računala +Comment[hu]=A távolléti állapot automatikus beállítása, ha nincs mozgás a számítógép körül +Comment[is]=Breytir stöðu þinni ef tölvan er ekki notkun +Comment[it]=Imposta lo stato ad assente quando non viene rilevato nessun movimento +Comment[ja]=コンピュータの近くにいない場合、不在状態にセットします +Comment[ka]=აყენებს გასვლის სტატუსს როდესაც კომპიუტერთან აქტივობა არ შეიმჩნევა +Comment[kk]=Компьютерде қимыл жоқты байқап орында жоқ деген күйді орнатады +Comment[km]=កំណត់ស្ថានភាពមិននៅ នៅពេលកុំព្យូទ័រ និងអ្វីៗនៅជិតវា មិនកម្រើក +Comment[lt]=Būklė nustatoma „Pasitraukęs“, jei šalia kompiuterio nėra jokio judėjimo +Comment[mk]=Го поставува статусот отсутен кога нема движење на компјутерот +Comment[nb]=Sett som borte når det ikke er noen bevegelse på mus eller tastatur +Comment[nds]=Stellt den Status automaatsch op "Nich dor", wenn sik an'n Reekner nix deit +Comment[ne]=कम्प्युटर नजिक चाल पत्ता नलाग्दा वस्तुस्थिति बाहिर सेट गर्दछ +Comment[nl]=Stelt automatisch afwezigheid in als er geen beweging wordt gedetecteerd +Comment[nn]=Set som vekke når det ikkje er noka rørsle på mus eller tastatur +Comment[pl]=Ustawia status "Zaraz wracam", gdy nie wykrywa żadnego ruchu w pobliżu komputera +Comment[pt]=Configura o estado de ausência ao não detectar movimento perto do computador +Comment[pt_BR]=Configura o status de ausente quando não detectar movimento próximo ao computador +Comment[ru]=Устанавливает состояние "отсутствует", если работа за компьютером не регистрируется в течение долгого времени +Comment[sk]=Nastaví stav prítomnosti podľa toho, či bol zaznamenaný pohyb pri počítači +Comment[sl]=Nastavi stanje odsotnosti, ko ni premikanja v bližini računalnika +Comment[sr]=Поставља статус „одсутан“ када не детектује померање у близини рачунара +Comment[sr@Latn]=Postavlja status „odsutan“ kada ne detektuje pomeranje u blizini računara +Comment[sv]=Ställer automatisk in frånvarostatus när ingen rörelse märks nära datorn +Comment[ta]=கணிப்பொறியின் அருகே நடக்கும் இயக்கத்தை கண்டுபிடிக்காத போது அமைக்கும் +Comment[tg]=Ҳангоми муайян накардани ҳаракат дар назди компютер ҳолатро дур месозад +Comment[tr]=Bilgisayarın başında olunmadığı algılanırsa uzakta olarak belirler +Comment[uk]=Встановлює стан у значення "відсутній", якщо не реєструється робота за комп'ютером +Comment[zh_CN]=根据计算机旁的状态设置离开状态 +Comment[zh_HK]=偵測不到電腦附近有動作時將狀態設為「離開」 +Comment[zh_TW]=當偵測不到動作時自動設為離開 diff --git a/kopete/plugins/motionautoaway/kopete_motionaway_config.desktop b/kopete/plugins/motionautoaway/kopete_motionaway_config.desktop new file mode 100644 index 00000000..ffe5775b --- /dev/null +++ b/kopete/plugins/motionautoaway/kopete_motionaway_config.desktop @@ -0,0 +1,111 @@ +[Desktop Entry] +Type=Service +ServiceTypes=KCModule + +X-KDE-ModuleType=Library +X-KDE-Library=kopete_motionaway +X-KDE-FactoryName=MotionAwayConfigFactory +X-KDE-ParentApp=kopete_motionaway +X-KDE-ParentComponents=kopete_motionaway + +Name=Motion Auto-Away +Name[ar]=حركة التبعيد التلقائية +Name[bg]=Промяна на състоянието +Name[bn]=চলাচল স্বয়ংক্রীয়-অনুপস্থিতি +Name[bs]=Auto-odsutnost na osnovu kretanja +Name[ca]=Auto-absent per moviment +Name[cs]=Nepřítomnost podle pohybu +Name[cy]=Dim Yma (Dim Symudiad) +Name[da]=Bevægelses-auto-borte +Name[de]=Auto-Abwesenheit +Name[el]=Αυτόματη μετάβαση σε απουσία +Name[es]=Ausencia automática por movimiento +Name[et]=Automaatne äraolek +Name[eu]=Auto-urrunduta +Name[fa]=حرکت خودکار دور +Name[fi]=Liikeen perusteella poistuminen +Name[fr]=Détection de mouvement +Name[gl]=Auto-alonxamento +Name[he]=מסמן "לא נמצא" בהתאם לתנועה +Name[hi]=मोशन आटो अवे +Name[hr]=Automatska odsutnost u nedostatku pokreta +Name[hu]=A távollét érzékelése mozgásdetektálással +Name[it]=Automaticamente "assente" se inutilizzato +Name[ja]=自動不在時の動作 +Name[ka]=ავტო-გასვლა +Name[kk]=Орында жоқ күйін автоорнату +Name[km]=ចលនាស្វ័យប្រវត្តិ ពេលមិននៅ +Name[lt]=Judėjimas „Pasitraukęs“ +Name[mk]=Авто-отсутен за движење +Name[nb]=Bli borte automatisk +Name[nds]=Auto-Wegwesen +Name[ne]=चाल स्वत: बाहिर +Name[nl]=Automatisch afwezig +Name[nn]=Bli vekke automatisk +Name[pl]=Wykrywanie nieaktywności za pomocą czujnika ruchu +Name[pt]=Ausência Automática por Movimento +Name[pt_BR]=Ausente Automático +Name[ru]=Автоопределение отсутствия +Name[sk]=Automatická prítomnosť podľa pohybu +Name[sl]=Samo-odsotnost (premikanje) +Name[sr]=Аутоматска одсутност без покретâ +Name[sr@Latn]=Automatska odsutnost bez pokretâ +Name[sv]=Automatisk rörelsefrånvaro +Name[ta]=அகராதி +Name[tg]=Ҳаракати Ақибгардии Худкор +Name[tr]=Otomatik Uzakta Hareketi +Name[uk]=Автовиявлення відсутності +Name[zh_CN]=自动离开 +Name[zh_HK]=動作感應器 +Name[zh_TW]=動作偵測自動離開 +Comment=Sets away status when not detecting movement near the computer +Comment[ar]=يحول وضع الاتصال إلى في الخارج عندما لا يتم تحديد تعاملات مع الكومبيوتر +Comment[bg]=Промяна на състоянието, когато няма активност от страна на потребителя +Comment[bn]=যখন কম্পিউটারের কাছে কোনও চলাচল অনুভূত হয়না তখন অনুপস্থিত অবস্থা নিযুক্ত করে +Comment[bs]=Postavlja status odsutnosti ako nije detektovano kretanje u blizini računara +Comment[ca]=Estableix l'estatus d'absent en no detectar moviment a l'ordinador +Comment[cs]=Nastaví automaticky stav "nepřítomen" při absenci pohybu +Comment[cy]=Gosod cyflwr i "i fwrdd" os na chanfyddir symudiad wrth ymyl y cyfrifiadur +Comment[da]=Sætter borte-status når ingen bevægelse detekteres nær computeren +Comment[de]=Setzt automatisch den Status auf abwesend, wenn keine Aktivität am Rechner feststellbar ist +Comment[el]=Ορίζει την κατάσταση σε απουσία όταν δεν ανιχνεύει κίνηση κοντά στον υπολογιστή +Comment[es]=Se pone en estado Ausente cuando no se detecte movimiento cerca de su equipo +Comment[et]=Määrab äraoleku staatuse, kui arvuti juures mingit elutegevust ei täheldata +Comment[eu]=Ezarri urrunduta egoera konputagailuan mugimendurik ez dagoenean +Comment[fa]=اگر هیچ حرکتی نزدیک رایانۀ شما آشکار نشود، وضعیت را کنار میگذارد +Comment[fi]=Asettaa poissaolevaksi, jos koneen lähistöllä ei havaita liikettä +Comment[fr]=Active l'état absent lorsque aucune activité n'est détectée près de l'ordinateur +Comment[gl]=Pónse en estado alonxado cando non se detectan movementos preto do seu ordenador +Comment[he]=מגדיר מצב "לא נמצא" בעת חוסר פעילות על המחשב +Comment[hi]=जब कम्प्यूटर के आसपास गतिविधि पता नहीं लगता है तो स्थिति को दूर नियत करता है +Comment[hr]=Postavlja status „odsutan“ kada ne detektira pomicanje u blizini računala +Comment[hu]=A távolléti állapot automatikus beállítása, ha nincs mozgás a számítógép körül +Comment[is]=Breytir stöðu þinni ef tölvan er ekki notkun +Comment[it]=Imposta lo stato ad assente quando non viene rilevato nessun movimento +Comment[ja]=コンピュータの近くにいない場合、不在状態にセットします +Comment[ka]=აყენებს გასვლის სტატუსს როდესაც კომპიუტერთან აქტივობა არ შეიმჩნევა +Comment[kk]=Компьютерде қимыл жоқты байқап орында жоқ деген күйді орнатады +Comment[km]=កំណត់ស្ថានភាពមិននៅ នៅពេលកុំព្យូទ័រ និងអ្វីៗនៅជិតវា មិនកម្រើក +Comment[lt]=Būklė nustatoma „Pasitraukęs“, jei šalia kompiuterio nėra jokio judėjimo +Comment[mk]=Го поставува статусот отсутен кога нема движење на компјутерот +Comment[nb]=Sett som borte når det ikke er noen bevegelse på mus eller tastatur +Comment[nds]=Stellt den Status automaatsch op "Nich dor", wenn sik an'n Reekner nix deit +Comment[ne]=कम्प्युटर नजिक चाल पत्ता नलाग्दा वस्तुस्थिति बाहिर सेट गर्दछ +Comment[nl]=Stelt automatisch afwezigheid in als er geen beweging wordt gedetecteerd +Comment[nn]=Set som vekke når det ikkje er noka rørsle på mus eller tastatur +Comment[pl]=Ustawia status "Zaraz wracam", gdy nie wykrywa żadnego ruchu w pobliżu komputera +Comment[pt]=Configura o estado de ausência ao não detectar movimento perto do computador +Comment[pt_BR]=Configura o status de ausente quando não detectar movimento próximo ao computador +Comment[ru]=Устанавливает состояние "отсутствует", если работа за компьютером не регистрируется в течение долгого времени +Comment[sk]=Nastaví stav prítomnosti podľa toho, či bol zaznamenaný pohyb pri počítači +Comment[sl]=Nastavi stanje odsotnosti, ko ni premikanja v bližini računalnika +Comment[sr]=Поставља статус „одсутан“ када не детектује померање у близини рачунара +Comment[sr@Latn]=Postavlja status „odsutan“ kada ne detektuje pomeranje u blizini računara +Comment[sv]=Ställer automatisk in frånvarostatus när ingen rörelse märks nära datorn +Comment[ta]=கணிப்பொறியின் அருகே நடக்கும் இயக்கத்தை கண்டுபிடிக்காத போது அமைக்கும் +Comment[tg]=Ҳангоми муайян накардани ҳаракат дар назди компютер ҳолатро дур месозад +Comment[tr]=Bilgisayarın başında olunmadığı algılanırsa uzakta olarak belirler +Comment[uk]=Встановлює стан у значення "відсутній", якщо не реєструється робота за комп'ютером +Comment[zh_CN]=根据计算机旁的状态设置离开状态 +Comment[zh_HK]=偵測不到電腦附近有動作時將狀態設為「離開」 +Comment[zh_TW]=當偵測不到動作時自動設為離開 diff --git a/kopete/plugins/motionautoaway/motionawayconfig.kcfg b/kopete/plugins/motionautoaway/motionawayconfig.kcfg new file mode 100644 index 00000000..9bad717c --- /dev/null +++ b/kopete/plugins/motionautoaway/motionawayconfig.kcfg @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 + http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > + <kcfgfile name="motionawayconfig" /> + <group name="MotionAutoAway Plugin" > + <entry key="BecomeAvailableWithActivity" type="Bool" > + <label>Become available again when the plugin detects motion</label> + <whatsthis>If this option is set, the plugin will put you in status available if you are away and it detects motion again.</whatsthis> + <default>true</default> + </entry> + <entry key="VideoDevice" type="Path" > + <label>Video device to use for motion detection</label> + <whatsthis>This is the Video4Linux path of the camera or device you want to use to detect motion. In most systems the first video device is /dev/v4l/video0.</whatsthis> + <default>/dev/v4l/video0</default> + </entry> + <entry key="AwayTimeout" type="UInt" > + <label>Become away after this many minutes of inactivity</label> + <whatsthis>This setting affects how fast the plugin switches to away status. Once the plugin detects no motion, it will wait this amount of minutes before switching to away status.</whatsthis> + <default>1</default> + <min>0</min> + </entry> + </group> +</kcfg> diff --git a/kopete/plugins/motionautoaway/motionawayconfig.kcfgc b/kopete/plugins/motionautoaway/motionawayconfig.kcfgc new file mode 100644 index 00000000..52f9d6ca --- /dev/null +++ b/kopete/plugins/motionautoaway/motionawayconfig.kcfgc @@ -0,0 +1,8 @@ +ClassName=MotionAwayConfig +File=motionawayconfig.kcfg +GlobalEnums=true +ItemAccessors=true +MemberVariables=private +Mutators=true +SetUserTexts=false +Singleton=true diff --git a/kopete/plugins/motionautoaway/motionawayplugin.cpp b/kopete/plugins/motionautoaway/motionawayplugin.cpp new file mode 100644 index 00000000..d534a186 --- /dev/null +++ b/kopete/plugins/motionautoaway/motionawayplugin.cpp @@ -0,0 +1,308 @@ +/* + motionawayplugin.cpp + + Kopete Motion Detector Auto-Away plugin + + Copyright (c) 2002 by Duncan Mac-Vicar Prett <[email protected]> + + Contains code from motion.c ( Detect changes in a video stream ) + Copyright 2000 by Jeroen Vreeken ([email protected]) + Distributed under the GNU public license version 2 + See also the file 'COPYING.motion' + + Kopete (c) 2002 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 "config.h" + +#include "motionawayplugin.h" + +#include <fcntl.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/ioctl.h> +#include <sys/poll.h> +#include <sys/types.h> +#include <time.h> +#include <unistd.h> + +#include <qtimer.h> + +#include <kconfig.h> +#include <kdebug.h> +#include <kgenericfactory.h> + +#include "kopeteaccountmanager.h" +#include "kopeteaway.h" +/* The following is a hack: + * e.g. Mandrake 9.x ships with a patched + * kernel which doesn't define this 64 bit types (we need GNU C lib + * because we use long long and warning - gcc extensions.) + * + * This is caused by the !defined(__STRICT_ANSI__) check in + * /usr/include/asm/types.h + */ +#if !defined(__u64) && defined(__GNUC__) +#if SIZEOF_UNSIGNED_LONG >= 8 +typedef unsigned long __u64; +#else +typedef unsigned long long __u64; +#endif +#endif + +#if !defined(__s64) && defined(__GNUC__) +#if SIZEOF_LONG >= 8 +typedef signed long __s64; +#else +typedef __signed__ long long __s64; +#endif +#endif +/* + * End hack + */ + +#include <linux/version.h> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,50) +#define _LINUX_TIME_H +#endif +#include <linux/videodev.h> + +#define DEF_WIDTH 352 +#define DEF_HEIGHT 288 +#define DEF_QUALITY 50 +#define DEF_CHANGES 5000 + +#define DEF_POLL_INTERVAL 1500 + +#define DEF_GAP 60*5 /* 5 minutes */ + +#define NORM_DEFAULT 0 +#define IN_DEFAULT 8 + +typedef KGenericFactory<MotionAwayPlugin> MotionAwayPluginFactory; +K_EXPORT_COMPONENT_FACTORY( kopete_motionaway, MotionAwayPluginFactory( "kopete_motionaway" ) ) + +MotionAwayPlugin::MotionAwayPlugin( QObject *parent, const char *name, const QStringList & /* args */ ) +: Kopete::Plugin( MotionAwayPluginFactory::instance(), parent, name ) +{ + kdDebug(14305) << k_funcinfo << "Called." << endl; + /* This should be read from config someday may be */ + m_width = DEF_WIDTH; + m_height = DEF_HEIGHT; + m_quality = DEF_QUALITY; + m_maxChanges = DEF_CHANGES; + m_gap = DEF_GAP; + + /* We haven't took the first picture yet */ + m_tookFirst = false; + + m_captureTimer = new QTimer(this); + m_awayTimer = new QTimer(this); + + connect( m_captureTimer, SIGNAL(timeout()), this, SLOT(slotCapture()) ); + connect( m_awayTimer, SIGNAL(timeout()), this, SLOT(slotTimeout()) ); + + signal(SIGCHLD, SIG_IGN); + + m_imageRef.resize( m_width * m_height * 3); + m_imageNew.resize( m_width * m_height * 3); + m_imageOld.resize( m_width * m_height * 3); + m_imageOut.resize( m_width * m_height * 3); + + + kdDebug(14305) << k_funcinfo << "Opening Video4Linux Device" << endl; + + m_deviceHandler = open( videoDevice.latin1() , O_RDWR); + + if (m_deviceHandler < 0) + { + kdDebug(14305) << k_funcinfo << "Can't open Video4Linux Device" << endl; + } + else + { + kdDebug(14305) << k_funcinfo << "Worked! Setting Capture timers!" << endl; + /* Capture first image, or we will get a alarm on start */ + getImage (m_deviceHandler, m_imageRef, DEF_WIDTH, DEF_HEIGHT, IN_DEFAULT, NORM_DEFAULT, + VIDEO_PALETTE_RGB24); + + /* We have the first image now */ + m_tookFirst = true; + m_wentAway = false; + + m_captureTimer->start( DEF_POLL_INTERVAL ); + m_awayTimer->start( awayTimeout * 60 * 1000 ); + } + loadSettings(); + connect(this, SIGNAL(settingsChanged()), this, SLOT( loadSettings() ) ); +} + +MotionAwayPlugin::~MotionAwayPlugin() +{ + kdDebug(14305) << k_funcinfo << "Closing Video4Linux Device" << endl; + close (m_deviceHandler); + kdDebug(14305) << k_funcinfo << "Freeing memory" << endl; +} + +void MotionAwayPlugin::loadSettings(){ + KConfig *kconfig = KGlobal::config(); + kconfig->setGroup("MotionAway Plugin"); + + awayTimeout = kconfig->readNumEntry("AwayTimeout", 1); + becomeAvailableWithActivity = kconfig->readBoolEntry("BecomeAvailableWithActivity", true); + videoDevice = kconfig->readEntry("VideoDevice", "/dev/video0"); + m_awayTimer->changeInterval(awayTimeout * 60 * 1000); +} + +int MotionAwayPlugin::getImage(int _dev, QByteArray &_image, int _width, int _height, int _input, int _norm, int _fmt) +{ + struct video_capability vid_caps; + struct video_channel vid_chnl; + struct video_window vid_win; + struct pollfd video_fd; + + // Just to avoid a warning + _fmt = 0; + + if (ioctl (_dev, VIDIOCGCAP, &vid_caps) == -1) + { + perror ("ioctl (VIDIOCGCAP)"); + return (-1); + } + /* Set channels and norms, NOT TESTED my philips cam doesn't have a + * tuner. */ + if (_input != IN_DEFAULT) + { + vid_chnl.channel = -1; + if (ioctl (_dev, VIDIOCGCHAN, &vid_chnl) == -1) + { + perror ("ioctl (VIDIOCGCHAN)"); + } + else + { + vid_chnl.channel = _input; + vid_chnl.norm = _norm; + + if (ioctl (_dev, VIDIOCSCHAN, &vid_chnl) == -1) + { + perror ("ioctl (VIDIOCSCHAN)"); + return (-1); + } + } + } + /* Set image size */ + if (ioctl (_dev, VIDIOCGWIN, &vid_win) == -1) + return (-1); + + vid_win.width=_width; + vid_win.height=_height; + + if (ioctl (_dev, VIDIOCSWIN, &vid_win) == -1) + return (-1); + + /* Check if data available on the video device */ + video_fd.fd = _dev; + video_fd.events = 0; + video_fd.events |= POLLIN; + video_fd.revents = 0; + + poll(&video_fd, 1, 0); + + if (video_fd.revents & POLLIN) { + /* Read an image */ + return read (_dev, _image.data() , _width * _height * 3); + } else { + return (-1); + } +} + +void MotionAwayPlugin::slotCapture() +{ + /* Should go on forever... emphasis on 'should' */ + if ( getImage ( m_deviceHandler, m_imageNew, m_width, m_height, IN_DEFAULT, NORM_DEFAULT, + VIDEO_PALETTE_RGB24) == m_width * m_height *3 ) + { + int diffs = 0; + if ( m_tookFirst ) + { + /* Make a differences picture in image_out */ + for (int i=0; i< m_width * m_height * 3 ; i++) + { + m_imageOut[i]= m_imageOld[i]- m_imageNew[i]; + if ((signed char)m_imageOut[i] > 32 || (signed char)m_imageOut[i] < -32) + { + m_imageOld[i] = m_imageNew[i]; + diffs++; + } + else + { + m_imageOut[i] = 0; + } + } + } + else + { + /* First picture: new image is now the old */ + for (int i=0; i< m_width * m_height * 3; i++) + m_imageOld[i] = m_imageNew[i]; + } + + /* The cat just walked in :) */ + if (diffs > m_maxChanges) + { + kdDebug(14305) << k_funcinfo << "Motion Detected. [" << diffs << "] Reseting Timeout" << endl; + + /* If we were away, now we are available again */ + if ( becomeAvailableWithActivity && !Kopete::Away::globalAway() && m_wentAway) + { + slotActivity(); + } + + /* We reset the away timer */ + m_awayTimer->stop(); + m_awayTimer->start( awayTimeout * 60 * 1000 ); + } + + /* Old image slowly decays, this will make it even harder on + slow moving object to stay undetected */ + /* + for (i=0; i<m_width*m_height*3; i++) + { + image_ref[i]=(image_ref[i]+image_new[i])/2; + } + */ + } + else + { + m_captureTimer->stop(); + } +} + +void MotionAwayPlugin::slotActivity() +{ + kdDebug(14305) << k_funcinfo << "User activity!, going available" << endl; + m_wentAway = false; + Kopete::AccountManager::self()->setAvailableAll(); +} + +void MotionAwayPlugin::slotTimeout() +{ + if(!Kopete::Away::globalAway() && !m_wentAway) + { + kdDebug(14305) << k_funcinfo << "Timeout and no user activity, going away" << endl; + m_wentAway = true; + Kopete::AccountManager::self()->setAwayAll(); + } +} + +#include "motionawayplugin.moc" +// vim: set noet ts=4 sts=4 sw=4: diff --git a/kopete/plugins/motionautoaway/motionawayplugin.h b/kopete/plugins/motionautoaway/motionawayplugin.h new file mode 100644 index 00000000..98e7e343 --- /dev/null +++ b/kopete/plugins/motionautoaway/motionawayplugin.h @@ -0,0 +1,93 @@ +/* + motionawayplugin.h + + Kopete Motion Detector Auto-Away plugin + + Copyright (c) 2002 by Duncan Mac-Vicar Prett <[email protected]> + + Contains code from motion.c ( Detect changes in a video stream ) + Copyright 2000 by Jeroen Vreeken ([email protected]) + Distributed under the GNU public license version 2 + See also the file 'COPYING.motion' + + Kopete (c) 2002 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 MOTIONAWAYPLUGIN_H +#define MOTIONAWAYPLUGIN_H + +#include "kopeteplugin.h" + +class QTimer; + +/** + * @author Duncan Mac-Vicar Prett <[email protected]> + */ + +class MotionAwayPlugin : public Kopete::Plugin +{ + Q_OBJECT + +public: + MotionAwayPlugin( QObject *parent, const char *name, const QStringList &args ); + ~MotionAwayPlugin(); + +public slots: + void loadSettings(); + void slotTimeout(); + void slotCapture(); + void slotActivity(); + +private: + int awayTimeout; + bool becomeAvailableWithActivity; + QString videoDevice; + + QTimer *m_captureTimer; + QTimer *m_awayTimer; + + int getImage(int, QByteArray& ,int ,int ,int ,int ,int ); + + bool m_tookFirst; + bool m_wentAway; + + int m_width; + int m_height; + + int m_quality; + int m_maxChanges; + + int m_deviceHandler; + int shots; + int m_gap; + + QByteArray m_imageRef; + QByteArray m_imageNew; + QByteArray m_imageOld; + QByteArray m_imageOut; + + /* + time_t currenttimep; + time_t lasttime; + struct tm *currenttime; + + char file[255]; + char filepath[255]; + char c; + + */ +}; + +#endif + +// vim: set noet ts=4 sts=4 sw=4: + diff --git a/kopete/plugins/motionautoaway/motionawaypreferences.cpp b/kopete/plugins/motionautoaway/motionawaypreferences.cpp new file mode 100644 index 00000000..a4962c5c --- /dev/null +++ b/kopete/plugins/motionautoaway/motionawaypreferences.cpp @@ -0,0 +1,70 @@ +/* + Kopete Motion Detector Auto-Away plugin + + Copyright (c) 2002-2004 by Duncan Mac-Vicar Prett <[email protected]> + + Kopete (c) 2002 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 <qlayout.h> +#include <qobject.h> +#include <qcheckbox.h> + +#include <kgenericfactory.h> +#include <klineedit.h> +#include <knuminput.h> + +#include "motionawayprefs.h" +#include "motionawaypreferences.h" +#include "motionawayconfig.h" + +typedef KGenericFactory<MotionAwayPreferences> MotionAwayPreferencesFactory; +K_EXPORT_COMPONENT_FACTORY( kcm_kopete_motionaway, MotionAwayPreferencesFactory("kcm_kopete_motionaway")) + +MotionAwayPreferences::MotionAwayPreferences(QWidget *parent, const char* /*name*/, const QStringList &args) + : KCModule(MotionAwayPreferencesFactory::instance(), parent, args) +{ + // Add actuall widget generated from ui file. + ( new QVBoxLayout( this ) )->setAutoAdd( true ); + preferencesDialog = new motionawayPrefsUI(this); + connect(preferencesDialog->BecomeAvailableWithActivity, SIGNAL(toggled(bool)), this, SLOT(slotWidgetModified())); + connect(preferencesDialog->AwayTimeout, SIGNAL(valueChanged(int)), this, SLOT(slotWidgetModified())); + connect(preferencesDialog->VideoDevice, SIGNAL(textChanged(const QString &)), this, SLOT(slotWidgetModified())); + load(); +} + +void MotionAwayPreferences::load() +{ + MotionAwayConfig::self()->readConfig(); + preferencesDialog->AwayTimeout->setValue(MotionAwayConfig::self()->awayTimeout()); + preferencesDialog->BecomeAvailableWithActivity->setChecked(MotionAwayConfig::self()->becomeAvailableWithActivity()); + preferencesDialog->VideoDevice->setText(MotionAwayConfig::self()->videoDevice()); + emit KCModule::changed(false); +} + +void MotionAwayPreferences::slotWidgetModified() +{ + emit KCModule::changed(true); +} + +void MotionAwayPreferences::save() +{ + MotionAwayConfig::self()->setAwayTimeout(preferencesDialog->AwayTimeout->value()); + MotionAwayConfig::self()->setBecomeAvailableWithActivity(preferencesDialog->BecomeAvailableWithActivity->isChecked()); + MotionAwayConfig::self()->setVideoDevice(preferencesDialog->VideoDevice->text()); + MotionAwayConfig::self()->writeConfig(); + emit KCModule::changed(false); +} + +#include "motionawaypreferences.moc" + +// vim: set noet ts=4 sts=4 sw=4: diff --git a/kopete/plugins/motionautoaway/motionawaypreferences.h b/kopete/plugins/motionautoaway/motionawaypreferences.h new file mode 100644 index 00000000..43b33411 --- /dev/null +++ b/kopete/plugins/motionautoaway/motionawaypreferences.h @@ -0,0 +1,45 @@ +/* + Kopete Motion Detector Auto-Away plugin + + Copyright (c) 2002-2004 by Duncan Mac-Vicar Prett <[email protected]> + + Kopete (c) 2002 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 MOTIONAWAYPREFERENCES_H +#define MOTIONAWAYPREFERENCES_H + +#include "kcmodule.h" + +class motionawayPrefsUI; + +/** + * Preference widget for the Motion Away plugin + * @author Duncan Mac-Vicar P. + */ +class MotionAwayPreferences : public KCModule +{ + Q_OBJECT +public: + MotionAwayPreferences(QWidget *parent = 0, const char *name = 0, const QStringList &args = QStringList()); + virtual void save(); + virtual void load(); + +private: + motionawayPrefsUI *preferencesDialog; +private slots: + void slotWidgetModified(); +}; + +#endif + +// vim: set noet ts=4 sts=4 sw=4: diff --git a/kopete/plugins/motionautoaway/motionawayprefs.ui b/kopete/plugins/motionautoaway/motionawayprefs.ui new file mode 100644 index 00000000..134f939a --- /dev/null +++ b/kopete/plugins/motionautoaway/motionawayprefs.ui @@ -0,0 +1,297 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>motionawayPrefsUI</class> +<author>Duncan Mac-Vicar P.</author> +<widget class="QWidget"> + <property name="name"> + <cstring>motionawayPrefsUI</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>411</width> + <height>406</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string><p>Motion Auto-Away can set you to be away automatically when it does not detect motion from your webcam or any video4linux device.</p> <p>It will put you online again when it detects you moving in front of the camera.</p></string> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>line1</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="QGroupBox"> + <property name="name"> + <cstring>groupBox2</cstring> + </property> + <property name="title"> + <string>Video Settings</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout21</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel2_2</cstring> + </property> + <property name="text"> + <string>&Video4Linux device:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>VideoDevice</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>95</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KLineEdit"> + <property name="name"> + <cstring>VideoDevice</cstring> + </property> + <property name="text"> + <string>/dev/video0</string> + </property> + </widget> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer21</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox1</cstring> + </property> + <property name="title"> + <string>Away Settings</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout5</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>BecomeAvailableWithActivity</cstring> + </property> + <property name="text"> + <string>Become available when &detecting activity again</string> + </property> + <property name="checked"> + <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>30</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout6</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel2</cstring> + </property> + <property name="text"> + <string>&Become away after this many minutes of inactivity:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>AwayTimeout</cstring> + </property> + </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>20</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout16</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KIntNumInput"> + <property name="name"> + <cstring>AwayTimeout</cstring> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>minutes</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>180</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer22</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klineedit.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> +</includehints> +</UI> |