Import of original sourcecode for afutrainer-3.0

Original source: http://www.oliver-saal.de/software/afutrainer/download/afutrainer-3.0-src.zip
Landing page: http://www.oliver-saal.de/software/afutrainer/download.php
092d114b47e40472238e27ee01a528a58ad2d311ec95280b404bb57c97c9fed6  afutrainer-3.0-src.zip
This commit is contained in:
Sebastian Lohff 2022-06-30 01:04:57 +02:00
commit 9f1d3c81d2
115 changed files with 18511 additions and 0 deletions

3066
APPNOTE.TXT Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,122 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
* Copyright (C) 2003-2007 by Oliver Saal *
* osaal@gmx.de *
* http://www.oliver-saal.de/software/afutrainer/ *
* *
* 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. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
Hinweis: Wenn HTML in Tags erlaubt ist, wird darauf explizit hingewiesen.
HTML wird dann entweder in CDATA-Blöcke (wie <![CDATA[ <b>fette Schrift</b> ]]>) gepackt
oder mit &lt; codiert (<answertext correct="true">42*10&lt;sup>-3&lt;/sup> A.</answertext>).
-->
<!ELEMENT afutrainer (title,publisher,version,valid,contact,comment?,options?,exam*,hint*,chapter+)>
<!-- Version des AFUTrainer-Formats - hier: 3.0 -->
<!ATTLIST afutrainer version (3.0) #REQUIRED>
<!-- Datum, an dem diese XML-Datei erstellt wurde. -->
<!ATTLIST afutrainer created CDATA #REQUIRED>
<!-- Titel (ausführlich/lang) des Fragenkatalogs -->
<!ELEMENT title (#PCDATA)>
<!-- Kurzbezeichnung des Fragenkatalogs -->
<!ATTLIST title short CDATA #IMPLIED>
<!-- unique wird benötigt, um Lernstatistiken unabh. vom Dateinamen
und eindeutig auf dem System abzuspeichern -->
<!ATTLIST title unique CDATA #REQUIRED>
<!-- Angaben zum Original-Fragenkatalog, Urheber: (Codiertes HTML erlaubt, s.o.)-->
<!ELEMENT publisher (#PCDATA)>
<!-- Version/Auflage des Original-Fragenkataloges (Codiertes HTML erlaubt, s.o.)-->
<!ELEMENT version (#PCDATA)>
<!-- Original-Versions-Datum -->
<!ATTLIST version published CDATA #REQUIRED>
<!-- Gültigkeitszeitraum des Katalogs -->
<!ELEMENT valid EMPTY>
<!ATTLIST valid from CDATA #REQUIRED>
<!ATTLIST valid until CDATA #IMPLIED>
<!-- Ansprechparter für den XML-Fragenkatalog (z.B. bei Fehlern): (Codiertes HTML erlaubt, s.o.)-->
<!ELEMENT contact (#PCDATA)>
<!-- Kommentar zum Fragenkatalog (Codiertes HTML erlaubt, s.o.)-->
<!ELEMENT comment (#PCDATA)>
<!-- Diverse Optionen -->
<!ELEMENT options EMPTY>
<!-- Wird die Reihenfolge der Antworten beim Abfragen immer durchgetauscht? Default: Ja -->
<!ATTLIST options mixanswers (true|false) "true">
<!-- Definition einer Prüfung -->
<!ELEMENT exam (exam_part+)>
<!-- Eindeutige Kennung (für Prüfungsstatistiken) -->
<!ATTLIST exam id CDATA #REQUIRED>
<!-- Name/Bezeichnung der Prüfung -->
<!ATTLIST exam name CDATA #REQUIRED>
<!-- Dauer der Prüfung in Minuten, 0 für unbegrenzt -->
<!ATTLIST exam duration CDATA #REQUIRED>
<!-- Max. erlaubte Anzahl von Fehlerpunkten zum Bestehen der Prüfung -->
<!ATTLIST exam maxerrorpoints CDATA #REQUIRED>
<!-- Teil einer Prüfung
Enthält regulären Ausdruck nach den Regeln von http://doc.trolltech.com/4.2/qregexp.html#details
Es werden für die Prüfungszusammenstellung 'count' Fragen ausgewählt,
deren 'id' diesem regulären Ausdruck entsprechen.
Bsp: <exam_part count="5">TA\d\d\d</exam_part>
=> Es sind 5 Fragen in der Prüfung, die mit TA beginnen und anschließend 3 Ziffern haben
-->
<!ELEMENT exam_part (#PCDATA)>
<!ATTLIST exam_part count CDATA #REQUIRED>
<!-- Hilfetexte/Bemerkungen zu einzelnen Fragen (Codiertes HTML erlaubt, s.o.)
Es ist möglich, ein Hilfetext mehreren Fragen zuzuordnen und auch einer Frage mehrere Texte zuzuordnen
-->
<!ELEMENT hint (#PCDATA)>
<!-- Zugeordnete Fragen, durch Leerzeichen und/oder Komma und/oder Semikolon getrennt-->
<!ATTLIST hint question CDATA #REQUIRED>
<!-- Autor des Hilfetextes -->
<!ATTLIST hint author CDATA #IMPLIED>
<!-- Datum -->
<!ATTLIST hint date CDATA #IMPLIED>
<!-- Kapitel eines Fragenkatalogs -->
<!ELEMENT chapter (chapter*, question*)>
<!-- Bezeichnung/Name des Kapitels -->
<!ATTLIST chapter name CDATA #REQUIRED>
<!-- Eindeutige ID des Kapitels -->
<!ATTLIST chapter id CDATA #REQUIRED>
<!-- Frage -->
<!ELEMENT question (textquestion, textanswer+, comment?)>
<!-- Eindeutige Kennung der Frage -->
<!ATTLIST question id CDATA #REQUIRED>
<!-- Letze Änderung der Frage -->
<!ATTLIST question changed CDATA #IMPLIED>
<!-- Fehlerpunkte beim falsch beantworten, Default: 1 -->
<!ATTLIST question errorpoints CDATA "1">
<!-- Ist die Frage aktiv bzw. prüfungsrelevant? Default: true -->
<!ATTLIST question active (true|false) "true">
<!-- Fragentext (Codiertes HTML erlaubt, s.o.) -->
<!ELEMENT textquestion (#PCDATA)>
<!-- Antwort auf eine Frage (Codiertes HTML erlaubt, s.o.) -->
<!ELEMENT textanswer (#PCDATA)>
<!-- Ist diese Anwort richtig oder falsch? (Default: false = falsch)-->
<!ATTLIST textanswer correct (true|false) "false">

108
AQDF-Format/aqdf.dtd Normal file
View File

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
AQDF (Amateur Radio Questionary Data Format) DTD
XML-DTD by Oliver Saal, Junghard Bippes and Dominik Dresel (c) 2003-2007
License: GPL v2 or later
Hinweis: Wenn HTML in Tags erlaubt ist, wird darauf explizit hingewiesen.
HTML wird dann entweder in CDATA-Blöcke (wie <![CDATA[ <b>fette Schrift</b> ]]>) gepackt
oder mit &lt; codiert (<answertext correct="true">42*10&lt;sup>-3&lt;/sup> A.</answertext>).
-->
<!ELEMENT aqdf (title,publisher,version,valid,contact,comment?,options?,exam*,hint*,chapter+)>
<!-- Version des AFUTrainer-Formats - hier: 3.0 -->
<!ATTLIST aqdf version (1.0) #REQUIRED>
<!-- Datum, an dem diese XML-Datei erstellt wurde. -->
<!ATTLIST aqdf created CDATA #REQUIRED>
<!-- Titel (ausführlich/lang) des Fragenkatalogs -->
<!ELEMENT title (#PCDATA)>
<!-- Kurzbezeichnung des Fragenkatalogs -->
<!ATTLIST title short CDATA #IMPLIED>
<!-- unique wird benötigt, um Lernstatistiken unabh. vom Dateinamen
und eindeutig auf dem System abzuspeichern -->
<!ATTLIST title unique CDATA #REQUIRED>
<!-- Angaben zum Original-Fragenkatalog, Urheber: (Codiertes HTML erlaubt, s.o.)-->
<!ELEMENT publisher (#PCDATA)>
<!-- Version/Auflage des Original-Fragenkataloges (Codiertes HTML erlaubt, s.o.)-->
<!ELEMENT version (#PCDATA)>
<!-- Original-Versions-Datum -->
<!ATTLIST version published CDATA #REQUIRED>
<!-- Gültigkeitszeitraum des Katalogs -->
<!ELEMENT valid EMPTY>
<!ATTLIST valid from CDATA #REQUIRED>
<!ATTLIST valid until CDATA #IMPLIED>
<!-- Ansprechparter für den XML-Fragenkatalog (z.B. bei Fehlern): (Codiertes HTML erlaubt, s.o.)-->
<!ELEMENT contact (#PCDATA)>
<!-- Kommentar zum Fragenkatalog (Codiertes HTML erlaubt, s.o.)-->
<!ELEMENT comment (#PCDATA)>
<!-- Diverse Optionen -->
<!ELEMENT options EMPTY>
<!-- Wird die Reihenfolge der Antworten beim Abfragen immer durchgetauscht? Default: Ja -->
<!ATTLIST options mixanswers (true|false) "true">
<!-- Definition einer Prüfung -->
<!ELEMENT exam (exam_part+)>
<!-- Eindeutige Kennung (für Prüfungsstatistiken) -->
<!ATTLIST exam id CDATA #REQUIRED>
<!-- Name/Bezeichnung der Prüfung -->
<!ATTLIST exam name CDATA #REQUIRED>
<!-- Dauer der Prüfung in Minuten, 0 für unbegrenzt -->
<!ATTLIST exam duration CDATA #REQUIRED>
<!-- Max. erlaubte Anzahl von Fehlerpunkten zum Bestehen der Prüfung -->
<!ATTLIST exam maxerrorpoints CDATA #REQUIRED>
<!-- Teil einer Prüfung
Enthält regulären Ausdruck nach den Regeln von http://doc.trolltech.com/4.2/qregexp.html#details
Es werden für die Prüfungszusammenstellung 'count' Fragen ausgewählt,
deren 'id' diesem regulären Ausdruck entsprechen.
Bsp: <exam_part count="5">TA\d\d\d</exam_part>
=> Es sind 5 Fragen in der Prüfung, die mit TA beginnen und anschließend 3 Ziffern haben
-->
<!ELEMENT exam_part (#PCDATA)>
<!ATTLIST exam_part count CDATA #REQUIRED>
<!-- Hilfetexte/Bemerkungen zu einzelnen Fragen (Codiertes HTML erlaubt, s.o.)
Es ist möglich, ein Hilfetext mehreren Fragen zuzuordnen und auch einer Frage mehrere Texte zuzuordnen
-->
<!ELEMENT hint (#PCDATA)>
<!-- Zugeordnete Fragen, durch Leerzeichen und/oder Komma und/oder Semikolon getrennt-->
<!ATTLIST hint question CDATA #REQUIRED>
<!-- Autor des Hilfetextes -->
<!ATTLIST hint author CDATA #IMPLIED>
<!-- Datum -->
<!ATTLIST hint date CDATA #IMPLIED>
<!-- Kapitel eines Fragenkatalogs -->
<!ELEMENT chapter (chapter*, question*)>
<!-- Bezeichnung/Name des Kapitels -->
<!ATTLIST chapter name CDATA #REQUIRED>
<!-- Eindeutige ID des Kapitels -->
<!ATTLIST chapter id CDATA #REQUIRED>
<!-- Frage -->
<!ELEMENT question (textquestion, textanswer+, comment?)>
<!-- Eindeutige Kennung der Frage -->
<!ATTLIST question id CDATA #REQUIRED>
<!-- Letze Änderung der Frage -->
<!ATTLIST question changed CDATA #IMPLIED>
<!-- Fehlerpunkte beim falsch beantworten, Default: 1 -->
<!ATTLIST question errorpoints CDATA "1">
<!-- Ist die Frage aktiv bzw. prüfungsrelevant? Default: true -->
<!ATTLIST question active (true|false) "true">
<!-- Fragentext (Codiertes HTML erlaubt, s.o.) -->
<!ELEMENT textquestion (#PCDATA)>
<!-- Antwort auf eine Frage (Codiertes HTML erlaubt, s.o.) -->
<!ELEMENT textanswer (#PCDATA)>
<!-- Ist diese Anwort richtig oder falsch? (Default: false = falsch)-->
<!ATTLIST textanswer correct (true|false) "false">

75
AQDF-Format/aqdf.xml Normal file
View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="ISO-8859-15"?>
<!--
AQDF (Amateur Radio Questionary Data Format) XML
by Oliver Saal, Junghard Bippes and Dominik Dresel (c) 2007
License: GPL v2 or later
-->
<!DOCTYPE aqdf SYSTEM "http://www.oliver-saal.de/software/afutrainer/download/aqdf10.dtd">
<aqdf version="1" name="DL Technik Klasse E (ab 02/2007)" created="2007-03-27" >
<!-- Wird benötigt um die Lernstatistiken eindeutig abzuspeichern -
falls sich der Dateiname (z.B. wegen neuer Fragenkatalog-Auflage) ändern
sollte: -->
<unique_name>DL-E-2006</unique_name>
<!-- Titel des Fragenkataloges -->
<title>Prüfungsfragen im Prüfungsteil Technische Kenntnisse bei Prüfungen zum Erwerb von Amateurfunkzeugnissen der Klasse E</title>
<!-- Angaben zum Original-Fragenkatalog, Urheber: -->
<author>Bundesnetzagentur&lt;br>Referat 225&lt;br>Canisiusstraße 21&lt;br>55122 Mainz&lt;br>E-Mail: Poststelle@BNetzA.de&lt;br>Fax: 06131 - 18 5644</author>
<!-- Version des Fragenkataloges -->
<version published="2006-09-01">1. Auflage, September 2006</version>
<!-- Gültigkeitsdauer -->
<valid from="2007-02-01" to="" />
<!-- Wer ist Ansprechparter für den XML-Fragenkatalog (z.B. bei Fehlern): -->
<contact>Oliver Saal, DM1OLI&lt;br>http://www.oliver-saal.de/software/afutrainer/&lt;br>Mail:osaal@gmx.de</contact>
<!-- Kommentar: (z.B: Frage xyz korrigiert...) -->
<comment></comment>
<!-- Diverse Optionen -->
<options mixanswers="1" />
<!-- Fragenauswahl pro Kapitel -->
<exam id="T" name="Technische Kenntnisse Klasse E" duration="60" maxerrorpoints="9">
<exam_part count="1">TA\d\d\d</exam_part>
<...>
</exam>
<!-- Bemerkungen zu den Fragen -->
<hint question="TB103, TB104" author="Oliver Saal (DM1OLI) osaal@gmx.de" date="2004-03-25">Bronze und Messing sind Metalle und damit Leiter. Desweiteren leitet Konstantan und Graphitstaub ebenfalls den elektrischen Strom.</hint>
<hint question="B..." author="Fragenkatalog Bundesnetzagentur">
<![CDATA[
<table>
<tr><th>Zu übermittelnder<br>Buchstabe</th><th>Schlüsselwort</th><th>Aussprache des<br>Schlüsselworts</th></tr>
<tr><td>A</td><td>Alfa</td><td><u>AL</u> FAH</td></tr>
<tr><td>Z</td><td>Zoulou</td><td><u>SUH</u> LUH</td></tr>
</table>
Die zu betonenden Silben sind <u>unterstrichen</u>.
]]>
</hint>
<chapter name="Prüfungsfragen im Prüfungsteil Technische Kenntnisse der Klasse E" id="T" >
<chapter name="Allgemeine mathematische Grundkenntnisse und Größen" id="A" >
<chapter name="Allgemeine mathematische Grundkenntnisse" id="1" >
<question id="TA101" changed="2006-09-23" errorpoints="1" active="true">
<textquestion>0,042 A entspricht</textquestion>
<textanswer correct="true">42*10&lt;sup>-3&lt;/sup> A.</textanswer>
<textanswer correct="false">42*10&lt;sup>3&lt;/sup> A.</textanswer>
<textanswer correct="false">42*10&lt;sup>-2&lt;/sup> A.</textanswer>
<textanswer correct="false">42*10&lt;sup>-1&lt;/sup> A.</textanswer>
<remark>geändert 2006-09-22, 2006-09-23 DF1IAV</remark>
<link>www.dj4uf.de/lehrg/a01/a01.html#Abg_Einheiten</link>
</question>
</chapter>
</chapter>
</chapter>
</aqdf>

BIN
Abfragestrategie.odt Normal file

Binary file not shown.

261
Doxyfile Normal file
View File

@ -0,0 +1,261 @@
# Doxyfile 1.5.1-p1
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = AFUTrainer
PROJECT_NUMBER = 2.2
OUTPUT_DIRECTORY = D:/projekte/Software/afutrainer/afutrainer-2.2/doc/
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
USE_WINDOWS_ENCODING = YES
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF = "The $name class" \
"The $name widget" \
"The $name file" \
is \
provides \
specifies \
contains \
represents \
a \
an \
the
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = YES
STRIP_FROM_PATH = D:/projekte/Software/afutrainer/afutrainer-2.2/
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 8
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
BUILTIN_STL_SUPPORT = NO
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
HIDE_UNDOC_MEMBERS = YES
HIDE_UNDOC_CLASSES = YES
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = NO
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = NO
FILE_VERSION_FILTER =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = D:/projekte/Software/afutrainer/afutrainer-2.2
FILE_PATTERNS = *.c \
*.cc \
*.cxx \
*.cpp \
*.c++ \
*.d \
*.java \
*.ii \
*.ixx \
*.ipp \
*.i++ \
*.inl \
*.h \
*.hh \
*.hxx \
*.hpp \
*.h++ \
*.idl \
*.odl \
*.cs \
*.php \
*.php3 \
*.inc \
*.m \
*.mm \
*.dox \
*.py
RECURSIVE = NO
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = NO
REFERENCES_RELATION = NO
REFERENCES_LINK_SOURCE = YES
USE_HTAGS = NO
VERBATIM_HEADERS = NO
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = NO
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = YES
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = YES
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = YES
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = NO
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = NO
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
MAX_DOT_GRAPH_DEPTH = 1000
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO

BIN
afutrainer.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

61
afutrainer.pro Normal file
View File

@ -0,0 +1,61 @@
win32 {
TEMPLATE = vcapp
}
else {
TEMPLATE = app
}
TARGET = afutrainer
QT += qt gui xml
HEADERS = mainwindow.h \
catalogmodel.h \
questionmodel.h \
dlglearn.h \
dlgviewquestion.h \
question.h \
chapter.h \
catalog.h \
dlglearnassistant.h \
answer.h \
helper.h \
chaptermodel.h \
osziparchive.h \
dlginformation.h \
exam.h \
dlgexam.h \
dlgexamselect.h \
error.h \
tools.h \
dlglearnstatistic.h \
dlgexamstatistic.h \
plotwidget.h \
recentfiles.h
SOURCES = main.cpp \
mainwindow.cpp \
catalogmodel.cpp \
questionmodel.cpp \
dlglearn.cpp \
dlgviewquestion.cpp \
question.cpp \
chapter.cpp \
catalog.cpp \
dlglearnassistant.cpp \
answer.cpp \
helper.cpp \
chaptermodel.cpp \
osziparchive.cpp \
dlginformation.cpp \
exam.cpp \
dlgexam.cpp \
dlgexamselect.cpp \
error.cpp \
tools.cpp \
dlglearnstatistic.cpp \
dlgexamstatistic.cpp \
plotwidget.cpp \
recentfiles.cpp
FORMS = mainwindow.ui dlglearn.ui dlgviewquestion.ui dlglearnassistant.ui dlginformation.ui dlgexamselect.ui dlgexam.ui dlglearnstatistic.ui dlgexamstatistic.ui
RC_FILE = afutrainer.rc
RESOURCES += afutrainer.qrc

36
afutrainer.qrc Normal file
View File

@ -0,0 +1,36 @@
<RCC>
<qresource prefix="/" >
<file>icons/16x16/book1.png</file>
<file>icons/16x16/button_ok.png</file>
<file>icons/16x16/button_cancel.png</file>
<file>icons/16x16/cancel.png</file>
<file>icons/16x16/clock.png</file>
<file>icons/16x16/contexthelp.png</file>
<file>icons/16x16/exit.png</file>
<file>icons/16x16/filenew.png</file>
<file>icons/16x16/fileopen.png</file>
<file>icons/16x16/filesave.png</file>
<file>icons/16x16/filesaveas.png</file>
<file>icons/16x16/finish.png</file>
<file>icons/16x16/folder.png</file>
<file>icons/16x16/idea.png</file>
<file>icons/16x16/idea_gray.png</file>
<file>icons/16x16/idea_info.png</file>
<file>icons/16x16/info.png</file>
<file>icons/16x16/level0.png</file>
<file>icons/16x16/level1.png</file>
<file>icons/16x16/level2.png</file>
<file>icons/16x16/level3.png</file>
<file>icons/16x16/level4.png</file>
<file>icons/16x16/level5.png</file>
<file>icons/16x16/next.png</file>
<file>icons/16x16/previous.png</file>
<file>icons/16x16/start.png</file>
<file>icons/16x16/stats.png</file>
<file>icons/16x16/stop.png</file>
<file>icons/16x16/viewmag.png</file>
<file>icons/32x32/idea.png</file>
<file>icons/32x32/qt.png</file>
<file>translations/qt_de.qm</file>
</qresource>
</RCC>

1
afutrainer.rc Normal file
View File

@ -0,0 +1 @@
IDI_ICON1 ICON DISCARDABLE "afutrainer.ico"

119
answer.cpp Normal file
View File

@ -0,0 +1,119 @@
/***************************************************************************
* Copyright (C) 2003-2007 by Oliver Saal *
* osaal@gmx.de *
* http://www.oliver-saal.de/software/afutrainer/ *
* *
* 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. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "answer.h"
#include <qcoreapplication.h>
CAnswer::CAnswer(const QString& strText, const bool bCorrect)
{
m_strText = strText;
m_bIsCorrect = bCorrect;
}
void CAnswer::clear()
{
m_strText.clear();
m_bIsCorrect = false;
}
QString CAnswerClicked::tr (const char *sourceText, const char *comment)
{
return QCoreApplication::translate("CAnswerClicked", sourceText, comment);
}
void CAnswerClicked::clear()
{
m_dt = QDateTime::currentDateTime();
m_uAnswer=0;
m_uNeededTime=0;
}
bool CAnswerClicked::operator < (const CAnswerClicked& ac) const
{
return m_dt < ac.m_dt;
}
QString CAnswerClicked::answerText(const unsigned uAnswer)
{
QString strRet;
for (int i=0; i<32; i++)
{
if (uAnswer & (1<<i))
{
if (!strRet.isEmpty())
strRet += ", ";
strRet += QChar('A' + i);
}
}
return strRet;
}
QString CAnswerClicked::answerText() const
{
return answerText(m_uAnswer);
}
QString CAnswerClicked::neededTimeText() const
{
if (m_uNeededTime < 1000)
return tr("&lt; 1 sec");
else if (m_uNeededTime < 60000)
return tr("%1 sec").arg(m_uNeededTime / 1000);
else
return tr("%1:%2 min").arg(m_uNeededTime / 60000).arg((m_uNeededTime / 1000) % 60, 2, 10, QChar('0'));
}
bool CAnswerClicked::isCorrect(const QList<CAnswer>& listAnswer) const
{
unsigned uMask=0;
for (int i=0; i<listAnswer.size(); i++)
{
if (listAnswer.at(i).isCorrect())
uMask |= (1<<i);
}
return (m_uAnswer == uMask);
}
bool CAnswerClicked::load (QDomElement elem)
{
bool bOk=false;
if (elem.tagName() != "answer_clicked") return false;
m_dt = QDateTime::fromString (elem.attribute("datetime"), Qt::ISODate);
if (!m_dt.isValid()) return false;
m_uAnswer = elem.attribute("answer_code").toUInt(&bOk);
if (!bOk) return false;
m_uNeededTime = elem.attribute("needed_time").toUInt(&bOk);
if (!bOk) return false;
return true;
}
void CAnswerClicked::save (QDomElement& parent, QDomDocument& doc) const
{
QDomElement elem = doc.createElement("answer_clicked");
elem.setAttribute("datetime", m_dt.toString(Qt::ISODate));
elem.setAttribute("answer_code", QString("%1").arg(m_uAnswer));
elem.setAttribute("needed_time", QString("%1").arg(m_uNeededTime));
parent.appendChild(elem);
}

142
answer.h Normal file
View File

@ -0,0 +1,142 @@
/***************************************************************************
* Copyright (C) 2003-2007 by Oliver Saal *
* osaal@gmx.de *
* http://www.oliver-saal.de/software/afutrainer/ *
* *
* 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. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef ANSWER_H
#define ANSWER_H
#include <qstring.h>
#include <qdom.h>
#include <qlist.h>
#include <qdatetime.h>
//! Die Klasse CAnswer speichert eine einzelne Antwort auf eine Frage
/*!
Das Schreiben und Lesen von XML-Daten wird von der Klasse CQuestion übernommen
*/
class CAnswer
{
public:
//! Standard-Konstruktor
/*! Initialisiert die Klasse, indem die Funktion clear() aufgerufen wird. */
CAnswer() { clear(); }
//! Konstruktor inkl. setzen eines Textes und ob die Antwort richtig ist
/*!
\param strText Antworttext
\param bCorrect true: Die Antwort ist korrekt
\sa m_strText, m_bIsCorrect
*/
CAnswer(const QString& strText, const bool bCorrect);
//! Standard-Destruktor
/*! In der Standard-Implementierung tut der Destruktor nichts. */
~CAnswer() {}
//! Zurücksetzen aller Werte
/*! Es werden alle Daten der Antwort gelöscht. */
void clear();
//! Überprüfen, ob die Klasse eine Antwort enthält
/*! \return true: Die Klasse ist leer und enthält keine Antwort */
inline bool isEmpty() const { return m_strText.isEmpty(); }
//! Auslesen, ob diese Antwort richtig ist
/*! \return true: Die Antwort ist richtig */
inline bool isCorrect() const { return m_bIsCorrect; }
//! Auslesen des Antworttextes
/*! \return Antworttext */
inline QString text() const { return m_strText; }
//! Setzen, ob diese Antwort richtig ist
/*!
\param bCorrect true: Die Antwort ist korrekt
\sa m_bIsCorrect
*/
inline void setCorrect (const bool bCorrect) { m_bIsCorrect = bCorrect; }
//! Setzen des Antworttextes
/*!
\param strText Antworttext
\sa m_strText
*/
inline void setText(const QString& strText) { m_strText = strText; }
//! Anhängen eines Textes an den Antworttext
/*!
\param strText Anzuhängender Text
\sa m_strText
*/
inline void appendText(const QString& strText) { m_strText += strText; }
protected:
//! Antworttext
/*!
Der Antworttext darf HTML-Code und HTML-Verweise auf Grafiken/Bilder enthalten. Bei Verweisen ist zu achten, dass kein Verzeichnis angegeben werden darf!
Default: leer
*/
QString m_strText;
//! Richtige oder falsche Antwort
/*! Default: false */
bool m_bIsCorrect;
};
//! Die Klasse CAnswerClicked speichert eine einzelne Beantwortung des Benutzers
/*!
*/
class CAnswerClicked
{
public:
//! Standard-Konstruktor
/*! Initialisiert die Klasse, indem die Funktion clear() aufgerufen wird. */
CAnswerClicked () { clear(); }
CAnswerClicked (const unsigned uAnswer, const unsigned uNeededTime)
{ m_uAnswer = uAnswer; m_dt = QDateTime::currentDateTime(); m_uNeededTime = uNeededTime; }
//! Standard-Destruktor
/*! In der Standard-Implementierung tut der Destruktor nichts. */
~CAnswerClicked () {}
//! Zurücksetzen aller Werte
/*! Es werden alle Daten auf Default-Werte zurückgesetzt. */
void clear();
inline QDateTime dateTime() const { return m_dt; }
inline unsigned neededTime() const { return m_uNeededTime; }
inline unsigned answer() const { return m_uAnswer; }
static QString answerText(const unsigned uAnswer);
QString answerText() const;
QString neededTimeText() const;
bool isCorrect(const QList<CAnswer>& listAnswer) const;
bool load (QDomElement elem);
void save (QDomElement& parent, QDomDocument& doc) const;
static QString tr (const char *sourceText, const char *comment=0);
bool operator < (const CAnswerClicked& ac) const;
protected:
QDateTime m_dt; //!< Zeitstempel der Antwort
unsigned m_uAnswer; //!< Antwort-Bitmaske
unsigned m_uNeededTime; //!< Benötigte Zeit in ms
};
#endif

433
catalog.cpp Normal file
View File

@ -0,0 +1,433 @@
/***************************************************************************
* Copyright (C) 2003-2007 by Oliver Saal *
* osaal@gmx.de *
* http://www.oliver-saal.de/software/afutrainer/ *
* *
* 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. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "catalog.h"
#include "osziparchive.h"
#include "tools.h"
#include <qdir.h>
#include <qfile.h>
#include <qmessagebox.h>
#include <qtextstream.h>
#include <qvariant.h>
CCatalog::~CCatalog()
{
qDeleteAll(m_listFiles);
}
void CCatalog::clear()
{
CChapter::clear();
m_bMixAnswers = true;
m_bSort = false;
m_strFileName.clear();
m_listHint.clear();
m_strUniqueName.clear();
qDeleteAll(m_listFiles);
m_strPublisher.clear();
m_strContact.clear();
m_dateValidFrom = QDate();
m_dateValidUntil = QDate();
m_dateCreated = QDate();
m_datePublished = QDate();
m_strVersion.clear();
m_listExam.clear();
m_listExamStat.clear();
}
bool CCatalog::isEmpty()
{
return m_strText.isEmpty();
}
bool CCatalog::isValid() const
{
if (m_dateValidFrom.isValid() && QDate::currentDate() < m_dateValidFrom) return false;
if (m_dateValidUntil.isValid() && QDate::currentDate() > m_dateValidUntil) return false;
return true;
}
bool CCatalog::hasHints (const QString& strQuestionId) const
{
for (int i=0; i<m_listHint.size(); i++)
{
if (m_listHint.at(i).hasQuestion(strQuestionId)) return true;
}
return false;
}
QString CCatalog::hintText (const QString& strQuestionId) const
{
QString str;
if (strQuestionId.isEmpty()) return QString();
for (int i=0; i<m_listHint.size(); i++)
{
if (m_listHint.at(i).hasQuestion(strQuestionId))
str += m_listHint[i].showText();
}
return str;
}
bool CCatalog::load (const QString& strFileName, QWidget *pParent)
{
QDomDocument doc;
QDomElement elemRoot, e;
QDomNode n;
QString str, strXML;
int iErrLine, iErrCol;
double dVersion=0.0;
CChapter *pChapter=0;
if (strFileName.right(3).toLower() != "aqz") return false;
CZipArchive zip;
if (!zip.open(strFileName, CZipArchive::OpenReadOnly))
{
QMessageBox::critical(pParent, pParent->tr("Datei-Fehler"), pParent->tr("Konnte folgende Datei nicht zum Lesen öffnen:\n%1").arg(strFileName));
return false;
}
// Fragen entpacken
CZipFile *pzfQuestions = zip.findFile("questions.xml");
if (pzfQuestions == 0)
{
QMessageBox::critical(pParent, pParent->tr("Datei-Fehler"), pParent->tr("Konnte in der Datei '%1' keine Fragen finden.").arg(strFileName));
return false;
}
strXML = QString::fromUtf8(pzfQuestions->deflateToByteArray());
clear();
// Alle Grafiken in temp. Dateien entpacken
// pParent->setCursor(Qt::WaitCursor);
for (int i=0; i<zip.fileCount(); i++)
{
CZipFile *pzf = zip.fileAt(i);
str = pzf->fileName().right(3);
if (str == "png" || str == "jpg" || str == "gif" || str == "bmp")
{ // Datei entpacken und Pfade im XML anpassen
str = QDir::temp().absoluteFilePath(pzf->fileName()+".XXXXXX");
QTemporaryFile *ptf = new QTemporaryFile(str);
ptf->open();
str = ptf->fileName();
pzf->deflateToFile(*ptf);
ptf->close();
m_listFiles.append(ptf);
strXML.replace(pzf->fileName(), str);
//qDebug ("Deflating %s to %s", qPrintable(pzf->fileName()), qPrintable(str));
}
}
// pParent->setCursor(Qt::ArrowCursor);
if (!doc.setContent(strXML, true, &str, &iErrLine, &iErrCol))
{
QMessageBox::critical(pParent, pParent->tr("XML-Fehler"), pParent->tr("Fragenkatalog: ") + strFileName + "\n" + str + "\n" + QString (pParent->tr("Zeile: %1 Spalte %2")).arg(iErrLine).arg(iErrCol));
return false;
}
elemRoot = doc.documentElement ();
if (elemRoot.tagName() != "aqdf")
{
QMessageBox::critical(pParent, pParent->tr("Datei-Fehler"), pParent->tr("Unbekanntes XML-Datenformat '%1'.").arg(elemRoot.tagName()));
return false;
}
//m_strText = elemRoot.attribute ("name");
m_dateCreated = QDate::fromString(elemRoot.attribute("created"), Qt::ISODate);
dVersion = elemRoot.attribute("version").toDouble();
if (dVersion != 1.0)
{
QMessageBox::information(pParent, pParent->tr("Information"), pParent->tr("Kann die Dateiversion %1 des Fragenkatalogs '%2' nicht lesen.").arg(dVersion).arg(strFileName));
return false;
}
n = elemRoot.firstChild();
while (!n.isNull())
{
if (n.isElement ())
{
e = n.toElement ();
if (e.tagName() == QString ("chapter"))
{
pChapter = new CChapter();
if (pChapter->load (e))
appendChapter(pChapter);
else
delete pChapter;
}
else if (e.tagName() == QString ("exam"))
{
CExam exam;
if (exam.load(e)) m_listExam.append(exam);
}
else if (e.tagName () == "hint")
{
CHint hint;
if (hint.load (e))
m_listHint.append (hint);
}
else if (e.tagName () == "title")
{
m_strText = e.text();
m_strUniqueName = e.attribute("unique");
}
else if (e.tagName () == "comment")
m_strComment = e.text();
else if (e.tagName () == "contact")
m_strContact = e.text();
else if (e.tagName () == "publisher")
m_strPublisher = e.text();
else if (e.tagName() == "valid")
{
m_dateValidFrom = QDate::fromString(e.attribute("from"), Qt::ISODate);
m_dateValidUntil = QDate::fromString(e.attribute("until"), Qt::ISODate);
}
else if (e.tagName() == "version")
{
m_datePublished = QDate::fromString(e.attribute("published"), Qt::ISODate);
m_strVersion = e.text();
}
else if (e.tagName() == "options")
{
m_bMixAnswers = QVariant(e.attribute("mixanswers", "true")).toBool();
m_bSort = QVariant(e.attribute("sort", "false")).toBool();
}
}
n = n.nextSibling();
}
if (m_strUniqueName.isEmpty())
m_strUniqueName = QDir(strFileName).dirName();
if (m_bSort) sortAll();
loadStatistic (pParent);
updateStatistic();
m_strFileName = strFileName;
return true;
}
bool CCatalog::save (const QString& strFileName, QWidget *pParent)
{
QFile file (strFileName);
if (strFileName.isEmpty()) return false;
if (!file.open(QIODevice::WriteOnly))
{
QMessageBox::critical(pParent, QString(pParent->tr("Datei-Fehler")), pParent->tr("Konnte folgende Datei nicht zum Schreiben öffnen:\n")+strFileName);
return false;
}
QTextStream out(&file);
QDomDocument doc("afutrainer");
QDomElement elemRoot = doc.createElement("afutrainer");
//elemRoot.setAttribute("name", name());
elemRoot.setAttribute("version", 3.0);
elemRoot.setAttribute("created", QDate::currentDate().toString(Qt::ISODate));
doc.appendChild(elemRoot);
// save unique name
QDomElement elemTitle = createXmlTextElement("title", name(), doc);
elemTitle.setAttribute("unique", m_strUniqueName);
elemRoot.appendChild (elemTitle);
// save comment
if (!m_strComment.isEmpty())
elemRoot.appendChild (createXmlTextElement("comment", m_strComment, doc));
// save contact
if (!m_strContact.isEmpty())
elemRoot.appendChild (createXmlTextElement("contact", m_strContact, doc));
// save publisher
if (!m_strPublisher.isEmpty())
elemRoot.appendChild (createXmlTextElement("publisher", m_strPublisher, doc));
// save version
QDomElement elemVersion = createXmlTextElement("version", m_strVersion, doc);
elemVersion.setAttribute("published", m_datePublished.toString(Qt::ISODate));
elemRoot.appendChild(elemVersion);
// save dates
if (m_dateValidFrom.isValid() || m_dateValidUntil.isValid())
{
QDomElement elemValid = doc.createElement("valid");
elemValid.setAttribute("from", m_dateValidFrom.toString(Qt::ISODate));
elemValid.setAttribute("until", m_dateValidUntil.toString(Qt::ISODate));
elemRoot.appendChild(elemValid);
}
// TODO: save tests
// save chapters
for (int i=0; i<m_listChapter.size(); i++)
m_listChapter[i]->save(elemRoot, doc);
// save helpers
for (int i=0; i<m_listHint.size(); i++)
m_listHint[i].save(elemRoot, doc);
out << doc.toString();
m_strFileName = strFileName;
return true;
}
QString CCatalog::statisticFileName() const
{
QDir dir;
QString str = dir.homePath()+QString("/.afutrainer/") + m_strUniqueName + QString(".stat.xml");
Q_ASSERT(!m_strUniqueName.isEmpty());
return (str);
}
bool CCatalog::loadStatistic(QWidget *pParent)
{
QDomDocument doc;
QDomElement elemRoot, e;
QDomNode n;
QFile file (statisticFileName());
QString strVerzeichnis, str, strXML;
int iErrLine, iErrCol;
if (!file.exists()) return true;
if (!file.open (QIODevice::ReadOnly))
{
QMessageBox::critical(pParent, QString(pParent->tr("Datei-Fehler")), pParent->tr("Konnte folgende Datei nicht zum Lesen öffnen:\n")+statisticFileName());
return false;
}
QTextStream in (&file);
strXML = in.readAll();
if (!doc.setContent(strXML, true, &str, &iErrLine, &iErrCol))
{
QMessageBox::critical(pParent, pParent->tr("XML-Fehler"), pParent->tr("Statistik zum Fragenkatalog: ") + statisticFileName() + "\n" + str + "\n" + QString (pParent->tr("Zeile: %1 Spalte %2")).arg(iErrLine).arg(iErrCol));
return false;
}
file.close ();
elemRoot = doc.documentElement ();
if (doc.doctype().name() != "AFUTrainerStatistics") return false;
if (elemRoot.tagName() != "statistic") return false;
n = elemRoot.firstChild();
while (!n.isNull())
{
if (n.isElement ())
{
e = n.toElement ();
if (e.tagName() == QString ("learning"))
{
loadLearnStatistic(e);
}
else if (e.tagName() == QString("exams"))
loadExamStatistic(e);
}
n = n.nextSibling();
}
return true;
}
bool CCatalog::saveStatistic(QWidget *pParent)
{
QDomDocument doc ("AFUTrainerStatistics");
QString strFileName = statisticFileName();
QFile file (strFileName);
if (m_strUniqueName.isEmpty()) return false;
QDomElement elemRoot = doc.createElement ("statistic");
elemRoot.setAttribute ("name", name());
elemRoot.setAttribute("version", 2);
elemRoot.setAttribute("date", QDate::currentDate().toString(Qt::ISODate));
doc.appendChild (elemRoot);
QDomElement elemLearn = doc.createElement ("learning");
elemRoot.appendChild (elemLearn);
saveLearnStatistic(elemLearn, doc);
QDomElement elemExams = doc.createElement ("exams");
elemRoot.appendChild (elemExams);
saveExamStatistic(elemExams, doc);
if (!file.open (QIODevice::WriteOnly))
{
QMessageBox::critical (pParent, pParent->tr("Fehler"), pParent->tr("Konnte folgende Datei nicht zum Schreiben öffnen.\n")+strFileName);
return false;
}
QTextStream out(&file);
out << doc.toString ();
return true;
}
bool CCatalog::loadExamStatistic (QDomElement& elemRoot)
{
QDomNode n;
QDomElement e;
n = elemRoot.firstChild();
while (!n.isNull())
{
if (n.isElement ())
{
e = n.toElement ();
if (e.tagName() == QString ("exam"))
{
CExamStat es;
if (es.load(e)) m_listExamStat.append(es);
}
}
n = n.nextSibling();
}
return true;
}
void CCatalog::saveExamStatistic (QDomElement& parent, QDomDocument& doc)
{
for (int i=0; i<m_listExamStat.size(); i++)
{
m_listExamStat.at(i).save (parent, doc);
}
}
QList<CChapter*> CCatalog::chapters()
{
QList<CChapter*> list;
list.append(this);
list << subChapters();
return list;
}
CExam CCatalog::examById(const QString& strId) const
{
for (int i=0; i<m_listExam.size(); i++)
{
if (m_listExam.at(i).id() == strId)
return m_listExam.at(i);
}
return CExam();
}

120
catalog.h Normal file
View File

@ -0,0 +1,120 @@
/***************************************************************************
* Copyright (C) 2003-2007 by Oliver Saal *
* osaal@gmx.de *
* http://www.oliver-saal.de/software/afutrainer/ *
* *
* 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. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef CATALOG_H
#define CATALOG_H
#include "chapter.h"
#include "exam.h"
#include <qlist.h>
#include <qtemporaryfile.h>
class CCatalog : public CChapter
{
public:
CCatalog() : CChapter() { clear(); }
~CCatalog();
void clear();
bool isEmpty();
inline QString name() const { return m_strText; }
inline void setName(const QString& strName) { m_strText = strName; }
inline QString contact() const { return m_strContact; }
inline void setContact(const QString& strContact) { m_strContact = strContact; }
inline QString publisher()