本文整理汇总了C++中ConfigurationManager类的典型用法代码示例。如果您正苦于以下问题:C++ ConfigurationManager类的具体用法?C++ ConfigurationManager怎么用?C++ ConfigurationManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConfigurationManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
void ActionDialog::on_buttonBox_clicked(QAbstractButton* button)
{
Command cmd;
ConfigurationManager *cm;
switch ( ui->buttonBox->standardButton(button) ) {
case QDialogButtonBox::Ok:
createAction();
break;
case QDialogButtonBox::Save:
cmd.name = cmd.cmd = ui->cmdEdit->currentText();
cmd.input = ui->comboBoxInputFormat->currentText();
cmd.output = ui->comboBoxOutputFormat->currentText();
cmd.sep = ui->separatorEdit->text();
cmd.outputTab = ui->comboBoxOutputTab->currentText();
cm = ConfigurationManager::instance();
cm->addCommand(cmd);
cm->saveSettings();
QMessageBox::information(
this, tr("Command saved"),
tr("Command was saved and can be accessed from item menu.\n"
"You can set up the command in preferences.") );
break;
case QDialogButtonBox::Cancel:
close();
break;
default:
break;
}
}
示例2: restoreHistory
void ActionDialog::restoreHistory()
{
ConfigurationManager *cm = ConfigurationManager::instance();
int maxCount = cm->value("command_history_size").toInt();
ui->comboBoxCommands->setMaxCount(maxCount);
QFile file( dataFilename() );
file.open(QIODevice::ReadOnly);
QDataStream in(&file);
QVariant v;
ui->comboBoxCommands->clear();
ui->comboBoxCommands->addItem(QString());
while( !in.atEnd() ) {
in >> v;
if (v.canConvert(QVariant::String)) {
// backwards compatibility with versions up to 1.8.2
QVariantMap values;
values["cmd"] = v;
ui->comboBoxCommands->addItem(commandToLabel(v.toString()), values);
} else {
QVariantMap values = v.value<QVariantMap>();
ui->comboBoxCommands->addItem(commandToLabel(values["cmd"].toString()), v);
}
}
ui->comboBoxCommands->setCurrentIndex(0);
}
示例3: QWidget
CommandWidget::CommandWidget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::CommandWidget)
{
ui->setupUi(this);
updateWidgets();
#ifdef NO_GLOBAL_SHORTCUTS
ui->checkBoxGlobalShortcut->hide();
ui->shortcutButtonGlobalShortcut->hide();
#else
ui->checkBoxGlobalShortcut->setIcon(iconShortcut());
ui->shortcutButtonGlobalShortcut->setExpectModifier(true);
#endif
ui->groupBoxCommand->setFocusProxy(ui->commandEdit);
ui->checkBoxAutomatic->setIcon(iconClipboard());
ui->checkBoxInMenu->setIcon(iconMenu());
ConfigurationManager *cm = ConfigurationManager::instance();
// Add tab names to combo boxes.
cm->initTabComboBox(ui->comboBoxCopyToTab);
cm->initTabComboBox(ui->comboBoxOutputTab);
// Add formats to combo boxex.
QStringList formats = cm->itemFactory()->formatsToSave();
formats.prepend(mimeText);
formats.removeDuplicates();
setComboBoxItems(ui->comboBoxInputFormat, formats);
setComboBoxItems(ui->comboBoxOutputFormat, formats);
}
示例4:
// Fetches the singleton Configuration Manager object
ConfigurationManager * ConfigurationManager::get() {
static ConfigurationManager ConfigManager;
if (ConfigManager.initialized == false) {
ConfigManager.init();
ConfigManager.initialized = true;
}
return &ConfigManager;
}
示例5: init
void init() {
configuration = ConfigurationManager("next0.txt");
mapLoader = configuration.GetMapLoader();
renderEngine = configuration.GetRenderEngine();
system("mode 650");
utility = Utilities();
playerX = 5;
playerY = 7;
}
示例6: ResourceAccessor
Component::Component(ConfigurationManager& params)
: ResourceAccessor(params, params.getConfigurationNodeForCurrentComponent())
, m_type(params.getTypeForCurrentComponent())
, m_configurationNode(params.getConfigurationNodeForCurrentComponent())
, m_prefix(params.getPrefixForCurrentComponent())
{
// Telling the ConfigurationManager that the object for the group in prefix is about
// to be created
m_confManager->setComponentFromGroupStatusToCreating(m_prefix, this);
// Declaring self as a resource of ours
declareResource(ConfigurationNode::separateLastElement(confPath()).element, this);
}
示例7: loadFromConfiguration
void ClipboardBrowserShared::loadFromConfiguration()
{
ConfigurationManager *cm = ConfigurationManager::instance();
editor = cm->value("editor").toString();
maxItems = cm->value("maxitems").toInt();
formats = ItemFactory::instance()->formatsToSave();
maxImageWidth = cm->value("max_image_width").toInt();
maxImageHeight = cm->value("max_image_height").toInt();
textWrap = cm->value("text_wrap").toBool();
commands = cm->commands();
viMode = cm->value("vi").toBool();
saveOnReturnKey = !cm->value("edit_ctrl_return").toBool();
moveItemOnReturnKey = cm->value("move").toBool();
}
示例8: loadSettings
void ActionDialog::loadSettings()
{
ConfigurationManager *cm = ConfigurationManager::instance();
restoreHistory();
ui->comboBoxInputFormat->clear();
ui->comboBoxInputFormat->addItems(standardFormats);
ui->comboBoxInputFormat->setCurrentIndex(cm->value("action_has_input").toBool() ? 1 : 0);
ui->comboBoxOutputFormat->clear();
ui->comboBoxOutputFormat->addItems(standardFormats);
ui->comboBoxOutputFormat->setCurrentIndex(cm->value("action_has_output").toBool() ? 1 : 0);
ui->separatorEdit->setText(cm->value("action_separator").toString());
ui->comboBoxOutputTab->setEditText(cm->value("action_output_tab").toString());
}
示例9: buildCommandMapping
void CommandMapper::buildCommandMapping()
{
ConfigurationManager* cfgMgr = ConfigurationManager::getSingletonPtr();
InputManager* inputMgr = InputManager::getSingletonPtr();
// First get the movement commands
const NameValuePairList& commands = cfgMgr->getSettings("Movement keys");
for (NameValuePairList::const_iterator it = commands.begin(); it != commands.end(); it++)
{
// Split the path at the ',' character
StringVector keys = Ogre::StringUtil::split(it->second, ",");
for (size_t i = 0; i < keys.size(); i++)
{
mMovementCommands[inputMgr->getScanCode(keys[i])] = getMovement(it->first);
LOG_MESSAGE(Logger::UI,
Ogre::String("Key ") + keys[i] + " ("
+ StringConverter::toString(inputMgr->getScanCode(keys[i]))
+ ") is assigned to movement " + it->first +" ("
+ StringConverter::toString(getMovement(it->first))+")");
}
}
buildCommandMap(mKeyGlobalActions, cfgMgr->getSettings("Action keys"));
buildCommandMap(mKeyMovementControlState, cfgMgr->getSettings("MovementController keys"));
buildCommandMap(mKeyFreeflightControlState, cfgMgr->getSettings("FreeflightController keys"));
buildCommandMap(mKeyDialogControlState, cfgMgr->getSettings("DialogController keys"));
buildCommandMap(mKeyCombatControlState, cfgMgr->getSettings("CombatController keys"));
buildCommandMap(mKeyCutsceneControlState, cfgMgr->getSettings("CutsceneController keys"));
}
示例10: loadFromConfiguration
void ClipboardBrowserShared::loadFromConfiguration()
{
ConfigurationManager *cm = ConfigurationManager::instance();
editor = cm->value("editor").toString();
maxItems = cm->value("maxitems").toInt();
textWrap = cm->value("text_wrap").toBool();
viMode = cm->value("vi").toBool();
saveOnReturnKey = !cm->value("edit_ctrl_return").toBool();
moveItemOnReturnKey = cm->value("move").toBool();
minutesToExpire = cm->value("expire_tab").toInt();
}
示例11: restoreHistory
void ActionDialog::restoreHistory()
{
ConfigurationManager *cm = ConfigurationManager::instance();
int maxCount = cm->value("command_history_size").toInt();
ui->cmdEdit->setMaxCount(maxCount);
QFile file( dataFilename() );
file.open(QIODevice::ReadOnly);
QDataStream in(&file);
QVariant v;
ui->cmdEdit->clear();
while( !in.atEnd() ) {
in >> v;
ui->cmdEdit->addItem(v.toString());
}
ui->cmdEdit->setCurrentIndex(0);
ui->cmdEdit->lineEdit()->selectAll();
}
示例12: c
/**
* The client is requesting an offer.
*
* @returns true.
*
* @param pDhcpMsg The message.
* @param cb The message size.
*/
bool NetworkManager::handleDhcpReqRequest(PCRTNETBOOTP pDhcpMsg, size_t cb)
{
ConfigurationManager *confManager = ConfigurationManager::getConfigurationManager();
/* 1. find client */
Client client = confManager->getClientByDhcpPacket(pDhcpMsg, cb);
/* 2. find bound lease */
Lease l = client.lease();
if (l != Lease::NullLease)
{
if (l.isExpired())
{
/* send client to INIT state */
Client c(client);
nak(client, pDhcpMsg->bp_xid);
confManager->expireLease4Client(c);
return true;
}
else {
/* XXX: Validate request */
RawOption opt;
RT_ZERO(opt);
Client c(client);
int rc = confManager->commitLease4Client(c);
AssertRCReturn(rc, false);
rc = ConfigurationManager::extractRequestList(pDhcpMsg, cb, opt);
AssertRCReturn(rc, false);
ack(client, pDhcpMsg->bp_xid, opt.au8RawOpt, opt.cbRawOpt);
}
}
else
{
nak(client, pDhcpMsg->bp_xid);
}
return true;
}
示例13: getIpv4Address
int VBoxNetDhcp::initNoMain()
{
CmdParameterIterator it;
RTNETADDRIPV4 address = getIpv4Address();
RTNETADDRIPV4 netmask = getIpv4Netmask();
RTNETADDRIPV4 networkId;
networkId.u = address.u & netmask.u;
RTNETADDRIPV4 UpperAddress;
RTNETADDRIPV4 LowerAddress = networkId;
UpperAddress.u = RT_H2N_U32(RT_N2H_U32(LowerAddress.u) | RT_N2H_U32(netmask.u));
for (it = CmdParameterll.begin(); it != CmdParameterll.end(); ++it)
{
switch(it->Key)
{
case 'l':
RTNetStrToIPv4Addr(it->strValue.c_str(), &LowerAddress);
break;
case 'u':
RTNetStrToIPv4Addr(it->strValue.c_str(), &UpperAddress);
break;
case 'b':
break;
}
}
ConfigurationManager *confManager = ConfigurationManager::getConfigurationManager();
AssertPtrReturn(confManager, VERR_INTERNAL_ERROR);
confManager->addNetwork(unconst(g_RootConfig),
networkId,
netmask,
LowerAddress,
UpperAddress);
return VINF_SUCCESS;
}
示例14: localMappings
int VBoxNetDhcp::fetchAndUpdateDnsInfo()
{
ComHostPtr host;
if (SUCCEEDED(virtualbox->COMGETTER(Host)(host.asOutParam())))
{
AddressToOffsetMapping mapIp4Addr2Off;
int rc = localMappings(m_NATNetwork, mapIp4Addr2Off);
/* XXX: here could be several cases: 1. COM error, 2. not found (empty) 3. ? */
AssertMsgRCReturn(rc, ("Can't fetch local mappings"), rc);
RTNETADDRIPV4 address = getIpv4Address();
RTNETADDRIPV4 netmask = getIpv4Netmask();
AddressList nameservers;
rc = hostDnsServers(host, networkid(address, netmask), mapIp4Addr2Off, nameservers);
AssertMsgRCReturn(rc, ("Debug me!!!"), rc);
/* XXX: Search strings */
std::string domain;
rc = hostDnsDomain(host, domain);
AssertMsgRCReturn(rc, ("Debug me!!"), rc);
{
VBoxNetALock(this);
ConfigurationManager *confManager = ConfigurationManager::getConfigurationManager();
confManager->flushAddressList(RTNET_DHCP_OPT_DNS);
for (AddressList::iterator it = nameservers.begin(); it != nameservers.end(); ++it)
confManager->addToAddressList(RTNET_DHCP_OPT_DNS, *it);
confManager->setString(RTNET_DHCP_OPT_DOMAIN_NAME, domain);
}
}
return VINF_SUCCESS;
}
示例15: RT_ZERO
/**
* The client is requesting an offer.
*
* @returns true.
*
* @param pDhcpMsg The message.
* @param cb The message size.
*/
bool NetworkManager::handleDhcpReqDiscover(PCRTNETBOOTP pDhcpMsg, size_t cb)
{
RawOption opt;
RT_ZERO(opt);
/* 1. Find client */
ConfigurationManager *confManager = ConfigurationManager::getConfigurationManager();
Client client = confManager->getClientByDhcpPacket(pDhcpMsg, cb);
/* 2. Find/Bind lease for client */
Lease lease = confManager->allocateLease4Client(client, pDhcpMsg, cb);
AssertReturn(lease != Lease::NullLease, VINF_SUCCESS);
int rc = ConfigurationManager::extractRequestList(pDhcpMsg, cb, opt);
/* 3. Send of offer */
lease.bindingPhase(true);
lease.phaseStart(RTTimeMilliTS());
lease.setExpiration(300); /* 3 min. */
offer4Client(client, pDhcpMsg->bp_xid, opt.au8RawOpt, opt.cbRawOpt);
return VINF_SUCCESS;
}