1 | /*
|
---|
2 | * Project: MoleCuilder
|
---|
3 | * Description: creates and alters molecular systems
|
---|
4 | * Copyright (C) 2010 University of Bonn. All rights reserved.
|
---|
5 | * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
|
---|
6 | */
|
---|
7 |
|
---|
8 | /**
|
---|
9 | * \file queries.dox
|
---|
10 | *
|
---|
11 | * Created on: Jan 20, 2013
|
---|
12 | * Author: ankele
|
---|
13 | */
|
---|
14 |
|
---|
15 |
|
---|
16 | /** \page queries Queries
|
---|
17 | *
|
---|
18 | * \section description General description
|
---|
19 | *
|
---|
20 | * Queries represent the process of asking the user to input a value as an
|
---|
21 | * option for \ref actions. How that is done depends on the current UI and
|
---|
22 | * the type of the value.
|
---|
23 | *
|
---|
24 | * \section internals Internals
|
---|
25 | *
|
---|
26 | * What happens when an action needs, say, an integer valued Parameter?
|
---|
27 | * - the action object has an element of type Parameter<int> declared in its .def file (including a validator defining the constraints)
|
---|
28 | * - the action's call() requests the current UI (for example QT) to create a dialog. The QT GUI creates a QtDialog
|
---|
29 | * - Action::call() also calls Dialog::query<T>() for each of its parameters telling the dialog what to ask from the user later on (in this case query<Parameter<int>>() )
|
---|
30 | * - Action::call() calls Dialog::display()
|
---|
31 | * - for each query Dialog::display() calls Query::handle() (in non QT UIs this will read temporary input from the user)
|
---|
32 | * - Dialog::display() then tests if the temporary values in all queries are valid (Query::isValid() )
|
---|
33 | * - if all values are correct, they are stored in the Parameter objects (Query::setValue() )
|
---|
34 | * - Action::performCall() (really perform the action)
|
---|
35 | *
|
---|
36 | * QtDialog needs to be more interactive:
|
---|
37 | * - it has its own QtDialog::display()
|
---|
38 | * - QtDialog::display() shows the dialog box and waits till the user closes it
|
---|
39 | * - the int query is shown as an QSpinBox, any user input will call QtDialog::update()
|
---|
40 | * - QtDialog::update() tests if all values are valid and enables/disables the OK button accordingly
|
---|
41 | *
|
---|
42 | * The internal workings of queries:
|
---|
43 | * - Dialog::query<T>() in turn calls the virtual Dialog::queryInt(), so effectivly QtDialog::queryInt() is being called
|
---|
44 | * - QtDialog::queryInt() creates a new IntQtQuery object and stores it in the dialog's query list
|
---|
45 | * - class hierarchy: IntQtQuery - QtQuery<int> - TQuery<int> - Query
|
---|
46 | * - the base class Query only stores additional info for the user
|
---|
47 | * - TQuery stores the Parameter and the temporary value
|
---|
48 | * - QtQuery is used to ignore the handle() call
|
---|
49 | * - IntQtQuery sets up the input box and handles the GUI signals
|
---|
50 | *
|
---|
51 | * List queries (like QtIntsQuery) are a bit more tricky. It creates a QtIntQuery as a child. The value from the child query can be added to QtIntsQuery's list of values. To handle communication between parent and child the child is being embedded in its own (special) dialog owned by the parent.
|
---|
52 | *
|
---|
53 | * \date 2013-01-29
|
---|
54 | *
|
---|
55 | */
|
---|