Esempio n. 1
0
void VideosWindow::onContextMenuRequested(const QPoint &pos)
{
    if (ui->objectList->currentIndex().data(UserRoleHeader).toBool()) return;

    QMenu *contextMenu = new KbMenu(this);
    contextMenu->setAttribute(Qt::WA_DeleteOnClose);
    contextMenu->addAction(tr("Delete"), this, SLOT(onDeleteClicked()));
    contextMenu->addAction(tr("Share"), this, SLOT(onShareClicked()));
    contextMenu->addAction(tr("Details"), this, SLOT(onDetailsClicked()));
    contextMenu->exec(this->mapToGlobal(pos));
}
Esempio n. 2
0
TrackWidget::TrackWidget( Track& track, QWidget *parent )
    :QPushButton(parent),
    ui( new Ui::TrackWidget ),
    m_nowPlaying( false ),
    m_triedFetchAlbumArt( false )
{
    ui->setupUi( this );

    m_spinner = new QLabel( this );
    m_spinner->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
    m_spinner->hide();

    m_movie = new QMovie( ":/icon_eq.gif", "GIF", this );
    m_movie->setCacheMode( QMovie::CacheAll );
    ui->equaliser->setMovie( m_movie );

    ui->buttonLayout->setAlignment( ui->love, Qt::AlignTop );
    ui->buttonLayout->setAlignment( ui->tag, Qt::AlignTop );
    ui->buttonLayout->setAlignment( ui->share, Qt::AlignTop );
    ui->buttonLayout->setAlignment( ui->buy, Qt::AlignTop );
    ui->trackTitleLayout->setAlignment( ui->asterisk, Qt::AlignTop );

    ui->albumArt->setAttribute( Qt::WA_LayoutUsesWidgetRect );
    ui->love->setAttribute( Qt::WA_LayoutUsesWidgetRect );
    ui->tag->setAttribute( Qt::WA_LayoutUsesWidgetRect );
    ui->share->setAttribute( Qt::WA_LayoutUsesWidgetRect );
    ui->buy->setAttribute( Qt::WA_LayoutUsesWidgetRect );

    setAttribute( Qt::WA_MacNoClickThrough );
    ui->albumArt->setAttribute( Qt::WA_MacNoClickThrough );
    ui->love->setAttribute( Qt::WA_MacNoClickThrough );
    ui->tag->setAttribute( Qt::WA_MacNoClickThrough );
    ui->share->setAttribute( Qt::WA_MacNoClickThrough );
    ui->buy->setAttribute( Qt::WA_MacNoClickThrough );

    connect( ui->love, SIGNAL(clicked(bool)), SLOT(onLoveClicked(bool)));
    connect( ui->tag, SIGNAL(clicked()), SLOT(onTagClicked()));
    connect( ui->share, SIGNAL(clicked()), SLOT(onShareClicked()));
    connect( ui->buy, SIGNAL(clicked()), SLOT(onBuyClicked()));

    connect( this, SIGNAL(clicked()), SLOT(onClicked()) );

    setTrack( track );
}