-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13354 from JoergAtGithub/optimize_control_code
Optimize control code
- Loading branch information
Showing
37 changed files
with
260 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#pragma once | ||
|
||
// required for Qt-Macros | ||
#include <qobjectdefs.h> | ||
|
||
namespace mixxx { | ||
|
||
namespace control { | ||
|
||
Q_NAMESPACE | ||
|
||
enum class ButtonMode { | ||
Push, | ||
Toggle, | ||
PowerWindow, | ||
LongPressLatching, | ||
Trigger | ||
}; | ||
|
||
Q_ENUM_NS(ButtonMode); | ||
|
||
} // namespace control | ||
} // namespace mixxx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,40 @@ | ||
/*************************************************************************** | ||
controlpushbutton.h - description | ||
------------------- | ||
begin : Wed Feb 20 2002 | ||
copyright : (C) 2002 by Tue and Ken Haste Andersen | ||
email : | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef CONTROLPUSHBUTTON_H | ||
#define CONTROLPUSHBUTTON_H | ||
#pragma once | ||
|
||
#include "control/controlbuttonmode.h" | ||
#include "control/controlobject.h" | ||
|
||
/** | ||
*@author Tue and Ken Haste Andersen | ||
*/ | ||
|
||
class ControlPushButton : public ControlObject { | ||
Q_OBJECT | ||
public: | ||
enum ButtonMode { | ||
PUSH = 0, | ||
TOGGLE, | ||
POWERWINDOW, | ||
LONGPRESSLATCHING, | ||
TRIGGER, | ||
}; | ||
|
||
static QString buttonModeToString(int mode) { | ||
switch(mode) { | ||
case ControlPushButton::PUSH: | ||
return "PUSH"; | ||
case ControlPushButton::TOGGLE: | ||
return "TOGGLE"; | ||
case ControlPushButton::POWERWINDOW: | ||
return "POWERWINDOW"; | ||
case ControlPushButton::LONGPRESSLATCHING: | ||
return "LONGPRESSLATCHING"; | ||
case ControlPushButton::TRIGGER: | ||
return "TRIGGER"; | ||
default: | ||
return "UNKNOWN"; | ||
static QString buttonModeToString(mixxx::control::ButtonMode buttonMode) { | ||
switch (buttonMode) { | ||
case mixxx::control::ButtonMode::Push: | ||
return QStringLiteral("Push"); | ||
case mixxx::control::ButtonMode::Toggle: | ||
return QStringLiteral("Toggle"); | ||
case mixxx::control::ButtonMode::PowerWindow: | ||
return QStringLiteral("PowerWindow"); | ||
case mixxx::control::ButtonMode::LongPressLatching: | ||
return QStringLiteral("LongPressLatching"); | ||
case mixxx::control::ButtonMode::Trigger: | ||
return QStringLiteral("Trigger"); | ||
} | ||
DEBUG_ASSERT(false); | ||
return "Unknown"; | ||
} | ||
|
||
ControlPushButton(const ConfigKey& key, bool bPersist = false, double defaultValue = 0.0); | ||
virtual ~ControlPushButton(); | ||
|
||
inline ButtonMode getButtonMode() const { | ||
inline mixxx::control::ButtonMode getButtonMode() const { | ||
return m_buttonMode; | ||
} | ||
void setButtonMode(enum ButtonMode mode); | ||
void setButtonMode(mixxx::control::ButtonMode mode); | ||
void setStates(int num_states); | ||
void setBehavior(mixxx::control::ButtonMode mode, int num_states); | ||
|
||
private: | ||
enum ButtonMode m_buttonMode; | ||
void updateBehavior(); | ||
enum mixxx::control::ButtonMode m_buttonMode; | ||
int m_iNoStates; | ||
}; | ||
|
||
#endif |
Oops, something went wrong.