OSDN Git Service

Moved more functions into MUtils library, especially all the Qt initialization code...
[lamexp/LameXP.git] / src / Dialog_MainWindow.cpp
index de4f9d0..d687204 100644 (file)
@@ -1,11 +1,12 @@
 ///////////////////////////////////////////////////////////////////////////////
 // LameXP - Audio Encoder Front-End
-// Copyright (C) 2004-2013 LoRd_MuldeR <MuldeR2@GMX.de>
+// Copyright (C) 2004-2014 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
 // the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
+// (at your option) any later version, but always including the *additional*
+// restrictions defined in the "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
 #include "Dialog_MainWindow.h"
 
 //UIC includes
-#include "../tmp/UIC_MainWindow.h"
+#include "UIC_MainWindow.h"
 
 //LameXP includes
 #include "Global.h"
-#include "Resource.h"
 #include "Dialog_WorkingBanner.h"
 #include "Dialog_MetaInfo.h"
 #include "Dialog_About.h"
@@ -35,7 +35,6 @@
 #include "Dialog_CueImport.h"
 #include "Dialog_LogView.h"
 #include "Thread_FileAnalyzer.h"
-#include "Thread_FileAnalyzer_ST.h"
 #include "Thread_MessageHandler.h"
 #include "Model_MetaInfo.h"
 #include "Model_Settings.h"
 #include "ShellIntegration.h"
 #include "CustomEventFilter.h"
 
+//Mutils includes
+#include <MUtils/Global.h>
+#include <MUtils/OSSupport.h>
+#include <MUtils/GUI.h>
+#include <MUtils/Version.h>
+
 //Qt includes
 #include <QMessageBox>
 #include <QTimer>
 // Helper macros
 ////////////////////////////////////////////////////////////
 
+#define BANNER_VISIBLE ((m_banner != NULL) && m_banner->isVisible())
+
+#define INIT_BANNER() do \
+{ \
+       if(m_banner == NULL) \
+       { \
+               m_banner = new WorkingBanner(this); \
+       } \
+} \
+while(0)
+
+#define SHOW_BANNER(TXT) do \
+{ \
+       INIT_BANNER(); \
+       m_banner->show((TXT)); \
+} \
+while(0)
+
+#define SHOW_BANNER_ARG(TXT, ARG) do \
+{ \
+       INIT_BANNER(); \
+       m_banner->show((TXT), (ARG)); \
+} \
+while(0)
+
+
+#define SHOW_BANNER_CONDITIONALLY(FLAG, TEST, TXT) do \
+{ \
+       if((!(FLAG)) && ((TEST))) \
+       { \
+               INIT_BANNER(); \
+               m_banner->show((TXT)); \
+               FLAG = true; \
+       } \
+} \
+while(0)
+
 #define ABORT_IF_BUSY do \
 { \
-       if(m_banner->isVisible() || m_delayedFileTimer->isActive()) \
+       if(BANNER_VISIBLE || m_delayedFileTimer->isActive() || (QApplication::activeModalWidget() != NULL)) \
        { \
                lamexp_beep(lamexp_beep_warning); \
                return; \
@@ -117,7 +159,7 @@ while(0)
 { \
        QItemSelectionModel *_tmp = (VIEW)->selectionModel(); \
        (VIEW)->setModel(MODEL); \
-       LAMEXP_DELETE(_tmp); \
+       MUTILS_DELETE(_tmp); \
 } \
 while(0)
 
@@ -156,25 +198,42 @@ while(0)
 } \
 while(0)
 
+#define PLAY_SOUND_OPTIONAL(NAME, ASYNC) do \
+{ \
+       if(m_settings->soundsEnabled()) lamexp_play_sound((NAME), (ASYNC)); \
+} \
+while(0)
+
+#define SHOW_CORNER_WIDGET(FLAG) do \
+{ \
+       if(QWidget *cornerWidget = ui->menubar->cornerWidget()) \
+       { \
+               cornerWidget->setVisible((FLAG)); \
+       } \
+} \
+while(0)
+
 #define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(QString(URL).replace("-", "&minus;"))
 #define FSLINK(PATH) QString("<a href=\"file:///%1\">%2</a>").arg(PATH).arg(QString(PATH).replace("-", "&minus;"))
-//#define USE_NATIVE_FILE_DIALOG (lamexp_themes_enabled() || ((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) < QSysInfo::WV_XP))
 #define CENTER_CURRENT_OUTPUT_FOLDER_DELAYED QTimer::singleShot(125, this, SLOT(centerOutputFolderModel()))
 
 static const unsigned int IDM_ABOUTBOX = 0xEFF0;
+static const char *g_hydrogen_audio_url = "http://wiki.hydrogenaud.io/index.php?title=Main_Page";
 
 ////////////////////////////////////////////////////////////
 // Constructor
 ////////////////////////////////////////////////////////////
 
-MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, SettingsModel *settingsModel, QWidget *parent)
+MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel_MetaInfo *metaInfo, SettingsModel *settingsModel, QWidget *parent)
 :
        QMainWindow(parent),
        ui(new Ui::MainWindow),
        m_fileListModel(fileListModel),
        m_metaData(metaInfo),
        m_settings(settingsModel),
+       m_windowIcon(NULL),
        m_fileSystemModel(NULL),
+       m_banner(NULL),
        m_accepted(false),
        m_firstTimeShown(true),
        m_outputFolderViewCentering(false),
@@ -183,14 +242,17 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
        //Init the dialog, from the .ui file
        ui->setupUi(this);
        setWindowFlags(windowFlags() ^ Qt::WindowMaximizeButtonHint);
-       
+
+       //Create window icon
+       m_windowIcon = lamexp_set_window_icon(this, lamexp_app_icon(), true);
+
        //Register meta types
        qRegisterMetaType<AudioFileModel>("AudioFileModel");
 
        //Enabled main buttons
        connect(ui->buttonAbout, SIGNAL(clicked()), this, SLOT(aboutButtonClicked()));
        connect(ui->buttonStart, SIGNAL(clicked()), this, SLOT(encodeButtonClicked()));
-       connect(ui->buttonQuit, SIGNAL(clicked()), this, SLOT(closeButtonClicked()));
+       connect(ui->buttonQuit,  SIGNAL(clicked()), this, SLOT(closeButtonClicked()));
 
        //Setup tab widget
        ui->tabWidget->setCurrentIndex(0);
@@ -199,6 +261,17 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
        //Add system menu
        lamexp_append_sysmenu(this, IDM_ABOUTBOX, "About...");
 
+       //Setup corner widget
+       QLabel *cornerWidget = new QLabel(ui->menubar);
+       m_evenFilterCornerWidget = new CustomEventFilter;
+       cornerWidget->setText("N/A");
+       cornerWidget->setFixedHeight(ui->menubar->height());
+       cornerWidget->setCursor(QCursor(Qt::PointingHandCursor));
+       cornerWidget->hide();
+       cornerWidget->installEventFilter(m_evenFilterCornerWidget);
+       connect(m_evenFilterCornerWidget, SIGNAL(eventOccurred(QWidget*, QEvent*)), this, SLOT(cornerWidgetEventOccurred(QWidget*, QEvent*)));
+       ui->menubar->setCornerWidget(cornerWidget);
+
        //--------------------------------
        // Setup "Source" tab
        //--------------------------------
@@ -220,23 +293,24 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
        m_exportCsvContextAction = m_sourceFilesContextMenu->addAction(QIcon(":/icons/table_save.png"), "N/A");
        m_importCsvContextAction = m_sourceFilesContextMenu->addAction(QIcon(":/icons/folder_table.png"), "N/A");
        SET_FONT_BOLD(m_showDetailsContextAction, true);
