X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fquassel.cpp;h=cd38fd26255a7034a3fe9521fde77ebe7c396ded;hp=c60f5ec1381036cbbe0d40d88b4ca645c0140124;hb=c44ad636e50c5ad8207cc59f10866539afa8a216;hpb=4c80eeb2d07b5ca75fd399b51c939961fdff1670 diff --git a/src/common/quassel.cpp b/src/common/quassel.cpp index c60f5ec1..cd38fd26 100644 --- a/src/common/quassel.cpp +++ b/src/common/quassel.cpp @@ -23,24 +23,27 @@ #include #include #if !defined Q_OS_WIN32 && !defined Q_OS_MAC +# include +# include # include #endif #include #include #include +#include #include #include #include -#include -#include "message.h" +#include "bufferinfo.h" #include "identity.h" +#include "logger.h" +#include "message.h" #include "network.h" -#include "bufferinfo.h" -#include "types.h" +#include "protocol.h" #include "syncableobject.h" -#include "logger.h" +#include "types.h" Quassel::BuildInfo Quassel::_buildInfo; AbstractCliParser *Quassel::_cliParser = 0; @@ -194,6 +197,8 @@ void Quassel::registerMetaTypes() qRegisterMetaTypeStreamOperators("AccountId"); qRegisterMetaTypeStreamOperators("MsgId"); + qRegisterMetaType("Protocol::SessionState"); + // Versions of Qt prior to 4.7 didn't define QVariant as a meta type if (!QMetaType::type("QVariant")) { qRegisterMetaType("QVariant"); @@ -495,32 +500,15 @@ void Quassel::loadTranslation(const QLocale &locale) quasselTranslator->setObjectName("QuasselTr"); qApp->installTranslator(quasselTranslator); -#if QT_VERSION >= 0x040800 - bool success = qtTranslator->load(locale, QString("qt_%1"), translationDirPath()); +#if QT_VERSION >= 0x040800 && !defined Q_OS_MAC + bool success = qtTranslator->load(locale, QString("qt_"), translationDirPath()); if (!success) qtTranslator->load(locale, QString("qt_"), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); quasselTranslator->load(locale, QString(""), translationDirPath()); #else - QString localeName = locale.name(); - - // if the user did not specify a language in the settings, the system locale - // is used, but Qt < 4.8 does not respect language settings. This bit is - // based on QLocale::uiLanguages() as in Qt 4.8.3 - if (locale == QLocale::system()) { - // FIXME: does it make sense to set the locale to the system locale? - QLocale::setDefault(locale); - QVariant res = QSystemLocale().query(QSystemLocale::UILanguages, QVariant()); - if (!res.isNull()) { - QString newName = res.toStringList()[0]; - if (!newName.isEmpty()) { - localeName = newName.replace('-', "_"); // silly Qt. - } - } - } - - bool success = qtTranslator->load(QString("qt_%1").arg(localeName), translationDirPath()); + bool success = qtTranslator->load(QString("qt_%1").arg(locale.name()), translationDirPath()); if (!success) - qtTranslator->load(QString("qt_%1").arg(localeName), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); - quasselTranslator->load(QString("%1").arg(localeName), translationDirPath()); + qtTranslator->load(QString("qt_%1").arg(locale.name()), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); + quasselTranslator->load(QString("%1").arg(locale.name()), translationDirPath()); #endif }