mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
* Remove creation of automatic playlists.
This commit is contained in:
@@ -51,7 +51,6 @@
|
|||||||
#include "widgets/AnimatedSplitter.h"
|
#include "widgets/AnimatedSplitter.h"
|
||||||
#include "widgets/NewPlaylistWidget.h"
|
#include "widgets/NewPlaylistWidget.h"
|
||||||
#include "widgets/SearchWidget.h"
|
#include "widgets/SearchWidget.h"
|
||||||
#include "widgets/PlaylistTypeSelectorDialog.h"
|
|
||||||
#include "widgets/ContainedMenuButton.h"
|
#include "widgets/ContainedMenuButton.h"
|
||||||
#include "thirdparty/Qocoa/qsearchfield.h"
|
#include "thirdparty/Qocoa/qsearchfield.h"
|
||||||
#include "playlist/dynamic/GeneratorInterface.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
|
void
|
||||||
TomahawkWindow::createStation()
|
TomahawkWindow::createStation()
|
||||||
{
|
{
|
||||||
@@ -1053,12 +1033,10 @@ TomahawkWindow::createStation()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
source_ptr author = SourceList::instance()->getLocal();
|
|
||||||
QString id = uuid();
|
|
||||||
QString info = ""; // FIXME
|
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->setMode( OnDemand );
|
||||||
playlist->createNewRevision( uuid(), playlist->currentrevision(), playlist->type(), playlist->generator()->controls() );
|
playlist->createNewRevision( uuid(), playlist->currentrevision(), playlist->type(), playlist->generator()->controls() );
|
||||||
|
|
||||||
@@ -1069,35 +1047,19 @@ TomahawkWindow::createStation()
|
|||||||
void
|
void
|
||||||
TomahawkWindow::createPlaylist()
|
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
|
if ( playlistName.isEmpty() || playlistName == title )
|
||||||
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() )
|
|
||||||
{
|
{
|
||||||
QList< playlist_ptr > pls = SourceList::instance()->getLocal()->dbCollection()->playlists();
|
QList< playlist_ptr > pls = SourceList::instance()->getLocal()->dbCollection()->playlists();
|
||||||
QStringList titles;
|
QStringList titles;
|
||||||
foreach ( const playlist_ptr& pl, pls )
|
foreach ( const playlist_ptr& pl, pls )
|
||||||
titles << pl->title();
|
titles << pl->title();
|
||||||
|
|
||||||
QString title = tr( "Playlist" );
|
|
||||||
playlistName = title;
|
playlistName = title;
|
||||||
int i = 2;
|
int i = 2;
|
||||||
while ( titles.contains( playlistName ) )
|
while ( titles.contains( playlistName ) )
|
||||||
@@ -1106,32 +1068,11 @@ TomahawkWindow::playlistCreateDialogFinished( int ret )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
playlist_ptr playlist = Tomahawk::Playlist::create( SourceList::instance()->getLocal(), uuid(), playlistName, "", "", false, QList< query_ptr>() );
|
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 );
|
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -92,7 +92,6 @@ protected:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void createAutomaticPlaylist( QString );
|
|
||||||
void createStation();
|
void createStation();
|
||||||
void createPlaylist();
|
void createPlaylist();
|
||||||
void loadSpiff();
|
void loadSpiff();
|
||||||
@@ -138,8 +137,6 @@ private slots:
|
|||||||
void maximize();
|
void maximize();
|
||||||
void toggleFullscreen();
|
void toggleFullscreen();
|
||||||
|
|
||||||
void playlistCreateDialogFinished( int ret );
|
|
||||||
|
|
||||||
void crashNow();
|
void crashNow();
|
||||||
|
|
||||||
void toggleMenuBar();
|
void toggleMenuBar();
|
||||||
|
Reference in New Issue
Block a user