[kde-doc-english] KDE/kdeedu/kwordquiz/src

Peter Hedlund peter at peterandlinda.com
Sat Mar 13 03:13:02 CET 2010


SVN commit 1102617 by hedlund:

FEATURE: 135260
BUG: 117532
GUI: A new tutor that shows a flashcard at defined intervals while working with other things.

Currently only implemented as a command line switch. To test run "kwordquiz -g tutor".

Based on patches by Aleks (http://reviewboard.kde.org/r/2822/) who has requested that I hold the copyright.

CCMAIL: abirvalg at lavabit.com

 M  +6 -1      CMakeLists.txt  
 M  +44 -2     kwordquiz.kcfg  
 A             kwqtutor.cpp   [License: GPL (v2+)]
 A             kwqtutor.h   [License: GPL (v2+)]
 A             kwqtutorflashcard.cpp   [License: GPL (v2+)]
 A             kwqtutorflashcard.h   [License: GPL (v2+)]
 A             kwqtutorprefs.cpp   [License: GPL (v2+)]
 A             kwqtutorprefs.h   [License: GPL (v2+)]
 M  +26 -24    main.cpp  
 A             preftutor.cpp   [License: LGPL (v2)]
 A             preftutor.h   [License: LGPL (v2)]
 A             preftutorbase.ui  


--- trunk/KDE/kdeedu/kwordquiz/src/CMakeLists.txt #1102616:1102617
@@ -19,6 +19,7 @@
    prefgeneral.cpp
    prefeditor.cpp
    prefquiz.cpp
+   preftutor.cpp
    dlgspecchar.cpp
    dlglanguage.cpp
    wqprintdialogpage.cpp
@@ -27,6 +28,9 @@
    kwqtablemodel.cpp
    kwqtableview.cpp
    kwqtabledelegate.cpp
+   kwqtutor.cpp
+   kwqtutorflashcard.cpp
+   kwqtutorprefs.cpp
    kwqsortfiltermodel.cpp
    kwqcommands.cpp
    kwqscorewidget.cpp
@@ -45,7 +49,8 @@
    kwqscorewidgetbase.ui
    prefcharacterbase.ui 
    prefcardappearancebase.ui
-   prefgeneralbase.ui )
+   prefgeneralbase.ui
+   preftutorbase.ui )
 
 kde4_add_kcfg_files(kwordquiz_SRCS prefs.kcfgc documentsettings.kcfgc)
 
--- trunk/KDE/kdeedu/kwordquiz/src/kwordquiz.kcfg #1102616:1102617
@@ -127,8 +127,8 @@
   </group>
   <group name="KNewStuff">
     <entry name="ProvidersUrl" type="Path">
-       <label>The Providers path for KWordQuiz</label>
-         <default code="true">"http://edu.kde.org/kvoctrain/providers.xml"</default>
+      <label>The Providers path for KWordQuiz</label>
+      <default code="true">"http://edu.kde.org/kvoctrain/providers.xml"</default>
     </entry>
     <entry name="InstallationCommand" type="String">
        <label>The command used to start a downloaded vocabulary</label>
@@ -139,4 +139,46 @@
        <default>Vocabularies</default>
     </entry>
   </group>
+  <group name="Tutor">
+    <entry name="TutorTiming" type="Enum">
+      <label>Pop up flashcards at fixed or random intervals</label>
+       <choices>
+        <choice name="FixedInterval"/>
+        <choice name="RandomInterval"/>
+      </choices>
+      <default>FixedInterval</default>
+    </entry>
+    <entry name="TutorEvery" type="Int">
+      <label>The interval in minutes at which to pop up a flash card</label>
+      <default>10</default>
+    </entry>
+    <entry name="TutorMin" type="Int">
+      <label>The minimum interval in minutes at which to pop up a flash card</label>
+      <default>20</default>
+    </entry>
+    <entry name="TutorMax" type="Int">
+      <label>The maximum interval in minutes at which to pop up a flash card</label>
+      <default>40</default>
+    </entry>
+    <entry name="TutorFlashCardGeometry" type="Rect">
+      <label>Geometry of the last flash card</label>
+      <default>QRect(2,2,200,80)</default>
+    </entry>
+    <entry name="TutorCardAppearance" type="Enum">
+      <label>Show flash card in a native KWordQuiz style</label>
+      <choices>
+        <choice name="Native"/>
+        <choice name="Minimalistic"/>
+      </choices>
+      <default>Native</default>
+    </entry>
+    <entry name="LastVocabFile" type="String">
+      <label>Last open vocabulary file to be opened automatically if none other is specified on the command line</label>
+      <default></default>
+    </entry>
+    <entry name="StartExerciseAsSoonAsFileIsLoaded" type="Bool">
+      <label>Start exercise as soon as the user opens vocabulary file</label>
+      <default>true</default>
+    </entry>
+  </group>
 </kcfg>
