Commit 6fb92ebd authored by Laurent Montel's avatar Laurent Montel 😁

Const'ify, initialize variable, minor optimization

parent 8fcaf236
......@@ -136,7 +136,7 @@ void Module::loadSoftware()
KConfig::NoGlobals);
KConfigGroup cg = KConfigGroup(config, "General");
QString logoPath = cg.readEntry("LogoPath", QString());
const QString logoPath = cg.readEntry("LogoPath", QString());
QPixmap logo;
if (logoPath.isEmpty()) {
logo = QIcon::fromTheme(QStringLiteral("start-here-kde")).pixmap(128, 128);
......@@ -149,18 +149,18 @@ void Module::loadSoftware()
// We allow overriding of the OS name for branding purposes.
// For example OS Ubuntu may be rebranded as Kubuntu. Also Kubuntu Active
// as a product brand is different from Kubuntu.
QString distroName = cg.readEntry("Name", os.name);
QString versionId = cg.readEntry("Version", os.versionId);
const QString distroName = cg.readEntry("Name", os.name);
const QString versionId = cg.readEntry("Version", os.versionId);
ui->nameVersionLabel->setText(QStringLiteral("%1 %2").arg(distroName, versionId));
QString variant = cg.readEntry("Variant", QString());
const QString variant = cg.readEntry("Variant", QString());
if (variant.isEmpty()) {
ui->variantLabel->hide();
} else {
ui->variantLabel->setText(variant);
}
QString url = cg.readEntry("Website", os.homeUrl);
const QString url = cg.readEntry("Website", os.homeUrl);
if (url.isEmpty()) {
ui->urlLabel->hide();
} else {
......@@ -169,7 +169,7 @@ void Module::loadSoftware()
// Since Plasma version detection isn't based on a library query it can fail
// in weird cases; instead of admiting defeat we simply hide everything :P
QString plasma = plasmaVersion();
const QString plasma = plasmaVersion();
if (plasma.isEmpty()) {
ui->plasma->hide();
ui->plasmaLabel->hide();
......
......@@ -66,7 +66,7 @@ private:
/**
* UI
*/
Ui::Module *ui;
Ui::Module *ui = nullptr;
/** \returns Version of plasmashell or an empty string when none was found */
QString plasmaVersion() const;
......
......@@ -331,7 +331,7 @@ static bool GetInfo_XServer_Generic(QTreeWidget *lBox) {
/* Helper-function to read output from an external program */
static int GetInfo_ReadfromPipe(QTreeWidget* tree, const char *FileName, bool WithEmptyLines = true) {
QProcess proc;
QTreeWidgetItem* olditem= NULL;
QTreeWidgetItem* olditem= nullptr;
QString s;
proc.start(FileName, QIODevice::ReadOnly);
......
......@@ -73,7 +73,7 @@ public:
}
++treeWidget;
}
return NULL;
return nullptr;
}
private:
......@@ -83,9 +83,12 @@ private:
void createMenuActions();
QMap<Solid::DeviceInterface::Type, SolDevice *> deviceMap;
InfoPanel *iPanel;
QAction *colAct, *expAct, *allAct, *relAct;
DevInfoPlugin *status;
InfoPanel *iPanel = nullptr;
QAction *colAct = nullptr;
QAction *expAct = nullptr;
QAction *allAct = nullptr;
QAction *relAct = nullptr;
DevInfoPlugin *status = nullptr;
//NicSignals *nicSig;
public Q_SLOTS:
......
......@@ -41,7 +41,7 @@ class DevInfoPlugin : public KCModule
Q_OBJECT
public:
DevInfoPlugin(QWidget *parent, const QVariantList &);
explicit DevInfoPlugin(QWidget *parent, const QVariantList &);
~DevInfoPlugin();
void updateStatus(const QString &uid);
......
......@@ -47,7 +47,7 @@ class InfoPanel : public QGroupBox
Q_OBJECT
public:
InfoPanel(QWidget *, DevInfoPlugin *);
explicit InfoPanel(QWidget *, DevInfoPlugin *);
~InfoPanel();
void setTopInfo(const QIcon &, Solid::Device *);
......
......@@ -67,7 +67,7 @@ public:
}
return dev;
} else {
return NULL;
return nullptr;
}
}
......
......@@ -63,7 +63,7 @@ public:
ChargingRole
};
StatisticsProvider(QObject *parent = Q_NULLPTR);
explicit StatisticsProvider(QObject *parent = nullptr);
void setDevice(const QString &device);
void setDuration(uint duration);
......
......@@ -60,7 +60,7 @@ static QTreeWidgetItem* createTitle(QTreeWidgetItem* parent, const QString& titl
static QTreeWidgetItem* addDeviceClass(QTreeWidgetItem *parent, QTreeWidgetItem *after, pciInfo *info) {
QString value;
QTreeWidgetItem *localAfter=NULL;
QTreeWidgetItem *localAfter=nullptr;
after=create(parent, i18n("Device Class"), getNameById(devClass, info->cooked.devClass)+value.sprintf(" (0x%02X)", info->cooked.devClass));
after=create(parent, i18n("Device Subclass"), getNameBy2Id(devSubclass, info->cooked.devClass, info->cooked.devSubClass)+value.sprintf(" (0x%02X)", info->cooked.devSubClass));
after=create(parent, i18n("Device Programming Interface"), getNameBy3Id(devInterface, info->cooked.devClass, info->cooked.devSubClass, info->cooked.devProgIface.devProgIface)+value.sprintf(" (0x%02X)", info->cooked.devProgIface.devProgIface));
......@@ -91,14 +91,14 @@ static QTreeWidgetItem* addVendor(QTreeWidgetItem *parent, QTreeWidgetItem *afte
}//else
//WARNING all pci_lookup_name calls should have 4 extra args for compatibility with older pcilib !
if (pci_lookup_name(PCIAccess, nameBuffer, NAME_BUFFER_SIZE, PCI_LOOKUP_VENDOR, info->cooked.vendor, 0, 0, 0)!=NULL) {
if (pci_lookup_name(PCIAccess, nameBuffer, NAME_BUFFER_SIZE, PCI_LOOKUP_VENDOR, info->cooked.vendor, 0, 0, 0)!=nullptr) {
// line.setAscii(nameBuffer); //not work, workaround below
line = QString::fromLatin1(pci_lookup_name(PCIAccess, nameBuffer, NAME_BUFFER_SIZE, PCI_LOOKUP_VENDOR, info->cooked.vendor, 0, 0, 0));
if (line.contains(QStringLiteral("Unknown"))==0) {
isVendor=true;
topname=line;
after=create(parent, i18n("Vendor"), line+value.sprintf(" (0x%04X)", info->cooked.vendor));
if (pci_lookup_name(PCIAccess, nameBuffer, NAME_BUFFER_SIZE, PCI_LOOKUP_DEVICE, info->cooked.vendor, info->cooked.device, 0, 0)!=NULL) {
if (pci_lookup_name(PCIAccess, nameBuffer, NAME_BUFFER_SIZE, PCI_LOOKUP_DEVICE, info->cooked.vendor, info->cooked.device, 0, 0)!=nullptr) {
// line.setAscii(nameBuffer); //not work, workaround below
line = QString::fromLatin1(pci_lookup_name(PCIAccess, nameBuffer, NAME_BUFFER_SIZE, PCI_LOOKUP_DEVICE, info->cooked.vendor, info->cooked.device, 0, 0));
if (line.contains(QStringLiteral("Unknown"))==0) {
......@@ -108,7 +108,7 @@ static QTreeWidgetItem* addVendor(QTreeWidgetItem *parent, QTreeWidgetItem *afte
if (info->cooked.headerType.headerType_bits.headerType==PCI_HEADER_TYPE_BRIDGE) {
isSub=true;
}//if
else if (pci_lookup_name(PCIAccess, nameBuffer, NAME_BUFFER_SIZE, PCI_LOOKUP_DEVICE|PCI_LOOKUP_SUBSYSTEM, info->cooked.vendor, info->cooked.device, subvendor, subdevice)!=NULL) {
else if (pci_lookup_name(PCIAccess, nameBuffer, NAME_BUFFER_SIZE, PCI_LOOKUP_DEVICE|PCI_LOOKUP_SUBSYSTEM, info->cooked.vendor, info->cooked.device, subvendor, subdevice)!=nullptr) {
// line.setAscii(nameBuffer); //not work, workaround below
line = QString::fromLatin1(pci_lookup_name(PCIAccess, nameBuffer, NAME_BUFFER_SIZE, PCI_LOOKUP_DEVICE|PCI_LOOKUP_SUBSYSTEM, info->cooked.vendor, info->cooked.device, subvendor, subdevice));
if (line.contains(QStringLiteral("Unknown"))==0) {
......@@ -128,7 +128,7 @@ static QTreeWidgetItem* addVendor(QTreeWidgetItem *parent, QTreeWidgetItem *afte
topname=i18nc(strCtxt, strUnknown);
}//if
if ((!isSub)&&(info->cooked.headerType.headerType_bits.headerType!=PCI_HEADER_TYPE_BRIDGE)) { //if entire subsytem was not found, search at least for subvendor
if (pci_lookup_name(PCIAccess, nameBuffer, NAME_BUFFER_SIZE, PCI_LOOKUP_VENDOR, subvendor, 0, 0, 0)!=NULL) {
if (pci_lookup_name(PCIAccess, nameBuffer, NAME_BUFFER_SIZE, PCI_LOOKUP_VENDOR, subvendor, 0, 0, 0)!=nullptr) {
// line.setAscii(nameBuffer); //not work, workaround below
line = QString::fromLatin1(pci_lookup_name(PCIAccess, nameBuffer, NAME_BUFFER_SIZE, PCI_LOOKUP_VENDOR, subvendor, 0, 0, 0));
if (line.contains(QStringLiteral("Unknown"))==0) {
......@@ -147,7 +147,7 @@ static QTreeWidgetItem* addVendor(QTreeWidgetItem *parent, QTreeWidgetItem *afte
}//addVendor
static QTreeWidgetItem* addInterrupt(QTreeWidgetItem *parent, QTreeWidgetItem *after, int irq, int pin) {
QTreeWidgetItem *localAfter=NULL;
QTreeWidgetItem *localAfter=nullptr;
QString value;
if ((irq!=0)||(pin!=0)) {
after=createTitle(parent, i18n("Interrupt"));
......@@ -158,7 +158,7 @@ static QTreeWidgetItem* addInterrupt(QTreeWidgetItem *parent, QTreeWidgetItem *a
}//addInterrupt
static QTreeWidgetItem* addControl(QTreeWidgetItem *parent, QTreeWidgetItem *after, pciInfo *info) {
QTreeWidgetItem *localAfter=NULL;
QTreeWidgetItem *localAfter=nullptr;
QString value;
after=create(parent, i18n("Control"), value.sprintf("0x%04X", info->cooked.command.command));
localAfter=create(after, i18n("Response in I/O space"), (info->cooked.command.command_bits.comIo ? i18nc(strCtxt, strEnabled) : i18nc(strCtxt, strDisabled)));
......@@ -176,7 +176,7 @@ static QTreeWidgetItem* addControl(QTreeWidgetItem *parent, QTreeWidgetItem *aft
}//addControl
static QTreeWidgetItem* addStatus(QTreeWidgetItem *parent, QTreeWidgetItem *after, pciInfo *info) {
QTreeWidgetItem *localAfter=NULL;
QTreeWidgetItem *localAfter=nullptr;
QString value;
after=create(parent, i18n("Status"), value.sprintf("0x%04X", info->cooked.status.status));
localAfter=create(after, i18n("Interrupt status"), (info->cooked.status.status_bits.statCapList ? i18nc(strCtxt, strEnabled) : i18nc(strCtxt, strDisabled)));
......@@ -195,7 +195,7 @@ static QTreeWidgetItem* addStatus(QTreeWidgetItem *parent, QTreeWidgetItem *afte
}//addStatus
static QTreeWidgetItem* addLatency(QTreeWidgetItem *parent, QTreeWidgetItem *after, pciInfo *info) {
QTreeWidgetItem *localAfter=NULL;
QTreeWidgetItem *localAfter=nullptr;
QString value;
after=create(parent, i18n("Latency"), value.sprintf("%u", info->cooked.latencyTimer));
if (info->cooked.headerType.headerType_bits.headerType==PCI_HEADER_TYPE_NORMAL) {
......@@ -216,7 +216,7 @@ static QTreeWidgetItem* addLatency(QTreeWidgetItem *parent, QTreeWidgetItem *aft
}//addLatency
static QTreeWidgetItem* addHeaderType(QTreeWidgetItem *parent, QTreeWidgetItem *after, pciInfo *info) {
QTreeWidgetItem *localAfter=NULL;
QTreeWidgetItem *localAfter=nullptr;
QString value;
after=create(parent, i18n("Header"),value.sprintf("0x%02X",info->cooked.headerType.headerTypeFull));
localAfter=create(after, i18n("Type"),getNameById(headerType,info->cooked.headerType.headerType_bits.headerType)+value.sprintf(" (0x%02X)",info->cooked.headerType.headerType_bits.headerType));
......@@ -225,7 +225,7 @@ static QTreeWidgetItem* addHeaderType(QTreeWidgetItem *parent, QTreeWidgetItem *
}//addHeaderType
static QTreeWidgetItem* addBist(QTreeWidgetItem *parent, QTreeWidgetItem *after, pciInfo *info) {
QTreeWidgetItem *localAfter=NULL;
QTreeWidgetItem *localAfter=nullptr;
QString value;
after=create(parent, i18n("Build-in self test"), value.sprintf("0x%02X", info->cooked.bist.bist));
localAfter=create(after, i18n("BIST Capable"), (info->cooked.bist.bist_bits.bistCapable ? i18nc(strCtxt, strYes) : i18nc(strCtxt, strNo)));
......@@ -250,13 +250,13 @@ static QTreeWidgetItem* addSize(QTreeWidgetItem *parent, QTreeWidgetItem *after,
#ifdef HAVE_PCIADDR_T64
else if (size<0x10000000000LL) {
after=create(parent, i18n("Size"),QString("%1 GiB").arg(static_cast<unsigned long>(size/0x40000000)));
after=create(parent, i18n("Size"),QStringLiteral("%1 GiB").arg(static_cast<unsigned long>(size/0x40000000)));
}//elif
else if (size<0x4000000000000LL) {
after=create(parent, i18n("Size"),QString("%1 PiB").arg(static_cast<unsigned long>(size/0x10000000000LL)));
after=create(parent, i18n("Size"),QStringLiteral("%1 PiB").arg(static_cast<unsigned long>(size/0x10000000000LL)));
}//elif
else if (size<0x1000000000000000LL) {
after=create(parent, i18n("Size"),QString("%1 EiB").arg(static_cast<unsigned long>(size/0x4000000000000LL)));
after=create(parent, i18n("Size"),QStringLiteral("%1 EiB").arg(static_cast<unsigned long>(size/0x4000000000000LL)));
}//elif
#else //HAVE_PCIADDR_T64
......@@ -269,8 +269,8 @@ static QTreeWidgetItem* addSize(QTreeWidgetItem *parent, QTreeWidgetItem *after,
}//addSize
static QTreeWidgetItem* addMapping(QTreeWidgetItem *parent, QTreeWidgetItem *after, pciInfo *info, pci_dev* PCIDevice) {
QTreeWidgetItem *localAfter=NULL;
QTreeWidgetItem *topLocalAfter=NULL;
QTreeWidgetItem *localAfter=nullptr;
QTreeWidgetItem *topLocalAfter=nullptr;
QString value;
bool is64b=false;
after=createTitle(parent, i18n("Address mappings"));
......@@ -320,7 +320,7 @@ static QTreeWidgetItem* addMapping(QTreeWidgetItem *parent, QTreeWidgetItem *aft
}//addMapping
static QTreeWidgetItem* addBus(QTreeWidgetItem *parent, QTreeWidgetItem *after, pciInfo *info) {
QTreeWidgetItem *localAfter=NULL;
QTreeWidgetItem *localAfter=nullptr;
QString value;
if (info->cooked.headerType.headerType_bits.headerType==PCI_HEADER_TYPE_BRIDGE) {
after=createTitle(parent, i18n("Bus"));
......@@ -340,7 +340,7 @@ static QTreeWidgetItem* addBus(QTreeWidgetItem *parent, QTreeWidgetItem *after,
}//addBus
static QTreeWidgetItem* addSecStatus(QTreeWidgetItem *parent, QTreeWidgetItem *after, pciInfo *info) {
QTreeWidgetItem *localAfter=NULL;
QTreeWidgetItem *localAfter=nullptr;
QString value;
if (info->cooked.headerType.headerType_bits.headerType==PCI_HEADER_TYPE_BRIDGE) {
after=create(parent, i18n("Secondary status"), value.sprintf("0x%04X", info->cooked.header.header1.secStatus.secStatus));
......@@ -376,7 +376,7 @@ static QTreeWidgetItem* addSecStatus(QTreeWidgetItem *parent, QTreeWidgetItem *a
}//addSecStatus
static QTreeWidgetItem* addBridgeBehind(QTreeWidgetItem *parent, QTreeWidgetItem *after, pciInfo *info) {
QTreeWidgetItem *localAfter=NULL;
QTreeWidgetItem *localAfter=nullptr;
QString value;
if (info->cooked.headerType.headerType_bits.headerType==PCI_HEADER_TYPE_BRIDGE) {
after=createTitle(parent, i18n("I/O behind bridge"));
......@@ -407,7 +407,7 @@ static QTreeWidgetItem* addBridgeBehind(QTreeWidgetItem *parent, QTreeWidgetItem
}//addBridgeBechind
static QTreeWidgetItem* addBridgeControl(QTreeWidgetItem *parent, QTreeWidgetItem *after, pciInfo *info) {
QTreeWidgetItem *localAfter=NULL;
QTreeWidgetItem *localAfter=nullptr;
QString value;
if (info->cooked.headerType.headerType_bits.headerType==PCI_HEADER_TYPE_BRIDGE) {
after=create(parent, i18n("Bridge control"),value.sprintf("0x%04X",info->cooked.header.header1.bridgeControl.bridgeControl));
......@@ -427,7 +427,7 @@ static QTreeWidgetItem* addBridgeControl(QTreeWidgetItem *parent, QTreeWidgetIte
}//addBridgeControl
static QTreeWidgetItem* addRom(QTreeWidgetItem *parent, QTreeWidgetItem *after, pciInfo *info, pci_dev* PCIDevice) {
QTreeWidgetItem *localAfter=NULL;
QTreeWidgetItem *localAfter=nullptr;
QString value;
if ((info->cooked.headerType.headerType_bits.headerType==PCI_HEADER_TYPE_NORMAL)||(info->cooked.headerType.headerType_bits.headerType==PCI_HEADER_TYPE_BRIDGE)) {
after=createTitle(parent, i18n("Expansion ROM"));
......@@ -445,8 +445,8 @@ static QTreeWidgetItem* addRom(QTreeWidgetItem *parent, QTreeWidgetItem *after,
}//addRom
static QTreeWidgetItem* addCardbusResource(QTreeWidgetItem *parent, QTreeWidgetItem *after, pciInfo *info) {
QTreeWidgetItem *localAfter=NULL;
QTreeWidgetItem *topLocalAfter=NULL;
QTreeWidgetItem *localAfter=nullptr;
QTreeWidgetItem *topLocalAfter=nullptr;
QString value;
int pref=0;
if (info->cooked.headerType.headerType_bits.headerType==PCI_HEADER_TYPE_CARDBUS) {
......@@ -477,7 +477,7 @@ static QTreeWidgetItem* addCardbusResource(QTreeWidgetItem *parent, QTreeWidgetI
}//addCardbusResource
static QTreeWidgetItem* addCardbusControl(QTreeWidgetItem *parent, QTreeWidgetItem *after, pciInfo *info) {
QTreeWidgetItem *localAfter=NULL;
QTreeWidgetItem *localAfter=nullptr;
QString value;
if (info->cooked.headerType.headerType_bits.headerType==PCI_HEADER_TYPE_CARDBUS) {
after=create(parent, i18n("CardBus control"),value.sprintf("0x%04X",info->cooked.header.header2.cbControl.cbControl));
......@@ -495,7 +495,7 @@ static QTreeWidgetItem* addCardbusControl(QTreeWidgetItem *parent, QTreeWidgetIt
}//addCardbusControl
static QTreeWidgetItem* addRaw(QTreeWidgetItem *parent, QTreeWidgetItem *after, pciInfo *info) {
QTreeWidgetItem *localAfter=NULL;
QTreeWidgetItem *localAfter=nullptr;
QString value, temp;
after=createTitle(parent, i18n("Raw PCI config space"));
for (int i=0; i<(getuid()==0 ? 16 : 4); i++) {
......@@ -513,8 +513,8 @@ static QTreeWidgetItem* addRaw(QTreeWidgetItem *parent, QTreeWidgetItem *after,
}//addRaw
static QTreeWidgetItem* addCapsPm(QTreeWidgetItem *parent, QTreeWidgetItem *after, pciInfo *info, int offset) {
QTreeWidgetItem *localAfter=NULL;
QTreeWidgetItem *subLocalAfter=NULL;
QTreeWidgetItem *localAfter=nullptr;
QTreeWidgetItem *subLocalAfter=nullptr;
QString value;
pmInfo infoPm;
if ((offset+2+sizeof(pmInfo))<256) {
......@@ -532,7 +532,7 @@ static QTreeWidgetItem* addCapsPm(QTreeWidgetItem *parent, QTreeWidgetItem *afte
subLocalAfter=create(localAfter, i18n("D2"),(infoPm.cooked.caps.caps_bits.capsPmeD2?i18nc(strCtxt, strEnabled):i18nc(strCtxt, strDisabled)));
subLocalAfter=create(localAfter, i18n("D3 hot"),(infoPm.cooked.caps.caps_bits.capsPmeD3hot?i18nc(strCtxt, strEnabled):i18nc(strCtxt, strDisabled)));
subLocalAfter=create(localAfter, i18n("D3 cold"),(infoPm.cooked.caps.caps_bits.capsPmeD3cold?i18nc(strCtxt, strEnabled):i18nc(strCtxt, strDisabled)));
localAfter=NULL;
localAfter=nullptr;
after=create(parent, i18n("Status"),value.sprintf("0x%04X",infoPm.cooked.status.status));
localAfter=create(after, i18n("Power state"),getNameById(powerState,infoPm.cooked.status.status_bits.statPower));
localAfter=create(after, i18n("Power management"),(infoPm.cooked.status.status_bits.statPme?i18nc(strCtxt, strEnabled):i18nc(strCtxt, strDisabled)));
......@@ -540,7 +540,7 @@ static QTreeWidgetItem* addCapsPm(QTreeWidgetItem *parent, QTreeWidgetItem *afte
localAfter=create(after, i18n("Data scale"),QString::number(infoPm.cooked.status.status_bits.statDataScale));
localAfter=create(after, i18n("Power management status"),(infoPm.cooked.status.status_bits.statPmeStat?i18nc(strCtxt, strEnabled):i18nc(strCtxt, strDisabled)));
if ((info->cooked.devClass==0x06)&&(info->cooked.devSubClass==0x04)) { //PCI bridge
subLocalAfter=NULL;
subLocalAfter=nullptr;
localAfter=create(after, i18n("Bridge status"),value.sprintf("0x%02X",infoPm.cooked.statusBridge.statusBridge));
subLocalAfter=create(localAfter, i18n("Secondary bus state in D3 hot"),(infoPm.cooked.statusBridge.statusBridge_bits.statBridgeBx?i18n("B2"):i18n("B3")));
subLocalAfter=create(localAfter, i18n("Secondary bus power & clock control"),(infoPm.cooked.statusBridge.statusBridge_bits.statBridgeClock?i18nc(strCtxt, strEnabled):i18nc(strCtxt, strDisabled)));
......@@ -551,7 +551,7 @@ static QTreeWidgetItem* addCapsPm(QTreeWidgetItem *parent, QTreeWidgetItem *afte
}//addCapsPm
static QTreeWidgetItem* addCapsAgp(QTreeWidgetItem *parent, QTreeWidgetItem *after, pciInfo *info, int offset) {
QTreeWidgetItem *localAfter=NULL;
QTreeWidgetItem *localAfter=nullptr;
QString value;
agpInfo infoAgp;
int i, cycleSize;
......@@ -579,7 +579,7 @@ static QTreeWidgetItem* addCapsAgp(QTreeWidgetItem *parent, QTreeWidgetItem *aft
localAfter=create(after, i18n("Isochronous transactions"),(infoAgp.cooked.status.status_bits1.statusIsochSupp?i18nc(strCtxt, strEnabled):i18nc(strCtxt, strDisabled)));
}//if
localAfter=create(after, i18n("Maximum number of AGP command"),value.sprintf("%i (0x%02X)",infoAgp.cooked.status.status_bits1.statusReq+1,infoAgp.cooked.status.status_bits1.statusReq));
localAfter=NULL;
localAfter=nullptr;
after=create(parent, i18n("Configuration"),value.sprintf("0x%08X",infoAgp.cooked.config.config));
localAfter=create(after, i18n("Rate"),getNameById(agpRate,infoAgp.cooked.config.config_bits0.configEnhRate));
localAfter=create(after, i18n("Fast Writes"),(infoAgp.cooked.config.config_bits1.configFastWrite?i18nc(strCtxt, strEnabled):i18nc(strCtxt, strDisabled)));
......@@ -614,7 +614,7 @@ static QTreeWidgetItem* addCapsVpd(QTreeWidgetItem *parent, QTreeWidgetItem *aft
}//addCapsVpd
static QTreeWidgetItem* addCapsMsi(QTreeWidgetItem *parent, QTreeWidgetItem *after, pciInfo *info, int offset) {
QTreeWidgetItem *localAfter=NULL;
QTreeWidgetItem *localAfter=nullptr;
QString value;
msiInfo infoMsi;
int size=10;
......@@ -675,8 +675,8 @@ static QTreeWidgetItem* addCapsVendor(QTreeWidgetItem *parent, QTreeWidgetItem *
}//addCapsVendor
static QTreeWidgetItem* addCaps(QTreeWidgetItem *parent, QTreeWidgetItem *after, pciInfo *info) {
QTreeWidgetItem *localAfter=NULL;
QTreeWidgetItem *topLocalAfter=NULL;
QTreeWidgetItem *localAfter=nullptr;
QTreeWidgetItem *topLocalAfter=nullptr;
QString value;
unsigned char offset;
if ((info->cooked.headerType.headerType_bits.headerType==PCI_HEADER_TYPE_NORMAL)||(info->cooked.headerType.headerType_bits.headerType==PCI_HEADER_TYPE_BRIDGE)) {
......@@ -725,19 +725,19 @@ bool GetInfo_PCIUtils(QTreeWidget* tree) {
tree->setHeaderLabels(headers);
tree->setRootIsDecorated(true);
pci_access *PCIAccess=NULL;
pci_dev *PCIDevice=NULL;
pci_access *PCIAccess=nullptr;
pci_dev *PCIDevice=nullptr;
//init libpci
PCIAccess=pci_alloc();
if (PCIAccess==NULL) {
if (PCIAccess==nullptr) {
return false;
}//if
pci_init(PCIAccess);
pci_scan_bus(PCIAccess);
QTreeWidgetItem *DeviceName=NULL, *after=NULL;
QTreeWidgetItem *DeviceName=nullptr, *after=nullptr;
QString value;
pciInfo info;
......@@ -757,7 +757,7 @@ bool GetInfo_PCIUtils(QTreeWidget* tree) {
//create device tree
DeviceName=new QTreeWidgetItem(tree, deviceList);
//adding class, subclass and programming interface info
after=addDeviceClass(DeviceName, NULL, &info);
after=addDeviceClass(DeviceName, nullptr, &info);
//adding revision
after=create(DeviceName, i18n("Revision"), value.sprintf("0x%02X", info.cooked.revision));
......
......@@ -57,7 +57,7 @@ void ImportsView::updateList() {
char buf[250];
QByteArray s(""), strSource, strMount, strType;
FILE *f=popen("mount", "r");
if (f==0)
if (f==nullptr)
return;
do {
e=fgets(buf, 250, f);
......
......@@ -211,10 +211,10 @@ void StatisticsView::calculate() {
{
QTreeWidgetItem *item = dataList->topLevelItem(i);
if (connCount) {
if ((QString(item->text(1)).contains(i18n("CONNECTION OPENED"))) && (QString(item->text(2)).contains(rService)) && (QString(item->text(3)).contains(rHost)))
if ((item->text(1).contains(i18n("CONNECTION OPENED"))) && (item->text(2).contains(rService)) && (item->text(3).contains(rHost)))
count++;
} else {
if ((QString(item->text(1)).contains(i18n("FILE OPENED"))) && (QString(item->text(2)).contains(rService)) && (QString(item->text(3)).contains(rHost)))
if ((item->text(1).contains(i18n("FILE OPENED"))) && (item->text(2).contains(rService)) && (item->text(3).contains(rHost)))
count++;
}
}
......@@ -273,7 +273,7 @@ LogItem* SambaLog::itemInList(const QString &name) {
}
}
return 0;
return nullptr;
}
void SambaLog::addItem(const QString &share, const QString &user) {
......@@ -284,7 +284,7 @@ void SambaLog::addItem(const QString &share, const QString &user) {
tmp->addItem(user);
} else {
items.append(new LogItem(share,user));
};
}
}
SmallLogItem* LogItem::itemInList(const QString &name) {
......
......@@ -45,7 +45,7 @@ class KcmContainer : public QScrollArea
*
* @param parent objects parent
*/
KcmContainer(QWidget *parent);
explicit KcmContainer(QWidget *parent);
/**
* Destory KCMContainer
......
......@@ -41,7 +41,7 @@ class KcmTreeItem
* @param module pointer to KCM module
* @param parent objects parent
*/
explicit KcmTreeItem(const KService::Ptr &module, KcmTreeItem *parent=0);
explicit KcmTreeItem(const KService::Ptr &module, KcmTreeItem *parent=nullptr);
/**
* KCM Tree Item for InfoKcmModel. Holds information about a KCM
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment