File indexing completed on 2024-05-19 04:49:33

0001 /****************************************************************************************
0002  * Copyright (c) 2010 Téo Mrnjavac <teo@kde.org>                                        *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License aint with          *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 #ifndef TRANSCODING_PROPERTY_H
0018 #define TRANSCODING_PROPERTY_H
0019 
0020 #include "core/amarokcore_export.h"
0021 
0022 #include <QPointer>
0023 #include <QStringList>
0024 #include <QVariant>
0025 #include <QWidget>
0026 
0027 namespace Transcoding
0028 {
0029 
0030 /**
0031  * This class defines a single option that modifies the behavior of an encoder, as
0032  * defined by a Transcoding::Format subclass.
0033  * @author Téo Mrnjavac <teo@kde.org>
0034  */
0035 class AMAROKCORE_EXPORT Property
0036 {
0037 public:
0038     enum Type
0039     {
0040         TRADEOFF
0041     };
0042 
0043     static Property Tradeoff( const QByteArray &name,
0044                               const QString &prettyName,
0045                               const QString &description,
0046                               const QString &leftText,
0047                               const QString &rightText,
0048                               int min,
0049                               int max,
0050                               int defaultValue );
0051 
0052     static Property Tradeoff( const QByteArray &name,
0053                               const QString &prettyName,
0054                               const QString &description,
0055                               const QString &leftText,
0056                               const QString &rightText,
0057                               const QStringList &valueLabels,
0058                               int defaultValue );
0059 
0060     QByteArray name() const { return m_name; }
0061 
0062     const QString & prettyName() const { return m_prettyName; }
0063 
0064     const QString & description() const { return m_description; }
0065 
0066     Type type() const { return m_type; }
0067 
0068     QVariant::Type variantType() const;
0069 
0070     int min() const { return m_min; }
0071 
0072     int max() const { return m_max; }
0073 
0074     QVariant defaultValue() const { return m_defaultValue; }
0075 
0076     const QStringList & valueLabels() const { return m_valueLabels; }
0077 
0078     const QStringList & endLabels() const { return m_endLabels; }
0079 
0080 private:
0081     Property( const QByteArray &name,
0082               const QString &prettyName,
0083               const QString &description,
0084               Type type,
0085               const QVariant &defaultValue,
0086               int min,
0087               int max,
0088               const QStringList &valueLabels,
0089               const QStringList &endLabels );
0090 
0091     QByteArray m_name;
0092     QString m_prettyName;
0093     QString m_description;
0094     Type m_type;
0095     QVariant m_defaultValue;
0096     int m_min;
0097     int m_max;
0098     QStringList m_valueLabels;
0099     QStringList m_endLabels;
0100 };
0101 
0102 typedef QList< Property > PropertyList;
0103 
0104 }
0105 
0106 #endif //TRANSCODING_PROPERTY_H