summaryrefslogtreecommitdiffstats
path: root/src/piklab-hex
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-30 00:15:53 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-30 00:15:53 +0000
commit0aaa8e3fc8f8a1481333b564f0922277c8d8ad59 (patch)
treeb95c0ca86c4876dd139af376b9f4afd8917cf0cd /src/piklab-hex
parentb79a2c28534cf09987eeeba3077fff9236df182a (diff)
downloadpiklab-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')
-rw-r--r--src/piklab-hex/main.cpp44
-rw-r--r--src/piklab-hex/main.h19
2 files changed, 32 insertions, 31 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;
diff --git a/src/piklab-hex/main.h b/src/piklab-hex/main.h
index 4689bff..212e175 100644
--- a/src/piklab-hex/main.h
+++ b/src/piklab-hex/main.h
@@ -24,8 +24,8 @@ namespace CLI
//----------------------------------------------------------------------------
enum CommandProperty { NoCommandProperty = 0, NeedSource1 = 1, NeedDestination = 2,
NeedSource2 = 4, NeedCorrectInput = 8, NeedDevice = 16 };
-Q_DECLARE_FLAGS(CommandProperties, CommandProperty)
-Q_DECLARE_OPERATORS_FOR_FLAGS(CommandProperties)
+TQ_DECLARE_FLAGS(CommandProperties, CommandProperty)
+TQ_DECLARE_OPERATORS_FOR_FLAGS(CommandProperties)
//----------------------------------------------------------------------------
struct FillOptions {
@@ -37,6 +37,7 @@ extern const FillOptions FILL_OPTIONS[];
class Main : public MainBase
{
Q_OBJECT
+ TQ_OBJECT
public:
Main();
virtual ~Main();
@@ -45,17 +46,17 @@ private:
PURL::Url _dest;
HexBuffer _source1, _source2;
HexBuffer::Format _format;
- QValueList<HexBuffer::ErrorData> _errors;
+ TQValueList<HexBuffer::ErrorData> _errors;
const Device::Data *_device;
Device::Memory *_memory;
- QString _fill;
+ TQString _fill;
- 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);
- virtual QString executeGetCommand(const QString &property);
- virtual ExitCode list(const QString &listName);
+ virtual ExitCode executeSetCommand(const TQString &property, const TQString &value);
+ virtual TQString executeGetCommand(const TQString &property);
+ virtual ExitCode list(const TQString &listName);
ExitCode deviceList();
ExitCode fillOptionList();
};