diff --git a/BiometricAuth/CMakeLists.txt b/BiometricAuth/CMakeLists.txt index 18c3215..e1b52a5 100644 --- a/BiometricAuth/CMakeLists.txt +++ b/BiometricAuth/CMakeLists.txt @@ -1,8 +1,6 @@ qt5_wrap_cpp(BiometricAuth_SRC biometricdeviceinfo.h - biometricproxy.h - biometricauthwidget.h - biometricdeviceswidget.h + biometricproxy.h giodbus.h uniauthservice.h ) @@ -10,9 +8,7 @@ qt5_wrap_cpp(BiometricAuth_SRC set(BiometricAuth_SRC ${BiometricAuth_SRC} biometricdeviceinfo.cpp - biometricproxy.cpp - biometricauthwidget.cpp - biometricdeviceswidget.cpp + biometricproxy.cpp giodbus.cpp uniauthservice.cpp ) @@ -20,11 +16,12 @@ set(BiometricAuth_SRC include_directories( ${Qt5Core_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} - ${Qt5DBus_INCLUDE_DIRS} - ${OpenCV_INCLUDE_DIRS} + ${Qt5DBus_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS} + ${GIOUNIX2_INCLUDE_DIRS} ) add_library(BiometricAuth STATIC ${BiometricAuth_SRC}) -target_link_libraries(BiometricAuth Qt5::Core Qt5::DBus Qt5::Widgets ${OpenCV_LIBS} ${GIOUNIX2_LIBRARIES}) +target_link_libraries(BiometricAuth Qt5::Core Qt5::DBus Qt5::Widgets + ${GIOUNIX2_LIBRARIES}) diff --git a/BiometricAuth/biometricauthwidget.cpp b/BiometricAuth/biometricauthwidget.cpp index a7b552d..4a03938 100644 --- a/BiometricAuth/biometricauthwidget.cpp +++ b/BiometricAuth/biometricauthwidget.cpp @@ -1,9 +1,9 @@ -/** +/* * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, @@ -12,9 +12,8 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. + * along with this program; if not, see . + * **/ #include "biometricauthwidget.h" #include diff --git a/BiometricAuth/biometricauthwidget.h b/BiometricAuth/biometricauthwidget.h index e380abf..8390a02 100644 --- a/BiometricAuth/biometricauthwidget.h +++ b/BiometricAuth/biometricauthwidget.h @@ -1,9 +1,9 @@ -/** +/* * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, @@ -12,9 +12,8 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. + * along with this program; if not, see . + * **/ #ifndef BIOMETRICAUTHWIDGET_H #define BIOMETRICAUTHWIDGET_H diff --git a/BiometricAuth/biometricdeviceinfo.cpp b/BiometricAuth/biometricdeviceinfo.cpp index f49881e..83f97f0 100644 --- a/BiometricAuth/biometricdeviceinfo.cpp +++ b/BiometricAuth/biometricdeviceinfo.cpp @@ -1,9 +1,9 @@ -/** +/* * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, @@ -12,9 +12,8 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. + * along with this program; if not, see . + * **/ #include "biometricdeviceinfo.h" @@ -67,6 +66,8 @@ QString DeviceType::getDeviceType_tr(int deviceType) return tr("Face"); case VoicePrint: return tr("VoicePrint"); + case LOGINOPT_TYPE_GENERAL_UKEY: + return tr("ukey"); case REMOTE_QRCODE_TYPE: return tr("QRCode"); default: @@ -126,10 +127,33 @@ const QDBusArgument &operator >>(const QDBusArgument &arg, DeviceInfo &deviceInf return arg; } +/* For the type FeatureInfo */ +QDBusArgument &operator<<(QDBusArgument &argument, const FeatureInfo &featureInfo) +{ + argument.beginStructure(); + argument << featureInfo.uid << featureInfo.biotype + << featureInfo.device_shortname << featureInfo.index + << featureInfo.index_name; + argument.endStructure(); + return argument; +} + +const QDBusArgument &operator>>(const QDBusArgument &argument, FeatureInfo &featureInfo) +{ + argument.beginStructure(); + argument >> featureInfo.uid >> featureInfo.biotype + >> featureInfo.device_shortname >> featureInfo.index + >> featureInfo.index_name; + argument.endStructure(); + return argument; +} + void registerMetaType() { qRegisterMetaType("DeviceInfo"); qDBusRegisterMetaType(); + qRegisterMetaType("FeatureInfo"); + qDBusRegisterMetaType(); } diff --git a/BiometricAuth/biometricdeviceinfo.h b/BiometricAuth/biometricdeviceinfo.h index 7ffb27a..e5a4e64 100644 --- a/BiometricAuth/biometricdeviceinfo.h +++ b/BiometricAuth/biometricdeviceinfo.h @@ -1,9 +1,9 @@ -/** +/* * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, @@ -12,9 +12,8 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. + * along with this program; if not, see . + * **/ #ifndef BIOMETRICDEVICEINFO_H #define BIOMETRICDEVICEINFO_H @@ -212,20 +211,35 @@ struct DeviceInfo int OpsStatus; }; + +struct FeatureInfo { + int uid; + int biotype; + QString device_shortname; + int index; + QString index_name; +}; + class QDBusArgument; QDBusArgument &operator <<(QDBusArgument &arg, const DeviceInfo &deviceInfo); const QDBusArgument &operator >>(const QDBusArgument &arg, DeviceInfo &deviceInfo); +QDBusArgument &operator<<(QDBusArgument &argument, const FeatureInfo &featureInfo); +const QDBusArgument &operator>>(const QDBusArgument &argument, FeatureInfo &featureInfo); void registerMetaType(); typedef std::shared_ptr DeviceInfoPtr; typedef QList DeviceList; typedef QMap DeviceMap; +typedef std::shared_ptr FeatureInfoPtr; +typedef QList FeatureList; +typedef QMap FeatureMap; QDebug operator <<(QDebug stream, const DeviceInfo &deviceInfo); Q_DECLARE_METATYPE(DeviceInfo) +Q_DECLARE_METATYPE(FeatureInfo) /** * @brief 获取默认设备 @@ -266,6 +280,8 @@ enum LOGINOPT_TYPE { LOGINOPT_TYPE_IRIS, // 虹膜 LOGINOPT_TYPE_VOICEPRINT, // 声纹 LOGINOPT_TYPE_FINGERVEIN, // 指静脉 + LOGINOPT_TYPE_GENERAL_UKEY, // 普通的ukey + LOGINOPT_TYPE_ADVANCED_UKEY, // 高阶的ukey LOGINOPT_TYPE_QRCODE, // 二维码 LOGINOPT_TYPE_OTHERS, // 其他 LOGINOPT_TYPE_COUNT diff --git a/BiometricAuth/biometricdeviceswidget.cpp b/BiometricAuth/biometricdeviceswidget.cpp index 856b750..0766ae3 100644 --- a/BiometricAuth/biometricdeviceswidget.cpp +++ b/BiometricAuth/biometricdeviceswidget.cpp @@ -1,9 +1,9 @@ -/** +/* * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, @@ -12,9 +12,8 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. + * along with this program; if not, see . + * **/ #include "biometricdeviceswidget.h" #include diff --git a/BiometricAuth/biometricdeviceswidget.h b/BiometricAuth/biometricdeviceswidget.h index d606aef..bdef3da 100644 --- a/BiometricAuth/biometricdeviceswidget.h +++ b/BiometricAuth/biometricdeviceswidget.h @@ -1,9 +1,9 @@ -/** +/* * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, @@ -12,9 +12,8 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. + * along with this program; if not, see . + * **/ #ifndef BIOMETRICDEVICESWIDGET_H #define BIOMETRICDEVICESWIDGET_H diff --git a/BiometricAuth/biometricproxy.cpp b/BiometricAuth/biometricproxy.cpp index 85637a4..9f2513e 100644 --- a/BiometricAuth/biometricproxy.cpp +++ b/BiometricAuth/biometricproxy.cpp @@ -1,9 +1,9 @@ -/** +/* * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, @@ -12,12 +12,12 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. + * along with this program; if not, see . + * **/ #include "biometricproxy.h" #include +#include BiometricProxy::BiometricProxy(QObject *parent) : QDBusAbstractInterface(BIOMETRIC_DBUS_SERVICE, @@ -37,6 +37,41 @@ QDBusPendingCall BiometricProxy::Identify(int drvid, int uid, int indexStart, in return asyncCallWithArgumentList(QStringLiteral("Identify"), argList); } +QDBusPendingCall BiometricProxy::UkeyIdentify(int drvid, int type, int uid) +{ + QList argList; + argList << drvid << type << uid; + return asyncCallWithArgumentList(QStringLiteral("UkeyIdentify"), argList); +} + +bool BiometricProxy::GetHasUkeyFeature(int uid, int indexStart, int indexEnd) +{ + QList qlist; + FeatureInfo *featureInfo; + int listsize; + QDBusMessage result = call(QStringLiteral("GetAllFeatureList"),uid,indexStart,indexEnd); + if(result.type() == QDBusMessage::ErrorMessage) + { + qWarning() << "GetDevList error:" << result.errorMessage(); + return false; + } + QList variantList = result.arguments(); + listsize = variantList[0].value(); + variantList[1].value() >> qlist; + for (int i = 0; i < listsize; i++) { + featureInfo = new FeatureInfo; + qlist[i].variant().value() >> *featureInfo; + if(featureInfo->biotype == LOGINOPT_TYPE_GENERAL_UKEY){ + delete featureInfo; + return true; + } + delete featureInfo; + } + + return false; + +} + int BiometricProxy::GetFeatureCount(int uid, int indexStart, int indexEnd) { QDBusMessage result = call(QStringLiteral("GetDevList")); @@ -68,6 +103,17 @@ int BiometricProxy::GetFeatureCount(int uid, int indexStart, int indexEnd) return res; } +int BiometricProxy::SetExtraInfo(QString info_type,QString extra_info) +{ + QDBusReply reply = call(QStringLiteral("SetExtraInfo"), info_type, extra_info); + if(!reply.isValid()) + { + qWarning() << "SetExtraInfo error:" << reply.error(); + return -1; + } + return reply.value(); +} + int BiometricProxy::StopOps(int drvid, int waiting) { QDBusReply reply = call(QStringLiteral("StopOps"), drvid, waiting); @@ -145,6 +191,28 @@ DeviceList BiometricProxy::GetDevList() return deviceList; } +FeatureMap BiometricProxy::GetUserFeatures(int uid) +{ + FeatureMap featureMap; + QList qlist; + int listsize; + QDBusMessage result = call(QStringLiteral("GetAllFeatureList"), uid, 0, -1); + if(result.type() == QDBusMessage::ErrorMessage) + { + qWarning() << "GetDevList error:" << result.errorMessage(); + return featureMap; + } + QList variantList = result.arguments(); + listsize = variantList[0].value(); + variantList[1].value() >> qlist; + for (int i = 0; i < listsize; i++) { + FeatureInfoPtr pFeatureInfo = std::make_shared(); + qlist[i].variant().value() >> *pFeatureInfo; + featureMap[pFeatureInfo->device_shortname].append(pFeatureInfo); + } + return featureMap; +} + int BiometricProxy::GetDevCount() { QDBusMessage result = call(QStringLiteral("GetDevList")); diff --git a/BiometricAuth/biometricproxy.h b/BiometricAuth/biometricproxy.h index ac03881..5395ed7 100644 --- a/BiometricAuth/biometricproxy.h +++ b/BiometricAuth/biometricproxy.h @@ -1,9 +1,9 @@ -/** +/* * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, @@ -12,9 +12,8 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. + * along with this program; if not, see . + * **/ #ifndef BIOMETRICPROXY_H #define BIOMETRICPROXY_H @@ -65,6 +64,21 @@ public Q_SLOTS: * @return 结果: (结果,用户id) */ QDBusPendingCall Identify(int drvid, int uid, int indexStart = 0, int indexEnd = -1); + /** + * @brief 使用指定id的设备进行用户认证 + * @param drvid 驱动(设备)id + * @param type ukey的认证类型,2表示pin认证(需通过setExtraInfo设置pin码,3表示指纹认证) + * @param uid 用户id + * @return 结果: (结果,用户id) + */ + QDBusPendingCall UkeyIdentify(int drvid, int type, int uid); + /** + * @brief 设置一些认证时所需的额外的信息 + * @param info_type 额外的信息类型,ukey pincode认证时传 "pincode" + * @param extra_info 额外的信息内容,ukey pincode认证时传PIN码内容 + * @return 结果: (设置额外信息的结果) + */ + int SetExtraInfo(QString info_type, QString extra_info); /** * @brief 终止设备上正在进行的操作 * @param drvid 设备id @@ -80,6 +94,14 @@ public Q_SLOTS: * @return */ int GetFeatureCount(int uid, int indexStart = 0, int indexEnd = -1); + /** + * @brief 获取当前用户已连接设备对应特征数目 + * @param uid 用户id + * @param indexStart 用于认证的特征索引范围 + * @param indexEnd + * @return 返回是否存在ukey特征 + */ + bool GetHasUkeyFeature(int uid, int indexStart = 0, int indexEnd = -1); /** * @brief 获取已连接的设备列表 * @return @@ -117,7 +139,12 @@ public Q_SLOTS: StatusReslut UpdateStatus(int drvid); int GetUserDevCount(int uid); int GetUserDevFeatureCount(int uid,int drvid); - + /** + * @brief GetUserFeatures 获取用户所有特征 + * @param uid 用户id + * @return 特征信息列表 + */ + FeatureMap GetUserFeatures(int uid); Q_SIGNALS: /** diff --git a/BiometricAuth/giodbus.cpp b/BiometricAuth/giodbus.cpp index 9e0490e..02a362b 100644 --- a/BiometricAuth/giodbus.cpp +++ b/BiometricAuth/giodbus.cpp @@ -1,6 +1,23 @@ +/* + * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 . + * +**/ #include "giodbus.h" #include -#include +#include #include int get_server_gvariant_stdout (int drvid) diff --git a/BiometricAuth/giodbus.h b/BiometricAuth/giodbus.h index 13e0880..a75f989 100644 --- a/BiometricAuth/giodbus.h +++ b/BiometricAuth/giodbus.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 GIODBUS_H #define GIODBUS_H diff --git a/BiometricAuth/main.cpp b/BiometricAuth/main.cpp index 6215ae1..cd780b5 100644 --- a/BiometricAuth/main.cpp +++ b/BiometricAuth/main.cpp @@ -1,9 +1,9 @@ -/** +/* * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, @@ -12,9 +12,8 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. + * along with this program; if not, see . + * **/ #include #include diff --git a/CMakeLists.txt b/CMakeLists.txt index 14d81a6..0aa1a46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,10 +5,13 @@ find_package(Qt5 COMPONENTS Core Widgets DBus X11Extras Xml Network Svg) find_package(PkgConfig REQUIRED) find_package(OpenCV REQUIRED) find_package(PkgConfig) +find_package(KF5Screen REQUIRED) +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项目 option (USE_INTEL "intel项目" OFF) diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/Common/CMakeLists.txt b/Common/CMakeLists.txt index 5390d95..a53f577 100644 --- a/Common/CMakeLists.txt +++ b/Common/CMakeLists.txt @@ -1,7 +1,21 @@ +pkg_check_modules(GLIB REQUIRED glib-2.0) +find_package(X11 REQUIRED) +find_package(KF5WindowSystem) + +include_directories( + ${Qt5Core_INCLUDE_DIRS} + ${Qt5Widgets_INCLUDE_DIRS} + ${Qt5DBus_INCLUDE_DIRS} + ${GLIB2_INCLUDE_DIRS} + ${KF5Wayland_LIBRARIES} + ) + qt5_wrap_cpp(Common_SRC autoresize.h checkbutton.h commonfunc.h + glibinterface.h + plasma-shell-manager.h ) set(Common_SRC @@ -9,14 +23,9 @@ set(Common_SRC autoresize.cpp checkbutton.cpp commonfunc.cpp + glibinterface.cpp + plasma-shell-manager.cpp ) -include_directories( - ${Qt5Core_INCLUDE_DIRS} - ${Qt5Widgets_INCLUDE_DIRS} - ${Qt5DBus_INCLUDE_DIRS} - ) - - add_library(Common STATIC ${Common_SRC}) -target_link_libraries(Common Qt5::Core Qt5::DBus Qt5::Widgets) +target_link_libraries(Common Qt5::Core Qt5::DBus Qt5::Widgets ${GIOUNIX2_LIBRARIES} ${KF5Wayland_LIBRARIES} -lKF5WaylandClient -lKF5WaylandServer KF5::WindowSystem) diff --git a/Common/checkbutton.cpp b/Common/checkbutton.cpp index 14ae327..9962a15 100644 --- a/Common/checkbutton.cpp +++ b/Common/checkbutton.cpp @@ -1,11 +1,10 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * +/* * Copyright (C) 2019 Tianjin KYLIN Information Technology 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 2 of the License, or - * (at your option) any later version. + * the Free Software Foundation; either version 3, 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 @@ -13,10 +12,9 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + * along with this program; if not, see . * - */ +**/ #include "checkbutton.h" diff --git a/Common/checkbutton.h b/Common/checkbutton.h index d6167c9..59f3463 100644 --- a/Common/checkbutton.h +++ b/Common/checkbutton.h @@ -1,11 +1,10 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * +/* * Copyright (C) 2019 Tianjin KYLIN Information Technology 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 2 of the License, or - * (at your option) any later version. + * the Free Software Foundation; either version 3, 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 @@ -13,10 +12,9 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + * along with this program; if not, see . * - */ +**/ #ifndef CHECKBUTTON_H #define CHECKBUTTON_H diff --git a/Common/commonfunc.cpp b/Common/commonfunc.cpp index 79df19e..e9aacce 100644 --- a/Common/commonfunc.cpp +++ b/Common/commonfunc.cpp @@ -1,11 +1,10 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * +/* * Copyright (C) 2019 Tianjin KYLIN Information Technology 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 2 of the License, or - * (at your option) any later version. + * the Free Software Foundation; either version 3, 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 @@ -13,15 +12,15 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + * along with this program; if not, see . * - */ +**/ #include #include #include #include +#include #include #include #include "commonfunc.h" diff --git a/Common/commonfunc.h b/Common/commonfunc.h index 43ab4a9..d028bdd 100644 --- a/Common/commonfunc.h +++ b/Common/commonfunc.h @@ -1,11 +1,10 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * +/* * Copyright (C) 2019 Tianjin KYLIN Information Technology 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 2 of the License, or - * (at your option) any later version. + * the Free Software Foundation; either version 3, 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 @@ -13,10 +12,9 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + * along with this program; if not, see . * - */ +**/ #ifndef COMMONFUNC_H #define COMMONFUNC_H @@ -25,6 +23,8 @@ #include #include +#define G_FONT_SIZE (11.0) + bool ispicture(QString filepath); QString getSystemVersion(); QString getSystemDistrib(); diff --git a/Common/glibinterface.cpp b/Common/glibinterface.cpp new file mode 100644 index 0000000..66c26bc --- /dev/null +++ b/Common/glibinterface.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 . + * +**/ +#include "glibinterface.h" +#include +#include + +#define STYLE_TYPE_SCHEMA "org.ukui.style" +#define KEY_SYSTEM_FONT_SIZE "system-font-size" +#define DEFAULT_FONT_SIZE (10.0) + +double getDefaultFontSize() +{ + GSettingsSchemaSource *schema_source = NULL; + GSettingsSchema *schema = NULL; + + schema_source = g_settings_schema_source_get_default(); + if(schema_source){ + schema = g_settings_schema_source_lookup (schema_source,KEY_SYSTEM_FONT_SIZE,TRUE); + if(schema){ + GVariant *size; + unsigned long length; + GSettings *gs; + + gs = g_settings_new(STYLE_TYPE_SCHEMA); + size = g_settings_get_default_value(gs, KEY_SYSTEM_FONT_SIZE); + QString fontsize(g_variant_get_string(size,&length)); + g_object_unref(gs); + + return fontsize.toDouble(); + } + } + return DEFAULT_FONT_SIZE; +} diff --git a/Common/glibinterface.h b/Common/glibinterface.h new file mode 100644 index 0000000..3b3c018 --- /dev/null +++ b/Common/glibinterface.h @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 GLIBINTERFACE_H +#define GLIBINTERFACE_H + +double getDefaultFontSize(); + +#endif // LOCKWIDGET_H + diff --git a/Common/plasma-shell-manager.cpp b/Common/plasma-shell-manager.cpp new file mode 100644 index 0000000..eeea7e4 --- /dev/null +++ b/Common/plasma-shell-manager.cpp @@ -0,0 +1,249 @@ +/* + * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 . + * +**/ + +#include "plasma-shell-manager.h" + +#include + +#include +#include + +#include +#include +#include + +static PlasmaShellManager* global_instance = nullptr; + +PlasmaShellManager *PlasmaShellManager::getInstance() +{ + if (!global_instance) + { + global_instance = new PlasmaShellManager; + qDebug() << "Here create instance..."; + } + qDebug() << "Return instance"; + return global_instance; +} + +bool PlasmaShellManager::setAppWindowActive() +{ + if (!supportPlasmaWindowManagement()) + return false; + + m_appWindow->requestActivate(); + return true; +} + +bool PlasmaShellManager::setAppWindowKeepAbove(bool keep) +{ + if (!supportPlasmaWindowManagement()) + { + qDebug() << "false"; + return false; + } + if(keep != m_appWindow->isKeepAbove()) { + qDebug() << "to keep above"; + m_appWindow->requestToggleKeepAbove(); + } + return true; +} + +bool PlasmaShellManager::setMaximized(QWindow *window) +{ + if (!supportShell()) + return false; + + auto surface = KWayland::Client::Surface::fromWindow(window); + if (!surface) + return false; + + auto shellSurface = m_shell->createSurface(surface, window); + if (!shellSurface) + return false; + + shellSurface->setMaximized(); + return true; +} + +bool PlasmaShellManager::setRole(QWindow *window, KWayland::Client::PlasmaShellSurface::Role role) +{ + if (!supportPlasmaShell()) + return false; + + auto surface = KWayland::Client::Surface::fromWindow(window); + if (!surface) + return false; + + auto plasmaShellSurface = m_plasmaShell->createSurface(surface, window); + if (!plasmaShellSurface) + return false; + + plasmaShellSurface->setRole(role); + return true; +} + +bool PlasmaShellManager::setPos(QWindow *window, const QPoint &pos) +{ + if (!supportPlasmaShell()) + return false; + + auto surface = KWayland::Client::Surface::fromWindow(window); + if (!surface) + return false; + + auto plasmaShellSurface = m_plasmaShell->createSurface(surface, window); + if (!plasmaShellSurface) + return false; + + plasmaShellSurface->setPosition(pos); + + return true; +} + +bool PlasmaShellManager::supportPlasmaShell() +{ + return m_plasmaShell; +} + +bool PlasmaShellManager::supportShell() +{ + return m_shell; +} + +bool PlasmaShellManager::supportPlasmaWindowManagement() +{ + return m_windowManager && m_appWindow; +} + +bool PlasmaShellManager::supportFakeInput() +{ + return m_fakeInput; +} + +bool PlasmaShellManager::supportKeyState() +{ + return m_keyState; +} + +KWayland::Client::Keystate::State PlasmaShellManager::getKeyState(KWayland::Client::Keystate::Key key) +{ + if(!supportKeyState()){ + return KWayland::Client::Keystate::Unlocked; + } + + return m_keyStateMap[key]; +} + +void PlasmaShellManager::setKeyPressed(quint32 key) +{ + if(!supportFakeInput()) + return ; + + m_fakeInput->requestKeyboardKeyPress(key); + m_fakeInput->requestKeyboardKeyRelease(key); +} + +PlasmaShellManager::PlasmaShellManager(QObject *parent) : QObject(parent) +{ + m_keyStateMap.insert(KWayland::Client::Keystate::Key::CapsLock,KWayland::Client::Keystate::Unlocked); + m_keyStateMap.insert(KWayland::Client::Keystate::Key::NumLock,KWayland::Client::Keystate::Unlocked); + m_keyStateMap.insert(KWayland::Client::Keystate::Key::ScrollLock,KWayland::Client::Keystate::Unlocked); + + auto connection = KWayland::Client::ConnectionThread::fromApplication(qApp); + auto registry = new KWayland::Client::Registry(this); + registry->create(connection->display()); + + connect(registry, &KWayland::Client::Registry::plasmaShellAnnounced, this, [=](){ + qDebug() << "plasmaShellAnnounced..."; + const auto interface = registry->interface(KWayland::Client::Registry::Interface::PlasmaShell); + if (interface.name != 0) { + qDebug() << "createPlasmaShell..."; + m_plasmaShell = registry->createPlasmaShell(interface.name, interface.version, this); + } + }); + + connect(registry, &KWayland::Client::Registry::plasmaWindowManagementAnnounced, this, [=](){ + qDebug() << "plasmaWindowManagementAnnounced"; + const auto interface = registry->interface(KWayland::Client::Registry::Interface::PlasmaWindowManagement); + if (interface.name != 0) { + qDebug() << "createPlasmaWindowManagement"; + m_windowManager = registry->createPlasmaWindowManagement(interface.name, interface.version, this); + } + if(m_windowManager) { + connect(m_windowManager, &KWayland::Client::PlasmaWindowManagement::windowCreated, + [this](KWayland::Client::PlasmaWindow *window) { + qDebug()<< "PlasmaWindow..."; + if (window->pid() == getpid()) { + if(isFirstCreate) { + isFirstCreate = false; + m_appWindow = window; + + connect(m_appWindow, &KWayland::Client::PlasmaWindow::activeChanged, + [this]() { + this->setAppWindowKeepAbove(true); + this->setAppWindowActive(); + }); + connect(m_appWindow, &KWayland::Client::PlasmaWindow::keepAboveChanged, + [this]() { + this->setAppWindowKeepAbove(true); + this->setAppWindowActive(); + }); + } + } + }); + } + }); + + connect(registry, &KWayland::Client::Registry::shellAnnounced, this, [=](){ + const auto interface = registry->interface(KWayland::Client::Registry::Interface::Shell); + if (interface.name != 0) { + m_shell = registry->createShell(interface.name, interface.version, this); + } + }); + + connect(registry, &KWayland::Client::Registry::fakeInputAnnounced, this, [=](){ + qDebug()<<"fakeInputAnnounced"; + const auto interface = registry->interface(KWayland::Client::Registry::Interface::FakeInput); + if (interface.name != 0) { + qDebug()<<"createFakeInput"; + m_fakeInput = registry->createFakeInput(interface.name, interface.version); + m_fakeInput->authenticate("ukui-screensaver-dialog","virual keyboard"); + } + }); + + connect(registry, &KWayland::Client::Registry::keystateAnnounced, this, [=](){ + qDebug()<<"keystateAnnounced"; + const auto interface = registry->interface(KWayland::Client::Registry::Interface::Keystate); + if (interface.name != 0) { + qDebug()<<"createKeyState"; + m_keyState = registry->createKeystate(interface.name, interface.version); + if(m_keyState){ + connect(m_keyState, &KWayland::Client::Keystate::stateChanged, + [this](KWayland::Client::Keystate::Key key,KWayland::Client::Keystate::State state) { + qDebug()<<"key = "<fetchStates(); + } + } + }); + + registry->setup(); + connection->roundtrip(); +} diff --git a/Common/plasma-shell-manager.h b/Common/plasma-shell-manager.h new file mode 100644 index 0000000..e5e0230 --- /dev/null +++ b/Common/plasma-shell-manager.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 PLASMASHELLMANAGER_H +#define PLASMASHELLMANAGER_H + +#include +#include +#include +#include +#include +#include +#include +#include + +class PlasmaShellManager : public QObject +{ + Q_OBJECT +public: + static PlasmaShellManager *getInstance(); + + bool setAppWindowActive(); + bool setAppWindowKeepAbove(bool keep); + bool setMaximized(QWindow *window); + bool setRole(QWindow *window, KWayland::Client::PlasmaShellSurface::Role role); + bool setPos(QWindow *window, const QPoint &pos); + void setKeyPressed(quint32 key); + + bool supportPlasmaShell(); + bool supportShell(); + bool supportPlasmaWindowManagement(); + bool supportFakeInput(); + bool supportKeyState(); + KWayland::Client::Keystate::State getKeyState(KWayland::Client::Keystate::Key key); +Q_SIGNALS: + void keyStateChanged(); + +private: + explicit PlasmaShellManager(QObject *parent = nullptr); + + KWayland::Client::PlasmaShell *m_plasmaShell = nullptr; + KWayland::Client::Shell *m_shell = nullptr; + KWayland::Client::PlasmaWindowManagement *m_windowManager = nullptr; + KWayland::Client::PlasmaWindow *m_appWindow = nullptr; + KWayland::Client::FakeInput *m_fakeInput = nullptr; + KWayland::Client::Keystate *m_keyState = nullptr; + + bool isFirstCreate = true; + + QMap m_keyStateMap; + +}; + + +#endif // PLASMASHELLMANAGER_H diff --git a/KylinNM/src/kylinnm.cpp b/KylinNM/src/kylinnm.cpp index 3446f2e..d17fd83 100644 --- a/KylinNM/src/kylinnm.cpp +++ b/KylinNM/src/kylinnm.cpp @@ -2470,6 +2470,7 @@ void KylinNM::enWifiDone() qDebug()<<"debug: already turn on the switch of wifi network"; syslog(LOG_DEBUG, "Already turn on the switch of wifi network"); + QTimer::singleShot(200, this, &KylinNM::onConnectChanged); } void KylinNM::disWifiDone() { diff --git a/KylinNM/src/swipegesturerecognizer.cpp b/KylinNM/src/swipegesturerecognizer.cpp index 87b553c..dd888c3 100644 --- a/KylinNM/src/swipegesturerecognizer.cpp +++ b/KylinNM/src/swipegesturerecognizer.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 . + * +**/ #include #include diff --git a/KylinNM/src/swipegesturerecognizer.h b/KylinNM/src/swipegesturerecognizer.h index 2e51665..4b6c7b8 100644 --- a/KylinNM/src/swipegesturerecognizer.h +++ b/KylinNM/src/swipegesturerecognizer.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 SWIPEGESTURERECOGNIZER_H #define SWIPEGESTURERECOGNIZER_H diff --git a/KylinNM/src/switchbutton.cpp b/KylinNM/src/switchbutton.cpp index 714e249..43ad098 100644 --- a/KylinNM/src/switchbutton.cpp +++ b/KylinNM/src/switchbutton.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 . + * +**/ #include "switchbutton.h" SwitchButton::SwitchButton(QWidget *parent) : QWidget(parent) diff --git a/KylinNM/src/switchbutton.h b/KylinNM/src/switchbutton.h index 7c0f1e5..8c86bc2 100644 --- a/KylinNM/src/switchbutton.h +++ b/KylinNM/src/switchbutton.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 SWITCHBUTTON_H #define SWITCHBUTTON_H diff --git a/VirtualKeyboard/CMakeLists.txt b/VirtualKeyboard/CMakeLists.txt index f9d52c7..aa1ddf2 100644 --- a/VirtualKeyboard/CMakeLists.txt +++ b/VirtualKeyboard/CMakeLists.txt @@ -4,21 +4,33 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) +include_directories(${PROJECT_SOURCE_DIR}/Common) + qt5_add_resources(VirtualKeyboard_SRC src/keyboard.qrc) +qt5_wrap_cpp(VirtualKeyboard_SRC + src/fakekeyboard.h + ) + set(VirtualKeyboard_SRC ${VirtualKeyboard_SRC} - src/cursormonitor.cpp - src/keyboardwidget.cpp - src/virtualkeyboard.cpp - src/x11keyboard.cpp - src/keyboard.qrc) + src/charsmorewidget.cpp + src/charswidget.cpp + src/dragwidget.cpp + src/kbbutton.cpp + src/kbtitle.cpp + src/letterswidget.cpp + src/numberswidget.cpp + src/virtualkeyboardwidget.cpp + src/x11keyboard.cpp + src/qtkeyboard.cpp + ) include_directories( ${Qt5Core_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} - ) + ) add_library(VirtualKeyboard STATIC ${VirtualKeyboard_SRC}) -target_link_libraries(VirtualKeyboard Qt5::Core Qt5::Widgets) +target_link_libraries(VirtualKeyboard Qt5::Core Qt5::Widgets Qt5::X11Extras Common) diff --git a/VirtualKeyboard/VirtualKeyboard.pri b/VirtualKeyboard/VirtualKeyboard.pri index e8029dc..79c43c4 100644 --- a/VirtualKeyboard/VirtualKeyboard.pri +++ b/VirtualKeyboard/VirtualKeyboard.pri @@ -1,18 +1,26 @@ SOURCES += \ - $$PWD/src/keyboardwidget.cpp \ - $$PWD/src/x11keyboard.cpp \ - $$PWD/src/cursormonitor.cpp \ - $$PWD/src/virtualkeyboard.cpp + $$PWD/src/charsmorewidget.cpp \ + $$PWD/src/charswidget.cpp \ + $$PWD/src/dragwidget.cpp \ + $$PWD/src/kbbutton.cpp \ + $$PWD/src/kbtitle.cpp \ + $$PWD/src/letterswidget.cpp \ + $$PWD/src/numberswidget.cpp \ + $$PWD/src/virtualkeyboardwidget.cpp \ + $$PWD/src/x11keyboard.cpp HEADERS += \ - $$PWD/src/keyboardwidget.h \ - $$PWD/src/x11keyboard.h \ - $$PWD/src/cursormonitor.h \ - $$PWD/src/virtualkeyboard.h - -FORMS += \ - $$PWD/src/keyboardwidget.ui + $$PWD/src/charsmorewidget.h \ + $$PWD/src/charswidget.h \ + $$PWD/src/commondef.h \ + $$PWD/src/dragwidget.h \ + $$PWD/src/kbbutton.h \ + $$PWD/src/kbtitle.h \ + $$PWD/src/letterswidget.h \ + $$PWD/src/numberswidget.h \ + $$PWD/src/virtualkeyboardwidget.h \ + $$PWD/src/x11keyboard.h RESOURCES += \ diff --git a/VirtualKeyboard/src/charsmorewidget.cpp b/VirtualKeyboard/src/charsmorewidget.cpp new file mode 100644 index 0000000..01cc10f --- /dev/null +++ b/VirtualKeyboard/src/charsmorewidget.cpp @@ -0,0 +1,189 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 . + * +**/ +#include "charsmorewidget.h" +#include "commondef.h" + +#include +#include +#include +#include +#include +#include + +CharsMoreWidget::CharsMoreWidget(QWidget *parent/* = nullptr*/) + : QWidget(parent) +{ + this->setAttribute(Qt::WA_TranslucentBackground);//背景透明 + setWindowFlags(Qt::FramelessWindowHint | + Qt::WindowStaysOnTopHint | + Qt::WindowDoesNotAcceptFocus); + initUI(); +} + +CharsMoreWidget::~CharsMoreWidget() +{ + +} + +void CharsMoreWidget::adjustGeometry(double lfWidthScale, double lfHeightScale, bool isVertical/* = false*/, bool floatStatus) +{ + QMap::iterator itGeometry = m_mapBtnGeometrys.begin(); + for (; itGeometry != m_mapBtnGeometrys.end(); itGeometry ++) { + QWidget *widget = itGeometry.key(); + if (widget) { + QRect oldGeometry = itGeometry.value(); + QRect newGeometry = oldGeometry; + if (floatStatus) { + newGeometry.setX(oldGeometry.x()*lfWidthScale*KEYBOARD_FLOAT_PERCENTAGE); + newGeometry.setY(oldGeometry.y()*lfHeightScale); + newGeometry.setWidth(oldGeometry.width()*lfWidthScale*KEYBOARD_FLOAT_PERCENTAGE); + newGeometry.setHeight(oldGeometry.height()*lfHeightScale); + } else { + newGeometry.setX(oldGeometry.x()*lfWidthScale); + newGeometry.setY(oldGeometry.y()*lfHeightScale); + newGeometry.setWidth(oldGeometry.width()*lfWidthScale); + newGeometry.setHeight(oldGeometry.height()*lfHeightScale); + } + widget->setGeometry(newGeometry); + } + } + + QChar chChars[] = {',', '.', '?', '!', '\'', ':', '~', '@', ';', '"', + '/', '(', ')', '_', '+', '=', '`', '^', '#', '*', + '%', '&', '\\', '[', ']', '<', '>', '{', '}', '|', + '$', '-'}; + for (int n = 0; n < sizeof(chChars)/sizeof(QChar); n++) { //单独更新符号btn的高度 + QString objName = QString("btn_%1").arg(QString(chChars[n])); + KBButton *btn = findChild(objName); + btn->setFixedHeight(KEYBOARD_FIXED_DEFAULT_NORMAL_CHARSMORE_BTN_HEIGHT *lfHeightScale); + } + //更新listfarame的高度 + listFrame->setFixedHeight(KEYBOARD_FIXED_DEFAULT_NORMAL_CHARSMORE_BTN_HEIGHT *m_vlayoutBtnList->count() *lfHeightScale); +} + +void CharsMoreWidget::onBtnClicked(QChar charId) +{ + QObject *obj = sender(); + KBButton *btn = static_cast(obj); + QString objName = btn->objectName(); + int lastUnderline = objName.lastIndexOf('_'); + int start = strlen("btn_"); + int keyLength = lastUnderline - start; + QString keyName = objName.mid(start, keyLength); + if (keyName == BTN_RETURN) { + Q_EMIT specialBtnClicked(PAGE_CHAR); + } else if (charId != QChar::Null) { + Q_EMIT normalBtnClicked(charId); + } else { + Q_EMIT specialBtnClicked(keyName); + } +} + +void CharsMoreWidget::initUI() +{ + // all chars + m_vlayoutBtnList = new QVBoxLayout(); + m_vlayoutBtnList->setContentsMargins(8,0,0,0); + m_vlayoutBtnList->setSpacing(1); + listFrame = new QFrame(); + listFrame->setLayout(m_vlayoutBtnList); + listFrame->setStyleSheet("QFrame{border-radius: 8px}"); + m_scrollFrame = new QScrollArea(this); + m_scrollFrame->setContentsMargins(0, 0, 0, 0); + m_scrollFrame->setFocusPolicy(Qt::NoFocus); + m_scrollFrame->setStyleSheet("QScrollArea {background-color: #C0FFFFFF; border-radius:8px;}"); + m_scrollFrame->viewport()->setStyleSheet("background-color:transparent;"); + m_scrollFrame->verticalScrollBar()->setProperty("drawScrollBarGroove", false); + m_scrollFrame->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + m_scrollFrame->verticalScrollBar()->setContextMenuPolicy(Qt::NoContextMenu); + m_scrollFrame->setWidgetResizable(true); + m_scrollFrame->setWidget(listFrame); + m_scrollFrame->setGeometry(KEYBOARD_FIXED_DEFAULT_CHARSMORE_L1, 0, + KEYBOARD_FIXED_DEFAULT_CHARSMORE_LIST_WIDTH, KEYBOARD_FIXED_DEFAULT_CHARSMORE_LIST_HEIGHT); + listFrame->setGeometry(KEYBOARD_FIXED_DEFAULT_CHARSMORE_L1, 0, + KEYBOARD_FIXED_DEFAULT_CHARSMORE_LIST_WIDTH, KEYBOARD_FIXED_DEFAULT_CHARSMORE_LIST_HEIGHT); + m_mapBtnGeometrys[m_scrollFrame] = m_scrollFrame->geometry(); + m_mapBtnGeometrys[listFrame] = listFrame->geometry(); + QChar chChars[] = {',', '.', '?', '!', '\'', ':', '~', '@', ';', '"', + '/', '(', ')', '_', '+', '=', '`', '^', '#', '*', + '%', '&', '\\', '[', ']', '<', '>', '{', '}', '|', + '$', '-', ' ', ' ', ' ', ' '}; + QHBoxLayout *lastLayout = nullptr; + for (int n = 0; n < sizeof(chChars)/sizeof(QChar); n++) { + KBButton *charBtn = new KBButton(listFrame); + charBtn->setCharId(chChars[n]); + charBtn->updateStyleSheet(KEYBOARD_LETTER_COLOR_NORMAL,KEYBOARD_LETTER_COLOR_PRESSED, + KEYBOARD_LETTER_COLOR_PRESSED,KEYBOARD_LETTER_COLOR_NORMAL, + KEYBOARD_LETTER_COLOR_PRESSED,KEYBOARD_FONT_COLOR_PRESS, + KBButton::BORDER_RADIUS_NONE); + if ((n%KEYBOARD_FIXED_DEFAULT_CHARSMORE_LIST_COLS) == 0) { + lastLayout = new QHBoxLayout(); + lastLayout->setContentsMargins(0,0,0,0); + lastLayout->setSpacing(1); + m_vlayoutBtnList->addLayout(lastLayout); + } + if (chChars[n] == ' ') { + charBtn->setDisabled(true); + } else { + charBtn->setObjectName(QString("btn_%1").arg(QString(chChars[n]))); + } + charBtn->setFixedHeight(KEYBOARD_FIXED_DEFAULT_NORMAL_CHARSMORE_BTN_HEIGHT); + lastLayout->addWidget(charBtn); + m_mapSubWidgetListRects[charBtn] = charBtn->geometry(); + connect(charBtn, &KBButton::clicked, this, &CharsMoreWidget::onBtnClicked); + } + // backspace + KBButton *backspaceBtn = new KBButton(this); + backspaceBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_CHARSMORE_L1+(KEYBOARD_FIXED_DEFAULT_CHARSMORE_LIST_WIDTH+KEYBOARD_FIXED_DEFAULT_CHARSMORE_HSPACING), + 0, + KEYBOARD_FIXED_DEFAULT_CHARSMORE_BTN_WIDTH, + KEYBOARD_FIXED_DEFAULT_CHARSMORE_BTN_HEIGHT); + backspaceBtn->setObjectName("btn_backspace"); + backspaceBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED,KEYBOARD_OTHER_FONT_COLOR_PRESS); + backspaceBtn->setIcon(QIcon(":/images/images/delet.svg")); + m_mapBtnGeometrys[backspaceBtn] = backspaceBtn->geometry(); + connect(backspaceBtn, &KBButton::clicked, this, &CharsMoreWidget::onBtnClicked); + // enter + KBButton *enterBtn = new KBButton(this); + enterBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_CHARSMORE_L1+(KEYBOARD_FIXED_DEFAULT_CHARSMORE_LIST_WIDTH+KEYBOARD_FIXED_DEFAULT_CHARSMORE_HSPACING), + (KEYBOARD_FIXED_DEFAULT_CHARSMORE_BTN_HEIGHT+KEYBOARD_FIXED_DEFAULT_CHARSMORE_VSPACING)*1, + KEYBOARD_FIXED_DEFAULT_CHARSMORE_BTN_WIDTH, + KEYBOARD_FIXED_DEFAULT_CHARSMORE_BTN_HEIGHT); + enterBtn->setObjectName("btn_enter"); + enterBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED,KEYBOARD_OTHER_FONT_COLOR_PRESS); + enterBtn->setIcon(QIcon(":/images/images/enter.svg")); + connect(enterBtn, &KBButton::clicked, this, &CharsMoreWidget::onBtnClicked); + m_mapBtnGeometrys[enterBtn] = enterBtn->geometry(); + // return + KBButton *returnBtn = new KBButton(this); + returnBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_CHARSMORE_L1+(KEYBOARD_FIXED_DEFAULT_CHARSMORE_LIST_WIDTH+KEYBOARD_FIXED_DEFAULT_CHARSMORE_HSPACING), + (KEYBOARD_FIXED_DEFAULT_CHARSMORE_BTN_HEIGHT+KEYBOARD_FIXED_DEFAULT_CHARSMORE_VSPACING)*2, + KEYBOARD_FIXED_DEFAULT_CHARSMORE_BTN_WIDTH, + KEYBOARD_FIXED_DEFAULT_CHARSMORE_BTN_HEIGHT); + returnBtn->setObjectName("btn_return"); + returnBtn->setText(tr("&&?!")); + returnBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED,KEYBOARD_OTHER_FONT_COLOR_PRESS); + connect(returnBtn, &KBButton::clicked, this, &CharsMoreWidget::onBtnClicked); + m_mapBtnGeometrys[returnBtn] = returnBtn->geometry(); +} diff --git a/VirtualKeyboard/src/charsmorewidget.h b/VirtualKeyboard/src/charsmorewidget.h new file mode 100644 index 0000000..9971ed3 --- /dev/null +++ b/VirtualKeyboard/src/charsmorewidget.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 CHARSMOREWIDGETS_H +#define CHARSMOREWIDGETS_H + +#include +#include "kbbutton.h" +#include + +class QVBoxLayout; +class QHBoxLayout; +class QScrollArea; +class QFrame; +class CharsMoreWidget : public QWidget +{ + Q_OBJECT +public: + explicit CharsMoreWidget(QWidget *parent = nullptr); + ~CharsMoreWidget(); + void adjustGeometry(double lfWidthScale, double lfHeightScale, bool isVertical = false, bool floatStatus = false); + +public Q_SLOTS: + void onBtnClicked(QChar charId); + +Q_SIGNALS: + void clicked(int nKeyId); + void specialBtnClicked(QString keyName); + void normalBtnClicked(QChar charId); + +private: + void initUI(); + +private: + QMap m_mapBtnGeometrys; + QMap m_mapSubWidgetListRects; + QVBoxLayout *m_vlayoutBtnList = nullptr; + QScrollArea *m_scrollFrame = nullptr; + QFrame *listFrame = nullptr; +}; + +#endif // CHARSMOREWIDGETS_H diff --git a/VirtualKeyboard/src/charswidget.cpp b/VirtualKeyboard/src/charswidget.cpp new file mode 100644 index 0000000..c66597f --- /dev/null +++ b/VirtualKeyboard/src/charswidget.cpp @@ -0,0 +1,255 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 . + * +**/ +#include "charswidget.h" + +#include "commondef.h" +#include + +CharsWidget::CharsWidget(QWidget *parent/* = nullptr*/) + : QWidget(parent) +{ + this->setAttribute(Qt::WA_TranslucentBackground);//背景透明 + initUI(); +} + +CharsWidget::~CharsWidget() +{ + +} + +void CharsWidget::initUI() +{ + // line 1 + QChar chLine1[] = {'1','2','3','4','5','6','7','8','9','0'}; + for (int n = 0; n < sizeof(chLine1)/sizeof(QChar); n++) { + KBButton *charBtn = new KBButton(this); + charBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L1+(KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*n, + KEYBOARD_FIXED_DEFAULT_TMARGIN, + KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + charBtn->setCharId(chLine1[n]); + charBtn->updateStyleSheet(KEYBOARD_LETTER_COLOR_NORMAL,KEYBOARD_LETTER_COLOR_PRESSED,KEYBOARD_LETTER_COLOR_PRESSED, + KEYBOARD_LETTER_COLOR_BORDER_NORMAL,KEYBOARD_LETTER_COLOR_BORDER_PRESSED,KEYBOARD_FONT_COLOR_PRESS); + connect(charBtn, &KBButton::clicked, this, &CharsWidget::onBtnClicked); + m_mapBtnGeometrys[charBtn] = charBtn->geometry(); + } + // backspace + KBButton *backspaceBtn = new KBButton(this); + backspaceBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L1+(KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*10, + KEYBOARD_FIXED_DEFAULT_TMARGIN, + KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + backspaceBtn->setObjectName("btn_backspace"); + backspaceBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED,KEYBOARD_OTHER_FONT_COLOR_PRESS); + connect(backspaceBtn, &KBButton::clicked, this, &CharsWidget::onBtnClicked); + backspaceBtn->setIcon(QIcon(":/images/images/delet.svg")); + m_mapBtnGeometrys[backspaceBtn] = backspaceBtn->geometry(); + + // line 2 + QChar chLine2[] = {'~','/',':',';','(',')','@','"','\''}; + for (int n = 0; n < sizeof(chLine2)/sizeof(QChar); n++) { + KBButton *charBtn = new KBButton(this); + charBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L2+(KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*n, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING), + KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + charBtn->setCharId(chLine2[n]); + charBtn->updateStyleSheet(KEYBOARD_LETTER_COLOR_NORMAL,KEYBOARD_LETTER_COLOR_PRESSED,KEYBOARD_LETTER_COLOR_PRESSED, + KEYBOARD_LETTER_COLOR_BORDER_NORMAL,KEYBOARD_LETTER_COLOR_BORDER_PRESSED,KEYBOARD_FONT_COLOR_PRESS); + connect(charBtn, &KBButton::clicked, this, &CharsWidget::onBtnClicked); + m_mapBtnGeometrys[charBtn] = charBtn->geometry(); + } + // enter + KBButton *enterBtn = new KBButton(this); + enterBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L2+(KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*9, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING), + KEYBOARD_FIXED_DEFAULT_ENTERBTN_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + enterBtn->setObjectName("btn_enter"); + enterBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED,KEYBOARD_OTHER_FONT_COLOR_PRESS); + connect(enterBtn, &KBButton::clicked, this, &CharsWidget::onBtnClicked); + enterBtn->setIcon(QIcon(":/images/images/enter.svg")); + m_mapBtnGeometrys[enterBtn] = enterBtn->geometry(); + + // line 3 + QChar chLine3[] = {'-','_','#','%','$','+','^',',','.','!'}; + for (int n = 0; n < sizeof(chLine3)/sizeof(QChar); n++) { + KBButton *charBtn = new KBButton(this); + charBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L3+(KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*(n+1), + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*2, + KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + charBtn->setCharId(chLine3[n]); + charBtn->updateStyleSheet(KEYBOARD_LETTER_COLOR_NORMAL,KEYBOARD_LETTER_COLOR_PRESSED,KEYBOARD_LETTER_COLOR_PRESSED, + KEYBOARD_LETTER_COLOR_BORDER_NORMAL,KEYBOARD_LETTER_COLOR_BORDER_PRESSED,KEYBOARD_FONT_COLOR_PRESS); + connect(charBtn, &KBButton::clicked, this, &CharsWidget::onBtnClicked); + m_mapBtnGeometrys[charBtn] = charBtn->geometry(); + } + // more + KBButton *moreBtn = new KBButton(this); + moreBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L3, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*2, + KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + moreBtn->setObjectName("btn_more"); + moreBtn->setText(tr("More")); + moreBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED,KEYBOARD_OTHER_FONT_COLOR_PRESS); + connect(moreBtn, &KBButton::clicked, this, &CharsWidget::onBtnClicked); + m_mapBtnGeometrys[moreBtn] = moreBtn->geometry(); + + // line 4 + KBButton *returnBtn = new KBButton(this); + returnBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L4, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*3, + KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + returnBtn->setObjectName("btn_return"); + returnBtn->setText(tr("ABC")); + returnBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED,KEYBOARD_OTHER_FONT_COLOR_PRESS); + connect(returnBtn, &KBButton::clicked, this, &CharsWidget::onBtnClicked); + m_mapBtnGeometrys[returnBtn] = returnBtn->geometry(); + + KBButton *numBtn = new KBButton(this); + numBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L4+(KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING), + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*3, + KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + numBtn->setObjectName("btn_number"); + numBtn->setText(tr("123")); + numBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED,KEYBOARD_OTHER_FONT_COLOR_PRESS); + connect(numBtn, &KBButton::clicked, this, &CharsWidget::onBtnClicked); + m_mapBtnGeometrys[numBtn] = numBtn->geometry(); + + KBButton *threedBtn = new KBButton(this); + threedBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L4+(KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*2, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*3, + KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + threedBtn->setObjectName("btn_threed"); + threedBtn->setCharId(('&')); + threedBtn->updateStyleSheet(KEYBOARD_LETTER_COLOR_NORMAL,KEYBOARD_LETTER_COLOR_PRESSED,KEYBOARD_LETTER_COLOR_PRESSED, + KEYBOARD_LETTER_COLOR_BORDER_NORMAL,KEYBOARD_LETTER_COLOR_BORDER_PRESSED,KEYBOARD_FONT_COLOR_PRESS); + connect(threedBtn, &KBButton::clicked, this, &CharsWidget::onBtnClicked); + m_mapBtnGeometrys[threedBtn] = threedBtn->geometry(); + + KBButton *spaceBtn = new KBButton(this); + spaceBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L4+(KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*3, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*3, + KEYBOARD_FIXED_DEFAULT_SPACEBTN_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + spaceBtn->setObjectName("btn_space"); + spaceBtn->updateStyleSheet(KEYBOARD_LETTER_COLOR_NORMAL,KEYBOARD_LETTER_COLOR_PRESSED, + KEYBOARD_LETTER_COLOR_PRESSED,KEYBOARD_LETTER_COLOR_BORDER_NORMAL, + KEYBOARD_LETTER_COLOR_BORDER_PRESSED,KEYBOARD_FONT_COLOR_PRESS); + spaceBtn->setIcon(QIcon(":/images/images/space.svg")); + connect(spaceBtn, &KBButton::clicked, this, &CharsWidget::onBtnClicked); + m_mapBtnGeometrys[spaceBtn] = spaceBtn->geometry(); + + KBButton *whBtn = new KBButton(this); + whBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L4+(KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*8, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*3, + KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + whBtn->setCharId('?'); + whBtn->updateStyleSheet(KEYBOARD_LETTER_COLOR_NORMAL,KEYBOARD_LETTER_COLOR_PRESSED,KEYBOARD_LETTER_COLOR_PRESSED, + KEYBOARD_LETTER_COLOR_BORDER_NORMAL,KEYBOARD_LETTER_COLOR_BORDER_PRESSED,KEYBOARD_FONT_COLOR_PRESS); + connect(whBtn, &KBButton::clicked, this, &CharsWidget::onBtnClicked); + m_mapBtnGeometrys[whBtn] = whBtn->geometry(); + + KBButton *leftBtn = new KBButton(this); + leftBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L4+(KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*9, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*3, + KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + leftBtn->setObjectName("btn_left"); + leftBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED,KEYBOARD_OTHER_FONT_COLOR_PRESS); + leftBtn->setIcon(QIcon(":/images/images/left.svg")); + connect(leftBtn, &KBButton::clicked, this, &CharsWidget::onBtnClicked); + m_mapBtnGeometrys[leftBtn] = leftBtn->geometry(); + + KBButton *rightBtn = new KBButton(this); + rightBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L4+(KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*10, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*3, + KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + rightBtn->setObjectName("btn_right"); + rightBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED,KEYBOARD_OTHER_FONT_COLOR_PRESS); + rightBtn->setIcon(QIcon(":/images/images/right.svg")); + connect(rightBtn, &KBButton::clicked, this, &CharsWidget::onBtnClicked); + m_mapBtnGeometrys[rightBtn] = rightBtn->geometry(); +} + +void CharsWidget::adjustGeometry(double lfWidthScale, double lfHeightScale, bool isVertical/* = false*/, bool floatStatus) +{ + QMap::iterator itGeometry = m_mapBtnGeometrys.begin(); + for (; itGeometry != m_mapBtnGeometrys.end(); itGeometry ++) { + KBButton *button = itGeometry.key(); + if (button) { + QRect oldGeometry = itGeometry.value(); + QRect newGeometry = oldGeometry; + if (floatStatus) { + newGeometry.setX(oldGeometry.x()*lfWidthScale*KEYBOARD_FLOAT_PERCENTAGE); + newGeometry.setY(oldGeometry.y()*lfHeightScale); + newGeometry.setWidth(oldGeometry.width()*lfWidthScale*KEYBOARD_FLOAT_PERCENTAGE); + newGeometry.setHeight(oldGeometry.height()*lfHeightScale); + } else { + newGeometry.setX(oldGeometry.x()*lfWidthScale); + newGeometry.setY(oldGeometry.y()*lfHeightScale); + newGeometry.setWidth(oldGeometry.width()*lfWidthScale); + newGeometry.setHeight(oldGeometry.height()*lfHeightScale); + } + button->setGeometry(newGeometry); + } + } +} + +void CharsWidget::onBtnClicked(QChar charId) +{ + QObject *obj = sender(); + KBButton *btn = static_cast(obj); + QString objName = btn->objectName(); + int lastUnderline = objName.lastIndexOf('_'); + int start = strlen("btn_"); + int keyLength = lastUnderline - start; + QString keyName = objName.mid(start, keyLength); + if (keyName == BTN_RETURN) { + Q_EMIT specialBtnClicked(PAGE_LETTER); + } else if (keyName == "more") { + Q_EMIT specialBtnClicked(PAGE_CHARSMORE); + } else if (keyName == "number") { + Q_EMIT specialBtnClicked(PAGE_NUMBER); + } else if (charId != QChar::Null) { + Q_EMIT normalBtnClicked(charId); + } else { + Q_EMIT specialBtnClicked(keyName); + } +} diff --git a/VirtualKeyboard/src/charswidget.h b/VirtualKeyboard/src/charswidget.h new file mode 100644 index 0000000..1076201 --- /dev/null +++ b/VirtualKeyboard/src/charswidget.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 CHARSWIDGET_H +#define CHARSWIDGET_H + +#include +#include "kbbutton.h" +#include + +class CharsWidget : public QWidget +{ + Q_OBJECT +public: + explicit CharsWidget(QWidget *parent = nullptr); + virtual ~CharsWidget(); + + void adjustGeometry(double lfWidthScale, double lfHeightScale, bool isVertical = false, bool floatStatus = false); + +public Q_SLOTS: + void onBtnClicked(QChar charId); + +Q_SIGNALS: + void clicked(int nKeyId); + void specialBtnClicked(QString keyName); + void normalBtnClicked(QChar c); + +private: + void initUI(); + +private: + QMap m_mapBtnGeometrys; + +}; + +#endif // CHARSWIDGET_H diff --git a/VirtualKeyboard/src/commondef.h b/VirtualKeyboard/src/commondef.h new file mode 100644 index 0000000..629bd2d --- /dev/null +++ b/VirtualKeyboard/src/commondef.h @@ -0,0 +1,121 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 COMMONDEF_H +#define COMMONDEF_H + +#define KEYBOARD_PARENT_DEFAULT_WIDTH 1620 +#define KEYBOARD_PARENT_DEFAULT_HEIGHT 1080 + +#define KEYBOARD_FIXED_DEFAULT_WIDTH 1620 +#define KEYBOARD_DRAGSHOW_FIXED_DEFAULT_HEIGHT 428 + +#define KEYBOARD_DRAGSHOW_FIXED_DEFAULT_WIDTH 1458 +#define KEYBOARD_DRAGHIDE_FIXED_DEFAULT_HEIGHT 404 + +#define KEYBOARD_TITLEBTN_DEFAULT_WIDTH 56 +#define KEYBOARD_TITLEBTN_DEFAULT_HEIGHT 56 +#define KEYBOARD_TITLE_DEFAULT_HEIGHT 68 + +#define KEYBOARD_DRAGBTN_DEFAULT_WIDTH 56 +#define KEYBOARD_DRAGBTN_DEFAULT_HEIGHT 4 +#define KEYBOARD_DRAG_DEFAULT_HEIGHT 26 + +#define KEYBOARD_FLOAT_PERCENTAGE 0.9 + +#define KEYBOARD_FIXED_DEFAULT_LMARGIN 22 // 左边距 +#define KEYBOARD_FIXED_DEFAULT_RMARGIN 22 // 右边距 +#define KEYBOARD_FIXED_DEFAULT_TMARGIN 8 // 上边距 +#define KEYBOARD_FIXED_DEFAULT_BMARGIN 16 // 下边距 + +#define KEYBOAED_FIXED_DEFAULT_VSPACING 8 // 垂直间隔 +#define KEYBOAED_FIXED_DEFAULT_HSPACING 8 // 水平间隔 +// letters +#define KEYBOARD_FIXED_DEFAULT_LETTER_L1 (KEYBOARD_FIXED_DEFAULT_LMARGIN+0) // 字符页面左起点 +#define KEYBOARD_FIXED_DEFAULT_LETTER_L2 (KEYBOARD_FIXED_DEFAULT_LMARGIN+72) // 字符页面左起点 +#define KEYBOARD_FIXED_DEFAULT_LETTER_L3 (KEYBOARD_FIXED_DEFAULT_LMARGIN+0) // 字符页面左起点 +#define KEYBOARD_FIXED_DEFAULT_LETTER_L4 (KEYBOARD_FIXED_DEFAULT_LMARGIN+0) // 字符页面左起点 +#define KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH 136 // 字符按钮宽度 +#define KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT 72 // 字符按钮高度 +#define KEYBOARD_FIXED_DEFAULT_LETTER_ENTWIDTH 208 +#define KEYBOARD_FIXED_DEFAULT_LETTER_SPCWIDTH 712 +#define KEYBOARD_FIXED_DEFAULT_TITLEBTN_WIDTH 56 +#define KEYBOARD_FIXED_DEFAULT_TITLEBTN_HEIGHT 56 + +#define KEYBOARD_FIXED_DEFAULT_ENTERBTN_WIDTH 208 +#define KEYBOARD_FIXED_DEFAULT_SPACEBTN_WIDTH 712 + +#define KEYBOARD_LETTER_COLOR_NORMAL "#FFFFFF" +#define KEYBOARD_LETTER_COLOR_PRESSED "#DDE0E4" +#define KEYBOARD_LETTER_COLOR_BORDER_NORMAL "#95A0AD" +#define KEYBOARD_LETTER_COLOR_BORDER_PRESSED "#95A0AD" + +#define KEYBOARD_OTHER_COLOR_NORMAL "#CED3D9" +#define KEYBOARD_OTHER_COLOR_PRESSED "#3790FA" +#define KEYBOARD_OTHER_COLOR_BORDER_NORMAL "#95A0AD" +#define KEYBOARD_OTHER_COLOR_BORDER_PRESSED "#1174E5" + +#define KEYBOARD_FONT_COLOR_PRESS "#262626" +#define KEYBOARD_OTHER_FONT_COLOR_PRESS "#FFFFFF" + +//numbers +#define KEYBOARD_FIXED_DEFAULT_NUMBER_L1 (KEYBOARD_FIXED_DEFAULT_LMARGIN+0) +#define KEYBOARD_FIXED_DEFAULT_NUMBER_L2 (KEYBOARD_FIXED_DEFAULT_LMARGIN+0) +#define KEYBOARD_FIXED_DEFAULT_NUMBER_L3 (KEYBOARD_FIXED_DEFAULT_LMARGIN+0) +#define KEYBOARD_FIXED_DEFAULT_NUMBER_L4 (KEYBOARD_FIXED_DEFAULT_LMARGIN+0) + +#define KEYBOARD_FIXED_DEFAULT_NUMBER_WIDTH 306 // 数字按钮宽度 +#define KEYBOARD_FIXED_DEFAULT_NUMBER_HEIGHT 72 // 数字按钮高度 +#define KEYBOARD_FIXED_DEFAULT_NUMBER_CHARS_HEIGHT 230 // 数字字符按钮高度 + +// chars more + +#define KEYBOARD_FIXED_DEFAULT_CHARSMORE_L1 (KEYBOARD_FIXED_DEFAULT_LMARGIN+0) +#define KEYBOARD_FIXED_DEFAULT_CHARSMORE_HSPACING 16 +#define KEYBOARD_FIXED_DEFAULT_CHARSMORE_VSPACING 16 + +#define KEYBOARD_FIXED_DEFAULT_CHARSMORE_LIST_COLS 6 +#define KEYBOARD_FIXED_DEFAULT_CHARSMORE_LIST_WIDTH 1350 // 字符列表宽度 +#define KEYBOARD_FIXED_DEFAULT_CHARSMORE_LIST_HEIGHT 315 // 字符列表高度 +#define KEYBOARD_FIXED_DEFAULT_CHARSMORE_BTN_WIDTH 214 // 按钮宽度 +#define KEYBOARD_FIXED_DEFAULT_CHARSMORE_BTN_HEIGHT 94 // 功能按钮高度 +#define KEYBOARD_FIXED_DEFAULT_NORMAL_CHARSMORE_BTN_HEIGHT 80 // 符号按钮高度 + +//iconsize +#define KEYBOARD_FIXED_DEFAULT_ICONSIZE QSize(25, 25) + +//keyName +#define PAGE_CHAR "page_char" +#define PAGE_NUMBER "page_number" +#define PAGE_CHARSMORE "page_charmore" +#define PAGE_LETTER "page_letter" +#define BTN_FLOAT "float" +#define BTN_CLOSE "close" +#define BTN_RETURN "return" +#define BTN_BACK "backspace" +#define BTN_ENTER "enter" +#define BTN_SHIFT "shift" +#define BTN_CTRL "ctrl" +#define BTN_ALT "alt" +#define BTN_SPACE "space" +#define BTN_RIGHT "right" +#define BTN_LEFT "left" +#define BTN_CAPSLOCK "capslock" + + + +#endif // COMMONDEF_H diff --git a/VirtualKeyboard/src/cursormonitor.cpp b/VirtualKeyboard/src/cursormonitor.cpp index 2c76123..9553a60 100644 --- a/VirtualKeyboard/src/cursormonitor.cpp +++ b/VirtualKeyboard/src/cursormonitor.cpp @@ -1,9 +1,9 @@ -/** +/* * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, @@ -12,9 +12,8 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. + * along with this program; if not, see . + * **/ #include "cursormonitor.h" #include diff --git a/VirtualKeyboard/src/dragwidget.cpp b/VirtualKeyboard/src/dragwidget.cpp new file mode 100644 index 0000000..db8a332 --- /dev/null +++ b/VirtualKeyboard/src/dragwidget.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 . + * +**/ +#include "dragwidget.h" +#include +#include +#include +#include "commondef.h" + +DragWidget::DragWidget(QWidget *parent/* = nullptr*/) + : QWidget(parent) +{ + setAttribute(Qt::WA_TranslucentBackground);//背景透明 + initUI(); +} + +DragWidget::~DragWidget() +{ + +} + +void DragWidget::initUI() +{ + setFixedHeight(KEYBOARD_DRAG_DEFAULT_HEIGHT); + + m_labelDrag = new QLabel(this); + m_labelDrag->setPixmap(QPixmap(":/images/images/drag.svg")); + m_labelDrag->setGeometry((KEYBOARD_PARENT_DEFAULT_WIDTH - KEYBOARD_TITLEBTN_DEFAULT_WIDTH)/2, + (this->height() - KEYBOARD_TITLEBTN_DEFAULT_HEIGHT)/2, + KEYBOARD_TITLEBTN_DEFAULT_WIDTH, KEYBOARD_TITLEBTN_DEFAULT_HEIGHT); + m_mapSubGeometrys[m_labelDrag] = m_labelDrag->geometry(); +} + +void DragWidget::adjustGeometry(double lfWidthScale, double lfHeightScale, bool isVertical/* = false*/, bool floatStatus) +{ + setFixedHeight(KEYBOARD_DRAG_DEFAULT_HEIGHT*lfHeightScale); + QMap::iterator itGeometry = m_mapSubGeometrys.begin(); + for (; itGeometry != m_mapSubGeometrys.end(); itGeometry ++) { + QLabel *label = itGeometry.key(); + if (label) { + QRect oldGeometry = itGeometry.value(); + QRect newGeometry = oldGeometry; + if (floatStatus) { + newGeometry.setX(oldGeometry.x()*lfWidthScale*KEYBOARD_FLOAT_PERCENTAGE); + newGeometry.setY(oldGeometry.y()*lfHeightScale); + newGeometry.setWidth(oldGeometry.width()*lfWidthScale*KEYBOARD_FLOAT_PERCENTAGE); + newGeometry.setHeight(oldGeometry.height()*lfHeightScale); + } else { + newGeometry.setX(oldGeometry.x()*lfWidthScale); + newGeometry.setY(oldGeometry.y()*lfHeightScale); + newGeometry.setWidth(oldGeometry.width()*lfWidthScale); + newGeometry.setHeight(oldGeometry.height()*lfHeightScale); + } + label->setGeometry(newGeometry); + } + } +} diff --git a/VirtualKeyboard/src/dragwidget.h b/VirtualKeyboard/src/dragwidget.h new file mode 100644 index 0000000..e8b1527 --- /dev/null +++ b/VirtualKeyboard/src/dragwidget.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 DRAGWIDGET_H +#define DRAGWIDGET_H + +#include +#include +#include + +class DragWidget : public QWidget +{ + Q_OBJECT +public: + DragWidget(QWidget *parent = nullptr); + virtual ~DragWidget(); + +public: + void adjustGeometry(double lfWidthScale, double lfHeightScale, bool isVertical = false, bool floatStatus = false); + +private: + void initUI(); + +private: + QLabel *m_labelDrag = nullptr; + QMap m_mapSubGeometrys; +}; + +#endif // DRAGWIDGET_H diff --git a/VirtualKeyboard/src/fakekeyboard.h b/VirtualKeyboard/src/fakekeyboard.h new file mode 100644 index 0000000..65a22ce --- /dev/null +++ b/VirtualKeyboard/src/fakekeyboard.h @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 FAKEKEYBOARD_H +#define FAKEKEYBOARD_H + +#include +#include + +class Modifier : public QObject +{ + Q_OBJECT +public: + Modifier(){} + + enum MOD{ + UNKNOWN = -1, + CTRL, + SHIFT, + ALT, + SUPER + }; + Q_ENUM(MOD) + + static QString getModifierName(int mod) + { + QMetaEnum metaEnum = QMetaEnum::fromType(); + const char* modName = metaEnum.valueToKey(mod); + QString result = QString(modName).toLower(); + return result; + } + static MOD getModifier(const QString &modName) + { + QMetaEnum metaEnum = QMetaEnum::fromType(); + MOD mod = (MOD)metaEnum.keyToValue(modName.toUpper().toLocal8Bit().data()); + return mod; + } +}; + +class FuncKey : public QObject +{ + Q_OBJECT +public: + FuncKey(){} + + enum FUNCKEY { + UNKNOWN = -1, + SPACE = 0, + BACKSPACE, + ENTER, + HOME, + END, + PGUP, + PGDN, + INSERT, + DELETE, + UP, + DOWN, + LEFT, + RIGHT, + CAPSLOCK + }; + Q_ENUM(FUNCKEY) + static QString getKeyName(int key) + { + QMetaEnum metaEnum = QMetaEnum::fromType(); + const char* keyName = metaEnum.valueToKey(key); + QString result = QString(keyName).toLower(); + return result; + } + static FUNCKEY getKey(const QString &keyName) + { + QMetaEnum metaEnum = QMetaEnum::fromType(); + FUNCKEY key = (FUNCKEY)metaEnum.keyToValue(keyName.toUpper().toLocal8Bit().data()); + return key; + } +}; + +class FakeKeyboard : public QObject +{ + Q_OBJECT +public: + explicit FakeKeyboard(QObject *parent = nullptr) + : QObject(parent) + { + + } + + virtual void addModifier(Modifier::MOD mod) = 0; + virtual void removeModifier(Modifier::MOD mod) = 0; + virtual bool hasModifier(Modifier::MOD mod) = 0; + virtual QList getAllModifier() = 0; + virtual void clearModifier() = 0; + +public Q_SLOTS: + virtual void onKeyPressed(QChar c) = 0; + virtual void onKeyPressed(FuncKey::FUNCKEY key) = 0; +}; + +#endif // FAKEKEYBOARD_H diff --git a/VirtualKeyboard/src/images/backspace.svg b/VirtualKeyboard/src/images/backspace.svg deleted file mode 100644 index 092d72d..0000000 --- a/VirtualKeyboard/src/images/backspace.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/VirtualKeyboard/src/images/backspace_click.svg b/VirtualKeyboard/src/images/backspace_click.svg deleted file mode 100644 index 4a9d7fa..0000000 --- a/VirtualKeyboard/src/images/backspace_click.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/VirtualKeyboard/src/images/capslock.svg b/VirtualKeyboard/src/images/capslock.svg deleted file mode 100644 index a5a367c..0000000 --- a/VirtualKeyboard/src/images/capslock.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - diff --git a/VirtualKeyboard/src/images/capslock_click.svg b/VirtualKeyboard/src/images/capslock_click.svg deleted file mode 100644 index 36ae8f8..0000000 --- a/VirtualKeyboard/src/images/capslock_click.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - diff --git a/VirtualKeyboard/src/images/capslock_hl.svg b/VirtualKeyboard/src/images/capslock_hl.svg deleted file mode 100644 index 4f8870a..0000000 --- a/VirtualKeyboard/src/images/capslock_hl.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/VirtualKeyboard/src/images/capslock_hl_click.svg b/VirtualKeyboard/src/images/capslock_hl_click.svg deleted file mode 100644 index 65b0a21..0000000 --- a/VirtualKeyboard/src/images/capslock_hl_click.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/VirtualKeyboard/src/images/close.svg b/VirtualKeyboard/src/images/close.svg index c509415..ba56780 100644 --- a/VirtualKeyboard/src/images/close.svg +++ b/VirtualKeyboard/src/images/close.svg @@ -1,22 +1,4 @@ - - - - - - - - - - - - - - - - - - - - - + + + + diff --git a/VirtualKeyboard/src/images/close_click.svg b/VirtualKeyboard/src/images/close_click.svg deleted file mode 100644 index d143065..0000000 --- a/VirtualKeyboard/src/images/close_click.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/VirtualKeyboard/src/images/delet.svg b/VirtualKeyboard/src/images/delet.svg new file mode 100644 index 0000000..b290563 --- /dev/null +++ b/VirtualKeyboard/src/images/delet.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/VirtualKeyboard/src/images/down.svg b/VirtualKeyboard/src/images/down.svg deleted file mode 100644 index 73361dd..0000000 --- a/VirtualKeyboard/src/images/down.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - -画板 15 - - - - diff --git a/VirtualKeyboard/src/images/down_click.svg b/VirtualKeyboard/src/images/down_click.svg deleted file mode 100644 index 9140b38..0000000 --- a/VirtualKeyboard/src/images/down_click.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - diff --git a/VirtualKeyboard/src/images/drag.svg b/VirtualKeyboard/src/images/drag.svg new file mode 100644 index 0000000..9bc4dac --- /dev/null +++ b/VirtualKeyboard/src/images/drag.svg @@ -0,0 +1,3 @@ + + + diff --git a/VirtualKeyboard/src/images/enter.svg b/VirtualKeyboard/src/images/enter.svg index 5cbc51d..9c09d11 100644 --- a/VirtualKeyboard/src/images/enter.svg +++ b/VirtualKeyboard/src/images/enter.svg @@ -1,11 +1,4 @@ - - - - - - - + + + + diff --git a/VirtualKeyboard/src/images/enter_click.svg b/VirtualKeyboard/src/images/enter_click.svg deleted file mode 100644 index 106cc7b..0000000 --- a/VirtualKeyboard/src/images/enter_click.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/VirtualKeyboard/src/images/float-restore.svg b/VirtualKeyboard/src/images/float-restore.svg new file mode 100644 index 0000000..3349d01 --- /dev/null +++ b/VirtualKeyboard/src/images/float-restore.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/VirtualKeyboard/src/images/float.svg b/VirtualKeyboard/src/images/float.svg new file mode 100644 index 0000000..a24e50f --- /dev/null +++ b/VirtualKeyboard/src/images/float.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/VirtualKeyboard/src/images/left.svg b/VirtualKeyboard/src/images/left.svg index 6ac0fa8..f614a70 100644 --- a/VirtualKeyboard/src/images/left.svg +++ b/VirtualKeyboard/src/images/left.svg @@ -1,7 +1,3 @@ - - - -画板 19 - - + + + diff --git a/VirtualKeyboard/src/images/left_click.svg b/VirtualKeyboard/src/images/left_click.svg deleted file mode 100644 index edfd291..0000000 --- a/VirtualKeyboard/src/images/left_click.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - -画板 20 - - diff --git a/VirtualKeyboard/src/images/rectangle.svg b/VirtualKeyboard/src/images/rectangle.svg new file mode 100644 index 0000000..7ffef85 --- /dev/null +++ b/VirtualKeyboard/src/images/rectangle.svg @@ -0,0 +1,3 @@ + + + diff --git a/VirtualKeyboard/src/images/right.svg b/VirtualKeyboard/src/images/right.svg index 62c301c..9922eb7 100644 --- a/VirtualKeyboard/src/images/right.svg +++ b/VirtualKeyboard/src/images/right.svg @@ -1,6 +1,3 @@ - - - - - + + + diff --git a/VirtualKeyboard/src/images/right_click.svg b/VirtualKeyboard/src/images/right_click.svg deleted file mode 100644 index 5ba0ec6..0000000 --- a/VirtualKeyboard/src/images/right_click.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - diff --git a/VirtualKeyboard/src/images/shift.svg b/VirtualKeyboard/src/images/shift.svg new file mode 100644 index 0000000..6a3b438 --- /dev/null +++ b/VirtualKeyboard/src/images/shift.svg @@ -0,0 +1,3 @@ + + + diff --git a/VirtualKeyboard/src/images/shift_lock.svg b/VirtualKeyboard/src/images/shift_lock.svg new file mode 100644 index 0000000..09d5c99 --- /dev/null +++ b/VirtualKeyboard/src/images/shift_lock.svg @@ -0,0 +1,4 @@ + + + + diff --git a/VirtualKeyboard/src/images/space.svg b/VirtualKeyboard/src/images/space.svg new file mode 100644 index 0000000..b5b9769 --- /dev/null +++ b/VirtualKeyboard/src/images/space.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/VirtualKeyboard/src/images/super.svg b/VirtualKeyboard/src/images/super.svg deleted file mode 100644 index c847e44..0000000 --- a/VirtualKeyboard/src/images/super.svg +++ /dev/null @@ -1 +0,0 @@ -画板 11 \ No newline at end of file diff --git a/VirtualKeyboard/src/images/super_click.svg b/VirtualKeyboard/src/images/super_click.svg deleted file mode 100644 index 7fcc495..0000000 --- a/VirtualKeyboard/src/images/super_click.svg +++ /dev/null @@ -1 +0,0 @@ -画板 12 \ No newline at end of file diff --git a/VirtualKeyboard/src/images/unlock.svg b/VirtualKeyboard/src/images/unlock.svg new file mode 100644 index 0000000..17271fd --- /dev/null +++ b/VirtualKeyboard/src/images/unlock.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/VirtualKeyboard/src/images/up.svg b/VirtualKeyboard/src/images/up.svg deleted file mode 100644 index d5613b2..0000000 --- a/VirtualKeyboard/src/images/up.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - -画板 13 - - - - diff --git a/VirtualKeyboard/src/images/up_click.svg b/VirtualKeyboard/src/images/up_click.svg deleted file mode 100644 index 225e401..0000000 --- a/VirtualKeyboard/src/images/up_click.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - diff --git a/VirtualKeyboard/src/kbbutton.cpp b/VirtualKeyboard/src/kbbutton.cpp new file mode 100644 index 0000000..d593793 --- /dev/null +++ b/VirtualKeyboard/src/kbbutton.cpp @@ -0,0 +1,182 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 . + * +**/ +#include "kbbutton.h" +#include "commondef.h" +#include +#include + +KBButton::KBButton(QWidget *parent/* = nullptr*/) + : QPushButton(parent) +{ + this->installEventFilter(this); + this->setIconSize(KEYBOARD_FIXED_DEFAULT_ICONSIZE); + this->setFocusPolicy(Qt::NoFocus); + connect(this, &QPushButton::clicked, this, [&,this]() { + if (m_charId.isLetter()) { + if (m_isShift) { + if (m_isCaps) { + m_charId = m_charId.toLower(); + } else { + m_charId = m_charId.toUpper(); + } + } else { + if (m_isCaps) { + m_charId = m_charId.toUpper(); + } else { + m_charId = m_charId.toLower(); + } + } + } + Q_EMIT clicked(m_charId); + }); +} + +KBButton::~KBButton() +{ + +} + +bool KBButton::eventFilter(QObject *watched, QEvent *event) +{ + if (m_clrNormal == KEYBOARD_LETTER_COLOR_NORMAL) + return QPushButton::eventFilter(watched, event); + if (event->type() == QEvent::MouseButtonPress) { + QPixmap pressIcon = this->icon().pixmap(QSize(24, 24)); + pressIcon = drawSymbolicColoredPixmap(pressIcon, "white"); + this->setIcon(pressIcon); + } else if (event->type() == QEvent::MouseButtonRelease) { + QPixmap releaseIcon = this->icon().pixmap(QSize(24, 24)); + releaseIcon = drawSymbolicColoredPixmap(releaseIcon, "black"); + this->setIcon(releaseIcon); + } + return QPushButton::eventFilter(watched, event); +} + +void KBButton::setCharId(QChar charId) +{ + m_charId = charId; + if (charId == '&') { + setText("&&"); + } else { + setText(m_charId); + } +} + +void KBButton::updateStyleSheet(QString clrNormal, QString clrHover, QString clrChecked, QString clrBoard, QString clrBoardPress, QString clrFontPress, int radius, bool is_lock) +{ + QString strBorderRadius = QString("border-top-left-radius: %1px; border-top-right-radius: %2px; border-bottom-right-radius: %3px;border-bottom-left-radius: %4px;") + .arg((radius&BORDER_RADIUS_LT)?8:0) + .arg((radius&BORDER_RADIUS_TR)?8:0) + .arg((radius&BORDER_RADIUS_RB)?8:0) + .arg((radius&BORDER_RADIUS_LB)?8:0); + if (!is_lock) { + setStyleSheet(QString("QPushButton{%1 border: 2px solid %2; border-width: 0px 0px 2px 0px; background: %3; color: #262626}" + // "QPushButton:hover{border: 2px solid %4; border-width: 2px 0px 0px 0px; background: %5;}" + "QPushButton:pressed{border: 2px solid %4; border-width: 2px 0px 0px 0px; background: %5; color: %6}" + "QPushButton:checked{border: 2px solid %7; border-width: 2px 0px 0px 0px; background: %8; color: %9}") + .arg(strBorderRadius).arg(clrBoard).arg(clrNormal).arg(clrBoardPress).arg(clrHover).arg(clrFontPress).arg(clrBoardPress).arg(clrChecked).arg(clrFontPress) + ); + } else { + setStyleSheet(QString("QPushButton{%1 border: 2px solid %2; border-width: 0px 0px 2px 0px; background: %3; color: #FFFFFF}" + // "QPushButton:hover{border: 2px solid %4; border-width: 2px 0px 0px 0px; background: %5;}" + "QPushButton:pressed{border: 2px solid %4; border-width: 2px 0px 0px 0px; background: %5; color: %6}" + "QPushButton:checked{border: 2px solid %7; border-width: 2px 0px 0px 0px; background: %8; color: %9}") + .arg(strBorderRadius).arg(clrBoard).arg(clrNormal).arg(clrBoardPress).arg(clrHover).arg(clrFontPress).arg(clrBoardPress).arg(clrChecked).arg(clrFontPress) + ); + } + m_clrBoard = clrBoard; + m_clrNormal = clrNormal; + m_clrBoardPress = clrBoardPress; + m_clrHover = clrHover; + m_clrChecked = clrChecked; + if (m_clrNormal == KEYBOARD_LETTER_COLOR_NORMAL) { + sysFont.setPixelSize(32); + this->setFont(sysFont); + this->setIconSize(QSize(32, 32)); + } else { + sysFont.setPixelSize(24); + this->setFont(sysFont); + this->setIconSize(QSize(24, 24)); + } +} + +QPixmap KBButton::drawSymbolicColoredPixmap(const QPixmap &source, QString cgColor) +{ + QImage img = source.toImage(); + for (int x = 0; x < img.width(); x++) { + for (int y = 0; y < img.height(); y++) { + auto color = img.pixelColor(x, y); + if (color.alpha() > 0) { + if ( "white" == cgColor) { + color.setRed(255); + color.setGreen(255); + color.setBlue(255); + img.setPixelColor(x, y, color); + } else if( "black" == cgColor) { + color.setRed(0); + color.setGreen(0); + color.setBlue(0); + img.setPixelColor(x, y, color); + } else if ("gray"== cgColor) { + color.setRed(152); + color.setGreen(163); + color.setBlue(164); + img.setPixelColor(x, y, color); + } else if ("blue" == cgColor){ + color.setRed(61); + color.setGreen(107); + color.setBlue(229); + img.setPixelColor(x, y, color); + } else { + return source; + } + } + } + } + return QPixmap::fromImage(img); +} + +void KBButton::setShiftState(bool isShift) +{ + if (m_isShift != isShift) { + if (m_charId.isLetter()) { + if (isShift) { + setText(m_charId.toUpper()); + } else { + setText(m_charId.toLower()); + } + } + m_isShift = isShift; + } +} + +void KBButton::setCapsStatus(bool isCaps) +{ + m_isCaps = isCaps; + setShiftState(m_isCaps); +} + +void KBButton::setCtrlState(bool isCtrl) +{ + +} + +void KBButton::setAltState(bool isAlt) +{ + +} diff --git a/VirtualKeyboard/src/kbbutton.h b/VirtualKeyboard/src/kbbutton.h new file mode 100644 index 0000000..923fa2e --- /dev/null +++ b/VirtualKeyboard/src/kbbutton.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 KBBUTTON_H +#define KBBUTTON_H + +#include + +class KBButton : public QPushButton +{ + Q_OBJECT +public: + enum BORDER_RADIUS{ + BORDER_RADIUS_NONE, + BORDER_RADIUS_LT = 1, + BORDER_RADIUS_TR = 2, + BORDER_RADIUS_RB = 4, + BORDER_RADIUS_LB = 8, + BORDER_RADIUS_ALL = 0xF, + }; + KBButton(QWidget *parent = nullptr); + virtual ~KBButton(); + + void setCharId(QChar charId); + void updateStyleSheet(QString clrNormal, QString clrHover, QString clrChecked, QString clrBoard, QString clrBoardPress, QString clrFontPress, int radius = BORDER_RADIUS_ALL, bool is_lock = false); + void setShiftState(bool isShift); + void setCapsStatus(bool isCaps); + void setCtrlState(bool isCtrl); + void setAltState(bool isAlt); + +protected: + bool eventFilter(QObject *watched, QEvent *event); + +Q_SIGNALS: + void clicked(QChar charId); + +private: + QPixmap drawSymbolicColoredPixmap(const QPixmap &source, QString cgColor); + +private: + int m_nKeyId = -1; + bool m_isShift = false; + bool m_isCtrl = false; + bool m_isAlt = false; + bool m_isCaps = false; + QChar m_charId = QChar::Null; + QString m_clrBoard; + QString m_clrNormal; + QString m_clrBoardPress; + QString m_clrHover; + QString m_clrChecked; + QFont sysFont; +}; + +#endif // KBBUTTON_H diff --git a/VirtualKeyboard/src/kbtitle.cpp b/VirtualKeyboard/src/kbtitle.cpp new file mode 100644 index 0000000..1d270cc --- /dev/null +++ b/VirtualKeyboard/src/kbtitle.cpp @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 . + * +**/ +#include "kbtitle.h" +#include +#include +#include "commondef.h" +#include + +KBTitle::KBTitle(QWidget *parent/* = nullptr*/) + : QWidget(parent) +{ + setAttribute(Qt::WA_TranslucentBackground);//背景透明 + initUI(); + initConnections(); +} + +KBTitle::~KBTitle() +{ + +} + +void KBTitle::initUI() +{ + setFixedHeight(KEYBOARD_TITLE_DEFAULT_HEIGHT); + QString strBtnStyle = "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%); }"; + + m_btnFloat = new QPushButton(this); + m_btnFloat->setFlat(true); + m_btnFloat->setIcon(QIcon(":/images/images/float.svg")); + m_btnFloat->setObjectName("btn_float"); + m_btnFloat->setIconSize(KEYBOARD_FIXED_DEFAULT_ICONSIZE); + m_btnFloat->setGeometry(1484, 8, KEYBOARD_TITLEBTN_DEFAULT_WIDTH, KEYBOARD_TITLEBTN_DEFAULT_HEIGHT); + m_btnFloat->setStyleSheet(strBtnStyle); + m_mapSubGeometrys[m_btnFloat] = m_btnFloat->geometry(); + + m_btnClose = new QPushButton(this); + m_btnClose->setFlat(true); + m_btnClose->setIcon(QIcon(":/images/images/close.svg")); + m_btnClose->setIconSize(KEYBOARD_FIXED_DEFAULT_ICONSIZE); + m_btnClose->setObjectName("btn_close"); + m_btnClose->setGeometry(1548, 8, KEYBOARD_TITLEBTN_DEFAULT_WIDTH, KEYBOARD_TITLEBTN_DEFAULT_HEIGHT); + m_btnClose->setStyleSheet(strBtnStyle); + m_mapSubGeometrys[m_btnClose] = m_btnClose->geometry(); +} + +void KBTitle::initConnections() +{ + connect(m_btnFloat, &QPushButton::clicked, this, &KBTitle::onBtnClicked); + connect(m_btnClose, &QPushButton::clicked, this, &KBTitle::onBtnClicked); +} + +void KBTitle::onBtnClicked() +{ + QObject *obj = sender(); + QPushButton *btn = static_cast(obj); + QString objName = btn->objectName(); + int lastUnderline = objName.lastIndexOf('_'); + int start = strlen("btn_"); + int keyLength = lastUnderline - start; + QString keyName = objName.mid(start, keyLength); + if (keyName == BTN_FLOAT) { + if (floatStatus) { + btn->setIcon(QIcon(":/images/images/float.svg")); + } else { + btn->setIcon(QIcon(":/images/images/float-restore.svg")); + } + floatStatus = !floatStatus; + } + + Q_EMIT btnClicked(keyName); +} + +void KBTitle::adjustGeometry(double lfWidthScale, double lfHeightScale, bool isVertical/* = false*/, bool floatStatus) +{ + setFixedHeight(KEYBOARD_TITLE_DEFAULT_HEIGHT*lfHeightScale); + QMap::iterator itGeometry = m_mapSubGeometrys.begin(); + for (; itGeometry != m_mapSubGeometrys.end(); itGeometry ++) { + QPushButton *button = itGeometry.key(); + if (button) { + QRect oldGeometry = itGeometry.value(); + QRect newGeometry = oldGeometry; + if (floatStatus) { + newGeometry.setX(oldGeometry.x()*lfWidthScale*KEYBOARD_FLOAT_PERCENTAGE); + newGeometry.setY(oldGeometry.y()*lfHeightScale); + newGeometry.setWidth(oldGeometry.width()*lfWidthScale*KEYBOARD_FLOAT_PERCENTAGE); + newGeometry.setHeight(oldGeometry.height()*lfHeightScale); + } else { + newGeometry.setX(oldGeometry.x()*lfWidthScale); + newGeometry.setY(oldGeometry.y()*lfHeightScale); + newGeometry.setWidth(oldGeometry.width()*lfWidthScale); + newGeometry.setHeight(oldGeometry.height()*lfHeightScale); + } + button->setGeometry(newGeometry); + } + } +} diff --git a/VirtualKeyboard/src/kbtitle.h b/VirtualKeyboard/src/kbtitle.h new file mode 100644 index 0000000..cda3263 --- /dev/null +++ b/VirtualKeyboard/src/kbtitle.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 KBTITLE_H +#define KBTITLE_H + +#include +#include +#include + +class KBTitle : public QWidget +{ + Q_OBJECT +public: + KBTitle(QWidget *parent = nullptr); + virtual ~KBTitle(); + +public: + void adjustGeometry(double lfWidthScale, double lfHeightScale, bool isVertical = false, bool floatStatus = false); + +public Q_SLOTS: + void onBtnClicked(); + +Q_SIGNALS: + void btnClicked(QString keyName); + +private: + void initUI(); + void initConnections(); + +private: + QPushButton *m_btnFloat = nullptr; + QPushButton *m_btnClose = nullptr; + QMap m_mapSubGeometrys; + bool floatStatus = false; +}; + +#endif // KBTITLE_H diff --git a/VirtualKeyboard/src/keyboard.qrc b/VirtualKeyboard/src/keyboard.qrc index 4e38067..a5e482e 100644 --- a/VirtualKeyboard/src/keyboard.qrc +++ b/VirtualKeyboard/src/keyboard.qrc @@ -1,27 +1,17 @@ - - keyboard.qss - - images/backspace_click.svg - images/backspace.svg - images/capslock_click.svg - images/capslock_hl.svg - images/capslock.svg - images/down_click.svg - images/down.svg - images/enter_click.svg images/enter.svg - images/left_click.svg images/left.svg - images/right_click.svg images/right.svg - images/super_click.svg - images/super.svg - images/up.svg - images/close_click.svg images/close.svg - images/capslock_hl_click.svg - images/up_click.svg + images/unlock.svg + images/space.svg + images/shift.svg + images/float.svg + images/float-restore.svg + images/drag.svg + images/delet.svg + images/shift_lock.svg + images/rectangle.svg diff --git a/VirtualKeyboard/src/keyboard.qss b/VirtualKeyboard/src/keyboard.qss deleted file mode 100644 index e91e23c..0000000 --- a/VirtualKeyboard/src/keyboard.qss +++ /dev/null @@ -1,37 +0,0 @@ -QPushButton -{ - border: none; - font: 24px; - color: white; - background: #35322f; - border-radius: 5px; -} - -QPushButton::pressed -{ - color: gray; - background: #2a2826; -} - -#btn_backspace, #btn_enter, #btn_shift_l, -#btn_shift_r, #btn_ctrl_l, #btn_ctrl_r, -#btn_alt_l, #btn_alt_r, #btn_super -{ - font: 16px; - background: #1e1b18 -} - -#btn_backspace::pressed, #btn_enter::pressed, #btn_shift_l::pressed, -#btn_shift_r::pressed, #btn_ctrl_l::pressed, #btn_ctrl_r::pressed, -#btn_alt_l::pressed, #btn_alt_r::pressed, #btn_super::pressed -{ - background: #181613; - color: gray; -} - -#btn_letter, #btn_symbol, #btn_number, -#btn_insert, #btn_delete, #btn_home, -#btn_end, #btn_pgup, #btn_pgdn, #btn_close -{ - font: 16px; -} diff --git a/VirtualKeyboard/src/keyboardwidget.cpp b/VirtualKeyboard/src/keyboardwidget.cpp deleted file mode 100644 index e97a710..0000000 --- a/VirtualKeyboard/src/keyboardwidget.cpp +++ /dev/null @@ -1,459 +0,0 @@ -/** - * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. -**/ -#include "keyboardwidget.h" -#include "ui_keyboardwidget.h" -#include -#include -#include - -#define SYMBOL_KEY_COUNT 29 -#define SYMBOL_PAGE_COUNT 2 - -#define BUTTON_BG "QPushButton{background:#1E1B18}" -#define BUTTON_BG_PRESSED "QPushButton{background: #181613;}" -#define BUTTON_BG_HL "QPushButton{background:#80c342}" -#define BUTTON_BG_HL_PRESSED "QPushButton{background:#486E25}" - - -QChar symbols[SYMBOL_PAGE_COUNT][SYMBOL_KEY_COUNT] = - { {'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', - 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', - 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/'}, - {'!', '@', '#', '$', '%', '^', '&', '*', '(', ')', - '`', '-', '=', '[', ']', '\\', '|', '{', '}', - '~','<', '>', ':', ';', '\'', '"', '_', '+', '?'}}; - - -KeyboardWidget::KeyboardWidget(QWidget *parent) : - QWidget(parent), - ui(new Ui::KeyboardWidget), - capsLock(false), - isShift(false), - page(0) -{ - vKeyboard = new X11Keyboard(this); - connect(this, SIGNAL(keyPressed(QChar)), - vKeyboard, SLOT(onKeyPressed(QChar))); - connect(this, SIGNAL(keyPressed(FuncKey::FUNCKEY)), - vKeyboard, SLOT(onKeyPressed(FuncKey::FUNCKEY))); - - ui->setupUi(this); - bindSingal(); - setDefaultIcon(); -} - -KeyboardWidget::~KeyboardWidget() -{ - delete ui; -} - -void KeyboardWidget::resizeEvent(QResizeEvent */*event*/) -{ - int w = width(); - int h = height(); - int mainLeftMargin = ui->hl_main->contentsMargins().left(); - int mainRightMargin = ui->hl_main->contentsMargins().right(); - int mainTopMargin = ui->hl_main->contentsMargins().left(); - int mainBottomMargin = ui->hl_main->contentsMargins().right(); - int mainSpacing = ui->hl_main->spacing(); - int itemSpacing = ui->hl_1->spacing(); - - int btnWidthCount = w - 11 * itemSpacing - mainSpacing- mainLeftMargin - mainRightMargin; - int btnHeightCount = h - 3 * itemSpacing - mainTopMargin - mainBottomMargin; - double btnWidth = btnWidthCount / 12; - double btnHeight = btnHeightCount / 4; - for(int i = 0; i <= 28; i++) { - QString btnObjName = "btn_" + QString::number(i); - QPushButton *btn = ui->page_letter->findChild(btnObjName); - btn->setFixedSize(btnWidth, btnHeight); - } - ui->btn_ctrl_l->setFixedSize(btnWidth * 1.3, btnHeight); - ui->btn_ctrl_r->setFixedSize(btnWidth * 1.3, btnHeight); - ui->btn_alt_l->setFixedSize(btnWidth, btnHeight); - ui->btn_alt_r->setFixedSize(btnWidth, btnHeight); - ui->btn_super->setFixedSize(btnWidth, btnHeight); - ui->btn_shift_l->setFixedSize(btnWidth, btnHeight); - ui->btn_shift_r->setFixedHeight(btnHeight); - ui->spacer_2->changeSize(btnWidth / 2, 20); - - - for(int i = 1; i <= 9; i++) { - QString btnObjName = "btn_num_" + QString::number(i); - QPushButton *btn = ui->page_number->findChild(btnObjName); - btn->setFixedWidth(btnWidth); - } - ui->btn_backspace_num->setFixedSize(btnWidth,btnHeight); - ui->btn_insert->setFixedWidth(btnWidth); - ui->btn_delete->setFixedWidth(btnWidth); - ui->btn_home->setFixedWidth(btnWidth); - ui->btn_end->setFixedWidth(btnWidth); - ui->btn_pgup->setFixedWidth(btnWidth); - ui->btn_pgdn->setFixedWidth(btnWidth); - ui->btn_up->setFixedSize(btnWidth,btnHeight); - ui->btn_down->setFixedSize(btnWidth,btnHeight); - ui->btn_left->setFixedSize(btnWidth,btnHeight); - ui->btn_right->setFixedSize(btnWidth,btnHeight); - - ui->btn_close->setFixedHeight(btnHeight); - ui->btn_letter->setFixedHeight(btnHeight); - ui->btn_symbol->setFixedHeight(btnHeight); - ui->btn_number->setFixedHeight(btnHeight); - - setIconSize(); -} - -float hScale = 0.6; -float wScale = hScale; -#define SET_ICON_SIZE_SCALE(btn) \ - ui->btn_##btn->setIconSize(QSize(ui->btn_##btn->width() * hScale, ui->btn_##btn->height() * wScale)); - -#define SET_ICON_SIZE(btn) \ - ui->btn_##btn->setIconSize(QSize(ui->btn_##btn->width(), ui->btn_##btn->height())); - -#define SET_SHIFT_ICON_SIZE_SCALE(btn) \ - ui->btn_##btn->setIconSize(QSize(ui->btn_##btn->height() * 0.4, ui->btn_##btn->height() * 0.4)); - -#define SET_ENTER_ICON_SIZE_SCALE(btn) \ - ui->btn_##btn->setIconSize(QSize(ui->btn_##btn->width() * 0.4, ui->btn_##btn->height() * 0.4)); - -void KeyboardWidget::setIconSize() -{ - SET_ICON_SIZE_SCALE(backspace); - SET_ICON_SIZE_SCALE(backspace_num); - SET_ENTER_ICON_SIZE_SCALE(enter); - SET_ICON_SIZE_SCALE(enter_num); - SET_ICON_SIZE_SCALE(close); - SET_ICON_SIZE_SCALE(super); - - SET_SHIFT_ICON_SIZE_SCALE(shift_l); - SET_SHIFT_ICON_SIZE_SCALE(shift_r); - SET_ICON_SIZE(up); - SET_ICON_SIZE(down); - SET_ICON_SIZE(left); - SET_ICON_SIZE(right); -} - -void KeyboardWidget::bindSingal() -{ - for(auto obj : ui->page_letter->children()) { - if(obj->metaObject()->className() == QString("QPushButton")) { - QPushButton *btn = static_cast(obj); - btn->setFocusPolicy(Qt::NoFocus); - connect(btn, &QPushButton::clicked, this, &KeyboardWidget::onButtonClicked); - connect(btn, &QPushButton::pressed, this, &KeyboardWidget::onButtonPressed); - connect(btn, &QPushButton::released, this, &KeyboardWidget::onButtonReleased); - } - } - for(auto obj : ui->page_number->children()) { - if(obj->metaObject()->className() == QString("QPushButton")) { - QPushButton *btn = static_cast(obj); - btn->setFocusPolicy(Qt::NoFocus); - connect(btn, &QPushButton::clicked, this, &KeyboardWidget::onButtonClicked); - connect(btn, &QPushButton::pressed, this, &KeyboardWidget::onButtonPressed); - connect(btn, &QPushButton::released, this, &KeyboardWidget::onButtonReleased); - } - } - ui->btn_close->setFocusPolicy(Qt::NoFocus); - ui->btn_letter->setFocusPolicy(Qt::NoFocus); - ui->btn_symbol->setFocusPolicy(Qt::NoFocus); - ui->btn_number->setFocusPolicy(Qt::NoFocus); - - connect(ui->btn_letter, &QPushButton::clicked, this, [&] { - ui->stackedWidget->setCurrentWidget(ui->page_letter); - page = 0; - switchPage(); - }); - connect(ui->btn_symbol, &QPushButton::clicked, this, [&] { - ui->stackedWidget->setCurrentWidget(ui->page_letter); - page = 1; - switchPage(); - }); - connect(ui->btn_number, &QPushButton::clicked, this, [&] { - ui->stackedWidget->setCurrentWidget(ui->page_number); - }); - connect(ui->btn_close, &QPushButton::clicked, - this, &KeyboardWidget::aboutToClose); - - connect(ui->btn_close, &QPushButton::pressed, - this, &KeyboardWidget::onButtonPressed); - connect(ui->btn_close, &QPushButton::released, - this, &KeyboardWidget::onButtonReleased); -} - -void KeyboardWidget::setDefaultIcon() -{ - ui->btn_backspace->setIcon(QIcon(":/images/images/backspace.svg")); - ui->btn_backspace_num->setIcon(QIcon(":/images/images/backspace.svg")); - ui->btn_enter->setIcon(QIcon(":/images/images/enter.svg")); - ui->btn_enter_num->setIcon(QIcon(":/images/images/enter.svg")); - ui->btn_shift_l->setIcon(QIcon(":/images/images/capslock.svg")); - ui->btn_shift_r->setIcon(QIcon(":/images/images/capslock.svg")); - ui->btn_close->setIcon(QIcon(":/images/images/close.svg")); - //ui->btn_super->setIcon(QIcon(":/images/images/super.svg")); - ui->btn_super->setText("Super"); - ui->btn_up->setIcon(QIcon(":/images/images/up.svg")); - ui->btn_down->setIcon(QIcon(":/images/images/down.svg")); - ui->btn_left->setIcon(QIcon(":/images/images/left.svg")); - ui->btn_right->setIcon(QIcon(":/images/images/right.svg")); -} - -QString KeyboardWidget::getKeyName(QPushButton *btn) -{ - QString objName = btn->objectName(); - int lastUnderline = objName.lastIndexOf('_'); - int start = strlen("btn_"); - int keyLength = lastUnderline - start; - QString keyName = objName.mid(start, keyLength); - return keyName; -} - -void KeyboardWidget::changeFuncKeyStyle(QPushButton *btn, bool isPressed) -{ - QString modName = getKeyName(btn); - Modifier::MOD mod = Modifier::getModifier(modName); - - if(vKeyboard->hasModifier(mod)) { - if(isPressed) - btn->setStyleSheet(BUTTON_BG_HL_PRESSED); - else - btn->setStyleSheet(BUTTON_BG_HL); - } else { - if(isPressed) - btn->setStyleSheet(BUTTON_BG_PRESSED); - else - btn->setStyleSheet(BUTTON_BG); - } -} - -void KeyboardWidget::changeShitKeyStyle(QPushButton *btn, bool isPressed) -{ - if(page == 0){ - if(isShift) { - if(capsLock){ - if(isPressed) { - btn->setStyleSheet(BUTTON_BG_HL_PRESSED); - btn->setIcon(QIcon(":/images/images/capslock_click.svg")); - } else { - btn->setStyleSheet(BUTTON_BG_HL); - btn->setIcon(QIcon(":/images/images/capslock.svg")); - } - } - else { - if(isPressed) - btn->setIcon(QIcon(":/images/images/capslock_hl_click.svg")); - else - btn->setIcon(QIcon(":/images/images/capslock_hl.svg")); - } - } else { - if(isPressed) - btn->setIcon(QIcon(":/images/images/capslock_click.svg")); - else - btn->setIcon(QIcon(":/images/images/capslock.svg")); - } - } -} - - -void KeyboardWidget::changeDirectKeyStyle(QPushButton *btn, bool isPressed) -{ - QString keyName = getKeyName(btn); - FuncKey::FUNCKEY key = FuncKey::getKey(keyName); - if(key == FuncKey::UNKNOWN) - return; - - QString iconName = QString(":/images/images/%1.svg").arg(keyName); - QString iconNamePressed = QString(":/images/images/%1_click.svg").arg(keyName); - - if(isPressed) - btn->setIcon(QIcon(iconNamePressed)); - else - btn->setIcon(QIcon(iconName)); -} - -/** - * @brief 修改按键样式 - * @param obj 按键 - * @param isPressed 按下或者松开 - */ -void KeyboardWidget::changeKeyStyle(QPushButton *btn, bool isPressed) -{ - if(btn == ui->btn_ctrl_l || btn == ui->btn_ctrl_r || - btn == ui->btn_alt_l || btn == ui->btn_alt_r || - btn == ui->btn_super) { - changeFuncKeyStyle(btn, isPressed); - } - - if(btn == ui->btn_shift_l) - changeShitKeyStyle(ui->btn_shift_l, isPressed); - if(btn == ui->btn_shift_r) - changeShitKeyStyle(ui->btn_shift_r, isPressed); - - changeDirectKeyStyle(btn, isPressed); -} - -void KeyboardWidget::onButtonPressed() -{ - QPushButton *btn = static_cast(sender()); - changeKeyStyle(btn, true); -} - -void KeyboardWidget::onButtonReleased() -{ - QPushButton *btn = static_cast(sender()); - changeKeyStyle(btn, false); -} - -void KeyboardWidget::onButtonClicked() -{ - QObject *obj = sender(); - if(obj->metaObject()->className() != QString("QPushButton")) - return; - - QPushButton *btn = static_cast(obj); - QString keyName = getKeyName(btn); - qDebug() << "keyName: " << keyName; - - Modifier::MOD mod = Modifier::getModifier(keyName); - FuncKey::FUNCKEY funcKey = FuncKey::getKey(keyName); - - if(keyName == "shift") { - if(page == 0) { - isShift = !isShift; - if(isShift) { //第一次被按下 - capsLock = false; - shiftLastClicked = QTime::currentTime(); - ui->btn_shift_l->setIcon(QIcon(":/images/images/capslock_hl.svg")); - ui->btn_shift_r->setIcon(QIcon(":/images/images/capslock_hl.svg")); - } - else { - int doubleClickInterval = QApplication::doubleClickInterval(); - if(shiftLastClicked.msecsTo(QTime::currentTime()) <= doubleClickInterval) { - //shift键双击,锁定大写 - capsLock = true; - isShift = true; - ui->btn_shift_l->setIcon(QIcon(":/images/images/capslock.svg")); - ui->btn_shift_r->setIcon(QIcon(":/images/images/capslock.svg")); - ui->btn_shift_l->setStyleSheet("QPushButton{background:#80c342}"); - ui->btn_shift_r->setStyleSheet("QPushButton{background:#80c342}"); - } else { - ui->btn_shift_l->setIcon(QIcon(":/images/images/capslock.svg")); - ui->btn_shift_r->setIcon(QIcon(":/images/images/capslock.svg")); - ui->btn_shift_l->setStyleSheet("QPushButton{background:#1e1b18}"); - ui->btn_shift_r->setStyleSheet("QPushButton{background:#1e1b18}"); - } - } - toggleCase(); - } else { - page = page % (SYMBOL_PAGE_COUNT - 1) + 1; - switchPage(); - } - } else if(mod != Modifier::UNKNOWN) { - if(vKeyboard->hasModifier(mod)) { - vKeyboard->removeModifier(mod); - btn->setStyleSheet(BUTTON_BG); - btn->setStyleSheet(BUTTON_BG); - } else { - vKeyboard->addModifier(mod); - btn->setStyleSheet(BUTTON_BG_HL); - btn->setStyleSheet(BUTTON_BG_HL); - } - } else if(funcKey != FuncKey::UNKNOWN) { - Q_EMIT keyPressed(funcKey); - } else { //字符键 - QChar c; - QString text = btn->text(); - qDebug() << "clicked button text: " << text; - if(text == "&&") - c = '&'; - else if(text.length() == 1) - c = text.at(0); - - Q_EMIT keyPressed(c); - - //如果shift键被单击,按一个键后就恢复为小写 - if(isShift && !capsLock) { - isShift = false; - toggleCase(); - changeShitKeyStyle(ui->btn_shift_l, false); - changeShitKeyStyle(ui->btn_shift_r, false); - } - clearModifier(); - } -} - -void KeyboardWidget::clearModifier() -{ - for(auto mod : vKeyboard->getAllModifier()) { - QString modName = Modifier::getModifierName(mod); - if(mod == Modifier::SUPER) { - QString objName = QString("btn_%1").arg(modName); - QPushButton *btn = ui->page_letter->findChild(objName); - btn->setStyleSheet(BUTTON_BG); - } else { - QString objName = QString("btn_%1_l").arg(modName); - QPushButton *btn = ui->page_letter->findChild(objName); - btn->setStyleSheet(BUTTON_BG); - objName = QString("btn_%1_r").arg(modName); - btn = ui->page_letter->findChild(objName); - btn->setStyleSheet(BUTTON_BG); - } - } - vKeyboard->clearModifier(); -} - -void KeyboardWidget::toggleCase() -{ - for(int i = 0; i < 26; i++) { - QString objName = "btn_" + QString::number(i); - QPushButton *btn = findChild(objName); - QChar ch; - if(isShift) { //切换到大写 - ch = symbols[0][i].toUpper(); - } else { - ch = symbols[0][i]; - } - btn->setText(ch); - } -} - -void KeyboardWidget::switchPage() -{ - if(page == 0) { - ui->btn_shift_l->setText(""); - ui->btn_shift_r->setText(""); - ui->btn_shift_l->setIcon(QIcon(":/images/images/capslock.svg")); - ui->btn_shift_r->setIcon(QIcon(":/images/images/capslock.svg")); - } else { - ui->btn_shift_l->setText(""); - ui->btn_shift_r->setText(""); - ui->btn_shift_l->setIcon(QIcon(":/images/images/capslock.svg")); - ui->btn_shift_r->setIcon(QIcon(":/images/images/capslock.svg")); - } - - for(int i = 0; i < SYMBOL_KEY_COUNT; i++) { - QString btnObjName = "btn_" + QString::number(i); - QPushButton *btn = ui->page_letter->findChild(btnObjName); - QChar c = symbols[page][i]; - if(c == '&') - btn->setText("&&"); - else - btn->setText(c); - } -} - diff --git a/VirtualKeyboard/src/keyboardwidget.h b/VirtualKeyboard/src/keyboardwidget.h deleted file mode 100644 index 25591ae..0000000 --- a/VirtualKeyboard/src/keyboardwidget.h +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. -**/ -#ifndef KEYBOARDWIDGET_H -#define KEYBOARDWIDGET_H - -#include -#include -#include -#include "x11keyboard.h" - -namespace Ui { -class KeyboardWidget; -} - -class QPushButton; - -class KeyboardWidget : public QWidget -{ - Q_OBJECT - -public: - explicit KeyboardWidget(QWidget *parent = 0); - ~KeyboardWidget(); - -protected: - void resizeEvent(QResizeEvent *event); - -private: - void bindSingal(); - void toggleCase(); - void switchPage(); - void setDefaultIcon(); - void setIconSize(); - void changeKeyStyle(QPushButton *btn, bool isPressed); - void changeFuncKeyStyle(QPushButton *btn, bool isPressed); - void changeShitKeyStyle(QPushButton *btn, bool isPressed); - void changeDirectKeyStyle(QPushButton *btn, bool isPressed); - void clearModifier(); - QString getKeyName(QPushButton *btn); - - -private Q_SLOTS: - void onButtonClicked(); - void onButtonPressed(); - void onButtonReleased(); - -Q_SIGNALS: - void aboutToClose(); - void keyPressed(QChar c); - void keyPressed(FuncKey::FUNCKEY key); - -private: - Ui::KeyboardWidget *ui; - bool capsLock; //是否大写锁定 - bool isShift; - QTime shiftLastClicked; //shift键上次被点击的时间 - int page; //当前是第几页的键盘 - X11Keyboard *vKeyboard; -}; - -#endif // KEYBOARDWIDGET_H diff --git a/VirtualKeyboard/src/keyboardwidget.ui b/VirtualKeyboard/src/keyboardwidget.ui deleted file mode 100644 index ac55eff..0000000 --- a/VirtualKeyboard/src/keyboardwidget.ui +++ /dev/null @@ -1,1203 +0,0 @@ - - - KeyboardWidget - - - Qt::NonModal - - - - 0 - 0 - 1132 - 293 - - - - - 0 - 0 - - - - - 0 - 0 - - - - KeyboardWidget - - - - 0 - - - QLayout::SetMinAndMaxSize - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 20 - - - QLayout::SetNoConstraint - - - 10 - - - 10 - - - 10 - - - 10 - - - - - 1 - - - - - 0 - - - QLayout::SetNoConstraint - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 5 - - - QLayout::SetNoConstraint - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - 10 - - - QLayout::SetNoConstraint - - - - - - 0 - 0 - - - - q - - - - - - - - 0 - 0 - - - - w - - - - - - - - 0 - 0 - - - - e - - - - - - - - 0 - 0 - - - - r - - - - - - - - 0 - 0 - - - - t - - - - - - - - 0 - 0 - - - - y - - - - - - - - 0 - 0 - - - - u - - - - - - - - 0 - 0 - - - - i - - - - - - - - 0 - 0 - - - - o - - - - - - - - 0 - 0 - - - - p - - - - - - - - 0 - 0 - - - - - - - - - - - - - 10 - - - QLayout::SetNoConstraint - - - - - Qt::Horizontal - - - QSizePolicy::Maximum - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - a - - - - - - - - 0 - 0 - - - - s - - - - - - - - 0 - 0 - - - - d - - - - - - - - 0 - 0 - - - - f - - - - - - - - 0 - 0 - - - - g - - - - - - - - 0 - 0 - - - - h - - - - - - - - 0 - 0 - - - - j - - - - - - - - 0 - 0 - - - - k - - - - - - - - 0 - 0 - - - - l - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - - 10 - - - QLayout::SetNoConstraint - - - - - - 0 - 0 - - - - - - - - - - - - - - - 0 - 0 - - - - z - - - - - - - - 0 - 0 - - - - x - - - - - - - - 0 - 0 - - - - c - - - - - - - - 0 - 0 - - - - v - - - - - - - - 0 - 0 - - - - b - - - - - - - - 0 - 0 - - - - n - - - - - - - - 0 - 0 - - - - m - - - - - - - - 0 - 0 - - - - , - - - - - - - - 0 - 0 - - - - . - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - - 10 - - - QLayout::SetNoConstraint - - - - - - 0 - 0 - - - - - - - Ctrl - - - - - - - - 0 - 0 - - - - - - - - - - - - 0 - 0 - - - - Alt - - - - - - - - 0 - 0 - - - - - - - - - - - - 0 - 0 - - - - Alt - - - - - - - - 0 - 0 - - - - / - - - - - - - - 0 - 0 - - - - Ctrl - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - QLayout::SetNoConstraint - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 10 - - - QLayout::SetNoConstraint - - - - - QLayout::SetNoConstraint - - - 10 - - - - - - 0 - 0 - - - - 9 - - - - - - - - 0 - 0 - - - - 5 - - - - - - - - 0 - 0 - - - - 8 - - - - - - - - 0 - 0 - - - - 4 - - - - - - - - 0 - 0 - - - - 2 - - - - - - - - 0 - 0 - - - - 7 - - - - - - - - 0 - 0 - - - - 1 - - - - - - - - 0 - 0 - - - - 6 - - - - - - - - 0 - 0 - - - - 3 - - - - - - - - 0 - 0 - - - - 0 - - - - - - - - 0 - 0 - - - - - - - - - - - - 0 - 0 - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - QLayout::SetNoConstraint - - - 10 - - - - - - 0 - 0 - - - - Delete - - - - - - - - 0 - 0 - - - - End - - - - - - - - 0 - 0 - - - - Insert - - - - - - - - 0 - 0 - - - - PgUp - - - - - - - - 0 - 0 - - - - - - - - - - - - 0 - 0 - - - - - - - - - - - - 0 - 0 - - - - Home - - - - - - - - 0 - 0 - - - - - - - - - - - - 0 - 0 - - - - - - - - - - - - 0 - 0 - - - - PgDn - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - 5 - - - QLayout::SetNoConstraint - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 0 - 0 - - - - - 100 - 16777215 - - - - - - - - - - - - 0 - 0 - - - - - 100 - 16777215 - - - - Abc - - - - - - - - 0 - 0 - - - - - 100 - 16777215 - - - - @ - - - - - - - - 0 - 0 - - - - - 100 - 16777215 - - - - 123 - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - diff --git a/VirtualKeyboard/src/letterswidget.cpp b/VirtualKeyboard/src/letterswidget.cpp new file mode 100644 index 0000000..102d64b --- /dev/null +++ b/VirtualKeyboard/src/letterswidget.cpp @@ -0,0 +1,383 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 . + * +**/ +#include "letterswidget.h" +#include "commondef.h" +#include "plasma-shell-manager.h" +#include +#include +#include + +LettersWidget::LettersWidget(QWidget *parent/* = nullptr*/) + : QWidget(parent) +{ + this->setAttribute(Qt::WA_TranslucentBackground);//背景透明 + initUI(); + + if(QString(qgetenv("XDG_SESSION_TYPE")) == "wayland") { + isWayland = true; + } + + if(isWayland){ + connect(PlasmaShellManager::getInstance(), &PlasmaShellManager::keyStateChanged, + this, &LettersWidget::onCapsChanged); + }else{ + settings = new QGSettings("org.ukui.peripherals-keyboard", "", this); + connect(settings, &QGSettings::changed, + this, &LettersWidget::onCapsChanged); + } + onCapsChanged(); +} + +LettersWidget::~LettersWidget() +{ + +} + +void LettersWidget::initUI() +{ + // line 1 + QChar chLine1[] = {'q','w','e','r','t','y','u','i','o','p'}; + for (int n = 0; n < sizeof(chLine1)/sizeof(QChar); n++) { + KBButton *letterBtn = new KBButton(this); + QString objName = "btn_" + QString::number(chLine1[n].toLatin1()); + letterBtn->setObjectName(objName); + letterBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L1+(KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*n, + KEYBOARD_FIXED_DEFAULT_TMARGIN, + KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + letterBtn->setCharId(chLine1[n]); + letterBtn->updateStyleSheet(KEYBOARD_LETTER_COLOR_NORMAL,KEYBOARD_LETTER_COLOR_PRESSED,KEYBOARD_LETTER_COLOR_PRESSED, + KEYBOARD_LETTER_COLOR_BORDER_NORMAL,KEYBOARD_LETTER_COLOR_BORDER_PRESSED,KEYBOARD_FONT_COLOR_PRESS); + connect(letterBtn, &KBButton::clicked, this, &LettersWidget::onBtnClicked); + m_mapBtnGeometrys[letterBtn] = letterBtn->geometry(); + } + // backspace + KBButton *backspaceBtn = new KBButton(this); + backspaceBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L1+(KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*10, + KEYBOARD_FIXED_DEFAULT_TMARGIN, + KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + backspaceBtn->setObjectName("btn_backspace"); + backspaceBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED,KEYBOARD_OTHER_FONT_COLOR_PRESS); + backspaceBtn->setIcon(QIcon(":/images/images/delet.svg")); + connect(backspaceBtn, &KBButton::clicked, this, &LettersWidget::onBtnClicked); + m_mapBtnGeometrys[backspaceBtn] = backspaceBtn->geometry(); + qDebug()<<"backspaceBtn geometry:"<geometry(); + + // line 2 + QChar chLine2[] = {'a','s','d','f','g','h','j','k','l'}; + for (int n = 0; n < sizeof(chLine2)/sizeof(QChar); n++) { + KBButton *letterBtn = new KBButton(this); + QString objName = "btn_" + QString::number(chLine2[n].toLatin1()); + letterBtn->setObjectName(objName); + letterBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L2+(KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*n, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING), + KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + letterBtn->setCharId(chLine2[n]); + letterBtn->updateStyleSheet(KEYBOARD_LETTER_COLOR_NORMAL,KEYBOARD_LETTER_COLOR_PRESSED,KEYBOARD_LETTER_COLOR_PRESSED, + KEYBOARD_LETTER_COLOR_BORDER_NORMAL,KEYBOARD_LETTER_COLOR_BORDER_PRESSED,KEYBOARD_FONT_COLOR_PRESS); + connect(letterBtn, &KBButton::clicked, this, &LettersWidget::onBtnClicked); + m_mapBtnGeometrys[letterBtn] = letterBtn->geometry(); + } + // enter + KBButton *enterBtn = new KBButton(this); + enterBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L2+(KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*9, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING), + KEYBOARD_FIXED_DEFAULT_ENTERBTN_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + enterBtn->setObjectName("btn_enter"); + enterBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED,KEYBOARD_OTHER_FONT_COLOR_PRESS); + enterBtn->setIcon(QIcon(":/images/images/enter.svg")); + connect(enterBtn, &KBButton::clicked, this, &LettersWidget::onBtnClicked); + m_mapBtnGeometrys[enterBtn] = enterBtn->geometry(); + + // line 3 + QChar chLine3[] = {'z','x','c','v','b','n','m',',','.'}; + for (int n = 0; n < sizeof(chLine3)/sizeof(QChar); n++) { + KBButton *letterBtn = new KBButton(this); + QString objName = "btn_" + QString::number(chLine3[n].toLatin1()); + letterBtn->setObjectName(objName); + letterBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L3+(KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*(n+1), + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*2, + KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + letterBtn->setCharId(chLine3[n]); + letterBtn->updateStyleSheet(KEYBOARD_LETTER_COLOR_NORMAL,KEYBOARD_LETTER_COLOR_PRESSED,KEYBOARD_LETTER_COLOR_PRESSED, + KEYBOARD_LETTER_COLOR_BORDER_NORMAL,KEYBOARD_LETTER_COLOR_BORDER_PRESSED, + KEYBOARD_FONT_COLOR_PRESS); + connect(letterBtn, &KBButton::clicked, this, &LettersWidget::onBtnClicked); + m_mapBtnGeometrys[letterBtn] = letterBtn->geometry(); + } + // shift l + KBButton *shiftLBtn = new KBButton(this); + shiftLBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L3, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*2, + KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + shiftLBtn->setObjectName("btn_shift_l"); + shiftLBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED, + KEYBOARD_OTHER_FONT_COLOR_PRESS); + shiftLBtn->setIcon(QIcon(":/images/images/shift.svg")); + connect(shiftLBtn, &KBButton::clicked, this, &LettersWidget::onBtnClicked); + m_mapBtnGeometrys[shiftLBtn] = shiftLBtn->geometry(); + // shift r + KBButton *shiftRBtn = new KBButton(this); + shiftRBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L3+(KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*10, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*2, + KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + shiftRBtn->setObjectName("btn_shift_r"); + shiftRBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED, + KEYBOARD_OTHER_FONT_COLOR_PRESS); + shiftRBtn->setIcon(QIcon(":/images/images/shift.svg")); + connect(shiftRBtn, &KBButton::clicked, this, &LettersWidget::onBtnClicked); + m_mapBtnGeometrys[shiftRBtn] = shiftRBtn->geometry(); + + // line 4 + KBButton *symbolBtn = new KBButton(this); + symbolBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L4, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*3, + KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + symbolBtn->setObjectName("btn_symbol"); + symbolBtn->setText(tr("&&?!")); + symbolBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED, + KEYBOARD_OTHER_FONT_COLOR_PRESS); + connect(symbolBtn, &KBButton::clicked, this, &LettersWidget::onBtnClicked); + m_mapBtnGeometrys[symbolBtn] = symbolBtn->geometry(); + + KBButton *numBtn = new KBButton(this); + numBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L4+(KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING), + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*3, + KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + numBtn->setObjectName("btn_num"); + numBtn->setText(tr("123")); + numBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED, + KEYBOARD_OTHER_FONT_COLOR_PRESS); + connect(numBtn, &KBButton::clicked, this, &LettersWidget::onBtnClicked); + m_mapBtnGeometrys[numBtn] = numBtn->geometry(); + + KBButton *ctrlBtn = new KBButton(this); + ctrlBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L4+(KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*2, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*3, + KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + ctrlBtn->setObjectName("btn_ctrl"); + ctrlBtn->setText(tr("Ctrl")); + ctrlBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED, + KEYBOARD_OTHER_FONT_COLOR_PRESS); + connect(ctrlBtn, &KBButton::clicked, this, &LettersWidget::onBtnClicked); + m_mapBtnGeometrys[ctrlBtn] = ctrlBtn->geometry(); + + KBButton *spaceBtn = new KBButton(this); + spaceBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L4+(KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*3, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*3, + KEYBOARD_FIXED_DEFAULT_SPACEBTN_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + spaceBtn->setObjectName("btn_space"); + spaceBtn->updateStyleSheet(KEYBOARD_LETTER_COLOR_NORMAL,KEYBOARD_LETTER_COLOR_PRESSED, + KEYBOARD_LETTER_COLOR_PRESSED,KEYBOARD_LETTER_COLOR_BORDER_NORMAL, + KEYBOARD_LETTER_COLOR_BORDER_PRESSED, + KEYBOARD_OTHER_FONT_COLOR_PRESS); + spaceBtn->setIcon(QIcon(":/images/images/space.svg")); + connect(spaceBtn, &KBButton::clicked, this, &LettersWidget::onBtnClicked); + m_mapBtnGeometrys[spaceBtn] = spaceBtn->geometry(); + + KBButton *altBtn = new KBButton(this); + altBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L4+(KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*8, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*3, + KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + altBtn->setObjectName("btn_alt"); + altBtn->setText(tr("Alt")); + altBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED, + KEYBOARD_OTHER_FONT_COLOR_PRESS); + connect(altBtn, &KBButton::clicked, this, &LettersWidget::onBtnClicked); + m_mapBtnGeometrys[altBtn] = altBtn->geometry(); + + KBButton *leftBtn = new KBButton(this); + leftBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L4+(KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*9, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*3, + KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + leftBtn->setObjectName("btn_left"); + leftBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED, + KEYBOARD_OTHER_FONT_COLOR_PRESS); + leftBtn->setIcon(QIcon(":/images/images/left.svg")); + connect(leftBtn, &KBButton::clicked, this, &LettersWidget::onBtnClicked); + m_mapBtnGeometrys[leftBtn] = leftBtn->geometry(); + + KBButton *rightBtn = new KBButton(this); + rightBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_LETTER_L4+(KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*10, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*3, + KEYBOARD_FIXED_DEFAULT_LETTER_WIDTH, + KEYBOARD_FIXED_DEFAULT_LETTER_HEIGHT); + rightBtn->setObjectName("btn_right"); + rightBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED, + KEYBOARD_OTHER_FONT_COLOR_PRESS); + rightBtn->setIcon(QIcon(":/images/images/right.svg")); + connect(rightBtn, &KBButton::clicked, this, &LettersWidget::onBtnClicked); + m_mapBtnGeometrys[rightBtn] = rightBtn->geometry(); +} + +void LettersWidget::adjustGeometry(double lfWidthScale, double lfHeightScale, bool isVertical/* = false*/, bool floatStatus) +{ + QMap::iterator itGeometry = m_mapBtnGeometrys.begin(); + for (; itGeometry != m_mapBtnGeometrys.end(); itGeometry ++) { + KBButton *button = itGeometry.key(); + if (button) { + QRect oldGeometry = itGeometry.value(); + QRect newGeometry = oldGeometry; + if (floatStatus) { + newGeometry.setX(oldGeometry.x()*lfWidthScale*KEYBOARD_FLOAT_PERCENTAGE); + newGeometry.setY(oldGeometry.y()*lfHeightScale); + newGeometry.setWidth(oldGeometry.width()*lfWidthScale*KEYBOARD_FLOAT_PERCENTAGE); + newGeometry.setHeight(oldGeometry.height()*lfHeightScale); + } else { + newGeometry.setX(oldGeometry.x()*lfWidthScale); + newGeometry.setY(oldGeometry.y()*lfHeightScale); + newGeometry.setWidth(oldGeometry.width()*lfWidthScale); + newGeometry.setHeight(oldGeometry.height()*lfHeightScale); + } + button->setGeometry(newGeometry); + } + } +} + +void LettersWidget::onBtnClicked(QChar charId) +{ + QObject *obj = sender(); + KBButton *btn = static_cast(obj); + QString objName = btn->objectName(); + int lastUnderline = objName.lastIndexOf('_'); + int start = strlen("btn_"); + int keyLength = lastUnderline - start; + QString keyName = objName.mid(start, keyLength); + + if (charId != QChar::Null && isShift && !capsState) { //第一次按shift,按后取消shift状态 + isShift = false; + changeFuncKeyStyle("shift_l", false); + changeFuncKeyStyle("shift_r", false); + toggleCase(); + } + + if (keyName == "num") { //数字页面 + Q_EMIT specialBtnClicked(PAGE_NUMBER); + } else if (keyName == "symbol") { //符号页面 + Q_EMIT specialBtnClicked(PAGE_CHAR); + } else if (keyName == BTN_SHIFT) { //shift + if (capsState) { + capsState = false; + isShift = false; + changeFuncKeyStyle("shift_l", false); + changeFuncKeyStyle("shift_r", false); + Q_EMIT specialBtnClicked(BTN_CAPSLOCK); + } else if (isShift) { //shift键锁定 + capsState = true; + isShift = true; + changeFuncKeyStyle("shift_l", true); + changeFuncKeyStyle("shift_r", true); + Q_EMIT specialBtnClicked(BTN_CAPSLOCK); + } else { + isShift = true; + changeFuncKeyStyle("shift_l", true); + changeFuncKeyStyle("shift_r", true); + } + toggleCase(); + } else if (charId != QChar::Null) { //字符 + Q_EMIT normalBtnClicked(charId); + } else { //ctrl或者alt + Q_EMIT specialBtnClicked(keyName); + + } +} + +void LettersWidget::onCapsChanged() +{ + if(isWayland){ + capsState = PlasmaShellManager::getInstance()->getKeyState(KWayland::Client::Keystate::Key::CapsLock); + }else{ + capsState = settings->get("capslock-state").toBool(); + } + + isShift = capsState; + for (int i = 97; i < 123; i++) { //大小写切换 + QString objName = QString("btn_%1").arg(QString::number(i)); + KBButton *btn = findChild(objName); + btn->setCapsStatus(capsState); + changeFuncKeyStyle("shift_l", capsState); + changeFuncKeyStyle("shift_r", capsState); + } +} + +void LettersWidget::toggleCase() +{ + for (int i = 97; i < 123; i++) { //大小写切换 + QString objName = QString("btn_%1").arg(QString::number(i)); + KBButton *btn = findChild(objName); + btn->setShiftState(isShift); + } +} + +void LettersWidget::changeFuncKeyStyle(QString obj, bool isLock) +{ + if(obj == BTN_CAPSLOCK) + return; + QString objName = QString("btn_%1").arg(obj); + KBButton *btn = findChild(objName); + if (isLock) { + btn->updateStyleSheet(KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED,KEYBOARD_OTHER_FONT_COLOR_PRESS, + KBButton::BORDER_RADIUS_ALL,true); + if (capsState && obj.contains(BTN_SHIFT)) { + btn->setIcon(QIcon(":/images/images/shift_lock.svg")); + } else if (obj.contains(BTN_SHIFT)) { + btn->setIcon(QIcon(":/images/images/rectangle.svg")); + } + } else { + btn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED,KEYBOARD_OTHER_FONT_COLOR_PRESS); + if (obj.contains(BTN_SHIFT)) { + btn->setIcon(QIcon(":/images/images/shift.svg")); + } + } +} diff --git a/VirtualKeyboard/src/letterswidget.h b/VirtualKeyboard/src/letterswidget.h new file mode 100644 index 0000000..31ee168 --- /dev/null +++ b/VirtualKeyboard/src/letterswidget.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 LETTERSWIDGET_H +#define LETTERSWIDGET_H + +#include +#include +#include "kbbutton.h" +#include + +class LettersWidget : public QWidget +{ + Q_OBJECT +public: + explicit LettersWidget(QWidget *parent = nullptr); + virtual ~LettersWidget(); + + void adjustGeometry(double lfWidthScale, double lfHeightScale, bool isVertical = false, bool floatStatus = false); + void changeFuncKeyStyle(QString obj, bool isLock); + +public Q_SLOTS: + void onBtnClicked(QChar charId); + void onCapsChanged(); + +Q_SIGNALS: + void clicked(int nKeyId); + void specialBtnClicked(QString keyName); + void normalBtnClicked(QChar c); + +private: + void initUI(); + void toggleCase(); + +private: + QMap m_mapBtnGeometrys; + + bool isShift = false; + + QGSettings *settings; + bool capsState = false; + bool isWayland = false; +}; + +#endif // LETTERSWIDGET_H diff --git a/VirtualKeyboard/src/main.cpp b/VirtualKeyboard/src/main.cpp index 99fc2f0..dbb84a0 100644 --- a/VirtualKeyboard/src/main.cpp +++ b/VirtualKeyboard/src/main.cpp @@ -1,9 +1,9 @@ -/** +/* * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, @@ -12,9 +12,8 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. + * along with this program; if not, see . + * **/ #include "virtualkeyboard.h" #include diff --git a/VirtualKeyboard/src/numberswidget.cpp b/VirtualKeyboard/src/numberswidget.cpp new file mode 100644 index 0000000..a09de13 --- /dev/null +++ b/VirtualKeyboard/src/numberswidget.cpp @@ -0,0 +1,293 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 . + * +**/ +#include "numberswidget.h" +#include "kbbutton.h" +#include "commondef.h" + +#include +#include +#include +#include +#include +#include + +NumbersWidget::NumbersWidget(QWidget *parent) + : QWidget(parent) +{ + this->setAttribute(Qt::WA_TranslucentBackground);//背景透明 + initUI(); +} + +NumbersWidget::~NumbersWidget() +{ + +} + +void NumbersWidget::initUI() +{ + // all chars + m_layoutBtnList = new QVBoxLayout(); + m_layoutBtnList->setContentsMargins(8,0,0,0); + m_layoutBtnList->setSpacing(1); + listFrame = new QFrame(); + listFrame->setObjectName("listFrame"); + listFrame->setLayout(m_layoutBtnList); + listFrame->setStyleSheet("QFrame{border-radius: 8px}"); + listFrame->setFrameStyle(QFrame::Plain); + m_scrollFrame = new QScrollArea(this); + m_scrollFrame->setObjectName("scrollFrame"); + m_scrollFrame->setFocusPolicy(Qt::NoFocus); + m_scrollFrame->setContentsMargins(0, 0, 0, 0); + m_scrollFrame->setStyleSheet("QScrollArea {background-color: #C0CED3D9; border-radius:8px;}"); + m_scrollFrame->viewport()->setStyleSheet("background-color:transparent;"); + m_scrollFrame->verticalScrollBar()->setProperty("drawScrollBarGroove", false); + m_scrollFrame->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + m_scrollFrame->verticalScrollBar()->setContextMenuPolicy(Qt::NoContextMenu); + m_scrollFrame->setWidgetResizable(true); + m_scrollFrame->setWidget(listFrame); + m_scrollFrame->setGeometry(KEYBOARD_FIXED_DEFAULT_NUMBER_L1, KEYBOARD_FIXED_DEFAULT_TMARGIN, + KEYBOARD_FIXED_DEFAULT_NUMBER_WIDTH, KEYBOARD_FIXED_DEFAULT_NUMBER_CHARS_HEIGHT); + listFrame->setGeometry(KEYBOARD_FIXED_DEFAULT_NUMBER_L1, KEYBOARD_FIXED_DEFAULT_TMARGIN, + KEYBOARD_FIXED_DEFAULT_NUMBER_WIDTH, KEYBOARD_FIXED_DEFAULT_NUMBER_CHARS_HEIGHT); + m_mapBtnGeometrys[m_scrollFrame] = m_scrollFrame->geometry(); + //m_mapBtnGeometrys[listFrame] = listFrame->geometry(); + QChar chChars[] = {',', '.', '?', '!', '\'', ':', '~', '@', ';', '"', + '/', '(', ')', '_', '+', '=', '`', '^', '#', '*', + '%', '&', '\\', '[', ']', '<', '>', '{', '}', '|', + '$', '-'}; + for (int n = 0; n < sizeof(chChars)/sizeof(QChar); n++) { + KBButton *charBtn = new KBButton(listFrame); + charBtn->setCharId(chChars[n]); + charBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_NORMAL, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_FONT_COLOR_PRESS, + KBButton::BORDER_RADIUS_NONE); + charBtn->setObjectName(QString("btn_%1").arg(QString(chChars[n]))); + connect(charBtn, &KBButton::clicked, this, &NumbersWidget::onBtnClicked); + charBtn->setFixedHeight(KEYBOARD_FIXED_DEFAULT_NUMBER_HEIGHT); + m_layoutBtnList->addWidget(charBtn); + } + // line 1 + QChar chLine1[] = {'1','2','3'}; + for (int n = 0; n < sizeof(chLine1)/sizeof(QChar); n++) { + KBButton *numberBtn = new KBButton(this); + numberBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_NUMBER_L1+(KEYBOARD_FIXED_DEFAULT_NUMBER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*(n+1), + KEYBOARD_FIXED_DEFAULT_TMARGIN, + KEYBOARD_FIXED_DEFAULT_NUMBER_WIDTH, + KEYBOARD_FIXED_DEFAULT_NUMBER_HEIGHT); + numberBtn->setCharId(chLine1[n]); + numberBtn->updateStyleSheet(KEYBOARD_LETTER_COLOR_NORMAL,KEYBOARD_LETTER_COLOR_PRESSED,KEYBOARD_LETTER_COLOR_PRESSED, + KEYBOARD_LETTER_COLOR_BORDER_NORMAL,KEYBOARD_LETTER_COLOR_BORDER_PRESSED,KEYBOARD_FONT_COLOR_PRESS); + connect(numberBtn, &KBButton::clicked, this, &NumbersWidget::onBtnClicked); + m_mapBtnGeometrys[numberBtn] = numberBtn->geometry(); + } + // backspace + KBButton *backspaceBtn = new KBButton(this); + backspaceBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_NUMBER_L1+(KEYBOARD_FIXED_DEFAULT_NUMBER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*4, + KEYBOARD_FIXED_DEFAULT_TMARGIN, + KEYBOARD_FIXED_DEFAULT_NUMBER_WIDTH, + KEYBOARD_FIXED_DEFAULT_NUMBER_HEIGHT); + backspaceBtn->setObjectName("btn_backspace"); + backspaceBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED,KEYBOARD_OTHER_FONT_COLOR_PRESS); + backspaceBtn->setIcon(QIcon(":/images/images/delet.svg")); + connect(backspaceBtn, &KBButton::clicked, this, &NumbersWidget::onBtnClicked); + m_mapBtnGeometrys[backspaceBtn] = backspaceBtn->geometry(); + + // line 2 + QChar chLine2[] = {'4','5','6'}; + for (int n = 0; n < sizeof(chLine2)/sizeof(QChar); n++) { + KBButton *numberBtn = new KBButton(this); + numberBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_NUMBER_L2+(KEYBOARD_FIXED_DEFAULT_NUMBER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*(n+1), + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_NUMBER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*1, + KEYBOARD_FIXED_DEFAULT_NUMBER_WIDTH, + KEYBOARD_FIXED_DEFAULT_NUMBER_HEIGHT); + numberBtn->setCharId(chLine2[n]); + numberBtn->updateStyleSheet(KEYBOARD_LETTER_COLOR_NORMAL,KEYBOARD_LETTER_COLOR_PRESSED,KEYBOARD_LETTER_COLOR_PRESSED, + KEYBOARD_LETTER_COLOR_BORDER_NORMAL,KEYBOARD_LETTER_COLOR_BORDER_PRESSED,KEYBOARD_FONT_COLOR_PRESS); + connect(numberBtn, &KBButton::clicked, this, &NumbersWidget::onBtnClicked); + m_mapBtnGeometrys[numberBtn] = numberBtn->geometry(); + } + // @ + KBButton *atBtn = new KBButton(this); + atBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_NUMBER_L2+(KEYBOARD_FIXED_DEFAULT_NUMBER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*4, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_NUMBER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*1, + KEYBOARD_FIXED_DEFAULT_NUMBER_WIDTH, + KEYBOARD_FIXED_DEFAULT_NUMBER_HEIGHT); + atBtn->setCharId('@'); + atBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED,KEYBOARD_OTHER_FONT_COLOR_PRESS); + connect(atBtn, &KBButton::clicked, this, &NumbersWidget::onBtnClicked); + m_mapBtnGeometrys[atBtn] = atBtn->geometry(); + // line 3 + QChar chLine3[] = {'7','8','9'}; + for (int n = 0; n < sizeof(chLine3)/sizeof(QChar); n++) { + KBButton *numberBtn = new KBButton(this); + numberBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_NUMBER_L3+(KEYBOARD_FIXED_DEFAULT_NUMBER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*(n+1), + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_NUMBER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*2, + KEYBOARD_FIXED_DEFAULT_NUMBER_WIDTH, + KEYBOARD_FIXED_DEFAULT_NUMBER_HEIGHT); + numberBtn->setCharId(chLine3[n]); + numberBtn->updateStyleSheet(KEYBOARD_LETTER_COLOR_NORMAL,KEYBOARD_LETTER_COLOR_PRESSED,KEYBOARD_LETTER_COLOR_PRESSED, + KEYBOARD_LETTER_COLOR_BORDER_NORMAL,KEYBOARD_LETTER_COLOR_BORDER_PRESSED,KEYBOARD_FONT_COLOR_PRESS); + connect(numberBtn, &KBButton::clicked, this, &NumbersWidget::onBtnClicked); + m_mapBtnGeometrys[numberBtn] = numberBtn->geometry(); + } + // symbol + KBButton *symbolBtn = new KBButton(this); + symbolBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_NUMBER_L3+(KEYBOARD_FIXED_DEFAULT_NUMBER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*4, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_NUMBER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*2, + KEYBOARD_FIXED_DEFAULT_NUMBER_WIDTH, + KEYBOARD_FIXED_DEFAULT_NUMBER_HEIGHT); + symbolBtn->setObjectName("btn_symbol"); + symbolBtn->setText(tr("&&?!")); + symbolBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED,KEYBOARD_OTHER_FONT_COLOR_PRESS); + connect(symbolBtn, &KBButton::clicked, this, &NumbersWidget::onBtnClicked); + m_mapBtnGeometrys[symbolBtn] = symbolBtn->geometry(); + + // line 4 + KBButton *returnBtn = new KBButton(this); + returnBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_NUMBER_L4, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_NUMBER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*3, + KEYBOARD_FIXED_DEFAULT_NUMBER_WIDTH, + KEYBOARD_FIXED_DEFAULT_NUMBER_HEIGHT); + returnBtn->setObjectName("btn_return"); + returnBtn->setText(tr("Return")); + returnBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED,KEYBOARD_OTHER_FONT_COLOR_PRESS); + connect(returnBtn, &KBButton::clicked, this, &NumbersWidget::onBtnClicked); + m_mapBtnGeometrys[returnBtn] = returnBtn->geometry(); + + // space + KBButton *spaceBtn = new KBButton(this); + spaceBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_NUMBER_L4+(KEYBOARD_FIXED_DEFAULT_NUMBER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*1, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_NUMBER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*3, + KEYBOARD_FIXED_DEFAULT_NUMBER_WIDTH, + KEYBOARD_FIXED_DEFAULT_NUMBER_HEIGHT); + spaceBtn->setObjectName("btn_space"); + spaceBtn->updateStyleSheet(KEYBOARD_LETTER_COLOR_NORMAL,KEYBOARD_LETTER_COLOR_PRESSED, + KEYBOARD_LETTER_COLOR_PRESSED,KEYBOARD_LETTER_COLOR_BORDER_NORMAL, + KEYBOARD_LETTER_COLOR_BORDER_PRESSED,KEYBOARD_OTHER_FONT_COLOR_PRESS); + spaceBtn->setIcon(QIcon(":/images/images/space.svg")); + connect(spaceBtn, &KBButton::clicked, this, &NumbersWidget::onBtnClicked); + m_mapBtnGeometrys[spaceBtn] = spaceBtn->geometry(); + + // . + KBButton *dianBtn = new KBButton(this); + dianBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_NUMBER_L4+(KEYBOARD_FIXED_DEFAULT_NUMBER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*3, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_NUMBER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*3, + KEYBOARD_FIXED_DEFAULT_NUMBER_WIDTH, + KEYBOARD_FIXED_DEFAULT_NUMBER_HEIGHT); + dianBtn->setCharId('.'); + dianBtn->updateStyleSheet(KEYBOARD_LETTER_COLOR_NORMAL,KEYBOARD_LETTER_COLOR_PRESSED, + KEYBOARD_LETTER_COLOR_PRESSED,KEYBOARD_LETTER_COLOR_BORDER_NORMAL, + KEYBOARD_LETTER_COLOR_BORDER_PRESSED,KEYBOARD_FONT_COLOR_PRESS); + connect(dianBtn, &KBButton::clicked, this, &NumbersWidget::onBtnClicked); + m_mapBtnGeometrys[dianBtn] = dianBtn->geometry(); + + // 9 + KBButton *num0Btn = new KBButton(this); + num0Btn->setGeometry(KEYBOARD_FIXED_DEFAULT_NUMBER_L4+(KEYBOARD_FIXED_DEFAULT_NUMBER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*2, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_NUMBER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*3, + KEYBOARD_FIXED_DEFAULT_NUMBER_WIDTH, + KEYBOARD_FIXED_DEFAULT_NUMBER_HEIGHT); + num0Btn->setCharId('0'); + num0Btn->updateStyleSheet(KEYBOARD_LETTER_COLOR_NORMAL,KEYBOARD_LETTER_COLOR_PRESSED, + KEYBOARD_LETTER_COLOR_PRESSED,KEYBOARD_LETTER_COLOR_BORDER_NORMAL, + KEYBOARD_LETTER_COLOR_BORDER_PRESSED,KEYBOARD_FONT_COLOR_PRESS); + connect(num0Btn, &KBButton::clicked, this, &NumbersWidget::onBtnClicked); + m_mapBtnGeometrys[num0Btn] = num0Btn->geometry(); + + // enter + KBButton *enterBtn = new KBButton(this); + enterBtn->setGeometry(KEYBOARD_FIXED_DEFAULT_NUMBER_L3+(KEYBOARD_FIXED_DEFAULT_NUMBER_WIDTH+KEYBOAED_FIXED_DEFAULT_HSPACING)*4, + KEYBOARD_FIXED_DEFAULT_TMARGIN+(KEYBOARD_FIXED_DEFAULT_NUMBER_HEIGHT+KEYBOAED_FIXED_DEFAULT_VSPACING)*3, + KEYBOARD_FIXED_DEFAULT_NUMBER_WIDTH, + KEYBOARD_FIXED_DEFAULT_NUMBER_HEIGHT); + enterBtn->setObjectName("btn_enter"); + enterBtn->updateStyleSheet(KEYBOARD_OTHER_COLOR_NORMAL,KEYBOARD_OTHER_COLOR_PRESSED, + KEYBOARD_OTHER_COLOR_PRESSED,KEYBOARD_OTHER_COLOR_BORDER_NORMAL, + KEYBOARD_OTHER_COLOR_BORDER_PRESSED,KEYBOARD_OTHER_FONT_COLOR_PRESS); + enterBtn->setIcon(QIcon(":/images/images/enter.svg")); + connect(enterBtn, &KBButton::clicked, this, &NumbersWidget::onBtnClicked); + m_mapBtnGeometrys[enterBtn] = enterBtn->geometry(); +} + +void NumbersWidget::adjustGeometry(double lfWidthScale, double lfHeightScale, bool isVertical/* = false*/, bool floatStatus) +{ + QMap::iterator itGeometry = m_mapBtnGeometrys.begin(); + for (; itGeometry != m_mapBtnGeometrys.end(); itGeometry ++) { + QWidget *widget = itGeometry.key(); + if (widget) { + QRect oldGeometry = itGeometry.value(); + QRect newGeometry = oldGeometry; + if (floatStatus) { + newGeometry.setX(oldGeometry.x()*lfWidthScale*KEYBOARD_FLOAT_PERCENTAGE); + newGeometry.setY(oldGeometry.y()*lfHeightScale); + newGeometry.setWidth(oldGeometry.width()*lfWidthScale*KEYBOARD_FLOAT_PERCENTAGE); + newGeometry.setHeight(oldGeometry.height()*lfHeightScale); + } else { + newGeometry.setX(oldGeometry.x()*lfWidthScale); + newGeometry.setY(oldGeometry.y()*lfHeightScale); + newGeometry.setWidth(oldGeometry.width()*lfWidthScale); + newGeometry.setHeight(oldGeometry.height()*lfHeightScale); + } + widget->setGeometry(newGeometry); + } + } + + QChar chChars[] = {',', '.', '?', '!', '\'', ':', '~', '@', ';', '"', + '/', '(', ')', '_', '+', '=', '`', '^', '#', '*', + '%', '&', '\\', '[', ']', '<', '>', '{', '}', '|', + '$', '-'}; + for (int n = 0; n < sizeof(chChars)/sizeof(QChar); n++) { //单独更新符号btn的高度 + QString objName = QString("btn_%1").arg(QString(chChars[n])); + KBButton *btn = findChild(objName); + btn->setFixedHeight(KEYBOARD_FIXED_DEFAULT_NUMBER_HEIGHT *lfHeightScale); + } + //更新listfarame的高度 + listFrame->setFixedHeight((KEYBOARD_FIXED_DEFAULT_NUMBER_HEIGHT *lfHeightScale +1) * (m_layoutBtnList->count())); +} + +void NumbersWidget::onBtnClicked(QChar charId) +{ + QObject *obj = sender(); + KBButton *btn = static_cast(obj); + QString objName = btn->objectName(); + int lastUnderline = objName.lastIndexOf('_'); + int start = strlen("btn_"); + int keyLength = lastUnderline - start; + QString keyName = objName.mid(start, keyLength); + qDebug() << "keyName: " << keyName; + if (keyName == BTN_RETURN) { + Q_EMIT specialBtnClicked(PAGE_LETTER); + } else if (keyName == "symbol") { + Q_EMIT specialBtnClicked(PAGE_CHAR); + } else if (charId != QChar::Null) { + Q_EMIT narmalBtnClicked(charId); + } else if (keyName == BTN_BACK) { + Q_EMIT specialBtnClicked(BTN_BACK); + } else { + Q_EMIT specialBtnClicked(keyName); + } +} diff --git a/VirtualKeyboard/src/numberswidget.h b/VirtualKeyboard/src/numberswidget.h new file mode 100644 index 0000000..bea0f28 --- /dev/null +++ b/VirtualKeyboard/src/numberswidget.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 NUMBERSWIDGET_H +#define NUMBERSWIDGET_H + +#include +#include + +class KBButton; +class QVBoxLayout; +class QScrollArea; +class QFrame; +class NumbersWidget : public QWidget +{ + Q_OBJECT +public: + explicit NumbersWidget(QWidget *parent = nullptr); + virtual ~NumbersWidget(); + + void adjustGeometry(double lfWidthScale, double lfHeightScale, bool isVertical = false, bool floatStatus = false); + +public Q_SLOTS: + void onBtnClicked(QChar charId); + +Q_SIGNALS: + void clicked(int nKeyId); + void specialBtnClicked(QString keyName); + void narmalBtnClicked(QChar charId); + +private: + void initUI(); + +private: + QMap m_mapBtnGeometrys; + QVBoxLayout *m_layoutBtnList = nullptr; + QScrollArea *m_scrollFrame = nullptr; + QFrame *listFrame = nullptr; +}; + +#endif // NUMBERSWIDGET_H diff --git a/VirtualKeyboard/src/qtkeyboard.cpp b/VirtualKeyboard/src/qtkeyboard.cpp new file mode 100644 index 0000000..a87495b --- /dev/null +++ b/VirtualKeyboard/src/qtkeyboard.cpp @@ -0,0 +1,225 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 . + * +**/ +#include "qtkeyboard.h" +#include +#include +#include +#include +#include +#include +#include "plasma-shell-manager.h" + +QMap m_specialSymbolMap = { + {' ', Qt::Key_Space}, + {',', Qt::Key_Comma}, + {'.', Qt::Key_Period}, + {'\'', Qt::Key_QuoteLeft}, + {'@', Qt::Key_At}, + {'#', Qt::Key_NumberSign}, + {'$', Qt::Key_Dollar}, + {'%', Qt::Key_Percent}, + {'&', Qt::Key_Ampersand}, + {'*', Qt::Key_Asterisk}, + {'(', Qt::Key_ParenLeft}, + {')', Qt::Key_ParenRight}, + {'-', Qt::Key_Minus}, + {'+', Qt::Key_Plus}, + {'!', Qt::Key_Exclam}, + {'"', Qt::Key_QuoteDbl}, + {'<', Qt::Key_Less}, + {'>', Qt::Key_Greater}, + {':', Qt::Key_Colon}, + {';', Qt::Key_Semicolon}, + {'/', Qt::Key_Slash}, + {'?', Qt::Key_Question}, + {'=', Qt::Key_Equal}, + {'.', Qt::Key_Period}, /*XK_kana_middledot*/ + {'~', Qt::Key_AsciiTilde}, + {'`', Qt::Key_QuoteLeft}, + {'|', Qt::Key_Bar}, + {'^', Qt::Key_AsciiCircum}, + {'{', Qt::Key_BraceLeft}, + {'}', Qt::Key_BraceRight}, + {'[', Qt::Key_BracketLeft}, + {']', Qt::Key_BracketRight}, + {'_', Qt::Key_Underscore}, + {'\\', Qt::Key_Backslash}, +}; + +QMap m_funckeyMap = { + {FuncKey::SPACE, Qt::Key_Space}, + {FuncKey::BACKSPACE, Qt::Key_Backspace}, + {FuncKey::ENTER, Qt::Key_Enter}, + {FuncKey::HOME, Qt::Key_Home}, + {FuncKey::END, Qt::Key_End}, + {FuncKey::PGUP, Qt::Key_PageUp}, + {FuncKey::PGDN, Qt::Key_PageDown}, + {FuncKey::INSERT, Qt::Key_Insert}, + {FuncKey::DELETE, Qt::Key_Delete}, + {FuncKey::UP, Qt::Key_Up}, + {FuncKey::DOWN, Qt::Key_Down}, + {FuncKey::LEFT, Qt::Key_Left}, + {FuncKey::RIGHT, Qt::Key_Right} +}; + +QMap m_modifierMap = { + {Modifier::CTRL, Qt::ControlModifier}, + {Modifier::ALT, Qt::AltModifier}, + {Modifier::SUPER, Qt::MetaModifier}, + {Modifier::SHIFT, Qt::ShiftModifier} +}; + +QVector m_shiftKeyVec = {'~', '!', '@', '#', '$', '%', '^', '&', '*', + '(', ')', '_', '+', '{', '}', '|', ':', '"', + '>', '?'}; + +#define DRM_DIR "/sys/class/leds/" +#define CAPSLOCK_STATUS "capslock_state" + +/** + * @brief 判断大写键状态 + * @return true: 大写锁定 + */ +bool QtKeyboard::checkCapsLockState() +{ + QDir ledDir(DRM_DIR); + QStringList leds = ledDir.entryList(QDir::Dirs); + QString capsFile; + + for(int i = 0;i QtKeyboard::getAllModifier() +{ + return modList; +} + +void QtKeyboard::clearModifier() +{ + modList.clear(); +} + + +void QtKeyboard::onKeyPressed(QChar c) +{ + /*判断大写锁定打开时,转换字母大小写状态,与x11keyboard类逻辑保持一致*/ + if(checkCapsLockState() && c.isLetter()){ + if(c.isUpper()){ + c = c.toLower(); + } + else if(c.isLower()){ + c = c.toUpper(); + } + } + + if(c>='A' && c<='Z'){ + sendKey(c.toLatin1(),c); + }else if(c>='a' && c<='z'){ + sendKey(c.toLatin1() - 32,c); + }else if(c >= '0' && c<='9'){ + sendKey(c.toLatin1(),c); + }else if(m_specialSymbolMap.contains(c)){ + sendKey(m_specialSymbolMap[c],c); + }else { + sendKey(c.toLatin1(),c); + } +} + +void QtKeyboard::onKeyPressed(FuncKey::FUNCKEY key) +{ + int keysym = m_funckeyMap[key]; + /*这里的text根据实际按键得到的QEvent中的text内容打印*/ + if(key == FuncKey::SPACE){ + sendKey(keysym," "); + }else if(key == FuncKey::BACKSPACE){ + sendKey(keysym,"\b"); + }else if(key == FuncKey::ENTER){ + sendKey(keysym,"\r"); + }else if(key == FuncKey::INSERT){ + sendKey(keysym,"\u007F"); + }else if(key == FuncKey::CAPSLOCK){ + PlasmaShellManager::getInstance()->setKeyPressed(58); + }else{ + sendKey(keysym,""); + } +} + +void QtKeyboard::sendKey(const unsigned int keysym,const QString text) +{ + Qt::KeyboardModifiers modifier = Qt::NoModifier; + for(auto mod : modList){ + modifier = modifier | m_modifierMap[mod]; + } + + QWidget *objfous = QApplication::focusWidget(); + + if(objfous){ + QKeyEvent event1(QEvent::KeyPress, keysym + , modifier, text + , true, 1); + QKeyEvent event2(QEvent::KeyRelease, keysym + , modifier, text + , true, 1); + + QCoreApplication::sendEvent(objfous, &event1); + QCoreApplication::sendEvent(objfous, &event2); + } + +} diff --git a/VirtualKeyboard/src/qtkeyboard.h b/VirtualKeyboard/src/qtkeyboard.h new file mode 100644 index 0000000..a9c9690 --- /dev/null +++ b/VirtualKeyboard/src/qtkeyboard.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 QTKEYBOARD_H +#define QTKEYBOARD_H + +#include +#include +#include "fakekeyboard.h" + +class QtKeyboard : public FakeKeyboard +{ + Q_OBJECT +public: + explicit QtKeyboard(QObject *parent = nullptr); + ~QtKeyboard(); + void addModifier(Modifier::MOD mod); + void removeModifier(Modifier::MOD mod); + bool hasModifier(Modifier::MOD mod); + QList getAllModifier(); + void clearModifier(); + +public Q_SLOTS: + void onKeyPressed(QChar c); + void onKeyPressed(FuncKey::FUNCKEY key); + +private: + void sendKey(const unsigned int keyCode,const QString text); + bool checkCapsLockState(); + +private: + QList modList; +}; + +#endif // QTKEYBOARD_H diff --git a/VirtualKeyboard/src/virtualkeyboard.cpp b/VirtualKeyboard/src/virtualkeyboard.cpp deleted file mode 100644 index ea46695..0000000 --- a/VirtualKeyboard/src/virtualkeyboard.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. -**/ -#include "virtualkeyboard.h" -#include -#include -#include -#include - -VirtualKeyboard::VirtualKeyboard(QWidget *parent) - : QWidget(parent) -{ - Q_INIT_RESOURCE(keyboard); - - setAutoFillBackground(true); - QPalette plt; - plt.setBrush(QPalette::Background, Qt::black); - setPalette(plt); - - setWindowFlags(Qt::FramelessWindowHint | - Qt::WindowStaysOnTopHint | - Qt::WindowDoesNotAcceptFocus); - - - keyboardWidget = new KeyboardWidget(this); - QHBoxLayout *hl_keyboard = new QHBoxLayout(this); - QSpacerItem *spacer = new QSpacerItem(40, 20); - hl_keyboard->addSpacerItem(spacer); - hl_keyboard->addWidget(keyboardWidget); - QSpacerItem *spacer2 = new QSpacerItem(40, 20); - hl_keyboard->addSpacerItem(spacer2); - - QFile qssFile(":/qss/keyboard.qss"); - qssFile.open(QIODevice::ReadOnly); - setStyleSheet(qssFile.readAll()); - qssFile.close(); - - QDesktopWidget *desktop = QApplication::desktop(); - cursorMonitor = new CursorMonitor(this); - - //在多显示器情况下,监视鼠标指针的位置和主显示器变化信号 - connect(cursorMonitor, &CursorMonitor::cursorPosChanged, - this, [&](const QPoint &pos){ - adjustGeometry(desktop->screenNumber(pos)); - }); - - connect(desktop, &QDesktopWidget::primaryScreenChanged, - this, [&]{ - adjustGeometry(desktop->primaryScreen()); - }); - - connect(keyboardWidget, &KeyboardWidget::aboutToClose, - this, &VirtualKeyboard::aboutToClose); - - adjustGeometry(desktop->primaryScreen()); -} - -void VirtualKeyboard::adjustGeometry(int screen) -{ - QDesktopWidget *desktop = QApplication::desktop(); - QWidget *activateScreen = desktop->screen(screen); - setGeometry(0, activateScreen->height() - activateScreen->height() / 3, - activateScreen->width(), activateScreen->height() / 3); -} diff --git a/VirtualKeyboard/src/virtualkeyboard.h b/VirtualKeyboard/src/virtualkeyboard.h deleted file mode 100644 index 44b628a..0000000 --- a/VirtualKeyboard/src/virtualkeyboard.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. -**/ -#ifndef VIRTUALKEYBOARD_H -#define VIRTUALKEYBOARD_H - -#include -#include - -#include "keyboardwidget.h" -#include "cursormonitor.h" - -class VirtualKeyboard : public QWidget -{ - Q_OBJECT -public: - explicit VirtualKeyboard(QWidget *parent = 0); - -private: - void adjustGeometry(int screen); - -Q_SIGNALS: - void aboutToClose(); - -private: - KeyboardWidget *keyboardWidget; - CursorMonitor *cursorMonitor; - bool isApplication; -}; - - -#endif // VIRTUALKEYBOARD_H diff --git a/VirtualKeyboard/src/virtualkeyboardwidget.cpp b/VirtualKeyboard/src/virtualkeyboardwidget.cpp new file mode 100644 index 0000000..4318702 --- /dev/null +++ b/VirtualKeyboard/src/virtualkeyboardwidget.cpp @@ -0,0 +1,310 @@ +/* + * Copyright (C) 2018 Tianjin KYLIN Information Technology 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, 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 . + * +**/ +#include "virtualkeyboardwidget.h" + +#include +#include +#include +#include +#include "commondef.h" +#include +#include +#include "dragwidget.h" +#include "kbtitle.h" +#include "letterswidget.h" +#include "numberswidget.h" +#include "charswidget.h" +#include "charsmorewidget.h" +#include "x11keyboard.h" +#include "qtkeyboard.h" + +VirtualKeyboardWidget::VirtualKeyboardWidget(QWidget *parent) + : QWidget(parent) + , m_lfWidthScale(1.0) + , m_lfHeightScale(1.0) + , m_isVertical(false) +{ + Q_INIT_RESOURCE(keyboard); + setAttribute(Qt::WA_TranslucentBackground);//背景透明 + //setAutoFillBackground(true); + setWindowFlags(Qt::FramelessWindowHint | + Qt::WindowStaysOnTopHint | + Qt::WindowDoesNotAcceptFocus); + + if(QX11Info::isPlatformX11()){ + vKeyboard = new X11Keyboard(this); + }else{ + vKeyboard = new QtKeyboard(this); + } + + connect(this, SIGNAL(keyPressed(QChar)), + vKeyboard, SLOT(onKeyPressed(QChar))); + connect(this, SIGNAL(keyPressed(FuncKey::FUNCKEY)), + vKeyboard, SLOT(onKeyPressed(FuncKey::FUNCKEY))); + initUI(); + initConnections(); +} + +VirtualKeyboardWidget::~VirtualKeyboardWidget() +{ + +} + +void VirtualKeyboardWidget::initUI() +{ + QVBoxLayout *layoutMain = new QVBoxLayout(this); + layoutMain->setContentsMargins(0,0,0,0); + layoutMain->setSpacing(0); + + m_dragWidget = new DragWidget(); + layoutMain->addWidget(m_dragWidget); + m_dragWidget->installEventFilter(this); + + m_kbTitle = new KBTitle(); + layoutMain->addWidget(m_kbTitle); + + m_stackedWidget = new QStackedWidget(); + + m_lettersWidget = new LettersWidget(); + m_stackedWidget->addWidget(m_lettersWidget); + + m_numbersWidget = new NumbersWidget(this); + m_stackedWidget->addWidget(m_numbersWidget); + + m_charsWidget = new CharsWidget(); + m_stackedWidget->addWidget(m_charsWidget); + + m_charsMoreWidget = new CharsMoreWidget(); + m_stackedWidget->addWidget(m_charsMoreWidget); + + m_stackedWidget->setCurrentIndex(VKB_PAGE_LETTERS); + m_nCurPage = VKB_PAGE_CHARSMORE; + layoutMain->addWidget(m_stackedWidget); +} + +void VirtualKeyboardWidget::initConnections() +{ + connect(m_kbTitle, &KBTitle::btnClicked, this, &VirtualKeyboardWidget::onSpecialBtnClicked); + connect(m_lettersWidget, &LettersWidget::specialBtnClicked, this, &VirtualKeyboardWidget::onSpecialBtnClicked); + connect(m_lettersWidget, &LettersWidget::normalBtnClicked, this, &VirtualKeyboardWidget::onNormalBtnClicked); + connect(m_numbersWidget, &NumbersWidget::specialBtnClicked, this, &VirtualKeyboardWidget::onSpecialBtnClicked); + connect(m_numbersWidget, &NumbersWidget::narmalBtnClicked, this, &VirtualKeyboardWidget::onNormalBtnClicked); + connect(m_charsWidget, &CharsWidget::specialBtnClicked, this, &VirtualKeyboardWidget::onSpecialBtnClicked); + connect(m_charsWidget, &CharsWidget::normalBtnClicked, this, &VirtualKeyboardWidget::onNormalBtnClicked); + connect(m_charsMoreWidget, &CharsMoreWidget::specialBtnClicked, this, &VirtualKeyboardWidget::onSpecialBtnClicked); + connect(m_charsMoreWidget, &CharsMoreWidget::normalBtnClicked, this, &VirtualKeyboardWidget::onNormalBtnClicked); +} + +void VirtualKeyboardWidget::adjustGeometry() +{ + QWidget *parentWidget = qobject_cast(parent()); + if (parentWidget) { + //qDebug()<< "parent: " << parentWidget <<"Parent gemotry:"<geometry(); + double lfWidth = parentWidget->geometry().width(); + double lfHeight = parentWidget->geometry().height(); + m_isVertical = lfHeight > lfWidth; + m_lfWidthScale = lfWidth/KEYBOARD_PARENT_DEFAULT_WIDTH; + if (m_isVertical) + m_lfHeightScale = lfHeight / KEYBOARD_PARENT_DEFAULT_WIDTH; + else + m_lfHeightScale = lfHeight / KEYBOARD_PARENT_DEFAULT_HEIGHT; + if (m_isdragState) { + lfWidth = m_lfWidthScale * KEYBOARD_DRAGSHOW_FIXED_DEFAULT_WIDTH; + lfHeight = m_lfHeightScale * KEYBOARD_DRAGSHOW_FIXED_DEFAULT_HEIGHT; + setGeometry(QRect(m_lfWidthScale * (KEYBOARD_PARENT_DEFAULT_WIDTH - KEYBOARD_DRAGSHOW_FIXED_DEFAULT_WIDTH) / 2, + parentWidget->geometry().height() - lfHeight, + lfWidth, lfHeight)); + m_dragWidget->show(); + } else { + lfWidth = m_lfWidthScale * KEYBOARD_FIXED_DEFAULT_WIDTH; + lfHeight = m_lfHeightScale * KEYBOARD_DRAGHIDE_FIXED_DEFAULT_HEIGHT; + m_dragWidget->hide(); + setGeometry(QRect(0, parentWidget->geometry().height()-lfHeight, lfWidth, lfHeight)); + } + + //qDebug()<<"Widget geometry:"<show(); + } else { + setGeometry(QRect(0, 0, + KEYBOARD_FIXED_DEFAULT_WIDTH, KEYBOARD_DRAGHIDE_FIXED_DEFAULT_HEIGHT)); + m_dragWidget->hide(); + } + m_lfWidthScale = 1.0; + m_lfHeightScale = 1.0; + m_isVertical = false; + } + if (m_dragWidget) { + m_dragWidget->adjustGeometry(m_lfWidthScale, m_lfHeightScale, m_isVertical, m_isdragState); + } + if (m_kbTitle) { + m_kbTitle->adjustGeometry(m_lfWidthScale, m_lfHeightScale, m_isVertical, m_isdragState); + } + if (m_lettersWidget) { + m_lettersWidget->adjustGeometry(m_lfWidthScale, m_lfHeightScale, m_isVertical, m_isdragState); + } + if (m_numbersWidget) { + m_numbersWidget->adjustGeometry(m_lfWidthScale, m_lfHeightScale, m_isVertical, m_isdragState); + } + if (m_charsWidget) { + m_charsWidget->adjustGeometry(m_lfWidthScale, m_lfHeightScale, m_isVertical, m_isdragState); + } + if (m_charsMoreWidget) { + m_charsMoreWidget->adjustGeometry(m_lfWidthScale, m_lfHeightScale, m_isVertical, m_isdragState); + } +} + +bool VirtualKeyboardWidget::eventFilter(QObject *watched, QEvent *event) +{ + if(watched != m_dragWidget && !isMove) return QWidget::eventFilter(watched, event); + switch(event->type()) + { + case QEvent::MouseButtonPress: + onMouseEvents(1); + return true; + case QEvent::MouseMove: + onMouseEvents(2); + return true; + case QEvent::MouseButtonRelease: + onMouseEvents(3); + return true; + default: + break; + } + return QWidget::eventFilter(watched, event); +} + +void VirtualKeyboardWidget::resizeEvent(QResizeEvent *event) +{ + adjustGeometry(); +} + +void VirtualKeyboardWidget::paintEvent(QPaintEvent *event) +{ + QPainterPath path; + QPainter painter(this); + painter.setOpacity(1.0); + painter.setRenderHint(QPainter::Antialiasing); // 反锯齿; + painter.setClipping(true); + painter.setPen(Qt::transparent); + if (m_isdragState) { + path.addRoundedRect(this->rect(), 16, 16); + } else { + path.addRoundedRect(this->rect(), 0, 0); + } + path.setFillRule(Qt::WindingFill); + painter.setBrush(QColor("#EBEDEF")); + painter.setPen(Qt::transparent); + painter.drawPath(path); + QWidget::paintEvent(event); +} + +void VirtualKeyboardWidget::onSpecialBtnClicked(QString keyName) +{ + Modifier::MOD mod = Modifier::getModifier(keyName); + FuncKey::FUNCKEY funcKey = FuncKey::getKey(keyName); + if (mod != Modifier::UNKNOWN) { + if(vKeyboard->hasModifier(mod)) { + vKeyboard->removeModifier(mod); + m_lettersWidget->changeFuncKeyStyle(keyName, false); + } else { + vKeyboard->addModifier(mod); + m_lettersWidget->changeFuncKeyStyle(keyName, true); + } + if (keyName == BTN_CAPSLOCK) { + Q_EMIT keyPressed(FuncKey::CAPSLOCK); + clearModifier(); + } + } else if(funcKey != FuncKey::UNKNOWN) { + Q_EMIT keyPressed(funcKey); + } else if (keyName == PAGE_CHARSMORE) { + m_stackedWidget->setCurrentIndex(VKB_PAGE_CHARSMORE); + update(); + } else if (keyName == PAGE_CHAR) { + m_stackedWidget->setCurrentIndex(VKB_PAGE_CHARS); + update(); + } else if (keyName == PAGE_NUMBER) { + m_stackedWidget->setCurrentIndex(VKB_PAGE_NUMBERS); + update(); + } else if (keyName == PAGE_LETTER) { + m_stackedWidget->setCurrentIndex(VKB_PAGE_LETTERS); + update(); + } else if (keyName == BTN_FLOAT) { + m_isdragState = !m_isdragState; + adjustGeometry(); + Q_EMIT aboutToFloat(); + } else if (keyName == BTN_CLOSE) { + Q_EMIT aboutToClose(); + } +} + +void VirtualKeyboardWidget::onNormalBtnClicked(QChar c) +{ + Q_EMIT keyPressed(c); + clearModifier(); +} + +void VirtualKeyboardWidget::clearModifier() +{ + for(auto mod : vKeyboard->getAllModifier()) { + QString modName = Modifier::getModifierName(mod); + m_lettersWidget->changeFuncKeyStyle(modName, false); + } + vKeyboard->clearModifier(); +} + +void VirtualKeyboardWidget::onMouseEvents(int type) +{ + switch (type) { + case 1: + { + isMove = true; + lastPoint = QCursor::pos(); + break; + } + case 2: + { + if(isMove) + { + QPoint cPoint = QCursor::pos(); + QPoint p = pos(); + p.setX(p.x() - lastPoint.x() + cPoint.x()); + p.setY(p.y() - lastPoint.y() + cPoint.y()); + lastPoint = cPoint; + move(p); + } + break; + } + case 3: + { + isMove = false; + break; + } + default: + break; + } +} + + +bool VirtualKeyboardWidget::getFloatStatus() +{ + return m_isdragState; +} diff --git a/VirtualKeyboard/src/virtualkeyboardwidget.h b/VirtualKeyboard/src/virtualkeyboardwidget.h new file mode 100644 index 0000000..3238662 --- /dev/null +++ b/VirtualKeyboard/src/virtualkeyboardwidget.h @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2018 Tianjin KYLIN Information Technology 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, 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 VIRTUALKEYBOARDWIDGET_H +#define VIRTUALKEYBOARDWIDGET_H + +#include +#include +#include +#include +#include "fakekeyboard.h" +#include "plasma-shell-manager.h" + +class DragWidget; +class KBTitle; +class LettersWidget; +class NumbersWidget; +class CharsWidget; +class CharsMoreWidget; +class VirtualKeyboardWidget : public QWidget +{ + Q_OBJECT +public: + enum { + VKB_PAGE_LETTERS, + VKB_PAGE_NUMBERS, + VKB_PAGE_CHARS, + VKB_PAGE_CHARSMORE, + }; + VirtualKeyboardWidget(QWidget *parent = nullptr); + virtual ~VirtualKeyboardWidget(); + bool getFloatStatus(); + +public Q_SLOTS: + void onNormalBtnClicked(QChar c); + void onSpecialBtnClicked(QString keyName); + +Q_SIGNALS: + void aboutToClose(); + void aboutToFloat(); + void keyPressed(QChar c); + void keyPressed(FuncKey::FUNCKEY key); + +protected: + void paintEvent(QPaintEvent *) override; + void resizeEvent(QResizeEvent *event) override; + bool eventFilter(QObject *watched, QEvent *event) override; + +private: + void initUI(); + void initConnections(); + void adjustGeometry(); + void onMouseEvents(int type); + void clearModifier(); + +private: + double m_lfWidthScale; + double m_lfHeightScale; + bool m_isVertical; + QStackedWidget *m_stackedWidget = nullptr; + LettersWidget *m_lettersWidget = nullptr; + NumbersWidget *m_numbersWidget = nullptr; + CharsWidget *m_charsWidget = nullptr; + CharsMoreWidget *m_charsMoreWidget = nullptr; + KBTitle *m_kbTitle = nullptr; + DragWidget *m_dragWidget = nullptr; + int m_nCurPage; + QList m_listPageHis; + bool m_isdragState = false;//是否为悬浮状态 + bool isMove;// 是否可移动 + QPoint lastPoint;// 拖拽控件时 记录当前控件的位置 + FakeKeyboard *vKeyboard; +}; + +#endif // VIRTUALKEYBOARDWIDGET_H diff --git a/VirtualKeyboard/src/x11keyboard.cpp b/VirtualKeyboard/src/x11keyboard.cpp index 5e160ed..c7cd2c8 100644 --- a/VirtualKeyboard/src/x11keyboard.cpp +++ b/VirtualKeyboard/src/x11keyboard.cpp @@ -1,9 +1,9 @@ -/** +/* * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, @@ -12,9 +12,8 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. + * along with this program; if not, see . + * **/ #include "x11keyboard.h" #include @@ -22,8 +21,6 @@ #include #include - - struct CharMap { QChar name; KeySym code; @@ -79,14 +76,15 @@ QMap funckeyMap = { {FuncKey::UP, XK_Up}, {FuncKey::DOWN, XK_Down}, {FuncKey::LEFT, XK_Left}, - {FuncKey::RIGHT, XK_Right} + {FuncKey::RIGHT, XK_Right}, + {FuncKey::CAPSLOCK, XK_Caps_Lock} }; QMap modifierMap = { {Modifier::CTRL, XK_Control_L}, {Modifier::ALT, XK_Alt_L}, {Modifier::SUPER, XK_Super_L}, - {Modifier::SHIFT, XK_Shift_L} + {Modifier::SHIFT, XK_Shift_L}, }; QVector shiftKeyVec = {'~', '!', '@', '#', '$', '%', '^', '&', '*', @@ -123,7 +121,7 @@ unsigned int keyCodeOfChar(QChar c) } X11Keyboard::X11Keyboard(QObject *parent) - : QObject(parent) + : FakeKeyboard(parent) { } @@ -168,6 +166,7 @@ void X11Keyboard::onKeyPressed(QChar c) void X11Keyboard::onKeyPressed(FuncKey::FUNCKEY key) { KeyCode keyCode; + KeySym keysym = funckeyMap[key]; if(keysym != NoSymbol) @@ -203,6 +202,9 @@ void X11Keyboard::sendKey(unsigned int keyCode) KeyCode keyCode = XKeysymToKeycode(display, modifierMap[mod]); XTestFakeKeyEvent(display, keyCode, False, 2); } + + //输入结束清除shift状态 + isShift = false; XFlush(display); } diff --git a/VirtualKeyboard/src/x11keyboard.h b/VirtualKeyboard/src/x11keyboard.h index 42fd997..9914019 100644 --- a/VirtualKeyboard/src/x11keyboard.h +++ b/VirtualKeyboard/src/x11keyboard.h @@ -1,9 +1,9 @@ -/** +/* * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, @@ -12,85 +12,17 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. + * along with this program; if not, see . + * **/ #ifndef X11KEYBOARD_H #define X11KEYBOARD_H #include #include +#include "fakekeyboard.h" -class Modifier : public QObject -{ - Q_OBJECT -public: - Modifier(){} - - enum MOD{ - UNKNOWN = -1, - CTRL, - SHIFT, - ALT, - SUPER - }; - Q_ENUM(MOD) - - static QString getModifierName(int mod) - { - QMetaEnum metaEnum = QMetaEnum::fromType(); - const char* modName = metaEnum.valueToKey(mod); - QString result = QString(modName).toLower(); - return result; - } - static MOD getModifier(const QString &modName) - { - QMetaEnum metaEnum = QMetaEnum::fromType(); - MOD mod = (MOD)metaEnum.keyToValue(modName.toUpper().toLocal8Bit().data()); - return mod; - } -}; - -class FuncKey : public QObject -{ - Q_OBJECT -public: - FuncKey(){} - - enum FUNCKEY { - UNKNOWN = -1, - SPACE = 0, - BACKSPACE, - ENTER, - HOME, - END, - PGUP, - PGDN, - INSERT, - DELETE, - UP, - DOWN, - LEFT, - RIGHT - }; - Q_ENUM(FUNCKEY) - static QString getKeyName(int key) - { - QMetaEnum metaEnum = QMetaEnum::fromType(); - const char* keyName = metaEnum.valueToKey(key); - QString result = QString(keyName).toLower(); - return result; - } - static FUNCKEY getKey(const QString &keyName) - { - QMetaEnum metaEnum = QMetaEnum::fromType(); - FUNCKEY key = (FUNCKEY)metaEnum.keyToValue(keyName.toUpper().toLocal8Bit().data()); - return key; - } -}; - -class X11Keyboard : public QObject +class X11Keyboard : public FakeKeyboard { Q_OBJECT public: diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index ac9b470..6900182 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -4,3 +4,4 @@ install(FILES ukui-screensaver.directory DESTINATION /usr/share/desktop-director install(FILES ukui-screensavers.menu DESTINATION /etc/xdg/menus) install(FILES ukui-screensaver-qt DESTINATION /etc/pam.d) install(FILES screensaver-startup.sh DESTINATION /usr/bin) +install(FILES ukui-screensaver-dialog.desktop DESTINATION /usr/share/applications) diff --git a/data/org.ukui.screensaver.gschema.xml b/data/org.ukui.screensaver.gschema.xml index 302bc72..4aef623 100644 --- a/data/org.ukui.screensaver.gschema.xml +++ b/data/org.ukui.screensaver.gschema.xml @@ -166,7 +166,7 @@ Allow the session status message to be displayed when the screen is locked. - '/usr/share/backgrounds/1-warty-final-ubuntukylin.jpg' + '/usr/share/backgrounds/1-openkylin.jpg' the background iamge of lockscreen Allow the user to set the background iamge of lockscreen. diff --git a/data/screensaver-startup.sh b/data/screensaver-startup.sh index c110d2e..822388a 100755 --- a/data/screensaver-startup.sh +++ b/data/screensaver-startup.sh @@ -1,5 +1,4 @@ #!/bin/bash -/usr/lib/ukui-screensaver/set4kScale >/dev/null 2>&1 ukui-screensaver-dialog --lock-startup & >/dev/null 2>&1 /usr/lib/ukui-screensaver/screensaver-focus-helper & >/dev/null 2>&1 diff --git a/data/ukui-screensaver-dialog.desktop b/data/ukui-screensaver-dialog.desktop new file mode 100644 index 0000000..95f33d1 --- /dev/null +++ b/data/ukui-screensaver-dialog.desktop @@ -0,0 +1,15 @@ +[Desktop Entry] +Type=Application +Name=Lockscreen Dialog +Name[tr]=Ekran pencere +Name[zh_CN]=锁屏窗口程序 +Name[zh_HK]=鎖屏窗口程式 +Name[zh_TW]=鎖屏窗口程式 +Comment[tr]=Ekran kilidini ve kurtarıcı göster +Comment[zh_CN]=展示屏幕锁定和保护程序 +Comment[zh_TW]=展示屏幕鎖定和保護程式 +Exec=/usr/bin/ukui-screensaver-dialog +NoDisplay=true +OnlyShowIn=UKUI +X-KDE-Wayland-Interfaces=org_kde_plasma_window_management,org_kde_kwin_keystate + diff --git a/data/ukui-screensaver.desktop b/data/ukui-screensaver.desktop index ce57723..9db6658 100644 --- a/data/ukui-screensaver.desktop +++ b/data/ukui-screensaver.desktop @@ -17,3 +17,4 @@ X-UKUI-Bugzilla-Product=ukui-screensaver X-UKUI-Bugzilla-Component=general X-UKUI-Bugzilla-Version=1.0.0 OnlyShowIn=UKUI +X-UKUI-AutoRestart=true diff --git a/debian/changelog b/debian/changelog index 745320d..74c6e0d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +ukui-screensaver (4.0.0.0-ok0~0426) yangtze; urgency=medium + + * BUG号: 137546 【RISC-V】【控制面板】无法更改屏幕缩放 + * 需求号:无 + * 其他修改说明:无 + + -- Yang Min Wed, 26 Apr 2023 19:49:20 +0800 + ukui-screensaver (3.22.1.3-ok11~0412) yangtze; urgency=medium * BUG号:I5XFFQ 锁屏登入界面无键盘图标,无实体键盘时无法输入 diff --git a/debian/control b/debian/control index dd14820..ad39a66 100644 --- a/debian/control +++ b/debian/control @@ -25,6 +25,7 @@ Build-Depends: debhelper-compat (= 12), libgsettings-qt-dev, libkf5windowsystem-dev, libmatemixer-dev, + libimlib2-dev, libukui-log4qt-dev, libkysdk-sysinfo-dev (>> 1.1.0kylin1), ukui-input-gather (>=1.0.0.2), diff --git a/debian/patches/0001-change-version-for-rebuild.patch b/debian/patches/0001-change-version-for-rebuild.patch deleted file mode 100644 index 2b07b39..0000000 --- a/debian/patches/0001-change-version-for-rebuild.patch +++ /dev/null @@ -1,8914 +0,0 @@ -From: winnerym -Date: Thu, 8 Dec 2022 14:21:31 +0800 -Subject: change version for rebuild - ---- - CMakeLists.txt | 5 +- - Common/commonfunc.cpp | 1 + - KylinNM/src/kylinnm.cpp | 1 + - VirtualKeyboard/CMakeLists.txt | 5 + - VirtualKeyboard/src/keyboardwidget.ui | 63 +- - VirtualKeyboard/src/virtualkeyboard.cpp | 6 +- - VirtualKeyboard/src/vkstackedwidget.cpp | 22 + - VirtualKeyboard/src/vkstackedwidget.h | 18 + - data/CMakeLists.txt | 1 + - data/org.ukui.screensaver.gschema.xml | 2 +- - data/ukui-screensaver-dialog.desktop | 15 + - data/ukui-screensaver.desktop | 1 + - i18n_ts/bo.ts | 375 ++++-- - i18n_ts/bo_CN.ts | 1912 +++++++++++-------------------- - i18n_ts/es.ts | 194 +++- - i18n_ts/fr.ts | 194 +++- - i18n_ts/pt.ts | 194 +++- - i18n_ts/ru.ts | 194 +++- - i18n_ts/tr.ts | 375 ++++-- - i18n_ts/zh_CN.ts | 173 +-- - screensaver/scconfiguration.cpp | 2 +- - screensaver/screensaver.cpp | 19 - - src/CMakeLists.txt | 11 +- - src/assets.qrc | 12 +- - src/assets/authdialog.qss | 5 - - src/assets/hibernate.png | Bin 902 -> 0 bytes - src/assets/hibernate.svg | 1 + - src/assets/keyboard.png | Bin 171 -> 0 bytes - src/assets/powerManager.png | Bin 501 -> 0 bytes - src/assets/reboot.png | Bin 1106 -> 0 bytes - src/assets/reboot.svg | 1 + - src/assets/shutdown.png | Bin 1157 -> 0 bytes - src/assets/shutdown.svg | 1 + - src/assets/suspend.png | Bin 817 -> 0 bytes - src/assets/suspend.svg | 1 + - src/assets/switchUser.png | Bin 424 -> 0 bytes - src/assets/switchuser.svg | 1 + - src/auth-pam.cpp | 52 +- - src/auth-pam.h | 3 +- - src/authdialog.cpp | 52 +- - src/authdialog.h | 6 +- - src/authpamthread.cpp | 201 ---- - src/authpamthread.h | 35 - - src/batterywidget.cpp | 3 +- - src/configuration.cpp | 3 +- - src/fullbackgroundwidget.cpp | 142 ++- - src/iconedit.cpp | 26 +- - src/interface.cpp | 16 +- - src/libinputswitchevent.cpp | 65 ++ - src/libinputswitchevent.h | 40 + - src/lockwidget.cpp | 338 ++++-- - src/lockwidget.h | 13 +- - src/plasma-shell-manager.cpp | 170 +++ - src/plasma-shell-manager.h | 37 + - src/powermanager.cpp | 33 +- - src/powermanager.h | 11 +- - src/screensaverwidget.cpp | 4 +- - src/ukui-screensaver-dialog.cpp | 16 +- - 58 files changed, 3074 insertions(+), 1997 deletions(-) - create mode 100644 VirtualKeyboard/src/vkstackedwidget.cpp - create mode 100644 VirtualKeyboard/src/vkstackedwidget.h - create mode 100644 data/ukui-screensaver-dialog.desktop - delete mode 100644 src/assets/hibernate.png - create mode 100644 src/assets/hibernate.svg - delete mode 100644 src/assets/keyboard.png - delete mode 100644 src/assets/powerManager.png - delete mode 100644 src/assets/reboot.png - create mode 100644 src/assets/reboot.svg - delete mode 100644 src/assets/shutdown.png - create mode 100644 src/assets/shutdown.svg - delete mode 100644 src/assets/suspend.png - create mode 100644 src/assets/suspend.svg - delete mode 100644 src/assets/switchUser.png - create mode 100644 src/assets/switchuser.svg - delete mode 100644 src/authpamthread.cpp - delete mode 100644 src/authpamthread.h - create mode 100644 src/libinputswitchevent.cpp - create mode 100644 src/libinputswitchevent.h - create mode 100644 src/plasma-shell-manager.cpp - create mode 100644 src/plasma-shell-manager.h - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 14d81a6..0aa1a46 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -5,10 +5,13 @@ find_package(Qt5 COMPONENTS Core Widgets DBus X11Extras Xml Network Svg) - find_package(PkgConfig REQUIRED) - find_package(OpenCV REQUIRED) - find_package(PkgConfig) -+find_package(KF5Screen REQUIRED) -+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项目 - option (USE_INTEL "intel项目" OFF) -diff --git a/Common/commonfunc.cpp b/Common/commonfunc.cpp -index 79df19e..c80213b 100644 ---- a/Common/commonfunc.cpp -+++ b/Common/commonfunc.cpp -@@ -22,6 +22,7 @@ - #include - #include - #include -+#include - #include - #include - #include "commonfunc.h" -diff --git a/KylinNM/src/kylinnm.cpp b/KylinNM/src/kylinnm.cpp -index 3446f2e..d17fd83 100644 ---- a/KylinNM/src/kylinnm.cpp -+++ b/KylinNM/src/kylinnm.cpp -@@ -2470,6 +2470,7 @@ void KylinNM::enWifiDone() - - qDebug()<<"debug: already turn on the switch of wifi network"; - syslog(LOG_DEBUG, "Already turn on the switch of wifi network"); -+ QTimer::singleShot(200, this, &KylinNM::onConnectChanged); - } - void KylinNM::disWifiDone() - { -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/data/CMakeLists.txt b/data/CMakeLists.txt -index ac9b470..6900182 100644 ---- a/data/CMakeLists.txt -+++ b/data/CMakeLists.txt -@@ -4,3 +4,4 @@ install(FILES ukui-screensaver.directory DESTINATION /usr/share/desktop-director - install(FILES ukui-screensavers.menu DESTINATION /etc/xdg/menus) - install(FILES ukui-screensaver-qt DESTINATION /etc/pam.d) - install(FILES screensaver-startup.sh DESTINATION /usr/bin) -+install(FILES ukui-screensaver-dialog.desktop DESTINATION /usr/share/applications) -diff --git a/data/org.ukui.screensaver.gschema.xml b/data/org.ukui.screensaver.gschema.xml -index 302bc72..4aef623 100644 ---- a/data/org.ukui.screensaver.gschema.xml -+++ b/data/org.ukui.screensaver.gschema.xml -@@ -166,7 +166,7 @@ - Allow the session status message to be displayed when the screen is locked. - - -- '/usr/share/backgrounds/1-warty-final-ubuntukylin.jpg' -+ '/usr/share/backgrounds/1-openkylin.jpg' - the background iamge of lockscreen - Allow the user to set the background iamge of lockscreen. - -diff --git a/data/ukui-screensaver-dialog.desktop b/data/ukui-screensaver-dialog.desktop -new file mode 100644 -index 0000000..95f33d1 ---- /dev/null -+++ b/data/ukui-screensaver-dialog.desktop -@@ -0,0 +1,15 @@ -+[Desktop Entry] -+Type=Application -+Name=Lockscreen Dialog -+Name[tr]=Ekran pencere -+Name[zh_CN]=锁屏窗口程序 -+Name[zh_HK]=鎖屏窗口程式 -+Name[zh_TW]=鎖屏窗口程式 -+Comment[tr]=Ekran kilidini ve kurtarıcı göster -+Comment[zh_CN]=展示屏幕锁定和保护程序 -+Comment[zh_TW]=展示屏幕鎖定和保護程式 -+Exec=/usr/bin/ukui-screensaver-dialog -+NoDisplay=true -+OnlyShowIn=UKUI -+X-KDE-Wayland-Interfaces=org_kde_plasma_window_management,org_kde_kwin_keystate -+ -diff --git a/data/ukui-screensaver.desktop b/data/ukui-screensaver.desktop -index ce57723..9db6658 100644 ---- a/data/ukui-screensaver.desktop -+++ b/data/ukui-screensaver.desktop -@@ -17,3 +17,4 @@ X-UKUI-Bugzilla-Product=ukui-screensaver - X-UKUI-Bugzilla-Component=general - X-UKUI-Bugzilla-Version=1.0.0 - OnlyShowIn=UKUI -+X-UKUI-AutoRestart=true -diff --git a/i18n_ts/bo.ts b/i18n_ts/bo.ts -index df90984..c88658a 100644 ---- a/i18n_ts/bo.ts -+++ b/i18n_ts/bo.ts -@@ -4,111 +4,134 @@ - - 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 - - - -- -+ - Abnormal network - - - -+ -+ BatteryWidget -+ -+ -+ Charging... -+ -+ -+ -+ -+ fully charged -+ -+ -+ -+ -+ PowerMode -+ -+ -+ -+ -+ BatteryMode -+ -+ -+ - - BiometricAuthWidget - -@@ -1424,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 - -@@ -1541,7 +1682,7 @@ - - - -- -+ - Not connected - - -@@ -1554,7 +1695,7 @@ - - - -- -+ - Disconnected - - -@@ -1580,22 +1721,22 @@ - - - -- -+ - Conn Ethernet Success - - - -- -+ - Conn Ethernet Fail - - - -- -+ - Conn Wifi Success - - - -- -+ - Confirm your Wi-Fi password or usable of wireless card - - -@@ -1618,17 +1759,17 @@ - - - -- -+ - Multiple users are logged in at the same time.Are you sure you want to reboot this system? - - - -- -+ - LAN - - - -- -+ - WLAN - - -@@ -1636,12 +1777,12 @@ - - LoginOptionsWidget - -- -+ - Login Options - - - -- -+ - Identify device removed! - - -@@ -1821,38 +1962,38 @@ - - PowerManager - -- -+ - Log Out - - - -- -+ - lock - - - -- -- -+ -+ - Reboot - - - -- -+ - Power Off - - - -- -+ - Shut Down - - - -- -+ - Hibernate - - - -- -+ - Suspend - - -@@ -1870,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 - - -@@ -1955,38 +2171,38 @@ - - TabletLockWidget - -- -- -- -- -- -- -+ -+ -+ -+ -+ -+ - Cancel - - - -- -- -+ -+ - Back - - - -- -+ - Skip - - - -- -+ - New password is the same as old - - - -- -+ - Reset password error:%1 - - - -- -+ - Please scan by correct WeChat - - -@@ -2058,25 +2274,38 @@ - - - -+ -+ Widget -+ -+ -+ Widget -+ -+ -+ -+ -+ LoadPlugin -+ -+ -+ - - main - -- -+ - Screensaver for ukui-screensaver - - - -- -+ - show on root window - - - -- -+ - show on window. - - - -- -+ - window id - - -@@ -2087,8 +2316,8 @@ - - - -- - -+ - lock the screen immediately - - -@@ -2108,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 3b0bc42..e4e93b5 100644 ---- a/i18n_ts/bo_CN.ts -+++ b/i18n_ts/bo_CN.ts -@@ -4,2549 +4,1927 @@ - - AuthDialog - -- More Devices -- 选择其他设备 -- -- -- Biometric -- 使用生物识别认证 -+ Retry -+ ཡང་བསྐྱར་ཚོད་ལེན། - - -- Password -- 使用密码认证 -+ Please enter your password or enroll your fingerprint -+ གསང་ཨང་མནོན་པའམ་མཛུབ་རིམ་མནོན་རོགས། - - -- -- Retry -- བསྐྱར་དུ་ཞིབ་བཤེར་བྱ་དགོས། -+ Too many unsuccessful attempts,please enter password. -+ མཛུབ་རིས་ར་སྤྲོད་ཕམ་ཉེས་ཚད་ཆེས་ཆེ་ལས་བརྒལ་བ། ཁྱོས་གསང་ཨང་བཀོལ་ནས་ཟྭ་འབྱེད་རོགས། - - -- UnLock -- 解锁 -+ Fingerprint authentication failed, you still have %1 verification opportunities -+ མཛུབ་རིས་ར་སྤྲོད་ཕམ་ཉེས་བྱུང་། ཁྱོད་ལ་ད་དུང་གོ་སྐབས་གཅིག་ཡོད། - - -- Slide to unlock -- 向上滑动解锁 -+ Password: -+ གསང་ཨང་། - - -- You have %1 unread message -- 您有%1条未读消息 -+ Biometric Authentication -+ སྐྱེ་དངོས་ངོས་འཛིན་ཀྱི་དཔང་ལེན། - - -- LoggedIn -- 已登录 -+ Other Devices -+ སྒྲིག་ཆས་གཞན་དག - - -- Password: -- 密码: -+ Password Authentication -+ གསང་ཨང་ར་སྤྲོད་གྲོས་ཆིངས། - - -- Account locked %1 minutes due to %2 fail attempts -- 账户锁定%1分钟由于%2次错误尝试 -+ 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 -- iris ཞིབ་བཤེར་བྱེད་པའམ་ཡང་ན་གསང་གྲངས་ནང་འཇུག་བྱས་ནས་ཟྭ་ -- -- -- -- Input Password -- ནང་འཇུག་གི་གསང་གྲངས། -- -- -- -- Failed to verify %1, please enter password to unlock -- %1ལ་ཞིབ་བཤེར་བྱེད་མ་ཐུབ་ན། གསང་གྲངས་ནང་འཇུག་བྱས་ནས་ཟྭ་རྒྱག་རོགས། -- -- -- -- Unable to verify %1, please enter password to unlock -- %1ལ་ཞིབ་བཤེར་བྱེད་ཐབས་བྲལ་བ་དང་། གསང་གྲངས་ནང་འཇུག་བྱས་ནས་ཟྭ་རྒྱག་རོགས། -- -- -- -- Abnormal network -- རྒྱུན་ལྡན་མིན་པའི་དྲ་ -- -- -- Use the bound wechat scanning code or enter the password to log in -- 使用绑定的微信扫码或输入密码登录 -+ - - -- -- - Password cannot be empty -- གསང་གྲངས་སྟོང་པ་ཡིན་མི་སྲིད། -+ - - -- Failed to verify %1, please enter password. -- 验证%1失败,请输入密码. -+ Password -+ - - -- Unable to verify %1, please enter password. -- 无法验证%1,请输入密码. -+ Login -+ - - -- - Failed to verify %1, you still have %2 verification opportunities -- %1ལ་ཞིབ་བཤེར་བྱེད་མ་ཐུབ་ན། ཁྱེད་ཚོར་ད་དུང་%2ལ་ཞིབ་བཤེར་བྱེད་པའི་གོ་སྐབས་ཡོད། -- -- -- Biometric/code scan authentication failed too many times, please enter the password. -- 生物/扫码验证失败达最大次数,请使用密码解锁 -- -- -- Bioauth/code scan authentication failed, you still have %1 verification opportunities -- 生物/扫码验证失败,您还有%1次尝试机会 -- -- -- NET Exception -- 网络异常 -- -- -- Password Incorrect, Please try again -- 密码错误,请重试 -- -- -- Authentication failure,there are still %1 remaining opportunities -- 认证失败,还剩%1次尝试机会 -- -- -- Please enter your password or enroll your fingerprint -- 请输入密码或者录入指纹 -- -- -- -- Authentication failure, Please try again -- བདེན་དཔང་ར་སྤྲོད་བྱེད་མ་ཐུབ་ན། ཡང་བསྐྱར་ཚོད་ལྟ་ཞིག -+ - - -- - Use the bound wechat scanning code or enter the password to unlock -- འབྲེལ་མཐུད་ཀྱི་འཕྲིན་ཕྲན་ཞིབ་བཤེར་ཨང་གྲངས་སམ་ཡང་ན་གསང་གྲངས་ནང་འཇུག་བྱས་ནས་ཟྭ་རྒྱག་པ། -- -- -- -- Password -- གསང་གྲངས། -- -- -- -- Login -- ཐོ་འགོད་བྱེད་པ། -- -- -- Biometric Authentication -- 生物识别认证 -+ - - -- Password Authentication -- 密码认证 -+ Failed to verify %1, please enter password to unlock -+ - - -- Other Devices -- 其他设备 -+ Unable to verify %1, please enter password to unlock -+ - - -- Too many unsuccessful attempts,please enter password. -- 指纹验证失败达最大次数,请使用密码登录 -+ Input Password -+ - - -- Fingerprint authentication failed, you still have %1 verification opportunities -- 指纹验证失败,您还有%1次尝试机会 -+ Abnormal network -+ - - - -- BioDevices -+ BatteryWidget - -- FingerPrint -- 指纹 -- -- -- FingerVein -- 指静脉 -- -- -- Iris -- 虹膜 -- -- -- Face -- 人脸 -- -- -- VoicePrint -- 声纹 -+ Charging... -+ - -- -- -- BioDevicesWidget - -- Please select other biometric devices -- 请选择其他生物识别设备 -+ fully charged -+ - - -- Device Type: -- 设备类型: -+ PowerMode -+ - - -- Device Name: -- 设备名称: -+ BatteryMode -+ - - - - BiometricAuthWidget - -- -- Current device: -- མིག་སྔའི་སྒྲིག་ཆས་ནི། -+ Identify failed, Please retry. -+ ངོས་འཛིན་མ་ཐུབ། ཡང་བསྐྱར་ཚོད་ལྟ་བྱོས། - - -- -- Identify failed, Please retry. -- ཕམ་ཉེས་བྱུང་བར་ངོས་འཛིན་གནང་རོགས། ཁྱེད་ཀྱིས་ཡང་བསྐྱར་ཐེངས་གཅིག་ལ -+ Current device: -+ མིག་སྔའི་སྒྲིག་ཆས་རེའུ་མིག: - - - - BiometricDevicesWidget - -- -+ OK -+ གཏན་འཁེལ་བྱེད་པ། -+ -+ - Please select the biometric device -- སྐྱེ་དངོས་དབྱེ་འབྱེད་སྒྲིག་ཆས་འདེམས་རོགས། -+ ཉིད་ཀྱིས་སྐྱེ་དངོས་སྒྲིག་ཆས་འདེམ་རོགས། - - -- - Device type: -- སྒྲིག་ཆས་ཀྱི་རིགས་དབྱིབས་ནི། -+ སྒྲིག་ཆས་ཀྱི་རིགས། - - -- - Device name: -- སྒྲིག་ཆས་ཀྱི་མིང་གཤམ་གསལ། -- -- -- -- OK -- འགྲིགས། -+ སྒྲིག་ཆས་ཀྱི་མིང་། - - - - ConfForm - -- - edit network -- རྩོམ་སྒྲིག་དྲ་བ། -+ - - -- - LAN name: -- LANཡི་མིང་ནི། -+ - - -- - Method: -- བྱེད་ཐབས་ནི། -+ - - -- - Address: -- སྡོད་གནས་ནི། -+ - - -- - Netmask: -- དྲ་རྒྱའི་མ་སི་ཁི་ཡིས་བཤད་རྒྱུར། -+ - - -- - Gateway: -- འགག་སྒོ་ནི། -+ - - -- - DNS 1: -- DNS 1: -+ - - -- - DNS 2: -- DNS 2: -+ - - -- - Edit Conn -- རྩོམ་སྒྲིག་པ། -+ - - -- -- - Auto(DHCP) -- རང་འགུལ་(DHCP) -+ - - -- -- - Manual -- ལག་དེབ། -+ - - -- - Cancel -- ཕྱིར་འཐེན། -+ - - -- - Save -- གྲོན་ཆུང་བྱེད་དགོས། -+ - - -- - Ok -- འགྲིགས། -+ - - -- - Can not create new wired network for without wired card -- སྐུད་ཡོད་བྱང་བུ་མེད་ན་སྐུད་ཡོད་དྲ་རྒྱ་གསར་པ་གཏོད་མི་ཐུབ། -+ - - -- - New network already created -- དྲ་རྒྱ་གསར་པ་གསར་སྐྲུན་བྱས་ཟིན་པ། -+ - - -- - New network settings already finished -- དྲ་རྒྱའི་སྒྲིག་བཀོད་གསར་པ་ལེགས་འགྲུབ་བྱུང་ཡོད། -- -- -- -- Edit Network -- རྩོམ་སྒྲིག་དྲ་བ། -- -- -- -- Add Wired Network -- སྐུད་ཡོད་བརྙན་འཕྲིན་དྲ་བ་ཁ་སྣོན་ -- -- -- create wired network successfully -- 已创建新的有线网络 -+ - - -- change configuration of wired network successfully -- 新的设置已经生效 -+ New settings already effective -+ - - -- -- New settings already effective -- སྒྲིག་གཞི་གསར་པར་ཕན་ནུས་ཐོན་ཡོད། -+ Edit Network -+ - - -- There is a same named LAN exsits. -- 已有同名连接存在 -+ Add Wired Network -+ - - - - DeviceType - -- -- FingerPrint -- མཛུབ་མོའི་པར་གཞི། -+ Face -+ མིའི་གདོང་། - - -- -- FingerVein -- མཛུབ་མོ་ཝེ་ལིན། -+ Iris -+ འཇའ་སྐྱི། - - -- -- Iris -- དབྱི་ལི་སི། -+ VoicePrint -+ སྒྲ་རིས། - - -- -- Face -- ངོ་གདོང་། -+ FingerPrint -+ མཛུབ་རིས། - - -- -- VoicePrint -- སྒྲ་གདངས་ཀྱི་པར་གཞི། -+ FingerVein -+ མཛུབ་མོའི་སྡོད་རྩ། - - -- - QRCode -- QRCode -+ - - - - DigitalAuthDialog - -- -- - LoginByUEdu -- LoginByUEdu -- -- -- now is authing, wait a moment -- 认证中,请稍后 -- -- -- Password Incorrect, Please try again -- 密码错误,请重试 -+ - - -- - ResetPWD? -- ཡང་བསྐྱར་བཀོད་སྒྲིག་བྱེད་དགོས་སམ། -+ - - -- -- - SetNewUEduPWD -- SetNewUeduPWD -+ -+ -+ -+ clear -+ - - -- - ConfirmNewUEduPWD -- གསར་དུ་གཏན་འཁེལ་བྱས་པའི་ནུའུ་ཝུའུ་ཏུའུ་ཕུའུ་ཝེ་ཏི། -+ - - -- - The two password entries are inconsistent, please reset -- གསང་བའི་འཇུག་སྒོ་གཉིས་གཅིག་མཐུན་མིན་པས་བསྐྱར་དུ་བཀོད་སྒྲིག་གནང་རོགས། -+ - - -- - Password entered incorrectly, please try again -- གསང་གྲངས་ནང་འཇུག་བྱས་པ་ནོར་འདུག་པས་ཡང་བསྐྱར་ཚོད་ལྟ་ཞིག་གནང་རོགས། -- -- -- -- clear -- གསལ་པོར་བཤད་ན། -+ - - - - DlgConnHidWifi - -- -+ Connect to Hidden Wi-Fi Network -+ -+ -+ - Add Hidden Wi-Fi -- སྦས་སྐུང་བྱས་པའི་Wi-Fiབསྣན་པ། -+ - - -- - Connection -- འབྲེལ་མཐུད་ -+ - - -- - Wi-Fi name -- Wi-Fiཡི་མིང་། -+ - - -- - Wi-Fi security -- Wi-Fiབདེ་འཇགས། -+ - - -- - Cancel -- ཕྱིར་འཐེན། -+ - - -- - Connect -- སྦྲེལ་མཐུད་བྱེད་པ -+ - - -- - C_reate… -- C_reate… -+ - - -- - None -- གཅིག་ཀྱང་མེད། -+ - - -- - WPA & WPA2 Personal -- WPA & WPA2 མི་སྒེར་ -- -- -- WEP 40/128-bit Key (Hex or ASCII) -- WEP 40/128 位密钥(十六进制或ASCII) -- -- -- WEP 128-bit Passphrase -- WEP 128 位密码句 -- -- -- Dynamic WEP (802.1X) -- 动态 WEP (802.1x) -- -- -- WPA & WPA2 Enterprise -- WPA 及 WPA2 企业 -- -- -- -- Connect to Hidden Wi-Fi Network -- སྦས་སྐུང་བྱས་པའི་Wi-Fiདྲ་རྒྱ་སྦྲེལ་མཐུད་བྱེད་པ། -+ - - - - DlgConnHidWifiLeap - -- - Connect to Hidden Wi-Fi Network -- སྦས་སྐུང་བྱས་པའི་Wi-Fiདྲ་རྒྱ་སྦྲེལ་མཐུད་བྱེད་པ། -+ - - -- - Add hidden Wi-Fi -- སྦས་སྐུང་བྱས་པའི་Wi-Fiབསྣན་པ། -+ - - -- - Connection -- འབྲེལ་མཐུད་ -+ - - -- - Network name -- དྲ་རྒྱའི་མིང་། -+ - - -- - Wi-Fi security -- Wi-Fiབདེ་འཇགས། -+ - - -- - Username -- སྤྱོད་མཁན་གྱི་མིང་། -+ - - -- - Password -- གསང་གྲངས། -+ - - -- - Cancel -- ཕྱིར་འཐེན། -+ - - -- - Connect -- སྦྲེལ་མཐུད་བྱེད་པ -+ - - -- - C_reate… -- C_reate… -+ - - -- - None -- གཅིག་ཀྱང་མེད། -+ - - -- - WPA & WPA2 Personal -- WPA & WPA2 མི་སྒེར་ -+ - - -- - WEP 40/128-bit Key (Hex or ASCII) -- WEP 40/128-bit Key (Hex or ASCII) -+ - - -- - WEP 128-bit Passphrase -- WEP 128-bit Passprase -+ - - -- - Dynamic WEP (802.1X) -- འགུལ་རྣམ་གྱི་WEP (802.1X) -+ - - -- - WPA & WPA2 Enterprise -- WPA & WPA2 ཁེ་ལས། -+ - - - - DlgConnHidWifiSecFast - -- - Connect to Hidden Wi-Fi Network -- སྦས་སྐུང་བྱས་པའི་Wi-Fiདྲ་རྒྱ་སྦྲེལ་མཐུད་བྱེད་པ། -+ - - -- - Add hidden Wi-Fi -- སྦས་སྐུང་བྱས་པའི་Wi-Fiབསྣན་པ། -+ - - -- - Connection -- འབྲེལ་མཐུད་ -+ - - -- - Network name -- དྲ་རྒྱའི་མིང་། -+ - - -- - Wi-Fi security -- Wi-Fiབདེ་འཇགས། -+ - - -- - Authentication -- བདེན་དཔང་ར་སྤྲོད་ -+ - - -- - Anonymous identity -- མིང་མ་བཀོད་པའི་ཐོབ་ཐང -+ - - -- - Allow automatic PAC pro_visioning -- རང་འགུལ་གྱིས་PACའགོ་pro_visioning་བྱས་ཆོག། -+ - - -- - PAC file -- PACཡིག་ཆ། -+ - - -- - Inner authentication -- ནང་ཁུལ་གྱི་བདེན་དཔང་ར་སྤྲོད། -+ - - -- - Username -- སྤྱོད་མཁན་གྱི་མིང་། -+ - - -- - Password -- གསང་གྲངས། -+ - - -- - Cancel -- ཕྱིར་འཐེན། -+ - - -- - Connect -- སྦྲེལ་མཐུད་བྱེད་པ -+ - - -- - C_reate… -- C_reate… -+ - - -- -- - None -- གཅིག་ཀྱང་མེད། -+ - - -- - WPA & WPA2 Personal -- WPA & WPA2 མི་སྒེར་ -+ - - -- - WEP 40/128-bit Key (Hex or ASCII) -- WEP 40/128-bit Key (Hex or ASCII) -+ - - -- - WEP 128-bit Passphrase -- WEP 128-bit Passprase -+ - - -- - Dynamic WEP (802.1X) -- འགུལ་རྣམ་གྱི་WEP (802.1X) -+ - - -- - WPA & WPA2 Enterprise -- WPA & WPA2 ཁེ་ལས། -+ - - -- - Tunneled TLS -- ཕུག་ལམ་གྱི་TLS -+ - - -- - Protected EAP (PEAP) -- སྲུང་སྐྱོབ་ཐོབ་པའི་EAP(PEAP) -+ - - -- - Anonymous -- མིང་མ་བཀོད་པའི་ -+ - - -- - Authenticated -- བདེན་དཔང་ར་སྤྲོད་བྱས། -+ - - -- - Both -- དེ་གཉིས་ཀ -+ - - - - DlgConnHidWifiSecLeap - -- - Connect to Hidden Wi-Fi Network -- སྦས་སྐུང་བྱས་པའི་Wi-Fiདྲ་རྒྱ་སྦྲེལ་མཐུད་བྱེད་པ། -+ - - -- - Add hidden Wi-Fi -- སྦས་སྐུང་བྱས་པའི་Wi-Fiབསྣན་པ། -+ - - -- - Connection -- འབྲེལ་མཐུད་ -+ - - -- - Network name -- དྲ་རྒྱའི་མིང་། -+ - - -- - Wi-Fi security -- Wi-Fiབདེ་འཇགས། -+ - - -- - Authentication -- བདེན་དཔང་ར་སྤྲོད་ -+ - - -- - Username -- སྤྱོད་མཁན་གྱི་མིང་། -+ - - -- - Password -- གསང་གྲངས། -+ - - -- - Cancel -- ཕྱིར་འཐེན། -+ - - -- - Connect -- སྦྲེལ་མཐུད་བྱེད་པ -+ - - -- - C_reate… -- C_reate… -+ - - -- - None -- གཅིག་ཀྱང་མེད། -+ - - -- - WPA & WPA2 Personal -- WPA & WPA2 མི་སྒེར་ -+ - - -- - WEP 40/128-bit Key (Hex or ASCII) -- WEP 40/128-bit Key (Hex or ASCII) -+ - - -- - WEP 128-bit Passphrase -- WEP 128-bit Passprase -+ - - -- - Dynamic WEP (802.1X) -- འགུལ་རྣམ་གྱི་WEP (802.1X) -+ - - -- - WPA & WPA2 Enterprise -- WPA & WPA2 ཁེ་ལས། -+ - - -- - Tunneled TLS -- ཕུག་ལམ་གྱི་TLS -+ - - -- - Protected EAP (PEAP) -- སྲུང་སྐྱོབ་ཐོབ་པའི་EAP(PEAP) -+ - - - - DlgConnHidWifiSecPeap - -- - Connect to Hidden Wi-Fi Network -- སྦས་སྐུང་བྱས་པའི་Wi-Fiདྲ་རྒྱ་སྦྲེལ་མཐུད་བྱེད་པ། -+ - - -- - Add hidden Wi-Fi -- སྦས་སྐུང་བྱས་པའི་Wi-Fiབསྣན་པ། -+ - - -- - Connection -- འབྲེལ་མཐུད་ -+ - - -- - Network name -- དྲ་རྒྱའི་མིང་། -+ - - -- - Wi-Fi security -- Wi-Fiབདེ་འཇགས། -+ - - -- - Authentication -- བདེན་དཔང་ར་སྤྲོད་ -+ - - -- - Anonymous identity -- མིང་མ་བཀོད་པའི་ཐོབ་ཐང -+ - - -- - Domain -- ཁྱབ་ཁོངས། -+ - - -- - CA certificate -- CA དཔང་ཡིག -+ - - -- - CA certificate password -- CA དཔང་ཡིག་གི་གསང་གྲངས། -+ - - -- - No CA certificate is required -- CAལག་ཁྱེར་མི་དགོས། -+ - - -- - PEAP version -- PEAPཔར་གཞི། -+ - - -- - Inner authentication -- ནང་ཁུལ་གྱི་བདེན་དཔང་ར་སྤྲོད། -+ - - -- - Username -- སྤྱོད་མཁན་གྱི་མིང་། -+ - - -- - Password -- གསང་གྲངས། -+ - - -- - Cancel -- ཕྱིར་འཐེན། -+ - - -- - Connect -- སྦྲེལ་མཐུད་བྱེད་པ -+ - - -- -- - None -- གཅིག་ཀྱང་མེད། -+ - - -- - WPA & WPA2 Personal -- WPA & WPA2 མི་སྒེར་ -+ - - -- - WEP 40/128-bit Key (Hex or ASCII) -- WEP 40/128-bit Key (Hex or ASCII) -+ - - -- - WEP 128-bit Passphrase -- WEP 128-bit Passprase -+ - - -- - Dynamic WEP (802.1X) -- འགུལ་རྣམ་གྱི་WEP (802.1X) -+ - - -- - WPA & WPA2 Enterprise -- WPA & WPA2 ཁེ་ལས། -+ - - -- - Tunneled TLS -- ཕུག་ལམ་གྱི་TLS -+ - - -- - Protected EAP (PEAP) -- སྲུང་སྐྱོབ་ཐོབ་པའི་EAP(PEAP) -+ - - -- - Choose from file -- ཡིག་ཆའི་ནང་ནས་གདམ་གསེས་ -+ - - -- - Automatic -- རང་འགུལ་གྱིས་རང་ -+ - - -- - Version 0 -- པར་གཞི་0 -+ - - -- - Version 1 -- པར་གཞི་དང་པོ། -+ - - - - DlgConnHidWifiSecPwd - -- - Connect to Hidden Wi-Fi Network -- སྦས་སྐུང་བྱས་པའི་Wi-Fiདྲ་རྒྱ་སྦྲེལ་མཐུད་བྱེད་པ། -+ - - -- - Add hidden Wi-Fi -- སྦས་སྐུང་བྱས་པའི་Wi-Fiབསྣན་པ། -+ - - -- - Connection -- འབྲེལ་མཐུད་ -+ - - -- - Network name -- དྲ་རྒྱའི་མིང་། -+ - - -- - Wi-Fi security -- Wi-Fiབདེ་འཇགས། -+ - - -- - Authentication -- བདེན་དཔང་ར་སྤྲོད་ -+ - - -- - Username -- སྤྱོད་མཁན་གྱི་མིང་། -+ - - -- - Password -- གསང་གྲངས། -+ - - -- - Cancel -- ཕྱིར་འཐེན། -+ - - -- - Connect -- སྦྲེལ་མཐུད་བྱེད་པ -+ - - -- - C_reate… -- C_reate… -+ - - -- - None -- གཅིག་ཀྱང་མེད། -+ - - -- - WPA & WPA2 Personal -- WPA & WPA2 མི་སྒེར་ -+ - - -- - WEP 40/128-bit Key (Hex or ASCII) -- WEP 40/128-bit Key (Hex or ASCII) -+ - - -- - WEP 128-bit Passphrase -- WEP 128-bit Passprase -+ - - -- - Dynamic WEP (802.1X) -- འགུལ་རྣམ་གྱི་WEP (802.1X) -+ - - -- - WPA & WPA2 Enterprise -- WPA & WPA2 ཁེ་ལས། -+ - - -- - Tunneled TLS -- ཕུག་ལམ་གྱི་TLS -+ - - -- - Protected EAP (PEAP) -- སྲུང་སྐྱོབ་ཐོབ་པའི་EAP(PEAP) -+ - - - - DlgConnHidWifiSecTls - -- - Connect to Hidden Wi-Fi Network -- སྦས་སྐུང་བྱས་པའི་Wi-Fiདྲ་རྒྱ་སྦྲེལ་མཐུད་བྱེད་པ། -+ - - -- - Add hidden Wi-Fi -- སྦས་སྐུང་བྱས་པའི་Wi-Fiབསྣན་པ། -+ - - -- - Connection -- འབྲེལ་མཐུད་ -+ - - -- - Network name -- དྲ་རྒྱའི་མིང་། -+ - - -- - Wi-Fi security -- Wi-Fiབདེ་འཇགས། -+ - - -- - Authentication -- བདེན་དཔང་ར་སྤྲོད་ -+ - - -- - Identity -- ཐོབ་ཐང་། -+ - - -- - Domain -- ཁྱབ་ཁོངས། -+ - - -- - CA certificate -- CA དཔང་ཡིག -+ - - -- - CA certificate password -- CA དཔང་ཡིག་གི་གསང་གྲངས། -+ - - -- - No CA certificate is required -- CAལག་ཁྱེར་མི་དགོས། -+ - - -- - User certificate -- སྤྱོད་མཁན་གྱི་ལག་ཁྱེར། -+ - - -- - User certificate password -- སྤྱོད་མཁན་གྱི་ལག་ཁྱེར་གྱི་གསང་ -+ - - -- - User private key -- སྤྱོད་མཁན་གྱི་སྒེར་གྱི་ལྡེ་མིག -+ - - -- - User key password -- སྤྱོད་མཁན་གྱི་ལྡེ་མིག་གི་གསང་ -+ - - -- - Cancel -- ཕྱིར་འཐེན། -+ - - -- - Connect -- སྦྲེལ་མཐུད་བྱེད་པ -+ - - -- - C_reate… -- C_reate… -+ - - -- -- -- -- - None -- གཅིག་ཀྱང་མེད། -+ - - -- - WPA & WPA2 Personal -- WPA & WPA2 མི་སྒེར་ -+ - - -- - WEP 40/128-bit Key (Hex or ASCII) -- WEP 40/128-bit Key (Hex or ASCII) -+ - - -- - WEP 128-bit Passphrase -- WEP 128-bit Passprase -+ - - -- - Dynamic WEP (802.1X) -- འགུལ་རྣམ་གྱི་WEP (802.1X) -+ - - -- - WPA & WPA2 Enterprise -- WPA & WPA2 ཁེ་ལས། -+ - - -- - Tunneled TLS -- ཕུག་ལམ་གྱི་TLS -+ - - -- - Protected EAP (PEAP) -- སྲུང་སྐྱོབ་ཐོབ་པའི་EAP(PEAP) -+ - - -- -- -- - Choose from file -- ཡིག་ཆའི་ནང་ནས་གདམ་གསེས་ -+ - - - - DlgConnHidWifiSecTunnelTLS - -- - Connect to Hidden Wi-Fi Network -- སྦས་སྐུང་བྱས་པའི་Wi-Fiདྲ་རྒྱ་སྦྲེལ་མཐུད་བྱེད་པ། -+ - - -- - Add hidden Wi-Fi -- སྦས་སྐུང་བྱས་པའི་Wi-Fiབསྣན་པ། -+ - - -- - Connection -- འབྲེལ་མཐུད་ -+ - - -- - Network name -- དྲ་རྒྱའི་མིང་། -+ - - -- - Wi-Fi security -- Wi-Fiབདེ་འཇགས། -+ - - -- - Authentication -- བདེན་དཔང་ར་སྤྲོད་ -+ - - -- - Anonymous identity -- མིང་མ་བཀོད་པའི་ཐོབ་ཐང -+ - - -- - Domain -- ཁྱབ་ཁོངས། -+ - - -- - CA certificate -- CA དཔང་ཡིག -+ - - -- - CA certificate password -- CA དཔང་ཡིག་གི་གསང་གྲངས། -+ - - -- - No CA certificate is required -- CAལག་ཁྱེར་མི་དགོས། -+ - - -- - Inner authentication -- ནང་ཁུལ་གྱི་བདེན་དཔང་ར་སྤྲོད། -+ - - -- - Username -- སྤྱོད་མཁན་གྱི་མིང་། -+ - - -- - Password -- གསང་གྲངས། -+ - - -- - Cancel -- ཕྱིར་འཐེན། -+ - - -- - Connect -- སྦྲེལ་མཐུད་བྱེད་པ -+ - - -- - C_reate… -- C_reate… -+ - - -- -- - None -- གཅིག་ཀྱང་མེད། -+ - - -- - WPA & WPA2 Personal -- WPA & WPA2 མི་སྒེར་ -+ - - -- - WEP 40/128-bit Key (Hex or ASCII) -- WEP 40/128-bit Key (Hex or ASCII) -+ - - -- - WEP 128-bit Passphrase -- WEP 128-bit Passprase -+ - - -- - Dynamic WEP (802.1X) -- འགུལ་རྣམ་གྱི་WEP (802.1X) -+ - - -- - WPA & WPA2 Enterprise -- WPA & WPA2 ཁེ་ལས། -+ - - -- - Tunneled TLS -- ཕུག་ལམ་གྱི་TLS -+ - - -- - Protected EAP (PEAP) -- སྲུང་སྐྱོབ་ཐོབ་པའི་EAP(PEAP) -+ - - -- - Choose from file -- ཡིག་ཆའི་ནང་ནས་གདམ་གསེས་ -+ - - - - DlgConnHidWifiWep - -- - Connect to Hidden Wi-Fi Network -- སྦས་སྐུང་བྱས་པའི་Wi-Fiདྲ་རྒྱ་སྦྲེལ་མཐུད་བྱེད་པ། -+ - - -- - Add hidden Wi-Fi -- སྦས་སྐུང་བྱས་པའི་Wi-Fiབསྣན་པ། -+ - - -- - Connection -- འབྲེལ་མཐུད་ -+ - - -- - Network name -- དྲ་རྒྱའི་མིང་། -+ - - -- - Wi-Fi security -- Wi-Fiབདེ་འཇགས། -+ - - -- - Key -- ལྡེ་མིག -+ - - -- - WEP index -- WEPསྟོན་གྲངས། -+ - - -- - Authentication -- བདེན་དཔང་ར་སྤྲོད་ -+ - - -- - Cancel -- ཕྱིར་འཐེན། -+ - - -- - Connect -- སྦྲེལ་མཐུད་བྱེད་པ -+ - - -- - C_reate… -- C_reate… -+ - - -- - None -- གཅིག་ཀྱང་མེད། -+ - - -- - WPA & WPA2 Personal -- WPA & WPA2 མི་སྒེར་ -+ - - -- - WEP 40/128-bit Key (Hex or ASCII) -- WEP 40/128-bit Key (Hex or ASCII) -+ - - -- - WEP 128-bit Passphrase -- WEP 128-bit Passprase -+ - - -- - Dynamic WEP (802.1X) -- འགུལ་རྣམ་གྱི་WEP (802.1X) -+ - - -- - WPA & WPA2 Enterprise -- WPA & WPA2 ཁེ་ལས། -+ - - -- - 1(default) -- 1(default) -+ - - -- - Open System -- སྒོ་འབྱེད་མ་ལག -+ - - -- - Shared Key -- མཉམ་སྤྱོད་ཀྱི་ལྡེ་མིག -+ - - - - DlgConnHidWifiWpa - -- - Connect to Hidden Wi-Fi Network -- སྦས་སྐུང་བྱས་པའི་Wi-Fiདྲ་རྒྱ་སྦྲེལ་མཐུད་བྱེད་པ། -+ - - -- - Add Hidden Wi-Fi -- སྦས་སྐུང་བྱས་པའི་Wi-Fiབསྣན་པ། -+ - - -- - Connection -- འབྲེལ་མཐུད་ -+ - - -- - Wi-Fi name -- Wi-Fiཡི་མིང་། -+ - - -- - Wi-Fi security -- Wi-Fiབདེ་འཇགས། -+ - - -- - Password -- གསང་གྲངས། -+ - - -- - Cancel -- ཕྱིར་འཐེན། -+ - - -- - Connect -- སྦྲེལ་མཐུད་བྱེད་པ -+ - - -- - C_reate… -- C_reate… -+ - - -- - None -- གཅིག་ཀྱང་མེད། -+ - - -- - WPA & WPA2 Personal -- WPA & WPA2 མི་སྒེར་ -- -- -- WEP 40/128-bit Key (Hex or ASCII) -- WEP 40/128 位密钥(十六进制或ASCII) -- -- -- WEP 128-bit Passphrase -- WEP 128 位密码句 -- -- -- Dynamic WEP (802.1X) -- 动态 WEP (802.1x) -- -- -- WPA & WPA2 Enterprise -- WPA 及 WPA2 企业 -+ - - - - DlgHotspotCreate - -- - Dialog -- གླེང་མོལ། -+ - - -- - Create Hotspot -- ཚ་བ་ཆེ་བའི་ས་ཆ་གསར་སྐྲུན་ -+ - - -- - Network name -- དྲ་རྒྱའི་མིང་། -+ - - -- - Wi-Fi security -- Wi-Fiབདེ་འཇགས། -+ - - -- - Password -- གསང་གྲངས། -+ - - -- - Cancel -- ཕྱིར་འཐེན། -+ - - -- - Ok -- འགྲིགས། -+ - - -- - None -- གཅིག་ཀྱང་མེད། -+ - - -- - WPA & WPA2 Personal -- WPA & WPA2 མི་སྒེར་ -+ - - - -- InputInfos -+ EngineDevice - -- -- Service exception... -- ཞབས་ཞུའི་དམིགས་བསལ་ ... -+ yes -+ - - -- -- Invaild parameters... -- གོ་མི་ཐུབ་པའི་གྲངས་ཀ་ ... -+ no -+ - - -- -- Unknown fault:%1 -- ཤེས་མེད་པའི་ནོར་འཛོལ། %1 -+ Yes -+ - - -- -- Recapture(60s) -- ཕྱིར་ལེན་པ།(60s) -+ No -+ - - -- -- Recapture(%1s) -- ཕྱིར་ལེན་པ།(%1s) -+ %1% available, charged -+ - - -- -- -- Get code -- ཚབ་རྟགས་ཐོབ་པ། -+ Left %1h %2m (%3%) -+ - -- -- -- KeyboardWidget - -- -- KeyboardWidget -- མཐེབ་གཞོང་Widget -+ %1% available -+ - -- -- -- KylinDBus - -- kylin network applet desktop message -- 麒麟网络工具信息提示 -+ Left %1h %2m to full -+ - -- -- -- KylinNM - -- -- kylin-nm -- kylin-nm -+ charging (%1%) -+ - - -- -- -- LAN -- ལན་ལན། -+ %1 waiting to discharge (%2%) -+ - - -- Enabel LAN List -- 其他有线网络 -+ %1 waiting to charge (%2%) -+ - - -- WiFi -- 无线网络 -+ AC adapter -+ - - -- Enabel WiFi List -- 其他无线网络 -+ Laptop battery -+ - - -- New WiFi -- 加入其他网络 -+ UPS -+ - - -- Network -- 网络 -+ Monitor -+ - - -- -- -- Advanced -- སྔོན་ཐོན་རང་བཞིན། -+ Mouse -+ - - -- Ethernet -- 有线网络 -+ Keyboard -+ - - -- Connect Hide Network -- 加入网络 -+ PDA -+ - - -- Wifi -- 无线网络 -+ Cell phone -+ - - -- Enabled -- 已开启 -+ Media player -+ - - -- Disabled -- 已关闭 -+ Tablet -+ - - -- -- HotSpot -- ཚ་བ་ཆེ་བ། -+ Computer -+ - - -- -- FlyMode -- འཕུར་སྐྱོད་འཕྲུལ་འཁོར། -+ unrecognised -+ - -+ -+ -+ InputInfos - -- Show MainWindow -- 显示网络连接界面 -+ Get code -+ - - -- -- Inactivated LAN -- འགུལ་སྐྱོད་མ་བྱས་པའི་LAN -+ Recapture(60s) -+ - - -- Inactivated WLAN -- 未激活 -+ Recapture(%1s) -+ - - -- -- Other WLAN -- WLAN གཞན་དག -+ Service exception... -+ - - -- -- -- WLAN -- སྐུད་མེད་ཅུས་ཁོངས་ཀྱི་དྲ་བ། -+ Invaild parameters... -+ - - -- -- Show KylinNM -- ཅིན་ལིན་ནའེ་མུའུ་ལ་བསྟན་དོན། -+ Unknown fault:%1 -+ - -+ -+ -+ KeyboardWidget - -- -- No wireless card detected -- སྐུད་མེད་བྱང་བུ་མ་རྙེད་པ། -+ KeyboardWidget -+ - -+ -+ -+ KylinNM - -- -- Activated LAN -- འགུལ་སྐྱོད་བྱས་པའི་LAN -+ kylin-nm -+ - - -- -- Activated WLAN -- འགུལ་སྐྱོད་བྱས་པའི་WLAN -+ No usable network in the list -+ - - -- -- -- -- -- -- Not connected -- འབྲེལ་མཐུད་མི་བྱེད་པ། -- -- -- -- -- -- -- -- -- -- -- -- Disconnected -- འབྲེལ་ཐག་ཆད་པ། -+ HotSpot -+ - - -- -- No Other Wired Network Scheme -- སྐུད་ཡོད་བརྙན་འཕྲིན་དྲ་བའི་འཆར་གཞི་གཞན་དག་མེད -+ FlyMode -+ - - -- Edit -- 编辑 -+ Advanced -+ - - -- Done -- 完成 -+ Show KylinNM -+ - - -- No wifi connected. -- 未连接任何网络 -+ No wireless card detected -+ - - -- -- No Other Wireless Network Scheme -- སྐུད་མེད་དྲ་རྒྱའི་འཆར་གཞི་གཞན་དག་མེད། -+ Not connected -+ - - -- -- Wired net is disconnected -- སྐུད་ཡོད་དྲ་རྒྱ་ཆད་པ། -+ Disconnected -+ - - -- Wi-Fi is disconnected -- 断开无线网络 -+ NetOn, -+ - - -- -- Confirm your Wi-Fi password or usable of wireless card -- ཁྱོད་ཀྱི་Wi-Fiཡི་གསང་གྲངས་སམ་ཡང་ན་སྐུད་མེད་བྱང་བུ་བཀོལ་སྤྱོད་བྱེད་ཆོག་པ་ར་སྤྲོད -- -- -- Ethernet Networks -- 其他有线网络 -- -- -- New LAN -- 新建有线网络 -- -- -- Hide WiFi -- 加入网络 -+ No Other Wired Network Scheme -+ - - -- -- No usable network in the list -- མིང་ཐོའི་ནང་དུ་སྤྱོད་གོ་ཆོད་པའི་དྲ་རྒྱ་མེད། -+ No Other Wireless Network Scheme -+ - - -- -- -- NetOn, -- དྲ་རྒྱ་དང་། -+ Wired net is disconnected -+ - - -- Wifi Networks -- 其他无线网络 -+ Conn Ethernet Success -+ - - -- None -- -+ Conn Ethernet Fail -+ - - -- keep wired network switch is on before turning on wireless switch -- 打开无线网开关前保持有线网开关打开 -+ Conn Wifi Success -+ - - -- please insert the wireless network adapter -- 请先插入无线网卡 -+ Confirm your Wi-Fi password or usable of wireless card -+ - - -- Abnormal connection exist, program will delete it -- 正在断开异常连接的网络 -+ Inactivated LAN -+ - - -- update Wi-Fi list now, click again -- 正在更新 Wi-Fi列表 请再次点击 -+ LAN -+ - - -- update Wi-Fi list now -- 正在更新 Wi-Fi列表 -+ WLAN -+ - - -- -- Conn Ethernet Success -- Conn Ethernetལེགས་འགྲུབ་བྱུང་བ། -+ Activated LAN -+ - - -- -- Conn Ethernet Fail -- ཁུང་ནེ་ཨེ་ཐེ་ནའེ་ལ་ཕམ་ཉེས་བྱུང་བ། -+ Activated WLAN -+ - - -- -- Conn Wifi Success -- ཁུང་ནེ་ཝེ་ཧྥེ་ལེགས་འགྲུབ་བྱུང་བ། -+ Other WLAN -+ - - - - LockWidget - -- -- Form -- -- -- -- - Date - དུས་ཚོད། - - -- -+ Form -+ ནས་འོང་བ། -+ -+ - Time - དུས་ཚོད། - - - Guest -- 游客 -+ མགྲོན་པོ། - - - SwitchUser -- 切换用户 -+ བཀོལ་མི་བརྗེ་བ། - - -- - Multiple users are logged in at the same time.Are you sure you want to reboot this system? -- སྤྱོད་མཁན་མང་པོ་ཞིག་དུས་གཅིག་ཏུ་ཐོ་འགོད་བྱས་པ་རེད། ཁྱོད་ཀྱིས་མ་ལག་འདི་བསྐྱར་དུ་སྒྲིག་རྒྱུ་ཡིན་ནམ། -+ - - -- - LAN -- སྐུད་ཡོད་དྲ་བ། -+ - - -- - WLAN -- སྐུད་མེད་ཅུས་ཁོངས་ཀྱི་དྲ་བ། -+ - - - - LoginOptionsWidget - -- - Login Options -- ཐོ་འགོད་ཀྱི་བསལ་འདེམས་ཀྱི་དབང་ཆ། -- -- -- Password -- 密码 -- -- -- Wechat -- 微信 -+ - - -- - Identify device removed! -- དབྱེ་འབྱེད་སྒྲིག་ཆས་མེད་པར་བཟོ་དགོས། -+ - - - - MyLineEdit - -- -- -- - Verification code -- ཞིབ་བཤེར་གྱི་ཚབ་རྟགས། -+ - - - - OneConnForm - -- - Form -- རྣམ་པ། -- -- -- -- Automatically join the network -- རང་འགུལ་གྱིས་དྲ་རྒྱའི་ནང་དུ་ཞུགས་པ། -- -- -- Input password -- 输入密码 -- -- -- Config -- 设置 -+ ནས་འོང་བ། - - -- -- -- -- - Connect -- སྦྲེལ་མཐུད་བྱེད་པ -+ - - -- - Disconnect -- འབྲེལ་ཐག་ཆད་པ། -+ - - -- - Input Password... -- ནང་འཇུག་གི་གསང་གྲངས་ -- -- -- -- Connect to Hidden Wi-Fi Network -- སྦས་སྐུང་བྱས་པའི་Wi-Fiདྲ་རྒྱ་སྦྲེལ་མཐུད་བྱེད་པ། -- -- -- -- Signal: -- བརྡ་རྟགས་ནི། -- -- -- Public -- 开放 -+ - - -- Safe -- 安全 -+ Automatically join the network -+ - - -- Rate -- 速率 -+ Connect to Hidden Wi-Fi Network -+ - - -- - None -- གཅིག་ཀྱང་མེད། -+ - - -- - WiFi Security: -- WiFiབཀོལ་སྤྱོད་བདེ་འཇགས་ནི། -+ -+ -+ -+ Signal: -+ - - -- - MAC: -- MAC: -+ - - -- - Conn Wifi Failed -- ཁུང་ནེ་ཝེ་ཧྥེ་ཕམ་སོང་། -+ - - - - OneLancForm - -- - Form -- རྣམ་པ། -- -- -- Config -- 设置 -+ ནས་འོང་བ། - - -- -- - Connect -- སྦྲེལ་མཐུད་བྱེད་པ -+ - - -- - Disconnect -- འབྲེལ་ཐག་ཆད་པ། -+ - - -- -- - No Configuration -- བཀོད་སྒྲིག་བྱས་མེད་པ། -+ - - -- - IPv4: -- IPv4: -+ - - -- - IPv6: -- IPv6: -+ - - -- - BandWidth: -- 带宽: -+ - - -- - MAC: -- MAC: -- -- -- Auto -- 自动 -+ - - - - PhoneAuthWidget - -- -- - Verification by phoneNum -- ཁ་པར་གྱི་ནུའུ་མུའུ་ཡིས་ཞིབ་བཤེར་བྱས། -+ - - -- - 「 Use bound Phone number to verification 」 -- 「ས་མཚམས་ཀྱི་ཁ་པར་ཨང་གྲངས་ལ་བརྟེན་ནས་ཞིབ་བཤེར་བྱ་དགོས།」 -- -- -- -- 「 Use SMS to verification 」 -- 「SMSབཀོལ་ནས་ཞིབ་བཤེར་བྱ་དགོས།」 -+ - - -- -- - commit -- བསྒྲུབ་རྒྱུ་ཁས་ལེན་ -+ - - -- -- -- Network not connected~ -- དྲ་རྒྱ་དང་འབྲེལ་མཐུད་མི་བྱེད་པ -+ 「 Use SMS to verification 」 -+ - - -- -- Network unavailable~ -- དྲ་རྒྱ་སྤྱོད་མི་ཐུབ་པ~ -+ Network not connected~ -+ - - -- - Verification Code invalid! -- ཞིབ་བཤེར་ཚད་གཞི་གོ་མི་ཆོད་པ་རེད། -+ - - -- - Verification Code incorrect.Please retry! -- ཞིབ་བཤེར་ཚད་གཞི་ཡང་དག་མིན་པ། ཁྱེད་ཀྱིས་ཡང་བསྐྱར་ཐེངས་གཅིག་ལ་བསྐྱར་དུ་ཞིབ -+ - - -- - Failed time over limit!Retry after 1 hour! -- ཚད་ལས་བརྒལ་ནས་ཕམ་ཁ་བྱུང་བའི་དུས་ཚོད་ ཆུ་ཚོད་1འགོར་རྗེས་ཡང་བསྐྱར་ཞིབ་བཤེར་བྱ་དགོས། -+ - - -- - verifaction failed! -- ངོ་རྒོལ་བྱེད་པའི་བྱ་སྤྱོད་ལ་ཕམ་ཉེས་བྱུང་བ་རེད། -+ -+ -+ -+ Network unavailable~ -+ - - - - PowerManager - -- -- lock -- ཟྭ་རྒྱག་པ། -- -- -- SwitchUser -- 切换用户 -- -- -- logout -- 注销 -+ Sleep -+ མལ་གསོ། - - -- reboot -- 重启 -+ Log Out -+ རྩིས་ཐེམ་ནས་བསུབ་པ། - - -- shutdown -- 关机 -+ Lock Screen -+ བརྙན་ཡོལ་ཟྭ་རྒྱག།(_L) - - -- Lock Screen -- 锁屏 -+ Restart -+ བསྐྱར་སློང་། - - - Switch User -- 切换用户 -+ སྤྱོད་མཁན་བརྗེ་རེས། - - -- -- Log Out -- ཕྱིར་འཐེན་བྱ་དགོས། -+ Suspend -+ འགེལ་འཇོག - - -- Restart -- ཡང་བསྐྱར་འགོ་འཛུགས་ -+ Power Off -+ འཁོར་ཁ་རྒྱག་པ། - - -- -- -- Reboot -+ lock - - - -- -- Power Off -- གློག་ཆད་པ། -+ Reboot -+ - - -- - Shut Down -- ལས་མཚམས་འཇོག -+ - - -- - Hibernate -- ཧིན་རྡུ་ཉི་ཞི་ཡ། -+ - -+ -+ -+ QObject - -- -- Suspend -- གནས་སྐབས་མཚམས་འཇོག་ -+ The screensaver is inactive. -+ འཆར་ངོས་སྲུང་སྐྱོབ་བྱ་རིམ་སད་མི་འདུག - - -- Sleep -- 休眠 -+ The screensaver is active. -+ འཆར་ངོས་སྲུང་སྐྱོབ་བྱ་རིམ་སད་འདུག - - - -- QObject -+ S: - -- -- The screensaver is active. -- བརྙན་ཤེལ་འདི་འགུལ་སྐྱོད་བྱེད་བཞིན་ཡོད། -+ -+ this is only shown for laptops with multiple batteries -+ - - -- -- The screensaver is inactive. -- བརྙན་ཤེལ་འདི་ལ་ནུས་པ་མེད། -+ -+ this is only shown for laptops with multiple batteries -+ - -- -- -- Screensaver - -- exit(Esc) -- 退出(Esc) -+ -+ laptop primary battery -+ - - -- exit -- 退出 -+ -+ battery-backed AC power source -+ - - -- -- Picture does not exist -- རི་མོ་མི་གནས་པ། -+ -+ a monitor is a device to measure voltage and current -+ - - -- Set as desktop wallpaper -- 设置为桌面壁纸 -+ -+ wireless mice with internal batteries -+ -+ -+ -+ -+ wireless keyboard with internal battery -+ -+ -+ -+ -+ portable device -+ -+ -+ -+ -+ cell phone (mobile...) -+ -+ -+ -+ -+ media player, mp3 etc -+ -+ -+ -+ -+ tablet device -+ -+ -+ -+ -+ tablet device -+ - -+ -+ -+ Screensaver - - Automatic switching -- 自动切换 -+ རང་འགུལ་བརྗེ་སྤོར། - - -- You have %1 unread message -- 您有%1条未读消息 -+ Picture does not exist -+ པར་རིས་མི་འདུག - - -- -- You have new notification -- ཁྱེད་ཚོར་བརྡ་ཐོ་གསར་པ་ཡོད། -+ Set as desktop wallpaper -+ ཅོག་ངོས་ཀྱི་གདོང་ཤོག་ཏུ་འཇོག་པ། - - -- - View -- ལྟ་ཚུལ། -+ -+ -+ -+ You have new notification -+ - - - - SleepTime - -- -- You have rested -- ཁྱེད་ཚོས་ངལ་གསོ་བྱས་ཟིན་པ་གཤམ་གསལ། -+ You have rested: -+ ཁྱེད་ཀྱིས་ ལ་ངལ་གསོས་ཟིན། - - -- You have rested: -- ཁྱེད་ཚོས་ངལ་གསོ་བྱས་ཟིན་པ་གཤམ་གསལ། -+ You have rested -+ - - - - SureWindow - -- - Form -- རྣམ་པ། -+ ནས་འོང་བ། - - -- - TextLabel -- ཡི་གེ་ལ་པེར་གྱིས་བཤད་རྒྱུར -+ - - -- - Cancel -- ཕྱིར་འཐེན། -+ - - -- - Confirm -- གཏན་འཁེལ་བྱ་དགོས། -- -- -- Multiple users are logged in at the same time.Are you sure you want to reboot this system? -- 同时有多个用户登录系统,您确定要退出系统吗? -- -- -- -- The following program is running to prevent the system from suspend! -- གཤམ་གྱི་གོ་རིམ་ནི་མ་ལག་གནས་སྐབས་མཚམས་འཇོག་པར་བཀག་འགོག་བྱེད་པའི་ཆེད་དུ་ཡིན། -+ - - -- -- The following program is running to prevent the system from hibernate! -- གཤམ་གྱི་གོ་རིམ་ནི་མ་ལག་ལ་བཀག་འགོག་བྱེད་པའི་ཆེད་དུ་ཡིན། -+ 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 reboot! -- གཤམ་གྱི་གོ་རིམ་ནི་མ་ལག་བསྐྱར་དུ་འབྱུང་བར་སྔོན་འགོག་བྱེད་ཆེད་ཡིན། -- -- -- -- SwitchButton -- -- login by password -- 密码登录 -+ The following program is running to prevent the system from suspend! -+ - - -- login by qr code -- 微信登录 -+ The following program is running to prevent the system from hibernate! -+ - - - - SwitchButtonGroup - -- - uEduPWD -- uEduPWD -+ - - -- - Wechat -- འཕྲིན་ཕྲན། -+ - - - - TabletLockWidget - -- You have %1 unread message -- 您有%1条未读消息 -+ Cancel -+ -+ -+ -+ Back -+ - - -- Slide to unlock -- 向上滑动解锁 -+ Skip -+ - - -- - New password is the same as old -- གསང་གྲངས་གསར་པ་དང་རྙིང་པ་གཅིག་མཚུངས་ཡིན། -+ - - -- - Reset password error:%1 -- གསང་གྲངས་ཀྱི་ནོར་འཁྲུལ་བསྐྱར་དུ་བཀོད་སྒྲིག་བྱེད་པ།%1 -+ - - -- - Please scan by correct WeChat -- ཡང་དག་པའི་འཕྲིན་ཕྲན་ཐོག་ནས་ཞིབ་བཤེར་གནང་རོགས། -- -- -- -- -- -- -- -- -- Cancel -- ཕྱིར་འཐེན། -- -- -- -- -- Back -- ཕྱིར་ལོག་པ། -- -- -- -- Skip -- བྲོས་བྱོལ་དུ་སོང་བ། -+ - - - - Utils - -- - kylin network applet desktop message -- kylinདྲ་རྒྱའི་ཀུ་ཤུའི་ཅོག་ཙེའི་ཆ་འཕྲིན། -+ - - - - VerificationWidget - -- - Please scan by bound WeChat -- འཕྲིན་ཕྲན་གྱིས་ཞིབ་བཤེར་བྱེད་རོགས། -+ - - - - VerticalVerificationWidget - -- - Please scan by bound WeChat -- འཕྲིན་ཕྲན་གྱིས་ཞིབ་བཤེར་བྱེད་རོགས། -+ - - - - WeChatAuthDialog - -- -- - Login by wechat -- ཝེ་ཆི་ཐེས་ཐོ་འགོད་བྱས་པ། -+ - - -- -- -- Verification by wechat -- ཝེ་ཆི་ཐེས་ཞིབ་བཤེར་བྱས་པ། -+ 「 Use registered WeChat account to login 」 -+ - - -- -- -- 「 Use registered WeChat account to login 」 -- 「ཐོ་འགོད་བྱས་ཟིན་པའི་སྐད་འཕྲིན་གྱི་ཐོ་ཁོངས་ལ་བརྟེན་ནས་ཐོ་འགོད་བྱེད་པ།」 -+ Verification by wechat -+ - - -- -- - 「 Use bound WeChat account to verification 」 -- 「ཚོད་འཛིན་རང་བཞིན་གྱི་སྐད་འཕྲིན་ཨང་གྲངས་ལ་བརྟེན་ནས་ཞིབ་བཤེར་བྱ་དགོས།」 -+ - - -- -- - Network not connected~ -- དྲ་རྒྱ་དང་འབྲེལ་མཐུད་མི་བྱེད་པ -+ - - -- - Scan code successfully -- ཞིབ་བཤེར་ཨང་གྲངས་ལེགས་འགྲུབ་བྱུང་བ། -+ - - -- - Timeout!Try again! -- དུས་ཚོད་ཕྱིར་འགོར་སོང་། ཡང་བསྐྱར་ཚོད་ལྟ།! -+ - -+ -+ -+ Widget - -- Login failed -- 登录失败 -+ Widget -+ -+ -+ -+ LoadPlugin -+ - - - - main - -- - Start command for the ukui ScreenSaver. -- ukui ScreenSaver ལ་བཀོད་འདོམས་བྱེད་འགོ་ཚུགས། -+ ཡོལ་སྒོའི་ཁ་འབྱེད་བཀའ་བརྡ། - - -- -- -- - lock the screen immediately -- འཕྲལ་དུ་བརྙན་ཤེལ་ལ་ཟྭ་རྒྱག་པ། -+ མྱུར་དུ་འཆར་ངོས་ཀྱི་ཟྭ་རྒྱག་པ། - - -- - query the status of the screen saver -- བརྙན་ཤེལ་གསོག་འཇོག་བྱེད་མཁན་གྱི་གནས་ཚུལ་ལ་འདྲི་རྩད་བྱས། -+ འཆར་ངོས་ལ་ཟྭ་བརྒྱབ་པའི་གནས་ཚུལ་ལེན་པ། - - -- - unlock the screen saver -- བརྙན་ཤེལ་གསོག་འཇོག་བྱེད་མཁན་ལ་སྒོ་འབྱེད་ -+ འཆར་ངོས་ཀྱི་ཟྭ་ཕྱེ་བ། - - -- -- show the screensaver -- བརྙན་ཤེལ་གྱི་བརྙན་ཤེལ་ལ་བལྟ་རུ་འཇུག་དགོས། -+ Screensaver for ukui-screensaver -+ - - -- -- Dialog for the ukui ScreenSaver. -- དབྱིན་ཇིའི་བརྙན་ཤེལ་གྱི་བརྙན་ཤེལ་ལ་ཁ་པར་རྒྱག་པའི་གླེང་མོལ། -+ show on root window -+ - - -- -- activated by session idle signal -- སྐབས་འདིའི་ཁོམ་པའི་བརྡ་རྟགས་ཀྱིས་སྐུལ་སློང་བྱས་པ། -+ show on window. -+ - - -- -- -- lock the screen and show screensaver immediately -- བརྙན་ཤེལ་ལ་ཟྭ་བརྒྱབ་ནས་འཕྲལ་མར་བརྙན་ཤེལ་གྱི་བརྙན་ཤེལ་སྟོན་པ། -+ window id -+ - - -- -- show screensaver immediately -- འཕྲལ་མར་བརྙན་ཤེལ་གྱི་བརྙན་ཤེལ་སྟོན་པ། -+ show the screensaver -+ - - -- -- Screensaver for ukui-screensaver -- དབྱིན་ཇིའི་བརྙན་ཤེལ་གྱི་བརྙན་ཤེལ་ལ་ལྟ་ཞིབ་བྱེད་མཁན། -+ Dialog for the ukui ScreenSaver. -+ - - -- -- show on root window -- རྩ་བའི་སྒེའུ་ཁུང་ནས་མངོན་པ། -+ activated by session idle signal -+ - - -- -- show on window. -- སྒེའུ་ཁུང་ནས་མངོན་པ། -+ lock the screen and show screensaver immediately -+ - - -- -- window id -- སྒེའུ་ཁུང་གི་ཐོབ་ཐང་ -+ show screensaver immediately -+ - - - -diff --git a/i18n_ts/es.ts b/i18n_ts/es.ts -index 57d0867..d117fe0 100644 ---- a/i18n_ts/es.ts -+++ b/i18n_ts/es.ts -@@ -108,6 +108,25 @@ - - - -+ -+ 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 - -@@ -1559,15 +1673,15 @@ - - - -- Shut Down -+ Reboot - - - -- Hibernate -+ Shut Down - - - -- Reboot -+ Hibernate - - - -@@ -1582,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 - -@@ -1729,6 +1906,17 @@ - - - -+ -+ Widget -+ -+ Widget -+ -+ -+ -+ LoadPlugin -+ -+ -+ - - main - -diff --git a/i18n_ts/fr.ts b/i18n_ts/fr.ts -index 437fd21..679e732 100644 ---- a/i18n_ts/fr.ts -+++ b/i18n_ts/fr.ts -@@ -108,6 +108,25 @@ - - - -+ -+ 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 - -@@ -1559,15 +1673,15 @@ - - - -- Shut Down -+ Reboot - - - -- Hibernate -+ Shut Down - - - -- Reboot -+ Hibernate - - - -@@ -1582,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 - -@@ -1729,6 +1906,17 @@ - - - -+ -+ Widget -+ -+ Widget -+ -+ -+ -+ LoadPlugin -+ -+ -+ - - main - -diff --git a/i18n_ts/pt.ts b/i18n_ts/pt.ts -index 1e49e91..c9077d7 100644 ---- a/i18n_ts/pt.ts -+++ b/i18n_ts/pt.ts -@@ -108,6 +108,25 @@ - - - -+ -+ 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 - -@@ -1559,15 +1673,15 @@ - - - -- Shut Down -+ Reboot - - - -- Hibernate -+ Shut Down - - - -- Reboot -+ Hibernate - - - -@@ -1582,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 - -@@ -1729,6 +1906,17 @@ - - - -+ -+ Widget -+ -+ Widget -+ -+ -+ -+ LoadPlugin -+ -+ -+ - - main - -diff --git a/i18n_ts/ru.ts b/i18n_ts/ru.ts -index 84dd7fc..82e351f 100644 ---- a/i18n_ts/ru.ts -+++ b/i18n_ts/ru.ts -@@ -108,6 +108,25 @@ - - - -+ -+ 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 - -@@ -1559,15 +1673,15 @@ - - - -- Shut Down -+ Reboot - - - -- Hibernate -+ Shut Down - - - -- Reboot -+ Hibernate - - - -@@ -1582,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 - -@@ -1729,6 +1906,17 @@ - - - -+ -+ Widget -+ -+ Widget -+ -+ -+ -+ LoadPlugin -+ -+ -+ - - main - -diff --git a/i18n_ts/tr.ts b/i18n_ts/tr.ts -index cc6562f..f08d2ff 100644 ---- a/i18n_ts/tr.ts -+++ b/i18n_ts/tr.ts -@@ -16,7 +16,7 @@ - Parola - - -- -+ - Retry - Yeniden Dene - -@@ -41,102 +41,102 @@ - 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 - - - -- -+ - Abnormal network - - -@@ -153,6 +153,29 @@ - Diğer Ayıtlar - - -+ -+ BatteryWidget -+ -+ -+ Charging... -+ -+ -+ -+ -+ fully charged -+ -+ -+ -+ -+ PowerMode -+ -+ -+ -+ -+ BatteryMode -+ -+ -+ - - BioDevices - -@@ -1506,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 - -@@ -1623,7 +1764,7 @@ - - - -- -+ - Not connected - - -@@ -1636,7 +1777,7 @@ - - - -- -+ - Disconnected - - -@@ -1662,22 +1803,22 @@ - - - -- -+ - Conn Ethernet Success - - - -- -+ - Conn Ethernet Fail - - - -- -+ - Conn Wifi Success - - - -- -+ - Confirm your Wi-Fi password or usable of wireless card - - -@@ -1708,17 +1849,17 @@ - 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 - - -@@ -1726,7 +1867,7 @@ - - LoginOptionsWidget - -- -+ - Login Options - - -@@ -1735,7 +1876,7 @@ - Parola - - -- -+ - Identify device removed! - - -@@ -1915,7 +2056,7 @@ - - PowerManager - -- -+ - lock - kilit - -@@ -1944,7 +2085,7 @@ - Kullanıcı Değiştir - - -- -+ - Log Out - Çıkış - -@@ -1953,28 +2094,28 @@ - Yeniden Başlat - - -- -- -+ -+ - Reboot - - - -- -+ - Power Off - Bilgisayarı Kapat - - -- -+ - Shut Down - - - -- -+ - Hibernate - - - -- -+ - Suspend - - -@@ -1992,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 - -@@ -2003,17 +2219,17 @@ - çıkış - - -- -+ - Picture does not exist - - - -- -+ - View - - - -- -+ - You have new notification - - -@@ -2093,38 +2309,38 @@ - - TabletLockWidget - -- -- -- -- -- -- -+ -+ -+ -+ -+ -+ - Cancel - - - -- -- -+ -+ - Back - - - -- -+ - Skip - - - -- -+ - New password is the same as old - - - -- -+ - Reset password error:%1 - - - -- -+ - Please scan by correct WeChat - - -@@ -2196,6 +2412,19 @@ - - - -+ -+ Widget -+ -+ -+ Widget -+ -+ -+ -+ -+ LoadPlugin -+ -+ -+ - - main - -@@ -2205,8 +2434,8 @@ - - - -- - -+ - lock the screen immediately - Ekranı hemen kilitle - -@@ -2226,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 4c27468..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次尝试机会 - -@@ -161,22 +161,22 @@ - 请输入密码或者录入指纹 - - -- -+ - Authentication failure, Please try again - 认证失败,请重试 - - -- -+ - Use the bound wechat scanning code or enter the password to unlock - 使用绑定的微信扫码或输入密码解锁 - - -- -+ - Password - 密码 - - -- -+ - Login - 登录 - -@@ -204,24 +204,22 @@ - - BatteryWidget - -- -- -+ - BatteryMode - 电池模式 - - -- -- -+ - PowerMode - 电源模式 - - -- -+ - Charging... - 正在充电... - - -- -+ - fully charged - 已充满电 - -@@ -1916,7 +1914,7 @@ - - - -- -+ - Not connected - 未连接任何网络 - -@@ -1929,7 +1927,7 @@ - - - -- -+ - Disconnected - 未连接 - -@@ -1965,7 +1963,7 @@ - 断开无线网络 - - -- -+ - Confirm your Wi-Fi password or usable of wireless card - 请确认Wi-Fi密码或无线设备 - -@@ -2021,17 +2019,17 @@ - 正在更新 Wi-Fi列表 - - -- -+ - Conn Ethernet Success - 连接有线网络成功 - - -- -+ - Conn Ethernet Fail - 连接有线网络失败 - - -- -+ - Conn Wifi Success - 连接无线网络成功 - -@@ -2062,17 +2060,17 @@ - 切换用户 - - -- -+ - Multiple users are logged in at the same time.Are you sure you want to reboot this system? - 同时有多个用户登录系统,您确定要退出系统吗? - - -- -+ - LAN - 有线网络 - - -- -+ - WLAN - 无线局域网 - -@@ -2080,7 +2078,7 @@ - - LoginOptionsWidget - -- -+ - Login Options - 登录选项 - -@@ -2093,7 +2091,7 @@ - 微信 - - -- -+ - Identify device removed! - 校验设备已移除! - -@@ -2301,7 +2299,7 @@ - - PowerManager - -- -+ - lock - 锁定 - -@@ -2330,37 +2328,37 @@ - 切换用户 - - -- -+ - Log Out - 注销 - - -- - Restart -- 重启 -+ 重启 - - -- -+ -+ - Reboot - 重启 - - -- -+ - Power Off - 关机 - - -- -+ - Shut Down - 关机 - - -- -+ - Hibernate - 休眠 - - -- -+ - Suspend - 睡眠 - -@@ -2387,7 +2385,7 @@ - - - -- this is only shown for laptops with multiple batteries -+ tablet device - - - -@@ -2402,7 +2400,7 @@ - 退出 - - -- -+ - Picture does not exist - 图片不存在 - -@@ -2419,12 +2417,12 @@ - 您有%1条未读消息 - - -- -+ - You have new notification - 您有新的消息 - - -- -+ - View - 预览 - -@@ -2523,38 +2521,38 @@ - 向上滑动解锁 - - -- -+ - New password is the same as old - 新密码与原密码相同 - - -- -+ - Reset password error:%1 - 重置密码失败:%1 - - -- -+ - Please scan by correct WeChat - 请使用正确的微信扫码 - - -- -- -- -- -- -- -+ -+ -+ -+ -+ -+ - Cancel - 取消 - - -- -- -+ -+ - Back - 返回 - - -- -+ - Skip - 跳过 - -@@ -2630,6 +2628,19 @@ - 登录失败 - - -+ -+ Widget -+ -+ -+ Widget -+ -+ -+ -+ -+ LoadPlugin -+ -+ -+ - - main - -@@ -2639,8 +2650,8 @@ - - - -- - -+ - lock the screen immediately - 马上锁定屏幕 - -@@ -2660,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/scconfiguration.cpp b/screensaver/scconfiguration.cpp -index a348df4..09af22d 100644 ---- a/screensaver/scconfiguration.cpp -+++ b/screensaver/scconfiguration.cpp -@@ -135,7 +135,7 @@ QString SCConfiguration::getDefaultBackground() - if(ispicture(backgroundFile)) - return backgroundFile; - else -- return "/usr/share/backgrounds/1-warty-final-ubuntukylin.jpg"; -+ return "/usr/share/backgrounds/1-openkylin.jpg"; - } - - int SCConfiguration::getTimeType() -diff --git a/screensaver/screensaver.cpp b/screensaver/screensaver.cpp -index b67a12e..5c06727 100644 ---- a/screensaver/screensaver.cpp -+++ b/screensaver/screensaver.cpp -@@ -531,25 +531,6 @@ void Screensaver::resizeEvent(QResizeEvent */*event*/) - flag = 1; - #ifndef USE_INTEL - if(myTextWidget){ -- --// QColor highLightColor = palette().color(QPalette::Base); --// QString stringColor = QString("rgba(%1,%2,%3,82%)") --// .arg(highLightColor.red()) --// .arg(highLightColor.green()) --// .arg(highLightColor.blue()); --// QColor textColor = palette().color(QPalette::Text); --// QString textString = QString("rgb(%1,%2,%3)") --// .arg(textColor.red()) --// .arg(textColor.green()) --// .arg(textColor.blue()); --// QColor borderColor = palette().color(QPalette::BrightText); --// QString borderString = QString("rgba(%1,%2,%3,85%)") --// .arg(borderColor.red()) --// .arg(borderColor.green()) --// .arg(borderColor.blue()); -- --// myTextLabel->setStyleSheet(QString("font-size:5px;border-radius: 2px;background: %1;color: %2;padding: 4px 8px 4px 8px;border-width: 1px;border-style: solid;border-color:%3;") \ --// .arg(stringColor).arg(textString).arg(borderString)); - if(curStyle == "ukui-dark" || curStyle == "ukui-black"){ - myTextLabel->setStyleSheet(QString("QLabel{font-size:5px;border-radius: 2px;padding: 4px 8px 4px 8px;border-width: 1px;\ - background: rgba(0, 0, 0, %1); color:#FFFFFF; border-radius:16px}").arg(blur_Num * 0.01)); -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 60c0226..684f2ec 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -28,6 +28,7 @@ include_directories( - ${GLIB_INCLUDE_DIRS} - ${MMIX_INCLUDE_DIRS} - ${kylin-nm-base_INCLUDE_DIRS} -+ ${KF5Wayland_LIBRARIES} - ) - - set(EXTRA_LIBS -@@ -39,9 +40,13 @@ set(EXTRA_LIBS - ${QGS_LIBRARIES} - ${GLIB_LIBRARIES} - ${MMIX_LIBRARIES} -+ ${KF5Wayland_LIBRARIES} - -lrt - -lpthread -+ -lKF5WaylandServer -+ -lKF5WaylandClient - -llibnm-icon-kylin -+ -lukuiinputgatherclient - ) - - qt5_wrap_ui(dialog_SRC -@@ -65,7 +70,6 @@ qt5_wrap_cpp(dialog_SRC - screensaverwidget.h - auth.h - auth-pam.h -- authpamthread.h - screensavermode.h - screensaverwndadaptor.h - xeventmonitor.h -@@ -97,6 +101,7 @@ qt5_wrap_cpp(dialog_SRC - lockchecker.h - servicemanager.h - mytabwidget.h -+ plasma-shell-manager.h - PhysicalDeviceSet/brightnessdeviceset.h - PhysicalDeviceSet/flightmodeset.h - PhysicalDeviceSet/sounddeviceset.h -@@ -104,6 +109,7 @@ qt5_wrap_cpp(dialog_SRC - device.h - enginedevice.h - batterywidget.h -+ libinputswitchevent.h - ) - - set(dialog_SRC -@@ -116,7 +122,6 @@ set(dialog_SRC - loginoptionswidget.cpp - screensaverwidget.cpp - auth-pam.cpp -- authpamthread.cpp - xeventmonitor.cpp - monitorwatcher.cpp - grab-x11.cpp -@@ -148,6 +153,7 @@ set(dialog_SRC - lockchecker.cpp - servicemanager.cpp - mytabwidget.cpp -+ plasma-shell-manager.cpp - PhysicalDeviceSet/brightnessdeviceset.cpp - PhysicalDeviceSet/flightmodeset.cpp - PhysicalDeviceSet/sounddeviceset.cpp -@@ -155,6 +161,7 @@ set(dialog_SRC - device.cpp - enginedevice.cpp - batterywidget.cpp -+ libinputswitchevent.cpp - ) - add_executable(ukui-screensaver-dialog ${dialog_SRC}) - add_definitions(-DAPP_API_MAJOR=0 -DAPP_API_MINOR=11 -DAPP_API_FUNC=0) -diff --git a/src/assets.qrc b/src/assets.qrc -index 6059541..870f62f 100644 ---- a/src/assets.qrc -+++ b/src/assets.qrc -@@ -5,9 +5,7 @@ - - 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 ---- a/src/assets/hibernate.png -+++ /dev/null -@@ -1,8 +0,0 @@ --PNG -- -- IHDR00W pHYs  ~8IDAThYq0 s#hx@ A@v&77@)xAJLrH97C/ؕ,)mF~@ ש@gvXXDf|]A]!b[l%"=! " --px^ --k v3mk  ݦYd2fvA|.I9=@9OawZzsHoÃ\ͫKH J/QgYHiU|q[UuK8. #|&"'zi)Oe-(3*Ƚz[Oljfr!*v --*ާ:ތo{ Ldm6t['ߟ --b0t2:bx2)tB8?+2 Ј}WG79DsP*{x18MMEgZT4VIPbf`+-Ie4Z4Xh)PAX*$:(l=R^'g5x --rP9|p5ET;fs*C~fqMDLDn$ 'wa͸Oa*\<$8uoE$Wt!EχȚI7#o(=J~)7J{:玩F UzI(pgL7 ?~-h"vlm͜WQMIENDB` -\ No newline at end of file -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 ---- a/src/assets/keyboard.png -+++ /dev/null -@@ -1,4 +0,0 @@ --PNG -- -- IHDR;0rIDATHK \WFPUC͈)Y#",~۪W4Gݚ (O꼪a~& --{gSتUȮn~U-c%vKae ]0(hIENDB` -\ No newline at end of file -diff --git a/src/assets/powerManager.png b/src/assets/powerManager.png -deleted file mode 100644 -index 73089ad..0000000 ---- a/src/assets/powerManager.png -+++ /dev/null -@@ -1,5 +0,0 @@ --PNG -- -- IHDR;0IDATHAJAEkO f&Bv+/ 1Ⅲ'KN4+u#&?&M3ӍCV)( --*{fK6/L6g<(.ylPEѣGԎ-?Yi3s#>z#c --]hxU%ǡ.8<6NyTp@Oc}g\0pY-'|%QKi&&R"-@)5Sx] bZǗa'eD*"+"2*ij}GQTɼY) k6qDz36qD6 |ø["x6@=@.)̐KۡZty-@7XA@=t%\יXO g5v1k,-BoMYeG}io6)j1or)JIENDB` -\ No newline at end of file -diff --git a/src/assets/reboot.png b/src/assets/reboot.png -deleted file mode 100644 -index 5365f79..0000000 ---- a/src/assets/reboot.png -+++ /dev/null -@@ -1,11 +0,0 @@ --PNG -- -- IHDR::J(IDAThMEuլ,F/ "PFqQ/&,!``zɋ=G$E0Kƈ( Yl6~]3=3==2/tUOWMou} 4@uPAR k{;M Z --`8 ~>9Μ[d%Vlk'G-H6*p`e,e^ < tt"9`^; nGylMlf{Q'2VHT^}'ȐZ:;{Z-}ҝ0o!@oڋ&7B7Z}):f~ --)MCv/3IY'o$C/CKarEU굑ikk+z*17-6XguͶLo ~f]%y}诶ujޙˁ$%{AѼ5QϮ݂[ --HZaSZ[msQIKv*>Q3 輎vr --` wBw --͘Gu񼻵;/3bi׼5k(=:.RF̓sjz<͛ǮAHs_嬤Fa]yZqM8j:t] Pzҙjv},PWvd5{6,ݴMLProf#&27.=^mlPWV[}̤ UwP5lmY_XS="wR>ΤQcv1nwfRܶEvTROYLG&:]MU4V쥱^i,vw0ױ --'=4@U*/juYIENDB` -\ No newline at end of file -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 ---- a/src/assets/shutdown.png -+++ /dev/null -@@ -1,12 +0,0 @@ --PNG -- -- IHDR::J(LIDAThZMh]E=תmZ?HhK[(n,ZAugn --YIƭ[qEc) .jkB]ԦҀ.zwyށ;NftAe$w~|| Uk+̟6$˖j'U1?<!I\!9>GH"YX 9Ҡ~=Bv(*<:@GYO?MBm%yƩ{V CrNI#ڈjV'IvxՋ86TpeZ; -+tn1BYk\FQ %jo8m%Qt r1\1.cijΉ'ng6>RVZwlWIbB(ka(Hj2\ }f] קBB-L-꼑UXŧBBo`@| xwq˲lBhDG俍("cq3b =m9_̇mLKY --X[}C#: ?T --X!}\|Yw --ڋiEkx/fY :\Zn#kWjDRr;$tZ~=4Ǡ* --r?ɿFB_+ {0wR,iQ!˲MFj" xB'\AuD G:HaQJOw2RGu.WK穯srfZiŭ&;P+$r8j2͓ --8Q!4Y /* [ --|"m$5[Fc NK --%_-ƗADQgdФZ*eGrQXBfg"eB˙][zYڠ3|y5S$46P(|X/j)fF.=XT#YBc]z4760]T/hWGc;Z}[M;{ H"Q[>C޵kfvfuR巕h --WjqhATʛ^AIENDB` -\ No newline at end of file -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 ---- a/src/assets/suspend.png -+++ /dev/null -@@ -1,8 +0,0 @@ --PNG -- -- IHDR00W pHYs  ~IDAThYq0 { #lPFH'(otǛ &(6H7;r*$w%dY1kD"Oxݨ ` --]o4OH"+(B7@čx-@/ b|s-*OBF˄a> b+[ 3]·p,v}d>+:>E XA ---`P 8KReSnvi>jg^Q --yҧC1]&w#iP {,y4Ɣs+pG+*{QpBno"h.`9gY{O?"y]~"!.ܥODڌU/}9`P ^(읦F˄{c["!kMHi<|OJ&V%+h_E <-Hb{]ر_*KI -- vQ7,wvň% Y$gQhq#c̯J ZR8Lw6_Ry1Uy~xpvӻlY1^eKv ZQ+G3+ e3׍0KɮOxcYG+:vѽX3;سң)={fL+ --൒&-1T[Zp.y=x4cG-ֲ}.-b2o(og}OIENDB` -\ No newline at end of file -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 ---- a/src/assets/switchUser.png -+++ /dev/null -@@ -1,3 +0,0 @@ --PNG -- -- IHDR;0oIDATH햽N0ؚR+e` 12P) OإOQ1vb):fBNJ }qe\槢HVs'@L(|^г]Í&+Zg(̵TtP141.4(kK#SLĸԠa^ClIlR떼-+bu):wx{:rhRc^=Z07NpMsfTcFxcsӮ&st>9=M`Je+Ʊs?]w!M0]+qcv Wyhsɝ;dރZZwDDQW^IENDB` -\ No newline at end of file -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/auth-pam.cpp b/src/auth-pam.cpp -index c83a2a0..aa01e1c 100644 ---- a/src/auth-pam.cpp -+++ b/src/auth-pam.cpp -@@ -36,6 +36,7 @@ static int pam_conversation(int msgLength, const struct pam_message **msg, - void sigchld_handler(int signo); - AuthPAM::AuthPAM(QObject *parent) - : Auth(parent), -+ pid(0), - nPrompts(0), - _isAuthenticated(false), - _isAuthenticating(false) -@@ -49,33 +50,54 @@ void AuthPAM::authenticate(const QString &userName) - - if(pipe(toParent) || pipe(toChild)) - qDebug()<< "create pipe failed: " << strerror(errno); -- m_authPamThread = new AuthPamThread(); -- m_authPamThread->startAuthPam(toChild[0], toParent[1], userName); -- _isAuthenticating = true; -- notifier = new QSocketNotifier(toParent[0], QSocketNotifier::Read); -- connect(notifier, &QSocketNotifier::activated, this, &AuthPAM::onSockRead); -+ if((pid = fork()) < 0) -+ { -+ qDebug() << "fork error: " << strerror(errno); -+ } -+ else if(pid == 0) -+ { -+ prctl(PR_SET_PDEATHSIG, SIGHUP); -+ close(toParent[0]); -+ close(toChild[1]); -+ int arg1_int = toParent[1]; -+ int arg2_int = toChild[0]; -+ char arg1[128]; -+ char arg2[128]; -+ sprintf(arg1,"%d",arg1_int); -+ sprintf(arg2,"%d",arg2_int); -+ execlp ("ukui-screensaver-checkpass", -+ "ukui-screensaver-checkpass", -+ arg1, arg2,userName.toLocal8Bit().data(), NULL); -+ _exit (EXIT_FAILURE); -+ } -+ else -+ { -+ close(toParent[1]); -+ close(toChild[0]); -+ _isAuthenticating = true; -+ notifier = new QSocketNotifier(toParent[0], QSocketNotifier::Read); -+ connect(notifier, &QSocketNotifier::activated, this, &AuthPAM::onSockRead); -+ } - } - - void AuthPAM::stopAuth() - { -- if (m_authPamThread) { -+ if(pid != 0) -+ { - messageList.clear(); - responseList.clear(); - _isAuthenticating = false; - _isAuthenticated = false; - nPrompts = 0; -+ ::kill(pid, SIGKILL); -+ -+ close(toParent[0]); -+ close(toChild[1]); - if(notifier){ -- disconnect(notifier, &QSocketNotifier::activated, this, &AuthPAM::onSockRead); -- delete notifier; -+ notifier->deleteLater(); - notifier = nullptr; - } -- close(toParent[1]); -- close(toChild[1]); -- m_authPamThread->stopAuthPam(); -- delete m_authPamThread; -- m_authPamThread = nullptr; -- close(toParent[0]); -- close(toChild[0]); -+ pid = 0; - } - } - -diff --git a/src/auth-pam.h b/src/auth-pam.h -index 2499442..3fba36c 100644 ---- a/src/auth-pam.h -+++ b/src/auth-pam.h -@@ -22,7 +22,6 @@ - #include - - #include --#include "authpamthread.h" - - typedef struct pam_message PAM_MESSAGE; - typedef struct pam_response PAM_RESPONSE; -@@ -48,7 +47,7 @@ private Q_SLOTS: - - private: - QString userName; -- AuthPamThread *m_authPamThread = nullptr; -+ pid_t pid; - QSocketNotifier *notifier; - int nPrompts; - QStringList responseList; -diff --git a/src/authdialog.cpp b/src/authdialog.cpp -index 309e0cd..11bd9a0 100644 ---- a/src/authdialog.cpp -+++ b/src/authdialog.cpp -@@ -37,6 +37,7 @@ - #include "commonfunc.h" - #include "loginoptionswidget.h" - #include "servicemanager.h" -+#include "uniauthservice.h" - #include "imageutil.h" - - AuthDialog::AuthDialog(const UserItem &user, QWidget *parent) : -@@ -399,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(); -@@ -587,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; - } -@@ -720,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); - -@@ -756,6 +778,7 @@ void AuthDialog::onMessageButtonClicked() - else - { - m_messageButton->hide(); -+ is_showMessageBtn = false; - authMode = PASSWORD; - - m_messageLabel->setText(""); -@@ -763,6 +786,11 @@ void AuthDialog::onMessageButtonClicked() - } - } - -+bool AuthDialog::getLineeditStatus() -+{ -+ return is_showMessageBtn; -+} -+ - void AuthDialog::onRespond(const QString &text) - { - if (!prompted && text != BIOMETRIC_SUCCESS) { -diff --git a/src/authdialog.h b/src/authdialog.h -index 4ce6348..6225de0 100644 ---- a/src/authdialog.h -+++ b/src/authdialog.h -@@ -30,7 +30,6 @@ - #include "users.h" - #include "biometricdeviceinfo.h" - #include "pam-tally.h" --#include "uniauthservice.h" - - namespace Ui { - class AuthDialog; -@@ -45,6 +44,7 @@ class BiometricAuthWidget; - class BiometricDevicesWidget; - class PamTally; - class LoginOptionsWidget; -+class UniAuthService; - - enum FOCUS { - REMOVE = 0, -@@ -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(); -@@ -124,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; -@@ -156,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/authpamthread.cpp b/src/authpamthread.cpp -deleted file mode 100644 -index 4dabca7..0000000 ---- a/src/authpamthread.cpp -+++ /dev/null -@@ -1,201 +0,0 @@ --#include "authpamthread.h" -- --#include --#include --#include --#include --#include --#include --#include -- --#define PAM_SERVICE_NAME "ukui-screensaver-qt" -- --static void writeData(int fd, const void *buf, ssize_t count); --static void writeString(int fd, const char *data); --static int readData(int fd, void *buf, size_t count); --static char * readString(int fd); --static int pam_conversation(int msgLength, const struct pam_message **msg, -- struct pam_response **resp, void *appData); -- --AuthPamThread::AuthPamThread(QObject* parent) -- : QThread(parent) --{ --} -- --AuthPamThread::~AuthPamThread() --{ -- --} -- --void AuthPamThread::writeData(int fd, const void *buf, ssize_t count) --{ -- if (!m_isAuthenticating) { -- return; -- } -- if(write(fd, buf, count) != count) -- qDebug() << "write to parent failed: " << strerror(errno); --} -- --void AuthPamThread::writeString(int fd, const char *data) --{ -- int length = data ? strlen(data) : -1; -- writeData(fd, &length, sizeof(length)); -- if(data) -- writeData(fd, data, sizeof(char) * length); --} -- --int AuthPamThread::readData(int fd, void *buf, size_t count) --{ -- ssize_t nRead = 0; -- while(true) { -- nRead = read(fd, buf, count); -- if (!m_isAuthenticating) { -- break; -- } -- if (nRead < 0) { -- if (errno == EAGAIN) { -- usleep(100*1000); -- continue; -- } else { -- qDebug() << "read data failed: " << strerror(errno) << errno; -- } -- } -- break; -- } -- return nRead; --} -- --char* AuthPamThread::readString(int fd) --{ -- int length; -- -- if(readData(fd, &length, sizeof(length)) <= 0) -- return NULL; -- if(length <= 0) -- length = 0; -- -- char *value = (char *)malloc(sizeof(char) * (length + 1)); -- readData(fd, value, length); -- -- value[length] = '\0'; -- -- return value; --} -- --static int --pam_conversation(int msgLength, const struct pam_message **msg, -- struct pam_response **resp, void *appData) --{ -- struct pam_response *response = (struct pam_response*)calloc(msgLength,sizeof(struct pam_response)); -- AuthPamThread* pData = (AuthPamThread*)appData; -- if (!pData || pData->m_fdRead < 0 || pData->m_fdWrite < 0) { -- return PAM_CONV_ERR; -- } -- -- int authComplete = 0; -- pData->writeData(pData->m_fdWrite, (const void*)&authComplete, sizeof(authComplete)); -- pData->writeData(pData->m_fdWrite, (const void*)&msgLength, sizeof(msgLength)); -- //发送pam消息 -- for(int i = 0; i < msgLength; i++) -- { -- const struct pam_message *m = msg[i]; -- pData->writeData(pData->m_fdWrite, (const void *)&m->msg_style, sizeof(m->msg_style)); -- pData->writeString(pData->m_fdWrite, m->msg); -- } -- //读取响应 -- for(int i = 0; i < msgLength; i++) -- { -- struct pam_response *r = &response[i]; -- if (pData->readData(pData->m_fdRead, &r->resp_retcode, sizeof(r->resp_retcode)) < 0) { -- break; -- } -- r->resp = pData->readString(pData->m_fdRead); -- } -- *resp = response; -- return PAM_SUCCESS; --} -- --void AuthPamThread::_authenticate(const char *userName) --{ -- qDebug() << "authenticate " << userName; -- -- pam_handle_t *pamh = NULL; -- char *newUser = NULL; -- int ret; -- int authRet; -- struct pam_conv conv; -- -- conv.conv = pam_conversation; -- conv.appdata_ptr = this; -- -- ret = pam_start(PAM_SERVICE_NAME, userName, &conv, &pamh); -- if(ret != PAM_SUCCESS) { -- qDebug() << "failed to start PAM: " << pam_strerror(NULL, ret); -- } -- -- authRet = pam_authenticate(pamh, 0); -- -- ret = pam_get_item(pamh, PAM_USER, (const void **)&newUser); -- if(ret != PAM_SUCCESS) { -- pam_end(pamh, 0); -- qDebug() << "failed to get username"; -- } -- -- if(authRet == PAM_SUCCESS) { -- /*检测账户有效性,即使密码认证通过,如果账户锁定或无效,也无法解锁*/ -- authRet = pam_acct_mgmt(pamh, 0); -- } -- -- if(authRet != PAM_SUCCESS) { -- qDebug() << "failed to acct mgmt " << pam_strerror(NULL, authRet); -- } -- -- if (newUser) { -- free(newUser); -- newUser = NULL; -- } -- fprintf(stderr, "authentication result: %d\n", authRet); -- -- // 发送认证结果 -- int authComplete = 1; -- writeData(m_fdWrite, (const void*)&authComplete, sizeof(authComplete)); -- writeData(m_fdWrite, (const void *)&authRet, sizeof(authRet)); -- qDebug() << "--- 认证完成"; --} -- --void AuthPamThread::startAuthPam(int fdRead, int fdWrite, QString strUserName) --{ -- if (!isRunning()) { -- qDebug()<<"startAuthPam ----"; -- m_isAuthenticating = true; -- int nFlags = fcntl(fdRead, F_GETFL); -- nFlags = nFlags | O_NONBLOCK; -- fcntl(fdRead, F_SETFL, nFlags); -- m_fdRead = fdRead; -- m_fdWrite = fdWrite; -- m_strUserName = strUserName; -- start(); -- } else { -- qDebug()<<"AuthPamThread is running!!"; -- } --} -- --void AuthPamThread::run() --{ -- if (m_fdRead >=0 && m_fdWrite >= 0 && !m_strUserName.isEmpty()) { -- _authenticate(m_strUserName.toLocal8Bit().data()); -- } else { -- qDebug()<<"AuthPamThread param error:"< -- --class AuthPamThread : public QThread --{ -- Q_OBJECT --public: -- AuthPamThread(QObject* parent = nullptr); -- virtual ~AuthPamThread(); -- void startAuthPam(int fdRead, int fdWrite, QString strUserName); -- void stopAuthPam(); -- -- void writeData(int fd, const void *buf, ssize_t count); -- void writeString(int fd, const char *data); -- int readData(int fd, void *buf, size_t count); -- char *readString(int fd); -- --protected: -- void run(); -- --private: -- void _authenticate(const char *userName); -- --public: -- int m_fdRead = -1; -- int m_fdWrite = -1; -- QString m_strUserName = ""; -- --private: -- bool m_isAuthenticating = false; --}; -- --#endif // AUTHPAMTHREAD_H -diff --git a/src/batterywidget.cpp b/src/batterywidget.cpp -index 76387c7..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); -diff --git a/src/configuration.cpp b/src/configuration.cpp -index fa5a9e8..264cdd9 100644 ---- a/src/configuration.cpp -+++ b/src/configuration.cpp -@@ -20,6 +20,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -205,7 +206,7 @@ QString Configuration::getBackground() - if(ispicture(background)) - return background; - -- return "/usr/share/backgrounds/1-warty-final-ubuntukylin.jpg"; -+ return "/usr/share/backgrounds/1-openkylin.jpg"; - } - - bool Configuration::lockWhenXScreensaverActivated() -diff --git a/src/fullbackgroundwidget.cpp b/src/fullbackgroundwidget.cpp -index 52efbe6..b77fdbb 100644 ---- a/src/fullbackgroundwidget.cpp -+++ b/src/fullbackgroundwidget.cpp -@@ -32,6 +32,7 @@ - #include - #include - #include -+#include "plasma-shell-manager.h" - #include - #include "lockwidget.h" - #include -@@ -210,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", -@@ -306,8 +307,8 @@ void FullBackgroundWidget::laterActivate() - raiseOtherWnd(); - setFocus(); - if(lockWidget && lockWidget->isVisible()) { -- //lockWidget->setFocus(); -- lockWidget->onActiveWindpw();//将焦点设置到密码框 -+ lockWidget->setFocus(); -+ lockWidget->onActiveLineedit();//将焦点设置到密码框 - } - update(); - } -@@ -318,8 +319,8 @@ void FullBackgroundWidget::laterOtherActivate() - raiseOtherWnd(); - //setFocus(); - if(lockWidget && lockWidget->isVisible()) { -- //lockWidget->setFocus(); -- lockWidget->onActiveWindpw();//将焦点设置到密码框 -+ lockWidget->setFocus(); -+ lockWidget->onActiveLineedit();//将焦点设置到密码框 - } - } - -@@ -341,9 +342,20 @@ void FullBackgroundWidget::setLockState() - - bool FullBackgroundWidget::eventFilter(QObject *obj, QEvent *event) - { -+ 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") { -+ PlasmaShellManager::getInstance()->setAppWindowKeepAbove(true); -+ } -+ - QTimer::singleShot(500,this,SLOT(setLockState())); - QTimer::singleShot(200,this,SLOT(killWindow())); - } -@@ -441,8 +453,11 @@ void FullBackgroundWidget::closeEvent(QCloseEvent *event) - if(widget) - widget->close(); - } -- closeGrab(); -- -+ -+ if(QX11Info::isPlatformX11()){ -+ closeGrab(); -+ } -+ - return QWidget::closeEvent(event); - } - -@@ -546,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接口获取了 -@@ -611,18 +626,26 @@ void FullBackgroundWidget::mousePressEvent(QMouseEvent *e) - void FullBackgroundWidget::init() - { - /*捕获键盘,如果捕获失败,则可能是由于弹出菜单项已经捕获,那么模拟一次esc按键来退出菜单,如果仍捕获失败,则放弃锁屏,避免密码无法输入*/ -- if(establishGrab()) -- qDebug()<<"establishGrab : true"; -- else { -- qDebug()<<"establishGrab : false"; -- XTestFakeKeyEvent(QX11Info::display(), XKeysymToKeycode(QX11Info::display(),XK_Escape), True, 1); -- XTestFakeKeyEvent(QX11Info::display(), XKeysymToKeycode(QX11Info::display(),XK_Escape), False, 1); -- XFlush(QX11Info::display()); -- sleep(1); -- if(!establishGrab()) -- { -- exit(1); -+ if(QX11Info::isPlatformX11()){ -+ if(establishGrab()) -+ qDebug()<<"establishGrab : true"; -+ else { -+ qDebug()<<"establishGrab : false"; -+ XTestFakeKeyEvent(QX11Info::display(), XKeysymToKeycode(QX11Info::display(),XK_Escape), True, 1); -+ XTestFakeKeyEvent(QX11Info::display(), XKeysymToKeycode(QX11Info::display(),XK_Escape), False, 1); -+ XFlush(QX11Info::display()); -+ sleep(1); -+ if(!establishGrab()) -+ { -+ exit(1); -+ } - } -+ -+ XWindowAttributes rootAttr; -+ XGetWindowAttributes(QX11Info::display(), QX11Info::appRootWindow(), &rootAttr); -+ XSelectInput( QX11Info::display(), QX11Info::appRootWindow(), -+ SubstructureNotifyMask|rootAttr.your_event_mask ); -+ - } - - qDebug()<<"----------------------------------------------------------------开始异步调用"; -@@ -631,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()){ -@@ -639,17 +662,16 @@ void FullBackgroundWidget::init() - } - }); - -- setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint -+ if(QX11Info::isPlatformX11()){ -+ setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint - | Qt::X11BypassWindowManagerHint); -+ }else{ -+ setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint); -+ } - - /*x100下会出现黑色小方块问题,设置此属性时正常*/ - setAttribute(Qt::WA_TranslucentBackground); - -- XWindowAttributes rootAttr; -- XGetWindowAttributes(QX11Info::display(), QX11Info::appRootWindow(), &rootAttr); -- XSelectInput( QX11Info::display(), QX11Info::appRootWindow(), -- SubstructureNotifyMask|rootAttr.your_event_mask ); -- - // 监听session信号 - // smInterface = new QDBusInterface(SM_DBUS_SERVICE, - // SM_DBUS_PATH, -@@ -657,10 +679,6 @@ void FullBackgroundWidget::init() - // QDBusConnection::sessionBus()); - // connect(smInterface, SIGNAL(StatusChanged(uint)), - // this, SLOT(onSessionStatusChanged(uint))); --// connect(xEventMonitor, SIGNAL(buttonDrag(int, int)), --// this, SLOT(onGlobalButtonDrag(int, int))); --// connect(xEventMonitor, SIGNAL(buttonPress(int, int)), --// this, SLOT(onGlobalButtonPressed(int, int))); - - // int totalWidth = 0; - // int totalHeight = 0; -@@ -672,9 +690,7 @@ void FullBackgroundWidget::init() - // setGeometry(0, 0, totalWidth, totalHeight); - QDesktopWidget *desktop = QApplication::desktop(); - setGeometry(desktop->geometry()); -- --// xEventMonitor->start(); -- -+ - #ifdef USE_INTEL - SoundDeviceSet::instance(); - #endif -@@ -686,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 -@@ -703,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() -@@ -761,7 +793,9 @@ void FullBackgroundWidget::showLockWidget() - } - onCursorMoved(QCursor::pos()); - lockWidget->setFocus(); -- XSetInputFocus(QX11Info::display(),this->winId(),RevertToParent,CurrentTime); -+ if(QX11Info::isPlatformX11() ){ -+ XSetInputFocus(QX11Info::display(),this->winId(),RevertToParent,CurrentTime); -+ } - activateWindow(); - repaint(); - } -@@ -1049,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; -@@ -1060,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 -diff --git a/src/iconedit.cpp b/src/iconedit.cpp -index c708076..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); -@@ -119,10 +121,14 @@ bool IconEdit::eventFilter(QObject *obj, QEvent *event) - } - if(event->type() == 23) - { -- //XSetInputFocus(QX11Info::display(),this->winId(),RevertToParent,CurrentTime); -+ if(QX11Info::isPlatformX11()){ -+ //XSetInputFocus(QX11Info::display(),this->winId(),RevertToParent,CurrentTime); -+ } - update(); - }else if(event->type() == QEvent::MouseButtonPress){ -- //XSetInputFocus(QX11Info::display(),this->winId(),RevertToParent,CurrentTime); -+ if(QX11Info::isPlatformX11()){ -+ //XSetInputFocus(QX11Info::display(),this->winId(),RevertToParent,CurrentTime); -+ } - update(); - } - } -@@ -171,8 +177,10 @@ void IconEdit::resizeEvent(QResizeEvent *) - - void IconEdit::setX11Focus() - { -- //XSetInputFocus(QX11Info::display(),this->winId(),RevertToParent,CurrentTime); -- update(); -+ if(QX11Info::isPlatformX11()){ -+ //XSetInputFocus(QX11Info::display(),this->winId(),RevertToParent,CurrentTime); -+ } -+ update(); - } - - void IconEdit::setFocusin(int target) -@@ -180,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 c16a672..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() -@@ -124,6 +127,14 @@ 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 264468f..1f02d85 100644 ---- a/src/lockwidget.cpp -+++ b/src/lockwidget.cpp -@@ -85,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); - -@@ -99,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() -@@ -126,8 +131,22 @@ bool LockWidget::eventFilter(QObject *obj, QEvent *event) - if(obj == mkylinNM) - return true; - -- if(obj == ui->btnPowerManager || obj == ui->btnSwitchUser || obj == 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); -@@ -152,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 ){ -@@ -277,6 +295,20 @@ void LockWidget::key_tab_release(int key) - authDialog->setFocusin(IN_LIGIN); - tabAt = ENTERBTN; - 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: - if(authDialog->getBioNum() >1) { - authDialog->setFocusin(BIO_RIGHT); -@@ -284,7 +316,6 @@ void LockWidget::key_tab_release(int key) - } else { - tabAt = BOTTMBTN; - authDialog->setFocusin(REMOVE); -- qDebug() << " is_batteryBtn = " << is_batteryBtn; - if(is_batteryBtn){ - horAT = BATTERYBTN; - } else if(users->getUsers().count() > 1){ -@@ -293,13 +324,11 @@ void LockWidget::key_tab_release(int key) - horAT =NETWORKBTN; - } - setBottomBtnSheet(); -- qDebug() << " horat = " << horAT; - } - break; - case BIOBTN: - tabAt = BOTTMBTN; - authDialog->setFocusin(REMOVE); -- qDebug() << " is_batteryBtn = " << is_batteryBtn; - if(is_batteryBtn) { - horAT = BATTERYBTN; - setBottomBtnSheet(); -@@ -310,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); -@@ -364,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; -@@ -375,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; -@@ -426,7 +479,11 @@ void LockWidget::key_LR_release(int key) - horAT = NETWORKBTN; - break; - case NETWORKBTN: -- horAT = KEYBOARDBTN; -+ if (ui->btnKeyboard->isHidden()) { -+ horAT = POWERBTN; -+ } else { -+ horAT = KEYBOARDBTN; -+ } - break; - case KEYBOARDBTN: - horAT = POWERBTN; -@@ -474,7 +531,11 @@ void LockWidget::key_LR_release(int key) - horAT = NETWORKBTN; - break; - case POWERBTN: -- horAT = KEYBOARDBTN; -+ if (ui->btnKeyboard->isHidden()) { -+ horAT = NETWORKBTN; -+ } else { -+ horAT = KEYBOARDBTN; -+ } - break; - default: - break; -@@ -699,6 +760,8 @@ void LockWidget::initUI() - 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 -@@ -717,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); -@@ -751,26 +814,33 @@ void LockWidget::initUI() - this->setCursor(Qt::ArrowCursor); - }); - -- //虚拟键盘 -- ui->btnKeyboard->setIcon(QIcon(":/image/assets/keyboard.svg")); -- ui->btnKeyboard->setFixedSize(48, 48); -- ui->btnKeyboard->setIconSize(QSize(24, 24)); -- ui->btnKeyboard->setFocusPolicy(Qt::NoFocus); -- ui->btnKeyboard->installEventFilter(this); -+ if(QX11Info::isPlatformX11()){ -+ //虚拟键盘 -+ ui->btnKeyboard->setIcon(QIcon(":/image/assets/keyboard.svg")); -+ ui->btnKeyboard->setFixedSize(48, 48); -+ ui->btnKeyboard->setIconSize(QSize(24, 24)); -+ ui->btnKeyboard->setFocusPolicy(Qt::NoFocus); -+ ui->btnKeyboard->installEventFilter(this); -+ - /* connect(ui->btnKeyboard, &QPushButton::clicked, - this, [&]{ - qDebug() << vKeyboard->isHidden(); - vKeyboard->setVisible(vKeyboard->isHidden()); - }); - */ -- connect(ui->btnKeyboard, &QPushButton::clicked, -- this, &LockWidget::showVirtualKeyboard); -+ -+ -+ 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); -@@ -780,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, -@@ -801,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(); - } -@@ -821,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()) -@@ -872,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; -@@ -1039,7 +1150,7 @@ void LockWidget::showNetManager(bool keynavigation) - 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(); -@@ -1048,11 +1159,13 @@ void LockWidget::showNetManager(bool keynavigation) - * 这里只调用m_kylinNM->raise()仍会有问题,需要再调用一次authDialog->lower()才行,原因未知*/ - if(authDialog && authDialog->isVisible()){ - authDialog->lower(); -+ authDialog->clearFocus(); - } -- authDialog->clearFocus(); -- if(mBatteryWidget && mBatteryWidget->isVisible()) -+ -+ if(mBatteryWidget && mBatteryWidget->isVisible()) { - mBatteryWidget->lower(); -- mBatteryWidget->clearFocus(); -+ mBatteryWidget->clearFocus(); -+ } - at_plugins = true; - - //m_kylinNM->updateWifiList(); -@@ -1079,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); - } - } - -@@ -1108,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); - -@@ -1118,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(); - } - -@@ -1250,6 +1383,8 @@ void LockWidget::loadNetPlugin() - QWidget *widget = pluginInstance->pluginUi(); - mkylinNM->addTab(widget,""); - -+ // 平板模式输入状态下自动调出虚拟键盘 -+ connect(pluginInstance, SIGNAL(needShowVirtualKeyboard()), this, SLOT(netInPutStatus())); - } else { - qDebug() << "Load Failed: " << wlanloader.errorString() << "\n"; - return; -@@ -1277,7 +1412,7 @@ void LockWidget::loadNetPlugin() - mkylinNM->widget(1)->setPalette(pal); - - m_kylinNM->setGeometry(this->width() - mkylinNM->width() - 20, -- this->height() - mkylinNM->height() - 100, -+ this->height() - mkylinNM->height() - 72 - 8, - mkylinNM->width(), - mkylinNM->height()); - -@@ -1421,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); - } - - } -@@ -1445,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()); - } - } -@@ -1467,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) -@@ -1482,8 +1620,10 @@ void LockWidget::resizeEvent(QResizeEvent *event) - x = x + ui->btnPowerManager->width(); - ui->btnPowerManager->move(width() - x,height() - y); - -- x = x+ui->btnKeyboard->width()+16; -- ui->btnKeyboard->move(width() - x, height() - y); -+ if(!ui->btnKeyboard->isHidden()){ -+ x = x+ui->btnKeyboard->width()+16; -+ ui->btnKeyboard->move(width() - x, height() - y); -+ } - - x = x + btnNetworkManager->width()+16; - btnNetworkManager->move(width() - x, height() - y); -@@ -1513,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()); - } -@@ -1535,7 +1675,9 @@ void LockWidget::resizeEvent(QResizeEvent *event) - powermanager->width(),powermanager->height()); - - } --// XSetInputFocus(QX11Info::display(),this->winId(),RevertToParent,CurrentTime); -+ if(QX11Info::isPlatformX11()){ -+ // XSetInputFocus(QX11Info::display(),this->winId(),RevertToParent,CurrentTime); -+ } - } - - -@@ -1704,27 +1846,67 @@ 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(); - } - - QString LockWidget::getBatteryIconName() -diff --git a/src/lockwidget.h b/src/lockwidget.h -index 08030b4..59ab6ea 100644 ---- a/src/lockwidget.h -+++ b/src/lockwidget.h -@@ -32,6 +32,7 @@ - #include "lockchecker.h" - #include "xeventmonitor.h" - #include "batterywidget.h" -+#include "libinputswitchevent.h" - - namespace Ui { - class LockWidget; -@@ -64,6 +65,7 @@ enum TABAT { - BIOBTN, - BOTTMBTN, - POWERMANAGER, -+ MESSAGEBTN, - }; - - enum HORIZONBTN { -@@ -87,8 +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(); -@@ -106,7 +109,6 @@ private: - 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 loadNetPlugin(); - void setBottomBtnSheet(); -@@ -116,6 +118,7 @@ private Q_SLOTS: - 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); -@@ -130,6 +133,7 @@ private Q_SLOTS: - void resetNavigation(); - void setBatteryIcon(QString str); - void dealMessage(QDBusMessage); -+ void onShowMessageBtn(bool is_show); - - protected: - bool eventFilter(QObject *obj, QEvent *event); -@@ -174,6 +178,11 @@ private: - QDBusInterface *batInterface = nullptr; - QDBusInterface *iface = nullptr; - QDBusInterface *dface = nullptr; -+ -+ -+ // 监听键盘插拔 -+ LibinputSwitchEvent *libswitch = nullptr; -+ bool isTableMode = false; - }; - - #endif // LOCKWIDGET_H -diff --git a/src/plasma-shell-manager.cpp b/src/plasma-shell-manager.cpp -new file mode 100644 -index 0000000..1ad8234 ---- /dev/null -+++ b/src/plasma-shell-manager.cpp -@@ -0,0 +1,170 @@ -+#include "plasma-shell-manager.h" -+ -+#include -+ -+#include -+#include -+ -+#include -+#include -+#include -+ -+static PlasmaShellManager* global_instance = nullptr; -+ -+PlasmaShellManager *PlasmaShellManager::getInstance() -+{ -+ if (!global_instance) -+ { -+ global_instance = new PlasmaShellManager; -+ qDebug() << "Here create instance..."; -+ } -+ qDebug() << "Return instance"; -+ return global_instance; -+} -+ -+bool PlasmaShellManager::setAppWindowActive() -+{ -+ if (!supportPlasmaWindowManagement()) -+ return false; -+ -+ m_appWindow->requestActivate(); -+ return true; -+} -+ -+bool PlasmaShellManager::setAppWindowKeepAbove(bool keep) -+{ -+ if (!supportPlasmaWindowManagement()) -+ { -+ qDebug() << "false"; -+ return false; -+ } -+ if(keep != m_appWindow->isKeepAbove()) { -+ qDebug() << "to keep above"; -+ m_appWindow->requestToggleKeepAbove(); -+ } -+ return true; -+} -+ -+bool PlasmaShellManager::setMaximized(QWindow *window) -+{ -+ if (!supportShell()) -+ return false; -+ -+ auto surface = KWayland::Client::Surface::fromWindow(window); -+ if (!surface) -+ return false; -+ -+ auto shellSurface = m_shell->createSurface(surface, window); -+ if (!shellSurface) -+ return false; -+ -+ shellSurface->setMaximized(); -+ return true; -+} -+ -+bool PlasmaShellManager::setRole(QWindow *window, KWayland::Client::PlasmaShellSurface::Role role) -+{ -+ if (!supportPlasmaShell()) -+ return false; -+ -+ auto surface = KWayland::Client::Surface::fromWindow(window); -+ if (!surface) -+ return false; -+ -+ auto plasmaShellSurface = m_plasmaShell->createSurface(surface, window); -+ if (!plasmaShellSurface) -+ return false; -+ -+ plasmaShellSurface->setRole(role); -+ return true; -+} -+ -+bool PlasmaShellManager::setPos(QWindow *window, const QPoint &pos) -+{ -+ if (!supportPlasmaShell()) -+ return false; -+ -+ auto surface = KWayland::Client::Surface::fromWindow(window); -+ if (!surface) -+ return false; -+ -+ auto plasmaShellSurface = m_plasmaShell->createSurface(surface, window); -+ if (!plasmaShellSurface) -+ return false; -+ -+ plasmaShellSurface->setPosition(pos); -+ return true; -+} -+ -+bool PlasmaShellManager::supportPlasmaShell() -+{ -+ return m_plasmaShell; -+} -+ -+bool PlasmaShellManager::supportShell() -+{ -+ return m_shell; -+} -+ -+bool PlasmaShellManager::supportPlasmaWindowManagement() -+{ -+ return m_windowManager && m_appWindow; -+} -+ -+PlasmaShellManager::PlasmaShellManager(QObject *parent) : QObject(parent) -+{ -+ auto connection = KWayland::Client::ConnectionThread::fromApplication(qApp); -+ auto registry = new KWayland::Client::Registry(this); -+ registry->create(connection->display()); -+ -+ connect(registry, &KWayland::Client::Registry::plasmaShellAnnounced, this, [=](){ -+ qDebug() << "plasmaShellAnnounced..."; -+ const auto interface = registry->interface(KWayland::Client::Registry::Interface::PlasmaShell); -+ if (interface.name != 0) { -+ qDebug() << "createPlasmaShell..."; -+ m_plasmaShell = registry->createPlasmaShell(interface.name, interface.version, this); -+ } -+ }); -+ -+ connect(registry, &KWayland::Client::Registry::plasmaWindowManagementAnnounced, this, [=](){ -+ qDebug() << "plasmaWindowManagementAnnounced"; -+ const auto interface = registry->interface(KWayland::Client::Registry::Interface::PlasmaWindowManagement); -+ if (interface.name != 0) { -+ qDebug() << "createPlasmaWindowManagement"; -+ m_windowManager = registry->createPlasmaWindowManagement(interface.name, interface.version, this); -+ } -+ if(m_windowManager) { -+ connect(m_windowManager, &KWayland::Client::PlasmaWindowManagement::windowCreated, -+ [this](KWayland::Client::PlasmaWindow *window) { -+ qDebug()<< "PlasmaWindow..."; -+ if (window->pid() == getpid()) { -+ if(isFirstCreate) { -+ isFirstCreate = false; -+ m_appWindow = window; -+ -+ connect(m_appWindow, &KWayland::Client::PlasmaWindow::activeChanged, -+ [this]() { -+ this->setAppWindowKeepAbove(true); -+ this->setAppWindowActive(); -+ }); -+ connect(m_appWindow, &KWayland::Client::PlasmaWindow::keepAboveChanged, -+ [this]() { -+ this->setAppWindowKeepAbove(true); -+ this->setAppWindowActive(); -+ }); -+ } -+ } -+ }); -+ } -+ }); -+ -+ connect(registry, &KWayland::Client::Registry::shellAnnounced, this, [=](){ -+ const auto interface = registry->interface(KWayland::Client::Registry::Interface::Shell); -+ if (interface.name != 0) { -+ m_shell = registry->createShell(interface.name, interface.version, this); -+ } -+ }); -+ -+ registry->setup(); -+ connection->roundtrip(); -+} -diff --git a/src/plasma-shell-manager.h b/src/plasma-shell-manager.h -new file mode 100644 -index 0000000..1437a88 ---- /dev/null -+++ b/src/plasma-shell-manager.h -@@ -0,0 +1,37 @@ -+#ifndef PLASMASHELLMANAGER_H -+#define PLASMASHELLMANAGER_H -+ -+#include -+#include -+#include -+#include -+#include -+ -+class PlasmaShellManager : public QObject -+{ -+ Q_OBJECT -+public: -+ static PlasmaShellManager *getInstance(); -+ -+ bool setAppWindowActive(); -+ bool setAppWindowKeepAbove(bool keep); -+ bool setMaximized(QWindow *window); -+ bool setRole(QWindow *window, KWayland::Client::PlasmaShellSurface::Role role); -+ bool setPos(QWindow *window, const QPoint &pos); -+ bool supportPlasmaShell(); -+ bool supportShell(); -+ bool supportPlasmaWindowManagement(); -+ -+private: -+ explicit PlasmaShellManager(QObject *parent = nullptr); -+ -+ KWayland::Client::PlasmaShell *m_plasmaShell = nullptr; -+ KWayland::Client::Shell *m_shell = nullptr; -+ KWayland::Client::PlasmaWindowManagement *m_windowManager = nullptr; -+ KWayland::Client::PlasmaWindow *m_appWindow = nullptr; -+ -+ bool isFirstCreate = true; -+}; -+ -+ -+#endif // PLASMASHELLMANAGER_H -diff --git a/src/powermanager.cpp b/src/powermanager.cpp -index 698cc00..aadcf02 100644 ---- a/src/powermanager.cpp -+++ b/src/powermanager.cpp -@@ -202,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;"); - } -@@ -660,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); -@@ -678,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); -@@ -704,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); -@@ -731,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/screensaverwidget.cpp b/src/screensaverwidget.cpp -index 48d2a43..cfc41cc 100644 ---- a/src/screensaverwidget.cpp -+++ b/src/screensaverwidget.cpp -@@ -143,7 +143,9 @@ bool ScreenSaverWidget::eventFilter(QObject *obj, QEvent *event) - { - if(event->type() == 23) - { -- XSetInputFocus(QX11Info::display(),this->winId(),RevertToParent,CurrentTime); -+ if(QX11Info::isPlatformX11()){ -+ XSetInputFocus(QX11Info::display(),this->winId(),RevertToParent,CurrentTime); -+ } - } - return false; - } -diff --git a/src/ukui-screensaver-dialog.cpp b/src/ukui-screensaver-dialog.cpp -index d13bf28..e7ed780 100644 ---- a/src/ukui-screensaver-dialog.cpp -+++ b/src/ukui-screensaver-dialog.cpp -@@ -28,6 +28,7 @@ - #include - #include - #include -+#include "plasma-shell-manager.h" - #include - #include - #include -@@ -225,7 +226,10 @@ int main(int argc, char *argv[]) - } - - #ifndef USE_INTEL -- window->show(); -+ if (QString(qgetenv("XDG_SESSION_TYPE")) == "wayland") -+ window->showFullScreen(); -+ else -+ window->show(); - window->activateWindow(); - #endif - if(parser.isSet(lockOption)) -@@ -266,6 +270,16 @@ int main(int argc, char *argv[]) - window->show(); - window->activateWindow(); - #endif -+ -+ -+ bool isWayland = false; -+ if(QString(qgetenv("XDG_SESSION_TYPE")) == "wayland") { -+ isWayland = true; -+ } -+ if (isWayland){ -+ PlasmaShellManager::getInstance(); -+ PlasmaShellManager::getInstance()->setAppWindowKeepAbove(true); -+ } - - QString username = getenv("USER"); - int uid = getuid(); diff --git a/debian/patches/0002-.patch b/debian/patches/0002-.patch deleted file mode 100644 index c42ec3e..0000000 --- a/debian/patches/0002-.patch +++ /dev/null @@ -1,42 +0,0 @@ -From: winnerym -Date: Thu, 8 Dec 2022 14:40:46 +0800 -Subject: =?utf-8?b?5pu05paw5L+u5pS56K6w5b2V?= - ---- - src/lockwidget.cpp | 23 ----------------------- - 1 file changed, 23 deletions(-) - -diff --git a/src/lockwidget.cpp b/src/lockwidget.cpp -index 1f02d85..cafeb59 100644 ---- a/src/lockwidget.cpp -+++ b/src/lockwidget.cpp -@@ -1909,29 +1909,6 @@ QString LockWidget::getBatteryIconName() - return QString(); - } - --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/debian/patches/0003-.patch b/debian/patches/0003-.patch deleted file mode 100644 index 04b7d26..0000000 --- a/debian/patches/0003-.patch +++ /dev/null @@ -1,145 +0,0 @@ -From: winnerym -Date: Fri, 30 Dec 2022 15:30:14 +0800 -Subject: =?utf-8?b?5pu05paw5L+u5pS56K6w5b2V?= - ---- - src/displaymanager.cpp | 1 - - src/fullbackgroundwidget.cpp | 7 ++++++- - src/plasma-shell-manager.cpp | 1 + - src/powermanager.cpp | 1 - - src/screensaverwidget.cpp | 12 +++++------- - src/ukui-screensaver-dialog.cpp | 2 +- - 6 files changed, 13 insertions(+), 11 deletions(-) - -diff --git a/src/displaymanager.cpp b/src/displaymanager.cpp -index abc9e0b..65e9346 100644 ---- a/src/displaymanager.cpp -+++ b/src/displaymanager.cpp -@@ -73,7 +73,6 @@ QString DisplayManager::getDisplayType() - - void DisplayManager::switchToGreeter() - { -- qDebug()<<"111111111111111111111111111111111111111111111111111111"; - if(_displayType == "lightdm"){ - QDBusMessage ret = dmSeatService->call("SwitchToGreeter"); - handleDBusError(ret); -diff --git a/src/fullbackgroundwidget.cpp b/src/fullbackgroundwidget.cpp -index b77fdbb..3e4e421 100644 ---- a/src/fullbackgroundwidget.cpp -+++ b/src/fullbackgroundwidget.cpp -@@ -849,7 +849,6 @@ void FullBackgroundWidget::showScreensaver(bool isPreview/* = false*/) - } else { - saverWidget->setGeometry(screen->geometry()); - } -- - } - setCursor(Qt::BlankCursor); - -@@ -1206,6 +1205,8 @@ void FullBackgroundWidget::onDesktopResized() - //repaint(); - update(); - #endif -+ -+ PlasmaShellManager::getInstance()->setPos(this->windowHandle(),QPoint(0,0)); - } - - void FullBackgroundWidget::laterInhibit(bool val) -@@ -1345,6 +1346,10 @@ QList FullBackgroundWidget::GetSubWndIds() - void FullBackgroundWidget::raiseOtherWnd() - { - //qDebug()<<"raiseOtherWnd----:"<setPosition(pos); -+ - return true; - } - -diff --git a/src/powermanager.cpp b/src/powermanager.cpp -index aadcf02..faf67f8 100644 ---- a/src/powermanager.cpp -+++ b/src/powermanager.cpp -@@ -216,7 +216,6 @@ void PowerManager::powerClicked(QListWidgetItem *item) - lasttime = QTime::currentTime(); - - QString name = itemWidget(item)->objectName(); -- printf("111111111111111111111111111 name = %s\n",name.toLatin1().data()); - // if(name == lockWidget->objectName()) - // lockWidgetClicked(); - if(switchWidget && name == switchWidget->objectName()) -diff --git a/src/screensaverwidget.cpp b/src/screensaverwidget.cpp -index cfc41cc..36bd944 100644 ---- a/src/screensaverwidget.cpp -+++ b/src/screensaverwidget.cpp -@@ -106,7 +106,7 @@ void ScreenSaverWidget::paintEvent(QPaintEvent *event) - if(!screensaver->exists()) - { - QPainter painter(this); -- painter.fillRect(geometry(), Qt::black); -+ painter.fillRect(0,0,this->width(),this->height(), Qt::black); - } - if(screensaver->mode == SAVER_IMAGE) { - switch(screensaver->effect) { -@@ -115,7 +115,7 @@ void ScreenSaverWidget::paintEvent(QPaintEvent *event) - QPixmap pixmap(screensaver->path); - pixmap.scaled(size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); - QPainter painter(this); -- painter.drawPixmap(geometry(), pixmap); -+ painter.drawPixmap(0,0,this->width(),this->height(), pixmap); - break; - } - case TRANSITION_FADE_IN_OUT: -@@ -124,17 +124,15 @@ void ScreenSaverWidget::paintEvent(QPaintEvent *event) - QPixmap pixmap1(screensaver->lastPath); - pixmap1.scaled(size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); - painter.setOpacity(opacity); -- painter.drawPixmap(geometry(), pixmap1); -+ painter.drawPixmap(0,0,this->width(),this->height(), pixmap1); - - QPixmap pixmap(screensaver->path); - pixmap.scaled(size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); - painter.setOpacity(1 - opacity); -- painter.drawPixmap(geometry(), pixmap); -+ painter.drawPixmap(0,0,this->width(),this->height(), pixmap); - break; - } - } -- -- - } - return QWidget::paintEvent(event); - } -@@ -174,7 +172,7 @@ void ScreenSaverWidget::embedXScreensaver(const QString &path) - void ScreenSaverWidget::resizeEvent(QResizeEvent *event) - { - if(m_screensaver){ -- m_screensaver->setGeometry(this->geometry()); -+ m_screensaver->setGeometry(0,0,this->width(),this->height()); - } - } - -diff --git a/src/ukui-screensaver-dialog.cpp b/src/ukui-screensaver-dialog.cpp -index e7ed780..2a5c0b7 100644 ---- a/src/ukui-screensaver-dialog.cpp -+++ b/src/ukui-screensaver-dialog.cpp -@@ -227,7 +227,7 @@ int main(int argc, char *argv[]) - - #ifndef USE_INTEL - if (QString(qgetenv("XDG_SESSION_TYPE")) == "wayland") -- window->showFullScreen(); -+ window->show(); - else - window->show(); - window->activateWindow(); diff --git a/debian/patches/0004-update-quotation.patch b/debian/patches/0004-update-quotation.patch deleted file mode 100644 index b1fb57f..0000000 --- a/debian/patches/0004-update-quotation.patch +++ /dev/null @@ -1,213 +0,0 @@ -From: winnerym -Date: Mon, 9 Jan 2023 21:00:00 +0800 -Subject: update quotation - ---- - screensaver/language/screensaver-zh_CN.ini | 139 +++++++---------------------- - 1 file changed, 33 insertions(+), 106 deletions(-) - -diff --git a/screensaver/language/screensaver-zh_CN.ini b/screensaver/language/screensaver-zh_CN.ini -index c921ed2..32b4fa7 100644 ---- a/screensaver/language/screensaver-zh_CN.ini -+++ b/screensaver/language/screensaver-zh_CN.ini -@@ -2,167 +2,94 @@ - OL=天生我材必有用,千金散尽还复来。 - author=李白《将进酒》 - [2] --OL=新时代的伟大成就是党和人民一道拼出来、干出来、奋斗出来的。 --author=习近平 --[3] - OL=莫愁前路无知己,天下谁人不识君。 - author=高适《别董大二首》 --[4] -+[3] - OL=莫听穿林打叶声,何妨吟啸且徐行。 - author=苏轼《定风波》 --[5] --OL=党用伟大奋斗创造了百年伟业,也一定能用新的伟大奋斗创造新的伟业。 --author=习近平 --[6] -+[4] - OL=巧言令色,鲜矣仁! - author=《论语》 --[7] -+[5] - FL=与君初相识,犹如故人归。 - SL=天涯明月新,朝暮最相思。 - author=杜牧《会友》 --[8] --FL=一个饱经沧桑而初心不变的党,才能基业常青; --SL=一个铸就辉煌仍勇于自我革命的党,才能无坚不摧。 --author=习近平 --[9] -+[6] - OL=见贤思齐焉,见不贤而内自省也。 - author=《论语》 --[10] -+[7] - OL=为政以德,譬如北辰,居其所而众星共之。 - author=《论语》 --[11] --FL=道阻且长,行则将至。前进道路上,无论是风高浪急还是惊涛骇浪, --SL=人民永远是我们最坚实的依托、最强大的底气。 --author=习近平 --[12] -+[8] - OL=知彼知己,百战不殆。 - author=《孙子兵法》 --[13] -+[9] - OL=人患不知其过,既知之,不能改,是无勇也。 - author=韩愈《五箴》 --[14] --FL=新征程是充满光荣和梦想的远征。蓝图已经绘就,号角已经吹响。 --SL=我们要踔厉奋发、勇毅前行,努力创造更加灿烂的明天。 --author=习近平 --[15] -+[10] - OL=万物并育而不相害,道并行而不相悖 - author=《礼记·中庸》 --[16] -+[11] - OL=自信人生二百年,会当水击三千里 - author=毛泽东《七古·残句》 --[17] --OL=我们完全有信心有能力在新时代新征程创造令世人刮目相看的新的更大奇迹。 --author=习近平 --[18] -+[12] - OL=青春虚度无所成,白首衔悲亦何及。 - author=权德舆《放歌行》 --[19] --OL=劳动模范是民族的精英、人民的楷模,是共和国的功臣。 --author=习近平 --[20] --FL=当前最重要的任务是撸起袖子加油干, --SL=一步一个脚印把党的二十大作出的重大决策部署付诸行动、见之于成效。 --author=习近平 --[21] --FL=广大人民群众坚持爱国奉献,无怨无悔,让我感到千千万万普通人最伟大, --SL=同时让我感到幸福都是奋斗出来的。 --author=2018新年贺词 习近平 --[22] --OL=中华文化既是历史的、也是当代的,既是民族的、也是世界的。 --author=习近平 --[23] --OL=没有坚实的物质技术基础,就不可能全面建成社会主义现代化强国。 --author=习近平 --[24] --OL=我们党没有自己的特殊利益,党在任何时候都是把群众利益放在第一位。 --author=习近平 --[25] -+[13] - OL=知者行之始。行者知之成。 - author=王阳明《传习录·卷上·门人陆澄录》 --[26] --FL=江山就是人民,人民就是江山。 --SL=中国共产党领导人民打江山、守江山,守的是人民的心,治国有常,利民为本。 --author=习近平 --[27] -+[14] - OL=此心不动,随机而动。 - author=王阳明 --[28] -+[15] - OL=你未看此花时,此花与汝心同归于寂。 - author=《传习录·卷下·门人黄省曾录》 --[29] --FL=时代呼唤我们,人民期待着我们, --SL=唯有矢志不渝、笃行不怠,方能不负时代、不负人民。 --author=习近平 --[30] -+[16] - OL=省察是有事时存养,存养是无事时省察。 - author=王阳明《传习录》 --[31] -+[17] - OL=路漫漫其修远兮,吾将上下而求索。 - author=《离骚》 --[32] --OL=当代中国青年生逢其时,施展才干的舞台无比广阔,实现梦想的前景无比光明。 --author=习近平 --[33] --FL=解决台湾问题是中国人自己的事,要由中国人来决定。 --SL=国家统一、民族复兴的历史车轮滚滚向前,祖国完全统一一定要实现,也一定能够实现。 --author=习近平 --[34] -+[18] - OL=悲莫悲兮生别离,乐莫乐兮新相知。 - author=《九歌·少司命》 --[35] -+[19] - OL=风飒飒兮木萧萧,思公子兮徒离忧。 - author=《九歌·山鬼》 --[36] -+[20] - OL=善守者,藏于九地之下,善攻者,动于九天之上。 - author=《孙子兵法》 --[37] --FL=我们正意气风发迈向全面建设社会主义现代化国家新征程, --SL=向第二个百年奋斗目标进军,以中国式现代化全面推进中华民族伟大复兴。 --author=习近平 --[38] -+[21] - OL=善战者,致人而不致于人。 - author=《孙子兵法·虚实第六》 --[39] -+[22] - OL=乱生于治,怯生于勇,弱生于强。 - author=《孙子兵法·兵势第五》 --[40] --FL=中国式现代化是中国共产党和中国人民长期实践探索的成果, --SL=是一项伟大而艰巨的事业。惟其艰巨,所以伟大;惟其艰巨,更显光荣。 --author=习近平 --[41] -+[23] - OL=不战而屈人之兵,善之善者也。 - author=《孙子兵法·谋攻第三》 --[42] -+[24] - OL=天行健,君子以自强不息。 - author=《周易.乾卦》 --[43] --FL=中国开放的大门只会越来越大。我们将坚定不移全面深化改革开放, --SL=坚定不移推动高质量发展,以自身发展为世界创造更多机遇。 --author=习近平 --[44] -+[25] - OL=积善之家,必有余庆;积不善之家,必有余殃。 - author=《周易.坤卦》 --[45] -+[26] - OL=穷则变,变则通,通则久。 - author=《周易.系辞下》 --[46] --FL=我们历来主张,人类的前途命运应该由世界各国人民来把握和决定。 --SL=只要共行天下大道,各国就能够和睦相处、合作共赢,携手创造世界的美好未来。 --author=习近平 --[47] -+[27] - OL=天若有情天亦老,人间正道是沧桑 - author=毛泽东《七律·人民解放军占领南京》 --[48] -+[28] - OL=仰天大笑出门去,我辈岂是蓬蒿人。 - author=李白《南陵别儿童入京》 --[49] -+[29] - OL=落叶秋风生渭水,落叶满长安。 - author=贾岛《忆江上吴处士》 --[50] --OL=人生来是精神所附丽的物质,免不掉物质所常有的惰性。 --author=朱光潜《朝抵抗力最大的路径走》 --[51] --FL=能朝抵抗力最大的路径走,是人的特点。 --SL=人在能尽量发挥这特点时,就足见出他有富裕的生活力。 --author=朱光潜《朝抵抗力最大的路径走》 -+[30] -+OL=飞流直下三千尺,疑是银河落九天。 -+author=李白《望庐山瀑布》 -+[31] -+OL=长风破浪会有时,直挂云帆济沧海。 -+author=李白《行路难·其一》 - diff --git a/debian/patches/0005-update-changelog.patch b/debian/patches/0005-update-changelog.patch deleted file mode 100644 index ed0838a..0000000 --- a/debian/patches/0005-update-changelog.patch +++ /dev/null @@ -1,197 +0,0 @@ -From: winnerym -Date: Tue, 14 Mar 2023 15:26:57 +0800 -Subject: update changelog - ---- - screensaver/language/screensaver-zh_CN.ini | 152 +++++++++++++++++------------ - 1 file changed, 89 insertions(+), 63 deletions(-) - -diff --git a/screensaver/language/screensaver-zh_CN.ini b/screensaver/language/screensaver-zh_CN.ini -index 32b4fa7..51b93e7 100644 ---- a/screensaver/language/screensaver-zh_CN.ini -+++ b/screensaver/language/screensaver-zh_CN.ini -@@ -1,95 +1,121 @@ - [1] --OL=天生我材必有用,千金散尽还复来。 --author=李白《将进酒》 -+FL=世上的事,只要肯用心去学, -+SL=没有一件是太晚的。 -+author=三毛《送你一匹马》 - [2] --OL=莫愁前路无知己,天下谁人不识君。 --author=高适《别董大二首》 -+OL=如果你是大河,何必在乎别人把你当成小溪。 -+author=汪国真 《如果》 - [3] --OL=莫听穿林打叶声,何妨吟啸且徐行。 --author=苏轼《定风波》 -+OL=世界上有不绝的风景,我有不老的心情。 -+author=汪国真《我喜欢出发》 - [4] --OL=巧言令色,鲜矣仁! --author=《论语》 -+OL=人生如逆旅,我亦是行人。 -+author=苏轼《临江仙·送钱穆父》 - [5] --FL=与君初相识,犹如故人归。 --SL=天涯明月新,朝暮最相思。 --author=杜牧《会友》 -+OL=行乐直须年少,尊前看取衰翁。 -+author=欧阳修《朝中措·送刘仲原甫出守维扬》 - [6] --OL=见贤思齐焉,见不贤而内自省也。 --author=《论语》 -+OL=行到水穷处,坐看云起时。 -+author=王维《终南别业》 - [7] --OL=为政以德,譬如北辰,居其所而众星共之。 --author=《论语》 -+OL=仰天大笑出门去,我辈岂是蓬蒿人。 -+author=李白《南陵别儿童入京》 - [8] --OL=知彼知己,百战不殆。 --author=《孙子兵法》 -+OL=天生我材必有用,千金散尽还复来。 -+author=李白《将进酒》 - [9] --OL=人患不知其过,既知之,不能改,是无勇也。 --author=韩愈《五箴》 -+OL=希君生羽翼,一化北溟鱼。 -+author=李白《江夏使君叔席上赠史郎中》 - [10] --OL=万物并育而不相害,道并行而不相悖 --author=《礼记·中庸》 -+OL=惟沉默是最高的轻蔑。 -+author=鲁迅《且介亭杂文附集》 - [11] --OL=自信人生二百年,会当水击三千里 --author=毛泽东《七古·残句》 -+OL=虽偶有轻风细雨,但总归晴天朗照。 -+author=史铁生《记忆与印象》 - [12] --OL=青春虚度无所成,白首衔悲亦何及。 --author=权德舆《放歌行》 -+OL=不能走远路却有辽阔的心。 -+author=史铁生《我与地坛》 - [13] --OL=知者行之始。行者知之成。 --author=王阳明《传习录·卷上·门人陆澄录》 -+OL=从卖气球的人那里,每个孩子牵走一个心愿。 -+author=北岛《代课》 - [14] --OL=此心不动,随机而动。 --author=王阳明 -+OL=要有最朴素的生活和最遥远的梦想 -+author=海子《枫》 - [15] --OL=你未看此花时,此花与汝心同归于寂。 --author=《传习录·卷下·门人黄省曾录》 -+OL=雾打湿了我的双翼,可风却不容我再迟疑。 -+author=舒婷《双桅船》 - [16] --OL=省察是有事时存养,存养是无事时省察。 --author=王阳明《传习录》 -+OL=拯救地球好累,虽然有些疲惫但我还是会。 -+author=《超人不会飞》 - [17] --OL=路漫漫其修远兮,吾将上下而求索。 --author=《离骚》 -+OL=宁可一思进,莫在一思停。 -+author=电影《一代宗师》 - [18] --OL=悲莫悲兮生别离,乐莫乐兮新相知。 --author=《九歌·少司命》 -+OL=让人类永远保持理智,确实是一件奢侈的事。 -+author=电影《流浪地球》 - [19] --OL=风飒飒兮木萧萧,思公子兮徒离忧。 --author=《九歌·山鬼》 -+FL=无论结果如何,人类的勇气和坚毅, -+SL=都被镌刻在星空下。 -+author=电影《流浪地球》 - [20] --OL=善守者,藏于九地之下,善攻者,动于九天之上。 --author=《孙子兵法》 -+OL=生活就像一盒巧克力,你不知道你的下一块口味是什么。 -+author=电影《阿甘正传》 - [21] --OL=善战者,致人而不致于人。 --author=《孙子兵法·虚实第六》 -+FL=也许我们这些聪明人,脑袋里能装的目标太多, -+SL=所以忘了执着。 -+author=电影《阿甘正传》 - [22] --OL=乱生于治,怯生于勇,弱生于强。 --author=《孙子兵法·兵势第五》 -+FL=我并不是每次吃完饭就看电视,有时我边吃边看电视, -+SL=生活中有些改变会增加乐趣。 -+author=电影《加菲猫》 - [23] --OL=不战而屈人之兵,善之善者也。 --author=《孙子兵法·谋攻第三》 -+OL=做人如果没梦想,那跟咸鱼有什么分别? -+author=电影《少林足球》 - [24] --OL=天行健,君子以自强不息。 --author=《周易.乾卦》 -+FL=世界上有一种鸟是关不住的,因为它们的每一片羽毛都沾满了太阳的光辉。 -+SL=当它们飞走的时候,你会觉得把它关起来是一种罪恶。 -+author=电影《肖申克的救赎》 - [25] --OL=积善之家,必有余庆;积不善之家,必有余殃。 --author=《周易.坤卦》 -+FL=你每天都在做很多看起来毫无意义的决定, -+SL=但某天你的某个决定就能改变你一生。 -+author=电影《西雅图未眠夜》 - [26] --OL=穷则变,变则通,通则久。 --author=《周易.系辞下》 -+FL=把人类看做虫子的三体人似乎忘记了一个事实: -+SL=虫子从来没有被战胜过。 -+author=刘慈欣《三体》 - [27] --OL=天若有情天亦老,人间正道是沧桑 --author=毛泽东《七律·人民解放军占领南京》 -+FL=在宇宙中,你再快都有比你更快的, -+SL=你再慢也有比你更慢的。 -+author=刘慈欣《三体》 - [28] --OL=仰天大笑出门去,我辈岂是蓬蒿人。 --author=李白《南陵别儿童入京》 -+OL=人间风雨各处有,何处不是浪浪山? -+author=国漫《小妖怪的夏天》 - [29] --OL=落叶秋风生渭水,落叶满长安。 --author=贾岛《忆江上吴处士》 -+FL=我看到那些岁月如何奔驰, -+SL=挨过了冬季,便迎来了春天。 -+author=《瓦尔登湖》 - [30] --OL=飞流直下三千尺,疑是银河落九天。 --author=李白《望庐山瀑布》 -+OL=保持热爱,奔赴山海。 -+author=佚名 - [31] --OL=长风破浪会有时,直挂云帆济沧海。 --author=李白《行路难·其一》 -+OL=别慌,月亮也正在大海某处迷茫。 -+author=佚名 -+[32] -+OL=当太阳升到最高点的时候,影子就不见了。 -+author=佚名 -+[33] -+OL=大直若屈,大巧若拙,大辩若讷。 -+author=《老子》 -+[34] -+OL=博学之,审问之,慎思之,明辨之,笃行之。 -+author=《礼记》 -+[35] -+OL=你要批评指点四周的风景,你首先要爬上屋顶。 -+author=歌德 -+[36] -+OL=只有流过血的手指,才能弹出世间的绝唱。 -+author=泰戈尔 -+[37] -+OL=他强任他强,清风拂山岗。 -+author=佚名 - diff --git a/debian/patches/0006-update-changelog.patch b/debian/patches/0006-update-changelog.patch deleted file mode 100644 index 54df464..0000000 --- a/debian/patches/0006-update-changelog.patch +++ /dev/null @@ -1,35 +0,0 @@ -From: winnerym -Date: Thu, 23 Mar 2023 09:37:26 +0800 -Subject: update changelog - ---- - src/authdialog.cpp | 2 +- - src/lockwidget.cpp | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/authdialog.cpp b/src/authdialog.cpp -index 11bd9a0..07f9e26 100644 ---- a/src/authdialog.cpp -+++ b/src/authdialog.cpp -@@ -632,7 +632,7 @@ void AuthDialog::setFocusin(int target) - m_messageButton->setStyleSheet("QPushButton{background-color: rgba(255,255,255,15%); border-radius: 4px; border: 2px solid #2C73C8;}"); - break; - default: -- if(m_widgetLoginOpts) -+ if(m_passwordEdit) - m_passwordEdit->setFocusin(target); - m_widgetLoginOpts->tabOptionSelected(2); - break; -diff --git a/src/lockwidget.cpp b/src/lockwidget.cpp -index cafeb59..f648e24 100644 ---- a/src/lockwidget.cpp -+++ b/src/lockwidget.cpp -@@ -1862,7 +1862,7 @@ bool LockWidget::exitSubWidget() - allExited = false; - return allExited; - } -- if(tabAt != LINEEDIT) -+ if(tabAt != LINEEDIT && tabAt != MESSAGEBTN && tabAt != ENTERBTN && tabAt != BIOBTN) - authDialog->setFocusin(REMOVE); - return allExited; - } diff --git a/debian/patches/0007-update-changelog.patch b/debian/patches/0007-update-changelog.patch deleted file mode 100644 index 1952547..0000000 --- a/debian/patches/0007-update-changelog.patch +++ /dev/null @@ -1,3221 +0,0 @@ -From: winnerym -Date: Wed, 12 Apr 2023 13:43:08 +0800 -Subject: update changelog - ---- - BiometricAuth/biometricauthwidget.cpp | 9 +- - BiometricAuth/biometricauthwidget.h | 9 +- - BiometricAuth/biometricdeviceinfo.cpp | 9 +- - BiometricAuth/biometricdeviceinfo.h | 9 +- - BiometricAuth/biometricdeviceswidget.cpp | 9 +- - BiometricAuth/biometricproxy.cpp | 9 +- - BiometricAuth/biometricproxy.h | 9 +- - BiometricAuth/giodbus.cpp | 17 + - BiometricAuth/giodbus.h | 17 + - COPYING | 674 ++++++++++++++++++++++++++ - Common/checkbutton.cpp | 12 +- - Common/checkbutton.h | 12 +- - Common/commonfunc.cpp | 12 +- - Common/commonfunc.h | 12 +- - KylinNM/src/swipegesturerecognizer.cpp | 17 + - KylinNM/src/swipegesturerecognizer.h | 17 + - KylinNM/src/switchbutton.cpp | 17 + - KylinNM/src/switchbutton.h | 17 + - VirtualKeyboard/src/cursormonitor.cpp | 9 +- - VirtualKeyboard/src/cursormonitor.h | 9 +- - VirtualKeyboard/src/keyboardwidget.cpp | 9 +- - VirtualKeyboard/src/keyboardwidget.h | 9 +- - VirtualKeyboard/src/virtualkeyboard.cpp | 9 +- - VirtualKeyboard/src/virtualkeyboard.h | 9 +- - VirtualKeyboard/src/vkstackedwidget.cpp | 17 + - VirtualKeyboard/src/vkstackedwidget.h | 17 + - VirtualKeyboard/src/x11keyboard.cpp | 9 +- - VirtualKeyboard/src/x11keyboard.h | 9 +- - examples/LoadCustomPlugin/widget.h | 19 +- - screensaver-focus-helper/blackwindow.cpp | 17 + - screensaver-focus-helper/blackwindow.h | 17 + - screensaver-focus-helper/main.cpp | 17 + - screensaver/customplugin.cpp | 19 +- - screensaver/customplugin.h | 19 +- - screensaver/cyclelabel.cpp | 12 +- - screensaver/cyclelabel.h | 12 +- - screensaver/screensaver.cpp | 18 +- - screensaver/screensaver.h | 2 +- - screensaver/screensaverplugin.h | 19 +- - set4kScale/main.cpp | 17 + - src/PhysicalDeviceSet/brightnessdeviceset.cpp | 17 + - src/PhysicalDeviceSet/brightnessdeviceset.h | 17 + - src/PhysicalDeviceSet/flightmodeset.cpp | 17 + - src/PhysicalDeviceSet/flightmodeset.h | 17 + - src/PhysicalDeviceSet/sounddeviceset.cpp | 17 + - src/PhysicalDeviceSet/sounddeviceset.h | 17 + - src/PhysicalDeviceSet/touchscreenset.cpp | 17 + - src/PhysicalDeviceSet/touchscreenset.h | 17 + - src/accountsinterface.cpp | 17 + - src/accountsinterface.h | 17 + - src/authdialog.cpp | 4 +- - src/batterywidget.cpp | 17 + - src/batterywidget.h | 17 + - src/common.h | 17 + - src/device.cpp | 13 +- - src/device.h | 13 +- - src/digitalkeyboard.cpp | 17 + - src/digitalkeyboard.h | 17 + - src/eduplatforminterface.cpp | 17 + - src/eduplatforminterface.h | 17 + - src/enginedevice.cpp | 14 +- - src/hoverwidget.cpp | 12 +- - src/hoverwidget.h | 12 +- - src/iconedit.cpp | 9 +- - src/iconedit.h | 9 +- - src/imageutil.cpp | 12 +- - src/imageutil.h | 12 +- - src/libinputswitchevent.cpp | 16 +- - src/lockchecker.cpp | 2 +- - src/loginedusers.cpp | 9 +- - src/loginedusers.h | 12 +- - src/loginoptionswidget.cpp | 17 + - src/loginoptionswidget.h | 17 + - src/monitorwatcher.h | 9 +- - src/mytabwidget.cpp | 17 + - src/mytabwidget.h | 17 + - src/networkwatcher.cpp | 17 + - src/networkwatcher.h | 17 + - src/permissioncheck.h | 17 + - src/plasma-shell-manager.cpp | 17 + - src/plasma-shell-manager.h | 17 + - src/screensaverwndadaptor.cpp | 17 + - src/screensaverwndadaptor.h | 17 + - src/surewindow.cpp | 17 + - src/surewindow.h | 17 + - src/ukui-screensaver-checkpass.cpp | 17 + - src/utils.cpp | 17 + - src/utils.h | 17 + - src/verificationwidget.cpp | 17 + - src/verificationwidget.h | 17 + - src/verticalVerificationwidget.cpp | 17 + - src/verticalVerificationwidget.h | 17 + - 92 files changed, 1755 insertions(+), 213 deletions(-) - create mode 100644 COPYING - -diff --git a/BiometricAuth/biometricauthwidget.cpp b/BiometricAuth/biometricauthwidget.cpp -index a7b552d..4a03938 100644 ---- a/BiometricAuth/biometricauthwidget.cpp -+++ b/BiometricAuth/biometricauthwidget.cpp -@@ -1,9 +1,9 @@ --/** -+/* - * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) -+ * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, -@@ -12,9 +12,8 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -- * 02110-1301, USA. -+ * along with this program; if not, see . -+ * - **/ - #include "biometricauthwidget.h" - #include -diff --git a/BiometricAuth/biometricauthwidget.h b/BiometricAuth/biometricauthwidget.h -index e380abf..8390a02 100644 ---- a/BiometricAuth/biometricauthwidget.h -+++ b/BiometricAuth/biometricauthwidget.h -@@ -1,9 +1,9 @@ --/** -+/* - * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) -+ * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, -@@ -12,9 +12,8 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -- * 02110-1301, USA. -+ * along with this program; if not, see . -+ * - **/ - #ifndef BIOMETRICAUTHWIDGET_H - #define BIOMETRICAUTHWIDGET_H -diff --git a/BiometricAuth/biometricdeviceinfo.cpp b/BiometricAuth/biometricdeviceinfo.cpp -index f49881e..ad0da07 100644 ---- a/BiometricAuth/biometricdeviceinfo.cpp -+++ b/BiometricAuth/biometricdeviceinfo.cpp -@@ -1,9 +1,9 @@ --/** -+/* - * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) -+ * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, -@@ -12,9 +12,8 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -- * 02110-1301, USA. -+ * along with this program; if not, see . -+ * - **/ - #include "biometricdeviceinfo.h" - -diff --git a/BiometricAuth/biometricdeviceinfo.h b/BiometricAuth/biometricdeviceinfo.h -index 7ffb27a..31cf9ac 100644 ---- a/BiometricAuth/biometricdeviceinfo.h -+++ b/BiometricAuth/biometricdeviceinfo.h -@@ -1,9 +1,9 @@ --/** -+/* - * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) -+ * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, -@@ -12,9 +12,8 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -- * 02110-1301, USA. -+ * along with this program; if not, see . -+ * - **/ - #ifndef BIOMETRICDEVICEINFO_H - #define BIOMETRICDEVICEINFO_H -diff --git a/BiometricAuth/biometricdeviceswidget.cpp b/BiometricAuth/biometricdeviceswidget.cpp -index 856b750..0766ae3 100644 ---- a/BiometricAuth/biometricdeviceswidget.cpp -+++ b/BiometricAuth/biometricdeviceswidget.cpp -@@ -1,9 +1,9 @@ --/** -+/* - * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) -+ * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, -@@ -12,9 +12,8 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -- * 02110-1301, USA. -+ * along with this program; if not, see . -+ * - **/ - #include "biometricdeviceswidget.h" - #include -diff --git a/BiometricAuth/biometricproxy.cpp b/BiometricAuth/biometricproxy.cpp -index 85637a4..644d9f7 100644 ---- a/BiometricAuth/biometricproxy.cpp -+++ b/BiometricAuth/biometricproxy.cpp -@@ -1,9 +1,9 @@ --/** -+/* - * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) -+ * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, -@@ -12,9 +12,8 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -- * 02110-1301, USA. -+ * along with this program; if not, see . -+ * - **/ - #include "biometricproxy.h" - #include -diff --git a/BiometricAuth/biometricproxy.h b/BiometricAuth/biometricproxy.h -index ac03881..4452a7e 100644 ---- a/BiometricAuth/biometricproxy.h -+++ b/BiometricAuth/biometricproxy.h -@@ -1,9 +1,9 @@ --/** -+/* - * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) -+ * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, -@@ -12,9 +12,8 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -- * 02110-1301, USA. -+ * along with this program; if not, see . -+ * - **/ - #ifndef BIOMETRICPROXY_H - #define BIOMETRICPROXY_H -diff --git a/BiometricAuth/giodbus.cpp b/BiometricAuth/giodbus.cpp -index 9e0490e..399aa0e 100644 ---- a/BiometricAuth/giodbus.cpp -+++ b/BiometricAuth/giodbus.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include "giodbus.h" - #include - #include -diff --git a/BiometricAuth/giodbus.h b/BiometricAuth/giodbus.h -index 13e0880..a75f989 100644 ---- a/BiometricAuth/giodbus.h -+++ b/BiometricAuth/giodbus.h -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 GIODBUS_H - #define GIODBUS_H - -diff --git a/COPYING b/COPYING -new file mode 100644 -index 0000000..94a9ed0 ---- /dev/null -+++ b/COPYING -@@ -0,0 +1,674 @@ -+ GNU GENERAL PUBLIC LICENSE -+ Version 3, 29 June 2007 -+ -+ Copyright (C) 2007 Free Software Foundation, Inc. -+ Everyone is permitted to copy and distribute verbatim copies -+ of this license document, but changing it is not allowed. -+ -+ Preamble -+ -+ The GNU General Public License is a free, copyleft license for -+software and other kinds of works. -+ -+ The licenses for most software and other practical works are designed -+to take away your freedom to share and change the works. By contrast, -+the GNU General Public License is intended to guarantee your freedom to -+share and change all versions of a program--to make sure it remains free -+software for all its users. We, the Free Software Foundation, use the -+GNU General Public License for most of our software; it applies also to -+any other work released this way by its authors. You can apply it to -+your programs, too. -+ -+ When we speak of free software, we are referring to freedom, not -+price. Our General Public Licenses are designed to make sure that you -+have the freedom to distribute copies of free software (and charge for -+them if you wish), that you receive source code or can get it if you -+want it, that you can change the software or use pieces of it in new -+free programs, and that you know you can do these things. -+ -+ To protect your rights, we need to prevent others from denying you -+these rights or asking you to surrender the rights. Therefore, you have -+certain responsibilities if you distribute copies of the software, or if -+you modify it: responsibilities to respect the freedom of others. -+ -+ For example, if you distribute copies of such a program, whether -+gratis or for a fee, you must pass on to the recipients the same -+freedoms that you received. You must make sure that they, too, receive -+or can get the source code. And you must show them these terms so they -+know their rights. -+ -+ Developers that use the GNU GPL protect your rights with two steps: -+(1) assert copyright on the software, and (2) offer you this License -+giving you legal permission to copy, distribute and/or modify it. -+ -+ For the developers' and authors' protection, the GPL clearly explains -+that there is no warranty for this free software. For both users' and -+authors' sake, the GPL requires that modified versions be marked as -+changed, so that their problems will not be attributed erroneously to -+authors of previous versions. -+ -+ Some devices are designed to deny users access to install or run -+modified versions of the software inside them, although the manufacturer -+can do so. This is fundamentally incompatible with the aim of -+protecting users' freedom to change the software. The systematic -+pattern of such abuse occurs in the area of products for individuals to -+use, which is precisely where it is most unacceptable. Therefore, we -+have designed this version of the GPL to prohibit the practice for those -+products. If such problems arise substantially in other domains, we -+stand ready to extend this provision to those domains in future versions -+of the GPL, as needed to protect the freedom of users. -+ -+ Finally, every program is threatened constantly by software patents. -+States should not allow patents to restrict development and use of -+software on general-purpose computers, but in those that do, we wish to -+avoid the special danger that patents applied to a free program could -+make it effectively proprietary. To prevent this, the GPL assures that -+patents cannot be used to render the program non-free. -+ -+ The precise terms and conditions for copying, distribution and -+modification follow. -+ -+ TERMS AND CONDITIONS -+ -+ 0. Definitions. -+ -+ "This License" refers to version 3 of the GNU General Public License. -+ -+ "Copyright" also means copyright-like laws that apply to other kinds of -+works, such as semiconductor masks. -+ -+ "The Program" refers to any copyrightable work licensed under this -+License. Each licensee is addressed as "you". "Licensees" and -+"recipients" may be individuals or organizations. -+ -+ To "modify" a work means to copy from or adapt all or part of the work -+in a fashion requiring copyright permission, other than the making of an -+exact copy. The resulting work is called a "modified version" of the -+earlier work or a work "based on" the earlier work. -+ -+ A "covered work" means either the unmodified Program or a work based -+on the Program. -+ -+ To "propagate" a work means to do anything with it that, without -+permission, would make you directly or secondarily liable for -+infringement under applicable copyright law, except executing it on a -+computer or modifying a private copy. Propagation includes copying, -+distribution (with or without modification), making available to the -+public, and in some countries other activities as well. -+ -+ To "convey" a work means any kind of propagation that enables other -+parties to make or receive copies. Mere interaction with a user through -+a computer network, with no transfer of a copy, is not conveying. -+ -+ An interactive user interface displays "Appropriate Legal Notices" -+to the extent that it includes a convenient and prominently visible -+feature that (1) displays an appropriate copyright notice, and (2) -+tells the user that there is no warranty for the work (except to the -+extent that warranties are provided), that licensees may convey the -+work under this License, and how to view a copy of this License. If -+the interface presents a list of user commands or options, such as a -+menu, a prominent item in the list meets this criterion. -+ -+ 1. Source Code. -+ -+ The "source code" for a work means the preferred form of the work -+for making modifications to it. "Object code" means any non-source -+form of a work. -+ -+ A "Standard Interface" means an interface that either is an official -+standard defined by a recognized standards body, or, in the case of -+interfaces specified for a particular programming language, one that -+is widely used among developers working in that language. -+ -+ The "System Libraries" of an executable work include anything, other -+than the work as a whole, that (a) is included in the normal form of -+packaging a Major Component, but which is not part of that Major -+Component, and (b) serves only to enable use of the work with that -+Major Component, or to implement a Standard Interface for which an -+implementation is available to the public in source code form. A -+"Major Component", in this context, means a major essential component -+(kernel, window system, and so on) of the specific operating system -+(if any) on which the executable work runs, or a compiler used to -+produce the work, or an object code interpreter used to run it. -+ -+ The "Corresponding Source" for a work in object code form means all -+the source code needed to generate, install, and (for an executable -+work) run the object code and to modify the work, including scripts to -+control those activities. However, it does not include the work's -+System Libraries, or general-purpose tools or generally available free -+programs which are used unmodified in performing those activities but -+which are not part of the work. For example, Corresponding Source -+includes interface definition files associated with source files for -+the work, and the source code for shared libraries and dynamically -+linked subprograms that the work is specifically designed to require, -+such as by intimate data communication or control flow between those -+subprograms and other parts of the work. -+ -+ The Corresponding Source need not include anything that users -+can regenerate automatically from other parts of the Corresponding -+Source. -+ -+ The Corresponding Source for a work in source code form is that -+same work. -+ -+ 2. Basic Permissions. -+ -+ All rights granted under this License are granted for the term of -+copyright on the Program, and are irrevocable provided the stated -+conditions are met. This License explicitly affirms your unlimited -+permission to run the unmodified Program. The output from running a -+covered work is covered by this License only if the output, given its -+content, constitutes a covered work. This License acknowledges your -+rights of fair use or other equivalent, as provided by copyright law. -+ -+ You may make, run and propagate covered works that you do not -+convey, without conditions so long as your license otherwise remains -+in force. You may convey covered works to others for the sole purpose -+of having them make modifications exclusively for you, or provide you -+with facilities for running those works, provided that you comply with -+the terms of this License in conveying all material for which you do -+not control copyright. Those thus making or running the covered works -+for you must do so exclusively on your behalf, under your direction -+and control, on terms that prohibit them from making any copies of -+your copyrighted material outside their relationship with you. -+ -+ Conveying under any other circumstances is permitted solely under -+the conditions stated below. Sublicensing is not allowed; section 10 -+makes it unnecessary. -+ -+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law. -+ -+ No covered work shall be deemed part of an effective technological -+measure under any applicable law fulfilling obligations under article -+11 of the WIPO copyright treaty adopted on 20 December 1996, or -+similar laws prohibiting or restricting circumvention of such -+measures. -+ -+ When you convey a covered work, you waive any legal power to forbid -+circumvention of technological measures to the extent such circumvention -+is effected by exercising rights under this License with respect to -+the covered work, and you disclaim any intention to limit operation or -+modification of the work as a means of enforcing, against the work's -+users, your or third parties' legal rights to forbid circumvention of -+technological measures. -+ -+ 4. Conveying Verbatim Copies. -+ -+ You may convey verbatim copies of the Program's source code as you -+receive it, in any medium, provided that you conspicuously and -+appropriately publish on each copy an appropriate copyright notice; -+keep intact all notices stating that this License and any -+non-permissive terms added in accord with section 7 apply to the code; -+keep intact all notices of the absence of any warranty; and give all -+recipients a copy of this License along with the Program. -+ -+ You may charge any price or no price for each copy that you convey, -+and you may offer support or warranty protection for a fee. -+ -+ 5. Conveying Modified Source Versions. -+ -+ You may convey a work based on the Program, or the modifications to -+produce it from the Program, in the form of source code under the -+terms of section 4, provided that you also meet all of these conditions: -+ -+ a) The work must carry prominent notices stating that you modified -+ it, and giving a relevant date. -+ -+ b) The work must carry prominent notices stating that it is -+ released under this License and any conditions added under section -+ 7. This requirement modifies the requirement in section 4 to -+ "keep intact all notices". -+ -+ c) You must license the entire work, as a whole, under this -+ License to anyone who comes into possession of a copy. This -+ License will therefore apply, along with any applicable section 7 -+ additional terms, to the whole of the work, and all its parts, -+ regardless of how they are packaged. This License gives no -+ permission to license the work in any other way, but it does not -+ invalidate such permission if you have separately received it. -+ -+ d) If the work has interactive user interfaces, each must display -+ Appropriate Legal Notices; however, if the Program has interactive -+ interfaces that do not display Appropriate Legal Notices, your -+ work need not make them do so. -+ -+ A compilation of a covered work with other separate and independent -+works, which are not by their nature extensions of the covered work, -+and which are not combined with it such as to form a larger program, -+in or on a volume of a storage or distribution medium, is called an -+"aggregate" if the compilation and its resulting copyright are not -+used to limit the access or legal rights of the compilation's users -+beyond what the individual works permit. Inclusion of a covered work -+in an aggregate does not cause this License to apply to the other -+parts of the aggregate. -+ -+ 6. Conveying Non-Source Forms. -+ -+ You may convey a covered work in object code form under the terms -+of sections 4 and 5, provided that you also convey the -+machine-readable Corresponding Source under the terms of this License, -+in one of these ways: -+ -+ a) Convey the object code in, or embodied in, a physical product -+ (including a physical distribution medium), accompanied by the -+ Corresponding Source fixed on a durable physical medium -+ customarily used for software interchange. -+ -+ b) Convey the object code in, or embodied in, a physical product -+ (including a physical distribution medium), accompanied by a -+ written offer, valid for at least three years and valid for as -+ long as you offer spare parts or customer support for that product -+ model, to give anyone who possesses the object code either (1) a -+ copy of the Corresponding Source for all the software in the -+ product that is covered by this License, on a durable physical -+ medium customarily used for software interchange, for a price no -+ more than your reasonable cost of physically performing this -+ conveying of source, or (2) access to copy the -+ Corresponding Source from a network server at no charge. -+ -+ c) Convey individual copies of the object code with a copy of the -+ written offer to provide the Corresponding Source. This -+ alternative is allowed only occasionally and noncommercially, and -+ only if you received the object code with such an offer, in accord -+ with subsection 6b. -+ -+ d) Convey the object code by offering access from a designated -+ place (gratis or for a charge), and offer equivalent access to the -+ Corresponding Source in the same way through the same place at no -+ further charge. You need not require recipients to copy the -+ Corresponding Source along with the object code. If the place to -+ copy the object code is a network server, the Corresponding Source -+ may be on a different server (operated by you or a third party) -+ that supports equivalent copying facilities, provided you maintain -+ clear directions next to the object code saying where to find the -+ Corresponding Source. Regardless of what server hosts the -+ Corresponding Source, you remain obligated to ensure that it is -+ available for as long as needed to satisfy these requirements. -+ -+ e) Convey the object code using peer-to-peer transmission, provided -+ you inform other peers where the object code and Corresponding -+ Source of the work are being offered to the general public at no -+ charge under subsection 6d. -+ -+ A separable portion of the object code, whose source code is excluded -+from the Corresponding Source as a System Library, need not be -+included in conveying the object code work. -+ -+ A "User Product" is either (1) a "consumer product", which means any -+tangible personal property which is normally used for personal, family, -+or household purposes, or (2) anything designed or sold for incorporation -+into a dwelling. In determining whether a product is a consumer product, -+doubtful cases shall be resolved in favor of coverage. For a particular -+product received by a particular user, "normally used" refers to a -+typical or common use of that class of product, regardless of the status -+of the particular user or of the way in which the particular user -+actually uses, or expects or is expected to use, the product. A product -+is a consumer product regardless of whether the product has substantial -+commercial, industrial or non-consumer uses, unless such uses represent -+the only significant mode of use of the product. -+ -+ "Installation Information" for a User Product means any methods, -+procedures, authorization keys, or other information required to install -+and execute modified versions of a covered work in that User Product from -+a modified version of its Corresponding Source. The information must -+suffice to ensure that the continued functioning of the modified object -+code is in no case prevented or interfered with solely because -+modification has been made. -+ -+ If you convey an object code work under this section in, or with, or -+specifically for use in, a User Product, and the conveying occurs as -+part of a transaction in which the right of possession and use of the -+User Product is transferred to the recipient in perpetuity or for a -+fixed term (regardless of how the transaction is characterized), the -+Corresponding Source conveyed under this section must be accompanied -+by the Installation Information. But this requirement does not apply -+if neither you nor any third party retains the ability to install -+modified object code on the User Product (for example, the work has -+been installed in ROM). -+ -+ The requirement to provide Installation Information does not include a -+requirement to continue to provide support service, warranty, or updates -+for a work that has been modified or installed by the recipient, or for -+the User Product in which it has been modified or installed. Access to a -+network may be denied when the modification itself materially and -+adversely affects the operation of the network or violates the rules and -+protocols for communication across the network. -+ -+ Corresponding Source conveyed, and Installation Information provided, -+in accord with this section must be in a format that is publicly -+documented (and with an implementation available to the public in -+source code form), and must require no special password or key for -+unpacking, reading or copying. -+ -+ 7. Additional Terms. -+ -+ "Additional permissions" are terms that supplement the terms of this -+License by making exceptions from one or more of its conditions. -+Additional permissions that are applicable to the entire Program shall -+be treated as though they were included in this License, to the extent -+that they are valid under applicable law. If additional permissions -+apply only to part of the Program, that part may be used separately -+under those permissions, but the entire Program remains governed by -+this License without regard to the additional permissions. -+ -+ When you convey a copy of a covered work, you may at your option -+remove any additional permissions from that copy, or from any part of -+it. (Additional permissions may be written to require their own -+removal in certain cases when you modify the work.) You may place -+additional permissions on material, added by you to a covered work, -+for which you have or can give appropriate copyright permission. -+ -+ Notwithstanding any other provision of this License, for material you -+add to a covered work, you may (if authorized by the copyright holders of -+that material) supplement the terms of this License with terms: -+ -+ a) Disclaiming warranty or limiting liability differently from the -+ terms of sections 15 and 16 of this License; or -+ -+ b) Requiring preservation of specified reasonable legal notices or -+ author attributions in that material or in the Appropriate Legal -+ Notices displayed by works containing it; or -+ -+ c) Prohibiting misrepresentation of the origin of that material, or -+ requiring that modified versions of such material be marked in -+ reasonable ways as different from the original version; or -+ -+ d) Limiting the use for publicity purposes of names of licensors or -+ authors of the material; or -+ -+ e) Declining to grant rights under trademark law for use of some -+ trade names, trademarks, or service marks; or -+ -+ f) Requiring indemnification of licensors and authors of that -+ material by anyone who conveys the material (or modified versions of -+ it) with contractual assumptions of liability to the recipient, for -+ any liability that these contractual assumptions directly impose on -+ those licensors and authors. -+ -+ All other non-permissive additional terms are considered "further -+restrictions" within the meaning of section 10. If the Program as you -+received it, or any part of it, contains a notice stating that it is -+governed by this License along with a term that is a further -+restriction, you may remove that term. If a license document contains -+a further restriction but permits relicensing or conveying under this -+License, you may add to a covered work material governed by the terms -+of that license document, provided that the further restriction does -+not survive such relicensing or conveying. -+ -+ If you add terms to a covered work in accord with this section, you -+must place, in the relevant source files, a statement of the -+additional terms that apply to those files, or a notice indicating -+where to find the applicable terms. -+ -+ Additional terms, permissive or non-permissive, may be stated in the -+form of a separately written license, or stated as exceptions; -+the above requirements apply either way. -+ -+ 8. Termination. -+ -+ You may not propagate or modify a covered work except as expressly -+provided under this License. Any attempt otherwise to propagate or -+modify it is void, and will automatically terminate your rights under -+this License (including any patent licenses granted under the third -+paragraph of section 11). -+ -+ However, if you cease all violation of this License, then your -+license from a particular copyright holder is reinstated (a) -+provisionally, unless and until the copyright holder explicitly and -+finally terminates your license, and (b) permanently, if the copyright -+holder fails to notify you of the violation by some reasonable means -+prior to 60 days after the cessation. -+ -+ Moreover, your license from a particular copyright holder is -+reinstated permanently if the copyright holder notifies you of the -+violation by some reasonable means, this is the first time you have -+received notice of violation of this License (for any work) from that -+copyright holder, and you cure the violation prior to 30 days after -+your receipt of the notice. -+ -+ Termination of your rights under this section does not terminate the -+licenses of parties who have received copies or rights from you under -+this License. If your rights have been terminated and not permanently -+reinstated, you do not qualify to receive new licenses for the same -+material under section 10. -+ -+ 9. Acceptance Not Required for Having Copies. -+ -+ You are not required to accept this License in order to receive or -+run a copy of the Program. Ancillary propagation of a covered work -+occurring solely as a consequence of using peer-to-peer transmission -+to receive a copy likewise does not require acceptance. However, -+nothing other than this License grants you permission to propagate or -+modify any covered work. These actions infringe copyright if you do -+not accept this License. Therefore, by modifying or propagating a -+covered work, you indicate your acceptance of this License to do so. -+ -+ 10. Automatic Licensing of Downstream Recipients. -+ -+ Each time you convey a covered work, the recipient automatically -+receives a license from the original licensors, to run, modify and -+propagate that work, subject to this License. You are not responsible -+for enforcing compliance by third parties with this License. -+ -+ An "entity transaction" is a transaction transferring control of an -+organization, or substantially all assets of one, or subdividing an -+organization, or merging organizations. If propagation of a covered -+work results from an entity transaction, each party to that -+transaction who receives a copy of the work also receives whatever -+licenses to the work the party's predecessor in interest had or could -+give under the previous paragraph, plus a right to possession of the -+Corresponding Source of the work from the predecessor in interest, if -+the predecessor has it or can get it with reasonable efforts. -+ -+ You may not impose any further restrictions on the exercise of the -+rights granted or affirmed under this License. For example, you may -+not impose a license fee, royalty, or other charge for exercise of -+rights granted under this License, and you may not initiate litigation -+(including a cross-claim or counterclaim in a lawsuit) alleging that -+any patent claim is infringed by making, using, selling, offering for -+sale, or importing the Program or any portion of it. -+ -+ 11. Patents. -+ -+ A "contributor" is a copyright holder who authorizes use under this -+License of the Program or a work on which the Program is based. The -+work thus licensed is called the contributor's "contributor version". -+ -+ A contributor's "essential patent claims" are all patent claims -+owned or controlled by the contributor, whether already acquired or -+hereafter acquired, that would be infringed by some manner, permitted -+by this License, of making, using, or selling its contributor version, -+but do not include claims that would be infringed only as a -+consequence of further modification of the contributor version. For -+purposes of this definition, "control" includes the right to grant -+patent sublicenses in a manner consistent with the requirements of -+this License. -+ -+ Each contributor grants you a non-exclusive, worldwide, royalty-free -+patent license under the contributor's essential patent claims, to -+make, use, sell, offer for sale, import and otherwise run, modify and -+propagate the contents of its contributor version. -+ -+ In the following three paragraphs, a "patent license" is any express -+agreement or commitment, however denominated, not to enforce a patent -+(such as an express permission to practice a patent or covenant not to -+sue for patent infringement). To "grant" such a patent license to a -+party means to make such an agreement or commitment not to enforce a -+patent against the party. -+ -+ If you convey a covered work, knowingly relying on a patent license, -+and the Corresponding Source of the work is not available for anyone -+to copy, free of charge and under the terms of this License, through a -+publicly available network server or other readily accessible means, -+then you must either (1) cause the Corresponding Source to be so -+available, or (2) arrange to deprive yourself of the benefit of the -+patent license for this particular work, or (3) arrange, in a manner -+consistent with the requirements of this License, to extend the patent -+license to downstream recipients. "Knowingly relying" means you have -+actual knowledge that, but for the patent license, your conveying the -+covered work in a country, or your recipient's use of the covered work -+in a country, would infringe one or more identifiable patents in that -+country that you have reason to believe are valid. -+ -+ If, pursuant to or in connection with a single transaction or -+arrangement, you convey, or propagate by procuring conveyance of, a -+covered work, and grant a patent license to some of the parties -+receiving the covered work authorizing them to use, propagate, modify -+or convey a specific copy of the covered work, then the patent license -+you grant is automatically extended to all recipients of the covered -+work and works based on it. -+ -+ A patent license is "discriminatory" if it does not include within -+the scope of its coverage, prohibits the exercise of, or is -+conditioned on the non-exercise of one or more of the rights that are -+specifically granted under this License. You may not convey a covered -+work if you are a party to an arrangement with a third party that is -+in the business of distributing software, under which you make payment -+to the third party based on the extent of your activity of conveying -+the work, and under which the third party grants, to any of the -+parties who would receive the covered work from you, a discriminatory -+patent license (a) in connection with copies of the covered work -+conveyed by you (or copies made from those copies), or (b) primarily -+for and in connection with specific products or compilations that -+contain the covered work, unless you entered into that arrangement, -+or that patent license was granted, prior to 28 March 2007. -+ -+ Nothing in this License shall be construed as excluding or limiting -+any implied license or other defenses to infringement that may -+otherwise be available to you under applicable patent law. -+ -+ 12. No Surrender of Others' Freedom. -+ -+ If conditions are imposed on you (whether by court order, agreement or -+otherwise) that contradict the conditions of this License, they do not -+excuse you from the conditions of this License. If you cannot convey a -+covered work so as to satisfy simultaneously your obligations under this -+License and any other pertinent obligations, then as a consequence you may -+not convey it at all. For example, if you agree to terms that obligate you -+to collect a royalty for further conveying from those to whom you convey -+the Program, the only way you could satisfy both those terms and this -+License would be to refrain entirely from conveying the Program. -+ -+ 13. Use with the GNU Affero General Public License. -+ -+ Notwithstanding any other provision of this License, you have -+permission to link or combine any covered work with a work licensed -+under version 3 of the GNU Affero General Public License into a single -+combined work, and to convey the resulting work. The terms of this -+License will continue to apply to the part which is the covered work, -+but the special requirements of the GNU Affero General Public License, -+section 13, concerning interaction through a network will apply to the -+combination as such. -+ -+ 14. Revised Versions of this License. -+ -+ The Free Software Foundation may publish revised and/or new versions of -+the GNU General Public License from time to time. Such new versions will -+be similar in spirit to the present version, but may differ in detail to -+address new problems or concerns. -+ -+ Each version is given a distinguishing version number. If the -+Program specifies that a certain numbered version of the GNU General -+Public License "or any later version" applies to it, you have the -+option of following the terms and conditions either of that numbered -+version or of any later version published by the Free Software -+Foundation. If the Program does not specify a version number of the -+GNU General Public License, you may choose any version ever published -+by the Free Software Foundation. -+ -+ If the Program specifies that a proxy can decide which future -+versions of the GNU General Public License can be used, that proxy's -+public statement of acceptance of a version permanently authorizes you -+to choose that version for the Program. -+ -+ Later license versions may give you additional or different -+permissions. However, no additional obligations are imposed on any -+author or copyright holder as a result of your choosing to follow a -+later version. -+ -+ 15. Disclaimer of Warranty. -+ -+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -+ALL NECESSARY SERVICING, REPAIR OR CORRECTION. -+ -+ 16. Limitation of Liability. -+ -+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -+SUCH DAMAGES. -+ -+ 17. Interpretation of Sections 15 and 16. -+ -+ If the disclaimer of warranty and limitation of liability provided -+above cannot be given local legal effect according to their terms, -+reviewing courts shall apply local law that most closely approximates -+an absolute waiver of all civil liability in connection with the -+Program, unless a warranty or assumption of liability accompanies a -+copy of the Program in return for a fee. -+ -+ END OF TERMS AND CONDITIONS -+ -+ How to Apply These Terms to Your New Programs -+ -+ If you develop a new program, and you want it to be of the greatest -+possible use to the public, the best way to achieve this is to make it -+free software which everyone can redistribute and change under these terms. -+ -+ To do so, attach the following notices to the program. It is safest -+to attach them to the start of each source file to most effectively -+state the exclusion of warranty; and each file should have at least -+the "copyright" line and a pointer to where the full notice is found. -+ -+ -+ Copyright (C) -+ -+ 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 . -+ -+Also add information on how to contact you by electronic and paper mail. -+ -+ If the program does terminal interaction, make it output a short -+notice like this when it starts in an interactive mode: -+ -+ Copyright (C) -+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. -+ This is free software, and you are welcome to redistribute it -+ under certain conditions; type `show c' for details. -+ -+The hypothetical commands `show w' and `show c' should show the appropriate -+parts of the General Public License. Of course, your program's commands -+might be different; for a GUI interface, you would use an "about box". -+ -+ You should also get your employer (if you work as a programmer) or school, -+if any, to sign a "copyright disclaimer" for the program, if necessary. -+For more information on this, and how to apply and follow the GNU GPL, see -+. -+ -+ The GNU General Public License does not permit incorporating your program -+into proprietary programs. If your program is a subroutine library, you -+may consider it more useful to permit linking proprietary applications with -+the library. If this is what you want to do, use the GNU Lesser General -+Public License instead of this License. But first, please read -+. -diff --git a/Common/checkbutton.cpp b/Common/checkbutton.cpp -index 14ae327..9962a15 100644 ---- a/Common/checkbutton.cpp -+++ b/Common/checkbutton.cpp -@@ -1,11 +1,10 @@ --/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -- * -+/* - * Copyright (C) 2019 Tianjin KYLIN Information Technology 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 2 of the License, or -- * (at your option) any later version. -+ * the Free Software Foundation; either version 3, 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 -@@ -13,10 +12,9 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -+ * along with this program; if not, see . - * -- */ -+**/ - - #include "checkbutton.h" - -diff --git a/Common/checkbutton.h b/Common/checkbutton.h -index d6167c9..59f3463 100644 ---- a/Common/checkbutton.h -+++ b/Common/checkbutton.h -@@ -1,11 +1,10 @@ --/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -- * -+/* - * Copyright (C) 2019 Tianjin KYLIN Information Technology 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 2 of the License, or -- * (at your option) any later version. -+ * the Free Software Foundation; either version 3, 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 -@@ -13,10 +12,9 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -+ * along with this program; if not, see . - * -- */ -+**/ - - #ifndef CHECKBUTTON_H - #define CHECKBUTTON_H -diff --git a/Common/commonfunc.cpp b/Common/commonfunc.cpp -index c80213b..e9aacce 100644 ---- a/Common/commonfunc.cpp -+++ b/Common/commonfunc.cpp -@@ -1,11 +1,10 @@ --/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -- * -+/* - * Copyright (C) 2019 Tianjin KYLIN Information Technology 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 2 of the License, or -- * (at your option) any later version. -+ * the Free Software Foundation; either version 3, 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 -@@ -13,10 +12,9 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -+ * along with this program; if not, see . - * -- */ -+**/ - - #include - #include -diff --git a/Common/commonfunc.h b/Common/commonfunc.h -index 43ab4a9..d8f0d02 100644 ---- a/Common/commonfunc.h -+++ b/Common/commonfunc.h -@@ -1,11 +1,10 @@ --/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -- * -+/* - * Copyright (C) 2019 Tianjin KYLIN Information Technology 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 2 of the License, or -- * (at your option) any later version. -+ * the Free Software Foundation; either version 3, 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 -@@ -13,10 +12,9 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -+ * along with this program; if not, see . - * -- */ -+**/ - - #ifndef COMMONFUNC_H - #define COMMONFUNC_H -diff --git a/KylinNM/src/swipegesturerecognizer.cpp b/KylinNM/src/swipegesturerecognizer.cpp -index 87b553c..dd888c3 100644 ---- a/KylinNM/src/swipegesturerecognizer.cpp -+++ b/KylinNM/src/swipegesturerecognizer.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include - #include - -diff --git a/KylinNM/src/swipegesturerecognizer.h b/KylinNM/src/swipegesturerecognizer.h -index 2e51665..4b6c7b8 100644 ---- a/KylinNM/src/swipegesturerecognizer.h -+++ b/KylinNM/src/swipegesturerecognizer.h -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 SWIPEGESTURERECOGNIZER_H - #define SWIPEGESTURERECOGNIZER_H - -diff --git a/KylinNM/src/switchbutton.cpp b/KylinNM/src/switchbutton.cpp -index 714e249..43ad098 100644 ---- a/KylinNM/src/switchbutton.cpp -+++ b/KylinNM/src/switchbutton.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include "switchbutton.h" - - SwitchButton::SwitchButton(QWidget *parent) : QWidget(parent) -diff --git a/KylinNM/src/switchbutton.h b/KylinNM/src/switchbutton.h -index 7c0f1e5..8c86bc2 100644 ---- a/KylinNM/src/switchbutton.h -+++ b/KylinNM/src/switchbutton.h -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 SWITCHBUTTON_H - #define SWITCHBUTTON_H - -diff --git a/VirtualKeyboard/src/cursormonitor.cpp b/VirtualKeyboard/src/cursormonitor.cpp -index 2c76123..9553a60 100644 ---- a/VirtualKeyboard/src/cursormonitor.cpp -+++ b/VirtualKeyboard/src/cursormonitor.cpp -@@ -1,9 +1,9 @@ --/** -+/* - * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) -+ * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, -@@ -12,9 +12,8 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -- * 02110-1301, USA. -+ * along with this program; if not, see . -+ * - **/ - #include "cursormonitor.h" - #include -diff --git a/VirtualKeyboard/src/cursormonitor.h b/VirtualKeyboard/src/cursormonitor.h -index 7722453..bacf21f 100644 ---- a/VirtualKeyboard/src/cursormonitor.h -+++ b/VirtualKeyboard/src/cursormonitor.h -@@ -1,9 +1,9 @@ --/** -+/* - * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) -+ * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, -@@ -12,9 +12,8 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -- * 02110-1301, USA. -+ * along with this program; if not, see . -+ * - **/ - #ifndef CURSORMONITOR_H - #define CURSORMONITOR_H -diff --git a/VirtualKeyboard/src/keyboardwidget.cpp b/VirtualKeyboard/src/keyboardwidget.cpp -index e97a710..be86698 100644 ---- a/VirtualKeyboard/src/keyboardwidget.cpp -+++ b/VirtualKeyboard/src/keyboardwidget.cpp -@@ -1,9 +1,9 @@ --/** -+/* - * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) -+ * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, -@@ -12,9 +12,8 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -- * 02110-1301, USA. -+ * along with this program; if not, see . -+ * - **/ - #include "keyboardwidget.h" - #include "ui_keyboardwidget.h" -diff --git a/VirtualKeyboard/src/keyboardwidget.h b/VirtualKeyboard/src/keyboardwidget.h -index 25591ae..d735ebd 100644 ---- a/VirtualKeyboard/src/keyboardwidget.h -+++ b/VirtualKeyboard/src/keyboardwidget.h -@@ -1,9 +1,9 @@ --/** -+/* - * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) -+ * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, -@@ -12,9 +12,8 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -- * 02110-1301, USA. -+ * along with this program; if not, see . -+ * - **/ - #ifndef KEYBOARDWIDGET_H - #define KEYBOARDWIDGET_H -diff --git a/VirtualKeyboard/src/virtualkeyboard.cpp b/VirtualKeyboard/src/virtualkeyboard.cpp -index bdc65a7..0ad995f 100644 ---- a/VirtualKeyboard/src/virtualkeyboard.cpp -+++ b/VirtualKeyboard/src/virtualkeyboard.cpp -@@ -1,9 +1,9 @@ --/** -+/* - * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) -+ * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, -@@ -12,9 +12,8 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -- * 02110-1301, USA. -+ * along with this program; if not, see . -+ * - **/ - #include "virtualkeyboard.h" - #include -diff --git a/VirtualKeyboard/src/virtualkeyboard.h b/VirtualKeyboard/src/virtualkeyboard.h -index 44b628a..8bdbc52 100644 ---- a/VirtualKeyboard/src/virtualkeyboard.h -+++ b/VirtualKeyboard/src/virtualkeyboard.h -@@ -1,9 +1,9 @@ --/** -+/* - * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) -+ * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, -@@ -12,9 +12,8 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -- * 02110-1301, USA. -+ * along with this program; if not, see . -+ * - **/ - #ifndef VIRTUALKEYBOARD_H - #define VIRTUALKEYBOARD_H -diff --git a/VirtualKeyboard/src/vkstackedwidget.cpp b/VirtualKeyboard/src/vkstackedwidget.cpp -index 1e966bb..3e46729 100644 ---- a/VirtualKeyboard/src/vkstackedwidget.cpp -+++ b/VirtualKeyboard/src/vkstackedwidget.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include "vkstackedwidget.h" - - VKStackedWidget::VKStackedWidget(QWidget *parent/* = nullptr*/) -diff --git a/VirtualKeyboard/src/vkstackedwidget.h b/VirtualKeyboard/src/vkstackedwidget.h -index 8ca4994..fb737ff 100644 ---- a/VirtualKeyboard/src/vkstackedwidget.h -+++ b/VirtualKeyboard/src/vkstackedwidget.h -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 VKSTACKEDWIDGET_H - #define VKSTACKEDWIDGET_H - -diff --git a/VirtualKeyboard/src/x11keyboard.cpp b/VirtualKeyboard/src/x11keyboard.cpp -index 5e160ed..02a196a 100644 ---- a/VirtualKeyboard/src/x11keyboard.cpp -+++ b/VirtualKeyboard/src/x11keyboard.cpp -@@ -1,9 +1,9 @@ --/** -+/* - * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) -+ * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, -@@ -12,9 +12,8 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -- * 02110-1301, USA. -+ * along with this program; if not, see . -+ * - **/ - #include "x11keyboard.h" - #include -diff --git a/VirtualKeyboard/src/x11keyboard.h b/VirtualKeyboard/src/x11keyboard.h -index 42fd997..f3bf757 100644 ---- a/VirtualKeyboard/src/x11keyboard.h -+++ b/VirtualKeyboard/src/x11keyboard.h -@@ -1,9 +1,9 @@ --/** -+/* - * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) -+ * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, -@@ -12,9 +12,8 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -- * 02110-1301, USA. -+ * along with this program; if not, see . -+ * - **/ - #ifndef X11KEYBOARD_H - #define X11KEYBOARD_H -diff --git a/examples/LoadCustomPlugin/widget.h b/examples/LoadCustomPlugin/widget.h -index 43d6a87..02e7658 100644 ---- a/examples/LoadCustomPlugin/widget.h -+++ b/examples/LoadCustomPlugin/widget.h -@@ -1,4 +1,21 @@ --#ifndef WIDGET_H -+/* -+ * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 WIDGET_H - #define WIDGET_H - - #include -diff --git a/screensaver-focus-helper/blackwindow.cpp b/screensaver-focus-helper/blackwindow.cpp -index 52f270e..0830595 100644 ---- a/screensaver-focus-helper/blackwindow.cpp -+++ b/screensaver-focus-helper/blackwindow.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include "blackwindow.h" - #include - #include -diff --git a/screensaver-focus-helper/blackwindow.h b/screensaver-focus-helper/blackwindow.h -index 9f30d24..6d1f071 100644 ---- a/screensaver-focus-helper/blackwindow.h -+++ b/screensaver-focus-helper/blackwindow.h -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 BLACKWINDOW_H - #define BLACKWINDOW_H - -diff --git a/screensaver-focus-helper/main.cpp b/screensaver-focus-helper/main.cpp -index 35a93f6..70b9982 100644 ---- a/screensaver-focus-helper/main.cpp -+++ b/screensaver-focus-helper/main.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include - #include - #include -diff --git a/screensaver/customplugin.cpp b/screensaver/customplugin.cpp -index afacc06..0ac4702 100644 ---- a/screensaver/customplugin.cpp -+++ b/screensaver/customplugin.cpp -@@ -1,4 +1,21 @@ --#include "customplugin.h" -+/* -+ * Copyright (C) 2018 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ -+#include "customplugin.h" - #include "screensaver.h" - - CustomPlugin::CustomPlugin(QObject *parent):QObject(parent) -diff --git a/screensaver/customplugin.h b/screensaver/customplugin.h -index 2d041f7..49f3b07 100644 ---- a/screensaver/customplugin.h -+++ b/screensaver/customplugin.h -@@ -1,4 +1,21 @@ --#ifndef CUSTOMPLUGIN_H -+/* -+ * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 CUSTOMPLUGIN_H - #define CUSTOMPLUGIN_H - - #include "screensaverplugin.h" -diff --git a/screensaver/cyclelabel.cpp b/screensaver/cyclelabel.cpp -index a97f42f..f6c847a 100644 ---- a/screensaver/cyclelabel.cpp -+++ b/screensaver/cyclelabel.cpp -@@ -1,11 +1,10 @@ --/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -- * -+/* - * Copyright (C) 2019 Tianjin KYLIN Information Technology 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 2 of the License, or -- * (at your option) any later version. -+ * the Free Software Foundation; either version 3, 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 -@@ -13,10 +12,9 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -+ * along with this program; if not, see . - * -- */ -+**/ - - #include "cyclelabel.h" - -diff --git a/screensaver/cyclelabel.h b/screensaver/cyclelabel.h -index 9967836..b8b2af6 100644 ---- a/screensaver/cyclelabel.h -+++ b/screensaver/cyclelabel.h -@@ -1,11 +1,10 @@ --/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -- * -+/* - * Copyright (C) 2019 Tianjin KYLIN Information Technology 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 2 of the License, or -- * (at your option) any later version. -+ * the Free Software Foundation; either version 3, 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 -@@ -13,10 +12,9 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -+ * along with this program; if not, see . - * -- */ -+**/ - - #ifndef CYCLELABEL_H - #define CYCLELABEL_H -diff --git a/screensaver/screensaver.cpp b/screensaver/screensaver.cpp -index 5c06727..fb5acd0 100644 ---- a/screensaver/screensaver.cpp -+++ b/screensaver/screensaver.cpp -@@ -637,6 +637,10 @@ void Screensaver::setUpdateCenterWidget() - QString languageDirPath=cwdPath+"language/"; - QString defaultLanguageFilePath=languageDirPath+"screensaver-en_US.ini"; - qDebug()<<"homePath="<childGroups(); -@@ -1197,6 +1201,8 @@ void Screensaver::setPreviewText(bool bVisible) - - void Screensaver::setCenterWidget() - { -+ if (!qsettings) -+ return ; - QStringList qlist = qsettings->childGroups(); - if(qlist.count()<1) - return; -diff --git a/screensaver/screensaver.h b/screensaver/screensaver.h -index 39bb7a1..e010fe1 100644 ---- a/screensaver/screensaver.h -+++ b/screensaver/screensaver.h -@@ -111,7 +111,7 @@ private: - QPushButton *settingsButton; - QPushButton *WallpaperButton; - QWidget *buttonWidget; -- QSettings *qsettings; -+ QSettings *qsettings = nullptr; - - MBackground *m_background; - -diff --git a/screensaver/screensaverplugin.h b/screensaver/screensaverplugin.h -index 041bf38..4fcd9ff 100644 ---- a/screensaver/screensaverplugin.h -+++ b/screensaver/screensaverplugin.h -@@ -1,4 +1,21 @@ --#ifndef SCREENSAVER_PLUGIN_H -+/* -+ * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 SCREENSAVER_PLUGIN_H - #define SCREENSAVER_PLUGIN_H - - #include -diff --git a/set4kScale/main.cpp b/set4kScale/main.cpp -index 5ec6932..5042642 100644 ---- a/set4kScale/main.cpp -+++ b/set4kScale/main.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include - #include - #include -diff --git a/src/PhysicalDeviceSet/brightnessdeviceset.cpp b/src/PhysicalDeviceSet/brightnessdeviceset.cpp -index 455c5d0..5e25b9f 100644 ---- a/src/PhysicalDeviceSet/brightnessdeviceset.cpp -+++ b/src/PhysicalDeviceSet/brightnessdeviceset.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include "brightnessdeviceset.h" - - int BrightnessDeviceSet::m_value = -1; -diff --git a/src/PhysicalDeviceSet/brightnessdeviceset.h b/src/PhysicalDeviceSet/brightnessdeviceset.h -index 77cd162..c361c9d 100644 ---- a/src/PhysicalDeviceSet/brightnessdeviceset.h -+++ b/src/PhysicalDeviceSet/brightnessdeviceset.h -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 BRIGHTNESSDEVICESET_H - #define BRIGHTNESSDEVICESET_H - -diff --git a/src/PhysicalDeviceSet/flightmodeset.cpp b/src/PhysicalDeviceSet/flightmodeset.cpp -index adcbf67..33e4616 100644 ---- a/src/PhysicalDeviceSet/flightmodeset.cpp -+++ b/src/PhysicalDeviceSet/flightmodeset.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include "flightmodeset.h" - - bool FlightModeSet::m_isFlightModeOpen = false; -diff --git a/src/PhysicalDeviceSet/flightmodeset.h b/src/PhysicalDeviceSet/flightmodeset.h -index 57842a4..3efcd0a 100644 ---- a/src/PhysicalDeviceSet/flightmodeset.h -+++ b/src/PhysicalDeviceSet/flightmodeset.h -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 FLIGHTMODESET_H - #define FLIGHTMODESET_H - /*! -diff --git a/src/PhysicalDeviceSet/sounddeviceset.cpp b/src/PhysicalDeviceSet/sounddeviceset.cpp -index f16ba8c..876708f 100644 ---- a/src/PhysicalDeviceSet/sounddeviceset.cpp -+++ b/src/PhysicalDeviceSet/sounddeviceset.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include "sounddeviceset.h" - - int SoundDeviceSet::m_value = -1; -diff --git a/src/PhysicalDeviceSet/sounddeviceset.h b/src/PhysicalDeviceSet/sounddeviceset.h -index 2b98aaa..12701bd 100644 ---- a/src/PhysicalDeviceSet/sounddeviceset.h -+++ b/src/PhysicalDeviceSet/sounddeviceset.h -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 SOUNDDEVICESET_H - #define SOUNDDEVICESET_H - -diff --git a/src/PhysicalDeviceSet/touchscreenset.cpp b/src/PhysicalDeviceSet/touchscreenset.cpp -index 0ba4449..9884078 100644 ---- a/src/PhysicalDeviceSet/touchscreenset.cpp -+++ b/src/PhysicalDeviceSet/touchscreenset.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include "touchscreenset.h" - - #include -diff --git a/src/PhysicalDeviceSet/touchscreenset.h b/src/PhysicalDeviceSet/touchscreenset.h -index fd6c5ef..096ce9e 100644 ---- a/src/PhysicalDeviceSet/touchscreenset.h -+++ b/src/PhysicalDeviceSet/touchscreenset.h -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 TOUCHSCREENSET_H - #define TOUCHSCREENSET_H - -diff --git a/src/accountsinterface.cpp b/src/accountsinterface.cpp -index 4b6abb5..7bc8cbb 100644 ---- a/src/accountsinterface.cpp -+++ b/src/accountsinterface.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2019 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include "accountsinterface.h" - - const QString STR_EDU_SERVICE = "cn.kylinos.SSOBackend"; -diff --git a/src/accountsinterface.h b/src/accountsinterface.h -index cc97edd..2e1a0d5 100644 ---- a/src/accountsinterface.h -+++ b/src/accountsinterface.h -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 ACCOUNTSINTERFACE_H - #define ACCOUNTSINTERFACE_H - -diff --git a/src/authdialog.cpp b/src/authdialog.cpp -index 07f9e26..fae337d 100644 ---- a/src/authdialog.cpp -+++ b/src/authdialog.cpp -@@ -366,8 +366,8 @@ void AuthDialog::resizeEvent(QResizeEvent *) - - void AuthDialog::setChildrenGeometry() - { -- if(scale < 0.5) -- setFixedWidth(500); -+// if(scale < 0.5) -+// setFixedWidth(500); - // 用户信息显示位置 - m_userWidget->setGeometry(0, 0, - width(), 376*scale); -diff --git a/src/batterywidget.cpp b/src/batterywidget.cpp -index 2cc74e4..d0a1c72 100644 ---- a/src/batterywidget.cpp -+++ b/src/batterywidget.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include "batterywidget.h" - #include - #include -diff --git a/src/batterywidget.h b/src/batterywidget.h -index b9d460c..acf9ac5 100644 ---- a/src/batterywidget.h -+++ b/src/batterywidget.h -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 BATTERYWIDGET_H - #define BATTERYWIDGET_H - -diff --git a/src/common.h b/src/common.h -index b7ed8c8..95489cb 100644 ---- a/src/common.h -+++ b/src/common.h -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 LOCKCOMMON_H - #define LOCKCOMMON_H - -diff --git a/src/device.cpp b/src/device.cpp -index f7a62c2..007d30a 100644 ---- a/src/device.cpp -+++ b/src/device.cpp -@@ -1,10 +1,10 @@ - /* -- * Copyright 2021 KylinSoft Co., Ltd. -+ * Copyright (C) 2021 Tianjin KYLIN Information Technology Co., Ltd. - * -- * This program is free software: you can redistribute it and/or modify -+ * 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. -+ * the Free Software Foundation; either version 3, 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 -@@ -12,8 +12,9 @@ - * 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 . -- */ -+ * along with this program; if not, see . -+ * -+**/ - - #include "device.h" - #include -diff --git a/src/device.h b/src/device.h -index fd72185..73c8615 100644 ---- a/src/device.h -+++ b/src/device.h -@@ -1,10 +1,10 @@ - /* -- * Copyright 2021 KylinSoft Co., Ltd. -+ * Copyright (C) 2021 Tianjin KYLIN Information Technology Co., Ltd. - * -- * This program is free software: you can redistribute it and/or modify -+ * 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. -+ * the Free Software Foundation; either version 3, 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 -@@ -12,8 +12,9 @@ - * 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 . -- */ -+ * along with this program; if not, see . -+ * -+**/ - - #ifndef DEVICE_H - #define DEVICE_H -diff --git a/src/digitalkeyboard.cpp b/src/digitalkeyboard.cpp -index 77239ba..4597ad4 100644 ---- a/src/digitalkeyboard.cpp -+++ b/src/digitalkeyboard.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include "digitalkeyboard.h" - - #include -diff --git a/src/digitalkeyboard.h b/src/digitalkeyboard.h -index 107a115..4a386fe 100644 ---- a/src/digitalkeyboard.h -+++ b/src/digitalkeyboard.h -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2018 Tianjin KYLIN Information Technology 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, 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 DIGITALKEYBOARD_H - #define DIGITALKEYBOARD_H - -diff --git a/src/eduplatforminterface.cpp b/src/eduplatforminterface.cpp -index 47084ef..6f3384c 100644 ---- a/src/eduplatforminterface.cpp -+++ b/src/eduplatforminterface.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include "eduplatforminterface.h" - - const QString STR_EDU_SERVICE = "cn.kylinos.SSOBackend"; -diff --git a/src/eduplatforminterface.h b/src/eduplatforminterface.h -index 60e72dc..0a93506 100644 ---- a/src/eduplatforminterface.h -+++ b/src/eduplatforminterface.h -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 EDUPLATFORMINTERFACE_H - #define EDUPLATFORMINTERFACE_H - #include -diff --git a/src/enginedevice.cpp b/src/enginedevice.cpp -index f67ff9c..f69c95e 100644 ---- a/src/enginedevice.cpp -+++ b/src/enginedevice.cpp -@@ -1,10 +1,10 @@ - /* -- * Copyright 2021 KylinSoft Co., Ltd. -+ * Copyright (C) 2021 Tianjin KYLIN Information Technology Co., Ltd. - * -- * This program is free software: you can redistribute it and/or modify -+ * 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. -+ * the Free Software Foundation; either version 3, 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 -@@ -12,9 +12,9 @@ - * 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 . -- */ -- -+ * along with this program; if not, see . -+ * -+**/ - #include "enginedevice.h" - #include "device.h" - #include -diff --git a/src/hoverwidget.cpp b/src/hoverwidget.cpp -index 67f142d..3c3b55e 100644 ---- a/src/hoverwidget.cpp -+++ b/src/hoverwidget.cpp -@@ -1,11 +1,10 @@ --/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -- * -+/* - * Copyright (C) 2019 Tianjin KYLIN Information Technology 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 2 of the License, or -- * (at your option) any later version. -+ * the Free Software Foundation; either version 3, 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 -@@ -13,10 +12,9 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -+ * along with this program; if not, see . - * -- */ -+**/ - #include "hoverwidget.h" - - #include -diff --git a/src/hoverwidget.h b/src/hoverwidget.h -index bcb811e..1fcf667 100644 ---- a/src/hoverwidget.h -+++ b/src/hoverwidget.h -@@ -1,11 +1,10 @@ --/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -- * -+/* - * Copyright (C) 2019 Tianjin KYLIN Information Technology 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 2 of the License, or -- * (at your option) any later version. -+ * the Free Software Foundation; either version 3, 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 -@@ -13,10 +12,9 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -+ * along with this program; if not, see . - * -- */ -+**/ - #ifndef HOVERWIDGET_H - #define HOVERWIDGET_H - -diff --git a/src/iconedit.cpp b/src/iconedit.cpp -index 5280ac8..1f8cf87 100644 ---- a/src/iconedit.cpp -+++ b/src/iconedit.cpp -@@ -1,9 +1,9 @@ --/* iconedit.cpp -+/* - * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) -+ * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, -@@ -12,9 +12,8 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -- * 02110-1301, USA. -+ * along with this program; if not, see . -+ * - **/ - #include "iconedit.h" - #include "imageutil.h" -diff --git a/src/iconedit.h b/src/iconedit.h -index 729197d..587f425 100644 ---- a/src/iconedit.h -+++ b/src/iconedit.h -@@ -1,9 +1,9 @@ --/* iconedit.h -+/* - * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) -+ * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, -@@ -12,9 +12,8 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -- * 02110-1301, USA. -+ * along with this program; if not, see . -+ * - **/ - - #ifndef ICONEDIT_H -diff --git a/src/imageutil.cpp b/src/imageutil.cpp -index 928d63f..11fe92f 100644 ---- a/src/imageutil.cpp -+++ b/src/imageutil.cpp -@@ -1,11 +1,10 @@ --/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -- * -+/* - * Copyright (C) 2019 Tianjin KYLIN Information Technology 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 2 of the License, or -- * (at your option) any later version. -+ * the Free Software Foundation; either version 3, 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 -@@ -13,10 +12,9 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -+ * along with this program; if not, see . - * -- */ -+**/ - - #include "imageutil.h" - -diff --git a/src/imageutil.h b/src/imageutil.h -index 92c09d8..ae40c46 100644 ---- a/src/imageutil.h -+++ b/src/imageutil.h -@@ -1,11 +1,10 @@ --/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -- * -+/* - * Copyright (C) 2019 Tianjin KYLIN Information Technology 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 2 of the License, or -- * (at your option) any later version. -+ * the Free Software Foundation; either version 3, 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 -@@ -13,10 +12,9 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -+ * along with this program; if not, see . - * -- */ -+**/ - - #ifndef IMAGEUTIL_H - #define IMAGEUTIL_H -diff --git a/src/libinputswitchevent.cpp b/src/libinputswitchevent.cpp -index a9aea94..0f30800 100644 ---- a/src/libinputswitchevent.cpp -+++ b/src/libinputswitchevent.cpp -@@ -1,20 +1,20 @@ - /* -- * Copyright 2022 KylinSoft Co., Ltd. -+ * Copyright (C) 2022 Tianjin KYLIN Information Technology Co., Ltd. - * -- * This program is free software: you can redistribute it and/or modify -+ * 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 2 of the License, or -- * (at your option) any later version. -+ * the Free Software Foundation; either version 3, 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 thi1s program; if not, write to the Free Software Foundation, Inc., -- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -- */ -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, see . -+ * -+**/ - - #include "libinputswitchevent.h" - -diff --git a/src/lockchecker.cpp b/src/lockchecker.cpp -index 7cc44e3..c0533cf 100644 ---- a/src/lockchecker.cpp -+++ b/src/lockchecker.cpp -@@ -1,5 +1,5 @@ - /* -- * Copyright (C) Copyright 2021 KylinSoft Co., Ltd. -+ * Copyright (C) 2021 Tianjin KYLIN Information Technology 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 -diff --git a/src/loginedusers.cpp b/src/loginedusers.cpp -index 5d7f440..bd4d247 100644 ---- a/src/loginedusers.cpp -+++ b/src/loginedusers.cpp -@@ -3,8 +3,8 @@ - * - * 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 2 of the License, or -- * (at your option) any later version. -+ * the Free Software Foundation; either version 3, 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 -@@ -12,10 +12,9 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -+ * along with this program; if not, see . - * -- */ -+**/ - - #include "loginedusers.h" - -diff --git a/src/loginedusers.h b/src/loginedusers.h -index c69ebe5..de1b175 100644 ---- a/src/loginedusers.h -+++ b/src/loginedusers.h -@@ -1,11 +1,10 @@ --/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -- * -+/* - * Copyright (C) 2019 Tianjin KYLIN Information Technology 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 2 of the License, or -- * (at your option) any later version. -+ * the Free Software Foundation; either version 3, 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 -@@ -13,10 +12,9 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -+ * along with this program; if not, see . - * -- */ -+**/ - - #ifndef LOGINEDUSER_H - #define LOGINEDUSER_H -diff --git a/src/loginoptionswidget.cpp b/src/loginoptionswidget.cpp -index 943cbff..cab7a65 100644 ---- a/src/loginoptionswidget.cpp -+++ b/src/loginoptionswidget.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include "loginoptionswidget.h" - - #include -diff --git a/src/loginoptionswidget.h b/src/loginoptionswidget.h -index c8630da..256ab5c 100644 ---- a/src/loginoptionswidget.h -+++ b/src/loginoptionswidget.h -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 LOGINOPTIONSWIDGET_H - #define LOGINOPTIONSWIDGET_H - -diff --git a/src/monitorwatcher.h b/src/monitorwatcher.h -index 224aeac..0f10599 100644 ---- a/src/monitorwatcher.h -+++ b/src/monitorwatcher.h -@@ -1,9 +1,9 @@ --/* monitorwatcher.h -+/* - * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) -+ * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, -@@ -12,9 +12,8 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -- * 02110-1301, USA. -+ * along with this program; if not, see . -+ * - **/ - #ifndef MONITORWATCHER_H - #define MONITORWATCHER_H -diff --git a/src/mytabwidget.cpp b/src/mytabwidget.cpp -index 7256584..dcc2e20 100644 ---- a/src/mytabwidget.cpp -+++ b/src/mytabwidget.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include "mytabwidget.h" - #include - #include -diff --git a/src/mytabwidget.h b/src/mytabwidget.h -index 65ff60a..732d44d 100644 ---- a/src/mytabwidget.h -+++ b/src/mytabwidget.h -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 MYTABWIDGET_H - #define MYTABWIDGET_H - -diff --git a/src/networkwatcher.cpp b/src/networkwatcher.cpp -index 313eabb..3c57a49 100644 ---- a/src/networkwatcher.cpp -+++ b/src/networkwatcher.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include - #include - #include -diff --git a/src/networkwatcher.h b/src/networkwatcher.h -index 71d3d28..a388266 100644 ---- a/src/networkwatcher.h -+++ b/src/networkwatcher.h -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 NETWORKWATCHER_H - #define NETWORKWATCHER_H - #include -diff --git a/src/permissioncheck.h b/src/permissioncheck.h -index 94639e5..3af7e9c 100644 ---- a/src/permissioncheck.h -+++ b/src/permissioncheck.h -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 PERMISSIONCHECK_H - #define PERMISSIONCHECK_H - -diff --git a/src/plasma-shell-manager.cpp b/src/plasma-shell-manager.cpp -index f987e4e..98659f0 100644 ---- a/src/plasma-shell-manager.cpp -+++ b/src/plasma-shell-manager.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include "plasma-shell-manager.h" - - #include -diff --git a/src/plasma-shell-manager.h b/src/plasma-shell-manager.h -index 1437a88..35516aa 100644 ---- a/src/plasma-shell-manager.h -+++ b/src/plasma-shell-manager.h -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 PLASMASHELLMANAGER_H - #define PLASMASHELLMANAGER_H - -diff --git a/src/screensaverwndadaptor.cpp b/src/screensaverwndadaptor.cpp -index 34761ed..8d4b9a5 100644 ---- a/src/screensaverwndadaptor.cpp -+++ b/src/screensaverwndadaptor.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include "screensaverwndadaptor.h" - - #include -diff --git a/src/screensaverwndadaptor.h b/src/screensaverwndadaptor.h -index 0641c0c..77c3dde 100644 ---- a/src/screensaverwndadaptor.h -+++ b/src/screensaverwndadaptor.h -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 SCREENSAVERWNDADAPTOR_H - #define SCREENSAVERWNDADAPTOR_H - -diff --git a/src/surewindow.cpp b/src/surewindow.cpp -index 8ee86e4..d8f07ea 100644 ---- a/src/surewindow.cpp -+++ b/src/surewindow.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include "surewindow.h" - #include "ui_surewindow.h" - #include -diff --git a/src/surewindow.h b/src/surewindow.h -index 8f15d27..62bc402 100644 ---- a/src/surewindow.h -+++ b/src/surewindow.h -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 SUREWINDOW_H - #define SUREWINDOW_H - -diff --git a/src/ukui-screensaver-checkpass.cpp b/src/ukui-screensaver-checkpass.cpp -index 6f48647..165259d 100644 ---- a/src/ukui-screensaver-checkpass.cpp -+++ b/src/ukui-screensaver-checkpass.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2018 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include - #include - #include -diff --git a/src/utils.cpp b/src/utils.cpp -index e5b7f50..dc5e9bc 100644 ---- a/src/utils.cpp -+++ b/src/utils.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2018 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include "utils.h" - #include - -diff --git a/src/utils.h b/src/utils.h -index 4966654..b00b483 100644 ---- a/src/utils.h -+++ b/src/utils.h -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 UTILS_H - #define UTILS_H - -diff --git a/src/verificationwidget.cpp b/src/verificationwidget.cpp -index edbb92f..9acb3e4 100644 ---- a/src/verificationwidget.cpp -+++ b/src/verificationwidget.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include "verificationwidget.h" - #include - #include -diff --git a/src/verificationwidget.h b/src/verificationwidget.h -index cbc13e7..973017e 100644 ---- a/src/verificationwidget.h -+++ b/src/verificationwidget.h -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 VERIFICATIONWIDGET_H - #define VERIFICATIONWIDGET_H - -diff --git a/src/verticalVerificationwidget.cpp b/src/verticalVerificationwidget.cpp -index 1dd912a..e848a45 100644 ---- a/src/verticalVerificationwidget.cpp -+++ b/src/verticalVerificationwidget.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include "verticalVerificationwidget.h" - #include - #include -diff --git a/src/verticalVerificationwidget.h b/src/verticalVerificationwidget.h -index 749dadc..26a94d4 100644 ---- a/src/verticalVerificationwidget.h -+++ b/src/verticalVerificationwidget.h -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 VERTICALVERIFICATIONWIDGET_H - #define VERTICALVERIFICATIONWIDGET_H - diff --git a/debian/patches/0008-update-changelog.patch b/debian/patches/0008-update-changelog.patch deleted file mode 100644 index 6b550b0..0000000 --- a/debian/patches/0008-update-changelog.patch +++ /dev/null @@ -1,813 +0,0 @@ -From: winnerym -Date: Wed, 12 Apr 2023 14:51:58 +0800 -Subject: update changelog - ---- - BiometricAuth/biometricdeviceswidget.h | 9 +- - BiometricAuth/main.cpp | 9 +- - VirtualKeyboard/CMakeLists.txt | 4 +- - VirtualKeyboard/src/fakekeyboard.h | 113 +++++++++++++++++ - VirtualKeyboard/src/keyboardwidget.cpp | 9 +- - VirtualKeyboard/src/keyboardwidget.h | 4 +- - VirtualKeyboard/src/main.cpp | 9 +- - VirtualKeyboard/src/qtkeyboard.cpp | 221 +++++++++++++++++++++++++++++++++ - VirtualKeyboard/src/qtkeyboard.h | 48 +++++++ - VirtualKeyboard/src/x11keyboard.cpp | 6 +- - VirtualKeyboard/src/x11keyboard.h | 71 +---------- - examples/LoadCustomPlugin/main.cpp | 17 +++ - examples/LoadCustomPlugin/widget.cpp | 19 ++- - src/fullbackgroundwidget.cpp | 3 - - src/lockwidget.cpp | 8 +- - 15 files changed, 449 insertions(+), 101 deletions(-) - create mode 100644 VirtualKeyboard/src/fakekeyboard.h - create mode 100644 VirtualKeyboard/src/qtkeyboard.cpp - create mode 100644 VirtualKeyboard/src/qtkeyboard.h - -diff --git a/BiometricAuth/biometricdeviceswidget.h b/BiometricAuth/biometricdeviceswidget.h -index d606aef..bdef3da 100644 ---- a/BiometricAuth/biometricdeviceswidget.h -+++ b/BiometricAuth/biometricdeviceswidget.h -@@ -1,9 +1,9 @@ --/** -+/* - * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) -+ * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, -@@ -12,9 +12,8 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -- * 02110-1301, USA. -+ * along with this program; if not, see . -+ * - **/ - #ifndef BIOMETRICDEVICESWIDGET_H - #define BIOMETRICDEVICESWIDGET_H -diff --git a/BiometricAuth/main.cpp b/BiometricAuth/main.cpp -index 6215ae1..cd780b5 100644 ---- a/BiometricAuth/main.cpp -+++ b/BiometricAuth/main.cpp -@@ -1,9 +1,9 @@ --/** -+/* - * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) -+ * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, -@@ -12,9 +12,8 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -- * 02110-1301, USA. -+ * along with this program; if not, see . -+ * - **/ - #include - #include -diff --git a/VirtualKeyboard/CMakeLists.txt b/VirtualKeyboard/CMakeLists.txt -index 3c8a010..9f5355d 100644 ---- a/VirtualKeyboard/CMakeLists.txt -+++ b/VirtualKeyboard/CMakeLists.txt -@@ -9,6 +9,7 @@ qt5_add_resources(VirtualKeyboard_SRC - - qt5_wrap_cpp(VirtualKeyboard_SRC - src/vkstackedwidget.h -+ src/fakekeyboard.h - ) - - set(VirtualKeyboard_SRC -@@ -17,6 +18,7 @@ set(VirtualKeyboard_SRC - src/keyboardwidget.cpp - src/virtualkeyboard.cpp - src/x11keyboard.cpp -+ src/qtkeyboard.cpp - src/vkstackedwidget.cpp - src/keyboard.qrc) - -@@ -26,4 +28,4 @@ include_directories( - ) - - add_library(VirtualKeyboard STATIC ${VirtualKeyboard_SRC}) --target_link_libraries(VirtualKeyboard Qt5::Core Qt5::Widgets) -+target_link_libraries(VirtualKeyboard Qt5::Core Qt5::Widgets Qt5::X11Extras) -diff --git a/VirtualKeyboard/src/fakekeyboard.h b/VirtualKeyboard/src/fakekeyboard.h -new file mode 100644 -index 0000000..7c29ce5 ---- /dev/null -+++ b/VirtualKeyboard/src/fakekeyboard.h -@@ -0,0 +1,113 @@ -+/* -+ * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 FAKEKEYBOARD_H -+#define FAKEKEYBOARD_H -+ -+#include -+#include -+ -+class Modifier : public QObject -+{ -+ Q_OBJECT -+public: -+ Modifier(){} -+ -+ enum MOD{ -+ UNKNOWN = -1, -+ CTRL, -+ SHIFT, -+ ALT, -+ SUPER -+ }; -+ Q_ENUM(MOD) -+ -+ static QString getModifierName(int mod) -+ { -+ QMetaEnum metaEnum = QMetaEnum::fromType(); -+ const char* modName = metaEnum.valueToKey(mod); -+ QString result = QString(modName).toLower(); -+ return result; -+ } -+ static MOD getModifier(const QString &modName) -+ { -+ QMetaEnum metaEnum = QMetaEnum::fromType(); -+ MOD mod = (MOD)metaEnum.keyToValue(modName.toUpper().toLocal8Bit().data()); -+ return mod; -+ } -+}; -+ -+class FuncKey : public QObject -+{ -+ Q_OBJECT -+public: -+ FuncKey(){} -+ -+ enum FUNCKEY { -+ UNKNOWN = -1, -+ SPACE = 0, -+ BACKSPACE, -+ ENTER, -+ HOME, -+ END, -+ PGUP, -+ PGDN, -+ INSERT, -+ DELETE, -+ UP, -+ DOWN, -+ LEFT, -+ RIGHT -+ }; -+ Q_ENUM(FUNCKEY) -+ static QString getKeyName(int key) -+ { -+ QMetaEnum metaEnum = QMetaEnum::fromType(); -+ const char* keyName = metaEnum.valueToKey(key); -+ QString result = QString(keyName).toLower(); -+ return result; -+ } -+ static FUNCKEY getKey(const QString &keyName) -+ { -+ QMetaEnum metaEnum = QMetaEnum::fromType(); -+ FUNCKEY key = (FUNCKEY)metaEnum.keyToValue(keyName.toUpper().toLocal8Bit().data()); -+ return key; -+ } -+}; -+ -+class FakeKeyboard : public QObject -+{ -+ Q_OBJECT -+public: -+ explicit FakeKeyboard(QObject *parent = nullptr) -+ : QObject(parent) -+ { -+ -+ } -+ -+ virtual void addModifier(Modifier::MOD mod) = 0; -+ virtual void removeModifier(Modifier::MOD mod) = 0; -+ virtual bool hasModifier(Modifier::MOD mod) = 0; -+ virtual QList getAllModifier() = 0; -+ virtual void clearModifier() = 0; -+ -+public Q_SLOTS: -+ virtual void onKeyPressed(QChar c) = 0; -+ virtual void onKeyPressed(FuncKey::FUNCKEY key) = 0; -+}; -+ -+#endif // FAKEKEYBOARD_H -diff --git a/VirtualKeyboard/src/keyboardwidget.cpp b/VirtualKeyboard/src/keyboardwidget.cpp -index be86698..a13adec 100644 ---- a/VirtualKeyboard/src/keyboardwidget.cpp -+++ b/VirtualKeyboard/src/keyboardwidget.cpp -@@ -20,6 +20,9 @@ - #include - #include - #include -+#include -+#include "x11keyboard.h" -+#include "qtkeyboard.h" - - #define SYMBOL_KEY_COUNT 29 - #define SYMBOL_PAGE_COUNT 2 -@@ -46,7 +49,11 @@ KeyboardWidget::KeyboardWidget(QWidget *parent) : - isShift(false), - page(0) - { -- vKeyboard = new X11Keyboard(this); -+ if(QX11Info::isPlatformX11()){ -+ vKeyboard = new X11Keyboard(this); -+ }else{ -+ vKeyboard = new QtKeyboard(this); -+ } - connect(this, SIGNAL(keyPressed(QChar)), - vKeyboard, SLOT(onKeyPressed(QChar))); - connect(this, SIGNAL(keyPressed(FuncKey::FUNCKEY)), -diff --git a/VirtualKeyboard/src/keyboardwidget.h b/VirtualKeyboard/src/keyboardwidget.h -index d735ebd..c2f7a37 100644 ---- a/VirtualKeyboard/src/keyboardwidget.h -+++ b/VirtualKeyboard/src/keyboardwidget.h -@@ -21,7 +21,7 @@ - #include - #include - #include --#include "x11keyboard.h" -+#include "fakekeyboard.h" - - namespace Ui { - class KeyboardWidget; -@@ -70,7 +70,7 @@ private: - bool isShift; - QTime shiftLastClicked; //shift键上次被点击的时间 - int page; //当前是第几页的键盘 -- X11Keyboard *vKeyboard; -+ FakeKeyboard *vKeyboard; - }; - - #endif // KEYBOARDWIDGET_H -diff --git a/VirtualKeyboard/src/main.cpp b/VirtualKeyboard/src/main.cpp -index 99fc2f0..dbb84a0 100644 ---- a/VirtualKeyboard/src/main.cpp -+++ b/VirtualKeyboard/src/main.cpp -@@ -1,9 +1,9 @@ --/** -+/* - * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) -+ * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, -@@ -12,9 +12,8 @@ - * 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, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -- * 02110-1301, USA. -+ * along with this program; if not, see . -+ * - **/ - #include "virtualkeyboard.h" - #include -diff --git a/VirtualKeyboard/src/qtkeyboard.cpp b/VirtualKeyboard/src/qtkeyboard.cpp -new file mode 100644 -index 0000000..731b70e ---- /dev/null -+++ b/VirtualKeyboard/src/qtkeyboard.cpp -@@ -0,0 +1,221 @@ -+/* -+ * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ -+#include "qtkeyboard.h" -+#include -+#include -+#include -+#include -+#include -+#include -+ -+QMap m_specialSymbolMap = { -+ {' ', Qt::Key_Space}, -+ {',', Qt::Key_Comma}, -+ {'.', Qt::Key_Period}, -+ {'\'', Qt::Key_QuoteLeft}, -+ {'@', Qt::Key_At}, -+ {'#', Qt::Key_NumberSign}, -+ {'$', Qt::Key_Dollar}, -+ {'%', Qt::Key_Percent}, -+ {'&', Qt::Key_Ampersand}, -+ {'*', Qt::Key_Asterisk}, -+ {'(', Qt::Key_ParenLeft}, -+ {')', Qt::Key_ParenRight}, -+ {'-', Qt::Key_Minus}, -+ {'+', Qt::Key_Plus}, -+ {'!', Qt::Key_Exclam}, -+ {'"', Qt::Key_QuoteDbl}, -+ {'<', Qt::Key_Less}, -+ {'>', Qt::Key_Greater}, -+ {':', Qt::Key_Colon}, -+ {';', Qt::Key_Semicolon}, -+ {'/', Qt::Key_Slash}, -+ {'?', Qt::Key_Question}, -+ {'=', Qt::Key_Equal}, -+ {'.', Qt::Key_Period}, /*XK_kana_middledot*/ -+ {'~', Qt::Key_AsciiTilde}, -+ {'`', Qt::Key_QuoteLeft}, -+ {'|', Qt::Key_Bar}, -+ {'^', Qt::Key_AsciiCircum}, -+ {'{', Qt::Key_BraceLeft}, -+ {'}', Qt::Key_BraceRight}, -+ {'[', Qt::Key_BracketLeft}, -+ {']', Qt::Key_BracketRight}, -+ {'_', Qt::Key_Underscore}, -+ {'\\', Qt::Key_Backslash}, -+}; -+ -+QMap m_funckeyMap = { -+ {FuncKey::SPACE, Qt::Key_Space}, -+ {FuncKey::BACKSPACE, Qt::Key_Backspace}, -+ {FuncKey::ENTER, Qt::Key_Enter}, -+ {FuncKey::HOME, Qt::Key_Home}, -+ {FuncKey::END, Qt::Key_End}, -+ {FuncKey::PGUP, Qt::Key_PageUp}, -+ {FuncKey::PGDN, Qt::Key_PageDown}, -+ {FuncKey::INSERT, Qt::Key_Insert}, -+ {FuncKey::DELETE, Qt::Key_Delete}, -+ {FuncKey::UP, Qt::Key_Up}, -+ {FuncKey::DOWN, Qt::Key_Down}, -+ {FuncKey::LEFT, Qt::Key_Left}, -+ {FuncKey::RIGHT, Qt::Key_Right} -+}; -+ -+QMap m_modifierMap = { -+ {Modifier::CTRL, Qt::ControlModifier}, -+ {Modifier::ALT, Qt::AltModifier}, -+ {Modifier::SUPER, Qt::MetaModifier}, -+ {Modifier::SHIFT, Qt::ShiftModifier} -+}; -+ -+QVector m_shiftKeyVec = {'~', '!', '@', '#', '$', '%', '^', '&', '*', -+ '(', ')', '_', '+', '{', '}', '|', ':', '"', -+ '>', '?'}; -+ -+#define DRM_DIR "/sys/class/leds/" -+#define CAPSLOCK_STATUS "capslock_state" -+ -+/** -+ * @brief 判断大写键状态 -+ * @return true: 大写锁定 -+ */ -+bool checkCapsLockState() -+{ -+ QDir ledDir(DRM_DIR); -+ QStringList leds = ledDir.entryList(QDir::Dirs); -+ QString capsFile; -+ -+ for(int i = 0;i QtKeyboard::getAllModifier() -+{ -+ return modList; -+} -+ -+void QtKeyboard::clearModifier() -+{ -+ modList.clear(); -+} -+ -+ -+void QtKeyboard::onKeyPressed(QChar c) -+{ -+ /*判断大写锁定打开时,转换字母大小写状态,与x11keyboard类逻辑保持一致*/ -+ if(checkCapsLockState() && c.isLetter()){ -+ if(c.isUpper()){ -+ c = c.toLower(); -+ } -+ else if(c.isLower()){ -+ c = c.toUpper(); -+ } -+ } -+ -+ if(c>='A' && c<='Z'){ -+ sendKey(c.toLatin1(),c); -+ }else if(c>='a' && c<='z'){ -+ sendKey(c.toLatin1() - 32,c); -+ }else if(c >= '0' && c<='9'){ -+ sendKey(c.toLatin1(),c); -+ }else if(m_specialSymbolMap.contains(c)){ -+ sendKey(m_specialSymbolMap[c],c); -+ }else { -+ sendKey(c.toLatin1(),c); -+ } -+} -+ -+void QtKeyboard::onKeyPressed(FuncKey::FUNCKEY key) -+{ -+ int keysym = m_funckeyMap[key]; -+ /*这里的text根据实际按键得到的QEvent中的text内容打印*/ -+ if(key == FuncKey::SPACE){ -+ sendKey(keysym," "); -+ }else if(key == FuncKey::BACKSPACE){ -+ sendKey(keysym,"\b"); -+ }else if(key == FuncKey::ENTER){ -+ sendKey(keysym,"\r"); -+ }else if(key == FuncKey::INSERT){ -+ sendKey(keysym,"\u007F"); -+ }else{ -+ sendKey(keysym,""); -+ } -+} -+ -+void QtKeyboard::sendKey(const unsigned int keysym,const QString text) -+{ -+ Qt::KeyboardModifiers modifier = Qt::NoModifier; -+ for(auto mod : modList){ -+ modifier = modifier | m_modifierMap[mod]; -+ } -+ -+ QWidget *objfous = QApplication::focusWidget(); -+ -+ if(objfous){ -+ QKeyEvent event1(QEvent::KeyPress, keysym -+ , modifier, text -+ , true, 1); -+ QKeyEvent event2(QEvent::KeyRelease, keysym -+ , modifier, text -+ , true, 1); -+ QCoreApplication::sendEvent(objfous, &event1); -+ QCoreApplication::sendEvent(objfous, &event2); -+ } -+ -+} -diff --git a/VirtualKeyboard/src/qtkeyboard.h b/VirtualKeyboard/src/qtkeyboard.h -new file mode 100644 -index 0000000..fed4508 ---- /dev/null -+++ b/VirtualKeyboard/src/qtkeyboard.h -@@ -0,0 +1,48 @@ -+/* -+ * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 QTKEYBOARD_H -+#define QTKEYBOARD_H -+ -+#include -+#include -+#include "fakekeyboard.h" -+ -+class QtKeyboard : public FakeKeyboard -+{ -+ Q_OBJECT -+public: -+ explicit QtKeyboard(QObject *parent = nullptr); -+ ~QtKeyboard(); -+ void addModifier(Modifier::MOD mod); -+ void removeModifier(Modifier::MOD mod); -+ bool hasModifier(Modifier::MOD mod); -+ QList getAllModifier(); -+ void clearModifier(); -+ -+public Q_SLOTS: -+ void onKeyPressed(QChar c); -+ void onKeyPressed(FuncKey::FUNCKEY key); -+ -+private: -+ void sendKey(const unsigned int keyCode,const QString text); -+ -+private: -+ QList modList; -+}; -+ -+#endif // QTKEYBOARD_H -diff --git a/VirtualKeyboard/src/x11keyboard.cpp b/VirtualKeyboard/src/x11keyboard.cpp -index 02a196a..25b36d8 100644 ---- a/VirtualKeyboard/src/x11keyboard.cpp -+++ b/VirtualKeyboard/src/x11keyboard.cpp -@@ -21,8 +21,6 @@ - #include - #include - -- -- - struct CharMap { - QChar name; - KeySym code; -@@ -35,7 +33,7 @@ struct CharMap XSpecialSymbolMap[] { - {'\'', XK_quoteright}, - {'@', XK_at}, - {'#', XK_numbersign}, -- {'$', XK_dollar}, -+ {'$', XK_dollar}, - {'%', XK_percent}, - {'&', XK_ampersand}, - {'*', XK_asterisk}, -@@ -122,7 +120,7 @@ unsigned int keyCodeOfChar(QChar c) - } - - X11Keyboard::X11Keyboard(QObject *parent) -- : QObject(parent) -+ : FakeKeyboard(parent) - { - - } -diff --git a/VirtualKeyboard/src/x11keyboard.h b/VirtualKeyboard/src/x11keyboard.h -index f3bf757..9914019 100644 ---- a/VirtualKeyboard/src/x11keyboard.h -+++ b/VirtualKeyboard/src/x11keyboard.h -@@ -20,76 +20,9 @@ - - #include - #include -+#include "fakekeyboard.h" - --class Modifier : public QObject --{ -- Q_OBJECT --public: -- Modifier(){} -- -- enum MOD{ -- UNKNOWN = -1, -- CTRL, -- SHIFT, -- ALT, -- SUPER -- }; -- Q_ENUM(MOD) -- -- static QString getModifierName(int mod) -- { -- QMetaEnum metaEnum = QMetaEnum::fromType(); -- const char* modName = metaEnum.valueToKey(mod); -- QString result = QString(modName).toLower(); -- return result; -- } -- static MOD getModifier(const QString &modName) -- { -- QMetaEnum metaEnum = QMetaEnum::fromType(); -- MOD mod = (MOD)metaEnum.keyToValue(modName.toUpper().toLocal8Bit().data()); -- return mod; -- } --}; -- --class FuncKey : public QObject --{ -- Q_OBJECT --public: -- FuncKey(){} -- -- enum FUNCKEY { -- UNKNOWN = -1, -- SPACE = 0, -- BACKSPACE, -- ENTER, -- HOME, -- END, -- PGUP, -- PGDN, -- INSERT, -- DELETE, -- UP, -- DOWN, -- LEFT, -- RIGHT -- }; -- Q_ENUM(FUNCKEY) -- static QString getKeyName(int key) -- { -- QMetaEnum metaEnum = QMetaEnum::fromType(); -- const char* keyName = metaEnum.valueToKey(key); -- QString result = QString(keyName).toLower(); -- return result; -- } -- static FUNCKEY getKey(const QString &keyName) -- { -- QMetaEnum metaEnum = QMetaEnum::fromType(); -- FUNCKEY key = (FUNCKEY)metaEnum.keyToValue(keyName.toUpper().toLocal8Bit().data()); -- return key; -- } --}; -- --class X11Keyboard : public QObject -+class X11Keyboard : public FakeKeyboard - { - Q_OBJECT - public: -diff --git a/examples/LoadCustomPlugin/main.cpp b/examples/LoadCustomPlugin/main.cpp -index 4d6c97b..1ba44a8 100644 ---- a/examples/LoadCustomPlugin/main.cpp -+++ b/examples/LoadCustomPlugin/main.cpp -@@ -1,3 +1,20 @@ -+/* -+ * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ - #include "widget.h" - #include - -diff --git a/examples/LoadCustomPlugin/widget.cpp b/examples/LoadCustomPlugin/widget.cpp -index 45a1213..fe30bca 100644 ---- a/examples/LoadCustomPlugin/widget.cpp -+++ b/examples/LoadCustomPlugin/widget.cpp -@@ -1,4 +1,21 @@ --#pragma execution_character_set("utf-8") -+/* -+ * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 . -+ * -+**/ -+#pragma execution_character_set("utf-8") - - #include "widget.h" - #include "ui_widget.h" -diff --git a/src/fullbackgroundwidget.cpp b/src/fullbackgroundwidget.cpp -index 3e4e421..4486055 100644 ---- a/src/fullbackgroundwidget.cpp -+++ b/src/fullbackgroundwidget.cpp -@@ -566,7 +566,6 @@ bool FullBackgroundWidget::nativeEventFilter(const QByteArray &eventType, void * - //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); - } else if(responseType == XCB_GE_GENERIC){ - xcb_ge_generic_event_t *xc = reinterpret_cast(event); -@@ -580,14 +579,12 @@ bool FullBackgroundWidget::nativeEventFilter(const QByteArray &eventType, void * - int x = xc->root_x; - int y = xc->root_y; - onGlobalButtonPressed(x, y); -- qDebug()<<"---------------------XCB_BUTTON_PRESS:"<(event); - int x = xc->root_x; - int y = xc->root_y; - onGlobalButtonDrag(x, y); -- qDebug()<<"---------------------XCB_MOTION_NOTIFY:"<setCursor(Qt::ArrowCursor); - }); - -- if(QX11Info::isPlatformX11()){ -+// if(QX11Info::isPlatformX11()){ - //虚拟键盘 - ui->btnKeyboard->setIcon(QIcon(":/image/assets/keyboard.svg")); - ui->btnKeyboard->setFixedSize(48, 48); -@@ -832,10 +832,11 @@ void LockWidget::initUI() - - connect(ui->btnKeyboard, &QPushButton::clicked, - this, &LockWidget::showVirtualKeyboard); -+/* - } else { - ui->btnKeyboard->hide(); - } -- -+*/ - //用户切换 - if(displayManager->canSwitch()) - { -@@ -875,9 +876,6 @@ void LockWidget::netInPutStatus() - - void LockWidget::showVirtualKeyboard() - { -- if (!QX11Info::isPlatformX11()) { -- return ; -- } - tabAt = LINEEDIT; - setBottomBtnSheet(); - tabAt = BOTTMBTN; diff --git a/debian/patches/series b/debian/patches/series deleted file mode 100644 index c8c6fea..0000000 --- a/debian/patches/series +++ /dev/null @@ -1,8 +0,0 @@ -0001-change-version-for-rebuild.patch -0002-.patch -0003-.patch -0004-update-quotation.patch -0005-update-changelog.patch -0006-update-changelog.patch -0007-update-changelog.patch -0008-update-changelog.patch diff --git a/examples/LoadCustomPlugin/main.cpp b/examples/LoadCustomPlugin/main.cpp index 4d6c97b..1ba44a8 100644 --- a/examples/LoadCustomPlugin/main.cpp +++ b/examples/LoadCustomPlugin/main.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 . + * +**/ #include "widget.h" #include diff --git a/examples/LoadCustomPlugin/widget.cpp b/examples/LoadCustomPlugin/widget.cpp index 45a1213..fe30bca 100644 --- a/examples/LoadCustomPlugin/widget.cpp +++ b/examples/LoadCustomPlugin/widget.cpp @@ -1,4 +1,21 @@ -#pragma execution_character_set("utf-8") +/* + * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 . + * +**/ +#pragma execution_character_set("utf-8") #include "widget.h" #include "ui_widget.h" diff --git a/examples/LoadCustomPlugin/widget.h b/examples/LoadCustomPlugin/widget.h index 43d6a87..02e7658 100644 --- a/examples/LoadCustomPlugin/widget.h +++ b/examples/LoadCustomPlugin/widget.h @@ -1,4 +1,21 @@ -#ifndef WIDGET_H +/* + * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 WIDGET_H #define WIDGET_H #include diff --git a/i18n_ts/bo.ts b/i18n_ts/bo.ts index df90984..f0f3219 100644 --- a/i18n_ts/bo.ts +++ b/i18n_ts/bo.ts @@ -4,111 +4,146 @@ AuthDialog - + Authentication failure, Please try again - - - - + + + + Please try again in %1 minutes. - - - - + + Enter the ukey password + + + + + Insert the ukey into the USB port + + + + + + + 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 - + Abnormal network + + BatteryWidget + + + Charging... + + + + + fully charged + + + + + PowerMode + + + + + BatteryMode + + + BiometricAuthWidget @@ -145,6 +180,32 @@ + + CharsMoreWidget + + + &&?! + + + + + CharsWidget + + + More + + + + + ABC + + + + + 123 + + + ConfForm @@ -279,6 +340,11 @@ + ukey + + + + QRCode @@ -1424,6 +1490,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 @@ -1458,14 +1642,6 @@ - - KeyboardWidget - - - KeyboardWidget - - - KylinNM @@ -1541,7 +1717,7 @@ - + Not connected @@ -1554,7 +1730,7 @@ - + Disconnected @@ -1580,26 +1756,49 @@ - + Conn Ethernet Success - + Conn Ethernet Fail - + Conn Wifi Success - + Confirm your Wi-Fi password or usable of wireless card + + LettersWidget + + + &&?! + + + + + 123 + + + + + Ctrl + + + + + Alt + + + LockWidget @@ -1618,17 +1817,17 @@ - + Multiple users are logged in at the same time.Are you sure you want to reboot this system? - + LAN - + WLAN @@ -1636,12 +1835,17 @@ LoginOptionsWidget - + Login Options - + + Password + + + + Identify device removed! @@ -1656,6 +1860,19 @@ + + NumbersWidget + + + &&?! + + + + + Return + + + OneConnForm @@ -1821,38 +2038,38 @@ PowerManager - + Log Out - + lock - - - Reboot + + + Restart - + Power Off - + Shut Down - + Hibernate - + Suspend @@ -1860,30 +2077,39 @@ QObject - + The screensaver is active. - + The screensaver is inactive. + + S: + + + + tablet device + + + Screensaver - + Picture does not exist - + View - + You have new notification @@ -1891,7 +2117,7 @@ SleepTime - + You have rested @@ -1919,22 +2145,22 @@ - + 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! @@ -1955,38 +2181,38 @@ TabletLockWidget - - - - - - + + + + + + Cancel - - + + Back - + Skip - + New password is the same as old - + Reset password error:%1 - + Please scan by correct WeChat @@ -2058,6 +2284,35 @@ + + Widget + + + Widget + + + + + LoadPlugin + + + + + delay + + + how long to show lock + + + + + has-lock + + + if show lock + + + main @@ -2081,52 +2336,67 @@ - + Start command for the ukui ScreenSaver. - - + + lock the screen immediately - + query the status of the screen saver - + unlock the screen saver - + show the screensaver - + + show blank and delay to lock,param:idle/lid/lowpower + + + + Dialog for the ukui ScreenSaver. - + activated by session idle signal - - + + lock the screen and show screensaver immediately - + show screensaver immediately + + + show blank screensaver immediately and delay time to show lock + + + + + show blank screensaver immediately and if lock + + diff --git a/i18n_ts/bo_CN.ts b/i18n_ts/bo_CN.ts index 3b0bc42..2774fdb 100644 --- a/i18n_ts/bo_CN.ts +++ b/i18n_ts/bo_CN.ts @@ -4,2549 +4,1955 @@ AuthDialog - More Devices - 选择其他设备 - - - Biometric - 使用生物识别认证 - - - Password - 使用密码认证 - - - Retry - བསྐྱར་དུ་ཞིབ་བཤེར་བྱ་དགོས། - - - UnLock - 解锁 - - - Slide to unlock - 向上滑动解锁 - - - You have %1 unread message - 您有%1条未读消息 - - - LoggedIn - 已登录 - - - Password: - 密码: - - - Account locked %1 minutes due to %2 fail attempts - 账户锁定%1分钟由于%2次错误尝试 - - - - - - - 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 - iris ཞིབ་བཤེར་བྱེད་པའམ་ཡང་ན་གསང་གྲངས་ནང་འཇུག་བྱས་ནས་ཟྭ་ - - - - Input Password - ནང་འཇུག་གི་གསང་གྲངས། - - - - Failed to verify %1, please enter password to unlock - %1ལ་ཞིབ་བཤེར་བྱེད་མ་ཐུབ་ན། གསང་གྲངས་ནང་འཇུག་བྱས་ནས་ཟྭ་རྒྱག་རོགས། - - - - Unable to verify %1, please enter password to unlock - %1ལ་ཞིབ་བཤེར་བྱེད་ཐབས་བྲལ་བ་དང་། གསང་གྲངས་ནང་འཇུག་བྱས་ནས་ཟྭ་རྒྱག་རོགས། - - - - Abnormal network - རྒྱུན་ལྡན་མིན་པའི་དྲ་ - - - Use the bound wechat scanning code or enter the password to log in - 使用绑定的微信扫码或输入密码登录 - - - - - Password cannot be empty - གསང་གྲངས་སྟོང་པ་ཡིན་མི་སྲིད། - - - Failed to verify %1, please enter password. - 验证%1失败,请输入密码. - - - Unable to verify %1, please enter password. - 无法验证%1,请输入密码. - - - - Failed to verify %1, you still have %2 verification opportunities - %1ལ་ཞིབ་བཤེར་བྱེད་མ་ཐུབ་ན། ཁྱེད་ཚོར་ད་དུང་%2ལ་ཞིབ་བཤེར་བྱེད་པའི་གོ་སྐབས་ཡོད། - - - Biometric/code scan authentication failed too many times, please enter the password. - 生物/扫码验证失败达最大次数,请使用密码解锁 - - - Bioauth/code scan authentication failed, you still have %1 verification opportunities - 生物/扫码验证失败,您还有%1次尝试机会 - - - NET Exception - 网络异常 - - - Password Incorrect, Please try again - 密码错误,请重试 - - - Authentication failure,there are still %1 remaining opportunities - 认证失败,还剩%1次尝试机会 + ཡང་བསྐྱར་ཚོད་ལེན། Please enter your password or enroll your fingerprint - 请输入密码或者录入指纹 - - - - Authentication failure, Please try again - བདེན་དཔང་ར་སྤྲོད་བྱེད་མ་ཐུབ་ན། ཡང་བསྐྱར་ཚོད་ལྟ་ཞིག - - - - Use the bound wechat scanning code or enter the password to unlock - འབྲེལ་མཐུད་ཀྱི་འཕྲིན་ཕྲན་ཞིབ་བཤེར་ཨང་གྲངས་སམ་ཡང་ན་གསང་གྲངས་ནང་འཇུག་བྱས་ནས་ཟྭ་རྒྱག་པ། - - - - Password - གསང་གྲངས། - - - - Login - ཐོ་འགོད་བྱེད་པ། - - - Biometric Authentication - 生物识别认证 - - - Password Authentication - 密码认证 - - - Other Devices - 其他设备 + གསང་ཨང་མནོན་པའམ་མཛུབ་རིམ་མནོན་རོགས། Too many unsuccessful attempts,please enter password. - 指纹验证失败达最大次数,请使用密码登录 + མཛུབ་རིས་ར་སྤྲོད་ཕམ་ཉེས་ཚད་ཆེས་ཆེ་ལས་བརྒལ་བ། ཁྱོས་གསང་ཨང་བཀོལ་ནས་ཟྭ་འབྱེད་རོགས། Fingerprint authentication failed, you still have %1 verification opportunities - 指纹验证失败,您还有%1次尝试机会 + མཛུབ་རིས་ར་སྤྲོད་ཕམ་ཉེས་བྱུང་། ཁྱོད་ལ་ད་དུང་གོ་སྐབས་གཅིག་ཡོད། + + + Password: + གསང་ཨང་། + + + Biometric Authentication + སྐྱེ་དངོས་ངོས་འཛིན་ཀྱི་དཔང་ལེན། + + + Other Devices + སྒྲིག་ཆས་གཞན་དག + + + Password Authentication + གསང་ཨང་ར་སྤྲོད་གྲོས་ཆིངས། + + + 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 + + + + Password cannot be empty + + + + Password + + + + Login + + + + Failed to verify %1, you still have %2 verification opportunities + + + + Use the bound wechat scanning code or enter the password to unlock + + + + Failed to verify %1, please enter password to unlock + + + + Unable to verify %1, please enter password to unlock + + + + Input Password + + + + Abnormal network + + + + Enter the ukey password + གསང་བའི་ཨང་གྲངས་ནང་འཇུག་བྱེད་པ། + + + Insert the ukey into the USB port + བདེ་འཇགས་ཀྱི་གསང་བའི་ལྡེ་མིག་དེ་USBཡི་སྣེ་འདྲེན་དུ་འཇུག་རོགས། - BioDevices + BatteryWidget - FingerPrint - 指纹 + Charging... + - FingerVein - 指静脉 + fully charged + - Iris - 虹膜 + PowerMode + - Face - 人脸 - - - VoicePrint - 声纹 - - - - BioDevicesWidget - - Please select other biometric devices - 请选择其他生物识别设备 - - - Device Type: - 设备类型: - - - Device Name: - 设备名称: + BatteryMode + BiometricAuthWidget - - Current device: - མིག་སྔའི་སྒྲིག་ཆས་ནི། + Identify failed, Please retry. + ངོས་འཛིན་མ་ཐུབ། ཡང་བསྐྱར་ཚོད་ལྟ་བྱོས། - - Identify failed, Please retry. - ཕམ་ཉེས་བྱུང་བར་ངོས་འཛིན་གནང་རོགས། ཁྱེད་ཀྱིས་ཡང་བསྐྱར་ཐེངས་གཅིག་ལ + Current device: + མིག་སྔའི་སྒྲིག་ཆས་རེའུ་མིག: BiometricDevicesWidget - - Please select the biometric device - སྐྱེ་དངོས་དབྱེ་འབྱེད་སྒྲིག་ཆས་འདེམས་རོགས། - - - - Device type: - སྒྲིག་ཆས་ཀྱི་རིགས་དབྱིབས་ནི། - - - - Device name: - སྒྲིག་ཆས་ཀྱི་མིང་གཤམ་གསལ། - - - OK - འགྲིགས། + གཏན་འཁེལ་བྱེད་པ། + + + Please select the biometric device + ཉིད་ཀྱིས་སྐྱེ་དངོས་སྒྲིག་ཆས་འདེམ་རོགས། + + + Device type: + སྒྲིག་ཆས་ཀྱི་རིགས། + + + Device name: + སྒྲིག་ཆས་ཀྱི་མིང་། + + + + CharsMoreWidget + + &&?! + + + + + CharsWidget + + More + + + + ABC + + + + 123 + ConfForm - edit network - རྩོམ་སྒྲིག་དྲ་བ། + - LAN name: - LANཡི་མིང་ནི། + - Method: - བྱེད་ཐབས་ནི། + - Address: - སྡོད་གནས་ནི། + - Netmask: - དྲ་རྒྱའི་མ་སི་ཁི་ཡིས་བཤད་རྒྱུར། + - Gateway: - འགག་སྒོ་ནི། + - DNS 1: - DNS 1: + - DNS 2: - DNS 2: + - Edit Conn - རྩོམ་སྒྲིག་པ། + - - Auto(DHCP) - རང་འགུལ་(DHCP) + - - Manual - ལག་དེབ། + - Cancel - ཕྱིར་འཐེན། + - Save - གྲོན་ཆུང་བྱེད་དགོས། + - Ok - འགྲིགས། + - Can not create new wired network for without wired card - སྐུད་ཡོད་བྱང་བུ་མེད་ན་སྐུད་ཡོད་དྲ་རྒྱ་གསར་པ་གཏོད་མི་ཐུབ། + - New network already created - དྲ་རྒྱ་གསར་པ་གསར་སྐྲུན་བྱས་ཟིན་པ། + - New network settings already finished - དྲ་རྒྱའི་སྒྲིག་བཀོད་གསར་པ་ལེགས་འགྲུབ་བྱུང་ཡོད། + - - Edit Network - རྩོམ་སྒྲིག་དྲ་བ། - - - - Add Wired Network - སྐུད་ཡོད་བརྙན་འཕྲིན་དྲ་བ་ཁ་སྣོན་ - - - create wired network successfully - 已创建新的有线网络 - - - change configuration of wired network successfully - 新的设置已经生效 - - - New settings already effective - སྒྲིག་གཞི་གསར་པར་ཕན་ནུས་ཐོན་ཡོད། + - There is a same named LAN exsits. - 已有同名连接存在 + Edit Network + + + + Add Wired Network + DeviceType - - FingerPrint - མཛུབ་མོའི་པར་གཞི། - - - - FingerVein - མཛུབ་མོ་ཝེ་ལིན། - - - - Iris - དབྱི་ལི་སི། - - - Face - ངོ་གདོང་། + མིའི་གདོང་། + + + Iris + འཇའ་སྐྱི། - VoicePrint - སྒྲ་གདངས་ཀྱི་པར་གཞི། + སྒྲ་རིས། + + + FingerPrint + མཛུབ་རིས། + + + FingerVein + མཛུབ་མོའི་སྡོད་རྩ། - QRCode - QRCode + + + + ukey + DigitalAuthDialog - - LoginByUEdu - LoginByUEdu + - now is authing, wait a moment - 认证中,请稍后 - - - Password Incorrect, Please try again - 密码错误,请重试 - - - ResetPWD? - ཡང་བསྐྱར་བཀོད་སྒྲིག་བྱེད་དགོས་སམ། + - - SetNewUEduPWD - SetNewUeduPWD + - - ConfirmNewUEduPWD - གསར་དུ་གཏན་འཁེལ་བྱས་པའི་ནུའུ་ཝུའུ་ཏུའུ་ཕུའུ་ཝེ་ཏི། - - - - The two password entries are inconsistent, please reset - གསང་བའི་འཇུག་སྒོ་གཉིས་གཅིག་མཐུན་མིན་པས་བསྐྱར་དུ་བཀོད་སྒྲིག་གནང་རོགས། - - - - Password entered incorrectly, please try again - གསང་གྲངས་ནང་འཇུག་བྱས་པ་ནོར་འདུག་པས་ཡང་བསྐྱར་ཚོད་ལྟ་ཞིག་གནང་རོགས། - - - clear - གསལ་པོར་བཤད་ན། + + + + ConfirmNewUEduPWD + + + + The two password entries are inconsistent, please reset + + + + Password entered incorrectly, please try again + DlgConnHidWifi - - Add Hidden Wi-Fi - སྦས་སྐུང་བྱས་པའི་Wi-Fiབསྣན་པ། - - - - Connection - འབྲེལ་མཐུད་ - - - - Wi-Fi name - Wi-Fiཡི་མིང་། - - - - Wi-Fi security - Wi-Fiབདེ་འཇགས། - - - - Cancel - ཕྱིར་འཐེན། - - - - Connect - སྦྲེལ་མཐུད་བྱེད་པ - - - - C_reate… - C_reate… - - - - None - གཅིག་ཀྱང་མེད། - - - - WPA & WPA2 Personal - WPA & WPA2 མི་སྒེར་ - - - WEP 40/128-bit Key (Hex or ASCII) - WEP 40/128 位密钥(十六进制或ASCII) - - - WEP 128-bit Passphrase - WEP 128 位密码句 - - - Dynamic WEP (802.1X) - 动态 WEP (802.1x) - - - WPA & WPA2 Enterprise - WPA 及 WPA2 企业 - - - Connect to Hidden Wi-Fi Network - སྦས་སྐུང་བྱས་པའི་Wi-Fiདྲ་རྒྱ་སྦྲེལ་མཐུད་བྱེད་པ། + + + + Add Hidden Wi-Fi + + + + Connection + + + + Wi-Fi name + + + + Wi-Fi security + + + + Cancel + + + + Connect + + + + C_reate… + + + + None + + + + WPA & WPA2 Personal + DlgConnHidWifiLeap - Connect to Hidden Wi-Fi Network - སྦས་སྐུང་བྱས་པའི་Wi-Fiདྲ་རྒྱ་སྦྲེལ་མཐུད་བྱེད་པ། + - Add hidden Wi-Fi - སྦས་སྐུང་བྱས་པའི་Wi-Fiབསྣན་པ། + - Connection - འབྲེལ་མཐུད་ + - Network name - དྲ་རྒྱའི་མིང་། + - Wi-Fi security - Wi-Fiབདེ་འཇགས། + - Username - སྤྱོད་མཁན་གྱི་མིང་། + - Password - གསང་གྲངས། + - Cancel - ཕྱིར་འཐེན། + - Connect - སྦྲེལ་མཐུད་བྱེད་པ + - C_reate… - C_reate… + - None - གཅིག་ཀྱང་མེད། + - WPA & WPA2 Personal - WPA & WPA2 མི་སྒེར་ + - WEP 40/128-bit Key (Hex or ASCII) - WEP 40/128-bit Key (Hex or ASCII) + - WEP 128-bit Passphrase - WEP 128-bit Passprase + - Dynamic WEP (802.1X) - འགུལ་རྣམ་གྱི་WEP (802.1X) + - WPA & WPA2 Enterprise - WPA & WPA2 ཁེ་ལས། + DlgConnHidWifiSecFast - Connect to Hidden Wi-Fi Network - སྦས་སྐུང་བྱས་པའི་Wi-Fiདྲ་རྒྱ་སྦྲེལ་མཐུད་བྱེད་པ། + - Add hidden Wi-Fi - སྦས་སྐུང་བྱས་པའི་Wi-Fiབསྣན་པ། + - Connection - འབྲེལ་མཐུད་ + - Network name - དྲ་རྒྱའི་མིང་། + - Wi-Fi security - Wi-Fiབདེ་འཇགས། + - Authentication - བདེན་དཔང་ར་སྤྲོད་ + - Anonymous identity - མིང་མ་བཀོད་པའི་ཐོབ་ཐང + - Allow automatic PAC pro_visioning - རང་འགུལ་གྱིས་PACའགོ་pro_visioning་བྱས་ཆོག། + - PAC file - PACཡིག་ཆ། + - Inner authentication - ནང་ཁུལ་གྱི་བདེན་དཔང་ར་སྤྲོད། + - Username - སྤྱོད་མཁན་གྱི་མིང་། + - Password - གསང་གྲངས། + - Cancel - ཕྱིར་འཐེན། + - Connect - སྦྲེལ་མཐུད་བྱེད་པ + - C_reate… - C_reate… + - - None - གཅིག་ཀྱང་མེད། + - WPA & WPA2 Personal - WPA & WPA2 མི་སྒེར་ + - WEP 40/128-bit Key (Hex or ASCII) - WEP 40/128-bit Key (Hex or ASCII) + - WEP 128-bit Passphrase - WEP 128-bit Passprase + - Dynamic WEP (802.1X) - འགུལ་རྣམ་གྱི་WEP (802.1X) + - WPA & WPA2 Enterprise - WPA & WPA2 ཁེ་ལས། + - Tunneled TLS - ཕུག་ལམ་གྱི་TLS + - Protected EAP (PEAP) - སྲུང་སྐྱོབ་ཐོབ་པའི་EAP(PEAP) + - Anonymous - མིང་མ་བཀོད་པའི་ + - Authenticated - བདེན་དཔང་ར་སྤྲོད་བྱས། + - Both - དེ་གཉིས་ཀ + DlgConnHidWifiSecLeap - Connect to Hidden Wi-Fi Network - སྦས་སྐུང་བྱས་པའི་Wi-Fiདྲ་རྒྱ་སྦྲེལ་མཐུད་བྱེད་པ། + - Add hidden Wi-Fi - སྦས་སྐུང་བྱས་པའི་Wi-Fiབསྣན་པ། + - Connection - འབྲེལ་མཐུད་ + - Network name - དྲ་རྒྱའི་མིང་། + - Wi-Fi security - Wi-Fiབདེ་འཇགས། + - Authentication - བདེན་དཔང་ར་སྤྲོད་ + - Username - སྤྱོད་མཁན་གྱི་མིང་། + - Password - གསང་གྲངས། + - Cancel - ཕྱིར་འཐེན། + - Connect - སྦྲེལ་མཐུད་བྱེད་པ + - C_reate… - C_reate… + - None - གཅིག་ཀྱང་མེད། + - WPA & WPA2 Personal - WPA & WPA2 མི་སྒེར་ + - WEP 40/128-bit Key (Hex or ASCII) - WEP 40/128-bit Key (Hex or ASCII) + - WEP 128-bit Passphrase - WEP 128-bit Passprase + - Dynamic WEP (802.1X) - འགུལ་རྣམ་གྱི་WEP (802.1X) + - WPA & WPA2 Enterprise - WPA & WPA2 ཁེ་ལས། + - Tunneled TLS - ཕུག་ལམ་གྱི་TLS + - Protected EAP (PEAP) - སྲུང་སྐྱོབ་ཐོབ་པའི་EAP(PEAP) + DlgConnHidWifiSecPeap - Connect to Hidden Wi-Fi Network - སྦས་སྐུང་བྱས་པའི་Wi-Fiདྲ་རྒྱ་སྦྲེལ་མཐུད་བྱེད་པ། + - Add hidden Wi-Fi - སྦས་སྐུང་བྱས་པའི་Wi-Fiབསྣན་པ། + - Connection - འབྲེལ་མཐུད་ + - Network name - དྲ་རྒྱའི་མིང་། + - Wi-Fi security - Wi-Fiབདེ་འཇགས། + - Authentication - བདེན་དཔང་ར་སྤྲོད་ + - Anonymous identity - མིང་མ་བཀོད་པའི་ཐོབ་ཐང + - Domain - ཁྱབ་ཁོངས། + - CA certificate - CA དཔང་ཡིག + - CA certificate password - CA དཔང་ཡིག་གི་གསང་གྲངས། + - No CA certificate is required - CAལག་ཁྱེར་མི་དགོས། + - PEAP version - PEAPཔར་གཞི། + - Inner authentication - ནང་ཁུལ་གྱི་བདེན་དཔང་ར་སྤྲོད། + - Username - སྤྱོད་མཁན་གྱི་མིང་། + - Password - གསང་གྲངས། + - Cancel - ཕྱིར་འཐེན། + - Connect - སྦྲེལ་མཐུད་བྱེད་པ + - - None - གཅིག་ཀྱང་མེད། + - WPA & WPA2 Personal - WPA & WPA2 མི་སྒེར་ + - WEP 40/128-bit Key (Hex or ASCII) - WEP 40/128-bit Key (Hex or ASCII) + - WEP 128-bit Passphrase - WEP 128-bit Passprase + - Dynamic WEP (802.1X) - འགུལ་རྣམ་གྱི་WEP (802.1X) + - WPA & WPA2 Enterprise - WPA & WPA2 ཁེ་ལས། + - Tunneled TLS - ཕུག་ལམ་གྱི་TLS + - Protected EAP (PEAP) - སྲུང་སྐྱོབ་ཐོབ་པའི་EAP(PEAP) + - Choose from file - ཡིག་ཆའི་ནང་ནས་གདམ་གསེས་ + - Automatic - རང་འགུལ་གྱིས་རང་ + - Version 0 - པར་གཞི་0 + - Version 1 - པར་གཞི་དང་པོ། + DlgConnHidWifiSecPwd - Connect to Hidden Wi-Fi Network - སྦས་སྐུང་བྱས་པའི་Wi-Fiདྲ་རྒྱ་སྦྲེལ་མཐུད་བྱེད་པ། + - Add hidden Wi-Fi - སྦས་སྐུང་བྱས་པའི་Wi-Fiབསྣན་པ། + - Connection - འབྲེལ་མཐུད་ + - Network name - དྲ་རྒྱའི་མིང་། + - Wi-Fi security - Wi-Fiབདེ་འཇགས། + - Authentication - བདེན་དཔང་ར་སྤྲོད་ + - Username - སྤྱོད་མཁན་གྱི་མིང་། + - Password - གསང་གྲངས། + - Cancel - ཕྱིར་འཐེན། + - Connect - སྦྲེལ་མཐུད་བྱེད་པ + - C_reate… - C_reate… + - None - གཅིག་ཀྱང་མེད། + - WPA & WPA2 Personal - WPA & WPA2 མི་སྒེར་ + - WEP 40/128-bit Key (Hex or ASCII) - WEP 40/128-bit Key (Hex or ASCII) + - WEP 128-bit Passphrase - WEP 128-bit Passprase + - Dynamic WEP (802.1X) - འགུལ་རྣམ་གྱི་WEP (802.1X) + - WPA & WPA2 Enterprise - WPA & WPA2 ཁེ་ལས། + - Tunneled TLS - ཕུག་ལམ་གྱི་TLS + - Protected EAP (PEAP) - སྲུང་སྐྱོབ་ཐོབ་པའི་EAP(PEAP) + DlgConnHidWifiSecTls - Connect to Hidden Wi-Fi Network - སྦས་སྐུང་བྱས་པའི་Wi-Fiདྲ་རྒྱ་སྦྲེལ་མཐུད་བྱེད་པ། + - Add hidden Wi-Fi - སྦས་སྐུང་བྱས་པའི་Wi-Fiབསྣན་པ། + - Connection - འབྲེལ་མཐུད་ + - Network name - དྲ་རྒྱའི་མིང་། + - Wi-Fi security - Wi-Fiབདེ་འཇགས། + - Authentication - བདེན་དཔང་ར་སྤྲོད་ + - Identity - ཐོབ་ཐང་། + - Domain - ཁྱབ་ཁོངས། + - CA certificate - CA དཔང་ཡིག + - CA certificate password - CA དཔང་ཡིག་གི་གསང་གྲངས། + - No CA certificate is required - CAལག་ཁྱེར་མི་དགོས། + - User certificate - སྤྱོད་མཁན་གྱི་ལག་ཁྱེར། + - User certificate password - སྤྱོད་མཁན་གྱི་ལག་ཁྱེར་གྱི་གསང་ + - User private key - སྤྱོད་མཁན་གྱི་སྒེར་གྱི་ལྡེ་མིག + - User key password - སྤྱོད་མཁན་གྱི་ལྡེ་མིག་གི་གསང་ + - Cancel - ཕྱིར་འཐེན། + - Connect - སྦྲེལ་མཐུད་བྱེད་པ + - C_reate… - C_reate… + - - - - None - གཅིག་ཀྱང་མེད། + - WPA & WPA2 Personal - WPA & WPA2 མི་སྒེར་ + - WEP 40/128-bit Key (Hex or ASCII) - WEP 40/128-bit Key (Hex or ASCII) + - WEP 128-bit Passphrase - WEP 128-bit Passprase + - Dynamic WEP (802.1X) - འགུལ་རྣམ་གྱི་WEP (802.1X) + - WPA & WPA2 Enterprise - WPA & WPA2 ཁེ་ལས། + - Tunneled TLS - ཕུག་ལམ་གྱི་TLS + - Protected EAP (PEAP) - སྲུང་སྐྱོབ་ཐོབ་པའི་EAP(PEAP) + - - - Choose from file - ཡིག་ཆའི་ནང་ནས་གདམ་གསེས་ + DlgConnHidWifiSecTunnelTLS - Connect to Hidden Wi-Fi Network - སྦས་སྐུང་བྱས་པའི་Wi-Fiདྲ་རྒྱ་སྦྲེལ་མཐུད་བྱེད་པ། + - Add hidden Wi-Fi - སྦས་སྐུང་བྱས་པའི་Wi-Fiབསྣན་པ། + - Connection - འབྲེལ་མཐུད་ + - Network name - དྲ་རྒྱའི་མིང་། + - Wi-Fi security - Wi-Fiབདེ་འཇགས། + - Authentication - བདེན་དཔང་ར་སྤྲོད་ + - Anonymous identity - མིང་མ་བཀོད་པའི་ཐོབ་ཐང + - Domain - ཁྱབ་ཁོངས། + - CA certificate - CA དཔང་ཡིག + - CA certificate password - CA དཔང་ཡིག་གི་གསང་གྲངས། + - No CA certificate is required - CAལག་ཁྱེར་མི་དགོས། + - Inner authentication - ནང་ཁུལ་གྱི་བདེན་དཔང་ར་སྤྲོད། + - Username - སྤྱོད་མཁན་གྱི་མིང་། + - Password - གསང་གྲངས། + - Cancel - ཕྱིར་འཐེན། + - Connect - སྦྲེལ་མཐུད་བྱེད་པ + - C_reate… - C_reate… + - - None - གཅིག་ཀྱང་མེད། + - WPA & WPA2 Personal - WPA & WPA2 མི་སྒེར་ + - WEP 40/128-bit Key (Hex or ASCII) - WEP 40/128-bit Key (Hex or ASCII) + - WEP 128-bit Passphrase - WEP 128-bit Passprase + - Dynamic WEP (802.1X) - འགུལ་རྣམ་གྱི་WEP (802.1X) + - WPA & WPA2 Enterprise - WPA & WPA2 ཁེ་ལས། + - Tunneled TLS - ཕུག་ལམ་གྱི་TLS + - Protected EAP (PEAP) - སྲུང་སྐྱོབ་ཐོབ་པའི་EAP(PEAP) + - Choose from file - ཡིག་ཆའི་ནང་ནས་གདམ་གསེས་ + DlgConnHidWifiWep - Connect to Hidden Wi-Fi Network - སྦས་སྐུང་བྱས་པའི་Wi-Fiདྲ་རྒྱ་སྦྲེལ་མཐུད་བྱེད་པ། + - Add hidden Wi-Fi - སྦས་སྐུང་བྱས་པའི་Wi-Fiབསྣན་པ། + - Connection - འབྲེལ་མཐུད་ + - Network name - དྲ་རྒྱའི་མིང་། + - Wi-Fi security - Wi-Fiབདེ་འཇགས། + - Key - ལྡེ་མིག + - WEP index - WEPསྟོན་གྲངས། + - Authentication - བདེན་དཔང་ར་སྤྲོད་ + - Cancel - ཕྱིར་འཐེན། + - Connect - སྦྲེལ་མཐུད་བྱེད་པ + - C_reate… - C_reate… + - None - གཅིག་ཀྱང་མེད། + - WPA & WPA2 Personal - WPA & WPA2 མི་སྒེར་ + - WEP 40/128-bit Key (Hex or ASCII) - WEP 40/128-bit Key (Hex or ASCII) + - WEP 128-bit Passphrase - WEP 128-bit Passprase + - Dynamic WEP (802.1X) - འགུལ་རྣམ་གྱི་WEP (802.1X) + - WPA & WPA2 Enterprise - WPA & WPA2 ཁེ་ལས། + - 1(default) - 1(default) + - Open System - སྒོ་འབྱེད་མ་ལག + - Shared Key - མཉམ་སྤྱོད་ཀྱི་ལྡེ་མིག + DlgConnHidWifiWpa - Connect to Hidden Wi-Fi Network - སྦས་སྐུང་བྱས་པའི་Wi-Fiདྲ་རྒྱ་སྦྲེལ་མཐུད་བྱེད་པ། + - Add Hidden Wi-Fi - སྦས་སྐུང་བྱས་པའི་Wi-Fiབསྣན་པ། + - Connection - འབྲེལ་མཐུད་ + - Wi-Fi name - Wi-Fiཡི་མིང་། + - Wi-Fi security - Wi-Fiབདེ་འཇགས། + - Password - གསང་གྲངས། + - Cancel - ཕྱིར་འཐེན། + - Connect - སྦྲེལ་མཐུད་བྱེད་པ + - C_reate… - C_reate… + - None - གཅིག་ཀྱང་མེད། + - WPA & WPA2 Personal - WPA & WPA2 མི་སྒེར་ - - - WEP 40/128-bit Key (Hex or ASCII) - WEP 40/128 位密钥(十六进制或ASCII) - - - WEP 128-bit Passphrase - WEP 128 位密码句 - - - Dynamic WEP (802.1X) - 动态 WEP (802.1x) - - - WPA & WPA2 Enterprise - WPA 及 WPA2 企业 + DlgHotspotCreate - Dialog - གླེང་མོལ། + - Create Hotspot - ཚ་བ་ཆེ་བའི་ས་ཆ་གསར་སྐྲུན་ + - Network name - དྲ་རྒྱའི་མིང་། + - Wi-Fi security - Wi-Fiབདེ་འཇགས། + - Password - གསང་གྲངས། + - Cancel - ཕྱིར་འཐེན། + - Ok - འགྲིགས། + - None - གཅིག་ཀྱང་མེད། + - WPA & WPA2 Personal - WPA & WPA2 མི་སྒེར་ + + + + + 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 - - Service exception... - ཞབས་ཞུའི་དམིགས་བསལ་ ... - - - - Invaild parameters... - གོ་མི་ཐུབ་པའི་གྲངས་ཀ་ ... - - - - Unknown fault:%1 - ཤེས་མེད་པའི་ནོར་འཛོལ། %1 - - - - Recapture(60s) - ཕྱིར་ལེན་པ།(60s) - - - - Recapture(%1s) - ཕྱིར་ལེན་པ།(%1s) - - - - Get code - ཚབ་རྟགས་ཐོབ་པ། + - - - KeyboardWidget - - KeyboardWidget - མཐེབ་གཞོང་Widget + Recapture(60s) + - - - KylinDBus - kylin network applet desktop message - 麒麟网络工具信息提示 + Recapture(%1s) + + + + Service exception... + + + + Invaild parameters... + + + + Unknown fault:%1 + KylinNM - kylin-nm - kylin-nm + - - - LAN - ལན་ལན། - - - Enabel LAN List - 其他有线网络 - - - WiFi - 无线网络 - - - Enabel WiFi List - 其他无线网络 - - - New WiFi - 加入其他网络 - - - Network - 网络 - - - - - Advanced - སྔོན་ཐོན་རང་བཞིན། - - - Ethernet - 有线网络 - - - Connect Hide Network - 加入网络 - - - Wifi - 无线网络 - - - Enabled - 已开启 - - - Disabled - 已关闭 - - - - HotSpot - ཚ་བ་ཆེ་བ། - - - - FlyMode - འཕུར་སྐྱོད་འཕྲུལ་འཁོར། - - - Show MainWindow - 显示网络连接界面 - - - - Inactivated LAN - འགུལ་སྐྱོད་མ་བྱས་པའི་LAN - - - Inactivated WLAN - 未激活 - - - - Other WLAN - WLAN གཞན་དག - - - - - WLAN - སྐུད་མེད་ཅུས་ཁོངས་ཀྱི་དྲ་བ། - - - - Show KylinNM - ཅིན་ལིན་ནའེ་མུའུ་ལ་བསྟན་དོན། - - - - No wireless card detected - སྐུད་མེད་བྱང་བུ་མ་རྙེད་པ། - - - - Activated LAN - འགུལ་སྐྱོད་བྱས་པའི་LAN - - - - Activated WLAN - འགུལ་སྐྱོད་བྱས་པའི་WLAN - - - - - - - - Not connected - འབྲེལ་མཐུད་མི་བྱེད་པ། - - - - - - - - - - - - Disconnected - འབྲེལ་ཐག་ཆད་པ། - - - - No Other Wired Network Scheme - སྐུད་ཡོད་བརྙན་འཕྲིན་དྲ་བའི་འཆར་གཞི་གཞན་དག་མེད - - - Edit - 编辑 - - - Done - 完成 - - - No wifi connected. - 未连接任何网络 - - - - No Other Wireless Network Scheme - སྐུད་མེད་དྲ་རྒྱའི་འཆར་གཞི་གཞན་དག་མེད། - - - - Wired net is disconnected - སྐུད་ཡོད་དྲ་རྒྱ་ཆད་པ། - - - Wi-Fi is disconnected - 断开无线网络 - - - - Confirm your Wi-Fi password or usable of wireless card - ཁྱོད་ཀྱི་Wi-Fiཡི་གསང་གྲངས་སམ་ཡང་ན་སྐུད་མེད་བྱང་བུ་བཀོལ་སྤྱོད་བྱེད་ཆོག་པ་ར་སྤྲོད - - - Ethernet Networks - 其他有线网络 - - - New LAN - 新建有线网络 - - - Hide WiFi - 加入网络 - - - No usable network in the list - མིང་ཐོའི་ནང་དུ་སྤྱོད་གོ་ཆོད་པའི་དྲ་རྒྱ་མེད། + + + + HotSpot + + + + FlyMode + + + + Advanced + + + + Show KylinNM + + + + No wireless card detected + + + + Not connected + + + + Disconnected + - - NetOn, - དྲ་རྒྱ་དང་། + - Wifi Networks - 其他无线网络 + No Other Wired Network Scheme + - None - + No Other Wireless Network Scheme + - keep wired network switch is on before turning on wireless switch - 打开无线网开关前保持有线网开关打开 + Wired net is disconnected + - please insert the wireless network adapter - 请先插入无线网卡 - - - Abnormal connection exist, program will delete it - 正在断开异常连接的网络 - - - update Wi-Fi list now, click again - 正在更新 Wi-Fi列表 请再次点击 - - - update Wi-Fi list now - 正在更新 Wi-Fi列表 - - - Conn Ethernet Success - Conn Ethernetལེགས་འགྲུབ་བྱུང་བ། + - Conn Ethernet Fail - ཁུང་ནེ་ཨེ་ཐེ་ནའེ་ལ་ཕམ་ཉེས་བྱུང་བ། + - Conn Wifi Success - ཁུང་ནེ་ཝེ་ཧྥེ་ལེགས་འགྲུབ་བྱུང་བ། + + + + Confirm your Wi-Fi password or usable of wireless card + + + + Inactivated LAN + + + + LAN + + + + WLAN + + + + Activated LAN + + + + Activated WLAN + + + + Other WLAN + + + + + LettersWidget + + &&?! + + + + 123 + + + + Ctrl + + + + Alt + LockWidget - - Form - - - - Date དུས་ཚོད། - + Form + ནས་འོང་བ། + + Time དུས་ཚོད། Guest - 游客 + མགྲོན་པོ། SwitchUser - 切换用户 + བཀོལ་མི་བརྗེ་བ། - 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! + Password - 密码 - - - Wechat - 微信 - - - - Identify device removed! - དབྱེ་འབྱེད་སྒྲིག་ཆས་མེད་པར་བཟོ་དགོས། + MyLineEdit - - - Verification code - ཞིབ་བཤེར་གྱི་ཚབ་རྟགས། + + + + + NumbersWidget + + &&?! + + + + Return + OneConnForm - Form - རྣམ་པ། + ནས་འོང་བ། - - Automatically join the network - རང་འགུལ་གྱིས་དྲ་རྒྱའི་ནང་དུ་ཞུགས་པ། - - - Input password - 输入密码 - - - Config - 设置 - - - - - - Connect - སྦྲེལ་མཐུད་བྱེད་པ + - Disconnect - འབྲེལ་ཐག་ཆད་པ། + - Input Password... - ནང་འཇུག་གི་གསང་གྲངས་ + + + + Automatically join the network + - Connect to Hidden Wi-Fi Network - སྦས་སྐུང་བྱས་པའི་Wi-Fiདྲ་རྒྱ་སྦྲེལ་མཐུད་བྱེད་པ། + - - Signal: - བརྡ་རྟགས་ནི། - - - Public - 开放 - - - Safe - 安全 - - - Rate - 速率 - - - None - གཅིག་ཀྱང་མེད། + - WiFi Security: - WiFiབཀོལ་སྤྱོད་བདེ་འཇགས་ནི། + + + + Signal: + - MAC: - MAC: + - Conn Wifi Failed - ཁུང་ནེ་ཝེ་ཧྥེ་ཕམ་སོང་། + OneLancForm - Form - རྣམ་པ། + ནས་འོང་བ། - Config - 设置 - - - - Connect - སྦྲེལ་མཐུད་བྱེད་པ + - Disconnect - འབྲེལ་ཐག་ཆད་པ། + - - No Configuration - བཀོད་སྒྲིག་བྱས་མེད་པ། + - IPv4: - IPv4: + - IPv6: - IPv6: + - BandWidth: - 带宽: + - MAC: - MAC: - - - Auto - 自动 + PhoneAuthWidget - - Verification by phoneNum - ཁ་པར་གྱི་ནུའུ་མུའུ་ཡིས་ཞིབ་བཤེར་བྱས། + - 「 Use bound Phone number to verification 」 - 「ས་མཚམས་ཀྱི་ཁ་པར་ཨང་གྲངས་ལ་བརྟེན་ནས་ཞིབ་བཤེར་བྱ་དགོས།」 + - - 「 Use SMS to verification 」 - 「SMSབཀོལ་ནས་ཞིབ་བཤེར་བྱ་དགོས།」 - - - - commit - བསྒྲུབ་རྒྱུ་ཁས་ལེན་ + + + + 「 Use SMS to verification 」 + - - Network not connected~ - དྲ་རྒྱ་དང་འབྲེལ་མཐུད་མི་བྱེད་པ + - - Network unavailable~ - དྲ་རྒྱ་སྤྱོད་མི་ཐུབ་པ~ - - - Verification Code invalid! - ཞིབ་བཤེར་ཚད་གཞི་གོ་མི་ཆོད་པ་རེད། + - Verification Code incorrect.Please retry! - ཞིབ་བཤེར་ཚད་གཞི་ཡང་དག་མིན་པ། ཁྱེད་ཀྱིས་ཡང་བསྐྱར་ཐེངས་གཅིག་ལ་བསྐྱར་དུ་ཞིབ + - Failed time over limit!Retry after 1 hour! - ཚད་ལས་བརྒལ་ནས་ཕམ་ཁ་བྱུང་བའི་དུས་ཚོད་ ཆུ་ཚོད་1འགོར་རྗེས་ཡང་བསྐྱར་ཞིབ་བཤེར་བྱ་དགོས། + - verifaction failed! - ངོ་རྒོལ་བྱེད་པའི་བྱ་སྤྱོད་ལ་ཕམ་ཉེས་བྱུང་བ་རེད། + + + + Network unavailable~ + PowerManager - - lock - ཟྭ་རྒྱག་པ། + Sleep + མལ་གསོ། - SwitchUser - 切换用户 - - - logout - 注销 - - - reboot - 重启 - - - shutdown - 关机 + Log Out + རྩིས་ཐེམ་ནས་བསུབ་པ། Lock Screen - 锁屏 - - - Switch User - 切换用户 - - - - Log Out - ཕྱིར་འཐེན་བྱ་དགོས། + བརྙན་ཡོལ་ཟྭ་རྒྱག།(_L) Restart - ཡང་བསྐྱར་འགོ་འཛུགས་ + བསྐྱར་སློང་། - - - Reboot + Switch User + སྤྱོད་མཁན་བརྗེ་རེས། + + + Suspend + འགེལ་འཇོག + + + Power Off + འཁོར་ཁ་རྒྱག་པ། + + + lock - - Power Off - གློག་ཆད་པ། - - - Shut Down - ལས་མཚམས་འཇོག + - Hibernate - ཧིན་རྡུ་ཉི་ཞི་ཡ། - - - - Suspend - གནས་སྐབས་མཚམས་འཇོག་ - - - Sleep - 休眠 + QObject - - The screensaver is active. - བརྙན་ཤེལ་འདི་འགུལ་སྐྱོད་བྱེད་བཞིན་ཡོད། + The screensaver is inactive. + འཆར་ངོས་སྲུང་སྐྱོབ་བྱ་རིམ་སད་མི་འདུག - - The screensaver is inactive. - བརྙན་ཤེལ་འདི་ལ་ནུས་པ་མེད། + The screensaver is active. + འཆར་ངོས་སྲུང་སྐྱོབ་བྱ་རིམ་སད་འདུག + + + + S: + + + tablet device + Screensaver - exit(Esc) - 退出(Esc) + Automatic switching + རང་འགུལ་བརྗེ་སྤོར། - exit - 退出 - - - Picture does not exist - རི་མོ་མི་གནས་པ། + པར་རིས་མི་འདུག Set as desktop wallpaper - 设置为桌面壁纸 + ཅོག་ངོས་ཀྱི་གདོང་ཤོག་ཏུ་འཇོག་པ། - Automatic switching - 自动切换 - - - You have %1 unread message - 您有%1条未读消息 - - - - You have new notification - ཁྱེད་ཚོར་བརྡ་ཐོ་གསར་པ་ཡོད། - - - View - ལྟ་ཚུལ། + + + + You have new notification + SleepTime - - You have rested - ཁྱེད་ཚོས་ངལ་གསོ་བྱས་ཟིན་པ་གཤམ་གསལ། + You have rested: + ཁྱེད་ཀྱིས་ ལ་ངལ་གསོས་ཟིན། - You have rested: - ཁྱེད་ཚོས་ངལ་གསོ་བྱས་ཟིན་པ་གཤམ་གསལ། + You have rested + SureWindow - Form - རྣམ་པ། + ནས་འོང་བ། - TextLabel - ཡི་གེ་ལ་པེར་གྱིས་བཤད་རྒྱུར + - Cancel - ཕྱིར་འཐེན། + - Confirm - གཏན་འཁེལ་བྱ་དགོས། + - Multiple users are logged in at the same time.Are you sure you want to reboot this system? - 同时有多个用户登录系统,您确定要退出系统吗? - - - - The following program is running to prevent the system from suspend! - གཤམ་གྱི་གོ་རིམ་ནི་མ་ལག་གནས་སྐབས་མཚམས་འཇོག་པར་བཀག་འགོག་བྱེད་པའི་ཆེད་དུ་ཡིན། - - - - The following program is running to prevent the system from hibernate! - གཤམ་གྱི་གོ་རིམ་ནི་མ་ལག་ལ་བཀག་འགོག་བྱེད་པའི་ཆེད་དུ་ཡིན། - - - - The following program is running to prevent the system from shutting down! - གཤམ་གྱི་གོ་རིམ་ནི་མ་ལག་གི་སྒོ་རྒྱག་པར་བཀག་འགོག་བྱེད་པའི་ཆེད་དུ་ཡིན། - - - The following program is running to prevent the system from reboot! - གཤམ་གྱི་གོ་རིམ་ནི་མ་ལག་བསྐྱར་དུ་འབྱུང་བར་སྔོན་འགོག་བྱེད་ཆེད་ཡིན། - - - - SwitchButton - - login by password - 密码登录 + - login by qr code - 微信登录 + 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! + SwitchButtonGroup - uEduPWD - uEduPWD + - Wechat - འཕྲིན་ཕྲན། + TabletLockWidget - You have %1 unread message - 您有%1条未读消息 - - - Slide to unlock - 向上滑动解锁 - - - - New password is the same as old - གསང་གྲངས་གསར་པ་དང་རྙིང་པ་གཅིག་མཚུངས་ཡིན། - - - - Reset password error:%1 - གསང་གྲངས་ཀྱི་ནོར་འཁྲུལ་བསྐྱར་དུ་བཀོད་སྒྲིག་བྱེད་པ།%1 - - - - Please scan by correct WeChat - ཡང་དག་པའི་འཕྲིན་ཕྲན་ཐོག་ནས་ཞིབ་བཤེར་གནང་རོགས། - - - - - - - - Cancel - ཕྱིར་འཐེན། + - - Back - ཕྱིར་ལོག་པ། + - Skip - བྲོས་བྱོལ་དུ་སོང་བ། + + + + New password is the same as old + + + + Reset password error:%1 + + + + Please scan by correct WeChat + Utils - kylin network applet desktop message - kylinདྲ་རྒྱའི་ཀུ་ཤུའི་ཅོག་ཙེའི་ཆ་འཕྲིན། + VerificationWidget - Please scan by bound WeChat - འཕྲིན་ཕྲན་གྱིས་ཞིབ་བཤེར་བྱེད་རོགས། + VerticalVerificationWidget - Please scan by bound WeChat - འཕྲིན་ཕྲན་གྱིས་ཞིབ་བཤེར་བྱེད་རོགས། + WeChatAuthDialog - - Login by wechat - ཝེ་ཆི་ཐེས་ཐོ་འགོད་བྱས་པ། + - - - Verification by wechat - ཝེ་ཆི་ཐེས་ཞིབ་བཤེར་བྱས་པ། - - - - 「 Use registered WeChat account to login 」 - 「ཐོ་འགོད་བྱས་ཟིན་པའི་སྐད་འཕྲིན་གྱི་ཐོ་ཁོངས་ལ་བརྟེན་ནས་ཐོ་འགོད་བྱེད་པ།」 + + + + Verification by wechat + - - 「 Use bound WeChat account to verification 」 - 「ཚོད་འཛིན་རང་བཞིན་གྱི་སྐད་འཕྲིན་ཨང་གྲངས་ལ་བརྟེན་ནས་ཞིབ་བཤེར་བྱ་དགོས།」 + - - Network not connected~ - དྲ་རྒྱ་དང་འབྲེལ་མཐུད་མི་བྱེད་པ + - Scan code successfully - ཞིབ་བཤེར་ཨང་གྲངས་ལེགས་འགྲུབ་བྱུང་བ། + - Timeout!Try again! - དུས་ཚོད་ཕྱིར་འགོར་སོང་། ཡང་བསྐྱར་ཚོད་ལྟ།! + + + + + Widget + + Widget + - Login failed - 登录失败 + LoadPlugin + + + + + delay + + how long to show lock + + + + + has-lock + + if show lock + main - Start command for the ukui ScreenSaver. - ukui ScreenSaver ལ་བཀོད་འདོམས་བྱེད་འགོ་ཚུགས། + ཡོལ་སྒོའི་ཁ་འབྱེད་བཀའ་བརྡ། - - - lock the screen immediately - འཕྲལ་དུ་བརྙན་ཤེལ་ལ་ཟྭ་རྒྱག་པ། + མྱུར་དུ་འཆར་ངོས་ཀྱི་ཟྭ་རྒྱག་པ། - query the status of the screen saver - བརྙན་ཤེལ་གསོག་འཇོག་བྱེད་མཁན་གྱི་གནས་ཚུལ་ལ་འདྲི་རྩད་བྱས། + འཆར་ངོས་ལ་ཟྭ་བརྒྱབ་པའི་གནས་ཚུལ་ལེན་པ། - unlock the screen saver - བརྙན་ཤེལ་གསོག་འཇོག་བྱེད་མཁན་ལ་སྒོ་འབྱེད་ + འཆར་ངོས་ཀྱི་ཟྭ་ཕྱེ་བ། - - show the screensaver - བརྙན་ཤེལ་གྱི་བརྙན་ཤེལ་ལ་བལྟ་རུ་འཇུག་དགོས། - - - - 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 - སྒེའུ་ཁུང་གི་ཐོབ་ཐང་ + + + + show the screensaver + + + + Dialog for the ukui ScreenSaver. + + + + activated by session idle signal + + + + lock the screen and show screensaver immediately + + + + show screensaver immediately + + + + show blank and delay to lock,param:idle/lid/lowpower + + + + show blank screensaver immediately and delay time to show lock + + + + show blank screensaver immediately and if lock + diff --git a/i18n_ts/es.ts b/i18n_ts/es.ts index 57d0867..fc24bdf 100644 --- a/i18n_ts/es.ts +++ b/i18n_ts/es.ts @@ -107,6 +107,33 @@ Abnormal network + + Enter the ukey password + + + + Insert the ukey into the USB port + + + + + BatteryWidget + + Charging... + + + + fully charged + + + + PowerMode + + + + BatteryMode + + BioAuthWidget @@ -203,6 +230,28 @@ + + CharsMoreWidget + + &&?! + + + + + CharsWidget + + More + Más + + + ABC + + + + 123 + + + ConfForm @@ -312,6 +361,10 @@ QRCode + + ukey + + DigitalAuthDialog @@ -1225,6 +1278,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 @@ -1256,7 +1404,7 @@ KeyboardWidget KeyboardWidget - TecladoWidget + TecladoWidget @@ -1354,6 +1502,25 @@ + + LettersWidget + + &&?! + + + + 123 + + + + Ctrl + + + + Alt + + + LockWidget @@ -1397,7 +1564,7 @@ Password - Contraseña + Contraseña Identify device removed! @@ -1411,6 +1578,17 @@ + + NumbersWidget + + &&?! + + + + Return + + + OneConnForm @@ -1567,7 +1745,7 @@ - Reboot + Restart @@ -1582,6 +1760,14 @@ + + S: + + + tablet device + + + Screensaver @@ -1729,6 +1915,31 @@ + + Widget + + Widget + + + + LoadPlugin + + + + + delay + + how long to show lock + + + + + has-lock + + if show lock + + + main @@ -1783,5 +1994,17 @@ show screensaver immediately + + show blank and delay to lock,param:idle/lid/lowpower + + + + show blank screensaver immediately and delay time to show lock + + + + show blank screensaver immediately and if lock + + diff --git a/i18n_ts/fr.ts b/i18n_ts/fr.ts index 437fd21..8a0b976 100644 --- a/i18n_ts/fr.ts +++ b/i18n_ts/fr.ts @@ -107,6 +107,33 @@ Abnormal network + + Enter the ukey password + + + + Insert the ukey into the USB port + + + + + BatteryWidget + + Charging... + + + + fully charged + + + + PowerMode + + + + BatteryMode + + BioAuthWidget @@ -203,6 +230,28 @@ + + CharsMoreWidget + + &&?! + + + + + CharsWidget + + More + Plus + + + ABC + + + + 123 + + + ConfForm @@ -312,6 +361,10 @@ QRCode + + ukey + + DigitalAuthDialog @@ -1225,6 +1278,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 @@ -1256,7 +1404,7 @@ KeyboardWidget KeyboardWidget - KeyboardWidget + KeyboardWidget @@ -1354,6 +1502,25 @@ + + LettersWidget + + &&?! + + + + 123 + + + + Ctrl + + + + Alt + + + LockWidget @@ -1397,7 +1564,7 @@ Password - Mot de passe + Mot de passe Identify device removed! @@ -1411,6 +1578,17 @@ + + NumbersWidget + + &&?! + + + + Return + + + OneConnForm @@ -1567,7 +1745,7 @@ - Reboot + Restart @@ -1582,6 +1760,14 @@ + + S: + + + tablet device + + + Screensaver @@ -1729,6 +1915,31 @@ + + Widget + + Widget + + + + LoadPlugin + + + + + delay + + how long to show lock + + + + + has-lock + + if show lock + + + main @@ -1783,5 +1994,17 @@ show screensaver immediately + + show blank and delay to lock,param:idle/lid/lowpower + + + + show blank screensaver immediately and delay time to show lock + + + + show blank screensaver immediately and if lock + + diff --git a/i18n_ts/pt.ts b/i18n_ts/pt.ts index 1e49e91..ed89cdf 100644 --- a/i18n_ts/pt.ts +++ b/i18n_ts/pt.ts @@ -107,6 +107,33 @@ Abnormal network + + Enter the ukey password + + + + Insert the ukey into the USB port + + + + + BatteryWidget + + Charging... + + + + fully charged + + + + PowerMode + + + + BatteryMode + + BioAuthWidget @@ -203,6 +230,28 @@ + + CharsMoreWidget + + &&?! + + + + + CharsWidget + + More + Mais + + + ABC + + + + 123 + + + ConfForm @@ -312,6 +361,10 @@ QRCode + + ukey + + DigitalAuthDialog @@ -1225,6 +1278,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 @@ -1256,7 +1404,7 @@ KeyboardWidget KeyboardWidget - KeyboardWidget + KeyboardWidget @@ -1354,6 +1502,25 @@ + + LettersWidget + + &&?! + + + + 123 + + + + Ctrl + + + + Alt + + + LockWidget @@ -1397,7 +1564,7 @@ Password - Senha + Senha Identify device removed! @@ -1411,6 +1578,17 @@ + + NumbersWidget + + &&?! + + + + Return + + + OneConnForm @@ -1567,7 +1745,7 @@ - Reboot + Restart @@ -1582,6 +1760,14 @@ + + S: + + + tablet device + + + Screensaver @@ -1729,6 +1915,31 @@ + + Widget + + Widget + + + + LoadPlugin + + + + + delay + + how long to show lock + + + + + has-lock + + if show lock + + + main @@ -1783,5 +1994,17 @@ show screensaver immediately + + show blank and delay to lock,param:idle/lid/lowpower + + + + show blank screensaver immediately and delay time to show lock + + + + show blank screensaver immediately and if lock + + diff --git a/i18n_ts/ru.ts b/i18n_ts/ru.ts index 84dd7fc..cf16e7f 100644 --- a/i18n_ts/ru.ts +++ b/i18n_ts/ru.ts @@ -107,6 +107,33 @@ Abnormal network + + Enter the ukey password + + + + Insert the ukey into the USB port + + + + + BatteryWidget + + Charging... + + + + fully charged + + + + PowerMode + + + + BatteryMode + + BioAuthWidget @@ -203,6 +230,28 @@ + + CharsMoreWidget + + &&?! + + + + + CharsWidget + + More + Больше + + + ABC + + + + 123 + + + ConfForm @@ -312,6 +361,10 @@ QRCode + + ukey + + DigitalAuthDialog @@ -1225,6 +1278,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 @@ -1256,7 +1404,7 @@ KeyboardWidget KeyboardWidget - KeyboardWidget + KeyboardWidget @@ -1354,6 +1502,25 @@ + + LettersWidget + + &&?! + + + + 123 + + + + Ctrl + + + + Alt + + + LockWidget @@ -1397,7 +1564,7 @@ Password - пароль + пароль Identify device removed! @@ -1411,6 +1578,17 @@ + + NumbersWidget + + &&?! + + + + Return + + + OneConnForm @@ -1567,7 +1745,7 @@ - Reboot + Restart @@ -1582,6 +1760,14 @@ + + S: + + + tablet device + + + Screensaver @@ -1729,6 +1915,31 @@ + + Widget + + Widget + + + + LoadPlugin + + + + + delay + + how long to show lock + + + + + has-lock + + if show lock + + + main @@ -1783,5 +1994,17 @@ show screensaver immediately + + show blank and delay to lock,param:idle/lid/lowpower + + + + show blank screensaver immediately and delay time to show lock + + + + show blank screensaver immediately and if lock + + diff --git a/i18n_ts/tr.ts b/i18n_ts/tr.ts index cc6562f..2fecce2 100644 --- a/i18n_ts/tr.ts +++ b/i18n_ts/tr.ts @@ -16,7 +16,7 @@ Parola - + Retry Yeniden Dene @@ -41,102 +41,114 @@ Kimlik doğrulama hatası, hala %1 kalan denemen var - + Authentication failure, Please try again - - - - + + + + Please try again in %1 minutes. - - - - + + Enter the ukey password + + + + + Insert the ukey into the USB port + + + + + + + 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 - + Abnormal network @@ -153,6 +165,29 @@ Diğer Ayıtlar + + BatteryWidget + + + Charging... + + + + + fully charged + + + + + PowerMode + + + + + BatteryMode + + + BioDevices @@ -227,6 +262,32 @@ Tamam + + CharsMoreWidget + + + &&?! + + + + + CharsWidget + + + More + + + + + ABC + + + + + 123 + + + ConfForm @@ -361,6 +422,11 @@ + ukey + + + + QRCode @@ -1506,6 +1572,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 @@ -1540,14 +1724,6 @@ - - KeyboardWidget - - - KeyboardWidget - - - KylinNM @@ -1623,7 +1799,7 @@ - + Not connected @@ -1636,7 +1812,7 @@ - + Disconnected @@ -1662,26 +1838,49 @@ - + Conn Ethernet Success - + Conn Ethernet Fail - + Conn Wifi Success - + Confirm your Wi-Fi password or usable of wireless card + + LettersWidget + + + &&?! + + + + + 123 + + + + + Ctrl + + + + + Alt + + + LockWidget @@ -1708,17 +1907,17 @@ 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 @@ -1726,16 +1925,17 @@ LoginOptionsWidget - + Login Options + Password - Parola + Parola - + Identify device removed! @@ -1750,6 +1950,19 @@ + + NumbersWidget + + + &&?! + + + + + Return + + + OneConnForm @@ -1915,7 +2128,7 @@ PowerManager - + lock kilit @@ -1944,37 +2157,33 @@ Kullanıcı Değiştir - + Log Out Çıkış + + Restart - Yeniden Başlat + Yeniden Başlat - - - Reboot - - - - + Power Off Bilgisayarı Kapat - + Shut Down - + Hibernate - + Suspend @@ -1982,16 +2191,25 @@ QObject - + The screensaver is active. - + The screensaver is inactive. + + S: + + + + tablet device + + + Screensaver @@ -2003,17 +2221,17 @@ çıkış - + Picture does not exist - + View - + You have new notification @@ -2029,7 +2247,7 @@ SleepTime - + You have rested @@ -2057,22 +2275,22 @@ - + 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! @@ -2093,38 +2311,38 @@ TabletLockWidget - - - - - - + + + + + + Cancel - - + + Back - + Skip - + New password is the same as old - + Reset password error:%1 - + Please scan by correct WeChat @@ -2196,56 +2414,100 @@ + + Widget + + + Widget + + + + + LoadPlugin + + + + + delay + + + how long to show lock + + + + + has-lock + + + if show lock + + + main - + Start command for the ukui ScreenSaver. Ukui Ekran Koruyucu için başlatma komutu. - - + + lock the screen immediately Ekranı hemen kilitle - + query the status of the screen saver - + unlock the screen saver - + show the screensaver - + + show blank and delay to lock,param:idle/lid/lowpower + + + + Dialog for the ukui ScreenSaver. - + activated by session idle signal - - + + lock the screen and show screensaver immediately - + show screensaver immediately + + + show blank screensaver immediately and delay time to show lock + + + + + show blank screensaver immediately and if lock + + Screensaver for ukui-screensaver diff --git a/i18n_ts/zh_CN.ts b/i18n_ts/zh_CN.ts index 4c27468..ac55ca7 100644 --- a/i18n_ts/zh_CN.ts +++ b/i18n_ts/zh_CN.ts @@ -16,7 +16,7 @@ 使用密码认证 - + Retry 重试 @@ -45,71 +45,72 @@ 账户锁定%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 +119,8 @@ 使用绑定的微信扫码或输入密码登录 - - + + Password cannot be empty 密码不能为空 @@ -132,7 +133,8 @@ 无法验证%1,请输入密码. - + + Failed to verify %1, you still have %2 verification opportunities 验证%1失败,您还有%2次尝试机会 @@ -161,22 +163,32 @@ 请输入密码或者录入指纹 - + Authentication failure, Please try again 认证失败,请重试 - + Use the bound wechat scanning code or enter the password to unlock 使用绑定的微信扫码或输入密码解锁 - + + Enter the ukey password + 输入安全密钥密码 + + + + Insert the ukey into the USB port + 请将安全密钥插入USB端口 + + + Password 密码 - + Login 登录 @@ -204,24 +216,22 @@ BatteryWidget - - + BatteryMode 电池模式 - - + PowerMode 电源模式 - + Charging... 正在充电... - + fully charged 已充满电 @@ -300,6 +310,44 @@ 确定 + + CharsMoreWidget + + Return + 返回 + + + + &&?! + + + + + CharsWidget + + + More + 更多 + + + + ABC + + + + + 123 + + + + Return + 返回 + + + Number + 数字 + + ConfForm @@ -446,6 +494,11 @@ + ukey + + + + QRCode 二维码 @@ -1783,14 +1836,6 @@ 获取验证码 - - KeyboardWidget - - - KeyboardWidget - - - KylinDBus @@ -1916,7 +1961,7 @@ - + Not connected 未连接任何网络 @@ -1929,7 +1974,7 @@ - + Disconnected 未连接 @@ -1965,7 +2010,7 @@ 断开无线网络 - + Confirm your Wi-Fi password or usable of wireless card 请确认Wi-Fi密码或无线设备 @@ -2021,21 +2066,52 @@ 正在更新 Wi-Fi列表 - + Conn Ethernet Success 连接有线网络成功 - + Conn Ethernet Fail 连接有线网络失败 - + Conn Wifi Success 连接无线网络成功 + + LettersWidget + + Symbol + 符号 + + + Num + 数字 + + + + &&?! + + + + + 123 + + + + + Ctrl + + + + + Alt + + + LockWidget @@ -2062,17 +2138,17 @@ 切换用户 - + Multiple users are logged in at the same time.Are you sure you want to reboot this system? 同时有多个用户登录系统,您确定要退出系统吗? - + LAN 有线网络 - + WLAN 无线局域网 @@ -2080,20 +2156,21 @@ LoginOptionsWidget - + Login Options 登录选项 + Password - 密码 + 密码 Wechat 微信 - + Identify device removed! 校验设备已移除! @@ -2108,6 +2185,23 @@ 短信验证码 + + NumbersWidget + + Symbol + 符号 + + + + &&?! + + + + + Return + 返回 + + OneConnForm @@ -2301,7 +2395,7 @@ PowerManager - + lock 锁定 @@ -2330,37 +2424,37 @@ 切换用户 - + Log Out 注销 - + + Restart 重启 - Reboot - 重启 + 重启 - + Power Off 关机 - + Shut Down 关机 - + Hibernate 休眠 - + Suspend 睡眠 @@ -2372,12 +2466,12 @@ QObject - + The screensaver is active. 屏幕保护程序已激活 - + The screensaver is inactive. 屏幕保护程序未激活 @@ -2387,7 +2481,7 @@ - this is only shown for laptops with multiple batteries + tablet device @@ -2402,7 +2496,7 @@ 退出 - + Picture does not exist 图片不存在 @@ -2419,12 +2513,12 @@ 您有%1条未读消息 - + You have new notification 您有新的消息 - + View 预览 @@ -2436,7 +2530,7 @@ 您已休息: - + You have rested 您已休息 @@ -2468,22 +2562,22 @@ 同时有多个用户登录系统,您确定要退出系统吗? - + The following program is running to prevent the system from suspend! 以下程序正在运行,阻止系统进入睡眠! - + The following program is running to prevent the system from hibernate! 以下程序正在运行,阻止系统进入休眠! - + The following program is running to prevent the system from shutting down! 以下程序正在运行,阻止系统关机! - + The following program is running to prevent the system from reboot! 以下程序正在运行,阻止系统重启! @@ -2523,38 +2617,38 @@ 向上滑动解锁 - + New password is the same as old 新密码与原密码相同 - + Reset password error:%1 重置密码失败:%1 - + Please scan by correct WeChat 请使用正确的微信扫码 - - - - - - + + + + + + Cancel 取消 - - + + Back 返回 - + Skip 跳过 @@ -2630,56 +2724,100 @@ 登录失败 + + Widget + + + Widget + + + + + LoadPlugin + + + + + delay + + + how long to show lock + + + + + has-lock + + + if show lock + + + main - + Start command for the ukui ScreenSaver. 启动锁屏到命令 - - + + lock the screen immediately 马上锁定屏幕 - + query the status of the screen saver 获取锁屏状态 - + unlock the screen saver 解锁屏幕 - + show the screensaver - + + show blank and delay to lock,param:idle/lid/lowpower + + + + Dialog for the ukui ScreenSaver. - + activated by session idle signal - - + + lock the screen and show screensaver immediately - + show screensaver immediately + + + show blank screensaver immediately and delay time to show lock + + + + + show blank screensaver immediately and if lock + + Screensaver for ukui-screensaver diff --git a/screensaver-focus-helper/blackwindow.cpp b/screensaver-focus-helper/blackwindow.cpp index 52f270e..0830595 100644 --- a/screensaver-focus-helper/blackwindow.cpp +++ b/screensaver-focus-helper/blackwindow.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 . + * +**/ #include "blackwindow.h" #include #include diff --git a/screensaver-focus-helper/blackwindow.h b/screensaver-focus-helper/blackwindow.h index 9f30d24..6d1f071 100644 --- a/screensaver-focus-helper/blackwindow.h +++ b/screensaver-focus-helper/blackwindow.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 BLACKWINDOW_H #define BLACKWINDOW_H diff --git a/screensaver-focus-helper/main.cpp b/screensaver-focus-helper/main.cpp index 35a93f6..70b9982 100644 --- a/screensaver-focus-helper/main.cpp +++ b/screensaver-focus-helper/main.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 . + * +**/ #include #include #include diff --git a/screensaver/CMakeLists.txt b/screensaver/CMakeLists.txt index 834e258..ce810ff 100644 --- a/screensaver/CMakeLists.txt +++ b/screensaver/CMakeLists.txt @@ -1,6 +1,7 @@ pkg_check_modules(X11 REQUIRED x11) pkg_check_modules(XTST REQUIRED xtst) pkg_check_modules(QGS REQUIRED gsettings-qt) +pkg_check_modules(KDKINFO REQUIRED kysdk-sysinfo) include_directories(${PROJECT_BINARY_DIR}) include_directories(${PROJECT_SOURCE_DIR}/Common) @@ -9,14 +10,20 @@ include_directories( ${X11_INCLUDE_DIRS} ${XTST_INCLUDE_DIRS} ${QGS_INCLUDE_DIRS} + ${KDKINFO_INCLUDE_DIRS} ) +link_directories( + ${KDKINFO_LIBRARY_DIRS} + ) + set(EXTRA_LIBS ${EXTRA_LIBS} ${X11_LIBRARIES} ${XTST_LIBRARIES} - ${QGS_LIBRARIES} - Common + ${QGS_LIBRARIES} + ${KDKINFO_LIBRARIES} + Common ) qt5_add_resources(screensaver_SRC default.qrc diff --git a/screensaver/assets/default.qss b/screensaver/assets/default.qss index 868e216..7985c01 100644 --- a/screensaver/assets/default.qss +++ b/screensaver/assets/default.qss @@ -1,13 +1,10 @@ QLabel#dateOfWeek { - font-size:16px; color: #ffffff; } QLabel#dateOfLocaltime { - font-size:50px; color: #ffffff; } QLabel#dateOfDay { - font-size:16px; color: #ffffff; } QLabel#dateOfLunar { @@ -17,28 +14,22 @@ QLabel#dateOfLunar { QLabel#clockTime { background:rgba(255,255,255,0.15); border-radius: 6px; - font-size:20px; color: #ffffff; } QLabel#colon { - font-size:20px; color: #ffffff; } QLabel#restTime { - font-size:20px; color: #ffffff; opacity:0.6; } QLabel#centerLabel { - font-size:36px; color: #ffffff; } QLabel#authorLabel { - font-size:28px; color: #ffffff; } QLabel#myText{ - font-size:24px; border-radius: 6px; background: rgba(255, 255, 255, 82%); padding: 24px 24px 24px 24px; diff --git a/screensaver/customplugin.cpp b/screensaver/customplugin.cpp index afacc06..0ac4702 100644 --- a/screensaver/customplugin.cpp +++ b/screensaver/customplugin.cpp @@ -1,4 +1,21 @@ -#include "customplugin.h" +/* + * Copyright (C) 2018 Tianjin KYLIN Information Technology 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, 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 . + * +**/ +#include "customplugin.h" #include "screensaver.h" CustomPlugin::CustomPlugin(QObject *parent):QObject(parent) diff --git a/screensaver/customplugin.h b/screensaver/customplugin.h index 2d041f7..49f3b07 100644 --- a/screensaver/customplugin.h +++ b/screensaver/customplugin.h @@ -1,4 +1,21 @@ -#ifndef CUSTOMPLUGIN_H +/* + * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 CUSTOMPLUGIN_H #define CUSTOMPLUGIN_H #include "screensaverplugin.h" diff --git a/screensaver/cyclelabel.cpp b/screensaver/cyclelabel.cpp index a97f42f..f6c847a 100644 --- a/screensaver/cyclelabel.cpp +++ b/screensaver/cyclelabel.cpp @@ -1,11 +1,10 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * +/* * Copyright (C) 2019 Tianjin KYLIN Information Technology 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 2 of the License, or - * (at your option) any later version. + * the Free Software Foundation; either version 3, 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 @@ -13,10 +12,9 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + * along with this program; if not, see . * - */ +**/ #include "cyclelabel.h" diff --git a/screensaver/cyclelabel.h b/screensaver/cyclelabel.h index 9967836..b8b2af6 100644 --- a/screensaver/cyclelabel.h +++ b/screensaver/cyclelabel.h @@ -1,11 +1,10 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * +/* * Copyright (C) 2019 Tianjin KYLIN Information Technology 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 2 of the License, or - * (at your option) any later version. + * the Free Software Foundation; either version 3, 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 @@ -13,10 +12,9 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + * along with this program; if not, see . * - */ +**/ #ifndef CYCLELABEL_H #define CYCLELABEL_H diff --git a/screensaver/language/screensaver-zh_CN.ini b/screensaver/language/screensaver-zh_CN.ini index c921ed2..51b93e7 100644 --- a/screensaver/language/screensaver-zh_CN.ini +++ b/screensaver/language/screensaver-zh_CN.ini @@ -1,168 +1,121 @@ [1] -OL=天生我材必有用,千金散尽还复来。 -author=李白《将进酒》 +FL=世上的事,只要肯用心去学, +SL=没有一件是太晚的。 +author=三毛《送你一匹马》 [2] -OL=新时代的伟大成就是党和人民一道拼出来、干出来、奋斗出来的。 -author=习近平 +OL=如果你是大河,何必在乎别人把你当成小溪。 +author=汪国真 《如果》 [3] -OL=莫愁前路无知己,天下谁人不识君。 -author=高适《别董大二首》 +OL=世界上有不绝的风景,我有不老的心情。 +author=汪国真《我喜欢出发》 [4] -OL=莫听穿林打叶声,何妨吟啸且徐行。 -author=苏轼《定风波》 +OL=人生如逆旅,我亦是行人。 +author=苏轼《临江仙·送钱穆父》 [5] -OL=党用伟大奋斗创造了百年伟业,也一定能用新的伟大奋斗创造新的伟业。 -author=习近平 +OL=行乐直须年少,尊前看取衰翁。 +author=欧阳修《朝中措·送刘仲原甫出守维扬》 [6] -OL=巧言令色,鲜矣仁! -author=《论语》 +OL=行到水穷处,坐看云起时。 +author=王维《终南别业》 [7] -FL=与君初相识,犹如故人归。 -SL=天涯明月新,朝暮最相思。 -author=杜牧《会友》 -[8] -FL=一个饱经沧桑而初心不变的党,才能基业常青; -SL=一个铸就辉煌仍勇于自我革命的党,才能无坚不摧。 -author=习近平 -[9] -OL=见贤思齐焉,见不贤而内自省也。 -author=《论语》 -[10] -OL=为政以德,譬如北辰,居其所而众星共之。 -author=《论语》 -[11] -FL=道阻且长,行则将至。前进道路上,无论是风高浪急还是惊涛骇浪, -SL=人民永远是我们最坚实的依托、最强大的底气。 -author=习近平 -[12] -OL=知彼知己,百战不殆。 -author=《孙子兵法》 -[13] -OL=人患不知其过,既知之,不能改,是无勇也。 -author=韩愈《五箴》 -[14] -FL=新征程是充满光荣和梦想的远征。蓝图已经绘就,号角已经吹响。 -SL=我们要踔厉奋发、勇毅前行,努力创造更加灿烂的明天。 -author=习近平 -[15] -OL=万物并育而不相害,道并行而不相悖 -author=《礼记·中庸》 -[16] -OL=自信人生二百年,会当水击三千里 -author=毛泽东《七古·残句》 -[17] -OL=我们完全有信心有能力在新时代新征程创造令世人刮目相看的新的更大奇迹。 -author=习近平 -[18] -OL=青春虚度无所成,白首衔悲亦何及。 -author=权德舆《放歌行》 -[19] -OL=劳动模范是民族的精英、人民的楷模,是共和国的功臣。 -author=习近平 -[20] -FL=当前最重要的任务是撸起袖子加油干, -SL=一步一个脚印把党的二十大作出的重大决策部署付诸行动、见之于成效。 -author=习近平 -[21] -FL=广大人民群众坚持爱国奉献,无怨无悔,让我感到千千万万普通人最伟大, -SL=同时让我感到幸福都是奋斗出来的。 -author=2018新年贺词 习近平 -[22] -OL=中华文化既是历史的、也是当代的,既是民族的、也是世界的。 -author=习近平 -[23] -OL=没有坚实的物质技术基础,就不可能全面建成社会主义现代化强国。 -author=习近平 -[24] -OL=我们党没有自己的特殊利益,党在任何时候都是把群众利益放在第一位。 -author=习近平 -[25] -OL=知者行之始。行者知之成。 -author=王阳明《传习录·卷上·门人陆澄录》 -[26] -FL=江山就是人民,人民就是江山。 -SL=中国共产党领导人民打江山、守江山,守的是人民的心,治国有常,利民为本。 -author=习近平 -[27] -OL=此心不动,随机而动。 -author=王阳明 -[28] -OL=你未看此花时,此花与汝心同归于寂。 -author=《传习录·卷下·门人黄省曾录》 -[29] -FL=时代呼唤我们,人民期待着我们, -SL=唯有矢志不渝、笃行不怠,方能不负时代、不负人民。 -author=习近平 -[30] -OL=省察是有事时存养,存养是无事时省察。 -author=王阳明《传习录》 -[31] -OL=路漫漫其修远兮,吾将上下而求索。 -author=《离骚》 -[32] -OL=当代中国青年生逢其时,施展才干的舞台无比广阔,实现梦想的前景无比光明。 -author=习近平 -[33] -FL=解决台湾问题是中国人自己的事,要由中国人来决定。 -SL=国家统一、民族复兴的历史车轮滚滚向前,祖国完全统一一定要实现,也一定能够实现。 -author=习近平 -[34] -OL=悲莫悲兮生别离,乐莫乐兮新相知。 -author=《九歌·少司命》 -[35] -OL=风飒飒兮木萧萧,思公子兮徒离忧。 -author=《九歌·山鬼》 -[36] -OL=善守者,藏于九地之下,善攻者,动于九天之上。 -author=《孙子兵法》 -[37] -FL=我们正意气风发迈向全面建设社会主义现代化国家新征程, -SL=向第二个百年奋斗目标进军,以中国式现代化全面推进中华民族伟大复兴。 -author=习近平 -[38] -OL=善战者,致人而不致于人。 -author=《孙子兵法·虚实第六》 -[39] -OL=乱生于治,怯生于勇,弱生于强。 -author=《孙子兵法·兵势第五》 -[40] -FL=中国式现代化是中国共产党和中国人民长期实践探索的成果, -SL=是一项伟大而艰巨的事业。惟其艰巨,所以伟大;惟其艰巨,更显光荣。 -author=习近平 -[41] -OL=不战而屈人之兵,善之善者也。 -author=《孙子兵法·谋攻第三》 -[42] -OL=天行健,君子以自强不息。 -author=《周易.乾卦》 -[43] -FL=中国开放的大门只会越来越大。我们将坚定不移全面深化改革开放, -SL=坚定不移推动高质量发展,以自身发展为世界创造更多机遇。 -author=习近平 -[44] -OL=积善之家,必有余庆;积不善之家,必有余殃。 -author=《周易.坤卦》 -[45] -OL=穷则变,变则通,通则久。 -author=《周易.系辞下》 -[46] -FL=我们历来主张,人类的前途命运应该由世界各国人民来把握和决定。 -SL=只要共行天下大道,各国就能够和睦相处、合作共赢,携手创造世界的美好未来。 -author=习近平 -[47] -OL=天若有情天亦老,人间正道是沧桑 -author=毛泽东《七律·人民解放军占领南京》 -[48] OL=仰天大笑出门去,我辈岂是蓬蒿人。 author=李白《南陵别儿童入京》 -[49] -OL=落叶秋风生渭水,落叶满长安。 -author=贾岛《忆江上吴处士》 -[50] -OL=人生来是精神所附丽的物质,免不掉物质所常有的惰性。 -author=朱光潜《朝抵抗力最大的路径走》 -[51] -FL=能朝抵抗力最大的路径走,是人的特点。 -SL=人在能尽量发挥这特点时,就足见出他有富裕的生活力。 -author=朱光潜《朝抵抗力最大的路径走》 +[8] +OL=天生我材必有用,千金散尽还复来。 +author=李白《将进酒》 +[9] +OL=希君生羽翼,一化北溟鱼。 +author=李白《江夏使君叔席上赠史郎中》 +[10] +OL=惟沉默是最高的轻蔑。 +author=鲁迅《且介亭杂文附集》 +[11] +OL=虽偶有轻风细雨,但总归晴天朗照。 +author=史铁生《记忆与印象》 +[12] +OL=不能走远路却有辽阔的心。 +author=史铁生《我与地坛》 +[13] +OL=从卖气球的人那里,每个孩子牵走一个心愿。 +author=北岛《代课》 +[14] +OL=要有最朴素的生活和最遥远的梦想 +author=海子《枫》 +[15] +OL=雾打湿了我的双翼,可风却不容我再迟疑。 +author=舒婷《双桅船》 +[16] +OL=拯救地球好累,虽然有些疲惫但我还是会。 +author=《超人不会飞》 +[17] +OL=宁可一思进,莫在一思停。 +author=电影《一代宗师》 +[18] +OL=让人类永远保持理智,确实是一件奢侈的事。 +author=电影《流浪地球》 +[19] +FL=无论结果如何,人类的勇气和坚毅, +SL=都被镌刻在星空下。 +author=电影《流浪地球》 +[20] +OL=生活就像一盒巧克力,你不知道你的下一块口味是什么。 +author=电影《阿甘正传》 +[21] +FL=也许我们这些聪明人,脑袋里能装的目标太多, +SL=所以忘了执着。 +author=电影《阿甘正传》 +[22] +FL=我并不是每次吃完饭就看电视,有时我边吃边看电视, +SL=生活中有些改变会增加乐趣。 +author=电影《加菲猫》 +[23] +OL=做人如果没梦想,那跟咸鱼有什么分别? +author=电影《少林足球》 +[24] +FL=世界上有一种鸟是关不住的,因为它们的每一片羽毛都沾满了太阳的光辉。 +SL=当它们飞走的时候,你会觉得把它关起来是一种罪恶。 +author=电影《肖申克的救赎》 +[25] +FL=你每天都在做很多看起来毫无意义的决定, +SL=但某天你的某个决定就能改变你一生。 +author=电影《西雅图未眠夜》 +[26] +FL=把人类看做虫子的三体人似乎忘记了一个事实: +SL=虫子从来没有被战胜过。 +author=刘慈欣《三体》 +[27] +FL=在宇宙中,你再快都有比你更快的, +SL=你再慢也有比你更慢的。 +author=刘慈欣《三体》 +[28] +OL=人间风雨各处有,何处不是浪浪山? +author=国漫《小妖怪的夏天》 +[29] +FL=我看到那些岁月如何奔驰, +SL=挨过了冬季,便迎来了春天。 +author=《瓦尔登湖》 +[30] +OL=保持热爱,奔赴山海。 +author=佚名 +[31] +OL=别慌,月亮也正在大海某处迷茫。 +author=佚名 +[32] +OL=当太阳升到最高点的时候,影子就不见了。 +author=佚名 +[33] +OL=大直若屈,大巧若拙,大辩若讷。 +author=《老子》 +[34] +OL=博学之,审问之,慎思之,明辨之,笃行之。 +author=《礼记》 +[35] +OL=你要批评指点四周的风景,你首先要爬上屋顶。 +author=歌德 +[36] +OL=只有流过血的手指,才能弹出世间的绝唱。 +author=泰戈尔 +[37] +OL=他强任他强,清风拂山岗。 +author=佚名 diff --git a/screensaver/main.cpp b/screensaver/main.cpp index c7d725f..28f3dd3 100644 --- a/screensaver/main.cpp +++ b/screensaver/main.cpp @@ -34,6 +34,7 @@ #include "config.h" +#define WORKING_DIRECTORY "/usr/share/ukui-screensaver" bool bControlFlg = false;//是否控制面板窗口 int main(int argc, char *argv[]) @@ -43,7 +44,15 @@ int main(int argc, char *argv[]) QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); #endif QApplication a(argc, argv); - prctl(PR_SET_PDEATHSIG, SIGHUP); + prctl(PR_SET_PDEATHSIG, SIGHUP); + //加载翻译文件 + QString locale = QLocale::system().name(); + QTranslator translator; + QString qmFile = QString(WORKING_DIRECTORY"/i18n_qm/%1.qm").arg(locale); + translator.load(qmFile); + a.installTranslator(&translator); + qDebug() << "load translation file " << qmFile; + QCommandLineParser parser; QString windowId; @@ -72,14 +81,24 @@ int main(int argc, char *argv[]) scale = screen->devicePixelRatio(); if(onWindow){ - windowId = parser.value("window-id"); + windowId = parser.value("window-id"); WId wid = windowId.toULong(); + + /*获取窗口属性失败时程序退出,这是为了避免应用调用屏保的一瞬间崩溃,导致 + 屏保获取到一个不存在的winid,从而产生一个屏保窗口*/ + + if(!XGetWindowAttributes (QX11Info::display(), wid, &xwa)) + { + qDebug()<<"XGetWindowAttributes failed"; + exit(0); + } + QWindow* window = QWindow::fromWinId(wid); - window->setProperty("_q_embedded_native_parent_handle",QVariant(wid)); + s.setProperty("_q_embedded_native_parent_handle",QVariant(wid)); + /*设置焦点穿透*/ + s.setWindowFlag(Qt::WindowTransparentForInput, true); s.winId(); - s.windowHandle()->setParent(window); - XGetWindowAttributes (QX11Info::display(), wid, &xwa); -/* + s.windowHandle()->setParent(window); #ifndef USE_INTEL XClassHint ch; ch.res_name = NULL; @@ -87,9 +106,10 @@ int main(int argc, char *argv[]) XGetClassHint (QX11Info::display(), wid, &ch); if(ch.res_name && strcmp(ch.res_name,"ukui-control-center")==0){ bControlFlg = true; + s.addClickedEvent(); } #endif -*/ + //获取屏保所在屏幕对应的缩放比例。 for(auto screen : QGuiApplication::screens()) { diff --git a/screensaver/scconfiguration.cpp b/screensaver/scconfiguration.cpp index a348df4..7342b76 100644 --- a/screensaver/scconfiguration.cpp +++ b/screensaver/scconfiguration.cpp @@ -21,6 +21,10 @@ #include #include #include +#include +#include +#include +#include "glibinterface.h" #define GSETTINGS_SCHEMA_SCREENSAVER "org.ukui.screensaver" #define GSETTINGS_SCHEMA_MATE_BACKGROUND "org.mate.background" @@ -119,9 +123,13 @@ void SCConfiguration::onConfigurationChanged(QString key) }else if(key == "menuTransparency"){ int blur_Num = stygsettings->get("menuTransparency").toInt(); Q_EMIT blurChanged(blur_Num); - }else if(key == "styleName"){ + }else if(key == "styleName"){ QString m_curStyle = stygsettings->get("styleName").toString(); Q_EMIT styleChanged(m_curStyle); + } else if (key == "systemFontSize") { + double m_curFontSize = stygsettings->get("systemFontSize").toDouble(); + qDebug() << "curFontSize = " << m_curFontSize ; + Q_EMIT fontSizeChanged(m_curFontSize); } } @@ -132,10 +140,19 @@ QString SCConfiguration::getDefaultBackground() backgroundFile = ukgsettings->get("background").toString(); } - if(ispicture(backgroundFile)) + if(ispicture(backgroundFile)) { return backgroundFile; - else + } else { + char *systemName = kdk_system_get_systemName(); + if (systemName) { + if (QString(systemName) == "openKylin") { + free(systemName); + return "/usr/share/backgrounds/1-openkylin.jpg"; + } + free(systemName); + } return "/usr/share/backgrounds/1-warty-final-ubuntukylin.jpg"; + } } int SCConfiguration::getTimeType() @@ -162,6 +179,30 @@ QString SCConfiguration::getDateType() return dateType; } +int SCConfiguration::getFontSize() +{ + double fontSize = 0; + if(stygsettings){ + QStringList keys = stygsettings->keys(); + if (keys.contains("systemFontSize")) { + fontSize = stygsettings->get("systemFontSize").toDouble(); + } + } + + double defaultFontSize = getDefaultFontSize(); + qDebug()<<"defaultFontSize = "<logicalDotsPerInch() > 0) + m_ptTopx = 72/(QApplication::primaryScreen()->logicalDotsPerInch()); + return m_ptTopx; +} + bool SCConfiguration::getAutoSwitch() { bool ret = false; diff --git a/screensaver/scconfiguration.h b/screensaver/scconfiguration.h index e41ba78..83322fe 100644 --- a/screensaver/scconfiguration.h +++ b/screensaver/scconfiguration.h @@ -38,6 +38,8 @@ public: QString getDefaultBackground(); //获取屏保默认背景 int getTimeType(); //获取显示时间格式 QString getDateType(); //获取日期格式 + int getFontSize(); //获取当前字体大小 + double getPtToPx(); bool getAutoSwitch(); //获取是否自动切换 bool getCShowRestTime(); //自定义是否显示休息时间 bool getUShowRestTime(); //UKUI是否显示休息时间 @@ -69,6 +71,7 @@ Q_SIGNALS: QString dateTypeChanged(QString type); int blurChanged(int num); QString styleChanged(QString type); + int fontSizeChanged(int fontSize); private: void initGsettings(); diff --git a/screensaver/screensaver.cpp b/screensaver/screensaver.cpp index b67a12e..dfb1b31 100644 --- a/screensaver/screensaver.cpp +++ b/screensaver/screensaver.cpp @@ -68,7 +68,6 @@ #define KEY_MESSAGE_SHOW_ENABLED "show-message-enabled" #define KEY_HOURSYSTEM "hoursystem" #define KEY_DATE_FORMAT "date" -#define WORKING_DIRECTORY "/usr/share/ukui-screensaver" QTime Screensaver::m_currentTime = QTime::currentTime(); extern bool bControlFlg; @@ -99,14 +98,6 @@ Screensaver::Screensaver(bool isscreensaver,QWidget *parent): screenLabel(nullptr), respondClick(false) { - //加载翻译文件 - QString locale = QLocale::system().name(); - QTranslator translator; - QString qmFile = QString(WORKING_DIRECTORY"/i18n_qm/%1.qm").arg(locale); - translator.load(qmFile); - qApp->installTranslator(&translator); - qDebug() << "load translation file " << qmFile; - installEventFilter(this); // setWindowFlags(Qt::X11BypassWindowManagerHint); setUpdateCenterWidget(); @@ -123,7 +114,8 @@ Screensaver::Screensaver(bool isscreensaver,QWidget *parent): myText = configuration->getMyText(); }else isUShowRestTime = configuration->getUShowRestTime(); - + curFontSize = configuration->getFontSize(); + m_ptToPx = configuration->getPtToPx(); initUI(); m_background = new MBackground(); @@ -251,6 +243,11 @@ void Screensaver::onDateFormatChanged(QString type){ dateType = type; } +void Screensaver::onFontSizeChanged(int fontSize) +{ + curFontSize = fontSize; +} + void Screensaver::onMessageNumberChanged(int num) { int number = configuration->getMessageNumber(); @@ -513,12 +510,23 @@ void Screensaver::resizeEvent(QResizeEvent */*event*/) for(int i = 0;ifont().pixelSize(); + int fontpt = labelList.at(i)->font().pointSize(); + if (fontsize > 0) { #ifdef USE_INTEL - const QString SheetStyle = QString("font-size:%1px;").arg(fontsize/3); + const QString SheetStyle = QString("font-size:%1px;").arg(fontsize/3); #else - const QString SheetStyle = QString("font-size:%1px;").arg(fontsize/4); + const QString SheetStyle = QString("font-size:%1px;").arg(fontsize/4); #endif - labelList.at(i)->setStyleSheet(SheetStyle); + labelList.at(i)->setStyleSheet(SheetStyle); + } else { + QFont font = labelList.at(i)->font(); +#ifdef USE_INTEL + font.setPointSize(fontpt/3); +#else + font.setPointSize(fontpt/4); +#endif + labelList.at(i)->setFont(font); + } } QList childList = timeLayout->findChildren(); for (int i = 0; i < childList.count(); ++i) { @@ -531,25 +539,6 @@ void Screensaver::resizeEvent(QResizeEvent */*event*/) flag = 1; #ifndef USE_INTEL if(myTextWidget){ - -// QColor highLightColor = palette().color(QPalette::Base); -// QString stringColor = QString("rgba(%1,%2,%3,82%)") -// .arg(highLightColor.red()) -// .arg(highLightColor.green()) -// .arg(highLightColor.blue()); -// QColor textColor = palette().color(QPalette::Text); -// QString textString = QString("rgb(%1,%2,%3)") -// .arg(textColor.red()) -// .arg(textColor.green()) -// .arg(textColor.blue()); -// QColor borderColor = palette().color(QPalette::BrightText); -// QString borderString = QString("rgba(%1,%2,%3,85%)") -// .arg(borderColor.red()) -// .arg(borderColor.green()) -// .arg(borderColor.blue()); - -// myTextLabel->setStyleSheet(QString("font-size:5px;border-radius: 2px;background: %1;color: %2;padding: 4px 8px 4px 8px;border-width: 1px;border-style: solid;border-color:%3;") \ -// .arg(stringColor).arg(textString).arg(borderString)); if(curStyle == "ukui-dark" || curStyle == "ukui-black"){ myTextLabel->setStyleSheet(QString("QLabel{font-size:5px;border-radius: 2px;padding: 4px 8px 4px 8px;border-width: 1px;\ background: rgba(0, 0, 0, %1); color:#FFFFFF; border-radius:16px}").arg(blur_Num * 0.01)); @@ -981,6 +970,9 @@ void Screensaver::setDatelayout() QVBoxLayout *vtimeLayout = new QVBoxLayout(timeLayout); this->dateOfLocaltime = new QLabel(this); + sysFont= qApp->font(); + sysFont.setPointSize((58 + curFontSize) *m_ptToPx); + this->dateOfLocaltime->setFont(sysFont); if(timeType == 12) this->dateOfLocaltime->setText(QDateTime::currentDateTime().toString("A hh:mm")); else @@ -992,10 +984,12 @@ void Screensaver::setDatelayout() vtimeLayout->addWidget(dateOfLocaltime); this->dateOfDay = new QLabel(this); + sysFont.setPointSize((16 + curFontSize) *m_ptToPx); + this->dateOfDay->setFont(sysFont); if(dateType == "cn") - this->dateOfDay->setText(QDate::currentDate().toString("yyyy/MM/dd ddd")); + this->dateOfDay->setText(QDate::currentDate().toString("yyyy/MM/dd ddd").replace("周","星期")); else - this->dateOfDay->setText(QDate::currentDate().toString("yyyy-MM-dd ddd")); + this->dateOfDay->setText(QDate::currentDate().toString("yyyy-MM-dd ddd").replace("周","星期")); this->dateOfDay->setObjectName("dateOfDay"); this->dateOfDay->setAlignment(Qt::AlignCenter); this->dateOfDay->adjustSize(); @@ -1109,9 +1103,9 @@ void Screensaver::updateTime() this->dateOfLocaltime->setText(curDateTime.toString("hh:mm")); if(dateType == "cn") - this->dateOfDay->setText(curDateTime.date().toString("yyyy/MM/dd ddd")); + this->dateOfDay->setText(curDateTime.date().toString("yyyy/MM/dd ddd").replace("周","星期")); else - this->dateOfDay->setText(curDateTime.date().toString("yyyy-MM-dd ddd")); + this->dateOfDay->setText(curDateTime.date().toString("yyyy-MM-dd ddd").replace("周","星期")); m_lastDateTime = curDateTime; } @@ -1184,7 +1178,8 @@ void Screensaver::setRandomText() } layout->addWidget(myTextLabel); } - + sysFont.setPointSize((18 + curFontSize) *m_ptToPx); + myTextLabel->setFont(sysFont); myTextLabel->setText(myText); myTextWidget->adjustSize(); if(myText != "") @@ -1279,10 +1274,14 @@ void Screensaver::setCenterWidget() authorlabel->hide(); } #endif - centerlabel1->setObjectName("centerLabel"); centerlabel2->setObjectName("centerLabel"); authorlabel->setObjectName("authorLabel"); + sysFont.setPointSize((36 + curFontSize) *m_ptToPx); + centerlabel1->setFont(sysFont); + centerlabel2->setFont(sysFont); + sysFont.setPointSize((28 + curFontSize) *m_ptToPx); + authorlabel->setFont(sysFont); qsettings->endGroup(); diff --git a/screensaver/screensaver.h b/screensaver/screensaver.h index 39bb7a1..84ee2e7 100644 --- a/screensaver/screensaver.h +++ b/screensaver/screensaver.h @@ -136,6 +136,9 @@ private: static QTime m_currentTime; int blur_Num; QString curStyle; + double curFontSize; + double m_ptToPx = 1.0; + QFont sysFont; WeatherManager *m_weatherManager=nullptr; QWidget *m_weatherLaout; @@ -181,6 +184,7 @@ private Q_SLOTS: void onDateFormatChanged(QString type); void onBlurNumChanged(int num); void onStyleChanged(QString style); + void onFontSizeChanged(int fontSize); QPixmap getPaddingPixmap(); }; diff --git a/screensaver/screensaverplugin.h b/screensaver/screensaverplugin.h index 041bf38..4fcd9ff 100644 --- a/screensaver/screensaverplugin.h +++ b/screensaver/screensaverplugin.h @@ -1,4 +1,21 @@ -#ifndef SCREENSAVER_PLUGIN_H +/* + * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 SCREENSAVER_PLUGIN_H #define SCREENSAVER_PLUGIN_H #include diff --git a/screensaver/sleeptime.cpp b/screensaver/sleeptime.cpp index 7367a35..bd06b4d 100644 --- a/screensaver/sleeptime.cpp +++ b/screensaver/sleeptime.cpp @@ -20,11 +20,13 @@ #include #include #include +#include SleepTime::SleepTime(QWidget *parent) : QWidget(parent), sleepTime(0), m_nLastSleepLeave(0), - m_nLastSleepTimeSecs(0) + m_nLastSleepTimeSecs(0), + configuration(SCConfiguration::instance()) { init(); } @@ -39,18 +41,22 @@ void SleepTime::init() layout = new QHBoxLayout(this); layout->setDirection(QBoxLayout::RightToLeft); layout->setSpacing(8); - + curFontSize = configuration->getFontSize(); + sysFont = qApp->font(); + sysFont.setPointSize((20 + curFontSize) *m_ptToPx); for(int i=0;i<3;i++) { QLabel *label = new QLabel(this); label->setText("0"); label->setFixedSize(40,40); label->setObjectName("clockTime"); + label->setFont(sysFont); list.append(label); if (i < 2) { QLabel *colon = new QLabel(this); colon->setText(":"); colon->setObjectName("colon"); + colon->setFont(sysFont); list.append(colon); } } @@ -61,6 +67,8 @@ void SleepTime::init() } restTime = new QLabel(this); + sysFont.setPointSize((20 + curFontSize) *m_ptToPx); + restTime->setFont(sysFont); restTime->setText(tr("You have rested")); restTime->setObjectName("restTime"); restTime->setAlignment(Qt::AlignBottom); diff --git a/screensaver/sleeptime.h b/screensaver/sleeptime.h index e5e4186..2174ac5 100644 --- a/screensaver/sleeptime.h +++ b/screensaver/sleeptime.h @@ -19,6 +19,7 @@ #ifndef SLEEPTIME_H #define SLEEPTIME_H +#include "scconfiguration.h" #include #include #include @@ -36,6 +37,7 @@ public: void setSmallMode(); private: + SCConfiguration *configuration; QLabel *restTime; QList list; QHBoxLayout *layout; @@ -44,6 +46,9 @@ private: long long m_nLastSleepTimeSecs; QDateTime initTime; QDateTime m_lastTime; + double curFontSize; + double m_ptToPx = 1.0; + QFont sysFont; void init(); void setHour(int hour); diff --git a/set4kScale/CMakeLists.txt b/set4kScale/CMakeLists.txt index 09b8eef..9429dfa 100644 --- a/set4kScale/CMakeLists.txt +++ b/set4kScale/CMakeLists.txt @@ -3,13 +3,18 @@ project(set4kScale) pkg_check_modules(X11 REQUIRED x11) pkg_check_modules(XCB REQUIRED xcb) pkg_check_modules(QGS REQUIRED gsettings-qt) +pkg_check_modules(KDKINFO REQUIRED kysdk-sysinfo) include_directories( ${X11_INCLUDE_DIRS} ${XCB_INCLUDE_DIRS} ${QGS_INCLUDE_DIRS} + ${KDKINFO_INCLUDE_DIRS} ) +link_directories( + ${KDKINFO_LIBRARY_DIRS}) + set(CMAKE_AUTOMOC ON) set(bin_SRCS @@ -18,7 +23,7 @@ set(bin_SRCS ) add_executable(set4kScale ${bin_SRCS}) -target_link_libraries(set4kScale Qt5::Core Qt5::Widgets Qt5::X11Extras ${X11_LIBRARIES} ${XCB_LIBRARIES} ${QGS_LIBRARIES}) +target_link_libraries(set4kScale Qt5::Core Qt5::Widgets Qt5::X11Extras ${X11_LIBRARIES} ${XCB_LIBRARIES} ${QGS_LIBRARIES} ${KDKINFO_LIBRARIES}) install(TARGETS set4kScale diff --git a/set4kScale/main.cpp b/set4kScale/main.cpp index 5ec6932..80b6c1e 100644 --- a/set4kScale/main.cpp +++ b/set4kScale/main.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 . + * +**/ #include #include #include @@ -11,6 +28,8 @@ #include #include #include +#include + extern "C" { #include #include @@ -24,6 +43,26 @@ extern "C" { #define CURSOR_THEME "cursor-theme" +/* 设置DPI环境变量 */ +void setXresources(double scale) +{ + Display *dpy; + QGSettings *mouse_settings = new QGSettings(MOUSE_SCHEMA); + QString str = QString("Xft.dpi:\t%1\nXcursor.size:\t%2\nXcursor.theme:\t%3\n") + .arg(scale * 96) + .arg(mouse_settings->get(CURSOR_SIZE).toInt() * scale) + .arg(mouse_settings->get(CURSOR_THEME).toString()); + + dpy = XOpenDisplay(NULL); + XChangeProperty(dpy, RootWindow(dpy, 0), XA_RESOURCE_MANAGER, XA_STRING, 8, + PropModeReplace, (unsigned char *) str.toLatin1().data(), str.length()); + XCloseDisplay(dpy); + + qDebug() << "setXresources:" << str; + + delete mouse_settings; +} + /* 过滤低分辨率高缩放比情况 */ void screenScaleJudgement(QGSettings *settings) { @@ -40,40 +79,24 @@ void screenScaleJudgement(QGSettings *settings) if (width < 1920 && height < 1080) { state = true; - } else if (width == 1920 && height == 1080 && scale > 1.5) { + } + else if (width == 1920 && height == 1080 && scale > 1.5) { state = true; - } else if (width > 2560 && height > 1440) { + } + /* + else if (width > 2560 && height > 1440) { mScale = true; } + */ } - if (state && !mScale) { - QGSettings *mGsettings = new QGSettings(MOUSE_SCHEMA); - mGsettings->set(CURSOR_SIZE, 24); +// if (state && !mScale) { + if (state) { settings->set(SCALING_KEY, 1.0); - delete mGsettings; + scale = 1.0; } } -} - -/* 设置DPI环境变量 */ -void setXresources(int dpi) -{ - Display *dpy; - QGSettings *mouse_settings = new QGSettings(MOUSE_SCHEMA); - QString str = QString("Xft.dpi:\t%1\nXcursor.size:\t%2\nXcursor.theme:\t%3\n") - .arg(dpi) - .arg(mouse_settings->get(CURSOR_SIZE).toInt()) - .arg(mouse_settings->get(CURSOR_THEME).toString()); - - dpy = XOpenDisplay(NULL); - XChangeProperty(dpy, RootWindow(dpy, 0), XA_RESOURCE_MANAGER, XA_STRING, 8, - PropModeReplace, (unsigned char *) str.toLatin1().data(), str.length()); - XCloseDisplay(dpy); - - qDebug() << "setXresources:" << str; - - delete mouse_settings; + setXresources(scale); } /* 判断文件是否存在 */ @@ -102,21 +125,16 @@ void writeXresourcesFile(QString XresourcesFile, QGSettings *settings, double sc file.close(); QGSettings *Font = new QGSettings("org.ukui.font-rendering"); - QGSettings *mouse_settings = new QGSettings(MOUSE_SCHEMA); Font->set("dpi", 96.0); settings->set(SCALING_KEY, scaling); - mouse_settings->set(CURSOR_SIZE, scaling * 24.0); qDebug() << " writeXresourcesFile: content = " << content - << " scalings = " << settings->get(SCALING_KEY).toDouble() - << "cursor size = " << mouse_settings->get(CURSOR_SIZE).toInt(); + << " scalings = " << settings->get(SCALING_KEY).toDouble(); delete Font; - delete mouse_settings; } /* 判断是否为首次登陆 */ - bool isTheFirstLogin(QGSettings *settings) { QString homePath = getenv("HOME"); @@ -156,22 +174,23 @@ bool isTheFirstLogin(QGSettings *settings) if (zoom1) { mScaling = 1.0; } else if (!zoom1 && zoom2) { - mScaling = 1.5; + mScaling = 1.5; //考虑新版缩放,设置默认150%暂时停止设置; } else if (!zoom1 && !zoom2 && zoom3) { mScaling = 2.0; } writeXresourcesFile(XresourcesFile, settings, mScaling); + setXresources(mScaling); + return true; } - /* 配置新装系统、新建用户第一次登陆时,4K缩放功能*/ -void setHightResolutionScreenZoom() +void setHightResolutionScreenZoom(bool platForm) { QGSettings *settings; - double dpi; + double scale; int ScreenNum = QApplication::screens().length(); if (!QGSettings::isSchemaInstalled(XSETTINGS_SCHEMA) || !QGSettings::isSchemaInstalled("org.ukui.font-rendering") || !QGSettings::isSchemaInstalled(MOUSE_SCHEMA)) { @@ -181,28 +200,41 @@ void setHightResolutionScreenZoom() } settings = new QGSettings(XSETTINGS_SCHEMA); + scale = settings->get(SCALING_KEY).toDouble(); + + if (platForm) { + setXresources(scale); + goto end; + } + if (isTheFirstLogin(settings)) { qDebug() << "Set the default zoom value when logging in for the first time."; goto end; } /* 过滤单双屏下小分辨率大缩放值 */ + if (ScreenNum > 1) { + setXresources(scale); goto end; } screenScaleJudgement(settings); end: - dpi = 0.0; - dpi = settings->get(SCALING_KEY).toDouble() * 96.0; - setXresources(dpi); delete settings; } int main(int argc, char *argv[]) { QApplication a(argc, argv); - setHightResolutionScreenZoom(); + QString platForm = kdk_system_get_hostCloudPlatform(); + if (platForm == "none") { + qDebug() << "platForm=" << platForm << ", 系统环境为实体机"; + setHightResolutionScreenZoom(false); + } else { + qDebug() << "platForm=" << platForm << ", 系统环境为云环境"; + setHightResolutionScreenZoom(true); + } return 0; } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 60c0226..d22a516 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,6 +7,8 @@ pkg_check_modules(QGS REQUIRED gsettings-qt) pkg_check_modules(GLIB REQUIRED glib-2.0) pkg_check_modules(MMIX REQUIRED libmatemixer) pkg_check_modules(kylin-nm-base REQUIRED kylin-nm-base) +pkg_check_modules(KDKINFO REQUIRED kysdk-sysinfo) +pkg_check_modules(IMLIB2 REQUIRED imlib2) find_library(PAM_LIBRARIES pam) @@ -28,6 +30,14 @@ include_directories( ${GLIB_INCLUDE_DIRS} ${MMIX_INCLUDE_DIRS} ${kylin-nm-base_INCLUDE_DIRS} + ${KF5Wayland_LIBRARIES} + ${KDKINFO_INCLUDE_DIRS} + ${IMLIB2_INCLUDE_DIRS} + ${OpenCV_INCLUDE_DIRS} + ) + +link_directories( + ${KDKINFO_LIBRARY_DIRS} ) set(EXTRA_LIBS @@ -39,9 +49,15 @@ set(EXTRA_LIBS ${QGS_LIBRARIES} ${GLIB_LIBRARIES} ${MMIX_LIBRARIES} + ${KF5Wayland_LIBRARIES} + ${KDKINFO_LIBRARIES} + ${IMLIB2_LIBRARIES} -lrt -lpthread + -lKF5WaylandServer + -lKF5WaylandClient -llibnm-icon-kylin + -lukuiinputgatherclient ) qt5_wrap_ui(dialog_SRC @@ -65,7 +81,6 @@ qt5_wrap_cpp(dialog_SRC screensaverwidget.h auth.h auth-pam.h - authpamthread.h screensavermode.h screensaverwndadaptor.h xeventmonitor.h @@ -97,6 +112,8 @@ qt5_wrap_cpp(dialog_SRC lockchecker.h servicemanager.h mytabwidget.h + modebutton.h + klabel.h PhysicalDeviceSet/brightnessdeviceset.h PhysicalDeviceSet/flightmodeset.h PhysicalDeviceSet/sounddeviceset.h @@ -104,6 +121,8 @@ qt5_wrap_cpp(dialog_SRC device.h enginedevice.h batterywidget.h + libinputswitchevent.h + machinemodel.h ) set(dialog_SRC @@ -116,7 +135,6 @@ set(dialog_SRC loginoptionswidget.cpp screensaverwidget.cpp auth-pam.cpp - authpamthread.cpp xeventmonitor.cpp monitorwatcher.cpp grab-x11.cpp @@ -148,6 +166,9 @@ set(dialog_SRC lockchecker.cpp servicemanager.cpp mytabwidget.cpp + modebutton.cpp + klabel.cpp + rootWindowBackground.cpp PhysicalDeviceSet/brightnessdeviceset.cpp PhysicalDeviceSet/flightmodeset.cpp PhysicalDeviceSet/sounddeviceset.cpp @@ -155,6 +176,8 @@ set(dialog_SRC device.cpp enginedevice.cpp batterywidget.cpp + libinputswitchevent.cpp + machinemodel.cpp ) add_executable(ukui-screensaver-dialog ${dialog_SRC}) add_definitions(-DAPP_API_MAJOR=0 -DAPP_API_MINOR=11 -DAPP_API_FUNC=0) @@ -173,6 +196,9 @@ target_link_libraries(ukui-screensaver-dialog Kylin-nm ukui-log4qt Screensaver + opencv_imgcodecs + opencv_imgproc + opencv_core ) link_libraries(libmatemixer.so glib-2.0.so) @@ -195,7 +221,7 @@ set(backend_SRC logind.cpp ) add_executable(ukui-screensaver-backend ${backend_SRC}) -target_link_libraries(ukui-screensaver-backend Qt5::Core Qt5::DBus ${QGS_LIBRARIES} ukui-log4qt) +target_link_libraries(ukui-screensaver-backend Qt5::Core Qt5::DBus ${QGS_LIBRARIES} ukui-log4qt Common) set(command_SRC ukui-screensaver-command.cpp @@ -209,6 +235,14 @@ set(checkpass_SRC add_executable(ukui-screensaver-checkpass ${checkpass_SRC}) target_link_libraries(ukui-screensaver-checkpass ${PAM_LIBRARIES}) +set(ukss_SRCS + ukss_interface.cpp + ) + +add_definitions(-DUKSSSO_LIBRARY) +add_library(ukss SHARED ${ukss_SRCS}) +target_link_libraries(ukss Qt5::Core Qt5::DBus ${QGS_LIBRARIES}) + install(TARGETS ukui-screensaver-dialog ukui-screensaver-backend @@ -216,6 +250,8 @@ install(TARGETS ukui-screensaver-checkpass DESTINATION bin) +install(TARGETS ukss DESTINATION ${QT_INSTALL_LIBS}) + #set(test-act_SRC # users.cpp # test-accounts.cpp diff --git a/src/PhysicalDeviceSet/brightnessdeviceset.cpp b/src/PhysicalDeviceSet/brightnessdeviceset.cpp index 455c5d0..5e25b9f 100644 --- a/src/PhysicalDeviceSet/brightnessdeviceset.cpp +++ b/src/PhysicalDeviceSet/brightnessdeviceset.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 . + * +**/ #include "brightnessdeviceset.h" int BrightnessDeviceSet::m_value = -1; diff --git a/src/PhysicalDeviceSet/brightnessdeviceset.h b/src/PhysicalDeviceSet/brightnessdeviceset.h index 77cd162..c361c9d 100644 --- a/src/PhysicalDeviceSet/brightnessdeviceset.h +++ b/src/PhysicalDeviceSet/brightnessdeviceset.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 BRIGHTNESSDEVICESET_H #define BRIGHTNESSDEVICESET_H diff --git a/src/PhysicalDeviceSet/flightmodeset.cpp b/src/PhysicalDeviceSet/flightmodeset.cpp index adcbf67..33e4616 100644 --- a/src/PhysicalDeviceSet/flightmodeset.cpp +++ b/src/PhysicalDeviceSet/flightmodeset.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 . + * +**/ #include "flightmodeset.h" bool FlightModeSet::m_isFlightModeOpen = false; diff --git a/src/PhysicalDeviceSet/flightmodeset.h b/src/PhysicalDeviceSet/flightmodeset.h index 57842a4..3efcd0a 100644 --- a/src/PhysicalDeviceSet/flightmodeset.h +++ b/src/PhysicalDeviceSet/flightmodeset.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 FLIGHTMODESET_H #define FLIGHTMODESET_H /*! diff --git a/src/PhysicalDeviceSet/sounddeviceset.cpp b/src/PhysicalDeviceSet/sounddeviceset.cpp index f16ba8c..876708f 100644 --- a/src/PhysicalDeviceSet/sounddeviceset.cpp +++ b/src/PhysicalDeviceSet/sounddeviceset.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 . + * +**/ #include "sounddeviceset.h" int SoundDeviceSet::m_value = -1; diff --git a/src/PhysicalDeviceSet/sounddeviceset.h b/src/PhysicalDeviceSet/sounddeviceset.h index 2b98aaa..12701bd 100644 --- a/src/PhysicalDeviceSet/sounddeviceset.h +++ b/src/PhysicalDeviceSet/sounddeviceset.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 SOUNDDEVICESET_H #define SOUNDDEVICESET_H diff --git a/src/PhysicalDeviceSet/touchscreenset.cpp b/src/PhysicalDeviceSet/touchscreenset.cpp index 0ba4449..9884078 100644 --- a/src/PhysicalDeviceSet/touchscreenset.cpp +++ b/src/PhysicalDeviceSet/touchscreenset.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 . + * +**/ #include "touchscreenset.h" #include diff --git a/src/PhysicalDeviceSet/touchscreenset.h b/src/PhysicalDeviceSet/touchscreenset.h index fd6c5ef..096ce9e 100644 --- a/src/PhysicalDeviceSet/touchscreenset.h +++ b/src/PhysicalDeviceSet/touchscreenset.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 TOUCHSCREENSET_H #define TOUCHSCREENSET_H diff --git a/src/accountsinterface.cpp b/src/accountsinterface.cpp index 4b6abb5..7bc8cbb 100644 --- a/src/accountsinterface.cpp +++ b/src/accountsinterface.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2019 Tianjin KYLIN Information Technology 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, 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 . + * +**/ #include "accountsinterface.h" const QString STR_EDU_SERVICE = "cn.kylinos.SSOBackend"; diff --git a/src/accountsinterface.h b/src/accountsinterface.h index cc97edd..2e1a0d5 100644 --- a/src/accountsinterface.h +++ b/src/accountsinterface.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 ACCOUNTSINTERFACE_H #define ACCOUNTSINTERFACE_H diff --git a/src/assets.qrc b/src/assets.qrc index 6059541..cb0a657 100644 --- a/src/assets.qrc +++ b/src/assets.qrc @@ -5,9 +5,7 @@ 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 @@ -119,11 +112,20 @@ assets/ukui-loginopt-finger.svg assets/ukui-loginopt-face.svg assets/ukui-loginopt-password.svg + assets/ukui-loginopt-ukey.svg assets/selected.svg assets/keyboard.svg assets/ukui-loginopt-smile.svg 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 + + + assets/data/conf.ini diff --git a/src/assets/authdialog.qss b/src/assets/authdialog.qss index dd3a1a0..a45e1c3 100644 --- a/src/assets/authdialog.qss +++ b/src/assets/authdialog.qss @@ -34,14 +34,12 @@ QToolButton::checked { QLabel { color: white; - font-size: 16px; } QToolTip{ border-radius:4px; background-color:#FFFFFF; color:black; - font-size:16px } #userWidget{ @@ -57,7 +55,6 @@ QToolTip{ /* 用户名 */ #login_nameLabel{ - font-size: 24px; } /* 密码输入框 */ @@ -66,7 +63,6 @@ QLineEdit { border: 2px solid #FFFFFF; border-radius: 6px; color:black; - font-size: 14px; lineedit-password-character:9679; } @@ -101,11 +97,6 @@ QLineEdit::focus{ /* 登录按钮 */ #loginButton{ - min-width: 24px; - max-width: 24px; - min-height: 24px; - max-height: 24px; - icon-size: 24px; background:#3D6BE5; border-radius:12px; } @@ -117,13 +108,11 @@ QLineEdit::focus{ /* PAM message提示*/ #messageLabel { - font-size: 16px; color: white; } #messageButton{ text-align:center; - font-size: 16px; color: white; } @@ -134,7 +123,6 @@ QMenu{ color: white; border-radius: 4px; width:250px; - font-size: 16px; padding: 5px 5px 5px 5px; } @@ -146,7 +134,6 @@ QMenu::item width:225px; border-radius: 4px; height:36px; - font-size:16px; padding: 2px 10px 2px 10px; } diff --git a/src/assets/data/conf.ini b/src/assets/data/conf.ini new file mode 100644 index 0000000..41ae2bd --- /dev/null +++ b/src/assets/data/conf.ini @@ -0,0 +1,15 @@ +[MachineType] +PANDING LTDtablet = SLATE +#Phytium12345 = SLATE + + +#key 值机器的sys_vendor + product_family +#cat /sys/class/dmi/id/product_family +#cat /sys/class/dmi/id/product_name +#cat /sys/class/dmi/id/sys_vendor + +#value 有以下四类 +#[SLATE]平板 +#[LAPTOP]计算机(有永久附加键盘) +#[CONVERTIBLE]平板/计算机(键盘可以分离、翻转或旋转) +#[ALLINONE]台式机 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/assets/ukui-loginopt-ukey.svg b/src/assets/ukui-loginopt-ukey.svg new file mode 100644 index 0000000..0239a86 --- /dev/null +++ b/src/assets/ukui-loginopt-ukey.svg @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/auth-pam.cpp b/src/auth-pam.cpp index c83a2a0..aa01e1c 100644 --- a/src/auth-pam.cpp +++ b/src/auth-pam.cpp @@ -36,6 +36,7 @@ static int pam_conversation(int msgLength, const struct pam_message **msg, void sigchld_handler(int signo); AuthPAM::AuthPAM(QObject *parent) : Auth(parent), + pid(0), nPrompts(0), _isAuthenticated(false), _isAuthenticating(false) @@ -49,33 +50,54 @@ void AuthPAM::authenticate(const QString &userName) if(pipe(toParent) || pipe(toChild)) qDebug()<< "create pipe failed: " << strerror(errno); - m_authPamThread = new AuthPamThread(); - m_authPamThread->startAuthPam(toChild[0], toParent[1], userName); - _isAuthenticating = true; - notifier = new QSocketNotifier(toParent[0], QSocketNotifier::Read); - connect(notifier, &QSocketNotifier::activated, this, &AuthPAM::onSockRead); + if((pid = fork()) < 0) + { + qDebug() << "fork error: " << strerror(errno); + } + else if(pid == 0) + { + prctl(PR_SET_PDEATHSIG, SIGHUP); + close(toParent[0]); + close(toChild[1]); + int arg1_int = toParent[1]; + int arg2_int = toChild[0]; + char arg1[128]; + char arg2[128]; + sprintf(arg1,"%d",arg1_int); + sprintf(arg2,"%d",arg2_int); + execlp ("ukui-screensaver-checkpass", + "ukui-screensaver-checkpass", + arg1, arg2,userName.toLocal8Bit().data(), NULL); + _exit (EXIT_FAILURE); + } + else + { + close(toParent[1]); + close(toChild[0]); + _isAuthenticating = true; + notifier = new QSocketNotifier(toParent[0], QSocketNotifier::Read); + connect(notifier, &QSocketNotifier::activated, this, &AuthPAM::onSockRead); + } } void AuthPAM::stopAuth() { - if (m_authPamThread) { + if(pid != 0) + { messageList.clear(); responseList.clear(); _isAuthenticating = false; _isAuthenticated = false; nPrompts = 0; + ::kill(pid, SIGKILL); + + close(toParent[0]); + close(toChild[1]); if(notifier){ - disconnect(notifier, &QSocketNotifier::activated, this, &AuthPAM::onSockRead); - delete notifier; + notifier->deleteLater(); notifier = nullptr; } - close(toParent[1]); - close(toChild[1]); - m_authPamThread->stopAuthPam(); - delete m_authPamThread; - m_authPamThread = nullptr; - close(toParent[0]); - close(toChild[0]); + pid = 0; } } diff --git a/src/auth-pam.h b/src/auth-pam.h index 2499442..3fba36c 100644 --- a/src/auth-pam.h +++ b/src/auth-pam.h @@ -22,7 +22,6 @@ #include #include -#include "authpamthread.h" typedef struct pam_message PAM_MESSAGE; typedef struct pam_response PAM_RESPONSE; @@ -48,7 +47,7 @@ private Q_SLOTS: private: QString userName; - AuthPamThread *m_authPamThread = nullptr; + pid_t pid; QSocketNotifier *notifier; int nPrompts; QStringList responseList; diff --git a/src/authdialog.cpp b/src/authdialog.cpp index 309e0cd..e179b46 100644 --- a/src/authdialog.cpp +++ b/src/authdialog.cpp @@ -30,19 +30,21 @@ #include "users.h" #include "iconedit.h" +#include "configuration.h" #include "biometricproxy.h" -#include "biometricauthwidget.h" -#include "biometricdeviceswidget.h" #include "pam-tally.h" #include "commonfunc.h" #include "loginoptionswidget.h" #include "servicemanager.h" +#include "uniauthservice.h" #include "imageutil.h" +#include "klabel.h" AuthDialog::AuthDialog(const UserItem &user, QWidget *parent) : QWidget(parent), user(user), auth(new AuthPAM(this)), + configuration(Configuration::instance()), authMode(UNKNOWN), m_biometricProxy(nullptr), m_widgetLoginOpts(nullptr), @@ -62,6 +64,8 @@ AuthDialog::AuthDialog(const UserItem &user, QWidget *parent) : if(qssFile.open(QIODevice::ReadOnly)) { this->setStyleSheet(qssFile.readAll()); } + curFontSize = configuration->getFontSize(); + m_ptToPx = configuration->getPtToPx(); initUI(); pam_tally_init(); //这里写函数声明 @@ -119,7 +123,7 @@ void AuthDialog::initUI() m_userWidget->setObjectName(QStringLiteral("userWidget")); /* 头像 */ - const QString SheetStyle = QString("border-radius: %1px; border:0px solid white;").arg(77*scale); + const QString SheetStyle = QString("border-radius: %1px; border:0px solid white;").arg((int)(77*scale)); m_labelHeadImg = new QLabel(m_userWidget); m_labelHeadImg->setObjectName(QStringLiteral("faceLabel")); m_labelHeadImg->setFocusPolicy(Qt::NoFocus); @@ -127,10 +131,7 @@ void AuthDialog::initUI() m_labelHeadImg->setAlignment(Qt::AlignCenter); m_labelHeadImg->hide(); - QPixmap facePixmap(user.icon); - facePixmap = scaledPixmap(facePixmap); - facePixmap = facePixmap.scaled(154*scale,154*scale, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); - facePixmap = PixmapToRound(facePixmap, 77*scale); + QPixmap facePixmap = makeRoundLogo(user.icon, 154*scale, 154*scale, 77*scale); m_labelHeadImg->setAlignment(Qt::AlignCenter); m_labelHeadImg->setPixmap(facePixmap); @@ -141,13 +142,10 @@ void AuthDialog::initUI() m_labelFace->hide(); // 二维码窗口 - m_labelLoginTypeTip = new QLabel(m_userWidget); - //m_labelLoginTypeTip->setStyleSheet("QToolTip{border-radius:4px;background-color:#FFFFFF;color:black;font-size:16px}"); + m_labelLoginTypeTip = new KLabel(m_userWidget); + m_labelLoginTypeTip->setFontSize(14); m_labelLoginTypeTip->setObjectName("loginTypeTipLabel"); m_labelLoginTypeTip->setAlignment(Qt::AlignCenter); - QFont font = m_labelLoginTypeTip->font(); - font.setPixelSize(14); - m_labelLoginTypeTip->setFont(font); m_labelQRCode = new QLabel(m_userWidget); m_labelQRCode->setObjectName("qrCodeLabel"); m_labelQRCode->setAlignment(Qt::AlignCenter); @@ -159,31 +157,21 @@ void AuthDialog::initUI() m_labelQRCodeTip = new QLabel(); m_labelQRCodeTip->setFixedSize(22,22); layoutQRCode->addWidget(m_labelQRCodeTip, 0, Qt::AlignHCenter); - m_labelQRCodeMsg = new QLabel(); - m_labelQRCodeMsg->setFixedHeight(24); - font = m_labelQRCodeMsg->font(); - font.setPixelSize(16); + m_labelQRCodeMsg = new KLabel(); + m_labelQRCodeMsg->setFixedHeight(30); + m_labelQRCodeMsg->setFontSize(14); m_labelQRCodeMsg->setStyleSheet("QLabel{background-color:rgba(255,255,255,0);color:rgb(255,0,0)}"); - m_labelQRCodeMsg->setFont(font); layoutQRCode->addWidget(m_labelQRCodeMsg, 0, Qt::AlignHCenter); /* 用户名 */ - m_nameLabel = new QLabel(m_userWidget); + m_nameLabel = new KLabel(m_userWidget); m_nameLabel->setObjectName(QStringLiteral("login_nameLabel")); m_nameLabel->setFocusPolicy(Qt::NoFocus); m_nameLabel->setAlignment(Qt::AlignCenter); - m_nameLabel->setStyleSheet("QToolTip{border-radius:4px;background-color:#FFFFFF;color:black;font-size:16px}"); + m_nameLabel->setFontSize(24); //m_nameLabel->setText(user.realName.isEmpty() ? user.name : user.realName); QString text = user.realName.isEmpty() ? user.name : user.realName; - font = m_nameLabel->font(); - font.setPixelSize(24); - QString str = ElideText(font,500,text); - if(text != str) - m_nameLabel->setToolTip(text); - if(text == str) - m_nameLabel->setToolTip(""); - m_nameLabel->setText(str); - + m_nameLabel->setElideText(text, 380); /* 密码框所在窗口 */ m_passwdWidget = new QWidget(this); @@ -199,7 +187,7 @@ void AuthDialog::initUI() QPixmap iconLogin = QIcon::fromTheme("system-lock-screen-symbolic").pixmap(16,16); iconLogin = ImageUtil::drawSymbolicColoredPixmap(iconLogin, "white"); m_passwordEdit->setIcon(iconLogin); - m_passwordEdit->setFocusPolicy(Qt::StrongFocus); + //m_passwordEdit->setFocusPolicy(Qt::StrongFocus); m_passwordEdit->installEventFilter(this); m_passwordEdit->readOnly(true); /*免密登录时,会出现闪一下密码框的问题,因此初始化时隐藏,收到pam发来的prompt类型的消息后再显示*/ @@ -212,19 +200,106 @@ void AuthDialog::initUI() //m_passwdWidget->hide(); /* 密码认证信息显示列表 */ - m_messageLabel = new QLabel(m_passwdWidget); + m_messageLabel = new KLabel(m_passwdWidget); m_messageLabel->setObjectName(QStringLiteral("messageLabel")); m_messageLabel->setAlignment(Qt::AlignLeft); - font = m_messageLabel->font(); - font.setPixelSize(14); - m_messageLabel->setFont(font); - m_messageLabel->setStyleSheet("QToolTip{border-radius:4px;background-color:#FFFFFF;color:black;font-size:16px}"); + m_messageLabel->setFontSize(14); + + /* ukey密码框所在窗口 */ + m_ukeyPasswdWidget = new QWidget(this); + m_ukeyPasswdWidget->setObjectName(QStringLiteral("passwordWidget")); + + /* 密码框 */ + m_ukeyPasswordEdit = new IconEdit(m_ukeyPasswdWidget); + connect(m_ukeyPasswordEdit,&IconEdit::clickedPassword, + this,&AuthDialog::onM_passwordEditClicked); + + m_ukeyPasswdWidget->setInputMethodHints(Qt::ImhNone); + m_ukeyPasswordEdit->setObjectName(QStringLiteral("passwordEdit")); + m_ukeyPasswordEdit->setIcon(QIcon::fromTheme("system-lock-screen-symbolic")); + //m_ukeyPasswordEdit->setFocusPolicy(Qt::StrongFocus); + m_ukeyPasswordEdit->installEventFilter(this); + m_ukeyPasswordEdit->setType(QLineEdit::Password); + m_ukeyPasswordEdit->setPrompt(tr("Enter the ukey password")); + m_ukeyPasswordEdit->setModeBtnVisible(false); + connect(m_ukeyPasswordEdit, SIGNAL(clicked(const QString&)), + this, SLOT(onRespondUkey(const QString&))); + + /* 密码认证信息显示列表 */ + m_ukeyMessageLabel = new KLabel(m_ukeyPasswdWidget); + m_ukeyMessageLabel->setObjectName(QStringLiteral("messageLabel")); + m_ukeyMessageLabel->setAlignment(Qt::AlignLeft); + m_ukeyMessageLabel->setFontSize(14); + m_ukeyMessageLabel->setStyleSheet("QToolTip{border-radius:4px;background-color:#FFFFFF;color:black;font-size:16px}"); + + m_ukeyPasswdWidget->hide(); + + m_loadingWidget = new QWidget(m_ukeyPasswdWidget); + m_loadingText = new KLabel(m_loadingWidget); + m_loadingText->setFontSize(18); + m_loadingText->setText(tr("Insert the ukey into the USB port")); + m_loadingButton = new QPushButton(m_loadingWidget); + m_loadingButton->setAttribute(Qt::WA_TransparentForMouseEvents, true); + m_loadingButton->setFlat(true); + m_loadingButton->installEventFilter(this); + m_loadingButton->setStyleSheet("QPushButton{text-align:center;color: rgb(255, 255, 255, 255);border: none;border-radius: 4px;outline: none;}"); + + m_loadingWidget->adjustSize(); + + QVBoxLayout *loadingLayout= new QVBoxLayout(m_loadingWidget); + loadingLayout->addWidget(m_loadingButton); + loadingLayout->addWidget(m_loadingText); + startLoadingUkey(); m_messageButton = new QPushButton(m_passwdWidget); m_messageButton->setObjectName(QStringLiteral("messageButton")); + QFont font; + font = m_messageButton->font(); + font.setPointSize((14 + curFontSize) *m_ptToPx); + m_messageButton->setFont(font); m_messageButton->hide(); } + +void AuthDialog::startLoadingUkey() +{ + //isLoadingUkey = true; + m_loadingWidget->show(); + m_ukeyPasswordEdit->hide(); + m_ukeyMessageLabel->hide(); + if(!m_loadingTimer) + { + m_loadingTimer = new QTimer(this); + m_loadingTimer->setInterval(150); + connect(m_loadingTimer, &QTimer::timeout, this, &AuthDialog::updateLoadingPixmap); + } + + QPixmap icon = QIcon::fromTheme("ukui-loading-0-symbolic").pixmap(27,27); + m_loadingPixmap = ImageUtil::drawSymbolicColoredPixmap(icon, "white"); + m_loadingButton->setIcon(m_loadingPixmap); + m_loadingButton->setIconSize(QSize(27, 27)); + m_loadingTimer->start(); +} + +void AuthDialog::stopLoadingUkey() +{ + isLoadingUkey = false; + m_loadingWidget->hide(); + m_ukeyPasswordEdit->show(); + m_ukeyMessageLabel->show(); + if(m_loadingTimer){ + m_loadingTimer->stop(); + } +} + +void AuthDialog::updateLoadingPixmap() +{ + QMatrix matrix; + matrix.rotate(90.0); + m_loadingPixmap = m_loadingPixmap.transformed(matrix, Qt::FastTransformation); + m_loadingButton->setIcon(QIcon(m_loadingPixmap)); +} + void AuthDialog::unlock_countdown() { int failed_count = 0; @@ -280,7 +355,9 @@ void AuthDialog::unlock_countdown() { if(m_passwordEdit){ m_passwordEdit->readOnly(false); - m_passwordEdit->setFocus(); + if (m_passwordEdit->isVisible()) { + m_passwordEdit->setFocus(); + } } if (isLockingFlg) { @@ -345,7 +422,9 @@ void AuthDialog::root_unlock_countdown() { if(m_passwordEdit){ m_passwordEdit->readOnly(false); - m_passwordEdit->setFocus(); + if (m_passwordEdit->isVisible()) { + m_passwordEdit->setFocus(); + } } if (isLockingFlg) { @@ -370,27 +449,25 @@ void AuthDialog::setChildrenGeometry() // 用户信息显示位置 m_userWidget->setGeometry(0, 0, width(), 376*scale); - m_labelLoginTypeTip->setGeometry(0,0,m_userWidget->width(), 24); + m_labelLoginTypeTip->setGeometry(0,0,m_userWidget->width(), 30); m_labelLoginTypeTip->setAlignment(Qt::AlignCenter); - m_labelHeadImg->setStyleSheet(QString("border-radius: %1px; border:0px solid white;").arg(77*scale)); + m_labelHeadImg->setStyleSheet(QString("border-radius: %1px; border:0px solid white;").arg((int)(77*scale))); m_labelHeadImg->setGeometry((width() - 154*scale) / 2 , m_labelLoginTypeTip->geometry().bottom()+24*scale, 154*scale, 154*scale); - QPixmap facePixmap(user.icon); - facePixmap = scaledPixmap(facePixmap); - facePixmap = facePixmap.scaled(154*scale,154*scale, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); - facePixmap = PixmapToRound(facePixmap, 77*scale); + + QPixmap facePixmap = makeRoundLogo(user.icon, 154*scale, 154*scale, 77*scale); m_labelHeadImg->setPixmap(facePixmap); - m_labelQRCode->setStyleSheet(QString("border-radius: %1px; border:0px solid white;background-color: rgba(255,255,255,100%);").arg(6*scale)); + m_labelQRCode->setStyleSheet(QString("border-radius: %1px; border:0px solid white;background-color: rgba(255,255,255,100%);").arg((int)(6*scale))); m_labelQRCode->setGeometry((width() - 154*scale) / 2 , m_labelLoginTypeTip->geometry().bottom()+24*scale, 154*scale, 154*scale); setQRCode(m_imgQRCode); - m_labelFace->setStyleSheet(QString("border-radius: %1px; border:0px solid white;background-color: rgba(255,255,255,10%);").arg(77*scale)); + m_labelFace->setStyleSheet(QString("border-radius: %1px; border:0px solid white;background-color: rgba(255,255,255,10%);").arg((int)(77*scale))); m_labelFace->setGeometry((width() - 154*scale) / 2 , m_labelLoginTypeTip->geometry().bottom()+24*scale, 154*scale, 154*scale); QImage faceImg; setFaceImg(faceImg); m_nameLabel->setGeometry(0, m_labelHeadImg->geometry().bottom() + 16*scale, - width(), 34); + width(), 40); m_passwdWidget->setGeometry(0, m_nameLabel->geometry().bottom() + 24*scale, width(), 100); m_passwordEdit->setGeometry((m_passwdWidget->width() - 240)/2, 0, 240, 40); @@ -398,10 +475,20 @@ void AuthDialog::setChildrenGeometry() m_passwordEdit->geometry().bottom() + 4, width()-(m_passwdWidget->width() - 240)/2, 36); m_messageLabel->setMinimumHeight(36); + + m_ukeyPasswdWidget->setGeometry(0, m_nameLabel->geometry().bottom() + 24*scale, width(), 100); + m_ukeyPasswordEdit->setGeometry((m_ukeyPasswdWidget->width() - 240)/2, 0, 240, 40); + m_ukeyMessageLabel->setGeometry((m_ukeyPasswdWidget->width() - 240)/2, + m_ukeyPasswordEdit->geometry().bottom() + 4, + width()-(m_ukeyPasswdWidget->width() - 240)/2, 36); + m_loadingWidget->adjustSize(); + m_loadingWidget->setGeometry((m_ukeyPasswdWidget->width() - m_loadingWidget->width())/2, 0, m_loadingWidget->width(), m_loadingWidget->height()); + 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(); @@ -409,12 +496,15 @@ void AuthDialog::setChildrenGeometry() void AuthDialog::switchLoginOptType(unsigned uLoginOptType) { + qDebug()<<"switchLoginOptType"<show(); m_labelQRCode->hide(); m_labelFace->hide(); + m_passwdWidget->show(); + m_ukeyPasswdWidget->hide(); } break; case LOGINOPT_TYPE_FACE: @@ -422,6 +512,8 @@ void AuthDialog::switchLoginOptType(unsigned uLoginOptType) m_labelHeadImg->hide(); m_labelQRCode->hide(); m_labelFace->show(); + m_passwdWidget->show(); + m_ukeyPasswdWidget->hide(); } break; case LOGINOPT_TYPE_FINGERPRINT: @@ -432,6 +524,8 @@ void AuthDialog::switchLoginOptType(unsigned uLoginOptType) m_labelHeadImg->show(); m_labelQRCode->hide(); m_labelFace->hide(); + m_passwdWidget->show(); + m_ukeyPasswdWidget->hide(); } break; case LOGINOPT_TYPE_QRCODE: @@ -440,6 +534,20 @@ void AuthDialog::switchLoginOptType(unsigned uLoginOptType) setQRCodeMsg(""); m_labelQRCode->show(); m_labelFace->hide(); + m_passwdWidget->show(); + m_ukeyPasswdWidget->hide(); + } + break; + case LOGINOPT_TYPE_GENERAL_UKEY: + { + m_labelHeadImg->show(); + m_labelQRCode->hide(); + m_labelFace->hide(); + m_passwdWidget->hide(); + m_ukeyPasswdWidget->show(); +// setFocusProxy(m_ukeyPasswordEdit); +// m_ukeyPasswordEdit->setFocusPolicy(Qt::StrongFocus); +// m_ukeyPasswordEdit->setFocus(); } break; default: @@ -483,6 +591,11 @@ void AuthDialog::switchLoginOptType(unsigned uLoginOptType) setLoginTypeTip(tr("Use the bound wechat scanning code or enter the password to unlock")); } break; + case LOGINOPT_TYPE_GENERAL_UKEY: + { + setLoginTypeTip(""); + } + break; default: return; } @@ -558,7 +671,13 @@ void AuthDialog::pamBioSuccess() switchLoginOptType(LOGINOPT_TYPE_PASSWORD); return ; } - m_widgetLoginOpts->startAuth(m_deviceInfo, user.uid); + + if(m_deviceInfo && m_deviceInfo->deviceType == LOGINOPT_TYPE_GENERAL_UKEY){ + //ukey时不调用ukey认证 + }else{ + m_widgetLoginOpts->startAuth(m_deviceInfo, user.uid); + } + if (m_deviceInfo) { switchLoginOptType(m_widgetLoginOpts->convertDeviceType(m_deviceInfo->deviceType)); } else { @@ -570,6 +689,13 @@ void AuthDialog::startBioAuth(unsigned uTimeout) { if (m_widgetLoginOpts) m_widgetLoginOpts->stopAuth(); + + if(m_deviceInfo && m_deviceInfo->deviceType == LOGINOPT_TYPE_GENERAL_UKEY){ + //ukey时不调用ukey认证 + switchLoginOptType(m_widgetLoginOpts->convertDeviceType(m_deviceInfo->deviceType)); + return; + } + if(!m_bioTimer){ m_bioTimer = new QTimer(this); connect(m_bioTimer, SIGNAL(timeout()), this, SLOT(pamBioSuccess())); @@ -587,33 +713,107 @@ void AuthDialog::setX11Focus() void AuthDialog::setFocusin(int target) { - if(m_passwordEdit && m_widgetLoginOpts) { + if(m_passwordEdit && m_passwordEdit->isVisible()) { + if (m_ukeyPasswordEdit) { + m_ukeyPasswordEdit->setFocusin(2); + } 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_passwordEdit) + m_passwordEdit->setFocusin(target); + m_widgetLoginOpts->tabOptionSelected(2); + break; + } + } else { + if (m_passwordEdit) { + m_passwordEdit->setFocusin(2); + } + switch (target) { + case REMOVE: //焦点清除 + if(m_widgetLoginOpts) + m_widgetLoginOpts->tabOptionSelected(2); + m_ukeyPasswordEdit->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: //焦点在登录按钮 + if(m_widgetLoginOpts) + m_widgetLoginOpts->tabOptionSelected(2); + m_ukeyPasswordEdit->setFocusin(1); + break; + case BIO_RIGHT: //登录选项焦点右移 + if(m_widgetLoginOpts) + m_widgetLoginOpts->tabOptionSelected(0); + m_ukeyPasswordEdit->setFocusin(2); + m_nameLabel->setFocus(); + break; + case BIO_LEFT: //登录选项焦点左移 + if(m_widgetLoginOpts) + m_widgetLoginOpts->tabOptionSelected(1); + m_ukeyPasswordEdit->setFocusin(target); + m_nameLabel->setFocus(); + break; + case IN_LINEEDIT: //焦点在密码输入框 + if(m_widgetLoginOpts) + m_widgetLoginOpts->tabOptionSelected(2); + m_ukeyPasswordEdit->setFocusin(0); + break; + case ON_MESSAGEBTN: //免密登录按钮 + if(m_widgetLoginOpts) + m_widgetLoginOpts->tabOptionSelected(2); + m_ukeyPasswordEdit->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: + if(m_ukeyPasswordEdit) + m_ukeyPasswordEdit->setFocusin(target); m_widgetLoginOpts->tabOptionSelected(2); break; } @@ -627,13 +827,17 @@ void AuthDialog::setClick() void AuthDialog::checkPassword() { - m_passwordEdit->clicked_cb(); + if (m_passwordEdit && m_passwordEdit->isVisible()) { + m_passwordEdit->clicked_cb(); + } else if (m_ukeyPasswordEdit && m_ukeyPasswordEdit->isVisible()) { + m_ukeyPasswordEdit->clicked_cb(); + } setFocusin(REMOVE); } void AuthDialog::onShowPrompt(const QString &prompt, Auth::PromptType type) { - qDebug() << "-------prompt: " << prompt; + qDebug() << "-------prompt: " << prompt<show(); } - m_passwordEdit->setFocus(); + if (m_passwordEdit->isVisible()) + m_passwordEdit->setFocus(); prompted = true; unacknowledged_messages = false; @@ -671,7 +876,8 @@ void AuthDialog::onShowPrompt(const QString &prompt, Auth::PromptType type) m_passwordEdit->clear(); m_passwordEdit->setPrompt(text); m_passwordEdit->show(); - m_passwordEdit->setFocus(); + if (m_passwordEdit->isVisible()) + m_passwordEdit->setFocus(); if(!m_timer){ m_timer = new QTimer(this); m_timer->setInterval(200); @@ -720,9 +926,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); @@ -730,7 +938,12 @@ void AuthDialog::show_authenticated(bool successful) { isretry = false; m_messageButton->setText(tr("Login")); + QString strMsgTip = m_messageLabel->text(); switchLoginOptType(LOGINOPT_TYPE_PASSWORD); + if (!strMsgTip.isEmpty()) { + m_messageLabel->setText(strMsgTip); + m_messageLabel->move(m_messageButton->x(), m_messageLabel->y()); + } // QTimer::singleShot(100, this, [=](){ // qDebug()<<"Delay to focus msgBtn!!"; // m_messageButton->show(); @@ -756,6 +969,7 @@ void AuthDialog::onMessageButtonClicked() else { m_messageButton->hide(); + is_showMessageBtn = false; authMode = PASSWORD; m_messageLabel->setText(""); @@ -763,6 +977,19 @@ void AuthDialog::onMessageButtonClicked() } } +void AuthDialog::onRespondUkey(const QString &text) +{ + if (m_widgetLoginOpts){ + m_widgetLoginOpts->SetExtraInfo(text,"pincode"); + m_widgetLoginOpts->startAuth(m_deviceInfo, user.uid); + } +} + +bool AuthDialog::getLineeditStatus() +{ + return is_showMessageBtn; +} + void AuthDialog::onRespond(const QString &text) { if (!prompted && text != BIOMETRIC_SUCCESS) { @@ -812,6 +1039,7 @@ void AuthDialog::clearMessage() void AuthDialog::performBiometricAuth() { + qDebug()<<"performBiometricAuth"; if(!m_biometricProxy) { m_biometricProxy = new BiometricProxy(this); @@ -846,6 +1074,12 @@ void AuthDialog::performBiometricAuth() { qWarning() << "No available devices"; skipBiometricAuth(); + if (m_deviceInfo) { + if (!m_widgetLoginOpts || !m_widgetLoginOpts->findDeviceById(m_deviceInfo->id) + || m_widgetLoginOpts->isDeviceDisable(m_deviceInfo->id)) { + m_deviceInfo = DeviceInfoPtr(); + } + } return; } @@ -879,8 +1113,21 @@ void AuthDialog::performBiometricAuth() return; } } + + if(m_deviceInfo->deviceType == LOGINOPT_TYPE_GENERAL_UKEY){ + switchLoginOptType(LOGINOPT_TYPE_PASSWORD); + m_widgetLoginOpts->setSelectedPassword(); + skipBiometricAuth(); + return ; + } + switchLoginOptType(m_widgetLoginOpts->convertDeviceType(m_deviceInfo->deviceType)); - startBioAuth(); + if(!m_widgetLoginOpts->isDeviceDisable(m_deviceInfo->id)) + startBioAuth(); + else { + QImage imgFailed; + setFaceImg(imgFailed, 1); + } skipBiometricAuth(); } @@ -914,6 +1161,12 @@ void AuthDialog::initBiometricWidget() m_widgetLoginOpts->hide(); else m_widgetLoginOpts->show(); + + if(m_widgetLoginOpts->getHasUkeyOptions() && m_widgetLoginOpts->getLoginOptCount() < 1){ + m_widgetLoginOpts->show(); + m_widgetLoginOpts->setSelectedPassword(); + } + m_widgetLoginOpts->setEnabled(true); setBiometricWidgetGeometry(); @@ -925,7 +1178,7 @@ void AuthDialog::setBiometricWidgetGeometry() if(m_widgetLoginOpts) { m_widgetLoginOpts->setGeometry(0, m_passwdWidget->geometry().bottom(), - width(), 84*scale); + width(), 92*scale); qDebug()<<"LoginOptGeometry:"<geometry()<<","<geometry() <<","<isHidden(); } @@ -933,33 +1186,63 @@ void AuthDialog::setBiometricWidgetGeometry() int AuthDialog::getBioNum() { - return m_widgetLoginOpts->getLoginOptCount(); + return m_widgetLoginOpts->getVisibleLoginOptCount(); } void AuthDialog::onDeviceChanged(unsigned uCurLoginOptType, const DeviceInfoPtr &deviceInfo, bool keyNavigation) { - if (!deviceInfo) - return; if(!keyNavigation) Q_EMIT loginOptionClicked(); - qDebug() << "device changed: " << *deviceInfo; - if(m_failedTimes.contains(deviceInfo->id) && + isLoadingUkey = false; + if(uCurLoginOptType == LOGINOPT_TYPE_PASSWORD){ + switchLoginOptType(uCurLoginOptType); + if(m_widgetLoginOpts){ + m_widgetLoginOpts->stopAuth(); + } + m_deviceInfo = nullptr; + authMode = PASSWORD; + startAuth(); + return; + } + if (uCurLoginOptType != LOGINOPT_TYPE_GENERAL_UKEY && !deviceInfo) + return; + if(deviceInfo) + qDebug() << "device changed: " << *deviceInfo; + if(deviceInfo && m_failedTimes.contains(deviceInfo->id) && m_failedTimes[deviceInfo->id] >= maxFailedTimes){ qDebug() << "Failed MAX:"<id; return ; } - if (deviceInfo == m_deviceInfo) { + + if (uCurLoginOptType == LOGINOPT_TYPE_GENERAL_UKEY && !deviceInfo){ + isLoadingUkey = true; + startLoadingUkey(); + }else if(uCurLoginOptType == LOGINOPT_TYPE_GENERAL_UKEY && deviceInfo){ + stopLoadingUkey(); + } + + if (uCurLoginOptType != LOGINOPT_TYPE_GENERAL_UKEY && deviceInfo == m_deviceInfo) { return ; } + + if(m_bioTimer && m_bioTimer->isActive()) + m_bioTimer->stop(); + m_deviceInfo = deviceInfo; switchLoginOptType(uCurLoginOptType); - if(!isBioPassed) + if(!isBioPassed && deviceInfo) startBioAuth(); } void AuthDialog::onBiometricAuthComplete(bool result, int nStatus) { if(!result) { + + if(m_deviceInfo && m_deviceInfo->deviceType == LOGINOPT_TYPE_GENERAL_UKEY && m_ukeyPasswdWidget->isVisible()){ + m_ukeyPasswordEdit->stopWaiting(); + m_ukeyPasswordEdit->clearText(); + } + if (nStatus == 5 && m_deviceInfo) { if(w_timer && w_timer->isActive()) w_timer->stop(); @@ -983,16 +1266,31 @@ void AuthDialog::onBiometricAuthComplete(bool result, int nStatus) setLoginTypeTip(tr("Failed to verify %1, please enter password to unlock").arg(DeviceType::getDeviceType_tr(m_deviceInfo->deviceType))); QImage nullImage; setQRCode(nullImage); + }else if(m_deviceInfo->deviceType == LOGINOPT_TYPE_GENERAL_UKEY){ + setUkeyTypeTip(tr("Unable to verify %1, please enter password to unlock").arg(DeviceType::getDeviceType_tr(m_deviceInfo->deviceType))); } else { setLoginTypeTip(tr("Unable to verify %1, please enter password to unlock").arg(DeviceType::getDeviceType_tr(m_deviceInfo->deviceType))); } if (m_widgetLoginOpts) m_widgetLoginOpts->setDeviceDisable(m_deviceInfo->id, true); + + if(m_ukeyPasswdWidget && m_ukeyPasswdWidget->isVisible()){ + m_ukeyPasswordEdit->readOnly(true); + } return ; } - setLoginTypeTip(tr("Failed to verify %1, you still have %2 verification opportunities") - .arg(DeviceType::getDeviceType_tr(m_deviceInfo->deviceType)) - .arg(maxFailedTimes-m_failedTimes[m_deviceInfo->id])); + + qDebug()<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; + if(m_deviceInfo->deviceType == LOGINOPT_TYPE_GENERAL_UKEY){ + setUkeyTypeTip(tr("Failed to verify %1, you still have %2 verification opportunities") + .arg(DeviceType::getDeviceType_tr(m_deviceInfo->deviceType)) + .arg(maxFailedTimes-m_failedTimes[m_deviceInfo->id])); + }else { + setLoginTypeTip(tr("Failed to verify %1, you still have %2 verification opportunities") + .arg(DeviceType::getDeviceType_tr(m_deviceInfo->deviceType)) + .arg(maxFailedTimes-m_failedTimes[m_deviceInfo->id])); + } + qDebug()<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; } } @@ -1073,7 +1371,7 @@ void AuthDialog::setQRCodeMsg(QString strMsg) { w_timer->stop(); } - m_labelQRCodeMsg->setText(strMsg); + m_labelQRCodeMsg->setElideText(strMsg, m_labelQRCode->width() - 20* scale, 14); m_labelQRCodeMsg->show(); m_labelQRCodeTip->setPixmap(QIcon::fromTheme("dialog-warning").pixmap(QSize(22,22))); m_labelQRCodeTip->show(); @@ -1094,7 +1392,7 @@ void AuthDialog::setFaceImg(QImage& imgFace, int nStatus) break; case 2: faceImage = m_widgetLoginOpts->loadSvg(":/image/assets/ukui-loginopt-smile.svg", "gray", 48); - m_labelFace->setStyleSheet(QString("border-radius: %1px; border:0px solid white;background-color: rgba(255,255,255,20%);").arg(77*scale)); + m_labelFace->setStyleSheet(QString("border-radius: %1px; border:0px solid white;background-color: rgba(255,255,255,10%);").arg((int)(77*scale))); break; default: faceImage = QPixmap(":/image/assets/ukui-loginopt-smile.svg"); @@ -1118,6 +1416,19 @@ void AuthDialog::updatePixmap() } } +void AuthDialog::setUkeyTypeTip(QString text) +{ + QString textTip = text; + if (!textTip.isEmpty()) { +// QFontMetrics font(m_ukeyMessageLabel->font()); +// QString textTip = font.elidedText(textTip, Qt::ElideRight, m_messageLabel->width()-8); + m_ukeyMessageLabel->setText(textTip); + m_ukeyMessageLabel->setToolTip(text); + m_ukeyMessageLabel->show(); + } else { + m_ukeyMessageLabel->hide(); + } +} void AuthDialog::setLoginTypeTip(QString strLoginTypeTip) { @@ -1162,12 +1473,20 @@ void AuthDialog::onLoginOptsCount(unsigned uCount, bool is_bioBtn) if(m_widgetLoginOpts->getLoginOptCount() < 1) { qWarning() << "No available devices"; + if (m_deviceInfo) { + m_deviceInfo = DeviceInfoPtr(); + } return; } //获取默认设备 if (m_widgetLoginOpts) { - m_deviceName = m_widgetLoginOpts->getDefaultDevice(user.name); + qDebug()<<"isLoadingUkey:"<getDefaultDevice(user.name,UniT_General_Ukey); + } else { + m_deviceName = m_widgetLoginOpts->getDefaultDevice(user.name); + } } qDebug() << m_deviceName; if (m_deviceInfo) { @@ -1191,6 +1510,16 @@ void AuthDialog::onLoginOptsCount(unsigned uCount, bool is_bioBtn) return; } } + + if (m_deviceInfo->deviceType == LOGINOPT_TYPE_GENERAL_UKEY){ + stopLoadingUkey(); + } + + if(m_deviceInfo){ + m_widgetLoginOpts->setCurrentDevice(m_deviceInfo); + m_widgetLoginOpts->updateUIStatus(); + } + switchLoginOptType(m_widgetLoginOpts->convertDeviceType(m_deviceInfo->deviceType)); startBioAuth(); } @@ -1272,6 +1601,12 @@ void AuthDialog::onBiometricDbusChanged(bool bActive) if(m_widgetLoginOpts->getLoginOptCount() < 1) { qWarning() << "No available devices"; + if (m_deviceInfo) { + if (!m_widgetLoginOpts || !m_widgetLoginOpts->findDeviceById(m_deviceInfo->id) + || m_widgetLoginOpts->isDeviceDisable(m_deviceInfo->id)) { + m_deviceInfo = DeviceInfoPtr(); + } + } return; } @@ -1303,3 +1638,38 @@ void AuthDialog::onBiometricDbusChanged(bool bActive) }); } } + +QPixmap AuthDialog::makeRoundLogo(QString logo, int wsize, int hsize, int radius) +{ + QPixmap rectPixmap; + QPixmap iconcop = QPixmap(logo); + qreal dpi = m_labelHeadImg->devicePixelRatioF(); + if (dpi > 1.0) { + wsize = wsize * dpi; + hsize = hsize * dpi; + } + if (iconcop.width() > iconcop.height()) { + QPixmap iconPixmap = iconcop.copy((iconcop.width() - iconcop.height())/2, 0, iconcop.height(), iconcop.height()); + // 根据label高度等比例缩放图片 + rectPixmap = iconPixmap.scaledToHeight(hsize, Qt::SmoothTransformation); + } else { + QPixmap iconPixmap = iconcop.copy(0, (iconcop.height() - iconcop.width())/2, iconcop.width(), iconcop.width()); + // 根据label宽度等比例缩放图片 + rectPixmap = iconPixmap.scaledToWidth(wsize, Qt::SmoothTransformation); + } + + if (rectPixmap.isNull()) { + return QPixmap(); + } + QPixmap pixmapa(rectPixmap); + QPixmap pixmap(radius * 2 * dpi, radius * 2 * dpi); + pixmap.fill(Qt::transparent); + QPainter painter(&pixmap); + painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); + QPainterPath path; + path.addEllipse(0, 0, radius * 2 * dpi, radius * 2 * dpi); + painter.setClipPath(path); + painter.drawPixmap(0, 0, radius * 2 * dpi, radius * 2 * dpi, pixmapa); + pixmap.setDevicePixelRatio(dpi); + return pixmap; +} diff --git a/src/authdialog.h b/src/authdialog.h index 4ce6348..b3602e3 100644 --- a/src/authdialog.h +++ b/src/authdialog.h @@ -37,12 +37,12 @@ class AuthDialog; } class QLabel; +class KLabel; class QPushButton; +class Configuration; class IconEdit; class Auth; class BiometricProxy; -class BiometricAuthWidget; -class BiometricDevicesWidget; class PamTally; class LoginOptionsWidget; @@ -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(); @@ -82,13 +84,19 @@ private: void startBioAuth(unsigned uTimeout = 1000); void show_authenticated (bool successful = true); void setLoginTypeTip(QString strLoginTypeTip); + void setUkeyTypeTip(QString text); void updatePixmap(); + void startLoadingUkey(); + void stopLoadingUkey(); + void updateLoadingPixmap(); + QPixmap makeRoundLogo(QString logo, int wsize, int hsize, int radius); private Q_SLOTS: void onShowMessage(const QString &message, Auth::MessageType type); void onShowPrompt(const QString &prompt, Auth::PromptType type); void onAuthComplete(); void onRespond(const QString &text); + void onRespondUkey(const QString &text); // void onBioAuthStart(); // void onBioAuthStop(); // void setBioMovieImage(); @@ -124,6 +132,7 @@ Q_SIGNALS: void authenticateCompete(bool result); void clickPassword(bool clicked); void loginOptionClicked(); + void showMessageBtn(bool is_show); private: UserItem user; Auth *auth; @@ -131,12 +140,12 @@ private: enum AuthMode { PASSWORD, BIOMETRIC, UNKNOWN }; AuthMode authMode; + Configuration *configuration; // biometric auth QString m_deviceName; DeviceInfoPtr m_deviceInfo = nullptr; BiometricProxy *m_biometricProxy; - BiometricAuthWidget *m_biometricAuthWidget; QWidget *m_buttonsWidget; QPushButton *m_biometricButton; QPushButton *m_passwordButton; @@ -149,18 +158,29 @@ private: // QPushButton *m_backButton; //返回用户列表 QWidget *m_userWidget; //放置用户信息Label QLabel *m_labelHeadImg = nullptr; //头像 - QLabel *m_nameLabel; //用户名 + KLabel *m_nameLabel; //用户名 // QLabel *m_isLoginLabel; //提示是否已登录 QWidget *m_passwdWidget; //放置密码输入框和信息列表 IconEdit *m_passwordEdit; //密码输入框 - QLabel *m_messageLabel; //PAM消息显示 + KLabel *m_messageLabel; //PAM消息显示 QPushButton *m_messageButton; + bool is_showMessageBtn = false; + + QWidget *m_ukeyPasswdWidget = nullptr; //放置密码输入框和信息列表 + IconEdit *m_ukeyPasswordEdit = nullptr; //密码输入框 + KLabel *m_ukeyMessageLabel = nullptr; //PAM消息显示 + + QWidget *m_loadingWidget = nullptr; + QPushButton *m_loadingButton = nullptr; + KLabel *m_loadingText = nullptr; + QTimer *m_loadingTimer = nullptr; + QPixmap m_loadingPixmap; QLabel *m_labelFace = nullptr; - QLabel *m_labelLoginTypeTip = nullptr; // 登录类型提示 + KLabel *m_labelLoginTypeTip = nullptr; // 登录类型提示 QLabel *m_labelQRCode = nullptr; // 二维码图标 - QLabel *m_labelQRCodeMsg = nullptr; // 二维码状态消息提示 + KLabel *m_labelQRCodeMsg = nullptr; // 二维码状态消息提示 QLabel *m_labelQRCodeTip = nullptr; bool isBioPassed; // 生物认证是否成功 @@ -189,6 +209,9 @@ private: QPixmap m_waitingPixmap; QTimer *w_timer; UniAuthService *m_uniauthService = nullptr; + double curFontSize = 0; + double m_ptToPx = 1.0; + bool isLoadingUkey = false; }; #endif // AUTHDIALOG_H diff --git a/src/authpamthread.cpp b/src/authpamthread.cpp deleted file mode 100644 index 4dabca7..0000000 --- a/src/authpamthread.cpp +++ /dev/null @@ -1,201 +0,0 @@ -#include "authpamthread.h" - -#include -#include -#include -#include -#include -#include -#include - -#define PAM_SERVICE_NAME "ukui-screensaver-qt" - -static void writeData(int fd, const void *buf, ssize_t count); -static void writeString(int fd, const char *data); -static int readData(int fd, void *buf, size_t count); -static char * readString(int fd); -static int pam_conversation(int msgLength, const struct pam_message **msg, - struct pam_response **resp, void *appData); - -AuthPamThread::AuthPamThread(QObject* parent) - : QThread(parent) -{ -} - -AuthPamThread::~AuthPamThread() -{ - -} - -void AuthPamThread::writeData(int fd, const void *buf, ssize_t count) -{ - if (!m_isAuthenticating) { - return; - } - if(write(fd, buf, count) != count) - qDebug() << "write to parent failed: " << strerror(errno); -} - -void AuthPamThread::writeString(int fd, const char *data) -{ - int length = data ? strlen(data) : -1; - writeData(fd, &length, sizeof(length)); - if(data) - writeData(fd, data, sizeof(char) * length); -} - -int AuthPamThread::readData(int fd, void *buf, size_t count) -{ - ssize_t nRead = 0; - while(true) { - nRead = read(fd, buf, count); - if (!m_isAuthenticating) { - break; - } - if (nRead < 0) { - if (errno == EAGAIN) { - usleep(100*1000); - continue; - } else { - qDebug() << "read data failed: " << strerror(errno) << errno; - } - } - break; - } - return nRead; -} - -char* AuthPamThread::readString(int fd) -{ - int length; - - if(readData(fd, &length, sizeof(length)) <= 0) - return NULL; - if(length <= 0) - length = 0; - - char *value = (char *)malloc(sizeof(char) * (length + 1)); - readData(fd, value, length); - - value[length] = '\0'; - - return value; -} - -static int -pam_conversation(int msgLength, const struct pam_message **msg, - struct pam_response **resp, void *appData) -{ - struct pam_response *response = (struct pam_response*)calloc(msgLength,sizeof(struct pam_response)); - AuthPamThread* pData = (AuthPamThread*)appData; - if (!pData || pData->m_fdRead < 0 || pData->m_fdWrite < 0) { - return PAM_CONV_ERR; - } - - int authComplete = 0; - pData->writeData(pData->m_fdWrite, (const void*)&authComplete, sizeof(authComplete)); - pData->writeData(pData->m_fdWrite, (const void*)&msgLength, sizeof(msgLength)); - //发送pam消息 - for(int i = 0; i < msgLength; i++) - { - const struct pam_message *m = msg[i]; - pData->writeData(pData->m_fdWrite, (const void *)&m->msg_style, sizeof(m->msg_style)); - pData->writeString(pData->m_fdWrite, m->msg); - } - //读取响应 - for(int i = 0; i < msgLength; i++) - { - struct pam_response *r = &response[i]; - if (pData->readData(pData->m_fdRead, &r->resp_retcode, sizeof(r->resp_retcode)) < 0) { - break; - } - r->resp = pData->readString(pData->m_fdRead); - } - *resp = response; - return PAM_SUCCESS; -} - -void AuthPamThread::_authenticate(const char *userName) -{ - qDebug() << "authenticate " << userName; - - pam_handle_t *pamh = NULL; - char *newUser = NULL; - int ret; - int authRet; - struct pam_conv conv; - - conv.conv = pam_conversation; - conv.appdata_ptr = this; - - ret = pam_start(PAM_SERVICE_NAME, userName, &conv, &pamh); - if(ret != PAM_SUCCESS) { - qDebug() << "failed to start PAM: " << pam_strerror(NULL, ret); - } - - authRet = pam_authenticate(pamh, 0); - - ret = pam_get_item(pamh, PAM_USER, (const void **)&newUser); - if(ret != PAM_SUCCESS) { - pam_end(pamh, 0); - qDebug() << "failed to get username"; - } - - if(authRet == PAM_SUCCESS) { - /*检测账户有效性,即使密码认证通过,如果账户锁定或无效,也无法解锁*/ - authRet = pam_acct_mgmt(pamh, 0); - } - - if(authRet != PAM_SUCCESS) { - qDebug() << "failed to acct mgmt " << pam_strerror(NULL, authRet); - } - - if (newUser) { - free(newUser); - newUser = NULL; - } - fprintf(stderr, "authentication result: %d\n", authRet); - - // 发送认证结果 - int authComplete = 1; - writeData(m_fdWrite, (const void*)&authComplete, sizeof(authComplete)); - writeData(m_fdWrite, (const void *)&authRet, sizeof(authRet)); - qDebug() << "--- 认证完成"; -} - -void AuthPamThread::startAuthPam(int fdRead, int fdWrite, QString strUserName) -{ - if (!isRunning()) { - qDebug()<<"startAuthPam ----"; - m_isAuthenticating = true; - int nFlags = fcntl(fdRead, F_GETFL); - nFlags = nFlags | O_NONBLOCK; - fcntl(fdRead, F_SETFL, nFlags); - m_fdRead = fdRead; - m_fdWrite = fdWrite; - m_strUserName = strUserName; - start(); - } else { - qDebug()<<"AuthPamThread is running!!"; - } -} - -void AuthPamThread::run() -{ - if (m_fdRead >=0 && m_fdWrite >= 0 && !m_strUserName.isEmpty()) { - _authenticate(m_strUserName.toLocal8Bit().data()); - } else { - qDebug()<<"AuthPamThread param error:"< - -class AuthPamThread : public QThread -{ - Q_OBJECT -public: - AuthPamThread(QObject* parent = nullptr); - virtual ~AuthPamThread(); - void startAuthPam(int fdRead, int fdWrite, QString strUserName); - void stopAuthPam(); - - void writeData(int fd, const void *buf, ssize_t count); - void writeString(int fd, const char *data); - int readData(int fd, void *buf, size_t count); - char *readString(int fd); - -protected: - void run(); - -private: - void _authenticate(const char *userName); - -public: - int m_fdRead = -1; - int m_fdWrite = -1; - QString m_strUserName = ""; - -private: - bool m_isAuthenticating = false; -}; - -#endif // AUTHPAMTHREAD_H diff --git a/src/batterywidget.cpp b/src/batterywidget.cpp index 76387c7..d0a1c72 100644 --- a/src/batterywidget.cpp +++ b/src/batterywidget.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 . + * +**/ #include "batterywidget.h" #include #include @@ -38,7 +55,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); diff --git a/src/batterywidget.h b/src/batterywidget.h index b9d460c..acf9ac5 100644 --- a/src/batterywidget.h +++ b/src/batterywidget.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 BATTERYWIDGET_H #define BATTERYWIDGET_H diff --git a/src/common.h b/src/common.h index b7ed8c8..95489cb 100644 --- a/src/common.h +++ b/src/common.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 LOCKCOMMON_H #define LOCKCOMMON_H diff --git a/src/configuration.cpp b/src/configuration.cpp index fa5a9e8..0e9198c 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -20,16 +20,23 @@ #include #include #include +#include #include #include #include #include #include +#include +#include +#include +#include "glibinterface.h" #include "commonfunc.h" #define GSETTINGS_SCHEMA_SCREENSAVER "org.ukui.screensaver" +#define GSETTINGS_SCHEMA_STYLE "org.ukui.style" #define KEY_MODE "mode" #define KEY_THEMES "themes" +#define KEY_FONT_SIZE "systemFontSize" #define KEY_IDLE_ACTIVATION_ENABLED "idle-activation-enabled" #define KEY_LOCK_ENABLED "lock-enabled" #define KEY_IMAGE_TRANSITION_EFFECT "image-transition-effect" @@ -58,7 +65,10 @@ Configuration::Configuration(QObject *parent) : QObject(parent) imageSwitchInterval = gsettings->get(KEY_IMAGE_SWITCH_INTERVAL).toInt(); imageTSEffect = gsettings->get(KEY_IMAGE_TRANSITION_EFFECT).toInt(); background = gsettings->get(KEY_BACKGROUND).toString(); - m_nLockTimeout = gsettings->get(KEY_LOCK_TIMEOUT).toInt(); + QStringList keysScreenSaver = gsettings->keys(); + if (keysScreenSaver.contains(KEY_LOCK_TIMEOUT)) { + m_nLockTimeout = gsettings->get(KEY_LOCK_TIMEOUT).toInt(); + } qDebug() << mode << themes; qDebug() << imageSwitchInterval << imageTSEffect; @@ -94,6 +104,13 @@ Configuration::Configuration(QObject *parent) : QObject(parent) if(themes.count() == 1 && themes[0] == "kyccss-personal-slideshow") mode ="image"; + + fsGsettings = new QGSettings(GSETTINGS_SCHEMA_STYLE); + + double defaultFontSize = getDefaultFontSize(); + + qDebug()<<"defaultFontSize = "<get(KEY_FONT_SIZE).toDouble() - defaultFontSize; } Configuration* Configuration::instance(QObject *parent) @@ -205,6 +222,19 @@ QString Configuration::getBackground() if(ispicture(background)) return background; + char *systemName = kdk_system_get_systemName(); + if (systemName) { + if (QString(systemName) == "openKylin") { + free(systemName); + return "/usr/share/backgrounds/1-openkylin.jpg"; + } + free(systemName); + } + return "/usr/share/backgrounds/1-warty-final-ubuntukylin.jpg"; +} + +QString Configuration::getDefaultBackgroundName() +{ return "/usr/share/backgrounds/1-warty-final-ubuntukylin.jpg"; } @@ -227,3 +257,15 @@ int Configuration::locktimeout() { return m_nLockTimeout; } + +double Configuration::getFontSize() +{ + return curFontSize; +} + +double Configuration::getPtToPx() +{ + if (QApplication::primaryScreen()->logicalDotsPerInch() > 0) + m_pxToPt = 72/(QApplication::primaryScreen()->logicalDotsPerInch()); + return m_pxToPt; +} diff --git a/src/configuration.h b/src/configuration.h index a74fada..8bd81e8 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -32,17 +32,20 @@ class QGSettings; class Configuration : public QObject { Q_OBJECT -public: +private: explicit Configuration(QObject *parent = nullptr); public: ScreenSaver *getScreensaver(); static Configuration *instance(QObject *parent = nullptr); QString getBackground(); + QString getDefaultBackgroundName(); bool lockWhenXScreensaverActivated(); int idlelock(); int idledelay(); int locktimeout(); + double getFontSize(); + double getPtToPx(); public Q_SLOTS: void onConfigurationChanged(QString key); @@ -53,7 +56,10 @@ private: private: QGSettings *gsettings; QGSettings *bgGsettings; + QGSettings *fsGsettings; QString mode; + double curFontSize; + double m_pxToPt = 1.0; QList themes; QString background; bool idleActivationEnabled; diff --git a/src/device.cpp b/src/device.cpp index f7a62c2..007d30a 100644 --- a/src/device.cpp +++ b/src/device.cpp @@ -1,10 +1,10 @@ /* - * Copyright 2021 KylinSoft Co., Ltd. + * Copyright (C) 2021 Tianjin KYLIN Information Technology Co., Ltd. * - * This program is free software: you can redistribute it and/or modify + * 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. + * the Free Software Foundation; either version 3, 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 @@ -12,8 +12,9 @@ * 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 . - */ + * along with this program; if not, see . + * +**/ #include "device.h" #include diff --git a/src/device.h b/src/device.h index fd72185..73c8615 100644 --- a/src/device.h +++ b/src/device.h @@ -1,10 +1,10 @@ /* - * Copyright 2021 KylinSoft Co., Ltd. + * Copyright (C) 2021 Tianjin KYLIN Information Technology Co., Ltd. * - * This program is free software: you can redistribute it and/or modify + * 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. + * the Free Software Foundation; either version 3, 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 @@ -12,8 +12,9 @@ * 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 . - */ + * along with this program; if not, see . + * +**/ #ifndef DEVICE_H #define DEVICE_H diff --git a/src/digitalkeyboard.cpp b/src/digitalkeyboard.cpp index 77239ba..4597ad4 100644 --- a/src/digitalkeyboard.cpp +++ b/src/digitalkeyboard.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 . + * +**/ #include "digitalkeyboard.h" #include diff --git a/src/digitalkeyboard.h b/src/digitalkeyboard.h index 107a115..4a386fe 100644 --- a/src/digitalkeyboard.h +++ b/src/digitalkeyboard.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2018 Tianjin KYLIN Information Technology 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, 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 DIGITALKEYBOARD_H #define DIGITALKEYBOARD_H diff --git a/src/displaymanager.cpp b/src/displaymanager.cpp index abc9e0b..65e9346 100644 --- a/src/displaymanager.cpp +++ b/src/displaymanager.cpp @@ -73,7 +73,6 @@ QString DisplayManager::getDisplayType() void DisplayManager::switchToGreeter() { - qDebug()<<"111111111111111111111111111111111111111111111111111111"; if(_displayType == "lightdm"){ QDBusMessage ret = dmSeatService->call("SwitchToGreeter"); handleDBusError(ret); diff --git a/src/eduplatforminterface.cpp b/src/eduplatforminterface.cpp index 47084ef..6f3384c 100644 --- a/src/eduplatforminterface.cpp +++ b/src/eduplatforminterface.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 . + * +**/ #include "eduplatforminterface.h" const QString STR_EDU_SERVICE = "cn.kylinos.SSOBackend"; diff --git a/src/eduplatforminterface.h b/src/eduplatforminterface.h index 60e72dc..0a93506 100644 --- a/src/eduplatforminterface.h +++ b/src/eduplatforminterface.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 EDUPLATFORMINTERFACE_H #define EDUPLATFORMINTERFACE_H #include diff --git a/src/enginedevice.cpp b/src/enginedevice.cpp index f67ff9c..f69c95e 100644 --- a/src/enginedevice.cpp +++ b/src/enginedevice.cpp @@ -1,10 +1,10 @@ /* - * Copyright 2021 KylinSoft Co., Ltd. + * Copyright (C) 2021 Tianjin KYLIN Information Technology Co., Ltd. * - * This program is free software: you can redistribute it and/or modify + * 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. + * the Free Software Foundation; either version 3, 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 @@ -12,9 +12,9 @@ * 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 . - */ - + * along with this program; if not, see . + * +**/ #include "enginedevice.h" #include "device.h" #include diff --git a/src/fullbackgroundwidget.cpp b/src/fullbackgroundwidget.cpp index 52efbe6..adbcf01 100644 --- a/src/fullbackgroundwidget.cpp +++ b/src/fullbackgroundwidget.cpp @@ -32,6 +32,7 @@ #include #include #include +#include "plasma-shell-manager.h" #include #include "lockwidget.h" #include @@ -210,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", @@ -301,13 +302,19 @@ void FullBackgroundWidget::switchToLinux() void FullBackgroundWidget::laterActivate() { + if (QX11Info::isPlatformX11()) { + /*在不调用XSetInputFocus接口的情况下,在窗口失去焦点后,activateWindow概率性无法 + * 激活窗口,导致锁屏输入不了密码。 + * 复现方法:锁屏,然后切换到tty,启动终端,文管等窗口抢占锁屏窗口焦点,数次以后必现*/ + XSetInputFocus(QX11Info::display(),this->winId(),RevertToParent,CurrentTime); + } activateWindow(); raise(); raiseOtherWnd(); setFocus(); if(lockWidget && lockWidget->isVisible()) { - //lockWidget->setFocus(); - lockWidget->onActiveWindpw();//将焦点设置到密码框 + lockWidget->setFocus(); + lockWidget->onActiveLineedit();//将焦点设置到密码框 } update(); } @@ -318,8 +325,8 @@ void FullBackgroundWidget::laterOtherActivate() raiseOtherWnd(); //setFocus(); if(lockWidget && lockWidget->isVisible()) { - //lockWidget->setFocus(); - lockWidget->onActiveWindpw();//将焦点设置到密码框 + lockWidget->setFocus(); + lockWidget->onActiveLineedit();//将焦点设置到密码框 } } @@ -329,21 +336,39 @@ void FullBackgroundWidget::setLockState() return ; lockState = true; - - QDBusInterface *interface = new QDBusInterface(SS_DBUS_SERVICE, + QString displayNum = QString(qgetenv("DISPLAY")).replace(":", "").replace(".", "_"); + QString sessionDbus = QString("%1%2").arg(QString(SS_DBUS_SERVICE)).arg(displayNum); + QDBusInterface *interface = new QDBusInterface(sessionDbus, SS_DBUS_PATH, SS_DBUS_INTERFACE); + if (!interface->isValid()) { + delete interface; + interface = new QDBusInterface(SS_DBUS_SERVICE, + SS_DBUS_PATH, + SS_DBUS_INTERFACE); + } QDBusMessage msg = interface->call("SetLockState"); if(msg.type() == QDBusMessage::ErrorMessage) qDebug() << msg.errorMessage(); - + HideMultiview(); } bool FullBackgroundWidget::eventFilter(QObject *obj, QEvent *event) { + 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") { + PlasmaShellManager::getInstance()->setAppWindowKeepAbove(true); + } + QTimer::singleShot(500,this,SLOT(setLockState())); QTimer::singleShot(200,this,SLOT(killWindow())); } @@ -441,8 +466,11 @@ void FullBackgroundWidget::closeEvent(QCloseEvent *event) if(widget) widget->close(); } - closeGrab(); - + + if(QX11Info::isPlatformX11()){ + closeGrab(); + } + return QWidget::closeEvent(event); } @@ -474,12 +502,7 @@ bool FullBackgroundWidget::nativeEventFilter(const QByteArray &eventType, void * XClassHint ch; ch.res_name = NULL; ch.res_class = NULL; - Display* display = XOpenDisplay(0); - if (!display) { - return false; - } - XGetClassHint (display, xc->window, &ch); - XCloseDisplay(display); + XGetClassHint (QX11Info::display(), xc->window, &ch); if(QString(ch.res_name) == "ukui-screensaver-dialog") { if (ch.res_name) XFree(ch.res_name); @@ -508,12 +531,7 @@ bool FullBackgroundWidget::nativeEventFilter(const QByteArray &eventType, void * XClassHint ch; ch.res_name = NULL; ch.res_class = NULL; - Display* display = XOpenDisplay(0); - if (!display) { - return false; - } - XGetClassHint (display, xm->window, &ch); - XCloseDisplay(display); + XGetClassHint (QX11Info::display(), xm->window, &ch); if(QString(ch.res_name) == "ukui-screensaver-dialog") { if (ch.res_name) XFree(ch.res_name); @@ -546,13 +564,12 @@ 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); + 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接口获取了 @@ -585,7 +602,7 @@ void FullBackgroundWidget::mouseMoveEvent(QMouseEvent *e) clearScreensavers(); } - onCursorMoved(QCursor::pos()); + //onCursorMoved(QCursor::pos()); return QWidget::mouseMoveEvent(e); } @@ -611,18 +628,30 @@ void FullBackgroundWidget::mousePressEvent(QMouseEvent *e) void FullBackgroundWidget::init() { /*捕获键盘,如果捕获失败,则可能是由于弹出菜单项已经捕获,那么模拟一次esc按键来退出菜单,如果仍捕获失败,则放弃锁屏,避免密码无法输入*/ - if(establishGrab()) - qDebug()<<"establishGrab : true"; - else { - qDebug()<<"establishGrab : false"; - XTestFakeKeyEvent(QX11Info::display(), XKeysymToKeycode(QX11Info::display(),XK_Escape), True, 1); - XTestFakeKeyEvent(QX11Info::display(), XKeysymToKeycode(QX11Info::display(),XK_Escape), False, 1); - XFlush(QX11Info::display()); - sleep(1); - if(!establishGrab()) - { - exit(1); + if(QX11Info::isPlatformX11()){ + if(establishGrab()) + qDebug()<<"establishGrab : true"; + else { + qDebug()<<"establishGrab : false"; + /*检测当前是否存在弹出菜单,只有存在弹出菜单时,才模拟按键esc*/ + if(checkHasPopupMenu()){ + XTestFakeKeyEvent(QX11Info::display(), XKeysymToKeycode(QX11Info::display(),XK_Escape), True, 1); + XTestFakeKeyEvent(QX11Info::display(), XKeysymToKeycode(QX11Info::display(),XK_Escape), False, 1); + XFlush(QX11Info::display()); + sleep(1); + } + HideMultiview(); + if(!establishGrab()) + { + exit(1); + } } + + XWindowAttributes rootAttr; + XGetWindowAttributes(QX11Info::display(), QX11Info::appRootWindow(), &rootAttr); + XSelectInput( QX11Info::display(), QX11Info::appRootWindow(), + SubstructureNotifyMask|rootAttr.your_event_mask ); + } qDebug()<<"----------------------------------------------------------------开始异步调用"; @@ -631,7 +660,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()){ @@ -639,17 +668,16 @@ void FullBackgroundWidget::init() } }); - setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint + if(QX11Info::isPlatformX11()){ + setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint); + }else{ + setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint); + } /*x100下会出现黑色小方块问题,设置此属性时正常*/ setAttribute(Qt::WA_TranslucentBackground); - XWindowAttributes rootAttr; - XGetWindowAttributes(QX11Info::display(), QX11Info::appRootWindow(), &rootAttr); - XSelectInput( QX11Info::display(), QX11Info::appRootWindow(), - SubstructureNotifyMask|rootAttr.your_event_mask ); - // 监听session信号 // smInterface = new QDBusInterface(SM_DBUS_SERVICE, // SM_DBUS_PATH, @@ -657,10 +685,6 @@ void FullBackgroundWidget::init() // QDBusConnection::sessionBus()); // connect(smInterface, SIGNAL(StatusChanged(uint)), // this, SLOT(onSessionStatusChanged(uint))); -// connect(xEventMonitor, SIGNAL(buttonDrag(int, int)), -// this, SLOT(onGlobalButtonDrag(int, int))); -// connect(xEventMonitor, SIGNAL(buttonPress(int, int)), -// this, SLOT(onGlobalButtonPressed(int, int))); // int totalWidth = 0; // int totalHeight = 0; @@ -672,9 +696,7 @@ void FullBackgroundWidget::init() // setGeometry(0, 0, totalWidth, totalHeight); QDesktopWidget *desktop = QApplication::desktop(); setGeometry(desktop->geometry()); - -// xEventMonitor->start(); - + #ifdef USE_INTEL SoundDeviceSet::instance(); #endif @@ -686,26 +708,30 @@ 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()); - break; - } -#else - if(screen->geometry().contains(pos)) - { - if(lockWidget->geometry() == screen->geometry()) - return ; - /*避免切换时闪烁*/ - qDebug()<geometry()<geometry(); + qInfo()<<"LockWidget:"<geometry()<geometry(); lockWidget->hide(); lockWidget->setGeometry(screen->geometry()); lockWidget->show(); + chkInOneScreen = true; break; } -#endif + } + if (!chkInOneScreen) { + for(auto screen : QGuiApplication::screens()) { + if(!screen){ + /*避免切换时闪烁*/ + qInfo()<<"LockWidget:"<geometry()<geometry()<<","<hide(); + lockWidget->setGeometry(screen->geometry()); + lockWidget->show(); + chkInOneScreen = true; + break; + } + } } } @@ -761,7 +787,9 @@ void FullBackgroundWidget::showLockWidget() } onCursorMoved(QCursor::pos()); lockWidget->setFocus(); - XSetInputFocus(QX11Info::display(),this->winId(),RevertToParent,CurrentTime); + if(QX11Info::isPlatformX11() ){ + XSetInputFocus(QX11Info::display(),this->winId(),RevertToParent,CurrentTime); + } activateWindow(); repaint(); } @@ -931,39 +959,60 @@ void FullBackgroundWidget::onLockScreenTimeout() m_timerLock->stop(); } -void FullBackgroundWidget::onBlankScreensaver() +void FullBackgroundWidget::onBlankScreensaver(int nDelay/* = 0*/, bool hasLock/* = true*/) { - showLockWidget(); - screenStatus = (ScreenStatus)(screenStatus | SCREEN_SAVER | SCREEN_LOCK); - qDebug() << "showScreensaver - screenStatus: " << screenStatus; + if (hasLock) { + showLockWidget(); + screenStatus = (ScreenStatus)(screenStatus | SCREEN_SAVER | SCREEN_LOCK); + } else { + screenStatus = (ScreenStatus)(screenStatus | SCREEN_SAVER); + } + qDebug() << "showScreensaver - screenStatus: " << screenStatus << nDelay; - for(auto screen : QGuiApplication::screens()) - { - ScreenSaver *saver = configuration->getScreensaver(); - saver->mode = SaverMode(SAVER_BLANK_ONLY); - ScreenSaverWidget *saverWidget = new ScreenSaverWidget(saver, this); - widgetXScreensaverList.push_back(saverWidget); - saverWidget->setGeometry(screen->geometry()); - } - setCursor(Qt::BlankCursor); - isBlank = true; + for(auto screen : QGuiApplication::screens()) + { + ScreenSaver *saver = configuration->getScreensaver(); + saver->mode = SaverMode(SAVER_BLANK_ONLY); + ScreenSaverWidget *saverWidget = new ScreenSaverWidget(saver, this); + widgetXScreensaverList.push_back(saverWidget); + saverWidget->setGeometry(screen->geometry()); + } + setCursor(Qt::BlankCursor); + isBlank = true; - /*在进行压力测试时,可能会出现锁屏界面启动极慢,导致在睡眠之前调用了锁屏,但 - * 锁屏没来得及绑定睡眠唤醒信号,导致唤醒后,锁屏界面没有收到信号从而一直显示黑屏的问题。 - * 因此这里在进入黑色屏保时,通过后台接口,获取一次当前是否应该显示黑色屏保状态*/ - QDBusInterface *interface = new QDBusInterface(SS_DBUS_SERVICE, - SS_DBUS_PATH, - SS_DBUS_INTERFACE); + if (0 == nDelay) { + /*在进行压力测试时,可能会出现锁屏界面启动极慢,导致在睡眠之前调用了锁屏,但 + * 锁屏没来得及绑定睡眠唤醒信号,导致唤醒后,锁屏界面没有收到信号从而一直显示黑屏的问题。 + * 因此这里在进入黑色屏保时,通过后台接口,获取一次当前是否应该显示黑色屏保状态*/ + QString displayNum = QString(qgetenv("DISPLAY")).replace(":", "").replace(".", "_"); + QString sessionDbus = QString("%1%2").arg(QString(SS_DBUS_SERVICE)).arg(displayNum); + QDBusInterface *interface = new QDBusInterface(sessionDbus, + SS_DBUS_PATH, + SS_DBUS_INTERFACE); + if (!interface->isValid()) { + delete interface; + interface = new QDBusInterface(SS_DBUS_SERVICE, + SS_DBUS_PATH, + SS_DBUS_INTERFACE); + } - QDBusReply stateReply = interface->call("GetBlankState"); - if(!stateReply.isValid()){ - return ; - } + QDBusReply stateReply = interface->call("GetBlankState"); + if(!stateReply.isValid()){ + return ; + } - if(!stateReply){ - isBlank = false; - clearScreensavers(); - } + if(!stateReply){ + isBlank = false; + clearScreensavers(); + } + } else { + QTimer::singleShot(nDelay, this, [=](){ + if (isBlank) { + isBlank = false; + clearScreensavers(); + } + }); + } } void FullBackgroundWidget::onScreensaver() @@ -1049,8 +1098,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; @@ -1060,9 +1113,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 @@ -1170,6 +1221,8 @@ void FullBackgroundWidget::onDesktopResized() //repaint(); update(); #endif + + PlasmaShellManager::getInstance()->setPos(this->windowHandle(),QPoint(0,0)); } void FullBackgroundWidget::laterInhibit(bool val) @@ -1309,6 +1362,10 @@ QList FullBackgroundWidget::GetSubWndIds() void FullBackgroundWidget::raiseOtherWnd() { //qDebug()<<"raiseOtherWnd----:"<isValid()){ + qWarning()<<"org.ukui.KWin.MultitaskView interface error!"; + return false; + } + return true; +} + +bool FullBackgroundWidget::isMultiviewHidden() +{ + if (initMultiviewDbus()) { + QDBusReply reply = m_dbusIfMultiview->call("isHidden"); + if(!reply.isValid()) { + qWarning() << "isHidden error:" << reply.error(); + return true; + } + return reply.value(); + } + return true; +} + +void FullBackgroundWidget::HideMultiview() +{ + if (initMultiviewDbus()) { + QDBusMessage result = m_dbusIfMultiview->call("hide"); + if(result.type() == QDBusMessage::ErrorMessage) { + qWarning() << "HideMultiview error:" << result.errorMessage(); + } + } +} + +void FullBackgroundWidget::ShowMultiview() +{ + if (initMultiviewDbus()) { + QDBusMessage result = m_dbusIfMultiview->call("show"); + if(result.type() == QDBusMessage::ErrorMessage) { + qWarning() << "HideMultiview error:" << result.errorMessage(); + } + } +} diff --git a/src/fullbackgroundwidget.h b/src/fullbackgroundwidget.h index 193e94e..92f1e06 100644 --- a/src/fullbackgroundwidget.h +++ b/src/fullbackgroundwidget.h @@ -52,7 +52,7 @@ public: void mouseMoveEvent(QMouseEvent *e); void mousePressEvent(QMouseEvent *e); void onScreensaver(); - void onBlankScreensaver(); + void onBlankScreensaver(int nDelay = 0, bool hasLock = true); void closeScreensaver(); void setIsStartup(bool val); @@ -91,6 +91,10 @@ private: bool isOtherWnd(int wndId); void delayLockScreen(); void stopDelayLockScreen(); + bool initMultiviewDbus(); + bool isMultiviewHidden(); + void HideMultiview(); + void ShowMultiview(); private Q_SLOTS: void onScreenCountChanged(int); @@ -139,6 +143,9 @@ private: QList m_listWndIds; QTimer *m_timerLock = nullptr; bool m_isAlreadyShowSaver = false; + + // 多任务视图接口 + QDBusInterface *m_dbusIfMultiview = nullptr; }; #endif // FULLBACKGROUNDWIDGET_H diff --git a/src/grab-x11.cpp b/src/grab-x11.cpp index 03806d2..9182cab 100644 --- a/src/grab-x11.cpp +++ b/src/grab-x11.cpp @@ -17,8 +17,19 @@ **/ #include "grab-x11.h" #include +#include +#include +#include #include #include +#include +#include +#include +#include +#include +#include + +#define MAX_PROPERTY_VALUE_LEN 4096 class XServerGraber{ public: @@ -59,8 +70,8 @@ bool establishGrab() if(!grabKeyboard()) return false; - -/*抓取鼠标会导致触摸无效,因此这里先注释掉*/ + +/*抓取鼠标会导致触摸无效,这里暂时取消掉*/ /* if(!grabMouse()) { XUngrabKeyboard(QX11Info::display(), CurrentTime); @@ -79,7 +90,159 @@ bool closeGrab() Q_UNUSED(xserverGraber); XUngrabKeyboard(QX11Info::display(), CurrentTime); - // XUngrabPointer(QX11Info::display(), CurrentTime); +// XUngrabPointer(QX11Info::display(), CurrentTime); XFlush(QX11Info::display()); return true; } + +static Bool +Window_Has_Property(Display * dpy, Window win, Atom atom) +{ + Atom type_ret; + int format_ret; + unsigned char *prop_ret; + unsigned long bytes_after, num_ret; + + type_ret = None; + prop_ret = NULL; + XGetWindowProperty(dpy, win, atom, 0, 0, False, AnyPropertyType, + &type_ret, &format_ret, &num_ret, + &bytes_after, &prop_ret); + if (prop_ret) + XFree(prop_ret); + + return (type_ret != None) ? True : False; +} + +int getWindowByPid(Window win){ + int ret = -1; + + Atom xa_ret_type; + int ret_format; + unsigned long ret_nitems; + unsigned long ret_bytes_after; + unsigned long tmp_size; + unsigned char *ret_prop; + int id = 0; + + + Atom xa_prop_name = XInternAtom(QX11Info::display(), "_NET_WM_PID", False); // 取对应字串的AtomID + + if (XGetWindowProperty(QX11Info::display(), win, xa_prop_name, 0, // 获取窗口属性 + MAX_PROPERTY_VALUE_LEN / 4, + False, XA_CARDINAL, &xa_ret_type, // XA_CARDINAL为数值类型 + &ret_format, &ret_nitems, &ret_bytes_after, + &ret_prop) != Success) // 后五个参数是返回值 + { + printf("Cannot get %s property.\n", "_NET_WM_PID"); + return -1; + } + else + { + if(ret_prop) + memcpy(&id, ret_prop, 4);// 类型传换 + qDebug()<<"window pid: "< diff --git a/src/hoverwidget.h b/src/hoverwidget.h index bcb811e..1fcf667 100644 --- a/src/hoverwidget.h +++ b/src/hoverwidget.h @@ -1,11 +1,10 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * +/* * Copyright (C) 2019 Tianjin KYLIN Information Technology 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 2 of the License, or - * (at your option) any later version. + * the Free Software Foundation; either version 3, 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 @@ -13,10 +12,9 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + * along with this program; if not, see . * - */ +**/ #ifndef HOVERWIDGET_H #define HOVERWIDGET_H diff --git a/src/iconedit.cpp b/src/iconedit.cpp index c708076..3e573fd 100644 --- a/src/iconedit.cpp +++ b/src/iconedit.cpp @@ -1,9 +1,9 @@ -/* iconedit.cpp +/* * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, @@ -12,12 +12,12 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. + * along with this program; if not, see . + * **/ #include "iconedit.h" #include "imageutil.h" +#include "configuration.h" #include #include #include @@ -26,10 +26,12 @@ #include #include #include +#include #include #include #include +#define DRM_DIR "/sys/class/leds/" #define GSETTINGS_SCHEMA_PERIPHERALS_KEYBOARD "org.ukui.peripherals-keyboard" #define CAPSLOCK_STATUS "capslock_state" @@ -37,56 +39,97 @@ * @brief 判断大写键状态 * @return true: 大写锁定 */ -//bool checkCapsLockState() -//{ -// bool capsState = false; -// unsigned int n; -// XkbGetIndicatorState(QX11Info::display(), XkbUseCoreKbd, &n); -// capsState = (n & 0x01) == 1; +bool checkCapsLockState() +{ + QDir ledDir(DRM_DIR); + QStringList leds = ledDir.entryList(QDir::Dirs); + QString capsFile; -// return capsState; -//} + for(int i = 0;igetFontSize(); + m_ptToPx = configuration->getPtToPx(); m_edit = new QLineEdit(this); m_edit->setObjectName(QStringLiteral("passwdEdit")); m_edit->setAttribute(Qt::WA_InputMethodEnabled, false); //禁用输入法 m_edit->setContextMenuPolicy(Qt::NoContextMenu); //禁用右键菜单 m_edit->installEventFilter(this); + QFont sysFont; + sysFont.setPointSize((16 + curFontSize) *m_ptToPx); + m_edit->setFont(sysFont); m_capsIcon = new QSvgWidget(this); m_capsIcon->setObjectName(QStringLiteral("capsIconLabel")); - settings = new QGSettings(GSETTINGS_SCHEMA_PERIPHERALS_KEYBOARD, "", this); - connect(settings, &QGSettings::changed, + + if (QString(qgetenv("XDG_SESSION_TYPE")) == "wayland"){ + capsState = checkCapsLockState(); + }else{ + settings = new QGSettings(GSETTINGS_SCHEMA_PERIPHERALS_KEYBOARD, "", this); + connect(settings, &QGSettings::changed, this, &IconEdit::onCapsChanged); - capsState = settings->get("capslock-state").toBool(); + capsState = settings->get("capslock-state").toBool(); + } + m_capsIcon->setVisible(capsState); 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); m_iconButton->setFocusPolicy(Qt::FocusPolicy::NoFocus); + m_iconButton->setStyleSheet("border-radius:12px; border:2px solid #3D6BE5;"); - m_modeButton = new QPushButton(this); + m_modeButton = new ModeButton(this); m_modeButton->setObjectName(QStringLiteral("echoModeButton")); - m_modeButton->setCheckable(true); m_modeButton->setIcon(QIcon::fromTheme("ukui-eye-display-symbolic")); m_modeButton->setFocusPolicy(Qt::FocusPolicy::NoFocus); m_modeButton->setCursor(Qt::PointingHandCursor); m_modeButton->installEventFilter(this); - connect(m_modeButton, &QPushButton::clicked, this, [&](bool checked){ - setType(checked ? QLineEdit::Normal : QLineEdit::Password); + m_modeButton->setFixedSize(24, 14); + m_modeButton->setIconSize(QSize(16, 16)); + m_modeButton->setFlat(true); + connect(m_modeButton, &QPushButton::clicked, this, [=](){ + if (m_edit->echoMode() == QLineEdit::Password) { + setType(QLineEdit::Normal); + } else { + setType(QLineEdit::Password); + } }); QHBoxLayout *layout = new QHBoxLayout(this); layout->setContentsMargins(1, 1, 8, 1); - layout->setSpacing(0); + layout->setSpacing(2); layout->addStretch(); layout->addWidget(m_capsIcon); layout->addWidget(m_modeButton); @@ -119,11 +162,21 @@ bool IconEdit::eventFilter(QObject *obj, QEvent *event) } if(event->type() == 23) { - //XSetInputFocus(QX11Info::display(),this->winId(),RevertToParent,CurrentTime); + if(QX11Info::isPlatformX11()){ + //XSetInputFocus(QX11Info::display(),this->winId(),RevertToParent,CurrentTime); + } update(); }else if(event->type() == QEvent::MouseButtonPress){ - //XSetInputFocus(QX11Info::display(),this->winId(),RevertToParent,CurrentTime); + if(QX11Info::isPlatformX11()){ + //XSetInputFocus(QX11Info::display(),this->winId(),RevertToParent,CurrentTime); + } update(); + } else if(event->type() == QEvent::MouseButtonRelease) { //禁用鼠标中键 + QMouseEvent *mouseevent = static_cast(event); + if(mouseevent->button() == Qt::MidButton){ + event->ignore(); + return true; + } } } if(obj == m_iconButton){ @@ -150,29 +203,33 @@ bool IconEdit::eventFilter(QObject *obj, QEvent *event) void IconEdit::setType(QLineEdit::EchoMode type) { m_edit->setEchoMode(type); - if(type == 0){ - m_modeButton->setChecked(true); + if (type == 0) { m_modeButton->setIcon(QIcon::fromTheme("ukui-eye-display-symbolic")); - } - else{ - m_modeButton->setChecked(false); + } else { m_modeButton->setIcon(QIcon::fromTheme("ukui-eye-hidden-symbolic")); } } +void IconEdit::setModeBtnVisible(bool visible) +{ + m_modeButton->setVisible(visible); +} + void IconEdit::resizeEvent(QResizeEvent *) { // 设置输入框中文件输入区,不让输入的文字在被隐藏在按钮下 int w = m_iconButton->width() + m_modeButton->width(); - m_edit->setTextMargins(1, 1, capsState ? w + m_capsIcon->width() + 8 : w, 1); + m_edit->setTextMargins(1, 1, capsState ? w + m_capsIcon->width() + 10 : w + 6, 1); m_edit->setFixedSize(size()); } void IconEdit::setX11Focus() { - //XSetInputFocus(QX11Info::display(),this->winId(),RevertToParent,CurrentTime); - update(); + if(QX11Info::isPlatformX11()){ + //XSetInputFocus(QX11Info::display(),this->winId(),RevertToParent,CurrentTime); + } + update(); } void IconEdit::setFocusin(int target) @@ -180,17 +237,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; } @@ -204,17 +259,23 @@ void IconEdit::clicked_cb() void IconEdit::onCapsChanged() { - capsState = settings->get("capslock-state").toBool(); + if(settings){ + capsState = settings->get("capslock-state").toBool(); + }else{ + capsState = checkCapsLockState(); + } m_capsIcon->setVisible(capsState); int w = m_iconButton->width() + m_modeButton->width(); - m_edit->setTextMargins(1, 1, capsState ? w + m_capsIcon->width() + 8 : w, 1); + m_edit->setTextMargins(1, 1, capsState ? w + m_capsIcon->width() + 10 : w + 6, 1); } -//void IconEdit::onCapsStateChanged() -//{ -// bool capsState = m_capsIcon->isHidden(); - -//} +void IconEdit::onCapsStateChanged() +{ + capsState = checkCapsLockState(); + m_capsIcon->setVisible(capsState); + int w = m_iconButton->width() + m_modeButton->width(); + m_edit->setTextMargins(1, 1, capsState ? w + m_capsIcon->width() + 10 : w + 6, 1); +} void IconEdit::setIcon(const QString &text) { diff --git a/src/iconedit.h b/src/iconedit.h index 729197d..f067a3e 100644 --- a/src/iconedit.h +++ b/src/iconedit.h @@ -1,9 +1,9 @@ -/* iconedit.h +/* * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, @@ -12,9 +12,8 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. + * along with this program; if not, see . + * **/ #ifndef ICONEDIT_H @@ -27,6 +26,9 @@ #include #include #include +#include "modebutton.h" + +class Configuration; class IconEdit : public QWidget { @@ -47,6 +49,7 @@ public: void setFocusin(int target); void readOnly(bool enabled); void setLocked(bool lock); + void setModeBtnVisible(bool visible); //void setEnabled(bool enabled); protected: @@ -63,19 +66,22 @@ Q_SIGNALS: public Q_SLOTS: void clicked_cb(); void onCapsChanged(); -// void onCapsStateChanged(); + void onCapsStateChanged(); private: QLineEdit *m_edit; QSvgWidget *m_capsIcon; QPushButton *m_iconButton; - QPushButton *m_modeButton; + ModeButton *m_modeButton; QTimer *m_timer; QPixmap m_waitingPixmap; QString m_iconText; //文字作为图标 QIcon m_icon; - QGSettings *settings; - bool capsState = false; + QGSettings *settings; + bool capsState = false; + Configuration *configuration; + double curFontSize = 0; + double m_ptToPx = 1.0; }; #endif // ICONEDIT_H diff --git a/src/imageutil.cpp b/src/imageutil.cpp index 928d63f..11fe92f 100644 --- a/src/imageutil.cpp +++ b/src/imageutil.cpp @@ -1,11 +1,10 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * +/* * Copyright (C) 2019 Tianjin KYLIN Information Technology 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 2 of the License, or - * (at your option) any later version. + * the Free Software Foundation; either version 3, 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 @@ -13,10 +12,9 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + * along with this program; if not, see . * - */ +**/ #include "imageutil.h" diff --git a/src/imageutil.h b/src/imageutil.h index 92c09d8..ae40c46 100644 --- a/src/imageutil.h +++ b/src/imageutil.h @@ -1,11 +1,10 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * +/* * Copyright (C) 2019 Tianjin KYLIN Information Technology 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 2 of the License, or - * (at your option) any later version. + * the Free Software Foundation; either version 3, 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 @@ -13,10 +12,9 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + * along with this program; if not, see . * - */ +**/ #ifndef IMAGEUTIL_H #define IMAGEUTIL_H diff --git a/src/interface.cpp b/src/interface.cpp index c16a672..d188ebf 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -54,6 +54,10 @@ Interface::Interface(QObject *parent) connect(&process, static_cast(&QProcess::finished), [=](int exitCode, QProcess::ExitStatus exitStatus){ + qInfo()<<"ukui-screensaver-dialog is exited,exitCode is "<isLidCloseWithBlank()) { m_nStatus &= ~SESSION_STATUS_SCREENCLOSE; } + stopDelayLockScreen(); } } @@ -442,8 +466,8 @@ bool Interface::checkStatus(int nStatus) return false; } if (((m_sessionWatcher->idledelay()*60 == m_sessionWatcher->closeActivationDelay()) - && m_sessionWatcher->closeActivationDelay() != -1) && !m_sessionWatcher->isCloseActivationEnable()) { - qDebug()<<"Close same with idle and Close disable!"; + && m_sessionWatcher->closeActivationDelay() != -1)/* && !m_sessionWatcher->isCloseActivationEnable()*/) { + qDebug()<<"Close same with idle do nothing!"; return false; } } @@ -453,3 +477,84 @@ bool Interface::checkStatus(int nStatus) } return true; } + +bool Interface::LockByBlank(int nType) // 0:idle delay close;1:lid close;2:lowpower close +{ + qDebug()<<"LockByBlank:"<closeActivationDelay(); + int nIdleDelay = m_sessionWatcher->idledelay(); + bool isCloseActive = m_sessionWatcher->isCloseActivationEnable(); + qDebug()<<"DelayState:"<isLockEnable()) { // 仅启动屏保 + isNeedLock = false; + } + } else { + return false; + } + } else { + qDebug()<<"Don't need blank lock:"<locktimeout() != -1 && isNeedLock) { + delayLockScreen(); + return false; + } else { + QString cmd = QString("/usr/bin/ukui-screensaver-dialog --blank --delay %1 --has-lock %2").arg(2000).arg(isNeedLock?1:0); + qDebug() << cmd; + process.start(cmd); + emitLockState(true); + } + return true; + } +} + +void Interface::delayLockScreen() +{ + if (!m_timerLock) { + m_timerLock = new QTimer(this); + connect(m_timerLock, &QTimer::timeout, this, &Interface::onLockScreenTimeout); + } + qDebug()<<"LockTimeout:"<locktimeout(); + if (m_sessionWatcher->locktimeout() != -1) { + stopDelayLockScreen(); + m_timerLock->start(m_sessionWatcher->locktimeout()*1000); + } +} + +void Interface::stopDelayLockScreen() +{ + if (m_timerLock && m_timerLock->isActive()) { + m_timerLock->stop(); + } +} + +void Interface::onLockScreenTimeout() +{ + Lock(); + m_timerLock->stop(); +} diff --git a/src/interface.h b/src/interface.h index 97e9b44..8b228ae 100644 --- a/src/interface.h +++ b/src/interface.h @@ -62,13 +62,27 @@ public Q_SLOTS: void onSessionIdleExit(); void onScreenClosed(bool state); void onLidStateChaned(bool isClosed); - bool GetBlankState(); + bool GetBlankState(); + bool LockByBlank(int nType); + private: bool checkExistChild(); void inhibit(); void uninhibit(); void emitLockState(bool); bool checkStatus(int nStatus); + /** + * @brief delayLockScreen 延迟锁屏 + */ + void delayLockScreen(); + /** + * @brief stopDelayLockScreen 停止延迟锁屏 + */ + void stopDelayLockScreen(); + /** + * @brief onLockScreenTimeout 延迟锁屏处理过程 + */ + void onLockScreenTimeout(); private: bool lockState; @@ -79,6 +93,8 @@ private: QDBusUnixFileDescriptor m_inhibitFileDescriptor; int m_nStatus = 0; // 当前状态 bool blankState = false; + bool m_isNewBlankInterface = false; + QTimer *m_timerLock = nullptr; private: QProcess process; }; diff --git a/src/klabel.cpp b/src/klabel.cpp new file mode 100644 index 0000000..ad19dd3 --- /dev/null +++ b/src/klabel.cpp @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 . + * +**/ +#include "klabel.h" +#include "configuration.h" +#include "commonfunc.h" +#include +#include +#include + +KLabel::KLabel(QWidget *parent) + : QLabel(parent), + configuration(Configuration::instance()) +{ + curFontSize = configuration->getFontSize(); + m_ptToPx = configuration->getPtToPx(); + this->setStyleSheet("QLabel{color: white;}" + "QToolTip{border-radius:4px; background-color:#FFFFFF; color:black;}"); +} + +void KLabel::setFontSize(int fontSize) +{ + sysFont.setPointSize((fontSize +curFontSize) *m_ptToPx); + this->setFont(sysFont); + QToolTip::setFont(sysFont); +} + +void KLabel::setElideText(const QString text, int width, int size) +{ + sysFont.setPointSize((size + curFontSize) *m_ptToPx); + QString str = ElideText(sysFont,width,text); + if(text != str) + this->setToolTip(text); + if(text == str) + this->setToolTip(""); + this->setText(str); +} diff --git a/src/klabel.h b/src/klabel.h new file mode 100644 index 0000000..c96b00b --- /dev/null +++ b/src/klabel.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 KLABEL_H +#define KLABEL_H + +#include + +class Configuration; + +class KLabel : public QLabel +{ + Q_OBJECT +public: + KLabel(QWidget *parent = nullptr); + void setFontSize(int fontSize); + void setElideText(const QString text, int width, int size = 16); + +private: + Configuration *configuration; + double curFontSize; + double m_ptToPx = 1.0; + QFont sysFont; +}; + +#endif // KLABEL_H diff --git a/src/libinputswitchevent.cpp b/src/libinputswitchevent.cpp new file mode 100644 index 0000000..de3886f --- /dev/null +++ b/src/libinputswitchevent.cpp @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 . + * +**/ + +#include "libinputswitchevent.h" + +typedef std::function sendEvent; +LibinputSwitchEvent::LibinputSwitchEvent(QObject *parent) + : QObject(parent) + , m_machineModel(MachineModel::getMachineModelInstance()) +{ + m_machineType = m_machineModel->getTheMachineType(); + 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() +{ + //其他处理 + if (m_machineType == QStringLiteral("SLATE")) { + return true; + }else if (m_machineType == "LAPTOP" ) {//永久附加键盘笔记本 + //return true; + }else if (m_machineType == "ALLINONE") {//台式 + return false; + }else { + //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..95ecbe3 --- /dev/null +++ b/src/libinputswitchevent.h @@ -0,0 +1,45 @@ +/* + * 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 +#include "machinemodel.h" +//头文件以及顺序不可改,不可删 +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); + +private: + QString m_machineType; + std::shared_ptr m_machineModel = nullptr; +}; + +#endif // LIBINPUTSWITCHEVENT_H diff --git a/src/lockchecker.cpp b/src/lockchecker.cpp index 7cc44e3..c0533cf 100644 --- a/src/lockchecker.cpp +++ b/src/lockchecker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) Copyright 2021 KylinSoft Co., Ltd. + * Copyright (C) 2021 Tianjin KYLIN Information Technology 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 diff --git a/src/lockwidget.cpp b/src/lockwidget.cpp index 264468f..daef32c 100644 --- a/src/lockwidget.cpp +++ b/src/lockwidget.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -33,12 +34,11 @@ #include #include #include -#include #include -#include #include #include "authdialog.h" -#include "virtualkeyboard.h" +#include "virtualkeyboardwidget.h" +#include "configuration.h" #include "users.h" #include "displaymanager.h" #include "config.h" @@ -46,16 +46,23 @@ #include "hoverwidget.h" #include "kylinnm.h" #include "mytabwidget.h" +#include "klabel.h" +#include "rootWindowBackground.h" +#include "configuration.h" #include #include #include +#define GSETTINGS_SCHEMA_MATE_BG "org.mate.background" +#define KEY_PICTURE_FILENAME "pictureFilename" +#define KEY_PICTURE_OPTIONS "pictureOptions" +#define KEY_PRIMARY_COLOR "primaryColor" #define TIME_TYPE_SCHEMA "org.ukui.control-center.panel.plugins" #define CONFIG_FILE "/etc/lightdm/ukui-greeter.conf" #define ON_TAB_SHEET "QPushButton{background-color: rgba(255,255,255,15%); border-radius: 4px; border: 2px solid #2C73C8;}" -#define ON_NORMAL_SHEET "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%);} \ +#define ON_NORMAL_SHEET "QPushButton{text-align:center;color: rgba(255, 255, 255, 255);border: none;border-radius: 4px;outline: none;} \ + QPushButton::hover{background-color: rgba(255,255,255,15%);} \ QPushButton::pressed {background-color: rgba(255,255,255,40%);}\ QPushButton::checked {background-color: rgba(255, 255, 255, 40%);}" float scale; @@ -64,6 +71,7 @@ LockWidget::LockWidget(QWidget *parent) ui(new Ui::LockWidget), usersMenu(nullptr), scrollArea(nullptr), + configuration(Configuration::instance()), users(new Users(this)), displayManager(new DisplayManager(this)), timeType(24), @@ -80,18 +88,20 @@ LockWidget::LockWidget(QWidget *parent) authDialog = new AuthDialog(user, this); authDialog->installEventFilter(this); connect(authDialog, &AuthDialog::authenticateCompete, - this, &LockWidget::closed); + this, &LockWidget::onAuthenticateCompete); connect(authDialog,&AuthDialog::clickPassword, this,&LockWidget::onClickPassword); connect(authDialog,&AuthDialog::loginOptionClicked, this,&LockWidget::resetNavigation); + connect(authDialog,&AuthDialog::showMessageBtn, + this,&LockWidget::onShowMessageBtn); // connect(this, &LockWidget::capsLockChanged, // authDialog, &AuthDialog::onCapsLockChanged); // connect(m_kylinNM, &KylinNM::onConnectChanged, this,[=](){ // updateNetIcon(m_kylinNM->getConnectStatus()); // }); - + curFontSize = configuration->getFontSize(); this->installEventFilter(this); initUI(); @@ -99,12 +109,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() @@ -126,8 +139,26 @@ bool LockWidget::eventFilter(QObject *obj, QEvent *event) if(obj == mkylinNM) return true; - if(obj == ui->btnPowerManager || obj == ui->btnSwitchUser || obj == btnNetworkManager || obj == ui->btnBatteryStatus) + if(vKeyboard && obj == vKeyboard) + return true; + + if (vKeyboard && obj != vKeyboard && obj != ui->btnKeyboard && obj != btnNetworkManager && obj != ui->btnPowerManager && vKeyboard->isVisible()) { + hideBottomPlugins(); + } + + 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); @@ -150,22 +181,7 @@ bool LockWidget::eventFilter(QObject *obj, QEvent *event) } if(powermanager && powermanager->isVisible()){ - authDialog->show(); - powermanager->hide(); - tabAt = LINEEDIT; - setBottomBtnSheet(); - authDialog->setFocusin(IN_LINEEDIT); - powermanager->clearStatus(); - at_power = false; - } - - if(tabAt != LINEEDIT) { - authDialog->setFocusin(REMOVE); - if(tabAt == BOTTMBTN) { - tabAt = LINEEDIT; - setBottomBtnSheet(); - tabAt = BOTTMBTN; - } + showPowerManager(); } } @@ -203,6 +219,11 @@ void LockWidget::setStartupMode(bool mode) if (powermanager) { powermanager->setStartupMode(m_isStartupMode); } + if (m_isStartupMode) { + m_futureLoadDeskBg = QtConcurrent::run([=](){ + setRootWindow(); + }); + } } void LockWidget::key_enter_release(int key) @@ -277,29 +298,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(); @@ -310,12 +342,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); @@ -364,6 +400,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; @@ -375,13 +425,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; @@ -426,7 +482,11 @@ void LockWidget::key_LR_release(int key) horAT = NETWORKBTN; break; case NETWORKBTN: - horAT = KEYBOARDBTN; + if (ui->btnKeyboard->isHidden()) { + horAT = POWERBTN; + } else { + horAT = KEYBOARDBTN; + } break; case KEYBOARDBTN: horAT = POWERBTN; @@ -474,7 +534,11 @@ void LockWidget::key_LR_release(int key) horAT = NETWORKBTN; break; case POWERBTN: - horAT = KEYBOARDBTN; + if (ui->btnKeyboard->isHidden()) { + horAT = NETWORKBTN; + } else { + horAT = KEYBOARDBTN; + } break; default: break; @@ -598,6 +662,9 @@ void LockWidget::startAuth() if(authDialog) { authDialog->startAuth(); + if (isTableMode && !(vKeyboard && vKeyboard->isVisible())) { + showVirtualKeyboard(); + } } } @@ -640,9 +707,9 @@ void LockWidget::initUI() ui->lblTime->setText(QDateTime::currentDateTime().toString("hh:mm")); if(dateType == "cn") - ui->lblDate->setText(QDate::currentDate().toString("yyyy/MM/dd ddd")); + ui->lblDate->setText(QDate::currentDate().toString("yyyy/MM/dd ddd").replace("周","星期")); else - ui->lblDate->setText(QDate::currentDate().toString("yyyy-MM-dd ddd")); + ui->lblDate->setText(QDate::currentDate().toString("yyyy-MM-dd ddd").replace("周","星期")); }); if(timeType == 12) @@ -650,7 +717,7 @@ void LockWidget::initUI() else ui->lblTime->setText(QDateTime::currentDateTime().toString("hh:mm")); - ui->lblTime->setStyleSheet("QLabel{color:white; font-size: 36px;}"); + ui->lblTime->setFontSize(36); ui->lblTime->setAlignment(Qt::AlignCenter); ui->lblTime->adjustSize(); timer->start(1000); @@ -659,11 +726,11 @@ void LockWidget::initUI() // qDebug() << "current date: " << date; // ui->lblDate->setText(date); if(dateType == "cn") - ui->lblDate->setText(QDate::currentDate().toString("yyyy/MM/dd ddd")); + ui->lblDate->setText(QDate::currentDate().toString("yyyy/MM/dd ddd").replace("周","星期")); else - ui->lblDate->setText(QDate::currentDate().toString("yyyy-MM-dd ddd")); + ui->lblDate->setText(QDate::currentDate().toString("yyyy-MM-dd ddd").replace("周","星期")); - ui->lblDate->setStyleSheet("QLabel{color:white; font-size: 18px;}"); + ui->lblDate->setFontSize(18); ui->lblDate->setAlignment(Qt::AlignCenter); ui->lblDate->adjustSize(); ui->widgetTime->adjustSize(); @@ -699,6 +766,8 @@ void LockWidget::initUI() 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 @@ -717,7 +786,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); @@ -732,8 +801,8 @@ void LockWidget::initUI() // }); 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%);} \ + btnNetworkManager->setStyleSheet("QPushButton{text-align:center;color: rgba(255, 255, 255, 255);border: none;border-radius: 4px;outline: none;} \ + QPushButton::hover{background-color: rgba(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); @@ -751,18 +820,12 @@ void LockWidget::initUI() this->setCursor(Qt::ArrowCursor); }); - //虚拟键盘 ui->btnKeyboard->setIcon(QIcon(":/image/assets/keyboard.svg")); ui->btnKeyboard->setFixedSize(48, 48); ui->btnKeyboard->setIconSize(QSize(24, 24)); ui->btnKeyboard->setFocusPolicy(Qt::NoFocus); ui->btnKeyboard->installEventFilter(this); -/* connect(ui->btnKeyboard, &QPushButton::clicked, - this, [&]{ - qDebug() << vKeyboard->isHidden(); - vKeyboard->setVisible(vKeyboard->isHidden()); - }); -*/ + connect(ui->btnKeyboard, &QPushButton::clicked, this, &LockWidget::showVirtualKeyboard); @@ -770,7 +833,7 @@ void LockWidget::initUI() 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); @@ -780,7 +843,38 @@ 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; + qInfo()<<"TableMode:"<isVisible())) { +// QTimer::singleShot(1000, this, [=]{ +// if (this->isTableMode) { +// showVirtualKeyboard(); +// QTimer::singleShot(500, this, [&, this](){ +// authDialog->setFocusin(IN_LINEEDIT); +// }); +// } +// }); + } else if (!isTableMode && (tabAt == BOTTMBTN && horAT == KEYBOARDBTN) && (vKeyboard && vKeyboard->isVisible())) { + QTimer::singleShot(100, this, [=]{ + if (!this->isTableMode) { + hideBottomPlugins(); + } + }); + } + }); +} +void LockWidget::netInPutStatus() +{ + if(isTableMode && !(vKeyboard && vKeyboard->isVisible())) + showVirtualKeyboard(); } void LockWidget::showVirtualKeyboard() @@ -790,21 +884,52 @@ void LockWidget::showVirtualKeyboard() tabAt = BOTTMBTN; horAT = KEYBOARDBTN; if(!vKeyboard){ - vKeyboard = new VirtualKeyboard(this); + vKeyboard = new VirtualKeyboardWidget(this); + vKeyboard->installEventFilter(this); vKeyboard->hide(); - connect(vKeyboard, &VirtualKeyboard::aboutToClose, + connect(vKeyboard, &VirtualKeyboardWidget::aboutToClose, this, &LockWidget::hideBottomPlugins); + connect(vKeyboard, &VirtualKeyboardWidget::aboutToFloat, + this, &LockWidget::netResetLocation); } vKeyboard->setVisible(vKeyboard->isHidden()); if(!vKeyboard->isHidden()){ vKeyboard->raise(); - authDialog->setFocusin(IN_LINEEDIT); + //authDialog->setFocusin(IN_LINEEDIT); at_plugins = true; + if(m_kylinNM && m_kylinNM->isVisible() && !vKeyboard->getFloatStatus()) { + 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); + } + vKeyboard->raise(); + //setVirkeyboardPos(); +} + +void LockWidget::netResetLocation() +{ + if (m_kylinNM && m_kylinNM->isVisible()) { + if (vKeyboard->getFloatStatus()) { + m_kylinNM->move(this->width() - m_kylinNM->width() - 20, + this->height() - m_kylinNM->height() - 72 - 8) ; + } else { + m_kylinNM->move(this->width() - m_kylinNM->width() - 20, + this->height() - m_kylinNM->height() - vKeyboard->height()); + } + m_kylinNM->raise(); + } + if (vKeyboard && vKeyboard->isVisible()) { + vKeyboard->raise(); } - setVirkeyboardPos(); } void LockWidget::showUserMenu() @@ -821,10 +946,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()) @@ -867,21 +992,32 @@ void LockWidget::showPowerManager(bool keynavigation) setCheckedSheet(BATTERYBTN, false); if(sureWidget && sureWidget->isVisible()) sureWidget->hide(); - if(vKeyboard && vKeyboard->isVisible()) - vKeyboard->hide(); + if (!at_power && (vKeyboard && vKeyboard->isVisible())) { + m_isShowKeyboard = true; + hideBottomPlugins(); + } else if (!at_power && (vKeyboard && !vKeyboard->isVisible())) { + m_isShowKeyboard = false; + } if(powermanager->isVisible()){ authDialog->show(); powermanager->hide(); - tabAt = LINEEDIT; - setBottomBtnSheet(); - authDialog->setFocusin(IN_LINEEDIT); + if(!authDialog->getLineeditStatus()) { + tabAt = LINEEDIT; + authDialog->setFocusin(IN_LINEEDIT); + if (m_isShowKeyboard && isTableMode && !(vKeyboard && vKeyboard->isVisible())) { + showVirtualKeyboard(); + } + } else { + tabAt = MESSAGEBTN; + authDialog->setFocusin(ON_MESSAGEBTN); + } + //setBottomBtnSheet(); powermanager->clearStatus(); at_power = false; } - else{ + else{ authDialog->hide(); powermanager->show(); - powermanager->setFocus(); if(keynavigation){ powermanager->keyBdRelease(Qt::Key_Right); tabAt = POWERMANAGER; @@ -1039,20 +1175,25 @@ void LockWidget::showNetManager(bool keynavigation) 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(); + if (vKeyboard && vKeyboard->isVisible()) { + vKeyboard->raise(); + } m_kylinNM->setFocus(); /*在150%缩放下,点击网络弹窗左上角有线连接部分,authDialog会收到点击事件导致网络弹窗隐藏, * 这里只调用m_kylinNM->raise()仍会有问题,需要再调用一次authDialog->lower()才行,原因未知*/ if(authDialog && authDialog->isVisible()){ authDialog->lower(); + authDialog->clearFocus(); } - authDialog->clearFocus(); - if(mBatteryWidget && mBatteryWidget->isVisible()) + + if(mBatteryWidget && mBatteryWidget->isVisible()) { mBatteryWidget->lower(); - mBatteryWidget->clearFocus(); + mBatteryWidget->clearFocus(); + } at_plugins = true; //m_kylinNM->updateWifiList(); @@ -1078,10 +1219,21 @@ void LockWidget::onClickPassword() setCheckedSheet(SWITCHBTN, false); at_plugins = false; } + if(isTableMode) { + if(!(vKeyboard && vKeyboard->isVisible())) + showVirtualKeyboard(); + } +// if(vKeyboard && vKeyboard->isVisible()) { +// vKeyboard->hide(); +// at_plugins = false; +// } +} - if(vKeyboard && vKeyboard->isVisible()) { - vKeyboard->hide(); - at_plugins = false; +void LockWidget::onShowMessageBtn(bool is_show) +{ + if(is_show) { + tabAt = MESSAGEBTN; + authDialog->setFocusin(ON_MESSAGEBTN); } } @@ -1108,9 +1260,6 @@ void LockWidget::showBattery() void LockWidget::hideBottomPlugins() { - if(m_kylinNM && m_kylinNM->isVisible()) - setCheckedSheet(NETWORKBTN, false); - if(scrollArea && scrollArea->isVisible()) setCheckedSheet(SWITCHBTN, false); @@ -1118,8 +1267,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(); } @@ -1250,6 +1410,8 @@ void LockWidget::loadNetPlugin() QWidget *widget = pluginInstance->pluginUi(); mkylinNM->addTab(widget,""); + // 平板模式输入状态下自动调出虚拟键盘 + connect(pluginInstance, SIGNAL(needShowVirtualKeyboard()), this, SLOT(netInPutStatus())); } else { qDebug() << "Load Failed: " << wlanloader.errorString() << "\n"; return; @@ -1277,7 +1439,7 @@ void LockWidget::loadNetPlugin() mkylinNM->widget(1)->setPalette(pal); m_kylinNM->setGeometry(this->width() - mkylinNM->width() - 20, - this->height() - mkylinNM->height() - 100, + this->height() - mkylinNM->height() - 72 - 8, mkylinNM->width(), mkylinNM->height()); @@ -1325,12 +1487,11 @@ void LockWidget::initUserMenu() usersMenu = new QMenu(scrollContents); usersMenu->setObjectName("usersMenu"); usersMenu->setToolTipsVisible(true); - usersMenu->setStyleSheet("QMenu{background-color: rgb(255,255,255,15%);color: white;border-radius: 4px;width:250px;font-size: 16px;padding: 5px 5px 5px 5px;} \ + usersMenu->setStyleSheet("QMenu{background-color: rgb(255,255,255,15%);color: white;border-radius: 8px;width:250px;padding: 5px 5px 5px 5px;} \ QMenu::icon{padding: 2px 5px 2px 5px;}\ - QMenu::item{width:225px;border-radius: 4px;height:36px;font-size:16px;padding: 2px 10px 2px 10px;} \ + QMenu::item{width:225px;border-radius: 4px;height:36px;padding: 2px 10px 2px 10px;} \ QMenu::item:selected {border-radius: 4px;background-color:rgb(255,255,255,40%);} \ - QMenu::item:pressed {border-radius: 4px;background-color: rgb(255,255,255,40%);} \ - QLabel {color: white;font-size: 16px;}"); + QMenu::item:pressed {border-radius: 4px;background-color: rgb(255,255,255,40%);}"); // usersMenu->setStyleSheet("QMenu{background-color:transparent;color:white;padding:5px 5px 5px 8px}"); //QToolTip{border-radius:4px;background-color:rgb(255,255,255,40%);color:white;} @@ -1357,9 +1518,9 @@ void LockWidget::initUserMenu() p = PixmapToRound(p, 16*scale); iconlabel->setPixmap(p); iconlabel->setGeometry(8,4,32,32); - QLabel *textlabel =new QLabel(widget); - textlabel->setStyleSheet("QToolTip{border-radius:4px;background-color:#FFFFFF;color:black;font-size:16px}"); - textlabel->setGeometry(48,8,190,24); + KLabel *textlabel =new KLabel(widget); + textlabel->setFontSize(16); + textlabel->setGeometry(48,4,190,30); action->setToolTip("SwitchUser"); action->setData("SwitchUser"); usersMenu->addAction(action); @@ -1392,9 +1553,9 @@ void LockWidget::initUserMenu() p = PixmapToRound(p, 16*scale); iconlabel->setPixmap(p); iconlabel->setGeometry(8,4,32,32); - QLabel *textlabel =new QLabel(widget); - textlabel->setStyleSheet("QToolTip{border-radius:4px;background-color:#FFFFFF;color:black;font-size:16px}"); - textlabel->setGeometry(48,8,190,24); + KLabel *textlabel =new KLabel(widget); + textlabel->setFontSize(16); + textlabel->setGeometry(48,4,190,30); action->setData("Guest"); action->setToolTip("Guest"); usersMenu->addAction(action); @@ -1417,11 +1578,25 @@ void LockWidget::initUserMenu() if(scrollArea){ if(scrollContents->height() < height()/2){ scrollArea->setFixedSize(usersMenu->width(), scrollContents->height()+1); - }else{ + + scrollArea->clearMask(); + }else{ scrollArea->setFixedSize(usersMenu->width() + 16, height()/2); + + /*当scrollArea区域小于scrollContent大小时,使用样式表绘制的圆角外部透明部分,会显示出scrollContent的内容 + * 导致圆角外部有阴影,因此使用另一种方式再次绘制圆角,该方式绘制出来的圆角存在一定锯齿,所以只在会有阴影 + * 的情况下执行。*/ + QBitmap bitMap(scrollArea->width(),scrollArea->height()); // 定义一个窗口大小的位图 + bitMap.fill(); // 填充整个位图 + QPainter painter(&bitMap); // 定义绘图设备 + painter.setBrush(Qt::black); // 必须定义为黑色 + painter.setPen(Qt::NoPen); // 只能为黑色或者不设置画笔 + painter.setRenderHint(QPainter::Antialiasing);// 反走样 + painter.drawRoundedRect(bitMap.rect(),8,8); // 绘制圆角矩形 + scrollArea->setMask(bitMap); } scrollArea->move(ui->btnSwitchUser->geometry().x()- scrollArea->width()/2 + 24, \ - height() - 72 - scrollArea->height() - 5); + height() - 72 - scrollArea->height() - 8); } } @@ -1445,7 +1620,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()); } } @@ -1467,11 +1642,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) @@ -1482,8 +1660,10 @@ void LockWidget::resizeEvent(QResizeEvent *event) x = x + ui->btnPowerManager->width(); ui->btnPowerManager->move(width() - x,height() - y); - x = x+ui->btnKeyboard->width()+16; - ui->btnKeyboard->move(width() - x, height() - y); + if(!ui->btnKeyboard->isHidden()){ + x = x+ui->btnKeyboard->width()+16; + ui->btnKeyboard->move(width() - x, height() - y); + } x = x + btnNetworkManager->width()+16; btnNetworkManager->move(width() - x, height() - y); @@ -1509,16 +1689,27 @@ void LockWidget::resizeEvent(QResizeEvent *event) if(scrollArea){ if(scrollContents->height() < height()/2){ scrollArea->setFixedSize(usersMenu->width(),scrollContents->height()+1); - }else{ + + scrollArea->clearMask(); + }else{ scrollArea->setFixedSize(usersMenu->width() + 16, height()/2); - } + + QBitmap bitMap(scrollArea->width(),scrollArea->height()); // 定义一个窗口大小的位图 + bitMap.fill(); // 填充整个位图 + QPainter painter(&bitMap); // 定义绘图设备 + painter.setBrush(Qt::black); // 必须定义为黑色 + painter.setPen(Qt::NoPen); // 只能为黑色或者不设置画笔 + painter.setRenderHint(QPainter::Antialiasing);// 反走样 + painter.drawRoundedRect(bitMap.rect(),8,8); // 绘制圆角矩形 + scrollArea->setMask(bitMap); + } 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()); } @@ -1535,7 +1726,9 @@ void LockWidget::resizeEvent(QResizeEvent *event) powermanager->width(),powermanager->height()); } -// XSetInputFocus(QX11Info::display(),this->winId(),RevertToParent,CurrentTime); + if(QX11Info::isPlatformX11()){ + // XSetInputFocus(QX11Info::display(),this->winId(),RevertToParent,CurrentTime); + } } @@ -1558,9 +1751,9 @@ void LockWidget::onUserAdded(const UserItem &user) iconlabel->setPixmap(p); //iconlabel->setStyleSheet("background-color:transparent;"); iconlabel->setGeometry(8,4,32,32); - QLabel *textlabel =new QLabel(widget); - textlabel->setStyleSheet("QToolTip{border-radius:4px;background-color:#FFFFFF;color:black;font-size:16px}"); - textlabel->setGeometry(48,8,190,24); + KLabel *textlabel =new KLabel(widget); + textlabel->setFontSize(16); + textlabel->setGeometry(48,4,190,30); if(getLoadStatus(user.name)){ QLabel *statusIcon = new QLabel(widget); QPixmap status(":/image/assets/selected.svg"); @@ -1572,15 +1765,7 @@ void LockWidget::onUserAdded(const UserItem &user) } action->setDefaultWidget(widget); - QFont font; - font.setPixelSize(16); - QString str = ElideText(font,189,user.realName); - if(user.realName != str){ - textlabel->setToolTip(user.realName); - textlabel->setText(str); - } else { - textlabel->setText(user.realName); - } + textlabel->setElideText(user.realName, textlabel->width()); action->setData(user.name); usersMenu->addAction(action); usersMenu->adjustSize(); @@ -1704,26 +1889,43 @@ 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) + if(tabAt != LINEEDIT && tabAt != MESSAGEBTN && tabAt != ENTERBTN && tabAt != BIOBTN) 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); + } + } } } @@ -1782,5 +1984,98 @@ const QDBusArgument &operator >>(const QDBusArgument &arg, userInfo &usersInfo) return arg; } +bool LockWidget::IsDesktopStarted() +{ + QDBusInterface *iface = new QDBusInterface(DESKTOP_DBUS_SERVICE, + DESKTOP_DBUS_PATH, + DESKTOP_DBUS_INTERFACE, + QDBusConnection::sessionBus(), + this); + if (iface) { + if (iface->isValid()) { + delete iface; + return true; + } + delete iface; + } + return false; +} +void LockWidget::setRootWindow() +{ + QStringList keysMateBg; + QString strUserBgFile = ""; + QString strUserBgColor = ""; + QString strUserBgOptions = ""; + if(QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA_MATE_BG)){ + QGSettings *mateBgSettings = new QGSettings(GSETTINGS_SCHEMA_MATE_BG, "", this); + keysMateBg = mateBgSettings->keys(); + if (keysMateBg.contains(KEY_PICTURE_FILENAME)) { + strUserBgFile = mateBgSettings->get(KEY_PICTURE_FILENAME).toString(); + } + if (keysMateBg.contains(KEY_PRIMARY_COLOR)) { + strUserBgColor = mateBgSettings->get(KEY_PRIMARY_COLOR).toString(); + } + if (keysMateBg.contains(KEY_PICTURE_OPTIONS)) { + strUserBgOptions = mateBgSettings->get(KEY_PICTURE_OPTIONS).toString(); + } + qDebug()<<"User bg info:"<getDefaultBackgroundName(); + } + if(nDrawBgType == 0) { + qDebug()<<"DrawBgFile:"< #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; @@ -47,9 +50,10 @@ struct userInfo { QDBusArgument &operator <<(QDBusArgument &arg, const userInfo &usersInfo); const QDBusArgument &operator >>(const QDBusArgument &arg, userInfo &usersInfo); -class VirtualKeyboard; +class VirtualKeyboardWidget; class PowerManager; class AuthDialog; +class Configuration; class Users; class UserItem; class DisplayManager; @@ -64,6 +68,7 @@ enum TABAT { BIOBTN, BOTTMBTN, POWERMANAGER, + MESSAGEBTN, }; enum HORIZONBTN { @@ -87,8 +92,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(); @@ -106,16 +112,29 @@ private: 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 loadNetPlugin(); - void setBottomBtnSheet(); - void setCheckedSheet(int type, bool show); + void loadNetPlugin(); + void setBottomBtnSheet(); + void setCheckedSheet(int type, bool show); + void netResetLocation(); + + /** + * @brief IsDesktopStarted 桌面是否已启动 + * @return + */ + bool IsDesktopStarted(); + + /** + * @brief setRootWindow 设置X背景 + */ + void setRootWindow(); + 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); @@ -130,6 +149,11 @@ private Q_SLOTS: void resetNavigation(); void setBatteryIcon(QString str); void dealMessage(QDBusMessage); + void onShowMessageBtn(bool is_show); + /** + * @brief onAuthenticateCompete 认证完成 + */ + void onAuthenticateCompete(); protected: bool eventFilter(QObject *obj, QEvent *event); @@ -139,7 +163,8 @@ protected: private: Ui::LockWidget *ui; AuthDialog *authDialog; - VirtualKeyboard *vKeyboard = nullptr; + Configuration *configuration; + VirtualKeyboardWidget *vKeyboard = nullptr; PowerManager *powermanager = nullptr; SureWindow *sureWidget = nullptr; QTimer *timer; @@ -168,12 +193,21 @@ private: bool is_keynavigation =false; int tabAt = LINEEDIT; int horAT = BATTERYBTN; - int at_power = false; + bool at_power = false; bool at_plugins = false; QDBusInterface *batInterface = nullptr; QDBusInterface *iface = nullptr; QDBusInterface *dface = nullptr; + + + // 监听键盘插拔 + LibinputSwitchEvent *libswitch = nullptr; + bool isTableMode = false; + bool m_isShowKeyboard = false; // 打开电源管理界面前虚拟键盘是否已打开 + + double curFontSize = 0; + QFuture m_futureLoadDeskBg; }; #endif // LOCKWIDGET_H diff --git a/src/lockwidget.ui b/src/lockwidget.ui index b6c8c42..9ca0558 100644 --- a/src/lockwidget.ui +++ b/src/lockwidget.ui @@ -60,14 +60,14 @@ QPushButton::pressed { - + Time - + Date @@ -179,6 +179,13 @@ QPushButton::pressed { + + + KLabel + QLabel +
klabel.h
+
+
diff --git a/src/loginedusers.cpp b/src/loginedusers.cpp index 5d7f440..bd4d247 100644 --- a/src/loginedusers.cpp +++ b/src/loginedusers.cpp @@ -3,8 +3,8 @@ * * 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 2 of the License, or - * (at your option) any later version. + * the Free Software Foundation; either version 3, 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 @@ -12,10 +12,9 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + * along with this program; if not, see . * - */ +**/ #include "loginedusers.h" diff --git a/src/loginedusers.h b/src/loginedusers.h index c69ebe5..de1b175 100644 --- a/src/loginedusers.h +++ b/src/loginedusers.h @@ -1,11 +1,10 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * +/* * Copyright (C) 2019 Tianjin KYLIN Information Technology 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 2 of the License, or - * (at your option) any later version. + * the Free Software Foundation; either version 3, 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 @@ -13,10 +12,9 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + * along with this program; if not, see . * - */ +**/ #ifndef LOGINEDUSER_H #define LOGINEDUSER_H diff --git a/src/loginoptionswidget.cpp b/src/loginoptionswidget.cpp index 943cbff..f2f1b95 100644 --- a/src/loginoptionswidget.cpp +++ b/src/loginoptionswidget.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 . + * +**/ #include "loginoptionswidget.h" #include @@ -6,6 +23,9 @@ #include #include "giodbus.h" #include "biometricdeviceinfo.h" +#include "configuration.h" +#include "klabel.h" +#include #include #include @@ -18,10 +38,11 @@ #include #include #include +#include #define ON_TAB_SHEET "QPushButton{background-color: rgba(255,255,255,15%); border-radius: 4px; border: 2px solid #2C73C8;}" -#define ON_NORMAL_SHEET "QPushButton{background-color: rgba(255,255,255,0); border-radius: 4px; border: none;}\ - QPushButton::hover{ background-color: rgb(255,255,255,15%);}\ +#define ON_NORMAL_SHEET "QPushButton{background-color: rgba(255,255,255,15%); border-radius: 4px; border: none;}\ + QPushButton::hover{ background-color: rgba(255,255,255,40%);}\ QPushButton::pressed {background-color: rgba(255,255,255,40%);}\ QPushButton::checked {background-color: rgba(255, 255, 255, 40%);}" @@ -30,6 +51,7 @@ LoginOptionsWidget::LoginOptionsWidget(BiometricProxy* proxy, int uid, UniAuthSe , m_biomericProxy(proxy) , m_uid(uid) , m_uniauthService(uniauthService) + , configuration(Configuration::instance()) { m_listPriority.clear(); m_listPriority.push_back(BioT_Face); @@ -38,6 +60,9 @@ LoginOptionsWidget::LoginOptionsWidget(BiometricProxy* proxy, int uid, UniAuthSe m_listPriority.push_back(BioT_VoicePrint); m_listPriority.push_back(BioT_FingerVein); m_listPriority.push_back(REMOTE_QRCODE_TYPE); + m_listPriority.push_back(UniT_General_Ukey); + curFontSize = configuration->getFontSize(); + m_ptToPx = configuration->getPtToPx(); initUI(); initConnections(); m_mapDisableDev.clear(); @@ -50,7 +75,7 @@ LoginOptionsWidget::~LoginOptionsWidget() void LoginOptionsWidget::initUI() { - this->setFixedHeight(86); + this->setFixedHeight(94); // 初始化UI m_layoutMain = new QVBoxLayout(); m_layoutMain->setContentsMargins(0,0,0,0); @@ -59,10 +84,11 @@ void LoginOptionsWidget::initUI() m_layoutOptBtns->setContentsMargins(0,0,0,0); m_layoutOptBtns->setSpacing(16); - m_labelOptTitle = new QLabel(); + m_labelOptTitle = new KLabel(); m_labelOptTitle->setAlignment(Qt::AlignCenter); + m_labelOptTitle->setFontSize(16); m_labelOptTitle->setText(tr("Login Options")); - m_labelOptTitle->setFixedHeight(22); + m_labelOptTitle->setFixedHeight(30); m_layoutMain->addWidget(m_labelOptTitle); m_btnGroup = new QButtonGroup(this); @@ -106,6 +132,18 @@ unsigned LoginOptionsWidget::getLoginOptCount() return m_mapDevices.size(); } +int LoginOptionsWidget::getVisibleLoginOptCount() +{ + int nCount = 0; + QMap::iterator itMapBtn = m_mapOptBtns.begin(); + for ( ; itMapBtn != m_mapOptBtns.end(); itMapBtn++) { + if (itMapBtn.value() && itMapBtn.value()->isVisible()) { + nCount ++; + } + } + return nCount; +} + DeviceInfoPtr LoginOptionsWidget::getFirstDevInfo() { DeviceInfoPtr devInfo = nullptr; @@ -170,29 +208,32 @@ void LoginOptionsWidget::addOptionButton(unsigned uLoginOptType, int nDrvId, QSt return ; } QPushButton *newButton = new QPushButton(); - QVBoxLayout *layoutBtn = new QVBoxLayout(); - newButton->setLayout(layoutBtn); - //QLabel *newLabel = new QLabel(); - layoutBtn->setAlignment(Qt::AlignCenter); - //layoutBtn->addWidget(newLabel); +// QVBoxLayout *layoutBtn = new QVBoxLayout(); +// newButton->setLayout(layoutBtn); +// QLabel *newLabel = new QLabel(); +// layoutBtn->setAlignment(Qt::AlignCenter); +// layoutBtn->addWidget(newLabel); newButton->setCheckable(true); newButton->setChecked(false); newButton->setFocusPolicy(Qt::NoFocus); - if (nDrvId == -1) { - //newButton->setEnabled(false); - newButton->setChecked(true); - //屏蔽鼠标事件 - newButton->setAttribute(Qt::WA_TransparentForMouseEvents, true); - } else { +// if (nDrvId == -1) { +// //newButton->setEnabled(false); +// newButton->setChecked(true); +// //屏蔽鼠标事件 +// newButton->setAttribute(Qt::WA_TransparentForMouseEvents, true); +// } else { int nLength = m_btnGroup->buttons().length(); m_btnGroup->addButton(newButton, nLength); m_listDriveId.append(nDrvId); - } + // } QPixmap iconPixmap; switch (uLoginOptType) { case LOGINOPT_TYPE_PASSWORD: iconPixmap = loadSvg(":/image/assets/ukui-loginopt-password.svg", "white", 16); break; + case LOGINOPT_TYPE_GENERAL_UKEY: + iconPixmap = loadSvg(":/image/assets/ukui-loginopt-ukey.svg", "white", 16); + break; case LOGINOPT_TYPE_FACE: iconPixmap = loadSvg(":/image/assets/ukui-loginopt-face.svg", "white", 16); break; @@ -215,7 +256,12 @@ void LoginOptionsWidget::addOptionButton(unsigned uLoginOptType, int nDrvId, QSt newButton->setIcon(iconPixmap); //newLabel->setPixmap(iconPixmap); newButton->setToolTip(strDrvName); - newButton->setStyleSheet("QToolTip{border-radius:4px;background-color:#FFFFFF;color:black;font-size:16px}"); + sysFont.setPointSize((14 + curFontSize) *m_ptToPx); + QToolTip::setFont(sysFont); + newButton->setStyleSheet("QPushButton{text-align:center;background-color: rgb(255,255,255,15%);border: none;border-radius: 4px;outline: none;}" + "QPushButton::hover{background-color: rgb(255,255,255,40%);}" + "QPushButton::pressed {background-color: rgba(255,255,255,40%);}" + "QPushButton::checked {background-color: rgba(255,255,255,40%);}"); newButton->setFixedSize(48, 48); if (isDeviceDisable(nDrvId)) { newButton->setDisabled(true); @@ -241,20 +287,51 @@ void LoginOptionsWidget::clearOptionButtons() m_mapOptBtns.clear(); } +bool LoginOptionsWidget::getHasUkeyOptions() +{ + return isShowUkey; +} + void LoginOptionsWidget::updateOptionButtons() { + isShowUkey = false; clearOptionButtons(); - //addOptionButton(LOGINOPT_TYPE_PASSWORD, -1, tr("Password")); + addOptionButton(LOGINOPT_TYPE_PASSWORD, -1, tr("Password")); DeviceMap::iterator itMapDev = m_mapDevices.begin(); for ( ; itMapDev != m_mapDevices.end(); itMapDev++) { for (DeviceInfoPtr devPtr : itMapDev.value()) { if (devPtr) { + if(devPtr->deviceType == LOGINOPT_TYPE_GENERAL_UKEY){ + //ukey 设备类型排在二维码前,但实际上应该显示在二维码之后,因此暂时不添加 + isShowUkey = true; + continue; + } addOptionButton(itMapDev.key(), devPtr->id, DeviceType::getDeviceType_tr(devPtr->deviceType)); } } } + + itMapDev = m_mapDevices.begin(); + if(isShowUkey){ + for ( ; itMapDev != m_mapDevices.end(); itMapDev++) { + for (DeviceInfoPtr devPtr : itMapDev.value()) { + if(devPtr && devPtr->deviceType == LOGINOPT_TYPE_GENERAL_UKEY){ + //此处才添加ukey + addOptionButton(itMapDev.key(), devPtr->id, DeviceType::getDeviceType_tr(devPtr->deviceType)); + } + } + } + } + + //存在特征但没有插入ukey + if(!isShowUkey && m_biomericProxy->GetHasUkeyFeature(m_uid) ){ + addOptionButton(LOGINOPT_TYPE_GENERAL_UKEY,-2,DeviceType::getDeviceType_tr(LOGINOPT_TYPE_GENERAL_UKEY)); + isShowUkey = true; + } + qDebug()<<"m_mapOptBtns.size():"<hide(); QMap::iterator itMapBtn = m_mapOptBtns.begin(); for ( ; itMapBtn != m_mapOptBtns.end(); itMapBtn++) { @@ -262,7 +339,7 @@ void LoginOptionsWidget::updateOptionButtons() itMapBtn.value()->hide(); } } - } else { + }else { m_labelOptTitle->show(); QMap::iterator itMapBtn = m_mapOptBtns.begin(); for ( ; itMapBtn != m_mapOptBtns.end(); itMapBtn++) { @@ -271,6 +348,10 @@ void LoginOptionsWidget::updateOptionButtons() } } } + m_mapOptBtns[-1]->hide(); + if(m_mapOptBtns.size() == 2 && isShowUkey) { + m_mapOptBtns[-1]->show(); + } } void LoginOptionsWidget::setUser(int uid) @@ -286,16 +367,21 @@ void LoginOptionsWidget::readDevicesInfo() bool isQRCodeEnable = getQRCodeEnable(); DeviceList deviceList = m_biomericProxy->GetDevList(); QStringList listDefDevices = getAllDefDevices(); - for(auto pDeviceInfo : deviceList) - { - qDebug()<<"BeginGetFeature------!"; - int nDevFeatureCount = m_biomericProxy->GetUserDevFeatureCount(m_uid,pDeviceInfo->id); - qDebug() << *pDeviceInfo << ",feautres:"< 0) { - if (!isAuthEnable && pDeviceInfo->deviceType <= DeviceType::VoicePrint) - continue; - if (!isQRCodeEnable && pDeviceInfo->deviceType == REMOTE_QRCODE_TYPE) - continue; + qDebug()<<"BeginGetFeature------!"; + FeatureMap mapFeatures = m_biomericProxy->GetUserFeatures(m_uid); + qDebug() << m_uid <<",count:"<deviceType <= DeviceType::VoicePrint) + continue; + if (!isQRCodeEnable && pDeviceInfo->deviceType == REMOTE_QRCODE_TYPE) + continue; + int nFeatureCount = 0; + if (mapFeatures.contains(pDeviceInfo->shortName)) { + nFeatureCount = mapFeatures[pDeviceInfo->shortName].size(); + } + qDebug() << *pDeviceInfo <<",count:"< 0) { int nDevType = LOGINOPT_TYPE_OTHERS; nDevType = convertDeviceType(pDeviceInfo->deviceType); if (listDefDevices.contains(pDeviceInfo->shortName) && @@ -304,9 +390,20 @@ void LoginOptionsWidget::readDevicesInfo() } } } + updateOptionButtons(); } +void LoginOptionsWidget::SetExtraInfo(QString extra_info, QString info_type) +{ + if(!m_biomericProxy) + { + qWarning() << "BiometricProxy doesn't exist."; + return; + } + m_biomericProxy->SetExtraInfo(info_type,extra_info); +} + void LoginOptionsWidget::startAuth(DeviceInfoPtr device, int uid) { if(!m_biomericProxy) @@ -332,7 +429,27 @@ void LoginOptionsWidget::startAuth(DeviceInfoPtr device, int uid) this->m_curLoginOptType = convertDeviceType(this->m_curDevInfo->deviceType); updateUIStatus(); SetLastDevice(this->m_strUserName, this->m_curDevInfo->id); - startAuth_(); + if(this->m_curLoginOptType == LOGINOPT_TYPE_GENERAL_UKEY) + startUkeyAuth(); + else + startAuth_(); +} + +void LoginOptionsWidget::startUkeyAuth() +{ + if (!m_curDevInfo) + return ; + qDebug().noquote() << QString("Identify:[drvid: %1, uid: %2]").arg(m_curDevInfo->id).arg(m_uid); + + m_isInAuth = true; + m_dupFD = -1; + + Q_EMIT setLoadingImage(); + m_biomericProxy->StopOps(m_curDevInfo->id); + QDBusPendingCall call = m_biomericProxy->UkeyIdentify(m_curDevInfo->id, 2,m_uid); + QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this); + connect(watcher, &QDBusPendingCallWatcher::finished, + this, &LoginOptionsWidget::onIdentifyComplete); } void LoginOptionsWidget::startAuth_() @@ -345,7 +462,7 @@ void LoginOptionsWidget::startAuth_() m_dupFD = -1; Q_EMIT setLoadingImage(); - + m_biomericProxy->StopOps(m_curDevInfo->id); QDBusPendingCall call = m_biomericProxy->Identify(m_curDevInfo->id, m_uid); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this); connect(watcher, &QDBusPendingCallWatcher::finished, @@ -369,7 +486,7 @@ void LoginOptionsWidget::stopAuth() Q_EMIT updateImage(QImage()); } -void LoginOptionsWidget::onIdentifyComplete(QDBusPendingCallWatcher *watcher) +void LoginOptionsWidget::onUkeyIdentifyComplete(QDBusPendingCallWatcher *watcher) { if(m_isStopped == true) return ; @@ -381,12 +498,37 @@ void LoginOptionsWidget::onIdentifyComplete(QDBusPendingCallWatcher *watcher) Q_EMIT authComplete(false, -1); return; } + int result = reply.argumentAt(0).toInt(); + int authUid = reply.argumentAt(1).toInt(); + qDebug() << result << authUid << m_uid; + if(result == DBUS_RESULT_SUCCESS) { + qDebug() << "Identify success"; + Q_EMIT authComplete(true, 0); + } else { + qDebug() << "Identify failed"; + Q_EMIT authComplete(false, 2); + } +} + +void LoginOptionsWidget::onIdentifyComplete(QDBusPendingCallWatcher *watcher) +{ + if(m_isStopped == true) + return ; + + QDBusPendingReply reply = *watcher; + if(reply.isError()) + { + qWarning() << "Identify error: " << reply.error().message(); + Q_EMIT authComplete(false, -1); + return; + } + int result = reply.argumentAt(0).toInt(); int authUid = reply.argumentAt(1).toInt(); qDebug() << result << authUid << m_uid; // 特征识别成功,而且用户id匹配 - if(result == DBUS_RESULT_SUCCESS && authUid == m_uid) { + if(result == DBUS_RESULT_SUCCESS && authUid == m_uid) { qDebug() << "Identify success"; Q_EMIT authComplete(true, 0); } else if(result == DBUS_RESULT_NOTMATCH) { // 特征识别不匹配 @@ -580,14 +722,26 @@ bool LoginOptionsWidget::getAuthDouble() return distribId; } -void LoginOptionsWidget::updateUIStatus() +void LoginOptionsWidget::setSelectedPassword() { if (m_mapOptBtns.contains(-1)) { QPushButton* btn = m_mapOptBtns[-1]; - if (btn) { + if (btn && btn->isVisible()) { + btn->setChecked(true); + } + m_curDevInfo = nullptr; + } +} + +void LoginOptionsWidget::updateUIStatus() +{ + if (!m_curDevInfo && m_mapOptBtns.contains(-1)) { + QPushButton* btn = m_mapOptBtns[-1]; + if (btn && btn->isVisible()) { btn->setChecked(true); } } + if (m_curDevInfo) { if (m_mapOptBtns.contains(m_curDevInfo->id)) { QPushButton* btn = m_mapOptBtns[m_curDevInfo->id]; @@ -607,7 +761,16 @@ void LoginOptionsWidget::onOptionSelected(int nIndex, bool keyNavigation) if (nIndex < m_listDriveId.size()) { DeviceInfoPtr info = findDeviceById(m_listDriveId[nIndex]); if (info && !isDeviceDisable(info->id)) { - Q_EMIT optionSelected(convertDeviceType(info->deviceType), info ,keyNavigation); + Q_EMIT optionSelected(convertDeviceType(info->deviceType), info, keyNavigation); + }else if(nIndex == 0 && m_listDriveId[nIndex] == -1){ + stopAuth(); + m_curDevInfo = nullptr; + Q_EMIT optionSelected(LOGINOPT_TYPE_PASSWORD, nullptr, keyNavigation); + }else if(m_listDriveId[nIndex] == -2){ + //存在ukey特征,但未插入ukey + stopAuth(); + m_curDevInfo = nullptr; + Q_EMIT optionSelected(LOGINOPT_TYPE_GENERAL_UKEY, nullptr, keyNavigation); } } } @@ -616,86 +779,65 @@ void LoginOptionsWidget::tabOptionSelected(int option) { switch(option) { case RIGHT: + { at_bioBtn = true; - if(nowAt+1 < m_listDriveId.count()) { - DeviceInfoPtr infoNow = findDeviceById(m_listDriveId[nowAt+1]); - if (infoNow) { - QPushButton* btn = m_mapOptBtns[infoNow->id]; - if (btn) { - btn->setStyleSheet(ON_TAB_SHEET); - } - } - if(nowAt >= 0) { - DeviceInfoPtr infoOld = findDeviceById(m_listDriveId[nowAt]); - if (infoOld) { - QPushButton* btn = m_mapOptBtns[infoOld->id]; - if (btn) { - btn->setStyleSheet(ON_NORMAL_SHEET); - } - } - } - nowAt += 1; - } else if (nowAt+1 == m_listDriveId.count()) { - DeviceInfoPtr infoNow = findDeviceById(m_listDriveId[0]); - if (infoNow) { - QPushButton* btn = m_mapOptBtns[infoNow->id]; - if (btn) { - btn->setStyleSheet(ON_TAB_SHEET); - } - } - DeviceInfoPtr infoOld = findDeviceById(m_listDriveId[nowAt]); - if (infoOld) { - QPushButton* btn = m_mapOptBtns[infoOld->id]; + int nCur = nowAt; + if(nCur >= 0 && nCur < m_listDriveId.count()) { + if (m_mapOptBtns.contains(m_listDriveId[nCur])) { + QPushButton* btn = m_mapOptBtns[m_listDriveId[nCur]]; if (btn) { btn->setStyleSheet(ON_NORMAL_SHEET); } } - nowAt = 0; } + for (int n = 0; n < m_listDriveId.count(); n ++) { + nCur = nCur + 1; + if (nCur >= m_listDriveId.count()) + nCur = 0; + if (m_mapOptBtns.contains(m_listDriveId[nCur])) { + QPushButton* btn = m_mapOptBtns[m_listDriveId[nCur]]; + if (btn && btn->isVisible()) { + btn->setStyleSheet(ON_TAB_SHEET); + nowAt = nCur; + break; + } + } + } + } break; case LEFT: + { at_bioBtn = true; - if(nowAt-1 >= 0) { - DeviceInfoPtr infoNow = findDeviceById(m_listDriveId[nowAt-1]); - if (infoNow) { - QPushButton* btn = m_mapOptBtns[infoNow->id]; - if (btn) { - btn->setStyleSheet(ON_TAB_SHEET); - } - } - DeviceInfoPtr infoOld = findDeviceById(m_listDriveId[nowAt]); - if (infoOld) { - QPushButton* btn = m_mapOptBtns[infoOld->id]; + int nCur = nowAt; + if(nCur >= 0 && nCur < m_listDriveId.count()) { + if (m_mapOptBtns.contains(m_listDriveId[nCur])) { + QPushButton* btn = m_mapOptBtns[m_listDriveId[nCur]]; if (btn) { btn->setStyleSheet(ON_NORMAL_SHEET); } } - nowAt -= 1; - } else if (nowAt-1 < 0) { - DeviceInfoPtr infoNow = findDeviceById(m_listDriveId[m_listDriveId.count() - 1]); - if (infoNow) { - QPushButton* btn = m_mapOptBtns[infoNow->id]; - if (btn) { - btn->setStyleSheet(ON_TAB_SHEET); - } - } - DeviceInfoPtr infoOld = findDeviceById(m_listDriveId[0]); - if (infoOld) { - QPushButton* btn = m_mapOptBtns[infoOld->id]; - if (btn) { - btn->setStyleSheet(ON_NORMAL_SHEET); - } - } - nowAt = m_listDriveId.count() - 1; } + for (int n = 0; n < m_listDriveId.count(); n ++) { + nCur = nCur - 1; + if (nCur < 0) + nCur = m_listDriveId.count() - 1; + if (m_mapOptBtns.contains(m_listDriveId[nCur])) { + QPushButton* btn = m_mapOptBtns[m_listDriveId[nCur]]; + if (btn && btn->isVisible()) { + btn->setStyleSheet(ON_TAB_SHEET); + nowAt = nCur; + break; + } + } + } + } break; case CLEAR: at_bioBtn = false; if(nowAt >= 0) { - for(int i = 0; i < getLoginOptCount(); i++) { - DeviceInfoPtr infoClear = findDeviceById(m_listDriveId[i]); - if (infoClear) { - QPushButton* btn = m_mapOptBtns[infoClear->id]; + for (int n = 0; n < m_listDriveId.count(); n ++) { + if (m_mapOptBtns.contains(m_listDriveId[n])) { + QPushButton* btn = m_mapOptBtns[m_listDriveId[n]]; if (btn) { btn->setStyleSheet(ON_NORMAL_SHEET); } @@ -707,20 +849,26 @@ void LoginOptionsWidget::tabOptionSelected(int option) case FirstDevice: at_bioBtn = true; if(nowAt >= 0) { - for(int i = 0; i < getLoginOptCount(); i++) { - DeviceInfoPtr infoClear = findDeviceById(m_listDriveId[i]); - if (infoClear) { - QPushButton* btn = m_mapOptBtns[infoClear->id]; + for (int n = 0; n < m_listDriveId.count(); n ++) { + if (m_mapOptBtns.contains(m_listDriveId[n])) { + QPushButton* btn = m_mapOptBtns[m_listDriveId[n]]; if (btn) { btn->setStyleSheet(ON_NORMAL_SHEET); } } } - DeviceInfoPtr infoFirst = findDeviceById(m_listDriveId[0]); - if (infoFirst) { - QPushButton* btn = m_mapOptBtns[infoFirst->id]; - if (btn) { - btn->setStyleSheet(ON_TAB_SHEET); + int nCur = 0; + for (int n = 0; n < m_listDriveId.count(); n ++) { + nCur = nCur + 1; + if (nCur >= m_listDriveId.count()) + nCur = 0; + if (m_mapOptBtns.contains(m_listDriveId[nCur])) { + QPushButton* btn = m_mapOptBtns[m_listDriveId[nCur]]; + if (btn && btn->isVisible()) { + btn->setStyleSheet(ON_TAB_SHEET); + nowAt = nCur; + break; + } } } nowAt = 0; @@ -728,15 +876,13 @@ void LoginOptionsWidget::tabOptionSelected(int option) break; case CLICK: at_bioBtn = false; - DeviceInfoPtr infoClick = findDeviceById(m_listDriveId[nowAt]); - if (infoClick) { - QPushButton* btn = m_mapOptBtns[infoClick->id]; + if (nowAt >= 0 && nowAt < m_listDriveId.count() && m_mapOptBtns.contains(m_listDriveId[nowAt])) { + QPushButton* btn = m_mapOptBtns[m_listDriveId[nowAt]]; if (btn) { onOptionSelected(nowAt, true); } } break; - } } @@ -759,6 +905,12 @@ int LoginOptionsWidget::convertDeviceType(int nDevType) case BioT_VoicePrint: nLoginOptType = LOGINOPT_TYPE_VOICEPRINT; break; + case UniT_General_Ukey: + nLoginOptType = LOGINOPT_TYPE_GENERAL_UKEY; + break; + case UniT_Advanced_Ukey: + nLoginOptType = LOGINOPT_TYPE_ADVANCED_UKEY; + break; case UniT_Remote: nLoginOptType = LOGINOPT_TYPE_QRCODE; break; @@ -886,6 +1038,23 @@ bool LoginOptionsWidget::getQRCodeEnable() } } +QString LoginOptionsWidget::getDefaultDevice(QString strUserName,int bioType) +{ + if (m_uniauthService && m_uniauthService->isActivatable()) { + QString defaultDeviceName = ""; + QString strDeviceName = m_uniauthService->getDefaultDevice(strUserName, bioType); + if(!strDeviceName.isEmpty()) { + DeviceInfoPtr pDeviceInfo = findDeviceByName(strDeviceName); + if (pDeviceInfo) { + defaultDeviceName = strDeviceName; + } + } + return defaultDeviceName; + } else { + return GetDefaultDevice(strUserName); + } +} + QString LoginOptionsWidget::getDefaultDevice(QString strUserName) { if (m_uniauthService && m_uniauthService->isActivatable()) { diff --git a/src/loginoptionswidget.h b/src/loginoptionswidget.h index c8630da..8c197fa 100644 --- a/src/loginoptionswidget.h +++ b/src/loginoptionswidget.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 LOGINOPTIONSWIDGET_H #define LOGINOPTIONSWIDGET_H @@ -7,12 +24,14 @@ #include "uniauthservice.h" class QLabel; +class KLabel; class QButtonGroup; class QHBoxLayout; class QVBoxLayout; class QPushButton; class QTimer; class QPixmap; +class Configuration; typedef enum { BioT_FingerPrint, /** 指纹 **/ @@ -59,7 +78,13 @@ public: bool getBioAuthEnable(int nType); bool getQRCodeEnable(); QString getDefaultDevice(QString strUserName); + QString getDefaultDevice(QString strUserName,int biotype); QStringList getAllDefDevices(); + void SetExtraInfo(QString extra_info,QString info_type); + bool getHasUkeyOptions(); + void setSelectedPassword(); + void updateUIStatus(); + int getVisibleLoginOptCount(); /** * @brief 进行生物识别认证 @@ -85,6 +110,7 @@ public: public Q_SLOTS: void readDevicesInfo(); void onIdentifyComplete(QDBusPendingCallWatcher *watcher); + void onUkeyIdentifyComplete(QDBusPendingCallWatcher *watcher); void onStatusChanged(int drvid, int status); void onFrameWritten(int drvid); void onUSBDeviceHotPlug(int drvid, int action, int devNum); @@ -106,8 +132,8 @@ private: void clearOptionButtons(); void updateOptionButtons(); void startAuth_(); + void startUkeyAuth(); bool getAuthDouble(); - void updateUIStatus(); QPixmap drawSymbolicColoredPixmap(QPixmap &source, QString cgColor); private: @@ -126,7 +152,7 @@ private: QVBoxLayout *m_layoutMain = nullptr; QHBoxLayout *m_layoutOptBtns = nullptr; - QLabel *m_labelOptTitle = nullptr; + KLabel *m_labelOptTitle = nullptr; QButtonGroup *m_btnGroup = nullptr; QList m_listDriveId; QMap m_mapOptBtns; @@ -135,6 +161,11 @@ private: bool at_bioBtn = false; UniAuthService *m_uniauthService = nullptr; QList m_listPriority; + Configuration *configuration; + double curFontSize = 0; + double m_ptToPx = 1.0; + QFont sysFont; + bool isShowUkey = false; }; #endif // LOGINOPTIONSWIDGET_H diff --git a/src/machinemodel.cpp b/src/machinemodel.cpp new file mode 100644 index 0000000..957da65 --- /dev/null +++ b/src/machinemodel.cpp @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 . + * +**/ +#include "machinemodel.h" +#include +#include +#include + +std::shared_ptr MachineModel::m_machineModel = nullptr; +std::mutex MachineModel::m_mutex; + +MachineModel::MachineModel(QObject *parent) : QObject(parent) +{ + initMachineType(); +} + +QString MachineModel::getTheMachineType() +{ + return m_machineType; +} + +std::shared_ptr MachineModel::getMachineModelInstance() +{ + if(m_machineModel == nullptr) + { + std::unique_lock lock(m_mutex); + if(m_machineModel == nullptr) + { + m_machineModel = std::shared_ptr(new MachineModel); + } + } + return m_machineModel; +} + +void MachineModel::initMachineType() +{ + QSettings setting(":/assets/data/conf.ini", QSettings::IniFormat); + setting.beginGroup("MachineType");//节点开始 + + QString type = getSysVendor() + getProductFamily(); + qInfo() << __FILE__ << __LINE__ << type; + if (setting.contains(type)) { + m_machineType = setting.value(type).toString(); + } else { + m_machineType = QString(); + } + qInfo() << __FILE__ << __LINE__ << m_machineType; + setting.endGroup();//节点结束 + +} + +const QString MachineModel::getSysVendor() const +{ + QProcess process; + QStringList options; + options << "-c"; + options << "cat /sys/class/dmi/id/sys_vendor"; + process.start("/bin/bash", options); + process.waitForFinished(); + QString result = process.readAllStandardOutput(); + + QStringList list = result.split("\n"); + result = list.at(0); + qInfo() << __FILE__ << __LINE__ << "获取设备厂商为:" << result; + return result; +} + +const QString MachineModel::getProductName() const +{ + QProcess process; + QStringList options; + options << "-c"; + options << "cat /sys/class/dmi/id/product_name"; + process.start("/bin/bash", options); + process.waitForFinished(); + QString result = process.readAllStandardOutput(); + + QStringList list = result.split("\n"); + result = list.at(0); + qInfo() << __FILE__ << __LINE__ << "获取产品名为:" << result; + return result; +} + +const QString MachineModel::getProductFamily() const +{ + QProcess process; + QStringList options; + options << "-c"; + options << "cat /sys/class/dmi/id/product_family"; + process.start("/bin/bash", options); + process.waitForFinished(); + QString result = process.readAllStandardOutput(); + + QStringList list = result.split("\n"); + result = list.at(0); + qInfo() << __FILE__ << __LINE__ << "获取设备Family为:" << result; + return result; +} diff --git a/src/machinemodel.h b/src/machinemodel.h new file mode 100644 index 0000000..7b49b64 --- /dev/null +++ b/src/machinemodel.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 MACHINEMODEL_H +#define MACHINNEMODEL_H + +#include +#include +#include + +class MachineModel : public QObject +{ + Q_OBJECT +public: + QString getTheMachineType(); + static std::shared_ptr getMachineModelInstance(); + +private: + MachineModel(QObject *parent = nullptr); + MachineModel(const MachineModel &); + const MachineModel &operator =(const MachineModel &) = delete; + +private: + void initMachineType(); + const QString getSysVendor() const; + const QString getProductName() const; + const QString getProductFamily() const; + QString m_machineType; + static std::shared_ptr m_machineModel; + static std::mutex m_mutex; + +signals: + +}; + +#endif // MACHINEMODEL_H diff --git a/src/modebutton.cpp b/src/modebutton.cpp new file mode 100644 index 0000000..3b8bb26 --- /dev/null +++ b/src/modebutton.cpp @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 . + * +**/ +#include "modebutton.h" +#include +#include + +ModeButton::ModeButton(QWidget *parent) + : QPushButton(parent) +{ + +} + +void ModeButton::paintEvent(QPaintEvent *event) +{ + QStylePainter p(this); + QStyleOptionButton option; + initStyleOption(&option); + option.state = QStyle::State_Enabled; + p.drawControl(QStyle::CE_PushButton, option); +} + diff --git a/src/modebutton.h b/src/modebutton.h new file mode 100644 index 0000000..dc7944c --- /dev/null +++ b/src/modebutton.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 MODEBUTTON_H +#define MODEBUTTON_H +#include + +class ModeButton : public QPushButton +{ + Q_OBJECT +public: + ModeButton(QWidget *parent = nullptr); + +protected: + void paintEvent(QPaintEvent *event); +}; + +#endif // MODEBUTTON_H diff --git a/src/monitorwatcher.h b/src/monitorwatcher.h index 224aeac..0f10599 100644 --- a/src/monitorwatcher.h +++ b/src/monitorwatcher.h @@ -1,9 +1,9 @@ -/* monitorwatcher.h +/* * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, @@ -12,9 +12,8 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. + * along with this program; if not, see . + * **/ #ifndef MONITORWATCHER_H #define MONITORWATCHER_H diff --git a/src/mytabwidget.cpp b/src/mytabwidget.cpp index 7256584..dcc2e20 100644 --- a/src/mytabwidget.cpp +++ b/src/mytabwidget.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 . + * +**/ #include "mytabwidget.h" #include #include diff --git a/src/mytabwidget.h b/src/mytabwidget.h index 65ff60a..732d44d 100644 --- a/src/mytabwidget.h +++ b/src/mytabwidget.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 MYTABWIDGET_H #define MYTABWIDGET_H diff --git a/src/networkwatcher.cpp b/src/networkwatcher.cpp index 313eabb..3c57a49 100644 --- a/src/networkwatcher.cpp +++ b/src/networkwatcher.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 . + * +**/ #include #include #include diff --git a/src/networkwatcher.h b/src/networkwatcher.h index 71d3d28..a388266 100644 --- a/src/networkwatcher.h +++ b/src/networkwatcher.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 NETWORKWATCHER_H #define NETWORKWATCHER_H #include diff --git a/src/org.ukui.ScreenSaver.xml b/src/org.ukui.ScreenSaver.xml index 3e47687..e0d3a42 100644 --- a/src/org.ukui.ScreenSaver.xml +++ b/src/org.ukui.ScreenSaver.xml @@ -26,5 +26,9 @@ + + + + diff --git a/src/permissioncheck.h b/src/permissioncheck.h index 94639e5..3af7e9c 100644 --- a/src/permissioncheck.h +++ b/src/permissioncheck.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2021 Tianjin KYLIN Information Technology 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, 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 PERMISSIONCHECK_H #define PERMISSIONCHECK_H diff --git a/src/powermanager.cpp b/src/powermanager.cpp index 698cc00..5b9ba34 100644 --- a/src/powermanager.cpp +++ b/src/powermanager.cpp @@ -28,6 +28,7 @@ #include #include "powermanager.h" #include "lockchecker.h" +#include "klabel.h" const static QString login1Service = QStringLiteral("org.freedesktop.login1"); const static QString login1Path = QStringLiteral("/org/freedesktop/login1"); @@ -202,7 +203,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;"); } @@ -215,7 +217,6 @@ void PowerManager::powerClicked(QListWidgetItem *item) lasttime = QTime::currentTime(); QString name = itemWidget(item)->objectName(); - printf("111111111111111111111111111 name = %s\n",name.toLatin1().data()); // if(name == lockWidget->objectName()) // lockWidgetClicked(); if(switchWidget && name == switchWidget->objectName()) @@ -330,7 +331,7 @@ void PowerManager::initUI() QLabel *rebootLabel = new QLabel(this); rebootPB->setProperty("class", "PowerManagerPB"); rebootPB->setIcon(QIcon(QPixmap(":/image/assets/intel/reboot.png").scaled(40,40))); - rebootLabel->setText(tr("Reboot")); + rebootLabel->setText(tr("Restart")); rebootLabel->setAlignment(Qt::AlignBottom | Qt::AlignHCenter); QVBoxLayout *rebootlayout = new QVBoxLayout(rebootWidget); @@ -660,14 +661,16 @@ 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); + KLabel *rebootLabel = new KLabel(this); + //rebootFace->setAlignment(Qt::AlignCenter); rebootFace->installEventFilter(this); rebootLabel->setAlignment(Qt::AlignCenter); - rebootFace->setPixmap(QPixmap(":/image/assets/reboot.png").scaled(58,58)); - rebootLabel->setText(tr("Reboot")); + rebootFace->setIcon(QIcon(":/image/assets/reboot.svg")); + rebootFace->setIconSize(QSize(48, 48)); + rebootLabel->setFontSize(16); + rebootLabel->setText(tr("Restart")); rebootWidget->setFixedSize(ITEM_WIDTH,ITEM_HEIGHT); QVBoxLayout *rebootlayout = new QVBoxLayout(rebootWidget); rebootlayout->addWidget(rbLabelWidget); @@ -678,15 +681,18 @@ 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); + KLabel *shutdownLabel = new KLabel(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)); + //sysFont.setPointSize(20); + shutdownLabel->setFontSize(16); 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); @@ -704,13 +710,15 @@ 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); + KLabel *hibernateLabel = new KLabel(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->setFontSize(16); hibernateLabel->setText(tr("Hibernate")); hibernateWidget->setFixedSize(ITEM_WIDTH,ITEM_HEIGHT); QVBoxLayout *hibernatelayout = new QVBoxLayout(hibernateWidget); @@ -731,13 +739,15 @@ 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); + KLabel *suspendLabel = new KLabel(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->setFontSize(16); 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/rootWindowBackground.cpp b/src/rootWindowBackground.cpp new file mode 100644 index 0000000..eb3d534 --- /dev/null +++ b/src/rootWindowBackground.cpp @@ -0,0 +1,410 @@ +/* + * Copyright (C) 2018 Tianjin KYLIN Information Technology 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, 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 . + * +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "rootWindowBackground.h" + +static const XID INVAL_ID = ~0UL; +Pixmap pix = INVAL_ID; +Display *dpy = NULL; +Window root = 0; +Screen *scn = NULL; + +struct RootWindowBGInfo { + bool isValid = false; + int nType; + int nColor; + QString strFileName; + int nOption; + QList listScreen; +}; + +static RootWindowBGInfo g_lastRootWndInfo; + +static QRect getSourceRect(const QRect &destination, const QRect &source) +{ + qreal screenScale = qreal(destination.width()) / qreal(destination.height()); + qreal width = source.width(); + qreal height = source.height(); + + if ((width / height) == screenScale) { + return source; + } + + bool isShortX = (width <= height); + if (isShortX) { + screenScale = qreal(destination.height()) / qreal(destination.width()); + } + + qreal shortEdge = isShortX ? width : height; + qreal longEdge = isShortX ? height : width; + + while (shortEdge > 1) { + qint32 temp = qFloor(shortEdge * screenScale); + if (temp <= longEdge) { + longEdge = temp; + break; + } + + qint32 spacing = qRound(shortEdge / 20); + if (spacing <= 0) { + spacing = 1; + } + shortEdge -= spacing; + } + + QSize sourceSize = source.size(); + if (shortEdge > 1 && longEdge > 1) { + sourceSize.setWidth(isShortX ? shortEdge : longEdge); + sourceSize.setHeight(isShortX ? longEdge : shortEdge); + } + + qint32 offsetX = 0; + qint32 offsetY = 0; + if (source.width() > sourceSize.width()) { + offsetX = (source.width() - sourceSize.width()) / 2; + } + + if (source.height() > sourceSize.height()) { + offsetY = (source.height() - sourceSize.height()) / 2; + } + + QPoint offsetPoint = source.topLeft(); + offsetPoint += QPoint(offsetX, offsetY); + + return QRect(offsetPoint, sourceSize); +} + +static QRect getDestRect(const QRect &destination, const QRect &source) +{ + qreal screenScale = qreal(destination.width()) / qreal(destination.height()); + qreal pixmapScale = qreal(source.width() / source.height()); + qreal width = source.width(); + qreal height = source.height(); + + if (pixmapScale == screenScale) { + return destination; + } + + qreal scaleWidth = destination.width() / width; + qreal scaleHeight = destination.height() / height; + qreal realPixmapWidth = 0; + qreal realPixmapHeight = 0; + + if(pixmapScale < screenScale){ + //图片比例小于屏幕比例时,按照图片和屏幕高度比进行缩放 + realPixmapWidth = width * scaleHeight; + realPixmapHeight = destination.height(); + }else{ + //图片比例大于屏幕比例时,按照图片与屏幕宽度比进行缩放 + realPixmapWidth = destination.width(); + realPixmapHeight = height * scaleWidth; + } + + QSize sourceSize = destination.size(); + qint32 offsetX = 0; + qint32 offsetY = 0; + if (destination.width() == realPixmapWidth) { + offsetY = (destination.height() - realPixmapHeight) / 2; + sourceSize.setHeight(realPixmapHeight); + } else if (destination.height() == realPixmapHeight) { + offsetX = (destination.width() - realPixmapWidth) / 2; + sourceSize.setWidth(realPixmapWidth); + } + + qDebug() << "=========getDestRect sourceSize:" << sourceSize; + QPoint offsetPoint = destination.topLeft(); + offsetPoint += QPoint(offsetX, offsetY); + + return QRect(offsetPoint, sourceSize); +} + +static QRect getSourceRect(const QRect &source, const QRect &screenGeometry, const QRect &screenVirtualGeometry) +{ + qreal pixWidth = source.width(); + qreal pixHeight = source.height(); + + QSize sourceSize = source.size(); + sourceSize.setWidth(screenGeometry.width() / screenVirtualGeometry.width() * pixWidth); + sourceSize.setHeight(screenGeometry.height() / screenVirtualGeometry.height() * pixHeight); + + qint32 offsetX = 0; + qint32 offsetY = 0; + if (screenGeometry.x() > 0) { + offsetX = (screenGeometry.x() / screenVirtualGeometry.width() * pixWidth); + } + + if (screenGeometry.y() > 0) { + offsetY = (screenGeometry.y() / screenVirtualGeometry.height() * pixHeight); + } + + QPoint offsetPoint = source.topLeft(); + offsetPoint += QPoint(offsetX, offsetY); + + return QRect(offsetPoint, sourceSize); +} + +void setRootWindowBackground(bool type,unsigned int color,char *filename, int nOption) +{ + Imlib_Image img; + + if (!dpy){ + dpy = XOpenDisplay(NULL); + if(!dpy) + return; + } + + int width = 0,height = 0; + + width = QApplication::desktop()->geometry().width()*qApp->devicePixelRatio(); + height = QApplication::desktop()->geometry().height()*qApp->devicePixelRatio(); + + if(!scn) + scn = DefaultScreenOfDisplay(dpy); + if(!root) + root = DefaultRootWindow(dpy); + + if (pix != INVAL_ID) { + XFreePixmap(dpy, pix); + pix = INVAL_ID; + } + pix = XCreatePixmap(dpy, root, width, height, + DefaultDepthOfScreen(scn)); + + imlib_context_set_display(dpy); + imlib_context_set_visual(DefaultVisualOfScreen(scn)); + imlib_context_set_colormap(DefaultColormapOfScreen(scn)); + imlib_context_set_drawable(pix); + + if(type == 0){ + img = imlib_load_image(filename); + if (!img) { + fprintf(stderr, "%s:Unable to load image\n", filename); + return ; + } + imlib_context_set_image(img); + + }else if(type == 1){ + img = imlib_create_image(width, height); + imlib_context_set_image(img); + int blue = color & 0xFF; + int green = color >> 8 & 0xFF; + int red = color >> 16 & 0xFF; + + qDebug()<<"red = "<= rect.width()) { + break; + } + } + drawedHeight += newSrcRect.height(); + if (drawedHeight >= rect.height()) { + break; + } + } + } + break; + case WNDBG_OPTION_ZOOM: // 适应 + { + rect = getDestRect(rect, newSrcRect); + qDebug()<<"Zoom:"<screens()){ + if (screen->name() == sscreen->name()) { + QRect srcRect = getSourceRect(newSrcRect, sscreen->geometry(), screen->virtualGeometry()); + imlib_render_image_part_on_drawable_at_size(srcRect.x(), srcRect.y(), + srcRect.width(), srcRect.height(), + rect.x(), rect.y(), + rect.width(),rect.height()); + break; + } + } + } + break; + default: + { + imlib_render_image_part_on_drawable_at_size(newSrcRect.x(), newSrcRect.y(), + newSrcRect.width(), newSrcRect.height(), + rect.x(), rect.y(), + rect.width(),rect.height()); + } + break; + } + } + + imlib_free_image(); +} + +void updateRootWindowBackground() +{ + // 对比新的屏幕尺寸是否有变化 + if (g_lastRootWndInfo.isValid) { + bool isSame = true; + QList listScreen; + for(QScreen *screen : QApplication::screens()){ + //在每个屏幕上绘制背景 + QRect rect = screen->geometry(); + rect.setX(rect.x()*screen->devicePixelRatio()); + rect.setY(rect.y()*screen->devicePixelRatio()); + rect.setWidth(rect.width()*screen->devicePixelRatio()); + rect.setHeight(rect.height()*screen->devicePixelRatio()); + listScreen.append(rect); + } + qDebug()<<"ScreenRects:"< g_lastRootWndInfo.listScreen.size()) { + isSame = false; + } else { + for (int n = 0; n < listScreen.size(); n++) { + if (n < g_lastRootWndInfo.listScreen.size()) { + if (g_lastRootWndInfo.listScreen[n] != listScreen[n]) { + isSame = false; + break; + } + } + } + } + if (!isSame) { + setRootWindowBackground(g_lastRootWndInfo.nType, g_lastRootWndInfo.nColor, + g_lastRootWndInfo.strFileName.toLatin1().data(), g_lastRootWndInfo.nOption); + } + } +} + +void drawBackground(bool isDraw) +{ + if (!dpy) { + return ; + } + if (isDraw) { + if (pix != INVAL_ID) + XSetWindowBackgroundPixmap(dpy, root, pix); + XClearWindow(dpy, root); + } + + while (XPending(dpy)) { + XEvent ev; + XNextEvent(dpy, &ev); + } + if (pix != INVAL_ID) { + XFreePixmap(dpy, pix); + pix = INVAL_ID; + } + XCloseDisplay(dpy); + dpy = NULL; +} + + diff --git a/VirtualKeyboard/src/cursormonitor.h b/src/rootWindowBackground.h similarity index 50% rename from VirtualKeyboard/src/cursormonitor.h rename to src/rootWindowBackground.h index 7722453..5cd0860 100644 --- a/VirtualKeyboard/src/cursormonitor.h +++ b/src/rootWindowBackground.h @@ -1,9 +1,9 @@ -/** +/* * Copyright (C) 2018 Tianjin KYLIN Information Technology 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 2, or (at your option) + * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, @@ -12,25 +12,19 @@ * 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, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. + * along with this program; if not, see . + * **/ -#ifndef CURSORMONITOR_H -#define CURSORMONITOR_H -#include -#include +typedef enum WNDBG_OPTION_e{ + WNDBG_OPTION_SCALED, // 填充 + WNDBG_OPTION_STRETCHED, // 拉伸 + WNDBG_OPTION_CENTERED, // 居中 + WNDBG_OPTION_WALLPAPER, // 平铺 + WNDBG_OPTION_ZOOM, // 适应 + WNDBG_OPTION_SPANNED // 跨区 +}WNDBG_OPTION; -class CursorMonitor : public QThread -{ - Q_OBJECT -public: - explicit CursorMonitor(QObject *parent = nullptr); - void run(); - -Q_SIGNALS: - void cursorPosChanged(const QPoint& pos); -}; - -#endif // CURSORMONITOR_H +void setRootWindowBackground(bool type,unsigned int color,char *filename, int nOption = 0); +void updateRootWindowBackground(); +void drawBackground(bool isDraw); diff --git a/src/screensaverwidget.cpp b/src/screensaverwidget.cpp index 48d2a43..36bd944 100644 --- a/src/screensaverwidget.cpp +++ b/src/screensaverwidget.cpp @@ -106,7 +106,7 @@ void ScreenSaverWidget::paintEvent(QPaintEvent *event) if(!screensaver->exists()) { QPainter painter(this); - painter.fillRect(geometry(), Qt::black); + painter.fillRect(0,0,this->width(),this->height(), Qt::black); } if(screensaver->mode == SAVER_IMAGE) { switch(screensaver->effect) { @@ -115,7 +115,7 @@ void ScreenSaverWidget::paintEvent(QPaintEvent *event) QPixmap pixmap(screensaver->path); pixmap.scaled(size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); QPainter painter(this); - painter.drawPixmap(geometry(), pixmap); + painter.drawPixmap(0,0,this->width(),this->height(), pixmap); break; } case TRANSITION_FADE_IN_OUT: @@ -124,17 +124,15 @@ void ScreenSaverWidget::paintEvent(QPaintEvent *event) QPixmap pixmap1(screensaver->lastPath); pixmap1.scaled(size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); painter.setOpacity(opacity); - painter.drawPixmap(geometry(), pixmap1); + painter.drawPixmap(0,0,this->width(),this->height(), pixmap1); QPixmap pixmap(screensaver->path); pixmap.scaled(size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); painter.setOpacity(1 - opacity); - painter.drawPixmap(geometry(), pixmap); + painter.drawPixmap(0,0,this->width(),this->height(), pixmap); break; } } - - } return QWidget::paintEvent(event); } @@ -143,7 +141,9 @@ bool ScreenSaverWidget::eventFilter(QObject *obj, QEvent *event) { if(event->type() == 23) { - XSetInputFocus(QX11Info::display(),this->winId(),RevertToParent,CurrentTime); + if(QX11Info::isPlatformX11()){ + XSetInputFocus(QX11Info::display(),this->winId(),RevertToParent,CurrentTime); + } } return false; } @@ -172,7 +172,7 @@ void ScreenSaverWidget::embedXScreensaver(const QString &path) void ScreenSaverWidget::resizeEvent(QResizeEvent *event) { if(m_screensaver){ - m_screensaver->setGeometry(this->geometry()); + m_screensaver->setGeometry(0,0,this->width(),this->height()); } } diff --git a/src/screensaverwndadaptor.cpp b/src/screensaverwndadaptor.cpp index 34761ed..8d4b9a5 100644 --- a/src/screensaverwndadaptor.cpp +++ b/src/screensaverwndadaptor.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 . + * +**/ #include "screensaverwndadaptor.h" #include diff --git a/src/screensaverwndadaptor.h b/src/screensaverwndadaptor.h index 0641c0c..77c3dde 100644 --- a/src/screensaverwndadaptor.h +++ b/src/screensaverwndadaptor.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 SCREENSAVERWNDADAPTOR_H #define SCREENSAVERWNDADAPTOR_H diff --git a/src/sessionwatcher.cpp b/src/sessionwatcher.cpp index 1f4d7a5..be05ab5 100644 --- a/src/sessionwatcher.cpp +++ b/src/sessionwatcher.cpp @@ -21,6 +21,7 @@ #include #include #include "types.h" +#include "glibinterface.h" #define GSETTINGS_SCHEMA_SCREENSAVER "org.ukui.screensaver" #define KEY_IDLE_DELAY "idleDelay" @@ -28,6 +29,8 @@ #define KEY_IDLE_ACTIVATION_ENABLED "idleActivationEnabled" #define KEY_IDLE_LOCK_ENABLED "idleLockEnabled" #define TIME_TYPE_SCHEMA "org.ukui.control-center.panel.plugins" +#define KEY_LOCK_TIMEOUT "lockTimeout" +#define STYLE_TYPE_SCHEMA "org.ukui.style" #define GSETTINGS_SCHEMA_SCREENSAVER_DEFAULT "org.ukui.screensaver-default" #define KEY_SHOW_REST_TIME "showRestTime" // old @@ -39,11 +42,14 @@ #define UPOWER_PATH "/org/freedesktop/UPower" #define UPOWER_SERVICE "org.freedesktop.UPower" #define UPOWER_DISPLAY_PATH "/org/freedesktop/UPower/devices/DisplayDevice" +#define G_FONT_SIZE (11.0) SessionWatcher::SessionWatcher(QObject *parent) : QObject(parent) { sessionPath = qgetenv("XDG_SESSION_PATH"); + defaultFontSize = getDefaultFontSize(); + QDBusInterface *interface = new QDBusInterface( SM_DBUS_SERVICE, SM_DBUS_PATH, @@ -83,6 +89,10 @@ SessionWatcher::SessionWatcher(QObject *parent) : QObject(parent) } idleDelay = m_ssSettings->get("idle-delay").toInt(); idleLock = m_ssSettings->get("idle-lock").toInt(); + + if (keysScreenSaver.contains(KEY_LOCK_TIMEOUT)) { + m_nLockTimeout = m_ssSettings->get("lock-timeout").toInt(); + } } if(QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA_SCREENSAVER_DEFAULT)){ @@ -142,14 +152,23 @@ SessionWatcher::SessionWatcher(QObject *parent) : QObject(parent) file.setPermissions(QFile::WriteUser | QFile::ReadUser | QFile::WriteOther | QFile::ReadOther); } configSettings = new QSettings(configPath, QSettings::IniFormat, this); - if(QGSettings::isSchemaInstalled(TIME_TYPE_SCHEMA)) + if (QGSettings::isSchemaInstalled(TIME_TYPE_SCHEMA)) { timegsettings = new QGSettings(TIME_TYPE_SCHEMA,"",this); - int timeType = timegsettings->get("hoursystem").toInt(); - setValue("timeType",timeType); - QString dateType = timegsettings->get("date").toString(); - setValue("dateType",dateType); - connect(timegsettings, &QGSettings::changed, - this, &SessionWatcher::onConfigurationTimeTpChanged); + int timeType = timegsettings->get("hoursystem").toInt(); + setValue("timeType",timeType); + QString dateType = timegsettings->get("date").toString(); + setValue("dateType",dateType); + connect(timegsettings, &QGSettings::changed, + this, &SessionWatcher::onConfigurationTimeTpChanged); + } + + if (QGSettings::isSchemaInstalled(STYLE_TYPE_SCHEMA)) { + stylesettings = new QGSettings(STYLE_TYPE_SCHEMA,"",this); + double fontSize = stylesettings->get("systemFontSize").toDouble(); + setValue("fontSize",fontSize - defaultFontSize); + connect(stylesettings, &QGSettings::changed, + this, &SessionWatcher::onConfigurationTimeTpChanged); + } // 监听合盖信号 QDBusConnection::systemBus().connect( @@ -162,20 +181,22 @@ void SessionWatcher::onSSConfigChanged(QString strKey) idleDelay = m_ssSettings->get("idle-delay").toInt(); } else if (strKey == KEY_IDLE_LOCK){ idleLock = m_ssSettings->get("idle-lock").toInt(); + } else if (strKey == KEY_LOCK_TIMEOUT) { + m_nLockTimeout = m_ssSettings->get("lock-timeout").toInt(); } } void SessionWatcher::onConfigurationTimeTpChanged(QString key) { - if(key == "hoursystem"){ + if (key == "hoursystem") { int timeType = timegsettings->get("hoursystem").toInt(); setValue("timeType",timeType); - } - if(key == "date"){ - qDebug()<<"jinlaile~~~~~~~~~~~~~~key="<get("date").toString(); - qDebug()<<"lsadjfldsa"<get("systemFontSize").toDouble() - defaultFontSize; + setValue("fontSize", fontSize); } } @@ -305,6 +326,11 @@ int SessionWatcher::idledelay() return idleDelay; } +int SessionWatcher::locktimeout() +{ + return m_nLockTimeout; +} + bool SessionWatcher::isLidCloseWithBlank() { if (!m_pmSettings) diff --git a/src/sessionwatcher.h b/src/sessionwatcher.h index 0d5419d..2c4a56d 100644 --- a/src/sessionwatcher.h +++ b/src/sessionwatcher.h @@ -38,6 +38,7 @@ public: int closeActivationDelay(); int idledelay(); bool isLidCloseWithBlank(); // 合盖关屏 + int locktimeout(); Q_SIGNALS: void sessionIdle(); @@ -59,11 +60,14 @@ private: QGSettings *m_ssSettings = nullptr; QGSettings *m_pmSettings = nullptr; QGSettings *m_sdSettings = nullptr; + QGSettings *stylesettings = nullptr; int idleDelay = -1; int idleLock = -1; + int m_nLockTimeout = -1; QTimer *m_timer = nullptr; QTimer *m_timer2 = nullptr; bool m_lidState = false; + double defaultFontSize; }; #endif // SESSIONWATCHER_H diff --git a/src/surewindow.cpp b/src/surewindow.cpp index 8ee86e4..ee7e4eb 100644 --- a/src/surewindow.cpp +++ b/src/surewindow.cpp @@ -1,13 +1,35 @@ +/* + * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 . + * +**/ #include "surewindow.h" #include "ui_surewindow.h" +#include "configuration.h" #include #include + SureWindow::SureWindow(QWidget *parent) : QWidget(parent), - ui(new Ui::SureWindow) + ui(new Ui::SureWindow), + configuration(Configuration::instance()) { ui->setupUi(this); - ui->tipLabel->setStyleSheet("color:white;font:14pt;"); + curFontSize = configuration->getFontSize(); + m_ptToPx = configuration->getPtToPx(); + ui->tipLabel->setFontSize(14 + curFontSize); //ui->tipLabel->setWordWrap(true); connect(ui->cancelBtn, &QPushButton::clicked, this, [&]() { emit cantelButtonclicked(); }); connect(ui->confirmBtn, &QPushButton::clicked, this, [&]() { emit confirmButtonclicked(); }); @@ -20,13 +42,15 @@ SureWindow::~SureWindow() void SureWindow::setTips(const QString tips) { - ui->cancelBtn->setStyleSheet("QPushButton{background: rgba(255, 255, 255, 0.2);border-radius: 8px;}" - "QPushButton:hover{background: rgba(255, 255, 255, 0.4);border-radius: 8px;}" - "QPushButton:pressed {background: rgba(255, 255, 255, 0.3);border-radius: 8px;}"); - - ui->confirmBtn->setStyleSheet("QPushButton{background: rgba(255, 255, 255, 0.2);border-radius: 8px;}" + ui->cancelBtn->setStyleSheet("QPushButton{background: rgba(255, 255, 255, 0.2);border-radius: 8px;color: white;}" "QPushButton:hover{background: rgba(255, 255, 255, 0.4);border-radius: 8px;}" "QPushButton:pressed {background: rgba(255, 255, 255, 0.3);border-radius: 8px;}"); + ui->confirmBtn->setStyleSheet("QPushButton{background: rgba(255, 255, 255, 0.2);border-radius: 8px;color: white;}" + "QPushButton:hover{background: rgba(255, 255, 255, 0.4);border-radius: 8px;}" + "QPushButton:pressed {background: rgba(255, 255, 255, 0.3);border-radius: 8px;}"); + sysFont.setPointSize((16 + curFontSize) *m_ptToPx); + ui->confirmBtn->setFont(sysFont); + ui->cancelBtn->setFont(sysFont); ui->confirmBtn->show(); ui->tipLabel->show(); ui->listView->hide(); @@ -70,7 +94,9 @@ void SureWindow::setWarning(QVector &list, int type) } ui->listView->verticalScrollMode(); - ui->listView->setStyleSheet("font:10pt;color:white; background-color: rgba(255,255,255,30%); border-radius: 12px;"); + ui->listView->setStyleSheet("color:white; background-color: rgba(255,255,255,30%); border-radius: 12px;"); + sysFont.setPointSize((10 + curFontSize) *m_ptToPx); + ui->listView->setFont(sysFont); ui->listView->setEditTriggers(QAbstractItemView::NoEditTriggers); ui->listView->setIconSize(QSize(32,32)); ui->listView->setModel(model); @@ -79,8 +105,9 @@ void SureWindow::setWarning(QVector &list, int type) ui->cancelBtn->setFixedSize(120, 48); ui->confirmBtn->hide(); - ui->cancelBtn->setStyleSheet("QPushButton{background: rgba(255, 255, 255, 0.2);border-radius: 24px;}" - "QPushButton:hover{background: rgba(255, 255, 255, 0.4);border-radius: 24px;}" - "QPushButton:pressed {background: rgba(255, 255, 255, 0.3);border-radius: 24px;}"); - + ui->cancelBtn->setStyleSheet("QPushButton{background: rgba(255, 255, 255, 0.2);border-radius: 8px;color: white;}" + "QPushButton:hover{background: rgba(255, 255, 255, 0.4);border-radius: 8px;}" + "QPushButton:pressed {background: rgba(255, 255, 255, 0.3);border-radius: 8px;}"); + sysFont.setPointSize((16 + curFontSize) *m_ptToPx); + ui->cancelBtn->setFont(sysFont); } diff --git a/src/surewindow.h b/src/surewindow.h index 8f15d27..7d49b31 100644 --- a/src/surewindow.h +++ b/src/surewindow.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 SUREWINDOW_H #define SUREWINDOW_H @@ -8,6 +25,8 @@ namespace Ui { class SureWindow; } +class Configuration; + class SureWindow : public QWidget { Q_OBJECT @@ -25,6 +44,12 @@ private: Q_SIGNALS: void cantelButtonclicked(); void confirmButtonclicked(); + +private: + Configuration *configuration; + double curFontSize = 0; + double m_ptToPx = 1.0; + QFont sysFont; }; #endif // SUREWINDOW_H diff --git a/src/surewindow.ui b/src/surewindow.ui index 278cab5..e2aea7a 100644 --- a/src/surewindow.ui +++ b/src/surewindow.ui @@ -46,7 +46,7 @@
- + Noto Sans CJK SC @@ -207,6 +207,13 @@
+ + + KLabel + QLabel +
klabel.h
+
+
diff --git a/src/tabletlockwidget.cpp b/src/tabletlockwidget.cpp index ff972bc..9a18136 100644 --- a/src/tabletlockwidget.cpp +++ b/src/tabletlockwidget.cpp @@ -35,7 +35,7 @@ #include "tabletlockwidget.h" #include "authdialog.h" -#include "virtualkeyboard.h" +#include "virtualkeyboardwidget.h" #include "users.h" #include "displaymanager.h" #include "weathermanager.h" @@ -62,7 +62,7 @@ TabletLockWidget::TabletLockWidget(QWidget *parent) : m_pb_powerManager(new QPushButton(this)), m_pb_networkManager(new QPushButton(this)), m_vKeyboardPB(new QPushButton(this)), - m_vKeyboard(new VirtualKeyboard(this)), + m_vKeyboard(new VirtualKeyboardWidget(this)), m_cancelOrBack(new QPushButton(this)), m_pb_skip(new QPushButton(this)), m_verificationWidget(new VerificationWidget(this)), @@ -166,8 +166,8 @@ void TabletLockWidget::initUI() //虚拟键盘 m_vKeyboard->hide(); - connect(m_vKeyboard, &VirtualKeyboard::aboutToClose, - m_vKeyboard, &VirtualKeyboard::hide); + connect(m_vKeyboard, &VirtualKeyboardWidget::aboutToClose, + m_vKeyboard, &VirtualKeyboardWidget::hide); m_vKeyboardPB->setIcon(QIcon(":/image/assets/intel/keyboard.png")); m_vKeyboardPB->setFixedSize(48,48); @@ -234,9 +234,9 @@ void TabletLockWidget::initUI() //Todo 1、锁屏 -》息屏 m_digitalAuthDialog->reset(); Q_EMIT blackSaver(); -#ifdef USE_INTEL +#ifdef USE_INTEL powermanager->hibernate(); -#endif +#endif } else { m_digitalAuthDialog->reset(); m_cancelOrBack->setIcon(QIcon(":/image/assets/intel/cancel.png")); @@ -348,7 +348,7 @@ void TabletLockWidget::initConnect() updateNetIcon(m_kylinNM->getConnectStatus()); }); - connect(m_vKeyboard, &VirtualKeyboard::aboutToClose, m_vKeyboard, [=](){ + connect(m_vKeyboard, &VirtualKeyboardWidget::aboutToClose, m_vKeyboard, [=](){ if(m_vKeyboard->isHidden() && m_kylinNM->isVisible()) { m_kylinNM->setGeometry(this->width() - m_kylinNM->width() - 20, this->height() - m_kylinNM->height() - 100, diff --git a/src/tabletlockwidget.h b/src/tabletlockwidget.h index dba18d7..8acf3b7 100644 --- a/src/tabletlockwidget.h +++ b/src/tabletlockwidget.h @@ -30,7 +30,7 @@ #include #include -class VirtualKeyboard; +class VirtualKeyboardWidget; class PowerManager; class AuthDialog; class Users; @@ -104,7 +104,7 @@ protected: private: AuthDialog *authDialog; - VirtualKeyboard *m_vKeyboard; + VirtualKeyboardWidget *m_vKeyboard; PowerManager *powermanager; QTimer *timer; QMenu *usersMenu; diff --git a/src/types.h b/src/types.h index 76b1fd1..7153a28 100644 --- a/src/types.h +++ b/src/types.h @@ -60,6 +60,10 @@ enum ScreenStatus #define SSWND_DBUS_PATH "/" #define SSWND_DBUS_INTERFACE "org.ukui.ScreenSaverWnd" +#define DESKTOP_DBUS_SERVICE "org.ukui.peony" +#define DESKTOP_DBUS_PATH "/org/ukui/peony" +#define DESKTOP_DBUS_INTERFACE "org.ukui.peony" + #define BIO_ERROR -1 #define BIO_FAILED 0 #define BIO_SUCCESS 1 diff --git a/src/ukss_interface.cpp b/src/ukss_interface.cpp new file mode 100644 index 0000000..11ea9bd --- /dev/null +++ b/src/ukss_interface.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2023 Tianjin KYLIN Information Technology 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, 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 . + * +**/ + +#include "ukss_interface.h" +#include +#include + +int LockByBlank(QString strReason) +{ + QProcess procCmd; + QString strCmd = QString("ukui-screensaver-command -b %1").arg(strReason); + qDebug()<<"LockByBlank,CMD:"<. + * +**/ +#ifndef __UKSS_INTERFACE_H__ +#define __UKSS_INTERFACE_H__ + +#include + +#if defined(UKSSSO_LIBRARY) +# define UKSSSO_EXPORT Q_DECL_EXPORT +#else +# define UKSSSO_EXPORT Q_DECL_IMPORT +#endif + +extern "C" UKSSSO_EXPORT int LockByBlank(QString strReason); + +#endif // __UKSS_INTERFACE_H__ diff --git a/src/ukui-screensaver-backend.cpp b/src/ukui-screensaver-backend.cpp index 31783b0..87ca85d 100644 --- a/src/ukui-screensaver-backend.cpp +++ b/src/ukui-screensaver-backend.cpp @@ -63,9 +63,14 @@ int main(int argc, char *argv[]) ScreenSaverAdaptor adaptor(interface); QDBusConnection service = QDBusConnection::sessionBus(); - if(!service.registerService(SS_DBUS_SERVICE)) { - qDebug() << service.lastError().message(); - exit(EXIT_FAILURE); + QString sessionDbus = SS_DBUS_SERVICE; + if(!service.registerService(sessionDbus)) { + QString displayNum = QString(qgetenv("DISPLAY")).replace(":", "").replace(".", "_");; + sessionDbus = QString("%1%2").arg(QString(SS_DBUS_SERVICE)).arg(displayNum); + if(!service.registerService(sessionDbus)) { + qDebug() << service.lastError().message(); + exit(EXIT_FAILURE); + } } if(!service.registerObject(SS_DBUS_PATH, SS_DBUS_SERVICE, &adaptor, QDBusConnection::ExportAllSlots | diff --git a/src/ukui-screensaver-checkpass.cpp b/src/ukui-screensaver-checkpass.cpp index 6f48647..165259d 100644 --- a/src/ukui-screensaver-checkpass.cpp +++ b/src/ukui-screensaver-checkpass.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2018 Tianjin KYLIN Information Technology 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, 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 . + * +**/ #include #include #include diff --git a/src/ukui-screensaver-command.cpp b/src/ukui-screensaver-command.cpp index 1ce2d54..c18808c 100644 --- a/src/ukui-screensaver-command.cpp +++ b/src/ukui-screensaver-command.cpp @@ -24,6 +24,7 @@ #include #include "types.h" #include +#include #define WORKING_DIRECTORY "/usr/share/ukui-screensaver" @@ -53,20 +54,31 @@ int main(int argc, char **argv) QCoreApplication::translate("main", "unlock the screen saver")); QCommandLineOption screensaverOption({"s", QStringLiteral("screensaver")}, QCoreApplication::translate("main", "show the screensaver")); + QCommandLineOption blankOption({"b", QStringLiteral("blank")}, + QCoreApplication::translate("main", "show blank and delay to lock,param:idle/lid/lowpower"), "lid"); parser.addOption(lockOption); parser.addOption(queryOption); parser.addOption(unlockOption); parser.addOption(screensaverOption); + parser.addOption(blankOption); parser.process(a); - if(!parser.isSet(lockOption) && !parser.isSet(queryOption) && !parser.isSet(unlockOption) && !parser.isSet(screensaverOption)) + if(!parser.isSet(lockOption) && !parser.isSet(queryOption) && !parser.isSet(unlockOption) + && !parser.isSet(screensaverOption) && !parser.isSet(blankOption)) return -1; - QDBusInterface *interface = new QDBusInterface(SS_DBUS_SERVICE, + QString displayNum = QString(qgetenv("DISPLAY")).replace(":", "").replace(".", "_"); + QString sessionDbus = QString("%1%2").arg(QString(SS_DBUS_SERVICE)).arg(displayNum); + QDBusInterface *interface = new QDBusInterface(sessionDbus, SS_DBUS_PATH, SS_DBUS_INTERFACE); - + if (!interface->isValid()) { + delete interface; + interface = new QDBusInterface(SS_DBUS_SERVICE, + SS_DBUS_PATH, + SS_DBUS_INTERFACE); + } QDBusReply stateReply = interface->call("GetLockState"); if(!stateReply.isValid()){ qWarning()<< "Get state error:" << stateReply.error(); @@ -90,6 +102,36 @@ int main(int argc, char **argv) QDBusMessage msg = interface->call("ShowScreensaver"); if(msg.type() == QDBusMessage::ErrorMessage) qDebug() << msg.errorMessage(); + } else if (parser.isSet(blankOption) && !stateReply) { + int nLockType = 0; + qDebug()<<"Param:"< bLockSuccess = interface->call("LockByBlank", nLockType); + if(bLockSuccess.isValid() && bLockSuccess.value()) { + bool isLocked = false; + for (int n = 0; n < 20; n++) { + QDBusReply reply = interface->call("GetLockState"); + if (reply.isValid()) { + isLocked = reply.value(); + } + if (isLocked) { + qDebug()<<"LockState:"< #include #include +#include "plasma-shell-manager.h" #include #include #include @@ -156,23 +157,30 @@ int main(int argc, char *argv[]) //命令行参数解析 QCommandLineParser parser; - parser.setApplicationDescription(QCoreApplication::translate("main", "Dialog for the ukui ScreenSaver.")); + parser.setApplicationDescription(QGuiApplication::translate("main", "Dialog for the ukui ScreenSaver.")); parser.addHelpOption(); parser.addVersionOption(); + parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions); // 举例说明:将 "-adb" 当成一个选项来看,而不是看成 "-a -b -c" QCommandLineOption lockOption(QStringLiteral("lock"), - QCoreApplication::translate("main", "lock the screen immediately")); + QGuiApplication::translate("main", "lock the screen immediately")); QCommandLineOption lstOption(QStringLiteral("lock-startup"), - QCoreApplication::translate("main", "lock the screen immediately")); + QGuiApplication::translate("main", "lock the screen immediately")); QCommandLineOption sessionIdleOption(QStringLiteral("session-idle"), - QCoreApplication::translate("main", "activated by session idle signal")); + QGuiApplication::translate("main", "activated by session idle signal")); QCommandLineOption lscreensaverOption(QStringLiteral("lock-screensaver"), - QCoreApplication::translate("main", "lock the screen and show screensaver immediately")); + QGuiApplication::translate("main", "lock the screen and show screensaver immediately")); QCommandLineOption screensaverOption(QStringLiteral("screensaver"), - QCoreApplication::translate("main", "show screensaver immediately")); + QGuiApplication::translate("main", "show screensaver immediately")); QCommandLineOption blankOption(QStringLiteral("blank"), - QCoreApplication::translate("main", "lock the screen and show screensaver immediately")); - parser.addOptions({lockOption, lstOption,sessionIdleOption , screensaverOption,blankOption,lscreensaverOption}); + QGuiApplication::translate("main", "lock the screen and show screensaver immediately")); + QCommandLineOption delayOption(QStringLiteral("delay"), + QGuiApplication::translate("main", "show blank screensaver immediately and delay time to show lock"), + QGuiApplication::translate("delay", "how long to show lock"), "0"); + QCommandLineOption hasLockOption(QStringLiteral("has-lock"), + QGuiApplication::translate("main", "show blank screensaver immediately and if lock"), + QGuiApplication::translate("has-lock", "if show lock"), "1"); + parser.addOptions({lockOption, lstOption,sessionIdleOption , screensaverOption,blankOption,lscreensaverOption,delayOption,hasLockOption}); parser.process(a); if(!parser.isSet(sessionIdleOption) @@ -206,9 +214,14 @@ int main(int argc, char *argv[]) ScreenSaverWndAdaptor adaptorWnd(window); QDBusConnection service = QDBusConnection::sessionBus(); + QString sessionDbus = SSWND_DBUS_SERVICE; if(!service.registerService(SSWND_DBUS_SERVICE)) { - qDebug() << service.lastError().message(); - return 1; + QString displayNum = QString(qgetenv("DISPLAY")).replace(":", "").replace(".", "_");; + sessionDbus = QString("%1%2").arg(QString(SSWND_DBUS_SERVICE)).arg(displayNum); + if(!service.registerService(sessionDbus)) { + qDebug() << service.lastError().message(); + return 1; + } } if(!service.registerObject(SSWND_DBUS_PATH, SSWND_DBUS_SERVICE, &adaptorWnd, QDBusConnection::ExportAllSlots | @@ -221,11 +234,29 @@ int main(int argc, char *argv[]) if(parser.isSet(blankOption)) { - window->onBlankScreensaver(); + int nDelay = 0; + bool isHasLock = true; + if (parser.isSet(delayOption)){ + int nDelayValue = parser.value(delayOption).toInt(); + if (nDelayValue > 0) { + nDelay = nDelayValue; + } + } + if (parser.isSet(hasLockOption)){ + int nHasLockValue = parser.value(hasLockOption).toInt(); + if (nHasLockValue == 0) { + isHasLock = false; + } + } + qDebug()<<"-------------:"<onBlankScreensaver(nDelay, isHasLock); } #ifndef USE_INTEL - window->show(); + if (QString(qgetenv("XDG_SESSION_TYPE")) == "wayland") + window->show(); + else + window->show(); window->activateWindow(); #endif if(parser.isSet(lockOption)) @@ -266,6 +297,16 @@ int main(int argc, char *argv[]) window->show(); window->activateWindow(); #endif + + + bool isWayland = false; + if(QString(qgetenv("XDG_SESSION_TYPE")) == "wayland") { + isWayland = true; + } + if (isWayland){ + PlasmaShellManager::getInstance(); + PlasmaShellManager::getInstance()->setAppWindowKeepAbove(true); + } QString username = getenv("USER"); int uid = getuid(); diff --git a/src/users.cpp b/src/users.cpp index 03c87e6..1e4a305 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -40,8 +40,15 @@ Users::Users(QObject *parent) : QObject(parent) if (Utils::isCommunity()) { defaultIcon = ":/image/assets/01-default-community.png"; } else { - defaultIcon = ":/image/assets/01-default-commercial.png"; + //优先读取控制面板的默认头像文件,保持登录锁屏默认头像和控制面板一致 + QFile faceFile("/usr/share/ukui/faces/default.png"); + if(faceFile.exists()){ + defaultIcon = "/usr/share/ukui/faces/default.png"; + }else{ + defaultIcon = ":/image/assets/01-default-commercial.png"; + } } + loadUsers(); } diff --git a/src/utils.cpp b/src/utils.cpp index e5b7f50..dc5e9bc 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2018 Tianjin KYLIN Information Technology 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, 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 . + * +**/ #include "utils.h" #include diff --git a/src/utils.h b/src/utils.h index 4966654..b00b483 100644 --- a/src/utils.h +++ b/src/utils.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2022 Tianjin KYLIN Information Technology 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, 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 UTILS_H #define UTILS_H diff --git a/src/verificationwidget.cpp b/src/verificationwidget.cpp index edbb92f..9acb3e4 100644 --- a/src/verificationwidget.cpp +++ b/src/verificationwidget.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 . + * +**/ #include "verificationwidget.h" #include #include diff --git a/src/verificationwidget.h b/src/verificationwidget.h index cbc13e7..973017e 100644 --- a/src/verificationwidget.h +++ b/src/verificationwidget.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 VERIFICATIONWIDGET_H #define VERIFICATIONWIDGET_H diff --git a/src/verticalVerificationwidget.cpp b/src/verticalVerificationwidget.cpp index 1dd912a..e848a45 100644 --- a/src/verticalVerificationwidget.cpp +++ b/src/verticalVerificationwidget.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 . + * +**/ #include "verticalVerificationwidget.h" #include #include diff --git a/src/verticalVerificationwidget.h b/src/verticalVerificationwidget.h index 749dadc..26a94d4 100644 --- a/src/verticalVerificationwidget.h +++ b/src/verticalVerificationwidget.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2020 Tianjin KYLIN Information Technology 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, 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 VERTICALVERIFICATIONWIDGET_H #define VERTICALVERIFICATIONWIDGET_H