mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2025-02-05 08:48:28 +01:00
Arbitration: after the end of turn, give the focus to the rack and select all the letters
This commit is contained in:
parent
537d00714b
commit
7e37cde0c0
4 changed files with 28 additions and 1 deletions
|
@ -630,6 +630,6 @@ void ArbitAssignments::endTurn()
|
||||||
// FIXME: shouldn't be done here
|
// FIXME: shouldn't be done here
|
||||||
setEnabled(!m_game->isFinished());
|
setEnabled(!m_game->isFinished());
|
||||||
|
|
||||||
emit gameUpdated();
|
emit endOfTurn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ signals:
|
||||||
void gameUpdated();
|
void gameUpdated();
|
||||||
void notifyProblem(QString iMsg);
|
void notifyProblem(QString iMsg);
|
||||||
void notifyInfo(QString iMsg);
|
void notifyInfo(QString iMsg);
|
||||||
|
void endOfTurn();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void refresh();
|
void refresh();
|
||||||
|
|
|
@ -66,6 +66,8 @@ ArbitrationWidget::ArbitrationWidget(QWidget *parent,
|
||||||
this, SIGNAL(notifyProblem(QString)));
|
this, SIGNAL(notifyProblem(QString)));
|
||||||
QObject::connect(m_assignmentsWidget, SIGNAL(notifyInfo(QString)),
|
QObject::connect(m_assignmentsWidget, SIGNAL(notifyInfo(QString)),
|
||||||
this, SIGNAL(notifyInfo(QString)));
|
this, SIGNAL(notifyInfo(QString)));
|
||||||
|
QObject::connect(m_assignmentsWidget, SIGNAL(endOfTurn()),
|
||||||
|
this, SLOT(endOfTurnRefresh()));
|
||||||
|
|
||||||
m_keyAccum = new KeyAccumulator(this, 400);
|
m_keyAccum = new KeyAccumulator(this, 400);
|
||||||
|
|
||||||
|
@ -204,6 +206,11 @@ ArbitrationWidget::ArbitrationWidget(QWidget *parent,
|
||||||
this, SIGNAL(requestDefinition(QString)));
|
this, SIGNAL(requestDefinition(QString)));
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
|
// Give focus to the rack
|
||||||
|
// FIXME: for some reason, the focus gets lost later...
|
||||||
|
lineEditRack->setFocus();
|
||||||
|
lineEditRack->selectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -213,9 +220,16 @@ void ArbitrationWidget::refresh()
|
||||||
// Update the rack only if needed, to avoid losing cursor position
|
// Update the rack only if needed, to avoid losing cursor position
|
||||||
QString qrack = qfw(pldRack.toString(PlayedRack::RACK_SIMPLE));
|
QString qrack = qfw(pldRack.toString(PlayedRack::RACK_SIMPLE));
|
||||||
if (qrack != lineEditRack->text()) {
|
if (qrack != lineEditRack->text()) {
|
||||||
|
// Save the selection status
|
||||||
|
bool isAllselected = lineEditRack->text() == lineEditRack->selectedText();
|
||||||
|
|
||||||
// Must be done before updateResultsModel(), because it will
|
// Must be done before updateResultsModel(), because it will
|
||||||
// indirectly call the clearResults() slot
|
// indirectly call the clearResults() slot
|
||||||
lineEditRack->setText(qrack);
|
lineEditRack->setText(qrack);
|
||||||
|
|
||||||
|
// Restore the selection
|
||||||
|
if (isAllselected)
|
||||||
|
lineEditRack->selectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateResultsModel();
|
updateResultsModel();
|
||||||
|
@ -592,6 +606,17 @@ void ArbitrationWidget::selectTableNumber(int key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ArbitrationWidget::endOfTurnRefresh()
|
||||||
|
{
|
||||||
|
// Refresh everything
|
||||||
|
emit gameUpdated();
|
||||||
|
|
||||||
|
// Give focus to the rack
|
||||||
|
lineEditRack->setFocus();
|
||||||
|
lineEditRack->selectAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ArbitrationWidget::updateSelectedMove()
|
void ArbitrationWidget::updateSelectedMove()
|
||||||
{
|
{
|
||||||
bool hasSelection = treeViewResults->selectionModel()->hasSelection();
|
bool hasSelection = treeViewResults->selectionModel()->hasSelection();
|
||||||
|
|
|
@ -72,6 +72,7 @@ private slots:
|
||||||
void updateCoordModel(const QString&);
|
void updateCoordModel(const QString&);
|
||||||
void populateResultsMenu(QMenu &iMenu, const QPoint &iPoint);
|
void populateResultsMenu(QMenu &iMenu, const QPoint &iPoint);
|
||||||
void selectTableNumber(int key);
|
void selectTableNumber(int key);
|
||||||
|
void endOfTurnRefresh();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Encapsulated game, can be NULL
|
/// Encapsulated game, can be NULL
|
||||||
|
|
Loading…
Add table
Reference in a new issue