Added KDE3 version of SoundKonverter

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/soundkonverter@1097614 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 15 years ago
commit f2cfda2a54

@ -0,0 +1 @@
Daniel Faust <hessijames@gmail.com>

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

@ -0,0 +1,199 @@
0.3.8:
-Fix: compile error with gcc 4.3
-Fix: filenames containing some special characters including '?' work again
-Fix: files added by 'add directory' or via context menu from konqueror and containing special characters will work now
-Fix: vfat compatible output names won't contain '/' anymore
0.3.7:
-Add: sox plugin for aiff (thanks to Ron Fischler)
-Add: toolame and twolame plugins for mp2 encoding
-Add: amr decoding with ffmpeg
-Add: Improved Polish translation (thanks to Michał Smoczyk)
-Add: Reading writing composer/disc number tags for tta files
-Add: A user script can be executed after each file has been converted (->config dialog->general->user script)
-Add: Hungarian and Italian translations (thanks to the language teams at launchpad)
-Fix: Flake plugin
-Fix: Wavpack encoding
-Fix: Dropping folders works again
-Fix: Use the current language's decimal symbol for oggenc
-Fix: Progress for lame abr/cbr encoding
-Fix: mp4v2 works now
-Fix: soundkonverter won't display wrong backends in the config dialog any more
-Fix: And a lot more ...
-Change: Use --vbr-new for lame
-Change: Use extension to determine file type if no mime type file was found
0.3.6:
-Fix: Don't crash when using kio_audiocd
-Fix: Show progress when using kio_audiocd
-Fix: Show the soundkonverter window when started with --rip option
-Fix: Handle remote files properly (http, smb, etc.)
0.3.5:
-Add: Portuguese translation (thanks to Equipa de Traduções 1 / www.portugal-a-programar.org)
-Add: Dutch translation (thanks to Sander Thijsen)
-Add: Improved Polish translation (thanks to Tomasz Argasiński)
-Add: Improved Russian translation (thanks to Ivan)
-Add: Support for flake (flac encoder)
-Add: Support for aften (ac3 encoder)
-Add: File format filter for adding a directory recursive
-Add: Tag reading/writing support for wavpack, optimfrog, trueaudio
-Add: Read Replay Gain tags for wavpack files
-Fix: Write m4a tags properly
-Fix: Some problems with the CD-Ripper dialog
-Fix: File filter for the Replay Gain tool
-Fix: Close soundKonverter faster
-Change: Use 'cp' for copying local files (hopefully fixes the 'get file bug')
0.3.4:
-Add: Polish translation (thanks to qla)
-Add: Brazilian Portuguese translation (thanks to Leandro Santiago da Silva)
-Add: Spanish translation (thanks to Adrian Capel)
-Add: Support for ttaenc and bonk
-Add: Support for wvgain
-Fix: Show Replay Gain of flac files correctly
-Fix: Don't recalculate Replay Gain, if all files in an album show the same gain
-Fix: Some minor fixes
-Remove: Plugin update feature because my website is down
0.3.3:
-Add: Russian translation (thanks to Ivan)
-Fix: Support autoconf >= 2.60 and automake >= 1.10 (thanks to Darwin Bautista)
0.3.2:
-Add: French translation (thanks to Placisfos)
-Add: Support for TiMidity++ (decoding midi files)
-Fix: Display notification when a backend doesn't provide progress data
-Fix: Added audio/x-m4a mime type
0.3.1:
-Add: Support for aacgain
-Add: Backend information in the readme file
-Fix: 2 Bugs where plugins couldn't be found
0.3:
-Fix: Log viewer now gets updated correctly
-Fix: Replay Gain plugins in single file mode read output correctly
-Fix: File length is guessed, when tags can't be read (except remote files)
-Fix: Some special characters in file names were not supported: "?", "#", "/"
-Fix: Made english command line arguments work independent of the current language
-Fix: Made notification for new backends and plugin updates work
-Fix: Changing the output directory in simple mode would not be respected
-Fix: Some minor fixes
0.3 rc1:
-Fix: Output names for CD tracks corrected
-Fix: Added 'hack' for writing id3v2 genre and year properly
-Fix: Reading backend output was improved
-Fix: Conversion of remote files
-Fix: Support for more kio slaves (system:/)
-Fix: Bug in service menu creation
-Fix: Improved the log viewer
-Fix: Previous options wouldn't be loaded properly
-Fix: Don't save last options, when started in invisible mode
-Fix: Detection of profiles wouldn't work properly
-Fix: Output directories sometimes got disarranged
-Fix: Using SIGKILL instead of SIGTERM solves a few problems
-Fix: Added check for cdparanoia in 'configure' (not tested)
-Fix: Some minor bugs
-Add: System tray icon, when starting soundKonverter in invisible mode
-Add: Amarok script works now (but it's very worthy of improvement)
-Add: German translation (plugin translations missing)
0.3 beta1:
-Fix: Backends configuration page is rebuild properly and some general fixes
-Fix: Adding directories by dropping them, improved progress bar
-Fix: Code cleanups in the Replay Gain tool
-Fix: Always load the latest plugins available
-Fix: Make the tool bar work
-Add: Boyan Tabakov's patch for selecting cddb entries, if there were multiple found
-Add: Quality parameter preview as tool tip of the quality spin box
-Add: Force VFAT compatible output file names
-Add: Automaticly save file list when adding new items and converting items
-Change: The 'Copy directory structure' feature produces shorter paths
-Change: Removed the 'Default output directory', 'By meta data' is now default
-Change: Removed the about plugins dialog and added a plugins configuration page to the configuration dialog
-Change: The backends process priority has been moved to the config dialog
0.3 alpha1:
Changed almost everything. The most important changes are:
-Add: CD ripping (including cddb and support for multiple devices and simultaneous ripping)
-Add: Converting multiple files at once
-Add: Editing of output options and tags
-Add: Support for discnumber and composer tags for ogg, mp3 and flac files
-Add: Tagging support for wma, ape, mp4, aac, aa and rm files
-Add: Support for Replay Gain in album mode including extended Replay Gain Tool
-Add: Custom profiles (including user defined commands)
-Add: Basic support for hybrid compression
-Add: KIO support (partly)
-Change: GUI cleanups
A big change is that soundKonverter now uses mime types. Unfortunately this causes a lot of problems.
Please report missing/wrong mime types!
0.2:
Nothing done!
0.2 rc2:
-Fix: Saving last options works now with different languages
-Fix: Calculation of remaining time corrected
-Fix: Replace / through \ when these characters are in tags that build the new file name
-Fix: When %[aAbBcCgGnNtTyY] is in a tag, it will not be replaced by the tag any longer.
-Fix: After a conversion is completed, the progress is calculated correct now.
Big thanks to Peter.
0.2 rc1:
-Fix: Several bugs
-Add: Last options are saved now (Thx Angelo)
-Add: German Translation
0.2 beta2:
-Fix: The output directory text box now isn't cleared after finishing a job. Thx Miguel
-Fix: The backend outputs are now read
-Fix: Setting the backend priority works now. For setting to a higher priority the root password is asked (kdesu)
-Fix: The toolbar works now correct
-Change: The menu can't be hidden now
-Change: The userinterface has been changed a bit. Thx Miguel
-Change: The Cue Editor now adds 0,5 sec. to each track
-Add: Spanish translation (partly) Thx Adrian Capel
0.2 beta1:
-Fix: Moving the columns in the file list works now
-Change: You can now extend soundkonverter by plugins
-Change: We have now a menu and a (not complete working) toolbar
-Add: Support for ReplayGain
-Add: Convert the next file if an error happens
-Add: Load the last file list, if soundkonverter crashed
-Add: Scan for new backends and plugins on startup
-Add: A ReplayGain tool for tagging/untagging files
-Add: A cue-Editor - just a supplement to all these tag editors out there - documentation will follow
-Add: An amaroK-Script for easily accessing soundKonverter from out of amaroK
-Add: Support for creating output directories by the file's tags/copy the file's source directory structure
0.1:
-Fix: Some spelling errors
-Fix: A compilation error
(Nothing really new, there is no need to upgrade)
0.1 RC1:
-Fix: Installation of the servicemenu file
-Fix: Support for wma decoder if only mplayer was found
-Fix: 'Default' button in configuration Dialog
-Fix: Progressbar
-Change: Modifyed the userinterface a little bit
-Change: English handbook is now complete
-Add: German handbook
0.1 beta2 update:
-Fix: Compilation error
-Fix: Scan for backends automatic
0.1 beta2:
-Fix: KUniqueApplication works now
-Fix: A few irritations
-Add: Formats: ape, mpc
-Add: Translation: German
-Add: Handbook: English (not jet complete)
-Add: Some small features
0.1 beta1:
Initial Release

@ -0,0 +1,167 @@
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes a while. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Type `make install' to install the programs and any data files and
documentation.
4. You can remove the program binaries and object files from the
source code directory by typing `make clean'.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made.
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.

@ -0,0 +1,22 @@
SUBDIRS = $(TOPSUBDIRS)
$(top_srcdir)/configure.in: configure.in.in $(top_srcdir)/subdirs
cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common configure.in ;
$(top_srcdir)/subdirs:
cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common subdirs
$(top_srcdir)/acinclude.m4: $(top_srcdir)/admin/acinclude.m4.in $(top_srcdir)/admin/libtool.m4.in
@cd $(top_srcdir) && cat admin/acinclude.m4.in admin/libtool.m4.in > acinclude.m4
MAINTAINERCLEANFILES = subdirs configure.in acinclude.m4 configure.files
package-messages:
cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common package-messages
$(MAKE) -C po merge
EXTRA_DIST = admin COPYING configure.in.in
dist-hook:
cd $(top_distdir) && perl admin/am_edit -padmin
cd $(top_distdir) && $(MAKE) -f admin/Makefile.common subdirs

@ -0,0 +1,10 @@
all:
@echo "This Makefile is only for the CVS repository"
@echo "This will be deleted before making the distribution"
@echo ""
$(MAKE) -f admin/Makefile.common cvs
dist:
$(MAKE) -f admin/Makefile.common dist
.SILENT:

160
README

@ -0,0 +1,160 @@
CONTENT
=======
1. About soundKonverter
2. Backends
3. Compile soundKonverter
4. Known bugs
1. About soundKonverter 0.3.8
=============================
- Released by Daniel Faust (hessijames@gmail.com) under the terms of the GPL v2 -
soundKonverter is frontend to various audio converters.
The key features are:
- Audio conversion
- Replay Gain calculation
- CD ripping
It is extendable by plugins and supports many backends:
En-/decoding: oggenc/oggdec, lame, gogo, faac/faad, mppenc/mppdec, flac, mac, mplayer, ffmpeg, shorten, ttaenc, bonk, ofr, ofs, wavpack, lac, lpac, speexenc/speexdec, timidity
Replay Gain: vorbisgain, mp3gain, aacgain, replaygain (MusePack), metaflac, wvgain
CD ripping: kio_audiocd, cdda2wav, cdparanoia
This way you can convert between various audio formats:
Decoding: ogg, mp3, mp2, m4a/mp4, aac, 3gp, mpc/mp+, flac, ape, wma, asf/asx, ra, rv, rm, avi, mpeg, wmv, qt/mov, flv, ac3, au/snd, shn, tta, bonk, ofr, ofs, wv, la, pac, spx, mid, mod/s3m/stm/ult/uni/xm/m15/mtm/669/it, wav
Encoing: ogg, mp3, mp2, m4a, aac, mpc, flac, ape, ra, ac3, au, shn, tta, bonk, ofr, ofs, wv, la, pac, spx, wav
soundKonverter supports reading and writing tags for many formats, so the tags are preserved when converting files.
It comes with an Amarok script that allows you to easily transcode files when transfering to your media device.
And it is avalable in English, German, French, Spanish, Russian, Polish and Brazilian Portuguese.
2. Backends
===========
110.oggvorbis.soundkonverter.xml
http://www.vorbis.com
120.lame.soundkonverter.xml
http://lame.sf.net
122.twolame.soundkonverter.xml
http://www.twolame.org
123.toolame.soundkonverter.xml
http://toolame.sourceforge.net
125.gogo.soundkonverter.xml
http://homepage2.nifty.com/kei-i/
127.faac.soundkonverter.xml
http://www.audiocoding.com
130.musepack.soundkonverter.xml
http://www.musepack.net
135.flac.soundkonverter.xml
http://flac.sourceforge.net
137.mac.soundkonverter.xml
http://www.monkeysaudio.com
140.mplayer.soundkonverter.xml
http://www.mplayerhq.hu
145.ffmpeg.soundkonverter.xml
http://ffmpeg.mplayerhq.hu
146.ffmpeg-lossless.soundkonverter.xml
Same as above, splitted just for internal use!
150.shorten.soundkonverter.xml
http://www.hornig.net/shorten.html
151.tta.soundkonverter.xml
http://tta.sourceforge.net
153.bonk.soundkonverter.xml
http://www.logarithmic.net/pfh/bonk/
155.optimfrog.soundkonverter.xml
http://www.losslessaudio.org
156.optimfrog-dualstream.soundkonverter.xml
http://www.losslessaudio.org
158.wavpack.soundkonverter.xml
http://www.wavpack.com
160.lac.soundkonverter.xml
Important: Rename the encoder "la" to "lac" because "la" is already used on linux!
http://www.lossless-audio.com
165.lpac.soundkonverter.xml
http://www.nue.tu-berlin.de/wer/liebchen/lpac.html
170.speex.soundkonverter.xml
http://www.speex.org
180.timidity.soundkonverter.xml
http://timidity.sourceforge.net
210.vorbisgain.soundkonverter.xml
http://sjeng.org/vorbisgain.html
220.mp3gain.soundkonverter.xml
http://mp3gain.sourceforge.net
225.aacgain.soundkonverter.xml
http://altosdesign.com/aacgain/
230.replaygain.soundkonverter.xml
This is the Replay Gain tool for musepack files!
http://www.musepack.net
240.metaflac.soundkonverter.xml
http://flac.sourceforge.net
250.wvgain.soundkonverter.xml
http://www.wavpack.com
310.cdda2wav.soundkonverter.xml
http://www.cdda2wav.de
320.cdparanoia.soundkonverter.xml
http://xiph.org/paranoia/
3. Compile soundKonverter
=========================
In order to compile soundKonverter, you need:
- taglib-devel 1.4.0 (libtaglib-devel on mandriva)
- cdparanoia (libcdda-devel on mandriva, cdparanoia-devel on fedora)
On some operating systems, the cdda check (cdparanoia) in ./configure may fail.
This is because sometimes the header files are at another location (eg. /usr/include/cdda instead of /usr/include on ark linux).
In this case remove the cdparanoia check from the configure.in.in file.
4. Known bugs
=============
- The options tabs get out of sync in some very rare cases
- taglib check in ./configure may fail
Backends that's output cant't be read:
- The progress of some backends can't be read properly
A big change is that soundKonverter now uses mime types.
If you find problems, please tell me about it.
Thanks to all Open Source programmers for their apps that I used to get some code.
Especially Kaffeine and Amarok.
Have a lot of fun.
Please send bug reports directly to hessijames@gmail.com

File diff suppressed because it is too large Load Diff

@ -0,0 +1,259 @@
/* config.h.in. Generated from configure.in by autoheader. */
/* Define to 1 if you have the <Carbon/Carbon.h> header file. */
#undef HAVE_CARBON_CARBON_H
/* Define to 1 if you have the <cdda_interface.h> header file. */
#undef HAVE_CDDA_INTERFACE_H
/* Define if you have the CoreAudio API */
#undef HAVE_COREAUDIO
/* Define to 1 if you have the <crt_externs.h> header file. */
#undef HAVE_CRT_EXTERNS_H
/* Defines if your system has the crypt function */
#undef HAVE_CRYPT
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define if you have libjpeg */
#undef HAVE_LIBJPEG
/* Define if you have libpng */
#undef HAVE_LIBPNG
/* Define if you have a working libpthread (will enable threaded code) */
#undef HAVE_LIBPTHREAD
/* Define if you have libz */
#undef HAVE_LIBZ
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* have mp4v2 */
#undef HAVE_MP4V2
/* Define to 1 if you have the <mp4.h> header file. */
#undef HAVE_MP4_H
/* Define if your system needs _NSGetEnviron to set up the environment */
#undef HAVE_NSGETENVIRON
/* Define if you have res_init */
#undef HAVE_RES_INIT
/* Define if you have the res_init prototype */
#undef HAVE_RES_INIT_PROTO
/* Define if you have a STL implementation by SGI */
#undef HAVE_SGI_STL
/* Define to 1 if you have the `snprintf' function. */
#undef HAVE_SNPRINTF
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define if you have strlcat */
#undef HAVE_STRLCAT
/* Define if you have the strlcat prototype */
#undef HAVE_STRLCAT_PROTO
/* Define if you have strlcpy */
#undef HAVE_STRLCPY
/* Define if you have the strlcpy prototype */
#undef HAVE_STRLCPY_PROTO
/* Define to 1 if you have the <systems.h> header file. */
#undef HAVE_SYSTEMS_H
/* Define to 1 if you have the <sys/bitypes.h> header file. */
#undef HAVE_SYS_BITYPES_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* have TagLib */
#undef HAVE_TAGLIB
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the `vsnprintf' function. */
#undef HAVE_VSNPRINTF
/* Suffix for lib directories */
#undef KDELIBSUFF
/* Define a safe value for MAXPATHLEN */
#undef KDEMAXPATHLEN
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* The size of `char *', as computed by sizeof. */
#undef SIZEOF_CHAR_P
/* The size of `int', as computed by sizeof. */
#undef SIZEOF_INT
/* The size of `long', as computed by sizeof. */
#undef SIZEOF_LONG
/* The size of `short', as computed by sizeof. */
#undef SIZEOF_SHORT
/* The size of `size_t', as computed by sizeof. */
#undef SIZEOF_SIZE_T
/* The size of `unsigned long', as computed by sizeof. */
#undef SIZEOF_UNSIGNED_LONG
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION
/* Defined if compiling without arts */
#undef WITHOUT_ARTS
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN
/*
* jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system
* headers and I'm too lazy to write a configure test as long as only
* unixware is related
*/
#ifdef _UNIXWARE
#define HAVE_BOOLEAN
#endif
/*
* AIX defines FD_SET in terms of bzero, but fails to include <strings.h>
* that defines bzero.
*/
#if defined(_AIX)
#include <strings.h>
#endif
#if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H)
# include <sys/time.h>
# include <crt_externs.h>
# define environ (*_NSGetEnviron())
#endif
#if !defined(HAVE_RES_INIT_PROTO)
#ifdef __cplusplus
extern "C" {
#endif
int res_init(void);
#ifdef __cplusplus
}
#endif
#endif
#if !defined(HAVE_STRLCAT_PROTO)
#ifdef __cplusplus
extern "C" {
#endif
unsigned long strlcat(char*, const char*, unsigned long);
#ifdef __cplusplus
}
#endif
#endif
#if !defined(HAVE_STRLCPY_PROTO)
#ifdef __cplusplus
extern "C" {
#endif
unsigned long strlcpy(char*, const char*, unsigned long);
#ifdef __cplusplus
}
#endif
#endif
/*
* On HP-UX, the declaration of vsnprintf() is needed every time !
*/
#if !defined(HAVE_VSNPRINTF) || defined(hpux)
#if __STDC__
#include <stdarg.h>
#include <stdlib.h>
#else
#include <varargs.h>
#endif
#ifdef __cplusplus
extern "C"
#endif
int vsnprintf(char *str, size_t n, char const *fmt, va_list ap);
#ifdef __cplusplus
extern "C"
#endif
int snprintf(char *str, size_t n, char const *fmt, ...);
#endif
#if defined(__SVR4) && !defined(__svr4__)
#define __svr4__ 1
#endif
/* type to use in place of socklen_t if not defined */
#undef kde_socklen_t
/* type to use in place of socklen_t if not defined (deprecated, use
kde_socklen_t) */
#undef ksize_t

@ -0,0 +1,2 @@
./admin/configure.in.min
configure.in.in

@ -0,0 +1,282 @@
dnl =======================================================
dnl FILE: ./admin/configure.in.min
dnl =======================================================
dnl This file is part of the KDE libraries/packages
dnl Copyright (C) 2001 Stephan Kulow (coolo@kde.org)
dnl This file is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Library General Public
dnl License as published by the Free Software Foundation; either
dnl version 2 of the License, or (at your option) any later version.
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Library General Public License for more details.
dnl You should have received a copy of the GNU Library General Public License
dnl along with this library; see the file COPYING.LIB. If not, write to
dnl the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
dnl Boston, MA 02110-1301, USA.
# Original Author was Kalle@kde.org
# I lifted it in some mater. (Stephan Kulow)
# I used much code from Janos Farkas
dnl Process this file with autoconf to produce a configure script.
AC_INIT(acinclude.m4) dnl a source file from your sub dir
dnl This is so we can use kde-common
AC_CONFIG_AUX_DIR(admin)
dnl This ksh/zsh feature conflicts with `cd blah ; pwd`
unset CDPATH
dnl Checking host/target/build systems, for make, install etc.
AC_CANONICAL_SYSTEM
dnl Perform program name transformation
AC_ARG_PROGRAM
dnl Automake doc recommends to do this only here. (Janos)
AM_INIT_AUTOMAKE(soundkonverter, 0.3.7) dnl searches for some needed programs
KDE_SET_PREFIX
dnl generate the config header
AM_CONFIG_HEADER(config.h) dnl at the distribution this done
dnl Checks for programs.
AC_CHECK_COMPILERS
AC_ENABLE_SHARED(yes)
AC_ENABLE_STATIC(no)
KDE_PROG_LIBTOOL
dnl for NLS support. Call them in this order!
dnl WITH_NLS is for the po files
AM_KDE_WITH_NLS
KDE_USE_QT(3.2.0)
AC_PATH_KDE
dnl =======================================================
dnl FILE: configure.in.in
dnl =======================================================
#MIN_CONFIG(3.2.0)
dnl PACKAGE set before
AC_C_BIGENDIAN
AC_CHECK_KDEMAXPATHLEN
###############################################################################
# BEGIN CDPARANOIA CHECK
###############################################################################
#
#AC_CHECK_HEADER([cdda_interface.h], [with_cdparanoia=yes], [with_cdparanoia=no])
#
#if test "$with_cdparanoia" != "yes" ; then
# soundkonverter_error_nocdparanoia=yes
# DO_NOT_COMPILE="$DO_NOT_COMPILE soundkonverter"
# no_soundkonverter=yes
#
# echo ""
# echo "-----------------------------------------"
# echo "ERROR: Could not find cdparanoia headers."
# echo "-----------------------------------------"
# echo ""
#
# AC_MSG_ERROR([could not find cdparanoia headers])
#fi
#
###############################################################################
# END CDPARANOIA CHECK
###############################################################################
dnl -------------------------------------
dnl cdparanoia check
dnl -------------------------------------
AC_CHECK_HEADERS(cdda_interface.h, have_paranoia="yes", have_paranoia="no" )
dnl ----------------------------------
dnl Can soundkonverter be compiled?
dnl ----------------------------------
if test x$have_paranoia != xyes; then
DO_NOT_COMPILE="$DO_NOT_COMPILE soundkonverter"
no_paranoia=yes
fi
###############################################################################
# BEGIN TAGLIB CHECK
###############################################################################
TAGLIB_REQ_VERSION="1.4.0";
AC_DEFUN([VERSION_TO_NUMBER], [`$1 | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1* 1000 + [$]2) * 1000 + [$]3;}'`])
AC_PATH_PROG(TAGLIB_CONFIG, taglib-config, no)
if test "x$TAGLIB_CONFIG" = "xno" ; then
soundkonverter_error_notaglib=yes
DO_NOT_COMPILE="$DO_NOT_COMPILE soundkonverter"
no_soundkonverter=yes
else
AC_DEFINE(HAVE_TAGLIB, 1, [have TagLib])
taglib_includes=[`$TAGLIB_CONFIG --cflags`]
taglib_libs=[`$TAGLIB_CONFIG --libs`]
taglib_version=[`$TAGLIB_CONFIG --version`]
if test VERSION_TO_NUMBER(echo $taglib_version) -lt VERSION_TO_NUMBER(echo $TAGLIB_REQ_VERSION); then
soundkonverter_error_taglibold=yes
DO_NOT_COMPILE="$DO_NOT_COMPILE soundkonverter"
no_soundkonverter=yes
fi
fi
AC_SUBST(taglib_includes)
AC_SUBST(taglib_libs)
###############################################################################
# END TAGLIB CHECK
###############################################################################
###############################################################################
# BEGIN MP4V2 CHECK
###############################################################################
# m4a/aac tag reading and writing needs libmp4v2 from faad2 or better mpeg4ip
AC_ARG_WITH(mp4v2,
AC_HELP_STRING([--with-mp4v2],[build soundkonverter with M4A/AAC tag support from mp4v2/faad2]),
[have_mp4v2=$withval],
[have_mp4v2=no]
)
AC_ARG_WITH(mp4v2-dir,
AC_HELP_STRING([--with-mp4v2-dir],[path to mp4v2 [default=/usr]]),
[mp4v2_dir="$withval"],
[mp4v2_dir=/usr]
)
if test "$have_mp4v2" != "no"; then
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
ac_cxxflags_save=$CXXFLAGS
CXXFLAGS="$CXXFLAGS -I$mp4v2_dir/include"
ac_ldflags_save=$LDFLAGS
LDFLAGS="$LDFLAGS -L$mp4v2_dir/lib"
# not even everyone using faad2 has <systems.h>
if ! test -f config.h; then
echo "#include \"confdefs.h\"" > config.h
fi
ac_cppflags_save=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -I."
AC_CHECK_HEADERS(systems.h)
AC_CHECK_HEADERS([mp4.h], [have_mp4_h=yes], [],
[#ifdef HAVE_SYSTEMS_H
# include <systems.h>
#endif
])
AC_CHECK_LIB( mp4v2, MP4Read, have_mp4v2=yes, have_mp4v2=no )
if test "$have_mp4v2" = "yes" -a "$have_mp4_h" = "yes"; then
AC_DEFINE(HAVE_MP4V2, 1, [have mp4v2])
MP4V2_INCLUDES="-I$mp4v2_dir/include"
MP4V2_LIBS="-L$mp4v2_dir/lib -lmp4v2"
else
have_mp4v2=no
fi
CPPFLAGS=$ac_cppflags_save
CXXFLAGS=$ac_cxxflags_save
LDFLAGS=$ac_ldflags_save
AC_LANG_RESTORE
fi
AC_SUBST(MP4V2_INCLUDES)
AC_SUBST(MP4V2_LIBS)
AM_CONDITIONAL(with_mp4v2, [test x$have_mp4v2 != xno ])
###############################################################################
# END MP4V2 CHECK
###############################################################################
KDE_CREATE_SUBDIRSLIST
AC_CONFIG_FILES([ Makefile ])
AC_CONFIG_FILES([ doc/Makefile ])
AC_CONFIG_FILES([ doc/en/Makefile ])
AC_CONFIG_FILES([ po/Makefile ])
AC_CONFIG_FILES([ src/Makefile ])
AC_CONFIG_FILES([ src/amarokscript/Makefile ])
AC_CONFIG_FILES([ src/metadata/Makefile ])
AC_CONFIG_FILES([ src/metadata/aac/Makefile ])
AC_CONFIG_FILES([ src/metadata/ape/Makefile ])
AC_CONFIG_FILES([ src/metadata/asf/Makefile ])
AC_CONFIG_FILES([ src/metadata/audible/Makefile ])
AC_CONFIG_FILES([ src/metadata/m4a/Makefile ])
AC_CONFIG_FILES([ src/metadata/mp4/Makefile ])
AC_CONFIG_FILES([ src/metadata/optimfrog/Makefile ])
AC_CONFIG_FILES([ src/metadata/rmff/Makefile ])
AC_CONFIG_FILES([ src/metadata/speex/Makefile ])
AC_CONFIG_FILES([ src/metadata/trueaudio/Makefile ])
AC_CONFIG_FILES([ src/metadata/wav/Makefile ])
AC_CONFIG_FILES([ src/metadata/wavpack/Makefile ])
AC_CONFIG_FILES([ src/pics/Makefile ])
AC_CONFIG_FILES([ src/pluginloader/Makefile ])
AC_CONFIG_FILES([ src/plugins/Makefile ])
AC_CONFIG_FILES([ src/plugins/format_infos/Makefile ])
AC_CONFIG_FILES([ src/plugins/mime_types/Makefile ])
AC_CONFIG_FILES([ src/plugins/plugins/Makefile ])
AC_CONFIG_FILES([ src/plugins/rohling/Makefile ])
AC_OUTPUT
# Check if KDE_SET_PREFIX was called, and --prefix was passed to configure
if test -n "$kde_libs_prefix" -a -n "$given_prefix"; then
# And if so, warn when they don't match
if test "$kde_libs_prefix" != "$given_prefix"; then
# And if kde doesn't know about the prefix yet
echo ":"`kde-config --path exe`":" | grep ":$given_prefix/bin/:" 2>&1 >/dev/null
if test $? -ne 0; then
echo ""
echo "Warning: you chose to install this package in $given_prefix,"
echo "but KDE was found in $kde_libs_prefix."
echo "For this to work, you will need to tell KDE about the new prefix, by ensuring"
echo "that KDEDIRS contains it, e.g. export KDEDIRS=$given_prefix:$kde_libs_prefix"
echo "Then restart KDE."
echo ""
fi
fi
fi
if test x$GXX = "xyes" -a x$kde_have_gcc_visibility = "xyes" -a x$kde_cv_val_qt_gcc_visibility_patched = "xno"; then
echo ""
echo "Your GCC supports symbol visibility, but the patch for Qt supporting visibility"
echo "was not included. Therefore, GCC symbol visibility support remains disabled."
echo ""
echo "For better performance, consider including the Qt visibility supporting patch"
echo "located at:"
echo ""
echo "http://bugs.kde.org/show_bug.cgi?id=109386"
echo ""
echo "and recompile all of Qt and KDE. Note, this is entirely optional and"
echo "everything will continue to work just fine without it."
echo ""
fi
if test "$all_tests" = "bad"; then
if test ! "$cache_file" = "/dev/null"; then
echo ""
echo "Please remove the file $cache_file after changing your setup"
echo "so that configure will find the changes next time."
echo ""
fi
else
echo ""
echo "Good - your configure finished. Start make now"
echo ""
fi

@ -0,0 +1,144 @@
#MIN_CONFIG(3.2.0)
AM_INIT_AUTOMAKE(soundkonverter, 0.3.7)
AC_C_BIGENDIAN
AC_CHECK_KDEMAXPATHLEN
###############################################################################
# BEGIN CDPARANOIA CHECK
###############################################################################
#
#AC_CHECK_HEADER([cdda_interface.h], [with_cdparanoia=yes], [with_cdparanoia=no])
#
#if test "$with_cdparanoia" != "yes" ; then
# soundkonverter_error_nocdparanoia=yes
# DO_NOT_COMPILE="$DO_NOT_COMPILE soundkonverter"
# no_soundkonverter=yes
#
# echo ""
# echo "-----------------------------------------"
# echo "ERROR: Could not find cdparanoia headers."
# echo "-----------------------------------------"
# echo ""
#
# AC_MSG_ERROR([could not find cdparanoia headers])
#fi
#
###############################################################################
# END CDPARANOIA CHECK
###############################################################################
dnl -------------------------------------
dnl cdparanoia check
dnl -------------------------------------
AC_CHECK_HEADERS(cdda_interface.h, have_paranoia="yes", have_paranoia="no" )
dnl ----------------------------------
dnl Can soundkonverter be compiled?
dnl ----------------------------------
if test x$have_paranoia != xyes; then
DO_NOT_COMPILE="$DO_NOT_COMPILE soundkonverter"
no_paranoia=yes
fi
###############################################################################
# BEGIN TAGLIB CHECK
###############################################################################
TAGLIB_REQ_VERSION="1.4.0";
AC_DEFUN([VERSION_TO_NUMBER], [`$1 | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1* 1000 + [$]2) * 1000 + [$]3;}'`])
AC_PATH_PROG(TAGLIB_CONFIG, taglib-config, no)
if test "x$TAGLIB_CONFIG" = "xno" ; then
soundkonverter_error_notaglib=yes
DO_NOT_COMPILE="$DO_NOT_COMPILE soundkonverter"
no_soundkonverter=yes
else
AC_DEFINE(HAVE_TAGLIB, 1, [have TagLib])
taglib_includes=[`$TAGLIB_CONFIG --cflags`]
taglib_libs=[`$TAGLIB_CONFIG --libs`]
taglib_version=[`$TAGLIB_CONFIG --version`]
if test VERSION_TO_NUMBER(echo $taglib_version) -lt VERSION_TO_NUMBER(echo $TAGLIB_REQ_VERSION); then
soundkonverter_error_taglibold=yes
DO_NOT_COMPILE="$DO_NOT_COMPILE soundkonverter"
no_soundkonverter=yes
fi
fi
AC_SUBST(taglib_includes)
AC_SUBST(taglib_libs)
###############################################################################
# END TAGLIB CHECK
###############################################################################
###############################################################################
# BEGIN MP4V2 CHECK
###############################################################################
# m4a/aac tag reading and writing needs libmp4v2 from faad2 or better mpeg4ip
AC_ARG_WITH(mp4v2,
AC_HELP_STRING([--with-mp4v2],[build soundkonverter with M4A/AAC tag support from mp4v2/faad2]),
[have_mp4v2=$withval],
[have_mp4v2=no]
)
AC_ARG_WITH(mp4v2-dir,
AC_HELP_STRING([--with-mp4v2-dir],[path to mp4v2 [default=/usr]]),
[mp4v2_dir="$withval"],
[mp4v2_dir=/usr]
)
if test "$have_mp4v2" != "no"; then
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
ac_cxxflags_save=$CXXFLAGS
CXXFLAGS="$CXXFLAGS -I$mp4v2_dir/include"
ac_ldflags_save=$LDFLAGS
LDFLAGS="$LDFLAGS -L$mp4v2_dir/lib"
# not even everyone using faad2 has <systems.h>
if ! test -f config.h; then
echo "#include \"confdefs.h\"" > config.h
fi
ac_cppflags_save=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -I."
AC_CHECK_HEADERS(systems.h)
AC_CHECK_HEADERS([mp4.h], [have_mp4_h=yes], [],
[#ifdef HAVE_SYSTEMS_H
# include <systems.h>
#endif
])
AC_CHECK_LIB( mp4v2, MP4Read, have_mp4v2=yes, have_mp4v2=no )
if test "$have_mp4v2" = "yes" -a "$have_mp4_h" = "yes"; then
AC_DEFINE(HAVE_MP4V2, 1, [have mp4v2])
MP4V2_INCLUDES="-I$mp4v2_dir/include"
MP4V2_LIBS="-L$mp4v2_dir/lib -lmp4v2"
else
have_mp4v2=no
fi
CPPFLAGS=$ac_cppflags_save
CXXFLAGS=$ac_cxxflags_save
LDFLAGS=$ac_ldflags_save
AC_LANG_RESTORE
fi
AC_SUBST(MP4V2_INCLUDES)
AC_SUBST(MP4V2_LIBS)
AM_CONDITIONAL(with_mp4v2, [test x$have_mp4v2 != xno ])
###############################################################################
# END MP4V2 CHECK
###############################################################################

@ -0,0 +1,6 @@
# the SUBDIRS is filled automatically by am_edit. If files are
# in this directory they are installed into the english dir
KDE_LANG = en
KDE_DOCS = soundkonverter
SUBDIRS = $(AUTODIRS)

@ -0,0 +1,2 @@
KDE_DOCS = soundkonverter
KDE_LANG = en

@ -0,0 +1,209 @@
<?xml version="1.0" ?>
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
<!ENTITY soundkonverter "<application>soundKonverter 0.3</application>">
<!ENTITY kappname "&soundkonverter;"><!-- Do *not* replace kappname-->
<!ENTITY package "kde-module"><!-- kdebase, kdeadmin, etc -->
<!ENTITY % addindex "IGNORE">
<!ENTITY % English "INCLUDE"><!-- change language only here -->
<!-- Do not define any other entities; instead, use the entities
from kde-genent.entities and $LANG/user.entities. -->
]>
<!-- kdoctemplate v0.8 October 1 1999
Minor update to "Credits and Licenses" section on August 24, 2000
Removed "Revision history" section on 22 January 2001
Changed to Installation/Help menu entities 18 October 2001
Other minor cleanup and changes 18 October 2001 -->
<!--
This template was designed by: David Rugge davidrugge@mindspring.com
with lots of help from: Eric Bischoff ebisch@cybercable.tm.fr
and Frederik Fouvry fouvry@sfs.nphil.uni-tuebingen.de
of the KDE DocBook team.
You may freely use this template for writing any sort of KDE documentation.
If you have any changes or improvements, please let us know.
Remember:
- in XML, the case of the <tags> and attributes is relevant ;
- also, quote all attributes.
Please don't forget to remove all these comments in your final documentation,
thanks ;-).
-->
<!-- ................................................................ -->
<!-- The language must NOT be changed here. -->
<book lang="&language;">
<!-- This header contains all of the meta-information for the document such
as Authors, publish date, the abstract, and Keywords -->
<bookinfo>
<title>The &soundkonverter; Handbook</title>
<authorgroup>
<author>
<firstname></firstname>
<othername></othername>
<surname>Daniel Faust</surname>
<affiliation>
<address><email>hessijames@gmail.com</email></address>
</affiliation>
</author>
</authorgroup>
<!-- TRANS:ROLES_OF_TRANSLATORS -->
<copyright>
<year>2006</year>
<year>2007</year>
<holder>Daniel Faust</holder>
</copyright>
<!-- Translators: put here the copyright notice of the translation -->
<!-- Put here the FDL notice. Read the explanation in fdl-notice.docbook
and in the FDL itself on how to use it. -->
<legalnotice>&FDLNotice;</legalnotice>
<!-- Date and version information of the documentation
Don't forget to include this last date and this last revision number, we
need them for translation coordination !
Please respect the format of the date (YYYY-MM-DD) and of the version
(V.MM.LL), it could be used by automation scripts.
Do NOT change these in the translation. -->
<date>2007-01-08</date>
<releaseinfo>0.3</releaseinfo>
<!-- Abstract about this handbook -->
<abstract>
<para>
soundKonverter is frontend to various audio converters.
</para>
</abstract>
<!-- This is a set of Keywords for indexing by search engines.
Please at least include KDE, the KDE package it is in, the name
of your application, and a few relevant keywords. -->
<keywordset>
<keyword>KDE</keyword>
<keyword>soundKonverter</keyword>
<keyword>audio</keyword>
<keyword>convert</keyword>
<keyword>transcode</keyword>
<keyword>decode</keyword>
<keyword>encode</keyword>
</keywordset>
</bookinfo>
<!-- The contents of the documentation begin here. Label
each chapter so with the id attribute. This is necessary for two reasons: it
allows you to easily reference the chapter from other chapters of your
document, and if there is no ID, the name of the generated HTML files will vary
from time to time making it hard to manage for maintainers and for the CVS
system. Any chapter labelled (OPTIONAL) may be left out at the author's
discretion. Other chapters should not be left out in order to maintain a
consistent documentation style across all KDE apps. -->
<chapter id="introduction">
<title>Introduction</title>
<!-- The introduction chapter contains a brief introduction for the
application that explains what it does and where to report
problems. Basically a long version of the abstract. Don't include a
revision history. (see installation appendix comment) -->
<para>soundKonverter is frontend to various audio converters.</para>
<para>
It is extendable by plugins and supports many backends:
lame, oggenc, flac, musepack, faac, mplayer, ffmpeg - just to mention a few.
</para>
<para>
This way you can convert between various audio formats:
mp3, ogg, flac, mpc, aac, m4a, rm and wma, avi, flv (the latter reading only) for example.
</para>
<para>soundKonverter supports reading and writing tags for many formats, so the tags are preserved when converting files.</para>
<para>
The key features are: Audio conversion, Replay Gain calculation, CD ripping
</para>
<para>soundKonverter comes with an Amarok script that allows you to easily transcode files when transfering to your media device.</para>
</chapter>
<chapter id="credits">
<!-- Include credits for the programmers, documentation writers, and
contributors here. The license for your software should then be included below
the credits with a reference to the appropriate license file included in the KDE
distribution. -->
<title>Credits and License</title>
<para>
&soundkonverter;
</para>
<para>
Program copyright 2007 Daniel Faust <email>hessijames@gmail.com</email>
</para>
<para>
Documentation copyright 2007 Daniel Faust <email>hessijames@gmail.com</email>
</para>
<!-- TRANS:CREDIT_FOR_TRANSLATORS -->
&underFDL; <!-- FDL: do not remove -->
<!-- Determine which license your application is licensed under,
and delete all the remaining licenses below:
(NOTE: All documentation are licensed under the FDL,
regardless of what license the application uses) -->
&underGPL; <!-- GPL License -->
</chapter>
<appendix id="installation">
<title>Installation</title>
<sect1 id="compilation">
<title>Compilation and Installation</title>
<para>
In order to compile soundKonverter, you need: taglib-devel, cdparanoia
</para>
<!-- This entity contains the boilerplate text for standard -->
<!-- compilation instructions. If your application requires any -->
<!-- special handling, remove it, and replace with your own text. -->
&install.compile.documentation;
</sect1>
</appendix>
&documentation.index;
</book>
<!--
Local Variables:
mode: sgml
sgml-minimize-attributes:nil
sgml-general-insert-case:lower
sgml-indent-step:0
sgml-indent-data:nil
End:
vim:tabstop=2:shiftwidth=2:expandtab
-->