-       connect(ui->buttonAddFiles, SIGNAL(clicked()), this, SLOT(addFilesButtonClicked()));
-       connect(ui->buttonRemoveFile, SIGNAL(clicked()), this, SLOT(removeFileButtonClicked()));
-       connect(ui->buttonClearFiles, SIGNAL(clicked()), this, SLOT(clearFilesButtonClicked()));
-       connect(ui->buttonFileUp, SIGNAL(clicked()), this, SLOT(fileUpButtonClicked()));
-       connect(ui->buttonFileDown, SIGNAL(clicked()), this, SLOT(fileDownButtonClicked()));
-       connect(ui->buttonShowDetails, SIGNAL(clicked()), this, SLOT(showDetailsButtonClicked()));
-       connect(m_fileListModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(sourceModelChanged()));
-       connect(m_fileListModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(sourceModelChanged()));
-       connect(m_fileListModel, SIGNAL(modelReset()), this, SLOT(sourceModelChanged()));
-       connect(ui->sourceFileView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(sourceFilesContextMenu(QPoint)));
-       connect(ui->sourceFileView->verticalScrollBar(), SIGNAL(sliderMoved(int)), this, SLOT(sourceFilesScrollbarMoved(int)));
-       connect(ui->sourceFileView->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(sourceFilesScrollbarMoved(int)));
-       connect(m_showDetailsContextAction, SIGNAL(triggered(bool)), this, SLOT(showDetailsButtonClicked()));
-       connect(m_previewContextAction, SIGNAL(triggered(bool)), this, SLOT(previewContextActionTriggered()));
-       connect(m_findFileContextAction, SIGNAL(triggered(bool)), this, SLOT(findFileContextActionTriggered()));
-       connect(m_exportCsvContextAction, SIGNAL(triggered(bool)), this, SLOT(exportCsvContextActionTriggered()));
-       connect(m_importCsvContextAction, SIGNAL(triggered(bool)), this, SLOT(importCsvContextActionTriggered()));
+
+       connect(ui->buttonAddFiles,                      SIGNAL(clicked()),                          this, SLOT(addFilesButtonClicked()));
+       connect(ui->buttonRemoveFile,                    SIGNAL(clicked()),                          this, SLOT(removeFileButtonClicked()));
+       connect(ui->buttonClearFiles,                    SIGNAL(clicked()),                          this, SLOT(clearFilesButtonClicked()));
+       connect(ui->buttonFileUp,                        SIGNAL(clicked()),                          this, SLOT(fileUpButtonClicked()));
+       connect(ui->buttonFileDown,                      SIGNAL(clicked()),                          this, SLOT(fileDownButtonClicked()));
+       connect(ui->buttonShowDetails,                   SIGNAL(clicked()),                          this, SLOT(showDetailsButtonClicked()));
+       connect(m_fileListModel,                         SIGNAL(rowsInserted(QModelIndex,int,int)),  this, SLOT(sourceModelChanged()));
+       connect(m_fileListModel,                         SIGNAL(rowsRemoved(QModelIndex,int,int)),   this, SLOT(sourceModelChanged()));
+       connect(m_fileListModel,                         SIGNAL(modelReset()),                       this, SLOT(sourceModelChanged()));
+       connect(ui->sourceFileView,                      SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(sourceFilesContextMenu(QPoint)));
+       connect(ui->sourceFileView->verticalScrollBar(), SIGNAL(sliderMoved(int)),                   this, SLOT(sourceFilesScrollbarMoved(int)));
+       connect(ui->sourceFileView->verticalScrollBar(), SIGNAL(valueChanged(int)),                  this, SLOT(sourceFilesScrollbarMoved(int)));
+       connect(m_showDetailsContextAction,              SIGNAL(triggered(bool)),                    this, SLOT(showDetailsButtonClicked()));
+       connect(m_previewContextAction,                  SIGNAL(triggered(bool)),                    this, SLOT(previewContextActionTriggered()));
+       connect(m_findFileContextAction,                 SIGNAL(triggered(bool)),                    this, SLOT(findFileContextActionTriggered()));
+       connect(m_exportCsvContextAction,                SIGNAL(triggered(bool)),                    this, SLOT(exportCsvContextActionTriggered()));
+       connect(m_importCsvContextAction,                SIGNAL(triggered(bool)),                    this, SLOT(importCsvContextActionTriggered()));
 
        //--------------------------------
        // Setup "Output" tab
@@ -313,7 +387,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
        // Setup "Meta Data" tab
        //--------------------------------
 
-       m_metaInfoModel = new MetaInfoModel(m_metaData, 6);
+       m_metaInfoModel = new MetaInfoModel(m_metaData);
        m_metaInfoModel->clearData();
        m_metaInfoModel->setData(m_metaInfoModel->index(4, 1), m_settings->metaInfoPosition());
        ui->metaDataView->setModel(m_metaInfoModel);
@@ -337,6 +411,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
        m_encoderButtonGroup->addButton(ui->radioButtonEncoderAAC, SettingsModel::AACEncoder);
        m_encoderButtonGroup->addButton(ui->radioButtonEncoderAC3, SettingsModel::AC3Encoder);
        m_encoderButtonGroup->addButton(ui->radioButtonEncoderFLAC, SettingsModel::FLACEncoder);
+       m_encoderButtonGroup->addButton(ui->radioButtonEncoderAPE, SettingsModel::MACEncoder);
        m_encoderButtonGroup->addButton(ui->radioButtonEncoderOpus, SettingsModel::OpusEncoder);
        m_encoderButtonGroup->addButton(ui->radioButtonEncoderDCA, SettingsModel::DCAEncoder);
        m_encoderButtonGroup->addButton(ui->radioButtonEncoderPCM, SettingsModel::PCMEncoder);
@@ -391,7 +466,6 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
        ui->comboBoxAftenCodingMode->setCurrentIndex(m_settings->aftenAudioCodingMode());
        ui->comboBoxAftenDRCMode->setCurrentIndex(m_settings->aftenDynamicRangeCompression());
        ui->comboBoxNormalizationMode->setCurrentIndex(m_settings->normalizationFilterEQMode());
-       //comboBoxOpusOptimize->setCurrentIndex(m_settings->opusOptimizeFor());
        ui->comboBoxOpusFramesize->setCurrentIndex(m_settings->opusFramesize());
        
        SET_CHECKBOX_STATE(ui->checkBoxBitrateManagement, m_settings->bitrateManagementEnabled());
@@ -567,17 +641,21 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
        connect(ui->actionImportCueSheet, SIGNAL(triggered(bool)), this, SLOT(importCueSheetActionTriggered(bool)));
                
        //Activate help menu actions
-       ui->actionVisitHomepage->setData(QString::fromLatin1(lamexp_website_url()));
-       ui->actionVisitSupport->setData(QString::fromLatin1(lamexp_support_url()));
-       ui->actionVisitMuldersSite->setData(QString::fromLatin1(lamexp_mulders_url()));
-       ui->actionDocumentFAQ->setData(QString("%1/FAQ.html").arg(QApplication::applicationDirPath()));
+       ui->actionVisitHomepage    ->setData(QString::fromLatin1(lamexp_website_url()));
+       ui->actionVisitSupport     ->setData(QString::fromLatin1(lamexp_support_url()));
+       ui->actionVisitMuldersSite ->setData(QString::fromLatin1(lamexp_mulders_url()));
+       ui->actionVisitTracker     ->setData(QString::fromLatin1(lamexp_tracker_url()));
+       ui->actionVisitHAK         ->setData(QString::fromLatin1(g_hydrogen_audio_url));
+       ui->actionDocumentFAQ      ->setData(QString("%1/FAQ.html").arg(QApplication::applicationDirPath()));
        ui->actionDocumentChangelog->setData(QString("%1/Changelog.html").arg(QApplication::applicationDirPath()));
        ui->actionDocumentTranslate->setData(QString("%1/Translate.html").arg(QApplication::applicationDirPath()));
-       connect(ui->actionCheckUpdates, SIGNAL(triggered()), this, SLOT(checkUpdatesActionActivated()));
-       connect(ui->actionVisitHomepage, SIGNAL(triggered()), this, SLOT(visitHomepageActionActivated()));
-       connect(ui->actionVisitMuldersSite, SIGNAL(triggered()), this, SLOT(visitHomepageActionActivated()));
-       connect(ui->actionVisitSupport, SIGNAL(triggered()), this, SLOT(visitHomepageActionActivated()));
-       connect(ui->actionDocumentFAQ, SIGNAL(triggered()), this, SLOT(documentActionActivated()));
+       connect(ui->actionCheckUpdates,      SIGNAL(triggered()), this, SLOT(checkUpdatesActionActivated()));
+       connect(ui->actionVisitSupport,      SIGNAL(triggered()), this, SLOT(visitHomepageActionActivated()));
+       connect(ui->actionVisitTracker,      SIGNAL(triggered()), this, SLOT(visitHomepageActionActivated()));
+       connect(ui->actionVisitHomepage,     SIGNAL(triggered()), this, SLOT(visitHomepageActionActivated()));
+       connect(ui->actionVisitMuldersSite,  SIGNAL(triggered()), this, SLOT(visitHomepageActionActivated()));
+       connect(ui->actionVisitHAK,          SIGNAL(triggered()), this, SLOT(visitHomepageActionActivated()));
+       connect(ui->actionDocumentFAQ,       SIGNAL(triggered()), this, SLOT(documentActionActivated()));
        connect(ui->actionDocumentChangelog, SIGNAL(triggered()), this, SLOT(documentActionActivated()));
        connect(ui->actionDocumentTranslate, SIGNAL(triggered()), this, SLOT(documentActionActivated()));
        
