DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dbe::models::subtree_proxy Class Reference

#include <subtreeproxy.hpp>

Inheritance diagram for dbe::models::subtree_proxy:
[legend]
Collaboration diagram for dbe::models::subtree_proxy:
[legend]

Public Member Functions

 subtree_proxy (const QString &Name, const QStringList &Default, QObject *parent=nullptr)
 Including DBE.
 ~subtree_proxy ()
void ResetModel ()
void check_view_type ()
void LoadClasses ()
treenode * getnode (const QModelIndex &index) const
Public Member Functions inherited from dbe::TreeModelInterface
virtual ~TreeModelInterface ()=default
Public Member Functions inherited from dbe::model_common_impl< subtree_proxy >
bool delete_objects (type_indices::iterator, type_indices::iterator) override
bool update_objects (type_indices::iterator, type_indices::iterator) override
bool create_objects (type_indices::iterator, type_indices::iterator) override
Public Member Functions inherited from dbe::model_common_interface
virtual ~model_common_interface ()=default
Public Member Functions inherited from dbe::model_initiate_actions_interface
virtual ~model_initiate_actions_interface ()=default
Public Member Functions inherited from dbe::model_common_data_access_interface
virtual type_object_ref getobject (type_index const &index) const =0
virtual type_class_info getclass (type_index const &index) const =0
virtual QAbstractItemModel * ReturnSourceModel () const =0
virtual ~model_common_data_access_interface ()=default
Public Member Functions inherited from dbe::model_common_async_operations< subtree_proxy >
MODEL_COMMON_TYPES_TOPLEVEL_DEFINITIONS model_common_async_operations ()
void model_common_connections ()

Protected Member Functions

bool filterAcceptsRow (int source_row, const QModelIndex &source_parent) const
bool lessThan (const QModelIndex &left, const QModelIndex &right) const
Protected Member Functions inherited from dbe::model_common_interface
virtual void remove_deleted_object (type_index const &index)=0
virtual void rename_contained_object (type_index const &index, type_object_info const &obj)=0
virtual void update_contained_object (type_index const &index, type_object_info const &obj)=0
virtual void create_contained_object (type_index const &index, type_object_info const &obj)=0
virtual type_index lookup (type_object_info const &)=0
QUuid getuuid () const
Protected Member Functions inherited from dbe::model_common_async_operations< subtree_proxy >
void remove_object (type_object_info const &)
void create_object (type_object_info const &)
void rename_object (type_object_info const &)
void update_object (type_object_info const &)
void update_multiple_objects (std::vector< type_object_info > const &)

Private Slots

void slot_create_object (QString const &src, dref const &obj)
void slot_remove_object (QString const &src, dref const &obj)
void slot_update_object (QString const &src, dref const &obj)
void slot_rename_object (QString const &src, dref const &obj)

Private Member Functions

bool ApplyDefaultFilter (int source_row, const QModelIndex &source_parent) const
bool ApplyUserFilter (int source_row, const QModelIndex &source_parent) const

Private Attributes

QString this_gui_windowname
QStringList this_default_filter
Window this_window_config
bool this_apply_default_filter

Detailed Description

Definition at line 24 of file subtreeproxy.hpp.

Constructor & Destructor Documentation

◆ subtree_proxy()

dbe::models::subtree_proxy::subtree_proxy ( const QString & Name,
const QStringList & Default,
QObject * parent = nullptr )
explicit

Including DBE.

Definition at line 14 of file subtreeproxy.cpp.

◆ ~subtree_proxy()

dbe::models::subtree_proxy::~subtree_proxy ( )

Definition at line 24 of file subtreeproxy.cpp.

24{}

Member Function Documentation

◆ ApplyDefaultFilter()

bool dbe::models::subtree_proxy::ApplyDefaultFilter ( int source_row,
const QModelIndex & source_parent ) const
private

Definition at line 153 of file subtreeproxy.cpp.

154{
155 Q_UNUSED(source_row)
156 Q_UNUSED(source_parent)
157
158 return true;
159}

◆ ApplyUserFilter()

bool dbe::models::subtree_proxy::ApplyUserFilter ( int source_row,
const QModelIndex & source_parent ) const
private

Process classes

Process objects

Definition at line 162 of file subtreeproxy.cpp.

163{
164 dbe::models::tree* srcmodel = static_cast<tree*>(sourceModel());
165
166 QModelIndex const& nodeindex = srcmodel->index(source_row, 0, source_parent);
167 treenode* tofilter = srcmodel->getnode(nodeindex);
168 QString const nodename = srcmodel->data(nodeindex).toString();
169
170 if (not source_parent.isValid()) {
172
173 for (QString const& admissible : this_window_config.GraphicalClassesList) {
174 GraphicalClass candidate = confaccessor::guiconfig()->graphical(admissible.toStdString());
175
176 if (candidate.DatabaseClassName == nodename or candidate.DerivedClasses.contains(nodename)) {
177 return true;
178 }
179 }
180 } else if (dynamic_cast<ObjectNode*>(tofilter)) {
181 return true;
182 } else if (dynamic_cast<RelationshipNode*>(tofilter)) {
184 QString const related = sourceModel()->data(nodeindex.parent().parent()).toString();
185
186 for (QString const& admissible : this_window_config.GraphicalClassesList) {
187 GraphicalClass candidate = confaccessor::guiconfig()->graphical(admissible.toStdString());
188
189 if (candidate.DatabaseClassName == related or candidate.DerivedClasses.contains(related)) {
190 return candidate.ShowAllRelationships or candidate.Relationships.contains(nodename);
191 }
192 }
193 }
194
195 return false;
196}
static cptr< ui::config::info > guiconfig()
QVariant data(const type_index &index, int role=Qt::DisplayRole) const override
Definition tree.cpp:106
type_datum * getnode(const type_index &index) const override
Definition tree.cpp:306
type_index index(int row, int column, const type_index &parent) const override
Definition tree.cpp:35
QStringList GraphicalClassesList

