OTHER: Fix crash on disconnected server.
Promoe now displays a message box, telling about what happened and terminates correctly after that
This commit is contained in:
parent
c0ca792481
commit
8221642227
4 changed files with 22 additions and 3 deletions
|
@ -137,6 +137,9 @@ try_again:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// useing normal disconnect callback, if that causes problems,
|
||||||
|
// an own method schould be created
|
||||||
|
setDisconnectCallback (boost::bind (&XClient::disconnect, this));
|
||||||
m_isconnected = true;
|
m_isconnected = true;
|
||||||
emit gotConnection (this);
|
emit gotConnection (this);
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ class XClient : public QObject {
|
||||||
public:
|
public:
|
||||||
XClient (QObject *, const std::string &);
|
XClient (QObject *, const std::string &);
|
||||||
|
|
||||||
void disconnect ();
|
|
||||||
bool connect (const char *path = NULL, const bool &sync = false,
|
bool connect (const char *path = NULL, const bool &sync = false,
|
||||||
QWidget* parent = NULL);
|
QWidget* parent = NULL);
|
||||||
static void propDictToQHash (const std::string &key,
|
static void propDictToQHash (const std::string &key,
|
||||||
|
@ -92,6 +91,9 @@ class XClient : public QObject {
|
||||||
void gotConnection (XClient *);
|
void gotConnection (XClient *);
|
||||||
void disconnected (XClient *);
|
void disconnected (XClient *);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void disconnect ();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Xmms::Client *m_client;
|
Xmms::Client *m_client;
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
MainDisplay::MainDisplay (QWidget *parent) : SkinDisplay(parent)
|
MainDisplay::MainDisplay (QWidget *parent) : SkinDisplay(parent)
|
||||||
{
|
{
|
||||||
|
@ -110,8 +111,21 @@ MainDisplay::MainDisplay (QWidget *parent) : SkinDisplay(parent)
|
||||||
client.volumeGet();
|
client.volumeGet();
|
||||||
|
|
||||||
setupServerConfig ();
|
setupServerConfig ();
|
||||||
|
|
||||||
|
//TODO: move to better place
|
||||||
|
connect (&client, SIGNAL(disconnected(XClient *)), this, SLOT(handleDisconnected ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MainDisplay::handleDisconnected ()
|
||||||
|
{
|
||||||
|
QMessageBox::critical( this, "xmms2 daemon disconnecte",
|
||||||
|
"The xmms2 deamon has disconnected\n"
|
||||||
|
"This could be because the server crashed\n"
|
||||||
|
"or because another client has shut down the sever.",
|
||||||
|
"Quit Promoe");
|
||||||
|
qApp->quit ();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MainDisplay::updateVolume (uint volume)
|
MainDisplay::updateVolume (uint volume)
|
||||||
|
|
|
@ -77,7 +77,7 @@ class MainDisplay : public SkinDisplay
|
||||||
protected slots:
|
protected slots:
|
||||||
void serverConfigChanged (QString key, QString value);
|
void serverConfigChanged (QString key, QString value);
|
||||||
void setRepeatAllEnabled (bool enabled);
|
void setRepeatAllEnabled (bool enabled);
|
||||||
|
void handleDisconnected ();
|
||||||
protected:
|
protected:
|
||||||
void SetupPushButtons (void);
|
void SetupPushButtons (void);
|
||||||
void SetupToggleButtons (void);
|
void SetupToggleButtons (void);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue