Exemplo n.º 1
0
Tab::Tab(const QUrl& url, QWidget* parent) : QWidget(parent) {
  _webView = new WebView(url, this);
  _toolBar = new ToolBar(_webView->history(), url, this);
  _searchBar = new SearchBar(this);
  _statusBar = new StatusBar(this);
  
  _layout = new QVBoxLayout(this);
  _layout->setMargin(0);
  _layout->setSpacing(0);
  _layout->addWidget(_toolBar,    0);
  _layout->addWidget(_webView,    1);
  _layout->addWidget(_searchBar,  0);
  _layout->addWidget(_statusBar,  0);

  _showSearchShortcut = new QShortcut(QKeySequence::Find, this);
  _focusAddressShortcut = new QShortcut(Qt::Key_F6, this);

  _searchBar->hide();

  connect(_toolBar, SIGNAL(goBackRequested()), _webView, SLOT(back()));
  connect(_toolBar, SIGNAL(goForwardRequested()), _webView, SLOT(forward()));
  connect(_toolBar, SIGNAL(reloadRequested()), _webView, SLOT(reload()));
  connect(_toolBar, SIGNAL(stopRequested()), _webView, SLOT(stop()));
  connect(_toolBar, SIGNAL(loadRequested(const QUrl&)), _webView, SLOT(setFocus()));
  connect(_toolBar, SIGNAL(loadRequested(const QUrl&)), _webView, SLOT(load(const QUrl&)));
  connect(_webView, SIGNAL(urlChanged(const QUrl&)), _toolBar, SLOT(setUrl(const QUrl&)));
  connect(_webView, SIGNAL(urlChanged(const QUrl&)), _toolBar, SLOT(updateActions()));
  connect(_webView, SIGNAL(loadStarted()), _toolBar, SLOT(enableStopAction()));
  connect(_webView, SIGNAL(loadFinished(bool)), _toolBar, SLOT(disableStopAction()));
  connect(_webView, SIGNAL(titleChanged(const QString&)), this, SLOT(updateTitle()));
  connect(_webView, SIGNAL(iconChanged()), this, SLOT(updateIcon()));
  connect(_searchBar, SIGNAL(searchDataChanged(const QString&, bool, bool)), _webView,
        SLOT(find(const QString&, bool, bool)));
  connect(_searchBar, SIGNAL(closeRequested()), _searchBar, SLOT(hide()));
  connect(_searchBar, SIGNAL(closeRequested()), _webView, SLOT(setFocus()));
  connect(_webView->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)),
        _statusBar, SLOT(showMessage(const QString&)));
  connect(_webView, SIGNAL(loadProgress(int)), _statusBar->progressBar(), SLOT(setValue(int)));
  connect(_statusBar->slider(), SIGNAL(valueChanged(int)), _webView, SLOT(setZoom(int)));
  connect(_showSearchShortcut, SIGNAL(activated()), _searchBar, SLOT(show()));
  connect(_focusAddressShortcut, SIGNAL(activated()), _toolBar->addressBar(), SLOT(setFocus()));
}
Exemplo n.º 2
0
void WebBrowser::createConnections() {
  connect(m_webView, &WebViewer::messageStatusChangeRequested, this, &WebBrowser::receiveMessageStatusChangeRequest);

  connect(m_txtLocation,SIGNAL(submitted(QString)), this, SLOT(loadUrl(QString)));
  connect(m_webView, SIGNAL(urlChanged(QUrl)), this, SLOT(updateUrl(QUrl)));

  // Connect this WebBrowser to global TabWidget.
  //TabWidget *tab_widget = qApp->mainForm()->tabWidget();
  //connect(m_webView, SIGNAL(newTabRequested()), tab_widget, SLOT(addEmptyBrowser()));
  //connect(m_webView, SIGNAL(linkMiddleClicked(QUrl)), tab_widget, SLOT(addLinkedBrowser(QUrl)));

  // Change location textbox status according to webpage status.
  connect(m_webView, SIGNAL(loadStarted()), this, SLOT(onLoadingStarted()));
  connect(m_webView, SIGNAL(loadProgress(int)), this, SLOT(onLoadingProgress(int)));
  connect(m_webView, SIGNAL(loadFinished(bool)), this, SLOT(onLoadingFinished(bool)));

  // Forward title/icon changes.
  connect(m_webView, SIGNAL(titleChanged(QString)), this, SLOT(onTitleChanged(QString)));
  connect(m_webView, SIGNAL(iconChanged(QIcon)), this, SLOT(onIconChanged(QIcon)));
}
Exemplo n.º 3
0
WebView::WebView(QWidget* parent) : QWebView(parent), possibleDragging(false), isLoading_(false)
{

    settings()->setAttribute(QWebSettings::JavaEnabled, false);
    settings()->setAttribute(QWebSettings::PluginsEnabled, false);
	settings()->setAttribute(QWebSettings::LocalStorageEnabled, false);
	settings()->setMaximumPagesInCache( 0 );
	settings()->setObjectCacheCapacities( 0, 0, 0 );
	settings()->clearMemoryCaches( );
	setAcceptDrops(false);

	page()->setNetworkAccessManager(NetworkAccessManager::instance());
    page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);

	connect(page(), SIGNAL(linkClicked(const QUrl&)), this, SLOT(linkClickedEvent(const QUrl&)));
	connect(page()->action(QWebPage::Copy), SIGNAL(triggered()), SLOT(textCopiedEvent()));
	connect(page()->action(QWebPage::Cut), SIGNAL(triggered()), SLOT(textCopiedEvent()));
	connect(page(), SIGNAL(loadStarted()), this, SLOT(loadStartedEvent()));
	connect(page(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinishedEvent(bool)));
}
Exemplo n.º 4
0
void WebTab::createPreviewSelectorBar(int index)
{
    if (m_previewSelectorBar.isNull())
    {
        m_previewSelectorBar = new PreviewSelectorBar(index, this);
        qobject_cast<QVBoxLayout *>(layout())->insertWidget(0, m_previewSelectorBar.data());
        m_previewSelectorBar.data()->animatedShow();
    }
    else
    {
        disconnect(m_previewSelectorBar.data());
        m_previewSelectorBar.data()->setIndex(index);
        m_previewSelectorBar.data()->animatedHide();
    }

    connect(this, SIGNAL(loadStarted()),      m_previewSelectorBar.data(), SLOT(loadProgress()), Qt::UniqueConnection);
    connect(this, SIGNAL(loadProgress(int)),  m_previewSelectorBar.data(), SLOT(loadProgress()), Qt::UniqueConnection);
    connect(this, SIGNAL(loadFinished(bool)), m_previewSelectorBar.data(), SLOT(loadFinished()), Qt::UniqueConnection);
    connect(this, SIGNAL(urlChanged(QUrl)),   m_previewSelectorBar.data(), SLOT(verifyUrl()),    Qt::UniqueConnection);
}
Exemplo n.º 5
0
int LLWebPage::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWebPage::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: loadProgressSlot((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: statusBarMessageSlot((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 2: titleChangedSlot((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 3: urlChangedSlot((*reinterpret_cast< const QUrl(*)>(_a[1]))); break;
        case 4: loadStarted(); break;
        case 5: loadFinished((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 6: extendNavigatorObject(); break;
        default: ;
        }
        _id -= 7;
    }
    return _id;
}
Exemplo n.º 6
0
SecondaryWindow::SecondaryWindow(QUrl baseUrl, QWidget* pParent) :
    BrowserWindow(true, true, baseUrl, pParent)
{
   setAttribute(Qt::WA_QuitOnClose, false);
   setAttribute(Qt::WA_DeleteOnClose, true);

#ifdef Q_WS_MACX
   setIconSize(QSize(26, 22));
#else
   setIconSize(QSize(26, 20));
#endif

   back_ = pToolbar_->addAction(icon("back"), QString::fromUtf8("Back"));
   back_->setToolTip(QString::fromUtf8("Back"));
   connect(back_, SIGNAL(triggered()),
           webView(), SLOT(back()));

   forward_ = pToolbar_->addAction(icon("forward"), QString::fromUtf8("Forward"));
   forward_->setToolTip(QString::fromUtf8("Forward"));
   connect(forward_, SIGNAL(triggered()),
           webView(), SLOT(forward()));

   reload_ = pToolbar_->addAction(icon("reload"), QString::fromUtf8("Reload"));
   reload_->setToolTip(QString::fromUtf8("Reload"));
   connect(reload_, SIGNAL(triggered()),
           webView(), SLOT(reload()));

   print_ = pToolbar_->addAction(icon("print"), QString::fromUtf8("Print"));
   print_->setToolTip(QString::fromUtf8("Print"));
   connect(print_, SIGNAL(triggered()),
           this, SLOT(print()));

   history_ = webView()->history();

   connect(webView(), SIGNAL(loadStarted()),
           this, SLOT(manageCommandState()));
   connect(webView(), SIGNAL(urlChanged(QUrl)),
           this, SLOT(manageCommandState()));

   manageCommandState();
}
Exemplo n.º 7
0
ShibbolethWebView::ShibbolethWebView(AccountPtr account, QWidget* parent)
    : QWebView(parent)
    , _account(account)
    , _accepted(false)
    , _cursorOverriden(false)
{
    // no minimize
    setWindowFlags(Qt::Dialog);
    setAttribute(Qt::WA_DeleteOnClose);

    QWebPage* page = new QWebPage(this);
    connect(page, SIGNAL(loadStarted()),
            this, SLOT(slotLoadStarted()));
    connect(page, SIGNAL(loadFinished(bool)),
            this, SLOT(slotLoadFinished(bool)));

    // Make sure to accept the same SSL certificate issues as the regular QNAM we use for syncing
    QObject::connect(page->networkAccessManager(), SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)),
            _account.data(), SLOT(slotHandleSslErrors(QNetworkReply*,QList<QSslError>)));

    // The Account keeps ownership of the cookie jar, it must outlive this webview.
    account->lendCookieJarTo(page->networkAccessManager());
    connect(page->networkAccessManager()->cookieJar(),
            SIGNAL(newCookiesForUrl (QList<QNetworkCookie>, QUrl)),
            this, SLOT(onNewCookiesForUrl (QList<QNetworkCookie>, QUrl)));
    page->mainFrame()->load(account->url());
    this->setPage(page);
    setWindowTitle(tr("%1 - Authenticate").arg(Theme::instance()->appNameGUI()));

    // If we have a valid cookie, it's most likely expired. We can use this as
    // as a criteria to tell the user why the browser window pops up
    QNetworkCookie shibCookie = ShibbolethCredentials::findShibCookie(_account.data(), ShibbolethCredentials::accountCookies(_account.data()));
    if (shibCookie != QNetworkCookie()) {
        Logger::instance()->postOptionalGuiLog(tr("Reauthentication required"), tr("Your session has expired. You need to re-login to continue to use the client."));
    }

    ConfigFile config;
    QSettings settings(config.configFile());
    resize(900, 700); // only effective the first time, later overridden by restoreGeometry
    restoreGeometry(settings.value(ShibbolethWebViewGeometryC).toByteArray());
}
Exemplo n.º 8
0
WebView::WebView(QWidget* parent)
    : QWebView(parent)
    , m_currentZoom(100)
    , m_isLoading(false)
    , m_progress(0)
    , m_clickedFrame(0)
    , m_actionsHaveImages(false)
{
    connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()));
    connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
    connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished()));

    connect(this, SIGNAL(iconChanged()), this, SLOT(slotIconChanged()));

    // Zoom levels same as in firefox
    m_zoomLevels << 30 << 50 << 67 << 80 << 90 << 100 << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300;

    qApp->installEventFilter(this);

    mApp->plugins()->emitWebViewCreated(this);
}
Exemplo n.º 9
0
PopupWebPage::PopupWebPage(QWebPage::WebWindowType type, QupZilla* mainClass)
    : WebPage(mainClass)
    , p_QupZilla(mainClass)
    , m_type(type)
    , m_createNewWindow(false)
    , m_menuBarVisible(false)
    , m_statusBarVisible(false)
    , m_toolBarVisible(false)
    , m_isLoading(false)
    , m_progress(0)
{
    connect(this, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(slotGeometryChangeRequested(QRect)));
    connect(this, SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SLOT(slotMenuBarVisibilityChangeRequested(bool)));
    connect(this, SIGNAL(toolBarVisibilityChangeRequested(bool)), this, SLOT(slotToolBarVisibilityChangeRequested(bool)));
    connect(this, SIGNAL(statusBarVisibilityChangeRequested(bool)), this, SLOT(slotStatusBarVisibilityChangeRequested(bool)));

    connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()));
    connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
    connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished(bool)));

    QTimer::singleShot(0, this, SLOT(checkBehaviour()));
}
Exemplo n.º 10
0
WebBox::WebBox ()
{
  showFrame = true;
  reloadOn = false;
  reloadSecs = 0;  // 1 day
  pApp = 0;
  uaList = 0;
  defaultWinFlags = this->windowFlags();
  effectiveUrl = QUrl("");
  
  setupUi (this);
  thePage = new MiniPage (this);
  webView->setPage (thePage) ;
  loadingLabel->hide ();
  failedLabel->hide ();
  
  InitUserMenu ();
  InitSettingsMenu ();
  MakeShortcuts ();
  DisableNewUrl ();
  DisableSettings ();
  agentMenu->hide();
  
  reloadTimer.setParent (this);
  reloadTimer.stop ();
  
  connect (theButton, SIGNAL ( clicked ()), this, SLOT ( UserWantsSomething()));
  connect (webView, SIGNAL ( loadFinished (bool)),
           this, SLOT ( LoadDone (bool)));
  connect (webView, SIGNAL ( loadStarted ()), 
           this, SLOT ( LoadStarted ()));
  connect (agentMenu, SIGNAL ( UserAgentChange (const UserAgent)),
            this, SLOT ( SetAgent (const UserAgent)));
  connect (agentMenu, SIGNAL ( UserAgentNew ()),
           newAgent, SLOT ( EditNew ()));
  connect (agentMenu, SIGNAL ( UserAgentEdit ( const QString )),
           newAgent, SLOT ( EditAgent (const QString )));
  
}
Exemplo n.º 11
0
AuthenticationDialog::AuthenticationDialog(QWidget *parent)
    : QDialog(parent)
    , d(new Private)
{
    d->displayMode = QStringLiteral("page");

    setWindowTitle(i18nc("@title:window", "Authenticate with VKontakte"));
    setAttribute(Qt::WA_DeleteOnClose, true);

    QWidget *progressWidget = new QWidget(this);
    QHBoxLayout *progressLayout = new QHBoxLayout(progressWidget);
    progressLayout->setContentsMargins(QMargins());
    d->webView = new KWebView(this);

    d->progressBar = new QProgressBar(this);
    d->progressBar->setRange(0, 100);
    QLabel *progressLabel = new QLabel(i18n("Loading Page:"), this);
    progressLayout->addWidget(progressLabel);
    progressLayout->addWidget(d->progressBar);

    // Buttons
    QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel, this);
    connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);

    // Layout
    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->addWidget(progressWidget);
    layout->addWidget(d->webView);
    layout->addWidget(buttonBox);
    setLayout(layout);


    connect(buttonBox, &QDialogButtonBox::rejected, this, &AuthenticationDialog::canceled);
    connect(d->webView, SIGNAL(urlChanged(QUrl)), this, SLOT(urlChanged(QUrl)));
    connect(d->webView, SIGNAL(loadStarted()), progressWidget, SLOT(show()));
    connect(d->webView, SIGNAL(loadFinished(bool)), progressWidget, SLOT(hide()));
    connect(d->webView, SIGNAL(loadProgress(int)), d->progressBar, SLOT(setValue(int)));
    connect(d->webView, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));
}
Exemplo n.º 12
0
void PopupWebPage::checkBehaviour()
{
    // If menubar/statusbar/toolbar visibility is explicitly set in window.open call,
    // at least one of those variables will be false.
    // If so, we should open new window.
    // But not when all visibilities are false, it occurs with target=_blank links

    if (!m_createNewWindow && (!m_menuBarVisible || !m_statusBarVisible || !m_toolBarVisible)
            && !(!m_menuBarVisible && !m_statusBarVisible && !m_toolBarVisible)) {
        m_createNewWindow = true;
    }

    if (m_createNewWindow) {
        PopupWebView* view = new PopupWebView;
        view->setWebPage(this);

        PopupWindow* popup = new PopupWindow(view);
        popup->setWindowGeometry(m_geometry);
        popup->setMenuBarVisibility(m_menuBarVisible);
        popup->setStatusBarVisibility(m_statusBarVisible);
        popup->setToolBarVisibility(m_toolBarVisible);
        popup->show();

        if (m_isLoading) {
            view->fakeLoadingProgress(m_progress);
        }

        p_QupZilla->addDeleteOnCloseWidget(popup);

        disconnect(this, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(slotGeometryChangeRequested(QRect)));
        disconnect(this, SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SLOT(slotMenuBarVisibilityChangeRequested(bool)));
        disconnect(this, SIGNAL(toolBarVisibilityChangeRequested(bool)), this, SLOT(slotToolBarVisibilityChangeRequested(bool)));
        disconnect(this, SIGNAL(statusBarVisibilityChangeRequested(bool)), this, SLOT(slotStatusBarVisibilityChangeRequested(bool)));

        disconnect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()));
        disconnect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
        disconnect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished(bool)));
    }
    else {
PanelFirmware::PanelFirmware(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::PanelFirmware)
{
    ui->setupUi(this);
    scroll = false;
    upload = new QProcess(this);
    connect(this, SIGNAL(initializePanel(QMap<QString,QString>)), this, SLOT(initialize(QMap<QString,QString>)));
    connect(this, SIGNAL(messageIn(QByteArray)), this, SLOT(parseMessage(QByteArray)));
    connect(this, SIGNAL(connectionState(bool)), this, SLOT(updateConnectionState(bool)));
    connect(upload, SIGNAL(readyReadStandardOutput()), this, SLOT(printConsole()));
    connect(upload, SIGNAL(readyReadStandardError()), this, SLOT(printErrors()));
    connect(ui->webView->page(), SIGNAL(loadStarted()), this, SLOT(startFirmwareUpload()));
    connect(ui->webView->page(), SIGNAL(loadProgress(int)), this, SLOT(scrollToBottom(int)));
    connect(ui->webView->page(), SIGNAL(loadFinished(bool)), this, SLOT(downloadFirmware(bool)));
    connect(&networkManager, SIGNAL(finished(QNetworkReply *)), this, SLOT(firmwareDownloaded(QNetworkReply*)));

    QFont consoleFont = ui->console->font();
    consoleFont.setPointSize(12);
    ui->console->setFont(consoleFont);
    ui->console->append("To return the board it's default factory configuration, select the Bootloader button.  To upload existing firmware, select the Firmware button.\n\nTo create and upload new firmware, complete the selections below.  You will need to be connected to the internet for this feature.");
}
Exemplo n.º 14
0
WebView::WebView(QWidget* parent)
    : QWebView(parent)
    , m_currentZoom(100)
    , m_isLoading(false)
    , m_progress(0)
    , m_clickedFrame(0)
    , m_page(0)
    , m_actionReload(0)
    , m_actionStop(0)
    , m_actionsInitialized(false)
    , m_disableTouchMocking(false)
{
    connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()));
    connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
    connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished()));
    connect(this, SIGNAL(iconChanged()), this, SLOT(slotIconChanged()));
    connect(this, SIGNAL(urlChanged(QUrl)), this, SLOT(slotUrlChanged(QUrl)));

    // Zoom levels same as in firefox
    m_zoomLevels << 30 << 50 << 67 << 80 << 90 << 100 << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300;

    installEventFilter(this);
}
Exemplo n.º 15
0
HelpWebView::HelpWebView(IEditorSite::Pointer editorSite, QWidget *parent, qreal zoom)
  : QWebView(parent)
  //, parentWidget(parent)
  , m_LoadFinished(false)
  , m_HelpEngine(HelpPluginActivator::getInstance()->getQHelpEngine())
{
  setAcceptDrops(false);

  setPage(new HelpPage(editorSite, parent));

  page()->setNetworkAccessManager(new HelpNetworkAccessManager(this));

  QAction* action = pageAction(QWebPage::OpenLinkInNewWindow);
  action->setText(tr("Open Link in New Tab"));
  if (!parent)
    action->setVisible(false);

  pageAction(QWebPage::DownloadLinkToDisk)->setVisible(false);
  pageAction(QWebPage::DownloadImageToDisk)->setVisible(false);
  pageAction(QWebPage::OpenImageInNewWindow)->setVisible(false);

  connect(pageAction(QWebPage::Copy), SIGNAL(changed()), this,
          SLOT(actionChanged()));
  connect(pageAction(QWebPage::Back), SIGNAL(changed()), this,
          SLOT(actionChanged()));
  connect(pageAction(QWebPage::Forward), SIGNAL(changed()), this,
          SLOT(actionChanged()));
  connect(page(), SIGNAL(linkHovered(QString,QString,QString)), this,
          SIGNAL(highlighted(QString)));
  connect(this, SIGNAL(urlChanged(QUrl)), this, SIGNAL(sourceChanged(QUrl)));
  connect(this, SIGNAL(loadStarted()), this, SLOT(setLoadStarted()));
  connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setLoadFinished(bool)));
  connect(page(), SIGNAL(printRequested(QWebFrame*)), this, SIGNAL(printRequested()));

  setFont(viewerFont());
  setTextSizeMultiplier(zoom == 0.0 ? 1.0 : zoom);
}
Exemplo n.º 16
0
WebView::WebView(QWidget *parent)
    : QWebView(parent)
    , m_progress(0)
    , m_currentZoom(100)
    , m_page(new WebPage(this))
