本文整理汇总了C++中BrowserMainWindow类的典型用法代码示例。如果您正苦于以下问题:C++ BrowserMainWindow类的具体用法?C++ BrowserMainWindow怎么用?C++ BrowserMainWindow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BrowserMainWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: acceptNavigationRequest
bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type)
{
// ctrl open in new tab
// ctrl-shift open in new tab and select
// ctrl-alt open in new window
if (type == QWebPage::NavigationTypeLinkClicked
&& (m_keyboardModifiers & Qt::ControlModifier
|| m_pressedButtons == Qt::MidButton)) {
bool newWindow = (m_keyboardModifiers & Qt::AltModifier);
WebView *webView;
if (newWindow) {
BrowserApplication::instance()->newMainWindow();
BrowserMainWindow *newMainWindow = BrowserApplication::instance()->mainWindow();
webView = newMainWindow->currentTab();
newMainWindow->raise();
newMainWindow->activateWindow();
webView->setFocus();
} else {
bool selectNewTab = (m_keyboardModifiers & Qt::ShiftModifier);
webView = mainWindow()->tabWidget()->newTab(selectNewTab);
}
webView->load(request);
m_keyboardModifiers = Qt::NoModifier;
m_pressedButtons = Qt::NoButton;
return false;
}
if (frame == mainFrame()) {
m_loadingUrl = request.url();
emit loadingUrl(m_loadingUrl);
}
return QWebPage::acceptNavigationRequest(frame, request, type);
}
示例2: clean
void BrowserApplication::lastWindowClosed()
{
clean();
BrowserMainWindow *mw = new BrowserMainWindow;
mw->goHome();
m_mainWindows.prepend(mw);
}
示例3: BrowserMainWindow
BrowserMainWindow *BrowserApplication::newMainWindow()
{
BrowserMainWindow *browser = new BrowserMainWindow();
m_mainWindows.prepend(browser);
browser->show();
return browser;
}
示例4: setHomeToCurrentPage
void SettingsDialog::setHomeToCurrentPage()
{
BrowserMainWindow *mw = static_cast<BrowserMainWindow*>(parent());
WebView *webView = mw->currentTab();
if (webView)
homeLineEdit->setText(QString::fromUtf8(webView->url().toEncoded()));
}
示例5: buffer
void BrowserApplication::restoreLastSession()
{
QList<QByteArray> windows;
QBuffer buffer(&m_lastSession);
QDataStream stream(&buffer);
buffer.open(QIODevice::ReadOnly);
int windowCount;
stream >> windowCount;
for (int i = 0; i < windowCount; ++i) {
QByteArray windowState;
stream >> windowState;
windows.append(windowState);
}
for (int i = 0; i < windows.count(); ++i) {
BrowserMainWindow *newWindow = 0;
if (m_mainWindows.count() == 1
&& mainWindow()->tabWidget()->count() == 1
&& mainWindow()->currentTab()->url() == QUrl()) {
newWindow = mainWindow();
} else {
newWindow = newMainWindow();
}
newWindow->restoreState(windows.at(i));
}
}
示例6: buffer
bool BrowserApplication::restoreLastSession()
{
int version = 2;
QList<QByteArray> windows;
QBuffer buffer(&m_lastSession);
QDataStream stream(&buffer);
buffer.open(QIODevice::ReadOnly);
qint32 marker;
qint32 v;
stream >> marker;
stream >> v;
if (marker != BrowserApplicationMagic || v != version)
return false;
qint32 windowCount;
stream >> windowCount;
for (qint32 i = 0; i < windowCount; ++i) {
QByteArray windowState;
stream >> windowState;
windows.append(windowState);
}
for (int i = 0; i < windows.count(); ++i) {
BrowserMainWindow *newWindow = 0;
if (m_mainWindows.count() == 1
&& mainWindow()->tabWidget()->count() == 1
&& mainWindow()->currentTab()->url() == QUrl()) {
newWindow = mainWindow();
} else {
newWindow = newMainWindow();
}
newWindow->restoreState(windows.at(i));
}
return true;
}
示例7: main
int main(int argc, char *argv[])
{
BrowserApplication a(argc, argv);
//MainWindow w;
BrowserMainWindow w;
QRect maxRect;
{
QDesktopWidget desktop;
maxRect = desktop.availableGeometry();
maxRect.adjust(50,50,-50,-50);
}
w.setGeometry(maxRect);
qDebug() << QApplication::applicationDirPath() << QApplication::applicationFilePath();
{
QPixmap splashPixmap(QApplication::applicationDirPath() + "/comm/conf/pics/splash.png");
QSplashScreen splash(splashPixmap);
splash.show();
enum {
splashTime = 1500
};
QTimer timer;
timer.start(splashTime);
do {
a.processEvents();
splash.showMessage(QString("Loading Process: %1%").arg(timer.remainingTime()*100.0/splashTime),Qt::AlignBottom);
} while(timer.remainingTime() > 1);
splash.finish(&w);
}
w.show();
a.processEvents();
return a.exec();
}
示例8: BrowserMainWindow
BrowserMainWindow *BrowserApplication::newMainWindow(QSharedDataPointer<ProcessOptions> processOptions)
{
BrowserMainWindow *browser = new BrowserMainWindow(processOptions);
m_mainWindows.prepend(browser);
browser->show();
return browser;
}
示例9: BrowserMainWindow
BrowserMainWindow *BrowserApplication::newMainWindow()
{
BrowserMainWindow *browser = new BrowserMainWindow();
m_mainWindows.prepend(browser);
connect(this, SIGNAL(privacyChanged(bool)),
browser, SLOT(slotPrivacyChanged(bool)));
browser->show();
return browser;
}
示例10: Q_UNUSED
QWebPage *WebPage::createWindow(QWebPage::WebWindowType type)
{
Q_UNUSED(type);
if (m_keyboardModifiers & Qt::ControlModifier || m_pressedButtons == Qt::MidButton)
m_openInNewTab = true;
if (m_openInNewTab) {
m_openInNewTab = false;
return mainWindow()->tabWidget()->newTab()->page();
}
BrowserApplication::instance()->newMainWindow();
BrowserMainWindow *mainWindow = BrowserApplication::instance()->mainWindow();
return mainWindow->currentTab()->page();
}
示例11: tr
bool BrowserApplication::restoreLastSession()
{
{
QSettings settings;
settings.beginGroup(QLatin1String("MainWindow"));
if (settings.value(QLatin1String("restoring"), false).toBool()) {
QMessageBox::information(0, tr("Restore failed"),
tr("The saved session will not be restored because Arora crashed while trying to restore this session."));
return false;
}
// saveSession will be called by an AutoSaver timer from the set tabs
// and in saveSession we will reset this flag back to false
settings.setValue(QLatin1String("restoring"), true);
}
int version = 2;
QList<QByteArray> windows;
QBuffer buffer(&m_lastSession);
QDataStream stream(&buffer);
buffer.open(QIODevice::ReadOnly);
qint32 marker;
qint32 v;
stream >> marker;
stream >> v;
if (marker != BrowserApplicationMagic || v != version)
return false;
qint32 windowCount;
stream >> windowCount;
for (qint32 i = 0; i < windowCount; ++i) {
QByteArray windowState;
stream >> windowState;
windows.append(windowState);
}
for (int i = 0; i < windows.count(); ++i) {
BrowserMainWindow *newWindow = 0;
if (i == 0 && m_mainWindows.count() >= 1) {
newWindow = mainWindow();
} else {
newWindow = newMainWindow();
}
newWindow->restoreState(windows.at(i));
}
return true;
}
示例12: text
void LineEdit::keyPressEvent ( QKeyEvent * event )
{
if ( event->key() == Qt::Key_Return && m_fix_url)
{
if (event->modifiers() & Qt::ControlModifier)
{
QString t = text().trimmed();
if (t.length() > 0)
{
if (t.toLower().indexOf("http://") != 0)
{
t = "http://" + t;
}
if (t.toLower().indexOf("www.") != 7)
{
t.insert(7, "www.");
}
int ind = t.indexOf('.', 12);
if ( ind == -1)
{
t += ".com/";
}
else
if (ind == t.length() - 1)
t += "com/";
setText( t );
}
}
}
// ALT+ENTER - open link in a new tab
if (event->key() == Qt::Key_Return && (event->modifiers() & Qt::AltModifier))
{
BrowserMainWindow *mainWindow = BrowserApplication::instance()->mainWindow();
mainWindow->tabWidget()->loadUrlNewTab( BrowserMainWindow::guessUrlFromString( text() ) );
clear();
return;
}
QLineEdit::keyPressEvent(event);
}
示例13: proxyAuthenticationRequired
void NetworkAccessManager::proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *auth)
{
BrowserMainWindow *mainWindow = BrowserApplication::instance()->mainWindow();
QDialog dialog(mainWindow);
dialog.setWindowFlags(Qt::Sheet);
Ui::ProxyDialog proxyDialog;
proxyDialog.setupUi(&dialog);
proxyDialog.iconLabel->setText(QString());
proxyDialog.iconLabel->setPixmap(mainWindow->style()->standardIcon(QStyle::SP_MessageBoxQuestion, 0, mainWindow).pixmap(32, 32));
QString introMessage = tr("<qt>Connect to proxy \"%1\" using:</qt>");
introMessage = introMessage.arg(Qt::escape(proxy.hostName()));
proxyDialog.introLabel->setText(introMessage);
proxyDialog.introLabel->setWordWrap(true);
if (dialog.exec() == QDialog::Accepted) {
auth->setUser(proxyDialog.userNameLineEdit->text());
auth->setPassword(proxyDialog.passwordLineEdit->text());
}
}
示例14: authenticationRequired
void NetworkAccessManager::authenticationRequired(QNetworkReply *reply, QAuthenticator *auth)
{
BrowserMainWindow *mainWindow = BrowserApplication::instance()->mainWindow();
QDialog dialog(mainWindow);
dialog.setWindowFlags(Qt::Sheet);
Ui::PasswordDialog passwordDialog;
passwordDialog.setupUi(&dialog);
passwordDialog.iconLabel->setText(QString());
passwordDialog.iconLabel->setPixmap(mainWindow->style()->standardIcon(QStyle::SP_MessageBoxQuestion, 0, mainWindow).pixmap(32, 32));
QString introMessage = tr("<qt>Enter username and password for \"%1\" at %2</qt>");
introMessage = introMessage.arg(Qt::escape(reply->url().toString())).arg(Qt::escape(reply->url().toString()));
passwordDialog.introLabel->setText(introMessage);
passwordDialog.introLabel->setWordWrap(true);
if (dialog.exec() == QDialog::Accepted) {
auth->setUser(passwordDialog.userNameLineEdit->text());
auth->setPassword(passwordDialog.passwordLineEdit->text());
}
}
示例15: switch
bool BrowserApplication::event(QEvent* event)
{
switch (event->type()) {
case QEvent::ApplicationActivate: {
clean();
if (!m_mainWindows.isEmpty()) {
BrowserMainWindow *mw = mainWindow();
if (mw && !mw->isMinimized()) {
mainWindow()->show();
}
return true;
}
}
case QEvent::FileOpen:
if (!m_mainWindows.isEmpty()) {
mainWindow()->loadPage(static_cast<QFileOpenEvent *>(event)->file());
return true;
}
default:
break;
}
return QApplication::event(event);
}