void MIDIProtocolSettingsWidget::buildGUI() { QLabel* ioTypeLabel = new QLabel(tr("Device I/O type"), this); m_inButton = new QRadioButton(tr("Input"), this); m_outButton = new QRadioButton(tr("Output"), this); //radioButtons with same parent are auto-exclusive per default, i.e., behave as belonging to the same group. QLabel* midiDeviceLabel = new QLabel(tr("MIDI device"), this); m_deviceCBox = new QComboBox(this); QGridLayout* gLayout = new QGridLayout; gLayout->addWidget(ioTypeLabel, 0, 0, 1, 1); gLayout->addWidget(m_inButton, 0, 1, 1, 1); gLayout->addWidget(m_outButton, 0, 2, 1, 1); gLayout->addWidget(midiDeviceLabel, 1, 0, 1, 1); gLayout->addWidget(m_deviceCBox, 1, 1, 1, 2); setLayout(gLayout); connect(m_inButton, SIGNAL(clicked()), this, SLOT(updateInputDevices())); connect(m_outButton, SIGNAL(clicked()), this, SLOT(updateOutputDevices())); m_inButton->setChecked(true); //TODO: QSettings updateInputDevices(); }
void MIDIProtocolSettingsWidget::buildGUI() { m_name = new QLineEdit; m_inButton = new QCheckBox(tr("Input"), this); m_inButton->setAutoExclusive(true); m_outButton = new QCheckBox(tr("Output"), this); m_outButton->setAutoExclusive(true); m_deviceCBox = new QComboBox(this); auto gb = new QWidget; gb->setContentsMargins(0, 0, 0, 0); auto gb_lay = new QHBoxLayout; gb_lay->setContentsMargins(0, 0, 0, 0); gb_lay->addWidget(m_inButton); gb_lay->addWidget(m_outButton); gb->setLayout(gb_lay); auto lay = new QFormLayout; lay->addRow(tr("Name"), m_name); lay->addRow(tr("Type"), gb); lay->addRow(tr("Device"), m_deviceCBox); setLayout(lay); connect(m_inButton, &QAbstractButton::toggled, this, [this] (bool b) { if(b) { updateDevices(OSSIA::MidiInfo::Type::RemoteInput); } }); connect(m_outButton, &QAbstractButton::toggled, this, [this] (bool b) { if(b) { updateDevices(OSSIA::MidiInfo::Type::RemoteOutput); } }); m_inButton->setChecked(true); //TODO: QSettings updateInputDevices(); }