Skip to content

Commit 8f156ee

Browse files
committed
datalogger: added toggle all channels switch for devices
Signed-off-by: Andrei Popa <[email protected]>
1 parent 9a7ea49 commit 8f156ee

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

gui/include/gui/widgets/menucontrolbutton.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class SCOPY_GUI_EXPORT CollapsableMenuControlButton : public QWidget, public Com
110110
MenuControlButton *getControlBtn();
111111
MenuControlButton *header() override { return m_ctrl; }
112112
SmallOnOffSwitch *onOffSwitch();
113-
SmallOnOffSwitch *enableOnOffSwitch(bool en);
113+
void enableOnOffSwitch(bool en);
114114

115115
private:
116116
MenuControlButton *m_ctrl;

gui/src/widgets/menucontrolbutton.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ MenuControlButton::MenuControlButton(QWidget *parent)
3131
: QAbstractButton(parent)
3232
{
3333
lay = new QHBoxLayout(this);
34-
lay->setMargin(16);
35-
lay->setSpacing(16);
34+
lay->setMargin(10);
35+
lay->setSpacing(10);
3636

3737
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
3838
setCheckable(true);
@@ -201,6 +201,6 @@ MenuControlButton *CollapsableMenuControlButton::getControlBtn() { return m_ctrl
201201

202202
SmallOnOffSwitch *CollapsableMenuControlButton::onOffSwitch() { return m_onOffSwitch; }
203203

204-
SmallOnOffSwitch *CollapsableMenuControlButton::enableOnOffSwitch(bool en) { m_onOffSwitch->setVisible(en); }
204+
void CollapsableMenuControlButton::enableOnOffSwitch(bool en) { m_onOffSwitch->setVisible(en); }
205205

206206
#include "moc_menucontrolbutton.cpp"

plugins/datalogger/src/datamonitorstylehelper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ DataMonitorStyleHelper::DataMonitorStyleHelper(QObject *parent)
3333
void DataMonitorStyleHelper::DataMonitorToolStyle(DatamonitorTool *tool)
3434
{
3535
tool->tool->setRightContainerWidth(300);
36-
tool->tool->setLeftContainerWidth(185);
36+
tool->tool->setLeftContainerWidth(210);
3737
tool->tool->centralContainer()->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
3838

3939
Style::setStyle(tool->textMonitors, style::properties::widget::textEditBigLabel, true, true);

plugins/datalogger/src/menus/monitorselectionmenu.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ MonitorSelectionMenu::MonitorSelectionMenu(QMap<QString, DataMonitorModel *> *mo
8383
void MonitorSelectionMenu::generateDeviceSection(QString device, bool import)
8484
{
8585
CollapsableMenuControlButton *devMonitorsSection = new CollapsableMenuControlButton(this);
86+
devMonitorsSection->enableOnOffSwitch(true);
87+
devMonitorsSection->onOffSwitch()->setChecked(false);
8688
devMonitorsSection->getControlBtn()->button()->setVisible(false);
8789
devMonitorsSection->getControlBtn()->setName(device);
8890

@@ -133,6 +135,9 @@ void MonitorSelectionMenu::addMonitor(DataMonitorModel *monitor)
133135

134136
m_monitorsGroup->addButton(monitorChannel);
135137

138+
connect(deviceMap.value(monitor->getDeviceName())->onOffSwitch(), &SmallOnOffSwitch::toggled, this,
139+
[=](bool en) { monitorChannel->checkBox()->setChecked(en); });
140+
136141
connect(monitorChannel, &MenuControlButton::clicked, this, [=, this](bool toggled) {
137142
if(!monitorChannel->checkBox()->isChecked()) {
138143
monitorChannel->checkBox()->setChecked(true);

0 commit comments

Comments
 (0)