forked from openkylin/ukui-menu
1.加载翻译文件,2.加入Widgets模块依赖
This commit is contained in:
parent
a4aaab5d7b
commit
745f203940
|
@ -13,7 +13,7 @@ set(CMAKE_AUTORCC ON)
|
||||||
|
|
||||||
# 查找qt组件
|
# 查找qt组件
|
||||||
find_package(Qt5 COMPONENTS
|
find_package(Qt5 COMPONENTS
|
||||||
Core Gui Quick LinguistTools DBus X11Extras
|
Core Gui Quick Widgets LinguistTools DBus X11Extras
|
||||||
REQUIRED)
|
REQUIRED)
|
||||||
|
|
||||||
# find kde framework components
|
# find kde framework components
|
||||||
|
@ -99,6 +99,7 @@ target_link_libraries(${PROJECT_NAME}
|
||||||
Qt5::Core
|
Qt5::Core
|
||||||
Qt5::Gui
|
Qt5::Gui
|
||||||
Qt5::Quick
|
Qt5::Quick
|
||||||
|
Qt5::Widgets
|
||||||
Qt5::DBus
|
Qt5::DBus
|
||||||
Qt5::X11Extras
|
Qt5::X11Extras
|
||||||
KF5::WindowSystem
|
KF5::WindowSystem
|
||||||
|
|
11
src/main.cpp
11
src/main.cpp
|
@ -1,4 +1,6 @@
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QTranslator>
|
||||||
|
#include <QLocale>
|
||||||
|
|
||||||
#include "singleapplication.h"
|
#include "singleapplication.h"
|
||||||
#include "ukui-menu-application.h"
|
#include "ukui-menu-application.h"
|
||||||
|
@ -6,6 +8,9 @@
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
|
QCoreApplication::setApplicationName("ukui-menu");
|
||||||
|
QCoreApplication::setOrganizationName("ukui");
|
||||||
|
QCoreApplication::setOrganizationDomain("ukui.org");
|
||||||
QCoreApplication::setApplicationVersion("0.0.1-alpha");
|
QCoreApplication::setApplicationVersion("0.0.1-alpha");
|
||||||
|
|
||||||
QString appid = QString("ukui-menu-%1").arg(QLatin1String(getenv("DISPLAY")));
|
QString appid = QString("ukui-menu-%1").arg(QLatin1String(getenv("DISPLAY")));
|
||||||
|
@ -20,6 +25,12 @@ int main(int argc, char *argv[])
|
||||||
return 0;
|
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);
|
UkuiMenu::UkuiMenuApplication menuApplication(&messageProcessor);
|
||||||
QObject::connect(&app, &SingleApplication::receivedMessage,
|
QObject::connect(&app, &SingleApplication::receivedMessage,
|
||||||
&messageProcessor, &UkuiMenu::MenuMessageProcessor::processMessage);
|
&messageProcessor, &UkuiMenu::MenuMessageProcessor::processMessage);
|
||||||
|
|
Loading…
Reference in New Issue