Support "eject" on OS X.
[maemo-rb.git] / rbutil / rbutilqt / base / encoderbase.cpp
blob05ccae3011fbb85d88606530fedeb8090d272839
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
9 * Copyright (C) 2007 by Dominik Wenger
11 * All files in this archive are subject to the GNU General Public License.
12 * See the file COPYING in the source tree root for full license agreement.
14 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
15 * KIND, either express or implied.
17 ****************************************************************************/
19 #include "encoderbase.h"
20 #include "utils.h"
21 #include "rbsettings.h"
22 #include "encoderrbspeex.h"
23 #include "encoderlame.h"
24 #include "encoderexe.h"
26 /*********************************************************************
27 * Encoder Base
28 **********************************************************************/
29 QMap<QString,QString> EncoderBase::encoderList;
31 EncoderBase::EncoderBase(QObject *parent): EncTtsSettingInterface(parent)
36 // initialize list of encoders
37 void EncoderBase::initEncodernamesList()
39 encoderList["rbspeex"] = "Rockbox Speex Encoder";
40 encoderList["lame"] = "Lame Mp3 Encoder";
44 // get nice name for a specific encoder
45 QString EncoderBase::getEncoderName(QString encoder)
47 if(encoderList.isEmpty())
48 initEncodernamesList();
49 return encoderList.value(encoder);
53 // get a specific encoder object
54 EncoderBase* EncoderBase::getEncoder(QObject* parent,QString encoder)
56 EncoderBase* enc;
57 if(encoder == "lame")
59 #if defined(Q_OS_MACX)
60 /* currently not on OS X */
61 enc = new EncoderExe(encoder,parent);
62 #else
63 enc = new EncoderLame(parent);
64 #endif
65 return enc;
67 else // rbspeex is default
69 enc = new EncoderRbSpeex(parent);
70 return enc;
75 QStringList EncoderBase::getEncoderList()
77 if(encoderList.isEmpty())
78 initEncodernamesList();
79 return encoderList.keys();