Skip to content

Commit 23ec9bf

Browse files
committed
feat: Synchronize to 107x
Synchronize to 107x pms: TASK-361719
1 parent a0b0995 commit 23ec9bf

File tree

132 files changed

+2337
-1976
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+2337
-1976
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ add_subdirectory("src")
5656
add_subdirectory("dcc-network")
5757
add_subdirectory("tests")
5858
# add_subdirectory("example")
59-
#add_subdirectory("dock-network-plugin")
59+
add_subdirectory("dock-network-plugin")
6060
add_subdirectory("dss-network-plugin")
61-
add_subdirectory("dss_example")
61+
# add_subdirectory("dss_example")
6262
#add_subdirectory("dock-example")
6363
add_subdirectory("network-service-plugin")

debian/dss-network-plugin.install

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
usr/lib/dde-session-shell/modules/libdss-network-plugin.so
22
usr/share/dss-network-plugin/translations
3-
usr/share/polkit-1/rules.d/50-dss-network-plugin.rules
3+
var/lib/polkit-1/localauthority/10-vendor.d/10-network-manager.pkla

dock-network-plugin/CMakeLists.txt

Lines changed: 49 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,77 @@
1-
cmake_minimum_required(VERSION 3.7)
1+
# SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd.
2+
#
3+
# SPDX-License-Identifier: CC0-1.0
24

35
set(PLUGIN_NAME "dock-network-plugin")
46

7+
set(QT_NS Qt6)
8+
set(DTK_NS Dtk6)
9+
510
project(${PLUGIN_NAME})
11+
include(GNUInstallDirs)
612
# 启用 qt moc 的支持
713
set(CMAKE_AUTOMOC ON)
814
# 启用 qrc 资源文件的支持
915
set(CMAKE_AUTORCC ON)
1016

11-
file(GLOB_RECURSE SRCS "*.h" "*.cpp" "item/*.h" "item/*.cpp" "../common-plugin/*.h" "../common-plugin/*.cpp")
17+
file(GLOB_RECURSE SRCS
18+
"networkplugin.h"
19+
"networkplugin.cpp"
20+
"quickpanelwidget.h"
21+
"quickpanelwidget.cpp"
22+
"dockcontentwidget.h"
23+
"../net-view/*.h"
24+
"../net-view/*.cpp"
25+
"widget/jumpsettingbutton.h"
26+
"widget/jumpsettingbutton.cpp"
27+
"widget/commoniconbutton.h"
28+
"widget/commoniconbutton.cpp"
29+
)
1230

13-
find_package(Qt5 COMPONENTS Core Widgets DBus Network LinguistTools REQUIRED)
31+
find_package(${QT_NS} ${REQUIRED_QT_VERSION} COMPONENTS Core Widgets DBus Network Svg LinguistTools REQUIRED)
1432
find_package(PkgConfig REQUIRED)
15-
find_package(Qt5Svg REQUIRED)
16-
find_package(DtkCore REQUIRED)
17-
find_package(DtkWidget REQUIRED)
18-
19-
set(DTKCORE_INCLUDE_DIR DTKCORE_INCLUDE_DIRS)
20-
33+
find_package(${DTK_NS} REQUIRED COMPONENTS Widget)
34+
find_package(KF6NetworkManagerQt REQUIRED)
2135
find_package(DdeDock REQUIRED)
22-
find_package(KF5NetworkManagerQt REQUIRED)
2336

24-
pkg_check_modules(QGSettings REQUIRED gsettings-qt)
25-
pkg_check_modules(DDE-Dock REQUIRED dde-dock)
37+
#if (CMAKE_BUILD_TYPE STREQUAL "Debug")
38+
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -fsanitize=address -O0")
39+
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fsanitize=address -O0")
40+
#endif()
2641

2742
file(GLOB TS_FILES "translations/*.ts")
28-
qt5_add_translation(QM_FILES ${TS_FILES})
43+
qt_add_translation(QM_FILES ${TS_FILES})
2944
add_custom_target(language ALL DEPENDS ${QM_FILES})
3045

