diff --git a/CMakeLists.txt b/CMakeLists.txt index bb61332..0aa1a46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ find_package(KF5Wayland REQUIRED) pkg_check_modules(GIOUNIX2 REQUIRED gio-unix-2.0) pkg_check_modules(GLIB2 REQUIRED glib-2.0 gio-2.0) +pkg_check_modules(kylin-nm-base REQUIRED kylin-nm-base) pkg_check_modules(KScreen REQUIRED kscreen2) # 是否是intel项目 diff --git a/VirtualKeyboard/CMakeLists.txt b/VirtualKeyboard/CMakeLists.txt index f9d52c7..3c8a010 100644 --- a/VirtualKeyboard/CMakeLists.txt +++ b/VirtualKeyboard/CMakeLists.txt @@ -7,12 +7,17 @@ set(CMAKE_AUTORCC ON) qt5_add_resources(VirtualKeyboard_SRC src/keyboard.qrc) +qt5_wrap_cpp(VirtualKeyboard_SRC + src/vkstackedwidget.h + ) + set(VirtualKeyboard_SRC ${VirtualKeyboard_SRC} src/cursormonitor.cpp src/keyboardwidget.cpp src/virtualkeyboard.cpp src/x11keyboard.cpp + src/vkstackedwidget.cpp src/keyboard.qrc) include_directories( diff --git a/VirtualKeyboard/src/keyboardwidget.ui b/VirtualKeyboard/src/keyboardwidget.ui index ac55eff..2f6b5f1 100644 --- a/VirtualKeyboard/src/keyboardwidget.ui +++ b/VirtualKeyboard/src/keyboardwidget.ui @@ -50,25 +50,25 @@ - 20 + 8 QLayout::SetNoConstraint - 10 + 8 - 10 + 8 - 10 + 8 - 10 + 8 - + 1 @@ -107,8 +107,8 @@ - 20 - 40 + 10 + 20 @@ -695,8 +695,8 @@ - 20 - 40 + 10 + 20 @@ -707,9 +707,24 @@ + + 4 + QLayout::SetNoConstraint + + 0 + + + 0 + + + 0 + + + 0 + @@ -872,7 +887,7 @@ - + 0 0 @@ -885,7 +900,7 @@ - + 0 0 @@ -973,7 +988,7 @@ - + 0 0 @@ -986,7 +1001,7 @@ - + 0 0 @@ -1012,7 +1027,7 @@ - + 0 0 @@ -1025,7 +1040,7 @@ - + 0 0 @@ -1096,8 +1111,8 @@ - 20 - 40 + 10 + 20 @@ -1185,8 +1200,8 @@ - 20 - 40 + 10 + 20 @@ -1198,6 +1213,14 @@ + + + VKStackedWidget + QStackedWidget +
src/vkstackedwidget.h
+ 1 +
+
diff --git a/VirtualKeyboard/src/virtualkeyboard.cpp b/VirtualKeyboard/src/virtualkeyboard.cpp index ea46695..bdc65a7 100644 --- a/VirtualKeyboard/src/virtualkeyboard.cpp +++ b/VirtualKeyboard/src/virtualkeyboard.cpp @@ -39,10 +39,12 @@ VirtualKeyboard::VirtualKeyboard(QWidget *parent) keyboardWidget = new KeyboardWidget(this); QHBoxLayout *hl_keyboard = new QHBoxLayout(this); - QSpacerItem *spacer = new QSpacerItem(40, 20); + hl_keyboard->setContentsMargins(0,0,0,0); + hl_keyboard->setSpacing(0); + QSpacerItem *spacer = new QSpacerItem(10, 5); hl_keyboard->addSpacerItem(spacer); hl_keyboard->addWidget(keyboardWidget); - QSpacerItem *spacer2 = new QSpacerItem(40, 20); + QSpacerItem *spacer2 = new QSpacerItem(10, 5); hl_keyboard->addSpacerItem(spacer2); QFile qssFile(":/qss/keyboard.qss"); diff --git a/VirtualKeyboard/src/vkstackedwidget.cpp b/VirtualKeyboard/src/vkstackedwidget.cpp new file mode 100644 index 0000000..1e966bb --- /dev/null +++ b/VirtualKeyboard/src/vkstackedwidget.cpp @@ -0,0 +1,22 @@ +#include "vkstackedwidget.h" + +VKStackedWidget::VKStackedWidget(QWidget *parent/* = nullptr*/) + : QStackedWidget(parent) +{ + +} + +VKStackedWidget::~VKStackedWidget() +{ + +} + +QSize VKStackedWidget::sizeHint() const +{ + return currentWidget()->sizeHint(); +} + +QSize VKStackedWidget::minimumSizeHint() const +{ + return currentWidget()->minimumSizeHint(); +} diff --git a/VirtualKeyboard/src/vkstackedwidget.h b/VirtualKeyboard/src/vkstackedwidget.h new file mode 100644 index 0000000..8ca4994 --- /dev/null +++ b/VirtualKeyboard/src/vkstackedwidget.h @@ -0,0 +1,18 @@ +#ifndef VKSTACKEDWIDGET_H +#define VKSTACKEDWIDGET_H + +#include + +class VKStackedWidget : public QStackedWidget +{ + Q_OBJECT +public: + explicit VKStackedWidget(QWidget *parent = nullptr); + virtual ~VKStackedWidget(); + +protected: + QSize sizeHint() const override; + QSize minimumSizeHint() const override; +}; + +#endif // VKSTACKEDWIDGET_H diff --git a/debian/control b/debian/control index 5d8ee2e..dd14820 100644 --- a/debian/control +++ b/debian/control @@ -16,12 +16,19 @@ Build-Depends: debhelper-compat (= 12), libx11-dev, libxtst-dev, libqt5svg5-dev, + libkylin-nm-base (>=3.20.0.9-0k1), + libnm-dev, + libkf5networkmanagerqt-dev, + kylin-nm-plugin, libkf5wayland-dev, libkf5screen-dev, libgsettings-qt-dev, libkf5windowsystem-dev, libmatemixer-dev, - libukui-log4qt-dev + libukui-log4qt-dev, + libkysdk-sysinfo-dev (>> 1.1.0kylin1), + ukui-input-gather (>=1.0.0.2), + libinput-dev Standards-Version: 4.5.0 Rules-Requires-Root: no Homepage: https://www.github.com/ukui/ukui-screensaver @@ -34,6 +41,7 @@ Depends: ethtool, mate-desktop-common, ukui-session-manager, libpam-biometric(>=3.20.0.10), + ukui-input-gather(>=1.0.0.2), ${misc:Depends}, ${shlibs:Depends} Replaces: ukui-screensaver-common (<< 2.0.0) diff --git a/i18n_ts/bo.ts b/i18n_ts/bo.ts index 1f66585..c88658a 100644 --- a/i18n_ts/bo.ts +++ b/i18n_ts/bo.ts @@ -4,108 +4,131 @@ AuthDialog - + Authentication failure, Please try again - - - + + + Please try again in %1 minutes. - - - - + + + + Please try again in %1 seconds. - - - - + + + + Account locked permanently. - + Verify face recognition or enter password to unlock - + Press fingerprint or enter password to unlock - + Verify voiceprint or enter password to unlock - + Verify finger vein or enter password to unlock - + Verify iris or enter password to unlock - + Use the bound wechat scanning code or enter the password to unlock - - + + Password cannot be empty - + Password - + Input Password - + Login - + Retry - + Failed to verify %1, please enter password to unlock - + Unable to verify %1, please enter password to unlock - + Failed to verify %1, you still have %2 verification opportunities - - NET Exception + + Abnormal network + + + + + BatteryWidget + + + Charging... + + + + + fully charged + + + + + PowerMode + + + + + BatteryMode @@ -253,32 +276,32 @@ DeviceType - + FingerPrint - + FingerVein - + Iris - + Face - + VoicePrint - + QRCode @@ -327,7 +350,6 @@ DlgConnHidWifi - Connect to Hidden Wi-Fi Network @@ -381,7 +403,6 @@ DlgConnHidWifiLeap - Connect to Hidden Wi-Fi Network @@ -465,7 +486,6 @@ DlgConnHidWifiSecFast - Connect to Hidden Wi-Fi Network @@ -600,7 +620,6 @@ DlgConnHidWifiSecLeap - Connect to Hidden Wi-Fi Network @@ -699,7 +718,6 @@ DlgConnHidWifiSecPeap - Connect to Hidden Wi-Fi Network @@ -849,7 +867,6 @@ DlgConnHidWifiSecPwd - Connect to Hidden Wi-Fi Network @@ -948,7 +965,6 @@ DlgConnHidWifiSecTls - Connect to Hidden Wi-Fi Network @@ -1092,7 +1108,6 @@ DlgConnHidWifiSecTunnelTLS - Connect to Hidden Wi-Fi Network @@ -1227,7 +1242,6 @@ DlgConnHidWifiWep - Connect to Hidden Wi-Fi Network @@ -1331,7 +1345,6 @@ DlgConnHidWifiWpa - Connect to Hidden Wi-Fi Network @@ -1390,7 +1403,6 @@ DlgHotspotCreate - Dialog @@ -1435,6 +1447,124 @@ + + EngineDevice + + + yes + + + + + no + + + + + Yes + + + + + No + + + + + %1% available, charged + + + + + Left %1h %2m (%3%) + + + + + %1% available + + + + + Left %1h %2m to full + + + + + charging (%1%) + + + + + %1 waiting to discharge (%2%) + + + + + %1 waiting to charge (%2%) + + + + + AC adapter + + + + + Laptop battery + + + + + UPS + + + + + Monitor + + + + + Mouse + + + + + Keyboard + + + + + PDA + + + + + Cell phone + + + + + Media player + + + + + Tablet + + + + + Computer + + + + + unrecognised + + + InputInfos @@ -1473,7 +1603,6 @@ KeyboardWidget - KeyboardWidget @@ -1482,7 +1611,6 @@ KylinNM - kylin-nm @@ -1554,7 +1682,7 @@ - + Not connected @@ -1567,7 +1695,7 @@ - + Disconnected @@ -1593,22 +1721,22 @@ - + Conn Ethernet Success - + Conn Ethernet Fail - + Conn Wifi Success - + Confirm your Wi-Fi password or usable of wireless card @@ -1617,32 +1745,44 @@ LockWidget - Form - - + Date - - + Time + + + Multiple users are logged in at the same time.Are you sure you want to reboot this system? + + + + + LAN + + + + + WLAN + + LoginOptionsWidget - + Login Options - + Identify device removed! @@ -1661,7 +1801,6 @@ OneConnForm - Form @@ -1723,7 +1862,6 @@ OneLancForm - Form @@ -1824,35 +1962,39 @@ PowerManager - + Log Out - + lock - - - Restart + + + Reboot - - + Power Off - - Suspend + + Shut Down - - Sleep + + Hibernate + + + + + Suspend @@ -1869,20 +2011,95 @@ + + S: + + + + this is only shown for laptops with multiple batteries + + + + + + this is only shown for laptops with multiple batteries + + + + + + laptop primary battery + + + + + + battery-backed AC power source + + + + + + a monitor is a device to measure voltage and current + + + + + + wireless mice with internal batteries + + + + + + wireless keyboard with internal battery + + + + + + portable device + + + + + + cell phone (mobile...) + + + + + + media player, mp3 etc + + + + + + tablet device + + + + + + tablet device + + + Screensaver - + Picture does not exist - + View - + You have new notification @@ -1890,8 +2107,51 @@ SleepTime - - You have rested: + + You have rested + + + + + SureWindow + + + Form + + + + + TextLabel + + + + + Cancel + + + + + Confirm + + + + + The following program is running to prevent the system from reboot! + + + + + The following program is running to prevent the system from shutting down! + + + + + The following program is running to prevent the system from suspend! + + + + + The following program is running to prevent the system from hibernate! @@ -1911,38 +2171,38 @@ TabletLockWidget - - - - - - + + + + + + Cancel - - + + Back - + Skip - + New password is the same as old - + Reset password error:%1 - + Please scan by correct WeChat @@ -2014,25 +2274,38 @@ + + Widget + + + Widget + + + + + LoadPlugin + + + main - + Screensaver for ukui-screensaver - + show on root window - + show on window. - + window id @@ -2043,8 +2316,8 @@ - - + + lock the screen immediately @@ -2064,23 +2337,23 @@ - + Dialog for the ukui ScreenSaver. - + activated by session idle signal - - + + lock the screen and show screensaver immediately - + show screensaver immediately diff --git a/i18n_ts/bo_CN.ts b/i18n_ts/bo_CN.ts index 4135111..e4e93b5 100644 --- a/i18n_ts/bo_CN.ts +++ b/i18n_ts/bo_CN.ts @@ -83,10 +83,6 @@ Login - - NET Exception - - Failed to verify %1, you still have %2 verification opportunities @@ -107,6 +103,29 @@ Input Password + + Abnormal network + + + + + BatteryWidget + + Charging... + + + + fully charged + + + + PowerMode + + + + BatteryMode + + BiometricAuthWidget @@ -1160,6 +1179,101 @@ + + EngineDevice + + yes + + + + no + + + + Yes + + + + No + + + + %1% available, charged + + + + Left %1h %2m (%3%) + + + + %1% available + + + + Left %1h %2m to full + + + + charging (%1%) + + + + %1 waiting to discharge (%2%) + + + + %1 waiting to charge (%2%) + + + + AC adapter + + + + Laptop battery + + + + UPS + + + + Monitor + + + + Mouse + + + + Keyboard + + + + PDA + + + + Cell phone + + + + Media player + + + + Tablet + + + + Computer + + + + unrecognised + + + InputInfos @@ -1311,6 +1425,18 @@ SwitchUser བཀོལ་མི་བརྗེ་བ། + + Multiple users are logged in at the same time.Are you sure you want to reboot this system? + + + + LAN + + + + WLAN + + LoginOptionsWidget @@ -1459,7 +1585,7 @@ PowerManager Sleep - མལ་གསོ། + མལ་གསོ། Log Out @@ -1471,7 +1597,7 @@ Restart - བསྐྱར་སློང་། + བསྐྱར་སློང་། Switch User @@ -1489,6 +1615,18 @@ lock + + Reboot + + + + Shut Down + + + + Hibernate + + QObject @@ -1501,6 +1639,69 @@ འཆར་ངོས་སྲུང་སྐྱོབ་བྱ་རིམ་སད་འདུག + + S: + + + this is only shown for laptops with multiple batteries + + + + + this is only shown for laptops with multiple batteries + + + + + laptop primary battery + + + + + battery-backed AC power source + + + + + a monitor is a device to measure voltage and current + + + + + wireless mice with internal batteries + + + + + wireless keyboard with internal battery + + + + + portable device + + + + + cell phone (mobile...) + + + + + media player, mp3 etc + + + + + tablet device + + + + + tablet device + + + Screensaver @@ -1528,7 +1729,46 @@ SleepTime You have rested: - ཁྱེད་ཀྱིས་ ལ་ངལ་གསོས་ཟིན། + ཁྱེད་ཀྱིས་ ལ་ངལ་གསོས་ཟིན། + + + You have rested + + + + + SureWindow + + Form + ནས་འོང་བ། + + + TextLabel + + + + Cancel + + + + Confirm + + + + The following program is running to prevent the system from reboot! + + + + The following program is running to prevent the system from shutting down! + + + + The following program is running to prevent the system from suspend! + + + + The following program is running to prevent the system from hibernate! + @@ -1621,6 +1861,17 @@ + + Widget + + Widget + + + + LoadPlugin + + + main diff --git a/i18n_ts/es.ts b/i18n_ts/es.ts index 21c1487..d117fe0 100644 --- a/i18n_ts/es.ts +++ b/i18n_ts/es.ts @@ -83,10 +83,6 @@ Verify iris or enter password to unlock - - NET Exception - - Failed to verify %1, you still have %2 verification opportunities @@ -107,6 +103,29 @@ Input Password + + Abnormal network + + + + + BatteryWidget + + Charging... + + + + fully charged + + + + PowerMode + + + + BatteryMode + + BioAuthWidget @@ -1225,6 +1244,101 @@ + + EngineDevice + + yes + + + + no + + + + Yes + + + + No + + + + %1% available, charged + + + + Left %1h %2m (%3%) + + + + %1% available + + + + Left %1h %2m to full + + + + charging (%1%) + + + + %1 waiting to discharge (%2%) + + + + %1 waiting to charge (%2%) + + + + AC adapter + + + + Laptop battery + + + + UPS + + + + Monitor + + + + Mouse + + + + Keyboard + + + + PDA + + + + Cell phone + + + + Media player + + + + Tablet + + + + Computer + + + + unrecognised + + + InputInfos @@ -1376,6 +1490,18 @@ SwitchUser Cambiar de usuario + + Multiple users are logged in at the same time.Are you sure you want to reboot this system? + + + + LAN + + + + WLAN + + LoginOptionsWidget @@ -1534,10 +1660,6 @@ Log Out - - Restart - - Power Off @@ -1547,11 +1669,19 @@ - Sleep + lock - lock + Reboot + + + + Shut Down + + + + Hibernate @@ -1566,6 +1696,69 @@ + + S: + + + this is only shown for laptops with multiple batteries + + + + + this is only shown for laptops with multiple batteries + + + + + laptop primary battery + + + + + battery-backed AC power source + + + + + a monitor is a device to measure voltage and current + + + + + wireless mice with internal batteries + + + + + wireless keyboard with internal battery + + + + + portable device + + + + + cell phone (mobile...) + + + + + media player, mp3 etc + + + + + tablet device + + + + + tablet device + + + Screensaver @@ -1584,7 +1777,42 @@ SleepTime - You have rested: + You have rested + + + + + SureWindow + + Form + Formar + + + TextLabel + TextLabel + + + Cancel + + + + Confirm + + + + The following program is running to prevent the system from reboot! + + + + The following program is running to prevent the system from shutting down! + + + + The following program is running to prevent the system from suspend! + + + + The following program is running to prevent the system from hibernate! @@ -1678,6 +1906,17 @@ + + Widget + + Widget + + + + LoadPlugin + + + main diff --git a/i18n_ts/fr.ts b/i18n_ts/fr.ts index c4588df..679e732 100644 --- a/i18n_ts/fr.ts +++ b/i18n_ts/fr.ts @@ -83,10 +83,6 @@ Verify iris or enter password to unlock - - NET Exception - - Failed to verify %1, you still have %2 verification opportunities @@ -107,6 +103,29 @@ Input Password + + Abnormal network + + + + + BatteryWidget + + Charging... + + + + fully charged + + + + PowerMode + + + + BatteryMode + + BioAuthWidget @@ -1225,6 +1244,101 @@ + + EngineDevice + + yes + + + + no + + + + Yes + + + + No + + + + %1% available, charged + + + + Left %1h %2m (%3%) + + + + %1% available + + + + Left %1h %2m to full + + + + charging (%1%) + + + + %1 waiting to discharge (%2%) + + + + %1 waiting to charge (%2%) + + + + AC adapter + + + + Laptop battery + + + + UPS + + + + Monitor + + + + Mouse + + + + Keyboard + + + + PDA + + + + Cell phone + + + + Media player + + + + Tablet + + + + Computer + + + + unrecognised + + + InputInfos @@ -1376,6 +1490,18 @@ SwitchUser Changer d'utilisateur + + Multiple users are logged in at the same time.Are you sure you want to reboot this system? + + + + LAN + + + + WLAN + + LoginOptionsWidget @@ -1534,10 +1660,6 @@ Log Out - - Restart - - Power Off @@ -1547,11 +1669,19 @@ - Sleep + lock - lock + Reboot + + + + Shut Down + + + + Hibernate @@ -1566,6 +1696,69 @@ + + S: + + + this is only shown for laptops with multiple batteries + + + + + this is only shown for laptops with multiple batteries + + + + + laptop primary battery + + + + + battery-backed AC power source + + + + + a monitor is a device to measure voltage and current + + + + + wireless mice with internal batteries + + + + + wireless keyboard with internal battery + + + + + portable device + + + + + cell phone (mobile...) + + + + + media player, mp3 etc + + + + + tablet device + + + + + tablet device + + + Screensaver @@ -1584,7 +1777,42 @@ SleepTime - You have rested: + You have rested + + + + + SureWindow + + Form + Forme + + + TextLabel + TextLabel + + + Cancel + + + + Confirm + + + + The following program is running to prevent the system from reboot! + + + + The following program is running to prevent the system from shutting down! + + + + The following program is running to prevent the system from suspend! + + + + The following program is running to prevent the system from hibernate! @@ -1678,6 +1906,17 @@ + + Widget + + Widget + + + + LoadPlugin + + + main diff --git a/i18n_ts/pt.ts b/i18n_ts/pt.ts index 2de6ea7..c9077d7 100644 --- a/i18n_ts/pt.ts +++ b/i18n_ts/pt.ts @@ -83,10 +83,6 @@ Verify iris or enter password to unlock - - NET Exception - - Failed to verify %1, you still have %2 verification opportunities @@ -107,6 +103,29 @@ Input Password + + Abnormal network + + + + + BatteryWidget + + Charging... + + + + fully charged + + + + PowerMode + + + + BatteryMode + + BioAuthWidget @@ -1225,6 +1244,101 @@ + + EngineDevice + + yes + + + + no + + + + Yes + + + + No + + + + %1% available, charged + + + + Left %1h %2m (%3%) + + + + %1% available + + + + Left %1h %2m to full + + + + charging (%1%) + + + + %1 waiting to discharge (%2%) + + + + %1 waiting to charge (%2%) + + + + AC adapter + + + + Laptop battery + + + + UPS + + + + Monitor + + + + Mouse + + + + Keyboard + + + + PDA + + + + Cell phone + + + + Media player + + + + Tablet + + + + Computer + + + + unrecognised + + + InputInfos @@ -1376,6 +1490,18 @@ SwitchUser Mudar de utilizador + + Multiple users are logged in at the same time.Are you sure you want to reboot this system? + + + + LAN + + + + WLAN + + LoginOptionsWidget @@ -1534,10 +1660,6 @@ Log Out - - Restart - - Power Off @@ -1547,11 +1669,19 @@ - Sleep + lock - lock + Reboot + + + + Shut Down + + + + Hibernate @@ -1566,6 +1696,69 @@ + + S: + + + this is only shown for laptops with multiple batteries + + + + + this is only shown for laptops with multiple batteries + + + + + laptop primary battery + + + + + battery-backed AC power source + + + + + a monitor is a device to measure voltage and current + + + + + wireless mice with internal batteries + + + + + wireless keyboard with internal battery + + + + + portable device + + + + + cell phone (mobile...) + + + + + media player, mp3 etc + + + + + tablet device + + + + + tablet device + + + Screensaver @@ -1584,7 +1777,42 @@ SleepTime - You have rested: + You have rested + + + + + SureWindow + + Form + Formato + + + TextLabel + TextLabel + + + Cancel + + + + Confirm + + + + The following program is running to prevent the system from reboot! + + + + The following program is running to prevent the system from shutting down! + + + + The following program is running to prevent the system from suspend! + + + + The following program is running to prevent the system from hibernate! @@ -1678,6 +1906,17 @@ + + Widget + + Widget + + + + LoadPlugin + + + main diff --git a/i18n_ts/ru.ts b/i18n_ts/ru.ts index f3ab806..82e351f 100644 --- a/i18n_ts/ru.ts +++ b/i18n_ts/ru.ts @@ -83,10 +83,6 @@ Verify iris or enter password to unlock - - NET Exception - - Failed to verify %1, you still have %2 verification opportunities @@ -107,6 +103,29 @@ Input Password + + Abnormal network + + + + + BatteryWidget + + Charging... + + + + fully charged + + + + PowerMode + + + + BatteryMode + + BioAuthWidget @@ -1225,6 +1244,101 @@ + + EngineDevice + + yes + + + + no + + + + Yes + + + + No + + + + %1% available, charged + + + + Left %1h %2m (%3%) + + + + %1% available + + + + Left %1h %2m to full + + + + charging (%1%) + + + + %1 waiting to discharge (%2%) + + + + %1 waiting to charge (%2%) + + + + AC adapter + + + + Laptop battery + + + + UPS + + + + Monitor + + + + Mouse + + + + Keyboard + + + + PDA + + + + Cell phone + + + + Media player + + + + Tablet + + + + Computer + + + + unrecognised + + + InputInfos @@ -1376,6 +1490,18 @@ SwitchUser Сменить пользователя + + Multiple users are logged in at the same time.Are you sure you want to reboot this system? + + + + LAN + + + + WLAN + + LoginOptionsWidget @@ -1534,10 +1660,6 @@ Log Out - - Restart - - Power Off @@ -1547,11 +1669,19 @@ - Sleep + lock - lock + Reboot + + + + Shut Down + + + + Hibernate @@ -1566,6 +1696,69 @@ + + S: + + + this is only shown for laptops with multiple batteries + + + + + this is only shown for laptops with multiple batteries + + + + + laptop primary battery + + + + + battery-backed AC power source + + + + + a monitor is a device to measure voltage and current + + + + + wireless mice with internal batteries + + + + + wireless keyboard with internal battery + + + + + portable device + + + + + cell phone (mobile...) + + + + + media player, mp3 etc + + + + + tablet device + + + + + tablet device + + + Screensaver @@ -1584,7 +1777,42 @@ SleepTime - You have rested: + You have rested + + + + + SureWindow + + Form + форма + + + TextLabel + TextLabel + + + Cancel + + + + Confirm + + + + The following program is running to prevent the system from reboot! + + + + The following program is running to prevent the system from shutting down! + + + + The following program is running to prevent the system from suspend! + + + + The following program is running to prevent the system from hibernate! @@ -1678,6 +1906,17 @@ + + Widget + + Widget + + + + LoadPlugin + + + main diff --git a/i18n_ts/tr.ts b/i18n_ts/tr.ts index 1d46147..f08d2ff 100644 --- a/i18n_ts/tr.ts +++ b/i18n_ts/tr.ts @@ -16,7 +16,7 @@ Parola - + Retry Yeniden Dene @@ -41,103 +41,103 @@ Kimlik doğrulama hatası, hala %1 kalan denemen var - + Authentication failure, Please try again - - - + + + Please try again in %1 minutes. - - - - + + + + Please try again in %1 seconds. - - - - + + + + Account locked permanently. - + Verify face recognition or enter password to unlock - + Press fingerprint or enter password to unlock - + Verify voiceprint or enter password to unlock - + Verify finger vein or enter password to unlock - + Verify iris or enter password to unlock - + Use the bound wechat scanning code or enter the password to unlock - - + + Password cannot be empty - + Password - + Input Password - + Login - + Failed to verify %1, please enter password to unlock - + Unable to verify %1, please enter password to unlock - + Failed to verify %1, you still have %2 verification opportunities - - NET Exception + + Abnormal network @@ -153,6 +153,29 @@ Diğer Ayıtlar + + BatteryWidget + + + Charging... + + + + + fully charged + + + + + PowerMode + + + + + BatteryMode + + + BioDevices @@ -335,32 +358,32 @@ DeviceType - + FingerPrint Parmak İzi - + FingerVein Parmak Damarı - + Iris Göz - + Face Yüz - + VoicePrint Ses İzi - + QRCode @@ -409,7 +432,6 @@ DlgConnHidWifi - Connect to Hidden Wi-Fi Network @@ -463,7 +485,6 @@ DlgConnHidWifiLeap - Connect to Hidden Wi-Fi Network @@ -547,7 +568,6 @@ DlgConnHidWifiSecFast - Connect to Hidden Wi-Fi Network @@ -682,7 +702,6 @@ DlgConnHidWifiSecLeap - Connect to Hidden Wi-Fi Network @@ -781,7 +800,6 @@ DlgConnHidWifiSecPeap - Connect to Hidden Wi-Fi Network @@ -931,7 +949,6 @@ DlgConnHidWifiSecPwd - Connect to Hidden Wi-Fi Network @@ -1030,7 +1047,6 @@ DlgConnHidWifiSecTls - Connect to Hidden Wi-Fi Network @@ -1174,7 +1190,6 @@ DlgConnHidWifiSecTunnelTLS - Connect to Hidden Wi-Fi Network @@ -1309,7 +1324,6 @@ DlgConnHidWifiWep - Connect to Hidden Wi-Fi Network @@ -1413,7 +1427,6 @@ DlgConnHidWifiWpa - Connect to Hidden Wi-Fi Network @@ -1472,7 +1485,6 @@ DlgHotspotCreate - Dialog @@ -1517,6 +1529,124 @@ + + EngineDevice + + + yes + + + + + no + + + + + Yes + + + + + No + + + + + %1% available, charged + + + + + Left %1h %2m (%3%) + + + + + %1% available + + + + + Left %1h %2m to full + + + + + charging (%1%) + + + + + %1 waiting to discharge (%2%) + + + + + %1 waiting to charge (%2%) + + + + + AC adapter + + + + + Laptop battery + + + + + UPS + + + + + Monitor + + + + + Mouse + + + + + Keyboard + + + + + PDA + + + + + Cell phone + + + + + Media player + + + + + Tablet + + + + + Computer + + + + + unrecognised + + + InputInfos @@ -1555,7 +1685,6 @@ KeyboardWidget - KeyboardWidget @@ -1564,7 +1693,6 @@ KylinNM - kylin-nm @@ -1636,7 +1764,7 @@ - + Not connected @@ -1649,7 +1777,7 @@ - + Disconnected @@ -1675,22 +1803,22 @@ - + Conn Ethernet Success - + Conn Ethernet Fail - + Conn Wifi Success - + Confirm your Wi-Fi password or usable of wireless card @@ -1699,19 +1827,16 @@ LockWidget - Form - - + Date Tarih - - + Time Zaman @@ -1723,11 +1848,26 @@ SwitchUser Kullanıcı Değiştir + + + Multiple users are logged in at the same time.Are you sure you want to reboot this system? + + + + + LAN + + + + + WLAN + + LoginOptionsWidget - + Login Options @@ -1736,7 +1876,7 @@ Parola - + Identify device removed! @@ -1755,7 +1895,6 @@ OneConnForm - Form @@ -1817,7 +1956,6 @@ OneLancForm - Form @@ -1918,7 +2056,7 @@ PowerManager - + lock kilit @@ -1947,30 +2085,38 @@ Kullanıcı Değiştir - + Log Out Çıkış - - Restart - Yeniden Başlat + Yeniden Başlat - - + + + Reboot + + + + Power Off Bilgisayarı Kapat - - Suspend + + Shut Down - - Sleep + + Hibernate + + + + + Suspend @@ -1987,6 +2133,81 @@ + + S: + + + + this is only shown for laptops with multiple batteries + + + + + + this is only shown for laptops with multiple batteries + + + + + + laptop primary battery + + + + + + battery-backed AC power source + + + + + + a monitor is a device to measure voltage and current + + + + + + wireless mice with internal batteries + + + + + + wireless keyboard with internal battery + + + + + + portable device + + + + + + cell phone (mobile...) + + + + + + media player, mp3 etc + + + + + + tablet device + + + + + + tablet device + + + Screensaver @@ -1998,17 +2219,17 @@ çıkış - + Picture does not exist - + View - + You have new notification @@ -2024,8 +2245,51 @@ SleepTime - - You have rested: + + You have rested + + + + + SureWindow + + + Form + + + + + TextLabel + + + + + Cancel + + + + + Confirm + + + + + The following program is running to prevent the system from reboot! + + + + + The following program is running to prevent the system from shutting down! + + + + + The following program is running to prevent the system from suspend! + + + + + The following program is running to prevent the system from hibernate! @@ -2045,38 +2309,38 @@ TabletLockWidget - - - - - - + + + + + + Cancel - - + + Back - + Skip - + New password is the same as old - + Reset password error:%1 - + Please scan by correct WeChat @@ -2148,6 +2412,19 @@ + + Widget + + + Widget + + + + + LoadPlugin + + + main @@ -2157,8 +2434,8 @@ - - + + lock the screen immediately Ekranı hemen kilitle @@ -2178,43 +2455,43 @@ - + Dialog for the ukui ScreenSaver. - + activated by session idle signal - - + + lock the screen and show screensaver immediately - + show screensaver immediately - + Screensaver for ukui-screensaver - + show on root window - + show on window. - + window id diff --git a/i18n_ts/zh_CN.ts b/i18n_ts/zh_CN.ts index b125e72..a159196 100644 --- a/i18n_ts/zh_CN.ts +++ b/i18n_ts/zh_CN.ts @@ -16,7 +16,7 @@ 使用密码认证 - + Retry 重试 @@ -45,71 +45,71 @@ 账户锁定%1分钟由于%2次错误尝试 - - - + + + Please try again in %1 minutes. 请%1分钟后再试 - - - - + + + + Please try again in %1 seconds. 请%1秒后再试 - - - - + + + + Account locked permanently. 账号已被永久锁定 - + Verify face recognition or enter password to unlock 验证人脸识别或输入密码解锁 - + Press fingerprint or enter password to unlock 按压指纹或输入密码解锁 - + Verify voiceprint or enter password to unlock 验证声纹或输入密码解锁 - + Verify finger vein or enter password to unlock 验证指静脉或输入密码解锁 - + Verify iris or enter password to unlock 验证虹膜或输入密码解锁 - + Input Password 输入密码 - + Failed to verify %1, please enter password to unlock 验证%1失败,请输入密码解锁 - + Unable to verify %1, please enter password to unlock 无法验证%1,请输入密码解锁 - + Abnormal network 网络异常 @@ -118,8 +118,8 @@ 使用绑定的微信扫码或输入密码登录 - - + + Password cannot be empty 密码不能为空 @@ -132,7 +132,7 @@ 无法验证%1,请输入密码. - + Failed to verify %1, you still have %2 verification opportunities 验证%1失败,您还有%2次尝试机会 @@ -145,9 +145,8 @@ 生物/扫码验证失败,您还有%1次尝试机会 - NET Exception - 网络异常 + 网络异常 Password Incorrect, Please try again @@ -162,22 +161,22 @@ 请输入密码或者录入指纹 - + Authentication failure, Please try again 认证失败,请重试 - + Use the bound wechat scanning code or enter the password to unlock 使用绑定的微信扫码或输入密码解锁 - + Password 密码 - + Login 登录 @@ -205,24 +204,22 @@ BatteryWidget - - + BatteryMode 电池模式 - - + PowerMode 电源模式 - + Charging... 正在充电... - + fully charged 已充满电 @@ -421,32 +418,32 @@ DeviceType - + FingerPrint 指纹 - + FingerVein 指静脉 - + Iris 虹膜 - + Face 人脸识别 - + VoicePrint 声纹 - + QRCode 二维码 @@ -1917,7 +1914,7 @@ - + Not connected 未连接任何网络 @@ -1930,7 +1927,7 @@ - + Disconnected 未连接 @@ -1966,7 +1963,7 @@ 断开无线网络 - + Confirm your Wi-Fi password or usable of wireless card 请确认Wi-Fi密码或无线设备 @@ -2022,17 +2019,17 @@ 正在更新 Wi-Fi列表 - + Conn Ethernet Success 连接有线网络成功 - + Conn Ethernet Fail 连接有线网络失败 - + Conn Wifi Success 连接无线网络成功 @@ -2045,12 +2042,12 @@ - + Date 日期 - + Time 时间 @@ -2063,17 +2060,17 @@ 切换用户 - + Multiple users are logged in at the same time.Are you sure you want to reboot this system? 同时有多个用户登录系统,您确定要退出系统吗? - + LAN 有线网络 - + WLAN 无线局域网 @@ -2081,7 +2078,7 @@ LoginOptionsWidget - + Login Options 登录选项 @@ -2094,7 +2091,7 @@ 微信 - + Identify device removed! 校验设备已移除! @@ -2302,7 +2299,7 @@ PowerManager - + lock 锁定 @@ -2331,38 +2328,37 @@ 切换用户 - + Log Out 注销 - - Restart - 重启 + 重启 - + + Reboot 重启 - + Power Off 关机 - + Shut Down 关机 - + Hibernate 休眠 - + Suspend 睡眠 @@ -2389,7 +2385,7 @@ - this is only shown for laptops with multiple batteries + tablet device @@ -2404,7 +2400,7 @@ 退出 - + Picture does not exist 图片不存在 @@ -2421,12 +2417,12 @@ 您有%1条未读消息 - + You have new notification 您有新的消息 - + View 预览 @@ -2434,9 +2430,8 @@ SleepTime - You have rested: - 您已休息: + 您已休息: @@ -2457,17 +2452,16 @@ - + Cancel 取消 - + Confirm 确认 - Multiple users are logged in at the same time.Are you sure you want to reboot this system? 同时有多个用户登录系统,您确定要退出系统吗? @@ -2527,38 +2521,38 @@ 向上滑动解锁 - + New password is the same as old 新密码与原密码相同 - + Reset password error:%1 重置密码失败:%1 - + Please scan by correct WeChat 请使用正确的微信扫码 - - - - - - + + + + + + Cancel 取消 - - + + Back 返回 - + Skip 跳过 @@ -2634,6 +2628,19 @@ 登录失败 + + Widget + + + Widget + + + + + LoadPlugin + + + main @@ -2643,8 +2650,8 @@ - - + + lock the screen immediately 马上锁定屏幕 @@ -2664,43 +2671,43 @@ - + Dialog for the ukui ScreenSaver. - + activated by session idle signal - - + + lock the screen and show screensaver immediately - + show screensaver immediately - + Screensaver for ukui-screensaver - + show on root window - + show on window. - + window id diff --git a/screensaver/language/screensaver-zh_CN.ini b/screensaver/language/screensaver-zh_CN.ini index 10d7d4e..c921ed2 100644 --- a/screensaver/language/screensaver-zh_CN.ini +++ b/screensaver/language/screensaver-zh_CN.ini @@ -2,107 +2,166 @@ OL=天生我材必有用,千金散尽还复来。 author=李白《将进酒》 [2] +OL=新时代的伟大成就是党和人民一道拼出来、干出来、奋斗出来的。 +author=习近平 +[3] OL=莫愁前路无知己,天下谁人不识君。 author=高适《别董大二首》 -[3] +[4] OL=莫听穿林打叶声,何妨吟啸且徐行。 author=苏轼《定风波》 -[4] +[5] +OL=党用伟大奋斗创造了百年伟业,也一定能用新的伟大奋斗创造新的伟业。 +author=习近平 +[6] OL=巧言令色,鲜矣仁! author=《论语》 -[5] +[7] FL=与君初相识,犹如故人归。 SL=天涯明月新,朝暮最相思。 author=杜牧《会友》 -[6] +[8] +FL=一个饱经沧桑而初心不变的党,才能基业常青; +SL=一个铸就辉煌仍勇于自我革命的党,才能无坚不摧。 +author=习近平 +[9] OL=见贤思齐焉,见不贤而内自省也。 author=《论语》 -[7] +[10] OL=为政以德,譬如北辰,居其所而众星共之。 author=《论语》 -[8] +[11] +FL=道阻且长,行则将至。前进道路上,无论是风高浪急还是惊涛骇浪, +SL=人民永远是我们最坚实的依托、最强大的底气。 +author=习近平 +[12] OL=知彼知己,百战不殆。 author=《孙子兵法》 -[9] +[13] OL=人患不知其过,既知之,不能改,是无勇也。 author=韩愈《五箴》 -[10] +[14] +FL=新征程是充满光荣和梦想的远征。蓝图已经绘就,号角已经吹响。 +SL=我们要踔厉奋发、勇毅前行,努力创造更加灿烂的明天。 +author=习近平 +[15] OL=万物并育而不相害,道并行而不相悖 author=《礼记·中庸》 -[11] +[16] OL=自信人生二百年,会当水击三千里 author=毛泽东《七古·残句》 -[12] +[17] +OL=我们完全有信心有能力在新时代新征程创造令世人刮目相看的新的更大奇迹。 +author=习近平 +[18] OL=青春虚度无所成,白首衔悲亦何及。 author=权德舆《放歌行》 -[13] +[19] OL=劳动模范是民族的精英、人民的楷模,是共和国的功臣。 author=习近平 -[14] +[20] +FL=当前最重要的任务是撸起袖子加油干, +SL=一步一个脚印把党的二十大作出的重大决策部署付诸行动、见之于成效。 +author=习近平 +[21] FL=广大人民群众坚持爱国奉献,无怨无悔,让我感到千千万万普通人最伟大, SL=同时让我感到幸福都是奋斗出来的。 author=2018新年贺词 习近平 -[15] +[22] OL=中华文化既是历史的、也是当代的,既是民族的、也是世界的。 author=习近平 -[16] +[23] +OL=没有坚实的物质技术基础,就不可能全面建成社会主义现代化强国。 +author=习近平 +[24] OL=我们党没有自己的特殊利益,党在任何时候都是把群众利益放在第一位。 author=习近平 -[17] +[25] OL=知者行之始。行者知之成。 author=王阳明《传习录·卷上·门人陆澄录》 -[18] +[26] +FL=江山就是人民,人民就是江山。 +SL=中国共产党领导人民打江山、守江山,守的是人民的心,治国有常,利民为本。 +author=习近平 +[27] OL=此心不动,随机而动。 author=王阳明 -[19] +[28] OL=你未看此花时,此花与汝心同归于寂。 author=《传习录·卷下·门人黄省曾录》 -[20] +[29] +FL=时代呼唤我们,人民期待着我们, +SL=唯有矢志不渝、笃行不怠,方能不负时代、不负人民。 +author=习近平 +[30] OL=省察是有事时存养,存养是无事时省察。 author=王阳明《传习录》 -[21] +[31] OL=路漫漫其修远兮,吾将上下而求索。 author=《离骚》 -[22] +[32] +OL=当代中国青年生逢其时,施展才干的舞台无比广阔,实现梦想的前景无比光明。 +author=习近平 +[33] +FL=解决台湾问题是中国人自己的事,要由中国人来决定。 +SL=国家统一、民族复兴的历史车轮滚滚向前,祖国完全统一一定要实现,也一定能够实现。 +author=习近平 +[34] OL=悲莫悲兮生别离,乐莫乐兮新相知。 author=《九歌·少司命》 -[23] +[35] OL=风飒飒兮木萧萧,思公子兮徒离忧。 author=《九歌·山鬼》 -[24] +[36] OL=善守者,藏于九地之下,善攻者,动于九天之上。 author=《孙子兵法》 -[25] +[37] +FL=我们正意气风发迈向全面建设社会主义现代化国家新征程, +SL=向第二个百年奋斗目标进军,以中国式现代化全面推进中华民族伟大复兴。 +author=习近平 +[38] OL=善战者,致人而不致于人。 author=《孙子兵法·虚实第六》 -[26] +[39] OL=乱生于治,怯生于勇,弱生于强。 author=《孙子兵法·兵势第五》 -[27] +[40] +FL=中国式现代化是中国共产党和中国人民长期实践探索的成果, +SL=是一项伟大而艰巨的事业。惟其艰巨,所以伟大;惟其艰巨,更显光荣。 +author=习近平 +[41] OL=不战而屈人之兵,善之善者也。 author=《孙子兵法·谋攻第三》 -[28] +[42] OL=天行健,君子以自强不息。 author=《周易.乾卦》 -[29] +[43] +FL=中国开放的大门只会越来越大。我们将坚定不移全面深化改革开放, +SL=坚定不移推动高质量发展,以自身发展为世界创造更多机遇。 +author=习近平 +[44] OL=积善之家,必有余庆;积不善之家,必有余殃。 author=《周易.坤卦》 -[30] +[45] OL=穷则变,变则通,通则久。 author=《周易.系辞下》 -[31] +[46] +FL=我们历来主张,人类的前途命运应该由世界各国人民来把握和决定。 +SL=只要共行天下大道,各国就能够和睦相处、合作共赢,携手创造世界的美好未来。 +author=习近平 +[47] OL=天若有情天亦老,人间正道是沧桑 author=毛泽东《七律·人民解放军占领南京》 -[32] +[48] OL=仰天大笑出门去,我辈岂是蓬蒿人。 author=李白《南陵别儿童入京》 -[33] +[49] OL=落叶秋风生渭水,落叶满长安。 author=贾岛《忆江上吴处士》 -[34] +[50] OL=人生来是精神所附丽的物质,免不掉物质所常有的惰性。 author=朱光潜《朝抵抗力最大的路径走》 -[35] +[51] FL=能朝抵抗力最大的路径走,是人的特点。 SL=人在能尽量发挥这特点时,就足见出他有富裕的生活力。 author=朱光潜《朝抵抗力最大的路径走》 diff --git a/screensaver/screensaver.cpp b/screensaver/screensaver.cpp index ce030b7..5c06727 100644 --- a/screensaver/screensaver.cpp +++ b/screensaver/screensaver.cpp @@ -857,12 +857,10 @@ void Screensaver::initUI() if(qssFile.open(QIODevice::ReadOnly)) { setStyleSheet(qssFile.readAll()); - qDebug()< assets/show-password.png assets/hide-password.png - assets/keyboard.png assets/switchGreeter.png - assets/switchUser.png assets/waiting.png assets/capslock.png assets/combobox_down.png @@ -25,13 +23,8 @@ assets/unlock-button-pressed.png assets/iconFace.png assets/iconFace.svg - assets/powerManager.png assets/lock.png assets/logout.png - assets/shutdown.png - assets/suspend.png - assets/hibernate.png - assets/reboot.png assets/bio-login.png assets/password-login.png assets/weather/68.png @@ -125,5 +118,10 @@ assets/ukui-loginopt-lose.svg assets/01-default-commercial.png assets/01-default-community.png + assets/suspend.svg + assets/shutdown.svg + assets/reboot.svg + assets/hibernate.svg + assets/switchuser.svg diff --git a/src/assets/authdialog.qss b/src/assets/authdialog.qss index dd3a1a0..fd14444 100644 --- a/src/assets/authdialog.qss +++ b/src/assets/authdialog.qss @@ -101,11 +101,6 @@ QLineEdit::focus{ /* 登录按钮 */ #loginButton{ - min-width: 24px; - max-width: 24px; - min-height: 24px; - max-height: 24px; - icon-size: 24px; background:#3D6BE5; border-radius:12px; } diff --git a/src/assets/hibernate.png b/src/assets/hibernate.png deleted file mode 100644 index a6338b1..0000000 Binary files a/src/assets/hibernate.png and /dev/null differ diff --git a/src/assets/hibernate.svg b/src/assets/hibernate.svg new file mode 100644 index 0000000..6cfad35 --- /dev/null +++ b/src/assets/hibernate.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/keyboard.png b/src/assets/keyboard.png deleted file mode 100644 index 4d93f1e..0000000 Binary files a/src/assets/keyboard.png and /dev/null differ diff --git a/src/assets/powerManager.png b/src/assets/powerManager.png deleted file mode 100644 index 73089ad..0000000 Binary files a/src/assets/powerManager.png and /dev/null differ diff --git a/src/assets/reboot.png b/src/assets/reboot.png deleted file mode 100644 index 5365f79..0000000 Binary files a/src/assets/reboot.png and /dev/null differ diff --git a/src/assets/reboot.svg b/src/assets/reboot.svg new file mode 100644 index 0000000..4f55d46 --- /dev/null +++ b/src/assets/reboot.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/shutdown.png b/src/assets/shutdown.png deleted file mode 100644 index a7c9c62..0000000 Binary files a/src/assets/shutdown.png and /dev/null differ diff --git a/src/assets/shutdown.svg b/src/assets/shutdown.svg new file mode 100644 index 0000000..d46725a --- /dev/null +++ b/src/assets/shutdown.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/suspend.png b/src/assets/suspend.png deleted file mode 100644 index 63f2a32..0000000 Binary files a/src/assets/suspend.png and /dev/null differ diff --git a/src/assets/suspend.svg b/src/assets/suspend.svg new file mode 100644 index 0000000..a83bdfa --- /dev/null +++ b/src/assets/suspend.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/switchUser.png b/src/assets/switchUser.png deleted file mode 100644 index 65b98ea..0000000 Binary files a/src/assets/switchUser.png and /dev/null differ diff --git a/src/assets/switchuser.svg b/src/assets/switchuser.svg new file mode 100644 index 0000000..2d6bfae --- /dev/null +++ b/src/assets/switchuser.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/authdialog.cpp b/src/authdialog.cpp index daab419..11bd9a0 100644 --- a/src/authdialog.cpp +++ b/src/authdialog.cpp @@ -57,6 +57,12 @@ AuthDialog::AuthDialog(const UserItem &user, QWidget *parent) : w_timer(nullptr), m_uniauthService(new UniAuthService(this)) { + setObjectName("AuthDialog"); + + QFile qssFile(":/qss/assets/authdialog.qss"); + if(qssFile.open(QIODevice::ReadOnly)) { + this->setStyleSheet(qssFile.readAll()); + } initUI(); pam_tally_init(); //这里写函数声明 @@ -102,24 +108,6 @@ void AuthDialog::stopAuth() // m_passwdWidget->hide(); } -QPixmap AuthDialog::PixmapToRound(const QPixmap &src, int radius) -{ - if (src.isNull()) { - return QPixmap(); - } - - QPixmap pixmapa(src); - QPixmap pixmap(radius*2,radius*2); - pixmap.fill(Qt::transparent); - QPainter painter(&pixmap); - painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); - QPainterPath path; - path.addEllipse(0, 0, radius*2, radius*2); - painter.setClipPath(path); - painter.drawPixmap(0, 0, radius*2, radius*2, pixmapa); - return pixmap; -} - void AuthDialog::initUI() { if (scale < 0.5) { @@ -412,9 +400,9 @@ void AuthDialog::setChildrenGeometry() width()-(m_passwdWidget->width() - 240)/2, 36); m_messageLabel->setMinimumHeight(36); m_messageButton->setGeometry((m_passwdWidget->width() - 200)/2, 0, 200, 40); - m_messageButton->setStyleSheet("QPushButton:!checked:!pressed:!hover{background-color: rgba(255,255,255,40)}" - "QPushButton:!checked:!pressed:hover{background-color: rgba(255,255,255,100)}" - "QPushButton:pressed{background-color: rgba(255,255,255,40)}"); +// m_messageButton->setStyleSheet("QPushButton:!checked:!pressed:!hover{background-color: rgba(255,255,255,40)}" +// "QPushButton:!checked:!pressed:hover{background-color: rgba(255,255,255,100)}" +// "QPushButton:pressed{background-color: rgba(255,255,255,40)}"); setBiometricWidgetGeometry(); @@ -600,33 +588,52 @@ void AuthDialog::setX11Focus() void AuthDialog::setFocusin(int target) { - if(m_passwordEdit && m_widgetLoginOpts) { + if(m_passwordEdit) { switch (target) { case REMOVE: //焦点清除 - m_widgetLoginOpts->tabOptionSelected(2); + if(m_widgetLoginOpts) + m_widgetLoginOpts->tabOptionSelected(2); m_passwordEdit->setFocusin(2); + if(is_showMessageBtn) { + m_messageButton->clearFocus(); + m_messageButton->setStyleSheet("QPushButton:!checked:!pressed:!hover{background-color: rgba(255,255,255,40)}" + "QPushButton:!checked:!pressed:hover{background-color: rgba(255,255,255,100)}" + "QPushButton:pressed{background-color: rgba(255,255,255,40)}"); + } m_nameLabel->setFocus(); break; case IN_LIGIN: //焦点在登录按钮 - m_widgetLoginOpts->tabOptionSelected(2); + if(m_widgetLoginOpts) + m_widgetLoginOpts->tabOptionSelected(2); m_passwordEdit->setFocusin(1); break; case BIO_RIGHT: //登录选项焦点右移 - m_widgetLoginOpts->tabOptionSelected(0); + if(m_widgetLoginOpts) + m_widgetLoginOpts->tabOptionSelected(0); m_passwordEdit->setFocusin(2); m_nameLabel->setFocus(); break; case BIO_LEFT: //登录选项焦点左移 - m_widgetLoginOpts->tabOptionSelected(1); + if(m_widgetLoginOpts) + m_widgetLoginOpts->tabOptionSelected(1); m_passwordEdit->setFocusin(target); m_nameLabel->setFocus(); break; case IN_LINEEDIT: //焦点在密码输入框 - m_widgetLoginOpts->tabOptionSelected(2); + if(m_widgetLoginOpts) + m_widgetLoginOpts->tabOptionSelected(2); m_passwordEdit->setFocusin(0); break; + case ON_MESSAGEBTN: //免密登录按钮 + if(m_widgetLoginOpts) + m_widgetLoginOpts->tabOptionSelected(2); + m_passwordEdit->setFocusin(2); + m_messageButton->setFocus(); + m_messageButton->setStyleSheet("QPushButton{background-color: rgba(255,255,255,15%); border-radius: 4px; border: 2px solid #2C73C8;}"); + break; default: - m_passwordEdit->setFocusin(target); + if(m_widgetLoginOpts) + m_passwordEdit->setFocusin(target); m_widgetLoginOpts->tabOptionSelected(2); break; } @@ -733,9 +740,11 @@ void AuthDialog::show_authenticated(bool successful) m_passwdWidget->show(); m_passwordEdit->hide(); m_passwordEdit->setFocusPolicy(Qt::NoFocus); - m_messageButton->setFocusPolicy(Qt::StrongFocus); - setFocusProxy(m_messageButton); +// m_messageButton->setFocusPolicy(Qt::StrongFocus); +// setFocusProxy(m_messageButton); m_messageButton->show(); + is_showMessageBtn = true; + Q_EMIT showMessageBtn(is_showMessageBtn); m_messageButton->setFocus(); m_messageButton->setDefault(true); @@ -769,6 +778,7 @@ void AuthDialog::onMessageButtonClicked() else { m_messageButton->hide(); + is_showMessageBtn = false; authMode = PASSWORD; m_messageLabel->setText(""); @@ -776,8 +786,17 @@ void AuthDialog::onMessageButtonClicked() } } +bool AuthDialog::getLineeditStatus() +{ + return is_showMessageBtn; +} + void AuthDialog::onRespond(const QString &text) { + if (!prompted && text != BIOMETRIC_SUCCESS) { + qInfo()<<"Wait for input passwd!"; + return; + } unacknowledged_messages=false; clearMessage(); startWaiting(); diff --git a/src/authdialog.h b/src/authdialog.h index 821569e..6225de0 100644 --- a/src/authdialog.h +++ b/src/authdialog.h @@ -52,6 +52,7 @@ enum FOCUS { BIO_RIGHT, BIO_LEFT, IN_LINEEDIT, + ON_MESSAGEBTN, }; extern float scale; @@ -69,6 +70,7 @@ public: void setClick(); void checkPassword(); int getBioNum(); + bool getLineeditStatus(); private: void initUI(); void startWaiting(); @@ -79,7 +81,6 @@ private: void initBiometricWidget(); void setChildrenGeometry(); void setBiometricWidgetGeometry(); - QPixmap PixmapToRound(const QPixmap &src, int radius); void startBioAuth(unsigned uTimeout = 1000); void show_authenticated (bool successful = true); void setLoginTypeTip(QString strLoginTypeTip); @@ -125,6 +126,7 @@ Q_SIGNALS: void authenticateCompete(bool result); void clickPassword(bool clicked); void loginOptionClicked(); + void showMessageBtn(bool is_show); private: UserItem user; Auth *auth; @@ -157,6 +159,7 @@ private: IconEdit *m_passwordEdit; //密码输入框 QLabel *m_messageLabel; //PAM消息显示 QPushButton *m_messageButton; + bool is_showMessageBtn = false; QLabel *m_labelFace = nullptr; QLabel *m_labelLoginTypeTip = nullptr; // 登录类型提示 diff --git a/src/batterywidget.cpp b/src/batterywidget.cpp index 840920f..2cc74e4 100644 --- a/src/batterywidget.cpp +++ b/src/batterywidget.cpp @@ -38,7 +38,8 @@ void BatteryWidget::initUi() }"); mValueLabel = new QLabel(this); - mValueLabel->setFixedSize(48, 48); + mValueLabel->setFixedHeight(48); + mValueLabel->setMidLineWidth(48); mStatusLabel = new QLabel(this); mStatusLabel->setFixedHeight(36); @@ -56,22 +57,29 @@ void BatteryWidget::initUi() void BatteryWidget::setupComponent() { - QDBusInterface *batInterface = new QDBusInterface( - "org.ukui.upower", "/upower/BatteryInfo", "org.ukui.upower.battery", QDBusConnection::sessionBus(), this); + QString batteryPath = ""; + dface = new QDBusInterface(UPOWER_SERVICE, UPOWER_PATH, UPOWER_INTERFACE, QDBusConnection::systemBus(), this); + QDBusReply> reply = dface->call("EnumerateDevices"); + if (dface->isValid()) { + for (QDBusObjectPath op : reply.value()) { + if (op.path().contains("battery_")) { + batteryPath = op.path(); + qDebug() << "battery path is :" << batteryPath; + break; + } + } + } else { + qDebug() << "Enumerate devices failed"; + } + batInterface = new QDBusInterface(UPOWER_SERVICE, batteryPath, FREEDESKTOP_UPOWER, QDBusConnection::systemBus(), this); - QDBusInterface *powerInterface = new QDBusInterface( - "org.ukui.upower", "/upower", "org.ukui.upower", QDBusConnection::sessionBus(), this); - - if (batInterface->isValid()) { - QDBusReply iconreply = batInterface->call("IconName"); + QDBusConnection::systemBus().connect( + UPOWER_SERVICE, batteryPath, FREEDESKTOP_UPOWER, "PropertiesChanged", this, SLOT(dealMessage(QDBusMessage))); + iface = new QDBusInterface(UPOWER_SERVICE, UPOWER_PATH, FREEDESKTOP_UPOWER, QDBusConnection::systemBus()); + if (dface->isValid()) { mIconBtn->setIconSize(QSize(48, 32)); mIconBtn->setFocusPolicy(Qt::NoFocus); - mIconBtn->setIcon(QIcon::fromTheme(iconreply)); - QDBusConnection::sessionBus().connect( - QString(), "/upower/BatteryInfo", "org.ukui.upower.battery", "BatteryIcon", this, SLOT(setBatteryIcon(QString))); - - QDBusReply batteryreply = powerInterface->call("OnBattery"); - mModeLabel->setText(batteryreply ? tr("BatteryMode") : tr("PowerMode")); + mIconBtn->setIcon(QIcon::fromTheme(getBatteryIconName())); } ed = EngineDevice::getInstance(); onBatteryChanged(ed->engine_get_state()); @@ -96,6 +104,29 @@ void BatteryWidget::setPoint(QPoint point) mPoint = point; } +QString BatteryWidget::getBatteryIconName() +{ + if (dface->isValid() && iface->isValid()) { + bool batteryState = false; + QDBusReply reply = iface->call("Get", UPOWER_SERVICE, "OnBattery"); + if (reply.isValid()) { + batteryState = reply.value().toBool(); + } + double percentage = -1.0; + QDBusReply percentage_reply = batInterface->call("Get", UPOWER_DIVICES_SERVICE, "Percentage"); + if (percentage_reply.isValid()) { + percentage = percentage_reply.value().toDouble(); + } + + if (batteryState) { + return QString("battery-level-%1-symbolic").arg((int)percentage / 10 * 10); + } else { + return QString("battery-level-%1-charging-symbolic").arg((int)percentage / 10 * 10); + } + } + return QString(); +} + void BatteryWidget::showEvent(QShowEvent *event) { QPoint pos = QPoint(mPoint.x(), @@ -133,7 +164,6 @@ void BatteryWidget::onBatteryChanged(QStringList args) } else if (batteryState == 4) { mStatusLabel->setText(tr("fully charged")); } - if (batteryState == 4 || batteryState == 1 || batteryState == 5) { mStatusLabel->setVisible(true); mModeLabel->setText(tr("PowerMode")); @@ -141,5 +171,11 @@ void BatteryWidget::onBatteryChanged(QStringList args) mStatusLabel->setVisible(false); mModeLabel->setText(tr("BatteryMode")); } + mValueLabel->setText(QString("%1%").arg(battery)); } + +void BatteryWidget::dealMessage(QDBusMessage) +{ + mIconBtn->setIcon(QIcon::fromTheme(getBatteryIconName())); +} diff --git a/src/batterywidget.h b/src/batterywidget.h index 8f9cd9b..b9d460c 100644 --- a/src/batterywidget.h +++ b/src/batterywidget.h @@ -9,6 +9,13 @@ #include #include "enginedevice.h" +#define FREEDESKTOP_UPOWER "org.freedesktop.DBus.Properties" +#define UPOWER_INTERFACE "org.freedesktop.UPower" +#define UPOWER_PATH "/org/freedesktop/UPower" +#define UPOWER_SERVICE "org.freedesktop.UPower" +#define UPOWER_DISPLAY_PATH "/org/freedesktop/UPower/devices/DisplayDevice" +#define UPOWER_DIVICES_SERVICE "org.freedesktop.UPower.Device" + class BatteryWidget : public QWidget { Q_OBJECT @@ -18,6 +25,7 @@ public: void initUi(); void setupComponent(); void setPoint(QPoint point); + QString getBatteryIconName(); protected: void showEvent(QShowEvent *event); @@ -31,12 +39,15 @@ private: QPoint mPoint; QDBusInterface *batInterface; + QDBusInterface *iface; + QDBusInterface *dface; EngineDevice* ed; private Q_SLOTS: void setBatteryIcon(QString icon); void onBatteryChanged(QStringList args); + void dealMessage(QDBusMessage); }; diff --git a/src/configuration.h b/src/configuration.h index 9bbf43a..a74fada 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -38,7 +38,7 @@ public: public: ScreenSaver *getScreensaver(); static Configuration *instance(QObject *parent = nullptr); - QString getBackground(); + QString getBackground(); bool lockWhenXScreensaverActivated(); int idlelock(); int idledelay(); diff --git a/src/fullbackgroundwidget.cpp b/src/fullbackgroundwidget.cpp index 7f4aad3..b77fdbb 100644 --- a/src/fullbackgroundwidget.cpp +++ b/src/fullbackgroundwidget.cpp @@ -34,6 +34,7 @@ #include #include "plasma-shell-manager.h" #include +#include "lockwidget.h" #include #include #include @@ -50,7 +51,6 @@ #include #include -#include "lockwidget.h" #include "xeventmonitor.h" #include "monitorwatcher.h" #include "configuration.h" @@ -211,21 +211,21 @@ FullBackgroundWidget::FullBackgroundWidget(QWidget *parent) qDebug() << "init - screenStatus: " << screenStatus; m_listWndIds.clear(); setMouseTracking(true); - // connect(monitorWatcher, &MonitorWatcher::monitorCountChanged, - // this, &FullBackgroundWidget::onScreenCountChanged); -// QDesktopWidget *desktop = QApplication::desktop(); +// connect(monitorWatcher, &MonitorWatcher::monitorCountChanged, +// this, &FullBackgroundWidget::onScreenCountChanged); + QDesktopWidget *desktop = QApplication::desktop(); -// connect(desktop, &QDesktopWidget::resized, -// this, &FullBackgroundWidget::onDesktopResized); + connect(desktop, &QDesktopWidget::resized, + this, &FullBackgroundWidget::onDesktopResized); // connect(desktop, &QDesktopWidget::workAreaResized, // this, &FullBackgroundWidget::onDesktopResized); -// connect(desktop, &QDesktopWidget::primaryScreenChanged, -// this, &FullBackgroundWidget::onDesktopResized); -// connect(desktop, &QDesktopWidget::screenCountChanged, -// this, &FullBackgroundWidget::onDesktopResized); + connect(desktop, &QDesktopWidget::primaryScreenChanged, + this, &FullBackgroundWidget::onDesktopResized); + connect(desktop, &QDesktopWidget::screenCountChanged, + this, &FullBackgroundWidget::onDesktopResized); - connect(QApplication::primaryScreen(),&QScreen::geometryChanged, this, &FullBackgroundWidget::onDesktopResized); - connect(QApplication::screens().at(0), &QScreen::virtualGeometryChanged, this,&FullBackgroundWidget::onDesktopResized); +// connect(QApplication::primaryScreen(),&QScreen::geometryChanged, this, &FullBackgroundWidget::onDesktopResized); +// connect(QApplication::screens().at(0), &QScreen::virtualGeometryChanged, this,&FullBackgroundWidget::onDesktopResized); QDBusInterface *iface = new QDBusInterface("org.freedesktop.login1", "/org/freedesktop/login1", @@ -256,10 +256,6 @@ FullBackgroundWidget::FullBackgroundWidget(QWidget *parent) this, SLOT(propertiesChangedSlot(QString, QMap, QStringList))); #endif - if(QX11Info::isPlatformX11()){ - xEventMonitor = new XEventMonitor(this); - } - init(); qApp->installNativeEventFilter(this); installEventFilter(this); @@ -311,8 +307,8 @@ void FullBackgroundWidget::laterActivate() raiseOtherWnd(); setFocus(); if(lockWidget && lockWidget->isVisible()) { - //lockWidget->setFocus(); - lockWidget->onActiveWindpw();//将焦点设置到密码框 + lockWidget->setFocus(); + lockWidget->onActiveLineedit();//将焦点设置到密码框 } update(); } @@ -323,8 +319,8 @@ void FullBackgroundWidget::laterOtherActivate() raiseOtherWnd(); //setFocus(); if(lockWidget && lockWidget->isVisible()) { - //lockWidget->setFocus(); - lockWidget->onActiveWindpw();//将焦点设置到密码框 + lockWidget->setFocus(); + lockWidget->onActiveLineedit();//将焦点设置到密码框 } } @@ -346,15 +342,17 @@ void FullBackgroundWidget::setLockState() bool FullBackgroundWidget::eventFilter(QObject *obj, QEvent *event) { - if(event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseMove || event->type() == 7){ - if(screenStatus & SCREEN_SAVER){ - clearScreensavers(); + if (!QX11Info::isPlatformX11()) { + if(event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseMove || event->type() == 7){ + if(screenStatus & SCREEN_SAVER && !isBlank){ + clearScreensavers(); + } } } if(event->type() == QEvent::WindowDeactivate){ QTimer::singleShot(50,this,SLOT(laterActivate())); }else if(event->type() == QEvent::WindowActivate){ - if(QString(qgetenv("XDG_SESSION_TYPE")) == "wayland") { + if(QString(qgetenv("XDG_SESSION_TYPE")) == "wayland") { PlasmaShellManager::getInstance()->setAppWindowKeepAbove(true); } @@ -563,13 +561,13 @@ bool FullBackgroundWidget::nativeEventFilter(const QByteArray &eventType, void * return false; } } else if (responseType == XCB_KEY_PRESS) { - //xcb_key_press_event_t *xc = reinterpret_cast(event); - //qDebug()<<"---------------------XCB_KEY_PRESS:"<detail; +// xcb_key_press_event_t *xc = reinterpret_cast(event); +// qDebug()<<"---------------------XCB_KEY_PRESS:"<detail; //onGlobalKeyPress(xc->detail); } else if (responseType == XCB_KEY_RELEASE) { - //xcb_key_release_event_t *xc = reinterpret_cast(event); - //qDebug()<<"---------------------XCB_KEY_RELEASE:"<detail; - //onGlobalKeyRelease(xc->detail); + xcb_key_release_event_t *xc = reinterpret_cast(event); + qDebug()<<"---------------------XCB_KEY_RELEASE:"<detail; + onGlobalKeyRelease(xc->detail); } else if(responseType == XCB_GE_GENERIC){ xcb_ge_generic_event_t *xc = reinterpret_cast(event); if(xc->event_type == XCB_BUTTON_PRESS){ //此处获取的是窗口内的点击事件,光标坐标不需要使用,就直接使用QCursor接口获取了 @@ -647,17 +645,6 @@ void FullBackgroundWidget::init() XGetWindowAttributes(QX11Info::display(), QX11Info::appRootWindow(), &rootAttr); XSelectInput( QX11Info::display(), QX11Info::appRootWindow(), SubstructureNotifyMask|rootAttr.your_event_mask ); - - // connect(xEventMonitor, SIGNAL(keyPress(const QString &)), - // this, SLOT(onGlobalKeyPress(const QString &))); - // connect(xEventMonitor, SIGNAL(keyRelease(const QString &)), - // this, SLOT(onGlobalKeyRelease(const QString &))); - // connect(xEventMonitor, SIGNAL(buttonDrag(int, int)), - // this, SLOT(onGlobalButtonDrag(int, int))); - // connect(xEventMonitor, SIGNAL(buttonPress(int, int)), - // this, SLOT(onGlobalButtonPressed(int, int))); - - // xEventMonitor->start(); } @@ -667,7 +654,7 @@ void FullBackgroundWidget::init() reader.setFileName(configuration->getBackground()); reader.setAutoTransform(true); reader.setDecideFormatFromContent(true); - reader.setScaledSize(QApplication::primaryScreen()->size()); + //reader.setScaledSize(QApplication::primaryScreen()->size()); background = QPixmap::fromImageReader(&reader); if(!background.isNull()){ @@ -715,11 +702,13 @@ void FullBackgroundWidget::onCursorMoved(const QPoint &pos) { return; } + bool chkInOneScreen = false; for(auto screen : QGuiApplication::screens()) { #ifdef USE_INTEL if(screen == qApp->primaryScreen()){ lockWidget->setGeometry(screen->geometry()); + chkInOneScreen = true; break; } #else @@ -732,10 +721,24 @@ void FullBackgroundWidget::onCursorMoved(const QPoint &pos) lockWidget->hide(); lockWidget->setGeometry(screen->geometry()); lockWidget->show(); + chkInOneScreen = true; break; } #endif } + if (!chkInOneScreen) { + for(auto screen : QGuiApplication::screens()) { + if(screen == qApp->primaryScreen()){ + /*避免切换时闪烁*/ + qInfo()<<"LockWidget:"<geometry()<geometry(); + lockWidget->hide(); + lockWidget->setGeometry(screen->geometry()); + lockWidget->show(); + chkInOneScreen = true; + break; + } + } + } } void FullBackgroundWidget::lock() @@ -830,11 +833,11 @@ void FullBackgroundWidget::showScreensaver(bool isPreview/* = false*/) { ScreenSaver *saver = configuration->getScreensaver(); /*锁屏设置的Qt::WA_TranslucentBackground属性会导致第三方屏保变得透明,因此在使用第三方屏保时 - * 取消该属性,清除屏保时再设置回来*/ - if(saver->path != "/usr/lib/ukui-screensaver/ukui-screensaver-default") - { - setAttribute(Qt::WA_TranslucentBackground,false); - } + * 取消该属性,清除屏保时再设置回来*/ + if(saver->path != "/usr/lib/ukui-screensaver/ukui-screensaver-default") + { + setAttribute(Qt::WA_TranslucentBackground,false); + } ScreenSaverWidget *saverWidget = new ScreenSaverWidget(saver, this); qDebug() << " new ScreenSaverWidget"; @@ -1080,8 +1083,12 @@ void FullBackgroundWidget::onGlobalKeyRelease(int key) // 键盘上的num_lock生效、不需要登录界面进行管理 } #else - if(key == Qt::Key_Escape && screenStatus == SCREEN_LOCK) // "escape" - { + if (key == 65) { // "Space" + if (lockWidget && lockWidget->isVisible()) {/*keyReleaseEvent有时候监听不到Space的按键事件 原因未知 + 把Space按键放到nativeEventFilter里面*/ + lockWidget->key_enter_release(Qt::Key_Space); + } + } else if (key == Qt::Key_Escape && screenStatus == SCREEN_LOCK) { // "escape" bool canShow = true; if (lockWidget && !lockWidget->exitSubWidget()) canShow = false; @@ -1091,9 +1098,7 @@ void FullBackgroundWidget::onGlobalKeyRelease(int key) canShow = false; if (canShow) showScreensaver(); - } - else if(screenStatus & SCREEN_SAVER && !isBlank) - { + } else if (screenStatus & SCREEN_SAVER && !isBlank) { clearScreensavers(); } #endif @@ -1193,7 +1198,7 @@ void FullBackgroundWidget::onDesktopResized() QDesktopWidget *desktop = QApplication::desktop(); setGeometry(desktop->geometry()); if(lockWidget) - onCursorMoved(QCursor::pos()); + onCursorMoved(QCursor::pos()); if(screenStatus & SCREEN_SAVER) { clearScreensavers(); diff --git a/src/iconedit.cpp b/src/iconedit.cpp index c6304af..5280ac8 100644 --- a/src/iconedit.cpp +++ b/src/iconedit.cpp @@ -68,6 +68,8 @@ IconEdit::IconEdit(QWidget *parent) m_capsIcon->load(QString(":/image/assets/capslock.svg")); m_iconButton = new QPushButton(this); + m_iconButton->setFixedSize(24, 24); + m_iconButton->setIconSize(QSize(24, 24)); m_iconButton->setObjectName(QStringLiteral("loginButton")); m_iconButton->setCursor(QCursor(Qt::PointingHandCursor)); m_iconButton->installEventFilter(this); @@ -186,17 +188,15 @@ void IconEdit::setFocusin(int target) switch (target) { case 0: m_edit->setFocus(); - m_iconButton->setStyleSheet("min-width: 24px; max-width: 24px; min-height: 24px; max-height: 24px;" - "icon-size: 22px; background:#3D6BE5; border-radius:12px;"); + m_iconButton->setStyleSheet("border-radius:12px; border:2px solid #3D6BE5;"); break; case 1: m_edit->clearFocus(); - m_iconButton->setStyleSheet("min-width: 24px; max-width: 24px; min-height: 24px; max-height: 24px;" - "icon-size: 22px; background:#000000; border-radius:12px;"); + m_iconButton->setFocus(); + m_iconButton->setStyleSheet("border-radius:12px; border:2px solid #000000;"); break; default: - m_iconButton->setStyleSheet("min-width: 24px; max-width: 24px; min-height: 24px; max-height: 24px;" - "icon-size: 22px; background:#3D6BE5; border-radius:12px;"); + m_iconButton->setStyleSheet("border-radius:12px; border:2px solid #3D6BE5;"); m_edit->clearFocus(); break; } diff --git a/src/interface.cpp b/src/interface.cpp index c3f8700..9e1309f 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -109,7 +109,10 @@ bool Interface::GetSlpState() bool Interface::GetLockState() { - return ((process.state() != QProcess::NotRunning) && lockState); + if(process.state() != QProcess::NotRunning) + return lockState; + else + return checkScreenDialogRunning(); } bool Interface::GetBlankState() @@ -125,11 +128,13 @@ void Interface::SetLockState() void Interface::emitLockState(bool val) { qDebug()<<"emitLockState state = "< sendEvent; +LibinputSwitchEvent::LibinputSwitchEvent(QObject *parent) : QObject(parent) +{ + + sendEvent se = std::bind(&LibinputSwitchEvent::dealEvent, this, std::placeholders::_1); + m_inputGatherClient = new UKUIInputGatherClient; + m_inputGatherClient->setEventCallBack(se); + m_inputGatherClient->startToReceiveEvent(); + +} +LibinputSwitchEvent::~LibinputSwitchEvent() +{ + delete m_inputGatherClient; +} +bool LibinputSwitchEvent::geInitDevicesStatus() +{ + //0 非平板 + //1 平板 + //-1 不支持 + int status = m_inputGatherClient->libinputTabletSwitchState(); + qInfo() << __FILE__ << __LINE__<< "当前设备的状态:" << status; + if(status == 1) + return true; + else + return false; +} +void LibinputSwitchEvent::dealEvent(Event* e) +{ + switch (e->type) { + case LIBINPUT_EVENT_SWITCH_TOGGLE: + qInfo() << __FILE__ << __LINE__ << "=LIBINPUT_EVENT_SWITCH_TOGGLE="; + if(e->event.switchEventDate.switchType == LIBINPUT_SWITCH_TABLET_MODE) { + qInfo() << __FILE__ << __LINE__ << "switch type" << e->event.switchEventDate.switchType; + qInfo() << __FILE__ << __LINE__ << "switch status" << e->event.switchEventDate.switchState; + if(e->event.switchEventDate.switchState == 1) { + Q_EMIT tabletModeStatusChanged(1); + }else { + Q_EMIT tabletModeStatusChanged(0); + } + } + break; + default: + break; + } +} diff --git a/src/libinputswitchevent.h b/src/libinputswitchevent.h new file mode 100644 index 0000000..424bafd --- /dev/null +++ b/src/libinputswitchevent.h @@ -0,0 +1,40 @@ +/* + * Copyright 2022 KylinSoft Co., Ltd. + * + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +#ifndef LIBINPUTSWITCHEVENT_H +#define LIBINPUTSWITCHEVENT_H + +#include +#include +#include +#include +//头文件以及顺序不可改,不可删 +class LibinputSwitchEvent : public QObject +{ + Q_OBJECT +public: + explicit LibinputSwitchEvent(QObject *parent = nullptr); + + ~LibinputSwitchEvent(); + UKUIInputGatherClient * m_inputGatherClient = nullptr; + bool geInitDevicesStatus(); +signals: + void tabletModeStatusChanged(int tabletmode); +private: + void dealEvent(Event* e); +}; + +#endif // LIBINPUTSWITCHEVENT_H diff --git a/src/lockwidget.cpp b/src/lockwidget.cpp index 048f9f6..cafeb59 100644 --- a/src/lockwidget.cpp +++ b/src/lockwidget.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -33,6 +34,7 @@ #include #include #include +#include #include #include #include "authdialog.h" @@ -43,6 +45,7 @@ #include "commonfunc.h" #include "hoverwidget.h" #include "kylinnm.h" +#include "mytabwidget.h" #include #include @@ -82,6 +85,8 @@ LockWidget::LockWidget(QWidget *parent) this,&LockWidget::onClickPassword); connect(authDialog,&AuthDialog::loginOptionClicked, this,&LockWidget::resetNavigation); + connect(authDialog,&AuthDialog::showMessageBtn, + this,&LockWidget::onShowMessageBtn); // connect(this, &LockWidget::capsLockChanged, // authDialog, &AuthDialog::onCapsLockChanged); @@ -96,12 +101,15 @@ LockWidget::LockWidget(QWidget *parent) is_switchBtn = false; ui->btnSwitchUser->hide(); } - if(is_batteryBtn) - horAT = BATTERYBTN; - else if(!is_batteryBtn && is_switchBtn) - horAT = SWITCHBTN; - else - horAT = NETWORKBTN; + + if(horAT != KEYBOARDBTN) { + if(is_batteryBtn) + horAT = BATTERYBTN; + else if(!is_batteryBtn && is_switchBtn) + horAT = SWITCHBTN; + else + horAT = NETWORKBTN; + } } LockWidget::~LockWidget() @@ -120,11 +128,25 @@ void LockWidget::closeEvent(QCloseEvent *event) bool LockWidget::eventFilter(QObject *obj, QEvent *event) { if(event->type() == 2){ - if(obj == m_kylinNM) + if(obj == mkylinNM) return true; - if(obj == ui->btnPowerManager || obj == ui->btnSwitchUser || obj == ui->btnNetworkManager || obj == ui->btnBatteryStatus) + if(vKeyboard && obj == vKeyboard) + return true; + + if(obj == ui->btnPowerManager || obj == ui->btnSwitchUser || obj == btnNetworkManager || obj == ui->btnBatteryStatus || obj == ui->btnKeyboard) { + authDialog->setFocusin(REMOVE); return false; + } + + if(tabAt != LINEEDIT) { + authDialog->setFocusin(REMOVE); + if(tabAt == BOTTMBTN) { + tabAt = LINEEDIT; + setBottomBtnSheet(); + tabAt = BOTTMBTN; + } + } if(mBatteryWidget && mBatteryWidget->isVisible()) { setCheckedSheet(BATTERYBTN, false); @@ -149,21 +171,20 @@ bool LockWidget::eventFilter(QObject *obj, QEvent *event) if(powermanager && powermanager->isVisible()){ authDialog->show(); powermanager->hide(); - tabAt = LINEEDIT; + if(!authDialog->getLineeditStatus()) { + tabAt = LINEEDIT; + authDialog->setFocusin(IN_LINEEDIT); + if(isTableMode && !(vKeyboard && vKeyboard->isVisible())) { + showVirtualKeyboard(); + } + } else { + tabAt = MESSAGEBTN; + authDialog->setFocusin(ON_MESSAGEBTN); + } setBottomBtnSheet(); - authDialog->setFocusin(IN_LINEEDIT); powermanager->clearStatus(); at_power = false; } - - if(tabAt != LINEEDIT) { - authDialog->setFocusin(REMOVE); - if(tabAt == BOTTMBTN) { - tabAt = LINEEDIT; - setBottomBtnSheet(); - tabAt = BOTTMBTN; - } - } } if (obj == scrollContents ){ @@ -172,24 +193,25 @@ bool LockWidget::eventFilter(QObject *obj, QEvent *event) //qDebug()<<"````````````````````````````````````````````"<type(); } } - - if(event->type() == QEvent::WindowActivate || event->type() == 8){ // QEvent::FocusIn +/* + if(event->type() == QEvent::WindowActivate){ if(!isNetFinished){ isNetFinished = true; - QTimer::singleShot(2000, this, [=](){ - m_kylinNM = new KylinNM(this); - m_kylinNM->installEventFilter(this); - connect(m_kylinNM, &KylinNM::onConnectChanged, this,[=](){ - updateNetIcon(m_kylinNM->getConnectStatus()); - }); - m_kylinNM->hide(); - QtConcurrent::run([=](){ - updateNetIcon(getNetStatus()); - }); - }); + QTimer::singleShot(1000, this, [=](){ + loadNetPlugin(); +// m_kylinNM = new KylinNM(this); +// m_kylinNM->installEventFilter(this); +// connect(m_kylinNM, &KylinNM::onConnectChanged, this,[=](){ +// updateNetIcon(m_kylinNM->getConnectStatus()); +// }); +// m_kylinNM->hide(); +// QtConcurrent::run([=](){ +// updateNetIcon(getNetStatus()); +// }); + }); } } - +*/ return false; } @@ -237,7 +259,7 @@ void LockWidget::key_enter_release(int key) case NETWORKBTN: if(!m_kylinNM || !(m_kylinNM && m_kylinNM->isVisible())) showNetManager(true); - ui->btnNetworkManager->setStyleSheet(ON_NORMAL_SHEET); + btnNetworkManager->setStyleSheet(ON_NORMAL_SHEET); authDialog->setFocusin(REMOVE); break; case KEYBOARDBTN: @@ -273,29 +295,40 @@ void LockWidget::key_tab_release(int key) authDialog->setFocusin(IN_LIGIN); tabAt = ENTERBTN; break; - case ENTERBTN: - if(authDialog->getBioNum() >1) { - authDialog->setFocusin(BIO_RIGHT); - tabAt = BIOBTN; - } else { - tabAt = BOTTMBTN; - authDialog->setFocusin(REMOVE); - qDebug() << " is_batteryBtn = " << is_batteryBtn; - if(is_batteryBtn){ - horAT = BATTERYBTN; - } else if(users->getUsers().count() > 1){ - horAT = SWITCHBTN; - } else { - horAT =NETWORKBTN; - } - setBottomBtnSheet(); - qDebug() << " horat = " << horAT; - } - break; - case BIOBTN: + case MESSAGEBTN : + tabAt = BOTTMBTN; + authDialog->setFocusin(REMOVE); + if(is_batteryBtn) { + horAT = BATTERYBTN; + setBottomBtnSheet(); + } else if(users->getUsers().count() > 1){ + horAT = SWITCHBTN; + setBottomBtnSheet(); + } else { + horAT =NETWORKBTN; + setBottomBtnSheet(); + } + break; + case ENTERBTN: + if(authDialog->getBioNum() >1) { + authDialog->setFocusin(BIO_RIGHT); + tabAt = BIOBTN; + } else { + tabAt = BOTTMBTN; + authDialog->setFocusin(REMOVE); + if(is_batteryBtn){ + horAT = BATTERYBTN; + } else if(users->getUsers().count() > 1){ + horAT = SWITCHBTN; + } else { + horAT =NETWORKBTN; + } + setBottomBtnSheet(); + } + break; + case BIOBTN: tabAt = BOTTMBTN; authDialog->setFocusin(REMOVE); - qDebug() << " is_batteryBtn = " << is_batteryBtn; if(is_batteryBtn) { horAT = BATTERYBTN; setBottomBtnSheet(); @@ -306,12 +339,16 @@ void LockWidget::key_tab_release(int key) horAT =NETWORKBTN; setBottomBtnSheet(); } - qDebug() << " horat = " << horAT; break; case BOTTMBTN: if(!at_power) { - authDialog->setFocusin(IN_LINEEDIT); - tabAt = LINEEDIT; + if(!authDialog->getLineeditStatus()) { + authDialog->setFocusin(IN_LINEEDIT); + tabAt = LINEEDIT; + } else { + authDialog->setFocusin(ON_MESSAGEBTN); + tabAt = MESSAGEBTN; + } setBottomBtnSheet(); } else if (at_power) { powermanager->keyBdRelease(Qt::Key_Right); @@ -360,6 +397,20 @@ void LockWidget::key_shiftTab_release() } setBottomBtnSheet(); break; + case MESSAGEBTN : + tabAt = BOTTMBTN; + authDialog->setFocusin(REMOVE); + if(is_batteryBtn) { + horAT = BATTERYBTN; + setBottomBtnSheet(); + } else if(users->getUsers().count() > 1){ + horAT = SWITCHBTN; + setBottomBtnSheet(); + } else { + horAT =NETWORKBTN; + setBottomBtnSheet(); + } + break; case ENTERBTN: authDialog->setFocusin(IN_LINEEDIT); tabAt = LINEEDIT; @@ -371,13 +422,19 @@ void LockWidget::key_shiftTab_release() break; case BOTTMBTN: if(!at_power) { - if(authDialog->getBioNum() >1) { - authDialog->setFocusin(BIO_RIGHT); - tabAt = BIOBTN; + if(!authDialog->getLineeditStatus()) { + if(authDialog->getBioNum() >1) { + authDialog->setFocusin(BIO_RIGHT); + tabAt = BIOBTN; + } else { + authDialog->setFocusin(IN_LIGIN); + tabAt = ENTERBTN; + } } else { - authDialog->setFocusin(IN_LIGIN); - tabAt = ENTERBTN; + authDialog->setFocusin(ON_MESSAGEBTN); + tabAt = MESSAGEBTN; } + setBottomBtnSheet(); } else { powermanager->keyBdRelease(Qt::Key_Right); tabAt = POWERMANAGER; @@ -422,7 +479,11 @@ void LockWidget::key_LR_release(int key) horAT = NETWORKBTN; break; case NETWORKBTN: - horAT = POWERBTN;//KEYBOARDBTN; + if (ui->btnKeyboard->isHidden()) { + horAT = POWERBTN; + } else { + horAT = KEYBOARDBTN; + } break; case KEYBOARDBTN: horAT = POWERBTN; @@ -470,7 +531,11 @@ void LockWidget::key_LR_release(int key) horAT = NETWORKBTN; break; case POWERBTN: - horAT = NETWORKBTN;//KEYBOARDBTN; + if (ui->btnKeyboard->isHidden()) { + horAT = NETWORKBTN; + } else { + horAT = KEYBOARDBTN; + } break; default: break; @@ -491,19 +556,19 @@ void LockWidget::setBottomBtnSheet() case BATTERYBTN: ui->btnBatteryStatus->setStyleSheet(ON_TAB_SHEET); ui->btnSwitchUser->setStyleSheet(ON_NORMAL_SHEET); - ui->btnNetworkManager->setStyleSheet(ON_NORMAL_SHEET); + btnNetworkManager->setStyleSheet(ON_NORMAL_SHEET); ui->btnKeyboard->setStyleSheet(ON_NORMAL_SHEET); ui->btnPowerManager->setStyleSheet(ON_NORMAL_SHEET); break; case SWITCHBTN: ui->btnSwitchUser->setStyleSheet(ON_TAB_SHEET); - ui->btnNetworkManager->setStyleSheet(ON_NORMAL_SHEET); + btnNetworkManager->setStyleSheet(ON_NORMAL_SHEET); ui->btnKeyboard->setStyleSheet(ON_NORMAL_SHEET); ui->btnPowerManager->setStyleSheet(ON_NORMAL_SHEET); ui->btnBatteryStatus->setStyleSheet(ON_NORMAL_SHEET); break; case NETWORKBTN: - ui->btnNetworkManager->setStyleSheet(ON_TAB_SHEET); + btnNetworkManager->setStyleSheet(ON_TAB_SHEET); ui->btnKeyboard->setStyleSheet(ON_NORMAL_SHEET); ui->btnPowerManager->setStyleSheet(ON_NORMAL_SHEET); ui->btnSwitchUser->setStyleSheet(ON_NORMAL_SHEET); @@ -513,19 +578,19 @@ void LockWidget::setBottomBtnSheet() ui->btnKeyboard->setStyleSheet(ON_TAB_SHEET); ui->btnPowerManager->setStyleSheet(ON_NORMAL_SHEET); ui->btnSwitchUser->setStyleSheet(ON_NORMAL_SHEET); - ui->btnNetworkManager->setStyleSheet(ON_NORMAL_SHEET); + btnNetworkManager->setStyleSheet(ON_NORMAL_SHEET); ui->btnBatteryStatus->setStyleSheet(ON_NORMAL_SHEET); break; case POWERBTN: ui->btnPowerManager->setStyleSheet(ON_TAB_SHEET); ui->btnSwitchUser->setStyleSheet(ON_NORMAL_SHEET); - ui->btnNetworkManager->setStyleSheet(ON_NORMAL_SHEET); + btnNetworkManager->setStyleSheet(ON_NORMAL_SHEET); ui->btnKeyboard->setStyleSheet(ON_NORMAL_SHEET); ui->btnBatteryStatus->setStyleSheet(ON_NORMAL_SHEET); break; default: ui->btnSwitchUser->setStyleSheet(ON_NORMAL_SHEET); - ui->btnNetworkManager->setStyleSheet(ON_NORMAL_SHEET); + btnNetworkManager->setStyleSheet(ON_NORMAL_SHEET); ui->btnKeyboard->setStyleSheet(ON_NORMAL_SHEET); ui->btnPowerManager->setStyleSheet(ON_NORMAL_SHEET); ui->btnBatteryStatus->setStyleSheet(ON_NORMAL_SHEET); @@ -533,7 +598,7 @@ void LockWidget::setBottomBtnSheet() } } else { ui->btnSwitchUser->setStyleSheet(ON_NORMAL_SHEET); - ui->btnNetworkManager->setStyleSheet(ON_NORMAL_SHEET); + btnNetworkManager->setStyleSheet(ON_NORMAL_SHEET); ui->btnKeyboard->setStyleSheet(ON_NORMAL_SHEET); ui->btnPowerManager->setStyleSheet(ON_NORMAL_SHEET); ui->btnBatteryStatus->setStyleSheet(ON_NORMAL_SHEET); @@ -665,24 +730,38 @@ void LockWidget::initUI() ui->widgetTime->adjustSize(); //电池电量显示icon - QDBusInterface *batInterface = new QDBusInterface( - "org.ukui.upower", "/upower/BatteryInfo", "org.ukui.upower.battery", QDBusConnection::sessionBus(), this); + batInterface = new QDBusInterface( + "org.freedesktop.UPower", "/org/freedesktop/UPower", "org.freedesktop.DBus.Properties", QDBusConnection::systemBus(), this); - QDBusInterface *powerInterface = new QDBusInterface( - "org.ukui.upower", "/upower", "org.ukui.upower", QDBusConnection::sessionBus(), this); - if (batInterface->isValid()) { - QDBusReply reply = powerInterface->call("MachineType"); + QString batteryPath = ""; + dface = new QDBusInterface(UPOWER_SERVICE, UPOWER_PATH, UPOWER_INTERFACE, QDBusConnection::systemBus(), this); + QDBusReply> reply = dface->call("EnumerateDevices"); + if (dface->isValid()) { + for (QDBusObjectPath op : reply.value()) { + if (op.path().contains("battery_")) { + batteryPath = op.path(); + qDebug() << "battery path is :" << batteryPath; + break; + } + } + } else { + qDebug() << "Enumerate devices failed"; + } + + iface = new QDBusInterface(UPOWER_SERVICE, batteryPath, FREEDESKTOP_UPOWER, QDBusConnection::systemBus()); + if (dface->isValid()) { + QDBusReply reply = batInterface->call("Get", "org.freedesktop.UPower", "LidIsPresent"); if (reply.isValid()) { - if (1 == reply.value()) { - QDBusReply iconreply = batInterface->call("IconName"); - setBatteryIcon(iconreply.value()); - QDBusConnection::sessionBus().connect( - QString(), "/upower/BatteryInfo", "org.ukui.upower.battery", "BatteryIcon", this, SLOT(setBatteryIcon(QString))); + if (true == reply.value().toBool()) { + setBatteryIcon(getBatteryIconName()); + QDBusConnection::systemBus().connect( + UPOWER_SERVICE, batteryPath, FREEDESKTOP_UPOWER, "PropertiesChanged", this, SLOT(dealMessage(QDBusMessage))); ui->btnBatteryStatus->setFixedSize(48,48); ui->btnBatteryStatus->setIconSize(QSize(24,24)); ui->btnBatteryStatus->setFocusPolicy(Qt::NoFocus); ui->btnBatteryStatus->installEventFilter(this); ui->btnBatteryStatus->setCheckable(true); + ui->btnBatteryStatus->raise(); mBatteryWidget = new BatteryWidget(QPoint(ui->btnBatteryStatus->x(), ui->btnBatteryStatus->y()), this); mBatteryWidget->hide(); connect(ui->btnBatteryStatus,&QPushButton::clicked @@ -701,7 +780,7 @@ void LockWidget::initUI() } //电源管理 - ui->btnPowerManager->setIcon(QIcon(":/image/assets/powerManager.png")); + ui->btnPowerManager->setIcon(QIcon(":/image/assets/shutdown.svg")); ui->btnPowerManager->setFixedSize(48,48); ui->btnPowerManager->setIconSize(QSize(24,24)); ui->btnPowerManager->setFocusPolicy(Qt::NoFocus); @@ -711,19 +790,29 @@ void LockWidget::initUI() ,this,&LockWidget::showPowerManager); - QtConcurrent::run([=](){ - updateNetIcon(getNetStatus()); - }); +// QtConcurrent::run([=](){ +// updateNetIcon(getNetStatus()); +// }); - ui->btnNetworkManager->setFixedSize(48,48); - ui->btnNetworkManager->setIconSize(QSize(24,24)); - ui->btnNetworkManager->setFocusPolicy(Qt::NoFocus); + btnNetworkManager = new KyNetworkIcon(this); + btnNetworkManager->setStyleSheet("QPushButton{text-align:center;color: rgb(255, 255, 255, 255);border: none;border-radius: 4px;outline: none;} \ + QPushButton::hover{background-color: rgb(255,255,255,15%);} \ + QPushButton::pressed {background-color: rgba(255,255,255,40%);}\ + QPushButton::checked {background-color: rgba(255, 255, 255, 40%);}"); + btnNetworkManager->setCheckable(true); + btnNetworkManager->setFixedSize(48,48); + btnNetworkManager->setIconSize(QSize(24,24)); + btnNetworkManager->setFocusPolicy(Qt::NoFocus); // ui->btnNetworkManager->setStyleSheet("QPushButton:Hover{border-radius:24px;background-color:rgba(255, 255, 255, 0.15);}" // "QPushButton:Pressed{border-radius:24px;background-color:rgba(255, 255, 255, 0.05);}"); - ui->btnNetworkManager->installEventFilter(this); + btnNetworkManager->installEventFilter(this); + btnNetworkManager->setCursor(Qt::PointingHandCursor); - connect(ui->btnNetworkManager,&QPushButton::clicked - ,this,&LockWidget::showNetManager); + connect(btnNetworkManager,&QPushButton::clicked + ,this, [&,this](){ + this->showNetManager(); + this->setCursor(Qt::ArrowCursor); + }); if(QX11Info::isPlatformX11()){ //虚拟键盘 @@ -732,7 +821,6 @@ void LockWidget::initUI() ui->btnKeyboard->setIconSize(QSize(24, 24)); ui->btnKeyboard->setFocusPolicy(Qt::NoFocus); ui->btnKeyboard->installEventFilter(this); - ui->btnKeyboard->hide(); /* connect(ui->btnKeyboard, &QPushButton::clicked, this, [&]{ @@ -744,13 +832,15 @@ void LockWidget::initUI() connect(ui->btnKeyboard, &QPushButton::clicked, this, &LockWidget::showVirtualKeyboard); + } else { + ui->btnKeyboard->hide(); } //用户切换 if(displayManager->canSwitch()) { //initUserMenu(); - ui->btnSwitchUser->setIcon(QIcon(":/image/assets/switchUser.png")); + ui->btnSwitchUser->setIcon(QIcon(":/image/assets/switchuser.svg")); ui->btnSwitchUser->setIconSize(QSize(24, 24)); ui->btnSwitchUser->setFixedSize(48, 48); ui->btnSwitchUser->setFocusPolicy(Qt::NoFocus); @@ -760,17 +850,41 @@ void LockWidget::initUI() connect(ui->btnSwitchUser, &QPushButton::clicked, this, &LockWidget::showUserMenu); } + //监听物理键盘插拔 + libswitch = new LibinputSwitchEvent; + isTableMode = libswitch->geInitDevicesStatus(); + if(isTableMode && !(vKeyboard && vKeyboard->isVisible())) { + showVirtualKeyboard(); + } + connect(libswitch , &LibinputSwitchEvent::tabletModeStatusChanged, this, [ = ](int tablet_mode) { + isTableMode = tablet_mode; + if(isTableMode && tabAt == LINEEDIT && !(vKeyboard && vKeyboard->isVisible())) { + showVirtualKeyboard(); + QTimer::singleShot(500, this, [&, this](){ + authDialog->setFocusin(IN_LINEEDIT); + }); + } + }); +} +void LockWidget::netInPutStatus() +{ + if(isTableMode && !(vKeyboard && vKeyboard->isVisible())) + showVirtualKeyboard(); } void LockWidget::showVirtualKeyboard() { + if (!QX11Info::isPlatformX11()) { + return ; + } tabAt = LINEEDIT; setBottomBtnSheet(); tabAt = BOTTMBTN; horAT = KEYBOARDBTN; if(!vKeyboard){ vKeyboard = new VirtualKeyboard(this); + vKeyboard->installEventFilter(this); vKeyboard->hide(); connect(vKeyboard, &VirtualKeyboard::aboutToClose, @@ -781,8 +895,18 @@ void LockWidget::showVirtualKeyboard() if(!vKeyboard->isHidden()){ vKeyboard->raise(); - authDialog->setFocusin(IN_LINEEDIT); + //authDialog->setFocusin(IN_LINEEDIT); at_plugins = true; + if(m_kylinNM && m_kylinNM->isVisible()) { + m_kylinNM->move(this->width() - m_kylinNM->width() - 20, + this->height() - m_kylinNM->height() - vKeyboard->height()); + m_kylinNM->raise(); + } else + authDialog->setFocusin(IN_LINEEDIT); + if(scrollArea && scrollArea->isVisible()) + setCheckedSheet(SWITCHBTN, false); + if(mBatteryWidget && mBatteryWidget->isVisible()) + setCheckedSheet(BATTERYBTN, false); } setVirkeyboardPos(); } @@ -801,10 +925,10 @@ void LockWidget::showUserMenu() setCheckedSheet(SWITCHBTN,false); at_plugins = false; authDialog->setFocusin(REMOVE); - } - else{ + } else { setCheckedSheet(SWITCHBTN, true); at_plugins = true; + authDialog->setFocusin(REMOVE); if(m_kylinNM && m_kylinNM->isVisible()) setCheckedSheet(NETWORKBTN, false); if(mBatteryWidget && mBatteryWidget->isVisible()) @@ -852,16 +976,23 @@ void LockWidget::showPowerManager(bool keynavigation) if(powermanager->isVisible()){ authDialog->show(); powermanager->hide(); - tabAt = LINEEDIT; + if(!authDialog->getLineeditStatus()) { + tabAt = LINEEDIT; + authDialog->setFocusin(IN_LINEEDIT); + if(isTableMode && !(vKeyboard && vKeyboard->isVisible())) { + showVirtualKeyboard(); + } + } else { + tabAt = MESSAGEBTN; + authDialog->setFocusin(ON_MESSAGEBTN); + } setBottomBtnSheet(); - authDialog->setFocusin(IN_LINEEDIT); powermanager->clearStatus(); at_power = false; } else{ authDialog->hide(); powermanager->show(); - powermanager->setFocus(); if(keynavigation){ powermanager->keyBdRelease(Qt::Key_Right); tabAt = POWERMANAGER; @@ -906,10 +1037,10 @@ void LockWidget::setCheckedSheet(int type, bool show) case NETWORKBTN: if(show) { m_kylinNM->show(); - ui->btnNetworkManager->setChecked(true); + btnNetworkManager->setChecked(true); } else { m_kylinNM->hide(); - ui->btnNetworkManager->setChecked(false); + btnNetworkManager->setChecked(false); } break; default: @@ -931,7 +1062,7 @@ void LockWidget::showWarning(QVector &wlist, int typ sureWidget->setFocus(); ui->widgetTime->hide(); ui->btnPowerManager->hide(); - ui->btnNetworkManager->hide(); + btnNetworkManager->hide(); ui->btnSwitchUser->hide(); ui->btnKeyboard->hide(); ui->btnBatteryStatus->hide(); @@ -953,7 +1084,7 @@ void LockWidget::switchToSureDialog(int type) sureWidget->setFocus(); ui->widgetTime->hide(); ui->btnPowerManager->hide(); - ui->btnNetworkManager->hide(); + btnNetworkManager->hide(); ui->btnSwitchUser->hide(); ui->btnKeyboard->hide(); ui->btnBatteryStatus->hide(); @@ -967,7 +1098,7 @@ void LockWidget::hideSureDialog() powermanager->show(); ui->widgetTime->show(); ui->btnPowerManager->show(); - ui->btnNetworkManager->show(); + btnNetworkManager->show(); ui->btnSwitchUser->show(); ui->btnKeyboard->show(); ui->btnBatteryStatus->show(); @@ -986,7 +1117,7 @@ void LockWidget::confirmClicked() authDialog->show(); ui->widgetTime->show(); ui->btnPowerManager->show(); - ui->btnNetworkManager->show(); + btnNetworkManager->show(); ui->btnSwitchUser->show(); ui->btnKeyboard->show(); ui->btnBatteryStatus->show(); @@ -1002,20 +1133,24 @@ void LockWidget::showNetManager(bool keynavigation) horAT = NETWORKBTN; } if(!m_kylinNM){ - return; + /*这里放在点击按钮后加载,一个原因是启动优化,另一个原因是如果放在构造函数中加载,则必须 + * 先让网络窗口显示出来一次,否则会在锁屏程序退出时,锁屏窗口在closeEvent中崩溃,原因未知 + * 同时,可以尽量降低在未操作网络时,网络程序对锁屏窗口的影响*/ + loadNetPlugin(); + m_kylinNM->hide(); } + if(m_kylinNM->isVisible()) { setCheckedSheet(NETWORKBTN, false); } else { - m_kylinNM->show(); setCheckedSheet(NETWORKBTN, true); if(scrollArea && scrollArea->isVisible()) setCheckedSheet(SWITCHBTN, false); if(mBatteryWidget && mBatteryWidget->isVisible()) setCheckedSheet(BATTERYBTN, false); m_kylinNM->setGeometry(this->width() - m_kylinNM->width() - 20, - this->height() - m_kylinNM->height() - 100, + this->height() - m_kylinNM->height() - 72 - 8, m_kylinNM->width(), m_kylinNM->height()); m_kylinNM->raise(); @@ -1024,14 +1159,16 @@ void LockWidget::showNetManager(bool keynavigation) * 这里只调用m_kylinNM->raise()仍会有问题,需要再调用一次authDialog->lower()才行,原因未知*/ if(authDialog && authDialog->isVisible()){ authDialog->lower(); + authDialog->clearFocus(); } - authDialog->clearFocus(); + if(mBatteryWidget && mBatteryWidget->isVisible()) { mBatteryWidget->lower(); mBatteryWidget->clearFocus(); } at_plugins = true; - m_kylinNM->updateWifiList(); + + //m_kylinNM->updateWifiList(); } } @@ -1055,9 +1192,21 @@ void LockWidget::onClickPassword() at_plugins = false; } - if(vKeyboard && vKeyboard->isVisible()) { - vKeyboard->hide(); - at_plugins = false; + if(isTableMode) { + if(!(vKeyboard && vKeyboard->isVisible())) + showVirtualKeyboard(); + } +// if(vKeyboard && vKeyboard->isVisible()) { +// vKeyboard->hide(); +// at_plugins = false; +// } +} + +void LockWidget::onShowMessageBtn(bool is_show) +{ + if(is_show) { + tabAt = MESSAGEBTN; + authDialog->setFocusin(ON_MESSAGEBTN); } } @@ -1084,9 +1233,6 @@ void LockWidget::showBattery() void LockWidget::hideBottomPlugins() { - if(m_kylinNM && m_kylinNM->isVisible()) - setCheckedSheet(NETWORKBTN, false); - if(scrollArea && scrollArea->isVisible()) setCheckedSheet(SWITCHBTN, false); @@ -1094,8 +1240,19 @@ void LockWidget::hideBottomPlugins() vKeyboard->hide(); at_plugins = false; } + if(m_kylinNM && m_kylinNM->isVisible()) { + m_kylinNM->move(this->width() - m_kylinNM->width() - 20, + this->height() - m_kylinNM->height() - 72 - 8); + tabAt = BOTTMBTN; + horAT = NETWORKBTN; + setCheckedSheet(NETWORKBTN, true); + at_plugins = true; + authDialog->setFocusin(REMOVE); + return ; + } //tabAt = EMPTY; - tabAt = LINEEDIT; + if(!authDialog->getLineeditStatus()) + tabAt = LINEEDIT; setBottomBtnSheet(); } @@ -1115,6 +1272,11 @@ void LockWidget::setBatteryIcon(QString str) ui->btnBatteryStatus->setIcon(QPixmap::fromImage(img)); } +void LockWidget::dealMessage(QDBusMessage) +{ + setBatteryIcon(getBatteryIconName()); +} + int LockWidget::getNetStatus() { int ret = -1; @@ -1151,22 +1313,111 @@ void LockWidget::updateNetIcon(int status) switch(status) { case 0: //有线 - ui->btnNetworkManager->setIcon(QIcon(":/image/assets/intel/icon-wired.png")); + btnNetworkManager->setIcon(QIcon(":/image/assets/intel/icon-wired.png")); break; case 1: //无线 - ui->btnNetworkManager->setIcon(QIcon(":/image/assets/intel/icon-wifi.png")); + btnNetworkManager->setIcon(QIcon(":/image/assets/intel/icon-wifi.png")); break; case 2: //有线+无线 - ui->btnNetworkManager->setIcon(QIcon(":/image/assets/intel/icon-wired.png")); + btnNetworkManager->setIcon(QIcon(":/image/assets/intel/icon-wired.png")); break; default: //无连接 - ui->btnNetworkManager->setIcon(QIcon(":/image/assets/intel/icon-no-signal.png")); + btnNetworkManager->setIcon(QIcon(":/image/assets/intel/icon-no-signal.png")); } } +void LockWidget::loadNetPlugin() +{ + m_kylinNM = new QWidget(this); + m_kylinNM->setFixedSize(420,480); + m_kylinNM->setObjectName("m_kylinNM"); + m_kylinNM->setStyleSheet("#m_kylinNM{background-color: white; border-radius:12px;}"); + + mkylinNM = new MyTabWidget(m_kylinNM); + mkylinNM->setFixedSize(420,480); + mkylinNM->tabBar()->setFixedHeight(40); + mkylinNM->installEventFilter(this); + + QPluginLoader netloader("/usr/lib/kylin-nm/libnetconnect.so");//有线 + QPluginLoader wlanloader("/usr/lib/kylin-nm/libwlanconnect.so");//无线 + + if (netloader.load()) { + QObject * plugin = netloader.instance(); + + if (plugin) { + Interface * pluginInstance = qobject_cast(plugin); + // 插件是否启用 + if (!pluginInstance) { + return; + } + + pluginInstance->setPluginType(SIMPLE); + QWidget *widget = pluginInstance->pluginUi(); + mkylinNM->addTab(widget,""); + + } else { + qDebug() << "Load Failed: " << netloader.errorString() << "\n"; + return; + } + } else { + qDebug() << "Load Failed: " << netloader.errorString() << "\n"; + return; + } + + if (wlanloader.load()) { + QObject * plugin = wlanloader.instance(); + + if (plugin) { + Interface * pluginInstance = qobject_cast(plugin); + // 插件是否启用 + if (!pluginInstance) { + return; + } + + pluginInstance->setPluginType(SIMPLE); + /*这里需要先调用setParentWidget,否则会出现网络连接弹窗无法弹出来的问题*/ + pluginInstance->setParentWidget(this); + QWidget *widget = pluginInstance->pluginUi(); + mkylinNM->addTab(widget,""); + + // 平板模式输入状态下自动调出虚拟键盘 + connect(pluginInstance, SIGNAL(needShowVirtualKeyboard()), this, SLOT(netInPutStatus())); + } else { + qDebug() << "Load Failed: " << wlanloader.errorString() << "\n"; + return; + } + } else { + qDebug() << "Load Failed: " << wlanloader.errorString() << "\n"; + return; + } + + + QHBoxLayout *m_tabBarLayout = new QHBoxLayout(mkylinNM); + m_tabBarLayout->setContentsMargins(0,0,0,0); + QLabel *m_lanLabel = new QLabel(tr("LAN")); + m_lanLabel->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter); + QLabel *m_wlanLabel = new QLabel(tr("WLAN")); + m_wlanLabel->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter); + m_tabBarLayout->addWidget(m_lanLabel); + m_tabBarLayout->addWidget(m_wlanLabel); + mkylinNM->tabBar()->setLayout(m_tabBarLayout); + mkylinNM->tabBar()->setFixedWidth(420); + QPalette pal = qApp->palette(); + pal.setBrush(QPalette::Background, Qt::white); +// m_kylinNM->setPalette(pal); + mkylinNM->widget(0)->setPalette(pal); + mkylinNM->widget(1)->setPalette(pal); + + m_kylinNM->setGeometry(this->width() - mkylinNM->width() - 20, + this->height() - mkylinNM->height() - 72 - 8, + mkylinNM->width(), + mkylinNM->height()); + +} + void LockWidget::switchToGreeter() { if(authDialog) @@ -1305,7 +1556,7 @@ void LockWidget::initUserMenu() scrollArea->setFixedSize(usersMenu->width() + 16, height()/2); } scrollArea->move(ui->btnSwitchUser->geometry().x()- scrollArea->width()/2 + 24, \ - height() - 72 - scrollArea->height() - 5); + height() - 72 - scrollArea->height() - 8); } } @@ -1329,7 +1580,7 @@ void LockWidget::keyReleaseEvent(QKeyEvent *e) key_OB_release(e->key()); } else if (e->key() == Qt::Key_Left || e->key() == Qt::Key_Right ) { // "Left" "Right" key_LR_release(e->key()); - } else if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter || e->key() == Qt::Key_Space) { // "Return" "KP_Enter" "Space" + } else if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) { // "Return" "KP_Enter" key_enter_release(e->key()); } } @@ -1351,11 +1602,14 @@ void LockWidget::resizeEvent(QResizeEvent *event) //认证窗口 //设置认证窗口左右居中 - if(scale >= 1) - authDialog->setGeometry((width()-authDialog->geometry().width())/2,height()/(4-0.65*scale), \ + if(scale >= 1.3) + authDialog->setGeometry((width()-authDialog->geometry().width())/2,height()/(4-0.7*scale), \ authDialog->width(), (height()*3/4)); + else if(scale <= 0.9) + authDialog->setGeometry((width()-authDialog->geometry().width())/2,height()/(4-0.9*scale), \ + authDialog->width(), (height()*3/4)); else - authDialog->setGeometry((width()-authDialog->geometry().width())/2,height()/(4+0.65*scale), \ + authDialog->setGeometry((width()-authDialog->geometry().width())/2,height()/(4-0.65*scale), \ authDialog->width(), (height()*3/4)); if(scale > 1) @@ -1366,13 +1620,13 @@ void LockWidget::resizeEvent(QResizeEvent *event) x = x + ui->btnPowerManager->width(); ui->btnPowerManager->move(width() - x,height() - y); - if(ui->btnKeyboard->isVisible()){ + if(!ui->btnKeyboard->isHidden()){ x = x+ui->btnKeyboard->width()+16; ui->btnKeyboard->move(width() - x, height() - y); } - x = x + ui->btnNetworkManager->width()+16; - ui->btnNetworkManager->move(width() - x, height() - y); + x = x + btnNetworkManager->width()+16; + btnNetworkManager->move(width() - x, height() - y); if(!ui->btnSwitchUser->isHidden()) { x = x + ui->btnSwitchUser->width()+16; @@ -1399,12 +1653,12 @@ void LockWidget::resizeEvent(QResizeEvent *event) scrollArea->setFixedSize(usersMenu->width() + 16, height()/2); } scrollArea->move(ui->btnSwitchUser->geometry().x()- scrollArea->width()/2 + 24, \ - height() - y - scrollArea->height() - 5); + height() - y - scrollArea->height() - 8); } if(m_kylinNM){ m_kylinNM->setGeometry(this->width() - m_kylinNM->width() - 20, - this->height() - m_kylinNM->height() - 100, + this->height() - m_kylinNM->height() - y - 8, m_kylinNM->width(), m_kylinNM->height()); } @@ -1474,24 +1728,6 @@ void LockWidget::onUserAdded(const UserItem &user) usersMenu->adjustSize(); } -QPixmap LockWidget::PixmapToRound(const QPixmap &src, int radius) -{ - if (src.isNull()) { - return QPixmap(); - } - - QPixmap pixmapa(src); - QPixmap pixmap(radius*2,radius*2); - pixmap.fill(Qt::transparent); - QPainter painter(&pixmap); - painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); - QPainterPath path; - path.addEllipse(0, 0, radius*2, radius*2); - painter.setClipPath(path); - painter.drawPixmap(0, 0, radius*2, radius*2, pixmapa); - return pixmap; -} - void LockWidget::onUserDeleted(const UserItem &user) { for(auto action : usersMenu->actions()) @@ -1599,7 +1835,7 @@ bool LockWidget::exitSubWidget() setCheckedSheet(NETWORKBTN, false); at_plugins = false; if(tabAt == BOTTMBTN && horAT == NETWORKBTN) - ui->btnNetworkManager->setStyleSheet(ON_TAB_SHEET); + btnNetworkManager->setStyleSheet(ON_TAB_SHEET); allExited = false; } else if(vKeyboard && vKeyboard->isVisible()) { vKeyboard->hide(); @@ -1610,29 +1846,69 @@ bool LockWidget::exitSubWidget() } else if(powermanager && powermanager->isVisible()){ authDialog->show(); powermanager->hide(); - tabAt = LINEEDIT; + if(!authDialog->getLineeditStatus()) { + tabAt = LINEEDIT; + authDialog->setFocusin(IN_LINEEDIT); + if(isTableMode && !(vKeyboard && vKeyboard->isVisible())) { + showVirtualKeyboard(); + } + } else { + tabAt = MESSAGEBTN; + authDialog->setFocusin(ON_MESSAGEBTN); + } setBottomBtnSheet(); - authDialog->setFocusin(IN_LINEEDIT); powermanager->clearStatus(); at_power = false; allExited = false; + return allExited; } if(tabAt != LINEEDIT) authDialog->setFocusin(REMOVE); -// if (!is_keynavigation) { -// resetNavigation(); -// } return allExited; } -void LockWidget::onActiveWindpw() +void LockWidget::onActiveLineedit() { - if(tabAt == LINEEDIT) { - if(authDialog && authDialog->isVisible()) - authDialog->setFocusin(IN_LINEEDIT); + if(tabAt == LINEEDIT || (tabAt == BOTTMBTN && horAT == KEYBOARDBTN)) { /* + 重启时session拉其他组件时会多次设置焦点 + 这个时候如果是平板模式,因为已经弹出了虚拟键盘 tabAt就会是BOTTOM + */ + if(authDialog && authDialog->isVisible()) { + if(!authDialog->getLineeditStatus()) { + authDialog->setFocusin(IN_LINEEDIT); + if(isTableMode && !(vKeyboard && vKeyboard->isVisible())) + showVirtualKeyboard(); + } else { + tabAt = MESSAGEBTN; + authDialog->setFocusin(ON_MESSAGEBTN); + } + } } } +QString LockWidget::getBatteryIconName() +{ + if (iface->isValid() && dface->isValid()) { + bool batteryState = false; + QDBusReply reply = batInterface->call("Get", UPOWER_SERVICE, "OnBattery"); + if (reply.isValid()) { + batteryState = reply.value().toBool(); + } + double percentage = -1.0; + QDBusReply percentage_reply = iface->call("Get", UPOWER_DIVICES_SERVICE, "Percentage"); + if (percentage_reply.isValid()) { + percentage = percentage_reply.value().toDouble(); + } + + if (true == batteryState) { + return QString("battery-level-%1-symbolic").arg((int)percentage / 10 * 10); + } else { + return QString("battery-level-%1-charging-symbolic").arg((int)percentage / 10 * 10); + } + } + return QString(); +} + int LockWidget::getLoginedNum() { if(loginedNum != 0) diff --git a/src/lockwidget.h b/src/lockwidget.h index 8723ecc..59ab6ea 100644 --- a/src/lockwidget.h +++ b/src/lockwidget.h @@ -25,10 +25,14 @@ #include #include #include +#include +#include +#include "kylin-nm/kylin-nm-interface.h" #include "surewindow.h" #include "lockchecker.h" #include "xeventmonitor.h" #include "batterywidget.h" +#include "libinputswitchevent.h" namespace Ui { class LockWidget; @@ -61,6 +65,7 @@ enum TABAT { BIOBTN, BOTTMBTN, POWERMANAGER, + MESSAGEBTN, }; enum HORIZONBTN { @@ -84,7 +89,9 @@ public: void setX11Focus(); bool exitSubWidget(); void setStartupMode(bool mode); - void onActiveWindpw(); + void onActiveLineedit(); + QString getBatteryIconName(); + void key_enter_release(int key); Q_SIGNALS: void closed(); @@ -98,20 +105,20 @@ private: void updateNetIcon(int status); bool getLoadStatus(const QString &name); int getNetStatus(); - QPixmap PixmapToRound(const QPixmap &src, int radius); void key_OB_release(int key); void key_tab_release(int key); void key_shiftTab_release(); void key_LR_release(int key); - void key_enter_release(int key); int getLoginedNum(); - void setBottomBtnSheet(); - void setCheckedSheet(int type, bool show); + void loadNetPlugin(); + void setBottomBtnSheet(); + void setCheckedSheet(int type, bool show); private Q_SLOTS: void onUserAdded(const UserItem &user); void onUserDeleted(const UserItem &user); void onUserMenuTrigged(QAction *action); void showVirtualKeyboard(); + void netInPutStatus(); void showPowerManager(bool keynavigation = false); void showUserMenu(); void showNetManager(bool keynavigation = false); @@ -125,6 +132,8 @@ private Q_SLOTS: void hideBottomPlugins(); void resetNavigation(); void setBatteryIcon(QString str); + void dealMessage(QDBusMessage); + void onShowMessageBtn(bool is_show); protected: bool eventFilter(QObject *obj, QEvent *event); @@ -147,14 +156,16 @@ private: QScrollArea *scrollArea; QWidget *scrollContents; + QWidget *m_kylinNM = nullptr; BatteryWidget *mBatteryWidget = nullptr; - KylinNM *m_kylinNM = nullptr; + QTabWidget *mkylinNM = nullptr; QWidget *m_NetManagerWidget; QStringList m_loginedUser; bool isNetFinished = false; int powermanagerType; int nowAt = -1; int loginedNum = 0; + QPushButton *btnNetworkManager = nullptr; bool m_isStartupMode = false; bool is_switchBtn = true; bool is_batteryBtn = true; @@ -163,6 +174,15 @@ private: int horAT = BATTERYBTN; int at_power = false; bool at_plugins = false; + + QDBusInterface *batInterface = nullptr; + QDBusInterface *iface = nullptr; + QDBusInterface *dface = nullptr; + + + // 监听键盘插拔 + LibinputSwitchEvent *libswitch = nullptr; + bool isTableMode = false; }; #endif // LOCKWIDGET_H diff --git a/src/lockwidget.ui b/src/lockwidget.ui index 4c6a20c..b6c8c42 100644 --- a/src/lockwidget.ui +++ b/src/lockwidget.ui @@ -144,25 +144,6 @@ QPushButton::pressed {
- - - - 370 - 10 - 80 - 26 - - - - PointingHandCursor - - - Qt::NoFocus - - - - - diff --git a/src/mytabwidget.cpp b/src/mytabwidget.cpp new file mode 100644 index 0000000..7256584 --- /dev/null +++ b/src/mytabwidget.cpp @@ -0,0 +1,40 @@ +#include "mytabwidget.h" +#include +#include +#include + +MyTabWidget::MyTabWidget(QWidget *parent) : QTabWidget(parent) +{ + //隐藏标题栏 + // setWindowFlags(Qt::FramelessWindowHint);//无边框 置顶 + + //设置窗口背景透明 +// setAttribute(Qt::WA_TranslucentBackground,false); + + //设置样式 + +// QWidget *w = new QWidget(this); +// QWidget *k = new QWidget(this); +// this->addTab(w,"111"); +// this->addTab(k,"222"); + + +} + +void MyTabWidget::paintEvent(QPaintEvent *p1) +{ + //绘制样式 + QStyleOption opt; + opt.initFrom(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);//绘制样式 + + QBitmap bmp(this->size()); + bmp.fill(); + QPainter painter(&bmp); + painter.setPen(Qt::NoPen); + painter.setBrush(Qt::black); + painter.setRenderHint(QPainter::Antialiasing); + painter.drawRoundedRect(bmp.rect(), 12, 12); + setMask(bmp); +} diff --git a/src/mytabwidget.h b/src/mytabwidget.h new file mode 100644 index 0000000..65ff60a --- /dev/null +++ b/src/mytabwidget.h @@ -0,0 +1,18 @@ +#ifndef MYTABWIDGET_H +#define MYTABWIDGET_H + +#include +#include + +class MyTabWidget : public QTabWidget +{ + Q_OBJECT +public: + explicit MyTabWidget(QWidget *parent = nullptr); + void paintEvent(QPaintEvent *event); + +signals: + +}; + +#endif // WIDGET_H diff --git a/src/powermanager.cpp b/src/powermanager.cpp index de9c30c..aadcf02 100644 --- a/src/powermanager.cpp +++ b/src/powermanager.cpp @@ -51,6 +51,11 @@ PowerManager::PowerManager(int num, QWidget *parent) lasttime(QTime::currentTime()) { // resize(ITEM_WIDTH*7, ITEM_HEIGHT); + QFile qssFile(":/qss/assets/authdialog.qss"); + if(qssFile.open(QIODevice::ReadOnly)) { + this->setStyleSheet(qssFile.readAll()); + } + setObjectName("PowerManager"); setFlow(QListWidget::LeftToRight); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -197,7 +202,8 @@ void PowerManager::clearStatus() void::PowerManager::setButtonStyle(QString Style) { if(Style == "normal") - listLabel.at(nowAt)->setStyleSheet("background-color: rgba(255, 255, 255, 15%);QLabel:hover{background-color:rgba(255,255,255,40%)};QLabel:pressed:!hover{background-color:rgba(255,255,255,30%)}"); + listLabel.at(nowAt)->setStyleSheet("background-color: rgba(255, 255, 255, 15%);\ + QPushButton:hover{background-color:rgba(255,255,255,40%)};QPushButton:pressed:!hover{background-color:rgba(255,255,255,30%)}"); else if(Style == "focus") listLabel.at(nowAt)->setStyleSheet("background-color: rgba(255, 255, 255, 20%);border: 1px solid #296CD9; border-radius: 64px;"); } @@ -655,13 +661,14 @@ void PowerManager::initUI() rebootWidget->setObjectName("rebootWidget"); QWidget *rbLabelWidget = new QWidget(this); rbLabelWidget->setFixedSize(130, 130); - rebootFace = new QLabel(rbLabelWidget); + rebootFace = new QPushButton(rbLabelWidget); rebootFace->setObjectName("rebootFace"); QLabel *rebootLabel = new QLabel(this); - rebootFace->setAlignment(Qt::AlignCenter); + //rebootFace->setAlignment(Qt::AlignCenter); rebootFace->installEventFilter(this); rebootLabel->setAlignment(Qt::AlignCenter); - rebootFace->setPixmap(QPixmap(":/image/assets/reboot.png").scaled(58,58)); + rebootFace->setIcon(QIcon(":/image/assets/reboot.svg")); + rebootFace->setIconSize(QSize(48, 48)); rebootLabel->setText(tr("Reboot")); rebootWidget->setFixedSize(ITEM_WIDTH,ITEM_HEIGHT); QVBoxLayout *rebootlayout = new QVBoxLayout(rebootWidget); @@ -673,15 +680,16 @@ void PowerManager::initUI() shutdownWidget->setObjectName("shutdownWidget"); QWidget *shLabelWidget = new QWidget(this); shLabelWidget->setFixedSize(130, 130); - shutdownFace = new QLabel(shLabelWidget); + shutdownFace = new QPushButton(shLabelWidget); shutdownFace->setObjectName("shutdownFace"); QLabel *shutdownLabel = new QLabel(this); shutdownLabel->setAlignment(Qt::AlignCenter); - shutdownFace->setAlignment(Qt::AlignCenter); + //shutdownFace->setAlignment(Qt::AlignCenter); shutdownFace->installEventFilter(this); - shutdownFace->setPixmap(QPixmap(":/image/assets/shutdown.png").scaled(58,58)); + shutdownFace->setIcon(QIcon(":/image/assets/shutdown.svg")); + shutdownFace->setIconSize(QSize(48, 48)); shutdownLabel->setText(tr("Shut Down")); - shutdownWidget->setFixedSize(ITEM_WIDTH,ITEM_HEIGHT); + shutdownWidget->setFixedSize(ITEM_WIDTH, ITEM_HEIGHT); QVBoxLayout *shutdownlayout = new QVBoxLayout(shutdownWidget); shutdownlayout->addWidget(shLabelWidget); shutdownlayout->addWidget(shutdownLabel); @@ -699,13 +707,14 @@ void PowerManager::initUI() hibernateWidget->setObjectName("hibernateWidget"); QWidget *hbLabelWidget = new QWidget(this); hbLabelWidget->setFixedSize(130, 130); - hibernateFace = new QLabel(hbLabelWidget); + hibernateFace = new QPushButton(hbLabelWidget); hibernateFace->setObjectName("hibernateFace"); QLabel *hibernateLabel = new QLabel(this); hibernateLabel->setAlignment(Qt::AlignCenter); - hibernateFace->setAlignment(Qt::AlignCenter); + //hibernateFace->setAlignment(Qt::AlignCenter); hibernateFace->installEventFilter(this); - hibernateFace->setPixmap(QPixmap(":/image/assets/hibernate.png").scaled(48,48)); + hibernateFace->setIcon(QIcon(":/image/assets/hibernate.svg")); + hibernateFace->setIconSize(QSize(48, 48)); hibernateLabel->setText(tr("Hibernate")); hibernateWidget->setFixedSize(ITEM_WIDTH,ITEM_HEIGHT); QVBoxLayout *hibernatelayout = new QVBoxLayout(hibernateWidget); @@ -726,13 +735,14 @@ void PowerManager::initUI() suspendWidget->setObjectName("suspendWidget"); QWidget *spLabelWidget = new QWidget(this); spLabelWidget->setFixedSize(130, 130); - suspendFace = new QLabel(spLabelWidget); + suspendFace = new QPushButton(spLabelWidget); suspendFace->setObjectName("suspendFace"); QLabel *suspendLabel = new QLabel(this); suspendLabel->setAlignment(Qt::AlignCenter); - suspendFace->setAlignment(Qt::AlignCenter); + //suspendFace->setAlignment(Qt::AlignCenter); suspendFace->installEventFilter(this); - suspendFace->setPixmap(QPixmap(":/image/assets/suspend.png").scaled(48,48)); + suspendFace->setIcon(QIcon(":/image/assets/suspend.svg")); + suspendFace->setIconSize(QSize(48, 48)); suspendLabel->setText(tr("Suspend")); suspendWidget->setFixedSize(ITEM_WIDTH,ITEM_HEIGHT); QVBoxLayout *suspendlayout = new QVBoxLayout(suspendWidget); diff --git a/src/powermanager.h b/src/powermanager.h index 854c881..7199568 100644 --- a/src/powermanager.h +++ b/src/powermanager.h @@ -45,6 +45,7 @@ enum stateType { }; class QLabel; +class QPushButton; class QListWidget; class QListWidgetItem; class QDBusInterface; @@ -76,7 +77,7 @@ private: void setQSS(); QWidget *list; #else - QList listLabel; + QList listLabel; int nowAt = -1; QListWidget *list; QWidget *suspendWidget; @@ -97,10 +98,10 @@ private: QWidget *rebootWidget; QWidget *shutdownWidget; QTime lasttime; - QLabel *rebootFace; - QLabel *shutdownFace; - QLabel *hibernateFace; - QLabel *suspendFace; + QPushButton *rebootFace; + QPushButton *shutdownFace; + QPushButton *hibernateFace; + QPushButton *suspendFace; int loginedNum = 0; bool m_isStartupMode = false; diff --git a/src/ukui-screensaver-dialog.cpp b/src/ukui-screensaver-dialog.cpp index f396331..e7ed780 100644 --- a/src/ukui-screensaver-dialog.cpp +++ b/src/ukui-screensaver-dialog.cpp @@ -198,11 +198,11 @@ int main(int argc, char *argv[]) window = new FullBackgroundWidget(); - QFile qssFile(":/qss/assets/authdialog.qss"); - if(qssFile.open(QIODevice::ReadOnly)) { - a.setStyleSheet(qssFile.readAll()); - } - qssFile.close(); +// QFile qssFile(":/qss/assets/authdialog.qss"); +// if(qssFile.open(QIODevice::ReadOnly)) { +// a.setStyleSheet(qssFile.readAll()); +// } +// qssFile.close(); // 注册DBus ScreenSaverWndAdaptor adaptorWnd(window); @@ -226,7 +226,10 @@ int main(int argc, char *argv[]) } #ifndef USE_INTEL - window->showFullScreen(); + if (QString(qgetenv("XDG_SESSION_TYPE")) == "wayland") + window->showFullScreen(); + else + window->show(); window->activateWindow(); #endif if(parser.isSet(lockOption))