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/icd1 | |
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/icd1')
-rw-r--r-- | src/progs/icd1/base/icd1.cpp | 22 | ||||
-rw-r--r-- | src/progs/icd1/base/icd1.h | 6 | ||||
-rw-r--r-- | src/progs/icd1/base/icd1_data.h | 4 | ||||
-rw-r--r-- | src/progs/icd1/base/icd1_prog.cpp | 2 | ||||
-rw-r--r-- | src/progs/icd1/base/icd1_prog.h | 7 | ||||
-rw-r--r-- | src/progs/icd1/base/icd1_serial.cpp | 10 | ||||
-rw-r--r-- | src/progs/icd1/base/icd1_serial.h | 2 | ||||
-rw-r--r-- | src/progs/icd1/gui/icd1_group_ui.cpp | 16 | ||||
-rw-r--r-- | src/progs/icd1/gui/icd1_group_ui.h | 9 | ||||
-rw-r--r-- | src/progs/icd1/xml/xml_icd1_parser.cpp | 8 |
10 files changed, 44 insertions, 42 deletions
diff --git a/src/progs/icd1/base/icd1.cpp b/src/progs/icd1/base/icd1.cpp index 8c2704a..2ce3c80 100644 --- a/src/progs/icd1/base/icd1.cpp +++ b/src/progs/icd1/base/icd1.cpp @@ -14,24 +14,24 @@ #include "common/port/port_base.h" //----------------------------------------------------------------------------- -Icd1::Hardware::Hardware(::Programmer::Base &base, const QString &portDevice) +Icd1::Hardware::Hardware(::Programmer::Base &base, const TQString &portDevice) : Icd::Hardware(base, new SerialPort(portDevice, base)) {} -bool Icd1::Hardware::internalConnect(const QString &mode) +bool Icd1::Hardware::internalConnect(const TQString &mode) { if ( !port()->open() ) return false; if ( !port()->reset() ) return false; if ( hasError() ) return false; - QByteArray a = toAscii(mode); + TQByteArray a = toAscii(mode); if ( !port()->send(a.data(), a.count()) ) return false; - QString s; + TQString s; if ( !port()->receive(1, s) ) return false; port()->setPinOn(Port::Serial::RTS, false, Port::PositiveLogic); Port::msleep(1); port()->setPinOn(Port::Serial::RTS, true, Port::PositiveLogic); if ( s.upper()!=mode ) { - log(Log::LineType::Error, i18n("Failed to set port mode to '%1'.").arg(mode)); + log(Log::LineType::Error, i18n("Failed to set port mode to '%1'.").tqarg(mode)); return false; } return true; @@ -52,10 +52,10 @@ bool Icd1::Hardware::readBlockCommand(uint nbBytes) { Q_ASSERT( nbBytes<=0xFF ); if ( !port()->sendCommand(0x7D00 + nbBytes) ) return false; - QByteArray a(nbBytes); + TQByteArray a(nbBytes); for (uint i=0; i<nbBytes; i++) if ( !port()->receiveByte(*(a.data()+i), i!=0) ) return false; - _rx = QString(a); + _rx = TQString(a); return true; } @@ -79,12 +79,12 @@ bool Icd1::Hardware::readVoltages(VoltagesData &voltages) if ( !sendCommand(0x701C, &res) ) return false; voltages[Pic::TargetVdd].value = (2.050 / 256) * res.toUInt(); // voltage at AN0 pin voltages[Pic::TargetVdd].value /= (4.7 / 14.7); // voltage at Vcc - log(Log::DebugLevel::Max, QString("Vdd: %1 %2").arg(toHexLabel(res, 4)).arg(voltages[Pic::TargetVdd].value)); + log(Log::DebugLevel::Max, TQString("Vdd: %1 %2").tqarg(toHexLabel(res, 4)).tqarg(voltages[Pic::TargetVdd].value)); voltages[Pic::TargetVdd].error = false; if ( !sendCommand(0x701D, &res) ) return false; voltages[Pic::TargetVpp].value = (2.050 / 256) * res.byte(0); // voltage at AN1 pin voltages[Pic::TargetVpp].value /= (10.0 / 110.0); // voltage at Vpp - log(Log::DebugLevel::Max, QString("Vpp: %1 %2").arg(toHexLabel(res, 4)).arg(voltages[Pic::TargetVpp].value)); + log(Log::DebugLevel::Max, TQString("Vpp: %1 %2").tqarg(toHexLabel(res, 4)).tqarg(voltages[Pic::TargetVpp].value)); voltages[Pic::TargetVpp].error = false; return sendCommand(0x7001); } @@ -106,7 +106,7 @@ bool Icd1::Hardware::selfTest() BitValue res; if ( !sendCommand(0x700B, &res, 5000) ) return false; if ( res!=0 ) { - log(Log::LineType::Warning, i18n("Self-test failed (returned value is %1)").arg(toLabel(res))); + log(Log::LineType::Warning, i18n("Self-test failed (returned value is %1)").tqarg(toLabel(res))); return false; } return true; @@ -152,7 +152,7 @@ bool Icd1::Hardware::eraseAll() if ( !sendCommand(0x7007, &res) ) return false; if ( !sendCommand(0x7001) ) return false; // disable Vpp if ( res!=0x3FFF ) { - log(Log::LineType::Error, i18n("Erase failed (returned value is %1)").arg(toHexLabel(res, 4))); + log(Log::LineType::Error, i18n("Erase failed (returned value is %1)").tqarg(toHexLabel(res, 4))); return false; } return true; diff --git a/src/progs/icd1/base/icd1.h b/src/progs/icd1/base/icd1.h index d1ae1d0..4026c8e 100644 --- a/src/progs/icd1/base/icd1.h +++ b/src/progs/icd1/base/icd1.h @@ -20,7 +20,7 @@ namespace Icd1 class Hardware : public Icd::Hardware { public: - Hardware(::Programmer::Base &base, const QString &portDevice); + Hardware(::Programmer::Base &base, const TQString &portDevice); SerialPort *port() { return static_cast<SerialPort *>(_port); } // initialization virtual bool uploadFirmware(const Pic::Memory &memory); @@ -46,8 +46,8 @@ public: virtual BitValue getProgramCounter(); private: - virtual bool internalConnect(const QString &mode); - virtual QString receivedData() const { return _rx; } + virtual bool internalConnect(const TQString &mode); + virtual TQString receivedData() const { return _rx; } bool sendCommand(uint cmd, BitValue *res = 0, uint timeout = Port::Serial::DEFAULT_TIMEOUT); bool readBlockCommand(uint nbBytes); bool gotoMemory(Pic::MemoryRangeType type, uint offset); diff --git a/src/progs/icd1/base/icd1_data.h b/src/progs/icd1/base/icd1_data.h index 4200578..a3aeec0 100644 --- a/src/progs/icd1/base/icd1_data.h +++ b/src/progs/icd1/base/icd1_data.h @@ -9,14 +9,14 @@ #ifndef ICD1_DATA_H #define ICD1_DATA_H -#include <qstring.h> +#include <tqstring.h> namespace Icd1 { struct Data { uchar part; }; - extern const Data &data(const QString &device); + extern const Data &data(const TQString &device); } // namespace #endif diff --git a/src/progs/icd1/base/icd1_prog.cpp b/src/progs/icd1/base/icd1_prog.cpp index 13d0d4c..0f79270 100644 --- a/src/progs/icd1/base/icd1_prog.cpp +++ b/src/progs/icd1/base/icd1_prog.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ #include "icd1_prog.h" -#include <qdir.h> +#include <tqdir.h> #include "progs/base/prog_config.h" #include "devices/list/device_list.h" diff --git a/src/progs/icd1/base/icd1_prog.h b/src/progs/icd1/base/icd1_prog.h index 721be49..5df72ab 100644 --- a/src/progs/icd1/base/icd1_prog.h +++ b/src/progs/icd1/base/icd1_prog.h @@ -22,6 +22,7 @@ class Hardware; class ProgrammerBase : public Icd::ProgrammerBase { Q_OBJECT + TQ_OBJECT public: ProgrammerBase(const Programmer::Group &group, const Pic::Data *data) : Icd::ProgrammerBase(group, data, "icd1_programmer_base") {} @@ -40,9 +41,9 @@ private: class Group : public Icd::Group { public: - virtual QString name() const { return "icd1"; } - virtual QString label() const { return i18n("ICD1 Programmer"); } - virtual QString xmlName() const { return "icd1"; } + virtual TQString name() const { return "icd1"; } + virtual TQString label() const { return i18n("ICD1 Programmer"); } + virtual TQString xmlName() const { return "icd1"; } virtual ::Programmer::Properties properties() const; virtual ::Programmer::TargetPowerMode targetPowerMode() const { return ::Programmer::TargetExternallyPowered; } virtual bool isPortSupported(PortType type) const { return ( type==PortType::Serial ); } diff --git a/src/progs/icd1/base/icd1_serial.cpp b/src/progs/icd1/base/icd1_serial.cpp index a506fdb..8d40697 100644 --- a/src/progs/icd1/base/icd1_serial.cpp +++ b/src/progs/icd1/base/icd1_serial.cpp @@ -9,13 +9,13 @@ ***************************************************************************/ #include "icd1_serial.h" -#include <qdatetime.h> +#include <tqdatetime.h> #include "common/global/global.h" #include "common/common/misc.h" #include "common/common/number.h" //----------------------------------------------------------------------------- -Icd1::SerialPort::SerialPort(const QString &device, Log::Base &log) +Icd1::SerialPort::SerialPort(const TQString &device, Log::Base &log) : Port::Serial(device, NeedDrain | NeedFlush, log) {} @@ -41,7 +41,7 @@ bool Icd1::SerialPort::reset() bool Icd1::SerialPort::synchronize() { if ( !setPinOn(RTS, false, Port::PositiveLogic) ) return false; - QTime time; + TQTime time; time.start(); for (;;) { bool bit; @@ -60,8 +60,8 @@ bool Icd1::SerialPort::sendCommand(uint cmd) Q_ASSERT( cmd<=0xFFFF ); synchronize(); char c[7] = "$XXXX\r"; - QString cs = toHex(cmd, 4); - log(Log::DebugLevel::Extra, QString("Send command: %1").arg(toPrintable(cs, PrintAlphaNum))); + TQString cs = toHex(cmd, 4); + log(Log::DebugLevel::Extra, TQString("Send command: %1").tqarg(toPrintable(cs, PrintAlphaNum))); c[1] = cs[0].latin1(); c[2] = cs[1].latin1(); c[3] = cs[2].latin1(); diff --git a/src/progs/icd1/base/icd1_serial.h b/src/progs/icd1/base/icd1_serial.h index e8d03da..e86dbaa 100644 --- a/src/progs/icd1/base/icd1_serial.h +++ b/src/progs/icd1/base/icd1_serial.h @@ -18,7 +18,7 @@ namespace Icd1 class SerialPort : public Port::Serial { public: - SerialPort(const QString &portDevice, Log::Base &log); + SerialPort(const TQString &portDevice, Log::Base &log); bool open(); bool reset(); bool synchronize(); diff --git a/src/progs/icd1/gui/icd1_group_ui.cpp b/src/progs/icd1/gui/icd1_group_ui.cpp index 34f28d5..1ae73a3 100644 --- a/src/progs/icd1/gui/icd1_group_ui.cpp +++ b/src/progs/icd1/gui/icd1_group_ui.cpp @@ -13,13 +13,13 @@ #include "progs/icd1/base/icd1_prog.h" //---------------------------------------------------------------------------- -Icd1::AdvancedDialog::AdvancedDialog(ProgrammerBase &base, QWidget *parent) - : ::Programmer::PicAdvancedDialog(base, parent, "icd1_advanced_dialog") +Icd1::AdvancedDialog::AdvancedDialog(ProgrammerBase &base, TQWidget *tqparent) + : ::Programmer::PicAdvancedDialog(base, tqparent, "icd1_advanced_dialog") { uint row = _selfTestContainer->numRows(); - QLabel *label = new QLabel(i18n("Result:"), _selfTestContainer); + TQLabel *label = new TQLabel(i18n("Result:"), _selfTestContainer); _selfTestContainer->addWidget(label, row,row, 0,0); - _selfTestLabel = new QLabel(_selfTestContainer); + _selfTestLabel = new TQLabel(_selfTestContainer); _selfTestContainer->addWidget(_selfTestLabel, row,row, 1,1); } @@ -30,12 +30,12 @@ void Icd1::AdvancedDialog::updateDisplay() } //---------------------------------------------------------------------------- -::Programmer::ConfigWidget *Icd1::GroupUI::createConfigWidget(QWidget *parent) const +::Programmer::ConfigWidget *Icd1::GroupUI::createConfigWidget(TQWidget *tqparent) const { - return new ::Programmer::ConfigWidget(static_cast<const Group &>(group()), parent); + return new ::Programmer::ConfigWidget(static_cast<const Group &>(group()), tqparent); } -::Programmer::AdvancedDialog *Icd1::GroupUI::createAdvancedDialog(::Programmer::Base &base, QWidget *parent) const +::Programmer::AdvancedDialog *Icd1::GroupUI::createAdvancedDialog(::Programmer::Base &base, TQWidget *tqparent) const { - return new AdvancedDialog(static_cast<ProgrammerBase &>(base), parent); + return new AdvancedDialog(static_cast<ProgrammerBase &>(base), tqparent); } diff --git a/src/progs/icd1/gui/icd1_group_ui.h b/src/progs/icd1/gui/icd1_group_ui.h index f60562a..c4f1c33 100644 --- a/src/progs/icd1/gui/icd1_group_ui.h +++ b/src/progs/icd1/gui/icd1_group_ui.h @@ -20,12 +20,13 @@ class Group; class AdvancedDialog : public ::Programmer::PicAdvancedDialog { Q_OBJECT + TQ_OBJECT public: - AdvancedDialog(ProgrammerBase &base, QWidget *parent); + AdvancedDialog(ProgrammerBase &base, TQWidget *tqparent); virtual void updateDisplay(); private: - QLabel *_selfTestLabel; + TQLabel *_selfTestLabel; ProgrammerBase &base() { return static_cast<ProgrammerBase &>(_base); } }; @@ -33,9 +34,9 @@ private: 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/icd1/xml/xml_icd1_parser.cpp b/src/progs/icd1/xml/xml_icd1_parser.cpp index e09f51c..3296134 100644 --- a/src/progs/icd1/xml/xml_icd1_parser.cpp +++ b/src/progs/icd1/xml/xml_icd1_parser.cpp @@ -19,18 +19,18 @@ public: XmlToData() : Programmer::XmlToData<Data>("icd1", "Icd1") {} 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 Icd1::XmlToData::parseData(QDomElement element, Data &data) +void Icd1::XmlToData::parseData(TQDomElement element, Data &data) { bool ok; data.part = fromHexLabel(element.attribute("family"), 2, &ok); if ( !ok ) qFatal("Missing or malformed family attribute"); } -void Icd1::XmlToData::outputData(const Data &data, QTextStream &s) const +void Icd1::XmlToData::outputData(const Data &data, TQTextStream &s) const { s << toHexLabel(data.part, 2); } |