mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-01 18:29:16 +01:00
Small bug fix.
Added minus.wav witch is a copy of magic.was. "minus" file needed.
This commit is contained in:
parent
b45044b8c3
commit
f18c980c4e
BIN
ground/openpilotgcs/share/openpilotgcs/sounds/default/minus.wav
Normal file
BIN
ground/openpilotgcs/share/openpilotgcs/sounds/default/minus.wav
Normal file
Binary file not shown.
@ -271,14 +271,16 @@ QString NotificationItem::checkSoundExists(QString fileName)
|
|||||||
|
|
||||||
QStringList valueToSoundList(QString value)
|
QStringList valueToSoundList(QString value)
|
||||||
{
|
{
|
||||||
|
qNotifyDebug()<<"notificationItem valueToSoundList input param"<<value;
|
||||||
// replace point chr if exists
|
// replace point chr if exists
|
||||||
value = value.replace(',', '.');
|
value = value.replace(',', '.');
|
||||||
QStringList numberParts = value.trimmed().split(".");
|
QStringList numberParts = value.trimmed().split(".");
|
||||||
QStringList digitWavs;
|
QStringList digitWavs;
|
||||||
|
bool negative=false;
|
||||||
if(numberParts.at(0).toInt()<0)
|
if(numberParts.at(0).toInt()<0)
|
||||||
{
|
{
|
||||||
digitWavs.append("moved");
|
negative=true;
|
||||||
|
digitWavs.append("minus");
|
||||||
numberParts[0]=QString::number(numberParts.at(0).toInt()*-1);
|
numberParts[0]=QString::number(numberParts.at(0).toInt()*-1);
|
||||||
}
|
}
|
||||||
if ( (numberParts.at(0).size() == 1) || (numberParts.at(0).toInt() < 20) ) {
|
if ( (numberParts.at(0).size() == 1) || (numberParts.at(0).toInt() < 20) ) {
|
||||||
@ -296,17 +298,20 @@ QStringList valueToSoundList(QString value)
|
|||||||
// [3] prepend 100 and 1000 digits of number
|
// [3] prepend 100 and 1000 digits of number
|
||||||
for (;i<numberParts.at(0).size();i++)
|
for (;i<numberParts.at(0).size();i++)
|
||||||
{
|
{
|
||||||
digitWavs.prepend(numberParts.at(0).at(numberParts.at(0).size()-i-1));
|
int offset=0;
|
||||||
if(digitWavs.first()==QString("0")) {
|
if(negative)
|
||||||
digitWavs.removeFirst();
|
offset=1;
|
||||||
|
digitWavs.insert(offset,numberParts.at(0).at(numberParts.at(0).size()-i-1));
|
||||||
|
if(digitWavs.at(offset)==QString("0")) {
|
||||||
|
digitWavs.removeAt(offset);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (i==1)
|
if (i==1)
|
||||||
digitWavs.replace(0,digitWavs.first()+'0');
|
digitWavs.replace(0+offset,digitWavs.at(offset)+'0');
|
||||||
if (i==2)
|
if (i==2)
|
||||||
digitWavs.insert(1,"100");
|
digitWavs.insert(1+offset,"100");
|
||||||
if (i==3)
|
if (i==3)
|
||||||
digitWavs.insert(1,"1000");
|
digitWavs.insert(1+offset,"1000");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check, is there fractional part of number?
|
// check, is there fractional part of number?
|
||||||
@ -322,6 +327,7 @@ QStringList valueToSoundList(QString value)
|
|||||||
digitWavs.append(numberParts.at(1).right(1));
|
digitWavs.append(numberParts.at(1).right(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
qNotifyDebug()<<"notificationItem valueToSoundList return value"<<digitWavs;
|
||||||
return digitWavs;
|
return digitWavs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user