merge from upstream/4.0.0.0

This commit is contained in:
winnerym 2023-04-26 20:29:38 +08:00
parent 642b69d412
commit 56a68b54d8
140 changed files with 6678 additions and 3432 deletions

View File

@ -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})

View File

@ -66,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:
@ -125,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>("DeviceInfo");
qDBusRegisterMetaType<DeviceInfo>();
qRegisterMetaType<FeatureInfo>("FeatureInfo");
qDBusRegisterMetaType<FeatureInfo>();
}

View File

@ -211,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<DeviceInfo> DeviceInfoPtr;
typedef QList<DeviceInfoPtr> DeviceList;
typedef QMap<int, DeviceList> DeviceMap;
typedef std::shared_ptr<FeatureInfo> FeatureInfoPtr;
typedef QList<FeatureInfoPtr> FeatureList;
typedef QMap<QString, FeatureList> FeatureMap;
QDebug operator <<(QDebug stream, const DeviceInfo &deviceInfo);
Q_DECLARE_METATYPE(DeviceInfo)
Q_DECLARE_METATYPE(FeatureInfo)
/**
* @brief
@ -265,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

View File

@ -17,6 +17,7 @@
**/
#include "biometricproxy.h"
#include <QDebug>
#include <QDBusArgument>
BiometricProxy::BiometricProxy(QObject *parent)
: QDBusAbstractInterface(BIOMETRIC_DBUS_SERVICE,
@ -36,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<QVariant> argList;
argList << drvid << type << uid;
return asyncCallWithArgumentList(QStringLiteral("UkeyIdentify"), argList);
}
bool BiometricProxy::GetHasUkeyFeature(int uid, int indexStart, int indexEnd)
{
QList<QDBusVariant> 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<QVariant> variantList = result.arguments();
listsize = variantList[0].value<int>();
variantList[1].value<QDBusArgument>() >> qlist;
for (int i = 0; i < listsize; i++) {
featureInfo = new FeatureInfo;
qlist[i].variant().value<QDBusArgument>() >> *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"));
@ -67,6 +103,17 @@ int BiometricProxy::GetFeatureCount(int uid, int indexStart, int indexEnd)
return res;
}
int BiometricProxy::SetExtraInfo(QString info_type,QString extra_info)
{
QDBusReply<int> 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<int> reply = call(QStringLiteral("StopOps"), drvid, waiting);
@ -144,6 +191,28 @@ DeviceList BiometricProxy::GetDevList()
return deviceList;
}
FeatureMap BiometricProxy::GetUserFeatures(int uid)
{
FeatureMap featureMap;
QList<QDBusVariant> qlist;
int listsize;
QDBusMessage result = call(QStringLiteral("GetAllFeatureList"), uid, 0, -1);
if(result.type() == QDBusMessage::ErrorMessage)
{
qWarning() << "GetDevList error:" << result.errorMessage();
return featureMap;
}
QList<QVariant> variantList = result.arguments();
listsize = variantList[0].value<int>();
variantList[1].value<QDBusArgument>() >> qlist;
for (int i = 0; i < listsize; i++) {
FeatureInfoPtr pFeatureInfo = std::make_shared<FeatureInfo>();
qlist[i].variant().value<QDBusArgument>() >> *pFeatureInfo;
featureMap[pFeatureInfo->device_shortname].append(pFeatureInfo);
}
return featureMap;
}
int BiometricProxy::GetDevCount()
{
QDBusMessage result = call(QStringLiteral("GetDevList"));

View File

@ -64,6 +64,21 @@ public Q_SLOTS:
* @return <int result, int uid> id)
*/
QDBusPendingCall Identify(int drvid, int uid, int indexStart = 0, int indexEnd = -1);
/**
* @brief 使id的设备进行用户认证
* @param drvid id
* @param type ukey的认证类型2pin认证setExtraInfo设置pin码,3
* @param uid id
* @return <int result, int uid> id)
*/
QDBusPendingCall UkeyIdentify(int drvid, int type, int uid);
/**
* @brief
* @param info_type ukey pincode认证时传 "pincode"
* @param extra_info ukey pincode认证时传PIN码内容
* @return <int result> )
*/
int SetExtraInfo(QString info_type, QString extra_info);
/**
* @brief
* @param drvid id
@ -79,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
@ -116,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:
/**

View File

@ -17,7 +17,7 @@
**/
#include "giodbus.h"
#include <gio/gio.h>
#include <gio-unix-2.0/gio/gunixfdlist.h>
#include <gio/gunixfdlist.h>
#include <glib.h>
int get_server_gvariant_stdout (int drvid)

View File

@ -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)

View File

@ -23,6 +23,8 @@
#include <QFont>
#include <QPixmap>
#define G_FONT_SIZE (11.0)
bool ispicture(QString filepath);
QString getSystemVersion();
QString getSystemDistrib();

48
Common/glibinterface.cpp Normal file
View File

@ -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 <http://www.gnu.org/licenses/>.
*
**/
#include "glibinterface.h"
#include <QString>
#include <gio/gio.h>
#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;
}

24
Common/glibinterface.h Normal file
View File

@ -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 <http://www.gnu.org/licenses/>.
*
**/
#ifndef GLIBINTERFACE_H
#define GLIBINTERFACE_H
double getDefaultFontSize();
#endif // LOCKWIDGET_H

View File

@ -15,6 +15,7 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
**/
#include "plasma-shell-manager.h"
#include <QApplication>
@ -129,8 +130,40 @@ 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());
@ -161,15 +194,15 @@ PlasmaShellManager::PlasmaShellManager(QObject *parent) : QObject(parent)
m_appWindow = window;
connect(m_appWindow, &KWayland::Client::PlasmaWindow::activeChanged,
[this]() {
this->setAppWindowKeepAbove(true);
this->setAppWindowActive();
});
[this]() {
this->setAppWindowKeepAbove(true);
this->setAppWindowActive();
});
connect(m_appWindow, &KWayland::Client::PlasmaWindow::keepAboveChanged,
[this]() {
this->setAppWindowKeepAbove(true);
this->setAppWindowActive();
});
[this]() {
this->setAppWindowKeepAbove(true);
this->setAppWindowActive();
});
}
}
});
@ -183,6 +216,34 @@ PlasmaShellManager::PlasmaShellManager(QObject *parent) : QObject(parent)
}
});
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 = "<<key<<"state = "<<state;
m_keyStateMap[key] = state;
emit keyStateChanged();
});
m_keyState->fetchStates();
}
}
});
registry->setup();
connection->roundtrip();
}

View File

@ -15,14 +15,18 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
**/
#ifndef PLASMASHELLMANAGER_H
#define PLASMASHELLMANAGER_H
#include <QObject>
#include <QWindow>
#include <QMap>
#include <KWayland/Client/plasmawindowmanagement.h>
#include <KWayland/Client/plasmashell.h>
#include <KWayland/Client/shell.h>
#include <KWayland/Client/fakeinput.h>
#include <KWayland/Client/keystate.h>
class PlasmaShellManager : public QObject
{
@ -35,9 +39,16 @@ public:
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);
@ -46,8 +57,13 @@ private:
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<KWayland::Client::Keystate::Key,KWayland::Client::Keystate::State> m_keyStateMap;
};

View File

@ -4,28 +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/vkstackedwidget.h
src/fakekeyboard.h
)
set(VirtualKeyboard_SRC
${VirtualKeyboard_SRC}
src/cursormonitor.cpp
src/keyboardwidget.cpp
src/virtualkeyboard.cpp
src/x11keyboard.cpp
src/qtkeyboard.cpp
src/vkstackedwidget.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 Qt5::X11Extras)
target_link_libraries(VirtualKeyboard Qt5::Core Qt5::Widgets Qt5::X11Extras Common)

View File

@ -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 += \

View File

@ -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 <http://www.gnu.org/licenses/>.
*
**/
#include "charsmorewidget.h"
#include "commondef.h"
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QScrollArea>
#include <QScrollBar>
#include <QVariant>
#include <QDebug>
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<QWidget*, QRect>::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<KBButton*>(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<KBButton*>(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();
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*
**/
#ifndef CHARSMOREWIDGETS_H
#define CHARSMOREWIDGETS_H
#include <QWidget>
#include "kbbutton.h"
#include <QMap>
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<QWidget*, QRect> m_mapBtnGeometrys;
QMap<QWidget*, QRect> m_mapSubWidgetListRects;
QVBoxLayout *m_vlayoutBtnList = nullptr;
QScrollArea *m_scrollFrame = nullptr;
QFrame *listFrame = nullptr;
};
#endif // CHARSMOREWIDGETS_H

View File

@ -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 <http://www.gnu.org/licenses/>.
*
**/
#include "charswidget.h"
#include "commondef.h"
#include <QDebug>
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<KBButton*, QRect>::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<KBButton*>(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);
}
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*
**/
#ifndef CHARSWIDGET_H
#define CHARSWIDGET_H
#include <QWidget>
#include "kbbutton.h"
#include <QMap>
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<KBButton*, QRect> m_mapBtnGeometrys;
};
#endif // CHARSWIDGET_H

View File

@ -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 <http://www.gnu.org/licenses/>.
*
**/
#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

View File

@ -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 <http://www.gnu.org/licenses/>.
*
**/
#include "dragwidget.h"
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QDebug>
#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<QLabel*, QRect>::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);
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
* 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
@ -15,32 +15,29 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
**/
#ifndef VIRTUALKEYBOARD_H
#define VIRTUALKEYBOARD_H
#ifndef DRAGWIDGET_H
#define DRAGWIDGET_H
#include <QWidget>
#include <QPushButton>
#include <QLabel>
#include <QMap>
#include "keyboardwidget.h"
#include "cursormonitor.h"
class VirtualKeyboard : public QWidget
class DragWidget : public QWidget
{
Q_OBJECT
public:
explicit VirtualKeyboard(QWidget *parent = 0);
DragWidget(QWidget *parent = nullptr);
virtual ~DragWidget();
public:
void adjustGeometry(double lfWidthScale, double lfHeightScale, bool isVertical = false, bool floatStatus = false);
private:
void adjustGeometry(int screen);
Q_SIGNALS:
void aboutToClose();
void initUI();
private:
KeyboardWidget *keyboardWidget;
CursorMonitor *cursorMonitor;
bool isApplication;
QLabel *m_labelDrag = nullptr;
QMap<QLabel*, QRect> m_mapSubGeometrys;
};
#endif // VIRTUALKEYBOARD_H
#endif // DRAGWIDGET_H

View File

@ -71,7 +71,8 @@ public:
UP,
DOWN,
LEFT,
RIGHT
RIGHT,
CAPSLOCK
};
Q_ENUM(FUNCKEY)
static QString getKeyName(int key)

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
<g id="默认">
<path fill="#FFFFFF" d="M41.1,9c3.2,0,5.9,2.6,5.9,5.9v20.2c0,3.2-2.6,5.9-5.9,5.9H18.3L4,25L18.3,9H41.1 M41.1,6H16.9L0,25
l16.9,19h24.2c4.9,0,8.9-4,8.9-8.9V14.9C50,10,46,6,41.1,6z"/>
<line fill="none" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-miterlimit="10" x1="40" y1="15" x2="20" y2="35"/>
<line fill="none" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-miterlimit="10" x1="20" y1="15" x2="40" y2="35"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 837 B

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
<g id="点击" opacity="0.6">
<path fill="#FFFFFF" d="M41.1,9c3.2,0,5.9,2.6,5.9,5.9v20.2c0,3.2-2.6,5.9-5.9,5.9H18.3L4,25L18.3,9H41.1 M41.1,6H16.9L0,25
l16.9,19h24.2c4.9,0,8.9-4,8.9-8.9V14.9C50,10,46,6,41.1,6z"/>
<line fill="none" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-miterlimit="10" x1="40" y1="15" x2="20" y2="35"/>
<line fill="none" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-miterlimit="10" x1="20" y1="15" x2="40" y2="35"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 851 B

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<path class="st0" d="M25,6.5L43.3,27H35v17H15V27H6.7L25,6.5 M22.8,4.5L3,26.7C1.8,28,2.7,30,4.5,30H12v15c0,1.1,0.9,2,2,2h22
c1.1,0,2-0.9,2-2V30h7.5c1.7,0,2.6-2,1.5-3.3L27.2,4.5C26,3.2,24,3.2,22.8,4.5z"/>
</svg>

Before

Width:  |  Height:  |  Size: 621 B

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
<g id="点击" opacity="0.6">
<path fill="#FFFFFF" d="M25,6.5L43.3,27H35v17H15V27H6.7L25,6.5 M22.8,4.5L3,26.7C1.8,28,2.7,30,4.5,30H12v15c0,1.1,0.9,2,2,2h22
c1.1,0,2-0.9,2-2V30h7.5c1.7,0,2.6-2,1.5-3.3L27.2,4.5C26,3.2,24,3.2,22.8,4.5z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 599 B

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
<path fill="#67B204" d="M25,6.5L43.3,27H35v17H15V27H6.7L25,6.5 M22.8,4.5L3,26.7C1.8,28,2.7,30,4.5,30H12v15c0,1.1,0.9,2,2,2h22
c1.1,0,2-0.9,2-2V30h7.5c1.7,0,2.6-2,1.5-3.3L27.2,4.5C26,3.2,24,3.2,22.8,4.5z"/>
</svg>

Before

Width:  |  Height:  |  Size: 560 B

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
<path fill="#4A692A" d="M25,6.5L43.3,27H35v17H15V27H6.7L25,6.5 M22.8,4.5L3,26.7C1.8,28,2.7,30,4.5,30H12v15c0,1.1,0.9,2,2,2h22
c1.1,0,2-0.9,2-2V30h7.5c1.7,0,2.6-2,1.5-3.3L27.2,4.5C26,3.2,24,3.2,22.8,4.5z"/>
</svg>

Before

Width:  |  Height:  |  Size: 560 B

View File

