MCPcopy Create free account
hub / github.com/aethersdr/AetherSDR / commitValueEdit

Method commitValueEdit

src/gui/ClientEqOutputFader.cpp:92–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92void ClientEqOutputFader::commitValueEdit()
93{
94 if (!m_valueEdit) return;
95 static thread_local bool s_committing = false;
96 if (s_committing) return;
97 s_committing = true;
98 const QString raw = m_valueEdit->text().trimmed();
99 bool ok = false;
100 double v = QLocale().toDouble(raw, &ok);
101 if (!ok) {
102 QString cleaned;
103 cleaned.reserve(raw.size());
104 for (QChar c : raw) {
105 if (c.isDigit() || c == QChar('.') || c == QChar('-')
106 || c == QChar('+') || c == QChar('e') || c == QChar('E'))
107 cleaned.append(c);
108 }
109 v = cleaned.toDouble(&ok);
110 }
111 if (ok) {
112 const float db = std::clamp(static_cast<float>(v),
113 kGainMinDb, kGainMaxDb);
114 m_gain = dbToLinear(db);
115 refreshValueLabel();
116 emit gainChanged(m_gain);
117 update();
118 } else {
119 refreshValueLabel();
120 }
121 s_committing = false;
122}
123
124bool ClientEqOutputFader::eventFilter(QObject* obj, QEvent* ev)
125{

Callers

nothing calls this directly

Calls 3

dbToLinearFunction · 0.85
textMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected