diff --git a/LameXP.vcproj b/LameXP.vcproj index dc4e2660..2f77591e 100644 --- a/LameXP.vcproj +++ b/LameXP.vcproj @@ -289,6 +289,10 @@ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > + + @@ -359,6 +363,10 @@ RelativePath=".\src\Config.h" > + + diff --git a/src/Config.h b/src/Config.h index 080733ac..1b2be3ea 100644 --- a/src/Config.h +++ b/src/Config.h @@ -25,7 +25,7 @@ #define VER_LAMEXP_MAJOR 4 #define VER_LAMEXP_MINOR_HI 0 #define VER_LAMEXP_MINOR_LO 0 -#define VER_LAMEXP_BUILD 10 +#define VER_LAMEXP_BUILD 11 #define VER_LAMEXP_SUFFIX TechPreview /* @@ -35,7 +35,7 @@ #define VER_LAMEXP_STR_HLP2(V,W,X,Y,Z) VER_LAMEXP_STR_HLP1(v##V.W##X Z [Build Y]) #define VER_LAMEXP_STR_HLP3(V,W,X,Y,Z) VER_LAMEXP_STR_HLP2(V,W,X,Y,Z) #define VER_LAMEXP_STR VER_LAMEXP_STR_HLP3(VER_LAMEXP_MAJOR,VER_LAMEXP_MINOR_HI,VER_LAMEXP_MINOR_LO,VER_LAMEXP_BUILD,VER_LAMEXP_SUFFIX) -#define VER_LAMEXP_SUFFIX_STR_HLP1(X) #X +#define VER_LAMEXP_SUFFIX_STR_HLP1(X) #X #define VER_LAMEXP_SUFFIX_STR_HLP2(X) VER_LAMEXP_SUFFIX_STR_HLP1(X) #define VER_LAMEXP_SUFFIX_STR VER_LAMEXP_SUFFIX_STR_HLP2(VER_LAMEXP_SUFFIX) #define VER_LAMEXP_MINOR_HLP1(X,Y) X##Y diff --git a/src/Dialog_About.cpp b/src/Dialog_About.cpp new file mode 100644 index 00000000..9c57d79b --- /dev/null +++ b/src/Dialog_About.cpp @@ -0,0 +1,145 @@ +/////////////////////////////////////////////////////////////////////////////// +// LameXP - Audio Encoder Front-End +// Copyright (C) 2004-2010 LoRd_MuldeR +// +// 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 +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// http://www.gnu.org/licenses/gpl-2.0.txt +/////////////////////////////////////////////////////////////////////////////// + +#include "Dialog_About.h" + +#include "Global.h" +#include "Resource.h" + +//Qt includes +#include +#include +#include +#include + +//Win32 includes +#include + +//Helper macros +#define LINK(URL) QString("%2").arg(URL).arg(URL) + +AboutDialog::AboutDialog(QWidget *parent) + : QMessageBox(parent) +{ + QString aboutText; + + aboutText += "

LameXP - Audio Encoder Front-end

"; + aboutText += QString("Copyright (C) 2004-%1 LoRd_MuldeR <MuldeR2@GMX.de>. Some rights reserved.
").arg(max(lamexp_version_date().year(),QDate::currentDate().year())); + aboutText += QString().sprintf("Version %d.%02d %s, Build %d [%s]

", lamexp_version_major(), lamexp_version_minor(), lamexp_version_release(), lamexp_version_build(), lamexp_version_date().toString(Qt::ISODate).toLatin1().constData()); + aboutText += "Please visit the official web-site at "; + aboutText += LINK("http://mulder.dummwiedeutsch.de/") += " for news and updates!
"; + aboutText += "

"; + aboutText += "This program is free software; you can redistribute it and/or
"; + aboutText += "modify it under the terms of the GNU General Public License
"; + aboutText += "as published by the Free Software Foundation; either version 2
"; + aboutText += "of the License, or (at your option) any later version.

"; + aboutText += "This program is distributed in the hope that it will be useful,
"; + aboutText += "but WITHOUT ANY WARRANTY; without even the implied warranty of
"; + aboutText += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
"; + aboutText += "GNU General Public License for more details.

"; + aboutText += "You should have received a copy of the GNU General Public License
"; + aboutText += "along with this program; if not, write to the Free Software
"; + aboutText += "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

"; + aboutText += "

