diff --git a/buildDebianPackage b/buildDebianPackage index 95c6a243..98fb8c2c 100755 --- a/buildDebianPackage +++ b/buildDebianPackage @@ -26,6 +26,9 @@ rm -rf install QT_PATH="/usr/local/Trolltech/Qt-4.7.3" PLUGINS_PATH="$QT_PATH/plugins" QMAKE_PATH="$QT_PATH/bin/qmake" +LRELEASES="/usr/local/Trolltech/Qt-4.7.3/bin/lrelease" +GUI_TRANSLATIONS_DIRECTORY_PATH="../Qt-sankore3.1/translations" +ARCHITECTURE=`uname -m` if [ ! -e "$QMAKE_PATH" ]; then notifyError "qmake command not found at $QMAKE_PATH" @@ -36,10 +39,14 @@ if [ ! -e "$PLUGINS_PATH" ]; then fi notify-send "Open-Sankore" "Building Open-Sankore ..." -$QMAKE_PATH -spec linux-g++ -make -j 4 release-install +if [ "$ARCHITECTURE" == "x86_64" ]; then + $QMAKE_PATH -spec linux-g++-64 +else + $QMAKE_PATH -spec linux-g++ +fi +make -j 4 release-install notify-send "Git Hub" "Make a tag of the delivered version" VERSION=`cat build/linux/release/version` @@ -49,8 +56,8 @@ else LAST_COMMITED_VERSION="`git describe $(git rev-list --tags --max-count=1)`" if [ "v$VERSION" != "$LAST_COMMITED_VERSION" ]; then echo creating a tag with the version $VERSION -# git tag -a "v$VERSION" -m "Generating setup for v$VERSION" -# git push origin --tags + git tag -a "v$VERSION" -m "Generating setup for v$VERSION" + git push origin --tags fi fi @@ -92,15 +99,31 @@ else cp "$QT_LIBRARY_SOURCE_PATH/libphonon.so.4.4.0" "$QT_LIBRARY_DEST_PATH/" fi + +notify-send "QT" "Internalization ..." +if [ ! -e $GUI_TRANSLATIONS_DIRECTORY_PATH ]; then + notifyError "gui translations pro file not found at: $GUI_TRANSLATIONS_DIRECTORY_PATH" +else + cd $GUI_TRANSLATIONS_DIRECTORY_PATH + $LRELEASES translations.pro + cd - + if [ ! -e build/linux/release/product/i18n ]; then + mkdir build/linux/release/product/i18n + fi + #copying qt gui translation + cp $GUI_TRANSLATIONS_DIRECTORY_PATH/qt_??.qm build/linux/release/product/i18n/ +fi + +$LRELEASES Sankore_3.1.pro +cp resources/i18n/*.qm build/linux/release/product/i18n/ + rm -rf install/linux mkdir -p install/linux -#mv build/linux/release/product build/linux/release/Sankore.$VERSION cd build/linux/release/product #Removing .svn directories ... find . -name .svn -exec rm -rf {} \; 2> /dev/null -#tar cvzf ../../../install/linux/Sankore\ 3.1.tar.gz Sankore_3.1.$VERSION -C . cd - notify-send "Building Sankore" "Finished to build Sankore building the package" @@ -191,7 +214,6 @@ CHANGE_LOG_FILE="$BASE_WORKING_DIR/DEBIAN/changelog-sankore-$VERSION.txt" CONTROL_FILE="$BASE_WORKING_DIR/DEBIAN/control" CHANGE_LOG_TEXT="changelog.txt" -ARCHITECTURE=`uname -m` if [ "$ARCHITECTURE" == "x86_64" ]; then ARCHITECTURE="amd64" fi diff --git a/release.linux.sh b/release.linux.sh index fd9624a6..9601d06c 100755 --- a/release.linux.sh +++ b/release.linux.sh @@ -23,6 +23,7 @@ QT_PATH="/usr/local/Trolltech/Qt-4.7.3" PLUGINS_PATH="$QT_PATH/plugins" QMAKE_PATH="$QT_PATH/bin/qmake" LRELEASES="/usr/local/Trolltech/Qt-4.7.3/bin/lrelease" +GUI_TRANSLATIONS_DIRECTORY_PATH="../Qt-sankore3.1/translations" if [ ! -e "$QMAKE_PATH" ]; then echo "qmake command not found at $QMAKE_PATH" @@ -35,11 +36,15 @@ if [ ! -e "$PLUGINS_PATH" ]; then exit 1 fi -$QMAKE_PATH -spec linux-g++ +ARCHITECTURE=`uname -m` +if [ "$ARCHITECTURE" == "x86_64" ]; then + $QMAKE_PATH -spec linux-g++-64 +else + $QMAKE_PATH -spec linux-g++ +fi make -j 4 release-install -$LRELEASES "Sankore_3.1.pro" VERSION=`cat build/linux/release/version` if [ ! -f build/linux/release/version ]; then @@ -79,9 +84,6 @@ copyQtLibrary(){ } -cp "$QT_LIBRARY_SOURCE_PATH/libphonon.so.4" "$QT_LIBRARY_DEST_PATH/" -cp "$QT_LIBRARY_SOURCE_PATH/libphonon.so.4.4.0" "$QT_LIBRARY_DEST_PATH/" - copyQtLibrary libQtWebKit copyQtLibrary libQtDBus copyQtLibrary libQtScript @@ -92,8 +94,25 @@ copyQtLibrary libQtXml copyQtLibrary libQtGui copyQtLibrary libQtCore -cp "$QT_LIBRARY_SOURCE_PATH/phonon.so.4" "$QT_LIBRARY_DEST_PATH/" -cp "$QT_LIBRARY_SOURCE_PATH/phonon.so.4.4.0" "$QT_LIBRARY_DEST_PATH/" +cp "$QT_LIBRARY_SOURCE_PATH/libphonon.so.4" "$QT_LIBRARY_DEST_PATH/" +cp "$QT_LIBRARY_SOURCE_PATH/libphonon.so.4.4.0" "$QT_LIBRARY_DEST_PATH/" + +if [ ! -e $GUI_TRANSLATIONS_DIRECTORY_PATH ]; then + notifyError "gui translations pro file not found at: $GUI_TRANSLATIONS_DIRECTORY_PATH" +else + cd $GUI_TRANSLATIONS_DIRECTORY_PATH + $LRELEASES translations.pro + cd - + if [ ! -e build/linux/release/product/i18n ]; then + mkdir build/linux/release/product/i18n + fi + #copying qt gui translation + cp $GUI_TRANSLATIONS_DIRECTORY_PATH/qt_??.qm build/linux/release/product/i18n/ +fi + +$LRELEASES Sankore_3.1.pro +cp resources/i18n/*.qm build/linux/release/product/i18n/ + rm -rf install/linux mkdir -p install/linux diff --git a/src/core/UBApplication.cpp b/src/core/UBApplication.cpp index 7c78a086..de59f778 100644 --- a/src/core/UBApplication.cpp +++ b/src/core/UBApplication.cpp @@ -101,8 +101,10 @@ static OSStatus ub_appleEventProcessor(const AppleEvent *ae, AppleEvent *event, #endif -UBApplication::UBApplication(const QString &id, int &argc, char **argv) : QtSingleApplication(id, argc, argv), - mPreferencesController(NULL) +UBApplication::UBApplication(const QString &id, int &argc, char **argv) : QtSingleApplication(id, argc, argv) + , mPreferencesController(NULL) + , mApplicationTranslator(NULL) + , mQtGuiTranslator(NULL) { staticMemoryCleaner = new QObject(0); // deleted in UBApplication destructor @@ -136,22 +138,20 @@ UBApplication::UBApplication(const QString &id, int &argc, char **argv) : QtSing undoStack = new QUndoStack(staticMemoryCleaner); } - QTranslator *translator = new QTranslator(this); - - translator->load(UBPlatformUtils::preferredTranslation()); - - installTranslator(translator); + mApplicationTranslator = new QTranslator(this); + mApplicationTranslator->load(UBPlatformUtils::preferredTranslation(QString("sankore_"))); + installTranslator(mApplicationTranslator); QString localString; - - if (!translator->isEmpty()) - { + if (!mApplicationTranslator->isEmpty()) localString = UBPlatformUtils::preferredLanguage(); - } else - { localString = "en_US"; - } + + mQtGuiTranslator = new QTranslator(this); + mQtGuiTranslator->load(UBPlatformUtils::preferredTranslation(QString("qt_"))); + installTranslator(mQtGuiTranslator); + QLocale::setDefault(QLocale(localString)); qDebug() << "Running application in:" << localString; @@ -203,6 +203,15 @@ UBApplication::~UBApplication() UBToolsManager::destroy(); + if(mApplicationTranslator != NULL){ + delete mApplicationTranslator; + mApplicationTranslator = NULL; + } + if(mQtGuiTranslator!=NULL){ + delete mQtGuiTranslator; + mQtGuiTranslator = NULL; + } + delete staticMemoryCleaner; staticMemoryCleaner = 0; } @@ -252,7 +261,7 @@ int UBApplication::exec(const QString& pFileToImport) boardController->paletteManager()->connectToDocumentController(); - UBDrawingController::drawingController()->setStylusTool((int)UBStylusTool::Selector); + UBDrawingController::drawingController()->setStylusTool((int)UBStylusTool::Pen); applicationController = new UBApplicationController(boardController->controlView(), boardController->displayView(), mainWindow, staticMemoryCleaner); diff --git a/src/core/UBApplication.h b/src/core/UBApplication.h index 0ca7ac37..5e2743fb 100644 --- a/src/core/UBApplication.h +++ b/src/core/UBApplication.h @@ -132,6 +132,8 @@ class UBApplication : public QtSingleApplication #endif UBPreferencesController* mPreferencesController; + QTranslator* mApplicationTranslator; + QTranslator* mQtGuiTranslator; }; diff --git a/src/core/UBDisplayManager.cpp b/src/core/UBDisplayManager.cpp index 1bffbb26..339fd3cb 100644 --- a/src/core/UBDisplayManager.cpp +++ b/src/core/UBDisplayManager.cpp @@ -142,7 +142,6 @@ void UBDisplayManager::setAsDesktop(QWidget* pControlWidget ) mDesktopWidget = pControlWidget; mDesktopWidget->hide(); mDesktopWidget->setGeometry(mDesktop->screenGeometry(mControlScreenIndex)); -// mDisplayWidget->showFullScreen(); // !!!! Should be included into Windows after QT recompilation #ifdef Q_WS_MAC // mControlWidget->setAttribute(Qt::WA_MacNoShadow); diff --git a/src/desktop/UBDesktopAnnotationController.cpp b/src/desktop/UBDesktopAnnotationController.cpp index 9cb92e4b..56540a46 100644 --- a/src/desktop/UBDesktopAnnotationController.cpp +++ b/src/desktop/UBDesktopAnnotationController.cpp @@ -52,11 +52,9 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) , mTransparentDrawingView(0) , mTransparentDrawingScene(0) , mDesktopPalette(NULL) -// , mKeyboardPalette(0) , mDesktopPenPalette(NULL) , mDesktopMarkerPalette(NULL) , mDesktopEraserPalette(NULL) -// , mRightPalette(NULL) , mWindowPositionInitialized(0) , mIsFullyTransparent(false) , mDesktopToolsPalettePositioned(false) @@ -89,27 +87,13 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) mTransparentDrawingScene = new UBGraphicsScene(0); mTransparentDrawingView->setScene(mTransparentDrawingScene); -// mRightPalette = UBApplication::boardController->paletteManager()->createDesktopRightPalette(mTransparentDrawingView); - //mRightPalette = new UBRightPalette(mTransparentDrawingView); - mDesktopPalette = new UBDesktopPalette(mTransparentDrawingView); if (UBPlatformUtils::hasVirtualKeyboard()) { -#ifdef Q_WS_X11 -// mKeyboardPalette = UBKeyboardPalette::create(0); -// connect(mTransparentDrawingView, SIGNAL(hidden()), mKeyboardPalette, SLOT(hide())); -// connect(mTransparentDrawingView, SIGNAL(shown()), this, SLOT(showKeyboard())); -#else -// mKeyboardPalette = UBKeyboardPalette::create(mTransparentDrawingView); -// mKeyboardPalette->setParent(mTransparentDrawingView); -#endif connect( UBApplication::boardController->paletteManager()->mKeyboardPalette, SIGNAL(keyboardActivated(bool)), mTransparentDrawingView, SLOT(virtualKeyboardActivated(bool))); -// connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), -// mTransparentDrawingView, SLOT(virtualKeyboardActivated(bool))); - #ifdef Q_WS_X11 connect(UBApplication::boardController->paletteManager()->mKeyboardPalette, SIGNAL(moved(QPoint)), this, SLOT(refreshMask())); connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), this, SLOT(refreshMask())); @@ -123,8 +107,6 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) connect(mDesktopPalette, SIGNAL(screenClick()), this, SLOT(screenCapture())); connect(mDesktopPalette, SIGNAL(maximized()), this, SLOT(onDesktopPaletteMaximized())); connect(mDesktopPalette, SIGNAL(minimizeStart(eMinimizedLocation)), this, SLOT(onDesktopPaletteMinimize())); -// connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), this, SLOT(showKeyboard(bool))); - connect(mTransparentDrawingView, SIGNAL(resized(QResizeEvent*)), this, SLOT(onTransparentWidgetResized())); diff --git a/src/frameworks/UBPlatformUtils.h b/src/frameworks/UBPlatformUtils.h index 74d97dce..a4d6d886 100644 --- a/src/frameworks/UBPlatformUtils.h +++ b/src/frameworks/UBPlatformUtils.h @@ -103,7 +103,7 @@ class UBPlatformUtils static void setFileType(const QString &filePath, unsigned long fileType); static void fadeDisplayOut(); static void fadeDisplayIn(); - static QString preferredTranslation(); + static QString preferredTranslation(QString pFilePrefix); static QString preferredLanguage(); static bool hasVirtualKeyboard(); //static void showVirtualKeyboard(); diff --git a/src/frameworks/UBPlatformUtils_linux.cpp b/src/frameworks/UBPlatformUtils_linux.cpp index 3c18ce93..174e3694 100644 --- a/src/frameworks/UBPlatformUtils_linux.cpp +++ b/src/frameworks/UBPlatformUtils_linux.cpp @@ -55,9 +55,9 @@ void UBPlatformUtils::fadeDisplayIn() // NOOP } -QString UBPlatformUtils::preferredTranslation() +QString UBPlatformUtils::preferredTranslation(QString pFilePrefix) { - QString qmPath = applicationResourcesDirectory() + "/" + "i18n" + "/" + QString("sankore_") + preferredLanguage() + ".qm"; + QString qmPath = applicationResourcesDirectory() + "/" + "i18n" + "/" + pFilePrefix + preferredLanguage() + ".qm"; return qmPath; } diff --git a/src/frameworks/UBPlatformUtils_mac.mm b/src/frameworks/UBPlatformUtils_mac.mm index 5d935031..5e1933ed 100644 --- a/src/frameworks/UBPlatformUtils_mac.mm +++ b/src/frameworks/UBPlatformUtils_mac.mm @@ -182,7 +182,7 @@ void UBPlatformUtils::fadeDisplayIn() } } -QString UBPlatformUtils::preferredTranslation() +QString UBPlatformUtils::preferredTranslation(QString pFilePrefix) { QString qmPath; @@ -202,7 +202,7 @@ QString UBPlatformUtils::preferredTranslation() QString UBPlatformUtils::preferredLanguage() { - QFileInfo qmFileInfo = QFileInfo(preferredTranslation()); + QFileInfo qmFileInfo = QFileInfo(applicationPreferredTranslation()); QDir lprojPath = qmFileInfo.dir(); QFileInfo lprojFileInfo = QFileInfo(lprojPath.absolutePath()); return lprojFileInfo.baseName(); diff --git a/src/frameworks/UBPlatformUtils_win.cpp b/src/frameworks/UBPlatformUtils_win.cpp index c60f0fc7..04f09420 100644 Binary files a/src/frameworks/UBPlatformUtils_win.cpp and b/src/frameworks/UBPlatformUtils_win.cpp differ