10 #include <QVariantMap> 21 : m_params(params), m_reader(reader), m_startPosition(startPosition), m_upPosition(-1), m_downPosition(-1)
23 zDebug() <<
"ZblLogBkSearch::ZblLogBkSearch";
27 static const int vpSize = 100;
33 m_vpDown =
new ZLogViewport(m_reader, vpSize,
this,
true);
40 zDebug() <<
"ZblLogBkSearch::~ZblLogBkSearch";
49 qmlRegisterUncreatableType<ZblLogBkSearch>(
"org.zuble.qml", 1, 0,
50 "ZblLogBkSearch",
"ZblLogBkSearch is an internal Zuble type. Use ZLogReader instead.");
66 zDebug() <<
"ZblLogBkSearch::markupViewport called";
68 const int chunkSize = 500;
73 throw ZblException(
"Error - viewport must be a ZLogViewport object.");
90 zDebug() <<
"markupViewport returned";
96 zDebug() <<
"startSearch function entered";
105 zDebug() <<
"invoking initial scanForward...";
107 QMetaObject::invokeMethod(
this,
"scanForward",
108 Qt::QueuedConnection);
111 zDebug() <<
"invoked initial scanForward...";
125 const bool loadMarkupColumn =
false;
130 QMetaObject::invokeMethod(
m_reader,
"loadViewport",
131 Qt::QueuedConnection,
134 Q_ARG(qint64, vpSize),
136 Q_ARG(
bool, loadMarkupColumn),
137 Q_ARG(QVariantMap, context));
147 zDebug() <<
"onLoadComplete called";
149 if(!errorMsg.isEmpty())
151 zWarning() <<
"Scanning file error encountered:" << errorMsg;
158 const int chunkSize = 27;
171 zDebug() <<
"invoking continued scanForward...";
173 QMetaObject::invokeMethod(
this,
"scanForward",
174 Qt::QueuedConnection);
176 zDebug() <<
"invoked continued scanForward...";
194 void ZblLogBkSearch::searchViewport(
198 const QList<int> roles,
200 const QString& searchPhrase,
201 bool signalFirstFind,
205 zDebug() <<
"searchViewport called";
This class performs log file I/O operations and JSON parsing in a background thread on behalf of a ZL...
void markupUpdated(ZLogViewport *viewport, ZblLogSearchList rowsFound)
Sent when a viewport's markeup data (model column 1) has been updated.
This class allows Zuble log file viewer text search operations to pass parameters between threads...
#define ZBL_REGISTER_LOGGED_OBJECT
ZLogViewport * m_vpDown
A viewport for scanning the file in the forward direction.
Q_INVOKABLE QVariant getValue(int role, int row)
Obtains the value of the specified data cell.
ZTableModel * getZModel()
Returns the data model containing the viewport's log records.
ZblLogReader * m_reader
Background log reader object.
A log viewport encapsulates a ZTableModel containing a contiguous subset of log records from a Zuble ...
Performs log file searches in a background thread.
void scanForward()
Scans a viewport for strings matching the search parameters.
qint64 m_upPosition
The current file position of the reverse scan;.
static void zInit()
Initializes search engine. Must be called only once before calling newLogSearcher() the first time...
#define ZBL_DEFINE_LOGGED_OBJECT(class_name)
ZBL_DECLARE_LOGGED_OBJECT ZblLogSearchParams m_params
Search parameters for this search object.
This two dimensional table model is used to store and manipulate data.
qint64 getMaxRecordCount()
Returns the number of log records the viewport data model will attempt to hold.
void markupViewport(QObject *viewport)
Updates the markup column (1) of the specified viewport's data model by scanning the data column (0) ...
void loadComplete(bool endOfData, QString errorMsg, QVariantMap context)
Signals that loading of the viewport requested by a call to loadRecordByIndex() has completed...
void moveComplete(qint64 rowsFound, qint64 rowsStored, bool endOfData, QString errorMsg)
Signals that moving of the viewport requested by a call to move() has completed.
void onMoveComplete(qint64 rowsFound, qint64 rowsStored, bool endOfData, QString errorMsg)
Called when the backward scanning viewport has been moved and is ready.
Log record scanner/highlighter object encapsulates logic for locating and marking up search text...
static ZblLogBkSearch * newLogSearcher()
Constructs a ZblLogBkSearch object and moves it to the search thread.
Q_INVOKABLE int modelRowCount() const
Returns the number of rows in the data set. This method may block the current thread.
This class allows Zuble log file viewer text search operations to pass search results between threads...
static int getSeekIndexRole()
Obtain the role number for the file seek position of a log record in the viewport's log record data m...
Zuble's Qt Exception Object.
~ZblLogBkSearch()
destructor
qint64 m_downPosition
The current file position of the forward scan;.
void onLoadComplete(bool eof, QString errorMsg, QVariantMap context)
Called when the forward scanning viewport has been loaded and is ready.
ZblLogSearchList scanModelColumnRows(ZTableModel *model, int chunkSize, ZLogViewport *viewport=NULL, qint64 currentRecordID=-1)
scanModelColumnRows
void startSearch()
Starts a text search of the log file for log records that satisfiy the search criteria. Search direction can be forward or backward or both.