--- trunk/KDE/kdeedu/kwordquiz/src/main.cpp #1102616:1102617
@@ -1,8 +1,8 @@
 /***************************************************************************
-                          main.cpp  -  description
+                                 main.cpp
                              -------------------
     begin                : Wed Jul 24 20:12:30 PDT 2002
-    copyright            : (C) 2002-2003 by Peter Hedlund
+    copyright            : (C) 2002-2010 by Peter Hedlund
     email                : peter.hedlund at kdemail.net
  ***************************************************************************/
 
@@ -15,19 +15,19 @@
  *                                                                         *
  ***************************************************************************/
 
-#include <QAction>
+#include <QtGui/QAction>
 
-#include <kcmdlineargs.h>
-#include <kaboutdata.h>
-#include <klocale.h>
-#include <kactioncollection.h>
-#include <kapplication.h>
+#include <KCmdLineArgs>
+#include <KAboutData>
+#include <KLocale>
+#include <KActionCollection>
+#include <KApplication>
 
+#include "kwqtutor.h"
 #include "kwordquiz.h"
 #include "version.h"
 
 static const char *description = I18N_NOOP("A powerful flashcard and vocabulary learning program");
-
 int main(int argc, char *argv[])
 {
   KAboutData aboutData("kwordquiz", 0,
@@ -50,38 +50,40 @@
   options.add("m");
   options.add("mode <number>", ki18n("A number 1-5 corresponding to the \nentries in the Mode menu"));
   options.add("g");
-  options.add("goto <session>", ki18n("Type of session to start with: \n'flash' for flashcard, \n'mc' for multiple choice, \n'qa' for question and answer"));
+  options.add("goto <session>", ki18n("Type of session to start with: \n'flash' for flashcard, \n'mc' for multiple choice, \n'qa' for question and answer, \n'tutor' for tutor"));
   options.add("+[File]", ki18n("File to open"));
   KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
 
+  if (KCmdLineArgs::parsedArgs()->getOption("goto") == "tutor") {
+    KApplication tutorapp;
+    tutorapp.setQuitOnLastWindowClosed(false);
+    KWQTutor* m_tutor = new KWQTutor(KCmdLineArgs::parsedArgs()->count() ?
+                                  KCmdLineArgs::parsedArgs()->url(KCmdLineArgs::parsedArgs()->count() - 1) : KUrl()); //last arg - file to open
+    return tutorapp.exec();
+  }
+
   KApplication app;
-
-  if (app.isSessionRestored())
-  {
+  if (app.isSessionRestored()) {
     RESTORE(KWordQuizApp);
   }
-  else 
-  {
+  else {
     KWordQuizApp *kwordquiz = new KWordQuizApp();
     kwordquiz->show();
 
     KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
 
-    if (args->count())
-    {
+    if (args->count()) {
       kwordquiz->openDocumentFile(KUrl(args->url(args->count() - 1)));
 
       QString mode = args->getOption("mode");
 
-      if (!mode.isEmpty())
-      {
+      if (!mode.isEmpty()) {
         QAction *a = kwordquiz->actionCollection()->action(QString("mode_%1").arg(QString(mode)));
         kwordquiz->slotModeActionGroupTriggered(a);
       }
 
       QString go_to = args->getOption("goto");
-      if (!go_to.isEmpty())
-      {
+      if (!go_to.isEmpty()) {
         if (go_to == "flash")
           kwordquiz->slotQuizFlash();
         if (go_to == "mc")
@@ -90,11 +92,11 @@
           kwordquiz->slotQuizQA();
       }
     }
-    else
-    {
+    else {
       kwordquiz->openDocumentFile();
     }
     args->clear();
   }
-  return app.exec();
+ return app.exec();
+
 }



More information about the kde-doc-english mailing list