Add a "sign out" button to the last.fm config dialog, and add an option to hide the "love" and "ban" buttons. Updates issue #156.
This commit is contained in:
parent
59a113b532
commit
931273b9ea
|
@ -31,6 +31,7 @@ LastFMConfig::LastFMConfig(QWidget *parent)
|
|||
ui_.busy->hide();
|
||||
|
||||
connect(service_, SIGNAL(AuthenticationComplete(bool)), SLOT(AuthenticationComplete(bool)));
|
||||
connect(ui_.sign_out, SIGNAL(clicked()), SLOT(SignOut()));
|
||||
}
|
||||
|
||||
bool LastFMConfig::NeedsValidation() const {
|
||||
|
@ -62,13 +63,23 @@ void LastFMConfig::AuthenticationComplete(bool success) {
|
|||
void LastFMConfig::Load() {
|
||||
ui_.username->setText(lastfm::ws::Username);
|
||||
ui_.scrobble->setChecked(service_->IsScrobblingEnabled());
|
||||
ui_.love_ban_->setChecked(service_->AreButtonsVisible());
|
||||
ui_.sign_out->setEnabled(!lastfm::ws::SessionKey.isEmpty());
|
||||
}
|
||||
|
||||
void LastFMConfig::Save() {
|
||||
QSettings s;
|
||||
s.beginGroup(LastFMService::kSettingsGroup);
|
||||
s.setValue("ScrobblingEnabled", ui_.scrobble->isChecked());
|
||||
s.setValue("ShowLoveBanButtons", ui_.love_ban_->isChecked());
|
||||
s.endGroup();
|
||||
|
||||
service_->ReloadSettings();
|
||||
}
|
||||
|
||||
void LastFMConfig::SignOut() {
|
||||
ui_.username->clear();
|
||||
ui_.password->clear();
|
||||
ui_.sign_out->setEnabled(false);
|
||||
service_->SignOut();
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ class LastFMConfig : public QWidget {
|
|||
|
||||
private slots:
|
||||
void AuthenticationComplete(bool success);
|
||||
void SignOut();
|
||||
|
||||
private:
|
||||
LastFMService* service_;
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>385</width>
|
||||
<height>213</height>
|
||||
<width>386</width>
|
||||
<height>235</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
|
@ -31,7 +31,31 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="username"/>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="username"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="sign_out">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sign out</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<normaloff>:/list-remove.png</normaloff>:/list-remove.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
|
@ -47,18 +71,28 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="scrobble">
|
||||
<property name="text">
|
||||
<string>Scrobble tracks that I listen to</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="scrobble">
|
||||
<property name="text">
|
||||
<string>Scrobble tracks that I listen to</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="love_ban_">
|
||||
<property name="text">
|
||||
<string>Show the "love" and "ban" buttons</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
|
@ -124,6 +158,15 @@
|
|||
<header>busyindicator.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<tabstops>
|
||||
<tabstop>username</tabstop>
|
||||
<tabstop>password</tabstop>
|
||||
<tabstop>scrobble</tabstop>
|
||||
<tabstop>love_ban_</tabstop>
|
||||
<tabstop>sign_out</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../data/data.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<height>295</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
|
|
@ -87,8 +87,10 @@ void LastFMService::ReloadSettings() {
|
|||
lastfm::ws::Username = settings.value("Username").toString();
|
||||
lastfm::ws::SessionKey = settings.value("Session").toString();
|
||||
scrobbling_enabled_ = settings.value("ScrobblingEnabled", true).toBool();
|
||||
buttons_visible_ = settings.value("ShowLoveBanButtons", true).toBool();
|
||||
|
||||
emit ScrobblingEnabledChanged(scrobbling_enabled_);
|
||||
emit ButtonVisibilityChanged(buttons_visible_);
|
||||
}
|
||||
|
||||
void LastFMService::ShowConfig() {
|
||||
|
@ -187,6 +189,16 @@ void LastFMService::Authenticate(const QString& username, const QString& passwor
|
|||
connect(reply, SIGNAL(finished()), SLOT(AuthenticateReplyFinished()));
|
||||
}
|
||||
|
||||
void LastFMService::SignOut() {
|
||||
lastfm::ws::Username.clear();
|
||||
lastfm::ws::SessionKey.clear();
|
||||
|
||||
QSettings settings;
|
||||
settings.beginGroup(kSettingsGroup);
|
||||
settings.setValue("Username", QString());
|
||||
settings.setValue("Session", QString());
|
||||
}
|
||||
|
||||
void LastFMService::AuthenticateReplyFinished() {
|
||||
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
|
||||
if (!reply) {
|
||||
|
|
|
@ -95,8 +95,10 @@ class LastFMService : public RadioService {
|
|||
// Last.fm specific stuff
|
||||
bool IsAuthenticated() const;
|
||||
bool IsScrobblingEnabled() const { return scrobbling_enabled_; }
|
||||
bool AreButtonsVisible() const { return buttons_visible_; }
|
||||
|
||||
void Authenticate(const QString& username, const QString& password);
|
||||
void SignOut();
|
||||
|
||||
void FetchMoreTracks();
|
||||
|
||||
|
@ -109,6 +111,7 @@ class LastFMService : public RadioService {
|
|||
signals:
|
||||
void AuthenticationComplete(bool success);
|
||||
void ScrobblingEnabledChanged(bool value);
|
||||
void ButtonVisibilityChanged(bool value);
|
||||
|
||||
private slots:
|
||||
void AuthenticateReplyFinished();
|
||||
|
@ -169,6 +172,7 @@ class LastFMService : public RadioService {
|
|||
bool initial_tune_;
|
||||
|
||||
bool scrobbling_enabled_;
|
||||
bool buttons_visible_;
|
||||
|
||||
RadioItem* artist_list_;
|
||||
RadioItem* tag_list_;
|
||||
|
|
|
@ -305,8 +305,11 @@ MainWindow::MainWindow(QNetworkAccessManager* network, QWidget *parent)
|
|||
connect(radio_model_, SIGNAL(StreamMetadataFound(QUrl,Song)), playlist_, SLOT(SetStreamMetadata(QUrl,Song)));
|
||||
connect(radio_model_, SIGNAL(AddItemToPlaylist(RadioItem*)), SLOT(InsertRadioItem(RadioItem*)));
|
||||
connect(radio_model_->GetLastFMService(), SIGNAL(ScrobblingEnabledChanged(bool)), SLOT(ScrobblingEnabledChanged(bool)));
|
||||
connect(radio_model_->GetLastFMService(), SIGNAL(ButtonVisibilityChanged(bool)), SLOT(LastFMButtonVisibilityChanged(bool)));
|
||||
connect(ui_.radio_view, SIGNAL(doubleClicked(QModelIndex)), SLOT(RadioDoubleClick(QModelIndex)));
|
||||
|
||||
LastFMButtonVisibilityChanged(radio_model_->GetLastFMService()->AreButtonsVisible());
|
||||
|
||||
// Tray icon
|
||||
QMenu* tray_menu = new QMenu(this);
|
||||
tray_menu->addAction(ui_.action_previous_track);
|
||||
|
@ -481,6 +484,12 @@ void MainWindow::ScrobblingEnabledChanged(bool value) {
|
|||
ui_.action_love->setEnabled(value);
|
||||
}
|
||||
|
||||
void MainWindow::LastFMButtonVisibilityChanged(bool value) {
|
||||
ui_.action_ban->setVisible(value);
|
||||
ui_.action_love->setVisible(value);
|
||||
ui_.last_fm_controls->setVisible(value);
|
||||
}
|
||||
|
||||
void MainWindow::resizeEvent(QResizeEvent*) {
|
||||
SaveGeometry();
|
||||
}
|
||||
|
|
|
@ -104,6 +104,7 @@ class MainWindow : public QMainWindow {
|
|||
void RadioDoubleClick(const QModelIndex& index);
|
||||
void InsertRadioItem(RadioItem*);
|
||||
void ScrobblingEnabledChanged(bool value);
|
||||
void LastFMButtonVisibilityChanged(bool value);
|
||||
void Love();
|
||||
|
||||
void LibraryScanStarted();
|
||||
|
|
|
@ -169,7 +169,7 @@
|
|||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<widget class="Line" name="lastfm_line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
|
|
|
@ -651,12 +651,18 @@ msgstr "Níže zadejte přihlašovací údaje pro Last.fm:"
|
|||
msgid "Last.fm username"
|
||||
msgstr "Uživatelské jméno k Last.fm"
|
||||
|
||||
msgid "Sign out"
|
||||
msgstr ""
|
||||
|
||||
msgid "Last.fm password"
|
||||
msgstr "Heslo k Last.fm"
|
||||
|
||||
msgid "Scrobble tracks that I listen to"
|
||||
msgstr "Skrobbovat skladby, které poslouchám"
|
||||
|
||||
msgid "Show the \"love\" and \"ban\" buttons"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"Note that you must be a <span style=\" font-weight:600;\">paid subscriber</"
|
||||
"span> to listen to Last.fm radio from within Clementine."
|
||||
|
|
|
@ -654,12 +654,18 @@ msgstr "Εισάγετε τις λεπτομέρειες για το Last.fm:"
|
|||
msgid "Last.fm username"
|
||||
msgstr "Last.fm όνομα χρήστη"
|
||||
|
||||
msgid "Sign out"
|
||||
msgstr ""
|
||||
|
||||
msgid "Last.fm password"
|
||||
msgstr "Last.fm συνθηματικό"
|
||||
|
||||
msgid "Scrobble tracks that I listen to"
|
||||
msgstr "Κάνε \"srobble\" τα κομμάτια που ακούω"
|
||||
|
||||
msgid "Show the \"love\" and \"ban\" buttons"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"Note that you must be a <span style=\" font-weight:600;\">paid subscriber</"
|
||||
"span> to listen to Last.fm radio from within Clementine."
|
||||
|
|
|
@ -656,12 +656,18 @@ msgstr "Ingrese su información de Last.fm debajo:"
|
|||
msgid "Last.fm username"
|
||||
msgstr "Usuario"
|
||||
|
||||
msgid "Sign out"
|
||||
msgstr ""
|
||||
|
||||
msgid "Last.fm password"
|
||||
msgstr "Contraseña"
|
||||
|
||||
msgid "Scrobble tracks that I listen to"
|
||||
msgstr "Enviar las pistas que reproduzco"
|
||||
|
||||
msgid "Show the \"love\" and \"ban\" buttons"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"Note that you must be a <span style=\" font-weight:600;\">paid subscriber</"
|
||||
"span> to listen to Last.fm radio from within Clementine."
|
||||
|
|
|
@ -655,12 +655,18 @@ msgstr "Inscrivez vos identifiants Last.fm ci-dessous :"
|
|||
msgid "Last.fm username"
|
||||
msgstr "Nom d'utilisateur"
|
||||
|
||||
msgid "Sign out"
|
||||
msgstr ""
|
||||
|
||||
msgid "Last.fm password"
|
||||
msgstr "Mot de passe"
|
||||
|
||||
msgid "Scrobble tracks that I listen to"
|
||||
msgstr "Envoyer les titres des pistes que j'écoute (scrobble)"
|
||||
|
||||
msgid "Show the \"love\" and \"ban\" buttons"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"Note that you must be a <span style=\" font-weight:600;\">paid subscriber</"
|
||||
"span> to listen to Last.fm radio from within Clementine."
|
||||
|
|
|
@ -649,12 +649,18 @@ msgstr "Podaj swoje dane dla Last.fm:"
|
|||
msgid "Last.fm username"
|
||||
msgstr "Użytkownik Last.fm"
|
||||
|
||||
msgid "Sign out"
|
||||
msgstr ""
|
||||
|
||||
msgid "Last.fm password"
|
||||
msgstr "Hasło Last.fm"
|
||||
|
||||
msgid "Scrobble tracks that I listen to"
|
||||
msgstr "Wysyłaj informacje o utworach których słucham"
|
||||
|
||||
msgid "Show the \"love\" and \"ban\" buttons"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"Note that you must be a <span style=\" font-weight:600;\">paid subscriber</"
|
||||
"span> to listen to Last.fm radio from within Clementine."
|
||||
|
|
|
@ -650,12 +650,18 @@ msgstr "Введите ваши данные Last.fm:"
|
|||
msgid "Last.fm username"
|
||||
msgstr "Логин Last.fm"
|
||||
|
||||
msgid "Sign out"
|
||||
msgstr ""
|
||||
|
||||
msgid "Last.fm password"
|
||||
msgstr "Пароль Last.fm"
|
||||
|
||||
msgid "Scrobble tracks that I listen to"
|
||||
msgstr "Скробблить треки, которые я слушаю"
|
||||
|
||||
msgid "Show the \"love\" and \"ban\" buttons"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"Note that you must be a <span style=\" font-weight:600;\">paid subscriber</"
|
||||
"span> to listen to Last.fm radio from within Clementine."
|
||||
|
|
|
@ -652,12 +652,18 @@ msgstr "Vložte svoje Last.fm detaily nižšie:"
|
|||
msgid "Last.fm username"
|
||||
msgstr "Last.fm použ. meno"
|
||||
|
||||
msgid "Sign out"
|
||||
msgstr ""
|
||||
|
||||
msgid "Last.fm password"
|
||||
msgstr "Last.fm heslo"
|
||||
|
||||
msgid "Scrobble tracks that I listen to"
|
||||
msgstr ""
|
||||
|
||||
msgid "Show the \"love\" and \"ban\" buttons"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"Note that you must be a <span style=\" font-weight:600;\">paid subscriber</"
|
||||
"span> to listen to Last.fm radio from within Clementine."
|
||||
|
|
|
@ -645,12 +645,18 @@ msgstr ""
|
|||
msgid "Last.fm username"
|
||||
msgstr ""
|
||||
|
||||
msgid "Sign out"
|
||||
msgstr ""
|
||||
|
||||
msgid "Last.fm password"
|
||||
msgstr ""
|
||||
|
||||
msgid "Scrobble tracks that I listen to"
|
||||
msgstr ""
|
||||
|
||||
msgid "Show the \"love\" and \"ban\" buttons"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"Note that you must be a <span style=\" font-weight:600;\">paid subscriber</"
|
||||
"span> to listen to Last.fm radio from within Clementine."
|
||||
|
|
Loading…
Reference in New Issue