Warning, file /multimedia/amarok/src/amarokurls/BookmarkMetaActions.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /**************************************************************************************** 0002 * Copyright (c) 2008 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 "BookmarkMetaActions.h" 0018 0019 #include "EngineController.h" 0020 #include "SvgHandler.h" 0021 #include "amarokurls/AmarokUrlHandler.h" 0022 #include "amarokurls/BookmarkModel.h" 0023 #include "core/meta/Meta.h" 0024 #include "core-impl/capabilities/timecode/TimecodeWriteCapability.h" 0025 #include "widgets/ProgressWidget.h" 0026 0027 #include <QIcon> 0028 #include <KLocalizedString> 0029 0030 BookmarkAlbumAction::BookmarkAlbumAction( QObject *parent, const Meta::AlbumPtr &album ) 0031 : QAction( i18n( "Bookmark this Album" ), parent ) 0032 , m_album( album ) 0033 { 0034 connect( this, &BookmarkAlbumAction::triggered, this, &BookmarkAlbumAction::slotTriggered ); 0035 setIcon( QIcon::fromTheme(QStringLiteral("bookmark-new")) ); 0036 setProperty( "popupdropper_svg_id", "lastfm" ); 0037 } 0038 0039 void 0040 BookmarkAlbumAction::slotTriggered() 0041 { 0042 The::amarokUrlHandler()->bookmarkAlbum( m_album ); 0043 } 0044 0045 0046 BookmarkArtistAction::BookmarkArtistAction( QObject *parent, const Meta::ArtistPtr &artist ) 0047 : QAction( i18n( "Bookmark this Artist" ), parent ) 0048 , m_artist( artist ) 0049 { 0050 connect( this, &BookmarkArtistAction::triggered, this, &BookmarkArtistAction::slotTriggered ); 0051 setIcon( QIcon::fromTheme(QStringLiteral("bookmark-new")) ); 0052 setProperty( "popupdropper_svg_id", "lastfm" ); 0053 } 0054 0055 void 0056 BookmarkArtistAction::slotTriggered() 0057 { 0058 The::amarokUrlHandler()->bookmarkArtist( m_artist ); 0059 } 0060 0061 BookmarkCurrentTrackPositionAction::BookmarkCurrentTrackPositionAction( QObject * parent ) 0062 : QAction( i18n( "Add Position Marker" ), parent ) 0063 { 0064 connect( this, &BookmarkCurrentTrackPositionAction::triggered, this, &BookmarkCurrentTrackPositionAction::slotTriggered ); 0065 setIcon( QIcon::fromTheme(QStringLiteral("flag-amarok")) ); 0066 } 0067 0068 void 0069 BookmarkCurrentTrackPositionAction::slotTriggered() 0070 { 0071 DEBUG_BLOCK 0072 0073 Meta::TrackPtr track = The::engineController()->currentTrack(); 0074 const qint64 miliseconds = The::engineController()->trackPositionMs(); 0075 0076 if ( track && track->has<Capabilities::TimecodeWriteCapability>() ) 0077 { 0078 debug() << " has WriteTimecode "; 0079 QScopedPointer<Capabilities::TimecodeWriteCapability> tcw( track->create<Capabilities::TimecodeWriteCapability>() ); 0080 tcw->writeTimecode( miliseconds ); 0081 } 0082 } 0083 0084 0085