BrowserWindow::BrowserWindow(Qz::BrowserWindowType type, const QUrl &startUrl) : QMainWindow(0) , m_startUrl(startUrl) , m_windowType(type) , m_startTab(0) , m_sideBarManager(new SideBarManager(this)) , m_statusBarMessage(new StatusBarMessage(this)) , m_hideNavigationTimer(0) { setObjectName("mainwindow"); setAttribute(Qt::WA_DeleteOnClose); setWindowTitle(tr("QupZilla")); setProperty("private", mApp->isPrivate()); setupUi(); setupMenu(); m_hideNavigationTimer = new QTimer(this); m_hideNavigationTimer->setInterval(1000); m_hideNavigationTimer->setSingleShot(true); connect(m_hideNavigationTimer, SIGNAL(timeout()), this, SLOT(hideNavigationSlot())); connect(mApp, SIGNAL(settingsReloaded()), this, SLOT(loadSettings())); QTimer::singleShot(0, this, SLOT(postLaunch())); if (mApp->isPrivate()) { QzTools::setWmClass("QupZilla Browser (Private Window)", this); } else { QzTools::setWmClass("QupZilla Browser", this); } }
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(); }
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())); }
MainWindow::MainWindow() : KXmlGuiWindow() , m_view(new MainView(this)) , m_findBar(new FindBar(this)) , m_zoomBar(new ZoomBar(this)) , m_historyPanel(0) , m_bookmarksPanel(0) , m_webInspectorPanel(0) , m_analyzerPanel(0) , m_historyBackMenu(0) , m_encodingMenu(new KMenu(this)) , m_bookmarksBar(0) , m_popup(new KPassivePopup(this)) , m_hidePopup(new QTimer(this)) , m_toolsMenu(0) { // creating a centralWidget containing panel, m_view and the hidden findbar QWidget *centralWidget = new QWidget; centralWidget->setContentsMargins(0, 0, 0, 0); // setting layout QVBoxLayout *layout = new QVBoxLayout; layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(m_view); layout->addWidget(m_findBar); layout->addWidget(m_zoomBar); centralWidget->setLayout(layout); // central widget setCentralWidget(centralWidget); // setting size policies setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); // then, setup our actions setupActions(); // setting Panels setupPanels(); // setting up rekonq tools setupTools(); // setting up rekonq toolbar(s) setupToolbars(); // a call to KXmlGuiWindow::setupGUI() populates the GUI // with actions, using KXMLGUI. // It also applies the saved mainwindow settings, if any, and ask the // mainwindow to automatically save settings if changed: window size, // toolbar position, icon size, etc. setupGUI(); // no menu bar in rekonq: we have other plans.. menuBar()->setVisible(false); // no more status bar.. setStatusBar(0); // give me some time to do all the other stuffs... QTimer::singleShot(100, this, SLOT(postLaunch())); kDebug() << "MainWindow ctor...DONE"; }