@ -1,22 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
<g id="键盘">
<g id="默认">
<path fill="#FFFFFF" d="M47,5v29H3V5H47 M50,2H0v35h50V2z"/>
<rect x="8" y="10" fill="#FFFFFF" width="3" height="3"/>
<rect x="15" y="10" fill="#FFFFFF" width="3" height="3"/>
<rect x="23" y="10" fill="#FFFFFF" width="3" height="3"/>
<rect x="31" y="10" fill="#FFFFFF" width="3" height="3"/>
<rect x="39" y="10" fill="#FFFFFF" width="3" height="3"/>
<rect x="8" y="18" fill="#FFFFFF" width="3" height="3"/>
<rect x="15" y="18" fill="#FFFFFF" width="3" height="3"/>
<rect x="23" y="18" fill="#FFFFFF" width="3" height="3"/>
<rect x="31" y="18" fill="#FFFFFF" width="3" height="3"/>
<rect x="39" y="18" fill="#FFFFFF" width="3" height="3"/>
<rect x="13" y="26" fill="#FFFFFF" width="24" height="3"/>
</g>
</g>
<polygon fill="#FFFFFF" points="29,41 25,45 21,41 18,41 25,48 32,41 "/>
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M17.6566 19.0719C18.0471 19.4624 18.6802 19.4624 19.0708 19.0719C19.4613 18.6814 19.4613 18.0482 19.0708 17.6577L6.34285 4.92976C5.95232 4.53923 5.31916 4.53923 4.92864 4.92976C4.53811 5.32028 4.53811 5.95345 4.92864 6.34397L17.6566 19.0719Z" fill="#262626"/>
<path d="M17.6566 4.92961C18.0471 4.53909 18.6803 4.53909 19.0708 4.92961C19.4613 5.32014 19.4613 5.9533 19.0708 6.34383L6.3429 19.0717C5.95238 19.4623 5.31921 19.4623 4.92869 19.0717C4.53816 18.6812 4.53816 18.0481 4.92869 17.6575L17.6566 4.92961Z" fill="#262626"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 639 B

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
<g id="键盘" opacity="0.6">
<g id="默认">
<path fill="#FFFFFF" d="M47,5v29H3V5H47 M50,2H0v35h50V2z"/>
<rect x="8" y="10" fill="#FFFFFF" width="3" height="3"/>
<rect x="15" y="10" fill="#FFFFFF" width="3" height="3"/>
<rect x="23" y="10" fill="#FFFFFF" width="3" height="3"/>
<rect x="31" y="10" fill="#FFFFFF" width="3" height="3"/>
<rect x="39" y="10" fill="#FFFFFF" width="3" height="3"/>
<rect x="8" y="18" fill="#FFFFFF" width="3" height="3"/>
<rect x="15" y="18" fill="#FFFFFF" width="3" height="3"/>
<rect x="23" y="18" fill="#FFFFFF" width="3" height="3"/>
<rect x="31" y="18" fill="#FFFFFF" width="3" height="3"/>
<rect x="39" y="18" fill="#FFFFFF" width="3" height="3"/>
<rect x="13" y="26" fill="#FFFFFF" width="24" height="3"/>
</g>
</g>
<polygon opacity="0.6" fill="#FFFFFF" enable-background="new " points="29,41 25,45 21,41 18,41 25,48 32,41 "/>
</svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,5 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M21.5 7.12778V16.8722H23.5V7.12778H21.5ZM5.6834 18.1172L2.14546 12.3607L0.44154 13.4079L3.97948 19.1645L5.6834 18.1172ZM2.14546 11.6393L5.6834 5.88275L3.97948 4.83553L0.44154 10.5921L2.14546 11.6393ZM19.1222 19.25H7.70917V21.25H19.1222V19.25ZM7.70917 4.75L19.1222 4.75V2.75H7.70917V4.75ZM2.14546 12.3607C2.00948 12.1395 2.00948 11.8605 2.14546 11.6393L0.44154 10.5921C-0.0892174 11.4557 -0.0892166 12.5443 0.44154 13.4079L2.14546 12.3607ZM21.5 16.8722C21.5 18.1854 20.4354 19.25 19.1222 19.25V21.25C21.54 21.25 23.5 19.29 23.5 16.8722H21.5ZM23.5 7.12778C23.5 4.71 21.54 2.75 19.1222 2.75V4.75C20.4354 4.75 21.5 5.81457 21.5 7.12778H23.5ZM5.6834 5.88275C6.116 5.17887 6.88297 4.75 7.70917 4.75V2.75C6.18804 2.75 4.77596 3.5396 3.97948 4.83553L5.6834 5.88275ZM3.97948 19.1645C4.77596 20.4604 6.18805 21.25 7.70917 21.25V19.25C6.88297 19.25 6.116 18.8211 5.6834 18.1172L3.97948 19.1645Z" fill="#262626"/>
<rect x="8.0498" y="8.46484" width="2" height="12" rx="1" transform="rotate(-45 8.0498 8.46484)" fill="#262626"/>
<rect width="2" height="12" rx="1" transform="matrix(0.707107 0.707107 0.707107 -0.707107 8.05078 15.5352)" fill="#363940"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
<title>画板 15</title>
<g id="下">
<polygon id="默认" fill="#FFFFFF" points="25,32 38,17 12,17 "/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 466 B

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
<polygon id="点击" opacity="0.6" fill="#FFFFFF" enable-background="new " points="25,32 38,17 12,17 "/>
</svg>

Before

Width:  |  Height:  |  Size: 460 B

View File

@ -0,0 +1,3 @@
<svg width="56" height="4" viewBox="0 0 56 4" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="56" height="4" rx="2" fill="#1D1D1D"/>
</svg>

After

Width:  |  Height:  |  Size: 153 B

View File

@ -1,11 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 70 50" enable-background="new 0 0 70 50" xml:space="preserve">
<path display="none" fill="none" stroke="#FFFFFF" stroke-width="3" stroke-miterlimit="10" d="M36.5,9.5h2c5.5,0,10,4.5,10,10l0,0
c0,5.5-4.5,10-10,10H5"/>
<polyline fill="none" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="
21,16 3,29.5 21,43 "/>
<path fill="none" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-miterlimit="10" d="M50,12.5h12.7
c3.3,0,6,2.7,6,6v4.8c0,3.3-2.7,6-6,6H5"/>
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2 17H18C20.2091 17 22 15.2091 22 13V3" stroke="#363940" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M7 12L2 17L7 22" stroke="#363940" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 828 B

After

Width:  |  Height:  |  Size: 344 B

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" opacity="0.6" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
x="0px" y="0px" viewBox="0 0 70 50" enable-background="new 0 0 70 50" xml:space="preserve">
<polyline opacity="0.6" fill="none" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" enable-background="new " points="
21,16 3,29.5 21,43 "/>
<path opacity="0.6" fill="none" stroke="#FFFFFF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" enable-background="new " d="
M50,12.5h12.7c3.3,0,6,2.7,6,6v4.8c0,3.3-2.7,6-6,6H5"/>
</svg>

Before

Width:  |  Height:  |  Size: 794 B

View File

@ -0,0 +1,6 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2 8V15.6C2 17.8402 2 18.9603 2.43597 19.816C2.81947 20.5686 3.43139 21.1805 4.18404 21.564C5.03968 22 6.15979 22 8.4 22H15.6C17.8402 22 18.9603 22 19.816 21.564C20.5686 21.1805 21.1805 20.5686 21.564 19.816C22 18.9603 22 17.8402 22 15.6V8" stroke="#262626" stroke-width="2" stroke-linecap="round"/>
<path d="M8.29289 15.7071C7.90237 15.3166 7.90237 14.6834 8.29289 14.2929C8.68342 13.9024 9.31658 13.9024 9.70711 14.2929L8.29289 15.7071ZM12 18L12.7071 18.7071C12.3166 19.0976 11.6834 19.0976 11.2929 18.7071L12 18ZM14.2929 14.2929C14.6834 13.9024 15.3166 13.9024 15.7071 14.2929C16.0976 14.6834 16.0976 15.3166 15.7071 15.7071L14.2929 14.2929ZM9.70711 14.2929L12.7071 17.2929L11.2929 18.7071L8.29289 15.7071L9.70711 14.2929ZM11.2929 17.2929L14.2929 14.2929L15.7071 15.7071L12.7071 18.7071L11.2929 17.2929Z" fill="#262626"/>
<path d="M11 16C11 16.5523 11.4477 17 12 17C12.5523 17 13 16.5523 13 16L11 16ZM13 8C13 7.44772 12.5523 7 12 7C11.4477 7 11 7.44772 11 8L13 8ZM13 16L13 8L11 8L11 16L13 16Z" fill="#262626"/>
<path d="M2 8H22V8C22 6.13623 22 5.20435 21.6955 4.46927C21.2895 3.48915 20.5108 2.71046 19.5307 2.30448C18.7956 2 17.8638 2 16 2H8C6.13623 2 5.20435 2 4.46927 2.30448C3.48915 2.71046 2.71046 3.48915 2.30448 4.46927C2 5.20435 2 6.13623 2 8V8Z" stroke="#262626" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,6 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2 16V8.4C2 6.15979 2 5.03969 2.43597 4.18404C2.81947 3.43139 3.43139 2.81947 4.18404 2.43597C5.03968 2 6.15979 2 8.4 2H15.6C17.8402 2 18.9603 2 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C22 5.03969 22 6.15979 22 8.4V16" stroke="#262626" stroke-width="2" stroke-linecap="round"/>
<path d="M8.29289 8.29289C7.90237 8.68342 7.90237 9.31658 8.29289 9.70711C8.68342 10.0976 9.31658 10.0976 9.70711 9.70711L8.29289 8.29289ZM12 6L12.7071 5.29289C12.3166 4.90237 11.6834 4.90237 11.2929 5.29289L12 6ZM14.2929 9.70711C14.6834 10.0976 15.3166 10.0976 15.7071 9.70711C16.0976 9.31658 16.0976 8.68342 15.7071 8.29289L14.2929 9.70711ZM9.70711 9.70711L12.7071 6.70711L11.2929 5.29289L8.29289 8.29289L9.70711 9.70711ZM11.2929 6.70711L14.2929 9.70711L15.7071 8.29289L12.7071 5.29289L11.2929 6.70711Z" fill="#262626"/>
<path d="M11 16C11 16.5523 11.4477 17 12 17C12.5523 17 13 16.5523 13 16L11 16ZM13 6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6L13 6ZM13 16L13 6L11 6L11 16L13 16Z" fill="#262626"/>
<path d="M2 16H22V16C22 17.8638 22 18.7956 21.6955 19.5307C21.2895 20.5108 20.5108 21.2895 19.5307 21.6955C18.7956 22 17.8638 22 16 22H8C6.13623 22 5.20435 22 4.46927 21.6955C3.48915 21.2895 2.71046 20.5108 2.30448 19.5307C2 18.7956 2 17.8638 2 16V16Z" stroke="#262626" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1,7 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="左" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
<title>画板 19</title>
<polygon id="默认" fill="#FFFFFF" points="18,25 33,12 33,38 "/>
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M17 2L7 12L17 22" stroke="#262626" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 439 B

After

Width:  |  Height:  |  Size: 213 B

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="左" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
<title>画板 20</title>
<polygon id="点击" opacity="0.6" fill="#FFFFFF" enable-background="new " points="18,25 33,12 33,38 "/>
</svg>

Before

Width:  |  Height:  |  Size: 481 B

View File

@ -0,0 +1,3 @@
<svg width="20" height="22" viewBox="0 0 20 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.34569 0.738189C9.22632 -0.246061 10.7737 -0.246064 11.6543 0.738188L19.4361 9.43558C20.7058 10.8547 19.6923 13.0988 17.7817 13.0988H15.1658V19.7993C15.1658 21.0147 14.1746 22 12.9519 22H7.04809C5.82538 22 4.83417 21.0147 4.83417 19.7993V13.0988H2.21826C0.30769 13.0988 -0.705754 10.8547 0.563946 9.43558L8.34569 0.738189Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 493 B

View File

@ -1,6 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
<polygon id="默认" fill="#FFFFFF" points="33,25 18,12 18,38 "/>
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7 2L17 12L7 22" stroke="#262626" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 418 B

After

Width:  |  Height:  |  Size: 212 B

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
<polygon id="点击" opacity="0.6" fill="#FFFFFF" enable-background="new " points="33,25 18,12 18,38 "/>
</svg>

Before

Width:  |  Height:  |  Size: 460 B

View File

@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M17.1658 13.0988H16.1658V14.0988V20.7993C16.1658 21.4568 15.628 22 14.9519 22H9.04809C8.372 22 7.83417 21.4568 7.83417 20.7993V14.0988V13.0988H6.83417H4.21826C3.15987 13.0988 2.62398 11.8682 3.30919 11.1024L11.0909 2.40498C11.5741 1.86501 12.4259 1.86501 12.9091 2.40498L20.6908 11.1024C21.376 11.8682 20.8401 13.0988 19.7817 13.0988H17.1658Z" stroke="#262626" stroke-width="2"/>
</svg>

After

Width:  |  Height:  |  Size: 492 B

View File

