From 745f2039403c2cd670c747fea667e9e8ab70f6db Mon Sep 17 00:00:00 2001 From: hewenfei Date: Fri, 9 Dec 2022 09:08:16 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=8A=A0=E8=BD=BD=E7=BF=BB=E8=AF=91=E6=96=87?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C2.=E5=8A=A0=E5=85=A5Widgets=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 3 ++- src/main.cpp | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a1acd1..aa7465c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ set(CMAKE_AUTORCC ON) # 查找qt组件 find_package(Qt5 COMPONENTS - Core Gui Quick LinguistTools DBus X11Extras + Core Gui Quick Widgets LinguistTools DBus X11Extras REQUIRED) # find kde framework components @@ -99,6 +99,7 @@ target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Gui Qt5::Quick + Qt5::Widgets Qt5::DBus Qt5::X11Extras KF5::WindowSystem diff --git a/src/main.cpp b/src/main.cpp index 9de14eb..495d4e9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,4 +1,6 @@ #include +#include +#include #include "singleapplication.h" #include "ukui-menu-application.h" @@ -6,6 +8,9 @@ int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QCoreApplication::setApplicationName("ukui-menu"); + QCoreApplication::setOrganizationName("ukui"); + QCoreApplication::setOrganizationDomain("ukui.org"); QCoreApplication::setApplicationVersion("0.0.1-alpha"); QString appid = QString("ukui-menu-%1").arg(QLatin1String(getenv("DISPLAY"))); @@ -20,6 +25,12 @@ int main(int argc, char *argv[]) return 0; } + // translation files + QTranslator translator(&app); + QString translationFile{(QString(UKUI_MENU_TRANSLATION_DIR) + "/ukui-menu_" + QLocale::system().name() + ".qm")}; + translator.load(translationFile); + QCoreApplication::installTranslator(&translator); + UkuiMenu::UkuiMenuApplication menuApplication(&messageProcessor); QObject::connect(&app, &SingleApplication::receivedMessage, &messageProcessor, &UkuiMenu::MenuMessageProcessor::processMessage);