1 /***************************************************************************
2 kverbosdoc.h - description
4 begin : Fre Dez 14 19:28:09 CET 2001
5 copyright : (C) 2001 by Arnold Kraschinski
6 email : arnold.k67@gmx.de
7 ***************************************************************************/
9 /***************************************************************************
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. *
16 ***************************************************************************/
25 // include files for QT
28 // include files for KDE
31 // include files des Projektes
32 #include "verbspanish.h"
34 // forward declaration of the Kverbos classes
40 * KVerbosDoc provides a document object for a document-view model.
42 * The KVerbosDoc class provides a document object that can be used in conjunction with
43 * the classes KVerbosApp and KVerbosView to create a document-view model for standard KDE
44 * applications based on KApplication and KMainWindow. Thereby, the document object
45 * is created by the KVerbosApp instance and contains the document structure with the
46 * according methods for manipulation of the document data by KVerbosView objects. Also,
47 * KVerbosDoc contains the methods for serialization of the document data from and to files.
49 * Die Dokumentenklasse hält eine Liste der verfügbaren Verben vor. Aus dieser Liste wird
50 * eines ausgewählt, das gelernt werden soll. Die View-Klasse kann dieses Verb abfragen und
51 * in dem Lernfenster darstellen.
52 * Es gibt einige Situationen, die eine neuen Wahl dieses Verbes erforderlich machen:
53 * - zu Beginn des Programms, wenn die Klasse gebildet wird
54 * - wenn eine neue Verbendatei geladen wird
55 * - wenn die View-Klasse eine neue Wahl anfordert
56 * die View-Klasse merkt sich die Anzahl der richtig gelösten Verben.
58 * @author Source Framework Automatically Generated by KDevelop, (c) The KDevelop Team.
59 * @version KDevelop version 1.2 code generation
61 class KVerbosDoc
: public QObject
66 * Constructor for the fileclass of the application
68 KVerbosDoc(QWidget
*parent
, const char *name
=0);
70 * Destructor for the fileclass of the application
74 /** adds a view to the document which represents the document contents. Usually this is your main view. */
75 void addView(KVerbosView
*view
);
76 /** removes a view from the list of currently connected views */
77 void removeView(KVerbosView
*view
);
78 /** sets the modified flag for the document after a modifying action on the view connected to the document.*/
79 void setModified(bool _m
=true){ modified
=_m
; };
80 /** returns if the document is modified or not. Use this to determine if your document needs saving by the user on closing.*/
81 bool isModified(){ return modified
; };
82 /** "save modified" - asks the user for saving if the document is modified */
84 /** deletes the document's contents */
85 void deleteContents();
86 /** initializes the document generally */
88 /** closes the acutal document */
90 /** loads the document by filename and format and emits the updateViews() signal
91 * Es werden bei der Datei die beiden Formate HTML-Datei und reine Textdatei unter-
94 bool openDocument(const KURL
& url
, const char *format
=0);
95 bool openDocHTML(QFile
&f
);
96 bool openDocVERBOS(QFile
&f
);
97 /** saves the document under filename and format.
98 * Die Datei kann wahlweise im HTML-Format oder als normale Textdatei abgespeichert
99 * werden. Die HTML-Datei ist umfangreicher, weil der formatierende HTML-Code
100 * ergänzt werden muss.
102 bool saveDocument(const KURL
& url
, const char *format
=0);
103 bool saveDocHTML(QFile
&f
);
104 bool saveDocVERBOS(QFile
&f
);
105 /** sets a new user name, and deletes the old one. If the old one is different from
106 * the default name DEFAULTUSER then some information is stored about the user. The
107 * Program look if some information about the user is stored.
109 void setNewUser(const QString n
);
110 /** returns a pointer to the actual user object */
111 KVerbosUser
* getUser() { return benutzer
; };
112 /** returns the KURL of the document */
113 const KURL
& URL() const;
114 /** sets the URL of the document */
115 void setURL(const KURL
& url
);
116 /** es wird ein Verb der Liste hinzugefügt, ist emitStatus = true, wird auch
117 * die Statuszeile entsprechend angepasst.
119 void appendVerb(const verbSpanish v
, bool emitStatus
= true);
120 /** prüft, ob die Liste des Dokumentes leer ist */
121 bool isEmpty() const;
122 /** Gibt einen Zeiger auf die Verbliste des Dokumentes zurück */
123 spanishVerbList
* getList();
124 /** Gibt die Anzahl der Verben im Dokument zurück */
125 int getAnzahl() const { return verbList2
.count(); };
126 /** Gibt die gewählte Zeit, die Formen des Verbes dazu und den spanischen
127 * und deutschen Infinitiv zurück
129 QString
getAuswahl(QString s
[][3], int &t
);
130 /** feedback from the view class about the solution */
131 void solved(const bool b
);
133 /** searches the verb given as a string in the list and returns a pointer to the verb */
134 spanishVerbList::Iterator
findVerb(const QString
& s
);
137 /** wird emittiert, wenn sich die Anzahl der Verben im Dokument verändert hat */
138 void anzahlVerbenGeaendert( int );
143 * calls repaint() on all views connected to the document object and is called by the view by which the document has been changed.
144 * As this view normally repaints itself, it is excluded from the paintEvent.
146 void slotUpdateAllViews(KVerbosView
*sender
);
150 * the list of the views currently connected to the document
152 static QPtrList
<KVerbosView
> *pViewList
;
156 * the modified flag of the current document
160 /** Die Liste der Verben */
161 spanishVerbList verbList2
;
162 KVerbosUser
* benutzer
;
165 #endif // KVERBOSDOC_H