From dc98131fd16e9afa80650a6850849c3f1e2ceceb Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Sun, 30 Nov 2014 21:32:23 +0100 Subject: [PATCH] Moved various auxiliary macros into the MUtils library. --- src/Config.h | 2 +- src/Decoder_AAC.cpp | 7 ++- src/Decoder_AC3.cpp | 7 ++- src/Decoder_ADPCM.cpp | 7 ++- src/Decoder_ALAC.cpp | 7 ++- src/Decoder_Avisynth.cpp | 8 ++- src/Decoder_FLAC.cpp | 7 ++- src/Decoder_MAC.cpp | 7 ++- src/Decoder_MP3.cpp | 7 ++- src/Decoder_Musepack.cpp | 7 ++- src/Decoder_Opus.cpp | 7 ++- src/Decoder_Shorten.cpp | 7 ++- src/Decoder_Speex.cpp | 7 ++- src/Decoder_TTA.cpp | 7 ++- src/Decoder_Vorbis.cpp | 7 ++- src/Decoder_WMA.cpp | 7 ++- src/Decoder_WavPack.cpp | 7 ++- src/Dialog_MainWindow.cpp | 9 +-- src/Dialog_Update.cpp | 15 +---- src/Encoder_AAC.cpp | 12 ++-- src/Encoder_AAC_FHG.cpp | 12 ++-- src/Encoder_AAC_QAAC.cpp | 12 ++-- src/Encoder_AC3.cpp | 12 ++-- src/Encoder_Abstract.h | 6 +- src/Encoder_DCA.cpp | 10 +-- src/Encoder_FLAC.cpp | 10 +-- src/Encoder_MAC.cpp | 12 ++-- src/Encoder_MP3.cpp | 12 ++-- src/Encoder_Opus.cpp | 12 ++-- src/Encoder_Vorbis.cpp | 12 ++-- src/Encoder_Wave.cpp | 8 +-- src/Filter_Downmix.cpp | 7 ++- src/Filter_Normalize.cpp | 7 ++- src/Filter_Resample.cpp | 7 ++- src/Filter_ToneAdjust.cpp | 7 ++- src/Global.h | 47 -------------- src/Global_IPC.cpp | 7 ++- src/Global_Tools.cpp | 9 +-- src/Global_Utils.cpp | 7 ++- src/Global_Version.cpp | 2 +- src/Global_Win32.cpp | 104 ++----------------------------- src/LockedFile.cpp | 37 +++++++---- src/Model_CueSheet.cpp | 7 ++- src/Model_Settings.cpp | 3 +- src/Registry_Encoder.cpp | 30 ++++----- src/ShellIntegration.cpp | 3 +- src/Thread_CPUObserver.cpp | 5 +- src/Thread_CueSplitter.cpp | 3 +- src/Thread_DiskObserver.cpp | 5 +- src/Thread_FileAnalyzer.cpp | 3 +- src/Thread_FileAnalyzer_Task.cpp | 5 +- src/Thread_Initialization.cpp | 13 ++-- src/Thread_Process.cpp | 12 ++-- src/Thread_RAMObserver.cpp | 5 +- src/Tool_Abstract.cpp | 3 +- src/Tool_WaveProperties.cpp | 7 ++- src/WinSevenTaskbar.cpp | 6 +- 57 files changed, 303 insertions(+), 317 deletions(-) diff --git a/src/Config.h b/src/Config.h index 6b8f54c0..5e02420e 100644 --- a/src/Config.h +++ b/src/Config.h @@ -35,7 +35,7 @@ #define VER_LAMEXP_MINOR_LO 1 #define VER_LAMEXP_TYPE Beta #define VER_LAMEXP_PATCH 3 -#define VER_LAMEXP_BUILD 1607 +#define VER_LAMEXP_BUILD 1608 #define VER_LAMEXP_CONFG 1558 /////////////////////////////////////////////////////////////////////////////// diff --git a/src/Decoder_AAC.cpp b/src/Decoder_AAC.cpp index 91a978e2..e9a4c5c2 100644 --- a/src/Decoder_AAC.cpp +++ b/src/Decoder_AAC.cpp @@ -22,8 +22,13 @@ #include "Decoder_AAC.h" +//Internal #include "Global.h" +//MUtils +#include + +//Qt #include #include #include @@ -34,7 +39,7 @@ AACDecoder::AACDecoder(void) { if(m_binary.isEmpty()) { - THROW("Error initializing AAC decoder. Tool 'faad.exe' is not registred!"); + MUTILS_THROW("Error initializing AAC decoder. Tool 'faad.exe' is not registred!"); } } diff --git a/src/Decoder_AC3.cpp b/src/Decoder_AC3.cpp index 2bf65f5b..e8255a02 100644 --- a/src/Decoder_AC3.cpp +++ b/src/Decoder_AC3.cpp @@ -22,8 +22,13 @@ #include "Decoder_AC3.h" +//Internal #include "Global.h" +//MUtils +#include + +//Qt #include #include #include @@ -34,7 +39,7 @@ AC3Decoder::AC3Decoder(void) { if(m_binary.isEmpty()) { - THROW("Error initializing Valib decoder. Tool 'valdec.exe' is not registred!"); + MUTILS_THROW("Error initializing Valib decoder. Tool 'valdec.exe' is not registred!"); } } diff --git a/src/Decoder_ADPCM.cpp b/src/Decoder_ADPCM.cpp index 79101b1a..5c0762f9 100644 --- a/src/Decoder_ADPCM.cpp +++ b/src/Decoder_ADPCM.cpp @@ -22,8 +22,13 @@ #include "Decoder_ADPCM.h" +//Internal #include "Global.h" +//MUtils +#include + +//Qt #include #include #include @@ -34,7 +39,7 @@ ADPCMDecoder::ADPCMDecoder(void) { if(m_binary.isEmpty()) { - THROW("Error initializing Vorbis decoder. Tool 'sox.exe' is not registred!"); + MUTILS_THROW("Error initializing Vorbis decoder. Tool 'sox.exe' is not registred!"); } } diff --git a/src/Decoder_ALAC.cpp b/src/Decoder_ALAC.cpp index 6767eaef..17b3f36c 100644 --- a/src/Decoder_ALAC.cpp +++ b/src/Decoder_ALAC.cpp @@ -22,8 +22,13 @@ #include "Decoder_ALAC.h" +//Internal #include "Global.h" +//MUtils +#include + +//Qt #include #include #include @@ -35,7 +40,7 @@ ALACDecoder::ALACDecoder(void) { if(m_binary.isEmpty()) { - THROW("Error initializing ALAC decoder. Tool 'refalac.exe' is not registred!"); + MUTILS_THROW("Error initializing ALAC decoder. Tool 'refalac.exe' is not registred!"); } } diff --git a/src/Decoder_Avisynth.cpp b/src/Decoder_Avisynth.cpp index 0de7cbdd..e235f827 100644 --- a/src/Decoder_Avisynth.cpp +++ b/src/Decoder_Avisynth.cpp @@ -22,8 +22,14 @@ #include "Decoder_Avisynth.h" + +//Internal #include "Global.h" +//MUtils +#include + +//Qt #include #include #include @@ -34,7 +40,7 @@ AvisynthDecoder::AvisynthDecoder(void) { if(m_binary.isEmpty()) { - THROW("Error initializing Avisynth decoder. Tool 'avs2wav.exe' is not registred!"); + MUTILS_THROW("Error initializing Avisynth decoder. Tool 'avs2wav.exe' is not registred!"); } } diff --git a/src/Decoder_FLAC.cpp b/src/Decoder_FLAC.cpp index e9c23799..5e634417 100644 --- a/src/Decoder_FLAC.cpp +++ b/src/Decoder_FLAC.cpp @@ -22,8 +22,13 @@ #include "Decoder_FLAC.h" +//Internal #include "Global.h" +//MUtils +#include + +//Qt #include #include #include @@ -34,7 +39,7 @@ FLACDecoder::FLACDecoder(void) { if(m_binary.isEmpty()) { - THROW("Error initializing FLAC decoder. Tool 'flac.exe' is not registred!"); + MUTILS_THROW("Error initializing FLAC decoder. Tool 'flac.exe' is not registred!"); } } diff --git a/src/Decoder_MAC.cpp b/src/Decoder_MAC.cpp index 3b005211..34b1b0fd 100644 --- a/src/Decoder_MAC.cpp +++ b/src/Decoder_MAC.cpp @@ -22,8 +22,13 @@ #include "Decoder_MAC.h" +//Internal #include "Global.h" +//MUtils +#include + +//Qt #include #include #include @@ -34,7 +39,7 @@ MACDecoder::MACDecoder(void) { if(m_binary.isEmpty()) { - THROW("Error initializing MAC decoder. Tool 'mac.exe' is not registred!"); + MUTILS_THROW("Error initializing MAC decoder. Tool 'mac.exe' is not registred!"); } } diff --git a/src/Decoder_MP3.cpp b/src/Decoder_MP3.cpp index 5baffbfa..da6d9ead 100644 --- a/src/Decoder_MP3.cpp +++ b/src/Decoder_MP3.cpp @@ -22,8 +22,13 @@ #include "Decoder_MP3.h" +//Internal #include "Global.h" +//MUtils +#include + +//Qt #include #include #include @@ -34,7 +39,7 @@ MP3Decoder::MP3Decoder(void) { if(m_binary.isEmpty()) { - THROW("Error initializing MPG123 decoder. Tool 'mpg123.exe' is not registred!"); + MUTILS_THROW("Error initializing MPG123 decoder. Tool 'mpg123.exe' is not registred!"); } } diff --git a/src/Decoder_Musepack.cpp b/src/Decoder_Musepack.cpp index 2f8d0cd5..8c1f895c 100644 --- a/src/Decoder_Musepack.cpp +++ b/src/Decoder_Musepack.cpp @@ -22,8 +22,13 @@ #include "Decoder_Musepack.h" +//Internal #include "Global.h" +//MUtils +#include + +//Qt #include #include #include @@ -35,7 +40,7 @@ MusepackDecoder::MusepackDecoder(void) { if(m_binary.isEmpty()) { - THROW("Error initializing Musepack decoder. Tool 'mpcdec.exe' is not registred!"); + MUTILS_THROW("Error initializing Musepack decoder. Tool 'mpcdec.exe' is not registred!"); } } diff --git a/src/Decoder_Opus.cpp b/src/Decoder_Opus.cpp index d5d58290..60e9584c 100644 --- a/src/Decoder_Opus.cpp +++ b/src/Decoder_Opus.cpp @@ -22,8 +22,13 @@ #include "Decoder_Opus.h" +//Internal #include "Global.h" +//MUtils +#include + +//Qt #include #include #include @@ -37,7 +42,7 @@ OpusDecoder::OpusDecoder(void) { if(m_binary.isEmpty()) { - THROW("Error initializing Opus decoder. Tool 'opusdec.exe' is not registred!"); + MUTILS_THROW("Error initializing Opus decoder. Tool 'opusdec.exe' is not registred!"); } } diff --git a/src/Decoder_Shorten.cpp b/src/Decoder_Shorten.cpp index 9ef46e21..4527187d 100644 --- a/src/Decoder_Shorten.cpp +++ b/src/Decoder_Shorten.cpp @@ -22,8 +22,13 @@ #include "Decoder_Shorten.h" +//Internal #include "Global.h" +//MUtils +#include + +//Qt #include #include #include @@ -35,7 +40,7 @@ ShortenDecoder::ShortenDecoder(void) { if(m_binary.isEmpty()) { - THROW("Error initializing Shorten decoder. Tool 'shorten.exe' is not registred!"); + MUTILS_THROW("Error initializing Shorten decoder. Tool 'shorten.exe' is not registred!"); } } diff --git a/src/Decoder_Speex.cpp b/src/Decoder_Speex.cpp index f6da0fb3..e5bc0857 100644 --- a/src/Decoder_Speex.cpp +++ b/src/Decoder_Speex.cpp @@ -22,8 +22,13 @@ #include "Decoder_Speex.h" +//Internal #include "Global.h" +//MUtils +#include + +//Qt #include #include #include @@ -34,7 +39,7 @@ SpeexDecoder::SpeexDecoder(void) { if(m_binary.isEmpty()) { - THROW("Error initializing Speex decoder. Tool 'speexdec.exe' is not registred!"); + MUTILS_THROW("Error initializing Speex decoder. Tool 'speexdec.exe' is not registred!"); } } diff --git a/src/Decoder_TTA.cpp b/src/Decoder_TTA.cpp index 310fec7c..e42551fb 100644 --- a/src/Decoder_TTA.cpp +++ b/src/Decoder_TTA.cpp @@ -22,8 +22,13 @@ #include "Decoder_TTA.h" +//Internal #include "Global.h" +//MUtils +#include + +//Qt #include #include #include @@ -35,7 +40,7 @@ TTADecoder::TTADecoder(void) { if(m_binary.isEmpty()) { - THROW("Error initializing TTA decoder. Tool 'ttaenc.exe' is not registred!"); + MUTILS_THROW("Error initializing TTA decoder. Tool 'ttaenc.exe' is not registred!"); } } diff --git a/src/Decoder_Vorbis.cpp b/src/Decoder_Vorbis.cpp index a3de44d4..87425cde 100644 --- a/src/Decoder_Vorbis.cpp +++ b/src/Decoder_Vorbis.cpp @@ -22,8 +22,13 @@ #include "Decoder_Vorbis.h" +//Internal #include "Global.h" +//MUtils +#include + +//Qt #include #include #include @@ -34,7 +39,7 @@ VorbisDecoder::VorbisDecoder(void) { if(m_binary.isEmpty()) { - THROW("Error initializing Vorbis decoder. Tool 'oggdec.exe' is not registred!"); + MUTILS_THROW("Error initializing Vorbis decoder. Tool 'oggdec.exe' is not registred!"); } } diff --git a/src/Decoder_WMA.cpp b/src/Decoder_WMA.cpp index ba77891a..d9942a34 100644 --- a/src/Decoder_WMA.cpp +++ b/src/Decoder_WMA.cpp @@ -22,8 +22,13 @@ #include "Decoder_WMA.h" +//Internal #include "Global.h" +//MUtils +#include + +//Qt #include #include #include @@ -36,7 +41,7 @@ WMADecoder::WMADecoder(void) { if(m_binary.isEmpty()) { - THROW("Error initializing WMA decoder. Tool 'wma2wav.exe' is not registred!"); + MUTILS_THROW("Error initializing WMA decoder. Tool 'wma2wav.exe' is not registred!"); } } diff --git a/src/Decoder_WavPack.cpp b/src/Decoder_WavPack.cpp index 128c4c55..f96372b8 100644 --- a/src/Decoder_WavPack.cpp +++ b/src/Decoder_WavPack.cpp @@ -22,8 +22,13 @@ #include "Decoder_WavPack.h" +//Internal #include "Global.h" +//MUtils +#include + +//Qt #include #include #include @@ -34,7 +39,7 @@ WavPackDecoder::WavPackDecoder(void) { if(m_binary.isEmpty()) { - THROW("Error initializing WavPack decoder. Tool 'wvunpack.exe' is not registred!"); + MUTILS_THROW("Error initializing WavPack decoder. Tool 'wvunpack.exe' is not registred!"); } } diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp index d687204c..4e408d17 100644 --- a/src/Dialog_MainWindow.cpp +++ b/src/Dialog_MainWindow.cpp @@ -51,6 +51,7 @@ #include #include #include +#include #include //Qt includes @@ -3342,7 +3343,7 @@ void MainWindow::outputFolderMouseEventOccurred(QWidget *sender, QEvent *event) } else { - THROW("Oups, this is not supposed to happen!"); + MUTILS_THROW("Oups, this is not supposed to happen!"); } } } @@ -3421,7 +3422,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 MUTILS_THROW("It appears that the encoder does not support *any* RC mode!"); //Apply current RC mode const int currentRCMode = EncoderRegistry::loadEncoderMode(m_settings, id); @@ -3430,7 +3431,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: MUTILS_THROW("updateEncoder(): Unknown rc-mode encountered!"); } //Display encoder description @@ -3551,7 +3552,7 @@ void MainWindow::updateBitrate(int value) ui->labelBitrate->setText(tr("Uncompressed")); break; default: - THROW("Unknown display value type encountered!"); + MUTILS_THROW("Unknown display value type encountered!"); break; } } diff --git a/src/Dialog_Update.cpp b/src/Dialog_Update.cpp index 8ce6fca2..bf8d385d 100644 --- a/src/Dialog_Update.cpp +++ b/src/Dialog_Update.cpp @@ -34,6 +34,7 @@ //MUtils #include #include +#include //Qt includes #include @@ -48,18 +49,6 @@ /////////////////////////////////////////////////////////////////////////////// -/* -template -T DO_ASYNC(T (*functionPointer)()) -{ - QFutureWatcher watcher; QEventLoop loop; - QObject::connect(&watcher, SIGNAL(finished()), &loop, SLOT(quit())); - watcher.setFuture(QtConcurrent::run(functionPointer)); - loop.exec(QEventLoop::ExcludeUserInputEvents); - return watcher.result(); -} -*/ - #define SHOW_HINT(TEXT, ICON) do \ { \ ui->hintLabel->setText((TEXT)); \ @@ -97,7 +86,7 @@ UpdateDialog::UpdateDialog(SettingsModel *settings, QWidget *parent) { if(m_binaryUpdater.isEmpty()) { - THROW("Tools not initialized correctly!"); + MUTILS_THROW("Tools not initialized correctly!"); } //Init the dialog, from the .ui file diff --git a/src/Encoder_AAC.cpp b/src/Encoder_AAC.cpp index 15c28dde..cb215798 100644 --- a/src/Encoder_AAC.cpp +++ b/src/Encoder_AAC.cpp @@ -49,7 +49,7 @@ class AACEncoderInfo : public AbstractEncoderInfo return true; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -65,7 +65,7 @@ class AACEncoderInfo : public AbstractEncoderInfo return 41; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -81,7 +81,7 @@ class AACEncoderInfo : public AbstractEncoderInfo return qBound(8, index2bitrate(index), 400); break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -99,7 +99,7 @@ class AACEncoderInfo : public AbstractEncoderInfo return TYPE_BITRATE; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -123,7 +123,7 @@ AACEncoder::AACEncoder(void) { if(m_binary_enc.isEmpty() || m_binary_tag.isEmpty() || m_binary_sox.isEmpty()) { - THROW("Error initializing AAC encoder. Tool 'neroAacEnc.exe' is not registred!"); + MUTILS_THROW("Error initializing AAC encoder. Tool 'neroAacEnc.exe' is not registred!"); } m_configProfile = 0; @@ -152,7 +152,7 @@ bool AACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo args << "-cbr" << QString::number(qBound(8, index2bitrate(m_configBitrate), 400) * 1000); break; default: - THROW("Bad rate-control mode!"); + MUTILS_THROW("Bad rate-control mode!"); break; } diff --git a/src/Encoder_AAC_FHG.cpp b/src/Encoder_AAC_FHG.cpp index 9d4c78ad..f8b03601 100644 --- a/src/Encoder_AAC_FHG.cpp +++ b/src/Encoder_AAC_FHG.cpp @@ -52,7 +52,7 @@ class FHGAACEncoderInfo : public AbstractEncoderInfo return false; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -68,7 +68,7 @@ class FHGAACEncoderInfo : public AbstractEncoderInfo return 52; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -84,7 +84,7 @@ class FHGAACEncoderInfo : public AbstractEncoderInfo return qBound(8, index2bitrate(index), 576); break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -102,7 +102,7 @@ class FHGAACEncoderInfo : public AbstractEncoderInfo return TYPE_BITRATE; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -125,7 +125,7 @@ FHGAACEncoder::FHGAACEncoder(void) { if(m_binary_enc.isEmpty() || m_binary_dll.isEmpty()) { - THROW("Error initializing FhgAacEnc. Tool 'fhgaacenc.exe' is not registred!"); + MUTILS_THROW("Error initializing FhgAacEnc. Tool 'fhgaacenc.exe' is not registred!"); } m_configProfile = 0; @@ -169,7 +169,7 @@ bool FHGAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaI args << "--vbr" << QString::number(qBound(1, m_configBitrate + 1, 6)); break; default: - THROW("Bad rate-control mode!"); + MUTILS_THROW("Bad rate-control mode!"); break; } diff --git a/src/Encoder_AAC_QAAC.cpp b/src/Encoder_AAC_QAAC.cpp index bfe12da7..9143d11b 100644 --- a/src/Encoder_AAC_QAAC.cpp +++ b/src/Encoder_AAC_QAAC.cpp @@ -60,7 +60,7 @@ class QAACEncoderInfo : public AbstractEncoderInfo return true; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -76,7 +76,7 @@ class QAACEncoderInfo : public AbstractEncoderInfo return 52; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -92,7 +92,7 @@ class QAACEncoderInfo : public AbstractEncoderInfo return qBound(8, index2bitrate(index), 576); break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -110,7 +110,7 @@ class QAACEncoderInfo : public AbstractEncoderInfo return TYPE_BITRATE; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -134,7 +134,7 @@ QAACEncoder::QAACEncoder(void) { if(m_binary_qaac.isEmpty() || m_binary_soxr.isEmpty() || m_binary_soxc.isEmpty()) { - THROW("Error initializing QAAC. Tool 'qaac.exe' is not registred!"); + MUTILS_THROW("Error initializing QAAC. Tool 'qaac.exe' is not registred!"); } m_configProfile = 0; @@ -178,7 +178,7 @@ bool QAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf args << "--tvbr" << QString::number(g_qaacVBRQualityLUT[qBound(0, m_configBitrate , 14)]); break; default: - THROW("Bad rate-control mode!"); + MUTILS_THROW("Bad rate-control mode!"); break; } diff --git a/src/Encoder_AC3.cpp b/src/Encoder_AC3.cpp index 5d35fa38..ee04dd93 100644 --- a/src/Encoder_AC3.cpp +++ b/src/Encoder_AC3.cpp @@ -48,7 +48,7 @@ class AC3EncoderInfo : public AbstractEncoderInfo return false; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -66,7 +66,7 @@ class AC3EncoderInfo : public AbstractEncoderInfo return 19; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -82,7 +82,7 @@ class AC3EncoderInfo : public AbstractEncoderInfo return g_ac3BitratesLUT[qBound(0, index, 18)]; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -98,7 +98,7 @@ class AC3EncoderInfo : public AbstractEncoderInfo return TYPE_BITRATE; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -120,7 +120,7 @@ AC3Encoder::AC3Encoder(void) { if(m_binary.isEmpty()) { - THROW("Error initializing FLAC encoder. Tool 'aften.exe' is not registred!"); + MUTILS_THROW("Error initializing FLAC encoder. Tool 'aften.exe' is not registred!"); } m_configAudioCodingMode = 0; @@ -147,7 +147,7 @@ bool AC3Encoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo args << "-b" << QString::number(g_ac3BitratesLUT[qBound(0, m_configBitrate, 18)]); break; default: - THROW("Bad rate-control mode!"); + MUTILS_THROW("Bad rate-control mode!"); break; } diff --git a/src/Encoder_Abstract.h b/src/Encoder_Abstract.h index 917bc25b..1350e2fe 100644 --- a/src/Encoder_Abstract.h +++ b/src/Encoder_Abstract.h @@ -22,10 +22,14 @@ #pragma once +//Internal #include "Global.h" #include "Tool_Abstract.h" #include "Model_AudioFile.h" +//MUtils +#include + class QProcess; class QStringList; class QMutex; @@ -76,7 +80,7 @@ public: //Encoder info static const AbstractEncoderInfo *getEncoderInfo(void) { - THROW("This method shall be re-implemented in derived classes!"); + MUTILS_THROW("This method shall be re-implemented in derived classes!"); return NULL; } diff --git a/src/Encoder_DCA.cpp b/src/Encoder_DCA.cpp index 650f0859..d517326a 100644 --- a/src/Encoder_DCA.cpp +++ b/src/Encoder_DCA.cpp @@ -52,7 +52,7 @@ class DCAEncoderInfo : public AbstractEncoderInfo return true; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -68,7 +68,7 @@ class DCAEncoderInfo : public AbstractEncoderInfo return 32; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -84,7 +84,7 @@ class DCAEncoderInfo : public AbstractEncoderInfo return qBound(32, index2bitrate(index), 4096); break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -100,7 +100,7 @@ class DCAEncoderInfo : public AbstractEncoderInfo return TYPE_BITRATE; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -122,7 +122,7 @@ DCAEncoder::DCAEncoder(void) { if(m_binary.isEmpty()) { - THROW("Error initializing DCA encoder. Tool 'dcaenc.exe' is not registred!"); + MUTILS_THROW("Error initializing DCA encoder. Tool 'dcaenc.exe' is not registred!"); } } diff --git a/src/Encoder_FLAC.cpp b/src/Encoder_FLAC.cpp index 5bf9c092..e58ca611 100644 --- a/src/Encoder_FLAC.cpp +++ b/src/Encoder_FLAC.cpp @@ -47,7 +47,7 @@ public: return false; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -63,7 +63,7 @@ public: return 0; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -79,7 +79,7 @@ public: return -1; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -94,7 +94,7 @@ public: case SettingsModel::CBRMode: return -1; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -116,7 +116,7 @@ FLACEncoder::FLACEncoder(void) { if(m_binary.isEmpty()) { - THROW("Error initializing FLAC encoder. Tool 'flac.exe' is not registred!"); + MUTILS_THROW("Error initializing FLAC encoder. Tool 'flac.exe' is not registred!"); } } diff --git a/src/Encoder_MAC.cpp b/src/Encoder_MAC.cpp index a7aa52c7..16eb336a 100644 --- a/src/Encoder_MAC.cpp +++ b/src/Encoder_MAC.cpp @@ -46,7 +46,7 @@ class MACEncoderInfo : public AbstractEncoderInfo return false; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -62,7 +62,7 @@ class MACEncoderInfo : public AbstractEncoderInfo return -1; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -78,7 +78,7 @@ class MACEncoderInfo : public AbstractEncoderInfo return -1; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -94,7 +94,7 @@ class MACEncoderInfo : public AbstractEncoderInfo return -1; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -117,7 +117,7 @@ MACEncoder::MACEncoder(void) { if(m_binary_enc.isEmpty() || m_binary_tag.isEmpty()) { - THROW("Error initializing MAC encoder. Tool 'mac.exe' or 'tag.exe' is not registred!"); + MUTILS_THROW("Error initializing MAC encoder. Tool 'mac.exe' or 'tag.exe' is not registred!"); } } @@ -141,7 +141,7 @@ bool MACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo args << QString().sprintf("-c%d", (m_configBitrate + 1) * 1000); break; default: - THROW("Bad rate-control mode!"); + MUTILS_THROW("Bad rate-control mode!"); break; } diff --git a/src/Encoder_MP3.cpp b/src/Encoder_MP3.cpp index bb4a81f4..663c6cd1 100644 --- a/src/Encoder_MP3.cpp +++ b/src/Encoder_MP3.cpp @@ -49,7 +49,7 @@ class MP3EncoderInfo : public AbstractEncoderInfo return true; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -65,7 +65,7 @@ class MP3EncoderInfo : public AbstractEncoderInfo return 14; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -81,7 +81,7 @@ class MP3EncoderInfo : public AbstractEncoderInfo return g_mp3BitrateLUT[qBound(0, index, 13)]; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -99,7 +99,7 @@ class MP3EncoderInfo : public AbstractEncoderInfo return TYPE_BITRATE; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -121,7 +121,7 @@ MP3Encoder::MP3Encoder(void) { if(m_binary.isEmpty()) { - THROW("Error initializing MP3 encoder. Tool 'lame.exe' is not registred!"); + MUTILS_THROW("Error initializing MP3 encoder. Tool 'lame.exe' is not registred!"); } m_algorithmQuality = 2; @@ -156,7 +156,7 @@ bool MP3Encoder::encode(const QString &sourceFile, const AudioFileModel_MetaInfo args << "-b" << QString::number(g_mp3BitrateLUT[qBound(0, m_configBitrate, 13)]); break; default: - THROW("Bad rate-control mode!"); + MUTILS_THROW("Bad rate-control mode!"); break; } diff --git a/src/Encoder_Opus.cpp b/src/Encoder_Opus.cpp index 507dab9a..82dc0965 100644 --- a/src/Encoder_Opus.cpp +++ b/src/Encoder_Opus.cpp @@ -45,7 +45,7 @@ class OpusEncoderInfo : public AbstractEncoderInfo return true; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -59,7 +59,7 @@ class OpusEncoderInfo : public AbstractEncoderInfo return 32; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -73,7 +73,7 @@ class OpusEncoderInfo : public AbstractEncoderInfo return qBound(8, (index + 1) * 8, 256); break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -89,7 +89,7 @@ class OpusEncoderInfo : public AbstractEncoderInfo return TYPE_BITRATE; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -111,7 +111,7 @@ OpusEncoder::OpusEncoder(void) { if(m_binary.isEmpty()) { - THROW("Error initializing Opus encoder. Tool 'opusenc.exe' is not registred!"); + MUTILS_THROW("Error initializing Opus encoder. Tool 'opusenc.exe' is not registred!"); } m_configOptimizeFor = 0; @@ -140,7 +140,7 @@ bool OpusEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf args << "--hard-cbr"; break; default: - THROW("Bad rate-control mode!"); + MUTILS_THROW("Bad rate-control mode!"); break; } diff --git a/src/Encoder_Vorbis.cpp b/src/Encoder_Vorbis.cpp index b5c8ffac..c686cf17 100644 --- a/src/Encoder_Vorbis.cpp +++ b/src/Encoder_Vorbis.cpp @@ -46,7 +46,7 @@ class VorbisEncoderInfo : public AbstractEncoderInfo return false; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -62,7 +62,7 @@ class VorbisEncoderInfo : public AbstractEncoderInfo return 60; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -78,7 +78,7 @@ class VorbisEncoderInfo : public AbstractEncoderInfo return qBound(32, (index + 4) * 8, 500); break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -96,7 +96,7 @@ class VorbisEncoderInfo : public AbstractEncoderInfo return TYPE_BITRATE; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -118,7 +118,7 @@ VorbisEncoder::VorbisEncoder(void) { if(m_binary.isEmpty()) { - THROW("Error initializing Vorbis encoder. Tool 'oggenc2.exe' is not registred!"); + MUTILS_THROW("Error initializing Vorbis encoder. Tool 'oggenc2.exe' is not registred!"); } m_configBitrateMaximum = 0; @@ -145,7 +145,7 @@ bool VorbisEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaI args << "-b" << QString::number(qBound(32, (m_configBitrate + 4) * 8, 500)); break; default: - THROW("Bad rate-control mode!"); + MUTILS_THROW("Bad rate-control mode!"); break; } diff --git a/src/Encoder_Wave.cpp b/src/Encoder_Wave.cpp index 15ca5f9b..70721357 100644 --- a/src/Encoder_Wave.cpp +++ b/src/Encoder_Wave.cpp @@ -54,7 +54,7 @@ public: return true; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -68,7 +68,7 @@ public: return 0; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -82,7 +82,7 @@ public: return -1; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } @@ -96,7 +96,7 @@ public: return TYPE_UNCOMPRESSED; break; default: - THROW("Bad RC mode specified!"); + MUTILS_THROW("Bad RC mode specified!"); } } diff --git a/src/Filter_Downmix.cpp b/src/Filter_Downmix.cpp index 7f5ee927..b8f6e528 100644 --- a/src/Filter_Downmix.cpp +++ b/src/Filter_Downmix.cpp @@ -22,10 +22,15 @@ #include "Filter_Downmix.h" +//Internal #include "Global.h" #include "Tool_WaveProperties.h" #include "Model_AudioFile.h" +//MUtils +#include + +//Qt #include #include #include @@ -36,7 +41,7 @@ DownmixFilter::DownmixFilter(void) { if(m_binary.isEmpty()) { - THROW("Error initializing SoX filter. Tool 'sox.exe' is not registred!"); + MUTILS_THROW("Error initializing SoX filter. Tool 'sox.exe' is not registred!"); } } diff --git a/src/Filter_Normalize.cpp b/src/Filter_Normalize.cpp index 93d22a54..4708c597 100644 --- a/src/Filter_Normalize.cpp +++ b/src/Filter_Normalize.cpp @@ -22,8 +22,13 @@ #include "Filter_Normalize.h" +//Internal #include "Global.h" +//MUtils +#include + +//Qt #include #include #include @@ -34,7 +39,7 @@ NormalizeFilter::NormalizeFilter(int peakVolume, int equalizationMode) { if(m_binary.isEmpty()) { - THROW("Error initializing SoX filter. Tool 'sox.exe' is not registred!"); + MUTILS_THROW("Error initializing SoX filter. Tool 'sox.exe' is not registred!"); } m_peakVolume = qMin(-50, qMax(-3200, peakVolume)); diff --git a/src/Filter_Resample.cpp b/src/Filter_Resample.cpp index 7c20a571..3d1660f8 100644 --- a/src/Filter_Resample.cpp +++ b/src/Filter_Resample.cpp @@ -22,9 +22,14 @@ #include "Filter_Resample.h" +//Internal #include "Global.h" #include "Model_AudioFile.h" +//MUtils +#include + +//Qt #include #include #include @@ -40,7 +45,7 @@ ResampleFilter::ResampleFilter(int samplingRate, int bitDepth) { if(m_binary.isEmpty()) { - THROW("Error initializing SoX filter. Tool 'sox.exe' is not registred!"); + MUTILS_THROW("Error initializing SoX filter. Tool 'sox.exe' is not registred!"); } m_samplingRate = (samplingRate > 0) ? qBound(8000, samplingRate, 192000) : 0; diff --git a/src/Filter_ToneAdjust.cpp b/src/Filter_ToneAdjust.cpp index d64c2aa3..2b49ed2c 100644 --- a/src/Filter_ToneAdjust.cpp +++ b/src/Filter_ToneAdjust.cpp @@ -22,8 +22,13 @@ #include "Filter_ToneAdjust.h" +//Internal #include "Global.h" +//MUtils +#include + +//Qt #include #include #include @@ -35,7 +40,7 @@ ToneAdjustFilter::ToneAdjustFilter(int bass, int treble) { if(m_binary.isEmpty()) { - THROW("Error initializing SoX filter. Tool 'sox.exe' is not registred!"); + MUTILS_THROW("Error initializing SoX filter. Tool 'sox.exe' is not registred!"); } m_bass = qMax(-2000, qMin(2000, bass)); diff --git a/src/Global.h b/src/Global.h index 6bc4fdbd..7f21ca1b 100644 --- a/src/Global.h +++ b/src/Global.h @@ -129,7 +129,6 @@ lamexp_icon_t *lamexp_set_window_icon(QWidget *window, const QIcon &icon, const bool lamexp_sheet_of_glass(QWidget *window); bool lamexp_sheet_of_glass_update(QWidget *window); bool lamexp_shutdown_computer(const QString &message, const unsigned long timeout = 30, const bool forceShutdown = true, const bool hibernate = false); -void lamexp_sleep(const unsigned int delay); QColor lamexp_system_color(const int color_id); const char *lamexp_support_url(void); bool lamexp_themes_enabled(void); @@ -160,50 +159,4 @@ const char *lamexp_website_url(void); // HELPER MACROS /////////////////////////////////////////////////////////////////////////////// -#define LAMEXP_CLOSE(HANDLE) do { if(HANDLE != NULL && HANDLE != INVALID_HANDLE_VALUE) { CloseHandle(HANDLE); HANDLE = NULL; } } while(0) -#define LAMEXP_MAKE_STRING_EX(X) #X -#define LAMEXP_MAKE_STRING(X) LAMEXP_MAKE_STRING_EX(X) -#define LAMEXP_SAFE_FREE(PTR) do { if(PTR) { free((void*) PTR); PTR = NULL; } } while(0) -#define LAMEXP_ZERO_MEMORY(X) memset(&(X), 0, sizeof((X))) #define NOBR(STR) (QString("%1").arg((STR)).replace("-", "−")) - -//Helper macro for throwing exceptions -#define THROW(MESSAGE) do \ -{ \ - throw std::runtime_error((MESSAGE)); \ -} \ -while(0) -#define THROW_FMT(FORMAT, ...) do \ -{ \ - char _error_msg[512]; \ - _snprintf_s(_error_msg, 512, _TRUNCATE, (FORMAT), __VA_ARGS__); \ - throw std::runtime_error(_error_msg); \ -} \ -while(0) -#define PRINT_ERROR(X, ...) do \ -{ \ - fflush(stdout); \ - fprintf(stderr, (X), __VA_ARGS__); \ - fflush(stderr); \ -} \ -while(0) - -//Memory check -#if LAMEXP_DEBUG - #define LAMEXP_MEMORY_CHECK(FUNC, RETV, ...) do \ - { \ - size_t _privateBytesBefore = lamexp_dbg_private_bytes(); \ - RETV = FUNC(__VA_ARGS__); \ - size_t _privateBytesLeak = (lamexp_dbg_private_bytes() - _privateBytesBefore) / 1024; \ - if(_privateBytesLeak > 0) { \ - lamexp_dbg_dbg_output_string("\nMemory leak: Lost %u KiloBytes of PrivateUsage memory!\n\n", _privateBytesLeak); \ - } \ - } \ - while(0) -#else - #define LAMEXP_MEMORY_CHECK(FUNC, RETV, ...) do \ - { \ - RETV = __noop(__VA_ARGS__); \ - } \ - while(0) -#endif diff --git a/src/Global_IPC.cpp b/src/Global_IPC.cpp index 58f852b3..ac2b960b 100644 --- a/src/Global_IPC.cpp +++ b/src/Global_IPC.cpp @@ -24,6 +24,7 @@ //MUtils #include +#include //Qt includes #include @@ -192,7 +193,7 @@ void lamexp_ipc_send(unsigned int command, const char* message) if(!g_lamexp_ipc_ptr.sharedmem || !g_lamexp_ipc_ptr.semaphore_read || !g_lamexp_ipc_ptr.semaphore_write || !g_lamexp_ipc_ptr.semaphore_read_mutex || !g_lamexp_ipc_ptr.semaphore_write_mutex) { - THROW("Shared memory for IPC not initialized yet."); + MUTILS_THROW("Shared memory for IPC not initialized yet."); } lamexp_ipc_data_t ipc_data; @@ -229,7 +230,7 @@ void lamexp_ipc_read(unsigned int *command, char* message, size_t buffSize) if(!g_lamexp_ipc_ptr.sharedmem || !g_lamexp_ipc_ptr.semaphore_read || !g_lamexp_ipc_ptr.semaphore_write || !g_lamexp_ipc_ptr.semaphore_read_mutex || !g_lamexp_ipc_ptr.semaphore_write_mutex) { - THROW("Shared memory for IPC not initialized yet."); + MUTILS_THROW("Shared memory for IPC not initialized yet."); } lamexp_ipc_data_t ipc_data; @@ -264,7 +265,7 @@ void lamexp_ipc_read(unsigned int *command, char* message, size_t buffSize) extern "C" void _lamexp_global_init_ipcom(void) { - LAMEXP_ZERO_MEMORY(g_lamexp_ipc_ptr); + MUTILS_ZERO_MEMORY(g_lamexp_ipc_ptr); } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/Global_Tools.cpp b/src/Global_Tools.cpp index ec95ee3b..42dea177 100644 --- a/src/Global_Tools.cpp +++ b/src/Global_Tools.cpp @@ -38,6 +38,7 @@ //MUtils #include +#include /////////////////////////////////////////////////////////////////////////////// // GLOBAL VARS @@ -89,7 +90,7 @@ void lamexp_register_tool(const QString &toolName, LockedFile *file, unsigned in if(g_lamexp_tools.registry->contains(toolName.toLower())) { - THROW("lamexp_register_tool: Tool is already registered!"); + MUTILS_THROW("lamexp_register_tool: Tool is already registered!"); } g_lamexp_tools.registry->insert(toolName.toLower(), file); @@ -352,9 +353,9 @@ bool lamexp_install_translator_from_file(const QString &qmFile) extern "C" void _lamexp_global_init_tools(void) { - LAMEXP_ZERO_MEMORY(g_lamexp_tools); - LAMEXP_ZERO_MEMORY(g_lamexp_currentTranslator); - LAMEXP_ZERO_MEMORY(g_lamexp_translation); + MUTILS_ZERO_MEMORY(g_lamexp_tools); + MUTILS_ZERO_MEMORY(g_lamexp_currentTranslator); + MUTILS_ZERO_MEMORY(g_lamexp_translation); } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/Global_Utils.cpp b/src/Global_Utils.cpp index 0d3c76a1..74cb658e 100644 --- a/src/Global_Utils.cpp +++ b/src/Global_Utils.cpp @@ -37,6 +37,7 @@ //MUtils #include +#include //CRT includes #include @@ -154,14 +155,14 @@ void lamexp_blink_window(QWidget *poWindow, unsigned int count, unsigned int del { poWindow->setWindowOpacity(x); QApplication::processEvents(); - lamexp_sleep(sleep); + MUtils::OS::sleep_ms(sleep); } for(double x = minOpac; x <= maxOpac; x += delOpac) { poWindow->setWindowOpacity(x); QApplication::processEvents(); - lamexp_sleep(sleep); + MUtils::OS::sleep_ms(sleep); } } @@ -280,7 +281,7 @@ const QIcon &lamexp_app_icon(void) extern "C" void _lamexp_global_init_utils(void) { - LAMEXP_ZERO_MEMORY(g_lamexp_app_icon); + MUTILS_ZERO_MEMORY(g_lamexp_app_icon); } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/Global_Version.cpp b/src/Global_Version.cpp index 34eb9413..b16fa4db 100644 --- a/src/Global_Version.cpp +++ b/src/Global_Version.cpp @@ -171,7 +171,7 @@ bool lamexp_portable_mode(void) extern "C" void _lamexp_global_init_versn(void) { - LAMEXP_ZERO_MEMORY(g_lamexp_portable); + MUTILS_ZERO_MEMORY(g_lamexp_portable); } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/Global_Win32.cpp b/src/Global_Win32.cpp index 3e997820..155213c4 100644 --- a/src/Global_Win32.cpp +++ b/src/Global_Win32.cpp @@ -155,59 +155,6 @@ const char* LAMEXP_DEFAULT_TRANSLATION = "LameXP_EN.qm"; // GLOBAL FUNCTIONS /////////////////////////////////////////////////////////////////////////////// -/* - * Check for debugger (detect routine) - */ -static __forceinline bool lamexp_check_for_debugger(void) -{ - __try - { - CloseHandle((HANDLE)((DWORD_PTR)-3)); - } - __except(1) - { - return true; - } - - BOOL bHaveDebugger = FALSE; - if(CheckRemoteDebuggerPresent(GetCurrentProcess(), &bHaveDebugger)) - { - if(bHaveDebugger) return true; - } - - return IsDebuggerPresent(); -} - -/* - * Check for debugger (thread proc) - */ -static unsigned int __stdcall lamexp_debug_thread_proc(LPVOID lpParameter) -{ - SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_LOWEST); - forever - { - if(lamexp_check_for_debugger()) - { - MUtils::OS::fatal_exit(L"Not a debug build. Please unload debugger and try again!"); - return 666; - } - lamexp_sleep(100); - } -} - -/* - * Check for debugger (startup routine) - */ -static HANDLE lamexp_debug_thread_init() -{ - if(lamexp_check_for_debugger()) - { - MUtils::OS::fatal_exit(L"Not a debug build. Please unload debugger and try again!"); - } - const uintptr_t h = _beginthreadex(NULL, 0, lamexp_debug_thread_proc, NULL, 0, NULL); - return (HANDLE)(h^0xdeadbeef); -} - /* * Convert QIcon to HICON -> caller is responsible for destroying the HICON! */ @@ -1089,60 +1036,17 @@ static DWORD WINAPI lamexp_fatal_exit_helper(LPVOID lpParameter) return 0; } -/* - * Initialize debug thread - */ -static const HANDLE g_debug_thread1 = MUTILS_DEBUG ? NULL : lamexp_debug_thread_init(); - -/* - * Get number private bytes [debug only] - */ -unsigned long lamexp_dbg_private_bytes(void) -{ -#if LAMEXP_DEBUG - for(int i = 0; i < 8; i++) _heapmin(); - PROCESS_MEMORY_COUNTERS_EX memoryCounters; - memoryCounters.cb = sizeof(PROCESS_MEMORY_COUNTERS_EX); - GetProcessMemoryInfo(GetCurrentProcess(), (PPROCESS_MEMORY_COUNTERS) &memoryCounters, sizeof(PROCESS_MEMORY_COUNTERS_EX)); - return memoryCounters.PrivateUsage; -#else - THROW("Cannot call this function in a non-debug build!"); -#endif //LAMEXP_DEBUG -} - -/* - * Output string to debugger [debug only] - */ -void lamexp_dbg_dbg_output_string(const char* format, ...) -{ -#if LAMEXP_DEBUG - char buffer[256]; - va_list args; - va_start (args, format); - vsnprintf_s(buffer, 256, _TRUNCATE, format, args); - OutputDebugStringA(buffer); - va_end(args); -#else - THROW("Cannot call this function in a non-debug build!"); -#endif //LAMEXP_DEBUG -} - /////////////////////////////////////////////////////////////////////////////// // INITIALIZATION /////////////////////////////////////////////////////////////////////////////// extern "C" void _lamexp_global_init_win32(void) { - if((!MUTILS_DEBUG) && lamexp_check_for_debugger()) - { - MUtils::OS::fatal_exit(L"Not a debug build. Please unload debugger and try again!"); - } - //Zero *before* constructors are called - LAMEXP_ZERO_MEMORY(g_lamexp_wine); - LAMEXP_ZERO_MEMORY(g_lamexp_themes_enabled); - LAMEXP_ZERO_MEMORY(g_lamexp_dwmapi); - LAMEXP_ZERO_MEMORY(g_lamexp_sounds); + MUTILS_ZERO_MEMORY(g_lamexp_wine); + MUTILS_ZERO_MEMORY(g_lamexp_themes_enabled); + MUTILS_ZERO_MEMORY(g_lamexp_dwmapi); + MUTILS_ZERO_MEMORY(g_lamexp_sounds); } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/LockedFile.cpp b/src/LockedFile.cpp index 189083b3..56192d79 100644 --- a/src/LockedFile.cpp +++ b/src/LockedFile.cpp @@ -25,6 +25,8 @@ //MUtils #include +#include +#include //Qt #include @@ -52,6 +54,15 @@ static const bool g_useFileDescrForQFile = false; #endif +static void CLOSE_HANDLE(HANDLE &h) +{ + if((h != NULL) && (h != INVALID_HANDLE_VALUE)) + { + CloseHandle(h); + h = NULL; + } +} + /////////////////////////////////////////////////////////////////////////////// static const char *g_blnk = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"; @@ -100,7 +111,7 @@ LockedFile::LockedFile(QResource *const resource, const QString &outPath, const //Make sure the resource is valid if(!(resource->isValid() && resource->data())) { - THROW_FMT("The resource at %p is invalid!", resource); + MUTILS_THROW_FMT("The resource at %p is invalid!", resource); } QFile outFile(m_filePath); @@ -119,12 +130,12 @@ LockedFile::LockedFile(QResource *const resource, const QString &outPath, const if(outFile.write(reinterpret_cast(resource->data()), resource->size()) != resource->size()) { QFile::remove(QFileInfo(outFile).canonicalFilePath()); - THROW_FMT("File '%s' could not be written!", MUTILS_UTF8(QFileInfo(outFile).fileName())); + MUTILS_THROW_FMT("File '%s' could not be written!", MUTILS_UTF8(QFileInfo(outFile).fileName())); } } else { - THROW_FMT("File '%s' could not be created!", MUTILS_UTF8(QFileInfo(outFile).fileName())); + MUTILS_THROW_FMT("File '%s' could not be created!", MUTILS_UTF8(QFileInfo(outFile).fileName())); } //Close file after it has been written @@ -143,14 +154,14 @@ LockedFile::LockedFile(QResource *const resource, const QString &outPath, const if((fileHandle == NULL) || (fileHandle == INVALID_HANDLE_VALUE)) { QFile::remove(QFileInfo(outFile).canonicalFilePath()); - THROW_FMT("File '%s' could not be locked!", MUTILS_UTF8(QFileInfo(m_filePath).fileName())); + MUTILS_THROW_FMT("File '%s' could not be locked!", MUTILS_UTF8(QFileInfo(m_filePath).fileName())); } //Get file descriptor m_fileDescriptor = _open_osfhandle(reinterpret_cast(fileHandle), _O_RDONLY | _O_BINARY); if(m_fileDescriptor < 0) { - THROW_FMT("Failed to obtain C Runtime file descriptor!"); + MUTILS_THROW_FMT("Failed to obtain C Runtime file descriptor!"); } QFile checkFile; @@ -175,7 +186,7 @@ LockedFile::LockedFile(QResource *const resource, const QString &outPath, const if(!checkFile.isOpen()) { QFile::remove(m_filePath); - THROW_FMT("File '%s' could not be read!", MUTILS_UTF8(QFileInfo(m_filePath).fileName())); + MUTILS_THROW_FMT("File '%s' could not be read!", MUTILS_UTF8(QFileInfo(m_filePath).fileName())); } //Verify file contents @@ -186,9 +197,9 @@ LockedFile::LockedFile(QResource *const resource, const QString &outPath, const if(hash.isNull() || _stricmp(hash.constData(), expectedHash.constData())) { qWarning("\nFile checksum error:\n A = %s\n B = %s\n", expectedHash.constData(), hash.constData()); - LAMEXP_CLOSE(fileHandle); + CLOSE_HANDLE(fileHandle); QFile::remove(m_filePath); - THROW_FMT("File '%s' is corruputed, take care!", MUTILS_UTF8(QFileInfo(m_filePath).fileName())); + MUTILS_THROW_FMT("File '%s' is corruputed, take care!", MUTILS_UTF8(QFileInfo(m_filePath).fileName())); } } @@ -206,7 +217,7 @@ LockedFile::LockedFile(const QString &filePath, const bool bOwnsFile) //Make sure the file exists, before we try to lock it if((!existingFileInfo.exists()) || (!existingFileInfo.isFile()) || m_filePath.isEmpty()) { - THROW_FMT("File '%s' does not exist!", MUTILS_UTF8(filePath)); + MUTILS_THROW_FMT("File '%s' does not exist!", MUTILS_UTF8(filePath)); } //Now lock the file @@ -221,14 +232,14 @@ LockedFile::LockedFile(const QString &filePath, const bool bOwnsFile) //Locked successfully? if((fileHandle == NULL) || (fileHandle == INVALID_HANDLE_VALUE)) { - THROW_FMT("File '%s' could not be locked!", MUTILS_UTF8(QFileInfo(m_filePath).fileName())); + MUTILS_THROW_FMT("File '%s' could not be locked!", MUTILS_UTF8(QFileInfo(m_filePath).fileName())); } //Get file descriptor m_fileDescriptor = _open_osfhandle(reinterpret_cast(fileHandle), _O_RDONLY | _O_BINARY); if(m_fileDescriptor < 0) { - THROW_FMT("Failed to obtain C Runtime file descriptor!"); + MUTILS_THROW_FMT("Failed to obtain C Runtime file descriptor!"); } } @@ -246,7 +257,7 @@ LockedFile::~LockedFile(void) for(int i = 0; i < 64; i++) { if(QFile::remove(m_filePath)) break; - lamexp_sleep(1); + MUtils::OS::sleep_ms(1); } } } @@ -261,6 +272,6 @@ void LockedFile::selfTest() { if(!MUtils::KeccakHash::selfTest()) { - THROW("QKeccakHash self-test has failed!"); + MUTILS_THROW("QKeccakHash self-test has failed!"); } } diff --git a/src/Model_CueSheet.cpp b/src/Model_CueSheet.cpp index c7d45d6e..7514d8ca 100644 --- a/src/Model_CueSheet.cpp +++ b/src/Model_CueSheet.cpp @@ -28,6 +28,7 @@ //MUtils #include +#include //Qt #include @@ -516,7 +517,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic if(application) { application->processEvents(); - if(lines < 128) lamexp_sleep(10); + if(lines < 128) MUtils::OS::sleep_ms(10); } if(cueStream.atEnd()) @@ -740,7 +741,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic if(application) { application->processEvents(); - lamexp_sleep(10); + MUtils::OS::sleep_ms(10); } CueSheetFile *currentFile = m_files.at(i); @@ -773,7 +774,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic if(application) { application->processEvents(); - lamexp_sleep(10); + MUtils::OS::sleep_ms(10); } CueSheetFile *currentFile = m_files.at(i); int nTracks = currentFile->trackCount(); diff --git a/src/Model_Settings.cpp b/src/Model_Settings.cpp index 2339423a..f4478135 100644 --- a/src/Model_Settings.cpp +++ b/src/Model_Settings.cpp @@ -28,6 +28,7 @@ //MUtils #include +#include //Qt #include @@ -543,7 +544,7 @@ QString SettingsModel::initDirectory(const QString &path) const for(int i = 0; i < 32; i++) { if(QDir(path).mkpath(".")) break; - lamexp_sleep(1); + MUtils::OS::sleep_ms(1); } } diff --git a/src/Registry_Encoder.cpp b/src/Registry_Encoder.cpp index 2c9b8eae..668aa5ea 100644 --- a/src/Registry_Encoder.cpp +++ b/src/Registry_Encoder.cpp @@ -115,7 +115,7 @@ AbstractEncoder *EncoderRegistry::createInstance(const int encoderId, const Sett } break; default: - THROW("makeEncoder(): Unknown AAC encoder specified!"); + MUTILS_THROW("makeEncoder(): Unknown AAC encoder specified!"); break; } } @@ -171,13 +171,13 @@ AbstractEncoder *EncoderRegistry::createInstance(const int encoderId, const Sett break; /*-------- default --------*/ default: - THROW("Unsupported encoder!"); + MUTILS_THROW("Unsupported encoder!"); } //Sanity checking if(!encoder) { - THROW("No encoder instance has been assigend!"); + MUTILS_THROW("No encoder instance has been assigend!"); } //Apply common settings @@ -212,16 +212,16 @@ const AbstractEncoderInfo *EncoderRegistry::getEncoderInfo(const int encoderId) case SettingsModel::AAC_ENCODER_QAAC: info = QAACEncoder::getEncoderInfo(); break; case SettingsModel::AAC_ENCODER_FHG: info = FHGAACEncoder::getEncoderInfo(); break; case SettingsModel::AAC_ENCODER_NERO: info = AACEncoder::getEncoderInfo(); break; - default: THROW("Unknown AAC encoder specified!"); + default: MUTILS_THROW("Unknown AAC encoder specified!"); } break; - default: THROW("Unsupported encoder!"); + default: MUTILS_THROW("Unsupported encoder!"); } //Sanity checking if(!info) { - THROW("No encoder instance has been assigend!"); + MUTILS_THROW("No encoder instance has been assigend!"); } return info; @@ -248,7 +248,7 @@ void EncoderRegistry::saveEncoderMode(SettingsModel *settings, const int encoder //Sanity checking if((rcMode < SettingsModel::VBRMode) || (rcMode > SettingsModel::CBRMode)) { - THROW("Unknown rate-control mode!"); + MUTILS_THROW("Unknown rate-control mode!"); } //Store the encoder bitrate/quality value @@ -263,7 +263,7 @@ void EncoderRegistry::saveEncoderMode(SettingsModel *settings, const int encoder case SettingsModel::DCAEncoder: STORE_MODE(DcaEnc, rcMode); break; case SettingsModel::MACEncoder: STORE_MODE(MacEnc, rcMode); break; case SettingsModel::PCMEncoder: STORE_MODE(Wave, rcMode); break; - default: THROW("Unsupported encoder!"); + default: MUTILS_THROW("Unsupported encoder!"); } } @@ -283,7 +283,7 @@ int EncoderRegistry::loadEncoderMode(const SettingsModel *settings, const int en case SettingsModel::DCAEncoder: LOAD_MODE(rcMode, DcaEnc); break; case SettingsModel::MACEncoder: LOAD_MODE(rcMode, MacEnc); break; case SettingsModel::PCMEncoder: LOAD_MODE(rcMode, Wave); break; - default: THROW("Unsupported encoder!"); + default: MUTILS_THROW("Unsupported encoder!"); } return rcMode; @@ -314,7 +314,7 @@ void EncoderRegistry::saveEncoderValue(SettingsModel *settings, const int encode //Sanity checking if((rcMode < SettingsModel::VBRMode) || (rcMode > SettingsModel::CBRMode)) { - THROW("Unknown rate-control mode!"); + MUTILS_THROW("Unknown rate-control mode!"); } //Store the encoder bitrate/quality value @@ -329,7 +329,7 @@ void EncoderRegistry::saveEncoderValue(SettingsModel *settings, const int encode case SettingsModel::DCAEncoder: STORE_VALUE(DcaEnc, rcMode, value); break; case SettingsModel::MACEncoder: STORE_VALUE(MacEnc, rcMode, value); break; case SettingsModel::PCMEncoder: STORE_VALUE(Wave, rcMode, value); break; - default: THROW("Unsupported encoder!"); + default: MUTILS_THROW("Unsupported encoder!"); } } @@ -340,7 +340,7 @@ int EncoderRegistry::loadEncoderValue(const SettingsModel *settings, const int e //Sanity checking if((rcMode < SettingsModel::VBRMode) || (rcMode > SettingsModel::CBRMode)) { - THROW("Unknown rate-control mode!"); + MUTILS_THROW("Unknown rate-control mode!"); } //Load the encoder bitrate/quality value @@ -355,7 +355,7 @@ int EncoderRegistry::loadEncoderValue(const SettingsModel *settings, const int e case SettingsModel::DCAEncoder: LOAD_VALUE(value, DcaEnc, rcMode); break; case SettingsModel::MACEncoder: LOAD_VALUE(value, MacEnc, rcMode); break; case SettingsModel::PCMEncoder: LOAD_VALUE(value, Wave, rcMode); break; - default: THROW("Unsupported encoder!"); + default: MUTILS_THROW("Unsupported encoder!"); } return value; @@ -391,7 +391,7 @@ void EncoderRegistry::saveEncoderCustomParams(SettingsModel *settings, const int case SettingsModel::DCAEncoder: STORE_PARAMS(DcaEnc, params.trimmed()); break; case SettingsModel::MACEncoder: STORE_PARAMS(MacEnc, params.trimmed()); break; case SettingsModel::PCMEncoder: STORE_PARAMS(Wave, params.trimmed()); break; - default: THROW("Unsupported encoder!"); + default: MUTILS_THROW("Unsupported encoder!"); } } @@ -411,7 +411,7 @@ QString EncoderRegistry::loadEncoderCustomParams(const SettingsModel *settings, case SettingsModel::DCAEncoder: LOAD_PARAMS(params, DcaEnc); break; case SettingsModel::MACEncoder: LOAD_PARAMS(params, MacEnc); break; case SettingsModel::PCMEncoder: LOAD_PARAMS(params, Wave); break; - default: THROW("Unsupported encoder!"); + default: MUTILS_THROW("Unsupported encoder!"); } return params; diff --git a/src/ShellIntegration.cpp b/src/ShellIntegration.cpp index 5d2dd39b..1d85880b 100644 --- a/src/ShellIntegration.cpp +++ b/src/ShellIntegration.cpp @@ -28,6 +28,7 @@ //MUtils #include +#include //Qt #include @@ -59,7 +60,7 @@ QMutex ShellIntegration::m_mutex; ShellIntegration::ShellIntegration(void) { - THROW("Cannot create instance of this class, sorry!"); + MUTILS_THROW("Cannot create instance of this class, sorry!"); } //////////////////////////////////////////////////////////// diff --git a/src/Thread_CPUObserver.cpp b/src/Thread_CPUObserver.cpp index d29e46ce..18a49854 100644 --- a/src/Thread_CPUObserver.cpp +++ b/src/Thread_CPUObserver.cpp @@ -26,6 +26,7 @@ //MUtils #include +#include //Qt #include @@ -61,12 +62,12 @@ void CPUObserverThread::run(void) } catch(const std::exception &error) { - PRINT_ERROR("\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what()); + MUTILS_PRINT_ERROR("\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what()); MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!"); } catch(...) { - PRINT_ERROR("\nGURU MEDITATION !!!\n\nUnknown exception error!\n"); + MUTILS_PRINT_ERROR("\nGURU MEDITATION !!!\n\nUnknown exception error!\n"); MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!"); } diff --git a/src/Thread_CueSplitter.cpp b/src/Thread_CueSplitter.cpp index dc9c10a4..838a6e62 100644 --- a/src/Thread_CueSplitter.cpp +++ b/src/Thread_CueSplitter.cpp @@ -32,6 +32,7 @@ //MUtils #include +#include //Qt #include @@ -228,7 +229,7 @@ void CueSplitter::run() } emit progressValChanged(10 * nTracksTotal); - lamexp_sleep(333); + MUtils::OS::sleep_ms(333); qDebug("All files were split.\n"); m_bSuccess = true; diff --git a/src/Thread_DiskObserver.cpp b/src/Thread_DiskObserver.cpp index f6b5a217..aecc04fe 100644 --- a/src/Thread_DiskObserver.cpp +++ b/src/Thread_DiskObserver.cpp @@ -29,6 +29,7 @@ //MUtils #include #include +#include //Qt #include @@ -63,12 +64,12 @@ void DiskObserverThread::run(void) } catch(const std::exception &error) { - PRINT_ERROR("\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what()); + MUTILS_PRINT_ERROR("\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what()); MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!"); } catch(...) { - PRINT_ERROR("\nGURU MEDITATION !!!\n\nUnknown exception error!\n"); + MUTILS_PRINT_ERROR("\nGURU MEDITATION !!!\n\nUnknown exception error!\n"); MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!"); } diff --git a/src/Thread_FileAnalyzer.cpp b/src/Thread_FileAnalyzer.cpp index d095adbe..af471554 100644 --- a/src/Thread_FileAnalyzer.cpp +++ b/src/Thread_FileAnalyzer.cpp @@ -31,6 +31,7 @@ //MUtils #include +#include //Qt #include @@ -411,7 +412,7 @@ void FileAnalyzer::taskFileAnalyzed(const unsigned int taskId, const int fileTyp m_filesRejected++; break; default: - THROW("Unknown file type identifier!"); + MUTILS_THROW("Unknown file type identifier!"); } //Emit all pending files diff --git a/src/Thread_FileAnalyzer_Task.cpp b/src/Thread_FileAnalyzer_Task.cpp index 7a64b773..5c3193d7 100644 --- a/src/Thread_FileAnalyzer_Task.cpp +++ b/src/Thread_FileAnalyzer_Task.cpp @@ -30,6 +30,7 @@ //MUtils #include #include +#include //Qt #include @@ -89,12 +90,12 @@ void AnalyzeTask::run() } catch(const std::exception &error) { - PRINT_ERROR("\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what()); + MUTILS_PRINT_ERROR("\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what()); MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!"); } catch(...) { - PRINT_ERROR("\nGURU MEDITATION !!!\n\nUnknown exception error!\n"); + MUTILS_PRINT_ERROR("\nGURU MEDITATION !!!\n\nUnknown exception error!\n"); MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!"); } } diff --git a/src/Thread_Initialization.cpp b/src/Thread_Initialization.cpp index 875c1058..bf6b1357 100644 --- a/src/Thread_Initialization.cpp +++ b/src/Thread_Initialization.cpp @@ -30,6 +30,7 @@ //MUtils #include #include +#include //Qt #include @@ -235,12 +236,12 @@ void InitializationThread::run(void) } catch(const std::exception &error) { - PRINT_ERROR("\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what()); + MUTILS_PRINT_ERROR("\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what()); MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!"); } catch(...) { - PRINT_ERROR("\nGURU MEDITATION !!!\n\nUnknown exception error!\n"); + MUTILS_PRINT_ERROR("\nGURU MEDITATION !!!\n\nUnknown exception error!\n"); MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!"); } } @@ -278,7 +279,7 @@ double InitializationThread::doInit(const size_t threadCount) PRINT_CPU_TYPE(CPU_TYPE_X86_SSE); break; PRINT_CPU_TYPE(CPU_TYPE_X64_GEN); break; PRINT_CPU_TYPE(CPU_TYPE_X64_SSE); break; - default: THROW("CPU support undefined!"); + default: MUTILS_THROW("CPU support undefined!"); } //Allocate queues @@ -462,7 +463,7 @@ void InitializationThread::runBenchmark(void) qFatal("Benchmark complete. Thanks and bye bye!"); #else //ENABLE_BENCHMARK - THROW("Sorry, the benchmark is *not* available in this build!"); + MUTILS_THROW("Sorry, the benchmark is *not* available in this build!"); #endif //ENABLE_BENCHMARK } @@ -472,7 +473,7 @@ void InitializationThread::runBenchmark(void) void InitializationThread::delay(void) { - lamexp_sleep(333); + MUtils::OS::sleep_ms(333); } void InitializationThread::initTranslations(void) @@ -925,7 +926,7 @@ void InitializationThread::selfTest(void) PRINT_CPU_TYPE(CPU_TYPE_X86_SSE); break; PRINT_CPU_TYPE(CPU_TYPE_X64_GEN); break; PRINT_CPU_TYPE(CPU_TYPE_X64_SSE); break; - default: THROW("CPU support undefined!"); + default: MUTILS_THROW("CPU support undefined!"); } unsigned int n = 0; for(int i = 0; true; i++) diff --git a/src/Thread_Process.cpp b/src/Thread_Process.cpp index 5c33c5ba..769e38b4 100644 --- a/src/Thread_Process.cpp +++ b/src/Thread_Process.cpp @@ -133,7 +133,7 @@ bool ProcessThread::start(QThreadPool *pool) //Make sure object was initialized correctly if(m_initialized < 0) { - THROW("Object not initialized yet!"); + MUTILS_THROW("Object not initialized yet!"); } if(m_initialized < 1) @@ -187,12 +187,12 @@ void ProcessThread::run() } catch(const std::exception &error) { - PRINT_ERROR("\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what()); + MUTILS_PRINT_ERROR("\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what()); MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!"); } catch(...) { - PRINT_ERROR("\nGURU MEDITATION !!!\n\nUnknown exception error!\n"); + MUTILS_PRINT_ERROR("\nGURU MEDITATION !!!\n\nUnknown exception error!\n"); MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!"); } } @@ -205,7 +205,7 @@ void ProcessThread::processFile() //Make sure object was initialized correctly if(m_initialized < 1) { - THROW("Object not initialized yet!"); + MUTILS_THROW("Object not initialized yet!"); } QString sourceFile = m_audioFile.filePath(); @@ -332,7 +332,7 @@ void ProcessThread::processFile() bSuccess = fileInfo.exists() && fileInfo.isFile() && (fileInfo.size() > 0); } - lamexp_sleep(125); + MUtils::OS::sleep_ms(125); //Report result emit processStateChanged(m_jobId, (m_aborted ? tr("Aborted!") : (bSuccess ? tr("Done.") : tr("Failed!"))), ((bSuccess && !m_aborted) ? ProgressModel::JobComplete : ProgressModel::JobFailed)); @@ -462,7 +462,7 @@ int ProcessThread::generateOutFileName(QString &outFileName) { break; } - lamexp_sleep(125); + MUtils::OS::sleep_ms(125); } } if(QFileInfo(outFileName).exists()) diff --git a/src/Thread_RAMObserver.cpp b/src/Thread_RAMObserver.cpp index a0b34fa4..a4e31ba1 100644 --- a/src/Thread_RAMObserver.cpp +++ b/src/Thread_RAMObserver.cpp @@ -25,6 +25,7 @@ //MUtils #include +#include //Qt #include @@ -60,12 +61,12 @@ void RAMObserverThread::run(void) } catch(const std::exception &error) { - PRINT_ERROR("\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what()); + MUTILS_PRINT_ERROR("\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what()); MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!"); } catch(...) { - PRINT_ERROR("\nGURU MEDITATION !!!\n\nUnknown exception error!\n"); + MUTILS_PRINT_ERROR("\nGURU MEDITATION !!!\n\nUnknown exception error!\n"); MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!"); } diff --git a/src/Tool_Abstract.cpp b/src/Tool_Abstract.cpp index b3b43030..35450a34 100644 --- a/src/Tool_Abstract.cpp +++ b/src/Tool_Abstract.cpp @@ -28,6 +28,7 @@ //MUtils #include +#include //Qt #include @@ -97,7 +98,7 @@ bool AbstractTool::startProcess(QProcess &process, const QString &program, const if(lamexp_current_file_time() <= s_lastLaunchTime) { - lamexp_sleep(START_DELAY); + MUtils::OS::sleep_ms(START_DELAY); } emit messageLogged(commandline2string(program, args) + "\n"); diff --git a/src/Tool_WaveProperties.cpp b/src/Tool_WaveProperties.cpp index 0be4272f..e753caff 100644 --- a/src/Tool_WaveProperties.cpp +++ b/src/Tool_WaveProperties.cpp @@ -22,9 +22,14 @@ #include "Tool_WaveProperties.h" +//Internal #include "Global.h" #include "Model_AudioFile.h" +//MUtils +#include + +//Qt #include #include @@ -34,7 +39,7 @@ WaveProperties::WaveProperties(void) { if(m_binary.isEmpty()) { - THROW("Error initializing MP3 encoder. Tool 'lame.exe' is not registred!"); + MUTILS_THROW("Error initializing MP3 encoder. Tool 'lame.exe' is not registred!"); } } diff --git a/src/WinSevenTaskbar.cpp b/src/WinSevenTaskbar.cpp index de533eaf..1d0f93e2 100644 --- a/src/WinSevenTaskbar.cpp +++ b/src/WinSevenTaskbar.cpp @@ -22,6 +22,10 @@ #include "WinSevenTaskbar.h" +//MUtils +#include + +//Qt #include #include @@ -36,7 +40,7 @@ static ITaskbarList3 *s_ptbl = NULL; WinSevenTaskbar::WinSevenTaskbar(void) { - THROW("Cannot create instance of this class!"); + MUTILS_THROW("Cannot create instance of this class!"); } WinSevenTaskbar::~WinSevenTaskbar(void)