MCPcopy Create free account
hub / github.com/cinience/RedisStudio / DoApplyData

Method DoApplyData

RedisStudio/RedisConfigUI.cpp:138–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136}
137
138void RedisConfigUI::DoApplyData()
139{
140 CEditUI exampleEditUI;
141 CComboUI exampleComboUI;
142
143 RedisClient::TDicConfig::const_iterator it = m_dicConfig.begin();
144 RedisClient::TDicConfig::const_iterator itend = m_dicConfig.end();
145 RedisClient::TDicConfig config;
146 for ( ; it!=itend; ++it)
147 {
148 CDuiString name = _T("redisconfig_");
149 CDuiString key = Base::CharacterSet::ANSIToUnicode(it->first).c_str();
150 name.Append(key);
151 CControlUI* pCtl = GetPaintMgr()->FindControl(name);
152 if (pCtl == NULL) continue;
153 string val ;
154 if (pCtl->GetClass() == exampleEditUI.GetClass())
155 {
156 CEditUI* pEdit = static_cast<CEditUI*> (pCtl);
157 val = Base::CharacterSet::UnicodeToANSI(pEdit->GetText().GetData());
158 }
159 else if (pCtl->GetClass() == exampleComboUI.GetClass())
160 {
161 CComboUI* pCombo = static_cast<CComboUI*> (pCtl);
162 int idx = pCombo->GetCurSel();
163 if (it->first == "loglevel")
164 {
165 if (idx == 0) val = "debug";
166 else if (idx == 1) val = "verbose";
167 else if (idx == 2) val = "notice";
168 else if (idx == 3) val = "warning";
169 }
170 else
171 {
172 if (idx == 0) val = "yes";
173 else if (idx == 1) val = "no";
174 }
175 }
176 if (val != it->second)
177 {
178 config.insert(std::make_pair(it->first, val));
179 }
180 }
181 if (SetConfig(config) && GetConfig())
182 {
183 DoFillData();
184 }
185}

Callers

nothing calls this directly

Calls 6

AppendMethod · 0.80
FindControlMethod · 0.45
GetClassMethod · 0.45
GetDataMethod · 0.45
GetTextMethod · 0.45
GetCurSelMethod · 0.45

Tested by

no test coverage detected