19 if(!file.open(QIODevice::ReadOnly))
30 static constexpr
wchar_t key[] = {
31 L
'@', L
'G', L
'a', L
'w', L
'^', L
'2',
32 L
't', L
'G', L
'Q', L
'6', L
'1', L
'-',
33 L
'Î', L
'Ò', L
'n', L
'i'
60 if((fp = fopen(
qPrintable(input),
"rb")) ==
nullptr)
66 if(fstat(fileno(fp), &st))
73 uchar *src =
new uchar[st.st_size];
76 if(fread(src,
sizeof(uchar), st.st_size, fp) != (
size_t)st.st_size)
84 if(memcmp(src,
"krc1", 4) != 0)
93 for(
int i = 0; i < st.st_size; ++i)
95 src[i] = (uchar)(src[i] ^
key[i % 16]);
104 if(!output.isEmpty())
107 if(file.open(QIODevice::WriteOnly))
109 QTextStream outstream(&file);
110 outstream.setCodec(
"UTF-8");
127 c1 = (c1 >=
'A' && c1 <=
'Z') ? (c1 | 0x20) : c1;
128 c2 = (c2 >=
'A' && c2 <=
'Z') ? (c2 | 0x20) : c2;
191 for(
int i = 0; i < lrclen; ++i)
202 len = (strchr((
char*)&lrc[i],
']') - (
char*)&lrc[i]) + 1;
203 for(
int j = 0; j < len; ++j)
205 if(lrc[i + j] ==
':')
209 while(lrc[++i] !=
'\n' && i < lrclen)
218 for(
int j = 0; j < len; ++j)
221 if(lrc[i + j] ==
',')
225 ms = atoi((
char*)&lrc[i + 1]);
228 for(j = 0; j < 10; ++j)
244 else if(top == 1 && lrc[i] ==
'>')
255 if(!file.open(QIODevice::ReadOnly))
273 const QRegExp regx(
"\\[(\\d+),\\d+\\]");
274 if(regx.indexIn(text) != -1)
276 text.replace(regx,
"[" +
TTKTime::toString(regx.cap(1).toInt(),
"mm:ss.zzz") +
"]");
279 text.remove(QRegExp(
"\\(\\d+,\\d+\\)"));
291 if(!file.open(QIODevice::ReadOnly))
299 const QString &
data = QString::fromUtf8(
m_data);
304 text.remove(QRegExp(
"<\\d+>"));
314 if(!file.open(QIODevice::ReadOnly))
322 const QString &
data = QString::fromUtf8(
m_data);
327 if(text.startsWith(
"{"))
332 const QRegExp regx(
"\\[(\\d+),\\d+\\]");
333 if(regx.indexIn(text) != -1)
335 text.replace(regx,
"[" +
TTKTime::toString(regx.cap(1).toInt(),
"mm:ss.zzz") +
"]");
338 text.remove(QRegExp(
"\\(\\d+,\\d+,\\d+\\)"));
#define TTKStaticCast(x, y)
#define TTKConstCast(x, y)
virtual bool decode(const QString &input) overridefinal
The class of the ttk xml interface.
int ZEXPORT uncompress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
const QByteArray & data() const noexcept
virtual bool decode(const QString &input) overridefinal
int sncasecmp(char *s1, char *s2, size_t n)
static constexpr wchar_t key[]
bool fromByteArray(const QByteArray &data)
QString readAttributeByTagName(const QString &tagName, const QString &attrName="value") const
virtual bool decode(const QString &input) overridefinal
The class of the base lrc interface.
#define QtNamespace(p)
Qt use namespace.
void createLrc(uchar *lrc, int lrclen)
virtual bool decode(const QString &input) overridefinal
int decompression(uchar *src, size_t srcsize, size_t *dstsize)
virtual bool decode(const QString &input) overridefinal
static QString toString(qint64 time, const QString &format) noexcept
#define TTK_ERROR_STREAM(msg)