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
ZLogReader.cpp
Go to the documentation of this file.
1 /*
2  * Zuble - A run-time system for QML/Javascript applications
3  * Copyright (C) 2015 Bob Dinitto
4  *
5  * Filename: ZLogReader.cpp
6  * Created on: 11/16/2015
7  * Author: Bob Dinitto
8  *
9  * Zuble is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  *
23  */
24 
25 #include "ZLogReader.h"
26 #include "ZTableModel.h"
27 #include "ZblLogManager.h"
28 #include "ZApplication.h"
29 #include "ZblLogReader.h"
30 #include "ZLogViewport.h"
31 #include "ZLogBookmark.h"
32 #include "ZblLogSearch.h"
33 #include "ZblLogBkSearch.h"
34 #include "ZLogReclinkModel.h"
35 #include "ZblLogSearchParams.h"
36 #include "ZLogSearch.h"
37 #include <QJsonParseError>
38 #include <QJsonArray>
39 #include <QJsonDocument>
40 #include <QtQml>
41 
42 namespace Zbl
43 {
44 
46 
47 
48 ZLogReader::ZLogReader(QObject *parent) :
49  QObject(parent), m_ready(false)
50 {
51  //m_logModel = zLogMan.createLogBufferModel();
52 
53  m_reader = ZblLogReader::newLogReader();
54 
55  connect(m_reader, SIGNAL(openComplete(bool,QString,QVariantMap)),
56  SLOT(onBackgroundOpenComplete(bool,QString,QVariantMap)));
57 
58  connect(m_reader, SIGNAL(notifyFileSize(qint64)),
59  this, SIGNAL(notifyFileSize(qint64)));
60 
61  //connect(m_reader, SIGNAL(loadRecordsComplete(QObject*,QString,QVariantMap)),
62  // SLOT(onBackgroundLoadIndexComplete(QObject*,QString,QVariantMap)));
63 
64 
65  m_model = new ZTableModel(this);
66 
67  m_model->setColumnCount(1);
68 
69  m_model->addRole(0, "searchObject");
70 }
71 
73 {
74  close();
75 }
76 
77 
79 {
81 
82  qmlRegisterType<ZLogReader>("org.zuble.qml", 1, 0, "ZLogReader");
83 
84  qmlRegisterUncreatableType<ZLogBookmark>("org.zuble.qml", 1, 0,
85  "ZLogBookmark", "ZLogBookmark objects are created using ZLogReader.");
86 
87  qmlRegisterUncreatableType<ZblLogSearch>("org.zuble.qml", 1, 0,
88  "ZblLogSearch", "ZblLogSearch objects are created automatically.");
89 
90  qmlRegisterUncreatableType<ZLogSearch>("org.zuble.qml", 1, 0,
91  "ZLogSearch", "ZLogSearch objects are created using ZLogReader.");
92 
93  qmlRegisterUncreatableType<ZLogReclinkModel>("org.zuble.qml", 1, 0,
94  "ZLogReclinkModel", "ZLogReclinkModel objects are created using ZLogSearch.");
95 
96  qRegisterMetaType<Zbl::ZblLogSearchList>("ZblLogSearchList");
97 
98  qRegisterMetaType<Zbl::ZblLogSearchParams>("ZblLogSearchParams");
99 
100  ZblLogReader::zInit(zLogMan.getLogBufferRoleCount());
103 }
104 
105 #if 0
106 void ZLogReader::openLogFile(const QString& filePath)
107 {
109 
110  QVariantMap context;
111  context.insert("loadOnOpen", QVariant(true));
112  context.insert("recordCount", QVariant(-1));
113  context.insert("recordIndex", QVariant(0));
114 
115  QMetaObject::invokeMethod(m_reader, "openFile",
116  Qt::QueuedConnection,
117  Q_ARG(const QString&, filePath),
118  Q_ARG(QVariantMap, context));
119 }
120 #endif
121 
122 void ZLogReader::onBackgroundOpenComplete(bool success, QString errorMsg, QVariantMap contextMap)
123 {
124  zDebug() << "Background log file opened!!";
125 
126  m_ready = success;
127 
128 #if 0
129 
130  bool loadFile = contextMap.value("loadOnOpen", false).toBool();
131 
132  if(loadFile)
133  {
134 
135  // create the viewport
136 
137  qint64 recordCount = contextMap.value("recordCount", QVariant(1000)).toInt();
138 
139  qint64 recordIndex = contextMap.value("recordIndex", QVariant(0)).toInt();
140 
141  ZLogViewport* viewport = new ZLogViewport(m_reader, m_searcher, recordCount);
142 
143 
144  // load the viewport
145 
146  QMetaObject::invokeMethod(m_reader, "loadViewport",
147  Qt::QueuedConnection,
148  Q_ARG(QObject*, viewport),
149  Q_ARG(qint64, recordIndex), // record index
150  Q_ARG(qint64, recordCount), // viewport size
151  Q_ARG(QVariantMap, contextMap));
152 
153  }
154  else
155  {
156  emit openComplete(m_filePath, success, errorMsg);
157  }
158 
159 
160 #else
161  emit openComplete(m_filePath, success, errorMsg);
162 
163 #endif
164 }
165 
166 
167 #if 0
168 void ZLogReader::onBackgroundLoadIndexComplete(QObject *viewport,
169  QString errorMsg,
170  QVariantMap contextMap)
171 {
172  emit loadComplete(viewport, errorMsg);
173 }
174 #endif
175 
176 void ZLogReader::openFile(const QString& filePath)
177 {
179 
180  QVariantMap context;
181  //context.insert("loadOnOpen", QVariant(false));
182  //context.insert("recordCount", QVariant(0));
183  //context.insert("recordIndex", QVariant(0));
184 
185  QMetaObject::invokeMethod(m_reader, "openFile",
186  Qt::QueuedConnection,
187  Q_ARG(const QString&, filePath),
188  Q_ARG(QVariantMap, context));
189 }
190 
192 {
193  if(!m_ready)
194  return;
195 
196  m_ready = false;
197 
198  emit closeAlert();
199 
201 
202  m_searchmarks.clear();
203 
204  QMetaObject::invokeMethod(m_reader,"close", Qt::QueuedConnection);
205 }
206 
208 {
209  ZLogViewport* newVp = new ZLogViewport(m_reader, 0, this);
210 
211  //newVp->connect(this, &ZLogReader::searchDeleteRequested, newVp, &ZLogViewport::onSearchDeleteRequested);
212 
213  return newVp;
214 }
215 
217 {
218  return m_ready;
219 }
220 
222 {
223  return m_filePath;
224 }
225 
227 {
228  return m_reader;
229 }
230 
231 
232 QObject* ZLogReader::newBookmark(const QString& name)
233 {
234  ZLogBookmark* bookmark = NULL;
235 
237 
238  if(inObjectThread(this))
239  {
240  if(hasBookmark(name))
241  {
242  QString msg("Error: Bookmark name: %1 already exists.");
243  msg.arg(name);
244  throw ZblException(msg);
245  }
246 
247  //bookmark = new ZLogBookmark(this);
248 
249  bookmark->setMarkName(name);
250 
251  m_bookmarks.append(bookmark);
252 
253 
254  connect(bookmark, &ZLogMap::selectionUpdated, this, &ZLogReader::bookmarksUpdated);
255 
256  emit bookmarksUpdated();
257  }
258  else
259  {
260 
261  QMetaObject::invokeMethod(this,"newBookmark",
262  Qt::BlockingQueuedConnection,
263  Q_RETURN_ARG(ZLogBookmark*, bookmark),
264  Q_ARG(const QString&, name)
265  );
266  }
267 
268  //zDebug() << "newBookmark returning name: " + bookmark->getMarkName();
269 
270  ZBL_SLOT_END_RETURN(bookmark, NULL,
272 }
273 
274 QObject* ZLogReader::getBookmark(const QString& name)
275 {
276  ZLogBookmark* bookmark = NULL;
277 
279 
280  if(inObjectThread(this))
281  {
282  const int count = m_bookmarks.count();
283 
284  for(int i=0; i<count; i++)
285  {
286  ZLogBookmark* nextMark = m_bookmarks.at(i);
287  if(nextMark->getMarkName() == name)
288  {
289  bookmark = nextMark;
290  break;
291  }
292  }
293  }
294  else
295  {
296 
297  QMetaObject::invokeMethod(this,"getBookmark",
298  Qt::BlockingQueuedConnection,
299  Q_RETURN_ARG(ZLogBookmark*, bookmark),
300  Q_ARG(const QString&, name)
301  );
302  }
303 
304  ZBL_SLOT_END_RETURN(bookmark, NULL,
306 
307 }
308 
309 #if 0
310 
311 QObject* ZLogReader::newSearchmark(const QString& searchPhrase, int searchType)
312 {
313  ZLogSearch* searchmark = NULL;
314 
316 
317  if(inObjectThread(this))
318  {
319  if(hasSearchmark(searchPhrase, searchType))
320  {
321  QString msg("Error: Searchmark phrase: %1 already exists.");
322  msg.arg(searchPhrase);
323  throw ZblException(msg);
324  }
325 
326  QString markName = QString("Search: %1:%2").arg(searchType).arg(searchPhrase);
327 
328  searchmark = new ZLogSearch(this);
329 
330  searchmark->setMarkName(markName);
331 
332  searchmark->setPhrase(searchPhrase);
333 
334  searchmark->setSearchType(searchType);
335 
336  m_bookmarks.append(searchmark);
337 
338  //QObject::connect(searchmark, &ZLogMap::selectionUpdated, this, &ZLogReader::bookmarksUpdated);
339 
340  //emit bookmarksUpdated();
341  }
342  else
343  {
344 
345  QMetaObject::invokeMethod(this,"newSearchmark",
346  Qt::BlockingQueuedConnection,
347  Q_RETURN_ARG(ZLogSearch*, searchmark),
348  Q_ARG(const QString&, searchPhrase),
349  Q_ARG(int, searchType)
350  );
351  }
352 
353  ZBL_SLOT_END_RETURN(searchmark, NULL,
354  Z_FAC_JS, ZLogReader::newSearchmark, newSearchmark failed)
355 }
356 #endif
357 
358 zblLogSearchPtr ZLogReader::getZSearch(const QString& searchPhrase, int searchType, QList<int> searchRoles)
359 {
360  // empty search phrase always creates "null" search object - no roles and type 0
361 
362  QList<int> roles;
363  int sType = 0;
364 
365  if(!searchPhrase.isEmpty())
366  {
367  roles = searchRoles;
368  sType = searchType;
369  }
370 
371  zDebug() << "ZLogReader returning search: " << searchPhrase << ";;;;; type=" << sType << "; roles=" << roles;
372 
373  QString searchName = ZblLogSearch::getSearchmarkName(searchPhrase, sType, roles);
374 
375  zDebug() << "Search name = " << searchName;
376 
377  QWeakPointer<ZblLogSearch> wkSearch = m_searchmarks.value(searchName);
378 
379  if(!wkSearch.isNull())
380  {
381  zblLogSearchPtr searchPtr(wkSearch.toStrongRef());
382 
383  if(!searchPtr.isNull())
384  {
385  zDebug() << "Returning existing search object.";
386 
387  return searchPtr;
388  }
389  }
390 
391 #if 0
392  ZblLogSearch* search = new ZblLogSearch(
393  searchPhrase,
394  searchType,
395  searchRoles,
397  0,
398  this);
399 
400 #else
401  ZblLogSearch* search = NULL;
402 #endif
403 
404 
405 
406  //zblLogSearchPtr newSearch(search, &ZblLogSearch::dismiss);
407 
408 
409 #if 1
410 
411  zDebug() << "Creating new search object.";
412 
413  zblLogSearchPtr newSearch(
414  new ZblLogSearch(
415  searchPhrase,
416  searchType,
417  searchRoles,
419  0,
420  this), &ZblLogSearch::dismiss);
421 #endif
422 
423 
424  QQmlEngine::setObjectOwnership(newSearch.data(), QQmlEngine::CppOwnership);
425 
426  // TBD: should reserve mark name for end user?
427 
428  newSearch->setMarkName(searchName);
429 
430  //bool replacingExtantSearch = hasSearchMap(searchName);
431 
432  m_searchmarks.insert(searchName, newSearch.toWeakRef());
433 
434  appendSearchModel(newSearch);
435 
436  return newSearch;
437 }
438 
440 {
441  zDebug() << "Adding search object to model: " << search->getMarkName();
442 
443  ZLogSearch* searchWrapper = new ZLogSearch(search, this);
444 
445  searchWrapper->setParent(this);
446 
447  QVariant vSearch = QVariant::fromValue(searchWrapper);
448 
449  ZDataRow row;
450 
451  row.append(vSearch);
452 
453  m_model->appendCells(row);
454 }
455 
457 {
458  zDebug() << "Removing search object from model: " << search->getMarkName();
459 
460  const int rowCount = m_model->modelRowCount();
461 
462  for(int i=0; i<rowCount; i++)
463  {
464  QVariant vSearch = m_model->getValue(0,i);
465 
466  ZLogSearch* wSearch = vSearch.value<ZLogSearch*>();
467 
468  QSharedPointer<ZblLogSearch> pSearch(wSearch->getZSearch());
469 
470  if(pSearch.data() == search)
471  {
472  if(pSearch->getMarkName() != search->getMarkName())
473  zWarning() << "Mark name mismatch! -- " << search->getMarkName();
474 
475  m_model->removeRow(i);
476 
477  wSearch->deleteLater();
478 
479  return;
480  }
481  }
482 }
483 
485 {
486  zDebug() << "Removing all search objects from data model: " << m_filePath;
487 
488  const int rowCount = m_model->modelRowCount();
489 
490  for(int i=0; i<rowCount; i++)
491  {
492  QVariant vSearch = m_model->getValue(0,i);
493 
494  ZLogSearch* wSearch = vSearch.value<ZLogSearch*>();
495 
496  wSearch->deleteLater();
497  }
498 
499  m_model->clearData();
500 }
501 
503 {
504  return m_model;
505 }
506 
507 bool ZLogReader::hasSearch(const QString& searchPhrase, int searchType, QList<int> searchRoles)
508 {
509  return hasSearchMap(ZblLogSearch::getSearchmarkName(searchPhrase, searchType, searchRoles));
510 }
511 
512 QObject* ZLogReader::getSearch(const QString& searchPhrase, int searchType, QList<int> searchRoles)
513 {
514  zblLogSearchPtr searchObject(getZSearch(searchPhrase, searchType, searchRoles));
515 
516  ZLogSearch* searchWrapper = new ZLogSearch(searchObject, this);
517 
518  QObject::connect(searchObject.data(), &ZblLogSearch::invalidate, searchWrapper, &ZLogSearch::onInvalidate);
519 
520  return searchWrapper;
521 }
522 
523 #if 0
524 void ZLogReader::purgeSearch()
525 {
526 
527  ZblLogSearch* zSearch = qobject_cast<ZblLogSearch*>(sender());
528 
529  if(!zSearch)
530  {
531  zWarning() << "Programming error: ZLogReader::purgeSearch() - Invalid connection or call!";
532  return;
533  }
534 
535  removeSearchModel(zSearch);
536 
537  int count = m_searchmarks.remove(zSearch->getMarkName());
538 
539  if(count == 0)
540  zWarning() << "Programming error: Search object not found in search object map.";
541 }
542 #endif
543 
544 
545 bool ZLogReader::hasBookmark(const QString& name)
546 {
547  const int count = m_bookmarks.count();
548 
549  for(int i=0; i<count; i++)
550  if(m_bookmarks.at(i)->getMarkName() == name)
551  return true;
552 
553  return false;
554 }
555 
556 bool ZLogReader::hasSearchMap(const QString& searchName)
557 {
558  QMap<QString, QWeakPointer<ZblLogSearch> >::iterator i = m_searchmarks.find(searchName);
559 
560  if(i == m_searchmarks.end())
561  return false;
562 
563  zblLogSearchPtr searchObject(i.value());
564 
565  return !searchObject.isNull();
566 }
567 
568 
569 
570 #if 0
571 bool ZLogReader::updateLogmark(const QObject* logMark, const QString& name)
572 {
573  return false;
574 }
575 #endif
576 
577 
578 bool ZLogReader::setLogmapParameters(const QObject* parameters, const QString& name)
579 {
580  return false;
581 
582 }
583 
584 
585 bool ZLogReader::deleteBookmark(const QString& name)
586 {
587  zDebug() << "ZLogReader::deleteBookmark function unimplelemted!";
588 
589  return false;
590 
591 }
592 
593 bool ZLogReader::deleteSearch(QObject* search)
594 {
595  bool status = false;
596 
597  ZLogSearch* wSearch = qobject_cast<ZLogSearch*>(search);
598 
599  if(!wSearch)
600  {
601  zWarning() << "Programming error: search parameter must be a ZLogSearch object.";
602  return status;
603  }
604 
605  if(!wSearch->isValid())
606  return status;
607 
608  zblLogSearchPtr pSearch(wSearch->getZSearch());
609 
610  if(pSearch->isNull())
611  {
612  zWarning() << "Programming error: dangling ZLogSearch object.";
613  return status;
614  }
615 
616  removeSearchModel(pSearch.data());
617 
618  QString searchName = pSearch->getMarkName();
619 
620  emit releaseSearchReferences(searchName);
621 
622  if(m_searchmarks.remove(searchName))
623  status = true;
624 
625  pSearch->invalidate();
626 
627 }
628 
629 QMap<qint64, QStringList> ZLogReader::getBookmarkSet(qint64 firstID, qint64 lastID)
630 {
631  QMap<qint64, QStringList> markset;
632 
634 
635  if(inObjectThread(this))
636  {
637  if(firstID>lastID)
638  throw ZblException("Error: lastID must be greater than or equal to firstID");
639 
640  for(qint64 i=firstID; i<=lastID; i++)
641  markset.insert(i,getBookmarkNames(i));
642  }
643  else
644  {
645  QMetaObject::invokeMethod(this,"getBookmarkSet",
646  Qt::BlockingQueuedConnection,
647  Q_RETURN_ARG(zMarkSet, markset),
648  Q_ARG(qint64, firstID),
649  Q_ARG(qint64, lastID)
650  );
651  }
652 
653  ZBL_SLOT_END_RETURN(markset, zMarkSet(),
655 }
656 
657 QStringList ZLogReader::getBookmarkNames(qint64 recordID)
658 {
659  QStringList names;
660 
662 
663  if(inObjectThread(this))
664  {
665  const int count = m_bookmarks.count();
666 
667  for(int i=0; i<count; i++)
668  {
669  ZLogBookmark* bookmark = m_bookmarks.at(i);
670 
671  if(bookmark->hasMark(recordID))
672  names.append(bookmark->getMarkName());
673  }
674  }
675  else
676  {
677 
678  QMetaObject::invokeMethod(this,"getBookmarkNames",
679  Qt::BlockingQueuedConnection,
680  Q_RETURN_ARG(QStringList, names),
681  Q_ARG(qint64, recordID)
682  );
683  }
684 
685  ZBL_SLOT_END_RETURN(names, QStringList(),
687 }
688 
689 QMap<qint64, QStringList> ZLogReader::getSearchmarkSet(qint64 firstID, qint64 lastID)
690 {
691  return QMap<qint64, QStringList>();
692 }
693 
694 
695 
696 
697 #if 0
698 int ZLogReader::getMarkTypes(qint64 recordID)
699 {
700 
701  ZLogMap::MarkTypes markTypes = ZLogMap::Invalid;
702 
703  const int count = m_logMaps.count();
704 
705  for(int i=0; i<count; i++)
706  {
707  ZLogMap* nextMap = m_logMaps.at(i);
708 
709  ZLogMap::MarkType nextType = nextMap->getMarkType();
710 
711  if(nextType && markTypes)
712  continue;
713 
714  if(nextMap->hasMark(recordID))
715  markTypes |= nextType;
716 
718  break;
719  }
720 
721  return markTypes;
722 
723 }
724 
725 QList<QObject*> ZLogReader::getMarks(qint64 recordID, int markTypes)
726 {
727  QList<QObject*> marks;
728 
729  const int count = m_logMaps.count();
730 
731  for(int i=0; i<count; i++)
732  {
733  ZLogMap* nextMap = m_logMaps.at(i);
734 
735  if((nextMap->getMarkType() | markTypes) && nextMap->hasMark(recordID))
736  marks.append(nextMap);
737  }
738 
739  return marks;
740 }
741 #endif
742 
743 } // Zbl
Encapsulates information necessary to locate a collection of log records in a log file...
Definition: ZLogBookmark.h:46
Q_INVOKABLE QObject * getSearchModel()
Obtain a pointer to the data model containing search objects for this log file.
Definition: ZLogReader.cpp:502
QMap< qint64, QStringList > zMarkSet
Definition: ZLogReader.h:68
virtual ~ZLogReader()
Virtual object destructor.
Definition: ZLogReader.cpp:72
QObject * getBookmark(const QString &name)
Obtains the bookmark or searchmark with the given name.
Definition: ZLogReader.cpp:274
static void registerType()
Registers ZLogReader as a QML type.
Definition: ZLogReader.cpp:78
Q_INVOKABLE void appendCells(QVariant data, bool truncateModel=false)
Asynchronously converts an array of cell data into one or more rows of model data and appends it to t...
bool deleteBookmark(const QString &name)
Remove the specified bookmark or searchmark by name.
Definition: ZLogReader.cpp:585
void openFile(const QString &filePath)
Opens the log file in a background thread concurrently but does not load it. Sends the openComplete s...
Definition: ZLogReader.cpp:176
This class performs log file I/O operations and JSON parsing in a background thread on behalf of a ZL...
Definition: ZblLogReader.h:91
Q_INVOKABLE void clearData()
Removes all data from the model. Roles and role names remain intact.
ZLogBookmark::zLogBookmarkList m_bookmarks
A central repository for log file marks. This is the definitive mark list for the log file...
Definition: ZLogReader.h:567
bool setLogmapParameters(const QObject *parameters, const QString &name)
Updates the specified logmark parameters (note, search type) for the bookmark with the specified name...
Definition: ZLogReader.cpp:578
A QML type that manages reading JSON formatted Zuble log files. QML programs create using Zbl...
Definition: ZLogReader.h:62
ZblLogReader * getBackgroundReader()
Obtains a pointer to the background reader object that services this log file.
Definition: ZLogReader.cpp:226
#define Z_FAC_JS
Definition: zglobal.h:123
QMap< qint64, QStringList > getBookmarkSet(qint64 firstID, qint64 lastID)
Returns a map containing log mark information for the specified set of log records.
Definition: ZLogReader.cpp:629
QString getMarkName() const
Maintains a list of log record links pertaining to a specific log file.
Definition: ZLogMap.h:28
ZBL_DECLARE_LOGGED_OBJECT ZblLogReader * m_reader
A log reader worker object to perform log file input and parsing operations in a background thread...
Definition: ZLogReader.h:533
void invalidate()
Sent when a request to delete this object requires all references to be released. ...
#define ZBL_REGISTER_LOGGED_OBJECT
Definition: zglobal.h:104
A wrapper for the explicitly shared ZblLogSearch object.
Definition: ZLogSearch.h:18
void onBackgroundOpenComplete(bool success, QString errorMsg, QVariantMap contextMap)
Called by the background thread when file has been opened.
Definition: ZLogReader.cpp:122
void closeAlert()
Sent when the close() function has been called.
void bookmarksUpdated()
Sent when the master log mark database has been updated.
static QString getSearchmarkName(QString searchPhrase, int searchType, QList< int > searchRoles)
Creates a unique name string for a given set of search parameters.
bool hasMark(qint64 recordID)
Determine if the log map contains a mark for the specified log record.
Definition: ZLogMap.cpp:166
Q_INVOKABLE QVariant getValue(int role, int row)
Obtains the value of the specified data cell.
bool m_ready
true when when log file is opened and ready to be used, false otherwise.
Definition: ZLogReader.h:540
Q_INVOKABLE zblLogSearchPtr getZSearch(const QString &searchPhrase, int searchType, QList< int > searchRoles)
Obtains or creates a search mark with the given search parameters.
Definition: ZLogReader.cpp:358
bool getReady()
Obtains the state of the ready flag..
Definition: ZLogReader.cpp:216
A log viewport encapsulates a ZTableModel containing a contiguous subset of log records from a Zuble ...
Definition: ZLogViewport.h:95
Definition: ZAndGate.cpp:6
QObject * newBookmark(const QString &name)
Creates a new ZLogBookmark object and returns it.
Definition: ZLogReader.cpp:232
static void zInit()
Initializes search engine. Must be called only once before calling newLogSearcher() the first time...
QObject * newViewport()
Obtains a new empty foreground ZLogViewport object on the log file.
Definition: ZLogReader.cpp:207
static void zInit(int logRecordRoleCount)
Must be called only once before calling newLogReader();.
void appendSearchModel(zblLogSearchPtr search)
Definition: ZLogReader.cpp:439
#define ZBL_SLOT_BEGIN_TRY
Definition: zglobal.h:128
void setMarkName(const QString &name)
#define zLogMan
Definition: ZblLogManager.h:36
bool hasSearchMap(const QString &searchName)
Definition: ZLogReader.cpp:556
QStringList getBookmarkNames(qint64 recordID)
Obtains a list of bookmark names for the specified log record.
Definition: ZLogReader.cpp:657
static ZblLogReader * newLogReader()
creates a new ZblLogReader object and moves it to the shared background log reader thread...
#define ZBL_DEFINE_LOGGED_OBJECT(class_name)
Definition: zglobal.h:99
#define zWarning()
Definition: zglobal.h:111
void releaseSearchReferences(QString searchObjectName)
Sent when a request to delete a ZLogSearch object has been received.
This two dimensional table model is used to store and manipulate data.
Definition: ZTableModel.h:96
QSharedPointer< ZblLogSearch > zblLogSearchPtr
Definition: ZblLogSearch.h:681
MarkType
Types of log maps: Invalid, Selection, Search, Bookmark.
Definition: ZLogMap.h:42
#define zDebug()
Definition: zglobal.h:113
Q_INVOKABLE QObject * getSearch(const QString &searchPhrase, int searchType, QList< int > searchRoles)
Obtains or creates the searchmark with the given search parameters.
Definition: ZLogReader.cpp:512
void selectionUpdated()
Sent whenever the ZLogMap state has been changed.
static void dismiss(QObject *search)
QSharedPointer deleter method called when last strong reference has gone out of scope; sends detach()...
bool inObjectThread(const QObject &object)
Definition: zglobal.h:173
Q_INVOKABLE int modelRowCount() const
Returns the number of rows in the data set. This method may block the current thread.
void purgeSearchModel()
Definition: ZLogReader.cpp:484
void removeSearchModel(ZblLogSearch *search)
Definition: ZLogReader.cpp:456
void close()
Close the log file input object and release resources.
Definition: ZLogReader.cpp:191
Q_INVOKABLE bool hasSearch(const QString &searchPhrase, int searchType, QList< int > searchRoles)
Determine if a specific search object exists.
Definition: ZLogReader.cpp:507
QString filePath
Path to the log file being read by this object.
Definition: ZLogReader.h:101
Zuble&#39;s Qt Exception Object.
Definition: ZblException.h:45
bool hasBookmark(const QString &name)
Definition: ZLogReader.cpp:545
static void zInit()
Initializes search engine. Must be called only once before constructing the first ZblLogSearch object...
QSharedPointer< ZblLogSearch > getZSearch()
Definition: ZLogSearch.cpp:12
void onInvalidate()
Handler for the ZblLogSearch::invalidate signal.
Definition: ZLogSearch.cpp:131
QString m_filePath
Path to log file being read.
Definition: ZLogReader.h:546
Q_INVOKABLE bool isValid() const
Determine if this wrapper object points to a valid search object.
Definition: ZLogSearch.cpp:126
Q_INVOKABLE void removeRow(int row)
QString getFilePath()
Obtains the path to the log file.
Definition: ZLogReader.cpp:221
ZTableModel * m_model
A data model used to display search objects.
Definition: ZLogReader.h:584
#define ZBL_SLOT_END_RETURN(return_success, return_failed, facility, code, error_message)
Definition: zglobal.h:141
QMap< QString, QWeakPointer< ZblLogSearch > > m_searchmarks
A central repository for log file marks. This is the definitive mark list for the log file...
Definition: ZLogReader.h:578
This object encapsulates search operation parameters, results, and steady state.
Definition: ZblLogSearch.h:35
QMap< qint64, QStringList > getSearchmarkSet(qint64 firstID, qint64 lastID)
Returns a map containing log mark information for the specified set of log records.
Definition: ZLogReader.cpp:689
bool deleteSearch(QObject *search)
Remove the specified search object from the search map and model.
Definition: ZLogReader.cpp:593
QList< QVariant > ZDataRow
Represents a single row (or column for column headers) of data cell values for a single role...
Definition: ZTableModel.h:57
void openComplete(QString filePath, bool success, QString errorMsg)
Sent when an openFile() operation has completed;.