void GWebContentView::bitmapZoomStop()
{
    if (m_timer) {
        m_timer->stop();
        disconnect(m_timer,SIGNAL(timeout()));
        delete m_timer;
        m_timer = NULL;
    }
    qreal zoomFactor = m_value * webWidget()->zoomFactor();
    ((zoomFactor+0.001) >= webWidget()->maximumScale() )? webWidget()->setZoomFactor(webWidget()->maximumScale()):webWidget()->setZoomFactor(zoomFactor);
    webWidget()->bitmapZoomCleanup();
}
Exemplo n.º 2
0
DomElement *WWidget::createSDomElement(WApplication *app)
{
    if (!needsToBeRendered()) {
        DomElement *result = webWidget()->createStubElement(app);
        renderOk();
        askRerender(true);
        return result;
    } else {
        webWidget()->setRendered(true);
        render(RenderFull);
        return webWidget()->createActualElement(app);
    }
}
void GWebContentView::zoomN()
{
    if ((m_value * webWidget()->zoomFactor()) <  webWidget()->minimumScale()){
       // if (m_timer && m_timer->isActive())
            bitmapZoomStop();
    }else {
        if (m_timer->isSingleShot()) {
            m_timer->setSingleShot(false);
            m_timer->start(1);
        }
        webWidget()->setBitmapZoom(m_value * webWidget()->zoomFactor());
        m_value *= KZoomOutStep;
    }
}
Exemplo n.º 4
0
Arquivo: WWidget.C Projeto: DTidd/wt
void WWidget::scheduleRerender(bool laterOnly, WFlags<RepaintFlag> flags)
{
  if (!flags_.test(BIT_NEED_RERENDER)) {
    flags_.set(BIT_NEED_RERENDER);
    WApplication::instance()->session()->renderer().needUpdate(this, laterOnly);
  }

  if ((flags & RepaintSizeAffected) &&
      !flags_.test(BIT_NEED_RERENDER_SIZE_CHANGE)) {
    flags_.set(BIT_NEED_RERENDER_SIZE_CHANGE);

    webWidget()->parentResized(this, Vertical);

    /*
     * A size change to an absolutely positioned widget will not affect
     * a layout computation, except if it's itself in a layout!
     */
    if (positionScheme() == Absolute && !isInLayout())
      return;

    /*
     * Propagate event up, this will be caught by a container widget
     * with a layout manager.
     */
    WWidget *p = parent();

    if (p)
      p->childResized(this, Vertical);
  }
}
Exemplo n.º 5
0
void WWidget::acceptDrops(const std::string& mimeType,
                          const WT_USTRING& hoverStyleClass)
{
    WWebWidget *thisWebWidget = webWidget();

    if (thisWebWidget->setAcceptDropsImpl(mimeType, true, hoverStyleClass)) {
        thisWebWidget->otherImpl_->dropSignal_->connect(this, &WWidget::getDrop);
    }
}
Exemplo n.º 6
0
std::string WWidget::inlineCssStyle()
{
    WWebWidget *ww = webWidget();
    DomElement *e = DomElement::getForUpdate(ww, ww->domElementType());
    ww->updateDom(*e, true);
    std::string result = e->cssStyle();
    delete e;
    return result;
}
Exemplo n.º 7
0
void WWidget::setLayoutSizeAware(bool aware)
{
    if (aware == flags_.test(BIT_RESIZE_AWARE))
        return;

    flags_.set(BIT_RESIZE_AWARE, aware);

    if (aware) {
        /*
         * Signals are created in a memory pool maintained by the application.
         * WPaintedWidget can be used offline.
         */
        if (!WApplication::instance())
            return;

        WWebWidget *w = webWidget();
        if (w == this)
            webWidget()->resized();
        else
            webWidget()->resized().connect(this, &WWidget::layoutSizeChanged);
    } else
        webWidget()->setImplementLayoutSizeAware(false);
}
Exemplo n.º 8
0
void ProgressBarWidget::timerEvent(QTimerEvent *event)
{
	if (event->timerId() == m_geometryUpdateTimer)
	{
		killTimer(m_geometryUpdateTimer);

		m_geometryUpdateTimer = 0;

		if (!m_window)
		{
			return;
		}

		WebContentsWidget *contentsWidget(qobject_cast<WebContentsWidget*>(m_window->getContentsWidget()));

		if (!contentsWidget || !contentsWidget->getWebWidget())
		{
			return;
		}

		WebWidget *webWidget(contentsWidget->getWebWidget());
		QRect geometry(webWidget->getProgressBarGeometry());
		const ToolBarsManager::ToolBarVisibility visibility(ToolBarsManager::getToolBarDefinition(ToolBarsManager::ProgressBar).normalVisibility);

		if (visibility == ToolBarsManager::AlwaysVisibleToolBar || (visibility == ToolBarsManager::AutoVisibilityToolBar && webWidget->getLoadingState() == WindowsManager::OngoingLoadingState))
		{
			if (!isVisible())
			{
				connect(webWidget, SIGNAL(progressBarGeometryChanged()), this, SLOT(scheduleGeometryUpdate()));
			}

			geometry.translate(0, webWidget->pos().y());

			setGeometry(geometry);
			show();
			raise();
		}
		else
		{
			disconnect(webWidget, SIGNAL(progressBarGeometryChanged()), this, SLOT(scheduleGeometryUpdate()));

			hide();
		}
	}
}
Exemplo n.º 9
0
void WWidget::stopAcceptDrops(const std::string& mimeType)
{
    WWebWidget *thisWebWidget = webWidget();

    thisWebWidget->setAcceptDropsImpl(mimeType, false, "");
}
Exemplo n.º 10
0
QWidget* createSidebarPanel(const QString &panel, MainWindow *mainWindow, int sidebar)
{
	QVariantMap parameters({{QLatin1String("sidebar"), sidebar}});

	if (panel == QLatin1String("addons"))
	{
		return new AddonsContentsWidget(parameters, nullptr);
	}

	if (panel == QLatin1String("bookmarks"))
	{
		return new BookmarksContentsWidget(parameters, nullptr);
	}

	if (panel == QLatin1String("cache"))
	{
		return new CacheContentsWidget(parameters, nullptr);
	}

	if (panel == QLatin1String("config"))
	{
		return new ConfigurationContentsWidget(parameters, nullptr);
	}

	if (panel == QLatin1String("cookies"))
	{
		return new CookiesContentsWidget(parameters, nullptr);
	}

	if (panel == QLatin1String("history"))
	{
		return new HistoryContentsWidget(parameters, nullptr);
	}

	if (panel == QLatin1String("notes"))
	{
		return new NotesContentsWidget(parameters, nullptr);
	}

	if (panel == QLatin1String("passwords"))
	{
		return new PasswordsContentsWidget(parameters, nullptr);
	}

	if (panel == QLatin1String("transfers"))
	{
		return new TransfersContentsWidget(parameters, nullptr);
	}

	if (panel == QLatin1String("windows"))
	{
		return new WindowsContentsWidget(parameters, nullptr);
	}

	if (panel.startsWith(QLatin1String("web:")))
	{
		if (!mainWindow || mainWindow->isPrivate())
		{
			parameters[QLatin1String("hints")] = SessionsManager::PrivateOpen;
		}

		WebContentsWidget *webWidget(new WebContentsWidget(parameters, QHash<int, QVariant>(), nullptr, nullptr));
		webWidget->setUrl(panel.section(QLatin1Char(':'), 1, -1), false);

		return webWidget;
	}

	return nullptr;
}