mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 16:44:05 +02:00
Let there be Automatic Playlists and Stations!
This commit is contained in:
@@ -43,7 +43,6 @@ DynamicWidget::DynamicWidget( const Tomahawk::dynplaylist_ptr& playlist, QWidget
|
||||
, m_songsSinceLastResolved( 0 )
|
||||
, m_headerText( 0 )
|
||||
, m_headerLayout( 0 )
|
||||
, m_modeCombo( 0 )
|
||||
, m_generatorCombo( 0 )
|
||||
, m_logo( 0 )
|
||||
, m_generateButton( 0 )
|
||||
@@ -55,12 +54,6 @@ DynamicWidget::DynamicWidget( const Tomahawk::dynplaylist_ptr& playlist, QWidget
|
||||
m_headerLayout = new QHBoxLayout;
|
||||
m_headerText = new QLabel( tr( "Type:" ), this );
|
||||
m_headerLayout->addWidget( m_headerText );
|
||||
QComboBox* mode = new QComboBox( this );
|
||||
mode->addItem( tr( "On Demand" ), OnDemand );
|
||||
mode->addItem( tr( "Static" ), Static );
|
||||
connect( mode, SIGNAL( activated( int ) ), this, SLOT( modeChanged( int ) ) );
|
||||
m_modeCombo = new ReadOrWriteWidget( mode, playlist->author()->isLocal(), this );
|
||||
m_headerLayout->addWidget( m_modeCombo );
|
||||
|
||||
QComboBox* gen = new QComboBox( this );
|
||||
foreach( const QString& type, GeneratorFactory::types() )
|
||||
@@ -134,12 +127,9 @@ void DynamicWidget::loadDynamicPlaylist(const Tomahawk::dynplaylist_ptr& playlis
|
||||
|
||||
if( !m_playlist.isNull() )
|
||||
m_controls->setControls( m_playlist->generator(), m_playlist->generator()->controls(), m_playlist->author()->isLocal() );
|
||||
qobject_cast<QComboBox*>( m_modeCombo->writableWidget() )->setCurrentIndex( static_cast<int>( playlist->mode() ) );
|
||||
|
||||
m_generatorCombo->setWritable( playlist->author()->isLocal() );
|
||||
m_generatorCombo->setLabel( qobject_cast< QComboBox* >( m_generatorCombo->writableWidget() )->currentText() );
|
||||
m_modeCombo->setWritable( playlist->author()->isLocal() );
|
||||
m_modeCombo->setLabel( qobject_cast< QComboBox* >( m_modeCombo->writableWidget() )->currentText() );
|
||||
|
||||
applyModeChange( m_playlist->mode() );
|
||||
connect( m_playlist->generator().data(), SIGNAL( generated( QList<Tomahawk::query_ptr> ) ), this, SLOT( tracksGenerated( QList<Tomahawk::query_ptr> ) ) );
|
||||
@@ -189,16 +179,6 @@ DynamicWidget::generateOrStart()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DynamicWidget::modeChanged( int mode )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
m_playlist->setMode( mode );
|
||||
applyModeChange( mode );
|
||||
controlsChanged();
|
||||
}
|
||||
|
||||
void
|
||||
DynamicWidget::applyModeChange( int mode )
|
||||
{
|
||||
|
@@ -59,7 +59,6 @@ public slots:
|
||||
|
||||
private slots:
|
||||
void generateOrStart();
|
||||
void modeChanged(int);
|
||||
void tracksGenerated( const QList< Tomahawk::query_ptr>& queries );
|
||||
|
||||
// used by on demand mode
|
||||
@@ -86,7 +85,6 @@ private:
|
||||
|
||||
QLabel* m_headerText;
|
||||
QHBoxLayout* m_headerLayout;
|
||||
ReadOrWriteWidget* m_modeCombo;
|
||||
ReadOrWriteWidget* m_generatorCombo;
|
||||
QLabel* m_logo;
|
||||
QPushButton* m_generateButton;
|
||||
|
@@ -166,7 +166,8 @@ TomahawkWindow::setupSignals()
|
||||
connect( ui->actionRescanCollection, SIGNAL( triggered() ), SLOT( rescanCollectionManually() ) );
|
||||
connect( ui->actionLoadXSPF, SIGNAL( triggered() ), SLOT( loadSpiff() ));
|
||||
connect( ui->actionCreatePlaylist, SIGNAL( triggered() ), SLOT( createPlaylist() ));
|
||||
connect( ui->actionCreateDynamicPlaylist, SIGNAL( triggered() ), SLOT( createDynamicPlaylist() ));
|
||||
connect( ui->actionCreateAutomaticPlaylist, SIGNAL( triggered() ), SLOT( createAutomaticPlaylist() ));
|
||||
connect( ui->actionCreate_New_Station, SIGNAL( triggered() ), SLOT( createStation() ));
|
||||
connect( ui->actionAboutTomahawk, SIGNAL( triggered() ), SLOT( showAboutTomahawk() ) );
|
||||
connect( ui->actionExit, SIGNAL( triggered() ), APP, SLOT( quit() ) );
|
||||
connect( ui->statusButton, SIGNAL( clicked() ), APP->sipHandler(), SLOT( toggleConnect() ) );
|
||||
@@ -315,37 +316,43 @@ TomahawkWindow::loadSpiff()
|
||||
}
|
||||
|
||||
void
|
||||
TomahawkWindow::createDynamicPlaylist()
|
||||
TomahawkWindow::createAutomaticPlaylist()
|
||||
{
|
||||
createPlaylist( true );
|
||||
bool ok;
|
||||
QString name = QInputDialog::getText( this, "Create New Automatic Playlist", "Name:", QLineEdit::Normal, "New Automatic Playlist", &ok );
|
||||
if ( !ok || name.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, name, info, creator, false );
|
||||
playlist->setMode( Static );
|
||||
playlist->createNewRevision( uuid(), playlist->currentrevision(), playlist->type(), playlist->generator()->controls(), playlist->entries() );
|
||||
}
|
||||
|
||||
void TomahawkWindow::createStation()
|
||||
{
|
||||
bool ok;
|
||||
QString name = QInputDialog::getText( this, "Create New Station", "Name:", QLineEdit::Normal, "New Station", &ok );
|
||||
if ( !ok || name.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, name, info, creator, false );
|
||||
playlist->setMode( OnDemand );
|
||||
playlist->createNewRevision( uuid(), playlist->currentrevision(), playlist->type(), playlist->generator()->controls(), playlist->entries() );
|
||||
}
|
||||
|
||||
void
|
||||
TomahawkWindow::createPlaylist( bool dynamic )
|
||||
TomahawkWindow::createPlaylist()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
if( dynamic )
|
||||
{
|
||||
bool ok;
|
||||
QString name = QInputDialog::getText( this, "Create New Playlist", "Name:", QLineEdit::Normal, "New Playlist", &ok );
|
||||
if ( !ok || name.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, name, info, creator, false );
|
||||
if( playlist->mode() == OnDemand )
|
||||
playlist->createNewRevision( uuid(), playlist->currentrevision(), playlist->type(), playlist->generator()->controls() );
|
||||
else
|
||||
playlist->createNewRevision( uuid(), playlist->currentrevision(), playlist->type(), playlist->generator()->controls(), playlist->entries() );
|
||||
} else
|
||||
{
|
||||
PlaylistManager::instance()->show( new NewPlaylistWidget() );
|
||||
}
|
||||
PlaylistManager::instance()->show( new NewPlaylistWidget() );
|
||||
|
||||
/* bool ok;
|
||||
QString name = QInputDialog::getText( this, "Create New Playlist", "Name:", QLineEdit::Normal, "New Playlist", &ok );
|
||||
|
@@ -41,8 +41,9 @@ protected:
|
||||
void closeEvent( QCloseEvent* e );
|
||||
|
||||
public slots:
|
||||
void createDynamicPlaylist();
|
||||
void createPlaylist( bool dynamic = false );
|
||||
void createAutomaticPlaylist();
|
||||
void createStation();
|
||||
void createPlaylist();
|
||||
void loadSpiff();
|
||||
void showSettingsDialog();
|
||||
|
||||
|
@@ -84,7 +84,8 @@
|
||||
<string>&Playlist</string>
|
||||
</property>
|
||||
<addaction name="actionCreatePlaylist"/>
|
||||
<addaction name="actionCreateDynamicPlaylist"/>
|
||||
<addaction name="actionCreateAutomaticPlaylist"/>
|
||||
<addaction name="actionCreate_New_Station"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionLoadXSPF"/>
|
||||
</widget>
|
||||
@@ -160,9 +161,14 @@
|
||||
<enum>QAction::AboutRole</enum>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCreateDynamicPlaylist">
|
||||
<action name="actionCreateAutomaticPlaylist">
|
||||
<property name="text">
|
||||
<string>Create New &Dynamic Playlist</string>
|
||||
<string>Create New &Automatic Playlist</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCreate_New_Station">
|
||||
<property name="text">
|
||||
<string>Create New &Station</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
|
Reference in New Issue
Block a user