@ -0,0 +1,4 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.0341 1.74795C13.1587 0.763701 11.6206 0.763704 10.7453 1.74795L3.01004 10.4453C1.74793 11.8644 2.75531 14.1085 4.65446 14.1085H7.25473V20.8091C7.25473 22.0245 8.24002 23.0098 9.45543 23.0098H11.5414C11.5046 22.9464 11.4694 22.8818 11.436 22.8162C11.1594 22.2734 11.0713 21.7339 11.0339 21.2767C10.9999 20.8604 10.9999 20.3689 11 19.8641V19.8641L11 19.8003V19.2003L11 19.1365V19.1364C10.9999 18.6317 10.9999 18.1401 11.0339 17.7238C11.0713 17.2666 11.1594 16.7272 11.436 16.1843C11.7917 15.4863 12.3438 14.9093 13.0225 14.5233C13.2626 11.9856 15.3995 10.0003 18 10.0003C19.8088 10.0003 21.3933 10.9608 22.2712 12.3995C22.4233 11.7508 22.2879 11.0284 21.7693 10.4453L14.0341 1.74795Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M15 16.0192C14.6078 16.0431 14.3295 16.097 14.092 16.218C13.7157 16.4097 13.4097 16.7157 13.218 17.092C13 17.5198 13 18.0799 13 19.2V19.8C13 20.9201 13 21.4802 13.218 21.908C13.4097 22.2843 13.7157 22.5903 14.092 22.782C14.5198 23 15.0799 23 16.2 23H19.8C20.9201 23 21.4802 23 21.908 22.782C22.2843 22.5903 22.5903 22.2843 22.782 21.908C23 21.4802 23 20.9201 23 19.8V19.2C23 18.0799 23 17.5198 22.782 17.092C22.5903 16.7157 22.2843 16.4097 21.908 16.218C21.6705 16.097 21.3922 16.0431 21 16.0192V15C21 13.3431 19.6569 12 18 12C16.3431 12 15 13.3431 15 15V16.0192ZM17 16H19V15C19 14.4477 18.5523 14 18 14C17.4477 14 17 14.4477 17 15V16Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,10 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_3756_117108)">
<path fill-rule="evenodd" clip-rule="evenodd" d="M20 10V13H4V10C4 9.45 3.55 9 3 9C2.45 9 2 9.45 2 10V14C2 14.55 2.45 15 3 15H21C21.55 15 22 14.55 22 14V10C22 9.45 21.55 9 21 9C20.45 9 20 9.45 20 10Z" fill="#1D1D1D"/>
</g>
<defs>
<clipPath id="clip0_3756_117108">
<rect width="24" height="24" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 470 B

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50"><defs><style>.cls-1{fill:#fff;}</style></defs><title>画板 11</title><g id="优麒麟"><path id="默认" class="cls-1" d="M25,6A19,19,0,1,0,44,25,19,19,0,0,0,25,6Zm7,4.48a2.75,2.75,0,1,1-2.75,2.76A2.75,2.75,0,0,1,32,10.48ZM25.11,13a12.12,12.12,0,0,1,3.26.45,3.66,3.66,0,0,0,5.29,3.08A12.08,12.08,0,0,1,37.2,24.2l-4.27.06a7.86,7.86,0,0,0-11-6.33l-2.19-3.68A12.07,12.07,0,0,1,25.11,13Zm3.26,13.91.6,1.21L27.8,29.2l.08.91H26.24l1.27-1.81-.44-.54-1.23,1v.64l-1.59,0,1-.95,1-1.19-.84-.58-.86.44-1.17.46-1-.18-.63,1-.2,1.39H20l1.12-1.31-.33-.78-.25-1.54-.81-2,1.46-2.7,1.35-.83L24,19.11l-.4,1,.22,0,1.53-1.54-.65,1.9L25,21.91l-1,1.35,1.49,1.09,2.08.83,1.48-.78.87-1.27,1.42-.44-.26,1.85-.91.32-.67-.13-1.21.69Zm-17.08.88A2.75,2.75,0,1,1,14,25a2.75,2.75,0,0,1-2.75,2.75h0Zm2.06.28a3.67,3.67,0,0,0,0-6,12.14,12.14,0,0,1,5-7l2.18,3.67a7.86,7.86,0,0,0-.11,12.72l-2.09,3.74A12.14,12.14,0,0,1,13.36,28.07ZM32.08,39.54a2.75,2.75,0,1,1,2.75-2.75,2.75,2.75,0,0,1-2.75,2.75Zm1.73-6a3.67,3.67,0,0,0-5.4,3.22,12.11,12.11,0,0,1-8.7-.81l2.08-3.73a7.86,7.86,0,0,0,11.15-6.4l4.27-.06a12.08,12.08,0,0,1-3.4,7.77Z"/></g></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50"><defs><style>.cls-1{fill:#fff;opacity:0.4;}</style></defs><title>画板 12</title><g id="优麒麟"><path id="点击" class="cls-1" d="M25,6A19,19,0,1,0,44,25,19,19,0,0,0,25,6Zm7,4.48a2.75,2.75,0,1,1-2.75,2.76A2.75,2.75,0,0,1,32,10.48ZM25.11,13a12.12,12.12,0,0,1,3.26.45,3.66,3.66,0,0,0,5.29,3.08A12.08,12.08,0,0,1,37.2,24.2l-4.27.06a7.86,7.86,0,0,0-11-6.33l-2.19-3.68A12.07,12.07,0,0,1,25.11,13Zm3.26,13.91.6,1.21L27.8,29.2l.08.91H26.24l1.27-1.81-.44-.54-1.23,1v.64l-1.59,0,1-.95,1-1.19-.84-.58-.86.44-1.17.46-1-.18-.63,1-.2,1.39H20l1.12-1.31-.33-.78-.25-1.54-.81-2,1.46-2.7,1.35-.83L24,19.11l-.4,1,.22,0,1.53-1.54-.65,1.9L25,21.91l-1,1.35,1.49,1.09,2.08.83,1.48-.78.87-1.27,1.42-.44-.26,1.85-.91.32-.67-.13-1.21.69Zm-17.08.88A2.75,2.75,0,1,1,14,25a2.75,2.75,0,0,1-2.75,2.75h0Zm2.06.28a3.67,3.67,0,0,0,0-6,12.14,12.14,0,0,1,5-7l2.18,3.67a7.86,7.86,0,0,0-.11,12.72l-2.09,3.74A12.14,12.14,0,0,1,13.36,28.07ZM32.08,39.54a2.75,2.75,0,1,1,2.75-2.75,2.75,2.75,0,0,1-2.75,2.75Zm1.73-6a3.67,3.67,0,0,0-5.4,3.22,12.11,12.11,0,0,1-8.7-.81l2.08-3.73a7.86,7.86,0,0,0,11.15-6.4l4.27-.06a12.08,12.08,0,0,1-3.4,7.77Z"/></g></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,5 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="3" y="10.5" width="18" height="12" rx="3" stroke="#262626" stroke-width="2" stroke-linejoin="round"/>
<path d="M17.25 6.75V6.75C17.25 3.85051 14.8995 1.5 12 1.5V1.5C9.10051 1.5 6.75 3.85051 6.75 6.75V10.5" stroke="#262626" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<rect x="11.25" y="14.25" width="1.5" height="4.5" rx="0.75" fill="#262626"/>
</svg>

After

Width:  |  Height:  |  Size: 479 B

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
<title>画板 13</title>
<g id="上">
<polygon id="默认" fill="#FFFFFF" points="25,17 12,32 38,32 "/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 466 B

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
<polygon id="默认" opacity="0.6" fill="#FFFFFF" enable-background="new " points="25,17 12,32 38,32 "/>
</svg>

Before

Width:  |  Height:  |  Size: 460 B

View File

@ -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 <http://www.gnu.org/licenses/>.
*
**/
#include "kbbutton.h"
#include "commondef.h"
#include <QDebug>
#include <QEvent>
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)
{
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*
**/
#ifndef KBBUTTON_H
#define KBBUTTON_H
#include <QPushButton>
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

View File

@ -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 <http://www.gnu.org/licenses/>.
*
**/
#include "kbtitle.h"
#include <QHBoxLayout>
#include <QVBoxLayout>
#include "commondef.h"
#include <QDebug>
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<QPushButton*>(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<QPushButton*, QRect>::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);
}
}
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*
**/
#ifndef KBTITLE_H
#define KBTITLE_H
#include <QWidget>
#include <QPushButton>
#include <QMap>
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<QPushButton*, QRect> m_mapSubGeometrys;
bool floatStatus = false;
};
#endif // KBTITLE_H

View File

@ -1,27 +1,17 @@
<RCC>
<qresource prefix="/qss">
<file>keyboard.qss</file>
</qresource>
<qresource prefix="/images">
<file>images/backspace_click.svg</file>
<file>images/backspace.svg</file>
<file>images/capslock_click.svg</file>
<file>images/capslock_hl.svg</file>
<file>images/capslock.svg</file>
<file>images/down_click.svg</file>
<file>images/down.svg</file>
<file>images/enter_click.svg</file>
<file>images/enter.svg</file>
<file>images/left_click.svg</file>
<file>images/left.svg</file>
<file>images/right_click.svg</file>
<file>images/right.svg</file>
<file>images/super_click.svg</file>
<file>images/super.svg</file>
<file>images/up.svg</file>
<file>images/close_click.svg</file>
<file>images/close.svg</file>
<file>images/capslock_hl_click.svg</file>
<file>images/up_click.svg</file>
<file>images/unlock.svg</file>
<file>images/space.svg</file>
<file>images/shift.svg</file>
<file>images/float.svg</file>
<file>images/float-restore.svg</file>
<file>images/drag.svg</file>
<file>images/delet.svg</file>
<file>images/shift_lock.svg</file>
<file>images/rectangle.svg</file>
</qresource>
</RCC>

View File

@ -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;
}

View File

@ -1,465 +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 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 <http://www.gnu.org/licenses/>.
*
**/
#include "keyboardwidget.h"
#include "ui_keyboardwidget.h"
#include <QDebug>
#include <QMap>
#include <QVector>
#include <QX11Info>
#include "x11keyboard.h"
#include "qtkeyboard.h"
#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)
{
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)));
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<QPushButton*>(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<QPushButton*>(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<QPushButton*>(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<QPushButton*>(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<QPushButton*>(sender());
changeKeyStyle(btn, true);
}
void KeyboardWidget::onButtonReleased()
{
QPushButton *btn = static_cast<QPushButton*>(sender());
changeKeyStyle(btn, false);
}
void KeyboardWidget::onButtonClicked()
{
QObject *obj = sender();
if(obj->metaObject()->className() != QString("QPushButton"))
return;
QPushButton *btn = static_cast<QPushButton*>(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<QPushButton*>(objName);
btn->setStyleSheet(BUTTON_BG);
} else {
QString objName = QString("btn_%1_l").arg(modName);
QPushButton *btn = ui->page_letter->findChild<QPushButton*>(objName);
btn->setStyleSheet(BUTTON_BG);
objName = QString("btn_%1_r").arg(modName);
btn = ui->page_letter->findChild<QPushButton*>(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<QPushButton*>(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<QPushButton*>(btnObjName);
QChar c = symbols[page][i];
if(c == '&')
btn->setText("&&");
else
btn->setText(c);
}
}

View File

@ -1,76 +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 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 <http://www.gnu.org/licenses/>.
*
**/
#ifndef KEYBOARDWIDGET_H
#define KEYBOARDWIDGET_H
#include <QWidget>
#include <QMap>
#include <QTime>
#include "fakekeyboard.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; //当前是第几页的键盘
FakeKeyboard *vKeyboard;
};
#endif // KEYBOARDWIDGET_H

File diff suppressed because it is too large Load Diff

View File

@ -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 <http://www.gnu.org/licenses/>.
*
**/
#include "letterswidget.h"
#include "commondef.h"
#include "plasma-shell-manager.h"
#include <QDebug>
#include <QX11Info>
#include <KWayland/Client/keystate.h>
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:"<<backspaceBtn->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<KBButton*, QRect>::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<KBButton*>(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<KBButton*>(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<KBButton*>(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<KBButton*>(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"));
}
}
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*
**/
#ifndef LETTERSWIDGET_H
#define LETTERSWIDGET_H
#include <QWidget>
#include <QGSettings/qgsettings.h>
#include "kbbutton.h"
#include <QMap>
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<KBButton*, QRect> m_mapBtnGeometrys;
bool isShift = false;
QGSettings *settings;
bool capsState = false;
bool isWayland = false;
};
#endif // LETTERSWIDGET_H

View File

@ -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 <http://www.gnu.org/licenses/>.
*
**/
#include "numberswidget.h"
#include "kbbutton.h"
#include "commondef.h"
#include <QFrame>
#include <QScrollArea>
#include <QScrollBar>
#include <QVBoxLayout>
#include <QVariant>
#include <QDebug>
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<QWidget*, QRect>::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<KBButton*>(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<KBButton*>(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);
}
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*
**/
#ifndef NUMBERSWIDGET_H
#define NUMBERSWIDGET_H
#include <QWidget>
#include <QMap>
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<QWidget*, QRect> m_mapBtnGeometrys;
QVBoxLayout *m_layoutBtnList = nullptr;
QScrollArea *m_scrollFrame = nullptr;
QFrame *listFrame = nullptr;
};
#endif // NUMBERSWIDGET_H

View File

@ -22,6 +22,7 @@
#include <QDir>
#include <QApplication>
#include <QCoreApplication>
#include "plasma-shell-manager.h"
QMap<QChar,int> m_specialSymbolMap = {
{' ', Qt::Key_Space},
@ -94,7 +95,7 @@ QVector<QChar> m_shiftKeyVec = {'~', '!', '@', '#', '$', '%', '^', '&', '*',
* @brief
* @return true:
*/
bool checkCapsLockState()
bool QtKeyboard::checkCapsLockState()
{
QDir ledDir(DRM_DIR);
QStringList leds = ledDir.entryList(QDir::Dirs);
@ -193,8 +194,10 @@ void QtKeyboard::onKeyPressed(FuncKey::FUNCKEY key)
sendKey(keysym,"\r");
}else if(key == FuncKey::INSERT){
sendKey(keysym,"\u007F");
}else if(key == FuncKey::CAPSLOCK){
PlasmaShellManager::getInstance()->setKeyPressed(58);
}else{
sendKey(keysym,"");
sendKey(keysym,"");
}
}
@ -214,6 +217,7 @@ void QtKeyboard::sendKey(const unsigned int keysym,const QString text)
QKeyEvent event2(QEvent::KeyRelease, keysym
, modifier, text
, true, 1);
QCoreApplication::sendEvent(objfous, &event1);
QCoreApplication::sendEvent(objfous, &event2);
}

View File

@ -40,6 +40,7 @@ public Q_SLOTS:
private:
void sendKey(const unsigned int keyCode,const QString text);
bool checkCapsLockState();
private:
QList<Modifier::MOD> modList;

View File

