aboutsummaryrefslogtreecommitdiff
path: root/plugins/ProfileEditor/forms
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/ProfileEditor/forms')
-rw-r--r--plugins/ProfileEditor/forms/profilemanagerdialog.cpp45
-rw-r--r--plugins/ProfileEditor/forms/profilemanagerdialog.h31
-rw-r--r--plugins/ProfileEditor/forms/profilemanagerdialog.ui89
3 files changed, 165 insertions, 0 deletions
diff --git a/plugins/ProfileEditor/forms/profilemanagerdialog.cpp b/plugins/ProfileEditor/forms/profilemanagerdialog.cpp
new file mode 100644
index 0000000..c5fec2b
--- /dev/null
+++ b/plugins/ProfileEditor/forms/profilemanagerdialog.cpp
@@ -0,0 +1,45 @@
+#include "profilemanagerdialog.h"
+#include "ui_profilemanagerdialog.h"
+#include <QWebEngineProfile>
+#include <QLabel>
+#include "profileview.h"
+
+ProfileManagerDialog::ProfileManagerDialog(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::ProfileManagerDialog)
+{
+ ui->setupUi(this);
+
+ connect(ui->listWidget, &QListWidget::itemPressed, this, &ProfileManagerDialog::showProfile);
+ showProfile(nullptr);
+}
+
+ProfileManagerDialog::~ProfileManagerDialog()
+{
+ delete ui;
+}
+
+void ProfileManagerDialog::addProfile(const QString &name, QWebEngineProfile *profile)
+{
+ profiles.insert(name, profile);
+ ui->listWidget->addItem(name);
+}
+
+void ProfileManagerDialog::showProfile(QListWidgetItem *item)
+{
+ // clear out groupbox layout
+ QLayoutItem *i;
+ while((i = ui->groupBox->layout()->takeAt(0)) != nullptr) {
+ delete i->widget();
+ delete i;
+ }
+
+ if(item == nullptr) {
+ ui->groupBox->setVisible(false);
+ return;
+ }
+ ui->groupBox->setVisible(true);
+
+ 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
new file mode 100644
index 0000000..ed79824
--- /dev/null
+++ b/plugins/ProfileEditor/forms/profilemanagerdialog.h
@@ -0,0 +1,31 @@
+#ifndef PROFILEMANAGERDIALOG_H
+#define PROFILEMANAGERDIALOG_H
+
+#include <QDialog>
+#include <QHash>
+
+namespace Ui {
+class ProfileManagerDialog;
+}
+
+class QWebEngineProfile;
+class QListWidgetItem;
+class ProfileManagerDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit ProfileManagerDialog(QWidget *parent = 0);
+ ~ProfileManagerDialog();
+
+ void addProfile(const QString &name, QWebEngineProfile *profile);
+
+private slots:
+ void showProfile(QListWidgetItem *item);
+
+private:
+ Ui::ProfileManagerDialog *ui;
+ QHash<QString, QWebEngineProfile *> profiles;
+};
+
+#endif // PROFILEMANAGERDIALOG_H
diff --git a/plugins/ProfileEditor/forms/profilemanagerdialog.ui b/plugins/ProfileEditor/forms/profilemanagerdialog.ui
new file mode 100644
index 0000000..ae3829a
--- /dev/null
+++ b/plugins/ProfileEditor/forms/profilemanagerdialog.ui
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ProfileManagerDialog</class>
+ <widget class="QDialog" name="ProfileManagerDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Profile Manager</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QListWidget" name="listWidget">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2"/>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Close</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>ProfileManagerDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>ProfileManagerDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>