mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 11:20:22 +02:00
* New layout for search page.
This commit is contained in:
@@ -20,52 +20,139 @@
|
|||||||
#include "SearchWidget.h"
|
#include "SearchWidget.h"
|
||||||
#include "ui_SearchWidget.h"
|
#include "ui_SearchWidget.h"
|
||||||
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QDialogButtonBox>
|
|
||||||
|
|
||||||
#include "SourceList.h"
|
#include "SourceList.h"
|
||||||
#include "ViewManager.h"
|
#include "ViewManager.h"
|
||||||
#include "playlist/PlayableModel.h"
|
#include "playlist/PlayableModel.h"
|
||||||
#include "playlist/PlaylistModel.h"
|
#include "playlist/PlaylistModel.h"
|
||||||
#include "utils/AnimatedSpinner.h"
|
#include "utils/AnimatedSpinner.h"
|
||||||
|
#include "utils/TomahawkStyle.h"
|
||||||
#include "utils/TomahawkUtilsGui.h"
|
#include "utils/TomahawkUtilsGui.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QScrollArea>
|
||||||
|
|
||||||
|
|
||||||
SearchWidget::SearchWidget( const QString& search, QWidget* parent )
|
SearchWidget::SearchWidget( const QString& search, QWidget* parent )
|
||||||
: QWidget( parent )
|
: QWidget( parent )
|
||||||
, ui( new Ui::SearchWidget )
|
, ui( new Ui::SearchWidget )
|
||||||
, m_search( search )
|
, m_search( search )
|
||||||
{
|
{
|
||||||
ui->setupUi( this );
|
QWidget* widget = new QWidget;
|
||||||
|
ui->setupUi( widget );
|
||||||
|
|
||||||
ui->resultsView->setGuid( "searchwidget" );
|
ui->lineAbove->setStyleSheet( QString( "QFrame { border: 1px solid black; }" ) );
|
||||||
m_resultsModel = new PlaylistModel( ui->resultsView );
|
ui->lineBelow->setStyleSheet( QString( "QFrame { border: 1px solid %1; }" ).arg( TomahawkStyle::HEADER_BACKGROUND.name() ) );
|
||||||
ui->resultsView->setPlaylistModel( m_resultsModel );
|
|
||||||
ui->resultsView->sortByColumn( PlaylistModel::Score, Qt::DescendingOrder );
|
|
||||||
|
|
||||||
m_albumsModel = new PlayableModel( ui->albumView );
|
{
|
||||||
ui->albumView->setPlayableModel( m_albumsModel );
|
ui->resultsView->setGuid( "searchwidget" );
|
||||||
|
m_resultsModel = new PlaylistModel( ui->resultsView );
|
||||||
|
|
||||||
m_artistsModel = new PlayableModel( ui->artistView );
|
QPalette p = ui->resultsView->palette();
|
||||||
ui->artistView->setPlayableModel( m_artistsModel );
|
p.setColor( QPalette::Text, TomahawkStyle::PAGE_TRACKLIST_TRACK_SOLVED );
|
||||||
|
p.setColor( QPalette::BrightText, TomahawkStyle::PAGE_TRACKLIST_TRACK_UNRESOLVED );
|
||||||
|
p.setColor( QPalette::Foreground, TomahawkStyle::PAGE_TRACKLIST_NUMBER );
|
||||||
|
p.setColor( QPalette::Highlight, TomahawkStyle::PAGE_TRACKLIST_HIGHLIGHT );
|
||||||
|
p.setColor( QPalette::HighlightedText, TomahawkStyle::PAGE_TRACKLIST_HIGHLIGHT_TEXT );
|
||||||
|
|
||||||
ui->artistView->proxyModel()->sort( -1 );
|
ui->resultsView->setPalette( p );
|
||||||
ui->albumView->proxyModel()->sort( -1 );
|
ui->resultsView->setFrameShape( QFrame::Panel );
|
||||||
ui->artistView->proxyModel()->setHideDupeItems( true );
|
ui->resultsView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
||||||
ui->albumView->proxyModel()->setHideDupeItems( true );
|
ui->resultsView->setStyleSheet( "QTreeView { background-color: transparent; }" );
|
||||||
|
TomahawkStyle::stylePageFrame( ui->resultsFrame );
|
||||||
|
|
||||||
TomahawkUtils::unmarginLayout( ui->verticalLayout );
|
ui->resultsView->setAlternatingRowColors( false );
|
||||||
|
ui->resultsView->setAutoResize( true );
|
||||||
|
ui->resultsView->setPlaylistModel( m_resultsModel );
|
||||||
|
ui->resultsView->sortByColumn( PlaylistModel::Score, Qt::DescendingOrder );
|
||||||
|
ui->resultsView->setEmptyTip( tr( "Sorry, we could not find any tracks!" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
m_albumsModel = new PlayableModel( ui->albumView );
|
||||||
|
ui->albumView->setPlayableModel( m_albumsModel );
|
||||||
|
|
||||||
|
ui->albumView->setFrameShape( QFrame::NoFrame );
|
||||||
|
ui->albumView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
||||||
|
ui->albumView->proxyModel()->sort( -1 );
|
||||||
|
ui->albumView->proxyModel()->setHideDupeItems( true );
|
||||||
|
|
||||||
|
ui->albumView->setAutoResize( true );
|
||||||
|
ui->albumView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
||||||
|
ui->albumView->setStyleSheet( "QListView { background-color: transparent; }" );
|
||||||
|
TomahawkStyle::stylePageFrame( ui->albumFrame );
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
m_artistsModel = new PlayableModel( ui->artistView );
|
||||||
|
ui->artistView->setPlayableModel( m_artistsModel );
|
||||||
|
|
||||||
|
ui->artistView->setFrameShape( QFrame::NoFrame );
|
||||||
|
ui->artistView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
||||||
|
ui->artistView->proxyModel()->sort( -1 );
|
||||||
|
ui->artistView->proxyModel()->setHideDupeItems( true );
|
||||||
|
|
||||||
|
ui->artistView->setAutoResize( true );
|
||||||
|
ui->artistView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
||||||
|
ui->artistView->setStyleSheet( "QListView { background-color: transparent; }" );
|
||||||
|
TomahawkStyle::stylePageFrame( ui->artistFrame );
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
QFont f = ui->label->font();
|
||||||
|
f.setFamily( "Fauna One" );
|
||||||
|
|
||||||
|
QPalette p = ui->label->palette();
|
||||||
|
p.setColor( QPalette::Foreground, TomahawkStyle::PAGE_CAPTION );
|
||||||
|
|
||||||
|
ui->label->setFont( f );
|
||||||
|
ui->label->setPalette( p );
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
QFont f = ui->label_2->font();
|
||||||
|
f.setFamily( "Fauna One" );
|
||||||
|
|
||||||
|
QPalette p = ui->label_2->palette();
|
||||||
|
p.setColor( QPalette::Foreground, TomahawkStyle::HEADER_TEXT );
|
||||||
|
|
||||||
|
ui->label_2->setFont( f );
|
||||||
|
ui->label_3->setFont( f );
|
||||||
|
ui->label_2->setPalette( p );
|
||||||
|
ui->label_3->setPalette( p );
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
QScrollArea* area = new QScrollArea();
|
||||||
|
area->setWidgetResizable( true );
|
||||||
|
area->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
|
||||||
|
area->setWidget( widget );
|
||||||
|
|
||||||
|
QPalette pal = palette();
|
||||||
|
pal.setBrush( backgroundRole(), TomahawkStyle::HEADER_BACKGROUND );
|
||||||
|
area->setPalette( pal );
|
||||||
|
area->setAutoFillBackground( true );
|
||||||
|
area->setFrameShape( QFrame::NoFrame );
|
||||||
|
area->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
||||||
|
|
||||||
|
QVBoxLayout* layout = new QVBoxLayout();
|
||||||
|
layout->addWidget( area );
|
||||||
|
setLayout( layout );
|
||||||
|
TomahawkUtils::unmarginLayout( layout );
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
QPalette pal = palette();
|
||||||
|
pal.setBrush( backgroundRole(), TomahawkStyle::PAGE_BACKGROUND );
|
||||||
|
ui->resultsContainer->setPalette( pal );
|
||||||
|
ui->resultsContainer->setAutoFillBackground( true );
|
||||||
|
}
|
||||||
|
|
||||||
m_artistsModel->startLoading();
|
m_artistsModel->startLoading();
|
||||||
m_albumsModel->startLoading();
|
m_albumsModel->startLoading();
|
||||||
m_resultsModel->startLoading();
|
m_resultsModel->startLoading();
|
||||||
m_queries << Tomahawk::Query::get( search, uuid() );
|
m_queries << Tomahawk::Query::get( search, uuid() );
|
||||||
|
|
||||||
ui->splitter_2->setStretchFactor( 0, 0 );
|
|
||||||
ui->splitter_2->setStretchFactor( 1, 1 );
|
|
||||||
|
|
||||||
foreach ( const Tomahawk::query_ptr& query, m_queries )
|
foreach ( const Tomahawk::query_ptr& query, m_queries )
|
||||||
{
|
{
|
||||||
connect( query.data(), SIGNAL( artistsAdded( QList<Tomahawk::artist_ptr> ) ), SLOT( onArtistsFound( QList<Tomahawk::artist_ptr> ) ) );
|
connect( query.data(), SIGNAL( artistsAdded( QList<Tomahawk::artist_ptr> ) ), SLOT( onArtistsFound( QList<Tomahawk::artist_ptr> ) ) );
|
||||||
|
@@ -54,8 +54,8 @@ public:
|
|||||||
virtual QString description() const { return tr( "Results for '%1'" ).arg( m_search ); }
|
virtual QString description() const { return tr( "Results for '%1'" ).arg( m_search ); }
|
||||||
virtual QPixmap pixmap() const;
|
virtual QPixmap pixmap() const;
|
||||||
|
|
||||||
|
virtual bool showInfoBar() const { return true; }
|
||||||
virtual bool isTemporaryPage() const { return true; }
|
virtual bool isTemporaryPage() const { return true; }
|
||||||
|
|
||||||
virtual bool jumpToCurrentTrack();
|
virtual bool jumpToCurrentTrack();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -6,33 +6,257 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>985</width>
|
<width>939</width>
|
||||||
<height>460</height>
|
<height>647</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="focusPolicy">
|
<property name="focusPolicy">
|
||||||
<enum>Qt::TabFocus</enum>
|
<enum>Qt::TabFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout_7" stretch="0,0,1,0,0">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSplitter" name="splitter_2">
|
<widget class="QWidget" name="resultsContainer" native="true">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>12</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>16</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>12</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>16</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="resultsFrame">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>8</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>8</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>20</pointsize>
|
||||||
|
<weight>50</weight>
|
||||||
|
<bold>false</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Tracks</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="PlaylistView" name="resultsView"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="lineAbove">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>1</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="handleWidth">
|
</widget>
|
||||||
<number>1</number>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="lineBelow">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>1</height>
|
||||||
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QSplitter" name="splitter">
|
<property name="orientation">
|
||||||
<property name="orientation">
|
<enum>Qt::Horizontal</enum>
|
||||||
<enum>Qt::Horizontal</enum>
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="widget" native="true">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="handleWidth">
|
<property name="topMargin">
|
||||||
<number>1</number>
|
<number>16</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="GridView" name="artistView"/>
|
<property name="rightMargin">
|
||||||
<widget class="GridView" name="albumView"/>
|
<number>0</number>
|
||||||
</widget>
|
</property>
|
||||||
<widget class="PlaylistView" name="resultsView"/>
|
<property name="bottomMargin">
|
||||||
|
<number>16</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="artistFrame">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>28</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>8</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>20</pointsize>
|
||||||
|
<weight>50</weight>
|
||||||
|
<bold>false</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Artists</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="GridView" name="artistView">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>190</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="widget_3" native="true">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>16</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>16</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="albumFrame">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>28</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>8</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>20</pointsize>
|
||||||
|
<weight>50</weight>
|
||||||
|
<bold>false</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Albums</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="GridView" name="albumView">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>190</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@@ -41,12 +265,12 @@
|
|||||||
<customwidget>
|
<customwidget>
|
||||||
<class>PlaylistView</class>
|
<class>PlaylistView</class>
|
||||||
<extends>QTreeView</extends>
|
<extends>QTreeView</extends>
|
||||||
<header>playlist/PlaylistView.h</header>
|
<header location="global">playlist/PlaylistView.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>GridView</class>
|
<class>GridView</class>
|
||||||
<extends>QListView</extends>
|
<extends>QListView</extends>
|
||||||
<header>playlist/GridView.h</header>
|
<header location="global">playlist/GridView.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
Reference in New Issue
Block a user