#include "ffbeffect.h"
#include "globalsettings.h"
+const QString FFBEffect::PRERR_CAPTION("Invalid FFB parameter");
+
FFBEffect::FFBEffect(FFBEffectTypes type)
{
m_status = FFBEffectStatus::NOT_LOADED;
protected:
virtual bool checkGenericParameters(const std::shared_ptr<FFBEffectParameters> params) = 0;
+ static const QString PRERR_CAPTION;
+
private:
FFBEffectStatus m_status;
FFBEffectTypes m_type;
std::shared_ptr<FFBRampEffectParameters> m_params;
};
-#endif // FFBRAMPEFFECT_H
+#endif // LINUXFFBRAMPEFFECT_H
return false;
if (!checkBoundsInclusive(params->leftSat.at(FFBConditionEffectParameters::Axis::X), 0, 0xFFFF)) {
- QMessageBox::warning(nullptr, CAPTION, "Left X saturation must be within <0; 65535>");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Left X saturation must be within <0; 65535>");
return false;
}
if (!checkBoundsInclusive(params->leftSat.at(FFBConditionEffectParameters::Axis::Y), 0, 0xFFFF)) {
- QMessageBox::warning(nullptr, CAPTION, "Left Y saturation must be within <0; 65535>");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Left Y saturation must be within <0; 65535>");
return false;
}
if (!checkBoundsInclusive(params->rightSat.at(FFBConditionEffectParameters::Axis::X), 0, 0xFFFF)) {
- QMessageBox::warning(nullptr, CAPTION, "Right X saturation must be within <0; 65535>");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Right X saturation must be within <0; 65535>");
return false;
}
if (!checkBoundsInclusive(params->rightSat.at(FFBConditionEffectParameters::Axis::Y), 0, 0xFFFF)) {
- QMessageBox::warning(nullptr, CAPTION, "Right Y saturation must be within <0; 65535>");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Right Y saturation must be within <0; 65535>");
return false;
}
if (!checkBoundsInclusive(params->leftCoeff.at(FFBConditionEffectParameters::Axis::X), -0x7FFF, 0x7FFF)) {
- QMessageBox::warning(nullptr, CAPTION, "Left X coefficient must be within <-32767; 32767>");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Left X coefficient must be within <-32767; 32767>");
return false;
}
if (!checkBoundsInclusive(params->leftCoeff.at(FFBConditionEffectParameters::Axis::Y), -0x7FFF, 0x7FFF)) {
- QMessageBox::warning(nullptr, CAPTION, "Left Y coefficient must be within <-32767; 32767>");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Left Y coefficient must be within <-32767; 32767>");
return false;
}
if (!checkBoundsInclusive(params->rightCoeff.at(FFBConditionEffectParameters::Axis::X), -0x7FFF, 0x7FFF)) {
- QMessageBox::warning(nullptr, CAPTION, "Right X coefficient must be within <-32767; 32767>");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Right X coefficient must be within <-32767; 32767>");
return false;
}
if (!checkBoundsInclusive(params->rightCoeff.at(FFBConditionEffectParameters::Axis::Y), -0x7FFF, 0x7FFF)) {
- QMessageBox::warning(nullptr, CAPTION, "Right Y coefficient must be within <-32767; 32767>");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Right Y coefficient must be within <-32767; 32767>");
return false;
}
if (!checkBoundsInclusive(params->deadband.at(FFBConditionEffectParameters::Axis::X), 0, 0xFFFF)) {
- QMessageBox::warning(nullptr, CAPTION, "Deadband X must be within <0; 65535>");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Deadband X must be within <0; 65535>");
return false;
}
if (!checkBoundsInclusive(params->deadband.at(FFBConditionEffectParameters::Axis::Y), 0, 0xFFFF)) {
- QMessageBox::warning(nullptr, CAPTION, "Deadband Y must be within <0; 65535>");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Deadband Y must be within <0; 65535>");
return false;
}
if (!checkBoundsInclusive(params->center.at(FFBConditionEffectParameters::Axis::X), -0x7FFF, 0x7FFF)) {
- QMessageBox::warning(nullptr, CAPTION, "Center X must be within <-32767; 32767>");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Center X must be within <-32767; 32767>");
return false;
}
if (!checkBoundsInclusive(params->center.at(FFBConditionEffectParameters::Axis::Y), -0x7FFF, 0x7FFF)) {
- QMessageBox::warning(nullptr, CAPTION, "Center Y must be within <-32767; 32767>");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Center Y must be within <-32767; 32767>");
return false;
}
return false;
if (!checkBoundsInclusive(m_params->level, -0x7FFF, 0x7FFF)) {
- QMessageBox::warning(nullptr, CAPTION, "Level parameters must be within <-32767; 32767>");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Level parameters must be within <-32767; 32767>");
return false;
}
#include "globalsettings.h"
#include <QtWidgets/QMessageBox>
-const QString SDL2FFBEffect::CAPTION("Invalid FFB parameter");
-
SDL_HapticEffect* SDL2FFBEffect::createFFstruct()
{
SDL_HapticEffect* effect = new SDL_HapticEffect;
return true;
if (!checkBoundsInclusive(attackLength, 0, 0x7FFF)) {
- QMessageBox::warning(nullptr, CAPTION, "Attack length must be within <0; 32767>");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Attack length must be within <0; 32767>");
return false;
}
if (!checkBoundsInclusive(attackLevel, 0, 0x7FFF)) {
- QMessageBox::warning(nullptr, CAPTION, "Attack level must be within <0; 32767>");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Attack level must be within <0; 32767>");
return false;
}
if (!checkBoundsInclusive(fadeLength, 0, 0x7FFF)) {
- QMessageBox::warning(nullptr, CAPTION, "Fade length must be within <0; 32767>");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Fade length must be within <0; 32767>");
return false;
}
if (!checkBoundsInclusive(fadeLevel, 0, 0x7FFF)) {
- QMessageBox::warning(nullptr, CAPTION, "Fade level must be within <0; 32767>");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Fade level must be within <0; 32767>");
return false;
}
return true;
if (!checkBoundsInclusive(params->direction, 0, 36000)) {
- QMessageBox::warning(nullptr, CAPTION, "Direction must be within <0; 36000)");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Direction must be within <0; 36000)");
return false;
}
if (!checkBoundsInclusive(params->replayLength, static_cast<int64_t>(0), static_cast<int64_t>(0x7FFF))) {
- QMessageBox::warning(nullptr, CAPTION, "Replay length must be within <0; 32767>");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Replay length must be within <0; 32767>");
return false;
}
if (!checkBoundsInclusive(params->replayDelay, 0, 0xFFFF)) {
- QMessageBox::warning(nullptr, CAPTION, "Replay delay must be within <0; 65535>");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Replay delay must be within <0; 65535>");
return false;
}
protected:
virtual bool checkGenericParameters(const std::shared_ptr<FFBEffectParameters> params);
bool checkEnvelopeParameters(const int attackLength, const int attackLevel, const int fadeLength, const int fadeLevel);
-
- static const QString CAPTION;
};
#endif // SDL2FFBEFFECT_H
return false;
if (!checkBoundsInclusive(params->period, 0, 36000)) {
- QMessageBox::warning(nullptr, CAPTION, "Period must be within <0; 36000>");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Period must be within <0; 36000>");
return false;
}
if (!checkBoundsInclusive(params->magnitude, -0x7FFF, 0x7FFF)) {
- QMessageBox::warning(nullptr, CAPTION, "Magnitude must be within <-32767; 32767>");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Magnitude must be within <-32767; 32767>");
return false;
}
if (!checkBoundsInclusive(params->offset, -0x7FFF, 0x7FFF)) {
- QMessageBox::warning(nullptr, CAPTION, "Offset must be within <-32767; 32767>");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Offset must be within <-32767; 32767>");
return false;
}
if (!checkBoundsInclusive(params->phase, 0, 36000)) {
- QMessageBox::warning(nullptr, CAPTION, "Phase must be withing <0; 36000>");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Phase must be withing <0; 36000>");
return false;
}
if (params->waveform == PeriodicWaveforms::NONE ||
params->waveform == PeriodicWaveforms::SQUARE) {
- QMessageBox::warning(nullptr, CAPTION, "Unsupported waveform");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Unsupported waveform");
return false;
}
return false;
if (checkBoundsInclusive(params->startLevel, -0x7FFF, 0x7FFF)) {
- QMessageBox::warning(nullptr, CAPTION, "Start level must be within <-32767; 32767>");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "Start level must be within <-32767; 32767>");
return false;
}
if (!checkBoundsInclusive(params->endLevel, -0x7FFF, 0x7FFF)) {
- QMessageBox::warning(nullptr, CAPTION, "End level must be within <-32767; 32767>");
+ QMessageBox::warning(nullptr, PRERR_CAPTION, "End level must be within <-32767; 32767>");
return false;
}