File indexing completed on 2024-10-06 04:25:57

0001 /*
0002     SPDX-FileCopyrightText: 2010 Michal Malek <michalm@jabster.pl>
0003     SPDX-FileCopyrightText: 1998-2007 Sebastian Trueg <trueg@k3b.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #include "k3baudioprojectinterface.h"
0009 #include "k3baudioprojectinterfaceadaptor.h"
0010 #include "k3baudiodoc.h"
0011 #include "k3baudiotrack.h"
0012 
0013 namespace K3b {
0014 
0015 AudioProjectInterface::AudioProjectInterface( AudioDoc* doc, const QString& dbusPath )
0016 :
0017     ProjectInterface( doc, dbusPath ),
0018     m_audioDoc( doc )
0019 {
0020     new K3bAudioProjectInterfaceAdaptor( this );
0021 }
0022 
0023 
0024 int AudioProjectInterface::trackCount() const
0025 {
0026     return m_audioDoc->numOfTracks();
0027 }
0028 
0029 
0030 QString AudioProjectInterface::title() const
0031 {
0032     return m_audioDoc->title();
0033 }
0034 
0035 
0036 QString AudioProjectInterface::artist() const
0037 {
0038     return m_audioDoc->artist();
0039 }
0040 
0041 
0042 QString AudioProjectInterface::trackTitle( int trackNum ) const
0043 {
0044     AudioTrack* track = m_audioDoc->getTrack( trackNum );
0045     if( track )
0046         return track->title();
0047     else
0048         return QString();
0049 }
0050 
0051 
0052 QString AudioProjectInterface::trackArtist( int trackNum ) const
0053 {
0054     AudioTrack* track = m_audioDoc->getTrack( trackNum );
0055     if( track )
0056         return track->artist();
0057     else
0058         return QString();
0059 }
0060 
0061 
0062 void AudioProjectInterface::setTitle( const QString& title )
0063 {
0064     m_audioDoc->setTitle( title );
0065 }
0066 
0067 
0068 void AudioProjectInterface::setArtist( const QString& artist )
0069 {
0070     m_audioDoc->setArtist( artist );
0071 }
0072 
0073 
0074 void AudioProjectInterface::setTrackTitle( int trackNum, const QString& title )
0075 {
0076     AudioTrack* track = m_audioDoc->getTrack( trackNum );
0077     if( track )
0078         track->setTitle( title );
0079 }
0080 
0081 
0082 void AudioProjectInterface::setTrackArtist( int trackNum, const QString& artist )
0083 {
0084     AudioTrack* track = m_audioDoc->getTrack( trackNum );
0085     if( track )
0086         track->setArtist( artist );
0087 }
0088 
0089 } // namespace K3b
0090 
0091 #include "moc_k3baudioprojectinterface.cpp"