SpotifySettingsPage::SpotifySettingsPage(SettingsDialog* dialog) : SettingsPage(dialog), network_(new NetworkAccessManager(this)), ui_(new Ui_SpotifySettingsPage), service_(InternetModel::Service<SpotifyService>()), validated_(false) { ui_->setupUi(this); setWindowIcon(QIcon(":/icons/svg/spotify.svg")); QFont bold_font(font()); bold_font.setBold(true); ui_->blob_status->setFont(bold_font); connect(ui_->download_blob, SIGNAL(clicked()), SLOT(DownloadBlob())); connect(ui_->login, SIGNAL(clicked()), SLOT(Login())); connect(ui_->login_state, SIGNAL(LogoutClicked()), SLOT(Logout())); connect(ui_->login_state, SIGNAL(LoginClicked()), SLOT(Login())); connect(service_, SIGNAL(LoginFinished(bool)), SLOT(LoginFinished(bool))); connect(service_, SIGNAL(BlobStateChanged()), SLOT(BlobStateChanged())); ui_->login_state->AddCredentialField(ui_->username); ui_->login_state->AddCredentialField(ui_->password); ui_->login_state->AddCredentialGroup(ui_->account_group); BlobStateChanged(); }
SpotifySettingsPage::SpotifySettingsPage(SettingsDialog* dialog) : SettingsPage(dialog), ui_(new Ui_SpotifySettingsPage), service_(InternetModel::Service<SpotifyService>()), validated_(false) { ui_->setupUi(this); setWindowIcon(QIcon(":/icons/48x48/spotify.png")); QFont bold_font(font()); bold_font.setBold(true); ui_->blob_status->setFont(bold_font); connect(ui_->download_blob, SIGNAL(clicked()), SLOT(DownloadBlob())); connect(ui_->login, SIGNAL(clicked()), SLOT(Login())); connect(ui_->login_state, SIGNAL(LogoutClicked()), SLOT(Logout())); connect(ui_->login_state, SIGNAL(LoginClicked()), SLOT(Login())); connect(service_, SIGNAL(LoginFinished(bool)), SLOT(LoginFinished(bool))); connect(service_, SIGNAL(BlobStateChanged()), SLOT(BlobStateChanged())); ui_->login_state->AddCredentialField(ui_->username); ui_->login_state->AddCredentialField(ui_->password); ui_->login_state->AddCredentialGroup(ui_->account_group); ui_->bitrate->addItem("96 " + tr("kbps"), pb::spotify::Bitrate96k); ui_->bitrate->addItem("160 " + tr("kbps"), pb::spotify::Bitrate160k); ui_->bitrate->addItem("320 " + tr("kbps"), pb::spotify::Bitrate320k); BlobStateChanged(); }
void SpotifyService::InstallBlob() { // The downloader deletes itself when it finishes SpotifyBlobDownloader* downloader = new SpotifyBlobDownloader( local_blob_version_, QFileInfo(local_blob_path_).path(), this); connect(downloader, SIGNAL(Finished()), SLOT(BlobDownloadFinished())); connect(downloader, SIGNAL(Finished()), SIGNAL(BlobStateChanged())); downloader->Start(); }