[Parley-devel] [parley] src/practice: Fix display of progress bar.
Andreas Cord-Landwehr
cordlandwehr at kde.org
Wed Feb 5 22:36:39 UTC 2014
Git commit 993e2135827e781758ddf63941f6034b5a92d82f by Andreas Cord-Landwehr.
Committed on 05/02/2014 at 22:32.
Pushed by cordlandwehr into branch 'master'.
Fix display of progress bar.
Correctly count number of correctly answered words and fix computation
of progress percentage.
CCMAIL: parley-devel at kde.org, cquike at ovi.com
M +4 -3 src/practice/guifrontend.cpp
M +1 -1 src/practice/practicestatemachine.cpp
http://commits.kde.org/parley/993e2135827e781758ddf63941f6034b5a92d82f
diff --git a/src/practice/guifrontend.cpp b/src/practice/guifrontend.cpp
index 306f089..6c948be 100644
--- a/src/practice/guifrontend.cpp
+++ b/src/practice/guifrontend.cpp
@@ -183,12 +183,13 @@ bool GuiFrontend::eventFilter(QObject *object, QEvent *event)
void GuiFrontend::setFinishedWordsTotalWords(int finished, int total)
{
+ int finishedPercentage = 1.0 * finished / total * 100;
// update progress bar
m_ui->totalProgress->setMaximum(total);
m_ui->totalProgress->setValue(finished);
- m_ui->totalProgress->setToolTip(i18np("You answered %2 of a total of %1 word.\nYou are %3% done.",
- "You answered %2 of a total of %1 words.\nYou are %3% done.",
- total, finished, finished/total*100));
+ m_ui->totalProgress->setToolTip(i18np("You answered correctly %2 of a total of %1 word.\nYou are %3% done.",
+ "You answered correctly %2 of a total of %1 words.\nYou are %3% done.",
+ total, finished, finishedPercentage));
}
void GuiFrontend::setHint(const QVariant& hint)
diff --git a/src/practice/practicestatemachine.cpp b/src/practice/practicestatemachine.cpp
index e6db24f..03da990 100644
--- a/src/practice/practicestatemachine.cpp
+++ b/src/practice/practicestatemachine.cpp
@@ -198,7 +198,7 @@ void PracticeStateMachine::updateFrontend()
// show the word that is currently practiced in the progress bar
m_frontend->setFinishedWordsTotalWords(
- m_testEntryManager->totalEntryCount() - m_testEntryManager->activeEntryCount() + 1,
+ m_testEntryManager->totalEntryCount() - m_testEntryManager->activeEntryCount(),
m_testEntryManager->totalEntryCount());
grade_t grade = m_mode->currentGradeForEntry();
More information about the Parley-devel
mailing list