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 ()
treenodegetnode (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 26 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 26 of file subtreeproxy.cpp.

27{
28}

Member Function Documentation

◆ ApplyDefaultFilter()

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

Definition at line 166 of file subtreeproxy.cpp.

168{
169 Q_UNUSED ( source_row )
170 Q_UNUSED ( source_parent )
171
172 return true;
173}

◆ ApplyUserFilter()

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

Process classes

Process objects

Definition at line 175 of file subtreeproxy.cpp.

177{
178 dbe::models::tree * srcmodel = static_cast<tree *> ( sourceModel() );
179
180 QModelIndex const & nodeindex = srcmodel->index ( source_row, 0, source_parent );
181 treenode * tofilter = srcmodel->getnode ( nodeindex );
182 QString const nodename = srcmodel->data ( nodeindex ).toString();
183
184 if ( not source_parent.isValid() )
185 {
187
188 for ( QString const & admissible : this_window_config.GraphicalClassesList )
189 {
190 GraphicalClass candidate = confaccessor::guiconfig()->graphical (
191 admissible.toStdString() );
192
193 if ( candidate.DatabaseClassName == nodename
194 or candidate.DerivedClasses.contains ( nodename ) )
195 {
196 return true;
197 }
198 }
199 }
200 else if ( dynamic_cast<ObjectNode *> ( tofilter ) )
201 {
202 return true;
203 }
204 else if ( dynamic_cast<RelationshipNode *> ( tofilter ) )
205 {
207 QString const related = sourceModel()->data ( nodeindex.parent().parent() ).toString();
208
209 for ( QString const & admissible : this_window_config.GraphicalClassesList )
210 {
211 GraphicalClass candidate = confaccessor::guiconfig()->graphical (
212 admissible.toStdString() );
213
214 if ( candidate.DatabaseClassName == related or candidate.DerivedClasses.contains (
215 related ) )
216 {
217 return candidate.ShowAllRelationships or candidate.Relationships.contains ( nodename );
218 }
219
220 }
221 }
222
223 return false;
224}
static cptr< ui::config::info > guiconfig()
QVariant data(const type_index &index, int role=Qt::DisplayRole) const override
Definition tree.cpp:121
type_datum * getnode(const type_index &index) const override
Definition tree.cpp:321
type_index index(int row, int column, const type_index &parent) const override
Definition tree.cpp:37

◆ check_view_type()

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

Definition at line 79 of file subtreeproxy.cpp.

80{
82 this_gui_windowname.toStdString() );
83
84 if ( this_window_config.Title.isEmpty() )
85 {
87 }
88}

◆ filterAcceptsRow()

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

Definition at line 36 of file subtreeproxy.cpp.

38{
40 {
41 return ApplyDefaultFilter ( source_row, source_parent );
42 }
43 else
44 {
45 return ApplyUserFilter ( source_row, source_parent );
46 }
47}
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 134 of file subtreeproxy.cpp.

135{
136 QModelIndex sourceParent = mapToSource ( index );
137 dbe::models::tree * my = dynamic_cast<dbe::models::tree *> ( sourceModel() );
138
139 if ( my )
140 {
141 return my->getnode ( sourceParent );
142 }
143
144 return nullptr;
145}

◆ lessThan()

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

Definition at line 49 of file subtreeproxy.cpp.

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

◆ LoadClasses()

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

Definition at line 90 of file subtreeproxy.cpp.

91{
92 if ( this_apply_default_filter == false )
93 {
94 for ( QString const & i : this_window_config.GraphicalClassesList )
95 {
96 GraphicalClass Class = confaccessor::guiconfig()->graphical ( i.toStdString() );
97 QStringList ClassList = Class.DerivedClasses;
98 ClassList.append ( Class.DatabaseClassName );
99
100 for ( QString & ClassName : ClassList )
101 {
102 treenode * ClassNode = confaccessor::gethandler()->getnode ( ClassName );
103
104 if ( ClassNode )
105 {
106 dbe::models::tree * UnderlyingModel =
107 static_cast<dbe::models::tree *> ( sourceModel() );
108 QModelIndex ParentIndex = UnderlyingModel->getindex ( ClassNode );
109
110 if ( sourceModel()->canFetchMore ( ParentIndex ) ) sourceModel()->fetchMore (
111 ParentIndex );
112 }
113 }
114 }
115 }
116}
static cptr< datahandler > gethandler()
type_index getindex(treenode *NodeItem, type_index const &RootIndex=QModelIndex()) const
Definition tree.cpp:291

◆ ResetModel()

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

Definition at line 30 of file subtreeproxy.cpp.

31{
32 beginResetModel();
33 endResetModel();
34}

◆ 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 67 of file subtreeproxy.hpp.

◆ this_default_filter

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

Definition at line 64 of file subtreeproxy.hpp.

◆ this_gui_windowname

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

Definition at line 63 of file subtreeproxy.hpp.

◆ this_window_config

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

Definition at line 65 of file subtreeproxy.hpp.


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