@ -0,0 +1,3 @@
POFILES = AUTO
noinst_HEADERS = de.po es.po fr.po hu.po it.po nl.po pl.po pt_BR.po pt_PT.po \
ru.po

1650
po/de.po

File diff suppressed because it is too large Load Diff

1661
po/es.po

File diff suppressed because it is too large Load Diff

1665
po/fr.po

File diff suppressed because it is too large Load Diff

1690
po/hu.po

File diff suppressed because it is too large Load Diff

1632
po/it.po

File diff suppressed because it is too large Load Diff

1687
po/nl.po

File diff suppressed because it is too large Load Diff

1636
po/pl.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1632
po/ru.po

File diff suppressed because it is too large Load Diff

@ -0,0 +1,58 @@
# set the include path for X, qt and KDE
INCLUDES = $(all_includes) -I$(top_srcdir)/src/metadata/ \
-I$(top_srcdir)/src/pluginloader/
# these are the headers for your project
noinst_HEADERS = cdmanager.h cdopener.h combobutton.h config.h \
configbackendspage.h configdialog.h configenvironmentpage.h configgeneralpage.h \
configpagebase.h configpluginspage.h conversionoptions.h convert.h cuesheeteditor.h \
dcopinterface.h dirdialog.h filelist.h logger.h logviewer.h options.h optionsdetailed.h \
optionseditor.h optionsrequester.h optionssimple.h outputdirectory.h \
progressindicator.h replaygain.h replaygainfilelist.h replaygainscanner.h soundkonverter.h \
soundkonverterapp.h
# let automoc handle all of the meta source files (moc)
METASOURCES = AUTO
messages: rc.cpp
$(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp
$(XGETTEXT) *.cpp -o $(podir)/soundkonverter.pot
KDE_ICON = AUTO
#########################################################################
# APPLICATION SECTION
#########################################################################
# this is the program that gets installed. it's name is used for all
# of the other Makefile.am variables
bin_PROGRAMS = soundkonverter
# the application source, library search path, and link libraries
soundkonverter_SOURCES = cddb.cpp cdmanager.cpp cdopener.cpp combobutton.cpp \
config.cpp configbackendspage.cpp configdialog.cpp configenvironmentpage.cpp \
configgeneralpage.cpp configpagebase.cpp configpluginspage.cpp conversionoptions.cpp \
convert.cpp cuesheeteditor.cpp dcopinterface.skel dirdialog.cpp filelist.cpp \
logger.cpp logviewer.cpp main.cpp options.cpp optionsdetailed.cpp \
optionseditor.cpp optionsrequester.cpp optionssimple.cpp outputdirectory.cpp paranoia.cpp \
progressindicator.cpp replaygain.cpp replaygainfilelist.cpp replaygainscanner.cpp \
soundkonverter.cpp soundkonverterapp.cpp
soundkonverter_LDFLAGS = $(KDE_RPATH) $(all_libraries)
soundkonverter_LDADD = $(LIB_KDEUI) $(LIB_KFILE) metadata/libmetadata.la \
pluginloader/libpluginloader.la -lcdda_interface -lcdda_paranoia
xdg_apps_DATA = soundkonverter.desktop
# this is where the shell's XML-GUI resource file goes
shellrcdir = $(kde_datadir)/soundkonverter
shellrc_DATA = soundkonverterui.rc
SUBDIRS = amarokscript metadata pics pluginloader plugins
soundkonverter_DEPENDENCIES = metadata/libmetadata.la \
pluginloader/libpluginloader.la
amarokscriptsdir = $(kde_datadir)/amarok/scripts
servicemenusdir = $(kde_datadir)/konqueror/servicemenus
servicemenus_DATA = audiocd_extract_with_soundkonverter.desktop
amarokscriptdir = $(kde_datadir)/soundkonverter/amarokscript
bin_SCRIPTS = userscript.sh
userscriptdir = $(kde_datadir)/soundkonverter
userscript_SCRIPTS = userscript.sh

@ -0,0 +1,3 @@
amarokscriptdir = $(kde_datadir)/soundkonverter/amarokscript
amarokscript_DATA = README \
soundKonverter.rb

@ -0,0 +1,43 @@
<div align="center"><b>soundKonverter amaroK-Script (v0.3.8)</b></div>
<p>
<b>About:</b><br>
This script only adds a context menu for easily accesssing the soundKonverter tool.<br>This version was designed to work with soundKonverter 0.2.80+<br>With soundKonverter you can convert audio files into another audio format. And you can add/remove the ReplayGain tag to/from audio files.
</p>
<p>
<b>Usage:</b><br>
Just run this script and click on one or multiple files in your playlist with the right mouse button. Select soundKonverter and your desired action. After that soundKonverter should start (if you have installed it). Look into the handbook of soundKonverter for further information.
</p>
<p>
<b>Dependencies:</b><br>
<ul>
<li>amaroK 1.4.0</li>
<li>Ruby 1.6</li>
<li>soundKonverter 0.2.80+</li>
</ul>
</p>
<p>
<b>ChangeLog:</b><br>
Version 0.1:<br>
<ul>
<li>initial release</li>
</ul>
Version 0.2.80:<br>
<ul>
<li>add: cd ripping menu</li>
</ul>
</p>
<p>
<b>License:</b><br>
GNU General Public License V2
</p>
<p>
<b>Author:</b><br>
Daniel Faust (daniel@kaligames.de)
</p>

@ -0,0 +1,296 @@
#!/usr/bin/env ruby
#
# amaroK-Script for integrating soundKonverter into amaroK
#
# (c) 2005 Daniel Faust <daniel@kaligames.de>
# License: GNU General Public License V2
# FIXME after adding some files to soundkonverter, it is impossible to repeat that, until soundkonverter gets closed.
# FIXME don't open files on every request. load options on startup and save on exit!
#`dcop amarok playlist addMedia KURL`
#`dcop amarok playlist addMediaList KURL::List`
#`dcop amarok collection scanCollectionChanges`
require "uri"
begin
require "Qt"
rescue LoadError
error = 'Qt Ruby bindings are required for this script.'
`dcop amarok playlist popupMessage "soundKonverter: #{error}"`
exit
end
class MainWidget < Qt::Dialog
slots 'accept()'
def initialize(parent = nil, name = nil)
super
box = Qt::VBoxLayout.new( self, 11, 6 );
lTitle = Qt::Label.new('soundKonverter plugin settings', self)
box.addWidget( lTitle )
lTitle.setAlignment(Qt::AlignCenter)
font = Qt::Font.new()
font.setPixelSize(18)
font.setBold(true)
lTitle.setFont(font)
box.addSpacing( 5 )
mediaDeviceBox = Qt::GroupBox.new( 1, Qt::Vertical, "Options for transfering to media devices", self )
box.addWidget( mediaDeviceBox )
mediaDeviceBox.layout().setSpacing( 6 )
mediaDeviceBox.layout().setMargin( 6 )
Qt::Label.new('Profile for lossy conversion:', mediaDeviceBox)
@cTranscodeProfile = Qt::ComboBox.new(mediaDeviceBox)
@cTranscodeProfile.insertItem("Very low")
@cTranscodeProfile.insertItem("Low")
@cTranscodeProfile.insertItem("Medium")
@cTranscodeProfile.insertItem("High")
@cTranscodeProfile.insertItem("Very high")
@cTranscodeProfile.setCurrentItem( 1 )
# box.addSpacing( 5 )
#
# rippingBox = Qt::GroupBox.new( 2, Qt::Horizontal, "Use pre-defined options for CD ripping", self )
# box.addWidget( rippingBox )
# rippingBox.layout().setSpacing( 6 )
# rippingBox.layout().setMargin( 6 )
# rippingBox.setCheckable( true )
# rippingBox.setEnabled( false )
#
# profileBox = Qt::HBoxLayout.new( rippingBox, 6 );
# lRippingProfile = Qt::Label.new('Profile:', rippingBox)
# profileBox.addWidget( lRippingProfile )
# @cRippingProfile = Qt::ComboBox.new(rippingBox)
# profileBox.addWidget( @cRippingProfile )
# @cRippingProfile.insertItem("Very low")
# @cRippingProfile.insertItem("Low")
# @cRippingProfile.insertItem("Medium")
# @cRippingProfile.insertItem("High")
# @cRippingProfile.insertItem("Very high")
# @cRippingProfile.insertItem("Lossless")
# @cRippingProfile.insertItem("Last used")
# @cRippingProfile.setCurrentItem(3)
# lRippingFormat = Qt::Label.new('Format:', rippingBox)
# profileBox.addWidget( lRippingFormat )
# @cRippingFormat = Qt::ComboBox.new(rippingBox)
# profileBox.addWidget( @cRippingFormat )
# @cRippingFormat.insertItem("ogg")
# @cRippingFormat.insertItem("mp3")
# @cRippingFormat.insertItem("flac")
# directoryBox = Qt::HBoxLayout.new( rippingBox, 6 );
# lRippingDirectory = Qt::Label.new('Directory:', rippingBox)
# directoryBox.addWidget( lRippingDirectory )
# @cRippingDirectory = Qt::ComboBox.new(rippingBox)
# directoryBox.addWidget( @cRippingDirectory )
# @cRippingDirectory.setEditable(true)
# @cRippingDirectory.insertItem("/home/daniel/soundKonverter/%b/%d - %n - %t")
# @cRippingDirectory.insertItem("Last used")
box.addSpacing( 5 )
buttonsBox = Qt::HBoxLayout.new(box)
buttonsBox.setSpacing(6)
buttonsBox.addStretch()
okPushButton = Qt::PushButton.new( self, "ok" )
buttonsBox.addWidget( okPushButton )
okPushButton.setText( "OK" )
okPushButton.setDefault( true )
connect( okPushButton, SIGNAL( 'clicked()' ),
self, SLOT( 'accept()' )
)
cancelPushButton = Qt::PushButton.new( self, "cancel" )
buttonsBox.addWidget( cancelPushButton )
cancelPushButton.setText( "Cancel" )
cancelPushButton.setAccel( Qt::KeySequence.new(Key_Escape) )
connect( cancelPushButton, SIGNAL( 'clicked()' ),
self, SLOT( 'reject()' )
)
file = Qt::File.new( File.dirname( File.expand_path( __FILE__ ) ) + "/config" )
if file.open( Qt::IO_ReadOnly )
ts = Qt::TextStream.new( file )
content = ''
ts >> content
if content == 'Very_low'
@cTranscodeProfile.setCurrentItem( 0 )
elsif content == 'Low'
@cTranscodeProfile.setCurrentItem( 1 )
elsif content == 'Medium'
@cTranscodeProfile.setCurrentItem( 2 )
elsif content == 'High'
@cTranscodeProfile.setCurrentItem( 3 )
elsif content == 'Very_high'
@cTranscodeProfile.setCurrentItem( 4 )
end
file.close()
end
# file = Qt::File.new( File.dirname( File.expand_path( __FILE__ ) ) + "/profiles" )
# if file.open( Qt::IO_ReadOnly )
# ts = Qt::TextStream.new( file )
# while !ts.eof()
# content = ''
# ts >> content
# @cProfile.insertItem( content )
# ts >> content
# end
#
# file.close()
# end
end
def accept()
file = Qt::File.new( File.dirname( File.expand_path( __FILE__ ) ) + "/config" )
if file.open( Qt::IO_WriteOnly )
ts = Qt::TextStream.new( file )
if @cTranscodeProfile.currentText() == 'Very low'
content = 'Very_low'
elsif @cTranscodeProfile.currentText() == 'Low'
content = 'Low'
elsif @cTranscodeProfile.currentText() == 'Medium'
content = 'Medium'
elsif @cTranscodeProfile.currentText() == 'High'
content = 'High'
elsif @cTranscodeProfile.currentText() == 'Very high'
content = 'Very_high'
end
ts << content + "\n"
file.close()
end
super
end
end
MenuItemName1 = "soundKonverter \"Convert selected files\""
MenuItemName2 = "soundKonverter \"Add Replay Gain to selected files\""
MenuItemName3 = "soundKonverter \"Rip and play audio CD\""
def cleanup()
`dcop amarok script removeCustomMenuItem #{MenuItemName1}`
`dcop amarok script removeCustomMenuItem #{MenuItemName2}`
`dcop amarok script removeCustomMenuItem #{MenuItemName3}`
end
trap( "SIGTERM" ) { cleanup() }
`dcop amarok script addCustomMenuItem #{MenuItemName1}`
`dcop amarok script addCustomMenuItem #{MenuItemName2}`
`dcop amarok script addCustomMenuItem #{MenuItemName3}`
loop do
message = gets().chomp()
command = /[A-Za-z]*/.match( message ).to_s()
case command
when "configure"
app = Qt::Application.new(ARGV)
widget = MainWidget.new
app.setMainWidget(widget)
widget.show()
app.exec()
when "transcode"
args = message.split()
filename = args[1]
#uri = URI.parse( args[1] )
#filename = URI.unescape( uri.path() )
filetype = args[2]
profile = ''
file = Qt::File.new( File.dirname( File.expand_path( __FILE__ ) ) + "/formats" )
if file.open( Qt::IO_ReadOnly )
ts = Qt::TextStream.new( file )
while !ts.eof()
mode = ''
formats = ''
ts >> mode
ts >> formats
if formats.split(',').include?( filetype )
profile = mode
end
end
file.close()
end
if profile == ''
file = Qt::File.new( File.dirname( File.expand_path( __FILE__ ) ) + "/config" )
if file.open( Qt::IO_ReadOnly )
ts = Qt::TextStream.new( file )
content = ''
ts >> content
if content == 'Very_low'
profile = 'Very low'
elsif content == 'Low'
profile = 'Low'
elsif content == 'Medium'
profile = 'Medium'
elsif content == 'High'
profile = 'High'
elsif content == 'Very_high'
profile = 'Very high'
end
file.close()
else
profile = 'Low'
end
end
`dcop amarok playlist shortStatusMessage "starting soundKonverter in background"`
`soundkonverter --invisible --profile '#{profile}' --format '#{filetype}' --output '/tmp' --command "dcop amarok mediabrowser transcodingFinished %u file://%o" '#{filename}'`
when "customMenuClicked"
if message.include?( "Convert selected files" )
args = message.split()
# Remove the command args
5.times() { args.delete_at( 0 ) }
# Iterate over all selected files
files = ''
args.each() do |arg|
uri = URI.parse( arg )
file = URI.unescape( uri.path() )
files += ' "'+file+'"'
end
`dcop amarok playlist shortStatusMessage "starting soundKonverter"`
`soundkonverter #{files}`
end
if message.include?( "Add Replay Gain to selected files" )
args = message.split()
# Remove the command args
8.times() { args.delete_at( 0 ) }
files = ''
args.each() do |arg|
uri = URI.parse( arg )
file = URI.unescape( uri.path() )
files += ' "'+file+'"'
end
`dcop amarok playlist shortStatusMessage "starting soundKonverter"`
`soundkonverter --replaygain #{files}`
end
if message.include?( "Rip and play audio CD" )
`dcop amarok playlist popupMessage "Select all tracks to rip and press 'Start' in order to start ripping.\nThe tracks will be added to the playlist, when they are ready."`
#`dcop amarok playlist shortStatusMessage "starting soundKonverter"`
`soundkonverter --invisible --rip auto --command "dcop amarok playlist addMedia %o"`
end
end
end

@ -0,0 +1,11 @@
[Desktop Entry]
Actions=ExtractSoundKonverter
ServiceTypes=media/audiocd
Icon=soundkonverter
X-KDE-Priority=TopLevel
[Desktop Action ExtractSoundKonverter]
Exec=soundkonverter --rip %u
Icon=soundkonverter
Name=Extract with soundKonverter
Name[de]=Mit soundKonverter auslesen

@ -0,0 +1,669 @@
/*
Copyright (C) 2000 Michael Matz <matz@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <config.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#include <errno.h>
#include <unistd.h>
#include <qdir.h>
#include <qtextstream.h>
#include <qregexp.h>
//#include <qapp.h>
#include <qstring.h>
// #include <qcursor.h>
//#include <kdebug.h>
#include <ksock.h>
#include <kextsock.h>
#include <klocale.h>
#include <kinputdialog.h>
#include "cddb.h"
#include "cddb.moc"
// FIXME //kdDebug
CDDB::CDDB()
: ks(0), port(80), remote(false), save_local(false)
{
QString s = QDir::homeDirPath()+"/.cddb";
cddb_dirs +=s;
}
CDDB::~CDDB()
{
deinit();
}
bool
CDDB::set_server(const char *hostname, unsigned short int _port)
{
if (ks)
{
if (h_name == hostname && port == _port)
return true;
deinit();
}
remote = (hostname != 0) && (*hostname != 0);
//kdDebug(7101) << "CDDB: set_server, host=" << hostname << "port=" << _port << endl;
if (remote)
{
ks = new KExtendedSocket(hostname, _port);
if (ks->connect() < 0)
{
//kdDebug(7101) << "CDDB: Can't connect!" << endl;
delete ks;
ks = 0;
return false;
}
h_name = hostname;
port = _port;
QCString r;
readLine(r); // the server greeting
writeLine("cddb hello kde-user blubb kio_audiocd 0.4");
readLine(r);
}
return true;
}
bool
CDDB::deinit()
{
if (ks)
{
writeLine("quit");
QCString r;
readLine(r);
ks->close();
}
h_name.resize(0);
port = 0;
remote = false;
ks = 0;
return true;
}
bool
CDDB::readLine(QCString& ret)
{
int read_length = 0;
char small_b[128];
//fd_set set;
ret.resize(0);
while (read_length < 40000)
{
// Look for a \n in buf
int ni = buf.find('\n');
if (ni >= 0)
{
// Nice, so return this substring (without the \n),
// and truncate buf accordingly
ret = buf.left(ni);
if (ret.length() && ret[ret.length()-1] == '\r')
ret.resize(ret.length());
buf.remove(0, ni+1);
//kdDebug(7101) << "CDDB: got `" << ret << "'" << endl;
return true;
}
// Try to refill the buffer
ks->waitForMore(60 * 1000);
ssize_t l = ks->readBlock(small_b, sizeof(small_b)-1);
if (l <= 0)
{
// l==0 normally means fd got closed, but we really need a lineend
return false;
}
small_b[l] = 0;
read_length += l;
buf += small_b;
}
return false;
}
bool
CDDB::writeLine(const QCString& line)
{
const char *b = line.data();
int l = line.length();
//kdDebug(7101) << "CDDB: send `" << line << "'" << endl;
while (l)
{
ssize_t wl = ks->writeBlock(b, l);
if (wl < 0 && errno != EINTR)
return false;
if (wl < 0)
wl = 0;
l -= wl;
b += wl;
}
l = line.length();
if (l && line.data()[l-1] != '\n')
{
char c = '\n';
ssize_t wl;
do {
wl = ks->writeBlock(&c, 1);
} while (wl <= 0 && errno == EINTR);
if (wl<=0 && errno != EINTR)
return false;
}
return true;
}
unsigned int
CDDB::get_discid(QValueList<int>& track_ofs)
{
unsigned int id = 0;
int num_tracks = track_ofs.count() - 2;
// the last two track_ofs[] are disc begin and disc end
for (int i = num_tracks - 1; i >= 0; i--)
{
int n = track_ofs[i];
n /= 75;
while (n > 0)
{
id += n % 10;
n /= 10;
}
}
unsigned int l = track_ofs[num_tracks + 1];
l -= track_ofs[num_tracks];
l /= 75;
id = ((id % 255) << 24) | (l << 8) | num_tracks;
return id;
}
static int
get_code (const QCString &s)
{
bool ok;
int code = s.left(3).toInt(&ok);
if (!ok)
code = -1;
return code;
}
static void
parse_query_resp (const QCString& _r, QCString& catg, QCString& d_id, QCString& title)
{
QCString r = _r.stripWhiteSpace();
int i = r.find(' ');
if (i)
{
catg = r.left(i).stripWhiteSpace();
r.remove(0, i+1);
r = r.stripWhiteSpace();
}
i = r.find(' ');
if (i)
{
d_id = r.left(i).stripWhiteSpace();
r.remove(0, i+1);
r = r.stripWhiteSpace();
}
title = r;
}
QString
CDDB::track(int i) const
{
if (i < 0 || i >= int(m_names.count()))
return QString();
return m_names[i].utf8();
}
QString
CDDB::artist(int i) const
{
if (i < 0 || i >= int(m_artists.count()))
return QString();
return m_artists[i].utf8();
}
bool
CDDB::parse_read_resp(QTextStream *stream, QTextStream *write_stream)
{
/* Note, that m_names and m_title should be empty */
QCString end = ".";
m_disc = 0;
m_year = 0;
m_genre = "";
/* Fill table, so we can index it below. */
for (int i = 0; i < m_tracks; i++)
{
m_names.append("");
m_artists.append("");
}
while (1)
{
QCString r;
if (stream)
{
if (stream->atEnd())
break;
r = stream->readLine().latin1();
}
else
{
if (!readLine(r))
return false;
}
/* Normally the "." is not saved into the local files, but be
tolerant about this. */
if (r == end)
break;
if (write_stream)
*write_stream << r << endl;
r = r.stripWhiteSpace();
if (r.isEmpty() || r[0] == '#')
continue;
if (r.left(7) == "DTITLE=")
{
r.remove(0, 7);
m_title += QString::fromLocal8Bit(r.stripWhiteSpace());
}
else if (r.left(6) == "TTITLE")
{
r.remove(0, 6);
int e = r.find('=');
if (e)
{
bool ok;
int i = r.left(e).toInt(&ok);
if (ok && i >= 0 && i < m_tracks)
{
r.remove(0, e+1);
m_names[i] += QString::fromLocal8Bit(r);
}
}
}
else if (r.left(6) == "DYEAR=")
{
r.remove(0, 6);
QString year = QString::fromLocal8Bit(r.stripWhiteSpace());
m_year = year.toInt();
//kdDebug(7101) << "CDDB: found Year: " << QString().sprintf("%04i",m_year) << endl;
}
else if (r.left(7) == "DGENRE=")
{
r.remove(0, 7);
m_genre = QString::fromLocal8Bit(r.stripWhiteSpace());
//kdDebug(7101) << "CDDB: found Genre: " << m_genre << endl;
}
}
/* XXX We should canonicalize the strings ("\n" --> '\n' e.g.) */
int si = m_title.find(" / ");
if (si > 0)
{
m_artist = m_title.left(si).stripWhiteSpace();
m_title.remove(0, si+3);
m_title = m_title.stripWhiteSpace();
}
si = m_title.find(" - CD");
if (si > 0)
{
QString disc = m_title.right(m_title.length()-(si+5)).stripWhiteSpace();
m_disc = disc.toInt();
//kdDebug(7101) << "CDDB: found Disc: " << disc << endl;
m_title = m_title.left(si).stripWhiteSpace();
}
if (m_title.isEmpty())
m_title = i18n("No Title");
/*else
m_title.replace(QRegExp("/"), "%2f");*/
if (m_artist.isEmpty())
m_artist = i18n("Unknown");
/*else
m_artist.replace(QRegExp("/"), "%2f");*/
//kdDebug(7101) << "CDDB: found Title: `" << m_title << "'" << endl;
for (int i = 0; i < m_tracks; i++)
{
if (m_names[i].isEmpty())
m_names[i] += i18n("Track %1").arg(i);
//m_names[i].replace(QRegExp("/"), "%2f");
si = m_names[i].find(" - ");
if (si < 0)
{
si = m_names[i].find(" / ");
}
if (si > 0)
{
m_artists[i] = m_names[i].left(si).stripWhiteSpace();
m_names[i].remove(0, si+3);
m_names[i] = m_names[i].stripWhiteSpace();
}
else
{
m_artists[i] = m_artist;
}
//kdDebug(7101) << "CDDB: found Track " << i+1 << ": `" << m_names[i] << "'" << endl;
}
return true;
}
void
CDDB::add_cddb_dirs(const QStringList& list)
{
QString s = QDir::homeDirPath()+"/.cddb";
cddb_dirs = list;
if (cddb_dirs.isEmpty())
cddb_dirs += s;
}
/* Locates and opens the local file corresponding to that discid.
Returns TRUE, if file is found and ready for reading.
Returns FALSE, if file isn't found. In this case ret_file is initialized
with a QFile which resides in the first cddb_dir, and has a temp name
(the ID + getpid()). You can open it for writing. */
bool
CDDB::searchLocal(unsigned int id, QFile *ret_file)
{
QDir dir;
QString filename;
filename = QString("%1").arg(id, 0, 16).rightJustify(8, '0');
QStringList::ConstIterator it;
for (it = cddb_dirs.begin(); it != cddb_dirs.end(); ++it)
{
dir.setPath(*it);
if (!dir.exists())
continue;
/* First look in dir directly. */
ret_file->setName (*it + "/" + filename);
if (ret_file->exists() && ret_file->open(IO_ReadOnly))
return true;
/* And then in the subdirs of dir (representing the categories normally).
*/
const QFileInfoList *subdirs = dir.entryInfoList (QDir::Dirs);
QFileInfoListIterator fiit(*subdirs);
QFileInfo *fi;
while ((fi = fiit.current()) != 0)
{
ret_file->setName (*it + "/" + fi->fileName() + "/" + filename);
if (ret_file->exists() && ret_file->open(IO_ReadOnly))
return true;
++fiit;
}
}
QString pid;
pid.setNum(::getpid());
ret_file->setName (cddb_dirs[0] + "/" + filename + "." + pid);
/* Try to create the save location. */
dir.setPath(cddb_dirs[0]);
if (save_local && !dir.exists())
{
//dir = QDir::current();
dir.mkdir(cddb_dirs[0]);
}
return false;
}
bool
CDDB::queryCD(QValueList<int>& track_ofs)
{
int num_tracks = track_ofs.count() - 2;
if (num_tracks < 1)
return false;
unsigned int id = get_discid(track_ofs);
QFile file;
bool local;
/* Already read this ID. */
if (id == m_discid)
return true;
emit cddbMessage(i18n("Searching local cddb entry ..."));
qApp->processEvents();
/* First look for a local file. */
local = searchLocal (id, &file);
/* If we have no local file, and no remote connection, barf. */
if (!local && (!remote || ks == 0))
return false;
m_tracks = num_tracks;
m_title = "";
m_artist = "";
m_names.clear();
m_discid = id;
if (local)
{
QTextStream stream(&file);
/* XXX Hmm, what encoding is used by CDDB files? local? Unicode?
Nothing? */
//stream.setEncoding(QTextStream::Locale);
parse_read_resp(&stream, 0);
file.close();
return true;
}
emit cddbMessage(i18n("Searching remote cddb entry ..."));
qApp->processEvents();
/* Remote CDDB query. */
unsigned int length = track_ofs[num_tracks+1] - track_ofs[num_tracks];
QCString q;
q.sprintf("cddb query %08x %d", id, num_tracks);
QCString num;
for (int i = 0; i < num_tracks; i++)
q += " " + num.setNum(track_ofs[i]);
q += " " + num.setNum(length / 75);
if (!writeLine(q))
return false;
QCString r;
if (!readLine(r))
return false;
r = r.stripWhiteSpace();
int code = get_code(r);
if (code == 200)
{
QCString catg, d_id, title;
QDir dir;
QCString s, pid;
emit cddbMessage(i18n("Found exact match cddb entry ..."));
qApp->processEvents();
/* an exact match */
r.remove(0, 3);
parse_query_resp(r, catg, d_id, title);
//kdDebug(7101) << "CDDB: found exact CD: category=" << catg << " DiscId=" << d_id << " Title=`" << title << "'" << endl;
q = "cddb read " + catg + " " + d_id;
if (!writeLine(q))
return false;
if (!readLine(r))
return false;
r = r.stripWhiteSpace();
code = get_code(r);
if (code != 210)
return false;
pid.setNum(::getpid());
s = cddb_dirs[0].latin1();
//s = s + "/" +catg; // xine seems to not search in local subdirs
dir.setPath( s );
if ( !dir.exists() ) dir.mkdir( s );
s = s+"/"+ d_id;
file.setName( s );
if (save_local && file.open(IO_WriteOnly))
{
//kdDebug(7101) << "CDDB: file name to save =" << file.name() << endl;
QTextStream stream(&file);
if (!parse_read_resp(0, &stream))
{
file.remove();
return false;
}
file.close();
/*QString newname (file.name());
newname.truncate(newname.findRev('.'));
if (QDir::current().rename(file.name(), newname)) {
//kdDebug(7101) << "CDDB: rename failed" << endl;
file.remove();
} */
}
else if (!parse_read_resp(0, 0))
return false;
}
else if (code == 211)
{
// Found some close matches. We'll read the query response and ask the user
// which one should be fetched from the server.
QCString end = ".";
QCString catg, d_id, title;
QDir dir;
QCString s, pid, first_match;
QStringList disc_ids;
/* some close matches */
//XXX may be try to find marker based on r
emit cddbMessage(i18n("Found close cddb entry ..."));
qApp->processEvents();
int i=0;
while (1)
{
if (!readLine(r))
return false;
r = r.stripWhiteSpace();
if (r == end)
break;
disc_ids.append(r);
if (i == 0)
first_match = r;
i++;
}
bool ok = false;
// We don't want to be thinking too much, do we?
// QApplication::restoreOverrideCursor();
// Oh, mylord, which match should I serve you?
QString _answer = KInputDialog::getItem(i18n("CDDB Matches"), i18n("Several close CDDB entries found. Choose one:"),
disc_ids, 0, false, &ok );
QCString answer = _answer.utf8();
if (ok){ // Get user selected match
parse_query_resp(answer, catg, d_id, title);
}
else{ // Get first match
parse_query_resp(first_match, catg, d_id, title);
}
// Now we can continue thinking...
// QApplication::setOverrideCursor( QCursor(Qt::WaitCursor) );
/*kdDebug(7101) << "CDDB: found close CD: category=" << catg << " DiscId="
<< d_id << " Title=`" << title << "'" << endl;*/
// ... and forth we go as usual
q = "cddb read " + catg + " " + d_id;
if (!writeLine(q))
return false;
if (!readLine(r))
return false;
r = r.stripWhiteSpace();
code = get_code(r);
if (code != 210)
return false;
pid.setNum(::getpid());
s = cddb_dirs[0].latin1();
dir.setPath( s );
if ( !dir.exists() ) dir.mkdir( s );
s = s+"/"+ d_id;
file.setName( s );
if (save_local && file.open(IO_WriteOnly))
{
//kdDebug(7101) << "CDDB: file name to save =" << file.name() << endl;
QTextStream stream(&file);
if (!parse_read_resp(0, &stream))
{
file.remove();
return false;
}
file.close();
}
else if (!parse_read_resp(0, 0))
return false;
}
else
{
/* 202 - no match found
403 - Database entry corrupt
409 - no handshake */
//kdDebug(7101) << "CDDB: query returned code " << code << endl;
return false;
}
return true;
}