#ifdef WEBKIT_TRUNK
    , m_enableAccessKeys(true)
    , m_accessKeysPressed(false)
#endif
{
    setPage(m_page);
    connect(page(), SIGNAL(statusBarMessage(const QString&)),
            SLOT(setStatusBarText(const QString&)));
    connect(this, SIGNAL(loadProgress(int)),
            this, SLOT(setProgress(int)));
    connect(this, SIGNAL(loadFinished(bool)),
            this, SLOT(loadFinished()));
    connect(page(), SIGNAL(aboutToLoadUrl(const QUrl &)),
            this, SIGNAL(urlChanged(const QUrl &)));
    connect(page(), SIGNAL(downloadRequested(const QNetworkRequest &)),
            this, SLOT(downloadRequested(const QNetworkRequest &)));
    connect(BrowserApplication::instance(), SIGNAL(zoomTextOnlyChanged(bool)),
            this, SLOT(applyZoom()));
    page()->setForwardUnsupportedContent(true);
    setAcceptDrops(true);

    // the zoom values (in percent) are chosen to be like in Mozilla Firefox 3
    m_zoomLevels << 30 << 50 << 67 << 80 << 90;
    m_zoomLevels << 100;
    m_zoomLevels << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300;
#if QT_VERSION >= 0x040600 || defined(WEBKIT_TRUNK)
    connect(m_page, SIGNAL(loadStarted()),
            this, SLOT(hideAccessKeys()));
    connect(m_page, SIGNAL(scrollRequested(int, int, const QRect &)),
            this, SLOT(hideAccessKeys()));
#endif
}
Exemplo n.º 17
0
WebView::WebView(QWidget* parent) :
#ifdef WEBENGINE
    QWebEngineView(parent),
