group lvview

Contains core fucntionality for the user interface.

Summary

Members Descriptions
public voidtoQml(const MLNode & n,QJSValue & result,QJSEngine * engine) Simple function that outputs the given MLNode in the form of a Qml object.
public voidfromQml(const QJSValue & value,MLNode & n) Simple function that converts the given Qml object into a LiveKeys-friendly MLNode shape.
public inline std::ostream &operator<<(std::ostream & stream,const QChar & val) Stream output operator for QChars
public inline std::ostream &operator<<(std::ostream & stream,const QString & val) Stream output operator for QStrings
public inline std::ostream &operator<<(std::ostream & stream,const QByteArray & val) Stream output operator for QByteArrays
public inline std::ostream &operator<<(std::ostream & stream,const QStringRef & val) Stream output operator for QStringRefs
public inline voidvisualLogMessageHandler(QtMsgType type,const QMessageLogContext & ctx,const QString & msg) Message handler for typical Qt-based messages
classlv::Extensions Object used to store all the extensions of LiveKeys.
classlv::KeyMap Abstraction of a map which pairs up commands with key shortcuts used to run them.
classlv::LiveExtension The class within Qml to be used when we want to add an extension.
classlv::ErrorHandler Object used inside QML that stops an error from passing it.
classlv::IncubationController Extends the QmlIncubationController.
classlv::QmlObjectList Contains a list of objects with a user buffer.
classlv::QmlVariantList Contains a custom list of values with a user buffer.
classlv::Settings General settings (on top of Editor settings) that uses a settings folder.
classlv::FatalException Subclass of the lv::Exception used for unrecoverable errors.
classlv::InputException Subclass of the lv::Exception used for configuration errors.
classlv::ViewEngine Main Qml engine.
classlv::VisualLogEntry Struct-like class for storing relevant data about a log entry.
classlv::VisualLogBaseModel Abstract model of a set of visual log entries, to be extended for concrete usage by the VisualLogModel and VisualLogFilter.
classlv::VisualLogFilter An implementation of the VisualLogBaseModel to represent a filtered set of log entries.
classlv::VisualLogModel Main model used in visualizing log entries within LiveKeys when the log window is opened.
classlv::VisualLogNetworkSender Implementation of VisualLog::Transport used for sending log messages over a network.
classlv::VisualLogQmlObject Contains methods to present a Qml output for the visual log.

Members

public voidtoQml(const MLNode & n,QJSValue & result,QJSEngine * engine)

Simple function that outputs the given MLNode in the form of a Qml object.

Since MLNodes can contain other MLNodes, this can be done recursively

public voidfromQml(const QJSValue & value,MLNode & n)

Simple function that converts the given Qml object into a LiveKeys-friendly MLNode shape.

public inline std::ostream &operator<<(std::ostream & stream,const QChar & val)

Stream output operator for QChars

public inline std::ostream &operator<<(std::ostream & stream,const QString & val)

Stream output operator for QStrings

public inline std::ostream &operator<<(std::ostream & stream,const QByteArray & val)

Stream output operator for QByteArrays

public inline std::ostream &operator<<(std::ostream & stream,const QStringRef & val)

Stream output operator for QStringRefs

public inline voidvisualLogMessageHandler(QtMsgType type,const QMessageLogContext & ctx,const QString & msg)

Message handler for typical Qt-based messages

class lv::Extensions

class lv::Extensions
  : public QObject

Object used to store all the extensions of LiveKeys.

Summary

Members Descriptions
publicExtensions(ViewEngine* engine,const QString & settingsPath,QObject * parent) Default constructor.
public~Extensions() Default destructor
public inline QQmlPropertyMap *globals() Globals getter
public voidloadExtensions() Loads all the extensions available
public inline QMap< std::string,WorkspaceExtension* >::iteratorbegin() Begin iterator of extensions
public inline QMap< std::string,WorkspaceExtension* >::iteratorend() End iterator of extensions

Members

publicExtensions(ViewEngine* engine,const QString & settingsPath,QObject * parent)

Default constructor.

public~Extensions()

Default destructor

public inline QQmlPropertyMap *globals()

Globals getter

public voidloadExtensions()

Loads all the extensions available

public inline QMap< std::string,WorkspaceExtension* >::iteratorbegin()

Begin iterator of extensions

public inline QMap< std::string,WorkspaceExtension* >::iteratorend()

End iterator of extensions

class lv::KeyMap

class lv::KeyMap
  : public QObject

Abstraction of a map which pairs up commands with key shortcuts used to run them.

Summary

Members Descriptions
publicKeyMap(const QString & settingsPath,QObject * parent) Default constructor
public~KeyMap() Default destructor
public QStringlocateCommand(KeyCodekey) Returns the command paired with the given key
public voidstore(KeyCodekey,const QString & command,bool isDefault) Store function which pairs the given command with the given key, unless it's not overriding a default command.
public voidstore(const QString & keydescription,const QString & command,bool isDefault) Store function which pairs the key (given by a description) with a given command
public voidstore(const QJSValue & keyObject,bool isDefault) Store command given by the QJSValue object
public voidstore(quint32 os,quint32 key,quint32 localModifer,const QString & command,bool isDefault) Store command under the key given by its components
public inline QMap<KeyCode, StoredCommand > &commandMap() Exposes the command mp
public QStringgetKeyCodeDescription(KeyCodekc) Creates a description of a key code e.g. Ctrl+K
{signal} public voidkeymapChanged() Signals a change in the keymap
{slot} public QStringlocateCommand(quint32 key,quint32 modifiers) Locate command for a key given by its components
{slot} public quint32localModifier(quint32 modifier) Returns the modifier containing flags corresponding to the background OS and keys
{slot} publicModifiercontrolOrCommand() Returns Control or Command depending on the background OS
{slot} public voidreadFile() Adds contents of a file to the keymap
enumModifier List of all possible modifiers
enumOs List of operating systems
typedefKeyCode unsigned long long

Members

publicKeyMap(const QString & settingsPath,QObject * parent)

Default constructor

public~KeyMap()

Default destructor

public QStringlocateCommand(KeyCodekey)

Returns the command paired with the given key

public voidstore(KeyCodekey,const QString & command,bool isDefault)

