Merge pull request !80 from xie_klve/openkylin/nile
This commit is contained in:
邓托 2024-09-10 11:11:09 +00:00 committed by Gitee
commit 08a3238420
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 34 additions and 35 deletions

9
debian/changelog vendored
View File

@ -1,3 +1,12 @@
kylin-nm (4.10.0.0-ok0.11) nile; urgency=medium
* BUG#IAPTDF 【gg-维哈柯】【VPN】点击托盘VPN按钮窗口布局不正确
* 需求:无
* 其他改动说明:更新翻译
* 其他改动影响域:无
-- jiahua xie <xiejiahua@kylinos.cn> Fri, 30 Aug 2024 09:33:01 +0800
kylin-nm (4.10.0.0-ok0.10) nile; urgency=medium
* BUG#I9IYPM 任务栏网络模块,切换哈维柯语言时从右往左布局出现混乱

View File

@ -30,6 +30,10 @@ VpnListItem::VpnListItem(const KyConnectItem *vpnConnectItem, QWidget *parent):L
m_deviceResource = new KyNetworkDeviceResourse(this);
connectItemCopy(vpnConnectItem);
char *envStr = getenv("LANGUAGE");
if (strcmp(envStr, "ug_CN") == 0 || strcmp(envStr, "kk_KZ") == 0 || strcmp(envStr, "ky_KG") == 0) {
this->setFixedWidth(390);
}
m_nameLabel->setText(m_vpnConnectItem.m_connectName);
m_netButton->setButtonIcon(QIcon::fromTheme("ukui-vpn-symbolic"));

View File

@ -684,11 +684,20 @@ void VpnPage::resetWindowPosition()
QRect availableGeo = QGuiApplication::screenAt(QCursor::pos())->geometry();
int x, y;
char *envStr = getenv("LANGUAGE");
switch(m_panelPosition){
case PANEL_TOP:
//任务栏位于上方
x = availableGeo.x() + availableGeo.width() - this->width() - MARGIN;
y = availableGeo.y() + m_panelSize + MARGIN;
/* 维吾尔语 ug_CN
* kk_KZ
* ky_KG */
if (strcmp(envStr, "ug_CN") == 0 || strcmp(envStr, "kk_KZ") == 0 || strcmp(envStr, "ky_KG") == 0) {
x = MARGIN;
y = availableGeo.y() + m_panelSize + MARGIN;
} else {
x = availableGeo.x() + availableGeo.width() - this->width() - MARGIN;
y = availableGeo.y() + m_panelSize + MARGIN;
}
break;
//任务栏位于左边
case PANEL_LEFT:
@ -702,8 +711,13 @@ void VpnPage::resetWindowPosition()
break;
//任务栏位于下方
default:
x = availableGeo.x() + availableGeo.width() - this->width() - MARGIN;
y = availableGeo.y() + availableGeo.height() - m_panelSize - this->height() - MARGIN;
if (strcmp(envStr, "ug_CN") == 0 || strcmp(envStr, "kk_KZ") == 0 || strcmp(envStr, "ky_KG") == 0) {
x = MARGIN;
y = availableGeo.y() + availableGeo.height() - m_panelSize - this->height() - MARGIN;
} else {
x = availableGeo.x() + availableGeo.width() - this->width() - MARGIN;
y = availableGeo.y() + availableGeo.height() - m_panelSize - this->height() - MARGIN;
}
break;
}
kdk::WindowManager::setGeometry(this->windowHandle(), QRect(x, y, this->width(), this->height()));

View File

@ -62,6 +62,9 @@ InfoButton::InfoButton(QWidget *parent) : QPushButton(parent)
void InfoButton::initUI()
{
this->setFixedSize(BUTTON_SIZE);
this->setIcon(QIcon::fromTheme("preferences-system-details-symbolic"));
this->setProperty("useButtonPalette", true);
this->setFlat(true);
m_backgroundColor = BACKGROUND_COLOR;
m_foregroundColor = FOREGROUND_COLOR_NORMAL;
}
@ -89,36 +92,6 @@ void InfoButton::onPaletteChanged()
this->repaint();
}
void InfoButton::paintEvent(QPaintEvent *event)
{
QPalette pal = this->palette();
pal.setColor(QPalette::Base, m_backgroundColor);
pal.setColor(QPalette::Text, m_foregroundColor);
QPainterPath cPath;
cPath.addRect(0, 0, ICON_SIZE);
cPath.addEllipse(0, 0, ICON_SIZE);
QPainterPath outerPath;
outerPath.addEllipse(OUTER_PATH);
QPainterPath innerPath;
innerPath.addEllipse(INNER_PATH);
outerPath -= innerPath;
QPainter painter(this);
painter.setRenderHint(QPainter:: Antialiasing, true); //设置渲染,启动反锯齿
painter.setPen(Qt::NoPen);
painter.setBrush(pal.color(QPalette::Base));
painter.drawPath(cPath);
painter.fillPath(outerPath, pal.color(QPalette::Text));
painter.setPen(m_foregroundColor);
QFont font("Noto Sans CJK SC", 11, QFont::Normal, false);
painter.setFont(font);
painter.drawText(TEXT_POS, "i");
}
void InfoButton::enterEvent(QEvent *event)
{

View File

@ -30,7 +30,6 @@ public:
~InfoButton() = default;
protected:
void paintEvent(QPaintEvent *event);
void enterEvent(QEvent *event);
void leaveEvent(QEvent *event);
void mousePressEvent(QMouseEvent *event);