Re-enable 'love' button if action fails
This commit is contained in:
committed by
craig.p.drummond
parent
fd77d09325
commit
3b3a5e1d44
@@ -1550,6 +1550,7 @@ void MPDConnection::sendClientMessage(const QString &client, const QString &msg,
|
||||
{
|
||||
if (!sendCommand("sendmessage "+client.toUtf8()+" "+msg.toUtf8(), false).ok) {
|
||||
emit error(i18n("Failed to send '%1' to %2. Please check %2 is registered with MPD.", msg, clientName.isEmpty() ? client : clientName));
|
||||
emit clientMessageFailed(client, msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -341,6 +341,8 @@ Q_SIGNALS:
|
||||
void editedStream(const QString &url, const QString &name, quint32 position);
|
||||
void streamList(const QList<Stream> &streams);
|
||||
|
||||
void clientMessageFailed(const QString &client, const QString &msg);
|
||||
|
||||
private Q_SLOTS:
|
||||
void idleDataReady();
|
||||
void onSocketStateChanged(QAbstractSocket::SocketState socketState);
|
||||
|
||||
@@ -189,6 +189,7 @@ Scrobbler::Scrobbler()
|
||||
connect(hardFailTimer, SIGNAL(timeout()), this, SLOT(authenticate()));
|
||||
loadSettings();
|
||||
connect(this, SIGNAL(clientMessage(QString,QString,QString)), MPDConnection::self(), SLOT(sendClientMessage(QString,QString,QString)));
|
||||
connect(MPDConnection::self(), SIGNAL(clientMessageFailed(QString,QString)), SLOT(clientMessageFailed(QString,QString)));
|
||||
}
|
||||
|
||||
Scrobbler::~Scrobbler()
|
||||
@@ -706,6 +707,15 @@ void Scrobbler::mpdStateUpdated()
|
||||
}
|
||||
}
|
||||
|
||||
void Scrobbler::clientMessageFailed(const QString &client, const QString &msg)
|
||||
{
|
||||
if (loveSent && client==scrobblerUrl() && msg==QLatin1String("love")) {
|
||||
// 'love' failed, so re-enable...
|
||||
loveSent=lovePending=false;
|
||||
emit songChanged(true);
|
||||
}
|
||||
}
|
||||
|
||||
void Scrobbler::cancelJobs()
|
||||
{
|
||||
if (authJob) {
|
||||
|
||||
@@ -108,6 +108,7 @@ private Q_SLOTS:
|
||||
void authResp();
|
||||
void scrobbleFinished();
|
||||
void mpdStateUpdated();
|
||||
void clientMessageFailed(const QString &client, const QString &msg);
|
||||
|
||||
private:
|
||||
void setActive();
|
||||
|
||||
Reference in New Issue
Block a user