mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-20 15:59:42 +01:00
* Fixed TWK-461: Always pre-sort searches by score column.
This commit is contained in:
parent
67acb25da0
commit
c4fbb6e0a7
@ -62,8 +62,10 @@ PlaylistView::setPlaylistModel( PlaylistModel* model )
|
||||
TrackView::setTrackModel( m_model );
|
||||
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() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
setGuid( QString( "playlistview/%1" ).arg( m_model->columnCount() ) );
|
||||
|
@ -71,11 +71,11 @@ TrackHeader::visibleSectionCount() const
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
bool
|
||||
TrackHeader::checkState()
|
||||
{
|
||||
if ( !count() || m_init )
|
||||
return;
|
||||
return false;
|
||||
|
||||
QByteArray state = TomahawkSettings::instance()->playlistColumnSizes( m_parent->guid() );
|
||||
if ( !state.isEmpty() )
|
||||
@ -102,6 +102,7 @@ TrackHeader::checkState()
|
||||
}
|
||||
|
||||
m_init = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
@ -40,7 +40,7 @@ public:
|
||||
|
||||
public slots:
|
||||
void toggleVisibility( int index );
|
||||
void checkState();
|
||||
bool checkState();
|
||||
|
||||
protected:
|
||||
void contextMenuEvent( QContextMenuEvent* e );
|
||||
|
@ -62,8 +62,7 @@ TrackView::TrackView( QWidget* parent )
|
||||
setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
|
||||
setRootIsDecorated( false );
|
||||
setUniformRowHeights( true );
|
||||
setMinimumWidth( 300 );
|
||||
// setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
|
||||
setMinimumWidth( 200 );
|
||||
|
||||
setHeader( m_header );
|
||||
setSortingEnabled( true );
|
||||
@ -204,7 +203,15 @@ void
|
||||
TrackView::resizeEvent( QResizeEvent* 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->resultsView->setGuid( "searchwidget" );
|
||||
m_resultsModel = new PlaylistModel( ui->resultsView );
|
||||
ui->resultsView->setPlaylistModel( m_resultsModel );
|
||||
ui->resultsView->overlay()->setEnabled( false );
|
||||
@ -96,7 +97,6 @@ SearchWidget::onResultsFound( const QList<Tomahawk::result_ptr>& results )
|
||||
Tomahawk::query_ptr q = result->toQuery();
|
||||
q->setResolveFinished( true );
|
||||
q->addResults( rl );
|
||||
qDebug() << result->toString();
|
||||
|
||||
m_resultsModel->append( q );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user