API Documentation
Loading...
Searching...
No Matches
ReportIterator.h
Go to the documentation of this file.
1#pragma once
2#include "DLLInfo.h"
3#include <NDEVR/WidgetIterator.h>
4#include <NDEVR/TranslatedString.h>
5#include <NDEVR/BaseValues.h>
6#include <NDEVR/UUID.h>
7#include <NDEVR/String.h>
8#include <NDEVR/JSONNode.h>
9#include <QSize>
10#include <QRect>
11class QWidget;
12class QMenu;
13namespace NDEVR
14{
15 class JSONNode;
16 class QTModelManager;
17 class File;
18 class Model;
20 {
24 ReportTemplate(const String& id, File resource);
25 ReportTemplate(const String& id, const String& base_64);
26 };
28 {
32 JSONNode& templateRoot();
33 void addProjectUnits();
34 void setTemplate(const ReportTemplate& report_template, JSONNode& node);
35 };
37 {
38 public:
39 ReportHandler(const TranslatedString& name, const TranslatedString& description, const String& icon)
40 : m_name(name)
41 , m_description(description)
42 , m_icon(icon)
43 {}
44 virtual ~ReportHandler() {};
45 const TranslatedString& name() const { return m_name; }
46 const TranslatedString& description() const { return m_description; }
47 const String& icon() const { return m_icon; }
48 //Given a list of model objects, returns report IDs it requests to handle. Note report ID's can be Model IDs, or unique to this object.
49 //Returned IDs will be stored, then used with canHandle, getReport, and createReportJSON
51
52 virtual QMenu* popupOptions() const { return nullptr; }
53 //Returns true if report can handle this ID
54 virtual bool canHandle(UUID, QTModelManager*) const { return false; };
55
56 //Can be nullptr if cannot generate report
57 virtual QWidget* getReport(const UUID&, QTModelManager*, const QRect&) const { return nullptr; };
58
59 //Allowed to be no-op. Given root parent node, create nodes that contain information for report
60 virtual void createReportJSON(const UUID&, JSONNode&, ReportJSONMaker&) const {};
61
62 virtual UUID id() const { return UUID::CreateUUID(m_name.translationID()); }
63 virtual bool defaultEnabled() const { return m_default_enabled; }
64 protected:
68 bool m_default_enabled = true;
69 };
70
72 {
73 public:
76 ReportIterator(const Buffer<const ReportHandler*>& reports, const Buffer<UUID>& objects_to_report, QTModelManager* manager);
77 QWidget* getReport(uint04 report_index) const override;
78 void setObjectsToReport(const Buffer<UUID>& objects_to_report);
79 void updateAvailableReports();
80 JSONNode createJSONNode() const;
81 void saveReportMetaData(const File& file) const;
82 void setReportHandlers(const Buffer<const ReportHandler*>& handlers);
83 virtual bool canHandle(UUID model_id, QTModelManager*);
84 const Buffer<const ReportHandler*>& reportHandlers() { return m_report_handlers; };
85 protected:
86 void sortIDs();
87 protected:
92 };
93
95 {
96 public:
97 static void RegisterReportHandler(const ReportHandler* handler);
98 static const Buffer<const ReportHandler*>& ReportHandlers() { return s_report_handlers; };
99 protected:
101 };
102}
#define NDEVR_API
Definition DLLInfo.h:67
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition File.h:47
JavaScript Object Notation or JSON is an open - standard file format that uses human - readable text ...
Definition JSONParser.h:121
Definition QTModelManager.h:94
Definition ReportIterator.h:37
TranslatedString m_description
Definition ReportIterator.h:66
ReportHandler(const TranslatedString &name, const TranslatedString &description, const String &icon)
Definition ReportIterator.h:39
virtual QWidget * getReport(const UUID &, QTModelManager *, const QRect &) const
Definition ReportIterator.h:57
String m_icon
Definition ReportIterator.h:67
virtual ~ReportHandler()
Definition ReportIterator.h:44
const TranslatedString & description() const
Definition ReportIterator.h:46
virtual Buffer< UUID > defaultReportIDs(const Buffer< UUID > &, QTModelManager *) const
Definition ReportIterator.h:50
const String & icon() const
Definition ReportIterator.h:47
TranslatedString m_name
Definition ReportIterator.h:65
virtual void createReportJSON(const UUID &, JSONNode &, ReportJSONMaker &) const
Definition ReportIterator.h:60
virtual UUID id() const
Definition ReportIterator.h:62
virtual QMenu * popupOptions() const
Definition ReportIterator.h:52
virtual bool canHandle(UUID, QTModelManager *) const
Definition ReportIterator.h:54
virtual bool defaultEnabled() const
Definition ReportIterator.h:63
const TranslatedString & name() const
Definition ReportIterator.h:45
Definition ReportIterator.h:72
Buffer< UUID > m_objects_to_report
Definition ReportIterator.h:88
Buffer< std::pair< const ReportHandler *, UUID > > m_report_objects
Definition ReportIterator.h:89
Buffer< const ReportHandler * > m_report_handlers
Definition ReportIterator.h:91
QTModelManager * m_manager
Definition ReportIterator.h:90
const Buffer< const ReportHandler * > & reportHandlers()
Definition ReportIterator.h:84
Definition ReportIterator.h:95
static Buffer< const ReportHandler * > s_report_handlers
Definition ReportIterator.h:100
static const Buffer< const ReportHandler * > & ReportHandlers()
Definition ReportIterator.h:98
Definition String.h:40
Definition TranslatedString.h:9
Definition UUID.h:66
Definition WidgetIterator.h:11
Definition ACIColor.h:37
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120
Definition ReportIterator.h:28
JSONNode root
Definition ReportIterator.h:30
QTModelManager * manager
Definition ReportIterator.h:29
Definition ReportIterator.h:20
File file
Definition ReportIterator.h:23
String id
Definition ReportIterator.h:21
String base_64
Definition ReportIterator.h:22