@ -1,80 +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 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 <http://www.gnu.org/licenses/>.
*
**/
#include "virtualkeyboard.h"
#include <QFile>
#include <QDesktopWidget>
#include <QHBoxLayout>
#include <QApplication>
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);
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(10, 5);
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);
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*
**/
#include "virtualkeyboardwidget.h"
#include <QPainterPath>
#include <QPainter>
#include <QX11Info>
#include <QMouseEvent>
#include "commondef.h"
#include <QDebug>
#include <QVBoxLayout>
#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<QWidget*>(parent());
if (parentWidget) {
//qDebug()<< "parent: " << parentWidget <<"Parent gemotry:"<<parentWidget->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:"<<geometry();
} else {
if (m_isdragState) {
setGeometry(QRect(0, 0,
KEYBOARD_DRAGSHOW_FIXED_DEFAULT_WIDTH, KEYBOARD_DRAGSHOW_FIXED_DEFAULT_HEIGHT));
m_dragWidget->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;
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*
**/
#ifndef VIRTUALKEYBOARDWIDGET_H
#define VIRTUALKEYBOARDWIDGET_H
#include <QWidget>
#include <QStackedWidget>
#include <QList>
#include <QMap>
#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<int> m_listPageHis;
bool m_isdragState = false;//是否为悬浮状态
bool isMove;// 是否可移动
QPoint lastPoint;// 拖拽控件时 记录当前控件的位置
FakeKeyboard *vKeyboard;
};
#endif // VIRTUALKEYBOARDWIDGET_H

View File

@ -33,7 +33,7 @@ struct CharMap XSpecialSymbolMap[] {
{'\'', XK_quoteright},
{'@', XK_at},
{'#', XK_numbersign},
{'$', XK_dollar},
{'$', XK_dollar},
{'%', XK_percent},
{'&', XK_ampersand},
{'*', XK_asterisk},
@ -76,14 +76,15 @@ QMap<FuncKey::FUNCKEY, KeySym> 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<Modifier::MOD, KeySym> 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<QChar> shiftKeyVec = {'~', '!', '@', '#', '$', '%', '^', '&', '*',
@ -165,6 +166,7 @@ void X11Keyboard::onKeyPressed(QChar c)
void X11Keyboard::onKeyPressed(FuncKey::FUNCKEY key)
{
KeyCode keyCode;
KeySym keysym = funckeyMap[key];
if(keysym != NoSymbol)
@ -201,5 +203,8 @@ void X11Keyboard::sendKey(unsigned int keyCode)
XTestFakeKeyEvent(display, keyCode, False, 2);
}
//输入结束清除shift状态
isShift = false;
XFlush(display);
}

View File

@ -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

8
debian/changelog vendored
View File

@ -1,3 +1,11 @@
ukui-screensaver (4.0.0.0-ok1~0426) yangtze; urgency=medium
* BUG号 137546 【RISC-V】【控制面板】无法更改屏幕缩放
* 需求号:无
* 其他修改说明:无
-- Yang Min <yangmin@kylinos.cn> Wed, 26 Apr 2023 19:49:20 +0800
ukui-screensaver (3.22.1.3-ok11~0412) yangtze; urgency=medium
* BUG号I5XFFQ 锁屏登入界面无键盘图标,无实体键盘时无法输入

1
debian/control vendored
View File

@ -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),

View File

@ -4,107 +4,119 @@
<context>
<name>AuthDialog</name>
<message>
<location filename="../src/authdialog.cpp" line="726"/>
<location filename="../src/authdialog.cpp" line="912"/>
<source>Authentication failure, Please try again</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="252"/>
<location filename="../src/authdialog.cpp" line="253"/>
<location filename="../src/authdialog.cpp" line="320"/>
<location filename="../src/authdialog.cpp" line="321"/>
<location filename="../src/authdialog.cpp" line="326"/>
<location filename="../src/authdialog.cpp" line="327"/>
<location filename="../src/authdialog.cpp" line="396"/>
<location filename="../src/authdialog.cpp" line="397"/>
<source>Please try again in %1 minutes.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="262"/>
<location filename="../src/authdialog.cpp" line="263"/>
<location filename="../src/authdialog.cpp" line="329"/>
<location filename="../src/authdialog.cpp" line="330"/>
<location filename="../src/authdialog.cpp" line="223"/>
<source>Enter the ukey password</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="240"/>
<source>Insert the ukey into the USB port</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="336"/>
<location filename="../src/authdialog.cpp" line="337"/>
<location filename="../src/authdialog.cpp" line="405"/>
<location filename="../src/authdialog.cpp" line="406"/>
<source>Please try again in %1 seconds.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="272"/>
<location filename="../src/authdialog.cpp" line="273"/>
<location filename="../src/authdialog.cpp" line="338"/>
<location filename="../src/authdialog.cpp" line="339"/>
<location filename="../src/authdialog.cpp" line="346"/>
<location filename="../src/authdialog.cpp" line="347"/>
<location filename="../src/authdialog.cpp" line="414"/>
<location filename="../src/authdialog.cpp" line="415"/>
<source>Account locked permanently.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="459"/>
<location filename="../src/authdialog.cpp" line="566"/>
<source>Verify face recognition or enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="464"/>
<location filename="../src/authdialog.cpp" line="571"/>
<source>Press fingerprint or enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="469"/>
<location filename="../src/authdialog.cpp" line="576"/>
<source>Verify voiceprint or enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="474"/>
<location filename="../src/authdialog.cpp" line="581"/>
<source>Verify finger vein or enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="479"/>
<location filename="../src/authdialog.cpp" line="586"/>
<source>Verify iris or enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="484"/>
<location filename="../src/authdialog.cpp" line="591"/>
<source>Use the bound wechat scanning code or enter the password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="537"/>
<location filename="../src/authdialog.cpp" line="538"/>
<location filename="../src/authdialog.cpp" line="649"/>
<location filename="../src/authdialog.cpp" line="650"/>
<source>Password cannot be empty</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="686"/>
<location filename="../src/authdialog.cpp" line="871"/>
<source>Password </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="688"/>
<location filename="../src/authdialog.cpp" line="873"/>
<source>Input Password</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="754"/>
<location filename="../src/authdialog.cpp" line="940"/>
<source>Login</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="766"/>
<location filename="../src/authdialog.cpp" line="957"/>
<source>Retry</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1011"/>
<location filename="../src/authdialog.cpp" line="1260"/>
<source>Failed to verify %1, please enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1015"/>
<location filename="../src/authdialog.cpp" line="1264"/>
<location filename="../src/authdialog.cpp" line="1266"/>
<source>Unable to verify %1, please enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1021"/>
<location filename="../src/authdialog.cpp" line="1279"/>
<location filename="../src/authdialog.cpp" line="1283"/>
<source>Failed to verify %1, you still have %2 verification opportunities</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1032"/>
<location filename="../src/authdialog.cpp" line="1296"/>
<source>Abnormal network</source>
<translation type="unfinished"></translation>
</message>
@ -168,6 +180,32 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CharsMoreWidget</name>
<message>
<location filename="../VirtualKeyboard/src/charsmorewidget.cpp" line="166"/>
<source>&amp;&amp;?!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CharsWidget</name>
<message>
<location filename="../VirtualKeyboard/src/charswidget.cpp" line="97"/>
<source>More</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../VirtualKeyboard/src/charswidget.cpp" line="111"/>
<source>ABC</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../VirtualKeyboard/src/charswidget.cpp" line="124"/>
<source>123</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ConfForm</name>
<message>
@ -302,6 +340,11 @@
</message>
<message>
<location filename="../BiometricAuth/biometricdeviceinfo.cpp" line="71"/>
<source>ukey</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../BiometricAuth/biometricdeviceinfo.cpp" line="73"/>
<source>QRCode</source>
<translation type="unfinished"></translation>
</message>
@ -1599,14 +1642,6 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>KeyboardWidget</name>
<message>
<location filename="../VirtualKeyboard/src/keyboardwidget.ui" line="29"/>
<source>KeyboardWidget</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>KylinNM</name>
<message>
@ -1741,6 +1776,29 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LettersWidget</name>
<message>
<location filename="../VirtualKeyboard/src/letterswidget.cpp" line="138"/>
<source>&amp;&amp;?!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../VirtualKeyboard/src/letterswidget.cpp" line="152"/>
<source>123</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../VirtualKeyboard/src/letterswidget.cpp" line="166"/>
<source>Ctrl</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../VirtualKeyboard/src/letterswidget.cpp" line="194"/>
<source>Alt</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LockWidget</name>
<message>
@ -1759,17 +1817,17 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="1092"/>
<location filename="../src/lockwidget.cpp" line="1135"/>
<source>Multiple users are logged in at the same time.Are you sure you want to reboot this system?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="1400"/>
<location filename="../src/lockwidget.cpp" line="1445"/>
<source>LAN</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="1402"/>
<location filename="../src/lockwidget.cpp" line="1447"/>
<source>WLAN</source>
<translation type="unfinished"></translation>
</message>
@ -1777,12 +1835,17 @@
<context>
<name>LoginOptionsWidget</name>
<message>
<location filename="../src/loginoptionswidget.cpp" line="64"/>
<location filename="../src/loginoptionswidget.cpp" line="73"/>
<source>Login Options</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/loginoptionswidget.cpp" line="550"/>
<location filename="../src/loginoptionswidget.cpp" line="270"/>
<source>Password</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/loginoptionswidget.cpp" line="664"/>
<source>Identify device removed!</source>
<translation type="unfinished"></translation>
</message>
@ -1797,6 +1860,19 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NumbersWidget</name>
<message>
<location filename="../VirtualKeyboard/src/numberswidget.cpp" line="143"/>
<source>&amp;&amp;?!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../VirtualKeyboard/src/numberswidget.cpp" line="157"/>
<source>Return</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OneConnForm</name>
<message>
@ -1973,8 +2049,8 @@
</message>
<message>
<location filename="../src/powermanager.cpp" line="334"/>
<location filename="../src/powermanager.cpp" line="672"/>
<source>Reboot</source>
<location filename="../src/powermanager.cpp" line="673"/>
<source>Restart</source>
<translation type="unfinished"></translation>
</message>
<message>
@ -1983,17 +2059,17 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/powermanager.cpp" line="691"/>
<location filename="../src/powermanager.cpp" line="694"/>
<source>Shut Down</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/powermanager.cpp" line="718"/>
<location filename="../src/powermanager.cpp" line="722"/>
<source>Hibernate</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/powermanager.cpp" line="746"/>
<location filename="../src/powermanager.cpp" line="751"/>
<source>Suspend</source>
<translation type="unfinished"></translation>
</message>
@ -2001,12 +2077,12 @@
<context>
<name>QObject</name>
<message>
<location filename="../src/ukui-screensaver-command.cpp" line="78"/>
<location filename="../src/ukui-screensaver-command.cpp" line="90"/>
<source>The screensaver is active.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/ukui-screensaver-command.cpp" line="80"/>
<location filename="../src/ukui-screensaver-command.cpp" line="92"/>
<source>The screensaver is inactive.</source>
<translation type="unfinished"></translation>
</message>
@ -2016,72 +2092,6 @@
<message>
<location filename="../src/enginedevice.cpp" line="308"/>
<source></source>
<comment>this is only shown for laptops with multiple batteries</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="313"/>
<source></source>
<comment>this is only shown for laptops with multiple batteries</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="337"/>
<source></source>
<comment>laptop primary battery</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="341"/>
<source></source>
<comment>battery-backed AC power source</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="345"/>
<source></source>
<comment>a monitor is a device to measure voltage and current</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="349"/>
<source></source>
<comment>wireless mice with internal batteries</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="353"/>
<source></source>
<comment>wireless keyboard with internal battery</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="357"/>
<source></source>
<comment>portable device</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="361"/>
<source></source>
<comment>cell phone (mobile...)</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="365"/>
<source></source>
<comment>media player, mp3 etc</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="369"/>
<source></source>
<comment>tablet device</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="373"/>
<source></source>
<comment>tablet device</comment>
<translation></translation>
</message>
@ -2089,17 +2099,17 @@
<context>
<name>Screensaver</name>
<message>
<location filename="../screensaver/screensaver.cpp" line="153"/>
<location filename="../screensaver/screensaver.cpp" line="145"/>
<source>Picture does not exist</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../screensaver/screensaver.cpp" line="1191"/>
<location filename="../screensaver/screensaver.cpp" line="1205"/>
<source>View</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../screensaver/screensaver.cpp" line="1356"/>
<location filename="../screensaver/screensaver.cpp" line="1374"/>
<source>You have new notification</source>
<translation type="unfinished"></translation>
</message>
@ -2107,7 +2117,7 @@
<context>
<name>SleepTime</name>
<message>
<location filename="../screensaver/sleeptime.cpp" line="64"/>
<location filename="../screensaver/sleeptime.cpp" line="72"/>
<source>You have rested</source>
<translation type="unfinished"></translation>
</message>
@ -2135,22 +2145,22 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/surewindow.cpp" line="40"/>
<location filename="../src/surewindow.cpp" line="47"/>
<source>The following program is running to prevent the system from reboot!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/surewindow.cpp" line="43"/>
<location filename="../src/surewindow.cpp" line="50"/>
<source>The following program is running to prevent the system from shutting down!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/surewindow.cpp" line="46"/>
<location filename="../src/surewindow.cpp" line="53"/>
<source>The following program is running to prevent the system from suspend!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/surewindow.cpp" line="49"/>
<location filename="../src/surewindow.cpp" line="56"/>
<source>The following program is running to prevent the system from hibernate!</source>
<translation type="unfinished"></translation>
</message>
@ -2287,57 +2297,78 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>delay</name>
<message>
<location filename="../src/ukui-screensaver-dialog.cpp" line="179"/>
<source>how long to show lock</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>has-lock</name>
<message>
<location filename="../src/ukui-screensaver-dialog.cpp" line="182"/>
<source>if show lock</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>main</name>
<message>
<location filename="../screensaver/main.cpp" line="56"/>
<location filename="../screensaver/main.cpp" line="65"/>
<source>Screensaver for ukui-screensaver</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../screensaver/main.cpp" line="60"/>
<location filename="../screensaver/main.cpp" line="69"/>
<source>show on root window</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../screensaver/main.cpp" line="62"/>
<location filename="../screensaver/main.cpp" line="71"/>
<source>show on window.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../screensaver/main.cpp" line="63"/>
<location filename="../screensaver/main.cpp" line="72"/>
<source>window id</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/ukui-screensaver-command.cpp" line="42"/>
<location filename="../src/ukui-screensaver-command.cpp" line="43"/>
<source>Start command for the ukui ScreenSaver.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/ukui-screensaver-command.cpp" line="47"/>
<location filename="../src/ukui-screensaver-command.cpp" line="48"/>
<location filename="../src/ukui-screensaver-dialog.cpp" line="166"/>
<location filename="../src/ukui-screensaver-dialog.cpp" line="168"/>
<source>lock the screen immediately</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/ukui-screensaver-command.cpp" line="50"/>
<location filename="../src/ukui-screensaver-command.cpp" line="51"/>
<source>query the status of the screen saver</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/ukui-screensaver-command.cpp" line="53"/>
<location filename="../src/ukui-screensaver-command.cpp" line="54"/>
<source>unlock the screen saver</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/ukui-screensaver-command.cpp" line="55"/>
<location filename="../src/ukui-screensaver-command.cpp" line="56"/>
<source>show the screensaver</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/ukui-screensaver-dialog.cpp" line="161"/>
<location filename="../src/ukui-screensaver-command.cpp" line="58"/>
<source>show blank and delay to lock,param:idle/lid/lowpower</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/ukui-screensaver-dialog.cpp" line="160"/>
<source>Dialog for the ukui ScreenSaver.</source>
<translation type="unfinished"></translation>
</message>
@ -2357,5 +2388,15 @@
<source>show screensaver immediately</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/ukui-screensaver-dialog.cpp" line="178"/>
<source>show blank screensaver immediately and delay time to show lock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/ukui-screensaver-dialog.cpp" line="181"/>
<source>show blank screensaver immediately and if lock</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -107,6 +107,14 @@
<source>Abnormal network</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enter the ukey password</source>
<translation></translation>
</message>
<message>
<source>Insert the ukey into the USB port</source>
<translation>USBཡི</translation>
</message>
</context>
<context>
<name>BatteryWidget</name>
@ -157,6 +165,28 @@
<translation></translation>
</message>
</context>
<context>
<name>CharsMoreWidget</name>
<message>
<source>&amp;&amp;?!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CharsWidget</name>
<message>
<source>More</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ABC</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>123</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ConfForm</name>
<message>
@ -266,6 +296,10 @@
<source>QRCode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ukey</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DigitalAuthDialog</name>
@ -1301,13 +1335,6 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>KeyboardWidget</name>
<message>
<source>KeyboardWidget</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>KylinNM</name>
<message>
@ -1403,6 +1430,25 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LettersWidget</name>
<message>
<source>&amp;&amp;?!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>123</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Ctrl</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Alt</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LockWidget</name>
<message>
@ -1448,6 +1494,10 @@
<source>Identify device removed!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Password</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MyLineEdit</name>
@ -1456,6 +1506,17 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NumbersWidget</name>
<message>
<source>&amp;&amp;?!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Return</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OneConnForm</name>
<message>
@ -1597,7 +1658,7 @@
</message>
<message>
<source>Restart</source>
<translation type="vanished"></translation>
<translation></translation>
</message>
<message>
<source>Switch User</source>
@ -1615,10 +1676,6 @@
<source>lock</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Reboot</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shut Down</source>
<translation type="unfinished"></translation>
@ -1641,61 +1698,6 @@
</context>
<context>
<name>S:</name>
<message>
<source></source>
<comment>this is only shown for laptops with multiple batteries</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>this is only shown for laptops with multiple batteries</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>laptop primary battery</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>battery-backed AC power source</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>a monitor is a device to measure voltage and current</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>wireless mice with internal batteries</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>wireless keyboard with internal battery</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>portable device</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>cell phone (mobile...)</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>media player, mp3 etc</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>tablet device</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>tablet device</comment>
@ -1872,6 +1874,20 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>delay</name>
<message>
<source>how long to show lock</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>has-lock</name>
<message>
<source>if show lock</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>main</name>
<message>
@ -1926,5 +1942,17 @@
<source>show screensaver immediately</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>show blank and delay to lock,param:idle/lid/lowpower</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>show blank screensaver immediately and delay time to show lock</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>show blank screensaver immediately and if lock</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -107,6 +107,14 @@
<source>Abnormal network</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enter the ukey password</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Insert the ukey into the USB port</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>BatteryWidget</name>
@ -222,6 +230,28 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CharsMoreWidget</name>
<message>
<source>&amp;&amp;?!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CharsWidget</name>
<message>
<source>More</source>
<translation type="unfinished">Más</translation>
</message>
<message>
<source>ABC</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>123</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ConfForm</name>
<message>
@ -331,6 +361,10 @@
<source>QRCode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ukey</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DigitalAuthDialog</name>
@ -1370,7 +1404,7 @@
<name>KeyboardWidget</name>
<message>
<source>KeyboardWidget</source>
<translation>TecladoWidget</translation>
<translation type="vanished">TecladoWidget</translation>
</message>
</context>
<context>
@ -1468,6 +1502,25 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LettersWidget</name>
<message>
<source>&amp;&amp;?!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>123</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Ctrl</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Alt</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LockWidget</name>
<message>
@ -1511,7 +1564,7 @@
</message>
<message>
<source>Password</source>
<translation type="obsolete">Contraseña</translation>
<translation type="unfinished">Contraseña</translation>
</message>
<message>
<source>Identify device removed!</source>
@ -1525,6 +1578,17 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NumbersWidget</name>
<message>
<source>&amp;&amp;?!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Return</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OneConnForm</name>
<message>
@ -1672,10 +1736,6 @@
<source>lock</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Reboot</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shut Down</source>
<translation type="unfinished"></translation>
@ -1684,6 +1744,10 @@
<source>Hibernate</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Restart</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
@ -1698,61 +1762,6 @@
</context>
<context>
<name>S:</name>
<message>
<source></source>
<comment>this is only shown for laptops with multiple batteries</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>this is only shown for laptops with multiple batteries</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>laptop primary battery</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>battery-backed AC power source</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>a monitor is a device to measure voltage and current</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>wireless mice with internal batteries</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>wireless keyboard with internal battery</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>portable device</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>cell phone (mobile...)</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>media player, mp3 etc</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>tablet device</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>tablet device</comment>
@ -1917,6 +1926,20 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>delay</name>
<message>
<source>how long to show lock</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>has-lock</name>
<message>
<source>if show lock</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>main</name>
<message>
@ -1971,5 +1994,17 @@
<source>show screensaver immediately</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>show blank and delay to lock,param:idle/lid/lowpower</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>show blank screensaver immediately and delay time to show lock</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>show blank screensaver immediately and if lock</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -107,6 +107,14 @@
<source>Abnormal network</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enter the ukey password</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Insert the ukey into the USB port</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>BatteryWidget</name>
@ -222,6 +230,28 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CharsMoreWidget</name>
<message>
<source>&amp;&amp;?!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CharsWidget</name>
<message>
<source>More</source>
<translation type="unfinished">Plus</translation>
</message>
<message>
<source>ABC</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>123</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ConfForm</name>
<message>
@ -331,6 +361,10 @@
<source>QRCode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ukey</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DigitalAuthDialog</name>
@ -1370,7 +1404,7 @@
<name>KeyboardWidget</name>
<message>
<source>KeyboardWidget</source>
<translation>KeyboardWidget</translation>
<translation type="vanished">KeyboardWidget</translation>
</message>
</context>
<context>
@ -1468,6 +1502,25 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LettersWidget</name>
<message>
<source>&amp;&amp;?!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>123</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Ctrl</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Alt</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LockWidget</name>
<message>
@ -1511,7 +1564,7 @@
</message>
<message>
<source>Password</source>
<translation type="obsolete">Mot de passe</translation>
<translation type="unfinished">Mot de passe</translation>
</message>
<message>
<source>Identify device removed!</source>
@ -1525,6 +1578,17 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NumbersWidget</name>
<message>
<source>&amp;&amp;?!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Return</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OneConnForm</name>
<message>
@ -1672,10 +1736,6 @@
<source>lock</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Reboot</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shut Down</source>
<translation type="unfinished"></translation>
@ -1684,6 +1744,10 @@
<source>Hibernate</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Restart</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
@ -1698,61 +1762,6 @@
</context>
<context>
<name>S:</name>
<message>
<source></source>
<comment>this is only shown for laptops with multiple batteries</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>this is only shown for laptops with multiple batteries</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>laptop primary battery</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>battery-backed AC power source</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>a monitor is a device to measure voltage and current</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>wireless mice with internal batteries</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>wireless keyboard with internal battery</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>portable device</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>cell phone (mobile...)</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>media player, mp3 etc</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>tablet device</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>tablet device</comment>
@ -1917,6 +1926,20 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>delay</name>
<message>
<source>how long to show lock</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>has-lock</name>
<message>
<source>if show lock</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>main</name>
<message>
@ -1971,5 +1994,17 @@
<source>show screensaver immediately</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>show blank and delay to lock,param:idle/lid/lowpower</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>show blank screensaver immediately and delay time to show lock</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>show blank screensaver immediately and if lock</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -107,6 +107,14 @@
<source>Abnormal network</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enter the ukey password</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Insert the ukey into the USB port</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>BatteryWidget</name>
@ -222,6 +230,28 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CharsMoreWidget</name>
<message>
<source>&amp;&amp;?!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CharsWidget</name>
<message>
<source>More</source>
<translation type="unfinished">Mais</translation>
</message>
<message>
<source>ABC</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>123</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ConfForm</name>
<message>
@ -331,6 +361,10 @@
<source>QRCode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ukey</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DigitalAuthDialog</name>
@ -1370,7 +1404,7 @@
<name>KeyboardWidget</name>
<message>
<source>KeyboardWidget</source>
<translation>KeyboardWidget</translation>
<translation type="vanished">KeyboardWidget</translation>
</message>
</context>
<context>
@ -1468,6 +1502,25 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LettersWidget</name>
<message>
<source>&amp;&amp;?!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>123</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Ctrl</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Alt</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LockWidget</name>
<message>
@ -1511,7 +1564,7 @@
</message>
<message>
<source>Password</source>
<translation type="obsolete">Senha</translation>
<translation type="unfinished">Senha</translation>
</message>
<message>
<source>Identify device removed!</source>
@ -1525,6 +1578,17 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NumbersWidget</name>
<message>
<source>&amp;&amp;?!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Return</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OneConnForm</name>
<message>
@ -1672,10 +1736,6 @@
<source>lock</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Reboot</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shut Down</source>
<translation type="unfinished"></translation>
@ -1684,6 +1744,10 @@
<source>Hibernate</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Restart</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
@ -1698,61 +1762,6 @@
</context>
<context>
<name>S:</name>
<message>
<source></source>
<comment>this is only shown for laptops with multiple batteries</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>this is only shown for laptops with multiple batteries</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>laptop primary battery</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>battery-backed AC power source</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>a monitor is a device to measure voltage and current</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>wireless mice with internal batteries</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>wireless keyboard with internal battery</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>portable device</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>cell phone (mobile...)</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>media player, mp3 etc</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>tablet device</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>tablet device</comment>
@ -1917,6 +1926,20 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>delay</name>
<message>
<source>how long to show lock</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>has-lock</name>
<message>
<source>if show lock</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>main</name>
<message>
@ -1971,5 +1994,17 @@
<source>show screensaver immediately</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>show blank and delay to lock,param:idle/lid/lowpower</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>show blank screensaver immediately and delay time to show lock</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>show blank screensaver immediately and if lock</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -107,6 +107,14 @@
<source>Abnormal network</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enter the ukey password</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Insert the ukey into the USB port</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>BatteryWidget</name>
@ -222,6 +230,28 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CharsMoreWidget</name>
<message>
<source>&amp;&amp;?!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CharsWidget</name>
<message>
<source>More</source>
<translation type="unfinished">Больше</translation>
</message>
<message>
<source>ABC</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>123</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ConfForm</name>
<message>
@ -331,6 +361,10 @@
<source>QRCode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ukey</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DigitalAuthDialog</name>
@ -1370,7 +1404,7 @@
<name>KeyboardWidget</name>
<message>
<source>KeyboardWidget</source>
<translation>KeyboardWidget</translation>
<translation type="vanished">KeyboardWidget</translation>
</message>
</context>
<context>
@ -1468,6 +1502,25 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LettersWidget</name>
<message>
<source>&amp;&amp;?!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>123</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Ctrl</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Alt</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LockWidget</name>
<message>
@ -1511,7 +1564,7 @@
</message>
<message>
<source>Password</source>
<translation type="obsolete">пароль</translation>
<translation type="unfinished">пароль</translation>
</message>
<message>
<source>Identify device removed!</source>
@ -1525,6 +1578,17 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NumbersWidget</name>
<message>
<source>&amp;&amp;?!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Return</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OneConnForm</name>
<message>
@ -1672,10 +1736,6 @@
<source>lock</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Reboot</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shut Down</source>
<translation type="unfinished"></translation>
@ -1684,6 +1744,10 @@
<source>Hibernate</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Restart</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
@ -1698,61 +1762,6 @@
</context>
<context>
<name>S:</name>
<message>
<source></source>
<comment>this is only shown for laptops with multiple batteries</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>this is only shown for laptops with multiple batteries</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>laptop primary battery</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>battery-backed AC power source</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>a monitor is a device to measure voltage and current</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>wireless mice with internal batteries</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>wireless keyboard with internal battery</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>portable device</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>cell phone (mobile...)</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>media player, mp3 etc</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>tablet device</comment>
<translation></translation>
</message>
<message>
<source></source>
<comment>tablet device</comment>
@ -1917,6 +1926,20 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>delay</name>
<message>
<source>how long to show lock</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>has-lock</name>
<message>
<source>if show lock</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>main</name>
<message>
@ -1971,5 +1994,17 @@
<source>show screensaver immediately</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>show blank and delay to lock,param:idle/lid/lowpower</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>show blank screensaver immediately and delay time to show lock</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>show blank screensaver immediately and if lock</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -16,7 +16,7 @@
<translation type="obsolete">Parola</translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="766"/>
<location filename="../src/authdialog.cpp" line="957"/>
<source>Retry</source>
<translation type="unfinished">Yeniden Dene</translation>
</message>
@ -41,102 +41,114 @@
<translation type="vanished">Kimlik doğrulama hatası, hala %1 kalan denemen var</translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="726"/>
<location filename="../src/authdialog.cpp" line="912"/>
<source>Authentication failure, Please try again</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="252"/>
<location filename="../src/authdialog.cpp" line="253"/>
<location filename="../src/authdialog.cpp" line="320"/>
<location filename="../src/authdialog.cpp" line="321"/>
<location filename="../src/authdialog.cpp" line="326"/>
<location filename="../src/authdialog.cpp" line="327"/>
<location filename="../src/authdialog.cpp" line="396"/>
<location filename="../src/authdialog.cpp" line="397"/>
<source>Please try again in %1 minutes.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="262"/>
<location filename="../src/authdialog.cpp" line="263"/>
<location filename="../src/authdialog.cpp" line="329"/>
<location filename="../src/authdialog.cpp" line="330"/>
<location filename="../src/authdialog.cpp" line="223"/>
<source>Enter the ukey password</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="240"/>
<source>Insert the ukey into the USB port</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="336"/>
<location filename="../src/authdialog.cpp" line="337"/>
<location filename="../src/authdialog.cpp" line="405"/>
<location filename="../src/authdialog.cpp" line="406"/>
<source>Please try again in %1 seconds.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="272"/>
<location filename="../src/authdialog.cpp" line="273"/>
<location filename="../src/authdialog.cpp" line="338"/>
<location filename="../src/authdialog.cpp" line="339"/>
<location filename="../src/authdialog.cpp" line="346"/>
<location filename="../src/authdialog.cpp" line="347"/>
<location filename="../src/authdialog.cpp" line="414"/>
<location filename="../src/authdialog.cpp" line="415"/>
<source>Account locked permanently.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="459"/>
<location filename="../src/authdialog.cpp" line="566"/>
<source>Verify face recognition or enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="464"/>
<location filename="../src/authdialog.cpp" line="571"/>
<source>Press fingerprint or enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="469"/>
<location filename="../src/authdialog.cpp" line="576"/>
<source>Verify voiceprint or enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="474"/>
<location filename="../src/authdialog.cpp" line="581"/>
<source>Verify finger vein or enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="479"/>
<location filename="../src/authdialog.cpp" line="586"/>
<source>Verify iris or enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="484"/>
<location filename="../src/authdialog.cpp" line="591"/>
<source>Use the bound wechat scanning code or enter the password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="537"/>
<location filename="../src/authdialog.cpp" line="538"/>
<location filename="../src/authdialog.cpp" line="649"/>
<location filename="../src/authdialog.cpp" line="650"/>
<source>Password cannot be empty</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="686"/>
<location filename="../src/authdialog.cpp" line="871"/>
<source>Password </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="688"/>
<location filename="../src/authdialog.cpp" line="873"/>
<source>Input Password</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="754"/>
<location filename="../src/authdialog.cpp" line="940"/>
<source>Login</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1011"/>
<location filename="../src/authdialog.cpp" line="1260"/>
<source>Failed to verify %1, please enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1015"/>
<location filename="../src/authdialog.cpp" line="1264"/>
<location filename="../src/authdialog.cpp" line="1266"/>
<source>Unable to verify %1, please enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1021"/>
<location filename="../src/authdialog.cpp" line="1279"/>
<location filename="../src/authdialog.cpp" line="1283"/>
<source>Failed to verify %1, you still have %2 verification opportunities</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1032"/>
<location filename="../src/authdialog.cpp" line="1296"/>
<source>Abnormal network</source>
<translation type="unfinished"></translation>
</message>
@ -250,6 +262,32 @@
<translation type="unfinished">Tamam</translation>
</message>
</context>
<context>
<name>CharsMoreWidget</name>
<message>
<location filename="../VirtualKeyboard/src/charsmorewidget.cpp" line="166"/>
<source>&amp;&amp;?!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CharsWidget</name>
<message>
<location filename="../VirtualKeyboard/src/charswidget.cpp" line="97"/>
<source>More</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../VirtualKeyboard/src/charswidget.cpp" line="111"/>
<source>ABC</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../VirtualKeyboard/src/charswidget.cpp" line="124"/>
<source>123</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ConfForm</name>
<message>
@ -384,6 +422,11 @@
</message>
<message>
<location filename="../BiometricAuth/biometricdeviceinfo.cpp" line="71"/>
<source>ukey</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../BiometricAuth/biometricdeviceinfo.cpp" line="73"/>
<source>QRCode</source>
<translation type="unfinished"></translation>
</message>
@ -1681,14 +1724,6 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>KeyboardWidget</name>
<message>
<location filename="../VirtualKeyboard/src/keyboardwidget.ui" line="29"/>
<source>KeyboardWidget</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>KylinNM</name>
<message>
@ -1823,6 +1858,29 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LettersWidget</name>
<message>
<location filename="../VirtualKeyboard/src/letterswidget.cpp" line="138"/>
<source>&amp;&amp;?!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../VirtualKeyboard/src/letterswidget.cpp" line="152"/>
<source>123</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../VirtualKeyboard/src/letterswidget.cpp" line="166"/>
<source>Ctrl</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../VirtualKeyboard/src/letterswidget.cpp" line="194"/>
<source>Alt</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LockWidget</name>
<message>
@ -1849,17 +1907,17 @@
<translation type="vanished">Kullanıcı Değiştir</translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="1092"/>
<location filename="../src/lockwidget.cpp" line="1135"/>
<source>Multiple users are logged in at the same time.Are you sure you want to reboot this system?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="1400"/>
<location filename="../src/lockwidget.cpp" line="1445"/>
<source>LAN</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="1402"/>
<location filename="../src/lockwidget.cpp" line="1447"/>
<source>WLAN</source>
<translation type="unfinished"></translation>
</message>
@ -1867,16 +1925,17 @@
<context>
<name>LoginOptionsWidget</name>
<message>
<location filename="../src/loginoptionswidget.cpp" line="64"/>
<location filename="../src/loginoptionswidget.cpp" line="73"/>
<source>Login Options</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/loginoptionswidget.cpp" line="270"/>
<source>Password</source>
<translation type="obsolete">Parola</translation>
<translation type="unfinished">Parola</translation>
</message>
<message>
<location filename="../src/loginoptionswidget.cpp" line="550"/>
<location filename="../src/loginoptionswidget.cpp" line="664"/>
<source>Identify device removed!</source>
<translation type="unfinished"></translation>
</message>
@ -1891,6 +1950,19 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NumbersWidget</name>
<message>
<location filename="../VirtualKeyboard/src/numberswidget.cpp" line="143"/>
<source>&amp;&amp;?!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../VirtualKeyboard/src/numberswidget.cpp" line="157"/>
<source>Return</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OneConnForm</name>
<message>
@ -2089,15 +2161,11 @@
<source>Log Out</source>
<translation type="unfinished">Çıkış</translation>
</message>
<message>
<source>Restart</source>
<translation type="obsolete">Yeniden Başlat</translation>
</message>
<message>
<location filename="../src/powermanager.cpp" line="334"/>
<location filename="../src/powermanager.cpp" line="672"/>
<source>Reboot</source>
<translation type="unfinished"></translation>
<location filename="../src/powermanager.cpp" line="673"/>
<source>Restart</source>
<translation type="unfinished">Yeniden Başlat</translation>
</message>
<message>
<location filename="../src/powermanager.cpp" line="354"/>
@ -2105,17 +2173,17 @@
<translation type="unfinished">Bilgisayarı Kapat</translation>
</message>
<message>
<location filename="../src/powermanager.cpp" line="691"/>
<location filename="../src/powermanager.cpp" line="694"/>
<source>Shut Down</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/powermanager.cpp" line="718"/>
<location filename="../src/powermanager.cpp" line="722"/>
<source>Hibernate</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/powermanager.cpp" line="746"/>
<location filename="../src/powermanager.cpp" line="751"/>
<source>Suspend</source>
<translation type="unfinished"></translation>
</message>
@ -2123,12 +2191,12 @@
<context>
<name>QObject</name>
<message>
<location filename="../src/ukui-screensaver-command.cpp" line="78"/>
<location filename="../src/ukui-screensaver-command.cpp" line="90"/>
<source>The screensaver is active.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/ukui-screensaver-command.cpp" line="80"/>
<location filename="../src/ukui-screensaver-command.cpp" line="92"/>
<source>The screensaver is inactive.</source>
<translation type="unfinished"></translation>
</message>
@ -2138,72 +2206,6 @@
<message>
<location filename="../src/enginedevice.cpp" line="308"/>
<source></source>
<comment>this is only shown for laptops with multiple batteries</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="313"/>
<source></source>
<comment>this is only shown for laptops with multiple batteries</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="337"/>
<source></source>
<comment>laptop primary battery</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="341"/>
<source></source>
<comment>battery-backed AC power source</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="345"/>
<source></source>
<comment>a monitor is a device to measure voltage and current</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="349"/>
<source></source>
<comment>wireless mice with internal batteries</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="353"/>
<source></source>
<comment>wireless keyboard with internal battery</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="357"/>
<source></source>
<comment>portable device</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="361"/>
<source></source>
<comment>cell phone (mobile...)</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="365"/>
<source></source>
<comment>media player, mp3 etc</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="369"/>
<source></source>
<comment>tablet device</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="373"/>
<source></source>
<comment>tablet device</comment>
<translation></translation>
</message>
@ -2219,17 +2221,17 @@
<translation type="obsolete">çıkış</translation>
</message>
<message>
<location filename="../screensaver/screensaver.cpp" line="153"/>
<location filename="../screensaver/screensaver.cpp" line="145"/>
<source>Picture does not exist</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../screensaver/screensaver.cpp" line="1191"/>
<location filename="../screensaver/screensaver.cpp" line="1205"/>
<source>View</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../screensaver/screensaver.cpp" line="1356"/>
<location filename="../screensaver/screensaver.cpp" line="1374"/>
<source>You have new notification</source>
<translation type="unfinished"></translation>
</message>
@ -2245,7 +2247,7 @@
<context>
<name>SleepTime</name>
<message>
<location filename="../screensaver/sleeptime.cpp" line="64"/>
<location filename="../screensaver/sleeptime.cpp" line="72"/>
<source>You have rested</source>
<translation type="unfinished"></translation>
</message>
@ -2273,22 +2275,22 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/surewindow.cpp" line="40"/>
<location filename="../src/surewindow.cpp" line="47"/>
<source>The following program is running to prevent the system from reboot!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/surewindow.cpp" line="43"/>
<location filename="../src/surewindow.cpp" line="50"/>
<source>The following program is running to prevent the system from shutting down!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/surewindow.cpp" line="46"/>
<location filename="../src/surewindow.cpp" line="53"/>
<source>The following program is running to prevent the system from suspend!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/surewindow.cpp" line="49"/>
<location filename="../src/surewindow.cpp" line="56"/>
<source>The following program is running to prevent the system from hibernate!</source>
<translation type="unfinished"></translation>
</message>
@ -2425,37 +2427,58 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>delay</name>
<message>
<location filename="../src/ukui-screensaver-dialog.cpp" line="179"/>
<source>how long to show lock</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>has-lock</name>
<message>
<location filename="../src/ukui-screensaver-dialog.cpp" line="182"/>
<source>if show lock</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>main</name>
<message>
<location filename="../src/ukui-screensaver-command.cpp" line="42"/>
<location filename="../src/ukui-screensaver-command.cpp" line="43"/>
<source>Start command for the ukui ScreenSaver.</source>
<translation type="unfinished">Ukui Ekran Koruyucu için başlatma komutu.</translation>
</message>
<message>
<location filename="../src/ukui-screensaver-command.cpp" line="47"/>
<location filename="../src/ukui-screensaver-command.cpp" line="48"/>
<location filename="../src/ukui-screensaver-dialog.cpp" line="166"/>
<location filename="../src/ukui-screensaver-dialog.cpp" line="168"/>
<source>lock the screen immediately</source>
<translation type="unfinished">Ekranı hemen kilitle</translation>
</message>
<message>
<location filename="../src/ukui-screensaver-command.cpp" line="50"/>
<location filename="../src/ukui-screensaver-command.cpp" line="51"/>
<source>query the status of the screen saver</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/ukui-screensaver-command.cpp" line="53"/>
<location filename="../src/ukui-screensaver-command.cpp" line="54"/>
<source>unlock the screen saver</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/ukui-screensaver-command.cpp" line="55"/>
<location filename="../src/ukui-screensaver-command.cpp" line="56"/>
<source>show the screensaver</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/ukui-screensaver-dialog.cpp" line="161"/>
<location filename="../src/ukui-screensaver-command.cpp" line="58"/>
<source>show blank and delay to lock,param:idle/lid/lowpower</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/ukui-screensaver-dialog.cpp" line="160"/>
<source>Dialog for the ukui ScreenSaver.</source>
<translation type="unfinished"></translation>
</message>
@ -2476,22 +2499,32 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../screensaver/main.cpp" line="56"/>
<location filename="../src/ukui-screensaver-dialog.cpp" line="178"/>
<source>show blank screensaver immediately and delay time to show lock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/ukui-screensaver-dialog.cpp" line="181"/>
<source>show blank screensaver immediately and if lock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../screensaver/main.cpp" line="65"/>
<source>Screensaver for ukui-screensaver</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../screensaver/main.cpp" line="60"/>
<location filename="../screensaver/main.cpp" line="69"/>
<source>show on root window</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../screensaver/main.cpp" line="62"/>
<location filename="../screensaver/main.cpp" line="71"/>
<source>show on window.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../screensaver/main.cpp" line="63"/>
<location filename="../screensaver/main.cpp" line="72"/>
<source>window id</source>
<translation type="unfinished"></translation>
</message>

View File

@ -16,7 +16,7 @@
<translation type="obsolete">使</translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="766"/>
<location filename="../src/authdialog.cpp" line="957"/>
<source>Retry</source>
<translation></translation>
</message>
@ -45,71 +45,72 @@
<translation type="vanished">%1%2</translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="252"/>
<location filename="../src/authdialog.cpp" line="253"/>
<location filename="../src/authdialog.cpp" line="320"/>
<location filename="../src/authdialog.cpp" line="321"/>
<location filename="../src/authdialog.cpp" line="326"/>
<location filename="../src/authdialog.cpp" line="327"/>
<location filename="../src/authdialog.cpp" line="396"/>
<location filename="../src/authdialog.cpp" line="397"/>
<source>Please try again in %1 minutes.</source>
<translation>%1</translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="262"/>
<location filename="../src/authdialog.cpp" line="263"/>
<location filename="../src/authdialog.cpp" line="329"/>
<location filename="../src/authdialog.cpp" line="330"/>
<location filename="../src/authdialog.cpp" line="336"/>
<location filename="../src/authdialog.cpp" line="337"/>
<location filename="../src/authdialog.cpp" line="405"/>
<location filename="../src/authdialog.cpp" line="406"/>
<source>Please try again in %1 seconds.</source>
<translation>%1</translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="272"/>
<location filename="../src/authdialog.cpp" line="273"/>
<location filename="../src/authdialog.cpp" line="338"/>
<location filename="../src/authdialog.cpp" line="339"/>
<location filename="../src/authdialog.cpp" line="346"/>
<location filename="../src/authdialog.cpp" line="347"/>
<location filename="../src/authdialog.cpp" line="414"/>
<location filename="../src/authdialog.cpp" line="415"/>
<source>Account locked permanently.</source>
<translation></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="459"/>
<location filename="../src/authdialog.cpp" line="566"/>
<source>Verify face recognition or enter password to unlock</source>
<translation></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="464"/>
<location filename="../src/authdialog.cpp" line="571"/>
<source>Press fingerprint or enter password to unlock</source>
<translation></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="469"/>
<location filename="../src/authdialog.cpp" line="576"/>
<source>Verify voiceprint or enter password to unlock</source>
<translation></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="474"/>
<location filename="../src/authdialog.cpp" line="581"/>
<source>Verify finger vein or enter password to unlock</source>
<translation></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="479"/>
<location filename="../src/authdialog.cpp" line="586"/>
<source>Verify iris or enter password to unlock</source>
<translation></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="688"/>
<location filename="../src/authdialog.cpp" line="873"/>
<source>Input Password</source>
<translation></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1011"/>
<location filename="../src/authdialog.cpp" line="1260"/>
<source>Failed to verify %1, please enter password to unlock</source>
<translation>%1</translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1015"/>
<location filename="../src/authdialog.cpp" line="1264"/>
<location filename="../src/authdialog.cpp" line="1266"/>
<source>Unable to verify %1, please enter password to unlock</source>
<translation>%1</translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1032"/>
<location filename="../src/authdialog.cpp" line="1296"/>
<source>Abnormal network</source>
<translation></translation>
</message>
@ -118,8 +119,8 @@
<translation type="vanished">使</translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="537"/>
<location filename="../src/authdialog.cpp" line="538"/>
<location filename="../src/authdialog.cpp" line="649"/>
<location filename="../src/authdialog.cpp" line="650"/>
<source>Password cannot be empty</source>
<translation></translation>
</message>
@ -132,7 +133,8 @@
<translation type="vanished">%1.</translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1021"/>
<location filename="../src/authdialog.cpp" line="1279"/>
<location filename="../src/authdialog.cpp" line="1283"/>
<source>Failed to verify %1, you still have %2 verification opportunities</source>
<translation>%1%2</translation>
</message>
@ -161,22 +163,32 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="726"/>
<location filename="../src/authdialog.cpp" line="912"/>
<source>Authentication failure, Please try again</source>
<translation></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="484"/>
<location filename="../src/authdialog.cpp" line="591"/>
<source>Use the bound wechat scanning code or enter the password to unlock</source>
<translation>使</translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="686"/>
<location filename="../src/authdialog.cpp" line="223"/>
<source>Enter the ukey password</source>
<translation></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="240"/>
<source>Insert the ukey into the USB port</source>
<translation>USB端口</translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="871"/>
<source>Password </source>
<translation> </translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="754"/>
<location filename="../src/authdialog.cpp" line="940"/>
<source>Login</source>
<translation></translation>
</message>
@ -298,6 +310,44 @@
<translation></translation>
</message>
</context>
<context>
<name>CharsMoreWidget</name>
<message>
<source>Return</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../VirtualKeyboard/src/charsmorewidget.cpp" line="166"/>
<source>&amp;&amp;?!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CharsWidget</name>
<message>
<location filename="../VirtualKeyboard/src/charswidget.cpp" line="97"/>
<source>More</source>
<translation></translation>
</message>
<message>
<location filename="../VirtualKeyboard/src/charswidget.cpp" line="111"/>
<source>ABC</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../VirtualKeyboard/src/charswidget.cpp" line="124"/>
<source>123</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Return</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Number</source>
<translation type="vanished"></translation>
</message>
</context>
<context>
<name>ConfForm</name>
<message>
@ -444,6 +494,11 @@
</message>
<message>
<location filename="../BiometricAuth/biometricdeviceinfo.cpp" line="71"/>
<source>ukey</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../BiometricAuth/biometricdeviceinfo.cpp" line="73"/>
<source>QRCode</source>
<translation></translation>
</message>
@ -1781,14 +1836,6 @@
<translation></translation>
</message>
</context>
<context>
<name>KeyboardWidget</name>
<message>
<location filename="../VirtualKeyboard/src/keyboardwidget.ui" line="29"/>
<source>KeyboardWidget</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>KylinDBus</name>
<message>
@ -2034,6 +2081,37 @@
<translation>线</translation>
</message>
</context>
<context>
<name>LettersWidget</name>
<message>
<source>Symbol</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Num</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../VirtualKeyboard/src/letterswidget.cpp" line="138"/>
<source>&amp;&amp;?!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../VirtualKeyboard/src/letterswidget.cpp" line="152"/>
<source>123</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../VirtualKeyboard/src/letterswidget.cpp" line="166"/>
<source>Ctrl</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../VirtualKeyboard/src/letterswidget.cpp" line="194"/>
<source>Alt</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LockWidget</name>
<message>
@ -2060,17 +2138,17 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="1092"/>
<location filename="../src/lockwidget.cpp" line="1135"/>
<source>Multiple users are logged in at the same time.Are you sure you want to reboot this system?</source>
<translation>退</translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="1400"/>
<location filename="../src/lockwidget.cpp" line="1445"/>
<source>LAN</source>
<translation type="unfinished">线</translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="1402"/>
<location filename="../src/lockwidget.cpp" line="1447"/>
<source>WLAN</source>
<translation type="unfinished">线</translation>
</message>
@ -2078,20 +2156,21 @@
<context>
<name>LoginOptionsWidget</name>
<message>
<location filename="../src/loginoptionswidget.cpp" line="64"/>
<location filename="../src/loginoptionswidget.cpp" line="73"/>
<source>Login Options</source>
<translation></translation>
</message>
<message>
<location filename="../src/loginoptionswidget.cpp" line="270"/>
<source>Password</source>
<translation type="vanished"></translation>
<translation></translation>
</message>
<message>
<source>Wechat</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../src/loginoptionswidget.cpp" line="550"/>
<location filename="../src/loginoptionswidget.cpp" line="664"/>
<source>Identify device removed!</source>
<translation>!</translation>
</message>
@ -2106,6 +2185,23 @@
<translation></translation>
</message>
</context>
<context>
<name>NumbersWidget</name>
<message>
<source>Symbol</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../VirtualKeyboard/src/numberswidget.cpp" line="143"/>
<source>&amp;&amp;?!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../VirtualKeyboard/src/numberswidget.cpp" line="157"/>
<source>Return</source>
<translation></translation>
</message>
</context>
<context>
<name>OneConnForm</name>
<message>
@ -2333,14 +2429,14 @@
<translation></translation>
</message>
<message>
<location filename="../src/powermanager.cpp" line="334"/>
<location filename="../src/powermanager.cpp" line="673"/>
<source>Restart</source>
<translation type="vanished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/powermanager.cpp" line="334"/>
<location filename="../src/powermanager.cpp" line="672"/>
<source>Reboot</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../src/powermanager.cpp" line="354"/>
@ -2348,17 +2444,17 @@
<translation></translation>
</message>
<message>
<location filename="../src/powermanager.cpp" line="691"/>
<location filename="../src/powermanager.cpp" line="694"/>
<source>Shut Down</source>
<translation></translation>
</message>
<message>
<location filename="../src/powermanager.cpp" line="718"/>
<location filename="../src/powermanager.cpp" line="722"/>
<source>Hibernate</source>
<translation></translation>
</message>
<message>
<location filename="../src/powermanager.cpp" line="746"/>
<location filename="../src/powermanager.cpp" line="751"/>
<source>Suspend</source>
<translation></translation>
</message>
@ -2370,12 +2466,12 @@
<context>
<name>QObject</name>
<message>
<location filename="../src/ukui-screensaver-command.cpp" line="78"/>
<location filename="../src/ukui-screensaver-command.cpp" line="90"/>
<source>The screensaver is active.</source>
<translation></translation>
</message>
<message>
<location filename="../src/ukui-screensaver-command.cpp" line="80"/>
<location filename="../src/ukui-screensaver-command.cpp" line="92"/>
<source>The screensaver is inactive.</source>
<translation></translation>
</message>
@ -2400,7 +2496,7 @@
<translation type="vanished">退</translation>
</message>
<message>
<location filename="../screensaver/screensaver.cpp" line="153"/>
<location filename="../screensaver/screensaver.cpp" line="145"/>
<source>Picture does not exist</source>
<translation></translation>
</message>
@ -2417,12 +2513,12 @@
<translation type="obsolete">%1</translation>
</message>
<message>
<location filename="../screensaver/screensaver.cpp" line="1356"/>
<location filename="../screensaver/screensaver.cpp" line="1374"/>
<source>You have new notification</source>
<translation></translation>
</message>
<message>
<location filename="../screensaver/screensaver.cpp" line="1191"/>
<location filename="../screensaver/screensaver.cpp" line="1205"/>
<source>View</source>
<translation></translation>
</message>
@ -2434,7 +2530,7 @@
<translation type="vanished">:</translation>
</message>
<message>
<location filename="../screensaver/sleeptime.cpp" line="64"/>
<location filename="../screensaver/sleeptime.cpp" line="72"/>
<source>You have rested</source>
<translation></translation>
</message>
@ -2466,22 +2562,22 @@
<translation type="vanished">退</translation>
</message>
<message>
<location filename="../src/surewindow.cpp" line="46"/>
<location filename="../src/surewindow.cpp" line="53"/>
<source>The following program is running to prevent the system from suspend!</source>
<translation></translation>
</message>
<message>
<location filename="../src/surewindow.cpp" line="49"/>
<location filename="../src/surewindow.cpp" line="56"/>
<source>The following program is running to prevent the system from hibernate!</source>
<translation></translation>
</message>
<message>
<location filename="../src/surewindow.cpp" line="43"/>
<location filename="../src/surewindow.cpp" line="50"/>
<source>The following program is running to prevent the system from shutting down!</source>
<translation></translation>
</message>
<message>
<location filename="../src/surewindow.cpp" line="40"/>
<location filename="../src/surewindow.cpp" line="47"/>
<source>The following program is running to prevent the system from reboot!</source>
<translation></translation>
</message>
@ -2641,37 +2737,58 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>delay</name>
<message>
<location filename="../src/ukui-screensaver-dialog.cpp" line="179"/>
<source>how long to show lock</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>has-lock</name>
<message>
<location filename="../src/ukui-screensaver-dialog.cpp" line="182"/>
<source>if show lock</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>main</name>
<message>
<location filename="../src/ukui-screensaver-command.cpp" line="42"/>
<location filename="../src/ukui-screensaver-command.cpp" line="43"/>
<source>Start command for the ukui ScreenSaver.</source>
<translation></translation>
</message>
<message>
<location filename="../src/ukui-screensaver-command.cpp" line="47"/>
<location filename="../src/ukui-screensaver-command.cpp" line="48"/>
<location filename="../src/ukui-screensaver-dialog.cpp" line="166"/>
<location filename="../src/ukui-screensaver-dialog.cpp" line="168"/>
<source>lock the screen immediately</source>
<translation></translation>
</message>
<message>
<location filename="../src/ukui-screensaver-command.cpp" line="50"/>
<location filename="../src/ukui-screensaver-command.cpp" line="51"/>
<source>query the status of the screen saver</source>
<translation></translation>
</message>
<message>
<location filename="../src/ukui-screensaver-command.cpp" line="53"/>
<location filename="../src/ukui-screensaver-command.cpp" line="54"/>
<source>unlock the screen saver</source>
<translation></translation>
</message>
<message>
<location filename="../src/ukui-screensaver-command.cpp" line="55"/>
<location filename="../src/ukui-screensaver-command.cpp" line="56"/>
<source>show the screensaver</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/ukui-screensaver-dialog.cpp" line="161"/>
<location filename="../src/ukui-screensaver-command.cpp" line="58"/>
<source>show blank and delay to lock,param:idle/lid/lowpower</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/ukui-screensaver-dialog.cpp" line="160"/>
<source>Dialog for the ukui ScreenSaver.</source>
<translation type="unfinished"></translation>
</message>
@ -2692,22 +2809,32 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../screensaver/main.cpp" line="56"/>
<location filename="../src/ukui-screensaver-dialog.cpp" line="178"/>
<source>show blank screensaver immediately and delay time to show lock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/ukui-screensaver-dialog.cpp" line="181"/>
<source>show blank screensaver immediately and if lock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../screensaver/main.cpp" line="65"/>
<source>Screensaver for ukui-screensaver</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../screensaver/main.cpp" line="60"/>
<location filename="../screensaver/main.cpp" line="69"/>
<source>show on root window</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../screensaver/main.cpp" line="62"/>
<location filename="../screensaver/main.cpp" line="71"/>
<source>show on window.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../screensaver/main.cpp" line="63"/>
<location filename="../screensaver/main.cpp" line="72"/>
<source>window id</source>
<translation type="unfinished"></translation>
</message>

View File

@ -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

View File

@ -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;

View File

@ -34,6 +34,7 @@
#include "config.h"
#define WORKING_DIRECTORY "/usr/share/ukui-screensaver"
bool bControlFlg = false;//是否控制面板窗口
int main(int argc, char *argv[])
@ -44,6 +45,14 @@ int main(int argc, char *argv[])
#endif
QApplication a(argc, argv);
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())
{

View File

@ -21,6 +21,10 @@
#include <QSettings>
#include <QGSettings>
#include <QString>
#include <kysdk/kysdk-system/libkysysinfo.h>
#include <QScreen>
#include <QApplication>
#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
return "/usr/share/backgrounds/1-openkylin.jpg";
} 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 = "<<defaultFontSize;
return fontSize - defaultFontSize;
}
double SCConfiguration::getPtToPx()
{
double m_ptTopx = 1.0;
if (QApplication::primaryScreen()->logicalDotsPerInch() > 0)
m_ptTopx = 72/(QApplication::primaryScreen()->logicalDotsPerInch());
return m_ptTopx;
}
bool SCConfiguration::getAutoSwitch()
{
bool ret = false;

View File

@ -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();

View File

@ -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;i<labelList.count();i++)
{
int fontsize = labelList.at(i)->font().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<QWidget*> childList = timeLayout->findChildren<QWidget *>();
for (int i = 0; i < childList.count(); ++i) {
@ -637,10 +645,6 @@ void Screensaver::setUpdateCenterWidget()
QString languageDirPath=cwdPath+"language/";
QString defaultLanguageFilePath=languageDirPath+"screensaver-en_US.ini";
qDebug()<<"homePath="<<homePath;
if (qsettings) {
delete qsettings;
qsettings = nullptr;
}
if (!lang.isEmpty()){
qDebug()<<"lang = "<<lang;
if(lang.contains('.')){
@ -667,19 +671,19 @@ void Screensaver::setUpdateCenterWidget()
}
if(useJd && jdConfigFileInfo.isFile()){
qsettings = new QSettings(jdLanguageFilePath,QSettings::IniFormat,this);
qsettings = new QSettings(jdLanguageFilePath,QSettings::IniFormat);
}else if (homeConfigFileInfo.isFile()){
qsettings = new QSettings(homeLanguageFilePath,QSettings::IniFormat,this);
qsettings = new QSettings(homeLanguageFilePath,QSettings::IniFormat);
}
else if(fileInfo.isFile()){
qsettings = new QSettings(languageFilePath,QSettings::IniFormat,this);
qsettings = new QSettings(languageFilePath,QSettings::IniFormat);
}
else{
qsettings = new QSettings(defaultLanguageFilePath,QSettings::IniFormat,this);
qsettings = new QSettings(defaultLanguageFilePath,QSettings::IniFormat);
}
}
else{
qsettings = new QSettings(defaultLanguageFilePath,QSettings::IniFormat,this);
qsettings = new QSettings(defaultLanguageFilePath,QSettings::IniFormat);
}
qsettings->setIniCodec(QTextCodec::codecForName("UTF-8"));
@ -777,7 +781,7 @@ void Screensaver::onBackgroundChanged()
}
void Screensaver::updateCenterWidget(int index)
{
if(!centerWidget || !qsettings)
if(!centerWidget )
return ;
QStringList qlist = qsettings->childGroups();
@ -966,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
@ -977,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();
@ -1094,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;
}
@ -1169,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 != "")
@ -1201,8 +1211,6 @@ void Screensaver::setPreviewText(bool bVisible)
void Screensaver::setCenterWidget()
{
if (!qsettings)
return ;
QStringList qlist = qsettings->childGroups();
if(qlist.count()<1)
return;
@ -1266,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();

View File

@ -111,7 +111,7 @@ private:
QPushButton *settingsButton;
QPushButton *WallpaperButton;
QWidget *buttonWidget;
QSettings *qsettings = nullptr;
QSettings *qsettings;
MBackground *m_background;
@ -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();
};

