aboutsummaryrefslogtreecommitdiff
path: root/plugins/ProfileEditor
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/ProfileEditor')
-rw-r--r--plugins/ProfileEditor/CMakeLists.txt3
-rw-r--r--plugins/ProfileEditor/forms/profilemanagerdialog.cpp8
-rw-r--r--plugins/ProfileEditor/forms/profilemanagerdialog.h6
-rw-r--r--plugins/ProfileEditor/profileeditorplugin.cpp20
-rw-r--r--plugins/ProfileEditor/profileeditorplugin.h4
5 files changed, 23 insertions, 18 deletions
diff --git a/plugins/ProfileEditor/CMakeLists.txt b/plugins/ProfileEditor/CMakeLists.txt
index 2fa3ba8..0308fde 100644
--- a/plugins/ProfileEditor/CMakeLists.txt
+++ b/plugins/ProfileEditor/CMakeLists.txt
@@ -17,7 +17,8 @@ add_library(ProfileEditorPlugin SHARED
)
target_include_directories(ProfileEditorPlugin
- PRIVATE ..)
+ PRIVATE ..
+ PRIVATE ../../src/webengine)
target_link_libraries(ProfileEditorPlugin
PRIVATE Qt5::Widgets
diff --git a/plugins/ProfileEditor/forms/profilemanagerdialog.cpp b/plugins/ProfileEditor/forms/profilemanagerdialog.cpp
index 13f974f..1c4d100 100644
--- a/plugins/ProfileEditor/forms/profilemanagerdialog.cpp
+++ b/plugins/ProfileEditor/forms/profilemanagerdialog.cpp
@@ -1,9 +1,9 @@
#include "profilemanagerdialog.h"
#include "profileview.h"
#include "ui_profilemanagerdialog.h"
-#include <QWebEngineProfile>
+#include <webprofile.h>
-ProfileManagerDialog::ProfileManagerDialog(QHash<QString, QWebEngineProfile *> &profiles, QWidget *parent)
+ProfileManagerDialog::ProfileManagerDialog(QHash<QString, WebProfile *> *profiles, QWidget *parent)
: QDialog(parent)
, ui(new Ui::ProfileManagerDialog)
, profiles(profiles)
@@ -13,7 +13,7 @@ ProfileManagerDialog::ProfileManagerDialog(QHash<QString, QWebEngineProfile *> &
connect(ui->listWidget, &QListWidget::itemPressed, this, &ProfileManagerDialog::showProfile);
showProfile(nullptr);
- for(auto i = profiles.constBegin(); i != profiles.constEnd(); ++i) {
+ for(auto i = profiles->constBegin(); i != profiles->constEnd(); ++i) {
ui->listWidget->addItem(i.key());
}
}
@@ -38,6 +38,6 @@ void ProfileManagerDialog::showProfile(QListWidgetItem *item)
}
ui->groupBox->setVisible(true);
- auto *v = new ProfileView(profiles.value(item->text()), this);
+ auto *v = new ProfileView(profiles->value(item->text()), this);
ui->groupBox->layout()->addWidget(v);
}
diff --git a/plugins/ProfileEditor/forms/profilemanagerdialog.h b/plugins/ProfileEditor/forms/profilemanagerdialog.h
index 9ce177d..ba315ce 100644
--- a/plugins/ProfileEditor/forms/profilemanagerdialog.h
+++ b/plugins/ProfileEditor/forms/profilemanagerdialog.h
@@ -9,14 +9,14 @@ namespace Ui
class ProfileManagerDialog;
}
-class QWebEngineProfile;
+class WebProfile;
class QListWidgetItem;
class ProfileManagerDialog : public QDialog
{
Q_OBJECT
public:
- explicit ProfileManagerDialog(QHash<QString, QWebEngineProfile *> &profiles, QWidget *parent = 0);
+ explicit ProfileManagerDialog(QHash<QString, WebProfile *> *profiles, QWidget *parent = 0);
~ProfileManagerDialog();
private slots:
@@ -24,7 +24,7 @@ private slots:
private:
Ui::ProfileManagerDialog *ui;
- const QHash<QString, QWebEngineProfile *> profiles;
+ const QHash<QString, WebProfile *> *profiles;
};
#endif // PROFILEMANAGERDIALOG_H
diff --git a/plugins/ProfileEditor/profileeditorplugin.cpp b/plugins/ProfileEditor/profileeditorplugin.cpp
index d0341b9..2e7b261 100644
--- a/plugins/ProfileEditor/profileeditorplugin.cpp
+++ b/plugins/ProfileEditor/profileeditorplugin.cpp
@@ -10,26 +10,30 @@
#include "forms/profilemanagerdialog.h"
#include "forms/profileview.h"
#include <QHash>
+#include <webprofile.h>
QHash<QString, std::function<int()>> ProfileEditorPlugin::commands()
{
QHash<QString, std::function<int()>> hash;
- hash.insert("profileEditor:about", []() -> int {
- qDebug("ProfileEditor for smolbote");
- return 0;
- });
- hash.insert("profileEditor:edit", [this]() -> int {
+ hash.insert("edit-profiles-ui", [this]() -> int {
auto *dialog = createWidget(nullptr);
return dialog->exec();
});
+
+ hash.insert("list-profiles", [this]() -> int {
+ for(auto i = profiles->constBegin(); i != profiles->constEnd(); ++i) {
+ qDebug(" - %s", qUtf8Printable(i.key()));
+ }
+ return 0;
+ });
return hash;
}
-void ProfileEditorPlugin::addProfile(const QString &name, QWebEngineProfile *profile)
+void ProfileEditorPlugin::setProfiles(QHash<QString, WebProfile *> *profiles)
{
- Q_CHECK_PTR(profile);
- profiles.insert(name, profile);
+ Q_CHECK_PTR(profiles);
+ this->profiles = profiles;
}
QDialog *ProfileEditorPlugin::createWidget(QWidget *parent)
diff --git a/plugins/ProfileEditor/profileeditorplugin.h b/plugins/ProfileEditor/profileeditorplugin.h
index 7ae0a57..db82cfb 100644
--- a/plugins/ProfileEditor/profileeditorplugin.h
+++ b/plugins/ProfileEditor/profileeditorplugin.h
@@ -25,11 +25,11 @@ public:
QHash<QString, std::function<int()>> commands() override;
// ProfileInterface
- void addProfile(const QString &name, QWebEngineProfile *profile) override;
+ void setProfiles(QHash<QString, WebProfile *> *profiles) override;
QDialog *createWidget(QWidget *parent) override;
private:
- QHash<QString, QWebEngineProfile *> profiles;
+ QHash<QString, WebProfile *> *profiles;
};
#endif //PROFILEEDITOR_PLUGIN_H