#else
    QWebView(parent),
#endif
    possibleDragging(false),
    isLoading_(false)
{
	setAcceptDrops(false);

#ifdef WEBENGINE
    settings()->setAttribute(QWebEngineSettings::PluginsEnabled, false);
	settings()->setAttribute(QWebEngineSettings::LocalStorageEnabled, false);
	// TODO cache cotrol
	// TODO network request interception
	// Review ink delegation (in other words all local links on page should work)

	connect(page()->action(QWebEnginePage::Copy), SIGNAL(triggered()), SLOT(textCopiedEvent()));
	connect(page()->action(QWebEnginePage::Cut), SIGNAL(triggered()), SLOT(textCopiedEvent()));
#else
	settings()->setAttribute(QWebSettings::JavaEnabled, false);
    settings()->setAttribute(QWebSettings::PluginsEnabled, false);
	settings()->setAttribute(QWebSettings::LocalStorageEnabled, false);
	settings()->setMaximumPagesInCache( 0 );
	settings()->setObjectCacheCapacities( 0, 0, 0 );
	settings()->clearMemoryCaches( );

    page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);

	connect(page()->action(QWebPage::Copy), SIGNAL(triggered()), SLOT(textCopiedEvent()));
	connect(page()->action(QWebPage::Cut), SIGNAL(triggered()), SLOT(textCopiedEvent()));
	connect(page(), SIGNAL(linkClicked(const QUrl&)), this, SLOT(linkClickedEvent(const QUrl&))); // most likely we don't need this at all
