From 5825451aef1a762bfaeff2d37c09b3790deee7b1 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Tue, 26 Jun 2018 19:51:52 +0200 Subject: Socket messages are json formatted --- src/mainwindow/subwindow.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/mainwindow/subwindow.cpp') diff --git a/src/mainwindow/subwindow.cpp b/src/mainwindow/subwindow.cpp index 354e07e..bcddabf 100644 --- a/src/mainwindow/subwindow.cpp +++ b/src/mainwindow/subwindow.cpp @@ -31,14 +31,14 @@ SubWindow::SubWindow(const QHash &config, QWidget *parent, Qt: resize(800, 600); setWidget(tabWidget); - profile = WebProfile::defaultProfile(); + m_profile = WebProfile::defaultProfile(); // system menu { auto *menu = systemMenu(); menu->addSeparator(); - auto *profileName_action = menu->addAction(tr("Profile: %1").arg(profile->name())); + auto *profileName_action = menu->addAction(tr("Profile: %1").arg(m_profile->name())); profileName_action->setEnabled(false); auto *loadProfile_menu = menu->addMenu(tr("Load profile")); @@ -130,16 +130,21 @@ WebView *SubWindow::view(int index) const void SubWindow::setProfile(WebProfile *profile) { Q_CHECK_PTR(profile); - this->profile = profile; + this->m_profile = profile; for(int i = 0; i < tabWidget->count(); ++i) { auto *view = qobject_cast(tabWidget->widget(i)); view->setProfile(profile); } } +WebProfile *SubWindow::profile() const +{ + return m_profile; +} + int SubWindow::addTab(const QUrl &url) { - auto *view = new WebView(profile, this); + auto *view = new WebView(m_profile, this); if(!url.isEmpty()) view->load(url); return tabWidget->addTab(view); @@ -153,7 +158,7 @@ void SubWindow::setCurrentTab(int index) QJsonObject SubWindow::session() const { QJsonObject obj; - obj.insert("profile", ProfileManager::id(profile)); + obj.insert("profile", ProfileManager::id(m_profile)); QJsonArray tabs; for(int i = 0; i < tabWidget->count(); ++i) { -- cgit v1.2.1