@ -0,0 +1,79 @@
/*
Copyright (C) 2000 Michael Matz <matz@kde.org>
Modified 2006 Daniel Faust <hessijames@gmail.com>, thx Michael
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef CDDB_H
#define CDDB_H
#include <qcstring.h>
#include <qvaluelist.h>
#include <qstringlist.h>
#include <qobject.h>
class QFile;
class QTextStream;
class KExtendedSocket;
class CDDB : public QObject
{
Q_OBJECT
public:
CDDB();
~CDDB();
bool set_server(const char *hostname = 0, unsigned short int port = 0);
void add_cddb_dirs(const QStringList& list);
void save_cddb (bool save) { save_local = save; }
unsigned int get_discid(QValueList<int>& track_ofs);
bool queryCD(QValueList<int>& track_ofs);
QString title() const { return m_title.utf8(); }
QString artist(int i) const;
int trackCount() const { return m_tracks; }
QString track(int i) const;
int disc() const { return m_disc; }
QString genre() const { return m_genre.utf8(); }
int year() const { return m_year; }
private:
bool readLine(QCString& s);
bool writeLine(const QCString& s);
bool deinit();
bool parse_read_resp(QTextStream*, QTextStream*);
bool searchLocal(unsigned int id, QFile *ret_file);
KExtendedSocket *ks;
QCString h_name;
unsigned short int port;
bool remote;
bool save_local;
QStringList cddb_dirs;
QCString buf;
unsigned int m_discid;
int m_tracks;
int m_disc;
int m_year;
QString m_genre;
QString m_title;
QString m_artist;
QStringList m_artists;
QStringList m_names;
signals:
void cddbMessage( QString );
};
#endif // CDDB_H

@ -0,0 +1,190 @@
#include "cdmanager.h"
#include "paranoia.h"
#include "cddb.h"
#include "conversionoptions.h"
#include <qstringlist.h>
#include <qvaluelist.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <kinputdialog.h>
#include <dcopref.h>
// ### soundkonverter 0.4 implement reading of milliseconds/frames
// TODO implement reading of cd data
CDDevice::CDDevice( const QString& _device )
{
QStringList s;
bool init = false;
QValueList<int> qvl;
int i;
QStringList dcopList, devList;
bool ok = false;
tags.clear();
if( !_device.isEmpty() )
s.append( _device );
else {
DCOPRef mediamanager( "kded", "mediamanager" );
DCOPReply reply = mediamanager.call( "fullList()" );
if( reply.isValid() ) {
dcopList = reply;
i = 0;
while( i < (int)dcopList.count() ) {
if( dcopList[i+10] == "media/audiocd" ) {
devList.append( dcopList[i+5] );
}
i += 13;
}
if( devList.count() > 1 ) {
QString choice = KInputDialog::getItem( i18n("Audio CD"), i18n("Several audio CDs found. Choose one:"), devList, 0, false, &ok );
if( ok ) s.append( choice );
else s.append( 0 ); // TODO if canceled, the cd opener should close, not use the first item
}
else if( devList.count()==1 ) {
s.append( devList[0] );
}
else {
s.append( "/dev/cdrom" );
s.append( "/dev/dvd" );
}
}
else {
s.append( "/dev/cdrom" );
s.append( "/dev/dvd" );
}
}
para = new Paranoia();
for( i = 0; i < (int)s.count(); i++ ) {
if( init = para->init(s[i]) ) {
device = s[i];
break;
}
}
if( init ) {
trackCount = para->getTracks();
timeCount = para->trackTime( -1 );
for( i = 0; i < para->getTracks(); i++) {
qvl.append( para->trackFirstSector(i+1) + 150 );
}
qvl.append( para->discFirstSector() );
qvl.append( para->discLastSector() );
CDDB* cddb = new CDDB();
cddb->save_cddb( true );
if( cddb->queryCD(qvl) ) {
for( i = 0; i < para->getTracks(); i++ ) {
tags += new TagData( cddb->artist(i), "", cddb->title(), cddb->track(i), cddb->genre(), "",
i+1, cddb->disc(), cddb->year(), para->trackTime(i) );
}
}
else {
cddb->set_server( "freedb.freedb.org", 8880 );
if( cddb->queryCD(qvl) ) {
for( i = 0; i < para->getTracks(); i++ ) {
tags += new TagData( cddb->artist(i), "", cddb->title(), cddb->track(i), cddb->genre(), "",
i+1, cddb->disc(), cddb->year(), para->trackTime(i) );
}
}
else {
for( i = 0; i < para->getTracks(); i++ ) {
tags += new TagData( i18n("Unknown"), "", i18n("Unknown"), i18n("Unknown"), "", "", i+1, 1, 0, para->trackTime(i) );
}
}
}
delete cddb;
}
else {
KMessageBox::information( 0, i18n("No audio CD found."), i18n("Warning") );
device = "";
delete para;
para = 0;
}
}
CDDevice::~CDDevice()
{}
CDManager::CDManager()
{}
CDManager::~CDManager()
{
while( cdDevices.count() > 0 ) delete cdDevices.first();
}
QString CDManager::newCDDevice( const QString& device )
{
CDDevice* cdDevice = new CDDevice( device );
for( QValueList<CDDevice*>::Iterator it = cdDevices.begin(); it != cdDevices.end(); ++it ) {
if( (*it)->device = cdDevice->device ) {
cdDevices.remove( *it );
delete (*it);
break;
}
}
cdDevices += cdDevice;
return cdDevice->device;
}
QValueList<TagData*> CDManager::getTrackList( const QString& device )
{
for( QValueList<CDDevice*>::Iterator it = cdDevices.begin(); it != cdDevices.end(); ++it ) {
if( (*it)->device = device ) return (*it)->tags;
}
QValueList<TagData*> list;
return list;
}
TagData* CDManager::getTags( const QString& device, int track )
{
for( QValueList<CDDevice*>::Iterator it = cdDevices.begin(); it != cdDevices.end(); ++it ) {
if( (*it)->device = device ) {
if( track > 0 ) {
QValueList<TagData*>::Iterator tag = (*it)->tags.at( track - 1 );
return (*tag);
}
else {
return (*it)->discTags;
}
}
}
return 0;
}
int CDManager::getTrackCount( const QString& device )
{
for( QValueList<CDDevice*>::Iterator it = cdDevices.begin(); it != cdDevices.end(); ++it ) {
if( (*it)->device = device ) return (*it)->trackCount;
}
return 0;
}
int CDManager::getTimeCount( const QString& device )
{
for( QValueList<CDDevice*>::Iterator it = cdDevices.begin(); it != cdDevices.end(); ++it ) {
if( (*it)->device = device ) return (*it)->timeCount;
}
return 0;
}
void CDManager::setDiscTags( const QString& device, TagData* tags )
{
for( QValueList<CDDevice*>::Iterator it = cdDevices.begin(); it != cdDevices.end(); ++it ) {
if( (*it)->device = device ) (*it)->discTags = tags;
}
}

@ -0,0 +1,95 @@
#ifndef CDMANAGER_H
#define CDMANAGER_H
#include "tagengine.h"
#include <qobject.h>
class ConversionOptions;
class Paranoia;
/**
* @short All data needed for a cd device
* @author Daniel Faust <hessijames@gmail.com>
* @version 0.3
*/
class CDDevice
{
public:
/**
* Constructor
*/
CDDevice( const QString& _device="" );
/**
* Destructor
*/
virtual ~CDDevice();
QString device;
Paranoia* para;
QValueList<TagData*> tags;
TagData* discTags;
int trackCount;
int timeCount;
};
/**
* @short The CD manager
* @author Daniel Faust <hessijames@gmail.com>
* @version 0.3
*/
class CDManager : public QObject
{
Q_OBJECT
public:
/**
* Constructor
*/
CDManager();
/**
* Destructor
*/
virtual ~CDManager();
/**
* Create a new CDDevice entry in cdDevices. Use @param device or auto search for an audio cd
* Return the used device (usefull, if auto searching was used)
*/
QString newCDDevice( const QString& device="" );
/**
* Return a list of all tracks on the cd in drive @param device
*/
QValueList<TagData*> getTrackList( const QString& device );
/**
* Return the tags of the track @param track on the cd in drive @param device
*/
TagData* getTags( const QString& device, int track );
/**
* Set the tags of the cd in drive @param device
*/
void setDiscTags( const QString& device, TagData* tags );
/**
* Return the sum of all tracks of the cd in drive @param device
*/
int getTrackCount( const QString& device );
/**
* Return the complete length of the cd in drive @param device
*/
int getTimeCount( const QString& device );
private:
/** a list of all devices */
QValueList<CDDevice*> cdDevices;
};
#endif // CDMANAGER_H