"; + aboutText += "This software uses the 'slick' icon set by Mark James – http://www.famfamfam.com/.
"; + aboutText += "Released under the Creative Commons Attribution 2.5 License.
"; + + setText(aboutText); + setIconPixmap(dynamic_cast(QApplication::instance())->windowIcon().pixmap(QSize(64,64))); + setWindowTitle("About LameXP"); + + QPushButton *firstButton = addButton("More About...", QMessageBox::AcceptRole); + firstButton->setIcon(QIcon(":/icons/information.png")); + firstButton->setMinimumWidth(120); + + QPushButton *secondButton = addButton("About Qt...", QMessageBox::AcceptRole); + secondButton->setIcon(QIcon(":/images/Qt.svg")); + secondButton->setMinimumWidth(120); + + QPushButton *thirdButton = addButton("Discard", QMessageBox::AcceptRole); + thirdButton->setIcon(QIcon(":/icons/cross.png")); + thirdButton->setMinimumWidth(90); +} + +AboutDialog::~AboutDialog(void) +{ +} + +int AboutDialog::exec() +{ + PlaySound(MAKEINTRESOURCE(IDR_WAVE_ABOUT), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC); + + while(1) + { + switch(QMessageBox::exec()) + { + case 0: + showMoreAbout(); + break; + case 1: + QMessageBox::aboutQt(dynamic_cast(this->parent())); + break; + default: + return 0; + } + } + + return 0; +} + +void AboutDialog::showMoreAbout() +{ + const QString li("
  • "); + + QString moreAboutText; + moreAboutText += "

    The following third-party software is used in LameXP:

    "; + moreAboutText += "
      "; + moreAboutText += li + "LAME - OpenSource mp3 Encoder
      "; + moreAboutText += "Released under the terms of the GNU Leser General Public License.
      "; + moreAboutText += LINK("http://lame.sourceforge.net/"); + moreAboutText += "
      "; + moreAboutText += li + "OggEnc - Ogg Vorbis Encoder"; + moreAboutText += "
      Completely open and patent-free audio encoding technology.
      "; + moreAboutText += LINK("http://www.vorbis.com/"); + moreAboutText += "
      "; + moreAboutText += li + "Nero AAC reference MPEG-4 Encoder
      "; + moreAboutText += "Freeware state-of-the-art HE-AAC encoder with 2-Pass support.
      "; + moreAboutText += "(Available from vendor web-site as free download)
      "; + moreAboutText += LINK("http://www.nero.com/eng/technologies-aac-codec.html/"); + moreAboutText += "
      "; + moreAboutText += li + "MediaInfo - Media File Analysis Tool
      "; + moreAboutText += "Released under the terms of the GNU Leser General Public License.
      "; + moreAboutText += LINK("http://mediainfo.sourceforge.net/"); + moreAboutText += "
    "; + + QMessageBox *moreAboutBox = new QMessageBox(dynamic_cast(this->parent())); + moreAboutBox->setText(moreAboutText); + moreAboutBox->setIconPixmap(dynamic_cast(QApplication::instance())->windowIcon().pixmap(QSize(64,64))); + + QPushButton *closeButton = moreAboutBox->addButton("Discard", QMessageBox::AcceptRole); + closeButton->setIcon(QIcon(":/icons/cross.png")); + closeButton->setMinimumWidth(90); + + moreAboutBox->setWindowTitle("About Third-party Software"); + moreAboutBox->exec(); + + LAMEXP_DELETE(moreAboutBox); +} diff --git a/src/Dialog_About.h b/src/Dialog_About.h new file mode 100644 index 00000000..adfe5363 --- /dev/null +++ b/src/Dialog_About.h @@ -0,0 +1,36 @@ +/////////////////////////////////////////////////////////////////////////////// +// LameXP - Audio Encoder Front-End +// Copyright (C) 2004-2010 LoRd_MuldeR +// +// 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 +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// http://www.gnu.org/licenses/gpl-2.0.txt +/////////////////////////////////////////////////////////////////////////////// + +#pragma once +#include + +class AboutDialog : public QMessageBox +{ +public: + AboutDialog(QWidget *parent = 0); + ~AboutDialog(void); + +public slots: + int exec(); + +private: + void AboutDialog::showMoreAbout(); +}; diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp index c6600e91..34c12b5e 100644 --- a/src/Dialog_MainWindow.cpp +++ b/src/Dialog_MainWindow.cpp @@ -26,6 +26,7 @@ #include "Resource.h" #include "Dialog_WorkingBanner.h" #include "Dialog_MetaInfo.h" +#include "Dialog_About.h" #include "Thread_FileAnalyzer.h" #include "Thread_MessageHandler.h" #include "Model_MetaInfo.h" @@ -44,12 +45,12 @@ #include #include #include +#include //Win32 includes #include //Helper macros -#define LINK(URL) QString("%2").arg(URL).arg(URL) #define ABORT_IF_BUSY \ if(m_banner->isVisible() || m_delayedFileTimer->isActive()) \ { \ @@ -57,6 +58,8 @@ if(m_banner->isVisible() || m_delayedFileTimer->isActive()) \ return; \ } \ +#define LINK(X) "" + //////////////////////////////////////////////////////////// // Constructor //////////////////////////////////////////////////////////// @@ -147,6 +150,8 @@ MainWindow::MainWindow(QWidget *parent) m_styleActionGroup->addAction(actionStyleWindowsXP); m_styleActionGroup->addAction(actionStyleWindowsClassic); actionStylePlastique->setChecked(true); + actionStyleWindowsXP->setEnabled((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) >= QSysInfo::WV_XP); + actionStyleWindowsVista->setEnabled((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) >= QSysInfo::WV_VISTA); connect(m_styleActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(styleActionActivated(QAction*))); //Activate help menu actions @@ -208,10 +213,37 @@ MainWindow::~MainWindow(void) } //////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS +// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////// -/*NONE*/ +void MainWindow::addFiles(const QStringList &files) +{ + if(files.isEmpty()) + { + return; + } + + tabWidget->setCurrentIndex(0); + + FileAnalyzer *analyzer = new FileAnalyzer(files); + connect(analyzer, SIGNAL(fileSelected(QString)), m_banner, SLOT(setText(QString)), Qt::QueuedConnection); + connect(analyzer, SIGNAL(fileAnalyzed(AudioFileModel)), m_fileListModel, SLOT(addFile(AudioFileModel)), Qt::QueuedConnection); + + m_banner->show("Adding file(s), please wait...", analyzer); + + if(analyzer->filesDenied()) + { + QMessageBox::warning(this, "Access Denied", QString("%1 file(s) have been rejected, because read access was not granted!
    This usually means the file is locked by another process.
    ").arg(analyzer->filesDenied())); + } + if(analyzer->filesRejected()) + { + QMessageBox::warning(this, "Files Rejected", QString("%1 file(s) have been rejected, because the file format could not be recognized!
    This usually means the file is damaged or the file format is not supported.
    ").arg(analyzer->filesRejected())); + } + + LAMEXP_DELETE(analyzer); + sourceFileView->scrollToBottom(); + m_banner->close(); +} //////////////////////////////////////////////////////////// // EVENTS @@ -262,92 +294,8 @@ void MainWindow::windowShown(void) void MainWindow::aboutButtonClicked(void) { ABORT_IF_BUSY; - - QString aboutText; - aboutText += "

    LameXP - Audio Encoder Front-end

    "; - aboutText += QString("Copyright (C) 2004-%1 LoRd_MuldeR <MuldeR2@GMX.de>. Some rights reserved.
    ").arg(max(lamexp_version_date().year(),QDate::currentDate().year())); - aboutText += QString().sprintf("Version %d.%02d %s, Build %d [%s]

    ", lamexp_version_major(), lamexp_version_minor(), lamexp_version_release(), lamexp_version_build(), lamexp_version_date().toString(Qt::ISODate).toLatin1().constData()); - aboutText += "Please visit the official web-site at "; - aboutText += LINK("http://mulder.dummwiedeutsch.de/") += " for news and updates!
    "; - aboutText += "

    "; - aboutText += "This program is free software; you can redistribute it and/or
    "; - aboutText += "modify it under the terms of the GNU General Public License
    "; - aboutText += "as published by the Free Software Foundation; either version 2
    "; - aboutText += "of the License, or (at your option) any later version.

    "; - aboutText += "This program is distributed in the hope that it will be useful,
    "; - aboutText += "but WITHOUT ANY WARRANTY; without even the implied warranty of
    "; - aboutText += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    "; - aboutText += "GNU General Public License for more details.

    "; - aboutText += "You should have received a copy of the GNU General Public License
    "; - aboutText += "along with this program; if not, write to the Free Software
    "; - aboutText += "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

    "; - aboutText += "

    "; - aboutText += "This software uses the 'slick' icon set by Mark James – http://www.famfamfam.com/.
    "; - aboutText += "Released under the Creative Commons Attribution 2.5 License.
    "; - - QMessageBox *aboutBox = new QMessageBox(this); - aboutBox->setText(aboutText); - aboutBox->setIconPixmap(dynamic_cast(QApplication::instance())->windowIcon().pixmap(QSize(64,64))); - aboutBox->setWindowTitle("About LameXP"); - - QPushButton *firstButton = aboutBox->addButton("More About...", QMessageBox::AcceptRole); - firstButton->setIcon(QIcon(":/icons/information.png")); - firstButton->setMinimumWidth(120); - - QPushButton *secondButton = aboutBox->addButton("About Qt...", QMessageBox::AcceptRole); - secondButton->setIcon(QIcon(":/images/Qt.svg")); - secondButton->setMinimumWidth(120); - - QPushButton *thirdButton = aboutBox->addButton("Discard", QMessageBox::AcceptRole); - thirdButton->setIcon(QIcon(":/icons/cross.png")); - thirdButton->setMinimumWidth(90); - - PlaySound(MAKEINTRESOURCE(IDR_WAVE_ABOUT), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC); - - while(1) - { - switch(aboutBox->exec()) - { - case 0: - { - const QString li("
  • "); - QString moreAboutText; - moreAboutText += "

    The following third-party software is used in LameXP:

    "; - moreAboutText += "
      "; - moreAboutText += li + "LAME - OpenSource mp3 Encoder
      "; - moreAboutText += "Released under the terms of the GNU Leser General Public License.
      "; - moreAboutText += LINK("http://lame.sourceforge.net/"); - moreAboutText += "
      "; - moreAboutText += li + "OggEnc - Ogg Vorbis Encoder"; - moreAboutText += "
      Completely open and patent-free audio encoding technology.
      "; - moreAboutText += LINK("http://www.vorbis.com/"); - moreAboutText += "
      "; - moreAboutText += li + "Nero AAC reference MPEG-4 Encoder
      "; - moreAboutText += "Freeware state-of-the-art HE-AAC encoder with 2-Pass support.
      "; - moreAboutText += LINK("http://www.nero.com/eng/technologies-aac-codec.html/"); - moreAboutText += "
      "; - moreAboutText += li + "MediaInfo - Media File Analysis Tool
      "; - moreAboutText += "Released under the terms of the GNU Leser General Public License.
      "; - moreAboutText += LINK("http://mediainfo.sourceforge.net/"); - moreAboutText += "
    "; - - QMessageBox *moreAboutBox = new QMessageBox(this); - moreAboutBox->setText(moreAboutText); - moreAboutBox->setIconPixmap(dynamic_cast(QApplication::instance())->windowIcon().pixmap(QSize(64,64))); - moreAboutBox->setWindowTitle("About Third-party Software"); - moreAboutBox->exec(); - - LAMEXP_DELETE(moreAboutBox); - break; - } - case 1: - QMessageBox::aboutQt(this); - break; - default: - return; - } - } - + AboutDialog *aboutBox = new AboutDialog(this); + aboutBox->exec(); LAMEXP_DELETE(aboutBox); } @@ -366,24 +314,8 @@ void MainWindow::encodeButtonClicked(void) void MainWindow::addFilesButtonClicked(void) { ABORT_IF_BUSY; - - tabWidget->setCurrentIndex(0); QStringList selectedFiles = QFileDialog::getOpenFileNames(this, "Add file(s)", QString(), "All supported files (*.*)"); - - if(selectedFiles.isEmpty()) - { - return; - } - - FileAnalyzer *analyzer = new FileAnalyzer(selectedFiles); - connect(analyzer, SIGNAL(fileSelected(QString)), m_banner, SLOT(setText(QString)), Qt::QueuedConnection); - connect(analyzer, SIGNAL(fileAnalyzed(AudioFileModel)), m_fileListModel, SLOT(addFile(AudioFileModel)), Qt::QueuedConnection); - - m_banner->show("Adding file(s), please wait...", analyzer); - LAMEXP_DELETE(analyzer); - - sourceFileView->scrollToBottom(); - m_banner->close(); + addFiles(selectedFiles); } /* @@ -392,8 +324,6 @@ void MainWindow::addFilesButtonClicked(void) void MainWindow::openFolderActionActivated(void) { ABORT_IF_BUSY; - - tabWidget->setCurrentIndex(0); QString selectedFolder = QFileDialog::getExistingDirectory(this, "Add folder", QDesktopServices::storageLocation(QDesktopServices::MusicLocation)); if(!selectedFolder.isEmpty()) @@ -406,16 +336,8 @@ void MainWindow::openFolderActionActivated(void) { fileList << fileInfoList.takeFirst().absoluteFilePath(); } - - FileAnalyzer *analyzer = new FileAnalyzer(fileList); - connect(analyzer, SIGNAL(fileSelected(QString)), m_banner, SLOT(setText(QString)), Qt::QueuedConnection); - connect(analyzer, SIGNAL(fileAnalyzed(AudioFileModel)), m_fileListModel, SLOT(addFile(AudioFileModel)), Qt::QueuedConnection); - m_banner->show("Adding folder, please wait...", analyzer); - LAMEXP_DELETE(analyzer); - - sourceFileView->scrollToBottom(); - m_banner->close(); + addFiles(fileList); } } @@ -734,14 +656,6 @@ void MainWindow::handleDelayedFiles(void) { selectedFiles << QFileInfo(m_delayedFileList->takeFirst()).absoluteFilePath(); } - - FileAnalyzer *analyzer = new FileAnalyzer(selectedFiles); - connect(analyzer, SIGNAL(fileSelected(QString)), m_banner, SLOT(setText(QString)), Qt::QueuedConnection); - connect(analyzer, SIGNAL(fileAnalyzed(AudioFileModel)), m_fileListModel, SLOT(addFile(AudioFileModel)), Qt::QueuedConnection); - - m_banner->show("Adding file(s), please wait...", analyzer); - LAMEXP_DELETE(analyzer); - sourceFileView->scrollToBottom(); - m_banner->close(); + addFiles(selectedFiles); } diff --git a/src/Dialog_MainWindow.h b/src/Dialog_MainWindow.h index f73d0c04..af40ec63 100644 --- a/src/Dialog_MainWindow.h +++ b/src/Dialog_MainWindow.h @@ -71,6 +71,8 @@ protected: void showEvent(QShowEvent *event); private: + void addFiles(const QStringList &files); + FileListModel *m_fileListModel; QFileSystemModel *m_fileSystemModel; QActionGroup *m_tabActionGroup; diff --git a/src/Global.cpp b/src/Global.cpp index e758b483..b46715db 100644 --- a/src/Global.cpp +++ b/src/Global.cpp @@ -50,6 +50,14 @@ #include #endif //_DEBUG +//Static build only macros +#ifdef QT_NODLL +#pragma warning(disable:4101) +#define LAMEXP_INIT_QT_STATIC_PLUGIN(X) Q_IMPORT_PLUGIN(X) +#else +#define LAMEXP_INIT_QT_STATIC_PLUGIN(X) +#endif + /////////////////////////////////////////////////////////////////////////////// // TYPES /////////////////////////////////////////////////////////////////////////////// @@ -91,6 +99,9 @@ static QSystemSemaphore *g_lamexp_semaphore_read_ptr = NULL; static const char *g_lamexp_semaphore_write_uuid = "{60AA8D04-F6B8-497d-81EB-0F600F4A65B5}"; static QSystemSemaphore *g_lamexp_semaphore_write_ptr = NULL; +//Image formats +static const char *g_lamexp_imageformats[] = {"png", "gif", "ico", "svg", NULL}; + /////////////////////////////////////////////////////////////////////////////// // GLOBAL FUNCTIONS /////////////////////////////////////////////////////////////////////////////// @@ -189,12 +200,6 @@ void lamexp_init_console(int argc, char* argv[]) } } -/* Disable nasty warning */ -#if !defined(QT_DLL) || defined(QT_NODLL) -#pragma warning(push) -#pragma warning(disable:4101) -#endif - /* * Initialize Qt framework */ @@ -213,7 +218,7 @@ bool lamexp_init_qt(int argc, char* argv[]) QT_REQUIRE_VERSION(argc, argv, QT_VERSION_STR); //Check the Windows version - switch(QSysInfo::WindowsVersion) + switch(QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) { case QSysInfo::WV_2000: qDebug("Running on Windows 2000 (not offically supported!).\n"); @@ -247,18 +252,19 @@ bool lamexp_init_qt(int argc, char* argv[]) QCoreApplication::setLibraryPaths(QStringList() << QApplication::applicationDirPath()); qDebug("Library Path:\n%s\n", QApplication::libraryPaths().first().toUtf8().constData()); - //Initialize static Qt plugins - #ifndef QT_DLL - Q_IMPORT_PLUGIN(qsvg); - Q_IMPORT_PLUGIN(qico); - #endif + //Init static Qt plugins + LAMEXP_INIT_QT_STATIC_PLUGIN(qico); + LAMEXP_INIT_QT_STATIC_PLUGIN(qsvg); //Check for supported image formats QList supportedFormats = QImageReader::supportedImageFormats(); - if(!(supportedFormats.contains("png") && supportedFormats.contains("gif") && supportedFormats.contains("ico") && supportedFormats.contains("svg"))) + for(int i = 0; g_lamexp_imageformats[i]; i++) { - qFatal("Qt initialization error: At least one image format plugin is missing!"); - return false; + if(!supportedFormats.contains(g_lamexp_imageformats[i])) + { + qFatal("Qt initialization error: At least one image format plugin is missing! (%s)", g_lamexp_imageformats[i]); + return false; + } } //Change application look @@ -269,11 +275,6 @@ bool lamexp_init_qt(int argc, char* argv[]) return true; } -/* Re-enable the warning */ -#if !defined(QT_DLL) || defined(QT_NODLL) -#pragma warning(pop) -#endif - /* * Initialize IPC */ diff --git a/src/Thread_FileAnalyzer.cpp b/src/Thread_FileAnalyzer.cpp index d26279d6..e708dc12 100644 --- a/src/Thread_FileAnalyzer.cpp +++ b/src/Thread_FileAnalyzer.cpp @@ -47,6 +47,10 @@ FileAnalyzer::FileAnalyzer(const QStringList &inputFiles) { qFatal("Invalid path to MediaInfo binary. Tool not initialized properly."); } + + m_filesAccepted = 0; + m_filesRejected = 0; + m_filesDenied = 0; } //////////////////////////////////////////////////////////// @@ -56,6 +60,11 @@ FileAnalyzer::FileAnalyzer(const QStringList &inputFiles) void FileAnalyzer::run() { m_bSuccess = false; + + m_filesAccepted = 0; + m_filesRejected = 0; + m_filesDenied = 0; + m_inputFiles.sort(); while(!m_inputFiles.isEmpty()) @@ -66,9 +75,11 @@ void FileAnalyzer::run() AudioFileModel file = analyzeFile(currentFile); if(file.fileName().isEmpty() || file.formatContainerType().isEmpty() || file.formatAudioType().isEmpty()) { + m_filesRejected++; qDebug("Skipped: %s", file.filePath().toUtf8().constData()); continue; } + m_filesAccepted++; emit fileAnalyzed(file); } @@ -89,6 +100,7 @@ const AudioFileModel FileAnalyzer::analyzeFile(const QString &filePath) if(!readTest.open(QIODevice::ReadOnly)) { qWarning("Cannot access file for reading, skipping!"); + m_filesDenied++; return audioFile; } else @@ -323,6 +335,20 @@ unsigned int FileAnalyzer::parseDuration(const QString &str) return 0; } +unsigned int FileAnalyzer::filesAccepted(void) +{ + return m_filesAccepted; +} + +unsigned int FileAnalyzer::filesRejected(void) +{ + return m_filesRejected - m_filesDenied; +} + +unsigned int FileAnalyzer::filesDenied(void) +{ + return m_filesDenied; +} //////////////////////////////////////////////////////////// // EVENTS diff --git a/src/Thread_FileAnalyzer.h b/src/Thread_FileAnalyzer.h index 336d0005..ecf8794b 100644 --- a/src/Thread_FileAnalyzer.h +++ b/src/Thread_FileAnalyzer.h @@ -40,6 +40,9 @@ public: FileAnalyzer(const QStringList &inputFiles); void run(); bool getSuccess(void) { return !isRunning() && m_bSuccess; } + unsigned int filesAccepted(void); + unsigned int filesRejected(void); + unsigned int filesDenied(void); signals: void fileSelected(const QString &fileName); @@ -62,5 +65,8 @@ private: QStringList m_inputFiles; QString m_mediaInfoBin; section_t m_currentSection; + unsigned int m_filesAccepted; + unsigned int m_filesRejected; + unsigned int m_filesDenied; bool m_bSuccess; };