Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

QlabTicketLine Class Reference
[Cashbox Related Classes]

#include <qlabticketline.h>

List of all members.


Detailed Description

The QlabTicketLine provides an abstract view of cashbox ticket lines. Its main reason for existing is that it is used both in cashboxes and in server side. The cashbox is used a a ticket lines generator while the server side classes act as a system dispatcher for the relevant informations.

Version:
0.8.2a
Author:
DJ Anubis <labproject@free.fr>

Warning:

	This is a work in progress class. The only thing that you can get
	for sure is the interface, which may extend but not change in incompatible
	ways. Do not rely on code in this class, at it can be fully revamped before
	we reach version 1.0.
	
The ticketline presents an abstraction for data included in a standard ticket line. It is used by both the various flavours of cashbox applications and server side processing.

QlabTicketLine proposes an abstract view for ticket data, via the classic QVariant mechanism. If you are not familiar with QVariant read the QVariant class description in Qt documentation

The class offers a good deal of line types. If you need to add some new types, you should ask for a specific code if you want a good compatibility with future versions.

One of the evolutions could be a parametrizable linetype descriptor which could be dynamically expanded. But this is still a wish as some issues did not yet find an elegant solution.

You gain access to data items using the usual value() and setValue() methods. store() and get() methods deal with the data repository, including a local fallback when master server is busy or down.

setGetField() method should be used very carefully as, badly parametrized, you could get the wrong data object.

A sample of usage is included in qlabibmcashbox.cpp sample application which describes a full fledged skeleton for IBM 4694 cashbox hardware.

License :

	Please read the license file in doc directory.
	1. Lab Public License.
		You should have received a copy of the Lab Public License
		with this package.
		If this is not the case, you can read it or download it at:
		http://labproject.free.fr
	2. Q Public License.
		Conformant to Trolltech QPL license.
	3. GNU General Public License.
		Reserved for free projects.
	4. Commercial license.
		Recommanded if your code is not distributed under one of the
		3 models above.

	Read the license FAQ in doc directory.
	

Public Types

Public Slots

Signals

Public Member Functions

Private Slots

Private Attributes


Member Enumeration Documentation

enum QlabTicketLine::LineTypes
 

Provides standard Line Types for Ticket lines.

Most of these names are self explanatory. Moneo is a French paypal like system, Separator inserts a line not dealing with real cashbox data.


Constructor & Destructor Documentation

QlabTicketLine::QlabTicketLine QObject *  parent = 0,
char *  name = 0
 

Builds a new QlabTicketLine instance.

Note:
All instance vars receive default values. Those are coherent with values dedicated to the most often used line type, say standard line.

QlabTicketLine::~QlabTicketLine  ) 
 

Deletes the instance of QlabTicketLine.

Note:
You might never call this as Qt does this very well, as we do not have static objects around.


Member Function Documentation

bool QlabTicketLine::get const QVariant &  val  )  [slot]
 

Get a Ticket Line from the data collection using the val Get Descriptor.

If setGetField() Method has not been called to remap the getter, you pass a recid ObjectID. Else you pass the wanted value. Note that an invalid descriptor can lead to 2 situations: 1. FALSE on really invalid value. 2. TRUE idf the value is valid for something, but you posted a logical error in your code. Be very carefull when changing the setGetField() method.

On FALSE result, you can access the reject reason using lastError() Method to get informations from the backend with a textual explanation.

void QlabTicketLine::init  )  [private, slot]
 

Inits the ticket line fields to known values.

This gives the most often used defaults, say: empty Line type.

Note:
Various line types may need various defaults. See Ticket Line Record format for more information.
Todo:
Document the different ticket line types formats.

void QlabTicketLine::itemTypeError const QString &  err  )  [signal]
 

Emited whenever a data Type or Name error appears.

This signal is emited whenever a data Type or Name error appears. The err string gives a somewhat database repository dependant error description.

Note:
Some database backends only give cryptic messages dealing with error numbers without explanation. In such a case, you'll have to keep the error code documentation for your DBMS in an easy access shelf around to understand the problem.

QString QlabTicketLine::lastError  )  [slot]
 

Returns the last Error String from the data repository backend.

Note:
The system does what is possible to give something useful, but some DBMS systems only return some cryptic values needing some kind of magic and the (huge) reference manual to deal with.

void QlabTicketLine::setGetField const QString &  fldname  )  [slot]
 

Sets the default Get Field to something else than the standard recid field.

This can lead to strange results if the getter is not an absolute reference to an object.

Note:
If the field name is invalid, a itemTypeError() signal is emited.

void QlabTicketLine::setValue const QString &  fld,
const QVariant &  value
[slot]
 

Sets the value for the fld field to value.

Note:
An invalid field name will emit a itemTypeError() signal

bool QlabTicketLine::store  )  [slot]
 

Stores the values to the repository.

We first try to connect to master server. If connection fails, we use the local backdrop. When master comes up afeter a backdrop, we have to push to the master the whole pile of ticket lines before registering the new one.

Returns TRUE if save is correct. Else returns FALSE and you can access the error with lastError() method.

QVariant QlabTicketLine::value const QString &  fld  )  [slot]
 

Returns the value of the field fld as a QVariant.

Note:
An invalid field name will not post an error but return an Invalid QVariant instance and emits a itemTypeError() signal


Member Data Documentation

bool QlabTicketLine::changed [private]
 

For internal use only.

Flag telling the store() method if something has to be saved here.

QlabDatabaseCashboxClient* QlabTicketLine::dbc [private]
 

For internal use only.

Hook to the client interface to repository

QString QlabTicketLine::dbErr [private]
 

For internal use only.

Keeps in a cool place the last error reported from the backend data repository.

QString QlabTicketLine::defaultGet [private]
 

For internal use only.

Stores the current Get Field used for get() method.

QMap< QString, QVariant> QlabTicketLine::line [private]
 

For internal use only.

Warning:
Don't rely on this. May change in a near future... Maybe only a few days before ultimate change. Maps data structure in a convenient access way.

Todo:
revamp the line QMap to something more exiting.

QlabDatabaseCashboxClient* QlabTicketLine::master [private]
 

For internal use only.

Short hand access to master connection.

 

L.A.B. Project © 2001-2004 LAB Project & DJ Anubis