mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-04 21:27:58 +02:00
* Fixed a few margin / spacing issues across all platforms (well, hopefully).
This commit is contained in:
@@ -23,7 +23,6 @@ AudioControls::AudioControls( QWidget* parent )
|
|||||||
ui->setupUi( this );
|
ui->setupUi( this );
|
||||||
|
|
||||||
ui->buttonAreaLayout->setSpacing( 2 );
|
ui->buttonAreaLayout->setSpacing( 2 );
|
||||||
ui->trackLabelLayout->setSpacing( 3 );
|
|
||||||
|
|
||||||
QFont font( ui->artistTrackLabel->font() );
|
QFont font( ui->artistTrackLabel->font() );
|
||||||
font.setPixelSize( 12 );
|
font.setPixelSize( 12 );
|
||||||
|
@@ -168,7 +168,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>8</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
@@ -177,14 +177,35 @@
|
|||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="1,0,0">
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="trackLabelLayout">
|
<layout class="QVBoxLayout" name="trackLabelLayout">
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QueryLabel" name="artistTrackLabel">
|
<widget class="QueryLabel" name="artistTrackLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>16</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="cursor">
|
<property name="cursor">
|
||||||
<cursorShape>PointingHandCursor</cursorShape>
|
<cursorShape>PointingHandCursor</cursorShape>
|
||||||
</property>
|
</property>
|
||||||
@@ -195,6 +216,18 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QueryLabel" name="albumLabel">
|
<widget class="QueryLabel" name="albumLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>16</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="cursor">
|
<property name="cursor">
|
||||||
<cursorShape>PointingHandCursor</cursorShape>
|
<cursorShape>PointingHandCursor</cursorShape>
|
||||||
</property>
|
</property>
|
||||||
@@ -212,8 +245,8 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>4</width>
|
||||||
<height>20</height>
|
<height>8</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
@@ -246,13 +279,16 @@
|
|||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>20</width>
|
||||||
<height>40</height>
|
<height>4</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="timeLabel">
|
<widget class="QLabel" name="timeLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@@ -23,6 +23,14 @@ SourceTreeItemWidget::SourceTreeItemWidget( const source_ptr& source, QWidget* p
|
|||||||
ui->verticalLayout->setSpacing( 3 );
|
ui->verticalLayout->setSpacing( 3 );
|
||||||
ui->activityLabel->setType( QueryLabel::ArtistAndTrack );
|
ui->activityLabel->setType( QueryLabel::ArtistAndTrack );
|
||||||
|
|
||||||
|
QFont font = ui->nameLabel->font();
|
||||||
|
// font.setPointSize( font.pointSize() - 1 );
|
||||||
|
ui->nameLabel->setFont( font );
|
||||||
|
|
||||||
|
font.setPointSize( font.pointSize() - 1 );
|
||||||
|
ui->infoLabel->setFont( font );
|
||||||
|
ui->activityLabel->setFont( font );
|
||||||
|
|
||||||
QString displayname;
|
QString displayname;
|
||||||
if ( source.isNull() )
|
if ( source.isNull() )
|
||||||
{
|
{
|
||||||
@@ -59,6 +67,10 @@ SourceTreeItemWidget::SourceTreeItemWidget( const source_ptr& source, QWidget* p
|
|||||||
ui->infoLabel->setForegroundRole( QPalette::Dark );
|
ui->infoLabel->setForegroundRole( QPalette::Dark );
|
||||||
ui->activityLabel->setForegroundRole( QPalette::Dark );
|
ui->activityLabel->setForegroundRole( QPalette::Dark );
|
||||||
|
|
||||||
|
ui->nameLabel->setContentsMargins( 4, 0, 0, 0 );
|
||||||
|
ui->infoLabel->setContentsMargins( 4, 0, 0, 0 );
|
||||||
|
ui->activityLabel->setContentsMargins( 4, 0, 0, 0 );
|
||||||
|
|
||||||
connect( ui->onOffButton, SIGNAL( clicked() ), SIGNAL( clicked() ) );
|
connect( ui->onOffButton, SIGNAL( clicked() ), SIGNAL( clicked() ) );
|
||||||
connect( ui->infoButton, SIGNAL( clicked() ), SLOT( onInfoButtonClicked() ) );
|
connect( ui->infoButton, SIGNAL( clicked() ), SLOT( onInfoButtonClicked() ) );
|
||||||
|
|
||||||
|
@@ -7,27 +7,15 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>359</width>
|
<width>359</width>
|
||||||
<height>60</height>
|
<height>56</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>60</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>60</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -92,7 +80,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>4</width>
|
<width>2</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@@ -101,10 +89,10 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>4</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>4</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="ElidedLabel" name="nameLabel">
|
<widget class="ElidedLabel" name="nameLabel">
|
||||||
|
@@ -354,9 +354,6 @@ TomahawkApp::startServent()
|
|||||||
qDebug() << "Failed to start listening with servent";
|
qDebug() << "Failed to start listening with servent";
|
||||||
exit( 1 );
|
exit( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
//QString key = m_servent.createConnectionKey();
|
|
||||||
//qDebug() << "Generated an offer key: " << key;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -146,7 +146,7 @@ QueryLabel::track() const
|
|||||||
void
|
void
|
||||||
QueryLabel::setText( const QString& text )
|
QueryLabel::setText( const QString& text )
|
||||||
{
|
{
|
||||||
setContentsMargins( 0, 0, 0, 0 );
|
setContentsMargins( m_textMargins );
|
||||||
|
|
||||||
m_result.clear();
|
m_result.clear();
|
||||||
m_query.clear();
|
m_query.clear();
|
||||||
@@ -165,6 +165,9 @@ QueryLabel::setResult( const Tomahawk::result_ptr& result )
|
|||||||
if ( result.isNull() )
|
if ( result.isNull() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if ( !m_text.isEmpty() && contentsMargins().left() != 0 ) // FIXME: hacky
|
||||||
|
m_textMargins = contentsMargins();
|
||||||
|
|
||||||
setContentsMargins( BOXMARGIN * 2, BOXMARGIN / 2, BOXMARGIN * 2, BOXMARGIN / 2);
|
setContentsMargins( BOXMARGIN * 2, BOXMARGIN / 2, BOXMARGIN * 2, BOXMARGIN / 2);
|
||||||
|
|
||||||
if ( m_result.isNull() || m_result.data() != result.data() )
|
if ( m_result.isNull() || m_result.data() != result.data() )
|
||||||
@@ -291,7 +294,7 @@ QueryLabel::paintEvent( QPaintEvent* event )
|
|||||||
|
|
||||||
if ( elidedText == s && m_hoverArea.width() )
|
if ( elidedText == s && m_hoverArea.width() )
|
||||||
{
|
{
|
||||||
p.setPen( palette().shadow().color() );
|
p.setPen( palette().mid().color() );
|
||||||
p.setBrush( palette().highlight() );
|
p.setBrush( palette().highlight() );
|
||||||
p.drawRoundedRect( m_hoverArea, 4.0, 4.0 );
|
p.drawRoundedRect( m_hoverArea, 4.0, 4.0 );
|
||||||
}
|
}
|
||||||
@@ -299,7 +302,7 @@ QueryLabel::paintEvent( QPaintEvent* event )
|
|||||||
if ( elidedText != s || ( m_result.isNull() && m_query.isNull() ) )
|
if ( elidedText != s || ( m_result.isNull() && m_query.isNull() ) )
|
||||||
{
|
{
|
||||||
p.setBrush( palette().window() );
|
p.setBrush( palette().window() );
|
||||||
p.setPen( palette().text().color() );
|
p.setPen( palette().color( foregroundRole() ) );
|
||||||
p.drawText( r, align, elidedText );
|
p.drawText( r, align, elidedText );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -313,7 +316,7 @@ QueryLabel::paintEvent( QPaintEvent* event )
|
|||||||
if ( m_type & Artist )
|
if ( m_type & Artist )
|
||||||
{
|
{
|
||||||
p.setBrush( palette().window() );
|
p.setBrush( palette().window() );
|
||||||
p.setPen( palette().text().color() );
|
p.setPen( palette().color( foregroundRole() ) );
|
||||||
|
|
||||||
if ( m_hoverArea.width() && m_hoverArea.left() + contentsMargins().left() == r.left() )
|
if ( m_hoverArea.width() && m_hoverArea.left() + contentsMargins().left() == r.left() )
|
||||||
{
|
{
|
||||||
@@ -327,7 +330,7 @@ QueryLabel::paintEvent( QPaintEvent* event )
|
|||||||
if ( m_type & Album )
|
if ( m_type & Album )
|
||||||
{
|
{
|
||||||
p.setBrush( palette().window() );
|
p.setBrush( palette().window() );
|
||||||
p.setPen( palette().text().color() );
|
p.setPen( palette().color( foregroundRole() ) );
|
||||||
|
|
||||||
if ( m_type & Artist )
|
if ( m_type & Artist )
|
||||||
{
|
{
|
||||||
@@ -346,7 +349,7 @@ QueryLabel::paintEvent( QPaintEvent* event )
|
|||||||
if ( m_type & Track )
|
if ( m_type & Track )
|
||||||
{
|
{
|
||||||
p.setBrush( palette().window() );
|
p.setBrush( palette().window() );
|
||||||
p.setPen( palette().text().color() );
|
p.setPen( palette().color( foregroundRole() ) );
|
||||||
|
|
||||||
if ( m_type & Artist || m_type & Album )
|
if ( m_type & Artist || m_type & Album )
|
||||||
{
|
{
|
||||||
@@ -418,39 +421,51 @@ QueryLabel::mouseMoveEvent( QMouseEvent* event )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( m_query.isNull() && m_result.isNull() )
|
||||||
|
{
|
||||||
|
m_hoverArea = QRect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const QFontMetrics& fm = fontMetrics();
|
const QFontMetrics& fm = fontMetrics();
|
||||||
int dashX = fm.width( DASH );
|
int dashX = fm.width( DASH );
|
||||||
int artistX = m_type & Artist ? fm.width( artist() ) : 0;
|
int artistX = m_type & Artist ? fm.width( artist() ) : 0;
|
||||||
int albumX = m_type & Album ? fm.width( album() ) : 0;
|
int albumX = m_type & Album ? fm.width( album() ) : 0;
|
||||||
int trackX = m_type & Track ? fm.width( track() ) : 0;
|
int trackX = m_type & Track ? fm.width( track() ) : 0;
|
||||||
|
|
||||||
|
if ( m_type & Track )
|
||||||
|
{
|
||||||
|
trackX += contentsMargins().left();
|
||||||
|
}
|
||||||
if ( m_type & Album )
|
if ( m_type & Album )
|
||||||
{
|
{
|
||||||
trackX += albumX + dashX;
|
trackX += albumX + dashX;
|
||||||
|
albumX += contentsMargins().left();
|
||||||
}
|
}
|
||||||
if ( m_type & Artist )
|
if ( m_type & Artist )
|
||||||
{
|
{
|
||||||
albumX += artistX + dashX;
|
albumX += artistX + dashX;
|
||||||
trackX += artistX + dashX;
|
trackX += artistX + dashX;
|
||||||
|
artistX += contentsMargins().left();
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect hoverArea;
|
QRect hoverArea;
|
||||||
if ( m_type & Artist && x < artistX )
|
if ( m_type & Artist && x < artistX )
|
||||||
{
|
{
|
||||||
hoverArea.setLeft( 1 );
|
hoverArea.setLeft( 0 );
|
||||||
hoverArea.setRight( artistX + contentsMargins().left() + 2 );
|
hoverArea.setRight( artistX + contentsMargins().left() );
|
||||||
}
|
}
|
||||||
else if ( m_type & Album && x < albumX )
|
else if ( m_type & Album && x < albumX && x > artistX )
|
||||||
{
|
{
|
||||||
int spacing = ( m_type & Artist ) ? dashX : 0;
|
int spacing = ( m_type & Artist ) ? dashX : 0;
|
||||||
hoverArea.setLeft( artistX + spacing + 1 );
|
hoverArea.setLeft( artistX + spacing );
|
||||||
hoverArea.setRight( albumX + spacing + contentsMargins().left() + 2 );
|
hoverArea.setRight( albumX + spacing + contentsMargins().left() );
|
||||||
}
|
}
|
||||||
else if ( m_type & Track && x < trackX )
|
else if ( m_type & Track && x < trackX && x > albumX )
|
||||||
{
|
{
|
||||||
int spacing = ( m_type & Album ) ? dashX : 0;
|
int spacing = ( m_type & Album ) ? dashX : 0;
|
||||||
hoverArea.setLeft( albumX + spacing + 1 );
|
hoverArea.setLeft( albumX + spacing );
|
||||||
hoverArea.setRight( trackX + contentsMargins().left() + 2 );
|
hoverArea.setRight( trackX + contentsMargins().left() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( hoverArea.width() )
|
if ( hoverArea.width() )
|
||||||
|
@@ -88,6 +88,7 @@ private:
|
|||||||
|
|
||||||
QRect m_hoverArea;
|
QRect m_hoverArea;
|
||||||
QPoint m_dragPos;
|
QPoint m_dragPos;
|
||||||
|
QMargins m_textMargins;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QUERYLABEL_H
|
#endif // QUERYLABEL_H
|
||||||
|
Reference in New Issue
Block a user