GroupBox.cpp
Go to the documentation of this file.
1 #include "GroupBox.h"
2 
3 #include <QCheckBox>
4 #include <QGuiApplication>
5 #include <QHBoxLayout>
6 #include <QScreen>
7 #include <QSplitter>
8 #include <QVBoxLayout>
9 
10 
12 {
13 
15  {
16  QVBoxLayout* layout = new QVBoxLayout();
17  this->setLayout(layout);
18 
19  QSplitter* splitter = new QSplitter(Qt::Orientation::Vertical);
20  layout->addWidget(splitter);
21 
22  this->setTitle("Memory");
23  int margin = 3;
24  this->layout()->setContentsMargins(margin, margin, margin, margin);
25 
26 
27  _tree = new armem::gui::MemoryTreeWidget();
28 
29 
30  _memoryTabWidget = new QTabWidget();
31  _memoryTabGroup = new QGroupBox("Queries, Predictions and Commits");
32  _memoryTabGroup->setLayout(new QVBoxLayout());
33 
34  margin = 0;
35  _memoryTabGroup->setContentsMargins(margin, margin, margin, margin);
36  _memoryTabGroup->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Maximum);
37 
38  {
39  _queryWidget = new armem::gui::QueryWidget();
40  _queryWidget->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Maximum);
41 
42  _memoryTabWidget->addTab(_queryWidget, QString("Query Settings"));
43  }
44  {
45  _snapshotSelectorWidget = new armem::gui::SnapshotSelectorWidget();
46  _snapshotSelectorWidget->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Maximum);
47 
48  _memoryTabWidget->addTab(_snapshotSelectorWidget, QString("Snapshot Selection"));
49  }
50  {
51  _predictionWidget = new armem::gui::PredictionWidget(std::move(entityInfoRetriever));
52  _predictionWidget->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Maximum);
53 
54  _memoryTabWidget->addTab(_predictionWidget, QString("Prediction"));
55  }
56  {
57  _commitWidget = new armem::gui::CommitWidget();
58  _commitWidget->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Maximum);
59 
60  _memoryTabWidget->addTab(_commitWidget, QString("Commit"));
61  }
62 
63  _memoryTabGroup->layout()->addWidget(_memoryTabWidget);
64 
65  splitter->addWidget(_tree);
66  splitter->addWidget(_memoryTabGroup);
67  // Prevent QueryGroup from growing.
68  const int largeHeight = QGuiApplication::primaryScreen()->size().height();
69  splitter->setSizes({largeHeight, 1});
70  }
71 
73  {
74  return _queryWidget;
75  }
76 
77  QGroupBox* GroupBox::queryGroup() const
78  {
79  return _memoryTabGroup;
80  }
81 
83  {
84  return _snapshotSelectorWidget;
85  }
86 
88  {
89  return _predictionWidget;
90  }
91 
93  {
94  return _commitWidget;
95  }
96 
98  {
99  return _tree;
100  }
101 
103  {
104  armem::client::query::Builder queryBuilder(_queryWidget->dataMode());
105  queryBuilder
106  .coreSegments().all()
107  .providerSegments().all()
108  .entities().all()
109  .snapshots(_snapshotSelectorWidget->selector());
110 
111  return queryBuilder.buildQueryInput();
112  }
113 
114 } // namespace armarx::armem::gui::memory
armarx::armem::client::query::EntitySelector::all
EntitySelector & all() override
Definition: selectors.cpp:96
armarx::armem::gui::CommitWidget
Definition: CommitWidget.h:15
armarx::armem::gui::memory
Definition: GroupBox.cpp:11
armarx::armem::client::query::ProviderSegmentSelector::entities
EntitySelector & entities()
Start specifying entities.
Definition: selectors.cpp:123
armarx::armem::gui::memory::GroupBox::queryGroup
QGroupBox * queryGroup() const
Definition: GroupBox.cpp:77
armarx::armem::gui::QueryWidget
Definition: QueryWidget.h:19
armarx::armem::gui::memory::GroupBox::snapshotSelectorWidget
SnapshotSelectorWidget * snapshotSelectorWidget() const
Definition: GroupBox.cpp:82
armarx::splitter
std::vector< std::string > splitter(std::string const &propertyValue)
Definition: ResultImageFuser.h:44
armarx::armem::client::query::Builder::buildQueryInput
QueryInput buildQueryInput() const
Definition: Builder.cpp:11
armarx::armem::client::query::EntitySelector::snapshots
SnapshotSelector & snapshots()
Start specifying entity snapshots.
Definition: selectors.cpp:86
armarx::armem::gui::memory::GroupBox::queryInput
armem::client::QueryInput queryInput() const
Definition: GroupBox.cpp:102
armarx::armem::gui::memory::TreeWidget
Definition: TreeWidget.h:15
armarx::armem::client::query::CoreSegmentSelector::all
CoreSegmentSelector & all() override
Definition: selectors.cpp:170
armarx::armem::gui::memory::GroupBox::GroupBox
GroupBox(PredictionWidget::GetEntityInfoFn &&entityInfoRetriever)
Definition: GroupBox.cpp:14
armarx::armem::gui::MemoryTreeWidget
memory::TreeWidget MemoryTreeWidget
Definition: TreeWidget.h:110
armarx::armem::gui::SnapshotSelectorWidget
Widget where queries for snapshots can be configured.
Definition: SnapshotSelectorWidget.h:28
armarx::armem::gui::memory::GroupBox::queryWidget
QueryWidget * queryWidget() const
Definition: GroupBox.cpp:72
armarx::armem::client::query::Builder::coreSegments
CoreSegmentSelector & coreSegments()
Start specifying core segments.
Definition: Builder.cpp:38
armarx::armem::gui::memory::GroupBox::predictionWidget
PredictionWidget * predictionWidget() const
Definition: GroupBox.cpp:87
armarx::armem::client::QueryInput
A query for parts of a memory.
Definition: Query.h:23
GroupBox.h
armarx::armem::gui::PredictionWidget::GetEntityInfoFn
std::function< EntityInfo(const MemoryID &)> GetEntityInfoFn
Definition: PredictionWidget.h:57
armarx::armem::gui::PredictionWidget
Definition: PredictionWidget.h:47
armarx::armem::gui::SnapshotSelectorWidget::selector
client::query::SnapshotSelector selector()
Definition: SnapshotSelectorWidget.cpp:14
armarx::armem::client::query::Builder
The query::Builder class provides a fluent-style specification of hierarchical queries.
Definition: Builder.h:22
armarx::armem::client::query::CoreSegmentSelector::providerSegments
ProviderSegmentSelector & providerSegments()
Start specifying provider segments.
Definition: selectors.cpp:160
armarx::armem::client::query::ProviderSegmentSelector::all
ProviderSegmentSelector & all() override
Definition: selectors.cpp:133
armarx::armem::gui::memory::GroupBox::tree
TreeWidget * tree() const
Definition: GroupBox.cpp:97
armarx::armem::gui::QueryWidget::dataMode
armem::query::DataMode dataMode() const
Definition: QueryWidget.cpp:196
armarx::armem::gui::memory::GroupBox::commitWidget
CommitWidget * commitWidget() const
Definition: GroupBox.cpp:92