diff options
Diffstat (limited to 'kradio3/src/include/interfaces.h')
-rw-r--r-- | kradio3/src/include/interfaces.h | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/kradio3/src/include/interfaces.h b/kradio3/src/include/interfaces.h index dced1d7..1719315 100644 --- a/kradio3/src/include/interfaces.h +++ b/kradio3/src/include/interfaces.h @@ -22,8 +22,8 @@ #include <config.h> #endif -#include <qptrlist.h> -#include <qmap.h> +#include <tqptrlist.h> +#include <tqmap.h> #include <kdebug.h> #include <typeinfo> @@ -65,20 +65,20 @@ To provide queries or a delivery feedback for messages, wrapper functions would have been necessary. - - Qt does not support multiple inheritance of QObjects. Thus even signals + - TQt does not support multiple inheritance of TQObjects. Thus even signals have to be declared abstract by the interface though the (later) implementation is already known. Those functions have to be declared as signals in the interface - implementation (derived from QObject) though the implementation does not + implementation (derived from TQObject) though the implementation does not want to worry about these signals. - - Qt does connect functions (signals/slots) and not interfaces. These + - TQt does connect functions (signals/slots) and not interfaces. These functions have to be connected separately. By that it is possible to forget to connect signals/slots of that interfaces. - - Aggregation of multiple interface implementations (each one is an QObject) - is not possible because qt does not allow multiple inheritance of QObjects + - Aggregation of multiple interface implementations (each one is an TQObject) + is not possible because qt does not allow multiple inheritance of TQObjects ///////////////////////////////////////////////////////////////////////////// @@ -87,7 +87,7 @@ Well, it eliminates at least the qt-problems explained above. But first we need a common mechanism to manage interface connections. This functionality can be provided by a common base class "InterfaceBase". It stores all - connected interfaces in a list of InterfaceBase pointers, e.g. QPtrList. + connected interfaces in a list of InterfaceBase pointers, e.g. TQPtrList. With this approach we would have some problems: @@ -145,7 +145,7 @@ - sending Messages Declare a virtual constant method with return value "int" and the desired - parameters. The return value will indicate how many receivers have handled + parameters. The return value will indicate how many tqreceivers have handled the message: virtual bool SendingMessages(int any_or_non_param) const; @@ -168,7 +168,7 @@ The method has to be implemented by a derived class. The current item of the - receivers conntions list is set to the sender. + tqreceivers conntions list is set to the sender. - querying queries @@ -180,7 +180,7 @@ Abbreviation by macros: - IF_QUERY( int QueryingQueries(int another_param) ) + IF_TQUERY( int QueryingQueries(int another_param) ) - answering queries @@ -195,7 +195,7 @@ IF_ANSWER( AnsweringQueries(int another_param) ) The method has to be implemented by a derived class. The current item of the - receivers conntions list is set to the sender. + tqreceivers conntions list is set to the sender. At last a note on maxConnections. This member is set on initialization by @@ -207,7 +207,7 @@ How do I use it ? - Implementations - Because we do not have a MOC as Qt does, we have to implement our sending + Because we do not have a TQMOC as TQt does, we have to implement our sending or querying methods by hand. But this minor disadvantage should be considered as less important than the fact, that this implementation is done where it belongs to. Especially because there are easy to use macros @@ -216,12 +216,12 @@ int ComplementaryInterface::SendingMessages(int any_or_non_param) const { IF_SEND_MESSAGE( ReceivingMessages(any_or_non_param) ) - // macro includes "return #receivers" + // macro includes "return #tqreceivers" } int ComplementaryInterface::QueryingQueries(int another_param) const { - IF_SEND_QUERY( AnsweringQuery(another_param), (int)"default return value" ) + IF_SEND_TQUERY( AnsweringQuery(another_param), (int)"default return value" ) } @@ -231,7 +231,7 @@ AnsweringQueries(param) ) - IF_IMPL_QUERY( int ComplementaryInterface::SendingMessages(int param), + IF_IMPL_TQUERY( int ComplementaryInterface::SendingMessages(int param), ReceivingMessages(param), (int)"default return value" ) @@ -337,8 +337,8 @@ public: typedef thisIF thisInterface; typedef cmplIF cmplInterface; - typedef QPtrList<cmplIF> IFList; - typedef QPtrListIterator<cmplIF> IFIterator; + typedef TQPtrList<cmplIF> IFList; + typedef TQPtrListIterator<cmplIF> IFIterator; typedef thisClass BaseClass; @@ -373,7 +373,7 @@ public: thisIF *initThisInterfacePointer(); thisIF *getThisInterfacePointer() const { return me; } bool isThisInterfacePointerValid() const { return me_valid; } - bool hasConnectionTo(cmplInterface *other) const { return iConnections.containsRef(other); } + bool hasConnectionTo(cmplInterface *other) const { return iConnections.tqcontainsRef(other); } void appendConnectionTo(cmplInterface *other) { iConnections.append(other); } void removeConnectionTo(cmplInterface *other) { iConnections.removeRef(other); } @@ -384,11 +384,11 @@ protected : // functions for individually selectable callbacks protected: - bool addListener (const cmplInterface *i, QPtrList<cmplInterface> &list); - void removeListener(const cmplInterface *i, QPtrList<cmplInterface> &list); + bool addListener (const cmplInterface *i, TQPtrList<cmplInterface> &list); + void removeListener(const cmplInterface *i, TQPtrList<cmplInterface> &list); void removeListener(const cmplInterface *i); - QMap<const cmplInterface *, QPtrList<QPtrList<cmplInterface> > > m_FineListeners; + TQMap<const cmplInterface *, TQPtrList<TQPtrList<cmplInterface> > > m_FineListeners; private: thisInterface *me; @@ -414,12 +414,12 @@ private: #ifdef DEBUG #include <iostream> using namespace std; - #define IF_QUERY_DEBUG \ + #define IF_TQUERY_DEBUG \ if (iConnections.count() > 1) { \ - kdDebug() << "class " << typeid(this).name() << ": using IF_QUERY with #connections > 1\n"; \ + kdDebug() << "class " << typeid(this).name() << ": using IF_TQUERY with #connections > 1\n"; \ } #else - #define IF_QUERY_DEBUG + #define IF_TQUERY_DEBUG #endif @@ -454,23 +454,23 @@ private: // queries #define ANSWERS public -#define QUERIES protected +#define TQUERIES protected -#define IF_QUERY(decl) \ +#define IF_TQUERY(decl) \ virtual decl const; -#define IF_SEND_QUERY(call, default) \ +#define IF_SEND_TQUERY(call, default) \ cmplInterface *o = IFIterator(iConnections).current(); \ if (o) { \ - IF_QUERY_DEBUG \ + IF_TQUERY_DEBUG \ return o->call; \ } else { \ return default; \ } \ -#define IF_IMPL_QUERY(decl, call, default) \ +#define IF_IMPL_TQUERY(decl, call, default) \ decl const { \ - IF_SEND_QUERY(call, default) \ + IF_SEND_TQUERY(call, default) \ } #define IF_ANSWER(decl) \ @@ -491,12 +491,12 @@ public: \ bool register4_##name (cmplInterface *); \ void unregister4_##name(cmplInterface *); \ private: \ - QPtrList<cmplInterface> m_Listeners_##name;\ + TQPtrList<cmplInterface> m_Listeners_##name;\ #define IF_SEND_MESSAGE_FINE(name, params, call) \ int ____n = 0; \ - for (QPtrListIterator<cmplInterface> ____it(m_Listeners_##name); ____it.current(); ++____it) { \ + for (TQPtrListIterator<cmplInterface> ____it(m_Listeners_##name); ____it.current(); ++____it) { \ if (____it.current()->call ) ++____n; \ } \ return ____n; @@ -576,7 +576,7 @@ bool InterfaceBase<thisIF, cmplIF>::connectI (Interface *__i) cmplIF *i = _i->initThisInterfacePointer(); if (i && me) { - bool i_connected = iConnections.containsRef(i); + bool i_connected = iConnections.tqcontainsRef(i); bool me_connected = i->hasConnectionTo(me); if (i_connected || me_connected) { @@ -671,9 +671,9 @@ void InterfaceBase<thisIF, cmplIF>::disconnectAllI() template <class thisIF, class cmplIF> -bool InterfaceBase<thisIF, cmplIF>::addListener(const cmplInterface *i, QPtrList<cmplInterface> &list) +bool InterfaceBase<thisIF, cmplIF>::addListener(const cmplInterface *i, TQPtrList<cmplInterface> &list) { - if (iConnections.containsRef(i) && !list.contains(i)) { + if (iConnections.tqcontainsRef(i) && !list.tqcontains(i)) { list.append(i); m_FineListeners[i].append(&list); return true; @@ -684,10 +684,10 @@ bool InterfaceBase<thisIF, cmplIF>::addListener(const cmplInterface *i, QPtrList template <class thisIF, class cmplIF> -void InterfaceBase<thisIF, cmplIF>::removeListener(const cmplInterface *i, QPtrList<cmplInterface> &list) +void InterfaceBase<thisIF, cmplIF>::removeListener(const cmplInterface *i, TQPtrList<cmplInterface> &list) { list.remove(i); - if (m_FineListeners.contains(i)) + if (m_FineListeners.tqcontains(i)) m_FineListeners[i].remove(&list); } @@ -695,9 +695,9 @@ void InterfaceBase<thisIF, cmplIF>::removeListener(const cmplInterface *i, QPtrL template <class thisIF, class cmplIF> void InterfaceBase<thisIF, cmplIF>::removeListener(const cmplInterface *i) { - if (m_FineListeners.contains(i)) { - QPtrList<QPtrList<cmplInterface> > &list = m_FineListeners[i]; - QPtrListIterator<QPtrList<cmplInterface> > it(list); + if (m_FineListeners.tqcontains(i)) { + TQPtrList<TQPtrList<cmplInterface> > &list = m_FineListeners[i]; + TQPtrListIterator<TQPtrList<cmplInterface> > it(list); for (; it.current(); ++it) { (*it)->remove(i); } |