@ -0,0 +1,781 @@
#include "cdopener.h"
#include "cdmanager.h"
#include "tagengine.h"
#include "config.h"
#include "ripperpluginloader.h"
#include "combobutton.h"
#include <klistview.h>
#include <klocale.h>
#include <kiconloader.h>
#include <kpushbutton.h>
#include <klineedit.h>
#include <kcombobox.h>
#include <knuminput.h>
#include <ktextedit.h>
#include <kfiledialog.h>
#include <kmessagebox.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qgroupbox.h>
#include <qdatetime.h>
#include <qcolor.h>
#include <qdir.h>
#include <qfile.h>
// ### soundkonverter 0.4: implement cd info text
CDOpener::CDOpener( Config* _config, CDManager* _cdManager, TagEngine* _tagEngine, const QString& _device, QWidget* parent, const char* name, /*Mode default_mode, const QString& default_text,*/ bool modal, WFlags f )
: KDialog( parent, name, modal, f )
{
cdManager = _cdManager;
tagEngine = _tagEngine;
config = _config;
// create an icon loader object for loading icons
KIconLoader* iconLoader = new KIconLoader();
// let the dialog look nice
setCaption( i18n("Add CD tracks") );
setIcon( iconLoader->loadIcon("cdaudio_unmount",KIcon::Small) );
// the grid for all widgets in the dialog
QGridLayout* gridLayout = new QGridLayout( this, 1, 1, 11, 6, "gridLayout" );
// the grid for the artist and album input
QGridLayout* topGridLayout = new QGridLayout( this, 1, 1, 0, 6, "topGridLayout" );
gridLayout->addLayout( topGridLayout, 0, 0 );
// set up the first row at the top
QLabel* lArtistLabel = new QLabel( i18n("Artist:"), this, "lArtistLabel" );
topGridLayout->addWidget( lArtistLabel, 0, 0 );
cArtist = new KComboBox( true, this, "cArtist" );
topGridLayout->addWidget( cArtist, 0, 1 );
cArtist->setMinimumWidth( 200 );
cArtist->insertItem( i18n("Various Artists") );
cArtist->setCurrentText( "" );
connect( cArtist, SIGNAL(textChanged(const QString&)),
this, SLOT(artistChanged(const QString&))
);
// add a horizontal box layout for the composer
QHBoxLayout* artistBox = new QHBoxLayout( -1, "artistBox" );
topGridLayout->addLayout( artistBox, 0, 3 );
// and fill it up
QLabel* lComposerLabel = new QLabel( i18n("Composer:"), this, "lComposerLabel" );
lComposerLabel->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
topGridLayout->addWidget( lComposerLabel, 0, 2 );
cComposer = new KComboBox( true, this, "cComposer" );
artistBox->addWidget( cComposer );
cComposer->insertItem( i18n("Various Composer") );
cComposer->setCurrentText( "" );
//cComposer->setSizePolicy( QSizePolicy::Maximum );
connect( cComposer, SIGNAL(textChanged(const QString&)),
this, SLOT(composerChanged(const QString&))
);
//artistBox->addStretch();
artistBox->addSpacing( 130 );
// pCDDB = new KPushButton( iconLoader->loadIcon("cdaudio_unmount",KIcon::Small), i18n("Request CDDB"), this, "pCDDB" );
// topGridLayout->addWidget( pCDDB, 0, 8 );
// set up the second row at the top
QLabel* lAlbumLabel = new QLabel( i18n("Album:"), this, "lAlbumLabel" );
topGridLayout->addWidget( lAlbumLabel, 1, 0 );
lAlbum = new KLineEdit( this, "lAlbum" );
topGridLayout->addWidget( lAlbum, 1, 1 );
// add a horizontal box layout for the disc number, year and genre
QHBoxLayout* albumBox = new QHBoxLayout( -1, "albumBox" );
topGridLayout->addLayout( albumBox, 1, 3 );
// and fill it up
QLabel* lDiscLabel = new QLabel( i18n("Disc No.:"), this, "lDiscLabel" );
lDiscLabel->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
topGridLayout->addWidget( lDiscLabel, 1, 2 );
iDisc = new KIntSpinBox( 1, 99, 1, 1, 10, this, "iDisc" );
albumBox->addWidget( iDisc );
QLabel* lYearLabel = new QLabel( i18n("Year:"), this, "lYearLabel" );
albumBox->addWidget( lYearLabel );
iYear = new KIntSpinBox( 0, 99999, 1, QDate::currentDate().year(), 10, this, "iYear" );
albumBox->addWidget( iYear );
QLabel* lGenreLabel = new QLabel( i18n("Genre:"), this, "lGenreLabel" );
albumBox->addWidget( lGenreLabel );
cGenre = new KComboBox( true, this, "cGenre" );
cGenre->insertStringList( tagEngine->genreList );
cGenre->setCurrentText( "" );
KCompletion* cGenreCompletion = cGenre->completionObject();
cGenreCompletion->insertItems( tagEngine->genreList );
cGenreCompletion->setIgnoreCase( true );
albumBox->addWidget( cGenre );
// generate the list view for the tracks
trackList = new KListView( this, "trackList" );
gridLayout->addWidget( trackList, 1, 0 );
// and fill in the headers
trackList->addColumn( i18n("Track") );
trackList->addColumn( i18n("Artist"), 0 );
trackList->addColumn( i18n("Composer"), 0 );
trackList->addColumn( i18n("Title") );
trackList->addColumn( i18n("Time") );
trackList->setSelectionMode( QListView::Extended );
trackList->setAllColumnsShowFocus( true );
trackList->setResizeMode( QListView::LastColumn );
connect( trackList, SIGNAL(selectionChanged()),
this, SLOT(trackChanged())
);
connect( trackList, SIGNAL(doubleClicked(QListViewItem*,const QPoint&,int)),
this, SLOT(addClicked())
);
gridLayout->setRowStretch( 1, 1 );
// create the box at the bottom for editing the tags
tagGroupBox = new QGroupBox( i18n("No track selected"), this, "tagGroupBox" );
gridLayout->addWidget( tagGroupBox, 2, 0 );
tagGroupBox->setColumnLayout( 0, Qt::Vertical );
tagGroupBox->layout()->setSpacing( 6 );
tagGroupBox->layout()->setMargin( 6 );
QGridLayout* tagGridLayout = new QGridLayout( tagGroupBox->layout(), 1, 1, -1, "tagGridLayout" );
// add the up and down buttons
pTrackUp = new KPushButton( " ", tagGroupBox, "pTrackUp" );
pTrackUp->setPixmap( iconLoader->loadIcon("up",KIcon::Toolbar) );
pTrackUp->setAutoRepeat( true );
connect( pTrackUp, SIGNAL(clicked()),
this, SLOT(trackUpPressed())
);
tagGridLayout->addWidget( pTrackUp, 0, 0 );
pTrackDown = new KPushButton( " ", tagGroupBox, "pTrackDown" );
pTrackDown->setPixmap( iconLoader->loadIcon("down",KIcon::Toolbar) );
pTrackDown->setAutoRepeat( true );
connect( pTrackDown, SIGNAL(clicked()),
this, SLOT(trackDownPressed())
);
tagGridLayout->addWidget( pTrackDown, 1, 0 );
// add the inputs
// add a horizontal box layout for the title
QHBoxLayout* trackTitleBox = new QHBoxLayout( -1, "trackTitleBox" );
tagGridLayout->addLayout( trackTitleBox, 0, 2 );
// and fill it up
QLabel *lTrackTitleLabel = new QLabel( i18n("Title:"), tagGroupBox, "lTrackTitleLabel" );
tagGridLayout->addWidget( lTrackTitleLabel, 0, 1 );
lTrackTitle = new KLineEdit( tagGroupBox, "lTrackTitle" );
trackTitleBox->addWidget( lTrackTitle );
connect( lTrackTitle, SIGNAL(textChanged(const QString&)),
this, SLOT(trackTitleChanged(const QString&))
);
pTrackTitleEdit = new KPushButton( " ", tagGroupBox, "pTrackTitleEdit" );
pTrackTitleEdit->setPixmap( iconLoader->loadIcon("kwrite",KIcon::Small) );
pTrackTitleEdit->setFixedSize( lTrackTitle->sizeHint().height(), lTrackTitle->sizeHint().height() );
pTrackTitleEdit->hide();
trackTitleBox->addWidget( pTrackTitleEdit );
connect( pTrackTitleEdit, SIGNAL(clicked()),
this, SLOT(editTrackTitleClicked())
);
// add a horizontal box layout for the composer
QHBoxLayout* trackArtistBox = new QHBoxLayout( -1, "trackArtistBox" );
tagGridLayout->addLayout( trackArtistBox, 1, 2 );
// and fill it up
QLabel* lTrackArtistLabel = new QLabel( i18n("Artist:"), tagGroupBox, "lTrackArtistLabel" );
tagGridLayout->addWidget( lTrackArtistLabel, 1, 1 );
lTrackArtist = new KLineEdit( tagGroupBox, "lTrackArtist" );
trackArtistBox->addWidget( lTrackArtist );
connect( lTrackArtist, SIGNAL(textChanged(const QString&)),
this, SLOT(trackArtistChanged(const QString&))
);
pTrackArtistEdit = new KPushButton( " ", tagGroupBox, "pTrackArtistEdit" );
pTrackArtistEdit->setPixmap( iconLoader->loadIcon("kwrite",KIcon::Small) );
pTrackArtistEdit->setFixedSize( lTrackArtist->sizeHint().height(), lTrackArtist->sizeHint().height() );
pTrackArtistEdit->hide();
trackArtistBox->addWidget( pTrackArtistEdit );
connect( pTrackArtistEdit, SIGNAL(clicked()),
this, SLOT(editTrackArtistClicked())
);
QLabel* lTrackComposerLabel = new QLabel( i18n("Composer:"), tagGroupBox, "lTrackComposerLabel" );
trackArtistBox->addWidget( lTrackComposerLabel );
lTrackComposer = new KLineEdit( tagGroupBox, "lTrackComposer" );
trackArtistBox->addWidget( lTrackComposer );
connect( lTrackComposer, SIGNAL(textChanged(const QString&)),
this, SLOT(trackComposerChanged(const QString&))
);
pTrackComposerEdit = new KPushButton( " ", tagGroupBox, "pTrackComposerEdit" );
pTrackComposerEdit->setPixmap( iconLoader->loadIcon("kwrite",KIcon::Small) );
pTrackComposerEdit->setFixedSize( lTrackComposer->sizeHint().height(), lTrackComposer->sizeHint().height() );
pTrackComposerEdit->hide();
trackArtistBox->addWidget( pTrackComposerEdit );
connect( pTrackComposerEdit, SIGNAL(clicked()),
this, SLOT(editTrackComposerClicked())
);
// add a horizontal box layout for the comment
QHBoxLayout* trackCommentBox = new QHBoxLayout( -1, "trackCommentBox" );
tagGridLayout->addLayout( trackCommentBox, 2, 2 );
// and fill it up
QLabel* lTrackCommentLabel = new QLabel( i18n("Comment:"), tagGroupBox, "lTrackCommentLabel" );
tagGridLayout->addWidget( lTrackCommentLabel, 2, 1 );
tTrackComment = new KTextEdit( tagGroupBox, "tTrackComment" );
trackCommentBox->addWidget( tTrackComment );
tTrackComment->setFixedHeight( 65 );
connect( tTrackComment, SIGNAL(textChanged()),
this, SLOT(trackCommentChanged())
);
pTrackCommentEdit = new KPushButton( " ", tagGroupBox, "pTrackCommentEdit" );
pTrackCommentEdit->setPixmap( iconLoader->loadIcon("kwrite",KIcon::Small) );
pTrackCommentEdit->setFixedSize( lTrackTitle->sizeHint().height(), lTrackTitle->sizeHint().height() );
pTrackCommentEdit->hide();
trackCommentBox->addWidget( pTrackCommentEdit );
connect( pTrackCommentEdit, SIGNAL(clicked()),
this, SLOT(editTrackCommentClicked())
);
// draw a horizontal line
QFrame* lineFrame = new QFrame( this, "lineFrame" );
lineFrame->setFrameShape( QFrame::HLine );
lineFrame->setFrameShadow( QFrame::Sunken );
lineFrame->setFrameShape( QFrame::HLine );
gridLayout->addWidget( lineFrame, 3, 0 );
gridLayout->setRowSpacing( 3, 16 );
// add a horizontal box layout for the control elements
QHBoxLayout* controlBox = new QHBoxLayout( -1, "controlBox" );
gridLayout->addLayout( controlBox, 4, 0 );
// add the control elements
pSaveCue = new KPushButton( iconLoader->loadIcon("filesave",KIcon::Small), i18n("Save cuesheet ..."), this, "pSaveCue" );
controlBox->addWidget( pSaveCue );
connect( pSaveCue, SIGNAL(clicked()),
this, SLOT(saveCuesheetClicked())
);
controlBox->addStretch();
cAdd = new ComboButton( this, "cAdd" );
cAdd->insertItem( iconLoader->loadIcon("fileopen",KIcon::Small),i18n("Add all tracks") );
cAdd->insertItem( iconLoader->loadIcon("fileopen",KIcon::Small),i18n("Add selected tracks") );
RipperPlugin* plugin = config->getCurrentRipper();
if( plugin != 0 && plugin->rip.full_disc.enabled ) cAdd->insertItem( iconLoader->loadIcon("cdaudio_unmount",KIcon::Small),i18n("Add full CD as one file") );
//cAdd->setSizeMode( ComboButton::Min );
controlBox->addWidget( cAdd );
connect( cAdd, SIGNAL(clicked(int)),
this, SLOT(addClicked(int))
);
pCancel = new KPushButton( iconLoader->loadIcon("cancel",KIcon::Small), i18n("Cancel"), this, "pCancel" );
controlBox->addWidget( pCancel );
connect( pCancel, SIGNAL(clicked()),
this, SLOT(reject())
);
// delete the icon loader object
delete iconLoader;
bool various_artists = false;
bool various_composer = false;
QString artist = "";
QString composer = "";
QString album = "";
int disc = 0;
int year = 0;
QString genre = "";
device = cdManager->newCDDevice( _device );
// don't execute the dialog, if no audio cd was found
noCD = device.isEmpty();
QValueList<TagData*> tags = cdManager->getTrackList( device );
for( QValueList<TagData*>::Iterator it = tags.begin(); it != tags.end(); ++it ) {
if( artist == "" ) artist = (*it)->artist;
else if( artist != (*it)->artist ) various_artists = true;
if( composer == "" ) composer = (*it)->composer;
else if( composer != (*it)->composer ) various_composer = true;
if( album == "" ) album = (*it)->album;
if( disc == 0 ) disc = (*it)->disc;
if( year == 0 ) year = (*it)->year;
if( genre == "" ) genre = (*it)->genre;
new KListViewItem( trackList, QString().sprintf("%02i",(*it)->track), (*it)->artist, (*it)->composer, (*it)->title, QString().sprintf("%i:%02i",(*it)->length/60,(*it)->length%60) );
}
trackList->setSorting( -1 );
// fill in the cd information
if( various_artists ) cArtist->setCurrentItem( 0 );
else cArtist->setCurrentText( artist );
artistChanged( cArtist->currentText() );
if( various_composer ) cComposer->setCurrentItem( 0 );
else cComposer->setCurrentText( composer );
composerChanged( cComposer->currentText() );
lAlbum->setText( album );
if( disc != 0 ) iDisc->setValue( disc );
if( year != 0 ) iYear->setValue( year );
cGenre->setCurrentText( genre );
//trackList->setCurrentItem( trackList->firstChild() );
trackList->setSelected( trackList->firstChild(), true );
pTrackUp->setEnabled( false );
if( trackList->firstChild() != 0 ) {
if( trackList->firstChild()->itemBelow() != 0 ) {
pTrackDown->setEnabled( true );
}
else {
pTrackDown->setEnabled( false );
}
}
else {
pTrackDown->setEnabled( false );
}
}
CDOpener::~CDOpener()
{}
int CDOpener::columnByName( const QString& name )
{
for( int i = 0; i < trackList->columns(); ++i ) {
if( trackList->columnText( i ) == name ) return i;
}
return -1;
}
void CDOpener::trackUpPressed()
{
QListViewItem* item = selectedItems.first()->itemAbove();
if( item != 0 ) {
item->setSelected( true );
trackList->repaintItem( item );
trackList->ensureItemVisible( item );
}
else {
return; // NULL pointer (cannot be)
}
for( QValueList<QListViewItem*>::Iterator it = selectedItems.begin(); it != selectedItems.end(); ++it ) {
(*it)->setSelected( false );
trackList->repaintItem( *it );
}
if( item->itemAbove() == 0 ) {
pTrackUp->setEnabled( false );
}
pTrackDown->setEnabled( true );
trackChanged();
}
void CDOpener::trackDownPressed()
{
QListViewItem* item = selectedItems.last()->itemBelow();
if( item != 0 ) {
item->setSelected( true );
trackList->repaintItem( item );
trackList->ensureItemVisible( item );
}
else {
return; // NULL pointer (cannot be)
}
for( QValueList<QListViewItem*>::Iterator it = selectedItems.begin(); it != selectedItems.end(); ++it ) {
(*it)->setSelected( false );
trackList->repaintItem( *it );
}
pTrackUp->setEnabled( true );
if( item->itemBelow() == 0 ) {
pTrackDown->setEnabled( false );
}
trackChanged();
}
void CDOpener::trackChanged()
{
// NOTE if no track is selected soundkonverter could use the current item as default item (like qlistview does)
int i = 0;
// rebuild the list of the selected tracks
selectedTracks.clear();
selectedItems.clear();
for( QListViewItem *item = trackList->firstChild(); item != NULL; item = item->nextSibling() ) {
i++;
if( item->isSelected() ) {
selectedTracks.append( i );
selectedItems.append( item );
}
}
// insert the new values
if( selectedTracks.count() < 1 ) {
pTrackUp->setEnabled( false );
pTrackDown->setEnabled( false );
lTrackTitle->setEnabled( false );
lTrackTitle->setText( "" );
pTrackTitleEdit->hide();
lTrackArtist->setEnabled( false );
lTrackArtist->setText( "" );
pTrackArtistEdit->hide();
lTrackComposer->setEnabled( false );
lTrackComposer->setText( "" );
pTrackComposerEdit->hide();
tTrackComment->setEnabled( false );
tTrackComment->setReadOnly( true );
tTrackComment->setText( "" );
pTrackCommentEdit->hide();
return;
}
else if( selectedTracks.count() > 1 ) {
if( selectedItems.first()->itemAbove() != 0 ) pTrackUp->setEnabled( true );
else pTrackUp->setEnabled( false );
if( selectedItems.last()->itemBelow() != 0 ) pTrackDown->setEnabled( true );
else pTrackDown->setEnabled( false );
QString trackListString = "";
if( selectedTracks.count() == trackList->childCount() ) {
trackListString = i18n("All tracks");
}
else {
trackListString = i18n("Tracks") + QString().sprintf(" %02i",selectedTracks.first());
QValueList<int>::Iterator track = selectedTracks.begin();
track++;
for( ; track != selectedTracks.end(); ++track ) {
trackListString += QString().sprintf(", %02i",*track);
}
}
tagGroupBox->setTitle( trackListString );
QString title = cdManager->getTags( device, selectedTracks.first() )->title;
bool equalTitles = true;
QString artist = cdManager->getTags( device, selectedTracks.first() )->artist;
bool equalArtists = true;
QString composer = cdManager->getTags( device, selectedTracks.first() )->composer;
bool equalComposers = true;
QString comment = cdManager->getTags( device, selectedTracks.first() )->comment;
bool equalComments = true;
for( QValueList<int>::Iterator track = selectedTracks.begin(); track != selectedTracks.end(); ++track ) {
TagData* tags = cdManager->getTags( device, *track );
if( title != tags->title ) equalTitles = false;
if( artist != tags->artist ) equalArtists = false;
if( composer != tags->composer ) equalComposers = false;
if( comment != tags->comment ) equalComments = false;
}
if( equalTitles ) {
lTrackTitle->setEnabled( true );
lTrackTitle->setText( title );
pTrackTitleEdit->hide();
}
else {
lTrackTitle->setEnabled( false );
lTrackTitle->setText( "" );
pTrackTitleEdit->show();
}
if( cArtist->currentText() == i18n("Various Artists") && equalArtists ) {
lTrackArtist->setEnabled( true );
lTrackArtist->setText( artist );
pTrackArtistEdit->hide();
}
else if( cArtist->currentText() == i18n("Various Artists") ) {
lTrackArtist->setEnabled( false );
lTrackArtist->setText( "" );
pTrackArtistEdit->show();
}
else {
lTrackArtist->setEnabled( false );
lTrackArtist->setText( cArtist->currentText() );
pTrackArtistEdit->hide();
}
if( cComposer->currentText() == i18n("Various Composer") && equalComposers ) {
lTrackComposer->setEnabled( true );
lTrackComposer->setText( composer );
pTrackComposerEdit->hide();
}
else if( cComposer->currentText() == i18n("Various Composer") ) {
lTrackComposer->setEnabled( false );
lTrackComposer->setText( "" );
pTrackComposerEdit->show();
}
else {
lTrackComposer->setEnabled( false );
lTrackComposer->setText( cComposer->currentText() );
pTrackComposerEdit->hide();
}
if( equalComments ) {
tTrackComment->setEnabled( true );
tTrackComment->setReadOnly( false );
tTrackComment->setText( comment );
pTrackCommentEdit->hide();
}
else {
tTrackComment->setEnabled( false );
tTrackComment->setReadOnly( true );
tTrackComment->setText( "" );
pTrackCommentEdit->show();
}
}
else {
if( selectedItems.first()->itemAbove() != 0 ) pTrackUp->setEnabled( true );
else pTrackUp->setEnabled( false );
if( selectedItems.first()->itemBelow() != 0 ) pTrackDown->setEnabled( true );
else pTrackDown->setEnabled( false );
tagGroupBox->setTitle( i18n("Track") + QString().sprintf(" %02i",selectedTracks.first()) );
TagData* tags = cdManager->getTags( device, selectedTracks.first() );
lTrackTitle->setEnabled( true );
lTrackTitle->setText( tags->title );
pTrackTitleEdit->hide();
if( cArtist->currentText() == i18n("Various Artists") ) {
lTrackArtist->setEnabled( true );
lTrackArtist->setText( tags->artist );
pTrackArtistEdit->hide();
}
else {
lTrackArtist->setEnabled( false );
lTrackArtist->setText( cArtist->currentText() );
pTrackArtistEdit->hide();
}
if( cComposer->currentText() == i18n("Various Composer") ) {
lTrackComposer->setEnabled( true );
lTrackComposer->setText( tags->composer );
pTrackComposerEdit->hide();
}
else {
lTrackComposer->setEnabled( false );
lTrackComposer->setText( cComposer->currentText() );
pTrackComposerEdit->hide();
}
tTrackComment->setEnabled( true );
tTrackComment->setReadOnly( false );
tTrackComment->setText( tags->comment );
pTrackCommentEdit->hide();
}
}
void CDOpener::artistChanged( const QString& text )
{
if( text == i18n("Various Artists") ) {
trackList->adjustColumn( columnByName( i18n("Artist") ) );
}
else {
trackList->setColumnWidth( columnByName( i18n("Artist") ), 0 );
}
trackChanged();
}
void CDOpener::composerChanged( const QString& text )
{
if( text == i18n("Various Composer") ) {
trackList->adjustColumn( columnByName( i18n("Composer") ) );
}
else {
trackList->setColumnWidth( columnByName( i18n("Composer") ), 0 );
}
trackChanged();
}
void CDOpener::trackTitleChanged( const QString& text )
{
if( !lTrackTitle->isEnabled() ) return;
for( QValueList<QListViewItem*>::Iterator it = selectedItems.begin(); it != selectedItems.end(); ++it ) {
(*it)->setText( columnByName( i18n("Title") ), text );
}
for( QValueList<int>::Iterator it = selectedTracks.begin(); it != selectedTracks.end(); ++it ) {
TagData* tags = cdManager->getTags( device, *it );
tags->title = text;
}
}
void CDOpener::trackArtistChanged( const QString& text )
{
if( !lTrackArtist->isEnabled() ) return;
for( QValueList<QListViewItem*>::Iterator it = selectedItems.begin(); it != selectedItems.end(); ++it ) {
(*it)->setText( columnByName( i18n("Artist") ), text );
}
for( QValueList<int>::Iterator it = selectedTracks.begin(); it != selectedTracks.end(); ++it ) {
TagData* tags = cdManager->getTags( device, *it );
tags->artist = text;
}
}
void CDOpener::trackComposerChanged( const QString& text )
{
if( !lTrackComposer->isEnabled() ) return;
for( QValueList<QListViewItem*>::Iterator it = selectedItems.begin(); it != selectedItems.end(); ++it ) {
(*it)->setText( columnByName( i18n("Composer") ), text );
}
for( QValueList<int>::Iterator it = selectedTracks.begin(); it != selectedTracks.end(); ++it ) {
TagData* tags = cdManager->getTags( device, *it );
tags->composer = text;
}
}
void CDOpener::trackCommentChanged()
{
QString text = tTrackComment->text();
if( !tTrackComment->isEnabled() ) return;
for( QValueList<int>::Iterator it = selectedTracks.begin(); it != selectedTracks.end(); ++it ) {
TagData* tags = cdManager->getTags( device, *it );
tags->comment = text;
}
}
void CDOpener::editTrackTitleClicked()
{
lTrackTitle->setEnabled( true );
lTrackTitle->setFocus();
pTrackTitleEdit->hide();
trackTitleChanged( lTrackTitle->text() );
}
void CDOpener::editTrackArtistClicked()
{
lTrackArtist->setEnabled( true );
lTrackArtist->setFocus();
pTrackArtistEdit->hide();
trackArtistChanged( lTrackArtist->text() );
}
void CDOpener::editTrackComposerClicked()
{
lTrackComposer->setEnabled( true );
lTrackComposer->setFocus();
pTrackComposerEdit->hide();
trackComposerChanged( lTrackComposer->text() );
}
void CDOpener::editTrackCommentClicked()
{
tTrackComment->setEnabled( true );
tTrackComment->setReadOnly( false );
tTrackComment->setFocus();
pTrackCommentEdit->hide();
trackCommentChanged();
}
void CDOpener::addClicked( int index )
{
if( index == 0 )
{
QValueList<int> allTracks;
// TODO save all options (album artist, disc, genre, etc.)
for( int it = 1; it <= cdManager->getTrackCount(device); ++it ) {
TagData* tags = cdManager->getTags( device, it );
if( cArtist->currentText() != i18n("Various Artists") ) tags->artist = cArtist->currentText();
if( cComposer->currentText() != i18n("Various Composer") ) tags->composer = cComposer->currentText();
tags->album = lAlbum->text();
tags->disc = iDisc->value();
tags->year = iYear->value();
tags->genre = cGenre->currentText();
allTracks += it;
}
emit addTracks( device, allTracks );
}
else if( index == 1 )
{
// TODO save all options (album artist, disc, genre, etc.)
for( QValueList<int>::Iterator it = selectedTracks.begin(); it != selectedTracks.end(); ++it ) {
TagData* tags = cdManager->getTags( device, *it );
if( cArtist->currentText() != i18n("Various Artists") ) tags->artist = cArtist->currentText();
if( cComposer->currentText() != i18n("Various Composer") ) tags->composer = cComposer->currentText();
tags->album = lAlbum->text();
tags->disc = iDisc->value();
tags->year = iYear->value();
tags->genre = cGenre->currentText();
}
emit addTracks( device, selectedTracks );
}
else
{
// TODO save all options (album artist, disc, genre, etc.)
cdManager->setDiscTags( device,
new TagData( cArtist->currentText(), cComposer->currentText(),
lAlbum->text(), /*cArtist->currentText() + " - " + */lAlbum->text(),
cGenre->currentText(), "",
1, iDisc->value(), iYear->value(),
cdManager->getTimeCount(device) ) );
emit addDisc( device );
}
accept();
}
// void CDOpener::addAsOneTrackClicked()
// {
// // TODO save all options (album artist, disc, genre, etc.)
// cdManager->setDiscTags( device,
// new TagData( cArtist->currentText(), cComposer->currentText(),
// lAlbum->text(), /*cArtist->currentText() + " - " + */lAlbum->text(),
// cGenre->currentText(), "",
// 1, iDisc->value(), iYear->value(),
// cdManager->getTimeCount(device) ) );
//
// emit addDisc( device );
// accept();
// }
void CDOpener::saveCuesheetClicked()
{
QString filename = KFileDialog::getSaveFileName( QDir::homeDirPath(), "*.cue" );
if( filename.isEmpty() ) return;
QFile cueFile( filename );
if( cueFile.exists() ) {
int ret = KMessageBox::questionYesNo( this,
i18n("A file with this name already exists.\n\nDo you want to overwrite the existing one?"),
i18n("File already exists") );
if( ret == KMessageBox::No ) return;
}
if( !cueFile.open( IO_WriteOnly ) ) return;
QString content;
content.append( "TITLE \"" + lAlbum->text() + "\"\n" );
content.append( "PERFORMER \"" + cArtist->currentText() + "\"\n" );
content.append( "FILE \"\" MP3\n" );
int INDEX = 0;
bool addFrames = false;
QValueList<TagData*> tags = cdManager->getTrackList( device );
for( QValueList<TagData*>::Iterator it = tags.begin(); it != tags.end(); ++it ) {
content.append( QString().sprintf(" TRACK %02i AUDIO\n",(*it)->track ) );
content.append( " TITLE \"" + (*it)->title + "\"\n" );
content.append( " PERFORMER \"" + (*it)->artist + "\"\n" );
if( addFrames ) {
content.append( QString().sprintf(" INDEX 01 %02i:%02i:37\n",INDEX/60,INDEX%60) );
INDEX++;
addFrames = false;
}
else {
content.append( QString().sprintf(" INDEX 01 %02i:%02i:00\n",INDEX/60,INDEX%60) );
addFrames = true;
}
INDEX += (*it)->length;
}
QTextStream ts( &cueFile );
ts << content;
cueFile.close();
}

@ -0,0 +1,139 @@
#ifndef CDOPENER_H
#define CDOPENER_H
#include <kdialog.h>
class CDManager;
class TagEngine;
class Config;
class ComboButton;
class KListView;
class KPushButton;
class KLineEdit;
class KComboBox;
class KIntSpinBox;
class KTextEdit;
class QGroupBox;
class QListViewItem;
/**
* @short Shows a dialog for selecting files from a CD
* @author Daniel Faust <hessijames@gmail.com>
* @version 0.3
*/
class CDOpener : public KDialog
{
Q_OBJECT
public:
// enum Mode {
// all_tracks,
// selected_tracks,
// full_cd
// };
/**
* Constructor
* @param parent The parent widget
* @param name The name of the file list
* @p modal Sets whether the dialog is modal or not
* @p f Some flags
*/
CDOpener( Config*, CDManager*, TagEngine*, const QString &device, QWidget *parent = 0, const char *name = 0, /*Mode default_mode = all_tracks, const QString& default_text = "",*/ bool modal = true, WFlags f = 0 );
/**
* Destructor
*/
virtual ~CDOpener();
/** true if no CD was found (don't execute the dialog) */
bool noCD;
private:
/** A list of all tracks on the CD */
KListView *trackList;
/** A combobox for entering the artist or selecting VA of the whole CD */
KComboBox *cArtist;
/** A combobox for entering the composer or selecting VC of the whole CD */
KComboBox *cComposer;
/** A lineedit for entering the album name */
KLineEdit *lAlbum;
/** A spinbox for entering or selecting the disc number */
KIntSpinBox *iDisc;
/** A spinbox for entering or selecting the year of the album */
KIntSpinBox *iYear;
/** A combobox for entering or selecting the genre of the album */
KComboBox *cGenre;
/** Request CDDB information */
// KPushButton *pCDDB;
/** The groupbox shows the selected track numbers */
QGroupBox *tagGroupBox;
/** Set the focus of the tag editor to the track over it */
KPushButton *pTrackUp;
/** Set the focus of the tag editor to the track under it */
KPushButton *pTrackDown;
/** A lineedit for entering the title of track */
KLineEdit *lTrackTitle;
KPushButton *pTrackTitleEdit;
/** A lineedit for entering the artist of a track */
KLineEdit *lTrackArtist;
KPushButton *pTrackArtistEdit;
/** A lineedit for entering the composer of a track */
KLineEdit *lTrackComposer;
KPushButton *pTrackComposerEdit;
/** A textedit for entering a comment for a track */
KTextEdit *tTrackComment;
KPushButton *pTrackCommentEdit;
/** Save the tag information to a cue file */
KPushButton *pSaveCue;
//** Add whole CD as one track and quit the dialog */
//KPushButton *pAddAsOneTrack;
//** Add selected tracks to the file list and quit the dialog */
//KPushButton *pAdd;
ComboButton* cAdd;
/** Quit the dialog */
KPushButton *pCancel;
CDManager* cdManager;
TagEngine* tagEngine;
Config* config;
QString device;
QValueList<int> selectedTracks;
QValueList<QListViewItem*> selectedItems;
int columnByName( const QString& name );
private slots:
void trackChanged();
void trackUpPressed();
void trackDownPressed();
void artistChanged( const QString& text );
void composerChanged( const QString& text );
void trackTitleChanged( const QString& text );
void trackArtistChanged( const QString& text );
void trackComposerChanged( const QString& text );
void trackCommentChanged();
void editTrackTitleClicked();
void editTrackArtistClicked();
void editTrackComposerClicked();
void editTrackCommentClicked();
void addClicked( int index = 1 );
// void addAsOneTrackClicked();
void saveCuesheetClicked();
signals:
void addTracks( const QString& device, QValueList<int> );
void addDisc( const QString& device );
//void openCuesheetEditor( const QString& content );
};
#endif // CDOPENER_H

