diff --git a/Modules/about-distro/src/Module.h b/Modules/about-distro/src/Module.h --- a/Modules/about-distro/src/Module.h +++ b/Modules/about-distro/src/Module.h @@ -70,7 +70,7 @@ */ void copyToClipboard(); - QVector > labelsForClipboard; + QVector> labelsForClipboard; /** * UI diff --git a/Modules/about-distro/src/Module.cpp b/Modules/about-distro/src/Module.cpp --- a/Modules/about-distro/src/Module.cpp +++ b/Modules/about-distro/src/Module.cpp @@ -157,11 +157,10 @@ // as a product brand is different from Kubuntu. 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)); + const QString nameVersionText = QStringLiteral("%1 %2").arg(distroName, versionId); + ui->nameVersionLabel->setText(nameVersionText); - const auto dummyDistroDescriptionLabel = new QLabel(i18nc("@title:row", "Operating System:"), this); - dummyDistroDescriptionLabel->hide(); - labelsForClipboard << qMakePair(dummyDistroDescriptionLabel, ui->nameVersionLabel); + labelsForClipboard << qMakePair(QStringLiteral("Operating System:"), nameVersionText); // Don't translate const QString variant = cg.readEntry("Variant", QString()); if (variant.isEmpty()) { @@ -185,16 +184,16 @@ ui->plasmaLabel->hide(); } else { ui->plasmaLabel->setText(plasma); - labelsForClipboard << qMakePair(ui->plasma, ui->plasmaLabel); + labelsForClipboard << qMakePair(QStringLiteral("KDE Plasma version:"), plasma); // Don't translate } const QString frameworksVersion = KCoreAddons::versionString(); ui->frameworksLabel->setText(frameworksVersion); - labelsForClipboard << qMakePair(ui->frameworksLabelKey, ui->frameworksLabel); + labelsForClipboard << qMakePair(QStringLiteral("KDE Frameworks version:"), frameworksVersion); // Don't translate const QString qversion = QString::fromLatin1(qVersion()); ui->qtLabel->setText(qversion); - labelsForClipboard << qMakePair(ui->qt, ui->qtLabel); + labelsForClipboard << qMakePair(QStringLiteral("Qt version:"), qversion); // Don't translate } void Module::loadHardware() @@ -205,14 +204,14 @@ ui->kernelLabel->hide(); } else { ui->kernelLabel->setText(QString::fromLatin1(utsName.release)); - labelsForClipboard << qMakePair(ui->kernel, ui->kernelLabel); + labelsForClipboard << qMakePair(QStringLiteral("Kernel version:"), QString::fromLatin1(utsName.release)); // Don't translate } const int bits = QT_POINTER_SIZE == 8 ? 64 : 32; const QString bitsStr = QString::number(bits); ui->bitsLabel->setText(i18nc("@label %1 is the CPU bit width (e.g. 32 or 64)", "%1-bit", bitsStr)); - labelsForClipboard << qMakePair(ui->bitsKey, ui->bitsLabel); + labelsForClipboard << qMakePair(QStringLiteral("Operating System type:"), QStringLiteral("%1-bit").arg(bitsStr)); // Don't translate const QList list = Solid::Device::listFromType(Solid::DeviceInterface::Processor); ui->processor->setText(i18np("Processor:", "Processors:", list.count())); @@ -246,29 +245,26 @@ ui->processor->setHidden(true); ui->processorLabel->setHidden(true); } else { - labelsForClipboard << qMakePair(ui->processor, ui->processorLabel); + labelsForClipboard << qMakePair(QStringLiteral("Processor:"), processorLabel); // Don't translate } const qlonglong totalRam = calculateTotalRam(); + const QString memoryText = KFormat().formatByteSize(totalRam); const QString memoryLabel = totalRam > 0 ? i18nc("@label %1 is the formatted amount of system memory (e.g. 7,7 GiB)", - "%1 of RAM", KFormat().formatByteSize(totalRam)) + "%1 of RAM", memoryText) : i18nc("Unknown amount of RAM", "Unknown"); ui->memoryLabel->setText(memoryLabel); - labelsForClipboard << qMakePair(ui->memory, ui->memoryLabel); + labelsForClipboard << qMakePair(QStringLiteral("Memory:"), totalRam > 0 ? QStringLiteral("%1 of RAM").arg(memoryText) + : QStringLiteral("Unknown")); // Don't translate } void Module::copyToClipboard() { QString text; // note that this loop does not necessarily represent the same order as in the GUI for (auto labelPair : qAsConst(labelsForClipboard)) { - const auto valueLabel = labelPair.second; - if (!valueLabel->isHidden()) { - const auto descriptionLabelText = labelPair.first->text(); - const auto valueLabelText = valueLabel->text(); - text += i18nc("%1 is a label already including a colon, %2 is the corresponding value", "%1 %2", descriptionLabelText, valueLabelText) + QStringLiteral("\n"); - } + text += labelPair.first + QStringLiteral(" ") + labelPair.second + QStringLiteral("\n"); } QGuiApplication::clipboard()->setText(text);