1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-14 04:51:53 +02:00

Show search and artist pages as temporary pages in sidebar

Remove margins and spacing from searchwidget
Remove "Cancel" button as no other view pages have cancel buttons, and we can't delete a page if we show it as a temporary page anymore
This commit is contained in:
Leo Franchi 2011-08-05 14:36:52 -04:00
parent c7c12eef93
commit f151b59431
4 changed files with 10 additions and 19 deletions

View File

@ -73,6 +73,7 @@ public:
virtual QString longDescription() const { return m_longDescription; }
virtual QPixmap pixmap() const { if ( m_pixmap.isNull() ) return Tomahawk::ViewPage::pixmap(); else return m_pixmap; }
virtual bool isTemporaryPage() const { return true; }
virtual bool showStatsBar() const { return false; }
virtual bool jumpToCurrentTrack() { return false; }

View File

@ -43,14 +43,17 @@ SearchWidget::SearchWidget( const QString& search, QWidget* parent )
ui->resultsView->overlay()->setEnabled( false );
ui->resultsView->sortByColumn( PlaylistModel::Score, Qt::DescendingOrder );
TomahawkUtils::unmarginLayout( ui->verticalLayout );
ui->resultsView->setContentsMargins( 0, 0, 0, 0 );
ui->resultsView->setFrameShape( QFrame::NoFrame );
ui->resultsView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
m_queries << Tomahawk::Query::get( search, uuid() );
foreach ( const Tomahawk::query_ptr& query, m_queries )
{
connect( query.data(), SIGNAL( resultsAdded( QList<Tomahawk::result_ptr> ) ), SLOT( onResultsFound( QList<Tomahawk::result_ptr> ) ) );
}
connect( ui->buttonBox, SIGNAL( rejected() ), SLOT( cancel() ) );
}
@ -94,11 +97,3 @@ SearchWidget::onResultsFound( const QList<Tomahawk::result_ptr>& results )
m_resultsModel->append( q );
}
}
void
SearchWidget::cancel()
{
emit destroyed( this );
deleteLater();
}

View File

@ -46,6 +46,7 @@ public:
virtual QWidget* widget() { return this; }
virtual Tomahawk::PlaylistInterface* playlistInterface() const { return 0; }
virtual bool isTemporaryPage() const { return true; }
virtual QString title() const { return tr( "Search" ); }
virtual QString description() const { return tr( "Results for '%1'" ).arg( m_search ); }
@ -63,8 +64,6 @@ signals:
private slots:
void onResultsFound( const QList<Tomahawk::result_ptr>& results );
void cancel();
private:
Ui::SearchWidget *ui;

View File

@ -14,16 +14,12 @@
<enum>Qt::TabFocus</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="PlaylistView" name="resultsView"/>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>