From f50a707c9e2d55a28adb22bc50d4343a94153928 Mon Sep 17 00:00:00 2001 From: lixueman <915764118@qq.com> Date: Sun, 19 Jun 2022 07:53:00 +0800 Subject: [PATCH 1/9] =?UTF-8?q?3.20wayland=E4=BD=8D=E7=BD=AE=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 86 ----- README.md | 34 +- main.cpp | 46 ++- res.qrc | 2 +- .../BuriedPoint/buriedpointdatasend.cpp | 78 ++++ .../BuriedPoint/buriedpointdatasend.h | 29 ++ .../tablet_directorychanged_thread.cpp | 12 +- .../Interface/ukui_chineseletter.cpp | 2 +- .../Interface/ukuimenuinterface.cpp | 18 +- src/BackProcess/backprocess.pri | 13 +- src/BackProcess/tablet/getmodeldata.cpp | 24 +- src/BackProcess/tablet/getmodeldata.h | 5 + src/BackProcess/tablet/pagemanager.cpp | 35 +- src/BackProcess/tablet/pagemanager.h | 4 +- .../Button/function_classify_button.cpp | 18 +- .../Button/letter_classify_button.cpp | 30 +- src/UserInterface/ListView/listview.cpp | 17 +- src/UserInterface/ListView/rightlistview.cpp | 18 +- src/UserInterface/ListView/rightlistview.h | 5 +- src/UserInterface/Other/rotationlabel.cpp | 38 ++ src/UserInterface/Other/rotationlabel.h | 21 + src/UserInterface/RightClickMenu/menubox.cpp | 6 + src/UserInterface/RightClickMenu/menubox.h | 1 + .../RightClickMenu/tabletrightclickmenu.cpp | 31 +- .../RightClickMenu/tabletrightclickmenu.h | 6 - src/UserInterface/ViewItem/itemdelegate.cpp | 33 +- .../ViewItem/right_item_delegate.cpp | 21 +- .../ViewItem/tablet_full_itemdelegate.cpp | 29 +- .../Widget/full_commonuse_widget.cpp | 17 + .../Widget/full_function_widget.cpp | 17 + .../Widget/full_letter_widget.cpp | 17 + .../Widget/full_searchresult_widget.cpp | 17 + src/UserInterface/Widget/function_Widget.cpp | 31 +- src/UserInterface/Widget/function_Widget.h | 1 - .../Widget/function_button_widget.cpp | 3 +- .../Widget/letter_button_widget.cpp | 13 +- src/UserInterface/Widget/main_view_widget.cpp | 20 +- src/UserInterface/Widget/main_view_widget.h | 4 + src/UserInterface/full_mainwindow.cpp | 29 +- src/UserInterface/mainwindow.cpp | 359 ++++++++++++++---- src/UserInterface/mainwindow.h | 18 +- src/UserInterface/tabletwindow.cpp | 183 ++++----- src/UserInterface/tabletwindow.h | 7 +- src/UserInterface/userinterface.pri | 2 + src/UtilityFunction/Style/style.cpp | 44 ++- src/UtilityFunction/Style/style.h | 7 + src/UtilityFunction/abstractInterface.h | 23 +- src/UtilityFunction/utility.cpp | 25 ++ src/UtilityFunction/utility.h | 25 +- translations/ukui-menu_bo.ts | 81 ++-- translations/ukui-menu_tr.ts | 81 ++-- translations/ukui-menu_zh_CN.ts | 81 ++-- ukui-menu.pro | 6 +- 53 files changed, 1224 insertions(+), 549 deletions(-) delete mode 100755 .github/workflows/build.yml create mode 100644 src/BackProcess/BuriedPoint/buriedpointdatasend.cpp create mode 100644 src/BackProcess/BuriedPoint/buriedpointdatasend.h create mode 100644 src/UserInterface/Other/rotationlabel.cpp create mode 100644 src/UserInterface/Other/rotationlabel.h diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100755 index d63f007..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,86 +0,0 @@ -name: Check build - -on: - push: - branches: - - master - - pull_request: - branches: - - master - - schedule: - - cron: '0 0 * * *' - -jobs: - archlinux: - name: on Archlinux - runs-on: ubuntu-20.04 - container: docker.io/library/archlinux:latest - steps: - - name: Checkout ukui-menu source code - uses: actions/checkout@v2 - - name: Refresh pacman repository - run: pacman -Sy - - name: Install build dependencies - run: pacman -S --noconfirm base-devel qt5-base bamf gsettings-qt qt5-svg qt5-x11extras qt5-tools kwindowsystem - - name: QMake configure & Make - run: | - mkdir build; - cd build; - qmake-qt5 ..; - make -j$(nproc); - debian: - name: on Debian Sid - runs-on: ubuntu-20.04 - container: docker.io/library/debian:sid - env: - DEBIAN_FRONTEND: noninteractive - steps: - - name: Checkout ukui-menu source code - uses: actions/checkout@v2 - - name: Update apt repository - run: apt-get update -y - - name: Install build dependcies - run: apt-get install -y build-essential qt5-default qttools5-dev-tools debhelper-compat qtbase5-dev libqt5svg5-dev libglib2.0-dev libgsettings-qt-dev libbamf3-dev libxrandr-dev libxtst-dev libx11-dev libqt5x11extras5-dev libkf5windowsystem-dev - - name: QMake configure & Make - run: | - mkdir build; - cd build; - qmake ..; - make -j$(nproc); - - fedora: - name: on Fedora 32 - runs-on: ubuntu-20.04 - container: docker.io/library/fedora:32 - steps: - - name: Checkout ukui-menu source code - uses: actions/checkout@v2 - - name: Install build dependencies - run: dnf install -y which gcc gcc-c++ make cmake cmake-rpm-macros autoconf automake intltool rpm-build qt5-rpm-macros qt5-qtbase-devel qt5-qtsvg-devel qt5-qtx11extras-devel qt5-linguist glib2-devel gsettings-qt-devel bamf-devel libXrandr-devel libXtst-devel libX11-devel kf5-kwindowsystem-devel - - name: QMake configure & Make - run: | - mkdir build; - cd build; - qmake-qt5 ..; - make -j$(nproc); - ubuntu: - name: on Ubuntu 20.04 - runs-on: ubuntu-20.04 - container: docker.io/library/ubuntu:focal - env: - DEBIAN_FRONTEND: noninteractive - steps: - - name: Checkout ukui-menu source code - uses: actions/checkout@v2 - - name: Update apt repository - run: apt-get update -y - - name: Install build dependcies - run: apt-get install -y build-essential qt5-default qttools5-dev-tools debhelper-compat qtbase5-dev libqt5svg5-dev libglib2.0-dev libgsettings-qt-dev libbamf3-dev libxrandr-dev libxtst-dev libx11-dev libqt5x11extras5-dev libkf5windowsystem-dev - - name: QMake configure & Make - run: | - mkdir build; - cd build; - qmake ..; - make -j$(nproc); diff --git a/README.md b/README.md index 3a66c1d..ff12dc9 100755 --- a/README.md +++ b/README.md @@ -2,7 +2,34 @@ ![build](https://github.com/ukui/ukui-menu/workflows/Check%20build/badge.svg?branch=master) -An advanced menu for UKUI, providing common and all software mixed sort module, alphabet classification module, functional classification module and search module. +An advanced menu for UKUI, providing common and all software mixed sort module, alphabet classification module, functional classification module and search module. Provides favorites and recent file functions, You can fix it to your favorites area by right-clicking the application. Provides two display modes: default window and full-screen window. + +# The project structure + +## data/img + +Provide icon files for the projec. + +## src/BackProcess + +Background data processing function realization, Includes DBUS, path listening, data acquisition, and search functions. + +## src/QtSingleApplication + +Singleton pattern processing. + +## src/UserInterface + +The UI implementation. + +## src/UtilityFunction + +Implementation of common functions, including database operations. + +## translations + +Translation files + # How to report bugs Bugs should be reported to the UKUI bug tracking system: @@ -15,6 +42,7 @@ Please read the HACKING file for information on where to send changes or bugfixes for this package. # How to build + ## Preparation You can build pre-depends with such command: @@ -34,7 +62,7 @@ Note: build-depends references the paragraph in debian/control. Note: If you want to run ukui-menu, You just need to execute the ukui-menu command at the terminal. -## DBUS interface +# DBUS interface BUS Name:org.ukui.menu @@ -50,7 +78,7 @@ WinKeyResponse () <---> ukui-menu display hidden state change interface GetSecurityConfigPath () <---> Get security control profile path -## Configuration file +# Configuration file .config/ukui/Ukuimenu.db diff --git a/main.cpp b/main.cpp index f30ac71..68bb94d 100755 --- a/main.cpp +++ b/main.cpp @@ -30,6 +30,9 @@ #include "file-utils.h" #include #include +#include "ukuistylehelper/ukuistylehelper.h" +#include "windowmanager/windowmanager.h" + #define UKUI_SERVICE "org.gnome.SessionManager" #define UKUI_PATH "/org/gnome/SessionManager" #define UKUI_INTERFACE "org.gnome.SessionManager" @@ -40,6 +43,9 @@ int main(int argc, char *argv[]) { initUkuiLog4qt("ukui-menu"); g_projectCodeName = KDKGetPrjCodeName().c_str(); + g_subProjectCodeName = KDKGetOSRelease("SUB_PROJECT_CODENAME").c_str(); + g_platform = QGuiApplication::platformName(); + qRegisterMetaType>("QVector"); #if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); @@ -69,20 +75,44 @@ int main(int argc, char *argv[]) MainWindow w; app.setActivationWindow(&w); + w.show(); + w.raise(); + if (Style::m_panelPosition == 0) { - w.setGeometry(QRect(Style::m_primaryScreenX + 4, Style::m_primaryScreenY + Style::m_availableScreenHeight - Style::minh - 3, - Style::minw, Style::minh)); + if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { + kdk::WindowManager::setGeometry(w.windowHandle(),QRect(Style::m_primaryScreenX + 4, Style::m_primaryScreenY + + Style::m_availableScreenHeight - Style::minh - 3, Style::minw, Style::minh)); + } else { + w.setGeometry(QRect(Style::m_primaryScreenX + 4, Style::m_primaryScreenY + Style::m_availableScreenHeight - Style::minh - 3, + Style::minw, Style::minh)); + } } else if (Style::m_panelPosition == 1) { - w.setGeometry(QRect(Style::m_primaryScreenX + 4, Style::m_primaryScreenY + 4, Style::minw, Style::minh)); + if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { + kdk::WindowManager::setGeometry(w.windowHandle(),QRect(Style::m_primaryScreenX + 4, + Style::m_primaryScreenY + 4, Style::minw, Style::minh)); + } else { + w.setGeometry(QRect(Style::m_primaryScreenX + 4, Style::m_primaryScreenY + 4, Style::minw, Style::minh)); + } + } else if (Style::m_panelPosition == 2) { - w.setGeometry(QRect(Style::m_primaryScreenX + 4, Style::m_primaryScreenY + 4, Style::minw, Style::minh)); + + + if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { + kdk::WindowManager::setGeometry(w.windowHandle(), QRect(Style::m_primaryScreenX + 4, + Style::m_primaryScreenY + 4, Style::minw, Style::minh)); + } else { + w.setGeometry(QRect(Style::m_primaryScreenX + 4, Style::m_primaryScreenY + 4, Style::minw, Style::minh)); + } } else { - w.setGeometry(QRect(Style::m_primaryScreenX + Style::m_availableScreenWidth - Style::minw - 4, Style::m_primaryScreenY + 4, - Style::minw, Style::minh)); + if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { + kdk::WindowManager::setGeometry(w.windowHandle(), QRect(Style::m_primaryScreenX + Style::m_availableScreenWidth - + Style::minw - 4, Style::m_primaryScreenY + 4, Style::minw, Style::minh)); + } else { + w.setGeometry(QRect(Style::m_primaryScreenX + Style::m_availableScreenWidth - Style::minw - 4, Style::m_primaryScreenY + 4, + Style::minw, Style::minh)); + } } - w.show(); - w.raise(); w.update(); w.activateWindow(); w.hide(); diff --git a/res.qrc b/res.qrc index 3a10c26..47d0ea3 100755 --- a/res.qrc +++ b/res.qrc @@ -27,7 +27,6 @@ data/img/mainviewwidget/DM-icon-返回.svg data/img/mainviewwidget/DM-icon-返回@2x.png data/img/mainviewwidget/DM-icon-选项.png - data/img/mainviewwidget/DM-icon-选项.svg data/img/mainviewwidget/DM-icon-选项@2x.png data/img/mainviewwidget/DM-icon-check.png data/img/mainviewwidget/DM-icon-check.svg @@ -171,5 +170,6 @@ data/img/sidebarwidget/usericon-lightcolor.svg src/BackProcess/Search/pinyinWithoutTone.txt src/BackProcess/Search/pinyinWithTone.txt + data/img/mainviewwidget/DM-icon-option.svg diff --git a/src/BackProcess/BuriedPoint/buriedpointdatasend.cpp b/src/BackProcess/BuriedPoint/buriedpointdatasend.cpp new file mode 100644 index 0000000..a35411f --- /dev/null +++ b/src/BackProcess/BuriedPoint/buriedpointdatasend.cpp @@ -0,0 +1,78 @@ +#include "buriedpointdatasend.h" +#include +#include +#include +#include +#include +#include +#include + +Q_GLOBAL_STATIC(BuriedPointDataSend, buriedPointDataSend) + +BuriedPointDataSend::BuriedPointDataSend() +{ + QString path = QDir::homePath() + "/.config/ukui/menuUploadMessage/"; +// m_sendDataInterface = new KUploadMessage(getpid()); +// m_sendDataInterface->initUploadInterface("ukui-menu", "menuData", path); +} + +BuriedPointDataSend::~BuriedPointDataSend() +{ +// if (m_sendDataInterface != nullptr) { +// delete m_sendDataInterface; +// m_sendDataInterface = nullptr; +// } +} + +BuriedPointDataSend *BuriedPointDataSend::getInstance() +{ + return buriedPointDataSend(); +} + +QString BuriedPointDataSend::getCurrentTime() +{ + QString tempDateTimeStr; + QDateTime tempDateTime = QDateTime::currentDateTime().toTimeZone(QTimeZone(8 * 3600)); + tempDateTimeStr = tempDateTime.toString("yyyy-MM-dd HH:mm:ss.zzz"); + return tempDateTimeStr; +} + +void BuriedPointDataSend::setPoint(const pointDataStruct &data) +{ +// int curNum = 1; +// QStringList applist = QStringList(); +// QString keyValue = data.module + data.function; + +// if (m_functionCount.keys().contains(keyValue)) { +// curNum = m_functionCount.value(keyValue); +// curNum ++; +// } + +// m_functionCount.insert(keyValue, curNum); + +// if (!data.otherFunction.isEmpty()) { +// if (m_applist.keys().contains(keyValue)) { +// applist = m_applist.value(keyValue); +// } + +// applist.append(data.otherFunction.at(0)); +// m_applist.insert(keyValue, applist); +// } + +// QString time = getCurrentTime(); +// QJsonObject jsonObj; +// QJsonArray otherFunction = QJsonArray::fromStringList(data.otherFunction); +// jsonObj.insert("module", QJsonValue(data.module)); +// jsonObj.insert("function", QJsonValue(data.function)); +// jsonObj.insert("functionNum", QJsonValue(QString::number(curNum))); +// jsonObj.insert("otherFunction", otherFunction); +// jsonObj.insert("errorLevel", QJsonValue(data.errorLevel)); +// jsonObj.insert("errorOutput", QJsonValue(data.errorOutput)); +// jsonObj.insert("createTimeStamp", QJsonValue(time));//注意该字段名称不能修改,否则会报invalid +// // 将数据转化为QString +// QString informationData(QJsonDocument(jsonObj).toJson(QJsonDocument::Compact)); +// qDebug() << "jsonObj:" << jsonObj; +// m_sendDataInterface->uploadMessage(informationData); +} + + diff --git a/src/BackProcess/BuriedPoint/buriedpointdatasend.h b/src/BackProcess/BuriedPoint/buriedpointdatasend.h new file mode 100644 index 0000000..55aa510 --- /dev/null +++ b/src/BackProcess/BuriedPoint/buriedpointdatasend.h @@ -0,0 +1,29 @@ +#ifndef BURIEDPOINTDATASEND_H +#define BURIEDPOINTDATASEND_H + +#include +#include +#include +#include "src/UtilityFunction/utility.h" +#include "unistd.h" +//#include "kuploadmessage.h" + +class BuriedPointDataSend : public QObject +{ + Q_OBJECT +public: + BuriedPointDataSend(); + ~BuriedPointDataSend(); + + static BuriedPointDataSend *getInstance(); + + void setPoint(const pointDataStruct &data); + +private: + QString getCurrentTime(); + QHash m_functionCount; + QHash m_applist; +// KUploadMessage *m_sendDataInterface = nullptr; +}; + +#endif // BURIEDPOINTDATASEND_H diff --git a/src/BackProcess/FileWatcher/tablet_directorychanged_thread.cpp b/src/BackProcess/FileWatcher/tablet_directorychanged_thread.cpp index 1d01699..0cbbf6b 100755 --- a/src/BackProcess/FileWatcher/tablet_directorychanged_thread.cpp +++ b/src/BackProcess/FileWatcher/tablet_directorychanged_thread.cpp @@ -76,14 +76,24 @@ void TabletDirectoryChangedThread::run() QStringList applist = setting->allKeys(); int appnum = setting->allKeys().count(); int maxindex = 0; + int minindex = 0; for (int i = 0; i < appnum; i++) { if (setting->value(applist.at(i)).toInt() > maxindex) { maxindex = setting->value(applist.at(i)).toInt(); } + + if(setting->value(applist.at(i)).toInt() <= minindex) { + minindex = setting->value(applist.at(i)).toInt(); + } + } + + if (desktopfn.contains("small-plugin-manage")){ + setting->setValue(desktopfn,minindex-1); + } else { + setting->setValue(desktopfn,maxindex+1); } - setting->setValue(desktopfn, maxindex + 1); //setting->allKeys().count() setting->sync(); setting->endGroup(); // diff --git a/src/BackProcess/Interface/ukui_chineseletter.cpp b/src/BackProcess/Interface/ukui_chineseletter.cpp index 882be2f..ff73a2d 100755 --- a/src/BackProcess/Interface/ukui_chineseletter.cpp +++ b/src/BackProcess/Interface/ukui_chineseletter.cpp @@ -6244,7 +6244,7 @@ QString UkuiChineseLetter::getPinyin(int code)//此方法可以获取所有汉 } if (pinyin.isEmpty()) { - pinyin = ""; + pinyin = " "; } return pinyin; diff --git a/src/BackProcess/Interface/ukuimenuinterface.cpp b/src/BackProcess/Interface/ukuimenuinterface.cpp index 50e4f9a..ed6718b 100755 --- a/src/BackProcess/Interface/ukuimenuinterface.cpp +++ b/src/BackProcess/Interface/ukuimenuinterface.cpp @@ -576,8 +576,6 @@ QVector UkuiMenuInterface::createAppInfoVector() sql.exec(QString("select name_zh from appCategory where app_name=\"%1\" ").arg(desktopfpExecName)); if (sql.next()) { - myDebug() << "数据库执行成功"; - for (int j = 0; j < vector.size(); j++) { if (vector.at(j).contains(sql.value(0).toString())) { appInfoList.append(QString::number(j)); @@ -861,9 +859,11 @@ bool UkuiMenuInterface::initAppIni() QVector tencentInitVector; QVector customizedVector; QVector thirdPartyVector; + QVector preorderAppVector; QString tencent_math = "/usr/share/applications/tencent-math-precise-practice.desktop"; QString tencent_chinese = "/usr/share/applications/tencent-chinese-precise-practice.desktop"; QString tencent_english = "/usr/share/applications/tencent-english-precise-practice.desktop"; + QString smallPluginManage = "/usr/share/applications/small-plugin-manage.desktop"; QVector precise_practiceVector; QStringList math; QStringList english; @@ -903,6 +903,8 @@ bool UkuiMenuInterface::initAppIni() customizedVector.append(appInfoVector.at(i)); } else if (tmp.indexOf("mdm") != -1) { customizedVector.append(appInfoVector.at(i)); + } else if (tmp.contains(smallPluginManage)) { + preorderAppVector.append(appInfoVector.at(i)); } else { appInitVector.append(appInfoVector.at(i)); } @@ -928,12 +930,22 @@ bool UkuiMenuInterface::initAppIni() qSort(thirdPartyVector.begin(), thirdPartyVector.end(), cmpApp); //按中英文字母排序 setting->beginGroup("application"); + for (int i = 0; i < preorderAppVector.count(); i++) { + QString str = preorderAppVector.at(i).at(0).section(' ', 0, 0); + QStringList list = str.split('/'); + str = list[list.size() - 1]; + //qDebug()<setValue(str, i); + } + + int firstVectorCount = preorderAppVector.count(); + for (int i = 0; i < tencentInitVector.count(); i++) { QString str = tencentInitVector.at(i).at(0).section(' ', 0, 0); QStringList list = str.split('/'); str = list[list.size() - 1]; //qDebug()<setValue(str, i); + setting->setValue(str, i + firstVectorCount); } int a = tencentInitVector.count(); diff --git a/src/BackProcess/backprocess.pri b/src/BackProcess/backprocess.pri index aa6805a..929a1a9 100755 --- a/src/BackProcess/backprocess.pri +++ b/src/BackProcess/backprocess.pri @@ -7,7 +7,8 @@ INCLUDEPATH += \ $$PWD/Interface \ $$PWD/Search \ $$PWD/tablet \ - $$PWD/XEventMonitor + $$PWD/XEventMonitor \ + $$PWD/BuriedPoint HEADERS += \ $$PWD/DBus/dbus-adaptor.h \ @@ -24,7 +25,8 @@ HEADERS += \ $$PWD/Search/searchappthread.h \ $$PWD/XEventMonitor/xeventmonitor.h \ $$PWD/tablet/getmodeldata.h \ - $$PWD/tablet/pagemanager.h + $$PWD/tablet/pagemanager.h \ + $$PWD/BuriedPoint/buriedpointdatasend.h SOURCES += \ $$PWD/DBus/dbus-adaptor.cpp \ @@ -41,4 +43,9 @@ SOURCES += \ $$PWD/Search/searchappthread.cpp \ $$PWD/XEventMonitor/xeventmonitor.cpp \ $$PWD/tablet/getmodeldata.cpp \ - $$PWD/tablet/pagemanager.cpp + $$PWD/tablet/pagemanager.cpp \ + $$PWD/BuriedPoint/buriedpointdatasend.cpp + + +INCLUDEPATH += $$PWD/../ +DEPENDPATH += $$PWD/../ diff --git a/src/BackProcess/tablet/getmodeldata.cpp b/src/BackProcess/tablet/getmodeldata.cpp index 7854aa0..11d0693 100755 --- a/src/BackProcess/tablet/getmodeldata.cpp +++ b/src/BackProcess/tablet/getmodeldata.cpp @@ -1,7 +1,7 @@ #include "getmodeldata.h" #include #include -#include "src/UtilityFunction/utility.h" +#include "utility.h" GetModelData::GetModelData() { @@ -34,6 +34,28 @@ QVector GetModelData::getMinAllData() return m_minAllData; } +QStringList GetModelData::getPreCollectionApp() +{ + //收藏区预置应用:设置、天气、软件商店、截图、文件管理器 + QStringList preAppList = QStringList(); + QStringList preAppListExist = QStringList(); + preAppList << QString("/usr/share/applications/ukui-control-center.desktop") + <initAppIni(); } -int PageManager::getPageNum(int appnum) +int PageManager::getPageNum(const int &appNum) { int pageNum = 0; - Style::appColumn = 6; - Style::appLine = 4; - if (appnum % (Style::appColumn * Style::appLine) == 0) { - pageNum = appnum / (Style::appColumn * Style::appLine); + if (appNum / (Style::appColumnFirst * Style::appLineFirst) == 0) { + pageNum = 1; } else { - pageNum = appnum / (Style::appColumn * Style::appLine) + 1; + int appNumOtherPage = appNum - (Style::appColumnFirst * Style::appLineFirst); + + if (appNumOtherPage % (Style::appColumn * Style::appLine) == 0) { + pageNum = appNumOtherPage / (Style::appColumn * Style::appLine) + 1; + } else { + pageNum = appNumOtherPage / (Style::appColumn * Style::appLine) + 2; + } } return pageNum; } -QVector PageManager::sortAppInPage(QVector appvector) +QVector PageManager::sortAppInPage(const QVector &appVector) { QVector m_data; QVector pageData; QStringList onePageData; - Q_FOREACH (QString desktopfp, appvector) { + Q_FOREACH (QString desktopfp, appVector) { m_data.append(desktopfp); } int pageSize = getPageNum(m_data.size()); + onePageData.clear(); + + for (int j = 0; j < Style::appColumnFirst * Style::appLineFirst; j++) { + if (m_data.size() > 0) { + onePageData.append(m_data.at(0)); + m_data.pop_front(); + } else { + break; + } + } + + pageData.append(onePageData); - for (int i = 0; i < pageSize; i++) { + for (int i = 0; i < pageSize - 1; i++) { onePageData.clear(); for (int j = 0; j < Style::appColumn * Style::appLine; j++) { @@ -44,7 +60,6 @@ QVector PageManager::sortAppInPage(QVector appvector) onePageData.append(m_data.at(0)); m_data.pop_front(); } else { - // pageData.append(onePageData); break; } } diff --git a/src/BackProcess/tablet/pagemanager.h b/src/BackProcess/tablet/pagemanager.h index bc0b878..8c3f2ca 100755 --- a/src/BackProcess/tablet/pagemanager.h +++ b/src/BackProcess/tablet/pagemanager.h @@ -10,8 +10,8 @@ class PageManager : public QObject public: PageManager(); - int getPageNum(int appnum); - QVector sortAppInPage(QVector appvector); + int getPageNum(const int &appNum); + QVector sortAppInPage(const QVector &appVector); QVector getAppPageVector(); private: UkuiMenuInterface *m_ukuiMenuInterface = nullptr; diff --git a/src/UserInterface/Button/function_classify_button.cpp b/src/UserInterface/Button/function_classify_button.cpp index f9b58ef..2494be4 100755 --- a/src/UserInterface/Button/function_classify_button.cpp +++ b/src/UserInterface/Button/function_classify_button.cpp @@ -89,8 +89,22 @@ void FunctionClassifyButton::paintEvent(QPaintEvent *e) painter.setPen(Qt::NoPen); if (!m_fullscreen) { - QColor color = option.palette.color(QPalette::Text); - color.setAlphaF(0.15); + QColor color; + + if (option.state & QStyle::State_Selected) { + if (g_curStyle == "ukui-dark") { + color.setNamedColor("#33FFFFFF"); + } else { + color.setNamedColor("#D1FFFFFF"); + } + } else { + if (g_curStyle == "ukui-dark") { + color.setNamedColor("#1AFFFFFF"); + } else { + color.setNamedColor("#8CFFFFFF"); + } + } + painter.setBrush(color); } else { painter.setOpacity(0.15); diff --git a/src/UserInterface/Button/letter_classify_button.cpp b/src/UserInterface/Button/letter_classify_button.cpp index 8fb9340..5bc882f 100755 --- a/src/UserInterface/Button/letter_classify_button.cpp +++ b/src/UserInterface/Button/letter_classify_button.cpp @@ -19,6 +19,7 @@ #include "letter_classify_button.h" #include #include +#include "utility.h" LetterClassifyButton::LetterClassifyButton(QWidget *parent, bool fullscreen, @@ -55,8 +56,22 @@ void LetterClassifyButton::paintEvent(QPaintEvent *e) painter.setPen(Qt::NoPen); if (!m_fullscreen) { - QColor color = option.palette.color(QPalette::Text); - color.setAlphaF(0.15); + QColor color; + + if (option.state & QStyle::State_Selected) { + if (g_curStyle == "ukui-dark") { + color.setNamedColor("#33FFFFFF"); + } else { + color.setNamedColor("#D1FFFFFF"); + } + } else { + if (g_curStyle == "ukui-dark") { + color.setNamedColor("#1AFFFFFF"); + } else { + color.setNamedColor("#8CFFFFFF"); + } + } + painter.setBrush(color); } else { painter.setOpacity(0.15); @@ -81,10 +96,13 @@ void LetterClassifyButton::paintEvent(QPaintEvent *e) QStyleOptionButton subopt = option; subopt.rect = painter.style()->subElementRect(QStyle::SE_PushButtonContents, &option, this); - // if(m_fullscreen) - // subopt.palette.setBrush(QPalette::ButtonText, QColor(Qt::white)); - // else - // subopt.palette.setBrush(QPalette::HighlightedText, subopt.palette.text()); + + if (m_fullscreen) { + subopt.palette.setBrush(QPalette::ButtonText, QColor(Qt::white)); + } else { + subopt.palette.setBrush(QPalette::HighlightedText, subopt.palette.text()); + } + painter.style()->drawControl(QStyle::CE_PushButtonLabel, &subopt, &painter, this); return; } diff --git a/src/UserInterface/ListView/listview.cpp b/src/UserInterface/ListView/listview.cpp index 9bd82c4..ff6b421 100755 --- a/src/UserInterface/ListView/listview.cpp +++ b/src/UserInterface/ListView/listview.cpp @@ -21,6 +21,7 @@ #include "utility.h" #include #include +#include "buriedpointdatasend.h" ListView::ListView(QWidget *parent/*, int width, int height, int module*/): KListView(parent) @@ -108,6 +109,12 @@ void ListView::onClicked(QModelIndex index) Q_EMIT sendAppClassificationBtnClicked(); } else { execApp(desktopfp); + pointDataStruct pointData; + pointData.module = "mainWindow/execApplication"; + pointData.function = "Clicked"; + pointData.functionNum = ""; + pointData.otherFunction.append(desktopfp); + BuriedPointDataSend::getInstance()->setPoint(pointData); } } } @@ -129,8 +136,14 @@ void ListView::paintEvent(QPaintEvent *e) { //滚动条 QPalette p = this->verticalScrollBar()->palette(); - QColor color(255, 255, 255); - color.setAlphaF(0.25); + QColor color; + + if (g_curStyle == "ukui-dark") { + color = QColor("#26FFFFFF"); + } else { + color = QColor("#1A000000"); + } + p.setColor(QPalette::Active, QPalette::Button, color); this->verticalScrollBar()->setPalette(p); QListView::paintEvent(e); diff --git a/src/UserInterface/ListView/rightlistview.cpp b/src/UserInterface/ListView/rightlistview.cpp index a70a58f..e8dec33 100755 --- a/src/UserInterface/ListView/rightlistview.cpp +++ b/src/UserInterface/ListView/rightlistview.cpp @@ -39,7 +39,9 @@ RightListView::~RightListView() void RightListView::initWidget() { + setAttribute(Qt::WA_TranslucentBackground); viewport()->setAttribute(Qt::WA_TranslucentBackground); + viewport()->setAutoFillBackground(false); this->setSelectionMode(QAbstractItemView::SingleSelection); this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -62,10 +64,10 @@ void RightListView::dropEvent(QDropEvent *event) RightListView *source = qobject_cast(event->source()); if (source && source == this) { - dropPos = event->pos(); + m_dropPos = event->pos(); - if (this->indexAt(dropPos).isValid()) { - QVariant var = listmodel->data(indexAt(dropPos), Qt::DisplayRole); + if (this->indexAt(m_dropPos).isValid()) { + QVariant var = listmodel->data(indexAt(m_dropPos), Qt::DisplayRole); QString desktopfp = var.value(); QFileInfo fileInfo(desktopfp); QString desktopfn = fileInfo.fileName(); @@ -88,6 +90,11 @@ void RightListView::selectFirstItem() } } +void RightListView::paintEvent(QPaintEvent *e) +{ + QListView::paintEvent(e); +} + void RightListView::keyPressEvent(QKeyEvent *e) { if (e->type() == QEvent::KeyPress) { @@ -106,6 +113,11 @@ void RightListView::keyPressEvent(QKeyEvent *e) } } +void RightListView::changeStyleColor(const QColor &color) +{ + m_styleColor = color; +} + void RightListView::enterEvent(QEvent *e) { Q_UNUSED(e); diff --git a/src/UserInterface/ListView/rightlistview.h b/src/UserInterface/ListView/rightlistview.h index e85e07c..c75e0cc 100755 --- a/src/UserInterface/ListView/rightlistview.h +++ b/src/UserInterface/ListView/rightlistview.h @@ -26,12 +26,14 @@ protected: void keyPressEvent(QKeyEvent *e); void dropEvent(QDropEvent *event); void enterEvent(QEvent *e); + void paintEvent(QPaintEvent *e); private: RightClickMenu *menu = nullptr; //右键菜单 QStringList data; QGSettings *gsetting; - QPoint dropPos; + QPoint m_dropPos; + QColor m_styleColor; // bool inCurView; @@ -39,6 +41,7 @@ public Q_SLOTS: // void rightClickedSlot(const QPoint &pos);//右键菜单 void selectFirstItem(); + void changeStyleColor(const QColor &color); Q_SIGNALS: diff --git a/src/UserInterface/Other/rotationlabel.cpp b/src/UserInterface/Other/rotationlabel.cpp new file mode 100644 index 0000000..0c08e2e --- /dev/null +++ b/src/UserInterface/Other/rotationlabel.cpp @@ -0,0 +1,38 @@ +#include "rotationlabel.h" +#include +#include + +RotationLabel::RotationLabel(QWidget *parent) + : QLabel(parent) +{ + this->setFrameShape(QFrame::NoFrame); + this->setContentsMargins(0, 0, 0, 0); +} + +void RotationLabel::setRotation(int rot) +{ + m_rotation = rot; + this->update(); + qDebug() << m_rotation; +} + +int RotationLabel::rotation() +{ + return m_rotation; +} + +void RotationLabel::paintEvent(QPaintEvent *event) +{ + QPainter painter(this); + painter.setRenderHints(QPainter::SmoothPixmapTransform, true); + painter.translate(rect().width() / 2, rect().height() / 2); + painter.rotate(m_rotation); + painter.translate(-rect().width() / 2, -rect().height() / 2); + painter.drawPixmap(rect().adjusted(0, 9, 0, -9), m_pixmap); + return QLabel::paintEvent(event); +} + +void RotationLabel::setIcon(const QPixmap &pixmap) +{ + m_pixmap = pixmap; +} diff --git a/src/UserInterface/Other/rotationlabel.h b/src/UserInterface/Other/rotationlabel.h new file mode 100644 index 0000000..f99cdbb --- /dev/null +++ b/src/UserInterface/Other/rotationlabel.h @@ -0,0 +1,21 @@ +#ifndef ROTATIONLABEL_H +#define ROTATIONLABEL_H +#include + +class RotationLabel : public QLabel +{ + Q_OBJECT + Q_PROPERTY(int rotation READ rotation WRITE setRotation) //旋转 +public: + RotationLabel(QWidget *parent = nullptr); + void setIcon(const QPixmap &pixmap); +protected: + int rotation(); + void setRotation(int rot); + void paintEvent(QPaintEvent *event); +private: + int m_rotation = 0; + QPixmap m_pixmap; +}; + +#endif // ROTATIONLABEL_H diff --git a/src/UserInterface/RightClickMenu/menubox.cpp b/src/UserInterface/RightClickMenu/menubox.cpp index b6a8932..c6f9729 100755 --- a/src/UserInterface/RightClickMenu/menubox.cpp +++ b/src/UserInterface/RightClickMenu/menubox.cpp @@ -19,3 +19,9 @@ void MenuBox::mousePressEvent(QMouseEvent *event) return QMenu::mousePressEvent(event); } +void MenuBox::hideEvent(QHideEvent *e) +{ + Q_EMIT sendMainWinActiveSignal(true); + return QMenu::hideEvent(e); +} + diff --git a/src/UserInterface/RightClickMenu/menubox.h b/src/UserInterface/RightClickMenu/menubox.h index 8502af3..ea48961 100755 --- a/src/UserInterface/RightClickMenu/menubox.h +++ b/src/UserInterface/RightClickMenu/menubox.h @@ -12,6 +12,7 @@ public: protected: void mousePressEvent(QMouseEvent *event); + void hideEvent(QHideEvent *e) override; public: Q_SIGNALS: diff --git a/src/UserInterface/RightClickMenu/tabletrightclickmenu.cpp b/src/UserInterface/RightClickMenu/tabletrightclickmenu.cpp index 3dfdc5d..0143c32 100755 --- a/src/UserInterface/RightClickMenu/tabletrightclickmenu.cpp +++ b/src/UserInterface/RightClickMenu/tabletrightclickmenu.cpp @@ -25,8 +25,7 @@ TabletRightClickMenu::TabletRightClickMenu(QWidget *parent): { QString path = QDir::homePath() + "/.config/ukui/ukui-menu.ini"; m_setting = new QSettings(path, QSettings::IniFormat); - m_cmdProc = new QProcess; - connect(m_cmdProc, &QProcess::readyReadStandardOutput, this, &TabletRightClickMenu::onReadOutput); + sprintf(m_style, "QMenu{padding-left:2px;padding-top:6px;padding-right:2px;padding-bottom:6px;border:1px solid %s;border-radius:6px;background-color:%s;}\ QMenu::item:selected{background-color:%s;border-radius:6px;}\ QMenu::separator{height:1px;background-color:%s;margin-top:2px;margin-bottom:2px;}", @@ -35,15 +34,10 @@ TabletRightClickMenu::TabletRightClickMenu(QWidget *parent): TabletRightClickMenu::~TabletRightClickMenu() { - if (m_cmdProc) { - delete m_cmdProc; - } - if (m_setting) { delete m_setting; } - m_cmdProc = nullptr; m_setting = nullptr; } @@ -185,28 +179,13 @@ void TabletRightClickMenu::addToDesktopActionTriggerSlot() void TabletRightClickMenu::uninstallActionTriggerSlot() { -// QString cmd = QString("dpkg -S " + m_desktopfp); -// myDebug() << "void TabletRightClickMenu::uninstallActionTriggerSlot()" << m_desktopfp; -// m_cmdProc->setReadChannel(QProcess::StandardOutput); -// m_cmdProc->start("sh", QStringList() << "-c" << cmd); -// m_cmdProc->waitForFinished(); -// m_cmdProc->waitForReadyRead(); -// m_cmdProc->close(); - onReadOutput(); + QString cmd = QString("kylin-uninstaller %1") + .arg(m_desktopfp.toLocal8Bit().data()); + bool ret = QProcess::startDetached(cmd); + myDebug() << "卸载:" << cmd << ret; m_actionNumber = 6; } -void TabletRightClickMenu::onReadOutput() -{ -// QString packagestr = QString::fromLocal8Bit(m_cmdProc->readAllStandardOutput().data()); -// QString packageName = packagestr.split(":").at(0); -//目前仅调用起软件商店,不传递参数 - char command[100]; -// sprintf(command, "kylin-software-center -remove %s", packageName.toLocal8Bit().data()); - sprintf(command, "kylin-software-center"); - QProcess::startDetached(command); -} - void TabletRightClickMenu::attributeActionTriggerSlot() { char command[100]; diff --git a/src/UserInterface/RightClickMenu/tabletrightclickmenu.h b/src/UserInterface/RightClickMenu/tabletrightclickmenu.h index 6fbd906..a91451c 100755 --- a/src/UserInterface/RightClickMenu/tabletrightclickmenu.h +++ b/src/UserInterface/RightClickMenu/tabletrightclickmenu.h @@ -76,8 +76,6 @@ private: char m_style[400]; - QProcess *m_cmdProc = nullptr; - protected: /** * @brief Get icon pixmap @@ -150,10 +148,6 @@ private Q_SLOTS: * @brief Personalize this list */ //void otherListActionTriggerSlot(); - /** - * @brief Read command output - */ - void onReadOutput(); }; #endif // RIGHTCLICKMENU_H diff --git a/src/UserInterface/ViewItem/itemdelegate.cpp b/src/UserInterface/ViewItem/itemdelegate.cpp index 69f6631..aa7f169 100755 --- a/src/UserInterface/ViewItem/itemdelegate.cpp +++ b/src/UserInterface/ViewItem/itemdelegate.cpp @@ -20,7 +20,7 @@ #include #include #include -#include "src/UtilityFunction/utility.h" +#include "utility.h" ItemDelegate::ItemDelegate(QObject *parent, int module): KItemDelegate(parent) @@ -58,8 +58,22 @@ void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, painter->setRenderHint(QPainter::Antialiasing); if ((option.state & QStyle::State_MouseOver) || (option.state & QStyle::State_HasFocus)) { - QColor color = option.palette.text().color(); - color.setAlphaF(0.15); + QColor color; + + if (option.state & QStyle::State_Selected) { + if (g_curStyle == "ukui-dark") { + color.setNamedColor("#33FFFFFF"); + } else { + color.setNamedColor("#D1FFFFFF"); + } + } else { + if (g_curStyle == "ukui-dark") { + color.setNamedColor("#1AFFFFFF"); + } else { + color.setNamedColor("#8CFFFFFF"); + } + } + painter->save(); painter->setPen(QPen(Qt::NoPen)); painter->setBrush(color); @@ -153,10 +167,13 @@ void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, // QRect textRect=QRect(rect.x()+11,rect.y()+12,rect.width(),rect.height()); QRect textRect = QRect(rect.x() + 11, rect.y(), rect.width(), rect.height()); painter->drawText(textRect, Qt::AlignVCenter, strlist.at(0)); - painter->setRenderHint(QPainter::Antialiasing, true); - painter->setPen(QPen(QColor(option.palette.text().color()), 1)); - painter->setOpacity(0.1); - painter->drawLine(QPoint(5, rect.bottom()), QPoint(rect.right(), rect.bottom())); + painter->setRenderHints(QPainter::SmoothPixmapTransform, true); + QPixmap pixmap = getCurIcon(":/data/img/mainviewwidget/DM-icon-option.svg", true).pixmap(QSize(16, 16)); + + if ((option.state & QStyle::State_MouseOver) || (option.state & QStyle::State_HasFocus)) { + painter->drawPixmap(rect.width() - 25, rect.y() + 15, pixmap); + } + painter->restore(); } } else if (module == -1) { @@ -279,7 +296,7 @@ void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, QString desktopfn = fileInfo.fileName(); if (checkIfLocked(desktopfn)) { - QIcon icon(QString(":/data/img/mainviewwidget/lock.svg")); + QIcon icon = getCurIcon(":/data/img/mainviewwidget/lock.svg", true); icon.paint(painter, QRect(rect.topRight().x() - 22, rect.y() + (rect.height() - 16) / 2, 16, 16)); } diff --git a/src/UserInterface/ViewItem/right_item_delegate.cpp b/src/UserInterface/ViewItem/right_item_delegate.cpp index c463c4a..a67a6ca 100755 --- a/src/UserInterface/ViewItem/right_item_delegate.cpp +++ b/src/UserInterface/ViewItem/right_item_delegate.cpp @@ -1,5 +1,5 @@ #include "right_item_delegate.h" -#include "src/UtilityFunction/utility.h" +#include "utility.h" #include RightItemDelegate::RightItemDelegate(QObject *parent): @@ -37,16 +37,27 @@ void RightItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt painter->setRenderHint(QPainter::Antialiasing); painter->save(); painter->setPen(QPen(Qt::NoPen)); - painter->setBrush(option.palette.base().color()); if ((option.state & QStyle::State_MouseOver) || (option.state & QStyle::State_HasFocus)) { if (option.state & QStyle::State_Selected) { - painter->setOpacity(0.8); + if (g_curStyle == "ukui-dark") { + painter->setBrush(QColor("#7A000000")); + } else { + painter->setBrush(QColor("#BFFFFFFF")); + } } else { - painter->setOpacity(0.6); + if (g_curStyle == "ukui-dark") { + painter->setBrush(QColor("#66000000")); + } else { + painter->setBrush(QColor("#99FFFFFF")); + } } } else { - painter->setOpacity(0.4); + if (g_curStyle == "ukui-dark") { + painter->setBrush(QColor("#40000000")); + } else { + painter->setBrush(QColor("#66FFFFFF")); + } } painter->drawPath(path); diff --git a/src/UserInterface/ViewItem/tablet_full_itemdelegate.cpp b/src/UserInterface/ViewItem/tablet_full_itemdelegate.cpp index 1bb5b74..58e487a 100755 --- a/src/UserInterface/ViewItem/tablet_full_itemdelegate.cpp +++ b/src/UserInterface/ViewItem/tablet_full_itemdelegate.cpp @@ -33,7 +33,6 @@ TabletFullItemDelegate::TabletFullItemDelegate(QObject *parent, int module): settt = new QSettings(pathini, QSettings::IniFormat); QString path = QDir::homePath() + "/.config/ukui/ukui-menu.ini"; setting = new QSettings(path, QSettings::IniFormat); - // qDebug() << "---------------------gengxinleziti---------------------"; } TabletFullItemDelegate::~TabletFullItemDelegate() @@ -73,11 +72,6 @@ void TabletFullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem QString appname = pUkuiMenuInterface->getAppName(desktopfp); QRect iconRect; QRect textRect; - // QString desktopfn=desktopfp.split('/').last(); - // setting->beginGroup("groupname"); - // bool iscontain=setting->contains(desktopfn); - // setting->sync(); - // setting->endGroup(); if (iconFileInfo.isFile() && (iconstr.endsWith(".png") || iconstr.endsWith(".svg"))) { icon = QIcon(iconstr); @@ -118,28 +112,27 @@ void TabletFullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem } bool bigIcon = index.data(Qt::UserRole + 2).toBool(); + int iconTopSpace = (rect.height() - Style::AppListIconSize) / 2; + int iconLeftSpace = (rect.width() - Style::AppListIconSize) / 2; if (bigIcon) { - iconRect = QRect(rect.x() + Style::AppLeftSpace - 6, //94 - rect.y() + Style::AppTopSpace - 6, //60 - Style::AppListIconSize + 12,//96 + iconRect = QRect(rect.x() + iconLeftSpace - 6, + rect.y() + iconTopSpace - 6, + Style::AppListIconSize + 12, Style::AppListIconSize + 12); textRect = QRect(rect.x(), - iconRect.bottom() /*- 3*/, + rect.bottom() - iconTopSpace, rect.width(), - rect.height() - iconRect.height() - Style::AppTopSpace - 30); - // QPixmap pixmap; - // pixmap = icon.pixmap((Style::AppListIconSize+20,Style::AppListIconSize+20));//wgx - // icon=QIcon(pixmap); + iconTopSpace); } else { - iconRect = QRect(rect.x() + Style::AppLeftSpace, - rect.y() + Style::AppTopSpace, + iconRect = QRect(rect.x() + iconLeftSpace, + rect.y() + iconTopSpace, Style::AppListIconSize, Style::AppListIconSize); textRect = QRect(rect.x(), - iconRect.bottom(), + rect.bottom() - iconTopSpace, rect.width(), - rect.height() - iconRect.height() - Style::AppTopSpace - 30); + iconTopSpace); } QString str; diff --git a/src/UserInterface/Widget/full_commonuse_widget.cpp b/src/UserInterface/Widget/full_commonuse_widget.cpp index 04691ab..5dd8db5 100755 --- a/src/UserInterface/Widget/full_commonuse_widget.cpp +++ b/src/UserInterface/Widget/full_commonuse_widget.cpp @@ -20,6 +20,7 @@ #include #include "style.h" #include "utility.h" +#include "buriedpointdatasend.h" #include FullCommonUseWidget::FullCommonUseWidget(QWidget *parent) : @@ -131,6 +132,11 @@ void FullCommonUseWidget::initVerticalScrollBar() void FullCommonUseWidget::on_powerOffButton_clicked() { QProcess::startDetached(QString("ukui-session-tools")); + pointDataStruct pointData; + pointData.module = "fullWindow/commonUseWidget/powerOffButton"; + pointData.function = "Clicked"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); } void FullCommonUseWidget::on_powerOffButton_customContextMenuRequested(const QPoint &pos) @@ -138,6 +144,11 @@ void FullCommonUseWidget::on_powerOffButton_customContextMenuRequested(const QPo RightClickMenu m_otherMenu(this); m_otherMenu.showShutdownMenu(m_powerOffButton->mapToGlobal(pos)); myDebug() << "SideBarWidget::shutdownBtnRightClickSlot() 开始"; + pointDataStruct pointData; + pointData.module = "fullWindow/commonUseWidget/powerOffButton"; + pointData.function = "RightClicked"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); } void FullCommonUseWidget::initAppListWidget() @@ -190,6 +201,12 @@ void FullCommonUseWidget::execApplication(QString desktopfp) { Q_EMIT sendHideMainWindowSignal(); execApp(desktopfp); + pointDataStruct pointData; + pointData.module = "fullWindow/commonUseWidget/execApplication"; + pointData.function = "Clicked"; + pointData.functionNum = ""; + pointData.otherFunction[0] = desktopfp; + BuriedPointDataSend::getInstance()->setPoint(pointData); } void FullCommonUseWidget::selectFirstItem() diff --git a/src/UserInterface/Widget/full_function_widget.cpp b/src/UserInterface/Widget/full_function_widget.cpp index c3e2520..55ed6c0 100755 --- a/src/UserInterface/Widget/full_function_widget.cpp +++ b/src/UserInterface/Widget/full_function_widget.cpp @@ -23,6 +23,7 @@ #include #include #include +#include "buriedpointdatasend.h" FullFunctionWidget::FullFunctionWidget(QWidget *parent) : QWidget(parent) @@ -151,6 +152,11 @@ void FullFunctionWidget::initVerticalScrollBar() void FullFunctionWidget::on_powerOffButton_clicked() { QProcess::startDetached(QString("ukui-session-tools")); + pointDataStruct pointData; + pointData.module = "fullWindow/FullFunctionWidget/powerOffButton"; + pointData.function = "Clicked"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); } void FullFunctionWidget::on_powerOffButton_customContextMenuRequested(const QPoint &pos) @@ -158,6 +164,11 @@ void FullFunctionWidget::on_powerOffButton_customContextMenuRequested(const QPoi RightClickMenu m_otherMenu(this); m_otherMenu.showShutdownMenu(m_powerOffButton->mapToGlobal(pos)); myDebug() << "SideBarWidget::shutdownBtnRightClickSlot() 开始"; + pointDataStruct pointData; + pointData.module = "fullWindow/FullFunctionWidget/powerOffButton"; + pointData.function = "RightClicked"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); } @@ -218,6 +229,12 @@ void FullFunctionWidget::execApplication(QString desktopfp) { Q_EMIT sendHideMainWindowSignal(); execApp(desktopfp); + pointDataStruct pointData; + pointData.module = "fullWindow/FullFunctionWidget/execApplication"; + pointData.function = "Clicked"; + pointData.functionNum = ""; + pointData.otherFunction[0] = desktopfp; + BuriedPointDataSend::getInstance()->setPoint(pointData); } void FullFunctionWidget::on_setAreaScrollBarValue(int value) diff --git a/src/UserInterface/Widget/full_letter_widget.cpp b/src/UserInterface/Widget/full_letter_widget.cpp index 5b7d21b..353cbef 100755 --- a/src/UserInterface/Widget/full_letter_widget.cpp +++ b/src/UserInterface/Widget/full_letter_widget.cpp @@ -19,6 +19,7 @@ #include "full_letter_widget.h" #include #include +#include "buriedpointdatasend.h" FullLetterWidget::FullLetterWidget(QWidget *parent) : QWidget(parent) @@ -145,6 +146,11 @@ void FullLetterWidget::initVerticalScrollBar() void FullLetterWidget::on_powerOffButton_clicked() { QProcess::startDetached(QString("ukui-session-tools")); + pointDataStruct pointData; + pointData.module = "fullWindow/FullLetterWidget/powerOffButton"; + pointData.function = "Clicked"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); } void FullLetterWidget::on_powerOffButton_customContextMenuRequested(const QPoint &pos) @@ -152,6 +158,11 @@ void FullLetterWidget::on_powerOffButton_customContextMenuRequested(const QPoint RightClickMenu m_otherMenu(this); m_otherMenu.showShutdownMenu(m_powerOffButton->mapToGlobal(pos)); qDebug() << "SideBarWidget::shutdownBtnRightClickSlot() 开始"; + pointDataStruct pointData; + pointData.module = "fullWindow/FullLetterWidget/powerOffButton"; + pointData.function = "RightClicked"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); } void FullLetterWidget::setFocusToThis() @@ -222,6 +233,12 @@ void FullLetterWidget::execApplication(QString desktopfp) { Q_EMIT sendHideMainWindowSignal(); execApp(desktopfp); + pointDataStruct pointData; + pointData.module = "fullWindow/FullLetterWidget/execApplication"; + pointData.function = "Clicked"; + pointData.functionNum = ""; + pointData.otherFunction[0] = desktopfp; + BuriedPointDataSend::getInstance()->setPoint(pointData); } void FullLetterWidget::on_setAreaScrollBarValue(int value) diff --git a/src/UserInterface/Widget/full_searchresult_widget.cpp b/src/UserInterface/Widget/full_searchresult_widget.cpp index 3f4eff6..259986b 100755 --- a/src/UserInterface/Widget/full_searchresult_widget.cpp +++ b/src/UserInterface/Widget/full_searchresult_widget.cpp @@ -20,6 +20,7 @@ #include "style.h" #include "utility.h" #include +#include "buriedpointdatasend.h" FullSearchResultWidget::FullSearchResultWidget(QWidget *parent) : QWidget(parent) @@ -120,6 +121,11 @@ void FullSearchResultWidget::initVerticalScrollBar() void FullSearchResultWidget::on_powerOffButton_clicked() { QProcess::startDetached(QString("ukui-session-tools")); + pointDataStruct pointData; + pointData.module = "fullWindow/FullSearchResultWidget/powerOffButton"; + pointData.function = "Clicked"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); } void FullSearchResultWidget::on_powerOffButton_customContextMenuRequested(const QPoint &pos) @@ -127,6 +133,11 @@ void FullSearchResultWidget::on_powerOffButton_customContextMenuRequested(const RightClickMenu m_otherMenu(this); m_otherMenu.showShutdownMenu(m_powerOffButton->mapToGlobal(pos)); myDebug() << "SideBarWidget::shutdownBtnRightClickSlot() 开始"; + pointDataStruct pointData; + pointData.module = "fullWindow/FullSearchResultWidget/powerOffButton"; + pointData.function = "RightClicked"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); } void FullSearchResultWidget::initAppListWidget() @@ -153,6 +164,12 @@ void FullSearchResultWidget::execApplication(QString desktopfp) { Q_EMIT sendHideMainWindowSignal(); execApp(desktopfp); + pointDataStruct pointData; + pointData.module = "fullWindow/FullLetterWidget/execApplication"; + pointData.function = "Clicked"; + pointData.functionNum = ""; + pointData.otherFunction[0] = desktopfp; + BuriedPointDataSend::getInstance()->setPoint(pointData); } void FullSearchResultWidget::updateAppListView(QVector arg) diff --git a/src/UserInterface/Widget/function_Widget.cpp b/src/UserInterface/Widget/function_Widget.cpp index efadea4..5cf1f5e 100755 --- a/src/UserInterface/Widget/function_Widget.cpp +++ b/src/UserInterface/Widget/function_Widget.cpp @@ -10,6 +10,7 @@ #include #include "currenttime_interface.h" #include "style.h" +#include "utility.h" #include #define TIME_FORMAT "org.ukui.control-center.panel.plugins" #define TIME_FORMAT_KEY "hoursystem" @@ -153,11 +154,12 @@ void FunctionWidget::initUi() this->setStyleSheet("border:0px solid #ff0000;background:transparent;"); this->setFocusPolicy(Qt::NoFocus); QVBoxLayout *mainLayout = new QVBoxLayout(this); - mainLayout->setSpacing(0); + mainLayout->setSpacing(10); + mainLayout->setContentsMargins(5, 0, 0, 0); this->setLayout(mainLayout); - //时间+搜索框 + //时间 upWidget = new QWidget(); - upWidget->setFixedSize(400, 232); + upWidget->setFixedSize(400, 96); upLayout = new QVBoxLayout(); upWidget->setLayout(upLayout); upLayout->setContentsMargins(0, 0, 0, 32); @@ -184,13 +186,6 @@ void FunctionWidget::initUi() upRightLayout->setContentsMargins(0, 0, 0, 0); upRightLayout->setSpacing(0); // upRightWidget->setStyleSheet("border-width:1px;border-style:solid;border-color:red"); - //左下 - downWidget = new QWidget; - downLayout = new QVBoxLayout(); - downWidget->setLayout(downLayout); - downWidget->setFixedSize(400, 104); - downLayout->setSpacing(0); - downLayout->setContentsMargins(0, 24, 0, 0); //左侧控件 timeLabel = new QLabel(); weekLabel = new QLabel(); @@ -205,17 +200,19 @@ void FunctionWidget::initUi() QDBusReply styleName = usrInterface->call(QString("get_current_stylename")); changeSearchBoxBackground(styleName); connect(searchEditBtn, &QPushButton::clicked, this, &FunctionWidget::obtainSearchResult); - downLayout->addWidget(searchEditBtn); upLayout->addWidget(leftUpWidget); - upLayout->addWidget(downWidget); - mainLayout->addWidget(upWidget); + mainLayout->addStretch(); + + if (g_subProjectCodeName.contains("mavis")) { + upWidget->setFixedSize(0, 0); + } else { + mainLayout->addWidget(upWidget); + } + + mainLayout->addWidget(searchEditBtn); focusPlug = new pluginwidget(this); - //加入专注模式 - // if(plugin) - // { mainLayout->addWidget(focusPlug); focusPlug->setFixedSize(400, 638); - // } mainLayout->addStretch(); leftUpLayout->addWidget(upLeftWidget); leftUpLayout->addWidget(upRightWidget); diff --git a/src/UserInterface/Widget/function_Widget.h b/src/UserInterface/Widget/function_Widget.h index 0298a62..3681c78 100755 --- a/src/UserInterface/Widget/function_Widget.h +++ b/src/UserInterface/Widget/function_Widget.h @@ -35,7 +35,6 @@ private: QGSettings *timeSetting = nullptr; QString themeName; QObject *plugin = nullptr; - AbstractInterface *app; QGraphicsDropShadowEffect *effect; QPalette palette; QTimer *myTimer = nullptr; diff --git a/src/UserInterface/Widget/function_button_widget.cpp b/src/UserInterface/Widget/function_button_widget.cpp index f23f976..cd7b8f8 100755 --- a/src/UserInterface/Widget/function_button_widget.cpp +++ b/src/UserInterface/Widget/function_button_widget.cpp @@ -48,9 +48,8 @@ void FunctionButtonWidget::initUi() { this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint); this->setAttribute(Qt::WA_StyledBackground, true); - this->resize(Style::LeftBtnWidth * 2 + 5, Style::LeftBtnHeight * 6 + 25); QGridLayout *gridLayout = new QGridLayout; - gridLayout->setContentsMargins(0, 0, 0, 0); + gridLayout->setContentsMargins(40, 80, 40, 80); gridLayout->setSpacing(5); this->setLayout(gridLayout); diff --git a/src/UserInterface/Widget/letter_button_widget.cpp b/src/UserInterface/Widget/letter_button_widget.cpp index f68a685..68e3a74 100755 --- a/src/UserInterface/Widget/letter_button_widget.cpp +++ b/src/UserInterface/Widget/letter_button_widget.cpp @@ -35,9 +35,8 @@ void LetterButtonWidget::initUi() this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint); this->setAttribute(Qt::WA_StyledBackground, true); this->setFocusPolicy(Qt::NoFocus); - this->resize(235, 366); QGridLayout *gridLayout = new QGridLayout; - gridLayout->setContentsMargins(0, 0, 0, 0); + gridLayout->setContentsMargins(35, 80, 35, 80); gridLayout->setSpacing(5); this->setLayout(gridLayout); QStringList letterlist; @@ -51,13 +50,13 @@ void LetterButtonWidget::initUi() letterlist.append("&&"); letterlist.append("#"); - for (int row = 0; row < 7; row++) { - for (int col = 0; col < 4; col++) { - if (row * 4 + col < letterlist.size()) { - LetterClassifyButton *btn = new LetterClassifyButton(this, false, letterlist.at(row * 4 + col)); + for (int row = 0; row < 6; row++) { + for (int col = 0; col < 5; col++) { + if (row * 5 + col < letterlist.size()) { + LetterClassifyButton *btn = new LetterClassifyButton(this, false, letterlist.at(row * 5 + col)); btn->setFlat(true); btn->setCheckable(false); - btn->setFixedSize(55, 48); + btn->setFixedSize(38, 38); gridLayout->addWidget(btn, row, col); connect(btn, &LetterClassifyButton::buttonClicked, this, &LetterButtonWidget::letterBtnClickedSlot); } else { diff --git a/src/UserInterface/Widget/main_view_widget.cpp b/src/UserInterface/Widget/main_view_widget.cpp index 4cf9778..8a883d8 100755 --- a/src/UserInterface/Widget/main_view_widget.cpp +++ b/src/UserInterface/Widget/main_view_widget.cpp @@ -42,9 +42,20 @@ MainViewWidget::~MainViewWidget() { } +void MainViewWidget::styleChangeSlot(const QString &style) +{ + m_curStyle = style; + + if (style == "ukui-dark") { + m_backColor.setNamedColor("#800D0D0D"); + } else { + m_backColor.setNamedColor("#94FFFFFF"); + } +} + void MainViewWidget::paintEvent(QPaintEvent *event) { - double transparency = getTransparency(); +// double transparency = getTransparency(); QRect rect = this->rect(); QPainterPath path; QPainter painter(this); @@ -60,11 +71,8 @@ void MainViewWidget::paintEvent(QPaintEvent *event) path.quadTo(rect.bottomRight(), rect.bottomRight() + QPointF(0, -radius)); path.lineTo(rect.topRight() + QPointF(0, radius)); path.quadTo(rect.topRight(), rect.topRight() + QPointF(-radius, -0)); - painter.setBrush(this->palette().base()); painter.setPen(Qt::transparent); - painter.setOpacity(transparency + 0.1); - painter.fillPath(path, this->palette().base()); - // setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); - // KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); + painter.setOpacity(0.58); + painter.fillPath(path, m_backColor); QWidget::paintEvent(event); } diff --git a/src/UserInterface/Widget/main_view_widget.h b/src/UserInterface/Widget/main_view_widget.h index 6926777..ebebf5a 100755 --- a/src/UserInterface/Widget/main_view_widget.h +++ b/src/UserInterface/Widget/main_view_widget.h @@ -55,12 +55,16 @@ protected: void paintEvent(QPaintEvent *event); public Q_SLOTS: + void styleChangeSlot(const QString &style); Q_SIGNALS: void directoryChangedSignal(); void sendDirectoryPath(); +private: + QString m_curStyle; + QColor m_backColor; }; #endif // MAINVIEWWIDGET_H diff --git a/src/UserInterface/full_mainwindow.cpp b/src/UserInterface/full_mainwindow.cpp index 9b37d38..5e63110 100755 --- a/src/UserInterface/full_mainwindow.cpp +++ b/src/UserInterface/full_mainwindow.cpp @@ -2,7 +2,8 @@ #include #include #include -#include "src/UtilityFunction/utility.h" +#include "utility.h" +#include "buriedpointdatasend.h" FullMainWindow::FullMainWindow(QWidget *parent) : QMainWindow(parent) @@ -41,7 +42,7 @@ FullMainWindow::FullMainWindow(QWidget *parent) : queryWidLayout->setSpacing(5); m_queryWid->setLayout(queryWidLayout); char style[200]; - QPixmap pixmap = loadSvg(QString(":/data/img/mainviewwidget/search.svg"), 16); + QPixmap pixmap = loadSvg(QString(":/data/img/mainviewwidget/full-search.svg"), 16); if (QGSettings::isSchemaInstalled(QString("org.ukui.style").toLocal8Bit())) { QGSettings *gsetting = new QGSettings("org.ukui.style", QByteArray(), this); @@ -225,6 +226,11 @@ void FullMainWindow::changeStyle() void FullMainWindow::on_minPushButton_clicked() { Q_EMIT showNormalWindow(); + pointDataStruct pointData; + pointData.module = "fullWindow/minPushButton"; + pointData.function = "Clicked"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); } void FullMainWindow::paintEvent(QPaintEvent *event) @@ -250,6 +256,11 @@ bool FullMainWindow::eventFilter(QObject *watched, QEvent *event) char style[200]; if (event->type() == QEvent::FocusIn) { + pointDataStruct pointData; + pointData.module = "fullWindow/Search"; + pointData.function = "Clicked"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); sprintf(style, "QLineEdit{border:2px solid %s;background-color:%s;border-radius:17px;color:#ffffff;}", QueryLineEditClickedBorder, QueryLineEditClickedBackground); m_lineEdit->setStyleSheet(style); @@ -425,6 +436,8 @@ void FullMainWindow::on_fullSelectMenuButton_clicked() void FullMainWindow::on_fullSelectMenuButton_triggered(QAction *arg1) { + pointDataStruct pointData; + if (arg1 == m_allAction) { m_fullStackedWidget->setCurrentIndex(0); m_fullCommonPage->repaintWidget(); @@ -434,6 +447,10 @@ void FullMainWindow::on_fullSelectMenuButton_triggered(QAction *arg1) m_allAction->setChecked(true); m_letterAction->setChecked(false); m_funcAction->setChecked(false); + pointData.module = "fullWindow/fullSelectMenuButton"; + pointData.function = "AllSelect"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); } else if (arg1 == m_letterAction) { m_fullStackedWidget->setCurrentIndex(1); m_fullLetterPage->repaintWidget(); @@ -442,6 +459,10 @@ void FullMainWindow::on_fullSelectMenuButton_triggered(QAction *arg1) m_allAction->setChecked(false); m_letterAction->setChecked(true); m_funcAction->setChecked(false); + pointData.module = "fullWindow/fullSelectMenuButton"; + pointData.function = "letterSelect"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); } else if (arg1 == m_funcAction) { m_fullStackedWidget->setCurrentIndex(2); m_fullFunctionPage->repaintWidget(); @@ -450,6 +471,10 @@ void FullMainWindow::on_fullSelectMenuButton_triggered(QAction *arg1) m_allAction->setChecked(false); m_letterAction->setChecked(false); m_funcAction->setChecked(true); + pointData.module = "fullWindow/fullSelectMenuButton"; + pointData.function = "FunctionSelect"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); } } diff --git a/src/UserInterface/mainwindow.cpp b/src/UserInterface/mainwindow.cpp index 8d7f369..4aee570 100755 --- a/src/UserInterface/mainwindow.cpp +++ b/src/UserInterface/mainwindow.cpp @@ -33,6 +33,7 @@ #include #include #include +#include "buriedpointdatasend.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) @@ -49,19 +50,19 @@ MainWindow::MainWindow(QWidget *parent) : //左侧 m_viewWidget = new MainViewWidget(m_centralwidget); m_mainLeftVerticalLayout = new QVBoxLayout(m_viewWidget); - m_mainLeftVerticalLayout->setSpacing(0); - m_mainLeftVerticalLayout->setContentsMargins(8, 8, 0, 0); + m_mainLeftVerticalLayout->setSpacing(9); + m_mainLeftVerticalLayout->setContentsMargins(8, 15, 4, 0); //搜索框部分 m_topStackedWidget = new QStackedWidget(m_viewWidget); - m_topStackedWidget->setFixedHeight(48); + m_topStackedWidget->setFixedHeight(34); //搜索框收起页 m_minMenuPage = new QWidget(); - m_minMenuPage->setMinimumSize(QSize(0, 48)); + m_minMenuPage->setMinimumSize(QSize(0, 34)); m_letfTopSelectHorizontalLayout = new QHBoxLayout(m_minMenuPage); - m_letfTopSelectHorizontalLayout->setSpacing(8); - m_letfTopSelectHorizontalLayout->setContentsMargins(8, 0, 8, 12); + m_letfTopSelectHorizontalLayout->setSpacing(2); + m_letfTopSelectHorizontalLayout->setContentsMargins(8, 0, 4, 0); m_minSelectTextLabel = new QLabel(m_minMenuPage); - m_horizontalSpacer = new QSpacerItem(68, 10, QSizePolicy::Expanding, QSizePolicy::Minimum); + m_horizontalSpacer = new QSpacerItem(58, 10, QSizePolicy::Expanding, QSizePolicy::Minimum); m_searchPushButton = new QPushButton(m_minMenuPage); // m_searchPushButton->setStyleSheet(m_buttonStyle.arg("QPushButton")); m_searchPushButton->setFixedSize(QSize(26, 26)); @@ -71,20 +72,21 @@ MainWindow::MainWindow(QWidget *parent) : m_minSelectButton->setFixedSize(QSize(26, 26)); m_minSelectButton->setIcon(getCurIcon(":/data/img/mainviewwidget/DM-all.svg", true)); m_minSelectButton->installEventFilter(this); - m_selectMenuButton = new QToolButton(m_minMenuPage); + m_selectMenuButton = new RotationLabel(m_minMenuPage); + m_selectMenuButton->installEventFilter(this); m_selectMenuButton->setStyleSheet("background: transparent;"); - m_selectMenuButton->setFixedSize(QSize(16, 26)); + m_selectMenuButton->setFixedSize(QSize(8, 26)); m_selectMenuButton->setAcceptDrops(true); - m_selectMenuButton->setIcon(getCurIcon(":/data/img/mainviewwidget/DM-arrow.svg", true)); - m_selectMenuButton->setPopupMode(QToolButton::InstantPopup); -// m_selectMenuButton->setStyleSheet(QString::fromUtf8("QToolButton::menu-indicator { image: None; }")); + m_selectMenuButton->setFocusPolicy(Qt::StrongFocus); + m_selectMenuButton->setIcon(getCurIcon(":/data/img/mainviewwidget/downarrow.svg", true) + .pixmap(QSize(Style::miniIconSize, Style::miniIconSize))); //搜索框展开页 m_minSearchPage = new QWidget(); m_leftTopSearchHorizontalLayout = new QHBoxLayout(m_minSearchPage); - m_leftTopSearchHorizontalLayout->setContentsMargins(8, 0, 8, 12); + m_leftTopSearchHorizontalLayout->setContentsMargins(8, 0, 8, 0); m_lineEdit = new QLineEdit(m_minSearchPage); m_lineEdit->setMinimumSize(QSize(30, 26)); - m_lineEdit->setStyleSheet(QString::fromUtf8("border-radius: 13px; border:2px solid rgba(5, 151, 255, 1); background: transparent;")); + m_lineEdit->setStyleSheet(QString::fromUtf8("border-radius: 13px; border:1px solid rgba(5, 151, 255, 1); background: transparent;")); m_lineEdit->setFrame(false); m_lineEdit->setPlaceholderText(tr("Search")); m_cancelSearchPushButton = new QPushButton(m_minSearchPage); @@ -127,19 +129,21 @@ MainWindow::MainWindow(QWidget *parent) : //右侧窗口 m_mainRightVerticalLayout = new QVBoxLayout(); m_mainRightVerticalLayout->setSpacing(0); - m_mainRightVerticalLayout->setContentsMargins(8, 8, 8, 8); + m_mainRightVerticalLayout->setContentsMargins(8, 6, 8, 8); m_mainRightVerticalLayout_1 = new QVBoxLayout(); m_rightTopHorizontalLayout = new QHBoxLayout(); m_rightTopHorizontalLayout->setSpacing(30); m_rightTopHorizontalLayout->setContentsMargins(8, 0, 10, 0); //收藏按键 m_collectPushButton = new QLabel(m_centralwidget); + m_collectPushButton->setFocusPolicy(Qt::StrongFocus); m_collectPushButton->setFixedHeight(34); // m_collectPushButton->setFlat(true); m_collectPushButton->installEventFilter(this); //最近按键 m_recentPushButton = new QLabel(m_centralwidget); m_recentPushButton->setFixedHeight(34); + m_recentPushButton->setFocusPolicy(Qt::StrongFocus); // m_recentPushButton->setFlat(true); m_recentPushButton->installEventFilter(this); m_horizontalSpacer_3 = new QSpacerItem(332, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); @@ -160,7 +164,7 @@ MainWindow::MainWindow(QWidget *parent) : m_collectPage = new QWidget(); m_collectPage->setFixedSize(QSize(324, 480)); m_rightCollectLayout = new QVBoxLayout(m_collectPage); - m_rightCollectLayout->setContentsMargins(0, 0, 0, 0); + m_rightCollectLayout->setContentsMargins(0, 18, 0, 0); //收藏视图 m_collectListView = new RightListView(m_collectPage); m_collectListView->setFixedSize(QSize(324, 428)); @@ -182,7 +186,12 @@ MainWindow::MainWindow(QWidget *parent) : //最近视图 m_recentListView = new ListView(m_recentPage); m_recentListView->installEventFilter(this); - m_recentListView->setFixedSize(QSize(324, 470)); + m_recentListView->setFixedSize(QSize(Style::rightViewWidth, Style::rightViewHeight)); + m_recentTextlabel = new QLabel(m_recentPage); + m_recentTextlabel->setFixedSize(QSize(Style::rightViewWidth, Style::rightViewHeight)); + m_recentTextlabel->setAlignment(Qt::AlignCenter); + m_recentTextlabel->setText(QApplication::translate("MainWindow", "No recent files")); + m_rightStackedWidget->addWidget(m_collectPage); m_rightStackedWidget->addWidget(m_recentPage); m_verticalSpacer_2 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); @@ -190,26 +199,30 @@ MainWindow::MainWindow(QWidget *parent) : m_rightBottomHorizontalLayout->setSizeConstraint(QLayout::SetDefaultConstraint); m_rightBottomHorizontalLayout->setContentsMargins(0, 0, 8, 0); m_horizontalSpacer_2 = new QSpacerItem(332, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + m_horizontalSpacer_4 = new QSpacerItem(10, 10, QSizePolicy::Minimum, QSizePolicy::Minimum); m_powerOffButton = new QPushButton(m_centralwidget); - m_powerOffButton->setFixedSize(QSize(24, 24)); + m_powerOffButton->setFixedSize(QSize(32, 32)); m_powerOffButton->setContextMenuPolicy(Qt::CustomContextMenu); m_powerOffButton->setIcon(QIcon(":/data/img/mainviewwidget/power.svg")); + m_powerOffButton->setIconSize(QSize(24, 24)); m_powerOffButton->setFlat(true); m_powerOffButton->installEventFilter(this); m_letfTopSelectHorizontalLayout->addWidget(m_minSelectTextLabel); m_letfTopSelectHorizontalLayout->addItem(m_horizontalSpacer); m_letfTopSelectHorizontalLayout->addWidget(m_searchPushButton); + m_letfTopSelectHorizontalLayout->addItem(m_horizontalSpacer_4); m_letfTopSelectHorizontalLayout->addWidget(m_minSelectButton); m_letfTopSelectHorizontalLayout->addWidget(m_selectMenuButton); m_leftTopSearchHorizontalLayout->addWidget(m_lineEdit); m_leftTopSearchHorizontalLayout->addWidget(m_cancelSearchPushButton); m_mainLeftVerticalLayout->addWidget(m_topStackedWidget); m_mainLeftVerticalLayout->addWidget(m_leftStackedWidget); + m_mainLeftVerticalLayout->addStretch(); m_mainRightVerticalLayout_1->addLayout(m_rightTopHorizontalLayout); - m_rightCollectLayout->addItem(m_verticalSpacer); m_rightCollectLayout->addWidget(m_collectListView); m_rightCollectLayout->addItem(m_verticalSpacer_2); m_rightRecentLayout->addWidget(m_recentListView); + m_rightRecentLayout->addWidget(m_recentTextlabel); m_mainRightVerticalLayout_1->addWidget(m_rightStackedWidget); m_rightBottomHorizontalLayout->addItem(m_horizontalSpacer_2); m_rightBottomHorizontalLayout->addWidget(m_powerOffButton); @@ -223,6 +236,8 @@ MainWindow::MainWindow(QWidget *parent) : m_minSelectButton->setText(QString()); m_selectMenuButton->setText(QString()); m_cancelSearchPushButton->setText(QString()); + QFont collectFont(QGuiApplication::font().family(), QGuiApplication::font().pointSize() + 2); + m_collectPushButton->setFont(collectFont); m_collectPushButton->setText(QApplication::translate("MainWindow", "collection", nullptr)); m_recentPushButton->setText(QApplication::translate("MainWindow", "recent", nullptr)); m_minMaxChangeButton->setToolTip(QApplication::translate("MainWindow", "Max", nullptr)); @@ -309,29 +324,50 @@ MainWindow::MainWindow(QWidget *parent) : this->hide(); this->clearFocus(); m_isFullScreen = false; + pointDataStruct pointData; + pointData.module = "mainWindow"; + pointData.function = "winHide"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); } else if (m_fullWindow->isVisible()) { m_fullWindow->hide(); m_fullWindow->clearFocus(); + pointDataStruct pointData; + pointData.module = "fullWindow"; + pointData.function = "winHide"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); m_isFullScreen = true; } else { if (!m_isFullScreen) { this->show(); + setMinWindowPos(); this->raise(); this->activateWindow(); -// m_collectPushButton->clicked(true); + pointDataStruct pointData; + pointData.module = "mainWindow"; + pointData.function = "winShow"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); on_collectPushButton_clicked(); m_viewWidget->setFocus(); } else { m_fullWindow->show(); - // fullWindow->raise(); +// fullWindow->raise(); m_fullWindow->activateWindow(); + pointDataStruct pointData; + pointData.module = "fullWindow"; + pointData.function = "winShow"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); } } }); - m_maxAnimation = new QPropertyAnimation(&m_animationPage, "geometry"); - m_minAnimation = new QPropertyAnimation(&m_animationPage, "geometry"); + m_animationPage = new AnimationPage(); + m_maxAnimation = new QPropertyAnimation(m_animationPage, "geometry", this); + m_minAnimation = new QPropertyAnimation(m_animationPage, "geometry", this); connect(m_maxAnimation, &QPropertyAnimation::finished, this, &MainWindow::maxAnimationFinished); connect(m_minAnimation, &QPropertyAnimation::finished, this, &MainWindow::minAnimationFinished); connect(m_lineEdit, &QLineEdit::textChanged, this, &MainWindow::searchAppSlot); @@ -340,11 +376,14 @@ MainWindow::MainWindow(QWidget *parent) : connect(m_fullWindow, &FullMainWindow::showNormalWindow, this, &MainWindow::showNormalWindowSlot); connect(m_fullWindow, &FullMainWindow::sendUpdateOtherView, this, &MainWindow::updateMinAllView); connect(m_minSelectButton, &QToolButton::clicked, this, &MainWindow::on_minSelectButton_clicked); - connect(m_selectMenuButton, &QToolButton::triggered, this, &MainWindow::on_selectMenuButton_triggered); + connect(m_dropDownMenu, &MenuBox::triggered, this, &MainWindow::on_selectMenuButton_triggered); + connect(m_dropDownMenu, &MenuBox::sendMainWinActiveSignal, [ = ]() { + m_selectMenuButton->setIcon(getCurIcon(":/data/img/mainviewwidget/downarrow.svg", true) + .pixmap(QSize(Style::miniIconSize, Style::miniIconSize))); + selectIconAnimation(false); + }); connect(m_powerOffButton, &QPushButton::customContextMenuRequested, this, &MainWindow::on_powerOffButton_customContextMenuRequested); connect(m_powerOffButton, &QPushButton::clicked, this, &MainWindow::on_powerOffButton_clicked); -// connect(m_collectPushButton, &QPushButton::clicked, this, &MainWindow::on_collectPushButton_clicked); -// connect(m_recentPushButton, &QPushButton::clicked, this, &MainWindow::on_recentPushButton_clicked); connect(m_cancelSearchPushButton, &QPushButton::clicked, this, &MainWindow::on_cancelSearchPushButton_clicked); connect(m_searchPushButton, &QPushButton::clicked, this, &MainWindow::on_searchPushButton_clicked); connect(m_minMaxChangeButton, &QPushButton::clicked, this, &MainWindow::on_minMaxChangeButton_clicked); @@ -375,7 +414,7 @@ MainWindow::MainWindow(QWidget *parent) : m_lineEdit->setParent(nullptr); m_leftTopSearchHorizontalLayout->addWidget(m_lineEdit); m_leftTopSearchHorizontalLayout->addWidget(m_cancelSearchPushButton); - m_lineEdit->setPlaceholderText("搜索应用"); + m_lineEdit->setPlaceholderText(QApplication::translate("MainWindow", "Search application")); m_fullWindow->updateView(); } @@ -399,6 +438,11 @@ MainWindow::MainWindow(QWidget *parent) : MainWindow::~MainWindow() { closeDataBase("MainThread"); + + if (m_animationPage != nullptr) { + delete m_animationPage; + m_animationPage = nullptr; + } } void MainWindow::initUi() @@ -412,25 +456,38 @@ void MainWindow::initUi() m_minAllListView->addData(m_modaldata->getMinAllData(), 0); m_minFuncListView->addData(m_modaldata->getMinFuncData(), 1); m_minLetterListView->addData(m_modaldata->getMinLetterData(), 2); - m_collectListView->addData(m_modaldata->getcollectData()); - m_recentListView->addData(m_modaldata->getRecentData(), -1); - QMenu *m_menu = new QMenu; - m_allAction = new QAction(m_menu); - m_letterAction = new QAction(m_menu); - m_funcAction = new QAction(m_menu); + + if (dataBaseIsEmpty()) { + m_collectListView->addData(m_modaldata->getPreCollectionApp()); + } else { + m_collectListView->addData(m_modaldata->getcollectData()); + } + + QVector recentFile = m_modaldata->getRecentData(); + m_recentListView->addData(recentFile , -1); + + if (recentFile.isEmpty()) { + m_recentListView->hide(); + } else { + m_recentTextlabel->hide(); + } + + m_dropDownMenu = new MenuBox(this); + m_dropDownMenu->setFixedWidth(Style::DropMenuWidth); + m_allAction = new QAction(m_dropDownMenu); + m_letterAction = new QAction(m_dropDownMenu); + m_funcAction = new QAction(m_dropDownMenu); m_allAction->setText(tr("All")); m_allAction->setCheckable(true); m_letterAction->setText(tr("Letter")); m_letterAction->setCheckable(true); m_funcAction->setText(tr("Function")); m_funcAction->setCheckable(true); - m_menu->addAction(m_allAction); - m_menu->addAction(m_letterAction); - m_menu->addAction(m_funcAction); + m_dropDownMenu->addAction(m_allAction); + m_dropDownMenu->addAction(m_letterAction); + m_dropDownMenu->addAction(m_funcAction); m_allAction->setChecked(true); - m_selectMenuButton->setMenu(m_menu); m_collectPushButton->setStyleSheet("color:#3790FA;"); -// m_collectPushButton->setStyleSheet("border: 1px solid red;"); QColor textColor = this->palette().color(QPalette::Text); QRgb rgbDefault = qRgb(textColor.red(), textColor.green(), textColor.blue()); QString textColorDefault = "#" + QString::number(rgbDefault, 16); @@ -450,6 +507,7 @@ void MainWindow::initUi() connect(m_collectListView, &RightListView::sendCollectViewUpdate, this, &MainWindow::updateCollectView); connect(m_desktopWatcher, &DesktopWatcher::directoryChangedSignal, this, &MainWindow::updateView); connect(m_desktopWatcher, &DesktopWatcher::updateRecentList, this, &MainWindow::updateRecentView); + connect(this, &MainWindow::sendStyleChangeSignal, m_viewWidget, &MainViewWidget::styleChangeSlot); changeStyle(); } @@ -467,10 +525,17 @@ void MainWindow::changeStyle() if (gsetting.keys().contains(QString("styleName"))) { if (gsetting.get("style-name").toString() == "ukui-light" || gsetting.get("style-name").toString() == "ukui-default") { + g_curStyle = "ukui-light"; buttonColorDefault = "rgba(16, 23, 29, 0.06)"; buttonColorHover = "rgba(16, 23, 29, 0.12)"; buttonColorPress = "rgba(16, 23, 29, 0.17)"; + m_windowColor.setNamedColor("#C7E9EEF2"); + Q_EMIT sendStyleChangeSignal("ukui-light"); + m_powerOffButton->setStyleSheet("QPushButton {padding: 0px;}" + "QPushButton:hover {border-radius:16px; background: rgba(255, 255, 255, 0.4);}" + "QPushButton:pressed {border-radius:16px; background: rgba(255, 255, 255, 0.65);}"); } else { + g_curStyle = "ukui-dark"; buttonColor = linePe.color(QPalette::Light); QRgb rgbDefault = qRgba(buttonColor.red(), buttonColor.green(), buttonColor.blue(), 25); buttonColorDefault = "#" + QString::number(rgbDefault, 16); @@ -478,6 +543,11 @@ void MainWindow::changeStyle() buttonColorHover = "#" + QString::number(rgbHover, 16); QRgb rgbPress = qRgba(buttonColor.red(), buttonColor.green(), buttonColor.blue(), 75); buttonColorPress = "#" + QString::number(rgbPress, 16); + m_windowColor.setNamedColor("#FF383838"); + Q_EMIT sendStyleChangeSignal("ukui-dark"); + m_powerOffButton->setStyleSheet("QPushButton {padding: 0px;}" + "QPushButton:hover {border-radius:16px; background: rgba(255, 255, 255, 0.12);}" + "QPushButton:pressed {border-radius:16px; background: rgba(255, 255, 255, 0.25);}"); } } } @@ -488,10 +558,7 @@ void MainWindow::changeStyle() m_searchPushButton->setStyleSheet(m_buttonStyle.arg("QPushButton")); m_minSelectButton->setStyleSheet(m_buttonStyle.arg("QPushButton")); m_cancelSearchPushButton->setStyleSheet(m_buttonStyle.arg("QPushButton")); - m_powerOffButton->setStyleSheet("QPushButton {padding: 0px;}" - "QPushButton:hover {border-radius:12px; background: rgba(255, 255, 255, 0.2);}" - "QPushButton:pressed {border-radius:12px; background: rgba(255, 255, 255, 0.3);}"); - m_searchPushButton->setIcon(getCurIcon(":/data/img/mainviewwidget/search.svg", true)); + m_searchPushButton->setIcon(getCurIcon(":/data/img/mainviewwidget/full-search.svg", true)); QAction *lineAction = m_lineEdit->actions().at(0); if (lineAction != nullptr) { @@ -501,7 +568,7 @@ void MainWindow::changeStyle() } QAction *action = new QAction(); - action->setIcon(getCurIcon(":/data/img/mainviewwidget/DM-icon-search.svg", true)); + action->setIcon(getCurIcon(":/data/img/mainviewwidget/full-search.svg", true)); m_lineEdit->addAction(action, QLineEdit::LeadingPosition); m_cancelSearchPushButton->setIcon(getCurIcon(":/data/img/mainviewwidget/DM-close-2x.png", true)); @@ -533,7 +600,7 @@ void MainWindow::paintEvent(QPaintEvent *event) path.quadTo(rect.bottomRight(), rect.bottomRight() + QPointF(0, -radius)); path.lineTo(rect.topRight() + QPointF(0, radius)); path.quadTo(rect.topRight(), rect.topRight() + QPointF(-radius, -0)); - painter.setBrush(this->palette().base()); + painter.setBrush(m_windowColor); painter.setPen(Qt::transparent); painter.setOpacity(transparency); painter.drawPath(path); @@ -581,7 +648,7 @@ bool MainWindow::event(QEvent *event) if (m_minSelectButton->hasFocus()) { m_minSelectButton->click(); } else if (m_selectMenuButton->hasFocus()) { - m_selectMenuButton->click(); + QApplication::postEvent(m_selectMenuButton, new QEvent(QEvent::MouseButtonPress)); } if (m_lineEdit->hasFocus()) { @@ -603,6 +670,7 @@ bool MainWindow::event(QEvent *event) void MainWindow::minAnimationFinished() { this->show(); + setMinWindowPos(); this->raise(); this->activateWindow(); m_viewWidget->setFocus(); @@ -611,8 +679,16 @@ void MainWindow::minAnimationFinished() QEventLoop loop; QTimer::singleShot(100, &loop, SLOT(quit())); loop.exec(); - m_animationPage.hide(); + m_animationPage->hide(); } + +void MainWindow::iconAnimationFinished() +{ + m_dropDownMenu->raise(); + m_dropDownMenu->exec(m_selectMenuButton->mapToGlobal(QPoint(m_selectMenuButton->width() + -Style::DropMenuWidth + 5, 29))); +} + void MainWindow::maxAnimationFinished() { m_fullWindow->raise(); @@ -621,7 +697,7 @@ void MainWindow::maxAnimationFinished() QEventLoop loop; QTimer::singleShot(100, &loop, SLOT(quit())); loop.exec(); - m_animationPage.hide(); + m_animationPage->hide(); } void MainWindow::resetLetterPage() { @@ -725,6 +801,9 @@ void MainWindow::animationFinishedSLot() } void MainWindow::on_minSelectButton_clicked() { +// selectIconAnimation(true); + selectIconAnimation(false); + if (m_leftStackedWidget->currentIndex() == 0) { on_selectMenuButton_triggered(m_letterAction); } else if (m_leftStackedWidget->currentIndex() == 1) { @@ -733,6 +812,30 @@ void MainWindow::on_minSelectButton_clicked() on_selectMenuButton_triggered(m_allAction); } } + +void MainWindow::selectIconAnimation(const bool &flag) +{ + iconAnimation = new QPropertyAnimation(m_selectMenuButton, "rotation", this); + + if (flag) { + connect(iconAnimation, &QPropertyAnimation::finished, this, &MainWindow::iconAnimationFinished); + + if (m_selectMenuButton->property("rotation") == 0) { + iconAnimation->setStartValue(0); + iconAnimation->setEndValue(-180); + } + } else { + if (m_selectMenuButton->property("rotation") == -180) { + iconAnimation->setStartValue(-180); + iconAnimation->setEndValue(0); + } + } + + iconAnimation->setEasingCurve(QEasingCurve::Linear); + iconAnimation->setDuration(300); + iconAnimation->start(QPropertyAnimation::DeleteWhenStopped); +} + bool MainWindow::eventFilter(QObject *target, QEvent *event) { if (event->type() == QEvent::MouseButtonPress) { @@ -745,6 +848,12 @@ bool MainWindow::eventFilter(QObject *target, QEvent *event) on_collectPushButton_clicked(); return false; } + + if (target == m_selectMenuButton) { + m_selectMenuButton->setIcon(getCurIcon(":/data/img/mainviewwidget/downarrow.svg", true) + .pixmap(QSize(Style::miniIconSize, Style::miniIconSize))); + selectIconAnimation(true); + } } if (event->type() == QEvent::KeyPress) { @@ -929,17 +1038,22 @@ void MainWindow::searchAppSlot(QString arg) } void MainWindow::on_selectMenuButton_triggered(QAction *arg1) { - qDebug() << "void MainWindow::on_selectMenuButton_triggered(QAction *arg1)" << m_allAction << arg1; + pointDataStruct pointData; + m_selectMenuButton->setIcon(getCurIcon(":/data/img/mainviewwidget/downarrow.svg", true).pixmap(QSize(Style::miniIconSize, Style::miniIconSize))); + selectIconAnimation(false); if (arg1 == m_allAction) { m_leftStackedWidget->setCurrentIndex(0); m_state = 0; m_minSelectButton->setIcon(getCurIcon(":/data/img/mainviewwidget/DM-all.svg", true)); -// m_minSelectButton->setIcon(QIcon(":/data/img/mainviewwidget/DM-all.svg")); m_minSelectTextLabel->setText(tr("All")); m_allAction->setChecked(true); m_letterAction->setChecked(false); m_funcAction->setChecked(false); + pointData.module = "mainWindow/selectMenuButton"; + pointData.function = "AllSelect"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); } else if (arg1 == m_letterAction) { m_leftStackedWidget->setCurrentIndex(1); m_state = 1; @@ -948,6 +1062,10 @@ void MainWindow::on_selectMenuButton_triggered(QAction *arg1) m_allAction->setChecked(false); m_letterAction->setChecked(true); m_funcAction->setChecked(false); + pointData.module = "mainWindow/selectMenuButton"; + pointData.function = "LetterSelect"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); } else if (arg1 == m_funcAction) { m_leftStackedWidget->setCurrentIndex(2); m_state = 2; @@ -956,6 +1074,10 @@ void MainWindow::on_selectMenuButton_triggered(QAction *arg1) m_allAction->setChecked(false); m_letterAction->setChecked(false); m_funcAction->setChecked(true); + pointData.module = "mainWindow/selectMenuButton"; + pointData.function = "FunctionSelect"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); } } void MainWindow::updateCollectView() @@ -971,7 +1093,15 @@ void MainWindow::updateMinAllView() void MainWindow::updateRecentView() { m_modaldata->loadDesktopVercor(); - m_recentListView->updateData(m_modaldata->getRecentData()); + QVector recentFile = m_modaldata->getRecentData(); + if (recentFile.isEmpty()) { + m_recentListView->hide(); + m_recentTextlabel->show(); + } else { + m_recentTextlabel->hide(); + m_recentListView->show(); + m_recentListView->updateData(recentFile); + } } void MainWindow::updateView() { @@ -993,15 +1123,26 @@ void MainWindow::databaseThreadCloseSlot() m_softwareDbThread->quit(); updateView(); } + void MainWindow::on_collectPushButton_clicked() { m_rightStackedWidget->setCurrentIndex(0); + pointDataStruct pointData; + pointData.module = "mainWindow/collectPushButton"; + pointData.function = "Clicked"; + pointData.functionNum = ""; + m_collectPushButton->setStyleSheet("color:#3790FA;"); + QFont collectFont(QGuiApplication::font().family(), QGuiApplication::font().pointSize() + 2); + m_collectPushButton->setFont(collectFont); QColor textColor = this->palette().color(QPalette::Text); QRgb rgbDefault = qRgb(textColor.red(), textColor.green(), textColor.blue()); QString textColorDefault = "#" + QString::number(rgbDefault, 16); m_recentPushButton->setStyleSheet(QString("color:%1;").arg(textColorDefault)); + QFont recentFont(QGuiApplication::font().family(), QGuiApplication::font().pointSize()); + m_recentPushButton->setFont(recentFont); } + void MainWindow::on_recentPushButton_clicked() { m_rightStackedWidget->setCurrentIndex(1); @@ -1009,27 +1150,52 @@ void MainWindow::on_recentPushButton_clicked() QRgb rgbDefault = qRgb(textColor.red(), textColor.green(), textColor.blue()); QString textColorDefault = "#" + QString::number(rgbDefault, 16); m_collectPushButton->setStyleSheet(QString("color:%1").arg(textColorDefault)); -// m_collectPushButton->setStyleSheet("color:white"); + QFont collectFont(QGuiApplication::font().family(), QGuiApplication::font().pointSize()); + m_collectPushButton->setFont(collectFont); m_recentPushButton->setStyleSheet("color:#3790FA"); + + pointDataStruct pointData; + pointData.module = "mainWindow/recentPushButton"; + pointData.function = "Clicked"; + pointData.functionNum = ""; + + QFont recentFont(QGuiApplication::font().family(), QGuiApplication::font().pointSize() + 2); + m_recentPushButton->setFont(recentFont); + updateRecentView(); } void MainWindow::on_cancelSearchPushButton_clicked() { m_topStackedWidget->setCurrentIndex(0); m_lineEdit->clear(); + pointDataStruct pointData; + pointData.module = "mainWindow/cancelSearchPushButton"; + pointData.function = "Clicked"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); } void MainWindow::on_searchPushButton_clicked() { m_topStackedWidget->setCurrentIndex(1); m_lineEdit->setFocus(); + pointDataStruct pointData; + pointData.module = "mainWindow/searchPushButton"; + pointData.function = "Clicked"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); } void MainWindow::on_minMaxChangeButton_clicked() { m_canHide = true; m_isFullScreen = true; - m_animationPage.setGeometry(this->x(), this->y(), Style::minw, Style::minh); - m_animationPage.show(); - m_animationPage.raise(); - m_animationPage.repaint(); + + m_animationPage->show(); + if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { + kdk::WindowManager::setGeometry(m_animationPage->windowHandle(), QRect(this->x(), this->y(), Style::minw, Style::minh)); + } else { + m_animationPage->setGeometry(this->x(), this->y(), Style::minw, Style::minh); + } + m_animationPage->raise(); + m_animationPage->repaint(); QEventLoop loop; QTimer::singleShot(100, &loop, SLOT(quit())); loop.exec(); @@ -1040,6 +1206,11 @@ void MainWindow::on_minMaxChangeButton_clicked() m_maxAnimation->setDuration(260); m_maxAnimation->start(); this->hide(); + pointDataStruct pointData; + pointData.module = "mainWindow/minMaxChangeButton"; + pointData.function = "Clicked"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); } void MainWindow::showWindow() { @@ -1047,13 +1218,24 @@ void MainWindow::showWindow() m_fullWindow->raise(); m_fullWindow->showNormal(); m_fullWindow->activateWindow(); + pointDataStruct pointData; + pointData.module = "fullWindow"; + pointData.function = "Show"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); } else { this->raise(); this->showNormal(); + setMinWindowPos(); this->activateWindow(); // m_collectPushButton->clicked(true); on_collectPushButton_clicked(); m_viewWidget->setFocus(); + pointDataStruct pointData; + pointData.module = "mainWindow"; + pointData.function = "Show"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); } } void MainWindow::hideWindow() @@ -1062,16 +1244,25 @@ void MainWindow::hideWindow() m_fullWindow->hide(); this->clearFocus(); m_isFullScreen = true; + pointDataStruct pointData; + pointData.module = "fullWindow"; + pointData.function = "Hide"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); } else { this->hide(); this->clearFocus(); m_isFullScreen = false; + pointDataStruct pointData; + pointData.module = "mainWindow"; + pointData.function = "Hide"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); } } -void MainWindow::repaintWidget() + +void MainWindow::setMinWindowPos() { - Style::initWidStyle(); - this->setMinimumSize(Style::minw, Style::minh); int position = Style::m_panelPosition; int x = Style::m_primaryScreenX; int y = Style::m_primaryScreenY; @@ -1079,15 +1270,37 @@ void MainWindow::repaintWidget() int height = Style::m_availableScreenHeight; if (position == 0) { - this->setGeometry(QRect(x + 4, y + height - Style::minh - 3, Style::minw, Style::minh)); + if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { + kdk::WindowManager::setGeometry(this->windowHandle(), QRect(x + 4, y + height - Style::minh - 3, Style::minw, Style::minh)); + } else { + this->setGeometry(QRect(x + 4, y + height - Style::minh - 3, Style::minw, Style::minh)); + } } else if (position == 1) { - this->setGeometry(QRect(x + 4, y + 4, Style::minw, Style::minh)); + if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { + kdk::WindowManager::setGeometry(this->windowHandle(), QRect(x + 4, y + 4, Style::minw, Style::minh)); + } else { + this->setGeometry(QRect(x + 4, y + 4, Style::minw, Style::minh)); + } } else if (position == 2) { - this->setGeometry(QRect(x + 4, y + 4, Style::minw, Style::minh)); + if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { + kdk::WindowManager::setGeometry(this->windowHandle(), QRect(x + 4, y + 4, Style::minw, Style::minh)); + } else { + this->setGeometry(QRect(x + 4, y + 4, Style::minw, Style::minh)); + } } else { - this->setGeometry(QRect(x + width - Style::minw - 4, y + 4, Style::minw, Style::minh)); + if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { + kdk::WindowManager::setGeometry(this->windowHandle(), QRect(x + width - Style::minw - 4, y + 4, Style::minw, Style::minh)); + } else { + this->setGeometry(QRect(x + width - Style::minw - 4, y + 4, Style::minw, Style::minh)); + } } +} +void MainWindow::repaintWidget() +{ + Style::initWidStyle(); + this->setMinimumSize(Style::minw, Style::minh); + setMinWindowPos(); m_fullWindow->move(x, y); m_fullWindow->setFixedSize(width, height); m_fullWindow->repaintWidget(); @@ -1095,10 +1308,14 @@ void MainWindow::repaintWidget() void MainWindow::showNormalWindowSlot() { myDebug() << "Style::m_availableScreenWidth" << Style::m_availableScreenWidth << "Style::m_availableScreenHeight" << Style::m_availableScreenHeight; - m_animationPage.setGeometry(0, 0, Style::m_availableScreenWidth, Style::m_availableScreenHeight); - m_animationPage.show(); - m_animationPage.raise(); - myDebug() << m_animationPage.rect(); + m_animationPage->show(); + if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { + kdk::WindowManager::setGeometry(m_animationPage->windowHandle(), QRect(0, 0, Style::m_availableScreenWidth, Style::m_availableScreenHeight)); + } else { + m_animationPage->setGeometry(0, 0, Style::m_availableScreenWidth, Style::m_availableScreenHeight); + } + m_animationPage->raise(); + myDebug() << m_animationPage->rect(); QEventLoop loop; QTimer::singleShot(100, &loop, SLOT(quit())); loop.exec(); @@ -1113,10 +1330,20 @@ void MainWindow::showNormalWindowSlot() void MainWindow::on_powerOffButton_clicked() { QProcess::startDetached(QString("ukui-session-tools")); + pointDataStruct pointData; + pointData.module = "mainWindow/powerOffButton"; + pointData.function = "Clicked"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); } void MainWindow::on_powerOffButton_customContextMenuRequested(const QPoint &pos) { RightClickMenu m_otherMenu(this); m_otherMenu.showShutdownMenu(this->mapToGlobal(m_centralwidget->rect().bottomRight())); + pointDataStruct pointData; + pointData.module = "mainWindow/powerOffButton"; + pointData.function = "RightClicked"; + pointData.functionNum = ""; + BuriedPointDataSend::getInstance()->setPoint(pointData); qDebug() << "SideBarWidget::shutdownBtnRightClickSlot() 开始"; } diff --git a/src/UserInterface/mainwindow.h b/src/UserInterface/mainwindow.h index b551565..9c1bcad 100755 --- a/src/UserInterface/mainwindow.h +++ b/src/UserInterface/mainwindow.h @@ -53,6 +53,9 @@ #include "function_button_widget.h" #include "letter_button_widget.h" #include "animationpage.h" +#include "rotationlabel.h" +#include "ukuistylehelper/ukuistylehelper.h" +#include "windowmanager/windowmanager.h" class MainWindow : public QMainWindow { @@ -100,12 +103,17 @@ protected: // void mouseReleaseEvent(QMouseEvent *event); + void selectIconAnimation(const bool &flag); + + void setMinWindowPos(); + public: Q_SIGNALS: void sendSearchKeyword(QString arg); void sendClassificationbtnList(); void sendLetterClassificationList(QStringList list); void sendSetFullWindowItemHide(bool flag); + void sendStyleChangeSignal(QString style); public Q_SLOTS: void updateCollectView(); @@ -122,6 +130,7 @@ public Q_SLOTS: void resetFunctionPage(); void minAnimationFinished(); void maxAnimationFinished(); + void iconAnimationFinished(); void changeStyle(); private Q_SLOTS: void on_selectMenuButton_triggered(QAction *arg1); @@ -160,7 +169,7 @@ private: QSpacerItem *m_horizontalSpacer = nullptr; QPushButton *m_searchPushButton = nullptr; QPushButton *m_minSelectButton = nullptr; - QToolButton *m_selectMenuButton = nullptr; + RotationLabel *m_selectMenuButton = nullptr; QWidget *m_minSearchPage = nullptr; QHBoxLayout *m_leftTopSearchHorizontalLayout = nullptr; QLineEdit *m_lineEdit = nullptr; @@ -189,11 +198,14 @@ private: RightListView *m_collectListView = nullptr; QWidget *m_recentPage = nullptr; ListView *m_recentListView = nullptr; + QLabel *m_recentTextlabel = nullptr; QSpacerItem *m_verticalSpacer_2 = nullptr; QHBoxLayout *m_rightBottomHorizontalLayout = nullptr; QSpacerItem *m_horizontalSpacer_2 = nullptr; + QSpacerItem *m_horizontalSpacer_4 = nullptr; QPushButton *m_powerOffButton = nullptr; - AnimationPage m_animationPage; + AnimationPage *m_animationPage = nullptr; + MenuBox *m_dropDownMenu = nullptr; bool m_canHide = true; bool m_isFullScreen = false; @@ -214,10 +226,12 @@ private: QPropertyAnimation *m_leaveAnimation = nullptr; QPropertyAnimation *m_minAnimation = nullptr; QPropertyAnimation *m_maxAnimation = nullptr; + QPropertyAnimation *iconAnimation = nullptr; int m_widgetState = -1; FunctionButtonWidget *m_functionBtnWid = nullptr; LetterButtonWidget *m_letterBtnWid = nullptr; SoftwareDatabaseUpdateThread *m_softwareDbThread = nullptr; + QColor m_windowColor; }; #endif // MAINWINDOW_H diff --git a/src/UserInterface/tabletwindow.cpp b/src/UserInterface/tabletwindow.cpp index 45f3152..4f26924 100755 --- a/src/UserInterface/tabletwindow.cpp +++ b/src/UserInterface/tabletwindow.cpp @@ -98,28 +98,6 @@ void TabletWindow::initUi() initStatusManager(); initTransparency(); registDbusService(); - /*//备用待窗管修改后启用 - connect(m_dbus, &DBus::winKeyResponseSignal, this, [ = ] { - if (QGSettings::isSchemaInstalled(QString("org.ukui.session").toLocal8Bit())) - { - QGSettings gsetting(QString("org.ukui.session").toLocal8Bit()); - if (gsetting.keys().contains("winKeyRelease")) { - if (gsetting.get(QString("winKeyRelease")).toBool()) { - return; - } - } - } - if (QApplication::activeWindow() == this) - { - myDebug() << "win键触发窗口隐藏事件"; - this->hide(); - } else - { - myDebug() << "win键触发窗口显示事件"; - this->showPCMenu(); - } - }); - */ ways(); buttonWidgetShow(); connect(m_leftWidget, &FunctionWidget::hideTabletWindow, this, &TabletWindow::recvHideMainWindowSlot); @@ -232,15 +210,13 @@ void TabletWindow::setBackground() void TabletWindow::registDbusService() { - m_dbus = new DBus; - new MenuAdaptor(m_dbus); - QDBusConnection con = QDBusConnection::sessionBus(); - - if (!con.registerService("org.ukui.menu") || - !con.registerObject("/org/ukui/menu", m_dbus)) { - qDebug() << "error:" << con.lastError().message(); - } - +// m_dbus = new DBus; +// new MenuAdaptor(m_dbus); +// QDBusConnection con = QDBusConnection::sessionBus(); +// if (!con.registerService("org.ukui.menu") || +// !con.registerObject("/org/ukui/menu", m_dbus)) { +// qDebug() << "error:" << con.lastError().message(); +// } // connect(m_dbus, &DBus::winKeyResponseSignal, this, [ = ] { // if (QGSettings::isSchemaInstalled(QString("org.ukui.session").toLocal8Bit())) // { @@ -261,21 +237,6 @@ void TabletWindow::registDbusService() // this->showPCMenu(); // } // }); - ways(); - buttonWidgetShow(); -// connect(this,&TabletWindow::pagenumchanged,this,&TabletWindow::pageNumberChanged); - connect(m_leftWidget, &FunctionWidget::hideTabletWindow, this, &TabletWindow::recvHideMainWindowSlot); - - if (checkapplist()) { - directoryChangedSlot();//更新应用列表 - } - - //pc下鼠标功能 - XEventMonitor::instance()->start(); - connect(XEventMonitor::instance(), SIGNAL(keyRelease(QString)), - this, SLOT(XkbEventsRelease(QString))); - connect(XEventMonitor::instance(), SIGNAL(keyPress(QString)), - this, SLOT(XkbEventsPress(QString))); } bool TabletWindow::checkapplist() @@ -413,6 +374,8 @@ void TabletWindow::showPCMenu() this->raise(); this->activateWindow(); g_menuStatus = true; + menuStatusChange(); + myDebug() << "showMenu显示开始菜单"; } //改变搜索框及工具栏透明度 @@ -560,9 +523,10 @@ bool TabletWindow::event(QEvent *event) //if(QEvent::WindowDeactivate == event->type())//窗口停用 { if (QApplication::activeWindow() != this) { - qDebug() << " * 鼠标点击窗口外部事件"; + myDebug() << " * 鼠标点击窗口外部事件"; this->hide(); g_menuStatus = false; + menuStatusChange(); } } @@ -576,6 +540,7 @@ bool TabletWindow::event(QEvent *event) if (!(m_scrollAnimation->state() == QPropertyAnimation::Running)) { this->hide(); g_menuStatus = false; + myDebug() << "鼠标点击事件触发隐藏"; } } @@ -642,65 +607,71 @@ void TabletWindow::insertAppList(QStringList desktopfplist) */ void TabletWindow::execApplication(QString desktopfp) { -// Q_EMIT sendHideMainWindowSignal(); -// execApp(desktopfp); - QString str; - //打开文件.desktop - GError **error = nullptr; - GKeyFileFlags flags = G_KEY_FILE_NONE; - GKeyFile *keyfile = g_key_file_new(); - QByteArray fpbyte = desktopfp.toLocal8Bit(); - char *filepath = fpbyte.data(); - g_key_file_load_from_file(keyfile, filepath, flags, error); - char *name = g_key_file_get_locale_string(keyfile, "Desktop Entry", "Exec", nullptr, nullptr); - //取出value值 - QString execnamestr = QString::fromLocal8Bit(name); - str = execnamestr; - //qDebug()<<"2 exec"<beginGroup("application"); - QString desktopfp1 = str; - //判断 - bool bo = m_disableAppSet->contains(desktopfp1.toLocal8Bit().data()); // iskey - bool bo1 = m_disableAppSet->QSettings::value(desktopfp1.toLocal8Bit().data()).toBool(); //isvalue - m_disableAppSet->endGroup(); - - if (bo && bo1 == false) { //都存在//存在并且为false,从filepathlist中去掉 - //qDebug()<<"bool"<(iface.call("LaunchApp", desktopfp)))) { + execApp(desktopfp); + QString str; + //打开文件.desktop + GError **error = nullptr; + GKeyFileFlags flags = G_KEY_FILE_NONE; + GKeyFile *keyfile = g_key_file_new(); + QByteArray fpbyte = desktopfp.toLocal8Bit(); + char *filepath = fpbyte.data(); + g_key_file_load_from_file(keyfile, filepath, flags, error); + char *name = g_key_file_get_locale_string(keyfile, "Desktop Entry", "Exec", nullptr, nullptr); + //取出value值 + QString execnamestr = QString::fromLocal8Bit(name); + str = execnamestr; + //qDebug()<<"2 exec"<beginGroup("application"); + QString desktopfp1 = str; + //判断 + bool bo = m_disableAppSet->contains(desktopfp1.toLocal8Bit().data()); // iskey + bool bo1 = m_disableAppSet->QSettings::value(desktopfp1.toLocal8Bit().data()).toBool(); //isvalue + m_disableAppSet->endGroup(); + + if (bo && bo1 == false) { //都存在//存在并且为false,从filepathlist中去掉 + //qDebug()<<"bool"<setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint); this->hide(); g_menuStatus = false; + myDebug() << "信号触发隐藏窗口"; } void TabletWindow::btnGroupClickedSlot(int prePageNum, int pageNum) @@ -1080,7 +1052,7 @@ void TabletWindow::winKeyReleaseSlot(const QString &key) if (QGSettings::isSchemaInstalled(QString("org.ukui.session").toLocal8Bit())) { QGSettings gsetting(QString("org.ukui.session").toLocal8Bit()); - if (gsetting.keys().contains("winKeyRelease")) + if (gsetting.keys().contains("winKeyRelease")) { if (gsetting.get(QString("winKeyRelease")).toBool()) { disconnect(XEventMonitor::instance(), SIGNAL(keyRelease(QString)), this, SLOT(xkbEventsRelease(QString))); @@ -1092,7 +1064,16 @@ void TabletWindow::winKeyReleaseSlot(const QString &key) connect(XEventMonitor::instance(), SIGNAL(keyPress(QString)), this, SLOT(xkbEventsPress(QString))); } + } } } } +void TabletWindow::menuStatusChange() +{ + QDBusMessage message = QDBusMessage::createSignal("/com/ukui/menu", "com.ukui.menu", "statusChangeSignal"); + //给信号赋值 + message << g_menuStatus; + //发射 + QDBusConnection::sessionBus().send(message); +} diff --git a/src/UserInterface/tabletwindow.h b/src/UserInterface/tabletwindow.h index efb1a2d..7b6a03d 100755 --- a/src/UserInterface/tabletwindow.h +++ b/src/UserInterface/tabletwindow.h @@ -46,8 +46,6 @@ #include "tabletlistview.h" #include "pagemanager.h" #include "tablet_directorychanged_thread.h" -#include "dbus.h" -#include "dbus-adaptor.h" class TabletWindow : public QWidget { @@ -123,8 +121,9 @@ private: QFileSystemWatcher *m_configFileWatcher = nullptr; TabletDirectoryChangedThread *m_directoryChangedThread = nullptr; QSettings *m_disableAppSet = nullptr; - DBus *m_dbus = nullptr; + QLabel m_animationPage; +// DBus *m_dbus = nullptr; protected: /** @@ -183,6 +182,8 @@ protected: bool checkapplist(); + void menuStatusChange(); + public Q_SLOTS: /** * @brief Open the application diff --git a/src/UserInterface/userinterface.pri b/src/UserInterface/userinterface.pri index 1bc7ffe..56b58f8 100755 --- a/src/UserInterface/userinterface.pri +++ b/src/UserInterface/userinterface.pri @@ -18,6 +18,7 @@ HEADERS += \ $$PWD/ListView/tabletlistview.h \ $$PWD/Other/classify_btn_scrollarea.h \ $$PWD/Other/lettertooltip.h \ + $$PWD/Other/rotationlabel.h \ $$PWD/Other/scrollarea.h \ $$PWD/RightClickMenu/menubox.h \ $$PWD/RightClickMenu/rightclickmenu.h \ @@ -55,6 +56,7 @@ SOURCES += \ $$PWD/ListView/tabletlistview.cpp \ $$PWD/Other/classify_btn_scrollarea.cpp \ $$PWD/Other/lettertooltip.cpp \ + $$PWD/Other/rotationlabel.cpp \ $$PWD/Other/scrollarea.cpp \ $$PWD/RightClickMenu/menubox.cpp \ $$PWD/RightClickMenu/rightclickmenu.cpp \ diff --git a/src/UtilityFunction/Style/style.cpp b/src/UtilityFunction/Style/style.cpp index dcc3831..a7ea91a 100755 --- a/src/UtilityFunction/Style/style.cpp +++ b/src/UtilityFunction/Style/style.cpp @@ -76,6 +76,8 @@ int Style::SideBarWidWidth = 0; int Style::appLine = 0; int Style::appColumn = 0; +int Style::appLineFirst = 0; +int Style::appColumnFirst = 0; int Style::appPage = 1; int Style::appNum = 0; int Style::nowpagenum = 1; @@ -100,6 +102,13 @@ int Style::ButtonWidgetWidth = 56; int Style::ToolWidgetLeft = 24; bool Style::IsWideScreen = false; +int Style::DropMenuWidth = 0; +int Style::DropMenuHeight = 0; +int Style::miniIconSize = 0; + +int Style::rightViewWidth = 0; +int Style::rightViewHeight = 0; + void Style::initWidStyle() { if (!g_projectCodeName.contains("V10SP1-edu")) { @@ -121,10 +130,12 @@ void Style::initWidStyle() if (m_availableScreenWidth == 800 && m_availableScreenHeight == 600) { minw = 320; minh = 500; + leftPageWidth = 300; + leftPageHeight = 517; } else { minw = 652; minh = 590; - leftPageWidth = 292; + leftPageWidth = 300; leftPageHeight = 517; } @@ -194,11 +205,16 @@ void Style::initWidStyle() AppSpaceBetweenIconText = 14; } - LeftBtnWidth = 100 + 5 * len; - LeftBtnHeight = 43; + LeftBtnWidth = 68 + 5 * len; + LeftBtnHeight = 34; QueryLineEditHeight = 30; LeftLetterBtnHeight = 25; LeftIconSize = 19; + DropMenuWidth = 140; + DropMenuHeight = 112; + miniIconSize = 8; + rightViewWidth = 324; + rightViewHeight = 470; LeftSpaceIconText = 14; m_applistWidWidth = m_availableScreenWidth / 1.25; m_applistWidWidth = m_applistWidWidth - (m_applistWidWidth % m_applistGridSizeWidth) + 1; @@ -208,23 +224,25 @@ void Style::initWidStyle() } else { ScreenWidth = QApplication::primaryScreen()->geometry().width(); ScreenHeight = QApplication::primaryScreen()->geometry().height(); - - if (ScreenHeight != 1080) { - AppListViewTopMargin = 30; - } else { - AppListViewTopMargin = 70; - } - + myDebug() << "Winches" << qApp->desktop()->widthMM(); + myDebug() << "Hinches" << qApp->desktop()->heightMM(); + myDebug() << "ScreenWidth" << ScreenWidth; + myDebug() << "ScreenHeight" << ScreenHeight; + appColumn = 6; + appLine = 4; + appLineFirst = 4; + AppListViewTopMargin = 70; AppListViewLeftMargin = 52; AppListViewBottomMargin = AppListViewTopMargin - 30; AppListViewRightMargin = 0; m_leftWidWidth = ScreenWidth * 0.3; FirsPageViewWidth = ScreenWidth - m_leftWidWidth - 5; + appColumnFirst = FirsPageViewWidth / 220; OtherPageViewWidth = ScreenWidth; - TabletItemSizeWidthFirst = FirsPageViewWidth / 6; - TabletItemSizeWidthOther = (ScreenWidth - 5) / 6; + TabletItemSizeWidthFirst = FirsPageViewWidth / appColumnFirst; + TabletItemSizeWidthOther = (ScreenWidth - 5) / appColumn; CenterWindHeight = ScreenHeight - AppListViewBottomMargin - AppListViewTopMargin; - AppListItemSizeHeight = CenterWindHeight / 4; + AppListItemSizeHeight = CenterWindHeight / appLine; AppListIconSize = 96; AppListBigIconSize = 108; AppTopSpace = (AppListItemSizeHeight - AppListIconSize) / 2; diff --git a/src/UtilityFunction/Style/style.h b/src/UtilityFunction/Style/style.h index 09ab7dd..a74e0da 100755 --- a/src/UtilityFunction/Style/style.h +++ b/src/UtilityFunction/Style/style.h @@ -133,6 +133,8 @@ public: static int appLine; static int appColumn; + static int appLineFirst; + static int appColumnFirst; static int appNum; static int appPage; static int nowpagenum; @@ -169,7 +171,12 @@ public: static int WideAppListItemSizeHeight; static int WideAppViewLeftMargin; static bool IsWideScreen; + static int DropMenuWidth; + static int DropMenuHeight; + static int miniIconSize; + static int rightViewWidth; + static int rightViewHeight; }; diff --git a/src/UtilityFunction/abstractInterface.h b/src/UtilityFunction/abstractInterface.h index 255507a..90ed8ff 100755 --- a/src/UtilityFunction/abstractInterface.h +++ b/src/UtilityFunction/abstractInterface.h @@ -1,20 +1,13 @@ -#ifndef OOBE_PLUGIN_INFACE_H -#define OOBE_PLUGIN_INFACE_H - -#include -#include -#include +#ifndef ABSTRACTINTERFACE_H +#define ABSTRACTINTERFACE_H #include - class QWidget; -class kyMenuPluginInterface +class AbstractInterface { - public: - virtual ~kyMenuPluginInterface() {} - virtual const QString name() = 0; - virtual const QString description() = 0; - virtual QWidget *createWidget(QWidget *parent) = 0; + virtual ~AbstractInterface() {} + virtual QWidget *createPluginWidget(QWidget *parent, bool type) = 0; }; -Q_DECLARE_INTERFACE(kyMenuPluginInterface, "org.kyMenuPlugin.AbstractInterface") -#endif +#define AbstractInterface_iid "Welcome to use focusmode" +Q_DECLARE_INTERFACE(AbstractInterface, AbstractInterface_iid) +#endif // ABSTRACTINTERFACE_H diff --git a/src/UtilityFunction/utility.cpp b/src/UtilityFunction/utility.cpp index c7e4521..3eee325 100755 --- a/src/UtilityFunction/utility.cpp +++ b/src/UtilityFunction/utility.cpp @@ -28,10 +28,14 @@ #include #include #include +#include "ukuimenuinterface.h" #define DATABASENAME QDir::homePath()+"/.config/ukui/"+"UkuiMenu.db" QString g_projectCodeName = "V10SP1"; +QString g_subProjectCodeName = ""; +QString g_platform = ""; bool g_menuStatus = false; +QString g_curStyle = ""; const QPixmap loadSvg(const QString &fileName, const int size) { @@ -370,6 +374,27 @@ bool updateDataBaseTableTimes(QString desktopfn) return ret; } +bool dataBaseIsEmpty() +{ + QSqlDatabase db = QSqlDatabase::database("MainThreadDataBase"); + QSqlQuery sql(db); + QString cmd; + cmd = QString("select * from appInfo"); + if (sql.exec(cmd)) { + if (!sql.next()) { + return true; + } else { + if (sql.value(0).toString() == "") { + return true; + } else { + return false; + } + } + return false; + } + return false; +} + bool updateDataBaseCollect(QString desktopfn, int type) { bool ret = false; diff --git a/src/UtilityFunction/utility.h b/src/UtilityFunction/utility.h index 75c43e7..9d5f7a9 100755 --- a/src/UtilityFunction/utility.h +++ b/src/UtilityFunction/utility.h @@ -25,7 +25,6 @@ #include #include #include -#include "ukuimenuinterface.h" #define DBUS_NAME "org.ukui.panel" #define DBUS_PATH "/panel/position" @@ -33,6 +32,26 @@ #define myDebug() qDebug() << QString("%1 %2 行 %3").arg(__FILE__).arg(__FUNCTION__).arg(__LINE__) +typedef struct pointDataStruct { + QString module; + QString function; + QString functionNum; + QStringList otherFunction; + QString errorLevel; + QString errorOutput; + QString timeStamp; + pointDataStruct() + { + module = QString(); + function = QString(); + functionNum = QString(); + otherFunction = QStringList(); + errorLevel = QString(); + errorOutput = QString(); + timeStamp = QString(); + } +} pointDataStruct; + static int collectCount = 0; const QPixmap loadSvg(const QString &fileName, const int size); @@ -60,6 +79,7 @@ bool checkIfRecent(QString desktopfn);//检查是否最近安装 bool checkIfCollected(QString desktopfn); QStringList getCollectAppList(); void changeCollectSort(QString dragDesktopfn, QString dropDesktopfn); +bool dataBaseIsEmpty();//判断数据库是否为空 bool updateDataBaseCollect(QString desktopfn, int type); QStringList getLockAppList();//获取被锁定应用 QStringList getUnlockAllList();//获取未被锁定应用 @@ -86,7 +106,10 @@ enum PanelPositon { }; extern QString g_projectCodeName; +extern QString g_subProjectCodeName; +extern QString g_platform; extern bool g_menuStatus; +extern QString g_curStyle; #endif // UTILITY_H diff --git a/translations/ukui-menu_bo.ts b/translations/ukui-menu_bo.ts index 1b61e67..85e856d 100755 --- a/translations/ukui-menu_bo.ts +++ b/translations/ukui-menu_bo.ts @@ -4,22 +4,22 @@ FullMainWindow - + Search - + All - + Letter - + Function @@ -27,7 +27,7 @@ FunctionWidget - + Search @@ -35,51 +35,56 @@ MainWindow - - ... - - - - + collection - - - + + + All - + Search - + + No recent files + + + + recent - + Max - + PowerOff - - + + Search application + + + + + Letter - - + + Function @@ -156,82 +161,82 @@ RightClickMenu - + Pin to all - + Unpin from all - + Pin to taskbar - + Unpin from taskbar - + Add to desktop shortcuts - + Pin to collection - + Remove from collection - + Uninstall - + Switch user - + Hibernate - + Sleep - + Lock Screen - + Log Out - + Restart - + Power Off - + Personalize this list diff --git a/translations/ukui-menu_tr.ts b/translations/ukui-menu_tr.ts index 6dc6e3e..3e5245e 100755 --- a/translations/ukui-menu_tr.ts +++ b/translations/ukui-menu_tr.ts @@ -4,22 +4,22 @@ FullMainWindow - + Search Ara - + All Tümü - + Letter Alfabetik - + Function Kategori @@ -118,7 +118,7 @@ Diğer - + Search Ara @@ -192,51 +192,56 @@ MainWindow - - ... - - - - + collection - - - + + + All Tümü - + Search Ara - + + No recent files + + + + recent - + Max - + PowerOff - - + + Search application + + + + + Letter Alfabetik - - + + Function Kategori @@ -360,62 +365,62 @@ RightClickMenu - + Pin to all Tümünü sabitle - + Unpin from all Tüm sabitlemeleri kaldır - + Pin to taskbar Görev çubuğuna sabitle - + Unpin from taskbar Görev çubuğundan sabitlemeyi kaldır - + Add to desktop shortcuts Masaüstü kısayollarına ekle - + Pin to collection - + Remove from collection - + Uninstall Kaldır - + Switch user - + Hibernate Beklemeye Al - + Sleep Uyku Modu - + Lock Screen Ekranı Kilitle @@ -424,22 +429,22 @@ Kullanıcı Değiştir - + Log Out Çıkış - + Restart Yeniden Başlat - + Power Off Kapat - + Personalize this list Bu listeyi özelleştirin diff --git a/translations/ukui-menu_zh_CN.ts b/translations/ukui-menu_zh_CN.ts index d4abdca..9ed9981 100755 --- a/translations/ukui-menu_zh_CN.ts +++ b/translations/ukui-menu_zh_CN.ts @@ -4,22 +4,22 @@ FullMainWindow - + Search 搜索应用 - + All 全部 - + Letter 字母排序 - + Function 功能分类 @@ -27,7 +27,7 @@ FunctionWidget - + Search 全局搜索 @@ -35,51 +35,56 @@ MainWindow - + Search 搜索应用 - - - - All - 全部 + + No recent files + 暂无最近文件 - - ... - + + + + All + 全部 - + collection 收藏 - + recent 最近 - + Max 放大 - + PowerOff 关机 - - + + Search application + 搜索应用 + + + + Letter 字母排序 - - + + Function 功能分类 @@ -156,82 +161,82 @@ RightClickMenu - + Pin to all 固定到“所有软件” - + Unpin from all 从“所有软件”取消固定 - + Pin to taskbar 固定到任务栏 - + Unpin from taskbar 从任务栏取消固定 - + Add to desktop shortcuts 添加到桌面快捷方式 - + Pin to collection 固定到收藏 - + Remove from collection 从收藏移除 - + Uninstall 卸载 - + Switch user 切换用户 - + Hibernate 休眠 - + Sleep 睡眠 - + Lock Screen 锁屏 - + Log Out 注销 - + Restart 重启 - + Power Off 关机 - + Personalize this list diff --git a/ukui-menu.pro b/ukui-menu.pro index 9cf7362..bb62748 100755 --- a/ukui-menu.pro +++ b/ukui-menu.pro @@ -48,11 +48,11 @@ INSTALLS += qm_files # So we can access it from main.cpp DEFINES += QM_FILES_INSTALL_PATH='\\"$${QM_FILES_INSTALL_PATH}\\"' -PKGCONFIG+=glib-2.0 gio-unix-2.0 gsettings-qt libbamf3 x11 xtst +PKGCONFIG+=glib-2.0 gio-unix-2.0 gsettings-qt libbamf3 x11 xtst kysdk-waylandhelper CONFIG += no_keywords link_pkgconfig -LIBS+=-pthread -luchardet -lukui-log4qt -lukui-com4c -lukui-com4cxx -lpeony +LIBS+=-pthread -luchardet -lukui-log4qt -lukui-com4c -lukui-com4cxx -lpeony -ldl -lcrypto desktop_file.files = ukui-menu.desktop desktop_file.path = /etc/xdg/autostart @@ -63,7 +63,7 @@ INSTALLS += \ FORMS += SOURCES += \ - main.cpp + main.cpp \ RESOURCES += \ res.qrc -- Gitee From bdacd49c7c5b459e7cf0b9e6869aa9097a8a811e Mon Sep 17 00:00:00 2001 From: lixueman <11020448+lixueman0110@user.noreply.gitee.com> Date: Sun, 19 Jun 2022 00:02:18 +0000 Subject: [PATCH 2/9] update src/UtilityFunction/abstractInterface.h. --- src/UtilityFunction/abstractInterface.h | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/UtilityFunction/abstractInterface.h b/src/UtilityFunction/abstractInterface.h index 90ed8ff..f484d73 100755 --- a/src/UtilityFunction/abstractInterface.h +++ b/src/UtilityFunction/abstractInterface.h @@ -1,13 +1,20 @@ -#ifndef ABSTRACTINTERFACE_H -#define ABSTRACTINTERFACE_H +#ifndef OOBE_PLUGIN_INFACE_H +#define OOBE_PLUGIN_INFACE_H + +#include +#include +#include #include + class QWidget; -class AbstractInterface +class kyMenuPluginInterface { + public: - virtual ~AbstractInterface() {} - virtual QWidget *createPluginWidget(QWidget *parent, bool type) = 0; + virtual ~kyMenuPluginInterface() {} + virtual const QString name() = 0; + virtual const QString description() = 0; + virtual QWidget *createWidget(QWidget *parent) = 0; }; -#define AbstractInterface_iid "Welcome to use focusmode" -Q_DECLARE_INTERFACE(AbstractInterface, AbstractInterface_iid) -#endif // ABSTRACTINTERFACE_H +Q_DECLARE_INTERFACE(kyMenuPluginInterface, "org.kyMenuPlugin.AbstractInterface") +#endif \ No newline at end of file -- Gitee From f3d06aa00a2a3663529e7c7d8267e1b8e8f436f3 Mon Sep 17 00:00:00 2001 From: lixueman <11020448+lixueman0110@user.noreply.gitee.com> Date: Sun, 19 Jun 2022 00:06:06 +0000 Subject: [PATCH 3/9] update debian/changelog. --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 4d7ef5c..ccecdaf 100755 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +ukui-menu (3.20.0.3-0k0) yangtze; urgency=medium + + * 3.20版本提交 + + -- lixueman Sat, 18 Jun 2022 21:42:59 +0800 + ukui-menu (3.1.1-0k0) yangtze; urgency=medium * 版本号规范化 -- Gitee From 44b9fc732725e856b146ef52c050aff3428857a2 Mon Sep 17 00:00:00 2001 From: lixueman Date: Mon, 20 Jun 2022 08:21:04 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E7=BC=BA=E5=A4=B1=E7=BC=96=E8=AF=91=E5=A4=B1=E8=B4=A5=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../img/mainviewwidget/DM-icon-option.svg | 0 src/UserInterface/mainwindow.cpp | 4 ++++ 2 files changed, 4 insertions(+) rename "data/img/mainviewwidget/DM-icon-\351\200\211\351\241\271.svg" => data/img/mainviewwidget/DM-icon-option.svg (100%) diff --git "a/data/img/mainviewwidget/DM-icon-\351\200\211\351\241\271.svg" b/data/img/mainviewwidget/DM-icon-option.svg similarity index 100% rename from "data/img/mainviewwidget/DM-icon-\351\200\211\351\241\271.svg" rename to data/img/mainviewwidget/DM-icon-option.svg diff --git a/src/UserInterface/mainwindow.cpp b/src/UserInterface/mainwindow.cpp index 4aee570..ccc8fe1 100755 --- a/src/UserInterface/mainwindow.cpp +++ b/src/UserInterface/mainwindow.cpp @@ -1300,6 +1300,10 @@ void MainWindow::repaintWidget() { Style::initWidStyle(); this->setMinimumSize(Style::minw, Style::minh); + int x = Style::m_primaryScreenX; + int y = Style::m_primaryScreenY; + int width = Style::m_availableScreenWidth; + int height = Style::m_availableScreenHeight; setMinWindowPos(); m_fullWindow->move(x, y); m_fullWindow->setFixedSize(width, height); -- Gitee From e31ed7db7c48631be77091a8d67eb9bc3df21da8 Mon Sep 17 00:00:00 2001 From: lixueman Date: Mon, 20 Jun 2022 08:26:38 +0800 Subject: [PATCH 5/9] op --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 267bb30..a1a551e 100755 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -ukui-menu (3.20.0.3-0k0) yangtze; urgency=medium +ukui-menu (3.20.0.3-0k1) yangtze; urgency=medium * 3.20版本提交 @@ -8,4 +8,4 @@ ukui-menu (3.1.1-0k0) yangtze; urgency=medium * 版本号规范化 - -- Xie Wei Fri, 06 May 2022 17:54:45 +0800 \ No newline at end of file + -- Xie Wei Fri, 06 May 2022 17:54:45 +0800 -- Gitee From 1b3ef31882ad9f60807d2edbdaab68f2946ecc81 Mon Sep 17 00:00:00 2001 From: lixueman Date: Mon, 20 Jun 2022 08:48:37 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E6=B7=BB=E5=8A=A0control=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debian/control | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index 2e3fd51..4cb6cda 100755 --- a/debian/control +++ b/debian/control @@ -19,7 +19,8 @@ Build-Depends: debhelper-compat (=12), libx11-dev, libukui-common0, libukui-common-dev, - libpeony-dev + libpeony-dev, + libkysdk-waylandhelper-dev Standards-Version: 4.5.0 Rules-Requires-Root: no Homepage: https://github.com/ukui/ukui-menu @@ -33,7 +34,8 @@ Depends: ${shlibs:Depends}, accountsservice, libgsettings-qt1, libqt5x11extras5, - bamfdaemon + bamfdaemon, + libkysdk-waylandhelper Suggests:kylin-status-manager, kylin-daq Description: Advanced ukui menu -- Gitee From f02a8043cc6317cf6ba8c459139d5bb6b99d6252 Mon Sep 17 00:00:00 2001 From: lixueman Date: Wed, 22 Jun 2022 11:22:36 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E8=B0=83=E6=95=B4platformName=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E4=BD=8D=E7=BD=AE=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=85=A8?= =?UTF-8?q?=E5=B1=8F=E7=AA=97=E5=8F=A3=E4=BD=8D=E7=BD=AE=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 2 +- src/UserInterface/mainwindow.cpp | 11 +++++++++++ src/UserInterface/mainwindow.h | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 68bb94d..4d4c558 100755 --- a/main.cpp +++ b/main.cpp @@ -44,7 +44,6 @@ int main(int argc, char *argv[]) initUkuiLog4qt("ukui-menu"); g_projectCodeName = KDKGetPrjCodeName().c_str(); g_subProjectCodeName = KDKGetOSRelease("SUB_PROJECT_CODENAME").c_str(); - g_platform = QGuiApplication::platformName(); qRegisterMetaType>("QVector"); #if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) @@ -56,6 +55,7 @@ int main(int argc, char *argv[]) #endif QtSingleApplication app("ukui-menu", argc, argv); app.setQuitOnLastWindowClosed(false); + g_platform = QGuiApplication::platformName(); if (app.isRunning()) { app.sendMessage("raise_window_noop"); diff --git a/src/UserInterface/mainwindow.cpp b/src/UserInterface/mainwindow.cpp index ccc8fe1..984d9f0 100755 --- a/src/UserInterface/mainwindow.cpp +++ b/src/UserInterface/mainwindow.cpp @@ -355,6 +355,7 @@ MainWindow::MainWindow(QWidget *parent) : m_viewWidget->setFocus(); } else { m_fullWindow->show(); + setMaxWindowPos(); // fullWindow->raise(); m_fullWindow->activateWindow(); pointDataStruct pointData; @@ -693,6 +694,7 @@ void MainWindow::maxAnimationFinished() { m_fullWindow->raise(); m_fullWindow->showNormal(); + setMaxWindowPos(); m_fullWindow->activateWindow(); QEventLoop loop; QTimer::singleShot(100, &loop, SLOT(quit())); @@ -1217,6 +1219,7 @@ void MainWindow::showWindow() if (m_isFullScreen) { m_fullWindow->raise(); m_fullWindow->showNormal(); + setMaxWindowPos(); m_fullWindow->activateWindow(); pointDataStruct pointData; pointData.module = "fullWindow"; @@ -1238,6 +1241,7 @@ void MainWindow::showWindow() BuriedPointDataSend::getInstance()->setPoint(pointData); } } + void MainWindow::hideWindow() { if (m_fullWindow->isVisible()) { @@ -1296,6 +1300,13 @@ void MainWindow::setMinWindowPos() } } +void MainWindow::setMaxWindowPos() +{ + if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { + kdk::WindowManager::setGeometry(m_fullWindow->windowHandle(), QRect(0, 0, Style::m_availableScreenWidth, Style::m_availableScreenHeight)); + } +} + void MainWindow::repaintWidget() { Style::initWidStyle(); diff --git a/src/UserInterface/mainwindow.h b/src/UserInterface/mainwindow.h index 9c1bcad..d2669dd 100755 --- a/src/UserInterface/mainwindow.h +++ b/src/UserInterface/mainwindow.h @@ -107,6 +107,8 @@ protected: void setMinWindowPos(); + void setMaxWindowPos(); + public: Q_SIGNALS: void sendSearchKeyword(QString arg); -- Gitee From a5faee10f009420ed65a9670de5967f9683bfb62 Mon Sep 17 00:00:00 2001 From: lixueman Date: Wed, 22 Jun 2022 13:35:46 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E6=9B=B4=E6=96=B0changelog=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index a1a551e..96fbab1 100755 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +ukui-menu (3.20.0.3-ok2) yangtze; urgency=medium + + * 调整QGuiApplication::platformName()调用时机 + * 增加全屏窗口显示时位置设定 + + -- lixueman Wed, 22 Jun 2022 11:22:58 +0800 + ukui-menu (3.20.0.3-0k1) yangtze; urgency=medium * 3.20版本提交 -- Gitee From 8e1cbde344ec3521b096da65531fad4ac3c8278b Mon Sep 17 00:00:00 2001 From: lixueman <11020448+lixueman0110@user.noreply.gitee.com> Date: Wed, 22 Jun 2022 06:25:10 +0000 Subject: [PATCH 9/9] update debian/changelog. --- debian/changelog | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/debian/changelog b/debian/changelog index 5dd406d..962814a 100755 --- a/debian/changelog +++ b/debian/changelog @@ -1,16 +1,10 @@ -ukui-menu (3.20.0.3-ok2) yangtze; urgency=medium +ukui-menu (3.1.1-ok3) yangtze; urgency=medium * 调整QGuiApplication::platformName()调用时机 * 增加全屏窗口显示时位置设定 -- lixueman Wed, 22 Jun 2022 11:22:58 +0800 -ukui-menu (3.20.0.3-0k1) yangtze; urgency=medium - - * 3.20版本提交 - - -- lixueman Sat, 18 Jun 2022 21:42:59 +0800 - ukui-menu (3.1.1-0k0) yangtze; urgency=medium * 版本号规范化 -- Gitee