mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-14 01:54:07 +02:00
* Remove date picker widget. Should probably be replace with a jump to date link.
This commit is contained in:
@@ -37,47 +37,8 @@
|
|||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
HistoryWidget::HistoryWidget( const source_ptr& source, QWidget* parent )
|
HistoryWidget::HistoryWidget( const source_ptr& source, QWidget* parent )
|
||||||
: FlexibleView( parent, m_header = new QWidget() )
|
: FlexibleView( parent )
|
||||||
{
|
{
|
||||||
m_header->setMaximumHeight( 160 );
|
|
||||||
/* QCalendarWidget* m_calendarFrom = new QCalendarWidget();
|
|
||||||
QCalendarWidget* m_calendarTo = new QCalendarWidget();
|
|
||||||
m_calendarFrom->setGridVisible( false );
|
|
||||||
m_calendarTo->setGridVisible( false );*/
|
|
||||||
m_calendarFrom = new QDateEdit( QDate::currentDate() );
|
|
||||||
m_calendarTo = new QDateEdit( QDate::currentDate() );
|
|
||||||
m_calendarFrom->setDisplayFormat( "yyyy MMMM dd" );
|
|
||||||
m_calendarTo->setDisplayFormat( "yyyy MMMM dd" );
|
|
||||||
|
|
||||||
// setting an empty style-sheet prevents the QDateEdits from adopting their parent's QPalette
|
|
||||||
QString calSheet = QString( "QDateEdit {}" );
|
|
||||||
m_calendarFrom->setStyleSheet( calSheet );
|
|
||||||
m_calendarTo->setStyleSheet( calSheet );
|
|
||||||
|
|
||||||
QPalette pal = m_header->palette();
|
|
||||||
pal.setColor( QPalette::Foreground, TomahawkStyle::HEADER_TEXT );
|
|
||||||
pal.setColor( QPalette::Text, TomahawkStyle::HEADER_TEXT );
|
|
||||||
pal.setColor( foregroundRole(), TomahawkStyle::HEADER_TEXT );
|
|
||||||
pal.setBrush( backgroundRole(), TomahawkStyle::HEADER_BACKGROUND.lighter() );
|
|
||||||
m_header->setPalette( pal );
|
|
||||||
m_header->setAutoFillBackground( true );
|
|
||||||
|
|
||||||
QLabel* fromLabel = new QLabel( tr( "From:" ) );
|
|
||||||
fromLabel->setPalette( m_header->palette() );
|
|
||||||
QLabel* toLabel = new QLabel( tr( "To:" ) );
|
|
||||||
toLabel->setPalette( m_header->palette() );
|
|
||||||
QHBoxLayout* layout = new QHBoxLayout( m_header );
|
|
||||||
layout->setContentsMargins( 4, 4, 4, 4 );
|
|
||||||
layout->setSpacing( 4 );
|
|
||||||
layout->addSpacerItem( new QSpacerItem( 1, 0, QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ) );
|
|
||||||
layout->addWidget( fromLabel );
|
|
||||||
layout->addWidget( m_calendarFrom );
|
|
||||||
layout->addSpacerItem( new QSpacerItem( 16, 0, QSizePolicy::Fixed, QSizePolicy::Minimum ) );
|
|
||||||
layout->addWidget( toLabel );
|
|
||||||
layout->addWidget( m_calendarTo );
|
|
||||||
layout->addSpacerItem( new QSpacerItem( 1, 0, QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ) );
|
|
||||||
m_header->setLayout( layout );
|
|
||||||
|
|
||||||
setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::RecentlyPlayed ) );
|
setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::RecentlyPlayed ) );
|
||||||
|
|
||||||
m_model = new RecentlyPlayedModel( this );
|
m_model = new RecentlyPlayedModel( this );
|
||||||
@@ -96,11 +57,6 @@ HistoryWidget::HistoryWidget( const source_ptr& source, QWidget* parent )
|
|||||||
m_model->setSource( source );
|
m_model->setSource( source );
|
||||||
|
|
||||||
setGuid( QString( "recentplays/%1" ).arg( source->nodeId() ) );
|
setGuid( QString( "recentplays/%1" ).arg( source->nodeId() ) );
|
||||||
|
|
||||||
/* connect( m_calendarFrom, SIGNAL( clicked( QDate ) ), SLOT( onDateClicked( QDate ) ) );
|
|
||||||
connect( m_calendarTo, SIGNAL( clicked( QDate ) ), SLOT( onDateClicked( QDate ) ) );*/
|
|
||||||
connect( m_calendarFrom, SIGNAL( dateChanged( QDate ) ), SLOT( onDateClicked( QDate ) ) );
|
|
||||||
connect( m_calendarTo, SIGNAL( dateChanged( QDate ) ), SLOT( onDateClicked( QDate ) ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -112,7 +68,7 @@ HistoryWidget::~HistoryWidget()
|
|||||||
void
|
void
|
||||||
HistoryWidget::onDateClicked( const QDate& date )
|
HistoryWidget::onDateClicked( const QDate& date )
|
||||||
{
|
{
|
||||||
QDateEdit* cw = qobject_cast< QDateEdit* >( sender() );
|
/* QDateEdit* cw = qobject_cast< QDateEdit* >( sender() );
|
||||||
if ( cw == m_calendarFrom && date > m_calendarTo->date())
|
if ( cw == m_calendarFrom && date > m_calendarTo->date())
|
||||||
{
|
{
|
||||||
m_calendarTo->setDate( date );
|
m_calendarTo->setDate( date );
|
||||||
@@ -124,5 +80,5 @@ HistoryWidget::onDateClicked( const QDate& date )
|
|||||||
|
|
||||||
m_model->setLimit( 0 );
|
m_model->setLimit( 0 );
|
||||||
m_model->setDateFrom( m_calendarFrom->date() );
|
m_model->setDateFrom( m_calendarFrom->date() );
|
||||||
m_model->setDateTo( m_calendarTo->date() );
|
m_model->setDateTo( m_calendarTo->date() );*/
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,6 @@ private slots:
|
|||||||
void onDateClicked( const QDate& date );
|
void onDateClicked( const QDate& date );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget* m_header;
|
|
||||||
RecentlyPlayedModel* m_model;
|
RecentlyPlayedModel* m_model;
|
||||||
|
|
||||||
/* QCalendarWidget* m_calendarFrom;
|
/* QCalendarWidget* m_calendarFrom;
|
||||||
|
Reference in New Issue
Block a user