From 02548f0b3fa2a14372359dd214d38437cb19d4a4 Mon Sep 17 00:00:00 2001 From: zhoudisi Date: Sun, 31 Mar 2024 20:48:32 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=E9=80=82=E9=85=8Dsdk=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhoudisi --- src/data/datadirectory.cpp | 6 ++-- src/main.cpp | 27 +++++++++------ src/model/logicburndata.cpp | 2 ++ src/model/logiccopyimage.cpp | 3 ++ src/model/menufactory.cpp | 7 ++++ src/process/processburndata.cpp | 3 ++ src/process/processcreateiso.cpp | 3 ++ src/process/processgetiso.cpp | 3 ++ src/view/burndata.cpp | 20 +++++++++--- src/view/burndata.h | 1 + src/view/burnimage.cpp | 7 +++- src/view/busnesssetting.cpp | 4 ++- src/view/copyimage.cpp | 9 ++++- src/view/diskcheck.cpp | 8 ++++- src/view/execdialog.cpp | 4 +-- src/view/filefilterrules.cpp | 12 +++++-- src/view/inputchange.cpp | 2 ++ src/view/kybaboutdialog.cpp | 6 ++-- src/view/kybaboutdialog.h | 2 +- src/view/mainwindow.cpp | 47 +++++++++++++++++++++------ src/view/mainwindow.h | 5 +++ src/view/modaldialog.cpp | 37 +++++---------------- src/view/modaldialog.ui | 3 ++ src/view/multiselectfiledialog.cpp | 2 ++ src/view/multiselectionfiledialog.cpp | 2 ++ src/view/tip_burnresult.cpp | 8 +++-- src/view/tip_burnresult.h | 1 + src/view/tip_burnresult.ui | 2 +- src/view/viewfilterfiles.cpp | 13 ++++++-- 29 files changed, 177 insertions(+), 72 deletions(-) diff --git a/src/data/datadirectory.cpp b/src/data/datadirectory.cpp index d99cc32..a29ba38 100644 --- a/src/data/datadirectory.cpp +++ b/src/data/datadirectory.cpp @@ -3,12 +3,14 @@ #include "src/frame/configuration.h" #include "src/view/execdialog.h" #include "src/view/modaldialog.h" +#include "src/view/mainwindow.h" #include #include #include #include #include +#include bool DataDirectory::g_bFilterHidden = false; bool DataDirectory::g_bFilterBroken = false;//是否执行损坏连接文件过滤 @@ -140,7 +142,7 @@ void DataDirectory::append(DataFile *d) case 0: do { - QScopedPointer p(new InputChange); + QScopedPointer p(new InputChange(MainWindow::Instance())); //renamed = EXEC->input(newName, _("Rename"), _("Add new name for %1").arg(d->display()), d->display()); renamed = p->input(newName, _("Rename"), _("File name duplicate, need to rename:"), d->display()); if (!renamed) break; @@ -482,7 +484,7 @@ void DataDirectory::doChild(DataFile *child, bool b) { - QScopedPointer p(new InputChange); + QScopedPointer p(new InputChange(MainWindow::Instance())); // renamed = EXEC->input(newName, _("Rename"), _("Add new name for %1").arg(child->display()), child->display()); renamed=p->input(newName, _("Rename"), _("File name duplicate, need to rename:"),child->display()); diff --git a/src/main.cpp b/src/main.cpp index fabc07a..16fa651 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -56,7 +57,6 @@ int main(int argc, char *argv[]) #endif //initUkuiLog4qt("burner"); - ABOUT->init(); CFG->init(); //EverTime Burner Start, init [DataSetting]--Duplicate Data/Add Data/Delete Data/clean Data //it can reduce some error when user some operation @@ -100,16 +100,23 @@ int main(int argc, char *argv[]) isWayland = true; } - MainWindow w(parser->positionalArguments(), nullptr); - if(isWayland) { - kdk::UkuiStyleHelper::self()->removeHeader(&w); +// MainWindow w(parser->positionalArguments(), nullptr); +// if(isWayland) { // set window position - 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())); - } - - w.show(); +// 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())); +// } + +// w.show(); + MainWindow::Instance(parser->positionalArguments(), nullptr); + kdk::UkuiStyleHelper::self()->removeHeader(MainWindow::Instance()); + MainWindow::Instance()->show(); + kdk::WindowManager::setGeometry(MainWindow::Instance()->windowHandle(), + QRect(qApp->desktop()->geometry().center() - MainWindow::Instance()->geometry().center(), + QSize(MainWindow::Instance()->size()))); + KYBAboutDialog::instance(MainWindow::Instance()); + ABOUT->init(); MAIN->initISO(); MONITOR->start(); diff --git a/src/model/logicburndata.cpp b/src/model/logicburndata.cpp index d944c39..15c0d6e 100644 --- a/src/model/logicburndata.cpp +++ b/src/model/logicburndata.cpp @@ -12,6 +12,7 @@ #include "src/process/processcreateiso.h" #include "src/process/processburndata.h" #include "src/process/processburnudfdata.h" +#include "src/view/mainwindow.h" #include #include @@ -21,6 +22,7 @@ #include #include #include +#include #define APPLICATIONTYPE QString("application/x-kylinburnerdata") diff --git a/src/model/logiccopyimage.cpp b/src/model/logiccopyimage.cpp index 3d5f92c..193b4cb 100644 --- a/src/model/logiccopyimage.cpp +++ b/src/model/logiccopyimage.cpp @@ -7,7 +7,10 @@ #include "src/process/processcopydisk.h" #include "src/view/execdialog.h" #include "src/po/translation.h" +#include "src/view/mainwindow.h" #include +#include +using namespace kdk; LogicCopyImage *LogicCopyImage::m_oInstance = nullptr; QMutex LogicCopyImage::m_oMutex; diff --git a/src/model/menufactory.cpp b/src/model/menufactory.cpp index c8af3fc..2d097e0 100644 --- a/src/model/menufactory.cpp +++ b/src/model/menufactory.cpp @@ -5,12 +5,15 @@ #include "src/data/datacdrom.h" #include "src/view/filefilterrules.h" #include "src/view/kybaboutdialog.h" +#include "src/view/mainwindow.h" #include #include #include #include #include +#include +#include MenuFactory *MenuFactory::m_oInstance = nullptr; QMutex MenuFactory::m_oMutex; @@ -432,7 +435,11 @@ void MenuFactory::takeCDROM(void * cdrom) #endif } void MenuFactory::showabout(){ + kdk::UkuiStyleHelper::self()->removeHeader(ABOUT); ABOUT->show(); + if(QString(qgetenv("XDG_SESSION_TYPE")) != "wayland") { + kdk::WindowManager::setGeometry(ABOUT->windowHandle(),QRect(MainWindow::Instance()->frameGeometry().center()-ABOUT->rect().center(),QSize(ABOUT->size()))); + } } MenuFactory::~MenuFactory() { diff --git a/src/process/processburndata.cpp b/src/process/processburndata.cpp index e006776..c221513 100644 --- a/src/process/processburndata.cpp +++ b/src/process/processburndata.cpp @@ -7,6 +7,7 @@ #include "src/view/execdialog.h" #include "src/frame/signals.h" #include "src/model/diroptutils.h" +#include "src/view/mainwindow.h" #include #include @@ -14,6 +15,8 @@ #include #include #include +#include +using namespace kdk; ProcessBurnData::ProcessBurnData(void *root, void *cdrom, QObject *parent) : ProcessBasic(parent), diff --git a/src/process/processcreateiso.cpp b/src/process/processcreateiso.cpp index 70f3a99..a20cc79 100644 --- a/src/process/processcreateiso.cpp +++ b/src/process/processcreateiso.cpp @@ -5,10 +5,13 @@ #include "src/data/datadirectory.h" #include "src/view/modaldialog.h" #include "src/view/execdialog.h" +#include "src/view/mainwindow.h" #include #include #include +#include +using namespace kdk; ProcessCreateISO::ProcessCreateISO(void *r, void *d, QObject *parent) : ProcessBasic(parent) diff --git a/src/process/processgetiso.cpp b/src/process/processgetiso.cpp index 91875b5..aaa78c7 100644 --- a/src/process/processgetiso.cpp +++ b/src/process/processgetiso.cpp @@ -7,9 +7,12 @@ #include "src/frame/signals.h" #include "src/frame/auditlog.h" #include +#include "src/view/mainwindow.h" #include #include +#include +using namespace kdk; ProcessGetISO::ProcessGetISO(void *src, void *des, QObject *parent) : ProcessBasic(parent), diff --git a/src/view/burndata.cpp b/src/view/burndata.cpp index c8a3a4d..1765a12 100755 --- a/src/view/burndata.cpp +++ b/src/view/burndata.cpp @@ -11,6 +11,7 @@ #include "src/view/viewfilterfiles.h" #include "src/view/mymenu.h" #include "src/frame/signals.h" +#include "mainwindow.h" #include #include @@ -21,6 +22,10 @@ #include #include #include +#include +#include "mainwindow.h" +#include +#include BurnData *BurnData::m_oInstance = nullptr; QMutex BurnData::m_oMutex; @@ -34,6 +39,7 @@ BurnData::BurnData(QWidget *parent) : m_oPosition(0 , 0), ui(new Ui::BurnData) { + inputchange = new InputChange(); QFont f; QToolButton *btn; ui->setupUi(this); @@ -561,7 +567,7 @@ void BurnData::slotsSelectionChanged() void BurnData::slotsAddFiles(bool b) { - MultiSelectionFileDialog fd; + MultiSelectionFileDialog fd(this); QList list = fd.sidebarUrls(); int sidebarNum = 8;//最大添加U盘数,可以自己定义 QString home = QDir::homePath().section("/", -1, -1); @@ -608,6 +614,10 @@ void BurnData::slotsAddFiles(bool b) fd.setWindowTitle(_("Burner") + " - " + _("Add File(s)")); fd.setWindowIcon(QIcon::fromTheme("burner")); fd.setSidebarUrls(list + mntUrlList); + fd.setModal(true); + kdk::UkuiStyleHelper::self()->removeHeader(&fd); + fd.move(this->geometry().center()-fd.geometry().center()); + kdk::WindowManager::setGeometry(fd.windowHandle(),fd.geometry()); if (fd.exec()) m_oModel->addDatasToIndex(fd.selectedFiles(), m_oAddIndex); ui->btnAdd->setChecked(false); @@ -624,7 +634,7 @@ void BurnData::slotsDeleteFiles(bool b) if (b || m_oDelete == sender()) { //使用QMessageBox代替EXEC删除提示弹窗 - QScopedPointer p(new TipsChange); + QScopedPointer p(new TipsChange(this)); if(p->question(_("Delete"), _("Delete file(s) selected?"))) { ui->btnDelete->setChecked(false); @@ -646,7 +656,7 @@ void BurnData::slotsCleanFiles(bool b) { if (b) { - QScopedPointer p(new TipsChange); + QScopedPointer p(new TipsChange(this)); // if(p->question(_("Clean"), _("Clean all item(s) under %1?") // .arg(ui->treeView->rootIndex().data().toString()))){ if(p->question(_("Clean"), _("Clean all file(s)?"))){ @@ -670,7 +680,9 @@ void BurnData::slotsNewFolder(bool b) { do { - InputChange inputchange; + InputChange inputchange(this); + KWindowSystem::setState(inputchange.winId(), NET::SkipPager | NET::SkipSwitcher); + inputchange.move(MainWindow::Instance()->geometry().center()-inputchange.geometry().center()); inputed = inputchange.input(folderName, _("NewFolder"), _("Please input new folder name."), _("NewFolder")); if (!inputed) break; ui->btnNewFolder->setChecked(false); diff --git a/src/view/burndata.h b/src/view/burndata.h index bbb620b..0058af5 100644 --- a/src/view/burndata.h +++ b/src/view/burndata.h @@ -93,6 +93,7 @@ private: QList m_oLinks; QModelIndexList m_oIndexes; QPoint m_oPosition; + InputChange *inputchange; private: Ui::BurnData *ui; signals: diff --git a/src/view/burnimage.cpp b/src/view/burnimage.cpp index 2b3a27f..c54692e 100644 --- a/src/view/burnimage.cpp +++ b/src/view/burnimage.cpp @@ -12,6 +12,8 @@ #include #include #include +#include +#include BurnImage *BurnImage::m_oInstance = nullptr; QMutex BurnImage::m_oMutex; @@ -164,7 +166,7 @@ void BurnImage::slotsBrowseISO() { QString path; QString isoPath; - QFileDialog fd; + QFileDialog fd(this); QList list = fd.sidebarUrls(); int sidebarNum = 8;//最大添加U盘数,可以自己定义 QString home = QDir::homePath().section("/", -1, -1); @@ -214,6 +216,9 @@ void BurnImage::slotsBrowseISO() fd.setFileMode(QFileDialog::ExistingFiles); fd.setNameFilter("ISO(*.iso)"); fd.setSidebarUrls(list + mntUrlList); + kdk::UkuiStyleHelper::self()->removeHeader(&fd); + fd.move(this->geometry().center()-fd.geometry().center()); + kdk::WindowManager::setGeometry(fd.windowHandle(),fd.geometry()); if (fd.exec() != QDialog::Accepted) return; isoPath = fd.selectedFiles().at(0); if (isoPath.isEmpty()) return; diff --git a/src/view/busnesssetting.cpp b/src/view/busnesssetting.cpp index b2c2861..60fe8a4 100755 --- a/src/view/busnesssetting.cpp +++ b/src/view/busnesssetting.cpp @@ -17,6 +17,7 @@ #include #include #include +#include BusnessSetting::BusnessSetting(QWidget *parent) : QWidget(parent), @@ -510,12 +511,13 @@ void BusnessSetting::initTempPathLineEdit() searchLayout->addWidget(buttonBrowse); searchLayout->setAlignment(Qt::AlignRight | Qt::AlignVCenter); connect(buttonBrowse, &IConLabel::clicked, this, [=]() { - MultiSelectionFileDialog selectPathDialog; + MultiSelectionFileDialog selectPathDialog(this); selectPathDialog.setExtendedSelection(); selectPathDialog.setDirectory(QDir::currentPath()); selectPathDialog.setFileMode(QFileDialog::DirectoryOnly); selectPathDialog.setWindowTitle(_("Please select a path")); selectPathDialog.setWindowIcon(QIcon::fromTheme("burner")); + kdk::UkuiStyleHelper::self()->removeHeader(&selectPathDialog); if (selectPathDialog.exec()) { QStringList selectFiles = selectPathDialog.selectedFiles(); if (!selectFiles.isEmpty()) { diff --git a/src/view/copyimage.cpp b/src/view/copyimage.cpp index c4a30be..13e7daf 100644 --- a/src/view/copyimage.cpp +++ b/src/view/copyimage.cpp @@ -8,10 +8,14 @@ #include "src/model/menufactory.h" #include "src/data/datacdrom.h" #include "src/view/execdialog.h" +#include "src/view/mainwindow.h" #include #include #include +#include +#include +using namespace kdk; CopyImage *CopyImage::m_oInstance = nullptr; QMutex CopyImage::m_oMutex; @@ -204,7 +208,7 @@ void CopyImage::slotsButtonClick() return; } - QFileDialog fd; + QFileDialog fd(this); QList list = fd.sidebarUrls(); int sidebarNum = 8;//最大添加U盘数,可以自己定义 QString home = QDir::homePath().section("/", -1, -1); @@ -249,6 +253,9 @@ void CopyImage::slotsButtonClick() fd.setFileMode(QFileDialog::DirectoryOnly); fd.setSidebarUrls(list + mntUrlList); + kdk::UkuiStyleHelper::self()->removeHeader(&fd); + fd.move(this->geometry().center()-fd.geometry().center()); + kdk::WindowManager::setGeometry(fd.windowHandle(),fd.geometry()); if (fd.exec() != QDialog::Accepted) return; path = fd.selectedFiles().at(0); diff --git a/src/view/diskcheck.cpp b/src/view/diskcheck.cpp index 87255a9..25c7c6d 100755 --- a/src/view/diskcheck.cpp +++ b/src/view/diskcheck.cpp @@ -1,4 +1,5 @@ #include "diskcheck.h" +#include "mainwindow.h" #include "ui_diskcheck.h" #include "src/data/datacdrom.h" #include "src/model/logicmain.h" @@ -8,6 +9,8 @@ #include #include #include +#include +#include DiskCheck::DiskCheck(QWidget *parent) : QWidget(parent), @@ -130,7 +133,7 @@ void DiskCheck::slotsChangeMedium(int idx) void DiskCheck::slotsBrowseFile() { QString file; - QFileDialog fd; + QFileDialog fd(this); QList list = fd.sidebarUrls(); int sidebarNum = 8;//最大添加U盘数,可以自己定义 QString home = QDir::homePath().section("/", -1, -1); @@ -175,6 +178,9 @@ void DiskCheck::slotsBrowseFile() fd.setFileMode(QFileDialog::ExistingFile); fd.setSidebarUrls(list + mntUrlList); + kdk::UkuiStyleHelper::self()->removeHeader(&fd); + fd.move(this->geometry().center()-fd.geometry().center()); + kdk::WindowManager::setGeometry(fd.windowHandle(),fd.geometry()); if (fd.exec() != QDialog::Accepted) return; file = fd.selectedFiles().at(0); diff --git a/src/view/execdialog.cpp b/src/view/execdialog.cpp index e0553ec..d25000b 100644 --- a/src/view/execdialog.cpp +++ b/src/view/execdialog.cpp @@ -1,4 +1,5 @@ #include "execdialog.h" +#include "mainwindow.h" #include "ui_execdialog.h" #include "src/frame/xatom-helper.h" #include "src/frame/configuration.h" @@ -8,7 +9,6 @@ #include #include #include -using namespace kdk; ExecDialog *ExecDialog::m_oInstance = nullptr; QMutex ExecDialog::m_oMutex; @@ -61,7 +61,7 @@ ExecDialog *ExecDialog::instance() QMutexLocker locker(&m_oMutex); if (nullptr == m_oInstance) { - m_oInstance = new ExecDialog(); + m_oInstance = new ExecDialog(MainWindow::Instance()); } } diff --git a/src/view/filefilterrules.cpp b/src/view/filefilterrules.cpp index 673c4fd..a95e8fc 100755 --- a/src/view/filefilterrules.cpp +++ b/src/view/filefilterrules.cpp @@ -1,4 +1,6 @@ +#include "burndata.h" #include "filefilterrules.h" +#include "mainwindow.h" #include "ui_filefilterrules.h" #include "src/frame/xatom-helper.h" #include "src/frame/logger.h" @@ -10,6 +12,8 @@ #include #include #include +#include +#include using namespace kdk; FileFilterRules *FileFilterRules::m_oInstance = nullptr; @@ -33,6 +37,7 @@ FileFilterRules::FileFilterRules(QWidget *parent) : hints.decorations = MWM_DECOR_BORDER; XAtomHelper::getInstance()->setWindowMotifHint(winId(), hints); } +// setAttribute(Qt::WA_ShowModal, true); ui->title->onlyShowInDialog(); connect(ui->title, SIGNAL(close()), this, SLOT(slotclose())); connect(this, SIGNAL(windowIconChanged(QIcon)), ui->title, SLOT(onWindowIconChange(QIcon))); @@ -123,11 +128,14 @@ void FileFilterRules::init(void *data) void FileFilterRules::show() { - move(m_oPosition); +// move(m_oPosition); if(m_bIsWayland) { kdk::UkuiStyleHelper::self()->removeHeader(this); + }else{ + QPoint position = MainWindow::Instance()->frameGeometry().topLeft(); + move(position.x()+(MainWindow::Instance()->width()-width())/2, position.y()+(MainWindow::Instance()->height()-height())/2); + kdk::WindowManager::setGeometry(windowHandle(),geometry()); } -// QDialog::show(); QDialog::exec(); } diff --git a/src/view/inputchange.cpp b/src/view/inputchange.cpp index fabc8af..98d59f2 100644 --- a/src/view/inputchange.cpp +++ b/src/view/inputchange.cpp @@ -17,6 +17,8 @@ InputChange::InputChange(QWidget *parent) : ui(new Ui::InputChange) { ui->setupUi(this); + setModal(true); + kdk::UkuiStyleHelper::self()->removeHeader(this); //判断是否是wayland环境 if(QString(qgetenv("XDG_SESSION_TYPE")) == "wayland") { diff --git a/src/view/kybaboutdialog.cpp b/src/view/kybaboutdialog.cpp index 435082e..ac57a93 100644 --- a/src/view/kybaboutdialog.cpp +++ b/src/view/kybaboutdialog.cpp @@ -9,6 +9,7 @@ #include #include #include +#include KYBAboutDialog *KYBAboutDialog::m_oInstance = nullptr; QMutex KYBAboutDialog::m_oMutex; @@ -23,6 +24,7 @@ KYBAboutDialog::KYBAboutDialog(QWidget *parent) : // ui(new Ui::KYBAboutDialog) { // ui->setupUi(this); + kdk::UkuiStyleHelper::self()->removeHeader(this); setAppIcon(QIcon::fromTheme("burner")); setAppName(_("KylinBurner")); setAppVersion(_("Version:") + VERSION); @@ -88,13 +90,13 @@ KYBAboutDialog::KYBAboutDialog(QWidget *parent) : //#endif } -KYBAboutDialog *KYBAboutDialog::instance() +KYBAboutDialog *KYBAboutDialog::instance(QWidget *parent) { if (nullptr == m_oInstance) { QMutexLocker locker(&m_oMutex); if (nullptr == m_oInstance) - m_oInstance = new KYBAboutDialog(); + m_oInstance = new KYBAboutDialog(parent); } return m_oInstance; } diff --git a/src/view/kybaboutdialog.h b/src/view/kybaboutdialog.h index 2b630bb..1e7dc47 100644 --- a/src/view/kybaboutdialog.h +++ b/src/view/kybaboutdialog.h @@ -12,7 +12,7 @@ class KYBAboutDialog : public kdk::KAboutDialog { Q_OBJECT public: - static KYBAboutDialog *instance(); + static KYBAboutDialog *instance(QWidget *parent = nullptr); public: void init(){} void destroy() { delete this; } diff --git a/src/view/mainwindow.cpp b/src/view/mainwindow.cpp index 9314792..a75316b 100755 --- a/src/view/mainwindow.cpp +++ b/src/view/mainwindow.cpp @@ -37,10 +37,13 @@ #include #include #include +#include +#include using namespace kdk; #define ICON_SIZE QSize(26, 26) - +MainWindow *MainWindow::m_mainWindow = nullptr; +QMutex MainWindow::m_oMutex; MainWindow::MainWindow(QStringList args, QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) @@ -65,6 +68,12 @@ MainWindow::MainWindow(QStringList args, QWidget *parent) m_isTabletMode = false; } + connect(kdk::WindowManager::self(), &kdk::WindowManager::windowAdded, this, [=](const kdk::WindowId& window_id){ + if (getpid() == kdk::WindowManager::getPid(window_id) && m_window_id == 0) + { + m_window_id = window_id.toULongLong(); + } + }); //切换模式 QDBusConnection::sessionBus().connect(QString("com.kylin.statusmanager.interface"), QString("/"), @@ -168,6 +177,7 @@ MainWindow::MainWindow(QStringList args, QWidget *parent) connect(this, SIGNAL(windowTitleChanged(QString)), ui->navTitle, SLOT(onWindowTitleChange(QString))); connect(this, SIGNAL(windowIconChanged(QIcon)), ui->burnerTitle, SLOT(onWindowIconChange(QIcon))); connect(this, SIGNAL(windowTitleChanged(QString)), ui->burnerTitle, SLOT(onWindowTitleChange(QString))); + //navTitle is unused. connect(ui->navTitle, SIGNAL(close()), this, SLOT(close())); connect(ui->navTitle, SIGNAL(min()), this, SLOT(showMinimized())); connect(ui->navTitle, &WindowTitle::max, [=](){ @@ -192,7 +202,7 @@ MainWindow::MainWindow(QStringList args, QWidget *parent) } else { - showMaximized(); + kdk::WindowManager::maximizeWindow(m_window_id); ui->burnerTitle->onWindowShowMaxed(true); } }); @@ -310,15 +320,26 @@ MainWindow::MainWindow(QStringList args, QWidget *parent) emit ui->btnBurnData->click(); } - p.setX(pos().x() + width() / 2); - p.setY(pos().y() + height() / 2); +// p.setX(pos().x() + width() / 2); +// p.setY(pos().y() + height() / 2); - move(p); +// move(p); m_mapStartTime[0] = QDateTime::currentMSecsSinceEpoch(); - ABOUT->close(); +// ABOUT->close(); //emit position(p); } +MainWindow *MainWindow::Instance(QStringList args, QWidget *parent) +{ + if(NULL == m_mainWindow){ + QMutexLocker locker(&m_oMutex); + if(NULL == m_mainWindow){ + m_mainWindow = new MainWindow(args, parent); + } + } + return m_mainWindow; +} + void MainWindow::closeEvent(QCloseEvent *event) { calculatorTime(m_current_page); @@ -352,9 +373,9 @@ void MainWindow::moveEvent(QMoveEvent *event) PAGE_BurnData->updatePosition(p); TIP_BURNRESULT->updatePosition(p); - sp.setX(p.x() - EXEC->width() / 2); - sp.setY(p.y() - EXEC->height() / 2); - EXEC->move(sp); +// sp.setX(p.x() - EXEC->width() / 2); +// sp.setY(p.y() - EXEC->height() / 2); +// EXEC->move(sp); //emit position(sp); @@ -621,7 +642,7 @@ void MainWindow::slotsBrowseOrSetting(bool b) { QString path; QString testPath; - QFileDialog fd; + QFileDialog fd(this); QList list = fd.sidebarUrls(); int sidebarNum = 8;//最大添加U盘数,可以自己定义 QString home = QDir::homePath().section("/", -1, -1); @@ -667,6 +688,9 @@ void MainWindow::slotsBrowseOrSetting(bool b) //fd.setNameFilter(_("Forlder")); fd.setFileMode(QFileDialog::DirectoryOnly); fd.setSidebarUrls(list + mntUrlList); + kdk::UkuiStyleHelper::self()->removeHeader(&fd); + fd.move(BurnData::instance()->geometry().center()-fd.geometry().center()); + kdk::WindowManager::setGeometry(fd.windowHandle(),fd.geometry()); if (/*!path.isEmpty()*/ fd.exec() == QDialog::Accepted) { @@ -849,6 +873,7 @@ MainWindow::~MainWindow() TIP_BURNRESULT->destroy(); LOGGER->destroy(); CFG->destroy(); + ABOUT->destroy(); delete ui; } @@ -1004,7 +1029,9 @@ void MainWindow::keyPressEvent(QKeyEvent *event) if(event->key() == Qt::Key_F10) { //关于界面 + kdk::UkuiStyleHelper::self()->removeHeader(ABOUT); ABOUT->show(); + kdk::WindowManager::setGeometry(ABOUT->windowHandle(),QRect(this->frameGeometry().center()-ABOUT->rect().center(),QSize(ABOUT->size()))); return; } diff --git a/src/view/mainwindow.h b/src/view/mainwindow.h index 6532175..cdc924a 100644 --- a/src/view/mainwindow.h +++ b/src/view/mainwindow.h @@ -10,6 +10,7 @@ #include #include #include +#include using namespace kdk; const QByteArray TRANSPARENT_SCHEMAS = "org.ukui.control-center.personalise"; @@ -36,6 +37,7 @@ signals: void delData(int); public: MainWindow(QStringList args, QWidget *parent = nullptr); + static MainWindow* Instance(QStringList args = QStringList(), QWidget *parent = nullptr); ~MainWindow(); protected: void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE; @@ -76,8 +78,11 @@ private: QStandardItem *m_copyImageItem; KNavigationBar *m_NavBar; QDBusMessage msg; + static MainWindow *m_mainWindow; + static QMutex m_oMutex; bool m_isTabletMode; int m_current_page = 0; + quint64 m_window_id; std::map m_mapStartTime = { {0, 0}, {1, 0}, diff --git a/src/view/modaldialog.cpp b/src/view/modaldialog.cpp index 04bb955..f89cc3a 100755 --- a/src/view/modaldialog.cpp +++ b/src/view/modaldialog.cpp @@ -10,6 +10,9 @@ #include #include #include +#include "src/view/mainwindow.h" +#include +#include using namespace kdk; ModalDialog *ModalDialog::m_oInstance = nullptr; @@ -155,38 +158,14 @@ void ModalDialog::updatePosition(QPoint p) void ModalDialog::show() { - QPoint sp; - switch (ui->showPage->currentIndex()) - { - case Progress: - //setFixedSize(450, 230); - sp.setX(m_oMainPos.x()-225); - sp.setY(m_oMainPos.y()-115); - break; - case Tip: - //setFixedSize(450, 230); - sp.setX(m_oMainPos.x()-225); - sp.setY(m_oMainPos.y()-115); - break; - case BusnessSetting: - //setFixedSize(450, 530); - sp.setX(m_oMainPos.x()-225); - sp.setY(m_oMainPos.y()-265); - break; - case DataSetting: - //setFixedSize(450, 300); - sp.setX(m_oMainPos.x()-225); - sp.setY(m_oMainPos.y()-150); - break; - case DiskCheck: - //setFixedSize(450, 300); - sp.setX(m_oMainPos.x()-225); - sp.setY(m_oMainPos.y()-150); - } - move(sp); if (this->isWayland()) kdk::UkuiStyleHelper::self()->removeHeader(this); QDialog::show(); + if(!this->isWayland()){ + QPoint position = MainWindow::Instance()->frameGeometry().topLeft(); + move(position.x()+(MainWindow::Instance()->width()-width())/2, position.y()+(MainWindow::Instance()->height()-height())/2); + kdk::WindowManager::setGeometry(windowHandle(),geometry()); + } } void ModalDialog::paintEvent(QPaintEvent *event) diff --git a/src/view/modaldialog.ui b/src/view/modaldialog.ui index f92250c..ba945f0 100755 --- a/src/view/modaldialog.ui +++ b/src/view/modaldialog.ui @@ -19,6 +19,9 @@ Dialog + + true + 0 diff --git a/src/view/multiselectfiledialog.cpp b/src/view/multiselectfiledialog.cpp index 8f7a066..bf52f73 100644 --- a/src/view/multiselectfiledialog.cpp +++ b/src/view/multiselectfiledialog.cpp @@ -1,9 +1,11 @@ #include "multiselectfiledialog.h" +#include MultiSelectFileDialog::MultiSelectFileDialog(QWidget *parent) : QFileDialog(parent) { + kdk::UkuiStyleHelper::self()->removeHeader(this); } diff --git a/src/view/multiselectionfiledialog.cpp b/src/view/multiselectionfiledialog.cpp index 59dc380..efa986b 100644 --- a/src/view/multiselectionfiledialog.cpp +++ b/src/view/multiselectionfiledialog.cpp @@ -1,6 +1,7 @@ #include "multiselectionfiledialog.h" #include +#include MultiSelectionFileDialog::MultiSelectionFileDialog(QWidget *parent, const QString &caption, @@ -8,6 +9,7 @@ MultiSelectionFileDialog::MultiSelectionFileDialog(QWidget *parent, const QString filter) : QFileDialog(parent, caption, directory, filter) { + kdk::UkuiStyleHelper::self()->removeHeader(this); m_oListView = findChild("listView"); m_oTreeView = findChild(); QDialogButtonBox *btn = findChild("buttonBox"); diff --git a/src/view/tip_burnresult.cpp b/src/view/tip_burnresult.cpp index 394304b..15c1afd 100644 --- a/src/view/tip_burnresult.cpp +++ b/src/view/tip_burnresult.cpp @@ -3,6 +3,7 @@ #include "src/frame/xatom-helper.h" #include "src/po/translation.h" #include "src/model/logicmain.h" +#include #include #include @@ -36,7 +37,7 @@ Tip_BurnResult::Tip_BurnResult(QWidget *parent) : XAtomHelper::getInstance()->setWindowMotifHint(winId(), hints); } - //setAttribute(Qt::WA_ShowModal, true); + setAttribute(Qt::WA_ShowModal, true); ui->buttonBox->setStandardButtons(QDialogButtonBox::Ok); @@ -88,7 +89,7 @@ void Tip_BurnResult::updatePosition(QPoint p) sp.setX(p.x()-225); sp.setY(p.y()-115); - move(sp); +// move(sp); } void Tip_BurnResult::slotsSuccess(QString name) @@ -108,6 +109,8 @@ void Tip_BurnResult::slotsSuccess(QString name) this->raise();//控件置顶 if (m_bIsWayland) kdk::UkuiStyleHelper::self()->removeHeader(this); + move(MainWindow::Instance()->frameGeometry().center() - this->rect().center()); +// kdk::WindowManager::setGeometry(windowHandle(),geometry()); this->exec();//控件显示 } @@ -130,6 +133,7 @@ void Tip_BurnResult::slotsFailed(QString name) this->raise();//控件置顶 if (m_bIsWayland) kdk::UkuiStyleHelper::self()->removeHeader(this); + move(MainWindow::Instance()->frameGeometry().center() - this->rect().center()); this->exec();//控件显示 } diff --git a/src/view/tip_burnresult.h b/src/view/tip_burnresult.h index 313671e..617c41c 100644 --- a/src/view/tip_burnresult.h +++ b/src/view/tip_burnresult.h @@ -4,6 +4,7 @@ #include #include #include +#include "src/view/mainwindow.h" namespace Ui { class Tip_BurnResult; diff --git a/src/view/tip_burnresult.ui b/src/view/tip_burnresult.ui index 362faba..12d1dea 100755 --- a/src/view/tip_burnresult.ui +++ b/src/view/tip_burnresult.ui @@ -3,7 +3,7 @@ Tip_BurnResult - Qt::NonModal + Qt::WindowModal true diff --git a/src/view/viewfilterfiles.cpp b/src/view/viewfilterfiles.cpp index fd4799a..8b9e4e7 100755 --- a/src/view/viewfilterfiles.cpp +++ b/src/view/viewfilterfiles.cpp @@ -1,5 +1,6 @@ #include "viewfilterfiles.h" #include "ui_viewfilterfiles.h" +#include "mainwindow.h" #include "src/frame/signals.h" #include "src/frame/xatom-helper.h" #include "src/frame/logger.h" @@ -11,6 +12,8 @@ #include "src/view/filefilterrules.h" #include #include +#include +#include using namespace kdk; ViewFilterFiles *ViewFilterFiles::m_oInstance = nullptr; @@ -155,10 +158,14 @@ void ViewFilterFiles::show() idx = ui->comboBox->currentIndex(); if (idx >= 0) updateIndex(idx); - move(m_oPosition); - if(m_bIsWayland) +// move(m_oPosition); + if(m_bIsWayland){ kdk::UkuiStyleHelper::self()->removeHeader(this); -// QDialog::show(); + }else{ + QPoint position = MainWindow::Instance()->frameGeometry().topLeft(); + move(position.x()+(MainWindow::Instance()->width()-width())/2, position.y()+(MainWindow::Instance()->height()-height())/2); + kdk::WindowManager::setGeometry(windowHandle(),geometry()); + } QDialog::exec(); } -- Gitee From 595a804c65fb8d4fdc0d2cdbb02164d7478dc4c6 Mon Sep 17 00:00:00 2001 From: zhoudisi Date: Sun, 31 Mar 2024 21:00:21 +0800 Subject: [PATCH 2/2] update changelog Signed-off-by: zhoudisi --- debian/changelog | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/debian/changelog b/debian/changelog index b2febdb..c5c8391 100755 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +kylin-burner (3.2.0.1kylin1k32.01-ok15) nile; urgency=medium + + * BUG: 无 + * 需求号: 无 + * 其他改动说明: TASK:#205195 子 【百日攻关】【图形栈合成渲染技术】UKUI应用适配 / 【百日攻关】【图形栈合成渲染技术】UKUI应用适配 - 刻录 + * 其他改动影响域: 无 + + -- zhoudisi Sun, 31 Mar 2024 20:59:09 +0800 + kylin-burner (3.2.0.1kylin1k32.01-ok14) nile; urgency=medium * BUG: #无 -- Gitee