mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-13 17:43:59 +02:00
Merge remote-tracking branch 'origin/stable'
This commit is contained in:
@@ -138,6 +138,7 @@ DatabaseCommand_AllTracks::exec( DatabaseImpl* dbi )
|
||||
QList<Tomahawk::result_ptr> results;
|
||||
results << result;
|
||||
qry->addResults( results );
|
||||
qry->setResolveFinished( true );
|
||||
|
||||
ql << qry;
|
||||
}
|
||||
|
@@ -229,6 +229,8 @@ Playlist::reportDeleted( const Tomahawk::playlist_ptr& self )
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
Q_ASSERT( self.data() == this );
|
||||
m_source->collection()->deletePlaylist( self );
|
||||
|
||||
emit deleted( self );
|
||||
}
|
||||
|
||||
|
||||
|
@@ -182,6 +182,9 @@ signals:
|
||||
/// renamed etc.
|
||||
void changed();
|
||||
|
||||
/// was deleted, eh?
|
||||
void deleted( const Tomahawk::playlist_ptr& pl );
|
||||
|
||||
void repeatModeChanged( PlaylistInterface::RepeatMode mode );
|
||||
void shuffleModeChanged( bool enabled );
|
||||
|
||||
|
@@ -265,6 +265,8 @@ DynamicPlaylist::reportDeleted( const Tomahawk::dynplaylist_ptr& self )
|
||||
Q_ASSERT( self.data() == this );
|
||||
// will emit Collection::playlistDeleted(...)
|
||||
author()->collection()->deleteDynamicPlaylist( self );
|
||||
|
||||
emit deleted( self );
|
||||
}
|
||||
|
||||
void DynamicPlaylist::addEntries(const QList< query_ptr >& queries, const QString& oldrev)
|
||||
|
@@ -113,6 +113,8 @@ signals:
|
||||
/// emitted when the playlist revision changes (whenever the playlist changes)
|
||||
void dynamicRevisionLoaded( Tomahawk::DynamicPlaylistRevision );
|
||||
|
||||
void deleted( const Tomahawk::dynplaylist_ptr& pl );
|
||||
|
||||
public slots:
|
||||
// want to update the playlist from the model?
|
||||
// generate a newrev using uuid() and call this:
|
||||
|
@@ -137,6 +137,7 @@ DynamicWidget::loadDynamicPlaylist( const Tomahawk::dynplaylist_ptr& playlist )
|
||||
disconnect( m_playlist->generator().data(), SIGNAL( generated( QList<Tomahawk::query_ptr> ) ), this, SLOT( tracksGenerated( QList<Tomahawk::query_ptr> ) ) );
|
||||
disconnect( m_playlist.data(), SIGNAL( dynamicRevisionLoaded( Tomahawk::DynamicPlaylistRevision) ), this, SLOT(onRevisionLoaded( Tomahawk::DynamicPlaylistRevision) ) );
|
||||
disconnect( m_playlist->generator().data(), SIGNAL( error( QString, QString ) ), this, SLOT( generatorError( QString, QString ) ) );
|
||||
disconnect( m_playlist.data(), SIGNAL( deleted( Tomahawk::dynplaylist_ptr ) ), this, SLOT( onDeleted() ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -163,6 +164,7 @@ DynamicWidget::loadDynamicPlaylist( const Tomahawk::dynplaylist_ptr& playlist )
|
||||
connect( m_playlist->generator().data(), SIGNAL( generated( QList<Tomahawk::query_ptr> ) ), this, SLOT( tracksGenerated( QList<Tomahawk::query_ptr> ) ) );
|
||||
connect( m_playlist.data(), SIGNAL( dynamicRevisionLoaded( Tomahawk::DynamicPlaylistRevision ) ), this, SLOT( onRevisionLoaded( Tomahawk::DynamicPlaylistRevision ) ) );
|
||||
connect( m_playlist->generator().data(), SIGNAL( error( QString, QString ) ), this, SLOT( generatorError( QString, QString ) ) );
|
||||
connect( m_playlist.data(), SIGNAL( deleted( Tomahawk::dynplaylist_ptr ) ), this, SLOT( onDeleted() ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -407,3 +409,10 @@ DynamicWidget::jumpToCurrentTrack()
|
||||
m_view->scrollTo( m_view->proxyModel()->currentItem(), QAbstractItemView::PositionAtCenter );
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
DynamicWidget::onDeleted()
|
||||
{
|
||||
emit destroyed( widget() );
|
||||
deleteLater();
|
||||
}
|
||||
|
@@ -96,6 +96,7 @@ public slots:
|
||||
|
||||
signals:
|
||||
void descriptionChanged( const QString& caption );
|
||||
void destroyed( QWidget* widget );
|
||||
|
||||
private slots:
|
||||
void generate( int = -1 );
|
||||
@@ -107,6 +108,7 @@ private slots:
|
||||
void showPreview();
|
||||
|
||||
void layoutFloatingWidgets();
|
||||
void onDeleted();
|
||||
|
||||
private:
|
||||
dynplaylist_ptr m_playlist;
|
||||
|
@@ -184,6 +184,8 @@ PlaylistManager::show( const Tomahawk::dynplaylist_ptr& playlist )
|
||||
{
|
||||
m_dynamicWidgets[ playlist ] = new Tomahawk::DynamicWidget( playlist, m_stack );
|
||||
|
||||
connect( playlist.data(), SIGNAL( deleted( Tomahawk::dynplaylist_ptr ) ), this, SLOT( onDynamicDeleted( Tomahawk::dynplaylist_ptr ) ) );
|
||||
|
||||
playlist->resolve();
|
||||
}
|
||||
|
||||
@@ -335,11 +337,6 @@ PlaylistManager::show( const Tomahawk::source_ptr& source )
|
||||
bool
|
||||
PlaylistManager::show( ViewPage* page )
|
||||
{
|
||||
if ( m_stack->indexOf( page->widget() ) < 0 )
|
||||
{
|
||||
connect( page->widget(), SIGNAL( destroyed( QWidget* ) ), SLOT( onWidgetDestroyed( QWidget* ) ) );
|
||||
}
|
||||
|
||||
setPage( page );
|
||||
|
||||
return true;
|
||||
@@ -490,6 +487,7 @@ PlaylistManager::showHistory( int historyPosition )
|
||||
|
||||
setHistoryPosition( historyPosition );
|
||||
ViewPage* page = m_pageHistory.at( historyPosition );
|
||||
qDebug() << "Showing page after a deleting:" << page->widget()->metaObject()->className();
|
||||
setPage( page, false );
|
||||
}
|
||||
|
||||
@@ -540,11 +538,11 @@ PlaylistManager::setPage( ViewPage* page, bool trackHistory )
|
||||
setHistoryPosition( m_pageHistory.count() - 1 );
|
||||
}
|
||||
|
||||
if ( playlistForInterface( currentPlaylistInterface() ) )
|
||||
if ( !playlistForInterface( currentPlaylistInterface() ).isNull() )
|
||||
emit playlistActivated( playlistForInterface( currentPlaylistInterface() ) );
|
||||
if ( dynamicPlaylistForInterface( currentPlaylistInterface() ) )
|
||||
if ( !dynamicPlaylistForInterface( currentPlaylistInterface() ).isNull() )
|
||||
emit dynamicPlaylistActivated( dynamicPlaylistForInterface( currentPlaylistInterface() ) );
|
||||
if ( collectionForInterface( currentPlaylistInterface() ) )
|
||||
if ( !collectionForInterface( currentPlaylistInterface() ).isNull() )
|
||||
emit collectionActivated( collectionForInterface( currentPlaylistInterface() ) );
|
||||
if ( isSuperCollectionVisible() )
|
||||
emit superCollectionActivated();
|
||||
@@ -555,9 +553,17 @@ PlaylistManager::setPage( ViewPage* page, bool trackHistory )
|
||||
AudioEngine::instance()->setPlaylist( currentPlaylistInterface() );
|
||||
|
||||
// UGH!
|
||||
if( QObject* obj = dynamic_cast< QObject* >( currentPage() ) ) {
|
||||
if( obj->metaObject()->indexOfSignal( "descriptionChanged(QString)" ) > -1 ) // if the signal exists (just to hide the qobject runtime warning...)
|
||||
connect( obj, SIGNAL( descriptionChanged( QString ) ), m_infobar, SLOT( setDescription( QString ) ) );
|
||||
if ( QObject* obj = dynamic_cast< QObject* >( currentPage() ) )
|
||||
{
|
||||
// if the signal exists (just to hide the qobject runtime warning...)
|
||||
if( obj->metaObject()->indexOfSignal( "descriptionChanged(QString)" ) > -1 )
|
||||
connect( obj, SIGNAL( descriptionChanged( QString ) ), m_infobar, SLOT( setDescription( QString ) ), Qt::UniqueConnection );
|
||||
}
|
||||
if ( QObject* obj = dynamic_cast< QObject* >( currentPage() ) )
|
||||
{
|
||||
// if the signal exists (just to hide the qobject runtime warning...)
|
||||
if( obj->metaObject()->indexOfSignal( "destroyed(QWidget*)" ) > -1 )
|
||||
connect( obj, SIGNAL( destroyed( QWidget* ) ), SLOT( onWidgetDestroyed( QWidget* ) ), Qt::UniqueConnection );
|
||||
}
|
||||
|
||||
m_stack->setCurrentWidget( page->widget() );
|
||||
@@ -641,14 +647,23 @@ PlaylistManager::updateView()
|
||||
void
|
||||
PlaylistManager::onWidgetDestroyed( QWidget* widget )
|
||||
{
|
||||
qDebug() << "Destroyed child:" << widget;
|
||||
qDebug() << "Destroyed child:" << widget << widget->metaObject()->className();
|
||||
|
||||
bool resetWidget = ( m_stack->currentWidget() == widget );
|
||||
m_stack->removeWidget( widget );
|
||||
|
||||
for ( int i = 0; i < m_pageHistory.count(); i++ )
|
||||
{
|
||||
ViewPage* page = m_pageHistory.at( i );
|
||||
|
||||
if ( !playlistForInterface( page->playlistInterface() ).isNull() )
|
||||
{
|
||||
m_playlistViews.remove( playlistForInterface( page->playlistInterface() ) );
|
||||
}
|
||||
if ( !dynamicPlaylistForInterface( page->playlistInterface() ).isNull() )
|
||||
{
|
||||
m_dynamicWidgets.remove( dynamicPlaylistForInterface( page->playlistInterface() ) );
|
||||
}
|
||||
|
||||
if ( page->widget() == widget )
|
||||
{
|
||||
m_pageHistory.removeAt( i );
|
||||
@@ -658,6 +673,8 @@ PlaylistManager::onWidgetDestroyed( QWidget* widget )
|
||||
}
|
||||
}
|
||||
|
||||
m_stack->removeWidget( widget );
|
||||
|
||||
if ( resetWidget )
|
||||
{
|
||||
if ( m_pageHistory.count() )
|
||||
@@ -764,6 +781,7 @@ PlaylistManager::playlistForInterface( PlaylistInterface* interface ) const
|
||||
{
|
||||
foreach ( PlaylistView* view, m_playlistViews.values() )
|
||||
{
|
||||
qDebug() << "LAAAA:" << view;
|
||||
if ( view->playlistInterface() == interface )
|
||||
{
|
||||
return m_playlistViews.key( view );
|
||||
|
@@ -135,6 +135,7 @@ public slots:
|
||||
private slots:
|
||||
void setFilter( const QString& filter );
|
||||
void applyFilter();
|
||||
|
||||
void onWidgetDestroyed( QWidget* widget );
|
||||
|
||||
private:
|
||||
|
@@ -71,7 +71,10 @@ void
|
||||
PlaylistModel::loadPlaylist( const Tomahawk::playlist_ptr& playlist, bool loadEntries )
|
||||
{
|
||||
if ( !m_playlist.isNull() )
|
||||
{
|
||||
disconnect( m_playlist.data(), SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ), this, SLOT( onRevisionLoaded( Tomahawk::PlaylistRevision ) ) );
|
||||
disconnect( m_playlist.data(), SIGNAL( deleted( Tomahawk::playlist_ptr ) ), this, SIGNAL( playlistDeleted() ) );
|
||||
}
|
||||
|
||||
if ( rowCount( QModelIndex() ) && loadEntries )
|
||||
{
|
||||
@@ -80,6 +83,7 @@ PlaylistModel::loadPlaylist( const Tomahawk::playlist_ptr& playlist, bool loadEn
|
||||
|
||||
m_playlist = playlist;
|
||||
connect( playlist.data(), SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ), SLOT( onRevisionLoaded( Tomahawk::PlaylistRevision ) ) );
|
||||
connect( playlist.data(), SIGNAL( deleted( Tomahawk::playlist_ptr ) ), this, SIGNAL( playlistDeleted() ) );
|
||||
|
||||
setReadOnly( !m_playlist->author()->isLocal() );
|
||||
setTitle( playlist->title() );
|
||||
@@ -106,7 +110,7 @@ PlaylistModel::loadPlaylist( const Tomahawk::playlist_ptr& playlist, bool loadEn
|
||||
|
||||
connect( plitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
||||
|
||||
if( !entry->query()->resolvingFinished() ) {
|
||||
if( !entry->query()->resolvingFinished() && entry->query()->playable() ) {
|
||||
m_waitingForResolved.append( entry->query().data() );
|
||||
connect( entry->query().data(), SIGNAL( resolvingFinished( bool ) ), this, SLOT( trackResolved( bool ) ) );
|
||||
}
|
||||
|
@@ -70,6 +70,9 @@ signals:
|
||||
void shuffleModeChanged( bool enabled );
|
||||
|
||||
void itemSizeChanged( const QModelIndex& index );
|
||||
|
||||
void playlistDeleted();
|
||||
|
||||
private slots:
|
||||
void onDataChanged();
|
||||
|
||||
@@ -80,6 +83,7 @@ private slots:
|
||||
void onTracksInserted( unsigned int row, const QList<Tomahawk::query_ptr>& tracks );
|
||||
|
||||
void trackResolved( bool );
|
||||
|
||||
private:
|
||||
QList<Tomahawk::plentry_ptr> playlistEntries() const;
|
||||
|
||||
|
@@ -58,6 +58,7 @@ PlaylistView::setModel( PlaylistModel* model )
|
||||
setGuid( "playlistview" );
|
||||
|
||||
connect( model, SIGNAL( trackCountChanged( unsigned int ) ), SLOT( onTrackCountChanged( unsigned int ) ) );
|
||||
connect( model, SIGNAL( playlistDeleted() ), SLOT( onDeleted() ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -154,3 +155,12 @@ PlaylistView::jumpToCurrentTrack()
|
||||
scrollTo( proxyModel()->currentItem(), QAbstractItemView::PositionAtCenter );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PlaylistView::onDeleted()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
emit destroyed( widget() );
|
||||
deleteLater();
|
||||
}
|
||||
|
@@ -50,6 +50,9 @@ public:
|
||||
|
||||
virtual bool jumpToCurrentTrack();
|
||||
|
||||
signals:
|
||||
void destroyed( QWidget* widget );
|
||||
|
||||
protected:
|
||||
void keyPressEvent( QKeyEvent* event );
|
||||
|
||||
@@ -60,6 +63,8 @@ private slots:
|
||||
void addItemsToPlaylist();
|
||||
void deleteItems();
|
||||
|
||||
void onDeleted();
|
||||
|
||||
private:
|
||||
void setupMenus();
|
||||
|
||||
|
@@ -45,7 +45,7 @@ TrackModel::TrackModel( QObject* parent )
|
||||
|
||||
TrackModel::~TrackModel()
|
||||
{
|
||||
delete m_rootItem;
|
||||
// delete m_rootItem;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -62,7 +62,6 @@ Query::Query( const QString& artist, const QString& track, const QString& album,
|
||||
void
|
||||
Query::addResults( const QList< Tomahawk::result_ptr >& newresults )
|
||||
{
|
||||
bool becameSolved = false;
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
m_results.append( newresults );
|
||||
|
@@ -74,6 +74,7 @@ public:
|
||||
void setTrack( const QString& track ) { m_track = track; }
|
||||
void setResultHint( const QString& resultHint ) { m_resultHint = resultHint; }
|
||||
void setDuration( int duration ) { m_duration = duration; }
|
||||
void setResolveFinished( bool resolved ) { m_resolveFinished = resolved; }
|
||||
|
||||
QVariant toVariant() const;
|
||||
QString toString() const;
|
||||
|
@@ -48,6 +48,12 @@ public:
|
||||
|
||||
virtual bool jumpToCurrentTrack() = 0;
|
||||
|
||||
/** subclasses implementing ViewPage can emit the following signals:
|
||||
* descriptionChanged( const QString& )
|
||||
* destroyed( QWidget* widget );
|
||||
*
|
||||
* See DynamicWidget for an example
|
||||
*/
|
||||
private:
|
||||
};
|
||||
|
||||
|
@@ -348,6 +348,8 @@ TomahawkApp::registerMetaTypes()
|
||||
qRegisterMetaType< Tomahawk::query_ptr >("Tomahawk::query_ptr");
|
||||
qRegisterMetaType< Tomahawk::source_ptr >("Tomahawk::source_ptr");
|
||||
qRegisterMetaType< Tomahawk::dyncontrol_ptr >("Tomahawk::dyncontrol_ptr");
|
||||
qRegisterMetaType< Tomahawk::playlist_ptr >("Tomahawk::playlist_ptr");
|
||||
qRegisterMetaType< Tomahawk::dynplaylist_ptr >("Tomahawk::dynplaylist_ptr");
|
||||
qRegisterMetaType< Tomahawk::geninterface_ptr >("Tomahawk::geninterface_ptr");
|
||||
qRegisterMetaType< QList<Tomahawk::playlist_ptr> >("QList<Tomahawk::playlist_ptr>");
|
||||
qRegisterMetaType< QList<Tomahawk::dynplaylist_ptr> >("QList<Tomahawk::dynplaylist_ptr>");
|
||||
|
Reference in New Issue
Block a user