score-addon-hardware/Hardware/Settings/View.cpp

49 lines
853 B
C++
Raw Normal View History

#include "View.hpp"
#include <score/widgets/FormWidget.hpp>
#include <QFormLayout>
#include <QComboBox>
#include <wobjectimpl.h>
W_OBJECT_IMPL(Hardware::Settings::View)
namespace Hardware
{
namespace Settings
{
View::View()
{
m_widg = new score::FormWidget{tr("Hardware")};
auto lay = m_widg->layout();
{
m_device = new QComboBox{m_widg};
m_device->addItem("None");
m_device->addItem("Launchpad_Pro_Standalone");
m_device->addItem("Launchpad_Pro_Live");
connect(m_device,
&QComboBox::currentTextChanged,
2024-12-13 22:41:58 +00:00
this,
&View::deviceChanged);
lay->addRow(m_device);
}
}
void View::setDevice(const QString& device)
{
2024-12-13 22:41:58 +00:00
int idx = m_device->findText(device);
if (idx != m_device->currentIndex())
m_device->setCurrentIndex(idx);
}
QWidget* View::getWidget()
{
return m_widg;
}
}
}