CueSheetModel: Don't wrap around 'minute' component to zero, if it exceeds 59 minutes.

This commit is contained in:
LoRd_MuldeR 2018-04-01 15:40:03 +02:00
parent 6ae5295cf1
commit 16f8dc4bcd
2 changed files with 13 additions and 21 deletions

View File

@ -34,8 +34,8 @@
#define VER_LAMEXP_MINOR_HI 1 #define VER_LAMEXP_MINOR_HI 1
#define VER_LAMEXP_MINOR_LO 6 #define VER_LAMEXP_MINOR_LO 6
#define VER_LAMEXP_TYPE Beta #define VER_LAMEXP_TYPE Beta
#define VER_LAMEXP_PATCH 9 #define VER_LAMEXP_PATCH 10
#define VER_LAMEXP_BUILD 2104 #define VER_LAMEXP_BUILD 2106
#define VER_LAMEXP_CONFG 2002 #define VER_LAMEXP_CONFG 2002
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -826,16 +826,10 @@ double CueSheetModel::parseTimeIndex(const QString &index)
if(rxTimeIndex.indexIn(index) >= 0) if(rxTimeIndex.indexIn(index) >= 0)
{ {
int min, sec, frm; int time[3];
bool minOK, secOK, frmOK; if(MUtils::regexp_parse_int32(rxTimeIndex, time, 3))
min = rxTimeIndex.cap(1).toInt(&minOK);
sec = rxTimeIndex.cap(2).toInt(&secOK);
frm = rxTimeIndex.cap(3).toInt(&frmOK);
if(minOK && secOK && frmOK)
{ {
return static_cast<double>(60 * min) + static_cast<double>(sec) + (static_cast<double>(frm) / 75.0); return static_cast<double>(60 * time[0]) + static_cast<double>(time[1]) + (static_cast<double>(time[2]) / 75.0);
} }
} }
@ -845,19 +839,17 @@ double CueSheetModel::parseTimeIndex(const QString &index)
QString CueSheetModel::indexToString(const double index) const QString CueSheetModel::indexToString(const double index) const
{ {
if(!_finite(index) || (index < 0.0) || (index > 86400.0)) if((!_finite(index)) || (index < 0.0) || (index > 86400.0))
{ {
return QString("??:??.???"); return QString("??:??.???");
} }
QTime time = QTime().addMSecs(static_cast<int>(floor(0.5 + (index * 1000.0)))); const int minutes = static_cast<int>(index / 60.0);
if(minutes < 100)
{
const MUtils::fp_parts_t seconds = MUtils::break_fp(fmod(index, 60.0));
return QString().sprintf("%02d:%02d.%03d", minutes, static_cast<int>(seconds.intpart), static_cast<int>(seconds.fractpart * 1000.0));
}
if(time.minute() < 100) return QString("99:99.999");
{
return time.toString("mm:ss.zzz");
}
else
{
return QString("99:99.999");
}
} }