Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ message(STATUS DEEPIN_NMQT_TEST ": ${DEEPIN_NMQT_TEST}")
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/usr")
endif()
include(GNUInstallDirs)

add_subdirectory("src")
add_subdirectory("dcc-network-plugin")
Expand Down
3 changes: 0 additions & 3 deletions dcc-network-plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ target_link_libraries(${PLUGIN_NAME} PRIVATE
# ${DDE-Network-Core_LIBRARIES}
)

# 设置安装路径的前缀(默认为"/usr/local")
set(CMAKE_INSTALL_PREFIX "/usr")

# 设置执行 make install 时哪个目标应该被 install 到哪个位置
install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/dde-control-center/modules)

Expand Down
3 changes: 1 addition & 2 deletions dock-network-plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.7)
set(PLUGIN_NAME "dock-network-plugin")

project(${PLUGIN_NAME})
include(GNUInstallDirs)
# 启用 qt moc 的支持
set(CMAKE_AUTOMOC ON)
# 启用 qrc 资源文件的支持
Expand Down Expand Up @@ -67,6 +66,6 @@ target_link_libraries(${PLUGIN_NAME} PRIVATE
${Qt5Network_LIBRARIES}
)

install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION /usr/lib/dde-dock/plugins/quick-trays)
install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION lib/dde-dock/plugins/quick-trays)
# 安装 .qm 文件
install(FILES ${QM_FILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/${PLUGIN_NAME}/translations)
5 changes: 4 additions & 1 deletion dock-network-plugin/networkplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ NetworkPlugin::NetworkPlugin(QObject *parent)
{
NetworkController::setIPConflictCheck(true);
QTranslator *translator = new QTranslator(this);
translator->load(QString("/usr/share/dock-network-plugin/translations/dock-network-plugin_%1.qm").arg(QLocale::system().name()));
QString languagePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
QString("dock-network-plugin/translations"),
QStandardPaths::LocateDirectory);
translator->load(QString(languagePath+"/dock-network-plugin_%1.qm").arg(QLocale::system().name()));
QCoreApplication::installTranslator(translator);
}

Expand Down
3 changes: 1 addition & 2 deletions dss-network-plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ set(PLUGIN_NAME "dss-network-plugin")

project(${PLUGIN_NAME})

include(GNUInstallDirs)
# 启用 qt moc 的支持
set(CMAKE_AUTOMOC ON)
# 启用 qrc 资源文件的支持
Expand Down Expand Up @@ -63,7 +62,7 @@ target_link_libraries(${PLUGIN_NAME} PRIVATE
${Qt5Network_LIBRARIES}
)

install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION /lib/dde-session-shell/modules)
install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION lib/dde-session-shell/modules)
# 安装 .qm 文件
install(FILES ${QM_FILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/${PLUGIN_NAME}/translations)

Expand Down
5 changes: 4 additions & 1 deletion dss-network-plugin/network_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ void NetworkModule::installTranslator(QString locale)
}
localTmp = locale;
QApplication::removeTranslator(&translator);
translator.load(QString("/usr/share/dss-network-plugin/translations/dss-network-plugin_%1.qm").arg(locale));
QString languagePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
QString("dss-network-plugin/translations"),
QStandardPaths::LocateDirectory);
translator.load(QString(languagePath+"/dss-network-plugin_%1.qm").arg(locale));
QApplication::installTranslator(&translator);
dde::network::NetworkController::instance()->retranslate();
m_networkHelper->updateTooltips();
Expand Down
1 change: 0 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

include(GNUInstallDirs)
set(CMAKE_PREFIX_PATH $ENV{Qt5_DIR})

file(GLOB_RECURSE SOURCEFILES "*.h" "*.cpp")
Expand Down
5 changes: 2 additions & 3 deletions src/proxycontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
#include "networkdbusproxy.h"

#include <QFile>

const QString chains4Path = "/usr/bin/proxychains4";
#include <QStandardPaths>

using namespace dde::network;

Expand All @@ -33,7 +32,7 @@ ProxyController::ProxyController(NetworkDBusProxy *networkInter, QObject *parent
m_appProxyConfig.username = m_networkInter->user();
m_appProxyConfig.password = m_networkInter->password();
// 判断是否存在proxychains4来决定是否存在应用代理
m_appProxyExist = QFile().exists(chains4Path);
m_appProxyExist = !QStandardPaths::findExecutable("proxychains4").isEmpty();
}

ProxyController::~ProxyController()
Expand Down