From c88b4129ffd06b9a230a2621cbcf3610905fc15c Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Fri, 1 Jun 2018 16:25:09 +0200 Subject: Add ProfileManagerDialog --- src/browser.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/browser.cpp b/src/browser.cpp index b10ff6a..be9d6b5 100644 --- a/src/browser.cpp +++ b/src/browser.cpp @@ -35,7 +35,7 @@ inline QVector loadPlugins(const QString &location) if(loader.load()) { #ifdef QT_DEBUG - qDebug("Loading plugin: %s [ok]", qUtf8Printable(name)); + qDebug("Loading plugin: %s [ok]", qUtf8Printable(pluginsDir.absoluteFilePath(name))); #endif Plugin p; p.instance = std::shared_ptr(loader.instance()); @@ -125,8 +125,12 @@ void Browser::setup(const QString &defaultProfile) if(p.instance->inherits("ProfileInterface")) { auto *profileEditor = qobject_cast(p.instance.get()); Q_ASSERT_X(profileEditor != nullptr, "Browser::setup", "profile interface cast failed"); - m_commands.insert("profileEditor:editDefaultProfile", [profileEditor]() -> int { - return profileEditor->createWidget(WebProfile::defaultProfile(), nullptr)->exec(); + m_commands.insert("profileEditor:edit", [this, profileEditor]() -> int { + QHash p; + for(const QString &key : m_profiles.keys()) { + p.insert(key, m_profiles.value(key)); + } + return profileEditor->createWidget(p, nullptr)->exec(); }); } } @@ -229,9 +233,13 @@ MainWindow *Browser::createWindow() auto *profileEditor = qobject_cast(p.instance.get()); if(profileEditor) { auto *profileAction = new QAction(tr("Profile"), window); - connect(profileAction, &QAction::triggered, window, [profileEditor]() { - //window->currentSubWindow() - profileEditor->createWidget(WebProfile::defaultProfile(), nullptr)->show(); + connect(profileAction, &QAction::triggered, window, [this, profileEditor]() { + QHash p; + for(const QString &key : m_profiles.keys()) { + p.insert(key, m_profiles.value(key)); + } + profileEditor->createWidget(p, nullptr)->show(); + //profileEditor->createWidget(WebProfile::defaultProfile(), nullptr)->show(); }); window->addAction(MainWindow::ToolsMenu, profileAction); } -- cgit v1.2.1