mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-02-25 20:33:20 +01:00
* Remove creation of automatic playlists.
This commit is contained in:
parent
7d16b5181d
commit
c31f0ad9c7
@ -51,7 +51,6 @@
|
||||
#include "widgets/AnimatedSplitter.h"
|
||||
#include "widgets/NewPlaylistWidget.h"
|
||||
#include "widgets/SearchWidget.h"
|
||||
#include "widgets/PlaylistTypeSelectorDialog.h"
|
||||
#include "widgets/ContainedMenuButton.h"
|
||||
#include "thirdparty/Qocoa/qsearchfield.h"
|
||||
#include "playlist/dynamic/GeneratorInterface.h"
|
||||
@ -1010,25 +1009,6 @@ TomahawkWindow::onAudioEngineError( AudioEngine::AudioErrorCode /* error */ )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkWindow::createAutomaticPlaylist( QString playlistName )
|
||||
{
|
||||
if ( playlistName.isEmpty() )
|
||||
return;
|
||||
|
||||
source_ptr author = SourceList::instance()->getLocal();
|
||||
QString id = uuid();
|
||||
QString info = ""; // FIXME
|
||||
QString creator = "someone"; // FIXME
|
||||
|
||||
dynplaylist_ptr playlist = DynamicPlaylist::create( author, id, playlistName, info, creator, Static, false );
|
||||
playlist->setMode( Static );
|
||||
playlist->createNewRevision( uuid(), playlist->currentrevision(), playlist->type(), playlist->generator()->controls(), playlist->entries() );
|
||||
|
||||
ViewManager::instance()->show( playlist );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkWindow::createStation()
|
||||
{
|
||||
@ -1053,12 +1033,10 @@ TomahawkWindow::createStation()
|
||||
}
|
||||
}
|
||||
|
||||
source_ptr author = SourceList::instance()->getLocal();
|
||||
QString id = uuid();
|
||||
QString info = ""; // FIXME
|
||||
QString creator = "someone"; // FIXME
|
||||
QString creator = ""; // FIXME
|
||||
|
||||
dynplaylist_ptr playlist = DynamicPlaylist::create( author, id, playlistName, info, creator, OnDemand, false );
|
||||
dynplaylist_ptr playlist = DynamicPlaylist::create( SourceList::instance()->getLocal(), uuid(), playlistName, info, creator, OnDemand, false );
|
||||
playlist->setMode( OnDemand );
|
||||
playlist->createNewRevision( uuid(), playlist->currentrevision(), playlist->type(), playlist->generator()->controls() );
|
||||
|
||||
@ -1069,69 +1047,32 @@ TomahawkWindow::createStation()
|
||||
void
|
||||
TomahawkWindow::createPlaylist()
|
||||
{
|
||||
PlaylistTypeSelectorDlg* playlistSelectorDlg = new PlaylistTypeSelectorDlg( TomahawkApp::instance()->mainWindow(), Qt::Sheet );
|
||||
QString title = tr( "Playlist" );
|
||||
bool ok;
|
||||
QString playlistName = QInputDialog( this, Qt::Sheet ).getText( this, tr( "Create New Playlist" ), tr( "Name:" ), QLineEdit::Normal, title, &ok );
|
||||
if ( !ok )
|
||||
return;
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
playlistSelectorDlg->setModal( true );
|
||||
#endif
|
||||
|
||||
connect( playlistSelectorDlg, SIGNAL( finished( int ) ), SLOT( playlistCreateDialogFinished( int ) ) );
|
||||
playlistSelectorDlg->show();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkWindow::playlistCreateDialogFinished( int ret )
|
||||
{
|
||||
PlaylistTypeSelectorDlg* playlistSelectorDlg = qobject_cast< PlaylistTypeSelectorDlg* >( sender() );
|
||||
Q_ASSERT( playlistSelectorDlg );
|
||||
|
||||
QString playlistName = playlistSelectorDlg->playlistName();
|
||||
|
||||
if ( !playlistSelectorDlg->playlistTypeIsAuto() && ret )
|
||||
if ( playlistName.isEmpty() || playlistName == title )
|
||||
{
|
||||
if ( playlistName.isEmpty() )
|
||||
QList< playlist_ptr > pls = SourceList::instance()->getLocal()->dbCollection()->playlists();
|
||||
QStringList titles;
|
||||
foreach ( const playlist_ptr& pl, pls )
|
||||
titles << pl->title();
|
||||
|
||||
playlistName = title;
|
||||
int i = 2;
|
||||
while ( titles.contains( playlistName ) )
|
||||
{
|
||||
QList< playlist_ptr > pls = SourceList::instance()->getLocal()->dbCollection()->playlists();
|
||||
QStringList titles;
|
||||
foreach ( const playlist_ptr& pl, pls )
|
||||
titles << pl->title();
|
||||
|
||||
QString title = tr( "Playlist" );
|
||||
playlistName = title;
|
||||
int i = 2;
|
||||
while ( titles.contains( playlistName ) )
|
||||
{
|
||||
playlistName = QString( "%1 (%2)" ).arg( title ).arg( i++ );
|
||||
}
|
||||
playlistName = QString( "%1 (%2)" ).arg( title ).arg( i++ );
|
||||
}
|
||||
|
||||
playlist_ptr playlist = Tomahawk::Playlist::create( SourceList::instance()->getLocal(), uuid(), playlistName, "", "", false, QList< query_ptr>() );
|
||||
ViewManager::instance()->show( playlist );
|
||||
}
|
||||
else if ( playlistSelectorDlg->playlistTypeIsAuto() && ret )
|
||||
{
|
||||
// create Auto Playlist
|
||||
if ( playlistName.isEmpty() )
|
||||
{
|
||||
QList< dynplaylist_ptr > pls = SourceList::instance()->getLocal()->dbCollection()->autoPlaylists();
|
||||
QStringList titles;
|
||||
foreach ( const dynplaylist_ptr& pl, pls )
|
||||
titles << pl->title();
|
||||
|
||||
QString title = tr( "Automatic Playlist" );
|
||||
playlistName = title;
|
||||
int i = 2;
|
||||
while ( titles.contains( playlistName ) )
|
||||
{
|
||||
playlistName = QString( "%1 (%2)" ).arg( title ).arg( i++ );
|
||||
}
|
||||
}
|
||||
|
||||
createAutomaticPlaylist( playlistName );
|
||||
}
|
||||
|
||||
playlistSelectorDlg->deleteLater();
|
||||
QString info = ""; // FIXME
|
||||
QString creator = "someone"; // FIXME
|
||||
|
||||
playlist_ptr playlist = Tomahawk::Playlist::create( SourceList::instance()->getLocal(), uuid(), playlistName, info, creator, false, QList< query_ptr>() );
|
||||
ViewManager::instance()->show( playlist );
|
||||
}
|
||||
|
||||
|
||||
|
@ -92,7 +92,6 @@ protected:
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
void createAutomaticPlaylist( QString );
|
||||
void createStation();
|
||||
void createPlaylist();
|
||||
void loadSpiff();
|
||||
@ -138,8 +137,6 @@ private slots:
|
||||
void maximize();
|
||||
void toggleFullscreen();
|
||||
|
||||
void playlistCreateDialogFinished( int ret );
|
||||
|
||||
void crashNow();
|
||||
|
||||
void toggleMenuBar();
|
||||
|
Loading…
x
Reference in New Issue
Block a user