| 104 | } |
| 105 | |
| 106 | void BrowserWindow::init() |
| 107 | { |
| 108 | m_statusBar = new QStatusBar(this); |
| 109 | m_statusBar->setWindowFlag(Qt::ToolTip); |
| 110 | m_statusBar->setVisible(true); |
| 111 | |
| 112 | connect(m_tabWidget, &TabWidget::titleChanged, this, &BrowserWindow::handleWebViewTitleChanged); |
| 113 | connect(m_tabWidget, &TabWidget::linkHovered, this, [this](const QString& url) { |
| 114 | m_statusBar->setVisible(!url.isEmpty()); |
| 115 | m_statusBar->showMessage(url); |
| 116 | }); |
| 117 | connect(m_tabWidget, &TabWidget::loadProgress, this, &BrowserWindow::handleWebViewLoadProgress); |
| 118 | connect(m_tabWidget, &TabWidget::urlChanged, this, [this](const QUrl &url) { |
| 119 | m_urlLineEdit->setText(url.toDisplayString()); |
| 120 | }); |
| 121 | connect(m_tabWidget, &TabWidget::favIconChanged, m_favAction, &QAction::setIcon); |
| 122 | connect(m_tabWidget, &TabWidget::devToolsRequested, this, &BrowserWindow::handleDevToolsRequested); |
| 123 | connect(m_urlLineEdit, &QLineEdit::returnPressed, this, &BrowserWindow::handleReturnPressed); |
| 124 | |
| 125 | QAction *focusUrlLineEditAction = new QAction(this); |
| 126 | addAction(focusUrlLineEditAction); |
| 127 | focusUrlLineEditAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_L)); |
| 128 | connect(focusUrlLineEditAction, &QAction::triggered, this, [this] () { |
| 129 | m_urlLineEdit->setFocus(Qt::ShortcutFocusReason); |
| 130 | }); |
| 131 | |
| 132 | handleWebViewTitleChanged(QString()); |
| 133 | connect(m_tabWidget, &TabWidget::currentChanged, this, [this](int index){ |
| 134 | QWidget* current = m_tabWidget->widget(index); |
| 135 | |
| 136 | emit activeViewChange(current); |
| 137 | emit activeViewPageChanged(); |
| 138 | }); |
| 139 | connect(m_tabWidget, &TabWidget::tabClosing, this, &BrowserWindow::handleTabClosing); |
| 140 | m_tabWidget->createTab(); |
| 141 | } |
| 142 | |
| 143 | QSize BrowserWindow::sizeHint() const |
| 144 | { |
no test coverage detected