예제 #1
0
파일: core.cpp 프로젝트: Zereal/leechcraft
	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;
}