1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-01 03:40:16 +02:00

* New layout for Dashboard.

This commit is contained in:
Christian Muehlhaeuser
2013-06-15 07:23:54 +02:00
committed by Michael Zanetti
parent 06dca3111f
commit 36ae09b698
2 changed files with 344 additions and 225 deletions

View File

@@ -61,13 +61,39 @@ Dashboard::Dashboard( QWidget* parent )
m_header->setCaption( tr( "Dashboard" ) ); m_header->setCaption( tr( "Dashboard" ) );
m_header->setDescription( tr( "An overview of your recent activity" ) ); m_header->setDescription( tr( "An overview of your recent activity" ) );
RecentPlaylistsModel* model = new RecentPlaylistsModel( HISTORY_PLAYLIST_ITEMS, this ); ui->lineAbove->setStyleSheet( QString( "QFrame { border: 1px solid black; }" ) );
ui->lineBelow->setStyleSheet( QString( "QFrame { border: 1px solid %1; }" ).arg( TomahawkStyle::HEADER_BACKGROUND.name() ) );
QPalette trackViewPal = ui->tracksView->palette(); {
trackViewPal.setColor( QPalette::Foreground, TomahawkStyle::PAGE_FOREGROUND ); m_tracksModel = new RecentlyPlayedModel( ui->tracksView, HISTORY_TRACK_ITEMS );
trackViewPal.setColor( QPalette::Text, TomahawkStyle::PAGE_FOREGROUND ); ui->tracksView->proxyModel()->setStyle( PlayableProxyModel::ShortWithAvatars );
trackViewPal.setColor( QPalette::Highlight, QColor( "#252020" ) ); ui->tracksView->overlay()->setEnabled( false );
trackViewPal.setColor( QPalette::HighlightedText, Qt::white ); ui->tracksView->setPlaylistModel( m_tracksModel );
ui->tracksView->setAutoResize( true );
ui->tracksView->setAlternatingRowColors( false );
m_tracksModel->setSource( source_ptr() );
QPalette p = ui->tracksView->palette();
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->tracksView->setPalette( p );
ui->tracksView->setFrameShape( QFrame::NoFrame );
ui->tracksView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
ui->tracksView->setStyleSheet( "QTreeView { background-color: transparent; }" );
TomahawkStyle::stylePageFrame( ui->trackFrame );
QFont f;
f.setBold( true );
QFontMetrics fm( f );
ui->tracksView->setMinimumWidth( fm.width( tr( "Recently played tracks" ) ) * 2 );
}
{
RecentPlaylistsModel* model = new RecentPlaylistsModel( HISTORY_PLAYLIST_ITEMS, this );
ui->playlistWidget->setFrameShape( QFrame::NoFrame ); ui->playlistWidget->setFrameShape( QFrame::NoFrame );
ui->playlistWidget->setAttribute( Qt::WA_MacShowFocusRect, 0 ); ui->playlistWidget->setAttribute( Qt::WA_MacShowFocusRect, 0 );
@@ -75,34 +101,69 @@ Dashboard::Dashboard( QWidget* parent )
ui->playlistWidget->setModel( model ); ui->playlistWidget->setModel( model );
ui->playlistWidget->overlay()->resize( 380, 86 ); ui->playlistWidget->overlay()->resize( 380, 86 );
ui->playlistWidget->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel ); ui->playlistWidget->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
ui->playlistWidget->setPalette( trackViewPal );
QPalette p = ui->playlistWidget->palette();
p.setColor( QPalette::Text, TomahawkStyle::HEADER_TEXT );
p.setColor( QPalette::BrightText, TomahawkStyle::HEADER_TEXT );
p.setColor( QPalette::Foreground, TomahawkStyle::HEADER_TEXT );
p.setColor( QPalette::Highlight, TomahawkStyle::HEADER_TEXT );
p.setColor( QPalette::HighlightedText, TomahawkStyle::HEADER_BACKGROUND );
ui->playlistWidget->setPalette( p );
ui->playlistWidget->setMinimumHeight( 400 ); ui->playlistWidget->setMinimumHeight( 400 );
ui->playlistWidget->setStyleSheet( "QListView { background-color: transparent; }" );
TomahawkStyle::styleScrollBar( ui->playlistWidget->verticalScrollBar() );
TomahawkStyle::stylePageFrame( ui->playlistFrame );
updatePlaylists(); updatePlaylists();
connect( ui->playlistWidget, SIGNAL( activated( QModelIndex ) ), SLOT( onPlaylistActivated( QModelIndex ) ) );
connect( model, SIGNAL( emptinessChanged( bool ) ), this, SLOT( updatePlaylists() ) );
}
m_tracksModel = new RecentlyPlayedModel( ui->tracksView, HISTORY_TRACK_ITEMS ); {
ui->tracksView->proxyModel()->setStyle( PlayableProxyModel::ShortWithAvatars );
ui->tracksView->overlay()->setEnabled( false );
ui->tracksView->setPlaylistModel( m_tracksModel );
ui->tracksView->setAutoResize( true );
m_tracksModel->setSource( source_ptr() );
ui->tracksView->setPalette( trackViewPal );
ui->tracksView->setAlternatingRowColors( false );
ui->tracksView->setFrameShape( QFrame::NoFrame );
ui->tracksView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
m_recentAlbumsModel = new AlbumModel( ui->additionsView ); m_recentAlbumsModel = new AlbumModel( ui->additionsView );
ui->additionsView->setPlayableModel( m_recentAlbumsModel ); ui->additionsView->setPlayableModel( m_recentAlbumsModel );
ui->additionsView->proxyModel()->sort( -1 ); ui->additionsView->proxyModel()->sort( -1 );
ui->additionsView->setStyleSheet( "QListView { background-color: transparent; }" );
TomahawkStyle::stylePageFrame( ui->additionsFrame );
TomahawkStyle::styleScrollBar( ui->additionsView->verticalScrollBar() );
}
{
QFont f = ui->label->font();
f.setBold( false );
f.setFamily( "Fauna One" );
QPalette p = ui->label->palette();
p.setColor( QPalette::Foreground, TomahawkStyle::PAGE_CAPTION );
ui->label->setFont( f );
ui->label_2->setFont( f );
ui->label->setPalette( p );
ui->label_2->setPalette( p );
}
{
QFont f = ui->playlistLabel->font();
f.setBold( false );
f.setFamily( "Fauna One" );
QPalette p = ui->playlistLabel->palette();
p.setColor( QPalette::Foreground, TomahawkStyle::HEADER_TEXT );
ui->playlistLabel->setFont( f );
ui->playlistLabel->setPalette( p );
}
{
QScrollArea* area = new QScrollArea(); QScrollArea* area = new QScrollArea();
area->setWidgetResizable( true ); area->setWidgetResizable( true );
area->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn ); area->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
area->setWidget( widget ); area->setWidget( widget );
QPalette pal = palette(); QPalette pal = palette();
// background: qradialgradient(cx: 0.5, cy: -1.8, fx: 0.5, fy: 0, radius: 2, stop: 0 %1, stop: 1 %2); pal.setBrush( backgroundRole(), TomahawkStyle::HEADER_BACKGROUND );
pal.setBrush( backgroundRole(), TomahawkStyle::PAGE_BACKGROUND );
area->setPalette( pal ); area->setPalette( pal );
area->setAutoFillBackground( true ); area->setAutoFillBackground( true );
area->setFrameShape( QFrame::NoFrame ); area->setFrameShape( QFrame::NoFrame );
@@ -113,31 +174,14 @@ Dashboard::Dashboard( QWidget* parent )
layout->addWidget( area ); layout->addWidget( area );
setLayout( layout ); setLayout( layout );
TomahawkUtils::unmarginLayout( layout ); TomahawkUtils::unmarginLayout( layout );
}
TomahawkStyle::styleScrollBar( ui->playlistWidget->verticalScrollBar() ); {
TomahawkStyle::styleScrollBar( ui->additionsView->verticalScrollBar() ); QPalette pal = palette();
pal.setBrush( backgroundRole(), TomahawkStyle::PAGE_BACKGROUND );
QFont f; ui->widget->setPalette( pal );
f.setBold( true ); ui->widget->setAutoFillBackground( true );
QFontMetrics fm( f ); }
ui->tracksView->setMinimumWidth( fm.width( tr( "Recently played tracks" ) ) * 2 );
QPalette p = ui->label->palette();
p.setColor( QPalette::Foreground, TomahawkStyle::PAGE_FOREGROUND );
p.setColor( QPalette::Text, TomahawkStyle::PAGE_TEXT );
ui->label->setPalette( p );
ui->label_2->setPalette( p );
ui->label_3->setPalette( p );
ui->playlistWidget->setStyleSheet( "QListView { background-color: transparent; }" );
TomahawkStyle::stylePageFrame( ui->playlistFrame );
ui->additionsView->setStyleSheet( "QListView { background-color: transparent; }" );
TomahawkStyle::stylePageFrame( ui->additionsFrame );
ui->tracksView->setStyleSheet( "QTreeView { background-color: transparent; }" );
TomahawkStyle::stylePageFrame( ui->trackFrame );
MetaPlaylistInterface* mpl = new MetaPlaylistInterface(); MetaPlaylistInterface* mpl = new MetaPlaylistInterface();
mpl->addChildInterface( ui->tracksView->playlistInterface() ); mpl->addChildInterface( ui->tracksView->playlistInterface() );
@@ -146,8 +190,6 @@ Dashboard::Dashboard( QWidget* parent )
connect( SourceList::instance(), SIGNAL( ready() ), SLOT( onSourcesReady() ) ); connect( SourceList::instance(), SIGNAL( ready() ), SLOT( onSourcesReady() ) );
connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), SLOT( onSourceAdded( Tomahawk::source_ptr ) ) ); connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), SLOT( onSourceAdded( Tomahawk::source_ptr ) ) );
connect( ui->playlistWidget, SIGNAL( activated( QModelIndex ) ), SLOT( onPlaylistActivated( QModelIndex ) ) );
connect( model, SIGNAL( emptinessChanged( bool ) ), this, SLOT( updatePlaylists() ) );
} }

