summaryrefslogtreecommitdiffstats
path: root/src/common/port/parallel.cpp
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/common/port/parallel.cpp
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/common/port/parallel.cpp')
-rw-r--r--src/common/port/parallel.cpp58
1 files changed, 29 insertions, 29 deletions
diff --git a/src/common/port/parallel.cpp b/src/common/port/parallel.cpp
index 22b6a4c..d92bc82 100644
--- a/src/common/port/parallel.cpp
+++ b/src/common/port/parallel.cpp
@@ -30,9 +30,9 @@
#include "common/common/misc.h"
//-----------------------------------------------------------------------------
-QStringList *Port::Parallel::_list = 0;
+TQStringList *Port::Parallel::_list = 0;
-Port::IODirs Port::Parallel::probe(const QString &device)
+Port::IODirs Port::Parallel::probe(const TQString &device)
{
#if defined(HAVE_PPDEV)
int fd = ::open(device.latin1(), O_RDWR);
@@ -54,26 +54,26 @@ Port::IODirs Port::Parallel::probe(const QString &device)
#endif
}
-QStringList Port::Parallel::deviceList()
+TQStringList Port::Parallel::deviceList()
{
- QStringList list;
+ TQStringList list;
#if defined(HAVE_PPDEV)
// standard parport in user space
- for(int i = 0; i<8; ++i) list.append(QString("/dev/parport%1").arg(i));
+ for(int i = 0; i<8; ++i) list.append(TQString("/dev/parport%1").tqarg(i));
// new devfs parport flavour
- for(int i = 0; i<8; ++i) list.append(QString("/dev/parports/%1").arg(i));
+ for(int i = 0; i<8; ++i) list.append(TQString("/dev/parports/%1").tqarg(i));
#elif defined(HAVE_PPBUS)
// FreeBSD
- for(int i = 0; i<8; ++i) list.append(QString("/dev/ppi%1").arg(i));
+ for(int i = 0; i<8; ++i) list.append(TQString("/dev/ppi%1").tqarg(i));
#endif
return list;
}
-const QStringList &Port::Parallel::probedDeviceList()
+const TQStringList &Port::Parallel::probedDeviceList()
{
if ( _list==0 ) {
- QStringList all = deviceList();
- _list = new QStringList;
+ TQStringList all = deviceList();
+ _list = new TQStringList;
for (uint i=0; i<uint(all.count()); i++)
if( probe(all[i]) & (In | Out) ) _list->append(all[i]);
}
@@ -100,12 +100,12 @@ const Port::Parallel::PPinData Port::Parallel::PIN_DATA[Nb_Pins] = {
{ Data, 0x20, Out, "D5" }, // data 5
{ Data, 0x40, Out, "D6" }, // data 6
{ Data, 0x80, Out, "D7" }, // data 7
- { Status, 0x40, In, "/ACK" }, // !ack
- { Status, 0x80, In, "BUSY" }, // busy
- { Status, 0x20, In, "PAPER" }, // pout
- { Status, 0x10, In, "SELin" }, // select
+ { tqStatus, 0x40, In, "/ACK" }, // !ack
+ { tqStatus, 0x80, In, "BUSY" }, // busy
+ { tqStatus, 0x20, In, "PAPER" }, // pout
+ { tqStatus, 0x10, In, "SELin" }, // select
{ Control, 0x02, Out, "LF" }, // !feed
- { Status, 0x08, In, "/ERROR" }, // !error
+ { tqStatus, 0x08, In, "/ERROR" }, // !error
{ Control, 0x04, Out, "PRIME" }, // !init
{ Control, 0x08, Out, "SELout" }, // !si
{ Nb_RequestTypes, 0x00, NoIO, "GND" }, // GND
@@ -118,9 +118,9 @@ const Port::Parallel::PPinData Port::Parallel::PIN_DATA[Nb_Pins] = {
{ Nb_RequestTypes, 0x00, NoIO, "GND" } // GND
};
-QValueVector<Port::PinData> Port::Parallel::pinData(IODir dir) const
+TQValueVector<Port::PinData> Port::Parallel::pinData(IODir dir) const
{
- QValueVector<PinData> v;
+ TQValueVector<PinData> v;
for (uint i=0; i<Nb_Pins; i++) {
if ( PIN_DATA[i].dir!=dir ) continue;
PinData pd = { i, PIN_DATA[i].label };
@@ -131,7 +131,7 @@ QValueVector<Port::PinData> Port::Parallel::pinData(IODir dir) const
bool Port::Parallel::isGroundPin(uint pin) const
{
- return ( PIN_DATA[pin].label==QString("GND") );
+ return ( PIN_DATA[pin].label==TQString("GND") );
}
Port::IODir Port::Parallel::ioDir(uint pin) const
@@ -155,7 +155,7 @@ const Port::Parallel::RequestData Port::Parallel::REQUEST_DATA[Nb_RequestTypes]
#endif
};
-Port::Parallel::Parallel(const QString &device, Log::Base &base)
+Port::Parallel::Parallel(const TQString &device, Log::Base &base)
: Base(base), _fd(-1), _device(device)
{
for (uint i=0; i<Nb_RequestTypes; i++) _images[i] = 0;
@@ -166,17 +166,17 @@ bool Port::Parallel::internalOpen()
#if defined(HAVE_PPDEV)
_fd = ::open(_device.latin1(), O_RDWR);
if ( _fd<0 ) {
- setSystemError(i18n("Could not open device \"%1\"").arg(_device));
+ setSystemError(i18n("Could not open device \"%1\"").tqarg(_device));
return false;
}
if ( ioctl(_fd, PPCLAIM)<0 ) {
- setSystemError(i18n("Could not claim device \"%1\": check it is read/write enabled").arg(_device));
+ setSystemError(i18n("Could not claim device \"%1\": check it is read/write enabled").tqarg(_device));
return false;
}
#elif defined(HAVE_PPBUS)
_fd = ::open(_device.latin1(), O_RDWR);
if ( _fd<0 ) {
- setSystemError(i18n("Could not open device \"%1\"").arg(_device));
+ setSystemError(i18n("Could not open device \"%1\"").tqarg(_device));
return false;
}
#endif
@@ -203,12 +203,12 @@ bool Port::Parallel::setPinOn(uint pin, bool on, LogicType type)
Q_ASSERT( PIN_DATA[pin].dir==Out );
RequestType rtype = PIN_DATA[pin].rType;
Q_ASSERT( rtype!=Nb_RequestTypes );
- uchar mask = PIN_DATA[pin].mask;
- uchar c = (XOR(type==NegativeLogic, on) ? _images[rtype] | mask : _images[rtype] & ~mask);
+ uchar tqmask = PIN_DATA[pin].tqmask;
+ uchar c = (XOR(type==NegativeLogic, on) ? _images[rtype] | tqmask : _images[rtype] & ~tqmask);
int request = REQUEST_DATA[rtype].write;
Q_ASSERT( request!=0 );
if ( ioctl(_fd, request, &c)<0 ) {
- setSystemError(i18n("Error setting pin %1 to %2").arg(PIN_DATA[pin].label).arg(on));
+ setSystemError(i18n("Error setting pin %1 to %2").tqarg(PIN_DATA[pin].label).tqarg(on));
return false;
}
_images[rtype] = c;
@@ -228,19 +228,19 @@ bool Port::Parallel::readPin(uint pin, LogicType type, bool &value)
Q_ASSERT( request!=0 );
uchar c = 0;
if ( ioctl(_fd, request, &c)<0 ) {
- setSystemError(i18n("Error reading bit on pin %1").arg(PIN_DATA[pin].label));
+ setSystemError(i18n("Error reading bit on pin %1").tqarg(PIN_DATA[pin].label));
return false;
}
_images[rtype] = c;
- value = (type==NegativeLogic ? ~c : c ) & PIN_DATA[pin].mask;
+ value = (type==NegativeLogic ? ~c : c ) & PIN_DATA[pin].tqmask;
#endif
return true;
}
-void Port::Parallel::setSystemError(const QString &message)
+void Port::Parallel::setSystemError(const TQString &message)
{
#if defined(HAVE_PPDEV) || defined(HAVE_PPBUS)
- log(Log::LineType::Error, message + QString(" (errno=%1).").arg(strerror(errno)));
+ log(Log::LineType::Error, message + TQString(" (errno=%1).").tqarg(strerror(errno)));
#else
Q_UNUSED(message);
#endif