@@ -591,9 +669,6 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
        move((desktopRect.width() - thisRect.width()) / 2, (desktopRect.height() - thisRect.height()) / 2);
        setMinimumSize(thisRect.width(), thisRect.height());
 
-       //Create banner
-       m_banner = new WorkingBanner(this);
-
        //Create DropBox widget
        m_dropBox = new DropBox(this, m_fileListModel, m_settings);
        connect(m_fileListModel, SIGNAL(modelReset()), m_dropBox, SLOT(modelChanged()));
@@ -603,17 +678,19 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
 
        //Create message handler thread
        m_messageHandler = new MessageHandlerThread();
-       m_delayedFileList = new QStringList();
-       m_delayedFileTimer = new QTimer();
-       m_delayedFileTimer->setSingleShot(true);
-       m_delayedFileTimer->setInterval(5000);
        connect(m_messageHandler, SIGNAL(otherInstanceDetected()), this, SLOT(notifyOtherInstance()), Qt::QueuedConnection);
        connect(m_messageHandler, SIGNAL(fileReceived(QString)), this, SLOT(addFileDelayed(QString)), Qt::QueuedConnection);
        connect(m_messageHandler, SIGNAL(folderReceived(QString, bool)), this, SLOT(addFolderDelayed(QString, bool)), Qt::QueuedConnection);
        connect(m_messageHandler, SIGNAL(killSignalReceived()), this, SLOT(close()), Qt::QueuedConnection);
-       connect(m_delayedFileTimer, SIGNAL(timeout()), this, SLOT(handleDelayedFiles()));
        m_messageHandler->start();
 
+       //Init delayed file handling
+       m_delayedFileList = new QStringList();
+       m_delayedFileTimer = new QTimer();
+       m_delayedFileTimer->setSingleShot(true);
+       m_delayedFileTimer->setInterval(5000);
+       connect(m_delayedFileTimer, SIGNAL(timeout()), this, SLOT(handleDelayedFiles()));
+
        //Load translation
        initializeTranslation();
 
@@ -622,6 +699,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
        changeEvent(&languageChangeEvent);
 
        //Enable Drag & Drop
+       m_droppedFileList = new QList<QUrl>();
        this->setAcceptDrops(true);
 }
 
@@ -648,29 +726,38 @@ MainWindow::~MainWindow(void)
        SET_MODEL(ui->metaDataView, NULL);
 
        //Free memory
-       LAMEXP_DELETE(m_tabActionGroup);
-       LAMEXP_DELETE(m_styleActionGroup);
-       LAMEXP_DELETE(m_languageActionGroup);
-       LAMEXP_DELETE(m_banner);
-       LAMEXP_DELETE(m_fileSystemModel);
-       LAMEXP_DELETE(m_messageHandler);
-       LAMEXP_DELETE(m_delayedFileList);
-       LAMEXP_DELETE(m_delayedFileTimer);
-       LAMEXP_DELETE(m_metaInfoModel);
-       LAMEXP_DELETE(m_encoderButtonGroup);
-       LAMEXP_DELETE(m_modeButtonGroup);
-       LAMEXP_DELETE(m_overwriteButtonGroup);
-       LAMEXP_DELETE(m_sourceFilesContextMenu);
-       LAMEXP_DELETE(m_outputFolderFavoritesMenu);
-       LAMEXP_DELETE(m_outputFolderContextMenu);
-       LAMEXP_DELETE(m_dropBox);
-       LAMEXP_DELETE(m_evenFilterCustumParamsHelp);
-       LAMEXP_DELETE(m_evenFilterOutputFolderMouse);
-       LAMEXP_DELETE(m_evenFilterOutputFolderView);
-       LAMEXP_DELETE(m_evenFilterCompressionTab);
+       MUTILS_DELETE(m_tabActionGroup);
+       MUTILS_DELETE(m_styleActionGroup);
+       MUTILS_DELETE(m_languageActionGroup);
+       MUTILS_DELETE(m_banner);
+       MUTILS_DELETE(m_fileSystemModel);
+       MUTILS_DELETE(m_messageHandler);
+       MUTILS_DELETE(m_droppedFileList);
+       MUTILS_DELETE(m_delayedFileList);
+       MUTILS_DELETE(m_delayedFileTimer);
+       MUTILS_DELETE(m_metaInfoModel);
+       MUTILS_DELETE(m_encoderButtonGroup);
+       MUTILS_DELETE(m_modeButtonGroup);
+       MUTILS_DELETE(m_overwriteButtonGroup);
+       MUTILS_DELETE(m_sourceFilesContextMenu);
+       MUTILS_DELETE(m_outputFolderFavoritesMenu);
+       MUTILS_DELETE(m_outputFolderContextMenu);
+       MUTILS_DELETE(m_dropBox);
+       MUTILS_DELETE(m_evenFilterCornerWidget);
+       MUTILS_DELETE(m_evenFilterCustumParamsHelp);
+       MUTILS_DELETE(m_evenFilterOutputFolderMouse);
+       MUTILS_DELETE(m_evenFilterOutputFolderView);
+       MUTILS_DELETE(m_evenFilterCompressionTab);
        
+       //Free window icon
+       if(m_windowIcon)
+       {
+               lamexp_free_window_icon(m_windowIcon);
+               m_windowIcon = NULL;
+       }
+
        //Un-initialize the dialog
-       LAMEXP_DELETE(ui);
+       MUTILS_DELETE(ui);
 }
 
 ////////////////////////////////////////////////////////////
@@ -687,9 +774,12 @@ void MainWindow::addFiles(const QStringList &files)
                return;
        }
 
-       ui->tabWidget->setCurrentIndex(0);
+       WITH_BLOCKED_SIGNALS(ui->tabWidget, setCurrentIndex, 0);
+       tabPageChanged(ui->tabWidget->currentIndex(), true);
 
+       INIT_BANNER();
        FileAnalyzer *analyzer = new FileAnalyzer(files);
+
        connect(analyzer, SIGNAL(fileSelected(QString)), m_banner, SLOT(setText(QString)), Qt::QueuedConnection);
        connect(analyzer, SIGNAL(progressValChanged(unsigned int)), m_banner, SLOT(setProgressVal(unsigned int)), Qt::QueuedConnection);
        connect(analyzer, SIGNAL(progressMaxChanged(unsigned int)), m_banner, SLOT(setProgressMax(unsigned int)), Qt::QueuedConnection);
@@ -731,7 +821,7 @@ void MainWindow::addFiles(const QStringList &files)
                QMessageBox::warning(this, tr("Files Rejected"), QString("%1<br>%2").arg(NOBR(tr("%n file(s) have been rejected, because the file format could not be recognized!", "", analyzer->filesRejected())), NOBR(tr("This usually means the file is damaged or the file format is not supported."))));
        }
 
-       LAMEXP_DELETE(analyzer);
+       MUTILS_DELETE(analyzer);
        m_banner->close();
 }
 
@@ -744,7 +834,7 @@ void MainWindow::addFolder(const QString &path, bool recursive, bool delayed)
        folderInfoList << QFileInfo(path);
        QStringList fileList;
        
-       m_banner->show(tr("Scanning folder(s) for files, please wait..."));
+       SHOW_BANNER(tr("Scanning folder(s) for files, please wait..."));
        
        QApplication::processEvents();
        lamexp_check_escape_state();
@@ -767,7 +857,7 @@ void MainWindow::addFolder(const QString &path, bool recursive, bool delayed)
                        fileList << fileInfoList.takeFirst().canonicalFilePath();
                }
 
-               QApplication::processEvents();
+               QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
 
                if(recursive)
                {
@@ -804,11 +894,12 @@ bool MainWindow::checkForUpdates(void)
 
        if(updateDialog->getSuccess())
        {
+               SHOW_CORNER_WIDGET(false);
                m_settings->autoUpdateLastCheck(QDate::currentDate().toString(Qt::ISODate));
                bReadyToInstall = updateDialog->updateReadyToInstall();
        }
 
-       LAMEXP_DELETE(updateDialog);
+       MUTILS_DELETE(updateDialog);
        return bReadyToInstall;
 }
 
@@ -826,7 +917,7 @@ void MainWindow::refreshFavorites(void)
                QAction *currentItem = folderList.takeFirst();
                if(currentItem->isSeparator()) break;
                m_outputFolderFavoritesMenu->removeAction(currentItem);
-               LAMEXP_DELETE(currentItem);
+               MUTILS_DELETE(currentItem);
        }
 
        QAction *lastItem = m_outputFolderFavoritesMenu->actions().first();