Store function which pairs the given command with the given key, unless it's not overriding a default command.

The main store function which eventually gets called by all the other variants.

public voidstore(const QString & keydescription,const QString & command,bool isDefault)

Store function which pairs the key (given by a description) with a given command

public voidstore(const QJSValue & keyObject,bool isDefault)

Store command given by the QJSValue object

public voidstore(quint32 os,quint32 key,quint32 localModifer,const QString & command,bool isDefault)

Store command under the key given by its components

public inline QMap<KeyCode, StoredCommand > &commandMap()

Exposes the command mp

public QStringgetKeyCodeDescription(KeyCodekc)

Creates a description of a key code e.g. Ctrl+K

{signal} public voidkeymapChanged()

Signals a change in the keymap

{slot} public QStringlocateCommand(quint32 key,quint32 modifiers)

Locate command for a key given by its components

{slot} public quint32localModifier(quint32 modifier)

Returns the modifier containing flags corresponding to the background OS and keys

{slot} publicModifiercontrolOrCommand()

Returns Control or Command depending on the background OS

{slot} public voidreadFile()

Adds contents of a file to the keymap

enumModifier

Values Descriptions
Control
Alt
Command
Shift
Meta

List of all possible modifiers

enumOs

Values Descriptions
Windows
Linux
Mac

List of operating systems

typedefKeyCode

unsigned long long

class lv::LiveExtension

The class within Qml to be used when we want to add an extension.

Summary

Members Descriptions

Members

class lv::ErrorHandler

class lv::ErrorHandler
  : public QObject
  : public QQmlParserStatus

Object used inside QML that stops an error from passing it.

Summary

Members Descriptions
public explicitErrorHandler(QObject * parent) Default constructor
public~ErrorHandler() Default destructor
public voidcomponentComplete() Implementation of a QQmlParserStatus method
public inline voidclassBegin() Blank implementation of a QQmlParserStatus method
public voidsignalError(const QJSValue & error) Used by the QML view engine to signal error
public voidsignalWarning(const QJSValue & error) Used by the QML view engine to signal warning
public voidsetTarget(QObject * target) Sets the target object within the QML hierarchy that it attaches itself to
public inline QObject *target() const Target getter
{signal} public voiderror(QJSValue e) Signals an error
{signal} public voidfatal(QJSValue e) Signals a fatal error
{signal} public voidwarning(QJSValue e) Signals a warning
{signal} public voidtargetChanged(QObject * target) Signals a target change
{slot} public voidskip(const QJSValue & error) Skips the error handler and propagates the error further

Members

public explicitErrorHandler(QObject * parent)

Default constructor

public~ErrorHandler()

Default destructor

public voidcomponentComplete()

Implementation of a QQmlParserStatus method

public inline voidclassBegin()

Blank implementation of a QQmlParserStatus method

public voidsignalError(const QJSValue & error)

Used by the QML view engine to signal error

public voidsignalWarning(const QJSValue & error)

Used by the QML view engine to signal warning

public voidsetTarget(QObject * target)

Sets the target object within the QML hierarchy that it attaches itself to

public inline QObject *target() const

Target getter

{signal} public voiderror(QJSValue e)

Signals an error

{signal} public voidfatal(QJSValue e)

Signals a fatal error

{signal} public voidwarning(QJSValue e)

Signals a warning

{signal} public voidtargetChanged(QObject * target)

Signals a target change

{slot} public voidskip(const QJSValue & error)

Skips the error handler and propagates the error further

class lv::IncubationController

class lv::IncubationController
  : public QObject
  : public QQmlIncubationController

Extends the QmlIncubationController.

Summary

Members Descriptions
publicIncubationController(QObject * parent) Default constructor
public~IncubationController() Default destructor
protected inline virtual voidtimerEvent(QTimerEvent *) Implementation of QObject function

Members

publicIncubationController(QObject * parent)

Default constructor

public~IncubationController()

Default destructor

protected inline virtual voidtimerEvent(QTimerEvent *)

Implementation of QObject function

class lv::QmlObjectList

class lv::QmlObjectList
  : public lv::Shared

Contains a list of objects with a user buffer.

This class is a wrapper for a variety of object containers to which we pass the usual methods to manipulate the data inside. It's to be used universally throughout LiveKeys as a container since it offers greater flexibility than usual Qml arrays. They can also be modifiable or read-only, depending on whether we provide modifier methods.

Summary

