[Parley-devel] KDE/kdeedu/parley/src
Frederik Gladhorn
gladhorn at kde.org
Sun Apr 18 03:13:15 CEST 2010
SVN commit 1115922 by gladhorn:
implement basic conjugation mode
what works:
* entering conjugation forms for a single tense that is randomly picked (yeah, it can be empty even)...
broken:
* if there is no personal pronoun, nothing will be displayed
* statistics are nuts with this mode for now
* tense selection
* filtering out of known conjugations
* verbs still get sorted out based on the grade the word has in general
* no useful feedback at all
* keyboard interaction (other than typing in the words)
... so all in all this looks promising :p
CCMAIL:parley-devel at kde.org
M +3 -0 CMakeLists.txt
M +2 -1 practice/abstractfrontend.h
M +0 -2 practice/abstractwidget.h
A practice/conjugationbackendmode.cpp [License: GPL (v2+)]
A practice/conjugationbackendmode.h [License: GPL (v2+)]
A practice/conjugationdata.h [License: GPL (v2+)]
A practice/conjugationmodewidget.cpp [License: GPL (v2+)]
A practice/conjugationmodewidget.h [License: GPL (v2+)]
A practice/conjugationwidget.h
M +5 -0 practice/defaultbackend.cpp
M +15 -10 practice/guifrontend.cpp
A practice/practice_widget_conjugation.ui
M +5 -5 practice/practicemainwindow.cpp
M +10 -10 practice/themedbackgroundrenderer.cpp
M +1 -1 statistics/statisticsmainwindow.ui
--- trunk/KDE/kdeedu/parley/src/CMakeLists.txt #1115921:1115922
@@ -79,6 +79,8 @@
practice/practiceoptions.cpp
practice/abstractfrontend.cpp
practice/abstractbackendmode.cpp
+ practice/conjugationbackendmode.cpp
+ practice/conjugationmodewidget.cpp
practice/defaultbackend.cpp
practice/guifrontend.cpp
practice/abstractwidget.cpp
@@ -110,6 +112,7 @@
practice/practice_widget_written.ui
practice/practice_widget_multiplechoice.ui
practice/practice_widget_flashcard.ui
+ practice/practice_widget_conjugation.ui
)
# settings for the practice
--- trunk/KDE/kdeedu/parley/src/practice/abstractfrontend.h #1115921:1115922
@@ -30,7 +30,8 @@
FlashCard,
MixedLetters,
MultipleChoice,
- Written
+ Written,
+ Conjugation
};
enum ResultState {
--- trunk/KDE/kdeedu/parley/src/practice/abstractwidget.h #1115921:1115922
@@ -58,8 +58,6 @@
protected:
GuiFrontend *m_frontend;
-
-
};
}
--- trunk/KDE/kdeedu/parley/src/practice/defaultbackend.cpp #1115921:1115922
@@ -22,6 +22,7 @@
#include "genderbackendmode.h"
#include "multiplechoicebackendmode.h"
#include "writtenbackendmode.h"
+#include "conjugationbackendmode.h"
using namespace Practice;
@@ -83,6 +84,10 @@
m_frontend->setMode(AbstractFrontend::MultipleChoice);
m_mode = new GenderBackendMode(m_options, m_frontend, this, m_testEntryManager, m_document->document());
break;
+ case Prefs::EnumPracticeMode::ConjugationPractice:
+ m_frontend->setMode(AbstractFrontend::Conjugation);
+ m_mode = new ConjugationBackendMode(m_options, m_frontend, this, m_testEntryManager, m_document->document());
+ break;
default:
Q_ASSERT("Implement selected practice mode" == 0);
}
--- trunk/KDE/kdeedu/parley/src/practice/guifrontend.cpp #1115921:1115922
@@ -12,19 +12,22 @@
***************************************************************************/
#include "guifrontend.h"
+
+#include <QtCore/QTimer>
+
+#include <kcolorscheme.h>
+#include <kstandarddirs.h>
+#include <kdebug.h>
+
#include "ui_practice_mainwindow.h"
-#include <kdebug.h>
-#include "writtenpracticewidget.h"
-#include "multiplechoicemodewidget.h"
+#include "conjugationmodewidget.h"
#include "flashcardmodewidget.h"
#include "mixedlettersmodewidget.h"
+#include "multiplechoicemodewidget.h"
#include "themedbackgroundrenderer.h"
-#include <kcolorscheme.h>
-#include <kstandarddirs.h>
+#include "writtenpracticewidget.h"
-#include <QTimer>
-
using namespace Practice;
GuiFrontend::GuiFrontend(QWidget* parent)
@@ -34,14 +37,13 @@
m_widget->setScalingEnabled(false, false);
m_widget->setKeepAspectRatio(Qt::IgnoreAspectRatio);
m_widget->setFadingEnabled(false);
-
+
m_ui = new Ui::PracticeMainWindow();
m_ui->setupUi(m_widget);
m_ui->centralPracticeWidget->setLayout(new QHBoxLayout());
m_themedBackgroundRenderer = new ThemedBackgroundRenderer(this);
-
QString theme(KStandardDirs::locate("data", "parley/themes/" + Prefs::theme()));
kDebug() << "Using theme: " << theme;
m_themedBackgroundRenderer->setSvgFilename(theme);
@@ -99,8 +101,11 @@
case MixedLetters:
newWidget = new MixedLettersModeWidget(this, m_widget);
break;
+ case Conjugation:
+ newWidget = new ConjugationModeWidget(this, m_widget);
+ break;
default:
- kDebug() << "Unknown/invalid mode" << mode;
+ Q_ASSERT("Practice Mode Invalid" == 0);
}
if (newWidget) {
m_ui->centralPracticeWidget->layout()->addWidget(newWidget);
--- trunk/KDE/kdeedu/parley/src/practice/practicemainwindow.cpp #1115921:1115922
@@ -41,10 +41,10 @@
m_guiFrontend = new GuiFrontend(this);
setCentralWidget(m_guiFrontend->widget());
-
+
Practice::PracticeOptions options;
m_backend = new Practice::DefaultBackend(m_guiFrontend, parent->parleyDocument(), options, testEntryManager, this);
-
+
// setModified - otherwise we may not ask to save progress
parent->parleyDocument()->document()->setModified(true);
@@ -52,7 +52,7 @@
connect(this, SIGNAL(enterPressed()), m_guiFrontend, SIGNAL(continueAction()));
connect(m_backend, SIGNAL(practiceFinished()), this, SIGNAL(stopPractice()));
-
+
KConfigGroup cfg(KSharedConfig::openConfig("parleyrc"), objectName());
applyMainWindowSettings(cfg);
}
@@ -124,10 +124,10 @@
bool PracticeMainWindow::event(QEvent *event)
{
- kDebug() << event << hasMouseTracking();
+ //kDebug() << event << hasMouseTracking();
if (event->type() == QEvent::HoverMove && m_fullScreenAction->isChecked()) {
QPoint pos = static_cast<QHoverEvent*>(event)->pos();
- kDebug() << pos;
+ //kDebug() << pos;
if(m_animation->direction() == QAbstractAnimation::Backward && pos.y() <= m_floatingToolBar->height()) {
m_animation->setDirection(QAbstractAnimation::Forward);
m_animation->start();
--- trunk/KDE/kdeedu/parley/src/practice/themedbackgroundrenderer.cpp #1115921:1115922
@@ -63,7 +63,7 @@
QPixmap ThemedBackgroundRenderer::getScaledBackground()
{
if (m_size.isEmpty()) {
- kDebug() << "trying to render with an invalid size";
+ //kDebug() << "trying to render with an invalid size";
return QPixmap();
}
if (m_future.isRunning() || m_future.resultCount()) {
@@ -87,7 +87,7 @@
void ThemedBackgroundRenderer::updateBackground()
{
if (m_size.isEmpty()) {
- kDebug() << "trying to render with an invalid size";
+ //kDebug() << "trying to render with an invalid size";
return;
}
m_timer.start();
@@ -108,7 +108,7 @@
void ThemedBackgroundRenderer::renderingFinished()
{
if(!m_future.resultCount()) {
- kDebug() << "there is no image!";
+ //kDebug() << "there is no image!";
return;
}
emit backgroundChanged(QPixmap::fromImage(m_future.result()));
@@ -176,7 +176,7 @@
renderRect(rect.first, rect.second, &p, fastScale);
}
- kDebug() << "image rendered, time:" << t.elapsed();
+ //kDebug() << "image rendered, time:" << t.elapsed();
return image;
}
@@ -227,7 +227,7 @@
if (itemRectF.isNull() || rect.isNull())
return;
- kDebug() << "draw item" << id;
+ //kDebug() << "draw item" << id;
// kDebug() << "original item rect:" << itemRect << m_renderer.boundsOnElement(id);
QRect itemRect = scaleRect(itemRectF, rect, scaleBase, aspectRatio);
// kDebug() << "scaled" << itemRect;
@@ -239,14 +239,14 @@
QImage image;
if (m_cache.imageSize(id) == itemRect.size()) {
- kDebug() << "found in cache:" << id;
+ // kDebug() << "found in cache:" << id;
image = m_cache.getImage(id);
} else if(fastScale && !m_cache.imageSize(id).isEmpty()) {
- kDebug() << "FAST SCALE for:" << id;
+ // kDebug() << "FAST SCALE for:" << id;
image = m_cache.getImage(id).scaled(itemRect.size(), Qt::IgnoreAspectRatio, Qt::FastTransformation);
m_isFastScaledRender = true;
} else {
- kDebug() << "NOT IN CACHE, render svg:" << id;
+ // kDebug() << "NOT IN CACHE, render svg:" << id;
image = QImage(itemRect.size(), QImage::Format_ARGB32_Premultiplied);
image.fill(QColor(Qt::transparent).rgba());
QPainter painter(&image);
@@ -328,7 +328,7 @@
}
break;
}
- kDebug() << "unhandled scaling option";
+ // kDebug() << "unhandled scaling option";
return itemRect.toRect();
}
@@ -408,7 +408,7 @@
itemRect.moveTo(x, y);
return itemRect;
}
- kDebug() << "unhandled alignment option";
+ // kDebug() << "unhandled alignment option";
return itemRect;
}
--- trunk/KDE/kdeedu/parley/src/statistics/statisticsmainwindow.ui #1115921:1115922
@@ -103,7 +103,7 @@
<item row="9" column="1">
<widget class="QRadioButton" name="conjugations">
<property name="enabled">
- <bool>false</bool>
+ <bool>true</bool>
</property>
<property name="text">
<string>Conjugations</string>
More information about the Parley-devel
mailing list