mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-28 11:42:42 +01:00
* A few more improvements for and around HeaderLabels.
This commit is contained in:
parent
61f9fd5c99
commit
1e62c117e4
@ -205,16 +205,16 @@ PlaylistItemDelegate::paintShort( QPainter* painter, const QStyleOptionViewItem&
|
||||
QFont boldFont = opt.font;
|
||||
boldFont.setBold( true );
|
||||
|
||||
r.adjust( ir.width() + 12, 0, 0, 0 );
|
||||
r.adjust( ir.width() + 12, 0, -12, 0 );
|
||||
QTextOption to( Qt::AlignTop );
|
||||
to.setWrapMode( QTextOption::NoWrap );
|
||||
painter->setFont( boldFont );
|
||||
QString text = painter->fontMetrics().elidedText( upperText, Qt::ElideRight, r.width() - 3 );
|
||||
QString text = painter->fontMetrics().elidedText( upperText, Qt::ElideRight, r.width() );
|
||||
painter->drawText( r.adjusted( 0, 1, 0, 0 ), text, to );
|
||||
|
||||
to.setAlignment( Qt::AlignBottom );
|
||||
painter->setFont( opt.font );
|
||||
text = painter->fontMetrics().elidedText( lowerText, Qt::ElideRight, r.width() - 3 );
|
||||
text = painter->fontMetrics().elidedText( lowerText, Qt::ElideRight, r.width() );
|
||||
painter->drawText( r.adjusted( 0, 1, 0, 0 ), text, to );
|
||||
}
|
||||
painter->restore();
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QLayout>
|
||||
#include <QPainter>
|
||||
#include <QPixmap>
|
||||
#include <QNetworkAccessManager>
|
||||
@ -338,6 +339,22 @@ createDragPixmap( int itemCount )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
unmarginLayout( QLayout* layout )
|
||||
{
|
||||
layout->setContentsMargins( 0, 0, 0, 0 );
|
||||
layout->setMargin( 0 );
|
||||
layout->setSpacing( 0 );
|
||||
|
||||
for ( int i = 0; i < layout->count(); i++ )
|
||||
{
|
||||
QLayout* childLayout = layout->itemAt( i )->layout();
|
||||
if ( childLayout )
|
||||
unmarginLayout( childLayout );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QWeakPointer< QNetworkAccessManager > s_nam;
|
||||
NetworkProxyFactory* s_proxyFactory = 0;
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <QThread>
|
||||
#include <QNetworkProxy>
|
||||
#include <QStringList>
|
||||
#include <QDir>
|
||||
|
||||
#define RESPATH ":/data/"
|
||||
|
||||
@ -33,8 +32,8 @@ class QDir;
|
||||
class QDateTime;
|
||||
class QString;
|
||||
class QPixmap;
|
||||
class QLayout;
|
||||
class QNetworkAccessManager;
|
||||
class QNetworkProxy;
|
||||
|
||||
namespace TomahawkUtils
|
||||
{
|
||||
@ -72,6 +71,8 @@ namespace TomahawkUtils
|
||||
DLLEXPORT QColor alphaBlend( const QColor& colorFrom, const QColor& colorTo, float opacity );
|
||||
DLLEXPORT QPixmap createDragPixmap( int itemCount = 1 );
|
||||
|
||||
DLLEXPORT void unmarginLayout( QLayout* layout );
|
||||
|
||||
DLLEXPORT NetworkProxyFactory* proxyFactory();
|
||||
DLLEXPORT QNetworkAccessManager* nam();
|
||||
|
||||
|
@ -74,7 +74,7 @@ HeaderLabel::paintEvent( QPaintEvent* event )
|
||||
p.drawLine( line );
|
||||
}
|
||||
{
|
||||
QColor lineColor( 63, 63, 63 );
|
||||
QColor lineColor( 30, 30, 30 );
|
||||
QLine line( 0, r.height() - 1, r.width(), r.height() - 1 );
|
||||
p.setPen( lineColor );
|
||||
p.drawLine( line );
|
||||
|
@ -45,22 +45,7 @@ SourceInfoWidget::SourceInfoWidget( const Tomahawk::source_ptr& source, QWidget*
|
||||
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 );
|
||||
TomahawkUtils::unmarginLayout( layout() );
|
||||
|
||||
ui->historyView->overlay()->setEnabled( false );
|
||||
|
||||
|
@ -48,6 +48,9 @@ WelcomeWidget::WelcomeWidget( QWidget* parent )
|
||||
ui->setupUi( this );
|
||||
|
||||
ui->splitter->setHandleWidth( 1 );
|
||||
ui->splitter_2->setHandleWidth( 1 );
|
||||
ui->splitter_2->setStretchFactor( 0, 3 );
|
||||
ui->splitter_2->setStretchFactor( 0, 2 );
|
||||
|
||||
WelcomePlaylistModel* model = new WelcomePlaylistModel( this );
|
||||
model->setMaxPlaylists( HISTORY_PLAYLIST_ITEMS );
|
||||
@ -59,19 +62,11 @@ WelcomeWidget::WelcomeWidget( QWidget* parent )
|
||||
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 );
|
||||
TomahawkUtils::unmarginLayout( layout() );
|
||||
TomahawkUtils::unmarginLayout( ui->verticalLayout->layout() );
|
||||
TomahawkUtils::unmarginLayout( ui->verticalLayout_2->layout() );
|
||||
TomahawkUtils::unmarginLayout( ui->verticalLayout_3->layout() );
|
||||
TomahawkUtils::unmarginLayout( ui->verticalLayout_4->layout() );
|
||||
|
||||
ui->playlistWidget->setItemDelegate( new PlaylistDelegate() );
|
||||
ui->playlistWidget->setModel( model );
|
||||
|
@ -10,69 +10,74 @@
|
||||
<height>513</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="2,1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<widget class="QSplitter" name="splitter_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="HeaderLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Recent Additions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="AlbumView" name="additionsView"/>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="HeaderLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Recent Additions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="AlbumView" name="additionsView"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="HeaderLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Newest Stations & Playlists</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="PlaylistWidget" name="playlistWidget"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<widget class="QWidget" name="">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="HeaderLabel" name="label_2">
|
||||
<widget class="HeaderLabel" name="label_3">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Newest Stations & Playlists</string>
|
||||
<string>Recently Played Tracks</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="PlaylistWidget" name="playlistWidget"/>
|
||||
<widget class="PlaylistView" name="tracksView">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="HeaderLabel" name="label_3">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Recently Played Tracks</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="PlaylistView" name="tracksView">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
@ -86,16 +91,16 @@
|
||||
<extends>QTreeView</extends>
|
||||
<header>playlist/playlistview.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>PlaylistWidget</class>
|
||||
<extends>QListWidget</extends>
|
||||
<header>widgets/welcomewidget.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>AlbumView</class>
|
||||
<extends>QListView</extends>
|
||||
<header>playlist/albumview.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>PlaylistWidget</class>
|
||||
<extends>QListWidget</extends>
|
||||
<header>widgets/welcomewidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QThread>
|
||||
#include <QtWebKit/QWebPage>
|
||||
|
Loading…
x
Reference in New Issue
Block a user