Changed: #1193 Added Qt translation files.

This commit is contained in:
dnk-88 2011-02-20 15:00:15 +02:00
parent f218922f4c
commit 62d06ff5bb
11 changed files with 19783 additions and 66 deletions

View file

@ -40,6 +40,8 @@ SET(OBJECT_VIEWER_UIS animation_form.ui animation_set_form.ui settings_form.ui
SET(OBJECT_VIEWER_RCS object_viewer_qt.qrc) SET(OBJECT_VIEWER_RCS object_viewer_qt.qrc)
SET(LANGUAGES en fr de ru)
SET(QT_USE_QTGUI TRUE) SET(QT_USE_QTGUI TRUE)
SET(QT_USE_QTOPENGL TRUE) SET(QT_USE_QTOPENGL TRUE)
@ -47,11 +49,27 @@ QT4_ADD_RESOURCES( OBJECT_VIEWER_RC_SRCS ${OBJECT_VIEWER_RCS} )
QT4_WRAP_CPP( OBJECT_VIEWER_MOC_SRCS ${OBJECT_VIEWER_HDR} ) QT4_WRAP_CPP( OBJECT_VIEWER_MOC_SRCS ${OBJECT_VIEWER_HDR} )
QT4_WRAP_UI( OBJECT_VIEWER_UI_HDRS ${OBJECT_VIEWER_UIS} ) QT4_WRAP_UI( OBJECT_VIEWER_UI_HDRS ${OBJECT_VIEWER_UIS} )
FOREACH(LANGUAGE ${LANGUAGES})
SET (TS ${CMAKE_CURRENT_SOURCE_DIR}/translations/object_viewer_qt_${LANGUAGE}.ts)
SET (QM ${CMAKE_CURRENT_SOURCE_DIR}/translations/object_viewer_qt_${LANGUAGE}.qm)
SET (TRANSLATIONS ${TRANSLATIONS} ${TS})
SET (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM})
ADD_CUSTOM_COMMAND (OUTPUT ${QM} COMMAND ${QT_LRELEASE_EXECUTABLE} ${TS} MAIN_DEPENDENCY ${TS})
ENDFOREACH()
ADD_CUSTOM_TARGET (translations COMMAND ${QT_LUPDATE_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR} -recursive -ts ${TRANSLATIONS})
ADD_CUSTOM_COMMAND (TARGET translations COMMAND ${QT_LRELEASE_EXECUTABLE} ${TRANSLATIONS})
SOURCE_GROUP(QtResources FILES ${OBJECT_VIEWER_UIS} ${OBJECT_VIEWER_RCS}) SOURCE_GROUP(QtResources FILES ${OBJECT_VIEWER_UIS} ${OBJECT_VIEWER_RCS})
SOURCE_GROUP(QtGeneratedUiHdr FILES ${OBJECT_VIEWER_UI_HDRS}) SOURCE_GROUP(QtGeneratedUiHdr FILES ${OBJECT_VIEWER_UI_HDRS})
SOURCE_GROUP(QtGeneratedMocSrc FILES ${OBJECT_VIEWER_MOC_SRCS}) SOURCE_GROUP(QtGeneratedMocSrc FILES ${OBJECT_VIEWER_MOC_SRCS})
ADD_EXECUTABLE(object_viewer_qt WIN32 MACOSX_BUNDLE ${OBJECT_VIEWER_SRC} ${OBJECT_VIEWER_MOC_SRCS} ${OBJECT_VIEWER_RC_SRCS} ${OBJECT_VIEWER_UI_HDRS}) ADD_EXECUTABLE(object_viewer_qt WIN32 MACOSX_BUNDLE
${OBJECT_VIEWER_SRC}
${OBJECT_VIEWER_MOC_SRCS}
${OBJECT_VIEWER_RC_SRCS}
${OBJECT_VIEWER_UI_HDRS}
${TRANSLATIONS})
TARGET_LINK_LIBRARIES(object_viewer_qt TARGET_LINK_LIBRARIES(object_viewer_qt
nelmisc nelmisc

View file

@ -21,6 +21,9 @@
// Qt includes // Qt includes
#include <QtCore/QDir> #include <QtCore/QDir>
#include <QtCore/QTranslator>
#include <QtCore/QLibraryInfo>
#include <QtCore/QLocale>
#include <QtCore/QSettings> #include <QtCore/QSettings>
#include <QtGui/QMessageBox> #include <QtGui/QMessageBox>
#include <QtGui/QApplication> #include <QtGui/QApplication>
@ -102,23 +105,30 @@ sint main(int argc, char **argv)
#endif #endif
nlinfo("Welcome to NeL Object Viewer Qt!"); nlinfo("Welcome to NeL Object Viewer Qt!");
NLMISC::CPath::remapExtension("tga", "png", true);
} }
QApplication app(argc, argv); QApplication app(argc, argv);
QSplashScreen *splash = new QSplashScreen(); QSplashScreen *splash = new QSplashScreen();
splash->setPixmap(QPixmap(":/images/nel_ide_load.png")); splash->setPixmap(QPixmap(":/images/nel_ide_load.png"));
splash->show(); splash->show();
QSettings *settings = new QSettings(QSettings::IniFormat, QSettings::UserScope,
QLatin1String("Ryzom Core"), QLatin1String("ObjectViewerQt"));
QTranslator translator;
QTranslator qtTranslator;
QString locale = settings->value("Language", QLocale::system().name()).toString();
QString qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
translator.load("object_viewer_qt_" + locale, ":/translations");
qtTranslator.load("qt_" + locale, qtTrPath);
app.installTranslator(&translator);
app.installTranslator(&qtTranslator);
#if defined(NL_OS_MAC) #if defined(NL_OS_MAC)
QDir::setCurrent(qApp->applicationDirPath() + QString("/../Resources")); QDir::setCurrent(qApp->applicationDirPath() + QString("/../Resources"));
CLibrary::addLibPath((qApp->applicationDirPath() + QString("/../PlugIns/nel")).toStdString()); CLibrary::addLibPath((qApp->applicationDirPath() + QString("/../PlugIns/nel")).toStdString());
#endif #endif
Modules::init(); Modules::init();
QSettings *settings = new QSettings(QSettings::IniFormat, QSettings::UserScope,
QLatin1String("Ryzom Core"), QLatin1String("ObjectViewerQt"));
Modules::plugMan().setSettings(settings); Modules::plugMan().setSettings(settings);

