Labeler interface. More...
#include <bpslabeler.h>
Signals | |
| void | error (const QString &aMessage) |
| Error signal. | |
| void | hideProgress () |
| Emitted after the operation is completed (or failed or was aborted). | |
| void | showProgress (int aMaximum, const QString &aLabel) |
| Emitted at start of operation to begin showing the progress indicator. | |
| void | updateProgressLabel (const QString &aLabel) |
| Emitted to update the progress label text. | |
| void | updateProgressMaximum (int aMaximum) |
| Emitted to change the highest tick value. | |
| void | updateProgressValue (int aValue) |
| Emitted when progress reaches next value to update the progress indicator. | |
Public Member Functions | |
| BpsLabeler (BpsDatastore *aDatastore, const QString &aLabelerId, QObject *aParent=0) | |
| virtual bool | canSave () |
| Information if save() and clear() is supported. | |
| virtual bool | canStartStop () |
| Information if start() and stop() is supported. | |
| virtual void | clear (const QVariant &aCollection, volatile bool *aCancelFlag=0) |
| Delete all articles of a collection from the labelers internal database. | |
| void | clearCache () |
| Clear the cached global and settings data. | |
| virtual void | close (volatile bool *aCancelFlag=0)=0 |
| Close the device and release it for manual operation. | |
| BpsDatastore * | datastore () const |
| QString | labelerId () const |
| virtual void | load (const QVariant &aArticle, const QVariant &aCollection, const QVariantMap &aParams, volatile bool *aCancelFlag=0)=0 |
| Load an article into the working memory so it is ready to start labeling. | |
| virtual void | open (int aLineNo, const QString &aLineName, const QMap< QString, QString > &aConfig, volatile bool *aCancelFlag=0)=0 |
| Open the device and do general initializations (setting the current date for example). | |
| virtual void | processEvents () |
| Process pending events from labeler. | |
| virtual void | save (const QVariant &aArticle, const QVariant &aCollection, const QVariantMap &aParams, volatile bool *aCancelFlag=0) |
| Save an article to the labelers internal database for emergency or offline operation. | |
| virtual void | saveLoad (const QVariant &aArticle, const QVariant &aCollection, const QVariantMap &aParams, volatile bool *aCancelFlag=0) |
| Save an article to the labelers internal database, and load it into the working memory so it is ready to start labeling. | |
| void | setCustomData (const QString &aSettingsData, const QString &aGlobalData) |
| Makes the labeler use custom data instead of the regular data. | |
| virtual void | start (volatile bool *aCancelFlag=0) |
| Start labeling, if supported by the device. | |
| virtual void | stop (volatile bool *aCancelFlag=0) |
| Stop labeling, if supported by the device. | |
| virtual | ~BpsLabeler () |
| Virtual default destructor. | |
Protected Member Functions | |
| QString | globalData () const |
| The global data is independent of the distinct setting. | |
| bool | init (const QVariant &aArticle, const QVariant &aCollection, const QVariantMap &aParams) |
| Initialize the internal data for processing placeholders. | |
| QString | processPlaceholders (const QString &aText) |
| Replace the placeholders in the given text. | |
| virtual QString | processReplacement (const QString &aText) |
| After the substitute content for a placeholder has been created, this method gets called to post-process it. | |
| QString | settingsData () const |
| The settings data belonging to the latest article init() was called for. | |
Labeler interface.
| BpsLabeler::BpsLabeler | ( | BpsDatastore * | aDatastore, |
| const QString & | aLabelerId, | ||
| QObject * | aParent = 0 |
||
| ) |
| [in] | aDatastore | The datastore to use. |
| [in] | aLabelerId | The labeler ID, for example "generic" or "lm2000". |
| [in] | aParent | The parent object. |
| virtual bool BpsLabeler::canSave | ( | ) | [virtual] |
| virtual bool BpsLabeler::canStartStop | ( | ) | [virtual] |
| virtual void BpsLabeler::clear | ( | const QVariant & | aCollection, |
| volatile bool * | aCancelFlag = 0 |
||
| ) | [virtual] |
Delete all articles of a collection from the labelers internal database.
The default implementation does nothing.
| [in] | aCollection | Key of the collection. The collection is used as folder/group/customer in the labelers internal database. |
| [in] | aCancelFlag | If the cancel flag becomes false during operation, the method will throw a BpsException. |
| BpsException | on errors or when operation is canceled. |
| void BpsLabeler::clearCache | ( | ) |
Clear the cached global and settings data.
Any previous setCustomData() action is reverted and regular data gets used again.
| virtual void BpsLabeler::close | ( | volatile bool * | aCancelFlag = 0 | ) | [pure virtual] |
Close the device and release it for manual operation.
| [in] | aCancelFlag | If the cancel flag becomes false during operation, the method will throw a BpsException. |
| BpsException | on errors or when operation is canceled. |
| BpsDatastore* BpsLabeler::datastore | ( | ) | const |
| void BpsLabeler::error | ( | const QString & | aMessage | ) | [signal] |
Error signal.
| [in] | aMessage | The error message. |
| QString BpsLabeler::globalData | ( | ) | const [protected] |
The global data is independent of the distinct setting.
For performance reasons the global data is cached, however it is possible to force reloading by calling clearCache() in advance.
| BpsException | on errors. |
| void BpsLabeler::hideProgress | ( | ) | [signal] |
Emitted after the operation is completed (or failed or was aborted).
The progress indicator should get hidden.
| bool BpsLabeler::init | ( | const QVariant & | aArticle, |
| const QVariant & | aCollection, | ||
| const QVariantMap & | aParams | ||
| ) | [protected] |
Initialize the internal data for processing placeholders.
Usually this will get called by implementations of load() and save() before replacing the placeholders.
| [in] | aArticle | Key of the article to load. |
| [in] | aCollection | Key of the collection. |
| [in] | aParams | Override values for the placeholders as key/value pairs. All placeholders except a_barcode may be overridden. |
| BpsException | on errors. |
| QString BpsLabeler::labelerId | ( | ) | const |
| virtual void BpsLabeler::load | ( | const QVariant & | aArticle, |
| const QVariant & | aCollection, | ||
| const QVariantMap & | aParams, | ||
| volatile bool * | aCancelFlag = 0 |
||
| ) | [pure virtual] |
Load an article into the working memory so it is ready to start labeling.
If the device does not support start/stop labeling, this will also start the labeling process.
| [in] | aArticle | Key of the article to load. |
| [in] | aCollection | Key of the collection. The collection is used as folder/group/customer in the labelers internal database. |
| [in] | aParams | Override values for the placeholders as key/value pairs. All placeholders except a_barcode may be overridden. |
| [in] | aCancelFlag | If the cancel flag becomes false during operation, the method will throw a BpsException. |
| BpsException | on errors or when operation is canceled. |
| virtual void BpsLabeler::open | ( | int | aLineNo, |
| const QString & | aLineName, | ||
| const QMap< QString, QString > & | aConfig, | ||
| volatile bool * | aCancelFlag = 0 |
||
| ) | [pure virtual] |
Open the device and do general initializations (setting the current date for example).
| [in] | aLineNo | The packing line number, usually the folder Central System Settings/Terminals/TERMINAL/Packlines/LINENO. |
| [in] | aLineName | The packing line name, usually the value Central System Settings/Terminals/TERMINAL/Packlines/LINENO/Name. |
| [in] | aConfig | The labeler configuration, usually the values in Central System Settings/Terminals/TERMINAL/Packlines/LINENO/Labeler. |
| [in] | aCancelFlag | If the cancel flag becomes false during operation, the method will throw a BpsException. |
| BpsException | on errors or when operation is canceled. |
| virtual void BpsLabeler::processEvents | ( | ) | [virtual] |
Process pending events from labeler.
This might be called by the labeling process by timer in intervals, or at idle times. In case of errors, the signal error() will be emitted.
| QString BpsLabeler::processPlaceholders | ( | const QString & | aText | ) | [protected] |
Replace the placeholders in the given text.
| [in] | aText | The source text with placeholders to be processed. |
| BpsException | on errors. |
| virtual QString BpsLabeler::processReplacement | ( | const QString & | aText | ) | [protected, virtual] |
After the substitute content for a placeholder has been created, this method gets called to post-process it.
The default implementation returns the text unmodified. Re-implement this method to escape certain characters for example.
| [in] | aText | The substitute text that will be used instead of the placeholder. |
| virtual void BpsLabeler::save | ( | const QVariant & | aArticle, |
| const QVariant & | aCollection, | ||
| const QVariantMap & | aParams, | ||
| volatile bool * | aCancelFlag = 0 |
||
| ) | [virtual] |
Save an article to the labelers internal database for emergency or offline operation.
The default implementation does nothing.
| [in] | aArticle | Key of the article to load. |
| [in] | aCollection | Key of the collection. The collection is used as folder/group/customer in the labelers internal database. |
| [in] | aParams | Override values for the placeholders as key/value pairs. All placeholders except a_barcode may be overridden. |
| [in] | aCancelFlag | If the cancel flag becomes false during operation, the method will throw a BpsException. |
| BpsException | on errors or when operation is canceled. |
| virtual void BpsLabeler::saveLoad | ( | const QVariant & | aArticle, |
| const QVariant & | aCollection, | ||
| const QVariantMap & | aParams, | ||
| volatile bool * | aCancelFlag = 0 |
||
| ) | [virtual] |
Save an article to the labelers internal database, and load it into the working memory so it is ready to start labeling.
If the device does not support start/stop labeling, this will also start the labeling process. The default implementation calls load().
| [in] | aArticle | Key of the article to load. |
| [in] | aCollection | Key of the collection. The collection is used as folder/group/customer in the labelers internal database. |
| [in] | aParams | Override values for the placeholders as key/value pairs. All placeholders except a_barcode may be overridden. |
| [in] | aCancelFlag | If the cancel flag becomes false during operation, the method will throw a BpsException. |
| BpsException | on errors or when operation is canceled. |
| void BpsLabeler::setCustomData | ( | const QString & | aSettingsData, |
| const QString & | aGlobalData | ||
| ) |
Makes the labeler use custom data instead of the regular data.
This method is used to test unsaved data in labeler settings application.
| [in] | aSettingsData | Settings data to be used in place of c_label.c_data. |
| [in] | aGlobalData | Global data to be used in place of c_labeler.c_data. |
| QString BpsLabeler::settingsData | ( | ) | const [protected] |
The settings data belonging to the latest article init() was called for.
For performance reasons the settings data of formerly loaded articles are cached, however it is possible to force reloading by calling clearCache() in advance.
| BpsException | on errors. |
| void BpsLabeler::showProgress | ( | int | aMaximum, |
| const QString & | aLabel | ||
| ) | [signal] |
Emitted at start of operation to begin showing the progress indicator.
The indicator should have value ticks from 0 to aMaximum, and be set initially to 0.
| [in] | aMaximum | Highest tick value, usually the number of processed items. |
| [in] | aLabel | Label to display in the progress indicator. Use QString() to display no label. |
| virtual void BpsLabeler::start | ( | volatile bool * | aCancelFlag = 0 | ) | [virtual] |
Start labeling, if supported by the device.
The default implementation does nothing.
| [in] | aCancelFlag | If the cancel flag becomes false during operation, the method will throw a BpsException. |
| BpsException | on errors or when operation is canceled. |
| virtual void BpsLabeler::stop | ( | volatile bool * | aCancelFlag = 0 | ) | [virtual] |
Stop labeling, if supported by the device.
The default implementation does nothing.
| [in] | aCancelFlag | If the cancel flag becomes false during operation, the method will throw a BpsException. |
| BpsException | on errors or when operation is canceled. |
| void BpsLabeler::updateProgressLabel | ( | const QString & | aLabel | ) | [signal] |
Emitted to update the progress label text.
| [in] | aLabel | New label text to display in the progress indicator. |
| void BpsLabeler::updateProgressMaximum | ( | int | aMaximum | ) | [signal] |
Emitted to change the highest tick value.
| [in] | aMaximum | Highest tick value, usually the number of processed items. |
| void BpsLabeler::updateProgressValue | ( | int | aValue | ) | [signal] |
Emitted when progress reaches next value to update the progress indicator.
| [in] | aValue | The value tick reached in the range 1...aMaximum, see showProgress(). |