=== modified file 'mixxx/res/skins/Deere1280x1024-SXGA/skin.xml' --- mixxx/res/skins/Deere1280x1024-SXGA/skin.xml 2011-12-14 17:08:05 +0000 +++ mixxx/res/skins/Deere1280x1024-SXGA/skin.xml 2011-12-17 14:42:04 +0000 @@ -2476,15 +2476,21 @@ **************************************** --> - Talkover Hold-to-talk and mix microphone input into the master output. + Microphone talkover Hold-to-talk or short click for latching to mix microphone input into the master output. - 1 + true + 2 0 btn_microphone_talkover_over.png btn_microphone_talkover.png + + 1 + btn_microphone_talkover_over.png + btn_microphone_talkover_over.png + 25,15 [Microphone],talkover === modified file 'mixxx/res/skins/Deere1280x800-WXGA/skin.xml' --- mixxx/res/skins/Deere1280x800-WXGA/skin.xml 2011-12-14 17:08:05 +0000 +++ mixxx/res/skins/Deere1280x800-WXGA/skin.xml 2011-12-17 14:42:53 +0000 @@ -2476,15 +2476,21 @@ **************************************** --> - Talkover Hold-to-talk and mix microphone input into the master output. + Microphone talkover Hold-to-talk or short click for latching to mix microphone input into the master output. - 1 + true + 2 0 btn_microphone_talkover_over.png btn_microphone_talkover.png + + 1 + btn_microphone_talkover_over.png + btn_microphone_talkover_over.png + 25,15 [Microphone],talkover === modified file 'mixxx/res/skins/Deere1440x900-WXGA+/skin.xml' --- mixxx/res/skins/Deere1440x900-WXGA+/skin.xml 2011-12-14 17:08:05 +0000 +++ mixxx/res/skins/Deere1440x900-WXGA+/skin.xml 2011-12-17 14:43:25 +0000 @@ -2476,15 +2476,21 @@ **************************************** --> - Talkover Hold-to-talk and mix microphone input into the master output. + Microphone talkover Hold-to-talk or short click for latching to mix microphone input into the master output. - 1 + true + 2 0 btn_microphone_talkover_over.png btn_microphone_talkover.png + + 1 + btn_microphone_talkover_over.png + btn_microphone_talkover_over.png + 25,15 [Microphone],talkover === modified file 'mixxx/res/skins/Deere1920x1080-FullHD/skin.xml' --- mixxx/res/skins/Deere1920x1080-FullHD/skin.xml 2011-12-14 17:08:05 +0000 +++ mixxx/res/skins/Deere1920x1080-FullHD/skin.xml 2011-12-17 14:43:53 +0000 @@ -2476,15 +2476,21 @@ **************************************** --> - Talkover Hold-to-talk and mix microphone input into the master output. + Microphone talkover Hold-to-talk or short click for latching to mix microphone input into the master output. - 1 + true + 2 0 btn_microphone_talkover_over.png btn_microphone_talkover.png + + 1 + btn_microphone_talkover_over.png + btn_microphone_talkover_over.png + 25,15 [Microphone],talkover === modified file 'mixxx/res/skins/Deere1920x1200-WUXGA/skin.xml' --- mixxx/res/skins/Deere1920x1200-WUXGA/skin.xml 2011-12-14 17:08:05 +0000 +++ mixxx/res/skins/Deere1920x1200-WUXGA/skin.xml 2011-12-17 14:44:38 +0000 @@ -2476,15 +2476,21 @@ **************************************** --> - Talkover Hold-to-talk and mix microphone input into the master output. + Microphone talkover Hold-to-talk or short click for latching to mix microphone input into the master output. - 1 + true + 2 0 btn_microphone_talkover_over.png btn_microphone_talkover.png + + 1 + btn_microphone_talkover_over.png + btn_microphone_talkover_over.png + 25,15 [Microphone],talkover === modified file 'mixxx/res/skins/LateNight1280x1024-SXGA/skin.xml' --- mixxx/res/skins/LateNight1280x1024-SXGA/skin.xml 2011-12-17 05:30:04 +0000 +++ mixxx/res/skins/LateNight1280x1024-SXGA/skin.xml 2011-12-17 14:47:55 +0000 @@ -3500,14 +3500,20 @@ **************************************** --> - Microphone talkover Hold-to-talk and mix microphone input into the master output. + Microphone talkover Hold-to-talk or short click for latching to mix microphone input into the master output. - 1 + true + 2 0 btn_microphone_talkover_over.png btn_microphone_talkover.png + + 1 + btn_microphone_talkover_over.png + btn_microphone_talkover_over.png + 10,12 [Microphone],talkover === modified file 'mixxx/res/skins/LateNight1280x800-WXGA/skin.xml' --- mixxx/res/skins/LateNight1280x800-WXGA/skin.xml 2011-12-17 05:30:04 +0000 +++ mixxx/res/skins/LateNight1280x800-WXGA/skin.xml 2011-12-17 14:47:18 +0000 @@ -3500,14 +3500,20 @@ **************************************** --> - Microphone talkover Hold-to-talk and mix microphone input into the master output. + Microphone talkover Hold-to-talk or short click for latching to mix microphone input into the master output. - 1 + true + 2 0 btn_microphone_talkover_over.png btn_microphone_talkover.png + + 1 + btn_microphone_talkover_over.png + btn_microphone_talkover_over.png + 10,12 [Microphone],talkover === modified file 'mixxx/res/skins/LateNight1366x768-WXGA/skin.xml' --- mixxx/res/skins/LateNight1366x768-WXGA/skin.xml 2011-12-14 17:08:05 +0000 +++ mixxx/res/skins/LateNight1366x768-WXGA/skin.xml 2011-12-17 14:49:03 +0000 @@ -3500,14 +3500,20 @@ **************************************** --> - Microphone talkover Hold-to-talk and mix microphone input into the master output. + Microphone talkover Hold-to-talk or short click for latching to mix microphone input into the master output. - 1 + true + 2 0 btn_microphone_talkover_over.png btn_microphone_talkover.png + + 1 + btn_microphone_talkover_over.png + btn_microphone_talkover_over.png + 12,12 [Microphone],talkover === modified file 'mixxx/res/skins/LateNightBlues1280x1024-SXGA/skin.xml' --- mixxx/res/skins/LateNightBlues1280x1024-SXGA/skin.xml 2011-12-17 05:30:04 +0000 +++ mixxx/res/skins/LateNightBlues1280x1024-SXGA/skin.xml 2011-12-17 14:49:51 +0000 @@ -3499,14 +3499,20 @@ **************************************** --> - Microphone talkover Hold-to-talk and mix microphone input into the master output. + Microphone talkover Hold-to-talk or short click for latching to mix microphone input into the master output. - 1 + true + 2 0 btn_microphone_talkover_over.png btn_microphone_talkover.png + + 1 + btn_microphone_talkover_over.png + btn_microphone_talkover_over.png + 10,12 [Microphone],talkover === modified file 'mixxx/res/skins/LateNightBlues1280x800-WXGA/skin.xml' --- mixxx/res/skins/LateNightBlues1280x800-WXGA/skin.xml 2011-12-17 05:30:04 +0000 +++ mixxx/res/skins/LateNightBlues1280x800-WXGA/skin.xml 2011-12-17 14:50:35 +0000 @@ -3500,14 +3500,20 @@ **************************************** --> - Microphone talkover Hold-to-talk and mix microphone input into the master output. + Microphone talkover Hold-to-talk or short click for latching to mix microphone input into the master output. - 1 + true + 2 0 btn_microphone_talkover_over.png btn_microphone_talkover.png + + 1 + btn_microphone_talkover_over.png + btn_microphone_talkover_over.png + 10,12 [Microphone],talkover === modified file 'mixxx/res/skins/LateNightBlues1366x768-WXGA/skin.xml' --- mixxx/res/skins/LateNightBlues1366x768-WXGA/skin.xml 2011-12-14 17:08:05 +0000 +++ mixxx/res/skins/LateNightBlues1366x768-WXGA/skin.xml 2011-12-17 14:51:17 +0000 @@ -3500,14 +3500,20 @@ **************************************** --> - Microphone talkover Hold-to-talk and mix microphone input into the master output. + Microphone talkover Hold-to-talk or short click for latching to mix microphone input into the master output. - 1 + true + 2 0 btn_microphone_talkover_over.png btn_microphone_talkover.png + + 1 + btn_microphone_talkover_over.png + btn_microphone_talkover_over.png + 12,12 [Microphone],talkover === modified file 'mixxx/res/skins/Shade1024x600-Netbook/skin.xml' --- mixxx/res/skins/Shade1024x600-Netbook/skin.xml 2011-12-17 05:30:04 +0000 +++ mixxx/res/skins/Shade1024x600-Netbook/skin.xml 2011-12-17 14:51:59 +0000 @@ -6032,15 +6032,21 @@ **************************************** --> - Talkover Hold-to-talk and mix microphone input into the master output. + Microphone talkover Hold-to-talk or short click for latching to mix microphone input into the master output. - 1 + true + 2 0 btn_microphone_talkover_over.png btn_microphone_talkover.png + + 1 + btn_microphone_talkover_over.png + btn_microphone_talkover_over.png + 4,27 [Microphone],talkover === modified file 'mixxx/res/skins/Shade1024x768-XGA/skin.xml' --- mixxx/res/skins/Shade1024x768-XGA/skin.xml 2011-12-17 05:30:04 +0000 +++ mixxx/res/skins/Shade1024x768-XGA/skin.xml 2011-12-17 14:52:28 +0000 @@ -6032,15 +6032,21 @@ **************************************** --> - Talkover Hold-to-talk and mix microphone input into the master output. + Microphone talkover Hold-to-talk or short click for latching to mix microphone input into the master output. - 1 + true + 2 0 btn_microphone_talkover_over.png btn_microphone_talkover.png + + 1 + btn_microphone_talkover_over.png + btn_microphone_talkover_over.png + 4,27 [Microphone],talkover === modified file 'mixxx/res/skins/ShadeDark1024x600-Netbook/skin.xml' --- mixxx/res/skins/ShadeDark1024x600-Netbook/skin.xml 2011-12-17 05:30:04 +0000 +++ mixxx/res/skins/ShadeDark1024x600-Netbook/skin.xml 2011-12-17 14:53:11 +0000 @@ -6031,15 +6031,21 @@ **************************************** --> - Talkover Hold-to-talk and mix microphone input into the master output. + Microphone talkover Hold-to-talk or short click for latching to mix microphone input into the master output. - 1 + true + 2 0 btn_microphone_talkover_over.png btn_microphone_talkover.png + + 1 + btn_microphone_talkover_over.png + btn_microphone_talkover_over.png + 4,27 [Microphone],talkover === modified file 'mixxx/res/skins/ShadeDark1024x768-XGA/skin.xml' --- mixxx/res/skins/ShadeDark1024x768-XGA/skin.xml 2011-12-14 17:08:05 +0000 +++ mixxx/res/skins/ShadeDark1024x768-XGA/skin.xml 2011-12-17 14:53:43 +0000 @@ -6031,15 +6031,22 @@ **************************************** --> + Microphone talkover Hold-to-talk or short click for latching to mix microphone input into the master output. Talkover Hold-to-talk and mix microphone input into the master output. - 1 + true + 2 0 btn_microphone_talkover_over.png btn_microphone_talkover.png + + 1 + btn_microphone_talkover_over.png + btn_microphone_talkover_over.png + 4,27 [Microphone],talkover === modified file 'mixxx/src/controlpushbutton.cpp' --- mixxx/src/controlpushbutton.cpp 2011-09-25 05:56:03 +0000 +++ mixxx/src/controlpushbutton.cpp 2011-12-17 16:17:58 +0000 @@ -23,36 +23,46 @@ -------- ------------------------------------------------------ */ ControlPushButton::ControlPushButton(ConfigKey key) : ControlObject(key, false) { - m_bIsToggleButton = false; + m_midiButtonMode = PUSH; m_iNoStates = 2; } -ControlPushButton::~ControlPushButton() -{ +ControlPushButton::~ControlPushButton() { } -//Tell this PushButton whether or not it's a "toggle" push button... -void ControlPushButton::setToggleButton(bool bIsToggleButton) -{ +// Tell this PushButton how to act on rising and falling edges +// This is only used for values from Midi and Keyboard +void ControlPushButton::setMidiButtonMode(enum MidiButtonMode mode) { //qDebug() << "Setting " << m_Key.group << m_Key.item << "as toggle"; - m_bIsToggleButton = bIsToggleButton; + m_midiButtonMode = mode; } -void ControlPushButton::setStates(int num_states) -{ +void ControlPushButton::setStates(int num_states) { m_iNoStates = num_states; } -void ControlPushButton::setValueFromMidi(MidiCategory c, double v) -{ +void ControlPushButton::setValueFromMidi(MidiCategory c, double v) { + // keyboard events are handled by this function as well + //if (m_bMidiSimulateLatching) //qDebug() << "bMidiSimulateLatching is true!"; // Only react on NOTE_ON midi events if simulating latching... //qDebug() << c << v; - - if (m_bIsToggleButton) { //This block makes push-buttons act as toggle buttons. + if (m_midiButtonMode == POWERWINDOW && m_iNoStates == 2) { //This block makes push-buttons act as toggle buttons. + if (c == NOTE_ON) { + if (v > 0.) { + m_dValue = !m_dValue; + m_pushTimer.setSingleShot(true); + m_pushTimer.start(300); + } + } else if (c == NOTE_OFF) { + if (!m_pushTimer.isActive()) { + m_dValue = 0.0; + } + } + } else if (m_midiButtonMode == TOGGLE) { //This block makes push-buttons act as toggle buttons. if (m_iNoStates > 2) { //multistate button if (v > 0.) { //looking for NOTE_ON doesn't seem to work... m_dValue++; === modified file 'mixxx/src/controlpushbutton.h' --- mixxx/src/controlpushbutton.h 2011-03-14 21:09:17 +0000 +++ mixxx/src/controlpushbutton.h 2011-12-17 16:17:58 +0000 @@ -20,6 +20,7 @@ #include "controlobject.h" #include "defs.h" +#include /** *@author Tue and Ken Haste Andersen @@ -29,17 +30,24 @@ { Q_OBJECT public: + enum MidiButtonMode { + PUSH, + TOGGLE, + POWERWINDOW + }; + ControlPushButton(ConfigKey key); ~ControlPushButton(); - void setToggleButton(bool bIsToggleButton); + void setMidiButtonMode(enum MidiButtonMode mode); void setStates(int num_states); protected: void setValueFromMidi(MidiCategory c, double v); private: - bool m_bIsToggleButton; + enum MidiButtonMode m_midiButtonMode; int m_iNoStates; + QTimer m_pushTimer; }; #endif === modified file 'mixxx/src/engine/enginebuffer.cpp' --- mixxx/src/engine/enginebuffer.cpp 2011-12-06 02:54:33 +0000 +++ mixxx/src/engine/enginebuffer.cpp 2011-12-17 16:17:58 +0000 @@ -102,7 +102,7 @@ // Play button playButton = new ControlPushButton(ConfigKey(group, "play")); - playButton->setToggleButton(true); + playButton->setMidiButtonMode(ControlPushButton::TOGGLE); connect(playButton, SIGNAL(valueChanged(double)), this, SLOT(slotControlPlay(double)), Qt::DirectConnection); @@ -170,7 +170,7 @@ m_pTrackEndCOT = new ControlObjectThreadMain(m_pTrackEnd); m_pRepeat = new ControlPushButton(ConfigKey(group, "repeat")); - m_pRepeat->setToggleButton(true); + m_pRepeat->setMidiButtonMode(ControlPushButton::TOGGLE); // Sample rate m_pSampleRate = ControlObject::getControl(ConfigKey("[Master]","samplerate")); @@ -218,7 +218,7 @@ setNewPlaypos(0.); m_pKeylock = new ControlPushButton(ConfigKey(group, "keylock")); - m_pKeylock->setToggleButton(true); + m_pKeylock->setMidiButtonMode(ControlPushButton::TOGGLE); m_pKeylock->set(false); m_pEject = new ControlPushButton(ConfigKey(group, "eject")); === modified file 'mixxx/src/engine/enginechannel.cpp' --- mixxx/src/engine/enginechannel.cpp 2011-04-15 07:08:16 +0000 +++ mixxx/src/engine/enginechannel.cpp 2011-12-17 16:17:58 +0000 @@ -24,7 +24,7 @@ EngineChannel::ChannelOrientation defaultOrientation) : m_group(pGroup) { m_pPFL = new ControlPushButton(ConfigKey(m_group, "pfl")); - m_pPFL->setToggleButton(true); + m_pPFL->setMidiButtonMode(ControlPushButton::TOGGLE); m_pOrientation = new ControlObject(ConfigKey(m_group, "orientation")); m_pOrientation->set(defaultOrientation); } === modified file 'mixxx/src/engine/enginefilterblock.cpp' --- mixxx/src/engine/enginefilterblock.cpp 2011-12-06 20:46:40 +0000 +++ mixxx/src/engine/enginefilterblock.cpp 2011-12-17 16:17:58 +0000 @@ -71,15 +71,15 @@ filterpotLow = new ControlLogpotmeter(ConfigKey(group, "filterLow"), 4.); filterKillLow = new ControlPushButton(ConfigKey(group, "filterLowKill")); - filterKillLow->setToggleButton(true); + filterKillLow->setMidiButtonMode(ControlPushButton::TOGGLE); filterpotMid = new ControlLogpotmeter(ConfigKey(group, "filterMid"), 4.); filterKillMid = new ControlPushButton(ConfigKey(group, "filterMidKill")); - filterKillMid->setToggleButton(true); + filterKillMid->setMidiButtonMode(ControlPushButton::TOGGLE); filterpotHigh = new ControlLogpotmeter(ConfigKey(group, "filterHigh"), 4.); filterKillHigh = new ControlPushButton(ConfigKey(group, "filterHighKill")); - filterKillHigh->setToggleButton(true); + filterKillHigh->setMidiButtonMode(ControlPushButton::TOGGLE); m_pTemp1 = new CSAMPLE[MAX_BUFFER_LEN]; m_pTemp2 = new CSAMPLE[MAX_BUFFER_LEN]; === modified file 'mixxx/src/engine/engineflanger.cpp' --- mixxx/src/engine/engineflanger.cpp 2010-10-26 08:03:26 +0000 +++ mixxx/src/engine/engineflanger.cpp 2011-12-17 16:17:58 +0000 @@ -58,7 +58,7 @@ // Create an enable key on a per-deck basis. flangerEnable = new ControlPushButton(ConfigKey(group, "flanger")); - flangerEnable->setToggleButton(true); + flangerEnable->setMidiButtonMode(ControlPushButton::TOGGLE); // Fixed values of controls: LFOamplitude = 240; === modified file 'mixxx/src/engine/enginemicrophone.cpp' --- mixxx/src/engine/enginemicrophone.cpp 2011-11-05 20:13:23 +0000 +++ mixxx/src/engine/enginemicrophone.cpp 2011-12-17 16:17:58 +0000 @@ -18,6 +18,7 @@ // Need a +1 here because the CircularBuffer only allows its size-1 // items to be held at once (it keeps a blank spot open persistently) m_sampleBuffer(MAX_BUFFER_LEN+1) { + m_pControlTalkover->setMidiButtonMode(ControlPushButton::POWERWINDOW); } EngineMicrophone::~EngineMicrophone() { === modified file 'mixxx/src/engine/enginepassthrough.cpp' --- mixxx/src/engine/enginepassthrough.cpp 2011-04-17 02:56:27 +0000 +++ mixxx/src/engine/enginepassthrough.cpp 2011-12-17 16:17:58 +0000 @@ -19,7 +19,7 @@ // Need a +1 here because the CircularBuffer only allows its size-1 // items to be held at once (it keeps a blank spot open persistently) m_sampleBuffer(MAX_BUFFER_LEN+1) { - m_pPassing->setToggleButton(true); + m_pPassing->setMidiButtonMode(ControlPushButton::TOGGLE); } EnginePassthrough::~EnginePassthrough() { === modified file 'mixxx/src/engine/loopingcontrol.cpp' --- mixxx/src/engine/loopingcontrol.cpp 2011-12-16 21:29:27 +0000 +++ mixxx/src/engine/loopingcontrol.cpp 2011-12-17 18:30:54 +0000 @@ -587,7 +587,7 @@ : m_dBeatLoopSize(size) { m_pPBActivateBeatLoop = new ControlPushButton( keyForControl(pGroup, "beatloop", size)); - m_pPBActivateBeatLoop->setToggleButton(true); + m_pPBActivateBeatLoop->setMidiButtonMode(ControlPushButton::TOGGLE); m_pPBActivateBeatLoop->setStates(2); connect(m_pPBActivateBeatLoop, SIGNAL(valueChanged(double)), this, SLOT(slotBeatLoopActivate(double)), === modified file 'mixxx/src/engine/quantizecontrol.cpp' --- mixxx/src/engine/quantizecontrol.cpp 2011-12-10 22:10:04 +0000 +++ mixxx/src/engine/quantizecontrol.cpp 2011-12-17 16:17:58 +0000 @@ -18,7 +18,7 @@ : EngineControl(pGroup, pConfig) { m_pCOQuantizeEnabled = new ControlPushButton(ConfigKey(pGroup, "quantize")); m_pCOQuantizeEnabled->set(1.0f); - m_pCOQuantizeEnabled->setToggleButton(true); + m_pCOQuantizeEnabled->setMidiButtonMode(ControlPushButton::TOGGLE); m_pCONextBeat = new ControlObject(ConfigKey(pGroup, "beat_next")); m_pCONextBeat->set(-1); m_pCOPrevBeat = new ControlObject(ConfigKey(pGroup, "beat_prev")); === modified file 'mixxx/src/engine/vinylcontrolcontrol.cpp' --- mixxx/src/engine/vinylcontrolcontrol.cpp 2011-10-16 02:09:36 +0000 +++ mixxx/src/engine/vinylcontrolcontrol.cpp 2011-12-17 16:17:58 +0000 @@ -26,19 +26,19 @@ m_pControlVinylEnabled = new ControlPushButton(ConfigKey(pGroup, "vinylcontrol_enabled")); m_pControlVinylEnabled->set(0); - m_pControlVinylEnabled->setToggleButton(true); + m_pControlVinylEnabled->setMidiButtonMode(ControlPushButton::TOGGLE); m_pControlVinylWantEnabled = new ControlPushButton(ConfigKey(pGroup, "vinylcontrol_wantenabled")); m_pControlVinylWantEnabled->set(0); - m_pControlVinylWantEnabled->setToggleButton(true); + m_pControlVinylWantEnabled->setMidiButtonMode(ControlPushButton::TOGGLE); m_pControlVinylMode = new ControlPushButton(ConfigKey(pGroup, "vinylcontrol_mode")); m_pControlVinylMode->setStates(3); - m_pControlVinylMode->setToggleButton(true); + m_pControlVinylMode->setMidiButtonMode(ControlPushButton::TOGGLE); m_pControlVinylCueing = new ControlPushButton(ConfigKey(pGroup, "vinylcontrol_cueing")); m_pControlVinylCueing->setStates(3); - m_pControlVinylCueing->setToggleButton(true); + m_pControlVinylCueing->setMidiButtonMode(ControlPushButton::TOGGLE); m_pControlVinylSignalEnabled = new ControlPushButton(ConfigKey(pGroup, "vinylcontrol_signal_enabled")); m_pControlVinylSignalEnabled->set(1); - m_pControlVinylSignalEnabled->setToggleButton(true); + m_pControlVinylSignalEnabled->setMidiButtonMode(ControlPushButton::TOGGLE); } VinylControlControl::~VinylControlControl() { === modified file 'mixxx/src/widget/wpushbutton.cpp' --- mixxx/src/widget/wpushbutton.cpp 2011-10-16 02:09:36 +0000 +++ mixxx/src/widget/wpushbutton.cpp 2011-12-17 16:17:58 +0000 @@ -24,6 +24,7 @@ #include #include #include +#include WPushButton::WPushButton(QWidget * parent) : WWidget(parent) { @@ -50,6 +51,8 @@ int iNumStates = selectNodeInt(node, "NumberStates"); setStates(iNumStates); + m_powerWindowStyle = selectNodeQString(node, "PowerWindowStyle").contains("true", Qt::CaseInsensitive); + // Set background pixmap if available if (!selectNode(node, "BackPath").isNull()) setPixmapBackground(getPath(selectNodeQString(node, "BackPath"))); @@ -66,85 +69,21 @@ state = state.nextSibling(); } - m_bLeftClickForcePush = false; - if (selectNodeQString(node, "LeftClickIsPushButton").contains("true", Qt::CaseInsensitive)) + if (selectNodeQString(node, "LeftClickIsPushButton").contains("true", Qt::CaseInsensitive)) { m_bLeftClickForcePush = true; + } else { + m_bLeftClickForcePush = false; + } - m_bRightClickForcePush = false; - if (selectNodeQString(node, "RightClickIsPushButton").contains("true", Qt::CaseInsensitive)) + if (selectNodeQString(node, "RightClickIsPushButton").contains("true", Qt::CaseInsensitive)) { m_bRightClickForcePush = true; - - //-------- - //This next big block allows each ControlPushButton to know whether or not it's - //a "toggle" button. - - // For each connection - QDomNode con = selectNode(node, "Connection"); - while (!con.isNull()) - { - // Get ConfigKey - QString key = selectNodeQString(con, "ConfigKey"); - - ConfigKey configKey; - configKey.group = key.left(key.indexOf(",")); - configKey.item = key.mid(key.indexOf(",")+1); - - //Find out if we're a push button... - if (node.nodeName() == "PushButton") - { - ControlPushButton* p = dynamic_cast( - ControlObject::getControl(configKey)); - - if (p == NULL) { - // A NULL here either means that this control is not a - // ControlPushButton or it does not exist. This logic is - // specific to push-buttons, so skip it either way. - con = con.nextSibling(); - continue; - } - - bool isLeftButton = false; - bool isRightButton = false; - if (!selectNode(con, "ButtonState").isNull()) - { - if (selectNodeQString(con, "ButtonState").contains("LeftButton", Qt::CaseInsensitive)) { - isLeftButton = true; - } - else if (selectNodeQString(con, "ButtonState").contains("RightButton", Qt::CaseInsensitive)) { - isRightButton = true; - } - } - - // If we have 2 states, tell my controlpushbutton object that we're - // a toggle button. Only set the control as a toggle button if it - // has not been forced to remain a push button by the - // Right/LeftClickIsPushButton directive above. Do this by checking - // whether this control is mapped to the RightButton or LeftButton - // and check it against the value of m_bLeft/RightClickForcePush. We - // have to handle the case where no ButtonState is provided for the - // control. If no button is provided, then we have to assume the - // connected control should be a toggle. - - //bool setAsToggleButton = iNumStates == 2 && - // ((!isLeftButton && !isRightButton) || - // ( (isLeftButton && !m_bLeftClickForcePush) || - // (isRightButton && !m_bRightClickForcePush) ) ); - - // if (setAsToggleButton) - // p->setToggleButton(true); - - // BJW: Removed this so that buttons that are hardcoded as toggle in the source - // don't get overridden if a skin fails to set them to 2-state. Buttons still - // default to non-toggle otherwise. - // else - // p->setToggleButton(false); - } - - con = con.nextSibling(); + } else { + m_bRightClickForcePush = false; } - //End of toggle button stuff. - //-------- + // BJW: Removed toggle button detection so that buttons that are hardcoded as toggle in the source + // don't isLeftButtonget overridden if a skin fails to set them to 2-state. Buttons still + // default to non-toggle otherwise. } void WPushButton::setStates(int iStates) @@ -215,20 +154,23 @@ void WPushButton::mousePressEvent(QMouseEvent * e) { - m_bPressed = true; - bool leftClick = e->button() == Qt::LeftButton; bool rightClick = e->button() == Qt::RightButton; // The value to emit. double emitValue = m_fValue; - // Calculate new state if it is a one state button - if (m_iNoStates == 1) { + if (m_powerWindowStyle && m_iNoStates == 2) { + if (m_fValue == 0.0f) { + m_clickTimer.setSingleShot(true); + m_clickTimer.start(300); + } + m_fValue = emitValue = 1.0f; + } else if (m_iNoStates == 1) { + // Calculate new state if it is a one state button m_fValue = emitValue = (m_fValue == 0.0f) ? 1.0f : 0.0f; - } - // Update state on press if it is a n-state button and not a pushbutton - else if (leftClick) { + } else if (leftClick) { + // Update state on press if it is a n-state button and not a pushbutton if (m_bLeftClickForcePush) { emitValue = 1.0f; } else { @@ -251,33 +193,40 @@ // } // } + m_bPressed = true; + if (leftClick) { emit(valueChangedLeftDown(emitValue)); } else if (rightClick) { emit(valueChangedRightDown(emitValue)); } - update(); } void WPushButton::mouseReleaseEvent(QMouseEvent * e) { - m_bPressed = false; - bool leftClick = e->button() == Qt::LeftButton; bool rightClick = e->button() == Qt::RightButton; // The value to emit double emitValue = m_fValue; - // Update state if it is a one state button. - if (m_iNoStates==1) // && e->button()==Qt::LeftButton) - { + if (m_powerWindowStyle && m_iNoStates == 2) { + if ( !m_clickTimer.isActive() + && !(QApplication::mouseButtons() & Qt::RightButton) + && m_bPressed) { + // Release Button after Timer, but not if right button is clicked + m_fValue = emitValue = 0.0f; + } + } else if (m_iNoStates==1) // && e->button()==Qt::LeftButton) + { // Update state if it is a one state button. m_fValue = emitValue = (m_fValue == 0.0f) ? 1.0f : 0.0f; } else if ((leftClick && m_bLeftClickForcePush) || (rightClick && m_bRightClickForcePush)) { emitValue = 0.0f; } + m_bPressed = false; + if (leftClick) { emit(valueChangedLeftUp(emitValue)); } else if (rightClick) { === modified file 'mixxx/src/widget/wpushbutton.h' --- mixxx/src/widget/wpushbutton.h 2010-09-14 06:32:04 +0000 +++ mixxx/src/widget/wpushbutton.h 2011-12-17 16:17:58 +0000 @@ -64,6 +64,9 @@ QPixmap **m_pPixmaps; /** Associated background pixmap */ QPixmap *m_pPixmapBack; + /** short click toggle button long click push button **/ + bool m_powerWindowStyle; + QTimer m_clickTimer; }; #endif