File indexing completed on 2025-02-02 05:18:14

0001 /*
0002     SPDX-FileCopyrightText: 2012-2020 Harald Sitter <sitter@kde.org>
0003     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 */
0005 
0006 #include "KernelEntry.h"
0007 
0008 #include <sys/utsname.h>
0009 
0010 KernelEntry::KernelEntry()
0011     : Entry(ki18n("Kernel Version:"), QString())
0012 {
0013 }
0014 
0015 QString KernelEntry::localizedValue(Language language) const
0016 {
0017     struct utsname utsName;
0018     if (uname(&utsName) != 0) {
0019         return QString();
0020     }
0021     const int bits = QT_POINTER_SIZE == 8 ? 64 : 32;
0022     return localize(
0023         ki18nc("@label %1 is the kernel version, %2 CPU bit width (e.g. 32 or 64)", "%1 (%2-bit)").subs(utsName.release).subs(QString::number(bits)),
0024         language);
0025 }