| 1 | // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/src/core/systeminfoui.cpp`/ |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #include "systeminfoui.h"cxx . . $ `<file>/src/core/systeminfoui.h`/ |
| 5 | |
| 6 | #include "app/app.h"cxx . . $ `<file>/src/app/app.h`/ |
| 7 | #include "isysmodel.h"cxx . . $ `<file>/src/core/isysmodel.h`/ |
| 8 | #include "qmlcomponentregistry.h"cxx . . $ `<file>/src/core/qmlcomponentregistry.h`/ |
| 9 | #include <QApplication> |
| 10 | #include <QClipboard> |
| 11 | #include <QQmlApplicationEngine> |
| 12 | #include <QtGlobal> |
| 13 | #include <QtQml> |
| 14 | #include <algorithm> |
| 15 | #include <iterator> |
| 16 | |
| 17 | char const *const SystemInfoUIcxx . . $ SystemInfoUI#::trStringscxx . . $ SystemInfoUI#trStrings.[] = { |
| 18 | // XXX add info keys here |
| 19 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "kernelv"), |
| 20 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "mesav"), |
| 21 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "vkapiv"), |
| 22 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "glcorev"), |
| 23 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "glcompv"), |
| 24 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "vendorid"), |
| 25 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "deviceid"), |
| 26 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "svendorid"), |
| 27 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "sdeviceid"), |
| 28 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "vendor"), |
| 29 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "device"), |
| 30 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "sdevice"), |
| 31 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "pcislot"), |
| 32 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "driver"), |
| 33 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "revision"), |
| 34 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "memory"), |
| 35 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "gputype"), |
| 36 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "biosv"), |
| 37 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "cpufamily"), |
| 38 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "model"), |
| 39 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "modname"), |
| 40 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "stepping"), |
| 41 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "ucodev"), |
| 42 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "l3cache"), |
| 43 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "exeunits"), |
| 44 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "cores"), |
| 45 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "flags"), |
| 46 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "bugs"), |
| 47 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "bogomips"), |
| 48 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "arch"), |
| 49 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "opmode"), |
| 50 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "byteorder"), |
| 51 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "virt"), |
| 52 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "l1dcache"), |
| 53 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "l1icache"), |
| 54 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "l2cache"), |
| 55 | QT_TRANSLATE_NOOPcxx . . $ `<external>/7871922715575640492/qttranslation.h:21:9`!("SystemInfoUI", "uniqueid"), |
| 56 | }; |
| 57 | |
| 58 | SystemInfoUIcxx . . $ SystemInfoUI#::SystemInfoUIcxx . . $ SystemInfoUI#SystemInfoUI(cc6a52b634b3d446).(QObjectcxx . . $ QObject# *parent) noexcept |
| 59 | : QObjectcxx . . $ QObject#QObject(749de1b6ae65bddd).(parent) |
| 60 | { |
| 61 | } |
| 62 | |
| 63 | void SystemInfoUIcxx . . $ SystemInfoUI#::initcxx . . $ SystemInfoUI#init(5a19f1e4d7dc19f8).(ISysModelcxx . . $ ISysModel# const *sysModel) |
| 64 | { |
| 65 | sysModel_cxx . . $ SystemInfoUI#sysModel_. = sysModel; |
| 66 | initInfocxx . . $ SystemInfoUI#initInfo(49f6e7a06ebc5aa8).(); |
| 67 | |
| 68 | for (auto const &sysModelInfo : info_cxx . . $ SystemInfoUI#info_.) { |
| 69 | |
| 70 | QVariantListcxx . . $ QVariantList# listcxx . . $ QList#QList(ced63f7c635d850d).; |
| 71 | for (auto const &sysComponentInfo : sysModelInfo.secondcxx . . $ std/pair#second.) { |
| 72 | list.appendcxx . . $ QList#append(1262c8661f7a27a7).(sysComponentInfocxx . . $ QVariant#QVariant(132dd6869045752b)..firstcxx . . $ std/pair#first.); |
| 73 | list.appendcxx . . $ QList#append(1262c8661f7a27a7).(sysComponentInfocxx . . $ QVariant#QVariant(132dd6869045752b)..secondcxx . . $ std/pair#second.); |
| 74 | } |
| 75 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! addSystemInfocxx . . $ SystemInfoUI#addSystemInfo(823b766d3b6f27e2).(sysModelInfo.firstcxx . . $ std/pair#first., list); |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | void SystemInfoUIcxx . . $ SystemInfoUI#::copyToClipboardcxx . . $ SystemInfoUI#copyToClipboard(83f5f38750778ac8).() const |
| 80 | { |
| 81 | auto clipboard = QApplicationcxx . . $ QApplication#::clipboardcxx . . $ QGuiApplication#clipboard(a5a00f8d44f5ac9e).(); |
| 82 | if (clipboard != nullptr) { |
| 83 | QStringcxx . . $ QString# textcxx . . $ QString#QString(85c52e162fed56f9).(Appcxx . . $ App#::Namecxx . . $ App#Name..datacxx . . $ std/basic_string_view#data(8e614c7de0b1573e).()); |
| 84 | text +=cxx . . $ QString#`operator+=`(d02845eef0c33901). " v"; |
| 85 | text +=cxx . . $ QString#`operator+=`(d02845eef0c33901). Appcxx . . $ App#::VersionStrcxx . . $ App#VersionStr..datacxx . . $ std/basic_string_view#data(8e614c7de0b1573e).(); |
| 86 | text +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "\n"; |
| 87 | |
| 88 | for (auto const &sysModelInfo : info_cxx . . $ SystemInfoUI#info_.) { |
| 89 | |
| 90 | auto sectionTitle = sysModelInfocxx . . $ QString#QString(132dd6869045752b)..firstcxx . . $ std/pair#first.; |
| 91 | sectionTitle.replacecxx . . $ QString#replace(192e628656427d1c).("\n"cxx . . $ QString#QString(85c52e162fed56f9)., " "cxx . . $ QString#QString(85c52e162fed56f9).); |
| 92 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "\n==== " +cxx . . $ operator+(629bb3c2d02a6966). sectionTitle +cxx . . $ operator+(5cf93062b24146ad). " ====\n"; |
| 93 | |
| 94 | for (auto const &sysComponentInfo : sysModelInfo.secondcxx . . $ std/pair#second.) |
| 95 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). sysComponentInfo.firstcxx . . $ std/pair#first. +cxx . . $ operator+(fe108924f6aa4707). ": " +cxx . . $ operator+(3e7d64bea38764c4). sysComponentInfo.secondcxx . . $ std/pair#second. +cxx . . $ operator+(5cf93062b24146ad). "\n"; |
| 96 | } |
| 97 | |
| 98 | clipboard->setTextcxx . . $ QClipboard#setText(9f492b8a441aa8de).(text); |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | void SystemInfoUIcxx . . $ SystemInfoUI#::initInfocxx . . $ SystemInfoUI#initInfo(49f6e7a06ebc5aa8).() |
| 103 | { |
| 104 | auto rawInfo = sysModel_cxx . . $ SystemInfoUI#sysModel_.->infocxx . . $ ISysModel#info(909f45ca661bc315).(); |
| 105 | |
| 106 | for (auto const &sysModelInfo : rawInfo) { |
| 107 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<QStringcxx . . $ QString#, QStringcxx . . $ QString#>> processedModelInfocxx . . $ std/vector#vector(49f6e7a06ebc5aa8).; |
| 108 | |
| 109 | // translate keys |
| 110 | stdcxx . . $ std/::transformcxx . . $ std/transform(da30451c4a040264).(sysModelInfo.secondcxx . . $ std/pair#second..cbegincxx . . $ std/vector#cbegin(d1e1699016b9d7e6).(), sysModelInfo.secondcxx . . $ std/pair#second..cendcxx . . $ std/vector#cend(d1e1699016b9d7e6).(), |
| 111 | stdcxx . . $ std/::back_insertercxx . . $ std/back_inserter(7b559d6bdd90ff74).(processedModelInfo), [](auto const &pair) { |
| 112 | return stdcxx . . $ std/::pair(trcxx . . $ SystemInfoUI#tr(75d9f1c324b4579d).(pair.first.c_str()), |
| 113 | QStringcxx . . $ QString#::fromStdStringcxx . . $ QString#fromStdString(24a2e9bdf24626eb).(pair.second)); |
| 114 | }); |
| 115 | |
| 116 | // sort information elements using the translated keys |
| 117 | stdcxx . . $ std/::sortcxx . . $ std/sort(4d3091562df4e52e).(processedModelInfo.begincxx . . $ std/vector#begin(55a6de06420d4903).(), processedModelInfo.endcxx . . $ std/vector#end(55a6de06420d4903).(), |
| 118 | [](auto const &left, auto const &right) { |
| 119 | return left.first < right.first; |
| 120 | }); |
| 121 | |
| 122 | info_cxx . . $ SystemInfoUI#info_..emplace_backcxx . . $ std/vector#emplace_back(a1bcdfdabc3a37df).(QStringcxx . . $ QString#::fromStdStringcxx . . $ QString#fromStdString(24a2e9bdf24626eb).(sysModelInfo.firstcxx . . $ std/pair#first.), |
| 123 | stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(processedModelInfo)); |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | bool const SystemInfoUIcxx . . $ SystemInfoUI#::registered_cxx . . $ SystemInfoUI#registered_. = |
| 128 | QMLComponentRegistrycxx . . $ QMLComponentRegistry#::addQMLTypeRegisterercxx . . $ QMLComponentRegistry#addQMLTypeRegisterer(9f2ee88c4f5f1585).([cxx . . $ std/function#function(bdc3712e480e4d04).]() { |
| 129 | qmlRegisterTypecxx . . $ qmlRegisterType(f18a5d83a8a5ac9a).<SystemInfoUIcxx . . $ SystemInfoUI#>("CoreCtrl.UIComponents", 1, 0, |
| 130 | SystemInfoUIcxx . . $ SystemInfoUI#::QMLComponentIDcxx . . $ SystemInfoUI#QMLComponentID..datacxx . . $ std/basic_string_view#data(8e614c7de0b1573e).()); |
| 131 | }); |