forked from alphaonex86/Ultracopier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LocalPluginOptions.cpp
executable file
·59 lines (51 loc) · 1.84 KB
/
LocalPluginOptions.cpp
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
/** \file LocalPluginOptions.cpp
\brief To bind the options of the plugin, into unique group options
\author alpha_one_x86
\licence GPL3, see the file COPYING */
#include "LocalPluginOptions.h"
LocalPluginOptions::LocalPluginOptions(const std::string &group)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start(\""+group+"\",[...])");
groupOptionAdded=false;
this->group=group;
connect(OptionEngine::optionEngine,&OptionEngine::resetOptions,this,&OptionInterface::resetOptions);//unsure
}
LocalPluginOptions::~LocalPluginOptions()
{
if(groupOptionAdded)
{
if(OptionEngine::optionEngine!=NULL)
OptionEngine::optionEngine->removeOptionGroup(group);
}
}
/// \brief To add option group to options
bool LocalPluginOptions::addOptionGroup(const std::vector<std::pair<std::string, std::string> > &KeysList)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start(\""+group+"\",[...])");
if(groupOptionAdded)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"Group already added!");
return false;
}
else
{
groupOptionAdded=true;
return OptionEngine::optionEngine->addOptionGroup(group,KeysList);
}
}
/// \brief To get option value
std::string LocalPluginOptions::getOptionValue(const std::string &variableName) const
{
return OptionEngine::optionEngine->getOptionValue(group,variableName);
}
/// \brief To set option value
void LocalPluginOptions::setOptionValue(const std::string &variableName,const std::string &value)
{
OptionEngine::optionEngine->setOptionValue(group,variableName,value);
}
// can be externally changed via reset
/*void LocalPluginOptions::newOptionValue(const std::string &group, const std::string &variable, const std::string &value)
{
if(group==this->group)
emit newOptionValue(variable,value);
}*/