aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp34
1 files changed, 13 insertions, 21 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 732bc70..297b571 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -27,8 +27,6 @@
#include <QToolButton>
#include <QStyle>
-#include <QFileDialog>
-
#include <QWebEngineHistory>
#include <QDockWidget>
@@ -46,10 +44,9 @@
MainWindow::MainWindow(std::shared_ptr<Configuration> config, QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
- navigationToolBar(new QToolBar(tr("Navigation"), this)),
- tabToolBar(new QToolBar(tr("Tab bar"), this)),
tabBar(new WebViewTabBar(nullptr, this)),
- m_addressBar(new UrlLineEdit(navigationToolBar)),
+ menuBar(new MainWindowMenuBar(config, this)),
+ m_addressBar(new UrlLineEdit(this)),
m_progressBar(new LoadingBar(this))
{
Q_ASSERT(config);
@@ -60,6 +57,7 @@ MainWindow::MainWindow(std::shared_ptr<Configuration> config, QWidget *parent) :
// set up UI
ui->setupUi(this);
+
QAction *fullscreenAction = new QAction(this);
fullscreenAction->setShortcut(QKeySequence(QString::fromStdString(m_config->value<std::string>("browser.shortcuts.fullscreen").value())));
connect(fullscreenAction, &QAction::triggered, this, &MainWindow::toggleFullscreen);
@@ -70,20 +68,15 @@ MainWindow::MainWindow(std::shared_ptr<Configuration> config, QWidget *parent) :
setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::North);
setTabPosition(Qt::RightDockWidgetArea, QTabWidget::North);
- // Main menu
- menuBar = new MainWindowMenuBar(config, this);
- menuBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
-
// Add the toolbars
// tabToolBar: main menu and tab list
- tabToolBar->setMovable(m_config->value<bool>("browser.ui.tabtoolbarMovable").value());
- tabToolBar->addWidget(menuBar);
+ ui->mainToolBar->setMovable(m_config->value<bool>("browser.ui.tabtoolbarMovable").value());
+ ui->mainToolBar->addWidget(menuBar);
//tabToolBar->addWidget(tabBar);
- this->addToolBar(Qt::TopToolBarArea, tabToolBar);
- this->addToolBarBreak(Qt::TopToolBarArea);
// navigationToolBar: address bar
- navigationToolBar->setMovable(m_config->value<bool>("browser.ui.navtoolbarMovable").value());
+ ui->navigationToolBar->setMovable(m_config->value<bool>("browser.ui.navtoolbarMovable").value());
+ insertToolBarBreak(ui->navigationToolBar);
// page actions
m_backButton = new NavigationButton(NavigationButton::BackButton, this);
@@ -98,12 +91,11 @@ MainWindow::MainWindow(std::shared_ptr<Configuration> config, QWidget *parent) :
tabBar->currentView()->load(tabBar->profile()->homepage());
});
- navigationToolBar->addWidget(m_backButton);
- navigationToolBar->addWidget(m_forwardButton);
- navigationToolBar->addWidget(m_reloadButton);
- navigationToolBar->addWidget(homepageButton);
- navigationToolBar->addWidget(m_addressBar);
- this->addToolBar(Qt::TopToolBarArea, navigationToolBar);
+ ui->navigationToolBar->addWidget(m_backButton);
+ ui->navigationToolBar->addWidget(m_forwardButton);
+ ui->navigationToolBar->addWidget(m_reloadButton);
+ ui->navigationToolBar->addWidget(homepageButton);
+ ui->navigationToolBar->addWidget(m_addressBar);
// connect signals
connect(m_addressBar, &UrlLineEdit::addressEntered, this, [&](const QUrl &url) {
@@ -180,7 +172,7 @@ void MainWindow::newTab(const QUrl &url)
{
if(!m_tabBarAdded) {
m_tabBarAdded = true;
- tabToolBar->addWidget(tabBar);
+ ui->mainToolBar->addWidget(tabBar);
}
tabBar->addTab(url);
}