#endif
	connect(page(), SIGNAL(loadStarted()), this, SLOT(loadStartedEvent()));
	connect(page(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinishedEvent(bool)));
}
Exemplo n.º 18
0
MainWindow::MainWindow( QStringList list, QWidget *parent )
    : QMainWindow( parent ) {
    loadSettings ();

    setWindowTitle( tr( "%1 -- For better use of leo.org" ).arg( APP_NAME ));

    createBars();
    createSystemTray();

    // Remove the path item of the argv-list
    list.removeFirst();
    para = list.join(" ");

    view = new QWebView;
        view->load( QString( "%1%2%3" ).arg( URL ).arg( loadINI ()).arg( para ));
    setCentralWidget( view );

    connect( view, SIGNAL( loadStarted ()), this, SLOT( show ()));
    connect( view, SIGNAL( loadProgress ( int )), this, SLOT( progressLoad ( int )));
    connect( view, SIGNAL( loadFinished ( bool )), this, SLOT( finishedLoad ( bool )));

    clipboard = QApplication::clipboard ();
        connect(clipboard,SIGNAL( changed( QClipboard::Mode )), this, SLOT( clipboardChange ()));
}
Exemplo n.º 19
0
void QDeclarativeWebView::setPage(QWebPage* page)
{
    if (d->view->page() == page)
        return;

    d->view->setPage(page);
    updateContentsSize();
    page->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
    page->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
    connect(page->mainFrame(), SIGNAL(urlChanged(QUrl)), this, SLOT(pageUrlChanged()));
    connect(page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString)));
    connect(page->mainFrame(), SIGNAL(iconChanged()), this, SIGNAL(iconChanged()));
    connect(page->mainFrame(), SIGNAL(initialLayoutCompleted()), this, SLOT(initialLayout()));
    connect(page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), this, SIGNAL(contentsSizeChanged(QSize)));

    connect(page, SIGNAL(loadStarted()), this, SLOT(doLoadStarted()));
    connect(page, SIGNAL(loadProgress(int)), this, SLOT(doLoadProgress(int)));
    connect(page, SIGNAL(loadFinished(bool)), this, SLOT(doLoadFinished(bool)));
    connect(page, SIGNAL(statusBarMessage(QString)), this, SLOT(setStatusText(QString)));

    connect(page->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(windowObjectCleared()));

    page->settings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, true);
}
Exemplo n.º 20
0
void Document::reload(bool prompt)
{
	// Abort if there is no file to reload
	if (m_index) {
		return;
	}

	// Confirm that they do want to reload
	if (prompt) {
		QMessageBox mbox(window());
		mbox.setIcon(QMessageBox::Question);
		mbox.setWindowTitle(tr("Reload File?"));
		mbox.setText(tr("Reload the file '%1' from disk?").arg(QFileInfo(m_filename).fileName()));
		mbox.setInformativeText(tr("All unsaved changes will be lost."));

		QPushButton* reload_button = mbox.addButton(tr("Reload"), QMessageBox::AcceptRole);
		if (reload_button->style()->styleHint(QStyle::SH_DialogButtonBox_ButtonsHaveIcons)) {
			reload_button->setIcon(reload_button->style()->standardIcon(QStyle::SP_BrowserReload));
		}
		mbox.addButton(QMessageBox::Cancel);
		mbox.setDefaultButton(reload_button);

		if (mbox.exec() == QMessageBox::Cancel) {
			return;
		}
	}

	// Reload file
	emit loadStarted(Window::tr("Opening %1").arg(QDir::toNativeSeparators(m_filename)));
	m_text->setReadOnly(true);
	disconnect(m_text->document(), SIGNAL(contentsChange(int,int,int)), this, SLOT(updateWordCount(int,int,int)));
	disconnect(m_text->document(), SIGNAL(undoCommandAdded()), this, SLOT(undoCommandAdded()));
	m_daily_progress->increaseWordCount(-wordCountDelta());
	loadFile(m_filename, -1);
	emit loadFinished();
}
Exemplo n.º 21
0
DumpRenderTree::DumpRenderTree()
    : m_dumpPixels(false)
    , m_stdin(0)
    , m_enableTextOutput(false)
    , m_standAloneMode(false)
    , m_graphicsBased(false)
    , m_persistentStoragePath(QString(getenv("DUMPRENDERTREE_TEMP")))
{

    QByteArray viewMode = getenv("QT_DRT_WEBVIEW_MODE");
    if (viewMode == "graphics")
        setGraphicsBased(true);

    DumpRenderTreeSupportQt::overwritePluginDirectories();
    DumpRenderTreeSupportQt::activeMockDeviceOrientationClient(true);
    QWebSettings::enablePersistentStorage(m_persistentStoragePath);

    m_networkAccessManager = new NetworkAccessManager(this);
    // create our primary testing page/view.
    if (isGraphicsBased()) {
        WebViewGraphicsBased* view = new WebViewGraphicsBased(0);
        m_page = new WebPage(view, this);
        view->setPage(m_page);
        m_mainView = view;
    } else {
        QWebView* view = new QWebView(0);
        m_page = new WebPage(view, this);
        view->setPage(m_page);
        m_mainView = view;
    }
    // Use a frame group name for all pages created by DumpRenderTree to allow
    // testing of cross-page frame lookup.
    DumpRenderTreeSupportQt::webPageSetGroupName(m_page, "org.webkit.qt.DumpRenderTree");

    m_mainView->setContextMenuPolicy(Qt::NoContextMenu);
    m_mainView->resize(QSize(LayoutTestController::maxViewWidth, LayoutTestController::maxViewHeight));

    // clean up cache by resetting quota.
    qint64 quota = webPage()->settings()->offlineWebApplicationCacheQuota();
    webPage()->settings()->setOfflineWebApplicationCacheQuota(quota);

    // create our controllers. This has to be done before connectFrame,
    // as it exports there to the JavaScript DOM window.
    m_controller = new LayoutTestController(this);
    connect(m_controller, SIGNAL(showPage()), this, SLOT(showPage()));
    connect(m_controller, SIGNAL(hidePage()), this, SLOT(hidePage()));

    // async geolocation permission set by controller
    connect(m_controller, SIGNAL(geolocationPermissionSet()), this, SLOT(geolocationPermissionSet()));

    connect(m_controller, SIGNAL(done()), this, SLOT(dump()));
    m_eventSender = new EventSender(m_page);
    m_textInputController = new TextInputController(m_page);
    m_plainTextController = new PlainTextController(m_page);
    m_gcController = new GCController(m_page);

    // now connect our different signals
    connect(m_page, SIGNAL(frameCreated(QWebFrame *)),
            this, SLOT(connectFrame(QWebFrame *)));
    connectFrame(m_page->mainFrame());

    connect(m_page, SIGNAL(loadFinished(bool)),
            m_controller, SLOT(maybeDump(bool)));
    // We need to connect to loadStarted() because notifyDone should only
    // dump results itself when the last page loaded in the test has finished loading.
    connect(m_page, SIGNAL(loadStarted()),
            m_controller, SLOT(resetLoadFinished()));
    connect(m_page, SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested()));
    connect(m_page, SIGNAL(printRequested(QWebFrame*)), this, SLOT(dryRunPrint(QWebFrame*)));

    connect(m_page->mainFrame(), SIGNAL(titleChanged(const QString&)),
            SLOT(titleChanged(const QString&)));
    connect(m_page, SIGNAL(databaseQuotaExceeded(QWebFrame*,QString)),
            this, SLOT(dumpDatabaseQuota(QWebFrame*,QString)));
    connect(m_page, SIGNAL(applicationCacheQuotaExceeded(QWebSecurityOrigin *, quint64)),
            this, SLOT(dumpApplicationCacheQuota(QWebSecurityOrigin *, quint64)));
    connect(m_page, SIGNAL(statusBarMessage(const QString&)),
            this, SLOT(statusBarMessage(const QString&)));

    QObject::connect(this, SIGNAL(quit()), qApp, SLOT(quit()), Qt::QueuedConnection);

    DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled(true);
    QFocusEvent event(QEvent::FocusIn, Qt::ActiveWindowFocusReason);
    QApplication::sendEvent(m_mainView, &event);
}
Exemplo n.º 22
0
  ChromeWidget::ChromeWidget(QGraphicsItem * parent, Qt::WindowFlags wFlags)
    : QObject(0),
      m_renderer(0),
      m_dom(0),
      m_viewController(new ViewController()),
      m_jsObject(new ChromeWidgetJSObject(0, this)),
      m_localeDelegate(new LocaleDelegate(this)),
      m_downloads(new Downloads())
  {
    m_layout = new ChromeLayout(parent, wFlags);
    QObject::connect(m_layout, SIGNAL(resizing(QSizeF)), this, SLOT(onResize(QSizeF)));
    QObject::connect(m_layout, SIGNAL(aspectChanged(int)), this, SLOT(onAspectChanged(int)));

    DeviceImpl *deviceImpl = new DEVICEIMPL();
    NetworkImpl *networkImpl = new NETWORKIMPL();
    m_deviceDelegate = new DeviceDelegate(deviceImpl);
    m_networkDelegate = new NetworkDelegate(networkImpl);

    BEDROCK_PROVISIONING::BedrockProvisioning *provisioning = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning();
    ChromeEffect::disabledColor.setNamedColor(provisioning->valueAsString("DisabledColor", "#FFFFFF"));
    ChromeEffect::disabledOpacity = static_cast<qreal>(provisioning->valueAsString("DisabledOpacity", "0.65").toFloat());

#ifndef __gva_no_chrome__
    m_snippets = new Snippets(this, this);
#endif
#ifndef __gva_no_chrome__
    m_page =  static_cast<QWebPage *>(new GVA::WebPageWrapper(this, "Chrome Javascript error"));
    m_page->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
    m_page->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
#endif
    m_viewController->setObjectName("views");

    connect(m_viewController, SIGNAL(currentViewChanged()), this, SLOT(onCurrentViewChanged()));
#ifndef __gva_no_chrome__

    m_jsObject->setObjectName("chrome");

    // Pass some signals from this object to the Javascript object.
    QObject::connect(this, SIGNAL(chromeComplete()), m_jsObject, SIGNAL(chromeComplete()));
    QObject::connect(this, SIGNAL(aspectChanged(int)), m_jsObject, SIGNAL(aspectChanged(int)));
    QObject::connect(this, SIGNAL(prepareForGeometryChange()), m_jsObject, SIGNAL(prepareForGeometryChange()));
    QObject::connect(this, SIGNAL(symbianCarriageReturn()), m_jsObject, SIGNAL(symbianCarriageReturn()));
    QObject::connect(this, SIGNAL(popupShown(const QString &)), m_jsObject, SIGNAL(popupShown(const QString &)));
    QObject::connect(this, SIGNAL(popupHidden(const QString &)), m_jsObject, SIGNAL(popupHidden(const QString &)));

    //addJSObjectToEngine(this);

    m_app = new GinebraApplication();
    QObject::connect(this, SIGNAL(goToBackground()), m_app, SLOT(sendToBackground()));

    //addJSObjectToEngine(m_app);

    QObject::connect(
            WebPageController::getSingleton(), SIGNAL(pageCreated(WRT::WrtBrowserContainer*)),
            this, SLOT(pageCreated(WRT::WrtBrowserContainer*)));

    QObject::connect(m_page, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));
    QObject::connect(m_page, SIGNAL(loadStarted()), this, SLOT(loadStarted()));
    QObject::connect(m_page->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(exportJSObjects()));