Members Descriptions
public explicitQmlObjectList(QObject * parent) Default contructor.
publicQmlObjectList(void * data,const std::type_info * typeInfo,std::function< int(QmlObjectList *)> itemCount,std::function< QObject *(QmlObjectList *, int)> itemAt,std::function< void(QmlObjectList *, QObject *)> appendItem,std::function< void(QmlObjectList *, int)> removeItemAt,std::function< void(QmlObjectList *)> clearItems,QObject * parent) Constructor for a modifiable list.
publicQmlObjectList(void * data,const std::type_info * typeInfo,std::function< int(QmlObjectList *)> itemCount,std::function< QObject *(QmlObjectList *, int)> itemAt,QObject * parent) Constructor for a read-only list.
public~QmlObjectList() Default destructor.
public QQmlListProperty< QObject >items() Returns the items this list contains.
public inline boolisConst() const Checks if the list is non-modifiable.
public inline void *data() Returns the pointer to the data structure.
public template<>
boolcanCast() const
Shows if the underlying type is matching the one we're passing.
public template<>
T *dataAs()
Returns the data pointer cast to the type we provide.
public template<>
voidpopulateObjectList(void * data,std::function< int(QmlObjectList *)> itemCount,std::function< QObject *(QmlObjectList *, int)> itemAt,std::function< void(QmlObjectList *, QObject *)> appendItem,std::function< void(QmlObjectList *, int)> removeItemAt,std::function< void(QmlObjectList *)> clearItems)
Sets the parameters for an existing object list.
public voidsetClone(std::function<QmlObjectList](#classlv_1_1QmlObjectList) *(const [QmlObjectList *)> clone) Sets a clone function for the list.
public voidsetAssignAt(std::function< void(QmlObjectList *, int, QObject *)> assignAt)
{slot} public QObject *itemAt(int index) Returns the item at the given index.
{slot} public intitemCount() Returns the item count.
{slot} public voidclearItems() Clear a modifiable list.
{slot} public voidappendItem(QObject * item) Append item to modifiable list.
{slot} public voidremoveItemAt(int index) Remove an item from a modifiable list at the given index.
{slot} public voidassignAt(int index,QObject * item)
{slot} public lv::QmlObjectListModel *model() Return a data model for this list.
{slot} publiclv::QmlObjectList*cloneConst() const Creates a const clone of our modifiable list.
{slot} publiclv::QmlObjectList*clone() const Clone a modifiable list.
{slot} public QJSValuetoArray() Converts the list to a js array.

Members

public explicitQmlObjectList(QObject * parent)

Default contructor.

The default QmlObjectList is actually a wrapped list of QObjects.

publicQmlObjectList(void * data,const std::type_info * typeInfo,std::function< int(QmlObjectList *)> itemCount,std::function< QObject *(QmlObjectList *, int)> itemAt,std::function< void(QmlObjectList *, QObject *)> appendItem,std::function< void(QmlObjectList *, int)> removeItemAt,std::function< void(QmlObjectList *)> clearItems,QObject * parent)

Constructor for a modifiable list.

publicQmlObjectList(void * data,const std::type_info * typeInfo,std::function< int(QmlObjectList *)> itemCount,std::function< QObject *(QmlObjectList *, int)> itemAt,QObject * parent)

Constructor for a read-only list.

We don't pass the functions which would allow us to modify the list in any way

public~QmlObjectList()

Default destructor.

If a clear method is provided, we clear the container items as well

public QQmlListProperty< QObject >items()

Returns the items this list contains.

public inline boolisConst() const

Checks if the list is non-modifiable.

public inline void *data()

Returns the pointer to the data structure.

public template<>
boolcanCast() const

Shows if the underlying type is matching the one we're passing.

public template<>
T *dataAs()

Returns the data pointer cast to the type we provide.

Should be used simultaneously with a canCast check to avoid errors

public template<>
voidpopulateObjectList(void * data,std::function< int(QmlObjectList *)> itemCount,std::function< QObject *(QmlObjectList *, int)> itemAt,std::function< void(QmlObjectList *, QObject *)> appendItem,std::function< void(QmlObjectList *, int)> removeItemAt,std::function< void(QmlObjectList *)> clearItems)

Sets the parameters for an existing object list.

We pass the data and the associated data modification functions

public voidsetClone(std::function<QmlObjectList](#classlv_1_1QmlObjectList) *(const [QmlObjectList *)> clone)

Sets a clone function for the list.

public voidsetAssignAt(std::function< void(QmlObjectList *, int, QObject *)> assignAt)

{slot} public QObject *itemAt(int index)

Returns the item at the given index.

{slot} public intitemCount()

Returns the item count.

{slot} public voidclearItems()

Clear a modifiable list.

If a list is read-only, this will throw an exception

{slot} public voidappendItem(QObject * item)

Append item to modifiable list.

If a list is read-only, this will throw an exception

{slot} public voidremoveItemAt(int index)

Remove an item from a modifiable list at the given index.

If a list is read-only, this will throw an exception

{slot} public voidassignAt(int index,QObject * item)

{slot} public lv::QmlObjectListModel *model()

Return a data model for this list.

{slot} publiclv::QmlObjectList*cloneConst() const

Creates a const clone of our modifiable list.

If there's no clone function, this will throw an exception

{slot} publiclv::QmlObjectList*clone() const

Clone a modifiable list.

If there's no clone function, this will throw an exception

{slot} public QJSValuetoArray()

Converts the list to a js array.

class lv::QmlVariantList

class lv::QmlVariantList
  : public lv::Shared

Contains a custom list of values with a user buffer.

This class is a wrapper for a variety of value containers to which we pass the usual methods to manipulate the data inside. It's to be used universally throughout LiveKeys as a container since it offers greater flexibility than usual Qml arrays. They can also be modifiable or read-only, depending on whether we provide modifier methods.

Summary

Members Descriptions
public explicitQmlVariantList(QObject * parent) Default contructor.
publicQmlVariantList(void * data,const std::type_info * typeInfo,std::function< QVariantList(QmlVariantList *)> itemList,std::function< int(QmlVariantList *)> itemCount,std::function< QVariant(QmlVariantList *, int)> itemAt,std::function< void(QmlVariantList *, QVariant)> appendItem,std::function< void(QmlVariantList *, int)> removeItemAt,std::function< void(QmlVariantList *)> clearItems,QObject * parent) Constructor where we provide every wrapper method for the given data container.
publicQmlVariantList(void * data,const std::type_info * typeInfo,std::function< QVariantList(QmlVariantList *)> itemList,std::function< int(QmlVariantList *)> itemCount,std::function< QVariant(QmlVariantList *, int)> itemAt,QObject * parent) Constructor for a read-only container.
public~QmlVariantList() Default destructor.
public inline void *data() Returns the pointer to the data structure.
public template<>
boolcanCast() const
Shows if the underlying type is matching the one we're passing.
public template<>
T *dataAs()
Returns the data pointer cast to the type we provide.
public voidsetItems(const QVariantList & items) Sets items for a modifiable list.
public voidsetClone(std::function<QmlVariantList](#classlv_1_1QmlVariantList) *(const [QmlVariantList *)> clone) Sets a clone function for the list.
public voidsetQuickAssign(std::function< void(QmlVariantList *, QVariantList)> qa) Sets a quick assign function for the list.
{slot} public QVariantListitems() Returns the items this list contains.
{slot} public QVariantitemAt(int index) Returns the item at the given index.
{slot} public intitemCount() Returns the item count.
{slot} public inline boolisConst() const Checks if the list is non-modifiable.
{slot} publicQmlVariantList*cloneConst() const Creates a const clone of our modifiable list.
{slot} publicQmlVariantList*clone() const Clone a modifiable list.
{slot} public voidclearItems() Clear a modifiable list.
{slot} public voidappendItem(QVariant item) Append item to modifiable list.
{slot} public voidremoveItemAt(int index) Remove an item from a modifiable list at the given index.
{slot} public QmlVariantListModel *model() Return a data model for this list.

Members

public explicitQmlVariantList(QObject * parent)

Default contructor.

The default QmlVariantList is actually a wrapped QVariantList.

publicQmlVariantList(void * data,const std::type_info * typeInfo,std::function< QVariantList(QmlVariantList *)> itemList,std::function< int(QmlVariantList *)> itemCount,std::function< QVariant(QmlVariantList *, int)> itemAt,std::function< void(QmlVariantList *, QVariant)> appendItem,std::function< void(QmlVariantList *, int)> removeItemAt,std::function< void(QmlVariantList *)> clearItems,QObject * parent)

Constructor where we provide every wrapper method for the given data container.

publicQmlVariantList(void * data,const std::type_info * typeInfo,std::function< QVariantList(QmlVariantList *)> itemList,std::function< int(QmlVariantList *)> itemCount,std::function< QVariant(QmlVariantList *, int)> itemAt,QObject * parent)

Constructor for a read-only container.

For this type of container, we don't have to provide the modifier methods

public~QmlVariantList()

Default destructor.

If a clear method is provided, we clear the container items as well

public inline void *data()

Returns the pointer to the data structure.

public template<>
boolcanCast() const

Shows if the underlying type is matching the one we're passing.

public template<>
T *dataAs()

Returns the data pointer cast to the type we provide.

Should be used simultaneously with a canCast check to avoid errors

public voidsetItems(const QVariantList & items)

Sets items for a modifiable list.

public voidsetClone(std::function<QmlVariantList](#classlv_1_1QmlVariantList) *(const [QmlVariantList *)> clone)

Sets a clone function for the list.

public voidsetQuickAssign(std::function< void(QmlVariantList *, QVariantList)> qa)

Sets a quick assign function for the list.

{slot} public QVariantListitems()

Returns the items this list contains.

{slot} public QVariantitemAt(int index)

Returns the item at the given index.

{slot} public intitemCount()

Returns the item count.

{slot} public inline boolisConst() const

Checks if the list is non-modifiable.

{slot} publicQmlVariantList*cloneConst() const

Creates a const clone of our modifiable list.

If there's no clone function, this will throw an exception

{slot} publicQmlVariantList*clone() const

Clone a modifiable list.

If there's no clone function, this will throw an exception

{slot} public voidclearItems()

Clear a modifiable list.

If a list is read-only, this will throw an exception

{slot} public voidappendItem(QVariant item)

Append item to modifiable list.

If a list is read-only, this will throw an exception

{slot} public voidremoveItemAt(int index)

Remove an item from a modifiable list at the given index.

If a list is read-only, this will throw an exception

{slot} public QmlVariantListModel *model()

Return a data model for this list.

class lv::Settings

class lv::Settings
  : public QObject

General settings (on top of Editor settings) that uses a settings folder.

Summary

Members Descriptions
public~Settings() Default destructor
public inline const QString &path() const Returns the path of the config folder
{slot} public QObject *file(const QString & key) Returns the file under the given key
{slot} public voidaddConfigFile(const QString & key,QObject * object) Adds a config file with a given key

Members

public~Settings()

Default destructor

public inline const QString &path() const

Returns the path of the config folder

{slot} public QObject *file(const QString & key)

Returns the file under the given key

{slot} public voidaddConfigFile(const QString & key,QObject * object)

Adds a config file with a given key

class lv::FatalException

class lv::FatalException
  : public lv::Exception

Subclass of the lv::Exception used for unrecoverable errors.

Summary

Members Descriptions
public inlineFatalException(const std::string & message,int code) Default costructor
public inlineFatalException(const QString & message,int code) QString overload of the default constructor
public inline virtual~FatalException() Default destructor

Members

public inlineFatalException(const std::string & message,int code)

Default costructor

public inlineFatalException(const QString & message,int code)

QString overload of the default constructor

public inline virtual~FatalException()

Default destructor

class lv::InputException

class lv::InputException
  : public lv::Exception

Subclass of the lv::Exception used for configuration errors.

Summary

Members Descriptions
public inlineInputException(const std::string & message,int code) Defautlt constructor
public inlineInputException(const QString & message,int code) QString overload of the default constructor
public inline virtual~InputException() Default destructor

Members

public inlineInputException(const std::string & message,int code)

Defautlt constructor

public inlineInputException(const QString & message,int code)

QString overload of the default constructor

public inline virtual~InputException()

Default destructor

class lv::ViewEngine

class lv::ViewEngine
  : public QObject

Main Qml engine.

Summary

Members Descriptions
public explicitViewEngine(QQmlEngine * engine,QObject * parent) Default constructor
public~ViewEngine() Default destructor
public inline boolisLoading() const Shows if the engine is loading
public inline voidsetIsLoading(bool isLoading) Sets the loading indicator of the object
public voiduseEngine(std::function< void(QQmlEngine *)> call) Locks the engine for use until the passed function finishes
public const QList< QQmlError > &lastErrors() const Displays the errors the engine had previously
public inline QQmlEngine *engine() The contained QQmlEngine
public inline QMutex *engineMutex() The engine mutex, which is used to lock the engine for use
public QJSValueevaluate(const QString & jsCode,const QString & fileName,int lineNumber) Evaluates the piece of code given the filename and line number
public voidthrowError(constException* e,QObject * object) Function analogue to throwing an exception in regular cpp code, but propagated through javascript.
public voidthrowError(const QQmlError & error) Variant of the same-named function that uses a QQmlError object from which it extracts relevant data
public voidthrowWarning(const QString & message,QObject * object,const QString & fileName,int lineNumber) Similar to throwError, but warnings are of lesser importance and can be ignored. Passed to the error handler
public boolhasErrorHandler(QObject * object) Shows if the given object has an associated error handler
public voidregisterErrorHandler(QObject * object,ErrorHandler* handler) Registers a handler for the given object
public voidremoveErrorHandler(QObject * object) Removes the handler for the given object
public voidaddCompileHook(CompileHookch,void * userData) Added after the compilation is finished, to be run as a callback
public voidremoveCompileHook(CompileHookch,void * userData) Removes the given compile hook
public template<>
TypeInfo::PtrregisterQmlTypeInfo(const std::function< void(const T &,MLNode &)> & serializeFunction,const std::function< void(constMLNode &, T &)> & deserializeFunction,const std::function< QObject *()> & constructorFunction,bool canLog)
Allows the engine to register info about a type.
public TypeInfo::PtrtypeInfo(const QMetaObject * type) const Returns the type info for a given meta-object
public TypeInfo::PtrtypeInfo(const QByteArray & typeName) const Returns the type info for a given type name
public TypeInfo::PtrtypeInfo(const QMetaType & metaType) const Returns the type info for a given meta-type by extracting the meta-object and calling the appropriate variant of the getter
public QObject *createObject(const QByteArray & qmlCode,QObject * parent,const QUrl & file,bool clearCache) Creates an object from the given qmlcode synchronously.
public QObject *createObject(const char * qmlCode,QObject * parent,const QUrl & file,bool clearCache)
public QJSValuetoJSErrors(const QList< QQmlError > & errors) const
public QJSValuetoJSError(const QQmlError & error) const
{signal} public voidaboutToCreateObject(const QUrl & file) Signals before compiling a new object.
{signal} public voidobjectAcquired(const QUrl & file,QObject * reference) Signals after acquiring a new object, assuring no errors were found.
{signal} public voidisLoadingChanged(bool isLoading) Loading indicator has changed
{signal} public voidobjectReady(QObject * object,const QUrl & file,QObject * reference) Object was created
{signal} public voidobjectCreationError(QJSValue errors,const QUrl & file,QObject * reference) Error in object creation
{signal} public voidapplicationError(QJSValue error) Emitted when the error is propagated all the way to the application
{signal} public voidapplicationWarning(QJSValue warning) Emitted when the warning is propagated all the way to the application
{slot} public voidcreateObjectAsync(const QString & qmlCode,QObject * parent,const QUrl & file,QObject * reference,bool clearCache) Main function of the engine, where we pass the code to be compiled asynchronously.
{slot} public QObject *createObject(const QString & qmlCode,QObject * parent,const QUrl & file,bool clearCache) Creates an object from the given qmlcode synchronously.
{slot} public voidengineWarnings(const QList< QQmlError > & warnings) Throws errors on these warnings which don't have their own object
{slot} public voidthrowError(const QJSValue & error,QObject * object) Variant of the same-named function that uses a QJSValue object along with the calling object.
{slot} public voidthrowWarning(const QJSValue & error,QObject * object) The function called by the same-named public function. Passes the warning to the error handler(s)
typedefCompileHook Callback function type to be run after the engine finishes compiling

Members

public explicitViewEngine(QQmlEngine * engine,QObject * parent)

Default constructor

public~ViewEngine()

Default destructor

public inline boolisLoading() const

Shows if the engine is loading

public inline voidsetIsLoading(bool isLoading)

Sets the loading indicator of the object

public voiduseEngine(std::function< void(QQmlEngine *)> call)

Locks the engine for use until the passed function finishes

public const QList< QQmlError > &lastErrors() const

Displays the errors the engine had previously

public inline QQmlEngine *engine()

The contained QQmlEngine

public inline QMutex *engineMutex()

The engine mutex, which is used to lock the engine for use

public QJSValueevaluate(const QString & jsCode,const QString & fileName,int lineNumber)

Evaluates the piece of code given the filename and line number

public voidthrowError(constException* e,QObject * object)

Function analogue to throwing an exception in regular cpp code, but propagated through javascript.

We use a simple macro, CREATE_EXCEPTION, to create exceptions in LiveKeys, which will include the metadata of the code where it was thrown. Usage example of this function can be found in qcalibratedebevec.cpp.

lv::Exception lve = CREATE_EXCEPTION(lv::Exception, e.what(), e.code);
lv::ViewContext::instance().engine()->throwError(&lve, this);

Calling the throwError manages to capture all the relevant data such as line number, type of error, and even the object from which it was thrown, and also the stacktrace containing even the relevant Javascript info. The error is propagated until we reach a relevant error handler ( See also: lv::ErrorHandler).

public voidthrowError(const QQmlError & error)

Variant of the same-named function that uses a QQmlError object from which it extracts relevant data

public voidthrowWarning(const QString & message,QObject * object,const QString & fileName,int lineNumber)

Similar to throwError, but warnings are of lesser importance and can be ignored. Passed to the error handler

public boolhasErrorHandler(QObject * object)

Shows if the given object has an associated error handler

public voidregisterErrorHandler(QObject * object,ErrorHandler* handler)

Registers a handler for the given object

public voidremoveErrorHandler(QObject * object)

Removes the handler for the given object

public voidaddCompileHook(CompileHookch,void * userData)

Added after the compilation is finished, to be run as a callback

public voidremoveCompileHook(CompileHookch,void * userData)

Removes the given compile hook

public template<>
TypeInfo::PtrregisterQmlTypeInfo(const std::function< void(const T &,MLNode &)> & serializeFunction,const std::function< void(constMLNode &, T &)> & deserializeFunction,const std::function< QObject *()> & constructorFunction,bool canLog)

Allows the engine to register info about a type.

Store a constructor, serialization functions and a logging flag for this type.

public TypeInfo::PtrtypeInfo(const QMetaObject * type) const

Returns the type info for a given meta-object

public TypeInfo::PtrtypeInfo(const QByteArray & typeName) const

Returns the type info for a given type name

public TypeInfo::PtrtypeInfo(const QMetaType & metaType) const

Returns the type info for a given meta-type by extracting the meta-object and calling the appropriate variant of the getter

public QObject *createObject(const QByteArray & qmlCode,QObject * parent,const QUrl & file,bool clearCache)

Creates an object from the given qmlcode synchronously.

public QObject *createObject(const char * qmlCode,QObject * parent,const QUrl & file,bool clearCache)

public QJSValuetoJSErrors(const QList< QQmlError > & errors) const

public QJSValuetoJSError(const QQmlError & error) const

{signal} public voidaboutToCreateObject(const QUrl & file)

Signals before compiling a new object.

{signal} public voidobjectAcquired(const QUrl & file,QObject * reference)

Signals after acquiring a new object, assuring no errors were found.

{signal} public voidisLoadingChanged(bool isLoading)

Loading indicator has changed

{signal} public voidobjectReady(QObject * object,const QUrl & file,QObject * reference)

Object was created

{signal} public voidobjectCreationError(QJSValue errors,const QUrl & file,QObject * reference)

Error in object creation

{signal} public voidapplicationError(QJSValue error)

Emitted when the error is propagated all the way to the application

{signal} public voidapplicationWarning(QJSValue warning)

Emitted when the warning is propagated all the way to the application

{slot} public voidcreateObjectAsync(const QString & qmlCode,QObject * parent,const QUrl & file,QObject * reference,bool clearCache)

Main function of the engine, where we pass the code to be compiled asynchronously.

Of extreme importance to the live coding part of LiveKeys, since we use it to compile our custom code. clearCache is used to indicate that we've changed one of the non-active files which are cached, so the cache has to be cleared since it's invalid after a change.

{slot} public QObject *createObject(const QString & qmlCode,QObject * parent,const QUrl & file,bool clearCache)

Creates an object from the given qmlcode synchronously.

{slot} public voidengineWarnings(const QList< QQmlError > & warnings)

Throws errors on these warnings which don't have their own object

{slot} public voidthrowError(const QJSValue & error,QObject * object)

Variant of the same-named function that uses a QJSValue object along with the calling object.

This is the actual function that gets called from the two variants above. The relevant data is converted to QJSValue and passed to here.

{slot} public voidthrowWarning(const QJSValue & error,QObject * object)

The function called by the same-named public function. Passes the warning to the error handler(s)

typedefCompileHook

Callback function type to be run after the engine finishes compiling

class lv::VisualLogEntry

Struct-like class for storing relevant data about a log entry.

Summary

Members Descriptions
public QStringprefix
public QStringtag
public QStringdata
public QVariant *objectData
public mutable QQmlComponent *component
public mutable QQmlContext *context
publicVisualLogEntry(const QString & tag,const QString & prefix,const QString & data) Constructor for string-type log entries
publicVisualLogEntry(const QString & tag,const QString & prefix,QVariant * objectData,QQmlComponent * component) Constructor for objects and/or image log entries

Members

public QStringprefix

public QStringtag

public QStringdata

public QVariant *objectData

public mutable QQmlComponent *component

public mutable QQmlContext *context

publicVisualLogEntry(const QString & tag,const QString & prefix,const QString & data)

Constructor for string-type log entries

publicVisualLogEntry(const QString & tag,const QString & prefix,QVariant * objectData,QQmlComponent * component)

Constructor for objects and/or image log entries

class lv::VisualLogBaseModel

class lv::VisualLogBaseModel
  : public QAbstractListModel

Abstract model of a set of visual log entries, to be extended for concrete usage by the VisualLogModel and VisualLogFilter.

Summary

Members Descriptions
public explicitVisualLogBaseModel(QObject * parent) Default constructor
public virtual~VisualLogBaseModel() Default destructor
public QVariantdata(const QModelIndex & index,int role) const Returns the data at the given index with a given role
public introwCount(const QModelIndex & parent) const Returns the row count of the model
public virtual QHash< int, QByteArray >roleNames() const Returns the role names
public inttotalEntries() const Total number of entries.
public QVariantentryDataAt(int index) const All data from the entry at the index
public QStringentryPrefixAt(int index) const Prefix from the entry at the given index
public const VisualLogEntry &entryAt(int index) const Log entry at the given index
enumRoles Role names

Members

public explicitVisualLogBaseModel(QObject * parent)

Default constructor

public virtual~VisualLogBaseModel()

Default destructor

public QVariantdata(const QModelIndex & index,int role) const

Returns the data at the given index with a given role

public introwCount(const QModelIndex & parent) const

Returns the row count of the model

public virtual QHash< int, QByteArray >roleNames() const

Returns the role names

public inttotalEntries() const

Total number of entries. See also: VisualLogBaseModel::rowCount

public QVariantentryDataAt(int index) const

All data from the entry at the index

public QStringentryPrefixAt(int index) const

Prefix from the entry at the given index

public const VisualLogEntry &entryAt(int index) const

Log entry at the given index

enumRoles

Values Descriptions
Msg
Prefix

Role names

class lv::VisualLogFilter

class lv::VisualLogFilter
  : public lv::VisualLogBaseModel
  : public QQmlParserStatus

An implementation of the VisualLogBaseModel to represent a filtered set of log entries.

The filter can be applied via tag, prefix or a regular search string

Summary

Members Descriptions
public explicitVisualLogFilter(QObject * parent) Default constructor
public~VisualLogFilter() Blank destructor
public inlinelv::VisualLogBaseModel*source() const Base model which is the model we're applying the filter too.
public inline QStringtag() const The tag we're filtering by
public QJSValuesearch() const Returns the search string/regexp
public inline boolisIndexing() const Indicator if the object is currently performing indexing in the background, asynchronously
public voidsetSource(lv::VisualLogBaseModel* source) Sets the model data source
public inline voidsetTag(QString tag) Tag setter
public voidsetSearch(QJSValue search) Sets the actual search string
public inline voidclassBegin() Implementation of the respective QQmlParserStatus function
public voidcomponentComplete() Implementation of the respective QQmlParserStatus function
public virtual QVariantdata(const QModelIndex & index,int role) const Implementation of the respective lv::VisualLogBaseModel/QAbstractListModel function
public virtual introwCount(const QModelIndex & parent) const Implementation of the respective lv::VisualLogBaseModel/QAbstractListModel function
public inline virtual inttotalEntries() const Total number of entries
public virtual QVariantentryDataAt(int index) const Implementation of the respective lv::VisualLogBaseModel function
public virtual QStringentryPrefixAt(int index) const Implementation of the respective lv::VisualLogBaseModel function
public virtual const VisualLogEntry &entryAt(int index) const Implementation of the respective lv::VisualLogBaseModel function
public voidsetPrefix(QJSValue prefix) Sets the prefix
public voidsetIsIndexing(bool isIndexing) Sets the indexing indicator
public QJSValueprefix() const The prefix we're filtering by
{signal} public voidsourceChanged() Source has changed
{signal} public voidtagChanged() Tag has changed
{signal} public voidprefixChanged() Prefix has changed
{signal} public voidsearchChanged() Search string has changed
{signal} public voidisIndexingChanged() Indexing indicator has changed
{slot} public voidrefilterReady() Slot that listens for the ending of indexing in the background.
{slot} public voidsourceDestroyed() Source is destroyed slot
{slot} public voidsourceModelReset() Reacts to changes in the source model
{slot} public voidsourceModelAboutToReset() Before a reset, we ignore the results of the worker because they're not valid anymore
{slot} public voidsourceRowsAboutToBeRemoved(const QModelIndex &,int from,int to) When source model is having rows removed, we ignore the worker results and rebuild
{slot} public voidsourceRowsInserted(const QModelIndex &,int from,int to) When source model is having rows added, we ignore the worker results and rebuild

Members

public explicitVisualLogFilter(QObject * parent)

Default constructor

public~VisualLogFilter()

Blank destructor

public inlinelv::VisualLogBaseModel*source() const

Base model which is the model we're applying the filter too.

Interestingly, it can be both the main model, or even another filter model! We could, in theory, have an array or filter models where each one is filtering on the previous one.

public inline QStringtag() const

The tag we're filtering by

public QJSValuesearch() const

Returns the search string/regexp

public inline boolisIndexing() const

Indicator if the object is currently performing indexing in the background, asynchronously

public voidsetSource(lv::VisualLogBaseModel* source)

Sets the model data source

public inline voidsetTag(QString tag)

Tag setter

public voidsetSearch(QJSValue search)

Sets the actual search string

public inline voidclassBegin()

Implementation of the respective QQmlParserStatus function

public voidcomponentComplete()

Implementation of the respective QQmlParserStatus function

public virtual QVariantdata(const QModelIndex & index,int role) const

Implementation of the respective lv::VisualLogBaseModel/QAbstractListModel function

public virtual introwCount(const QModelIndex & parent) const

Implementation of the respective lv::VisualLogBaseModel/QAbstractListModel function

public inline virtual inttotalEntries() const

Total number of entries

public virtual QVariantentryDataAt(int index) const

Implementation of the respective lv::VisualLogBaseModel function

public virtual QStringentryPrefixAt(int index) const

Implementation of the respective lv::VisualLogBaseModel function

public virtual const VisualLogEntry &entryAt(int index) const

Implementation of the respective lv::VisualLogBaseModel function

public voidsetPrefix(QJSValue prefix)

Sets the prefix

public voidsetIsIndexing(bool isIndexing)

Sets the indexing indicator

public QJSValueprefix() const

The prefix we're filtering by

{signal} public voidsourceChanged()

Source has changed

{signal} public voidtagChanged()

Tag has changed

{signal} public voidprefixChanged()

Prefix has changed

{signal} public voidsearchChanged()

Search string has changed

{signal} public voidisIndexingChanged()

Indexing indicator has changed

{slot} public voidrefilterReady()

Slot that listens for the ending of indexing in the background.

This slot gets called after the worker finishes, but also gets called only after control is returned to the event loop. Any changes in between will be lost, therefore we handle the changes separately, using the m_workerIgnoreResult variable.

{slot} public voidsourceDestroyed()

Source is destroyed slot

{slot} public voidsourceModelReset()

Reacts to changes in the source model

{slot} public voidsourceModelAboutToReset()

Before a reset, we ignore the results of the worker because they're not valid anymore

{slot} public voidsourceRowsAboutToBeRemoved(const QModelIndex &,int from,int to)

When source model is having rows removed, we ignore the worker results and rebuild

{slot} public voidsourceRowsInserted(const QModelIndex &,int from,int to)

When source model is having rows added, we ignore the worker results and rebuild

class lv::VisualLogModel

class lv::VisualLogModel
  : public lv::VisualLogBaseModel
  : public lv::VisualLog::ViewTransport

Main model used in visualizing log entries within LiveKeys when the log window is opened.

Receives any type message, whether if it's a string (or a string-displayable object) or an image.

Summary

Members Descriptions
publicVisualLogModel(QQmlEngine * engine) Default constructor
public~VisualLogModel() Blank destructor
public virtual QVariantdata(const QModelIndex & index,int role) const Implementation of the respective QAbstractListModel function
public inline virtual introwCount(const QModelIndex & parent) const Implementation of the respective QAbstractListModel function
public virtual voidonMessage(const VisualLog::Configuration * configuration,constVisualLog::MessageInfo& messageInfo,const std::string & message) Implementation of the respective function from VisualLog::ViewTransport.
public virtual voidonView(const VisualLog::Configuration * configuration,constVisualLog::MessageInfo& messageInfo,const std::string & viewName,const QVariant & value) Implementation of the respective function from VisualLog::ViewTransport.
public inline intwidth() const Returns the width
public inline virtual inttotalEntries() const Implementation of the respective VisualLogBaseModel function
public virtual QVariantentryDataAt(int index) const Implementation of the respective VisualLogBaseModel function
public virtual QStringentryPrefixAt(int index) const Implementation of the respective VisualLogBaseModel function
public virtual const VisualLogEntry &entryAt(int index) const Implementation of the respective VisualLogBaseModel function
public inline QList< VisualLogEntry >::Iteratorbegin() Begin-iterator of the log entries
public inline QList< VisualLogEntry >::Iteratorend() End-iterator of the log entries
public inline QList< VisualLogEntry >::ConstIteratorbegin() const Const begin-iterator of the log entries
public inline QList< VisualLogEntry >::ConstIteratorend() const Const end-iterator of the log entries
{signal} public voidwidthChanged(int width) Width has changed
{signal} public voidentryAdded() Entry was added
{slot} public inline voidsetWidth(int width) Sets the width
{slot} public voidclearValues() Erases all log entries from the model

Members

publicVisualLogModel(QQmlEngine * engine)

Default constructor

public~VisualLogModel()

Blank destructor

public virtual QVariantdata(const QModelIndex & index,int role) const

Implementation of the respective QAbstractListModel function

public inline virtual introwCount(const QModelIndex & parent) const

Implementation of the respective QAbstractListModel function

public virtual voidonMessage(const VisualLog::Configuration * configuration,constVisualLog::MessageInfo& messageInfo,const std::string & message)

Implementation of the respective function from VisualLog::ViewTransport.

Appends the given string message to the list of log entries.

public virtual voidonView(const VisualLog::Configuration * configuration,constVisualLog::MessageInfo& messageInfo,const std::string & viewName,const QVariant & value)

Implementation of the respective function from VisualLog::ViewTransport.

Appends the log view given via name to the entries

public inline intwidth() const

Returns the width

public inline virtual inttotalEntries() const

Implementation of the respective VisualLogBaseModel function

public virtual QVariantentryDataAt(int index) const

Implementation of the respective VisualLogBaseModel function

public virtual QStringentryPrefixAt(int index) const

Implementation of the respective VisualLogBaseModel function

public virtual const VisualLogEntry &entryAt(int index) const

Implementation of the respective VisualLogBaseModel function

public inline QList< VisualLogEntry >::Iteratorbegin()

Begin-iterator of the log entries

public inline QList< VisualLogEntry >::Iteratorend()

End-iterator of the log entries

public inline QList< VisualLogEntry >::ConstIteratorbegin() const

Const begin-iterator of the log entries

public inline QList< VisualLogEntry >::ConstIteratorend() const

Const end-iterator of the log entries

{signal} public voidwidthChanged(int width)

Width has changed

{signal} public voidentryAdded()

Entry was added

{slot} public inline voidsetWidth(int width)

Sets the width

{slot} public voidclearValues()

Erases all log entries from the model

class lv::VisualLogNetworkSender

class lv::VisualLogNetworkSender
  : public QObject
  : public lv::VisualLog::Transport

Implementation of VisualLog::Transport used for sending log messages over a network.

Summary

Members Descriptions
public explicitVisualLogNetworkSender(const QString & ip,int port,QObject * parent) Default constructor, initialized with an IP address and an appropriate port
public~VisualLogNetworkSender() Default destructor
public voidsendMessage(const QString & message) QString variant of the sendMessage function
public voidsendMessage(const QByteArray & message) Main, byte-array based function for sending messages over the network
public voidsendMessage(const std::string & message) Standard string variant of the sendMessage function
public voidconnectToHost(int maxRetries) Function that tries to connect to host a limited ammount of times
public virtual voidonMessage(const VisualLog::Configuration * configuration,constVisualLog::MessageInfo& messageInfo,const std::string & message) Sends a string-based log message over the network
public virtual voidonObject(const VisualLog::Configuration * configuration,constVisualLog::MessageInfo& messageInfo,const std::string & type,constMLNode& node) Sends an object-based log entry over the network by converting it into JSON
{slot} public voidsocketConnected() When socket is connected, we send all the queued messages through
{slot} public voidsocketDisconnected() When socket is disconnected. we notify the user of a failed connecting attempt, or finally notify that we gave up
{slot} public voidsocketError(QAbstractSocket::SocketError) In case of socket error, we notify the user and try again if we have any attempts left
{slot} public voidreconnect() Function that attempts to connect to host if we haven't exceeded the maximum number of attempts

Members

public explicitVisualLogNetworkSender(const QString & ip,int port,QObject * parent)

Default constructor, initialized with an IP address and an appropriate port

public~VisualLogNetworkSender()

Default destructor

public voidsendMessage(const QString & message)

QString variant of the sendMessage function

public voidsendMessage(const QByteArray & message)

Main, byte-array based function for sending messages over the network

public voidsendMessage(const std::string & message)

Standard string variant of the sendMessage function

public voidconnectToHost(int maxRetries)

Function that tries to connect to host a limited ammount of times

public virtual voidonMessage(const VisualLog::Configuration * configuration,constVisualLog::MessageInfo& messageInfo,const std::string & message)

Sends a string-based log message over the network

public virtual voidonObject(const VisualLog::Configuration * configuration,constVisualLog::MessageInfo& messageInfo,const std::string & type,constMLNode& node)

Sends an object-based log entry over the network by converting it into JSON

{slot} public voidsocketConnected()

When socket is connected, we send all the queued messages through

{slot} public voidsocketDisconnected()

When socket is disconnected. we notify the user of a failed connecting attempt, or finally notify that we gave up

{slot} public voidsocketError(QAbstractSocket::SocketError)

In case of socket error, we notify the user and try again if we have any attempts left

{slot} public voidreconnect()

Function that attempts to connect to host if we haven't exceeded the maximum number of attempts

class lv::VisualLogQmlObject

class lv::VisualLogQmlObject
  : public QObject

Contains methods to present a Qml output for the visual log.

Summary

Members Descriptions
publicVisualLogQmlObject(QObject * parent) Default constructor
public~VisualLogQmlObject() Default destructor
{slot} public voidf(const QJSValue & messageOrCategory,const QJSValue & message) Fatal messages
{slot} public voide(const QJSValue & messageOrCategory,const QJSValue & message) Error messages
{slot} public voidw(const QJSValue & messageOrCategory,const QJSValue & message) Warning messages
{slot} public voidi(const QJSValue & messageOrCategory,const QJSValue & message) Info messages
{slot} public voidd(const QJSValue & messageOrCategory,const QJSValue & message) Debug messages
{slot} public voidv(const QJSValue & messageOrCategory,const QJSValue & message) Verbose messages
{slot} public voidconfigure(const QString & name,const QJSValue & options) Configures global vlog object from a given QJSValue object

Members

publicVisualLogQmlObject(QObject * parent)

Default constructor

public~VisualLogQmlObject()

Default destructor

{slot} public voidf(const QJSValue & messageOrCategory,const QJSValue & message)

Fatal messages

{slot} public voide(const QJSValue & messageOrCategory,const QJSValue & message)

Error messages

{slot} public voidw(const QJSValue & messageOrCategory,const QJSValue & message)

Warning messages

{slot} public voidi(const QJSValue & messageOrCategory,const QJSValue & message)

Info messages

{slot} public voidd(const QJSValue & messageOrCategory,const QJSValue & message)

Debug messages

{slot} public voidv(const QJSValue & messageOrCategory,const QJSValue & message)

Verbose messages

{slot} public voidconfigure(const QString & name,const QJSValue & options)

Configures global vlog object from a given QJSValue object