Update Brazilian Portuguese translation for Rockbox Utility
[kugel-rb.git] / rbutil / rbutilqt / base / encoders.h
bloba70f775e98ed0cb573b96439d433d3c1cc2d39e0
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id$
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #ifndef ENCODERS_H
23 #define ENCODERS_H
25 #include <QtCore>
27 #include "encttssettings.h"
28 #include "rbspeex.h"
31 class EncBase : public EncTtsSettingInterface
33 Q_OBJECT
34 public:
35 EncBase(QObject *parent );
37 //! Child class should encode a wav file
38 virtual bool encode(QString input,QString output) =0;
39 //! Child class should do startup
40 virtual bool start()=0;
41 //! Child class should stop
42 virtual bool stop()=0;
44 // settings
45 //! Child class should return true when configuration is ok
46 virtual bool configOk()=0;
47 //! Child class should fill in the setttingsList
48 virtual void generateSettings() = 0;
49 //! Chlid class should commit the from SettingsList to permanent storage
50 virtual void saveSettings() = 0;
52 // static functions
53 static QString getEncoderName(QString name);
54 static EncBase* getEncoder(QObject* parent,QString name);
55 static QStringList getEncoderList(void);
57 private:
58 static void initEncodernamesList(void);
60 protected:
61 static QMap<QString,QString> encoderList;
65 class EncExes : public EncBase
67 enum ESettings
69 eEXEPATH,
70 eEXEOPTIONS
73 Q_OBJECT
74 public:
75 EncExes(QString name,QObject *parent = NULL);
76 bool encode(QString input,QString output);
77 bool start();
78 bool stop() {return true;}
80 // setting
81 bool configOk();
82 void generateSettings();
83 void saveSettings();
85 private:
86 QString m_name;
87 QString m_EncExec;
88 QString m_EncOpts;
89 QMap<QString,QString> m_TemplateMap;
90 QString m_EncTemplate;
93 class EncRbSpeex : public EncBase
95 enum ESettings
97 eVOLUME,
98 eQUALITY,
99 eCOMPLEXITY,
100 eNARROWBAND
103 Q_OBJECT
104 public:
105 EncRbSpeex(QObject *parent = NULL);
106 bool encode(QString input,QString output);
107 bool start();
108 bool stop() {return true;}
110 // for settings view
111 bool configOk();
112 void generateSettings();
113 void saveSettings();
115 private:
116 float quality;
117 float volume;
118 int complexity;
119 bool narrowband;
121 float defaultQuality;
122 float defaultVolume;
123 int defaultComplexity;
124 bool defaultBand;
128 #endif