summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt26
-rwxr-xr-xbuild.sh16
-rw-r--r--src/dialog.cpp2
-rw-r--r--src/i18n/de.ts72
-rw-r--r--src/main.cpp9
-rw-r--r--src/ui/dialog.ui4
6 files changed, 122 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0bc9e02..9601a66 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,7 @@ file(GLOB_RECURSE VMCHOOSER_SOURCES src/*.cpp)
file(GLOB_RECURSE VMCHOOSER_MOC_HEADERS src/*.h)
file(GLOB_RECURSE VMCHOOSER_UIS src/ui/*.ui)
file(GLOB_RECURSE VMCHOOSER_RESOURCES src/*.qrc)
+file(GLOB_RECURSE VMCHOOSER_TSS src/i18n/*.ts)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
@@ -48,7 +49,6 @@ endif(LIBXML2_FOUND)
#
# Qt4
#
-# TODO: Qt4.3 should do
find_package(Qt4 4.5.0 REQUIRED)
if(QT4_FOUND)
message(STATUS "Qt4 found")
@@ -62,6 +62,29 @@ set(QT_USE_QTSVG TRUE)
include(${QT_USE_FILE})
+option(UPDATE_TRANSLATIONS "Update .ts files (WARNING: make clean will delete the .ts files!)")
+if(VMCHOOSER_TSS)
+ if (UPDATE_TRANSLATIONS)
+ set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${VMCHOOSER_SOURCES} ${VMCHOOSER_UIS})
+ QT4_CREATE_TRANSLATION(VMCHOOSER_QMS ${FILES_TO_TRANSLATE} ${VMCHOOSER_TSS} OPTIONS -noobsolete)
+ message(STATUS ".tr files have been updated")
+ else (UPDATE_TRANSLATIONS)
+ QT4_ADD_TRANSLATION(VMCHOOSER_QMS ${VMCHOOSER_TSS})
+ endif (UPDATE_TRANSLATIONS)
+
+ # write a resource file for qm files
+ set(resource_file_content "<RCC>\n <qresource prefix=\"/\">\n")
+ foreach(file ${VMCHOOSER_QMS})
+ get_filename_component(filename ${file} NAME)
+ set(resource_file_content "${resource_file_content} <file>${filename}</file>\n")
+ endforeach(file)
+ set(resource_file_content "${resource_file_content} </qresource>\n</RCC>\n")
+ file(WRITE "${CMAKE_BINARY_DIR}/translation.qrc" "${resource_file_content}")
+ set(VMCHOOSER_RESOURCES ${VMCHOOSER_RESOURCES} "${CMAKE_BINARY_DIR}/translation.qrc")
+
+ #add_custom_target(translations_target DEPENDS ${VMCHOOSER_QMS})
+endif(VMCHOOSER_TSS)
+
QT4_ADD_RESOURCES(VMCHOOSER_RC_SOURCES ${VMCHOOSER_RESOURCES})
QT4_WRAP_UI(VMCHOOSER_UI_HEADERS ${VMCHOOSER_UIS})
QT4_WRAP_CPP(VMCHOOSER_MOC_SOURCES ${VMCHOOSER_MOC_HEADERS})
@@ -77,6 +100,7 @@ add_executable(vmchooser
${VMCHOOSER_MOC_SOURCES}
${VMCHOOSER_UI_HEADERS}
${VMCHOOSER_RC_SOURCES}
+ ${VMCHOOSER_QMS}
)
target_link_libraries(vmchooser
diff --git a/build.sh b/build.sh
index 69041c0..7a515e4 100755
--- a/build.sh
+++ b/build.sh
@@ -8,6 +8,20 @@ BUILDDIR="build"
DIR=$(pwd)
+for OPTION in "$@"
+do
+ if [[ "$OPTION" == "--clean" ]]
+ then
+ rm -r "$BUILDDIR"
+ elif [[ "$OPTION" == "--update-translations" ]]
+ then
+ CMAKE_ARGS="$CMAKE_ARGS -DUPDATE_TRANSLATIONS:BOOL=ON"
+ else
+ echo "usage: $SCRIPTNAME [--clean] [--update-translations]" >&2
+ exit 1
+ fi
+done
+
if [[ ! -f "$DIR"/"$SRCDIR"/CMakeLists.txt ]]
then
echo "$SRCDIR/CMakeLists.txt not found" >&2
@@ -26,6 +40,6 @@ fi
mkdir -p "$BUILDDIR"
cd "$BUILDDIR"
-cmake "$DIR"/"$SRCDIR"/ && make clean && make -j $NCORES
+cmake $CMAKE_ARGS "$DIR"/"$SRCDIR"/ && make -j $NCORES
cd "$DIR"
diff --git a/src/dialog.cpp b/src/dialog.cpp
index 6a931ca..7ebfbcc 100644
--- a/src/dialog.cpp
+++ b/src/dialog.cpp
@@ -16,7 +16,7 @@ Dialog::Dialog(QWidget *parent) :
if (ifaceDBus_->isValid()) {
// PVS is running
QStringList accessOptions;
- accessOptions << "None" << "View Only" << "Full";
+ accessOptions << tr("None") << tr("View Only") << tr("Full");
ui->comboBoxLecturer->insertItems(0, accessOptions);
ui->comboBoxOthers->insertItems(0, accessOptions);
diff --git a/src/i18n/de.ts b/src/i18n/de.ts
new file mode 100644
index 0000000..b8063d6
--- /dev/null
+++ b/src/i18n/de.ts
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="de">
+<context>
+ <name>Dialog</name>
+ <message>
+ <location filename="../ui/dialog.ui" line="14"/>
+ <source>vmchooser</source>
+ <translation>vmchooser</translation>
+ </message>
+ <message>
+ <location filename="../ui/dialog.ui" line="36"/>
+ <source>PVS Options</source>
+ <translation>PVS Einstellungen</translation>
+ </message>
+ <message>
+ <location filename="../ui/dialog.ui" line="44"/>
+ <source>VNC access by lecturer:</source>
+ <translation>VNC-Zugriff für Dozenten:</translation>
+ </message>
+ <message>
+ <location filename="../ui/dialog.ui" line="61"/>
+ <source>VNC access by others:</source>
+ <translation>VNC-Zugriff für andere:</translation>
+ </message>
+ <message>
+ <location filename="../ui/dialog.ui" line="102"/>
+ <source>Accept chat messages</source>
+ <translation>Chat-Nachrichten akzeptieren</translation>
+ </message>
+ <message>
+ <location filename="../ui/dialog.ui" line="109"/>
+ <source>Accept file transfers</source>
+ <translation>Dateiübertragungen akzeptieren</translation>
+ </message>
+ <message>
+ <location filename="../ui/dialog.ui" line="149"/>
+ <source>Abort</source>
+ <translation>Abbrechen</translation>
+ </message>
+ <message>
+ <location filename="../ui/dialog.ui" line="156"/>
+ <source>Start</source>
+ <translation>Start</translation>
+ </message>
+ <message>
+ <location filename="../dialog.cpp" line="19"/>
+ <source>None</source>
+ <translation>kein Zugriff</translation>
+ </message>
+ <message>
+ <location filename="../dialog.cpp" line="19"/>
+ <source>View Only</source>
+ <translation>nur ansehen</translation>
+ </message>
+ <message>
+ <location filename="../dialog.cpp" line="19"/>
+ <source>Full</source>
+ <translation>Vollzugriff</translation>
+ </message>
+ <message>
+ <location filename="../main.cpp" line="196"/>
+ <source>X Sessions</source>
+ <translation>X Sitzungen</translation>
+ </message>
+ <message>
+ <location filename="../main.cpp" line="197"/>
+ <source>Virtual Sessions</source>
+ <translation>Virtuelle Sitzungen</translation>
+ </message>
+</context>
+</TS>
diff --git a/src/main.cpp b/src/main.cpp
index 6766403..c44d362 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3,6 +3,7 @@
#include <iostream>
#include <stdlib.h>
+#include <QTranslator>
#include "save_restore_session.h"
#include "xsession.h"
#include "vsession.h"
@@ -18,6 +19,10 @@ using namespace std;
int main(int argc, char *argv[]) {
QApplication a(argc, argv);
+ QTranslator translator;
+ translator.load(":" + QLocale::system().name());
+ a.installTranslator(&translator);
+
string version = "0.0.13";
AnyOption* opt = new AnyOption();
char* xmlpath = NULL;
@@ -188,8 +193,8 @@ int main(int argc, char *argv[]) {
Dialog w;
w.resize(width, height);
- w.addItems(xsessions, "X Sessions");
- w.addItems(vsessions, "Virtual Sessions");
+ w.addItems(xsessions, a.translate("Dialog", "X Sessions"));
+ w.addItems(vsessions, a.translate("Dialog", "Virtual Sessions"));
w.selectPreviousSession();
w.show();
return a.exec();
diff --git a/src/ui/dialog.ui b/src/ui/dialog.ui
index fe03b5d..6594b63 100644
--- a/src/ui/dialog.ui
+++ b/src/ui/dialog.ui
@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
- <string>Dialog</string>
+ <string>vmchooser</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
@@ -146,7 +146,7 @@
<item>
<widget class="QPushButton" name="pushButtonAbort">
<property name="text">
- <string>Abbrechen</string>
+ <string>Abort</string>
</property>
</widget>
</item>