!86 添加维哈柯语言下布局切换为从右往左

Merge pull request !86 from liudunfa/openkylin/nile
This commit is contained in:
杨敏 2024-06-04 12:49:52 +00:00 committed by openkylin-cibot
parent aaf6674bfb
commit 3a2b1f6254
2 changed files with 700 additions and 0 deletions

699
debian/patches/0034-86.patch vendored Normal file
View File

@ -0,0 +1,699 @@
From: =?utf-8?b?5p2o5pWP?= <yangmin@kylinos.cn>
Date: Tue, 4 Jun 2024 12:49:52 +0000
Subject: =?utf-8?b?ITg2IOa3u+WKoOe7tOWTiOafr+ivreiogOS4i+W4g+WxgOWIh+aNog==?=
=?utf-8?b?5Li65LuO5Y+z5b6A5bemIE1lcmdlIHB1bGwgcmVxdWVzdCAhODYgZnJvbSBsaXVk?=
=?utf-8?b?dW5mYS9vcGVua3lsaW4vbmlsZQ==?=
---
src/common/definetypes.h | 2 +
src/lock-backend/gsettingshelper.cpp | 14 +++
src/lock-backend/gsettingshelper.h | 2 +
src/screensaver/scconfiguration.cpp | 3 +-
src/screensaver/screensaver.cpp | 13 ++-
src/widgets/iconedit.cpp | 35 +++++-
src/widgets/iconedit.h | 4 +
src/widgets/lockwidget.cpp | 221 +++++++++++++++++++++--------------
src/widgets/lockwidget.h | 15 +++
src/widgets/loginoptionswidget.cpp | 7 ++
src/widgets/mylistwidget.cpp | 25 ++++
src/widgets/mylistwidget.h | 4 +
src/widgets/powerlistwidget.cpp | 1 +
13 files changed, 250 insertions(+), 96 deletions(-)
diff --git a/src/common/definetypes.h b/src/common/definetypes.h
index ea9520f..9d3afd5 100644
--- a/src/common/definetypes.h
+++ b/src/common/definetypes.h
@@ -174,6 +174,8 @@ typedef enum _LOCK_CMD_ID_e
#define GLIB_KEY_SYSTEM_FONT_SIZE "system-font-size"
#define KEY_THEME_COLOR "themeColor"
#define KEY_SYSTEM_FONT "systemFont"
+#define KEY_MENU_TRANSPARENCY "menuTransparency"
+#define KEY_STYLE_NAME "styleName"
#define GSETTINGS_SCHEMA_SESSION "org.ukui.session"
#define KEY_SESSION_IDLE "idleDelay"
diff --git a/src/lock-backend/gsettingshelper.cpp b/src/lock-backend/gsettingshelper.cpp
index e7b002e..b1c1caf 100644
--- a/src/lock-backend/gsettingshelper.cpp
+++ b/src/lock-backend/gsettingshelper.cpp
@@ -214,6 +214,12 @@ bool GSettingsHelper::initThemeStyle()
if (keys.contains(KEY_THEME_COLOR)) {
m_strThemeColor = m_gsThemeStyle->get(KEY_THEME_COLOR).toString();
}
+ if (keys.contains(KEY_MENU_TRANSPARENCY)) {
+ m_menuTransparency = m_gsThemeStyle->get(KEY_MENU_TRANSPARENCY).toInt();
+ }
+ if (keys.contains(KEY_STYLE_NAME)) {
+ m_styleName = m_gsThemeStyle->get(KEY_STYLE_NAME).toString();
+ }
}
}
return (bool)(m_gsThemeStyle);
@@ -405,6 +411,10 @@ void GSettingsHelper::onThemeStyleConfigChanged(QString strKey)
varValue = m_strThemeColor = m_gsThemeStyle->get(KEY_THEME_COLOR).toString();
} else if (strKey == KEY_SYSTEM_FONT) {
varValue = m_font = m_gsThemeStyle->get(KEY_SYSTEM_FONT).toString();
+ } else if (strKey == KEY_MENU_TRANSPARENCY) {
+ varValue = m_menuTransparency = m_gsThemeStyle->get(KEY_MENU_TRANSPARENCY).toInt();
+ } else if (strKey == KEY_STYLE_NAME) {
+ varValue = m_styleName = m_gsThemeStyle->get(KEY_STYLE_NAME).toString();
}
Q_EMIT themeStyleConfigChanged(strKey, varValue);
}
@@ -634,6 +644,10 @@ QVariant GSettingsHelper::GetThemeStyleConf(QString strKey)
varValue = m_lfFontSize;
} else if (strKey == KEY_THEME_COLOR) {
varValue = m_strThemeColor;
+ } else if (strKey == KEY_MENU_TRANSPARENCY) {
+ varValue = m_menuTransparency;
+ } else if (strKey == KEY_STYLE_NAME) {
+ varValue = m_styleName;
}
}
return varValue;
diff --git a/src/lock-backend/gsettingshelper.h b/src/lock-backend/gsettingshelper.h
index 7d11a70..46d88a4 100644
--- a/src/lock-backend/gsettingshelper.h
+++ b/src/lock-backend/gsettingshelper.h
@@ -135,6 +135,8 @@ private:
double m_lfFontSize = 0.0;
QString m_strThemeColor;
QString m_font;
+ int m_menuTransparency = 0;
+ QString m_styleName;
int m_nSessionIdle = -1;
bool m_nSessionLogout = false;
diff --git a/src/screensaver/scconfiguration.cpp b/src/screensaver/scconfiguration.cpp
index e7bfbd8..e2c2f91 100644
--- a/src/screensaver/scconfiguration.cpp
+++ b/src/screensaver/scconfiguration.cpp
@@ -228,8 +228,7 @@ QString SCConfiguration::getMyText()
int SCConfiguration::getBlurNumber()
{
int blurNum = 50;
- blurNum = m_helperBackendDbus->getUkccPluginsConf("menuTransparency").toInt();
- qDebug() << "????nm" << blurNum;
+ blurNum = m_helperBackendDbus->getThemeStyleConf("menuTransparency").toInt();
return blurNum;
}
diff --git a/src/screensaver/screensaver.cpp b/src/screensaver/screensaver.cpp
index d49410f..c246e95 100644
--- a/src/screensaver/screensaver.cpp
+++ b/src/screensaver/screensaver.cpp
@@ -560,10 +560,15 @@ void Screensaver::resizeEvent(QResizeEvent * /*event*/)
}
flag = 1;
#ifndef USE_INTEL
- if (myTextWidget) {
- onBlurNumChanged(blur_Num);
- onStyleChanged(curStyle);
- cycleLabel->setFixedSize(5, 5);
+ if(myTextWidget){
+ if(curStyle == "ukui-dark" || curStyle == "ukui-black"){
+ myTextLabel->setStyleSheet(QString("QLabel{font-size: 5px; background: rgba(0, 0, 0, %1); color:#FFFFFF; border-radius: 2px; padding: 4px 8px 4px 8px; border-width: 1px;}").arg(blur_Num * 0.01));
+ cycleLabel->setStyleSheet(QString("QLabel{background: rgba(0, 0, 0, %1); color:#FFFFFF; border-radius:3px}").arg(blur_Num * 0.01));
+ } else{
+ myTextLabel->setStyleSheet(QString("QLabel{font-size: 5px; background: rgba(255, 255, 255, %1); border-radius:2px; padding: 4px 8px 4px 8px; border-width: 1px;}").arg(blur_Num * 0.01));
+ cycleLabel->setStyleSheet(QString("QLabel{background: rgba(255, 255, 255, %1); border-radius:3px}").arg(blur_Num * 0.01));
+ }
+ cycleLabel->setFixedSize(6, 6);
}
if (screenLabel)
screenLabel->adjustSize();
diff --git a/src/widgets/iconedit.cpp b/src/widgets/iconedit.cpp
index d72748e..9e82ad4 100644
--- a/src/widgets/iconedit.cpp
+++ b/src/widgets/iconedit.cpp
@@ -66,7 +66,7 @@ IconEdit::IconEdit(LockDialogModel *model, QWidget *parent) : QWidget(parent), m
m_iconButton->setProperty("isImportant", true);
QHBoxLayout *layout = new QHBoxLayout(this);
- layout->setContentsMargins(1, 1, 8, 1);
+ layout->setContentsMargins(8, 1, 8, 1);
layout->setSpacing(2);
layout->addStretch();
layout->addWidget(m_capsIcon);
@@ -75,6 +75,13 @@ IconEdit::IconEdit(LockDialogModel *model, QWidget *parent) : QWidget(parent), m
connect(m_edit, &QLineEdit::returnPressed, this, &IconEdit::clicked_cb);
connect(m_iconButton, &QPushButton::clicked, this, &IconEdit::clicked_cb);
+ connect(m_edit, &QLineEdit::textChanged, this, [=](QString text){
+ if (!text.isEmpty()) {
+ setLayoutDirection(Qt::LeftToRight);
+ } else if (systemLang == "ug_CN" || systemLang == "ky_KG" || systemLang == "kk_KZ") {
+ setLayoutDirection(Qt::RightToLeft);
+ }
+ });
m_edit->setAttribute(Qt::WA_InputMethodEnabled, false); // 禁用输入法
m_edit->setContextMenuPolicy(Qt::NoContextMenu); // 禁用右键菜单
@@ -82,6 +89,14 @@ IconEdit::IconEdit(LockDialogModel *model, QWidget *parent) : QWidget(parent), m
m_iconButton->setFocusPolicy(Qt::TabFocus);
m_iconButton->installEventFilter(this);
this->setFocusProxy(m_edit);
+
+ QLocale local;
+ systemLang = local.name();
+ if (systemLang == "ug_CN" || systemLang == "ky_KG" || systemLang == "kk_KZ") {
+ setLayoutDirection(Qt::RightToLeft);
+ } else {
+ setLayoutDirection(Qt::LeftToRight);
+ }
}
void IconEdit::resizeEvent(QResizeEvent *)
@@ -136,6 +151,24 @@ bool IconEdit::eventFilter(QObject *obj, QEvent *event)
return false;
}
+void IconEdit::changeEvent(QEvent *event)
+{
+ if (event->type() == QEvent::LanguageChange) {
+ refreshTranslate();
+ }
+}
+
+void IconEdit::refreshTranslate()
+{
+ QLocale local;
+ systemLang = local.name();
+ if (systemLang == "ug_CN" || systemLang == "ky_KG" || systemLang == "kk_KZ") {
+ setLayoutDirection(Qt::RightToLeft);
+ } else {
+ setLayoutDirection(Qt::LeftToRight);
+ }
+}
+
void IconEdit::setIcon(const QIcon &icon, const QSize &size)
{
QPixmap pixmap = icon.pixmap(size.width(), size.height());
diff --git a/src/widgets/iconedit.h b/src/widgets/iconedit.h
index ac731f4..efc2fd0 100644
--- a/src/widgets/iconedit.h
+++ b/src/widgets/iconedit.h
@@ -53,10 +53,12 @@ public:
protected:
void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
bool eventFilter(QObject *obj, QEvent *event);
+ void changeEvent(QEvent *event);
private:
void updatePixmap();
void resetFocus();
+ void refreshTranslate();
Q_SIGNALS:
void clicked(const QString &);
@@ -79,6 +81,8 @@ private:
QPixmap m_waitingPixmap;
bool m_capsState = false;
QSize m_sizeIconBtn;
+
+ QString systemLang;
};
#endif // ICONEDIT_H
diff --git a/src/widgets/lockwidget.cpp b/src/widgets/lockwidget.cpp
index 2734d08..9214ef6 100644
--- a/src/widgets/lockwidget.cpp
+++ b/src/widgets/lockwidget.cpp
@@ -31,6 +31,7 @@
#include <QPushButton>
#include <QApplication>
#include <QScreen>
+#include <QHBoxLayout>
#include <QtConcurrent/QtConcurrentRun>
#include "poweritemwidget.h"
#include "useritemwidget.h"
@@ -224,39 +225,22 @@ void LockWidget::resizeEvent(QResizeEvent *event)
buttonListWidget->setFixedSize(
QSize(48 * buttonListWidget->count() + buttonListWidget->spacing() * 2 * buttonListWidget->count(), 64));
}
- buttonListWidget->move(
- width() - buttonListWidget->width() - RIGHT_MARGIN * scale,
- height() - buttonListWidget->height() - BOTTOM_MARGIN * scale);
+ m_pBottomWidget->setGeometry(0, height() - buttonListWidget->height() - BOTTOM_MARGIN * scale,
+ this->width(), 64);
if (m_sessionListWidget) {
m_sessionListWidget->setMaxHeight(height() / 2);
m_sessionListWidget->updateWidgetSize();
- m_sessionListWidget->move(
- this->width() - m_sessionListWidget->width() - RIGHT_MARGIN * scale,
- height() - BOTTOM_MARGIN * scale - buttonListWidget->height() - buttonListWidget->spacing() * scale * 2
- - m_sessionListWidget->height());
+ setSessionListWidgetLocate();
}
if (m_networkWidget) {
- m_networkWidget->setGeometry(
- this->width() - m_networkWidget->width() - RIGHT_MARGIN * scale,
- this->height() - m_networkWidget->height() - BOTTOM_MARGIN * scale - buttonListWidget->spacing() * scale * 2
- - buttonListWidget->height(),
- m_networkWidget->width(),
- m_networkWidget->height());
- }
- if (batteryWidget) {
- batteryWidget->move(
- this->width() - batteryWidget->width() - RIGHT_MARGIN * scale,
- height() - BOTTOM_MARGIN * scale - buttonListWidget->height() - buttonListWidget->spacing() * scale
- - batteryWidget->height());
+ setNetWorkWidgetLocate();
}
+ setBatteryWidgetLocate();
if (m_userListWidget) {
- m_userListWidget->move(
- width() - m_userListWidget->width() - RIGHT_MARGIN,
- height() - BOTTOM_MARGIN * scale - buttonListWidget->height() - buttonListWidget->spacing() * scale
- - m_userListWidget->height());
+ setUserListWidgetLocate();
}
if (m_systemMonitorBtn) {
@@ -316,6 +300,13 @@ void LockWidget::keyReleaseEvent(QKeyEvent *e)
QWidget::keyReleaseEvent(e);
}
+void LockWidget::changeEvent(QEvent *event)
+{
+ if (event->type() == QEvent::LanguageChange) {
+ refreshTranslate();
+ }
+}
+
void LockWidget::initUI()
{
// 检查并获取第三方认证插件配置信息
@@ -333,6 +324,8 @@ void LockWidget::initUI()
authDialog->installEventFilter(this);
m_ptToPx = m_modelLockDialog->getPtToPx();
m_curFontSize = m_modelLockDialog->getCurFontSize();
+ QLocale local;
+ systemLang = local.name();
initTimeWidget();
initPowerWidget();
initButtonWidget();
@@ -376,16 +369,10 @@ void LockWidget::initUserWidget()
SwitchToUser(strUserName);
});
connect(m_userListWidget, &UserListWidget::widgetSizeChanged, m_modelLockDialog, [=]() {
- m_userListWidget->move(
- width() - m_userListWidget->width() - RIGHT_MARGIN,
- height() - BOTTOM_MARGIN * scale - buttonListWidget->height() - buttonListWidget->spacing() * scale
- - m_userListWidget->height());
+ setUserListWidgetLocate();
});
m_userListWidget->clearFocus();
- m_userListWidget->move(
- width() - m_userListWidget->width() - RIGHT_MARGIN,
- height() - BOTTOM_MARGIN * scale - buttonListWidget->height() - buttonListWidget->spacing() * scale
- - m_userListWidget->height());
+ setUserListWidgetLocate();
}
}
@@ -403,12 +390,7 @@ void LockWidget::initSessionWidget()
m_modelLockDialog,
&LockDialogModel::setCurrentSession);
m_sessionListWidget->clearFocus();
- if (buttonListWidget) {
- m_sessionListWidget->move(
- this->width() - m_sessionListWidget->width() - RIGHT_MARGIN * scale,
- height() - BOTTOM_MARGIN * scale - buttonListWidget->height() - buttonListWidget->spacing() * scale * 2
- - m_sessionListWidget->height());
- }
+ setSessionListWidgetLocate();
}
}
@@ -430,7 +412,10 @@ void LockWidget::initPowerWidget()
void LockWidget::initButtonWidget()
{
- buttonListWidget = new MyListWidget(this);
+ m_pBottomWidget = new QWidget(this);
+ QHBoxLayout *bottomWidgetLayout = new QHBoxLayout(m_pBottomWidget);
+ bottomWidgetLayout->setContentsMargins(RIGHT_MARGIN * scale - 16, 0, RIGHT_MARGIN * scale - 16, 0);
+ buttonListWidget = new MyListWidget(m_pBottomWidget);
buttonListWidget->installEventFilter(this);
buttonListWidget->setFlow(QListWidget::LeftToRight);
buttonListWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@@ -554,8 +539,8 @@ void LockWidget::initButtonWidget()
buttonListWidget->setFixedSize(
QSize(48 * buttonListWidget->count() + buttonListWidget->spacing() * 2 * buttonListWidget->count(), 64));
}
- buttonListWidget->move(
- width() - RIGHT_MARGIN - buttonListWidget->width(), height() - BOTTOM_MARGIN - buttonListWidget->spacing());
+ bottomWidgetLayout->addStretch();
+ bottomWidgetLayout->addWidget(buttonListWidget);
connect(buttonListWidget, &MyListWidget::currentItemChanged, this, &LockWidget::onButtonItemChanged);
connect(buttonListWidget, &MyListWidget::itemClicked, this, &LockWidget::onButtonItemClicked);
buttonListWidget->clearFocus();
@@ -714,12 +699,7 @@ void LockWidget::onUsersInfoChanged()
m_userListWidget->hide();
}
if (m_userListWidget) {
- m_userListWidget->move(
- width()
- - (m_userListWidget->width() / 2 + RIGHT_MARGIN * scale
- + (m_virKbButton->width() + buttonListWidget->spacing() * scale * 2) * 4),
- height() - BOTTOM_MARGIN * scale - buttonListWidget->height() - buttonListWidget->spacing() * scale
- - m_userListWidget->height());
+ setUserListWidgetLocate();
}
}
UserInfoPtr ptrUser = m_modelLockDialog->findUserByName(m_curUserInfo->name());
@@ -859,12 +839,7 @@ void LockWidget::onShowBatteryWidget()
if (!batteryWidget) {
batteryWidget = new BatteryWidget(m_modelLockDialog, this);
batteryWidget->setFixedSize(420, 112);
- if (batteryWidget) {
- batteryWidget->move(
- this->width() - batteryWidget->width() - RIGHT_MARGIN,
- this->height() - batteryWidget->height() - BOTTOM_MARGIN - buttonListWidget->spacing() * 2
- - buttonListWidget->height());
- }
+ setBatteryWidgetLocate();
}
if (batteryWidget && batteryWidget->isHidden()) {
@@ -923,12 +898,7 @@ void LockWidget::onShowNetworkWidget()
});
}
m_networkWidget->loadNetPlugin();
- m_networkWidget->setGeometry(
- this->width() - m_networkWidget->width() - RIGHT_MARGIN * scale,
- this->height() - m_networkWidget->height() - BOTTOM_MARGIN * scale - buttonListWidget->spacing() * scale
- - buttonListWidget->height(),
- m_networkWidget->width(),
- m_networkWidget->height());
+ setNetWorkWidgetLocate();
if (m_networkWidget && m_networkWidget->isVisible()) {
m_networkWidget->hide();
m_networkButton->setClickedStatus(NORMAL);
@@ -1010,13 +980,7 @@ void LockWidget::onShowVirtualKeyboard()
}
if (!m_virtualKeyboardWidget->isHidden()) {
- if (m_networkWidget && m_networkWidget->isVisible() && !m_virtualKeyboardWidget->getFloatStatus()) {
- m_networkWidget->move(
- this->width() - m_networkWidget->width() - 20,
- this->height() - m_networkWidget->height() - m_virtualKeyboardWidget->height());
- m_networkWidget->raise();
- } else {
- }
+ setNetWorkWidgetLocate();
m_virtualKeyboardWidget->raise();
}
m_virKbButton->setClickedStatus(NORMAL);
@@ -1054,13 +1018,7 @@ void LockWidget::onShowVirtualKeyboard(bool tabletMode)
}
if (!m_virtualKeyboardWidget->isHidden()) {
- if (m_networkWidget && m_networkWidget->isVisible() && !m_virtualKeyboardWidget->getFloatStatus()) {
- m_networkWidget->move(
- this->width() - m_networkWidget->width() - 20,
- this->height() - m_networkWidget->height() - m_virtualKeyboardWidget->height());
- m_networkWidget->raise();
- } else {
- }
+ setNetWorkWidgetLocate();
m_virtualKeyboardWidget->raise();
}
m_virKbButton->setClickedStatus(NORMAL);
@@ -1143,17 +1101,7 @@ void LockWidget::onSetVirkeyboardPos()
void LockWidget::onNetWorkResetLocation()
{
if (m_networkWidget && m_networkWidget->isVisible()) {
- if (m_virtualKeyboardWidget->getFloatStatus()) {
- m_networkWidget->move(
- this->width() - m_networkWidget->width() - RIGHT_MARGIN,
- this->height() - m_networkWidget->height() - BOTTOM_MARGIN - buttonListWidget->spacing()
- - buttonListWidget->height());
- } else {
- m_networkWidget->move(
- this->width() - m_networkWidget->width() - RIGHT_MARGIN,
- this->height() - m_networkWidget->height() - m_virtualKeyboardWidget->height());
- }
- m_networkWidget->raise();
+ setNetWorkWidgetLocate();
}
if (m_virtualKeyboardWidget && m_virtualKeyboardWidget->isVisible()) {
m_virtualKeyboardWidget->raise();
@@ -1165,12 +1113,7 @@ void LockWidget::onHideVirkeyboard()
if (m_virtualKeyboardWidget && m_virtualKeyboardWidget->isVisible()) {
m_virtualKeyboardWidget->hide();
}
- if (m_networkWidget && m_networkWidget->isVisible()) {
- m_networkWidget->move(
- this->width() - m_networkWidget->width() - RIGHT_MARGIN,
- this->height() - m_networkWidget->height() - BOTTOM_MARGIN - buttonListWidget->spacing()
- - buttonListWidget->height());
- }
+ setNetWorkWidgetLocate();
}
void LockWidget::onShowInhibitWarning(QStringList list, int type, bool iscommand)
@@ -1388,6 +1331,106 @@ void LockWidget::SwitchToUser(QString strUserName)
}
}
+void LockWidget::refreshTranslate()
+{
+ QLocale local;
+ systemLang = local.name();
+ if (systemLang == "ug_CN" || systemLang == "ky_KG" || systemLang == "kk_KZ") {
+ if (m_pBottomWidget)
+ m_pBottomWidget->setLayoutDirection(Qt::RightToLeft);
+ if (m_userListWidget)
+ m_userListWidget->setLayoutDirection(Qt::RightToLeft);
+ if (m_powerListWidget)
+ m_powerListWidget->setLayoutDirection(Qt::RightToLeft);
+ } else {
+ if (m_pBottomWidget)
+ m_pBottomWidget->setLayoutDirection(Qt::LeftToRight);
+ if (m_userListWidget)
+ m_userListWidget->setLayoutDirection(Qt::LeftToRight);
+ if (m_powerListWidget)
+ m_powerListWidget->setLayoutDirection(Qt::LeftToRight);
+ }
+ setUserListWidgetLocate();
+}
+
+void LockWidget::setUserListWidgetLocate()
+{
+ if (!m_userListWidget || !buttonListWidget)
+ return;
+ if (systemLang == "ug_CN" || systemLang == "ky_KG" || systemLang == "kk_KZ") {
+ m_userListWidget->move(RIGHT_MARGIN,
+ height() - BOTTOM_MARGIN * scale - buttonListWidget->height()
+ - buttonListWidget->spacing() * scale - m_userListWidget->height());
+ } else {
+ m_userListWidget->move(width() - m_userListWidget->width() - RIGHT_MARGIN,
+ height() - BOTTOM_MARGIN * scale - buttonListWidget->height()
+ - buttonListWidget->spacing() * scale - m_userListWidget->height());
+ }
+}
+
+void LockWidget::setNetWorkWidgetLocate()
+{
+ if (!m_networkWidget || !buttonListWidget)
+ return;
+ if (systemLang == "ug_CN" || systemLang == "ky_KG" || systemLang == "kk_KZ") {
+ if (m_networkWidget->isVisible() && m_virtualKeyboardWidget && !m_virtualKeyboardWidget->getFloatStatus() && m_virtualKeyboardWidget->isVisible()) {
+ m_networkWidget->move(RIGHT_MARGIN * scale,
+ this->height() - m_networkWidget->height() - m_virtualKeyboardWidget->height());
+ m_networkWidget->raise();
+ } else {
+ m_networkWidget->move(RIGHT_MARGIN * scale,
+ this->height() - m_networkWidget->height() - BOTTOM_MARGIN * scale
+ - buttonListWidget->spacing() * scale - buttonListWidget->height());
+ }
+ } else {
+ if (m_networkWidget->isVisible() && m_virtualKeyboardWidget && !m_virtualKeyboardWidget->getFloatStatus() && m_virtualKeyboardWidget->isVisible()) {
+ m_networkWidget->move(this->width() - m_networkWidget->width() - RIGHT_MARGIN * scale,
+ this->height() - m_networkWidget->height() - m_virtualKeyboardWidget->height());
+ m_networkWidget->raise();
+ } else {
+ m_networkWidget->move(this->width() - m_networkWidget->width() - RIGHT_MARGIN * scale,
+ this->height() - m_networkWidget->height() - BOTTOM_MARGIN * scale
+ - buttonListWidget->spacing() * scale - buttonListWidget->height());
+ }
+ }
+}
+
+void LockWidget::setSessionListWidgetLocate()
+{
+ if (!m_sessionListWidget)
+ return;
+ if (systemLang == "ug_CN" || systemLang == "ky_KG" || systemLang == "kk_KZ") {
+ if (buttonListWidget) {
+ m_sessionListWidget->move(RIGHT_MARGIN * scale,
+ height() - BOTTOM_MARGIN * scale - buttonListWidget->height()
+ - buttonListWidget->spacing() * scale * 2 - m_sessionListWidget->height());
+ }
+ } else {
+ if (buttonListWidget) {
+ m_sessionListWidget->move(this->width() - m_sessionListWidget->width() - RIGHT_MARGIN * scale,
+ height() - BOTTOM_MARGIN * scale - buttonListWidget->height()
+ - buttonListWidget->spacing() * scale * 2 - m_sessionListWidget->height());
+ }
+ }
+}
+
+void LockWidget::setBatteryWidgetLocate()
+{
+ if (systemLang == "ug_CN" || systemLang == "ky_KG" || systemLang == "kk_KZ") {
+ if (batteryWidget && buttonListWidget) {
+ batteryWidget->move(RIGHT_MARGIN * scale,
+ height() - BOTTOM_MARGIN * scale - buttonListWidget->height()
+ - buttonListWidget->spacing() * scale - batteryWidget->height());
+ }
+ } else {
+ if (batteryWidget && buttonListWidget) {
+ batteryWidget->move(this->width() - batteryWidget->width() - RIGHT_MARGIN * scale,
+ height() - BOTTOM_MARGIN * scale - buttonListWidget->height()
+ - buttonListWidget->spacing() * scale - batteryWidget->height());
+ }
+ }
+}
+
void LockWidget::onLanguageChanged(bool isCompleted)
{
if (isCompleted) {
diff --git a/src/widgets/lockwidget.h b/src/widgets/lockwidget.h
index 15592f5..4f4e57e 100644
--- a/src/widgets/lockwidget.h
+++ b/src/widgets/lockwidget.h
@@ -74,6 +74,7 @@ protected:
bool eventFilter(QObject *obj, QEvent *event);
void resizeEvent(QResizeEvent *event);
void keyReleaseEvent(QKeyEvent *e);
+ void changeEvent(QEvent *event);
signals:
@@ -105,6 +106,16 @@ private:
void SwitchToUser(QString strUserName);
+ void refreshTranslate();
+
+ void setUserListWidgetLocate();
+
+ void setNetWorkWidgetLocate();
+
+ void setSessionListWidgetLocate();
+
+ void setBatteryWidgetLocate();
+
private Q_SLOTS:
/**
* @brief item选中状态改变
@@ -192,6 +203,8 @@ private:
PowerListWidget *m_powerListWidget = nullptr;
// 底部button列表
MyListWidget *buttonListWidget = nullptr;
+ // 底部button布局
+ QWidget *m_pBottomWidget = nullptr;
QPixmap background;
@@ -252,6 +265,8 @@ private:
bool m_isSessionTools = false;
bool m_iscommand = false;
+
+ QString systemLang;
};
#endif // LOCKWIDGET_H
diff --git a/src/widgets/loginoptionswidget.cpp b/src/widgets/loginoptionswidget.cpp
index 180c153..70be650 100644
--- a/src/widgets/loginoptionswidget.cpp
+++ b/src/widgets/loginoptionswidget.cpp
@@ -102,6 +102,13 @@ void LoginOptionsWidget::changeEvent(QEvent *event)
void LoginOptionsWidget::refreshTranslate()
{
m_labelOptTitle->setTipText(tr("Login Options"));
+ QLocale local;
+ QString systemLang = local.name();
+ if (systemLang == "ug_CN" || systemLang == "ky_KG" || systemLang == "kk_KZ") {
+ setLayoutDirection(Qt::RightToLeft);
+ } else {
+ setLayoutDirection(Qt::LeftToRight);
+ }
}
void LoginOptionsWidget::initConnections()
diff --git a/src/widgets/mylistwidget.cpp b/src/widgets/mylistwidget.cpp
index 6eec47e..5bb3907 100644
--- a/src/widgets/mylistwidget.cpp
+++ b/src/widgets/mylistwidget.cpp
@@ -21,6 +21,13 @@
MyListWidget::MyListWidget(QWidget *parent) : QListWidget(parent)
{
+ QLocale local;
+ QString systemLang = local.name();
+ if (systemLang == "ug_CN" || systemLang == "ky_KG" || systemLang == "kk_KZ") {
+ setLayoutDirection(Qt::RightToLeft);
+ } else {
+ setLayoutDirection(Qt::LeftToRight);
+ }
installEventFilter(this);
setFocusPolicy(Qt::TabFocus);
}
@@ -140,3 +147,21 @@ bool MyListWidget::eventFilter(QObject *obj, QEvent *event)
return QListWidget::eventFilter(obj, event);
}
+
+void MyListWidget::changeEvent(QEvent *event)
+{
+ if (event->type() == QEvent::LanguageChange) {
+ refreshTranslate();
+ }
+}
+
+void MyListWidget::refreshTranslate()
+{
+ QLocale local;
+ QString systemLang = local.name();
+ if (systemLang == "ug_CN" || systemLang == "ky_KG" || systemLang == "kk_KZ") {
+ setLayoutDirection(Qt::RightToLeft);
+ } else {
+ setLayoutDirection(Qt::LeftToRight);
+ }
+}
diff --git a/src/widgets/mylistwidget.h b/src/widgets/mylistwidget.h
index 8090574..f7969e0 100644
--- a/src/widgets/mylistwidget.h
+++ b/src/widgets/mylistwidget.h
@@ -37,6 +37,10 @@ public:
protected:
bool eventFilter(QObject *obj, QEvent *event);
+ void changeEvent(QEvent *event);
+
+private:
+ void refreshTranslate();
private:
// 标志位记录前一个选中的item
diff --git a/src/widgets/powerlistwidget.cpp b/src/widgets/powerlistwidget.cpp
index 341f667..db1b990 100644
--- a/src/widgets/powerlistwidget.cpp
+++ b/src/widgets/powerlistwidget.cpp
@@ -257,6 +257,7 @@ void PowerListWidget::changeEvent(QEvent *event)
if (event->type() == QEvent::LanguageChange) {
refreshTranslate();
}
+ return QListWidget::changeEvent(event);
}
void PowerListWidget::refreshTranslate()

View File

@ -31,3 +31,4 @@
0031-83-fixbug.patch
0032-84-fixbug.patch
0033-85-fixbug.patch
0034-86.patch