dispatcher.h
00001 /* This file is part of the KDE project 00002 Copyright (C) 2003 Matthias Kretz <kretz@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 00018 */ 00019 00020 #ifndef KSETTINGS_DISPATCHER_H 00021 #define KSETTINGS_DISPATCHER_H 00022 00023 #include <tqobject.h> 00024 #include <tqmap.h> 00025 #include <tdelibs_export.h> 00026 00027 class TQCString; 00028 class TQSignal; 00029 class TQStrList; 00030 template<class T> class KStaticDeleter; 00031 class TDEInstance; 00032 class TDEConfig; 00033 00034 namespace KSettings 00035 { 00036 00051 class TDEUTILS_EXPORT Dispatcher : public TQObject 00052 { 00053 friend class KStaticDeleter<Dispatcher>; 00054 00055 Q_OBJECT 00056 public: 00060 static Dispatcher * self(); 00061 00074 void registerInstance( TDEInstance * instance, TQObject * recv, const char * slot ); 00075 00079 TDEConfig * configForInstanceName( const TQCString & instanceName ); 00080 00085 TQStrList instanceNames() const; 00086 00087 //X /** 00088 //X * @return The TDEInstance object belonging to the instance name you pass 00089 //X * (only works for registered instances of course). 00090 //X */ 00091 //X TDEInstance * instanceForName( const TQCString & instanceName ); 00092 00093 public slots: 00100 void reparseConfiguration( const TQCString & instanceName ); 00101 00108 void syncConfiguration(); 00109 00110 private slots: 00111 void unregisterInstance( TQObject * ); 00112 00113 private: 00114 Dispatcher( TQObject * parent = 0, const char * name = 0 ); 00115 ~Dispatcher(); 00116 static Dispatcher * m_self; 00117 00118 struct InstanceInfo { 00119 TDEInstance * instance; 00120 TQSignal * signal; 00121 int count; 00122 }; 00123 TQMap<TQCString, InstanceInfo> m_instanceInfo; 00124 TQMap<TQObject *, TQCString> m_instanceName; 00125 00126 class DispatcherPrivate; 00127 DispatcherPrivate * d; 00128 }; 00129 00130 } 00131 00132 // vim: sw=4 sts=4 et 00133 #endif // KSETTINGS_DISPATCHER_H