View File

@ -20,11 +20,13 @@
#include <QLabel>
#include <QDebug>
#include <QListWidget>
#include <QApplication>
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);

View File

@ -19,6 +19,7 @@
#ifndef SLEEPTIME_H
#define SLEEPTIME_H
#include "scconfiguration.h"
#include <QWidget>
#include <QLabel>
#include <QTimer>
@ -36,6 +37,7 @@ public:
void setSmallMode();
private:
SCConfiguration *configuration;
QLabel *restTime;
QList<QLabel *> 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);

View File

@ -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

View File

@ -28,6 +28,8 @@
#include <QApplication>
#include <QWidget>
#include <QGSettings/QGSettings>
#include <kysdk/kysdk-system/libkysysinfo.h>
extern "C" {
#include <X11/Xatom.h>
#include <X11/Xlib.h>
@ -41,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)
{
@ -57,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);
}
/* 判断文件是否存在 */
@ -119,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");
@ -173,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)) {
@ -198,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;
}

View File

@ -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)
@ -29,6 +31,13 @@ include_directories(
${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
@ -41,6 +50,8 @@ set(EXTRA_LIBS
${GLIB_LIBRARIES}
${MMIX_LIBRARIES}
${KF5Wayland_LIBRARIES}
${KDKINFO_LIBRARIES}
${IMLIB2_LIBRARIES}
-lrt
-lpthread
-lKF5WaylandServer
@ -101,7 +112,8 @@ qt5_wrap_cpp(dialog_SRC
lockchecker.h
servicemanager.h
mytabwidget.h
plasma-shell-manager.h
modebutton.h
klabel.h
PhysicalDeviceSet/brightnessdeviceset.h
PhysicalDeviceSet/flightmodeset.h
PhysicalDeviceSet/sounddeviceset.h
@ -110,6 +122,7 @@ qt5_wrap_cpp(dialog_SRC
enginedevice.h
batterywidget.h
libinputswitchevent.h
machinemodel.h
)
set(dialog_SRC
@ -153,7 +166,9 @@ set(dialog_SRC
lockchecker.cpp
servicemanager.cpp
mytabwidget.cpp
plasma-shell-manager.cpp
modebutton.cpp
klabel.cpp
rootWindowBackground.cpp
PhysicalDeviceSet/brightnessdeviceset.cpp
PhysicalDeviceSet/flightmodeset.cpp
PhysicalDeviceSet/sounddeviceset.cpp
@ -162,6 +177,7 @@ set(dialog_SRC
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)
@ -180,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)
@ -202,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
@ -216,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
@ -223,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

View File

@ -112,6 +112,7 @@
<file>assets/ukui-loginopt-finger.svg</file>
<file>assets/ukui-loginopt-face.svg</file>
<file>assets/ukui-loginopt-password.svg</file>
<file>assets/ukui-loginopt-ukey.svg</file>
<file>assets/selected.svg</file>
<file>assets/keyboard.svg</file>
<file>assets/ukui-loginopt-smile.svg</file>
@ -124,4 +125,7 @@
<file>assets/hibernate.svg</file>
<file>assets/switchuser.svg</file>
</qresource>
<qresource prefix="/">
<file>assets/data/conf.ini</file>
</qresource>
</RCC>

View File

@ -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;
}
@ -112,13 +108,11 @@ QLineEdit::focus{
/* PAM message提示*/
#messageLabel {
font-size: 16px;
color: white;
}
#messageButton{
text-align:center;
font-size: 16px;
color: white;
}
@ -129,7 +123,6 @@ QMenu{
color: white;
border-radius: 4px;
width:250px;
font-size: 16px;
padding: 5px 5px 5px 5px;
}
@ -141,7 +134,6 @@ QMenu::item
width:225px;
border-radius: 4px;
height:36px;
font-size:16px;
padding: 2px 10px 2px 10px;
}

15
src/assets/data/conf.ini Normal file
View File

@ -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]台式机

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
<style type="text/css">
.st0{display:none;}
.st1{display:inline;fill:#262626;}
.st2{display:inline;fill:none;stroke:#262626;stroke-linecap:round;stroke-miterlimit:10;}
.st3{fill:#262626;}
.st4{fill:none;stroke:#262626;stroke-linecap:round;stroke-miterlimit:10;}
</style>
<g id="图层_1" class="st0">
<path class="st1" d="M5,5.6C5,5.3,5.3,5,5.6,5c0,0,0,0,0,0h5.8C11.7,5,12,5.3,12,5.6v0v7.8c0,0.3-0.3,0.6-0.6,0.6l0,0H5.6
C5.3,14,5,13.7,5,13.4V5.6 M4,5.6v7.8C4,14.3,4.7,15,5.6,15h5.8c0.9,0,1.6-0.7,1.6-1.6c0,0,0,0,0,0V5.6C13,4.7,12.3,4,11.4,4
c0,0,0,0,0,0H5.6C4.7,4,4,4.7,4,5.6L4,5.6z"/>
<path class="st1" d="M7,3h3v1H7V3 M6,3v2h5V3c0-0.6-0.4-1-1-1H7C6.4,2,6,2.4,6,3z"/>
<path class="st1" d="M8,6.5v6C8,12.8,8.2,13,8.5,13S9,12.8,9,12.5v-6C9,6.2,8.8,6,8.5,6S8,6.2,8,6.5z"/>
<path class="st2" d="M8,10.5L8,10.5c-0.8,0-1.5-0.7-1.5-1.5V8"/>
<path class="st2" d="M9,9.5L9,9.5c0.8,0,1.5-0.7,1.5-1.5V7"/>
</g>
<g id="图层_1_x5F_复制">
<path class="st3" d="M3,4.6C3,4.3,3.3,4,3.6,4c0,0,0,0,0,0h7.8C11.7,4,12,4.3,12,4.6v0v8.8c0,0.3-0.3,0.6-0.6,0.6l0,0H3.6
C3.3,14,3,13.7,3,13.4V4.6 M2,4.6v8.8C2,14.3,2.7,15,3.6,15h7.8c0.9,0,1.6-0.7,1.6-1.6c0,0,0,0,0,0V4.6C13,3.7,12.3,3,11.4,3
c0,0,0,0,0,0H3.6C2.7,3,2,3.7,2,4.6L2,4.6z"/>
<path class="st3" d="M5,2h5v1H5V2 M4,2v2h7V2c0-0.6-0.4-1-1-1H5C4.4,1,4,1.4,4,2z"/>
<path class="st3" d="M7,6.5v6C7,12.8,7.2,13,7.5,13S8,12.8,8,12.5v-6C8,6.2,7.8,6,7.5,6S7,6.2,7,6.5z"/>
<path class="st4" d="M7,10.5L7,10.5c-0.8,0-1.5-0.7-1.5-1.5V8"/>
<path class="st4" d="M8,9.5L8,9.5c0.8,0,1.5-0.7,1.5-1.5V7"/>
<rect x="7" y="1" class="st3" width="1" height="2"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -30,20 +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),
@ -63,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(); //这里写函数声明
@ -120,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);
@ -128,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);
@ -142,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);
@ -160,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);
@ -200,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类型的消息后再显示*/
@ -213,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;
@ -281,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)
{
@ -346,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)
{
@ -366,32 +444,30 @@ 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);
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);
@ -399,6 +475,16 @@ 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)}"
@ -410,12 +496,15 @@ void AuthDialog::setChildrenGeometry()
void AuthDialog::switchLoginOptType(unsigned uLoginOptType)
{
qDebug()<<"switchLoginOptType"<<uLoginOptType;
switch(uLoginOptType) {
case LOGINOPT_TYPE_PASSWORD:
{
m_labelHeadImg->show();
m_labelQRCode->hide();
m_labelFace->hide();
m_passwdWidget->show();
m_ukeyPasswdWidget->hide();
}
break;
case LOGINOPT_TYPE_FACE:
@ -423,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:
@ -433,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:
@ -441,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:
@ -484,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;
}
@ -559,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 {
@ -571,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()));
@ -588,7 +713,10 @@ void AuthDialog::setX11Focus()
void AuthDialog::setFocusin(int target)
{
if(m_passwordEdit) {
if(m_passwordEdit && m_passwordEdit->isVisible()) {
if (m_ukeyPasswordEdit) {
m_ukeyPasswordEdit->setFocusin(2);
}
switch (target) {
case REMOVE: //焦点清除
if(m_widgetLoginOpts)
@ -637,6 +765,58 @@ void AuthDialog::setFocusin(int 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;
}
}
}
@ -647,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<<authMode;
QString text = prompt;
if(text == BIOMETRIC_PAM || text == BIOMETRIC_PAM_DOUBLE || text == BIOMETRIC_PAM_QRCODE) {
@ -673,7 +857,8 @@ void AuthDialog::onShowPrompt(const QString &prompt, Auth::PromptType type)
m_passwordEdit->show();
}
m_passwordEdit->setFocus();
if (m_passwordEdit->isVisible())
m_passwordEdit->setFocus();
prompted = true;
unacknowledged_messages = false;
@ -691,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);
@ -752,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();
@ -786,6 +977,14 @@ 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;
@ -840,6 +1039,7 @@ void AuthDialog::clearMessage()
void AuthDialog::performBiometricAuth()
{
qDebug()<<"performBiometricAuth";
if(!m_biometricProxy)
{
m_biometricProxy = new BiometricProxy(this);
@ -874,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;
}
@ -907,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();
}
@ -942,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();
@ -953,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:"<<m_widgetLoginOpts->geometry()<<","<<m_passwdWidget->geometry()
<<","<<geometry()<<",isHidden:"<<m_widgetLoginOpts->isHidden();
}
@ -961,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:"<<deviceInfo->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();
@ -1011,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()<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
}
}
@ -1101,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();
@ -1122,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");
@ -1146,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)
{
@ -1190,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:"<<isLoadingUkey;
if (isLoadingUkey) {
m_deviceName = m_widgetLoginOpts->getDefaultDevice(user.name,UniT_General_Ukey);
} else {
m_deviceName = m_widgetLoginOpts->getDefaultDevice(user.name);
}
}
qDebug() << m_deviceName;
if (m_deviceInfo) {
@ -1219,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();
}
@ -1300,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;
}
@ -1331,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;
}