View File

@@ -7,22 +7,49 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>965</width> <width>965</width>
<height>1179</height> <height>616</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string notr="true" extracomment="not translatable because not shown to the user">Form</string> <string notr="true" extracomment="not translatable because not shown to the user">Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,1"> <layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing"> <property name="spacing">
<number>16</number> <number>0</number>
</property> </property>
<property name="margin"> <property name="margin">
<number>12</number> <number>0</number>
</property>
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<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> </property>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin"> <property name="leftMargin">
<number>12</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>12</number>
</property>
<property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
@@ -47,13 +74,13 @@
<number>8</number> <number>8</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>8</number> <number>4</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="font"> <property name="font">
<font> <font>
<pointsize>18</pointsize> <pointsize>20</pointsize>
<weight>75</weight> <weight>75</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
@@ -111,7 +138,7 @@
<property name="font"> <property name="font">
<font> <font>
<family>Arial</family> <family>Arial</family>
<pointsize>18</pointsize> <pointsize>20</pointsize>
<weight>75</weight> <weight>75</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
@@ -145,6 +172,53 @@
</item> </item>
</layout> </layout>
</item> </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">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="Line" name="lineBelow">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>1</height>
</size>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="playlistContainer" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<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> <item>
<widget class="QFrame" name="playlistFrame"> <widget class="QFrame" name="playlistFrame">
<property name="frameShape"> <property name="frameShape">
@@ -170,11 +244,11 @@
<number>4</number> <number>4</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="playlistLabel">
<property name="font"> <property name="font">
<font> <font>
<family>Arial</family> <family>Arial</family>
<pointsize>18</pointsize> <pointsize>20</pointsize>
<weight>75</weight> <weight>75</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
@@ -193,6 +267,9 @@
</layout> </layout>
</widget> </widget>
</item> </item>
</layout>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
@@ -209,16 +286,16 @@
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget>
<class>PlaylistView</class>
<extends>QTreeView</extends>
<header location="global">playlist/PlaylistView.h</header>
</customwidget>
<customwidget> <customwidget>
<class>GridView</class> <class>GridView</class>
<extends>QListView</extends> <extends>QListView</extends>
<header location="global">playlist/GridView.h</header> <header location="global">playlist/GridView.h</header>
</customwidget> </customwidget>
<customwidget>
<class>PlaylistView</class>
<extends>QTreeView</extends>
<header>playlist/PlaylistView.h</header>
</customwidget>
<customwidget> <customwidget>
<class>PlaylistWidget</class> <class>PlaylistWidget</class>
<extends>QListWidget</extends> <extends>QListWidget</extends>