aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2017-01-12 19:57:00 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2017-01-12 19:57:00 +0100
commit8c30d0d5f0ab93c44b6957040fd0a2b3b7749faa (patch)
tree94500815f9734492c3c61d97aca1b0c4bbcddcd3 /src/mainwindow.cpp
parentMinor bugfixes (diff)
downloadsmolbote-8c30d0d5f0ab93c44b6957040fd0a2b3b7749faa.tar.xz
Profile config loading and saving
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index fef3bcc..1f27652 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -20,7 +20,16 @@ MainWindow::MainWindow(Browser *instance, QUrl defaultUrl, QWidget *parent) :
browserInstance = instance;
Settings settings;
- profile = QWebEngineProfile::defaultProfile();
+ // Create the profile
+ profileName = settings.value("defaults/profile").toString();
+ if(profileName.isEmpty()) {
+ qDebug("Creating off-the-record profile");
+ profileName = tr("Off the record");
+ profile = new WebEngineProfile(this);
+ } else {
+ qDebug("Using profile: %s", qUtf8Printable(profileName));
+ profile = new WebEngineProfile(profileName, this);
+ }
ui->setupUi(this);
resize(settings.value("window/width", 800).toInt(), settings.value("window/height", 600).toInt());
@@ -36,11 +45,13 @@ MainWindow::MainWindow(Browser *instance, QUrl defaultUrl, QWidget *parent) :
// Profile menu
QMenuBar *rightBar = new QMenuBar(ui->menuBar);
- profileMenu = new QMenu(tr("Profile: ") + profile->storageName());
+ profileMenu = new QMenu(tr("Profile: ") + profileName);
rightBar->addMenu(profileMenu);
ui->menuBar->setCornerWidget(rightBar);
profileMenu->addAction(tr("Edit profile"), this, SLOT(createProfileDialog()));
profileMenu->addAction(tr("Load profile"));
+ profileMenu->addAction(tr("Settings"));
+ profileMenu->addAction(tr("Cookies"));
this->addToolBar(Qt::TopToolBarArea, navigationToolBar);
this->addToolBarBreak(Qt::TopToolBarArea);
@@ -66,6 +77,8 @@ MainWindow::~MainWindow()
void MainWindow::createNewTab(const QUrl &url)
{
QWebEngineView *view = new QWebEngineView(0);
+ QWebEnginePage *page = new QWebEnginePage(profile, view);
+ view->setPage(page);
view->load(url);
tabBar->addTab(view);
}