mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 16:44:05 +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_busy( false )
|
||||
{
|
||||
// qDebug() << Q_FUNC_INFO << "1";
|
||||
qDebug() << Q_FUNC_INFO << "1" << title;
|
||||
init();
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ Playlist::Playlist( const source_ptr& author,
|
||||
, m_initEntries( entries )
|
||||
, m_busy( false )
|
||||
{
|
||||
// qDebug() << Q_FUNC_INFO << "2";
|
||||
qDebug() << Q_FUNC_INFO << "2" << title;
|
||||
init();
|
||||
}
|
||||
|
||||
|
@@ -35,22 +35,24 @@ PlaylistTypeSelectorDlg::PlaylistTypeSelectorDlg( QWidget* parent, Qt::WindowFla
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
// ui->
|
||||
ui->horizontalLayout_2->setContentsMargins( 4, 4, 4, 4 );
|
||||
ui->verticalLayout->setContentsMargins( 4, 0, 4, 4 );
|
||||
|
||||
setSizeGripEnabled( false );
|
||||
resize( width(), 150 );
|
||||
setMinimumSize( size() );
|
||||
setMaximumSize( size() ); // to remove the resize grip on osx this is the only way
|
||||
#else
|
||||
ui->verticalLayout->setContentsMargins( 9, 0, 9, 9 );
|
||||
#endif
|
||||
|
||||
ui->line->setMaximumHeight( ui->label->height() );
|
||||
ui->line->setContentsMargins( 0, 0, 0, 0 );
|
||||
m_isAutoPlaylist = false;
|
||||
m_playlistName = "";
|
||||
|
||||
connect( ui->manualPlaylistButton, SIGNAL( clicked() ),
|
||||
this, SLOT( createNormalPlaylist() ));
|
||||
connect( ui->autoPlaylistButton, SIGNAL( clicked() ),
|
||||
this, SLOT( createAutomaticPlaylist() ));
|
||||
connect( ui->autoPlaylistNameLine, SIGNAL( textChanged( const QString& )),
|
||||
this, SLOT( enableAutoPlaylistButton( const QString& )));
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +74,6 @@ void
|
||||
PlaylistTypeSelectorDlg::createAutomaticPlaylist()
|
||||
{
|
||||
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
|
||||
}
|
||||
|
||||
@@ -80,7 +81,7 @@ PlaylistTypeSelectorDlg::createAutomaticPlaylist()
|
||||
QString
|
||||
PlaylistTypeSelectorDlg::playlistName() const
|
||||
{
|
||||
return m_playlistName;
|
||||
return ui->playlistNameLine->text();
|
||||
}
|
||||
|
||||
|
||||
@@ -89,11 +90,3 @@ PlaylistTypeSelectorDlg::playlistTypeIsAuto() const
|
||||
{
|
||||
return m_isAutoPlaylist;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PlaylistTypeSelectorDlg::enableAutoPlaylistButton( const QString &text )
|
||||
{
|
||||
ui->autoPlaylistButton->setEnabled( !text.isEmpty() );
|
||||
}
|
||||
|
||||
|
@@ -40,15 +40,13 @@ public:
|
||||
QString playlistName() const;
|
||||
|
||||
private slots:
|
||||
void createNormalPlaylist();
|
||||
void createAutomaticPlaylist();
|
||||
void enableAutoPlaylistButton( const QString& );
|
||||
void createNormalPlaylist();
|
||||
void createAutomaticPlaylist();
|
||||
|
||||
private:
|
||||
bool m_isAutoPlaylist; // if not an auto playlist then its a normal playlist
|
||||
|
||||
Ui::PlaylistTypeSelectorDlg *ui;
|
||||
QString m_playlistName;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>482</width>
|
||||
<height>169</height>
|
||||
<width>420</width>
|
||||
<height>100</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@@ -18,8 +18,8 @@
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>482</width>
|
||||
<height>145</height>
|
||||
<width>420</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
@@ -34,21 +34,15 @@
|
||||
<property name="modal">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="1,1,0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>221</width>
|
||||
<height>40</height>
|
||||
<width>190</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
@@ -63,42 +57,12 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</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>
|
||||
</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>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
@@ -118,57 +82,42 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
<property name="margin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</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>
|
||||
<widget class="QLineEdit" name="playlistNameLine">
|
||||
<property name="placeholderText">
|
||||
<string>New Playlist...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<widget class="QPushButton" name="manualPlaylistButton">
|
||||
<property name="text">
|
||||
<string>Create Manual Playlist</string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="autoPlaylistButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create Automatic Playlist</string>
|
||||
|
@@ -68,34 +68,44 @@ CategoryAddItem::activate()
|
||||
{
|
||||
case SourcesModel::PlaylistsCategory: {
|
||||
|
||||
PlaylistTypeSelectorDlg playlistSelectorDlg( TomahawkApp::instance()->mainWindow() );
|
||||
int successfulReturn = playlistSelectorDlg.exec();
|
||||
|
||||
if ( !playlistSelectorDlg.playlistTypeIsAuto() && successfulReturn ) {
|
||||
|
||||
// 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() );
|
||||
}
|
||||
PlaylistTypeSelectorDlg* playlistSelectorDlg = new PlaylistTypeSelectorDlg( TomahawkApp::instance()->mainWindow(), Qt::Sheet );
|
||||
#ifndef Q_OS_MAC
|
||||
playlistSelectorDlg->setModal( true );
|
||||
#endif
|
||||
connect( playlistSelectorDlg, SIGNAL( finished( int ) ), this, SLOT( dialogClosed( int ) ) );
|
||||
|
||||
playlistSelectorDlg->show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
case SourcesModel::StationsCategory:
|
||||
APP->mainWindow()->createStation();
|
||||
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
|
||||
CategoryAddItem::flags() const
|
||||
|
@@ -37,6 +37,7 @@ public:
|
||||
|
||||
private slots:
|
||||
void parsedDroppedTracks( const QList< Tomahawk::query_ptr >& tracks );
|
||||
void dialogClosed( int ret );
|
||||
|
||||
private:
|
||||
SourcesModel::CategoryType m_categoryType;
|
||||
|
@@ -524,26 +524,34 @@ TomahawkWindow::createStation()
|
||||
void
|
||||
TomahawkWindow::createPlaylist()
|
||||
{
|
||||
PlaylistTypeSelectorDlg playlistSelectorDlg;
|
||||
int successfulReturn = playlistSelectorDlg.exec();
|
||||
PlaylistTypeSelectorDlg* playlistSelectorDlg = new PlaylistTypeSelectorDlg( TomahawkApp::instance()->mainWindow(), Qt::Sheet );
|
||||
#ifndef Q_OS_MAC
|
||||
playlistSelectorDlg->setModal( true );
|
||||
#endif
|
||||
connect( playlistSelectorDlg, SIGNAL( finished( int ) ), this, SLOT( playlistCreateDialogFinished( int ) ) );
|
||||
|
||||
if ( !playlistSelectorDlg.playlistTypeIsAuto() && successfulReturn )
|
||||
{
|
||||
// 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 );
|
||||
}
|
||||
playlistSelectorDlg->show();
|
||||
}
|
||||
|
||||
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
|
||||
TomahawkWindow::audioStarted()
|
||||
|
@@ -98,6 +98,7 @@ private slots:
|
||||
void minimize();
|
||||
void maximize();
|
||||
|
||||
void playlistCreateDialogFinished( int ret );
|
||||
private:
|
||||
void loadSettings();
|
||||
void saveSettings();
|
||||
|
Reference in New Issue
Block a user