1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-09 15:47:38 +02:00

* More work on AudioControls layout. Hoep this simplifies things a bit.

This commit is contained in:
Christian Muehlhaeuser
2014-09-03 02:37:48 +02:00
parent b8416fa7c0
commit 3dab1533fc
2 changed files with 183 additions and 184 deletions

View File

@@ -172,27 +172,8 @@ AudioControls::AudioControls( QWidget* parent )
connect( ViewManager::instance(), SIGNAL( viewPageDestroyed() ), SLOT( onControlStateChanged() ) ); connect( ViewManager::instance(), SIGNAL( viewPageDestroyed() ), SLOT( onControlStateChanged() ) );
// TomahawkUtils::unmarginLayout( ui->horizontalLayout );
// TomahawkUtils::unmarginLayout( ui->buttonAreaLayout );
// ui->buttonAreaLayout->setSpacing( 0 );
ui->stackedLayout->setSpacing( 0 );
ui->stackedLayout->setContentsMargins( 0, 0, 0, 0 );
ui->stackedLayout->setMargin( 0 );
ui->playPauseButton->setContentsMargins( 0, 0, 0, 0 );
ui->pauseButton->setContentsMargins( 0, 0, 0, 0 );
ui->stackedLayout->setSizeConstraint( QLayout::SetFixedSize );
// setFixedSize corrections for stuff in .ui :(
// ui->buttonArea->setFixedSize( scaled( 170, 66 ) );
//ui->coverImage->setFixedSize( scaled( 60, 60 ) );
//ui->metaDataArea->setMaximumHeight( scaledY( 74 ) );
//ui->widget_4->setFixedSize( scaled( 170, 66 ) );
// ui->volumeSlider->setFixedHeight( 20 );
// ui->verticalLayout->setContentsMargins( scaledX( 2 ), scaledY( 6 ),
// 0, scaledY( 6 ) );
connect( InfoSystem::InfoSystem::instance(), SIGNAL( updatedSupportedPushTypes( Tomahawk::InfoSystem::InfoTypeSet ) ), connect( InfoSystem::InfoSystem::instance(), SIGNAL( updatedSupportedPushTypes( Tomahawk::InfoSystem::InfoTypeSet ) ),
this, SLOT( onInfoSystemPushTypesUpdated( Tomahawk::InfoSystem::InfoTypeSet ) ) ); SLOT( onInfoSystemPushTypesUpdated( Tomahawk::InfoSystem::InfoTypeSet ) ) );
onInfoSystemPushTypesUpdated( InfoSystem::InfoSystem::instance()->supportedPushTypes() ); onInfoSystemPushTypesUpdated( InfoSystem::InfoSystem::instance()->supportedPushTypes() );
onPlaybackStopped(); // initial state onPlaybackStopped(); // initial state
@@ -334,7 +315,8 @@ AudioControls::onPlaybackLoading( const Tomahawk::result_ptr result )
ui->timeLeftLabel->setText( "-" + duration ); ui->timeLeftLabel->setText( "-" + duration );
m_lastTextSecondShown = 0; m_lastTextSecondShown = 0;
ui->stackedLayout->setCurrentWidget( ui->pauseButton ); ui->playPauseButton->setVisible( false );
ui->pauseButton->setVisible( true );
/* ui->loveButton->setEnabled( true ); /* ui->loveButton->setEnabled( true );
ui->loveButton->setVisible( true ); ui->loveButton->setVisible( true );
@@ -462,7 +444,8 @@ void
AudioControls::onPlaybackPaused() AudioControls::onPlaybackPaused()
{ {
tDebug( LOGEXTRA ) << Q_FUNC_INFO; tDebug( LOGEXTRA ) << Q_FUNC_INFO;
ui->stackedLayout->setCurrentWidget( ui->playPauseButton ); ui->playPauseButton->setVisible( true );
ui->pauseButton->setVisible( false );
m_sliderTimeLine.setPaused( true ); m_sliderTimeLine.setPaused( true );
} }
@@ -471,7 +454,8 @@ void
AudioControls::onPlaybackResumed() AudioControls::onPlaybackResumed()
{ {
tDebug( LOGEXTRA ) << Q_FUNC_INFO; tDebug( LOGEXTRA ) << Q_FUNC_INFO;
ui->stackedLayout->setCurrentWidget( ui->pauseButton ); ui->playPauseButton->setVisible( false );
ui->pauseButton->setVisible( true );
m_seeked = true; m_seeked = true;
onPlaybackTimer( m_lastSliderCheck ); onPlaybackTimer( m_lastSliderCheck );
} }
@@ -504,7 +488,8 @@ AudioControls::onPlaybackStopped()
m_phononTickCheckTimer.stop(); m_phononTickCheckTimer.stop();
ui->ownerButton->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultResolver, TomahawkUtils::Original, QSize( 34, 34 ) ) ); ui->ownerButton->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultResolver, TomahawkUtils::Original, QSize( 34, 34 ) ) );
ui->stackedLayout->setCurrentWidget( ui->playPauseButton ); ui->playPauseButton->setVisible( true );
ui->pauseButton->setVisible( false );
/* ui->loveButton->setEnabled( false ); /* ui->loveButton->setEnabled( false );
ui->loveButton->setVisible( false ); ui->loveButton->setVisible( false );
ui->socialButton->setEnabled( false ); ui->socialButton->setEnabled( false );

View File

@@ -6,14 +6,17 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1014</width> <width>1043</width>
<height>108</height> <height>112</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin"> <property name="leftMargin">
<number>32</number> <number>32</number>
</property> </property>
@@ -24,17 +27,17 @@
<number>32</number> <number>32</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>24</number> <number>16</number>
</property> </property>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="margin"> <property name="spacing">
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,0,0"> <layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,0,0,0,0">
<property name="margin"> <property name="spacing">
<number>0</number> <number>8</number>
</property> </property>
<item> <item>
<spacer name="horizontalSpacer_4"> <spacer name="horizontalSpacer_4">
@@ -118,9 +121,9 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,1,0,0,0"> <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,2,0,0,0,0,0,0,0,0,0,0">
<property name="margin"> <property name="spacing">
<number>0</number> <number>8</number>
</property> </property>
<item> <item>
<widget class="QWidget" name="buttonArea" native="true"> <widget class="QWidget" name="buttonArea" native="true">
@@ -144,12 +147,21 @@
</property> </property>
<layout class="QHBoxLayout" name="buttonAreaLayout"> <layout class="QHBoxLayout" name="buttonAreaLayout">
<property name="spacing"> <property name="spacing">
<number>0</number> <number>8</number>
</property> </property>
<property name="sizeConstraint"> <property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum> <enum>QLayout::SetMinimumSize</enum>
</property> </property>
<property name="margin"> <property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
@@ -176,29 +188,31 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<layout class="QStackedLayout" name="stackedLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="ImageButton" name="playPauseButton"> <widget class="ImageButton" name="playPauseButton">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string notr="true" extracomment="not translatable because is placeholder text">Play</string> <string notr="true" extracomment="not translatable because is placeholder text">Play</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item>
<widget class="ImageButton" name="pauseButton"> <widget class="ImageButton" name="pauseButton">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string notr="true" extracomment="not translatable because is placeholder text">Pause</string> <string notr="true" extracomment="not translatable because is placeholder text">Pause</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout>
</item>
<item> <item>
<spacer name="horizontalSpacer_8"> <spacer name="horizontalSpacer_8">
<property name="orientation"> <property name="orientation">
@@ -247,7 +261,7 @@
<string notr="true" extracomment="not translatable because is placeholder text">Time</string> <string notr="true" extracomment="not translatable because is placeholder text">Time</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
@@ -282,7 +296,7 @@
<string notr="true" extracomment="not translatable because is placeholder text">Time Left</string> <string notr="true" extracomment="not translatable because is placeholder text">Time Left</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignTop</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>