- remove usage of qt3 support functions.

- undef QT3_SUPPORT until the QT3_SUPPORT-logic will be inverted.
- QLocale::system().name() returns e.g de_DE but the Qt file name is 
  qt_de.


Index: frontends/qt4/lyx_gui.C
===================================================================
--- frontends/qt4/lyx_gui.C     (revision 14043)
+++ frontends/qt4/lyx_gui.C     (working copy)
@@ -9,6 +9,8 @@
  * Full author contact details are available in file CREDITS.
  */

+#undef QT3_SUPPORT
+
 #include <config.h>

 #include "lyx_gui.h"
@@ -55,6 +57,8 @@
 #include <QEventLoop>
 #include <QTranslator>
 #include <QTextCodec>
+#include <QLocale>
+#include <QLibraryInfo>

 using lyx::support::ltrim;
 using lyx::support::package;
@@ -167,19 +171,22 @@

        // install translation file for Qt built-in dialogs
        // These are only installed since Qt 3.2.x
-       QTranslator qt_trans(0);
-       if (qt_trans.load(QString("qt_") + QTextCodec::locale(),
-                         qInstallPathTranslations())) {
+       QTranslator qt_trans;
+       QString language_name = QString("qt_") + QLocale::system().name();
+       language_name.truncate(5);
+       if (qt_trans.load(language_name,
+               QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
+       {
                qApp->installTranslator(&qt_trans);
                // even if the language calls for RtL, don't do that
-               qApp->setReverseLayout(false);
+               qApp->setLayoutDirection(Qt::LeftToRight);
                lyxerr[Debug::GUI]
                        << "Successfully installed Qt translations for locale "
-                       << QTextCodec::locale() << std::endl;
+                       << fromqstr(language_name) << std::endl;
        } else
                lyxerr[Debug::GUI]
                        << "Could not find  Qt translations for locale "
-                       << QTextCodec::locale() << std::endl;
+                       << fromqstr(language_name) << std::endl;

 /*#ifdef Q_WS_MACX
        // These translations are meant to break Qt/Mac menu merging
@@ -260,9 +267,7 @@
        // During screen update/ redraw, this method is disabled to
        // prevent keyboard events being handed to the LyX core, where
        // they could cause re-entrant calls to screen update.
-#if QT_VERSION >= 0x030100
-       qApp->processEvents(QEventLoop::ExcludeUserInput);
-#endif
+       qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
 }



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14046 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Peter Kümmel 2006-06-08 14:27:44 +00:00
parent e3784fcb6b
commit 8a552374b9

View File

@ -9,6 +9,8 @@
* Full author contact details are available in file CREDITS.
*/
#undef QT3_SUPPORT
#include <config.h>
#include "lyx_gui.h"
@ -55,6 +57,8 @@
#include <QEventLoop>
#include <QTranslator>
#include <QTextCodec>
#include <QLocale>
#include <QLibraryInfo>
using lyx::support::ltrim;
using lyx::support::package;
@ -167,19 +171,22 @@ void exec(int & argc, char * argv[])
// install translation file for Qt built-in dialogs
// These are only installed since Qt 3.2.x
QTranslator qt_trans(0);
if (qt_trans.load(QString("qt_") + QTextCodec::locale(),
qInstallPathTranslations())) {
QTranslator qt_trans;
QString language_name = QString("qt_") + QLocale::system().name();
language_name.truncate(5);
if (qt_trans.load(language_name,
QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
{
qApp->installTranslator(&qt_trans);
// even if the language calls for RtL, don't do that
qApp->setReverseLayout(false);
qApp->setLayoutDirection(Qt::LeftToRight);
lyxerr[Debug::GUI]
<< "Successfully installed Qt translations for locale "
<< QTextCodec::locale() << std::endl;
<< fromqstr(language_name) << std::endl;
} else
lyxerr[Debug::GUI]
<< "Could not find Qt translations for locale "
<< QTextCodec::locale() << std::endl;
<< fromqstr(language_name) << std::endl;
/*#ifdef Q_WS_MACX
// These translations are meant to break Qt/Mac menu merging
@ -260,9 +267,7 @@ void sync_events()
// During screen update/ redraw, this method is disabled to
// prevent keyboard events being handed to the LyX core, where
// they could cause re-entrant calls to screen update.
#if QT_VERSION >= 0x030100
qApp->processEvents(QEventLoop::ExcludeUserInput);
#endif
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
}