@ -0,0 +1,114 @@
#include "combobutton.h"
#include <qlayout.h>
#include <qstring.h>
#include <qpixmap.h>
#include <qstyle.h>
#include <kpushbutton.h>
#include <kcombobox.h>
ComboButton::ComboButton( QWidget *parent, const char *name )
: QWidget( parent, name )
{
m_increaseHeight = 0;
QGridLayout *grid = new QGridLayout( this, 1, 1 );
m_box = new KComboBox(this);
grid->addWidget(m_box,0,0);
connect( m_box, SIGNAL(activated(int)),
this, SLOT(boxActivated(int))
);
m_button = new KPushButton( QString::null, this, "pushbutton" );
grid->addWidget( m_button, 0, 0 );
connect( m_button, SIGNAL(clicked()),
this, SLOT(buttonClicked())
);
m_sizeMode = Max;
balanceSize();
}
ComboButton::~ComboButton()
{
}
void ComboButton::balanceSize()
{
int width;
if( m_sizeMode == Max )
width = m_box->sizeHint().width()-17;
else
width = m_button->sizeHint().width();
int height = ( m_box->sizeHint().height() > m_button->sizeHint().height() ) ? m_box->sizeHint().height() : m_button->sizeHint().height();
m_box->setFixedSize( width+17, height+m_increaseHeight );
m_button->setFixedSize( width, height+m_increaseHeight );
}
void ComboButton::repaintButton()
{
m_button->setText( m_box->currentText() );
if(m_box->pixmap( m_box->currentItem()) )
m_button->setIconSet( *m_box->pixmap(m_box->currentItem()) );
balanceSize();
}
void ComboButton::insertItem( const QString &text, int index )
{
m_box->insertItem( text, index );
repaintButton();
}
void ComboButton::insertItem( const QPixmap &pixmap, const QString &text, int index )
{
m_box->insertItem( pixmap, text, index );
repaintButton();
}
void ComboButton::increaseHeight( int height )
{
m_increaseHeight = height;
balanceSize();
}
void ComboButton::boxActivated( int index )
{
repaintButton();
emit clicked( index );
}
void ComboButton::buttonClicked()
{
emit clicked( m_box->currentItem() );
}
void ComboButton::setSizeMode( int mode )
{
m_sizeMode = mode;
balanceSize();
}
int ComboButton::sizeMode()
{
return m_sizeMode;
}
void ComboButton::setFont( const QFont& font )
{
m_button->setFont( font );
m_box->setFont( font );
}
QFont ComboButton::font()
{
return m_button->font();
}

@ -0,0 +1,110 @@
#ifndef COMBOBUTTON_H
#define COMBOBUTTON_H
#include <qwidget.h>
class QString;
class QPixmap;
class KPushButton;
class KComboBox;
/**
* @short ComboButton
* @author Daniel Faust <hessijames@gmail.com>
* @version 0.3
*/
class ComboButton : public QWidget
{
Q_OBJECT
public:
enum SizeMode {
Min, Max
};
/**
* Constructor
* @param parent The parent widget
* @param name The name of the file list
*/
ComboButton( QWidget *parent, const char *name = 0 );
/**
* Destructor
*/
virtual ~ComboButton();
/**
* Insert a new item with @p text at position @p index
*/
void insertItem( const QString &text, int index = -1 );
/**
* Insert a new item with an icon @p pixmap and @p text at position @p index
*/
void insertItem( const QPixmap &pixmap, const QString &text, int index = -1 );
/**
* Increase the combobutton's height by @p height
*/
void increaseHeight( int height );
/**
* Sets m_sizeMode to @p mode
*/
void setSizeMode( int mode );
/**
* Returns the m_sizeMode
*/
int sizeMode();
/**
* Sets the font of the combobutton
*/
void setFont( const QFont& font );
/**
* Returns the font of the button
*/
QFont font();
private:
/** A pointer to the button */
KPushButton *m_button;
/** A pointer to the combobox */
KComboBox *m_box;
int m_increaseHeight;
/** The actual size mode */
int m_sizeMode;
/** Recalculate the size of the combobutton */
void balanceSize();
/** The button gets a new label, etc. */
void repaintButton();
//public slots:
//void setCurrentItem(const QString &item, bool insert=false, int index=-1);
//void setCurrentItem(int index);
private slots:
/**
* Is called when the user selects an item from the popdown menu of the combobox
*/
void boxActivated( int index );
/**
* Is called when the user clicks the button
*/
void buttonClicked();
signals:
/**
* The signal clicked is emitted, when the user selects an item
*/
void clicked( int index );
};
#endif // COMBOBUTTON_H

File diff suppressed because it is too large Load Diff

@ -0,0 +1,354 @@
#ifndef CONFIG_H
#define CONFIG_H
#include "formatinfoloader.h"
#include "conversionoptions.h"
#include <qobject.h>
#include <qvaluelist.h>
#include <qstringlist.h>
#include <qmap.h>
class Logger;
class ConvertPlugin;
//class ConvertPluginLoader;
class ReplayGainPlugin;
//class ReplayGainPluginLoader;
class RipperPlugin;
struct ProfileData;
/**
* @short Format items for the format list
* @author Daniel Faust <hessijames@gmail.com>
* @version 0.3
*/
class FormatItem
{
public:
/**
* Constructor
*/
FormatItem();
/**
* Destructor
*/
virtual ~FormatItem();
QStringList mime_types;
QStringList extensions; // for easy use
QStringList correction_file_mime_types;
QStringList correction_file_extensions; // for easy use
QString description;
FormatInfo::CompressionType compressionType;
int compressionLevel; // the value from the config dialog
bool internalReplayGain;
int size;
QValueList<ConvertPlugin*> encoders;
QValueList<ConvertPlugin*> decoders;
QValueList<ReplayGainPlugin*> replaygains;
//QValueList<RepairerPlugin*> repairers;
ConvertPlugin* encoder;
ConvertPlugin* decoder;
ReplayGainPlugin* replaygain;
//RepairerPlugin* repairer;
};
/**
* @short Configuration class
* @author Daniel Faust <hessijames@gmail.com>
* @version 0.3
*/
class Config : public QObject
{
Q_OBJECT
public:
/**
* Constructor
*/
Config( Logger* );
/**
* Destructor
*/
virtual ~Config();
/**
* Read the preferences from the configuration file
*/
void read();
/**
* Write the preferences to the configuration file
*/
void write( bool sync = true );
/**
* Read the profiles from the profiles file
*/
void readProfiles();
/**
* Write the profiles to the profiles file
*/
void writeProfiles();
/**
* Get the encoder for a given file format (mime type or extension)
*/
ConvertPlugin* encoderForFormat( const QString &format );
/**
* Get the decoder for a given file format (mime type or extension)
*/
ConvertPlugin* decoderForFormat( const QString &format );
/**
* Get the decoder for a given file format (mime type or extension)
*/
ReplayGainPlugin* replaygainForFormat( const QString &format );
/**
* Get the format information for a given file format (mime type or extension)
*/
FormatItem* getFormatItem( const QString &format );
/**
* Get the current ripper
*/
RipperPlugin* getCurrentRipper() { return currentRipper; }
/**
* Set the current ripper
*/
void setCurrentRipper( RipperPlugin* ripper ) { currentRipper = ripper; }
/**
* Returns a list of all loaded rippers
*/
QValueList<RipperPlugin*> allRippers() { return rippers; }
/**
* Returns a list of all loaded converters
*/
QValueList<ConvertPlugin*> allConverters() { return converters; }
/**
* Returns a list of all loaded replaygains
*/
QValueList<ReplayGainPlugin*> allReplayGains() { return replaygains; }
/**
* Returns a list of all known file formats
*/
QStringList allFormats();
/**
* Returns a list of all known encodeable file formats
*/
QStringList allEncodableFormats();
/**
* Returns a list of all known lossy encodeable file formats
*/
QStringList allLossyEncodableFormats();
/**
* Returns a list of all known lossless encodeable file formats
*/
QStringList allLosslessEncodableFormats();
/**
* Returns a list of all known hybrid encodeable file formats
*/
QStringList allHybridEncodableFormats();
/**
* Returns the extension of the correction file format for the given format
* If there is nor correction file format, the returned string is empty
*/
QString getCorrectionExtension( const QString &format );
/**
* Returns a localized description for the given format
*/
QString getFormatDescription( const QString &format );
/**
* Add a new profile
*/
void addProfile( const QString &name, const ConversionOptions& profile );
/**
* Remove a new profile
*/
void removeProfile( const QString &name );
/**
* Returns the conversion options for a profile
*/
ConversionOptions getProfile( const QString &name );
/**
* Returns the name of the profile with conversion options @p options
*/
QString getProfileName( const ConversionOptions& options );
/**
* Returns a list of all user defined profiles
*/
QStringList getAllProfiles();
/**
* Returns true if the @p file can be added to the conversion list (can be decoded)
*/
bool acceptFile( const QString& format );
/**
* Returns true if the @p file can be added to the replay gain tool
*/
bool acceptReplayGainFile( const QString& format );
/**
* Returns a file filter suitable for the file open dialog
*/
QString fileFilter( bool wav = true );
/**
* Returns a string list of supported file formats
*/
QStringList fileTypes( bool wav = true );
/**
* Returns a file filter suitable for the file open dialog for the replay gain scanner
*/
QString replayGainFilter();
/**
* Returns a string list of Replay Gain supported file formats
*/
QStringList replayGainFileTypes();
struct Data {
struct General {
int startTab;
int lastTab;
QString defaultProfile;
QString defaultFormat;
// QString defaultOutputDirectory;
QString specifyOutputDirectory;
QString metaDataOutputDirectory;
QString copyStructureOutputDirectory;
int priority;
bool useVFATNames;
int conflictHandling;
int numFiles;
int updateDelay;
bool askForNewOptions;
bool executeUserScript;
bool showToolBar;
} general;
struct Plugins {
bool checkForUpdates;
} plugins;
struct Environment {
QStringList directories;
QStringList foundPrograms;
} environment;
struct App {
int configVersion;
} app;
} data;
bool onlinePluginsChanged;
bool backendsChanged;
QMap<QString, QString> binaries;
private:
struct PluginMapData {
int version;
QString filename;
QString type;
};
Logger* logger;
/** holds all known formats */
QValueList<FormatItem> formats;
/** holds all known rippers */
QValueList<RipperPlugin*> rippers;
RipperPlugin* currentRipper;
/** holds all known converters */
QValueList<ConvertPlugin*> converters;
/** holds all known replaygain apps */
QValueList<ReplayGainPlugin*> replaygains;
/* holds all known file repairing apps */
// QValueList<RepairerItem> repairer;
//ConvertPluginLoader* convertPluginLoader;
//ReplayGainPluginLoader* replaygainPluginLoader;
/** holds all user defined profiles */
QValueList<ProfileData> profiles;
/**
* Load the files with the file infos (format descriptions, file size, etc.)
*/
void loadFileInfos();
/**
* Load all plugins that can be found
*/
void loadPlugins();
/**
* A plugin wants to register it's features for a file format
* @p binary The binary name of the app that wants to register it's features
* @p extension The file name extension for that is wants to register
* @p features The features of the app for that extension
*/
void registerFormatFeatures( const QString &mime_type,
ConvertPlugin* encoder = 0, ConvertPlugin* decoder = 0,
ReplayGainPlugin* replaygain = 0/*, RepairPlugin* repairer = 0*/,
const QString &correction_file_mime_type = QString::null );
/**
* Generate the service menu
*/
void writeServiceMenu();
/**
* Copy the amarok script
*/
void writeAmarokScript();
/*
* We have new inforamtion for a file format
* @p extension The file name extension for that is wants to register
* @p newSynonym Register a new synonym for this file format?
* @p newMimeType Register a new mime type for this file format?
* @p newDescription Register a new description for this file format?
* @p newSize Register a new size for this file format for calculating the progress?
*/
/*void registerFileFormat( const QString &extension, const QString &newSynonym = QString::null,
const QString &newMimeType = QString::null,
const QString &newDescription = QString::null,
int newSize = 0, FormatInfo::CompressionType newCompressionType = FormatInfo::lossy );*/
//void registerFileFormat( const QString &mime_type, const QString &option, const QString &value );
// NOTE this function is obsolete.
// after loading all plugins and creating all neccessary file format items,
// sk will search for format info files and update the items.
signals:
void configChanged();
};
#endif // CONFIG_H

@ -0,0 +1,493 @@
#include "configbackendspage.h"
#include "convertpluginloader.h"
#include "replaygainpluginloader.h"
#include "ripperpluginloader.h"
#include "config.h"
#include <qlayout.h>
#include <qlabel.h>
#include <qgroupbox.h>
#include <qtooltip.h>
#include <qvbox.h>
#include <qslider.h>
#include <qcheckbox.h>
#include <kiconloader.h>
#include <klocale.h>
#include <kcombobox.h>
#include <kscrollview.h>
#include <kstandarddirs.h>
ConfigBackendsPage::ConfigBackendsPage( Config* _config, QMap<QString, QString>* _binaries, QWidget* parent, const char *name )
: ConfigPageBase( parent, name )
{
config = _config;
binaries = _binaries;
grid = new QGridLayout( parent );
scrollView = new KScrollView( parent, "scrollView" );
scrollView->setResizePolicy( QScrollView::AutoOneFit );
grid->addWidget( scrollView, 0, 0 );
box = new QVBox( scrollView->viewport() );
box->setMargin( 11 );
box->setSpacing( 6 );
scrollView->addChild( box );
QHBox* legendBox = new QHBox( box );
legendBox->setMargin( 0 );
legendBox->setSpacing( 6 );
KStandardDirs* stdDirs = new KStandardDirs();
QLabel* lLegendLabel = new QLabel( i18n("Legend")+":", legendBox, "lLegendLabel" );
QLabel* lLegendGreen = new QLabel( "", legendBox, "lLegendGreen" );
lLegendGreen->setPixmap( QPixmap(stdDirs->findResource("data","soundkonverter/pics/ledgreen_legend.png")) );
QLabel* lLegendFull = new QLabel( i18n("Full support"), legendBox, "lLegendFull" );
QLabel* lLegendYellow = new QLabel("",legendBox,"lLegendYellow");
lLegendYellow->setPixmap( QPixmap(stdDirs->findResource("data","soundkonverter/pics/ledyellow_legend.png")) );
QLabel* lLegendMost = new QLabel( i18n("Most supported"), legendBox, "lLegendMost" );
QLabel* lLegendRed = new QLabel( "", legendBox, "lLegendRed" );
lLegendRed->setPixmap( QPixmap(stdDirs->findResource("data","soundkonverter/pics/ledred_legend.png")) );
QLabel* lLegendBasic = new QLabel( i18n("Basic support"), legendBox, "lLegendBasic" );
legendBox->setStretchFactor( lLegendLabel, 1 );
QGroupBox* ripperGroup = new QGroupBox( 1, Qt::Vertical, box, "ripperGroup" );
ripperGroup->layout()->setSpacing( 6 );
ripperGroup->layout()->setMargin( 6 );
QLabel* lRipper = new QLabel( i18n("CD Ripper")+":", ripperGroup, "lRipper" );
cRipper = new KComboBox( ripperGroup, "cRipper" );
connect( cRipper, SIGNAL(activated(int)),
this, SLOT(cfgChanged())
);
delete stdDirs;
rebuild();
}
ConfigBackendsPage::~ConfigBackendsPage()
{}
void ConfigBackendsPage::resetDefaults()
{
int i;
int item;
int rank;
i = 1;
rank = 60;
item = 0;
QValueList<RipperPlugin*> rippers = config->allRippers();
for( QValueList<RipperPlugin*>::Iterator it = rippers.begin(); it != rippers.end(); ++it )
{
if( (*it)->rip.rank > rank ) {
rank = (*it)->rip.rank;
item = i;
}
i++;
}
cRipper->setCurrentItem( item );
for( QValueList<FormatOptions>::Iterator a = formatOptions.begin(); a != formatOptions.end(); ++a )
{
FormatItem* formatItem = config->getFormatItem( (*a).format );
if( formatItem == 0 ) continue;
i = item = rank = 0;
for( QValueList<ConvertPlugin*>::Iterator b = formatItem->encoders.begin(); b != formatItem->encoders.end(); ++b ) {
if( (*b)->enc.rank > rank ) {
rank = (*b)->enc.rank;
item = i;
}
i++;
}
(*a).cEncoder->setCurrentItem( item );
i = item = rank = 0;
for( QValueList<ConvertPlugin*>::Iterator b = formatItem->decoders.begin(); b != formatItem->decoders.end(); ++b ) {
if( (*b)->dec.rank > rank ) {
rank = (*b)->dec.rank;
item = i;
}
i++;
}
(*a).cDecoder->setCurrentItem( item );
i = item = rank = 0;
for( QValueList<ReplayGainPlugin*>::Iterator b = formatItem->replaygains.begin(); b != formatItem->replaygains.end(); ++b ) {
if( (*b)->replaygain.rank > rank ) {
rank = (*b)->replaygain.rank;
item = i;
}
i++;
}
(*a).cReplayGain->setCurrentItem( item );
}
encoderChanged();
for( QValueList<FormatOptions>::Iterator a = formatOptions.begin(); a != formatOptions.end(); ++a )
{
FormatItem* formatItem = config->getFormatItem( (*a).format );
if( formatItem == 0 ) continue;
QString encoder = (*a).cEncoder->currentText();
(*a).cInternalReplayGain->setChecked( false );
for( QValueList<ConvertPlugin*>::Iterator b = formatItem->encoders.begin(); b != formatItem->encoders.end(); ++b ) {
if( (*b)->enc.bin == encoder && (*b)->enc.strength.enabled ) {
if( (*b)->enc.strength.range_max >= (*b)->enc.strength.range_min )
(*a).sStrength->setValue( (*b)->enc.strength.default_value / (*b)->enc.strength.step );
else
(*a).sStrength->setValue( ( (*b)->enc.strength.range_min - (*b)->enc.strength.default_value ) / (*b)->enc.strength.step );
}
if( (*b)->enc.bin == encoder && (*b)->enc.replaygain.enabled ) {
if( formatItem->replaygain != 0 && formatItem->replaygain->replaygain.rank > (*b)->enc.replaygain.rank ) {
(*a).cInternalReplayGain->setChecked( false );
}
else {
(*a).cInternalReplayGain->setChecked( true );
}
}
}
}
strengthChanged();
cfgChanged();
}
void ConfigBackendsPage::saveSettings()
{
config->setCurrentRipper( 0 );
QValueList<RipperPlugin*> rippers = config->allRippers();
for( QValueList<RipperPlugin*>::Iterator it = rippers.begin(); it != rippers.end(); ++it )
{
if( (*it)->rip.bin == cRipper->currentText() ) {
config->setCurrentRipper( *it );
}
}
for( QValueList<FormatOptions>::Iterator a = formatOptions.begin(); a != formatOptions.end(); ++a )
{
FormatItem* formatItem = config->getFormatItem( (*a).format );
if( formatItem == 0 ) continue;
for( QValueList<ConvertPlugin*>::Iterator b = formatItem->encoders.begin(); b != formatItem->encoders.end(); ++b ) {
if( (*b)->enc.bin == (*a).cEncoder->currentText() ) {
formatItem->encoder = (*b);
if( (*b)->enc.strength.enabled ) {
formatItem->compressionLevel = (*a).sStrength->value();
}
if( (*b)->enc.replaygain.enabled ) {
formatItem->internalReplayGain = (*a).cInternalReplayGain->isChecked();
}
}
}
for( QValueList<ConvertPlugin*>::Iterator b = formatItem->decoders.begin(); b != formatItem->decoders.end(); ++b ) {
if( (*b)->dec.bin == (*a).cDecoder->currentText() ) {
formatItem->decoder = (*b);
}
}
for( QValueList<ReplayGainPlugin*>::Iterator b = formatItem->replaygains.begin(); b != formatItem->replaygains.end(); ++b ) {
if( (*b)->replaygain.bin == (*a).cReplayGain->currentText() ) {
formatItem->replaygain = (*b);
}
}
}
}
void ConfigBackendsPage::rebuild()
{
for( QValueList<FormatOptions>::Iterator it = formatOptions.begin(); it != formatOptions.end(); ++it )
{
delete (*it).lEncoder;
disconnect( (*it).cEncoder, SIGNAL(activated(int)), 0, 0 );
delete (*it).cEncoder;
delete (*it).lStrength;
disconnect( (*it).sStrength,SIGNAL(valueChanged(int)), 0, 0 );
delete (*it).sStrength;
delete (*it).lStrengthDisplay;
delete (*it).lDecoder;
disconnect( (*it).cDecoder, SIGNAL(activated(int)), 0, 0 );
delete (*it).cDecoder;
delete (*it).lReplayGain;
disconnect( (*it).cReplayGain, SIGNAL(activated(int)), 0, 0 );
delete (*it).cReplayGain;
disconnect( (*it).cInternalReplayGain, SIGNAL(toggled(bool)), 0, 0 );
delete (*it).cInternalReplayGain;
delete (*it).grid;
delete (*it).group;
}
formatOptions.clear();
// TODO show all extensions
QStringList formats = config->allFormats();
for( QStringList::Iterator it = formats.begin(); it != formats.end(); ++it )
{
FormatOptions options;
options.format = *it;
FormatItem *formatItem = config->getFormatItem( options.format );
QString title;
if( formatItem ) {
for( QStringList::Iterator at = formatItem->extensions.begin(); at != formatItem->extensions.end(); ++at ) {
if( !title.contains((*at).lower()) ) title += (*at).lower() + ", ";
}
title = title.left( title.length() - 2 );
/* title += " [";
for( QStringList::Iterator bt = formatItem->mime_types.begin(); bt != formatItem->mime_types.end(); ++bt ) {
if( !title.contains((*bt).lower()) ) title += (*bt).lower() + ", ";
}
title = title.left( title.length() - 2 ) + "]";*/
}
else {
title = options.format;
}
options.group = new QGroupBox( title, box, options.format );
options.group->setColumnLayout( 0, Qt::Vertical );
options.group->layout()->setSpacing( 6 );
options.group->layout()->setMargin( 6 );
options.group->show();
options.grid = new QGridLayout( options.group->layout() );
options.lEncoder = new QLabel( i18n("Encoder")+":", options.group, options.format );
options.lEncoder->show();
options.grid->addWidget( options.lEncoder, 0, 0 );
options.cEncoder = new KComboBox( options.group, options.format );
options.cEncoder->show();
connect( options.cEncoder, SIGNAL(activated(int)),
this, SLOT(cfgChanged())
);
connect( options.cEncoder, SIGNAL(activated(int)),
this, SLOT(encoderChanged())
);
options.grid->addWidget( options.cEncoder, 0, 1 );
options.lStrength = new QLabel( i18n("Strength")+":", options.group, options.format );
options.lStrength->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
options.lStrength->show();
options.grid->addWidget( options.lStrength, 0, 2 );
options.sStrength = new QSlider( Qt::Horizontal, options.group, options.format );
options.sStrength->setTickmarks( QSlider::Below );
options.sStrength->show();
QToolTip::add( options.sStrength, i18n("Set the compression strength:\n\nLeft = fast conversion\nRight = good resultant file") );
options.grid->addWidget( options.sStrength, 0, 3 );
connect( options.sStrength, SIGNAL(valueChanged(int)),
this, SLOT(cfgChanged())
);
connect( options.sStrength, SIGNAL(valueChanged(int)),
this, SLOT(strengthChanged())
);
options.lDecoder = new QLabel( i18n("Decoder")+":", options.group, options.format );
options.lDecoder->show();
options.grid->addWidget( options.lDecoder, 1, 0 );
options.cDecoder = new KComboBox( options.group, options.format );
options.cDecoder->show();
options.grid->addWidget( options.cDecoder, 1, 1 );
connect( options.cDecoder, SIGNAL(activated(int)),
this, SLOT(cfgChanged())
);
options.lStrengthDisplay = new QLabel( "", options.group, options.format );
options.lStrengthDisplay->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
options.lStrengthDisplay->setEnabled( false );
options.grid->addWidget( options.lStrengthDisplay, 1, 3 );
options.lReplayGain = new QLabel( i18n("Replay Gain")+":", options.group, options.format );
options.lReplayGain->show();
options.grid->addWidget( options.lReplayGain, 2, 0 );
options.cReplayGain = new KComboBox( options.group, options.format );
options.cReplayGain->show();
options.grid->addWidget( options.cReplayGain, 2, 1 );
connect( options.cReplayGain, SIGNAL(activated(int)),
this, SLOT(cfgChanged())
);
options.cInternalReplayGain = new QCheckBox( i18n("Use internal Replay Gain"), options.group, options.format );
QToolTip::add( options.cInternalReplayGain, i18n("Use the internal Replay Gain calculator of the encoder") );
options.grid->addWidget( options.cInternalReplayGain, 2, 3 );
connect( options.cInternalReplayGain, SIGNAL(toggled(bool)),
this, SLOT(cfgChanged())
);
options.grid->setColStretch( 0, 0 );
options.grid->setColStretch( 1, 1 );
options.grid->setColStretch( 2, 1 );
options.grid->setColStretch( 3, 1 );
formatOptions.append( options );
}
refill();
}
void ConfigBackendsPage::refill()
{
KStandardDirs* stdDirs = new KStandardDirs();
int i, item;
cRipper->clear();
i = item = 0;
cRipper->insertItem( QPixmap(stdDirs->findResource("data","soundkonverter/pics/ledyellow.png")), i18n("KDE audio CD protocol") );
i++;
QValueList<RipperPlugin*> rippers = config->allRippers();
for( QValueList<RipperPlugin*>::Iterator it = rippers.begin(); it != rippers.end(); ++it )
{
if( (*binaries)[(*it)->rip.bin] == "" ) continue;
if( (*it)->rip.rank >= 70 ) cRipper->insertItem( QPixmap(stdDirs->findResource("data","soundkonverter/pics/ledgreen.png")), (*it)->rip.bin );
else if( (*it)->rip.rank >= 40 ) cRipper->insertItem( QPixmap(stdDirs->findResource("data","soundkonverter/pics/ledyellow.png")), (*it)->rip.bin );
else cRipper->insertItem( QPixmap(stdDirs->findResource("data","soundkonverter/pics/ledred.png")), (*it)->rip.bin );
if( (*it) == config->getCurrentRipper() ) item = i;
i++;
}
cRipper->setCurrentItem( item );
for( QValueList<FormatOptions>::Iterator a = formatOptions.begin(); a != formatOptions.end(); ++a )
{
FormatItem* formatItem = config->getFormatItem( (*a).format );
(*a).cEncoder->clear();
(*a).cDecoder->clear();
(*a).cReplayGain->clear();
if( formatItem == 0 ) continue;
i = item = 0;
for( QValueList<ConvertPlugin*>::Iterator b = formatItem->encoders.begin(); b != formatItem->encoders.end(); ++b ) {
if( (*binaries)[(*b)->enc.bin] == "" ) continue;
if( (*b)->enc.rank >= 70 ) (*a).cEncoder->insertItem( QPixmap(stdDirs->findResource("data","soundkonverter/pics/ledgreen.png")), (*b)->enc.bin );
else if( (*b)->enc.rank >= 40 ) (*a).cEncoder->insertItem( QPixmap(stdDirs->findResource("data","soundkonverter/pics/ledyellow.png")), (*b)->enc.bin );
else (*a).cEncoder->insertItem( QPixmap(stdDirs->findResource("data","soundkonverter/pics/ledred.png")), (*b)->enc.bin );
if( (*b) == formatItem->encoder ) item = i;
i++;
}
(*a).cEncoder->setCurrentItem( item );
i = item = 0;
for( QValueList<ConvertPlugin*>::Iterator b = formatItem->decoders.begin(); b != formatItem->decoders.end(); ++b ) {
if( (*binaries)[(*b)->dec.bin] == "" ) continue;
if( (*b)->dec.rank >= 70 ) (*a).cDecoder->insertItem( QPixmap(stdDirs->findResource("data","soundkonverter/pics/ledgreen.png")), (*b)->dec.bin );
else if( (*b)->dec.rank >= 40 ) (*a).cDecoder->insertItem( QPixmap(stdDirs->findResource("data","soundkonverter/pics/ledyellow.png")), (*b)->dec.bin );
else (*a).cDecoder->insertItem( QPixmap(stdDirs->findResource("data","soundkonverter/pics/ledred.png")), (*b)->dec.bin );
if( (*b) == formatItem->decoder ) item = i;
i++;
}
(*a).cDecoder->setCurrentItem( item );
i = item = 0;
for( QValueList<ReplayGainPlugin*>::Iterator b = formatItem->replaygains.begin(); b != formatItem->replaygains.end(); ++b ) {
if( (*binaries)[(*b)->replaygain.bin] == "" ) continue;
if( (*b)->replaygain.rank >= 70 ) (*a).cReplayGain->insertItem( QPixmap(stdDirs->findResource("data","soundkonverter/pics/ledgreen.png")), (*b)->replaygain.bin );
else if( (*b)->replaygain.rank >= 40 ) (*a).cReplayGain->insertItem( QPixmap(stdDirs->findResource("data","soundkonverter/pics/ledyellow.png")), (*b)->replaygain.bin );
else (*a).cReplayGain->insertItem( QPixmap(stdDirs->findResource("data","soundkonverter/pics/ledred.png")), (*b)->replaygain.bin );
if( (*b) == formatItem->replaygain ) item = i;
i++;
}
(*a).cReplayGain->setCurrentItem( item );
}
delete stdDirs;
encoderChanged();
}
void ConfigBackendsPage::encoderChanged()
{
bool recalc;
for( QValueList<FormatOptions>::Iterator a = formatOptions.begin(); a != formatOptions.end(); ++a )
{
FormatItem* formatItem = config->getFormatItem( (*a).format );
(*a).lStrength->hide();
(*a).sStrength->hide();
(*a).lStrengthDisplay->hide();
(*a).cInternalReplayGain->hide();
if( formatItem == 0 ) continue;
QString encoder = (*a).cEncoder->currentText();
for( QValueList<ConvertPlugin*>::Iterator b = formatItem->encoders.begin(); b != formatItem->encoders.end(); ++b ) {
if( QObject::sender() && (*a).format == QObject::sender()->name() ) recalc = true;
else if( !QObject::sender() ) recalc = true;
else recalc = false;
if( (*b)->enc.bin == encoder && (*b)->enc.strength.enabled ) {
(*a).lStrength->show();
if( (*b)->enc.strength.range_max >= (*b)->enc.strength.range_min ) {
(*a).sStrength->setMinValue( (int)((*b)->enc.strength.range_min/(*b)->enc.strength.step) );
(*a).sStrength->setMaxValue( (int)((*b)->enc.strength.range_max/(*b)->enc.strength.step) );
}
else {
(*a).sStrength->setMinValue( (int)((*b)->enc.strength.range_max/(*b)->enc.strength.step) );
(*a).sStrength->setMaxValue( (int)((*b)->enc.strength.range_min/(*b)->enc.strength.step) );
}
(*a).sStrength->setPageStep( 1 );
if( QObject::sender() && (*a).format == QObject::sender()->name() ) {
if( (*b)->enc.strength.range_max >= (*b)->enc.strength.range_min )
(*a).sStrength->setValue( (*b)->enc.strength.default_value / (*b)->enc.strength.step );
else
(*a).sStrength->setValue( ( (*b)->enc.strength.range_min - (*b)->enc.strength.default_value ) / (*b)->enc.strength.step );
}
else if( !QObject::sender() ) {
(*a).sStrength->setValue( formatItem->compressionLevel );
}
(*a).sStrength->show();
(*a).lStrengthDisplay->show();
}
if( (*b)->enc.bin == encoder && (*b)->enc.replaygain.enabled ) {
(*a).cInternalReplayGain->show();
if( recalc ) (*a).cInternalReplayGain->setChecked( formatItem->internalReplayGain );
}
}
}
strengthChanged();
}
void ConfigBackendsPage::strengthChanged()
{
for( QValueList<FormatOptions>::Iterator a = formatOptions.begin(); a != formatOptions.end(); ++a )
{
FormatItem* formatItem = config->getFormatItem( (*a).format );
if( formatItem == 0 ) continue;
QString encoder = (*a).cEncoder->currentText();
for( QValueList<ConvertPlugin*>::Iterator b = formatItem->encoders.begin(); b != formatItem->encoders.end(); ++b ) {
if( (*b)->enc.bin == encoder && (*b)->enc.strength.enabled ) {
QString strength = (*b)->enc.strength.param;
int compressionLevel = (*a).sStrength->value();
if( (*b)->enc.strength.profiles.empty() ) {
if( (*b)->enc.strength.step < 1 ) {
if( (*b)->enc.strength.range_max >= (*b)->enc.strength.range_min )
strength.replace( "%c", QString::number( compressionLevel * (*b)->enc.strength.step ) );
else
strength.replace( "%c", QString::number( (*b)->enc.strength.range_min - compressionLevel * (*b)->enc.strength.step ) );
}
else {
if( (*b)->enc.strength.range_max >= (*b)->enc.strength.range_min )
strength.replace( "%c", QString::number( (int)(compressionLevel * (*b)->enc.strength.step) ) );
else
strength.replace( "%c", QString::number( (int)((*b)->enc.strength.range_min - compressionLevel * (*b)->enc.strength.step) ) );
}
if( (*b)->enc.strength.separator != '.' ) strength.replace( QChar('.'), (*b)->enc.strength.separator );
}
else {
QStringList::Iterator it = (*b)->enc.strength.profiles.at( (int)compressionLevel );
strength.replace( "%c", *it );
}
(*a).lStrengthDisplay->setText( "( \"" + strength + "\" )" );
}
}
}
}

