diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2017-01-12 19:57:00 +0100 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2017-01-12 19:57:00 +0100 |
commit | 8c30d0d5f0ab93c44b6957040fd0a2b3b7749faa (patch) | |
tree | 94500815f9734492c3c61d97aca1b0c4bbcddcd3 /src/mainwindow.cpp | |
parent | Minor bugfixes (diff) | |
download | smolbote-8c30d0d5f0ab93c44b6957040fd0a2b3b7749faa.tar.xz |
Profile config loading and saving
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r-- | src/mainwindow.cpp | 17 |
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);
}
|