25 auto* vlayout =
new QVBoxLayout();
26 auto* hlayout =
new QHBoxLayout();
29 _availableMemoriesGroupBox =
new QGroupBox(
"Available memories");
30 auto vboxlayout =
new QVBoxLayout();
31 vboxlayout->setMargin(1);
32 vboxlayout->setSizeConstraint(QLayout::SizeConstraint::SetMinAndMaxSize);
33 vboxlayout->setAlignment(Qt::AlignTop);
34 _de_selectMemoryServers =
new QPushButton(_selectText);
35 _de_selectMemoryServers->setEnabled(
false);
36 vboxlayout->addWidget(_de_selectMemoryServers);
37 _availableMemoriesGroupBox->setLayout(vboxlayout);
40 _availableMemoriesScrollArea =
new QScrollArea();
41 _availableMemoriesScrollArea->setWidget(_availableMemoriesGroupBox);
42 _availableMemoriesScrollArea->setWidgetResizable(
true);
44 hlayout->addWidget(_availableMemoriesScrollArea);
47 QFrame* vFrame =
new QFrame;
48 vFrame->setFrameShape(QFrame::VLine);
49 hlayout->addWidget(vFrame);
52 _additionalSettingsGroupBox =
new QGroupBox(
"Additional query settings");
53 auto vboxlayout =
new QVBoxLayout();
54 vboxlayout->setMargin(1);
55 vboxlayout->setSizeConstraint(QLayout::SizeConstraint::SetMinAndMaxSize);
56 vboxlayout->setAlignment(Qt::AlignTop);
57 _additionalSettingsGroupBox->setLayout(vboxlayout);
59 _dataCheckBox =
new QCheckBox(
"Get Data");
60 _dataCheckBox->setChecked(
true);
61 vboxlayout->addWidget(_dataCheckBox);
63 _dropRemovedCheckBox =
new QCheckBox(
"Drop disconnected memories");
64 _dropRemovedCheckBox->setChecked(
true);
65 vboxlayout->addWidget(_dropRemovedCheckBox);
67 _dropDisabledCheckBox =
new QCheckBox(
"Drop disabled memories");
68 _dropDisabledCheckBox->setChecked(
false);
69 vboxlayout->addWidget(_dropDisabledCheckBox);
71 auto* recDepthHLayout =
new QHBoxLayout();
72 _recursionDepthLabel =
new QLabel(
"Link resolution depth:");
73 recDepthHLayout->addWidget(_recursionDepthLabel);
74 _recursionDepthLabel->setFixedWidth(200);
76 _recursionDepthSpinner =
new QSpinBox();
77 _recursionDepthSpinner->setRange(-1, std::numeric_limits<int>::max());
78 _recursionDepthSpinner->setValue(0);
79 _recursionDepthSpinner->setEnabled(_dataCheckBox->isChecked());
80 _recursionDepthSpinner->setSpecialValueText(QString(
"Unlimited"));
81 recDepthHLayout->addWidget(_recursionDepthSpinner);
82 recDepthHLayout->addStretch();
83 vboxlayout->addLayout(recDepthHLayout);
85 hlayout->addWidget(_additionalSettingsGroupBox);
87 vlayout->addLayout(hlayout);
91 _dataCheckBox, &QCheckBox::stateChanged,
this, &This::setRecursionDepthSpinnerEnabled);
93 connect(_de_selectMemoryServers, &QPushButton::pressed,
this, &This::deSelectMemoryServers);
95 connect(_recursionDepthSpinner,
96 qOverload<int>(&QSpinBox::valueChanged),
100 connect(_dropRemovedCheckBox,
105 connect(_dropDisabledCheckBox,
110 connect(_dataCheckBox,
122 std::scoped_lock l(enabledMemoriesMutex);
123 std::vector<std::string> alreadyPresentMemoryCheckboxes;
126 int maxIndex = _availableMemoriesGroupBox->layout()
129 for (
int i = 1; i < maxIndex; ++i)
131 auto w = _availableMemoriesGroupBox->layout()->itemAt(i)->widget();
132 QCheckBox* box =
static_cast<QCheckBox*
>(w);
133 QSignalBlocker blocker(box);
134 std::string memoryName = box->text().toStdString();
135 if (box->isEnabled() &&
136 std::find(activeMemoryNames.begin(), activeMemoryNames.end(), memoryName) ==
137 activeMemoryNames.end())
140 box->setVisible(
false);
141 box->setChecked(
false);
142 box->setEnabled(
false);
144 if (not(box->isEnabled()) &&
145 std::find(activeMemoryNames.begin(), activeMemoryNames.end(), memoryName) !=
146 activeMemoryNames.end())
149 box->setVisible(
true);
150 box->setChecked(
false);
151 box->setEnabled(
true);
153 alreadyPresentMemoryCheckboxes.push_back(memoryName);
158 for (
const auto& memoryName : activeMemoryNames)
160 if (std::find(alreadyPresentMemoryCheckboxes.begin(),
161 alreadyPresentMemoryCheckboxes.end(),
162 memoryName) == alreadyPresentMemoryCheckboxes.end())
165 auto box =
new QCheckBox(QString::fromStdString(memoryName));
168 box->setVisible(
true);
169 box->setEnabled(
true);
170 _availableMemoriesGroupBox->layout()->addWidget(box);
173 connect(box, &QCheckBox::stateChanged,
this, &This::updateSelectAllButtonState);
179 _de_selectMemoryServers->setEnabled(!activeMemoryNames.empty());