From c663b6440964f6ac48027143ac9e63298991f9d0 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:33:34 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1157639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kcontrol/usbview/usbdevices.cpp | 108 ++++++++++++++++++++-------------------- 1 file changed, 54 insertions(+), 54 deletions(-) (limited to 'kcontrol/usbview/usbdevices.cpp') diff --git a/kcontrol/usbview/usbdevices.cpp b/kcontrol/usbview/usbdevices.cpp index 3d557a7ed..466fd9a98 100644 --- a/kcontrol/usbview/usbdevices.cpp +++ b/kcontrol/usbview/usbdevices.cpp @@ -15,9 +15,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include @@ -32,7 +32,7 @@ #include #endif -QPtrList USBDevice::_devices; +TQPtrList USBDevice::_devices; USBDB *USBDevice::_db; @@ -50,26 +50,26 @@ USBDevice::USBDevice() _db = new USBDB; } -static QString catFile(QString fname) +static TQString catFile(TQString fname) { char buffer[256]; - QString result; - int fd = ::open(QFile::encodeName(fname), O_RDONLY); + TQString result; + int fd = ::open(TQFile::encodeName(fname), O_RDONLY); if (fd<0) - return QString::null; + return TQString::null; if (fd >= 0) { ssize_t count; while ((count = ::read(fd, buffer, 256)) > 0) - result.append(QString(buffer).left(count)); + result.append(TQString(buffer).left(count)); ::close(fd); } return result.stripWhiteSpace(); } -void USBDevice::parseSysDir(int bus, int parent, int level, QString dname) +void USBDevice::parseSysDir(int bus, int parent, int level, TQString dname) { _level = level; _parent = parent; @@ -80,7 +80,7 @@ void USBDevice::parseSysDir(int bus, int parent, int level, QString dname) _device = catFile(dname + "/devnum").toUInt(); if (_device == 1) - _product += QString(" (%1)").arg(_bus); + _product += TQString(" (%1)").arg(_bus); _vendorID = catFile(dname + "/idVendor").toUInt(0, 16); _prodID = catFile(dname + "/idProduct").toUInt(0, 16); @@ -97,12 +97,12 @@ void USBDevice::parseSysDir(int bus, int parent, int level, QString dname) _verMajor = int(version); _verMinor = int(10*(version - floor(version))); - QDir dir(dname); - dir.setNameFilter(QString("%1-*").arg(bus)); - dir.setFilter(QDir::Dirs); - QStringList list = dir.entryList(); + TQDir dir(dname); + dir.setNameFilter(TQString("%1-*").arg(bus)); + dir.setFilter(TQDir::Dirs); + TQStringList list = dir.entryList(); - for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { + for(TQStringList::Iterator it = list.begin(); it != list.end(); ++it) { if ((*it).contains(':')) continue; @@ -111,7 +111,7 @@ void USBDevice::parseSysDir(int bus, int parent, int level, QString dname) } } -void USBDevice::parseLine(QString line) +void USBDevice::parseLine(TQString line) { if (line.startsWith("T:")) sscanf(line.local8Bit().data(), @@ -123,7 +123,7 @@ void USBDevice::parseLine(QString line) _product = line.mid(12); /* add bus number to root devices */ if (_device==1) - _product += QString(" (%1)").arg(_bus); + _product += TQString(" (%1)").arg(_bus); } else if (line.startsWith("S: SerialNumber")) _serial = line.mid(17); @@ -151,27 +151,27 @@ void USBDevice::parseLine(QString line) USBDevice *USBDevice::find(int bus, int device) { - QPtrListIterator it(_devices); + TQPtrListIterator it(_devices); for ( ; it.current(); ++it) if (it.current()->bus() == bus && it.current()->device() == device) return it.current(); return 0; } -QString USBDevice::product() +TQString USBDevice::product() { if (!_product.isEmpty()) return _product; - QString pname = _db->device(_vendorID, _prodID); + TQString pname = _db->device(_vendorID, _prodID); if (!pname.isEmpty()) return pname; return i18n("Unknown"); } -QString USBDevice::dump() +TQString USBDevice::dump() { - QString r; + TQString r; r = "

" + product() + "


