Commit 5db30eca authored by Laurent Montel's avatar Laurent Montel 😁

Use QStringLiteral where it's possible

parent 7c0f8516
......@@ -82,7 +82,10 @@ configure_file(config-workspace.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-works
configure_file(config-X11.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-X11.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
remove_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_STRICT_ITERATORS -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_KEYWORDS)
remove_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_KEYWORDS)
add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
add_definitions(-DQT_USE_QSTRINGBUILDER)
if(NOT CMAKE_VERSION VERSION_LESS "3.10.0" AND KF5_VERSION VERSION_LESS "5.42.0")
# CMake 3.9+ warns about automoc on files without Q_OBJECT, and doesn't know about other macros.
......
......@@ -74,8 +74,8 @@ Module::Module(QWidget *parent, const QVariantList &args) :
{
KAboutData *aboutData = new KAboutData(QStringLiteral("kcm-about-distro"),
i18nc("@title", "About Distribution"),
global_s_versionStringFull,
QStringLiteral(""),
QString::fromLatin1(global_s_versionStringFull),
QString(),
KAboutLicense::LicenseKey::GPL_V3,
i18nc("@info:credit", "Copyright 2012-2014 Harald Sitter"));
......@@ -177,7 +177,7 @@ void Module::loadSoftware()
ui->plasmaLabel->setText(plasma);
}
ui->qtLabel->setText(qVersion());
ui->qtLabel->setText(QString::fromLatin1(qVersion()));
ui->frameworksLabel->setText(KCoreAddons::versionString());
}
......@@ -189,7 +189,7 @@ void Module::loadHardware()
ui->kernel->hide();
ui->kernelLabel->hide();
} else {
ui->kernelLabel->setText(utsName.release);
ui->kernelLabel->setText(QString::fromLatin1(utsName.release));
}
const int bits = QT_POINTER_SIZE == 8 ? 64 : 32;
......
......@@ -49,7 +49,7 @@ static void setVar(QStringList *var, const QString &value)
// is required to not contain spaces even if more advanced shell escaping
// is also allowed...
QString value_ = value;
if (value_.at(0) == QChar('"') && value_.at(value_.size()-1) == QChar('"')) {
if (value_.at(0) == QLatin1Char('"') && value_.at(value_.size()-1) == QLatin1Char('"')) {
value_.remove(0, 1);
value_.remove(-1, 1);
}
......@@ -89,7 +89,7 @@ OSRelease::OSRelease()
QString line;
QStringList comps;
while (!file.atEnd()) {
line = file.readLine();
line = QString::fromLatin1(file.readLine());
if (line.startsWith(QLatin1Char('#'))) {
// Comment line
......
......@@ -23,6 +23,6 @@
#include "Module.h"
K_PLUGIN_FACTORY(KcmAboutDistroFactory,
registerPlugin<Module>("kcm-about-distro");)
registerPlugin<Module>(QStringLiteral("kcm-about-distro"));)
#include "main.moc"
......@@ -54,7 +54,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
bool GetInfo_ReadfromFile(QTreeWidget* tree, const char *FileName, const QChar& splitChar) {
bool added = false;
QFile file(FileName);
QFile file(QString::fromLatin1(FileName));
if (!file.exists()) {
return false;
......@@ -97,7 +97,7 @@ bool GetInfo_IRQ(QTreeWidget* tree) {
}
bool GetInfo_DMA(QTreeWidget* tree) {
QFile file(INFO_DMA);
QFile file(QString::fromLatin1(INFO_DMA));
QStringList headers;
headers << i18n("DMA-Channel") << i18n("Used By");
......@@ -153,7 +153,7 @@ bool GetInfo_IO_Ports(QTreeWidget* tree) {
QStringList headers;
headers << i18n("I/O-Range") << i18n("Used By");
tree->setHeaderLabels(headers);
return GetInfo_ReadfromFile(tree, INFO_IOPORTS, ':');
return GetInfo_ReadfromFile(tree, INFO_IOPORTS, QLatin1Char(':'));
}
bool GetInfo_XServer_and_Video(QTreeWidget* tree) {
......
......@@ -61,7 +61,7 @@ void WaylandModule::init()
compositorItem->setIcon(0, QIcon::fromTheme(QStringLiteral("wayland")));
compositorItem->setExpanded(true);
new QTreeWidgetItem(compositorItem, QStringList() << i18n("Name of the Display") << qgetenv("WAYLAND_DISPLAY"));
new QTreeWidgetItem(compositorItem, QStringList() << i18n("Name of the Display") << QString::fromLatin1(qgetenv("WAYLAND_DISPLAY")));
auto interfacesItem = new QTreeWidgetItem(compositorItem, QStringList() << i18n("Interfaces") << i18n("Interface Version"));
interfacesItem->setExpanded(true);
......@@ -75,7 +75,7 @@ void WaylandModule::init()
connect(registry, &Registry::interfaceAnnounced, this,
[this, interfacesItem] (const QByteArray &interface, quint32 name, quint32 version) {
Q_UNUSED(name)
new QTreeWidgetItem(interfacesItem, QStringList() << interface << QString::number(version));
new QTreeWidgetItem(interfacesItem, QStringList() << QString::fromLatin1(interface) << QString::number(version));
}
);
connect(registry, &Registry::seatAnnounced, this,
......
......@@ -49,8 +49,8 @@ static const QString HexStr(unsigned long val, int digits) {
int i;
hexstr = QStringLiteral("0x%1").arg(val, digits, 16/*=HEX*/);
for (i=hexstr.length()-1; i>0; --i)
if (hexstr[i]==' ')
hexstr[i] = '0';
if (hexstr[i]==QLatin1Char(' '))
hexstr[i] = QLatin1Char('0');
return hexstr;
}
......@@ -196,7 +196,7 @@ static QTreeWidgetItem* XServer_fill_screen_info(QTreeWidgetItem *lBox, QTreeWid
for (etp=event_table; etp->name; etp++) {
if (EventMaskOfScreen(s) & etp->value) {
QStringList eventList;
eventList << i18n("Event = %1", HexStr(etp->value, HEXDIGITS)) << etp->name;
eventList << i18n("Event = %1", HexStr(etp->value, HEXDIGITS)) << QString::fromLatin1(etp->name);
new QTreeWidgetItem(last, eventList);
}
}
......@@ -236,7 +236,7 @@ static bool GetInfo_XServer_Generic(QTreeWidget *lBox) {
next->setExpanded(true);
QStringList displayNameList;
displayNameList << i18n("Name of the Display") << DisplayString(dpy);
displayNameList << i18n("Name of the Display") << QString::fromUtf8(DisplayString(dpy));
last = new QTreeWidgetItem(next, displayNameList);
QStringList vendorList;
......@@ -334,7 +334,7 @@ static int GetInfo_ReadfromPipe(QTreeWidget* tree, const char *FileName, bool Wi
QTreeWidgetItem* olditem= nullptr;
QString s;
proc.start(FileName, QIODevice::ReadOnly);
proc.start(QString::fromLatin1(FileName), QIODevice::ReadOnly);
if (!proc.waitForFinished()) {
// Process hanged or did not start
return 0;
......
......@@ -59,19 +59,19 @@ CREATE_FACTORY(Wayland, i18n("Wayland"))
K_PLUGIN_FACTORY(KInfoModulesFactory,
#ifdef INFO_IRQ_AVAILABLE
registerPlugin<KIRQInfoWidget>("irq");
registerPlugin<KIRQInfoWidget>(QStringLiteral("irq"));
#endif
#ifdef INFO_IOPORTS_AVAILABLE
registerPlugin<KIO_PortsInfoWidget>("ioports");
registerPlugin<KIO_PortsInfoWidget>(QStringLiteral("ioports"));
#endif
#ifdef INFO_DMA_AVAILABLE
registerPlugin<KDMAInfoWidget>("dma");
registerPlugin<KDMAInfoWidget>(QStringLiteral("dma"));
#endif
#ifdef INFO_XSERVER_AVAILABLE
registerPlugin<KXServer_and_VideoInfoWidget>("xserver");
registerPlugin<KXServer_and_VideoInfoWidget>(QStringLiteral("xserver"));
#endif
#ifdef INFO_WAYLAND_AVAILABLE
registerPlugin<KWaylandInfoWidget>("wayland");
registerPlugin<KWaylandInfoWidget>(QStringLiteral("wayland"));
#endif
)
......
......@@ -105,7 +105,7 @@ bool Chart::drawChart(t_memsize total, const QList<t_memsize>& used, const QList
mFreeMemoryLabel->setText(i18n("%1 free", formattedUnit(last_used)));
setAccessibleDescription(accessibleDescription.join('\n'));
setAccessibleDescription(accessibleDescription.join(QLatin1Char('\n')));
return true;
}
......@@ -119,7 +119,7 @@ ChartWidget::ChartWidget(const QString& title, const QString& hint, Chart* chart
QVBoxLayout* mainLayout = new QVBoxLayout(this);
titleLabel = new QLabel("<strong>" + title + "</strong>", this);
titleLabel = new QLabel(QStringLiteral("<strong>") + title + QStringLiteral("</strong>"), this);
titleLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
titleLabel->setAlignment(Qt::AlignHCenter);
titleLabel->setToolTip(hint);
......@@ -129,7 +129,7 @@ ChartWidget::ChartWidget(const QString& title, const QString& hint, Chart* chart
chart->setToolTip(hint);
mainLayout->addWidget(chart);
mFreeMemoryLabel = new QLabel(QLatin1String(""), this);
mFreeMemoryLabel = new QLabel(QString(), this);
mFreeMemoryLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
mFreeMemoryLabel->setAlignment(Qt::AlignHCenter);
mFreeMemoryLabel->setToolTip(hint);
......
......@@ -135,9 +135,9 @@ static QString HWaddr2String(const char *hwaddr) {
int v = (*hwaddr & 0xff);
QString num = QStringLiteral("%1").arg(v, 0, 16);
if (num.length() < 2)
num.prepend("0");
num.prepend(QStringLiteral("0"));
if (i>0)
ret.append(":");
ret.append(QStringLiteral(":"));
ret.append(num);
}
return ret;
......@@ -172,7 +172,7 @@ QList<MyNIC*> findNICs() {
int flags;
struct sockaddr_in *sinptr;
MyNIC *tmp=0;
MyNIC *tmp=nullptr;
switch (ifr->ifr_addr.sa_family) {
case AF_INET:
sinptr = (struct sockaddr_in *) &ifr->ifr_addr;
......
......@@ -55,29 +55,30 @@ void ImportsView::updateList() {
list.clear();
char *e;
char buf[250];
QByteArray s(""), strSource, strMount, strType;
QByteArray s(""), strSource, strMount;
QString strType;
FILE *f=popen("mount", "r");
if (f==nullptr)
return;
do {
e=fgets(buf, 250, f);
if (e!=0) {
if (e) {
s=buf;
if ((s.contains(" nfs ")) || (s.contains(" smbfs "))) {
strSource=s.left(s.indexOf(" on /"));
strMount=s.mid(s.indexOf(" on /")+4, s.length());
if ((s.contains(" nfs ")) || (s.contains("/remote on ")))
strType="NFS";
strType=QStringLiteral("NFS");
else if (s.contains(" smbfs "))
strType="SMB";
strType=QStringLiteral("SMB");
int pos(strMount.indexOf(" type "));
if (pos==-1)
pos=strMount.indexOf(" read/");
strMount=strMount.left(pos);
QTreeWidgetItem *item = new QTreeWidgetItem(&list);
item->setText(0, strType);
item->setText(1, strSource);
item->setText(2, strMount);
item->setText(1, QString::fromUtf8(strSource));
item->setText(2, QString::fromUtf8(strMount));
};
};
} while (!feof(f));
......
......@@ -178,42 +178,42 @@ void LogView::updateList() {
};
};
if (timeRead==0) {
c1=0;
c2=0;
c3=0;
c4=0;
c1=nullptr;
c2=nullptr;
c3=nullptr;
c4=nullptr;
if (showConnOpen.isChecked())
c1=strstr(buf, CONN_OPEN);
if (c1==0) {
if (!c1) {
if (showConnClose.isChecked())
c2=strstr(buf, CONN_CLOSE);
if (c2==0) {
if (!c2) {
if (showFileOpen.isChecked())
c3=strstr(buf, FILE_OPEN);
if (c3==0) {
if (!c3) {
if (showFileClose.isChecked())
c4=strstr(buf, FILE_CLOSE);
if (c4==0)
if (!c4)
continue;
};
};
};
if (c1!=0) {
if (c1) {
c=strstr(buf, " as user");
*c='\0';
*c1='\0';
new QTreeWidgetItemX(&viewHistory,time,I18N_NOOP("CONNECTION OPENED"),c1+connOpenLen,buf+2);
connectionsCount++;
} else if (c2!=0) {
} else if (c2) {
*c2='\0';
new QTreeWidgetItemX(&viewHistory,time,I18N_NOOP("CONNECTION CLOSED"),c2+connCloseLen,buf+2);
} else if (c3!=0) {
} else if (c3) {
c=strstr(buf, " read=");
*c='\0';
*c3='\0';
new QTreeWidgetItemX(&viewHistory,time,I18N_NOOP(" FILE OPENED"),c3+fileOpenLen,buf+2);
filesCount++;
} else if (c4!=0) {
} else if (c4) {
c=strstr(buf, " (numopen=");
*c='\0';
*c4='\0';
......
......@@ -60,22 +60,22 @@ public:
//a faster constructor saves a lot time
QTreeWidgetItemX(QTreeWidget *parent, const char *c0, const char *c1 = 0, const char *c2 = 0, const char *c3 = 0, const char *c4 = 0, const char *c5 = 0, const char *c6 = 0, const char *c7 = 0) :
QTreeWidgetItem(parent) {
setText( 0, c0);
setText( 1, c1);
setText( 2, c2);
setText( 3, c3);
setText( 0, QString::fromLatin1(c0));
setText( 1, QString::fromLatin1(c1));
setText( 2, QString::fromLatin1(c2));
setText( 3, QString::fromLatin1(c3));
if (c4==0)
return;
setText( 4, c4);
setText( 4, QString::fromLatin1(c4));
if (c5==0)
return;
setText( 5, c5);
setText( 5, QString::fromLatin1(c5));
if (c6==0)
return;
setText( 6, c6);
setText( 6, QString::fromLatin1(c6));
if (c7==0)
return;
setText( 7, c7);
setText( 7, QString::fromLatin1(c7));
}
};
......
......@@ -30,7 +30,7 @@
#include "ksmbstatus.h"
#define Before(ttf,in) in.left(in.indexOf(ttf))
#define After(ttf,in) (in.contains(ttf)?QString(in.mid(in.indexOf(ttf)+QString(ttf).length())):QString(""))
#define After(ttf,in) (in.contains(ttf)?QString(in.mid(in.indexOf(ttf)+QString(ttf).length())):QLatin1String(""))
NetMon::NetMon(QWidget * parent, KConfig *config) :
QWidget(parent), configFile(config), showmountProc(nullptr), strShare(""), strUser(""), strGroup(""), strMachine(""), strSince(""), strPid(""), iUser(0), iGroup(0), iMachine(0), iPid(0) {
......@@ -61,8 +61,8 @@ void NetMon::processNFSLine(char *bufline, int) {
if (line.contains(":/")) {
QTreeWidgetItem *item = new QTreeWidgetItem(list);
item->setText(0, QStringLiteral("NFS"));
item->setText(0, After(":",line));
item->setText(0, Before(":/",line));
item->setText(0, After(QLatin1String(":"),QString::fromUtf8(line)));
item->setText(0, Before(QLatin1String(":/"),QString::fromUtf8(line)));
}
}
......@@ -70,7 +70,7 @@ void NetMon::processSambaLine(char *bufline, int) {
QByteArray line(bufline);
rownumber++;
if (rownumber == 2)
version->setText(bufline); // second line = samba version
version->setText(QString::fromUtf8(bufline)); // second line = samba version
if ((readingpart==header) && line.contains("Service")) {
iUser=line.indexOf("uid");
iGroup=line.indexOf("gid");
......@@ -88,11 +88,11 @@ void NetMon::processSambaLine(char *bufline, int) {
strMachine=line;
QTreeWidgetItem * item = new QTreeWidgetItem(list);
item->setText(0, QStringLiteral("SMB"));
item->setText(1, strShare);
item->setText(2, strMachine);
item->setText(3, strUser);
item->setText(4, strGroup);
item->setText(5, strPid/*,strSince*/);
item->setText(1, QString::fromUtf8(strShare));
item->setText(2, QString::fromUtf8(strMachine));
item->setText(3, QString::fromUtf8(strUser));
item->setText(4, QString::fromUtf8(strGroup));
item->setText(5, QString::fromUtf8(strPid)/*,strSince*/);
} else if (readingpart==connexions)
readingpart=locked_files;
else if ((readingpart==locked_files) && (line.indexOf("No ")==0))
......@@ -156,13 +156,13 @@ void NetMon::update() {
list->clear();
/* Re-read the Contents ... */
QString path(::getenv("PATH"));
QString path(QString::fromUtf8(::getenv("PATH")));
path += QLatin1String("/bin:/sbin:/usr/bin:/usr/sbin");
rownumber=0;
readingpart=header;
nrpid=0;
process->setEnvironment(QStringList() << ("PATH=" + path));
process->setEnvironment(QStringList() << (QStringLiteral("PATH=") + path));
connect(process, &QProcess::readyRead, this, &NetMon::readFromProcess);
process->start(QStringLiteral("smbstatus"));
if (!process->waitForFinished()) {
......@@ -183,13 +183,13 @@ void NetMon::update() {
}
delete process;
process=0;
process=nullptr;
readingpart=nfs;
delete showmountProc;
showmountProc=new QProcess();
connect(showmountProc, &QProcess::readyRead, this, &NetMon::readFromProcess);
showmountProc->setEnvironment(QStringList() << ("PATH=" + path));
showmountProc->setEnvironment(QStringList() << (QStringLiteral("PATH=") + path));
//without this timer showmount hangs up to 5 minutes
//if the portmapper daemon isn't running
QTimer::singleShot(5000,this,&NetMon::killShowmount);
......@@ -205,6 +205,6 @@ void NetMon::update() {
void NetMon::killShowmount() {
////qDebug()<<"killShowmount()";
showmountProc->deleteLater();
showmountProc=0;
showmountProc=nullptr;
}
......@@ -59,7 +59,7 @@ static QString catFile(const QString &fname) {
{
ssize_t count;
while ((count = ::read(fd, buffer, 256)) > 0)
result.append(QString(buffer).leftRef(count));
result.append(QString::fromLatin1(buffer).leftRef(count));
::close(fd);
}
......@@ -69,27 +69,27 @@ static QString catFile(const QString &fname) {
void USBDevice::parseSysDir(int bus, int parent, int level, const QString& dname) {
_level = level;
_parent = parent;
_manufacturer = catFile(dname + "/manufacturer");
_product = catFile(dname + "/product");
_manufacturer = catFile(dname + QStringLiteral("/manufacturer"));
_product = catFile(dname + QStringLiteral("/product"));
_bus = bus;
_device = catFile(dname + "/devnum").toUInt();
_device = catFile(dname + QStringLiteral("/devnum")).toUInt();
if (_device == 1)
_product += QStringLiteral(" (%1)").arg(_bus);
_vendorID = catFile(dname + "/idVendor").toUInt(0, 16);
_prodID = catFile(dname + "/idProduct").toUInt(0, 16);
_vendorID = catFile(dname + QStringLiteral("/idVendor")).toUInt(nullptr, 16);
_prodID = catFile(dname + QStringLiteral("/idProduct")).toUInt(nullptr, 16);
_class = catFile(dname + "/bDeviceClass").toUInt(0, 16);
_sub = catFile(dname + "/bDeviceSubClass").toUInt(0, 16);
_maxPacketSize = catFile(dname + "/bMaxPacketSize0").toUInt();
_class = catFile(dname + QStringLiteral("/bDeviceClass")).toUInt(nullptr, 16);
_sub = catFile(dname + QStringLiteral("/bDeviceSubClass")).toUInt(nullptr, 16);
_maxPacketSize = catFile(dname + QStringLiteral("/bMaxPacketSize0")).toUInt();
_speed = catFile(dname + "/speed").toDouble();
_serial = catFile(dname + "/serial");
_channels = catFile(dname + "/maxchild").toUInt();
_speed = catFile(dname + QStringLiteral("/speed")).toDouble();
_serial = catFile(dname + QStringLiteral("/serial"));
_channels = catFile(dname + QStringLiteral("/maxchild")).toUInt();
double version = catFile(dname + "/version").toDouble();
double version = catFile(dname + QStringLiteral("/version")).toDouble();
_verMajor = int(version);
_verMinor = int(10*(version - floor(version)));
......@@ -99,11 +99,11 @@ void USBDevice::parseSysDir(int bus, int parent, int level, const QString& dname
const QStringList list = dir.entryList();
for (QStringList::const_iterator it = list.constBegin(); it != list.constEnd(); ++it) {
if ((*it).contains(':'))
if ((*it).contains(QLatin1Char(':')))
continue;
USBDevice* dev = new USBDevice();
dev->parseSysDir(bus, ++level, _device, dname + '/' + *it);
dev->parseSysDir(bus, ++level, _device, dname + QLatin1Char('/') + *it);
}
}
......@@ -125,7 +125,7 @@ void USBDevice::parseLine(const QString& line) {
} else if (line.startsWith(QLatin1String("D:"))) {
char buffer[11];
sscanf(line.toLocal8Bit().data(), "D: Ver=%x.%x Cls=%x(%10s) Sub=%x Prot=%x MxPS=%u #Cfgs=%u", &_verMajor, &_verMinor, &_class, buffer, &_sub, &_prot, &_maxPacketSize, &_configs);
_className = buffer;
_className = QString::fromLatin1(buffer);
} else if (line.startsWith(QLatin1String("P:")))
sscanf(line.toLocal8Bit().data(), "P: Vendor=%x ProdID=%x Rev=%x.%x", &_vendorID, &_prodID, &_revMajor, &_revMinor);
}
......@@ -151,29 +151,29 @@ QString USBDevice::product() {
QString USBDevice::dump() {
QString r;
r = "<qml><h2><center>" + product() + "</center></h2><br/><hl/>";
r = QStringLiteral("<qml><h2><center>") + product() + QStringLiteral("</center></h2><br/><hl/>");
if (!_manufacturer.isEmpty())
r += i18n("<b>Manufacturer:</b> ") + _manufacturer + "<br/>";
r += i18n("<b>Manufacturer:</b> ") + _manufacturer + QStringLiteral("<br/>");
if (!_serial.isEmpty())
r += i18n("<b>Serial #:</b> ") + _serial + "<br/>";
r += i18n("<b>Serial #:</b> ") + _serial + QStringLiteral("<br/>");
r += QLatin1String("<br/><table>");
QString c = QStringLiteral("<td>%1</td>").arg(_class);
QString cname = _db->cls(_class);
if (!cname.isEmpty())
c += "<td>(" + i18n(cname.toLatin1()) +")</td>";
c += QStringLiteral("<td>(") + i18n(cname.toLatin1()) +QStringLiteral(")</td>");
r += i18n("<tr><td><i>Class</i></td>%1</tr>", c);
QString sc = QStringLiteral("<td>%1</td>").arg(_sub);
QString scname = _db->subclass(_class, _sub);
if (!scname.isEmpty())
sc += "<td>(" + i18n(scname.toLatin1()) +")</td>";
sc += QStringLiteral("<td>(") + i18n(scname.toLatin1()) +QStringLiteral(")</td>");
r += i18n("<tr><td><i>Subclass</i></td>%1</tr>", sc);
QString pr = QStringLiteral("<td>%1</td>").arg(_prot);
QString prname = _db->protocol(_class, _sub, _prot);
if (!prname.isEmpty())
pr += "<td>(" + prname +")</td>";
pr += QStringLiteral("<td>(") + prname +QStringLiteral(")</td>");
r += i18n("<tr><td><i>Protocol</i></td>%1</tr>", pr);
#if !(defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD))
r += ki18n("<tr><td><i>USB Version</i></td><td>%1.%2</td></tr>")
......@@ -185,12 +185,12 @@ QString USBDevice::dump() {
QString v = QString::number(_vendorID, 16);
QString name = _db->vendor(_vendorID);
if (!name.isEmpty())
v += "<td>(" + name +")</td>";
v += QStringLiteral("<td>(") + name +QStringLiteral(")</td>");
r += i18n("<tr><td><i>Vendor ID</i></td><td>0x%1</td></tr>", v);
QString p = QString::number(_prodID, 16);
QString pname = _db->device(_vendorID, _prodID);
if (!pname.isEmpty())
p += "<td>(" + pname +")</td>";
p += QStringLiteral("<td>(") + pname +QStringLiteral(")</td>");
r += i18n("<tr><td><i>Product ID</i></td><td>0x%1</td></tr>", p);
r += ki18n("<tr><td><i>Revision</i></td><td>%1.%2</td></tr>")
.subs(_revMajor,0,16).subs(_revMinor,2,16,QChar::fromLatin1('0'))
......@@ -209,7 +209,7 @@ QString USBDevice::dump() {
QStringList::const_iterator it = _devnodes.constBegin();
++it;
for (; it != _devnodes.constEnd(); ++it )
r += "<tr><td></td><td>" + *it + "</td></tr>";
r += QStringLiteral("<tr><td></td><td>") + *it + QStringLiteral("</td></tr>");
}
#else
r += i18n("<tr><td><i>Max. Packet Size</i></td><td>%1</td></tr>", _maxPacketSize);
......@@ -247,16 +247,16 @@ bool USBDevice::parse(const QString &fname) {
{
ssize_t count;
while ((count = ::read(fd, buffer, 256)) > 0)
result.append(QString(buffer).leftRef(count));
result.append(QString::fromLatin1(buffer).leftRef(count));
::close(fd);
}
// read in the device infos
USBDevice *device = 0;
USBDevice *device = nullptr;
int start=0, end;
result.remove(QRegExp(QStringLiteral("^\n")));
while ((end = result.indexOf('\n', start)) > 0)
while ((end = result.indexOf(QLatin1Char('\n'), start)) > 0)
{
QString line = result.mid(start, end-start);
......@@ -284,7 +284,7 @@ bool USBDevice::parseSys(const QString &dname) {
if (bus_reg.indexIn(*it) != -1)
bus = bus_reg.cap(1).toInt();
device->parseSysDir(bus, 0, 0, d.absolutePath() + '/' + *it);
device->parseSysDir(bus, 0, 0, d.absolutePath() + QLatin1Char('/') + *it);
}
return d.count();
......
......@@ -215,7 +215,7 @@ void View1394::rescanBus() {
//minimal config rom
if (((firstQuad>>24) & 0xff)==1) {
QString guidStr=QString::number(firstQuad, 16);
guidStr="0x"+guidStr.rightJustified(6, '0');
guidStr="0x"+guidStr.rightJustified(6, QLatin1Char('0'));
QStringList romList;
romList << nodeStr << guidStr;
......@@ -227,13 +227,13 @@ void View1394::rescanBus() {
char buf[32];
snprintf(buf, 32, "%lX", guid);
guidStr=buf;
guidStr="0x"+guidStr.rightJustified(16, '0');
QString local=((j | 0xffc0) == localNodeId) ? "X" : "";
QString irmStr=(cap & 0x80000000) ? "X" : "";
QString cmStr=(cap & 0x40000000) ? "X" : "";
QString isStr=(cap & 0x20000000) ? "X" : "";
QString bmStr=(cap & 0x10000000) ? "X" : "";
QString pmStr=(cap & 0x08000000) ? "X" : "";
guidStr="0x"+guidStr.rightJustified(16, QLatin1Char('0'));
QString local=((j | 0xffc0) == localNodeId) ? QStringLiteral("X") : QString();
QString irmStr=(cap & 0x80000000) ? QStringLiteral("X") : QString();
QString cmStr=(cap & 0x40000000) ? QStringLiteral("X") : QString();
QString isStr=(cap & 0x20000000) ? QStringLiteral("X") : QString();
QString bmStr=(cap & 0x10000000) ? QStringLiteral("X") : QString();