◆ check_view_type()

void dbe::models::subtree_proxy::check_view_type ( )

Definition at line 72 of file subtreeproxy.cpp.

73{
75
76 if (this_window_config.Title.isEmpty()) {
78 }
79}

◆ filterAcceptsRow()

bool dbe::models::subtree_proxy::filterAcceptsRow ( int source_row,
const QModelIndex & source_parent ) const
protected

Definition at line 34 of file subtreeproxy.cpp.

35{
37 return ApplyDefaultFilter(source_row, source_parent);
38 } else {
39 return ApplyUserFilter(source_row, source_parent);
40 }
41}
bool ApplyDefaultFilter(int source_row, const QModelIndex &source_parent) const
bool ApplyUserFilter(int source_row, const QModelIndex &source_parent) const

◆ getnode()

dbe::treenode * dbe::models::subtree_proxy::getnode ( const QModelIndex & index) const
virtual

Implements dbe::TreeModelInterface.

Definition at line 121 of file subtreeproxy.cpp.

122{
123 QModelIndex sourceParent = mapToSource(index);
124 dbe::models::tree* my = dynamic_cast<dbe::models::tree*>(sourceModel());
125
126 if (my) {
127 return my->getnode(sourceParent);
128 }
129
130 return nullptr;
131}

◆ lessThan()

bool dbe::models::subtree_proxy::lessThan ( const QModelIndex & left,
const QModelIndex & right ) const
protected

Definition at line 44 of file subtreeproxy.cpp.

45{
46 if (left.parent() == QModelIndex() || left.parent().parent() == QModelIndex()) {
47 QVariant LeftData = sourceModel()->data(left);
48 QVariant RightData = sourceModel()->data(right);
49
50 switch (LeftData.type()) {
51 case QVariant::Bool:
52 case QVariant::UInt:
53 return (LeftData.toUInt() < RightData.toUInt());
54
55 case QVariant::Int:
56 return (LeftData.toInt() < RightData.toInt());
57
58 case QVariant::String:
59 return ((LeftData.toString()).compare(RightData.toString()) > 0);
60
61 default:
62 return false;
63 }
64
65 return true;
66 }
67
68 return false;
69}

◆ LoadClasses()

void dbe::models::subtree_proxy::LoadClasses ( )

Definition at line 82 of file subtreeproxy.cpp.

83{
84 if (this_apply_default_filter == false) {
85 for (QString const& i : this_window_config.GraphicalClassesList) {
86 GraphicalClass Class = confaccessor::guiconfig()->graphical(i.toStdString());
87 QStringList ClassList = Class.DerivedClasses;
88 ClassList.append(Class.DatabaseClassName);
89
90 for (QString& ClassName : ClassList) {
91 treenode* ClassNode = confaccessor::gethandler()->getnode(ClassName);
92
93 if (ClassNode) {
94 dbe::models::tree* UnderlyingModel = static_cast<dbe::models::tree*>(sourceModel());
95 QModelIndex ParentIndex = UnderlyingModel->getindex(ClassNode);
96
97 if (sourceModel()->canFetchMore(ParentIndex))
98 sourceModel()->fetchMore(ParentIndex);
99 }
100 }
101 }
102 }
103}
static cptr< datahandler > gethandler()
type_index getindex(treenode *NodeItem, type_index const &RootIndex=QModelIndex()) const
Definition tree.cpp:278

◆ ResetModel()

void dbe::models::subtree_proxy::ResetModel ( )

Definition at line 27 of file subtreeproxy.cpp.

28{
29 beginResetModel();
30 endResetModel();
31}

◆ slot_create_object

void dbe::models::subtree_proxy::slot_create_object ( QString const & src,
dref const & obj )
privateslot

◆ slot_remove_object

void dbe::models::subtree_proxy::slot_remove_object ( QString const & src,
dref const & obj )
privateslot

◆ slot_rename_object

void dbe::models::subtree_proxy::slot_rename_object ( QString const & src,
dref const & obj )
privateslot

◆ slot_update_object

void dbe::models::subtree_proxy::slot_update_object ( QString const & src,
dref const & obj )
privateslot

Member Data Documentation

◆ this_apply_default_filter

bool dbe::models::subtree_proxy::this_apply_default_filter
private

Definition at line 60 of file subtreeproxy.hpp.

◆ this_default_filter

QStringList dbe::models::subtree_proxy::this_default_filter
private

Definition at line 57 of file subtreeproxy.hpp.

◆ this_gui_windowname

QString dbe::models::subtree_proxy::this_gui_windowname
private

Definition at line 56 of file subtreeproxy.hpp.

◆ this_window_config

Window dbe::models::subtree_proxy::this_window_config
private

Definition at line 58 of file subtreeproxy.hpp.


The documentation for this class was generated from the following files: