| 618 | } |
| 619 | |
| 620 | void NetHackQtMenuWindow::InputCount(char key) |
| 621 | { |
| 622 | if (key == '\b' || key == '\177' || how == PICK_NONE) { |
| 623 | if (counting) { |
| 624 | if (countstr.isEmpty()) |
| 625 | ClearCount(); |
| 626 | else |
| 627 | countstr = countstr.mid(0, countstr.size() - 1); |
| 628 | } |
| 629 | } else { |
| 630 | counting = true; |
| 631 | // starting a count (enforced by caller) with '#' is optional; |
| 632 | // if used, show visible '0' |
| 633 | if (key == '#') |
| 634 | key = '0'; |
| 635 | // if we have non-zero digit and are currently showing visible '0', |
| 636 | // replace instead of append; doesn't attempt to handle multiple |
| 637 | // leading zeroes--they won't affect the outcome, just look odd |
| 638 | else if (key > '0' && countstr == "0") |
| 639 | countstr = ""; |
| 640 | countstr += QChar(key); |
| 641 | } |
| 642 | if (counting) |
| 643 | prompt.setText("Count: " + countstr); |
| 644 | } |
| 645 | |
| 646 | void NetHackQtMenuWindow::ClearCount(void) |
| 647 | { |
nothing calls this directly
no outgoing calls
no test coverage detected