@@ -919,10 +1010,11 @@ void MainWindow::showEvent(QShowEvent *event)
        m_accepted = false;
        resizeEvent(NULL);
        sourceModelChanged();
-       
+
        if(!event->spontaneous())
        {
-               ui->tabWidget->setCurrentIndex(0);
+               WITH_BLOCKED_SIGNALS(ui->tabWidget, setCurrentIndex, 0);
+               tabPageChanged(ui->tabWidget->currentIndex(), true);
        }
 
        if(m_firstTimeShown)
@@ -944,78 +1036,93 @@ void MainWindow::showEvent(QShowEvent *event)
  */
 void MainWindow::changeEvent(QEvent *e)
 {
-       if(e->type() == QEvent::LanguageChange)
+       QMainWindow::changeEvent(e);
+       if(e->type() != QEvent::LanguageChange)
        {
-               /*qWarning("\nMainWindow::changeEvent()\n");*/
+               return;
+       }
 
-               int comboBoxIndex[8];
+       int comboBoxIndex[8];
                
-               //Backup combobox indices, as retranslateUi() resets
-               comboBoxIndex[0] = ui->comboBoxMP3ChannelMode->currentIndex();
-               comboBoxIndex[1] = ui->comboBoxSamplingRate->currentIndex();
-               comboBoxIndex[2] = ui->comboBoxAACProfile->currentIndex();
-               comboBoxIndex[3] = ui->comboBoxAftenCodingMode->currentIndex();
-               comboBoxIndex[4] = ui->comboBoxAftenDRCMode->currentIndex();
-               comboBoxIndex[5] = ui->comboBoxNormalizationMode->currentIndex();
-               comboBoxIndex[6] = 0; //comboBoxOpusOptimize->currentIndex();
-               comboBoxIndex[7] = ui->comboBoxOpusFramesize->currentIndex();
+       //Backup combobox indices, as retranslateUi() resets
+       comboBoxIndex[0] = ui->comboBoxMP3ChannelMode->currentIndex();
+       comboBoxIndex[1] = ui->comboBoxSamplingRate->currentIndex();
+       comboBoxIndex[2] = ui->comboBoxAACProfile->currentIndex();
+       comboBoxIndex[3] = ui->comboBoxAftenCodingMode->currentIndex();
+       comboBoxIndex[4] = ui->comboBoxAftenDRCMode->currentIndex();
+       comboBoxIndex[5] = ui->comboBoxNormalizationMode->currentIndex();
+       comboBoxIndex[6] = 0; //comboBoxOpusOptimize->currentIndex();
+       comboBoxIndex[7] = ui->comboBoxOpusFramesize->currentIndex();
                
-               //Re-translate from UIC
-               ui->retranslateUi(this);
-
-               //Restore combobox indices
-               ui->comboBoxMP3ChannelMode->setCurrentIndex(comboBoxIndex[0]);
-               ui->comboBoxSamplingRate->setCurrentIndex(comboBoxIndex[1]);
-               ui->comboBoxAACProfile->setCurrentIndex(comboBoxIndex[2]);
-               ui->comboBoxAftenCodingMode->setCurrentIndex(comboBoxIndex[3]);
-               ui->comboBoxAftenDRCMode->setCurrentIndex(comboBoxIndex[4]);
-               ui->comboBoxNormalizationMode->setCurrentIndex(comboBoxIndex[5]);
-               //comboBoxOpusOptimize->setCurrentIndex(comboBoxIndex[6]);
-               ui->comboBoxOpusFramesize->setCurrentIndex(comboBoxIndex[7]);
-
-               //Update the window title
-               if(LAMEXP_DEBUG)
-               {
-                       setWindowTitle(QString("%1 [!!! DEBUG BUILD !!!]").arg(windowTitle()));
-               }
-               else if(lamexp_version_demo())
-               {
-                       setWindowTitle(QString("%1 [%2]").arg(windowTitle(), tr("DEMO VERSION")));
-               }
-
-               //Manually re-translate widgets that UIC doesn't handle
-               m_outputFolderNoteBox->setText(tr("Initializing directory outline, please be patient..."));
-               m_dropNoteLabel->setText(QString("<br><br>» %1 Â«<br><br><br><img src=\":/images/Sound.png\">").arg(tr("You can drop in audio files here!")));
-               m_showDetailsContextAction->setText(tr("Show Details"));
-               m_previewContextAction->setText(tr("Open File in External Application"));
-               m_findFileContextAction->setText(tr("Browse File Location"));
-               m_showFolderContextAction->setText(tr("Browse Selected Folder"));
-               m_refreshFolderContextAction->setText(tr("Refresh Directory Outline"));
-               m_goUpFolderContextAction->setText(tr("Go To Parent Directory"));
-               m_addFavoriteFolderAction->setText(tr("Bookmark Current Output Folder"));
-               m_exportCsvContextAction->setText(tr("Export Meta Tags to CSV File"));
-               m_importCsvContextAction->setText(tr("Import Meta Tags from CSV File"));
-
-               //Force GUI update
-               m_metaInfoModel->clearData();
-               m_metaInfoModel->setData(m_metaInfoModel->index(4, 1), m_settings->metaInfoPosition());
-               updateEncoder(m_settings->compressionEncoder());
-               updateLameAlgoQuality(ui->sliderLameAlgoQuality->value());
-               updateMaximumInstances(ui->sliderMaxInstances->value());
-               renameOutputPatternChanged(ui->lineEditRenamePattern->text(), true);
-
-               //Re-install shell integration
-               if(m_settings->shellIntegrationEnabled())
+       //Re-translate from UIC
+       ui->retranslateUi(this);
+
+       //Restore combobox indices
+       ui->comboBoxMP3ChannelMode->setCurrentIndex(comboBoxIndex[0]);
+       ui->comboBoxSamplingRate->setCurrentIndex(comboBoxIndex[1]);
+       ui->comboBoxAACProfile->setCurrentIndex(comboBoxIndex[2]);
+       ui->comboBoxAftenCodingMode->setCurrentIndex(comboBoxIndex[3]);
+       ui->comboBoxAftenDRCMode->setCurrentIndex(comboBoxIndex[4]);
+       ui->comboBoxNormalizationMode->setCurrentIndex(comboBoxIndex[5]);
+       //comboBoxOpusOptimize->setCurrentIndex(comboBoxIndex[6]);
+       ui->comboBoxOpusFramesize->setCurrentIndex(comboBoxIndex[7]);
+
+       //Update the window title
+       if(MUTILS_DEBUG)
+       {
+               setWindowTitle(QString("%1 [!!! DEBUG BUILD !!!]").arg(windowTitle()));
+       }
+       else if(lamexp_version_demo())
+       {
+               setWindowTitle(QString("%1 [%2]").arg(windowTitle(), tr("DEMO VERSION")));
+       }
+
+       //Manually re-translate widgets that UIC doesn't handle
+       m_outputFolderNoteBox->setText(tr("Initializing directory outline, please be patient..."));
+       m_dropNoteLabel->setText(QString("<br><img src=\":/images/DropZone.png\"><br><br>%1").arg(tr("You can drop in audio files here!")));
+       if(QLabel *cornerWidget = dynamic_cast<QLabel*>(ui->menubar->cornerWidget()))
+       {
+               cornerWidget->setText(QString("<nobr><img src=\":/icons/exclamation_small.png\">&nbsp;<b style=\"color:darkred\">%1</b>&nbsp;&nbsp;&nbsp;</nobr>").arg(tr("Check for Updates")));
+       }
+       m_showDetailsContextAction->setText(tr("Show Details"));
+       m_previewContextAction->setText(tr("Open File in External Application"));
+       m_findFileContextAction->setText(tr("Browse File Location"));
+       m_showFolderContextAction->setText(tr("Browse Selected Folder"));
+       m_refreshFolderContextAction->setText(tr("Refresh Directory Outline"));
+       m_goUpFolderContextAction->setText(tr("Go To Parent Directory"));
+       m_addFavoriteFolderAction->setText(tr("Bookmark Current Output Folder"));
+       m_exportCsvContextAction->setText(tr("Export Meta Tags to CSV File"));
+       m_importCsvContextAction->setText(tr("Import Meta Tags from CSV File"));
+
+       //Force GUI update
+       m_metaInfoModel->clearData();
+       m_metaInfoModel->setData(m_metaInfoModel->index(4, 1), m_settings->metaInfoPosition());
+       updateEncoder(m_settings->compressionEncoder());
+       updateLameAlgoQuality(ui->sliderLameAlgoQuality->value());
+       updateMaximumInstances(ui->sliderMaxInstances->value());
+       renameOutputPatternChanged(ui->lineEditRenamePattern->text(), true);
+
+       //Re-install shell integration
+       if(m_settings->shellIntegrationEnabled())
+       {
+               ShellIntegration::install();
+       }
+
+       //Translate system menu
+       lamexp_update_sysmenu(this, IDM_ABOUTBOX, ui->buttonAbout->text());
+       
+       //Force resize event
+       QApplication::postEvent(this, new QResizeEvent(this->size(), QSize()));
+       for(QObjectList::ConstIterator iter = this->children().constBegin(); iter != this->children().constEnd(); iter++)
+       {
+               if(QWidget *child = dynamic_cast<QWidget*>(*iter))
                {
-                       ShellIntegration::install();
+                       QApplication::postEvent(child, new QResizeEvent(child->size(), QSize()));
                }
-
-               //Translate system menu
-               lamexp_update_sysmenu(this, IDM_ABOUTBOX, ui->buttonAbout->text());
-                       
-               //Force resize, if needed
-               tabPageChanged(ui->tabWidget->currentIndex());
        }
+
+       //Force tabe page change
+       tabPageChanged(ui->tabWidget->currentIndex(), true);
 }
 
 /*
@@ -1036,51 +1143,12 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event)
  */
 void MainWindow::dropEvent(QDropEvent *event)
 {
-       ABORT_IF_BUSY;
-
-       QStringList droppedFiles;
-       QList<QUrl> urls = event->mimeData()->urls();
-
-       while(!urls.isEmpty())
-       {
-               QUrl currentUrl = urls.takeFirst();
-               QFileInfo file(currentUrl.toLocalFile());
-               if(!file.exists())
-               {
-                       continue;
-               }
-               if(file.isFile())
-               {
-                       qDebug("Dropped File: %s", file.canonicalFilePath().toUtf8().constData());
-                       droppedFiles << file.canonicalFilePath();
-                       continue;
-               }
-               if(file.isDir())
-               {
-                       qDebug("Dropped Folder: %s", file.canonicalFilePath().toUtf8().constData());
-                       QList<QFileInfo> list = QDir(file.canonicalFilePath()).entryInfoList(QDir::Files | QDir::NoSymLinks);
-                       if(list.count() > 0)
-                       {
-                               for(int j = 0; j < list.count(); j++)
-                               {
-                                       droppedFiles << list.at(j).canonicalFilePath();
-                               }
-                       }
-                       else
-                       {
-                               list = QDir(file.canonicalFilePath()).entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks);
-                               for(int j = 0; j < list.count(); j++)
-                               {
-                                       qDebug("Descending to Folder: %s", list.at(j).canonicalFilePath().toUtf8().constData());
-                                       urls.prepend(QUrl::fromLocalFile(list.at(j).canonicalFilePath()));
-                               }
-                       }
-               }
-       }
-       
-       if(!droppedFiles.isEmpty())
+       m_droppedFileList->clear();
+       (*m_droppedFileList) << event->mimeData()->urls();
+       if(!m_droppedFileList->isEmpty())
        {
-               addFilesDelayed(droppedFiles, true);
+               PLAY_SOUND_OPTIONAL("drop", true);
+               QTimer::singleShot(0, this, SLOT(handleDroppedFiles()));
        }
 }
 
