diff --git a/src/libtomahawk/CMakeLists.txt b/src/libtomahawk/CMakeLists.txt index da15df272..3e6fd33ac 100644 --- a/src/libtomahawk/CMakeLists.txt +++ b/src/libtomahawk/CMakeLists.txt @@ -171,7 +171,9 @@ set( libSources widgets/welcomewidget.cpp widgets/welcomeplaylistmodel.cpp widgets/overlaywidget.cpp + widgets/HeaderLabel.cpp widgets/infowidgets/sourceinfowidget.cpp +# widgets/infowidgets/ArtistInfoWidget.cpp kdsingleapplicationguard/kdsingleapplicationguard.cpp kdsingleapplicationguard/kdsharedmemorylocker.cpp @@ -338,7 +340,9 @@ set( libHeaders widgets/welcomewidget.h widgets/welcomeplaylistmodel.h widgets/overlaywidget.h + widgets/HeaderLabel.h widgets/infowidgets/sourceinfowidget.h +# widgets/infowidgets/ArtistInfoWidget.h kdsingleapplicationguard/kdsingleapplicationguard.h ) @@ -360,6 +364,7 @@ set( libUI ${libUI} widgets/searchwidget.ui widgets/welcomewidget.ui widgets/infowidgets/sourceinfowidget.ui + widgets/infowidgets/ArtistInfoWidget.ui playlist/topbar/topbar.ui playlist/infobar/infobar.ui ) diff --git a/src/libtomahawk/widgets/HeaderLabel.cpp b/src/libtomahawk/widgets/HeaderLabel.cpp new file mode 100644 index 000000000..f30fbc7b2 --- /dev/null +++ b/src/libtomahawk/widgets/HeaderLabel.cpp @@ -0,0 +1,86 @@ +/* === This file is part of Tomahawk Player - === + * + * Copyright 2010-2011, Christian Muehlhaeuser + * + * Tomahawk is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Tomahawk is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Tomahawk. If not, see . + */ + +#include "HeaderLabel.h" + +#include +#include + +#define FONT_SIZE 16 + + +HeaderLabel::HeaderLabel( QWidget* parent ) + : QLabel( parent ) + , m_parent( parent ) +{ + QFont f( font() ); + f.setBold( true ); + f.setPointSize( 11 ); + +#ifdef Q_WS_MAC + f.setPointSize( f.pointSize() - 2 ); +#endif + + setFont( f ); + setFixedHeight( sizeHint().height() + 6 ); + qDebug() << "FOOBAR:" << minimumSize(); +} + + +HeaderLabel::~HeaderLabel() +{ +} + + +QSize +HeaderLabel::sizeHint() const +{ + return QLabel::sizeHint(); +} + + +void +HeaderLabel::paintEvent( QPaintEvent* event ) +{ + QPainter p( this ); + QRect r = contentsRect(); + +// p.setRenderHint( QPainter::Antialiasing ); + + QRect upperHalf( 0, 0, r.width(), r.height() / 2 ); + QRect lowerHalf( 0, upperHalf.height(), r.width(), r.height() ); + p.fillRect( upperHalf, QColor( 80, 80, 80 ) ); + p.fillRect( lowerHalf, QColor( 72, 72, 72 ) ); + + { + QColor lineColor( 100, 100, 100 ); + QLine line( 0, 0, r.width(), 0 ); + p.setPen( lineColor ); + p.drawLine( line ); + } + { + QColor lineColor( 63, 63, 63 ); + QLine line( 0, r.height() - 1, r.width(), r.height() - 1 ); + p.setPen( lineColor ); + p.drawLine( line ); + } + + r.adjust( 8, 3, -8, -3 ); + p.setPen( Qt::white ); + p.drawText( r, text() ); +} diff --git a/src/libtomahawk/widgets/HeaderLabel.h b/src/libtomahawk/widgets/HeaderLabel.h new file mode 100644 index 000000000..3333dabf6 --- /dev/null +++ b/src/libtomahawk/widgets/HeaderLabel.h @@ -0,0 +1,47 @@ +/* === This file is part of Tomahawk Player - === + * + * Copyright 2010-2011, Christian Muehlhaeuser + * + * Tomahawk is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Tomahawk is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Tomahawk. If not, see . + */ + +#ifndef HEADERLABEL_H +#define HEADERLABEL_H + +#include + +#include "dllmacro.h" + +class DLLEXPORT HeaderLabel : public QLabel +{ +Q_OBJECT + +public: + HeaderLabel( QWidget* parent ); + ~HeaderLabel(); + + QSize minimumSizeHint() const { return sizeHint(); } + QSize sizeHint() const; + +public slots: + +protected: +// void changeEvent( QEvent* e ); + void paintEvent( QPaintEvent* event ); + +private: + QWidget* m_parent; +}; + +#endif // HEADERLABEL_H diff --git a/src/libtomahawk/widgets/infowidgets/sourceinfowidget.cpp b/src/libtomahawk/widgets/infowidgets/sourceinfowidget.cpp index 77912e92a..0f8288589 100644 --- a/src/libtomahawk/widgets/infowidgets/sourceinfowidget.cpp +++ b/src/libtomahawk/widgets/infowidgets/sourceinfowidget.cpp @@ -38,6 +38,30 @@ SourceInfoWidget::SourceInfoWidget( const Tomahawk::source_ptr& source, QWidget* { ui->setupUi( this ); + ui->historyView->setFrameShape( QFrame::NoFrame ); + ui->historyView->setAttribute( Qt::WA_MacShowFocusRect, 0 ); + ui->recentAlbumView->setFrameShape( QFrame::NoFrame ); + ui->recentAlbumView->setAttribute( Qt::WA_MacShowFocusRect, 0 ); + ui->recentCollectionView->setFrameShape( QFrame::NoFrame ); + ui->recentCollectionView->setAttribute( Qt::WA_MacShowFocusRect, 0 ); + + ui->horizontalLayout->setContentsMargins( 0, 0, 0, 0 ); + ui->horizontalLayout->setMargin( 0 ); + ui->horizontalLayout->setSpacing( 0 ); + + ui->verticalLayout->setContentsMargins( 0, 0, 0, 0 ); + ui->verticalLayout->setMargin( 0 ); + ui->verticalLayout->setSpacing( 0 ); + ui->verticalLayout_2->setContentsMargins( 0, 0, 0, 0 ); + ui->verticalLayout_2->setMargin( 0 ); + ui->verticalLayout_2->setSpacing( 0 ); + ui->verticalLayout_3->setContentsMargins( 0, 0, 0, 0 ); + ui->verticalLayout_3->setMargin( 0 ); + ui->verticalLayout_3->setSpacing( 0 ); + ui->verticalLayout_4->setContentsMargins( 0, 0, 0, 0 ); + ui->verticalLayout_4->setMargin( 0 ); + ui->verticalLayout_4->setSpacing( 0 ); + ui->historyView->overlay()->setEnabled( false ); m_recentCollectionModel = new CollectionFlatModel( ui->recentCollectionView ); diff --git a/src/libtomahawk/widgets/infowidgets/sourceinfowidget.ui b/src/libtomahawk/widgets/infowidgets/sourceinfowidget.ui index cfb416fcb..bde48ccbc 100644 --- a/src/libtomahawk/widgets/infowidgets/sourceinfowidget.ui +++ b/src/libtomahawk/widgets/infowidgets/sourceinfowidget.ui @@ -6,7 +6,7 @@ 0 0 - 985 + 831 460 @@ -14,14 +14,7 @@ - - - - 13 - 75 - true - - + Recent Albums @@ -56,14 +49,7 @@ - - - - 13 - 75 - true - - + Latest Additions to their Collection @@ -77,14 +63,7 @@ - - - - 13 - 75 - true - - + Recently played Tracks @@ -100,21 +79,26 @@ + + HeaderLabel + QLabel +
widgets/HeaderLabel.h
+
PlaylistView QTreeView
playlist/playlistview.h
- - CollectionView - QTreeView -
playlist/collectionview.h
-
AlbumView QListView
playlist/albumview.h
+ + CollectionView + QTreeView +
playlist/collectionview.h
+
diff --git a/src/libtomahawk/widgets/welcomewidget.cpp b/src/libtomahawk/widgets/welcomewidget.cpp index f288f6714..2f0ae31e8 100644 --- a/src/libtomahawk/widgets/welcomewidget.cpp +++ b/src/libtomahawk/widgets/welcomewidget.cpp @@ -52,6 +52,27 @@ WelcomeWidget::WelcomeWidget( QWidget* parent ) WelcomePlaylistModel* model = new WelcomePlaylistModel( this ); model->setMaxPlaylists( HISTORY_PLAYLIST_ITEMS ); + ui->playlistWidget->setFrameShape( QFrame::NoFrame ); + ui->playlistWidget->setAttribute( Qt::WA_MacShowFocusRect, 0 ); + ui->tracksView->setFrameShape( QFrame::NoFrame ); + ui->tracksView->setAttribute( Qt::WA_MacShowFocusRect, 0 ); + ui->additionsView->setFrameShape( QFrame::NoFrame ); + ui->additionsView->setAttribute( Qt::WA_MacShowFocusRect, 0 ); + + ui->horizontalLayout->setContentsMargins( 0, 0, 0, 0 ); + ui->horizontalLayout->setMargin( 0 ); + ui->horizontalLayout->setSpacing( 0 ); + + ui->verticalLayout->setContentsMargins( 0, 0, 0, 0 ); + ui->verticalLayout->setMargin( 0 ); + ui->verticalLayout->setSpacing( 0 ); + ui->verticalLayout_2->setContentsMargins( 0, 0, 0, 0 ); + ui->verticalLayout_2->setMargin( 0 ); + ui->verticalLayout_2->setSpacing( 0 ); + ui->verticalLayout_3->setContentsMargins( 0, 0, 0, 0 ); + ui->verticalLayout_3->setMargin( 0 ); + ui->verticalLayout_3->setSpacing( 0 ); + ui->playlistWidget->setItemDelegate( new PlaylistDelegate() ); ui->playlistWidget->setModel( model ); ui->playlistWidget->overlay()->resize( 380, 86 ); diff --git a/src/libtomahawk/widgets/welcomewidget.ui b/src/libtomahawk/widgets/welcomewidget.ui index d55ca2ff7..5866dc325 100644 --- a/src/libtomahawk/widgets/welcomewidget.ui +++ b/src/libtomahawk/widgets/welcomewidget.ui @@ -6,8 +6,8 @@ 0 0 - 985 - 459 + 875 + 513 @@ -16,15 +16,10 @@ Qt::Vertical - + - - - - 14 - - + Recent Additions @@ -35,15 +30,10 @@ - + - - - - 14 - - + Newest Stations & Playlists @@ -59,18 +49,13 @@ - + 16777215 16777215 - - - 14 - - Recently Played Tracks @@ -91,6 +76,11 @@ + + HeaderLabel + QLabel +
widgets/HeaderLabel.h
+
PlaylistView QTreeView