commit 2e77c0b4ce1781d87a532022d8ebaccff0fb2b17 Author: tpearson Date: Tue Jul 5 19:32:49 2011 +0000 Added kstreamripper git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kstreamripper@1239912 283d02a7-25f6-0310-bc7c-ecb5cbfe19da diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..d67550f --- /dev/null +++ b/AUTHORS @@ -0,0 +1,2 @@ +Michael Goettsche +William Entriken 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/ChangeLog b/ChangeLog new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/ChangeLog @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Doxyfile b/Doxyfile new file mode 100644 index 0000000..23a9436 --- /dev/null +++ b/Doxyfile @@ -0,0 +1,234 @@ +# Doxyfile 1.3.3-Gideon + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = kstreamripper.kdevelop +PROJECT_NUMBER = 0.1 +OUTPUT_DIRECTORY = +OUTPUT_LANGUAGE = English +USE_WINDOWS_ENCODING = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +DISTRIBUTE_GROUP_DOC = NO +TAB_SIZE = 8 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +SUBGROUPING = YES +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = NO +EXTRACT_PRIVATE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = /home/tuxipuxi/Documents/cpp/kde/kstreamripper +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.idl \ + *.odl \ + *.cs \ + *.php \ + *.php3 \ + *.inc \ + *.C \ + *.H \ + *.tlh \ + *.diff \ + *.patch \ + *.moc \ + *.xpm \ + *.dox +RECURSIVE = yes +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = NO +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = NO +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = YES +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = yes +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 1000 +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..8416e76 --- /dev/null +++ b/INSTALL @@ -0,0 +1,84 @@ +sctest REQUIREMENTS +------------------------ + +kde >= 3.2 is needed to run sctest + +To compile sctest, the kde development packages +are needed: kdelibs-devel, kdebase-devel and python + +scons is also needed http://www.scons.org +(this tool also used by Blender, ..) +Make sure scons is at least v0.96.1, otherwise +the compilation will fail. In case if you do not have +it, a minimum distribution is provided (see SCONS below) + +-> One should only have to run : +$ scons +# scons install +(do "scons install" as root - the menus may not +show up if you skip this step) + + +SCONS +----- + +-> If scons is missing, use the one bundled with PROGRAMNAME : +./unpack_local_scons.sh +python scons.py +python scons.py install +(run the last command as root) + + +-> For your convenience, a quick makefile is created : +./unpack_local_scons.sh +make +make install + + +USEFUL SCONS COMMANDS +--------------------- + +build the targets : scons +install them : scons install +clean the project : scons -c +uninstall : scons -c install +build in parallel : scons -j2 + +CONFIGURATION NOTES +------------------- + +The installation scripts are relying on the kde-config program. +The programs kde-config, qmake, uic and moc must be accesssible +through your PATH. + +Qt and kde may not be installed as expected (in QTDIR and KDEDIR) +So until kde-config is able to give that information, you may +have to give those paths. + +Here are some examples : +On Fedora/Redhat + scons configure kdeincludes=/usr/include/kde/ +On Debian + scons configure qtincludes=/usr/include/qt/ kdeinclude=/usr/include/kde/ +To install in some particular location with additional include paths + scons configure prefix=~/tmp extraincludes=/tmp/include:/usr/local/include + +For more options to tune the build look at the .py files available on +the top-level directory : +generic.py, kde.py, ... + +The build system is based on bksys, a build system that replaces +autoconf, automake and make in a row. Feel free to report your opinion +about it to the authors. + +BUILDING RPMS OR DEBS WITH CHECKINSTALL +--------------------------------------- + +With checkinstall 1.6, use +$ scons +# checkinstall --fstrans=no --nodoc scons install +# scons uninstall + +--------------------------------------- +enjoy KStreamRipper +Michael Goettsche diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8df7d48 --- /dev/null +++ b/Makefile @@ -0,0 +1,20 @@ +all: + @/usr/bin/scons -Q + +# it is also possible to use +# @/usr/bin/scons -Q -j4 + +install: + @/usr/bin/scons -Q install + +clean: + @/usr/bin/scons -Q -c + +uninstall: + @/usr/bin/scons -Q -c install + +dist: + @/usr/bin/scons -Q dist + +distclean: + @/usr/bin/scons -Q distclean diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/NEWS @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/README b/README new file mode 100644 index 0000000..638915f --- /dev/null +++ b/README @@ -0,0 +1 @@ +see INSTALL diff --git a/SConstruct b/SConstruct new file mode 100644 index 0000000..128317b --- /dev/null +++ b/SConstruct @@ -0,0 +1,234 @@ +#! /usr/bin/env python +## The kde detection is located in kde.py (have a look!) +## Delete the comments following as you see it fit + +""" +scons files are python scripts, comments begin by a "#" symbol +or are enclosed between sequences of triple quotes, so +this is a comment :) + +There is a lot of documentation and comments, but you can +remove them when you convert your program +""" + +""" +---------------------------------- +How to enjoy bksys full and plenty +(and forget about the autohell ? :) +----------------------------------- + +The program scons is usually launched as "scons" +When it is not intalled globally, one can run +"python scons.py" instead (ie : to use the local scons +that comes with bksys - try ./unpack_local_scons.sh) + +To compile the project, you will then only need to launch +scons on the top-level directory, the scripts find and +cache the proper environment automatically : +-> scons +(or python scons.py) + +To clean the project +-> scons -c +(or python scons.py -c) + +To install the project +-> scons install +(or python scons.py scons install) + +To uninstall the project +-> scons -c install + +To compile while being in a subdirectory +-> cd src; scons -u + +To (re)configure the project and give particular arguments, use ie : +-> scons configure debug=1 +-> scons configure prefix=/tmp/ita debug=full extraincludes=/usr/local/include:/tmp/include prefix=/usr/local +or -> python scons.py configure debug=1 +etc .. +The variables are saved automatically after the first run +(look at kde.cache.py, ..) + +Here is a quick list of options used (look at generic.py and kde.py) : +prefix +exec_prefix +datadir +libdir +kdeincludes +qtincludes +kdelibs +qtlibs +extraincludes (a list of paths separated by ':') + +""" + +########################################### +## Common section, for loading the tools + +## Load the builders in config +env = Environment(TARGS=COMMAND_LINE_TARGETS, ARGS=ARGUMENTS, tools=['default', 'generic', 'kde'], toolpath=['./', './admin']) +#env = Environment(TARGS=COMMAND_LINE_TARGETS, ARGS=ARGUMENTS, tools=['default', 'generic', 'kde', 'cg'], toolpath=['./']) +#env = Environment(TARGS=COMMAND_LINE_TARGETS, ARGS=ARGUMENTS, tools=['default', 'generic', 'kde', 'sound'], toolpath=['./']) +#env = Environment(TARGS=COMMAND_LINE_TARGETS, ARGS=ARGUMENTS, tools=['default', 'generic', 'kde', 'libxml'], toolpath=['./']) + +## the configuration should be done by now, quit +if 'configure' in COMMAND_LINE_TARGETS: + env.Exit(0) + +""" +Overview of the module system : + +Each module (kde.py, generic.py, sound.py..) tries to load a stored +configuration when run. If the stored configuration does not exist +or if 'configure' is given on the command line (scons configure), +the module launches the verifications and detectioins and stores +the results. Modules also call exit when the detection fail. + +For example, kde.py stores its config into kde.cache.py + +This has several advantages for both developers and users : + - Users do not have to run ./configure to compile + - The build is insensitive to environment changes + - The cache maintains the objects so the config can be changed often + - Each module adds its own help via env.Help("message") +""" + +## Use the variables available in the environment - unsafe, but moc, meinproc need it :-/ +import os +env.AppendUnique( ENV = os.environ ) + +## The target make dist requires the python module shutil which is in 2.3 +env.EnsurePythonVersion(2, 3) + +## Bksys requires scons 0.96 +env.EnsureSConsVersion(0, 96) + +""" +Explanation of the 'env = Environment...' line : +* the command line arguments and targets are stored in env['TARGS'] and env['ARGS'] for use by the tools +* the part 'tools=['default', 'generic ..' detect and load the necessary functions for doing the things +* the part "toolpath=['./']" tells that the tools can be found in the current directory (generic.py, kde.py ..) +""" + +""" +To load more configuration modules one should only have to add the appropriate tool +ie: to detect alsa and add the proper cflags, ldflags .. + a file alsa.py file will be needed, and one should then use : + env = Environment(TARGS=COMMAND_LINE_TARGETS, ARGS=ARGUMENTS, tools=['default', 'generic', 'kde', 'alsa'], toolpath=['./']) + +You can also load environments that are targetted to different platforms +ie: if os.sys.platform = "darwin": + env = Environment(... + elsif os.sys.platform = "linux": + env = Environment(... + +""" + +## Setup the cache directory - this avoids recompiling the same files over and over again +## this is very handy when working with cvs +env.CacheDir('cache') + +## Avoid spreading .sconsign files everywhere - keep this line +env.SConsignFile('scons_signatures') + +## If you need more libs and they rely on pkg-config +## ie: add support for GTK (source: the scons wiki on www.scons.org) +# env.ParseConfig('pkg-config --cflags --libs gtk+-2.0') + +""" +This tell scons that there are no rcs or sccs files - this trick +can speed up things a bit when having lots of #include +in the source code and for network file systems +""" +env.SourceCode(".", None) + +dirs = [ '.', 'src', 'po', 'doc'] + +for dir in dirs: + env.SourceCode(dir, None) + +## If we had only one program (named kvigor) to build, +## we could add before exporting the env (some kde +## helpers in kde.py need it) : +# env['APPNAME'] = 'kvigor' + +## Use this define if you are using the kde translation scheme (.po files) +env.Append( CPPFLAGS = ['-DQT_NO_TRANSLATION'] ) + +## Add this define if you want to use qthreads +#env.Append( CPPFLAGS = ['-DQT_THREAD_SUPPORT', '-D_REENTRANT'] ) + +## To use kdDebug(intvalue)<<"some trace"< + +from time import * +import SCons.Util +import string + +import os, re + +BOLD ="\033[1m" +RED ="\033[91m" +GREEN ="\033[92m" +YELLOW ="\033[1m" #"\033[93m" # unreadable on white backgrounds +CYAN ="\033[96m" +NORMAL ="\033[0m" + +# Returns the name of the shared object (i.e. libkdeui.so.4) +# referenced by a libtool archive (like libkdeui.la) +def getSOfromLA(lafile): + contents = open(lafile, 'r').read() + match = re.search("^dlname='([^']*)'$", contents, re.M) + if match: + return match.group(1) + return None + +def exists(env): + return True + +def detect_kde(env): + """ Detect the qt and kde environment using kde-config mostly """ + + prefix = env['ARGS'].get('prefix', None) + execprefix = env['ARGS'].get('execprefix', None) + datadir = env['ARGS'].get('datadir', None) + libdir = env['ARGS'].get('libdir', None) + kdeincludes= env['ARGS'].get('kdeincludes', None) + kdelibs = env['ARGS'].get('kdelibs', None) + qtincludes = env['ARGS'].get('qtincludes', None) + qtlibs = env['ARGS'].get('qtlibs', None) + + ## Detect the kde libraries + print "Checking for kde-config : ", + kde_config = os.popen("which kde-config 2>/dev/null").read().strip() + if len(kde_config): + print GREEN + "kde-config was found" + NORMAL + else: + print RED + "kde-config was NOT found in your PATH"+ NORMAL + print "Make sure kde is installed properly" + print "(missing package kdebase-devel?)" + env.Exit(1) + env['KDEDIR'] = os.popen('kde-config -prefix').read().strip() + + print "Checking for kde version : ", + kde_version = os.popen("kde-config --version|grep KDE").read().strip().split()[1] + if int(kde_version[0]) != 3 or int(kde_version[2]) < 2: + print RED + kde_version + print RED + "Your kde version can be too old" + NORMAL + print RED + "Please make sure kde is at least 3.2" + NORMAL + else: + print GREEN + kde_version + NORMAL + + ## Detect the qt library + print "Checking for the qt library : ", + qtdir = os.getenv("QTDIR") + if qtdir: + print GREEN + "qt is in " + qtdir + NORMAL + else: + libdir = os.popen('kde-config --expandvars --install lib').read().strip() + libkdeuiSO = libdir+'/'+getSOfromLA(libdir+'/libkdeui.la') + m = re.search('(.*)/lib/libqt.*', os.popen('ldd '+libkdeuiSO+' | grep libqt').read().strip().split()[2]) + if m: + qtdir = m.group(1) + print YELLOW+"qt was found as " + m.group(1) + NORMAL + else: + print RED+"qt was not found"+NORMAL + print RED+"Please set QTDIR first (/usr/lib/qt3?)"+NORMAL + env.Exit(1) + env['QTDIR'] = qtdir.strip() + + ## Find the necessary programs uic and moc + print "Checking for uic : ", + uic = qtdir + "/bin/uic" + if os.path.isfile(uic): + print GREEN+"uic was found as "+uic+NORMAL + else: + uic = os.popen("which uic 2>/dev/null").read().strip() + if len(uic): + print YELLOW+"uic was found as "+uic+NORMAL + else: + uic = os.popen("which uic 2>/dev/null").read().strip() + if len(uic): + print YELLOW+"uic was found as "+uic+NORMAL + else: + print RED+"uic was not found - set QTDIR put it in your PATH ?"+NORMAL + env.Exit(1) + env['QT_UIC'] = uic + + print "Checking for moc : ", + moc = qtdir + "/bin/moc" + if os.path.isfile(moc): + print GREEN+"moc was found as "+moc+NORMAL + else: + moc = os.popen("which moc 2>/dev/null").read().strip() + if len(moc): + print YELLOW+"moc was found as "+moc+NORMAL + elif os.path.isfile("/usr/share/qt3/bin/moc"): + moc = "/usr/share/qt3/bin/moc" + print YELLOW+"moc was found as "+moc+NORMAL + else: + print RED+"moc was not found - set QTDIR or put it in your PATH ?"+NORMAL + env.Exit(1) + env['QT_MOC'] = moc + + ## check for the qt and kde includes + print "Checking for the qt includes : ", + if qtincludes and os.path.isfile(qtincludes + "/qlayout.h"): + # The user told where to look for and it looks valid + print GREEN+"ok "+qtincludes+NORMAL + else: + if os.path.isfile(qtdir + "/include/qlayout.h"): + # Automatic detection + print GREEN+"ok "+qtdir + "/include/ "+NORMAL + qtincludes = qtdir + "/include/" + elif os.path.isfile("/usr/include/qt3/qlayout.h"): + # Debian probably + print YELLOW+"the qt headers were found in /usr/include/qt3/ "+NORMAL + qtincludes = "/usr/include/qt3" + else: + print RED+"the qt headers were not found"+NORMAL + env.Exit(1) + + print "Checking for the kde includes : ", + kdeprefix = os.popen("kde-config --prefix").read().strip() + if not kdeincludes: + kdeincludes = kdeprefix+"/include/" + if os.path.isfile(kdeincludes + "/klineedit.h"): + print GREEN+"ok "+kdeincludes+NORMAL + else: + if os.path.isfile(kdeprefix+"/include/kde/klineedit.h"): + # Debian, Fedora probably + print YELLOW+"the kde headers were found in "+kdeprefix+"/include/kde/"+NORMAL + kdeincludes = kdeprefix + "/include/kde/" + else: + print RED+"The kde includes were NOT found"+NORMAL + env.Exit(1) + + if prefix: + ## use the user-specified prefix + if not execprefix: + execprefix = prefix + if not datadir: + datadir = prefix+"/share" + if not libdir: + libdir = execprefix+"/lib" + + subst_vars = lambda x: x.replace('${exec_prefix}',execprefix).replace('${datadir}',datadir).replace('${libdir}',libdir) + env['KDEBIN'] = subst_vars(os.popen('kde-config --install exe').read().strip()) + env['KDEAPPS'] = subst_vars(os.popen('kde-config --install apps').read().strip()) + env['KDEDATA'] = subst_vars(os.popen('kde-config --install data').read().strip()) + env['KDEMODULE']= subst_vars(os.popen('kde-config --install module').read().strip()) + env['KDELOCALE']= subst_vars(os.popen('kde-config --install locale').read().strip()) + env['KDEDOC'] = subst_vars(os.popen('kde-config --install html').read().strip()) + env['KDEKCFG'] = subst_vars(os.popen('kde-config --install kcfg').read().strip()) + env['KDEXDG'] = subst_vars(os.popen('kde-config --install xdgdata-apps').read().strip()) + env['KDEMENU'] = subst_vars(os.popen('kde-config --install apps').read().strip()) + env['KDEMIME'] = subst_vars(os.popen('kde-config --install mime').read().strip()) + env['KDEICONS'] = subst_vars(os.popen('kde-config --install icon').read().strip()) + env['KDESERV'] = subst_vars(os.popen('kde-config --install services').read().strip()) + else: + # the user has given no prefix, install as a normal kde app + env['PREFIX'] = os.popen('kde-config --prefix').read().strip() + env['KDEBIN'] = os.popen('kde-config --expandvars --install exe').read().strip() + env['KDEAPPS'] = os.popen('kde-config --expandvars --install apps').read().strip() + env['KDEDATA'] = os.popen('kde-config --expandvars --install data').read().strip() + env['KDEMODULE']= os.popen('kde-config --expandvars --install module').read().strip() + env['KDELOCALE']= os.popen('kde-config --expandvars --install locale').read().strip() + env['KDEDOC'] = os.popen('kde-config --expandvars --install html').read().strip() + env['KDEKCFG'] = os.popen('kde-config --expandvars --install kcfg').read().strip() + env['KDEXDG'] = os.popen('kde-config --expandvars --install xdgdata-apps').read().strip() + env['KDEMENU'] = os.popen('kde-config --expandvars --install apps').read().strip() + env['KDEMIME'] = os.popen('kde-config --expandvars --install mime').read().strip() + env['KDEICONS'] = os.popen('kde-config --expandvars --install icon').read().strip() + env['KDESERV'] = os.popen('kde-config --expandvars --install services').read().strip() + + env['QTPLUGINS']=os.popen('kde-config --expandvars --install qtplugins').read().strip() + + ## kde libs and includes + env['KDEINCLUDEPATH']= kdeincludes + if not kdelibs: + kdelibs = os.popen('kde-config --expandvars --install lib').read().strip() + env['KDELIBPATH']= kdelibs + + ## qt libs and includes + env['QTINCLUDEPATH']= qtincludes + if not qtlibs: + qtlibs = qtdir+"/lib" + env['QTLIBPATH']= qtlibs + +def mocscan(target, source, env): + splitext = SCons.Util.splitext + + q_object_search = re.compile(r'[^A-Za-z0-9]Q_OBJECT[^A-Za-z0-9]') + + for obj in source: + + if not obj.has_builder(): + # binary obj file provided + continue + + cpp = obj.sources[0] + if not splitext(str(cpp))[1] == '.cpp': + # not a cplusplus source + continue + + # if we have a .ui file, it is automatically handled by Uic + uiname = string.split(cpp.abspath, '.cpp')[0] + ".ui" + if os.path.isfile(uiname): + continue + + hname = splitext(cpp.name)[0] + ".h" + h = SCons.Node.FS.find_file(hname, (cpp.get_dir(),) ) + + if h: + # h file with the Q_OBJECT macro found -> add .moc file + mocfile = string.split(cpp.abspath, '.cpp')[0] + ".moc" + # trick : check if the moc file already exists (avoid a scan) + if os.path.isfile(mocfile): + env.Moc(h) + elif q_object_search.search(h.get_contents()): + # FIXME : strong assumption + env.Moc(h) + + return (target, source) + +def generate(env): + + import SCons.Defaults + import SCons.Tool + env.Help(""" +"""+BOLD+ +"""*** KDE options *** +-------------------"""+NORMAL+""" +"""+BOLD+"""* prefix """+NORMAL+""": base install path, ie: /usr/local +"""+BOLD+"""* execprefix """+NORMAL+""": install path for binaries, ie: /usr/bin +"""+BOLD+"""* datadir """+NORMAL+""": install path for the data, ie: /usr/local/share +"""+BOLD+"""* libdir """+NORMAL+""": install path for the libs, ie: /usr/lib +"""+BOLD+"""* kdeincludes"""+NORMAL+""": path to the kde includes (/usr/include/kde on debian, ...) +"""+BOLD+"""* qtincludes """+NORMAL+""": same punishment, for qt includes (/usr/include/qt on debian, ...) +"""+BOLD+"""* kdelibs """+NORMAL+""": path to the kde libs, for linking the programs +"""+BOLD+"""* qtlibs """+NORMAL+""": same punishment, for qt libraries +ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt +"""+NORMAL) + + CLVar = SCons.Util.CLVar + splitext = SCons.Util.splitext + Builder = SCons.Builder.Builder + + # Detect the environment - replaces ./configure implicitely + # and store the options into a cache + from SCons.Options import Options + cachefile=env['CACHEDIR']+'/kde.cache.py' + opts = Options(cachefile) + opts.AddOptions( + ( 'QTDIR', 'root of qt directory' ), + ( 'QTLIBPATH', 'path to the qt libraries' ), + ( 'QTINCLUDEPATH', 'path to the qt includes' ), + ( 'QT_UIC', 'moc directory'), + ( 'QT_MOC', 'moc executable command'), + ( 'QTPLUGINS', 'uic executable command'), + ( 'KDEDIR', 'root of kde directory' ), + ( 'KDELIBPATH', 'path to the kde libs' ), + ( 'KDEINCLUDEPATH', 'path to the kde includes' ), + + ( 'PREFIX', 'root of the program installation'), + + ( 'KDEBIN', 'installation path of the kde binaries'), + ( 'KDEMODULE', 'installation path of the parts and libs'), + ( 'KDEAPPS', ''), + ( 'KDEDATA', 'installation path of the application data'), + ( 'KDELOCALE', ''), + ( 'KDEDOC', 'installation path of the application documentation'), + ( 'KDEKCFG', 'installation path of the .kcfg files'), + ( 'KDEXDG', 'installation path of the service types'), + ( 'KDEMENU', ''), + ( 'KDEMIME', 'installation path of to the mimetypes'), + ( 'KDEICONS', ''), + ( 'KDESERV', ''), + ) + opts.Update(env) + + # reconfigure when things are missing + if 'configure' in env['TARGS'] or not env.has_key('QTDIR') or not env.has_key('KDEDIR'): + detect_kde(env) + + # finally save the configuration + opts.Save(cachefile, env) + + ## set default variables, one can override them in sconscript files + env.Append(CXXFLAGS = ['-I'+env['KDEINCLUDEPATH'], '-I'+env['QTINCLUDEPATH'] ]) + env.Append(LIBPATH = [env['KDELIBPATH'], env['QTLIBPATH'] ]) + + env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 + + env['QT_AUTOSCAN'] = 1 + env['QT_DEBUG'] = 0 + + env['QT_UIC_HFLAGS'] = '-L $QTPLUGINS -nounload' + env['QT_UIC_CFLAGS'] = '$QT_UIC_HFLAGS -tr tr2i18n' + env['QT_LIBS'] = 'qt-mt' + + env['LIBTOOL_FLAGS'] = '--silent --mode=compile --tag=CXX' + + env['QT_UICIMPLPREFIX'] = '' + env['QT_UICIMPLSUFFIX'] = '.cpp' + env['QT_MOCHPREFIX'] = '' + env['QT_MOCHSUFFIX'] = '.moc' + env['KDE_KCFG_IMPLPREFIX'] = '' + env['KDE_KCFG_IMPL_HSUFFIX'] = '.h' + env['KDE_KCFG_IMPL_CSUFFIX'] = '.cpp' + env['KDE_SKEL_IMPL_SUFFIX'] = '.skel' + env['MEINPROC'] = 'meinproc' + env['MSGFMT'] = 'msgfmt' + + + ###### ui file processing + def uicGenerator(target, source, env, for_signature): + act=[] + act.append('$QT_UIC $QT_UIC_HFLAGS -o '+target[0].path+' '+source[0].path) + act.append('rm -f ' +target[1].path) + act.append('echo \'#include \' >> '+target[1].path) + act.append('echo \'#include \' >> '+target[1].path) + act.append('$QT_UIC $QT_UIC_CFLAGS -impl '+target[0].path+' -o '+target[1].path+'.tmp '+source[0].path) + act.append('cat '+target[1].path+'.tmp >> '+target[1].path) + act.append('rm -f '+target[1].path+'.tmp') + act.append('echo \'#include "' + target[2].name + '"\' >> '+target[1].path) + act.append('$QT_MOC -o '+target[2].path+' '+target[0].path) + return act + + def uicEmitter(target, source, env): + adjustixes = SCons.Util.adjustixes + bs = SCons.Util.splitext(str(source[0].name))[0] + bs = os.path.join(str(target[0].get_dir()),bs) + # first target is automatically added by builder (.h file) + if len(target) < 2: + # second target is .cpp file + target.append(adjustixes(bs, + env.subst('$QT_UICIMPLPREFIX'), + env.subst('$QT_UICIMPLSUFFIX'))) + if len(target) < 3: + # third target is .moc file + target.append(adjustixes(bs, + env.subst('$QT_MOCHPREFIX'), + env.subst('$QT_MOCHSUFFIX'))) + return target, source + + UIC_BUILDER = Builder( + generator = uicGenerator, + emitter = uicEmitter, + suffix = '.h', + src_suffix = '.ui' ) + + ###### moc file processing + env['QT_MOCCOM'] = ('$QT_MOC -o ${TARGETS[0]} $SOURCE') + + MOC_BUILDER = Builder( + action = '$QT_MOCCOM', + suffix = '.moc', + src_suffix = '.h' ) + + MOCCPP_BUILDER = Builder( + action = '$QT_MOCCOM', + suffix = '_moc.cpp', + src_suffix = '.h' ) + + ###### kcfg file processing + def kcfgGenerator(target, source, env, for_signature): + act=[] + act.append('kconfig_compiler -d'+str(source[0].get_dir())+' '+source[1].path+' '+source[0].path) + return act + + def kcfgEmitter(target, source, env): + adjustixes = SCons.Util.adjustixes + bs = SCons.Util.splitext(str(source[0].name))[0] + bs = os.path.join(str(target[0].get_dir()),bs) + # first target is automatically added by builder (.h file) + if len(target) < 2: + # second target is .cpp file + target.append(adjustixes(bs, env.subst('$KDE_KCFG_IMPLPREFIX'), env.subst('$KDE_KCFG_IMPL_CSUFFIX'))) + + if len(source) <2: + kcfgfilename = os.popen("cat "+str(source[0])+"|grep File|sed 's/File.*=//i'").read().rstrip() + source.append( str(source[0].get_dir())+'/'+kcfgfilename ) + return target, source + + KCFG_BUILDER = Builder( + generator = kcfgGenerator, + emitter = kcfgEmitter, + suffix = '.h', + src_suffix = '.kcfgc' ) + + ###### dcop processing + def dcopGenerator(target, source, env, for_signature): + act=[] + act.append('dcopidl '+source[0].path+' > '+target[1].path+'|| ( rm -f '+target[1].path+' ; false )') + act.append('dcopidl2cpp --c++-suffix cpp --no-signals --no-stub '+target[1].path) + return act + + def dcopEmitter(target, source, env): + bs = SCons.Util.splitext(str(source[0].name))[0] + bs = os.path.join(str(target[0].get_dir()),bs) + target.append(bs+'.kidl') + #target.append(bs+'_skel.cpp') + return target, source + + DCOP_BUILDER = Builder( + generator = dcopGenerator, + emitter = dcopEmitter, + suffix = '_skel.cpp', + src_suffix = '.h' ) + + ###### documentation (meinproc) processing + MEINPROC_BUILDER = Builder( + action = '$MEINPROC --check --cache $TARGET $SOURCE', + suffix = '.cache.bz2', + src_suffix = '.docbook' ) + + ###### translation files builder + TRANSFILES_BUILDER = Builder( + action = '$MSGFMT $SOURCE -o $TARGET', + suffix = '.gmo', + src_suffix = '.po' ) + + ###### libtool file builder + def laGenerator(target, source, env, for_signature): + act=[] + act.append('echo "dlname=\''+source[0].name+'\'" > '+target[0].path) + act.append('echo "library_names=\''+source[0].name+' '+source[0].name+' '+source[0].name+'\'" >> '+target[0].path) + act.append('echo "old_library=\'\'">> '+target[0].path) + act.append('echo "dependency_libs=\'\'">> '+target[0].path) + act.append('echo "current=0">> '+target[0].path) + act.append('echo "age=0">> '+target[0].path) + act.append('echo "revision=0">> '+target[0].path) + act.append('echo "installed=yes">> '+target[0].path) + act.append('echo "shouldnotlink=no">> '+target[0].path) + act.append('echo "dlopen=\'\'">> '+target[0].path) + act.append('echo "dlpreopen=\'\'">> '+target[0].path) + act.append('echo "libdir=\''+env['KDEMODULE']+'\'" >> '+target[0].path) + return act + + LA_BUILDER = Builder( + generator = laGenerator, + suffix = '.la', + src_suffix = '.so' ) + + ##### register the builders + env['BUILDERS']['Uic'] = UIC_BUILDER + env['BUILDERS']['Moc'] = MOC_BUILDER + env['BUILDERS']['Moccpp'] = MOCCPP_BUILDER + env['BUILDERS']['Dcop'] = DCOP_BUILDER + env['BUILDERS']['Kcfg'] = KCFG_BUILDER + env['BUILDERS']['LaFile'] = LA_BUILDER + env['BUILDERS']['Meinproc'] = MEINPROC_BUILDER + env['BUILDERS']['Transfiles'] = TRANSFILES_BUILDER + + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + static_obj.src_builder.append('Uic') + shared_obj.src_builder.append('Uic') + static_obj.src_builder.append('Kcfg') + shared_obj.src_builder.append('Kcfg') + static_obj.src_builder.append('LaFile') + shared_obj.src_builder.append('LaFile') + static_obj.src_builder.append('Meinproc') + shared_obj.src_builder.append('Meinproc') + static_obj.src_builder.append('Transfiles') + shared_obj.src_builder.append('Transfiles') + + ## find the files to moc, dcop, and link against kde and qt + env.AppendUnique(PROGEMITTER=[mocscan], SHLIBEMITTER=[mocscan], LIBEMITTER =[mocscan]) + + ########################################### + ## Handy helpers for building kde programs + ## You should not have to modify them .. + + #import SCons.Util + skel_ext = [".skel", ".SKEL"] + def KDEfiles(lenv, target, source): + """ Returns a list of files for scons (handles kde tricks like .skel) + It also makes custom checks against double includes like : ['file.ui', 'file.cpp'] + (file.cpp is already included because of file.ui) """ + + src=[] + ui_files=[] + kcfg_files=[] + skel_files=[] + other_files=[] + + # For each file, check wether it is a dcop file or not, and create the complete list of sources + for file in source: + bs = SCons.Util.splitext(file)[0] + ext = SCons.Util.splitext(file)[1] + if ext in skel_ext: + lenv.Dcop(bs+'.h') + src.append(bs+'_skel.cpp') + elif ext == ".moch": + lenv.Moccpp(bs+'.h') + src.append(bs+'_moc.cpp') + else: + src.append(file) + + if ext == '.ui': + ui_files.append(bs) + elif ext == '.kcfgc': + kcfg_files.append(bs) + elif ext == '.skel': + skel_files.append(bs) + else: + other_files.append(bs) + return src + + """ + In the future, these functions will contain the code that will dump the + configuration for re-use from an IDE + """ + import glob + def KDEinstall(lenv, restype, subdir, files): + if not 'install' in env['TARGS']: + return + basedir=env['DESTDIR'] + if len(restype)>0: + if not lenv.has_key(restype): + print RED+"unknown resource type "+restype+NORMAL + else: + basedir += lenv[restype]+'/' + #print file # <- useful to trace stuff :) + install_list = env.Install(basedir+subdir, files) + env.Alias('install', install_list) + return install_list + + def KDEinstallas(lenv, restype, destfile, file): + if not 'install' in env['TARGS']: + return + basedir=env['DESTDIR'] + if len(restype)>0: + if not lenv.has_key(restype): + print RED+"unknown resource type "+restype+NORMAL + else: + basedir += lenv[restype]+'/' + install_list = env.InstallAs(basedir+destfile, file) + env.Alias('install', install_list) + return install_list + + def KDEprogram(lenv, target, source): + """ Makes a kde program + The program is installed except if one sets env['NOAUTOINSTALL'] """ + src = KDEfiles(lenv, target, source) + program_list = lenv.Program(target, src) + if not lenv.has_key('NOAUTOINSTALL'): + KDEinstall(lenv, 'KDEBIN', '', target) + return program_list + + def KDEshlib(lenv, target, source, kdelib=0): + """ Makes a shared library for kde (.la file for klibloader) + The library is installed except if one sets env['NOAUTOINSTALL'] """ + src = KDEfiles(lenv, target, source) + library_list = lenv.SharedLibrary(target, src) + lafile_list = lenv.LaFile(target, library_list) + if not lenv.has_key('NOAUTOINSTALL'): + install_dir = 'KDEMODULE' + if kdelib==1: + install_dir = 'KDELIBPATH' + KDEinstall(lenv, install_dir, '', library_list) + KDEinstall(lenv, install_dir, '', lafile_list) + return library_list + + def KDEstaticlib(lenv, target, source): + """ Makes a static library for kde - in practice you should not use static libraries + 1. they take more memory than shared ones + 2. makefile.am needed it because of limitations + (cannot handle sources in separate folders - takes extra processing) """ + src = KDEfiles(lenv, target, source) + return lenv.StaticLibrary(target, src) + # do not install static libraries by default + + def KDEaddflags_cxx(lenv, fl): + """ Compilation flags for C++ programs """ + lenv.AppendUnique(CXXFLAGS = fl) + + def KDEaddflags_c(lenv, fl): + """ Compilation flags for C programs """ + lenv.AppendUnique(CFLAGS = fl) + + def KDEaddflags_link(lenv, fl): + """ Add link flags - Use this if KDEaddlibs below is not enough """ + lenv.AppendUnique(LINKFLAGS = fl) + + def KDEaddlibs(lenv, libs): + """ Helper function """ + lenv.AppendUnique(LIBS = libs) + + def KDEaddpaths_includes(lenv, paths): + """ Add new include paths """ + lenv.AppendUnique(CPPPATH = paths) + + def KDEaddpaths_libs(lenv, paths): + """ Add paths to libraries """ + lenv.AppendUnique(LIBPATH = paths) + + def KDElang(lenv, folder, appname): + """ Process translations (.po files) in a po/ dir """ + transfiles = glob.glob(folder+'/*.po') + for lang in transfiles: + result = lenv.Transfiles(lang) + country = SCons.Util.splitext(result[0].name)[0] + KDEinstallas(lenv, 'KDELOCALE', country+'/LC_MESSAGES/'+appname+'.mo', result) + + def KDEicon(lenv, icname): + """ Emulates the behaviour of Makefile.am to install icons + Contributed by: "Andrey Golovizin" """ + type_dic = { 'action' : 'actions', 'app' : 'apps', 'device' : + 'devices', 'filesys' : 'filesystems', 'mime' : 'mimetypes' } + dir_dic = { + 'los' :'locolor/16x16', + 'lom' :'locolor/32x32', + 'him' :'hicolor/32x32', + 'hil' :'hicolor/48x48', + 'lo16' :'locolor/16x16', + 'lo22' :'locolor/22x22', + 'lo32' :'locolor/32x32', + 'hi16' :'hicolor/16x16', + 'hi22' :'hicolor/22x22', + 'hi32' :'hicolor/32x32', + 'hi48' :'hicolor/48x48', + 'hi64' :'hicolor/64x64', + 'hi128':'hicolor/128x128', + 'hisc' :'hicolor/scalable', + 'cr16' :'crystalsvg/16x16', + 'cr22' :'crystalsvg/22x22', + 'cr32' :'crystalsvg/32x32', + 'cr48' :'crystalsvg/48x48', + 'cr64' :'crystalsvg/64x64', + 'cr128':'crystalsvg/128x128', + 'crsc' :'crystalsvg/scalable' + } + + import glob + iconfiles = [] + for ext in ['png', 'xpm', 'mng', 'svg', 'svgz']: + files = glob.glob('*-*-%s.%s' % (icname, ext)) + iconfiles += files + for iconfile in iconfiles: + tmp = iconfile.split('-') + if len(tmp) != 3: + print RED + 'WARNING: icon filename has unknown format: ' + iconfile + NORMAL + continue + [icon_dir, icon_type, icon_filename] = tmp + try: + destfile = '%s/%s/%s/%s' % (lenv['KDEICONS'], dir_dic[icon_dir], type_dic[icon_type], icon_filename) + except KeyError: + print RED + 'WARNING: unknown icon type: ' + iconfile + NORMAL + continue + ## do not use KDEinstallas here, as parsing from an ide will be necessary + if 'install' in env['TARGS']: + env.Alias('install', env.InstallAs( env['DESTDIR']+'/'+destfile, iconfile ) ) + + # Attach the functions to the environment so that sconscripts can use them + from SCons.Script.SConscript import SConsEnvironment + SConsEnvironment.KDEprogram = KDEprogram + SConsEnvironment.KDEshlib = KDEshlib + SConsEnvironment.KDEstaticlib = KDEstaticlib + SConsEnvironment.KDEinstall = KDEinstall + SConsEnvironment.KDEinstallas = KDEinstallas + SConsEnvironment.KDElang = KDElang + SConsEnvironment.KDEicon = KDEicon + + SConsEnvironment.KDEaddflags_cxx = KDEaddflags_cxx + SConsEnvironment.KDEaddflags_c = KDEaddflags_c + SConsEnvironment.KDEaddflags_link = KDEaddflags_link + SConsEnvironment.KDEaddlibs = KDEaddlibs + SConsEnvironment.KDEaddpaths_includes = KDEaddpaths_includes + SConsEnvironment.KDEaddpaths_libs = KDEaddpaths_libs diff --git a/doc/SConscript b/doc/SConscript new file mode 100644 index 0000000..c16dbb0 --- /dev/null +++ b/doc/SConscript @@ -0,0 +1,83 @@ +#! /usr/bin/env python +## This script demonstrates to build and install +## the documentation of a kde program with scons +## +## Thomas Nagy, 2005 + +## This file can be reused freely for any project (see COPYING) + +## First load the environment set in the top-level SConstruct file +Import( 'env' ) +myenv=env.Copy() + +## The following looks complicated but it is not +## We first define a function to install all files as documentation +## The documentation is of course lying in subfolders from here +## * normal files are installed under KDEDOC/destination +## * meinproc files are not installed, but processed into a single +## index.cache.bz2 which is installed afterwards + +## This is far more maintainable to have *one* file than +## having lots of almost empty SConscript in several folders + +import os +import sys +import glob +import SCons.Util + +## Define this to 1 if you are writing documentation else to 0 :) +i_am_a_documentation_writer = 0 + +## This function uses env imported above +def processfolder(folder, lang, destination=""): + # folder is the folder to process + # lang is the language + # destination is the subdirectory in KDEDOC + + docfiles = glob.glob(folder+"/???*.*") # file files that are at least 4 chars wide :) + + # warn about errors + #if len(lang) != 2: + # print "error, lang must be a two-letter string, like 'en'" + + # when the destination is not given, use the folder + if len(destination) == 0: + destination=folder + + docbook_list = [] + for file in docfiles: + + # do not process folders + if not os.path.isfile(file): + continue + # do not process the cache file + if file == 'index.cache.bz2': + continue + # ignore invalid files (TODO??) + if len( SCons.Util.splitext( file ) ) <= 1 : + continue + + ext = SCons.Util.splitext( file )[1] + + # docbook files are processed by meinproc + if ext == '.docbook': + docbook_list.append( file ) + continue + + myenv.KDEinstall('KDEDOC', lang+'/'+destination, file) + + # Now process the index.docbook files .. + if len(docbook_list) == 0: + return + if not os.path.isfile( folder+'index.docbook' ): + print "Error, index.docbook was not found in "+folder+'/index.docbook' + return + if i_am_a_documentation_writer: + for file in docbook_list: + myenv.Depends( folder+'index.cache.bz2', file ) + myenv.Meinproc( folder+'/index.cache.bz2', folder+'/index.docbook' ) + myenv.KDEinstall( 'KDEDOC', lang+'/'+destination, folder+'/index.cache.bz2' ) + +## Use processfolder for each documentation directory +processfolder('en/', 'en') + diff --git a/doc/en/index.docbook b/doc/en/index.docbook new file mode 100644 index 0000000..4826ffa --- /dev/null +++ b/doc/en/index.docbook @@ -0,0 +1,101 @@ + + + + +]> + + + + + + The KStreamRipper Handbook + + + + Michael Goettsche +
mail@tuxipuxi.de
+
+
+ date + 0.1 + + SHORT DESCRIPTION GOES HERE + + + KDE + KStreamRipper + +
+ + + Introduction + + + Features + + + + + + Installation + + + How to obtain KStreamRipper + + + + + Requirements + + + + + Compilation and Installation + + Compiling KStreamRipper is very easy. The following should do + it: +% ./configure +% make +% make install + + + That should do it! Should you run into any problems, + please report them to the author + + + + + Using KStreamRipper + + + + + Questions, Answers, and Tips + + + Frequently asked questions + + + Question 1 + + + The answer + + + + + +
+ diff --git a/kde.py b/kde.py new file mode 100644 index 0000000..b08dac1 --- /dev/null +++ b/kde.py @@ -0,0 +1,816 @@ +# Made from scons qt.py and (heavily) modified into kde.py +# Thomas Nagy, 2004, 2005 + +""" +Run scons -h to display the associated help, or look below .. +""" + +BOLD ="\033[1m" +RED ="\033[91m" +GREEN ="\033[92m" +YELLOW ="\033[1m" #"\033[93m" # unreadable on white backgrounds +CYAN ="\033[96m" +NORMAL ="\033[0m" + +import os, re + +# Returns the name of the shared object (i.e. libkdeui.so.4) +# referenced by a libtool archive (like libkdeui.la) +def getSOfromLA(lafile): + contents = open(lafile, 'r').read() + match = re.search("^dlname='([^']*)'$", contents, re.M) + if match: + return match.group(1) + return None + +def exists(env): + return True + +def detect_kde(env): + """ Detect the qt and kde environment using kde-config mostly """ + + prefix = env['ARGS'].get('prefix', None) + execprefix = env['ARGS'].get('execprefix', None) + datadir = env['ARGS'].get('datadir', None) + libdir = env['ARGS'].get('libdir', None) + libsuffix = env['ARGS'].get('libsuffix', '') + kdeincludes = env['ARGS'].get('kdeincludes', None) + kdelibs = env['ARGS'].get('kdelibs', None) + qtincludes = env['ARGS'].get('qtincludes', None) + qtlibs = env['ARGS'].get('qtlibs', None) + + if libdir: + libdir = libdir+libsuffix + + ## Detect the kde libraries + print "Checking for kde-config : ", + kde_config = os.popen("which kde-config 2>/dev/null").read().strip() + if len(kde_config): + print GREEN+"kde-config was found"+NORMAL + else: + print RED+"kde-config was NOT found in your PATH"+NORMAL + print "Make sure kde is installed properly" + print "(missing package kdebase-devel?)" + env.Exit(1) + env['KDEDIR'] = os.popen('kde-config -prefix').read().strip() + + print "Checking for kde version : ", + kde_version = os.popen("kde-config --version|grep KDE").read().strip().split()[1] + try: + env['KDEm1']=int(kde_version[0]) + except: + pass + try: + env['KDEm2']=int(kde_version[2]) + except: + pass + try: + env['KDEm3']=int(kde_version[4]) + except: + pass + if int(kde_version[0]) != 3 or int(kde_version[2]) < 2: + print RED+kde_version + print RED+"Your kde version can be too old"+NORMAL + print RED+"Please make sure kde is at least 3.2"+NORMAL + else: + print GREEN+kde_version+NORMAL + + ## Detect the qt library + print "Checking for the qt library : ", + qtdir = os.getenv("QTDIR") + if qtdir: + print GREEN+"qt is in "+qtdir+NORMAL + else: + libdir = os.popen('kde-config --expandvars --install lib').read().strip() + libkdeuiSO = libdir+'/'+getSOfromLA(libdir+'/libkdeui.la') + m = re.search('(.*)/lib/libqt.*', os.popen('ldd ' + libkdeuiSO + ' | grep libqt').read().strip().split()[2]) + if m: + qtdir = m.group(1) + print YELLOW+"qt was found as "+m.group(1)+NORMAL + else: + print RED+"qt was not found"+NORMAL + print RED+"Please set QTDIR first (/usr/lib/qt3?)"+NORMAL + env.Exit(1) + env['QTDIR'] = qtdir.strip() + + ## Find the necessary programs uic and moc + print "Checking for uic : ", + uic = qtdir + "/bin/uic" + if os.path.isfile(uic): + print GREEN+"uic was found as "+uic+NORMAL + else: + uic = os.popen("which uic 2>/dev/null").read().strip() + if len(uic): + print YELLOW+"uic was found as "+uic+NORMAL + else: + uic = os.popen("which uic 2>/dev/null").read().strip() + if len(uic): + print YELLOW+"uic was found as "+uic+NORMAL + else: + print RED+"uic was not found - set QTDIR put it in your PATH ?"+NORMAL + env.Exit(1) + env['QT_UIC'] = uic + + print "Checking for moc : ", + moc = qtdir + "/bin/moc" + if os.path.isfile(moc): + print GREEN + "moc was found as " + moc + NORMAL + else: + moc = os.popen("which moc 2>/dev/null").read().strip() + if len(moc): + print YELLOW + "moc was found as " + moc + NORMAL + elif os.path.isfile("/usr/share/qt3/bin/moc"): + moc = "/usr/share/qt3/bin/moc" + print YELLOW + "moc was found as " + moc + NORMAL + else: + print RED + "moc was not found - set QTDIR or put it in your PATH ?" + NORMAL + env.Exit(1) + env['QT_MOC'] = moc + + ## check for the qt and kde includes + print "Checking for the qt includes : ", + if qtincludes and os.path.isfile(qtincludes + "/qlayout.h"): + # The user told where to look for and it looks valid + print GREEN + "ok " + qtincludes + NORMAL + else: + if os.path.isfile(qtdir + "/include/qlayout.h"): + # Automatic detection + print GREEN + "ok " + qtdir + "/include/ " + NORMAL + qtincludes = qtdir + "/include/" + elif os.path.isfile("/usr/include/qt3/qlayout.h"): + # Debian probably + print YELLOW + "the qt headers were found in /usr/include/qt3/ " + NORMAL + qtincludes = "/usr/include/qt3" + else: + print RED + "the qt headers were not found" + NORMAL + env.Exit(1) + + print "Checking for the kde includes : ", + kdeprefix = os.popen("kde-config --prefix").read().strip() + if not kdeincludes: + kdeincludes = kdeprefix+"/include/" + if os.path.isfile(kdeincludes + "/klineedit.h"): + print GREEN + "ok " + kdeincludes + NORMAL + else: + if os.path.isfile(kdeprefix+"/include/kde/klineedit.h"): + # Debian, Fedora probably + print YELLOW + "the kde headers were found in " + kdeprefix + "/include/kde/" + NORMAL + kdeincludes = kdeprefix + "/include/kde/" + else: + print RED + "The kde includes were NOT found" + NORMAL + env.Exit(1) + + if prefix: + ## use the user-specified prefix + if not execprefix: + execprefix = prefix + if not datadir: + datadir=prefix+"/share" + if not libdir: + libdir=execprefix+"/lib"+libsuffix + + subst_vars = lambda x: x.replace('${exec_prefix}', execprefix).replace('${datadir}',datadir).replace('${libdir}', libdir) + debian_fix = lambda x: x.replace('/usr/share', '${datadir}') + env['KDEBIN'] = subst_vars(os.popen('kde-config --install exe').read().strip()) + env['KDEAPPS'] = subst_vars(os.popen('kde-config --install apps').read().strip()) + env['KDEDATA'] = subst_vars(os.popen('kde-config --install data').read().strip()) + env['KDEMODULE']= subst_vars(os.popen('kde-config --install module').read().strip()) + env['KDELOCALE']= subst_vars(os.popen('kde-config --install locale').read().strip()) + env['KDEDOC'] = subst_vars( debian_fix(os.popen('kde-config --install html').read().strip()) ) + env['KDEKCFG'] = subst_vars(os.popen('kde-config --install kcfg').read().strip()) + env['KDEXDG'] = subst_vars(os.popen('kde-config --install xdgdata-apps').read().strip()) + env['KDEXDGDIR']= subst_vars(os.popen('kde-config --install xdgdata-dirs').read().strip()) + env['KDEMENU'] = subst_vars(os.popen('kde-config --install apps').read().strip()) + env['KDEMIME'] = subst_vars(os.popen('kde-config --install mime').read().strip()) + env['KDEICONS'] = subst_vars(os.popen('kde-config --install icon').read().strip()) + env['KDESERV'] = subst_vars(os.popen('kde-config --install services').read().strip()) + else: + # the user has given no prefix, install as a normal kde app + env['PREFIX'] = os.popen('kde-config --prefix').read().strip() + env['KDEBIN'] = os.popen('kde-config --expandvars --install exe').read().strip() + env['KDEAPPS'] = os.popen('kde-config --expandvars --install apps').read().strip() + env['KDEDATA'] = os.popen('kde-config --expandvars --install data').read().strip() + env['KDEMODULE']= os.popen('kde-config --expandvars --install module').read().strip() + env['KDELOCALE']= os.popen('kde-config --expandvars --install locale').read().strip() + env['KDEDOC'] = os.popen('kde-config --expandvars --install html').read().strip() + env['KDEKCFG'] = os.popen('kde-config --expandvars --install kcfg').read().strip() + env['KDEXDG'] = os.popen('kde-config --expandvars --install xdgdata-apps').read().strip() + env['KDEXDGDIR']= os.popen('kde-config --expandvars --install xdgdata-dirs').read().strip() + env['KDEMENU'] = os.popen('kde-config --expandvars --install apps').read().strip() + env['KDEMIME'] = os.popen('kde-config --expandvars --install mime').read().strip() + env['KDEICONS'] = os.popen('kde-config --expandvars --install icon').read().strip() + env['KDESERV'] = os.popen('kde-config --expandvars --install services').read().strip() + + env['QTPLUGINS']=os.popen('kde-config --expandvars --install qtplugins').read().strip() + + ## kde libs and includes + env['KDEINCLUDEPATH']=kdeincludes + if not kdelibs: + kdelibs=os.popen('kde-config --expandvars --install lib').read().strip() + env['KDELIBPATH']=kdelibs + + ## qt libs and includes + env['QTINCLUDEPATH']=qtincludes + if not qtlibs: + qtlibs=qtdir+"/lib" + env['QTLIBPATH']=qtlibs + +def generate(env): + """"Set up the qt and kde environment and builders - the moc part is difficult to understand """ + env.Help(""" +"""+BOLD+ +"""*** KDE options *** +-------------------""" ++NORMAL+""" +"""+BOLD+"""* prefix """+NORMAL+""": base install path, ie: /usr/local +"""+BOLD+"""* execprefix """+NORMAL+""": install path for binaries, ie: /usr/bin +"""+BOLD+"""* datadir """+NORMAL+""": install path for the data, ie: /usr/local/share +"""+BOLD+"""* libdir """+NORMAL+""": install path for the libs, ie: /usr/lib +"""+BOLD+"""* libsuffix """+NORMAL+""": suffix of libraries on amd64, ie: 64, 32 +"""+BOLD+"""* kdeincludes"""+NORMAL+""": path to the kde includes (/usr/include/kde on debian, ...) +"""+BOLD+"""* qtincludes """+NORMAL+""": same punishment, for qt includes (/usr/include/qt on debian, ...) +"""+BOLD+"""* kdelibs """+NORMAL+""": path to the kde libs, for linking the programs +"""+BOLD+"""* qtlibs """+NORMAL+""": same punishment, for qt libraries +ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt +"""+NORMAL) + + import SCons.Defaults + import SCons.Tool + import SCons.Util + + ui_extensions = [".ui"] + header_extensions = [".h", ".hxx", ".hpp", ".hh"] + source_extensions = [".cpp", ".cxx", ".cc"] + + def find_file(filename, paths, node_factory): + retval = None + for dir in paths: + node = node_factory(filename, dir) + if node.rexists(): + return node + return None + + class _Metasources: + """ Callable class, which works as an emitter for Programs, SharedLibraries + and StaticLibraries.""" + + def __init__(self, objBuilderName): + self.objBuilderName = objBuilderName + + def __call__(self, target, source, env): + """ Smart autoscan function. Gets the list of objects for the Program + or Lib. Adds objects and builders for the special qt files. """ + try: + if int(env.subst('$QT_AUTOSCAN')) == 0: + return target, source + except ValueError: + pass + + try: + qtdebug = int(env.subst('$QT_DEBUG')) + except ValueError: + qtdebug = 0 + + # some shortcuts used in the scanner + FS = SCons.Node.FS.default_fs + splitext = SCons.Util.splitext + objBuilder = getattr(env, self.objBuilderName) + + # some regular expressions: + # Q_OBJECT detection + q_object_search = re.compile(r'[^A-Za-z0-9]Q_OBJECT[^A-Za-z0-9]') + + # The following is kind of hacky to get builders working properly (FIXME) ?? + objBuilderEnv = objBuilder.env + objBuilder.env = env + mocBuilderEnv = env.Moc.env + env.Moc.env = env + + # make a deep copy for the result; MocH objects will be appended + out_sources = source[:] + + for obj in source: + if not obj.has_builder(): + # binary obj file provided + if qtdebug: + print "scons: qt: '%s' seems to be a binary. Discarded." % str(obj) + continue + cpp = obj.sources[0] + if not splitext(str(cpp))[1] in source_extensions: + if qtdebug: + print "scons: qt: '%s' is no cxx file. Discarded." % str(cpp) + # c or fortran source + continue + #cpp_contents = comment.sub('', cpp.get_contents()) + cpp_contents = cpp.get_contents() + + h = None + ui = None + + for ui_ext in ui_extensions: + # try to find the ui file in the corresponding source directory + uiname = splitext(cpp.name)[0] + ui_ext + ui = find_file(uiname, (cpp.get_dir(),), FS.File) + if ui: + if qtdebug: + print "scons: qt: found .ui file of header" #% (str(h), str(cpp)) + #h_contents = comment.sub('', h.get_contents()) + break + + # if we have a .ui file, do not continue, it is automatically handled by Uic + if ui: + continue + + for h_ext in header_extensions: + # try to find the header file in the corresponding source + # directory + hname = splitext(cpp.name)[0] + h_ext + h = find_file(hname, (cpp.get_dir(),), FS.File) + if h: + if qtdebug: + print "scons: qt: Scanning '%s' (header of '%s')" % (str(h), str(cpp)) + #h_contents = comment.sub('', h.get_contents()) + h_contents = h.get_contents() + break + + if not h and qtdebug: + print "scons: qt: no header for '%s'." % (str(cpp)) + if h and q_object_search.search(h_contents): + # h file with the Q_OBJECT macro found -> add .moc or _moc.cpp file + moc_cpp = None + + if env.has_key('NOMOCSCAN'): + moc_cpp = env.Moc(h) + else: + reg = '\n\s*#include\s*("|<)'+splitext(cpp.name)[0]+'.moc("|>)' + meta_object_search = re.compile(reg) + if meta_object_search.search(cpp_contents): + moc_cpp = env.Moc(h) + else: + moc_cpp = env.Moccpp(h) + moc_o = objBuilder(moc_cpp) + out_sources.append(moc_o) + if qtdebug: + print "scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(h), str(moc_cpp[0])) + + if cpp and q_object_search.search(cpp_contents): + print "error, bksys cannot handle cpp files with Q_OBJECT classes" + print "if you are sure this is a feature worth the effort, " + print "report this to the authors tnagyemail-mail yahoo.fr" + + # restore the original env attributes (FIXME) + objBuilder.env = objBuilderEnv + env.Moc.env = mocBuilderEnv + + return (target, out_sources) + + MetasourcesShared = _Metasources('SharedObject') + MetasourcesStatic = _Metasources('StaticObject') + + CLVar = SCons.Util.CLVar + splitext = SCons.Util.splitext + Builder = SCons.Builder.Builder + + # Detect the environment - replaces ./configure implicitely and store the options into a cache + from SCons.Options import Options + cachefile=env['CACHEDIR']+'kde.cache.py' + opts = Options(cachefile) + opts.AddOptions( + ('PREFIX', 'root of the program installation'), + + ('QTDIR', 'root of qt directory'), + ('QTLIBPATH', 'path to the qt libraries'), + ('QTINCLUDEPATH', 'path to the qt includes'), + ('QT_UIC', 'moc directory'), + ('QT_MOC', 'moc executable command'), + ('QTPLUGINS', 'uic executable command'), + ('KDEDIR', 'root of kde directory'), + ('KDELIBPATH', 'path to the kde libs'), + ('KDEINCLUDEPATH', 'path to the kde includes'), + + ('KDEBIN', 'installation path of the kde binaries'), + ('KDEMODULE', 'installation path of the parts and libs'), + ('KDEAPPS', ''), + ('KDEDATA', 'installation path of the application data'), + ('KDELOCALE', ''), + ('KDEDOC', 'installation path of the application documentation'), + ('KDEKCFG', 'installation path of the .kcfg files'), + ('KDEXDG', 'installation path of the service types'), + ('KDEXDGDIR', 'installation path of the xdg service directories'), + ('KDEMENU', ''), + ('KDEMIME', 'installation path of to the mimetypes'), + ('KDEICONS', ''), + ('KDEm1', ''), + ('KDEm2', ''), + ('KDEm3', ''), + ('KDESERV', ''), + ) + opts.Update(env) + + # reconfigure when things are missing + if 'configure' in env['TARGS'] or not env.has_key('QTDIR') or not env.has_key('KDEDIR'): + detect_kde(env) + + # finally save the configuration to the cache file + opts.Save(cachefile, env) + + ## set default variables, one can override them in sconscript files + env.Append(CXXFLAGS = ['-I'+env['KDEINCLUDEPATH'], '-I'+env['QTINCLUDEPATH'] ]) + env.Append(LIBPATH = [env['KDELIBPATH'], env['QTLIBPATH'] ]) + + env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 + + env['QT_AUTOSCAN'] = 1 + env['QT_DEBUG'] = 0 + env['QT_UIC_HFLAGS'] = '-L $QTPLUGINS -nounload' + env['QT_UIC_CFLAGS'] = '$QT_UIC_HFLAGS -tr tr2i18n' + env['QT_LIBS'] = 'qt-mt' + env['QT_UICIMPLPREFIX'] = '' + env['QT_UICIMPLSUFFIX'] = '.cpp' + + env['QT_MOCHPREFIX'] = '' + env['QT_MOCHSUFFIX'] = '.moc' + env['KDE_KCFG_IMPLPREFIX'] = '' + env['KDE_KCFG_IMPL_HSUFFIX'] = '.h' + env['KDE_KCFG_IMPL_CSUFFIX'] = '.cpp' + env['KDE_SKEL_IMPL_SUFFIX'] = '.skel' + env['MEINPROC'] = 'meinproc' + env['MSGFMT'] = 'msgfmt' + + ## ui file processing + def uicGenerator(target, source, env, for_signature): + act=[] + act.append('$QT_UIC $QT_UIC_HFLAGS -o '+target[0].path+' '+source[0].path) + act.append('rm -f ' +target[1].path) + act.append('echo \'#include \' >> '+target[1].path) + act.append('echo \'#include \' >> '+target[1].path) + act.append('$QT_UIC $QT_UIC_CFLAGS -impl '+target[0].path+' -o '+target[1].path+'.tmp '+source[0].path) + act.append('cat '+target[1].path+'.tmp >> '+target[1].path) + act.append('rm -f '+target[1].path+'.tmp') + act.append('echo \'#include "' + target[2].name + '"\' >> '+target[1].path) + act.append('$QT_MOC -o '+target[2].path+' '+target[0].path) + return act + + def uicEmitter(target, source, env): + adjustixes = SCons.Util.adjustixes + bs = SCons.Util.splitext(str(source[0].name))[0] + bs = os.path.join(str(target[0].get_dir()),bs) + # first target is automatically added by builder (.h file) + if len(target) < 2: + # second target is .cpp file + target.append(adjustixes(bs, + env.subst('$QT_UICIMPLPREFIX'), + env.subst('$QT_UICIMPLSUFFIX'))) + if len(target) < 3: + # third target is .moc file + target.append(adjustixes(bs, + env.subst('$QT_MOCHPREFIX'), + env.subst('$QT_MOCHSUFFIX'))) + return target, source + + UIC_BUILDER = Builder( + generator = uicGenerator, + emitter = uicEmitter, + suffix = '.h', + src_suffix = '.ui') + + ## moc file processing + env['QT_MOCCOM'] = ('$QT_MOC -o ${TARGETS[0]} $SOURCE') + + MOC_BUILDER = Builder( + action = '$QT_MOCCOM', + suffix = '.moc', + src_suffix = '.h') + + MOCCPP_BUILDER = Builder( + action = '$QT_MOCCOM', + suffix = '_moc.cpp', + src_suffix = '.h') + + ## kcfg file processing + def kcfgGenerator(target, source, env, for_signature): + act=[] + act.append('kconfig_compiler -d'+str(source[0].get_dir())+' '+source[1].path+' '+source[0].path) + return act + + def kcfgEmitter(target, source, env): + adjustixes = SCons.Util.adjustixes + bs = SCons.Util.splitext(str(source[0].name))[0] + bs = os.path.join(str(target[0].get_dir()),bs) + # .h file is automatically added + if len(target) < 2: + # add .cpp file + target.append(adjustixes(bs, env.subst('$KDE_KCFG_IMPLPREFIX'), env.subst('$KDE_KCFG_IMPL_CSUFFIX'))) + + if len(source) <2: + if not os.path.isfile(str(source[0])): + print RED+'kcfg file given'+str(source[0])+' does not exist !'+NORMAL + return target, source + kfcgfilename="" + kcfgFileDeclRx = re.compile("^[fF]ile\s*=\s*(.+)\s*$") + for line in file(str(source[0]), "r").readlines(): + match = kcfgFileDeclRx.match(line.strip()) + if match: + kcfgfilename = match.group(1) + break + source.append(str(source[0].get_dir())+'/'+kcfgfilename) + return target, source + + KCFG_BUILDER = Builder( + generator = kcfgGenerator, + emitter = kcfgEmitter, + suffix = '.h', + src_suffix = '.kcfgc') + + ## dcop processing + def dcopGenerator(target, source, env, for_signature): + act=[] + act.append('dcopidl '+source[0].path+' > '+target[1].path+'|| ( rm -f '+target[1].path+' ; false)') + act.append('dcopidl2cpp --c++-suffix cpp --no-signals --no-stub '+target[1].path) + return act + + def dcopEmitter(target, source, env): + bs = SCons.Util.splitext(str(source[0].name))[0] + bs = os.path.join(str(target[0].get_dir()),bs) + target.append(bs+'.kidl') + #target.append(bs+'_skel.cpp') + return target, source + + DCOP_BUILDER = Builder( + generator = dcopGenerator, + emitter = dcopEmitter, + suffix = '_skel.cpp', + src_suffix = '.h') + + ## documentation processing + MEINPROC_BUILDER = Builder( + action = '$MEINPROC --check --cache $TARGET $SOURCE', + suffix = '.cache.bz2') + + ## translation files builder + TRANSFILES_BUILDER = Builder( + action = '$MSGFMT $SOURCE -o $TARGET', + suffix = '.gmo', + src_suffix = '.po') + + ## libtool file builder + def laGenerator(target, source, env, for_signature): + act=[] + act.append('echo "dlname=\''+source[0].name+'\'" > '+target[0].path) + act.append('echo "library_names=\''+source[0].name+' '+source[0].name+' '+source[0].name+'\'" >> '+target[0].path) + act.append('echo "old_library=\'\'">> '+target[0].path) + act.append('echo "dependency_libs=\'\'">> '+target[0].path) + act.append('echo "current=0">> '+target[0].path) + act.append('echo "age=0">> '+target[0].path) + act.append('echo "revision=0">> '+target[0].path) + act.append('echo "installed=yes">> '+target[0].path) + act.append('echo "shouldnotlink=no">> '+target[0].path) + act.append('echo "dlopen=\'\'">> '+target[0].path) + act.append('echo "dlpreopen=\'\'">> '+target[0].path) + act.append('echo "libdir=\''+env['KDEMODULE']+'\'" >> '+target[0].path) + env.Depends(target, source) + return act + LA_BUILDER = Builder( + generator = laGenerator, + suffix = '.la', + src_suffix = env['SHLIBSUFFIX']) + + ## register the builders + env['BUILDERS']['Uic'] = UIC_BUILDER + env['BUILDERS']['Moc'] = MOC_BUILDER + env['BUILDERS']['Moccpp'] = MOCCPP_BUILDER + env['BUILDERS']['Dcop'] = DCOP_BUILDER + env['BUILDERS']['Kcfg'] = KCFG_BUILDER + env['BUILDERS']['LaFile'] = LA_BUILDER + env['BUILDERS']['Meinproc'] = MEINPROC_BUILDER + env['BUILDERS']['Transfiles']= TRANSFILES_BUILDER + + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + static_obj.src_builder.append('Uic') + shared_obj.src_builder.append('Uic') + static_obj.src_builder.append('Kcfg') + shared_obj.src_builder.append('Kcfg') + static_obj.src_builder.append('LaFile') + shared_obj.src_builder.append('LaFile') + static_obj.src_builder.append('Meinproc') + shared_obj.src_builder.append('Meinproc') + static_obj.src_builder.append('Transfiles') + shared_obj.src_builder.append('Transfiles') + + ## Find the files to moc, dcop, and link against kde and qt + env.AppendUnique(PROGEMITTER = [MetasourcesStatic], SHLIBEMITTER=[MetasourcesShared], LIBEMITTER =[MetasourcesStatic]) + + ## Handy helpers for building kde programs + ## You should not have to modify them .. + + #import SCons.Util + skel_ext = [".skel", ".SKEL"] + def KDEfiles(lenv, target, source): + """ Returns a list of files for scons (handles kde tricks like .skel) + It also makes custom checks against double includes like : ['file.ui', 'file.cpp'] + (file.cpp is already included because of file.ui) """ + + src=[] + ui_files=[] + kcfg_files=[] + skel_files=[] + other_files=[] + + # For each file, check wether it is a dcop file or not, and create the complete list of sources + for file in source: + bs = SCons.Util.splitext(file)[0] + ext = SCons.Util.splitext(file)[1] + if ext in skel_ext: + lenv.Dcop(bs+'.h') + src.append(bs+'_skel.cpp') + elif ext == ".moch": + lenv.Moccpp(bs+'.h') + src.append(bs+'_moc.cpp') + else: + src.append(file) + + if ext == '.ui': + ui_files.append(bs) + elif ext == '.kcfgc': + kcfg_files.append(bs) + elif ext == '.skel': + skel_files.append(bs) + else: + other_files.append(bs) + + # Now check against typical newbie errors + for file in ui_files: + for ofile in other_files: + if ofile == file: + print RED+"WARNING: You have included "+file+".ui and another file of the same prefix"+NORMAL + print "Files generated by uic (file.h, file.cpp must not be included" + for file in kcfg_files: + for ofile in other_files: + if ofile == file: + print RED+"WARNING: You have included "+file+".kcfg and another file of the same prefix"+NORMAL + print "Files generated by kconfig_compiler (settings.h, settings.cpp) must not be included" + return src + + + """ + In the future, these functions will contain the code that will dump the + configuration for re-use from an IDE + """ + import glob + def KDEinstall(lenv, restype, subdir, files): + if not 'install' in env['TARGS']: + return + basedir=env['DESTDIR'] + if len(restype)>0: + if not lenv.has_key(restype): + print RED+"unknown resource type "+restype+NORMAL + else: + basedir += lenv[restype]+'/' + #print file # <- useful to trace stuff :) + install_list = env.Install(basedir+subdir+'/', files) + env.Alias('install', install_list) + return install_list + + def KDEinstallas(lenv, restype, destfile, file): + if not 'install' in env['TARGS']: + return + basedir=env['DESTDIR'] + if len(restype)>0: + if not lenv.has_key(restype): + print RED+"unknown resource type "+restype+NORMAL + else: + basedir += lenv[restype]+'/' + install_list = env.InstallAs(basedir+destfile, file) + env.Alias('install', install_list) + return install_list + + def KDEprogram(lenv, target, source): + """ Makes a kde program + The program is installed except if one sets env['NOAUTOINSTALL'] """ + src = KDEfiles(lenv, target, source) + program_list = lenv.Program(target, src) + if not lenv.has_key('NOAUTOINSTALL'): + KDEinstall(lenv, 'KDEBIN', '', target) + return program_list + + def KDEshlib(lenv, target, source, kdelib=0, libprefix='lib'): + """ Makes a shared library for kde (.la file for klibloader) + The library is installed except if one sets env['NOAUTOINSTALL'] """ + src = KDEfiles(lenv, target, source) + lenv['LIBPREFIX']=libprefix + library_list = lenv.SharedLibrary(target, src) + lafile_list = lenv.LaFile(target, library_list) + if not lenv.has_key('NOAUTOINSTALL'): + install_dir = 'KDEMODULE' + if kdelib==1: + install_dir = 'KDELIBPATH' + KDEinstall(lenv, install_dir, '', library_list) + KDEinstall(lenv, install_dir, '', lafile_list) + return library_list + + def KDEstaticlib(lenv, target, source): + """ Makes a static library for kde - in practice you should not use static libraries + 1. they take more memory than shared ones + 2. makefile.am needed it because of limitations + (cannot handle sources in separate folders - takes extra processing) """ + src = KDEfiles(lenv, target, source) + return lenv.StaticLibrary(target, src) + # do not install static libraries by default + + def KDEaddflags_cxx(lenv, fl): + """ Compilation flags for C++ programs """ + lenv.AppendUnique(CXXFLAGS = fl) + + def KDEaddflags_c(lenv, fl): + """ Compilation flags for C programs """ + lenv.AppendUnique(CFLAGS = fl) + + def KDEaddflags_link(lenv, fl): + """ Add link flags - Use this if KDEaddlibs below is not enough """ + lenv.AppendUnique(LINKFLAGS = fl) + + def KDEaddlibs(lenv, libs): + """ Helper function """ + lenv.AppendUnique(LIBS = libs) + + def KDEaddpaths_includes(lenv, paths): + """ Add new include paths """ + lenv.AppendUnique(CPPPATH = paths) + + def KDEaddpaths_libs(lenv, paths): + """ Add paths to libraries """ + lenv.AppendUnique(LIBPATH = paths) + + def KDElang(lenv, folder, appname): + """ Process translations (.po files) in a po/ dir """ + transfiles = glob.glob(folder+'/*.po') + for lang in transfiles: + result = lenv.Transfiles(lang) + country = SCons.Util.splitext(result[0].name)[0] + KDEinstallas(lenv, 'KDELOCALE', country+'/LC_MESSAGES/'+appname+'.mo', result) + + def KDEicon(lenv, icname): + """ Emulates the behaviour of Makefile.am to install icons + Contributed by: "Andrey Golovizin" """ + type_dic = { 'action' : 'actions', 'app' : 'apps', 'device' : + 'devices', 'filesys' : 'filesystems', 'mime' : 'mimetypes' } + dir_dic = { + 'los' :'locolor/16x16', + 'lom' :'locolor/32x32', + 'him' :'hicolor/32x32', + 'hil' :'hicolor/48x48', + 'lo16' :'locolor/16x16', + 'lo22' :'locolor/22x22', + 'lo32' :'locolor/32x32', + 'hi16' :'hicolor/16x16', + 'hi22' :'hicolor/22x22', + 'hi32' :'hicolor/32x32', + 'hi48' :'hicolor/48x48', + 'hi64' :'hicolor/64x64', + 'hi128':'hicolor/128x128', + 'hisc' :'hicolor/scalable', + 'cr16' :'crystalsvg/16x16', + 'cr22' :'crystalsvg/22x22', + 'cr32' :'crystalsvg/32x32', + 'cr48' :'crystalsvg/48x48', + 'cr64' :'crystalsvg/64x64', + 'cr128':'crystalsvg/128x128', + 'crsc' :'crystalsvg/scalable' + } + + iconfiles = [] + for ext in ['png', 'xpm', 'mng', 'svg', 'svgz']: + files = glob.glob('*-*-%s.%s' % (icname, ext)) + iconfiles += files + for iconfile in iconfiles: + tmp = iconfile.split('-') + if len(tmp)!=3: + print RED+'WARNING: icon filename has unknown format: '+iconfile+NORMAL + continue + [icon_dir, icon_type, icon_filename]=tmp + try: + destfile = '%s/%s/%s/%s' % (lenv['KDEICONS'], dir_dic[icon_dir], type_dic[icon_type], icon_filename) + except KeyError: + print RED+'WARNING: unknown icon type: '+iconfile+NORMAL + continue + ## Do not use KDEinstallas here, as parsing from an ide will be necessary + if 'install' in env['TARGS']: + env.Alias('install', env.InstallAs( env['DESTDIR']+'/'+destfile, iconfile ) ) + + # Attach the functions to the environment so that sconscripts can use them + from SCons.Script.SConscript import SConsEnvironment + SConsEnvironment.KDEprogram = KDEprogram + SConsEnvironment.KDEshlib = KDEshlib + SConsEnvironment.KDEstaticlib = KDEstaticlib + SConsEnvironment.KDEinstall = KDEinstall + SConsEnvironment.KDEinstallas = KDEinstallas + SConsEnvironment.KDElang = KDElang + SConsEnvironment.KDEicon = KDEicon + + SConsEnvironment.KDEaddflags_cxx = KDEaddflags_cxx + SConsEnvironment.KDEaddflags_c = KDEaddflags_c + SConsEnvironment.KDEaddflags_link = KDEaddflags_link + SConsEnvironment.KDEaddlibs = KDEaddlibs + SConsEnvironment.KDEaddpaths_includes = KDEaddpaths_includes + SConsEnvironment.KDEaddpaths_libs = KDEaddpaths_libs + diff --git a/kstreamripper.kdevelop b/kstreamripper.kdevelop new file mode 100644 index 0000000..d974588 --- /dev/null +++ b/kstreamripper.kdevelop @@ -0,0 +1,206 @@ + + + + Michael Goettsche + mail@tuxipuxi.de + 0.1 + KDevKDEAutoProject + C++ + + C++ + Code + Qt + KDE + + . + false + + + + + + + src/kstreamripper + default + + + src/kstreamripper + executable + / + + false + true + + + + + + + + optimized + GccOptions + GppOptions + G77Options + -O2 -g0 + + + --enable-debug=full + debug + GccOptions + GppOptions + G77Options + -O0 -g3 + + + + --prefix=/opt/kde --enable-debug=full + + + + + kdevgccoptions + kdevgppoptions + kdevpgf77options + + + + + + + + + + + + + + false + 1 + false + + + + + + + + + + + false + false + + + false + false + *.o,*.lo,CVS + + + + + gtk + gnustep + python + php + perl + + + /home/tuxipuxi/Documents/cpp/kde/kstreamripper/html/ + /home/tuxipuxi/Documents/cpp/kde/kstreamripper/html/ + + + + + + + + + libtool + + + + + + true + false + false + + + false + true + 10 + + + + + + + + + + + + + .h + .cpp + + + + + true + true + true + false + true + true + true + 250 + 400 + 250 + + + + + set + m_,_ + theValue + true + true + + + + false + false + + + 0.1 + + + + + + + + + false + false + false + 0 + false + false + false + false + + + + -f + + + + -dP + -f + -C -d -P + -u3 -p + + + diff --git a/kstreamripper.kdevelop.pcs b/kstreamripper.kdevelop.pcs new file mode 100644 index 0000000..0139aa7 Binary files /dev/null and b/kstreamripper.kdevelop.pcs differ diff --git a/kstreamripper.kdevses b/kstreamripper.kdevses new file mode 100644 index 0000000..da20bed --- /dev/null +++ b/kstreamripper.kdevses @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/po/SConscript b/po/SConscript new file mode 100644 index 0000000..0362e0a --- /dev/null +++ b/po/SConscript @@ -0,0 +1,24 @@ +## This script demonstrates to build and install +## a simple kde program having KconfigXT settings +## with scons +## +## Thomas Nagy, 2004, 2005 + +## This file can be reused freely for any project (see COPYING) + + +## First load the environment set in the top-level SConstruct file +#Import( "env KDElang" ) +Import('env') +myenv=env.Copy() + +## Make translations for the program "test1" in french (requires fr.po) +myenv['APPNAME'] = "kstreamripper" +#KDElang( ['fr'], myenv ) + +## NOTE1 : +# KDElang( ['fr','de','nl','pl'], myenv ) + +## NOTE2 : +## updating the translation files must be done manually +## for the moment, using the messages.sh script diff --git a/po/messages.sh b/po/messages.sh new file mode 100755 index 0000000..a36f5c9 --- /dev/null +++ b/po/messages.sh @@ -0,0 +1,60 @@ +#!/bin/sh + +# Inspired by Makefile.common from coolo +# this script is used to update the .po files + +# To update the translations, you will need a specific gettext +# patched for kde and a lot of patience, tenacity, luck, time .. + + +# I guess one should only update the .po files when all .cpp files +# are generated (after a make or scons) + +# If you have a better way to do this, do not keep that info +# for yourself and help me to improve this script, thanks +# (tnagyemail-mail tat yahoo d0tt fr) + +SRCDIR=../test1-kconfigxt # srcdir is the directory containing the source code +TIPSDIR=$SRCDIR # tipsdir is the directory containing the tips + +KDEDIR=`kde-config --prefix` +EXTRACTRC=extractrc +KDEPOT=`kde-config --prefix`/include/kde.pot +XGETTEXT="xgettext -C -ki18n -ktr2i18n -kI18N_NOOP -ktranslate -kaliasLocale -x $KDEPOT " + +## check that kde.pot is available +if ! test -e $KDEPOT; then + echo "$KDEPOT does not exist, there is something wrong with your installation!" + XGETTEXT="xgettext -C -ki18n -ktr2i18n -kI18N_NOOP -ktranslate -kaliasLocale " +fi + +> rc.cpp + +## extract the strings +echo "extracting the strings" + +# process the .ui and .rc files +$EXTRACTRC `find $SRCDIR -iname *.rc` >> rc.cpp +$EXTRACTRC `find $SRCDIR -iname *.ui` >> rc.cpp +echo -e 'i18n("_: NAME OF TRANSLATORS\\n"\n"Your names")\ni18n("_: EMAIL OF TRANSLATORS\\n"\n"Your emails")' > $SRCDIR/_translatorinfo.cpp + +# process the tips - $SRCDIR is supposed to be where the tips are living +pushd $TIPSDIR; preparetips >tips.cpp; popd + +$XGETTEXT `find $SRCDIR -name "*.cpp"` -o kdissert.pot + +# remove the intermediate files +rm -f $TIPSDIR/tips.cpp +rm -f rc.cpp +rm -f $SRCDIR/_translatorinfo.cpp + +## now merge the .po files .. +echo "merging the .po files" + +for i in `ls *.po`; do + msgmerge $i kdissert.pot -o $i || exit 1 +done + +## finished +echo "Done" + diff --git a/scons-mini.tar.bz2 b/scons-mini.tar.bz2 new file mode 100644 index 0000000..0c1ce52 Binary files /dev/null and b/scons-mini.tar.bz2 differ diff --git a/scons-mini.tar.bz2.cdbs-config_list b/scons-mini.tar.bz2.cdbs-config_list new file mode 100644 index 0000000..e69de29 diff --git a/src/SConscript b/src/SConscript new file mode 100644 index 0000000..5d40432 --- /dev/null +++ b/src/SConscript @@ -0,0 +1,69 @@ +#! /usr/bin/env python +## This script demonstrates how to build and install +## a simple kde program having KconfigXT settings +## with scons +## +## Thomas Nagy, 2004, 2005 + +## This file can be reused freely for any project (see COPYING) + +############################ +## load the config + +## Use the environment and the tools set in the top-level +## SConstruct file (set with 'Export') - this is very important + +Import( 'env' ) +myenv=env.Copy() + +############################# +## the programs to build + +# The sources for our program - only .ui, .skel and .cpp are accepted +kstreamripper_sources = """ +addnewstreamimpl.cpp +addnewstream.ui +kstreamripperbase.ui +kstreamripper.cpp +main.cpp +processcontroller.cpp +processlistviewitem.cpp +""".split() + +# Our main program +# KDEprogram add the file to the install targets automatically, +# so you do not need to write KDEinstall('KDEBIN', '', test1, myenv) +myenv.KDEprogram( "kstreamripper", kstreamripper_sources ) + +############################ +## Customization + +## Additional include paths for compiling the source files +## Always add '../' (top-level directory) because moc makes code that needs it +myenv.KDEaddpaths_includes( ['./', '../'] ) + +## Necessary libraries to link against +myenv.KDEaddlibs( ['qt-mt', 'kio', 'kdeui'] ) +if env['KDEm2']>3: myenv.KDEaddlibs( ['kdnssd']) +############################# +## Data to install + +## The ui.rc file and the tips go into datadir/appname/ +myenv.KDEinstall( 'KDEDATA', 'kstreamripper', 'kstreamripperui.rc' ) + +## The kcfg file is installed in a global kcfg directory +#myenv.KDEinstall( 'KDEKCFG', '', 'test1.kcfg' ) + +## Warning : there is a difference between the normal destop file used for the menu +## and the servicetype desktop file, so they go in different directories +## you will find more information in 'test3' +myenv.KDEinstall( 'KDEMENU', 'Utilities', 'kstreamripper.desktop') + +## Use this when you need to install a mimetype file +#myenv.KDEinstall( 'KDEMIME', 'application', 'x-test1.desktop' ) + +## Installing icons is easy (hi-16-app-test1.png, hi-22-app-test1.png) +## do not forget that this is a python script so loops are allowed here :) +myenv.KDEicon( 'hi16-app-kstreameripper.png') +myenv.KDEicon( 'hi32-app-kstreameripper.png') + diff --git a/src/addnewstream.ui b/src/addnewstream.ui new file mode 100644 index 0000000..5b46733 --- /dev/null +++ b/src/addnewstream.ui @@ -0,0 +1,108 @@ + +AddNewStream + + + AddNewStream + + + + 0 + 0 + 383 + 287 + + + + Add Stream.... + + + TabFocus + + + + unnamed + + + + frame3 + + + StyledPanel + + + Raised + + + + unnamed + + + + d_nameLabel + + + Name: + + + + + d_descriptionLabel + + + Description: + + + + + d_nameEdit + + + + + d_urlEdit + + + + + d_descEdit + + + + + d_urlLabel + + + Url of Stream: + + + + + + + d_okButton + + + TabFocus + + + &Ok + + + Alt+O + + + + + d_cancelButton + + + &Cancel + + + Alt+C + + + + + + diff --git a/src/addnewstreamimpl.cpp b/src/addnewstreamimpl.cpp new file mode 100644 index 0000000..033e44e --- /dev/null +++ b/src/addnewstreamimpl.cpp @@ -0,0 +1,66 @@ +/*************************************************************************** + * Copyright (C) 2003-2005 by Michael Goettsche * + * mail@tuxipuxi.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * 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. * + ***************************************************************************/ + +#include + +#include +#include + +#include "addnewstreamimpl.h" + + +AddNewStreamImpl::AddNewStreamImpl( QWidget* parent, const char* name ) + : AddNewStream( parent,name, true ) +{ + connect( d_okButton, SIGNAL( clicked()), this, SLOT( okButtonClicked()) ); + connect( d_cancelButton, SIGNAL( clicked()), this, SLOT( cancelButtonClicked()) ); +} + + +AddNewStreamImpl::~AddNewStreamImpl() +{ +} + + +//SLOTS + + +void AddNewStreamImpl::okButtonClicked() +{ + if( d_nameEdit->text() != "" && d_urlEdit->text() != "") + { + emit finished( this ); + this->close(); + } + else + { + KMessageBox::error( this, "You forgot to fill out one or more fields, please do it now.", + "Missing Information" ); + } +} + + +void AddNewStreamImpl::cancelButtonClicked() +{ + this->close(); +} + + + diff --git a/src/addnewstreamimpl.h b/src/addnewstreamimpl.h new file mode 100644 index 0000000..30bcb49 --- /dev/null +++ b/src/addnewstreamimpl.h @@ -0,0 +1,48 @@ +/*************************************************************************** + * Copyright (C) 2003-2005 by Michael Goettsche * + * mail@tuxipuxi.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * 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. * + ***************************************************************************/ + +#ifndef ADDNEWSTREAMIMPL_H +#define ADDNEWSTREAMIMPL_H + +#include "addnewstream.h" + +class AddNewStreamImpl : public AddNewStream +{ + Q_OBJECT + +public: + + AddNewStreamImpl( QWidget* parent = 0, const char* name = 0 ); + ~AddNewStreamImpl(); + +protected: + +protected slots: + + void okButtonClicked(); + void cancelButtonClicked(); + +signals: + + void finished( AddNewStreamImpl* ); +}; + +#endif + diff --git a/src/hi16-app-kstreamripper.png b/src/hi16-app-kstreamripper.png new file mode 100644 index 0000000..4ed606c Binary files /dev/null and b/src/hi16-app-kstreamripper.png differ diff --git a/src/hi32-app-kstreamripper.png b/src/hi32-app-kstreamripper.png new file mode 100644 index 0000000..45ae1a1 Binary files /dev/null and b/src/hi32-app-kstreamripper.png differ diff --git a/src/kstreamripper.cpp b/src/kstreamripper.cpp new file mode 100644 index 0000000..9641df2 --- /dev/null +++ b/src/kstreamripper.cpp @@ -0,0 +1,309 @@ +/*************************************************************************** + * Copyright (C) 2003-2005 by Michael Goettsche * + * mail@tuxipuxi.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * 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. * + ***************************************************************************/ + + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "kstreamripper.h" +#include "addnewstreamimpl.h" +#include "processlistviewitem.h" +#include "processcontroller.h" + + + +KStreamRipper::KStreamRipper( QWidget* parent, const char* name ) + : KStreamRipperBase( parent,name ) +#if KDE_IS_VERSION(3,3,90) + , m_browser("_shoutcast._tcp",0,true) +#endif +{ + m_destEdit->setText( QDir::homeDirPath() ); + + m_streamsListView->addColumn( "Name" ); + m_streamsListView->addColumn( "Status" ); + m_streamsListView->addColumn( "Size" ); + + //app config + KConfig *appConfig = KGlobal::config(); + + m_destEdit->setText( appConfig->readEntry( "Destination" , "" ) ); + m_timeEdit->setText( appConfig->readEntry( "Riptime", "0" )); + m_tuneInEdit->setText( appConfig->readEntry( "Command", "xmms " )); + m_id3Checkbox->setChecked( appConfig->readBoolEntry( "Id3Tag", 1 )); + + //listview entrys + QStringList nameList,urlList,descList; + + nameList = appConfig->readListEntry( "names" ); + urlList = appConfig->readListEntry( "urls" ); + descList = appConfig->readListEntry( "descs" ); + QStringList::iterator iter1, iter2, iter3; + iter1 = nameList.begin(); + iter2 = urlList.begin(); + iter3 = descList.begin(); + + for( ; iter1 != nameList.end() && iter2 != urlList.end() && iter3 != descList.end(); ++iter1, ++iter2, ++iter3 ) + { + ProcessListViewItem * proc = new ProcessListViewItem( m_streamsListView, *iter1, "", ""); + proc->setRenameEnabled(0, true); + proc->getProcessController()->setUrl( *iter2 ); + proc->getProcessController()->setDescription( *iter3 ); + } + + //CONNECTS + + //clicks + connect(m_addStreamButton, SIGNAL(clicked()), this, SLOT(addStreamButtonClicked())); + connect(m_deleteStreamButton, SIGNAL(clicked()), this, SLOT(deleteStreamButtonClicked())); + connect(m_tuneInButton, SIGNAL(clicked()), this, SLOT(tuneInButtonClicked())); + connect(m_ripButton, SIGNAL(clicked()), this, SLOT(ripButtonClicked())); + connect(m_stopRipButton, SIGNAL(clicked()), this, SLOT(stopRipButtonClicked())); + connect(m_browseButton, SIGNAL(clicked()), this, SLOT(browseButtonClicked())); + connect(m_aboutButton, SIGNAL(clicked()), this, SLOT(aboutButtonClicked())); + connect(m_quitButton, SIGNAL(clicked()), this, SLOT(quitButtonClicked())); + + //other + connect( m_streamsListView, SIGNAL(selectionChanged()), this, SLOT( selectedNewListItem()) ); + connect( m_DescriptionEdit, SIGNAL(textChanged(const QString&)), this, SLOT( descriptionChanged()) ); + connect( m_UrlEdit, SIGNAL(textChanged(const QString&)), this, SLOT( urlChanged()) ); + + // zeroconf +#if KDE_IS_VERSION(3,3,90) + connect(&m_browser, SIGNAL(serviceAdded(DNSSD::RemoteService::Ptr)), this, + SLOT(serviceAdded(DNSSD::RemoteService::Ptr))); + connect(&m_browser, SIGNAL(serviceRemoved(DNSSD::RemoteService::Ptr)), this, + SLOT(serviceRemoved(DNSSD::RemoteService::Ptr))); + m_browser.startBrowse(); +#endif +} + + +KStreamRipper::~KStreamRipper() +{ +} + + +void KStreamRipper::closeEvent( QCloseEvent *e ) +{ + KConfig *appConfig = KGlobal::config(); + + appConfig->writeEntry( "Destination", m_destEdit->text()); + appConfig->writeEntry( "Riptime", m_timeEdit->text()); + appConfig->writeEntry( "Command", m_tuneInEdit->text()); + appConfig->writeEntry( "Id3Tag", m_id3Checkbox->isChecked()); + + //save the listview entrys + + QStringList nameList,urlList,descList; + QListViewItemIterator iter( m_streamsListView ); + + while( iter.current() ) + { + ProcessListViewItem * ProcItem = (ProcessListViewItem*)iter.current(); + if(ProcItem->getProcessController()->getAutomatic()) continue; + + nameList.append( iter.current()->text( 0 )); + urlList.append( ProcItem->getProcessController()->getUrl() ); + descList.append( ProcItem->getProcessController()->getDescription() ); + ++iter; + } + + appConfig->writeEntry( "names", nameList ); + appConfig->writeEntry( "urls" , urlList ); + appConfig->writeEntry( "descs", descList ); + + appConfig->sync(); + + e->accept(); +} + + +//SLOTS +void KStreamRipper::addStreamButtonClicked() +{ + AddNewStreamImpl *test = new AddNewStreamImpl( this ); + connect( test, SIGNAL( finished( AddNewStreamImpl* )), this, SLOT( addStreamFinished( AddNewStreamImpl* )) ); + + test->show(); +} + +void KStreamRipper::deleteStreamButtonClicked() +{ + ProcessListViewItem * ProcItem = (ProcessListViewItem*)m_streamsListView->currentItem(); + stopRipButtonClicked(); + delete ProcItem; +} + +void KStreamRipper::tuneInButtonClicked() +{ + if( m_streamsListView->currentItem() ) + { + QString command = m_tuneInEdit->text().replace( "", m_UrlEdit->text() ); + + QStringList commands = QStringList::split( " ", command ); + + QProcess *process = new QProcess( this ); + process->setArguments( commands ); + + process->start(); + } + else ; +} + +#if KDE_IS_VERSION(3,3,90) +void KStreamRipper::serviceAdded(DNSSD::RemoteService::Ptr srv) +{ + ProcessListViewItem * proc = new ProcessListViewItem( m_streamsListView, srv->serviceName(), "", ""); + proc->getProcessController()->setUrl( QString("http://%1:%2%3").arg(srv->hostName()).arg(srv->port()).arg(srv->textData()["path"]) ); + proc->getProcessController()->setDescription( i18n("found by Zeroconf") ); + proc->getProcessController()->setAutomatic(true); + proc->getProcessController()->setService(srv); + +} +void KStreamRipper::serviceRemoved(DNSSD::RemoteService::Ptr srv) +{ + QListViewItemIterator iter( m_streamsListView ); + + while( iter.current() ) { + ProcessListViewItem * ProcItem = (ProcessListViewItem*)iter.current(); + if (ProcItem->getProcessController()->getAutomatic() && + srv==ProcItem->getProcessController()->getService()) { + delete ProcItem; + return; + } + ++iter; + } + +} +#endif + +void KStreamRipper::ripButtonClicked() +{ + if (KStandardDirs::findExe("streamripper")) { + ProcessListViewItem * ProcItem = (ProcessListViewItem*)m_streamsListView->currentItem(); + ProcItem->getProcessController()->startRip(m_destEdit->text(), m_timeEdit->text()); + m_ripButton->setEnabled( false ); + m_stopRipButton->setEnabled( true ); + } else { + KMessageBox::error(this, "The streamripper executable wasn't found. Make sure " + "it's in your path.", "streamripper not found"); + } +} + +void KStreamRipper::stopRipButtonClicked() +{ + ProcessListViewItem * ProcItem = (ProcessListViewItem*)m_streamsListView->currentItem(); + ProcItem->getProcessController()->stopRip(); + m_ripButton->setEnabled( true ); + m_stopRipButton->setEnabled( false ); +} + +void KStreamRipper::browseButtonClicked() +{ + QString openDest = KFileDialog::getExistingDirectory( QDir::homeDirPath(), + this, + "Select Destination..." ); + m_destEdit->setText( openDest ); +} + +void KStreamRipper::aboutButtonClicked() +{ + KAboutApplication *aboutApp = new KAboutApplication(); + aboutApp->show(); +} + +void KStreamRipper::quitButtonClicked() +{ + this->close(); +} + +void KStreamRipper::selectedNewListItem() +{ + if ( !m_streamsListView->selectedItem() ) { + m_deleteStreamButton->setEnabled( false ); + m_tuneInButton->setEnabled( false ); + m_ripButton->setEnabled( false ); + m_DescriptionEdit->setText( QString::null ); + m_DescriptionEdit->setEnabled(false); + m_UrlEdit->setEnabled(false); + m_UrlEdit->setText( QString::null ); + return; + } + ProcessController * ProcCtl = ((ProcessListViewItem*)m_streamsListView->currentItem())->getProcessController(); + + // reconfigure what the user is allowed to do based on if this process is ripping + m_ripButton->setEnabled( !ProcCtl->getStatus() ); + m_stopRipButton->setEnabled( ProcCtl->getStatus() ); + m_tuneInButton->setEnabled( true ); + m_deleteStreamButton->setEnabled( !ProcCtl->getAutomatic() ); + + m_DescriptionEdit->setText(ProcCtl->getDescription()); + m_DescriptionEdit->setEnabled(true); + m_UrlEdit->setText(ProcCtl->getUrl()); + m_UrlEdit->setEnabled( !ProcCtl->getAutomatic() ); + + + // maybe these are more elegant than the next two functions, assuming the slots are implemented in ProcessController + //connect(m_DescriptionEdit, SIGNAL(textChanged(const QString&)), (ProcessListViewItem*)m_streamsListView->currentItem()->getProcessController(), SIGNAL(descriptionChanged(const QString&)) + //connect(m_UrlEdit, SIGNAL(textChanged(const QString&)), (ProcessListViewItem*)m_streamsListView->currentItem()->getProcessController(), SIGNAL(urlChanged(const QString&)) +} + +void KStreamRipper::descriptionChanged() +{ + // maybe this should be deleted and the communication would be through a slot + ProcessListViewItem * ProcItem = (ProcessListViewItem*)m_streamsListView->currentItem(); + ProcItem->getProcessController()->setDescription(m_DescriptionEdit->text()); +} + +void KStreamRipper::urlChanged() +{ + // maybe this should be deleted and the communication would be through a slot + ProcessListViewItem * ProcItem = (ProcessListViewItem*)m_streamsListView->currentItem(); + ProcItem->getProcessController()->setUrl(m_UrlEdit->text()); +} + + +void KStreamRipper::addStreamFinished( AddNewStreamImpl *e ) +{ + ProcessListViewItem * proc = new ProcessListViewItem( m_streamsListView, e->d_nameEdit->text(), "", ""); + proc->getProcessController()->setUrl( e->d_urlEdit->text() ); + proc->getProcessController()->setDescription( e->d_descEdit->text() ); +} + diff --git a/src/kstreamripper.desktop b/src/kstreamripper.desktop new file mode 100644 index 0000000..3810f9f --- /dev/null +++ b/src/kstreamripper.desktop @@ -0,0 +1,16 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=KStreamRipper +Name[xx]=xxKStreamRipperxx +Exec=kstreamripper +Icon=kstreamripper +Type=Application +Comment=A simple KDE Application +Comment[da]=Et simpelt KDE program +Comment[es]=Una aplicación de KDE sencilla +Comment[hu]=Egyszerű KDE-alkalmazás +Comment[pt]=Uma aplicação KDE simples +Comment[pt_BR]=Um simples Aplicativo do KDE +Comment[sl]=Preprost program za KDE +Comment[sv]=Ett enkelt KDE-program +Comment[xx]=xxA simple KDE Applicationxx diff --git a/src/kstreamripper.h b/src/kstreamripper.h new file mode 100644 index 0000000..f1a5192 --- /dev/null +++ b/src/kstreamripper.h @@ -0,0 +1,79 @@ +/*************************************************************************** + * Copyright (C) 2003-2005 by Michael Goettsche * + * mail@tuxipuxi.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * 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. * + ***************************************************************************/ + +#ifndef KSTREAMRIPPER_H +#define KSTREAMRIPPER_H + +#include +#include "kstreamripperbase.h" +#if KDE_IS_VERSION(3,3,90) +#include +#include +#else +// damned moc will create slots regardless of #if macro +// this is hack to avoid undefined type +namespace DNSSD { namespace RemoteService { typedef int Ptr; } } +#endif + + +class AddNewStreamImpl; +class QString; + +class KStreamRipper : public KStreamRipperBase +{ + Q_OBJECT + +public: + + KStreamRipper( QWidget* parent = 0, const char* name = 0 ); + ~KStreamRipper(); + + virtual void closeEvent( QCloseEvent* ); +#if KDE_IS_VERSION(3,3,90) + DNSSD::ServiceBrowser m_browser; +#endif + +protected slots: + + void addStreamButtonClicked(); + void deleteStreamButtonClicked(); + void tuneInButtonClicked(); + void ripButtonClicked(); + void stopRipButtonClicked(); + void browseButtonClicked(); + void aboutButtonClicked(); + void quitButtonClicked(); + + void selectedNewListItem(); + void descriptionChanged(); + void urlChanged(); + + void addStreamFinished( AddNewStreamImpl* ); +#if KDE_IS_VERSION(3,3,90) + void serviceAdded(DNSSD::RemoteService::Ptr srv); + void serviceRemoved(DNSSD::RemoteService::Ptr srv); +#else + void serviceAdded(DNSSD::RemoteService::Ptr) {}; + void serviceRemoved(DNSSD::RemoteService::Ptr) {}; +#endif +}; + +#endif + diff --git a/src/kstreamripper.lsm b/src/kstreamripper.lsm new file mode 100644 index 0000000..0dbae01 --- /dev/null +++ b/src/kstreamripper.lsm @@ -0,0 +1,16 @@ +Begin3 +Title: KStreamRipper -- Some description +Version: 0.1 +Entered-date: +Description: +Keywords: KDE Qt +Author: Michael Goettsche +Maintained-by: Michael Goettsche +Home-page: +Alternate-site: +Primary-site: ftp://ftp.kde.org/pub/kde/unstable/apps/utils + xxxxxx kstreamripper-0.1.tar.gz + xxx kstreamripper-0.1.lsm +Platform: Linux. Needs KDE +Copying-policy: GPL +End diff --git a/src/kstreamripperbase.ui b/src/kstreamripperbase.ui new file mode 100644 index 0000000..fc87901 --- /dev/null +++ b/src/kstreamripperbase.ui @@ -0,0 +1,337 @@ + +KStreamRipperBase + + + KStreamRipperBase + + + + 0 + 0 + 749 + 782 + + + + KStreamRipper V. 0.3.4 + + + + unnamed + + + + spacer1 + + + Horizontal + + + Expanding + + + + 31 + 20 + + + + + + m_favoriteLabel + + + Your Radio Streams: + + + + + layout10 + + + + unnamed + + + + m_aboutButton + + + About + + + + + m_quitButton + + + &Quit + + + + + + + spacer5 + + + Horizontal + + + Expanding + + + + 421 + 21 + + + + + + m_streamsGroup + + + Stream Options + + + + unnamed + + + + m_addStreamButton + + + &Add Stream + + + Alt+A + + + + + m_deleteStreamButton + + + false + + + &Delete Stream + + + Alt+D + + + + + m_stopRipButton + + + false + + + &Stop Rip + + + Alt+S + + + false + + + + + m_tuneInButton + + + false + + + &Tune in + + + Alt+T + + + + + m_ripButton + + + false + + + &Rip Stream + + + Alt+R + + + + + + + m_streamsListView + + + true + + + AllColumns + + + Reject + + + + + m_settingsGroup + + + false + + + Settings + + + + unnamed + + + + m_pathLabel + + + Destination: + + + + + m_timeToRip + + + Time to Rip: + + + + + m_id3Label + + + Add ID3 Tag: + + + + + m_id3Checkbox + + + + + + true + + + + + m_tuneInLabel + + + Tune in Command: + + + + + m_secondsLabel + + + seconds + + + + + m_browseButton + + + .... + + + + + m_tuneInEdit + + + xmms <url> + + + + + m_timeEdit + + + 0 + + + + + m_destEdit + + + Choose a directory + + + + + + + m_Details + + + Details + + + + unnamed + + + + m_StreamDesc + + + Description: + + + + + m_StreamURL + + + URL: + + + + + m_UrlEdit + + + false + + + true + + + + + m_DescriptionEdit + + + false + + + + + + + + diff --git a/src/kstreamripperui.rc b/src/kstreamripperui.rc new file mode 100644 index 0000000..850885b --- /dev/null +++ b/src/kstreamripperui.rc @@ -0,0 +1,8 @@ + + + + C&ustom + + + + diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..81d8846 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,66 @@ +/*************************************************************************** + * Copyright (C) 2003-2005 by Michael Goettsche * + * mail@tuxipuxi.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * 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. * + ***************************************************************************/ + +#include +#include +#include + +#include "kstreamripper.h" + + +int main( int argc, char *argv[] ) +{ + KAboutData aboutApp( "KStreamRipper", I18N_NOOP( "KStreamRipper" ), "0.3.4", + "KStreamRipper is a Frontend to Streamripper. Visit Homepage for more Info.", + KAboutData::License_GPL, "(C) 2003-2005 Michael Goettsche", 0, + "http://kstreamripper.tuxipuxi.org", "mail@tuxipuxi.org" ); + + aboutApp.addAuthor( "Michael Goettsche", "Maintainer, Initial version", "mail@tuxipuxi.org" ); + aboutApp.addAuthor( "William Entriken", "Concurrent Ripping, Major UI improvements", "william.entriken@villanova.edu" ); + aboutApp.addCredit( "Kevin Krammer", "Assistance"); + aboutApp.addCredit( "Jakub Stachowski", "bksys migration, crash fix" ); + KCmdLineArgs::init( argc, argv, &aboutApp ); + + KApplication app; + + KStreamRipper *mainWidget = new KStreamRipper(); + + app.setMainWidget( mainWidget ); + mainWidget->show(); + + mainWidget->resize( 700, 600 ); + + return app.exec(); +} + + + + + + + + + + + + + + + diff --git a/src/processcontroller.cpp b/src/processcontroller.cpp new file mode 100644 index 0000000..f0dfb6c --- /dev/null +++ b/src/processcontroller.cpp @@ -0,0 +1,148 @@ +/*************************************************************************** + * Copyright (C) 2005 by Will Entriken * + * william.entriken@villanova.edu * + * * + * 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. * + ***************************************************************************/ + + +#include "processcontroller.h" +#include "processlistviewitem.h" + +ProcessController::ProcessController(ProcessListViewItem * parent) + : QObject((QObject *)parent), myParent(parent), myStatus(false), myAutomatic(false), myProcess(new QProcess(this)) +{ + connect (myProcess, SIGNAL( readyReadStdout() ), (ProcessController *) this, SLOT( readStdout()) ); + // connect (myProcess, SIGNAL( destroyed() ), myProcess, SLOT( kill()) ); + // this should work, according to http://doc.trolltech.com/3.2/qobject.html#~QObject but it doesn't +} + +ProcessController::~ProcessController() +{ + myProcess->kill(); +} + +void ProcessController::readStdout() +{ + QString tempOutput = myProcess->readStdout(); + + if( tempOutput.contains( "ripping..." )) + { + QString songname = tempOutput.mid( tempOutput.find( "]" )+1, tempOutput.findRev( "[" ) - tempOutput.find( "]" ) - 1); + myParent->setText( 1, songname.stripWhiteSpace() ); + + QString bytesR = tempOutput.mid( tempOutput.findRev( "[" )+1, tempOutput.findRev( "]" ) - tempOutput.findRev( "[" ) - 1); + myParent->setText( 2, bytesR.stripWhiteSpace() ); + } + + if( tempOutput.contains( "Connecting..." )) + { + myParent->setText( 1, "Connecting..." ); + myParent->setText( 2, "" ); + } + + if( tempOutput.contains( "buffering" )) + { + myParent->setText( 1, "Buffering..." ); + myParent->setText( 2, "" ); + } + + if( tempOutput.contains( "Time to stop is here" )) + { + myParent->setText( 1, "Complete" ); + myParent->setText( 2, "" ); + //QTimer::singleShot( 1500, myParent, SLOT( setEmptyText(3) )); + } +} + + +void ProcessController::startRip(QString destination, QString time) +{ + myStatus = true; + myParent->setText( 1, "Ripping" ); + + myProcess->clearArguments(); + myProcess->addArgument( "streamripper" ); + myProcess->addArgument( myUrl ); + myProcess->addArgument( "-d " ); + myProcess->addArgument( destination ); + if( time.toInt() ) + { + myProcess->addArgument( "-l " ); + myProcess->addArgument( time ); + } + + myProcess->setCommunication( QProcess::Stdout | QProcess::Stderr | QProcess::DupStderr ); + myProcess->start(); +} + + +void ProcessController::stopRip() +{ + myStatus = false; + myParent->setText( 1, "" ); + myParent->setText( 2, "" ); + + myProcess->tryTerminate(); + QTimer::singleShot( 2000, myProcess, SLOT( kill() ) ); +} + + +bool ProcessController::getStatus() +{ + return myStatus; +} + +QString ProcessController::getUrl() +{ + return myUrl; +} + +void ProcessController::setAutomatic(bool a) +{ + myAutomatic = a; +} + +bool ProcessController::getAutomatic() +{ + return myAutomatic; +} +#if KDE_IS_VERSION(3,3,90) +void ProcessController::setService(DNSSD::RemoteService::Ptr service) +{ + myService = service; +} + +DNSSD::RemoteService::Ptr ProcessController::getService() +{ + return myService; +} +#endif + +QString ProcessController::getDescription() +{ + return myDescription; +} + +void ProcessController::setUrl(QString Url) +{ + myUrl = Url; +} + +void ProcessController::setDescription(QString Description) +{ + myDescription = Description; +} diff --git a/src/processcontroller.h b/src/processcontroller.h new file mode 100644 index 0000000..22183df --- /dev/null +++ b/src/processcontroller.h @@ -0,0 +1,71 @@ +/*************************************************************************** + * Copyright (C) 2005 by Will Entriken * + * william.entriken@villanova.edu * + * * + * 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. * + ***************************************************************************/ + +#ifndef PROCESSCONTROLLER_H +#define PROCESSCONTROLLER_H + +#include +#include +#include +#include +#include +#if KDE_IS_VERSION(3,3,90) +#include +#endif + +class ProcessListViewItem; + +class ProcessController : public QObject +{ + Q_OBJECT +public: + ProcessController(ProcessListViewItem * parent); + ~ProcessController(); + + bool getStatus(); + bool getAutomatic(); + void setAutomatic(bool a); +#if KDE_IS_VERSION(3,3,90) + DNSSD::RemoteService::Ptr getService(); + void setService(DNSSD::RemoteService::Ptr service); +#endif + void setUrl(QString Url); + void setDescription(QString Description); + QString getUrl(); + QString getDescription(); + void startRip(QString destination, QString time); + void stopRip(); + +protected slots: + void readStdout(); + +private: + ProcessListViewItem * myParent; + bool myStatus; + bool myAutomatic; +#if KDE_IS_VERSION(3,3,90) + DNSSD::RemoteService::Ptr myService; +#endif + QProcess * myProcess; + QString myUrl; + QString myDescription; +}; + +#endif diff --git a/src/processlistviewitem.cpp b/src/processlistviewitem.cpp new file mode 100644 index 0000000..d2c88cc --- /dev/null +++ b/src/processlistviewitem.cpp @@ -0,0 +1,108 @@ +/*************************************************************************** + * Copyright (C) 2005 by Will Entriken * + * william.entriken@villanova.edu * + * * + * 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. * + ***************************************************************************/ + + +#include "processlistviewitem.h" + +#include "processlistviewitem.h" +#include "processcontroller.h" + +ProcessListViewItem::ProcessListViewItem( QListView * parent ) + : QListViewItem(parent), myProcessController(new ProcessController(this)) +{ +} + +ProcessListViewItem::ProcessListViewItem( QListViewItem * parent ) + : QListViewItem(parent), myProcessController(new ProcessController(this)) +{ +} + +ProcessListViewItem::ProcessListViewItem( QListView * parent, QListViewItem * after ) + : QListViewItem(parent, after), myProcessController(new ProcessController(this)) +{ +} + +ProcessListViewItem::ProcessListViewItem( QListViewItem * parent, QListViewItem * after ) + : QListViewItem(parent, after), myProcessController(new ProcessController(this)) +{ +} + +ProcessListViewItem::ProcessListViewItem( QListView * parent, + QString label1, + QString label2, + QString label3, + QString label4, + QString label5, + QString label6, + QString label7, + QString label8 ) + : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8), myProcessController(new ProcessController(this)) +{ +} + +ProcessListViewItem::ProcessListViewItem( QListViewItem * parent, + QString label1, + QString label2, + QString label3, + QString label4, + QString label5, + QString label6, + QString label7, + QString label8 ) + : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8), myProcessController(new ProcessController(this)) +{ +} + +ProcessListViewItem::ProcessListViewItem( QListView * parent, QListViewItem * after, + QString label1, + QString label2, + QString label3, + QString label4, + QString label5, + QString label6, + QString label7, + QString label8 ) + : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8), + myProcessController(new ProcessController(this)) +{ +} + +ProcessListViewItem::ProcessListViewItem( QListViewItem * parent, QListViewItem * after, + QString label1, + QString label2, + QString label3, + QString label4, + QString label5, + QString label6, + QString label7, + QString label8 ) + : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8), + myProcessController(new ProcessController(this)) +{ +} + +ProcessListViewItem::~ProcessListViewItem() +{ +} + +ProcessController * ProcessListViewItem::getProcessController() +{ + return myProcessController; +} diff --git a/src/processlistviewitem.h b/src/processlistviewitem.h new file mode 100644 index 0000000..aaa3e74 --- /dev/null +++ b/src/processlistviewitem.h @@ -0,0 +1,71 @@ +/*************************************************************************** + * Copyright (C) 2005 by Will Entriken * + * william.entriken@villanova.edu * + * * + * 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. * + ***************************************************************************/ + + +#ifndef PROCESSLISTVIEWITEM_H +#define PROCESSLISTVIEWITEM_H + +#include +#include +#include + +class ProcessController; + +class ProcessListViewItem : public QObject, public QListViewItem +{ + Q_OBJECT +public: + + ProcessListViewItem( QListView * parent ); + ProcessListViewItem( QListViewItem * parent ); + ProcessListViewItem( QListView * parent, QListViewItem * after ); + ProcessListViewItem( QListViewItem * parent, QListViewItem * after ); + + ProcessListViewItem( QListView * parent, + QString, QString = QString::null, + QString = QString::null, QString = QString::null, + QString = QString::null, QString = QString::null, + QString = QString::null, QString = QString::null ); + ProcessListViewItem( QListViewItem * parent, + QString, QString = QString::null, + QString = QString::null, QString = QString::null, + QString = QString::null, QString = QString::null, + QString = QString::null, QString = QString::null ); + + ProcessListViewItem( QListView * parent, QListViewItem * after, + QString, QString = QString::null, + QString = QString::null, QString = QString::null, + QString = QString::null, QString = QString::null, + QString = QString::null, QString = QString::null ); + ProcessListViewItem( QListViewItem * parent, QListViewItem * after, + QString, QString = QString::null, + QString = QString::null, QString = QString::null, + QString = QString::null, QString = QString::null, + QString = QString::null, QString = QString::null ); + + ~ProcessListViewItem(); + + ProcessController * getProcessController(); + +private: + ProcessController * myProcessController; +}; + +#endif diff --git a/src/processlistviewitem_interface.h b/src/processlistviewitem_interface.h new file mode 100644 index 0000000..49385fa --- /dev/null +++ b/src/processlistviewitem_interface.h @@ -0,0 +1,38 @@ +/*************************************************************************** + * Copyright (C) 2005 by Will Entriken * + * william.entriken@villanova.edu * + * * + * 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. * + ***************************************************************************/ + + +#ifndef __PROCESSLISTVIEWITEM_INTERFACE_H +#define __PROCESSLISTVIEWITEM_INTERFACE_H + +class ProcessListViewItemInterface +{ +public: + ProcessListViewItemInterface() {} + virtual ~ProcessListViewItemInterface() {} + + +private: + ProcessListViewItemInterface( const ProcessListViewItemInterface& source ); + void operator = ( const ProcessListViewItemInterface& source ); +}; + + +#endif // __PROCESSLISTVIEWITEM_INTERFACE_H diff --git a/templates/cpp b/templates/cpp new file mode 100644 index 0000000..1ad574e --- /dev/null +++ b/templates/cpp @@ -0,0 +1,19 @@ +/*************************************************************************** + * Copyright (C) 2003 by Michael Goettsche * + * mail@tuxipuxi.de * + * * + * 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. * + ***************************************************************************/ diff --git a/templates/h b/templates/h new file mode 100644 index 0000000..1ad574e --- /dev/null +++ b/templates/h @@ -0,0 +1,19 @@ +/*************************************************************************** + * Copyright (C) 2003 by Michael Goettsche * + * mail@tuxipuxi.de * + * * + * 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. * + ***************************************************************************/ diff --git a/unpack_local_scons.sh b/unpack_local_scons.sh new file mode 100755 index 0000000..a1266fc --- /dev/null +++ b/unpack_local_scons.sh @@ -0,0 +1,61 @@ +#!/bin/sh + +BOLD="\033[1m" +RED="\033[91m" +GREEN="\033[92m" +YELLOW="\033[93m" +CYAN="\033[96m" +NORMAL="\033[0m" + +#bunzip2 scons-mini.tar.bz2 +#tar xvf scons-mini.tar + +# if kde is there a recent tar should be too +tar xjvf scons-mini.tar.bz2 + +cat > Makefile << EOF +## Makefile automatically generated by unpack_local_scons.sh + +### To use scons when installed globally use +#SCONS=scons +### To run the local version instead, define +SCONS=./scons + +# scons : compile +# scons -c : clean +# scons install : install +# scons -c install : uninstall and clean + +# default target : use scons to build the programs +all: + \$(SCONS) -Q + +### There are several possibilities to help debugging : +# scons --debug=explain, scons --debug=tree .. +# +### To optimize the runtime, use +# scons --max-drift=1 --implicit-deps-unchanged +debug: + \$(SCONS) -Q --debug=tree + +clean: + \$(SCONS) -c + +install: + \$(SCONS) install + +uninstall: + \$(SCONS) -c install + +## this target creates a tarball of the project +dist: + \$(SCONS) dist +EOF + + +echo "" +echo -e $GREEN"A minimum scons distribution has been unpacked right here" +echo -e $GREEN"you can now run : "$NORMAL +echo -e $BOLD"./scons"$NORMAL +echo -e $BOLD"./scons install$NORMAL (as root probably)" +