Added workaround for MediaInfo's line break bug (regression in latest MediaInfo).

This commit is contained in:
LoRd_MuldeR 2011-04-25 21:13:52 +02:00
parent f4fd021cae
commit 837cc90840
9 changed files with 79 additions and 10 deletions

View File

@ -835,6 +835,7 @@ del "$(TargetDir)imageformats\q???d4.dll"
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\QRC_%(Filename).cpp" -name "%(Filename)" "%(FullPath)" <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\QRC_%(Filename).cpp" -name "%(Filename)" "%(FullPath)"
</Command> </Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\QRC_%(Filename).cpp;%(Outputs)</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\QRC_%(Filename).cpp;%(Outputs)</Outputs>
<SubType>Designer</SubType>
</CustomBuild> </CustomBuild>
<CustomBuild Include="res\Localization.qrc"> <CustomBuild Include="res\Localization.qrc">
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">RCC "$(SolutionDir)tmp\QRC_%(Filename).cpp"</Message> <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">RCC "$(SolutionDir)tmp\QRC_%(Filename).cpp"</Message>

View File

@ -2,6 +2,7 @@
<RCC version="1.0"> <RCC version="1.0">
<qresource> <qresource>
<file>images/Busy.gif</file> <file>images/Busy.gif</file>
<file>images/Cartoon.png</file>
<file>images/CD.png</file> <file>images/CD.png</file>
<file>images/Disque.png</file> <file>images/Disque.png</file>
<file>images/DropBox.png</file> <file>images/DropBox.png</file>

BIN
res/images/Cartoon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 2 #define VER_LAMEXP_MINOR_LO 2
#define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 7 #define VER_LAMEXP_PATCH 7
#define VER_LAMEXP_BUILD 462 #define VER_LAMEXP_BUILD 468
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Tools versions // Tools versions

View File

