mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 01:23:24 -08:00
Fix remaining review threads on the alts search controls
- Disable keyboard tracking on the depth and window spin boxes so typing a two-digit value sends one search, not one per digit. - Reload the user under investigation on a filter change instead of reading the search box, which could switch to a name never submitted. - Keep a chip's last match count while it is unchecked; the server omits unchecked match types, so the label used to drop to "(0)".
This commit is contained in:
parent
a82d8f3021
commit
a1a5aae467
2 changed files with 23 additions and 5 deletions
|
|
@ -95,6 +95,7 @@ TabAlts::TabAlts(TabSupervisor *_tabSupervisor, AbstractClient *_client, const Q
|
||||||
depthSpin->setMinimum(1);
|
depthSpin->setMinimum(1);
|
||||||
depthSpin->setMaximum(MAX_ALT_DEPTH);
|
depthSpin->setMaximum(MAX_ALT_DEPTH);
|
||||||
depthSpin->setValue(1);
|
depthSpin->setValue(1);
|
||||||
|
depthSpin->setKeyboardTracking(false);
|
||||||
connect(depthSpin, &QSpinBox::valueChanged, this, &TabAlts::onSearchFilterChanged);
|
connect(depthSpin, &QSpinBox::valueChanged, this, &TabAlts::onSearchFilterChanged);
|
||||||
|
|
||||||
investigateButton = new QPushButton;
|
investigateButton = new QPushButton;
|
||||||
|
|
@ -145,6 +146,7 @@ TabAlts::TabAlts(TabSupervisor *_tabSupervisor, AbstractClient *_client, const Q
|
||||||
monthsSpin->setMinimum(1);
|
monthsSpin->setMinimum(1);
|
||||||
monthsSpin->setMaximum(24);
|
monthsSpin->setMaximum(24);
|
||||||
monthsSpin->setValue(6);
|
monthsSpin->setValue(6);
|
||||||
|
monthsSpin->setKeyboardTracking(false);
|
||||||
connect(monthsSpin, &QSpinBox::valueChanged, this, &TabAlts::onSearchFilterChanged);
|
connect(monthsSpin, &QSpinBox::valueChanged, this, &TabAlts::onSearchFilterChanged);
|
||||||
|
|
||||||
auto *filterBar = new QHBoxLayout;
|
auto *filterBar = new QHBoxLayout;
|
||||||
|
|
@ -355,12 +357,17 @@ void TabAlts::investigateUser()
|
||||||
}
|
}
|
||||||
currentUser = userName;
|
currentUser = userName;
|
||||||
updateTrail();
|
updateTrail();
|
||||||
|
reloadCurrentUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TabAlts::reloadCurrentUser()
|
||||||
|
{
|
||||||
lastAlts.clear();
|
lastAlts.clear();
|
||||||
selectedUser.clear();
|
selectedUser.clear();
|
||||||
clearDetails();
|
clearDetails();
|
||||||
altsTable->setRowCount(0);
|
altsTable->setRowCount(0);
|
||||||
statusLabel->setText(tr("Loading alts for %1...").arg(currentUser));
|
statusLabel->setText(tr("Loading alts for %1...").arg(currentUser));
|
||||||
requestAlts(userName, depthSpin->value());
|
requestAlts(currentUser, depthSpin->value());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabAlts::requestAlts(const QString &userName, int depth)
|
void TabAlts::requestAlts(const QString &userName, int depth)
|
||||||
|
|
@ -445,9 +452,17 @@ void TabAlts::renderTable()
|
||||||
++ipCount;
|
++ipCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
emailChip->setText(tr("Email (%1)").arg(emailCount));
|
// The server omits unchecked match types, so keep the last count while a
|
||||||
clientIdChip->setText(tr("Client ID (%1)").arg(clientIdCount));
|
// chip is off instead of relabelling it "(0)".
|
||||||
ipChip->setText(tr("IP (%1)").arg(ipCount));
|
if (emailChip->isChecked()) {
|
||||||
|
emailChip->setText(tr("Email (%1)").arg(emailCount));
|
||||||
|
}
|
||||||
|
if (clientIdChip->isChecked()) {
|
||||||
|
clientIdChip->setText(tr("Client ID (%1)").arg(clientIdCount));
|
||||||
|
}
|
||||||
|
if (ipChip->isChecked()) {
|
||||||
|
ipChip->setText(tr("IP (%1)").arg(ipCount));
|
||||||
|
}
|
||||||
|
|
||||||
QFont userFont = altsTable->font();
|
QFont userFont = altsTable->font();
|
||||||
userFont.setBold(true);
|
userFont.setBold(true);
|
||||||
|
|
@ -538,7 +553,9 @@ void TabAlts::onSearchFilterChanged()
|
||||||
if (currentUser.isEmpty()) {
|
if (currentUser.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
investigateUser();
|
// A filter change reloads the user being investigated; it must not switch
|
||||||
|
// to a name that was typed into the search box but never submitted.
|
||||||
|
reloadCurrentUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabAlts::onDisplayFilterChanged()
|
void TabAlts::onDisplayFilterChanged()
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ private:
|
||||||
void loadUser(const QString &userName);
|
void loadUser(const QString &userName);
|
||||||
void goToTrailEntry(const QString &userName);
|
void goToTrailEntry(const QString &userName);
|
||||||
void updateTrail();
|
void updateTrail();
|
||||||
|
void reloadCurrentUser();
|
||||||
void requestAlts(const QString &userName, int depth);
|
void requestAlts(const QString &userName, int depth);
|
||||||
void requestDetails(const QString &userName);
|
void requestDetails(const QString &userName);
|
||||||
void clearDetails();
|
void clearDetails();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue