From 02263905d14216d6894d772ba3ab78e4eb1e806c Mon Sep 17 00:00:00 2001 From: Yohann Dedy Date: Mon, 25 Jul 2016 22:12:32 +0200 Subject: [PATCH] added bitset variable/slots for thru settings --- src/settingswindow.cpp | 19 ++++++++++++++----- src/settingswindow.h | 3 +++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/settingswindow.cpp b/src/settingswindow.cpp index c708411..1463186 100644 --- a/src/settingswindow.cpp +++ b/src/settingswindow.cpp @@ -17,7 +17,8 @@ settingsWindow::settingsWindow(QWidget *parent) : _channelThruCheckBox(new QCheckBox(this)), _sysexThruCheckBox(new QCheckBox(this)), _realtimeThruCheckBox(new QCheckBox(this)), - _masterChannelSpinBox(new QSpinBox(this)) + _masterChannelSpinBox(new QSpinBox(this)), + _thruBitset(new std::bitset<3> ) { this->setWindowTitle("Configuration"); @@ -39,7 +40,8 @@ settingsWindow::settingsWindow(QWidget *parent) : _channelThruCheckBox->setText("Channel Events Thru (BIT0)"); _sysexThruCheckBox->setText("Sysex Events Thru (BIT1)"); _realtimeThruCheckBox->setText("Realtim Events Thru (BIT2)"); - + _masterChannelSpinBox->setMinimum(1); + _masterChannelSpinBox->setMaximum(16); _masterChannelSpinBox->setValue(1); QPushButton *getConfigButton = new QPushButton; @@ -67,7 +69,14 @@ settingsWindow::settingsWindow(QWidget *parent) : mainWidget->setLayout(mainLayout); setCentralWidget(mainWidget); - - - + connect(_channelThruCheckBox,SIGNAL(toggled(bool)),this,SLOT(onThruCheckboxChange())); + connect(_sysexThruCheckBox,SIGNAL(toggled(bool)),this,SLOT(onThruCheckboxChange())); + connect(_realtimeThruCheckBox,SIGNAL(toggled(bool)),this,SLOT(onThruCheckboxChange())); +} + +void settingsWindow::onThruCheckboxChange(){ + _thruBitset->set(0, _channelThruCheckBox->isChecked()); + _thruBitset->set(1, _sysexThruCheckBox->isChecked()); + _thruBitset->set(2,_realtimeThruCheckBox->isChecked()); + qDebug()<< "_thruBitset = " <<_thruBitset->to_ulong(); } diff --git a/src/settingswindow.h b/src/settingswindow.h index 502f161..472badb 100644 --- a/src/settingswindow.h +++ b/src/settingswindow.h @@ -7,6 +7,7 @@ #include ; #include #include +#include ; #include "qmidimessage.h" #include "qmidiin.h" @@ -26,6 +27,7 @@ public: QCheckBox *_channelThruCheckBox; QCheckBox *_sysexThruCheckBox; QCheckBox *_realtimeThruCheckBox; + std::bitset<3> *_thruBitset; QSpinBox *_masterChannelSpinBox; private: @@ -35,6 +37,7 @@ private: signals: public slots: + void onThruCheckboxChange(); }; #endif // SETTINGSWINDOW_H