Qt: Reduce duplicated lines
Jeffrey Pfau jeffrey@endrift.com
Fri, 24 Jul 2015 00:01:43 -0700
1 files changed,
5 insertions(+),
22 deletions(-)
jump to
M
src/platform/qt/GBAKeyEditor.cpp
→
src/platform/qt/GBAKeyEditor.cpp
@@ -68,28 +68,6 @@ });
} #endif - connect(m_keyDU, SIGNAL(valueChanged(int)), this, SLOT(setNext())); - connect(m_keyDD, SIGNAL(valueChanged(int)), this, SLOT(setNext())); - connect(m_keyDL, SIGNAL(valueChanged(int)), this, SLOT(setNext())); - connect(m_keyDR, SIGNAL(valueChanged(int)), this, SLOT(setNext())); - connect(m_keySelect, SIGNAL(valueChanged(int)), this, SLOT(setNext())); - connect(m_keyStart, SIGNAL(valueChanged(int)), this, SLOT(setNext())); - connect(m_keyA, SIGNAL(valueChanged(int)), this, SLOT(setNext())); - connect(m_keyB, SIGNAL(valueChanged(int)), this, SLOT(setNext())); - connect(m_keyL, SIGNAL(valueChanged(int)), this, SLOT(setNext())); - connect(m_keyR, SIGNAL(valueChanged(int)), this, SLOT(setNext())); - - connect(m_keyDU, SIGNAL(axisChanged(int, int)), this, SLOT(setNext())); - connect(m_keyDD, SIGNAL(axisChanged(int, int)), this, SLOT(setNext())); - connect(m_keyDL, SIGNAL(axisChanged(int, int)), this, SLOT(setNext())); - connect(m_keyDR, SIGNAL(axisChanged(int, int)), this, SLOT(setNext())); - connect(m_keySelect, SIGNAL(axisChanged(int, int)), this, SLOT(setNext())); - connect(m_keyStart, SIGNAL(axisChanged(int, int)), this, SLOT(setNext())); - connect(m_keyA, SIGNAL(axisChanged(int, int)), this, SLOT(setNext())); - connect(m_keyB, SIGNAL(axisChanged(int, int)), this, SLOT(setNext())); - connect(m_keyL, SIGNAL(axisChanged(int, int)), this, SLOT(setNext())); - connect(m_keyR, SIGNAL(axisChanged(int, int)), this, SLOT(setNext())); - m_buttons = new QWidget(this); QVBoxLayout* layout = new QVBoxLayout; m_buttons->setLayout(layout);@@ -115,6 +93,11 @@ m_keyStart,
m_keyL, m_keyR }; + + for (auto& key : m_keyOrder) { + connect(key, SIGNAL(valueChanged(int)), this, SLOT(setNext())); + connect(key, SIGNAL(axisChanged(int, int)), this, SLOT(setNext())); + } m_currentKey = m_keyOrder.end();