mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-12 00:54:20 +02:00
Remove New Playlist widget for now, until we refactor the playlist UIs.
Also update the new playlist type widget to take into account the changes. Make the dialog a sheet on osx.
This commit is contained in:
@@ -119,7 +119,7 @@ Playlist::Playlist( const source_ptr& src,
|
|||||||
, m_currentItem( 0 )
|
, m_currentItem( 0 )
|
||||||
, m_busy( false )
|
, m_busy( false )
|
||||||
{
|
{
|
||||||
// qDebug() << Q_FUNC_INFO << "1";
|
qDebug() << Q_FUNC_INFO << "1" << title;
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ Playlist::Playlist( const source_ptr& author,
|
|||||||
, m_initEntries( entries )
|
, m_initEntries( entries )
|
||||||
, m_busy( false )
|
, m_busy( false )
|
||||||
{
|
{
|
||||||
// qDebug() << Q_FUNC_INFO << "2";
|
qDebug() << Q_FUNC_INFO << "2" << title;
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -35,22 +35,24 @@ PlaylistTypeSelectorDlg::PlaylistTypeSelectorDlg( QWidget* parent, Qt::WindowFla
|
|||||||
|
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
// ui->
|
// ui->
|
||||||
ui->horizontalLayout_2->setContentsMargins( 4, 4, 4, 4 );
|
ui->verticalLayout->setContentsMargins( 4, 0, 4, 4 );
|
||||||
|
|
||||||
setSizeGripEnabled( false );
|
setSizeGripEnabled( false );
|
||||||
|
resize( width(), 150 );
|
||||||
setMinimumSize( size() );
|
setMinimumSize( size() );
|
||||||
setMaximumSize( size() ); // to remove the resize grip on osx this is the only way
|
setMaximumSize( size() ); // to remove the resize grip on osx this is the only way
|
||||||
|
#else
|
||||||
|
ui->verticalLayout->setContentsMargins( 9, 0, 9, 9 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
ui->line->setMaximumHeight( ui->label->height() );
|
||||||
|
ui->line->setContentsMargins( 0, 0, 0, 0 );
|
||||||
m_isAutoPlaylist = false;
|
m_isAutoPlaylist = false;
|
||||||
m_playlistName = "";
|
|
||||||
|
|
||||||
connect( ui->manualPlaylistButton, SIGNAL( clicked() ),
|
connect( ui->manualPlaylistButton, SIGNAL( clicked() ),
|
||||||
this, SLOT( createNormalPlaylist() ));
|
this, SLOT( createNormalPlaylist() ));
|
||||||
connect( ui->autoPlaylistButton, SIGNAL( clicked() ),
|
connect( ui->autoPlaylistButton, SIGNAL( clicked() ),
|
||||||
this, SLOT( createAutomaticPlaylist() ));
|
this, SLOT( createAutomaticPlaylist() ));
|
||||||
connect( ui->autoPlaylistNameLine, SIGNAL( textChanged( const QString& )),
|
|
||||||
this, SLOT( enableAutoPlaylistButton( const QString& )));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -72,7 +74,6 @@ void
|
|||||||
PlaylistTypeSelectorDlg::createAutomaticPlaylist()
|
PlaylistTypeSelectorDlg::createAutomaticPlaylist()
|
||||||
{
|
{
|
||||||
m_isAutoPlaylist = true;
|
m_isAutoPlaylist = true;
|
||||||
m_playlistName = ui->autoPlaylistNameLine->text();
|
|
||||||
done( QDialog::Accepted ); // return code is used to vaidate we did not exit out of the Dialog successfully
|
done( QDialog::Accepted ); // return code is used to vaidate we did not exit out of the Dialog successfully
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,7 +81,7 @@ PlaylistTypeSelectorDlg::createAutomaticPlaylist()
|
|||||||
QString
|
QString
|
||||||
PlaylistTypeSelectorDlg::playlistName() const
|
PlaylistTypeSelectorDlg::playlistName() const
|
||||||
{
|
{
|
||||||
return m_playlistName;
|
return ui->playlistNameLine->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -89,11 +90,3 @@ PlaylistTypeSelectorDlg::playlistTypeIsAuto() const
|
|||||||
{
|
{
|
||||||
return m_isAutoPlaylist;
|
return m_isAutoPlaylist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
PlaylistTypeSelectorDlg::enableAutoPlaylistButton( const QString &text )
|
|
||||||
{
|
|
||||||
ui->autoPlaylistButton->setEnabled( !text.isEmpty() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@@ -40,15 +40,13 @@ public:
|
|||||||
QString playlistName() const;
|
QString playlistName() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void createNormalPlaylist();
|
void createNormalPlaylist();
|
||||||
void createAutomaticPlaylist();
|
void createAutomaticPlaylist();
|
||||||
void enableAutoPlaylistButton( const QString& );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_isAutoPlaylist; // if not an auto playlist then its a normal playlist
|
bool m_isAutoPlaylist; // if not an auto playlist then its a normal playlist
|
||||||
|
|
||||||
Ui::PlaylistTypeSelectorDlg *ui;
|
Ui::PlaylistTypeSelectorDlg *ui;
|
||||||
QString m_playlistName;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>482</width>
|
<width>420</width>
|
||||||
<height>169</height>
|
<height>100</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@@ -18,8 +18,8 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>482</width>
|
<width>420</width>
|
||||||
<height>145</height>
|
<height>100</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
@@ -34,21 +34,15 @@
|
|||||||
<property name="modal">
|
<property name="modal">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="1,1,0">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>2</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>221</width>
|
<width>190</width>
|
||||||
<height>40</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -63,42 +57,12 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<widget class="Line" name="line">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>28</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="manualPlaylistButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Create Manual Playlist</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="Line" name="line">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@@ -118,57 +82,42 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_4">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="orientation">
|
<property name="text">
|
||||||
<enum>Qt::Vertical</enum>
|
<string>Name:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="margin">
|
||||||
<size>
|
<number>1</number>
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<widget class="QLineEdit" name="playlistNameLine">
|
||||||
<item>
|
<property name="placeholderText">
|
||||||
<widget class="QLabel" name="label_3">
|
<string>New Playlist...</string>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>Name:</string>
|
</widget>
|
||||||
</property>
|
|
||||||
<property name="margin">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="autoPlaylistNameLine">
|
|
||||||
<property name="placeholderText">
|
|
||||||
<string>New Playlist...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_3">
|
<widget class="QPushButton" name="manualPlaylistButton">
|
||||||
<property name="orientation">
|
<property name="text">
|
||||||
<enum>Qt::Vertical</enum>
|
<string>Create Manual Playlist</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
</widget>
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="autoPlaylistButton">
|
<widget class="QPushButton" name="autoPlaylistButton">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Create Automatic Playlist</string>
|
<string>Create Automatic Playlist</string>
|
||||||
|
@@ -68,34 +68,44 @@ CategoryAddItem::activate()
|
|||||||
{
|
{
|
||||||
case SourcesModel::PlaylistsCategory: {
|
case SourcesModel::PlaylistsCategory: {
|
||||||
|
|
||||||
PlaylistTypeSelectorDlg playlistSelectorDlg( TomahawkApp::instance()->mainWindow() );
|
PlaylistTypeSelectorDlg* playlistSelectorDlg = new PlaylistTypeSelectorDlg( TomahawkApp::instance()->mainWindow(), Qt::Sheet );
|
||||||
int successfulReturn = playlistSelectorDlg.exec();
|
#ifndef Q_OS_MAC
|
||||||
|
playlistSelectorDlg->setModal( true );
|
||||||
if ( !playlistSelectorDlg.playlistTypeIsAuto() && successfulReturn ) {
|
#endif
|
||||||
|
connect( playlistSelectorDlg, SIGNAL( finished( int ) ), this, SLOT( dialogClosed( int ) ) );
|
||||||
// only show if none is shown yet
|
|
||||||
if( !ViewManager::instance()->isNewPlaylistPageVisible() ) {
|
|
||||||
//fix this namespace resolution problem, was not there before
|
|
||||||
Tomahawk::ViewPage* p = ViewManager::instance()->show( new NewPlaylistWidget() );
|
|
||||||
model()->linkSourceItemToPage( this, p );
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if ( playlistSelectorDlg.playlistTypeIsAuto() && successfulReturn ) {
|
|
||||||
// create Auto Playlist
|
|
||||||
QString playlistName = playlistSelectorDlg.playlistName();
|
|
||||||
APP->mainWindow()->createAutomaticPlaylist( playlistName );
|
|
||||||
} else if ( !successfulReturn ) {
|
|
||||||
model()->viewPageActivated( ViewManager::instance()->currentPage() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
playlistSelectorDlg->show();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SourcesModel::StationsCategory:
|
case SourcesModel::StationsCategory:
|
||||||
APP->mainWindow()->createStation();
|
APP->mainWindow()->createStation();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CategoryAddItem::dialogClosed( int ret )
|
||||||
|
{
|
||||||
|
PlaylistTypeSelectorDlg* playlistSelectorDlg = qobject_cast< PlaylistTypeSelectorDlg* >( sender() );
|
||||||
|
Q_ASSERT( playlistSelectorDlg );
|
||||||
|
|
||||||
|
QString playlistName = playlistSelectorDlg->playlistName();
|
||||||
|
if ( playlistName.isEmpty() )
|
||||||
|
playlistName = tr( "New Playlist" );
|
||||||
|
|
||||||
|
if ( !playlistSelectorDlg->playlistTypeIsAuto() && ret ) {
|
||||||
|
|
||||||
|
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
|
||||||
|
APP->mainWindow()->createAutomaticPlaylist( playlistName );
|
||||||
|
} else if ( !ret ) {
|
||||||
|
model()->viewPageActivated( ViewManager::instance()->currentPage() );
|
||||||
|
}
|
||||||
|
playlistSelectorDlg->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
Qt::ItemFlags
|
Qt::ItemFlags
|
||||||
CategoryAddItem::flags() const
|
CategoryAddItem::flags() const
|
||||||
|
@@ -37,6 +37,7 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void parsedDroppedTracks( const QList< Tomahawk::query_ptr >& tracks );
|
void parsedDroppedTracks( const QList< Tomahawk::query_ptr >& tracks );
|
||||||
|
void dialogClosed( int ret );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SourcesModel::CategoryType m_categoryType;
|
SourcesModel::CategoryType m_categoryType;
|
||||||
|
@@ -524,26 +524,34 @@ TomahawkWindow::createStation()
|
|||||||
void
|
void
|
||||||
TomahawkWindow::createPlaylist()
|
TomahawkWindow::createPlaylist()
|
||||||
{
|
{
|
||||||
PlaylistTypeSelectorDlg playlistSelectorDlg;
|
PlaylistTypeSelectorDlg* playlistSelectorDlg = new PlaylistTypeSelectorDlg( TomahawkApp::instance()->mainWindow(), Qt::Sheet );
|
||||||
int successfulReturn = playlistSelectorDlg.exec();
|
#ifndef Q_OS_MAC
|
||||||
|
playlistSelectorDlg->setModal( true );
|
||||||
|
#endif
|
||||||
|
connect( playlistSelectorDlg, SIGNAL( finished( int ) ), this, SLOT( playlistCreateDialogFinished( int ) ) );
|
||||||
|
|
||||||
if ( !playlistSelectorDlg.playlistTypeIsAuto() && successfulReturn )
|
playlistSelectorDlg->show();
|
||||||
{
|
|
||||||
// only show if none is shown yet
|
|
||||||
if ( !ViewManager::instance()->isNewPlaylistPageVisible() )
|
|
||||||
{
|
|
||||||
ViewManager::instance()->show( new NewPlaylistWidget() );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else if ( playlistSelectorDlg.playlistTypeIsAuto() && successfulReturn )
|
|
||||||
{
|
|
||||||
// create Auto Playlist
|
|
||||||
QString playlistName = playlistSelectorDlg.playlistName();
|
|
||||||
APP->mainWindow()->createAutomaticPlaylist( playlistName );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TomahawkWindow::playlistCreateDialogFinished( int ret )
|
||||||
|
{
|
||||||
|
PlaylistTypeSelectorDlg* playlistSelectorDlg = qobject_cast< PlaylistTypeSelectorDlg* >( sender() );
|
||||||
|
Q_ASSERT( playlistSelectorDlg );
|
||||||
|
|
||||||
|
QString playlistName = playlistSelectorDlg->playlistName();
|
||||||
|
if ( playlistName.isEmpty() )
|
||||||
|
playlistName = tr( "New Playlist" );
|
||||||
|
|
||||||
|
if ( !playlistSelectorDlg->playlistTypeIsAuto() && ret ) {
|
||||||
|
|
||||||
|
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
|
||||||
|
createAutomaticPlaylist( playlistName );
|
||||||
|
}
|
||||||
|
playlistSelectorDlg->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TomahawkWindow::audioStarted()
|
TomahawkWindow::audioStarted()
|
||||||
|
@@ -98,6 +98,7 @@ private slots:
|
|||||||
void minimize();
|
void minimize();
|
||||||
void maximize();
|
void maximize();
|
||||||
|
|
||||||
|
void playlistCreateDialogFinished( int ret );
|
||||||
private:
|
private:
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
|
Reference in New Issue
Block a user