"; @@ -182,41 +182,41 @@ QString USBDevice::dump() r += "
"; - QString c = QString("").arg(_class); - QString cname = _db->cls(_class); + TQString c = TQString("").arg(_class); + TQString cname = _db->cls(_class); if (!cname.isEmpty()) c += ""; r += i18n("%1").arg(c); - QString sc = QString("").arg(_sub); - QString scname = _db->subclass(_class, _sub); + TQString sc = TQString("").arg(_sub); + TQString scname = _db->subclass(_class, _sub); if (!scname.isEmpty()) sc += ""; r += i18n("%1").arg(sc); - QString pr = QString("").arg(_prot); - QString prname = _db->protocol(_class, _sub, _prot); + TQString pr = TQString("").arg(_prot); + TQString prname = _db->protocol(_class, _sub, _prot); if (!prname.isEmpty()) pr += ""; r += i18n("%1").arg(pr); #ifndef Q_OS_FREEBSD r += i18n("") .arg(_verMajor,0,16) - .arg(QString::number(_verMinor,16).prepend('0').right(2)); + .arg(TQString::number(_verMinor,16).prepend('0').right(2)); #endif r += ""; - QString v = QString::number(_vendorID,16); - QString name = _db->vendor(_vendorID); + TQString v = TQString::number(_vendorID,16); + TQString name = _db->vendor(_vendorID); if (!name.isEmpty()) v += ""; r += i18n("").arg(v); - QString p = QString::number(_prodID,16); - QString pname = _db->device(_vendorID, _prodID); + TQString p = TQString::number(_prodID,16); + TQString pname = _db->device(_vendorID, _prodID); if (!pname.isEmpty()) p += ""; r += i18n("").arg(p); r += i18n("") .arg(_revMajor,0,16) - .arg(QString::number(_revMinor,16).prepend('0').right(2)); + .arg(TQString::number(_revMinor,16).prepend('0').right(2)); r += ""; r += i18n("").arg(_speed); @@ -228,7 +228,7 @@ QString USBDevice::dump() r += i18n(""); r += i18n("").arg(*_devnodes.at(0)); if ( _devnodes.count() > 1 ) - for ( QStringList::Iterator it = _devnodes.at(1); it != _devnodes.end(); ++it ) + for ( TQStringList::Iterator it = _devnodes.at(1); it != _devnodes.end(); ++it ) r += ""; #else r += i18n("").arg(_maxPacketSize); @@ -250,18 +250,18 @@ QString USBDevice::dump() #ifndef Q_OS_FREEBSD -bool USBDevice::parse(QString fname) +bool USBDevice::parse(TQString fname) { _devices.clear(); - QString result; + TQString result; // read in the complete file // - // Note: we can't use a QTextStream, as the files in /proc + // Note: we can't use a TQTextStream, as the files in /proc // are pseudo files with zero length char buffer[256]; - int fd = ::open(QFile::encodeName(fname), O_RDONLY); + int fd = ::open(TQFile::encodeName(fname), O_RDONLY); if (fd<0) return false; @@ -269,7 +269,7 @@ bool USBDevice::parse(QString fname) { ssize_t count; while ((count = ::read(fd, buffer, 256)) > 0) - result.append(QString(buffer).left(count)); + result.append(TQString(buffer).left(count)); ::close(fd); } @@ -277,10 +277,10 @@ bool USBDevice::parse(QString fname) // read in the device infos USBDevice *device = 0; int start=0, end; - result.replace(QRegExp("^\n"),""); + result.replace(TQRegExp("^\n"),""); while ((end = result.find('\n', start)) > 0) { - QString line = result.mid(start, end-start); + TQString line = result.mid(start, end-start); if (line.startsWith("T:")) device = new USBDevice(); @@ -293,17 +293,17 @@ bool USBDevice::parse(QString fname) return true; } -bool USBDevice::parseSys(QString dname) +bool USBDevice::parseSys(TQString dname) { - QDir d(dname); + TQDir d(dname); d.setNameFilter("usb*"); - QStringList list = d.entryList(); + TQStringList list = d.entryList(); - for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { + for(TQStringList::Iterator it = list.begin(); it != list.end(); ++it) { USBDevice* device = new USBDevice(); int bus = 0; - QRegExp bus_reg("[a-z]*([0-9]+)"); + TQRegExp bus_reg("[a-z]*([0-9]+)"); if (bus_reg.search(*it) != -1) bus = bus_reg.cap(1).toInt(); @@ -332,10 +332,10 @@ void USBDevice::collectData( int fd, int level, usb_device_info &di, int parent) _bus = di.udi_bus; _device = di.udi_addr; - _product = QString::fromLatin1(di.udi_product); + _product = TQString::fromLatin1(di.udi_product); if ( _device == 1 ) - _product += " " + QString::number( _bus ); - _manufacturer = QString::fromLatin1(di.udi_vendor); + _product += " " + TQString::number( _bus ); + _manufacturer = TQString::fromLatin1(di.udi_vendor); _prodID = di.udi_productNo; _vendorID = di.udi_vendorNo; _class = di.udi_class; @@ -387,13 +387,13 @@ void USBDevice::collectData( int fd, int level, usb_device_info &di, int parent) -bool USBDevice::parse(QString fname) +bool USBDevice::parse(TQString fname) { static bool showErrorMessage = true; bool error = false; _devices.clear(); - QFile controller("/dev/usb0"); + TQFile controller("/dev/usb0"); int i = 1; while ( controller.exists() ) { @@ -418,7 +418,7 @@ bool USBDevice::parse(QString fname) } else { error = true; } - controller.setName( QString::fromLocal8Bit("/dev/usb%1").arg(i++) ); + controller.setName( TQString::fromLocal8Bit("/dev/usb%1").arg(i++) ); } if ( showErrorMessage && error ) { -- cgit v1.2.1
%1%1(" + i18n(cname.latin1()) +")
Class
%1%1(" + i18n(scname.latin1()) +")
Subclass
%1%1(" + prname +")
Protocol
USB Version%1.%2
(" + name +")
Vendor ID0x%1
(" + pname +")
Product ID0x%1
Revision%1.%2
Speed%1 Mbit/s
Power Consumptionself powered
Attached Devicenodes%1
" + *it + "
Max. Packet Size%1