summaryrefslogtreecommitdiffstats
path: root/kverbos/kverbos/kverbosview.h
blob: 3690c72a5b9bf2e9902c82f0252b7f5475a1e8e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/***************************************************************************
                          kverbosview.h  -  description
                             -------------------
    begin                : Fre Dez 14 19:28:09 CET 2001
    copyright            : (C) 2001 by Arnold Kraschinski
    email                : arnold.k67@gmx.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef KVERBOSVIEW_H
#define KVERBOSVIEW_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif 

// include files for Qt
#include "qlernen.h"

// weitere include-Files für das Programm
#include "kverbos.h"

// forward-Deklaration der Klasse. Während man die API-Dokumentation erstellt,
// muss diese Zeile auskommentiert werden, weil sonst der falsche Text als Beschreibung
// der Klasse erkannt wird.
//class KVerbosDoc;

/** The KVerbosView class provides the view widget for the KVerbosApp instance.	
 * The View instance inherits TQWidget as a base class and represents the view object of a KTMainWindow. As KVerbosView is part of the
 * docuement-view model, it needs a reference to the document object connected with it by the KVerbosApp class to manipulate and display
 * the document structure provided by the KVerbosDoc class.
 * 	
 * Diese Klasse soll folgende Funktionen erfüllen:
 *  - sie soll das momentan ausgewählte Verb vom Dokument holen.
 *    Diese Information enthält die spanische und deutsche Bedeutung des Verbes, die Zeit, die
 *    momentan getestet werden soll, und alle Verbformen, die zu dieser Zeit gehören.
 *  - die Klasse nimmt die Eingaben des Benutzers entgegen und prüft anschließend, ob die Ein-
 *    gaben richtig sind.
 *  - Die Informationen, wie viele Verben richtig geübt und wie viele falsch geübt wurden, soll
 *    direkt in dieser Klasse gespeichert werden und nicht im Dokument.
 *  - Die Klasse meldet an das Dokument, wenn es Zeit ist sich ein neues Verb zu suchen.
 *    Das ist in folgenden Fällen nötig:
 *          - wenn die Klasse zum ersten Mal gestartet wird und ein erstes Verb eingestellt werden
 *            soll.
 *          - wenn ein neues Dokument mit Verben geladen wird.
 *          - wenn der Benutzer die Formen richtig eingegeben hat.
 *          - wenn ihm nichts mehr einfällt und er weiter will.
 *
 * @author Source Framework Automatically Generated by KDevelop, (c) The KDevelop Team.
 * @version KDevelop version 0.4 code generation
 */
class KVerbosView : public QLernen /*TQWidget*/
{
  Q_OBJECT
public:
  /** Constructor for the main view */
  KVerbosView(TQWidget *parent = 0, const char *name=0);
  /** Destructor for the main view */
  ~KVerbosView();

  /** returns a pointer to the document connected to the view instance. Mind that this method requires a KVerbosApp instance as a parent
   * widget to get to the window document pointer by calling the KVerbosApp::getDocument() method.
   *
   * @see KVerbosApp#getDocument
   */
  KVerbosDoc* getDocument() const;

  /** contains the implementation for printing functionality */
  void print(TQPrinter *pPrinter);
	/** This funktion erases all accents from the letters of a string
	  */
	TQString deleteAccents(const TQString& s) const;
	/** tell the view that the user has changed. Training results are deleted and set to the
	  * initial values. A new verb is chosen. The function returns the training result of the
	  * old user. r1 is the training results and r2 is the number of the trained verbs.
	  */
	int userChanged(int& r1, int& r2);
	
public slots:
  /** Die folgenden Slots werden aufgerufen, wenn ein Button mit einem
   *  spanischen Sonderzeichen gedrückt wird.
   *  Das Zeichen wird dann dem Eingabefeld, das den Focus hat zugefügt.
   */
  virtual void slotN();
  virtual void slotA();
  virtual void slotE();
  virtual void slotI();
  virtual void slotO();
  virtual void slotU();
  /** all the LineEdits will be cleared
    */
  virtual void slotClearAll();
  /** if the verb is already corrected (corrected == true) then the font is
    * set to the normal font
    */
  virtual void slotFont();
	/** if the time is a progressiv or a perfect form the input of the yo-Editbox
    * which contains the gerund or the partizip is copied into the others.
    */
  virtual void slotCopyText();
  /** Die Ansicht wird aufgefordert sich das aktuelle Verb vom Dokument zu holen
   *  sich eine Zeit auszuwählen und dann das Verb in dem Fenster zum Üben bereitzustellen
   */
  virtual void zeigeVerb();
  /** Es soll ein anderes Verb zum Lernen ausgewählt werden, das momentan eingegebene wird
      nicht gewertet.
    */
  virtual void slotWeiter();
  /** The input should be corrected.
    */
  virtual void slotCorregir();
  /** The solution should be shown in the window
    */
  virtual void slotSolution();


signals:
  void numberTrainedChanged(int);
  void numberCorrectChanged(int);
  void informKFeeder(int);

private:
  /** the following variables store the information about the actual verb. The information
    * is obtained from the doc.
    */
	TQString espanol;
	TQString aleman;
	int zeitAuswahl;
	TQString formen[7][3];
	/** tells if the actual input already has been correced by using the button */
	bool corrected;
	/** Are pointers to the GUI elements for an easier use */
	TQLineEdit* formEdit[6][3];
	/** the number of verbs that habe been correct */
	int enteredCorrect;
	/** the number of all verbs that have been trained */
	int verbsTrained;
};

#endif // KVERBOSVIEW_H