示例#1
0
void tab::createConnects()
{
    connect(urlAddress, SIGNAL(returnPressed()), this, SLOT(newUrl()));
    connect(addressCompleter, SIGNAL(itemChoosed(QString)), this, SLOT(newUrl(QString)));
    connect(webView, SIGNAL(urlChanged(QUrl)), this, SLOT(urlChanged(QUrl)));
    connect(webView, SIGNAL(titleChanged(QString)), this, SLOT(chTitle(QString)));
    connect(webView, SIGNAL(iconChanged()), this, SLOT(chIcon()));
    connect(webView, SIGNAL(statusBarMessage(QString)), this, SLOT(statusBarMessage(QString)));
    connect(webView, SIGNAL(selectionChanged()), this, SLOT(selectionChange()));
    connect(webView, SIGNAL(loadStarted()), this, SLOT(loadStart()));
    connect(webView, SIGNAL(loadProgress(int)), this, SLOT(loadProgress(int)));
    connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(loadFinish(bool)));
    connect(webView, SIGNAL(linkClicked(QUrl)), this, SLOT(linkClick(QUrl)));
    connect(webView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequest(QPoint)));
    connect(webView->page(), SIGNAL(unsupportedContent(QNetworkReply*)), this, SLOT(downloadRequest(QNetworkReply*)));
    connect(webView->page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequset(QNetworkRequest)));
    connect(webView->page(), SIGNAL(printRequested(QWebFrame*)), this, SLOT(printPage(QWebFrame*)));
}
void UsernameBox::prepare() {
	_goodText = App::self()->username.isEmpty() ? QString() : lang(lng_username_available);

	setTitle(langFactory(lng_username_title));

	addButton(langFactory(lng_settings_save), [=] { save(); });
	addButton(langFactory(lng_cancel), [=] { closeBox(); });

	connect(_username, &Ui::MaskedInputField::changed, [=] { changed(); });
	connect(_username, &Ui::MaskedInputField::submitted, [=] { save(); });
	_link->addClickHandler([=] { linkClick(); });

	_about.setRichText(st::usernameTextStyle, lang(lng_username_about));
	setDimensions(st::boxWidth, st::usernamePadding.top() + _username->height() + st::usernameSkip + _about.countHeight(st::boxWidth - st::usernamePadding.left()) + 3 * st::usernameTextStyle.lineHeight + st::usernamePadding.bottom());

	_checkTimer->setSingleShot(true);
	connect(_checkTimer, &QTimer::timeout, [=] { check(); });

	updateLinkText();
}