summaryrefslogtreecommitdiff
path: root/plugins-unmaintained/PluginLoader/keybinding/pluginLoader.cpp
blob: 387b09ed5df02c0700bee60a691b04a651d0d12a (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/** \file pluginLoader.cpp
\brief Define the session plugin loader test
\author alpha_one_x86 */

#include "pluginLoader.h"
#include "PlatformMacro.h"

#include <QFile>
#include <QDir>

#ifndef Q_OS_UNIX
#error "Only for unix"
#endif

KeyBindPlugin::KeyBindPlugin()
{
    connect(&optionsWidget,&OptionsWidget::sendKeyBind,this,&KeyBindPlugin::setKeyBind);
}

KeyBindPlugin::~KeyBindPlugin()
{
}

void KeyBindPlugin::setResources(OptionInterface * options,const QString &writePath,const QString &pluginPath,const bool &portableVersion)
{
    Q_UNUSED(options);
    Q_UNUSED(writePath);
    Q_UNUSED(pluginPath);
    Q_UNUSED(portableVersion);
    this->optionsEngine=options;
    if(optionsEngine!=NULL)
    {
        QList<QPair<QString, QVariant> > KeysList;
        KeysList.append(qMakePair(QStringLiteral("keySequence"),QString()));
        optionsEngine->addOptionGroup(KeysList);
        optionsWidget.setKeyBind(QKeySequence::fromString(optionsEngine->getOptionValue("keySequence").toString()));
    }
}

/// \brief to get the options widget, NULL if not have
QWidget * KeyBindPlugin::options()
{
    return &optionsWidget;
}

void KeyBindPlugin::newLanguageLoaded()
{
    optionsWidget.retranslate();
}

/// \brief try enable/disable the catching
void KeyBindPlugin::setEnabled(const bool &needBeRegistred)
{
    Q_UNUSED(needBeRegistred);
}

void KeyBindPlugin::setKeyBind(const QKeySequence &keySequence)
{
    optionsEngine->setOptionValue("keySequence",keySequence);
}