From f9ed795730acbc3155990e8d99e24447f808fc7f Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Thu, 12 Jan 2017 13:52:45 +0100 Subject: Viewing and editing user agent of default profile --- src/mainwindow.cpp | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index dea9f79..ccf75f3 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -5,6 +5,8 @@ #include #include #include "browser.h" +#include "forms/profiledialog.h" +#include MainWindow::MainWindow(Browser *instance, QUrl defaultUrl, QWidget *parent) : QMainWindow(parent), @@ -17,20 +19,25 @@ MainWindow::MainWindow(Browser *instance, QUrl defaultUrl, QWidget *parent) : browserInstance = instance; Settings settings; + profile = QWebEngineProfile::defaultProfile(); + ui->setupUi(this); resize(settings.value("window/width", 800).toInt(), settings.value("window/height", 600).toInt()); - // Populate the menu bar - // Browser menu - with new window, new tab, open and quit - QMenu *browserMenu = new QMenu(qApp->applicationName(), ui->menuBar); + // Browser menu + browserMenu = new QMenu(qApp->applicationName(), ui->menuBar); + ui->menuBar->addMenu(browserMenu); browserMenu->addAction(tr("New Window"), this, SLOT(handleNewWindow()), QKeySequence(tr("Ctrl+N"))); browserMenu->addAction(tr("New Tab"), this, SLOT(createNewTab()), QKeySequence(tr("Ctrl+T"))); browserMenu->addSeparator(); + browserMenu->addAction(tr("About Qt"), qApp, SLOT(aboutQt())); browserMenu->addAction(tr("Quit"), qApp, SLOT(quit()), QKeySequence(tr("Ctrl+Q"))); - ui->menuBar->addMenu(browserMenu); - // View menu - fullscreen - // Page menu - what page actions? - // Help menu - help contents, about, about qt + + // Profile menu + profileMenu = new QMenu(profile->storageName()); + ui->menuBar->addMenu(profileMenu); + profileMenu->addAction(tr("Edit profile"), this, SLOT(createProfileDialog())); + profileMenu->addAction(tr("Load profile")); this->addToolBar(Qt::TopToolBarArea, navigationToolBar); this->addToolBarBreak(Qt::TopToolBarArea); @@ -103,3 +110,9 @@ void MainWindow::handleTitleUpdated(const QString &title) Settings settings; setWindowTitle(title + settings.value("window/title", "qtwebenginebrowser").toString()); } + +void MainWindow::createProfileDialog() +{ + ProfileDialog *dialog = new ProfileDialog(profile, this); + dialog->exec(); +} -- cgit v1.2.1