View file

@ -1,5 +1,5 @@
<RCC> <RCC>
<qresource> <qresource prefix="/">
<file>images/nel.png</file> <file>images/nel.png</file>
<file>images/open-file.png</file> <file>images/open-file.png</file>
<file>images/go-down.png</file> <file>images/go-down.png</file>
@ -42,12 +42,9 @@
<file>images/rmpoints.png</file> <file>images/rmpoints.png</file>
<file>images/cam_del.png</file> <file>images/cam_del.png</file>
<file>images/cam_add.png</file> <file>images/cam_add.png</file>
<file>images/Emitter.bmp</file> <file>images/Emitter.bmp</file>
<file>images/Force.bmp</file> <file>images/Force.bmp</file>
<file>images/nel_ide_load.png</file> <file>images/nel_ide_load.png</file>
<file>images/bad_particle_system_item.png</file> <file>images/bad_particle_system_item.png</file>
<file>images/particle_system_item.png</file> <file>images/particle_system_item.png</file>
<file>images/instance_item.png</file> <file>images/instance_item.png</file>
@ -57,5 +54,9 @@
<file>images/sound_item.png</file> <file>images/sound_item.png</file>
<file>images/workspace_item.png</file> <file>images/workspace_item.png</file>
<file>images/collision_zone_item.png</file> <file>images/collision_zone_item.png</file>
</qresource> <file>translations/object_viewer_qt_en.qm</file>
<file>translations/object_viewer_qt_fr.qm</file>
<file>translations/object_viewer_qt_de.qm</file>
<file>translations/object_viewer_qt_ru.qm</file>
</qresource>
</RCC> </RCC>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff