File indexing completed on 2024-05-19 05:00:42
0001 /* 0002 SPDX-FileCopyrightText: 2004 Jakub Stachowski <qbast@go2.pl> 0003 0004 SPDX-License-Identifier: LGPL-2.0-only 0005 */ 0006 0007 #ifndef _WATCHER_H_ 0008 #define _WATCHER_H_ 0009 0010 #include <QObject> 0011 0012 class QString; 0013 0014 namespace KDNSSD { 0015 class ServiceBrowser; 0016 class ServiceTypeBrowser; 0017 } 0018 0019 class Watcher : public QObject 0020 { 0021 Q_OBJECT 0022 public: 0023 Watcher(); 0024 0025 unsigned int refcount; 0026 protected: 0027 virtual QUrl constructUrl() const = 0; 0028 0029 protected Q_SLOTS: 0030 void scheduleUpdate(); 0031 void finished(); 0032 0033 private: 0034 bool updateNeeded; 0035 }; 0036 0037 class TypeWatcher : public Watcher 0038 { 0039 Q_OBJECT 0040 public: 0041 TypeWatcher(); 0042 protected: 0043 QUrl constructUrl() const Q_DECL_OVERRIDE; 0044 private: 0045 KDNSSD::ServiceTypeBrowser* typebrowser; 0046 }; 0047 0048 class ServiceWatcher : public Watcher 0049 { 0050 Q_OBJECT 0051 public: 0052 explicit ServiceWatcher(const QString& type); 0053 protected: 0054 QUrl constructUrl() const Q_DECL_OVERRIDE; 0055 private: 0056 KDNSSD::ServiceBrowser* browser; 0057 QString m_type; 0058 }; 0059 0060 #endif