示例#1
0
void SongdisplayWidget::updateDisplay()
{
    if (currentTrack->isValid())
    {
        this->title->setText( currentTrack->getUrl().toString() );
        this->artist->setText( "artist" );
        this->album->setText( "album" );

        QUrl url = preferences->getBaseUrl();
        url.setPath( url.path() + "/track/image" );

        url.addEncodedQueryItem(
            QString( "track_id" ).toUtf8(),
            QString::number( currentTrack->getID() ).toUtf8()
        );

        QNetworkRequest request = QNetworkRequest( url );
        manager->get( request );
    }
    else
    {
        setDefaultIcon();
    }

}
示例#2
0
文件: Button.cpp 项目: bramstein/ui
	void Button::init(Icon *icon,const std::string &label)
	{
		setThemeName("Button");
		setDefaultIcon(icon);
		addMouseListener(this);
		addFocusListener(this);
		setText(label);
	}
示例#3
0
void SongdisplayWidget::responseImageData( QNetworkReply *reply )
{
    if (200 == reply->attribute(QNetworkRequest::HttpStatusCodeAttribute))
    {
        QPixmap image;
        QByteArray bytes = reply->readAll();
        image.loadFromData(bytes);
        image = image.scaled(64, 64);
        this->cover->setPixmap(image);
    }
    else
    {
        setDefaultIcon();
    }
}
示例#4
0
void QFStyledButton::setBuddyWithDefaultIcon(QWidget* b, ActionMode mode) {
    setBuddy(b, mode);
    setDefaultIcon(mode);
}
示例#5
0
SongdisplayWidget::SongdisplayWidget( QWidget *parent ) :
    QWidget( parent )
{
    this->cover = new QLabel( this );
    this->cover->setFixedSize( 64, 64 );
    setDefaultIcon();

    // Build the rows
    this->title = new QLabel( this );
    QFont font = this->title->font();
    font.setPointSize( font.pointSize() + 5 );
    this->title->setFont( font );
    this->title->setMinimumWidth( 300 );
    this->title->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
    this->artist = new QLabel( this );
    this->album = new QLabel( this );

    this->song_box = new QWidget();

    QVBoxLayout *layout = new QVBoxLayout( this );
    layout->addWidget( this->title );
    layout->addWidget( this->artist );
    layout->addWidget( this->album );
    this->song_box->setLayout( layout );

    QHBoxLayout *foo = new QHBoxLayout( this );

    foo->addWidget( this->cover );
    foo->addWidget( this->song_box );

    this->setLayout( foo );

    QPalette sample_palette;
    sample_palette.setColor( QPalette::Window, Qt::black );
    sample_palette.setColor( QPalette::WindowText, Qt::gray );

    this->setAutoFillBackground( true );
    this->setPalette( sample_palette );
    //this->setText("What ever text");

    QPalette sample_palette2;
    sample_palette2.setColor( QPalette::Window, Qt::black );
    sample_palette2.setColor( QPalette::WindowText, QColor( 200, 200, 200 ) );

    this->title->setPalette( sample_palette2 );
    this->title->setText( "1111" );

    sample_palette2.setColor( QPalette::Window, Qt::black );
    sample_palette2.setColor( QPalette::WindowText, QColor( 150, 150, 150 ) );

    this->artist->setPalette( sample_palette2 );
    this->artist->setText( "2222" );

    sample_palette2.setColor( QPalette::Window, Qt::black );
    sample_palette2.setColor( QPalette::WindowText, QColor( 100, 100, 100 ) );

    this->album->setPalette( sample_palette2 );
    this->album->setText( "3333" );

    this->currentTrack = new Track();

    manager = new QNetworkAccessManager();

    setupSignals();

}