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

Method initSet

src/RedisView/AppView/MainWidget.cpp:78–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78void MainWidget::initSet(RedisCluster *redisClient) {
79 _tabIndex = -1;
80 _idbIndex = 0;
81 _iScanKeySeq = 0;
82 _iScanValueSeq = 0;
83 _displayViewTab = true;
84 _displayCmdTab = false;
85 _displayMsgTab = false;
86 _redisSendClient = nullptr;
87 _redisRecvClient = nullptr;
88 _tabPage.clear();
89 _vTaskId.clear();
90 _cmdRsult.clear();
91 _vTreeItemKey.clear();
92
93 QString sPath = QCoreApplication::applicationDirPath() + "/" + IniFileName;
94 QSettings settings(sPath, QSettings::IniFormat);
95 settings.setIniCodec("UTF-8");
96 _isCmdSplit = settings.value("cmdSplit", true).toBool();
97 _isFormat = settings.value("format", true).toBool();
98 _isResp = settings.value("resp", false).toBool();
99 _isText = settings.value("text", true).toBool();
100 _isJson = settings.value("json", false).toBool();
101 _isEnterSend = settings.value("enterSend", true).toBool();
102
103 _redisClient = redisClient;
104 _strConnectName = _redisClient->getConnectName();
105 _isClusterMode = _redisClient->getClusterMode();
106 _isReplicationMode = _redisClient->getReplicationMode();
107 if(_isClusterMode) {
108 _idbNums = 1;
109 } else {
110 if(!_redisClient->getDbNum(_idbNums)) {
111 _idbNums = 1;
112 PubLib::log(tr("获取DB数失败,默认为1"));
113 }
114 }
115 _vClients = _redisClient->getClients(false);
116 _vMasterClients = _redisClient->getClients(true);
117 for(int i = 0; i < _vMasterClients.size(); ++i) {
118 _vMasterClients[i]._client = nullptr;
119 }
120
121 // 线程池至少会存在一个线程
122 _threadPool = QThreadPool::globalInstance(); //全局线程池
123 _threadPool->setMaxThreadCount(MAX_THREAD_COUNT); //最大线程数
124 _threadPool->setExpiryTimeout(5000); //5s
125}
126
127void MainWidget::initSlot() {
128 connect(_closeView, &QAction::triggered, this, &MainWidget::closeView);

Callers

nothing calls this directly

Calls 6

getConnectNameMethod · 0.80
getClusterModeMethod · 0.80
getReplicationModeMethod · 0.80
getDbNumMethod · 0.80
getClientsMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected