From d66b4a1f6a2438aa7886c1e13ba1b8fad7394636 Mon Sep 17 00:00:00 2001 From: rongyouli Date: Wed, 13 Jul 2022 09:54:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug=20128089=20128065?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UIControl/UIControl.pro | 4 +- UIControl/src/line.cpp | 31 ++ UIControl/src/line.h | 21 ++ UIControl/src/main.cpp | 12 + UIControl/src/mainwindow.cpp | 14 +- UIControl/src/mainwindow.h | 2 + UIControl/src/page1.cpp | 111 +++--- UIControl/src/page1.h | 10 +- UIControl/src/page2.cpp | 26 +- .../translations/kylin-usb-creator_bo_CN.ts | 78 +++-- .../translations/kylin-usb-creator_zh_CN.ts | 2 + debian/changelog | 10 + debian/control | 11 + kylin-usb-creator.pro | 11 +- registeredQDbus/mythread.cpp | 6 + registeredQDbus/mythread.h | 11 + registeredQDbus/registeredQDbus.pro | 2 + registeredQDbus/systemdbusregister.cpp | 327 +++++++++++++++--- registeredQDbus/systemdbusregister.h | 4 +- 19 files changed, 552 insertions(+), 141 deletions(-) create mode 100644 UIControl/src/line.cpp create mode 100644 UIControl/src/line.h create mode 100644 registeredQDbus/mythread.cpp create mode 100644 registeredQDbus/mythread.h diff --git a/UIControl/UIControl.pro b/UIControl/UIControl.pro index d486d07..c9e1c32 100644 --- a/UIControl/UIControl.pro +++ b/UIControl/UIControl.pro @@ -24,6 +24,7 @@ SOURCES += \ src/include/menumodule.cpp \ src/include/theme.cpp \ src/include/utils.cpp \ + src/line.cpp \ src/main.cpp \ src/mainwindow.cpp \ src/page1.cpp \ @@ -45,6 +46,7 @@ HEADERS += \ src/include/menumodule.h \ src/include/theme.h \ src/include/utils.h \ + src/line.h \ src/mainwindow.h \ src/page1.h \ src/page2.h \ @@ -76,7 +78,7 @@ desktop.files = kylin-usb-creator.desktop INSTALLS += target desktop icons schemes CONFIG += link_pkgconfig -PKGCONFIG += gsettings-qt +PKGCONFIG += gsettings-qt kysdk-waylandhelper # translations #qm_files.files = src/translations/*.pm #qm_files.path = /usr/share/kylin diff --git a/UIControl/src/line.cpp b/UIControl/src/line.cpp new file mode 100644 index 0000000..05a276c --- /dev/null +++ b/UIControl/src/line.cpp @@ -0,0 +1,31 @@ +#include "line.h" +#include +line::line() +{ + this->setMouseTracking(true); + +} +void line::leaveEvent(QEvent *event) +{ +} +void line::mousePressEvent(QMouseEvent *event) +{ + if(event->button()==Qt::LeftButton){ + } + QLineEdit::mousePressEvent(event); +} +void line::mouseReleaseEvent(QMouseEvent *event) +{ + + QLineEdit::mouseReleaseEvent(event); + +} +void line::mouseDoubleClickEvent(QMouseEvent *event) +{ + +} +void line::mouseMoveEvent(QMouseEvent *e) +{ + QLineEdit::mouseMoveEvent(e); +} + diff --git a/UIControl/src/line.h b/UIControl/src/line.h new file mode 100644 index 0000000..648be7d --- /dev/null +++ b/UIControl/src/line.h @@ -0,0 +1,21 @@ +#ifndef LINE_H +#define LINE_H +#include +#include +#include +class line : public QLineEdit +{ + Q_OBJECT +public: + line(); + +protected: + void mousePressEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *e); + + void mouseDoubleClickEvent(QMouseEvent *event); + void leaveEvent(QEvent *event); +}; + +#endif // LINE_H diff --git a/UIControl/src/main.cpp b/UIControl/src/main.cpp index 37c5fd4..0b0d281 100644 --- a/UIControl/src/main.cpp +++ b/UIControl/src/main.cpp @@ -21,6 +21,7 @@ #include "include/qtsingleapplication.h" #include #include +#include #include #include #include @@ -29,6 +30,8 @@ #include #include "include/xatom-helper.h" #include "mainwindow.h" +#include "ukuistylehelper/ukuistylehelper.h" +#include "windowmanager/windowmanager.h" #if (QT_VERSION <= QT_VERSION_CHECK(5,15,0)) #include "dbusadaptor.h" #endif @@ -47,6 +50,8 @@ void activeMainwindow() } int main(int argc, char *argv[]) { + bool isWayland=false; + // init log module initUkuiLog4qt("usb-boot-maker"); QString parm = "--"; @@ -108,9 +113,16 @@ int main(int argc, char *argv[]) }else { MainWindow w(NULL,parm); w.handleIconClickedSub(); + w.show(); + + // center window + int sw=QGuiApplication::primaryScreen()->availableGeometry().width(); + int sh=QGuiApplication::primaryScreen()->availableGeometry().height(); + kdk::WindowManager::setGeometry(w.windowHandle(),QRect((sw-w.width())/2,(sh-w.height())/2,w.width(),w.height())); QObject::connect(&a,SIGNAL(messageReceived(const QString&)),&w,SLOT(handleIconClickedSub())); return a.exec(); + } return a.exec(); } diff --git a/UIControl/src/mainwindow.cpp b/UIControl/src/mainwindow.cpp index 9a3af0b..ae08f0c 100644 --- a/UIControl/src/mainwindow.cpp +++ b/UIControl/src/mainwindow.cpp @@ -17,6 +17,8 @@ */ #include "mainwindow.h" #include "include/xatom-helper.h" +#include "ukuistylehelper/ukuistylehelper.h" +#include "windowmanager/windowmanager.h" MainWindow::MainWindow(QWidget *parent,QString isoPath) : QWidget(parent) { @@ -141,10 +143,12 @@ void MainWindow::setIconchange(){ } void MainWindow::init(){ +// bool isWayland=false; this->setWindowTitle(tr("usb boot maker")); this->setFixedSize(472,648); -// 在屏幕中央显示 + QRect availableGeometry = qApp->primaryScreen()->availableGeometry(); + qInfo()<<"148availableGeometry"<move((availableGeometry.width()-this->width())/2,(availableGeometry.height()- this->height())/2); m_DaemonIpcDbus = new DaemonIpcDbus(); // 连结systembus进程消息 @@ -300,6 +304,8 @@ void MainWindow::handleIconClickedSub() hints.decorations = MWM_DECOR_BORDER; XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), hints); // this->isActiveWindow() + // this->move((QApplication::desktop()->width() - this->width())/2,(QApplication::desktop()->height() - this->height())/2); + QDesktopWidget* m = QApplication::desktop(); QRect desk_rect = m->screenGeometry(m->screenNumber(QCursor::pos())); int desk_x = desk_rect.width(); @@ -395,6 +401,7 @@ void MainWindow::dealAuthorityStatus(QString status){ makeStart(); }else{ // 授权失败,回到到page1 + } } void MainWindow::setThemeDark() @@ -433,7 +440,10 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event){ // } return QWidget::dragEnterEvent(event); } - +void MainWindow::dragLeaveEvent(QDragLeaveEvent *event){ + page1->dragLeaveEvent(event); + return QWidget::dragLeaveEvent(event); +} void MainWindow::dropEvent(QDropEvent *event){ // if(pageIndex == PAGE_ONE){ if(page1){ diff --git a/UIControl/src/mainwindow.h b/UIControl/src/mainwindow.h index 8557161..da1f248 100644 --- a/UIControl/src/mainwindow.h +++ b/UIControl/src/mainwindow.h @@ -101,6 +101,8 @@ private: void keyPressEvent(QKeyEvent* event); void dragEnterEvent(QDragEnterEvent*); + void dragLeaveEvent(QDragLeaveEvent*); + // void eventFilter() void dropEvent(QDropEvent*); void init(); //初始化mainwindow相关的设置 diff --git a/UIControl/src/page1.cpp b/UIControl/src/page1.cpp index b67cec3..118e596 100644 --- a/UIControl/src/page1.cpp +++ b/UIControl/src/page1.cpp @@ -26,47 +26,43 @@ Page1::Page1() } void Page1::initControlQss() { - edit = new QLineEdit; - topwidget1 = new QWidget(this); - topwidget1->setFixedSize(450,300); - topwidget1->hide(); + edit = new line; + edit->installEventFilter(this); + // topwidget1 = new QWidget(this); + // topwidget1->setFixedSize(450,300); + // topwidget1->hide(); topwidget=new QWidget(this); - top=new topborder(this); - top->hide(); - top->setGeometry(40,55,500,400); - topwidget->setFixedSize(450,300); - // tabUdisk = new QLabel(topwidget); - tabUdisk1 = new QLabel(topwidget1); - // tabUdisk->setFixedSize(192,192); + fram=new QFrame; + fram->setFrameShape(QFrame::NoFrame); + //fram->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + // top=new topborder(this); + // top->hide(); + fram->setGeometry(40,95,500,400); + fram->hide(); + topwidget->setFixedSize(450,320); + tabUdisk1 = new QLabel(fram); tabUdisk1->setFixedSize(127,127); urlIso=new QLabel(topwidget); - urlIso1=new QLabel(topwidget1); + urlIso1=new QLabel(fram); QPixmap pix(":/data/button lightmode inactive.png"); urlIso1->setText(tr("Drag and drop the image file here")); tabUdisk1->setPixmap(pix); - // QPixmap pix(":/data/Placeholder lighter.png"); - // tabUdisk->setPixmap(pix); urlIso->setWordWrap(true); -// urlIso->setFixedSize(400,90); urlIso->setEnabled(false); urlIso->setText(tr("Click or drag to add a mirror file")); urlIso->setAlignment(Qt::AlignHCenter); urlIso1->setAlignment(Qt::AlignHCenter); + urlIso1->setWordWrap(true); comboUdisk = new QComboBox(this); comboUdisk->setFixedSize(400,40); comboUdisk->setEnabled(false); - //format=new QCheckBox(this); - // format->setText(tr("format partition")); QWidget *btnwidget = new QWidget(this); findIso=new QPushButton(btnwidget); findIso->setStyleSheet("QPushButton{border-image:url(:/data/button lightmode normal.png);}" "QPushButton:hover{border-image:url(:/data/button lightmode hover.png);}" "QPushButton:clicked{border-image:url(:/data/button lightmode click.png);}"); findIso->setFixedSize(127,127); - // findIso->setText(tr("select file")); - // findIso->setFixedSize(150,40); creatStart=new QPushButton(btnwidget); - // creatStart->setFixedSize(150,40); creatStart->setText(tr("Start")); creatStart->setEnabled(false); connect(findIso,&QPushButton::clicked,this,[=]{ @@ -88,28 +84,33 @@ void Page1::initControlQss() QHBoxLayout *hlay=new QHBoxLayout(this); btnwidget->setLayout(hlay); hlay->addStretch(100); - // hlay->addWidget(findIso); hlay->addWidget(creatStart); hlay->addStretch(100); QVBoxLayout *vlay1 = new QVBoxLayout(this); QVBoxLayout *vlay2 = new QVBoxLayout(this); +// if(comboUdisk->currentText()!=tr("No USB drive available")){ +// qInfo()<<"wenbenshuchu"; +// edit->installEventFilter(this); +// } topwidget->setLayout(vlay1); - topwidget1->setLayout(vlay2); - //vlay1->addWidget(tabUdisk,0,Qt::AlignCenter); + fram->setLayout(vlay2); vlay1->addWidget(findIso,0,Qt::AlignCenter); vlay1->addWidget(urlIso,0,Qt::AlignCenter); + vlay1->addSpacing(70); vlay2->addWidget(tabUdisk1,0,Qt::AlignCenter); + vlay2->addSpacing(150); vlay2->addWidget(urlIso1,0,Qt::AlignCenter); + vlay2->addSpacing(70); QVBoxLayout *vlay =new QVBoxLayout(this); - vlay->addStretch(40); - vlay->addWidget(topwidget1,0,Qt::AlignCenter); + vlay->addSpacing(100); + // vlay->addWidget(topwidget1,0,Qt::AlignCenter); + vlay->addWidget(fram,0,Qt::AlignCenter); vlay->addWidget(topwidget,0,Qt::AlignCenter); - vlay->addStretch(40); + vlay->addSpacing(50); vlay->addWidget(comboUdisk,0,Qt::AlignCenter); - // vlay->addWidget(format,0,Qt::AlignCenter); - vlay->addStretch(30); + vlay->addSpacing(30); vlay->addWidget(btnwidget); - vlay->addStretch(50); + vlay->addSpacing(30); udiskPlugWatcherInit(); //监控U盘插拔 } //{ @@ -320,12 +321,17 @@ void Page1::getStorageInfo() comboUdisk->addItem(info,diskInfo->devicePath); comboUdisk->setEnabled(true); -} - comboUdisk->setCurrentIndex(-1); - comboUdisk->setLineEdit(edit); - edit->setText(tr("select USB flash drive")); - edit->setReadOnly(true); - + } + if(comboUdisk->count()!=1){ + comboUdisk->setCurrentIndex(-1); + comboUdisk->setLineEdit(edit); + edit->setText(tr("select USB flash drive")); + edit->setReadOnly(true); + } +// comboUdisk->setCurrentIndex(-1); +// comboUdisk->setLineEdit(edit); +// edit->setText(tr("select USB flash drive")); +// edit->setReadOnly(true); if(0==comboUdisk->count()) { comboUdisk->addItem(tr("No USB drive available")); @@ -445,17 +451,24 @@ void Page1::dragEnterEvent(QDragEnterEvent *event){ return ; } if(event->mimeData()->hasFormat("text/uri-list")){ -// QPixmap pix(":/data/button lightmode inactive.png"); - // urlIso1->setText(tr("Drag and drop the image file here")); -// tabUdisk1->setPixmap(pix); - topwidget1->show(); - topwidget->hide(); - top->show(); + qInfo()<<"437"<setFrameShape(QFrame::StyledPanel); + fram->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); + fram->show(); + // topwidget1->show(); + topwidget->hide(); +// top->show(); event->acceptProposedAction(); } return QWidget::dragEnterEvent(event); } +void Page1::dragLeaveEvent(QDragLeaveEvent *event){ + findIso->show(); + topwidget->show(); + fram->hide(); + return QWidget::dragLeaveEvent(event); +} void Page1::dropEvent(QDropEvent *event){ auto urls = event->mimeData()->urls(); if(urls.isEmpty()) @@ -463,12 +476,8 @@ void Page1::dropEvent(QDropEvent *event){ for(auto url:urls){ dealSelectedFile(url.toLocalFile()); findIso->show(); - // QPixmap pix(":/data/Placeholder lighter.png"); - // tabUdisk->setPixmap(pix); - // tabUdisk->show(); - topwidget1->hide(); topwidget->show(); - top->hide(); + fram->hide(); ifStartBtnChange(); } return ; @@ -483,3 +492,13 @@ void Page1::settingStyle(){ }); subject->iniWidgetStyle(); } +bool Page1::eventFilter(QObject *watched, QEvent *event){ + if(watched==edit){ + if(event->type()==QEvent::MouseButtonPress){ + if(comboUdisk->currentText()!=tr("No USB drive available")){ + qInfo()<<"wenbenshuchu"; + comboUdisk->showPopup(); + } + } + } +} diff --git a/UIControl/src/page1.h b/UIControl/src/page1.h index 5a4113b..f01f1ac 100644 --- a/UIControl/src/page1.h +++ b/UIControl/src/page1.h @@ -61,7 +61,9 @@ #include #include #include "topborder.h" +#include "line.h" #include "include/GSettingSubject.h" +#include class AvailableDiskInfo { public: @@ -80,6 +82,7 @@ class Page1 : public QWidget public: explicit Page1(); QString isoPath; //iso文件的路径 + QFrame *fram; QList diskInfos; // U盘信息 bool ifStartBtnChange(); //开始制作按钮是否可以点击 void setThemeStyleLight(); //设置浅色主题 @@ -93,12 +96,14 @@ public: QLabel *urlIso1 = nullptr; QComboBox *comboUdisk = nullptr;//U盘列表 topborder * top; - QLineEdit * edit; + // QLineEdit * edit; + line * edit; QPushButton *creatStart = nullptr;//开始制作 QPushButton *findIso = nullptr;//浏览文件按钮 GsettingSubject *subject; void dropEvent(QDropEvent*); void dragEnterEvent(QDragEnterEvent *event); + void dragLeaveEvent(QDragLeaveEvent *event); signals: void makeStart(QString sourcePath,QString targetPath); //make start void starmake(QString sourcepath,QString usbpath); @@ -139,6 +144,9 @@ public: QLabel *tabUdisk1= nullptr; QWidget *topwidget; QWidget * topwidget1; +protected: + bool eventFilter(QObject *watched, QEvent *event); + }; diff --git a/UIControl/src/page2.cpp b/UIControl/src/page2.cpp index 7602c10..8d102ad 100644 --- a/UIControl/src/page2.cpp +++ b/UIControl/src/page2.cpp @@ -159,14 +159,13 @@ void Page2::startMaking() { playLoadingGif(); QDBusConnection::systemBus().connect(QString(),QString("/"),"com.kylinusbcreator.interface","workingProgress",this,SLOT(dealWorkingProgress(int))); - QDBusConnection::systemBus().connect(QString(),QString("/"),"com.kylinusbcreator.interface","errorstr",this,SLOT(dealerror(QString))); QDBusConnection::systemBus().connect(QString(),QString("/"),"com.kylinusbcreator.interface","makeFinish",this,SLOT(dealMakeFinish(QString))); } void Page2::dealerrorstr(QString str){ - qInfo()<<"errorstr"<setPersent(progress); + qInfo()<<"progress"<setValue(progress); // round->setFormat(QString::number(progress)+"%"); @@ -184,13 +184,17 @@ void Page2::dealMakeFinish(QString status) uDiskPath = ""; if("success" == status){ //TODO:success action + //mountDevice(uDiskPath); round->setPersent(100); - mountDevice(uDiskPath); playFinishGif(); - qDebug()<<"status"<MainWindow Kylin USB Creator - 麒麟U盘启动器 + ཆི་ལིན་Uསྡེར་སྒུལ་ཆས་ kylin usb creator - 麒麟U盘启动器 + ཆི་ལིན་Uསྡེར་སྒུལ་ཆས་ minimize - 最小化 + ཆེས་ཆུང་ཅན་ @@ -25,7 +25,7 @@ usb boot maker - usb ལྷམ་བཟོ་མཁན། + Uསྡེར་ ལྷམ་བཟོ་མཁན། @@ -92,14 +92,14 @@ choose iso file - iso ཡིག་ཆ་བདམས་པ། + བདམས་པའི་ཤེལ་བརྙན་ཡིག་ཆ། select USB flash drive - USB 闪存驱动器选择 + Uསྡེར་འདེམས་སྒྲིག་ཆས་ @@ -113,27 +113,27 @@ USB drive will be formatted,please backup your files! - 制作启动盘的U盘将被格式化,请先备份好重要文件! + སྒོ་ཕྱེ་པའི་Uསྡེར་དེ་རྣམ་པར་འཇོག་པས།སྔོན་ལ་ཡིག་ཆ་གལ་ཆེན་དག་གྲབས་ཉར་བྱེད་རོགས། Authorization - 授权 + དབང་སྐུར། cancel - 取消 + མེད་པར་བཟོ་བ་ Choose iso file - 选择光盘镜像文件 + འོད་སྡེར་བདམས་པའི་ཤེལ་བརྙན་ཡིག་ཆ། Select USB drive - 选择U盘 + Uསྡེར་འདེམ་པ། Open - 浏览 + རགས་ལྟ་ @@ -142,7 +142,7 @@ ISO Invalid,please make sure you choose a vavlid image! - ISO镜像无效,请选择正确的镜像! + ISOOབརྙན་ལ་ནུས་པ་མི་འདུགཁྱེད་ཀྱིས་ཡང་དག་གི་སྣང་བརྙན་འདེམས་རོགས། @@ -151,32 +151,34 @@ These operations needs to be verified: - 执行该动作需要root授权,您需要进行验证: + འགུལ་སྟངས་འདི་ལག་བསྟར་བྱེད་པར་rotཡིས་དབང་ཆ་བསྐུར་དགོས་པས་ཁྱེད་ཀྱིས་ཚོད་ལྟས་ར་སྤྲོད་བྱེད་དགོས།: USB drive will be formatted,please backup your files - 制作启动盘的U盘将被格式化,请先备份好重要文件 + སྒོ་འབྱེད་སྡེར་བཟོས་ཀྱི་Uསྡེར་ནི་རྣམ་གཞག་དང་།ཡིག་ཆ་གལ་ཆེན་སྔོན་ལ་གྲབས་ཉར་ཡག་པོ་རོགས་། OK - 授权 + དབང་སྐུར། These operations needs to be verified. - 要安装或卸载软件,您需要进行验证。 + མ་ལག་སྒྲིག་པའམ་ཕབ་དགོས།ཁྱེད་ཀྱིས་ཞིབ་བཤེར་བྱེད་དགོས། Request authorization: - 一个程序正试图执行一个需要特权的动作。要求授权以执行该动作: + གོ་རིམ་ཞིག་ལག་བསྟར་བྱེད་པར་ཚོད་ལྟ་བྱེད་བཞིན་ཡོད་།ཁྱད་དབང་གི་འགུལ་སྟངས་ཞིག་རེད། དབང་བསྐུར་ནས་བྱ་སྤྱོད་དེ་ལག་བསྟར་བྱེད་དུ་འཇུག་དགོས།: Password: - 输入密码: + གསང་ཨང་འགོད་པ།: + + No USB drive available USBསྒུལ་ཆས་བཀོལ་སྤྱོད་བྱེད་མི་ཐུབ། @@ -190,7 +192,7 @@ Please do not remove the USB driver or power off now. - 制作时请不要移除U盘或关机。 + བཟོ་དུས་སུUསྡེར་དང་ཡང་ན་ཁ་མ་རྒྱག་རོགས། @@ -251,27 +253,27 @@ StyleWidget kylin usb creator - 麒麟U盘启动器 + ཆི་ལིན་Uསྡེར་སྒུལ་ཆས་ Theme - 主题 + བརྗོད་བྱ་གཙོ་བོ། Help - 帮助 + རོགས་རམ། About - 关于 + སྐོར་ Setting - 设置 + གསར་འཛུགས་ Quit - 退出 + ཕྱིར་འབུད་ @@ -291,7 +293,7 @@ menuModule menu - 菜单 + ཟས་ཐོ། @@ -390,23 +392,23 @@ USB Boot Maker provides system image making function.The operation process is simple and easy.You can choose ISO image and usb driver,and make boot driver with a few clicks. - USB Boot Maker提供了系统图像功能。 བཀོལ་སྤྱོད་ཀྱི་གོ་རིམ་སྟབས་བདེ་ཞིང་སྟབས་བདེ་ཡིན། ཁྱེད་ཚོས་ISOཡི་པར་རིས་དང་usb ཁ་ལོ་བ་གདམ་གསེས་བྱས་ཆོག་པ་མ་ཟད། ད་དུང་མཐེབ་བཀྱག་འགའ་བརྒྱབ་ནས་ལྷམ་ཡུ་རིང་གི་ཁ + Uསྡེར་སྒུལ་ཆས་ཀྱིས་མ་ལག་བརྙན་རིས་ནུས་པ་འདོན་སྤྲོད་བྱས།。 བཀོལ་སྤྱོད་ཀྱི་གོ་རིམ་སྟབས་བདེ་ཞིང་སྟབས་བདེ་ཡིན། ཁྱེད་ཚོས་ISOཡི་པར་རིས་དང་usb ཁ་ལོ་བ་གདམ་གསེས་བྱས་ཆོག་པ་མ་ཟད། ད་དུང་མཐེབ་བཀྱག་འགའ་བརྒྱབ་ནས་ལྷམ་ཡུ་རིང་གི་ཁ close - 关闭 + སྒོ་རྒྱག་པ་ kylin usb creator - 麒麟U盘启动器 + ཆི་ལིན་Uསྡེར་སྒུལ་ཆས་ Kylin USB Creator provides system image making function.The operation process is simple and easy.You can choose ISO image and usb driver,and make boot driver with a few clicks. - 麒麟U盘启动器提供系统盘制作功能,操作流程简单便捷。用户可以自行选择ISO镜像和U盘,一键轻松制作U盘启动盘。 + ཆི་ལིན་Uསྡེར་སྒུལ་ཆས་ཀྱིས་མ་ལག་གི་བྱེད་ནུས་འདོན་སྤྲོད་བྱས་ཡོད་ལ།བཀོལ་སྤྱོད་ཀྱི་བརྒྱུད་རིམ་སྟབས་བདེ་ཡིན། བཀོལ་མཁན་གྱིས་རང་འགུལ་ངང་ISOབརྙན་བརྙན་དང་Uསྡེར་འདེམས་ཆོགམཐེབ་གཅིག་བདེ་མོའི་ངང་Uསྡེར་ལས་ཆོག Kylin USB Creator provides system image making function.The operation process is simple and easy.You can choose ISO image and usb driver,and make boot driver with a few clicks - 麒麟U盘启动器提供系统盘制作功能。操作流程简单便捷。用户可以自行选择ISO镜像和U盘,一键轻松制作U盘启动器。 + ཆི་ལིན་Uསྡེར་སྒུལ་ཆས་ཀྱིས་མ་ལག་སྡེར་བཟོ་བའི་ནུས་པ་འདོན་སྤྲོད་བྱས། བཀོལ་སྤྱོད་ཀྱི་བརྒྱུད་རིམ་སྟབས་བདེ་ལ་སྟབས་བདེ། བཀོལ་མཁན་གྱིས་རང་འགུལ་ངང་ISOབརྙན་བརྙན་དང་Uསྡེར་འདེམས་ཆོགམཐེབ་གཅིག་བདེ་མོའི་ངང་Uསྡེར་སྒུལ་ཆས་བཟོས་ཆོག @@ -421,30 +423,30 @@ Support: support@kylinos.cn - 支持:support@kylinos.cn + རྒྱབ་སྐྱོར་:support@kylinos.cn rootAuthDialog Input password - 请输入密码 + གསང་ཨང་ནང་འཇུག་རོགས་། please enter the password - 请输入密码 + གསང་ཨང་ནང་འཇུག་རོགས་། Wrong password!Try again - 密码错误,请重新尝试 + གསང་ཨང་ནོར་འཁྲུལ་དང་།ཡང་བསྐྱར་ཚོད་ལྟ་ཞིག་བྱེད་རོགས་། Current user is not in the sudoers file,please change another account or change authority - 当前用户不在sudoer名单中,请修改账户或权限 + མིག་སྔར་སྤྱོད་མཁན་གྱི་མིང་ཐོ་ནང་དུ་མེད་།ཐོ་ཁོངས་སམ་དབང་ཚད་བཟོ་བཅོས་རྒྱག་རོགས་། Current user is not in the sudoers file,please change another account or change authority. - 当前用户不在sudoer名单中,请修改账户或权限。 + མིག་སྔར་སྤྱོད་མཁན་གྱི་མིང་ཐོ་ནང་དུ་མེད་།ཐོ་ཁོངས་སམ་དབང་ཚད་བཟོ་བཅོས་རྒྱག་རོགས་།。 diff --git a/UIControl/src/translations/kylin-usb-creator_zh_CN.ts b/UIControl/src/translations/kylin-usb-creator_zh_CN.ts index 3121181..3443090 100644 --- a/UIControl/src/translations/kylin-usb-creator_zh_CN.ts +++ b/UIControl/src/translations/kylin-usb-creator_zh_CN.ts @@ -176,7 +176,9 @@ + + No USB drive available 无可用U盘 diff --git a/debian/changelog b/debian/changelog index 7002089..0d1734e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +kylin-usb-creator (1.2.0.3kord-ok3) yangtze; urgency=medium + + * BUG:128065 【U盘启动器】U盘启动器制作的启动盘无法安装系统 + 128089 【U盘启动器】U盘启动器打开后,页面未处于中间 + *其他改动说明:无 + * 其他改动影响域:无 + + + -- rongyouli Wed, 13 Jul 2022 09:37:04 +0800 + kylin-usb-creator (1.2.0.3kord-ok2) yangtze; urgency=medium * Fix build error diff --git a/debian/control b/debian/control index a595a38..5466e5d 100644 --- a/debian/control +++ b/debian/control @@ -3,6 +3,17 @@ Section: utils Priority: optional Maintainer: liuyuhui Build-Depends: debhelper-compat (= 12), + qtbase5-dev, + qt5-qmake, + qtchooser, + libkf5windowsystem-dev, + libqt5x11extras5-dev, + qtscript5-dev, + libkysdk-waylandheleper, + libkysdk-waylandheleper-dev, + libkysdk-appcommon, + qttools5-dev-tools, + qtbase5-dev-tools, libgsettings-qt-dev, libkf5windowsystem-dev, libpolkit-qt5-1-dev, diff --git a/kylin-usb-creator.pro b/kylin-usb-creator.pro index 30c6a1f..f08e4cf 100644 --- a/kylin-usb-creator.pro +++ b/kylin-usb-creator.pro @@ -1,8 +1,17 @@ TEMPLATE = subdirs -CONFIG += ordered +CONFIG += ordered \ + qt SUBDIRS = \ UIControl \ registeredQDbus \ +HEADERS += \ + UIControl/src/line.h + +SOURCES += \ + UIControl/src/line.cpp + +QT += widgets + diff --git a/registeredQDbus/mythread.cpp b/registeredQDbus/mythread.cpp new file mode 100644 index 0000000..3b70524 --- /dev/null +++ b/registeredQDbus/mythread.cpp @@ -0,0 +1,6 @@ +#include "mythread.h" + +Mythread::Mythread() +{ + +} diff --git a/registeredQDbus/mythread.h b/registeredQDbus/mythread.h new file mode 100644 index 0000000..9b00dec --- /dev/null +++ b/registeredQDbus/mythread.h @@ -0,0 +1,11 @@ +#ifndef MYTHREAD_H +#define MYTHREAD_H + + +class Mythread +{ +public: + Mythread(); +}; + +#endif // MYTHREAD_H diff --git a/registeredQDbus/registeredQDbus.pro b/registeredQDbus/registeredQDbus.pro index 48b47a0..24287c8 100644 --- a/registeredQDbus/registeredQDbus.pro +++ b/registeredQDbus/registeredQDbus.pro @@ -38,6 +38,7 @@ INSTALLS += \ SOURCES += \ main.cpp \ + mythread.cpp \ systemdbusregister.cpp \ # systemdbusregister.cpp @@ -45,6 +46,7 @@ LIBS += -L/usr/lib/x86_64-linux-gnu/ -lpolkit-qt5-core-1 LIBS += -lukui-log4qt HEADERS += \ + mythread.h \ systemdbusregister.h DISTFILES += \ diff --git a/registeredQDbus/systemdbusregister.cpp b/registeredQDbus/systemdbusregister.cpp index ba4e15c..f335f3f 100644 --- a/registeredQDbus/systemdbusregister.cpp +++ b/registeredQDbus/systemdbusregister.cpp @@ -21,6 +21,7 @@ #include #include #include +#include using namespace PolkitQt1; @@ -45,34 +46,167 @@ void SystemDbusRegister::MakeStart(QString sourcePath,QString targetPath){ emit authorityStatus("failed"); return ; } -// if(!unmountDevice(targetPath)){ -// // TODO:Deal sbus message unmount_error -// emit makeFinish("unmount_error"); - -// } - -// if(!unmountDevice(targetPath + "1")){ -// // TODO:Deal sbus message unmount_error -// emit makeFinish("unmount_error"); -// } uDiskPath = targetPath; - QFileInfo info(sourcePath); - sourceFileSize = info.size()/1000000; - command_dd = new QProcess(); - //指定输出语言 - QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); - env.insert("LANGUAGE","en_US:en"); - command_dd->setProcessEnvironment(env); - connect(command_dd,&QProcess::readyReadStandardError,this,&SystemDbusRegister::readBashStandardErrorInfo); - connect(command_dd,SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(dd_finished(int,QProcess::ExitStatus))); - QTimer::singleShot(1*1000, this, &SystemDbusRegister::handletimeout); - command_dd->start("bash"); - command_dd->start("bash"); - command_dd->waitForStarted(); +QFileInfo info(sourcePath); +sourceFileSize = info.size()/1000000; +command_dd = new QProcess(); +//指定输出语言 +QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); +env.insert("LANGUAGE","en_US:en"); +command_dd->setProcessEnvironment(env); +//command_dd->setProcessChannelMode(QProcess::MergedChannels); +connect(command_dd,&QProcess::readyReadStandardOutput,this,&SystemDbusRegister::readBashStandardErrorInfo); +connect(command_dd,&QProcess::readyReadStandardError,this,&SystemDbusRegister::readBashStandardErrorInfo); +connect(command_dd,SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(dd_finished(int,QProcess::ExitStatus))); +QTimer::singleShot(1*1000, this, &SystemDbusRegister::handletimeout); + // QThread::create([=](){ + qDebug("输出线程"); + if(!unmountDevice(targetPath)){ + // TODO:Deal sbus message unmount_error + QProcess *format=new QProcess; +// format->start("bash"); + QStringList args512; + args512<<"if=/dev/zero"<<"of="+targetPath.toLocal8Bit()<<"bs=512"<<"count=1"; + format->start("dd", args512); + connect(format,SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(clear_finished(int,QProcess::ExitStatus))); + format->waitForStarted(); + if(format->waitForStarted()){ + qDebug()<<"58ag0"<arguments(); + } - QString ddshell = "dd if='"+sourcePath.toLocal8Bit()+"' of="+targetPath.toLocal8Bit()+" status=progress"+" bs=4096"; - command_dd->write(ddshell.toLocal8Bit() + '\n'); - return ; + // format->waitForFinished(); + emit makeFinish("unmount_error"); + } + + if(!unmountDevice(targetPath + "1")){ +// // TODO:Deal sbus message unmount_error + QProcess *format=new QProcess; + QStringList args512; + args512<<"if=/dev/zero"<<"of="+targetPath.toLocal8Bit()<<"bs=512"<<"count=1"; + format->start("dd", args512); + connect(format,SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(clear_finished(int,QProcess::ExitStatus))); + format->waitForStarted(); + if(format->waitForStarted()){ + qDebug()<<"70ag0"<arguments(); + } + //format->waitForFinished(); + emit makeFinish("unmount_error"); + } +// uDiskPath = targetPath; +// QFileInfo info(sourcePath); +// sourceFileSize = info.size()/1000000; +// this->command_dd = new QProcess(); +// //指定输出语言 +// QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); +// env.insert("LANGUAGE","en_US:en"); +// this->command_dd->setProcessEnvironment(env); +// //command_dd->setProcessChannelMode(QProcess::MergedChannels); +// connect(this->command_dd,&QProcess::readyReadStandardOutput,this,&SystemDbusRegister::readBashStandardErrorInfo); +// connect(this->command_dd,&QProcess::readyReadStandardError,this,&SystemDbusRegister::readBashStandardErrorInfo); +// connect(this->command_dd,SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(dd_finished(int,QProcess::ExitStatus))); +// QTimer::singleShot(1*1000, this, &SystemDbusRegister::handletimeout); + //command_dd->start("bash"); + // command_dd->start("bash"); +// QStringList args; +// args<<"if="+sourcePath.toLocal8Bit()<<"of="+targetPath.toLocal8Bit()<<"status=progress"<<"bs=32M"; +// command_dd->start("dd", args); +// command_dd->waitForStarted(); +// if(command_dd->waitForStarted()){ +// qDebug()<<"97command_dd->arguments()"<command_dd->arguments(); +// } +// // QString ddshell = "dd if='"+sourcePath.toLocal8Bit()+"' of="+targetPath.toLocal8Bit()+" status=progress"+" bs=32M"; +// // command_dd->write(ddshell.toLocal8Bit() + '\n'); +// qDebug()<<"shuchu91"<command_dd->arguments(); + //return ; + // })->start(); +// QStringList args; +// args<<"if="+sourcePath.toLocal8Bit()<<"of="+targetPath.toLocal8Bit()<<"status=progress"<<"bs=32M"; +// command_dd->start("dd", args); +// command_dd->waitForStarted(); +// if(command_dd->waitForStarted()){ +// qDebug()<<"97command_dd->arguments()"<arguments(); +// } +// // QString ddshell = "dd if='"+sourcePath.toLocal8Bit()+"' of="+targetPath.toLocal8Bit()+" status=progress"+" bs=32M"; +// // command_dd->write(ddshell.toLocal8Bit() + '\n'); +// qDebug()<<"shuchu91"<arguments(); +// if(!unmountDevice(targetPath)){ +// // TODO:Deal sbus message unmount_error +// QProcess *format=new QProcess; +// format->start("bash"); +// QString fileformat="mkfs -t ext4 "+targetPath; +// format->write(fileformat.toLocal8Bit()+'\n'); +// format->waitForFinished(); +// emit makeFinish("unmount_error"); +// } + +// if(!unmountDevice(targetPath + "1")){ +// // TODO:Deal sbus message unmount_error +// QProcess *format=new QProcess; +// format->start("bash"); +// QString fileformat="mkfs -t ext4 "+targetPath+"1"; +// format->write(fileformat.toLocal8Bit()+'\n'); +// format->waitForFinished(); +// emit makeFinish("unmount_error"); +// } +// uDiskPath = targetPath; + +// // udiskmountpoint(); +//// QProcess *format=new QProcess; +//// format->start("bash"); +//// QString fileformat="mkfs -t ext4 "+targetPath; +//// format->write(fileformat.toLocal8Bit()+'\n'); +//// format->waitForFinished(); +//// QProcess *clearor=new QProcess; +//// connect(clearor,SIGNAL(finished(int)),this,SLOT(clear_finished(int))); +//// QStringList args512; +// // args512<<"if=/dev/zero"<<"of="+targetPath.toLocal8Bit()<<"status=progress"<<"bs=512"<<"count=1"; +// // clearor->start("dd", args512); +//// clearor->start("bash"); +//// clearor->start("bash"); +//// clearor->waitForStarted(); +//// QString source="/dev/zero"; +//// QString ddshell1 ="dd if='"+source.toLocal8Bit()+"' of="+targetPath.toLocal8Bit()+" status=progress"+" bs=512"+" count=1"; +//// clearor->write(ddshell1.toLocal8Bit() + '\n'); +// // connect(clearor,&QProcess::finished,this,&SystemDbusRegister::clear_finished); +// // clearor->waitForFinished(); +// QFileInfo info(sourcePath); +// sourceFileSize = info.size()/1000000; +// command_dd = new QProcess(); +// //指定输出语言 +// QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); +// env.insert("LANGUAGE","en_US:en"); +// command_dd->setProcessEnvironment(env); +// connect(command_dd,&QProcess::readyReadStandardError,this,&SystemDbusRegister::readBashStandardErrorInfo); +// connect(command_dd,SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(dd_finished(int,QProcess::ExitStatus))); +// QTimer::singleShot(1*1000, this, &SystemDbusRegister::handletimeout); +// command_dd->start("bash"); +// command_dd->start("bash"); +// command_dd->waitForStarted(); +// QString ddshell = "dd if='"+sourcePath.toLocal8Bit()+"' of="+targetPath.toLocal8Bit()+" status=progress"+" bs=32M"; +// command_dd->write(ddshell.toLocal8Bit() + '\n'); +// qDebug()<<"shuchu91"<arguments(); + // return ; +} +void SystemDbusRegister::clear_finished(int exitCode,QProcess::ExitStatus exitStatus){ + qDebug()<<"85exitCode"<start("dd", args); + command_dd->waitForStarted(); + if(command_dd->waitForStarted()){ + qDebug()<<"97command_dd->arguments()"<arguments(); + } + // QString ddshell = "dd if='"+sourcePath.toLocal8Bit()+"' of="+targetPath.toLocal8Bit()+" status=progress"+" bs=32M"; + // command_dd->write(ddshell.toLocal8Bit() + '\n'); + qDebug()<<"shuchu91"<arguments(); + } +// command_dd->start("bash"); +// command_dd->start("bash"); +// command_dd->waitForStarted(); +// QString ddshell = "dd if='"+sourceFile.toLocal8Bit()+"' of="+uDiskPath.toLocal8Bit()+" status=progress"+" bs=32M"; +// command_dd->write(ddshell.toLocal8Bit() + '\n'); } void SystemDbusRegister::dd_finished(int exitCode, QProcess::ExitStatus exitStatus){ if(exitStatus!=QProcess::NormalExit){ @@ -88,27 +222,95 @@ void SystemDbusRegister::handletimeout(){ command_dd->kill(); } } -//bool SystemDbusRegister::unmountDevice(QString target) -//{ -// QProcess unmount; -// unmount.start("udisksctl",QStringList{"unmount","-b",target}); -// qDebug()<<"Start unmount disk:"<readAllStandardError(); cmdout.trimmed(); if(!cmdout.isEmpty() && cmdout != "\r" && cmdout != "\n"){ @@ -146,8 +349,9 @@ void SystemDbusRegister::readBashStandardErrorInfo() return; } //send mission percent debus message every output + qDebug()<<__func__<<__LINE__<stop(); if(isMakingSucess()){ //send production success dbus message - qDebug()<<"make success"; + qInfo()<<"make success"; QProcess sync; sync.start("sync"); sync.waitForStarted(); sync.waitForFinished(); emit makeFinish("success"); + //mountDevice(uDiskPath); + // mountDevice(uDiskPath+"1"); qDebug()<<"uDiskPath"<start(2000); } + +bool SystemDbusRegister::mountDevice(QString target){ + +// QProcess sync; +// sync.start("sync"); +// sync.waitForStarted(); +// sync.waitForFinished(); + + QProcess mount; + qInfo()<<"start mounting disk:"<