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/piklab-coff | |
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/piklab-coff')
-rw-r--r-- | src/piklab-coff/main.cpp | 68 | ||||
-rw-r--r-- | src/piklab-coff/main.h | 23 |
2 files changed, 46 insertions, 45 deletions
diff --git a/src/piklab-coff/main.cpp b/src/piklab-coff/main.cpp index bc24b53..9e865e7 100644 --- a/src/piklab-coff/main.cpp +++ b/src/piklab-coff/main.cpp @@ -51,7 +51,7 @@ CLI::Main::Main() CLI::Main::~Main() {} -CLI::ExitCode CLI::Main::prepareCommand(const QString &command) +CLI::ExitCode CLI::Main::prepareCommand(const TQString &command) { const CommandData *data = findCommandData(command); CommandProperties properties = static_cast<CommandProperties>(data->properties); @@ -76,9 +76,9 @@ CLI::ExitCode CLI::Main::prepareCommand(const QString &command) return OK; } -QString CLI::Main::prettyAuxSymbol(const Coff::AuxSymbol &aux) +TQString CLI::Main::prettyAuxSymbol(const Coff::AuxSymbol &aux) { - QString s = (aux.type()==Coff::AuxSymbolType::Nb_Types ? "?" : aux.type().label()); + TQString s = (aux.type()==Coff::AuxSymbolType::Nb_Types ? "?" : aux.type().label()); switch (aux.type().type()) { case Coff::AuxSymbolType::Direct: break; case Coff::AuxSymbolType::File: s += "=" + static_cast<const Coff::AuxSymbolFile &>(aux).filename(); break; @@ -89,29 +89,29 @@ QString CLI::Main::prettyAuxSymbol(const Coff::AuxSymbol &aux) return s; } -QString CLI::Main::prettySymbol(const Coff::Symbol &sym) +TQString CLI::Main::prettySymbol(const Coff::Symbol &sym) { - QStringList saux; + TQStringList saux; for (uint i=0; i<uint(sym.auxSymbols().count()); i++) saux += prettyAuxSymbol(*sym.auxSymbols()[i]); - QString s = (sym.auxSymbols().count()!=0 ? " aux=[" + saux.join(" ") + "]" : QString::null); - QStringList slist; - if ( sym.sectionType()!=Coff::SymbolSectionType::Nb_Types ) slist += QString("sectionType=\"%1\"").arg(sym.sectionType().label()); - if ( sym.symbolClass()!=Coff::SymbolClass::Nb_Types ) slist += QString("class=\"%1\"").arg(sym.symbolClass().label()); + TQString s = (sym.auxSymbols().count()!=0 ? " aux=[" + saux.join(" ") + "]" : TQString()); + TQStringList slist; + if ( sym.sectionType()!=Coff::SymbolSectionType::Nb_Types ) slist += TQString("sectionType=\"%1\"").tqarg(sym.sectionType().label()); + if ( sym.symbolClass()!=Coff::SymbolClass::Nb_Types ) slist += TQString("class=\"%1\"").tqarg(sym.symbolClass().label()); if ( sym.type()!=Coff::SymbolType::Nb_Types ) { - slist += QString("type=\"%1\"").arg(sym.type().label()); - if ( sym.derivedType()!=Coff::SymbolDerivedType::Nb_Types ) slist += QString("/\"%1\"").arg(sym.derivedType().label()); + slist += TQString("type=\"%1\"").tqarg(sym.type().label()); + if ( sym.derivedType()!=Coff::SymbolDerivedType::Nb_Types ) slist += TQString("/\"%1\"").tqarg(sym.derivedType().label()); } return slist.join(" ") + s; } -CLI::ExitCode CLI::Main::executeCommandArchive(const QString &command, Log::KeyList &keys) +CLI::ExitCode CLI::Main::executeCommandArchive(const TQString &command, Log::KeyList &keys) { Coff::Archive coff(_source); if ( !coff.parse(*this) ) return ARG_ERROR; if ( command=="info" ) { keys = coff.information(); - keys.setTitle(QString::null); + keys.setTitle(TQString()); return OK; } @@ -128,7 +128,7 @@ CLI::ExitCode CLI::Main::executeCommandArchive(const QString &command, Log::KeyL return errorExit(i18n("Command not available for COFF of type Archive."), ARG_ERROR); } -CLI::ExitCode CLI::Main::executeCommandObject(const QString &command, Log::KeyList &keys) +CLI::ExitCode CLI::Main::executeCommandObject(const TQString &command, Log::KeyList &keys) { Coff::TextObject coff(_device, _source); if ( !coff.parse(*this) ) return ARG_ERROR; @@ -138,13 +138,13 @@ CLI::ExitCode CLI::Main::executeCommandObject(const QString &command, Log::KeyLi if ( command=="info" ) { keys = coff.information(); - keys.setTitle(QString::null); + keys.setTitle(TQString()); return OK; } if ( command=="variables" ) { keys.setTitle(i18n("Variables:")); - QMap<QString, Address>::const_iterator it; + TQMap<TQString, Address>::const_iterator it; for (it=coff.variables().begin(); it!=coff.variables().end(); ++it) keys.append(it.key(), toHexLabelAbs(it.data())); return OK; @@ -165,8 +165,8 @@ CLI::ExitCode CLI::Main::executeCommandObject(const QString &command, Log::KeyLi for (uint i=0; i<coff.nbSections(); i++) { const Coff::Section *s = coff.Coff::Object::section(i); keys.append(s->name(), i18n("type=\"%1\" address=%2 size=%3 flags=%4") - .arg(s->type()==Coff::SectionType::Nb_Types ? "?" : s->type().label()) - .arg(toHexLabel(s->address(), nbCharsAddress)).arg(toHexLabel(s->size(), nbCharsAddress)).arg(toHexLabel(s->flags(), 8))); + .tqarg(s->type()==Coff::SectionType::Nb_Types ? "?" : s->type().label()) + .tqarg(toHexLabel(s->address(), nbCharsAddress)).tqarg(toHexLabel(s->size(), nbCharsAddress)).tqarg(toHexLabel(s->flags(), 8))); } return OK; } @@ -180,13 +180,13 @@ CLI::ExitCode CLI::Main::executeCommandObject(const QString &command, Log::KeyLi for (uint k=0; k<uint(s->lines().count()); k++) { if (first) { first = false; - keys.append(i18n("section \"%1\":").arg(s->name()), QString::null); + keys.append(i18n("section \"%1\":").tqarg(s->name()), TQString()); } const Coff::CodeLine *cl = s->lines()[k]; - QString key = cl->filename() + ":" + QString::number(cl->line()); + TQString key = cl->filename() + ":" + TQString::number(cl->line()); if ( !cl->address().isValid() ) { const Coff::Symbol &sym = *cl->symbol(); - keys.append(key, i18n("symbol \"%1\"").arg(sym.name()) + prettySymbol(sym)); + keys.append(key, i18n("symbol \"%1\"").tqarg(sym.name()) + prettySymbol(sym)); } else keys.append(key, toHexLabel(cl->address(), nbCharsAddress)); } } @@ -195,16 +195,16 @@ CLI::ExitCode CLI::Main::executeCommandObject(const QString &command, Log::KeyLi if ( command=="files" ) { keys.setTitle(i18n("Files:")); - QStringList::const_iterator it; + TQStringList::const_iterator it; for (it=coff.filenames().begin(); it!=coff.filenames().end(); ++it) - keys.append(*it, QString::null); + keys.append(*it, TQString()); return OK; } return errorExit(i18n("Command not available for COFF of type Object."), ARG_ERROR); } -CLI::ExitCode CLI::Main::executeCommand(const QString &command) +CLI::ExitCode CLI::Main::executeCommand(const TQString &command) { CoffType type = Coff::identify(_source, *this); if ( type==CoffType::Nb_Types ) return ARG_ERROR; @@ -226,32 +226,32 @@ CLI::ExitCode CLI::Main::prepareRun(bool &interactive) return OK; } -CLI::ExitCode CLI::Main::executeSetCommand(const QString &property, const QString &value) +CLI::ExitCode CLI::Main::executeSetCommand(const TQString &property, const TQString &value) { if ( property=="device" || property=="processor" ) { if ( value.isEmpty() ) { _device = 0; return OK; } - QString s = value.upper(); + TQString s = value.upper(); _device = Device::lister().data(s); - if ( _device==0 ) return errorExit(i18n("Unknown device \"%1\".").arg(s), ARG_ERROR); + if ( _device==0 ) return errorExit(i18n("Unknown device \"%1\".").tqarg(s), ARG_ERROR); return OK; } - return errorExit(i18n("Unknown property \"%1\".").arg(property), ARG_ERROR); + return errorExit(i18n("Unknown property \"%1\".").tqarg(property), ARG_ERROR); } -QString CLI::Main::executeGetCommand(const QString &property) +TQString CLI::Main::executeGetCommand(const TQString &property) { if ( property=="device" || property=="processor" ) { if ( _device==0 ) return i18n("<not set>"); return _device->name(); } - log(Log::LineType::SoftError, i18n("Unknown property \"%1\".").arg(property)); - return QString::null; + log(Log::LineType::SoftError, i18n("Unknown property \"%1\".").tqarg(property)); + return TQString(); } -CLI::ExitCode CLI::Main::list(const QString &command) +CLI::ExitCode CLI::Main::list(const TQString &command) { if ( MainBase::list(command)==OK ) return OK; if ( command=="device-list" ) return deviceList(); @@ -261,11 +261,11 @@ CLI::ExitCode CLI::Main::list(const QString &command) CLI::ExitCode CLI::Main::deviceList() { - QValueVector<QString> devices; + TQValueVector<TQString> devices; log(Log::LineType::Normal, i18n("Supported devices:")); devices = Device::lister().supportedDevices(); qHeapSort(devices); - QString s; + TQString s; for (uint i=0; i<uint(devices.count()); i++) s += " " + devices[i]; log(Log::LineType::Normal, s + "\n"); return OK; diff --git a/src/piklab-coff/main.h b/src/piklab-coff/main.h index 21ac319..343bd9b 100644 --- a/src/piklab-coff/main.h +++ b/src/piklab-coff/main.h @@ -19,13 +19,14 @@ namespace CLI { //---------------------------------------------------------------------------- enum CommandProperty { NoCommandProperty = 0, NeedSource = 1, NeedDestination = 2, NeedDevice = 4 }; -Q_DECLARE_FLAGS(CommandProperties, CommandProperty) -Q_DECLARE_OPERATORS_FOR_FLAGS(CommandProperties) +TQ_DECLARE_FLAGS(CommandProperties, CommandProperty) +TQ_DECLARE_OPERATORS_FOR_FLAGS(CommandProperties) //---------------------------------------------------------------------------- class Main : public MainBase { Q_OBJECT + TQ_OBJECT public: Main(); virtual ~Main(); @@ -34,17 +35,17 @@ private: const Device::Data *_device; PURL::Url _source, _dest; - virtual ExitCode prepareCommand(const QString &command); - virtual ExitCode executeCommand(const QString &command); + virtual ExitCode prepareCommand(const TQString &command); + virtual ExitCode executeCommand(const TQString &command); virtual ExitCode prepareRun(bool &interactive); - virtual ExitCode executeSetCommand(const QString &property, const QString &value); - ExitCode executeCommandArchive(const QString &command, Log::KeyList &keys); - ExitCode executeCommandObject(const QString &command, Log::KeyList &keys); - virtual QString executeGetCommand(const QString &property); - virtual ExitCode list(const QString &listName); + virtual ExitCode executeSetCommand(const TQString &property, const TQString &value); + ExitCode executeCommandArchive(const TQString &command, Log::KeyList &keys); + ExitCode executeCommandObject(const TQString &command, Log::KeyList &keys); + virtual TQString executeGetCommand(const TQString &property); + virtual ExitCode list(const TQString &listName); ExitCode deviceList(); - static QString prettyAuxSymbol(const Coff::AuxSymbol &aux); - static QString prettySymbol(const Coff::Symbol &sym); + static TQString prettyAuxSymbol(const Coff::AuxSymbol &aux); + static TQString prettySymbol(const Coff::Symbol &sym); }; } // namespace |