From f9ed795730acbc3155990e8d99e24447f808fc7f Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Thu, 12 Jan 2017 13:52:45 +0100 Subject: Viewing and editing user agent of default profile --- src/forms/profiledialog.cpp | 25 +++++++++++++++ src/forms/profiledialog.h | 27 ++++++++++++++++ src/forms/profiledialog.ui | 78 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 src/forms/profiledialog.cpp create mode 100644 src/forms/profiledialog.h create mode 100644 src/forms/profiledialog.ui (limited to 'src/forms') 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 +#include + +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 @@ + + + ProfileDialog + + + + 0 + 0 + 480 + 640 + + + + Dialog + + + + + + + + User Agent + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Close|QDialogButtonBox::Save + + + + + + + + + buttonBox + accepted() + ProfileDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + ProfileDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + -- cgit v1.2.1