DNSSD
servicemodel.h
Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 * 00003 * Copyright (C) 2008 Jakub Stachowski <qbast@go2.pl> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public License 00016 * along with this library; see the file COPYING.LIB. If not, write to 00017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef DNSSDSERVICEMODEL_H 00022 #define DNSSDSERVICEMODEL_H 00023 00024 #include <QtCore/QAbstractItemModel> 00025 #include <dnssd/dnssd_export.h> 00026 #include <dnssd/remoteservice.h> 00027 00028 namespace DNSSD 00029 { 00030 00031 struct ServiceModelPrivate; 00032 class ServiceBrowser; 00033 00034 00066 class KDNSSD_EXPORT ServiceModel : public QAbstractItemModel 00067 { 00068 Q_OBJECT 00069 00070 public: 00071 00073 enum AdditionalRoles { 00074 ServicePtrRole = 0xA06519DE 00075 }; 00076 00083 enum ModelColumns { 00084 ServiceName = 0, 00085 Host = 1, 00086 Port = 2 00087 }; 00088 00099 explicit ServiceModel(ServiceBrowser* browser, QObject* parent = 0); 00100 00101 virtual ~ServiceModel(); 00102 00104 virtual int columnCount(const QModelIndex& parent = QModelIndex() ) const; 00106 virtual int rowCount(const QModelIndex& parent = QModelIndex() ) const; 00108 virtual QModelIndex parent(const QModelIndex& index ) const; 00110 virtual QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex() ) const; 00112 virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole ) const; 00114 virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; 00116 virtual bool hasIndex(int row, int column, const QModelIndex &parent) const; 00117 00118 private: 00119 ServiceModelPrivate* const d; 00120 friend struct ServiceModelPrivate; 00121 00122 }; 00123 00124 } 00125 00126 #endif
KDE 4.6 API Reference