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 | |
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')
88 files changed, 1837 insertions, 1882 deletions
diff --git a/src/common/cli/cli_global.cpp b/src/common/cli/cli_global.cpp index 4d58bdd..b30aaee 100644 --- a/src/common/cli/cli_global.cpp +++ b/src/common/cli/cli_global.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ #include "cli_global.h" -#include <qdir.h> +#include <tqdir.h> #include "common/global/purl.h" #include "cli_log.h" @@ -18,14 +18,14 @@ bool CLI::_isInteractive = false; CLI::View *CLI::_view = 0; CLI::MainBase *CLI::_main = 0; -CLI::ExitCode CLI::errorExit(const QString &message, ExitCode code) +CLI::ExitCode CLI::errorExit(const TQString &message, ExitCode code) { Q_ASSERT( code!=OK ); _view->log(Log::LineType::SoftError, message); return code; } -CLI::ExitCode CLI::okExit(const QString &message) +CLI::ExitCode CLI::okExit(const TQString &message) { _view->log(Log::LineType::Information, message); return OK; @@ -33,5 +33,5 @@ CLI::ExitCode CLI::okExit(const QString &message) PURL::Directory CLI::runDirectory() { - return PURL::Directory(QDir::currentDirPath()); + return PURL::Directory(TQDir::currentDirPath()); } diff --git a/src/common/cli/cli_global.h b/src/common/cli/cli_global.h index b90f36e..e89c1e7 100644 --- a/src/common/cli/cli_global.h +++ b/src/common/cli/cli_global.h @@ -9,7 +9,7 @@ #ifndef CLI_GLOBAL_H #define CLI_GLOBAL_H -#include <qstring.h> +#include <tqstring.h> namespace PURL { class Directory; } namespace CLI @@ -19,8 +19,8 @@ class View; class MainBase; enum ExitCode { EXITING = 1, OK = 0, ARG_ERROR = -1, NOT_SUPPORTED_ERROR = -2, FILE_ERROR = -3, EXEC_ERROR = -4 }; -extern ExitCode errorExit(const QString &message, ExitCode code); -extern ExitCode okExit(const QString &message); +extern ExitCode errorExit(const TQString &message, ExitCode code); +extern ExitCode okExit(const TQString &message); extern PURL::Directory runDirectory(); extern bool _force; diff --git a/src/common/cli/cli_log.cpp b/src/common/cli/cli_log.cpp index 603d5f8..948675b 100644 --- a/src/common/cli/cli_log.cpp +++ b/src/common/cli/cli_log.cpp @@ -11,53 +11,37 @@ #include "common/global/global.h" #include "cli_global.h" -void CLI::View::doLog(Log::LineType type, const QString &text, Log::Action) +void CLI::View::doLog(Log::LineType type, const TQString &text, Log::Action) { - QString s = text + "\n"; + TQString s = text + "\n"; switch (type.type()) { case Log::LineType::Error: case Log::LineType::SoftError: s = "Error: " + s; break; case Log::LineType::Warning: s = "Warning: " + s; break; default: break; } -#if QT_VERSION<0x040000 if ( type==Log::LineType::Error || type==Log::LineType::SoftError ) fprintf(stderr, "%s", s.latin1()); else fprintf(stdout, "%s", s.latin1()); -#else - QByteArray ba = s.toLatin1(); - if ( type==Log::LineType::Error || type==Log::LineType::SoftError ) fprintf(stderr, "%s", ba.constData()); - else fprintf(stdout, "%s", ba.constData()); -#endif } -void CLI::View::doLog(Log::DebugLevel, const QString &text, Log::Action) +void CLI::View::doLog(Log::DebugLevel, const TQString &text, Log::Action) { - QString s = text + "\n"; -#if QT_VERSION<0x040000 + TQString s = text + "\n"; fprintf(stdout, "%s", s.latin1()); -#else - QByteArray ba = s.toLatin1(); - fprintf(stdout, "%s", ba.constData()); -#endif } -void CLI::View::appendToLastLine(const QString &text) +void CLI::View::appendToLastLine(const TQString &text) { -#if QT_VERSION<0x040000 fprintf(stdout, "%s", text.latin1()); -#else - QByteArray ba = text.toLatin1(); - fprintf(stdout, "%s", ba.constData()); -#endif } -void CLI::View::sorry(const QString &message, const QString &details) +void CLI::View::sorry(const TQString &message, const TQString &details) { if ( details.isEmpty() ) log(Log::LineType::Error, message, Log::Immediate); else log(Log::LineType::Error, message + " (" + details + ")", Log::Immediate); } -bool CLI::View::askContinue(const QString &message) +bool CLI::View::askContinue(const TQString &message) { log(Log::LineType::Warning, message + " " + (_force ? i18n("*yes*") : i18n("*no*")), Log::Immediate); if (_force) return true; diff --git a/src/common/cli/cli_log.h b/src/common/cli/cli_log.h index 2fa83dc..7585b05 100644 --- a/src/common/cli/cli_log.h +++ b/src/common/cli/cli_log.h @@ -17,15 +17,15 @@ namespace CLI class View : public Log::View { public: - virtual void appendToLastLine(const QString &text); + virtual void appendToLastLine(const TQString &text); virtual void clear() {} - virtual void sorry(const QString &message, const QString &details); - virtual bool askContinue(const QString &message); + virtual void sorry(const TQString &message, const TQString &details); + virtual bool askContinue(const TQString &message); virtual void logUserAbort(); private: - virtual void doLog(Log::LineType type, const QString &text, Log::Action action); - virtual void doLog(Log::DebugLevel level, const QString &text, Log::Action action); + virtual void doLog(Log::LineType type, const TQString &text, Log::Action action); + virtual void doLog(Log::DebugLevel level, const TQString &text, Log::Action action); }; } // namespace diff --git a/src/common/cli/cli_main.cpp b/src/common/cli/cli_main.cpp index 7d75dbb..11537a7 100644 --- a/src/common/cli/cli_main.cpp +++ b/src/common/cli/cli_main.cpp @@ -12,7 +12,7 @@ #include "common/global/about.h" //----------------------------------------------------------------------------- -const CLI::CommandData *CLI::findCommandData(const QString &command) +const CLI::CommandData *CLI::findCommandData(const TQString &command) { for (uint i=0; NORMAL_COMMAND_DATA[i].name; i++) if ( NORMAL_COMMAND_DATA[i].name==command ) return &NORMAL_COMMAND_DATA[i]; @@ -22,23 +22,23 @@ const CLI::CommandData *CLI::findCommandData(const QString &command) return 0; } -CLI::ExitCode CLI::findCommand(const QString &s) +CLI::ExitCode CLI::findCommand(const TQString &s) { if ( s.isEmpty() ) return errorExit(i18n("No command specified"), ARG_ERROR); const CommandData *data = findCommandData(s); - if ( data==0 ) return errorExit(i18n("Unknown command: %1").arg(s), ARG_ERROR); + if ( data==0 ) return errorExit(i18n("Unknown command: %1").tqarg(s), ARG_ERROR); return OK; } //----------------------------------------------------------------------------- -bool CLI::isPropertyList(const QString &s) +bool CLI::isPropertyList(const TQString &s) { for (uint i=0; PROPERTY_DATA[i].name; i++) if ( s==PROPERTY_DATA[i].list ) return true; return false; } -bool CLI::isProperty(const QString &s) +bool CLI::isProperty(const TQString &s) { for (uint i=0; PROPERTY_DATA[i].name; i++) if ( s==PROPERTY_DATA[i].name ) return true; @@ -112,7 +112,7 @@ CLI::ExitCode CLI::propertyList() //----------------------------------------------------------------------------- CLI::MainBase::MainBase(Properties properties) - : QObject(0, "main"), _properties(properties) + : TQObject(0, "main"), _properties(properties) { Q_ASSERT( _main==0 ); _main = this; @@ -136,7 +136,7 @@ CLI::OptionList CLI::MainBase::optionList(const char *fileDescription) const opt.description = 0; opt.def = 0; if ( PROPERTY_DATA[i].help==0 ) { - Q_ASSERT( QString(PROPERTY_DATA[i].name)!=PROPERTY_DATA[i].optName ); + Q_ASSERT( TQString(PROPERTY_DATA[i].name)!=PROPERTY_DATA[i].optName ); opt.name = PROPERTY_DATA[i].name; // alias list.append(opt); } else { @@ -164,7 +164,7 @@ CLI::OptionList CLI::MainBase::optionList(const char *fileDescription) const return list; } -CLI::ExitCode CLI::MainBase::list(const QString &command) +CLI::ExitCode CLI::MainBase::list(const TQString &command) { if ( command=="command-list" ) return commandList(); if ( command=="property-list" ) return propertyList(); @@ -179,10 +179,10 @@ CLI::ExitCode CLI::MainBase::doRun() for (uint i=0; PROPERTY_DATA[i].name; i++) { if ( PROPERTY_DATA[i].optName==0 ) continue; // alias or interactive only if ( !_args->isSet(PROPERTY_DATA[i].name) ) continue; - QString option = _args->getOption(PROPERTY_DATA[i].name); + TQString option = _args->getOption(PROPERTY_DATA[i].name); ExitCode code = executeSetCommand(PROPERTY_DATA[i].name, option); if ( code!=OK ) return code; - log(Log::LineType::Information, QString("%1: %2").arg(PROPERTY_DATA[i].name).arg(executeGetCommand(PROPERTY_DATA[i].name))); + log(Log::LineType::Information, TQString("%1: %2").tqarg(PROPERTY_DATA[i].name).tqarg(executeGetCommand(PROPERTY_DATA[i].name))); } // process default lists @@ -197,7 +197,7 @@ CLI::ExitCode CLI::MainBase::doRun() if ( code!=OK || interactive ) return code; // find command - QString command = _args->getOption("command"); + TQString command = _args->getOption("command"); code = findCommand(command); if ( code!=OK ) return code; diff --git a/src/common/cli/cli_main.h b/src/common/cli/cli_main.h index 9b54c70..b0d71cb 100644 --- a/src/common/cli/cli_main.h +++ b/src/common/cli/cli_main.h @@ -17,8 +17,8 @@ namespace CLI { //----------------------------------------------------------------------------- enum Property { NoProperty = 0, HasForce = 1, HasInteractiveMode = 2 }; -Q_DECLARE_FLAGS(Properties, Property) -Q_DECLARE_OPERATORS_FOR_FLAGS(Properties) +TQ_DECLARE_FLAGS(Properties, Property) +TQ_DECLARE_OPERATORS_FOR_FLAGS(Properties) extern const KCmdLineOptions OPTIONS[]; //----------------------------------------------------------------------------- @@ -29,8 +29,8 @@ struct CommandData { }; extern const CommandData NORMAL_COMMAND_DATA[]; extern const CommandData INTERACTIVE_COMMAND_DATA[]; -extern const CommandData *findCommandData(const QString &command); -extern ExitCode findCommand(const QString &s); +extern const CommandData *findCommandData(const TQString &command); +extern ExitCode findCommand(const TQString &s); extern ExitCode commandList(); //----------------------------------------------------------------------------- @@ -39,8 +39,8 @@ struct PropertyData const char *name, *optName, *alias, *help, *list, *listHelp; }; extern const PropertyData PROPERTY_DATA[]; -extern bool isPropertyList(const QString &s); -extern bool isProperty(const QString &s); +extern bool isPropertyList(const TQString &s); +extern bool isProperty(const TQString &s); extern ExitCode propertyList(); //----------------------------------------------------------------------------- @@ -55,18 +55,19 @@ private: }; //----------------------------------------------------------------------------- -class MainBase : public QObject, public Log::Base +class MainBase : public TQObject, public Log::Base { Q_OBJECT + TQ_OBJECT public: MainBase(Properties properties); virtual OptionList optionList(const char *fileDescription) const; virtual ExitCode doRun(); - virtual ExitCode list(const QString &listName); - virtual ExitCode prepareCommand(const QString &command) = 0; - virtual ExitCode executeCommand(const QString &command) = 0; - virtual ExitCode executeSetCommand(const QString &property, const QString &value) = 0; - virtual QString executeGetCommand(const QString &property) = 0; + virtual ExitCode list(const TQString &listName); + virtual ExitCode prepareCommand(const TQString &command) = 0; + virtual ExitCode executeCommand(const TQString &command) = 0; + virtual ExitCode executeSetCommand(const TQString &property, const TQString &value) = 0; + virtual TQString executeGetCommand(const TQString &property) = 0; protected: Properties _properties; diff --git a/src/common/cli/cli_pfile.cpp b/src/common/cli/cli_pfile.cpp index 96add3a..e984e52 100644 --- a/src/common/cli/cli_pfile.cpp +++ b/src/common/cli/cli_pfile.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ #include "common/global/pfile.h" -#include <qfile.h> +#include <tqfile.h> //----------------------------------------------------------------------------- bool PURL::File::openForWrite() @@ -17,7 +17,7 @@ bool PURL::File::openForWrite() _file->setName(url().filepath()); if ( !_file->open(IO_WriteOnly) ) { _error = i18n("Could not open file for writing."); - _log.sorry(_error, i18n("File: %1").arg(_file->name())); + _log.sorry(_error, i18n("File: %1").tqarg(_file->name())); return false; } return true; @@ -35,7 +35,7 @@ bool PURL::File::openForRead() _file->setName(_url.filepath()); if ( !_file->open(IO_ReadOnly) ) { _error = i18n("Could not open file for reading."); - _log.sorry(_error, i18n("File: %1").arg(_file->name())); + _log.sorry(_error, i18n("File: %1").tqarg(_file->name())); return false; } return true; 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 diff --git a/src/common/global/about.cpp b/src/common/global/about.cpp index 33bfae9..ffda7db 100644 --- a/src/common/global/about.cpp +++ b/src/common/global/about.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ #include "about.h" -#if defined(Q_WS_WIN) +#if defined(TQ_WS_WIN) # define SVN_REVISION "windows" #else # include "svn_revision/svn_revision.h" @@ -59,10 +59,10 @@ void Piklab::init(KAboutData *about, int argc, char **argv, bool gui, const KCmd KCmdLineArgs::init(argc, argv, about); KCmdLineArgs::addCmdLineOptions(options); #if defined(NO_KDE) -# if QT_VERSION<0x040000 - (void)new QApplication(argc, argv, QApplication::Tty); +# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 + (void)new TQApplication(argc, argv, TQApplication::Tty); # else - (void)new QCoreApplication(argc, argv); + (void)new TQCoreApplication(argc, argv); # endif #else (void)new KApplication(gui, gui); diff --git a/src/common/global/about.h b/src/common/global/about.h index e20ee46..4d53914 100644 --- a/src/common/global/about.h +++ b/src/common/global/about.h @@ -14,7 +14,7 @@ namespace Piklab { //----------------------------------------------------------------------------- -class OptionList : public QValueList<KCmdLineOptions> +class OptionList : public TQValueList<KCmdLineOptions> { public: OptionList() : _options(0) {} diff --git a/src/common/global/generic_config.cpp b/src/common/global/generic_config.cpp index 841233b..6ddf44c 100644 --- a/src/common/global/generic_config.cpp +++ b/src/common/global/generic_config.cpp @@ -11,12 +11,12 @@ #include "global.h" #if defined(NO_KDE) -# include <qsettings.h> +# include <tqsettings.h> class GenericConfigPrivate { public: - GenericConfigPrivate(const QString &group) { _settings.beginGroup("/piklab/" + group); } - QSettings _settings; + GenericConfigPrivate(const TQString &group) { _settings.beginGroup("/piklab/" + group); } + TQSettings _settings; }; #else # include <kapplication.h> @@ -24,7 +24,7 @@ public: class GenericConfigPrivate { public: - GenericConfigPrivate(const QString &group) : _group(group) {} + GenericConfigPrivate(const TQString &group) : _group(group) {} ~GenericConfigPrivate() { kapp->config()->sync(); } KConfig &config() { KConfig *conf = kapp->config(); @@ -33,11 +33,11 @@ public: } private: - QString _group; + TQString _group; }; #endif -GenericConfig::GenericConfig(const QString &group) +GenericConfig::GenericConfig(const TQString &group) : _group(group) { _d = new GenericConfigPrivate(group); @@ -57,10 +57,10 @@ void GenericConfig::rollback() #endif } -QString GenericConfig::readEntry(const QString &key, const QString &def) const +TQString GenericConfig::readEntry(const TQString &key, const TQString &def) const { #if defined(NO_KDE) -# if QT_VERSION<0x040000 +# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 return _d->_settings.readEntry(key, def); # else return _d->_settings.value(key, def).toString(); @@ -69,10 +69,10 @@ QString GenericConfig::readEntry(const QString &key, const QString &def) const return _d->config().readEntry(key, def); #endif } -void GenericConfig::writeEntry(const QString &key, const QString &value) +void GenericConfig::writeEntry(const TQString &key, const TQString &value) { #if defined(NO_KDE) -# if QT_VERSION<0x040000 +# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 _d->_settings.writeEntry(key, value); # else _d->_settings.setValue(key, value); @@ -82,10 +82,10 @@ void GenericConfig::writeEntry(const QString &key, const QString &value) #endif } -QStringList GenericConfig::readListEntry(const QString &key, const QStringList &defaultValues) const +TQStringList GenericConfig::readListEntry(const TQString &key, const TQStringList &defaultValues) const { #if defined(NO_KDE) -# if QT_VERSION<0x040000 +# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 if ( _d->_settings.readEntry(key).isNull() ) return defaultValues; return _d->_settings.readListEntry(key); # else @@ -96,10 +96,10 @@ QStringList GenericConfig::readListEntry(const QString &key, const QStringList & return _d->config().readListEntry(key); #endif } -void GenericConfig::writeEntry(const QString &key, const QStringList &value) +void GenericConfig::writeEntry(const TQString &key, const TQStringList &value) { #if defined(NO_KDE) -# if QT_VERSION<0x040000 +# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 _d->_settings.writeEntry(key, value); # else _d->_settings.setValue(key, value); @@ -109,12 +109,12 @@ void GenericConfig::writeEntry(const QString &key, const QStringList &value) #endif } -QValueList<int> GenericConfig::readIntListEntry(const QString &key) const +TQValueList<int> GenericConfig::readIntListEntry(const TQString &key) const { #if defined(NO_KDE) - QValueList<int> ilist; - QStringList list = readListEntry(key, QStringList()); - QStringList::const_iterator it; + TQValueList<int> ilist; + TQStringList list = readListEntry(key, TQStringList()); + TQStringList::const_iterator it; for (it=list.begin(); it!=list.end(); ++it) { bool ok; int v = (*it).toInt(&ok); @@ -126,32 +126,32 @@ QValueList<int> GenericConfig::readIntListEntry(const QString &key) const return _d->config().readIntListEntry(key); #endif } -void GenericConfig::writeEntry(const QString &key, const QValueList<int> &value) +void GenericConfig::writeEntry(const TQString &key, const TQValueList<int> &value) { #if defined(NO_KDE) - QStringList list; - QValueList<int>::const_iterator it; - for (it=value.begin(); it!=value.end(); ++it) list.append(QString::number(*it)); + TQStringList list; + TQValueList<int>::const_iterator it; + for (it=value.begin(); it!=value.end(); ++it) list.append(TQString::number(*it)); writeEntry(key, list); #else _d->config().writeEntry(key, value); #endif } -QSize GenericConfig::readSizeEntry(const QString &key, const QSize *def) const +TQSize GenericConfig::readSizeEntry(const TQString &key, const TQSize *def) const { #if defined(NO_KDE) - QValueList<int> list = readIntListEntry(key); + TQValueList<int> list = readIntListEntry(key); if ( list.count()!=2 ) return *def; - return QSize(list[0], list[1]); + return TQSize(list[0], list[1]); #else return _d->config().readSizeEntry(key, def); #endif } -void GenericConfig::writeEntry(const QString &key, const QSize &value) +void GenericConfig::writeEntry(const TQString &key, const TQSize &value) { #if defined(NO_KDE) - QValueList<int> ilist; + TQValueList<int> ilist; ilist.append(value.width()); ilist.append(value.height()); writeEntry(key, ilist); @@ -160,10 +160,10 @@ void GenericConfig::writeEntry(const QString &key, const QSize &value) #endif } -bool GenericConfig::readBoolEntry(const QString &key, bool def) const +bool GenericConfig::readBoolEntry(const TQString &key, bool def) const { #if defined(NO_KDE) -# if QT_VERSION<0x040000 +# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 return _d->_settings.readBoolEntry(key, def); # else return _d->_settings.value(key, def).toBool(); @@ -172,10 +172,10 @@ bool GenericConfig::readBoolEntry(const QString &key, bool def) const return _d->config().readBoolEntry(key, def); #endif } -void GenericConfig::writeEntry(const QString &key, bool value) +void GenericConfig::writeEntry(const TQString &key, bool value) { #if defined(NO_KDE) -# if QT_VERSION<0x040000 +# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 _d->_settings.writeEntry(key, value); # else _d->_settings.setValue(key, value); @@ -185,10 +185,10 @@ void GenericConfig::writeEntry(const QString &key, bool value) #endif } -int GenericConfig::readIntEntry(const QString &key, int def) const +int GenericConfig::readIntEntry(const TQString &key, int def) const { #if defined(NO_KDE) -# if QT_VERSION<0x040000 +# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 return _d->_settings.readNumEntry(key, def); # else return _d->_settings.value(key, def).toInt(); @@ -197,10 +197,10 @@ int GenericConfig::readIntEntry(const QString &key, int def) const return _d->config().readNumEntry(key, def); #endif } -void GenericConfig::writeEntry(const QString &key, int value) +void GenericConfig::writeEntry(const TQString &key, int value) { #if defined(NO_KDE) -# if QT_VERSION<0x040000 +# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 _d->_settings.writeEntry(key, value); # else _d->_settings.setValue(key, value); @@ -210,7 +210,7 @@ void GenericConfig::writeEntry(const QString &key, int value) #endif } -void GenericConfig::deleteGroup(const QString &group) +void GenericConfig::deleteGroup(const TQString &group) { #if defined(NO_KDE) Q_UNUSED(group); @@ -220,22 +220,22 @@ void GenericConfig::deleteGroup(const QString &group) #endif } -QVariant GenericConfig::readVariantEntry(const QString &key, const QVariant &defValue) const +TQVariant GenericConfig::readVariantEntry(const TQString &key, const TQVariant &defValue) const { switch (defValue.type()) { - case QVariant::Bool: return QVariant(readBoolEntry(key, defValue.toBool()), 0); - case QVariant::UInt: return readUIntEntry(key, defValue.toUInt()); + case TQVariant::Bool: return TQVariant(readBoolEntry(key, defValue.toBool()), 0); + case TQVariant::UInt: return readUIntEntry(key, defValue.toUInt()); default: break; } Q_ASSERT(false); - return QVariant(); + return TQVariant(); } -void GenericConfig::writeEntry(const QString &key, const QVariant &v) +void GenericConfig::writeEntry(const TQString &key, const TQVariant &v) { switch (v.type()) { - case QVariant::Bool: writeEntry(key, v.toBool()); break; - case QVariant::UInt: writeEntry(key, v.toUInt()); break; + case TQVariant::Bool: writeEntry(key, v.toBool()); break; + case TQVariant::UInt: writeEntry(key, v.toUInt()); break; default: Q_ASSERT(false); break; } } diff --git a/src/common/global/generic_config.h b/src/common/global/generic_config.h index 70dfeaa..74002e5 100644 --- a/src/common/global/generic_config.h +++ b/src/common/global/generic_config.h @@ -9,8 +9,8 @@ #ifndef GENERIC_CONFIG_H #define GENERIC_CONFIG_H -#include <qvariant.h> -#include <qsize.h> +#include <tqvariant.h> +#include <tqsize.h> #include "global.h" #include "common/common/misc.h" @@ -20,50 +20,50 @@ class GenericConfigPrivate; class GenericConfig { public: - GenericConfig(const QString &group); + GenericConfig(const TQString &group); ~GenericConfig(); - QString group() const { return _group; } + TQString group() const { return _group; } void rollback(); - QString readEntry(const QString &key, const QString &def = QString::null) const; - void writeEntry(const QString &key, const QString &value); - void writeEntry(const QString &key, const QCString &value) { writeEntry(key, QString(value)); } - void writeEntry(const QString &key, const char *value) { writeEntry(key, QString(value)); } - QStringList readListEntry(const QString &key, const QStringList &defaultValues) const; - void writeEntry(const QString &key, const QStringList &value); - QValueList<int> readIntListEntry(const QString &key) const; - void writeEntry(const QString &key, const QValueList<int> &value); - QSize readSizeEntry(const QString &key, const QSize *def = 0) const; - void writeEntry(const QString &key, const QSize &value); - bool readBoolEntry(const QString &key, bool def) const; - void writeEntry(const QString &key, bool value); - int readIntEntry(const QString &key, int def = 0) const; - void writeEntry(const QString &key, int value); - uint readUIntEntry(const QString &key, uint def = 0) const { return qMax(0, readIntEntry(key, def)); } - void writeEntry(const QString &key, uint value) { writeEntry(key, int(value)); } + TQString readEntry(const TQString &key, const TQString &def = TQString()) const; + void writeEntry(const TQString &key, const TQString &value); + void writeEntry(const TQString &key, const TQCString &value) { writeEntry(key, TQString(value)); } + void writeEntry(const TQString &key, const char *value) { writeEntry(key, TQString(value)); } + TQStringList readListEntry(const TQString &key, const TQStringList &defaultValues) const; + void writeEntry(const TQString &key, const TQStringList &value); + TQValueList<int> readIntListEntry(const TQString &key) const; + void writeEntry(const TQString &key, const TQValueList<int> &value); + TQSize readSizeEntry(const TQString &key, const TQSize *def = 0) const; + void writeEntry(const TQString &key, const TQSize &value); + bool readBoolEntry(const TQString &key, bool def) const; + void writeEntry(const TQString &key, bool value); + int readIntEntry(const TQString &key, int def = 0) const; + void writeEntry(const TQString &key, int value); + uint readUIntEntry(const TQString &key, uint def = 0) const { return qMax(0, readIntEntry(key, def)); } + void writeEntry(const TQString &key, uint value) { writeEntry(key, int(value)); } template <typename Enum> - Enum readEnumEntry(const QString &key, Enum def = Enum::Nb_Types) const { return Enum::fromKey(readEntry(key, def.key())); } + Enum readEnumEntry(const TQString &key, Enum def = Enum::Nb_Types) const { return Enum::fromKey(readEntry(key, def.key())); } template <typename Enum> - void writeEnumEntry(const QString &key, Enum v) { writeEntry(key, v.key()); } - QVariant readVariantEntry(const QString &key, const QVariant &defValue) const; - void writeEntry(const QString &key, const QVariant &value); + void writeEnumEntry(const TQString &key, Enum v) { writeEntry(key, v.key()); } + TQVariant readVariantEntry(const TQString &key, const TQVariant &defValue) const; + void writeEntry(const TQString &key, const TQVariant &value); - static void deleteGroup(const QString &group); + static void deleteGroup(const TQString &group); struct ItemData { const char *key, *label; - QVariant defValue; + TQVariant defValue; }; template <typename Type> - QVariant readVariantEntry(Type type) const { return readVariantEntry(type.data().key, type.data().defValue); } + TQVariant readVariantEntry(Type type) const { return readVariantEntry(type.data().key, type.data().defValue); } template <typename Type> - void writeVariantEntry(Type type, const QVariant &value) { + void writeVariantEntry(Type type, const TQVariant &value) { Q_ASSERT( value.type()==type.data().defValue.type() ); writeEntry(type.data().key, value); } private: - QString _group; + TQString _group; GenericConfigPrivate *_d; }; @@ -72,11 +72,11 @@ private: #define END_DECLARE_CONFIG(Type, group) \ END_DECLARE_ENUM(Type, GenericConfig::ItemData) \ - inline QVariant readConfigEntry(Type type) { \ + inline TQVariant readConfigEntry(Type type) { \ GenericConfig config(group); \ return config.readVariantEntry<Type>(type); \ } \ - inline void writeConfigEntry(Type type, const QVariant &v) { \ + inline void writeConfigEntry(Type type, const TQVariant &v) { \ GenericConfig config(group); \ config.writeVariantEntry<Type>(type, v); \ } diff --git a/src/common/global/global.h b/src/common/global/global.h index 72dab0e..9eb8979 100644 --- a/src/common/global/global.h +++ b/src/common/global/global.h @@ -9,37 +9,21 @@ #ifndef GLOBAL_H #define GLOBAL_H -#include <qglobal.h> +#include <tqglobal.h> -#if QT_VERSION<0x040000 -# include <qapplication.h> -# include <qvaluelist.h> -# include <qvaluevector.h> -# include <qmemarray.h> +# include <tqapplication.h> +# include <tqvaluelist.h> +# include <tqvaluevector.h> +# include <tqmemarray.h> # include "common/common/qflags.h" -# define qMax QMAX -# define qMin QMIN -# include <qurl.h> -# define Q3Url QUrl -# include <qguardedptr.h> -#else -# include <qcoreapplication.h> -# include <Qt3Support/Q3ValueList> -# define QValueList Q3ValueList -# include <Qt3Support/Q3ValueVector> -# define QValueVector Q3ValueVector -# include <Qt3Support/Q3MemArray> -# define QMemArray Q3MemArray -# define qHeapSort qSort -# include <Qt3Support/Q3Url> -# include <Qt3Support/Q3MimeSourceFactory> -# define QMimeSourceFactory Q3MimeSourceFactory -# include <qpointer.h> -# define QGuardedPtr QPointer -#endif +# define qMax TQMAX +# define qMin TQMIN +# include <tqurl.h> +# define Q3Url TQUrl +# include <tqguardedptr.h> #if defined(NO_KDE) -# include "qt_config.h" +# include "tqt_config.h" # include "common/nokde/nokde_kurl.h" # include "common/nokde/nokde_klocale.h" # include "common/nokde/nokde_kaboutdata.h" diff --git a/src/common/global/log.cpp b/src/common/global/log.cpp index cf85303..1ab42d0 100644 --- a/src/common/global/log.cpp +++ b/src/common/global/log.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ #include "log.h" -#include <qeventloop.h> +#include <tqeventloop.h> #include "global.h" //----------------------------------------------------------------------------- @@ -41,12 +41,12 @@ void Log::View::setDebugLevel(DebugLevel level) _debugLevel = level; } -void Log::View::log(LineType type, const QString &text, Action action) +void Log::View::log(LineType type, const TQString &text, Action action) { if ( _modes[type.type()]==Show ) doLog(type, text, action); } -void Log::View::log(DebugLevel level, const QString &text, Action action) +void Log::View::log(DebugLevel level, const TQString &text, Action action) { Q_ASSERT( level!=DebugLevel::Quiet ); updateDebugLevel(); @@ -59,30 +59,30 @@ void Log::View::logUserAbort() } //----------------------------------------------------------------------------- -void Log::StringView::sorry(const QString &message, const QString &details) +void Log::StringView::sorry(const TQString &message, const TQString &details) { if ( details.isEmpty() ) _s += message; else _s += message + ": " + details; } -bool Log::StringView::askContinue(const QString &message) +bool Log::StringView::askContinue(const TQString &message) { log(LineType::Warning, message, Immediate); return false; // always fail } //----------------------------------------------------------------------------- -Log::Base::Base(Base *parent) +Log::Base::Base(Base *tqparent) : _parent(0), _data(0) { - setParent(parent); + setParent(tqparent); } -void Log::Base::setParent(Base *parent) +void Log::Base::setParent(Base *tqparent) { delete _data; - _parent = parent; - _data = (parent ? 0 : new LogData); + _parent = tqparent; + _data = (tqparent ? 0 : new LogData); } Log::Base::~Base() @@ -101,28 +101,28 @@ void Log::Base::logUserAbort() if ( view() ) view()->logUserAbort(); } -void Log::Base::log(LineType type, const QString &message, Action action) +void Log::Base::log(LineType type, const TQString &message, Action action) { if ( type==LineType::Error ) setError(message); if ( view() ) view()->log(type, message, action); } -void Log::Base::log(DebugLevel level, const QString &message, Action action) +void Log::Base::log(DebugLevel level, const TQString &message, Action action) { if ( view() ) view()->log(level, message, action); } -void Log::Base::appendToLastLine(const QString &text) +void Log::Base::appendToLastLine(const TQString &text) { if ( view() ) view()->appendToLastLine(text); } -void Log::Base::sorry(const QString &message, const QString &details) +void Log::Base::sorry(const TQString &message, const TQString &details) { if ( view() ) view()->sorry(message, details); } -bool Log::Base::askContinue(const QString &message) +bool Log::Base::askContinue(const TQString &message) { if ( view()==0 ) return false; return view()->askContinue(message); @@ -135,9 +135,9 @@ void Log::Base::clear() } //----------------------------------------------------------------------------- -QString Log::KeyList::text() const +TQString Log::KeyList::text() const { - QString text; + TQString text; if ( !_title.isEmpty() ) text += _title + "\n"; uint nb = 0; for (uint i=0; i<uint(_keys.count()); i++) nb = qMax(nb, uint(_keys[i].length())); diff --git a/src/common/global/log.h b/src/common/global/log.h index 7383d57..eff0b88 100644 --- a/src/common/global/log.h +++ b/src/common/global/log.h @@ -9,7 +9,7 @@ #ifndef LOG_H #define LOG_H -#include <qstringlist.h> +#include <tqstringlist.h> #include "common/common/key_enum.h" @@ -34,11 +34,11 @@ class Generic { public: virtual ~Generic() {} - virtual void log(LineType type, const QString &text, Action action = Immediate) = 0; - virtual void log(DebugLevel level, const QString &text, Action action = Immediate) = 0; - virtual void appendToLastLine(const QString &text) = 0; - virtual void sorry(const QString &message, const QString &details) = 0; - virtual bool askContinue(const QString &message) = 0; + virtual void log(LineType type, const TQString &text, Action action = Immediate) = 0; + virtual void log(DebugLevel level, const TQString &text, Action action = Immediate) = 0; + virtual void appendToLastLine(const TQString &text) = 0; + virtual void sorry(const TQString &message, const TQString &details) = 0; + virtual bool askContinue(const TQString &message) = 0; virtual void clear() = 0; virtual void logUserAbort() = 0; }; @@ -50,8 +50,8 @@ public: ShowMode showMode(LineType type) const { return _modes[type.type()]; } void setShowMode(LineType type, ShowMode mode) { _modes[type.type()] = mode; } void setDebugLevel(DebugLevel level); - virtual void log(LineType type, const QString &text, Action action = Immediate); - virtual void log(DebugLevel level, const QString &text, Action action = Immediate); + virtual void log(LineType type, const TQString &text, Action action = Immediate); + virtual void log(DebugLevel level, const TQString &text, Action action = Immediate); virtual void logUserAbort(); protected: @@ -59,8 +59,8 @@ protected: DebugLevel _debugLevel; virtual void updateDebugLevel() {} - virtual void doLog(LineType type, const QString &text, Action action) = 0; - virtual void doLog(DebugLevel level, const QString &text, Action action) = 0; + virtual void doLog(LineType type, const TQString &text, Action action) = 0; + virtual void doLog(DebugLevel level, const TQString &text, Action action) = 0; }; //----------------------------------------------------------------------------- @@ -68,38 +68,38 @@ class StringView : public View { public: StringView() {} - QString string() const { return _s; } - virtual void appendToLastLine(const QString &text) { _s += text; } - virtual void clear() { _s = QString::null; } - virtual void sorry(const QString &message, const QString &details); - virtual bool askContinue(const QString &message); + TQString string() const { return _s; } + virtual void appendToLastLine(const TQString &text) { _s += text; } + virtual void clear() { _s = TQString(); } + virtual void sorry(const TQString &message, const TQString &details); + virtual bool askContinue(const TQString &message); private: - QString _s; + TQString _s; - virtual void doLog(LineType, const QString &text, Action) { _s += text + "\n"; } - virtual void doLog(DebugLevel, const QString &text, Action) { _s += text + "\n"; } + virtual void doLog(LineType, const TQString &text, Action) { _s += text + "\n"; } + virtual void doLog(DebugLevel, const TQString &text, Action) { _s += text + "\n"; } }; //----------------------------------------------------------------------------- class Base : public Generic { public: - Base(Base *parent = 0); + Base(Base *tqparent = 0); virtual ~Base(); - void setParent(Base *parent); + void setParent(Base *tqparent); void setView(View *view); View *view() { return logData()->view; } - virtual void log(LineType type, const QString &message, Action action = Immediate); - virtual void log(DebugLevel level, const QString &message, Action action = Immediate); - virtual void appendToLastLine(const QString &text); - void setError(const QString &error) { logData()->error = error; } + virtual void log(LineType type, const TQString &message, Action action = Immediate); + virtual void log(DebugLevel level, const TQString &message, Action action = Immediate); + virtual void appendToLastLine(const TQString &text); + void setError(const TQString &error) { logData()->error = error; } virtual bool hasError() const { return !logData()->error.isNull(); } - virtual QString error() const { return logData()->error; } - virtual void resetError() { logData()->error = QString::null; } - virtual void sorry(const QString &message, const QString &details = QString::null); - virtual bool askContinue(const QString &message); + virtual TQString error() const { return logData()->error; } + virtual void resetError() { logData()->error = TQString(); } + virtual void sorry(const TQString &message, const TQString &details = TQString()); + virtual bool askContinue(const TQString &message); virtual void clear(); void logUserAbort(); @@ -108,7 +108,7 @@ protected: class LogData { public: LogData() : view(0) {} - QString error; + TQString error; View *view; }; LogData *_data; @@ -118,15 +118,15 @@ protected: class KeyList { public: - KeyList(const QString &title = QString::null) : _title(title) {} - void setTitle(const QString &title) { _title = title; } - void append(const QString &key, const QString &label) { _keys += key; _labels += label; } - QString text() const; + KeyList(const TQString &title = TQString()) : _title(title) {} + void setTitle(const TQString &title) { _title = title; } + void append(const TQString &key, const TQString &label) { _keys += key; _labels += label; } + TQString text() const; void display(Generic &log) const; private: - QString _title; - QStringList _keys, _labels; + TQString _title; + TQStringList _keys, _labels; }; } // namespace diff --git a/src/common/global/pfile.cpp b/src/common/global/pfile.cpp index 71cee16..66d7f4b 100644 --- a/src/common/global/pfile.cpp +++ b/src/common/global/pfile.cpp @@ -8,10 +8,10 @@ ***************************************************************************/ #include "pfile.h" -#include <qfile.h> +#include <tqfile.h> //----------------------------------------------------------------------------- -PURL::FileBase::FileBase(Log::Generic &log, const QString &extension) +PURL::FileBase::FileBase(Log::Generic &log, const TQString &extension) : _tmp(0), _file(0), _stream(0), _extension(extension), _log(log) {} @@ -22,12 +22,12 @@ PURL::FileBase::~FileBase() delete _tmp; } -const QFile *PURL::FileBase::qfile() const +const TQFile *PURL::FileBase::qfile() const { return (_tmp ? _tmp->file() : _file); } -QFile *PURL::FileBase::qfile() +TQFile *PURL::FileBase::qfile() { return (_tmp ? _tmp->file() : _file); } @@ -37,9 +37,9 @@ void PURL::FileBase::flush() if ( qfile() ) qfile()->flush(); } -QTextStream &PURL::FileBase::stream() +TQTextStream &PURL::FileBase::stream() { - if ( _stream==0 ) _stream = new QTextStream(qfile()); + if ( _stream==0 ) _stream = new TQTextStream(qfile()); return *_stream; } @@ -49,7 +49,7 @@ bool PURL::FileBase::hasError() const return ( uint(qfile()->status())!=IO_Ok ); } -QString PURL::FileBase::errorString() const +TQString PURL::FileBase::errorString() const { if ( _error.isEmpty() ) { if ( qfile()==0 ) return i18n("File not open."); @@ -58,28 +58,28 @@ QString PURL::FileBase::errorString() const return _error; } -QStringList PURL::FileBase::readLines() +TQStringList PURL::FileBase::readLines() { - QStringList lines; + TQStringList lines; for (;;) { - QString s = stream().readLine(); + TQString s = stream().readLine(); if ( s.isNull() ) break; lines.append(s); } return lines; } -QByteArray PURL::FileBase::readAll() +TQByteArray PURL::FileBase::readAll() { if ( qfile() ) return qfile()->readAll(); - return QByteArray(); + return TQByteArray(); } //----------------------------------------------------------------------------- PURL::File::File(const Url &url, Log::Generic &log) - : FileBase(log, QString::null), _url(url) + : FileBase(log, TQString()), _url(url) { - _file = new QFile; + _file = new TQFile; } void PURL::File::setUrl(const Url &url) diff --git a/src/common/global/pfile.h b/src/common/global/pfile.h index d0955e7..477d7c0 100644 --- a/src/common/global/pfile.h +++ b/src/common/global/pfile.h @@ -9,7 +9,7 @@ #ifndef PFILE_H #define PFILE_H -#include <qtextstream.h> +#include <tqtextstream.h> #include "purl.h" namespace PURL @@ -18,25 +18,25 @@ namespace PURL class FileBase { public: - FileBase(Log::Generic &log, const QString &extension); + FileBase(Log::Generic &log, const TQString &extension); ~FileBase(); - QFile *qfile(); - const QFile *qfile() const; - QTextStream &stream(); - QString readText() { return stream().read(); } - QString readLine() { return stream().readLine(); } - QStringList readLines(); - QByteArray readAll(); - void appendText(const QString &text) { stream() << text; } + TQFile *qfile(); + const TQFile *qfile() const; + TQTextStream &stream(); + TQString readText() { return stream().read(); } + TQString readLine() { return stream().readLine(); } + TQStringList readLines(); + TQByteArray readAll(); + void appendText(const TQString &text) { stream() << text; } void flush(); bool hasError() const; - QString errorString() const; + TQString errorString() const; protected: KTempFile *_tmp; - QFile *_file; - QTextStream *_stream; - QString _error, _extension; + TQFile *_file; + TQTextStream *_stream; + TQString _error, _extension; Log::Generic &_log; private: // disable copy constructor and operator = diff --git a/src/common/global/process.cpp b/src/common/global/process.cpp index 7659eea..1efe715 100644 --- a/src/common/global/process.cpp +++ b/src/common/global/process.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ #include "process.h" -#include <qdatetime.h> +#include <tqdatetime.h> #if defined(NO_KDE) # include "common/nokde/nokde_kprocess.h" @@ -22,8 +22,8 @@ Process::State Process::runSynchronously(Base &process, RunActions actions, uint timeout) { Synchronous sync(timeout); - QObject::connect(&process, SIGNAL(done(int)), &sync, SLOT(done())); - QObject::connect(&process, SIGNAL(requestSynchronousStop()), &sync, SLOT(done())); + TQObject::connect(&process, TQT_SIGNAL(done(int)), &sync, TQT_SLOT(done())); + TQObject::connect(&process, TQT_SIGNAL(requestSynchronousStop()), &sync, TQT_SLOT(done())); if ( (actions & Start) && !process.start(0) ) return process.state(); Q_ASSERT( process.isRunning() ); if ( !sync.enterLoop() ) process.timeoutSlot(); @@ -31,15 +31,15 @@ Process::State Process::runSynchronously(Base &process, RunActions actions, uint } //---------------------------------------------------------------------------- -Process::Base::Base(QObject *parent, const char *name) - : QObject(parent, name), _state(Stopped) +Process::Base::Base(TQObject *tqparent, const char *name) + : TQObject(tqparent, name), _state(Stopped) { _process = new KProcess(this); - connect(_process, SIGNAL(processExited(KProcess *)), SLOT(exited())); - connect(_process, SIGNAL(receivedStdout(KProcess *, char *, int)), SLOT(receivedStdout(KProcess*, char *, int))); - connect(_process, SIGNAL(receivedStderr(KProcess *, char *, int)), SLOT(receivedStderr(KProcess*, char *, int))); - _timer = new QTimer(this); - connect(_timer, SIGNAL(timeout()), SLOT(timeoutSlot())); + connect(_process, TQT_SIGNAL(processExited(KProcess *)), TQT_SLOT(exited())); + connect(_process, TQT_SIGNAL(receivedStdout(KProcess *, char *, int)), TQT_SLOT(receivedStdout(KProcess*, char *, int))); + connect(_process, TQT_SIGNAL(receivedStderr(KProcess *, char *, int)), TQT_SLOT(receivedStderr(KProcess*, char *, int))); + _timer = new TQTimer(this); + connect(_timer, TQT_SIGNAL(timeout()), TQT_SLOT(timeoutSlot())); } Process::Base::~Base() @@ -47,27 +47,27 @@ Process::Base::~Base() _process->kill(); } -QStringList Process::Base::arguments() const +TQStringList Process::Base::arguments() const { - if ( _process==0 ) return QStringList(); + if ( _process==0 ) return TQStringList(); #if defined(NO_KDE) return _process->args(); #else - QStringList list; - const QValueList<QCString> &args = _process->args(); + TQStringList list; + const TQValueList<TQCString> &args = _process->args(); for (uint i=0; i<args.count(); i++) list.append(args[i]); return list; #endif } -void Process::Base::setup(const QString &executable, const QStringList &options, bool withWine) +void Process::Base::setup(const TQString &executable, const TQStringList &options, bool withWine) { _state = Stopped; _timer->stop(); _process->clearArguments(); if (withWine) { _process->setEnvironment("WINEDEBUG", "-all"); - *_process << QString("wine"); + *_process << TQString("wine"); } *_process << executable; *_process << options; @@ -77,8 +77,8 @@ bool Process::Base::start(uint timeout) { _state = Stopped; _timer->stop(); - _stdout = QString::null; - _stderr = QString::null; + _stdout = TQString(); + _stderr = TQString(); #if defined(NO_KDE) if ( !_process->start() ) { #else @@ -116,9 +116,9 @@ bool Process::Base::isRunning() const return _process->isRunning(); } -void Process::Base::writeToStdin(const QString &s) +void Process::Base::writeToStdin(const TQString &s) { - QCString cs = s.latin1(); + TQCString cs = s.latin1(); _process->writeStdin(cs.data(), cs.length()); } @@ -137,7 +137,7 @@ void Process::Base::setUseShell(bool useShell) _process->setUseShell(useShell); } -bool Process::Base::isFilteredLine(const QString &line) +bool Process::Base::isFilteredLine(const TQString &line) { // "wine" returns all those "libGL warning" that mess up the output... return line.startsWith("libGL warning"); @@ -146,13 +146,13 @@ bool Process::Base::isFilteredLine(const QString &line) //---------------------------------------------------------------------------- void Process::StringOutput::receivedStdout(KProcess*, char *data, int len) { - _stdout += QString::fromLatin1(data, len); + _stdout += TQString::tqfromLatin1(data, len); emit stdoutDataReceived(); } void Process::StringOutput::receivedStderr(KProcess*, char *data, int len) { - _stderr += QString::fromLatin1(data, len); + _stderr += TQString::tqfromLatin1(data, len); emit stderrDataReceived(); } @@ -163,8 +163,8 @@ void Process::LineBase::receivedStdout(KProcess*, char *data, int len) if ( data[i]=='\r' ) continue; if ( data[i]=='\n' ) { if ( !isFilteredLine(_stdout) ) addStdoutLine(_stdout); - _stdout = QString::null; - } else _stdout += QString::fromLatin1(data + i, 1); + _stdout = TQString(); + } else _stdout += TQString::tqfromLatin1(data + i, 1); } if ( !_process->isRunning() && !isFilteredLine(_stdout) ) addStdoutLine(_stdout); emit stdoutDataReceived(); @@ -176,8 +176,8 @@ void Process::LineBase::receivedStderr(KProcess*, char *data, int len) if ( data[i]=='\r' ) continue; if ( data[i]=='\n' ) { if ( !isFilteredLine(_stderr) ) addStderrLine(_stderr); - _stderr = QString::null; - } else _stderr += QString::fromLatin1(data + i, 1); + _stderr = TQString(); + } else _stderr += TQString::tqfromLatin1(data + i, 1); } if ( !_process->isRunning() && !isFilteredLine(_stderr) ) addStderrLine(_stderr); emit stderrDataReceived(); diff --git a/src/common/global/process.h b/src/common/global/process.h index 9c67149..d4e7db0 100644 --- a/src/common/global/process.h +++ b/src/common/global/process.h @@ -10,9 +10,9 @@ #define PROCESS_H #include <signal.h> -#include <qstringlist.h> -#include <qobject.h> -#include <qtimer.h> +#include <tqstringlist.h> +#include <tqobject.h> +#include <tqtimer.h> class KProcess; #include "global.h" @@ -23,24 +23,25 @@ namespace Process enum State { Stopped, StartFailed, Running, Exited, Timedout }; class Base; enum RunAction { NoRunAction = 0, Start = 1 }; -Q_DECLARE_FLAGS(RunActions, RunAction) -Q_DECLARE_OPERATORS_FOR_FLAGS(RunActions) +TQ_DECLARE_FLAGS(RunActions, RunAction) +TQ_DECLARE_OPERATORS_FOR_FLAGS(RunActions) extern State runSynchronously(Base &process, RunActions actions, uint timeout); // in ms (0 == no timeout) //---------------------------------------------------------------------------- -class Base : public QObject +class Base : public TQObject { Q_OBJECT + TQ_OBJECT public: - Base(QObject *parent, const char *name); + Base(TQObject *tqparent, const char *name); virtual ~Base(); - void setup(const QString &executable, const QStringList &options, bool withWine); - QStringList arguments() const; + void setup(const TQString &executable, const TQStringList &options, bool withWine); + TQStringList arguments() const; void setWorkingDirectory(const PURL::Directory &dir); void setUseShell(bool useShell); virtual bool start(uint timeout); // in ms (0 == no timeout) - QString prettyCommand() const { return arguments().join(" "); } - void writeToStdin(const QString &s); + TQString prettyCommand() const { return arguments().join(" "); } + void writeToStdin(const TQString &s); bool signal(int n); bool isRunning() const; State state() const { return _state; } @@ -64,20 +65,21 @@ protected slots: protected: State _state; KProcess *_process; - QTimer *_timer; - QString _stdout, _stderr; + TQTimer *_timer; + TQString _stdout, _stderr; - static bool isFilteredLine(const QString &line); + static bool isFilteredLine(const TQString &line); }; //---------------------------------------------------------------------------- class StringOutput : public Base { Q_OBJECT + TQ_OBJECT public: - StringOutput(QObject *parent = 0, const char *name = 0) : Base(parent, name) {} - QString sout() const { return _stdout; } - QString serr() const { return _stderr; } + StringOutput(TQObject *tqparent = 0, const char *name = 0) : Base(tqparent, name) {} + TQString sout() const { return _stdout; } + TQString serr() const { return _stderr; } private slots: virtual void receivedStdout(KProcess *, char *buffer, int len); @@ -88,49 +90,52 @@ private slots: class LineBase : public Base { Q_OBJECT + TQ_OBJECT public: - LineBase(QObject *parent = 0, const char *name = 0) : Base(parent, name) {} + LineBase(TQObject *tqparent = 0, const char *name = 0) : Base(tqparent, name) {} private slots: virtual void receivedStdout(KProcess *, char *buffer, int len); virtual void receivedStderr(KProcess *, char *buffer, int len); private: - virtual void addStdoutLine(const QString &line) = 0; - virtual void addStderrLine(const QString &line) = 0; + virtual void addStdoutLine(const TQString &line) = 0; + virtual void addStderrLine(const TQString &line) = 0; }; //---------------------------------------------------------------------------- class LineOutput : public LineBase { Q_OBJECT + TQ_OBJECT public: - LineOutput(QObject *parent = 0, const char *name = 0) : LineBase(parent, name) {} + LineOutput(TQObject *tqparent = 0, const char *name = 0) : LineBase(tqparent, name) {} virtual bool start(uint timeout); - QStringList sout() const { return _stdoutLines; } - QStringList serr() const { return _stderrLines; } + TQStringList sout() const { return _stdoutLines; } + TQStringList serr() const { return _stderrLines; } protected: - QStringList _stdoutLines, _stderrLines; + TQStringList _stdoutLines, _stderrLines; - virtual void addStdoutLine(const QString &line) { _stdoutLines += line; } - virtual void addStderrLine(const QString &line) { _stderrLines += line; } + virtual void addStdoutLine(const TQString &line) { _stdoutLines += line; } + virtual void addStderrLine(const TQString &line) { _stderrLines += line; } }; //---------------------------------------------------------------------------- class LineSignal : public LineBase { Q_OBJECT + TQ_OBJECT public: - LineSignal(QObject *parent = 0, const char *name = 0) : LineBase(parent, name) {} + LineSignal(TQObject *tqparent = 0, const char *name = 0) : LineBase(tqparent, name) {} signals: - void logStdoutLine(const QString &line); - void logStderrLine(const QString &line); + void logStdoutLine(const TQString &line); + void logStderrLine(const TQString &line); private: - virtual void addStdoutLine(const QString &line) { emit logStdoutLine(line); } - virtual void addStderrLine(const QString &line) { emit logStderrLine(line); } + virtual void addStdoutLine(const TQString &line) { emit logStdoutLine(line); } + virtual void addStderrLine(const TQString &line) { emit logStderrLine(line); } }; } // namespace diff --git a/src/common/global/progress_monitor.cpp b/src/common/global/progress_monitor.cpp index fcd0cec..f86d236 100644 --- a/src/common/global/progress_monitor.cpp +++ b/src/common/global/progress_monitor.cpp @@ -8,8 +8,8 @@ ***************************************************************************/ #include "progress_monitor.h" -ProgressMonitor::ProgressMonitor(QObject* parent) - : QObject(parent, "progress_monitor") +ProgressMonitor::ProgressMonitor(TQObject* tqparent) + : TQObject(tqparent, "progress_monitor") { _current = _tasks.end(); } @@ -21,7 +21,7 @@ void ProgressMonitor::clear() emit showProgress(false); } -void ProgressMonitor::appendTask(const QString &label, uint nbSteps) +void ProgressMonitor::appendTask(const TQString &label, uint nbSteps) { Task task; task.label = label; @@ -30,7 +30,7 @@ void ProgressMonitor::appendTask(const QString &label, uint nbSteps) _tasks.append(task); } -void ProgressMonitor::insertTask(const QString &label, uint nbSteps) +void ProgressMonitor::insertTask(const TQString &label, uint nbSteps) { Task task; task.label = label; @@ -57,7 +57,7 @@ uint ProgressMonitor::nbDoneSteps() const void ProgressMonitor::update() { - QString label = (_current==_tasks.end() ? QString::null : (*_current).label); + TQString label = (_current==_tasks.end() ? TQString() : (*_current).label); emit setLabel(label); emit setTotalProgress(nbSteps()); emit setProgress(nbDoneSteps()); @@ -79,6 +79,6 @@ void ProgressMonitor::addTaskProgress(uint nbSteps) uint nb = (*_current).nbDoneSteps + nbSteps; Q_ASSERT( nb<=(*_current).nbSteps ); if ( nb>(*_current).nbSteps ) qDebug("%s %i+%i > %i", (*_current).label.latin1(), (*_current).nbDoneSteps, nbSteps, (*_current).nbSteps); - (*_current).nbDoneSteps = QMIN(nb, (*_current).nbSteps); + (*_current).nbDoneSteps = TQMIN(nb, (*_current).nbSteps); update(); } diff --git a/src/common/global/progress_monitor.h b/src/common/global/progress_monitor.h index bb905f7..1cff202 100644 --- a/src/common/global/progress_monitor.h +++ b/src/common/global/progress_monitor.h @@ -11,14 +11,15 @@ #include "global.h" -class ProgressMonitor : public QObject +class ProgressMonitor : public TQObject { Q_OBJECT + TQ_OBJECT public: - ProgressMonitor(QObject *parent = 0); + ProgressMonitor(TQObject *tqparent = 0); void clear(); - void appendTask(const QString &label, uint nbSteps); - void insertTask(const QString &label, uint nbSteps); + void appendTask(const TQString &label, uint nbSteps); + void insertTask(const TQString &label, uint nbSteps); void startNextTask(); void addTaskProgress(uint nbSteps); uint nbSteps() const; @@ -29,18 +30,18 @@ public slots: signals: void showProgress(bool show); - void setLabel(const QString &label); + void setLabel(const TQString &label); void setTotalProgress(uint nbSteps); void setProgress(uint nbSteps); private: class Task { public: - QString label; + TQString label; uint nbSteps, nbDoneSteps; }; - QValueList<Task> _tasks; - QValueList<Task>::iterator _current; + TQValueList<Task> _tasks; + TQValueList<Task>::iterator _current; }; #endif diff --git a/src/common/global/purl.cpp b/src/common/global/purl.cpp index 6db2914..aeae543 100644 --- a/src/common/global/purl.cpp +++ b/src/common/global/purl.cpp @@ -8,14 +8,12 @@ ***************************************************************************/ #include "purl.h" -#include <qfileinfo.h> -#include <qdatetime.h> -#include <qdir.h> -#include <qregexp.h> -#include <qmap.h> -#if QT_VERSION<0x040000 -# include <qnetwork.h> -#endif +#include <tqfileinfo.h> +#include <tqdatetime.h> +#include <tqdir.h> +#include <tqregexp.h> +#include <tqmap.h> +# include <tqnetwork.h> #include "common/common/synchronous.h" #include "process.h" @@ -27,38 +25,38 @@ #endif //----------------------------------------------------------------------------- -PURL::Http::Http(const QString &hostname) - : QHttp(hostname) +PURL::Http::Http(const TQString &hostname) + : TQHttp(hostname) { - connect(this, SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)), - SLOT(responseHeaderReceivedSlot(const QHttpResponseHeader &))); + connect(this, TQT_SIGNAL(responseHeaderReceived(const TQHttpResponseHeader &)), + TQT_SLOT(responseHeaderReceivedSlot(const TQHttpResponseHeader &))); } //----------------------------------------------------------------------------- class PURL::Private { public: - QString convertWindowsFilepath(const QString &filepath); + TQString convertWindowsFilepath(const TQString &filepath); private: - QMap<char, QString> _winDrives; // drive -> unix path - QMap<QString, QString> _winPaths; // windows path -> unix path - - QString getWindowsDrivePath(char drive); - bool checkCachedPath(QString &filepath) const; - QString cachePath(const QString &origin, const QString &filepath); - QString convertWindowsShortFilepath(const QString &filepath); - QString findName(const QString &path, const QString &name); - static QString findName(const QString &filepath); + TQMap<char, TQString> _winDrives; // drive -> unix path + TQMap<TQString, TQString> _winPaths; // windows path -> unix path + + TQString getWindowsDrivePath(char drive); + bool checkCachedPath(TQString &filepath) const; + TQString cachePath(const TQString &origin, const TQString &filepath); + TQString convertWindowsShortFilepath(const TQString &filepath); + TQString findName(const TQString &path, const TQString &name); + static TQString findName(const TQString &filepath); }; -QString PURL::Private::getWindowsDrivePath(char drive) +TQString PURL::Private::getWindowsDrivePath(char drive) { #if defined(Q_OS_UNIX) - if ( !_winDrives.contains(drive) ) { - QStringList args; + if ( !_winDrives.tqcontains(drive) ) { + TQStringList args; args += "-u"; - QString s; + TQString s; s += drive; args += s + ":\\"; ::Process::StringOutput process; @@ -66,71 +64,67 @@ QString PURL::Private::getWindowsDrivePath(char drive) ::Process::State state = ::Process::runSynchronously(process, ::Process::Start, 3000); if ( state!=::Process::Exited ) qWarning("Error running \"winepath\" with \"%s\" (%i)", args.join(" ").latin1(), state); s = process.sout() + process.serr(); - QDir dir(s.stripWhiteSpace()); + TQDir dir(s.stripWhiteSpace()); _winDrives[drive] = dir.canonicalPath(); } return _winDrives[drive]; #else - return QString("%1:\\").arg(drive); + return TQString("%1:\\").tqarg(drive); #endif } -bool PURL::Private::checkCachedPath(QString &filepath) const +bool PURL::Private::checkCachedPath(TQString &filepath) const { - if ( !_winPaths.contains(filepath) ) return false; + if ( !_winPaths.tqcontains(filepath) ) return false; filepath = _winPaths[filepath]; return true; } -QString PURL::Private::cachePath(const QString &origin, const QString &filepath) +TQString PURL::Private::cachePath(const TQString &origin, const TQString &filepath) { _winPaths[origin] = filepath; return filepath; } -QString PURL::Private::convertWindowsFilepath(const QString &filepath) +TQString PURL::Private::convertWindowsFilepath(const TQString &filepath) { // appears to be an absolute windows path if ( filepath[0]=='\\' ) { - QString tmp = filepath; + TQString tmp = filepath; if ( checkCachedPath(tmp) ) return tmp; - return cachePath(filepath, convertWindowsShortFilepath(tmp.replace('\\', "/"))); + return cachePath(filepath, convertWindowsShortFilepath(tmp.tqreplace('\\', "/"))); } // appears to be a windows path with a drive if ( (filepath.length()>=2 && filepath[0].isLetter() && filepath[1]==':') ) { - QString tmp = filepath; + TQString tmp = filepath; if ( checkCachedPath(tmp) ) return tmp; -#if QT_VERSION<0x040000 - tmp = getWindowsDrivePath(filepath[0]) + tmp.mid(2).replace('\\', "/"); -#else - tmp = getWindowsDrivePath(filepath[0].toLatin1()) + tmp.mid(2).replace('\\', "/"); -#endif + tmp = getWindowsDrivePath(filepath[0]) + tmp.mid(2).tqreplace('\\', "/"); return cachePath(filepath, convertWindowsShortFilepath(tmp)); } return filepath; } -QString PURL::Private::findName(const QString &path, const QString &name) +TQString PURL::Private::findName(const TQString &path, const TQString &name) { - QString filepath = path + '/' + name; + TQString filepath = path + '/' + name; if ( checkCachedPath(filepath) ) return filepath; return cachePath(filepath, findName(filepath)); } -QString PURL::Private::findName(const QString &filepath) +TQString PURL::Private::findName(const TQString &filepath) { - QFileInfo finfo(filepath); + TQFileInfo finfo(filepath); if ( finfo.exists() || !finfo.dir().exists() ) return finfo.filePath(); - QStringList list = finfo.dir().entryList(QDir::All, QDir::Name); + TQStringList list = finfo.dir().entryList(TQDir::All, TQDir::Name); // find if name is just in a different case for (uint j=0; j<uint(list.count()); j++) { if ( list[j].lower()!=finfo.fileName().lower() ) continue; return finfo.dirPath() + '/' + list[j]; } // find if name is a shorted filename - QRegExp rexp("([^~]+)~(\\d+).*"); + TQRegExp rexp("([^~]+)~(\\d+).*"); if ( !rexp.exactMatch(finfo.fileName()) ) return finfo.filePath(); - QString start = rexp.cap(1).lower(); + TQString start = rexp.cap(1).lower(); uint index = rexp.cap(2).toUInt(); uint k = 0; for (uint j = 0; j<uint(list.count()); j++) { @@ -141,18 +135,18 @@ QString PURL::Private::findName(const QString &filepath) return finfo.filePath(); } -QString PURL::Private::convertWindowsShortFilepath(const QString &filepath) +TQString PURL::Private::convertWindowsShortFilepath(const TQString &filepath) { - // apparently "winepath" cannot do that for us and it is a real pain too... + // aptqparently "winepath" cannot do that for us and it is a real pain too... // we assume filepath is an absolute unix path // first see if we know the dirpath - QFileInfo finfo(filepath); - QString path = finfo.dirPath(); + TQFileInfo finfo(filepath); + TQString path = finfo.dirPath(); if ( checkCachedPath(path) ) return findName(path, finfo.fileName()); // otherwise go down the path - QStringList names = QStringList::split('/', filepath); - QString tmp; + TQStringList names = TQStringList::split('/', filepath); + TQString tmp; for (uint i=0; i<uint(names.count()); i++) tmp = findName(tmp, names[i]); if ( filepath.endsWith("/") ) tmp += "/"; @@ -162,17 +156,17 @@ QString PURL::Private::convertWindowsShortFilepath(const QString &filepath) //----------------------------------------------------------------------------- PURL::Private *PURL::Base::_private = 0; -PURL::Base::Base(const QString &filepath) +PURL::Base::Base(const TQString &filepath) : _relative(true) { if ( !filepath.isEmpty() ) { if ( _private==0 ) _private = new Private; #if defined(Q_OS_UNIX) - QString tmp = _private->convertWindowsFilepath(filepath); + TQString tmp = _private->convertWindowsFilepath(filepath); #else - QString tmp = filepath; + TQString tmp = filepath; #endif - if ( tmp.startsWith("~") ) tmp = QDir::homeDirPath() + tmp.mid(1); + if ( tmp.startsWith("~") ) tmp = TQDir::homeDirPath() + tmp.mid(1); _relative = Q3Url::isRelativeUrl(tmp); #if defined(Q_OS_UNIX) if ( !tmp.startsWith("/") ) tmp = '/' + tmp; @@ -203,13 +197,13 @@ bool PURL::Base::operator ==(const Base &url) const return _url==url._url; } -QString PURL::Base::path(SeparatorType type) const +TQString PURL::Base::path(SeparatorType type) const { #if defined(NO_KDE) - QString s = _url.dirPath(); + TQString s = _url.dirPath(); if ( !s.isEmpty() && !s.endsWith("/") ) s += '/'; #else - QString s = _url.directory(false, false); + TQString s = _url.directory(false, false); #endif if ( type==WindowsSeparator ) { for (uint i=0; i<uint(s.length()); i++) @@ -218,13 +212,13 @@ QString PURL::Base::path(SeparatorType type) const return s; } -QString PURL::Base::unterminatedPath(SeparatorType type) const +TQString PURL::Base::unterminatedPath(SeparatorType type) const { #if defined(NO_KDE) - QString s = _url.dirPath(); + TQString s = _url.dirPath(); if ( s.endsWith("/") ) s = s.mid(0, s.length()-1); #else - QString s = _url.directory(true, false); + TQString s = _url.directory(true, false); #endif if ( type==WindowsSeparator ) { for (uint i=0; i<uint(s.length()); i++) @@ -233,10 +227,10 @@ QString PURL::Base::unterminatedPath(SeparatorType type) const return s; } -QString PURL::Base::pretty() const +TQString PURL::Base::pretty() const { #if defined(NO_KDE) - QString s = _url.toString(); + TQString s = _url.toString(); if ( s.startsWith("://") ) return s.mid(3); return s; #else @@ -256,26 +250,24 @@ bool PURL::Base::isInto(const Directory &dir) const bool PURL::Base::httpUrlExists(bool *ok) const { -#if QT_VERSION<0x040000 qInitNetworkProtocols(); -#endif if (ok) *ok = false; Http http(_url.host()); Synchronous sync(500); - QObject::connect(&http, SIGNAL(done(bool)), &sync, SLOT(done())); - QFileInfo info(_url.fileName(false)); + TQObject::connect(&http, TQT_SIGNAL(done(bool)), &sync, TQT_SLOT(done())); + TQFileInfo info(_url.fileName(false)); http.head(_url.path()); if ( !sync.enterLoop() ) return false; // timeout - if ( http.error()!=QHttp::NoError ) return false; + if ( http.error()!=TQHttp::NoError ) return false; if (ok ) *ok = true; return ( http._header.statusCode()==200 ); } -bool PURL::Base::exists(QDateTime *lastModified) const +bool PURL::Base::exists(TQDateTime *lastModified) const { if ( isEmpty() ) return false; if ( isLocal() ) { - QFileInfo fi(_url.path()); + TQFileInfo fi(_url.path()); if (lastModified) *lastModified = fi.lastModified(); return fi.exists(); } @@ -283,13 +275,13 @@ bool PURL::Base::exists(QDateTime *lastModified) const #if !defined(NO_KDE) if (lastModified) { KIO::UDSEntry uds; - if ( !KIO::NetAccess::stat(_url, uds, qApp->mainWidget()) ) return false; + if ( !KIO::NetAccess::stat(_url, uds, tqApp->mainWidget()) ) return false; KFileItem item(uds, _url); lastModified->setTime_t(item.time(KIO::UDS_MODIFICATION_TIME)); return true; } else { // assume file exists if ioslave cannot tell... - return KIO::NetAccess::exists(_url, true, qApp->mainWidget()); + return KIO::NetAccess::exists(_url, true, tqApp->mainWidget()); } #else if (lastModified) lastModified->setTime_t(0); @@ -299,62 +291,62 @@ bool PURL::Base::exists(QDateTime *lastModified) const } //---------------------------------------------------------------------------- -PURL::Url PURL::Url::fromPathOrUrl(const QString &s) +PURL::Url PURL::Url::fromPathOrUrl(const TQString &s) { KURL kurl = KURL::fromPathOrURL(s); if ( !kurl.protocol().isEmpty() && kurl.protocol()!="file" && kurl.protocol().length()!=1 ) return kurl; return Url(s.startsWith("file://") ? s.mid(7) : s); } -PURL::Url::Url(const Directory &dir, const QString &filename, FileType type) +PURL::Url::Url(const Directory &dir, const TQString &filename, FileType type) : Base(dir.path() + '/' + addExtension(filename, type)) {} -PURL::Url::Url(const Directory &dir, const QString &filepath) +PURL::Url::Url(const Directory &dir, const TQString &filepath) : Base(dir.path() + '/' + filepath) {} PURL::FileType PURL::Url::fileType() const { - QFileInfo info(filename()); + TQFileInfo info(filename()); FOR_EACH(FileType, type) for (uint i=0; type.data().extensions[i]; i++) if ( info.extension(false).lower()==type.data().extensions[i] ) return type; return Unknown; } -QString PURL::Url::basename() const +TQString PURL::Url::basename() const { - QFileInfo info(_url.fileName(false)); + TQFileInfo info(_url.fileName(false)); return info.baseName(true); } -QString PURL::Url::filename() const +TQString PURL::Url::filename() const { - QFileInfo info(_url.fileName(false)); + TQFileInfo info(_url.fileName(false)); return info.fileName(); } -QString PURL::Url::filepath(SeparatorType type) const +TQString PURL::Url::filepath(SeparatorType type) const { return path(type) + filename(); } -PURL::Url PURL::Url::toExtension(const QString &extension) const +PURL::Url PURL::Url::toExtension(const TQString &extension) const { - QFileInfo info(filename()); + TQFileInfo info(filename()); return Url(directory().path() + info.baseName(true) + '.' + extension); } -PURL::Url PURL::Url::appendExtension(const QString &extension) const +PURL::Url PURL::Url::appendExtension(const TQString &extension) const { - QFileInfo info(filename()); + TQFileInfo info(filename()); return Url(directory().path() + info.fileName() + '.' + extension); } -QString PURL::Url::relativeTo(const Directory &dir, SeparatorType type) const +TQString PURL::Url::relativeTo(const Directory &dir, SeparatorType type) const { - QString s = filepath(type); + TQString s = filepath(type); if ( !isInto(dir) ) return s; return s.right(s.length() - dir.path(type).length()); } @@ -368,7 +360,7 @@ PURL::Url PURL::Url::toAbsolute(const Directory &dir) const bool PURL::findExistingUrl(Url &url) { if ( url.exists() ) return true; - QFileInfo info(url.filename()); + TQFileInfo info(url.filename()); Url tmp = url.toExtension(info.extension(false).upper()); if ( !tmp.exists() ) { tmp = url.toExtension(info.extension(false).lower()); @@ -388,35 +380,35 @@ PURL::UrlList::UrlList(const KURL::List &list) #endif //----------------------------------------------------------------------------- -PURL::Directory::Directory(const QString &path) - : Base(path.isEmpty() ? QString::null : path + '/') +PURL::Directory::Directory(const TQString &path) + : Base(path.isEmpty() ? TQString() : path + '/') {} PURL::Directory PURL::Directory::up() const { - QDir dir(path()); + TQDir dir(path()); dir.cdUp(); return PURL::Directory(dir.path()); } -PURL::Directory PURL::Directory::down(const QString &subPath) const +PURL::Directory PURL::Directory::down(const TQString &subPath) const { - Q_ASSERT( QDir::isRelativePath(subPath) ); - QDir dir(path()); + Q_ASSERT( TQDir::isRelativePath(subPath) ); + TQDir dir(path()); dir.cd(subPath); return PURL::Directory(dir.path()); } -QStringList PURL::Directory::files(const QString &filter) const +TQStringList PURL::Directory::files(const TQString &filter) const { - QDir dir(path()); - return dir.entryList(filter, QDir::Files); + TQDir dir(path()); + return dir.entryList(filter, TQDir::Files); } -PURL::Url PURL::Directory::findMatchingFilename(const QString &filename) const +PURL::Url PURL::Directory::findMatchingFilename(const TQString &filename) const { - QDir dir(path()); - QStringList files = dir.entryList(QDir::Files); + TQDir dir(path()); + TQStringList files = dir.entryList(TQDir::Files); for (uint i=0; i<uint(files.count()); i++) if ( files[i].lower()==filename.lower() ) return Url(*this, files[i]); return Url(*this, filename); @@ -424,5 +416,5 @@ PURL::Url PURL::Directory::findMatchingFilename(const QString &filename) const PURL::Directory PURL::Directory::current() { - return QDir::currentDirPath(); + return TQDir::currentDirPath(); } diff --git a/src/common/global/purl.h b/src/common/global/purl.h index 6cbf38b..a0ee295 100644 --- a/src/common/global/purl.h +++ b/src/common/global/purl.h @@ -10,27 +10,23 @@ #define PURL_H #include "common/global/global.h" -#if QT_VERSION<0x040000 -# include <qhttp.h> -#else -# include <QtNetwork/QHttp> -# include <QDateTime> -#endif +# include <tqhttp.h> #include "common/global/log.h" #include "common/common/purl_base.h" namespace PURL { //---------------------------------------------------------------------------- -class Http : public QHttp +class Http : public TQHttp { Q_OBJECT + TQ_OBJECT public: - Http(const QString &hostname); - QHttpResponseHeader _header; + Http(const TQString &hostname); + TQHttpResponseHeader _header; private slots: - void responseHeaderReceivedSlot(const QHttpResponseHeader &rh) { _header = rh; } + void responseHeaderReceivedSlot(const TQHttpResponseHeader &rh) { _header = rh; } }; class Url; @@ -43,21 +39,21 @@ enum SeparatorType { UnixSeparator, WindowsSeparator }; class Base { public: - Base(const QString &filepath = QString::null); + Base(const TQString &filepath = TQString()); Base(const KURL &url); bool operator <(const Base &url) const { return _url<url._url; } bool operator ==(const Base &url) const; bool operator !=(const Base &url) const { return !(_url==url._url); } const KURL &kurl() const { return _url; } - QString pretty() const; + TQString pretty() const; bool isEmpty() const { return _url.isEmpty(); } bool isLocal() const; - QString path(SeparatorType type = UnixSeparator) const; // with ending '/' unless empty path - QString unterminatedPath(SeparatorType type = UnixSeparator) const; // no ending '/' + TQString path(SeparatorType type = UnixSeparator) const; // with ending '/' unless empty path + TQString unterminatedPath(SeparatorType type = UnixSeparator) const; // no ending '/' Directory directory() const; bool isInto(const Directory &dir) const; bool isRelative() const { return _relative; } - bool exists(QDateTime *lastModified = 0) const; + bool exists(TQDateTime *lastModified = 0) const; protected: bool _relative; @@ -75,42 +71,42 @@ public: Url() {} Url(const KURL &url) : Base(url) {} // add correct extension if filename has no extension - Url(const Directory &path, const QString &filename, FileType type); - Url(const Directory &path, const QString &filepath); - static Url fromPathOrUrl(const QString &s); + Url(const Directory &path, const TQString &filename, FileType type); + Url(const Directory &path, const TQString &filepath); + static Url fromPathOrUrl(const TQString &s); Url toFileType(FileType type) const { return toExtension(type.data().extensions[0]); } - Url toExtension(const QString &extension) const; - Url appendExtension(const QString &extension) const; + Url toExtension(const TQString &extension) const; + Url appendExtension(const TQString &extension) const; const FileType::Data &data() const { return fileType().data(); } FileType fileType() const; - QString basename() const; // filename without extension - QString filename() const; // filename without path - QString filepath(SeparatorType type = UnixSeparator) const; // filename with path - QString relativeTo(const Directory &dir, SeparatorType type = UnixSeparator) const; + TQString basename() const; // filename without extension + TQString filename() const; // filename without path + TQString filepath(SeparatorType type = UnixSeparator) const; // filename with path + TQString relativeTo(const Directory &dir, SeparatorType type = UnixSeparator) const; Url toAbsolute(const Directory &dir) const; #if !defined(NO_KDE) bool isDosFile() const; bool create(Log::Generic &log) const; // do not overwrite - bool write(const QString &text, Log::Generic &log) const; + bool write(const TQString &text, Log::Generic &log) const; bool copyTo(const Url &destination, Log::Generic &log) const; // do not overwrite bool del(Log::Generic &log) const; #endif private: - Url(const QString &filepath) : Base(filepath) {} + Url(const TQString &filepath) : Base(filepath) {} }; extern bool findExistingUrl(Url &url); // may transform extension's case if needed //---------------------------------------------------------------------------- -class UrlList : public QValueList<Url> +class UrlList : public TQValueList<Url> { public: UrlList() {} UrlList(const Url &url) { append(url); } - UrlList(const QValueList<Url> &list) : QValueList<Url>(list) {} + UrlList(const TQValueList<Url> &list) : TQValueList<Url>(list) {} #if !defined(NO_KDE) UrlList(const KURL::List &list); #endif @@ -120,11 +116,11 @@ public: class Directory : public Base { public: - Directory(const QString &path = QString::null); - QStringList files(const QString &filter) const; - Url findMatchingFilename(const QString &filename) const; + Directory(const TQString &path = TQString()); + TQStringList files(const TQString &filter) const; + Url findMatchingFilename(const TQString &filename) const; Directory up() const; - Directory down(const QString &path) const; + Directory down(const TQString &path) const; static Directory current(); #if !defined(NO_KDE) bool create(Log::Generic &log) const; diff --git a/src/common/global/xml_data_file.cpp b/src/common/global/xml_data_file.cpp index 2464b34..30d42cd 100644 --- a/src/common/global/xml_data_file.cpp +++ b/src/common/global/xml_data_file.cpp @@ -8,25 +8,25 @@ ***************************************************************************/ #include "xml_data_file.h" -#include <qfile.h> -#include <qstringlist.h> +#include <tqfile.h> +#include <tqstringlist.h> #include <ksimpleconfig.h> #include <klocale.h> #include "common/global/pfile.h" -XmlDataFile::XmlDataFile(const PURL::Url &url, const QString &name) +XmlDataFile::XmlDataFile(const PURL::Url &url, const TQString &name) : _url(url), _name(name), _document(name) { - QDomElement root = _document.createElement(name); + TQDomElement root = _document.createElement(name); _document.appendChild(root); } -bool XmlDataFile::load(QString &error) +bool XmlDataFile::load(TQString &error) { Log::StringView sview; PURL::File file(_url, sview); if ( !file.openForRead() ) { - error = i18n("Error opening file: %1").arg(sview.string()); + error = i18n("Error opening file: %1").tqarg(sview.string()); return false; } if ( !_document.setContent(file.qfile(), false, &error) ) return false; @@ -38,122 +38,122 @@ bool XmlDataFile::load(QString &error) return true; } -bool XmlDataFile::save(QString &error) const +bool XmlDataFile::save(TQString &error) const { Log::StringView sview; PURL::File file(_url, sview); bool ok = file.openForWrite(); if (ok) { - QString s = _document.toString(2); + TQString s = _document.toString(2); file.appendText(s); ok = file.close(); } - if ( !ok ) error = i18n("Error saving file: %1").arg(sview.string()); + if ( !ok ) error = i18n("Error saving file: %1").tqarg(sview.string()); return ok; } -QDomElement XmlDataFile::findChildElement(QDomElement parent, const QString &name) const +TQDomElement XmlDataFile::findChildElement(TQDomElement tqparent, const TQString &name) const { - QDomNodeList list = parent.elementsByTagName(name); + TQDomNodeList list = tqparent.elementsByTagName(name); return list.item(0).toElement(); } -QDomElement XmlDataFile::createChildElement(QDomElement parent, const QString &name) +TQDomElement XmlDataFile::createChildElement(TQDomElement tqparent, const TQString &name) { - QDomNodeList list = parent.elementsByTagName(name); + TQDomNodeList list = tqparent.elementsByTagName(name); if ( list.count()==0 ) { - QDomElement element = _document.createElement(name); - parent.appendChild(element); + TQDomElement element = _document.createElement(name); + tqparent.appendChild(element); return element; } return list.item(0).toElement(); } -void XmlDataFile::removeChilds(QDomNode parent) const +void XmlDataFile::removeChilds(TQDomNode tqparent) const { - QDomNodeList list = parent.childNodes(); + TQDomNodeList list = tqparent.childNodes(); for (uint i=0; i<list.count(); i++) - parent.removeChild(list.item(i)); + tqparent.removeChild(list.item(i)); } -QString XmlDataFile::value(const QString &group, const QString &key, const QString &defValue) const +TQString XmlDataFile::value(const TQString &group, const TQString &key, const TQString &defValue) const { - QDomElement root = _document.documentElement(); - QDomElement groupElement = findChildElement(root, group); + TQDomElement root = _document.documentElement(); + TQDomElement groupElement = findChildElement(root, group); if ( groupElement.isNull() ) return defValue; - QDomElement element = findChildElement(groupElement, key); + TQDomElement element = findChildElement(groupElement, key); if ( element.isNull() ) return defValue; - QDomText text = element.firstChild().toText(); + TQDomText text = element.firstChild().toText(); if ( text.isNull() ) return defValue; return text.data(); } -void XmlDataFile::setValue(const QString &group, const QString &key, const QString &value) +void XmlDataFile::setValue(const TQString &group, const TQString &key, const TQString &value) { - QDomElement root = _document.documentElement(); - QDomElement groupElement = createChildElement(root, group); - QDomElement element = createChildElement(groupElement, key); + TQDomElement root = _document.documentElement(); + TQDomElement groupElement = createChildElement(root, group); + TQDomElement element = createChildElement(groupElement, key); removeChilds(element); - QDomText text = _document.createTextNode(value); + TQDomText text = _document.createTextNode(value); element.appendChild(text); } -QStringList XmlDataFile::listValues(const QString &group, const QString &key, const QStringList &defaultValues) const +TQStringList XmlDataFile::listValues(const TQString &group, const TQString &key, const TQStringList &defaultValues) const { - QStringList list; - QDomElement root = _document.documentElement(); - QDomElement groupElement = findChildElement(root, group); + TQStringList list; + TQDomElement root = _document.documentElement(); + TQDomElement groupElement = findChildElement(root, group); if ( groupElement.isNull() ) return defaultValues; - QDomElement element = findChildElement(groupElement, key); + TQDomElement element = findChildElement(groupElement, key); if ( element.isNull() ) return defaultValues; - QDomNodeList childs = element.childNodes(); + TQDomNodeList childs = element.childNodes(); if ( childs.count()==1 ) { // legacy compatibility - QDomText text = element.firstChild().toText(); + TQDomText text = element.firstChild().toText(); if ( !text.isNull() ) return text.data(); } for (uint i=0; i<childs.count(); i++) { - QDomText text = childs.item(i).toElement().firstChild().toText(); + TQDomText text = childs.item(i).toElement().firstChild().toText(); if ( text.isNull() ) continue; list.append(text.data()); } return list; } -void XmlDataFile::appendListValue(const QString &group, const QString &key, const QString &value) +void XmlDataFile::appendListValue(const TQString &group, const TQString &key, const TQString &value) { - QDomElement root = _document.documentElement(); - QDomElement groupElement = createChildElement(root, group); - QDomElement element = createChildElement(groupElement, key); - QDomElement item = _document.createElement("item"); + TQDomElement root = _document.documentElement(); + TQDomElement groupElement = createChildElement(root, group); + TQDomElement element = createChildElement(groupElement, key); + TQDomElement item = _document.createElement("item"); element.appendChild(item); - QDomText text = _document.createTextNode(value); + TQDomText text = _document.createTextNode(value); item.appendChild(text); } -void XmlDataFile::removeListValue(const QString &group, const QString &key, const QString &value) +void XmlDataFile::removeListValue(const TQString &group, const TQString &key, const TQString &value) { - QDomElement root = _document.documentElement(); - QDomElement groupElement = createChildElement(root, group); - QDomElement element = createChildElement(groupElement, key); - QDomNodeList list = element.childNodes(); + TQDomElement root = _document.documentElement(); + TQDomElement groupElement = createChildElement(root, group); + TQDomElement element = createChildElement(groupElement, key); + TQDomNodeList list = element.childNodes(); for (uint i=0; i<list.count(); i++) { - QDomElement item = list.item(i).toElement(); - QDomText text = item.firstChild().toText(); + TQDomElement item = list.item(i).toElement(); + TQDomText text = item.firstChild().toText(); if ( text.isNull() || text.data()!=value ) continue; element.removeChild(item); break; } } -void XmlDataFile::clearList(const QString &group, const QString &key) +void XmlDataFile::clearList(const TQString &group, const TQString &key) { - QDomElement root = _document.documentElement(); - QDomElement groupElement = createChildElement(root, group); - QDomElement element = createChildElement(groupElement, key); + TQDomElement root = _document.documentElement(); + TQDomElement groupElement = createChildElement(root, group); + TQDomElement element = createChildElement(groupElement, key); groupElement.removeChild(element); } -void XmlDataFile::setListValues(const QString &group, const QString &key, const QStringList &values) +void XmlDataFile::setListValues(const TQString &group, const TQString &key, const TQStringList &values) { clearList(group, key); for (uint i=0; i<values.count(); i++) appendListValue(group, key, values[i]); diff --git a/src/common/global/xml_data_file.h b/src/common/global/xml_data_file.h index dfcbc73..bae5d1f 100644 --- a/src/common/global/xml_data_file.h +++ b/src/common/global/xml_data_file.h @@ -9,37 +9,37 @@ #ifndef XML_DATA_FILE_H #define XML_DATA_FILE_H -#include <qdom.h> +#include <tqdom.h> #include "common/global/purl.h" class XmlDataFile { public: - XmlDataFile(const PURL::Url &url, const QString &name); + XmlDataFile(const PURL::Url &url, const TQString &name); virtual ~XmlDataFile() {} PURL::Url url() const { return _url; } - virtual bool load(QString &error); - bool save(QString &error) const; + virtual bool load(TQString &error); + bool save(TQString &error) const; - QString value(const QString &group, const QString &key, const QString &defaultValue) const; - void setValue(const QString &group, const QString &key, const QString &value); - QStringList listValues(const QString &group, const QString &key, const QStringList &defaultValues) const; - void setListValues(const QString &group, const QString &key, const QStringList &values); - void appendListValue(const QString &group, const QString &key, const QString &value); - void removeListValue(const QString &group, const QString &key, const QString &value); - void clearList(const QString &group, const QString &key); + TQString value(const TQString &group, const TQString &key, const TQString &defaultValue) const; + void setValue(const TQString &group, const TQString &key, const TQString &value); + TQStringList listValues(const TQString &group, const TQString &key, const TQStringList &defaultValues) const; + void setListValues(const TQString &group, const TQString &key, const TQStringList &values); + void appendListValue(const TQString &group, const TQString &key, const TQString &value); + void removeListValue(const TQString &group, const TQString &key, const TQString &value); + void clearList(const TQString &group, const TQString &key); protected: PURL::Url _url; private: - QString _name; - QDomDocument _document; + TQString _name; + TQDomDocument _document; - QDomElement findChildElement(QDomElement element, const QString &tag) const; - QDomElement createChildElement(QDomElement element, const QString &tag); - void removeChilds(QDomNode node) const; + TQDomElement findChildElement(TQDomElement element, const TQString &tag) const; + TQDomElement createChildElement(TQDomElement element, const TQString &tag); + void removeChilds(TQDomNode node) const; }; #endif diff --git a/src/common/gui/config_widget.h b/src/common/gui/config_widget.h index abfafab..787780b 100644 --- a/src/common/gui/config_widget.h +++ b/src/common/gui/config_widget.h @@ -10,10 +10,10 @@ #ifndef CONFIG_WIDGET_H #define CONFIG_WIDGET_H -#include <qpixmap.h> -#include <qcheckbox.h> -#include <qvaluevector.h> -#include <qvariant.h> +#include <tqpixmap.h> +#include <tqcheckbox.h> +#include <tqvaluevector.h> +#include <tqvariant.h> #include "container.h" @@ -21,11 +21,12 @@ class ConfigWidget : public Container { Q_OBJECT + TQ_OBJECT public: - ConfigWidget(QWidget *parent = 0) : Container(parent) {} - virtual QString title() const { return QString::null; } - virtual QString header() const { return QString::null; } - virtual QPixmap pixmap() const { return QPixmap(); } + ConfigWidget(TQWidget *tqparent = 0) : Container(tqparent) {} + virtual TQString title() const { return TQString(); } + virtual TQString header() const { return TQString(); } + virtual TQPixmap pixmap() const { return TQPixmap(); } public slots: virtual void loadConfig() = 0; @@ -52,40 +53,40 @@ public: } private: - QValueVector<QWidget *> _widgets; + TQValueVector<TQWidget *> _widgets; - static QWidget *createWidget(Type type, ConfigWidget *widget) { - QWidget *w = 0; + static TQWidget *createWidget(Type type, ConfigWidget *widget) { + TQWidget *w = 0; uint row = widget->numRows(); switch (type.data().defValue.type()) { - case QVariant::Bool: - w = new QCheckBox(type.label(), widget); + case TQVariant::Bool: + w = new TQCheckBox(type.label(), widget); widget->addWidget(w, row,row, 0,1); break; default: Q_ASSERT(false); break; } return w; } - void load(Type type, QWidget *widget) const { + void load(Type type, TQWidget *widget) const { switch (type.data().defValue.type()) { - case QVariant::Bool: - static_cast<QCheckBox *>(widget)->setChecked(readConfigEntry(type).toBool()); + case TQVariant::Bool: + static_cast<TQCheckBox *>(widget)->setChecked(readConfigEntry(type).toBool()); break; default: Q_ASSERT(false); break; } } - void save(Type type, QWidget *widget) { + void save(Type type, TQWidget *widget) { switch (type.data().defValue.type()) { - case QVariant::Bool: - writeConfigEntry(type, QVariant(static_cast<QCheckBox *>(widget)->isChecked(), 0)); + case TQVariant::Bool: + writeConfigEntry(type, TQVariant(static_cast<TQCheckBox *>(widget)->isChecked(), 0)); break; default: Q_ASSERT(false); break; } } - void setDefault(Type type, QWidget *widget) const { + void setDefault(Type type, TQWidget *widget) const { switch (type.data().defValue.type()) { - case QVariant::Bool: - static_cast<QCheckBox *>(widget)->setChecked(type.data().defValue.toBool()); + case TQVariant::Bool: + static_cast<TQCheckBox *>(widget)->setChecked(type.data().defValue.toBool()); break; default: Q_ASSERT(false); break; } diff --git a/src/common/gui/container.cpp b/src/common/gui/container.cpp index 881e265..960acca 100644 --- a/src/common/gui/container.cpp +++ b/src/common/gui/container.cpp @@ -11,21 +11,21 @@ #include "misc_gui.h" //---------------------------------------------------------------------------- -Container::Container(QWidget *parent, Type type) - : QFrame(parent), _type(type) +Container::Container(TQWidget *tqparent, Type type) + : TQFrame(tqparent), _type(type) { initLayout(); } -Container::Container(QWidgetStack *stack, uint index, Type type) - : QFrame(stack), _type(type) +Container::Container(TQWidgetStack *stack, uint index, Type type) + : TQFrame(stack), _type(type) { initLayout(); stack->addWidget(this, index); } -Container::Container(QTabWidget *tabw, const QString &title, Type type) - : QFrame(tabw), _type(type) +Container::Container(TQTabWidget *tabw, const TQString &title, Type type) + : TQFrame(tabw), _type(type) { initLayout(); tabw->addTab(this, title); @@ -36,43 +36,43 @@ void Container::setFrame(Type type) _type = type; switch (type) { case Flat: - setMargin(parent() && parent()->inherits("QTabWidget") ? 10 : 0); - setFrameStyle(QFrame::NoFrame); + setMargin(tqparent() && tqparent()->inherits(TQTABWIDGET_OBJECT_NAME_STRING) ? 10 : 0); + setFrameStyle(TQFrame::NoFrame); break; case Sunken: setMargin(10); - setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); + setFrameStyle(TQFrame::StyledPanel | TQFrame::Sunken); break; } } void Container::initLayout() { - _topLayout = new QGridLayout(this, 1, 1, 0, 10); - _gridLayout = new QGridLayout(1, 1, 10); + _topLayout = new TQGridLayout(this, 1, 1, 0, 10); + _gridLayout = new TQGridLayout(1, 1, 10); _topLayout->addLayout(_gridLayout, 0, 0); _topLayout->setRowStretch(1, 1); setFrame(_type); } -void Container::addWidget(QWidget *w, uint startRow, uint endRow, uint startCol, uint endCol, int alignment) +void Container::addWidget(TQWidget *w, uint startRow, uint endRow, uint startCol, uint endCol, int tqalignment) { Q_ASSERT( startRow<=endRow ); Q_ASSERT( startCol<=endCol ); w->show(); - _gridLayout->addMultiCellWidget(w, startRow, endRow, startCol, endCol, alignment); + _gridLayout->addMultiCellWidget(w, startRow, endRow, startCol, endCol, tqalignment); } -void Container::addLayout(QLayout *l, uint startRow, uint endRow, uint startCol, uint endCol, int alignment) +void Container::addLayout(TQLayout *l, uint startRow, uint endRow, uint startCol, uint endCol, int tqalignment) { Q_ASSERT( startRow<=endRow ); Q_ASSERT( startCol<=endCol ); - _gridLayout->addMultiCellLayout(l, startRow, endRow, startCol, endCol, alignment); + _gridLayout->addMultiCellLayout(l, startRow, endRow, startCol, endCol, tqalignment); } //---------------------------------------------------------------------------- -ButtonContainer::ButtonContainer(const QString &title, QWidget *parent) - : Container(parent, Sunken) +ButtonContainer::ButtonContainer(const TQString &title, TQWidget *tqparent) + : Container(tqparent, Sunken) { _button = new PopupButton(title, this); addWidget(_button, 0,0, 0,1); diff --git a/src/common/gui/container.h b/src/common/gui/container.h index d718c6f..e64d143 100644 --- a/src/common/gui/container.h +++ b/src/common/gui/container.h @@ -9,24 +9,25 @@ #ifndef CONTAINER_H #define CONTAINER_H -#include <qframe.h> -#include <qwidgetstack.h> -#include <qtabwidget.h> -#include <qlayout.h> +#include <tqframe.h> +#include <tqwidgetstack.h> +#include <tqtabwidget.h> +#include <tqlayout.h> class PopupButton; //---------------------------------------------------------------------------- -class Container : public QFrame +class Container : public TQFrame { Q_OBJECT + TQ_OBJECT public: enum Type { Flat, Sunken }; - Container(QWidget *parent = 0, Type type = Flat); - Container(QWidgetStack *stack, uint index, Type type = Flat); - Container(QTabWidget *tabw, const QString &title, Type type = Flat); - void addWidget(QWidget *widget, uint startRow, uint endRow, uint startCol, uint endCol, int alignment = 0); - void addLayout(QLayout *layout, uint startRow, uint endRow, uint startCol, uint endCol, int alignment = 0); + Container(TQWidget *tqparent = 0, Type type = Flat); + Container(TQWidgetStack *stack, uint index, Type type = Flat); + Container(TQTabWidget *tabw, const TQString &title, Type type = Flat); + void addWidget(TQWidget *widget, uint startRow, uint endRow, uint startCol, uint endCol, int tqalignment = 0); + void addLayout(TQLayout *tqlayout, uint startRow, uint endRow, uint startCol, uint endCol, int tqalignment = 0); uint numRows() const { return _gridLayout->numRows(); } uint numCols() const { return _gridLayout->numCols(); } void setFrame(Type type); @@ -38,7 +39,7 @@ public: private: Type _type; - QGridLayout *_topLayout, *_gridLayout; + TQGridLayout *_topLayout, *_gridLayout; void initLayout(); }; @@ -47,8 +48,9 @@ private: class ButtonContainer : public Container { Q_OBJECT + TQ_OBJECT public: - ButtonContainer(const QString &title, QWidget *parent); + ButtonContainer(const TQString &title, TQWidget *tqparent); PopupButton &button() { return *_button; } private: diff --git a/src/common/gui/dialog.cpp b/src/common/gui/dialog.cpp index 650b086..f8ee222 100644 --- a/src/common/gui/dialog.cpp +++ b/src/common/gui/dialog.cpp @@ -8,101 +8,101 @@ ***************************************************************************/ #include "dialog.h" -#include <qheader.h> -#include <qtimer.h> -#include <qlabel.h> -#include <qwidgetstack.h> +#include <tqheader.h> +#include <tqtimer.h> +#include <tqlabel.h> +#include <tqwidgetstack.h> #include <ktextedit.h> #include "misc_gui.h" //----------------------------------------------------------------------------- -Dialog::Dialog(QWidget *parent, const char *name, bool modal, - const QString &caption, int buttonMask, ButtonCode defaultButton, - bool separator, const QSize &defaultSize) - : KDialogBase(parent, name, modal, caption, buttonMask, defaultButton, separator), +Dialog::Dialog(TQWidget *tqparent, const char *name, bool modal, + const TQString &caption, int buttonMask, ButtonCode defaultButton, + bool separator, const TQSize &defaultSize) + : KDialogBase(tqparent, name, modal, caption, buttonMask, defaultButton, separator), _defaultSize(defaultSize) { - BusyCursor::start(); + PBusyCursor::start(); Q_ASSERT(name); - QWidget *main = new QWidget(this); + TQWidget *main = new TQWidget(this); setMainWidget(main); - QTimer::singleShot(0, this, SLOT(updateSize())); + TQTimer::singleShot(0, this, TQT_SLOT(updateSize())); } -Dialog::Dialog(DialogType type, const QString &caption, int buttonMask, ButtonCode defaultButton, - QWidget *parent, const char *name, bool modal, bool separator, const QSize &defaultSize) - : KDialogBase(type, caption, buttonMask, defaultButton, parent, name, modal, separator), +Dialog::Dialog(DialogType type, const TQString &caption, int buttonMask, ButtonCode defaultButton, + TQWidget *tqparent, const char *name, bool modal, bool separator, const TQSize &defaultSize) + : KDialogBase(type, caption, buttonMask, defaultButton, tqparent, name, modal, separator), _defaultSize(defaultSize) { - BusyCursor::start(); + PBusyCursor::start(); Q_ASSERT(name); - QTimer::singleShot(0, this, SLOT(updateSize())); + TQTimer::singleShot(0, this, TQT_SLOT(updateSize())); } Dialog::~Dialog() { GuiConfig gc; - gc.writeEntry(QString(name()) + "_size", size()); + gc.writeEntry(TQString(name()) + "_size", size()); } void Dialog::updateSize() { GuiConfig gc; - resize(gc.readSizeEntry(QString(name()) + "_size", &_defaultSize)); - BusyCursor::stop(); + resize(gc.readSizeEntry(TQString(name()) + "_size", &_defaultSize)); + PBusyCursor::stop(); } //----------------------------------------------------------------------------- -TreeListDialog::Item::Item(const QString &label, QWidget *page, const QString &title, QListView *listview) +TreeListDialog::Item::Item(const TQString &label, TQWidget *page, const TQString &title, TQListView *listview) : KListViewItem(listview, label), _page(page), _title(title) {} -TreeListDialog::Item::Item(const QString &label, QWidget *page, const QString &title, QListViewItem *item) +TreeListDialog::Item::Item(const TQString &label, TQWidget *page, const TQString &title, TQListViewItem *item) : KListViewItem(item, label), _page(page), _title(title) {} -TreeListDialog::TreeListDialog(QWidget *parent, const char *name, bool modal, - const QString &caption, int buttonMask, ButtonCode defaultButton, +TreeListDialog::TreeListDialog(TQWidget *tqparent, const char *name, bool modal, + const TQString &caption, int buttonMask, ButtonCode defaultButton, bool separator) - : Dialog(parent, name, modal, caption, buttonMask, defaultButton, separator) + : Dialog(tqparent, name, modal, caption, buttonMask, defaultButton, separator) { - QVBoxLayout *top = new QVBoxLayout(mainWidget(), 0, 10); + TQVBoxLayout *top = new TQVBoxLayout(mainWidget(), 0, 10); // list view - QValueList<int> widths; + TQValueList<int> widths; widths += 80; widths += 500; - Splitter *splitter = new Splitter(widths, Horizontal, mainWidget(), name); + Splitter *splitter = new Splitter(widths,Qt::Horizontal, mainWidget(), name); top->addWidget(splitter); _listView = new KListView(splitter); - connect(_listView, SIGNAL(currentChanged(QListViewItem *)), SLOT(currentChanged(QListViewItem *))); + connect(_listView, TQT_SIGNAL(currentChanged(TQListViewItem *)), TQT_SLOT(currentChanged(TQListViewItem *))); _listView->setAllColumnsShowFocus(true); _listView->setRootIsDecorated(true); _listView->setSorting(0); - _listView->addColumn(QString::null); + _listView->addColumn(TQString()); _listView->header()->hide(); - _listView->setResizeMode(QListView::LastColumn); + _listView->setResizeMode(TQListView::LastColumn); // pages - _frame = new QFrame(splitter); - QVBoxLayout *vbox = new QVBoxLayout(_frame, 10, 10); - _titleBox = new QHBoxLayout(vbox); - _label = new QLabel(_frame); + _frame = new TQFrame(splitter); + TQVBoxLayout *vbox = new TQVBoxLayout(_frame, 10, 10); + _titleBox = new TQHBoxLayout(vbox); + _label = new TQLabel(_frame); _titleBox->addWidget(_label); - _stack = new QWidgetStack(_frame); - connect(_stack, SIGNAL(aboutToShow(QWidget *)), SIGNAL(aboutToShowPage(QWidget *))); + _stack = new TQWidgetStack(_frame); + connect(_stack, TQT_SIGNAL(aboutToShow(TQWidget *)), TQT_SIGNAL(aboutToShowPage(TQWidget *))); vbox->addWidget(_stack); vbox->addStretch(1); } -QWidget *TreeListDialog::addPage(const QStringList &labels) +TQWidget *TreeListDialog::addPage(const TQStringList &labels) { Q_ASSERT( !labels.isEmpty() ); - QWidget *page = 0; - QListViewItem *item = 0; - QListViewItemIterator it(_listView); + TQWidget *page = 0; + TQListViewItem *item = 0; + TQListViewItemIterator it(_listView); for (; it.current(); ++it) { if ( it.current()->text(0)==labels[0] ) { item = it.current(); @@ -110,8 +110,8 @@ QWidget *TreeListDialog::addPage(const QStringList &labels) } } if ( item==0 ) { - page = new QWidget(_stack); - connect(page, SIGNAL(destroyed(QObject *)), SLOT(pageDestroyed(QObject *))); + page = new TQWidget(_stack); + connect(page, TQT_SIGNAL(destroyed(TQObject *)), TQT_SLOT(pageDestroyed(TQObject *))); _stack->addWidget(page); item = new Item(labels[0], page, labels[0], _listView); item->setOpen(true); @@ -119,9 +119,9 @@ QWidget *TreeListDialog::addPage(const QStringList &labels) item->setSelectable(last); } for (uint i=1; i<labels.count(); i++) { - QListViewItem *parent = item; + TQListViewItem *tqparent = item; item = 0; - QListViewItemIterator iti(parent); + TQListViewItemIterator iti(tqparent); for (; it.current(); ++it) { if ( it.current()->text(0)==labels[i] ) { item = it.current(); @@ -129,10 +129,10 @@ QWidget *TreeListDialog::addPage(const QStringList &labels) } } if ( item==0 ) { - page = new QWidget(_stack); - connect(page, SIGNAL(destroyed(QObject *)), SLOT(pageDestroyed(QObject *))); + page = new TQWidget(_stack); + connect(page, TQT_SIGNAL(destroyed(TQObject *)), TQT_SLOT(pageDestroyed(TQObject *))); _stack->addWidget(page); - item = new Item(labels[i], page, labels[i], parent); + item = new Item(labels[i], page, labels[i], tqparent); item->setOpen(true); bool last = ( labels.count()==i+1 ); item->setSelectable(last); @@ -142,7 +142,7 @@ QWidget *TreeListDialog::addPage(const QStringList &labels) return page; } -void TreeListDialog::currentChanged(QListViewItem *lvitem) +void TreeListDialog::currentChanged(TQListViewItem *lvitem) { if ( lvitem==0 ) return; Item *item = static_cast<Item *>(lvitem); @@ -151,9 +151,9 @@ void TreeListDialog::currentChanged(QListViewItem *lvitem) _stack->raiseWidget(item->_page); } -void TreeListDialog::showPage(QWidget *page) +void TreeListDialog::showPage(TQWidget *page) { - QListViewItemIterator it(_listView); + TQListViewItemIterator it(_listView); for (; it.current(); ++it) { Item *item = static_cast<Item *>(it.current()); if ( item->_page==page ) { @@ -164,7 +164,7 @@ void TreeListDialog::showPage(QWidget *page) } } -int TreeListDialog::pageIndex(QWidget *page) const +int TreeListDialog::pageIndex(TQWidget *page) const { return _stack->id(page); } @@ -176,24 +176,24 @@ int TreeListDialog::activePageIndex() const return pageIndex(item->_page); } -void TreeListDialog::pageDestroyed(QObject *object) +void TreeListDialog::pageDestroyed(TQObject *object) { - QListViewItemIterator it(_listView); + TQListViewItemIterator it(_listView); for (; it.current(); ++it) { Item *item = static_cast<Item *>(it.current()); - if ( item->_page!=object ) continue; + if ( TQT_BASE_OBJECT(item->_page)!=TQT_BASE_OBJECT(object) ) continue; delete item; break; } } //----------------------------------------------------------------------------- -TextEditorDialog::TextEditorDialog(const QString &text, const QString &caption, - bool wrapAtWidgetWidth, QWidget *parent) - : Dialog(parent, "text_editor_dialog", true, caption, Close, Close, false, QSize(200, 100)) +TextEditorDialog::TextEditorDialog(const TQString &text, const TQString &caption, + bool wrapAtWidgetWidth, TQWidget *tqparent) + : Dialog(tqparent, "text_editor_dialog", true, caption, Close, Close, false, TQSize(200, 100)) { - KTextEdit *w = new KTextEdit(text, QString::null, this); + KTextEdit *w = new KTextEdit(text, TQString(), this); w->setReadOnly(true); - w->setWordWrap(wrapAtWidgetWidth ? QTextEdit::WidgetWidth : QTextEdit::NoWrap); + w->setWordWrap(wrapAtWidgetWidth ? TQTextEdit::WidgetWidth : TQTextEdit::NoWrap); setMainWidget(w); } diff --git a/src/common/gui/dialog.h b/src/common/gui/dialog.h index 1227a7d..bc95d81 100644 --- a/src/common/gui/dialog.h +++ b/src/common/gui/dialog.h @@ -9,7 +9,7 @@ #ifndef DIALOG_H #define DIALOG_H -#include <qlayout.h> +#include <tqlayout.h> #include <kdialogbase.h> #include <klistview.h> @@ -17,51 +17,53 @@ class Dialog : public KDialogBase { Q_OBJECT + TQ_OBJECT public: - Dialog(QWidget *parent, const char *name, bool modal, - const QString &caption, int buttonMask, ButtonCode defaultButton, bool separator, - const QSize &defaultSize = QSize()); - Dialog(DialogType type, const QString &caption, - int buttonMask, ButtonCode defaultButton, QWidget *parent, const char *name, - bool modal, bool separator, const QSize &defaultSize = QSize()); + Dialog(TQWidget *tqparent, const char *name, bool modal, + const TQString &caption, int buttonMask, ButtonCode defaultButton, bool separator, + const TQSize &defaultSize = TQSize()); + Dialog(DialogType type, const TQString &caption, + int buttonMask, ButtonCode defaultButton, TQWidget *tqparent, const char *name, + bool modal, bool separator, const TQSize &defaultSize = TQSize()); virtual ~Dialog(); private slots: void updateSize(); private: - QSize _defaultSize; + TQSize _defaultSize; }; //----------------------------------------------------------------------------- class TreeListDialog : public Dialog { Q_OBJECT + TQ_OBJECT public: - TreeListDialog(QWidget *parent, const char *name, bool modal, - const QString &caption, int buttonMask, ButtonCode defaultButton, bool separator); - QWidget *addPage(const QStringList &labels); - void showPage(QWidget *page); + TreeListDialog(TQWidget *tqparent, const char *name, bool modal, + const TQString &caption, int buttonMask, ButtonCode defaultButton, bool separator); + TQWidget *addPage(const TQStringList &labels); + void showPage(TQWidget *page); int activePageIndex() const; - int pageIndex(QWidget *page) const; + int pageIndex(TQWidget *page) const; protected slots: - virtual void currentChanged(QListViewItem *item); - void pageDestroyed(QObject *page); + virtual void currentChanged(TQListViewItem *item); + void pageDestroyed(TQObject *page); protected: - QFrame *_frame; + TQFrame *_frame; KListView *_listView; - QHBoxLayout *_titleBox; - QLabel *_label; - QWidgetStack *_stack; + TQHBoxLayout *_titleBox; + TQLabel *_label; + TQWidgetStack *_stack; class Item : public KListViewItem { public: - Item(const QString &label, QWidget *page, const QString &title, QListView *listview); - Item(const QString &label, QWidget *page, const QString &title, QListViewItem *item); - QWidget *_page; - QString _title; + Item(const TQString &label, TQWidget *page, const TQString &title, TQListView *listview); + Item(const TQString &label, TQWidget *page, const TQString &title, TQListViewItem *item); + TQWidget *_page; + TQString _title; }; }; @@ -69,9 +71,10 @@ protected: class TextEditorDialog : public Dialog { Q_OBJECT + TQ_OBJECT public: - TextEditorDialog(const QString &text, const QString &caption, - bool wrapAtWidgetWidth, QWidget *parent); + TextEditorDialog(const TQString &text, const TQString &caption, + bool wrapAtWidgetWidth, TQWidget *tqparent); }; #endif diff --git a/src/common/gui/editlistbox.cpp b/src/common/gui/editlistbox.cpp index 1d2916d..2e40b8a 100644 --- a/src/common/gui/editlistbox.cpp +++ b/src/common/gui/editlistbox.cpp @@ -19,9 +19,9 @@ */ #include "editlistbox.h" -#include <qstringlist.h> -#include <qlabel.h> -#include <qheader.h> +#include <tqstringlist.h> +#include <tqlabel.h> +#include <tqheader.h> #include <kdialog.h> #include <klocale.h> @@ -30,22 +30,22 @@ #include <kiconloader.h> #include <kstdguiitem.h> -EditListBox::EditListBox(uint nbColumns, QWidget *parent, const char *name, Mode mode, Buttons buttons) - : QFrame(parent, name), _mode(mode), _buttons(buttons) +EditListBox::EditListBox(uint nbColumns, TQWidget *tqparent, const char *name, Mode mode, Buttons buttons) + : TQFrame(tqparent, name), _mode(mode), _buttons(buttons) { m_lineEdit = new KLineEdit; init(nbColumns, m_lineEdit); } -EditListBox::EditListBox(uint nbColumns, QWidget *view, KLineEdit *lineEdit, QWidget *parent, const char *name, +EditListBox::EditListBox(uint nbColumns, TQWidget *view, KLineEdit *lineEdit, TQWidget *tqparent, const char *name, Mode mode, Buttons buttons) - : QFrame(parent, name), _mode(mode), _buttons(buttons) + : TQFrame(tqparent, name), _mode(mode), _buttons(buttons) { m_lineEdit = lineEdit; init(nbColumns, view); } -void EditListBox::init(uint nbColumns, QWidget *view) +void EditListBox::init(uint nbColumns, TQWidget *view) { _addButton = 0; _removeButton = 0; @@ -53,48 +53,48 @@ void EditListBox::init(uint nbColumns, QWidget *view) _moveDownButton = 0; _removeAllButton = 0; _resetButton = 0; - setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); + tqsetSizePolicy(TQSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding)); - QGridLayout *grid = new QGridLayout(this, 1, 1, 0, KDialog::spacingHint()); + TQGridLayout *grid = new TQGridLayout(this, 1, 1, 0, KDialog::spacingHint()); uint row = 0; if (view) { - QHBoxLayout *hbox = new QHBoxLayout(KDialog::spacingHint()); + TQHBoxLayout *hbox = new TQHBoxLayout(KDialog::spacingHint()); grid->addMultiCellLayout(hbox, row,row, 0,1); if (m_lineEdit) { KIconLoader loader; - QIconSet iconset = loader.loadIcon("locationbar_erase", KIcon::Toolbar); - KPushButton *button = new KPushButton(iconset, QString::null, this); - connect(button, SIGNAL(clicked()), SLOT(clearEdit())); + TQIconSet iconset = loader.loadIcon("locationbar_erase", KIcon::Toolbar); + KPushButton *button = new KPushButton(iconset, TQString(), this); + connect(button, TQT_SIGNAL(clicked()), TQT_SLOT(clearEdit())); hbox->addWidget(button); } - view->reparent( this, QPoint(0,0) ); + view->reparent( this, TQPoint(0,0) ); hbox->addWidget(view); row++; } _listView= new KListView(this); - for (uint i=0; i<nbColumns; i++) _listView->addColumn(QString::null); + for (uint i=0; i<nbColumns; i++) _listView->addColumn(TQString()); _listView->header()->hide(); _listView->setSorting(-1); _listView->setResizeMode(KListView::LastColumn); _listView->setColumnWidthMode(nbColumns-1, KListView::Maximum); grid->addWidget(_listView, row, 0); - QVBoxLayout *vbox = new QVBoxLayout(10); + TQVBoxLayout *vbox = new TQVBoxLayout(10); grid->addLayout(vbox, row, 1); - _buttonsLayout = new QVBoxLayout(10); + _buttonsLayout = new TQVBoxLayout(10); vbox->addLayout(_buttonsLayout); vbox->addStretch(1); setButtons(_buttons); if (m_lineEdit) { - connect(m_lineEdit,SIGNAL(textChanged(const QString&)),this,SLOT(typedSomething(const QString&))); + connect(m_lineEdit,TQT_SIGNAL(textChanged(const TQString&)),this,TQT_SLOT(typedSomething(const TQString&))); m_lineEdit->setTrapReturnKey(true); - connect(m_lineEdit,SIGNAL(returnPressed()),this,SLOT(addItem())); + connect(m_lineEdit,TQT_SIGNAL(returnPressed()),this,TQT_SLOT(addItem())); } - connect(_listView, SIGNAL(selectionChanged()), SLOT(selectionChanged())); + connect(_listView, TQT_SIGNAL(selectionChanged()), TQT_SLOT(selectionChanged())); // maybe supplied lineedit has some text already - typedSomething(m_lineEdit ? m_lineEdit->text() : QString::null); + typedSomething(m_lineEdit ? m_lineEdit->text() : TQString()); } void EditListBox::setButtons(Buttons buttons) @@ -111,7 +111,7 @@ void EditListBox::setButtons(Buttons buttons) #endif _addButton->setEnabled(false); _addButton->show(); - connect(_addButton, SIGNAL(clicked()), SLOT(addItem())); + connect(_addButton, TQT_SIGNAL(clicked()), TQT_SLOT(addItem())); _buttonsLayout->addWidget(_addButton); } @@ -121,7 +121,7 @@ void EditListBox::setButtons(Buttons buttons) _removeButton = new KPushButton(KGuiItem(i18n("Remove"), "clear"), this); _removeButton->setEnabled(false); _removeButton->show(); - connect(_removeButton, SIGNAL(clicked()), SLOT(removeItem())); + connect(_removeButton, TQT_SIGNAL(clicked()), TQT_SLOT(removeItem())); _buttonsLayout->addWidget(_removeButton); } @@ -130,7 +130,7 @@ void EditListBox::setButtons(Buttons buttons) if ( buttons & RemoveAll ) { _removeAllButton = new KPushButton(KGuiItem(i18n("Remove All"), "delete"), this); _removeAllButton->show(); - connect(_removeAllButton, SIGNAL(clicked()), SLOT(clear())); + connect(_removeAllButton, TQT_SIGNAL(clicked()), TQT_SLOT(clear())); _buttonsLayout->addWidget(_removeAllButton); } @@ -142,12 +142,12 @@ void EditListBox::setButtons(Buttons buttons) _moveUpButton = new KPushButton(KGuiItem(i18n("Move &Up"), "up"), this); _moveUpButton->setEnabled(false); _moveUpButton->show(); - connect(_moveUpButton, SIGNAL(clicked()), SLOT(moveItemUp())); + connect(_moveUpButton, TQT_SIGNAL(clicked()), TQT_SLOT(moveItemUp())); _buttonsLayout->addWidget(_moveUpButton); _moveDownButton = new KPushButton(KGuiItem(i18n("Move &Down"), "down"), this); _moveDownButton->setEnabled(false); _moveDownButton->show(); - connect(_moveDownButton, SIGNAL(clicked()), SLOT(moveItemDown())); + connect(_moveDownButton, TQT_SIGNAL(clicked()), TQT_SLOT(moveItemDown())); _buttonsLayout->addWidget(_moveDownButton); } @@ -156,14 +156,14 @@ void EditListBox::setButtons(Buttons buttons) if ( buttons & Reset ) { _resetButton = new KPushButton(KStdGuiItem::reset(), this); _resetButton->show(); - connect(_resetButton, SIGNAL(clicked()), SIGNAL(reset())); + connect(_resetButton, TQT_SIGNAL(clicked()), TQT_SIGNAL(reset())); _buttonsLayout->addWidget(_resetButton); } } -void EditListBox::typedSomething(const QString& text) +void EditListBox::typedSomething(const TQString& text) { - QListViewItem *item = _listView->selectedItem(); + TQListViewItem *item = _listView->selectedItem(); if (item) { if( selectedText()!=text ) { item->setText(textColumn(), text); @@ -175,7 +175,7 @@ void EditListBox::typedSomething(const QString& text) void EditListBox::moveItemUp() { - QListViewItem *item = _listView->selectedItem(); + TQListViewItem *item = _listView->selectedItem(); if ( item==0 || item->itemAbove()==0 ) return; item->itemAbove()->moveItem(item); updateButtons(); @@ -184,7 +184,7 @@ void EditListBox::moveItemUp() void EditListBox::moveItemDown() { - QListViewItem *item = _listView->selectedItem(); + TQListViewItem *item = _listView->selectedItem(); if ( item==0 || item->itemBelow()==0 ) return; item->moveItem(item->itemBelow()); updateButtons(); @@ -201,11 +201,11 @@ void EditListBox::addItem() addItem(m_lineEdit->text()); } -void EditListBox::addItem(const QString &text) +void EditListBox::addItem(const TQString &text) { bool alreadyInList(false); //if we didn't check for dupes at the inserting we have to do it now - if ( _mode==DuplicatesDisallowed ) alreadyInList = _listView->findItem(text, textColumn()); + if ( _mode==DuplicatesDisallowed ) alreadyInList = _listView->tqfindItem(text, textColumn()); if (m_lineEdit) { bool block = m_lineEdit->signalsBlocked(); @@ -216,7 +216,7 @@ void EditListBox::addItem(const QString &text) _listView->clearSelection(); if (!alreadyInList) { - QListViewItem *item = createItem(); + TQListViewItem *item = createItem(); item->setText(textColumn(), text); if ( _listView->lastItem() ) item->moveItem(_listView->lastItem()); emit changed(); @@ -237,9 +237,9 @@ void EditListBox::clearEdit() void EditListBox::removeItem() { - QListViewItem *item = _listView->selectedItem(); + TQListViewItem *item = _listView->selectedItem(); if (item) { - QString text = item->text(textColumn()); + TQString text = item->text(textColumn()); delete item; emit changed(); emit removed(text); @@ -267,15 +267,15 @@ void EditListBox::clear() uint EditListBox::count() const { uint nb = 0; - QListViewItemIterator it(_listView); + TQListViewItemIterator it(_listView); for (; it.current(); ++it) nb++; return nb; } -const QListViewItem *EditListBox::item(uint i) const +const TQListViewItem *EditListBox::item(uint i) const { uint k = 0; - QListViewItemIterator it(_listView); + TQListViewItemIterator it(_listView); for (; it.current(); ++it) { if ( k==i ) return it.current(); k++; @@ -283,19 +283,19 @@ const QListViewItem *EditListBox::item(uint i) const return 0; } -QStringList EditListBox::texts() const +TQStringList EditListBox::texts() const { - QStringList list; - QListViewItemIterator it(_listView); + TQStringList list; + TQListViewItemIterator it(_listView); for (; it.current(); ++it) list.append(it.current()->text(textColumn())); return list; } -void EditListBox::setTexts(const QStringList& items) +void EditListBox::setTexts(const TQStringList& items) { _listView->clear(); for (int i=items.count()-1; i>=0; i--) { - QListViewItem *item = createItem(); + TQListViewItem *item = createItem(); item->setText(textColumn(), items[i]); } if (m_lineEdit) m_lineEdit->clear(); @@ -304,14 +304,14 @@ void EditListBox::setTexts(const QStringList& items) void EditListBox::updateButtons() { - QListViewItem *item = _listView->selectedItem(); + TQListViewItem *item = _listView->selectedItem(); if (_addButton) { if ( m_lineEdit==0 ) _addButton->setEnabled(true); else { - QString text = m_lineEdit->text(); + TQString text = m_lineEdit->text(); if ( _mode!=DuplicatesCheckedAtEntering ) _addButton->setEnabled(!text.isEmpty()); else if ( text.isEmpty() ) _addButton->setEnabled(false); - else _addButton->setEnabled(!_listView->findItem(text, textColumn())); + else _addButton->setEnabled(!_listView->tqfindItem(text, textColumn())); } } if (_removeButton) _removeButton->setEnabled(item); @@ -320,21 +320,21 @@ void EditListBox::updateButtons() if (_removeAllButton) _removeAllButton->setEnabled(_listView->firstChild()); } -void EditListBox::setEditText(const QString &text) +void EditListBox::setEditText(const TQString &text) { _listView->clearSelection(); if (m_lineEdit) m_lineEdit->setText(text); updateButtons(); } -QListViewItem *EditListBox::createItem() +TQListViewItem *EditListBox::createItem() { return new KListViewItem(_listView); } -QString EditListBox::selectedText() const +TQString EditListBox::selectedText() const { - QListViewItem *item = _listView->selectedItem(); - if ( item==0 ) return QString::null; + TQListViewItem *item = _listView->selectedItem(); + if ( item==0 ) return TQString(); return item->text(textColumn()); } diff --git a/src/common/gui/editlistbox.h b/src/common/gui/editlistbox.h index c259278..3e7a26d 100644 --- a/src/common/gui/editlistbox.h +++ b/src/common/gui/editlistbox.h @@ -19,7 +19,7 @@ #ifndef EDITLISTBOX_H #define EDITLISTBOX_H -#include <qlayout.h> +#include <tqlayout.h> #include <klineedit.h> #include <kpushbutton.h> #include <klistview.h> @@ -32,33 +32,34 @@ // * use KStdGuiItem for buttons // * support for New, Clear, Reset buttons // * use KListView -class EditListBox : public QFrame +class EditListBox : public TQFrame { Q_OBJECT + TQ_OBJECT public: enum Mode { DuplicatesDisallowed, DuplicatesAllowed, DuplicatesCheckedAtEntering }; enum Button { Add = 1, Remove = 2, UpDown = 4, RemoveAll = 8, Reset = 16 }; - Q_DECLARE_FLAGS(Buttons, Button) + TQ_DECLARE_FLAGS(Buttons, Button) - EditListBox(uint nbColumns, QWidget *parent = 0, const char *name = 0, Mode mode = DuplicatesDisallowed, + EditListBox(uint nbColumns, TQWidget *tqparent = 0, const char *name = 0, Mode mode = DuplicatesDisallowed, Buttons buttons = Buttons(Add|Remove|RemoveAll|UpDown) ); - EditListBox(uint nbColumns, QWidget *view, KLineEdit *lineEdit, QWidget *parent = 0, const char *name = 0, + EditListBox(uint nbColumns, TQWidget *view, KLineEdit *lineEdit, TQWidget *tqparent = 0, const char *name = 0, Mode mode = DuplicatesDisallowed, Buttons buttons = Buttons(Add|Remove|RemoveAll|UpDown) ); - void setTexts(const QStringList& items); - QStringList texts() const; + void setTexts(const TQStringList& items); + TQStringList texts() const; uint count() const; - QString text(uint i) const { return item(i)->text(textColumn()); } - const QListViewItem *item(uint i) const; + TQString text(uint i) const { return item(i)->text(textColumn()); } + const TQListViewItem *item(uint i) const; Buttons buttons() const { return _buttons; } void setButtons(Buttons buttons); - void setEditText(const QString &text); - void addItem(const QString &text); + void setEditText(const TQString &text); + void addItem(const TQString &text); signals: void reset(); void changed(); - void added( const QString & text ); - void removed( const QString & text ); + void added( const TQString & text ); + void removed( const TQString & text ); public slots: void clear(); @@ -70,26 +71,26 @@ Q_OBJECT virtual void addItem(); virtual void removeItem(); void selectionChanged(); - void typedSomething(const QString& text); + void typedSomething(const TQString& text); protected: KListView *_listView; - virtual QListViewItem *createItem(); + virtual TQListViewItem *createItem(); virtual uint textColumn() const { return 0; } - QString selectedText() const; + TQString selectedText() const; private: Mode _mode; Buttons _buttons; - QVBoxLayout *_buttonsLayout; + TQVBoxLayout *_buttonsLayout; KLineEdit *m_lineEdit; KPushButton *_addButton, *_removeButton, *_moveUpButton, *_moveDownButton, *_removeAllButton, *_resetButton; - void init(uint nbColumns, QWidget *view); + void init(uint nbColumns, TQWidget *view); void updateButtons(); }; -Q_DECLARE_OPERATORS_FOR_FLAGS(EditListBox::Buttons) +TQ_DECLARE_OPERATORS_FOR_FLAGS(EditListBox::Buttons) #endif diff --git a/src/common/gui/hexword_gui.cpp b/src/common/gui/hexword_gui.cpp index d794a11..b85e829 100644 --- a/src/common/gui/hexword_gui.cpp +++ b/src/common/gui/hexword_gui.cpp @@ -9,16 +9,16 @@ ***************************************************************************/ #include "hexword_gui.h" -#include <qtimer.h> +#include <tqtimer.h> #include "common/gui/number_gui.h" #include "common/common/misc.h" //----------------------------------------------------------------------------- -HexValueValidator::HexValueValidator(uint nbChars, QObject *parent) - : QValidator(parent, "hex_value_validator"), _nbChars(nbChars) {} +HexValueValidator::HexValueValidator(uint nbChars, TQObject *tqparent) + : TQValidator(tqparent, "hex_value_validator"), _nbChars(nbChars) {} -QValidator::State HexValueValidator::validate(QString &input, int &) const +TQValidator::State HexValueValidator::validate(TQString &input, int &) const { if ( input.length()==0 ) return Acceptable; if ( input.length()>_nbChars ) return Invalid; @@ -28,12 +28,12 @@ QValidator::State HexValueValidator::validate(QString &input, int &) const } //----------------------------------------------------------------------------- -GenericHexWordEditor::GenericHexWordEditor(uint nbChars, bool hasBlankValue, QWidget *parent) - : KLineEdit(parent, "hex_word_editor"), _nbChars(nbChars), _hasBlankValue(hasBlankValue) +GenericHexWordEditor::GenericHexWordEditor(uint nbChars, bool hasBlankValue, TQWidget *tqparent) + : KLineEdit(tqparent, "hex_word_editor"), _nbChars(nbChars), _hasBlankValue(hasBlankValue) { - setFocusPolicy(ClickFocus); - setValidator(new HexValueValidator(nbChars, this)); - connect(this, SIGNAL(textChanged(const QString &)), SLOT(slotTextChanged())); + setFocusPolicy(TQ_ClickFocus); + setValidator(new HexValueValidator(nbChars, TQT_TQOBJECT(this))); + connect(this, TQT_SIGNAL(textChanged(const TQString &)), TQT_SLOT(slotTextChanged())); setFrame(false); } @@ -46,9 +46,9 @@ void GenericHexWordEditor::slotTextChanged() bool GenericHexWordEditor::changeValue() { if ( !isValid() ) return false; - QString s = text(); + TQString s = text(); BitValue v = blankValue(); - if ( s!=QString(repeat("-", _nbChars)) ) { + if ( s!=TQString(repeat("-", _nbChars)) ) { s = s.leftJustify(_nbChars, '0', true); for (uint i=0; i<_nbChars; i++) if ( !isxdigit(s[i].latin1()) ) s[i] = '0'; @@ -74,17 +74,17 @@ void GenericHexWordEditor::set() blockSignals(false); } -bool GenericHexWordEditor::event(QEvent *e) +bool GenericHexWordEditor::event(TQEvent *e) { switch (e->type()) { - case QEvent::FocusOut: + case TQEvent::FocusOut: changeValue(); break; - case QEvent::FocusIn: - QTimer::singleShot(0, this, SLOT(selectAll())); // ugly but it works + case TQEvent::FocusIn: + TQTimer::singleShot(0, this, TQT_SLOT(selectAll())); // ugly but it works break; - case QEvent::KeyPress: - switch ( static_cast<QKeyEvent *>(e)->key() ) { + case TQEvent::KeyPress: + switch ( TQT_TQKEYEVENT(e)->key() ) { case Key_Next: emit moveNextPage(); return true; @@ -122,15 +122,15 @@ bool GenericHexWordEditor::event(QEvent *e) } default: break; } - return QLineEdit::event(e); + return TQLineEdit::event(e); } -QSize GenericHexWordEditor::sizeHint() const +TQSize GenericHexWordEditor::tqsizeHint() const { - return QSize(maxCharWidth(NumberBase::Hex, font()) * (_nbChars+1), fontMetrics().height()); + return TQSize(maxCharWidth(NumberBase::Hex, font()) * (_nbChars+1), fontMetrics().height()); } -QSize GenericHexWordEditor::minimumSizeHint() const +TQSize GenericHexWordEditor::tqminimumSizeHint() const { - return QSize(maxCharWidth(NumberBase::Hex, font()) * (_nbChars+1), fontMetrics().height()); + return TQSize(maxCharWidth(NumberBase::Hex, font()) * (_nbChars+1), fontMetrics().height()); } diff --git a/src/common/gui/hexword_gui.h b/src/common/gui/hexword_gui.h index 5da6840..f607f07 100644 --- a/src/common/gui/hexword_gui.h +++ b/src/common/gui/hexword_gui.h @@ -10,18 +10,19 @@ #ifndef HEXWORD_GUI_H #define HEXWORD_GUI_H -#include <qvalidator.h> +#include <tqvalidator.h> #include <klineedit.h> #include "common/common/bitvalue.h" //----------------------------------------------------------------------------- -class HexValueValidator : public QValidator +class HexValueValidator : public TQValidator { Q_OBJECT + TQ_OBJECT public: - HexValueValidator(uint nbChars, QObject *parent); - virtual State validate(QString &input, int &pos) const; + HexValueValidator(uint nbChars, TQObject *tqparent); + virtual State validate(TQString &input, int &pos) const; private: uint _nbChars; @@ -31,10 +32,11 @@ private: class GenericHexWordEditor : public KLineEdit { Q_OBJECT + TQ_OBJECT public: - GenericHexWordEditor(uint nbChars, bool hasBlankValue, QWidget *parent); - virtual QSize sizeHint() const; - virtual QSize minimumSizeHint() const; + GenericHexWordEditor(uint nbChars, bool hasBlankValue, TQWidget *tqparent); + virtual TQSize tqsizeHint() const; + virtual TQSize tqminimumSizeHint() const; signals: void modified(); @@ -56,9 +58,9 @@ protected: bool _hasBlankValue; virtual bool isValid() const = 0; - virtual BitValue mask() const = 0; + virtual BitValue tqmask() const = 0; virtual BitValue normalizeWord(BitValue value) const = 0; - virtual bool event(QEvent *e); + virtual bool event(TQEvent *e); virtual void set(); virtual BitValue word() const = 0; virtual void setWord(BitValue value) = 0; @@ -69,8 +71,9 @@ protected: class HexWordEditor : public GenericHexWordEditor { Q_OBJECT + TQ_OBJECT public: - HexWordEditor(uint nbChars, QWidget *parent) : GenericHexWordEditor(nbChars, false, parent) {} + HexWordEditor(uint nbChars, TQWidget *tqparent) : GenericHexWordEditor(nbChars, false, tqparent) {} void setValue(BitValue word) { _word = word; set(); } BitValue value() const { return _word; } @@ -78,8 +81,8 @@ protected: BitValue _word; virtual bool isValid() const { return true; } - virtual BitValue mask() const { return maxValue(NumberBase::Hex, _nbChars); } - virtual BitValue normalizeWord(BitValue value) const { return value.maskWith(mask()); } + virtual BitValue tqmask() const { return maxValue(NumberBase::Hex, _nbChars); } + virtual BitValue normalizeWord(BitValue value) const { return value.tqmaskWith(tqmask()); } virtual BitValue word() const { return _word; } virtual void setWord(BitValue value) { _word = value; } virtual BitValue blankValue() const { return 0; } diff --git a/src/common/gui/key_gui.h b/src/common/gui/key_gui.h index fb8a9f5..5ae0a84 100644 --- a/src/common/gui/key_gui.h +++ b/src/common/gui/key_gui.h @@ -9,9 +9,9 @@ #ifndef KEY_GUI_H #define KEY_GUI_H -#include <qcombobox.h> -#include <qwidgetstack.h> -#include <qpopupmenu.h> +#include <tqcombobox.h> +#include <tqwidgetstack.h> +#include <tqpopupmenu.h> #include "common/gui/misc_gui.h" #include "common/common/misc.h" @@ -21,10 +21,10 @@ template <typename KeyType, typename Type, typename WidgetType> class KeyWidget { public: - typedef QMapConstIterator<KeyType, int> ConstIterator; + typedef TQMapConstIterator<KeyType, int> ConstIterator; public: - KeyWidget(QWidget *parent) { _widget = new WidgetType(parent); } + KeyWidget(TQWidget *tqparent) { _widget = new WidgetType(tqparent); } virtual ~KeyWidget() { delete _widget; } virtual WidgetType *widget() { return _widget; } virtual void clear() { _ids.clear(); } @@ -32,16 +32,16 @@ public: ConstIterator end() const { return _ids.end(); } uint count() const { return _ids.count(); } void appendItem(const KeyType &key, Type type) { - CRASH_ASSERT( !_ids.contains(key) ); + CRASH_ASSERT( !_ids.tqcontains(key) ); _ids[key] = append(type); } KeyType currentItem() const { return key(currentId()); } void setCurrentItem(const KeyType &key) { - if ( _ids.contains(key) ) setCurrentId(_ids[key]); + if ( _ids.tqcontains(key) ) setCurrentId(_ids[key]); } - bool contains(const KeyType &key) const { return _ids.contains(key); } + bool tqcontains(const KeyType &key) const { return _ids.tqcontains(key); } Type item(const KeyType &key) const { - CRASH_ASSERT( _ids.contains(key) ); + CRASH_ASSERT( _ids.tqcontains(key) ); return get(_ids[key]); } Type item(ConstIterator it) const { @@ -60,64 +60,64 @@ protected: virtual void setCurrentId(int id) = 0; virtual Type get(int id) const = 0; - QWidget *_parent; - QMap<KeyType, int> _ids; + TQWidget *_parent; + TQMap<KeyType, int> _ids; WidgetType *_widget; }; //----------------------------------------------------------------------------- template <typename KeyType> -class KeyComboBox : public KeyWidget<KeyType, QString, QComboBox> +class KeyComboBox : public KeyWidget<KeyType, TQString, TQComboBox> { public: - typedef KeyWidget<KeyType, QString, QComboBox> ParentType; - KeyComboBox(QWidget *parent = 0) : ParentType(parent) {} + typedef KeyWidget<KeyType, TQString, TQComboBox> ParentType; + KeyComboBox(TQWidget *tqparent = 0) : ParentType(tqparent) {} virtual void clear() { ParentType::clear(); ParentType::_widget->clear(); } void fixMinimumWidth() { - ParentType::_widget->setMinimumWidth(ParentType::_widget->sizeHint().width()); + ParentType::_widget->setMinimumWidth(ParentType::_widget->tqsizeHint().width()); } protected: - virtual int append(QString label) { ParentType::_widget->insertItem(label); return ParentType::_widget->count()-1; } + virtual int append(TQString label) { ParentType::_widget->insertItem(label); return ParentType::_widget->count()-1; } virtual int currentId() const { return ParentType::_widget->currentItem(); } virtual void setCurrentId(int id) { ParentType::_widget->setCurrentItem(id); } - virtual QString get(int id) const { return ParentType::_widget->text(id); } + virtual TQString get(int id) const { return ParentType::_widget->text(id); } }; //----------------------------------------------------------------------------- template <typename KeyType> -class KeyWidgetStack : public KeyWidget<KeyType, QWidget *, QWidgetStack> +class KeyWidgetStack : public KeyWidget<KeyType, TQWidget *, TQWidgetStack> { public: - typedef KeyWidget<KeyType, QWidget *, QWidgetStack> ParentType; - KeyWidgetStack(QWidget *parent = 0) : ParentType(parent) {} + typedef KeyWidget<KeyType, TQWidget *, TQWidgetStack> ParentType; + KeyWidgetStack(TQWidget *tqparent = 0) : ParentType(tqparent) {} protected: - virtual int append(QWidget *widget) { return ParentType::_widget->addWidget(widget); } + virtual int append(TQWidget *widget) { return ParentType::_widget->addWidget(widget); } virtual int currentId() const { return ParentType::_widget->id(ParentType::_widget->visibleWidget()); } virtual void setCurrentId(int id) { ParentType::_widget->raiseWidget(id); } - virtual QWidget *get(int id) const { return ParentType::_widget->widget(id); } + virtual TQWidget *get(int id) const { return ParentType::_widget->widget(id); } }; //----------------------------------------------------------------------------- template <typename KeyType> -class KeyPopupButton : public KeyWidget<KeyType, QString, PopupButton> +class KeyPopupButton : public KeyWidget<KeyType, TQString, PopupButton> { public: - typedef KeyWidget<KeyType, QString, PopupButton> ParentType; - KeyPopupButton(QWidget *parent = 0) : ParentType(parent) {} + typedef KeyWidget<KeyType, TQString, PopupButton> ParentType; + KeyPopupButton(TQWidget *tqparent = 0) : ParentType(tqparent) {} protected: - virtual int append(QString label) { return ParentType::_widget->appendItem(label, QPixmap()); } - virtual QString get(int id) const { return ParentType::_widget->popup()->text(id); } + virtual int append(TQString label) { return ParentType::_widget->appendItem(label, TQPixmap()); } + virtual TQString get(int id) const { return ParentType::_widget->popup()->text(id); } private: // disabled - QString currentItem() const; - void setCurrentItem(const QString &key); + TQString currentItem() const; + void setCurrentItem(const TQString &key); virtual int currentId() const { return 0; } virtual void setCurrentId(int) {} }; diff --git a/src/common/gui/list_container.cpp b/src/common/gui/list_container.cpp index 0103175..78f5a65 100644 --- a/src/common/gui/list_container.cpp +++ b/src/common/gui/list_container.cpp @@ -9,27 +9,27 @@ #include "list_container.h" //---------------------------------------------------------------------------- -PopupContainer::PopupContainer(const QString &title, QWidget *parent, const char *name) - : KPopupMenu(parent, name) +PopupContainer::PopupContainer(const TQString &title, TQWidget *tqparent, const char *name) + : KPopupMenu(tqparent, name) { if ( !title.isEmpty() ) insertTitle(title); } -ListContainer *PopupContainer::appendBranch(const QString &title) +ListContainer *PopupContainer::appendBranch(const TQString &title) { PopupContainer *branch = new PopupContainer(title, this); insertItem(title, branch); return branch; } -ListContainer *PopupContainer::appendBranch(const QPixmap &pixmap, const QString &title) +ListContainer *PopupContainer::appendBranch(const TQPixmap &pixmap, const TQString &title) { PopupContainer *branch = new PopupContainer(title, this); insertItem(pixmap, title, branch); return branch; } -void PopupContainer::appendItem(const QPixmap &icon, const QString &label, uint id, ItemState state) +void PopupContainer::appendItem(const TQPixmap &icon, const TQString &label, uint id, ItemState state) { insertItem(icon, label, id); switch (state) { @@ -41,16 +41,16 @@ void PopupContainer::appendItem(const QPixmap &icon, const QString &label, uint } //---------------------------------------------------------------------------- -ListViewItemContainer::ListViewItemContainer(const QString &title, KListView *parent) - : KListViewItem(parent, title), _parent(0), _column(0) +ListViewItemContainer::ListViewItemContainer(const TQString &title, KListView *tqparent) + : KListViewItem(tqparent, title), _parent(0), _column(0) { - _ids = new QMap<const QListViewItem *, uint>; + _ids = new TQMap<const TQListViewItem *, uint>; } -ListViewItemContainer::ListViewItemContainer(const QString &title, ListViewItemContainer *parent) - : KListViewItem(parent, title), _parent(parent), _column(0) +ListViewItemContainer::ListViewItemContainer(const TQString &title, ListViewItemContainer *tqparent) + : KListViewItem(tqparent, title), _parent(tqparent), _column(0) { - _ids = parent->_ids; + _ids = tqparent->_ids; } ListViewItemContainer::~ListViewItemContainer() @@ -58,38 +58,38 @@ ListViewItemContainer::~ListViewItemContainer() if ( _parent==0 ) delete _ids; } -ListContainer *ListViewItemContainer::appendBranch(const QString &title) +ListContainer *ListViewItemContainer::appendBranch(const TQString &title) { ListViewItemContainer *branch = new ListViewItemContainer(title, this); branch->setColumn(_column); branch->setSelectable(false); // append instead of prepend - QListViewItem *litem=firstChild(); + TQListViewItem *litem=firstChild(); while ( litem && litem->nextSibling() ) litem = litem->nextSibling(); if (litem) branch->moveItem(litem); return branch; } -void ListViewItemContainer::appendItem(const QPixmap &icon, const QString &title, uint id, ItemState state) +void ListViewItemContainer::appendItem(const TQPixmap &icon, const TQString &title, uint id, ItemState state) { - QListViewItem *item = 0; + TQListViewItem *item = 0; if ( state==Normal || state==Disabled ) { item = new KListViewItem(this); item->setText(_column, title); } else { - item = new QCheckListItem(this, title, QCheckListItem::CheckBox); - static_cast<QCheckListItem *>(item)->setState(state==Checked ? QCheckListItem::On : QCheckListItem::Off); + item = new TQCheckListItem(this, title, TQCheckListItem::CheckBox); + static_cast<TQCheckListItem *>(item)->setState(state==Checked ? TQCheckListItem::On : TQCheckListItem::Off); } item->setPixmap(_column, icon); item->setSelectable(state==Normal); // append instead of prepend - QListViewItem *litem=firstChild(); + TQListViewItem *litem=firstChild(); while ( litem && litem->nextSibling() ) litem = litem->nextSibling(); if (litem) item->moveItem(litem); (*_ids)[item] = id; } -int ListViewItemContainer::id(const QListViewItem *item) const +int ListViewItemContainer::id(const TQListViewItem *item) const { - return (_ids->contains(item) ? int((*_ids)[item]) : -1); + return (_ids->tqcontains(item) ? int((*_ids)[item]) : -1); } diff --git a/src/common/gui/list_container.h b/src/common/gui/list_container.h index b70db57..138b9ea 100644 --- a/src/common/gui/list_container.h +++ b/src/common/gui/list_container.h @@ -17,39 +17,40 @@ class ListContainer { public: virtual ~ListContainer() {} - virtual ListContainer *appendBranch(const QString &title) = 0; + virtual ListContainer *appendBranch(const TQString &title) = 0; enum ItemState { Normal, Checked, UnChecked, Disabled }; - void appendItem(const QString &label, uint id, ItemState state) { appendItem(QPixmap(), label, id, state); } - virtual void appendItem(const QPixmap &icon, const QString &label, uint id, ItemState state) = 0; + void appendItem(const TQString &label, uint id, ItemState state) { appendItem(TQPixmap(), label, id, state); } + virtual void appendItem(const TQPixmap &icon, const TQString &label, uint id, ItemState state) = 0; }; //---------------------------------------------------------------------------- class PopupContainer : public KPopupMenu, public ListContainer { Q_OBJECT + TQ_OBJECT public: - PopupContainer(const QString &title, QWidget *parent = 0, const char *name = 0); - virtual ListContainer *appendBranch(const QString &title); - virtual ListContainer *appendBranch(const QPixmap &icon, const QString &title); - virtual void appendItem(const QPixmap &icon, const QString &label, uint id, ItemState state); + PopupContainer(const TQString &title, TQWidget *tqparent = 0, const char *name = 0); + virtual ListContainer *appendBranch(const TQString &title); + virtual ListContainer *appendBranch(const TQPixmap &icon, const TQString &title); + virtual void appendItem(const TQPixmap &icon, const TQString &label, uint id, ItemState state); }; //---------------------------------------------------------------------------- class ListViewItemContainer : public KListViewItem, public ListContainer { public: - ListViewItemContainer(const QString &title, KListView *parent); - ListViewItemContainer(const QString &title, ListViewItemContainer *parent); + ListViewItemContainer(const TQString &title, KListView *tqparent); + ListViewItemContainer(const TQString &title, ListViewItemContainer *tqparent); virtual ~ListViewItemContainer(); void setColumn(uint column) { _column = column; } - virtual ListContainer *appendBranch(const QString &title); - virtual void appendItem(const QPixmap &icon, const QString &label, uint id, ItemState state); - int id(const QListViewItem* item) const; // -1 if not known + virtual ListContainer *appendBranch(const TQString &title); + virtual void appendItem(const TQPixmap &icon, const TQString &label, uint id, ItemState state); + int id(const TQListViewItem* item) const; // -1 if not known private: ListViewItemContainer *_parent; uint _column; - QMap<const QListViewItem *, uint> *_ids; + TQMap<const TQListViewItem *, uint> *_ids; }; #endif diff --git a/src/common/gui/list_view.cpp b/src/common/gui/list_view.cpp index c9434f3..4d5ac14 100644 --- a/src/common/gui/list_view.cpp +++ b/src/common/gui/list_view.cpp @@ -9,18 +9,18 @@ ***************************************************************************/ #include "list_view.h" -#include <qapplication.h> -#include <qpainter.h> -#include <qlineedit.h> -#include <qheader.h> -#include <qmetaobject.h> -#include <qvariant.h> +#include <tqapplication.h> +#include <tqpainter.h> +#include <tqlineedit.h> +#include <tqheader.h> +#include <tqmetaobject.h> +#include <tqvariant.h> //---------------------------------------------------------------------------- -ListView::ListView(QWidget *parent, const char *name) - : KListView(parent, name) +ListView::ListView(TQWidget *tqparent, const char *name) + : KListView(tqparent, name) { - QToolTip::remove(this); + TQToolTip::remove(this); _tooltip = new ListViewToolTip(this); } @@ -29,9 +29,9 @@ ListView::~ListView() delete _tooltip; } -QString ListView::tooltip(const QListViewItem &, int) const +TQString ListView::tooltip(const TQListViewItem &, int) const { - return QString::null; + return TQString(); } void ListView::clear() @@ -40,16 +40,16 @@ void ListView::clear() KListView::clear(); } -bool ListView::eventFilter(QObject *o, QEvent *e) +bool ListView::eventFilter(TQObject *o, TQEvent *e) { - QValueList<EditListViewItem *>::const_iterator it; + TQValueList<EditListViewItem *>::const_iterator it; for (it=_editItems.begin(); it!=_editItems.end(); ++it) { for (uint i=0; i<(*it)->_editWidgets.count(); i++) { - if ( (*it)->_editWidgets[i]==o ) { + if ( TQT_BASE_OBJECT((*it)->_editWidgets[i])==TQT_BASE_OBJECT(o) ) { //qDebug("event %i", e->type()); switch (e->type()) { - case QEvent::KeyPress: { - QKeyEvent *ke = static_cast<QKeyEvent *>(e); + case TQEvent::KeyPress: { + TQKeyEvent *ke = TQT_TQKEYEVENT(e); switch (ke->key()) { case Key_Enter: case Key_Return: @@ -61,12 +61,12 @@ bool ListView::eventFilter(QObject *o, QEvent *e) } break; } - case QEvent::FocusOut: { - //qDebug("focus out %i %i=%i", qApp->focusWidget(), focusWidget(), (*it)->_editWidgets[i]); - if ( qApp->focusWidget() && focusWidget()==(*it)->_editWidgets[i] ) break; + case TQEvent::FocusOut: { + //qDebug("focus out %i %i=%i", tqApp->tqfocusWidget(), tqfocusWidget(), (*it)->_editWidgets[i]); + if ( tqApp->tqfocusWidget() && tqfocusWidget()==(*it)->_editWidgets[i] ) break; //qDebug("ext"); - QCustomEvent *e = new QCustomEvent(9999); - QApplication::postEvent(o, e); + TQCustomEvent *e = new TQCustomEvent(9999); + TQApplication::postEvent(o, e); return true; } case 9999: @@ -84,21 +84,21 @@ bool ListView::eventFilter(QObject *o, QEvent *e) void ListView::stopRenaming(bool force) { - QValueList<EditListViewItem *>::const_iterator it; + TQValueList<EditListViewItem *>::const_iterator it; for (it=_editItems.begin(); it!=_editItems.end(); ++it) if ( (*it)->isRenaming() ) (*it)->renameDone(force); } //---------------------------------------------------------------------------- -void ListViewToolTip::maybeTip(const QPoint &p) +void ListViewToolTip::maybeTip(const TQPoint &p) { if ( _listView==0 ) return; - const QListViewItem* item = _listView->itemAt(p); + const TQListViewItem* item = _listView->itemAt(p); if ( item==0 ) return; - QRect rect = _listView->itemRect(item); + TQRect rect = _listView->tqitemRect(item); if ( !rect.isValid() ) return; int col = _listView->header()->sectionAt(p.x()); - QString text = _listView->tooltip(*item, col); + TQString text = _listView->tooltip(*item, col); if ( !text.isEmpty() ) { int hpos = _listView->header()->sectionPos(col); rect.setLeft(hpos); @@ -128,17 +128,17 @@ EditListViewItem::~EditListViewItem() for (uint i=0; i<_editWidgets.count(); i++) delete _editWidgets[i]; } -void EditListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int align) +void EditListViewItem::paintCell(TQPainter *p, const TQColorGroup &cg, int column, int width, int align) { if ( column<int(_editWidgets.count()) && _editWidgets[column] ) - p->fillRect(0, 0, width, height(), cg.color(QColorGroup::Background)); + p->fillRect(0, 0, width, height(), cg.color(TQColorGroup::Background)); else KListViewItem::paintCell(p, cg, column, width, align); } void EditListViewItem::startRename() { if ( !renameEnabled(0) ) return; - QListView *lv = listView(); + TQListView *lv = listView(); if ( !lv ) return; KListViewItem::startRename(0); if (renameBox) { @@ -149,8 +149,8 @@ void EditListViewItem::startRename() _renaming = true; _editWidgets.resize(lv->columns()); for (uint i=0; i<_editWidgets.count(); i++) { - QRect r = lv->itemRect(this); - r = QRect(lv->viewportToContents(r.topLeft()), r.size()); + TQRect r = lv->tqitemRect(this); + r = TQRect(lv->viewportToContents(r.topLeft()), r.size()); r.setLeft(lv->header()->sectionPos(i)); r.setWidth(lv->header()->sectionSize(i) - 1); if ( i==0 ) r.setLeft(r.left() + lv->itemMargin() + (depth() + (lv->rootIsDecorated() ? 1 : 0)) * lv->treeStepSize() - 1); @@ -162,7 +162,7 @@ void EditListViewItem::startRename() if ( _editWidgets[i]==0 ) continue; _editWidgets[i]->installEventFilter(lv); lv->addChild(_editWidgets[i], r.x(), r.y()); - uint w = QMIN(r.width(), _editWidgets[i]->sizeHint().width()); + uint w = TQMIN(r.width(), _editWidgets[i]->tqsizeHint().width()); _editWidgets[i]->resize(w, r.height()); lv->viewport()->setFocusProxy(_editWidgets[i]); _editWidgets[i]->setFocus(); @@ -172,7 +172,7 @@ void EditListViewItem::startRename() void EditListViewItem::removeEditBox() { - QListView *lv = listView(); + TQListView *lv = listView(); if ( !lv ) return; _renaming = false; bool resetFocus = false; @@ -189,17 +189,17 @@ void EditListViewItem::removeEditBox() } } -void EditListViewItem::editDone(int col, const QWidget *edit) +void EditListViewItem::editDone(int col, const TQWidget *edit) { - if ( edit->metaObject()->findProperty("text", true)!=-1 ) + if ( edit->tqmetaObject()->tqfindProperty("text", true)!=-1 ) emit listView()->itemRenamed(this, col, edit->property("text").toString()); - else if ( edit->metaObject()->findProperty("currentText", true)!=-1 ) + else if ( edit->tqmetaObject()->tqfindProperty("currentText", true)!=-1 ) emit listView()->itemRenamed(this, col, edit->property("currentText").toString()); } void EditListViewItem::renameDone(bool force) { - QListView *lv = listView(); + TQListView *lv = listView(); if ( !lv || !_renaming ) return; _renaming = false; for (uint i=0; i<_editWidgets.count(); i++) { @@ -210,12 +210,12 @@ void EditListViewItem::renameDone(bool force) removeEditBox(); } -int EditListViewItem::width(const QFontMetrics &fm, const QListView *lv, int col) const +int EditListViewItem::width(const TQFontMetrics &fm, const TQListView *lv, int col) const { int w = KListViewItem::width(fm, lv, col); - QWidget *edit = editWidgetFactory(col); + TQWidget *edit = editWidgetFactory(col); if ( edit==0 ) return w; - w = QMAX(w, edit->sizeHint().width()); + w = TQMAX(w, edit->tqsizeHint().width()); delete edit; return w; } diff --git a/src/common/gui/list_view.h b/src/common/gui/list_view.h index 09ca984..c76ef46 100644 --- a/src/common/gui/list_view.h +++ b/src/common/gui/list_view.h @@ -9,8 +9,8 @@ #ifndef LIST_VIEW_H #define LIST_VIEW_H -#include <qtooltip.h> -#include <qvaluevector.h> +#include <tqtooltip.h> +#include <tqvaluevector.h> #define private public #define protected public #include <klistview.h> @@ -24,36 +24,37 @@ class ListViewToolTip; class ListView : public KListView { Q_OBJECT + TQ_OBJECT public: - ListView(QWidget *parent = 0, const char *name = 0); + ListView(TQWidget *tqparent = 0, const char *name = 0); virtual ~ListView(); virtual void clear(); void stopRenaming(bool force); - virtual QString tooltip(const QListViewItem &item, int column) const; + virtual TQString tooltip(const TQListViewItem &item, int column) const; public slots: void cancelRenaming() { stopRenaming(false); } void finishRenaming() { stopRenaming(true); } protected: - virtual bool eventFilter(QObject *o, QEvent *e); + virtual bool eventFilter(TQObject *o, TQEvent *e); private: ListViewToolTip *_tooltip; - QValueList<EditListViewItem *> _editItems; + TQValueList<EditListViewItem *> _editItems; friend class EditListViewItem; }; //----------------------------------------------------------------------------- -class ListViewToolTip : public QToolTip +class ListViewToolTip : public TQToolTip { public: - ListViewToolTip(ListView *parent) - : QToolTip(parent->viewport()), _listView(parent) {} + ListViewToolTip(ListView *tqparent) + : TQToolTip(tqparent->viewport()), _listView(tqparent) {} protected: - virtual void maybeTip(const QPoint &p); + virtual void maybeTip(const TQPoint &p); private: ListView *_listView; @@ -70,15 +71,15 @@ public: bool isRenaming() const { return _renaming; } protected: - virtual QWidget *editWidgetFactory(int col) const = 0; + virtual TQWidget *editWidgetFactory(int col) const = 0; virtual bool alwaysAcceptEdit(int col) const = 0; - virtual int width(const QFontMetrics &fm, const QListView *lv, int c) const; - virtual void editDone(int col, const QWidget *editWidget); - virtual void paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int align); + virtual int width(const TQFontMetrics &fm, const TQListView *lv, int c) const; + virtual void editDone(int col, const TQWidget *editWidget); + virtual void paintCell(TQPainter *p, const TQColorGroup &cg, int column, int width, int align); private: bool _renaming; - QValueVector<QWidget *> _editWidgets; + TQValueVector<TQWidget *> _editWidgets; virtual void activate() { startRename(); } virtual void startRename(int) { startRename(); } diff --git a/src/common/gui/misc_gui.cpp b/src/common/gui/misc_gui.cpp index 00f4997..fadf7a9 100644 --- a/src/common/gui/misc_gui.cpp +++ b/src/common/gui/misc_gui.cpp @@ -8,16 +8,16 @@ ***************************************************************************/ #include "misc_gui.h" -#include <qapplication.h> -#include <qpushbutton.h> -#include <qtimer.h> -#include <qwidgetstack.h> -#include <qobjectlist.h> -#include <qpainter.h> -#include <qheader.h> -#include <qmetaobject.h> -#include <qvariant.h> -#include <qpopupmenu.h> +#include <tqapplication.h> +#include <tqpushbutton.h> +#include <tqtimer.h> +#include <tqwidgetstack.h> +#include <tqobjectlist.h> +#include <tqpainter.h> +#include <tqheader.h> +#include <tqmetaobject.h> +#include <tqvariant.h> +#include <tqpopupmenu.h> #include <kcursor.h> #include <kiconloader.h> @@ -31,92 +31,92 @@ #include "common/gui/number_gui.h" //----------------------------------------------------------------------------- -bool BusyCursor::_overridePaused = false; +bool PBusyCursor::_overridePaused = false; -void BusyCursor::start() +void PBusyCursor::start() { - QApplication::setOverrideCursor(KCursor::waitCursor(), true); + TQApplication::setOverrideCursor(KCursor::waitCursor(), true); } -void BusyCursor::stop() +void PBusyCursor::stop() { - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); } -void BusyCursor::pause() +void PBusyCursor::pause() { - _overridePaused = QApplication::overrideCursor(); + _overridePaused = TQApplication::overrideCursor(); stop(); } -void BusyCursor::restore() +void PBusyCursor::restore() { if (_overridePaused) start(); } //----------------------------------------------------------------------------- -void MessageBox::information(const QString &text, Log::ShowMode show, const QString &dontShowAgainName) +void MessageBox::information(const TQString &text, Log::ShowMode show, const TQString &dontShowAgainName) { if ( show==Log::DontShow ) return; - BusyCursor::pause(); - KMessageBox::information(qApp->mainWidget(), text, QString::null, dontShowAgainName, KMessageBox::Notify | KMessageBox::AllowLink); - BusyCursor::restore(); + PBusyCursor::pause(); + KMessageBox::information(tqApp->mainWidget(), text, TQString(), dontShowAgainName, KMessageBox::Notify | KMessageBox::AllowLink); + PBusyCursor::restore(); } -void MessageBox::detailedSorry(const QString &text, const QString &details, Log::ShowMode show) +void MessageBox::detailedSorry(const TQString &text, const TQString &details, Log::ShowMode show) { if ( show==Log::DontShow ) return; - BusyCursor::pause(); - if ( details.isEmpty() ) KMessageBox::sorry(qApp->mainWidget(), text, QString::null, KMessageBox::Notify | KMessageBox::AllowLink); - else KMessageBox::detailedSorry(qApp->mainWidget(), text, details, QString::null, KMessageBox::Notify | KMessageBox::AllowLink); - BusyCursor::restore(); + PBusyCursor::pause(); + if ( details.isEmpty() ) KMessageBox::sorry(tqApp->mainWidget(), text, TQString(), KMessageBox::Notify | KMessageBox::AllowLink); + else KMessageBox::detailedSorry(tqApp->mainWidget(), text, details, TQString(), KMessageBox::Notify | KMessageBox::AllowLink); + PBusyCursor::restore(); } -bool MessageBox::askContinue(const QString &text, const KGuiItem &buttonContinue, const QString &caption) +bool MessageBox::askContinue(const TQString &text, const KGuiItem &buttonContinue, const TQString &caption) { - ::BusyCursor::pause(); - int res = KMessageBox::warningContinueCancel(qApp->mainWidget(), text, caption, buttonContinue); - ::BusyCursor::restore(); + ::PBusyCursor::pause(); + int res = KMessageBox::warningContinueCancel(tqApp->mainWidget(), text, caption, buttonContinue); + ::PBusyCursor::restore(); return ( res==KMessageBox::Continue ); } -bool MessageBox::questionYesNo(const QString &text, const KGuiItem &yesButton,const KGuiItem &noButton, const QString &caption) +bool MessageBox::questionYesNo(const TQString &text, const KGuiItem &yesButton,const KGuiItem &noButton, const TQString &caption) { - ::BusyCursor::pause(); - int res = KMessageBox::questionYesNo(qApp->mainWidget(), text, caption, yesButton, noButton); - ::BusyCursor::restore(); + ::PBusyCursor::pause(); + int res = KMessageBox::questionYesNo(tqApp->mainWidget(), text, caption, yesButton, noButton); + ::PBusyCursor::restore(); return ( res==KMessageBox::Yes ); } -MessageBox::Result MessageBox::questionYesNoCancel(const QString &text, const KGuiItem &yesButton, const KGuiItem &noButton, - const QString &caption) +MessageBox::Result MessageBox::questionYesNoCancel(const TQString &text, const KGuiItem &yesButton, const KGuiItem &noButton, + const TQString &caption) { - ::BusyCursor::pause(); - int res = KMessageBox::questionYesNoCancel(qApp->mainWidget(), text, caption, yesButton, noButton); - ::BusyCursor::restore(); + ::PBusyCursor::pause(); + int res = KMessageBox::questionYesNoCancel(tqApp->mainWidget(), text, caption, yesButton, noButton); + ::PBusyCursor::restore(); if ( res==KMessageBox::Yes ) return Yes; if ( res==KMessageBox::No ) return No; return Cancel; } -void MessageBox::text(const QString &text, Log::ShowMode show) +void MessageBox::text(const TQString &text, Log::ShowMode show) { if ( show==Log::DontShow ) return; - BusyCursor::pause(); - TextEditorDialog dialog(text, QString::null, false, qApp->mainWidget()); + PBusyCursor::pause(); + TextEditorDialog dialog(text, TQString(), false, tqApp->mainWidget()); dialog.exec(); - BusyCursor::restore(); + PBusyCursor::restore(); } //---------------------------------------------------------------------------- -PopupButton::PopupButton(QWidget *parent, const char *name) - : KPushButton(parent, name) +PopupButton::PopupButton(TQWidget *tqparent, const char *name) + : KPushButton(tqparent, name) { init(); } -PopupButton::PopupButton(const QString &text, QWidget *parent, const char *name) - : KPushButton(text, parent, name) +PopupButton::PopupButton(const TQString &text, TQWidget *tqparent, const char *name) + : KPushButton(text, tqparent, name) { init(); } @@ -125,8 +125,8 @@ void PopupButton::init() { _separator = false; setFlat(true); - QPopupMenu *popup = new QPopupMenu(this); - connect(popup, SIGNAL(activated(int)), SIGNAL(activated(int))); + TQPopupMenu *popup = new TQPopupMenu(this); + connect(popup, TQT_SIGNAL(activated(int)), TQT_SIGNAL(activated(int))); setPopup(popup); } @@ -137,20 +137,20 @@ void PopupButton::appendAction(KAction *action) action->plug(popup()); } -void PopupButton::appendAction(const QString &label, const QString &icon, - QObject *receiver, const char *slot) +void PopupButton::appendAction(const TQString &label, const TQString &icon, + TQObject *receiver, const char *slot) { appendAction(new KAction(label, icon, 0, receiver, slot, (KActionCollection *)0)); } -int PopupButton::appendItem(const QString &label, const QString &icon, int id) +int PopupButton::appendItem(const TQString &label, const TQString &icon, int id) { KIconLoader loader; - QPixmap pixmap = loader.loadIcon(icon, KIcon::Small); + TQPixmap pixmap = loader.loadIcon(icon, KIcon::Small); return appendItem(label, pixmap, id); } -int PopupButton::appendItem(const QString &label, const QPixmap &icon, int id) +int PopupButton::appendItem(const TQString &label, const TQPixmap &icon, int id) { if ( _separator && popup()->count()!=0 ) popup()->insertSeparator(); _separator = false; @@ -158,41 +158,41 @@ int PopupButton::appendItem(const QString &label, const QPixmap &icon, int id) } //----------------------------------------------------------------------------- -Splitter::Splitter(const QValueList<int> &defaultSizes, Orientation o, QWidget *parent, const char *name) - : QSplitter(o, parent, name), _defaultSizes(defaultSizes) +Splitter::Splitter(const TQValueList<int> &defaultSizes, Qt::Orientation o, TQWidget *tqparent, const char *name) + : TQSplitter(o, tqparent, name), _defaultSizes(defaultSizes) { Q_ASSERT(name); setOpaqueResize(true); - QTimer::singleShot(0, this, SLOT(updateSizes())); + TQTimer::singleShot(0, this, TQT_SLOT(updateSizes())); } Splitter::~Splitter() { GuiConfig gc; - gc.writeEntry(QString(name()) + "_sizes", sizes()); + gc.writeEntry(TQString(name()) + "_sizes", sizes()); } void Splitter::updateSizes() { GuiConfig gc; - QValueList<int> sizes = gc.readIntListEntry(QString(name()) + "_sizes"); + TQValueList<int> sizes = gc.readIntListEntry(TQString(name()) + "_sizes"); for (uint i=sizes.count(); i<_defaultSizes.count(); i++) sizes.append(_defaultSizes[i]); setSizes(sizes); } //----------------------------------------------------------------------------- -TabBar::TabBar(QWidget *parent, const char *name) - : KTabBar(parent, name), _ignoreWheelEvent(false) +TabBar::TabBar(TQWidget *tqparent, const char *name) + : KTabBar(tqparent, name), _ignoreWheelEvent(false) {} -void TabBar::wheelEvent(QWheelEvent *e) +void TabBar::wheelEvent(TQWheelEvent *e) { - if (_ignoreWheelEvent) QApplication::sendEvent(parent(), e); // #### not sure why ignoring is not enough... + if (_ignoreWheelEvent) TQApplication::sendEvent(tqparent(), e); // #### not sure why ignoring is not enough... else KTabBar::wheelEvent(e); } -TabWidget::TabWidget(QWidget *parent, const char *name) - : KTabWidget(parent, name) +TabWidget::TabWidget(TQWidget *tqparent, const char *name) + : KTabWidget(tqparent, name) { setTabBar(new TabBar(this)); } @@ -202,7 +202,7 @@ void TabWidget::setIgnoreWheelEvent(bool ignore) static_cast<TabBar *>(tabBar())->_ignoreWheelEvent = ignore; } -void TabWidget::wheelEvent(QWheelEvent *e) +void TabWidget::wheelEvent(TQWheelEvent *e) { if (static_cast<TabBar *>(tabBar())->_ignoreWheelEvent) e->ignore(); else KTabWidget::wheelEvent(e); @@ -211,24 +211,24 @@ void TabWidget::wheelEvent(QWheelEvent *e) void TabWidget::setTabBar(TabBar *tabbar) { KTabWidget::setTabBar(tabbar); - connect(tabBar(), SIGNAL(contextMenu( int, const QPoint & )), SLOT(contextMenu( int, const QPoint & ))); - connect(tabBar(), SIGNAL(mouseDoubleClick( int )), SLOT(mouseDoubleClick( int ))); - connect(tabBar(), SIGNAL(mouseMiddleClick( int )), SLOT(mouseMiddleClick( int ))); - connect(tabBar(), SIGNAL(initiateDrag( int )), SLOT(initiateDrag( int ))); - connect(tabBar(), SIGNAL(testCanDecode(const QDragMoveEvent *, bool & )), SIGNAL(testCanDecode(const QDragMoveEvent *, bool & ))); - connect(tabBar(), SIGNAL(receivedDropEvent( int, QDropEvent * )), SLOT(receivedDropEvent( int, QDropEvent * ))); - connect(tabBar(), SIGNAL(moveTab( int, int )), SLOT(moveTab( int, int ))); - connect(tabBar(), SIGNAL(closeRequest( int )), SLOT(closeRequest( int ))); - connect(tabBar(), SIGNAL(wheelDelta( int )), SLOT(wheelDelta( int ))); + connect(tabBar(), TQT_SIGNAL(contextMenu( int, const TQPoint & )), TQT_SLOT(contextMenu( int, const TQPoint & ))); + connect(tabBar(), TQT_SIGNAL(mouseDoubleClick( int )), TQT_SLOT(mouseDoubleClick( int ))); + connect(tabBar(), TQT_SIGNAL(mouseMiddleClick( int )), TQT_SLOT(mouseMiddleClick( int ))); + connect(tabBar(), TQT_SIGNAL(initiateDrag( int )), TQT_SLOT(initiateDrag( int ))); + connect(tabBar(), TQT_SIGNAL(testCanDecode(const TQDragMoveEvent *, bool & )), TQT_SIGNAL(testCanDecode(const TQDragMoveEvent *, bool & ))); + connect(tabBar(), TQT_SIGNAL(receivedDropEvent( int, TQDropEvent * )), TQT_SLOT(receivedDropEvent( int, TQDropEvent * ))); + connect(tabBar(), TQT_SIGNAL(moveTab( int, int )), TQT_SLOT(moveTab( int, int ))); + connect(tabBar(), TQT_SIGNAL(closeRequest( int )), TQT_SLOT(closeRequest( int ))); + connect(tabBar(), TQT_SIGNAL(wheelDelta( int )), TQT_SLOT(wheelDelta( int ))); } //----------------------------------------------------------------------------- -ComboBox::ComboBox(QWidget *parent, const char *name) - : QComboBox(parent, name), _ignoreWheelEvent(false) +ComboBox::ComboBox(TQWidget *tqparent, const char *name) + : TQComboBox(tqparent, name), _ignoreWheelEvent(false) {} -void ComboBox::wheelEvent(QWheelEvent *e) +void ComboBox::wheelEvent(TQWheelEvent *e) { - if (_ignoreWheelEvent) QApplication::sendEvent(parent(), e); // #### not sure why ignoring is not enough... - else QComboBox::wheelEvent(e); + if (_ignoreWheelEvent) TQApplication::sendEvent(tqparent(), e); // #### not sure why ignoring is not enough... + else TQComboBox::wheelEvent(e); } diff --git a/src/common/gui/misc_gui.h b/src/common/gui/misc_gui.h index 2d58569..7003f91 100644 --- a/src/common/gui/misc_gui.h +++ b/src/common/gui/misc_gui.h @@ -9,12 +9,12 @@ #ifndef MISC_GUI_H #define MISC_GUI_H -#include <qlayout.h> -#include <qsplitter.h> -#include <qvaluevector.h> -#include <qvalidator.h> -#include <qcombobox.h> -#include <qwidgetstack.h> +#include <tqlayout.h> +#include <tqsplitter.h> +#include <tqvaluevector.h> +#include <tqvalidator.h> +#include <tqcombobox.h> +#include <tqwidgetstack.h> #include <klocale.h> #include <kpushbutton.h> @@ -29,11 +29,11 @@ class KAction; #include "common/common/number.h" //----------------------------------------------------------------------------- -class BusyCursor +class PBusyCursor { public: - BusyCursor() { start(); } - ~BusyCursor() { stop(); } + PBusyCursor() { start(); } + ~PBusyCursor() { stop(); } static void start(); static void stop(); static void pause(); @@ -46,32 +46,33 @@ private: //----------------------------------------------------------------------------- namespace MessageBox { -extern void information(const QString &text, Log::ShowMode show, const QString &dontShowAgainName = QString::null); -extern void detailedSorry(const QString &text, const QString &details, Log::ShowMode show); -inline void sorry(const QString &text, Log::ShowMode show) { detailedSorry(text, QString::null, show); } -extern bool askContinue(const QString &text, const KGuiItem &continueButton = KStdGuiItem::cont(), - const QString &caption = i18n("Warning")); -extern bool questionYesNo(const QString &text, const KGuiItem &yesButton, const KGuiItem &noButton, - const QString &caption = i18n("Warning")); +extern void information(const TQString &text, Log::ShowMode show, const TQString &dontShowAgainName = TQString()); +extern void detailedSorry(const TQString &text, const TQString &details, Log::ShowMode show); +inline void sorry(const TQString &text, Log::ShowMode show) { detailedSorry(text, TQString(), show); } +extern bool askContinue(const TQString &text, const KGuiItem &continueButton = KStdGuiItem::cont(), + const TQString &caption = i18n("Warning")); +extern bool questionYesNo(const TQString &text, const KGuiItem &yesButton, const KGuiItem &noButton, + const TQString &caption = i18n("Warning")); enum Result { Yes, No, Cancel }; -extern Result questionYesNoCancel(const QString &text, const KGuiItem &yesButton, const KGuiItem &noButton, - const QString &caption = i18n("Warning")); -extern void text(const QString &text, Log::ShowMode show); +extern Result questionYesNoCancel(const TQString &text, const KGuiItem &yesButton, const KGuiItem &noButton, + const TQString &caption = i18n("Warning")); +extern void text(const TQString &text, Log::ShowMode show); } //---------------------------------------------------------------------------- class PopupButton : public KPushButton { Q_OBJECT + TQ_OBJECT public: - PopupButton(QWidget *parent = 0, const char *name = 0); - PopupButton(const QString &text, QWidget *parent = 0, const char *name = 0); + PopupButton(TQWidget *tqparent = 0, const char *name = 0); + PopupButton(const TQString &text, TQWidget *tqparent = 0, const char *name = 0); void appendAction(KAction *action); - void appendAction(const QString &label, const QString &icon = QString::null, - QObject *receiver = 0, const char *slot = 0); - int appendItem(const QString &label, uint id) { return appendItem(label, QPixmap(), id); } - int appendItem(const QString &label, const QString &icon, int id = -1); - int appendItem(const QString &label, const QPixmap &icon, int id = -1); + void appendAction(const TQString &label, const TQString &icon = TQString(), + TQObject *receiver = 0, const char *slot = 0); + int appendItem(const TQString &label, uint id) { return appendItem(label, TQPixmap(), id); } + int appendItem(const TQString &label, const TQString &icon, int id = -1); + int appendItem(const TQString &label, const TQPixmap &icon, int id = -1); void appendSeparator() { _separator = true; } signals: @@ -84,19 +85,20 @@ private: }; //----------------------------------------------------------------------------- -class Splitter : public QSplitter +class Splitter : public TQSplitter { Q_OBJECT + TQ_OBJECT public: - Splitter(const QValueList<int> &defaultSizes, Orientation orientation, - QWidget *parent, const char *name); + Splitter(const TQValueList<int> &defaultSizes, Qt::Orientation orientation, + TQWidget *tqparent, const char *name); virtual ~Splitter(); private slots: void updateSizes(); private: - QValueList<int> _defaultSizes; + TQValueList<int> _defaultSizes; }; //----------------------------------------------------------------------------- @@ -107,12 +109,13 @@ public: }; //----------------------------------------------------------------------------- -class SeparatorWidget : public QFrame +class SeparatorWidget : public TQFrame { Q_OBJECT + TQ_OBJECT public: - SeparatorWidget(QWidget *parent) : QFrame(parent, "separator") { - setFrameStyle(QFrame::Panel | QFrame::Sunken); + SeparatorWidget(TQWidget *tqparent) : TQFrame(tqparent, "separator") { + setFrameStyle(TQFrame::Panel | TQFrame::Sunken); setMargin(2); setFixedHeight(2*2); } @@ -122,11 +125,12 @@ public: class TabBar : public KTabBar { Q_OBJECT + TQ_OBJECT public: - TabBar(QWidget *parent = 0, const char *name = 0); + TabBar(TQWidget *tqparent = 0, const char *name = 0); protected: - virtual void wheelEvent(QWheelEvent *e); + virtual void wheelEvent(TQWheelEvent *e); private: bool _ignoreWheelEvent; @@ -137,25 +141,27 @@ private: class TabWidget : public KTabWidget { Q_OBJECT + TQ_OBJECT public: - TabWidget(QWidget *parent = 0, const char *name = 0); + TabWidget(TQWidget *tqparent = 0, const char *name = 0); void setIgnoreWheelEvent(bool ignore); protected: - virtual void wheelEvent(QWheelEvent *e); + virtual void wheelEvent(TQWheelEvent *e); void setTabBar(TabBar *tabbar); }; //----------------------------------------------------------------------------- -class ComboBox : public QComboBox +class ComboBox : public TQComboBox { Q_OBJECT + TQ_OBJECT public: - ComboBox(QWidget *parent = 0, const char *name = 0); + ComboBox(TQWidget *tqparent = 0, const char *name = 0); void setIgnoreWheelEvent(bool ignore) { _ignoreWheelEvent = ignore; } protected: - virtual void wheelEvent(QWheelEvent *e); + virtual void wheelEvent(TQWheelEvent *e); private: bool _ignoreWheelEvent; diff --git a/src/common/gui/number_gui.cpp b/src/common/gui/number_gui.cpp index d855407..1a84a36 100644 --- a/src/common/gui/number_gui.cpp +++ b/src/common/gui/number_gui.cpp @@ -8,65 +8,65 @@ ***************************************************************************/ #include "number_gui.h" -#include <qfontmetrics.h> +#include <tqfontmetrics.h> //----------------------------------------------------------------------------- -uint maxCharWidth(const QString &s, const QFont &font) +uint maxCharWidth(const TQString &s, const TQFont &font) { - QFontMetrics fm(font); + TQFontMetrics fm(font); uint w = 0; for (uint i=0; i<uint(s.length()); i++) - w = QMAX(w, uint(fm.width(s[i]))); + w = TQMAX(w, uint(fm.width(s[i]))); return w; } -uint maxCharWidth(NumberBase base, const QFont &font) +uint maxCharWidth(NumberBase base, const TQFont &font) { - QString s; + TQString s; for (uint i=0; i<base.data().base; i++) s += toChar(base, i); return maxCharWidth(s, font); } -uint maxLabelWidth(NumberBase base, uint nbChars, const QFont &font) +uint maxLabelWidth(NumberBase base, uint nbChars, const TQFont &font) { uint w = maxStringWidth(base, nbChars, font); - QFontMetrics fm(font); + TQFontMetrics fm(font); if ( base==NumberBase::String ) return w + 2 * fm.width("\""); return w + fm.width(base.data().prefix); } //----------------------------------------------------------------------------- -NumberLineEdit::NumberLineEdit(QWidget *parent, const char *name) - : KLineEdit(parent, name) +NumberLineEdit::NumberLineEdit(TQWidget *tqparent, const char *name) + : KLineEdit(tqparent, name) { - connect(this, SIGNAL(textChanged(const QString &)), SLOT(textChangedSlot())); + connect(this, TQT_SIGNAL(textChanged(const TQString &)), TQT_SLOT(textChangedSlot())); } -NumberLineEdit::NumberLineEdit(const QString &text, QWidget *parent, const char *name) - : KLineEdit(text, parent, name) +NumberLineEdit::NumberLineEdit(const TQString &text, TQWidget *tqparent, const char *name) + : KLineEdit(text, tqparent, name) { - connect(this, SIGNAL(textChanged(const QString &)), SLOT(textChangedSlot())); + connect(this, TQT_SIGNAL(textChanged(const TQString &)), TQT_SLOT(textChangedSlot())); } -QValidator::State validateNumber(const QString &input) +TQValidator::State validateNumber(const TQString &input) { - if ( input.isEmpty() ) return QValidator::Intermediate; + if ( input.isEmpty() ) return TQValidator::Intermediate; bool ok; (void)fromAnyLabel(input, &ok); - if (ok) return QValidator::Acceptable; + if (ok) return TQValidator::Acceptable; FOR_EACH(NumberBase, base) - if ( input==base.data().prefix ) return QValidator::Intermediate; - if ( input[0]=='\"' ) return QValidator::Intermediate; - if ( input[0]=='\'' ) return QValidator::Intermediate; - return QValidator::Invalid; + if ( input==base.data().prefix ) return TQValidator::Intermediate; + if ( input[0]=='\"' ) return TQValidator::Intermediate; + if ( input[0]=='\'' ) return TQValidator::Intermediate; + return TQValidator::Invalid; } void NumberLineEdit::textChangedSlot() { - QValidator::State state = validateNumber(text()); + TQValidator::State state = validateNumber(text()); switch (state) { - case QValidator::Acceptable: unsetColor(); break; - case QValidator::Intermediate: setColor(QColor("#FF9900")); break; - case QValidator::Invalid: setColor(red); break; + case TQValidator::Acceptable: unsetColor(); break; + case TQValidator::Intermediate: setColor(TQColor("#FF9900")); break; + case TQValidator::Invalid: setColor(red); break; } } diff --git a/src/common/gui/number_gui.h b/src/common/gui/number_gui.h index f910820..2b23d2b 100644 --- a/src/common/gui/number_gui.h +++ b/src/common/gui/number_gui.h @@ -9,28 +9,29 @@ #ifndef NUMBER_GUI_H #define NUMBER_GUI_H -#include <qvalidator.h> +#include <tqvalidator.h> #include <klineedit.h> #include "common/common/number.h" //----------------------------------------------------------------------------- -extern uint maxCharWidth(const QString &s, const QFont &font); -extern uint maxCharWidth(NumberBase base, const QFont &font); -inline uint maxStringWidth(NumberBase base, uint nbChars, const QFont &font) { return nbChars * maxCharWidth(base, font); } -extern uint maxLabelWidth(NumberBase base, uint nbChars, const QFont &font); +extern uint maxCharWidth(const TQString &s, const TQFont &font); +extern uint maxCharWidth(NumberBase base, const TQFont &font); +inline uint maxStringWidth(NumberBase base, uint nbChars, const TQFont &font) { return nbChars * maxCharWidth(base, font); } +extern uint maxLabelWidth(NumberBase base, uint nbChars, const TQFont &font); -extern QValidator::State validateNumber(const QString &s); +extern TQValidator::State validateNumber(const TQString &s); //----------------------------------------------------------------------------- class NumberLineEdit : public KLineEdit { Q_OBJECT + TQ_OBJECT public: - NumberLineEdit(QWidget *parent = 0, const char *name = 0); - NumberLineEdit(const QString &text, QWidget *parent = 0, const char *name = 0); + NumberLineEdit(TQWidget *tqparent = 0, const char *name = 0); + NumberLineEdit(const TQString &text, TQWidget *tqparent = 0, const char *name = 0); uint value(bool *ok = 0) const { return fromAnyLabel(text(), ok); } - void setColor(const QColor &color) { setPaletteForegroundColor(color); } + void setColor(const TQColor &color) { setPaletteForegroundColor(color); } void unsetColor() { unsetPalette(); } private slots: diff --git a/src/common/gui/pfile_ext.cpp b/src/common/gui/pfile_ext.cpp index d42de16..43f9e81 100644 --- a/src/common/gui/pfile_ext.cpp +++ b/src/common/gui/pfile_ext.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ #include "pfile_ext.h" -#include <qfile.h> +#include <tqfile.h> #include <kio/netaccess.h> #include <ktempfile.h> #include "common/gui/misc_gui.h" @@ -18,11 +18,11 @@ bool PURL::File::openForWrite() { close(); if (_tmp) delete _tmp; - _tmp = new KTempFile(QString::null, _extension); + _tmp = new KTempFile(TQString(), _extension); _tmp->setAutoDelete(true); if ( _tmp->status()!=0 ) { _error = i18n("Could not create temporary file."); - _log.sorry(_error, i18n("File: %1").arg(_tmp->name())); + _log.sorry(_error, i18n("File: %1").tqarg(_tmp->name())); return false; } return true; @@ -35,11 +35,11 @@ bool PURL::File::close() bool ok = (_tmp ? _tmp->status() : _file->status())==IO_Ok; if ( !_file->name().isEmpty() ) { KIO::NetAccess::removeTempFile(_file->name()); - _file->setName(QString::null); + _file->setName(TQString()); } delete _stream; _stream = 0; - if ( ok && _tmp && !_url.isEmpty() && !KIO::NetAccess::upload(_tmp->name(), _url.kurl(), qApp->mainWidget()) ) { + if ( ok && _tmp && !_url.isEmpty() && !KIO::NetAccess::upload(_tmp->name(), _url.kurl(), tqApp->mainWidget()) ) { _error = KIO::NetAccess::lastErrorString(); ok = false; _log.sorry(i18n("Could not save file."), errorString()); @@ -52,8 +52,8 @@ bool PURL::File::close() bool PURL::File::openForRead() { close(); - QString tmp; - if ( !KIO::NetAccess::download(_url.kurl(), tmp, qApp->mainWidget()) ) { + TQString tmp; + if ( !KIO::NetAccess::download(_url.kurl(), tmp, tqApp->mainWidget()) ) { _error = KIO::NetAccess::lastErrorString(); _log.sorry(i18n("Could not open file for reading."), errorString()); return false; @@ -61,7 +61,7 @@ bool PURL::File::openForRead() _file->setName(tmp); if ( !_file->open(IO_ReadOnly) ) { _error = i18n("Could not open temporary file."); - _log.sorry(_error, i18n("File: %1").arg(_file->name())); + _log.sorry(_error, i18n("File: %1").tqarg(_file->name())); return false; } return true; @@ -75,7 +75,7 @@ bool PURL::File::remove() } //----------------------------------------------------------------------------- -PURL::TempFile::TempFile(Log::Generic &log, const QString &extension) +PURL::TempFile::TempFile(Log::Generic &log, const TQString &extension) : FileBase(log, extension) {} @@ -92,7 +92,7 @@ bool PURL::TempFile::close() _tmp->close(); if ( _tmp->status()!=IO_Ok ) { _error = i18n("Could not write to temporary file."); - _log.sorry(_error, i18n("File: %1").arg(_tmp->name())); + _log.sorry(_error, i18n("File: %1").tqarg(_tmp->name())); return false; } } @@ -103,11 +103,11 @@ bool PURL::TempFile::openForWrite() { close(); if (_tmp) delete _tmp; - _tmp = new KTempFile(QString::null, _extension); + _tmp = new KTempFile(TQString(), _extension); _tmp->setAutoDelete(true); if ( _tmp->status()!=0 ) { _error = i18n("Could not create temporary file."); - _log.sorry(_error, i18n("File: %1").arg(_tmp->name())); + _log.sorry(_error, i18n("File: %1").tqarg(_tmp->name())); return false; } return true; diff --git a/src/common/gui/pfile_ext.h b/src/common/gui/pfile_ext.h index 14c007a..0158ee4 100644 --- a/src/common/gui/pfile_ext.h +++ b/src/common/gui/pfile_ext.h @@ -17,7 +17,7 @@ namespace PURL class TempFile : public FileBase { public: - TempFile(Log::Generic &log, const QString &extension = QString::null); + TempFile(Log::Generic &log, const TQString &extension = TQString()); ~TempFile() { close(); } Url url() const; bool close(); diff --git a/src/common/gui/purl_ext.cpp b/src/common/gui/purl_ext.cpp index 5d69d05..df657a7 100644 --- a/src/common/gui/purl_ext.cpp +++ b/src/common/gui/purl_ext.cpp @@ -8,8 +8,8 @@ ***************************************************************************/ #include "common/global/purl.h" -#include <qfile.h> -#include <qapplication.h> +#include <tqfile.h> +#include <tqapplication.h> #include <kio/netaccess.h> #include <kfileitem.h> #include <ktempfile.h> @@ -27,7 +27,7 @@ bool PURL::Url::copyTo(const Url &destination, Log::Generic &log) const // } //#else // do not overwrite - bool ok = KIO::NetAccess::file_copy(_url, destination._url, -1, false, false, qApp->mainWidget()); + bool ok = KIO::NetAccess::file_copy(_url, destination._url, -1, false, false, tqApp->mainWidget()); if ( !ok ) log.sorry(i18n("Could not copy file"), KIO::NetAccess::lastErrorString()); return ok; //#endif @@ -36,7 +36,7 @@ bool PURL::Url::copyTo(const Url &destination, Log::Generic &log) const bool PURL::Url::create(Log::Generic &log) const { //#if defined(NO_KDE) -// QByteArray a; +// TQByteArray a; // Synchronous sync; // if ( sync.op().put(a, _url.filepath()) && sync.execute() ) { // if ( show==Log::Show ) ConsoleView::sorry(i18n("Could not create file"), sync.error()); @@ -44,17 +44,17 @@ bool PURL::Url::create(Log::Generic &log) const // } //#else // assume file do no exist if ioslave cannot tell... - if ( KIO::NetAccess::exists(_url, false, qApp->mainWidget()) ) return true; + if ( KIO::NetAccess::exists(_url, false, tqApp->mainWidget()) ) return true; KTempFile tmp; tmp.setAutoDelete(true); // do not overwrite - bool ok = KIO::NetAccess::file_copy(tmp.name(), _url, -1, false, false, qApp->mainWidget()); + bool ok = KIO::NetAccess::file_copy(tmp.name(), _url, -1, false, false, tqApp->mainWidget()); if ( !ok ) log.sorry(i18n("Could not create file"), KIO::NetAccess::lastErrorString()); //#endif return ok; } -bool PURL::Url::write(const QString &text, Log::Generic &log) const +bool PURL::Url::write(const TQString &text, Log::Generic &log) const { File file(*this, log); if ( !file.openForWrite() ) return false; @@ -71,7 +71,7 @@ bool PURL::Url::del(Log::Generic &log) const // return false; // } //#else - bool ok = KIO::NetAccess::del(_url, qApp->mainWidget()); + bool ok = KIO::NetAccess::del(_url, tqApp->mainWidget()); if ( !ok ) log.sorry(i18n("Could not delete file."), KIO::NetAccess::lastErrorString()); return ok; //#endif @@ -103,8 +103,8 @@ bool PURL::Directory::create(Log::Generic &log) const // } //#else // assume dir do no exist if ioslave cannot tell... - if ( KIO::NetAccess::exists(_url, false, qApp->mainWidget()) ) return true; - bool ok = KIO::NetAccess::mkdir(_url, qApp->mainWidget()); + if ( KIO::NetAccess::exists(_url, false, tqApp->mainWidget()) ) return true; + bool ok = KIO::NetAccess::mkdir(_url, tqApp->mainWidget()); if ( !ok ) log.sorry(i18n("Could not create directory"), KIO::NetAccess::lastErrorString()); //#endif return ok; diff --git a/src/common/gui/purl_gui.cpp b/src/common/gui/purl_gui.cpp index d81fdb6..f93e11c 100644 --- a/src/common/gui/purl_gui.cpp +++ b/src/common/gui/purl_gui.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ #include "purl_gui.h" -#include <qlayout.h> +#include <tqlayout.h> #include <kiconloader.h> #include <kpushbutton.h> #include <krun.h> @@ -18,20 +18,20 @@ #include "misc_gui.h" //----------------------------------------------------------------------------- -PURL::Url PURL::getOpenUrl(const QString &startDir, const QString &filter, - QWidget *widget, const QString &caption) +PURL::Url PURL::getOpenUrl(const TQString &startDir, const TQString &filter, + TQWidget *widget, const TQString &caption) { return KFileDialog::getOpenURL(startDir, filter, widget, caption); } -PURL::UrlList PURL::getOpenUrls(const QString &startDir, const QString &filter, - QWidget *widget, const QString &caption) +PURL::UrlList PURL::getOpenUrls(const TQString &startDir, const TQString &filter, + TQWidget *widget, const TQString &caption) { return KFileDialog::getOpenURLs(startDir, filter, widget, caption); } -PURL::Url PURL::getSaveUrl(const QString &startDir, const QString &filter, - QWidget *widget, const QString &caption, +PURL::Url PURL::getSaveUrl(const TQString &startDir, const TQString &filter, + TQWidget *widget, const TQString &caption, SaveAction action) { Url url = KFileDialog::getSaveURL(startDir, filter, widget, caption); @@ -40,7 +40,7 @@ PURL::Url PURL::getSaveUrl(const QString &startDir, const QString &filter, case NoSaveAction: break; case AskOverwrite: if ( url.exists() ) { - if ( !MessageBox::askContinue(i18n("File \"%1\" already exists. Overwrite ?").arg(url.pretty())) ) return Url(); + if ( !MessageBox::askContinue(i18n("File \"%1\" already exists. Overwrite ?").tqarg(url.pretty())) ) return Url(); } break; case CancelIfExists: @@ -50,19 +50,19 @@ PURL::Url PURL::getSaveUrl(const QString &startDir, const QString &filter, return url; } -PURL::Directory PURL::getExistingDirectory(const QString &startDir, QWidget *widget, - const QString &caption) +PURL::Directory PURL::getExistingDirectory(const TQString &startDir, TQWidget *widget, + const TQString &caption) { KURL kurl = KDirSelectDialog::selectDirectory(startDir, false, widget, caption); if ( kurl.isEmpty() ) return Directory(); return Directory(kurl.path(1)); } -QPixmap PURL::icon(FileType type) +TQPixmap PURL::icon(FileType type) { - if (type.data().xpm_icon) return QPixmap(type.data().xpm_icon); + if (type.data().xpm_icon) return TQPixmap(type.data().xpm_icon); if ( hasMimetype(type) ) return KMimeType::mimeType(type.data().mimetype)->pixmap(KIcon::Small); - return QPixmap(); + return TQPixmap(); } bool PURL::hasMimetype(FileType type) @@ -73,11 +73,11 @@ bool PURL::hasMimetype(FileType type) } //----------------------------------------------------------------------------- -PURL::Label::Label(const QString &url, const QString &text, - QWidget *parent, const char *name) - : KURLLabel(url, text, parent, name) +PURL::Label::Label(const TQString &url, const TQString &text, + TQWidget *tqparent, const char *name) + : KURLLabel(url, text, tqparent, name) { - connect(this, SIGNAL(leftClickedURL()), SLOT(urlClickedSlot())); + connect(this, TQT_SIGNAL(leftClickedURL()), TQT_SLOT(urlClickedSlot())); } void PURL::Label::urlClickedSlot() @@ -86,29 +86,29 @@ void PURL::Label::urlClickedSlot() } //----------------------------------------------------------------------------- -PURL::BaseWidget::BaseWidget(QWidget *parent, const char *name) - : QWidget(parent, name) +PURL::BaseWidget::BaseWidget(TQWidget *tqparent, const char *name) + : TQWidget(tqparent, name) { init(); } -PURL::BaseWidget::BaseWidget(const QString &defaultDir, QWidget *parent, const char *name) - : QWidget(parent, name), _defaultDir(defaultDir) +PURL::BaseWidget::BaseWidget(const TQString &defaultDir, TQWidget *tqparent, const char *name) + : TQWidget(tqparent, name), _defaultDir(defaultDir) { init(); } void PURL::BaseWidget::init() { - QHBoxLayout *top = new QHBoxLayout(this, 0, 10); + TQHBoxLayout *top = new TQHBoxLayout(this, 0, 10); _edit = new KLineEdit(this); - connect(_edit, SIGNAL(textChanged(const QString &)), SIGNAL(changed())); + connect(_edit, TQT_SIGNAL(textChanged(const TQString &)), TQT_SIGNAL(changed())); top->addWidget(_edit); KIconLoader loader; - QIconSet iconset = loader.loadIcon("fileopen", KIcon::Toolbar); - QPushButton *button = new KPushButton(iconset, QString::null, this); - connect(button, SIGNAL(clicked()), SLOT(buttonClicked())); + TQIconSet iconset = loader.loadIcon("fileopen", KIcon::Toolbar); + TQPushButton *button = new KPushButton(iconset, TQString(), this); + connect(button, TQT_SIGNAL(clicked()), TQT_SLOT(buttonClicked())); top->addWidget(button); } @@ -122,23 +122,23 @@ void PURL::DirectoryWidget::buttonClicked() } //---------------------------------------------------------------------------- -PURL::DirectoriesWidget::DirectoriesWidget(const QString &title, QWidget *parent, const char *name) - : QVGroupBox(title, parent, name) +PURL::DirectoriesWidget::DirectoriesWidget(const TQString &title, TQWidget *tqparent, const char *name) + : TQVGroupBox(title, tqparent, name) { - init(QString::null); + init(TQString()); } -PURL::DirectoriesWidget::DirectoriesWidget(const QString &title, const QString &defaultDir, QWidget *parent, const char *name) - : QVGroupBox(title, parent, name) +PURL::DirectoriesWidget::DirectoriesWidget(const TQString &title, const TQString &defaultDir, TQWidget *tqparent, const char *name) + : TQVGroupBox(title, tqparent, name) { init(defaultDir); } -void PURL::DirectoriesWidget::init(const QString &defaultDir) +void PURL::DirectoriesWidget::init(const TQString &defaultDir) { DirectoryWidget *edit = new DirectoryWidget(defaultDir); _editListBox = new EditListBox(1, edit, edit->lineEdit(), this, "directories_editlistbox"); - connect(_editListBox, SIGNAL(changed()), SIGNAL(changed())); + connect(_editListBox, TQT_SIGNAL(changed()), TQT_SIGNAL(changed())); } //---------------------------------------------------------------------------- diff --git a/src/common/gui/purl_gui.h b/src/common/gui/purl_gui.h index a11bedf..d554636 100644 --- a/src/common/gui/purl_gui.h +++ b/src/common/gui/purl_gui.h @@ -9,7 +9,7 @@ #ifndef PURL_GUI_H #define PURL_GUI_H -#include <qvgroupbox.h> +#include <tqvgroupbox.h> #include <klineedit.h> #include <klocale.h> #include <kurllabel.h> @@ -21,34 +21,36 @@ namespace PURL { //----------------------------------------------------------------------------- extern bool hasMimetype(FileType type); -extern QPixmap icon(FileType type); -extern Directory getExistingDirectory(const QString &startDir, QWidget *widget, const QString &caption); -extern Url getOpenUrl(const QString &startDir, const QString &filter, QWidget *widget, - const QString &caption); -extern UrlList getOpenUrls(const QString &startDir, const QString &filter, QWidget *widget, - const QString &caption); +extern TQPixmap icon(FileType type); +extern Directory getExistingDirectory(const TQString &startDir, TQWidget *widget, const TQString &caption); +extern Url getOpenUrl(const TQString &startDir, const TQString &filter, TQWidget *widget, + const TQString &caption); +extern UrlList getOpenUrls(const TQString &startDir, const TQString &filter, TQWidget *widget, + const TQString &caption); enum SaveAction { NoSaveAction, AskOverwrite, CancelIfExists }; -extern Url getSaveUrl(const QString &startDir, const QString &filter, QWidget *widget, - const QString &caption, SaveAction action); +extern Url getSaveUrl(const TQString &startDir, const TQString &filter, TQWidget *widget, + const TQString &caption, SaveAction action); //----------------------------------------------------------------------------- class Label : public KURLLabel { Q_OBJECT + TQ_OBJECT public: - Label(const QString &url, const QString &text, QWidget *parent = 0, const char *name = 0); + Label(const TQString &url, const TQString &text, TQWidget *tqparent = 0, const char *name = 0); private slots: void urlClickedSlot(); }; //----------------------------------------------------------------------------- -class BaseWidget : public QWidget +class BaseWidget : public TQWidget { Q_OBJECT + TQ_OBJECT public: - BaseWidget(QWidget *parent = 0, const char *name = 0); - BaseWidget(const QString &defaultDir, QWidget *parent = 0, const char *name = 0); + BaseWidget(TQWidget *tqparent = 0, const char *name = 0); + BaseWidget(const TQString &defaultDir, TQWidget *tqparent = 0, const char *name = 0); KLineEdit *lineEdit() { return _edit; } signals: @@ -58,7 +60,7 @@ protected slots: virtual void buttonClicked() = 0; protected: - QString _defaultDir; + TQString _defaultDir; KLineEdit *_edit; void init(); @@ -68,9 +70,10 @@ protected: class DirectoryWidget : public BaseWidget { Q_OBJECT + TQ_OBJECT public: - DirectoryWidget(QWidget *parent = 0, const char *name = 0) : BaseWidget(parent, name) {} - DirectoryWidget(const QString &defaultDir, QWidget *parent = 0, const char *name = 0) : BaseWidget(defaultDir, parent, name) {} + DirectoryWidget(TQWidget *tqparent = 0, const char *name = 0) : BaseWidget(tqparent, name) {} + DirectoryWidget(const TQString &defaultDir, TQWidget *tqparent = 0, const char *name = 0) : BaseWidget(defaultDir, tqparent, name) {} void setDirectory(const Directory &dir) { _edit->setText(dir.path()); } Directory directory() const { return _edit->text(); } @@ -79,32 +82,34 @@ protected slots: }; //----------------------------------------------------------------------------- -class DirectoriesWidget : public QVGroupBox +class DirectoriesWidget : public TQVGroupBox { Q_OBJECT + TQ_OBJECT public: - DirectoriesWidget(const QString &title, QWidget *parent = 0, const char *name = 0); - DirectoriesWidget(const QString &title, const QString &defaultDir, QWidget *parent = 0, const char *name = 0); - void setDirectories(const QStringList &dirs) { _editListBox->setTexts(dirs); } - QStringList directories() const { return _editListBox->texts(); } + DirectoriesWidget(const TQString &title, TQWidget *tqparent = 0, const char *name = 0); + DirectoriesWidget(const TQString &title, const TQString &defaultDir, TQWidget *tqparent = 0, const char *name = 0); + void setDirectories(const TQStringList &dirs) { _editListBox->setTexts(dirs); } + TQStringList directories() const { return _editListBox->texts(); } signals: void changed(); private: EditListBox *_editListBox; - void init(const QString &defaultDir); + void init(const TQString &defaultDir); }; //----------------------------------------------------------------------------- class UrlWidget : public BaseWidget { Q_OBJECT + TQ_OBJECT public: - UrlWidget(const QString &filter, QWidget *parent = 0, const char *name = 0) - : BaseWidget(parent, name), _filter(filter) {} - UrlWidget(const QString &defaultDir, const QString &filter, QWidget *parent = 0, const char *name = 0) - : BaseWidget(defaultDir, parent, name), _filter(filter) {} + UrlWidget(const TQString &filter, TQWidget *tqparent = 0, const char *name = 0) + : BaseWidget(tqparent, name), _filter(filter) {} + UrlWidget(const TQString &defaultDir, const TQString &filter, TQWidget *tqparent = 0, const char *name = 0) + : BaseWidget(defaultDir, tqparent, name), _filter(filter) {} Url url() const { return PURL::Url::fromPathOrUrl(_edit->text()); } void setUrl(const Url &url) { _edit->setText(url.filepath()); } @@ -112,7 +117,7 @@ protected slots: virtual void buttonClicked(); private: - QString _filter; + TQString _filter; }; } // namespace diff --git a/src/common/nokde/nokde_kaboutdata.cpp b/src/common/nokde/nokde_kaboutdata.cpp index 21b6917..6dd8f33 100644 --- a/src/common/nokde/nokde_kaboutdata.cpp +++ b/src/common/nokde/nokde_kaboutdata.cpp @@ -24,52 +24,52 @@ #include "nokde_kaboutdata.h" //#include <kstandarddirs.h> -#include <qfile.h> -#include <qtextstream.h> -#include <qstringlist.h> +#include <tqfile.h> +#include <tqtextstream.h> +#include <tqstringlist.h> -QString +TQString KAboutPerson::name() const { - return QString::fromUtf8(mName); + return TQString::fromUtf8(mName); } -QString +TQString KAboutPerson::task() const { if (mTask && *mTask) return i18n(mTask); else - return QString::null; + return TQString(); } -QString +TQString KAboutPerson::emailAddress() const { - return QString::fromUtf8(mEmailAddress); + return TQString::fromUtf8(mEmailAddress); } -QString +TQString KAboutPerson::webAddress() const { - return QString::fromUtf8(mWebAddress); + return TQString::fromUtf8(mWebAddress); } -KAboutTranslator::KAboutTranslator(const QString & name, - const QString & emailAddress) +KAboutTranslator::KAboutTranslator(const TQString & name, + const TQString & emailAddress) { mName=name; mEmail=emailAddress; } -QString KAboutTranslator::name() const +TQString KAboutTranslator::name() const { return mName; } -QString KAboutTranslator::emailAddress() const +TQString KAboutTranslator::emailAddress() const { return mEmail; } @@ -90,7 +90,7 @@ public: const char *translatorName; const char *translatorEmail; const char *productName; -// QImage* programLogo; +// TQImage* programLogo; }; @@ -163,9 +163,9 @@ KAboutData::setLicenseText( const char *licenseText ) } void -KAboutData::setLicenseTextFile( const QString &file ) +KAboutData::setLicenseTextFile( const TQString &file ) { - mLicenseText = qstrdup(QFile::encodeName(file)); + mLicenseText = qstrdup(TQFile::encodeName(file)); mLicenseKey = License_File; } @@ -244,99 +244,99 @@ KAboutData::productName() const return appName(); } -QString +TQString KAboutData::programName() const { if (mProgramName && *mProgramName) return i18n(mProgramName); else - return QString::null; + return TQString(); } /* -QImage +TQImage KAboutData::programLogo() const { - return d->programLogo ? (*d->programLogo) : QImage(); + return d->programLogo ? (*d->programLogo) : TQImage(); } void -KAboutData::setProgramLogo(const QImage& image) +KAboutData::setProgramLogo(const TQImage& image) { if (!d->programLogo) - d->programLogo = new QImage( image ); + d->programLogo = new TQImage( image ); else *d->programLogo = image; } */ -QString +TQString KAboutData::version() const { - return QString::fromLatin1(mVersion); + return TQString::tqfromLatin1(mVersion); } -QString +TQString KAboutData::shortDescription() const { if (mShortDescription && *mShortDescription) return i18n(mShortDescription); else - return QString::null; + return TQString(); } -QString +TQString KAboutData::homepage() const { - return QString::fromLatin1(mHomepageAddress); + return TQString::tqfromLatin1(mHomepageAddress); } -QString +TQString KAboutData::bugAddress() const { - return QString::fromLatin1(mBugEmailAddress); + return TQString::tqfromLatin1(mBugEmailAddress); } -const QValueList<KAboutPerson> +const TQValueList<KAboutPerson> KAboutData::authors() const { return mAuthorList; } -const QValueList<KAboutPerson> +const TQValueList<KAboutPerson> KAboutData::credits() const { return mCreditList; } -const QValueList<KAboutTranslator> +const TQValueList<KAboutTranslator> KAboutData::translators() const { - QValueList<KAboutTranslator> personList; + TQValueList<KAboutTranslator> personList; if(d->translatorName == 0) return personList; - QStringList nameList; - QStringList emailList; + TQStringList nameList; + TQStringList emailList; - QString names = i18n(d->translatorName); - if(names != QString::fromUtf8(d->translatorName)) + TQString names = i18n(d->translatorName); + if(names != TQString::fromUtf8(d->translatorName)) { -#if QT_VERSION < 0x040000 - nameList = QStringList::split(',',names); +#if [[[TQT_VERSION IS DEPRECATED]]] < 0x040000 + nameList = TQStringList::split(',',names); #else - nameList = names.split(',', QString::SkipEmptyParts); + nameList = names.split(',', TQString::SkipEmptyParts); #endif } if(d->translatorEmail) { - QString emails = i18n(d->translatorEmail); + TQString emails = i18n(d->translatorEmail); - if(emails != QString::fromUtf8(d->translatorEmail)) + if(emails != TQString::fromUtf8(d->translatorEmail)) { -#if QT_VERSION < 0x040000 - emailList = QStringList::split(',',emails,true); +#if [[[TQT_VERSION IS DEPRECATED]]] < 0x040000 + emailList = TQStringList::split(',',emails,true); #else emailList = emails.split(','); #endif @@ -344,21 +344,21 @@ KAboutData::translators() const } - QStringList::Iterator nit; - QStringList::Iterator eit=emailList.begin(); + TQStringList::Iterator nit; + TQStringList::Iterator eit=emailList.begin(); for(nit = nameList.begin(); nit != nameList.end(); ++nit) { - QString email; + TQString email; if(eit != emailList.end()) { email=*eit; ++eit; } - QString name=*nit; + TQString name=*nit; -#if QT_VERSION < 0x040000 +#if [[[TQT_VERSION IS DEPRECATED]]] < 0x040000 personList.append(KAboutTranslator(name.stripWhiteSpace(), email.stripWhiteSpace())); #else personList.append(KAboutTranslator(name.trimmed(), email.trimmed())); @@ -368,7 +368,7 @@ KAboutData::translators() const return personList; } -QString +TQString KAboutData::aboutTranslationTeam() { return i18n("replace this with information about your translation team", @@ -378,29 +378,29 @@ KAboutData::aboutTranslationTeam() "visit http://i18n.kde.org</p>"); } -QString +TQString KAboutData::otherText() const { if (mOtherText && *mOtherText) return i18n(mOtherText); else - return QString::null; + return TQString(); } -QString +TQString KAboutData::license() const { - QString result; + TQString result; if (!copyrightStatement().isEmpty()) result = copyrightStatement() + "\n\n"; - QString l; - QString f; + TQString l; + TQString f; switch ( mLicenseKey ) { case License_File: - f = QFile::decodeName(mLicenseText); + f = TQFile::decodeName(mLicenseText); break; case License_GPL_V2: l = "GPL v2"; @@ -418,9 +418,9 @@ KAboutData::license() const l = "Artistic License"; f = locate("data", "LICENSES/ARTISTIC"); break; - case License_QPL_V1_0: - l = "QPL v1.0"; - f = locate("data", "LICENSES/QPL_V1.0"); + case License_TQPL_V1_0: + l = "TQPL v1.0"; + f = locate("data", "LICENSES/TQPL_V1.0"); break; case License_Custom: if (mLicenseText && *mLicenseText) @@ -434,21 +434,21 @@ KAboutData::license() const } if (!l.isEmpty()) - result += i18n("This program is distributed under the terms of the %1.").arg( l ); + result += i18n("This program is distributed under the terms of the %1.").tqarg( l ); if (!f.isEmpty()) { - QFile file(f); -#if QT_VERSION < 0x040000 + TQFile file(f); +#if [[[TQT_VERSION IS DEPRECATED]]] < 0x040000 if (file.open(IO_ReadOnly)) #else - if (file.open(QIODevice::ReadOnly)) + if (file.open(TQIODevice::ReadOnly)) #endif { result += '\n'; result += '\n'; - QTextStream str(&file); -#if QT_VERSION < 0x040000 + TQTextStream str(&file); +#if [[[TQT_VERSION IS DEPRECATED]]] < 0x040000 result += str.read(); #else result += str.readAll(); @@ -459,11 +459,11 @@ KAboutData::license() const return result; } -QString +TQString KAboutData::copyrightStatement() const { if (mCopyrightStatement && *mCopyrightStatement) return i18n(mCopyrightStatement); else - return QString::null; + return TQString(); } diff --git a/src/common/nokde/nokde_kaboutdata.h b/src/common/nokde/nokde_kaboutdata.h index 13076d4..01a8e74 100644 --- a/src/common/nokde/nokde_kaboutdata.h +++ b/src/common/nokde/nokde_kaboutdata.h @@ -21,16 +21,16 @@ * */ -#include <qglobal.h> -#if QT_VERSION < 0x040000 -# include <qvaluelist.h> +#include <tqglobal.h> +#if [[[TQT_VERSION IS DEPRECATED]]] < 0x040000 +# include <tqvaluelist.h> #else -# include <Qt3Support/Q3ValueList> -# define QValueList Q3ValueList -# include <QStringList> +# include <TQt3Support/Q3ValueList> +# define TQValueList Q3ValueList +# include <TQStringList> #endif -#include <qstring.h> -//#include <qimage.h> +#include <tqstring.h> +//#include <tqimage.h> #include "nokde_klocale.h" @@ -85,37 +85,37 @@ public: } /** * @internal - * Don't use. Required by QValueList + * Don't use. Required by TQValueList */ KAboutPerson() {} /** * The person's name - * @return the person's name (can be QString::null, if it has been + * @return the person's name (can be TQString(), if it has been * constructed with a null name) */ - QString name() const; + TQString name() const; /** * The person's task - * @return the person's task (can be QString::null, if it has been + * @return the person's task (can be TQString(), if it has been * constructed with a null task) */ - QString task() const; + TQString task() const; /** * The person's email address - * @return the person's email address (can be QString::null, if it has been + * @return the person's email address (can be TQString(), if it has been * constructed with a null email) */ - QString emailAddress() const; + TQString emailAddress() const; /** * The home page or a relevant link - * @return the persons home page (can be QString::null, if it has been + * @return the persons home page (can be TQString(), if it has been * constructed with a null home page) */ - QString webAddress() const; + TQString webAddress() const; private: const char *mName; @@ -149,26 +149,26 @@ public: * * @param emailAddress The email address of the person. */ - KAboutTranslator(const QString & name=QString::null, - const QString & emailAddress=QString::null); + KAboutTranslator(const TQString & name=TQString(), + const TQString & emailAddress=TQString()); /** * The translator's name - * @return the translators's name (can be QString::null, if it has been + * @return the translators's name (can be TQString(), if it has been * constructed with a null name) */ - QString name() const; + TQString name() const; /** * The translator's email - * @return the translator's email address (can be QString::null, if it has been + * @return the translator's email address (can be TQString(), if it has been * constructed with a null email) */ - QString emailAddress() const; + TQString emailAddress() const; private: - QString mName; - QString mEmail; + TQString mName; + TQString mEmail; KAboutTranslatorPrivate* d; }; @@ -204,8 +204,8 @@ class KDECORE_EXPORT KAboutData License_LGPL_V2 = 2, License_BSD = 3, License_Artistic = 4, - License_QPL = 5, - License_QPL_V1_0 = 5 + License_TQPL = 5, + License_TQPL_V1_0 = 5 }; public: @@ -352,7 +352,7 @@ class KDECORE_EXPORT KAboutData * * @param file File containing the license text. */ - void setLicenseTextFile( const QString &file ); + void setLicenseTextFile( const TQString &file ); /** * Defines the program name used internally. @@ -379,7 +379,7 @@ class KDECORE_EXPORT KAboutData * @see programLogo() * @since 3.4 */ -// void setProgramLogo(const QImage& image); +// void setProgramLogo(const TQImage& image); /** * Defines the program version string. @@ -469,7 +469,7 @@ class KDECORE_EXPORT KAboutData * Returns the translated program name. * @return the program name (translated). */ - QString programName() const; + TQString programName() const; /** * Returns the program logo image. @@ -477,63 +477,63 @@ class KDECORE_EXPORT KAboutData * no custom application logo defined. * @since 3.4 */ -// QImage programLogo() const; +// TQImage programLogo() const; /** * Returns the program's version. * @return the version string. */ - QString version() const; + TQString version() const; /** * Returns a short, translated description. * @return the short description (translated). Can be - * QString::null if not set. + * TQString() if not set. */ - QString shortDescription() const; + TQString shortDescription() const; /** * Returns the application homepage. - * @return the application homepage URL. Can be QString::null if + * @return the application homepage URL. Can be TQString() if * not set. */ - QString homepage() const; + TQString homepage() const; /** * Returns the email address for bugs. * @return the email address where to report bugs. */ - QString bugAddress() const; + TQString bugAddress() const; /** * Returns a list of authors. * @return author information (list of persons). */ - const QValueList<KAboutPerson> authors() const; + const TQValueList<KAboutPerson> authors() const; /** * Returns a list of persons who contributed. * @return credit information (list of persons). */ - const QValueList<KAboutPerson> credits() const; + const TQValueList<KAboutPerson> credits() const; /** * Returns a list of translators. * @return translators information (list of persons) */ - const QValueList<KAboutTranslator> translators() const; + const TQValueList<KAboutTranslator> translators() const; /** * Returns a message about the translation team. * @return a message about the translation team */ - static QString aboutTranslationTeam(); + static TQString aboutTranslationTeam(); /** * Returns a translated, free form text. - * @return the free form text (translated). Can be QString::null if not set. + * @return the free form text (translated). Can be TQString() if not set. */ - QString otherText() const; + TQString otherText() const; /** * Returns the license. If the licenseType argument of the constructor has been @@ -542,13 +542,13 @@ class KDECORE_EXPORT KAboutData * * @return The license text. */ - QString license() const; + TQString license() const; /** * Returns the copyright statement. - * @return the copyright statement. Can be QString::null if not set. + * @return the copyright statement. Can be TQString() if not set. */ - QString copyrightStatement() const; + TQString copyrightStatement() const; private: const char *mAppName; @@ -560,8 +560,8 @@ class KDECORE_EXPORT KAboutData const char *mOtherText; const char *mHomepageAddress; const char *mBugEmailAddress; - QValueList<KAboutPerson> mAuthorList; - QValueList<KAboutPerson> mCreditList; + TQValueList<KAboutPerson> mAuthorList; + TQValueList<KAboutPerson> mCreditList; const char *mLicenseText; KAboutDataPrivate *d; diff --git a/src/common/nokde/nokde_kcmdlineargs.cpp b/src/common/nokde/nokde_kcmdlineargs.cpp index 7f026fe..f06f20e 100644 --- a/src/common/nokde/nokde_kcmdlineargs.cpp +++ b/src/common/nokde/nokde_kcmdlineargs.cpp @@ -32,23 +32,23 @@ #include <limits.h> #endif -#include <qdir.h> -#include <qfile.h> -#include <qurl.h> - -#include <qstringlist.h> -#if QT_VERSION<0x040000 -# include <qasciidict.h> -# include <qstrlist.h> +#include <tqdir.h> +#include <tqfile.h> +#include <tqurl.h> + +#include <tqstringlist.h> +#if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 +# include <tqasciidict.h> +# include <tqstrlist.h> #else -# include <Qt3Support/Q3StrList> -# define QGList Q3GList -# define QStrList Q3StrList -# include <Qt3Support/Q3AsciiDict> -# define QGDict Q3GDict -# define QAsciiDict Q3AsciiDict -# include <Qt3Support/Q3PtrCollection> -# define QPtrCollection Q3PtrCollection +# include <TQt3Support/Q3StrList> +# define TQGList Q3GList +# define TQStrList Q3StrList +# include <TQt3Support/Q3AsciiDict> +# define TQGDict Q3GDict +# define TQAsciiDict Q3AsciiDict +# include <TQt3Support/Q3PtrCollection> +# define TQPtrCollection Q3PtrCollection #endif @@ -60,47 +60,47 @@ //#include <kstringhandler.h> //#include <kstaticdeleter.h> -#ifdef Q_WS_X11 +#ifdef TQ_WS_X11 #define DISPLAY "DISPLAY" -#elif defined(Q_WS_QWS) -#define DISPLAY "QWS_DISPLAY" +#elif defined(TQ_WS_TQWS) +#define DISPLAY "TQWS_DISPLAY" #endif -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN #include <win32_utils.h> #endif -template class QAsciiDict<QCString>; -template class QPtrList<KCmdLineArgs>; +template class TQAsciiDict<TQCString>; +template class TQPtrList<KCmdLineArgs>; -class KCmdLineParsedOptions : public QAsciiDict<QCString> +class KCmdLineParsedOptions : public TQAsciiDict<TQCString> { public: KCmdLineParsedOptions() - : QAsciiDict<QCString>( 7 ) { } + : TQAsciiDict<TQCString>( 7 ) { } // WABA: Huh? // The compiler doesn't find KCmdLineParsedOptions::write(s) by itself ??? // WABA: No, because there is another write function that hides the // write function in the base class even though this function has a // different signature. (obscure C++ feature) - QDataStream& save( QDataStream &s) const - { return QGDict::write(s); } + TQDataStream& save( TQDataStream &s) const + { return TQGDict::write(s); } - QDataStream& load( QDataStream &s) - { return QGDict::read(s); } + TQDataStream& load( TQDataStream &s) + { return TQGDict::read(s); } protected: - virtual QDataStream& write( QDataStream &s, QPtrCollection::Item data) const + virtual TQDataStream& write( TQDataStream &s, TQPtrCollection::Item data) const { - QCString *str = (QCString *) data; + TQCString *str = (TQCString *) data; s << (*str); return s; } - virtual QDataStream& read( QDataStream &s, QPtrCollection::Item &item) + virtual TQDataStream& read( TQDataStream &s, TQPtrCollection::Item &item) { - QCString *str = new QCString; + TQCString *str = new TQCString; s >> (*str); item = (void *)str; return s; @@ -108,20 +108,20 @@ protected: }; -class KCmdLineParsedArgs : public QStrList +class KCmdLineParsedArgs : public TQStrList { public: KCmdLineParsedArgs() - : QStrList( true ) { } - QDataStream& save( QDataStream &s) const - { return QGList::write(s); } + : TQStrList( true ) { } + TQDataStream& save( TQDataStream &s) const + { return TQGList::write(s); } - QDataStream& load( QDataStream &s) - { return QGList::read(s); } + TQDataStream& load( TQDataStream &s) + { return TQGList::read(s); } }; -class KCmdLineArgsList: public QPtrList<KCmdLineArgs> +class KCmdLineArgsList: public TQPtrList<KCmdLineArgs> { public: KCmdLineArgsList() { } @@ -201,16 +201,16 @@ KCmdLineArgs::init(int _argc, char **_argv, const KAboutData *_about, bool /*noK parsed = false; mCwd = /*mCwdd.setObject(mCwd, */new char [PATH_MAX+1];//, true); getcwd(mCwd, PATH_MAX); -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN win32_slashify(mCwd, PATH_MAX); #endif // if (!noKApp) // KApplication::addCmdLineOptions(); } -QString KCmdLineArgs::cwd() +TQString KCmdLineArgs::cwd() { - return QFile::decodeName(QCString(mCwd)); + return TQFile::decodeName(TQCString(mCwd)); } const char * KCmdLineArgs::appName() @@ -252,16 +252,16 @@ KCmdLineArgs::addCmdLineOptions( const KCmdLineOptions *options, const char *nam } void -KCmdLineArgs::saveAppArgs( QDataStream &ds) +KCmdLineArgs::saveAppArgs( TQDataStream &ds) { if (!parsed) parseAllArgs(); - // Remove Qt and KDE options. + // Remove TQt and KDE options. removeArgs("qt"); removeArgs("kde"); - QCString qCwd = mCwd; + TQCString qCwd = mCwd; ds << qCwd; uint count = argsList ? argsList->count() : 0; @@ -272,15 +272,15 @@ KCmdLineArgs::saveAppArgs( QDataStream &ds) KCmdLineArgs *args; for(args = argsList->first(); args; args = argsList->next()) { - ds << QCString(args->id); + ds << TQCString(args->id); args->save(ds); } } void -KCmdLineArgs::loadAppArgs( QDataStream &ds) +KCmdLineArgs::loadAppArgs( TQDataStream &ds) { - // Remove Qt and KDE options. + // Remove TQt and KDE options. removeArgs("qt"); removeArgs("kde"); @@ -295,7 +295,7 @@ KCmdLineArgs::loadAppArgs( QDataStream &ds) if (ds.atEnd()) return; - QCString qCwd; + TQCString qCwd; ds >> qCwd; delete [] mCwd; @@ -307,7 +307,7 @@ KCmdLineArgs::loadAppArgs( QDataStream &ds) while(count--) { - QCString id; + TQCString id; ds >> id; assert( argsList ); for(args = argsList->first(); args; args = argsList->next()) @@ -367,7 +367,7 @@ void KCmdLineArgs::removeArgs(const char *id) * +4 - no more options follow // !fork */ static int -findOption(const KCmdLineOptions *options, QCString &opt, +findOption(const KCmdLineOptions *options, TQCString &opt, const char *&opt_name, const char *&def, bool &enabled) { int result; @@ -407,11 +407,11 @@ findOption(const KCmdLineOptions *options, QCString &opt, options++; if (!options->name) return result+0; - QCString nextOption = options->name; -# if QT_VERSION<0x040000 - int p = nextOption.find(' '); + TQCString nextOption = options->name; +# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 + int p = nextOption.tqfind(' '); #else - int p = QString(nextOption).indexOf(' '); + int p = TQString(nextOption).indexOf(' '); #endif if (p > 0) nextOption = nextOption.left(p); @@ -443,16 +443,16 @@ findOption(const KCmdLineOptions *options, QCString &opt, void -KCmdLineArgs::findOption(const char *_opt, QCString opt, int &i, bool _enabled, bool &moreOptions) +KCmdLineArgs::findOption(const char *_opt, TQCString opt, int &i, bool _enabled, bool &moreOptions) { KCmdLineArgs *args = argsList->first(); const char *opt_name; const char *def; - QCString argument; -# if QT_VERSION<0x040000 - int j = opt.find('='); + TQCString argument; +# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 + int j = opt.tqfind('='); #else - int j = QString(opt).indexOf('='); + int j = TQString(opt).indexOf('='); #endif if (j != -1) { @@ -476,7 +476,7 @@ KCmdLineArgs::findOption(const char *_opt, QCString opt, int &i, bool _enabled, int p = 1; while (true) { - QCString singleCharOption = " "; + TQCString singleCharOption = " "; singleCharOption[0] = _opt[p]; args = argsList->first(); while (args) @@ -518,7 +518,7 @@ KCmdLineArgs::findOption(const char *_opt, QCString opt, int &i, bool _enabled, if (ignoreUnknown) return; enable_i18n(); - usage( i18n("Unknown option '%1'.").arg(QString::fromLocal8Bit(_opt))); + usage( i18n("Unknown option '%1'.").tqarg(TQString::fromLocal8Bit(_opt))); } if ((result & 4) != 0) @@ -534,7 +534,7 @@ KCmdLineArgs::findOption(const char *_opt, QCString opt, int &i, bool _enabled, if (ignoreUnknown) return; enable_i18n(); - usage( i18n("Unknown option '%1'.").arg(QString::fromLocal8Bit(_opt))); + usage( i18n("Unknown option '%1'.").tqarg(TQString::fromLocal8Bit(_opt))); } if (argument.isEmpty()) { @@ -542,7 +542,7 @@ KCmdLineArgs::findOption(const char *_opt, QCString opt, int &i, bool _enabled, if (i >= argc) { enable_i18n(); - usage( i18n("'%1' missing.").arg( opt_name)); + usage( i18n("'%1' missing.").tqarg( opt_name)); } argument = argv[i]; } @@ -555,12 +555,12 @@ KCmdLineArgs::findOption(const char *_opt, QCString opt, int &i, bool _enabled, } void -KCmdLineArgs::printQ(const QString &msg) +KCmdLineArgs::printQ(const TQString &msg) { -# if QT_VERSION<0x040000 - QCString localMsg = msg.local8Bit(); +# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 + TQCString localMsg = msg.local8Bit(); #else - QCString localMsg = msg.toLocal8Bit(); + TQCString localMsg = msg.toLocal8Bit(); #endif fprintf(stdout, "%s", localMsg.data()); } @@ -618,10 +618,10 @@ KCmdLineArgs::parseAllArgs() else if ( (::qstrcmp(option, "version") == 0) || (::qstrcmp(option, "v") == 0)) { - printQ( QString("Qt: %1\n").arg(qVersion())); -// printQ( QString("KDE: %1\n").arg(KDE_VERSION_STRING)); - printQ( QString("%1: %2\n"). - arg(about->programName()).arg(about->version())); + printQ( TQString("TQt: %1\n").tqarg(qVersion())); +// printQ( TQString("KDE: %1\n").tqarg(KDE_VERSION_STRING)); + printQ( TQString("%1: %2\n"). + arg(about->programName()).tqarg(about->version())); exit(0); } else if ( (::qstrcmp(option, "license") == 0) ) { @@ -632,26 +632,26 @@ KCmdLineArgs::parseAllArgs() } else if ( ::qstrcmp( option, "author") == 0 ) { enable_i18n(); if ( about ) { - const QValueList<KAboutPerson> authors = about->authors(); + const TQValueList<KAboutPerson> authors = about->authors(); if ( !authors.isEmpty() ) { - QString authorlist; - for (QValueList<KAboutPerson>::ConstIterator it = authors.begin(); it != authors.end(); ++it ) { - QString email; + TQString authorlist; + for (TQValueList<KAboutPerson>::ConstIterator it = authors.begin(); it != authors.end(); ++it ) { + TQString email; if ( !(*it).emailAddress().isEmpty() ) email = " <" + (*it).emailAddress() + ">"; - authorlist += QString(" ") + (*it).name() + email + "\n"; + authorlist += TQString(" ") + (*it).name() + email + "\n"; } - printQ( i18n("the 2nd argument is a list of name+address, one on each line","%1 was written by\n%2").arg ( QString(about->programName()) ).arg( authorlist ) ); + printQ( i18n("the 2nd argument is a list of name+address, one on each line","%1 was written by\n%2").arg ( TQString(about->programName()) ).tqarg( authorlist ) ); } } else { - printQ( i18n("%1 was written by somebody who wants to remain anonymous.").arg(about->programName()) ); + printQ( i18n("%1 was written by somebody who wants to remain anonymous.").tqarg(about->programName()) ); } if (!about->bugAddress().isEmpty()) { if (about->bugAddress() == "submit@bugs.kde.org") printQ( i18n( "Please use http://bugs.kde.org to report bugs, do not mail the authors directly.\n" ) ); else - printQ( i18n( "Please use %1 to report bugs, do not mail the authors directly.\n" ).arg(about->bugAddress()) ); + printQ( i18n( "Please use %1 to report bugs, do not mail the authors directly.\n" ).tqarg(about->bugAddress()) ); } exit(0); } else { @@ -671,7 +671,7 @@ KCmdLineArgs::parseAllArgs() if (ignoreUnknown) continue; enable_i18n(); - usage( i18n("Unexpected argument '%1'.").arg(QString::fromLocal8Bit(argv[i]))); + usage( i18n("Unexpected argument '%1'.").tqarg(TQString::fromLocal8Bit(argv[i]))); } else { @@ -768,20 +768,20 @@ KCmdLineArgs::enable_i18n() } void -KCmdLineArgs::usage(const QString &error) +KCmdLineArgs::usage(const TQString &error) { // assert(KGlobal::_locale); -# if QT_VERSION<0x040000 - QCString localError = error.local8Bit(); +# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 + TQCString localError = error.local8Bit(); #else - QCString localError = error.toLocal8Bit(); + TQCString localError = error.toLocal8Bit(); #endif if (localError[error.length()-1] == '\n') localError = localError.left(error.length()-1); fprintf(stderr, "%s: %s\n", argv[0], localError.data()); - QString tmp = i18n("Use --help to get a list of available command line options."); -# if QT_VERSION<0x040000 + TQString tmp = i18n("Use --help to get a list of available command line options."); +# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 localError = tmp.local8Bit(); #else localError = tmp.toLocal8Bit(); @@ -797,11 +797,11 @@ KCmdLineArgs::usage(const char *id) assert(argsList != 0); // It's an error to call usage(...) without // having done addCmdLineOptions first! - QString optionFormatString = " %1 %2\n"; - QString optionFormatStringDef = " %1 %2 [%3]\n"; - QString optionHeaderString = i18n("\n%1:\n"); - QString tmp; - QString usage; + TQString optionFormatString = " %1 %2\n"; + TQString optionFormatStringDef = " %1 %2 [%3]\n"; + TQString optionHeaderString = i18n("\n%1:\n"); + TQString tmp; + TQString usage; KCmdLineArgs *args = argsList->last(); @@ -815,7 +815,7 @@ KCmdLineArgs::usage(const char *id) { if (args->name) { - usage = i18n("[%1-options]").arg(args->name)+" "+usage; + usage = i18n("[%1-options]").tqarg(args->name)+" "+usage; } args = argsList->prev(); } @@ -835,30 +835,30 @@ KCmdLineArgs::usage(const char *id) } } - printQ(i18n("Usage: %1 %2\n").arg(argv[0]).arg(usage)); + printQ(i18n("Usage: %1 %2\n").tqarg(argv[0]).tqarg(usage)); printQ("\n"+about->shortDescription()+"\n"); - printQ(optionHeaderString.arg(i18n("Generic options"))); - printQ(optionFormatString.arg("--help", -25).arg(i18n("Show help about options"))); + printQ(optionHeaderString.tqarg(i18n("Generic options"))); + printQ(optionFormatString.tqarg("--help", -25).tqarg(i18n("Show help about options"))); args = argsList->first(); while(args) { if (args->name && args->id) { - QString option = QString("--help-%1").arg(args->id); - QString desc = i18n("Show %1 specific options").arg(args->name); + TQString option = TQString("--help-%1").tqarg(args->id); + TQString desc = i18n("Show %1 specific options").tqarg(args->name); - printQ(optionFormatString.arg(option, -25).arg(desc)); + printQ(optionFormatString.tqarg(option, -25).tqarg(desc)); } args = argsList->next(); } - printQ(optionFormatString.arg("--help-all",-25).arg(i18n("Show all options"))); - printQ(optionFormatString.arg("--author",-25).arg(i18n("Show author information"))); - printQ(optionFormatString.arg("-v, --version",-25).arg(i18n("Show version information"))); - printQ(optionFormatString.arg("--license",-25).arg(i18n("Show license information"))); - printQ(optionFormatString.arg("--", -25).arg(i18n("End of options"))); + printQ(optionFormatString.tqarg("--help-all",-25).tqarg(i18n("Show all options"))); + printQ(optionFormatString.tqarg("--author",-25).tqarg(i18n("Show author information"))); + printQ(optionFormatString.tqarg("-v, --version",-25).tqarg(i18n("Show version information"))); + printQ(optionFormatString.tqarg("--license",-25).tqarg(i18n("Show license information"))); + printQ(optionFormatString.tqarg("--", -25).tqarg(i18n("End of options"))); args = argsList->first(); // Sets current to 1st. @@ -878,22 +878,22 @@ KCmdLineArgs::usage(const char *id) { bool hasArgs = false; bool hasOptions = false; - QString optionsHeader; + TQString optionsHeader; if (args->name) - optionsHeader = optionHeaderString.arg(i18n("%1 options").arg(QString::fromLatin1(args->name))); + optionsHeader = optionHeaderString.tqarg(i18n("%1 options").tqarg(TQString::tqfromLatin1(args->name))); else optionsHeader = i18n("\nOptions:\n"); while (args) { const KCmdLineOptions *option = args->options; - QCString opt = ""; + TQCString opt = ""; // while(option && option->name) { - QString description; - QString descriptionRest; - QStringList dl; + TQString description; + TQString descriptionRest; + TQStringList dl; // Option header if (option->name[0] == ':') @@ -914,7 +914,7 @@ KCmdLineArgs::usage(const char *id) { if (option->description) { - QString tmp = "\n"+i18n(option->description); + TQString tmp = "\n"+i18n(option->description); if (!tmp.endsWith("\n")) tmp.append("\n"); printQ(tmp); @@ -927,15 +927,15 @@ KCmdLineArgs::usage(const char *id) if (option->description) { description = i18n(option->description); -# if QT_VERSION<0x040000 - dl = QStringList::split("\n", description, true); +# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 + dl = TQStringList::split("\n", description, true); #else dl = description.split("\n"); #endif description = dl.first(); dl.erase( dl.begin() ); } - QCString name = option->name; + TQCString name = option->name; if (name[0] == '!') name = name.mid(1); @@ -950,8 +950,8 @@ KCmdLineArgs::usage(const char *id) name = name.mid(1); if ((name[0] == '[') && (name[name.length()-1] == ']')) name = name.mid(1, name.length()-2); - printQ(optionFormatString.arg(QString(name), -25) - .arg(description)); + printQ(optionFormatString.tqarg(TQString(name), -25) + .tqarg(description)); } else { @@ -974,22 +974,22 @@ KCmdLineArgs::usage(const char *id) opt = opt + name; if (!option->def) { - printQ(optionFormatString.arg(QString(opt), -25) - .arg(description)); + printQ(optionFormatString.tqarg(TQString(opt), -25) + .tqarg(description)); } else { - printQ(optionFormatStringDef.arg(QString(opt), -25) - .arg(description).arg(option->def)); + printQ(optionFormatStringDef.tqarg(TQString(opt), -25) + .tqarg(description).tqarg(option->def)); } opt = ""; } } - for(QStringList::Iterator it = dl.begin(); + for(TQStringList::Iterator it = dl.begin(); it != dl.end(); ++it) { - printQ(optionFormatString.arg("", -25).arg(*it)); + printQ(optionFormatString.tqarg("", -25).tqarg(*it)); } option++; @@ -1018,7 +1018,7 @@ KCmdLineArgs::KCmdLineArgs( const KCmdLineOptions *_options, { parsedOptionList = 0; parsedArgList = 0; - isQt = (::qstrcmp(id, "qt") == 0); + isTQt = (::qstrcmp(id, "qt") == 0); } /** @@ -1054,7 +1054,7 @@ KCmdLineArgs::reset() } void -KCmdLineArgs::save( QDataStream &ds) const +KCmdLineArgs::save( TQDataStream &ds) const { uint count = 0; if (parsedOptionList) @@ -1069,7 +1069,7 @@ KCmdLineArgs::save( QDataStream &ds) const } void -KCmdLineArgs::load( QDataStream &ds) +KCmdLineArgs::load( TQDataStream &ds) { if (!parsedOptionList) parsedOptionList = new KCmdLineParsedOptions; if (!parsedArgList) parsedArgList = new KCmdLineParsedArgs; @@ -1090,12 +1090,12 @@ KCmdLineArgs::load( QDataStream &ds) } void -KCmdLineArgs::setOption(const QCString &opt, bool enabled) +KCmdLineArgs::setOption(const TQCString &opt, bool enabled) { - if (isQt) + if (isTQt) { - // Qt does it own parsing. - QCString arg = "-"; + // TQt does it own parsing. + TQCString arg = "-"; if( !enabled ) arg += "no"; arg += opt; @@ -1107,23 +1107,23 @@ KCmdLineArgs::setOption(const QCString &opt, bool enabled) } if (enabled) - parsedOptionList->replace( opt, new QCString("t") ); + parsedOptionList->tqreplace( opt, new TQCString("t") ); else - parsedOptionList->replace( opt, new QCString("f") ); + parsedOptionList->tqreplace( opt, new TQCString("f") ); } void -KCmdLineArgs::setOption(const QCString &opt, const char *value) +KCmdLineArgs::setOption(const TQCString &opt, const char *value) { - if (isQt) + if (isTQt) { - // Qt does it's own parsing. - QCString arg = "-"; + // TQt does it's own parsing. + TQCString arg = "-"; arg += opt; addArgument(arg); addArgument(value); -#ifdef Q_WS_X11 +#ifdef TQ_WS_X11 // Hack coming up! if (arg == "-display") { @@ -1136,16 +1136,16 @@ KCmdLineArgs::setOption(const QCString &opt, const char *value) parsedOptionList->setAutoDelete(true); } - parsedOptionList->insert( opt, new QCString(value) ); + parsedOptionList->insert( opt, new TQCString(value) ); } -QCString +TQCString KCmdLineArgs::getOption(const char *_opt) const { - QCString *value = 0; + TQCString *value = 0; if (parsedOptionList) { - value = parsedOptionList->find(_opt); + value = parsedOptionList->tqfind(_opt); } if (value) @@ -1155,7 +1155,7 @@ KCmdLineArgs::getOption(const char *_opt) const const char *opt_name; const char *def; bool dummy = true; - QCString opt = _opt; + TQCString opt = _opt; int result = ::findOption( options, opt, opt_name, def, dummy) & ~4; if (result != 3) @@ -1168,7 +1168,7 @@ KCmdLineArgs::getOption(const char *_opt) const assert( 0 ); exit(255); } - return QCString(def); + return TQCString(def); } QCStringList @@ -1180,7 +1180,7 @@ KCmdLineArgs::getOptionList(const char *_opt) const while(true) { - QCString *value = parsedOptionList->take(_opt); + TQCString *value = parsedOptionList->take(_opt); if (!value) break; result.prepend(*value); @@ -1196,7 +1196,7 @@ KCmdLineArgs::getOptionList(const char *_opt) const it != result.end(); ++it) { - parsedOptionList->insert(_opt, new QCString(*it)); + parsedOptionList->insert(_opt, new TQCString(*it)); } return result; } @@ -1208,7 +1208,7 @@ KCmdLineArgs::isSet(const char *_opt) const const char *opt_name; const char *def; bool dummy = true; - QCString opt = _opt; + TQCString opt = _opt; int result = ::findOption( options, opt, opt_name, def, dummy) & ~4; if (result == 0) @@ -1222,10 +1222,10 @@ KCmdLineArgs::isSet(const char *_opt) const exit(255); } - QCString *value = 0; + TQCString *value = 0; if (parsedOptionList) { - value = parsedOptionList->find(opt); + value = parsedOptionList->tqfind(opt); } if (value) @@ -1276,18 +1276,18 @@ KCmdLineArgs::url(int n) const KURL KCmdLineArgs::makeURL(const char *_urlArg) { - QString urlArg = QFile::decodeName(_urlArg); - if (!QDir::isRelativePath(urlArg)) + TQString urlArg = TQFile::decodeName(_urlArg); + if (!TQDir::isRelativePath(urlArg)) { //KURL result; //result.setPath(urlArg); //return result; // Absolute path. return urlArg; } -# if QT_VERSION<0x040000 - if ( !QUrl::isRelativeUrl(urlArg) ) +# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 + if ( !TQUrl::isRelativeUrl(urlArg) ) #else - if ( !QUrl(urlArg).isRelative() ) + if ( !TQUrl(urlArg).isRelative() ) #endif //return KURL(urlArg); // Argument is a URL return urlArg; diff --git a/src/common/nokde/nokde_kcmdlineargs.h b/src/common/nokde/nokde_kcmdlineargs.h index 8b79b62..8808d94 100644 --- a/src/common/nokde/nokde_kcmdlineargs.h +++ b/src/common/nokde/nokde_kcmdlineargs.h @@ -24,20 +24,20 @@ #include "nokde_klocale.h" #include "nokde_kurl.h" -# if QT_VERSION<0x040000 -# include <qptrlist.h> -# include <qvaluelist.h> +# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 +# include <tqptrlist.h> +# include <tqvaluelist.h> #else -# include <Qt3Support/Q3CString> -# define QCString Q3CString -# include <Qt3Support/Q3PtrList> -# define QPtrList Q3PtrList -# include <Qt3Support/Q3ValueList> -# define QValueList Q3ValueList +# include <TQt3Support/Q3CString> +# define TQCString Q3CString +# include <TQt3Support/Q3PtrList> +# define TQPtrList Q3PtrList +# include <TQt3Support/Q3ValueList> +# define TQValueList Q3ValueList #endif -# include <qstring.h> +# include <tqstring.h> -typedef QValueList<QCString> QCStringList; +typedef TQValueList<TQCString> QCStringList; /** * @short Structure that holds command line options. @@ -90,7 +90,7 @@ class KCmdLineArgsPrivate; * @short A class for command-line argument handling. * * KCmdLineArgs provides simple access to the command-line arguments - * for an application. It takes into account Qt-specific options, + * for an application. It takes into account TQt-specific options, * KDE-specific options and application specific options. * * This class is used in %main() via the static method @@ -129,13 +129,13 @@ class KCmdLineArgsPrivate; * .... * * // An option which takes an additional argument - * QCString anotherOptionArg = args->getOption("another-option"); + * TQCString anotherOptionArg = args->getOption("another-option"); * * // Arguments (e.g. files to open) * for(int i = 0; i < args->count(); i++) // Counting start at 0! * { * // don't forget to convert to Unicode! - * openFile( QFile::decodeName( args->arg(i))); + * openFile( TQFile::decodeName( args->arg(i))); * // Or more convenient: * // openURL( args->url(i)); * @@ -234,7 +234,7 @@ class KDECORE_EXPORT KCmdLineArgs { friend class KApplication; friend class KUniqueApplication; - friend class QPtrList<KCmdLineArgs>; + friend class TQPtrList<KCmdLineArgs>; public: // Static functions: @@ -253,7 +253,7 @@ public: * @param _description A short description of what your application is about. * @param _version A version. * @param noKApp Set this true to not add commandline options for - * QApplication / KApplication + * TQApplication / KApplication * * @since 3.2 */ @@ -281,7 +281,7 @@ public: * @param _argv As passed to @p main(...). * @param about A KAboutData object describing your program. * @param noKApp Set this true to not add commandline options for - * QApplication / KApplication + * TQApplication / KApplication */ static void init(int _argc, char **_argv, const KAboutData *about, bool noKApp = false); @@ -389,7 +389,7 @@ public: * where the user started a second instance. * @return the current working directory **/ - static QString cwd(); + static TQString cwd(); /** * Get the appname according to argv[0]. @@ -410,7 +410,7 @@ public: * Print an error to stderr and the usage help to stdout and exit. * @param error the error to print **/ - static void usage(const QString &error); + static void usage(const TQString &error); /** * Enable i18n to be able to print a translated error message. @@ -441,7 +441,7 @@ public: * If the option was present more than the value of the * last occurrence is used. */ - QCString getOption(const char *option) const; + TQCString getOption(const char *option) const; /** * Read out all occurrences of a string option. @@ -543,7 +543,7 @@ public: /** * Load arguments from a stream. */ - static void loadAppArgs( QDataStream &); + static void loadAppArgs( TQDataStream &); /** * Add standard option --tempfile @@ -582,7 +582,7 @@ private: * * Checks what to do with a single option */ - static void findOption(const char *_opt, QCString opt, int &i, bool enabled, bool &moreOptions); + static void findOption(const char *_opt, TQCString opt, int &i, bool enabled, bool &moreOptions); /** * @internal @@ -619,23 +619,23 @@ private: /** * @internal for KUniqueApplication only: * - * Save all but the Qt and KDE arguments to a stream. + * Save all but the TQt and KDE arguments to a stream. */ - static void saveAppArgs( QDataStream &); + static void saveAppArgs( TQDataStream &); /** * @internal * * Set a boolean option */ - void setOption(const QCString &option, bool enabled); + void setOption(const TQCString &option, bool enabled); /** * @internal * * Set a string option */ - void setOption(const QCString &option, const char *value); + void setOption(const TQCString &option, const char *value); /** * @internal @@ -649,14 +649,14 @@ private: * * Save to a stream. */ - void save( QDataStream &) const; + void save( TQDataStream &) const; /** * @internal * * Restore from a stream. */ - void load( QDataStream &); + void load( TQDataStream &); /** * @internal for KApplication only @@ -675,14 +675,14 @@ private: */ static void initIgnore(int _argc, char **_argv, const char *_appname); - static void printQ(const QString &msg); + static void printQ(const TQString &msg); const KCmdLineOptions *options; const char *name; const char *id; KCmdLineParsedOptions *parsedOptionList; KCmdLineParsedArgs *parsedArgList; - bool isQt; + bool isTQt; static KCmdLineArgsList *argsList; // All options. static const KAboutData *about; diff --git a/src/common/nokde/nokde_klocale.cpp b/src/common/nokde/nokde_klocale.cpp index e30ba2f..aa6cb26 100644 --- a/src/common/nokde/nokde_klocale.cpp +++ b/src/common/nokde/nokde_klocale.cpp @@ -1,4 +1,4 @@ #include "nokde_klocale.h" -QString i18n(const QString &, const QString &text) { return text; } -QString locate(const QString &, const QString &) { return QString::null; } +TQString i18n(const TQString &, const TQString &text) { return text; } +TQString locate(const TQString &, const TQString &) { return TQString(); } diff --git a/src/common/nokde/nokde_klocale.h b/src/common/nokde/nokde_klocale.h index a1cf720..9a3e361 100644 --- a/src/common/nokde/nokde_klocale.h +++ b/src/common/nokde/nokde_klocale.h @@ -9,9 +9,9 @@ #undef I18N_NOOP #define I18N_NOOP(x) (x) -#include <qstring.h> -inline QString i18n(const QString &text) { return text; } -extern QString i18n(const QString &index, const QString &text); -extern QString locate(const QString &, const QString &); +#include <tqstring.h> +inline TQString i18n(const TQString &text) { return text; } +extern TQString i18n(const TQString &index, const TQString &text); +extern TQString locate(const TQString &, const TQString &); #endif diff --git a/src/common/nokde/nokde_kprocess.cpp b/src/common/nokde/nokde_kprocess.cpp index 92c8968..2886f20 100644 --- a/src/common/nokde/nokde_kprocess.cpp +++ b/src/common/nokde/nokde_kprocess.cpp @@ -1,29 +1,29 @@ #include "nokde_kprocess.h" -#if QT_VERSION<0x040000 -# include <qprocess.h> -# define Q3Process QProcess +#if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 +# include <tqprocess.h> +# define Q3Process TQProcess #else -# include <Qt3Support/Q3Process> +# include <TQt3Support/Q3Process> #endif #if defined(Q_OS_UNIX) # include <signal.h> #endif -KProcess::KProcess(QObject *parent, const char *name) - : QObject(parent, name) +KProcess::KProcess(TQObject *tqparent, const char *name) + : TQObject(tqparent, name) { _process = new Q3Process(this); - connect(_process, SIGNAL(processExited()), SLOT(processExitedSlot())); - connect(_process, SIGNAL(readyReadStdout()), SLOT(readyReadStdoutSlot())); - connect(_process, SIGNAL(readyReadStderr()), SLOT(readyReadStderrSlot())); + connect(_process, TQT_SIGNAL(processExited()), TQT_SLOT(processExitedSlot())); + connect(_process, TQT_SIGNAL(readyReadStdout()), TQT_SLOT(readyReadStdoutSlot())); + connect(_process, TQT_SIGNAL(readyReadStderr()), TQT_SLOT(readyReadStderrSlot())); } bool KProcess::start() { _process->setArguments(_arguments); - QStringList env; + TQStringList env; if ( !_environment.isEmpty() ) { for (uint i=0; environ[i]; i++) env += environ[i]; env += _environment; @@ -40,23 +40,23 @@ void KProcess::processExitedSlot() void KProcess::readyReadStdoutSlot() { - QByteArray a = _process->readStdout(); + TQByteArray a = _process->readStdout(); emit receivedStdout(this, a.data(), a.count()); } void KProcess::readyReadStderrSlot() { - QByteArray a = _process->readStderr(); + TQByteArray a = _process->readStderr(); emit receivedStderr(this, a.data(), a.count()); } bool KProcess::writeStdin(const char *buffer, int len) { -#if QT_VERSION<0x040000 - QByteArray a; +#if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 + TQByteArray a; a.assign(buffer, len); #else - QByteArray a(buffer, len); + TQByteArray a(buffer, len); #endif _process->writeToStdin(a); return true; @@ -88,7 +88,7 @@ bool KProcess::isRunning() const return _process->isRunning(); } -void KProcess::setWorkingDirectory(const QDir &dir) +void KProcess::setWorkingDirectory(const TQDir &dir) { return _process->setWorkingDirectory(dir); } diff --git a/src/common/nokde/nokde_kprocess.h b/src/common/nokde/nokde_kprocess.h index 59ff73c..5c7effd 100644 --- a/src/common/nokde/nokde_kprocess.h +++ b/src/common/nokde/nokde_kprocess.h @@ -1,32 +1,33 @@ #ifndef _KPROCESS_H_ #define _KPROCESS_H_ -#include <qdir.h> +#include <tqdir.h> #include "common/global/global.h" #include "common/common/synchronous.h" -#if QT_VERSION<0x040000 -class QProcess; +#if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 +class TQProcess; #else class Q3Process; #endif -class KProcess : public QObject +class KProcess : public TQObject { Q_OBJECT + TQ_OBJECT public: - KProcess(QObject *parent = 0, const char *name = 0); + KProcess(TQObject *tqparent = 0, const char *name = 0); void clearArguments() { _arguments.clear(); } - KProcess &operator<< (const QString &arg) { _arguments += arg; return *this; } - KProcess &operator<< (const QStringList &args) { _arguments += args; return *this; } - QStringList args() const { return _arguments; } - void setEnvironment(const QString &name, const QString &value) { _environment += name + "=" + value; } + KProcess &operator<< (const TQString &arg) { _arguments += arg; return *this; } + KProcess &operator<< (const TQStringList &args) { _arguments += args; return *this; } + TQStringList args() const { return _arguments; } + void setEnvironment(const TQString &name, const TQString &value) { _environment += name + "=" + value; } bool start(); bool writeStdin(const char *buffer, int len); bool kill(); bool kill(int n); int exitStatus() const; bool isRunning() const; - void setWorkingDirectory(const QDir &dir); + void setWorkingDirectory(const TQDir &dir); void setUseShell(bool useShell); signals: @@ -40,12 +41,12 @@ private slots: void readyReadStderrSlot(); private: -#if QT_VERSION<0x040000 - QProcess *_process; +#if [[[TQT_VERSION IS DEPRECATED]]]<0x040000 + TQProcess *_process; #else Q3Process *_process; #endif - QStringList _arguments,_environment; + TQStringList _arguments,_environment; }; #endif diff --git a/src/common/nokde/nokde_kurl.h b/src/common/nokde/nokde_kurl.h index 202c46d..c31fca1 100644 --- a/src/common/nokde/nokde_kurl.h +++ b/src/common/nokde/nokde_kurl.h @@ -1,7 +1,7 @@ #ifndef _KURL_H_ #define _KURL_H_ -#include <qfile.h> +#include <tqfile.h> #include "common/global/global.h" @@ -9,12 +9,12 @@ class KURL : public Q3Url { public: KURL() {} - KURL(const QString &s) : Q3Url(s) {} + KURL(const TQString &s) : Q3Url(s) {} void cleanPath() {} bool isEmpty() const { return toString(false, false).isEmpty(); } - QString fileName(bool b) const { Q_UNUSED(b); Q_ASSERT(!b); return Q3Url::fileName(); } - static KURL fromPathOrURL(const QString &s) { return KURL(s); } -#if QT_VERSION>=0x040000 + TQString fileName(bool b) const { Q_UNUSED(b); Q_ASSERT(!b); return Q3Url::fileName(); } + static KURL fromPathOrURL(const TQString &s) { return KURL(s); } +#if [[[TQT_VERSION IS DEPRECATED]]]>=0x040000 bool operator <(const KURL &url) const { return path()<url.path(); } bool operator ==(const KURL &url) const { return path()==url.path(); } bool operator !=(const KURL &url) const { return path()!=url.path(); } @@ -25,8 +25,8 @@ public: class KTempFile { public: - const QFile *file() const { return 0; } - QFile *file() { return 0; } + const TQFile *file() const { return 0; } + TQFile *file() { return 0; } }; #endif diff --git a/src/common/nokde/win32_utils.h b/src/common/nokde/win32_utils.h index cc5e110..a5f3acd 100644 --- a/src/common/nokde/win32_utils.h +++ b/src/common/nokde/win32_utils.h @@ -26,7 +26,7 @@ #define KDEWIN32_EXPORT #ifdef __cplusplus -#include <qstring.h> +#include <tqstring.h> extern "C" { #endif @@ -60,13 +60,13 @@ KDEWIN32_EXPORT void win32_slashify(char *path, int maxlen); @param item is an item inside subKey or "" if default folder's value should be returned @param ok if not null, will be set to true on success and false on failure */ -KDEWIN32_EXPORT QString getWin32RegistryValue(HKEY key, const QString& subKey, - const QString& item, bool *ok = 0); +KDEWIN32_EXPORT TQString getWin32RegistryValue(HKEY key, const TQString& subKey, + const TQString& item, bool *ok = 0); /** \return a value from MS Windows native registry for shell folder \a folder. */ -inline QString getWin32ShellFoldersPath(const QString& folder) { +inline TQString getWin32ShellFoldersPath(const TQString& folder) { return getWin32RegistryValue(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", folder); } @@ -77,7 +77,7 @@ inline QString getWin32ShellFoldersPath(const QString& folder) { Used by KPropertiesDialog, if possible. */ KDEWIN32_EXPORT -bool showWin32FilePropertyDialog(const QString& fileName); +bool showWin32FilePropertyDialog(const TQString& fileName); /** \return two-letter locale name (like "en" or "pl") taken from MS Windows native registry. @@ -85,12 +85,12 @@ bool showWin32FilePropertyDialog(const QString& fileName); Used e.g. by kbuildsycoca application. */ KDEWIN32_EXPORT -QCString getWin32LocaleName(); +TQCString getWin32LocaleName(); /*! Temporary solutiuon - \return a KFileDialog-compatible filter string converted to QFileDialog compatible one. + \return a KFileDialog-compatible filter string converted to TQFileDialog compatible one. This is temporary solution for kdelibs/win32... */ -KDEWIN32_EXPORT QString convertKFileDialogFilterToQFileDialogFilter(const QString& filter); +KDEWIN32_EXPORT TQString convertKFileDialogFilterToTQFileDialogFilter(const TQString& filter); #endif //__cplusplus diff --git a/src/common/port/parallel.cpp b/src/common/port/parallel.cpp index 22b6a4c..d92bc82 100644 --- a/src/common/port/parallel.cpp +++ b/src/common/port/parallel.cpp @@ -30,9 +30,9 @@ #include "common/common/misc.h" //----------------------------------------------------------------------------- -QStringList *Port::Parallel::_list = 0; +TQStringList *Port::Parallel::_list = 0; -Port::IODirs Port::Parallel::probe(const QString &device) +Port::IODirs Port::Parallel::probe(const TQString &device) { #if defined(HAVE_PPDEV) int fd = ::open(device.latin1(), O_RDWR); @@ -54,26 +54,26 @@ Port::IODirs Port::Parallel::probe(const QString &device) #endif } -QStringList Port::Parallel::deviceList() +TQStringList Port::Parallel::deviceList() { - QStringList list; + TQStringList list; #if defined(HAVE_PPDEV) // standard parport in user space - for(int i = 0; i<8; ++i) list.append(QString("/dev/parport%1").arg(i)); + for(int i = 0; i<8; ++i) list.append(TQString("/dev/parport%1").tqarg(i)); // new devfs parport flavour - for(int i = 0; i<8; ++i) list.append(QString("/dev/parports/%1").arg(i)); + for(int i = 0; i<8; ++i) list.append(TQString("/dev/parports/%1").tqarg(i)); #elif defined(HAVE_PPBUS) // FreeBSD - for(int i = 0; i<8; ++i) list.append(QString("/dev/ppi%1").arg(i)); + for(int i = 0; i<8; ++i) list.append(TQString("/dev/ppi%1").tqarg(i)); #endif return list; } -const QStringList &Port::Parallel::probedDeviceList() +const TQStringList &Port::Parallel::probedDeviceList() { if ( _list==0 ) { - QStringList all = deviceList(); - _list = new QStringList; + TQStringList all = deviceList(); + _list = new TQStringList; for (uint i=0; i<uint(all.count()); i++) if( probe(all[i]) & (In | Out) ) _list->append(all[i]); } @@ -100,12 +100,12 @@ const Port::Parallel::PPinData Port::Parallel::PIN_DATA[Nb_Pins] = { { Data, 0x20, Out, "D5" }, // data 5 { Data, 0x40, Out, "D6" }, // data 6 { Data, 0x80, Out, "D7" }, // data 7 - { Status, 0x40, In, "/ACK" }, // !ack - { Status, 0x80, In, "BUSY" }, // busy - { Status, 0x20, In, "PAPER" }, // pout - { Status, 0x10, In, "SELin" }, // select + { tqStatus, 0x40, In, "/ACK" }, // !ack + { tqStatus, 0x80, In, "BUSY" }, // busy + { tqStatus, 0x20, In, "PAPER" }, // pout + { tqStatus, 0x10, In, "SELin" }, // select { Control, 0x02, Out, "LF" }, // !feed - { Status, 0x08, In, "/ERROR" }, // !error + { tqStatus, 0x08, In, "/ERROR" }, // !error { Control, 0x04, Out, "PRIME" }, // !init { Control, 0x08, Out, "SELout" }, // !si { Nb_RequestTypes, 0x00, NoIO, "GND" }, // GND @@ -118,9 +118,9 @@ const Port::Parallel::PPinData Port::Parallel::PIN_DATA[Nb_Pins] = { { Nb_RequestTypes, 0x00, NoIO, "GND" } // GND }; -QValueVector<Port::PinData> Port::Parallel::pinData(IODir dir) const +TQValueVector<Port::PinData> Port::Parallel::pinData(IODir dir) const { - QValueVector<PinData> v; + TQValueVector<PinData> v; for (uint i=0; i<Nb_Pins; i++) { if ( PIN_DATA[i].dir!=dir ) continue; PinData pd = { i, PIN_DATA[i].label }; @@ -131,7 +131,7 @@ QValueVector<Port::PinData> Port::Parallel::pinData(IODir dir) const bool Port::Parallel::isGroundPin(uint pin) const { - return ( PIN_DATA[pin].label==QString("GND") ); + return ( PIN_DATA[pin].label==TQString("GND") ); } Port::IODir Port::Parallel::ioDir(uint pin) const @@ -155,7 +155,7 @@ const Port::Parallel::RequestData Port::Parallel::REQUEST_DATA[Nb_RequestTypes] #endif }; -Port::Parallel::Parallel(const QString &device, Log::Base &base) +Port::Parallel::Parallel(const TQString &device, Log::Base &base) : Base(base), _fd(-1), _device(device) { for (uint i=0; i<Nb_RequestTypes; i++) _images[i] = 0; @@ -166,17 +166,17 @@ bool Port::Parallel::internalOpen() #if defined(HAVE_PPDEV) _fd = ::open(_device.latin1(), O_RDWR); if ( _fd<0 ) { - setSystemError(i18n("Could not open device \"%1\"").arg(_device)); + setSystemError(i18n("Could not open device \"%1\"").tqarg(_device)); return false; } if ( ioctl(_fd, PPCLAIM)<0 ) { - setSystemError(i18n("Could not claim device \"%1\": check it is read/write enabled").arg(_device)); + setSystemError(i18n("Could not claim device \"%1\": check it is read/write enabled").tqarg(_device)); return false; } #elif defined(HAVE_PPBUS) _fd = ::open(_device.latin1(), O_RDWR); if ( _fd<0 ) { - setSystemError(i18n("Could not open device \"%1\"").arg(_device)); + setSystemError(i18n("Could not open device \"%1\"").tqarg(_device)); return false; } #endif @@ -203,12 +203,12 @@ bool Port::Parallel::setPinOn(uint pin, bool on, LogicType type) Q_ASSERT( PIN_DATA[pin].dir==Out ); RequestType rtype = PIN_DATA[pin].rType; Q_ASSERT( rtype!=Nb_RequestTypes ); - uchar mask = PIN_DATA[pin].mask; - uchar c = (XOR(type==NegativeLogic, on) ? _images[rtype] | mask : _images[rtype] & ~mask); + uchar tqmask = PIN_DATA[pin].tqmask; + uchar c = (XOR(type==NegativeLogic, on) ? _images[rtype] | tqmask : _images[rtype] & ~tqmask); int request = REQUEST_DATA[rtype].write; Q_ASSERT( request!=0 ); if ( ioctl(_fd, request, &c)<0 ) { - setSystemError(i18n("Error setting pin %1 to %2").arg(PIN_DATA[pin].label).arg(on)); + setSystemError(i18n("Error setting pin %1 to %2").tqarg(PIN_DATA[pin].label).tqarg(on)); return false; } _images[rtype] = c; @@ -228,19 +228,19 @@ bool Port::Parallel::readPin(uint pin, LogicType type, bool &value) Q_ASSERT( request!=0 ); uchar c = 0; if ( ioctl(_fd, request, &c)<0 ) { - setSystemError(i18n("Error reading bit on pin %1").arg(PIN_DATA[pin].label)); + setSystemError(i18n("Error reading bit on pin %1").tqarg(PIN_DATA[pin].label)); return false; } _images[rtype] = c; - value = (type==NegativeLogic ? ~c : c ) & PIN_DATA[pin].mask; + value = (type==NegativeLogic ? ~c : c ) & PIN_DATA[pin].tqmask; #endif return true; } -void Port::Parallel::setSystemError(const QString &message) +void Port::Parallel::setSystemError(const TQString &message) { #if defined(HAVE_PPDEV) || defined(HAVE_PPBUS) - log(Log::LineType::Error, message + QString(" (errno=%1).").arg(strerror(errno))); + log(Log::LineType::Error, message + TQString(" (errno=%1).").tqarg(strerror(errno))); #else Q_UNUSED(message); #endif diff --git a/src/common/port/parallel.h b/src/common/port/parallel.h index 1473db0..2dbfc71 100644 --- a/src/common/port/parallel.h +++ b/src/common/port/parallel.h @@ -22,47 +22,47 @@ namespace Port class Parallel : public Base { public: - Parallel(const QString &device, Log::Base &base); + Parallel(const TQString &device, Log::Base &base); virtual ~Parallel() { close(); } virtual Description description() const { return Description(PortType::Parallel, _device); } - static IODirs probe(const QString &device); - static const QStringList &probedDeviceList(); + static IODirs probe(const TQString &device); + static const TQStringList &probedDeviceList(); static bool isAvailable(); enum Pin { DS = 0, D0, D1, D2, D3, D4, D5, D6, D7, ACK, BUSY, PAPER, SELin, LF, ERROR, PRIME, SELout, P18, P19, P20, P21, P22, P23, P24, P25, Nb_Pins }; - enum RequestType { Control = 0, Status, Data, Nb_RequestTypes }; + enum RequestType { Control = 0, tqStatus, Data, Nb_RequestTypes }; struct PPinData { RequestType rType; - uchar mask; + uchar tqmask; IODir dir; const char *label; }; static const PPinData PIN_DATA[Nb_Pins]; virtual bool setPinOn(uint pin, bool on, LogicType type); virtual bool readPin(uint pin, LogicType type, bool &value); - virtual QValueVector<PinData> pinData(IODir dir) const; + virtual TQValueVector<PinData> pinData(IODir dir) const; virtual bool isGroundPin(uint pin) const; virtual uint groundPin() const { return P25; } virtual IODir ioDir(uint pin) const; private: int _fd; - QString _device; + TQString _device; struct RequestData { int read, write; }; static const RequestData REQUEST_DATA[Nb_RequestTypes]; uchar _images[Nb_RequestTypes]; - static QStringList *_list; - static QStringList deviceList(); + static TQStringList *_list; + static TQStringList deviceList(); virtual bool internalOpen(); virtual void internalClose(); - virtual void setSystemError(const QString &message); + virtual void setSystemError(const TQString &message); }; } // namespace diff --git a/src/common/port/port.cpp b/src/common/port/port.cpp index c56c120..3df2d48 100644 --- a/src/common/port/port.cpp +++ b/src/common/port/port.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ #include "port.h" -#if defined(Q_WS_WIN) +#if defined(TQ_WS_WIN) # include <sys/timeb.h> #else # include <sys/time.h> @@ -65,16 +65,16 @@ const PortType::Data PortType::DATA[Nb_Types] = { const char * const Port::IO_DIR_NAMES[3] = { "no_io", "in", "out" }; -QStringList Port::probedDeviceList(PortType type) +TQStringList Port::probedDeviceList(PortType type) { - if ( !isAvailable(type) ) return QStringList(); + if ( !isAvailable(type) ) return TQStringList(); switch (type.type()) { case PortType::Serial: return Serial::probedDeviceList(); case PortType::Parallel: return Parallel::probedDeviceList(); case PortType::USB: return USB::probedDeviceList(); case PortType::Nb_Types: break; } - return QStringList(); + return TQStringList(); } bool Port::isAvailable(PortType type) @@ -88,11 +88,11 @@ bool Port::isAvailable(PortType type) return false; } -PortType Port::findType(const QString &portDevice) +PortType Port::findType(const TQString &portDevice) { FOR_EACH(PortType, type) { if ( !type.data().withDevice ) continue; - if ( probedDeviceList(type).contains(portDevice) ) return type; + if ( probedDeviceList(type).tqcontains(portDevice) ) return type; } return PortType::Nb_Types; } diff --git a/src/common/port/port.h b/src/common/port/port.h index f385deb..7c644cd 100644 --- a/src/common/port/port.h +++ b/src/common/port/port.h @@ -9,7 +9,7 @@ #ifndef PORT_H #define PORT_H -#include <qstringlist.h> +#include <tqstringlist.h> #include "common/global/global.h" #include "common/common/key_enum.h" @@ -34,17 +34,17 @@ extern void usleep(uint us); // in microseconds class Description { public: Description() : type(PortType::Nb_Types) {} - Description(PortType ptype, const QString &pdevice) : type(ptype), device(pdevice) {} + Description(PortType ptype, const TQString &pdevice) : type(ptype), device(pdevice) {} PortType type; - QString device; + TQString device; }; enum IODir { NoIO = 0, In = 1, Out = 2 }; extern const char * const IO_DIR_NAMES[3]; - Q_DECLARE_FLAGS(IODirs, IODir) - Q_DECLARE_OPERATORS_FOR_FLAGS(IODirs) - extern QStringList probedDeviceList(PortType type); - extern PortType findType(const QString &device); + TQ_DECLARE_FLAGS(IODirs, IODir) + TQ_DECLARE_OPERATORS_FOR_FLAGS(IODirs) + extern TQStringList probedDeviceList(PortType type); + extern PortType findType(const TQString &device); extern bool isAvailable(PortType type); struct PinData { uint pin; diff --git a/src/common/port/port_base.cpp b/src/common/port/port_base.cpp index 7528eeb..0112a1b 100644 --- a/src/common/port/port_base.cpp +++ b/src/common/port/port_base.cpp @@ -28,31 +28,31 @@ void Port::Base::close() bool Port::Base::send(const char *data, uint size, uint timeout) { - log(Log::DebugLevel::LowLevel, QString("Sending: \"%1\"").arg(toPrintable(data, size, PrintAlphaNum))); + log(Log::DebugLevel::LowLevel, TQString("Sending: \"%1\"").tqarg(toPrintable(data, size, PrintAlphaNum))); return internalSend(data, size, timeout); } -bool Port::Base::receive(uint size, QString &s, uint timeout) +bool Port::Base::receive(uint size, TQString &s, uint timeout) { - QMemArray<uchar> a; + TQMemArray<uchar> a; if ( !receive(size, a, timeout) ) return false; s.fill(0, size); for (uint i=0; i<size; i++) s[i] = a[i]; return true; } -bool Port::Base::receive(uint size, QMemArray<uchar> &a, uint timeout) +bool Port::Base::receive(uint size, TQMemArray<uchar> &a, uint timeout) { a.resize(size); bool ok = internalReceive(size, (char *)a.data(), timeout); - if (ok) log(Log::DebugLevel::LowLevel, QString("Received: \"%1\"").arg(toPrintable(a, PrintAlphaNum))); + if (ok) log(Log::DebugLevel::LowLevel, TQString("Received: \"%1\"").tqarg(toPrintable(a, PrintAlphaNum))); return ok; } bool Port::Base::receiveChar(char &c, uint timeout) { if ( !internalReceive(1, &c, timeout) ) return false; - log(Log::DebugLevel::LowLevel, QString("Received: \"%1\"").arg(toPrintable(c, PrintAlphaNum))); + log(Log::DebugLevel::LowLevel, TQString("Received: \"%1\"").tqarg(toPrintable(c, PrintAlphaNum))); return true; } @@ -66,10 +66,10 @@ bool Port::Base::readPin(uint, LogicType, bool &) qFatal("readPin not implemented"); return 0; } -QValueVector<Port::PinData> Port::Base::pinData(IODir) const +TQValueVector<Port::PinData> Port::Base::pinData(IODir) const { qFatal("pinData not implemented"); - return QValueVector<PinData>(); + return TQValueVector<PinData>(); } bool Port::Base::isGroundPin(uint) const { @@ -87,22 +87,22 @@ Port::IODir Port::Base::ioDir(uint) const return NoIO; } -void Port::Base::log(Log::LineType lineType, const QString &message) +void Port::Base::log(Log::LineType lineType, const TQString &message) { if ( lineType==Log::LineType::Error && _closing ) return; Log::Base::log(lineType, description().type.label() + ": " + message); if ( lineType==Log::LineType::Error ) close(); } -void Port::Base::log(Log::DebugLevel level, const QString &message) +void Port::Base::log(Log::DebugLevel level, const TQString &message) { Log::Base::log(level, description().type.label() + ": " + message); } -void Port::Base::logData(const QString &) +void Port::Base::logData(const TQString &) { /* - QString vs; + TQString vs; for (uint i=0; i<s.length(); i++) { char c = s[i]; switch (c) { @@ -113,7 +113,7 @@ void Port::Base::logData(const QString &) default: { if ( c>=32 && c<=126 ) vs += c; else { - QString tmp; + TQString tmp; tmp.sprintf("\\x%02x", c); vs += tmp; } diff --git a/src/common/port/port_base.h b/src/common/port/port_base.h index 3ae4787..c48fed6 100644 --- a/src/common/port/port_base.h +++ b/src/common/port/port_base.h @@ -24,21 +24,21 @@ public: bool open(); void close(); - virtual void log(Log::LineType kind, const QString &message); - virtual void log(Log::DebugLevel level, const QString &message); - void logData(const QString &s); + virtual void log(Log::LineType kind, const TQString &message); + virtual void log(Log::DebugLevel level, const TQString &message); + void logData(const TQString &s); enum { DEFAULT_TIMEOUT = 3000 }; // 3s bool sendChar(char c, uint timeout = DEFAULT_TIMEOUT) { return send(&c, 1, timeout); } bool send(const char *data, uint size, uint timeout = DEFAULT_TIMEOUT); - bool send(const QMemArray<uchar> &a, uint timeout = DEFAULT_TIMEOUT) { return send((const char *)a.data(), a.count(), timeout); } + bool send(const TQMemArray<uchar> &a, uint timeout = DEFAULT_TIMEOUT) { return send((const char *)a.data(), a.count(), timeout); } bool receiveChar(char &c, uint timeout = DEFAULT_TIMEOUT); - bool receive(uint size, QString &s, uint timeout = DEFAULT_TIMEOUT); - bool receive(uint size, QMemArray<uchar> &a, uint timeout = DEFAULT_TIMEOUT); + bool receive(uint size, TQString &s, uint timeout = DEFAULT_TIMEOUT); + bool receive(uint size, TQMemArray<uchar> &a, uint timeout = DEFAULT_TIMEOUT); virtual bool setPinOn(uint pin, bool on, LogicType type); virtual bool readPin(uint pin, LogicType type, bool &value); - virtual QValueVector<PinData> pinData(IODir dir) const; + virtual TQValueVector<PinData> pinData(IODir dir) const; virtual bool isGroundPin(uint pin) const; virtual uint groundPin() const; virtual IODir ioDir(uint pin) const; @@ -48,7 +48,7 @@ protected: virtual void internalClose() = 0; virtual bool internalSend(const char *, uint, uint) { qFatal("Not implemented"); return false; } virtual bool internalReceive(uint, char *, uint) { qFatal("Not implemented"); return false; } - virtual void setSystemError(const QString &message) = 0; + virtual void setSystemError(const TQString &message) = 0; private: bool _closing; diff --git a/src/common/port/serial.cpp b/src/common/port/serial.cpp index b370d22..5942561 100644 --- a/src/common/port/serial.cpp +++ b/src/common/port/serial.cpp @@ -20,17 +20,17 @@ # include <errno.h> # include <unistd.h> // needed on some system #endif -#include <qdatetime.h> +#include <tqdatetime.h> //----------------------------------------------------------------------------- -QStringList *Port::Serial::_list = 0; +TQStringList *Port::Serial::_list = 0; #if defined(Q_OS_UNIX) const Port::Serial::Handle Port::Serial::INVALID_HANDLE = -1; #elif defined(Q_OS_WIN) const Port::Serial::Handle Port::Serial::INVALID_HANDLE = INVALID_HANDLE_VALUE; #endif -Port::Serial::Handle Port::Serial::openHandle(const QString &device, IODirs dirs) +Port::Serial::Handle Port::Serial::openHandle(const TQString &device, IODirs dirs) { #if defined(Q_OS_UNIX) // open non blocking: avoid missing DCD (comment from xwisp2) @@ -57,7 +57,7 @@ void Port::Serial::closeHandle(Handle handle) #endif } -Port::IODirs Port::Serial::probe(const QString &device) +Port::IODirs Port::Serial::probe(const TQString &device) { Handle handle = openHandle(device, In); if ( handle==INVALID_HANDLE ) return NoIO; @@ -68,35 +68,35 @@ Port::IODirs Port::Serial::probe(const QString &device) return (In | Out); } -QStringList Port::Serial::deviceList() +TQStringList Port::Serial::deviceList() { - QStringList list; + TQStringList list; #if defined(Q_OS_UNIX) // standard serport in user space - for (uint i=0; i<8; i++) list.append(QString("/dev/ttyS%1").arg(i)); + for (uint i=0; i<8; i++) list.append(TQString("/dev/ttyS%1").tqarg(i)); // new devfs serport flavour - for (uint i=0; i<8; i++) list.append(QString("/dev/tts/%1").arg(i)); + for (uint i=0; i<8; i++) list.append(TQString("/dev/tts/%1").tqarg(i)); // standard USB serport in user space - for (uint i=0; i<8; i++) list.append(QString("/dev/ttyUSB%1").arg(i)); + for (uint i=0; i<8; i++) list.append(TQString("/dev/ttyUSB%1").tqarg(i)); // new devfs USB serport flavour - for (uint i=0; i<8; i++) list.append(QString("/dev/usb/tts/%1").arg(i)); + for (uint i=0; i<8; i++) list.append(TQString("/dev/usb/tts/%1").tqarg(i)); // FreeBSD - for (uint i=0; i<8; i++) list.append(QString("/dev/ttyd%1").arg(i)); + for (uint i=0; i<8; i++) list.append(TQString("/dev/ttyd%1").tqarg(i)); // Slackware 11 devfs USB Serial port support. - for (uint i=0; i<8; i++) list.append(QString("/dev/tts/USB%1").arg(i)); + for (uint i=0; i<8; i++) list.append(TQString("/dev/tts/USB%1").tqarg(i)); // MacOSX devfs USB Serial port support. list.append("/dev/tty.usbserial"); #elif defined(Q_OS_WIN) - for (uint i=1; i<10; i++) list.append(QString("COM%1").arg(i)); + for (uint i=1; i<10; i++) list.append(TQString("COM%1").tqarg(i)); #endif return list; } -const QStringList &Port::Serial::probedDeviceList() +const TQStringList &Port::Serial::probedDeviceList() { if ( _list==0 ) { - QStringList all = deviceList(); - _list = new QStringList; + TQStringList all = deviceList(); + _list = new TQStringList; for (uint i=0; i<uint(all.count()); i++) if( probe(all[i]) & (In | Out) ) _list->append(all[i]); } @@ -130,9 +130,9 @@ const Port::Serial::SPinData Port::Serial::PIN_DATA[Nb_Pins] = { { Out, "RI" } }; -QValueVector<Port::PinData> Port::Serial::pinData(IODir dir) const +TQValueVector<Port::PinData> Port::Serial::pinData(IODir dir) const { - QValueVector<PinData> v; + TQValueVector<PinData> v; for (uint i=0; i<Nb_Pins; i++) { if ( PIN_DATA[i].dir!=dir ) continue; PinData pd = { i, PIN_DATA[i].label }; @@ -142,7 +142,7 @@ QValueVector<Port::PinData> Port::Serial::pinData(IODir dir) const } bool Port::Serial::isGroundPin(uint pin) const { - return ( PIN_DATA[pin].label==QString("GND") ); + return ( PIN_DATA[pin].label==TQString("GND") ); } Port::IODir Port::Serial::ioDir(uint pin) const @@ -150,7 +150,7 @@ Port::IODir Port::Serial::ioDir(uint pin) const return PIN_DATA[pin].dir; } -Port::Serial::Serial(const QString &device, Properties properties, Log::Base &base) +Port::Serial::Serial(const TQString &device, Properties properties, Log::Base &base) : Base(base), _device(device), _properties(properties), _fd(INVALID_HANDLE) {} @@ -187,7 +187,7 @@ bool Port::Serial::internalOpen() { _fd = openHandle(_device, In | Out); if ( _fd==INVALID_HANDLE ) { - setSystemError(i18n("Could not open device \"%1\" read-write").arg(_device)); + setSystemError(i18n("Could not open device \"%1\" read-write").tqarg(_device)); return false; } if ( !getParameters(_oldParameters) ) return false; // save configuration @@ -216,7 +216,7 @@ void Port::Serial::internalClose() bool Port::Serial::internalSend(const char *data, uint size, uint timeout) { if ( _fd==INVALID_HANDLE ) return false; - QTime time; + TQTime time; time.start(); for (uint todo=size; todo!=0; ) { #if defined(Q_OS_UNIX) @@ -232,7 +232,7 @@ bool Port::Serial::internalSend(const char *data, uint size, uint timeout) if ( res>0 ) todo -= res; else { if ( uint(time.elapsed())>timeout ) { - log(Log::LineType::Error, i18n("Timeout sending data (%1/%2 bytes sent).").arg(size-todo).arg(size)); + log(Log::LineType::Error, i18n("Timeout sending data (%1/%2 bytes sent).").tqarg(size-todo).tqarg(size)); return false; } msleep(1); @@ -245,7 +245,7 @@ bool Port::Serial::internalSend(const char *data, uint size, uint timeout) bool Port::Serial::internalReceive(uint size, char *data, uint timeout) { if ( _fd==INVALID_HANDLE ) return false; - QTime time; + TQTime time; time.start(); for(uint todo=size; todo!=0; ) { #if defined(Q_OS_UNIX) @@ -277,7 +277,7 @@ bool Port::Serial::internalReceive(uint size, char *data, uint timeout) if ( res>0 ) todo -= res; else { if ( uint(time.elapsed())>timeout ) { - log(Log::LineType::Error, i18n("Timeout receiving data (%1/%2 bytes received).").arg(size-todo).arg(size)); + log(Log::LineType::Error, i18n("Timeout receiving data (%1/%2 bytes received).").tqarg(size-todo).tqarg(size)); return false; } msleep(1); @@ -292,7 +292,7 @@ bool Port::Serial::drain(uint timeout) #if defined(Q_OS_UNIX) // tcdrain will block if the serial cable is disconnected // so we first check for data in output buffer... - QTime time; + TQTime time; time.start(); for (;;) { int nb; @@ -303,7 +303,7 @@ bool Port::Serial::drain(uint timeout) if ( nb==0 ) break; if ( uint(time.elapsed())>timeout ) { _fd = INVALID_HANDLE; // otherwise close blocks... - log(Log::LineType::Error, i18n("Timeout sending data (%1 bytes left).").arg(nb)); + log(Log::LineType::Error, i18n("Timeout sending data (%1 bytes left).").tqarg(nb)); return false; } } @@ -364,7 +364,7 @@ bool Port::Serial::setPinOn(uint pin, bool on, LogicType type) Q_ASSERT( pin<Nb_Pins ); Q_ASSERT( PIN_DATA[pin].dir==Out ); if ( !internalSetPinOn(Pin(pin), on) ) { - setSystemError(i18n("Error setting bit %1 of serial port to %2").arg(PIN_DATA[pin].label).arg(on)); + setSystemError(i18n("Error setting bit %1 of serial port to %2").tqarg(PIN_DATA[pin].label).tqarg(on)); return false; } return true; @@ -375,19 +375,19 @@ bool Port::Serial::internalReadPin(Pin pin, LogicType type, bool &value) #if defined(Q_OS_UNIX) int bits; if ( ioctl(_fd, TIOCMGET, &bits)<0 ) return false; - int mask = 0; + int tqmask = 0; switch (pin) { - case DCD: mask = TIOCM_CD; break; - case RX : mask = TIOCM_SR; break; - case DSR: mask = TIOCM_DSR; break; - case CTS: mask = TIOCM_CTS; break; + case DCD: tqmask = TIOCM_CD; break; + case RX : tqmask = TIOCM_SR; break; + case DSR: tqmask = TIOCM_DSR; break; + case CTS: tqmask = TIOCM_CTS; break; default: Q_ASSERT(false); return false; } - value = ((type==NegativeLogic ? ~bits : bits) & mask); + value = ((type==NegativeLogic ? ~bits : bits) & tqmask); return true; #elif defined(Q_OS_WIN) DWORD status; - if ( GetCommModemStatus(_fd, &status)==0 ) return false; + if ( GetCommModemtqStatus(_fd, &status)==0 ) return false; switch (pin) { case DCD: value = (status & MS_RLSD_ON); break; case DSR: value = (status & MS_DSR_ON); break; @@ -406,7 +406,7 @@ bool Port::Serial::internalReadPin(Pin pin, LogicType type, bool &value) Q_ASSERT( pin<Nb_Pins ); Q_ASSERT( PIN_DATA[pin].dir==In ); if ( !internalReadPin(Pin(pin), type, value) ) { - setSystemError(i18n("Error reading serial pin %1").arg(PIN_DATA[pin].label)); + setSystemError(i18n("Error reading serial pin %1").tqarg(PIN_DATA[pin].label)); return false; } return true; @@ -510,14 +510,14 @@ bool Port::Serial::setHardwareFlowControl(bool on) return setParameters(parameters); } -void Port::Serial::setSystemError(const QString &message) +void Port::Serial::setSystemError(const TQString &message) { #if defined(Q_OS_UNIX) - log(Log::LineType::Error, message + QString(" (errno=%1)").arg(strerror(errno))); + log(Log::LineType::Error, message + TQString(" (errno=%1)").tqarg(strerror(errno))); #elif defined(Q_OS_WIN) LPVOID lpMsgBuf; FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lpMsgBuf, 0, NULL); - log(Log::LineType::Error, message + QString(" (last error=%1 %2)").arg(GetLastError()).arg((const char *)(LPCTSTR)lpMsgBuf)); + log(Log::LineType::Error, message + TQString(" (last error=%1 %2)").tqarg(GetLastError()).tqarg((const char *)(LPCTSTR)lpMsgBuf)); LocalFree(lpMsgBuf); #endif } diff --git a/src/common/port/serial.h b/src/common/port/serial.h index b2911e6..9296068 100644 --- a/src/common/port/serial.h +++ b/src/common/port/serial.h @@ -37,21 +37,21 @@ public: enum Property { NoProperty = 0, NeedDrain = 1, NeedFlush = 2, NeedBreak = 4, Blocking = 8 }; - Q_DECLARE_FLAGS(Properties, Property) + TQ_DECLARE_FLAGS(Properties, Property) - Serial(const QString &device, Properties properties, Log::Base &base); + Serial(const TQString &device, Properties properties, Log::Base &base); virtual ~Serial() { close(); } virtual Description description() const { return Description(PortType::Serial, _device); } - static const QStringList &probedDeviceList(); - static IODirs probe(const QString &device); + static const TQStringList &probedDeviceList(); + static IODirs probe(const TQString &device); static bool isAvailable() { return true; } enum InputFlag { NoInputFlag = 0, IgnoreBreak = 1, IgnoreParity = 2 }; - Q_DECLARE_FLAGS(InputFlags, InputFlag) + TQ_DECLARE_FLAGS(InputFlags, InputFlag) enum ControlFlag { NoControlFlag = 0, ByteSize8 = 1, HardwareFlowControl = 2, EnableReceiver = 4, IgnoreControlLines = 8 }; - Q_DECLARE_FLAGS(ControlFlags, ControlFlag) + TQ_DECLARE_FLAGS(ControlFlags, ControlFlag) bool setMode(InputFlags inputFlags, ControlFlags controlFlags, Speed speed, uint readTimeout); // in ms bool drain(uint timeout); bool flush(uint timeout); @@ -66,13 +66,13 @@ public: static const SPinData PIN_DATA[Nb_Pins]; virtual bool setPinOn(uint pin, bool on, LogicType type); virtual bool readPin(uint pin, LogicType type, bool &value); - virtual QValueVector<PinData> pinData(IODir dir) const; + virtual TQValueVector<PinData> pinData(IODir dir) const; virtual bool isGroundPin(uint pin) const; virtual uint groundPin() const { return SG; } virtual IODir ioDir(uint pin) const; private: - QString _device; + TQString _device; Properties _properties; #if defined(Q_OS_UNIX) typedef int Handle; @@ -93,20 +93,20 @@ private: virtual void internalClose(); virtual bool internalSend(const char *data, uint size, uint timeout); virtual bool internalReceive(uint size, char *data, uint timeout); - virtual void setSystemError(const QString &message); + virtual void setSystemError(const TQString &message); bool internalSetPinOn(Pin pin, bool on); bool internalReadPin(Pin pin, LogicType type, bool &value); static const Handle INVALID_HANDLE; - static Handle openHandle(const QString &device, IODirs dirs); + static Handle openHandle(const TQString &device, IODirs dirs); static void closeHandle(Handle handle); - static QStringList *_list; - static QStringList deviceList(); + static TQStringList *_list; + static TQStringList deviceList(); static void setHardwareFlowControl(Parameters ¶meters, bool on); }; -Q_DECLARE_OPERATORS_FOR_FLAGS(Serial::Properties) -Q_DECLARE_OPERATORS_FOR_FLAGS(Serial::InputFlags) -Q_DECLARE_OPERATORS_FOR_FLAGS(Serial::ControlFlags) +TQ_DECLARE_OPERATORS_FOR_FLAGS(Serial::Properties) +TQ_DECLARE_OPERATORS_FOR_FLAGS(Serial::InputFlags) +TQ_DECLARE_OPERATORS_FOR_FLAGS(Serial::ControlFlags) } // namespace diff --git a/src/common/port/usb_port.cpp b/src/common/port/usb_port.cpp index 392b483..80e7de2 100644 --- a/src/common/port/usb_port.cpp +++ b/src/common/port/usb_port.cpp @@ -14,7 +14,7 @@ #ifdef HAVE_USB # include <usb.h> #endif -#include <qdatetime.h> +#include <tqdatetime.h> #include "common/common/version_data.h" #include "common/common/number.h" @@ -38,7 +38,7 @@ void Port::USB::initialize() #ifdef HAVE_USB usb_init(); VersionData vd = VersionData::fromString(LIBUSB_VERSION); - QString s = QString("libusb %1").arg(vd.pretty()); + TQString s = TQString("libusb %1").tqarg(vd.pretty()); if ( vd<VersionData(0, 1, 8) ) qWarning("%s: may be too old (you need at least version 0.1.8)", s.latin1()); #endif } @@ -79,7 +79,7 @@ bool Port::USB::findBulk(const struct usb_device *dev) for (int a=0; a < dev->config[c].interface[i].num_altsetting; a++) { qDebug(" Looking at altsetting %d...This altsetting has %d endpoints.", a, dev->config[c].interface[i].altsetting[a].bNumEndpoints); for (int e=0; e < dev->config[c].interface[i].altsetting[a].bNumEndpoints; e++) { - QString s; + TQString s; s.sprintf(" Endpoint %d: Address %02xh, attributes %02xh ", e, dev->config[c].interface[i].altsetting[a].endpoint[e].bEndpointAddress, dev->config[c].interface[i].altsetting[a].endpoint[e].bmAttributes); uchar attribs = (dev->config[c].interface[i].altsetting[a].endpoint[e].bmAttributes & 3); switch (attribs) { @@ -122,17 +122,17 @@ bool Port::USB::findBulk(const struct usb_device *dev) return true; } -QStringList Port::USB::probedDeviceList() +TQStringList Port::USB::probedDeviceList() { initialize(); - QStringList list; + TQStringList list; #ifdef HAVE_USB usb_init(); // needed ? for (usb_bus *bus=getBusses(); bus; bus=bus->next) { for (struct usb_device *dev=bus->devices; dev; dev=dev->next) { if ( dev->descriptor.idVendor==0 ) continue; // controller - list.append(QString("Vendor Id: %1 - Product Id: %2") - .arg(toLabel(NumberBase::Hex, dev->descriptor.idVendor, 4)).arg(toLabel(NumberBase::Hex, dev->descriptor.idProduct, 4))); + list.append(TQString("Vendor Id: %1 - Product Id: %2") + .tqarg(toLabel(NumberBase::Hex, dev->descriptor.idVendor, 4)).tqarg(toLabel(NumberBase::Hex, dev->descriptor.idProduct, 4))); } } #endif @@ -176,10 +176,10 @@ Port::USB::~USB() delete _private; } -void Port::USB::setSystemError(const QString &message) +void Port::USB::setSystemError(const TQString &message) { #ifdef HAVE_USB - log(Log::LineType::Error, message + QString(" (err=%1).").arg(usb_strerror())); + log(Log::LineType::Error, message + TQString(" (err=%1).").tqarg(usb_strerror())); #else log(Log::LineType::Error, message); #endif @@ -192,7 +192,7 @@ void Port::USB::tryToDetachDriver() log(Log::DebugLevel::Extra, "find if there is already an installed driver"); char dname[256] = ""; if ( usb_get_driver_np(_handle, _interface, dname, 255)<0 ) return; - log(Log::DebugLevel::Normal, QString(" a driver \"%1\" is already installed...").arg(dname)); + log(Log::DebugLevel::Normal, TQString(" a driver \"%1\" is already installed...").tqarg(dname)); # if defined(LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP) && LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP usb_detach_kernel_driver_np(_handle, _interface); log(Log::DebugLevel::Normal, " try to detach it..."); @@ -208,10 +208,10 @@ bool Port::USB::internalOpen() _device = findDevice(_vendorId, _productId); if ( _device==0 ) { log(Log::LineType::Error, i18n("Could not find USB device (vendor=%1 product=%2).") - .arg(toLabel(NumberBase::Hex, _vendorId, 4)).arg(toLabel(NumberBase::Hex, _productId, 4))); + .tqarg(toLabel(NumberBase::Hex, _vendorId, 4)).tqarg(toLabel(NumberBase::Hex, _productId, 4))); return false; } - log(Log::DebugLevel::Extra, QString("found USB device as \"%1\" on bus \"%2\"").arg(_device->filename).arg(_device->bus->dirname)); + log(Log::DebugLevel::Extra, TQString("found USB device as \"%1\" on bus \"%2\"").tqarg(_device->filename).tqarg(_device->bus->dirname)); _handle = usb_open(_device); if ( _handle==0 ) { setSystemError(i18n("Error opening USB device.")); @@ -239,11 +239,11 @@ bool Port::USB::internalOpen() uint old = _config; i = 0; _config = _device->config[i].bConfigurationValue; - log(Log::LineType::Warning, i18n("Configuration %1 not present: using %2").arg(old).arg(_config)); + log(Log::LineType::Warning, i18n("Configuration %1 not present: using %2").tqarg(old).tqarg(_config)); } const usb_config_descriptor &configd = _device->config[i]; if ( usb_set_configuration(_handle, _config)<0 ) { - setSystemError(i18n("Error setting USB configuration %1.").arg(_config)); + setSystemError(i18n("Error setting USB configuration %1.").tqarg(_config)); return false; } for (i=0; i<configd.bNumInterfaces; i++) @@ -252,15 +252,15 @@ bool Port::USB::internalOpen() uint old = _interface; i = 0; _interface = configd.interface[i].altsetting[0].bInterfaceNumber; - log(Log::LineType::Warning, i18n("Interface %1 not present: using %2").arg(old).arg(_interface)); + log(Log::LineType::Warning, i18n("Interface %1 not present: using %2").tqarg(old).tqarg(_interface)); } _private->_interface = &(configd.interface[i].altsetting[0]); if ( usb_claim_interface(_handle, _interface)<0 ) { - setSystemError(i18n("Could not claim USB interface %1").arg(_interface)); + setSystemError(i18n("Could not claim USB interface %1").tqarg(_interface)); return false; } - log(Log::DebugLevel::Max, QString("alternate setting is %1").arg(_private->_interface->bAlternateSetting)); - log(Log::DebugLevel::Max, QString("USB bcdDevice: %1").arg(toHexLabel(_device->descriptor.bcdDevice, 4))); + log(Log::DebugLevel::Max, TQString("alternate setting is %1").tqarg(_private->_interface->bAlternateSetting)); + log(Log::DebugLevel::Max, TQString("USB bcdDevice: %1").tqarg(toHexLabel(_device->descriptor.bcdDevice, 4))); return true; #else log(Log::LineType::Error, i18n("USB support disabled")); @@ -284,9 +284,9 @@ bool Port::USB::sendControlMessage(const ControlMessageData &data) { if ( hasError() ) return false; #ifdef HAVE_USB - QString s = data.bytes; + TQString s = data.bytes; uint length = strlen(data.bytes) / 2; - QByteArray ba(length); + TQByteArray ba(length); for (uint i=0; i<length; i++) ba[i] = fromString(NumberBase::Hex, s.mid(2*i, 2), 0); int res = usb_control_msg(_handle, data.type, data.request, data.value, 0, ba.data(), length, 1000); // 1s @@ -342,10 +342,10 @@ bool Port::USB::write(uint ep, const char *data, uint size) #ifdef HAVE_USB IODir dir = endpointDir(ep); EndpointMode mode = endpointMode(ep); - log(Log::DebugLevel::LowLevel, QString("write to endpoint %1 (%2 - %3) %4 chars: \"%5\"") - .arg(toHexLabel(ep, 2)).arg(ENDPOINT_MODE_NAMES[mode]).arg(IO_DIR_NAMES[dir]).arg(size).arg(toPrintable(data, size, PrintEscapeAll))); + log(Log::DebugLevel::LowLevel, TQString("write to endpoint %1 (%2 - %3) %4 chars: \"%5\"") + .tqarg(toHexLabel(ep, 2)).tqarg(ENDPOINT_MODE_NAMES[mode]).tqarg(IO_DIR_NAMES[dir]).tqarg(size).tqarg(toPrintable(data, size, PrintEscapeAll))); Q_ASSERT( dir==Out ); - QTime time; + TQTime time; time.start(); int todo = size; for (;;) { @@ -356,8 +356,8 @@ bool Port::USB::write(uint ep, const char *data, uint size) //qDebug("res: %i", res); if ( res==todo ) break; if ( uint(time.elapsed())>3000 ) { // 3 s - if ( res<0 ) setSystemError(i18n("Error sending data (ep=%1 res=%2)").arg(toHexLabel(ep, 2)).arg(res)); - else log(Log::LineType::Error, i18n("Timeout: only some data sent (%1/%2 bytes).").arg(size-todo).arg(size)); + if ( res<0 ) setSystemError(i18n("Error sending data (ep=%1 res=%2)").tqarg(toHexLabel(ep, 2)).tqarg(res)); + else log(Log::LineType::Error, i18n("Timeout: only some data sent (%1/%2 bytes).").tqarg(size-todo).tqarg(size)); return false; } if ( res==0 ) log(Log::DebugLevel::Normal, i18n("Nothing sent: retrying...")); @@ -376,10 +376,10 @@ bool Port::USB::read(uint ep, char *data, uint size, bool *poll) #ifdef HAVE_USB IODir dir = endpointDir(ep); EndpointMode mode = endpointMode(ep); - log(Log::DebugLevel::LowLevel, QString("read from endpoint %1 (%2 - %3) %4 chars") - .arg(toHexLabel(ep, 2)).arg(ENDPOINT_MODE_NAMES[mode]).arg(IO_DIR_NAMES[dir]).arg(size)); + log(Log::DebugLevel::LowLevel, TQString("read from endpoint %1 (%2 - %3) %4 chars") + .tqarg(toHexLabel(ep, 2)).tqarg(ENDPOINT_MODE_NAMES[mode]).tqarg(IO_DIR_NAMES[dir]).tqarg(size)); Q_ASSERT( dir==In ); - QTime time; + TQTime time; time.start(); int todo = size; for (;;) { @@ -390,8 +390,8 @@ bool Port::USB::read(uint ep, char *data, uint size, bool *poll) //qDebug("res: %i", res); if ( res==todo ) break; if ( uint(time.elapsed())>3000 ) { // 3 s: seems to help icd2 in some case (?) - if ( res<0 ) setSystemError(i18n("Error receiving data (ep=%1 res=%2)").arg(toHexLabel(ep, 2)).arg(res)); - else log(Log::LineType::Error, i18n("Timeout: only some data received (%1/%2 bytes).").arg(size-todo).arg(size)); + if ( res<0 ) setSystemError(i18n("Error receiving data (ep=%1 res=%2)").tqarg(toHexLabel(ep, 2)).tqarg(res)); + else log(Log::LineType::Error, i18n("Timeout: only some data received (%1/%2 bytes).").tqarg(size-todo).tqarg(size)); return false; } if ( res==0 ) { diff --git a/src/common/port/usb_port.h b/src/common/port/usb_port.h index 73961cc..0da7aa1 100644 --- a/src/common/port/usb_port.h +++ b/src/common/port/usb_port.h @@ -27,11 +27,11 @@ class USB : public Base public: USB(Log::Base &base, uint vendorId, uint productId, uint config, uint interface); virtual ~USB(); - virtual Description description() const { return Description(PortType::USB, QString::null); } + virtual Description description() const { return Description(PortType::USB, TQString()); } static struct usb_device *findDevice(uint vendorId, uint productId); static bool isAvailable(); - static QStringList probedDeviceList(); + static TQStringList probedDeviceList(); struct ControlMessageData { int type, request, value; @@ -56,7 +56,7 @@ private: virtual bool internalOpen(); virtual void internalClose(); - virtual void setSystemError(const QString &message); + virtual void setSystemError(const TQString &message); void tryToDetachDriver(); static bool _initialized; |