diff options
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r-- | src/mainwindow.cpp | 27 |
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();
+}
|