From 837cc90840073e63af76dea4b12ec49d9afbdc7e Mon Sep 17 00:00:00 2001 From: lordmulder Date: Mon, 25 Apr 2011 21:13:52 +0200 Subject: [PATCH] Added workaround for MediaInfo's line break bug (regression in latest MediaInfo). --- LameXP_VS2010.vcxproj | 1 + res/Images.qrc | 1 + res/images/Cartoon.png | Bin 0 -> 2411 bytes res/images/Disque.png | Bin 4081 -> 2520 bytes src/Config.h | 2 +- src/Dialog_About.cpp | 69 +++++++++++++++++++++++++++++++----- src/Dialog_About.h | 3 ++ src/Thread_FileAnalyzer.cpp | 12 ++++++- src/Thread_FileAnalyzer.h | 1 + 9 files changed, 79 insertions(+), 10 deletions(-) create mode 100644 res/images/Cartoon.png diff --git a/LameXP_VS2010.vcxproj b/LameXP_VS2010.vcxproj index add5f55c..f81c47fa 100644 --- a/LameXP_VS2010.vcxproj +++ b/LameXP_VS2010.vcxproj @@ -835,6 +835,7 @@ del "$(TargetDir)imageformats\q???d4.dll" "$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\QRC_%(Filename).cpp" -name "%(Filename)" "%(FullPath)" $(SolutionDir)tmp\QRC_%(Filename).cpp;%(Outputs) + Designer RCC "$(SolutionDir)tmp\QRC_%(Filename).cpp" diff --git a/res/Images.qrc b/res/Images.qrc index 51e72b58..d33eb6ef 100644 --- a/res/Images.qrc +++ b/res/Images.qrc @@ -2,6 +2,7 @@ images/Busy.gif + images/Cartoon.png images/CD.png images/Disque.png images/DropBox.png diff --git a/res/images/Cartoon.png b/res/images/Cartoon.png new file mode 100644 index 0000000000000000000000000000000000000000..5982d4c29e9e3967c1c5554a630136f8d5702054 GIT binary patch literal 2411 zcmV-x36%DUP)N3u_ z1j%%&6?G6bwrM&^Gx>VHBlmgV_l zXwf2MW@e(gx*DrjuZFFyZIvMH+Zl1Zo0}Vs965p;H*VnN%a_=(V+Yo)TZaV;7GTbt zImpS$k=F0qw+}@{MMzIimnbVM!?tbPaP8VPxlctvKmc%1$=LA zZboTosRS*wT(=x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>%1").arg(tr("LameXP − Audio Encoder Front-end")); @@ -189,12 +196,12 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta m_disque->setPixmap(disque); m_disque->setWindowOpacity(0.01); m_disque->show(); + m_disqueFlags[0] = (qrand() > (RAND_MAX/2)); + m_disqueFlags[1] = (qrand() > (RAND_MAX/2)); m_disqueTimer = new QTimer; connect(m_disqueTimer, SIGNAL(timeout()), this, SLOT(moveDisque())); m_disqueTimer->setInterval(10); m_disqueTimer->start(); - m_disqueFlags[0] = true; - m_disqueFlags[1] = true; } m_firstShow = firstStart; @@ -212,6 +219,10 @@ AboutDialog::~AboutDialog(void) m_disqueTimer->stop(); 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) { - 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(perfCount.QuadPart) - static_cast(m_disqueDelay); + delta = max(1, min(128, static_cast(ceil(delay / static_cast(perfFrequ.QuadPart) / 0.00512)))); + } + m_disqueDelay = perfCount.QuadPart; + } + if(m_disque) { QPoint pos = m_disque->pos(); pos.setX(m_disqueFlags[0] ? pos.x() + delta : pos.x() - delta); pos.setY(m_disqueFlags[1] ? pos.y() + delta : pos.y() - delta); - m_disque->move(pos); if(pos.x() <= 0) { m_disqueFlags[0] = true; + pos.setX(0); + m_rotateNext = true; } else if(pos.x() >= m_screenGeometry.width() - m_disque->width()) { m_disqueFlags[0] = false; + pos.setX(m_screenGeometry.width() - m_disque->width()); + m_rotateNext = true; } - if(pos.y() <= 0) { m_disqueFlags[1] = true; + pos.setY(0); + m_rotateNext = true; } else if(pos.y() >= m_screenGeometry.height()- m_disque->height()) { 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) @@ -533,7 +578,15 @@ bool AboutDialog::eventFilter(QObject *obj, QEvent *event) { 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(i*90) + 45.0), Qt::SmoothTransformation)); + m_rotateNext = true; + } + } QDesktopServices::openUrl(QUrl(disqueUrl)); } diff --git a/src/Dialog_About.h b/src/Dialog_About.h index f86e748b..eae2e2b9 100644 --- a/src/Dialog_About.h +++ b/src/Dialog_About.h @@ -55,6 +55,9 @@ private: QTimer * m_disqueTimer; bool m_disqueFlags[2]; 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()); bool playResoureSound(const QString &library, const unsigned long soundId, const bool async); diff --git a/src/Thread_FileAnalyzer.cpp b/src/Thread_FileAnalyzer.cpp index a735fc62..0bd47701 100644 --- a/src/Thread_FileAnalyzer.cpp +++ b/src/Thread_FileAnalyzer.cpp @@ -114,6 +114,7 @@ const AudioFileModel FileAnalyzer::analyzeFile(const QString &filePath) AudioFileModel audioFile(filePath); m_currentSection = sectionOther; m_currentCover = coverNone; + m_lineBreakBugWorkaround = false; QFile readTest(filePath); if(!readTest.open(QIODevice::ReadOnly)) @@ -169,6 +170,7 @@ const AudioFileModel FileAnalyzer::analyzeFile(const QString &filePath) int index = line.indexOf(':'); if(index > 0) { + m_lineBreakBugWorkaround = false; QString key = line.left(index-1).trimmed(); QString val = line.mid(index+1).trimmed(); if(!key.isEmpty() && !val.isEmpty()) @@ -230,7 +232,11 @@ void FileAnalyzer::updateSection(const QString §ion) } else { - qWarning("Unknown section: %s", section.toUtf8().constData()); + if(!m_lineBreakBugWorkaround) + { + m_currentSection = sectionOther; + qWarning("Unknown section: %s", section.toUtf8().constData()); + } } } @@ -299,6 +305,10 @@ void FileAnalyzer::updateInfo(AudioFileModel &audioFile, const QString &key, con m_currentCover = coverGif; } } + else if(!key.compare("Complete Name", Qt::CaseInsensitive)) + { + m_lineBreakBugWorkaround = true; + } break; case sectionAudio: diff --git a/src/Thread_FileAnalyzer.h b/src/Thread_FileAnalyzer.h index b5d61d65..2a3313f7 100644 --- a/src/Thread_FileAnalyzer.h +++ b/src/Thread_FileAnalyzer.h @@ -83,5 +83,6 @@ private: unsigned int m_filesRejected; unsigned int m_filesDenied; unsigned int m_filesDummyCDDA; + bool m_lineBreakBugWorkaround; bool m_bSuccess; };