@ -77,7 +77,9 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta
QMessageBox(parent), QMessageBox(parent),
m_settings(settings), m_settings(settings),
m_disque(NULL), m_disque(NULL),
m_disqueTimer(NULL) m_disqueTimer(NULL),
m_rotateNext(false),
m_disqueDelay(_I64_MAX)
{ {
const QString versionStr = QString().sprintf const QString versionStr = QString().sprintf
( (
@ -91,6 +93,11 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta
qVersion() qVersion()
); );
for(int i = 0; i < 4; i++)
{
m_cartoon[i] = NULL;
}
QString aboutText; QString aboutText;
aboutText += QString("<h2>%1</h2>").arg(tr("LameXP &minus; Audio Encoder Front-end")); aboutText += QString("<h2>%1</h2>").arg(tr("LameXP &minus; Audio Encoder Front-end"));
@ -189,12 +196,12 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta
m_disque->setPixmap(disque); m_disque->setPixmap(disque);
m_disque->setWindowOpacity(0.01); m_disque->setWindowOpacity(0.01);
m_disque->show(); m_disque->show();
m_disqueFlags[0] = (qrand() > (RAND_MAX/2));
m_disqueFlags[1] = (qrand() > (RAND_MAX/2));
m_disqueTimer = new QTimer; m_disqueTimer = new QTimer;
connect(m_disqueTimer, SIGNAL(timeout()), this, SLOT(moveDisque())); connect(m_disqueTimer, SIGNAL(timeout()), this, SLOT(moveDisque()));
m_disqueTimer->setInterval(10); m_disqueTimer->setInterval(10);
m_disqueTimer->start(); m_disqueTimer->start();
m_disqueFlags[0] = true;
m_disqueFlags[1] = true;
} }
m_firstShow = firstStart; m_firstShow = firstStart;
@ -212,6 +219,10 @@ AboutDialog::~AboutDialog(void)
m_disqueTimer->stop(); m_disqueTimer->stop();
LAMEXP_DELETE(m_disqueTimer); LAMEXP_DELETE(m_disqueTimer);
} }
for(int i = 0; i < 4; i++)
{
LAMEXP_DELETE(m_cartoon[i]);
}
} }
@ -475,31 +486,65 @@ void AboutDialog::showMoreAbout(void)
void AboutDialog::moveDisque(void) void AboutDialog::moveDisque(void)
{ {
static const int delta = 2; int delta = 2;
LARGE_INTEGER perfCount, perfFrequ;
if(QueryPerformanceFrequency(&perfFrequ) && QueryPerformanceCounter(&perfCount))
{
if(m_disqueDelay != _I64_MAX)
{
double delay = static_cast<double>(perfCount.QuadPart) - static_cast<double>(m_disqueDelay);
delta = max(1, min(128, static_cast<int>(ceil(delay / static_cast<double>(perfFrequ.QuadPart) / 0.00512))));
}
m_disqueDelay = perfCount.QuadPart;
}
if(m_disque) if(m_disque)
{ {
QPoint pos = m_disque->pos(); QPoint pos = m_disque->pos();
pos.setX(m_disqueFlags[0] ? pos.x() + delta : pos.x() - delta); pos.setX(m_disqueFlags[0] ? pos.x() + delta : pos.x() - delta);
pos.setY(m_disqueFlags[1] ? pos.y() + delta : pos.y() - delta); pos.setY(m_disqueFlags[1] ? pos.y() + delta : pos.y() - delta);
m_disque->move(pos);
if(pos.x() <= 0) if(pos.x() <= 0)
{ {
m_disqueFlags[0] = true; m_disqueFlags[0] = true;
pos.setX(0);
m_rotateNext = true;
} }
else if(pos.x() >= m_screenGeometry.width() - m_disque->width()) else if(pos.x() >= m_screenGeometry.width() - m_disque->width())
{ {
m_disqueFlags[0] = false; m_disqueFlags[0] = false;
pos.setX(m_screenGeometry.width() - m_disque->width());
m_rotateNext = true;
} }
if(pos.y() <= 0) if(pos.y() <= 0)
{ {
m_disqueFlags[1] = true; m_disqueFlags[1] = true;
pos.setY(0);
m_rotateNext = true;
} }
else if(pos.y() >= m_screenGeometry.height()- m_disque->height()) else if(pos.y() >= m_screenGeometry.height()- m_disque->height())
{ {
m_disqueFlags[1] = false; m_disqueFlags[1] = false;
pos.setY(m_screenGeometry.height() - m_disque->height());
m_rotateNext = true;
}
m_disque->move(pos);
if(m_rotateNext)
{
QPixmap *cartoon = NULL;
if(m_disqueFlags[0] == true && m_disqueFlags[1] != true) cartoon = m_cartoon[0];
if(m_disqueFlags[0] == true && m_disqueFlags[1] == true) cartoon = m_cartoon[1];
if(m_disqueFlags[0] != true && m_disqueFlags[1] == true) cartoon = m_cartoon[2];
if(m_disqueFlags[0] != true && m_disqueFlags[1] != true) cartoon = m_cartoon[3];
if(cartoon)
{
m_disque->setPixmap(*cartoon);
m_disque->resize(cartoon->size());
}
m_rotateNext = false;
} }
if(m_disque->windowOpacity() < 0.9) if(m_disque->windowOpacity() < 0.9)
@ -533,7 +578,15 @@ bool AboutDialog::eventFilter(QObject *obj, QEvent *event)
{ {
if((obj == m_disque) && (event->type() == QEvent::MouseButtonPress)) if((obj == m_disque) && (event->type() == QEvent::MouseButtonPress))
{ {
m_disque->hide(); QPixmap cartoon(":/images/Cartoon.png");
for(int i = 0; i < 4; i++)
{
if(!m_cartoon[i])
{
m_cartoon[i] = new QPixmap(cartoon.transformed(QMatrix().rotate(static_cast<double>(i*90) + 45.0), Qt::SmoothTransformation));
m_rotateNext = true;
}
}
QDesktopServices::openUrl(QUrl(disqueUrl)); QDesktopServices::openUrl(QUrl(disqueUrl));
} }

View File

@ -55,6 +55,9 @@ private:
QTimer * m_disqueTimer; QTimer * m_disqueTimer;
bool m_disqueFlags[2]; bool m_disqueFlags[2];
QRect m_screenGeometry; QRect m_screenGeometry;
QPixmap *m_cartoon[4];
bool m_rotateNext;
__int64 m_disqueDelay;
QString makeToolText(const QString &toolName, const QString &toolBin, const QString &toolVerFmt, const QString &toolLicense, const QString &toolWebsite, const QString &extraInfo = QString()); QString makeToolText(const QString &toolName, const QString &toolBin, const QString &toolVerFmt, const QString &toolLicense, const QString &toolWebsite, const QString &extraInfo = QString());
bool playResoureSound(const QString &library, const unsigned long soundId, const bool async); bool playResoureSound(const QString &library, const unsigned long soundId, const bool async);

View File

@ -114,6 +114,7 @@ const AudioFileModel FileAnalyzer::analyzeFile(const QString &filePath)
AudioFileModel audioFile(filePath); AudioFileModel audioFile(filePath);
m_currentSection = sectionOther; m_currentSection = sectionOther;
m_currentCover = coverNone; m_currentCover = coverNone;
m_lineBreakBugWorkaround = false;
QFile readTest(filePath); QFile readTest(filePath);
if(!readTest.open(QIODevice::ReadOnly)) if(!readTest.open(QIODevice::ReadOnly))
@ -169,6 +170,7 @@ const AudioFileModel FileAnalyzer::analyzeFile(const QString &filePath)
int index = line.indexOf(':'); int index = line.indexOf(':');
if(index > 0) if(index > 0)
{ {
m_lineBreakBugWorkaround = false;
QString key = line.left(index-1).trimmed(); QString key = line.left(index-1).trimmed();
QString val = line.mid(index+1).trimmed(); QString val = line.mid(index+1).trimmed();
if(!key.isEmpty() && !val.isEmpty()) if(!key.isEmpty() && !val.isEmpty())
@ -230,9 +232,13 @@ void FileAnalyzer::updateSection(const QString &section)
} }
else else
{ {
if(!m_lineBreakBugWorkaround)
{
m_currentSection = sectionOther;
qWarning("Unknown section: %s", section.toUtf8().constData()); qWarning("Unknown section: %s", section.toUtf8().constData());
} }
} }
}
void FileAnalyzer::updateInfo(AudioFileModel &audioFile, const QString &key, const QString &value) void FileAnalyzer::updateInfo(AudioFileModel &audioFile, const QString &key, const QString &value)
{ {
@ -299,6 +305,10 @@ void FileAnalyzer::updateInfo(AudioFileModel &audioFile, const QString &key, con
m_currentCover = coverGif; m_currentCover = coverGif;
} }
} }
else if(!key.compare("Complete Name", Qt::CaseInsensitive))
{
m_lineBreakBugWorkaround = true;
}
break; break;
case sectionAudio: case sectionAudio:

View File

@ -83,5 +83,6 @@ private:
unsigned int m_filesRejected; unsigned int m_filesRejected;
unsigned int m_filesDenied; unsigned int m_filesDenied;
unsigned int m_filesDummyCDDA; unsigned int m_filesDummyCDDA;
bool m_lineBreakBugWorkaround;
bool m_bSuccess; bool m_bSuccess;
}; };