View File

@ -30,21 +30,21 @@
#include "users.h"
#include "biometricdeviceinfo.h"
#include "pam-tally.h"
#include "uniauthservice.h"
namespace Ui {
class AuthDialog;
}
class QLabel;
class KLabel;
class QPushButton;
class Configuration;
class IconEdit;
class Auth;
class BiometricProxy;
class BiometricAuthWidget;
class BiometricDevicesWidget;
class PamTally;
class LoginOptionsWidget;
class UniAuthService;
enum FOCUS {
REMOVE = 0,
@ -84,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();
@ -134,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;
@ -152,19 +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; // 生物认证是否成功
@ -193,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

View File

@ -26,11 +26,17 @@
#include <QGSettings>
#include <QMimeType>
#include <ctime>
#include <kysdk/kysdk-system/libkysysinfo.h>
#include <QScreen>
#include <QApplication>
#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"
@ -59,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;
@ -95,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 = "<<defaultFontSize;
curFontSize = fsGsettings->get(KEY_FONT_SIZE).toDouble() - defaultFontSize;
}
Configuration* Configuration::instance(QObject *parent)
@ -206,7 +222,20 @@ QString Configuration::getBackground()
if(ispicture(background))
return background;
return "/usr/share/backgrounds/1-openkylin.jpg";
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";
}
bool Configuration::lockWhenXScreensaverActivated()
@ -228,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;
}

Some files were not shown because too many files have changed in this diff Show More