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 #include "TranscodingProperty.h" 0018 #include "core/support/Debug.h" 0019 0020 #include <QComboBox> 0021 #include <QHBoxLayout> 0022 #include <QLabel> 0023 #include <QLineEdit> 0024 #include <QSpinBox> 0025 0026 namespace Transcoding 0027 { 0028 0029 Property 0030 Property::Tradeoff( const QByteArray &name, 0031 const QString &prettyName, 0032 const QString &description, 0033 const QString &leftText, 0034 const QString &rightText, 0035 int min, 0036 int max, 0037 int defaultValue ) 0038 { 0039 if( max < min ) 0040 qSwap( min, max ); 0041 return Property( name, prettyName, description, TRADEOFF, 0042 defaultValue, min, max, QStringList(), 0043 QStringList() << leftText << rightText ); 0044 } 0045 0046 Property 0047 Property::Tradeoff(const QByteArray &name, 0048 const QString &prettyName, 0049 const QString &description, 0050 const QString &leftText, 0051 const QString &rightText, 0052 const QStringList &valueLabels, 0053 int defaultValue ) 0054 { 0055 return Property( name, prettyName, description, TRADEOFF, 0056 defaultValue, 0, valueLabels.isEmpty() ? 0 : valueLabels.size() - 1, valueLabels, 0057 QStringList() << leftText << rightText ); 0058 } 0059 0060 QVariant::Type 0061 Property::variantType() const 0062 { 0063 switch( m_type ) 0064 { 0065 case TRADEOFF: 0066 return QVariant::Int; 0067 } 0068 return QVariant::Invalid; 0069 } 0070 0071 Property::Property( const QByteArray &name, 0072 const QString &prettyName, 0073 const QString &description, 0074 Type type, 0075 const QVariant &defaultValue, 0076 int min, 0077 int max, 0078 const QStringList &valueLabels, 0079 const QStringList &endLabels ) 0080 : m_name( name ) 0081 , m_prettyName( prettyName ) 0082 , m_description( description ) 0083 , m_type( type ) 0084 , m_defaultValue( defaultValue ) 0085 , m_min( min ) 0086 , m_max( max ) 0087 , m_valueLabels( valueLabels ) 0088 , m_endLabels( endLabels ) 0089 {} 0090 0091 } //namespace Transcoding