aboutsummaryrefslogtreecommitdiff
path: root/plugins/ConfigurationEditor/configurationeditorplugin.cpp
blob: bf8a90dabd51d46cee6e0eb6b26ab1a0bff2abe3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "configurationeditorplugin.h"
#include "forms/configurationdialog.h"
#include <QDialog>
#include <QHash>
#include <configuration.h>

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)
{
    auto *dlg = new ConfigurationDialog(browser->getConfiguration(), parent);
    dlg->setAttribute(Qt::WA_DeleteOnClose, true);
    return dlg;
}