From bfee209b7a3e06bc98d0bf3200ef4600dbd03b9a Mon Sep 17 00:00:00 2001 From: Micke Prag Date: Tue, 22 Sep 2009 16:46:51 +0000 Subject: [PATCH] Loaded translation files correctly on MacOSX --- telldus-gui/TelldusGui/CMakeLists.txt | 2 +- telldus-gui/TelldusGui/telldusgui.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/telldus-gui/TelldusGui/CMakeLists.txt b/telldus-gui/TelldusGui/CMakeLists.txt index ec60cd45..eac6691c 100644 --- a/telldus-gui/TelldusGui/CMakeLists.txt +++ b/telldus-gui/TelldusGui/CMakeLists.txt @@ -108,7 +108,7 @@ IF (UPDATE_TRANSLATIONS) ELSE (UPDATE_TRANSLATIONS) IF (APPLE) SET_SOURCE_FILES_PROPERTIES(${telldus-gui_TS} PROPERTIES - OUTPUT_LOCATION ${CMAKE_BINARY_DIR} + OUTPUT_LOCATION ${CMAKE_BINARY_DIR}/TelldusCenter.app/Contents/Resources ) ELSEIF (UNIX) SET_SOURCE_FILES_PROPERTIES(${telldus-gui_TS} PROPERTIES diff --git a/telldus-gui/TelldusGui/telldusgui.cpp b/telldus-gui/TelldusGui/telldusgui.cpp index c31fe885..bd9f928a 100644 --- a/telldus-gui/TelldusGui/telldusgui.cpp +++ b/telldus-gui/TelldusGui/telldusgui.cpp @@ -1,13 +1,23 @@ #include "telldusgui.h" #include #include +#include #include #include "devicewidget.h" QWidget* WINAPI tdDeviceWidget( QWidget *parent ) { QTranslator *translator = new QTranslator(parent); +#ifdef Q_OS_MAC + QDir resDir = QDir(qApp->applicationDirPath()); + if (resDir.dirName() == "MacOS") { + resDir.cdUp(); + resDir.cd("resources"); + } + translator->load("TelldusGui_" + QLocale::system().name(), resDir.absolutePath()); +#else translator->load("TelldusGui_" + QLocale::system().name()); +#endif qApp->installTranslator(translator); return new DeviceWidget(parent); }