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-hex/main.cpp | |
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-hex/main.cpp')
-rw-r--r-- | src/piklab-hex/main.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/piklab-hex/main.cpp b/src/piklab-hex/main.cpp index 6323770..7c5ee75 100644 --- a/src/piklab-hex/main.cpp +++ b/src/piklab-hex/main.cpp @@ -61,7 +61,7 @@ CLI::Main::~Main() delete _memory; } -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); @@ -79,7 +79,7 @@ CLI::ExitCode CLI::Main::prepareCommand(const QString &command) if ( !file.openForRead() ) return FILE_ERROR; _errors = _source1.load(file.stream(), _format); if ( (properties & NeedCorrectInput) && !_errors.isEmpty() ) { - QString s = (properties & NeedSource2 ? i18n("First hex file: ") : QString::null); + TQString s = (properties & NeedSource2 ? i18n("First hex file: ") : TQString()); for (uint i=0; i<uint(_errors.count()); i++) log(Log::LineType::Error, s + _errors[i].message()); return EXEC_ERROR; } @@ -91,7 +91,7 @@ CLI::ExitCode CLI::Main::prepareCommand(const QString &command) if ( !file.openForRead() ) return FILE_ERROR; _errors = _source2.load(file.stream(), _format); if ( (properties & NeedCorrectInput) && !_errors.isEmpty() ) { - QString s = (properties & NeedSource1 ? i18n("Second hex file: ") : QString::null); + TQString s = (properties & NeedSource1 ? i18n("Second hex file: ") : TQString()); for (uint i=0; i<uint(_errors.count()); i++) log(Log::LineType::Error, s + _errors[i].message()); return EXEC_ERROR; } @@ -105,7 +105,7 @@ CLI::ExitCode CLI::Main::prepareCommand(const QString &command) return OK; } -CLI::ExitCode CLI::Main::executeCommand(const QString &command) +CLI::ExitCode CLI::Main::executeCommand(const TQString &command) { if (_device) { delete _memory; @@ -113,9 +113,9 @@ CLI::ExitCode CLI::Main::executeCommand(const QString &command) } if ( command=="check" ) { if ( _device==0 ) return okExit(i18n("Hex file is valid.")); - QStringList warnings; + TQStringList warnings; Device::Memory::WarningTypes wtypes = _memory->fromHexBuffer(_source1, warnings); - if ( wtypes==Device::Memory::NoWarning ) return okExit(i18n("Hex file is compatible with device \"%1\".").arg(_device->name())); + if ( wtypes==Device::Memory::NoWarning ) return okExit(i18n("Hex file is compatible with device \"%1\".").tqarg(_device->name())); return errorExit(warnings.join("\n"), EXEC_ERROR); } if ( command=="info" ) { @@ -159,28 +159,28 @@ CLI::ExitCode CLI::Main::executeCommand(const QString &command) bool firstInSecond = true, secondInFirst = true; HexBuffer::const_iterator it; for (it=_source1.begin(); it!=_source1.end(); ++it) { - if ( it.data().maskWith(0xFFFF)==_source2[it.key()].maskWith(0xFFFF) ) continue; + if ( it.data().tqmaskWith(0xFFFF)==_source2[it.key()].tqmaskWith(0xFFFF) ) continue; firstInSecond = false; } for (it=_source2.begin(); it!=_source2.end(); ++it) { - if ( it.data().maskWith(0xFFFF)==_source1[it.key()].maskWith(0xFFFF) ) continue; + if ( it.data().tqmaskWith(0xFFFF)==_source1[it.key()].tqmaskWith(0xFFFF) ) continue; secondInFirst = false; } if ( firstInSecond && secondInFirst ) return okExit(i18n("The two hex files have the same content.")); if (firstInSecond) log(Log::LineType::Information, i18n("The first hex file is a subset of the second one.")); if (secondInFirst) log(Log::LineType::Information, i18n("The second hex file is a subset of the first one.")); - return errorExit(i18n("The two hex files are different at address %1.").arg(toHexLabel(it.key(), 8)), EXEC_ERROR); + return errorExit(i18n("The two hex files are different at address %1.").tqarg(toHexLabel(it.key(), 8)), EXEC_ERROR); } if ( command=="checksum" ) { - QStringList warnings; + TQStringList warnings; Device::Memory::WarningTypes wtypes = _memory->fromHexBuffer(_source1, warnings); for (uint i=0; i<uint(warnings.count()); i++) log(Log::LineType::Warning, warnings[i]); log(Log::LineType::Warning, i18n("Checksum computation is experimental and is not always correct!")); // #### REMOVE ME BitValue cs = _memory->checksum(); - log(Log::LineType::Normal, i18n("Checksum: %1").arg(toHexLabel(cs, 4))); + log(Log::LineType::Normal, i18n("Checksum: %1").tqarg(toHexLabel(cs, 4))); if ( _device->group().name()=="pic" ) { BitValue ucs = static_cast<Pic::Memory *>(_memory)->unprotectedChecksum(); - if ( ucs!=cs ) log(Log::LineType::Information, i18n("Unprotected checksum: %1").arg(toHexLabel(ucs, 4))); + if ( ucs!=cs ) log(Log::LineType::Information, i18n("Unprotected checksum: %1").tqarg(toHexLabel(ucs, 4))); } return OK; } @@ -211,16 +211,16 @@ 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; } if ( property=="fill" ) { @@ -232,10 +232,10 @@ CLI::ExitCode CLI::Main::executeSetCommand(const QString &property, const QStrin if ( !ok ) return errorExit(i18n("Number format not recognized."), 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>"); @@ -245,11 +245,11 @@ QString CLI::Main::executeGetCommand(const QString &property) if ( _fill.isEmpty() ) return i18n("<not set>"); return _fill; } - 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(); @@ -260,11 +260,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; |