BrowserApplication::BrowserApplication(int &argc, char **argv) : SingleApplication(argc, argv) , quitting(false) { QCoreApplication::setOrganizationDomain(QLatin1String("arora-browser.org")); QCoreApplication::setApplicationName(QLatin1String("Arora")); QString version = QLatin1String("0.8.0"); QString gitVersion = QLatin1String(GITCHANGENUMBER); if (gitVersion != QLatin1String("0") && !gitVersion.isEmpty()) version += QString(QLatin1String(" (git: %1 %2)")) .arg(QLatin1String(GITCHANGENUMBER)) .arg(QLatin1String(GITVERSION)); QCoreApplication::setApplicationVersion(version); #ifndef AUTOTESTS QStringList args = QCoreApplication::arguments(); QString message = (args.count() > 1) ? parseArgumentUrl(args.last()) : QString(); if (sendMessage(message)) return; // not sure what else to do... if (!startSingleServer()) return; connect(this, SIGNAL(messageReceived(const QString &)), this, SLOT(messageReceived(const QString &))); #endif #if defined(Q_WS_MAC) QApplication::setQuitOnLastWindowClosed(false); #else QApplication::setQuitOnLastWindowClosed(true); #endif QDesktopServices::setUrlHandler(QLatin1String("http"), this, "openUrl"); // Until QtWebkit defaults to 16 QWebSettings::globalSettings()->setFontSize(QWebSettings::DefaultFontSize, 16); QWebSettings::globalSettings()->setFontSize(QWebSettings::DefaultFixedFontSize, 16); QSettings settings; settings.beginGroup(QLatin1String("sessions")); m_lastSession = settings.value(QLatin1String("lastSession")).toByteArray(); settings.endGroup(); #if defined(Q_WS_MAC) connect(this, SIGNAL(lastWindowClosed()), this, SLOT(lastWindowClosed())); #endif // setting this in the postLaunch actually takes a lot more time // because the event has to be propagated to everyone. setWindowIcon(QIcon(QLatin1String(":128x128/arora.png"))); #ifndef AUTOTESTS QTimer::singleShot(0, this, SLOT(postLaunch())); #endif languageManager(); }
BrowserApplication::BrowserApplication(int &argc, char **argv) : SingleApplication(argc, argv) , quitting(false) { QCoreApplication::setOrganizationDomain(QLatin1String("arora-browser.org")); QCoreApplication::setApplicationName(QLatin1String("Arora")); QCoreApplication::setApplicationVersion(QLatin1String("0.11.0" #ifdef GITVERSION " (Git: " GITCHANGENUMBER " " GITVERSION ")" #endif )); #ifndef AUTOTESTS connect(this, SIGNAL(messageReceived(QLocalSocket *)), this, SLOT(messageReceived(QLocalSocket *))); QStringList args = QCoreApplication::arguments(); if (args.count() > 1) { QString message = parseArgumentUrl(args.last()); sendMessage(message.toUtf8()); } // If we could connect to another Arora then exit QString message = QString(QLatin1String("aroramessage://getwinid")); if (sendMessage(message.toUtf8(), 500)) return; #ifdef BROWSERAPPLICATION_DEBUG qDebug() << "BrowserApplication::" << __FUNCTION__ << "I am the only arora"; #endif // not sure what else to do... if (!startSingleServer()) return; #endif QApplication::setQuitOnLastWindowClosed(true); QDesktopServices::setUrlHandler(QLatin1String("http"), this, "openUrl"); // Until QtWebkit defaults to 16 QWebSettings::globalSettings()->setFontSize(QWebSettings::DefaultFontSize, 16); QWebSettings::globalSettings()->setFontSize(QWebSettings::DefaultFixedFontSize, 16); QSettings settings; settings.beginGroup(QLatin1String("sessions")); m_lastSession = settings.value(QLatin1String("lastSession")).toByteArray(); settings.endGroup(); // setting this in the postLaunch actually takes a lot more time // because the event has to be propagated to everyone. setWindowIcon(QIcon(QLatin1String(":128x128/arora.png"))); #ifndef AUTOTESTS QTimer::singleShot(0, this, SLOT(postLaunch())); #endif languageManager(); }