diff --git a/CMakeLists.txt.user b/CMakeLists.txt.user index 71151d7..f2fb82e 100644 --- a/CMakeLists.txt.user +++ b/CMakeLists.txt.user @@ -1,10 +1,10 @@ - + EnvironmentId - {45a71af6-65bb-4af1-a2df-6ab519c8565c} + {055df76c-eb5f-479b-9e45-f478a706e6f9} ProjectExplorer.Project.ActiveTarget @@ -77,15 +77,12 @@ true true Builtin.DefaultTidyAndClazy - 2 + 0 true - - true - @@ -94,7 +91,7 @@ Desktop Desktop Desktop - {0d1d96e7-0317-4f7a-a513-68284676b112} + {f0d093c2-ceeb-4303-9c63-b1e5c487b907} 0 0 0 @@ -107,7 +104,7 @@ -DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX} -DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C} -DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx} - /home/SMB.BASEALT.RU/kozyrevid/work/new_alterator/build + /home/yura/work/new_alterator/build @@ -153,7 +150,7 @@ -DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX} -DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C} -DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx} - /home/SMB.BASEALT.RU/kozyrevid/work/build-new_alterator-Desktop-Release + /home/yura/work/build-new_alterator-Desktop-Release @@ -197,7 +194,7 @@ -DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX} -DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C} -DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx} - /home/SMB.BASEALT.RU/kozyrevid/work/build-new_alterator-Desktop-RelWithDebInfo + /home/yura/work/build-new_alterator-Desktop-RelWithDebInfo @@ -241,7 +238,7 @@ -DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX} -DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C} -DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx} - /home/SMB.BASEALT.RU/kozyrevid/work/build-new_alterator-Desktop-MinSizeRel + /home/yura/work/build-new_alterator-Desktop-MinSizeRel @@ -297,15 +294,12 @@ 2 - new_alterator - CMakeProjectManager.CMakeRunConfiguration.new_alterator - new_alterator + ProjectExplorer.CustomExecutableRunConfiguration + false true - true false true - /home/SMB.BASEALT.RU/kozyrevid/work/new_alterator/build 1 diff --git a/resources/DistInfo.qml b/resources/DistInfo.qml index 8fb0962..0d0605b 100644 --- a/resources/DistInfo.qml +++ b/resources/DistInfo.qml @@ -5,68 +5,83 @@ import QtQuick.Controls 2.15 import ru.basealt.DistInfoBack 1.0 import shared 1.0 -ColumnLayout{ - DistInfoBack{id: back} - TextWithHeader{ - id: editionArea + ScrollView { + id: view - headerS: "ALT edition" - keys: ["Kernel version", "OS version", ifDiffK()] - vals: [back.getKernel(), back.getInstalledOS(), ifDiffV()] - n: 3 - comp: Component{ - Image { - sourceSize.width: 100 - sourceSize.height: 100 - source: "../resources/wiki_logo.svg" + anchors.fill: parent + ColumnLayout{ + id: content + + DistInfoBack{id: back} + + TextWithHeader{ + id: editionArea + + Layout.preferredWidth: currentPage.width + headerS: "ALT edition" + keys: ["Kernel version", "OS version", ifDiffK()] + vals: [back.getKernel(), back.getInstalledOS(), ifDiffV()] + n: 3 + comp: Component{ + Image { + sourceSize.width: 100 + sourceSize.height: 100 + source: "../resources/wiki_logo.svg" + } + } + + + function ifDiffK(){ + return back.getInstalledOS() === back.getOS() ? "" : "Updated to" + } + function ifDiffV(){ + return back.getInstalledOS() === back.getOS() ? "" : back.getOS() + } } - } + TextWithHeader { + id: systemArea + + Layout.minimumWidth: currentPage.width + headerS: "System" + keys: ["Chassis", "Vendor", "Device name", "Processor", "RAM", "GPU"] + vals: [back.getChassis(), back.getVendor(), back.getDevice(), back.getProcessor(), back.getRAM(), getSysType()] + n: 6 + comp: Component{ + Button{ + text: "More information" + } + } + + function getRAM(){return "cba"} + function getSysType(){return "qwerty"} + } + + TextWithHeader{ + id: hostnameArea + + Layout.minimumWidth: currentPage.width + headerS: "Computer name, domain..." + keys: ["Hostname", "Realm", "Domain role", "Workgroup"] + vals: [back.getHostname(), back.getRealm(), back.getRole(), back.getWorkgroup()] + n: 4 + comp: Component{ + Button{ + text: "Domain settings" + } + } + + function getProcessor(){return "abc"} + function getRAM(){return "cba"} + function getSysType(){return "qwerty"} + } + + Item {Layout.fillHeight: true} + + TextArea{ + text: "Project's cite: .\t Report bugs here: " + } - function ifDiffK(){ - return back.getInstalledOS() === back.getOS() ? "" : "Updated to" - } - function ifDiffV(){ - return back.getInstalledOS() === back.getOS() ? "" : back.getOS() } } - - TextWithHeader { - id: systemArea - - Layout.fillWidth: true - headerS: "System" - keys: ["Chassis", "Vendor", "Device name", "Processor", "RAM", "GPU"] - vals: [back.getChassis(), back.getVendor(), back.getDevice(), back.getProcessor(), back.getRAM(), getSysType()] - n: 6 - comp: Component{ - Button{ - text: "More information" - } - } - - function getRAM(){return "cba"} - function getSysType(){return "qwerty"} - } - - TextWithHeader{ - id: hostnameArea - - headerS: "Computer name, domain..." - keys: ["Hostname", "Realm", "Domain role", "Workgroup"] - vals: [back.getHostname(), back.getRealm(), back.getRole(), back.getWorkgroup()] - n: 4 - comp: Component{ - Button{ - text: "Domain settings" - } - } - - function getProcessor(){return "abc"} - function getRAM(){return "cba"} - function getSysType(){return "qwerty"} - } - - Item {Layout.fillHeight: true} -} diff --git a/shared/TextWithHeader.qml b/shared/TextWithHeader.qml index 6ba2b81..2e5aab5 100644 --- a/shared/TextWithHeader.qml +++ b/shared/TextWithHeader.qml @@ -6,6 +6,8 @@ import Qt.labs.qmlmodels 1.0 import QtQml 2.15 Rectangle{ + id: rect + property var keys property var vals property string headerS @@ -28,7 +30,7 @@ Rectangle{ TextArea{ id: header - text: qsTr(headerS) + text: qsTr(headerS) + content.width font.pointSize: 12 } @@ -61,6 +63,9 @@ Rectangle{ id: val text: vals[index] + } + + Item{ Layout.fillWidth: true } } diff --git a/src/dist_info.cpp b/src/dist_info.cpp index 220ded1..bc97d97 100644 --- a/src/dist_info.cpp +++ b/src/dist_info.cpp @@ -51,9 +51,16 @@ QString AlteratorDistInfo::getProcessor(){ return ""; if (!clp.waitForFinished()) return ""; - QByteArray result = clp.readAll(); - QString res = result; - return res.mid(res.indexOf("model name") + 12, res.indexOf("stepping") - res.indexOf("model name") - 13); + QString result = clp.readAll(); + QStringRef res = &result; + res = res.right(res.size() - res.indexOf("model name")); + res = res.left(res.indexOf("\n")); + res = res.right(res.size() - res.indexOf(": ") - 2); + QStringRef cores = &result; + cores = cores.right(cores.size() - cores.indexOf("cpu cores")); + cores = cores.left(cores.indexOf("\n")); + cores = cores.right(cores.size() - cores.indexOf(": ") - 2); + return res.toString() + " " + QChar(0x00D7) + " " + QString::number(cores.toInt()); } QString AlteratorDistInfo::getRAM(){ @@ -63,21 +70,17 @@ QString AlteratorDistInfo::getRAM(){ return ""; if (!clp.waitForFinished()) return ""; - QByteArray result = clp.readAll(); - QString res = result; - return res.mid(res.indexOf("MemTotal") + 16, res.indexOf("MemFree") - res.indexOf("MemTotal") - 17); + QString result = clp.readAll(); + QStringRef res = &result; + res = res.right(res.size() - res.indexOf("MemTotal")); + res = res.left(res.indexOf("\n")); + res = res.left(res.lastIndexOf(" ")); + res = res.right(res.size() - res.lastIndexOf(" ")); + return QString::number(res.toDouble() / 1024 / 1024, 'f', 3) + " Gb"; } QString AlteratorDistInfo::getHostname(){ - QProcess clp; - clp.start("cat", QStringList() << "/proc/meminfo"); - if (!clp.waitForStarted()) - return ""; - if (!clp.waitForFinished()) - return ""; - QByteArray result = clp.readAll(); - QString res = result; - return res.mid(res.indexOf("MemTotal") + 16, res.indexOf("MemFree") - res.indexOf("MemTotal") - 17); + return DBusInterface->property("Hostname").toString(); } QString AlteratorDistInfo::getRealm(){