diff options
| author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 00:15:53 +0000 |
|---|---|---|
| committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 00:15:53 +0000 |
| commit | 0aaa8e3fc8f8a1481333b564f0922277c8d8ad59 (patch) | |
| tree | b95c0ca86c4876dd139af376b9f4afd8917cf0cd /src/common/common | |
| parent | b79a2c28534cf09987eeeba3077fff9236df182a (diff) | |
| download | piklab-0aaa8e3fc8f8a1481333b564f0922277c8d8ad59.tar.gz piklab-0aaa8e3fc8f8a1481333b564f0922277c8d8ad59.zip | |
TQt4 port piklab
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/piklab@1238822 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/common/common')
| -rw-r--r-- | src/common/common/bitvalue.cpp | 10 | ||||
| -rw-r--r-- | src/common/common/bitvalue.h | 24 | ||||
| -rw-r--r-- | src/common/common/group.cpp | 8 | ||||
| -rw-r--r-- | src/common/common/group.h | 20 | ||||
| -rw-r--r-- | src/common/common/key_enum.h | 14 | ||||
| -rw-r--r-- | src/common/common/lister.h | 18 | ||||
| -rw-r--r-- | src/common/common/misc.cpp | 18 | ||||
| -rw-r--r-- | src/common/common/misc.h | 16 | ||||
| -rw-r--r-- | src/common/common/number.cpp | 38 | ||||
| -rw-r--r-- | src/common/common/number.h | 46 | ||||
| -rw-r--r-- | src/common/common/purl_base.cpp | 36 | ||||
| -rw-r--r-- | src/common/common/purl_base.h | 22 | ||||
| -rw-r--r-- | src/common/common/qflags.h | 66 | ||||
| -rw-r--r-- | src/common/common/range.h | 12 | ||||
| -rw-r--r-- | src/common/common/storage.cpp | 6 | ||||
| -rw-r--r-- | src/common/common/storage.h | 12 | ||||
| -rw-r--r-- | src/common/common/streamer.h | 26 | ||||
| -rw-r--r-- | src/common/common/synchronous.cpp | 37 | ||||
| -rw-r--r-- | src/common/common/synchronous.h | 12 | ||||
| -rw-r--r-- | src/common/common/version_data.cpp | 16 | ||||
| -rw-r--r-- | src/common/common/version_data.h | 12 |
21 files changed, 218 insertions, 251 deletions
diff --git a/src/common/common/bitvalue.cpp b/src/common/common/bitvalue.cpp index 16d5ef0..f4ae5ed 100644 --- a/src/common/common/bitvalue.cpp +++ b/src/common/common/bitvalue.cpp @@ -13,11 +13,11 @@ const uint GenericValue::INVALID = 0xFFFFFFFFU; BitValue BitValue::XORn(uint n) const { uint nb = nbBits(_value); - uint mask = maxValue(NumberBase::Bin, n); + uint tqmask = maxValue(NumberBase::Bin, n); uint res = 0x0; for (uint i=0; i<nb; i +=n) { - res ^= (_value >> i) & mask; - //qDebug("%i %s %s", i, toHexLabel((value>>i) & mask, 4).latin1(), toHexLabel(res, 4).latin1()); + res ^= (_value >> i) & tqmask; + //qDebug("%i %s %s", i, toHexLabel((value>>i) & tqmask, 4).latin1(), toHexLabel(res, 4).latin1()); } return res; } @@ -25,6 +25,6 @@ BitValue BitValue::XORn(uint n) const BitValue BitValue::XNORn(uint n) const { BitValue res = XORn(n); - BitValue mask = maxValue(NumberBase::Bin, n); - return res.complementInMask(mask); + BitValue tqmask = maxValue(NumberBase::Bin, n); + return res.complementInMask(tqmask); } diff --git a/src/common/common/bitvalue.h b/src/common/common/bitvalue.h index d3ef9fe..9d0a50f 100644 --- a/src/common/common/bitvalue.h +++ b/src/common/common/bitvalue.h @@ -35,18 +35,18 @@ protected: uint _value; private: - friend QDataStream &operator <<(QDataStream &s, GenericValue v); - friend QDataStream &operator >>(QDataStream &s, GenericValue &v); + friend TQDataStream &operator <<(TQDataStream &s, GenericValue v); + friend TQDataStream &operator >>(TQDataStream &s, GenericValue &v); }; -inline QDataStream &operator <<(QDataStream &s, GenericValue v) { s << v._value; return s; } -inline QDataStream &operator >>(QDataStream &s, GenericValue &v) { s >> v._value; return s; } +inline TQDataStream &operator <<(TQDataStream &s, GenericValue v) { s << v._value; return s; } +inline TQDataStream &operator >>(TQDataStream &s, GenericValue &v) { s >> v._value; return s; } -inline QString toLabel(GenericValue v) { return QString::number(v.toUInt()); } -inline QString toLabel(NumberBase base, GenericValue v, uint nbChars) { return toLabel(base, v.toUInt(), nbChars); } -inline QString toHexLabel(GenericValue v, uint nbChars) { return toHexLabel(v.toUInt(), nbChars); } -inline QString toHex(GenericValue v, uint nbChars) { return toHex(v.toUInt(), nbChars); } -inline QString toHexLabelAbs(GenericValue v) { return ::toHexLabelAbs(v.toUInt()); } +inline TQString toLabel(GenericValue v) { return TQString::number(v.toUInt()); } +inline TQString toLabel(NumberBase base, GenericValue v, uint nbChars) { return toLabel(base, v.toUInt(), nbChars); } +inline TQString toHexLabel(GenericValue v, uint nbChars) { return toHexLabel(v.toUInt(), nbChars); } +inline TQString toHex(GenericValue v, uint nbChars) { return toHex(v.toUInt(), nbChars); } +inline TQString toHexLabelAbs(GenericValue v) { return ::toHexLabelAbs(v.toUInt()); } //---------------------------------------------------------------------------- class Address : public GenericValue @@ -96,11 +96,11 @@ public: BitValue XORn(uint n) const; // XOR between groups of n bits inside value BitValue XNORn(uint n) const; // XORn then NOT on n bits - BitValue maskWith(BitValue mask) const { return _value & mask._value; } + BitValue tqmaskWith(BitValue tqmask) const { return _value & tqmask._value; } bool isInside(BitValue v) const { return ( (_value & v._value)==_value ); } - BitValue complementInMask(BitValue mask) const { return mask._value & ~_value; } + BitValue complementInMask(BitValue tqmask) const { return tqmask._value & ~_value; } BitValue twoComplement() const { return -_value; } - BitValue clearMaskBits(BitValue mask) const { return _value & ~mask._value; } + BitValue clearMaskBits(BitValue tqmask) const { return _value & ~tqmask._value; } bool isOverlapping(BitValue v) const { return ( _value & v._value ); } class const_iterator { diff --git a/src/common/common/group.cpp b/src/common/common/group.cpp index 2a0610f..7c77f3a 100644 --- a/src/common/common/group.cpp +++ b/src/common/common/group.cpp @@ -31,22 +31,22 @@ Group::Base::ConstIterator Group::Base::end() const return _devices.end(); } -void Group::Base::addDevice(const QString &name, const Device::Data *data, Support support) +void Group::Base::addDevice(const TQString &name, const Device::Data *data, Support support) { _devices[name].data = data; _devices[name].support = support; } -Group::Base::Data Group::Base::deviceData(const QString &device) const +Group::Base::Data Group::Base::deviceData(const TQString &device) const { const_cast<Base &>(*this).checkInitSupported(); return _devices[device]; } -QValueVector<QString> Group::Base::supportedDevices() const +TQValueVector<TQString> Group::Base::supportedDevices() const { const_cast<Base &>(*this).checkInitSupported(); - QValueVector<QString> names; + TQValueVector<TQString> names; for (ConstIterator it=begin(); it!=end(); ++it) names.append(it.key()); return names; } diff --git a/src/common/common/group.h b/src/common/common/group.h index 2a87674..687c41e 100644 --- a/src/common/common/group.h +++ b/src/common/common/group.h @@ -9,8 +9,8 @@ #ifndef GROUP_H #define GROUP_H -#include <qstringlist.h> -#include <qmap.h> +#include <tqstringlist.h> +#include <tqmap.h> #include "common/global/global.h" #include "key_enum.h" @@ -34,27 +34,27 @@ public: const Device::Data *data; Support support; }; - typedef QMap<QString, Data>::ConstIterator ConstIterator; + typedef TQMap<TQString, Data>::ConstIterator ConstIterator; Base(); virtual ~Base() {} - virtual QString name() const = 0; - virtual QString label() const = 0; + virtual TQString name() const = 0; + virtual TQString label() const = 0; ConstIterator begin() const; ConstIterator end() const; - Data deviceData(const QString &device) const; - bool isSupported(const QString &device) const { return deviceData(device).support!=Support::None; } - QValueVector<QString> supportedDevices() const; + Data deviceData(const TQString &device) const; + bool isSupported(const TQString &device) const { return deviceData(device).support!=Support::None; } + TQValueVector<TQString> supportedDevices() const; uint count() const; const BaseGui *gui() const { return _gui; } void checkInitSupported(); protected: virtual void init(); - virtual void addDevice(const QString &name, const Device::Data *data, Support support); + virtual void addDevice(const TQString &name, const Device::Data *data, Support support); virtual void initSupported() = 0; - QMap<QString, Data> _devices; + TQMap<TQString, Data> _devices; private: const BaseGui *_gui; diff --git a/src/common/common/key_enum.h b/src/common/common/key_enum.h index 504ca56..45b1635 100644 --- a/src/common/common/key_enum.h +++ b/src/common/common/key_enum.h @@ -9,7 +9,7 @@ #ifndef KEY_ENUM_H #define KEY_ENUM_H -#include <qdatastream.h> +#include <tqdatastream.h> #include "misc.h" #include "common/global/global.h" @@ -30,16 +30,16 @@ protected: uint _value; private: - friend QDataStream &operator >>(QDataStream &s, GenericEnum &e); - friend QDataStream &operator <<(QDataStream &s, const GenericEnum &e); + friend TQDataStream &operator >>(TQDataStream &s, GenericEnum &e); + friend TQDataStream &operator <<(TQDataStream &s, const GenericEnum &e); }; -inline QDataStream &operator <<(QDataStream &s, const GenericEnum &e) +inline TQDataStream &operator <<(TQDataStream &s, const GenericEnum &e) { s << e._value; return s; } -inline QDataStream &operator >>(QDataStream &s, GenericEnum &e) +inline TQDataStream &operator >>(TQDataStream &s, GenericEnum &e) { s >> e._value; return s; @@ -53,7 +53,7 @@ public: \ #define DECLARE_DATA \ public: \ - static Type fromKey(const QString &key) { \ + static Type fromKey(const TQString &key) { \ for (uint i=0; i<Nb_Types; i++) \ if ( key==DATA[i].key ) return Type(i); \ return Type(Nb_Types); \ @@ -67,7 +67,7 @@ public: \ Q_ASSERT(DATA[_value].key); \ return DATA[_value].key; \ } \ - QString label() const { \ + TQString label() const { \ CRASH_ASSERT( _value!=Nb_Types ); \ Q_ASSERT(DATA[_value].label); \ return i18n(DATA[_value].label); \ diff --git a/src/common/common/lister.h b/src/common/common/lister.h index 35413e8..270aba6 100644 --- a/src/common/common/lister.h +++ b/src/common/common/lister.h @@ -18,7 +18,7 @@ template <class GroupType> class Lister { public: - typedef typename QMap<QString, const GroupType *>::ConstIterator ConstIterator; + typedef typename TQMap<TQString, const GroupType *>::ConstIterator ConstIterator; ConstIterator begin() const { return ConstIterator(_groups.begin()); } ConstIterator end() const { return ConstIterator(_groups.end()); } @@ -26,10 +26,10 @@ public: for (ConstIterator it=begin(); it!=end(); ++it) delete it.data(); } - QValueVector<QString> supportedDevices() const { - QValueVector<QString> names; + TQValueVector<TQString> supportedDevices() const { + TQValueVector<TQString> names; for (ConstIterator it=begin(); it!=end(); ++it) { - QValueVector<QString> gnames = it.data()->supportedDevices(); + TQValueVector<TQString> gnames = it.data()->supportedDevices(); for (uint k=0; k<uint(gnames.count()); k++) names.append(gnames[k]); } return names; @@ -41,14 +41,14 @@ public: return nb; } - bool isSupported(const QString &device) const { + bool isSupported(const TQString &device) const { for (ConstIterator it=begin(); it!=end(); ++it) if ( it.data()->isSupported(device) ) return true; return false; } - const GroupType *group(const QString &name) const { - if ( _groups.contains(name) ) return _groups[name]; + const GroupType *group(const TQString &name) const { + if ( _groups.tqcontains(name) ) return _groups[name]; return 0; } @@ -58,12 +58,12 @@ protected: group->_gui = gui; if (gui) gui->_group = group; group->init(); - Q_ASSERT( !_groups.contains(group->name()) ); + Q_ASSERT( !_groups.tqcontains(group->name()) ); _groups.insert(group->name(), group); } private: - QMap<QString, const GroupType *> _groups; + TQMap<TQString, const GroupType *> _groups; }; } // namespace diff --git a/src/common/common/misc.cpp b/src/common/common/misc.cpp index 1974024..1c22b4e 100644 --- a/src/common/common/misc.cpp +++ b/src/common/common/misc.cpp @@ -10,8 +10,8 @@ #include <unistd.h> -#include <qregexp.h> -#include <qtimer.h> +#include <tqregexp.h> +#include <tqtimer.h> #include "number.h" @@ -30,9 +30,9 @@ uchar bcd2bin(uchar bcd) return (h*10) + l; } -QString escapeXml(const QString &cs) +TQString escapeXml(const TQString &cs) { - QString s; + TQString s; for (uint i=0; i<uint(cs.length()); i++) { if ( cs[i]=='<' ) s += "<"; else if ( cs[i]=='>' ) s += ">"; @@ -41,7 +41,7 @@ QString escapeXml(const QString &cs) return s; } -QString htmlTableRow(const QString &title, const QString &value) +TQString htmlTableRow(const TQString &title, const TQString &value) { return "<tr><td>" + title + ":</td><td>" + value + "</td></tr>"; } @@ -53,12 +53,12 @@ void crash(const char *assert, const char *file, int line) (*ptr)++; } -bool checkAvailable(const QByteArray &data, uint offset, uint nbBytes) +bool checkAvailable(const TQByteArray &data, uint offset, uint nbBytes) { return ( offset+nbBytes<=uint(data.size()) ); } -Q_UINT32 getULong(const QByteArray &data, uint offset, uint nbBytes, bool *ok) +TQ_UINT32 getULong(const TQByteArray &data, uint offset, uint nbBytes, bool *ok) { Q_ASSERT( nbBytes<=8 ); if ( !checkAvailable(data, offset, nbBytes) ) { @@ -66,7 +66,7 @@ Q_UINT32 getULong(const QByteArray &data, uint offset, uint nbBytes, bool *ok) return 0; } if (ok) *ok = true; - Q_UINT32 r = 0; - for (uint i=0; i<nbBytes; i++) r += Q_UINT8(data[offset+i]) << (8*i); + TQ_UINT32 r = 0; + for (uint i=0; i<nbBytes; i++) r += TQ_UINT8(data[offset+i]) << (8*i); return r; } diff --git a/src/common/common/misc.h b/src/common/common/misc.h index f8f92f6..afcd121 100644 --- a/src/common/common/misc.h +++ b/src/common/common/misc.h @@ -9,16 +9,16 @@ #ifndef MISC_H #define MISC_H -#include <qstring.h> +#include <tqstring.h> -inline QString repeat(const char *r, uint nb) +inline TQString repeat(const char *r, uint nb) { - QString s; + TQString s; for (uint i=0; i<nb; i++) s += r; return s; } -inline QString stripEndingWhiteSpaces(const QString &s) { +inline TQString stripEndingWhiteSpaces(const TQString &s) { int k = s.length()-1; for (; k>=0; k--) if ( s[k]!=' ' ) break; return s.mid(0, k+1); @@ -28,11 +28,11 @@ extern uchar bin2bcd(uchar bin); extern uchar bcd2bin(uchar bcd); inline bool XOR(bool b1, bool b2) { return ( (!b1 && b2) || (b1 && !b2) ); } -extern bool checkAvailable(const QByteArray &data, uint offset, uint nbBytes); -extern Q_UINT32 getULong(const QByteArray &data, uint offset, uint nbBytes, bool *ok); +extern bool checkAvailable(const TQByteArray &data, uint offset, uint nbBytes); +extern TQ_UINT32 getULong(const TQByteArray &data, uint offset, uint nbBytes, bool *ok); -extern QString escapeXml(const QString &s); -extern QString htmlTableRow(const QString &title, const QString &value); +extern TQString escapeXml(const TQString &s); +extern TQString htmlTableRow(const TQString &title, const TQString &value); extern void crash(const char *assert, const char *file, int line); #define CRASH_ASSERT(x) ((x) ? void(0) : crash(#x, __FILE__, __LINE__)) diff --git a/src/common/common/number.cpp b/src/common/common/number.cpp index 12fcac0..01fa4eb 100644 --- a/src/common/common/number.cpp +++ b/src/common/common/number.cpp @@ -35,10 +35,10 @@ char toChar(NumberBase base, uint value) return 'A' + value - 10; } -QString toString(NumberBase base, ulong value, uint nbChars) +TQString toString(NumberBase base, ulong value, uint nbChars) { ulong tmp = value; - QString s; + TQString s; s.fill(0, nbChars); for (uint i=0; i<nbChars; i++) { s[nbChars-i-1] = toChar(base, uint(value % base.data().base)); @@ -49,7 +49,7 @@ QString toString(NumberBase base, ulong value, uint nbChars) return s; } -QString toLabel(NumberBase base, ulong value, uint nbChars) +TQString toLabel(NumberBase base, ulong value, uint nbChars) { if ( base==NumberBase::String ) return "\'" + toString(base, value, nbChars) + "\'"; return base.data().prefix + toString(base, value, nbChars); @@ -73,31 +73,21 @@ ulong maxValue(NumberBase base, uint nbChars) return v - 1; } -ulong fromString(NumberBase base, const QCString &s, bool *ok) +ulong fromString(NumberBase base, const TQCString &s, bool *ok) { return fromString(base, s.data(), s.length(), ok); } -ulong fromString(NumberBase base, const QString &s, bool *ok) +ulong fromString(NumberBase base, const TQString &s, bool *ok) { -#if QT_VERSION<0x040000 return fromString(base, s.latin1(), s.length(), ok); -#else - QByteArray a = s.toLatin1(); - return fromString(base, a.data(), a.count(), ok); -#endif } -ulong fromLabel(NumberBase base, const QString &s, bool *ok) +ulong fromLabel(NumberBase base, const TQString &s, bool *ok) { -#if QT_VERSION<0x040000 return fromLabel(base, s.latin1(), s.length(), ok); -#else - QByteArray a = s.toLatin1(); - return fromLabel(base, a.data(), a.count(), ok); -#endif } -ulong fromLabel(NumberBase base, const QString &s, uint nbChars, bool *ok) +ulong fromLabel(NumberBase base, const TQString &s, uint nbChars, bool *ok) { if ( uint(s.length())!=nbChars+strlen(base.data().prefix) ) { if (ok) *ok = false; @@ -123,7 +113,7 @@ ulong fromLabel(NumberBase base, const char *s, uint size, bool *ok) return fromString(base, s+psize, size-psize-ssize, ok); } -ulong fromAnyLabel(const QString &s, bool *ok) +ulong fromAnyLabel(const TQString &s, bool *ok) { uint v = 0; bool bok = false; @@ -173,9 +163,9 @@ ulong fromString(NumberBase base, const char *s, uint size, bool *ok) return v; } -QString toLabels(NumberBase base, const QMemArray<uint> &values, uint nbChars) +TQString toLabels(NumberBase base, const TQMemArray<uint> &values, uint nbChars) { - QString s = "["; + TQString s = "["; for (uint i=0; i<values.count(); i++) { if ( i!=0 ) s += ' '; s += toLabel(base, values[i], nbChars); @@ -184,18 +174,18 @@ QString toLabels(NumberBase base, const QMemArray<uint> &values, uint nbChars) return s; } -QString formatNumber(ulong v) +TQString formatNumber(ulong v) { #if defined(NO_KDE) - return QString::number(v); + return TQString::number(v); #else return KGlobal::locale()->formatNumber(v, 0); #endif } -QByteArray toAscii(const QString &s) +TQByteArray toAscii(const TQString &s) { - QByteArray a(s.length()); + TQByteArray a(s.length()); for (uint i=0; i<uint(s.length()); i++) a[i] = s[i].latin1(); return a; } diff --git a/src/common/common/number.h b/src/common/common/number.h index f4dae79..94d7c48 100644 --- a/src/common/common/number.h +++ b/src/common/common/number.h @@ -29,30 +29,30 @@ extern ulong maxValue(NumberBase base, uint nbChars); inline uint convertNbChars(uint nb, NumberBase from, NumberBase to) { return nbChars(to, maxValue(from, nb)); } extern char toChar(NumberBase base, uint value); -extern QString toString(NumberBase base, ulong value, uint nbChars); -extern QString toLabel(NumberBase base, ulong value, uint nbChars); -extern QString toLabels(NumberBase base, const QMemArray<ulong> &values, uint nbChars); +extern TQString toString(NumberBase base, ulong value, uint nbChars); +extern TQString toLabel(NumberBase base, ulong value, uint nbChars); +extern TQString toLabels(NumberBase base, const TQMemArray<ulong> &values, uint nbChars); extern uint fromChar(NumberBase base, char c, bool *ok); extern ulong fromString(NumberBase base, const char *s, uint size, bool *ok); -extern ulong fromString(NumberBase base, const QString &s, bool *ok); -extern ulong fromLabel(NumberBase base, const QString &s, bool *ok); -extern ulong fromLabel(NumberBase base, const QString &s, uint nbChars, bool *ok); +extern ulong fromString(NumberBase base, const TQString &s, bool *ok); +extern ulong fromLabel(NumberBase base, const TQString &s, bool *ok); +extern ulong fromLabel(NumberBase base, const TQString &s, uint nbChars, bool *ok); extern ulong fromLabel(NumberBase base, const char *s, uint size, bool *ok); -extern ulong fromAnyLabel(const QString &s, bool *ok); +extern ulong fromAnyLabel(const TQString &s, bool *ok); //---------------------------------------------------------------------------- -inline QString toHex(ulong value, uint nbChars) { return toString(NumberBase::Hex, value, nbChars); } -inline QString toHexLabel(ulong value, uint nbChars) { return toLabel(NumberBase::Hex, value, nbChars); } -inline QString toHexLabelAbs(ulong value) { return toLabel(NumberBase::Hex, value, nbChars(NumberBase::Hex, value)); } +inline TQString toHex(ulong value, uint nbChars) { return toString(NumberBase::Hex, value, nbChars); } +inline TQString toHexLabel(ulong value, uint nbChars) { return toLabel(NumberBase::Hex, value, nbChars); } +inline TQString toHexLabelAbs(ulong value) { return toLabel(NumberBase::Hex, value, nbChars(NumberBase::Hex, value)); } inline uint fromHex(char c, bool *ok) { return fromChar(NumberBase::Hex, c, ok); } -inline uint fromHex(QChar c, bool *ok) { return fromChar(NumberBase::Hex, c.latin1(), ok); } +inline uint fromHex(TQChar c, bool *ok) { return fromChar(NumberBase::Hex, c.latin1(), ok); } inline ulong fromHex(const char *s, uint size, bool *ok) { return fromString(NumberBase::Hex, s, size, ok); } -inline ulong fromHex(const QString &s, bool *ok) { return fromString(NumberBase::Hex, s, ok); } -inline ulong fromHexLabel(const QString &s, bool *ok) { return fromLabel(NumberBase::Hex, s, ok); } -inline ulong fromHexLabel(const QString &s, uint nbChars, bool *ok) { return fromLabel(NumberBase::Hex, s, nbChars, ok); } +inline ulong fromHex(const TQString &s, bool *ok) { return fromString(NumberBase::Hex, s, ok); } +inline ulong fromHexLabel(const TQString &s, bool *ok) { return fromLabel(NumberBase::Hex, s, ok); } +inline ulong fromHexLabel(const TQString &s, uint nbChars, bool *ok) { return fromLabel(NumberBase::Hex, s, nbChars, ok); } inline ulong fromHexLabel(const char *s, uint size, bool *ok) { return fromLabel(NumberBase::Hex, s, size, ok); } //---------------------------------------------------------------------------- @@ -63,28 +63,28 @@ inline uint nbChars(ulong value) { return nbBitsToNbChars(nbBits(value)); } inline uint nbBytes(ulong value) { return nbBitsToNbBytes(nbBits(value)); } //---------------------------------------------------------------------------- -extern QString formatNumber(ulong v); -extern QByteArray toAscii(const QString &s); +extern TQString formatNumber(ulong v); +extern TQByteArray toAscii(const TQString &s); //---------------------------------------------------------------------------- enum PrintMode { PrintAlphaNum, PrintEscapeAll }; -inline QString toPrintable(char c, PrintMode mode) +inline TQString toPrintable(char c, PrintMode mode) { - if ( mode==PrintAlphaNum && isalnum(c) ) return QChar(c); + if ( mode==PrintAlphaNum && isalnum(c) ) return TQChar(c); return "\\" + toHex(uchar(c), 2); } -inline QString toPrintable(const char *data, uint size, PrintMode mode) +inline TQString toPrintable(const char *data, uint size, PrintMode mode) { - QString s; + TQString s; for (uint i=0; i<size; i++) s += toPrintable(data[i], mode); return s; } -inline QString toPrintable(const QString &s, PrintMode mode) +inline TQString toPrintable(const TQString &s, PrintMode mode) { - QByteArray a = toAscii(s); + TQByteArray a = toAscii(s); return toPrintable(a.data(), a.count(), mode); } -inline QString toPrintable(const QMemArray<uchar> &data, PrintMode mode) +inline TQString toPrintable(const TQMemArray<uchar> &data, PrintMode mode) { return toPrintable((const char *)data.data(), data.size(), mode); } diff --git a/src/common/common/purl_base.cpp b/src/common/common/purl_base.cpp index 2493322..fe15d6b 100644 --- a/src/common/common/purl_base.cpp +++ b/src/common/common/purl_base.cpp @@ -9,7 +9,7 @@ #include "purl_base.h" #include "common/global/global.h" -#include <qfileinfo.h> +#include <tqfileinfo.h> #include "data/xpms/project.xpm" #include "data/xpms/sourcefile.xpm" @@ -58,51 +58,51 @@ const PURL::FileType::Data PURL::FileType::DATA[Nb_Types] = { { "", Nb_FileGroups, NoProperty, SourceFamily::Nb_Types, I18N_NOOP("Pikdev Project File"), { "pikprj", 0 }, 0, 0, 0 } }; -QString PURL::addExtension(const QString &filename, FileType type) +TQString PURL::addExtension(const TQString &filename, FileType type) { - QFileInfo info(filename); + TQFileInfo info(filename); if ( !info.extension().isEmpty() ) return filename; return filename + '.' + extension(type); } -QString PURL::extension(FileType type) +TQString PURL::extension(FileType type) { return type.data().extensions[0]; } -QString PURL::extensions(FileType type) +TQString PURL::extensions(FileType type) { Q_ASSERT( type!=PURL::Nb_FileTypes ); - QString s; + TQString s; for (uint i=0; type.data().extensions[i]; i++) { if ( i!=0 ) s += ' '; - s += QString("*.") + type.data().extensions[i]; + s += TQString("*.") + type.data().extensions[i]; } return s; } -QString PURL::filter(FileType type) +TQString PURL::filter(FileType type) { //if ( hasMimetype(type) ) return DATA[type].mimetype; // #### we cannot mix mimetype and regular filters in KFileDialog... - QString s = extensions(type); + TQString s = extensions(type); return s + ' ' + s.upper() + '|' + type.label() + " (" + s + ")"; } -QString PURL::extensions(FileGroup group) +TQString PURL::extensions(FileGroup group) { - QString e; + TQString e; FOR_EACH(FileType, type) { if ( type.data().group!=group ) continue; if ( type!=FileType::Type(0) ) e += ' '; - QString s = extensions(type); + TQString s = extensions(type); e += s + ' ' + s.upper(); } return e; } -QString PURL::sourceFilter(FilterType type) +TQString PURL::sourceFilter(FilterType type) { - QString f = extensions(Source) + ' ' + extensions(Header) + '|' + i18n("All Source Files"); + TQString f = extensions(Source) + ' ' + extensions(Header) + '|' + i18n("All Source Files"); if ( type==CompleteFilter) { FOR_EACH(FileType, type) { if ( !(type.data().properties & (Source | Header)) ) continue; @@ -112,9 +112,9 @@ QString PURL::sourceFilter(FilterType type) return f; } -QString PURL::objectFilter(FilterType type) +TQString PURL::objectFilter(FilterType type) { - QString f = extensions(Object) + ' ' + extensions(Library) + '|' + i18n("All Object Files"); + TQString f = extensions(Object) + ' ' + extensions(Library) + '|' + i18n("All Object Files"); if ( type==CompleteFilter ) { f += '\n' + filter(Object); f += '\n' + filter(Library); @@ -122,9 +122,9 @@ QString PURL::objectFilter(FilterType type) return f; } -QString PURL::projectFilter(FilterType type) +TQString PURL::projectFilter(FilterType type) { - QString f = extensions(Project) + ' ' + extensions(PikdevProject) + '|' + i18n("Project Files"); + TQString f = extensions(Project) + ' ' + extensions(PikdevProject) + '|' + i18n("Project Files"); if ( type==CompleteFilter ) { f += '\n' + filter(Project); f += '\n' + filter(PikdevProject); diff --git a/src/common/common/purl_base.h b/src/common/common/purl_base.h index 7a7e4ea..783daf0 100644 --- a/src/common/common/purl_base.h +++ b/src/common/common/purl_base.h @@ -38,8 +38,8 @@ END_DECLARE_ENUM(SourceFamily, SourceFamilyData) enum FileGroup { Source = 0, Header, LinkerScript, LinkerObject, Nb_FileGroups }; enum FileProperty { NoProperty = 0, Editable = 1, ReadOnly = 2 }; -Q_DECLARE_FLAGS(FileProperties, FileProperty) -Q_DECLARE_OPERATORS_FOR_FLAGS(FileProperties) +TQ_DECLARE_FLAGS(FileProperties, FileProperty) +TQ_DECLARE_OPERATORS_FOR_FLAGS(FileProperties) struct FileTypeData { const char *key; @@ -52,7 +52,7 @@ struct FileTypeData { const char *mimetype; const char *highlightModeName; }; -#ifndef Q_MOC_RUN // needed because MOC does not expand defines... +#ifndef TQ_TQMOC_RUN // needed because TQMOC does not expand defines... class FileType : public GenericEnum { public: @@ -64,15 +64,15 @@ DECLARE_ENUM_CLASS(FileType) #endif // add correct extension if filename has no extension -extern QString addExtension(const QString &filename, FileType type); -extern QString extension(FileType type); -extern QString extensions(FileType type); -extern QString filter(FileType type); +extern TQString addExtension(const TQString &filename, FileType type); +extern TQString extension(FileType type); +extern TQString extensions(FileType type); +extern TQString filter(FileType type); enum FilterType { SimpleFilter, CompleteFilter }; -extern QString sourceFilter(FilterType type); -extern QString objectFilter(FilterType type); -extern QString projectFilter(FilterType type); -extern QString extensions(FileGroup group); +extern TQString sourceFilter(FilterType type); +extern TQString objectFilter(FilterType type); +extern TQString projectFilter(FilterType type); +extern TQString extensions(FileGroup group); } // namespace diff --git a/src/common/common/qflags.h b/src/common/common/qflags.h index 4858ce4..c7abfc2 100644 --- a/src/common/common/qflags.h +++ b/src/common/common/qflags.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 1992-2005 Trolltech AS. All rights reserved. ** -** This file is part of the QtCore module of the Qt Toolkit. +** This file is part of the TQtCore module of the TQt Toolkit. ** ** This file may be used under the terms of the GNU General Public ** License version 2.0 as published by the Free Software Foundation @@ -20,62 +20,62 @@ ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ****************************************************************************/ -#ifndef QFLAGS_H -#define QFLAGS_H +#ifndef TQFLAGS_H +#define TQFLAGS_H -#include <qglobal.h> +#include <tqglobal.h> -class QFlag +class TQFlag { int i; public: - inline QFlag(int i); + inline TQFlag(int i); inline operator int() const { return i; } }; -inline QFlag::QFlag(int ai) : i(ai) {} +inline TQFlag::TQFlag(int ai) : i(ai) {} template<typename Enum> -class QFlags +class TQFlags { typedef void **Zero; int i; public: typedef Enum enum_type; - inline QFlags(const QFlags &f) : i(f.i) {} - inline QFlags(Enum f) : i(f) {} - inline QFlags(Zero = 0) : i(0) {} - inline QFlags(QFlag f) : i(f) {} + inline TQFlags(const TQFlags &f) : i(f.i) {} + inline TQFlags(Enum f) : i(f) {} + inline TQFlags(Zero = 0) : i(0) {} + inline TQFlags(TQFlag f) : i(f) {} - inline QFlags &operator=(const QFlags &f) { i = f.i; return *this; } - inline QFlags &operator&=(int mask) { i &= mask; return *this; } - inline QFlags &operator&=(uint mask) { i &= mask; return *this; } - inline QFlags &operator|=(QFlags f) { i |= f.i; return *this; } - inline QFlags &operator|=(Enum f) { i |= f; return *this; } - inline QFlags &operator^=(QFlags f) { i ^= f.i; return *this; } - inline QFlags &operator^=(Enum f) { i ^= f; return *this; } + inline TQFlags &operator=(const TQFlags &f) { i = f.i; return *this; } + inline TQFlags &operator&=(int tqmask) { i &= tqmask; return *this; } + inline TQFlags &operator&=(uint tqmask) { i &= tqmask; return *this; } + inline TQFlags &operator|=(TQFlags f) { i |= f.i; return *this; } + inline TQFlags &operator|=(Enum f) { i |= f; return *this; } + inline TQFlags &operator^=(TQFlags f) { i ^= f.i; return *this; } + inline TQFlags &operator^=(Enum f) { i ^= f; return *this; } inline operator int() const { return i;} - inline QFlags operator|(QFlags f) const { QFlags g; g.i = i | f.i; return g; } - inline QFlags operator|(Enum f) const { QFlags g; g.i = i | f; return g; } - inline QFlags operator^(QFlags f) const { QFlags g; g.i = i ^ f.i; return g; } - inline QFlags operator^(Enum f) const { QFlags g; g.i = i ^ f; return g; } - inline QFlags operator&(int mask) const { QFlags g; g.i = i & mask; return g; } - inline QFlags operator&(uint mask) const { QFlags g; g.i = i & mask; return g; } - inline QFlags operator&(Enum f) const { QFlags g; g.i = i & f; return g; } - inline QFlags operator~() const { QFlags g; g.i = ~i; return g; } + inline TQFlags operator|(TQFlags f) const { TQFlags g; g.i = i | f.i; return g; } + inline TQFlags operator|(Enum f) const { TQFlags g; g.i = i | f; return g; } + inline TQFlags operator^(TQFlags f) const { TQFlags g; g.i = i ^ f.i; return g; } + inline TQFlags operator^(Enum f) const { TQFlags g; g.i = i ^ f; return g; } + inline TQFlags operator&(int tqmask) const { TQFlags g; g.i = i & tqmask; return g; } + inline TQFlags operator&(uint tqmask) const { TQFlags g; g.i = i & tqmask; return g; } + inline TQFlags operator&(Enum f) const { TQFlags g; g.i = i & f; return g; } + inline TQFlags operator~() const { TQFlags g; g.i = ~i; return g; } inline bool operator!() const { return !i; } }; -#define Q_DECLARE_FLAGS(Flags, Enum)\ -typedef QFlags<Enum> Flags; -#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags) \ -inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) \ -{ return QFlags<Flags::enum_type>(f1) | f2; } \ -inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) \ +#define TQ_DECLARE_FLAGS(Flags, Enum)\ +typedef TQFlags<Enum> Flags; +#define TQ_DECLARE_OPERATORS_FOR_FLAGS(Flags) \ +inline TQFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) \ +{ return TQFlags<Flags::enum_type>(f1) | f2; } \ +inline TQFlags<Flags::enum_type> operator|(Flags::enum_type f1, TQFlags<Flags::enum_type> f2) \ { return f2 | f1; } #endif diff --git a/src/common/common/range.h b/src/common/common/range.h index e07cb68..d1e846f 100644 --- a/src/common/common/range.h +++ b/src/common/common/range.h @@ -18,7 +18,7 @@ class GenericRange public: virtual ~GenericRange() {} virtual bool isEmpty() const = 0; - bool contains(Type v) const { return !isEmpty() && v>=start && v<=end; } + bool tqcontains(Type v) const { return !isEmpty() && v>=start && v<=end; } Type start, end; }; @@ -32,14 +32,14 @@ public: }; template <typename Type> -inline QDataStream &operator >>(QDataStream &s, GenericRange<Type> &r) { s >> r.start >> r.end; return s; } +inline TQDataStream &operator >>(TQDataStream &s, GenericRange<Type> &r) { s >> r.start >> r.end; return s; } template <typename Type> -inline QDataStream &operator <<(QDataStream &s, const GenericRange<Type> &r) { s << r.start << r.end; return s; } +inline TQDataStream &operator <<(TQDataStream &s, const GenericRange<Type> &r) { s << r.start << r.end; return s; } template <typename Type> inline bool operator ==(const GenericRange<Type> &r1, const GenericRange<Type> &r2) { return ( r1.start==r2.start && r1.end==r2.end ); } template <typename Type, typename RangeType> -class GenericRangeVector : public QValueVector<RangeType> +class GenericRangeVector : public TQValueVector<RangeType> { public: GenericRangeVector() {} @@ -49,9 +49,9 @@ public: for (uint i=0; i<nb; i++) if ( !this->at(i).isEmpty() ) return false; return true; } - bool contains(Type v) const { + bool tqcontains(Type v) const { uint nb = this->count(); - for (uint i=0; i<nb; i++) if ( this->at(i).contains(v) ) return true; + for (uint i=0; i<nb; i++) if ( this->at(i).tqcontains(v) ) return true; return false; } }; diff --git a/src/common/common/storage.cpp b/src/common/common/storage.cpp index 00137b8..447a8a0 100644 --- a/src/common/common/storage.cpp +++ b/src/common/common/storage.cpp @@ -8,14 +8,14 @@ ***************************************************************************/ #include "storage.h" -#include <qtimer.h> +#include <tqtimer.h> //---------------------------------------------------------------------------- void GenericStorage::delayedChanged() { if (_dirty) return; _dirty = true; - QTimer::singleShot(0, this, SLOT(changedSlot())); + TQTimer::singleShot(0, this, TQT_SLOT(changedSlot())); } void GenericStorage::changedSlot() @@ -27,7 +27,7 @@ void GenericStorage::changedSlot() //---------------------------------------------------------------------------- void GenericViewProxy::addStorage(GenericStorage &storage) { - connect(&storage, SIGNAL(changed()), SLOT(changed())); + connect(&storage, TQT_SIGNAL(changed()), TQT_SLOT(changed())); } void GenericViewProxy::changed() diff --git a/src/common/common/storage.h b/src/common/common/storage.h index b61123a..f1c947d 100644 --- a/src/common/common/storage.h +++ b/src/common/common/storage.h @@ -10,7 +10,7 @@ #define STORAGE_H #include "common/global/global.h" -#include <qobject.h> +#include <tqobject.h> //----------------------------------------------------------------------------- template <class Type> @@ -28,15 +28,16 @@ public: } private: - QValueList<Type> _list; + TQValueList<Type> _list; }; //---------------------------------------------------------------------------- -class GenericStorage : public QObject +class GenericStorage : public TQObject { Q_OBJECT + TQ_OBJECT public: - GenericStorage(QObject *parent = 0, const char *name = 0) : QObject(parent, name), _dirty(false) {} + GenericStorage(TQObject *tqparent = 0, const char *name = 0) : TQObject(tqparent, name), _dirty(false) {} signals: void changed(); @@ -55,9 +56,10 @@ private: //---------------------------------------------------------------------------- class GenericView; -class GenericViewProxy : public QObject +class GenericViewProxy : public TQObject { Q_OBJECT + TQ_OBJECT public: GenericViewProxy(GenericView &view) : _view(view) {} void addStorage(GenericStorage &storage); diff --git a/src/common/common/streamer.h b/src/common/common/streamer.h index 93d1421..5d0bbaa 100644 --- a/src/common/common/streamer.h +++ b/src/common/common/streamer.h @@ -9,8 +9,8 @@ #ifndef STREAMER_H #define STREAMER_H -#include <qdatastream.h> -#include <qtextstream.h> +#include <tqdatastream.h> +#include <tqtextstream.h> #include "common/global/global.h" #include "common/common/number.h" @@ -19,13 +19,9 @@ template <class DataType> class DataStreamer { public: - uint toCppString(const QValueList<DataType *> &list, QTextStream &s) { - QByteArray a; -#if QT_VERSION<0x040000 - QDataStream ds(a, IO_WriteOnly); -#else - QDataStream ds(&a, QIODevice::WriteOnly); -#endif + uint toCppString(const TQValueList<DataType *> &list, TQTextStream &s) { + TQByteArray a; + TQDataStream ds(a, IO_WriteOnly); for (uint i=0; i<uint(list.count()); i++) ds << *list[i]; s << "\""; for (uint i=0; i<uint(a.count()); i++) { @@ -36,15 +32,11 @@ public: return a.count(); } - QValueList<DataType *> fromCppString(const char *data, uint size) { - QByteArray a; + TQValueList<DataType *> fromCppString(const char *data, uint size) { + TQByteArray a; a.setRawData(data, size); -#if QT_VERSION<0x040000 - QDataStream ds(a, IO_ReadOnly); -#else - QDataStream ds(&a, QIODevice::ReadOnly); -#endif - QValueList<DataType *> list; + TQDataStream ds(a, IO_ReadOnly); + TQValueList<DataType *> list; for (;;) { if ( ds.atEnd() ) break; DataType *data = new DataType; diff --git a/src/common/common/synchronous.cpp b/src/common/common/synchronous.cpp index f392103..b893bf4 100644 --- a/src/common/common/synchronous.cpp +++ b/src/common/common/synchronous.cpp @@ -9,50 +9,35 @@ #include "synchronous.h" #include "common/global/global.h" -#if QT_VERSION<0x040000 -# include <qwidget.h> -#endif +# include <tqwidget.h> Synchronous::Synchronous(uint timeout) { - connect(&_timer, SIGNAL(timeout()), SLOT(done())); + connect(&_timer, TQT_SIGNAL(timeout()), TQT_SLOT(done())); if (timeout) _timer.start(timeout, true); -#if QT_VERSION>=0x040000 - _loop = new QEventLoop(this); -#endif } -#if QT_VERSION<0x040000 // uplifted from kdelibs... -void qt_enter_modal(QWidget *widget); -void qt_leave_modal(QWidget *widget); -#endif +void qt_enter_modal(TQWidget *widget); +void qt_leave_modal(TQWidget *widget); bool Synchronous::enterLoop() { -#if QT_VERSION<0x040000 - QWidget *dummy = 0; - if ( qApp->type()!=QApplication::Tty ) { - dummy = new QWidget(0, 0, WType_Dialog | WShowModal); - dummy->setFocusPolicy(QWidget::NoFocus); + TQWidget *dummy = 0; + if ( tqApp->type()!=TQApplication::Tty ) { + dummy = new TQWidget(0, 0, WType_Dialog | WShowModal); + dummy->setFocusPolicy(TQ_NoFocus); qt_enter_modal(dummy); } - QApplication::eventLoop()->enterLoop(); - if ( qApp->type()!=QApplication::Tty ) { + TQApplication::eventLoop()->enterLoop(); + if ( tqApp->type()!=TQApplication::Tty ) { qt_leave_modal(dummy); delete dummy; } -#else - _loop->exec(); -#endif return _timer.isActive(); } void Synchronous::done() { -#if QT_VERSION<0x040000 - QApplication::eventLoop()->exitLoop(); -#else - _loop->exit(); -#endif + TQApplication::eventLoop()->exitLoop(); } diff --git a/src/common/common/synchronous.h b/src/common/common/synchronous.h index e855e38..759747a 100644 --- a/src/common/common/synchronous.h +++ b/src/common/common/synchronous.h @@ -9,12 +9,13 @@ #ifndef SYNCHRONOUS_H #define SYNCHRONOUS_H -#include <qtimer.h> -#include <qeventloop.h> +#include <tqtimer.h> +#include <tqeventloop.h> -class Synchronous : public QObject +class Synchronous : public TQObject { Q_OBJECT + TQ_OBJECT public: Synchronous(uint timeout = 0); // timeout is ms (0 == no timeout) bool enterLoop(); // return false on timeout @@ -23,10 +24,7 @@ public slots: void done(); private: - QTimer _timer; -#if QT_VERSION>=0x040000 - QEventLoop *_loop; -#endif + TQTimer _timer; }; #endif diff --git a/src/common/common/version_data.cpp b/src/common/common/version_data.cpp index 481ba1a..926f290 100644 --- a/src/common/common/version_data.cpp +++ b/src/common/common/version_data.cpp @@ -8,14 +8,14 @@ ***************************************************************************/ #include "version_data.h" -#include <qregexp.h> +#include <tqregexp.h> #include "number.h" -VersionData VersionData::fromString(const QString &s) +VersionData VersionData::fromString(const TQString &s) { VersionData vd; - QRegExp re("([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)"); + TQRegExp re("([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)"); if ( !re.exactMatch(s) ) return vd; vd._valid = true; vd._majorNum = re.cap(1).toUInt(); @@ -25,7 +25,7 @@ VersionData VersionData::fromString(const QString &s) return vd; } -VersionData VersionData::fromHexString(const QString &s) +VersionData VersionData::fromHexString(const TQString &s) { VersionData vd; if ( s.length()!=6 ) return vd; @@ -36,16 +36,16 @@ VersionData VersionData::fromHexString(const QString &s) return vd; } -QString VersionData::pretty() const +TQString VersionData::pretty() const { if ( !isValid() ) return "---"; - return QString::number(_majorNum) + '.' + QString::number(_minorNum) + '.' + QString::number(_dotNum) + _sub; + return TQString::number(_majorNum) + '.' + TQString::number(_minorNum) + '.' + TQString::number(_dotNum) + _sub; } -QString VersionData::prettyWithoutDot() const +TQString VersionData::prettyWithoutDot() const { if ( !isValid() ) return "---"; - return QString::number(_majorNum) + '.' + QString::number(_minorNum); + return TQString::number(_majorNum) + '.' + TQString::number(_minorNum); } uint VersionData::toUInt() const diff --git a/src/common/common/version_data.h b/src/common/common/version_data.h index 2571631..a060f7b 100644 --- a/src/common/common/version_data.h +++ b/src/common/common/version_data.h @@ -14,8 +14,8 @@ class VersionData { public: - static VersionData fromString(const QString &s); - static VersionData fromHexString(const QString &s); + static VersionData fromString(const TQString &s); + static VersionData fromHexString(const TQString &s); public: VersionData() : _valid(false) {} @@ -26,10 +26,10 @@ public: uchar majorNum() const { return _majorNum; } uchar minorNum() const { return _minorNum; } uchar dotNum() const { return _dotNum; } - QString sub() const { return _sub; } + TQString sub() const { return _sub; } VersionData toWithoutDot() const { return VersionData(_majorNum, _minorNum, 0); } - QString pretty() const; - QString prettyWithoutDot() const; + TQString pretty() const; + TQString prettyWithoutDot() const; uint toUInt() const; bool operator <(const VersionData &vd) const { return toUInt()<vd.toUInt(); } bool operator <=(const VersionData &vd) const { return toUInt()<=vd.toUInt(); } @@ -41,7 +41,7 @@ public: private: bool _valid; uchar _majorNum, _minorNum, _dotNum; - QString _sub; + TQString _sub; }; #endif |
