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/tbl_bootloader | |
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/tbl_bootloader')
7 files changed, 33 insertions, 31 deletions
diff --git a/src/progs/tbl_bootloader/base/tbl_bootloader.cpp b/src/progs/tbl_bootloader/base/tbl_bootloader.cpp index 419ad86..9c52fb7 100644 --- a/src/progs/tbl_bootloader/base/tbl_bootloader.cpp +++ b/src/progs/tbl_bootloader/base/tbl_bootloader.cpp @@ -43,7 +43,7 @@ void TinyBootloader::Config::writeRetries(uint nb) } //----------------------------------------------------------------------------- -TinyBootloader::Hardware::Hardware(::Programmer::Base &base, const QString &portDevice) +TinyBootloader::Hardware::Hardware(::Programmer::Base &base, const TQString &portDevice) : ::Bootloader::Hardware(base, new Port::Serial(portDevice, Port::Serial::NoProperty, base)) { Config config; @@ -76,17 +76,17 @@ bool TinyBootloader::Hardware::internalConnectHardware() bool TinyBootloader::Hardware::verifyDeviceId() { uchar id = data(device().name()).id; - QValueVector<QString> list = _base.group().supportedDevices(); - QStringList devices; + TQValueVector<TQString> list = _base.group().supportedDevices(); + TQStringList devices; for (uint i=0; i<uint(list.count()); i++) if ( _id==data(list[i]).id ) devices.append(list[i]); if ( _id!=id ) { - if ( devices.count()==0 ) log(Log::LineType::Error, i18n("Unknown id returned by bootloader (%1 read and %2 expected).").arg(toHexLabel(_id, 2)).arg(toHexLabel(id, 2))); - else log(Log::LineType::Error, i18n("Id returned by bootloader corresponds to other devices: %1 (%2 read and %3 expected).").arg(devices.join(" ")).arg(toHexLabel(_id, 2)).arg(toHexLabel(id, 2))); + if ( devices.count()==0 ) log(Log::LineType::Error, i18n("Unknown id returned by bootloader (%1 read and %2 expected).").tqarg(toHexLabel(_id, 2)).tqarg(toHexLabel(id, 2))); + else log(Log::LineType::Error, i18n("Id returned by bootloader corresponds to other devices: %1 (%2 read and %3 expected).").tqarg(devices.join(" ")).tqarg(toHexLabel(_id, 2)).tqarg(toHexLabel(id, 2))); // we can't ask for "continue anyway?" because bootloader can timeout... return false; } - log(Log::LineType::Information, " " + i18n("Bootloader identified device as: %1").arg(devices.join(" "))); + log(Log::LineType::Information, " " + i18n("Bootloader identified device as: %1").tqarg(devices.join(" "))); return true; } @@ -101,10 +101,10 @@ bool TinyBootloader::Hardware::waitReady(bool *checkCRC) if (checkCRC) { *checkCRC = false; if ( c=='N' ) return true; - log(Log::LineType::Error, i18n("Received unexpected character ('%1' received; 'K' or 'N' expected).").arg(toPrintable(c, PrintAlphaNum))); + log(Log::LineType::Error, i18n("Received unexpected character ('%1' received; 'K' or 'N' expected).").tqarg(toPrintable(c, PrintAlphaNum))); return true; } - log(Log::LineType::Error, i18n("Received unexpected character ('%1' received; 'K' expected).").arg(toPrintable(c, PrintAlphaNum))); + log(Log::LineType::Error, i18n("Received unexpected character ('%1' received; 'K' expected).").tqarg(toPrintable(c, PrintAlphaNum))); return false; } @@ -158,9 +158,9 @@ bool TinyBootloader::Hardware::writeCode(const Device::Array &data, bool erase) // check that there is nothing on top of bootloader for (uint i=nb; i<data.size(); i++) { - if ( data[i]==device().mask(Pic::MemoryRangeType::Code) ) continue; + if ( data[i]==device().tqmask(Pic::MemoryRangeType::Code) ) continue; uint address = device().addressIncrement(Pic::MemoryRangeType::Code) * i; - log(Log::LineType::Warning, " " + i18n("Code is present in bootloader reserved area (at address %1). It will be ignored.").arg(toHexLabel(address, device().nbCharsAddress()))); + log(Log::LineType::Warning, " " + i18n("Code is present in bootloader reserved area (at address %1). It will be ignored.").tqarg(toHexLabel(address, device().nbCharsAddress()))); break; } @@ -194,7 +194,7 @@ bool TinyBootloader::Hardware::writeCode(const Device::Array &data, bool erase) if ( !erase ) { bool write = false; for (uint k=0; k<nbWords; k++) { - if ( wdata[i+k]==device().mask(Pic::MemoryRangeType::Code) ) continue; + if ( wdata[i+k]==device().tqmask(Pic::MemoryRangeType::Code) ) continue; write = true; break; } @@ -206,7 +206,7 @@ bool TinyBootloader::Hardware::writeCode(const Device::Array &data, bool erase) if ( !sendCodeAddress(address, crc) ) return false; uint nbw = device().nbBytesWord(Pic::MemoryRangeType::Code); if ( !sendChar(nbw*nbWords, &crc) ) return false; - log(Log::DebugLevel::Normal, QString("write code memory at %1: %2 bytes").arg(toHexLabel(address, 4)).arg(2*nbWords)); + log(Log::DebugLevel::Normal, TQString("write code memory at %1: %2 bytes").tqarg(toHexLabel(address, 4)).tqarg(2*nbWords)); for(uint k=0; k<nbWords; k++) { if ( !sendChar(wdata[i+k].byte(0), &crc) ) return false; // data low if ( !sendChar(wdata[i+k].byte(1), &crc) ) return false; // data high diff --git a/src/progs/tbl_bootloader/base/tbl_bootloader.h b/src/progs/tbl_bootloader/base/tbl_bootloader.h index b6e759f..322df3e 100644 --- a/src/progs/tbl_bootloader/base/tbl_bootloader.h +++ b/src/progs/tbl_bootloader/base/tbl_bootloader.h @@ -33,7 +33,7 @@ public: class Hardware : public ::Bootloader::Hardware { public: - Hardware(::Programmer::Base &base, const QString &portDevice); + Hardware(::Programmer::Base &base, const TQString &portDevice); Port::Serial *port() { return static_cast<Port::Serial *>(_port); } bool verifyDeviceId(); virtual bool write(Pic::MemoryRangeType type, const Device::Array &data); diff --git a/src/progs/tbl_bootloader/base/tbl_bootloader_data.h b/src/progs/tbl_bootloader/base/tbl_bootloader_data.h index 51be528..d8e7f79 100644 --- a/src/progs/tbl_bootloader/base/tbl_bootloader_data.h +++ b/src/progs/tbl_bootloader/base/tbl_bootloader_data.h @@ -14,8 +14,8 @@ namespace TinyBootloader struct Data { uchar id; }; - extern bool isSupported(const QString &device); - extern const Data &data(const QString &device); + extern bool isSupported(const TQString &device); + extern const Data &data(const TQString &device); } // namespace #endif diff --git a/src/progs/tbl_bootloader/base/tbl_bootloader_prog.h b/src/progs/tbl_bootloader/base/tbl_bootloader_prog.h index 75b986d..08cbf3f 100644 --- a/src/progs/tbl_bootloader/base/tbl_bootloader_prog.h +++ b/src/progs/tbl_bootloader/base/tbl_bootloader_prog.h @@ -18,6 +18,7 @@ namespace TinyBootloader class ProgrammerBase : public ::Bootloader::ProgrammerBase { Q_OBJECT + TQ_OBJECT public: ProgrammerBase(const Programmer::Group &group, const Pic::Data *data); virtual bool verifyDeviceId() { return static_cast<Hardware &>(hardware()).verifyDeviceId(); } @@ -27,8 +28,8 @@ public: class Group : public ::Bootloader::Group { public: - virtual QString name() const { return "tbl_bootloader"; } - virtual QString label() const { return i18n("Tiny Bootloader"); } + virtual TQString name() const { return "tbl_bootloader"; } + virtual TQString label() const { return i18n("Tiny Bootloader"); } virtual ::Programmer::Properties properties() const { return ::Programmer::Programmer; } virtual ::Programmer::TargetPowerMode targetPowerMode() const { return ::Programmer::TargetSelfPowered; } virtual bool isPortSupported(PortType type) const { return type==PortType::Serial; } diff --git a/src/progs/tbl_bootloader/gui/tbl_bootloader_ui.cpp b/src/progs/tbl_bootloader/gui/tbl_bootloader_ui.cpp index 5b576b9..f0c1725 100644 --- a/src/progs/tbl_bootloader/gui/tbl_bootloader_ui.cpp +++ b/src/progs/tbl_bootloader/gui/tbl_bootloader_ui.cpp @@ -12,29 +12,29 @@ #include "common/port/serial.h" //----------------------------------------------------------------------------- -TinyBootloader::ConfigWidget::ConfigWidget(const::Programmer::Group &group, QWidget *parent) - : ::Programmer::ConfigWidget(group, parent) +TinyBootloader::ConfigWidget::ConfigWidget(const::Programmer::Group &group, TQWidget *tqparent) + : ::Programmer::ConfigWidget(group, tqparent) { uint row = numRows(); - QLabel *label = new QLabel(i18n("Port Speed:"), this); + TQLabel *label = new TQLabel(i18n("Port Speed:"), this); addWidget(label, row,row, 0,0); _speed = new KComboBox(this); for (uint i=0; i<Port::Serial::Nb_Speeds; i++) { if ( Port::Serial::SPEED_VALUES[i]==0 || !Port::Serial::SPEED_DATA[i].supported ) continue; - _speed->insertItem(QString::number(Port::Serial::SPEED_VALUES[i])); + _speed->insertItem(TQString::number(Port::Serial::SPEED_VALUES[i])); } addWidget(_speed, row,row, 1,1); row++; - label = new QLabel(i18n("Timeout (ms):"), this); + label = new TQLabel(i18n("Timeout (ms):"), this); addWidget(label, row,row, 0,0); _timeout = new KIntNumInput(this); _timeout->setMinValue(0); addWidget(_timeout, row,row, 1,1); row++; - label = new QLabel(i18n("No of Retries:"), this); + label = new TQLabel(i18n("No of Retries:"), this); addWidget(label, row,row, 0,0); _retries = new KIntNumInput(this); _retries->setMinValue(0); @@ -74,7 +74,7 @@ void TinyBootloader::ConfigWidget::loadConfig() } //----------------------------------------------------------------------------- -::Programmer::ConfigWidget *TinyBootloader::GroupUI::createConfigWidget(QWidget *parent) const +::Programmer::ConfigWidget *TinyBootloader::GroupUI::createConfigWidget(TQWidget *tqparent) const { - return new ConfigWidget(static_cast<const ::Programmer::Group &>(group()), parent); + return new ConfigWidget(static_cast<const ::Programmer::Group &>(group()), tqparent); } diff --git a/src/progs/tbl_bootloader/gui/tbl_bootloader_ui.h b/src/progs/tbl_bootloader/gui/tbl_bootloader_ui.h index d0285af..442b879 100644 --- a/src/progs/tbl_bootloader/gui/tbl_bootloader_ui.h +++ b/src/progs/tbl_bootloader/gui/tbl_bootloader_ui.h @@ -20,8 +20,9 @@ namespace TinyBootloader class ConfigWidget: public ::Programmer::ConfigWidget { Q_OBJECT + TQ_OBJECT public: - ConfigWidget(const ::Programmer::Group &group, QWidget *parent); + ConfigWidget(const ::Programmer::Group &group, TQWidget *tqparent); virtual void loadConfig(); virtual void saveConfig(); @@ -34,7 +35,7 @@ private: class GroupUI : public ::Bootloader::GroupUI { public: - virtual ::Programmer::ConfigWidget *createConfigWidget(QWidget *parent) const; + virtual ::Programmer::ConfigWidget *createConfigWidget(TQWidget *tqparent) const; }; } // namespace diff --git a/src/progs/tbl_bootloader/xml/xml_tbl_bootloader_parser.cpp b/src/progs/tbl_bootloader/xml/xml_tbl_bootloader_parser.cpp index 62ed806..0960cd1 100644 --- a/src/progs/tbl_bootloader/xml/xml_tbl_bootloader_parser.cpp +++ b/src/progs/tbl_bootloader/xml/xml_tbl_bootloader_parser.cpp @@ -22,11 +22,11 @@ public: XmlToData() : Programmer::XmlToData<Data>("tbl_bootloader", "TinyBootloader") {} private: - virtual void parseData(QDomElement element, Data &data); - virtual void outputData(const Data &data, QTextStream &s) const; + virtual void parseData(TQDomElement element, Data &data); + virtual void outputData(const Data &data, TQTextStream &s) const; }; -void TinyBootloader::XmlToData::parseData(QDomElement element, Data &data) +void TinyBootloader::XmlToData::parseData(TQDomElement element, Data &data) { const Device::Data *ddata = Device::lister().data(currentDevice()); if ( ddata->group().name()!="pic" ) qFatal("non-pic device not supported"); @@ -37,7 +37,7 @@ void TinyBootloader::XmlToData::parseData(QDomElement element, Data &data) if ( !ok ) qFatal("Invalid \"id\" tag"); } -void TinyBootloader::XmlToData::outputData(const Data &data, QTextStream &s) const +void TinyBootloader::XmlToData::outputData(const Data &data, TQTextStream &s) const { s << data.id; } |