aboutsummaryrefslogtreecommitdiff
path: root/src/about
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2020-04-25 22:09:13 +0300
committerAqua-sama <aqua@iserlohn-fortress.net>2020-05-26 12:50:15 +0300
commit0492a063806b6d63e4f378908b809de104a24820 (patch)
tree2e285d0c9b5067dc9395bfb751fe84bb8ac2a5f4 /src/about
parentlibwebengine (diff)
downloadsmolbote-0492a063806b6d63e4f378908b809de104a24820.tar.xz
Update ProfileEditor plugin
ProfileEditor: - add tests - disable read-only settings on otr profiles Add WebProfile::setHeaders and WebProfile::setCookies
Diffstat (limited to 'src/about')
-rw-r--r--src/about/aboutdialog.ui5
-rw-r--r--src/about/aboutplugin.cpp60
-rw-r--r--src/about/aboutplugin.h3
-rw-r--r--src/about/aboutplugin.ui53
4 files changed, 39 insertions, 82 deletions
diff --git a/src/about/aboutdialog.ui b/src/about/aboutdialog.ui
index 5b1c12a..036474c 100644
--- a/src/about/aboutdialog.ui
+++ b/src/about/aboutdialog.ui
@@ -134,11 +134,6 @@
</item>
</layout>
</widget>
- <widget class="QWidget" name="tab">
- <attribute name="title">
- <string>Plugins</string>
- </attribute>
- </widget>
</widget>
</item>
<item>
diff --git a/src/about/aboutplugin.cpp b/src/about/aboutplugin.cpp
index 92e55bb..a011b47 100644
--- a/src/about/aboutplugin.cpp
+++ b/src/about/aboutplugin.cpp
@@ -12,57 +12,12 @@
#include <QPluginLoader>
#include <QToolButton>
-QTreeWidgetItem *createItem(const QString &key, const QJsonValue &json, QTreeWidgetItem *parent)
-{
- auto *item = new QTreeWidgetItem(parent, { key, QLatin1String("---") });
-
- switch(json.type()) {
- case QJsonValue::Bool:
- item->setText(1, json.toBool() ? QLatin1String("true") : QLatin1String("false"));
- break;
-
- case QJsonValue::Double:
- item->setText(1, QString::number(json.toDouble()));
- break;
-
- case QJsonValue::String:
- item->setText(1, json.toString());
- break;
-
- case QJsonValue::Array:
- item->setText(1, QString());
- for(const auto &v : json.toArray()) {
- createItem(QString(), v, item);
- }
- break;
-
- case QJsonValue::Object:
- item->setText(1, QString());
- for(const QString &k : json.toObject().keys()) {
- createItem(k, json.toObject()[k], item);
- }
- break;
-
- case QJsonValue::Null:
- item->setText(1, QLatin1String("null"));
- break;
-
- case QJsonValue::Undefined:
- item->setText(1, QLatin1String("undefined"));
- break;
- }
-
- return item;
-}
-
AboutPluginDialog::AboutPluginDialog(QWidget *parent)
: QDialog(parent)
, ui(new Ui::AboutPluginDialog)
{
setAttribute(Qt::WA_DeleteOnClose, true);
ui->setupUi(this);
-
-
}
AboutPluginDialog::~AboutPluginDialog()
@@ -85,20 +40,17 @@ void AboutPluginDialog::add(QPluginLoader *loader)
auto *enable_btn = new QToolButton(this);
enable_btn->setCheckable(true);
enable_btn->setChecked(loader->isLoaded());
+ enable_btn->setText(loader->isLoaded() ? "loaded" : "unloaded");
ui->tableWidget->setCellWidget(index, 4, enable_btn);
- connect(enable_btn, &QToolButton::clicked, this, [ loader, enable_btn ](bool checked) {
+ connect(enable_btn, &QToolButton::clicked, this, [this, loader, enable_btn](bool checked) {
const bool success = checked ? loader->load() : loader->unload();
if(!success) {
enable_btn->setChecked(!checked);
- //ui->error->setText(loader->errorString());
+ ui->msg->setText(loader->errorString());
+ } else {
+ ui->msg->setText(checked ? "Plugin successfully loaded" : "Plugin successfully unloaded");
+ enable_btn->setText(checked ? "loaded" : "unloaded");
}
});
-
- for(const QString &key : metadata.keys()) {
- auto *i = createItem(key, metadata.value(key), nullptr);
- if(i != nullptr) {
- ui->details_treeWidget->insertTopLevelItem(0, i);
- }
- }
}
diff --git a/src/about/aboutplugin.h b/src/about/aboutplugin.h
index b01cc78..f9cd3d4 100644
--- a/src/about/aboutplugin.h
+++ b/src/about/aboutplugin.h
@@ -24,6 +24,9 @@ public:
explicit AboutPluginDialog(QWidget *parent = nullptr);
~AboutPluginDialog() override;
+signals:
+ void loadPlugin(const QString &path);
+
public slots:
void add(QPluginLoader *loader);
diff --git a/src/about/aboutplugin.ui b/src/about/aboutplugin.ui
index d4291e5..5f44886 100644
--- a/src/about/aboutplugin.ui
+++ b/src/about/aboutplugin.ui
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>600</width>
+ <width>900</width>
<height>420</height>
</rect>
</property>
@@ -19,6 +19,9 @@
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
+ <attribute name="verticalHeaderVisible">
+ <bool>false</bool>
+ </attribute>
<column>
<property name="text">
<string>Name</string>
@@ -52,28 +55,32 @@
</widget>
</item>
<item>
- <widget class="QTreeWidget" name="details_treeWidget">
- <column>
- <property name="text">
- <string>Key</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Value</string>
- </property>
- </column>
- </widget>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Close</set>
- </property>
- </widget>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QToolButton" name="add_toolButton">
+ <property name="text">
+ <string>Add</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="msg">
+ <property name="text">
+ <string>text</string>
+ </property>
+ </widget>
+ </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>
</item>
</layout>
</widget>