[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/soc-parley/parley/practice
From:       David Capel <wot.narg () gmail ! com>
Date:       2008-06-15 23:08:20
Message-ID: 1213571300.460242.6937.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 820975 by capel:

Fixed a cmake warning
It now closes when the practice is done and the quit action works.
The randomizer theoretically works, but in reality doesn't.



 M  +0 -1      CMakeLists.txt  
 M  +8 -0      parleypracticemainwindow.cpp  
 M  +1 -0      statistics.cpp  
 M  +12 -11    statistics.h  
 M  +2 -3      testentrymanager.cpp  
 M  +2 -2      testentrymanager.h  


--- branches/work/soc-parley/parley/practice/CMakeLists.txt #820974:820975
@@ -27,7 +27,6 @@
     hint.cpp
     answervalidator.cpp
     testentrymanager.cpp
-    practiceprefs.cpp
     entryfilter.cpp
 )
 kde4_add_ui_files(parleypractice_SRCS entryfilter.ui)
--- branches/work/soc-parley/parley/practice/parleypracticemainwindow.cpp \
#820974:820975 @@ -35,6 +35,7 @@
 #include <KActionMenu>
 #include <KLocalizedString>
 #include <KConfigDialog>
+#include <KApplication>
 
 #include "practiceview.h"
 #include "input.h"
@@ -120,7 +121,9 @@
     scene->addItem(barstats);
     connect(stats, SIGNAL(signalUpdateDisplay(Statistics*)), barstats, \
                SLOT(slotUpdateDisplay(Statistics*)));
     connect(m_manager, SIGNAL(signalExpressionChanged(KEduVocExpression*)), stats, \
SLOT(slotSetExpression(KEduVocExpression*))); +    connect(m_manager, \
SIGNAL(signalSetFinished()), stats, SLOT(slotSetFinished()));  
+
     //QGraphicsLinearLayout * promptAndInput = new QGraphicsLinearLayout();
     //promptAndInput->setOrientation(Qt::Vertical);
     //promptAndInput->addItem(gprompt);
@@ -203,6 +206,11 @@
     KStandardAction::preferences(this, SLOT(slotCreatePreferencesDialog()),
                                        actionCollection());
 
+    //// Quit action setup ////
+    KStandardAction::quit(kapp, SLOT(quit()), actionCollection());
+    connect(stats, SIGNAL(signalQuit()), kapp, SLOT(quit()));
+
+
     //// Final Graphics Setup ////
 
     setupGUI();
--- branches/work/soc-parley/parley/practice/statistics.cpp #820974:820975
@@ -162,6 +162,7 @@
 void Statistics::slotSetFinished()
 {
     // TODO do something here ;)
+    emit signalQuit();
 }
 
 
--- branches/work/soc-parley/parley/practice/statistics.h #820974:820975
@@ -35,12 +35,12 @@
 class Statistics : public QObject
 {
     Q_OBJECT
-            
+
     public:
         Statistics(QObject * parent = 0);
         virtual ~Statistics();
 
-        
+
         /// Tainting causes an answer to be counted as incorrect (even if it is
         /// correct), and the tainting frequency is statisticly tracked.
         /// These denote the reason that an answer is tainted.
@@ -105,14 +105,14 @@
         /// Called when the user has requested that the answer be shown.
         /// If the question has not been answered, it will be counted as incorrect.
         void slotSolutionShown();
-        
+
     public:
         static const QString gradeToString(int grade);
 
-        
+
         /// Returns the percent of entries that have been answered correctly.
         /// This will return 0 when the numerator and/or denominator is 0,
-        /// This practice is mathmatically incorrect (n/0 != 0/0 != 0), but works in \
practice  +        /// This practice is mathmatically incorrect (n/0 != 0/0 != 0), \
but works in practice  float percentCorrect()
         { return m_attempted != 0 ? static_cast<float>(m_correct) / m_attempted : \
0.0f; }  bool answerChecked() const  { return m_answerChecked; }
@@ -129,10 +129,11 @@
         int taintReason(TaintReason reason) const { return m_taintReasons[reason]; }
         /// Get how often entries were skipped for SkipReason @param reason
         int skippedReason(SkipReason reason) const { return m_skipReasons[reason]; }
-        
+
     signals:
         void signalUpdateDisplay(Statistics*);
-        
+        void signalQuit();
+
     protected:
         /// Number of questions attempted.
         int m_attempted;
@@ -170,7 +171,7 @@
         /// If the current question is tainted.
         bool m_tainted;
 
-        
+
 };
 
 class LCDStatistics : public QLCDNumber
@@ -179,7 +180,7 @@
 
     public:
         LCDStatistics(QWidget* parent = 0);
-            
+
     public slots:
         /// Refreshes the GUI display.
         void slotUpdateDisplay(Statistics*);
@@ -192,12 +193,12 @@
     public:
         SvgBarStatistics(QSvgRenderer * renderer, QGraphicsItem * parent = 0);
         ~SvgBarStatistics();
-        
+
     public slots:
         /// Refreshes the GUI display.
         void slotUpdateDisplay(Statistics*);
-        
 
+
     private:
         QRectF m_backgroundRect;
 };
--- branches/work/soc-parley/parley/practice/testentrymanager.cpp #820974:820975
@@ -101,8 +101,7 @@
 
 void TestEntryManager::shuffle()
 {
-    kDebug() << "called";
-    KRandomSequence().randomize(m_entries);
+    KRandomSequence(0).randomize(m_entries);
 }
 
 
@@ -124,7 +123,7 @@
     }
     else
     {
-        emit signalQuestionSetFinished();
+        emit signalSetFinished();
         kDebug() << "finished";
     }
 }
--- branches/work/soc-parley/parley/practice/testentrymanager.h #820974:820975
@@ -53,7 +53,7 @@
 
     public:
         TestEntryManager(QObject* parent = 0);
-        
+
         void open(KEduVocDocument*);
 
         const QString currentSolution() const;
@@ -112,7 +112,7 @@
         /// Used so various widgets will know to reset themselves.
         void signalNewEntry();
         /// Emitted when the set of questions is finished.
-        void signalQuestionSetFinished();
+        void signalSetFinished();
 
 };
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic