mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-07 06:36:55 +02:00
* Fixed TWK-379: Properly parent 'Export Playlist' dialog and store/restore last used path.
This commit is contained in:
@@ -863,6 +863,20 @@ TomahawkSettings::setScriptDefaultPath( const QString& path )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString
|
||||||
|
TomahawkSettings::playlistDefaultPath() const
|
||||||
|
{
|
||||||
|
return value( "playlists/defaultpath", QDir::homePath() ).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TomahawkSettings::setPlaylistDefaultPath( const QString& path )
|
||||||
|
{
|
||||||
|
setValue( "playlists/defaultpath", path );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TomahawkSettings::nowPlayingEnabled() const
|
TomahawkSettings::nowPlayingEnabled() const
|
||||||
{
|
{
|
||||||
|
@@ -184,8 +184,11 @@ public:
|
|||||||
QStringList enabledScriptResolvers() const;
|
QStringList enabledScriptResolvers() const;
|
||||||
void setEnabledScriptResolvers( const QStringList& resolvers );
|
void setEnabledScriptResolvers( const QStringList& resolvers );
|
||||||
|
|
||||||
|
// Default paths
|
||||||
QString scriptDefaultPath() const;
|
QString scriptDefaultPath() const;
|
||||||
void setScriptDefaultPath( const QString& path );
|
void setScriptDefaultPath( const QString& path );
|
||||||
|
QString playlistDefaultPath() const;
|
||||||
|
void setPlaylistDefaultPath( const QString& path );
|
||||||
|
|
||||||
// Now-Playing Settings
|
// Now-Playing Settings
|
||||||
// For now, just Adium. Soon, the world!
|
// For now, just Adium. Soon, the world!
|
||||||
|
@@ -258,7 +258,8 @@ SourceTreeView::deletePlaylist( const QModelIndex& idxIn )
|
|||||||
PlaylistItem* item = itemFromIndex< PlaylistItem >( idx );
|
PlaylistItem* item = itemFromIndex< PlaylistItem >( idx );
|
||||||
playlist_ptr playlist = item->playlist();
|
playlist_ptr playlist = item->playlist();
|
||||||
Playlist::remove( playlist );
|
Playlist::remove( playlist );
|
||||||
} else if( type == SourcesModel::AutomaticPlaylist || type == SourcesModel::Station )
|
}
|
||||||
|
else if( type == SourcesModel::AutomaticPlaylist || type == SourcesModel::Station )
|
||||||
{
|
{
|
||||||
DynamicPlaylistItem* item = itemFromIndex< DynamicPlaylistItem >( idx );
|
DynamicPlaylistItem* item = itemFromIndex< DynamicPlaylistItem >( idx );
|
||||||
dynplaylist_ptr playlist = item->dynPlaylist();
|
dynplaylist_ptr playlist = item->dynPlaylist();
|
||||||
@@ -280,13 +281,20 @@ SourceTreeView::copyPlaylistLink()
|
|||||||
DynamicPlaylistItem* item = itemFromIndex< DynamicPlaylistItem >( m_contextMenuIndex );
|
DynamicPlaylistItem* item = itemFromIndex< DynamicPlaylistItem >( m_contextMenuIndex );
|
||||||
dynplaylist_ptr playlist = item->dynPlaylist();
|
dynplaylist_ptr playlist = item->dynPlaylist();
|
||||||
GlobalActionManager::instance()->copyPlaylistToClipboard( playlist );
|
GlobalActionManager::instance()->copyPlaylistToClipboard( playlist );
|
||||||
} else if ( type == SourcesModel::StaticPlaylist )
|
}
|
||||||
|
else if ( type == SourcesModel::StaticPlaylist )
|
||||||
{
|
{
|
||||||
PlaylistItem* item = itemFromIndex< PlaylistItem >( m_contextMenuIndex );
|
PlaylistItem* item = itemFromIndex< PlaylistItem >( m_contextMenuIndex );
|
||||||
playlist_ptr playlist = item->playlist();
|
playlist_ptr playlist = item->playlist();
|
||||||
|
|
||||||
QString filename = QFileDialog::getSaveFileName( this, tr( "Save XSPF" ), QDir::homePath(), tr( "Playlists (*.xspf)" ) );
|
QString filename = QFileDialog::getSaveFileName( TomahawkUtils::tomahawkWindow(), tr( "Save XSPF" ),
|
||||||
GlobalActionManager::instance()->savePlaylistToFile( playlist, filename );
|
TomahawkSettings::instance()->playlistDefaultPath(), tr( "Playlists (*.xspf)" ) );
|
||||||
|
if ( !filename.isEmpty() )
|
||||||
|
{
|
||||||
|
QFileInfo playlistAbsoluteFilePath = filename;
|
||||||
|
TomahawkSettings::instance()->setPlaylistDefaultPath( playlistAbsoluteFilePath.absolutePath() );
|
||||||
|
GlobalActionManager::instance()->savePlaylistToFile( playlist, filename );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user