From 1b1ac4a0b14b9860089f4baa92f027835b96c959 Mon Sep 17 00:00:00 2001 From: fensite Date: Thu, 14 Oct 2021 09:03:05 +0800 Subject: [PATCH] =?UTF-8?q?simplify=20translation=20methods=EF=BC=9B=20Ign?= =?UTF-8?q?ore=20dependent=20details=20to=20prevent=20compilation=20errors?= =?UTF-8?q?=20=E7=AE=80=E5=8C=96=E7=BF=BB=E8=AF=91=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=EF=BC=9B=E5=BF=BD=E7=95=A5=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E7=9A=84=E8=AF=A6=E6=83=85=E4=BB=A5=E9=98=B2=E6=AD=A2=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debian/control | 3 +-- debian/rules | 4 ++++ src/main.cpp | 16 +++++++--------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/debian/control b/debian/control index 0dec5721..c34468cd 100644 --- a/debian/control +++ b/debian/control @@ -16,14 +16,13 @@ Build-Depends: debhelper (>=9), libx11-dev, libqt5svg5-dev, libkf5networkmanagerqt-dev (>= 5.36.0), - libnm-dev, + libnm-dev, libcap-dev, Standards-Version: 4.5.0 Rules-Requires-Root: no Homepage: https://github.com/ukui/kylin-nm Vcs-Git: https://github.com/ukui/kylin-nm.git Vcs-Browser: https://github.com/ukui/kylin-nm - Package: kylin-nm Architecture: any Depends: network-manager (>=1.2.6), diff --git a/debian/rules b/debian/rules index 545fc119..9454d51a 100755 --- a/debian/rules +++ b/debian/rules @@ -28,3 +28,7 @@ override_dh_auto_clean: override_dh_auto_build: dh_auto_build -- $(MAKE_OPTS) + +override_dh_shlibdeps: + dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info + diff --git a/src/main.cpp b/src/main.cpp index cac828c9..6c34052a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -85,6 +85,7 @@ int main(int argc, char *argv[]) QtSingleApplication a(id, argc, argv); qInstallMessageHandler(messageOutput); if (a.isRunning()) { + qInfo() << "Kylin-Network-Manager Is Already Launched, just show"; auto connection = QDBusConnection::sessionBus(); QDBusInterface iface("com.kylin.network", "/com/kylin/network", @@ -94,22 +95,19 @@ int main(int argc, char *argv[]) return 0; } - qDebug()<<"Kylin Network Manager Is Already Launched"; - QApplication::setQuitOnLastWindowClosed(false); // Internationalization QString locale = QLocale::system().name(); QTranslator trans_global; - if (locale == "zh_CN") { - trans_global.load(":/translations/kylin-nm_zh_CN.qm"); + qDebug() << "QLocale " << QLocale(); + if (trans_global.load(QLocale(), "kylin-nm", "_", ":/translations/")) + { a.installTranslator(&trans_global); + qDebug()<<"Translations load success"; + } else { + qWarning() << "Translations load fail"; } - if (locale == "tr_TR") { - trans_global.load(":/translations/kylin-nm_tr.qm"); - a.installTranslator(&trans_global); - } - qDebug()<<"Translations Are Already Loaded"; MainWindow w; w.setProperty("useStyleWindowManager", false); //禁用拖动