From a416a0d658f3517bcccdfd819f19a8fc93bad9d1 Mon Sep 17 00:00:00 2001 From: dou33 Date: Sat, 11 Dec 2021 10:31:40 +0800 Subject: [PATCH] fix min window logic --- fix-bug-min-window-logic.patch | 133 +++++++++++++++++++++++++++++++++ kylin-usb-creator.spec | 7 +- 2 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 fix-bug-min-window-logic.patch diff --git a/fix-bug-min-window-logic.patch b/fix-bug-min-window-logic.patch new file mode 100644 index 0000000..c3cf096 --- /dev/null +++ b/fix-bug-min-window-logic.patch @@ -0,0 +1,133 @@ +diff -Naur kylin-usb-creator-1.0.0/debian/changelog kylin-usb-creator-1.0.0~/debian/changelog +--- kylin-usb-creator-1.0.0/debian/changelog 2021-12-09 14:37:53.464467473 +0800 ++++ kylin-usb-creator-1.0.0~/debian/changelog 2021-12-09 15:20:44.713299353 +0800 +@@ -1,3 +1,9 @@ ++kylin-usb-creator (1.0.0-27kord) v101; urgency=medium ++ ++ * 解决了BUG#24046 程序正在运行且处于最小化状态时,可以通过点击菜单栏图标拉起 ++ ++ -- shixiaoshuo Mon, 30 Nov 2020 15:38:52 +0800 ++ + kylin-usb-creator (1.0.0-26kord) v101; urgency=medium + + * 移除程序外部透明顶级窗口,改为主题接管状态栏样式及阴影圆角 +diff -Naur kylin-usb-creator-1.0.0/src/main.cpp kylin-usb-creator-1.0.0~/src/main.cpp +--- kylin-usb-creator-1.0.0/src/main.cpp 2021-12-09 14:37:53.464467473 +0800 ++++ kylin-usb-creator-1.0.0~/src/main.cpp 2021-12-09 15:20:46.315571642 +0800 +@@ -20,7 +20,6 @@ + if(QGSettings::isSchemaInstalled(APPDATA)) + { + QGSettings *p = new QGSettings(APPDATA); +-// p->get() + qDebug()<<"main.cpp activeMainwindow value:"<get("mode").toString(); + p->set("mode","stat4"); + qDebug()<<"main.cpp after set value:"<get("mode").toString(); +@@ -74,14 +73,14 @@ + + + if(a.isRunning()){ +-// a.sendMessage(nullptr); +- activeMainwindow(); ++ a.sendMessage(QApplication::arguments().length() > 1 ? QApplication::arguments().at(0):a.applicationFilePath()); + qDebug()<<"#### kylin-usb-creator is already running"; + return EXIT_SUCCESS; + }else { + MainWindow w; ++ a.setActiveWindow(&w); + w.show(); +-// QObject::connect(&a,SIGNAL(messageReceived(const QString&)),&w,SLOT(handleIconClickedSub(const QString&))); ++ QObject::connect(&a,SIGNAL(messageReceived(const QString&)),&w,SLOT(handleIconClickedSub())); + return a.exec(); + } + a.setWindowIcon(QIcon(":data/logo/96.png")); +diff -Naur kylin-usb-creator-1.0.0/src/mainwindow.cpp kylin-usb-creator-1.0.0~/src/mainwindow.cpp +--- kylin-usb-creator-1.0.0/src/mainwindow.cpp 2021-12-09 14:37:53.465550821 +0800 ++++ kylin-usb-creator-1.0.0~/src/mainwindow.cpp 2021-12-09 15:20:46.272237706 +0800 +@@ -161,11 +161,21 @@ + } + void MainWindow::handleIconClickedSub() + { +- QRect availableGeometry = qApp->primaryScreen()->availableGeometry(); +- this->move((availableGeometry.width() - this->width())/2, (availableGeometry.height() - this->height())/2); +- this->showNormal(); +- this->raise(); +- this->activateWindow(); ++ qDebug()<<"handleIconClickedSub"; ++// QRect availableGeometry = qApp->primaryScreen()->availableGeometry(); ++// this->move((availableGeometry.width() - this->width())/2, (availableGeometry.height() - this->height())/2); ++// this->showNormal(); ++ ++ Qt::WindowFlags flags = windowFlags(); ++ flags |= Qt::WindowStaysOnTopHint; ++ setWindowFlags(flags); ++ show(); ++ flags &= ~Qt::WindowStaysOnTopHint; ++ setWindowFlags(flags); ++ showNormal(); ++ ++// this->raise(); ++// this->activateWindow(); + + } + +diff -Naur kylin-usb-creator-1.0.0/src/mainwindow.h kylin-usb-creator-1.0.0~/src/mainwindow.h +--- kylin-usb-creator-1.0.0/src/mainwindow.h 2021-12-09 14:37:53.465550821 +0800 ++++ kylin-usb-creator-1.0.0~/src/mainwindow.h 2021-12-09 15:20:46.250570738 +0800 +@@ -33,7 +33,7 @@ + void makeStart(); //点击授权按钮后由页面1跳转到页面2 + void makeFinish(); + void returnMain(); +-// void handleIconClickedSub(const QString&); ++ void handleIconClickedSub(); + // void passwdCheck(); + private: + void init(); //初始化mainwindow相关的设置 +@@ -44,7 +44,7 @@ + void initGsetting(); + void setThemeStyle(); + +- void handleIconClickedSub(); ++// void handleIconClickedSub(); + QTimer *dbustimer = nullptr; + QStackedWidget *stackedWidget= nullptr; + //页面小圆点 +diff -Naur kylin-usb-creator-1.0.0/src/qtsingleapplication.cpp kylin-usb-creator-1.0.0~/src/qtsingleapplication.cpp +--- kylin-usb-creator-1.0.0/src/qtsingleapplication.cpp 2021-12-09 14:37:53.467717517 +0800 ++++ kylin-usb-creator-1.0.0~/src/qtsingleapplication.cpp 2021-12-09 15:20:46.276571099 +0800 +@@ -284,13 +284,13 @@ + \sa activateWindow(), messageReceived() + */ + +-void QtSingleApplication::setActivationWindow(QWidget* aw, bool activateOnMessage) ++void QtSingleApplication::setActivationWindow(MainWindow* aw, bool activateOnMessage) + { + actWin = aw; + if (activateOnMessage) + connect(peer, SIGNAL(messageReceived(const QString&)), this, SLOT(activateWindow())); +- else +- disconnect(peer, SIGNAL(messageReceived(const QString&)), this, SLOT(activateWindow())); ++// else ++// disconnect(peer, SIGNAL(messageReceived(const QString&)), this, SLOT(activateWindow())); + } + + +diff -Naur kylin-usb-creator-1.0.0/src/qtsingleapplication.h kylin-usb-creator-1.0.0~/src/qtsingleapplication.h +--- kylin-usb-creator-1.0.0/src/qtsingleapplication.h 2021-12-09 14:37:53.467717517 +0800 ++++ kylin-usb-creator-1.0.0~/src/qtsingleapplication.h 2021-12-09 15:20:46.244070647 +0800 +@@ -41,6 +41,7 @@ + #ifndef QTSINGLEAPPLICATION_H + #define QTSINGLEAPPLICATION_H + ++#include "mainwindow.h" + #include + + class QtLocalPeer; +@@ -80,7 +81,7 @@ + bool isRunning(); + QString id() const; + +- void setActivationWindow(QWidget* aw, bool activateOnMessage = true); ++ void setActivationWindow(MainWindow* aw, bool activateOnMessage = true); + QWidget* activationWindow() const; + + // Obsolete: diff --git a/kylin-usb-creator.spec b/kylin-usb-creator.spec index 10c9a03..6e1e9ec 100644 --- a/kylin-usb-creator.spec +++ b/kylin-usb-creator.spec @@ -1,13 +1,14 @@ %define debug_package %{nil} Name: kylin-usb-creator Version: 1.0.0 -Release: 2 +Release: 3 Summary: kylin-usb-creator License: GPL-3+ URL: http://www.ukui.org Source0: %{name}-%{version}.tar.gz patch0: 0001-add-dbus-service.patch +patch1: fix-bug-min-window-logic.patch BuildRequires: qt5-qttools-devel BuildRequires: qt5-qtscript-devel @@ -24,6 +25,7 @@ BuildRequires: gsettings-qt-devel %prep %setup -q %patch0 -p1 +%patch1 -p1 %build %{qmake_qt5} %{_qt5_qmake_flags} CONFIG+=enable-by-default kylin-usb-creator.pro @@ -50,6 +52,9 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/pixmaps/kylin-usb-creator.png %changelog +* Fri Dec 10 2021 douyan - 1.0.0-3 +- fix min window logic + * Wed Dec 8 2021 douyan - 1.0.0-2 - add dbus service