本文整理汇总了C++中ConfigGroup类的典型用法代码示例。如果您正苦于以下问题:C++ ConfigGroup类的具体用法?C++ ConfigGroup怎么用?C++ ConfigGroup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConfigGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clear
void ProtocolChooserWidget::loadImpl()
{
clear();
ConfigGroup group = Config().group("protocols");
QVariantMap selected = group.value("list", QVariantMap());
QStandardItem *parent_item = m_model->invisibleRootItem();
ExtensionInfoList exts = extensionList();
for (int i = 0; i < exts.size(); i++) {
const ExtensionInfo &info = exts.at(i);
const QMetaObject *meta = info.generator()->metaObject();
QString name = QString::fromLatin1(MetaObjectBuilder::info(meta, "Protocol"));
if (name.isEmpty())
continue;
if (!m_protocol_items.contains(name)) {
ServiceItem *item = new ServiceItem(Icon("applications-system") ,name);
item->setData(true,ServiceItem::ExclusiveRole);
parent_item->appendRow(item);
m_protocol_items.insert(name,item);
}
QIcon icon = Icon("applications-system");
//TODO Make normal names for the implementation of protocols
ServiceItem *item = new ServiceItem(icon,info.name());
//ServiceItem *item = new ServiceItem(icon,info.name());
item->setToolTip(ServiceChooser::html(info));
item->setCheckable(true);
item->setData(info.description().toString(),DescriptionRole);
if (selected.value(name).toString() == ServiceChooser::className(info))
item->setCheckState(Qt::Checked);
item->setData(ServiceChooser::className(info),ServiceItem::ExtentionInfoRole);
m_protocol_items.value(name)->appendRow(item);
}
}
示例2: if
ConfigGroup *
ConfigGroup::FindSubgroup(const wxChar *szName) const
{
size_t i,
lo = 0,
hi = m_aSubgroups.Count();
int res;
ConfigGroup *pGroup;
while ( lo < hi ) {
i = (lo + hi)/2;
pGroup = m_aSubgroups[i];
#if wxCONFIG_CASE_SENSITIVE
res = wxStrcmp(pGroup->Name(), szName);
#else
res = wxStricmp(pGroup->Name(), szName);
#endif
if ( res > 0 )
hi = i;
else if ( res < 0 )
lo = i + 1;
else
return pGroup;
}
return NULL;
}
示例3: Config
YandexNarodManager::~YandexNarodManager()
{
delete netman;
ConfigGroup group = Config().group("yandex").group("narod");
group.setValue("managerGeometry", saveGeometry());
group.sync();
}
示例4: Config
void KdeSpellerSettings::saveImpl()
{
QString lang = m_ui->dictionaryComboBox->currentDictionary();
ConfigGroup group = Config().group("speller");
group.setValue("autodetect", m_ui->autodetect->isChecked());
group.setValue("language", lang);
KdeSpellerLayer::spellerInstance()->setLanguage(lang);
}
示例5: CreateOneElementGroups
void SzarpConfigs::CreateOneElementGroups(ConfigList* config_groups, ConfigNameHash& titles) {
for (ConfigNameHash::iterator i = titles.begin(); i != titles.end() ; ++i) {
const wxString& prefix = i->first;
ConfigGroup* confgroup = new ConfigGroup;
confgroup->AppendConfig(prefix, titles[prefix]);
confgroup->group_name = titles[prefix];
config_groups->push_back(confgroup);
}
}
示例6: Config
void KdeSpellerLayer::loadSettings()
{
ConfigGroup group = Config().group("speller");
m_autodetect = group.value("autodetect", false);
QString lang = KdeSpellerSettings::suggestLanguage(group.value("language", QString()), speller());
if (!lang.isEmpty())
m_dictionary = lang;
else if (!speller()->availableDictionaries().isEmpty())
m_dictionary = speller()->availableDictionaries().begin().value();
speller()->setLanguage(m_dictionary);
emit dictionaryChanged();
}
示例7: CreateGroups
void SzarpConfigs::CreateGroups(ConfigList* result, MPW& prefix_map, ConfigNameHash &titles) {
for (MPW::iterator i = prefix_map.begin(); i != prefix_map.end(); ++i) {
const set<wxString>& prefixes = i->first;
set<wxString, NoCaseCmp>& words = i->second;
if (prefixes.size() <= 1)
continue;
set<wxString>::iterator j;
wxString title;
for (j = prefixes.begin(); j != prefixes.end(); j++) {
ConfigNameHash::iterator k = titles.find(*j);
if (k != titles.end()) {
title = k->second;
break;
}
}
if (j == prefixes.end())
continue;
ConfigGroup* confgroup = new ConfigGroup;
wxString& group_name = confgroup->group_name;
wxStringTokenizer tknz(title,
_T(" \t\r\n"),
wxTOKEN_STRTOK);
while (tknz.HasMoreTokens()) {
wxString token = tknz.GetNextToken();
if (words.find(token) != words.end())
group_name += token + _T(" ");
}
int prefix_count = 0;
for (set<wxString>::iterator k = prefixes.begin(); k != prefixes.end(); k++) {
ConfigNameHash::iterator l = titles.find(*k);
if (l == titles.end())
continue;
prefix_count++;
confgroup->AppendConfig(*k, l->second);
}
if (prefix_count <= 1) {
delete confgroup;
continue;
}
result->push_back(confgroup);
for (set<wxString>::iterator k = prefixes.begin(); k != prefixes.end(); k++) {
titles.erase(*k);
}
}
}
示例8: GetClass
/**
* @brief
* Returns the value of a configuration class variable
*/
String Config::GetVar(const String &sClass, const String &sVariable)
{
// Get configuration class
ConfigGroup *pClass = GetClass(sClass);
if (pClass) {
// Get attribute
const DynVar *pDynVar = pClass->GetAttribute(sVariable);
if (pDynVar)
return pDynVar->GetString();
}
// Error!
return "";
}
示例9: RenameGroup
bool wxFileConfig::RenameGroup(const wxString& oldName,
const wxString& newName)
{
// check that the group exists
ConfigGroup *group = m_pCurrentGroup->FindSubgroup(oldName);
if ( !group )
return FALSE;
// check that the new group doesn't already exist
if ( m_pCurrentGroup->FindSubgroup(newName) )
return FALSE;
group->Rename(newName);
return TRUE;
}
示例10: path
bool wxFileConfig::DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso)
{
wxConfigPathChanger path(this, key);
if ( !m_pCurrentGroup->DeleteEntry(path.Name()) )
return FALSE;
if ( bGroupIfEmptyAlso && m_pCurrentGroup->IsEmpty() ) {
if ( m_pCurrentGroup != m_pRootGroup ) {
ConfigGroup *pGroup = m_pCurrentGroup;
SetPath(wxT("..")); // changes m_pCurrentGroup!
m_pCurrentGroup->DeleteSubgroupByName(pGroup->Name());
}
//else: never delete the root group
}
return TRUE;
}
示例11: SetClassDefault
/**
* @brief
* Set default configuration settings
*/
bool Config::SetDefault(const String &sClass, const String &sVariable)
{
// Set all classes to default settings?
if (sClass.GetLength())
return SetClassDefault(sClass, sVariable);
else {
// Set a class to default settings
bool bResult = true; // No error by default
Iterator<ConfigGroup*> cIterator = m_lstConfig.GetIterator();
while (cIterator.HasNext()) {
ConfigGroup *pClass = cIterator.Next();
if (!SetClassDefault(pClass->GetClass()->GetClassName(), sVariable))
bResult = false; // Something went wrong
}
// Done
return bResult;
}
}
示例12: setupUi
YandexNarodManager::YandexNarodManager()
{
setupUi(this);
this->setWindowTitle(tr("Yandex.Narod file manager"));
this->setWindowIcon(QIcon(":/icons/yandexnarodplugin.png"));
frameProgress->hide();
frameFileActions->hide();
listWidget->clear();
netman = new YandexNarodNetMan(this);
connect(netman, SIGNAL(statusText(QString)), labelStatus, SLOT(setText(QString)));
connect(netman, SIGNAL(progressMax(int)), progressBar, SLOT(setMaximum(int)));
connect(netman, SIGNAL(progressValue(int)), progressBar, SLOT(setValue(int)));
connect(netman, SIGNAL(newFileItem(FileItem)), this, SLOT(newFileItem(FileItem)));
connect(netman, SIGNAL(finished()), this, SLOT(netmanFinished()));
QPixmap iconimage(":/icons/yandexnarod-icons-files.png");
for (int i=0; i<(iconimage.width()/16); i++) {
QIcon icon(iconimage.copy((i*16),0,16,16));
fileicons.append(icon);
}
fileiconstyles["b-icon-music"] = 0;
fileiconstyles["b-icon-video"] = 1;
fileiconstyles["b-icon-arc"] = 2;
fileiconstyles["b-icon-doc"] = 3;
fileiconstyles["b-icon-soft"] = 4;
fileiconstyles["b-icon-unknown"] = 5;
fileiconstyles["b-icon-picture"] = 14;
uploadwidget=0;
ConfigGroup group = Config().group("yandex").group("narod");
QByteArray geometry = group.value("managerGeometry", QByteArray());
if (!geometry.isEmpty())
restoreGeometry(geometry);
else
centerizeWidget(this);
setAttribute(Qt::WA_QuitOnClose, false);
setAttribute(Qt::WA_DeleteOnClose, true);
}
示例13: result
void YandexNarodAuthorizator::requestAuthorization()
{
if (m_stage > Need) {
if (m_stage == Already)
emit result(Success);
return;
}
ConfigGroup group = Config().group("yandex");
QString login = group.value("login", QString());
QString password = group.value("passwd", QString(), Config::Crypted);
if (login.isEmpty() || password.isEmpty()) {
PasswordDialog *dialog = PasswordDialog::request(
tr("Yandex.Disk authorizarion"),
tr("Enter your Yandex login and password"));
dialog->setLoginEditVisible(true);
dialog->setSaveButtonVisible(false);
connect(dialog, SIGNAL(finished(int)), SLOT(onDialogFinished(int)));
return;
}
return requestAuthorization(login, password);
}
示例14: clear
void ServiceChoooserWidget::loadImpl()
{
clear();
ConfigGroup group = Config().group("services");
QVariantMap selected = group.value("list", QVariantMap());
QStandardItem *parent_item = m_model->invisibleRootItem();
ExtensionInfoList exts = extensionList();
QStringList helper;
for (int i = 0; i < exts.size(); ++i) {
const ExtensionInfo &info = exts.at(i);
const char *serviceName = MetaObjectBuilder::info(info.generator()->metaObject(), "Service");
if (serviceName && *serviceName) {
if (!m_service_items.contains(serviceName)) {
QString localizedName = QT_TRANSLATE_NOOP("Service",serviceName).toString();
int index = qLowerBound(helper, localizedName) - helper.constBegin();
helper.insert(index, localizedName);
ServiceItem *item = new ServiceItem(Icon(serviceIcon(serviceName)),localizedName);
item->setData(true,ServiceItem::ExclusiveRole);
parent_item->insertRow(index, item);
m_service_items.insert(serviceName,item);
}
QIcon icon = !info.icon().name().isEmpty() ?
info.icon() :
Icon("applications-system");
ServiceItem *item = new ServiceItem(icon,info.name());
item->setToolTip(ServiceChoooser::html(info));
item->setCheckable(true);
item->setData(info.description().toString(),DescriptionRole);
if (selected.value(serviceName).toString() == ServiceChoooser::className(info))
item->setCheckState(Qt::Checked);
item->setData(qVariantFromValue(info), ServiceItem::ExtentionInfoRole);
m_service_items.value(serviceName)->appendRow(item);
}
}
}
示例15: Parent
// Return the line which contains "[our name]". If we're still not in the list,
// add our line to it immediately after the last line of our parent group if we
// have it or in the very beginning if we're the root group.
LineList *ConfigGroup::GetGroupLine()
{
if ( m_pLine == NULL ) {
ConfigGroup *pParent = Parent();
// this group wasn't present in local config file, add it now
if ( pParent != NULL ) {
wxString strFullName;
strFullName << wxT("[")
// +1: no '/'
<< FilterOutEntryName(GetFullName().c_str() + 1)
<< wxT("]");
m_pLine = m_pConfig->LineListInsert(strFullName,
pParent->GetLastGroupLine());
pParent->SetLastGroup(this); // we're surely after all the others
}
else {
// we return NULL, so that LineListInsert() will insert us in the
// very beginning
}
}
return m_pLine;
}