Make sys includes POSIX-compliant
[quassel.git] / src / common / quassel.cpp
index 171bdc0..cd38fd2 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-09 by the Quassel Project                          *
+ *   Copyright (C) 2005-2013 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -15,7 +15,7 @@
  *   You should have received a copy of the GNU General Public License     *
  *   along with this program; if not, write to the                         *
  *   Free Software Foundation, Inc.,                                       *
- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
 #include "quassel.h"
 #include <iostream>
 #include <signal.h>
 #if !defined Q_OS_WIN32 && !defined Q_OS_MAC
+#  include <sys/types.h>
+#  include <sys/time.h>
 #  include <sys/resource.h>
 #endif
 
 #include <QCoreApplication>
 #include <QDateTime>
 #include <QFileInfo>
+#include <QHostAddress>
 #include <QLibraryInfo>
 #include <QSettings>
 #include <QTranslator>
-#include <QHostAddress>
 
-#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 "types.h"
 
 Quassel::BuildInfo Quassel::_buildInfo;
 AbstractCliParser *Quassel::_cliParser = 0;
@@ -193,6 +197,8 @@ void Quassel::registerMetaTypes()
     qRegisterMetaTypeStreamOperators<AccountId>("AccountId");
     qRegisterMetaTypeStreamOperators<MsgId>("MsgId");
 
+    qRegisterMetaType<Protocol::SessionState>("Protocol::SessionState");
+
     // Versions of Qt prior to 4.7 didn't define QVariant as a meta type
     if (!QMetaType::type("QVariant")) {
         qRegisterMetaType<QVariant>("QVariant");
@@ -494,10 +500,15 @@ void Quassel::loadTranslation(const QLocale &locale)
     quasselTranslator->setObjectName("QuasselTr");
     qApp->installTranslator(quasselTranslator);
 
-    QLocale::setDefault(locale);
-
+#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
     bool success = qtTranslator->load(QString("qt_%1").arg(locale.name()), translationDirPath());
     if (!success)
         qtTranslator->load(QString("qt_%1").arg(locale.name()), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
     quasselTranslator->load(QString("%1").arg(locale.name()), translationDirPath());
+#endif
 }