ledgerupdate testing
This commit is contained in:
@@ -220,6 +220,11 @@ private slots:
|
||||
historyIndex = commandHistory.size(); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
|
||||
// <20>洢<EFBFBD><E6B4A2>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>
|
||||
if (!currentCommand.isEmpty() && command != "up" && command != "down" && command != "\x7f") {
|
||||
currentCommand.append(command);
|
||||
}
|
||||
|
||||
// <20><><EFBFBD>ͻ<EFBFBD><CDBB>˷<EFBFBD><CBB7>͡<EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>롱<EFBFBD><EBA1B1><EFBFBD><EFBFBD>
|
||||
clientSocket->write("Received command\n> ");
|
||||
clientSocket->flush();
|
||||
@@ -281,6 +286,12 @@ private slots:
|
||||
rocketmq_test_set(); // <20><><EFBFBD><EFBFBD> set <20><><EFBFBD><EFBFBD>
|
||||
clientSocket->write("Executed rocketmq_test_set\n> ");
|
||||
}
|
||||
else if (command.startsWith("only")) {
|
||||
qDebug() << "Executing rocketmq_test_only()";
|
||||
std::cout << "Executing rocketmq_test_only()\n";
|
||||
rocketmq_test_only(); // <20><><EFBFBD><EFBFBD> set <20><><EFBFBD><EFBFBD>
|
||||
clientSocket->write("Executed rocketmq_test_only\n> ");
|
||||
}
|
||||
else if (command.startsWith("ledger")) {
|
||||
qDebug() << "Executing ledger()";
|
||||
std::cout << "Executing ledger()\n";
|
||||
@@ -326,26 +337,29 @@ private slots:
|
||||
}
|
||||
}
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD>
|
||||
else if (command == "up" || command == "down") {
|
||||
// <20><><EFBFBD>¼<EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EEB4A6>
|
||||
if (command == "up") {
|
||||
// <20>ϼ<EFBFBD>ͷ<EFBFBD><CDB7>ѡ<EFBFBD><D1A1>ǰһ<C7B0><D2BB><EFBFBD><EFBFBD>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD>
|
||||
if (historyIndex > 0) {
|
||||
historyIndex--;
|
||||
}
|
||||
} else if (command == "down") {
|
||||
// <20>¼<EFBFBD>ͷ<EFBFBD><CDB7>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD>
|
||||
if (historyIndex < commandHistory.size() - 1) {
|
||||
historyIndex++;
|
||||
}
|
||||
}
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD><EEA3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD>
|
||||
if (historyIndex >= 0 && historyIndex < commandHistory.size()) {
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʷ
|
||||
if (command == "up") {
|
||||
if (historyIndex > 0) {
|
||||
historyIndex--;
|
||||
clientSocket->write(commandHistory[historyIndex].toUtf8());
|
||||
} else {
|
||||
clientSocket->write("No history available\n> ");
|
||||
clientSocket->write("No previous command\n> ");
|
||||
}
|
||||
} else if (command == "down") {
|
||||
if (historyIndex < commandHistory.size() - 1) {
|
||||
historyIndex++;
|
||||
clientSocket->write(commandHistory[historyIndex].toUtf8());
|
||||
} else {
|
||||
clientSocket->write("No next command\n> ");
|
||||
}
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> backspace <20><>
|
||||
else if (command == "\x7f") {
|
||||
if (!currentCommand.isEmpty()) {
|
||||
currentCommand.chop(1); // ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ַ<EFBFBD>
|
||||
clientSocket->write(currentCommand.toUtf8());
|
||||
}
|
||||
clientSocket->flush();
|
||||
}
|
||||
// <20><><EFBFBD><EFBFBD> exit <20><><EFBFBD><EFBFBD>
|
||||
else if (command == "exit") {
|
||||
@@ -369,6 +383,7 @@ signals:
|
||||
private:
|
||||
QList<QString> commandHistory; // <20>洢<EFBFBD><E6B4A2>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD>
|
||||
int historyIndex = -1; // <20><>ǰ<EFBFBD><C7B0>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
QString currentCommand; // <20><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>
|
||||
QTcpServer *server;
|
||||
QTimer *timer;
|
||||
int TEST_NUM;
|
||||
|
||||
Reference in New Issue
Block a user