@ -0,0 +1,81 @@
#ifndef CONFIGBACKENDSPAGE_H
#define CONFIGBACKENDSPAGE_H
#include <configpagebase.h>
#include <qstringlist.h>
class Config;
class KComboBox;
class KScrollView;
class QGroupBox;
class QGridLayout;
class QLabel;
class QSlider;
class QCheckBox;
class QVBox;
/**
* @short The page for configuring the environment
* @author Daniel Faust <hessijames@gmail.com>
* @version 0.3
*/
class ConfigBackendsPage : public ConfigPageBase
{
Q_OBJECT
public:
/**
* Default Constructor
*/
ConfigBackendsPage( Config*, QMap<QString, QString>*, QWidget *parent=0, const char *name=0 );
/**
* Default Destructor
*/
virtual ~ConfigBackendsPage();
private:
struct FormatOptions
{
// TODO remove the string lists
QString format;
QGroupBox* group;
QGridLayout* grid;
QLabel* lEncoder;
KComboBox* cEncoder;
QLabel* lStrength;
QSlider* sStrength;
QLabel* lStrengthDisplay;
QLabel* lDecoder;
KComboBox* cDecoder;
QLabel* lReplayGain;
KComboBox* cReplayGain;
QCheckBox* cInternalReplayGain;
};
QValueList<FormatOptions> formatOptions;
QGridLayout* grid;
KScrollView* scrollView;
QVBox* box;
KComboBox* cRipper;
Config* config;
QMap<QString, QString>* binaries;
public slots:
void resetDefaults();
void saveSettings();
void rebuild();
void refill();
void encoderChanged();
void strengthChanged();
};
#endif // CONFIGBACKENDSPAGE_H

@ -0,0 +1,174 @@
#include "configdialog.h"
#include "config.h"
#include "configgeneralpage.h"
#include "configpluginspage.h"
#include "configenvironmentpage.h"
#include "configbackendspage.h"
/*#include "config_dialogue_interface.h"
#include "config_dialogue_backend_plugins.h"
#include "config_dialogue_backends.h"
#include "config_dialogue_en_decoder.h"
#include "config_dialogue_en_decoder_options.h"
#include "tools.h"
#include "backend_plugins.h"
#include "replaygain_plugins.h"
#include <qlayout.h>
*/
//#include <kconfig.h>
#include <kiconloader.h>
#include <klocale.h>
#include <kpushbutton.h>
ConfigDialog::ConfigDialog( Config* _config, QWidget *parent, const char *name, Page startPage )
: KDialogBase(
IconList,
i18n("Settings"),
Apply | Cancel | Default | Help | Ok,
Ok, // default button
parent,
name,
true, // modal
true // separator
)
{
config = _config;
//resize( 600, 400 );
binaries = config->binaries;
connect( this, SIGNAL(applyClicked()),
this,SLOT(applyClickedSlot())
);
connect( this, SIGNAL(okClicked()),
this,SLOT(okClickedSlot())
);
connect( this, SIGNAL(defaultClicked()),
this,SLOT(defaultClickedSlot())
);
generalPage = addPage( i18n("General"), "misc" );
configGeneralPage = new ConfigGeneralPage( config, generalPage, "configGeneralPage" );
connect( configGeneralPage, SIGNAL(configChanged()),
this, SLOT(configChanged())
);
connect( this, SIGNAL(saveGeneral()),
configGeneralPage, SLOT(saveSettings())
);
connect( this, SIGNAL(resetGeneral()),
configGeneralPage, SLOT(resetDefaults())
);
pluginsPage = addPage( i18n("Plugins"), "connect_creating" );
configPluginsPage = new ConfigPluginsPage( config, pluginsPage, "configPluginsPage" );
connect( configPluginsPage, SIGNAL(configChanged()),
this, SLOT(configChanged())
);
connect( this, SIGNAL(savePlugins()),
configPluginsPage, SLOT(saveSettings())
);
connect( this, SIGNAL(resetPlugins()),
configPluginsPage, SLOT(resetDefaults())
);
environmentPage = addPage( i18n("Environment"), "filefind" );
configEnvironmentPage = new ConfigEnvironmentPage( config, &binaries, environmentPage, "configEnvironmentPage" );
connect( configEnvironmentPage, SIGNAL(configChanged()),
this, SLOT(configChanged())
);
connect( this, SIGNAL(saveEnvironment()),
configEnvironmentPage, SLOT(saveSettings())
);
connect( this, SIGNAL(resetEnvironment()),
configEnvironmentPage, SLOT(resetDefaults())
);
backendsPage = addPage( i18n("Backends"), "kcmsystem" );
configBackendsPage = new ConfigBackendsPage( config, &binaries, backendsPage, "configBackendsPage" );
connect( configBackendsPage, SIGNAL(configChanged()),
this, SLOT(configChanged())
);
connect( this, SIGNAL(saveBackends()),
configBackendsPage, SLOT(saveSettings())
);
connect( this, SIGNAL(resetBackends()),
configBackendsPage, SLOT(resetDefaults())
);
connect( configEnvironmentPage, SIGNAL(rebuildBackendsPage()),
configBackendsPage, SLOT(rebuild())
);
setConfigChanged( false );
showPage( startPage );
}
ConfigDialog::~ConfigDialog()
{
}
QFrame *ConfigDialog::addPage(const QString &itemName, const QString &iconName)
{
return KDialogBase::addPage( itemName, QString::null, MainBarIcon(iconName,32) );
}
void ConfigDialog::setConfigChanged( const bool value )
{
actionButton( Apply )->setEnabled(value);
}
void ConfigDialog::configChanged()
{
setConfigChanged( true );
}
void ConfigDialog::applyClickedSlot()
{
okClickedSlot();
setConfigChanged( false );
}
void ConfigDialog::okClickedSlot()
{
emit saveGeneral();
emit savePlugins();
emit saveEnvironment();
emit saveBackends();
config->write();
}
void ConfigDialog::defaultClickedSlot()
{
int index = activePageIndex();
QStringList listDefaults;
if( index == -1 )
return;
if( index == pageIndex(generalPage) )
{
emit resetGeneral();
setConfigChanged( true );
}
else if( index == pageIndex(pluginsPage) )
{
emit resetPlugins();
setConfigChanged( true );
}
else if( index == pageIndex(environmentPage) )
{
emit resetEnvironment();
setConfigChanged( true );
}
else if( index == pageIndex(backendsPage) )
{
emit resetBackends();
setConfigChanged( true );
}
}

@ -0,0 +1,79 @@
#ifndef CONFIGDIALOG_H
#define CONFIGDIALOG_H
#include <kdialogbase.h>
#include <qmap.h>
class Config;
class ConfigGeneralPage;
class ConfigPluginsPage;
class ConfigEnvironmentPage;
class ConfigBackendsPage;
/**
* @short Config dialog
* @author Daniel Faust <hessijames@gmail.com>
* @version 0.3
*/
class ConfigDialog : public KDialogBase
{
Q_OBJECT
public:
enum Page {
GeneralPage,
PluginsPage,
EnvironmentPage,
BackendsPage
};
/**
* Constructor
*/
ConfigDialog( Config*, QWidget *parent = 0, const char *name = 0, Page startPage = GeneralPage );
/**
* Destructor
*/
virtual ~ConfigDialog();
private:
QFrame* addPage( const QString &itemName, const QString &iconName );
QFrame* generalPage;
ConfigGeneralPage* configGeneralPage;
QFrame* pluginsPage;
ConfigPluginsPage* configPluginsPage;
QFrame* environmentPage;
ConfigEnvironmentPage* configEnvironmentPage;
QFrame* backendsPage;
ConfigBackendsPage* configBackendsPage;
void setConfigChanged( const bool );
Config* config;
QMap<QString, QString> binaries;
private slots:
void configChanged();
void okClickedSlot();
void applyClickedSlot();
void defaultClickedSlot();
signals:
void saveGeneral();
void savePlugins();
void saveEnvironment();
void saveBackends();
void resetGeneral();
void resetPlugins();
void resetEnvironment();
void resetBackends();
};
#endif // CONFIGDIALOG_H

@ -0,0 +1,223 @@
#include "configenvironmentpage.h"
#include "config.h"
#include <klocale.h>
#include <kiconloader.h>
#include <kpushbutton.h>
#include <klistbox.h>
//#include <keditlistbox.h>
//#include <kurlrequester.h>
#include <kfiledialog.h>
#include <kstandarddirs.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qtooltip.h>
#include <qmap.h>
ConfigEnvironmentPage::ConfigEnvironmentPage( Config* _config, QMap<QString, QString>* _binaries, QWidget *parent, const char *name )
: ConfigPageBase( parent, name )
{
config = _config;
binaries = _binaries;
// create an icon loader object for loading icons
KIconLoader* iconLoader = new KIconLoader();
QVBoxLayout* box = new QVBoxLayout( parent, 0, 6 );
QLabel* lDirectoriesLabel = new QLabel( i18n("Directories to be scanned")+":", parent, "lDirectoriesLabel" );
box->addWidget( lDirectoriesLabel );
// KEditListBox* eDirectories = new KEditListBox( parent, "eDirectories" );
// box->addWidget( eDirectories );
QHBoxLayout* directoriesBox = new QHBoxLayout( box );
lDirectories = new KListBox( parent, "lDirectories" );
lDirectories->insertStringList( config->data.environment.directories );
directoriesBox->addWidget( lDirectories );
connect( lDirectories, SIGNAL(highlighted(int)),
this, SLOT(directoriesSelectionChanged(int))
);
QVBoxLayout* directoriesMiddleBox = new QVBoxLayout( directoriesBox );
pDirUp = new KPushButton( "", parent, "pDirUp" );
pDirUp->setPixmap( iconLoader->loadIcon("up",KIcon::Toolbar) );
pDirUp->setEnabled( false );
QToolTip::add( pDirUp, i18n("Move selected directory one position up.\nThis effects which backend will be chosen, if there are several versions.") );
directoriesMiddleBox->addWidget( pDirUp );
connect( pDirUp, SIGNAL(clicked()),
this, SLOT(dirUp())
);
directoriesMiddleBox->addStretch();
pDirDown = new KPushButton( "", parent, "pDirDown" );
pDirDown->setPixmap( iconLoader->loadIcon("down",KIcon::Toolbar) );
pDirDown->setEnabled( false );
QToolTip::add( pDirDown, i18n("Move selected directory one position down.\nThis effects which backend will be chosen, if there are several versions.") );
directoriesMiddleBox->addWidget( pDirDown );
connect( pDirDown, SIGNAL(clicked()),
this, SLOT(dirDown())
);
QVBoxLayout* directoriesRightBox = new QVBoxLayout( directoriesBox );
pAddDirectory = new KPushButton( iconLoader->loadIcon("add",KIcon::Small), i18n("Add ..."), parent, "pAddDirectory" );
directoriesRightBox->addWidget( pAddDirectory );
connect( pAddDirectory, SIGNAL(clicked()),
this, SLOT(addDirectory())
);
pRemoveDirectory = new KPushButton( iconLoader->loadIcon("remove",KIcon::Small), i18n("Remove"), parent, "pRemoveDirectory" );
directoriesRightBox->addWidget( pRemoveDirectory );
pRemoveDirectory->setEnabled( false );
connect( pRemoveDirectory, SIGNAL(clicked()),
this, SLOT(removeDirectory())
);
directoriesRightBox->addStretch();
box->addSpacing( 5 );
QHBoxLayout* programsBox = new QHBoxLayout( box );
QVBoxLayout* foundProgramsBox = new QVBoxLayout( programsBox );
QLabel* lFoundProgramsLabel = new QLabel( i18n("Programs found")+":", parent, "lFoundProgramsLabel" );
foundProgramsBox->addWidget( lFoundProgramsLabel );
lFoundPrograms = new KListBox( parent, "lFoundPrograms" );
lFoundPrograms->setSelectionMode( QListBox::NoSelection );
foundProgramsBox->addWidget( lFoundPrograms );
//connect(lPrograms,SIGNAL(highlighted(int)),this,SLOT(programsSelectionChanged(int)));
programsBox->setStretchFactor( foundProgramsBox, 3 );
QVBoxLayout* notFoundProgramsBox = new QVBoxLayout( programsBox );
QLabel* lNotFoundProgramsLabel = new QLabel( i18n("Programs not found")+":", parent, "lNotFoundProgramsLabel" );
notFoundProgramsBox->addWidget( lNotFoundProgramsLabel );
lNotFoundPrograms = new KListBox( parent, "lNotFoundPrograms" );
lNotFoundPrograms->setSelectionMode( QListBox::NoSelection );
notFoundProgramsBox->addWidget( lNotFoundPrograms );
//connect(lPrograms,SIGNAL(highlighted(int)),this,SLOT(programsSelectionChanged(int)));
programsBox->setStretchFactor( notFoundProgramsBox, 2 );
for( QMap<QString, QString>::Iterator it = config->binaries.begin(); it != config->binaries.end(); ++it ) {
if( it.data() != "" ) {
lFoundPrograms->insertItem( it.data() );
}
else {
lNotFoundPrograms->insertItem( it.key() );
}
}
// box->addStretch();
// delete the icon loader object
delete iconLoader;
}
ConfigEnvironmentPage::~ConfigEnvironmentPage()
{}
void ConfigEnvironmentPage::resetDefaults()
{
lDirectories->clear();
QString datadir = locateLocal( "data", "soundkonverter/bin/" );
datadir.remove( datadir.length() - 1, 1 );
lDirectories->insertItem( datadir );
lDirectories->insertItem( QDir::homeDirPath() + "/bin" );
lDirectories->insertItem( "/usr/local/bin" );
lDirectories->insertItem( "/usr/bin" );
refill();
cfgChanged();
}
void ConfigEnvironmentPage::saveSettings()
{
config->data.environment.directories.clear();
for( uint i = 0; i < lDirectories->count(); i++ ) {
config->data.environment.directories.append( lDirectories->text(i) );
}
config->binaries = *binaries;
}
void ConfigEnvironmentPage::directoriesSelectionChanged( int index )
{
pRemoveDirectory->setEnabled( true );
if( index != 0 ) pDirUp->setEnabled( true );
else pDirUp->setEnabled( false );
if( index != lDirectories->count() - 1 ) pDirDown->setEnabled( true );
else pDirDown->setEnabled( false );
}
void ConfigEnvironmentPage::dirUp()
{
int index = lDirectories->currentItem();
if( index > 0 ) {
QString text = lDirectories->currentText();
lDirectories->removeItem( index );
lDirectories->insertItem( text, index - 1 );
lDirectories->setSelected( index - 1, true );
refill();
cfgChanged();
}
}
void ConfigEnvironmentPage::dirDown()
{
int index = lDirectories->currentItem();
if( (uint)index < lDirectories->count() - 1 ) {
QString text = lDirectories->currentText();
lDirectories->removeItem( index );
lDirectories->insertItem( text, index + 1 );
lDirectories->setSelected( index + 1, true );
refill();
cfgChanged();
}
}
void ConfigEnvironmentPage::addDirectory()
{
QString dirname = KFileDialog::getExistingDirectory( "/", 0 );
if( dirname != NULL ) {
lDirectories->insertItem( dirname );
refill();
cfgChanged();
}
}
void ConfigEnvironmentPage::removeDirectory()
{
lDirectories->removeItem( lDirectories->currentItem() );
refill();
cfgChanged();
}
void ConfigEnvironmentPage::refill()
{
for( QMap<QString, QString>::Iterator it = binaries->begin(); it != binaries->end(); ++it ) {
it.data() = "";
for( uint i = 0; i < lDirectories->count(); i++ ) {
if( it.data() == "" && QFile::exists(lDirectories->text(i) + "/" + it.key()) ) {
it.data() = lDirectories->text(i) + "/" + it.key();
}
}
}
lFoundPrograms->clear();
lNotFoundPrograms->clear();
for( QMap<QString, QString>::Iterator it = binaries->begin(); it != binaries->end(); ++it ) {
if( it.data() != "" ) {
lFoundPrograms->insertItem( it.data() );
}
else {
lNotFoundPrograms->insertItem( it.key() );
}
}
emit rebuildBackendsPage();
}

@ -0,0 +1,62 @@
#ifndef CONFIGENVIRONMENTPAGE_H
#define CONFIGENVIRONMENTPAGE_H
#include <configpagebase.h>
class Config;
class KPushButton;
class KListBox;
/**
* @short The page for configuring the environment
* @author Daniel Faust <hessijames@gmail.com>
* @version 0.3
*/
class ConfigEnvironmentPage : public ConfigPageBase
{
Q_OBJECT
public:
/**
* Default Constructor
*/
ConfigEnvironmentPage( Config*, QMap<QString, QString>*, QWidget *parent=0, const char *name=0 );
/**
* Default Destructor
*/
virtual ~ConfigEnvironmentPage();
private:
KListBox* lDirectories;
KPushButton* pDirUp;
KPushButton* pDirDown;
KPushButton* pAddDirectory;
KPushButton* pRemoveDirectory;
KListBox* lFoundPrograms;
KListBox* lNotFoundPrograms;
Config* config;
QMap<QString, QString>* binaries;
public slots:
void resetDefaults();
void saveSettings();
private slots:
void directoriesSelectionChanged( int );
void dirUp();
void dirDown();
void addDirectory();
void removeDirectory();
void refill();
signals:
void rebuildBackendsPage();
};
#endif // CONFIGENVIRONMENTPAGE_H