3146
add_definitions("${QT_DEFINITIONS} -DQT_PLUGIN")
32-
add_library(${PLUGIN_NAME} SHARED ${SRCS} ../common-plugin/network.qrc)
33-
34-
get_target_property(KF5_QT_INCLUDE_DIRS KF5::NetworkManagerQt INTERFACE_INCLUDE_DIRECTORIES)
35-
36-
set(TRY_KF5_LIBRARIES
37-
IMPORTED_LOCATION_DEBIAN
38-
IMPORTED_LOCATION_NOCONFIG
39-
)
47+
add_library(${PLUGIN_NAME} SHARED ${SRCS} ../net-view/window/qrc/network.qrc)
48+
set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../../dde-dock)
4049

41-
if (NOT KF5_QT_LIBRARIES)
42-
find_library(KF5_QT_LIBRARIES libKF5NetworkManagerQt.so)
43-
endif()
50+
# get_target_property(KF6_QT_INCLUDE_DIRS KF6::NetworkManagerQt INTERFACE_INCLUDE_DIRECTORIES)
4451

4552
target_include_directories(${PLUGIN_NAME} PUBLIC
46-
${DtkWidget_INCLUDE_DIRS}
47-
${Qt5DBus_INCLUDE_DIRS}
48-
${QGSettings_INCLUDE_DIRS}
49-
${DDE-Network-Core_INCLUDE_DIRS}
50-
${DDE_DOCK_INCLUDE_DIR}
51-
${Qt5Network_INCLUDE_DIRS}
52-
${KF5_QT_INCLUDE_DIRS}
53-
${NETINTERFACEINCLUDE}
54-
"../common-plugin/"
53+
${DTK_NS}::Widget
54+
${QT_NS}::Dbus
55+
${QT_NS}::Network
56+
KF6::NetworkManagerQt
57+
# "../../../interfaces"
58+
"../net-view/operation"
59+
"../net-view/window"
60+
"../src"
5561
)
5662

5763
target_link_libraries(${PLUGIN_NAME} PRIVATE
58-
${DtkWidget_LIBRARIES}
59-
${Qt5Widgets_LIBRARIES}
60-
${Qt5Svg_LIBRARIES}
61-
${Qt5DBus_LIBRARIES}
62-
${QGSettings_LIBRARIES}
63-
${DDE-Network-Core_LIBRARIES}
64-
${KF5_QT_LIBRARIES}
65-
${Qt5Network_LIBRARIES}
64+
${QT_NS}::Widgets
65+
${QT_NS}::Svg
66+
${QT_NS}::DBus
67+
${QT_NS}::Network
68+
${DTK_NS}::Widget
69+
KF6::NetworkManagerQt
70+
dde-network-core6
6671
)
6772

