From 968af1d235ac30d737991b269156bee5dc99d318 Mon Sep 17 00:00:00 2001 From: tpearson Date: Thu, 30 Jun 2011 19:37:06 +0000 Subject: TQt4 port knutclient This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/knutclient@1238881 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/knutnet.h | 105 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 53 insertions(+), 52 deletions(-) (limited to 'src/knutnet.h') diff --git a/src/knutnet.h b/src/knutnet.h index 00b8e9a..f15ce4e 100755 --- a/src/knutnet.h +++ b/src/knutnet.h @@ -23,38 +23,38 @@ //#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include -#include +#include struct upsVarDef { - QString upsVarName; + TQString upsVarName; bool upsVarActivate; bool upsVarType; // typ true(1) RO - false (0) RW (muzeme menit) bool upsValueType; // typ true(1) char - false (0) enum (vyctova) // ma vyznam jen pro RW promenne int upsVarMax; // udave max delku string promenne nebo pocet moznosti pro enum promennou // ma vyznam jen pro RW promenne - QString upsValue; // hodnota promene - QString upsDescription; // informace o promene - QValueVector* upsEnumValues; + TQString upsValue; // hodnota promene + TQString upsDescription; // informace o promene + TQValueVector* upsEnumValues; }; struct upsICommDef { - QString upsCommName; - QString upsDescription; + TQString upsCommName; + TQString upsDescription; }; -class QString; -class QCString; -class QSocket; -class QTimer; +class TQString; +class TQCString; +class TQSocket; +class TQTimer; /** @@ -77,8 +77,9 @@ class QTimer; * @short Communication with UPS - Komunikace s UPS * @version 0.7 */ -class KNutNet : public QObject { +class KNutNet : public TQObject { Q_OBJECT + TQ_OBJECT public: enum NetState {Idle, HostLookup, Connecting, Connected, ConnectError,Closing }; @@ -144,7 +145,7 @@ public: // this not error NoListVars}; //upsd doesn't return list of variables, variable for STATUS has got value WAIT - enum typeOfStatus { + enum typeOftqStatus { NS = 0, // - NONE status of UPS wasn't read OFF = 1, // - UPS is off (not supplying power) OL = 2, // - UPS is online (supplying power from the line/mains) @@ -218,7 +219,7 @@ public: * * @since 0.7.5 **/ - KNutNet (const QString upsAddress, const QString upsName="", const unsigned short port=3493, unsigned int countRepeat =0, const unsigned int delay = 200); + KNutNet (const TQString upsAddress, const TQString upsName="", const unsigned short port=3493, unsigned int countRepeat =0, const unsigned int delay = 200); /** * @since 0.5 @@ -233,7 +234,7 @@ public: * * @since 0.1 **/ - void newUPS (const QString upsAddress, const QString upsName, const unsigned short port=3493); + void newUPS (const TQString upsAddress, const TQString upsName, const unsigned short port=3493); /** @@ -365,7 +366,7 @@ bool switchedToTCP ( void ); * * @since 0.7 **/ - int instantCommand (const QString command, const QString userName, const QString password, const bool onlyCommand = false); + int instantCommand (const TQString command, const TQString userName, const TQString password, const bool onlyCommand = false); /** @@ -381,7 +382,7 @@ bool switchedToTCP ( void ); * * @since 0.7 **/ - int setVariable (const QString variable, const QString value, const QString userName, const QString password, const bool onlyVariable = false); + int setVariable (const TQString variable, const TQString value, const TQString userName, const TQString password, const bool onlyVariable = false); @@ -428,7 +429,7 @@ bool switchedToTCP ( void ); * * @since 0.6 **/ - int readVars (const QString name, struct upsVarDef& allVar); + int readVars (const TQString name, struct upsVarDef& allVar); /** @@ -451,7 +452,7 @@ bool switchedToTCP ( void ); * * @since 0.6.1 **/ - QString readStringVar (const QString name); + TQString readStringVar (const TQString name); /** * Nacte jednu z hodnot vyctove promenne. @@ -464,7 +465,7 @@ bool switchedToTCP ( void ); * * @since 0.6.1 **/ - QString readEnumValueVar (const QString name, const int valueNumber); + TQString readEnumValueVar (const TQString name, const int valueNumber); /** @@ -480,7 +481,7 @@ bool switchedToTCP ( void ); * * @since 0.5 **/ -int readStatus(void); +int readtqStatus(void); /** @@ -491,7 +492,7 @@ int readStatus(void); * * @since 0.6 **/ - int setActivate ( const QString name ); + int setActivate ( const TQString name ); /** * Zrusi nastaveni priznaku aktivity. @@ -501,7 +502,7 @@ int readStatus(void); * * @since 0.6 **/ - int unSetActivate ( const QString name ); + int unSetActivate ( const TQString name ); /** * Zrusi nastaveni priznaku aktivity pro VSECHNY promene. @@ -523,7 +524,7 @@ int readStatus(void); * * @since 0.6 **/ - int existName ( const QString name ); + int existName ( const TQString name ); /********* Consts ****************/ @@ -617,9 +618,9 @@ void cleanConnecting (void); * * @since 0.1 **/ -int setKey (const QString line); +int setKey (const TQString line); -QString parseValue (const QString line); +TQString parseValue (const TQString line); /** * Parsuje typ promenne (RW ENUM STRING). @@ -630,7 +631,7 @@ QString parseValue (const QString line); * * @since 0.1.1 **/ -int parseTypeValue (QString line, int& lenString ); +int parseTypeValue (TQString line, int& lenString ); @@ -641,7 +642,7 @@ int parseTypeValue (QString line, int& lenString ); * * @since 0.1 **/ -int parseLine(QString& line, QString& upsName ,QString& varName, QString& value, int& typeValue, int& lenString); +int parseLine(TQString& line, TQString& upsName ,TQString& varName, TQString& value, int& typeValue, int& lenString); @@ -677,7 +678,7 @@ int parseLine(QString& line, QString& upsName ,QString& varName, QString& value, * * @since 0.1 **/ -int getFirstUpsName (QString& firstUpsName); +int getFirstUpsName (TQString& firstUpsName); /** @@ -746,22 +747,22 @@ int getFirstUpsName (QString& firstUpsName); * Nenastavuje promenou error. * Doesn't set variable error */ - int getUpsData (const QCString sbuffer, QString& rbuffer, const QCString endString=0); + int getUpsData (const TQCString sbuffer, TQString& rbuffer, const TQCString endString=0); /** * @internal */ - void setRWVars (const QString varName, const bool valueType, const int varMax, QValueVector* enumValues); + void setRWVars (const TQString varName, const bool valueType, const int varMax, TQValueVector* enumValues); /** * @internal */ -void upsSetType (struct upsVarDef& upsVar, const QString name, const QString value = ""); +void upsSetType (struct upsVarDef& upsVar, const TQString name, const TQString value = ""); /** * @internal */ - int upsTranslateError (const QString string); + int upsTranslateError (const TQString string); /** @@ -772,26 +773,26 @@ void upsSetType (struct upsVarDef& upsVar, const QString name, const QString val /** * @internal */ - int upsOldTranslateError (const QString string); + int upsOldTranslateError (const TQString string); /** * @internal * Pro qt mensi nez 3.0.0 nemuze byt value const */ - void genStatusFlags (QString value); + void genStatusFlags (TQString value); /** * @internal * Nenastavuje promenou error. */ - int sendComm (const QString command, const QString arg1, const QString arg2, const bool useUpsName=false); + int sendComm (const TQString command, const TQString arg1, const TQString arg2, const bool useUpsName=false); /** * @internal */ - int activate ( const QString name, const bool setActivate ); + int activate ( const TQString name, const bool setActivate ); /** @@ -803,7 +804,7 @@ void upsSetType (struct upsVarDef& upsVar, const QString name, const QString val /** * @internal */ - int newDescription (const QCString inBuffer, QString& upsDescription); + int newDescription (const TQCString inBuffer, TQString& upsDescription); private slots: void slotConnectionError(int error); @@ -823,15 +824,15 @@ private: /******* CONST ********/ - static const Q_ULONG rBufferLen = 1024; + static const TQ_ULONG rBufferLen = 1024; - QSocket *m_commandSocket; - QTimer* m_unConnectTimer; + TQSocket *m_commandSocket; + TQTimer* m_unConnectTimer; /****** VARS *************/ - QString m_upsAddress; - QString m_upsName; + TQString m_upsAddress; + TQString m_upsName; unsigned int m_countRepeat; unsigned short m_port; @@ -855,12 +856,12 @@ private: bool m_switchToTCP; - QMutex m_getUpsDataMutex; + TQMutex m_getUpsDataMutex; - QValueVector m_listVars; - QValueVector m_listIComms; + TQValueVector m_listVars; + TQValueVector m_listIComms; -/********* Pomocne promenne ***********/ +/********* Potqmocne promenne ***********/ int m_posChar; }; -- cgit v1.2.1