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/progs/pickit2 | |
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/progs/pickit2')
-rw-r--r-- | src/progs/pickit2/base/pickit.cpp | 20 | ||||
-rw-r--r-- | src/progs/pickit2/base/pickit.h | 6 | ||||
-rw-r--r-- | src/progs/pickit2/base/pickit2.cpp | 16 | ||||
-rw-r--r-- | src/progs/pickit2/base/pickit2_data.h | 4 | ||||
-rw-r--r-- | src/progs/pickit2/base/pickit2_prog.cpp | 4 | ||||
-rw-r--r-- | src/progs/pickit2/base/pickit2_prog.h | 5 | ||||
-rw-r--r-- | src/progs/pickit2/base/pickit_prog.cpp | 10 | ||||
-rw-r--r-- | src/progs/pickit2/base/pickit_prog.h | 1 | ||||
-rw-r--r-- | src/progs/pickit2/gui/pickit2_group_ui.cpp | 12 | ||||
-rw-r--r-- | src/progs/pickit2/gui/pickit2_group_ui.h | 7 | ||||
-rw-r--r-- | src/progs/pickit2/xml/xml_pickit2_parser.cpp | 16 |
11 files changed, 52 insertions, 49 deletions
diff --git a/src/progs/pickit2/base/pickit.cpp b/src/progs/pickit2/base/pickit.cpp index 7da2d18..3344ef8 100644 --- a/src/progs/pickit2/base/pickit.cpp +++ b/src/progs/pickit2/base/pickit.cpp @@ -18,12 +18,12 @@ Pickit::Array::Array(uint length, uchar fillChar, PrintMode mode) _data.fill(fillChar); } -QString Pickit::Array::pretty() const +TQString Pickit::Array::pretty() const { int end = _data.count() - 1; for (; end>=0; end--) if ( _data[end]!=_fillChar ) break; - QString s; + TQString s; for (int i=0; i<=end; i++) s += toPrintable(_data[i], _mode); return s; } @@ -52,14 +52,14 @@ bool Pickit::USBPort::command(const char *s) bool Pickit::USBPort::command(const Array &cmd) { - log(Log::DebugLevel::Extra, QString("send command: \"%1\"").arg(cmd.pretty())); + log(Log::DebugLevel::Extra, TQString("send command: \"%1\"").tqarg(cmd.pretty())); return write(writeEndPoint(), (const char *)cmd._data.data(), cmd.length()); } bool Pickit::USBPort::receive(Pickit::Array &array) { if ( !read(readEndPoint(), (char *)array._data.data(), array.length()) ) return false; - log(Log::DebugLevel::Max, QString("received: \"%1\"").arg(array.pretty())); + log(Log::DebugLevel::Max, TQString("received: \"%1\"").tqarg(array.pretty())); return true; } @@ -78,11 +78,11 @@ bool Pickit::USBPort::getMode(VersionData &version, ::Programmer::Mode &mode) return true; } -bool Pickit::USBPort::receiveWords(uint nbBytesWord, uint nbRead, QValueVector<uint> &words, uint offset) +bool Pickit::USBPort::receiveWords(uint nbBytesWord, uint nbRead, TQValueVector<uint> &words, uint offset) { - log(Log::DebugLevel::Max, QString("receive words nbBytesWord=%1 nbRead=%2 offset=%3").arg(nbBytesWord).arg(nbRead).arg(offset)); + log(Log::DebugLevel::Max, TQString("receive words nbBytesWord=%1 nbRead=%2 offset=%3").tqarg(nbBytesWord).tqarg(nbRead).tqarg(offset)); Array a = array(); - QMemArray<uchar> data(nbRead*a.length()); + TQMemArray<uchar> data(nbRead*a.length()); uint l = 0; for (uint i=0; i<nbRead; i++) { if ( !receive(a) ) return false; @@ -101,7 +101,7 @@ bool Pickit::USBPort::receiveWords(uint nbBytesWord, uint nbRead, QValueVector<u //----------------------------------------------------------------------------- Pickit::Hardware::Hardware(::Programmer::Base &base, USBPort *port) - : ::Programmer::PicHardware(base, port, QString::null) + : ::Programmer::PicHardware(base, port, TQString()) {} bool Pickit::Hardware::internalConnectHardware() @@ -149,7 +149,7 @@ bool Pickit::Hardware::regenerateOsccal(BitValue &newValue) cmd[4] = 'r'; cmd[5] = 'p'; if ( !port().command(cmd) ) return false; - QValueVector<uint> words; + TQValueVector<uint> words; if ( !port().receiveWords(1, 1, words) ) return false; newValue = words[7] | 0x3400; return true; @@ -176,7 +176,7 @@ bool Pickit::BMDeviceSpecific::doRead(Pic::MemoryRangeType type, Device::Array & { data.resize(device().nbWords(type)); gotoMemory(type); - QValueVector<uint> words; + TQValueVector<uint> words; switch (type.type()) { case Pic::MemoryRangeType::Config: case Pic::MemoryRangeType::Code: diff --git a/src/progs/pickit2/base/pickit.h b/src/progs/pickit2/base/pickit.h index 741ed61..184a110 100644 --- a/src/progs/pickit2/base/pickit.h +++ b/src/progs/pickit2/base/pickit.h @@ -23,7 +23,7 @@ class Array { public: uint length() const { return _data.count(); } - QString pretty() const; + TQString pretty() const; uchar &operator[](uint i) { return _data[i]; } uchar operator[](uint i) const { return _data[i]; } @@ -33,7 +33,7 @@ protected: private: uchar _fillChar; PrintMode _mode; - QMemArray<uchar> _data; + TQMemArray<uchar> _data; friend class USBPort; }; @@ -49,7 +49,7 @@ public: bool command(const char *s); bool receive(Array &data); bool getMode(VersionData &version, ::Programmer::Mode &mode); - bool receiveWords(uint nbBytesWord, uint nbRead, QValueVector<uint> &data, uint offset = 0); + bool receiveWords(uint nbBytesWord, uint nbRead, TQValueVector<uint> &data, uint offset = 0); protected: virtual uint writeEndPoint() const = 0; diff --git a/src/progs/pickit2/base/pickit2.cpp b/src/progs/pickit2/base/pickit2.cpp index 6458fa2..6a010ff 100644 --- a/src/progs/pickit2/base/pickit2.cpp +++ b/src/progs/pickit2/base/pickit2.cpp @@ -43,16 +43,16 @@ bool Pickit2::USBPort::readFirmwareCodeMemory(Device::Array &data, const Device: uint nb = end - start + 1; Pickit::Array cmd = createCommand(1, 2*nb, 2*i); if ( !command(cmd) ) return false; - QValueVector<uint> read; + TQValueVector<uint> read; if ( !receiveWords(1, 1, read) ) return false; for (uint k=0; k<nb; k++) { uint index = i + start + k; data[index]= read[5 + 2*k] & 0xFF | (read[6 + 2*k] << 8); if ( vdata && index>=0x1000 && index<0x3FF0 && data[index]!=(*vdata)[index] ) { log(Log::LineType::Error, i18n("Firmware memory does not match hex file (at address 0x%2: reading 0x%3 and expecting 0x%4).") - .arg(QString(toHex(index/2, device->nbCharsAddress()))) - .arg(QString(toHex(data[index], device->nbCharsWord(Pic::MemoryRangeType::Code)))) - .arg(QString(toHex((*vdata)[index], device->nbCharsWord(Pic::MemoryRangeType::Code))))); + .tqarg(TQString(toHex(index/2, device->nbCharsAddress()))) + .tqarg(TQString(toHex(data[index], device->nbCharsWord(Pic::MemoryRangeType::Code)))) + .tqarg(TQString(toHex((*vdata)[index], device->nbCharsWord(Pic::MemoryRangeType::Code))))); return false; } } @@ -111,7 +111,7 @@ bool Pickit2::USBPort::uploadFirmware(const Pic::Memory &memory, ProgressMonitor //----------------------------------------------------------------------------- bool Pickit2::Hardware::readVoltages(VoltagesData &voltages) { - log(Log::DebugLevel::Extra, QString("readVoltages: Firmware is %1").arg(_base.firmwareVersion().pretty())); + log(Log::DebugLevel::Extra, TQString("readVoltages: Firmware is %1").tqarg(_base.firmwareVersion().pretty())); if ( _base.firmwareVersion()<VersionData(1, 20, 0) ) { log(Log::LineType::Warning, i18n("Cannot read voltages with this firmware version.")); return true; @@ -128,9 +128,9 @@ bool Pickit2::Hardware::readVoltages(VoltagesData &voltages) bool Pickit2::Hardware::setVddVpp(double vdd, double vpp) { - log(Log::DebugLevel::Extra, QString("setVddVpp: Firmware is %1").arg(_base.firmwareVersion().pretty())); + log(Log::DebugLevel::Extra, TQString("setVddVpp: Firmware is %1").tqarg(_base.firmwareVersion().pretty())); if ( _base.firmwareVersion()<VersionData(1, 20, 0) ) return true; - log(Log::DebugLevel::Normal, QString(" set Vdd = %1 V and Vpp = %2 V").arg(vdd).arg(vpp)); + log(Log::DebugLevel::Normal, TQString(" set Vdd = %1 V and Vpp = %2 V").tqarg(vdd).tqarg(vpp)); Array cmd; cmd[0] = 's'; uint cvdd = uint(32.0 * vdd + 12.5); @@ -313,7 +313,7 @@ bool Pickit2::P18F::doRead(Pic::MemoryRangeType type, Device::Array &data, const { USBPort &port = static_cast<USBPort &>(hardware().port()); data.resize(device().nbWords(type)); - QValueVector<uint> words; + TQValueVector<uint> words; switch (type.type()) { case Pic::MemoryRangeType::DeviceId: case Pic::MemoryRangeType::UserId: diff --git a/src/progs/pickit2/base/pickit2_data.h b/src/progs/pickit2/base/pickit2_data.h index abae867..7eece69 100644 --- a/src/progs/pickit2/base/pickit2_data.h +++ b/src/progs/pickit2/base/pickit2_data.h @@ -9,7 +9,7 @@ #ifndef PICKIT2_DATA_H #define PICKIT2_DATA_H -#include <qstring.h> +#include <tqstring.h> namespace Pickit2 { @@ -18,7 +18,7 @@ namespace Pickit2 uchar progWidth; bool regenerateOsccal; }; - extern const Data &data(const QString &device); + extern const Data &data(const TQString &device); } // namespace #endif diff --git a/src/progs/pickit2/base/pickit2_prog.cpp b/src/progs/pickit2/base/pickit2_prog.cpp index 88b73b9..3e3a2bd 100644 --- a/src/progs/pickit2/base/pickit2_prog.cpp +++ b/src/progs/pickit2/base/pickit2_prog.cpp @@ -50,10 +50,10 @@ bool Pickit2::Base::doUploadFirmware(PURL::File &file) { const Pic::Data &data = static_cast<const Pic::Data &>(*Device::lister().data("18F2550")); Pic::Memory memory(static_cast<const Pic::Data &>(data)); - QStringList errors, warnings; + TQStringList errors, warnings; Pic::Memory::WarningTypes warningTypes; if ( !memory.load(file.stream(), errors, warningTypes, warnings) ) { - log(Log::LineType::Error, i18n("Could not read firmware hex file \"%1\" (%2).").arg(file.url().pretty()).arg(errors[0])); + log(Log::LineType::Error, i18n("Could not read firmware hex file \"%1\" (%2).").tqarg(file.url().pretty()).tqarg(errors[0])); return false; } if ( warningTypes!=Pic::Memory::NoWarning ) { diff --git a/src/progs/pickit2/base/pickit2_prog.h b/src/progs/pickit2/base/pickit2_prog.h index 5a67e2a..31efb44 100644 --- a/src/progs/pickit2/base/pickit2_prog.h +++ b/src/progs/pickit2/base/pickit2_prog.h @@ -18,6 +18,7 @@ namespace Pickit2 class Base : public Pickit::Base { Q_OBJECT + TQ_OBJECT public: Base(const Programmer::Group &group, const Pic::Data *data) : Pickit::Base(group, data) {} virtual bool deviceHasOsccalRegeneration() const; @@ -33,8 +34,8 @@ private: class Group : public Pickit::Group { public: - virtual QString name() const { return "pickit2"; } - virtual QString label() const { return i18n("PICkit2 Firmware 1.x"); } + virtual TQString name() const { return "pickit2"; } + virtual TQString label() const { return i18n("PICkit2 Firmware 1.x"); } virtual Programmer::Properties properties() const { return ::Programmer::Programmer | ::Programmer::HasFirmware | ::Programmer::CanUploadFirmware | ::Programmer::CanReadMemory | ::Programmer::HasConnectedState; } virtual bool canReadVoltage(Pic::VoltageType type) const { return ( type==Pic::TargetVdd || type==Pic::TargetVpp ); } diff --git a/src/progs/pickit2/base/pickit_prog.cpp b/src/progs/pickit2/base/pickit_prog.cpp index c11dd08..f894906 100644 --- a/src/progs/pickit2/base/pickit_prog.cpp +++ b/src/progs/pickit2/base/pickit_prog.cpp @@ -28,22 +28,22 @@ bool Pickit::Base::readFirmwareVersion() bool Pickit::Base::regenerateOsccal(const PURL::Url &url) { - log(Log::DebugLevel::Normal, QString(" Calibration firmware file: %1").arg(url.pretty())); + log(Log::DebugLevel::Normal, TQString(" Calibration firmware file: %1").tqarg(url.pretty())); Log::StringView sview; PURL::File file(url, sview); if ( !file.openForRead() ) { - log(Log::LineType::Error, i18n("Could not open firmware file \"%1\".").arg(url.pretty())); + log(Log::LineType::Error, i18n("Could not open firmware file \"%1\".").tqarg(url.pretty())); return false; } Pic::Memory memory(*device()); - QStringList errors, warnings; + TQStringList errors, warnings; Pic::Memory::WarningTypes warningTypes; if ( !memory.load(file.stream(), errors, warningTypes, warnings) ) { - log(Log::LineType::Error, i18n("Could not read calibration firmware file \"%1\" (%2).").arg(url.pretty()).arg(errors[0])); + log(Log::LineType::Error, i18n("Could not read calibration firmware file \"%1\" (%2).").tqarg(url.pretty()).tqarg(errors[0])); return false; } if ( warningTypes!=Pic::Memory::NoWarning ) { - log(Log::LineType::Error, i18n("Calibration firmware file seems incompatible with selected device %1.").arg(device()->name())); + log(Log::LineType::Error, i18n("Calibration firmware file seems incompatible with selected device %1.").tqarg(device()->name())); return false; } if ( !askContinue(i18n("This will overwrite the device code memory. Continue anyway?")) ) return false; diff --git a/src/progs/pickit2/base/pickit_prog.h b/src/progs/pickit2/base/pickit_prog.h index b35fc92..7d2e76d 100644 --- a/src/progs/pickit2/base/pickit_prog.h +++ b/src/progs/pickit2/base/pickit_prog.h @@ -22,6 +22,7 @@ class Hardware; class Base : public Programmer::PicBase { Q_OBJECT + TQ_OBJECT public: Base(const Programmer::Group &group, const Pic::Data *data); virtual bool deviceHasOsccalRegeneration() const = 0; diff --git a/src/progs/pickit2/gui/pickit2_group_ui.cpp b/src/progs/pickit2/gui/pickit2_group_ui.cpp index f36395a..473dea7 100644 --- a/src/progs/pickit2/gui/pickit2_group_ui.cpp +++ b/src/progs/pickit2/gui/pickit2_group_ui.cpp @@ -18,8 +18,8 @@ #include "progs/pickit2/base/pickit2.h" //---------------------------------------------------------------------------- -Pickit::AdvancedDialog::AdvancedDialog(Base &base, QWidget *parent, const char *name) - : ::Programmer::PicAdvancedDialog(base, parent, name) +Pickit::AdvancedDialog::AdvancedDialog(Base &base, TQWidget *tqparent, const char *name) + : ::Programmer::PicAdvancedDialog(base, tqparent, name) {} void Pickit::AdvancedDialog::regenerateCalibration() @@ -41,12 +41,12 @@ void Pickit::AdvancedDialog::regenerateCalibration() } //---------------------------------------------------------------------------- -::Programmer::ConfigWidget *Pickit2::GroupUI::createConfigWidget(QWidget *parent) const +::Programmer::ConfigWidget *Pickit2::GroupUI::createConfigWidget(TQWidget *tqparent) const { - return new ::Programmer::ConfigWidget(static_cast<const ::Programmer::Group &>(group()), parent); + return new ::Programmer::ConfigWidget(static_cast<const ::Programmer::Group &>(group()), tqparent); } -::Programmer::AdvancedDialog *Pickit2::GroupUI::createAdvancedDialog(::Programmer::Base &base, QWidget *parent) const +::Programmer::AdvancedDialog *Pickit2::GroupUI::createAdvancedDialog(::Programmer::Base &base, TQWidget *tqparent) const { - return new Pickit::AdvancedDialog(static_cast<Base &>(base), parent, "pickit2_advanced_dialog"); + return new Pickit::AdvancedDialog(static_cast<Base &>(base), tqparent, "pickit2_advanced_dialog"); } diff --git a/src/progs/pickit2/gui/pickit2_group_ui.h b/src/progs/pickit2/gui/pickit2_group_ui.h index f79aa1f..78da904 100644 --- a/src/progs/pickit2/gui/pickit2_group_ui.h +++ b/src/progs/pickit2/gui/pickit2_group_ui.h @@ -18,8 +18,9 @@ namespace Pickit class AdvancedDialog : public ::Programmer::PicAdvancedDialog { Q_OBJECT + TQ_OBJECT public: - AdvancedDialog(Base &base, QWidget *parent, const char *name); + AdvancedDialog(Base &base, TQWidget *tqparent, const char *name); Base &base() { return static_cast<Base &>(_base); } public slots: @@ -33,9 +34,9 @@ namespace Pickit2 class GroupUI : public ::Programmer::GroupUI { public: - virtual ::Programmer::ConfigWidget *createConfigWidget(QWidget *parent) const; + virtual ::Programmer::ConfigWidget *createConfigWidget(TQWidget *tqparent) const; virtual bool hasAdvancedDialog() const { return true; } - virtual ::Programmer::AdvancedDialog *createAdvancedDialog(::Programmer::Base &base, QWidget *parent) const; + virtual ::Programmer::AdvancedDialog *createAdvancedDialog(::Programmer::Base &base, TQWidget *tqparent) const; }; } // namespace diff --git a/src/progs/pickit2/xml/xml_pickit2_parser.cpp b/src/progs/pickit2/xml/xml_pickit2_parser.cpp index ffc82f7..686e4b2e 100644 --- a/src/progs/pickit2/xml/xml_pickit2_parser.cpp +++ b/src/progs/pickit2/xml/xml_pickit2_parser.cpp @@ -18,14 +18,14 @@ public: XmlToData() : Programmer::XmlToData<Data>("pickit2", "Pickit2") {} private: - virtual void parseData(QDomElement element, Data &data); - virtual void outputData(const Data &data, QTextStream &s) const; - virtual void outputFunctions(QTextStream &s) const; + virtual void parseData(TQDomElement element, Data &data); + virtual void outputData(const Data &data, TQTextStream &s) const; + virtual void outputFunctions(TQTextStream &s) const; }; -void Pickit2::XmlToData::parseData(QDomElement element, Data &data) +void Pickit2::XmlToData::parseData(TQDomElement element, Data &data) { - QString s = element.attribute("entry"); + TQString s = element.attribute("entry"); if ( s.length()!=1 || (s[0]!='O' && s[0]!='P') ) qFatal("Invalid or missing entry mode"); data.entryMode = s[0].latin1(); s = element.attribute("pmode"); @@ -47,13 +47,13 @@ void Pickit2::XmlToData::parseData(QDomElement element, Data &data) else qFatal("Invalid regen value"); } -void Pickit2::XmlToData::outputData(const Data &data, QTextStream &s) const +void Pickit2::XmlToData::outputData(const Data &data, TQTextStream &s) const { s << "'" << data.entryMode << "', '" << data.progMode; s << "', " << data.progWidth << ", " << (data.regenerateOsccal ? "true" : "false"); } -void Pickit2::XmlToData::outputFunctions(QTextStream &s) const +void Pickit2::XmlToData::outputFunctions(TQTextStream &s) const { Programmer::XmlToData<Data>::outputFunctions(s); s << "::Programmer::DeviceSpecific *Group::createDeviceSpecific(::Programmer::Base &base) const" << endl; @@ -61,7 +61,7 @@ void Pickit2::XmlToData::outputFunctions(QTextStream &s) const s << " uint i = family(static_cast< ::Pickit2::Base &>(base).device()->name());" << endl; s << " switch(i) {" << endl; for (uint i=0; i<uint(families().count()); i++) { - s << " case " + QString::number(i) + ": return new " + families()[i] + "(base);" << endl; + s << " case " + TQString::number(i) + ": return new " + families()[i] + "(base);" << endl; } s << " }" << endl; s << " Q_ASSERT(false);" << endl; |