예제 #1
0
int main()
{
  int l;
  int h;
  int x;
  int y;

  // Ask user to input 4 integers
  cout << "Please enter 4 integers: " << endl;
  cin >> l;
  cin >> h;
  cin >> x;
  cin >> y;

  // Create "BrowserWindow" object
  BrowserWindow bw (l, h, x, y, "Chrome", "Facebook", "NY Times");

  // Call "printBrowserInformation" function
  bw.printBrowserInformation();

  // Ask the user for user for a string
  string e;
  cout << "Please enter a string value for the editor: " << endl;
  cin >> e;

  // Create "Editor" object
  Editor editor (l, h, x, y, e);

  // Call "printEditorInformation" function
  editor.printEditorInformation();
}
예제 #2
0
파일: main.cpp 프로젝트: jhj/aqp-qt5
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    app.setApplicationName(app.translate("main", "Matrix Quiz"));
#ifdef Q_WS_MAC
    app.setCursorFlashTime(0);
#endif

    qsrand(static_cast<uint>(time(0)));

    QWebSettings *webSettings = QWebSettings::globalSettings();
    webSettings->setAttribute(QWebSettings::AutoLoadImages, true);
    webSettings->setAttribute(QWebSettings::JavascriptEnabled, true);
    webSettings->setAttribute(QWebSettings::PluginsEnabled, true);

    QString url = QUrl::fromLocalFile(AQP::applicationPathOf() +
                                      "/matrixquiz.html").toString();
    BrowserWindow *browser = new BrowserWindow(url, new WebPage);
    browser->showToolBar(false);
    browser->enableActions(false);
    QDialogButtonBox *buttonBox = new QDialogButtonBox;
    QPushButton *quitButton = buttonBox->addButton(
            app.translate("main", "&Quit"),
            QDialogButtonBox::AcceptRole);
    QVBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(browser, 1);
    layout->addWidget(buttonBox);
    QDialog dialog;
    dialog.setLayout(layout);
    QObject::connect(quitButton, SIGNAL(clicked()),
                     &dialog, SLOT(accept()));
    dialog.setWindowTitle(app.applicationName());
    dialog.show();
    return app.exec();
}
예제 #3
0
void GwtCallback::openMinimalWindow(QString name,
                                    QString url,
                                    int width,
                                    int height)
{
   bool named = !name.isEmpty() && name != QString::fromUtf8("_blank");

   BrowserWindow* browser = NULL;
   if (named)
      browser = s_windowTracker.getWindow(name);

   if (!browser)
   {
      bool isViewerZoomWindow =
          (name == QString::fromUtf8("_rstudio_viewer_zoom"));

      browser = new BrowserWindow(false, !isViewerZoomWindow, name);
      browser->setAttribute(Qt::WA_DeleteOnClose);
      browser->setAttribute(Qt::WA_QuitOnClose, false);
      browser->connect(browser->webView(), SIGNAL(onCloseWindowShortcut()),
                       browser, SLOT(onCloseRequested()));
      if (named)
         s_windowTracker.addWindow(name, browser);

      // set title for viewer zoom
      if (isViewerZoomWindow)
         browser->setWindowTitle(QString::fromUtf8("Viewer Zoom"));
   }

   browser->webView()->load(QUrl(url));
   browser->resize(width, height);
   browser->show();
   browser->activateWindow();
}
예제 #4
0
int main(int argc, char** argv) {
    QApplication app(argc, argv);

    QStringList args = QApplication::arguments();
    QStringList urls = args;
    urls.removeAt(0);

    if (urls.isEmpty()) {
        QString defaultUrl = QString("file://%1/%2").arg(QDir::homePath()).arg(QLatin1String("index.html"));
        if (QDir(defaultUrl).exists())
            urls.append(defaultUrl);
        else
            urls.append("http://www.google.com");
    }

    BrowserWindow* window = new BrowserWindow();
    window->load(urls[0]);

    for (int i = 1; i < urls.size(); ++i)
        window->newWindow(urls[i]);

    app.exec();

    return 0;
}
예제 #5
0
int main(int argc, char** argv)
{
    // FIXME: We must add support for the threaded rendering as it is the default.
    qputenv("QML_NO_THREADED_RENDERER", QByteArray("1"));

    MiniBrowserApplication app(argc, argv);

    if (app.isRobotized()) {
        BrowserWindow* window = new BrowserWindow(&app.m_windowOptions);
        UrlLoader loader(window, app.urls().at(0), app.robotTimeout(), app.robotExtraTime());
        loader.loadNext();
        window->show();
        return app.exec();
    }

    QStringList urls = app.urls();

    if (urls.isEmpty()) {
        QString defaultIndexFile = QString("%1/%2").arg(QDir::homePath()).arg(QLatin1String("index.html"));
        if (QFile(defaultIndexFile).exists())
            urls.append(QString("file://") + defaultIndexFile);
        else
            urls.append("http://www.google.com");
    }

    BrowserWindow* window = new BrowserWindow(&app.m_windowOptions);
    window->load(urls.at(0));

    for (int i = 1; i < urls.size(); ++i)
        window->newWindow(urls.at(i));

    app.exec();

    return 0;
}
예제 #6
0
파일: main.cpp 프로젝트: cuijianzhu/Gaze
/*! \mainpage GazeBrowser API Documentation
 *
 * \section intro_sec Introduction
 *
 * This is the API Documentation of the GazeBrowser
 *
 * \section About GazeBrowser
 * GazeBrowser is an Application for browsing the internet with your eye movements.
 * <br/> GazeBrowser uses the GazeLib (developed by the same authors) to measure the Gaze Tracking signals.
 * This application makes heavy use of Qt, OpenCV and the GazeLib API
 *
 * \subsection Usage
 * Start the Browser, Calibrate the System and use your eyes!
 */
