diff --git a/plugins/vpn/translations/zh_CN.qm b/plugins/vpn/translations/zh_CN.qm new file mode 100644 index 00000000..56074df7 Binary files /dev/null and b/plugins/vpn/translations/zh_CN.qm differ diff --git a/src-vpn/frontend/single-pages/singlepage.h b/src-vpn/frontend/single-pages/singlepage.h index c822c4f4..2855b96b 100644 --- a/src-vpn/frontend/single-pages/singlepage.h +++ b/src-vpn/frontend/single-pages/singlepage.h @@ -43,7 +43,7 @@ using namespace kdk; #define MAIN_LAYOUT_SPACING 0 #define TITLE_FRAME_HEIGHT 60 //TabWidget的tab和widget有间隙,和设计稿看起来一致就不能设为设计稿里的高度 #define TITLE_LAYOUT_MARGINS 24,0,24,0 -#define NET_LAYOUT_MARGINS 8,8,8,8 +#define NET_LAYOUT_MARGINS 8,8,0,8 #define TEXT_HEIGHT 20 #define SETTINGS_LAYOUT_MARGINS 23,0,24,0 diff --git a/src-vpn/frontend/single-pages/vpnpage.cpp b/src-vpn/frontend/single-pages/vpnpage.cpp index 41c8cb70..e2cb274b 100644 --- a/src-vpn/frontend/single-pages/vpnpage.cpp +++ b/src-vpn/frontend/single-pages/vpnpage.cpp @@ -147,11 +147,7 @@ void VpnPage::constructItemArea() } } - if (m_listWidget->count() <= MAX_ITEMS) { - m_listFrame->setFixedWidth(MIN_WIDTH); - } else { - m_listFrame->setFixedWidth(MAX_WIDTH); - } + resetListWidgetWidth(); } void VpnPage::initVpnArea() @@ -174,14 +170,6 @@ void VpnPage::resetPageHeight() m_listFrame->show(); m_netDivider->show(); } - - for (int i = 0; i < m_mainLayout->count(); i ++) { - QWidget *w = m_mainLayout->itemAt(i)->widget(); - if (w != nullptr && w->isHidden() != true) { - height += w->height(); - } - } - this->setFixedHeight(height + PAGE_SPACE); } bool VpnPage::removeConnectionItem(QMap &connectMap, @@ -203,9 +191,7 @@ bool VpnPage::removeConnectionItem(QMap &connectMap, p_listWidgetItem = nullptr; iter = connectMap.erase(iter); - if (m_listWidget->count() <= MAX_ITEMS) { - m_listFrame->setFixedWidth(MIN_WIDTH); - } + resetListWidgetWidth(); return true; } } @@ -249,9 +235,7 @@ void VpnPage::onAddConnection(QString uuid) //新增一个有线 delete p_newItem; p_newItem = nullptr; - if (m_listWidget->count() >= MAX_ITEMS) { - m_listFrame->setFixedWidth(MAX_WIDTH); - } + resetListWidgetWidth(); resetPageHeight(); resetWindowPosition(); this->update(); @@ -338,9 +322,8 @@ void VpnPage::updateActivatedConnectionArea(KyConnectItem *p_newItem) deleteConnectionMapItem(m_activeItemMap, m_listWidget, p_newItem->m_connectUuid); QListWidgetItem *p_listWidgetItem = addNewItem(p_newItem, m_listWidget); m_activeItemMap.insert(p_newItem->m_connectUuid, p_listWidgetItem); - if (m_listWidget->count() <= MAX_ITEMS) { - m_listFrame->setFixedWidth(MIN_WIDTH); - } + + resetListWidgetWidth(); return; } @@ -356,11 +339,7 @@ void VpnPage::updateConnectionArea(KyConnectItem *p_newItem) QListWidgetItem *p_listWidgetItem = insertNewItem(p_newItem, m_listWidget); m_vpnItemMap.insert(p_newItem->m_connectUuid, p_listWidgetItem); - if (m_listWidget->count() <= MAX_ITEMS) { - m_listFrame->setFixedWidth(MIN_WIDTH); - } else { - m_listFrame->setFixedWidth(MAX_WIDTH); - } + resetListWidgetWidth(); } void VpnPage::updateConnectionState(QMap &connectMap, @@ -700,3 +679,12 @@ void VpnPage::resetWindowPosition() kdk::WindowManager::setGeometry(this->windowHandle(), rect); qDebug() << " Position of ukui-panel is " << position << "; Position of mainwindow is " << this->geometry() << "." << Q_FUNC_INFO << __LINE__; } + +void VpnPage::resetListWidgetWidth() +{ + if (m_listWidget->count() <= MAX_ITEMS) { + m_listFrame->setFixedWidth(MIN_WIDTH); + } else { + m_listFrame->setFixedWidth(MAX_WIDTH); + } +} diff --git a/src-vpn/frontend/single-pages/vpnpage.h b/src-vpn/frontend/single-pages/vpnpage.h index 0b7dec31..e5748723 100644 --- a/src-vpn/frontend/single-pages/vpnpage.h +++ b/src-vpn/frontend/single-pages/vpnpage.h @@ -97,7 +97,7 @@ private: QListWidget *vpnListWidget, QString uuid); void resetWindowPosition(); - + void resetListWidgetWidth(); Q_SIGNALS: void vpnAdd(QStringList info); diff --git a/src-vpn/translations/kylin-vpn_bo_CN.qm b/src-vpn/translations/kylin-vpn_bo_CN.qm new file mode 100644 index 00000000..be651eed --- /dev/null +++ b/src-vpn/translations/kylin-vpn_bo_CN.qm @@ -0,0 +1 @@ +VPN Server + + + VPN + + + + + Auto Connection + + + + + Confirm + + + + + Cancel + + vpnConfigPage @@ -90,7 +110,7 @@ - vpnDetail + VpnDetail @@ -113,29 +133,6 @@ - - vpnDetailPage - - - VPN - - - - - Auto Connection - - - - - Confirm - - - - - Cancel - - - vpnObject diff --git a/src-vpn/translations/kylin-vpn_zh_CN.qm b/src-vpn/translations/kylin-vpn_zh_CN.qm new file mode 100644 index 00000000..75c3ce3e Binary files /dev/null and b/src-vpn/translations/kylin-vpn_zh_CN.qm differ diff --git a/src-vpn/translations/kylin-vpn_zh_CN.ts b/src-vpn/translations/kylin-vpn_zh_CN.ts index d0afe821..29c04c79 100644 --- a/src-vpn/translations/kylin-vpn_zh_CN.ts +++ b/src-vpn/translations/kylin-vpn_zh_CN.ts @@ -756,6 +756,26 @@ If key direction is used, it must be opposite to the VPN side used. If '1&a VPN Server 服务器地址 + + + VPN + + + + + Auto Connection + 自动连接 + + + + Confirm + 确定 + + + + Cancel + 取消 + vpnConfigPage @@ -765,7 +785,7 @@ If key direction is used, it must be opposite to the VPN side used. If '1&a - vpnDetail + VpnDetail @@ -804,29 +824,6 @@ If key direction is used, it must be opposite to the VPN side used. If '1&a 确定 - - vpnDetailPage - - - VPN - - - - - Auto Connection - 自动连接 - - - - Confirm - 确定 - - - - Cancel - 取消 - - vpnObject