示例#1
0
	BrowserWidget* Core::NewURL (const QUrl& url, bool raise)
	{
		if (!Initialized_)
			return 0;

		BrowserWidget *widget = new BrowserWidget ();
		widget->InitShortcuts ();
		widget->SetUnclosers (Unclosers_);
		Widgets_.push_back (widget);

		QString tabTitle = "Poshuku";
		if (url.host ().size ())
			tabTitle = url.host ();
		emit addNewTab (tabTitle, widget);

		ConnectSignals (widget);

		if (!url.isEmpty ())
			widget->SetURL (url);

		if (raise)
			emit raiseTab (widget);
		
		emit hookTabAdded (Util::DefaultHookProxy_ptr (new Util::DefaultHookProxy),
				widget,
				widget->getWebView (),
				url);

		return widget;
	}
示例#2
0
BrowserWidget* Core::NewURL (const QUrl& url, bool raise,
                             const QList<QPair<QByteArray, QVariant>>& props)
{
    if (!Initialized_)
        return 0;

    BrowserWidget *widget = new BrowserWidget ();
    widget->InitShortcuts ();
    Widgets_.push_back (widget);

    Q_FOREACH (const auto& pair, props)
        widget->setProperty (pair.first, pair.second);

    QString tabTitle = "Poshuku";
    if (url.host ().size ())
        tabTitle = url.host ();
    emit addNewTab (tabTitle, widget);

    ConnectSignals (widget);

    if (!url.isEmpty ())
        widget->SetURL (url);

    if (raise)
        emit raiseTab (widget);

    emit hookTabAdded (Util::DefaultHookProxy_ptr (new Util::DefaultHookProxy),
                       widget,
                       widget->getWebView (),
                       url);

    return widget;
}