#endif

    ViewStack * vs = ViewStack::getSingleton();
    vs->setViewController(m_viewController);
    vs->setChromeWidget(this);

    // TO DO: need a better home for this.
    qMetaTypeId<QObjectList>();
    qRegisterMetaType<QObjectList>("QObjectList");
	
	//for QA Automation test tool purpose
#if !defined(QT_NO_LIBRARY)
    QLibrary testLib("qttestability");
    if(testLib.load()){
        typedef void (*TasInitialize)(void);
        TasInitialize initFunction = (TasInitialize)testLib.resolve("qt_testability_init");
#ifdef Q_OS_SYMBIAN
        //not found so use ordinal
        if(!initFunction){
            initFunction = (TasInitialize)testLib.resolve("1");
        }
#endif
        if(initFunction){
            initFunction();
        }
    }
#endif
  }
Exemplo n.º 23
0
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    //objet pour la gestion des réglages
    settingsTable = new QSettings("outadoc", "FreeStance");

    options = new Options(this);
    about = new About(this);
    help = new Help(this);
    settings = new AppSettings;

    //on vérifie les mises à jour
    checkForUpdates();

    bool hasBeenSet = settingsTable->value("hasBeenSet", false).toBool();
    //si le programme n'a jamais été utilisé...
    if(hasBeenSet != true)
    {
        settingsTable->setValue("hasBeenSet", false);
        options->show();
    }

    //on centre la fenêtre
    QDesktopWidget *widget = QApplication::desktop();
    int desktop_width = widget->width();
    int desktop_height = widget->height();
    int x = desktop_width / 2 - width() / 2;
    int y = desktop_height / 2 - height() / 2 - 25;
    move(QPoint(x, y));

    //on récupère le dernier profil utilisé pour l'utiliser par défaut dans le programme
    if(settings->getProfileToUse() == 1)
    {
        ui->actionProfil_1->setChecked(true);
        ui->actionProfil_2->setChecked(false);
        ui->actionProfil_3->setChecked(false);
    }

    else if (settings->getProfileToUse() == 2)
    {
        ui->actionProfil_1->setChecked(false);
        ui->actionProfil_2->setChecked(true);
        ui->actionProfil_3->setChecked(false);
    }

    else if(settings->getProfileToUse() == 3)
    {
        ui->actionProfil_1->setChecked(false);
        ui->actionProfil_2->setChecked(false);
        ui->actionProfil_3->setChecked(true);
    }

    //url pour les programmes tv
    setProgrammetvNetUrl(QUrl(tr("http://www.programme-tv.net/programme/free-13/")));
    setProgrammeTvUrl(QUrl(tr("http://dev.outadoc.fr/freestance/tvprog.html")));
    setCesoirtvComUrl(QUrl(tr("http://cesoirtv.com/")));
    setTvmagComUrl(QUrl(tr("http://www.tvmag.com/programme-tv/guide-tele.html?boId=2")));
    setTvexpressComUrl(QUrl(tr("http://tv-express.com/")));
    setHomepage(getTvexpressComUrl());

    //chargement du guide epg
    webbrowser = new QWebView;
    vbox = new QVBoxLayout;
    vbox->addWidget(webbrowser);
    ui->web_frame->setLayout(vbox);
    ui->prgrbar_browser->setVisible(false);
    webbrowser->load(getHomepage());

    //connections pour l'epg
    connect(ui->b_refresh, SIGNAL(clicked()), webbrowser, SLOT(reload()));
    connect(ui->b_prev, SIGNAL(clicked()), webbrowser, SLOT(back()));
    connect(ui->b_fw, SIGNAL(clicked()), webbrowser, SLOT(forward()));
    connect(ui->cbox_site, SIGNAL(currentIndexChanged(int)), this, SLOT(changeWebsite(int)));
    connect(webbrowser, SIGNAL(loadStarted()), this, SLOT(beginLoading()));
    connect(webbrowser, SIGNAL(loadProgress(int)), this, SLOT(loading(int)));
    connect(webbrowser, SIGNAL(loadFinished(bool)), this, SLOT(stopLoading(bool)));
    connect(ui->actionPr_f_rences, SIGNAL(triggered()), options, SLOT(show()));
    connect(ui->actionV_rifier_les_mises_jour, SIGNAL(triggered()), SLOT(checkForUpdates()));

    //on affiche la version dans le bas
    ui->lbl_actual_version->setText(VERSION);

    //le stay on top ne marche pas pour le moment, donc
    ui->actionToujours_au_dessus->setVisible(false);
}
Exemplo n.º 24
0
//#include <QDebug>
Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);

    QTextCodec *utfcodec = QTextCodec::codecForName("UTF-8"); //qt4
    QTextCodec::setCodecForTr(utfcodec);
    QTextCodec::setCodecForCStrings(utfcodec);

    filePath =qApp->applicationDirPath();

    myWeb = new QWebView;

    timerDec.setInterval(350);
    timerInc.setInterval(350);

    ui->vltWeb->addWidget(myWeb);
    ui->splitter->setStretchFactor(0,0);
    ui->splitter->setStretchFactor(1,3);

    connect(ui->pbBack, SIGNAL(clicked()), myWeb, SLOT(back()));
    connect(ui->pbForward, SIGNAL(clicked()), myWeb,SLOT(forward()));

    connect(ui->pbFontDec, SIGNAL(clicked()), this, SLOT(zoomDec()));
    connect(ui->pbFontInc, SIGNAL(clicked()), this, SLOT(zoomInc()));
    connect(ui->pbFontNorm, SIGNAL(clicked()), this, SLOT(zoomNorm()));

    connect(ui->pbFontDec, SIGNAL(pressed()), &timerDec, SLOT(start()));
    connect(ui->pbFontInc, SIGNAL(pressed()), &timerInc, SLOT(start()));

    connect(ui->pbFontDec,SIGNAL(released()), &timerDec, SLOT(stop()));
    connect(ui->pbFontInc,SIGNAL(released()), &timerInc, SLOT(stop()));

    connect(&timerDec,SIGNAL(timeout()), this, SLOT(zoomDec()));
    connect(&timerInc, SIGNAL(timeout()), this, SLOT(zoomInc()));

    connect(myWeb, SIGNAL(loadProgress(int)), ui->pbrLoad , SLOT(setValue(int)));
    connect(myWeb, SIGNAL(loadFinished(bool)), SLOT(slotFinished(bool)));
    connect(myWeb, SIGNAL(loadStarted()), this, SLOT(startLoad()));
