qcp/libqcp/qcpmodel.h

65 lines
1.4 KiB
C++

#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);
QCP::Share share() const { return m_share; }
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);
QCP::Share share(); /* try to find first share */
protected:
virtual Avahi::model::Entry* newEntry(const Avahi::Service &s, void *priv);
};
class LIBQCPSHARED_EXPORT Root : public Avahi::model::Root {
public:
virtual int columnCount();
virtual QVariant emptyData(int col, int role);
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