mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 06:07:37 +02:00
* Fixed TWK-461: Always pre-sort searches by score column.
This commit is contained in:
@@ -62,8 +62,10 @@ PlaylistView::setPlaylistModel( PlaylistModel* model )
|
|||||||
TrackView::setTrackModel( m_model );
|
TrackView::setTrackModel( m_model );
|
||||||
setColumnHidden( TrackModel::Age, true ); // Hide age column per default
|
setColumnHidden( TrackModel::Age, true ); // Hide age column per default
|
||||||
|
|
||||||
if ( !m_model->playlist().isNull() )
|
if ( guid().isEmpty() && !m_model->playlist().isNull() )
|
||||||
|
{
|
||||||
setGuid( QString( "playlistview/%1/%2" ).arg( m_model->columnCount() ).arg( m_model->playlist()->guid() ) );
|
setGuid( QString( "playlistview/%1/%2" ).arg( m_model->columnCount() ).arg( m_model->playlist()->guid() ) );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setGuid( QString( "playlistview/%1" ).arg( m_model->columnCount() ) );
|
setGuid( QString( "playlistview/%1" ).arg( m_model->columnCount() ) );
|
||||||
|
@@ -71,11 +71,11 @@ TrackHeader::visibleSectionCount() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
bool
|
||||||
TrackHeader::checkState()
|
TrackHeader::checkState()
|
||||||
{
|
{
|
||||||
if ( !count() || m_init )
|
if ( !count() || m_init )
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
QByteArray state = TomahawkSettings::instance()->playlistColumnSizes( m_parent->guid() );
|
QByteArray state = TomahawkSettings::instance()->playlistColumnSizes( m_parent->guid() );
|
||||||
if ( !state.isEmpty() )
|
if ( !state.isEmpty() )
|
||||||
@@ -102,6 +102,7 @@ TrackHeader::checkState()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_init = true;
|
m_init = true;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
@@ -40,7 +40,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void toggleVisibility( int index );
|
void toggleVisibility( int index );
|
||||||
void checkState();
|
bool checkState();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void contextMenuEvent( QContextMenuEvent* e );
|
void contextMenuEvent( QContextMenuEvent* e );
|
||||||
|
@@ -62,8 +62,7 @@ TrackView::TrackView( QWidget* parent )
|
|||||||
setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
|
setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
|
||||||
setRootIsDecorated( false );
|
setRootIsDecorated( false );
|
||||||
setUniformRowHeights( true );
|
setUniformRowHeights( true );
|
||||||
setMinimumWidth( 300 );
|
setMinimumWidth( 200 );
|
||||||
// setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
|
|
||||||
|
|
||||||
setHeader( m_header );
|
setHeader( m_header );
|
||||||
setSortingEnabled( true );
|
setSortingEnabled( true );
|
||||||
@@ -204,7 +203,15 @@ void
|
|||||||
TrackView::resizeEvent( QResizeEvent* event )
|
TrackView::resizeEvent( QResizeEvent* event )
|
||||||
{
|
{
|
||||||
QTreeView::resizeEvent( event );
|
QTreeView::resizeEvent( event );
|
||||||
m_header->checkState();
|
|
||||||
|
int sortSection = m_header->sortIndicatorSection();
|
||||||
|
Qt::SortOrder sortOrder = m_header->sortIndicatorOrder();
|
||||||
|
|
||||||
|
if ( m_header->checkState() && sortSection >= 0 )
|
||||||
|
{
|
||||||
|
// restoreState keeps overwriting our previous sort-order
|
||||||
|
sortByColumn( sortSection, sortOrder );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -39,6 +39,7 @@ SearchWidget::SearchWidget( const QString& search, QWidget* parent )
|
|||||||
{
|
{
|
||||||
ui->setupUi( this );
|
ui->setupUi( this );
|
||||||
|
|
||||||
|
ui->resultsView->setGuid( "searchwidget" );
|
||||||
m_resultsModel = new PlaylistModel( ui->resultsView );
|
m_resultsModel = new PlaylistModel( ui->resultsView );
|
||||||
ui->resultsView->setPlaylistModel( m_resultsModel );
|
ui->resultsView->setPlaylistModel( m_resultsModel );
|
||||||
ui->resultsView->overlay()->setEnabled( false );
|
ui->resultsView->overlay()->setEnabled( false );
|
||||||
@@ -96,7 +97,6 @@ SearchWidget::onResultsFound( const QList<Tomahawk::result_ptr>& results )
|
|||||||
Tomahawk::query_ptr q = result->toQuery();
|
Tomahawk::query_ptr q = result->toQuery();
|
||||||
q->setResolveFinished( true );
|
q->setResolveFinished( true );
|
||||||
q->addResults( rl );
|
q->addResults( rl );
|
||||||
qDebug() << result->toString();
|
|
||||||
|
|
||||||
m_resultsModel->append( q );
|
m_resultsModel->append( q );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user