From 94c345dda8b5e04a5014ad0410d4be1eae18864a Mon Sep 17 00:00:00 2001 From: zhangyuanyuan1 Date: Mon, 10 Apr 2023 17:52:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=A6=E6=83=85=E9=A1=B5IP?= =?UTF-8?q?v4=20DNS=E5=88=97=E8=A1=A8=20tab=E9=80=82=E9=85=8D=E9=AB=98?= =?UTF-8?q?=E5=88=86=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/netdetails/detailpage.cpp | 2 +- src/frontend/netdetails/netdetail.cpp | 32 ++++++++++++++++++++++++-- src/frontend/netdetails/netdetail.h | 4 ++++ 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/src/frontend/netdetails/detailpage.cpp b/src/frontend/netdetails/detailpage.cpp index 21517fb0..a80cc0e8 100644 --- a/src/frontend/netdetails/detailpage.cpp +++ b/src/frontend/netdetails/detailpage.cpp @@ -87,7 +87,7 @@ void DetailPage::setIpv4(const QString &ipv4) { } void DetailPage::setIpv4Dns(const QString &ipv4Dns) { - this->m_IPV4Dns->setText(ipv4Dns); + this->m_IPV4Dns->setLabelText(ipv4Dns); } void DetailPage::setIpv6(const QString &ipv6) { diff --git a/src/frontend/netdetails/netdetail.cpp b/src/frontend/netdetails/netdetail.cpp index 32cc3f89..c3df56fc 100644 --- a/src/frontend/netdetails/netdetail.cpp +++ b/src/frontend/netdetails/netdetail.cpp @@ -660,7 +660,7 @@ void NetDetail::getStaticIpInfo(ConInfo &conInfo, bool bActived) // conInfo.ipv4ConfigType = connetSetting.m_ipv4ConfigIpType; conInfo.ipv6ConfigType = connetSetting.m_ipv6ConfigIpType; - conInfo.ipv4DnsList = connetSetting.m_ipv4Dns; +// conInfo.ipv4DnsList = connetSetting.m_ipv4Dns; conInfo.ipv6DnsList = connetSetting.m_ipv6Dns; conInfo.isAutoConnect = connetSetting.m_isAutoConnect; @@ -1196,7 +1196,26 @@ void NetDetail::setNetTabToolTip() NetTabBar::NetTabBar(QWidget *parent) :KTabBar(KTabBarStyle::SegmentDark, parent) { - + //模式切换 + QDBusConnection::sessionBus().connect(QString("com.kylin.statusmanager.interface"), + QString("/"), + QString("com.kylin.statusmanager.interface"), + QString("mode_change_signal"), this, SLOT(onModeChanged(bool))); + //模式获取 + QDBusInterface interface(QString("com.kylin.statusmanager.interface"), + QString("/"), + QString("com.kylin.statusmanager.interface"), + QDBusConnection::sessionBus()); + if(!interface.isValid()) { + this->setFixedHeight(TAB_HEIGHT); + return; + } + QDBusReply reply = interface.call("get_current_tabletmode"); + if (!reply.isValid()) { + this->setFixedHeight(TAB_HEIGHT); + return; + } + onModeChanged(reply.value()); } NetTabBar::~NetTabBar() @@ -1219,6 +1238,15 @@ QSize NetTabBar::minimumTabSizeHint(int index) const return size; } +void NetTabBar::onModeChanged(bool mode) +{ + if (mode) { + this->setFixedHeight(TAB_HEIGHT_TABLET); // 平板模式 + } else { + this->setFixedHeight(TAB_HEIGHT); // PC模式 + } +} + ThreadObject::ThreadObject(QString deviceName, QObject *parent) :m_devName(deviceName), QObject(parent) diff --git a/src/frontend/netdetails/netdetail.h b/src/frontend/netdetails/netdetail.h index 1bdaadd4..567afcab 100644 --- a/src/frontend/netdetails/netdetail.h +++ b/src/frontend/netdetails/netdetail.h @@ -68,6 +68,10 @@ public: protected: QSize sizeHint() const; QSize minimumTabSizeHint(int index) const; + +private Q_SLOTS: + void onModeChanged(bool mode); + }; class ThreadObject : public QObject {