00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef KSG_SENSORBROWSER_H
00025 #define KSG_SENSORBROWSER_H
00026
00027 #include <tqdict.h>
00028
00029 #include <klistview.h>
00030 #include <ksgrd/SensorClient.h>
00031
00032 class TQMouseEvent;
00033
00034 namespace KSGRD {
00035 class SensorManager;
00036 class SensorAgent;
00037 }
00038
00039 class SensorInfo;
00040 class HostInfo;
00041
00046 class SensorBrowser : public KListView, public KSGRD::SensorClient
00047 {
00048 Q_OBJECT
00049
00050 public:
00051 SensorBrowser( TQWidget* parent, KSGRD::SensorManager* sm, const char* name = 0 );
00052 ~SensorBrowser();
00053
00054 TQStringList listHosts();
00055 TQStringList listSensors( const TQString &hostName );
00056
00057 public slots:
00058 void disconnect();
00059 void hostReconfigured( const TQString &hostName );
00060 void update();
00061 void newItemSelected( TQListViewItem *item );
00062
00063 protected:
00064 virtual void viewportMouseMoveEvent( TQMouseEvent* );
00065
00066 private:
00067 void answerReceived( int id, const TQString& );
00068
00069 KSGRD::SensorManager* mSensorManager;
00070
00071 TQPtrList<HostInfo> mHostInfoList;
00072 TQString mDragText;
00073
00074 };
00075
00079 class SensorInfo
00080 {
00081 public:
00082 SensorInfo( TQListViewItem *lvi, const TQString &name, const TQString &desc,
00083 const TQString &type );
00084 ~SensorInfo() {}
00085
00089 TQListViewItem* listViewItem() const;
00090
00094 const TQString& name() const;
00095
00099 const TQString& description() const;
00100
00104 const TQString& type() const;
00105
00106 private:
00107 TQListViewItem* mLvi;
00108 TQString mName;
00109 TQString mDesc;
00110 TQString mType;
00111 };
00112
00113 class HostInfo
00114 {
00115 public:
00116 HostInfo( int id, const KSGRD::SensorAgent *agent, const TQString &name,
00117 TQListViewItem *lvi );
00118 ~HostInfo() { }
00119
00123 int id() const;
00124
00128 const KSGRD::SensorAgent* sensorAgent() const;
00129
00133 const TQString& hostName() const;
00134
00138 TQListViewItem* listViewItem() const;
00139
00143 const TQString& sensorName( const TQListViewItem *lvi ) const;
00144
00148 TQStringList allSensorNames() const;
00149
00153 const TQString& sensorType( const TQListViewItem *lvi ) const;
00154
00158 const TQString& sensorDescription( const TQListViewItem *lvi ) const;
00159
00168 void addSensor( TQListViewItem *lvi, const TQString& name,
00169 const TQString& desc, const TQString& type );
00170
00175 bool isRegistered( const TQString& name ) const;
00176
00181 bool isRegistered( TQListViewItem *lvi ) const;
00182
00183 private:
00184 int mId;
00185
00186 const KSGRD::SensorAgent* mSensorAgent;
00187 const TQString mHostName;
00188 TQListViewItem* mLvi;
00189
00190 TQPtrList<SensorInfo> mSensorList;
00191 };
00192
00193 #endif