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

Method reOpenClient

src/RedisView/AppView/MainWidget.cpp:26–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24}
25
26void MainWidget::reOpenClient() {
27 _idbIndex = 0;
28 _vClients.clear();
29 _vMasterClients.clear();
30 _vClients = _redisClient->getClients(false);
31 _vMasterClients = _redisClient->getClients(true);
32 for(int i = 0; i < _vMasterClients.size(); ++i) {
33 _vMasterClients[i]._client = nullptr;
34 }
35
36 ui->_ipComboBox->clear();
37 _isClusterMode = _redisClient->getClusterMode();
38 _isReplicationMode = _redisClient->getReplicationMode();
39 if(_isClusterMode) {
40 _idbNums = 1;
41 QString clientInfo;
42 ui->_ipComboBox->addItem("Cluster mode");
43 for(int j = 0; j < _vClients.size(); ++j) {
44 _vClients[j]._client = nullptr;
45 clientInfo = QString("%1:%2:%3")
46 .arg(_vClients[j]._host)
47 .arg(_vClients[j]._port)
48 .arg(_vClients[j]._master ? "Master" : "Slave");
49 ui->_ipComboBox->addItem(clientInfo);
50 }
51 } else if(_isReplicationMode) {
52 if(!_redisClient->getDbNum(_idbNums)) {
53 _idbNums = 1;
54 }
55 QString clientInfo;
56 ui->_ipComboBox->addItem("Replication mode");
57 for(int j = 0; j < _vClients.size(); ++j) {
58 _vClients[j]._client = nullptr;
59 clientInfo = QString("%1:%2:%3")
60 .arg(_vClients[j]._host)
61 .arg(_vClients[j]._port)
62 .arg(_vClients[j]._master ? "Master" : "Slave");
63 ui->_ipComboBox->addItem(clientInfo);
64 }
65 } else {
66 for(int j = 0; j < _vClients.size(); ++j) {
67 _vClients[j]._client = nullptr;
68 }
69 if(!_redisClient->getDbNum(_idbNums)) {
70 _idbNums = 1;
71 }
72 ui->_ipComboBox->addItem("Singleton mode");
73 }
74
75 initKeyView();
76}
77
78void MainWidget::initSet(RedisCluster *redisClient) {
79 _tabIndex = -1;

Callers 1

refreshConnInfoMethod · 0.80

Calls 5

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

Tested by

no test coverage detected