@@ -1089,7 +1157,7 @@ void MainWindow::dropEvent(QDropEvent *event)
  */
 void MainWindow::closeEvent(QCloseEvent *event)
 {
-       if(m_banner->isVisible() || m_delayedFileTimer->isActive())
+       if(BANNER_VISIBLE || m_delayedFileTimer->isActive())
        {
                lamexp_beep(lamexp_beep_warning);
                event->ignore();
@@ -1115,7 +1183,7 @@ void MainWindow::resizeEvent(QResizeEvent *event)
 
        if(QWidget *port = ui->outputFolderView->viewport())
        {
-               m_outputFolderNoteBox->setGeometry(16, (port->height() - 64) / 2, port->width() - 32,  64);
+               m_outputFolderNoteBox->setGeometry(16, (port->height() - 64) / 2, port->width() - 32, 64);
        }
 }
 
@@ -1173,12 +1241,12 @@ bool MainWindow::event(QEvent *e)
 {
        switch(e->type())
        {
-       case lamexp_event_queryendsession:
+       case MUtils::GUI::USER_EVENT_QUERYENDSESSION:
                qWarning("System is shutting down, main window prepares to close...");
-               if(m_banner->isVisible()) m_banner->close();
+               if(BANNER_VISIBLE) m_banner->close();
                if(m_delayedFileTimer->isActive()) m_delayedFileTimer->stop();
                return true;
-       case lamexp_event_endsession:
+       case MUtils::GUI::USER_EVENT_ENDSESSION:
                qWarning("System is shutting down, main window will close now...");
                if(isVisible())
                {
@@ -1223,7 +1291,7 @@ bool MainWindow::winEvent(MSG *message, long *result)
  */
 void MainWindow::windowShown(void)
 {
-       const QStringList &arguments = lamexp_arguments(); //QApplication::arguments();
+       const QStringList &arguments = MUtils::OS::arguments(); //QApplication::arguments();
 
        //Force resize event
        resizeEvent(NULL);
@@ -1246,7 +1314,7 @@ void MainWindow::windowShown(void)
                        AboutDialog *about = new AboutDialog(m_settings, this, true);
                        iAccepted = about->exec();
                        if(iAccepted <= 0) iAccepted = -2;
-                       LAMEXP_DELETE(about);
+                       MUTILS_DELETE(about);
                }
 
                if(iAccepted <= 0)
@@ -1254,7 +1322,7 @@ void MainWindow::windowShown(void)
                        m_settings->licenseAccepted(++iAccepted);
                        m_settings->syncNow();
                        QApplication::processEvents();
-                       lamexp_play_sound(IDR_WAVE_WHAMMY, false);
+                       lamexp_play_sound("whammy", false);
                        QMessageBox::critical(this, tr("License Declined"), tr("You have declined the license. Consequently the application will exit now!"), tr("Goodbye!"));
                        QFileInfo uninstallerInfo = QFileInfo(QString("%1/Uninstall.exe").arg(QApplication::applicationDirPath()));
                        if(uninstallerInfo.exists())
@@ -1270,7 +1338,7 @@ void MainWindow::windowShown(void)
                        return;
                }
                
-               lamexp_play_sound(IDR_WAVE_WOOHOO, false);
+               lamexp_play_sound("woohoo", false);
                m_settings->licenseAccepted(1);
                m_settings->syncNow();
                if(lamexp_version_demo()) showAnnounceBox();
@@ -1279,10 +1347,10 @@ void MainWindow::windowShown(void)
        //Check for expiration
        if(lamexp_version_demo())
        {
-               if(lamexp_current_date_safe() >= lamexp_version_expires())
+               if(MUtils::OS::current_date() >= lamexp_version_expires())
                {
                        qWarning("Binary has expired !!!");
-                       lamexp_play_sound(IDR_WAVE_WHAMMY, false);
+                       lamexp_play_sound("whammy", false);
                        if(QMessageBox::warning(this, tr("LameXP - Expired"), QString("%1<br>%2").arg(NOBR(tr("This demo (pre-release) version of LameXP has expired at %1.").arg(lamexp_version_expires().toString(Qt::ISODate))), NOBR(tr("LameXP is free software and release versions won't expire."))), tr("Check for Updates"), tr("Exit Program")) == 0)
                        {
                                checkForUpdates();
@@ -1306,9 +1374,10 @@ void MainWindow::windowShown(void)
        }
 
        //Update reminder
-       if(lamexp_current_date_safe() >= lamexp_version_date().addYears(1))
+       if(MUtils::OS::current_date() >= MUtils::Version::app_build_date().addYears(1))
        {
                qWarning("Binary is more than a year old, time to update!");
+               SHOW_CORNER_WIDGET(true);
                int ret = QMessageBox::warning(this, tr("Urgent Update"), NOBR(tr("Your version of LameXP is more than a year old. Time for an update!")), tr("Check for Updates"), tr("Exit Program"), tr("Ignore"));
                switch(ret)
                {
@@ -1324,22 +1393,26 @@ void MainWindow::windowShown(void)
                        return;
                default:
                        QEventLoop loop; QTimer::singleShot(7000, &loop, SLOT(quit()));
-                       lamexp_play_sound(IDR_WAVE_WAITING, true);
-                       m_banner->show(tr("Skipping update check this time, please be patient..."), &loop);
+                       lamexp_play_sound("waiting", true);
+                       SHOW_BANNER_ARG(tr("Skipping update check this time, please be patient..."), &loop);
                        break;
                }
        }
-       else if(m_settings->autoUpdateEnabled())
+       else
        {
                QDate lastUpdateCheck = QDate::fromString(m_settings->autoUpdateLastCheck(), Qt::ISODate);
-               if(!firstRun && (!lastUpdateCheck.isValid() || lamexp_current_date_safe() >= lastUpdateCheck.addDays(14)))
+               if((!firstRun) && ((!lastUpdateCheck.isValid()) || (MUtils::OS::current_date() >= lastUpdateCheck.addDays(14))))
                {
-                       if(QMessageBox::information(this, tr("Update Reminder"), NOBR(lastUpdateCheck.isValid() ? tr("Your last update check was more than 14 days ago. Check for updates now?") : tr("Your did not check for LameXP updates yet. Check for updates now?")), tr("Check for Updates"), tr("Postpone")) == 0)
+                       SHOW_CORNER_WIDGET(true);
+                       if(m_settings->autoUpdateEnabled())
                        {
-                               if(checkForUpdates())
+                               if(QMessageBox::information(this, tr("Update Reminder"), NOBR(lastUpdateCheck.isValid() ? tr("Your last update check was more than 14 days ago. Check for updates now?") : tr("Your did not check for LameXP updates yet. Check for updates now?")), tr("Check for Updates"), tr("Postpone")) == 0)
                                {
-                                       QApplication::quit();
-                                       return;
+                                       if(checkForUpdates())
+                                       {
+                                               QApplication::quit();
+                                               return;
+                                       }
                                }
                        }
                }
@@ -1391,7 +1464,7 @@ void MainWindow::windowShown(void)
                if(!arguments[i].compare("--add", Qt::CaseInsensitive))
                {
                        QFileInfo currentFile(arguments[++i].trimmed());
-                       qDebug("Adding file from CLI: %s", currentFile.absoluteFilePath().toUtf8().constData());
+                       qDebug("Adding file from CLI: %s", MUTILS_UTF8(currentFile.absoluteFilePath()));
                        addedFiles.append(currentFile.absoluteFilePath());
                }
                if(!addedFiles.isEmpty())
@@ -1406,13 +1479,13 @@ void MainWindow::windowShown(void)
                if(!arguments[i].compare("--add-folder", Qt::CaseInsensitive))
                {
                        QFileInfo currentFile(arguments[++i].trimmed());
-                       qDebug("Adding folder from CLI: %s", currentFile.absoluteFilePath().toUtf8().constData());
+                       qDebug("Adding folder from CLI: %s", MUTILS_UTF8(currentFile.absoluteFilePath()));
                        addFolder(currentFile.absoluteFilePath(), false, true);
                }
                if(!arguments[i].compare("--add-recursive", Qt::CaseInsensitive))
                {
                        QFileInfo currentFile(arguments[++i].trimmed());
-                       qDebug("Adding folder recursively from CLI: %s", currentFile.absoluteFilePath().toUtf8().constData());
+                       qDebug("Adding folder recursively from CLI: %s", MUTILS_UTF8(currentFile.absoluteFilePath()));
                        addFolder(currentFile.absoluteFilePath(), true, true);
                }
        }
@@ -1482,10 +1555,10 @@ void MainWindow::showAnnounceBox(void)
        for(unsigned int i = 0; i < timeout; i++)
        {
                timers[i]->stop();
-               LAMEXP_DELETE(timers[i]);
+               MUTILS_DELETE(timers[i]);
        }
 
-       LAMEXP_DELETE(announceBox);
+       MUTILS_DELETE(announceBox);
 }
 
 // =========================================================
@@ -1510,7 +1583,7 @@ void MainWindow::encodeButtonClicked(void)
                return;
        }
        
-       QString tempFolder = m_settings->customTempPathEnabled() ? m_settings->customTempPath() : lamexp_temp_folder2();
+       QString tempFolder = m_settings->customTempPathEnabled() ? m_settings->customTempPath() : MUtils::temp_folder();
        if(!QFileInfo(tempFolder).exists() || !QFileInfo(tempFolder).isDir())
        {
                if(QMessageBox::warning(this, tr("Not Found"), QString("%1<br><tt>%2</tt>").arg(NOBR(tr("Your currently selected TEMP folder does not exist anymore:")), NOBR(QDir::toNativeSeparators(tempFolder))), tr("Restore Default"), tr("Cancel")) == 0)
@@ -1527,7 +1600,7 @@ void MainWindow::encodeButtonClicked(void)
        {
                QStringList tempFolderParts = tempFolder.split("/", QString::SkipEmptyParts, Qt::CaseInsensitive);
                tempFolderParts.takeLast();
-               if(m_settings->soundsEnabled()) lamexp_play_sound(IDR_WAVE_WHAMMY, false);
+               PLAY_SOUND_OPTIONAL("whammy", false);
                QString lowDiskspaceMsg = QString("%1<br>%2<br><br>%3<br>%4<br>").arg
                (
                        NOBR(tr("There are less than %1 GB of free diskspace available on your system's TEMP folder.").arg(QString::number(minimumFreeDiskspaceMultiplier))),
@@ -1538,7 +1611,7 @@ void MainWindow::encodeButtonClicked(void)
                switch(QMessageBox::warning(this, tr("Low Diskspace Warning"), lowDiskspaceMsg, tr("Abort Encoding Process"), tr("Clean Disk Now"), tr("Ignore")))
                {
                case 1:
-                       QProcess::startDetached(QString("%1/cleanmgr.exe").arg(lamexp_known_folder(lamexp_folder_systemfolder)), QStringList() << "/D" << tempFolderParts.first());
+                       QProcess::startDetached(QString("%1/cleanmgr.exe").arg(MUtils::OS::known_folder(MUtils::OS::FOLDER_SYSTEMFOLDER)), QStringList() << "/D" << tempFolderParts.first());
                case 0:
                        return;
                        break;
@@ -1557,6 +1630,7 @@ void MainWindow::encodeButtonClicked(void)
        case SettingsModel::FLACEncoder:
        case SettingsModel::OpusEncoder:
        case SettingsModel::DCAEncoder:
+       case SettingsModel::MACEncoder:
        case SettingsModel::PCMEncoder:
                break;
        default:
@@ -1567,7 +1641,7 @@ void MainWindow::encodeButtonClicked(void)
 
        if(!m_settings->outputToSourceDir())
        {
-               QFile writeTest(QString("%1/~%2.txt").arg(m_settings->outputDir(), lamexp_rand_str()));
+               QFile writeTest(QString("%1/~%2.txt").arg(m_settings->outputDir(), MUtils::rand_str()));
                if(!(writeTest.open(QIODevice::ReadWrite) && (writeTest.write(writeTestBuffer) == strlen(writeTestBuffer))))
                {
                        QMessageBox::warning(this, tr("LameXP"), QString("%1<br><nobr>%2</nobr><br><br>%3").arg(tr("Cannot write to the selected output directory."), m_settings->outputDir(), tr("Please choose a different directory!")));
@@ -1596,7 +1670,7 @@ void MainWindow::aboutButtonClicked(void)
        (
                AboutDialog *aboutBox = new AboutDialog(m_settings, this);
                aboutBox->exec();
-               LAMEXP_DELETE(aboutBox);
+               MUTILS_DELETE(aboutBox);
        );
 }
 
@@ -1616,10 +1690,11 @@ void MainWindow::closeButtonClicked(void)
 /*
  * Tab page changed
  */
-void MainWindow::tabPageChanged(int idx)
+void MainWindow::tabPageChanged(int idx, const bool silent)
 {
        resizeEvent(NULL);
        
+       //Update "view" menu
        QList<QAction*> actions = m_tabActionGroup->actions();
        for(int i = 0; i < actions.count(); i++)
        {
@@ -1631,6 +1706,12 @@ void MainWindow::tabPageChanged(int idx)
                }
        }
 
+       //Play tick sound
+       if(!silent)
+       {
+               PLAY_SOUND_OPTIONAL("tick", true);
+       }
+
        int initialWidth = this->width();
        int maximumWidth = QApplication::desktop()->availableGeometry().width();
 
@@ -1698,6 +1779,21 @@ void MainWindow::tabActionActivated(QAction *action)
 }
 
 // =========================================================
+// Menubar slots
+// =========================================================
+
+/*
+ * Handle corner widget Event
+ */
+void MainWindow::cornerWidgetEventOccurred(QWidget *sender, QEvent *event)
+{
+       if(event->type() == QEvent::MouseButtonPress)
+       {
+               QTimer::singleShot(0, this, SLOT(checkUpdatesActionActivated()));
+       }
+}
+
+// =========================================================
 // View menu slots
 // =========================================================
 
@@ -1758,13 +1854,17 @@ void MainWindow::styleActionActivated(QAction *action)
        if(QEvent *e = new QEvent(QEvent::LanguageChange))
        {
                changeEvent(e);
-               LAMEXP_DELETE(e);
+               MUTILS_DELETE(e);
        }
 
        //Make transparent
        const type_info &styleType = typeid(*qApp->style());
        const bool bTransparent = ((typeid(QWindowsVistaStyle) == styleType) || (typeid(QWindowsXPStyle) == styleType));
        MAKE_TRANSPARENT(ui->scrollArea, bTransparent);
+
+       //Also force a re-size event
+       QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
+       resizeEvent(NULL);
 }
 
 /*
@@ -1959,7 +2059,16 @@ void MainWindow::importCueSheetActionTriggered(bool checked)
                                m_settings->mostRecentInputPath(QFileInfo(selectedCueFile).canonicalPath());
                                CueImportDialog *cueImporter  = new CueImportDialog(this, m_fileListModel, selectedCueFile, m_settings);
                                result = cueImporter->exec();
-                               LAMEXP_DELETE(cueImporter);
+                               MUTILS_DELETE(cueImporter);
+                       }
+
+                       if(result == QDialog::Accepted)
+                       {
+                               qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
+                               ui->sourceFileView->update();
+                               qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
+                               ui->sourceFileView->scrollToBottom();
+                               qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
                        }
 
                        if(result != (-1)) break;
@@ -1977,6 +2086,7 @@ void MainWindow::showDropBoxWidgetActionTriggered(bool checked)
        if(!m_dropBox->isVisible())
        {
                m_dropBox->show();
+               QTimer::singleShot(2500, m_dropBox, SLOT(showToolTip()));
        }
        
        lamexp_blink_window(m_dropBox);
@@ -2116,7 +2226,7 @@ void MainWindow::documentActionActivated(void)
                        else
                        {
                                QFile source(resource.filePath());
-                               QFile output(QString("%1/%2.%3.html").arg(lamexp_temp_folder2(), document.baseName(), lamexp_rand_str().left(8)));
+                               QFile output(QString("%1/%2.%3.html").arg(MUtils::temp_folder(), document.baseName(), MUtils::rand_str().left(8)));
                                if(source.open(QIODevice::ReadOnly) && output.open(QIODevice::ReadWrite))
                                {
                                        output.write(source.readAll());
@@ -2305,6 +2415,7 @@ void MainWindow::showDetailsButtonClicked(void)
                        iResult = metaInfoDialog->exec(file, index.row() > 0, index.row() < m_fileListModel->rowCount() - 1);
                );
                
+               //Copy all info to Meta Info tab
                if(iResult == INT_MAX)
                {
                        m_metaInfoModel->assignInfoFrom(file);
@@ -2315,7 +2426,7 @@ void MainWindow::showDetailsButtonClicked(void)
                if(!iResult) break;
        }
 
-       LAMEXP_DELETE(metaInfoDialog);
+       MUTILS_DELETE(metaInfoDialog);
        QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
        sourceFilesScrollbarMoved(0);
 }
@@ -2373,7 +2484,7 @@ void MainWindow::findFileContextActionTriggered(void)
        {
                QString systemRootPath;
 
-               QDir systemRoot(lamexp_known_folder(lamexp_folder_systemfolder));
+               QDir systemRoot(MUtils::OS::known_folder(MUtils::OS::FOLDER_SYSTEMFOLDER));
                if(systemRoot.exists() && systemRoot.cdUp())
                {
                        systemRootPath = systemRoot.canonicalPath();
@@ -2396,6 +2507,73 @@ void MainWindow::findFileContextActionTriggered(void)
 }
 
 /*
+ * Add all dropped files
+ */
+void MainWindow::handleDroppedFiles(void)
+{
+       ABORT_IF_BUSY;
+
+       static const int MIN_COUNT = 16;
+       const QString bannerText = tr("Loading dropped files or folders, please wait...");
+       bool bUseBanner = false;
+
+       SHOW_BANNER_CONDITIONALLY(bUseBanner, (m_droppedFileList->count() >= MIN_COUNT), bannerText);
+
+       QStringList droppedFiles;
+       while(!m_droppedFileList->isEmpty())
+       {
+               QFileInfo file(m_droppedFileList->takeFirst().toLocalFile());
+               QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
+
+               if(!file.exists())
+               {
+                       continue;
+               }
+
+               if(file.isFile())
+               {
+                       qDebug("Dropped File: %s", MUTILS_UTF8(file.canonicalFilePath()));
+                       droppedFiles << file.canonicalFilePath();
+                       continue;
+               }
+
+               if(file.isDir())
+               {
+                       qDebug("Dropped Folder: %s", MUTILS_UTF8(file.canonicalFilePath()));
+                       QFileInfoList list = QDir(file.canonicalFilePath()).entryInfoList(QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks);
+                       if(list.count() > 0)
+                       {
+                               SHOW_BANNER_CONDITIONALLY(bUseBanner, (list.count() >= MIN_COUNT), bannerText);
+                               for(QFileInfoList::ConstIterator iter = list.constBegin(); iter != list.constEnd(); iter++)
+                               {
+                                       droppedFiles << (*iter).canonicalFilePath();
+                               }
+                       }
+                       else
+                       {
+                               list = QDir(file.canonicalFilePath()).entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks);
+                               SHOW_BANNER_CONDITIONALLY(bUseBanner, (list.count() >= MIN_COUNT), bannerText);
+                               for(QFileInfoList::ConstIterator iter = list.constBegin(); iter != list.constEnd(); iter++)
+                               {
+                                       qDebug("Descending to Folder: %s", MUTILS_UTF8((*iter).canonicalFilePath()));
+                                       m_droppedFileList->prepend(QUrl::fromLocalFile((*iter).canonicalFilePath()));
+                               }
+                       }
+               }
+       }
+       
+       if(bUseBanner)
+       {
+               m_banner->close();
+       }
+
+       if(!droppedFiles.isEmpty())
+       {
+               addFiles(droppedFiles);
+       }
+}
+
+/*
  * Add all pending files
  */
 void MainWindow::handleDelayedFiles(void)
@@ -2407,15 +2585,16 @@ void MainWindow::handleDelayedFiles(void)
                return;
        }
 
-       if(m_banner->isVisible())
+       if(BANNER_VISIBLE)
        {
                m_delayedFileTimer->start(5000);
                return;
        }
-
+       
+       WITH_BLOCKED_SIGNALS(ui->tabWidget, setCurrentIndex, 0);
+       tabPageChanged(ui->tabWidget->currentIndex(), true);
+       
        QStringList selectedFiles;
-       ui->tabWidget->setCurrentIndex(0);
-
        while(!m_delayedFileList->isEmpty())
        {
                QFileInfo currentFile = QFileInfo(m_delayedFileList->takeFirst());
@@ -2705,26 +2884,24 @@ void MainWindow::makeFolderButtonClicked(void)
        QDir basePath(m_fileSystemModel->fileInfo(ui->outputFolderView->currentIndex()).absoluteFilePath());
        QString suggestedName = tr("New Folder");
 
-       const AudioFileModel_MetaInfo &metaInfo = m_metaData->metaInfo();
-
-       if(!metaInfo.artist().isEmpty() && !metaInfo.album().isEmpty())
+       if(!m_metaData->artist().isEmpty() && !m_metaData->album().isEmpty())
        {
-               suggestedName = QString("%1 - %2").arg(metaInfo.artist(), metaInfo.album());
+               suggestedName = QString("%1 - %2").arg(m_metaData->artist(),m_metaData->album());
        }
-       else if(!metaInfo.artist().isEmpty())
+       else if(!m_metaData->artist().isEmpty())
        {
-               suggestedName = metaInfo.artist();
+               suggestedName = m_metaData->artist();
        }
-       else if(!metaInfo.album().isEmpty())
+       else if(!m_metaData->album().isEmpty())
        {
-               suggestedName = metaInfo.album();
+               suggestedName =m_metaData->album();
        }
        else
        {
                for(int i = 0; i < m_fileListModel->rowCount(); i++)
                {
                        const AudioFileModel &audioFile = m_fileListModel->getFile(m_fileListModel->index(i, 0));
-                       const AudioFileModel_MetaInfo &fileMetaInfo = m_metaData->metaInfo();
+                       const AudioFileModel_MetaInfo &fileMetaInfo = audioFile.metaInfo();
 
                        if(!fileMetaInfo.album().isEmpty() || !fileMetaInfo.artist().isEmpty())
                        {
@@ -2967,7 +3144,7 @@ void MainWindow::initOutputFolderModel(void)
                if(m_fileSystemModel)
                {
                        SET_MODEL(ui->outputFolderView, NULL);
-                       LAMEXP_DELETE(m_fileSystemModel);
+                       MUTILS_DELETE(m_fileSystemModel);
                        ui->outputFolderView->repaint();
                }
 
@@ -3165,7 +3342,7 @@ void MainWindow::outputFolderMouseEventOccurred(QWidget *sender, QEvent *event)
                                }
                                else
                                {
-                                       throw "Oups, this is not supposed to happen!";
+                                       THROW("Oups, this is not supposed to happen!");
                                }
                        }
                }
@@ -3191,7 +3368,7 @@ void MainWindow::editMetaButtonClicked(void)
        
                if(index.row() == 4)
                {
-                       m_settings->metaInfoPosition(m_metaData->metaInfo().position());
+                       m_settings->metaInfoPosition(m_metaData->position());
                }
        }
 }
@@ -3244,7 +3421,7 @@ void MainWindow::updateEncoder(int id)
        if(ui->radioButtonModeQuality->isEnabled())             ui->radioButtonModeQuality->setChecked(true);
        else if(ui->radioButtonModeAverageBitrate->isEnabled()) ui->radioButtonModeAverageBitrate->setChecked(true);
        else if(ui->radioButtonConstBitrate->isEnabled())       ui->radioButtonConstBitrate->setChecked(true);
-       else throw "It appears that the encoder does not support *any* RC mode!";
+       else THROW("It appears that the encoder does not support *any* RC mode!");
 
        //Apply current RC mode
        const int currentRCMode = EncoderRegistry::loadEncoderMode(m_settings, id);
@@ -3253,7 +3430,7 @@ void MainWindow::updateEncoder(int id)
                case SettingsModel::VBRMode: if(ui->radioButtonModeQuality->isEnabled())        ui->radioButtonModeQuality->setChecked(true);        break;
                case SettingsModel::ABRMode: if(ui->radioButtonModeAverageBitrate->isEnabled()) ui->radioButtonModeAverageBitrate->setChecked(true); break;
                case SettingsModel::CBRMode: if(ui->radioButtonConstBitrate->isEnabled())       ui->radioButtonConstBitrate->setChecked(true);       break;
-               default: throw "updateEncoder(): Unknown rc-mode encountered!";
+               default: THROW("updateEncoder(): Unknown rc-mode encountered!");
        }
 
        //Display encoder description
@@ -3374,7 +3551,7 @@ void MainWindow::updateBitrate(int value)
                ui->labelBitrate->setText(tr("Uncompressed"));
                break;
        default:
-               throw "Unknown display value type encountered!";
+               THROW("Unknown display value type encountered!");
                break;
        }
 }
@@ -3392,11 +3569,7 @@ void MainWindow::compressionTabEventOccurred(QWidget *sender, QEvent *event)
        }
        else if((sender == ui->labelResetEncoders) && (event->type() == QEvent::MouseButtonPress))
        {
-               if(m_settings->soundsEnabled())
-               {
-                       lamexp_play_sound(IDR_WAVE_BLAST, true);
-               }
-
+               PLAY_SOUND_OPTIONAL("blast", true);
                EncoderRegistry::resetAllEncoders(m_settings);
                m_settings->compressionEncoder(SettingsModel::MP3Encoder);
                ui->radioButtonEncoderMP3->setChecked(true);
@@ -3774,7 +3947,7 @@ void MainWindow::browseCustomTempFolderButtonClicked(void)
 
        if(!newTempFolder.isEmpty())
        {
-               QFile writeTest(QString("%1/~%2.tmp").arg(newTempFolder, lamexp_rand_str()));
+               QFile writeTest(QString("%1/~%2.tmp").arg(newTempFolder, MUtils::rand_str()));
                if(writeTest.open(QIODevice::ReadWrite))
                {
                        writeTest.remove();
@@ -3853,30 +4026,31 @@ void MainWindow::showCustomParamsHelpScreen(const QString &toolName, const QStri
                return;
        }
 
-       QProcess *process = new QProcess();
-       process->setProcessChannelMode(QProcess::MergedChannels);
-       process->setReadChannel(QProcess::StandardOutput);
-       process->start(binary, command.isEmpty() ? QStringList() : QStringList() << command);
+       QProcess process;
+       MUtils::init_process(process, QFileInfo(binary).absolutePath());
+
+       process.start(binary, command.isEmpty() ? QStringList() : QStringList() << command);
+
        qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
 
-       if(process->waitForStarted(15000))
+       if(process.waitForStarted(15000))
        {
                qApp->processEvents();
-               process->waitForFinished(15000);
+               process.waitForFinished(15000);
        }
        
-       if(process->state() != QProcess::NotRunning)
+       if(process.state() != QProcess::NotRunning)
        {
-               process->kill();
-               process->waitForFinished(-1);
+               process.kill();
+               process.waitForFinished(-1);
        }
 
        qApp->restoreOverrideCursor();
        QStringList output; bool spaceFlag = true;
 
-       while(process->canReadLine())
+       while(process.canReadLine())
        {
-               QString temp = QString::fromUtf8(process->readLine());
+               QString temp = QString::fromUtf8(process.readLine());
                TRIM_STRING_RIGHT(temp);
                if(temp.isEmpty())
                {
@@ -3888,8 +4062,6 @@ void MainWindow::showCustomParamsHelpScreen(const QString &toolName, const QStri
                }
        }
 
-       LAMEXP_DELETE(process);
-
        if(output.count() < 1)
        {
                qWarning("Empty output, cannot show help screen!");
@@ -3898,7 +4070,7 @@ void MainWindow::showCustomParamsHelpScreen(const QString &toolName, const QStri
 
        LogViewDialog *dialog = new LogViewDialog(this);
        TEMP_HIDE_DROPBOX( dialog->exec(output); );
-       LAMEXP_DELETE(dialog);
+       MUTILS_DELETE(dialog);
 }
 
 void MainWindow::overwriteModeChanged(int id)
@@ -3921,10 +4093,7 @@ void MainWindow::overwriteModeChanged(int id)
  */
 void MainWindow::resetAdvancedOptionsButtonClicked(void)
 {
-       if(m_settings->soundsEnabled())
-       {
-               lamexp_play_sound(IDR_WAVE_BLAST, true);
-       }
+       PLAY_SOUND_OPTIONAL("blast", true);
 
        ui->sliderLameAlgoQuality->setValue(m_settings->lameAlgoQualityDefault());
        ui->spinBoxBitrateManagementMin->setValue(m_settings->bitrateManagementMinRateDefault());
@@ -3977,7 +4146,7 @@ void MainWindow::resetAdvancedOptionsButtonClicked(void)
  */
 void MainWindow::notifyOtherInstance(void)
 {
-       if(!m_banner->isVisible())
+       if(!(BANNER_VISIBLE))
        {
                QMessageBox msgBox(QMessageBox::Warning, tr("Already Running"), tr("LameXP is already running, please use the running instance!"), QMessageBox::NoButton, this, Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint | Qt::WindowStaysOnTopHint);
                msgBox.exec();
@@ -3991,13 +4160,13 @@ void MainWindow::addFileDelayed(const QString &filePath, bool tryASAP)
 {
        if(tryASAP && !m_delayedFileTimer->isActive())
        {
-               qDebug("Received file: %s", filePath.toUtf8().constData());
+               qDebug("Received file: %s", MUTILS_UTF8(filePath));
                m_delayedFileList->append(filePath);
                QTimer::singleShot(0, this, SLOT(handleDelayedFiles()));
        }
        
        m_delayedFileTimer->stop();
-       qDebug("Received file: %s", filePath.toUtf8().constData());
+       qDebug("Received file: %s", MUTILS_UTF8(filePath));
        m_delayedFileList->append(filePath);
        m_delayedFileTimer->start(5000);
 }
@@ -4007,7 +4176,7 @@ void MainWindow::addFileDelayed(const QString &filePath, bool tryASAP)
  */
 void MainWindow::addFilesDelayed(const QStringList &filePaths, bool tryASAP)
 {
-       if(tryASAP && !m_delayedFileTimer->isActive())
+       if(tryASAP && (!m_delayedFileTimer->isActive()))
        {
                qDebug("Received %d file(s).", filePaths.count());
                m_delayedFileList->append(filePaths);
@@ -4027,7 +4196,7 @@ void MainWindow::addFilesDelayed(const QStringList &filePaths, bool tryASAP)
  */
 void MainWindow::addFolderDelayed(const QString &folderPath, bool recursive)
 {
-       if(!m_banner->isVisible())
+       if(!(BANNER_VISIBLE))
        {
                addFolder(folderPath, recursive, true);
        }