Ejemplo n.º 1
0
void
TrackWidget::onShareClicked()
{
    QMenu* shareMenu = new QMenu( this );

    shareMenu->addAction( tr( "Share on Last.fm" ), this, SLOT(onShareLastFm()) );
    shareMenu->addAction( tr( "Share on Twitter" ), this, SLOT(onShareTwitter()) );
    shareMenu->addAction( tr( "Share on Facebook" ), this, SLOT(onShareFacebook()) );

    shareMenu->exec( cursor().pos() );
}
Ejemplo n.º 2
0
ScrobbleControls::ScrobbleControls( QWidget* parent )
    :QFrame( parent )
{
    QHBoxLayout* layout = new QHBoxLayout( this );
    layout->setContentsMargins( 0, 0, 0, 0 );
    layout->setSpacing( 5 );

    layout->addWidget(ui.love = new QPushButton(tr("love")), 0, Qt::AlignCenter);
    ui.love->setObjectName("love");
    ui.love->setCheckable( true );
    ui.love->setToolTip( tr( "Love track" ) );
    connect( ui.love, SIGNAL( clicked(bool) ), SLOT( onLoveChanged( bool ) ) );
 
    layout->addWidget(ui.tag = new QPushButton(tr("tag")), 0, Qt::AlignCenter);
    ui.tag->setObjectName("tag");
    ui.tag->setToolTip( tr( "Add tags" ) );

    layout->addWidget(ui.share = new QPushButton(tr("share")), 0, Qt::AlignCenter);
    ui.share->setObjectName("share");
    ui.share->setToolTip( tr( "Share" ) );

    QMenu* shareMenu = new QMenu( this );
    shareMenu->addAction( tr( "Share on Last.fm" ), this, SLOT(onShareLastFm()) );
    shareMenu->addAction( tr( "Share on Twitter" ), this, SLOT(onShareTwitter()) );
    shareMenu->addAction( tr( "Share on Facebook" ), this, SLOT(onShareFacebook()) );
    ui.share->setMenu( shareMenu );

    layout->addWidget(ui.buy = new QPushButton(tr("buy")), 0, Qt::AlignCenter);
    ui.buy->setObjectName("buy");
    ui.buy->setToolTip( tr( "Buy" ) );
    ui.buy->setVisible( false );

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

    layout->addStretch( 1 );

    new QShortcut( QKeySequence( Qt::CTRL + Qt::Key_S ), ui.share, SLOT( click() ) );
    new QShortcut( QKeySequence( Qt::CTRL + Qt::Key_T ), ui.tag, SLOT( click() ) );
    new QShortcut( QKeySequence( Qt::CTRL + Qt::Key_L ), ui.love, SLOT( toggle() ) );
    new QShortcut( QKeySequence( Qt::CTRL + Qt::Key_B ), ui.buy, SLOT( click() ) );

    connect( ui.tag, SIGNAL( clicked()), SLOT( onTag()));
    //connect( ui.share, SIGNAL( clicked()), SLOT( onShare()));
}