From fff127333ac7b105429de53759f13a38ff934e83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Teuli=C3=A8re?= Date: Fri, 20 Jan 2012 12:57:11 +0100 Subject: [PATCH] Added a column for the total score of the player --- qt/history_widget.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/qt/history_widget.cpp b/qt/history_widget.cpp index 70d2d14..5f8eaa5 100644 --- a/qt/history_widget.cpp +++ b/qt/history_widget.cpp @@ -103,8 +103,8 @@ void HistoryWidget::updateModel() m_model->removeRows(0, m_model->rowCount()); if (m_forPlayer) { - // Empty column - m_model->setHeaderData(5, Qt::Horizontal, "", Qt::DisplayRole); + // Display the cumulative score + m_model->setHeaderData(5, Qt::Horizontal, _q("Total"), Qt::DisplayRole); } else { @@ -120,6 +120,7 @@ void HistoryWidget::updateModel() if (!align) m_model->insertRow(0); + int totalScore = 0; for (unsigned int i = 0; i < m_history->getSize(); ++i) { int rowNum = m_model->rowCount(); @@ -140,11 +141,16 @@ void HistoryWidget::updateModel() m_model->setData(m_model->index(prevRowNum, 1), qfw(t.getPlayedRack().toString())); m_model->setData(m_model->index(rowNum, 4), m.getScore()); + totalScore += m.getScore(); if (!m_forPlayer && m_game != NULL) { const wstring &name = m_game->getPlayer(t.getPlayer()).getName(); m_model->setData(m_model->index(rowNum, 5), qfw(name)); } + else + { + m_model->setData(m_model->index(rowNum, 5), totalScore); + } // Set the rest if (m.getType() == Move::VALID_ROUND)