int main(int argc, char * argv[]) {
    QApplication app(argc, argv);

    QTranslator qtTranslator;
    qtTranslator.load("qt_" + QLocale::system().name(),
                      QLibraryInfo::location(QLibraryInfo::TranslationsPath));
    app.installTranslator(&qtTranslator);

    QTranslator myappTranslator;
    myappTranslator.load(
        //QString::fromStdString(GazeConfig::inWorkingDir("translation/gazebrowser_de")));
        "gazebrowser_" + QLocale::system().name());
    app.installTranslator(&myappTranslator);

    BrowserWindow *browser;

    // was the camera number passed as an argument?
    bool conversion_ok = false;
    int camera = 0;
    if (argc > 1) {
        camera = QString(argv[1]).toInt(&conversion_ok, 10);
        if(!conversion_ok)
            camera = 0;
    }

    browser = new BrowserWindow(camera);

    browser->showFullScreen();
    return app.exec();
}
예제 #7
0
static WKPageRef createNewPage(WKPageRef page, WKURLRequestRef request, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void* clientInfo)
{
    BrowserWindow* browserWindow = BrowserWindow::create();
    browserWindow->createWindow(0, 0, 800, 600);

    return WKViewGetPage(browserWindow->view().webView());
}
예제 #8
0
void GwtCallback::reloadViewerZoomWindow(QString url)
{
   BrowserWindow* pBrowser = s_windowTracker.getWindow(
                     QString::fromUtf8("_rstudio_viewer_zoom"));
   if (pBrowser)
      pBrowser->webView()->setUrl(url);
}
예제 #9
0
void RootView::AttachedToWindow()
{
	SetViewColor( 216,216,216 );
	mURLView->SetDivider( 40 );
	mTopView->show();
	
	AddChild( mURLView );
	AddChild( mTopView );
	AddChild( mStatusBar );

	KHTMLPart *htmlPart = new KHTMLPart( mTopView, "khtmlpart" );

	KHTMLView* pcView = htmlPart->view();
	
	BRect rect = mTopView->Bounds();
	pcView->SetResizingMode( B_FOLLOW_ALL );
	pcView->MoveTo( rect.LeftTop() );
	pcView->ResizeTo( rect.Width(), rect.Height() );
//	pcView->MakeFocus( true );
	pcView->SetTarget( BMessenger( Window() ) );
	pcView->show();
	
	BrowserWindow *bw = (BrowserWindow *)Window();
	bw->SetPart( htmlPart );
	bw->SetStatusBar( mStatusBar );
	bw->SetURLView( mURLView );
	
}
예제 #10
0
void GwtCallback::reloadZoomWindow()
{
   BrowserWindow* pBrowser = s_windowTracker.getWindow(
                     QString::fromUtf8("_rstudio_zoom"));
   if (pBrowser)
      pBrowser->webView()->reload();
}
예제 #11
0
void TabManagerWidget::itemDoubleClick(QTreeWidgetItem* item, int)
{
    if (!item) {
        return;
    }

    BrowserWindow* mainWindow = qobject_cast<BrowserWindow*>(qvariant_cast<QWidget*>(item->data(0, QupZillaPointerRole)));
    QWidget* tabWidget = qvariant_cast<QWidget*>(item->data(0, WebTabPointerRole));

    if (!mainWindow) {
        return;
    }

    if (mainWindow->isMinimized()) {
        mainWindow->showNormal();
    }
    else {
        mainWindow->show();
    }
    mainWindow->activateWindow();
    mainWindow->raise();
    mainWindow->weView()->setFocus();

    if (tabWidget && tabWidget != mainWindow->tabWidget()->currentWidget()) {
        mainWindow->tabWidget()->setCurrentIndex(mainWindow->tabWidget()->indexOf(tabWidget));
    }
}
예제 #12
0
파일: main.cpp 프로젝트: ddksaku/manitou
int main(int argc, char *argv[])
{
    Manitou manitou(argc, argv);
    BrowserWindow *browserWindow = manitou.createNewWindow();
    browserWindow->showMaximized();
    return manitou.exec();
}
예제 #13
0
int main(int argc, char *argv[])
{
#if !defined(Q_WS_S60)
    QApplication::setGraphicsSystem("raster");
#endif

    QApplication app(argc, argv);

    app.setApplicationName("Anomaly");
    app.setApplicationVersion("0.0.0");

    BrowserWindow window;
#ifdef Q_OS_SYMBIAN
    window.showFullScreen();
    QWebSettings::globalSettings()->setObjectCacheCapacities(128*1024, 1024*1024, 1024*1024);
    QWebSettings::globalSettings()->setMaximumPagesInCache(3);
#else
    window.resize(360, 640);
    window.show();
    app.setStyle("windows");
#endif

#ifdef QT_KEYPAD_NAVIGATION
    QApplication::setNavigationMode(Qt::NavigationModeCursorAuto);
#endif
    return app.exec();
}
예제 #14
0
파일: Manitou.cpp 프로젝트: ddksaku/manitou
void Manitou::onOpenTab()
{
    BrowserTab *tab = createNewTab();
    BrowserWindow *window = (BrowserWindow*) activeWindow();
    window->addTab(tab);
    window->setCurrentTab(tab);
}
예제 #15
0
static WKPageRef createNewPage(WKPageRef page, const void* clientInfo)
{
    BrowserWindow* browserWindow = BrowserWindow::create();
    browserWindow->createWindow(0, 0, 800, 600);

    return WKViewGetPage(browserWindow->view().webView());
}
예제 #16
0
KParts::ReadOnlyPart* BrowserWindow::CreateNewWindow( const std::string& cURL, const KParts::URLArgs& cURLArgs, const KParts::WindowArgs& sWndArgs )
{
	BRect cFrame( 0, 0, 799, 599 );

	BPoint cPos;
	if ( sWndArgs.x == -1 || sWndArgs.y == -1 ) {
		cPos = get_window_pos();
	}
	if ( sWndArgs.x != -1 ) {
		cPos.x = sWndArgs.x;
	}
	if ( sWndArgs.y != -1 ) {
		cPos.y  = sWndArgs.y;
	}
	if ( sWndArgs.width != -1 ) {
		cFrame.right   = cFrame.left + sWndArgs.width - 1;
	}
	if ( sWndArgs.height != -1 ) {
		cFrame.bottom  = cFrame.top + sWndArgs.height - 1;
	}
	cFrame.OffsetBy( cPos );
		
	BrowserWindow* pcNewWindow = new BrowserWindow( cFrame, false );
	if ( cURL.empty() == false ) {
		pcNewWindow->OpenURL( cURL, cURLArgs );

	}

	pcNewWindow->Show();
	return( pcNewWindow->GetPart() );
}
예제 #17
0
파일: Manitou.cpp 프로젝트: ddksaku/manitou
void Manitou::onWindowClosed(unsigned long id)
{
    BrowserWindow *window = windowsMap.value(id, 0);
    if (window) {
        windowsMap.remove(id);
        window->deleteLater();
    }
}
예제 #18
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    BrowserWindow w;
    w.show();
    
    return a.exec();
}
예제 #19
0
void
BrowserApp::_CreateNewPage(const BString& url, bool fullscreen)
{
	uint32 workspace = 1 << current_workspace();

	bool loadedInWindowOnCurrentWorkspace = false;
	for (int i = 0; BWindow* window = WindowAt(i); i++) {
		BrowserWindow* webWindow = dynamic_cast<BrowserWindow*>(window);
		if (!webWindow)
			continue;
		if (webWindow->Lock()) {
			if (webWindow->Workspaces() & workspace) {
				if (webWindow->IsBlankTab()) {
					if (url.Length() != 0)
						webWindow->CurrentWebView()->LoadURL(url);
				} else
					webWindow->CreateNewTab(url, true);
				webWindow->Activate();
				webWindow->CurrentWebView()->MakeFocus(true);
				loadedInWindowOnCurrentWorkspace = true;
			}
			webWindow->Unlock();
		}
		if (loadedInWindowOnCurrentWorkspace)
			return;
	}
	_CreateNewWindow(url, fullscreen);
}
예제 #20
0
void GwtCallback::openMinimalWindow(QString name,
                                    QString url,
                                    int width,
                                    int height)
{
   static WindowTracker windowTracker;

   bool named = !name.isEmpty() && name != QString::fromAscii("_blank");

   BrowserWindow* browser = NULL;
   if (named)
      browser = windowTracker.getWindow(name);

   if (!browser)
   {
      browser = new BrowserWindow(false, true);
      browser->setAttribute(Qt::WA_DeleteOnClose);
      browser->setAttribute(Qt::WA_QuitOnClose, false);
      browser->connect(browser->webView(), SIGNAL(onCloseWindowShortcut()),
                       browser, SLOT(onCloseRequested()));
      if (named)
         windowTracker.addWindow(name, browser);
   }

   browser->webView()->load(QUrl(url));
   browser->resize(width, height);
   browser->show();
   browser->activateWindow();
}
예제 #21
0
void Fullscreen::ToggleFullscreen() {
    // Original code in chromium > fullscreen_handler.cc > FullscreenHandler::SetFullscreenImpl:
    // http://src.chromium.org/viewvc/chrome/trunk/src/ui/views/win/fullscreen_handler.cc
    BrowserWindow* browserWindow = GetBrowserWindow(
            cefBrowser_->GetHost()->GetWindowHandle());
    if (!browserWindow) {
        LOG_ERROR << "GetBrowserWindow() failed in ToggleFullscreen()";
        return;
    }
    HWND hwnd = browserWindow->GetWindowHandle();
    if (!isFullscreen_) {
        isMaximized_ = (IsZoomed(hwnd) != 0);
        if (isMaximized_) {
            SendMessage(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
        }
        gwlStyle_ = GetWindowLong(hwnd, GWL_STYLE);
        gwlExStyle_ = GetWindowLong(hwnd, GWL_EXSTYLE);
        RECT rect;
        GetWindowRect(hwnd, &rect);
        windowRect_ = rect;
        int removeStyle, removeExStyle;
        removeStyle = WS_CAPTION | WS_THICKFRAME;
        removeExStyle = (WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE
                | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE);
        SetWindowLong(hwnd, GWL_STYLE, gwlStyle_ & ~(removeStyle));
        SetWindowLong(hwnd, GWL_EXSTYLE, gwlExStyle_ & ~(removeExStyle));
        HMONITOR monitor;
        MONITORINFO monitorInfo = {};
        monitorInfo.cbSize = sizeof(monitorInfo);
        // MONITOR_DEFAULTTONULL, MONITOR_DEFAULTTOPRIMARY, 
        // MONITOR_DEFAULTTONEAREST
        monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
        GetMonitorInfo(monitor, &monitorInfo);
        int left, top, right, bottom;
        left = monitorInfo.rcMonitor.left;
        top = monitorInfo.rcMonitor.top;
        right = monitorInfo.rcMonitor.right;
        bottom = monitorInfo.rcMonitor.bottom;
        SetWindowPos(hwnd, NULL,
                left, top, right-left, bottom-top,
                SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
    } else {
        SetWindowLong(hwnd, GWL_STYLE, gwlStyle_);
        SetWindowLong(hwnd, GWL_EXSTYLE, gwlExStyle_);
        RECT rect = windowRect_;
        SetWindowPos(hwnd, NULL, rect.left, rect.top,
                rect.right - rect.left, rect.bottom - rect.top,
                SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
        if (isMaximized_) {
            SendMessage(hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
        }
    }
    isFullscreen_ = !(isFullscreen_);
}
예제 #22
0
void Settings::OnOkPressed()
{
	try {
		BrowserWindow* browser = dynamic_cast<BrowserWindow*>(fParent);
		browser->restartUdpListener(fSbUdpPortnumber->value());
	}
	catch (const std::bad_cast& e) {
		cerr << "Settings::OnPressed: " << e.what()<< endl;
	}
	this->close();
}
예제 #23
0
void DownloadItem::goToDownloadPage()
{
    BrowserWindow* qz = mApp->getWindow();

    if (qz) {
        qz->tabWidget()->addView(m_downloadPage, Qz::NT_SelectedTab);
    }
    else {
        mApp->createWindow(Qz::BW_NewWindow, m_downloadPage);
    }
}
예제 #24
0
void BrowserWindow::CreateNewWindow( const std::string& cURL, const KParts::URLArgs& cURLArgs )
{
	BRect cFrame( 0, 0, 799, 599 );

	cFrame.OffsetBy( get_window_pos() );

	BrowserWindow* pcNewWindow = new BrowserWindow( cFrame, false );
	if ( cURL.empty() == false ) {
		pcNewWindow->OpenURL( cURL, cURLArgs );
	}

	pcNewWindow->Show();
}
bool MiniBrowserApplication::notify(QObject* target, QEvent* event)
{
    // We try to be smart, if we received real touch event, we are probably on a device
    // with touch screen, and we should not have touch mocking.

    if (!event->spontaneous() || m_realTouchEventReceived || !m_windowOptions.touchMockingEnabled())
        return QGuiApplication::notify(target, event);

    if (isTouchEvent(event)) {
        if (m_pendingFakeTouchEventCount)
            --m_pendingFakeTouchEventCount;
        else
            m_realTouchEventReceived = true;
        return QGuiApplication::notify(target, event);
    }

    BrowserWindow* browserWindow = qobject_cast<BrowserWindow*>(target);
    if (!browserWindow)
        return QGuiApplication::notify(target, event);

    m_holdingControl = QGuiApplication::keyboardModifiers().testFlag(Qt::ControlModifier);

    // In QML events are propagated through parents. But since the WebView
    // may consume key events, a shortcut might never reach the top QQuickItem.
    // Therefore we are checking here for shortcuts.
    if (event->type() == QEvent::KeyPress) {
        QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
        if ((keyEvent->key() == Qt::Key_R && keyEvent->modifiers() == Qt::ControlModifier) || keyEvent->key() == Qt::Key_F5) {
            browserWindow->reload();
            return true;
        }
        if ((keyEvent->key() == Qt::Key_L && keyEvent->modifiers() == Qt::ControlModifier) || keyEvent->key() == Qt::Key_F6) {
            browserWindow->focusAddressBar();
            return true;
        }
        if ((keyEvent->key() == Qt::Key_F && keyEvent->modifiers() == Qt::ControlModifier) || keyEvent->key() == Qt::Key_F3) {
            browserWindow->toggleFind();
            return true;
        }
    }

    if (event->type() == QEvent::KeyRelease && static_cast<QKeyEvent*>(event)->key() == Qt::Key_Control) {
        foreach (int id, m_heldTouchPoints)
            if (m_touchPoints.contains(id) && !QGuiApplication::mouseButtons().testFlag(Qt::MouseButton(id))) {
                m_touchPoints[id].setState(Qt::TouchPointReleased);
                m_heldTouchPoints.remove(id);
            } else
                m_touchPoints[id].setState(Qt::TouchPointStationary);

        sendTouchEvent(browserWindow, m_heldTouchPoints.isEmpty() ? QEvent::TouchEnd : QEvent::TouchUpdate, static_cast<QKeyEvent*>(event)->timestamp());
    }
예제 #26
0
QString WebPage::viewerUrl()
{
   if (viewerUrl_.isEmpty())
   {
      // if we don't know the viewer URL ourselves but we're a child window, ask our parent
      BrowserWindow *parent = dynamic_cast<BrowserWindow*>(view()->window());
      if (parent != nullptr && parent->opener() != nullptr)
      {
         return parent->opener()->viewerUrl();
      }
   }

   // return our own viewer URL
   return viewerUrl_;
}
예제 #27
0
void
BrowserApp::_CreateNewWindow(const BString& url, bool fullscreen)
{
	// Offset the window frame unless this is the first window created in the
	// session.
	if (fWindowCount > 0)
		fLastWindowFrame.OffsetBy(20, 20);
	if (!BScreen().Frame().Contains(fLastWindowFrame))
		fLastWindowFrame.OffsetTo(50, 50);

	BrowserWindow* window = new BrowserWindow(fLastWindowFrame, fSettings,
		url);
	if (fullscreen)
		window->ToggleFullscreen();
	window->Show();
}
    virtual void onNavigationRequested(Window *win, URLString newUrl,
                                       URLString referrer, bool isNewWindow,
                                       bool &cancelDefaultAction)
	{
		WindowDelegate::onNavigationRequested(win,newUrl,referrer,isNewWindow,cancelDefaultAction);
		m_owner->__FIRE_OnNavigationRequested(m_owner,newUrl.data(),referrer.data(),isNewWindow);
	}
예제 #29
0
파일: Manitou.cpp 프로젝트: ddksaku/manitou
BrowserWindow* Manitou::createNewWindow(const QUrl &url)
{
    BrowserWindow *window = new BrowserWindow(windowsSequence);
    windowsMap.insert(windowsSequence++, window);
    connect(window, SIGNAL(windowClosed(unsigned long)), SLOT(onWindowClosed(unsigned long)));

    BrowserTab *tab = createNewTab(url);
    window->addTab(tab);

    BrowserWindow *activeWindow = (BrowserWindow*) Manitou::activeWindow();
    if (activeWindow) {
        window->setWindowState(activeWindow->windowState());
    }

    return window;
}
예제 #30
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    app.setApplicationName("Anomaly");
    app.setApplicationVersion("0.0.0");

    BrowserWindow window;
    window.resize(360, 640);
    window.show();
    app.setStyle("windows");

#ifdef QT_KEYPAD_NAVIGATION
    QApplication::setNavigationMode(Qt::NavigationModeCursorAuto);
#endif
    return app.exec();
}