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
|
/** \page design Design
This page contains the design for the 1.0 version of this application.
The design may be subject to change.
The <EM>beta</EM>-version will be the result of extensive testing and
necessary feature extensions.
@section program The C++ program
@subsection programStatic Static Structure
\image html classes.png "Static structure of AnyMeal"
@subsection programCollaboration Collaboration
\image html import.png "Collaboration for importing Mealmaster recipes"
When a Mealmaster recipe is imported, it is converted to XML and then to
an SQL script (the latter step is done using an XSL script). Both steps
are performed by a \c ChainedCompiler object. The resulting SQL script
(for inserting the recipe into the database) is passed to the \c Database
object for execution.
The Mealmaster parser is implemented using <A HREF="man:/flex">flex</A> to
achieve high-speed. <A HREF="man:/flex">flex</A> is a state-of-the-art
finite-state-machine lexer.
@subsection programGUI Graphical User Interface
@subsubsection programGUIMenu Menu
<UL>
<LI><B>File</B>
<UL>
<LI><B>Connect:</B> Connect to database.</LI>
<LI><B>Initialise Database:</B> Create tables for database.</LI>
<LI><B>Import MealMaster:</B> Import file with mealmaster data.</LI>
<LI><B>Clean Database:</B> Delete least recently used recipes.</LI>
<LI><B>Destruct Database:</B> Destruct tables of database.</LI>
<LI><B>Exit:</B> Terminate program.</LI>
</UL>
</LI>
<LI><B>Edit</B>
<UL>
<LI><B>Search:</B> Open search dialog.</LI>
</UL>
</LI>
<LI><B>Help</B>
<UL>
<LI><B>Contents:</B> Open chapter tree of online help.</LI>
<LI><B>Index:</B> Open keyword index of online help.</LI>
<LI><B>About:</B> Display information about program.</LI>
</UL>
</LI>
</UL>
@subsubsection programGUISearch Search Dialog
The program memorizes a list of available ingredients, which can be
edited by the user. This list is used for searching relevant recipes
(see @ref requirements).
@subsubsection programGUIList Recipe List
A <EM>recipe list</EM> is a MDI-window displaying a list of recipes and
a selection. It has the following buttons:
\li <B>Clear:</B> Clear selection.
\li <B>All:</B> Select all.
\li <B>Add to Category:</B> Add selected recipes to a category.
\li <B>Remove from Category:</B> Remove selected recipes from category.
\li <B>Export:</B> Export selected recipes to mealmaster docbook-XML or
HTML.
\li <B>Display:</B> Display highlighted recipe.
\li <B>Edit:</B> Edit highlighted recipe.
\li <B>Delete:</B> Delete selected recipes.
@section database Database
@subsection databaseER Entity Relation Diagram
All search-commands are converted to SQL and passed on to the database to
fully exploit the power of <B>MySQL</B>.
The entity relation diagram explains gives a clue of how the database
is (or rather will be) organized:
\image html er.png "Entity relation diagram for database tables"
The fields author, date, preparation time, total time and the conversion
tables for converting units are not implemented (yet).
@subsection databaseFlow Data Flow
While AnyMeal stores is data using old-style SQL databases, it also
makes extensive use of XML, XSL and XPath to access and convert the data.
While the data flow may be a bit complicated at first sight, the
corresponding application is easy to implement, because most of the
required functionality already is provided by the libraries used in this
project:
\image html dataflow.png "Dataflow showing conversion steps for recipes"
The design is using the XSU-approach (XML-SQL-Utility). This approach
already was used by the <EM>Oracle</EM>-developers. The results of all
SQL-queries are converted to XML. The preparation of the raw data can be
done by compact XSL-scripts, which leads to a software-architecture, which
is very lean and very flexible, because the database-structure is not
reflected in the program's static code. You can find more about these
ideas in the following german book:
\verbatim
"Datenbanken und XML. Konzepte, Anwendungen, Systeme" 2002 (Xpert.press)
von Wassilios Kazakos, Andreas Schmidt, Peter Tomczyk.
http://www.datenbanken-und-xml.de/
\endverbatim
F.e. for displaying the recipes are converted first to docbook and then
to HTML using an XSL-script and finally displayed with a
web-browser-plugin.
It is possible to invoke each compilation-step from the command-line.
The following command would convert the first recipe in the database
to HTML and display it with <EM>lynx</EM>:
\code
( echo "<?xml version='1.0'?><query><selection><single>1</single></selection></query>" | \
anymeal -q | anymeal --xsu -d kochbuch -u mysqlUser -p mysqlPassword |
anymeal -r | anymeal -b | anymeal -t ) 2> /dev/null | lynx -stdin
\endcode
The database contains version information. Beginning from version 1.0
there will be a concept how the database gets upgraded, if a new version
of the software requires this.
@todo All documentation has to reside in the kde-directory.
@todo Use \c QDockWindow instead of \c QMainWindow or \c QWindow
@todo Error: %rice% -> ingredient "rice and water" gets counted several
times!
@todo User-manual and context-help.
@todo Preserve intendation of recipes. Maybe use fixed-with font and
LinearLayout for lines beginning with ':' in Mealmaster file.
@todo Problem with yytext_ptr: Automake doesn't pass options to flex under
Mandrake.
@todo Fix sorting of ingredient-amounts in recipe-editor.
@todo Improve user-friendlieness of keyboard-control.
@todo Add throw-clauses wherever possible
@todo Filter input of search-dialog and wizards thoroughly (f.e. no '\''
in database-name, filtering of amount-input).
@todo language-attribute to recipe and make units and all other text in
docbook-script language dependent. Add a sample-recipe for each language.
@todo Improve graphics
@todo ID of recipe changes after editing. The dialogs and the selection
have to be updated!
@todo Fulltext search
@todo Make input-data of search-dialog and name of last database visited
persistent.
@todo Introduce forward-/backward-button for navigating through huge
amounts of recipes. */
|