aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2017-01-12 13:52:45 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2017-01-12 13:52:45 +0100
commitf9ed795730acbc3155990e8d99e24447f808fc7f (patch)
treea2ddea654465485dc56747e3d092ca06f671b1a9 /src/mainwindow.cpp
parentNew Window action now works (diff)
downloadsmolbote-f9ed795730acbc3155990e8d99e24447f808fc7f.tar.xz
Viewing and editing user agent of default profile
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp27
1 files changed, 20 insertions, 7 deletions
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 <QCloseEvent>
#include <QMessageBox>
#include "browser.h"
+#include "forms/profiledialog.h"
+#include <QApplication>
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();
+}