Peter Kümmel wrote:
> Georg Baum wrote:
>>> -       QTranslator qt_trans(0);
>>> -       if (qt_trans.load(QString("qt_") + QTextCodec::locale(),
>>> -                         qInstallPathTranslations())) {
>>> +       static QTranslator qt_trans;
>> Why do you make this static? Does it work if you remove the static
>> qualifier?
> 
> Yesterday it was static, but removing static doesn't help, still the
> infinite loop.
> 

This fixes it, then also the static QTranslator makes no problem,
and it would be hard to forbid all static Qt objects.

Could I at least check in the translator stuff, because
at the current state lyx will not even start?



$ svn diff -rHEAD

Index: frontends/qt4/lyx_gui.C
===================================================================
--- frontends/qt4/lyx_gui.C     (revision 14038)
+++ frontends/qt4/lyx_gui.C     (working copy)
@@ -55,6 +55,8 @@
 #include <QEventLoop>
 #include <QTranslator>
 #include <QTextCodec>
+#include <QLocale>
+#include <QLibraryInfo>

 using lyx::support::ltrim;
 using lyx::support::package;
@@ -74,6 +76,7 @@
 using std::string;


+
 extern BufferList bufferlist;

 // FIXME: wrong place !
@@ -157,29 +160,34 @@

 bool use_gui = true;

+boost::scoped_ptr<LQApplication> auto_del_app;

 void exec(int & argc, char * argv[])
 {
        // Force adding of font path _before_ QApplication is initialized
        FontLoader::initFontPath();

-       LQApplication app(argc, argv);
+       auto_del_app.reset(new LQApplication(argc, 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;
+                       << language_name.toStdString().c_str() << std::endl;
        } else
                lyxerr[Debug::GUI]
                        << "Could not find  Qt translations for locale "
-                       << QTextCodec::locale() << std::endl;
+                       << language_name.toStdString().c_str() << std::endl;

 /*#ifdef Q_WS_MACX
        // These translations are meant to break Qt/Mac menu merging

Reply via email to