void QSpotifySession::onLoggedIn() { qDebug() << "Logged in"; if (m_user) return; m_isLoggedIn = true; m_user = new QSpotifyUser(sp_session_user(m_sp_session)); m_user->init(); setScrobble(settings.value("scrobble", false).toBool()); lfmLogin(settings.value("lfmUser", "").toString(), settings.value("lfmPass", "").toString()); m_pending_connectionRequest = false; emit pendingConnectionRequestChanged(); emit isLoggedInChanged(); emit userChanged(); if(!m_uriToOpen.isEmpty()) { handleUri(m_uriToOpen); m_uriToOpen = ""; } sp_session_flush_caches(m_sp_session); checkNetworkAccess(); qDebug() << "Done"; }
SpotifySearch::SpotifySearch(QWidget *parent) : QWidget(parent), ui(new Ui::SpotifySearch), _session(0), _search(new QSpotifySearch(this)) { ui->setupUi(this); login(); _session = QSpotifySession::instance(); connect(_session, SIGNAL(isLoggedInChanged()), this, SLOT(loggedIn())); connect(this->ui->lineEdit, SIGNAL(returnPressed()), this, SLOT(search())); connect(_search, SIGNAL(resultsChanged()), this, SLOT(resultsChanged())); _collection = Core::ICore::createMediaCollection("org.safri.collection.audio", "Spotify", ICore::storageDirectory()+"/Spotify"); PluginSystem::PluginManager::instance()->addObject(_collection); }
void QSpotifySession::onLoggedOut() { qDebug() << "QSpotifySession::onLoggedOut"; if (!m_explicitLogout) return; if(m_aboutToQuit) { m_aboutToQuit = false; emit readyToQuit(); return; } m_explicitLogout = false; m_isLoggedIn = false; m_pending_connectionRequest = false; emit pendingConnectionRequestChanged(); emit isLoggedInChanged(); }