diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-04-25 17:20:18 +0300 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-04-29 17:23:25 +0300 |
commit | 24a55ed0785b4ec02b69e3a7a3e36ee9a45cc458 (patch) | |
tree | 1dc30b013e6b0fc6fc0650207c6b6c21a0c8e141 /plugins | |
parent | Add libfuzzer test to libconfiguration (diff) | |
download | smolbote-24a55ed0785b4ec02b69e3a7a3e36ee9a45cc458.tar.xz |
Cleanup
- Don't run configuration fuzzer as test
- Remove plugins/ConfigurationEditor
- Move exported interfaces to include/smolbote
- Install plugin interfaces
Diffstat (limited to 'plugins')
7 files changed, 0 insertions, 294 deletions
diff --git a/plugins/ConfigurationEditor/ConfigurationEditor.json b/plugins/ConfigurationEditor/ConfigurationEditor.json deleted file mode 100644 index 5c9d504..0000000 --- a/plugins/ConfigurationEditor/ConfigurationEditor.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "Configuration Editor", - "author": "Aqua-sama", - "shortcut": "Ctrl+Shift+C" -} diff --git a/plugins/ConfigurationEditor/configurationeditorplugin.cpp b/plugins/ConfigurationEditor/configurationeditorplugin.cpp deleted file mode 100644 index 1f60cc0..0000000 --- a/plugins/ConfigurationEditor/configurationeditorplugin.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This file is part of smolbote. It's copyrighted by the contributors recorded - * in the version control history of the file, available from its original - * location: https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote - * - * SPDX-License-Identifier: GPL-3.0 - */ - -#include "configurationeditorplugin.h" -#include "forms/configurationdialog.h" -#include <QDialog> -#include <QHash> - -CommandHash_t ConfigurationEditorPlugin::commands() -{ - QHash<QString, std::function<int()>> hash; - - hash.insert("configure", [this]() -> int { - auto *dlg = createWidget(nullptr); - return dlg->exec(); - }); - - return hash; -} - -QDialog *ConfigurationEditorPlugin::createWidget(QWidget *parent) const -{ - auto *app = browser(); - Q_CHECK_PTR(app); - - auto *dlg = new ConfigurationDialog(parent); - dlg->setAttribute(Qt::WA_DeleteOnClose, true); - - for(const QString &key : app->configurationOptions()) { - dlg->addOption(key, app->configuration(key)); - } - dlg->ui->settings_treeWidget->resizeColumnToContents(0); - dlg->ui->shortcuts_treeWidget->resizeColumnToContents(0); - - connect(dlg, &ConfigurationDialog::configurationChanged, dlg, [app](const QString &key, const QString &value) { - app->setConfiguration(key, value); - }); - - return dlg; -} diff --git a/plugins/ConfigurationEditor/configurationeditorplugin.h b/plugins/ConfigurationEditor/configurationeditorplugin.h deleted file mode 100644 index 7e7ebc6..0000000 --- a/plugins/ConfigurationEditor/configurationeditorplugin.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * This file is part of smolbote. It's copyrighted by the contributors recorded - * in the version control history of the file, available from its original - * location: https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote - * - * SPDX-License-Identifier: GPL-3.0 - */ - -#ifndef CONFIGURATIONEDITOR_PLUGIN_H -#define CONFIGURATIONEDITOR_PLUGIN_H - -#include <QVector> -#include <plugininterface.h> - -class QDialog; -class ConfigurationEditorPlugin : public QObject, public PluginInterface -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID PluginInterfaceIid FILE "ConfigurationEditor.json") - Q_INTERFACES(PluginInterface) - -public: - // PluginInterface - CommandHash_t commands() override; - QDialog *createWidget(QWidget *parent = nullptr) const override; -}; - -#endif // CONFIGURATIONEDITOR_PLUGIN_H diff --git a/plugins/ConfigurationEditor/forms/configurationdialog.cpp b/plugins/ConfigurationEditor/forms/configurationdialog.cpp deleted file mode 100644 index f433d70..0000000 --- a/plugins/ConfigurationEditor/forms/configurationdialog.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This file is part of smolbote. It's copyrighted by the contributors recorded - * in the version control history of the file, available from its original - * location: https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote - * - * SPDX-License-Identifier: GPL-3.0 - */ - -#include "configurationdialog.h" -#include <QKeySequenceEdit> -#include <QLineEdit> - -ConfigurationDialog::ConfigurationDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::ConfigurationDialog) -{ - ui->setupUi(this); -} - -ConfigurationDialog::~ConfigurationDialog() -{ - delete ui; -} - -void ConfigurationDialog::addOption(const QString &key, const QString &value) -{ - QTreeWidgetItem *item = nullptr; - - if(key.contains(QLatin1Literal("shortcut"))) { - item = new QTreeWidgetItem(ui->shortcuts_treeWidget); - - auto *edit = new QKeySequenceEdit(value); - ui->shortcuts_treeWidget->setItemWidget(item, 1, edit); - - connect(edit, &QKeySequenceEdit::keySequenceChanged, this, [this, key](const QKeySequence &keySequence) { - emit configurationChanged(key, keySequence.toString()); - }); - - } else { - item = new QTreeWidgetItem(ui->settings_treeWidget); - - auto *edit = new QLineEdit(value); - ui->settings_treeWidget->setItemWidget(item, 1, edit); - - connect(edit, &QLineEdit::editingFinished, this, [this, key, edit]() { - emit configurationChanged(key, edit->text()); - }); - } - item->setText(0, key); -} diff --git a/plugins/ConfigurationEditor/forms/configurationdialog.h b/plugins/ConfigurationEditor/forms/configurationdialog.h deleted file mode 100644 index fd07aa8..0000000 --- a/plugins/ConfigurationEditor/forms/configurationdialog.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of smolbote. It's copyrighted by the contributors recorded - * in the version control history of the file, available from its original - * location: https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote - * - * SPDX-License-Identifier: GPL-3.0 - */ - -#ifndef CONFIGURATIONDIALOG_H -#define CONFIGURATIONDIALOG_H - -#include <QDialog> -#include "ui_configurationdialog.h" - -class ConfigurationDialog : public QDialog -{ - Q_OBJECT - - friend class ConfigurationEditorPlugin; - -public: - explicit ConfigurationDialog(QWidget *parent = nullptr); - ~ConfigurationDialog(); - - void addOption(const QString &key, const QString &value); - -signals: - void configurationChanged(const QString &key, const QString &value); - -private: - Ui::ConfigurationDialog *ui; -}; - -#endif // CONFIGURATIONDIALOG_H diff --git a/plugins/ConfigurationEditor/forms/configurationdialog.ui b/plugins/ConfigurationEditor/forms/configurationdialog.ui deleted file mode 100644 index 738d4a1..0000000 --- a/plugins/ConfigurationEditor/forms/configurationdialog.ui +++ /dev/null @@ -1,119 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>ConfigurationDialog</class> - <widget class="QDialog" name="ConfigurationDialog"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>800</width> - <height>600</height> - </rect> - </property> - <property name="windowTitle"> - <string>Configuration</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QTabWidget" name="tabWidget"> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="settings_tab"> - <attribute name="title"> - <string>Settings</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <item> - <widget class="QTreeWidget" name="settings_treeWidget"> - <property name="editTriggers"> - <set>QAbstractItemView::NoEditTriggers</set> - </property> - <column> - <property name="text"> - <string>Name</string> - </property> - </column> - <column> - <property name="text"> - <string>Value</string> - </property> - </column> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="shortcuts_tab"> - <attribute name="title"> - <string>Shortcuts</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <widget class="QTreeWidget" name="shortcuts_treeWidget"> - <property name="editTriggers"> - <set>QAbstractItemView::NoEditTriggers</set> - </property> - <column> - <property name="text"> - <string notr="true">Name</string> - </property> - </column> - <column> - <property name="text"> - <string>Value</string> - </property> - </column> - </widget> - </item> - </layout> - </widget> - </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> - </widget> - <resources/> - <connections> - <connection> - <sender>buttonBox</sender> - <signal>accepted()</signal> - <receiver>ConfigurationDialog</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>ConfigurationDialog</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> diff --git a/plugins/ConfigurationEditor/meson.build b/plugins/ConfigurationEditor/meson.build deleted file mode 100644 index 96acccc..0000000 --- a/plugins/ConfigurationEditor/meson.build +++ /dev/null @@ -1,13 +0,0 @@ -ConfigurationEditorPlugin_moc = mod_qt5.preprocess( - include_directories: include, - moc_headers: ['configurationeditorplugin.h', 'forms/configurationdialog.h'], - ui_files: ['forms/configurationdialog.ui'], - dependencies: dep_qt5 -) - -ConfigurationEditorPlugin_lib = shared_library('ConfigurationEditorPlugin', - [interfaces_moc, ConfigurationEditorPlugin_moc, 'configurationeditorplugin.cpp', 'forms/configurationdialog.cpp'], - dependencies: dep_qt5, - include_directories: include, - install: true, install_dir: join_paths(get_option('libdir'), 'smolbote/plugins') -) |