From 10a33e14d6338ff004410413f6fe52810be43f67 Mon Sep 17 00:00:00 2001 From: anbr Date: Tue, 21 Dec 2010 20:36:58 +0100 Subject: release 0.1.0 from http://www.schmidtie.de/download/vdr-dvdswitch-0.1.0.tar.bz2 --- COPYING | 340 ++++++ HISTORY | 180 +++ Makefile | 83 ++ README | 11 + commands.c | 850 ++++++++++++++ commands.h | 261 +++++ debug.c | 68 ++ debug.h | 28 + dvdlist-item.c | 15 + dvdlist-item.h | 19 + dvdlist.c | 75 ++ dvdlist.h | 28 + dvdplugin.c | 173 +++ dvdplugin.h | 48 + dvdswitch.c | 210 ++++ helpers.c | 689 +++++++++++ helpers.h | 270 +++++ i18n.c | 3327 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ i18n.h | 16 + imagelist-item.c | 57 + imagelist-item.h | 40 + imagelist.c | 203 ++++ imagelist.h | 37 + menu-item.c | 29 + menu-item.h | 30 + menu.c | 1157 +++++++++++++++++++ menu.h | 149 +++ setup-itypes.c | 243 ++++ setup-itypes.h | 40 + setup.c | 518 +++++++++ setup.h | 114 ++ tools.c | 27 + tools.h | 122 ++ 33 files changed, 9457 insertions(+) create mode 100644 COPYING create mode 100644 HISTORY create mode 100644 Makefile create mode 100644 README create mode 100644 commands.c create mode 100644 commands.h create mode 100644 debug.c create mode 100644 debug.h create mode 100644 dvdlist-item.c create mode 100644 dvdlist-item.h create mode 100644 dvdlist.c create mode 100644 dvdlist.h create mode 100644 dvdplugin.c create mode 100644 dvdplugin.h create mode 100644 dvdswitch.c create mode 100644 helpers.c create mode 100644 helpers.h create mode 100644 i18n.c create mode 100644 i18n.h create mode 100644 imagelist-item.c create mode 100644 imagelist-item.h create mode 100644 imagelist.c create mode 100644 imagelist.h create mode 100644 menu-item.c create mode 100644 menu-item.h create mode 100644 menu.c create mode 100644 menu.h create mode 100644 setup-itypes.c create mode 100644 setup-itypes.h create mode 100644 setup.c create mode 100644 setup.h create mode 100644 tools.c create mode 100644 tools.h diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..5b6e7c6 --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + 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 + + 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. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 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) 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. + + , 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/HISTORY b/HISTORY new file mode 100644 index 0000000..926129d --- /dev/null +++ b/HISTORY @@ -0,0 +1,180 @@ +VDR Plugin 'dvdswitch' Revision History +--------------------------------------- + +2006-03-03: Version 0.1.0 +- FIX: Kompilierprobleme mit der 'dvdplugin.c' behoben (Danke an Frank99) +- FIX: DVD-Plugin Thread-Objekt wird nun sauber beendet. +- FIX: Beim Erstellen von Images wurde in bestimmten Situationen der +DVD-Gerätename falsch übergeben. Die Funkion "ReadLink", die der VDR nutzt hat +hier bei relativen Links leider nicht den absoluten Pfad ausgegeben. Das Plugin +setzt das nun korrekt um. +- FIX: Die Funktion strtok wurde gg. strtok_r ausgetauscht das sollte einige +Komplierprobleme beheben und hoffentlich keine neue hervorufen :) (Danke an +soave) +- NEU: Ein komplettes Verzeichnis-Management wurde hinzugefügt. Damit ist es +möglich Verzeichnisse anzulegen, umzubenenen, zu verschieden und zu löschen. +Hinweis: Sollte eine derartige Aktion ausgeführt worden sein, wird die +Image-Liste nach verlassen des Management-Bereiches neu aufgebaut. Das +Verschieben ist Thread gesteuert. Es kann dadurch vorkommen, wenn das +Verschieben noch nicht noch nicht beendet ist, das während des Neuaufbaus das +verschobene Element nicht auftaucht. Hier hilft ein Neu-Öffnen des Plugin. Damit +dies nicht allzuoft passiert, ist eine kleine Pause von 500ms zwischen Aktion +und Neuaufbau gesetzt. +- NEU: Images lassen sich nun in die verschiedenen Unterverzeichnisse +verschieben. Auch hier kann es dazu kommen, dass das verschobene Element nicht +gleich wieder auftaucht, wenn das Verschieben noch nicht abgeschlossen ist. +- NEU: Images lassen sich nun umbenennen. +- NEU: Zum Löschen von Images und Verzeichnissen ist eine eigene Routine +implementiert worden. Damit sollten "Löschprobleme" endlich nicht mehr +existieren. In diesem Zusammenhang ist der ganze Löschvorgang in einem Thread +ausgelagert worden. Damit sollte es keine Behinderung des eigentlichen +VDR-Betriebes geben. Hinweis: In diesem Thread werden VOR Beginn des +Löschvorganges die Images/Verzeichnisse mit einem ".del" versehen und in der +Image-Anzeige wird alles mit ".del" am Ende ausgefiltert und nicht angezeigt. +- NEU: Das Plugin wird NICHT mehr nach einem Löschvorgang beendet +- NEU: Die Schublade des DVD-Laufwerkes lässt sich über das Plugin öffnen und +schließen. Das ganze passiert über das Programm "eject" in ähnlicher weise wie +das "trayopen" Plugin. +- NEU: Das im Plugin zuletzt selektierte Element (Image, Verzeichnis, +DVD-Geräte-Eintrag) bleibt während des VDR-Betriebes selektiert, auch wenn das +Plugin geschlossen wird. +- NEU: Ein "Befehle" Menü wurde hinzugefügt, welches alle bisherigen und +natürlich die neuen Funktionen anbietet. konkret sind das: +* Verzeichnis Management +* DVD Schublade öffnen +* DVD Schublade schließen +* Wiedergabe +* Image umbenennen +* Image verschieben +* Image löschen +* Image brennen +* Image von DVD erstellen +Im Standard ist nun die Taste "Rot" mit dem Aufruf dieses Befehlemenüs versehen. +- NEU: Im Setup lassen sich die Tasten 1-9, 0, die Farbtasten sowie OK +individuell mit allen Befehlen individuell belegen. So kann sich jeder +die Bedienung so legen. wie er es mag bzw. gewohnt ist. Macht im Grunde das +Befehlemenü überflüssig, aber evtl. ist dem einen oder anderen das Arbeiten +über dieses Menü lieber :) +- NEU: An allen relevanten Stellen (wenn ich nicht gerade eine Übersehen habe) +sollte eine Rechteprüfung in Bezug des Nutzers, unter dem der VDR läuft, +passieren. Will man bspw. ein Verzeichnis in einem anderen anlegen, in dem man +nicht die benötigten Rechte hat, so gibt das Plugin eine entsprechende Info +aus. +- NEU: Vor den Image-Namen kann man sich eine Spalte "Image-Größe" angzeigen +lassen. Die Größenangabe bezieht sich auf GB und wird mit einer Nachkommastelle +angezeigt. Entsprechende Option zum aktivieren befindet sich im Setup unter +"Detailierte Anzeigen Einstellung". +- Die Funktionsweise zum Anzeige-Modi "Kategorie" wurde verändert. +Die Kategorie "Image-Typ" unterscheidet nicht mehr nach "Verzeichnis" und +"ISO-Image" sondern nach den unterschiedlichen Typen die im Setup unter +"Imagetyp" eingetragen sind. Dafür gibt es einen dritten Kategoriemodus mit der +Bezeichnung "Datei-Typ", welcher die alte Funktion übernimmt. +In diesem Zusammenhang wurde die Setup-Einstellung "ISO zuerst" entfernt. +- ACHTUNG: Die Funktion "Image erstellen" wurde verändert: +1. Nun kann nebst dem Image-Namen auch das Verzeichnis relativ zum +Image-Hauptverzeichnis ausgewählt werden und somit das zu erstellende Image +gleich in ein Unterverzeichnis einsortiert werden. Wird nichts angegeben, geht +das Plugin vom Hauptverzeichnis aus. +2. Zudem gibt es nicht mehr die Selektierung "ISO-Image" und "Verzeichnis" für +die Wahl nach dem ImageTyp. Die vorhandenen ImageTyp-Liste, die im Setup +erstellt werden kann, wird als Auswahl zur Verfügung gestellt. Wird ein +ImageTyp mit der Option "Datei" ausgewählt, wird dem angegebenen Image-Namen +die entsprechende Extension automatisch angehangen. Diese SOLLTE also nicht +beim Namen angegeben werden. +3. Dem Script wurde als 3. Parameter immer das DVD-Device übergeben. War das +dem DVD-Plugin übergebene Device nur ein Link (bspw. /dev/dvd auf /dev/hd?), so +sollte der Link entsprechend aufgelöst werden um das echte Device zu übergeben. +Nicht nur, das diese Auflösung in einigen Fällen fehlerhaft war, so brachte es +den ReadScript's schlicht nichts. Benötigt wird ja eher ein MountPoint, in den +die eingelegte DVD gemountet werden kann. Aus diesem Grund wird das Plugin nun +versuchen aus der fstab einen evtl. eingetragenen MountPoint herauszufiltern +und dem Script als 4ten Parameter zu übergeben. Gibt es in der fstab keinen +Eintrag, so wird nichts übergeben. Dann muss dieser Pfad in das benutzte Script +hart eingetragen werden. +Übergebene Parameter sind demzufolge: +1. Pfad in dem das Image abgelegt werden soll +2. Name des zukünftigen Images INKLUSIVE der Datei-Extension +3. Das echte DVD-Device +4. ein evtl. in der fstab eingetragener MountPoint für das DVD-Device +5. Info ob das Image als "IMAGE" oder "DIR" angelegt werden soll. +Ob und was für Parameter ausgewertet werden, kann das Script natürlich selbst +entscheiden. +- Die Parameter für das "WriteScript" wurden geändert. Hier muss eine Anpassung +vorgenommen werden. Parameter 3 (Image-Kurzname) ist entfallen. +Übergeben Paremeter sind jetzt: +1. voller Imagename inkl. Pfad +2. Image Typ (wie vorher: "IMAGE" bzw. "DIR"). +- Die Aufrufe für das Einlesen von DVDs und Brennen vom Images sind in Thread's +ausgelagert worden. Bringt derzeit noch keine großen Vorteile ... aber wer weiß +was noch kommt :) + + +2005-10-18: Version 0.0.3 +- NEU: Das Plugin startet nun auch, wenn im ImageDir kein Image vorgefunden + wird, damit wenigstens über die "Lies DVD" Funktion Images generiert werden + können (Danke an m0190). +- FIX: In diesem Zusammenhang gab es an vielen Stellen Crash's, wenn kein + Image vorhanden war. Alle Fehler sollten behoben sein. +- NEU: Im Anzeige-Modi "Verzeichnisse" wird beim Navigieren einer Ebene zurück + ([..]), das ursprünglich selektierte Verzeichnis wieder ausgewählt. +- NEU: Über das Setup kann man nun in jedem Anzeige-Modi ein Eintrag für das + eigentliche DVD-Laufwerk einblenden lassen. Die Auswahl dieses + Eintrages startet dann entsprechend das DVD-Plugin mit dem echten DVD-Device. +- NEU: Der im Setup angegebene Name für das DVDSwitch Plugin wird nun nicht + mehr nur im Hauptmenü angezeigt, sondern auch als Titel der Images-Übersicht. +- NEU: Im Titel der Images-Übersicht kann man sich bei Bedarf den noch + verfügbaren Speicherplatz anzeigen lassen inkl. der Anzeige über die Anzahl an + DVD5 (4,7GB) und DVD9 (8,5GB) Images, die noch Platz haben dürften. Die + Anzeige lässt sich im Setup entsprechen de-/aktivieren. +- NEU: Das, was das Plugin als "DVD-Image" ansieht (derzeit Dateien mit der + Extension ".iso" und Verzeichnisse mit einem Unterverzeichnis namens + "video_ts") kann nun direkt beinflusst werden. Dazu kann man über das + Setup-Menü eine "Image-Liste" pflegen. Bei der Imageart "Verzeichnis" muss + angegeben werden, was dieses Verzeichnis für ein(e) Datei/Verzeichnis + beinhaltet. Bei der Imageart "Datei" muss die Extension angegeben werden. + Zustätzlich kann zu jeder Dateiart ausgewählt werden, ob die Extension + ausgeblendet werden soll. Wer sich die "ImageTyp" Spalte einblenden lässt wird + zukünftig das sehen, was in der Image-Liste zu jedem Eintrag als anzuzeigende + Bezeichnung angegeben wurde. + Als Standard sind hier Image-Dateien mit ".iso" als Extension und + Image-Verzeichnise mit "video_ts" als Unterverzeichnis angeben. +- Aus Gründen der Übersicht wurde die SetupPage überarbeitet. +- Das DVD-Plugin wird nun bei einer VDR-Version >= 1.3.32 über die Funktion + "cRemote::CallPlugin()" gestartet. +- FIX: Ein möglicher Crash bei der Übergabe des TempDevices sollte nun nicht + mehr auftauchen (Danke Viking). +- FIX/NEU: Netter Nebeneffekt: Ein zusätzlicher DVD-Plugin-Patch ist nicht mehr + nötig, es sollte nun auch ohne klappen (Danke wieder einmal für den Test an + ravenclaw_78!! :)). +- FIX: syslog läuft beim Parsen der Konfigeinträge nun nicht mehr unnötig mit + Fehlern voll (Danke an egal). + + +2005-10-07: Version 0.0.2 +- NEU: Übergabe des ImageDir nun optional via Parameter. Der entsprechende + Menüpunkt im Setup ist dann deaktiviert. (Idee von ronnykornexl) +- NEU: Es gibt nun Defaultangaben für das Write- und Readscript. Sollte keine + Angaben über die Pluginparameter erfolgen so gilt: + /usr/local/bin/dvdswitch_writedvd.sh und + /usr/local/bin/dvdswitch_readdvd.sh. + Entsprechend sind einige Sicherheitsabfragen über die existens etc. + eingeflossen. (Idee von neves) +- FIX: Im SetupMenü kann bei der Angabe für das ImageDir nun auch der Slash + ausgewählt werden. (Danke an ravenclaw_78) +- FIX: Im Submenü zum einlesen einer DVD werden nun beim editieren des + gewünschten DVD-Namens auch die Optionen zum Umschalten Groß-/Kleinschreibung + etc. angeboten. Zudem kann der Lesevorgang zu der Farbtaste auch über OK + gestartet werden. +- PATCH: Sollte es mit der Übergabe des TempDevices des Switch-Plugins an das + DVD-Plugin nicht klappen, so sollte erst mal das DVD-Plugin mit dem + beigefügten Diff-File (patches Ordner) gepatcht werden. (ganz großen Dank hier + an ravenclaw_78 für die vielen Tests!!) +- Die Funktionen der Farbtasten wurden neu zugeordnet. +- Aus dem "lese DVD" bei den Farbtasten wurde ein "lies DVD". +- Einige Codeverbesserungen (so hoffe ich :)). + + + +2005-10-05: Version 0.0.1 + +- Initial revision. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b476a11 --- /dev/null +++ b/Makefile @@ -0,0 +1,83 @@ +# +# Makefile for a Video Disk Recorder plugin +# +# $Id$ + +# The official name of this plugin. +# This name will be used in the '-P...' option of VDR to load the plugin. +# By default the main source file also carries this name. +# +PLUGIN = dvdswitch + +### The version number of this plugin (taken from the main source file): + +VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g') + +### The C++ compiler and options: + +CXX ?= g++ +CXXFLAGS ?= -O2 -Wall -Woverloaded-virtual + +### The directory environment: + +DVBDIR = ../../../../DVB +VDRDIR = ../../.. +LIBDIR = ../../lib +TMPDIR = /tmp + +### Allow user defined options to overwrite defaults: + +-include $(VDRDIR)/Make.config + +### The version number of VDR (taken from VDR's "config.h"): + +VDRVERSION = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') + +### The name of the distribution archive: + +ARCHIVE = $(PLUGIN)-$(VERSION) +PACKAGE = vdr-$(ARCHIVE) + +### Includes and Defines (add further entries here): + +INCLUDES += -I$(VDRDIR)/include -I$(DVBDIR)/include + +DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' + +### The object files (add further files here): + +#OBJS = $(PLUGIN).o i18n.o menu-item.o menu.o dvdlist-item.o dvdlist.o dvdplugin.o setup.o setup-itypes.o imagelist.o imagelist-item.o commands.o helpers.o debug.o +OBJS = $(PLUGIN).o i18n.o debug.o helpers.o tools.o imagelist-item.o imagelist.o dvdlist-item.o dvdlist.o dvdplugin.o menu-item.o menu.o setup.o setup-itypes.o commands.o + +### Implicit rules: + +%.o: %.c + $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $< + +# Dependencies: + +MAKEDEP = $(CXX) -MM -MG +DEPFILE = .dependencies +$(DEPFILE): Makefile + @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@ + +-include $(DEPFILE) + +### Targets: + +all: libvdr-$(PLUGIN).so + +libvdr-$(PLUGIN).so: $(OBJS) + $(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@ + @cp $@ $(LIBDIR)/$@.$(VDRVERSION) + +dist: clean + @-rm -rf $(TMPDIR)/$(ARCHIVE) + @mkdir $(TMPDIR)/$(ARCHIVE) + @cp -a * $(TMPDIR)/$(ARCHIVE) + @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE) + @-rm -rf $(TMPDIR)/$(ARCHIVE) + @echo Distribution package created as $(PACKAGE).tgz + +clean: + @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~ diff --git a/README b/README new file mode 100644 index 0000000..a40a815 --- /dev/null +++ b/README @@ -0,0 +1,11 @@ +This is a "plugin" for the Video Disk Recorder (VDR). + +Written by: Andreas Schmidt(Darkside) + +Project's homepage: None + +Latest version available at: http://download.schmidtie.de/dvdswitch.tar.bz2 + +See the file COPYING for license information. + +Description: diff --git a/commands.c b/commands.c new file mode 100644 index 0000000..8b3bb1b --- /dev/null +++ b/commands.c @@ -0,0 +1,850 @@ +#include +#include +#include "commands.h" +#include "setup.h" +#include "tools.h" +#include "menu-item.h" +#include "imagelist.h" +#include "dvdplugin.h" +#include "setup-itypes.h" + +// --- cCMD ---------------------------------------------------------- + +eOSState cCMD::Play(cMainMenuItem *item) +{ + if(item) + DEBUG("Play Image %s, %i", item->FileName(), item->Type()); + else + DEBUG("Play Image: Kein Image angegeben"); + + if(!item || item->Type() == iDevice) + cDVDPlugin::Start(); + else if (item && item->Type() == iDVD) + cDVDPlugin::Start(item->FileName()); + + return osEnd; +} + +eOSState cCMD::Eject(bool close) +{ + char *cmd = NULL; + asprintf(&cmd, "eject %s %s", close ? "-t" : "", DVDSwitchSetup.DVDLinkOrg); + DEBUG("Eject: %i - %s", close, cmd); + int rc = system(cmd); + DEBUG("Eject-Rückgabe: %i", rc); + free(cmd); + + return osContinue; +} + +// --- cCMDMenu ------------------------------------------------------------- + +cCMDMenu::cCMDMenu(cMainMenuItem *item, cMainMenu *osdobject) + : cOsdMenu(tr("Commands")) +{ + iItem = item; + OsdObject = osdobject; + cOsdItem *mItem = NULL; + + Add(new cOsdItem(tr("Directory Management"))); + Add(new cOsdItem(tr("DVD-Tray open"))); + Add(new cOsdItem(tr("DVD-Tray close"))); + Add(new cOsdItem(tr("Play"))); + if(!iItem || (iItem && iItem->Type() != iDVD && iItem->Type() != iDevice)) + { + mItem = Last(); + mItem->SetSelectable(false); + } + Add(new cOsdItem(tr("Image rename"))); + if(!iItem || (iItem && iItem->Type() != iDVD)) + { + mItem = Last(); + mItem->SetSelectable(false); + } + Add(new cOsdItem(tr("Image move"))); + if(!iItem || (iItem && iItem->Type() != iDVD)) + { + mItem = Last(); + mItem->SetSelectable(false); + } + Add(new cOsdItem(tr("Image delete"))); + if(!iItem || (iItem && iItem->Type() != iDVD)) + { + mItem = Last(); + mItem->SetSelectable(false); + } + Add(new cOsdItem(tr("Image burn"))); + if(!iItem || (iItem && iItem->Type() != iDVD)) + { + mItem = Last(); + mItem->SetSelectable(false); + } + Add(new cOsdItem(tr("Image to create from DVD"))); +} + +eOSState cCMDMenu::ProcessKey(eKeys Key) +{ + eOSState ret = osUnknown; + + if(!HasSubMenu()) + { + cCMDImage *CMDImage = NULL; + cOsdItem *item = NULL; + eCMDs cmd = cmdNone; + switch(Key) + { + case kOk: + item = Get(Current()); + if(!strcasecmp(item->Text(),tr("Directory Management"))) + cmd = cmdDirManage; + if(!strcasecmp(item->Text(),tr("DVD-Tray open"))) + cmd = cmdDVDopen; + if(!strcasecmp(item->Text(),tr("DVD-Tray close"))) + cmd = cmdDVDclose; + if(!strcasecmp(item->Text(),tr("Play"))) + cmd = cmdImgPlay; + if(!strcasecmp(item->Text(),tr("Image rename"))) + cmd = cmdImgRename; + if(!strcasecmp(item->Text(),tr("Image move"))) + cmd = cmdImgMove; + if(!strcasecmp(item->Text(),tr("Image delete"))) + cmd = cmdImgDelete; + if(!strcasecmp(item->Text(),tr("Image burn"))) + cmd = cmdImgBurn; + if(!strcasecmp(item->Text(),tr("Image to create from DVD"))) + cmd = cmdImgRead; + switch(cmd) + { + case cmdDirManage: + return AddSubMenu(new cCMDDir(OsdObject)); + break; + case cmdDVDopen: + return cCMD::Eject(false); + break; + case cmdDVDclose: + return cCMD::Eject(true); + break; + case cmdImgPlay: + return cCMD::Play(iItem); + break; + case cmdImgRename: + OsdObject->SetState(mmsImgRename); + item = OsdObject->Get(OsdObject->Current()); + item->ProcessKey(kRight); + return osBack; + break; + case cmdImgMove: + return AddSubMenu(new cCMDMove(iItem->FileName(), OsdObject, false)); + break; + case cmdImgDelete: + CMDImage = new cCMDImage(OsdObject); + ret = CMDImage->Delete(iItem->FileName()); + DELETENULL(CMDImage); + return ret; + break; + case cmdImgBurn: + CMDImage = new cCMDImage(OsdObject); + ret = CMDImage->Burn(iItem->FileName()); + DELETENULL(CMDImage); + return ret; + break; + case cmdImgRead: + return AddSubMenu(new cCMDImageRead); + break; + default: + break; + } + break; + default: + break; + } + } + + return cOsdMenu::ProcessKey(Key); +} + +// --- cCMDDir ------------------------------------------------------------ + +cCMDDir::cCMDDir(cMainMenu *osdobject, bool select, char *buffer) + : cOsdMenu(tr("Directory Management")) +{ + DEBUG("Verzeichnis Management"); + ImageDir(DVDSwitchSetup.ImageDir); + CurrentDir(DVDSwitchSetup.ImageDir); + ParentDir(DVDSwitchSetup.ImageDir); + + State = csNone; + OsdObject = osdobject; + Select = select; + Buffer = buffer; + SetDir(); + + if(Select) + SetTitle(tr("Select Directory")); + + Build(DVDSwitchSetup.ImageDir); + cMainMenuItem *mItem = (cMainMenuItem*)Get(Current()); + if(mItem) + LastSelDir(mItem->FileName()); +} + +void cCMDDir::SetHelp(void) +{ + cMainMenuItem *item = NULL; + switch(State) + { + case csNone: + item = (cMainMenuItem*)Get(Current()); + if(Count() && item && item->Type() == iDir) + if(Select) + cOsdMenu::SetHelp(NULL, tr("New"), NULL , tr("Select")); + else + cOsdMenu::SetHelp(tr("Rename"), tr("New"), tr("Delete"), tr("Move")); + else + cOsdMenu::SetHelp(NULL, tr("New"), NULL , NULL); + break; + default: + cOsdMenu::SetHelp(NULL, NULL, NULL , NULL); + break; + } +} + +void cCMDDir::Build(char *dir) +{ + DEBUG("Erstelle Verzeichnisliste %s", dir); + if(!dir) + dir = CurrentDir(); + + Clear(); + if(State == csNone) + { + SetCols(0); + SetTitle(tr("Edit Directories")); + } + + cDirHandling *DirHand = new cDirHandling(this, this); + SetCurrent(Get(DirHand->Build(dir, true))); + delete(DirHand); + + Display(); + SetHelp(); +} + +eOSState cCMDDir::ProcessKey(eKeys Key) +{ + cMainMenuItem *mItem = NULL; + cDirHandling *DirHand = NULL; + cFileInfo *info = NULL; + + if(!HasSubMenu()) + { + switch(State) + { + case csNone: + mItem = (cMainMenuItem*)Get(Current()); + switch(Key) + { + case kUp: + case kUp|k_Repeat: + case kDown: + case kDown|k_Repeat: + cOsdMenu::ProcessKey(Key); + SetHelp(); + mItem = (cMainMenuItem*)Get(Current()); + if(mItem) + LastSelDir(mItem->FileName()); + return osContinue; + break; + case kOk: + info = new cFileInfo(mItem->FileName()); + if(!info->isExecutable() || !info->isReadable()) + { + DEBUG("Verzeichniswechsel: Keine Rechte"); + DELETENULL(info); + OSD_ERRMSG(tr("no Rights!")); + return osContinue; + break; + } + DELETENULL(info); + DirHand = new cDirHandling(this, this); + DirHand->ProcessKey(mItem); + delete(DirHand); + Build(); + break; + case kRed: + if(mItem->Type() == iDir) + return Edit(mItem); + break; + case kGreen: + return New(); + break; + case kYellow: + if(mItem->Type() == iDir && Interface->Confirm(tr("really delete?"))) + { + DEBUG("Verzeichnis löschen"); + if(cFileCMD::DirIsEmpty(mItem->FileName()) || + (!cFileCMD::DirIsEmpty(mItem->FileName()) && Interface->Confirm(tr("Directory not empty. however delete?")))) + { + cFileDelThread *del = new cFileDelThread(mItem->FileName()); + if(del->OK()) + { + DEBUG("Verzeichnis löschen gestartet"); + del->Start(); + Build(); + OsdObject->SetState(mmsReInit); + } + else + DELETENULL(del); + } + return osContinue; + } + break; + case kBlue: + if(mItem->Type() == iDir) + { + if(Select) + { + DEBUG("Verzeichnis gewählt: %s", mItem->FileName()); + info = new cFileInfo(mItem->FileName()); + if(!info->isExecutable() || !info->isReadable()) + { + DEBUG("Verzeichnis: Keine Rechte"); + OSD_ERRMSG(tr("no Rights!")); + } + else + { + char *seldir = mItem->FileName(); + for (unsigned int i = 0; i < strlen(DVDSwitchSetup.ImageDir); i++) + seldir++; + if(seldir[0] == '/') + seldir++; + strn0cpy((char*)Buffer, seldir, MaxFileName); + cRemote::Put(kBack); + } + DELETENULL(info); + return osContinue; + } + else + return AddSubMenu(new cCMDMove(mItem->FileName(), OsdObject)); + } + break; + default: + break; + } + break; + case csDirNew: + return New(Key); + break; + case csDirEdit: + return Edit(Key); + break; + default: + break; + } + } + + eOSState ret = cOsdMenu::ProcessKey(Key); + + if(!HasSubMenu() && Key == kBlue && ret == osContinue) + { + if((cMainMenuItem*)Get(Current() + 1)) + mItem = (cMainMenuItem*)Get(Current() + 1); + else + mItem = (cMainMenuItem*)Get(Current() - 1); + if(mItem) + LastSelDir(mItem->FileName()); + Build(); + } + + return ret; +} + +eOSState cCMDDir::New(void) +{ + DEBUG("Verzeichnis: Neu"); + cFileInfo *info = new cFileInfo(CurrentDir()); + if(!info->isWriteable()) + { + DEBUG("Verzeichnis: Neu: Keine Berechtigung in %s", CurrentDir()); + OSD_ERRMSG(tr("no Rights to create")); + } + else + { + State = csDirNew; + SetCols(5); + SetTitle(CurrentDir()); + SetDir(); + + cMainMenuItem *mItem = (cMainMenuItem*)First(); + Ins(new cMenuEditStrItem(tr("New:"), Dir, MaxFileName, tr(" abcdefghijklmnopqrstuvwxyz0123456789-.#~")), + true, + mItem); + while(mItem) + { + mItem->SetSelectable(false); + mItem = (cMainMenuItem*)Next(mItem); + } + Display(); + cOsdMenu::ProcessKey(kRight); + } + + return osContinue; +} + +eOSState cCMDDir::New(eKeys Key) +{ + switch(Key) + { + case kOk: + if(!isempty(Dir)) + { + char *buffer = NULL; + asprintf(&buffer, "%s/%s", CurrentDir(), stripspace(Dir)); + DEBUG("Verzeichnis: Neu: Anlegen: %s", buffer); + cFileInfo *info = new cFileInfo(buffer); + if(info->isExists()) + { + DEBUG("Verzeichnis existiert bereits"); + OSD_WARNMSG(tr("Directory exists")); + FREENULL(buffer); + DELETENULL(info); + return osContinue; + } + if(cFileCMD::Mkdir(buffer)) + { + DEBUG("Verzeichnis anlegen erfolgreich"); + LastSelDir(buffer); + if(!Select) + OsdObject->SetState(mmsReInit); + } + FREENULL(buffer); + DELETENULL(info); + } + case kBack: + State = csNone; + Build(); + return osContinue; + break; + default: + break; + } + + return cOsdMenu::ProcessKey(Key); +} + +eOSState cCMDDir::Edit(cMainMenuItem *mItem) +{ + DEBUG("Verzeichnis: Edit: %s", mItem->FileName()); + cFileInfo *info = new cFileInfo(mItem->FileName()); + if(!info->isWriteable()) + { + DELETENULL(info); + info = new cFileInfo(CurrentDir()); + if(!info->isWriteable()) + { + DEBUG("Verzeichnis: Edit: Keine Rechte"); + OSD_ERRMSG(tr("no Rights to rename")); + DELETENULL(info); + return osContinue; + } + } + DELETENULL(info); + info = new cFileInfo(mItem->FileName()); + SetDir(info->FileName()); + DELETENULL(info); + State = csDirEdit; + SetCols(11); + SetTitle(CurrentDir()); + + cMainMenuItem *dmItem = NULL; + mItem = (cMainMenuItem*)First(); + while(mItem) + { + if(!strcasecmp(mItem->FileName(), LastSelDir())) + { + DEBUG("Verzeichnis: Edit: Item gefunden: %s", mItem->FileName()); + Ins(new cMenuEditStrItem(tr("Rename:"), Dir, MaxFileName, tr(" abcdefghijklmnopqrstuvwxyz0123456789-_.#~")), + true, + mItem); + dmItem = mItem; + } + mItem->SetSelectable(false); + mItem = (cMainMenuItem*)Next(mItem); + } + + if(dmItem) + Del(dmItem->Index()); + Display(); + cOsdMenu::ProcessKey(kRight); + + return osContinue; +} + +eOSState cCMDDir::Edit(eKeys Key) +{ + switch(Key) + { + case kOk: + if(!isempty(Dir)) + { + char *buffer = NULL; + asprintf(&buffer, "%s/%s", CurrentDir(), stripspace(Dir)); + DEBUG("Verzeichnis: Edit: OK: %s", buffer); + cFileInfo *info = new cFileInfo(buffer); + if(info->isExists()) + { + DEBUG("Verzeichnis: Edit: Existiert schon"); + OSD_WARNMSG(tr("Directory exists")); + FREENULL(buffer); + DELETENULL(info); + return osUnknown; + } + if(cFileCMD::Rn(LastSelDir(), buffer)) + { + DEBUG("Verzeichnis: Edit: Rename OK"); + LastSelDir(buffer); + OsdObject->SetState(mmsReInit); + } + FREENULL(buffer); + DELETENULL(info); + } + case kBack: + State = csNone; + Build(); + return osContinue; + break; + default: + break; + } + + return cOsdMenu::ProcessKey(Key); +} + +// --- cCMDMove ------------------------------------------------------------- + +cCMDMove::cCMDMove(char *file, cMainMenu *osdobject, bool dir, bool direct) + : cOsdMenu(tr("Move")) +{ + DEBUG("Verzeichnis: Move: %s"); + File = file ? strdup(file) : NULL; + OsdObject = osdobject; + Dir = dir; + Direct = direct; + + ImageDir(DVDSwitchSetup.ImageDir); + CurrentDir(DVDSwitchSetup.ImageDir); + ParentDir(DVDSwitchSetup.ImageDir); + + + Build(DVDSwitchSetup.ImageDir); +} + +void cCMDMove::SetHelp(void) +{ + cOsdMenu::SetHelp(NULL, NULL, NULL , tr("Insert")); +} + +void cCMDMove::Build(char *dir) +{ + DEBUG("Verzeichnis: Move: Erstelle Verzeichnisliste: %s", dir); + if(!dir) + dir = CurrentDir(); + + Clear(); + + cDirHandling *DirHand = new cDirHandling(this, this); + SetCurrent(Get(DirHand->Build(dir, true))); + delete(DirHand); + + if(Count()) + { + cMainMenuItem *item = (cMainMenuItem*)First(); + while(item) + { + if(!strcasecmp(item->FileName(), File)) + { + Del(item->Index()); + break; + } + item = (cMainMenuItem*)Next(item); + } + } + + Display(); + SetHelp(); +} + +eOSState cCMDMove::ProcessKey(eKeys Key) +{ + cMainMenuItem *mItem = (cMainMenuItem*)Get(Current()); + cDirHandling *DirHand = NULL; + cFileMoveThread *move = NULL; + + switch(Key) + { + case kUp: + case kUp|k_Repeat: + case kDown: + case kDown|k_Repeat: + cOsdMenu::ProcessKey(Key); + SetHelp(); + mItem = (cMainMenuItem*)Get(Current()); + if(mItem) + LastSelDir(mItem->FileName()); + return osContinue; + break; + case kOk: + DirHand = new cDirHandling(this, this); + DirHand->ProcessKey(mItem); + DELETENULL(DirHand); + Build(); + break; + case kBlue: + DEBUG("Verzeichnis: Move: Verschiede in: %s", CurrentDir()); + move = new cFileMoveThread(File, CurrentDir()); + if(move->OK()) + { + DEBUG("Verzeichnis: Move: Erfolgreich"); + move->Start(); + cCondWait::SleepMs(1 * 500); + OsdObject->SetState(mmsReInit); + } + else + DELETENULL(move); + if(!Dir && !Direct) + cRemote::Put(kBack); + return osBack; + break; + default: + break; + } + + return cOsdMenu::ProcessKey(Key); +} + +// --- cCMDImage ------------------------------------------------------------ + +cCMDImage::cCMDImage(cMainMenu *osdobject) +{ + DEBUG("CMDImage"); + File = NULL; + strcpy(NewFile, "\0"); + OsdObject = osdobject; +} + +cCMDImage::~cCMDImage(void) +{ + if(File) + free(File); +} + +char* cCMDImage::Rename(char *file) +{ + DEBUG("CMDImage Rename"); + if(file) + { + FREENULL(File); + File = strdup(file); + } + + return File; +} + +eOSState cCMDImage::Delete(char *file) +{ + DEBUG("lösche DVD '%s'", file); + if(file) + { + if(Interface->Confirm(tr("really delete?"))) + { + cFileDelThread *del = new cFileDelThread(file); + if(del->OK()) + { + DEBUG("löschen OK"); + del->Start(); + OsdObject->SetState(mmsReInitCur); + } + else + DELETENULL(del); + } + } + + return osBack; +} + +eOSState cCMDImage::Burn(char *file) +{ + DEBUG("DVD Schreiben '%s'", file); + + cFileInfo *info = new cFileInfo(DVDSwitchSetup.DVDWriteScript); + + if(!info->isExists()) + { + DEBUG("Writescript existiert nicht"); + DELETENULL(info); + OSD_ERRMSG(tr("Specified Writescript not exist!")); + return osContinue; + } + if(!info->isExecutable()) + { + DEBUG("Writescript lässt sich nicht ausführen"); + DELETENULL(info); + OSD_ERRMSG(tr("Cannot execute Writescript!")); + return osContinue; + } + + DELETENULL(info); + + info = new cFileInfo(file); + + if(Interface->Confirm(tr("Burn Now?"))) + { + DEBUG("Starte Burn-Thread"); + cCMDImageBurnThread *burn = new cCMDImageBurnThread(file, info->Type()); + burn->Start(); + } + + return osContinue; +} + +// --- cCmdDVDRead ------------------------------------------------------------ + +cCMDImageRead::cCMDImageRead(void) + : cOsdMenu(tr("Read DVD"), 14) +{ + DEBUG("lese DVD"); + + cFileInfo *info = new cFileInfo(DVDSwitchSetup.DVDReadScript); + + if(!info->isExists()) + { + DEBUG("Readscript existiert nicht"); + DELETENULL(info); + OSD_ERRMSG(tr("Specified Readscript not exist!")); + cRemote::Put(kBack); + } + else if(!info->isExecutable()) + { + DEBUG("Readscript lässt sich nicht ausführen"); + DELETENULL(info); + OSD_ERRMSG(tr("Cannot execute Readscript!")); + cRemote::Put(kBack); + } + else + { + DELETENULL(info); + strcpy(File, "\0"); + strcpy(Dir, "\0"); + strcpy(ImgTypeTxt, "\0"); + ImgType = -1; + + Add(new cMenuEditStrItem(tr("Name:"), File, MaxFileName, tr(" abcdefghijklmnopqrstuvwxyz0123456789-_.#~"))); + Add(new cMenuEditStrItem(tr("Directory:"), Dir, MaxFileName, tr(" abcdefghijklmnopqrstuvwxyz0123456789-_.#~"))); + Add(new cMenuEditStrItem(tr("Imagetype:"), ImgTypeTxt, MaxFileName, tr(" abcdefghijklmnopqrstuvwxyz0123456789-_.#~"))); + + SetHelp(); + Display(); + } +} + +cCMDImageRead::~cCMDImageRead(void) +{ + DEBUG("lesen DVD beendet"); +} + +void cCMDImageRead::SetHelp(void) +{ + switch(Current()) + { + case 1: + case 2: + cOsdMenu::SetHelp(tr("read in"), NULL, NULL, tr("Select")); + break; + default: + cOsdMenu::SetHelp(tr("read in"), NULL, NULL, NULL); + break; + } +} + +eOSState cCMDImageRead::ProcessKey(eKeys Key) +{ + if(!HasSubMenu()) + { + switch(Key) + { + case kUp: + case kUp|k_Repeat: + case kDown: + case kDown|k_Repeat: + cOsdMenu::ProcessKey(Key); + SetHelp(); + return osContinue; + case kRight: + switch(Current()) + { + case 1: + case 2: + return osContinue; + break; + default: + break; + } + break; + case kRed: + if(isempty(File)) + { + OSD_ERRMSG(tr("invalid file name for DVD-Image")); + return osContinue; + } + if(ImgType < 0) + { + OSD_ERRMSG(tr("No Imagetype selected")); + return osContinue; + } + if(isempty(Dir)) + { + if(!Interface->Confirm(tr("No Directory selected. Use Standard?"))) + return osContinue; + } + if(Interface->Confirm(tr("Now Read?"))) + { + char *buffer = NULL; + if(isempty(Dir)) + buffer = strdup(DVDSwitchSetup.ImageDir); + else + { + if(DVDSwitchSetup.ImageDir[strlen(DVDSwitchSetup.ImageDir)-1] == '/') + asprintf(&buffer, "%s%s", DVDSwitchSetup.ImageDir, Dir); + else + asprintf(&buffer, "%s/%s", DVDSwitchSetup.ImageDir, Dir); + } + if(buffer[strlen(buffer)-1] == '/') + buffer[strlen(buffer)-1] == '\0'; + DEBUG("ReadThread wird gestartet"); + cCMDImageReadThread *read = new cCMDImageReadThread(File, buffer, ImgType); + FREENULL(buffer); + read->Start(); + return osBack; + } + break; + case kBlue: + switch(Current()) + { + case 1: + return AddSubMenu(new cCMDDir(NULL, true, &Dir[0])); + break; + case 2: + return AddSubMenu(new cMenuSetupDSITypes(true, &ImgType, &ImgTypeTxt[0])); + break; + default: + break; + } + break; + default: + break; + } + } + + return cOsdMenu::ProcessKey(Key); + +} diff --git a/commands.h b/commands.h new file mode 100644 index 0000000..3d53f1a --- /dev/null +++ b/commands.h @@ -0,0 +1,261 @@ +#ifndef __COMMANDS_DVDSWITCH_H +#define __COMMANDS_DVDSWITCH_H + +#include +#include "menu.h" +#include "imagelist.h" +#include "setup.h" +#include + +enum eCMDs +{ + cmdNone, + cmdDirManage, + cmdDVDopen, + cmdDVDclose, + cmdImgPlay, + cmdImgRename, + cmdImgMove, + cmdImgDelete, + cmdImgBurn, + cmdImgRead, + cmdCommands +}; + +enum eCMDState +{ + csNone, + csDirNew, + csDirEdit, + csDirMove, + csDirDel +}; + + +class cCMD +{ + public: + static eOSState Play(cMainMenuItem *item = NULL); + static eOSState Eject(bool close = false); +}; + + +class cCMDMenu : public cOsdMenu +{ + private: + cMainMenuItem *iItem; + cMainMenu *OsdObject; + public: + cCMDMenu(cMainMenuItem *item, cMainMenu *osdobject); + virtual eOSState ProcessKey(eKeys Key); +}; + +class cCMDDir : public cOsdMenu, private cDirHandlingOpt +{ + private: + eCMDState State; + char Dir[MaxFileName]; + cMainMenu *OsdObject; + bool Select; + char *Buffer; + + void Build(char *dir = NULL); + void SetDir(char *value = NULL) + { + if(value) + strn0cpy(Dir, value, MaxFileName); + else + strcpy(Dir, "\0"); + } + + eOSState New(void); + eOSState New(eKeys Key); + eOSState Edit(cMainMenuItem *mItem); + eOSState Edit(eKeys Key); + public: + cCMDDir(cMainMenu *osdobject = NULL, bool select = false, char *buffer = NULL); + + virtual eOSState ProcessKey(eKeys Key); + void SetHelp(void); +}; + +class cCMDMove : public cOsdMenu, private cDirHandlingOpt +{ + private: + char *File; + cMainMenu *OsdObject; + bool Dir; + bool Direct; + + void Build(char *dir = NULL); + public: + cCMDMove(char *file, cMainMenu *osdobject, bool dir = true, bool direct = false); + ~cCMDMove(void) { free(File); } + + virtual eOSState ProcessKey(eKeys Key); + void SetHelp(void); +}; + +class cCMDImage +{ + private: + char *File; + cMainMenu *OsdObject; + public: + char NewFile[MaxFileName]; + int tmpHideTypeCol; + //int tmpHideImgSize + + cCMDImage(cMainMenu *osdobject = NULL); + ~cCMDImage(void); + + char* Rename(char *file = NULL); + eOSState Delete(char *file = NULL); + eOSState Burn(char *file); +}; + +class cCMDImageRead : public cOsdMenu +{ + private: + char File[MaxFileName]; + char Dir[MaxFileName]; + char ImgTypeTxt[MaxFileName]; + int ImgType; + public: + cCMDImageRead(void); + ~cCMDImageRead(void); + + void SetHelp(void); + virtual eOSState ProcessKey(eKeys Key); +}; + +class cCMDImageReadThread : public cThread +{ + private: + char *File; + char *Dir; + eFileInfo FileType; + protected: + virtual void Action(void) + { + DEBUG("ReadThread gestartet"); + if(File && Dir && FileType != tNone) + { + DEBUG("Aktion wird ausgeführt"); + char *cmd = NULL; + char *output = NULL; + char *mountpoint = NULL; + int step = 0; + cTokenizer *token = NULL; + char buffer[MaxFileName]; + realpath(DVDSwitchSetup.DVDLinkOrg, buffer); + + while(!mountpoint && step < 2) + { + step++; + asprintf(&cmd, + "cat /etc/fstab | grep -e \"%s\" | grep -e \"^[^#]\"", + step == 1 ? DVDSwitchSetup.DVDLinkOrg : buffer); + DEBUG("Commando: %s", cmd); + + FILE *p = popen(cmd, "r"); + if(p) + { +#if VDRVERSNUM >= 10318 + cReadLine rl; + output = rl.Read(p); +#else + output = readline(p); +#endif + pclose(p); + } + token = new cTokenizer(output, " "); + if(token->Count() > 1) + mountpoint = strdup(stripspace(token->GetToken(2))); + DELETENULL(token); + } + FREENULL(cmd); + asprintf(&cmd, + "'%s' '%s' '%s' '%s' '%s' '%s'", + DVDSwitchSetup.DVDReadScript, + Dir, + File, + buffer, + mountpoint, + (FileType == tFile) ? "IMAGE" : "DIR"); + DEBUG("Aufruf: %s", cmd); + int rc = system(cmd); + DEBUG("Rückgabe Aufruf: %i", rc); + FREENULL(cmd); + FREENULL(mountpoint); + } + delete(this); + }; + public: + cCMDImageReadThread(char *file, char *dir, int imgtype) + { + DEBUG("ReadThread created"); + File = NULL; + Dir = NULL; + FileType = tNone; + + cImageListItem *item = ImageList.Get(imgtype); + if(imgtype >= 0 && file && dir) + { + if(item->GetFType() == tFile) + asprintf(&File, "%s%s", file, item->GetValue()); + else + File = strdup(file); + Dir = strdup(dir); + FileType = item->GetFType(); + } + } + ~cCMDImageReadThread(void) + { + free(File); + free(Dir); + } +}; + +class cCMDImageBurnThread : public cThread +{ + private: + char *File; + eFileInfo FileType; + protected: + virtual void Action(void) + { + DEBUG("BurnThread gestartet"); + if(File && FileType != tNone) + { + DEBUG("Aktion wird ausgeführt"); + char *cmd; + asprintf(&cmd, + "'%s' '%s' '%s'", + DVDSwitchSetup.DVDWriteScript, + File, + FileType == tFile ? "IMAGE" : "DIR"); + DEBUG("Aufruf: %s", &cmd); + int rc = system(cmd); + DEBUG("Rückgabe Aufruf: %i", rc); + FREENULL(cmd); + } + delete(this); + }; + public: + cCMDImageBurnThread(char *file, eFileInfo type) + { + DEBUG("BurnThread created"); + File = NULL; + FileType = tNone; + + if(file && type != tNone) + { + File = strdup(file); + FileType = type; + } + } + ~cCMDImageBurnThread(void) { free(File); } +}; + +#endif // __COMMANDS_DVDSWITCH_H diff --git a/debug.c b/debug.c new file mode 100644 index 0000000..3727028 --- /dev/null +++ b/debug.c @@ -0,0 +1,68 @@ +#include +#include +#include "debug.h" + +// --- cDebugLog ------------------------------------------------------- + +cDebugLog DebugLog; + +cDebugLog::cDebugLog(void) +{ + FileName = NULL; + File = NULL; +} + +cDebugLog::~ cDebugLog(void) +{ + Close(); + free(FileName); +} + +bool cDebugLog::Open(void) +{ + File = fopen(FileName, "a"); + if(File) + { + DEBUG("---------"); + DEBUG("Neuer Log"); + DEBUG("---------"); + return true; + } + + return false; +} + +void cDebugLog::Close(void) +{ + if(File) + fclose(File); +} + +bool cDebugLog::SetLogFile(char *filename) +{ + if(filename) + FileName = strdup(filename); + + return Open(); +} + +void cDebugLog::WriteLine(char *file, int line, char *format, ...) +{ + if(File) + { + char *fmt; + asprintf(&fmt, "DVDSWITCH(%s,%d): %s", file, line, format); + va_list ap; + va_start(ap, format); + vfprintf(File, fmt, ap); + va_end(ap); + fprintf(File, "\n"); + fflush(File); + free(fmt); + } +} + +void cDebugLog::End(void) +{ + Close(); +} diff --git a/debug.h b/debug.h new file mode 100644 index 0000000..f7a7f7f --- /dev/null +++ b/debug.h @@ -0,0 +1,28 @@ +#ifndef __DEBUG_DVDSWITCH_H +#define __DEBUG_DVDSWITCH_H + +#include + +#define DEBUG(a...) DebugLog.WriteLine(__FILE__, __LINE__, a) + +class cDebugLog +{ + private: + char *FileName; + FILE *File; + + + bool Open(void); + void Close(void); + public: + cDebugLog(void); + ~cDebugLog(void); + + bool SetLogFile(char *filename); + void WriteLine(char *file, int line, char *format, ...); + void End(void); +}; + +extern cDebugLog DebugLog; + +#endif // __DEBUG_DVDSWITCH_H diff --git a/dvdlist-item.c b/dvdlist-item.c new file mode 100644 index 0000000..2c820c7 --- /dev/null +++ b/dvdlist-item.c @@ -0,0 +1,15 @@ +#include "dvdlist-item.h" +#include "helpers.h" + +// --- cDVDListItem -------------------------------------------------------- + +cDVDListItem::cDVDListItem(char* file) +{ + DEBUG("Neues DVDItem -> %s", file); + File = file ? strdup(file) : NULL; +} + +cDVDListItem::~ cDVDListItem(void) +{ + free(File); +} diff --git a/dvdlist-item.h b/dvdlist-item.h new file mode 100644 index 0000000..39603b1 --- /dev/null +++ b/dvdlist-item.h @@ -0,0 +1,19 @@ +#ifndef __DVDLISTITEM_DVDSWITCH_H +#define __DVDLISTITEM_DVDSWITCH_H + +#include +#include + +class cDVDListItem : public cListObject +{ + private: + char *File; + + public: + cDVDListItem(char* file); + ~cDVDListItem(void); + + char* FileName(void) { return File; }; +}; + +#endif // __DVDLISTITEM_DVDSWITCH_H diff --git a/dvdlist.c b/dvdlist.c new file mode 100644 index 0000000..396eb48 --- /dev/null +++ b/dvdlist.c @@ -0,0 +1,75 @@ +#include +#include "dvdlist.h" +#include "setup.h" +#include "helpers.h" +#include "imagelist.h" + +// --- cDVDList ------------------------------------------------------------------ + +bool cDVDList::Create(char *dir, char *exts, char *dirs, eFileList smode, bool sub) +{ + DEBUG("DVDList: %s, %s", exts, dirs); + + Clear(); + FREENULL(DVDExts); + FREENULL(DVDDirs); + + DVDExts = exts ? strdup(exts) : NULL; + DVDDirs = dirs ? strdup(dirs) : NULL; + + if(!DVDExts && !DVDDirs) + return false; + + return Load(dir, smode, sub); +} + +bool cDVDList::Load(char *dir, eFileList smode, bool sub) +{ + DEBUG("DVDList: Load"); + bool ret = false; + int i = 0; + + cFileInfo *fInfo = NULL; + cFileList *fList = new cFileList(); + + fList->OptExclude("^lost\\+found$"); // lost+found Dir + fList->OptExclude("^\\."); // hidden Files + fList->OptExclude("\\.sdel$"); // del Files + fList->OptExclude("\\.smove$"); // move Files + + if(DVDExts) + { + cTokenizer *token = new cTokenizer(DVDExts, "@"); + char *extexp = NULL; + for(i = 1; i <= token->Count(); i++) + { + asprintf(&extexp, "%s$", token->GetToken(i)); + fList->OptInclude(extexp, tFile); + FREENULL(extexp); + } + delete(token); + } + + if(DVDDirs) + fList->OptInclude(".*", tDir); + + fList->OptSort(smode, true); + + ret = fList->Load(dir, sub); + + cFileListItem *fItem = fList->First(); + while(fItem) + { + fInfo = new cFileInfo(fItem->Value()); + if(fInfo->Type() == tFile || + fInfo->Type() == tDir && fList->DirIsIn(fItem, DVDDirs)) + Add(new cDVDListItem(fItem->Value())); + DELETENULL(fInfo); + fItem = fList->Next(fItem); + } + + delete(fList); + delete(fInfo); + + return ret; +} diff --git a/dvdlist.h b/dvdlist.h new file mode 100644 index 0000000..ef539ef --- /dev/null +++ b/dvdlist.h @@ -0,0 +1,28 @@ +#include +#include +#include "dvdlist-item.h" +#include "helpers.h" + +class cDVDList : public cList +{ + private: + char *DVDExts; + char *DVDDirs; + + bool Load(char *dir, eFileList smode, bool sub); + public: + cDVDList(void) + { + DVDExts = NULL; + DVDDirs = NULL; + } + ~cDVDList(void) + { + free(DVDExts); + free(DVDDirs); + } + //bool Create(char *dir, DVDType dtype = dtAll, DLSortMode smode = dlAsc, bool subdirs = false); + bool Create(char *dir, char *exts, char *dirs, eFileList smode = sNone, bool sub = false); + +}; + diff --git a/dvdplugin.c b/dvdplugin.c new file mode 100644 index 0000000..950ba00 --- /dev/null +++ b/dvdplugin.c @@ -0,0 +1,173 @@ +#include +#include +#include +#include +#include "dvdplugin.h" +#include "debug.h" + +cDVDPluginThread::cDVDPluginThread(char *image) + :cThread("DVDPluginThread") +{ + DEBUG("Neuer DVD Thread angelegt"); + Image = image ? strdup(image) : NULL; +} + +cDVDPluginThread::~cDVDPluginThread(void) +{ + DEBUG("DVD Thread beendet"); + + free(Image); + Cancel(); +} + +void cDVDPluginThread::Action(void) +{ + DEBUG("DVD Thread gestartet"); + if(Image) + cDVDPlugin::ChangeLink(Image); + +#if VDRVERSNUM < 10332 + cPlugin *plugin = cPluginManager::GetPlugin("dvd"); + + if(plugin) + { + plugin->MainMenuAction(); + DEBUG("DVD MainMenuAction gestartet"); + } +#else + cRemote::CallPlugin("dvd"); + DEBUG("DVD Plugin gestaret"); +#endif + + cCondWait::SleepMs(2 * 1000); + cControl *control = cControl::Control(); + DEBUG(control ? (char*)"Control gefunden" : (char*)"Control nicht gefunden"); + while(control) + { + cCondWait::SleepMs(5 * 1000); + control = cControl::Control(); + } + DEBUG("Control wurde geschlossen"); + + if(Image) + cDVDPlugin::ChangeLink(DVDSwitchSetup.DVDLinkOrg); + + DEBUG("Beende thread"); + cDVDPlugin::Exit(); +} + +// --- cDVDPlugin ---------------------------------------------------------------- + +cDVDPluginThread *cDVDPlugin::thread = NULL; + +void cDVDPlugin::DetectDevice(void) +{ + DEBUG("Scan nach DVD Device"); + char *cmd = NULL; + char *output = NULL; + char *dvd = NULL; + + asprintf(&cmd, "ps -p %i -o cmd --no-header", getpid()); + DEBUG("Commando: %s", cmd); + + FILE *p = popen(cmd, "r"); + if(p) + { +#if VDRVERSNUM >= 10318 + cReadLine rl; + output = rl.Read(p); +#else + output = readline(p); +#endif + pclose(p); + } + + cTokenizer *token = new cTokenizer(output, " "); + for(int i = 1; i <= token->Count(); i++) + { + if(RegIMatch(token->GetToken(i), "^--plugin=dvd") || + (RegIMatch(token->GetToken(i - 1), "^-P$") && + RegIMatch(token->GetToken(i), "^dvd$"))) + { + if(RegIMatch(token->GetToken(i + 1), "^-C$") && + token->GetToken(i + 2)) + { + dvd = strdup(token->GetToken(i + 2)); + break; + } + if(RegIMatch(token->GetToken(i + 1), "^--dvd=")) + { + char *p = strchr(token->GetToken(i + 1), '='); + p++; + dvd = strdup(p); + break; + } + } + } + DELETENULL(token); + + if(dvd) + { + DEBUG("Erkanntes DVD Device: %s", dvd); + DVDSwitchSetup.SetDVDDevice(dvd); + } + else + { + DEBUG("Nehme Standard-DVD Device"); + DVDSwitchSetup.SetDVDDevice("/dev/dvd"); + } + + free(cmd); + free(dvd); + //free(output); +} + +void cDVDPlugin::SetLink(void) +{ + int argc = 2; + char *argv[2] = { NULL, NULL }; + + asprintf(&argv[0], "%s", "dvd"); + asprintf(&argv[1], "--dvd=%s", DVDSwitchSetup.DVDLink); + + cPlugin *plugin = cPluginManager::GetPlugin("dvd"); + + if(plugin) + { + optind = 0; //reset for getopt + plugin->ProcessArgs(argc, argv); + } + + free(argv[0]); + free(argv[1]); +} + +void cDVDPlugin::Start(char *image) +{ + if(!thread) + { + thread = new cDVDPluginThread(image); + thread->Start(); + } +} + +void cDVDPlugin::Exit(void) +{ + if(thread) + DELETENULL(thread); +} + +void cDVDPlugin::ChangeLink(char *target) +{ + if(target) + { + char *cmd = NULL; + int rc = 0; + + asprintf(&cmd, LINK, target, DVDSwitchSetup.DVDLink); + DEBUG("Ändere link: %s", cmd); + rc = system(cmd); + DEBUG("Rückgabe Änderung: %i", rc); + free(cmd); + } +} diff --git a/dvdplugin.h b/dvdplugin.h new file mode 100644 index 0000000..6591370 --- /dev/null +++ b/dvdplugin.h @@ -0,0 +1,48 @@ +#ifndef __DVDPLUGIN_DVDSWITCH_H +#define __DVDPLUGIN_DVDSWITCH_H + +#include +#include "helpers.h" +#include "setup.h" + +#define LINK "ln -nfs '%s' '%s' 2> /dev/null" + +class cDVDPluginThread : public cThread +{ + private: + char *Image; + protected: + virtual void Action(void); + public: + cDVDPluginThread(char *image = NULL); + ~cDVDPluginThread(void); +}; + +class cDVDPlugin +{ + private: + static cDVDPluginThread *thread; + static void DetectDevice(void); + static void SetLink(void); + static void KillLink(void) + { + cFileCMD::Del(DVDSwitchSetup.DVDLink); + }; + public: + static void Start(char *image = NULL); + static void Exit(void); + static void ChangeLink(char *target); + static void Init(void) + { + DetectDevice(); + ChangeLink(DVDSwitchSetup.DVDLinkOrg); + SetLink(); + } + static void Finish(void) + { + Exit(); + KillLink(); + } +}; + +#endif // __DVDPLUGIN_DVDSWITCH_H diff --git a/dvdswitch.c b/dvdswitch.c new file mode 100644 index 0000000..7e8f33c --- /dev/null +++ b/dvdswitch.c @@ -0,0 +1,210 @@ +/* + * dvdswitch.c: A plugin for the Video Disk Recorder + * + * See the README file for copyright information and how to reach the author. + * + * $Id$ + */ + +#include +#include +#include +#include "i18n.h" +#include "helpers.h" +#include "setup.h" +#include "menu.h" +#include "dvdplugin.h" +#include "imagelist.h" +//#include "dvdlist.h" + +static const char *VERSION = "0.1.0"; +static const char *DESCRIPTION = "allowed to play DVD-Images"; +//static const char *MAINMENUENTRY = "DVDSwitch"; + +class cPluginDvdswitch : public cPlugin { +private: + // Add any member variables or functions you may need here. + bool CheckError(void); +public: + cPluginDvdswitch(void); + virtual ~cPluginDvdswitch(); + virtual const char *Version(void) { return VERSION; } + virtual const char *Description(void) { return tr(DESCRIPTION); } + virtual const char *CommandLineHelp(void); + virtual bool ProcessArgs(int argc, char *argv[]); + virtual bool Initialize(void); + virtual bool Start(void); + virtual void Stop(void); + virtual void Housekeeping(void); + //virtual const char *MainMenuEntry(void) { return tr(MAINMENUENTRY); } + virtual const char *MainMenuEntry(void) { return DVDSwitchSetup.MenuName; } + virtual cOsdObject *MainMenuAction(void); + virtual cMenuSetupPage *SetupMenu(void); + virtual bool SetupParse(const char *Name, const char *Value); + virtual bool Service(const char *Id, void *Data = NULL); + virtual const char **SVDRPHelpPages(void); + virtual cString SVDRPCommand(const char *Command, const char *Option, int &ReplyCode); + }; + +cPluginDvdswitch::cPluginDvdswitch(void) +{ + // Initialize any member variables here. + // DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL + // VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT! +} + +cPluginDvdswitch::~cPluginDvdswitch() +{ + // Clean up after yourself! + cDVDPlugin::Finish(); + DebugLog.End(); +} + +const char *cPluginDvdswitch::CommandLineHelp(void) +{ + //12345678901234567890123456789012345678901234567890123456789012345678901234567890| + return + " -D LOGFILE, --debug=LOGFILE write Debug-Info's in LOGFILE\n" + " -r SCRIPT, --readscript=SCRIPT SCRIPT = scriptname with path for reading" + " DVD as a ISO Image File" + " -w SCRIPT, --writescript=SCRIPT SCRIPT = scriptname with path to writing" + " selected DVD Image" + " -i PATH, --imagedir=PATH Path to DVD-Images. This Option can set" + " in SetupMenu optional"; +} + +bool cPluginDvdswitch::ProcessArgs(int argc, char *argv[]) +{ + static struct option long_options[] = { + { "debug", required_argument, NULL, 'D' }, + { "readscript", required_argument, NULL, 'r' }, + { "writescript", required_argument, NULL, 'w' }, + { "imagedir", required_argument, NULL, 'i' }, + { NULL } + }; + + int c = 0; + optind = 1; //default for getopt + + while((c = getopt_long(argc, argv, "D:r:w:", long_options, NULL)) != -1) + { + switch(c) + { + case 'D': + DebugLog.SetLogFile(optarg); + break; + case 'r': + strn0cpy(DVDSwitchSetup.DVDReadScript, optarg, MaxFileName); + break; + case 'w': + strn0cpy(DVDSwitchSetup.DVDWriteScript, optarg, MaxFileName); + break; + case 'i': + strn0cpy(DVDSwitchSetup.ImageDir, optarg, MaxFileName); + DVDSwitchSetup.ImageDirPerParam = true; + break; + default: + esyslog("DVDSwitch: unknown Parameter: %c", c); + break; + } + } + + return true; +} + +bool cPluginDvdswitch::Initialize(void) +{ + // Initialize any background activities the plugin shall perform. + DEBUG("Plugin wird initialisiert"); + RegisterI18n(Phrases); + + DVDSwitchSetup.SetConfDir((char*)ConfigDirectory(Name())); + cDVDPlugin::Init(); + ImageList.Init(); + DVDSwitchSetup.Init(); + + return true; +} + +bool cPluginDvdswitch::Start(void) +{ + // Start any background activities the plugin shall perform. + return true; +} + +void cPluginDvdswitch::Stop(void) +{ + // Stop any background activities the plugin shall perform. +} + +void cPluginDvdswitch::Housekeeping(void) +{ + // Perform any cleanup or other regular tasks. +} + +cOsdObject *cPluginDvdswitch::MainMenuAction(void) +{ + // Perform the action when selected from the main VDR menu. + DEBUG("MainMenuAction"); + if (CheckError()) + { + DEBUG("Fehler entdeckt. Keine OSDOBJECT Rueckgabe"); + return NULL; + } + else + return new cMainMenu(); +} + +cMenuSetupPage *cPluginDvdswitch::SetupMenu(void) +{ + // Return a setup menu in case the plugin supports one. + return new cMenuSetupDVDSwitch(); +} + +bool cPluginDvdswitch::SetupParse(const char *Name, const char *Value) +{ + // Parse your own setup parameters and store their values. + return DVDSwitchSetup.SetupParse(Name, Value); +} + +bool cPluginDvdswitch::Service(const char *Id, void *Data) +{ + // Handle custom service requests from other plugins + return false; +} + +const char **cPluginDvdswitch::SVDRPHelpPages(void) +{ + // Return help text for SVDRP commands this plugin implements + return NULL; +} + +cString cPluginDvdswitch::SVDRPCommand(const char *Command, const char *Option, int &ReplyCode) +{ + // Process SVDRP commands this plugin implements + return NULL; +} + +bool cPluginDvdswitch::CheckError(void) +{ + DEBUG("Fehlercheck"); + DEBUG("Check ImageDir"); + if(!DirectoryOk(DVDSwitchSetup.ImageDir)) + { + DEBUG("ImageDir '%s' ist nicht lesbar oder existiert nicht", DVDSwitchSetup.ImageDir); + OSD_ERRMSG(tr("Image Directory not readable or not exist")); + return true; + } + + DEBUG("Check DVD Plugin"); + if(!cPluginManager::GetPlugin("dvd")) + { + DEBUG("DVDPlugin wurde nicht gefunden!"); + OSD_INFOMSG(tr("DVD-Plugin not found! Function deactivated!")); + } else + DVDSwitchSetup.DVDPluginExist = true; + + return false; +} + +VDRPLUGINCREATOR(cPluginDvdswitch); // Don't touch this! diff --git a/helpers.c b/helpers.c new file mode 100644 index 0000000..65cbd94 --- /dev/null +++ b/helpers.c @@ -0,0 +1,689 @@ +#include "helpers.h" + +// --- OSD Message Helpers ----------------------------------- + +void OsdMsg(eMessageType Type, const char *Msg) +{ +#if VDRVERSNUM >= 10307 + Skins.Message(Type, Msg); +#else + switch(Type) + { + case mtInfo: + Interface->Info(Msg); + break; + case mtWarning: //Was muss da hin?? + Interface->Error(Msg); + break; + case mtError: + Interface->Error(Msg); + break; + } +#endif +} + +void ChangeChars(char *name, char *chars) +{ + char seek; + char replace; + + double len = strlen(chars); + + if ((len / 2) != floor(len / 2)) + len--; + + for(int i = 0; i < (int)len; i += 2) + { + seek = chars[i]; + replace = chars[i + 1]; + name = strreplace(name, seek, replace); + } +} + +void StrRepeat(char *input, int count, char *dest) +{ + for(int i = 0; i < count; i++) + strcat(dest, input); +} + +bool RegIMatch(char *string, char *pattern) +{ + if(!string || !pattern) + return false; + + bool ret = false; + regex_t reg; + + if(!regcomp(®, pattern, REG_EXTENDED | REG_ICASE | REG_NOSUB)) + { + if(!regexec(®, string, 0, NULL, 0)) + ret = true; + } + + regfree(®); + + return ret; +} + +// --- cTokenizer --------------------------------------- + +void cTokenizer::Tokenize(bool trim) +{ + Clear(); + DEBUG("String wird in Token zerlegt"); + char *buffer = NULL; + char *token = NULL; + char *tok_pointer; + + buffer = strdup(String); + if(trim) + buffer = stripspace(buffer); + + for(token = strtok_r(buffer, Delim, &tok_pointer); + token; + token = strtok_r(NULL, Delim, &tok_pointer)) + { + DEBUG("Token gefunden: %s", token); + if(!trim) + Add(new cToken(token)); + else + Add(new cToken(stripspace(token))); + } + + free(buffer); +} + +// --- cFileInfo --------------------------------------------- + +cFileInfo::cFileInfo(char *file) +{ + DEBUG("FileInfo: %s", file); + File = (file && !isempty(file)) ? strdup(file) : NULL; + + if(File && File[strlen(File) - 1] == '/') + File[strlen(File) - 1] = '\0'; + + buffer = NULL; + + if(isExists()) + stat64(File, &Info); + + size = 0; +} + +cFileInfo::~ cFileInfo(void) +{ + free(File); + free(buffer); +} + +char *cFileInfo::Path(void) +{ + FREENULL(buffer); + + char *p = strrchr(File, '/'); + if(p) + { + int len = strlen(File) - strlen(p) + 1; + buffer = (char*)malloc(len); + strn0cpy(buffer, File, len); + } + + DEBUG("FileInfo: Pfad: %s", buffer); + + return buffer; +} + +char *cFileInfo::FileName(void) +{ + FREENULL(buffer); + + char *p = strrchr(File, '/'); + if(p) + { + p++; + buffer = strdup(p); + } + + DEBUG("FileInfo: FileName: %s", buffer); + + return buffer; + +} + +char *cFileInfo::FileNameWithoutExt(void) +{ + char *ext = NULL; + char *filename = NULL; + + if(Extension()) + ext = strdup(Extension()); + if(FileName()) + filename = strdup(FileName()); + + FREENULL(buffer); + + if(ext && filename) + { + int len = strlen(filename) - strlen(ext) + 1; + buffer = (char*)malloc(len); + strn0cpy(buffer, filename, len); + } + else if(filename) + buffer = strdup(filename); + + free(ext); + free(filename); + + DEBUG("FileInfo: FileNameWithoutExt: %s", buffer); + + return buffer; +} + +char *cFileInfo::Extension(bool withPoint) +{ + FREENULL(buffer); + + char *p = strrchr(File, '.'); + if(p) + { + if(!withPoint) + p++; + if(!isempty(p)) + buffer = strdup(p); + } + + DEBUG("FileInfo: Extension: %s", buffer); + + return buffer; +} + +eFileInfo cFileInfo::Type(void) +{ + switch(Info.st_mode & S_IFMT) + { + case S_IFDIR: + return tDir; + break; + case S_IFREG: + case S_IFLNK: + return tFile; + break; + default: + return tUnknown; + break; + } +} + +unsigned long long int cFileInfo::SizeByte(void) +{ + cFileList *list = NULL; + cFileListItem *item = NULL; + cFileInfo *info = NULL; + + if(!size) + { + switch(Type()) + { + case tFile: + size = Info.st_size; + break; + case tDir: + list = new cFileList(); + list->OptFilterType(tFile); + if(list->Load(File, true)) + { + item = list->First(); + while(item) + { + info = new cFileInfo(item->Value()); + size += info->SizeByte(); + DELETENULL(info); + item = list->Next(item); + } + } + delete(list); + break; + default: + break; + } + } + + return size; +} + +double cFileInfo::SizeKByte(int decimals) +{ + double size = (double)SizeByte() / 1024; + + for(int i = 0; i < decimals; i++) + size *= 10; + + size = (double)(unsigned int)(size + 0.5); + + for(int i = 0; i < decimals; i++) + size /= 10; + + return size; +} + +double cFileInfo::SizeMByte(int decimals) +{ + double size = (double)SizeByte() / 1024 / 1024; + + for(int i = 0; i < decimals; i++) + size *= 10; + + size = (double)(unsigned int)(size + 0.5); + + for(int i = 0; i < decimals; i++) + size /= 10; + + return size; +} + +double cFileInfo::SizeGByte(int decimals) +{ + double size = (double)SizeByte() / 1024 / 1024 / 1024; + + for(int i = 0; i < decimals; i++) + size *= 10; + + size = (double)(unsigned int)(size + 0.5); + + for(int i = 0; i < decimals; i++) + size /= 10; + + return size; +} + +bool cFileInfo::isReadable(void) +{ + if(getuid() == 0) + return true; + + if(Info.st_uid == getuid() && + Info.st_mode & S_IRUSR) + return true; + + if(Info.st_gid == getgid() && + Info.st_mode & S_IRGRP) + return true; + + if(Info.st_mode & S_IROTH) + return true; + + return false; +} + +bool cFileInfo::isWriteable(void) +{ + if(getuid() == 0) + return true; + + if(Info.st_uid == getuid() && + Info.st_mode & S_IWUSR) + return true; + + if(Info.st_gid == getgid() && + Info.st_mode & S_IWGRP) + return true; + + if(Info.st_mode & S_IWOTH) + return true; + + return false; +} + +bool cFileInfo::isExecutable(void) +{ + if(getuid() == 0 && + (Info.st_mode & S_IXUSR || + Info.st_mode & S_IXGRP || + Info.st_mode & S_IXOTH)) + return true; + + if(Info.st_uid == getuid() && + Info.st_mode & S_IXUSR) + return true; + + if(Info.st_gid == getgid() && + Info.st_mode & S_IXGRP) + return true; + + if(Info.st_mode & S_IXOTH) + return true; + + return false; +} + +bool cFileInfo::isExists(void) +{ + return !access(File, F_OK); +} + +// --- cFileCMD ------------------------------------------------- + +bool cFileCMD::Del(char *file) +{ + cFileInfo *info = new cFileInfo(file); + cFileList *list = NULL; + cFileListItem *item = NULL; + bool ret = true; + + switch(info->Type()) + { + case tDir: + list = new cFileList(); + list->OptSort(sDesc); + if(list->Load(file, true)) + { + item = list->First(); + while(item) + { + DELETENULL(info); + info = new cFileInfo(item->Value()); + if(info->Type() == tFile && remove(item->Value()) < 0) + ret = false; + if(info->Type() == tDir && rmdir(item->Value()) < 0) + ret = false; + item = list->Next(item); + } + } else + ret = false; + if(rmdir(file) < 0) + ret = false; + break; + default: + if(remove(file) < 0) + ret = false; + break; + } + + delete(info); + delete(list); + + return ret; +} + +bool cFileCMD::DirIsEmpty(char *file) +{ + bool ret = false; + + cFileList *list = new cFileList(); + if(list->Load(file, true) && !list->Count()) + ret = true; + delete(list); + + return ret; +} + +// --- cFileList ------------------------------- + +cFileListItem::cFileListItem(char *dir, char *file) +{ + if(file && !isempty(file) && dir && !isempty(dir)) + { + if(dir[strlen(dir) - 1] == '/') + asprintf(&File, "%s%s", dir, file); + else + asprintf(&File, "%s/%s", dir, file); + } + else + File = NULL; + + if(File && File[strlen(File) - 1] == '/') + File[strlen(File) - 1] = '\0'; +} + +cFileListItem::cFileListItem(char *file) +{ + File = file ? strdup(file) : NULL; + + if(File && File[strlen(File) - 1] == '/') + File[strlen(File) - 1] = '\0'; +} + +cFileList::cFileList(void) +{ + Dir = NULL; + Sub = false; + + Includes = NULL; + Excludes = new cFileOptList(); + Excludes->Add(new cFileOptListItem("^\\.{1,2}$")); + Protect = false; + + SortMode = sNone; + SortToFilename = false; + Type = tNone; +} + +cFileList::~cFileList(void) +{ + free(Dir); + + if(!Protect) + { + delete(Includes); + delete(Excludes); + } +} + +bool cFileList::Load(char *dir, bool withsub) +{ + if(dir && isempty(dir)) + return false; + + if(!dir && !Dir) + return false; + + Clear(); + + if(dir) + { + FREENULL(Dir); + Dir = strdup(dir); + if(Dir[strlen(Dir) - 1] == '/') + Dir[strlen(Dir) - 1] = '\0'; + } + + if(withsub) + Sub = withsub; + + return Read(Dir, Sub); +} + +bool cFileList::Read(char *dir, bool withsub) +{ + bool ret = false; + char *buffer = NULL; + + struct dirent *DirData = NULL; + + cReadDir Dir(dir); + if(Dir.Ok()) + { + while((DirData = Dir.Next()) != NULL) + { + if(CheckIncludes(dir, DirData->d_name) && + !CheckExcludes(dir, DirData->d_name) && + CheckType(dir, DirData->d_name, Type)) + SortIn(dir, DirData->d_name); + if(withsub && + CheckType(dir, DirData->d_name, tDir) && + !RegIMatch(DirData->d_name, "^\\.{1,2}$")) + { + asprintf(&buffer, "%s/%s", dir, DirData->d_name); + Read(buffer, withsub); + FREENULL(buffer); + } + } + ret = true; + } + + return ret; +} + +void cFileList::SortIn(char *dir, char *file) +{ + cFileListItem *Item = First(); + cFileInfo *ItemInfo = NULL; + char *NewItem = NULL; + cFileInfo *NewItemInfo = NULL; + + switch(SortMode) + { + case sNone: + Add(new cFileListItem(dir, file)); + break; + case sAsc: + case sDesc: + if(Item) + { + asprintf(&NewItem, "%s/%s", dir, file); + NewItemInfo = SortToFilename ? new cFileInfo(NewItem) : NULL; + while(Item) + { + if(SortToFilename) + { + DELETENULL(ItemInfo); + ItemInfo = new cFileInfo(Item->Value()); + } + + if((SortMode == sAsc && !SortToFilename && strcasecmp(NewItem, Item->Value()) < 0) || + (SortMode == sDesc && !SortToFilename && strcasecmp(NewItem, Item->Value()) > 0)) + break; + if((SortMode == sAsc && SortToFilename && strcasecmp(NewItemInfo->FileName(), ItemInfo->FileName()) < 0) || + (SortMode == sDesc && SortToFilename && strcasecmp(NewItemInfo->FileName(), ItemInfo->FileName()) > 0)) + break; + + Item = Next(Item); + } + } + if(Item) + Ins(new cFileListItem(dir, file), Item); + else + Add(new cFileListItem(dir, file)); + break; + default: + break; + } + + delete(NewItemInfo); + delete(ItemInfo); + free(NewItem); +} + +bool cFileList::CheckIncludes(char *dir, char *file) +{ + if(!Includes) + return true; + + cFileOptListItem *iItem = Includes->First(); + while(iItem) + { + if(RegIMatch(file, iItem->Regex()) && CheckType(dir, file, iItem->FileType())) + return true; + + iItem = Includes->Next(iItem); + } + + return false; +} + +bool cFileList::CheckExcludes(char *dir, char *file) +{ + if(!Excludes) + return false; + + cFileOptListItem *eItem = Excludes->First(); + while(eItem) + { + if(RegIMatch(file, eItem->Regex()) && CheckType(dir, file, eItem->FileType())) + return true; + + eItem = Excludes->Next(eItem); + } + + return false; +} + +bool cFileList::CheckType(char *dir, char *file, eFileInfo type) +{ + if(type == tNone) + return true; + + bool ret = false; + + char *buffer = NULL; + + asprintf(&buffer, "%s/%s", dir, file); + + cFileInfo *info = new cFileInfo(buffer); + if(info->Type() == type) + ret = true; + delete(info); + + free(buffer); + + return ret; +} + +bool cFileList::DirIsEmpty(cFileListItem *item) +{ + bool ret = true; + + cFileInfo *fInfo = new cFileInfo(item->Value()); + + if(fInfo->Type() == tDir) + { + cFileList *fList = new cFileList(); + + fList->Includes = Includes; + fList->Excludes = Excludes; + fList->Protect = true; + + fList->Load(item->Value()); + if(fList->Count()) + ret = false; + + delete(fList); + } + + delete(fInfo); + + return ret; +} + +bool cFileList::DirIsIn(char *file, char *strings) +{ + bool ret = false; + + cFileInfo *fInfo = new cFileInfo(file); + + if(fInfo->Type() == tDir && strings && !isempty(strings)) + { + cFileList *fList = new cFileList(); + char *buffer; + + cTokenizer *token = new cTokenizer(strings, "@"); + for(int i = 1; i <= token->Count(); i++) + { + asprintf(&buffer, "^%s$", token->GetToken(i)); + fList->OptInclude(buffer); + free(buffer); + } + DELETENULL(token); + + fList->Load(file); + if(fList->Count()) + ret = true; + + delete(fList); + } + + delete(fInfo); + + return ret; +} diff --git a/helpers.h b/helpers.h new file mode 100644 index 0000000..b5d7185 --- /dev/null +++ b/helpers.h @@ -0,0 +1,270 @@ +#ifndef __HELPERS_DVDSWITCH_H +#define __HELPERS_DVDSWITCH_H + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "debug.h" + +#define OSD_ERRMSG(msg) OsdMsg(mtError, msg) +#define OSD_WARNMSG(msg) OsdMsg(mtWarning, msg) +#define OSD_INFOMSG(msg) OsdMsg(mtInfo, msg) + +#define FREENULL(p) (free(p), p = NULL) + +void OsdMsg(eMessageType Type, const char *Msg); +void ChangeChars(char *name, char *chars); +void StrRepeat(char *input, int count, char *dest); +bool RegIMatch(char *string, char *pattern); + +// --- cStringValue ------------------------------------- + +class cStringValue +{ + private: + char *String; + + void Init(char *string) + { + FREENULL(String); + String = string ? strdup(string) : NULL; + } + public: + cStringValue(void) { String = NULL; } + ~cStringValue(void) { free(String); } + + cStringValue &operator= (char *string) + { + Init(string); + return *this; + } + cStringValue &operator+= (char *string) + { + if(String && string) + { + String = (char*) realloc(String, strlen(String) + strlen(string) + 1); + strcat(String, string); + } + if(!String) + Init(string); + + return *this; + } + char *operator& (void) { return String; } + + int len(void) { return String ? strlen(String) : 0; } +}; + +// --- cStringList -------------------------------------- + +class cStringListItem : public cListObject +{ + private: + char *String; + public: + cStringListItem(char *string) + { + String = string ? strdup(string) : NULL; + } + ~cStringListItem(void) { free(String); } + + char *Value(void) { return String; } +}; + +class cStringList : public cList {}; + +// --- cTokenizer --------------------------------------- + +class cToken : public cListObject +{ + private: + char *String; + public: + cToken(char *string) { + DEBUG("Neuer Token: %s", string); + String = string ? strdup(string) : NULL; + } + ~cToken(void) { free(String); } + char *Value(void) { return String; } +}; + +class cTokenizer : public cList +{ + private: + char *String; + char *Delim; + + void Tokenize(bool trim); + public: + cTokenizer(char *string, char *delim, bool trim = false) + { + DEBUG("neuer Tokenizer wird initialisiert: %s, %s", string, delim); + String = string ? strdup(string) : NULL; + Delim = delim ? strdup(delim) : NULL; + if(String && Delim) + Tokenize(trim); + } + ~cTokenizer(void) + { + DEBUG("Tokenizer wird gelöscht"); + free(String); + free(Delim); + } + char *GetToken(int index) { return index > 0 && index <= Count() ? Get(index - 1)->Value() : NULL; } +}; + +// --- cFileInfo ---------------------------------------- + +enum eFileInfo +{ + tNone = 0, + tDir, + tFile, + tUnknown, +}; + +class cFileInfo +{ + private: + char *File; + char *buffer; + struct stat64 Info; + unsigned long long int size; + + public: + cFileInfo(char *file); + ~cFileInfo(void); + + char *Path(void); + char *FileName(void); + char *FileNameWithoutExt(void); + char *Extension(bool withPoint = true); + eFileInfo Type(void); + unsigned long long int SizeByte(void); + double SizeKByte(int decimals = 2); + double SizeMByte(int decimals = 2); + double SizeGByte(int decimals = 1); + bool isReadable(void); + bool isWriteable(void); + bool isExecutable(void); + bool isExists(void); +}; + +// --- cFileCMD ------------------------------------------ + +class cFileCMD +{ + public: + static bool Del(char *file); + static bool Mkdir(char *dir) { return MakeDirs(dir, true); } + static bool Rn(char *oldfile, char *newfile) { return !rename(oldfile, newfile); } + static bool DirIsEmpty(char *file); +}; + +// --- cFileList ------------------------------- + +enum eFileList +{ + sNone, + sAsc, + sDesc, +}; + +class cFileOptListItem : public cListObject +{ + private: + char *RegEx; + eFileInfo Type; + public: + cFileOptListItem(char *regex, eFileInfo type = tNone) + { + RegEx = (regex && !isempty(regex)) ? strdup(regex) : NULL; + Type = type; + } + ~cFileOptListItem(void) { free(RegEx); } + + char *Regex(void) { return RegEx; } + eFileInfo FileType(void) { return Type; } +}; + +class cFileOptList : public cList {}; + +class cFileList; + +class cFileListItem : public cListObject +{ + friend class cFileList; + private: + char *File; + public: + cFileListItem(char *dir, char *file); + cFileListItem(char *file); + ~cFileListItem(void) { free(File); } + char *Value(void) { return File; } +}; + +class cFileList : public cList +{ + private: + char *Dir; + bool Sub; + + cFileOptList *Includes; + cFileOptList *Excludes; + bool Protect; + + eFileList SortMode; + bool SortToFilename; + eFileInfo Type; + + bool Read(char *dir, bool withsub); + void SortIn(char *dir, char *file); + + bool CheckIncludes(char *dir, char *file); + bool CheckExcludes(char *dir, char *file); + bool CheckType(char *dir, char *file, eFileInfo type); + public: + cFileList(void); + ~cFileList(void); + + bool Load(char *dir = NULL, bool withsub = false); + void OptInclude(char *include, eFileInfo type = tNone) + { + if(!Includes) + Includes = new cFileOptList(); + if(!include) + Includes->Clear(); + else + Includes->Add(new cFileOptListItem(include, type)); + } + void OptExclude(char *exclude, eFileInfo type = tNone) + { + if(!Excludes) + Excludes = new cFileOptList(); + if(!exclude) + Excludes->Clear(); + else + Excludes->Add(new cFileOptListItem(exclude, type)); + } + void OptSort(eFileList mode, bool tofilename = false) + { + SortMode = mode; + SortToFilename = tofilename; + } + void OptFilterType(eFileInfo type) { Type = type; } + + bool DirIsEmpty(cFileListItem *item); + static bool DirIsIn(char *file, char *strings); + static bool DirIsIn(cFileListItem *item, char *strings) { return DirIsIn(item->Value(), strings); } +}; + +#endif // __HELPERS_DVDSWITCH_H diff --git a/i18n.c b/i18n.c new file mode 100644 index 0000000..517a5ca --- /dev/null +++ b/i18n.c @@ -0,0 +1,3327 @@ +/* + * i18n.c: Internationalization + * + * See the README file for copyright information and how to reach the author. + * + * $Id: i18n.c 1.3 2002/06/23 13:05:59 kls Exp $ + */ + +#include "i18n.h" + +const tI18nPhrase Phrases[] = { + + { "DVDSwitch",// eng,dos + "DVDSwitch",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "allows to DVD-Images",// eng,dos + "ermöglicht DVD-Images abzuspielen",//deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Generic Settings",// eng,dos + "Allgemeine Einstellungen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Display Settings",// eng,dos + "Anzeige Einstellungen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Special Display Settings",// eng,dos + "Detailierte Anzeige Einstellungen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Navigation",// eng,dos + "Navigation",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tHide Mainmenu Entry",// eng,dos + "\tVerstecke Hauptmenüeintrag",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\t Name",// eng,dos + "\t Name",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tImage Dir.",// eng,dos + "\tImage Verz.",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tView free DiskSpace",// eng,dos + "\tZeige freien Plattenplatz",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tImagetypes",// eng,dos + "\tImagetypen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "to adjust",// eng,dos + "Einstellen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Imagetypes",// eng,dos + "Imagetypen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Description:",// eng,dos + "Beschreibung:",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Type-Title:",// eng,dos + "Typ-Bezeichnung:",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Image Type",// eng,dos + "Image Typ",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Directory contains:",// eng,dos + "Verzeichnis enthält:",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "File Extension:",// eng,dos + "Datei-Erweiterung:",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Hide Extension",// eng,dos + "Erweiterung ausblenden",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Directory with 'VIDEO_TS' Folder",// eng,dos + "Verzeichnis mit 'VIDEO_TS' Ordner",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "File with '.iso' Extension",// eng,dos + "Datei mit '.iso' Extension",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Iso-Image",// eng,dos + "Iso-Image",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Directory",// eng,dos + "Verzeichnis",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "File",// eng,dos + "Datei",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tDisplay Mode",// eng,dos + "\tAnzeige Modus",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "All Images",// eng,dos + "Alle Images",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "All with Cat.",// eng,dos + "Alle mit Kat.",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Directories",// eng,dos + "Verzeichnisse",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\t Category Type",// eng,dos + "\t Art der Kategorie",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Image-Type",// eng,dos + "Image-Typ",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Directories",// eng,dos + "Verzeichnisse",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "File-Type",// eng,dos + "Datei-Typ",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Image-File",// eng,dos + "Image-Datei",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Image-Directory",// eng,dos + "Image-Verzeichnis",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + + { "\t invisible empty Dir's/Cat.",// eng,dos + "\t Blende leere Verz./Kat. aus",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tAlphabetic Sort",// eng,dos + "\talphabetische Sortierung",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "none",// eng,dos + "Keine",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "ascending",// eng,dos + "Aufsteigend",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "descending",// eng,dos + "Absteigend",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tvisible DVD-Drive",// eng,dos + "\tDVD-LW einblenden",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tISO Images first",// eng,dos + "\tISO Images zuerst",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tinvisible Extension",// eng,dos + "\tBlende Erweiterung aus",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tisible Image-Type Col",// eng,dos + "\tZeige Image-Typ Spalte",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\t Width for Image-Col",// eng,dos + "\t Breite für Image-Spalte",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tchar for Cat.Line",// eng,dos + "\tZeichen für Kat.Linie",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\t Count before Cat.Name",// eng,dos + "\t Anzahl vorm Kat.Namen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tSpaces before/after Cat.Name",// eng,dos + "\tLeerzeichen vor/nach Kat.Name",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tCutText for Subcat",// eng,dos + "\tTrenntext für Subkat.",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tchange Character",// eng,dos + "\tZeichen ändern",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tCat.Jump by Left/Right",// eng,dos + "\tKat.sprung bei Links/Rechts",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "without Catergory",// eng,dos + "ohne Kategorie",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "DVD-Drive",// eng,dos + "DVD-Laufwerk",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Image Directory not readable or not exist",// eng,dos + "Image Verzeichnis ist nicht lesbar oder existiert nicht",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "DVD-Plugin not found! Function deactivated!",// eng,dos + "DVD Plugin nicht gefunden! Funktion deaktiviert!",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "No Writescript specified",// eng,dos + "Es wurde kein Writescript angegeben",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Specified Writescript not exist!",// eng,dos + "Angegebenes Writescript existiert nicht!",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Cannot execute Writescript!",// eng,dos + "Kann Writescript nicht ausführen!",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "No Readscript specified",// eng,dos + "Es wurde kein Readscript angegeben",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Specified Readscript not exist!",// eng,dos + "Angegebenes Readscript existiert nicht!",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Cannot execute Readscript!",// eng,dos + "Kann Readscript nicht ausführen!",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "invalid file name for DVD-Image",// eng,dos + "ungültiger Dateiname für das DVD-Image",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "'Description' must not empty!",// eng,dos + "'Beschreibung' darf nicht leer sein!",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "'Type-Title' must not empty!",// eng,dos + "'Typ Bezeichnung' darf nicht leer sein!",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "'Directory contains' must not empty!",// eng,dos + "'Verzeichnis enthält' darf nicht leer sein!",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "'File Extension' must not empty!",// eng,dos + "'Datei Erweiterung' darf nicht leer sein!",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "really delete Entry?",// eng,dos + "Eintrag wirklich löschen?",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "really delete DVD?",// eng,dos + "DVD wirklich löschen?",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "to change",// eng,dos + "Wechseln",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Play",// eng,dos + "Wiedergabe",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Read DVD",// eng,dos + "Lies DVD",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Write DVD",// eng,dos + "Schreibe DVD",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Read DVD",// eng,dos + "Lies DVD",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Imagename:",// eng,dos + "Image-Name:",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Imagetype:",// eng,dos + "Image-Typ:",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "read in",// eng,dos + "Einlesen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "no Rights to move",// eng,dos + "keine Berechtigung zum Verschieben",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "no Rights to delete",// eng,dos + "keine Berechtigung zum Löschen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "no Rights to write",// eng,dos + "keine Berechtigung zum Schreiben",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "no Rights to create",// eng,dos + "keine Berechtigung zum Erstellen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "no Rights to rename",// eng,dos + "keine Berechtigung zum schreiben",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "no Rights!",// eng,dos + "keine Berechtigung!",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "really delete?",// eng,dos + "Wirklich löschen?",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Directory not empty. however delete?",// eng,dos + "Verzeichnis ist nicht leer. Dennoch löschen?",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Commands",// eng,dos + "Befehle",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Directory Management",// eng,dos + "Verzeichnis Management",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "DVD-Tray open",// eng,dos + "DVD Schublade öffnen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "DVD-Tray close",// eng,dos + "DVD Schublade schließen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Image rename",// eng,dos + "Image umbenennen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Image move",// eng,dos + "Image verschieben",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Image delete",// eng,dos + "Image löschen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Image burn",// eng,dos + "Image brennen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Image to create from DVD",// eng,dos + "Image von DVD erstellen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Select",// eng,dos + "Auswählen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Rename",// eng,dos + "Umbenennen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Move",// eng,dos + "Verschieben",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Edit Directories",// eng,dos + "Verzeichnisse bearbeiten",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "New:",// eng,dos + "Neu:",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Directory exists",// eng,dos + "Verzeichnis existiert bereits",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Rename:",// eng,dos + "Umbenenen:",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Burn Now?",// eng,dos + "Jetzt brennen?",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Name:",// eng,dos + "Name:",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Directory:",// eng,dos + "Verzeichnis:",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Imagetype:",// eng,dos + "ImageTyp:",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "No Imagetype selected",// eng,dos + "Es wurde kein Imagetyp ausgewählt!",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "No Directory selected. Use Standard?",// eng,dos + "Es wurde kein Verzeichnis ausgewählt. Standard benutzen?",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Now Read?",// eng,dos + "Jetzt einlesen?",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Select Directory",// eng,dos + "Verzeichnis auswählen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "File exists in Directory",// eng,dos + "Datei existiert bereits im Verzeichnis",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "none Function",// eng,dos + "keine Funktion",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Dir. Management",// eng,dos + "Verz. Management",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Tray open",// eng,dos + "DVD öffnen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Tray close",// eng,dos + "DVD schließen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Image create",// eng,dos + "Image erstellen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Dir.Mgmt.",// eng,dos + "Verz.Mgmt.",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Close",// eng,dos + "Schließen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Burn",// eng,dos + "Brennen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Create",// eng,dos + "Erstellen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Key allocation",// eng,dos + "Tastenbelegung",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tKey 1",// eng,dos + "\tTaste 1",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tKey 2",// eng,dos + "\tTaste 2",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tKey 3",// eng,dos + "\tTaste 3",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tKey 4",// eng,dos + "\tTaste 4",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tKey 5",// eng,dos + "\tTaste 5",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tKey 6",// eng,dos + "\tTaste 6",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tKey 7",// eng,dos + "\tTaste 7",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tKey 8",// eng,dos + "\tTaste 8",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tKey 9",// eng,dos + "\tTaste 9",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tKey 0",// eng,dos + "\tTaste 0",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tKey Red",// eng,dos + "\tTaste Rot",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tKey Yellow",// eng,dos + "\tTaste Gelb",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tKey Green",// eng,dos + "\tTaste Grün",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tKey Blue",// eng,dos + "\tTaste Blau",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tKey OK",// eng,dos + "\tTaste OK",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tvisible Image-Size Col",// eng,dos + "\tZeige Spalte Image Größe",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "\tvisible Image-Type Col",// eng,dos + "\tZeige Spalte Image-Typ",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Insert",// eng,dos + "Einfügen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "New",// eng,dos + "Neu",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { "Delete",// eng,dos + "Löschen",// deu,ger + "",// slv,slo + "",// ita + "",// dut,nla,nld + "",// por + "",// fra,fre + "",// nor + "",// fin,smi + "",// pol + "",// esl,spa + "",// ell,gre + "",// sve,swe + "",// rom,rum + "",// hun + "",// cat,cln + "",// rus + "",// hrv + "",// est + "",// dan +#if VDRVERSNUM >= 10342 + "",// cze,ces +#endif + }, + { NULL } + }; diff --git a/i18n.h b/i18n.h new file mode 100644 index 0000000..577628a --- /dev/null +++ b/i18n.h @@ -0,0 +1,16 @@ +/* + * i18n.h: Internationalization + * + * See the README file for copyright information and how to reach the author. + * + * $Id: i18n.h 1.2 2002/05/11 14:48:16 kls Exp $ + */ + +#ifndef _I18N__H +#define _I18N__H + +#include + +extern const tI18nPhrase Phrases[]; + +#endif //_I18N__H diff --git a/imagelist-item.c b/imagelist-item.c new file mode 100644 index 0000000..95a2cb2 --- /dev/null +++ b/imagelist-item.c @@ -0,0 +1,57 @@ +#include "imagelist-item.h" + +cImageListItem::cImageListItem(char *lname, char *sname, eFileInfo type, char *value, bool hide) +{ + LName = NULL; + SName = NULL; + Value = 0; + SString = NULL; + + Edit(lname, sname, type, value, hide); + + Debug(); +} + +cImageListItem::~ cImageListItem(void) +{ + free(LName); + free(SName); + free(Value); + free(SString); +} + +void cImageListItem::Edit(char *lname, char *sname, eFileInfo type, char *value, bool hide) +{ + DEBUG("New/Edit ImageListItem"); + Debug(); + + free(LName); + free(SName); + free(Value); + + LName = lname ? strdup(lname) : NULL; + SName = sname ? strdup(sname) : NULL; + + if(type == tFile && value && value[0] != '.') + asprintf(&Value, ".%s", value); + else + Value = value ? strdup(value) : NULL; + + fType = type; + HideExt = hide; + + MakeSetupString(); + + Debug(); +} + +void cImageListItem::Debug(void) +{ + DEBUG("Items:"); + DEBUG(" LongName: %s", LName); + DEBUG(" ShortName: %s", SName); + DEBUG(" FileType: %i", (int)fType); + DEBUG(" Value: %s", Value); + DEBUG(" Hide: %s", HideExt ? "TRUE" : "FALSE"); + DEBUG(" SaveString: %s", SString); +} diff --git a/imagelist-item.h b/imagelist-item.h new file mode 100644 index 0000000..95e986b --- /dev/null +++ b/imagelist-item.h @@ -0,0 +1,40 @@ +#ifndef __IMAGELISTITEM_DVDSWITCH_H +#define __IMAGELISTITEM_DVDSWITCH_H + +#include +#include +#include "helpers.h" + +class cImageListItem : public cListObject +{ + private: + char *LName; + char *SName; + eFileInfo fType; + char *Value; + bool HideExt; + char *SString; + + void MakeSetupString(void) + { + DEBUG("Neuer SetupString"); + FREENULL(SString); + asprintf(&SString, "%s|%s|%i|%s|%i", LName, SName, (int)fType, Value, HideExt); + DEBUG("...%s", SString); + }; + + void Debug(void); + public: + cImageListItem(char *lname, char *sname, eFileInfo type, char *value, bool hide); + ~cImageListItem(void); + void Edit(char *lname, char *shortname, eFileInfo type, char *value, bool hide); + + char *GetLName(void) { return LName; }; + char *GetSName(void) { return SName; }; + eFileInfo GetFType(void) { return fType; }; + char *GetValue(void) { return Value; }; + bool IsHide(void) { return HideExt; }; + char *SaveString(void) { return SString; }; +}; + +#endif // __IMAGELISTITEM_DVDSWITCH_H diff --git a/imagelist.c b/imagelist.c new file mode 100644 index 0000000..fd387ff --- /dev/null +++ b/imagelist.c @@ -0,0 +1,203 @@ +#include "imagelist.h" + +cImageList ImageList; + +cImageList::cImageList(void) +{ + Setup = false; +} + +cImageList::~ cImageList(void) +{ +} + +void cImageList::Init(void) +{ + DEBUG("Init ImageList"); + if(!Setup) + { + Add(new cImageListItem((char*)tr("Directory with 'VIDEO_TS' Folder"), + (char*)tr("Directory"), + tDir, + "video_ts", + true)); + Add(new cImageListItem((char*)tr("File with '.iso' Extension"), + (char*)tr("Iso-Image"), + tFile, + ".iso", + true)); + } +} + +void cImageList::AddItem(char *item) +{ + DEBUG("Neues Item soll hinzugefügt werden: %s", item); + + if (!isempty(item)) + { + cTokenizer *token = new cTokenizer(item, "|"); + if(token->Count() == 5) + Add(new cImageListItem(token->GetToken(1), + token->GetToken(2), + (eFileInfo)atoi(token->GetToken(3)), + token->GetToken(4), + atoi(token->GetToken(5)))); + delete(token); + } +} + +void cImageList::AddSetup(char *value) +{ + DEBUG("Erhalte SetupString: %s",value); + + Setup = true; + Clear(); + + if(!isempty(value)) + { + cTokenizer *token = new cTokenizer(value, "@"); + for(int i = 1; i <= token->Count(); i++) + AddItem(token->GetToken(i)); + DELETENULL(token); + } +} + +char *cImageList::GetSetupString(void) +{ + DEBUG("Erstelle SetupString"); + + SString = NULL; + cImageListItem *item = First(); + + while(item) + { + DEBUG("Füge hinzu: %s", item->SaveString()); + SString += item->SaveString(); + SString += "@"; + item = Next(item); + } + + return &SString; +} + +char *cImageList::GetExtensions(void) +{ + DEBUG("Erstelle Liste aller Extensions"); + + Ext = NULL; + cImageListItem *item = First(); + + while(item) + { + DEBUG("Item ist vom Type: %i", (int) item->GetFType()); + if(item->GetFType() == tFile) + { + DEBUG("Item wird hinzugefügt: %s", item->GetValue()); + Ext += item->GetValue(); + Ext += "@"; + } + item = Next(item); + } + + return stripspace(&Ext); +} + +char *cImageList::GetHideExtensions(void) +{ + DEBUG("Erstelle Liste aller Extensions die ausgeblendet werden sollen"); + + HideExt = NULL; + cImageListItem *item = First(); + + while(item) + { + DEBUG("Item ist vom Type: %i", (int) item->GetFType()); + if(item->GetFType() == tFile && item->IsHide()) + { + DEBUG("Item wird hinzugefügt: %s", item->GetValue()); + HideExt += item->GetValue(); + HideExt += "@"; + } + item = Next(item); + } + + return stripspace(&HideExt); +} + +char *cImageList::GetDirContains(void) +{ + DEBUG("Erstelle Liste aller Verzeichnisinhalte"); + + DirIn = NULL; + cImageListItem *item = First(); + + while(item) + { + DEBUG("Item ist vom Type: %i", (int) item->GetFType()); + if(item->GetFType() == tDir) + { + DEBUG("Item wird hinzugefügt: %s", item->GetValue()); + DirIn += item->GetValue(); + DirIn += "@"; + } + item = Next(item); + } + + return stripspace(&DirIn); +} + +char *cImageList::GetShortName(char *file) +{ + DEBUG("Shortname wird gesucht: %s", file); + + Short = NULL; + cImageListItem *item = First(); + cFileInfo *info = new cFileInfo(file); + + switch(info->Type()) + { + case tDir: + while(item) + { + if(item->GetFType() == tDir && + cFileList::DirIsIn(file, item->GetValue())) + break; + item = Next(item); + } + if(item) + Short = item->GetSName(); + break; + case tFile: + while(item) + { + if(item->GetFType() == tFile && + !strcasecmp(item->GetValue(), info->Extension())) + break; + item = Next(item); + } + if(item) + Short = item->GetSName(); + break; + default: + break; + } + + return &Short; +} + +bool cImageList::IsHide(char *ext) +{ + if(!ext) + return false; + + cImageListItem *item = First(); + while(item) + { + if(item->GetFType() == tFile && + item->IsHide() && + !strcasecmp(ext, item->GetValue())) + return true; + item = Next(item); + } + return false; +} diff --git a/imagelist.h b/imagelist.h new file mode 100644 index 0000000..6458149 --- /dev/null +++ b/imagelist.h @@ -0,0 +1,37 @@ +#ifndef __IMAGELIST_DVDSWITCH_H +#define __IMAGELIST_DVDSWITCH_H + +#include +#include +#include "imagelist-item.h" + +class cImageList : public cList +{ + private: + cStringValue SString; + cStringValue Ext; + cStringValue HideExt; + cStringValue DirIn; + cStringValue Short; + + bool Setup; + + void AddItem(char *item); + public: + cImageList(void); + ~cImageList(void); + + void Init(void); + void AddSetup(char *value); + + char *GetSetupString(void); + char *GetExtensions(void); + char *GetHideExtensions(void); + char *GetDirContains(void); + char *GetShortName(char *file); + bool IsHide(char *ext); +}; + +extern cImageList ImageList; + +#endif //__IMAGELIST_DVDSWITCH_H diff --git a/menu-item.c b/menu-item.c new file mode 100644 index 0000000..edfd24a --- /dev/null +++ b/menu-item.c @@ -0,0 +1,29 @@ +#include "menu.h" +#include "menu-item.h" +#include "setup.h" +#include "imagelist.h" + +// --- cMainMenuItem ----------------------------------------------------- + +cMainMenuItem::cMainMenuItem(eMainMenuItem itype, char *file) +{ + DEBUG("Neues MainMenuItem: %i, %s", (int)itype, file); + + iType = itype; + File = file ? strdup(file) : NULL; + + OSD = cMainMenu::CreateOSDName(iType, File); + + SetText(OSD, true); + if(iType == iCat) + SetSelectable(false); + + DEBUG("OSDName: %s", OSD); +} + +cMainMenuItem::~ cMainMenuItem() +{ + free(File); + free(OSD); +} + diff --git a/menu-item.h b/menu-item.h new file mode 100644 index 0000000..cb102a3 --- /dev/null +++ b/menu-item.h @@ -0,0 +1,30 @@ +#ifndef __MENUITEM_DVDSWITCH_H +#define __MENUITEM_DVDSWITCH_H + +#include +#include "dvdlist-item.h" + +enum eMainMenuItem +{ + iCat, + iParent, + iDir, + iDVD, + iDevice +}; + +class cMainMenuItem : public cOsdItem +{ + private: + eMainMenuItem iType; + char *File; + char *OSD; + public: + cMainMenuItem(eMainMenuItem itype, char *file = NULL); + ~cMainMenuItem(void); + + eMainMenuItem Type(void) { return iType; }; + char* FileName(void) { return File; }; +}; + +#endif // __MENUITEM_DVDSWITCH_H diff --git a/menu.c b/menu.c new file mode 100644 index 0000000..cf5dbd7 --- /dev/null +++ b/menu.c @@ -0,0 +1,1157 @@ +#include +#include "menu.h" +#include "tools.h" +#include "setup.h" +#include "dvdplugin.h" +#include "commands.h" +#include "imagelist.h" + +cDirHandlingOpt MainMenuOptions; + +// --- cMainMenu ------------------------------------------------------------------------ + +cMainMenu::cMainMenu(void) + : cOsdMenu(DVDSwitchSetup.MenuName, DVDSwitchSetup.CountTypCol, 10) +{ + FirstSelectable = -1; + CMDImg = NULL; + State = mmsNone; + + if(!MainMenuOptions.ImageDir()) + Init(); + + Build(MainMenuOptions.CurrentDir()); +} + +cMainMenu::~cMainMenu(void) +{ + if(CMDImg) + delete(CMDImg); +} + +void cMainMenu::Init(void) +{ + MainMenuOptions.ImageDir(DVDSwitchSetup.ImageDir); + MainMenuOptions.CurrentDir(DVDSwitchSetup.ImageDir); + MainMenuOptions.ParentDir(DVDSwitchSetup.ImageDir); +} + +void cMainMenu::SetMenuTitle(void) +{ + char *title = NULL; + + if(DVDSwitchSetup.ViewFreeDiskSpace) + { + int mByte = FreeDiskSpaceMB(DVDSwitchSetup.ImageDir); + double gByte = (double)((int)((double)mByte / 1024 * 10)) / 10; + asprintf(&title, + "%s - %4.1f GB (DVD5: %i / DVD9: %i)", + DVDSwitchSetup.MenuName, + gByte, + (int)(gByte / 4.7), + (int)(gByte / 8.5)); + } else + title = DVDSwitchSetup.MenuName ? strdup(DVDSwitchSetup.MenuName) : NULL; + + SetTitle(title); + free(title); +} + +void cMainMenu::Build(char *dir) +{ + DEBUG("Build MainMenu von %s", dir); + + SetMenuTitle(); + if(!DVDSwitchSetup.HideImgSizeCol) + SetCols(DVDSwitchSetup.CountTypCol, 10); + else + SetCols(5, DVDSwitchSetup.CountTypCol-5, 10); + + FirstSelectable = -1; + + Clear(); + + switch(DVDSwitchSetup.DisplayMode) + { + case 0: + BuildDisp0(dir); + break; + case 1: + BuildDisp1(dir); + break; + case 2: + BuildDisp2(dir); + break; + } + + DEBUG("First Selectable ist: %i", FirstSelectable); + + if(FirstSelectable >= 0) + { + cMainMenuItem *mmItem = (cMainMenuItem*)Get(FirstSelectable); + SetCurrent(mmItem); + MainMenuOptions.setLastSelectItemName(mmItem->FileName()); + MainMenuOptions.LastSelectItemType(mmItem->Type()); + } + + Display(); + SetHelp(); +} + +void cMainMenu::BuildDisp0(char *dir) +{ + DEBUG("Bilde Menu nach DisplayMode 0"); + + cDVDList *DVDList = new cDVDList; + cMainMenuItem *mItem = NULL; + + if(DVDSwitchSetup.DisplayDVDDevice) + { + DEBUG("Füge Eintrag für das DVD-Device hinzu"); + Add(new cMainMenuItem(iDevice)); + if(!MainMenuOptions.getLastSelectItemName() && MainMenuOptions.LastSelectItemType() == iDevice) + FirstSelectable = 0; + } + + if(DVDList->Create(dir, + ImageList.GetExtensions(), + ImageList.GetDirContains(), + (eFileList)DVDSwitchSetup.SortMode, + true)) + { + DEBUG("DVDList erstellt"); + cDVDListItem *item = DVDList->First(); + while(item) + { + Add(new cMainMenuItem(iDVD, item->FileName())); + if(MainMenuOptions.getLastSelectItemName() && + !strcasecmp(item->FileName(), MainMenuOptions.getLastSelectItemName())) + { + mItem = (cMainMenuItem*)Last(); + FirstSelectable = mItem->Index(); + mItem = NULL; + } + item = DVDList->Next(item); + } + } + + if(Count() && FirstSelectable < 0) + FirstSelectable = 0; + + delete(DVDList); +} + +void cMainMenu::BuildDisp1(char *dir) +{ + cImageListItem *iItem = NULL; + cDVDList *DVDList = new cDVDList; + cDVDListItem *dItem = NULL; + cDirList *DirList = NULL; + cFileListItem *fItem = NULL; + cMainMenuItem *mItem = NULL; + + switch(DVDSwitchSetup.CategorieType) + { + case 0: // Image-Type + if(DVDSwitchSetup.DisplayDVDDevice) + { + DEBUG("Füge Eintrag für das DVD-Device hinzu"); + Add(new cMainMenuItem(iCat, dir)); + Add(new cMainMenuItem(iDevice)); + if(!MainMenuOptions.getLastSelectItemName() && MainMenuOptions.LastSelectItemType() == iDevice) + FirstSelectable = 1; + } + iItem = ImageList.First(); + while(iItem) + { + if(DVDList->Create(dir, + iItem->GetFType() == tFile ? iItem->GetValue() : NULL, + iItem->GetFType() == tDir ? iItem->GetValue() : NULL, + (eFileList)DVDSwitchSetup.SortMode, + true) && + (DVDList->Count() || !DVDSwitchSetup.HideEmptyDirs)) + { + Add(new cMainMenuItem(iCat, iItem->GetSName())); + dItem = DVDList->First(); + while(dItem) + { + Add(new cMainMenuItem(iDVD, dItem->FileName())); + if(MainMenuOptions.getLastSelectItemName() && + !strcasecmp(dItem->FileName(), MainMenuOptions.getLastSelectItemName())) + { + mItem = (cMainMenuItem*)Last(); + FirstSelectable = mItem->Index(); + mItem = NULL; + } + dItem = DVDList->Next(dItem); + } + } + iItem = ImageList.Next(iItem); + } + break; + case 1: // Directories + if(DVDList->Create(dir, + ImageList.GetExtensions(), + ImageList.GetDirContains(), + (eFileList)DVDSwitchSetup.SortMode, + false) && + (DVDList->Count() || !DVDSwitchSetup.HideEmptyDirs || DVDSwitchSetup.DisplayDVDDevice)) + { + Add(new cMainMenuItem(iCat, dir)); + if(DVDSwitchSetup.DisplayDVDDevice) + { + DEBUG("Füge Eintrag für das DVD-Device hinzu"); + Add(new cMainMenuItem(iDevice)); + if(!MainMenuOptions.getLastSelectItemName() && MainMenuOptions.LastSelectItemType() == iDevice) + FirstSelectable = 1; + } + dItem = DVDList->First(); + while(dItem) + { + Add(new cMainMenuItem(iDVD, dItem->FileName())); + if(MainMenuOptions.getLastSelectItemName() && + !strcasecmp(dItem->FileName(), MainMenuOptions.getLastSelectItemName())) + { + mItem = (cMainMenuItem*)Last(); + FirstSelectable = mItem->Index(); + mItem = NULL; + } + dItem = DVDList->Next(dItem); + } + } + DirList = new cDirList(); + if(DirList->Load(dir, true)) + { + fItem = DirList->First(); + while(fItem) + { + if(!DirList->DirIsIn(fItem, ImageList.GetDirContains()) && + DVDList->Create(fItem->Value(), + ImageList.GetExtensions(), + ImageList.GetDirContains(), + (eFileList)DVDSwitchSetup.SortMode, + false) && + (DVDList->Count() || !DVDSwitchSetup.HideEmptyDirs)) + { + Add(new cMainMenuItem(iCat, fItem->Value())); + dItem = DVDList->First(); + while(dItem) + { + Add(new cMainMenuItem(iDVD, dItem->FileName())); + if(MainMenuOptions.getLastSelectItemName() && + !strcasecmp(dItem->FileName(), MainMenuOptions.getLastSelectItemName())) + { + mItem = (cMainMenuItem*)Last(); + FirstSelectable = mItem->Index(); + mItem = NULL; + } + dItem = DVDList->Next(dItem); + } + } + fItem = DirList->Next(fItem); + } + } + DELETENULL(DirList); + break; + case 2: // FileType + if(DVDSwitchSetup.DisplayDVDDevice) + { + DEBUG("Füge Eintrag für das DVD-Device hinzu"); + Add(new cMainMenuItem(iCat, dir)); + Add(new cMainMenuItem(iDevice)); + if(!MainMenuOptions.getLastSelectItemName() && MainMenuOptions.LastSelectItemType() == iDevice) + FirstSelectable = 1; + } + if(DVDList->Create(dir, + ImageList.GetExtensions(), + NULL, + (eFileList)DVDSwitchSetup.SortMode, + true) && + (DVDList->Count() || !DVDSwitchSetup.HideEmptyDirs)) + { + Add(new cMainMenuItem(iCat, (char*)tr("Image-File"))); + dItem = DVDList->First(); + while(dItem) + { + Add(new cMainMenuItem(iDVD, dItem->FileName())); + if(MainMenuOptions.getLastSelectItemName() && + !strcasecmp(dItem->FileName(), MainMenuOptions.getLastSelectItemName())) + { + mItem = (cMainMenuItem*)Last(); + FirstSelectable = mItem->Index(); + mItem = NULL; + } + dItem = DVDList->Next(dItem); + } + } + if(DVDList->Create(dir, + NULL, + ImageList.GetDirContains(), + (eFileList)DVDSwitchSetup.SortMode, + true) && + (DVDList->Count() || !DVDSwitchSetup.HideEmptyDirs)) + { + Add(new cMainMenuItem(iCat, (char*)tr("Image-Directory"))); + dItem = DVDList->First(); + while(dItem) + { + Add(new cMainMenuItem(iDVD, dItem->FileName())); + if(MainMenuOptions.getLastSelectItemName() && + !strcasecmp(dItem->FileName(), MainMenuOptions.getLastSelectItemName())) + { + mItem = (cMainMenuItem*)Last(); + FirstSelectable = mItem->Index(); + mItem = NULL; + } + dItem = DVDList->Next(dItem); + } + } + break; + default: + break; + } + + DEBUG("Ermittle FirstSelectable"); + mItem = (cMainMenuItem*)First(); + if(mItem && FirstSelectable < 0) + { + while(mItem && !mItem->Selectable()) + mItem = (cMainMenuItem*)Next(mItem); + if(mItem) + FirstSelectable = mItem->Index(); + } + + delete(DVDList); + delete(DirList); +} + +void cMainMenu::BuildDisp2(char *dir) +{ + cMainMenuItem *mItem = NULL; + cDVDList *DVDList = new cDVDList; + cDVDListItem *dItem = NULL; + + cDirHandling *DirHand = new cDirHandling(this, &MainMenuOptions); + FirstSelectable = DirHand->Build(dir, !DVDSwitchSetup.HideEmptyDirs); + delete(DirHand); + + if(DVDSwitchSetup.DisplayDVDDevice && !strcasecmp(dir, MainMenuOptions.ImageDir())) + { + DEBUG("Füge Eintrag für das DVD-Device hinzu"); + Add(new cMainMenuItem(iDevice)); + if(!MainMenuOptions.getLastSelectItemName() && MainMenuOptions.LastSelectItemType() == iDevice) + { + mItem = (cMainMenuItem*)Last(); + FirstSelectable = mItem->Index(); + } + } + + if(DVDList->Create(dir, + ImageList.GetExtensions(), + ImageList.GetDirContains(), + (eFileList)DVDSwitchSetup.SortMode, + false)) + { + dItem = DVDList->First(); + while(dItem) + { + Add(new cMainMenuItem(iDVD, dItem->FileName())); + if(MainMenuOptions.getLastSelectItemName() && + !strcasecmp(dItem->FileName(), MainMenuOptions.getLastSelectItemName())) + { + mItem = (cMainMenuItem*)Last(); + FirstSelectable = mItem->Index(); + mItem = NULL; + } + dItem = DVDList->Next(dItem); + } + } + + delete(DVDList); + + mItem = (cMainMenuItem*)First(); + if(mItem && FirstSelectable < 0) + FirstSelectable = 0; +} + +void cMainMenu::SetHelp(void) +{ + cMainMenuItem *mItem = (cMainMenuItem*)Get(Current()); + + const char *kRed = NULL, *kGreen = NULL, *kYellow = NULL, *kBlue = NULL; + + switch((eCMDs)DVDSwitchSetup.kRed) + { + case cmdImgPlay: + if(mItem && (mItem->Type() == iParent || mItem->Type() == iDir)) + { + kRed = tr("to change"); + break; + } + if(mItem && !DVDSwitchSetup.DVDPluginExist) + break; + case cmdImgRename: + case cmdImgMove: + case cmdImgDelete: + case cmdImgBurn: + if(!mItem) + break; + if(mItem && (mItem->Type() == iParent || mItem->Type() == iDir)) + break; + if(mItem && (eCMDs)DVDSwitchSetup.kRed != cmdImgPlay && mItem->Type() != iDVD) + break; + case cmdDirManage: + case cmdDVDopen: + case cmdDVDclose: + case cmdImgRead: + case cmdCommands: + kRed = DVDSwitchSetup.CommandsShortName[DVDSwitchSetup.kRed]; + break; + default: + break; + } + + switch((eCMDs)DVDSwitchSetup.kGreen) + { + case cmdImgPlay: + if(mItem && (mItem->Type() == iParent || mItem->Type() == iDir)) + { + kGreen = tr("to change"); + break; + } + if(mItem && !DVDSwitchSetup.DVDPluginExist) + break; + case cmdImgRename: + case cmdImgMove: + case cmdImgDelete: + case cmdImgBurn: + if(!mItem) + break; + if(mItem && (mItem->Type() == iParent || mItem->Type() == iDir)) + break; + if(mItem && (eCMDs)DVDSwitchSetup.kGreen != cmdImgPlay && mItem->Type() != iDVD) + break; + case cmdDirManage: + case cmdDVDopen: + case cmdDVDclose: + case cmdImgRead: + case cmdCommands: + kGreen = DVDSwitchSetup.CommandsShortName[DVDSwitchSetup.kGreen]; + break; + default: + break; + } + + switch((eCMDs)DVDSwitchSetup.kYellow) + { + case cmdImgPlay: + if(mItem && (mItem->Type() == iParent || mItem->Type() == iDir)) + { + kYellow = tr("to change"); + break; + } + if(mItem && !DVDSwitchSetup.DVDPluginExist) + break; + case cmdImgRename: + case cmdImgMove: + case cmdImgDelete: + case cmdImgBurn: + if(!mItem) + break; + if(mItem && (mItem->Type() == iParent || mItem->Type() == iDir)) + break; + if(mItem && (eCMDs)DVDSwitchSetup.kYellow != cmdImgPlay && mItem->Type() != iDVD) + break; + case cmdDirManage: + case cmdDVDopen: + case cmdDVDclose: + case cmdImgRead: + case cmdCommands: + kYellow = DVDSwitchSetup.CommandsShortName[DVDSwitchSetup.kYellow]; + break; + default: + break; + } + + switch((eCMDs)DVDSwitchSetup.kBlue) + { + case cmdImgPlay: + if(mItem && (mItem->Type() == iParent || mItem->Type() == iDir)) + { + kBlue = tr("to change"); + break; + } + if(mItem && !DVDSwitchSetup.DVDPluginExist) + break; + case cmdImgRename: + case cmdImgMove: + case cmdImgDelete: + case cmdImgBurn: + if(!mItem) + break; + if(mItem && (mItem->Type() == iParent || mItem->Type() == iDir)) + break; + if(mItem && (eCMDs)DVDSwitchSetup.kBlue != cmdImgPlay && mItem->Type() != iDVD) + break; + case cmdDirManage: + case cmdDVDopen: + case cmdDVDclose: + case cmdImgRead: + case cmdCommands: + kBlue = DVDSwitchSetup.CommandsShortName[DVDSwitchSetup.kBlue]; + break; + default: + break; + } + + cOsdMenu::SetHelp(kRed, kGreen, kYellow, kBlue); +} + +eOSState cMainMenu::ProcessKey(eKeys Key) +{ + if(!HasSubMenu()) + { + switch(State) + { + case mmsImgRename: + switch(Key) + { + case kBack: + SetState(mmsNone); + DVDSwitchSetup.HideTypeCol = CMDImg->tmpHideTypeCol; + DELETENULL(CMDImg); + Build(MainMenuOptions.CurrentDir()); + Display(); + return osContinue; + break; + case kOk: + SetState(mmsNone); + DVDSwitchSetup.HideTypeCol = CMDImg->tmpHideTypeCol; + if(!isempty(CMDImg->NewFile)) + { + char *buffer = NULL; + char *buffer2 = NULL; + cFileInfo *info = new cFileInfo(CMDImg->Rename()); + if(ImageList.IsHide(info->Extension())) + { + buffer2 = strdup(info->Extension()); + asprintf(&buffer, "%s/%s%s", info->Path(), stripspace(CMDImg->NewFile), buffer2); + } + else + asprintf(&buffer, "%s/%s", info->Path(), stripspace(CMDImg->NewFile)); + DELETENULL(info); + info = new cFileInfo(buffer); + if(!info->isExists()) + { + if(cFileCMD::Rn(CMDImg->Rename(), buffer)) + MainMenuOptions.setLastSelectItemName(buffer); + } + else + OSD_WARNMSG(tr("File exists in Directory")); + FREENULL(buffer); + FREENULL(buffer2); + DELETENULL(info); + } + DELETENULL(CMDImg); + Build(MainMenuOptions.CurrentDir()); + Display(); + return osContinue; + break; + default: + break; + } + break; + default: + switch(Key) + { + case kUp: + case kUp|k_Repeat: + case kDown: + case kDown|k_Repeat: + case kRight: + case kRight|k_Repeat: + case kLeft: + case kLeft|k_Repeat: + return MenuMove(Key); + break; + case k1: + case k2: + case k3: + case k4: + case k5: + case k6: + case k7: + case k8: + case k9: + case k0: + case kRed: + case kGreen: + case kYellow: + case kBlue: + case kOk: + return Commands(Key); + break; + default: + break; + } + } + } + + return cOsdMenu::ProcessKey(Key); +} + +eOSState cMainMenu::MenuMove(eKeys Key) +{ + eOSState state = osContinue; + cMainMenuItem *mItem = NULL; + int step = 0; + + if(DVDSwitchSetup.DisplayMode == 1) + { + switch(Key) + { + case kDown: + case kDown|k_Repeat: + case kUp: + case kUp|k_Repeat: + state = cOsdMenu::ProcessKey(Key); + if(Count() && + Current() == FirstSelectable) + { + SetCurrent(Get(0)); + Display(); + SetCurrent(Get(FirstSelectable)); + Display(); + } + break; + case kLeft: + case kLeft|k_Repeat: + if(Count() && + DVDSwitchSetup.JumpCatByKey) + { + mItem = (cMainMenuItem*)Get(Current()); + step = 0; + while(step < 4) + { + while(mItem && step == 0) + { + if(mItem->Type() == iCat) + { + step++; + break; + } + mItem = (cMainMenuItem*)Prev(mItem); + } + while(mItem && step == 1) + { + if(mItem->Type() != iCat) + { + step++; + break; + } + mItem = (cMainMenuItem*)Prev(mItem); + } + while(mItem && step == 2) + { + if(mItem->Type() == iCat) + { + step++; + break; + } + mItem = (cMainMenuItem*)Prev(mItem); + } +#if VDRVERSNUM >= 10327 + if(!mItem && Setup.MenuScrollWrap) + { + mItem = (cMainMenuItem*)Last(); + if(mItem->Type() != iCat) + step = 2; + else + step = 1; + } + else +#endif + step = 4; + } + if(mItem) + { + SetCurrent(Next(mItem)); + Display(); + } + } + else + state = cOsdMenu::ProcessKey(Key); + if(Count() && + Current() == FirstSelectable) + { + SetCurrent(Get(0)); + Display(); + SetCurrent(Get(FirstSelectable)); + Display(); + } + break; + case kRight: + case kRight|k_Repeat: + if(Count() && + DVDSwitchSetup.JumpCatByKey) + { + mItem = (cMainMenuItem*)Get(Current()); + step = 0; + while(step < 3) + { + while(mItem && step == 0) + { + if(mItem->Type() == iCat) + { + step++; + break; + } + mItem = (cMainMenuItem*)Next(mItem); + } + while(mItem && step == 1) + { + if(mItem->Type() != iCat) + { + step++; + break; + } + mItem = (cMainMenuItem*)Next(mItem); + } +#if VDRVERSNUM >= 10327 + if(!mItem && Setup.MenuScrollWrap) + { + mItem = (cMainMenuItem*)First(); + step = 1; + } + else +#endif + step = 3; + } + if(mItem) + { + SetCurrent(mItem); + Display(); + } + } + else + state = cOsdMenu::ProcessKey(Key); + if(Count() && + Current() == FirstSelectable) + { + SetCurrent(Get(0)); + Display(); + SetCurrent(Get(FirstSelectable)); + Display(); + } + break; + default: + state = cOsdMenu::ProcessKey(Key); + break; + } + } + else + state = cOsdMenu::ProcessKey(Key); + SetHelp(); + + mItem = (cMainMenuItem*)Get(Current()); + MainMenuOptions.setLastSelectItemName(mItem->FileName()); + MainMenuOptions.LastSelectItemType(mItem->Type()); + + return state; +} + + +eOSState cMainMenu::SelectItem(void) +{ + cMainMenuItem *mItem = (cMainMenuItem*)Get(Current()); + cFileInfo *info = NULL; + cDirHandling *DirHand = NULL; + + if (mItem) + { + switch(mItem->Type()) + { + case iParent: + case iDir: + info = new cFileInfo(mItem->FileName()); + if(!info->isExecutable() || !info->isReadable()) + { + DELETENULL(info); + OSD_ERRMSG(tr("no Rights!")); + return osContinue; + break; + } + DELETENULL(info); + DirHand = new cDirHandling(this, &MainMenuOptions); + DirHand->ProcessKey(mItem); + delete(DirHand); + Build(MainMenuOptions.CurrentDir()); + break; + case iDVD: + case iDevice: + return cCMD::Play(mItem); + break; + default: + break; + } + } + + return osContinue; +} + +eOSState cMainMenu::Commands(eKeys Key) +{ + eOSState state = osUnknown; + cMainMenuItem *mItem = (cMainMenuItem*)Get(Current()); + eCMDs cmd = cmdNone; + cCMDImage *CMDImage = NULL; + + if(!HasSubMenu()) + { + switch(Key) + { + case k1: + cmd = (eCMDs)DVDSwitchSetup.k1; + break; + case k2: + cmd = (eCMDs)DVDSwitchSetup.k2; + break; + case k3: + cmd = (eCMDs)DVDSwitchSetup.k3; + break; + case k4: + cmd = (eCMDs)DVDSwitchSetup.k4; + break; + case k5: + cmd = (eCMDs)DVDSwitchSetup.k5; + break; + case k6: + cmd = (eCMDs)DVDSwitchSetup.k6; + break; + case k7: + cmd = (eCMDs)DVDSwitchSetup.k7; + break; + case k8: + cmd = (eCMDs)DVDSwitchSetup.k8; + break; + case k9: + cmd = (eCMDs)DVDSwitchSetup.k9; + break; + case k0: + cmd = (eCMDs)DVDSwitchSetup.k0; + break; + case kRed: + cmd = (eCMDs)DVDSwitchSetup.kRed; + break; + case kGreen: + cmd = (eCMDs)DVDSwitchSetup.kGreen; + break; + case kYellow: + cmd = (eCMDs)DVDSwitchSetup.kYellow; + break; + case kBlue: + cmd = (eCMDs)DVDSwitchSetup.kBlue; + break; + case kOk: + cmd = (eCMDs)DVDSwitchSetup.kOk; + break; + default: + break; + } + switch(cmd) + { + case cmdDirManage: + return AddSubMenu(new cCMDDir(this)); + break; + case cmdDVDopen: + return cCMD::Eject(false); + break; + case cmdDVDclose: + return cCMD::Eject(true); + break; + case cmdImgPlay: + return SelectItem(); + break; + case cmdImgRename: + if(mItem && mItem->Type() == iDVD) + { + SetState(mmsImgRename); + cOsdMenu::ProcessKey(kRight); + return osContinue; + } + break; + case cmdImgMove: + return AddSubMenu(new cCMDMove(mItem->FileName(), this, false, true)); + break; + case cmdImgDelete: + if(mItem && mItem->Type() == iDVD) + { + CMDImage = new cCMDImage(this); + state = CMDImage->Delete(mItem->FileName()); + DELETENULL(CMDImage); + return osContinue; + } + break; + case cmdImgBurn: + if(mItem && mItem->Type() == iDVD) + { + CMDImage = new cCMDImage(this); + state = CMDImage->Burn(mItem->FileName()); + DELETENULL(CMDImage); + return osContinue; + } + break; + case cmdImgRead: + return AddSubMenu(new cCMDImageRead()); + break; + case cmdCommands: + return AddSubMenu(new cCMDMenu(mItem, this)); + default: + break; + } + } + + return cOsdMenu::ProcessKey(Key); +} + +char *cMainMenu::CreateOSDName(eMainMenuItem itype, char *file) +{ + cStringValue buffer; + cStringValue tmpOSD; + cFileInfo *info = NULL; + char *reg = NULL; + int i = 0; + int len = 0; + + switch(itype) + { + case iCat: + asprintf(®, "^%s", MainMenuOptions.ImageDir()); + if(!RegIMatch(file, reg)) + buffer = file; + else + { + char *p = &file[strlen(MainMenuOptions.ImageDir())]; + if(p[0] == '/') + p++; + cTokenizer *token = new cTokenizer(p, "/"); + for (i = 1; i <= token->Count(); i++) + { + ChangeChars(token->GetToken(i), DVDSwitchSetup.ChangeCharsOSDName); + buffer += token->GetToken(i); + if(i != token->Count()) + buffer += DVDSwitchSetup.SubCatCutter; + } + DELETENULL(token); + } + FREENULL(reg); + for (i = 0; i < DVDSwitchSetup.CharCountBeforeCat; i++) + tmpOSD += &DVDSwitchSetup.CatLineChar; + if(DVDSwitchSetup.SpacesBeforeAfterCat) + tmpOSD += " "; + if(isempty(&buffer)) + tmpOSD += (char*)tr("without Catergory"); + else + tmpOSD += &buffer; + if(DVDSwitchSetup.SpacesBeforeAfterCat) + tmpOSD += " "; + len = tmpOSD.len(); + for (i = 0; i < (119 - len); i++) + tmpOSD += &DVDSwitchSetup.CatLineChar; + break; + case iParent: + buffer = ".."; + case iDir: + if(!&buffer && file) + { + info = new cFileInfo(file); + buffer = info->FileName(); + } + tmpOSD = "["; + tmpOSD += &buffer; + tmpOSD += "]"; + break; + case iDVD: + info = new cFileInfo(file); + if(ImageList.IsHide(info->Extension())) + buffer = info->FileNameWithoutExt(); + else + buffer = info->FileName(); + ChangeChars(&buffer, DVDSwitchSetup.ChangeCharsOSDName); + + if(DVDSwitchSetup.HideImgSizeCol) + { + char *size = NULL; + asprintf(&size, "(%03.1f)\t", info->SizeGByte(1)); + tmpOSD += size; + free(size); + } + tmpOSD += &buffer; + + //tmpOSD = &buffer; + if(DVDSwitchSetup.HideTypeCol) + { + tmpOSD += "\t"; + tmpOSD += ImageList.GetShortName(file); + } + break; + case iDevice: + tmpOSD = "--> ("; + tmpOSD += (char*)tr("DVD-Drive"); + tmpOSD += ") <--"; + break; + default: + break; + } + + delete(info); + free(reg); + + return strdup(&tmpOSD); +} + +void cMainMenu::SetState(eMainMenuState state) +{ + State = state; + cMainMenuItem *mItem = NULL; + cMainMenuItem *dmItem = NULL; + cFileInfo *info = NULL; + + switch(State) + { + case mmsReInit: + SetState(mmsNone); + Init(); + Build(MainMenuOptions.CurrentDir()); + break; + case mmsReInitCur: + SetState(mmsNone); + Build(MainMenuOptions.CurrentDir()); + break; + case mmsImgRename: + DELETENULL(CMDImg); + mItem = (cMainMenuItem*)Get(Current()); + if(mItem->Type() != iDVD) + { + SetState(mmsNone); + break; + } + info = new cFileInfo(mItem->FileName()); + if(!info->isWriteable()) + { + DELETENULL(info); + info = new cFileInfo(MainMenuOptions.CurrentDir()); + if(!info->isWriteable()) + { + OSD_ERRMSG(tr("no Rights to rename")); + SetState(mmsNone); + DELETENULL(info); + break; + } + } + DELETENULL(info); + CMDImg = new cCMDImage(); + CMDImg->Rename(mItem->FileName()); + CMDImg->tmpHideTypeCol = DVDSwitchSetup.HideTypeCol; + if(DVDSwitchSetup.HideTypeCol) + { + DVDSwitchSetup.HideTypeCol = 0; + Build(MainMenuOptions.CurrentDir()); + } + SetCols(11); + mItem = (cMainMenuItem*)First(); + while(mItem) + { + if(mItem->Index() == Current()) + { + info = new cFileInfo(mItem->FileName()); + if(ImageList.IsHide(info->Extension())) + strn0cpy(CMDImg->NewFile, info->FileNameWithoutExt(), MaxFileName); + else + strn0cpy(CMDImg->NewFile, info->FileName(), MaxFileName); + DELETENULL(info); + Ins(new cMenuEditStrItem(tr("Rename:"), CMDImg->NewFile, MaxFileName, tr(" abcdefghijklmnopqrstuvwxyz0123456789-_.#~")), + true, + mItem); + dmItem = mItem; + } + mItem->SetSelectable(false); + mItem = (cMainMenuItem*)Next(mItem); + } + if(dmItem) + Del(dmItem->Index()); + Display(); + break; + default: + break; + } +} + +// --- cDirHandling ----------------------------------------- + +cDirHandling::cDirHandling(cOsdMenu *osdobject, cDirHandlingOpt *dirobject) +{ + OsdObject = osdobject; + DirObject = dirobject; +} + +int cDirHandling::Build(char *dir, bool emptydirs) +{ + int ret = -1; + cMainMenuItem *mItem = NULL; + + cDirList *DirList = new cDirList(); + if(DirList->Load(dir, false)) + { + if(DirObject->isParent(dir)) + OsdObject->Add(new cMainMenuItem(iParent, DirObject->ParentDir())); + + cFileListItem *fItem = DirList->First(); + while(fItem) + { + if(!DirList->DirIsIn(fItem, ImageList.GetDirContains()) && + (!DirList->DirIsEmpty(fItem) || emptydirs)) + { + OsdObject->Add(new cMainMenuItem(iDir, fItem->Value())); + mItem = (cMainMenuItem*)OsdObject->Last(); + if(mItem && + DirObject->getLastSelectItemName() && + !strcasecmp(mItem->FileName(), DirObject->getLastSelectItemName())) + ret = mItem->Index(); + if(mItem && DirObject->isLastSel(mItem->FileName())) + ret = mItem->Index(); + } + fItem = DirList->Next(fItem); + } + } + + return ret; +} + +void cDirHandling::ProcessKey(cMainMenuItem *mItem) +{ + cFileInfo *info = NULL; + + if (mItem) + { + switch(mItem->Type()) + { + case iParent: + DirObject->LastSelDir(DirObject->CurrentDir()); + DirObject->CurrentDir(DirObject->ParentDir()); + if(strcasecmp(DirObject->ImageDir(), DirObject->ParentDir())) + { + info = new cFileInfo(DirObject->ParentDir()); + DirObject->ParentDir(info->Path()); + DELETENULL(info); + } + break; + case iDir: + DirObject->ParentDir(DirObject->CurrentDir()); + DirObject->CurrentDir(mItem->FileName()); + break; + default: + break; + } + } +} diff --git a/menu.h b/menu.h new file mode 100644 index 0000000..002bad8 --- /dev/null +++ b/menu.h @@ -0,0 +1,149 @@ +#ifndef __MENU_DVDSWITCH_H +#define __MENU_DVDSWITCH_H + +#include +#include "menu-item.h" +#include "dvdlist.h" + +enum eMainMenuState +{ + mmsNone, + mmsReInit, + mmsReInitCur, + mmsImgRename, +}; + +class cCMDImage; + +class cMainMenu : public cOsdMenu +{ + private: + int FirstSelectable; + eMainMenuState State; + cCMDImage *CMDImg; + + void Init(void); + void SetMenuTitle(void); + void Build(char *dir); + void BuildDisp0(char *dir); + void BuildDisp1(char *dir); + void BuildDisp2(char *dir); + eOSState MenuMove(eKeys Key); + eOSState SelectItem(void); + eOSState Commands(eKeys Key); + public: + cMainMenu(void); + ~cMainMenu(void); + void SetHelp(void); + virtual eOSState ProcessKey(eKeys Key); + + static char *CreateOSDName(eMainMenuItem itype, char *file = NULL); + void SetState(eMainMenuState state); + eMainMenuState GetState(void) { return State; }; +}; + +class cDirHandlingOpt +{ + char *IDir; + char *CDir; + char *PDir; + char *LSDir; + char *LSItemName; + eMainMenuItem LSItemType; + + public: + cDirHandlingOpt(void) + { + IDir = NULL; + CDir = NULL; + PDir = NULL; + LSDir = NULL; + LSItemName = NULL; + LSItemType = iCat; + } + ~cDirHandlingOpt(void) + { + free(IDir); + free(CDir); + free(PDir); + free(LSDir); + free(LSItemName); + } + char *ImageDir(char *dir = NULL) + { + if(dir) + { + FREENULL(IDir); + IDir = strdup(dir); + } + return IDir; + } + char *CurrentDir(char *dir = NULL) + { + if(dir) + { + FREENULL(CDir); + CDir = strdup(dir); + } + return CDir; + } + char *ParentDir(char *dir = NULL) + { + if(dir) + { + FREENULL(PDir); + PDir = strdup(dir); + } + return PDir; + } + char *LastSelDir(char *dir = NULL) + { + if(dir) + { + FREENULL(LSDir); + LSDir = strdup(dir); + } + return LSDir; + } + bool isParent(char *dir) + { + if(dir && PDir && strcasecmp(dir, PDir)) + return true; + return false; + } + bool isLastSel(char *dir) + { + if(dir && LSDir && !strcasecmp(dir, LSDir)) + return true; + return false; + } + void setLastSelectItemName(char *filename = NULL) + { + FREENULL(LSItemName); + if(filename) + LSItemName = strdup(filename); + }; + char *getLastSelectItemName(void) { return LSItemName; } + eMainMenuItem LastSelectItemType(eMainMenuItem type = iCat) + { + if(type != iCat) + LSItemType = type; + return LSItemType; + } +}; + +class cDirHandling +{ + private: + cOsdMenu *OsdObject; + cDirHandlingOpt *DirObject; + public: + cDirHandling(cOsdMenu *osdobject, cDirHandlingOpt *dirobject); + + int Build(char *dir, bool emptydirs); + void ProcessKey(cMainMenuItem *mItem); +}; + +extern cDirHandlingOpt MainMenuOptions; + +#endif // __MENU_DVDSWITCH_H diff --git a/setup-itypes.c b/setup-itypes.c new file mode 100644 index 0000000..e66da77 --- /dev/null +++ b/setup-itypes.c @@ -0,0 +1,243 @@ +#include +#include "setup-itypes.h" +#include "i18n.h" + +cMenuSetupDSITypes::cMenuSetupDSITypes(bool select, int* retindex, char *buffer) + : cOsdMenu(tr("Imagetypes")) +{ + DEBUG("Ermitlle ersten Setup-Eintrag"); + cSetupLine *item = Setup.First(); + Select = select; + RetIndex = retindex; + Buffer = buffer; + + if(item) + DEBUG("OK"); + + while(item) + { + if(item->Plugin() && + !strcasecmp(item->Plugin(), "dvdswitch") && + !strcasecmp(item->Name(), "ImageTypes")) + break; + item = Setup.Next(item); + } + + SetupLine = item; + + Set(); +} + + +void cMenuSetupDSITypes::Set(void) +{ + int current = Current(); + + Clear(); + + cImageListItem *item = ImageList.First(); + + while(item) + { + Add(new cOsdItem(item->GetLName())); + item = ImageList.Next(item); + } + + SetCurrent(Get(current)); + + Display(); + SetHelp(); +} + +void cMenuSetupDSITypes::SetHelp(void) +{ + cOsdItem *item = Get(Current()); + if(item) + { + if(Select) + cOsdMenu::SetHelp(NULL, tr("New"), NULL , tr("Select")); + else + cOsdMenu::SetHelp(tr("Edit"), tr("New"), tr("Delete") , NULL); + } + else + cOsdMenu::SetHelp(NULL, tr("New"), NULL , NULL); +} + +eOSState cMenuSetupDSITypes::ProcessKey(eKeys Key) +{ + eOSState state = cOsdMenu::ProcessKey(Key); + + cImageListItem *item = NULL; + + if (!HasSubMenu()) + { + switch(Key) + { + case kRed: + state = AddSubMenu(new cMenuSetupDSITypesItem(Current())); + break; + case kGreen: + state = AddSubMenu(new cMenuSetupDSITypesItem(ImageList.Count())); + break; + case kYellow: + if(Interface->Confirm(tr("really delete Entry?"))) + { + item = ImageList.Get(Current()); + ImageList.Del(item); + Set(); + Display(); + } + break; + case kBlue: + item = ImageList.Get(Current()); + if(Select && item) + { + strn0cpy((char*)Buffer, item->GetLName(), MaxFileName); + *RetIndex = item->Index(); + return osBack; + } + break; + case kBack: + case kOk: + item = ImageList.Get(Current()); + if(Select && item) + { + strn0cpy((char*)Buffer, item->GetLName(), MaxFileName); + *RetIndex = item->Index(); + return osBack; + } + if(state == osContinue) + { + Set(); + Display(); + } + else + { + if(SetupLine) + { + DEBUG("Lösche SetupLine"); + Setup.Del(SetupLine); + } + DEBUG("Hole SetupString"); + if(ImageList.GetSetupString()) + SetupLine = new cSetupLine("ImageTypes", ImageList.GetSetupString(), "dvdswitch"); + else + SetupLine = new cSetupLine("ImageTypes", "", "dvdswitch"); + DEBUG("neue SetupLine erstellt"); + Setup.Add(SetupLine); + DEBUG("neue SetupLine hinzugefügt"); + return osBack; + } + break; + default: + break; + } + } + + return state; +} + +// --- cMenuSetupDSITypesItem ----------------------------------- + +cMenuSetupDSITypesItem::cMenuSetupDSITypesItem(int itemindex) + : cOsdMenu(tr("New"), 22) +{ + if(itemindex < ImageList.Count()) + { + SetTitle(tr("Edit")); + Item = ImageList.Get(itemindex); + strn0cpy(LongName, Item->GetLName(), 50); + strn0cpy(ShortName, Item->GetSName(), 20); + FileType = (int)Item->GetFType() - 1; + strn0cpy(Extension, Item->GetValue(), 20); + HideExtension = Item->IsHide(); + } else + { + Item = NULL; + strcpy(LongName, "\0"); + strcpy(ShortName, "\0"); + FileType = 1; + strcpy(Extension, "\0"); + HideExtension = 1; + } + + FileTypes[0] = tr("Directory"); + FileTypes[1] = tr("File"); + + Set(); +} + +void cMenuSetupDSITypesItem::Set(void) +{ + int current = Current(); + + Clear(); + + Add(new cMenuEditStrItem(tr("Description:"), + LongName, + 50, + " abcdefghijklmnopqrstuvwxyz0123456789-.#~'/()[]")); + Add(new cMenuEditStrItem(tr("Type-Title:"), + ShortName, + 20, + " abcdefghijklmnopqrstuvwxyz0123456789-.#~'/()[]")); + Add(new cMenuEditStraItem(tr("Image Type"), &FileType, 2, FileTypes)); + Add(new cMenuEditStrItem(!FileType ? tr("Directory contains:") : tr("File Extension:"), + Extension, + 20, + "abcdefghijklmnopqrstuvwxyz0123456789-_.#~")); + if(FileType) + Add(new cMenuEditBoolItem(tr("Hide Extension"), &HideExtension)); + + SetCurrent(Get(current)); + Display(); +} + +eOSState cMenuSetupDSITypesItem::ProcessKey(eKeys Key) +{ + int tmpFileType = FileType; + + eOSState state = cOsdMenu::ProcessKey(Key); + + if(tmpFileType != FileType) + { + Set(); + Display(); + } + + if(state == osUnknown) + { + switch(Key) + { + case kOk: + if(isempty(LongName)) + { + OSD_WARNMSG(tr("'Description' must not empty!")); + return osContinue; + } + if(isempty(ShortName)) + { + OSD_WARNMSG(tr("'Type-Title' must not empty!")); + return osContinue; + } + if(isempty(Extension)) + { + if(!FileType) + OSD_WARNMSG(tr("'Directory contains' must not empty!")); + else + OSD_WARNMSG(tr("'File Extension' must not empty!")); + return osContinue; + } + if(!Item) + ImageList.Add(new cImageListItem(LongName, ShortName, (eFileInfo)(FileType + 1), Extension, HideExtension)); + else + Item->Edit(LongName, ShortName, (eFileInfo)(FileType + 1), Extension, HideExtension); + state = osBack; + break; + default: + break; + } + } + + return state; +} diff --git a/setup-itypes.h b/setup-itypes.h new file mode 100644 index 0000000..ff646e4 --- /dev/null +++ b/setup-itypes.h @@ -0,0 +1,40 @@ +#ifndef __SETUP_EXTENSIONS_DVDSWITCH_H +#define __SETUP_EXTENSIONS_DVDSWITCH_H + +#include +#include "imagelist.h" + +class cMenuSetupDSITypes : public cOsdMenu +{ + private: + cSetupLine *SetupLine; + bool Select; + int *RetIndex; + char *Buffer; + + void Set(void); + public: + cMenuSetupDSITypes(bool select = false, int* retindex = NULL, char *buffer = NULL); + void SetHelp(void); + protected: + virtual eOSState ProcessKey(eKeys Key); +}; + +class cMenuSetupDSITypesItem : public cOsdMenu +{ + private: + cImageListItem *Item; + char LongName[50]; + char ShortName[20]; + int FileType; + const char *FileTypes[2]; + char Extension[20]; + int HideExtension; + + void Set(void); + public: + cMenuSetupDSITypesItem(int itemindex); + virtual eOSState ProcessKey(eKeys Key); +}; + +#endif // __SETUP_EXTENSIONS_DVDSWITCH_H diff --git a/setup.c b/setup.c new file mode 100644 index 0000000..15f5928 --- /dev/null +++ b/setup.c @@ -0,0 +1,518 @@ +#include "setup.h" +#include "menu.h" +#include "i18n.h" +#include "dvdplugin.h" +#include "setup-itypes.h" + +// --- cDVDSwitchSetup ------------------------------------------------ + +cDVDSwitchSetup DVDSwitchSetup; + +cDVDSwitchSetup::cDVDSwitchSetup(void) +{ + HideMenuEntry = 0; + strcpy(MenuName, "DVDSwitch"); + CustomMenuName = false; + strcpy(ImageDir, "/video/dvd"); + ImageDirPerParam = false; + ViewFreeDiskSpace = 1; + + DisplayMode = 0; + CategorieType = 1; + HideEmptyDirs = 1; + SortMode = 1; + DisplayDVDDevice = 0; + + HideTypeCol = 0; + CountTypCol = 35; + HideImgSizeCol = 0; + asprintf(&CatLineChars, "%s", "-_.:#+*!%<>"); + CatLineChar = CatLineChars[0]; + CharCountBeforeCat = 3; + SpacesBeforeAfterCat = 1; + strcpy(SubCatCutter, ">"); + strcpy(ChangeCharsOSDName, "_ +&"); + + JumpCatByKey = 0; + + k1 = 2; + k2 = 3; + k3 = 0; + k4 = 0; + k5 = 0; + k6 = 0; + k7 = 0; + k8 = 5; + k9 = 6; + k0 = 1; + kRed = 10; + kGreen = 8; + kYellow = 7; + kBlue = 9; + kOk = 4; + + DVDPluginExist = false; + strcpy(DVDReadScript, "/usr/local/bin/dvdswitch_readdvd.sh"); + strcpy(DVDWriteScript, "/usr/local/bin/dvdswitch_writedvd.sh"); +} + +cDVDSwitchSetup::~ cDVDSwitchSetup(void) +{ +} + +void cDVDSwitchSetup::Init(void) +{ + if (!CustomMenuName) + strcpy(MenuName, tr(MenuName)); + + MaxDModes = 3; + DModes[0] = tr("All Images"); + DModes[1] = tr("All with Cat."); + DModes[2] = tr("Directories"); + + MaxCTypes = 3; + CTypes[0] = tr("Image-Type"); + CTypes[1] = tr("Directories"); + CTypes[2] = tr("File-Type"); + + MaxSModes = 3; + SModes[0] = tr("none"); + SModes[1] = tr("ascending"); + SModes[2] = tr("descending"); + + MaxCommands = 11; + Commands[0] = tr("none Function"); + Commands[1] = tr("Dir. Management"); + Commands[2] = tr("Tray open"); + Commands[3] = tr("Tray close"); + Commands[4] = tr("Play"); + Commands[5] = tr("Image rename"); + Commands[6] = tr("Image move"); + Commands[7] = tr("Image delete"); + Commands[8] = tr("Image burn"); + Commands[9] = tr("Image create"); + Commands[10] = tr("Commands"); + + CommandsShortName[0] = NULL; + CommandsShortName[1] = tr("Dir.Mgmt."); + CommandsShortName[2] = tr("Open"); + CommandsShortName[3] = tr("Close"); + CommandsShortName[4] = tr("Play"); + CommandsShortName[5] = tr("Rename"); + CommandsShortName[6] = tr("Move"); + CommandsShortName[7] = tr("Delete"); + CommandsShortName[8] = tr("Burn"); + CommandsShortName[9] = tr("Create"); + CommandsShortName[10] = tr("Commands"); + + Debug(); +} + +bool cDVDSwitchSetup::SetupParse(const char *Name, const char *Value) +{ + if (!strcasecmp(Name, "HideMenuEntry")) HideMenuEntry = atoi(Value); + if (!strcasecmp(Name, "MenuName")) + { + strn0cpy(MenuName, Value, 50); + CustomMenuName = true; + } + if (!strcasecmp(Name, "ImageDir") && !ImageDirPerParam) strn0cpy(ImageDir, Value, MaxFileName); + if (!strcasecmp(Name, "ImageTypes")) ImageList.AddSetup((char*)Value); + if (!strcasecmp(Name, "ViewFreeDiskSpace")) ViewFreeDiskSpace = atoi(Value); + + if (!strcasecmp(Name, "DisplayMode")) DisplayMode = atoi(Value); + if (!strcasecmp(Name, "CategorieType")) CategorieType = atoi(Value); + if (!strcasecmp(Name, "HideEmptyDirs")) HideEmptyDirs = atoi(Value); + if (!strcasecmp(Name, "SortMode")) SortMode = atoi(Value); + if (!strcasecmp(Name, "DisplayDVDDevice")) DisplayDVDDevice = atoi(Value); + + + if (!strcasecmp(Name, "HideTypeCol")) HideTypeCol = atoi(Value); + if (!strcasecmp(Name, "CountTypCol")) CountTypCol = atoi(Value); + if (!strcasecmp(Name, "HideImgSizeCol")) HideImgSizeCol = atoi(Value); + + if (!strcasecmp(Name, "CatLineChar")) + { + CatLineChar = atoi(Value); + if(!CatLineChar || !strchr(CatLineChars, CatLineChar)) + CatLineChar = CatLineChars[0]; + } + if (!strcasecmp(Name, "CharCountBeforeCat")) CharCountBeforeCat = atoi(Value); + if (!strcasecmp(Name, "SpacesBeforeAfterCat")) SpacesBeforeAfterCat = atoi(Value); + if (!strcasecmp(Name, "SubCatCutter")) strn0cpy(SubCatCutter, Value, 7); + if (!strcasecmp(Name, "ChangeCharsOSDName")) strn0cpy(ChangeCharsOSDName, Value, 20); + + if (!strcasecmp(Name, "JumpCatByKey")) JumpCatByKey = atoi(Value); + + if (!strcasecmp(Name, "k1")) k1 = atoi(Value); + if (!strcasecmp(Name, "k2")) k2 = atoi(Value); + if (!strcasecmp(Name, "k3")) k3 = atoi(Value); + if (!strcasecmp(Name, "k4")) k4 = atoi(Value); + if (!strcasecmp(Name, "k5")) k5 = atoi(Value); + if (!strcasecmp(Name, "k6")) k6 = atoi(Value); + if (!strcasecmp(Name, "k7")) k7 = atoi(Value); + if (!strcasecmp(Name, "k8")) k8 = atoi(Value); + if (!strcasecmp(Name, "k9")) k9 = atoi(Value); + if (!strcasecmp(Name, "k0")) k0 = atoi(Value); + if (!strcasecmp(Name, "kRed")) kRed = atoi(Value); + if (!strcasecmp(Name, "kGreen")) kGreen = atoi(Value); + if (!strcasecmp(Name, "kYellow")) kYellow = atoi(Value); + if (!strcasecmp(Name, "kBlue")) kBlue = atoi(Value); + if (!strcasecmp(Name, "kOk")) kOk = atoi(Value); + + return true; +} + +void cDVDSwitchSetup::Debug(void) +{ + DEBUG("SetupParameter:"); + DEBUG(" HideMenuEntry: %i", HideMenuEntry); + DEBUG(" MenuName: %s", MenuName); + DEBUG(" ImageDir: %s", ImageDir); + DEBUG(" ImageDirPerParam: %s", ImageDirPerParam ? "TRUE" : "FALSE"); + DEBUG(" ViewFreeDiskSpace: %s", ViewFreeDiskSpace ? "TRUE" : "FALSE"); + + DEBUG(" DisplayMode: %i", DisplayMode); + DEBUG(" CategorieType: %i", CategorieType); + DEBUG(" HideEmptyDirs: %i", HideEmptyDirs); + DEBUG(" SortMode: %i", SortMode); + DEBUG(" DisplayDVDDevice: %s", DisplayDVDDevice ? "TRUE" : "FALSE"); + + //DEBUG(" ISOFirst: %i", ISOFirst); + DEBUG(" HideTypeCol: %i", HideTypeCol); + DEBUG(" CountTypCol: %i", CountTypCol); + DEBUG(" HideImgSizeCol: %i", HideImgSizeCol); + DEBUG(" CatLineChar, %i", CatLineChar); + DEBUG(" CharCountBeforeCat: %i", CharCountBeforeCat); + DEBUG(" SpacesBeforeAfterCat: %i", SpacesBeforeAfterCat); + DEBUG(" SubCatCutter: %s", SubCatCutter); + DEBUG(" ChangeCharsOSDName: %s", ChangeCharsOSDName); + + DEBUG(" JumpCatByKey: %i", JumpCatByKey); + + DEBUG(" DVDLink: %s", DVDLink); + DEBUG(" DVDLinkOrg: %s", DVDLinkOrg); + DEBUG(" DVDReadScript: %s", DVDReadScript); + DEBUG(" DVDWriteScript: %s", DVDWriteScript); + + DEBUG(" k1: %i", k1); + DEBUG(" k2: %i", k2); + DEBUG(" k3: %i", k3); + DEBUG(" k4: %i", k4); + DEBUG(" k5: %i", k5); + DEBUG(" k6: %i", k6); + DEBUG(" k7: %i", k7); + DEBUG(" k8: %i", k8); + DEBUG(" k9: %i", k9); + DEBUG(" k0: %i", k0); + DEBUG(" kRed: %i", kRed); + DEBUG(" kGreen: %i", kGreen); + DEBUG(" kYellow: %i", kYellow); + DEBUG(" kBlue: %i", kBlue); + DEBUG(" kOk: %i", kOk); +} + +// --- cMenuSetupDVDSwitch ------------------------------------------- + +cMenuSetupDVDSwitch::cMenuSetupDVDSwitch(void) +{ + data = DVDSwitchSetup; + + ViewGeneric = false; + ViewGenericPos = -1; + ViewDisplay = false; + ViewDisplayPos = -1; + ViewSpecialDisplay = false; + ViewSpecialDisplayPos = -1; + ViewNav = false; + ViewNavPos = -1; + ViewKey = false; + ViewKeyPos = -1; + + SetCols(2,30); + Set(); +} + +void cMenuSetupDVDSwitch::Set(void) +{ + int current = Current(); + cOsdItem *item = NULL; + + Clear(); + + Add(new cMenuEditCatItem(tr("Generic Settings"), ViewGeneric)); + ViewGenericPos = Count() - 1; + if(ViewGeneric) + { + Add(new cMenuEditBoolItem(tr("\tHide Mainmenu Entry"), &data.HideMenuEntry)); + if (!data.HideMenuEntry) + Add(new cMenuEditStrItem(tr("\t Name"), + data.MenuName, + 50, + tr(" abcdefghijklmnopqrstuvwxyz0123456789-.#~"))); + if(!data.ImageDirPerParam) + Add(new cMenuEditStrItem(tr("\tImage Dir."), + data.ImageDir, + MaxFileName, + "abcdefghijklmnopqrstuvwxyz0123456789-.#~/")); + Add(new cOsdItem(tr("\tImagetypes"))); + Add(new cMenuEditBoolItem(tr("\tView free DiskSpace"), &data.ViewFreeDiskSpace)); + Add(new cOsdItem("------------------------------------------------------------------------------------------")); + item = Last(); + item->SetSelectable(false); + } + + Add(new cMenuEditCatItem(tr("Display Settings"), ViewDisplay)); + ViewDisplayPos = Count() - 1; + if(ViewDisplay) + { + Add(new cMenuEditStraItem(tr("\tDisplay Mode"), &data.DisplayMode, data.MaxDModes, data.DModes)); + if(data.DisplayMode == 1) + Add(new cMenuEditStraItem(tr("\t Category Type"), &data.CategorieType, data.MaxCTypes, data.CTypes)); + if(data.DisplayMode > 0) + Add(new cMenuEditBoolItem(tr("\t invisible empty Dir's/Cat."), &data.HideEmptyDirs)); + Add(new cMenuEditStraItem(tr("\tAlphabetic Sort"), &data.SortMode, data.MaxSModes, data.SModes)); + Add(new cMenuEditBoolItem(tr("\tvisible DVD-Drive"), &data.DisplayDVDDevice)); + Add(new cOsdItem("------------------------------------------------------------------------------------------")); + item = Last(); + item->SetSelectable(false); + } + + Add(new cMenuEditCatItem(tr("Special Display Settings"), ViewSpecialDisplay)); + ViewSpecialDisplayPos = Count() - 1; + if(ViewSpecialDisplay) + { + Add(new cMenuEditBoolItem(tr("\tvisible Image-Type Col"), &data.HideTypeCol)); + if(data.HideTypeCol) + Add(new cMenuEditIntItem(tr("\t Width for Image-Col"), &data.CountTypCol, 10, 50)); + Add(new cMenuEditBoolItem(tr("\tvisible Image-Size Col"), &data.HideImgSizeCol)); + Add(new cMenuEditStrItem(tr("\tchange Character"), + data.ChangeCharsOSDName, + 20, + " abcdefghijklmnopqrstuvwxyz0123456789-_+*&.#~%$")); + if(data.DisplayMode == 1) + { + //if(data.CategorieType == 0) + // Add(new cMenuEditBoolItem(tr("\tISO Images first"), &data.ISOFirst)); + Add(new cMenuEditChrItem(tr("\tchar for Cat.Line"), + &data.CatLineChar, + data.CatLineChars)); + Add(new cMenuEditIntItem(tr("\t Count before Cat.Name"), &data.CharCountBeforeCat, 0, 30)); + Add(new cMenuEditBoolItem(tr("\tSpaces before/after Cat.Name"), &data.SpacesBeforeAfterCat)); + if(data.CategorieType == 1) + Add(new cMenuEditStrItem(tr("\tCutText for Subcat"), + data.SubCatCutter, + 6, + "-_.:#+*!%<>")); + } + Add(new cOsdItem("------------------------------------------------------------------------------------------")); + item = Last(); + item->SetSelectable(false); + } + + if(data.DisplayMode == 1) + { + Add(new cMenuEditCatItem(tr("Navigation"), ViewNav)); + ViewNavPos = Count() - 1; + if(ViewNav) + { + Add(new cMenuEditBoolItem(tr("\tCat.Jump by Left/Right"), &data.JumpCatByKey)); + Add(new cOsdItem("------------------------------------------------------------------------------------------")); + item = Last(); + item->SetSelectable(false); + } + } + + Add(new cMenuEditCatItem(tr("Key allocation"), ViewKey)); + ViewKeyPos = Count() - 1; + if(ViewKey) + { + Add(new cMenuEditStraItem(tr("\tKey 1"), &data.k1, data.MaxCommands, data.Commands)); + Add(new cMenuEditStraItem(tr("\tKey 2"), &data.k2, data.MaxCommands, data.Commands)); + Add(new cMenuEditStraItem(tr("\tKey 3"), &data.k3, data.MaxCommands, data.Commands)); + Add(new cMenuEditStraItem(tr("\tKey 4"), &data.k4, data.MaxCommands, data.Commands)); + Add(new cMenuEditStraItem(tr("\tKey 5"), &data.k5, data.MaxCommands, data.Commands)); + Add(new cMenuEditStraItem(tr("\tKey 6"), &data.k6, data.MaxCommands, data.Commands)); + Add(new cMenuEditStraItem(tr("\tKey 7"), &data.k7, data.MaxCommands, data.Commands)); + Add(new cMenuEditStraItem(tr("\tKey 8"), &data.k8, data.MaxCommands, data.Commands)); + Add(new cMenuEditStraItem(tr("\tKey 9"), &data.k9, data.MaxCommands, data.Commands)); + Add(new cMenuEditStraItem(tr("\tKey 0"), &data.k0, data.MaxCommands, data.Commands)); + Add(new cMenuEditStraItem(tr("\tKey Red"), &data.kRed, data.MaxCommands, data.Commands)); + Add(new cMenuEditStraItem(tr("\tKey Green"), &data.kGreen, data.MaxCommands, data.Commands)); + Add(new cMenuEditStraItem(tr("\tKey Yellow"), &data.kYellow, data.MaxCommands, data.Commands)); + Add(new cMenuEditStraItem(tr("\tKey Blue"), &data.kBlue, data.MaxCommands, data.Commands)); + Add(new cMenuEditStraItem(tr("\tKey OK"), &data.kOk, data.MaxCommands, data.Commands)); + } + + SetCurrent(Get(current)); + Display(); +} + +eOSState cMenuSetupDVDSwitch::ProcessKey(eKeys Key) +{ + eOSState state = osContinue; + + if(!HasSubMenu()) + { + const char *ItemText = Get(Current())->Text(); + + switch(Key) + { + case kRight: + case kLeft: + if(Current() == ViewGenericPos || + Current() == ViewDisplayPos || + Current() == ViewSpecialDisplayPos || + Current() == ViewNavPos || + Current() == ViewKeyPos) + { + if(Current() == ViewGenericPos) + { + if((Key == kRight && !ViewGeneric) || + (Key == kLeft && ViewGeneric)) + ViewGeneric = !ViewGeneric; + } + else if(Current() == ViewDisplayPos) + { + if((Key == kRight && !ViewDisplay) || + (Key == kLeft && ViewDisplay)) + ViewDisplay = !ViewDisplay; + } + else if(Current() == ViewSpecialDisplayPos) + { + if((Key == kRight && !ViewSpecialDisplay) || + (Key == kLeft && ViewSpecialDisplay)) + ViewSpecialDisplay = !ViewSpecialDisplay; + } + else if(Current() == ViewNavPos) + { + if((Key == kRight && !ViewNav) || + (Key == kLeft && ViewNav)) + ViewNav = !ViewNav; + } + else if(Current() == ViewKeyPos) + { + if((Key == kRight && !ViewKey) || + (Key == kLeft && ViewKey)) + ViewKey = !ViewKey; + } + Set(); + Display(); + return osContinue; + } + else + { + int tmpHideMenuEntry = data.HideMenuEntry; + int tmpDisplayMode = data.DisplayMode; + int tmpCategorieType = data.CategorieType; + int tmpHideTypeCol = data.HideTypeCol; + + eOSState state = cMenuSetupPage::ProcessKey(Key); + + if (tmpHideMenuEntry != data.HideMenuEntry || + tmpDisplayMode != data.DisplayMode || + tmpCategorieType != data.CategorieType || + tmpHideTypeCol != data.HideTypeCol) + { + Set(); + Display(); + } + + return state; + } + break; + case kUp: + case kUp|k_Repeat: + case kDown: + case kDown|k_Repeat: + state = cMenuSetupPage::ProcessKey(Key); + ItemText = Get(Current())->Text(); + + if(strstr(ItemText, tr("\tImagetypes")) == ItemText) + cOsdMenu::SetHelp(NULL, NULL, NULL, tr("to adjust")); + else + cOsdMenu::SetHelp(NULL, NULL, NULL, NULL); + break; + case kBlue: + if(strstr(ItemText, tr("\tImagetypes")) == ItemText) + return AddSubMenu(new cMenuSetupDSITypes()); + break; + default: + state = cMenuSetupPage::ProcessKey(Key); + break; + } + } + else + state = cMenuSetupPage::ProcessKey(Key); + + return state; +} + +void cMenuSetupDVDSwitch::Store(void) +{ + DEBUG("STORE Setup"); + + DEBUG("SWITCH data"); + DVDSwitchSetup = data; + + SetupStore("HideMenuEntry", DVDSwitchSetup.HideMenuEntry); + SetupStore("MenuName", DVDSwitchSetup.MenuName); + if(!DVDSwitchSetup.ImageDirPerParam) + SetupStore("ImageDir", DVDSwitchSetup.ImageDir); + SetupStore("ViewFreeDiskSpace", DVDSwitchSetup.ViewFreeDiskSpace); + + SetupStore("DisplayMode", DVDSwitchSetup.DisplayMode); + SetupStore("CategorieType", DVDSwitchSetup.CategorieType); + SetupStore("HideEmptyDirs", DVDSwitchSetup.HideEmptyDirs); + SetupStore("SortMode", DVDSwitchSetup.SortMode); + SetupStore("DisplayDVDDevice", DVDSwitchSetup.DisplayDVDDevice); + + SetupStore("HideTypeCol", DVDSwitchSetup.HideTypeCol); + SetupStore("CountTypCol", DVDSwitchSetup.CountTypCol); + SetupStore("HideImgSizeCol", DVDSwitchSetup.HideImgSizeCol); + SetupStore("CatLineChar", DVDSwitchSetup.CatLineChar); + SetupStore("CharCountBeforeCat", DVDSwitchSetup.CharCountBeforeCat); + SetupStore("SpacesBeforeAfterCat", DVDSwitchSetup.SpacesBeforeAfterCat); + SetupStore("SubCatCutter", DVDSwitchSetup.SubCatCutter); + SetupStore("ChangeCharsOSDName", DVDSwitchSetup.ChangeCharsOSDName); + + SetupStore("JumpCatByKey", DVDSwitchSetup.JumpCatByKey); + + SetupStore("k1", DVDSwitchSetup.k1); + SetupStore("k2", DVDSwitchSetup.k2); + SetupStore("k3", DVDSwitchSetup.k3); + SetupStore("k4", DVDSwitchSetup.k4); + SetupStore("k5", DVDSwitchSetup.k5); + SetupStore("k6", DVDSwitchSetup.k6); + SetupStore("k7", DVDSwitchSetup.k7); + SetupStore("k8", DVDSwitchSetup.k8); + SetupStore("k9", DVDSwitchSetup.k9); + SetupStore("k0", DVDSwitchSetup.k0); + SetupStore("kRed", DVDSwitchSetup.kRed); + SetupStore("kGreen", DVDSwitchSetup.kGreen); + SetupStore("kYellow", DVDSwitchSetup.kYellow); + SetupStore("kBlue", DVDSwitchSetup.kBlue); + SetupStore("kOk", DVDSwitchSetup.kOk); + + DVDSwitchSetup.Debug(); +} + +// --- cMenuEditCatItem ------------------------------------------------------ + +cMenuEditCatItem::cMenuEditCatItem(const char *name, bool view) +{ + Name = (char*) malloc(120); + if(view) + strcpy(Name, "-\t"); + else + strcpy(Name, "+\t"); + strcat(Name, name); + //strcat(Name, " "); + //StrRepeat("_", (119 - strlen(Name)), Name); + SetText(Name); +} + +cMenuEditCatItem::~cMenuEditCatItem(void) +{ + free(Name); +} diff --git a/setup.h b/setup.h new file mode 100644 index 0000000..d089a08 --- /dev/null +++ b/setup.h @@ -0,0 +1,114 @@ +#ifndef __SETUP_DVDSWITCH_H +#define __SETUP_DVDSWITCH_H + +#include + +class cDVDSwitchSetup +{ + public: + int HideMenuEntry; + char MenuName[50]; + bool CustomMenuName; + char ImageDir[MaxFileName]; + bool ImageDirPerParam; + int ViewFreeDiskSpace; + + int MaxDModes; + const char *DModes[10]; + int DisplayMode; + int MaxCTypes; + const char *CTypes[10]; + int CategorieType; + int HideEmptyDirs; + int MaxSModes; + const char *SModes[10]; + int SortMode; + int DisplayDVDDevice; + + int HideTypeCol; + int CountTypCol; + int HideImgSizeCol; + char CatLineChar; + char *CatLineChars; + int CharCountBeforeCat; + int SpacesBeforeAfterCat; + char SubCatCutter[7]; + char ChangeCharsOSDName[20]; + + int JumpCatByKey; + + char ConfigDirectory[MaxFileName]; + bool DVDPluginExist; + char DVDLink[MaxFileName]; + char DVDLinkOrg[MaxFileName]; + char DVDReadScript[MaxFileName]; + char DVDWriteScript[MaxFileName]; + + int MaxCommands; + const char *Commands[15]; + const char *CommandsShortName[15]; + int k1; + int k2; + int k3; + int k4; + int k5; + int k6; + int k7; + int k8; + int k9; + int k0; + int kRed; + int kGreen; + int kYellow; + int kBlue; + int kOk; + + cDVDSwitchSetup(void); + ~cDVDSwitchSetup(void); + void Init(void); + bool SetupParse(const char *Name, const char *Value); + void Debug(void); + + void SetConfDir(char *value) + { + strcpy(ConfigDirectory, value); + strcpy(DVDLink, ConfigDirectory); + strcat(DVDLink, "/dvdlink"); + } + void SetDVDDevice(char *value) { strcpy(DVDLinkOrg, value); } +}; + +class cMenuSetupDVDSwitch : public cMenuSetupPage +{ + private: + cDVDSwitchSetup data; + bool ViewGeneric; + int ViewGenericPos; + bool ViewDisplay; + int ViewDisplayPos; + bool ViewSpecialDisplay; + int ViewSpecialDisplayPos; + bool ViewNav; + int ViewNavPos; + bool ViewKey; + int ViewKeyPos; + protected: + void Set(void); + virtual void Store(void); + virtual eOSState ProcessKey(eKeys Key); + public: + cMenuSetupDVDSwitch(void); +}; + +class cMenuEditCatItem : public cOsdItem +{ + private: + char *Name; + public: + cMenuEditCatItem(const char *name, bool view = false); + ~cMenuEditCatItem(void); +}; + +extern cDVDSwitchSetup DVDSwitchSetup; + +#endif // __SETUP_DVDSWITCH_H diff --git a/tools.c b/tools.c new file mode 100644 index 0000000..35ca8e2 --- /dev/null +++ b/tools.c @@ -0,0 +1,27 @@ +#include "tools.h" +#include "imagelist.h" +#include "setup.h" + +cDirList::cDirList(void) +{ + char *buffer = NULL; + + OptExclude("^lost\\+found$"); // lost+found Dir + OptExclude("^\\."); // hidden Files + OptExclude("\\.sdel$"); // del Files + OptExclude("\\.smove$"); // move Files + + cTokenizer *token = new cTokenizer(ImageList.GetDirContains(), "@"); + for(int i = 1; i <= token->Count(); i++) + { + asprintf(&buffer, "^%s$", token->GetToken(i)); + OptExclude(buffer); + FREENULL(buffer); + } + + OptSort((eFileList)DVDSwitchSetup.SortMode); + OptFilterType(tDir); + + delete(token); +} + diff --git a/tools.h b/tools.h new file mode 100644 index 0000000..d81eb02 --- /dev/null +++ b/tools.h @@ -0,0 +1,122 @@ +#ifndef __TOOLS_DVDSWITCH_H +#define __TOOLS_DVDSWITCH_H + +#include "helpers.h" + +class cDirList : public cFileList +{ + public: + cDirList(void); +}; + +class cFileDelThread : public cThread +{ + private: + char *File; + bool Ok; + + bool RightCheck(char *value) + { + bool ret = false; + if(value) + { + cFileInfo *info = new cFileInfo(value); + ret = info->isWriteable(); + DELETENULL(info); + } + return ret; + } + protected: + virtual void Action(void) + { + if(File) + cFileCMD::Del(File); + delete(this); + }; + public: + cFileDelThread(char *file) + { + File = NULL; + Ok = false; + + if(!RightCheck(file)) + OSD_ERRMSG(tr("no Rights to delete")); + else + { + Ok = true; + if(file) + { + asprintf(&File, "%s.sdel", file); + cFileCMD::Rn(file, File); + } + } + } + ~cFileDelThread(void) { free(File); } + bool OK(void) { return Ok; }; +}; + +class cFileMoveThread : public cThread +{ + private: + char *FileName; + char *File; + char *Dest; + bool Ok; + + bool RightCheck(char *value) + { + bool ret = false; + if(value) + { + cFileInfo *info = new cFileInfo(value); + ret = info->isWriteable(); + DELETENULL(info); + } + return ret; + } + protected: + virtual void Action(void) + { + if(FileName && File && Dest) + { + char *buffer = NULL; + asprintf(&buffer, "%s/%s", Dest, FileName); + cFileCMD::Rn(File, buffer); + free(buffer); + } + delete(this); + }; + public: + cFileMoveThread(char *file, char *dest) + { + FileName = NULL; + File = NULL; + Dest = NULL; + Ok = false; + + if(!RightCheck(file) || !RightCheck(dest)) + OSD_ERRMSG(tr("no Rights to move")); + else + { + Ok = true; + if(file) + { + cFileInfo *info = new cFileInfo(file); + FileName = strdup(info->FileName()); + DELETENULL(info); + asprintf(&File, "%s.smove", file); + cFileCMD::Rn(file, File); + } + Dest = dest ? strdup(dest) : NULL; + } + } + ~cFileMoveThread(void) + { + free(FileName); + free(File); + free(Dest); + } + bool OK(void) { return Ok; }; +}; + +#endif // __TOOLS_DVDSWITCH_H -- cgit v1.2.3