Esempio n. 1
0
AudioPlayer::AudioPlayer(QObject *parent) :
    QObject(parent), m_state(Stopped), m_audio(0), m_codec(0)
{
    qRegisterMetaType<State>("State");

    AudioImageProvider::setCurrentAudioPlayer(this);

    connect(MediaLibrary::instance(), SIGNAL(artwork(QImage)), this, SLOT(artworkReady(QImage)));

    qDebug() << "constructing audioplayer" << this;
}
Esempio n. 2
0
void TestMetaManager::read()
{
    QString album("Album: " + _meta->album());
    QString artist("Artist: " + _meta->artist());
    QString artwork("Artwork: " + _meta->artwork());
    QString copyright("Copyright: " + _meta->copyright());
    QString description("Description: " + _meta->description());
    QString encoder("Encoder: " + _meta->encoder());
    QString genre("Genre: " + _meta->genre());
    QString id("ID: " + _meta->id());
    QString language("Language: " + _meta->language());
    QString number("Number: " + QString().number(_meta->number()));
    QString publisher("Publisher: " + _meta->publisher());
    QString rating("Rating: " + _meta->rating());
    QString setting("Setting: " + _meta->setting());
    QString title("Title: " + _meta->title());
    QString url("Url: " + _meta->url());
    QString year("Year: " + QString().number(_meta->year()));

    ui->labelMeta->setText(album + "\n" + artist + "\n" + artwork + "\n" + copyright + "\n" +
                           description + "\n" + encoder + "\n" + genre + "\n" + id + "\n" +
                           language + "\n" + number + "\n" + publisher + "\n" + rating + "\n" +
                           setting + "\n" + title + "\n" + url + "\n" + year + "\n");
}
Esempio n. 3
0
void TabWidget::paintEvent( QPaintEvent * pe )
{
	QPainter p( this );
	p.setFont( pointSize<7>( font() ) );

	// Draw background
	QBrush bg_color = p.background();
	p.fillRect( 0, 0, width() - 1, height() - 1, bg_color );

	// Draw external borders
	p.setPen( tabBorder() );
	p.drawRect( 0, 0, width() - 1, height() - 1 );

	// Draw tabs' bar background
	p.fillRect( 1, 1, width() - 2, m_tabheight + 2, tabBackground() );

	// Draw title, if any
	if( ! m_caption.isEmpty() )
	{
		p.setFont( pointSize<8>( p.font() ) );
		p.setPen( tabTitleText() );
		p.drawText( 5, 11, m_caption );
	}

	// Calculate the tabs' x (tabs are painted next to the caption)
	int tab_x_offset = m_caption.isEmpty() ? 4 : 14 + fontMetrics().width( m_caption );

	// Compute tabs' width depending on the number of tabs (only applicable for artwork tabs)
	widgetStack::iterator first = m_widgets.begin();
	widgetStack::iterator last = m_widgets.end();
	int tab_width = width();
	if ( first != last )
	{
		tab_width = ( width() - tab_x_offset ) / std::distance( first, last );
	}

	// Draw all tabs
	p.setPen( tabText() );
	for( widgetStack::iterator it = first ; it != last ; ++it )
	{
		// Draw a text tab or a artwork tab.
		if( m_usePixmap )
		{
			// Fixes tab's width, because original size is only correct for text tabs
			( *it ).nwidth = tab_width;

			// Get artwork
			QPixmap artwork( embed::getIconPixmap( ( *it ).pixmap ) );

			// Highlight active tab
			if( it.key() == m_activeTab )
			{
				p.fillRect( tab_x_offset, 0, ( *it ).nwidth, m_tabbarHeight - 1, tabSelected() );
			}

			// Draw artwork
			p.drawPixmap(tab_x_offset + ( ( *it ).nwidth - artwork.width() ) / 2, 1, artwork );
		}
		else
		{
			// Highlight tab when active
			if( it.key() == m_activeTab )
			{
				p.fillRect( tab_x_offset, 2, ( *it ).nwidth - 6, m_tabbarHeight - 4, tabSelected() );
			}

			// Draw text
			p.drawText( tab_x_offset + 3, m_tabheight + 1, ( *it ).name );
		}

		// Next tab's horizontal position
		tab_x_offset += ( *it ).nwidth;
	}
}