本文整理汇总了C++中ConfigManager::ReadSSet方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigManager::ReadSSet方法的具体用法?C++ ConfigManager::ReadSSet怎么用?C++ ConfigManager::ReadSSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigManager
的用法示例。
在下文中一共展示了ConfigManager::ReadSSet方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnButton
void AnnoyingDialog::OnButton(wxCommandEvent& event)
{
if(!m_CheckBox)
cbThrow(_T("Ow... null pointer."));
int id = event.GetId();
// convert IDs from standard buttons to dReturnType
switch (id)
{
case wxID_YES:
id = rtYES;
break;
case wxID_OK:
id = rtOK;
break;
case wxID_NO:
id = rtNO;
break;
case wxID_CANCEL:
id = rtCANCEL;
break;
default:
break;
}
if(m_CheckBox->IsChecked())
{
ConfigManager* cfg = Manager::Get()->GetConfigManager(wxT("an_dlg"));
ConfigManagerContainer::StringSet disabled = cfg->ReadSSet(wxT("/disabled_ret"));
// if we are supposed to remember the users choice, save the button
disabled.insert(m_Id + F(wxT(":%d"), m_DefRet == rtSAVE_CHOICE ? id : m_DefRet));
cfg->Write(wxT("/disabled_ret"), disabled);
}
EndModal(id);
}
示例2: EndModal
void EnvironmentSettingsDlg::EndModal(int retCode)
{
if (retCode == wxID_OK)
{
ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("app"));
ConfigManager *pcfg = Manager::Get()->GetConfigManager(_T("project_manager"));
ConfigManager *mcfg = Manager::Get()->GetConfigManager(_T("message_manager"));
ConfigManager *acfg = Manager::Get()->GetConfigManager(_T("an_dlg"));
// tab "General"
cfg->Write(_T("/environment/single_instance"), (bool) XRCCTRL(*this, "chkSingleInstance", wxCheckBox)->GetValue());
cfg->Write(_T("/environment/use_ipc"), (bool) XRCCTRL(*this, "chkUseIPC", wxCheckBox)->GetValue());
cfg->Write(_T("/environment/raise_via_ipc"), (bool) XRCCTRL(*this, "chkRaiseViaIPC", wxCheckBox)->GetValue());
cfg->Write(_T("/environment/check_associations"), (bool) XRCCTRL(*this, "chkAssociations", wxCheckBox)->GetValue());
cfg->Write(_T("/environment/check_modified_files"), (bool) XRCCTRL(*this, "chkModifiedFiles", wxCheckBox)->GetValue());
cfg->Write(_T("/environment/ignore_invalid_targets"),(bool) XRCCTRL(*this, "chkInvalidTargets", wxCheckBox)->GetValue());
cfg->Write(_T("/console_shell"), XRCCTRL(*this, "txtConsoleShell", wxTextCtrl)->GetValue());
cfg->Write(_T("/console_terminal"), XRCCTRL(*this, "txtConsoleTerm", wxTextCtrl)->GetValue());
// tab "View"
cfg->Write(_T("/environment/blank_workspace"), (bool) XRCCTRL(*this, "rbAppStart", wxRadioBox)->GetSelection() ? true : false);
pcfg->Write(_T("/open_files"), (int) XRCCTRL(*this, "rbProjectOpen", wxRadioBox)->GetSelection());
cfg->Write(_T("/environment/settings_size"), (int) XRCCTRL(*this, "rbSettingsIconsSize", wxRadioBox)->GetSelection());
mcfg->Write(_T("/auto_hide"), (bool) XRCCTRL(*this, "chkAutoHideMessages", wxCheckBox)->GetValue());
mcfg->Write(_T("/auto_show_search"), (bool) XRCCTRL(*this, "chkAutoShowMessagesOnSearch", wxCheckBox)->GetValue());
mcfg->Write(_T("/auto_show_build_warnings"), (bool) XRCCTRL(*this, "chkAutoShowMessagesOnWarn", wxCheckBox)->GetValue());
mcfg->Write(_T("/auto_show_build_errors"), (bool) XRCCTRL(*this, "chkAutoShowMessagesOnErr", wxCheckBox)->GetValue());
mcfg->Write(_T("/save_selection_change_in_mp"), (bool) XRCCTRL(*this, "chkSaveSelectionChangeInMP", wxCheckBox)->GetValue());
cfg->Write(_T("/open_containing_folder"), XRCCTRL(*this, "txtOpenFolder", wxTextCtrl)->GetValue());
cfg->Write(_T("/environment/view/dbl_clk_maximize"), (bool)XRCCTRL(*this, "chkDblClkMaximizes", wxCheckBox)->GetValue());
cfg->Write(_T("/environment/view/layout_to_toggle"), XRCCTRL(*this, "choLayoutToToggle", wxChoice)->GetStringSelection());
cfg->Write(_T("/locale/enable"), (bool) XRCCTRL(*this, "chkI18N", wxCheckBox)->GetValue());
const wxLanguageInfo *info = wxLocale::FindLanguageInfo(XRCCTRL(*this, "cbxLanguage", wxComboBox)->GetStringSelection());
if(info)
cfg->Write(_T("/locale/language"), info->CanonicalName);
else
cfg->Write(_T("/locale/language"), wxEmptyString);
mcfg->Write(_T("/log_font_size"), (int) XRCCTRL(*this, "spnLogFontSize", wxSpinCtrl)->GetValue());
cfg->Write(_T("/dialog_placement/do_place"), (bool) XRCCTRL(*this, "chkDoPlace", wxCheckBox)->GetValue());
cfg->Write(_T("/dialog_placement/dialog_position"), (int) XRCCTRL(*this, "chkPlaceHead", wxCheckBox)->GetValue() ? pdlHead : pdlCentre);
// tab "Appearence"
bool tab_switcher_mode = (bool) XRCCTRL(*this, "chkStackedBasedTabSwitching", wxCheckBox)->GetValue();
if (Manager::Get()->GetConfigManager(_T("app"))->ReadBool(_T("/environment/tabs_stacked_based_switching")) != tab_switcher_mode)
{
if (tab_switcher_mode)
Manager::Get()->GetEditorManager()->RebuildNotebookStack();
else
Manager::Get()->GetEditorManager()->DeleteNotebookStack();
}
cfg->Write(_T("/environment/tabs_stacked_based_switching"), tab_switcher_mode);
bool enableMousewheel = (bool) XRCCTRL(*this, "chkNBUseMousewheel",wxCheckBox)->GetValue();
cfg->Write(_T("/environment/tabs_use_mousewheel"), enableMousewheel);
wxString key = XRCCTRL(*this, "txtMousewheelModifier", wxTextCtrl)->GetValue();
cfg->Write(_T("/environment/tabs_mousewheel_modifier"), key.IsEmpty()?_T("Ctrl"):key);
cfg->Write(_T("/environment/tabs_mousewheel_advance"), (bool) XRCCTRL(*this, "rbNBModToAdvance", wxRadioButton)->GetValue());
cfg->Write(_T("/environment/tabs_invert_advance"), (bool) XRCCTRL(*this, "chkNBInvertAdvance", wxCheckBox)->GetValue());
cfg->Write(_T("/environment/tabs_invert_move"), (bool) XRCCTRL(*this, "chkNBInvertMove", wxCheckBox)->GetValue());
bool useToolTips = (bool)XRCCTRL(*this, "chkNBUseToolTips", wxCheckBox)->GetValue();
cfg->Write(_T("/environment/tabs_use_tooltips"),useToolTips);
cfg->Write(_T("/environment/tabs_dwell_time"), (int) XRCCTRL(*this, "spnNBDwellTime", wxSpinCtrl)->GetValue());
cbAuiNotebook::AllowScrolling(enableMousewheel);
cbAuiNotebook::UseToolTips(useToolTips);
cbAuiNotebook::SetDwellTime(cfg->ReadInt(_T("/environment/tabs_dwell_time"), 1000));
cbAuiNotebook::SetModKeys(cfg->Read(_T("/environment/tabs_mousewheel_modifier"),_T("Ctrl")));
cbAuiNotebook::UseModToAdvance(cfg->ReadBool(_T("/environment/tabs_mousewheel_advance"),false));
cbAuiNotebook::InvertAdvanceDirection(cfg->ReadBool(_T("/environment/tabs_invert_advance"),false));
cbAuiNotebook::InvertMoveDirection(cfg->ReadBool(_T("/environment/tabs_invert_move"),false));
/*
cfg->Write(_T("/environment/aui/border_size"), (int) XRCCTRL(*this, "spnAuiBorder", wxSpinCtrl)->GetValue());
cfg->Write(_T("/environment/aui/sash_size"), (int) XRCCTRL(*this, "spnAuiSash", wxSpinCtrl)->GetValue());
cfg->Write(_T("/environment/aui/caption_size"), (int) XRCCTRL(*this, "spnAuiCaption", wxSpinCtrl)->GetValue());
cfg->Write(_T("/environment/aui/active_caption_colour"), XRCCTRL(*this, "btnAuiActiveCaptionColour", wxButton)->GetBackgroundColour());
cfg->Write(_T("/environment/aui/active_caption_gradient_colour"), XRCCTRL(*this, "btnAuiActiveCaptionGradientColour", wxButton)->GetBackgroundColour());
cfg->Write(_T("/environment/aui/active_caption_text_colour"), XRCCTRL(*this, "btnAuiActiveCaptionTextColour", wxButton)->GetBackgroundColour());
cfg->Write(_T("/environment/aui/inactive_caption_colour"), XRCCTRL(*this, "btnAuiInactiveCaptionColour", wxButton)->GetBackgroundColour());
cfg->Write(_T("/environment/aui/inactive_caption_gradient_colour"), XRCCTRL(*this, "btnAuiInactiveCaptionGradientColour", wxButton)->GetBackgroundColour());
cfg->Write(_T("/environment/aui/inactive_caption_text_colour"), XRCCTRL(*this, "btnAuiInactiveCaptionTextColour", wxButton)->GetBackgroundColour());
m_pArt->SetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE, XRCCTRL(*this, "spnAuiBorder", wxSpinCtrl)->GetValue());
m_pArt->SetMetric(wxAUI_DOCKART_SASH_SIZE, XRCCTRL(*this, "spnAuiSash", wxSpinCtrl)->GetValue());
m_pArt->SetMetric(wxAUI_DOCKART_CAPTION_SIZE, XRCCTRL(*this, "spnAuiCaption", wxSpinCtrl)->GetValue());
m_pArt->SetColour(wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR, XRCCTRL(*this, "btnAuiActiveCaptionColour", wxButton)->GetBackgroundColour());
m_pArt->SetColour(wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR, XRCCTRL(*this, "btnAuiActiveCaptionGradientColour", wxButton)->GetBackgroundColour());
m_pArt->SetColour(wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR, XRCCTRL(*this, "btnAuiActiveCaptionTextColour", wxButton)->GetBackgroundColour());
m_pArt->SetColour(wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR, XRCCTRL(*this, "btnAuiInactiveCaptionColour", wxButton)->GetBackgroundColour());
m_pArt->SetColour(wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR,XRCCTRL(*this, "btnAuiInactiveCaptionGradientColour", wxButton)->GetBackgroundColour());
m_pArt->SetColour(wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR, XRCCTRL(*this, "btnAuiInactiveCaptionTextColour", wxButton)->GetBackgroundColour());
*/
// tab "Dialogs"
wxCheckListBox* lb = XRCCTRL(*this, "chkDialogs", wxCheckListBox);
ConfigManagerContainer::StringSet dialogs = acfg->ReadSSet(_T("/disabled"));
//.........这里部分代码省略.........
示例3: locDir
//.........这里部分代码省略.........
{
wxMenuItemList& items = menuLayouts->GetMenuItems();
for (size_t i = 0; i < items.GetCount() && ! items[i]->IsSeparator() ; ++i)
{
#if wxCHECK_VERSION(2,8,5)
XRCCTRL(*this, "choLayoutToToggle", wxChoice)->Append(items[i]->GetLabelText(items[i]->GetItemLabelText()));
#else
XRCCTRL(*this, "choLayoutToToggle", wxChoice)->Append(items[i]->GetLabelFromText(items[i]->GetLabel()));
#endif
}
}
}
}
sel = XRCCTRL(*this, "choLayoutToToggle", wxChoice)->FindString( cfg->Read(_T("/environment/view/layout_to_toggle"),cfg->Read(_T("/main_frame/layout/default"))));
XRCCTRL(*this, "choLayoutToToggle", wxChoice)->SetSelection(sel != wxNOT_FOUND ? sel : 0);
XRCCTRL(*this, "choLayoutToToggle", wxChoice)->Enable(en);
bool i18n=cfg->ReadBool(_T("/locale/enable"), false);
XRCCTRL(*this, "chkI18N", wxCheckBox)->SetValue(i18n);
wxDir locDir(ConfigManager::GetDataFolder() + _T("/locale"));
wxString locFName;
if(locDir.IsOpened() && locDir.GetFirst(&locFName/*, wxEmptyString, wxDIR_DIRS*/))
do
{
const wxLanguageInfo *info = wxLocale::FindLanguageInfo(locFName);
if(info)
{
XRCCTRL(*this, "cbxLanguage", wxComboBox)->Append(info->Description);
}
}while(locDir.GetNext(&locFName));
XRCCTRL(*this, "cbxLanguage", wxComboBox)->Enable(i18n);
const wxLanguageInfo *info = wxLocale::FindLanguageInfo(cfg->Read(_T("/locale/language")));
if(info)
XRCCTRL(*this, "cbxLanguage", wxComboBox)->SetStringSelection(info->Description);
// tab "Notebook"
XRCCTRL(*this, "chkStackedBasedTabSwitching", wxCheckBox)->SetValue(cfg->ReadBool(_T("/environment/tabs_stacked_based_switching"), 0));
bool enableTabMousewheel = cfg->ReadBool(_T("/environment/tabs_use_mousewheel"),true);
bool modToAdvance = cfg->ReadBool(_T("/environment/tabs_mousewheel_advance"),false);
XRCCTRL(*this, "chkNBUseMousewheel", wxCheckBox)->SetValue(enableTabMousewheel);
XRCCTRL(*this, "rbNBModToAdvance", wxRadioButton)->SetValue(modToAdvance);
XRCCTRL(*this, "rbNBModToMove", wxRadioButton)->SetValue(!modToAdvance);
XRCCTRL(*this, "chkNBInvertAdvance", wxCheckBox)->SetValue(cfg->ReadBool(_T("/environment/tabs_invert_advance"),false));
XRCCTRL(*this, "chkNBInvertMove", wxCheckBox)->SetValue(cfg->ReadBool(_T("/environment/tabs_invert_move"),false));
XRCCTRL(*this, "txtMousewheelModifier", wxTextCtrl)->SetValue(cfg->Read(_T("/environment/tabs_mousewheel_modifier"),_T("Ctrl")));
XRCCTRL(*this, "txtMousewheelModifier", wxTextCtrl)->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(EnvironmentSettingsDlg::OnMousewheelModifier));
XRCCTRL(*this, "rbNBModToAdvance", wxRadioButton)->Enable(enableTabMousewheel);
XRCCTRL(*this, "rbNBModToMove", wxRadioButton)->Enable(enableTabMousewheel);
XRCCTRL(*this, "chkNBInvertAdvance", wxCheckBox)->Enable(enableTabMousewheel);
XRCCTRL(*this, "chkNBInvertMove", wxCheckBox)->Enable(enableTabMousewheel);
XRCCTRL(*this, "txtMousewheelModifier", wxTextCtrl)->Enable(enableTabMousewheel);
bool useToolTips = cfg->ReadBool(_T("/environment/tabs_use_tooltips"),true);
XRCCTRL(*this, "chkNBUseToolTips", wxCheckBox)->SetValue(useToolTips);
XRCCTRL(*this, "spnNBDwellTime", wxSpinCtrl)->SetValue(cfg->ReadInt(_T("/environment/tabs_dwell_time"), 1000));
XRCCTRL(*this, "spnNBDwellTime", wxSpinCtrl)->Enable(useToolTips);
// tab "Docking"
/*
XRCCTRL(*this, "spnAuiBorder", wxSpinCtrl)->SetValue(cfg->ReadInt(_T("/environment/aui/border_size"), m_pArt->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE)));
XRCCTRL(*this, "spnAuiSash", wxSpinCtrl)->SetValue(cfg->ReadInt(_T("/environment/aui/sash_size"), m_pArt->GetMetric(wxAUI_DOCKART_SASH_SIZE)));
XRCCTRL(*this, "spnAuiCaption", wxSpinCtrl)->SetValue(cfg->ReadInt(_T("/environment/aui/caption_size"), m_pArt->GetMetric(wxAUI_DOCKART_CAPTION_SIZE)));
XRCCTRL(*this, "btnAuiActiveCaptionColour", wxButton)->SetBackgroundColour(cfg->ReadColour(_T("/environment/aui/active_caption_colour"), m_pArt->GetColour(wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR)));
XRCCTRL(*this, "btnAuiActiveCaptionGradientColour", wxButton)->SetBackgroundColour(cfg->ReadColour(_T("/environment/aui/active_caption_gradient_colour"), m_pArt->GetColour(wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR)));
XRCCTRL(*this, "btnAuiActiveCaptionTextColour", wxButton)->SetBackgroundColour(cfg->ReadColour(_T("/environment/aui/active_caption_text_colour"), m_pArt->GetColour(wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR)));
XRCCTRL(*this, "btnAuiInactiveCaptionColour", wxButton)->SetBackgroundColour(cfg->ReadColour(_T("/environment/aui/inactive_caption_colour"), m_pArt->GetColour(wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR)));
XRCCTRL(*this, "btnAuiInactiveCaptionGradientColour", wxButton)->SetBackgroundColour(cfg->ReadColour(_T("/environment/aui/inactive_caption_gradient_colour"), m_pArt->GetColour(wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR)));
XRCCTRL(*this, "btnAuiInactiveCaptionTextColour", wxButton)->SetBackgroundColour(cfg->ReadColour(_T("/environment/aui/inactive_caption_text_colour"), m_pArt->GetColour(wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR)));
*/
// tab "Dialogs"
wxCheckListBox* clb = XRCCTRL(*this, "chkDialogs", wxCheckListBox);
clb->Clear();
ConfigManagerContainer::StringSet dialogs = acfg->ReadSSet(_T("/disabled"));
for (ConfigManagerContainer::StringSet::iterator i = dialogs.begin(); i != dialogs.end(); ++i)
clb->Append(*i);
// tab "Network"
XRCCTRL(*this, "txtProxy", wxTextCtrl)->SetValue(cfg->Read(_T("/network_proxy")));
// disable some windows-only settings, in other platforms
#ifndef __WXMSW__
XRCCTRL(*this, "chkAssociations", wxCheckBox)->Enable(false);
XRCCTRL(*this, "btnSetAssocs", wxButton)->Enable(false);
XRCCTRL(*this, "btnManageAssocs", wxButton)->Enable(false);
#endif
// add all plugins configuration panels
AddPluginPanels();
// make sure everything is laid out properly
GetSizer()->SetSizeHints(this);
CentreOnParent();
}
示例4: Init
void AnnoyingDialog::Init(const wxString &caption, const wxString &id, const wxString& message, const wxArtID icon,
dStyle style, const wxString& b1, const wxString& b2, const wxString& b3)
{
m_CheckBox = nullptr;
m_DontAnnoy = false;
m_Id = id;
static_assert(wxMinimumVersion<2,8,12>::eval, "wxWidgets 2.8.12 is required");
ConfigManagerContainer::StringSet disabled;
ConfigManager* cfg = Manager::Get()->GetConfigManager(wxT("an_dlg"));
if (cfg->Exists(wxT("/disabled_ret")))
{
// new config style, includes return code in format:
// "id:dReturnType"
// example:
// "Question XYZ?:4"
disabled = cfg->ReadSSet(wxT("/disabled_ret"));
}
else
{
// if the new config key does not exist, read from the old one
// old keys are in format:
// "id"
disabled = cfg->ReadSSet(wxT("/disabled"));
// and copy it to the new one
cfg->Write(wxT("/disabled_ret"), disabled);
// we do not do an in place upgrade of the format to maintain
// compatibility with previous versions
}
ConfigManagerContainer::StringSet::const_iterator it = disabled.lower_bound(m_Id);
if (it != disabled.end())
{
if (*it == m_Id)
{
// upgrade old settings
m_DontAnnoy = true;
if (m_DefRet == rtSAVE_CHOICE)
m_DefRet = rtYES; // default value
disabled.erase(it);
disabled.insert(m_Id + F(wxT(":%d"), m_DefRet));
// save updated format
cfg->Write(wxT("/disabled_ret"), disabled);
return;
}
else if (it->BeforeLast(wxT(':')) == m_Id)
{
m_DontAnnoy = true;
// read the saved choice and store it for ShowModal() to use
long ret = rtSAVE_CHOICE;
if (it->AfterLast(wxT(':')).ToLong(&ret) && ret != rtSAVE_CHOICE)
{
Manager::Get()->GetLogManager()->Log(*it);
m_DefRet = (dReturnType)ret;
}
else if (m_DefRet == rtSAVE_CHOICE)
m_DefRet = rtYES; // default value
return;
}
}
wxBoxSizer *outerSizer = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer *mainArea = new wxFlexGridSizer(2, 0, 0);
wxStaticBitmap *bitmap = new wxStaticBitmap(this, -1, wxArtProvider::GetBitmap(icon, wxART_MESSAGE_BOX), wxDefaultPosition);
mainArea->Add(bitmap, 0, wxALL, 5);
wxStaticText *txt = new wxStaticText(this, -1, message, wxDefaultPosition, wxDefaultSize, 0);
mainArea->Add( txt, 0, wxALIGN_CENTER|wxALL, 5 );
mainArea->Add( 1, 1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
int numButtons = 0;
dReturnType id1 = rtINVALID;
dReturnType id2 = rtINVALID;
dReturnType id3 = rtINVALID;
wxString bTxt1;
wxString bTxt2;
wxString bTxt3;
if(style == OK || style == ONE_BUTTON)
{
numButtons = 1;
// only one choice, so set m_DefRet
m_DefRet = (style == OK ? rtOK : rtONE);
id1 = m_DefRet;
bTxt1 = b1.IsEmpty() ? wxString(_("&OK")) : b1;
}
else if(style == YES_NO || style == OK_CANCEL || style == TWO_BUTTONS)
{
numButtons = 2;
id1 = (style == YES_NO ? rtYES : (style == OK_CANCEL ? rtOK : rtONE));
id2 = (style == YES_NO ? rtNO : (style == OK_CANCEL ? rtCANCEL : rtTWO));
bTxt1 = b1.IsEmpty() ? (style == YES_NO ? wxString(_("&Yes")) : wxString(_("&OK"))) : b1;
bTxt2 = b2.IsEmpty() ? (style == YES_NO ? wxString(_("&No")) : wxString(_("&Cancel"))) : b2;
// this is the default, so apply correct return type (if it was not set)
if (m_DefRet == rtYES)
m_DefRet = id1;
}
//.........这里部分代码省略.........