SpotifySession::SpotifySession( sessionConfig config, QObject *parent )
   : QObject( parent )
   , m_pcLoaded( false )
   , m_sessionConfig( config )
   , m_loggedIn( false )
   , m_relogin( false )
{

    // Instance
    s_instance = this;
    // Friends
    m_SpotifyPlaylists = new SpotifyPlaylists( this );
    connect( m_SpotifyPlaylists, SIGNAL( sendLoadedPlaylist( SpotifyPlaylists::LoadedPlaylist ) ), this, SLOT(playlistReceived(SpotifyPlaylists::LoadedPlaylist) ) );

    // Playlist cachemiss fix
    // @note: bad way of handling exitfails
    connect( m_SpotifyPlaylists, SIGNAL( forcePruneCache() ), this, SLOT( relogin() ) );

    m_SpotifyPlayback = new SpotifyPlayback( this );

    // Connect to signals
    connect( this, SIGNAL( notifyMainThreadSignal() ), this, SLOT( notifyMainThread() ), Qt::QueuedConnection );
    qDebug() << " === Using LibVersion " << SPOTIFY_API_VERSION << " ===";
    // User needs to create session himself, that way, config
    //createSession();
}
Example #2
0
void WsseAuthorization::initialize()
{
    ui = new QWidget();
    layout = new QHBoxLayout();
    usernameLabel = new QLabel("User not logged in");
    reloginBtn = new QPushButton("Relogin");
    layout->setMargin(0);
    layout->addWidget(usernameLabel);
    layout->addWidget(reloginBtn);
    ui->setLayout(layout);

    authDialog = new AuthDialog(ui);

    connect(reloginBtn, SIGNAL(clicked()), this, SLOT(relogin()));
}
Example #3
0
void IrcClient::dnsresolved(const boost::system::error_code & ec, const boost::asio::ip::tcp::resolver::iterator &endpoint_iterator, boost::shared_ptr<boost::asio::ip::tcp::resolver>  resolver)
{
    if (!ec)
    {
        boost::asio::async_connect(socket_, endpoint_iterator,
            boost::bind(&IrcClient::handle_connect_request, this,
            boost::asio::placeholders::error));
    }
    else
    {
        relogin();
#ifdef DEBUG
        std::cout << "Error: " << ec.message() << "\n";
#endif
    }
}
Example #4
0
void IrcClient::handle_connect_request(const boost::system::error_code& err)
{
    if (!err)
    {
        connected();

        boost::asio::async_read_until(socket_, response_, "\r\n",
            boost::bind(&IrcClient::handle_read_request, this,
            boost::asio::placeholders::error,boost::asio::placeholders::bytes_transferred));
    }
    else if (err != boost::asio::error::eof)
    {
        relogin();
#ifdef DEBUG
        std::cout << "Error: " << err.message() << "\n";
#endif
    }
}
Example #5
0
void IrcClient::handle_write_request(const boost::system::error_code& err, std::size_t bytewrited)
{    
    if (!err)    
    {		
        request_.consume(bytewrited);		
        if (request_.size())			
            boost::asio::async_write(socket_,
            request_,
            boost::bind(&IrcClient::handle_write_request, this,boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); 
    }    
    else    
    {
        relogin();
#ifdef DEBUG        
        std::cout << "Error: " << err.message() << "\n";
#endif
    }
}
Example #6
0
App::App() : KUniqueApplication()
    ,m_networkAccessManager(new NetworkAccessManager(this))
    ,m_oauth(new QOAuth::Interface(this))
    ,m_parser(new QJson::Parser)
    ,m_mainWindow(0)
    ,m_controller(0)
    ,m_tray(0)
{
    qmlRegisterType<QDeclarativePropertyMap>();

    m_controller = new Controller;
    m_mainWindow = new MainWindow;
    m_tray = new KStatusNotifierItem(m_mainWindow);
    m_tray->setIconByName("kmoefm");
    m_tray->setTitle(i18n("Moe FM"));
    m_tray->setToolTipIconByName("kmoefm");
    m_tray->setToolTipTitle(i18n("KMoeFM"));
    m_tray->setToolTipSubTitle(i18n("Moe FM"));
    KAction* action;
    action = m_tray->actionCollection()->addAction(QLatin1String("relogin"), this, SLOT(relogin()));
    action->setText(i18n("Relogin"));
    m_tray->contextMenu()->addAction(action);
    m_tray->setAssociatedWidget(m_mainWindow);

    connect(m_controller, SIGNAL(infoChanged()), this, SLOT(updateInfo()));

    m_oauth->setConsumerKey(CONSUMER_KEY);
    m_oauth->setConsumerSecret(CONSUMER_SECRET);

    readSettings();

    connect(this, SIGNAL(checkCredentialFinished(bool)), SLOT(firstRunCheck(bool)));
    QTimer::singleShot(0, this, SLOT(checkCredential()));
}