102 lines
3.9 KiB
Diff
102 lines
3.9 KiB
Diff
From 35f849e92bc7e8fe10bd8836b8b3f84b3bf2321f Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?=E4=BE=AF=E7=BA=A2=E5=8B=8B?= <houhongxun@kylinos.cn>
|
|
Date: Mon, 6 May 2024 15:45:43 +0800
|
|
Subject: [PATCH] misc fixes: deprecated func, memory leaks, code error
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Signed-off-by: 侯红勋 <houhongxun@kylinos.cn>
|
|
---
|
|
UIControl/src/page1.cpp | 4 ++--
|
|
UIControl/src/page2.cpp | 2 +-
|
|
registeredQDbus/systemdbusregister.cpp | 8 ++++----
|
|
registeredQDbus/systemdbusregister.h | 2 +-
|
|
4 files changed, 8 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/UIControl/src/page1.cpp b/UIControl/src/page1.cpp
|
|
index 6b5d2ca..9736323 100644
|
|
--- a/UIControl/src/page1.cpp
|
|
+++ b/UIControl/src/page1.cpp
|
|
@@ -157,11 +157,11 @@ void Page1::getUdiskPathAndCap()
|
|
{
|
|
diskInfos.clear();
|
|
QProcess lsblk;
|
|
- lsblk.start("lsblk -J");
|
|
+ lsblk.start("lsblk", QStringList() << "-J");
|
|
lsblk.waitForFinished();
|
|
|
|
QProcess lsblk2;
|
|
- lsblk2.start("lsblk -JS");
|
|
+ lsblk2.start("lsblk", QStringList() << "-JS");
|
|
lsblk2.waitForFinished();
|
|
QJsonArray arr1 = QStringToJsonArray(QString::fromLocal8Bit(lsblk.readAllStandardOutput())); //获取json类型的shell执行结果
|
|
QJsonArray arr2 = QStringToJsonArray(QString::fromLocal8Bit(lsblk2.readAllStandardOutput()));
|
|
diff --git a/UIControl/src/page2.cpp b/UIControl/src/page2.cpp
|
|
index 8041012..78e2312 100644
|
|
--- a/UIControl/src/page2.cpp
|
|
+++ b/UIControl/src/page2.cpp
|
|
@@ -161,7 +161,7 @@ void Page2::dealMakeFinish(QString status)
|
|
bool Page2::mountDevice(QString target){
|
|
|
|
QProcess sync;
|
|
- sync.start("sync");
|
|
+ sync.start("sync", QStringList());
|
|
sync.waitForStarted();
|
|
sync.waitForFinished();
|
|
|
|
diff --git a/registeredQDbus/systemdbusregister.cpp b/registeredQDbus/systemdbusregister.cpp
|
|
index 63ecf27..99db98c 100644
|
|
--- a/registeredQDbus/systemdbusregister.cpp
|
|
+++ b/registeredQDbus/systemdbusregister.cpp
|
|
@@ -55,13 +55,13 @@ void SystemDbusRegister::MakeStart(QString sourcePath,QString targetPath){
|
|
uDiskPath = targetPath;
|
|
QFileInfo info(sourcePath);
|
|
sourceFileSize = info.size()/1000000;
|
|
- command_dd = new QProcess();
|
|
+ command_dd = new QProcess(this);
|
|
//指定输出语言
|
|
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
|
env.insert("LANGUAGE","en_US:en");
|
|
command_dd->setProcessEnvironment(env);
|
|
connect(command_dd,&QProcess::readyReadStandardError,this,&SystemDbusRegister::readBashStandardErrorInfo);
|
|
- command_dd->start("bash");
|
|
+ command_dd->start("bash", QStringList());
|
|
command_dd->waitForStarted();
|
|
QString ddshell = "dd if='"+sourcePath.toLocal8Bit()+"' of="+targetPath.toLocal8Bit()+" status=progress";
|
|
command_dd->write(ddshell.toLocal8Bit() + '\n');
|
|
@@ -93,7 +93,7 @@ bool SystemDbusRegister::unmountDevice(QString target)
|
|
void SystemDbusRegister::MakeExit(){
|
|
qDebug()<<"exit dd process";
|
|
if(!command_dd) return ;
|
|
- if(command_dd->Running){
|
|
+ if(QProcess::Running == command_dd->state()){
|
|
command_dd->kill();
|
|
}
|
|
return ;
|
|
@@ -144,7 +144,7 @@ void SystemDbusRegister::finishEvent(){
|
|
bool SystemDbusRegister::isMakingSucess()
|
|
{
|
|
QProcess lsblk;
|
|
- lsblk.start("lsblk -JS");
|
|
+ lsblk.start("lsblk", QStringList() << "-JS");
|
|
// lsblk.waitForStarted();
|
|
lsblk.waitForFinished();
|
|
// qDebug()<<"lsblk output"<<lsblk.readAllStandardError();
|
|
diff --git a/registeredQDbus/systemdbusregister.h b/registeredQDbus/systemdbusregister.h
|
|
index 136ed98..3b6bffe 100644
|
|
--- a/registeredQDbus/systemdbusregister.h
|
|
+++ b/registeredQDbus/systemdbusregister.h
|
|
@@ -41,7 +41,7 @@ class SystemDbusRegister : public QObject, protected QDBusContext
|
|
Q_CLASSINFO("D-Bus Interface", "com.kylinusbcreator.interface")
|
|
public:
|
|
SystemDbusRegister();
|
|
-// ~SystemDbusRegister();
|
|
+ //~SystemDbusRegister();
|
|
|
|
Q_SIGNALS:
|
|
void workingProgress(int);
|
|
--
|
|
2.43.0
|
|
|