//    connect(myWeb, SIGNAL(linkClicked(QUrl)), this, SLOT(newUrl(QUrl)));
//tmp windows gmn    connect(myWeb, SIGNAL(urlChanged(QUrl)), SLOT(newUrl(QUrl)));

   // myWeb->load(QUrl("http://img0.liveinternet.ru/images/attach/c/5//3970/3970473_sprite198.swf"));//http://img0.liveinternet.ru/images/attach/c/5//3970/3970473_sprite198.swf
    myWeb->load(QUrl(filePath+"/html/sniffer_index.html"));

//    qDebug()<<filePath;

//    connect(myWeb,SIGNAL(titleChanged(QString)), ui->widget, SLOT(setWindowTitle(QString)));
//    myWeb->load(QUrl(filePath+"/html2/ddd.html"));
    ui->treeWidget->setSortingEnabled(0);


    QTreeWidgetItem *myItem = new QTreeWidgetItem(ui->treeWidget);
    myItem->setText(0, "EMBEE Radio Sniffer");//zmist

    QTreeWidgetItem *vstup = new QTreeWidgetItem(myItem);
    vstup->setText(0, "Введение");


    QTreeWidgetItem *vykor = new QTreeWidgetItem(myItem);
    vykor->setText(0, "Использование");

    QTreeWidgetItem *vykorNast = new QTreeWidgetItem(vykor);
    vykorNast->setText(0, "Настройка соединения");

    QTreeWidgetItem *vykorNtty = new QTreeWidgetItem(vykorNast);
    vykorNtty->setText(0, "Настройка последовательного порта");

    QTreeWidgetItem *vykorNhayes = new QTreeWidgetItem(vykorNast);
    vykorNhayes->setText(0, "Настройка соединения через Hayes-модем");

    QTreeWidgetItem *vykorNeth = new QTreeWidgetItem(vykorNast);
    vykorNeth->setText(0, "Настройка соединения через Ethernet");

    QTreeWidgetItem *vykorParam = new QTreeWidgetItem(vykor);
    vykorParam->setText(0, "Конфигурация основных параметров");

    QTreeWidgetItem *vykorParamO = new QTreeWidgetItem(vykorParam);
    vykorParamO->setText(0, "Описание параметров");

    QTreeWidgetItem *vykorParamR = new QTreeWidgetItem(vykorParam);
    vykorParamR->setText(0, "Режимы");

    QTreeWidgetItem *vykorTerm = new QTreeWidgetItem(vykor);
    vykorTerm->setText(0, "Встроенный терминал");

    QTreeWidgetItem *vykorCom = new QTreeWidgetItem(myItem);
    vykorCom->setText(0, "Command Reference");

    QTreeWidgetItem *vykorComF = new QTreeWidgetItem(vykorCom);
    vykorComF->setText(0, "The File Menu");

    QTreeWidgetItem *vykorComV = new QTreeWidgetItem(vykorCom);
    vykorComV->setText(0, "The View Menu");

    QTreeWidgetItem *vykorComA = new QTreeWidgetItem(vykorCom);
    vykorComA->setText(0, "The Advanced Menu");

    QTreeWidgetItem *vykorComSw = new QTreeWidgetItem(vykorCom);
    vykorComSw->setText(0, "The Switch Menu");

    QTreeWidgetItem *vykorComSet = new QTreeWidgetItem(vykorCom);
    vykorComSet->setText(0, "The Settings Menu");

    QTreeWidgetItem *vykorComH = new QTreeWidgetItem(vykorCom);
    vykorComH->setText(0, "The Help Menu");

    ui->treeWidget->setItemExpanded(myItem, true);
    ui->treeWidget->setItemExpanded(vykor, true);
    ui->treeWidget->setItemExpanded(vykorNast, true);
    ui->treeWidget->setItemExpanded(vykorParam, true);
    ui->treeWidget->setItemExpanded(vykorCom, true);

    ui->pbFontNorm->setToolTip(tr("x1"));
    QTimer::singleShot(50, this, SLOT(zoomChanged()));
  /*  QTreeWidgetItem *vykor = new QTreeWidgetItem(myItem);
    vykor->setText(0, "Использование");*/
    loadSettings();

}
Exemplo n.º 25
0
void WebView::fakeLoadingProgress(int progress)
{
    emit loadStarted();
    emit loadProgress(progress);
}
Exemplo n.º 26
0
WebTab::WebTab(QWidget *parent, bool isPrivateBrowsing)
    : QWidget(parent)
    , m_webView(0)
    , m_progress(0)
    , m_part(0)
    , m_zoomFactor(ReKonfig::defaultZoom())
    , m_isPrivateBrowsing(isPrivateBrowsing)
    , m_isWebApp(false)
    , m_splitter(new QSplitter(this))
