aboutsummaryrefslogtreecommitdiff
path: root/src/forms
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2017-01-12 13:52:45 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2017-01-12 13:52:45 +0100
commitf9ed795730acbc3155990e8d99e24447f808fc7f (patch)
treea2ddea654465485dc56747e3d092ca06f671b1a9 /src/forms
parentNew Window action now works (diff)
downloadsmolbote-f9ed795730acbc3155990e8d99e24447f808fc7f.tar.xz
Viewing and editing user agent of default profile
Diffstat (limited to 'src/forms')
-rw-r--r--src/forms/profiledialog.cpp25
-rw-r--r--src/forms/profiledialog.h27
-rw-r--r--src/forms/profiledialog.ui78
3 files changed, 130 insertions, 0 deletions
diff --git a/src/forms/profiledialog.cpp b/src/forms/profiledialog.cpp
new file mode 100644
index 0000000..14279c4
--- /dev/null
+++ b/src/forms/profiledialog.cpp
@@ -0,0 +1,25 @@
+#include "profiledialog.h"
+#include "ui_profiledialog.h"
+
+ProfileDialog::ProfileDialog(QWebEngineProfile *profile, QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::ProfileDialog)
+{
+ _profile = profile;
+
+ ui->setupUi(this);
+ ui->userAgent_lineEdit->setText(_profile->httpUserAgent());
+
+ connect(this, SIGNAL(accepted()), this, SLOT(saveProfile()));
+}
+
+ProfileDialog::~ProfileDialog()
+{
+ delete ui;
+}
+
+void ProfileDialog::saveProfile()
+{
+ qDebug("Saving profile...");
+ _profile->setHttpUserAgent(ui->userAgent_lineEdit->text());
+}
diff --git a/src/forms/profiledialog.h b/src/forms/profiledialog.h
new file mode 100644
index 0000000..98426d0
--- /dev/null
+++ b/src/forms/profiledialog.h
@@ -0,0 +1,27 @@
+#ifndef PROFILEDIALOG_H
+#define PROFILEDIALOG_H
+
+#include <QDialog>
+#include <QWebEngineProfile>
+
+namespace Ui {
+class ProfileDialog;
+}
+
+class ProfileDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit ProfileDialog(QWebEngineProfile *profile, QWidget *parent = 0);
+ ~ProfileDialog();
+
+private slots:
+ void saveProfile();
+
+private:
+ QWebEngineProfile *_profile;
+ Ui::ProfileDialog *ui;
+};
+
+#endif // PROFILEDIALOG_H
diff --git a/src/forms/profiledialog.ui b/src/forms/profiledialog.ui
new file mode 100644
index 0000000..160743b
--- /dev/null
+++ b/src/forms/profiledialog.ui
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ProfileDialog</class>
+ <widget class="QDialog" name="ProfileDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>480</width>
+ <height>640</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>User Agent</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="userAgent_lineEdit"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Close|QDialogButtonBox::Save</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>ProfileDialog</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>ProfileDialog</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>