2010-07-24 16:16:44 +00:00
|
|
|
#ifndef QCPMODEL_H
|
|
|
|
#define QCPMODEL_H
|
|
|
|
|
|
|
|
#include "qcp.h"
|
|
|
|
#include "../libqtavahi/qtavahimodel.h"
|
|
|
|
|
|
|
|
namespace QCP {
|
|
|
|
namespace model {
|
|
|
|
class LIBQCPSHARED_EXPORT Entry : public Avahi::model::Entry {
|
|
|
|
public:
|
|
|
|
Entry(Row *parent, const Avahi::Service &s, const QCP::Share &share);
|
|
|
|
|
|
|
|
virtual QVariant data(int col, int role);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
QCP::Share m_share;
|
|
|
|
};
|
|
|
|
|
|
|
|
class LIBQCPSHARED_EXPORT EntryList : public Avahi::model::EntryList {
|
|
|
|
public:
|
|
|
|
EntryList(Row *parent, const Avahi::ServiceKey &k);
|
|
|
|
|
|
|
|
virtual int columnCount();
|
|
|
|
|
|
|
|
virtual QVariant data(int col, int role);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual Avahi::model::Entry* newEntry(const Avahi::Service &s, void *priv);
|
|
|
|
};
|
|
|
|
|
|
|
|
class LIBQCPSHARED_EXPORT Root : public Avahi::model::Root {
|
|
|
|
public:
|
|
|
|
virtual int columnCount();
|
2010-07-24 23:42:13 +00:00
|
|
|
virtual QVariant emptyData(int col, int role);
|
2010-07-24 16:16:44 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual EntryList* newList(const Avahi::ServiceKey &k);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
class LIBQCPSHARED_EXPORT BrowseModel : public Avahi::BrowseModel {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
BrowseModel(QObject *parent = 0);
|
|
|
|
|
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
|
|
|
|
|
|
|
QCP::Browse *browse() { return m_browse; }
|
|
|
|
|
|
|
|
protected slots:
|
|
|
|
void foundShare(QCP::Share s);
|
|
|
|
void lostShare(QCP::Share s);
|
|
|
|
|
|
|
|
private:
|
|
|
|
QCP::Browse *m_browse;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // QCPMODEL_H
|