Added AVAHI support to promoe. Check the promoe.pro file to enable / disable it.

This commit is contained in:
Tobias Rundstrom 2006-03-09 00:42:12 -03:00
parent dec1b66342
commit 056e50ea51
7 changed files with 280 additions and 5 deletions

57
ServerBrowser.h Normal file
View file

@ -0,0 +1,57 @@
#ifndef __SERVER_BROWSER_H__
#define __SERVER_BROWSER_H__
#include "XMMSHandler.h"
#include <QWidget>
#include <QListWidget>
#include <QMainWindow>
#include <QLabel>
#include <QVBoxLayout>
#include <avahi-client/client.h>
#include <avahi-client/lookup.h>
#include <avahi-common/malloc.h>
#include <avahi-common/error.h>
#include <avahi-qt4/qt-watch.h>
class ServerItem : public QListWidgetItem {
public:
ServerItem (QIcon i, const QString &name, const QString &path, QListWidget *parent) :
QListWidgetItem (i, name, parent) {
m_path = path;
setToolTip (m_path);
}
QString path (void) const { return m_path; }
private:
QString m_path;
};
class ServerBrowserList : public QListWidget {
Q_OBJECT
public:
ServerBrowserList (QWidget *parent);
~ServerBrowserList ();
void addServer (const QString &, const QString &);
bool setupAvahi (void);
AvahiClient *client (void) const { return m_client; }
public slots:
void connectServer (QListWidgetItem *);
private:
const AvahiPoll *m_poll;
AvahiClient *m_client;
AvahiServiceBrowser *m_sb;
};
class ServerBrowserWindow : public QMainWindow {
Q_OBJECT
public:
ServerBrowserWindow (QWidget *parent);
~ServerBrowserWindow () {}
private:
ServerBrowserList *m_list;
};
#endif