From eca780626956131cb92cfd0e84c9d30adc7e7747 Mon Sep 17 00:00:00 2001 From: Daniel Brunner <0xFEEDC0DE64@gmail.com> Date: Sun, 14 Oct 2018 15:35:39 +0200 Subject: [PATCH] cmake plugin cleanups --- CMakeLists.txt | 8 +++++++- weatherplugin.cpp | 6 +++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d4bc1bb..3011e99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,13 @@ set(SOURCES weatherwidget.cpp ) -add_library(zeiterfassung-plugins-weatherplugin SHARED ${HEADERS} ${SOURCES}) +set(OTHER_FILES + weatherplugin.json +) + +add_library(zeiterfassung-plugins-weatherplugin SHARED ${HEADERS} ${SOURCES} ${OTHER_FILES}) + +set_target_properties(zeiterfassung-plugins-weatherplugin PROPERTIES OUTPUT_NAME weatherplugin PREFIX "") target_link_libraries(zeiterfassung-plugins-weatherplugin Qt5::Core Qt5::Gui Qt5::Widgets zeiterfassungguilib zeiterfassungnetworklib) diff --git a/weatherplugin.cpp b/weatherplugin.cpp index a09feee..8500aa7 100644 --- a/weatherplugin.cpp +++ b/weatherplugin.cpp @@ -6,6 +6,8 @@ #include #include +#include "utils/fileutils.h" + #include "mainwindow.h" #include "weatherwidget.h" @@ -16,9 +18,7 @@ WeatherPlugin::WeatherPlugin(QObject *parent) : { qDebug() << "called"; - static auto dir = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(QStringLiteral("translations")); - - if(m_translator.load(QLocale(), QStringLiteral("weatherplugin"), QStringLiteral("_"), dir)) + if(m_translator.load(QLocale(), QStringLiteral("weatherplugin"), QStringLiteral("_"), translationsDir())) { if(!QCoreApplication::installTranslator(&m_translator)) {