30 for(
const QString &oneLine :
qAsConst(text))
37 for(
const QString &oneLine :
qAsConst(text))
109 if(!file.open(QIODevice::ReadOnly))
169 const QRegExp regx01(
"\\[\\d{2}:\\d{2}\\.\\d{3}\\]");
170 const QRegExp regx02(
"\\[\\d{2}:\\d{2}\\.\\d{2}\\]");
171 const QRegExp regx03(
"\\[\\d{2}:\\d{2}\\.\\d{1}\\]");
172 const QRegExp regx04(
"\\[\\d{2}:\\d{2}:\\d{3}\\]");
173 const QRegExp regx05(
"\\[\\d{2}:\\d{2}:\\d{2}\\]");
174 const QRegExp regx06(
"\\[\\d{2}:\\d{2}:\\d{1}\\]");
175 const QRegExp regx07(
"\\[\\d{2}:\\d{2}\\]");
176 const QRegExp regx08(
"\\[\\d{2}\\.\\d{2}\\.\\d{3}\\]");
177 const QRegExp regx09(
"\\[\\d{2}\\.\\d{2}\\.\\d{2}\\]");
178 const QRegExp regx10(
"\\[\\d{2}\\.\\d{2}\\.\\d{1}\\]");
179 const QRegExp regx11(
"\\[\\d{2}\\.\\d{2}:\\d{3}\\]");
180 const QRegExp regx12(
"\\[\\d{2}\\.\\d{2}:\\d{2}\\]");
181 const QRegExp regx13(
"\\[\\d{2}\\.\\d{2}:\\d{1}\\]");
182 const QRegExp regx14(
"\\[\\d{2}\\.\\d{2}\\]");
186 if(oneLine.contains(regx01))
191 else if(oneLine.contains(regx02))
196 else if(oneLine.contains(regx03))
201 else if(oneLine.contains(regx04))
206 else if(oneLine.contains(regx05))
211 else if(oneLine.contains(regx06))
216 else if(oneLine.contains(regx07))
221 else if(oneLine.contains(regx08))
226 else if(oneLine.contains(regx09))
231 else if(oneLine.contains(regx10))
236 else if(oneLine.contains(regx11))
241 else if(oneLine.contains(regx12))
246 else if(oneLine.contains(regx13))
257 QString temp = oneLine;
258 temp.replace(regx, {});
259 int pos = regx.indexIn(oneLine);
262 const QString &cap = regx.cap(0);
284 pos += regx.matchedLength();
285 pos = regx.indexIn(oneLine, pos);
292 regx.setPattern(first);
295 const int minutes = regx.cap(0).toInt();
296 regx.setPattern(second);
299 const int seconds = regx.cap(0).toInt();
300 regx.setPattern(third);
303 const int milliseconds = regx.cap(0).toInt();
304 const int length = QString::number(milliseconds).length();
305 const qint64 totalTime = minutes *
TTK_DN_M2MS + seconds *
TTK_DN_S2MS + milliseconds * pow(10, 3 - length);
312 regx.setPattern(first);
315 const int minutes = regx.cap(0).toInt();
316 regx.setPattern(second);
319 const int seconds = regx.cap(0).toInt();
328 const QStringList list(cap.split(splite));
329 if(list.count() != 3)
334 const int minutes = list[0].toInt();
335 const int seconds = list[1].toInt();
336 const int milliseconds = list[2].toInt();
337 const int length = QString::number(milliseconds).length();
338 const qint64 totalTime = minutes *
TTK_DN_M2MS + seconds *
TTK_DN_S2MS + milliseconds * pow(10, 3 - length);
345 qint64 beforeTime = 0;
351 beforeTime = keys[0];
354 for(
int i = 1; i < keys.count(); ++i)
357 const qint64 afterTime = keys[i];
358 if(beforeTime <= time && time <= afterTime)
363 beforeTime = afterTime;
378 copy.insert(it.key() + pos, it.value());
386 data.append(QString(
"[by: %1]\n[offset:0]\n").arg(
TTK_APP_NAME));
395 if(!file.open(QIODevice::WriteOnly))
400 QTextStream outstream(&file);
401 outstream.setCodec(
"UTF-8");
450 pre = last = QString();
478 interval = later - previous;
488 for(
int i = 0; i < index + 1; ++i)
void revertTime(qint64 pos)
static MusicApplication * instance()
State setData(const QByteArray &data)
QByteArray decodeString() const
QStringList dataList() const
bool findText(qint64 current, qint64 total, QString &pre, QString &last, qint64 &interval) const
QMap< qint64, QString > TTKIntStringMap
QString text(int index) const
The class of the krc to lrc.
State loadFromLrcFile(const QString &path)
qint64 setSongTimeSpeed(qint64 time)
qint64 findTime(int index) const
State loadFromKrcFile(const QString &path)
#define QtNamespace(p)
Qt use namespace.
TTKIntStringMap m_lrcContainer
static constexpr const char * MUSIC_TTKLRCF
MusicLrcAnalysis(QObject *parent=nullptr)
QString dataString() const
void matchLrcLine(const QString &oneLine)
static QString toString(qint64 time, const QString &format) noexcept
QStringList m_currentShowLrcContainer
bool decode(const QString &input, const QString &output={})
QString m_currentFilePath