WARNING: USE THIS SOFTWARE AT YOUR OWN RISK! THIS IS EXPERIMENTAL SOFTWARE NOT INTENDED FOR PRODUCTION USE! Zuble is currently an early stage prototype. As such Zuble is minimally tested and inherently unstable. It is provided for experimental, development, and demonstration purposes only. | Zuble QML Types | Zuble C++ Classes | Zuble Overview |
Zuble
0.1
Zuble Framework C++/QML extension API
|
A QML type that manages reading JSON formatted Zuble log files. QML programs create using Zbl.newLogReader() More...
#include <ZLogReader.h>
Public Types | |
typedef QMap< qint64, QStringList > | zMarkSet |
Public Slots | |
void | onBackgroundOpenComplete (bool success, QString errorMsg, QVariantMap contextMap) |
Called by the background thread when file has been opened. More... | |
void | openFile (const QString &filePath) |
Opens the log file in a background thread concurrently but does not load it. Sends the openComplete signal when complete. More... | |
QObject * | newViewport () |
Obtains a new empty foreground ZLogViewport object on the log file. More... | |
void | close () |
Close the log file input object and release resources. More... | |
QObject * | newBookmark (const QString &name) |
Creates a new ZLogBookmark object and returns it. More... | |
QObject * | getBookmark (const QString &name) |
Obtains the bookmark or searchmark with the given name. More... | |
bool | setLogmapParameters (const QObject *parameters, const QString &name) |
Updates the specified logmark parameters (note, search type) for the bookmark with the specified name or search phrase. More... | |
bool | deleteBookmark (const QString &name) |
Remove the specified bookmark or searchmark by name. More... | |
bool | deleteSearch (QObject *search) |
Remove the specified search object from the search map and model. More... | |
QMap< qint64, QStringList > | getBookmarkSet (qint64 firstID, qint64 lastID) |
Returns a map containing log mark information for the specified set of log records. More... | |
QStringList | getBookmarkNames (qint64 recordID) |
Obtains a list of bookmark names for the specified log record. More... | |
QMap< qint64, QStringList > | getSearchmarkSet (qint64 firstID, qint64 lastID) |
Returns a map containing log mark information for the specified set of log records. More... | |
Signals | |
void | openComplete (QString filePath, bool success, QString errorMsg) |
Sent when an openFile() operation has completed;. More... | |
void | closeAlert () |
Sent when the close() function has been called. More... | |
void | bookmarksUpdated () |
Sent when the master log mark database has been updated. More... | |
void | searchCreated (QObject *searchObject) |
Sent when a new search object has been created. More... | |
void | releaseSearchReferences (QString searchObjectName) |
Sent when a request to delete a ZLogSearch object has been received. More... | |
void | notifyFileSize (qint64 fileSize) |
Periodically signals the current log file size. More... | |
Public Member Functions | |
ZLogReader (QObject *parent=0) | |
Object constructor. More... | |
virtual | ~ZLogReader () |
Virtual object destructor. More... | |
bool | getReady () |
Obtains the state of the ready flag.. More... | |
QString | getFilePath () |
Obtains the path to the log file. More... | |
ZblLogReader * | getBackgroundReader () |
Obtains a pointer to the background reader object that services this log file. More... | |
Q_INVOKABLE QObject * | getSearchModel () |
Obtain a pointer to the data model containing search objects for this log file. More... | |
Q_INVOKABLE bool | hasSearch (const QString &searchPhrase, int searchType, QList< int > searchRoles) |
Determine if a specific search object exists. More... | |
Q_INVOKABLE QObject * | getSearch (const QString &searchPhrase, int searchType, QList< int > searchRoles) |
Obtains or creates the searchmark with the given search parameters. More... | |
Q_INVOKABLE zblLogSearchPtr | getZSearch (const QString &searchPhrase, int searchType, QList< int > searchRoles) |
Obtains or creates a search mark with the given search parameters. More... | |
Static Public Member Functions | |
static void | registerType () |
Registers ZLogReader as a QML type. More... | |
Protected Member Functions | |
bool | hasBookmark (const QString &name) |
bool | hasSearchMap (const QString &searchName) |
void | appendSearchModel (zblLogSearchPtr search) |
void | removeSearchModel (ZblLogSearch *search) |
void | purgeSearchModel () |
Protected Attributes | |
ZBL_DECLARE_LOGGED_OBJECT ZblLogReader * | m_reader |
A log reader worker object to perform log file input and parsing operations in a background thread. More... | |
bool | m_ready |
true when when log file is opened and ready to be used, false otherwise. More... | |
QString | m_filePath |
Path to log file being read. More... | |
ZLogBookmark::zLogBookmarkList | m_bookmarks |
A central repository for log file marks. This is the definitive mark list for the log file, all others are copies. More... | |
QMap< QString, QWeakPointer< ZblLogSearch > > | m_searchmarks |
A central repository for log file marks. This is the definitive mark list for the log file, all others are copies. More... | |
ZTableModel * | m_model |
A data model used to display search objects. More... | |
Properties | |
bool | ready |
true when the log file is opened and ready to be used, false otherwise More... | |
QString | filePath |
Path to the log file being read by this object. More... | |
A QML type that manages reading JSON formatted Zuble log files. QML programs create using Zbl.newLogReader()
Zuble log files are created by the Zuble Log Manager's Qt log message handler. This class allows QML programs to read portions of JSON formatted log files into data models for display.
Each ZLogReader object represents a single open log file. One or more viewport objects (ZLogViewport) can be created as views on the file. Each viewport encapsulates a data model containing a subset of consecutive log records from the file. Viewports can be positioned at specified locations and can be scrolled forward and backward.
One or more search objects (ZLogSearch) can be created to perform background text search operations on some or all log records.
Definition at line 62 of file ZLogReader.h.
typedef QMap<qint64, QStringList> Zbl::ZLogReader::zMarkSet |
Definition at line 68 of file ZLogReader.h.
|
explicit |
Object constructor.
parent | The parent of the this Object or null for no parent |
Definition at line 48 of file ZLogReader.cpp.
|
virtual |
Virtual object destructor.
Definition at line 72 of file ZLogReader.cpp.
|
protected |
Definition at line 439 of file ZLogReader.cpp.
Referenced by getZSearch().
|
signal |
Sent when the master log mark database has been updated.
Referenced by newBookmark(), and Zbl::ZLogViewport::ZLogViewport().
|
slot |
Close the log file input object and release resources.
All search objects for this log file reader will become invalidated.
Definition at line 191 of file ZLogReader.cpp.
Referenced by ~ZLogReader().
|
signal |
|
slot |
Remove the specified bookmark or searchmark by name.
Unnamed searchmarks can be removed by deleteSearchmark(const QString&)
name | The name of the bookmark or searchmark to remove |
Definition at line 585 of file ZLogReader.cpp.
|
slot |
Remove the specified search object from the search map and model.
WARNING: This will invalidate all existing wrappers to the specified search object.
search | A ZLogSearch object representing the search to be deleted |
Definition at line 593 of file ZLogReader.cpp.
ZblLogReader * Zbl::ZLogReader::getBackgroundReader | ( | ) |
Obtains a pointer to the background reader object that services this log file.
The reader object runs in a background thread to service foreground file i/o requests.
Definition at line 226 of file ZLogReader.cpp.
Referenced by Zbl::ZblLogSearch::ZblLogSearch().
|
slot |
Obtains the bookmark or searchmark with the given name.
name | Name of the bookmark to return |
Definition at line 274 of file ZLogReader.cpp.
|
slot |
Obtains a list of bookmark names for the specified log record.
recordID | Log record ID for which bookmarks will be obtained |
Definition at line 657 of file ZLogReader.cpp.
Referenced by getBookmarkSet(), and Zbl::ZLogViewport::onUpdateBookmarks().
|
slot |
Returns a map containing log mark information for the specified set of log records.
A list of bookmark names is returned for each log record between the specified first and last log record ID.
firstID | Log record ID of the first record in the set. |
lastID | Log record ID of the last record in the set. |
Definition at line 629 of file ZLogReader.cpp.
QString Zbl::ZLogReader::getFilePath | ( | ) |
Obtains the path to the log file.
Definition at line 221 of file ZLogReader.cpp.
bool Zbl::ZLogReader::getReady | ( | ) |
Obtains the state of the ready flag..
Definition at line 216 of file ZLogReader.cpp.
QObject * Zbl::ZLogReader::getSearch | ( | const QString & | searchPhrase, |
int | searchType, | ||
QList< int > | searchRoles | ||
) |
Obtains or creates the searchmark with the given search parameters.
A new ZLogSearch object will be created to wrap either an existing ZblLogSearch object or a new ZblLogSearch object matching the specified parameters.
searchPhrase | Search phrase of the given searchmark to return |
searchType | Search type of the given serachmark to return |
searchRoles | A list of log viewport data model roles to search. Only roles in this list will be searched and highlighted. Other roles will be ignored. |
Definition at line 512 of file ZLogReader.cpp.
Referenced by Zbl::ZLogViewport::onSearchDeleteRequested().
|
slot |
Returns a map containing log mark information for the specified set of log records.
A list of searchmark search phrases is returned for each log record between the specified first and last log record ID.
firstID | Log record ID of the first record in the set. |
lastID | Log record ID of the last record in the set. |
Definition at line 689 of file ZLogReader.cpp.
QObject * Zbl::ZLogReader::getSearchModel | ( | ) |
Obtain a pointer to the data model containing search objects for this log file.
The model contains a ZLogSearch object wrapper for each extant ZblLogSearch object in the searchmark map. The model can be used to display search objects.
Definition at line 502 of file ZLogReader.cpp.
zblLogSearchPtr Zbl::ZLogReader::getZSearch | ( | const QString & | searchPhrase, |
int | searchType, | ||
QList< int > | searchRoles | ||
) |
Obtains or creates a search mark with the given search parameters.
searchPhrase | |
searchType | |
searchRoles |
Definition at line 358 of file ZLogReader.cpp.
Referenced by getSearch(), and Zbl::ZLogViewport::ZLogViewport().
|
protected |
Definition at line 545 of file ZLogReader.cpp.
Referenced by newBookmark().
bool Zbl::ZLogReader::hasSearch | ( | const QString & | searchPhrase, |
int | searchType, | ||
QList< int > | searchRoles | ||
) |
Determine if a specific search object exists.
Definition at line 507 of file ZLogReader.cpp.
|
protected |
Definition at line 556 of file ZLogReader.cpp.
Referenced by hasSearch().
|
slot |
Creates a new ZLogBookmark object and returns it.
name | Name of the bookmark. Bookmark names must be unique within the namespace for each log file. |
Definition at line 232 of file ZLogReader.cpp.
|
slot |
Obtains a new empty foreground ZLogViewport object on the log file.
Definition at line 207 of file ZLogReader.cpp.
|
signal |
Periodically signals the current log file size.
fileSize |
|
slot |
Called by the background thread when file has been opened.
success | true if open successful, false if error |
errorMsg | error message |
contextMap | opaque user-defined data |
Definition at line 122 of file ZLogReader.cpp.
|
signal |
Sent when an openFile() operation has completed;.
filePath | the path to the log file |
success | true if open successful, false if failed |
errorMsg | Error message if success == false |
Referenced by onBackgroundOpenComplete().
|
slot |
Opens the log file in a background thread concurrently but does not load it. Sends the openComplete signal when complete.
filePath | Path to a Zuble log file |
Definition at line 176 of file ZLogReader.cpp.
|
protected |
Definition at line 484 of file ZLogReader.cpp.
Referenced by close().
|
static |
Registers ZLogReader as a QML type.
Definition at line 78 of file ZLogReader.cpp.
Referenced by Zbl::Zblcore::registerTypes().
|
signal |
Sent when a request to delete a ZLogSearch object has been received.
The backing ZblLogSearch object will be released and all ZLogSearch objects that reference it will become invalid after this signal is sent.
QString | A pointer to a ZLogSearch object that. |
Referenced by deleteSearch().
|
protected |
Definition at line 456 of file ZLogReader.cpp.
Referenced by deleteSearch(), and getSearch().
|
signal |
Sent when a new search object has been created.
searchObject | A pointer to the new ZLogSearch object. |
|
slot |
Updates the specified logmark parameters (note, search type) for the bookmark with the specified name or search phrase.
Each parameter in the specified dictionary of name/value pairs will be replaced. Parameters not in the dictionary will retain their original values.
If the specified bookmark or searchmark doesn't currently exist in ZLogReader's repository when this method is called no action is taken and false is returned.
parameters | a dictionary object containing name/value pairs for each parameter to be updated. |
name | Name or search phrase of the logmark object to be updated. Specify a name for bookmarks and named searchmarks or a search phrase for unnamed searchmarks. |
Definition at line 578 of file ZLogReader.cpp.
|
protected |
A central repository for log file marks. This is the definitive mark list for the log file, all others are copies.
Marks are used to flag log file records for selection, for returning search results and for storing user-defined bookmarks. They're contained in ZLogMap objects, each of which defines a specific group of marks based on their source. All marks satisfying a specific search phrase are returned in a single ZLogMap, for example. All bookmarks with the same name occupy a single ZLogMap object.
Each log viewport contains a ZLogMap for the current selection. Thus each selection is independent and local to each viewport. Search results and bookmarks are shared between viewports. Both can optionally be stored in a notation file.
Mark lookups traverse the list of map objects.
Definition at line 567 of file ZLogReader.h.
Referenced by getBookmark(), getBookmarkNames(), hasBookmark(), and newBookmark().
|
protected |
Path to log file being read.
Definition at line 546 of file ZLogReader.h.
Referenced by getFilePath(), onBackgroundOpenComplete(), openFile(), purgeSearchModel(), and registerType().
|
protected |
A data model used to display search objects.
Definition at line 584 of file ZLogReader.h.
Referenced by appendSearchModel(), getSearchModel(), purgeSearchModel(), and removeSearchModel().
|
protected |
A log reader worker object to perform log file input and parsing operations in a background thread.
Definition at line 533 of file ZLogReader.h.
Referenced by close(), getBackgroundReader(), newViewport(), onBackgroundOpenComplete(), openFile(), and registerType().
|
protected |
true when when log file is opened and ready to be used, false otherwise.
Definition at line 540 of file ZLogReader.h.
Referenced by close(), getReady(), and onBackgroundOpenComplete().
|
protected |
A central repository for log file marks. This is the definitive mark list for the log file, all others are copies.
Definition at line 578 of file ZLogReader.h.
Referenced by close(), deleteSearch(), getSearch(), getZSearch(), and hasSearchMap().
|
read |
Path to the log file being read by this object.
Definition at line 101 of file ZLogReader.h.
Referenced by openFile(), and registerType().
|
read |
true when the log file is opened and ready to be used, false otherwise
Definition at line 95 of file ZLogReader.h.
Zuble documentation copyright © 2019 Bob Dinitto. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Zuble is a derivative work of Qt version 5. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.