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
ZLogViewport.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: ZLogViewport.cpp
6  * Created on: 11/22/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 #include <QtQml>
25 #include "ZLogViewport.h"
26 #include "ZblLogReader.h"
27 #include "ZTableModel.h"
28 #include "ZblLogManager.h"
29 #include "ZLogReader.h"
30 #include "ZblLogBkSearch.h"
31 
32 namespace Zbl {
33 
35 
36 const qint64 ZLogViewport::m_minimumRecordSize = 1024;
37 const qint64 ZLogViewport::m_maximumRecordSize = 65536;
38 
42 
44  ZblLogReader* reader,
45  qint64 recordCount,
46  QObject* parent,
47  bool background) :
48  QObject(parent),
49  m_reader(reader),
50  m_optimalCount(recordCount),
51  m_assumeRecordSize(-1),
52  m_currentSearch(0),
53  m_motionLock(false),
54  m_listener(0)
55 {
56  // TBD: calling zLogMan to create the log buffer binds the log reader
57  // application to reading only log files from it's own version of the log
58  // file output format. should there be a versioning system?
59  // what about supporting alternate file formats, such as binary or custom?
60 
61  m_model = zLogMan.createLogBufferModel(this);
62 
63 
64  m_model->addRole(m_roleSeekIndex, "seekIndex");
65  m_model->addRole(m_roleByteCount, "byteCount");
66  m_model->addRole(m_roleBookmarks, "bookmarks");
67 
68  static bool zLogViewportInitialized = false;
69 
70  if(!zLogViewportInitialized)
71  {
73  zLogViewportInitialized = true;
74  }
75 
76  if(!background)
77  {
78  // foreground viewport gets 2 columns and a selection map
79 
80  m_model->setColumnCount(2); // add column for rich text markup
81 
82  // listen for updates to master mark list
83 
84  ZLogReader* logReader = qobject_cast<ZLogReader*>(parent);
85 
86  if(logReader)
87  {
88  // TBD: should ZblViewport owner make connection instead of embedding knowledge
89  // about the viewport container here?
90 
91  m_selectionMap = new ZLogMap(logReader);
92 
94  }
95 
96  QList<int> roles;
97 
98  m_currentSearch = getZReader()->getZSearch("",0,roles);
99  }
100  else
101  {
102  // background viewport gets one column, no selection map
103 
105  }
106 
107  m_listener = this;
108 
109  //connect(this, &ZLogViewport::rowMatched, this, &ZLogViewport::onRowMatched);
110 }
111 
113 {
114  qmlRegisterUncreatableType<ZLogViewport>
115  ("org.zuble.qml", 1, 0,
116  "ZLogViewport",
117  "Use ZLogReader to create ZLogViewport objects.");
118 
119  qint64 nextRole = zLogMan.getLogBufferRoleCount();
120  m_roleSeekIndex = nextRole++;
121  m_roleByteCount = nextRole++;
122  m_roleBookmarks = nextRole++;
123 
124 }
125 
126 
128 {
129  zDebug() << "Viewport was notified of log marks updated.";
130 
131  // TBD: UPDATE VIEWPORT MODEL WITH BOOKMARK INFO!!!!!
132 
133  ZLogReader* reader = getZReader();
134 
135  const int modelRowCount = m_model->modelRowCount();
136 
137  for(int i=0; i < modelRowCount; i++)
138  {
139 
140  qint64 recordID = m_model->getValue(ZblLogManager::LogFieldRecordNum, i).toLongLong();
141 
142  m_model->putValue(m_roleBookmarks, i, QVariant(reader->getBookmarkNames(recordID)));
143  }
144 }
145 
146 
148 {
149  return m_model;
150 }
151 
153 {
154  return m_selectionMap;
155 }
156 
158 {
159  return new ZLogSearch(m_currentSearch, getZReader());
160 }
161 
162 bool ZLogViewport::setCurrentSearch(QObject *search)
163 {
164  ZLogSearch* zSearch = qobject_cast<ZLogSearch*>(search);
165 
166  if(!zSearch)
167  {
168  zWarning() << "Programming error: search parameter must be a ZLogSearch object.";
169  return false;
170  }
171 
172  if(!zSearch->getZSearch()->validateReader(getZReader()))
173  {
174  zWarning() << "Programming error: specified ZLogSearch object is not from this viewport's log file.";
175  return false;
176  }
177 
178 #if 0
179 
180  if(m_currentSearch)
181  QObject::disconnect(m_currentSearch->getSearcher(), &ZblLogBkSearch::markupUpdated, this, &ZLogViewport::onMarkupCompleted);
182 #endif
183 
184  m_currentSearch = zSearch->m_search;
185 
186  //connect(m_currentSearch->getSearcher(), &ZblLogBkSearch::markupUpdated, this, &ZLogViewport::onMarkupCompleted);
187 
188  //connect( m_currentSearch->getSearcher(), SIGNAL(markupUpdated(ZLogViewport*, ZblLogSearchList)),
189  //SLOT(onMarkupCompleted(ZLogViewport*, ZblLogSearchList)));
190 
191  return true;
192 }
193 
194 
196 {
197  return m_currentSearch;
198 }
199 
200 
202 {
203  return NULL;
204 
205 }
206 
208 {
209  return NULL;
210 }
211 
212 #if 0
213 QVariant ZLogViewport::getCurrentSearchParams()
214 {
215  QVariant searchParams;
216 
217  if(m_currentSearch)
218  searchParams = ZblLogSearchParams::fromSearch(m_currentSearch.data());
219  else
220  searchParams = QVariant::fromValue<ZblLogSearchParams>(ZblLogSearchParams());
221 
222  return searchParams;
223 }
224 #endif
225 
227 {
228  if(m_currentSearch)
229  return m_currentSearch->getSearchParameters();
230  else
231  return ZblLogSearchParams();
232 }
233 
235 {
236  return m_motionLock;
237 }
238 
240 {
242 
243  if(inObjectThread(this))
244  {
246  }
247  else
248  {
249  QMetaObject::invokeMethod(this, "setLock",
250  Qt::BlockingQueuedConnection,
251  Q_ARG(bool,locked));
252  }
253 
254  ZBL_SLOT_END_VOID(Z_FAC_JS, getValue, getValue failed)
255 }
256 
257 
259 {
260  return m_model;
261 }
262 
264 {
265  return m_roleSeekIndex;
266 }
267 
269 {
270  return m_roleByteCount;
271 
272 }
274 {
275  return m_roleBookmarks;
276 }
277 
279 {
280  return m_assumeRecordSize;
281 }
282 
284 {
285  if(size < 1024)
286  size = 1024;
287  else if(size > 1024 * 64)
288  size = 1024 * 64;
289 
290  m_assumeRecordSize = size;
291 }
292 
293 
295 {
296  return getZReader();
297 }
298 
300 {
301  ZLogReader* reader = qobject_cast<ZLogReader*>(parent());
302 
303  if(!reader)
304  {
305  //zWarning() << "Programming error: ZLogViewport parent is not "
306  // "of class ZLogReader.";
307  return NULL;
308  }
309 
310  return reader;
311 }
312 
313 qint64 ZLogViewport::getRecordSeekPos(qint64 recordID)
314 {
315  const int rowCount = m_model->modelRowCount();
316 
317  for(qint64 i=0; i < rowCount; i++)
318  {
319  int nextID = m_model->getValue(ZblLogManager::LogFieldRecordNum, i).toInt();
320 
321  if(nextID == recordID)
322  {
323  qint64 nextPos = m_model->getValue(m_roleSeekIndex, i).toInt();
324  return nextPos;
325  }
326 
327  }
328  return -1;
329 }
330 
331 qint64 ZLogViewport::getRecordModelRow(qint64 recordID)
332 {
333  const int rowCount = m_model->modelRowCount();
334 
335  const int firstID = m_model->getValue(ZblLogManager::LogFieldRecordNum, 0).toInt();
336  const int lastID = m_model->getValue(ZblLogManager::LogFieldRecordNum, rowCount-1).toInt();
337 
338  if(recordID < firstID || recordID > lastID)
339  return -1;
340 
341  for(qint64 i=0; i < rowCount; i++)
342  {
343  int nextID = m_model->getValue(ZblLogManager::LogFieldRecordNum, i).toInt();
344 
345  if(nextID == recordID)
346  return i;
347  }
348 
349  return -1;
350 }
351 
352 
353 
354 #if 0
355 
356 int ZLogViewport::getSelectionType()
357 {
358  return ZLogMap::Selection;
359 }
360 
361 int ZLogViewport::getSearchType()
362 {
363  return ZLogMap::Search;
364 }
365 
366 int ZLogViewport::getBookmarkType()
367 {
368  return ZLogMap::Bookmark;
369 }
370 
371 int ZLogViewport::getInvalidType()
372 {
373  return ZLogMap::Invalid;
374 }
375 
376 int ZLogViewport::getAllType()
377 {
378  return ZLogMap::Selection | ZLogMap::Search | ZLogMap::Bookmark;
379 }
380 #endif
381 
382 #if 0
383 qint64 ZLogViewport::insertMark(qint64 recordID,
384  qint64 seekPosition,
385  int markType,
386  QVariant name ,
387  QVariant note)
388 {
389  return m_selectionMap->insertMark(recordID, -1, seekPosition);
390 }
391 QList<QObject*> ZLogViewport::getMarks(qint64 recordID, int markTypes)
392 {
393  QList<QObject*> marks;
394 
395  const int count = m_mapList.count();
396 
397  for(int i=0; i<count; i++)
398  {
399  ZLogMap* nextMap = m_mapList.at(i);
400 
401  if((nextMap->getMarkType() | markTypes) && nextMap->hasMark(recordID))
402  marks.append(nextMap);
403  }
404 
405  return marks;
406 }
407 
408 int ZLogViewport::getMarkTypes(qint64 recordID)
409 {
410 
411  ZLogMap::MarkTypes markTypes = ZLogMap::Invalid;
412 
413  const int count = m_mapList.count();
414 
415  for(int i=0; i<count; i++)
416  {
417  ZLogMap* nextMap = m_mapList.at(i);
418 
419  ZLogMap::MarkType nextType = nextMap->getMarkType();
420 
421  if(nextType && markTypes)
422  continue;
423 
424  if(nextMap->hasMark(recordID))
425  markTypes |= nextType;
426 
428  break;
429  }
430 
431  return markTypes;
432 
433 }
434 #endif
435 
436 
437 void ZLogViewport::timerEvent(QTimerEvent * event)
438 {
439  killTimer(m_timerID);
440 
442 
443  m_timerID = startTimer(2000);
444 }
445 
447 {
448  return m_listener;
449 }
450 
452 {
453  // TBD: still need listener?
454  m_listener = listener;
455 }
456 
458 {
459  return m_optimalCount;
460 }
461 
462 
464  qint64 seekPosition,
465  qint64 recordCount)
466 
467 {
469 
470  if(m_motionLock)
471  throw ZblException("ZLogViewport::loadRecordByIndex - can't load "
472  "viewport while background operation in progress.");
473 
474  QVariantMap empty;
475 
476  const bool markupColumn = m_model->modelColumnCount() > 1;
477 
478  ZblLogSearchParams searchParams = getSearchParameters();
479 
480  QMetaObject::invokeMethod(m_reader, "loadViewport",
481  Qt::QueuedConnection,
482  Q_ARG(QObject*, this),
483  Q_ARG(qint64, seekPosition), // record index
484  Q_ARG(qint64, recordCount), // viewport size
485  Q_ARG(ZblLogSearchParams, searchParams),
486  Q_ARG(bool, markupColumn),
487  Q_ARG(QVariantMap, empty));
488 
490 }
491 
493  qint64 recordCount,
494  bool forward)
495 {
497 
498  if(m_motionLock)
499  throw ZblException("ZLogViewport::loadRecordByIndex - can't load "
500  "viewport while background operation in progress.");
501 
502  qint64 seekIndex;
503 
504  const int rowCount = m_model->rowCount();
505 
506  if(!rowCount)
507  {
508  zWarning() << "Can't move zero length viewport.";
509  return;
510  }
511  else if(forward)
512  {
513  seekIndex = getNextPageLocation();
514  }
515  else
516  {
517  seekIndex = getCurrentLocation();
518  }
519 
520  ZblLogSearchParams searchParams = getSearchParameters();
521 
522  const bool loadMarkupColumn = m_model->modelColumnCount() > 1;
523 
524  zDebug() << "Moving viewport, forward = " << forward
525  << ", recordCount = " << recordCount
526  << ", seekIndex = " << seekIndex;
527 
528  QMetaObject::invokeMethod(m_reader, "move",
529  Qt::QueuedConnection,
530  Q_ARG(QObject*, this),
531  Q_ARG(qint64, recordCount),
532  Q_ARG(qint64, seekIndex),
533  Q_ARG(bool, forward),
534  Q_ARG(ZblLogSearchParams, searchParams),
535  Q_ARG(bool, loadMarkupColumn));
536 
538 
539 }
540 
542 {
543  zDebug() << "ZLogViewport::markupText";
544 
545  if(m_currentSearch.isNull())
546  return false;
547 
548 
549  if(m_motionLock)
550  {
551  zDebug() << "Programming error - Can't search while background "
552  "operation is in progress.";
553 
554  return false;
555  }
556 
557  setLock(true);
558 
559  //TBD: don't search if a search is already in progress
560  // validate roles exist in viewport model
561  // validate type
562  // validate phrase
563 
564  ZblLogSearchParams searchParams(getSearchParameters());
565 
566  connect(m_currentSearch->getSearcher(), &ZblLogBkSearch::markupUpdated,
568 
569  QMetaObject::invokeMethod(m_currentSearch->getSearcher(), "markupViewport",
570  Qt::QueuedConnection,
571  Q_ARG(QObject*, this),
572  Q_ARG(ZblLogSearchParams, searchParams));
573 
574  zDebug() << "ZLogViewport::markupText returning";
575 
576  return true;
577 }
578 
579 
581  QList<int> roles,
582  QString searchPhrase,
583  int type)
584 {
585  zDebug() << "ZLogViewport::markupText roles="
586  << roles << "; phrase="
587  << searchPhrase << "; type=" << type;
588 
589  if(m_currentSearch.isNull())
590  return false;
591 
592 
593  if(m_motionLock)
594  {
595  zDebug() << "Programming error - Can't search while background "
596  "operation is in progress.";
597 
598  return false;
599  }
600 
601  setLock(true);
602 
603  //TBD: don't search if a search is already in progress
604  // validate roles exist in viewport model
605  // validate type
606  // validate phrase
607 
608  //QObject* funky = NULL;
609 
610  //ZblLogSearchParams searchParams(getSearchParameters());
611 
612  //QObject* searcher = m_currentSearch->getSearcher();
613 
614  connect(m_currentSearch->getSearcher(), &ZblLogBkSearch::markupUpdated,
616 
617  ZblLogSearchParams searchParams(
618  ZblLogSearch::SearchDirectionForward, 0, roles, searchPhrase, type);
619 
620  QMetaObject::invokeMethod(m_currentSearch->getSearcher(), "markupViewport",
621  Qt::QueuedConnection,
622  Q_ARG(QObject*, this),
623  Q_ARG(ZblLogSearchParams, searchParams));
624 
625  zDebug() << "ZLogViewport::markupText returning";
626 
627  return true;
628 }
629 
631 {
632  zDebug() << "ZLogViewport::onMarkupCompleted";
633 
634  if(viewport != this)
635  {
636  zDebug() << "Not mine! viewport=" << viewport << "; this=" << this;
637 
638  return;
639  }
640 
641  m_searchLinks = rowsFound;
642 
644 
645  setLock(false);
646 
647  emit markupUpdated();
648 }
649 
650 
651 
653  qint64 modelRow,
654  QList<int> modelRoles,
655  QList<QString> markupText)
656 {
657 
658  if(!m_currentSearch)
659  return;
660 
661  zDebug() << "Search row matched - row =" << modelRow << ", modelRoles ="
662  << modelRoles << ", markupText =" << markupText;
663 
664  const int nextRecordID = m_model->getValue(ZblLogManager::LogFieldRecordNum, modelRow).toInt();
665  const int nextSeekPos = m_model->getValue(m_roleSeekIndex, modelRow).toInt();
666 
667  m_currentSearch->insertMark(nextRecordID, nextRecordID, nextSeekPos);
668 
669  // TBD: update reclinkmodel here!!!
670 
671  //m_reclinks.insertLink(nextRecordID, nextSeekPos, "hello world" );
672 
673 
674  for(int i=0; i < modelRoles.size(); i++)
675  {
676  int nextRole = modelRoles.at(i);
677 
678  m_currentSearch->addRoleFound(nextRole);
679 
680  m_model->putValue(nextRole, modelRow, 1, markupText.at(i));
681  }
682 
683 }
684 
685 void ZLogViewport::onSearchDeleteRequested(QObject* searchObject)
686 {
687 #if 0
688  ZLogSearch* search = qobject_cast<ZLogSearch*>(searchObject);
689 
690  if(!search)
691  zWarning() << "Invalid object passed to method. Object should be of "
692  "class Zbl::ZLogSearch";
693 
694  if(m_currentSearch == search)
695  {
696  zDebug() << "Releasing current search: " << search;
697 
698  QList<int> roles;
699  m_currentSearch = getZReader()->getSearch("",0,roles);
700  }
701 #endif
702 }
703 
704 
706 {
708 }
709 
711 {
713 }
714 
716 {
718 }
719 
721 {
722  return m_model->getValue(m_roleSeekIndex, 0).toLongLong();
723 }
724 
726 {
727  return -1;
728 }
729 
731 {
732  return -1;
733 }
734 
736 {
737  return -1;
738 }
739 
741 {
742  const qint64 rowCount = m_model->rowCount();
743 
744  if(!rowCount)
745  {
746  zWarning() << "Zero length viewport.";
747  return 0;
748  }
749 
750  const qint64 lastRow = rowCount - 1;
751  qint64 seekIndex = m_model->getValue(m_roleSeekIndex, lastRow).toInt();
752  seekIndex += m_model->getValue(m_roleByteCount, lastRow).toInt();
753  return seekIndex;
754 
755 }
756 
757 
758 
759 
760 
761 } // Zbl
qint64 getActiveLocation()
void onMarkupCompleted(ZLogViewport *viewport, ZblLogSearchList rowsFound)
Connected to the ZblLogBkSearch::markupUpdatred signal.
static int m_roleByteCount
Role number of the byte count value in the log record data model.
Definition: ZLogViewport.h:764
ZTableModel * m_model
The data model that receives the viewport&#39;s log records.
Definition: ZLogViewport.h:702
void putRecordSize(int size)
Set the average log record size ZLogViewport will use when calculating memory buffer sizes...
static const qint64 m_maximumRecordSize
The maximum record size ZLogViewport will use. Currently 65536 bytes.
Definition: ZLogViewport.h:743
Q_INVOKABLE void move(qint64 recordCount, bool forward)
Moves the viewport forward or backwards. This method is asynchronous.
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
QAbstractTableModel override.
Definition: ZTableModel.cpp:65
static int m_roleSeekIndex
Role number of the seek index value in the log record data model.
Definition: ZLogViewport.h:756
bool m_motionLock
Flag prevents viewport from being moved or updated during background operations.
Definition: ZLogViewport.h:791
static int getByteCountRole()
Obtain the role number for the byte count of a log record in the viewport&#39;s log record data model...
This class performs log file I/O operations and JSON parsing in a background thread on behalf of a ZL...
Definition: ZblLogReader.h:91
QObject * getCurrentSearch()
Obtains a javascript wrapper for the current search object for this viewport.
int getRecordSize()
Obtain the average log record size ZLogViewport will use when calculating memory buffer sizes...
A QML type that manages reading JSON formatted Zuble log files. QML programs create using Zbl...
Definition: ZLogReader.h:62
void markupUpdated(ZLogViewport *viewport, ZblLogSearchList rowsFound)
Sent when a viewport&#39;s markeup data (model column 1) has been updated.
Q_INVOKABLE void loadRecords(qint64 seekPosition, qint64 recordCount)
Loads a consecutive set of log records from the log file into the viewport.
zblLogReaderPtr m_reader
The background worker object that reads and parses the viewport&#39;s log file. This value must not be nu...
Definition: ZLogViewport.h:709
#define Z_FAC_JS
Definition: zglobal.h:123
void onRowMatched(qint64 modelRow, QList< int > modelRoles, QList< QString > markupText)
Connected to the rowMatched signal to update encapsulated ZLogSearch and ZLogMapModel objects when se...
void onUpdateBookmarks()
Signal handler for ZLogReader::updateLogMarks signal.
qint64 getRecordModelRow(qint64 recordID)
Obtain the index position for the specified log record in the model.
ZLogReader * getZReader()
Obtains the ZLogReader object that is the parent of this ZLogViewport object.
void onSearchDeleteRequested(QObject *searchObject)
Handler for ZLogReader::searchDeleteRequested signal.
bool markupText()
Marks up text in the viewport&#39;s data model asynchronously using the current search parameters...
void insertMark(qint64 recordID, qint64 lastRecordID, qint64 seekPosition)
Creates a new log mark in the database.
Definition: ZLogMap.cpp:147
Q_INVOKABLE void putValue(int role, int row, const QVariant &value)
Sets the value of the specified cell in the data set.
This class allows Zuble log file viewer text search operations to pass parameters between threads...
static int getBookmarksRole()
Obtain the role number for the bookmark data of a log record in the viewport&#39;s log record data model...
Maintains a list of log record links pertaining to a specific log file.
Definition: ZLogMap.h:28
ZLogViewport * m_listener
Companion ZLogViewport object to receive forwarded signals. Value may be null.
Definition: ZLogViewport.h:802
Q_INVOKABLE void truncate(int rowCount, bool removeFromFront=false)
#define ZBL_REGISTER_LOGGED_OBJECT
Definition: zglobal.h:104
void invalidateModel()
Resets the model.
A wrapper for the explicitly shared ZblLogSearch object.
Definition: ZLogSearch.h:18
qint64 m_assumeRecordSize
The viewport will assume log records average this number of bytes (including JSON formating character...
Definition: ZLogViewport.h:731
void bookmarksUpdated()
Sent when the master log mark database has been updated.
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.
ZTableModel * getZModel()
Returns the data model containing the viewport&#39;s log records.
bool setCurrentSearch(QObject *search)
Sets this viewport&#39;s current search object.
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
A log viewport encapsulates a ZTableModel containing a contiguous subset of log records from a Zuble ...
Definition: ZLogViewport.h:95
void setListener(ZLogViewport *listener)
Definition: ZAndGate.cpp:6
ZLogViewport * getListener() const
static int m_roleBookmarks
Role number of the bookmarks value in the log record data model.
Definition: ZLogViewport.h:772
void markupUpdated()
Sent when search has completed marking up viewport model data.
#define ZBL_SLOT_BEGIN_TRY
Definition: zglobal.h:128
#define zLogMan
Definition: ZblLogManager.h:36
QStringList getBookmarkNames(qint64 recordID)
Obtains a list of bookmark names for the specified log record.
Definition: ZLogReader.cpp:657
#define ZBL_DEFINE_LOGGED_OBJECT(class_name)
Definition: zglobal.h:99
qint64 getRecordSeekPos(qint64 recordID)
Obtain the file seek position for the specified log record ID from model data in the viewport...
ZLogViewport(ZblLogReader *reader, qint64 recordCount, QObject *parent=0, bool background=false)
Viewport constructor.
ZLogMap * m_selectionMap
A log mark map that holds the current selection for this viewport.
Definition: ZLogViewport.h:779
#define zWarning()
Definition: zglobal.h:111
This two dimensional table model is used to store and manipulate data.
Definition: ZTableModel.h:96
qint64 getMaxRecordCount()
Returns the number of log records the viewport data model will attempt to hold.
#define ZBL_SLOT_END_VOID(facility, code, error_message)
Definition: zglobal.h:134
QSharedPointer< ZblLogSearch > zblLogSearchPtr
Definition: ZblLogSearch.h:681
MarkType
Types of log maps: Invalid, Selection, Search, Bookmark.
Definition: ZLogMap.h:42
ZBL_DECLARE_LOGGED_OBJECT ZblLogSearchParams getSearchParameters()
A Qt log category for this class.
QObject * getModel()
Obtains the log viewport&#39;s data model which contains a contiguous subset of rows from the log file...
qint64 getNextPageLocation()
#define zDebug()
Definition: zglobal.h:113
zblLogSearchPtr getZSearch()
Obtains the current search log map for this viewport.
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
ZblLogSearchList m_searchLinks
A list of log record links for records in the viewport that satisfy the current search criteria...
Definition: ZLogViewport.h:822
Q_INVOKABLE void setColumnCount(int count)
Sets the number of columns the table will contain. This method may block the current thread...
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.
int m_timerID
ID for the viewport&#39;s event timer.
Definition: ZLogViewport.h:748
qint64 getCurrentLocation()
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&#39;s log record data m...
Zuble&#39;s Qt Exception Object.
Definition: ZblException.h:45
QObject * getReader()
Obtains the ZLogReader object that is the parent of this ZLogViewport object.
QObject * getCurrentSearchlinks()
Obtain a data model containing the log record links for the current search.
void setLock(bool locked)
Sets or clears the viewport motion lock.
QSharedPointer< ZblLogSearch > m_search
Definition: ZLogSearch.h:156
qint64 m_optimalCount
Identifies the first record in the viewport.
Definition: ZLogViewport.h:722
Q_INVOKABLE bool addRole(int roleNumber)
Adds the specified role to the data model. This method may block the current thread.
QSharedPointer< ZblLogSearch > getZSearch()
Definition: ZLogSearch.cpp:12
static const qint64 m_minimumRecordSize
The minimum record size ZLogViewport will use. Currently 1024 bytes.
Definition: ZLogViewport.h:737
zblLogSearchPtr m_currentSearch
A log mark map that holds the current search results for this viewport.
Definition: ZLogViewport.h:786
static void registerType()
Registers ZLogViewport as a QML type.
QObject * getSelection()
Obtains the selection log mark map for this viewport. Each viewport has its own selection.
virtual void timerEvent(QTimerEvent *event)
Timer is used to flush excess log records from the log record buffer.
bool locked
True if the viewport is locked for scanning, false otherwise.
Definition: ZLogViewport.h:193
QObject * getCurrentBookmarklinks()
Obtain a data model containing the log record links for the current bookmark. [TBD: does this even ma...
Q_INVOKABLE int modelColumnCount() const
Returns the number of columns in the data set. This method may block the current thread.