mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-20 07:49:42 +01:00
Add a Copy Link action and keep Export Playlist for static playlists
This commit is contained in:
parent
5b98bc9c75
commit
26733aa85f
@ -190,6 +190,13 @@ SourceTreeView::setupMenus()
|
||||
m_playlistMenu.addSeparator();
|
||||
|
||||
QAction *copyPlaylistAction = m_playlistMenu.addAction( tr( "&Copy Link" ) );
|
||||
|
||||
if ( type == SourcesModel::StaticPlaylist )
|
||||
{
|
||||
QAction* exportPlaylist = m_playlistMenu.addAction( tr( "&Export Playlist") );
|
||||
connect( exportPlaylist, SIGNAL( triggered() ), this, SLOT( exportPlaylist() ) );
|
||||
}
|
||||
|
||||
QAction *deletePlaylistAction = m_playlistMenu.addAction( tr( "&Delete %1" ).arg( SourcesModel::rowTypeToString( type ) ) );
|
||||
|
||||
QString addToText;
|
||||
@ -227,9 +234,6 @@ SourceTreeView::setupMenus()
|
||||
}
|
||||
}
|
||||
|
||||
if ( type == SourcesModel::StaticPlaylist )
|
||||
copyPlaylistAction->setText( tr( "&Copy Playlist Link" ) );
|
||||
|
||||
connect( loadPlaylistAction, SIGNAL( triggered() ), SLOT( loadPlaylist() ) );
|
||||
connect( renamePlaylistAction, SIGNAL( triggered() ), SLOT( renamePlaylist() ) );
|
||||
connect( deletePlaylistAction, SIGNAL( triggered() ), SLOT( deletePlaylist() ) );
|
||||
@ -398,23 +402,37 @@ SourceTreeView::copyPlaylistLink()
|
||||
}
|
||||
else if ( type == SourcesModel::StaticPlaylist )
|
||||
{
|
||||
// Disable toma.hk playlist mode until ready
|
||||
PlaylistItem* item = itemFromIndex< PlaylistItem >( m_contextMenuIndex );
|
||||
playlist_ptr playlist = item->playlist();
|
||||
GlobalActionManager::instance()->getShortLink( playlist );
|
||||
/*
|
||||
PlaylistItem* item = itemFromIndex< PlaylistItem >( m_contextMenuIndex );
|
||||
playlist_ptr playlist = item->playlist();
|
||||
const PlaylistItem* item = itemFromIndex< PlaylistItem >( m_contextMenuIndex );
|
||||
const playlist_ptr playlist = item->playlist();
|
||||
|
||||
QString suggestedFilename = TomahawkSettings::instance()->playlistDefaultPath() + "/" + playlist->title();
|
||||
QString filename = QFileDialog::getSaveFileName( TomahawkUtils::tomahawkWindow(), tr( "Save XSPF" ),
|
||||
suggestedFilename, tr( "Playlists (*.xspf)" ) );
|
||||
if ( !filename.isEmpty() )
|
||||
{
|
||||
QFileInfo playlistAbsoluteFilePath = filename;
|
||||
TomahawkSettings::instance()->setPlaylistDefaultPath( playlistAbsoluteFilePath.absolutePath() );
|
||||
GlobalActionManager::instance()->savePlaylistToFile( playlist, filename );
|
||||
} */
|
||||
GlobalActionManager::instance()->getShortLink( playlist );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SourceTreeView::exportPlaylist()
|
||||
{
|
||||
const QModelIndex idx = m_contextMenuIndex;
|
||||
if ( !idx.isValid() )
|
||||
return;
|
||||
|
||||
const SourcesModel::RowType type = ( SourcesModel::RowType )model()->data( m_contextMenuIndex, SourcesModel::SourceTreeItemTypeRole ).toInt();
|
||||
Q_ASSERT( type == SourcesModel::StaticPlaylist );
|
||||
if ( type != SourcesModel::StaticPlaylist )
|
||||
return;
|
||||
|
||||
const PlaylistItem* item = itemFromIndex< PlaylistItem >( m_contextMenuIndex );
|
||||
const playlist_ptr playlist = item->playlist();
|
||||
|
||||
const QString suggestedFilename = TomahawkSettings::instance()->playlistDefaultPath() + "/" + playlist->title();
|
||||
const QString filename = QFileDialog::getSaveFileName( TomahawkUtils::tomahawkWindow(), tr( "Save XSPF" ),
|
||||
suggestedFilename, tr( "Playlists (*.xspf)" ) );
|
||||
if ( !filename.isEmpty() )
|
||||
{
|
||||
const QFileInfo playlistAbsoluteFilePath( filename );
|
||||
TomahawkSettings::instance()->setPlaylistDefaultPath( playlistAbsoluteFilePath.absolutePath() );
|
||||
GlobalActionManager::instance()->savePlaylistToFile( playlist, filename );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,6 +72,7 @@ private slots:
|
||||
void loadPlaylist();
|
||||
void deletePlaylist( const QModelIndex& = QModelIndex() );
|
||||
void copyPlaylistLink();
|
||||
void exportPlaylist();
|
||||
void addToLocal();
|
||||
|
||||
void latchOnOrCatchUp();
|
||||
|
Loading…
x
Reference in New Issue
Block a user