Пример #1
0
MobileUiApplication::MobileUiApplication(int &argc, char **argv)
#ifdef HAVE_KDE
  : KApplication(),
#else
  : QApplication(argc, argv),
#endif
    Quassel(),
    _aboutToQuit(false)
{
#ifdef HAVE_KDE
  Q_UNUSED(argc); Q_UNUSED(argv);

  // We need to setup KDE's data dirs
  QStringList dataDirs = KGlobal::dirs()->findDirs("data", "");
  for(int i = 0; i < dataDirs.count(); i++)
    dataDirs[i].append("quassel/");
  dataDirs.append(":/data/");
  setDataDirPaths(dataDirs);

#else /* HAVE_KDE */

  setDataDirPaths(findDataDirPaths());

#endif /* HAVE_KDE */

#if defined(HAVE_KDE) || defined(Q_OS_MAC)
  disableCrashhandler();
#endif /* HAVE_KDE || Q_OS_MAC */
  setRunMode(Quassel::ClientOnly);

  qInstallMsgHandler(Client::logMessage);
}
Пример #2
0
QtUiApplication::QtUiApplication(int &argc, char **argv)
#ifdef HAVE_KDE4
    : KApplication(),  // KApplication is deprecated in KF5
#else
    : QApplication(argc, argv),
#endif
    Quassel(),
    _aboutToQuit(false)
{
#ifdef HAVE_KDE4
    Q_UNUSED(argc); Q_UNUSED(argv);

    // Setup KDE's data dirs
    // Because we can't use KDE stuff in (the class) Quassel directly, we need to do this here...
    QStringList dataDirs = KGlobal::dirs()->findDirs("data", "");

    // Just in case, also check our install prefix
    dataDirs << QCoreApplication::applicationDirPath() + "/../share/apps/";

    // Normalize and append our application name
    for (int i = 0; i < dataDirs.count(); i++)
        dataDirs[i] = QDir::cleanPath(dataDirs.at(i)) + "/quassel/";

    // Add resource path and just in case.
    // Workdir should have precedence
    dataDirs.prepend(QCoreApplication::applicationDirPath() + "/data/");
    dataDirs.append(":/data/");

    // Append trailing '/' and check for existence
    auto iter = dataDirs.begin();
    while (iter != dataDirs.end()) {
        if (!iter->endsWith(QDir::separator()) && !iter->endsWith('/'))
            iter->append(QDir::separator());
        if (!QFile::exists(*iter))
            iter = dataDirs.erase(iter);
        else
            ++iter;
    }

    dataDirs.removeDuplicates();
    setDataDirPaths(dataDirs);

#else /* HAVE_KDE4 */

    setDataDirPaths(findDataDirPaths());

#endif /* HAVE_KDE4 */

#if defined(HAVE_KDE4) || defined(Q_OS_MAC)
    disableCrashhandler();
#endif /* HAVE_KDE4 || Q_OS_MAC */
    setRunMode(Quassel::ClientOnly);

#if QT_VERSION < 0x050000
    qInstallMsgHandler(Client::logMessage);
#else
    qInstallMessageHandler(Client::logMessage);
#endif
}