File indexing completed on 2025-01-19 04:24:19
0001 /**************************************************************************************** 0002 * Copyright (c) 2009 Nikolaj Hald Nielsen <nhn@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 along with * 0014 * this program. If not, see <http://www.gnu.org/licenses/>. * 0015 ****************************************************************************************/ 0016 0017 #include "AudioCdCollectionLocation.h" 0018 0019 #include "AudioCdMeta.h" 0020 #include "core/support/Debug.h" 0021 #include "FormatSelectionDialog.h" 0022 0023 using namespace Collections; 0024 0025 AudioCdCollectionLocation::AudioCdCollectionLocation( AudioCdCollection *parentCollection ) 0026 : CollectionLocation( parentCollection ) 0027 , m_collection( parentCollection ) 0028 { 0029 } 0030 0031 0032 AudioCdCollectionLocation::~AudioCdCollectionLocation() 0033 { 0034 } 0035 0036 void AudioCdCollectionLocation::getKIOCopyableUrls( const Meta::TrackList & tracks ) 0037 { 0038 DEBUG_BLOCK 0039 0040 QMap<Meta::TrackPtr, QUrl> resultMap; 0041 foreach( Meta::TrackPtr trackPtr, tracks ) 0042 { 0043 Meta::AudioCdTrackPtr cdTrack = Meta::AudioCdTrackPtr::staticCast( trackPtr ); 0044 0045 const QString path = m_collection->copyableFilePath( cdTrack->fileNameBase() + QLatin1Char('.') + m_collection->encodingFormat() ); 0046 resultMap.insert( trackPtr, QUrl::fromLocalFile( path ) ); 0047 } 0048 0049 slotGetKIOCopyableUrlsDone( resultMap ); 0050 } 0051 0052 void AudioCdCollectionLocation::showSourceDialog( const Meta::TrackList &tracks, bool removeSources ) 0053 { 0054 DEBUG_BLOCK 0055 Q_UNUSED( tracks ) 0056 Q_UNUSED( removeSources ) 0057 FormatSelectionDialog * dlg = new FormatSelectionDialog(); 0058 0059 connect( dlg, &FormatSelectionDialog::formatSelected, this, &AudioCdCollectionLocation::onFormatSelected ); 0060 connect( dlg, &FormatSelectionDialog::rejected, this, &AudioCdCollectionLocation::onCancel ); 0061 0062 dlg->show(); 0063 } 0064 0065 void AudioCdCollectionLocation::formatSelected( int format ) 0066 { 0067 Q_UNUSED( format ) 0068 } 0069 0070 void AudioCdCollectionLocation::formatSelectionCancelled() 0071 { 0072 } 0073 0074 void AudioCdCollectionLocation::onFormatSelected( int format ) 0075 { 0076 DEBUG_BLOCK 0077 m_collection->setEncodingFormat( format ); 0078 slotShowSourceDialogDone(); 0079 } 0080 0081 void AudioCdCollectionLocation::onCancel() 0082 { 0083 DEBUG_BLOCK 0084 abort(); 0085 } 0086 0087 0088 0089