#ifdef HAVE_KACTIVITIES
    , m_activityResourceInstance(0)
#endif
{
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    QVBoxLayout *l = new QVBoxLayout(this);
    l->setMargin(0);
    l->setSpacing(0);

    m_splitter->addWidget(view());
    view()->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    // NOTE: setting web inspector vertical/horizontal
    m_splitter->setOrientation(Qt::Vertical);

    l->addWidget(m_splitter);

    // fix focus handling
    setFocusProxy(view());


    KWebWallet *wallet = page()->wallet();

    if (wallet)
    {
        connect(wallet, SIGNAL(saveFormDataRequested(QString,QUrl)),
                this, SLOT(createWalletBar(QString,QUrl)));
    }

    // Connect webview signals with related webtab ones
    connect(view(), SIGNAL(loadFinished(bool)),     this, SIGNAL(loadFinished(bool)));
    connect(view(), SIGNAL(loadProgress(int)),      this, SIGNAL(loadProgress(int)));
    connect(view(), SIGNAL(loadStarted()),          this, SIGNAL(loadStarted()));
    connect(view(), SIGNAL(urlChanged(QUrl)),       this, SIGNAL(urlChanged(QUrl)));
    connect(view(), SIGNAL(titleChanged(QString)),  this, SIGNAL(titleChanged(QString)));
    connect(view(), SIGNAL(iconChanged()),          this, SIGNAL(iconChanged()));
    
    connect(page(), SIGNAL(initialUrl(QUrl)),       this, SIGNAL(urlChanged(QUrl)));

    if (!parent)
    {
        m_isWebApp = true;
        connect(this, SIGNAL(titleChanged(QString)), this, SLOT(webAppTitleChanged(QString)));
        connect(this, SIGNAL(iconChanged()), this, SLOT(webAppIconChanged()));
    }

    connect(view(), SIGNAL(loadProgress(int)),  this, SLOT(updateProgress(int)));
    connect(view(), SIGNAL(loadStarted()),      this, SLOT(resetProgress()));
    connect(view(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinished()));
    connect(view(), SIGNAL(zoomChanged(int)),   this, SLOT(setZoom(int)));
    
    // Session Manager
    connect(view(), SIGNAL(loadFinished(bool)), SessionManager::self(), SLOT(saveSession()));
    
#ifdef HAVE_KACTIVITIES
    if (m_isPrivateBrowsing)
        return;
    
    m_activityResourceInstance = new KActivities::ResourceInstance(window()->winId(), this);
    
    connect(this, SIGNAL(urlChanged(QUrl)), m_activityResourceInstance, SLOT(setUri(QUrl)));
    connect(this, SIGNAL(titleChanged(QString)), m_activityResourceInstance, SLOT(setTitle(QString)));
#endif
}
/*!
    Constructor       
 */
