MCPcopy Create free account
hub / github.com/cc20110101/RedisView / setEncode

Method setEncode

src/RedisView/AppView/MainWindow.cpp:684–719  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

682}
683
684void MainWindow::setEncode(QString encode) {
685 QList<ClientInfoDialog> vClientInfo;
686 ClientInfoDialog clientInfo;
687 QString sPath = QCoreApplication::applicationDirPath() + "/" + IniFileName;
688 QSettings settings(sPath, QSettings::IniFormat);
689 settings.setIniCodec("UTF-8");
690 int size = settings.beginReadArray("logins");
691 for(int i = 0; i < size; ++i) {
692 settings.setArrayIndex(i);
693 clientInfo._name = settings.value("name").toString().trimmed();
694 clientInfo._encodeAddr = settings.value("addr").toByteArray();
695 clientInfo._encodePasswd = settings.value("passwd").toByteArray();
696 clientInfo._encode = settings.value("encode","GB18030").toString().trimmed();
697 clientInfo._keyPattern = settings.value("keypattern","").toString();
698 clientInfo._valuePattern = settings.value("valuepattern","").toString();
699 vClientInfo << clientInfo;
700 }
701 settings.endArray();
702 settings.remove("logins");
703 settings.beginWriteArray("logins");
704 for(int j =0; j < vClientInfo.size(); ++j) {
705 settings.setArrayIndex(j);
706 settings.setValue("name", vClientInfo[j]._name);
707 settings.setValue("addr", vClientInfo[j]._encodeAddr);
708 settings.setValue("passwd", vClientInfo[j]._encodePasswd);
709 if(_redisClient->getConnectName() == vClientInfo[j]._name)
710 settings.setValue("encode", encode);
711 else
712 settings.setValue("encode", vClientInfo[j]._encode);
713 settings.setValue("keypattern", vClientInfo[j]._keyPattern);
714 settings.setValue("valuepattern", vClientInfo[j]._valuePattern);
715 }
716 settings.endArray();
717 QTextCodec::setCodecForLocale(QTextCodec::codecForName(encode.toLatin1()));
718 Global::gEncode = encode;
719}
720
721void MainWindow::setEncodeIcon() {
722 if(Global::gEncode == "Big5") {

Callers

nothing calls this directly

Calls 2

setValueMethod · 0.80
getConnectNameMethod · 0.80

Tested by

no test coverage detected