BrowserApplication::BrowserApplication(int &argc, char **argv, char *styleSheet,QSharedDataPointer<ProcessOptions> processOptions) : QApplication(argc, argv) , m_localServer(0) , m_privateProfile(0) , sawStyleSheetCommandLineOption(false) , nextSessionNameIndex(1) { nameTemplate = QLatin1String("domterm-%1"); QCoreApplication::setOrganizationName(QLatin1String("DomTerm")); QCoreApplication::setApplicationName(QLatin1String("QtDomTerm")); QCoreApplication::setApplicationVersion(QLatin1String(QTDOMTERM_VERSION)); QString serverName = QCoreApplication::applicationName() + QString::fromLatin1(QT_VERSION_STR).remove('.') + QLatin1String("webengine"); if (styleSheet != NULL) { m_stylesheetFilename = QString(styleSheet); sawStyleSheetCommandLineOption = true; } m_fileSystemWatcher = new QFileSystemWatcher(this); QLocalSocket socket; socket.connectToServer(serverName); if (socket.waitForConnected(500)) { QDataStream stream(&socket); stream << *processOptions; socket.waitForBytesWritten(); return; } #if defined(Q_OS_OSX) QApplication::setQuitOnLastWindowClosed(false); #else QApplication::setQuitOnLastWindowClosed(true); #endif m_localServer = new QLocalServer(this); connect(m_localServer, SIGNAL(newConnection()), this, SLOT(newLocalSocketConnection())); if (!m_localServer->listen(serverName) && m_localServer->serverError() == QAbstractSocket::AddressInUseError) { QLocalServer::removeServer(serverName); if (!m_localServer->listen(serverName)) qWarning("Could not create local socket %s.", qPrintable(serverName)); } #ifndef QT_NO_OPENSSL if (!QSslSocket::supportsSsl()) { QMessageBox::information(0, "Demo Browser", "This system does not support OpenSSL. SSL websites will not be available."); } #endif QString localSysName = QLocale::system().name(); installTranslator(QLatin1String("qt_") + localSysName); QTimer::singleShot(0, this, SLOT(postLaunch())); }
TSBrowserApplication::TSBrowserApplication(int &argc, char **argv) : QApplication(argc, argv) , m_localServer(0) , bOpenLinkInTab(false) { QCoreApplication::setOrganizationName(QLatin1String("IJAB")); QCoreApplication::setApplicationName(QLatin1String("SpeechNav")); QCoreApplication::setApplicationVersion(QLatin1String("1.0.0")); #ifdef Q_WS_QWS // Use a different server name for QWS so we can run an X11 // browser and a QWS browser in parallel on the same machine for // debugging QString serverName = QCoreApplication::applicationName() + QLatin1String("_qws"); #else QString serverName = QCoreApplication::applicationName(); #endif QLocalSocket socket; socket.connectToServer(serverName); if (socket.waitForConnected(500)) { QTextStream stream(&socket); QStringList args = QCoreApplication::arguments(); if (args.count() > 1) stream << args.last(); else stream << QString(); stream.flush(); socket.waitForBytesWritten(); return; } #if defined(Q_WS_MAC) QApplication::setQuitOnLastWindowClosed(false); #else QApplication::setQuitOnLastWindowClosed(true); #endif m_localServer = new QLocalServer(this); connect(m_localServer, SIGNAL(newConnection()), this, SLOT(newLocalSocketConnection())); if (!m_localServer->listen(serverName)) { if (m_localServer->serverError() == QAbstractSocket::AddressInUseError && QFile::exists(m_localServer->serverName())) { QFile::remove(m_localServer->serverName()); m_localServer->listen(serverName); } } #ifndef QT_NO_OPENSSL if (!QSslSocket::supportsSsl()) { QMessageBox::information(0, "SpeechNav", "This system does not support OpenSSL. SSL websites will not be available."); } #endif QDesktopServices::setUrlHandler(QLatin1String("http"), this, "openUrl"); QString localSysName = QLocale::system().name(); installTranslator(QLatin1String("qt_") + localSysName); #if defined(Q_WS_MAC) connect(this, SIGNAL(lastWindowClosed()), this, SLOT(lastWindowClosed())); #endif QTimer::singleShot(0, this, SLOT(postLaunch())); // Set logger QsLogging::Logger& logger = QsLogging::Logger::instance(); const QString sLogPath(QDir(applicationDirPath()).filePath("tsweb.log")); logFileDestination = QsLogging::DestinationFactory::MakeFileDestination(sLogPath); logger.addDestination(logFileDestination.get()); }
BrowserApplication::BrowserApplication(int &argc, char **argv) : QApplication(argc, argv) , m_localServer(0) { QCoreApplication::setOrganizationName(QLatin1String("Qt")); QCoreApplication::setApplicationName(QLatin1String("demobrowser")); QCoreApplication::setApplicationVersion(QLatin1String("0.1")); #ifdef Q_WS_QWS // Use a different server name for QWS so we can run an X11 // browser and a QWS browser in parallel on the same machine for // debugging QString serverName = QCoreApplication::applicationName() + QLatin1String("_qws"); #else QString serverName = QCoreApplication::applicationName(); #endif QLocalSocket socket; socket.connectToServer(serverName); if (socket.waitForConnected(500)) { QTextStream stream(&socket); QStringList args = QCoreApplication::arguments(); if (args.count() > 1) stream << args.last(); else stream << QString(); stream.flush(); socket.waitForBytesWritten(); return; } #if defined(Q_WS_MAC) QApplication::setQuitOnLastWindowClosed(false); #else QApplication::setQuitOnLastWindowClosed(true); #endif m_localServer = new QLocalServer(this); connect(m_localServer, SIGNAL(newConnection()), this, SLOT(newLocalSocketConnection())); if (!m_localServer->listen(serverName)) { if (m_localServer->serverError() == QAbstractSocket::AddressInUseError && QFile::exists(m_localServer->serverName())) { QFile::remove(m_localServer->serverName()); m_localServer->listen(serverName); } } #ifndef QT_NO_OPENSSL if (!QSslSocket::supportsSsl()) { QMessageBox::information(0, "Demo Browser", "This system does not support OpenSSL. SSL websites will not be available."); } #endif QDesktopServices::setUrlHandler(QLatin1String("http"), this, "openUrl"); QString localSysName = QLocale::system().name(); installTranslator(QLatin1String("qt_") + localSysName); 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 QTimer::singleShot(0, this, SLOT(postLaunch())); }
BrowserApplication::BrowserApplication(int &argc, char **argv) : QApplication(argc, argv) , m_localServer(0) { QCoreApplication::setOrganizationDomain(QLatin1String("arora-browser.org")); QCoreApplication::setApplicationName(QLatin1String("Arora")); QString version = QString("0.2 (Change: %1 %2)").arg(GITCHANGENUMBER).arg(GITVERSION); QCoreApplication::setApplicationVersion(version); #ifdef Q_WS_QWS // Use a different server name for QWS so we can run an X11 // browser and a QWS browser in parallel on the same machine for // debugging QString serverName = QCoreApplication::applicationName() + QLatin1String("_qws"); #else QString serverName = QCoreApplication::applicationName(); #endif QLocalSocket socket; socket.connectToServer(serverName); if (socket.waitForConnected(500)) { QTextStream stream(&socket); QStringList args = QCoreApplication::arguments(); if (args.count() > 1) stream << args.last(); else stream << QString(); stream.flush(); socket.waitForBytesWritten(); return; } #if defined(Q_WS_MAC) QApplication::setQuitOnLastWindowClosed(false); #else QApplication::setQuitOnLastWindowClosed(true); #endif m_localServer = new QLocalServer(this); connect(m_localServer, SIGNAL(newConnection()), this, SLOT(newLocalSocketConnection())); if (!m_localServer->listen(serverName)) { if (m_localServer->serverError() == QAbstractSocket::AddressInUseError && QFile::exists(m_localServer->serverName())) { QFile::remove(m_localServer->serverName()); m_localServer->listen(serverName); } } QDesktopServices::setUrlHandler(QLatin1String("http"), this, "openUrl"); QString localSysName = QLocale::system().name(); installTranslator(QLatin1String("qt_") + localSysName); installTranslator(dataDirectory() + QDir::separator() + "locale" + QDir::separator() + localSysName); 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 QTimer::singleShot(0, this, SLOT(postLaunch())); }