moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kverbos / kverbos / kverbosuser.h
blob4b072e1d4f1c58326a10dcba8e6f264b03fa5572
1 /***************************************************************************
2 kverbosuser.h - description
3 -------------------
4 begin : Tue Dec 18 2001
5 copyright : (C) 2001 by Arnold Kraschinski
6 email : arnold.k67@gmx.de
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
18 #ifndef KVERBOSUSER_H
19 #define KVERBOSUSER_H
21 #include "verbspanish.h"
23 // Der maximale Wert für den falsch bzw. richtig Zähler
24 #define MAX_WERT 32767
25 // Die maximale Anzahl von Anfragen, die ein Verb in der Richtig-Liste verbleibt.
26 #define STAY_IN_R_LIST 25
27 #define FEHLERHAFT -1
28 #define UNGELERNT 0
29 #define RICHTIGGEMACHT 1
30 #define FALSCHGEWICHT 2
31 #define DEFAULTUSER "------"
32 #define MAX_RESULTS 10
34 /** Datenstruktur für ein Verb in den Listen
35 * right - gibt an, wie oft das Verb schon richtig eingegeben wurde.
36 * wrong - gibt an, wie oft das Verb schon falsch eingegeben wurde.
37 * counter - ist der Zähler für die aufsummierte Gewichtung der Verben bei Verben in den
38 * ungelernten bzw. falschen Listen. In der Liste der richtig gelernten Verben
39 * ist das ein Zähler, der angibt, wie lange das Verb in der Liste bleiben kann.
40 * used - zeigt an, ob das Verb in der Verbendatei des Hauptprogrammes vorkommt.
41 * status - zeigt an, ob das Verb noch nicht geübt wurde (status = 0), ob es zuletzt falsch
42 * eingegeben wurde (status = -1) oder zuletzt richtig (status = 1)
44 class eintrag
46 public:
47 bool operator== (const eintrag& e) const;
48 QString verb;
49 int right;
50 int wrong;
51 int counter;
52 int status;
53 bool used;
56 typedef QValueList<eintrag> verbenListe;
58 /** This class holds information about an user of the program. It stores lists of
59 * verbs. One list for the words that are in the opened verb file and aren't traines yet.
60 * Another list for the words that have been correct. This verbs are stored in the
61 * list to present them more rarely to the user. The third list are for verbs entered with
62 * errors. This verbs are presented to the user with a greater probability.
64 *@author Arnold Kraschinski
66 class KVerbosUser {
67 public:
68 KVerbosUser(spanishVerbList* pL, QString n=DEFAULTUSER);
69 ~KVerbosUser();
70 /** fills the lists with the verbs that are in the verb list of the main program */
71 void fillList(spanishVerbList* pL);
72 /** returns the user name */
73 QString getName() { return name; };
74 /** marks all verbs in the R(right) and the F(false) list as unused. That means they can't
75 * be a suggestion. This are probably verbs that are stored user data but at the moment
76 * they aren't in the used verb list.
78 void deaktivieren();
79 /** calculates the Kumulus for the list with the verbs that aren't studied yet and
80 * for the list with the verbs that have been wrong. */
81 void updateKumulus();
82 /** selects a verb out of the verbs that are in the U and F list. That means a
83 * verb that hasn't been studied yet or one that was wrong. */
84 QString suggestVerb();
85 /** The solution for the suggested verb was right. Now the verb should be deleted from
86 * the list of unstudied verbs but added to the list with the right verbs.
88 void right();
89 /** The opposite function to the above one. The solution was wrong and the verb has to
90 * be moved to the list with the wrong verbs.
92 void wrong();
93 /** Saves all the user information to the $KDEHOME/apps/kverbos/data/username.kverbos file */
94 bool saveUser(const int& res, const int& num);
95 /** Retrieve the old results and the number of sessions */
96 bool getResults(int& s, QString d[], int r[][2]);
97 /** returns a pointer to the users verb list */
98 verbenListe* getListe() { return &liste; };
100 private:
101 /** name of the user */
102 QString name;
103 /** the list of the verbs that the user has workes with */
104 verbenListe liste;
105 /** this is the latest selected verb of the list */
106 QString auswahl;
107 /** die aufaddierte Summe der gewichteten Verben */
108 int kumulus;
109 /** an Iterator for the verb list */
110 verbenListe::Iterator it;
111 /** the number of training sessions that the user has made */
112 int sessions;
113 /** The results of the last ten seccions */
114 QString date[MAX_RESULTS];
115 int result[MAX_RESULTS][2];
118 #endif