Esempio n. 1
0
MyTagsTuner::MyTagsTuner()
{
	setItemDelegate( new StationDelegate );
	WsReply* reply = AuthenticatedUser().getTopTags();
	connect( reply, SIGNAL( finished( WsReply*)), SLOT(onFetchedTags( WsReply*)) );
	connect( this, SIGNAL( itemClicked( QListWidgetItem* )), SLOT( onTagClicked( QListWidgetItem*)) );
}
Esempio n. 2
0
unicorn::Application::Application( int& argc, char** argv ) throw( StubbornUserException )
                    : QApplication( argc, argv ),
                      m_logoutAtQuit( false )
{
#ifdef Q_WS_MAC
    qt_mac_set_menubar_icons( false );
#endif    
    
    CoreApplication::init();

#ifdef __APPLE__
    AEEventHandlerUPP h = NewAEEventHandlerUPP( appleEventHandler );
    AEInstallEventHandler( kCoreEventClass, kAEReopenApplication, h, 0, false );
#endif

    translate();

    CoreSettings s;
    if (s.value( "Username" ).toString().isEmpty() || s.value( "SessionKey" ).toString().isEmpty() || Settings().logOutOnExit())
    {
        LoginDialog d( s.value( "Username" ).toString() );
        if (d.exec() == QDialog::Accepted)
        {
            // if LogOutOnExit is enabled, really, we shouldn't store these,
            // but it means other Unicorn apps can log in while the client is 
            // loaded, and we delete the settings on exit if logOut is on
            s.setValue( "Username", d.username() );
            s.setValue( "SessionKey", d.sessionKey() );
            s.setValue( "Password", d.passwordHash() );
            
            UserSettings().setValue( UserSettings::subscriptionKey(), d.isSubscriber() );
        }
        else
        {
            throw StubbornUserException();
        }
    }

    Ws::Username = s.value( "Username" ).toString();
    Ws::SessionKey = s.value( "SessionKey" ).toString();
    
    connect( AuthenticatedUser().getInfo(), SIGNAL(finished( WsReply* )), SLOT(onUserGotInfo( WsReply* )) );

#ifdef __APPLE__
    setQuitOnLastWindowClosed( false );
#endif
}
Esempio n. 3
0
TrackDashboard::TrackDashboard()
{   
    nam = new WsAccessManager( this );
    
    ui.papyrus = new QWidget( this );    
    ui.cover = new PrettyCoverWidget;
    ui.cover->setParent( ui.papyrus );
    
    connect( ui.cover, SIGNAL( clicked()), SLOT( onCoverClicked()));
    
    setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
    
    ui.info = new QWidget( ui.papyrus );
    QVBoxLayout* v = new QVBoxLayout( ui.info );
    
    v->addWidget( ui.bio = new BioWebView );

    v->addSpacing( 10 );
    v->addWidget( new QLabel( tr( HEADING "Tags") ) );
    v->addSpacing( 3 );
    v->addWidget( ui.tags = new ListView );
    ((ListView*)ui.tags)->setSeedType( Seed::TagType );
    v->addSpacing( 10 );
    v->addWidget( new QLabel( tr( HEADING "Similar Artists") ) );
    v->addSpacing( 3 );
    v->addWidget( ui.similarArtists = new ListView );
    ((ListView*)ui.similarArtists)->setSeedType( Seed::ArtistType );
    v->setMargin( 0 );
    v->setSpacing( 0 );

    ui.bio->page()->mainFrame()->setScrollBarPolicy( Qt::Vertical, Qt::ScrollBarAlwaysOff );
    ui.bio->page()->mainFrame()->setScrollBarPolicy( Qt::Horizontal, Qt::ScrollBarAlwaysOff );
    ui.bio->page()->setLinkDelegationPolicy( QWebPage::DelegateExternalLinks );
    ui.bio->setAutoFillBackground( true );
    connect( ui.bio, SIGNAL(linkClicked( const QUrl& )), SLOT(openExternally( const QUrl& )) );

    ui.scrollbar = new FadingScrollBar( this );
    ui.scrollbar->setVisible( false );
    connect( ui.scrollbar, SIGNAL(valueChanged( int )), SLOT(setPapyrusPosition( int )) );

#ifndef Q_WS_MAC
    // mac has finer grained scrolling, and acceleration
    ui.scrollbar->setSingleStep( 9 );
#endif

    UnicornWidget::paintItBlack( this );
    UnicornWidget::paintItBlack( ui.bio );
    setAutoFillBackground( true );

    QPalette p = palette();
    QColor c( 0x0e, 0x0e, 0x0e );
    p.setColor( QPalette::Window, c );
    p.setColor( QPalette::Base, Qt::transparent );
    p.setColor( QPalette::Text, Qt::white );
    setPalette( p );
    p.setColor( QPalette::Text, QColor( 0xa3, 0xa5, 0xa8 ) );
    ui.bio->setPalette( p );

	ui.spinner = new SpinnerLabel( this );
    ui.spinner->move( 10, 10 );

    clear();

    setAttribute( Qt::WA_MacNoClickThrough );
    
    ui.sources = new QPushButton( AuthenticatedUser().name(), this );
}