10.08.2013 Views

Bachelor Thesis - Computer Graphics Group

Bachelor Thesis - Computer Graphics Group

Bachelor Thesis - Computer Graphics Group

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

are used. In any case, when no corresponding action can be found, an empty<br />

Action object is returned.<br />

Unlike the currently used PatternList, the active ActionMapping can be<br />

modified safely. The next time a gesture is performed, the corresponding action<br />

is determined according to the current state. This is beneficial as the user is<br />

able to see the changes done in the user interface immediately. To achieve good<br />

performance, the internal implementation uses QMap classes, which can be<br />

indexed directly by an Application and a Gesture.<br />

5.6 Commands<br />

Action commands have been designed to be modular and easily extensible.<br />

The interface is based on the command and prototype design patterns [1].<br />

There are two classes of commands:<br />

• ICommand is a basic command, which does not support configuration.<br />

It must implement the execute method. A finalize method, which can<br />

be overridden optionally, is also provided. This method is called when<br />

wheel gestures are performed. The purpose is to finalize the sequence<br />

of multiple command executions, each for one wheel-scrolling event. It<br />

gives the command an opportunity to restore any state it might have<br />

altered, such as releasing emulated key presses, etc.<br />

• ICommandConfigurable is an extended variant of ICommand, which<br />

is user configurable. It must implement methods, which store and restore<br />

the actual command configuration in XML. To present the configuration<br />

options in the user interface, the command implementation is supposed<br />

to fill a provided container with any widgets it may need. It must be<br />

also able to fill the widgets with the current configuration and to retrieve<br />

the configuration from the widgets. This is done by implementing a few<br />

virtual methods, prescribed by the interface<br />

Instances of the actual command implementations are managed by the CommandFactory.<br />

The factory is a globally accessible singleton, initialized by the<br />

Engine at start-up. The factory owns prototypes of all available commands.<br />

Other objects can browse the list of commands or directly request a certain<br />

command by its name. If it has been found, the prototype of the command is<br />

returned to the caller. Prototypes cannot be executed; they must be cloned to<br />

create a separate instance.<br />

A list of all commands with their descriptions can be found in the user’s<br />

manual. Some of the commands have been proposed in the goals, others have<br />

been designed while implementing the application.<br />

36

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!