68-
install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION lib/dde-dock/plugins/quick-trays)
73+
install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION lib/dde-dock/plugins/system-trays)
6974
# 安装 .qm 文件
7075
install(FILES ${QM_FILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/${PLUGIN_NAME}/translations)
76+
# 安装显示在控制中心-个性化-任务栏-插件区域的图标
77+
install(FILES "resources/dcc-network.dci" DESTINATION share/dde-dock/icons/dcc-setting)
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
2+
//
3+
// SPDX-License-Identifier: LGPL-3.0-or-later
4+
5+
#ifndef DOCKCONTENTWIDGET_H
6+
#define DOCKCONTENTWIDGET_H
7+
8+
#include "netmanager.h"
9+
#include "netview.h"
10+
#include "widget/jumpsettingbutton.h"
11+
#include "constants.h"
12+
13+
#include <QDebug>
14+
#include <QEvent>
15+
#include <QStyleOption>
16+
#include <QStylePainter>
17+
#include <QToolButton>
18+
#include <QTreeView>
19+
#include <QVBoxLayout>
20+
#include <QWidget>
21+
22+
namespace dde {
23+
namespace network {
24+
25+
class DockContentWidget : public QWidget
26+
{
27+
Q_OBJECT
28+
public:
29+
explicit DockContentWidget(NetView *netView, NetManager *netManager, QWidget *parent = nullptr)
30+
: QWidget(parent)
31+
, m_mainLayout(new QVBoxLayout(this))
32+
, m_netView(netView)
33+
, m_minHeight(-1)
34+
{
35+
m_netView->installEventFilter(this);
36+
m_netView->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
37+
connect(m_netView, &NetView::updateSize, this, &DockContentWidget::updateSize);
38+
39+
m_netSetBtn = new JumpSettingButton(this);
40+
m_netSetBtn->setIcon(QIcon::fromTheme("network-setting"));
41+
m_netSetBtn->setDescription(tr("Network settings"));
42+
connect(m_netSetBtn, &JumpSettingButton::clicked, netManager, &NetManager::gotoControlCenter);
43+
44+
m_netCheckBtn = new JumpSettingButton(this);
45+
m_netCheckBtn->setIcon(QIcon::fromTheme("network-check"));
46+
m_netCheckBtn->setDescription(tr("Network Detection"));
47+
connect(m_netCheckBtn, &JumpSettingButton::clicked, netManager, &NetManager::gotoCheckNet);
48+
49+
QWidget *buttonWidget = new QWidget(this);
50+
QVBoxLayout *buttonLayout = new QVBoxLayout;
51+
buttonLayout->setContentsMargins(10, 10, 10, 10);
52+
buttonLayout->setSpacing(10);
53+
buttonLayout->addWidget(m_netCheckBtn);
54+
buttonLayout->addWidget(m_netSetBtn);
55+
buttonWidget->setLayout(buttonLayout);
56+
57+
m_mainLayout->setContentsMargins(0, 10, 0, 0);
58+
m_mainLayout->addWidget(m_netView, 0, Qt::AlignTop | Qt::AlignHCenter);
59+
m_mainLayout->addStretch();
60+
m_mainLayout->addSpacing(10);
61+
m_mainLayout->addWidget(buttonWidget, 0, Qt::AlignBottom);
62+
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
63+
setMaximumHeight(Dock::DOCK_POPUP_WIDGET_MAX_HEIGHT);
64+
}
65+
66+
~DockContentWidget() override { }
67+
68+
void setMainLayoutMargins(const QMargins &margin) {
69+
m_mainLayout->setContentsMargins(margin);
70+
}
71+
void setMinHeight(int minHeight) { m_minHeight = minHeight; }
72+
void updateSize() {
73+
auto h = Dock::DOCK_POPUP_WIDGET_MAX_HEIGHT - 20 - m_mainLayout->contentsMargins().top() - (m_netCheckBtn->isVisible() ? (m_netSetBtn->height() + m_netCheckBtn->height() + 10) : m_netSetBtn->height());
74+
m_netView->setMaxHeight(h);
75+
if (m_netView->height() > h)
76+
m_netView->setFixedHeight(h);
77+
setFixedSize(m_netView->width(), qMax(m_minHeight, m_netView->height() + 20 + m_mainLayout->contentsMargins().top() + (m_netCheckBtn->isVisible() ? (m_netSetBtn->height() + m_netCheckBtn->height() + 10) : m_netSetBtn->height())));
78+
}
79+
void setNetCheckBtnVisible(bool visible) {
80+
m_netCheckBtn->setVisible(visible);
81+
updateSize();
82+
}
83+
84+
protected:
85+
bool eventFilter(QObject *watch, QEvent *event) override
86+
{
87+
if ((watch == m_netView && event->type() == QEvent::Resize) || event->type() == QEvent::Show) {
88+
updateSize();
89+
}
90+
return QWidget::eventFilter(watch, event);
91+
}
92+
93+
private:
94+
QVBoxLayout *m_mainLayout;
95+
NetView *m_netView;
96+
int m_minHeight;
97+
JumpSettingButton *m_netSetBtn;
98+
JumpSettingButton *m_netCheckBtn;
99+
};
100+
101+
} // namespace network
102+
} // namespace dde
103+
#endif // DOCKCONTENTWIDGET_H

dock-network-plugin/lupdate.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ if [ ! -d "translations/" ];then
33
mkdir translations
44
fi
55
cd ./translations
6-
rm -f dock-hotspot-plugin_en_US.ts
7-
lupdate ../ ../../src ../../common-plugin -ts -no-ui-lines -locations none -no-obsolete dock-network-plugin_en_US.ts
6+
rm -f dock-network-plugin.ts
7+
lupdate ../ ../../net-view/ -ts -no-ui-lines -locations none -no-obsolete dock-network-plugin.ts
88
cd ../
9-
10-
tx push -s --branch m23

dock-network-plugin/network.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"api": "2.0.0",
3-
"primary" : true,
2+
"api": "1.1.1",
43
"depends-daemon-dbus-service": "org.deepin.dde.Network1"
54
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"api": "2.0.0",
3+
"depends-daemon-dbus-service": "org.deepin.dde.Network1"
4+
}

0 commit comments

Comments
 (0)