aboutsummaryrefslogtreecommitdiff
path: root/plugins/ConfigurationEditor/configurationeditorplugin.cpp
blob: 0d44a8a64971d7da6225b6ec9fd91f671a8700a2 (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 <QHash>
#include <QDialog>
#include "forms/configurationdialog.h"
#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;
}