WlanLoginView::WlanLoginView(WlanLoginMainWindow* mainWindow):
    mMainWindow(mainWindow),
    mDocLoader(new WlanLoginDocumentLoader(mainWindow)),
    mProgressBar(NULL),
    mScrollAreaContent(NULL),
    mWebView(NULL),
    mNextAction(NULL),
    mFirstIctsOkResult(true)
{   
    OstTraceFunctionEntry0(WLANLOGINVIEW_WLANLOGINVIEW_ENTRY);
    
    loadDocml();
    
    setTitleBarVisible(false);
    setStatusBarVisible(false);
    
    // Set white background to content widget
    QPixmap pixmap(10,10);
    pixmap.fill(Qt::white);
    QGraphicsPixmapItem *pixmapItem = new QGraphicsPixmapItem(pixmap);
    mScrollAreaContent->setBackgroundItem(pixmapItem);
    
    mWebView->page()->setNetworkAccessManager(mMainWindow->application()->engine()->networkAccessManager());
    
    bool connectStatus = connect(
        mWebView,
        SIGNAL(loadStarted()),
        this,
        SLOT(handleLoadStarted())); 
    Q_ASSERT(connectStatus == true);
    
    connectStatus = connect(
        mWebView,
        SIGNAL(loadProgress(int)),
        this,
        SLOT(handleLoadProgress(int))); 
    Q_ASSERT(connectStatus == true);
    
    connectStatus = connect(
        mWebView,
        SIGNAL(loadFinished(bool)),
        this,
        SLOT(handleLoadFinished(bool)));
    Q_ASSERT(connectStatus == true);
    
    connectStatus = connect(
    mWebView,
    SIGNAL(urlChanged(const QUrl&)),
    this,
    SLOT(handleUrlChanged(const QUrl&)));
    Q_ASSERT(connectStatus == true);
    
    connectStatus = connect(
        mWebView->page(),
        SIGNAL(formSubmitted()),
        this,
        SLOT(handleFormSubmitted()));
    Q_ASSERT(connectStatus == true);
    
    connectStatus = connect(
        mCancelAction,
        SIGNAL(triggered()),
        this,
        SLOT(handleCancelAction()));
    Q_ASSERT(connectStatus == true);
    
    connectStatus = connect(
        mNextAction,
        SIGNAL(triggered()),
        this,
        SLOT(handleNextAction()));
    Q_ASSERT(connectStatus == true);
    
    show();
    
    OstTraceFunctionExit0(WLANLOGINVIEW_WLANLOGINVIEW_EXIT);
}
Exemplo n.º 28
0
MpMapWidget::MpMapWidget(MainObject *mOb, QWidget *parent) :
        QWidget(parent)
{

	mainObject = mOb;
	setProperty("settings_namespace", QVariant("mp_map_window"));
	mainObject->settings->restoreWindow(this);

    setWindowTitle(tr("Multi Player Map"));
	setWindowIcon(QIcon(":/icon/mpmap"));

    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    mainLayout->setContentsMargins(0,0,0,0);
    mainLayout->setSpacing(0);


    //** Toolbar
    QToolBar *toolbar = new QToolBar();
    mainLayout->addWidget(toolbar, 1);

    //** Select server
	QLabel *lblSelectServer = new QLabel(tr("Select Server:"));
    toolbar->addWidget(lblSelectServer);

    comboServer = new QComboBox();
    toolbar->addWidget(comboServer);
	
	//**get callsign

	//**add callsign to url
	comboServer->addItem("MpMap-01", QVariant("http://mpmap01.flightgear.org/"));
	comboServer->addItem("MpMap-02", QVariant("http://mpmap02.flightgear.org/"));
	comboServer->setCurrentIndex(0);
	connect(comboServer, SIGNAL(currentIndexChanged(int)), this, SLOT(on_combo_server()) );

	//=============================================================
	//== Cache
	//qDebug() << QDesktopServices::storageLocation(QDesktopServices::CacheLocation);

	networkDiskCache = new QNetworkDiskCache(this);
	networkDiskCache->setCacheDirectory(QDesktopServices::storageLocation(QDesktopServices::CacheLocation));

	networkCookieJar = new QNetworkCookieJar(this);

	//== Browser
	webView = new QWebView(this);
	mainLayout->addWidget(webView, 100);
	webView->page()->networkAccessManager()->setCache(networkDiskCache);
	webView->page()->networkAccessManager()->setCookieJar(networkCookieJar);
	connect(webView, SIGNAL(loadStarted()), this, SLOT(start_progress()));
	connect(webView, SIGNAL(loadProgress(int)), this, SLOT(update_progress(int)));
	connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(end_progress(bool)));

    //*** Status Bar
    statusBar = new QStatusBar(this);
    mainLayout->addWidget(statusBar);
    statusBar->showMessage("Idle");

    //** Progress Bar
    progressBar = new QProgressBar();
    progressBar->setVisible(false);
    statusBar->addPermanentWidget(progressBar);

    //*** Initialise
	on_combo_server();
}
Exemplo n.º 29
0
    {
        QWidget *emptyWidget = new QWidget;
        QPalette p = emptyWidget->palette();
        p.setColor(QPalette::Window, palette().color(QPalette::Base));
        emptyWidget->setPalette(p);
        emptyWidget->setAutoFillBackground(true);
        disconnect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
        addTab(emptyWidget, tr("(Untitled)"));
        connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
        return 0;
    }

    // webview
    WBWebView *webView = new WBWebView;
    urlLineEdit->setWebView(webView);
    connect(webView, SIGNAL(loadStarted()), this, SLOT(webViewLoadStarted()));
    connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(webViewIconChanged()));
    connect(webView, SIGNAL(iconChanged()), this, SLOT(webViewIconChanged()));
    connect(webView, SIGNAL(titleChanged(const QString &)), this, SLOT(webViewTitleChanged(const QString &)));
    connect(webView, SIGNAL(urlChanged(const QUrl &)), this, SLOT(webViewUrlChanged(const QUrl &)));
    connect(webView->page(), SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested()));
    connect(webView->page(), SIGNAL(geometryChangeRequested(const QRect &)), this, SIGNAL(geometryChangeRequested(const QRect &)));
    connect(webView->page(), SIGNAL(printRequested(QWebFrame *)), this, SIGNAL(printRequested(QWebFrame *)));
    connect(webView->page(), SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SIGNAL(menuBarVisibilityChangeRequested(bool)));
    connect(webView->page(), SIGNAL(statusBarVisibilityChangeRequested(bool)), this, SIGNAL(statusBarVisibilityChangeRequested(bool)));
    connect(webView->page(), SIGNAL(toolBarVisibilityChangeRequested(bool)), this, SIGNAL(toolBarVisibilityChangeRequested(bool)));

    connect(webView, SIGNAL(pixmapCaptured(const QPixmap&, bool)), UBApplication::applicationController, SLOT(addCapturedPixmap(const QPixmap &, bool)));

    connect(webView, SIGNAL(embedCodeCaptured(const QString&)), UBApplication::applicationController, SLOT(addCapturedEmbedCode(const QString&)));
Exemplo n.º 30
0
        QPalette p = emptyWidget->palette();
        p.setColor(QPalette::Window, palette().color(QPalette::Base));
        emptyWidget->setPalette(p);
        emptyWidget->setAutoFillBackground(true);
        disconnect(this, SIGNAL(currentChanged(int)),
            this, SLOT(currentChanged(int)));
        addTab(emptyWidget, tr("(Untitled)"));
        connect(this, SIGNAL(currentChanged(int)),
            this, SLOT(currentChanged(int)));
        return 0;
    }

    // webview
    WebView *webView = new WebView;
    urlLineEdit->setWebView(webView);
    connect(webView, SIGNAL(loadStarted()),
            this, SLOT(webViewLoadStarted()));
    connect(webView, SIGNAL(loadFinished(bool)),
            this, SLOT(webViewIconChanged()));
    connect(webView, SIGNAL(iconChanged()),
            this, SLOT(webViewIconChanged()));
    connect(webView, SIGNAL(titleChanged(const QString &)),
            this, SLOT(webViewTitleChanged(const QString &)));
    connect(webView, SIGNAL(urlChanged(const QUrl &)),
            this, SLOT(webViewUrlChanged(const QUrl &)));
    connect(webView->page(), SIGNAL(windowCloseRequested()),
            this, SLOT(windowCloseRequested()));
    connect(webView->page(), SIGNAL(geometryChangeRequested(const QRect &)),
            this, SIGNAL(geometryChangeRequested(const QRect &)));
    connect(webView->page(), SIGNAL(printRequested(QWebFrame *)),
            this, SIGNAL(printRequested(QWebFrame *)));