diff options
Diffstat (limited to 'src/rekonqwindow.cpp')
-rw-r--r-- | src/rekonqwindow.cpp | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/src/rekonqwindow.cpp b/src/rekonqwindow.cpp index c2355afb..dff85dfb 100644 --- a/src/rekonqwindow.cpp +++ b/src/rekonqwindow.cpp @@ -19,18 +19,42 @@ RekonqWindow::RekonqWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::RekonqWindow) { ui->setupUi(this); + + connect(ui->tabs, &QTabBar::currentChanged, this, [this](int index) { + auto *view = ui->tabs->view(index); + Q_CHECK_PTR(view); + + ui->views->setCurrentWidget(view); + ui->urlBar->setCurrentView(view); + }); + connect(ui->tabs, &TabBar::removeView, this, [this](RekonqView *view) { ui->views->removeWidget(view); }); + + // connect actions connect(ui->actionSettings, &QAction::triggered, this, [this]() { (new SettingsDialog(Application::instance()->settings(), this))->show(); }); connect(ui->actionTaskManager, &QAction::triggered, this, [this]() { (new TaskManager(this))->show(); }); + + connect(ui->newTab, &QToolButton::clicked, this, + [this]() { Application::instance()->newView(QUrl("http://duckduckgo.com"), this); }); } RekonqWindow::~RekonqWindow() { delete ui; } void RekonqWindow::addView(RekonqView *view) { - const auto tabId = ui->tabWidget->addTab(view, view->title()); - connect(view, &RekonqView::titleChanged, this, - [this, tabId](const QString &title) { ui->tabWidget->setTabText(tabId, title); }); + Q_CHECK_PTR(view); + + ui->views->addWidget(view); + ui->tabs->addTab(view); + connect(view, &RekonqView::urlChanged, ui->urlBar, &UrlBar::setUrl); + connect(view, &RekonqView::titleChanged, [this, view](const QString &title) { + const auto index = ui->views->indexOf(view); + ui->tabs->setTabText(index, view->title()); + }); + + connect(view, &RekonqView::loadStarted, ui->urlBar, &UrlBar::loadStarted); + connect(view, &RekonqView::loadProgress, ui->urlBar, &UrlBar::loadProgress); + connect(view, &RekonqView::loadFinished, ui->urlBar, &UrlBar::loadFinished); } /* |