=== modified file 'mixxx/src/mixxx.cpp' --- mixxx/src/mixxx.cpp 2011-12-17 05:59:20 +0000 +++ mixxx/src/mixxx.cpp 2011-12-23 15:38:33 +0000 @@ -164,15 +164,16 @@ QDir::homePath().append("/").append(SETTINGS_PATH) .append("Custom.kbd.cfg"); - ConfigObject* pKbdConfig = NULL; + //Empty keyboard configuration + m_pKbdConfig_empty = new ConfigObject(""); if (QFile::exists(userKeyboard)) { qDebug() << "Found and will use custom keyboard preset" << userKeyboard; - pKbdConfig = new ConfigObject(userKeyboard); + m_pKbdConfig = new ConfigObject(userKeyboard); } else // Otherwise use the default - pKbdConfig = + m_pKbdConfig = new ConfigObject( QString(qConfigPath) .append("keyboard/").append("Standard.kbd.cfg")); @@ -180,7 +181,7 @@ // TODO(XXX) leak pKbdConfig, MixxxKeyboard owns it? Maybe roll all keyboard // initialization into MixxxKeyboard // Workaround for today: MixxxKeyboard calls delete - m_pKeyboard = new MixxxKeyboard(pKbdConfig); + m_pKeyboard = new MixxxKeyboard(m_pKbdConfig); //create RecordingManager m_pRecordingManager = new RecordingManager(m_pConfig); @@ -709,6 +710,7 @@ m_pOptionsBeatMark = new QAction(tr("&Audio Beat Marks"), this); + m_pOptionsKeyboard = new QAction(tr("Enable &keyboard mapping"), this); m_pOptionsFullScreen = new QAction(tr("&Full Screen"), this); #ifdef __APPLE__ @@ -852,6 +854,14 @@ connect(m_pOptionsRecord, SIGNAL(toggled(bool)), this, SLOT(slotOptionsRecord(bool))); + m_pOptionsKeyboard->setCheckable(true); + m_pOptionsKeyboard->setChecked(true); + m_pOptionsKeyboard->setStatusTip(tr("Toggle Keyboard On/Off")); + m_pOptionsFullScreen->setWhatsThis( + tr("Enable/Disable keyboard mappings")); + connect(m_pOptionsKeyboard, SIGNAL(toggled(bool)), + this, SLOT(slotOptionsKeyboard(bool))); + m_pOptionsFullScreen->setCheckable(true); m_pOptionsFullScreen->setChecked(false); m_pOptionsFullScreen->setStatusTip(tr("Full Screen")); @@ -916,6 +926,7 @@ #ifdef __SHOUTCAST__ m_pOptionsMenu->addAction(m_pOptionsShoutcast); #endif + m_pOptionsMenu->addAction(m_pOptionsKeyboard); m_pOptionsMenu->addAction(m_pOptionsFullScreen); m_pOptionsMenu->addSeparator(); m_pOptionsMenu->addAction(m_pOptionsPreferences); @@ -1042,6 +1053,20 @@ // BEAT MARK STUFF } +void MixxxApp::slotOptionsKeyboard(bool toggle) +{ + if (toggle) { + //qDebug() << "Enable keyboard shortcuts/mappings"; + m_pKeyboard->setKeyboardConfig(m_pKbdConfig); + } + + else { + //qDebug() << "Disable keyboard shortcuts/mappings"; + m_pKeyboard->setKeyboardConfig(m_pKbdConfig_empty); + } + +} + void MixxxApp::slotOptionsFullScreen(bool toggle) { if (m_pOptionsFullScreen) === modified file 'mixxx/src/mixxx.h' --- mixxx/src/mixxx.h 2011-12-17 05:59:20 +0000 +++ mixxx/src/mixxx.h 2011-12-23 15:00:53 +0000 @@ -104,6 +104,8 @@ void slotCheckboxVinylControl2(bool toggle); /** toggle recording - Don't #ifdef this because MOC is dumb**/ void slotOptionsRecord(bool toggle); + /** toogle keyboard on-off */ + void slotOptionsKeyboard(bool toggle); /** toogle full screen mode */ void slotOptionsFullScreen(bool toggle); /** Preference dialog */ @@ -210,6 +212,7 @@ QAction *m_pOptionsVinylControl2; #endif QAction *m_pOptionsRecord; + QAction *m_pOptionsKeyboard; QAction *m_pOptionsFullScreen; QAction *m_pOptionsPreferences; #ifdef __SHOUTCAST__ @@ -232,6 +235,9 @@ // Fullscreen patch QPoint m_winpos; bool m_NativeMenuBarSupport; + + ConfigObject* m_pKbdConfig; + ConfigObject* m_pKbdConfig_empty; }; //A structure to store the parsed command-line arguments === modified file 'mixxx/src/mixxxkeyboard.cpp' --- mixxx/src/mixxxkeyboard.cpp 2011-10-16 02:09:36 +0000 +++ mixxx/src/mixxxkeyboard.cpp 2011-12-23 13:42:41 +0000 @@ -135,6 +135,10 @@ return k; } +void MixxxKeyboard::setKeyboardConfig(ConfigObject * pKbdConfigObject) { + m_pKbdConfigObject = pKbdConfigObject; +} + ConfigObject* MixxxKeyboard::getKeyboardConfig() { return m_pKbdConfigObject; } === modified file 'mixxx/src/mixxxkeyboard.h' --- mixxx/src/mixxxkeyboard.h 2010-11-01 05:08:58 +0000 +++ mixxx/src/mixxxkeyboard.h 2011-12-23 13:43:06 +0000 @@ -40,6 +40,7 @@ /** Event filter */ bool eventFilter(QObject *obj, QEvent *e); + void setKeyboardConfig(ConfigObject *pKbdConfigObject); ConfigObject* getKeyboardConfig(); private: