File indexing completed on 2025-03-09 04:24:22
0001 /**************************************************************************************** 0002 * Copyright (c) 2012 Matěj Laitl <matej@laitl.cz> * 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 along with * 0014 * this program. If not, see <http://www.gnu.org/licenses/>. * 0015 ****************************************************************************************/ 0016 0017 #include "IpodTranscodeCapability.h" 0018 0019 #include <KConfig> 0020 0021 using namespace Capabilities; 0022 0023 IpodTranscodeCapability::IpodTranscodeCapability( IpodCollection *coll, const QString &deviceDirPath ) 0024 : TranscodeCapability() 0025 , m_coll( coll ) 0026 , m_configFilePath( deviceDirPath + QString( "/AmarokTranscodingPrefs" ) ) 0027 { 0028 } 0029 0030 IpodTranscodeCapability::~IpodTranscodeCapability() 0031 { 0032 // nothing to do 0033 } 0034 0035 QStringList 0036 IpodTranscodeCapability::playableFileTypes() 0037 { 0038 if( m_coll ) 0039 return m_coll->supportedFormats(); 0040 return QStringList(); 0041 } 0042 0043 Transcoding::Configuration 0044 IpodTranscodeCapability::savedConfiguration() 0045 { 0046 KConfig config( m_configFilePath, KConfig::SimpleConfig ); 0047 return Transcoding::Configuration::fromConfigGroup( config.group( nullptr ) ); 0048 } 0049 0050 void 0051 IpodTranscodeCapability::setSavedConfiguration( const Transcoding::Configuration &configuration ) 0052 { 0053 KConfig config( m_configFilePath, KConfig::SimpleConfig ); 0054 KConfigGroup group = config.group( nullptr ); 0055 configuration.saveToConfigGroup( group ); 0056 config.sync(); 0057 } 0058