mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2025-01-13 01:58:27 +08:00
新增资源显示
This commit is contained in:
parent
997a39eb63
commit
79f1c7cae1
Binary file not shown.
@ -24,7 +24,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
a.installTranslator(trans);
|
a.installTranslator(trans);
|
||||||
// 判断是否为 !amd64
|
// 判断是否为 !amd64
|
||||||
if(GetRunCommand("arch").replace(" ", "").replace("\n", "") == QString("x86_64")){
|
if(GetRunCommand("arch").replace(" ", "").replace("\n", "") != QString("x86_64")){
|
||||||
QMessageBox::critical(NULL, "错误", "此程序不支持非 X86 架构,立即退出");
|
QMessageBox::critical(NULL, "错误", "此程序不支持非 X86 架构,立即退出");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
BIN
VM-source/main.o
BIN
VM-source/main.o
Binary file not shown.
@ -12,6 +12,7 @@
|
|||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
#include <infoutils.h>
|
#include <infoutils.h>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent) :
|
MainWindow::MainWindow(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
@ -27,6 +28,37 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
system("xdg-open https://www.virtualbox.org/wiki/Linux_Downloads");
|
system("xdg-open https://www.virtualbox.org/wiki/Linux_Downloads");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// QTimer
|
||||||
|
QTimer *cpuGet = new QTimer(this);
|
||||||
|
connect(cpuGet, &QTimer::timeout, this, &MainWindow::ShowCPUMessage);
|
||||||
|
cpuGet->setInterval(600);
|
||||||
|
cpuGet->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::ShowCPUMessage(){
|
||||||
|
// 获取 CPU 占用率
|
||||||
|
long cpuAll = 0;
|
||||||
|
long cpuFree = 0;
|
||||||
|
infoUtils::cpuRate(cpuAll, cpuFree);
|
||||||
|
long cpu = ((cpuAll - m_cpuAll) - (cpuFree - m_cpuFree)) * 100 / (cpuAll - m_cpuAll);
|
||||||
|
if(cpu > 100){
|
||||||
|
// 处理异常值
|
||||||
|
cpu = 100;
|
||||||
|
}
|
||||||
|
// 获取内存占用率
|
||||||
|
long memory = 0;
|
||||||
|
long memoryAll = 0;
|
||||||
|
long swap = 0;
|
||||||
|
long swapAll = 0;
|
||||||
|
|
||||||
|
infoUtils::memoryRate(memory, memoryAll, swap, swapAll);
|
||||||
|
|
||||||
|
QString info = "CPU: " + QString::number(cpu) + "% 内存: " +
|
||||||
|
QString::number(memory * 100 / memoryAll) + "% " + QString::number(memory / 1024) + "MB/" + QString::number(memoryAll / 1024) + "MB";
|
||||||
|
qDebug() << cpuAll << " " << cpuFree;
|
||||||
|
ui->CPUValue->showMessage(info, 5000);
|
||||||
|
m_cpuAll = cpuAll;
|
||||||
|
m_cpuFree = cpuFree;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MainWindow::GetRunCommand(QString command){
|
QString MainWindow::GetRunCommand(QString command){
|
||||||
|
@ -16,12 +16,16 @@ public:
|
|||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void ShowCPUMessage();
|
||||||
void on_browser_clicked();
|
void on_browser_clicked();
|
||||||
QString GetRunCommand(QString command);
|
QString GetRunCommand(QString command);
|
||||||
void on_install_clicked();
|
void on_install_clicked();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
|
long m_cpuAll;
|
||||||
|
long m_cpuFree;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
Binary file not shown.
@ -25,7 +25,7 @@
|
|||||||
<enum>QTabWidget::Rounded</enum>
|
<enum>QTabWidget::Rounded</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>2</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@ -306,6 +306,11 @@ p, li { white-space: pre-wrap; }
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QStatusBar" name="CPUValue">
|
||||||
|
<property name="statusTip">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
<action name="action">
|
<action name="action">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>退出</string>
|
<string>退出</string>
|
||||||
|
@ -22,8 +22,8 @@ QT_BEGIN_MOC_NAMESPACE
|
|||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_DEPRECATED
|
QT_WARNING_DISABLE_DEPRECATED
|
||||||
struct qt_meta_stringdata_MainWindow_t {
|
struct qt_meta_stringdata_MainWindow_t {
|
||||||
QByteArrayData data[6];
|
QByteArrayData data[7];
|
||||||
char stringdata0[72];
|
char stringdata0[87];
|
||||||
};
|
};
|
||||||
#define QT_MOC_LITERAL(idx, ofs, len) \
|
#define QT_MOC_LITERAL(idx, ofs, len) \
|
||||||
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
|
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
|
||||||
@ -33,15 +33,17 @@ struct qt_meta_stringdata_MainWindow_t {
|
|||||||
static const qt_meta_stringdata_MainWindow_t qt_meta_stringdata_MainWindow = {
|
static const qt_meta_stringdata_MainWindow_t qt_meta_stringdata_MainWindow = {
|
||||||
{
|
{
|
||||||
QT_MOC_LITERAL(0, 0, 10), // "MainWindow"
|
QT_MOC_LITERAL(0, 0, 10), // "MainWindow"
|
||||||
QT_MOC_LITERAL(1, 11, 18), // "on_browser_clicked"
|
QT_MOC_LITERAL(1, 11, 14), // "ShowCPUMessage"
|
||||||
QT_MOC_LITERAL(2, 30, 0), // ""
|
QT_MOC_LITERAL(2, 26, 0), // ""
|
||||||
QT_MOC_LITERAL(3, 31, 13), // "GetRunCommand"
|
QT_MOC_LITERAL(3, 27, 18), // "on_browser_clicked"
|
||||||
QT_MOC_LITERAL(4, 45, 7), // "command"
|
QT_MOC_LITERAL(4, 46, 13), // "GetRunCommand"
|
||||||
QT_MOC_LITERAL(5, 53, 18) // "on_install_clicked"
|
QT_MOC_LITERAL(5, 60, 7), // "command"
|
||||||
|
QT_MOC_LITERAL(6, 68, 18) // "on_install_clicked"
|
||||||
|
|
||||||
},
|
},
|
||||||
"MainWindow\0on_browser_clicked\0\0"
|
"MainWindow\0ShowCPUMessage\0\0"
|
||||||
"GetRunCommand\0command\0on_install_clicked"
|
"on_browser_clicked\0GetRunCommand\0"
|
||||||
|
"command\0on_install_clicked"
|
||||||
};
|
};
|
||||||
#undef QT_MOC_LITERAL
|
#undef QT_MOC_LITERAL
|
||||||
|
|
||||||
@ -51,7 +53,7 @@ static const uint qt_meta_data_MainWindow[] = {
|
|||||||
8, // revision
|
8, // revision
|
||||||
0, // classname
|
0, // classname
|
||||||
0, 0, // classinfo
|
0, 0, // classinfo
|
||||||
3, 14, // methods
|
4, 14, // methods
|
||||||
0, 0, // properties
|
0, 0, // properties
|
||||||
0, 0, // enums/sets
|
0, 0, // enums/sets
|
||||||
0, 0, // constructors
|
0, 0, // constructors
|
||||||
@ -59,13 +61,15 @@ static const uint qt_meta_data_MainWindow[] = {
|
|||||||
0, // signalCount
|
0, // signalCount
|
||||||
|
|
||||||
// slots: name, argc, parameters, tag, flags
|
// slots: name, argc, parameters, tag, flags
|
||||||
1, 0, 29, 2, 0x08 /* Private */,
|
1, 0, 34, 2, 0x08 /* Private */,
|
||||||
3, 1, 30, 2, 0x08 /* Private */,
|
3, 0, 35, 2, 0x08 /* Private */,
|
||||||
5, 0, 33, 2, 0x08 /* Private */,
|
4, 1, 36, 2, 0x08 /* Private */,
|
||||||
|
6, 0, 39, 2, 0x08 /* Private */,
|
||||||
|
|
||||||
// slots: parameters
|
// slots: parameters
|
||||||
QMetaType::Void,
|
QMetaType::Void,
|
||||||
QMetaType::QString, QMetaType::QString, 4,
|
QMetaType::Void,
|
||||||
|
QMetaType::QString, QMetaType::QString, 5,
|
||||||
QMetaType::Void,
|
QMetaType::Void,
|
||||||
|
|
||||||
0 // eod
|
0 // eod
|
||||||
@ -77,10 +81,11 @@ void MainWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id,
|
|||||||
auto *_t = static_cast<MainWindow *>(_o);
|
auto *_t = static_cast<MainWindow *>(_o);
|
||||||
(void)_t;
|
(void)_t;
|
||||||
switch (_id) {
|
switch (_id) {
|
||||||
case 0: _t->on_browser_clicked(); break;
|
case 0: _t->ShowCPUMessage(); break;
|
||||||
case 1: { QString _r = _t->GetRunCommand((*reinterpret_cast< QString(*)>(_a[1])));
|
case 1: _t->on_browser_clicked(); break;
|
||||||
|
case 2: { QString _r = _t->GetRunCommand((*reinterpret_cast< QString(*)>(_a[1])));
|
||||||
if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = std::move(_r); } break;
|
if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = std::move(_r); } break;
|
||||||
case 2: _t->on_install_clicked(); break;
|
case 3: _t->on_install_clicked(); break;
|
||||||
default: ;
|
default: ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -115,13 +120,13 @@ int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
|||||||
if (_id < 0)
|
if (_id < 0)
|
||||||
return _id;
|
return _id;
|
||||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||||
if (_id < 3)
|
if (_id < 4)
|
||||||
qt_static_metacall(this, _c, _id, _a);
|
qt_static_metacall(this, _c, _id, _a);
|
||||||
_id -= 3;
|
_id -= 4;
|
||||||
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
|
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
|
||||||
if (_id < 3)
|
if (_id < 4)
|
||||||
*reinterpret_cast<int*>(_a[0]) = -1;
|
*reinterpret_cast<int*>(_a[0]) = -1;
|
||||||
_id -= 3;
|
_id -= 4;
|
||||||
}
|
}
|
||||||
return _id;
|
return _id;
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@ -20,6 +20,7 @@
|
|||||||
#include <QtWidgets/QMainWindow>
|
#include <QtWidgets/QMainWindow>
|
||||||
#include <QtWidgets/QPushButton>
|
#include <QtWidgets/QPushButton>
|
||||||
#include <QtWidgets/QSpacerItem>
|
#include <QtWidgets/QSpacerItem>
|
||||||
|
#include <QtWidgets/QStatusBar>
|
||||||
#include <QtWidgets/QTabWidget>
|
#include <QtWidgets/QTabWidget>
|
||||||
#include <QtWidgets/QTextBrowser>
|
#include <QtWidgets/QTextBrowser>
|
||||||
#include <QtWidgets/QVBoxLayout>
|
#include <QtWidgets/QVBoxLayout>
|
||||||
@ -57,6 +58,7 @@ public:
|
|||||||
QLabel *label_3;
|
QLabel *label_3;
|
||||||
QSpacerItem *verticalSpacer_2;
|
QSpacerItem *verticalSpacer_2;
|
||||||
QTextBrowser *textBrowser_2;
|
QTextBrowser *textBrowser_2;
|
||||||
|
QStatusBar *CPUValue;
|
||||||
|
|
||||||
void setupUi(QMainWindow *MainWindow)
|
void setupUi(QMainWindow *MainWindow)
|
||||||
{
|
{
|
||||||
@ -209,10 +211,13 @@ public:
|
|||||||
horizontalLayout->addWidget(tabWidget);
|
horizontalLayout->addWidget(tabWidget);
|
||||||
|
|
||||||
MainWindow->setCentralWidget(centralWidget);
|
MainWindow->setCentralWidget(centralWidget);
|
||||||
|
CPUValue = new QStatusBar(MainWindow);
|
||||||
|
CPUValue->setObjectName(QString::fromUtf8("CPUValue"));
|
||||||
|
MainWindow->setStatusBar(CPUValue);
|
||||||
|
|
||||||
retranslateUi(MainWindow);
|
retranslateUi(MainWindow);
|
||||||
|
|
||||||
tabWidget->setCurrentIndex(2);
|
tabWidget->setCurrentIndex(1);
|
||||||
|
|
||||||
|
|
||||||
QMetaObject::connectSlotsByName(MainWindow);
|
QMetaObject::connectSlotsByName(MainWindow);
|
||||||
@ -353,6 +358,9 @@ public:
|
|||||||
"<p style=\" margin-top:0px; margin-bott"
|
"<p style=\" margin-top:0px; margin-bott"
|
||||||
"om:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:'Droid Sans Mono','monospace','monospace'; font-size:11pt; color:#6a9955;\">https://juejin.cn/post/7080484519328874510</span></p></body></html>", nullptr));
|
"om:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:'Droid Sans Mono','monospace','monospace'; font-size:11pt; color:#6a9955;\">https://juejin.cn/post/7080484519328874510</span></p></body></html>", nullptr));
|
||||||
tabWidget->setTabText(tabWidget->indexOf(tab_2), QCoreApplication::translate("MainWindow", "\345\205\263\344\272\216", nullptr));
|
tabWidget->setTabText(tabWidget->indexOf(tab_2), QCoreApplication::translate("MainWindow", "\345\205\263\344\272\216", nullptr));
|
||||||
|
#if QT_CONFIG(statustip)
|
||||||
|
CPUValue->setStatusTip(QString());
|
||||||
|
#endif // QT_CONFIG(statustip)
|
||||||
} // retranslateUi
|
} // retranslateUi
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user