OTHER: Make the mainloop inherit Xmms::MainloopInterface.

Also made it orphan (Xmms::Client deletes it properly). This should be
added as a shared library compiled with the bindings if QT libraries are
available.
This commit is contained in:
Jonne Lehtinen 2006-05-27 13:24:00 +03:00 committed by Tobias Rundstrom
parent 70da726f52
commit a18cea60f0
3 changed files with 20 additions and 14 deletions

View file

@ -1,11 +1,17 @@
#include <xmmsclient/xmmsclient++/mainloop.h>
#include <xmmsclient/xmmsclient.h>
#include "XmmsQT4.h"
#include <QApplication>
#include <QObject>
#include <QSocketNotifier>
static void CheckWrite (int i, void *userdata);
XmmsQT4::XmmsQT4 (xmmsc_connection_t *xmmsc, QObject *parent) : QObject (parent)
XmmsQT4::XmmsQT4 (xmmsc_connection_t *xmmsc) :
QObject (), Xmms::MainloopInterface (xmmsc),
m_fd (0), m_rsock (0), m_wsock (0), m_xmmsc (xmmsc)
{
m_xmmsc = xmmsc;
m_fd = xmmsc_io_fd_get (xmmsc);
xmmsc_io_need_out_callback_set (xmmsc, CheckWrite, this);
@ -25,6 +31,9 @@ XmmsQT4::~XmmsQT4 ()
delete m_wsock;
}
void XmmsQT4::run ()
{
}
xmmsc_connection_t *XmmsQT4::GetXmmsConnection ()
{
@ -54,13 +63,11 @@ void XmmsQT4::ToggleWrite (bool toggle)
static void CheckWrite (int i, void *userdata)
{
XmmsQT4 *obj = (XmmsQT4 *) userdata;
xmmsc_connection_t *xmmsc = obj->GetXmmsConnection();
XmmsQT4 *obj = static_cast< XmmsQT4* > (userdata);
if (xmmsc_io_want_out (xmmsc)) {
if (xmmsc_io_want_out (obj->GetXmmsConnection ())) {
obj->ToggleWrite (true);
} else {
obj->ToggleWrite (false);
}
}