@ -0,0 +1,323 @@
#include "configgeneralpage.h"
#include "config.h"
#include <klocale.h>
#include <kcombobox.h>
#include <knuminput.h>
#include <kiconloader.h>
#include <klineedit.h>
#include <kpushbutton.h>
#include <kfiledialog.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qcheckbox.h>
#include <qtooltip.h>
#include <qdir.h>
#include <qregexp.h>
// ### soundkonverter 0.4: add an option to use vfat save names when the output device is vfat
ConfigGeneralPage::ConfigGeneralPage( Config* _config, QWidget *parent, const char *name )
: ConfigPageBase( parent, name )
{
config = _config;
// create an icon loader object for loading icons
KIconLoader* iconLoader = new KIconLoader();
QVBoxLayout* box = new QVBoxLayout( parent, 0, 6 );
QHBoxLayout* startTabBox = new QHBoxLayout( box, 6 );
QLabel* lStartTab = new QLabel( i18n("Start in Mode")+":", parent, "lStartTab" );
startTabBox->addWidget( lStartTab );
cStartTab = new KComboBox( parent, "cStartTab" );
cStartTab->insertItem( i18n("Last used") );
cStartTab->insertItem( i18n("Simple") );
cStartTab->insertItem( i18n("Detailed") );
cStartTab->setCurrentItem( config->data.general.startTab );
startTabBox->addWidget( cStartTab );
connect( cStartTab, SIGNAL(activated(int)),
this, SLOT(cfgChanged())
);
box->addSpacing( 5 );
QHBoxLayout* defaultProfileBox = new QHBoxLayout( box, 6 );
QLabel* lDefaultProfile = new QLabel( i18n("Default profile")+":", parent, "lDefaultProfile" );
defaultProfileBox->addWidget( lDefaultProfile );
cDefaultProfile = new KComboBox( parent, "cDefaultProfile" );
sDefaultProfile += i18n("Very low");
sDefaultProfile += i18n("Low");
sDefaultProfile += i18n("Medium");
sDefaultProfile += i18n("High");
sDefaultProfile += i18n("Very high");
sDefaultProfile += i18n("Lossless");
sDefaultProfile += i18n("Hybrid");
sDefaultProfile += config->getAllProfiles();
sDefaultProfile.remove( i18n("Last used") );
sDefaultProfile.remove( "Last used" );
sDefaultProfile.prepend( i18n("Last used") );
cDefaultProfile->insertStringList( sDefaultProfile );
cDefaultProfile->setCurrentItem( profileIndex(config->data.general.defaultProfile) );
defaultProfileBox->addWidget( cDefaultProfile );
connect( cDefaultProfile, SIGNAL(activated(int)),
this, SLOT(profileChanged())
);
connect( cDefaultProfile, SIGNAL(activated(int)),
this, SLOT(cfgChanged())
);
QLabel* lDefaultFormat = new QLabel( i18n("Default format")+":", parent, "lDefaultFormat" );
defaultProfileBox->addWidget( lDefaultFormat );
cDefaultFormat = new KComboBox( parent, "cDefaultFormat" );
defaultProfileBox->addWidget( cDefaultFormat );
connect( cDefaultFormat, SIGNAL(activated(int)),
this, SLOT(cfgChanged())
);
profileChanged();
box->addSpacing( 5 );
/* QHBoxLayout* defaultDirBox = new QHBoxLayout( box, 6 );
QLabel* lDefaultDir = new QLabel( i18n("Default output directory")+":", parent, "lDefaultDir" );
defaultDirBox->addWidget( lDefaultDir );
lDir = new KLineEdit( parent, "lDir" );
lDir->setText( config->data.general.defaultOutputDirectory );
QToolTip::add( lDir, i18n("<p>The following strings are space holders, that will be replaced by the information in the meta data:</p><p>%a - Artist<br>%b - Album<br>%c - Comment<br>%d - Disc number<br>%g - Genre<br>%n - Track number<br>%p - Composer<br>%t - Title<br>%y - Year<br>%f - Original file name<p>") );
defaultDirBox->addWidget( lDir );
connect( lDir, SIGNAL(textChanged(const QString&)),
this, SLOT(cfgChanged())
);*/
/*pDirInfo = new KPushButton( iconLoader->loadIcon("messagebox_info",KIcon::Small), "", parent, "pDirInfo" );
QToolTip::add( pDirInfo, i18n("Information about the wildcards.") );
defaultDirBox->addWidget( pDirInfo );
connect( pDirInfo, SIGNAL(clicked()),
this, SLOT(dirInfo())
);*/
// pDirSelect = new KPushButton( iconLoader->loadIcon("folder",KIcon::Small), "", parent, "pDirSelect" );
// QToolTip::add( pDirSelect, i18n("Choose an output directory") );
// defaultDirBox->addWidget( pDirSelect );
// connect( pDirSelect, SIGNAL(clicked()),
// this, SLOT(selectDir())
// );
QHBoxLayout* priorityBox = new QHBoxLayout( box, 6 );
QLabel* lPriority = new QLabel( i18n("Process priority of the backends")+":", parent, "lPriority" );
priorityBox->addWidget( lPriority );
cPriority = new KComboBox( parent, "cPriority" );
sPriority += i18n("Normal");
sPriority += i18n("Low");
cPriority->insertStringList( sPriority );
cPriority->setCurrentItem( config->data.general.priority / 10 ); // NOTE that just works for 'normal' and 'low'
priorityBox->addWidget( cPriority );
connect( cPriority, SIGNAL(activated(int)),
this, SLOT(cfgChanged())
);
box->addSpacing( 5 );
QHBoxLayout* useVFATNamesBox = new QHBoxLayout( box, 6 );
cUseVFATNames = new QCheckBox( i18n("Use FAT compatible output file names"), parent, "cUseVFATNames" );
QToolTip::add( cUseVFATNames, i18n("Replaces some special characters like \'?\' by \'_\'.") );
cUseVFATNames->setChecked( config->data.general.useVFATNames );
useVFATNamesBox->addWidget( cUseVFATNames );
connect( cUseVFATNames, SIGNAL(toggled(bool)),
this, SLOT(cfgChanged())
);
box->addSpacing( 5 );
QHBoxLayout* conflictHandlingBox = new QHBoxLayout( box, 6 );
QLabel* lConflictHandling = new QLabel( i18n("Conflict handling")+":", parent, "lConflictHandling" );
conflictHandlingBox->addWidget( lConflictHandling );
cConflictHandling = new KComboBox( parent, "cConflictHandling" );
QToolTip::add( cConflictHandling, i18n("Do that if the output file already exists") );
sConflictHandling += i18n("Generate new file name");
sConflictHandling += i18n("Skip file");
cConflictHandling->insertStringList( sConflictHandling );
cConflictHandling->setCurrentItem( config->data.general.conflictHandling );
conflictHandlingBox->addWidget( cConflictHandling );
connect( cConflictHandling, SIGNAL(activated(int)),
this, SLOT(cfgChanged())
);
box->addSpacing( 5 );
QHBoxLayout* numFilesBox = new QHBoxLayout( box, 6 );
QLabel* lNumFiles = new QLabel( i18n("Number of files to convert at once")+":", parent, "lNumFiles" );
numFilesBox->addWidget( lNumFiles );
iNumFiles = new KIntSpinBox( 1, 100, 1, config->data.general.numFiles, 10, parent, "iNumFiles" );
numFilesBox->addWidget( iNumFiles );
connect( iNumFiles, SIGNAL(valueChanged(int)),
this, SLOT(cfgChanged())
);
box->addSpacing( 5 );
QHBoxLayout* updateDelayBox = new QHBoxLayout( box, 6 );
QLabel* lUpdateDelay = new QLabel( i18n("Status update delay (time in msec.)")+":", parent, "lUpdateDelay" );
updateDelayBox->addWidget( lUpdateDelay );
iUpdateDelay = new KIntSpinBox( 100, 5000, 100, config->data.general.updateDelay, 10, parent, "iUpdateDelay" );
QToolTip::add( iUpdateDelay, i18n("Update the progress bar in this interval (time in milliseconds)") );
updateDelayBox->addWidget( iUpdateDelay );
connect( iUpdateDelay, SIGNAL(valueChanged(int)),
this, SLOT(cfgChanged())
);
box->addSpacing( 5 );
QHBoxLayout* askForNewOptionsBox = new QHBoxLayout( box, 6 );
cAskForNewOptions = new QCheckBox( i18n("Ask for new options, when adding files from external program"), parent, "cAskForNewOptions" );
QToolTip::add( cAskForNewOptions, i18n("If you open a file with soundKonverter and soundKonverter is already running,\nyou can either be asked to define new converting options\nor the current settings from the soundKonverter main window are used.") );
cAskForNewOptions->setChecked( config->data.general.askForNewOptions );
askForNewOptionsBox->addWidget( cAskForNewOptions );
connect( cAskForNewOptions, SIGNAL(toggled(bool)),
this, SLOT(cfgChanged())
);
box->addSpacing( 5 );
QHBoxLayout* executeUserScriptBox = new QHBoxLayout( box, 6 );
cExecuteUserScript = new QCheckBox( i18n("Execute user script (for advanced users)"), parent, "cAskForNewOptions" );
QToolTip::add( cExecuteUserScript, i18n("Executes a script after every finished conversion. Have a look at $KDEDIR/soundkonverter/userscript.sh") );
cExecuteUserScript->setChecked( config->data.general.executeUserScript );
executeUserScriptBox->addWidget( cExecuteUserScript );
connect( cExecuteUserScript, SIGNAL(toggled(bool)),
this, SLOT(cfgChanged())
);
box->addStretch();
// delete the icon loader object
delete iconLoader;
}
ConfigGeneralPage::~ConfigGeneralPage()
{}
void ConfigGeneralPage::resetDefaults()
{
cStartTab->setCurrentItem( 0 );
cDefaultProfile->setCurrentItem( 0 );
cDefaultFormat->setCurrentItem( 0 );
// lDir->setText( QDir::homeDirPath() + "/soundKonverter/%b/%d - %n - %a - %t" );
cPriority->setCurrentItem( 1 );
cUseVFATNames->setChecked( true );
cConflictHandling->setCurrentItem( 0 );
iNumFiles->setValue( 3 );
iUpdateDelay->setValue( 500 );
cAskForNewOptions->setChecked( true );
cExecuteUserScript->setChecked( false );
cfgChanged();
}
void ConfigGeneralPage::saveSettings()
{
config->data.general.startTab = cStartTab->currentItem();
config->data.general.defaultProfile = cDefaultProfile->currentText();
config->data.general.defaultFormat = cDefaultFormat->currentText();
// config->data.general.defaultOutputDirectory = lDir->text();
config->data.general.priority = cPriority->currentItem() * 10; // NOTE that just works for 'normal' and 'low'
config->data.general.useVFATNames = cUseVFATNames->isChecked();
config->data.general.conflictHandling = cConflictHandling->currentItem();
config->data.general.numFiles = iNumFiles->value();
config->data.general.updateDelay = iUpdateDelay->value();
config->data.general.askForNewOptions = cAskForNewOptions->isChecked();
config->data.general.executeUserScript = cExecuteUserScript->isChecked();
}
int ConfigGeneralPage::profileIndex( const QString &string )
{
return sDefaultProfile.findIndex( string );
}
int ConfigGeneralPage::formatIndex( const QString &string )
{
return sDefaultFormat.findIndex( string );
}
// void ConfigGeneralPage::selectDir()
// {
// QString startDir = lDir->text();
// int i = startDir.find( QRegExp("%[aAbBcCdDgGnNpPtTyY]{1,1}") );
// if( i != -1 ) {
// i = startDir.findRev( "/", i );
// startDir = startDir.left( i );
// }
//
// QString directory = KFileDialog::getExistingDirectory( startDir, 0, i18n("Choose an output directory") );
// if( !directory.isEmpty() ) {
// QString dir = lDir->text();
// i = dir.find( QRegExp("%[aAbBcCdDgGnNpPtTyY]{1,1}") );
// if( i != -1 ) {
// i = dir.findRev( "/", i );
// lDir->setText( directory + dir.mid(i) );
// }
// else {
// lDir->setText( directory );
// }
// }
// }
void ConfigGeneralPage::profileChanged()
{
QString last;
if( cDefaultProfile->currentText() == i18n("Last used") ) {
last = cDefaultFormat->currentText();
if( last.isEmpty() ) last = config->data.general.defaultFormat;
cDefaultFormat->clear();
sDefaultFormat = i18n("Last used");
cDefaultFormat->insertStringList( sDefaultFormat );
cDefaultFormat->setCurrentItem( formatIndex(last) );
return;
}
ConversionOptions options = config->getProfile( cDefaultProfile->currentText() );
if( !options.encodingOptions.sFormat.isEmpty() ) {
last = cDefaultFormat->currentText();
cDefaultFormat->clear();
sDefaultFormat = options.encodingOptions.sFormat;
cDefaultFormat->insertStringList( sDefaultFormat );
cDefaultFormat->setCurrentItem( formatIndex(last) );
return;
}
if( cDefaultProfile->currentText() == i18n("Very low") ||
cDefaultProfile->currentText() == i18n("Low") ||
cDefaultProfile->currentText() == i18n("Medium") ||
cDefaultProfile->currentText() == i18n("High") ||
cDefaultProfile->currentText() == i18n("Very high") ) {
last = cDefaultFormat->currentText();
if( last.isEmpty() ) last = config->data.general.defaultFormat;
cDefaultFormat->clear();
sDefaultFormat = i18n("Last used");
sDefaultFormat += config->allLossyEncodableFormats();
cDefaultFormat->insertStringList( sDefaultFormat );
cDefaultFormat->setCurrentItem( formatIndex(last) );
}
else if( cDefaultProfile->currentText() == i18n("Lossless") ) {
last = cDefaultFormat->currentText();
if( last.isEmpty() ) last = config->data.general.defaultFormat;
cDefaultFormat->clear();
sDefaultFormat = i18n("Last used");
sDefaultFormat += config->allLosslessEncodableFormats();
sDefaultFormat += "wav";
cDefaultFormat->insertStringList( sDefaultFormat );
cDefaultFormat->setCurrentItem( formatIndex(last) );
}
else if( cDefaultProfile->currentText() == i18n("Hybrid") ) {
last = cDefaultFormat->currentText();
if( last.isEmpty() ) last = config->data.general.defaultFormat;
cDefaultFormat->clear();
sDefaultFormat = i18n("Last used");
sDefaultFormat += config->allHybridEncodableFormats();
cDefaultFormat->insertStringList( sDefaultFormat );
cDefaultFormat->setCurrentItem( formatIndex(last) );
}
}

@ -0,0 +1,69 @@
#ifndef CONFIGGENERALPAGE_H
#define CONFIGGENERALPAGE_H
#include <configpagebase.h>
class Config;
class QCheckBox;
class KComboBox;
class KIntSpinBox;
class KLineEdit;
class KPushButton;
/**
* @short The page for the general configuration
* @author Daniel Faust <hessijames@gmail.com>
* @version 0.3
*/
class ConfigGeneralPage : public ConfigPageBase
{
Q_OBJECT
public:
/**
* Default Constructor
*/
ConfigGeneralPage( Config*, QWidget *parent=0, const char *name=0 );
/**
* Default Destructor
*/
virtual ~ConfigGeneralPage();
private:
KComboBox* cStartTab;
KComboBox* cDefaultProfile;
QStringList sDefaultProfile;
KComboBox* cDefaultFormat;
QStringList sDefaultFormat;
// KLineEdit* lDir;
//KPushButton* pDirInfo;
// KPushButton* pDirSelect;
KComboBox* cPriority;
QStringList sPriority;
QCheckBox* cUseVFATNames;
QStringList sConflictHandling;
KComboBox* cConflictHandling;
KIntSpinBox* iNumFiles;
KIntSpinBox* iUpdateDelay;
QCheckBox* cAskForNewOptions;
QCheckBox* cExecuteUserScript;
Config* config;
int profileIndex( const QString& string );
int formatIndex( const QString& string );
public slots:
void resetDefaults();
void saveSettings();
private slots:
// void selectDir();
void profileChanged();
};
#endif // CONFIGGENERALPAGE_H

@ -0,0 +1,20 @@
#include "configpagebase.h"
ConfigPageBase::ConfigPageBase( QWidget *parent, const char *name )
: QWidget( parent, name )
{}
ConfigPageBase::~ConfigPageBase()
{}
void ConfigPageBase::resetDefaults()
{}
void ConfigPageBase::saveSettings()
{}
void ConfigPageBase::cfgChanged()
{
emit configChanged();
}

@ -0,0 +1,38 @@
#ifndef CONFIGPAGEBASE_H
#define CONFIGPAGEBASE_H
#include <qwidget.h>
/**
* @short The base for all pages of the config dialog
* @author Daniel Faust <hessijames@gmail.com>
* @version 0.3
*/
class ConfigPageBase : public QWidget
{
Q_OBJECT
public:
/**
* Constructor
*/
ConfigPageBase( QWidget *parent=0, const char *name=0 );
/**
* Destructor
*/
virtual ~ConfigPageBase();
public slots:
virtual void resetDefaults();
virtual void saveSettings();
void cfgChanged();
signals:
void configChanged();
};
#endif // CONFIGPAGEBASE_H

@ -0,0 +1,639 @@
#include "configpluginspage.h"
#include "config.h"
#include "convertpluginloader.h"
#include "replaygainpluginloader.h"
#include "ripperpluginloader.h"
#include <qlabel.h>
#include <qlayout.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qcheckbox.h>
// #include <qevent.h>
// #include <qdragobject.h>
#include <qtooltip.h>
#include <qlocale.h>
// #include <qurl.h>
#include <klocale.h>
#include <kpushbutton.h>
#include <kio/job.h>
#include <kstandarddirs.h>
#include <kmessagebox.h>
#include <kiconloader.h>
#include <kfiledialog.h>
#include <klistbox.h>
//#include <kurl.h>
ConfigPluginsPage::ConfigPluginsPage( Config* _config, QWidget* parent, const char* name )
: ConfigPageBase( parent, name )
{
config = _config;
// create an icon loader object for loading icons
KIconLoader* iconLoader = new KIconLoader();
QVBoxLayout* box = new QVBoxLayout( parent, 0, 6 );
QLabel* lPluginsLabel = new QLabel( i18n("Installed plugins")+":", parent, "lPluginsLabel" );
box->addWidget( lPluginsLabel );
QHBoxLayout* pluginsBox = new QHBoxLayout( box );
lPlugins = new KListBox( parent, "lPlugins" );
pluginsBox->addWidget(lPlugins);
connect( lPlugins, SIGNAL(highlighted(int)),
this, SLOT(pluginsSelectionChanged(int))
);
refreshPlugins();
QVBoxLayout* pluginsRightBox = new QVBoxLayout( pluginsBox );
pAddPlugin = new KPushButton( iconLoader->loadIcon("add",KIcon::Small), i18n("Add ..."), parent, "pAddPlugin" );
pluginsRightBox->addWidget( pAddPlugin );
connect( pAddPlugin, SIGNAL(clicked()),
this, SLOT(getPlugin())
);
pRemovePlugin = new KPushButton( iconLoader->loadIcon("remove",KIcon::Small), i18n("Remove"), parent, "pRemovePlugin" );
pRemovePlugin->setEnabled( false );
pluginsRightBox->addWidget( pRemovePlugin );
connect( pRemovePlugin, SIGNAL(clicked()),
this, SLOT(removePlugin())
);
pluginsRightBox->addStretch();
pAboutPlugin = new KPushButton( iconLoader->loadIcon("messagebox_info",KIcon::Small), i18n("About"), parent, "pAboutPlugin" );
pAboutPlugin->setEnabled( false );
pluginsRightBox->addWidget( pAboutPlugin );
connect( pAboutPlugin, SIGNAL(clicked()),
this, SLOT(aboutPlugin())
);
/* NOTE kaligames.de is down
box->addSpacing( 5 );
QLabel* lOnlinePluginsLabel = new QLabel( i18n("Available plugins")+":", parent, "lOnlinePluginsLabel" );
box->addWidget( lOnlinePluginsLabel );
QHBoxLayout* onlinePluginsBox = new QHBoxLayout( box );
lOnlinePlugins = new KListBox( parent, "lOnlinePlugins" );
onlinePluginsBox->addWidget( lOnlinePlugins );
connect( lOnlinePlugins, SIGNAL(highlighted(int)),
this, SLOT(onlinePluginsSelectionChanged(int))
);
QVBoxLayout* onlinePluginsRightBox = new QVBoxLayout( onlinePluginsBox );
pRefreshOnlinePlugins = new KPushButton( iconLoader->loadIcon("reload",KIcon::Small), i18n("Refresh"), parent, "pRefreshOnlinePlugins" );
QToolTip::add( pRefreshOnlinePlugins, i18n("Download the latest list of available plugins.") );
onlinePluginsRightBox->addWidget( pRefreshOnlinePlugins );
connect( pRefreshOnlinePlugins, SIGNAL(clicked()),
this, SLOT(refreshOnlinePlugins())
);
// TODO upgrade button
// pUpgradeOnlinePlugins = new KPushButton( iconLoader->loadIcon("filesave",KIcon::Small), i18n("Upgrade"), parent, "pUpgradeOnlinePlugins" );
// pUpgradeOnlinePlugins->setEnabled( false );
// QToolTip::add( pUpgradeOnlinePlugins, i18n("Download all plugins and install them into the soundKonverter directory.") );
// onlinePluginsRightBox->addWidget( pUpgradeOnlinePlugins );
// connect(pInstallAllOnlinePlugins,SIGNAL(clicked()),this,SLOT(upgradeOnlinePlugins()));
onlinePluginsRightBox->addStretch();
pInstallOnlinePlugin = new KPushButton( iconLoader->loadIcon("filesave",KIcon::Small), i18n("Install"), parent, "pInstallOnlinePlugin" );
pInstallOnlinePlugin->setEnabled( false );
QToolTip::add( pInstallOnlinePlugin, i18n("Download the selected plugin and install it into the soundKonverter directory.") );
onlinePluginsRightBox->addWidget( pInstallOnlinePlugin );
connect( pInstallOnlinePlugin, SIGNAL(clicked()),
this, SLOT(getOnlinePlugin())
);
pAboutOnlinePlugin = new KPushButton( iconLoader->loadIcon("messagebox_info",KIcon::Small), i18n("About"), parent, "pAboutOnlinePlugin" );
pAboutOnlinePlugin->setEnabled( false );
onlinePluginsRightBox->addWidget( pAboutOnlinePlugin );
connect( pAboutOnlinePlugin, SIGNAL(clicked()),
this, SLOT(aboutOnlinePlugin())
);
cCheckOnlinePlugins = new QCheckBox( i18n("Check for new plugins on every startup"), parent, "cCheckOnlinePlugins" );
cCheckOnlinePlugins->setChecked( config->data.plugins.checkForUpdates );
box->addWidget( cCheckOnlinePlugins );
connect( cCheckOnlinePlugins, SIGNAL(toggled(bool)),
this, SLOT(cfgChanged())
);
// box->addStretch();
// delete the icon loader object
delete iconLoader;
if( config->data.plugins.checkForUpdates && config->onlinePluginsChanged ) {
// NOTE copied from below
QString line;
bool add;
QFile file( locateLocal("data","soundkonverter/pluginlist.txt") );
if( file.open(IO_ReadOnly) ) {
QTextStream stream( &file );
while( !stream.atEnd() ) {
line = stream.readLine(); // line of text excluding '\n'
line.replace( "&amp;", "&" );
line.replace( "&auml;", "ä" );
line.replace( "&Auml;", "Ä" );
line.replace( "&ouml;", "ö" );
line.replace( "&Ouml;", "Ö" );
line.replace( "&uuml;", "ü" );
line.replace( "&Uuml;", "Ü" );
line.replace( "&szlig;", "ß" );
add = true;
for( uint i=0; i<lPlugins->count(); i++ ) {
if( lPlugins->text(i) == line ) {
add = false;
break;
}
}
if( add ) lOnlinePlugins->insertItem( line );
}
file.close();
}
}
*/
}
ConfigPluginsPage::~ConfigPluginsPage()
{}
void ConfigPluginsPage::resetDefaults()
{
// cCheckOnlinePlugins->setChecked( false );
// cfgChanged();
}
void ConfigPluginsPage::saveSettings()
{
// config->data.plugins.checkForUpdates = cCheckOnlinePlugins->isChecked();
}
void ConfigPluginsPage::pluginsSelectionChanged( int index )
{
QString name = lPlugins->text( index );
QValueList<ConvertPlugin*> converters = config->allConverters();
for( QValueList<ConvertPlugin*>::Iterator it = converters.begin(); it != converters.end(); ++it ) {
if( name == (*it)->info.name + " v. " + QString::number((*it)->info.version) ) {
QFileInfo file( (*it)->filePathName );
if( file.isWritable() ) pRemovePlugin->setEnabled( true );
else pRemovePlugin->setEnabled( false );
break;
}
}
QValueList<ReplayGainPlugin*> replaygains = config->allReplayGains();
for( QValueList<ReplayGainPlugin*>::Iterator it = replaygains.begin(); it != replaygains.end(); ++it ) {
if( name == (*it)->info.name + " v. " + QString::number((*it)->info.version) ) {
QFileInfo file( (*it)->filePathName );
if( file.isWritable() ) pRemovePlugin->setEnabled( true );
else pRemovePlugin->setEnabled( false );
break;
}
}
QValueList<RipperPlugin*> rippers = config->allRippers();
for( QValueList<RipperPlugin*>::Iterator it = rippers.begin(); it != rippers.end(); ++it ) {
if( name == (*it)->info.name + " v. " + QString::number((*it)->info.version) ) {
QFileInfo file( (*it)->filePathName );
if( file.isWritable() ) pRemovePlugin->setEnabled( true );
else pRemovePlugin->setEnabled( false );
break;
}
}
pAboutPlugin->setEnabled( true );
}
void ConfigPluginsPage::refreshPlugins()
{
lPlugins->clear();
QValueList<ConvertPlugin*> converters = config->allConverters();
for( QValueList<ConvertPlugin*>::Iterator it = converters.begin(); it != converters.end(); ++it ) {
lPlugins->insertItem( (*it)->info.name + " v. " + QString::number((*it)->info.version) );
//lPlugins->insertItem( i18n("%1, Version: %2").arg((*it)->info.name).arg((*it)->info.version) );
}
QValueList<ReplayGainPlugin*> replaygains = config->allReplayGains();
for( QValueList<ReplayGainPlugin*>::Iterator it = replaygains.begin(); it != replaygains.end(); ++it ) {
lPlugins->insertItem( (*it)->info.name + " v. " + QString::number((*it)->info.version) );
//lPlugins->insertItem( i18n("%1, Version: %2").arg((*it)->info.name).arg((*it)->info.version) );
}
QValueList<RipperPlugin*> rippers = config->allRippers();
for( QValueList<RipperPlugin*>::Iterator it = rippers.begin(); it != rippers.end(); ++it ) {
lPlugins->insertItem( (*it)->info.name + " v. " + QString::number((*it)->info.version) );
//lPlugins->insertItem( i18n("%1, Version: %2").arg((*it)->info.name).arg((*it)->info.version) );
}
}
void ConfigPluginsPage::getPlugin()
{
QString url = KFileDialog::getOpenFileName( QDir::homeDirPath(), i18n("*.soundkonverter.xml|Plugins (*.soundkonverter.xml)"), this, i18n("Choose a plugin to add!") );
if( !url.isEmpty() ) {
QString filePathName = KURL::decode_string( url );
QString fileName = filePathName.right( filePathName.length() - filePathName.findRev("/") );
getPluginFilePathName = locateLocal("data","soundkonverter/plugins/") + fileName;
getPluginJob = KIO::file_copy( url, getPluginFilePathName, -1, true, false, false );
connect( getPluginJob, SIGNAL(result(KIO::Job*)),
this, SLOT(getPluginFinished(KIO::Job*))
);
}
}
void ConfigPluginsPage::getPluginFinished( KIO::Job* job )
{
if( job->error() == 0 ) {
ConvertPluginLoader* convertPluginLoader = new ConvertPluginLoader();
ReplayGainPluginLoader* replaygainPluginLoader = new ReplayGainPluginLoader();
RipperPluginLoader* ripperPluginLoader = new RipperPluginLoader();
if( convertPluginLoader->verifyFile(getPluginFilePathName) == -1 &&
replaygainPluginLoader->verifyFile(getPluginFilePathName) == -1 &&
ripperPluginLoader->verifyFile(getPluginFilePathName) == -1 )
{
KIO::del( getPluginFilePathName, false, false );
KMessageBox::error( this,
i18n("The plugin could not be installed. Please ensure that you have selected a valid soundKonverter plugin file."),
i18n("Error while installing plugin") );
}
else
{
// TODO reload plugins without restart
// ConvertPlugin* plugin = convertPluginLoader->loadFile( getPluginFilePathName );
// if( plugin->info.version != -1 ) {
// lPlugins->insertItem( plugin->info.name + " v. " + QString::number(plugin->info.version) + " (" + i18n("restart necessary") + ")" );
// }
// else {
// delete plugin;
// ConvertPlugin* plugin = convertPluginLoader->loadFile( getPluginFilePathName );
// if( plugin->info.version != -1 ) {
// lPlugins->insertItem( plugin->info.name + " v. " + QString::number(plugin->info.version) + " (" + i18n("restart necessary") + ")" );
// }
// else {
// delete plugin;
// ConvertPlugin* plugin = convertPluginLoader->loadFile( getPluginFilePathName );
// if( plugin->info.version != -1 ) {
// lPlugins->insertItem( plugin->info.name + " v. " + QString::number(plugin->info.version) + " (" + i18n("restart necessary") + ")" );
// }
// }
// }
// delete plugin;
KMessageBox::information( this,
i18n("The plugin was installed successfully. Please restart soundKonverter in order to activate it."),
i18n("Plugin successfully installed") );
//config->reloadPlugins();
//refreshPlugins();
//emit rescanForBackends();
//emit reloadEnDecoderPage();
}
delete convertPluginLoader;
delete replaygainPluginLoader;
delete ripperPluginLoader;
}
else {
KMessageBox::error( this,
i18n("The plugin could not be installed. Please ensure that you have write permission on your whole user directory."),
i18n("Error while installing plugin") );
}
}
void ConfigPluginsPage::removePlugin()
{
// TODO reload plugins without restart
QString name = lPlugins->currentText();
QValueList<ConvertPlugin*> converters = config->allConverters();
for( QValueList<ConvertPlugin*>::Iterator it = converters.begin(); it != converters.end(); ++it ) {
if( name == (*it)->info.name + " v. " + QString::number((*it)->info.version) ) {
QFile file( (*it)->filePathName );
if( file.remove() ) {
lPlugins->removeItem( lPlugins->currentItem() );
KMessageBox::information( this,
i18n("The plugin was removed successfully. Please restart soundKonverter in order to deactivate it."),
i18n("Plugin successfully removed") );
}
else {
KMessageBox::error( this,
i18n("The plugin could not be removed. Please ensure that you have write permission on your whole user directory."),
i18n("Error while removing plugin") );
}
break;
}
}
QValueList<ReplayGainPlugin*> replaygains = config->allReplayGains();
for( QValueList<ReplayGainPlugin*>::Iterator it = replaygains.begin(); it != replaygains.end(); ++it ) {
if( name == (*it)->info.name + " v. " + QString::number((*it)->info.version) ) {
QFile file( (*it)->filePathName );
if( file.remove() ) {
lPlugins->removeItem( lPlugins->currentItem() );
KMessageBox::information( this,
i18n("The plugin was removed successfully. Please restart soundKonverter in order to deactivate it."),
i18n("Plugin successfully removed") );
}
else {
KMessageBox::error( this,
i18n("The plugin could not be removed. Please ensure that you have write permission on your whole user directory."),
i18n("Error while removing plugin") );
}
break;
}
}
QValueList<RipperPlugin*> rippers = config->allRippers();
for( QValueList<RipperPlugin*>::Iterator it = rippers.begin(); it != rippers.end(); ++it ) {
if( name == (*it)->info.name + " v. " + QString::number((*it)->info.version) ) {
QFile file( (*it)->filePathName );
if( file.remove() ) {
lPlugins->removeItem( lPlugins->currentItem() );
KMessageBox::information( this,
i18n("The plugin was removed successfully. Please restart soundKonverter in order to deactivate it."),
i18n("Plugin successfully removed") );
}
else {
KMessageBox::error( this,
i18n("The plugin could not be removed. Please ensure that you have write permission on your whole user directory."),
i18n("Error while removing plugin") );
}
break;
}
}
/* backendPlugins.remove(lPlugins->currentText());
replayGainPlugins.remove(lPlugins->currentText());
backendPlugins.reload();
replayGainPlugins.reload();
lPlugins->clear();
lPlugins->insertStringList(backendPlugins.loadedPlugins());
lPlugins->insertStringList(replayGainPlugins.loadedPlugins());
emit rescanForBackends();
emit reloadEnDecoderPage();*/
}
void ConfigPluginsPage::aboutPlugin()
{
// TODO add link support
QString name = lPlugins->currentText();
QValueList<ConvertPlugin*> converters = config->allConverters();
for( QValueList<ConvertPlugin*>::Iterator it = converters.begin(); it != converters.end(); ++it ) {
if( name == (*it)->info.name + " v. " + QString::number((*it)->info.version) ) {
KMessageBox::information( this,
i18n((*it)->info.about) + "\n" +
i18n("Version") + ": " + QString::number((*it)->info.version) + "\n" +
i18n("Author") + ": " + (*it)->info.author,
i18n("About") + ": " + (*it)->info.name );
break;
}
}
QValueList<ReplayGainPlugin*> replaygains = config->allReplayGains();
for( QValueList<ReplayGainPlugin*>::Iterator it = replaygains.begin(); it != replaygains.end(); ++it ) {
if( name == (*it)->info.name + " v. " + QString::number((*it)->info.version) ) {
KMessageBox::information( this,
i18n((*it)->info.about) + "\n" +
i18n("Version") + ": " + QString::number((*it)->info.version) + "\n" +
i18n("Author") + ": " + (*it)->info.author,
i18n("About") + ": " + (*it)->info.name );
break;
}
}
QValueList<RipperPlugin*> rippers = config->allRippers();
for( QValueList<RipperPlugin*>::Iterator it = rippers.begin(); it != rippers.end(); ++it ) {
if( name == (*it)->info.name + " v. " + QString::number((*it)->info.version) ) {
KMessageBox::information( this,
i18n((*it)->info.about) + "\n" +
i18n("Version") + ": " + QString::number((*it)->info.version) + "\n" +
i18n("Author") + ": " + (*it)->info.author,
i18n("About") + ": " + (*it)->info.name );
break;
}
}
}
void ConfigPluginsPage::onlinePluginsSelectionChanged( int index )
{
if( lOnlinePlugins->currentText() != i18n("No new plugins available!") ) {
pInstallOnlinePlugin->setEnabled( true );
pAboutOnlinePlugin->setEnabled( true );
}
else {
pInstallOnlinePlugin->setEnabled( false );
pAboutOnlinePlugin->setEnabled( false );
}
}
void ConfigPluginsPage::refreshOnlinePlugins()
{
pRefreshOnlinePlugins->setEnabled( false );
refreshOnlinePluginsJob = KIO::file_copy( "http://kaligames.de/downloads/soundkonverter/plugins/download.php?version=" + QString::number(config->data.app.configVersion),
locateLocal("data","soundkonverter/pluginlist.txt"), -1, true, false, false );
connect( refreshOnlinePluginsJob, SIGNAL(result(KIO::Job*)),
this, SLOT(refreshOnlinePluginsFinished(KIO::Job*))
);
}
void ConfigPluginsPage::refreshOnlinePluginsFinished( KIO::Job* job )
{
if( job->error() == 0 ) {
lOnlinePlugins->clear();
QString line;
bool add;
QFile file( locateLocal("data","soundkonverter/pluginlist.txt") );
if( file.open(IO_ReadOnly) ) {
QTextStream stream( &file );
while( !stream.atEnd() ) {
line = stream.readLine(); // line of text excluding '\n'
line.replace( "&amp;", "&" );
line.replace( "&auml;", "ä" );
line.replace( "&Auml;", "Ä" );
line.replace( "&ouml;", "ö" );
line.replace( "&Ouml;", "Ö" );
line.replace( "&uuml;", "ü" );
line.replace( "&Uuml;", "Ü" );
line.replace( "&szlig;", "ß" );
add = true;
for( uint i=0; i<lPlugins->count(); i++ ) {
if( lPlugins->text(i) == line ) {
add = false;
break;
}
}
if( add ) lOnlinePlugins->insertItem( line );
}
file.close();
}
if( lOnlinePlugins->count() == 0 ) {
lOnlinePlugins->insertItem( i18n("No new plugins available!") );
}
}
else {
KMessageBox::error( this,
i18n("The plugin list could not be downloaded. Please ensure, that your internet connection works correct.\nMaybe our server is busy at the moment, please try it again later."),
i18n("Error while loading plugin list") );
}
pRefreshOnlinePlugins->setEnabled( true );
}
void ConfigPluginsPage::getOnlinePlugin()
{
pInstallOnlinePlugin->setEnabled( false );
QString name;
for( uint i=0; i<lOnlinePlugins->count(); i++ ) {
if( lOnlinePlugins->isSelected(i) ) {
name = lOnlinePlugins->text( i );
lOnlinePlugins->removeItem( i );
break;
}
}
name.replace( "&", "&amp;" );
name.replace( "ä", "&auml;" );
name.replace( "Ä", "&Auml;" );
name.replace( "ö", "&ouml;" );
name.replace( "Ö", "&Ouml;" );
name.replace( "ü", "&uuml;" );
name.replace( "Ü", "&Uuml;" );
name.replace( "ß", "&szlig;" );
KURL::encode_string( name );
getOnlinePluginJob = KIO::file_copy( "http://kaligames.de/downloads/soundkonverter/plugins/getfile.php?version=" + QString::number(config->data.app.configVersion) + "&file=" + name,
locateLocal("data","soundkonverter/plugins/newplugin.xml"), -1, true, false, false );
connect( getOnlinePluginJob, SIGNAL(result(KIO::Job*)),
this, SLOT(getOnlinePluginFinished(KIO::Job*))
);
}
void ConfigPluginsPage::getOnlinePluginFinished( KIO::Job* job )
{
if( job->error() == 0 ) {
QString name;
QString line;
QFile file( locateLocal("data","soundkonverter/plugins/newplugin.xml") );
if( file.open(IO_ReadOnly) ) {
QTextStream stream( &file );
name = stream.readLine(); // read the file name from the top of the file
getPluginFilePathName = locateLocal("data","soundkonverter/plugins/") + name;
QFile newFile( getPluginFilePathName );
if( newFile.open(IO_WriteOnly) ) {
QTextStream newStream( &newFile );
while( !stream.atEnd() ) {
line = stream.readLine(); // line of text excluding '\n'
newStream << line << "\n";
}
newFile.close();
}
file.close();
}
file.remove();
ConvertPluginLoader* convertPluginLoader = new ConvertPluginLoader();
ReplayGainPluginLoader* replaygainPluginLoader = new ReplayGainPluginLoader();
RipperPluginLoader* ripperPluginLoader = new RipperPluginLoader();
if( convertPluginLoader->verifyFile(getPluginFilePathName) == -1 &&
replaygainPluginLoader->verifyFile(getPluginFilePathName) == -1 &&
ripperPluginLoader->verifyFile(getPluginFilePathName) == -1 )
{
KIO::del( getPluginFilePathName, false, false );
KMessageBox::error( this,
i18n("The plugin could not be installed. Please ensure that you have selected a valid soundKonverter plugin file."),
i18n("Error while installing plugin") );
}
else
{
// TODO reload plugins without restart
// ConvertPlugin* plugin = convertPluginLoader->loadFile( getPluginFilePathName );
// if( plugin->info.version != -1 ) {
// lPlugins->insertItem( plugin->info.name + " v. " + QString::number(plugin->info.version) + " (" + i18n("restart necessary") + ")" );
// }
// else {
// delete plugin;
// ConvertPlugin* plugin = convertPluginLoader->loadFile( getPluginFilePathName );
// if( plugin->info.version != -1 ) {
// lPlugins->insertItem( plugin->info.name + " v. " + QString::number(plugin->info.version) + " (" + i18n("restart necessary") + ")" );
// }
// else {
// delete plugin;
// ConvertPlugin* plugin = convertPluginLoader->loadFile( getPluginFilePathName );
// if( plugin->info.version != -1 ) {
// lPlugins->insertItem( plugin->info.name + " v. " + QString::number(plugin->info.version) + " (" + i18n("restart necessary") + ")" );
// }
// }
// }
// delete plugin;
KMessageBox::information( this,
i18n("The plugin was installed successfully. Please restart soundKonverter in order to activate it."),
i18n("Plugin successfully installed") );
//config->reloadPlugins();
//refreshPlugins();
//emit rescanForBackends();
//emit reloadEnDecoderPage();
}
delete convertPluginLoader;
delete replaygainPluginLoader;
delete ripperPluginLoader;
}
else {
KMessageBox::error( this,
i18n("The plugin could not be installed. Please ensure that you have write permission on your whole user directory."),
i18n("Error while installing plugin") );
}
}
void ConfigPluginsPage::aboutOnlinePlugin()
{
pAboutOnlinePlugin->setEnabled( false );
QString name = lOnlinePlugins->currentText();
name.replace( "&", "&amp;" );
name.replace( "ä", "&auml;" );
name.replace( "Ä", "&Auml;" );
name.replace( "ö", "&ouml;" );
name.replace( "Ö", "&Ouml;" );
name.replace( "ü", "&uuml;" );
name.replace( "Ü", "&Uuml;" );
name.replace( "ß", "&szlig;" );
KURL::encode_string( name );
aboutOnlinePluginJob = KIO::file_copy( "http://kaligames.de/downloads/soundkonverter/plugins/info.php?file=" + name + "&lang=" + QLocale::languageToString(QLocale::system().language()),
locateLocal("data","soundkonverter/plugin_info.txt"), -1, true, false, false );
connect( aboutOnlinePluginJob, SIGNAL(result(KIO::Job*)),
this, SLOT(aboutOnlinePluginFinished(KIO::Job*))
);
}
void ConfigPluginsPage::aboutOnlinePluginFinished( KIO::Job* job )
{
if( job->error() == 0 ) {
QString name = lOnlinePlugins->currentText();
QFile file( locateLocal("data","soundkonverter/plugin_info.txt") );
if( file.open(IO_ReadOnly) ) {
QTextStream stream( &file );
QString data = stream.readLine();
KMessageBox::information( this, i18n(data), i18n("About") + ": " + name,
QString::null, KMessageBox::Notify | KMessageBox::AllowLink );
}
else {
KMessageBox::error( this,
i18n("The plugin info could not be downloaded. Please ensure, that your internet connection works correctly."),
i18n("Error while loading plugin info") );
}
}
else {
KMessageBox::error( this,
i18n("The plugin info could not be downloaded. Please ensure, that your internet connection works correctly."),
i18n("Error while loading plugin info") );
}
pAboutOnlinePlugin->setEnabled( true );
}

@ -0,0 +1,82 @@
#ifndef CONFIGPLUGINSPAGE_H
#define CONFIGPLUGINSPAGE_H
#include <configpagebase.h>
#include <kio/jobclasses.h>
class Config;
class KPushButton;
class KListBox;
class QCheckBox;
/**
* @short The page for configuring the plugins
* @author Daniel Faust <hessijames@gmail.com>
* @version 0.3
*/
class ConfigPluginsPage : public ConfigPageBase
{
Q_OBJECT
public:
/**
* Default Constructor
*/
ConfigPluginsPage( Config*, QWidget *parent=0, const char *name=0 );
/**
* Default Destructor
*/
virtual ~ConfigPluginsPage();
private:
KListBox* lPlugins;
KPushButton* pAddPlugin;
KIO::FileCopyJob* getPluginJob;
KPushButton* pRemovePlugin;
KPushButton* pAboutPlugin;
KListBox* lOnlinePlugins;
KPushButton* pRefreshOnlinePlugins;
KIO::FileCopyJob* refreshOnlinePluginsJob;
KPushButton* pInstallOnlinePlugin;
KIO::FileCopyJob* getOnlinePluginJob;
KPushButton* pUpgradeOnlinePlugins;
KPushButton* pAboutOnlinePlugin;
KIO::FileCopyJob* aboutOnlinePluginJob;
QCheckBox* cCheckOnlinePlugins;
QString getPluginFilePathName;
Config* config;
public slots:
void resetDefaults();
void saveSettings();
// signals:
// void configChanged();
// void recalcEnDecoderPage();
// void reloadEnDecoderPage();
// void rescanForBackends();
private slots:
void pluginsSelectionChanged( int );
void refreshPlugins();
void getPlugin();
void getPluginFinished( KIO::Job* );
void removePlugin();
void aboutPlugin();
void onlinePluginsSelectionChanged( int );
void refreshOnlinePlugins();
void refreshOnlinePluginsFinished( KIO::Job* );
void getOnlinePlugin();
void getOnlinePluginFinished( KIO::Job* );
void aboutOnlinePlugin();
void aboutOnlinePluginFinished( KIO::Job* );
};
#endif // CONFIGPLUGINSPAGE_H

@ -0,0 +1,86 @@
#include "conversionoptions.h"
ConversionOptions::ConversionOptions() // TODO reset all values
{}
ConversionOptions::~ConversionOptions()
{}
bool ConversionOptions::nearlyEqual( const ConversionOptions& other )
{
if( encodingOptions.sFormat != other.encodingOptions.sFormat ||
encodingOptions.sQualityMode != other.encodingOptions.sQualityMode ||
encodingOptions.iQuality != other.encodingOptions.iQuality ||
encodingOptions.sBitrateMode != other.encodingOptions.sBitrateMode ||
encodingOptions.bBitrateRange != other.encodingOptions.bBitrateRange ||
encodingOptions.samplingRate.bEnabled != other.encodingOptions.samplingRate.bEnabled ||
encodingOptions.channels.bEnabled != other.encodingOptions.channels.bEnabled ||
encodingOptions.replaygain.bEnabled != other.encodingOptions.replaygain.bEnabled ||
encodingOptions.sInOutFiles != other.encodingOptions.sInOutFiles ) {
return false;
}
if( encodingOptions.bBitrateRange ) {
if( encodingOptions.iMinBitrate != other.encodingOptions.iMinBitrate ||
encodingOptions.iMaxBitrate != other.encodingOptions.iMaxBitrate ) {
return false;
}
}
if( encodingOptions.samplingRate.bEnabled ) {
if( encodingOptions.samplingRate.iSamplingRate != other.encodingOptions.samplingRate.iSamplingRate ) {
return false;
}
}
if( encodingOptions.channels.bEnabled ) {
if( encodingOptions.channels.sChannels != other.encodingOptions.channels.sChannels ) {
return false;
}
}
if( outputOptions.mode != other.outputOptions.mode ||
outputOptions.directory != other.outputOptions.directory ) {
return false;
}
return true;
}
/*bool ConversionOptions::nearlyEqual( ConversionOptions* other )
{
if( encodingOptions.sFormat != other->encodingOptions.sFormat ||
encodingOptions.sQualityMode != other->encodingOptions.sQualityMode ||
encodingOptions.iQuality != other->encodingOptions.iQuality ||
encodingOptions.sBitrateMode != other->encodingOptions.sBitrateMode ||
encodingOptions.bBitrateRange != other->encodingOptions.bBitrateRange ||
encodingOptions.samplingRate.bEnabled != other->encodingOptions.samplingRate.bEnabled ||
encodingOptions.channels.bEnabled != other->encodingOptions.channels.bEnabled ||
encodingOptions.replaygain.bEnabled != other->encodingOptions.replaygain.bEnabled ||
encodingOptions.sInOutFiles != other->encodingOptions.sInOutFiles ) {
return false;
}
if( encodingOptions.bBitrateRange ) {
if( encodingOptions.iMinBitrate != other->encodingOptions.iMinBitrate ||
encodingOptions.iMaxBitrate != other->encodingOptions.iMaxBitrate ) {
return false;
}
}
if( encodingOptions.samplingRate.bEnabled ) {
if( encodingOptions.samplingRate.iSamplingRate != other->encodingOptions.samplingRate.iSamplingRate ) {
return false;
}
}
if( encodingOptions.channels.bEnabled ) {
if( encodingOptions.channels.sChannels != other->encodingOptions.channels.sChannels ) {
return false;
}
}
if( outputOptions.mode != other->outputOptions.mode ||
outputOptions.directory != other->outputOptions.directory ) {
return false;
}
return true;
}*/

@ -0,0 +1,65 @@
#ifndef CONVERSIONOPTIONS_H
#define CONVERSIONOPTIONS_H
#include "outputdirectory.h"
#include <qstring.h>
/**
* @short Here the options for the conversion process can be stored
* @author Daniel Faust <hessijames@gmail.com>
* @version 0.3
*/
class ConversionOptions
{
public:
struct EncodingOptions {
QString sFormat; // output format
QString sQualityMode; // which mode are we using? quality, bitrate, lossless? i18n()!!!
int iQuality; // the encoding quality / bitrate
QString sBitrateMode; // when using bitrate mode, which? abr, cbr?
bool bBitrateRange; // enable bitrate range?
int iMinBitrate, iMaxBitrate; // when using bitrate range
struct SamplingRateOptions { // special options, when sampling rate is enabled
bool bEnabled;
int iSamplingRate;
} samplingRate;
struct ChannelsOptions { // special options, when channels is enabled
bool bEnabled;
QString sChannels;
} channels;
struct ReplaygainOptions { // special options, when replaygain is enabled
bool bEnabled;
} replaygain;
QString sInOutFiles; // could be called 'user defined parameter'
// but it is analog to the in_out_files option in the plugins
};
struct OutputOptions {
OutputDirectory::Mode mode;
QString directory;
};
/**
* Constructor
*/
ConversionOptions();
/**
* Destructor
*/
virtual ~ConversionOptions();
/**
* Checks whether this ConversionOptions and @p other are equal, except the 'filePathName' and 'outputFilePathName' members
*/
bool nearlyEqual( const ConversionOptions& other );
QString filePathName; // the path and name of the file
QString outputFilePathName; // if the user wants to change the output directory/file name per file!
EncodingOptions encodingOptions; // what shall we do with the file?
OutputOptions outputOptions; // where to save the file?
};
#endif // CONVERSIONOPTIONS_H

File diff suppressed because it is too large Load Diff

@ -0,0 +1,281 @@
#ifndef CONVERT_H
#define CONVERT_H
#include <kio/jobclasses.h>
#include <qobject.h>
#include <qvaluelist.h>
#include <kprocess.h>
class Config;
class TagEngine;
class CDManager;
class FileList;
class FileListItem;
class ReplayGain;
class Logger;
class KTempFile;
//class KProcess;
/**
* @short The items for the conversion (for every active file)
* @author Daniel Faust <hessijames@gmail.com>
* @version 0.3
*/
class ConvertItem
{
public:
/**
* A list of flags for knowing what to do
*/
enum Mode {
get = 0x0001, // Copy the file to tmp
get_correction = 0x0002, // Copy the correction file to tmp
rip = 0x0004, // Rip the file
decode = 0x0008, // Decode the file
encode = 0x0010, // Encode the file
replaygain = 0x0020, // Apply replaygain
write_tags = 0x0040, // Write the tags to the file
put = 0x0080, // Move the file to the output directory
put_correction = 0x0100, // Move the correction file to the output directory
execute_userscript= 0x0200 // Run the user script
};
/**
* Default Constructor
*/
ConvertItem();
/**
* Constructor
* @p item A pointer to the file list item
*/
ConvertItem( FileListItem* item );
/**
* Destructor
*/
virtual ~ConvertItem();
/** a reference to the file list item */
FileListItem* fileListItem;
/** for adding replay gain */
ReplayGain* replayGain;
/** if we need to encode, decode, etc. here we have our processes */
KProcess* convertProcess;
/** for moving the file to the temporary or output directory */
KIO::Job* moveJob;
KTempFile* tempInFile;
KTempFile* tempWavFile;
KTempFile* tempOutFile;
QString correctionInFile;
QString correctionOutFile;
QString correctionInputExtension;
QString correctionOutputExtension;
//QTime readOutputTimer;
QTime lastOutputTimer;
/** what shall we do with the file? */
Mode mode;
/** and what are we doing with the file? */
Mode state;
/** the id with that the item is registered at the logger */
int logID;
/** the binary for special treatment */
// QString binary;
/** the path and the name of the output file (needed for executing a command after conversion) */
QString outputFilePathName;
/** if it is an audio cd and it should be ripped to one file: the number of tracks on the cd */
int tracks;
/** the current track */
int track;
int lastPercent;
/** the time from the file list item splitted up */
float getTime;
float getCorrectionTime;
float ripTime;
float decodeTime;
float encodeTime;
float replaygainTime;
/** the current conversion progress */
int percent;
};
/**
* @short The conversion engine
* @author Daniel Faust <hessijames@gmail.com>
* @version 0.3
*/
class Convert : public QObject
{
Q_OBJECT
public:
/**
* Constructor
*/
Convert( Config*, TagEngine*, CDManager*, FileList*, Logger* );
/**
* Destructor
*/
virtual ~Convert();
void cleanUp();
private:
/**
* Copy the file with the file list item @p item to a temporary directory and download or rip, when necessary
*/
void get( ConvertItem* item );
/**
* Copy the correction file with the file list item @p item to a temporary directory and download or rip, when necessary
*/
void getCorrection( ConvertItem* item );
/**
* Rip the file with the convert item @p item from the CD
*/
void rip( ConvertItem* item );
/**
* Decode the file with the convert item @p item
*/
void decode( ConvertItem* item );
/**
* Encode the file with the convert item @p item
*/
void encode( ConvertItem* item );
/**
* Calculate replaygain tags of the file with the convert item @p item
*/
void replaygain( ConvertItem* item );
/**
* Write the tags of the file with the convert item @p item
*/
void writeTags( ConvertItem* item );
/**
* Copy the file with the convert item @p item to the output directory
*/
void put( ConvertItem* item );
/**
* Copy the correction file with the convert item @p item to the output directory
*/
void putCorrection( ConvertItem* item );
/**
* Run the userscript for the convert item @p item
*/
void executeUserScript( ConvertItem* item );
/**
* Decide, what to do next with out item @p item
*/
void executeNextStep( ConvertItem* item );
/**
* Remove item @p item and emit the state @p state
*/
void remove( ConvertItem* item, int state = 0 );
/** holds all active files */
QValueList<ConvertItem*> items;
Config* config;
TagEngine* tagEngine;
CDManager* cdManager;
FileList* fileList;
Logger* logger;
QTimer* tUpdateProgressIndicator;
KProcess notify;
private slots:
/**
* The file is being moved
* @p job The pinter to the job
*/
void moveProgress( KIO::Job* job, unsigned long percent );
/**
* The file has been moved
* @p job The pinter to the job
*/
void moveFinished( KIO::Job* job );
/**
* Get the process' output
* @p proc The pinter to the progess
* @p data The output data
* @p length The length of the data
*/
void processOutput( KProcess *proc, char *data, int length );
/**
* The process has exited
* @p proc The pinter to the progess
*/
void processExit( KProcess *proc );
/**
* Updates the progress indicator
*/
void updateProgressIndicator();
public slots:
/**
* Add a new @p item to the item list and start
*/
void add( FileListItem* item );
/**
* Stop the item with the file list item @p item in the item list and remove it
*/
void stop( FileListItem* item );
/**
* Change the process priorities
*/
// void priorityChanged( int );
signals:
/**
* A job was completed
* The job with the file list item @p item was completed
* And report the finish @p state ( 0 = ok, -1 = error, 1 = aborted )
*/
void finished( FileListItem* item, int state );
/**
* Send the logger a signal
*/
void finishedProcess( int id, int state );
/**
* The next track from @p device can be ripped while the track is being encoded
*/
void rippingFinished( const QString& device );
void countTime( float );
void uncountTime( float );
void update( float );
};
#endif // CONVERT_H

@ -0,0 +1,325 @@
#include "cuesheeteditor.h"
#include <qlayout.h>
#include <qstring.h>
#include <klocale.h>
#include <kiconloader.h>
#include <kpushbutton.h>
#include <kmessagebox.h>
//#include <ktextedit.h>
/*#include <kparts/factory.h> // KPart Factory
#include <klibloader.h> // LibLoader, contains factories
#include <kate/document.h> // Katepart document
#include <kate/view.h> // Katepart view
*/
// ### soundkonverter 0.4: import/export flac cuesheet
CuesheetEditor::CuesheetEditor( QWidget *parent, const char *name, bool modal, WFlags f )
: KDialog( parent, name, modal, f )
{
// TODO can the cuesheet editor be extendet by more tags (composer), etc.
// create an icon loader object for loading icons
KIconLoader* iconLoader = new KIconLoader();
setCaption( i18n("Cuesheet Editor") );
resize( 600, 400 );
setIcon( iconLoader->loadIcon("kwrite",KIcon::Small) );
QGridLayout *grid = new QGridLayout( this, 4, 1, 11, 6 );
tTextEdit = new KTextEdit( this, "tTextEdit" );
tTextEdit->setFocus();
grid->addWidget( tTextEdit, 0, 0 );
/*
// Get KPart factory for the katepart library.
// This returns 0, if the library can not be found
KParts::Factory* factory = (KParts::Factory *)
KLibLoader::self()->factory ("libkatepart");
if (factory)
{
// The library was found, so create the Kate::Document
KTextEditor::Document *doc = (KTextEditor::Document *)
factory->createPart( 0, "", this, "", "KTextEditor::Document" );
// The document only represents the document, to view
// the document's content
// we have to create a view for the document.
Kate::View *view = (Kate::View *) doc->createView( this, 0L );
// all went well, so return the view
//return view;
grid->addWidget( view, 0, 0 );
}
else
{
// The library was not found
//return 0L;
}
*/
QHBoxLayout *buttonBox = new QHBoxLayout();
grid->addLayout( buttonBox, 3, 0 );
pHelp = new KPushButton( iconLoader->loadIcon("help",KIcon::Small), "", this, "pHelp" );
buttonBox->addWidget( pHelp );
connect( pHelp, SIGNAL(clicked()),
this, SLOT(help())
);
pGenerate = new KPushButton( iconLoader->loadIcon("filenew",KIcon::Small), i18n("Generate"), this, "pGenerate" );
buttonBox->addWidget( pGenerate );
connect( pGenerate, SIGNAL(clicked()),
this, SLOT(generate())
);
pConvert = new KPushButton( iconLoader->loadIcon("run",KIcon::Small), i18n("Format"), this, "pConvert" );
buttonBox->addWidget( pConvert );
connect( pConvert, SIGNAL(clicked()),
this, SLOT(convert())
);
pShift = new KPushButton( iconLoader->loadIcon("reload",KIcon::Small), i18n("Shift Title/Performer"), this, "pShift" );
buttonBox->addWidget( pShift );
connect( pShift, SIGNAL(clicked()),
this, SLOT(shift())
);
buttonBox->addStretch();
pOk = new KPushButton(iconLoader->loadIcon("exit",KIcon::Small), i18n("Close"), this, "pOk" );
pOk->setFocus();
buttonBox->addWidget( pOk );
connect( pOk, SIGNAL(clicked()),
this, SLOT(accept())
);
// delete the icon loader object
delete iconLoader;
}
CuesheetEditor::~CuesheetEditor()
{}
void CuesheetEditor::help()
{
KMessageBox::information( this,
i18n("<p>With this small tool you can process cue files as they are used for burning music mixes and for organizing them in media players like amaroK.<br><br>You can generate a new file by pasting text into the input area. It must be formated the following way:<br><br>Title - Artist [time]<br>Title - Artist [3:25]<br>Title - Artist [2:37]<br>...<br>A tip: Use kwrite and regular expressions to format it this way.</p>"),
i18n("Cuesheet Editor - Help") );
}
void CuesheetEditor::generate()
{
QString text = tTextEdit->text();
QString newText;
QStringList titleList, performerList;
QValueList<int> timeList;
QString time;
int min, sec;
int index;
while( index != -1 )
{
index = text.find( " - " );
if( index == -1 )
break;
titleList.append( text.left(index) );
text.remove( 0, index + 3 );
index=text.find( " [" );
if( index == -1 )
break;
performerList.append( text.left(index) );
text.remove( 0, index + 2 );
index = text.find( "]" );
if( index == -1 )
break;
time = text.left( index );
sscanf( time, "%i:%i", &min, &sec );
timeList.append( min * 60 + sec );
text.remove( 0, index + 2 );
}
newText.append( "TITLE \"\"\n" );
newText.append( "PERFORMER \"\"\n" );
newText.append( "FILE \"\" MP3\n" );
int TRACK = 1;
int INDEX = 0;
bool addFrames = false;
QStringList::Iterator performerIt = performerList.begin();
QValueList<int>::Iterator timeIt = timeList.begin();
for( QStringList::Iterator titleIt = titleList.begin(); titleIt != titleList.end(); ++titleIt )
{
newText.append( QString().sprintf(" TRACK %02i AUDIO\n",TRACK ) );
newText.append( " TITLE \"" + (*titleIt) + "\"\n" );
newText.append( " PERFORMER \"" + (*performerIt) + "\"\n" );
if( addFrames ) {
newText.append( QString().sprintf(" INDEX 01 %02i:%02i:37\n",INDEX/60,INDEX%60) );
INDEX++;
addFrames = false;
}
else {
newText.append( QString().sprintf(" INDEX 01 %02i:%02i:00\n",INDEX/60,INDEX%60) );
addFrames = true;
}
performerIt++;
timeIt++;
TRACK++;
INDEX += (*timeIt);
}
tTextEdit->setText(newText);
}
void CuesheetEditor::convert()
{
QString text=tTextEdit->text();
QString newText;
QString tmpText;
QString first, rest;
QStringList splinters;
int index;
while( index!=-1 )
{
index=text.find("\"");
if( index==-1 )
break;
newText+=text.left(index+1);
text.remove(0,index+1);
index=text.find("\"");
tmpText=text.left(index+1);
text.remove(0,index+1);
if( newText.right(6) == "FILE \"" )
{
newText+=tmpText;
continue;
}
splinters=QStringList::split(' ',tmpText);
for( QStringList::Iterator it=splinters.begin(); it!=splinters.end(); ++it )
{
for( uint i=0; i<(*it).length(); i++ )
{
if( (*it).left(i).lower() != (*it).left(i).upper() )
{
index=i;
break;
}
}
first=(*it).left(index);
first=first.upper();
rest=(*it).right((*it).length()-index);
rest=rest.lower();
for( uint i=0; i<rest.length(); i++ )
{
/*if( rest.mid(i,1).lower() == rest.mid(i,1).upper() )
{
rest=rest.left(i+1)+rest.mid(i+1,1).upper()+rest.right(rest.length()-i-2);
}*/
if( rest.mid(i,1) ==