OSDN Git Service

Updated Simplified Chinese translation, thanks to Hongchuan Zhuang <kidneybean@sohu...
[lamexp/LameXP.git] / src / Decoder_Vorbis.cpp
index 9b9fc38..3b6bf02 100644 (file)
@@ -1,12 +1,12 @@
 ///////////////////////////////////////////////////////////////////////////////
 // LameXP - Audio Encoder Front-End
-// Copyright (C) 2004-2018 LoRd_MuldeR <MuldeR2@GMX.de>
+// Copyright (C) 2004-2023 LoRd_MuldeR <MuldeR2@GMX.de>
 //
 // This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
+// it under the terms of the GNU GENERAL PUBLIC LICENSE as published by
 // the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version, but always including the *additional*
-// restrictions defined in the "License.txt" file.
+// (at your option) any later version; always including the non-optional
+// LAMEXP GNU GENERAL PUBLIC LICENSE ADDENDUM. See "License.txt" file!
 //
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -61,15 +61,16 @@ bool VorbisDecoder::decode(const QString &sourceFile, const QString &outputFile,
        }
 
        int prevProgress = -1;
-       QRegExp regExp("\\s+(\\d+)% decoded.");
+       QRegExp regExp("\\b(\\d+)\\.(\\d)%\\s+decoded.");
 
        const result_t result = awaitProcess(process, abortFlag, [this, &prevProgress, &regExp](const QString &text)
        {
                if (regExp.lastIndexIn(text) >= 0)
                {
-                       qint32 newProgress;
-                       if (MUtils::regexp_parse_int32(regExp, newProgress))
+                       qint32 values[2];
+                       if (MUtils::regexp_parse_int32(regExp, values, 2))
                        {
+                               const qint32 newProgress = (values[1] >= 5) ? (values[0] + 1) : values[0];
                                if (newProgress > prevProgress)
                                {
                                        emit statusUpdated(newProgress);
@@ -84,11 +85,11 @@ bool VorbisDecoder::decode(const QString &sourceFile, const QString &outputFile,
        return (result == RESULT_SUCCESS);
 }
 
-bool VorbisDecoder::isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion)
+bool VorbisDecoder::isFormatSupported(const QString &containerType, const QString& /*containerProfile*/, const QString &formatType, const QString& /*formatProfile*/, const QString& /*formatVersion*/)
 {
-       if(containerType.compare("OGG", Qt::CaseInsensitive) == 0)
+       if(containerType.compare(QLatin1String("OGG"), Qt::CaseInsensitive) == 0)
        {
-               if(formatType.compare("Vorbis", Qt::CaseInsensitive) == 0)
+               if(formatType.compare(QLatin1String("Vorbis"), Qt::CaseInsensitive) == 0)
                {
                        return true;
                }