Moved various functions into MUtils library and removed obsolete code from LameXP.
This commit is contained in:
parent
d7100e2207
commit
035699c84e
@ -35,7 +35,7 @@
|
||||
#define VER_LAMEXP_MINOR_LO 1
|
||||
#define VER_LAMEXP_TYPE Beta
|
||||
#define VER_LAMEXP_PATCH 1
|
||||
#define VER_LAMEXP_BUILD 1588
|
||||
#define VER_LAMEXP_BUILD 1590
|
||||
#define VER_LAMEXP_CONFG 1558
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -24,11 +24,16 @@
|
||||
|
||||
#include "UIC_AboutDialog.h"
|
||||
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
#include "Model_Settings.h"
|
||||
|
||||
#include <math.h>
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
#include <MUtils/OSSupport.h>
|
||||
#include <MUtils/Version.h>
|
||||
|
||||
//Qt
|
||||
#include <QDate>
|
||||
#include <QApplication>
|
||||
#include <QIcon>
|
||||
@ -47,6 +52,9 @@
|
||||
#include <QWindowsVistaStyle>
|
||||
#include <QWindowsXPStyle>
|
||||
|
||||
//CRT
|
||||
#include <math.h>
|
||||
|
||||
//Helper macros
|
||||
#define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(QString(URL).replace("-", "−"))
|
||||
#define TRIM_RIGHT(STR) do { while(STR.endsWith(QChar(' ')) || STR.endsWith(QChar('\t')) || STR.endsWith(QChar('\r')) || STR.endsWith(QChar('\n'))) STR.chop(1); } while(0)
|
||||
@ -173,7 +181,7 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta
|
||||
//Show about dialog for the first time?
|
||||
if(!firstStart)
|
||||
{
|
||||
lamexp_seed_rand();
|
||||
MUtils::seed_rand();
|
||||
|
||||
ui->acceptButton->hide();
|
||||
ui->declineButton->hide();
|
||||
@ -192,10 +200,10 @@ AboutDialog::AboutDialog(SettingsModel *settings, QWidget *parent, bool firstSta
|
||||
geometryUpdated();
|
||||
|
||||
m_discOpacity = 0.01;
|
||||
m_disquePos.setX(static_cast<int>(lamexp_rand() % static_cast<unsigned int>(m_disqueBound.right() - disque.width() - m_disqueBound.left())) + m_disqueBound.left());
|
||||
m_disquePos.setY(static_cast<int>(lamexp_rand() % static_cast<unsigned int>(m_disqueBound.bottom() - disque.height() - m_disqueBound.top())) + m_disqueBound.top());
|
||||
m_disqueFlags[0] = (lamexp_rand() > (UINT_MAX/2));
|
||||
m_disqueFlags[1] = (lamexp_rand() > (UINT_MAX/2));
|
||||
m_disquePos.setX(static_cast<int>(MUtils::next_rand32() % static_cast<unsigned int>(m_disqueBound.right() - disque.width() - m_disqueBound.left())) + m_disqueBound.left());
|
||||
m_disquePos.setY(static_cast<int>(MUtils::next_rand32() % static_cast<unsigned int>(m_disqueBound.bottom() - disque.height() - m_disqueBound.top())) + m_disqueBound.top());
|
||||
m_disqueFlags[0] = (MUtils::next_rand32() > (UINT_MAX/2));
|
||||
m_disqueFlags[1] = (MUtils::next_rand32() > (UINT_MAX/2));
|
||||
m_disque->move(m_disquePos);
|
||||
m_disque->setWindowOpacity(m_discOpacity);
|
||||
m_disque->show();
|
||||
@ -226,19 +234,19 @@ AboutDialog::~AboutDialog(void)
|
||||
if(m_disque)
|
||||
{
|
||||
m_disque->close();
|
||||
LAMEXP_DELETE(m_disque);
|
||||
MUTILS_DELETE(m_disque);
|
||||
}
|
||||
if(m_disqueTimer)
|
||||
{
|
||||
m_disqueTimer->stop();
|
||||
LAMEXP_DELETE(m_disqueTimer);
|
||||
MUTILS_DELETE(m_disqueTimer);
|
||||
}
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
LAMEXP_DELETE(m_cartoon[i]);
|
||||
MUTILS_DELETE(m_cartoon[i]);
|
||||
}
|
||||
LAMEXP_DELETE(m_initFlags);
|
||||
LAMEXP_DELETE(ui);
|
||||
MUTILS_DELETE(m_initFlags);
|
||||
MUTILS_DELETE(ui);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -526,6 +534,8 @@ bool AboutDialog::eventFilter(QObject *obj, QEvent *event)
|
||||
|
||||
void AboutDialog::initInformationTab(void)
|
||||
{
|
||||
const QDate versionDate = MUtils::Version::build_date();
|
||||
|
||||
const QString versionStr = QString().sprintf
|
||||
(
|
||||
"Version %d.%02d %s, Build %d [%s], %s %s, Qt v%s",
|
||||
@ -533,16 +543,16 @@ void AboutDialog::initInformationTab(void)
|
||||
lamexp_version_minor(),
|
||||
lamexp_version_release(),
|
||||
lamexp_version_build(),
|
||||
lamexp_version_date().toString(Qt::ISODate).toLatin1().constData(),
|
||||
lamexp_version_compiler(),
|
||||
lamexp_version_arch(),
|
||||
versionDate.toString(Qt::ISODate).toLatin1().constData(),
|
||||
MUtils::Version::compiler_version(),
|
||||
MUtils::Version::compiler_arch(),
|
||||
qVersion()
|
||||
);
|
||||
|
||||
const QString copyrightStr = QString().sprintf
|
||||
(
|
||||
"Copyright (C) 2004-%04d LoRd_MuldeR <MuldeR2@GMX.de>. Some rights reserved.",
|
||||
qMax(lamexp_version_date().year(), lamexp_current_date_safe().year())
|
||||
qMax(versionDate.year(), MUtils::OS::current_date().year())
|
||||
);
|
||||
|
||||
QString aboutText;
|
||||
@ -553,8 +563,8 @@ void AboutDialog::initInformationTab(void)
|
||||
aboutText += QString("%1<br>").arg(NOBR(tr("Please visit %1 for news and updates!").arg(LINK(lamexp_website_url()))));
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
||||
const QDate currentDate = lamexp_current_date_safe();
|
||||
if(LAMEXP_DEBUG)
|
||||
const QDate currentDate = MUtils::OS::current_date();
|
||||
if(MUTILS_DEBUG)
|
||||
{
|
||||
int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0);
|
||||
aboutText += QString("<hr><font color=\"crimson\">%1</font>").arg(NOBR(QString("!!! --- DEBUG BUILD --- Expires at: %1 · Days left: %2 --- DEBUG BUILD --- !!!").arg(lamexp_version_expires().toString(Qt::ISODate), QString::number(daysLeft))));
|
||||
@ -623,8 +633,8 @@ void AboutDialog::initContributorsTab(void)
|
||||
{
|
||||
QString flagIcon = (strlen(g_lamexp_translators[i].pcFlag) > 0) ? QString("<img src=\":/flags/%1.png\">").arg(g_lamexp_translators[i].pcFlag) : QString();
|
||||
contributorsAboutText += QString("<tr><td valign=\"middle\">%1</td><td>%2</td>").arg(flagIcon, spaces);
|
||||
contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td>").arg(WCHAR2QSTR(g_lamexp_translators[i].pcLanguage), spaces);
|
||||
contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td><td><a href=\"mailto:%3\"><%3></a></td></tr>").arg(WCHAR2QSTR(g_lamexp_translators[i].pcName), spaces, g_lamexp_translators[i].pcMail);
|
||||
contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td>").arg(MUTILS_QSTR(g_lamexp_translators[i].pcLanguage), spaces);
|
||||
contributorsAboutText += QString("<td valign=\"middle\">%1</td><td>%2</td><td><a href=\"mailto:%3\"><%3></a></td></tr>").arg(MUTILS_QSTR(g_lamexp_translators[i].pcName), spaces, g_lamexp_translators[i].pcMail);
|
||||
}
|
||||
|
||||
contributorsAboutText += QString("<tr><td colspan=\"7\"><b> </b></td></tr>");
|
||||
|
@ -36,6 +36,9 @@
|
||||
#include "Registry_Decoder.h"
|
||||
#include "LockedFile.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//Qt includes
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
@ -91,8 +94,8 @@ CueImportDialog::CueImportDialog(QWidget *parent, FileListModel *fileList, const
|
||||
|
||||
CueImportDialog::~CueImportDialog(void)
|
||||
{
|
||||
LAMEXP_DELETE(m_model);
|
||||
LAMEXP_DELETE(ui);
|
||||
MUTILS_DELETE(m_model);
|
||||
MUTILS_DELETE(ui);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -120,7 +123,7 @@ int CueImportDialog::exec(void)
|
||||
QString text = QString("<nobr>%1</nobr><br><nobr>%2</nobr><br><br><nobr>%3</nobr>").arg(tr("Failed to load the Cue Sheet file:"), QDir::toNativeSeparators(m_cueFileName), tr("The specified file could not be found!")).replace("-", "−");
|
||||
QMessageBox::warning(progress, tr("Cue Sheet Error"), text);
|
||||
progress->close();
|
||||
LAMEXP_DELETE(progress);
|
||||
MUTILS_DELETE(progress);
|
||||
return CueSheetModel::ErrorIOFailure;
|
||||
}
|
||||
|
||||
@ -162,8 +165,8 @@ int CueImportDialog::exec(void)
|
||||
if(input->exec() < 1)
|
||||
{
|
||||
progress->close();
|
||||
LAMEXP_DELETE(input);
|
||||
LAMEXP_DELETE(progress);
|
||||
MUTILS_DELETE(input);
|
||||
MUTILS_DELETE(progress);
|
||||
return Rejected;
|
||||
}
|
||||
|
||||
@ -178,7 +181,7 @@ int CueImportDialog::exec(void)
|
||||
codec = QTextCodec::codecForName("System");
|
||||
}
|
||||
|
||||
LAMEXP_DELETE(input);
|
||||
MUTILS_DELETE(input);
|
||||
}
|
||||
|
||||
bomCheck.clear();
|
||||
@ -221,12 +224,12 @@ int CueImportDialog::exec(void)
|
||||
QString text = QString("<nobr>%1</nobr><br><nobr>%2</nobr><br><br><nobr>%3</nobr>").arg(tr("Failed to load the Cue Sheet file:"), QDir::toNativeSeparators(m_cueFileName), errorMsg).replace("-", "−");
|
||||
QMessageBox::warning(progress, tr("Cue Sheet Error"), text);
|
||||
progress->close();
|
||||
LAMEXP_DELETE(progress);
|
||||
MUTILS_DELETE(progress);
|
||||
return iResult;
|
||||
}
|
||||
|
||||
progress->close();
|
||||
LAMEXP_DELETE(progress);
|
||||
MUTILS_DELETE(progress);
|
||||
return QDialog::exec();
|
||||
}
|
||||
|
||||
@ -287,7 +290,7 @@ void CueImportDialog::importButtonClicked(void)
|
||||
return;
|
||||
}
|
||||
|
||||
QFile writeTest(QString("%1/~%2.txt").arg(m_outputDir, lamexp_rand_str()));
|
||||
QFile writeTest(QString("%1/~%2.txt").arg(m_outputDir, MUtils::rand_str()));
|
||||
if(!(writeTest.open(QIODevice::ReadWrite) && (writeTest.write(writeTestBuffer) == strlen(writeTestBuffer))))
|
||||
{
|
||||
QMessageBox::warning(this, tr("LameXP"), QString("<nobr>%2</nobr>").arg(tr("Error: The selected output directory is not writable!")));
|
||||
@ -402,8 +405,8 @@ bool CueImportDialog::analyzeFiles(QStringList &files)
|
||||
}
|
||||
}
|
||||
|
||||
LAMEXP_DELETE(progress);
|
||||
LAMEXP_DELETE(analyzer);
|
||||
MUTILS_DELETE(progress);
|
||||
MUTILS_DELETE(analyzer);
|
||||
|
||||
return bSuccess;
|
||||
}
|
||||
@ -440,6 +443,6 @@ void CueImportDialog::splitFiles(void)
|
||||
QMessageBox::information(this, tr("Cue Sheet Completed"), text);
|
||||
}
|
||||
|
||||
LAMEXP_DELETE(splitter);
|
||||
LAMEXP_DELETE(progress);
|
||||
MUTILS_DELETE(splitter);
|
||||
MUTILS_DELETE(progress);
|
||||
}
|
||||
|
@ -24,9 +24,14 @@
|
||||
|
||||
#include "UIC_DropBox.h"
|
||||
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
#include "Model_Settings.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//Qt
|
||||
#include <QThread>
|
||||
#include <QMovie>
|
||||
#include <QKeyEvent>
|
||||
@ -96,10 +101,10 @@ DropBox::~DropBox(void)
|
||||
m_settings->dropBoxWidgetPositionY(this->y());
|
||||
}
|
||||
|
||||
LAMEXP_DELETE(m_counterLabel);
|
||||
LAMEXP_DELETE(m_windowReferencePoint);
|
||||
LAMEXP_DELETE(m_mouseReferencePoint);
|
||||
LAMEXP_DELETE(ui);
|
||||
MUTILS_DELETE(m_counterLabel);
|
||||
MUTILS_DELETE(m_windowReferencePoint);
|
||||
MUTILS_DELETE(m_mouseReferencePoint);
|
||||
MUTILS_DELETE(ui);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -28,6 +28,9 @@
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//Qt includes
|
||||
#include <QClipboard>
|
||||
#include <QFileDialog>
|
||||
@ -66,9 +69,9 @@ LogViewDialog::~LogViewDialog(void)
|
||||
QApplication::clipboard()->clear();
|
||||
}
|
||||
|
||||
LAMEXP_DELETE(m_oldIcon);
|
||||
LAMEXP_DELETE(m_acceptIcon);
|
||||
LAMEXP_DELETE(ui);
|
||||
MUTILS_DELETE(m_oldIcon);
|
||||
MUTILS_DELETE(m_acceptIcon);
|
||||
MUTILS_DELETE(ui);
|
||||
}
|
||||
|
||||
int LogViewDialog::exec(const QStringList &logData)
|
||||
@ -80,7 +83,7 @@ int LogViewDialog::exec(const QStringList &logData)
|
||||
void LogViewDialog::copyButtonClicked(void)
|
||||
{
|
||||
QMimeData *mime = new QMimeData();
|
||||
mime->setData("text/plain", QUTF8(ui->textEdit->toPlainText()));
|
||||
mime->setData("text/plain", MUTILS_UTF8(ui->textEdit->toPlainText()));
|
||||
QApplication::clipboard()->setMimeData(mime);
|
||||
m_clipboardUsed = true;
|
||||
m_oldIcon->swap(ui->buttonCopy->icon());
|
||||
|
@ -47,6 +47,11 @@
|
||||
#include "ShellIntegration.h"
|
||||
#include "CustomEventFilter.h"
|
||||
|
||||
//Mutils includes
|
||||
#include <MUtils/Global.h>
|
||||
#include <MUtils/OSSupport.h>
|
||||
#include <MUtils/Version.h>
|
||||
|
||||
//Qt includes
|
||||
#include <QMessageBox>
|
||||
#include <QTimer>
|
||||
@ -153,7 +158,7 @@ while(0)
|
||||
{ \
|
||||
QItemSelectionModel *_tmp = (VIEW)->selectionModel(); \
|
||||
(VIEW)->setModel(MODEL); \
|
||||
LAMEXP_DELETE(_tmp); \
|
||||
MUTILS_DELETE(_tmp); \
|
||||
} \
|
||||
while(0)
|
||||
|
||||
@ -720,28 +725,28 @@ 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_droppedFileList);
|
||||
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_evenFilterCornerWidget);
|
||||
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)
|
||||
@ -751,7 +756,7 @@ MainWindow::~MainWindow(void)
|
||||
}
|
||||
|
||||
//Un-initialize the dialog
|
||||
LAMEXP_DELETE(ui);
|
||||
MUTILS_DELETE(ui);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -815,7 +820,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();
|
||||
}
|
||||
|
||||
@ -893,7 +898,7 @@ bool MainWindow::checkForUpdates(void)
|
||||
bReadyToInstall = updateDialog->updateReadyToInstall();
|
||||
}
|
||||
|
||||
LAMEXP_DELETE(updateDialog);
|
||||
MUTILS_DELETE(updateDialog);
|
||||
return bReadyToInstall;
|
||||
}
|
||||
|
||||
@ -911,7 +916,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();
|
||||
@ -1062,7 +1067,7 @@ void MainWindow::changeEvent(QEvent *e)
|
||||
ui->comboBoxOpusFramesize->setCurrentIndex(comboBoxIndex[7]);
|
||||
|
||||
//Update the window title
|
||||
if(LAMEXP_DEBUG)
|
||||
if(MUTILS_DEBUG)
|
||||
{
|
||||
setWindowTitle(QString("%1 [!!! DEBUG BUILD !!!]").arg(windowTitle()));
|
||||
}
|
||||
@ -1308,7 +1313,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)
|
||||
@ -1341,7 +1346,7 @@ 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("whammy", false);
|
||||
@ -1368,7 +1373,7 @@ void MainWindow::windowShown(void)
|
||||
}
|
||||
|
||||
//Update reminder
|
||||
if(lamexp_current_date_safe() >= lamexp_version_date().addYears(1))
|
||||
if(MUtils::OS::current_date() >= MUtils::Version::build_date().addYears(1))
|
||||
{
|
||||
qWarning("Binary is more than a year old, time to update!");
|
||||
SHOW_CORNER_WIDGET(true);
|
||||
@ -1395,7 +1400,7 @@ void MainWindow::windowShown(void)
|
||||
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))))
|
||||
{
|
||||
SHOW_CORNER_WIDGET(true);
|
||||
if(m_settings->autoUpdateEnabled())
|
||||
@ -1458,7 +1463,7 @@ void MainWindow::windowShown(void)
|
||||
if(!arguments[i].compare("--add", Qt::CaseInsensitive))
|
||||
{
|
||||
QFileInfo currentFile(arguments[++i].trimmed());
|
||||
qDebug("Adding file from CLI: %s", QUTF8(currentFile.absoluteFilePath()));
|
||||
qDebug("Adding file from CLI: %s", MUTILS_UTF8(currentFile.absoluteFilePath()));
|
||||
addedFiles.append(currentFile.absoluteFilePath());
|
||||
}
|
||||
if(!addedFiles.isEmpty())
|
||||
@ -1473,13 +1478,13 @@ void MainWindow::windowShown(void)
|
||||
if(!arguments[i].compare("--add-folder", Qt::CaseInsensitive))
|
||||
{
|
||||
QFileInfo currentFile(arguments[++i].trimmed());
|
||||
qDebug("Adding folder from CLI: %s", QUTF8(currentFile.absoluteFilePath()));
|
||||
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", QUTF8(currentFile.absoluteFilePath()));
|
||||
qDebug("Adding folder recursively from CLI: %s", MUTILS_UTF8(currentFile.absoluteFilePath()));
|
||||
addFolder(currentFile.absoluteFilePath(), true, true);
|
||||
}
|
||||
}
|
||||
@ -1549,10 +1554,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);
|
||||
}
|
||||
|
||||
// =========================================================
|
||||
@ -1577,7 +1582,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)
|
||||
@ -1635,7 +1640,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!")));
|
||||
@ -1664,7 +1669,7 @@ void MainWindow::aboutButtonClicked(void)
|
||||
(
|
||||
AboutDialog *aboutBox = new AboutDialog(m_settings, this);
|
||||
aboutBox->exec();
|
||||
LAMEXP_DELETE(aboutBox);
|
||||
MUTILS_DELETE(aboutBox);
|
||||
);
|
||||
}
|
||||
|
||||
@ -1848,7 +1853,7 @@ void MainWindow::styleActionActivated(QAction *action)
|
||||
if(QEvent *e = new QEvent(QEvent::LanguageChange))
|
||||
{
|
||||
changeEvent(e);
|
||||
LAMEXP_DELETE(e);
|
||||
MUTILS_DELETE(e);
|
||||
}
|
||||
|
||||
//Make transparent
|
||||
@ -2053,7 +2058,7 @@ 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)
|
||||
@ -2220,7 +2225,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());
|
||||
@ -2420,7 +2425,7 @@ void MainWindow::showDetailsButtonClicked(void)
|
||||
if(!iResult) break;
|
||||
}
|
||||
|
||||
LAMEXP_DELETE(metaInfoDialog);
|
||||
MUTILS_DELETE(metaInfoDialog);
|
||||
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
sourceFilesScrollbarMoved(0);
|
||||
}
|
||||
@ -2526,14 +2531,14 @@ void MainWindow::handleDroppedFiles(void)
|
||||
|
||||
if(file.isFile())
|
||||
{
|
||||
qDebug("Dropped File: %s", QUTF8(file.canonicalFilePath()));
|
||||
qDebug("Dropped File: %s", MUTILS_UTF8(file.canonicalFilePath()));
|
||||
droppedFiles << file.canonicalFilePath();
|
||||
continue;
|
||||
}
|
||||
|
||||
if(file.isDir())
|
||||
{
|
||||
qDebug("Dropped Folder: %s", QUTF8(file.canonicalFilePath()));
|
||||
qDebug("Dropped Folder: %s", MUTILS_UTF8(file.canonicalFilePath()));
|
||||
QFileInfoList list = QDir(file.canonicalFilePath()).entryInfoList(QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks);
|
||||
if(list.count() > 0)
|
||||
{
|
||||
@ -2549,7 +2554,7 @@ void MainWindow::handleDroppedFiles(void)
|
||||
SHOW_BANNER_CONDITIONALLY(bUseBanner, (list.count() >= MIN_COUNT), bannerText);
|
||||
for(QFileInfoList::ConstIterator iter = list.constBegin(); iter != list.constEnd(); iter++)
|
||||
{
|
||||
qDebug("Descending to Folder: %s", QUTF8((*iter).canonicalFilePath()));
|
||||
qDebug("Descending to Folder: %s", MUTILS_UTF8((*iter).canonicalFilePath()));
|
||||
m_droppedFileList->prepend(QUrl::fromLocalFile((*iter).canonicalFilePath()));
|
||||
}
|
||||
}
|
||||
@ -3138,7 +3143,7 @@ void MainWindow::initOutputFolderModel(void)
|
||||
if(m_fileSystemModel)
|
||||
{
|
||||
SET_MODEL(ui->outputFolderView, NULL);
|
||||
LAMEXP_DELETE(m_fileSystemModel);
|
||||
MUTILS_DELETE(m_fileSystemModel);
|
||||
ui->outputFolderView->repaint();
|
||||
}
|
||||
|
||||
@ -3941,7 +3946,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();
|
||||
@ -4021,7 +4026,7 @@ void MainWindow::showCustomParamsHelpScreen(const QString &toolName, const QStri
|
||||
}
|
||||
|
||||
QProcess process;
|
||||
lamexp_init_process(process, QFileInfo(binary).absolutePath());
|
||||
MUtils::init_process(process, QFileInfo(binary).absolutePath());
|
||||
|
||||
process.start(binary, command.isEmpty() ? QStringList() : QStringList() << command);
|
||||
|
||||
@ -4064,7 +4069,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)
|
||||
@ -4154,13 +4159,13 @@ void MainWindow::addFileDelayed(const QString &filePath, bool tryASAP)
|
||||
{
|
||||
if(tryASAP && !m_delayedFileTimer->isActive())
|
||||
{
|
||||
qDebug("Received file: %s", QUTF8(filePath));
|
||||
qDebug("Received file: %s", MUTILS_UTF8(filePath));
|
||||
m_delayedFileList->append(filePath);
|
||||
QTimer::singleShot(0, this, SLOT(handleDelayedFiles()));
|
||||
}
|
||||
|
||||
m_delayedFileTimer->stop();
|
||||
qDebug("Received file: %s", QUTF8(filePath));
|
||||
qDebug("Received file: %s", MUTILS_UTF8(filePath));
|
||||
m_delayedFileList->append(filePath);
|
||||
m_delayedFileTimer->start(5000);
|
||||
}
|
||||
|
@ -22,9 +22,14 @@
|
||||
|
||||
#include "Dialog_MetaInfo.h"
|
||||
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
#include "Model_MetaInfo.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//Qt
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
#include <QTimer>
|
||||
@ -90,8 +95,8 @@ MetaInfoDialog::MetaInfoDialog(QWidget *parent)
|
||||
|
||||
MetaInfoDialog::~MetaInfoDialog(void)
|
||||
{
|
||||
LAMEXP_DELETE(m_contextMenuInfo);
|
||||
LAMEXP_DELETE(m_contextMenuArtwork);
|
||||
MUTILS_DELETE(m_contextMenuInfo);
|
||||
MUTILS_DELETE(m_contextMenuArtwork);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -135,7 +140,7 @@ int MetaInfoDialog::exec(AudioFileModel &audioFile, bool allowUp, bool allowDown
|
||||
int iResult = QDialog::exec();
|
||||
|
||||
tableView->setModel(NULL);
|
||||
LAMEXP_DELETE(model);
|
||||
MUTILS_DELETE(model);
|
||||
|
||||
return iResult;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
//UIC includes
|
||||
#include "UIC_ProcessingDialog.h"
|
||||
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
#include "Model_FileList.h"
|
||||
#include "Model_Progress.h"
|
||||
@ -42,6 +43,10 @@
|
||||
#include "Filter_ToneAdjust.h"
|
||||
#include "WinSevenTaskbar.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//Qt
|
||||
#include <QApplication>
|
||||
#include <QRect>
|
||||
#include <QDesktopWidget>
|
||||
@ -338,18 +343,18 @@ ProcessingDialog::~ProcessingDialog(void)
|
||||
}
|
||||
}
|
||||
|
||||
LAMEXP_DELETE(m_progressIndicator);
|
||||
LAMEXP_DELETE(m_systemTray);
|
||||
LAMEXP_DELETE(m_diskObserver);
|
||||
LAMEXP_DELETE(m_cpuObserver);
|
||||
LAMEXP_DELETE(m_ramObserver);
|
||||
LAMEXP_DELETE(m_progressViewFilterGroup);
|
||||
LAMEXP_DELETE(m_filterInfoLabel);
|
||||
LAMEXP_DELETE(m_filterInfoLabelIcon);
|
||||
LAMEXP_DELETE(m_contextMenu);
|
||||
LAMEXP_DELETE(m_progressModel);
|
||||
LAMEXP_DELETE(m_threadPool);
|
||||
LAMEXP_DELETE(m_defaultColor);
|
||||
MUTILS_DELETE(m_progressIndicator);
|
||||
MUTILS_DELETE(m_systemTray);
|
||||
MUTILS_DELETE(m_diskObserver);
|
||||
MUTILS_DELETE(m_cpuObserver);
|
||||
MUTILS_DELETE(m_ramObserver);
|
||||
MUTILS_DELETE(m_progressViewFilterGroup);
|
||||
MUTILS_DELETE(m_filterInfoLabel);
|
||||
MUTILS_DELETE(m_filterInfoLabelIcon);
|
||||
MUTILS_DELETE(m_contextMenu);
|
||||
MUTILS_DELETE(m_progressModel);
|
||||
MUTILS_DELETE(m_threadPool);
|
||||
MUTILS_DELETE(m_defaultColor);
|
||||
|
||||
WinSevenTaskbar::setOverlayIcon(this, NULL);
|
||||
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNoState);
|
||||
@ -360,7 +365,7 @@ ProcessingDialog::~ProcessingDialog(void)
|
||||
m_windowIcon = NULL;
|
||||
}
|
||||
|
||||
LAMEXP_DELETE(ui);
|
||||
MUTILS_DELETE(ui);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -514,7 +519,7 @@ void ProcessingDialog::initEncoding(void)
|
||||
|
||||
if(!m_diskObserver)
|
||||
{
|
||||
m_diskObserver = new DiskObserverThread(m_settings->customTempPathEnabled() ? m_settings->customTempPath() : lamexp_temp_folder2());
|
||||
m_diskObserver = new DiskObserverThread(m_settings->customTempPathEnabled() ? m_settings->customTempPath() : MUtils::temp_folder());
|
||||
connect(m_diskObserver, SIGNAL(messageLogged(QString,int)), m_progressModel, SLOT(addSystemMessage(QString,int)), Qt::QueuedConnection);
|
||||
connect(m_diskObserver, SIGNAL(freeSpaceChanged(quint64)), this, SLOT(diskUsageHasChanged(quint64)), Qt::QueuedConnection);
|
||||
m_diskObserver->start();
|
||||
@ -597,7 +602,7 @@ void ProcessingDialog::startNextJob(void)
|
||||
(
|
||||
currentFile,
|
||||
(m_settings->outputToSourceDir() ? QFileInfo(currentFile.filePath()).absolutePath() : m_settings->outputDir()),
|
||||
(m_settings->customTempPathEnabled() ? m_settings->customTempPath() : lamexp_temp_folder2()),
|
||||
(m_settings->customTempPathEnabled() ? m_settings->customTempPath() : MUtils::temp_folder()),
|
||||
encoder,
|
||||
m_settings->prependRelativeSourcePath() && (!m_settings->outputToSourceDir())
|
||||
);
|
||||
@ -828,7 +833,7 @@ void ProcessingDialog::logViewDoubleClicked(const QModelIndex &index)
|
||||
LogViewDialog *logView = new LogViewDialog(this);
|
||||
logView->setWindowTitle(QString("LameXP - [%1]").arg(m_progressModel->data(index, Qt::DisplayRole).toString()));
|
||||
logView->exec(logFile);
|
||||
LAMEXP_DELETE(logView);
|
||||
MUTILS_DELETE(logView);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1013,7 +1018,7 @@ void ProcessingDialog::writePlayList(void)
|
||||
//Do we need an UTF-8 playlist?
|
||||
for(int i = 0; i < list.count(); i++)
|
||||
{
|
||||
if(wcscmp(QWCHAR(QString::fromLatin1(list.at(i).toLatin1().constData())), QWCHAR(list.at(i))))
|
||||
if(wcscmp(MUTILS_WCHR(QString::fromLatin1(list.at(i).toLatin1().constData())), MUTILS_WCHR(list.at(i))))
|
||||
{
|
||||
useUtf8 = true;
|
||||
break;
|
||||
@ -1038,7 +1043,7 @@ void ProcessingDialog::writePlayList(void)
|
||||
playList.write("#EXTM3U\r\n");
|
||||
while(!list.isEmpty())
|
||||
{
|
||||
playList.write(useUtf8 ? QUTF8(list.takeFirst()) : list.takeFirst().toLatin1().constData());
|
||||
playList.write(useUtf8 ? MUTILS_UTF8(list.takeFirst()) : list.takeFirst().toLatin1().constData());
|
||||
playList.write("\r\n");
|
||||
}
|
||||
playList.close();
|
||||
|
@ -22,15 +22,19 @@
|
||||
|
||||
#include "Dialog_SplashScreen.h"
|
||||
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
#include "WinSevenTaskbar.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//Qt
|
||||
#include <QThread>
|
||||
#include <QMovie>
|
||||
#include <QKeyEvent>
|
||||
#include <QTimer>
|
||||
|
||||
#include "WinSevenTaskbar.h"
|
||||
|
||||
#define FADE_DELAY 16
|
||||
#define OPACITY_DELTA 0.04
|
||||
|
||||
@ -104,9 +108,9 @@ SplashScreen::~SplashScreen(void)
|
||||
m_working->stop();
|
||||
}
|
||||
|
||||
LAMEXP_DELETE(m_working);
|
||||
LAMEXP_DELETE(m_loop);
|
||||
LAMEXP_DELETE(m_timer);
|
||||
MUTILS_DELETE(m_working);
|
||||
MUTILS_DELETE(m_loop);
|
||||
MUTILS_DELETE(m_timer);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -162,7 +166,7 @@ void SplashScreen::showSplash(QThread *thread)
|
||||
splashScreen->close();
|
||||
|
||||
//Free
|
||||
LAMEXP_DELETE(splashScreen);
|
||||
MUTILS_DELETE(splashScreen);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/UpdateChecker.h>
|
||||
#include <MUtils/Version.h>
|
||||
|
||||
//Qt includes
|
||||
#include <QClipboard>
|
||||
@ -143,14 +144,14 @@ UpdateDialog::~UpdateDialog(void)
|
||||
}
|
||||
}
|
||||
|
||||
LAMEXP_DELETE(m_thread);
|
||||
LAMEXP_DELETE(m_logFile);
|
||||
LAMEXP_DELETE(m_animator);
|
||||
MUTILS_DELETE(m_thread);
|
||||
MUTILS_DELETE(m_logFile);
|
||||
MUTILS_DELETE(m_animator);
|
||||
|
||||
WinSevenTaskbar::setTaskbarState(this->parentWidget(), WinSevenTaskbar::WinSevenTaskbarNoState);
|
||||
WinSevenTaskbar::setOverlayIcon(this->parentWidget(), NULL);
|
||||
|
||||
LAMEXP_DELETE(ui);
|
||||
MUTILS_DELETE(ui);
|
||||
}
|
||||
|
||||
void UpdateDialog::showEvent(QShowEvent *event)
|
||||
@ -170,7 +171,7 @@ void UpdateDialog::showEvent(QShowEvent *event)
|
||||
}
|
||||
|
||||
threadStatusChanged(m_thread->getUpdateStatus());
|
||||
ui->labelVersionInstalled->setText(QString("%1 %2 (%3)").arg(tr("Build"), QString::number(lamexp_version_build()), lamexp_version_date().toString(Qt::ISODate)));
|
||||
ui->labelVersionInstalled->setText(QString("%1 %2 (%3)").arg(tr("Build"), QString::number(lamexp_version_build()), MUtils::Version::build_date().toString(Qt::ISODate)));
|
||||
ui->labelVersionLatest->setText(QString("(%1)").arg(tr("Unknown")));
|
||||
|
||||
ui->installButton->setEnabled(false);
|
||||
@ -404,7 +405,7 @@ void UpdateDialog::applyUpdate(void)
|
||||
QStringList args;
|
||||
QEventLoop loop;
|
||||
|
||||
lamexp_init_process(process, QFileInfo(m_binaryUpdater).absolutePath(), false);
|
||||
MUtils::init_process(process, QFileInfo(m_binaryUpdater).absolutePath(), false);
|
||||
|
||||
connect(&process, SIGNAL(error(QProcess::ProcessError)), &loop, SLOT(quit()));
|
||||
connect(&process, SIGNAL(finished(int,QProcess::ExitStatus)), &loop, SLOT(quit()));
|
||||
@ -461,7 +462,7 @@ void UpdateDialog::logButtonClicked(void)
|
||||
{
|
||||
LogViewDialog *logView = new LogViewDialog(this);
|
||||
logView->exec(*m_logFile);
|
||||
LAMEXP_DELETE(logView);
|
||||
MUTILS_DELETE(logView);
|
||||
}
|
||||
|
||||
void UpdateDialog::progressBarValueChanged(int value)
|
||||
@ -489,7 +490,7 @@ void UpdateDialog::testKnownHosts(void)
|
||||
loop.exec(QEventLoop::ExcludeUserInputEvents);
|
||||
}
|
||||
|
||||
LAMEXP_DELETE(testThread);
|
||||
MUTILS_DELETE(testThread);
|
||||
logButtonClicked();
|
||||
}
|
||||
|
||||
|
@ -23,9 +23,14 @@
|
||||
#include "Dialog_WorkingBanner.h"
|
||||
#include "UIC_WorkingBanner.h"
|
||||
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
#include "WinSevenTaskbar.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//Qt
|
||||
#include <QThread>
|
||||
#include <QMovie>
|
||||
#include <QKeyEvent>
|
||||
@ -120,11 +125,11 @@ WorkingBanner::~WorkingBanner(void)
|
||||
if(m_working)
|
||||
{
|
||||
m_working->stop();
|
||||
LAMEXP_DELETE(m_working);
|
||||
MUTILS_DELETE(m_working);
|
||||
}
|
||||
|
||||
LAMEXP_DELETE(m_style);
|
||||
LAMEXP_DELETE(m_metrics);
|
||||
MUTILS_DELETE(m_style);
|
||||
MUTILS_DELETE(m_metrics);
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@ -180,7 +185,7 @@ void WorkingBanner::show(const QString &text, QThread *thread)
|
||||
WinSevenTaskbar::setOverlayIcon(dynamic_cast<QWidget*>(this->parent()), NULL);
|
||||
|
||||
//Free memory
|
||||
LAMEXP_DELETE(loop);
|
||||
MUTILS_DELETE(loop);
|
||||
|
||||
//Hide splash
|
||||
this->close();
|
||||
|
@ -22,10 +22,17 @@
|
||||
|
||||
#include "Encoder_AAC_QAAC.h"
|
||||
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
#include "Model_Settings.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//StdLib
|
||||
#include <math.h>
|
||||
|
||||
//Qt
|
||||
#include <QProcess>
|
||||
#include <QDir>
|
||||
#include <QCoreApplication>
|
||||
@ -145,7 +152,7 @@ bool QAACEncoder::encode(const QString &sourceFile, const AudioFileModel_MetaInf
|
||||
process.setWorkingDirectory(QFileInfo(outputFile).canonicalPath());
|
||||
|
||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||
env.insert("PATH", QDir::toNativeSeparators(QString("%1;%1/QTfiles;%2").arg(QDir(QCoreApplication::applicationDirPath()).canonicalPath(), lamexp_temp_folder2())));
|
||||
env.insert("PATH", QDir::toNativeSeparators(QString("%1;%1/QTfiles;%2").arg(QDir(QCoreApplication::applicationDirPath()).canonicalPath(), MUtils::temp_folder())));
|
||||
process.setProcessEnvironment(env);
|
||||
|
||||
if(m_configRCMode != SettingsModel::VBRMode)
|
||||
|
@ -22,8 +22,12 @@
|
||||
|
||||
#include "Encoder_Abstract.h"
|
||||
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
AbstractEncoder::AbstractEncoder(void)
|
||||
{
|
||||
m_configBitrate = 0;
|
||||
@ -79,7 +83,7 @@ const bool AbstractEncoder::needsTimingInfo(void)
|
||||
bool AbstractEncoder::isUnicode(const QString &original)
|
||||
{
|
||||
QString asLatin1 = QString::fromLatin1(original.toLatin1().constData());
|
||||
return (wcscmp(QWCHAR(original), QWCHAR(asLatin1)) != 0);
|
||||
return (wcscmp(MUTILS_WCHR(original), MUTILS_WCHR(asLatin1)) != 0);
|
||||
}
|
||||
|
||||
//Remove "problematic" characters from tag
|
||||
|
36
src/Global.h
36
src/Global.h
@ -163,8 +163,6 @@ bool lamexp_check_sysmenu_msg(void *message, const unsigned int identifier);
|
||||
bool lamexp_check_tool(const QString &toolName);
|
||||
const QString lamexp_clean_filename(const QString &str);
|
||||
const QString lamexp_clean_filepath(const QString &str);
|
||||
bool lamexp_clean_folder(const QString &folderPath);
|
||||
QDate lamexp_current_date_safe(void);
|
||||
unsigned __int64 lamexp_current_file_time(void);
|
||||
void lamexp_dbg_dbg_output_string(const char* format, ...);
|
||||
unsigned long lamexp_dbg_private_bytes(void);
|
||||
@ -181,7 +179,6 @@ const lamexp_os_version_t &lamexp_get_os_version(void);
|
||||
void lamexp_init_console(const QStringList &argv);
|
||||
void lamexp_init_error_handlers(void);
|
||||
int lamexp_init_ipc(void);
|
||||
void lamexp_init_process(QProcess &process, const QString &wokringDir, const bool bReplaceTempDir = true);
|
||||
bool lamexp_init_qt(int argc, char* argv[]);
|
||||
bool lamexp_install_translator(const QString &language);
|
||||
bool lamexp_install_translator_from_file(const QString &qmFile);
|
||||
@ -206,20 +203,14 @@ bool lamexp_play_sound_alias(const QString &alias, const bool bAsync);
|
||||
bool lamexp_portable_mode(void);
|
||||
unsigned long lamexp_process_id(const QProcess *proc);
|
||||
QStringList lamexp_query_translations(void);
|
||||
unsigned int lamexp_rand(void);
|
||||
QString lamexp_rand_str(const bool bLong = false);
|
||||
void lamexp_register_tool(const QString &toolName, LockedFile *file, unsigned int version = 0, const QString *tag = NULL);
|
||||
bool lamexp_remove_file(const QString &filename);
|
||||
void lamexp_seed_rand(void);
|
||||
lamexp_icon_t *lamexp_set_window_icon(QWidget *window, const QIcon &icon, const bool bIsBigIcon);
|
||||
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);
|
||||
int lamexp_system_message(const wchar_t *text, int beepType);
|
||||
const char *lamexp_support_url(void);
|
||||
const QString &lamexp_temp_folder2(void);
|
||||
bool lamexp_themes_enabled(void);
|
||||
unsigned int lamexp_tool_version(const QString &toolName, QString *tag = NULL);
|
||||
unsigned int lamexp_toolver_coreaudio(void);
|
||||
@ -235,52 +226,25 @@ unsigned int lamexp_translation_sysid(const QString &langId);
|
||||
bool lamexp_update_sysmenu(const QWidget *win, const unsigned int identifier, const QString &text);
|
||||
bool lamexp_user_is_admin(void);
|
||||
const QString lamexp_version2string(const QString &pattern, unsigned int version, const QString &defaultText, const QString *tag = NULL);
|
||||
const char *lamexp_version_arch(void);
|
||||
unsigned int lamexp_version_build(void);
|
||||
const char *lamexp_version_compiler(void);
|
||||
unsigned int lamexp_version_confg(void);
|
||||
const QDate &lamexp_version_date(void);
|
||||
bool lamexp_version_demo(void);
|
||||
QDate lamexp_version_expires(void);
|
||||
unsigned int lamexp_version_major(void);
|
||||
unsigned int lamexp_version_minor(void);
|
||||
const char *lamexp_version_release(void);
|
||||
const char *lamexp_version_time(void);
|
||||
const char *lamexp_website_url(void);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// HELPER MACROS
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define LAMEXP_BOOL2STR(X) ((X) ? "1" : "0")
|
||||
#define LAMEXP_COMPILER_WARNING(TXT) __pragma(message(__FILE__ "(" LAMEXP_MAKE_STRING(__LINE__) ") : warning: " TXT))
|
||||
#define LAMEXP_CLOSE(HANDLE) do { if(HANDLE != NULL && HANDLE != INVALID_HANDLE_VALUE) { CloseHandle(HANDLE); HANDLE = NULL; } } while(0)
|
||||
#define LAMEXP_DELETE(PTR) do { if(PTR) { delete PTR; PTR = NULL; } } while(0)
|
||||
#define LAMEXP_DELETE_ARRAY(PTR) do { if(PTR) { delete [] PTR; PTR = 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("<nobr>%1</nobr>").arg((STR)).replace("-", "−"))
|
||||
#define QUTF8(STR) ((STR).toUtf8().constData())
|
||||
#define QWCHAR(STR) (reinterpret_cast<const wchar_t*>((STR).utf16()))
|
||||
#define WCHAR2QSTR(STR) (QString::fromUtf16(reinterpret_cast<const unsigned short*>((STR))))
|
||||
|
||||
//Check for debug build
|
||||
#if defined(_DEBUG) && defined(QT_DEBUG) && !defined(NDEBUG) && !defined(QT_NO_DEBUG)
|
||||
#define LAMEXP_DEBUG (1)
|
||||
#elif defined(NDEBUG) && defined(QT_NO_DEBUG) && !defined(_DEBUG) && !defined(QT_DEBUG)
|
||||
#define LAMEXP_DEBUG (0)
|
||||
#else
|
||||
#error Inconsistent debug defines detected!
|
||||
#endif
|
||||
|
||||
//Check for CPU-compatibility options
|
||||
#if !defined(_M_X64) && defined(_MSC_VER) && defined(_M_IX86_FP)
|
||||
#if (_M_IX86_FP != 0)
|
||||
#error We should not enabled SSE or SSE2 in release builds!
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Helper macro for throwing exceptions
|
||||
#define THROW(MESSAGE) do \
|
||||
|
@ -22,6 +22,9 @@
|
||||
|
||||
#include "Global.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//Qt includes
|
||||
#include <QSharedMemory>
|
||||
#include <QSystemSemaphore>
|
||||
@ -106,41 +109,41 @@ int lamexp_init_ipc(void)
|
||||
if(g_lamexp_ipc_ptr.semaphore_read->error() != QSystemSemaphore::NoError)
|
||||
{
|
||||
QString errorMessage = g_lamexp_ipc_ptr.semaphore_read->errorString();
|
||||
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_read);
|
||||
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write);
|
||||
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_read_mutex);
|
||||
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write_mutex);
|
||||
qFatal("Failed to create system smaphore: %s", QUTF8(errorMessage));
|
||||
MUTILS_DELETE(g_lamexp_ipc_ptr.semaphore_read);
|
||||
MUTILS_DELETE(g_lamexp_ipc_ptr.semaphore_write);
|
||||
MUTILS_DELETE(g_lamexp_ipc_ptr.semaphore_read_mutex);
|
||||
MUTILS_DELETE(g_lamexp_ipc_ptr.semaphore_write_mutex);
|
||||
qFatal("Failed to create system smaphore: %s", MUTILS_UTF8(errorMessage));
|
||||
return -1;
|
||||
}
|
||||
if(g_lamexp_ipc_ptr.semaphore_write->error() != QSystemSemaphore::NoError)
|
||||
{
|
||||
QString errorMessage = g_lamexp_ipc_ptr.semaphore_write->errorString();
|
||||
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_read);
|
||||
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write);
|
||||
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_read_mutex);
|
||||
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write_mutex);
|
||||
qFatal("Failed to create system smaphore: %s", QUTF8(errorMessage));
|
||||
MUTILS_DELETE(g_lamexp_ipc_ptr.semaphore_read);
|
||||
MUTILS_DELETE(g_lamexp_ipc_ptr.semaphore_write);
|
||||
MUTILS_DELETE(g_lamexp_ipc_ptr.semaphore_read_mutex);
|
||||
MUTILS_DELETE(g_lamexp_ipc_ptr.semaphore_write_mutex);
|
||||
qFatal("Failed to create system smaphore: %s", MUTILS_UTF8(errorMessage));
|
||||
return -1;
|
||||
}
|
||||
if(g_lamexp_ipc_ptr.semaphore_read_mutex->error() != QSystemSemaphore::NoError)
|
||||
{
|
||||
QString errorMessage = g_lamexp_ipc_ptr.semaphore_read_mutex->errorString();
|
||||
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_read);
|
||||
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write);
|
||||
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_read_mutex);
|
||||
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write_mutex);
|
||||
qFatal("Failed to create system smaphore: %s", QUTF8(errorMessage));
|
||||
MUTILS_DELETE(g_lamexp_ipc_ptr.semaphore_read);
|
||||
MUTILS_DELETE(g_lamexp_ipc_ptr.semaphore_write);
|
||||
MUTILS_DELETE(g_lamexp_ipc_ptr.semaphore_read_mutex);
|
||||
MUTILS_DELETE(g_lamexp_ipc_ptr.semaphore_write_mutex);
|
||||
qFatal("Failed to create system smaphore: %s", MUTILS_UTF8(errorMessage));
|
||||
return -1;
|
||||
}
|
||||
if(g_lamexp_ipc_ptr.semaphore_write_mutex->error() != QSystemSemaphore::NoError)
|
||||
{
|
||||
QString errorMessage = g_lamexp_ipc_ptr.semaphore_write_mutex->errorString();
|
||||
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_read);
|
||||
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write);
|
||||
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_read_mutex);
|
||||
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write_mutex);
|
||||
qFatal("Failed to create system smaphore: %s", QUTF8(errorMessage));
|
||||
MUTILS_DELETE(g_lamexp_ipc_ptr.semaphore_read);
|
||||
MUTILS_DELETE(g_lamexp_ipc_ptr.semaphore_write);
|
||||
MUTILS_DELETE(g_lamexp_ipc_ptr.semaphore_read_mutex);
|
||||
MUTILS_DELETE(g_lamexp_ipc_ptr.semaphore_write_mutex);
|
||||
qFatal("Failed to create system smaphore: %s", MUTILS_UTF8(errorMessage));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -158,16 +161,16 @@ int lamexp_init_ipc(void)
|
||||
else
|
||||
{
|
||||
QString errorMessage = g_lamexp_ipc_ptr.sharedmem->errorString();
|
||||
LAMEXP_DELETE(g_lamexp_ipc_ptr.sharedmem);
|
||||
qFatal("Failed to attach to shared memory: %s", QUTF8(errorMessage));
|
||||
MUTILS_DELETE(g_lamexp_ipc_ptr.sharedmem);
|
||||
qFatal("Failed to attach to shared memory: %s", MUTILS_UTF8(errorMessage));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QString errorMessage = g_lamexp_ipc_ptr.sharedmem->errorString();
|
||||
LAMEXP_DELETE(g_lamexp_ipc_ptr.sharedmem);
|
||||
qFatal("Failed to create shared memory: %s", QUTF8(errorMessage));
|
||||
MUTILS_DELETE(g_lamexp_ipc_ptr.sharedmem);
|
||||
qFatal("Failed to create shared memory: %s", MUTILS_UTF8(errorMessage));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -275,9 +278,9 @@ extern "C" void _lamexp_global_free_ipcom(void)
|
||||
g_lamexp_ipc_ptr.sharedmem->detach();
|
||||
}
|
||||
|
||||
LAMEXP_DELETE(g_lamexp_ipc_ptr.sharedmem);
|
||||
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_read);
|
||||
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write);
|
||||
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_read_mutex);
|
||||
LAMEXP_DELETE(g_lamexp_ipc_ptr.semaphore_write_mutex);
|
||||
MUTILS_DELETE(g_lamexp_ipc_ptr.sharedmem);
|
||||
MUTILS_DELETE(g_lamexp_ipc_ptr.semaphore_read);
|
||||
MUTILS_DELETE(g_lamexp_ipc_ptr.semaphore_write);
|
||||
MUTILS_DELETE(g_lamexp_ipc_ptr.semaphore_read_mutex);
|
||||
MUTILS_DELETE(g_lamexp_ipc_ptr.semaphore_write_mutex);
|
||||
}
|
||||
|
@ -22,6 +22,9 @@
|
||||
|
||||
#include "Global.h"
|
||||
|
||||
//LameXP includes
|
||||
#include "LockedFile.h"
|
||||
|
||||
//Qt includes
|
||||
#include <QApplication>
|
||||
#include <QMap>
|
||||
@ -33,8 +36,8 @@
|
||||
#include <QTranslator>
|
||||
#include <QFileInfo>
|
||||
|
||||
//LameXP includes
|
||||
#include "LockedFile.h"
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// GLOBAL VARS
|
||||
@ -364,12 +367,12 @@ extern "C" void _lamexp_global_free_tools(void)
|
||||
if(g_lamexp_currentTranslator.instance)
|
||||
{
|
||||
QApplication::removeTranslator(g_lamexp_currentTranslator.instance);
|
||||
LAMEXP_DELETE(g_lamexp_currentTranslator.instance);
|
||||
MUTILS_DELETE(g_lamexp_currentTranslator.instance);
|
||||
}
|
||||
LAMEXP_DELETE(g_lamexp_translation.files);
|
||||
LAMEXP_DELETE(g_lamexp_translation.names);
|
||||
LAMEXP_DELETE(g_lamexp_translation.cntry);
|
||||
LAMEXP_DELETE(g_lamexp_translation.sysid);
|
||||
MUTILS_DELETE(g_lamexp_translation.files);
|
||||
MUTILS_DELETE(g_lamexp_translation.names);
|
||||
MUTILS_DELETE(g_lamexp_translation.cntry);
|
||||
MUTILS_DELETE(g_lamexp_translation.sysid);
|
||||
|
||||
//Free *all* registered tools
|
||||
if(g_lamexp_tools.registry)
|
||||
@ -378,14 +381,14 @@ extern "C" void _lamexp_global_free_tools(void)
|
||||
for(int i = 0; i < keys.count(); i++)
|
||||
{
|
||||
LockedFile *lf = g_lamexp_tools.registry->take(keys.at(i));
|
||||
LAMEXP_DELETE(lf);
|
||||
MUTILS_DELETE(lf);
|
||||
}
|
||||
g_lamexp_tools.registry->clear();
|
||||
g_lamexp_tools.versions->clear();
|
||||
g_lamexp_tools.tags->clear();
|
||||
}
|
||||
LAMEXP_DELETE(g_lamexp_tools.registry);
|
||||
LAMEXP_DELETE(g_lamexp_tools.versions);
|
||||
LAMEXP_DELETE(g_lamexp_tools.tags);
|
||||
MUTILS_DELETE(g_lamexp_tools.registry);
|
||||
MUTILS_DELETE(g_lamexp_tools.versions);
|
||||
MUTILS_DELETE(g_lamexp_tools.tags);
|
||||
|
||||
}
|
||||
|
@ -38,6 +38,9 @@
|
||||
//Natural sort
|
||||
#include "strnatcmp.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//CRT includes
|
||||
#include <time.h>
|
||||
#include <process.h>
|
||||
@ -46,14 +49,6 @@
|
||||
// GLOBAL VARS
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//%TEMP% folder
|
||||
static struct
|
||||
{
|
||||
QString *path;
|
||||
QReadWriteLock lock;
|
||||
}
|
||||
g_lamexp_temp_folder;
|
||||
|
||||
static struct
|
||||
{
|
||||
QIcon *appIcon;
|
||||
@ -65,203 +60,12 @@ g_lamexp_app_icon;
|
||||
// GLOBAL FUNCTIONS
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
* Get a random string
|
||||
*/
|
||||
QString lamexp_rand_str(const bool bLong)
|
||||
{
|
||||
const QUuid uuid = QUuid::createUuid().toString();
|
||||
|
||||
const unsigned int u1 = uuid.data1;
|
||||
const unsigned int u2 = (((unsigned int)(uuid.data2)) << 16) | ((unsigned int)(uuid.data3));
|
||||
const unsigned int u3 = (((unsigned int)(uuid.data4[0])) << 24) | (((unsigned int)(uuid.data4[1])) << 16) | (((unsigned int)(uuid.data4[2])) << 8) | ((unsigned int)(uuid.data4[3]));
|
||||
const unsigned int u4 = (((unsigned int)(uuid.data4[4])) << 24) | (((unsigned int)(uuid.data4[5])) << 16) | (((unsigned int)(uuid.data4[6])) << 8) | ((unsigned int)(uuid.data4[7]));
|
||||
|
||||
return bLong ? QString().sprintf("%08x%08x%08x%08x", u1, u2, u3, u4) : QString().sprintf("%08x%08x", (u1 ^ u2), (u3 ^ u4));
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to initialize the folder (with *write* access)
|
||||
*/
|
||||
static QString lamexp_try_init_folder(const QString &folderPath)
|
||||
{
|
||||
static const char *TEST_DATA = "Lorem ipsum dolor sit amet, consectetur, adipisci velit!";
|
||||
|
||||
bool success = false;
|
||||
|
||||
const QFileInfo folderInfo(folderPath);
|
||||
const QDir folderDir(folderInfo.absoluteFilePath());
|
||||
|
||||
//Create folder, if it does *not* exist yet
|
||||
for(int i = 0; (i < 16) && (!folderDir.exists()); i++)
|
||||
{
|
||||
folderDir.mkpath(".");
|
||||
}
|
||||
|
||||
//Make sure folder exists now *and* is writable
|
||||
if(folderDir.exists())
|
||||
{
|
||||
const QByteArray testData = QByteArray(TEST_DATA);
|
||||
for(int i = 0; (i < 32) && (!success); i++)
|
||||
{
|
||||
QFile testFile(folderDir.absoluteFilePath(QString("~%1.tmp").arg(lamexp_rand_str())));
|
||||
if(testFile.open(QIODevice::ReadWrite | QIODevice::Truncate))
|
||||
{
|
||||
if(testFile.write(testData) >= testData.size())
|
||||
{
|
||||
success = true;
|
||||
}
|
||||
testFile.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (success ? folderDir.canonicalPath() : QString());
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize LameXP temp folder
|
||||
*/
|
||||
#define INIT_TEMP_FOLDER_RAND(OUT_PTR, BASE_DIR) do \
|
||||
{ \
|
||||
for(int _i = 0; _i < 128; _i++) \
|
||||
{ \
|
||||
const QString _randDir = QString("%1/%2").arg((BASE_DIR), lamexp_rand_str()); \
|
||||
if(!QDir(_randDir).exists()) \
|
||||
{ \
|
||||
*(OUT_PTR) = lamexp_try_init_folder(_randDir); \
|
||||
if(!(OUT_PTR)->isEmpty()) break; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
while(0)
|
||||
|
||||
/*
|
||||
* Get LameXP temp folder
|
||||
*/
|
||||
const QString &lamexp_temp_folder2(void)
|
||||
{
|
||||
QReadLocker readLock(&g_lamexp_temp_folder.lock);
|
||||
|
||||
//Already initialized?
|
||||
if(g_lamexp_temp_folder.path && (!g_lamexp_temp_folder.path->isEmpty()))
|
||||
{
|
||||
if(QDir(*g_lamexp_temp_folder.path).exists())
|
||||
{
|
||||
return *g_lamexp_temp_folder.path;
|
||||
}
|
||||
}
|
||||
|
||||
//Obtain the write lock to initilaize
|
||||
readLock.unlock();
|
||||
QWriteLocker writeLock(&g_lamexp_temp_folder.lock);
|
||||
|
||||
//Still uninitilaized?
|
||||
if(g_lamexp_temp_folder.path && (!g_lamexp_temp_folder.path->isEmpty()))
|
||||
{
|
||||
if(QDir(*g_lamexp_temp_folder.path).exists())
|
||||
{
|
||||
return *g_lamexp_temp_folder.path;
|
||||
}
|
||||
}
|
||||
|
||||
//Create the string, if not done yet
|
||||
if(!g_lamexp_temp_folder.path)
|
||||
{
|
||||
g_lamexp_temp_folder.path = new QString();
|
||||
}
|
||||
|
||||
g_lamexp_temp_folder.path->clear();
|
||||
|
||||
//Try the %TMP% or %TEMP% directory first
|
||||
QString tempPath = lamexp_try_init_folder(QDir::temp().absolutePath());
|
||||
if(!tempPath.isEmpty())
|
||||
{
|
||||
INIT_TEMP_FOLDER_RAND(g_lamexp_temp_folder.path, tempPath);
|
||||
}
|
||||
|
||||
//Otherwise create TEMP folder in %LOCALAPPDATA% or %SYSTEMROOT%
|
||||
if(g_lamexp_temp_folder.path->isEmpty())
|
||||
{
|
||||
qWarning("%%TEMP%% directory not found -> trying fallback mode now!");
|
||||
static const lamexp_known_folder_t folderId[2] = { lamexp_folder_localappdata, lamexp_folder_systroot_dir };
|
||||
for(size_t id = 0; (g_lamexp_temp_folder.path->isEmpty() && (id < 2)); id++)
|
||||
{
|
||||
const QString &knownFolder = lamexp_known_folder(folderId[id]);
|
||||
if(!knownFolder.isEmpty())
|
||||
{
|
||||
tempPath = lamexp_try_init_folder(QString("%1/Temp").arg(knownFolder));
|
||||
if(!tempPath.isEmpty())
|
||||
{
|
||||
INIT_TEMP_FOLDER_RAND(g_lamexp_temp_folder.path, tempPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Failed to create TEMP folder?
|
||||
if(g_lamexp_temp_folder.path->isEmpty())
|
||||
{
|
||||
qFatal("Temporary directory could not be initialized !!!");
|
||||
}
|
||||
|
||||
return *g_lamexp_temp_folder.path;
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup QPorcess object
|
||||
*/
|
||||
void lamexp_init_process(QProcess &process, const QString &wokringDir, const bool bReplaceTempDir)
|
||||
{
|
||||
//Environment variable names
|
||||
static const char *const s_envvar_names_temp[] =
|
||||
{
|
||||
"TEMP", "TMP", "TMPDIR", "HOME", "USERPROFILE", "HOMEPATH", NULL
|
||||
};
|
||||
static const char *const s_envvar_names_remove[] =
|
||||
{
|
||||
"WGETRC", "SYSTEM_WGETRC", "HTTP_PROXY", "FTP_PROXY", "NO_PROXY", "GNUPGHOME", "LC_ALL", "LC_COLLATE", "LC_CTYPE", "LC_MESSAGES", "LC_MONETARY", "LC_NUMERIC", "LC_TIME", "LANG", NULL
|
||||
};
|
||||
|
||||
//Initialize environment
|
||||
QProcessEnvironment env = process.processEnvironment();
|
||||
if(env.isEmpty()) env = QProcessEnvironment::systemEnvironment();
|
||||
|
||||
//Clean a number of enviroment variables that might affect our tools
|
||||
for(size_t i = 0; s_envvar_names_remove[i]; i++)
|
||||
{
|
||||
env.remove(QString::fromLatin1(s_envvar_names_remove[i]));
|
||||
env.remove(QString::fromLatin1(s_envvar_names_remove[i]).toLower());
|
||||
}
|
||||
|
||||
const QString tempDir = QDir::toNativeSeparators(lamexp_temp_folder2());
|
||||
|
||||
//Replace TEMP directory in environment
|
||||
if(bReplaceTempDir)
|
||||
{
|
||||
for(size_t i = 0; s_envvar_names_temp[i]; i++)
|
||||
{
|
||||
env.insert(s_envvar_names_temp[i], tempDir);
|
||||
}
|
||||
}
|
||||
|
||||
//Setup PATH variable
|
||||
const QString path = env.value("PATH", QString()).trimmed();
|
||||
env.insert("PATH", path.isEmpty() ? tempDir : QString("%1;%2").arg(tempDir, path));
|
||||
|
||||
//Setup QPorcess object
|
||||
process.setWorkingDirectory(wokringDir);
|
||||
process.setProcessChannelMode(QProcess::MergedChannels);
|
||||
process.setReadChannel(QProcess::StandardOutput);
|
||||
process.setProcessEnvironment(env);
|
||||
}
|
||||
|
||||
/*
|
||||
* Natural Order String Comparison - the 'lessThan' helper function
|
||||
*/
|
||||
static bool lamexp_natural_string_sort_helper(const QString &str1, const QString &str2)
|
||||
{
|
||||
return (strnatcmp(QWCHAR(str1), QWCHAR(str2)) < 0);
|
||||
return (strnatcmp(MUTILS_WCHR(str1), MUTILS_WCHR(str2)) < 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -269,7 +73,7 @@ static bool lamexp_natural_string_sort_helper(const QString &str1, const QString
|
||||
*/
|
||||
static bool lamexp_natural_string_sort_helper_fold_case(const QString &str1, const QString &str2)
|
||||
{
|
||||
return (strnatcasecmp(QWCHAR(str1), QWCHAR(str2)) < 0);
|
||||
return (strnatcasecmp(MUTILS_WCHR(str1), MUTILS_WCHR(str2)) < 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -348,59 +152,6 @@ QStringList lamexp_available_codepages(bool noAliases)
|
||||
return codecList;
|
||||
}
|
||||
|
||||
/*
|
||||
* Robert Jenkins' 96 bit Mix Function
|
||||
* Source: http://www.concentric.net/~Ttwang/tech/inthash.htm
|
||||
*/
|
||||
static unsigned int lamexp_mix(const unsigned int x, const unsigned int y, const unsigned int z)
|
||||
{
|
||||
unsigned int a = x;
|
||||
unsigned int b = y;
|
||||
unsigned int c = z;
|
||||
|
||||
a=a-b; a=a-c; a=a^(c >> 13);
|
||||
b=b-c; b=b-a; b=b^(a << 8);
|
||||
c=c-a; c=c-b; c=c^(b >> 13);
|
||||
a=a-b; a=a-c; a=a^(c >> 12);
|
||||
b=b-c; b=b-a; b=b^(a << 16);
|
||||
c=c-a; c=c-b; c=c^(b >> 5);
|
||||
a=a-b; a=a-c; a=a^(c >> 3);
|
||||
b=b-c; b=b-a; b=b^(a << 10);
|
||||
c=c-a; c=c-b; c=c^(b >> 15);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
/*
|
||||
* Seeds the random number generator
|
||||
* Note: Altough rand_s() doesn't need a seed, this must be called pripr to lamexp_rand(), just to to be sure!
|
||||
*/
|
||||
void lamexp_seed_rand(void)
|
||||
{
|
||||
qsrand(lamexp_mix(clock(), time(NULL), _getpid()));
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns a randum number
|
||||
* Note: This function uses rand_s() if available, but falls back to qrand() otherwise
|
||||
*/
|
||||
unsigned int lamexp_rand(void)
|
||||
{
|
||||
quint32 rnd = 0;
|
||||
|
||||
if(rand_s(&rnd) == 0)
|
||||
{
|
||||
return rnd;
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < sizeof(unsigned int); i++)
|
||||
{
|
||||
rnd = (rnd << 8) ^ qrand();
|
||||
}
|
||||
|
||||
return rnd;
|
||||
}
|
||||
|
||||
/*
|
||||
* Make a window blink (to draw user's attention)
|
||||
*/
|
||||
@ -452,38 +203,6 @@ void lamexp_blink_window(QWidget *poWindow, unsigned int count, unsigned int del
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clean folder
|
||||
*/
|
||||
bool lamexp_clean_folder(const QString &folderPath)
|
||||
{
|
||||
QDir tempFolder(folderPath);
|
||||
if(tempFolder.exists())
|
||||
{
|
||||
QFileInfoList entryList = tempFolder.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::Hidden);
|
||||
|
||||
for(int i = 0; i < entryList.count(); i++)
|
||||
{
|
||||
if(entryList.at(i).isDir())
|
||||
{
|
||||
lamexp_clean_folder(entryList.at(i).canonicalFilePath());
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int j = 0; j < 3; j++)
|
||||
{
|
||||
if(lamexp_remove_file(entryList.at(i).canonicalFilePath()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return tempFolder.rmdir(".");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Computus according to H. Lichtenberg
|
||||
*/
|
||||
@ -623,7 +342,6 @@ bool lamexp_broadcast(int eventType, bool onlyToVisible)
|
||||
|
||||
extern "C" void _lamexp_global_init_utils(void)
|
||||
{
|
||||
LAMEXP_ZERO_MEMORY(g_lamexp_temp_folder);
|
||||
LAMEXP_ZERO_MEMORY(g_lamexp_app_icon);
|
||||
}
|
||||
|
||||
@ -633,28 +351,6 @@ extern "C" void _lamexp_global_init_utils(void)
|
||||
|
||||
extern "C" void _lamexp_global_free_utils(void)
|
||||
{
|
||||
//Delete temporary files
|
||||
const QString &tempFolder = lamexp_temp_folder2();
|
||||
if(!tempFolder.isEmpty())
|
||||
{
|
||||
bool success = false;
|
||||
for(int i = 0; i < 100; i++)
|
||||
{
|
||||
if(lamexp_clean_folder(tempFolder))
|
||||
{
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
lamexp_sleep(100);
|
||||
}
|
||||
if(!success)
|
||||
{
|
||||
lamexp_system_message(L"Sorry, LameXP was unable to clean up all temporary files. Some residual files in your TEMP directory may require manual deletion!", lamexp_beep_warning);
|
||||
lamexp_exec_shell(NULL, tempFolder, QString(), QString(), true);
|
||||
}
|
||||
}
|
||||
|
||||
//Free memory
|
||||
LAMEXP_DELETE(g_lamexp_temp_folder.path);
|
||||
LAMEXP_DELETE(g_lamexp_app_icon.appIcon);
|
||||
MUTILS_DELETE(g_lamexp_app_icon.appIcon);
|
||||
}
|
||||
|
@ -27,6 +27,9 @@
|
||||
#include "Resource.h"
|
||||
#include "Config.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Version.h>
|
||||
|
||||
//Qt includes
|
||||
#include <QApplication>
|
||||
#include <QDate>
|
||||
@ -64,12 +67,6 @@ static struct
|
||||
}
|
||||
g_lamexp_portable;
|
||||
|
||||
//Build date
|
||||
static QDate g_lamexp_version_date;
|
||||
static const char *g_lamexp_months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||
static const char *g_lamexp_version_raw_date = __DATE__;
|
||||
static const char *g_lamexp_version_raw_time = __TIME__;
|
||||
|
||||
//Official web-site URL
|
||||
static const char *g_lamexp_website_url = "http://lamexp.sourceforge.net/";
|
||||
static const char *g_lamexp_mulders_url = "http://muldersoft.com/";
|
||||
@ -82,91 +79,6 @@ static const unsigned int g_lamexp_toolver_fhgaacenc = VER_LAMEXP_TOOL_FHGAACENC
|
||||
static const unsigned int g_lamexp_toolver_qaacenc = VER_LAMEXP_TOOL_QAAC;
|
||||
static const unsigned int g_lamexp_toolver_coreaudio = VER_LAMEXP_TOOL_COREAUDIO;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// COMPILER INFO
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
* Disclaimer: Parts of the following code were borrowed from MPC-HC project: http://mpc-hc.sf.net/
|
||||
*/
|
||||
|
||||
//Compiler detection
|
||||
#if defined(__INTEL_COMPILER)
|
||||
#if (__INTEL_COMPILER >= 1300)
|
||||
static const char *g_lamexp_version_compiler = "ICL 13." LAMEXP_MAKE_STR(__INTEL_COMPILER_BUILD_DATE);
|
||||
#elif (__INTEL_COMPILER >= 1200)
|
||||
static const char *g_lamexp_version_compiler = "ICL 12." LAMEXP_MAKE_STR(__INTEL_COMPILER_BUILD_DATE);
|
||||
#elif (__INTEL_COMPILER >= 1100)
|
||||
static const char *g_lamexp_version_compiler = "ICL 11.x";
|
||||
#elif (__INTEL_COMPILER >= 1000)
|
||||
static const char *g_lamexp_version_compiler = "ICL 10.x";
|
||||
#else
|
||||
#error Compiler is not supported!
|
||||
#endif
|
||||
#elif defined(_MSC_VER)
|
||||
#if (_MSC_VER == 1800)
|
||||
#if (_MSC_FULL_VER == 180021005)
|
||||
static const char *g_lamexp_version_compiler = "MSVC 2013";
|
||||
#elif (_MSC_FULL_VER == 180030501)
|
||||
static const char *g_lamexp_version_compiler = "MSVC 2013.2";
|
||||
#elif (_MSC_FULL_VER == 180030723)
|
||||
static const char *g_lamexp_version_compiler = "MSVC 2013.3";
|
||||
#elif (_MSC_FULL_VER == 180031101)
|
||||
static const char *g_lamexp_version_compiler = "MSVC 2013.4";
|
||||
#else
|
||||
#error Compiler version is not supported yet!
|
||||
#endif
|
||||
#elif (_MSC_VER == 1700)
|
||||
#if (_MSC_FULL_VER == 170050727)
|
||||
static const char *g_lamexp_version_compiler = "MSVC 2012";
|
||||
#elif (_MSC_FULL_VER == 170051106)
|
||||
static const char *g_lamexp_version_compiler = "MSVC 2012.1";
|
||||
#elif (_MSC_FULL_VER == 170060315)
|
||||
static const char *g_lamexp_version_compiler = "MSVC 2012.2";
|
||||
#elif (_MSC_FULL_VER == 170060610)
|
||||
static const char *g_lamexp_version_compiler = "MSVC 2012.3";
|
||||
#elif (_MSC_FULL_VER == 170061030)
|
||||
static const char *g_lamexp_version_compiler = "MSVC 2012.4";
|
||||
#else
|
||||
#error Compiler version is not supported yet!
|
||||
#endif
|
||||
#elif (_MSC_VER == 1600)
|
||||
#if (_MSC_FULL_VER >= 160040219)
|
||||
static const char *g_lamexp_version_compiler = "MSVC 2010-SP1";
|
||||
#else
|
||||
static const char *g_lamexp_version_compiler = "MSVC 2010";
|
||||
#endif
|
||||
#elif (_MSC_VER == 1500)
|
||||
#if (_MSC_FULL_VER >= 150030729)
|
||||
static const char *g_lamexp_version_compiler = "MSVC 2008-SP1";
|
||||
#else
|
||||
static const char *g_lamexp_version_compiler = "MSVC 2008";
|
||||
#endif
|
||||
#else
|
||||
#error Compiler is not supported!
|
||||
#endif
|
||||
|
||||
// Note: /arch:SSE and /arch:SSE2 are only available for the x86 platform
|
||||
#if !defined(_M_X64) && defined(_M_IX86_FP)
|
||||
#if (_M_IX86_FP == 1)
|
||||
LAMEXP_COMPILER_WARNING("SSE instruction set is enabled!")
|
||||
#elif (_M_IX86_FP == 2)
|
||||
LAMEXP_COMPILER_WARNING("SSE2 (or higher) instruction set is enabled!")
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#error Compiler is not supported!
|
||||
#endif
|
||||
|
||||
//Architecture detection
|
||||
#if defined(_M_X64)
|
||||
static const char *g_lamexp_version_arch = "x64";
|
||||
#elif defined(_M_IX86)
|
||||
static const char *g_lamexp_version_arch = "x86";
|
||||
#else
|
||||
#error Architecture is not supported!
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// GLOBAL FUNCTIONS
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -178,10 +90,7 @@ unsigned int lamexp_version_major(void) { return g_lamexp_version.ver_major;
|
||||
unsigned int lamexp_version_minor(void) { return g_lamexp_version.ver_minor; }
|
||||
unsigned int lamexp_version_build(void) { return g_lamexp_version.ver_build; }
|
||||
unsigned int lamexp_version_confg(void) { return g_lamexp_version.ver_confg; }
|
||||
const char *lamexp_version_release(void) { return g_lamexp_version.ver_release_name; }
|
||||
const char *lamexp_version_time(void) { return g_lamexp_version_raw_time; }
|
||||
const char *lamexp_version_compiler(void) { return g_lamexp_version_compiler; }
|
||||
const char *lamexp_version_arch(void) { return g_lamexp_version_arch; }
|
||||
const char* lamexp_version_release(void) { return g_lamexp_version.ver_release_name; }
|
||||
unsigned int lamexp_toolver_neroaac(void) { return g_lamexp_toolver_neroaac; }
|
||||
unsigned int lamexp_toolver_fhgaacenc(void) { return g_lamexp_toolver_fhgaacenc; }
|
||||
unsigned int lamexp_toolver_qaacenc(void) { return g_lamexp_toolver_qaacenc; }
|
||||
@ -218,70 +127,7 @@ bool lamexp_version_demo(void)
|
||||
*/
|
||||
QDate lamexp_version_expires(void)
|
||||
{
|
||||
return lamexp_version_date().addDays(LAMEXP_DEBUG ? 7 : 30);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert month string to integer value
|
||||
*/
|
||||
static int lamexp_month2int(const char *str)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
for(int j = 0; j < 12; j++)
|
||||
{
|
||||
if(!_strcmpi(str, g_lamexp_months[j]))
|
||||
{
|
||||
ret = j+1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get build date date
|
||||
*/
|
||||
const QDate &lamexp_version_date(void)
|
||||
{
|
||||
//Format of __DATE__ is defined as: "MMM DD YYYY"
|
||||
if(!g_lamexp_version_date.isValid())
|
||||
{
|
||||
int date[3] = {0, 0, 0};
|
||||
char temp_m[4], temp_d[3], temp_y[5];
|
||||
|
||||
temp_m[0] = g_lamexp_version_raw_date[0x0];
|
||||
temp_m[1] = g_lamexp_version_raw_date[0x1];
|
||||
temp_m[2] = g_lamexp_version_raw_date[0x2];
|
||||
temp_m[3] = 0x00;
|
||||
|
||||
temp_d[0] = g_lamexp_version_raw_date[0x4];
|
||||
temp_d[1] = g_lamexp_version_raw_date[0x5];
|
||||
temp_d[2] = 0x00;
|
||||
|
||||
temp_y[0] = g_lamexp_version_raw_date[0x7];
|
||||
temp_y[1] = g_lamexp_version_raw_date[0x8];
|
||||
temp_y[2] = g_lamexp_version_raw_date[0x9];
|
||||
temp_y[3] = g_lamexp_version_raw_date[0xA];
|
||||
temp_y[4] = 0x00;
|
||||
|
||||
date[0] = atoi(temp_y);
|
||||
date[1] = lamexp_month2int(temp_m);
|
||||
date[2] = atoi(temp_d);
|
||||
|
||||
if((date[0] > 0) && (date[1] > 0) && (date[2] > 0))
|
||||
{
|
||||
|
||||
g_lamexp_version_date = QDate(date[0], date[1], date[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
THROW("Internal error: Date format could not be recognized!");
|
||||
}
|
||||
}
|
||||
|
||||
return g_lamexp_version_date;
|
||||
return MUtils::Version::build_date().addDays(MUTILS_DEBUG ? 7 : 30);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -67,6 +67,9 @@
|
||||
#include "Resource.h"
|
||||
#include "Config.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//CRT includes
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
@ -712,7 +715,7 @@ void lamexp_init_error_handlers(void)
|
||||
*/
|
||||
void lamexp_init_console(const QStringList &argv)
|
||||
{
|
||||
bool enableConsole = (LAMEXP_DEBUG) || ((VER_LAMEXP_CONSOLE_ENABLED) && lamexp_version_demo());
|
||||
bool enableConsole = (MUTILS_DEBUG) || ((VER_LAMEXP_CONSOLE_ENABLED) && lamexp_version_demo());
|
||||
|
||||
if(_environ)
|
||||
{
|
||||
@ -733,7 +736,7 @@ void lamexp_init_console(const QStringList &argv)
|
||||
}
|
||||
}
|
||||
|
||||
if(!LAMEXP_DEBUG)
|
||||
if(!MUTILS_DEBUG)
|
||||
{
|
||||
for(int i = 0; i < argv.count(); i++)
|
||||
{
|
||||
@ -955,7 +958,7 @@ static HANDLE lamexp_debug_thread_init()
|
||||
*/
|
||||
static bool lamexp_event_filter(void *message, long *result)
|
||||
{
|
||||
if((!(LAMEXP_DEBUG)) && lamexp_check_for_debugger())
|
||||
if((!(MUTILS_DEBUG)) && lamexp_check_for_debugger())
|
||||
{
|
||||
lamexp_fatal_exit("Not a debug build. Please unload debugger and try again!");
|
||||
}
|
||||
@ -1135,8 +1138,8 @@ bool lamexp_init_qt(int argc, char* argv[])
|
||||
if(!runningOnSupportedOSVersion)
|
||||
{
|
||||
const QString message = QString().sprintf("Running on an unknown WindowsNT-based system (v%u.%u).", osVersionNo.versionMajor, osVersionNo.versionMinor);
|
||||
qWarning("%s\n", QUTF8(message));
|
||||
MessageBoxW(NULL, QWCHAR(message), L"LameXP", MB_OK | MB_TOPMOST | MB_ICONWARNING);
|
||||
qWarning("%s\n", MUTILS_UTF8(message));
|
||||
MessageBoxW(NULL, MUTILS_WCHR(message), L"LameXP", MB_OK | MB_TOPMOST | MB_ICONWARNING);
|
||||
}
|
||||
|
||||
//Check for compat mode
|
||||
@ -1164,7 +1167,7 @@ bool lamexp_init_qt(int argc, char* argv[])
|
||||
|
||||
//Load plugins from application directory
|
||||
QCoreApplication::setLibraryPaths(QStringList() << QApplication::applicationDirPath());
|
||||
qDebug("Library Path:\n%s\n", QUTF8(QApplication::libraryPaths().first()));
|
||||
qDebug("Library Path:\n%s\n", MUTILS_UTF8(QApplication::libraryPaths().first()));
|
||||
|
||||
//Set application properties
|
||||
application->setApplicationName("LameXP - Audio Encoder Front-End");
|
||||
@ -1257,7 +1260,7 @@ const QStringList &lamexp_arguments(void)
|
||||
{
|
||||
for(int i = 0; i < nArgs; i++)
|
||||
{
|
||||
(*g_lamexp_argv.list) << WCHAR2QSTR(szArglist[i]);
|
||||
(*g_lamexp_argv.list) << MUTILS_QSTR(szArglist[i]);
|
||||
}
|
||||
LocalFree(szArglist);
|
||||
}
|
||||
@ -1372,7 +1375,7 @@ const QString &lamexp_known_folder(lamexp_known_folder_t folder_id)
|
||||
folderPath = folderTemp.canonicalPath();
|
||||
}
|
||||
}
|
||||
LAMEXP_DELETE_ARRAY(path);
|
||||
MUTILS_DELETE_ARRAY(path);
|
||||
}
|
||||
|
||||
//Update cache
|
||||
@ -1380,42 +1383,6 @@ const QString &lamexp_known_folder(lamexp_known_folder_t folder_id)
|
||||
return (*g_lamexp_known_folder.knownFolders)[folderId];
|
||||
}
|
||||
|
||||
/*
|
||||
* Safely remove a file
|
||||
*/
|
||||
bool lamexp_remove_file(const QString &filename)
|
||||
{
|
||||
if(!QFileInfo(filename).exists() || !QFileInfo(filename).isFile())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!QFile::remove(filename))
|
||||
{
|
||||
static const DWORD attrMask = FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM;
|
||||
const DWORD attributes = GetFileAttributesW(QWCHAR(filename));
|
||||
if(attributes & attrMask)
|
||||
{
|
||||
SetFileAttributesW(QWCHAR(filename), FILE_ATTRIBUTE_NORMAL);
|
||||
}
|
||||
if(!QFile::remove(filename))
|
||||
{
|
||||
qWarning("Could not delete \"%s\"", filename.toLatin1().constData());
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if visual themes are enabled (WinXP and later)
|
||||
*/
|
||||
@ -1521,7 +1488,7 @@ bool lamexp_shutdown_computer(const QString &message, const unsigned long timeou
|
||||
}
|
||||
}
|
||||
const DWORD reason = SHTDN_REASON_MAJOR_APPLICATION | SHTDN_REASON_FLAG_PLANNED;
|
||||
return InitiateSystemShutdownEx(NULL, const_cast<wchar_t*>(QWCHAR(message)), timeout, forceShutdown ? TRUE : FALSE, FALSE, reason);
|
||||
return InitiateSystemShutdownEx(NULL, const_cast<wchar_t*>(MUTILS_WCHR(message)), timeout, forceShutdown ? TRUE : FALSE, FALSE, reason);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1529,86 +1496,6 @@ bool lamexp_shutdown_computer(const QString &message, const unsigned long timeou
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Determines the current date, resistant against certain manipulations
|
||||
*/
|
||||
QDate lamexp_current_date_safe(void)
|
||||
{
|
||||
const DWORD MAX_PROC = 1024;
|
||||
DWORD *processes = new DWORD[MAX_PROC];
|
||||
DWORD bytesReturned = 0;
|
||||
|
||||
if(!EnumProcesses(processes, sizeof(DWORD) * MAX_PROC, &bytesReturned))
|
||||
{
|
||||
LAMEXP_DELETE_ARRAY(processes);
|
||||
return QDate::currentDate();
|
||||
}
|
||||
|
||||
const DWORD procCount = bytesReturned / sizeof(DWORD);
|
||||
ULARGE_INTEGER lastStartTime;
|
||||
memset(&lastStartTime, 0, sizeof(ULARGE_INTEGER));
|
||||
|
||||
for(DWORD i = 0; i < procCount; i++)
|
||||
{
|
||||
HANDLE hProc = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, processes[i]);
|
||||
if(hProc)
|
||||
{
|
||||
FILETIME processTime[4];
|
||||
if(GetProcessTimes(hProc, &processTime[0], &processTime[1], &processTime[2], &processTime[3]))
|
||||
{
|
||||
ULARGE_INTEGER timeCreation;
|
||||
timeCreation.LowPart = processTime[0].dwLowDateTime;
|
||||
timeCreation.HighPart = processTime[0].dwHighDateTime;
|
||||
if(timeCreation.QuadPart > lastStartTime.QuadPart)
|
||||
{
|
||||
lastStartTime.QuadPart = timeCreation.QuadPart;
|
||||
}
|
||||
}
|
||||
CloseHandle(hProc);
|
||||
}
|
||||
}
|
||||
|
||||
LAMEXP_DELETE_ARRAY(processes);
|
||||
|
||||
FILETIME lastStartTime_fileTime;
|
||||
lastStartTime_fileTime.dwHighDateTime = lastStartTime.HighPart;
|
||||
lastStartTime_fileTime.dwLowDateTime = lastStartTime.LowPart;
|
||||
|
||||
FILETIME lastStartTime_localTime;
|
||||
if(!FileTimeToLocalFileTime(&lastStartTime_fileTime, &lastStartTime_localTime))
|
||||
{
|
||||
memcpy(&lastStartTime_localTime, &lastStartTime_fileTime, sizeof(FILETIME));
|
||||
}
|
||||
|
||||
SYSTEMTIME lastStartTime_system;
|
||||
if(!FileTimeToSystemTime(&lastStartTime_localTime, &lastStartTime_system))
|
||||
{
|
||||
memset(&lastStartTime_system, 0, sizeof(SYSTEMTIME));
|
||||
lastStartTime_system.wYear = 1970; lastStartTime_system.wMonth = lastStartTime_system.wDay = 1;
|
||||
}
|
||||
|
||||
const QDate currentDate = QDate::currentDate();
|
||||
const QDate processDate = QDate(lastStartTime_system.wYear, lastStartTime_system.wMonth, lastStartTime_system.wDay);
|
||||
return (currentDate >= processDate) ? currentDate : processDate;
|
||||
}
|
||||
|
||||
/*
|
||||
* Show system message box
|
||||
*/
|
||||
int lamexp_system_message(const wchar_t *text, int beepType)
|
||||
{
|
||||
UINT flags = MB_OK | MB_TOPMOST;
|
||||
|
||||
switch(beepType)
|
||||
{
|
||||
case lamexp_beep_info: flags = flags | MB_ICONASTERISK;
|
||||
case lamexp_beep_warning: flags = flags | MB_ICONEXCLAMATION;
|
||||
case lamexp_beep_error: flags = flags | MB_ICONHAND;
|
||||
}
|
||||
|
||||
return MessageBoxW(NULL, text, L"LameXP", flags);
|
||||
}
|
||||
|
||||
/*
|
||||
* Block window "move" message
|
||||
*/
|
||||
@ -1680,7 +1567,7 @@ bool lamexp_play_sound(const QString &name, const bool bAsync)
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning("Sound effect \"%s\" not found!", QUTF8(name));
|
||||
qWarning("Sound effect \"%s\" not found!", MUTILS_UTF8(name));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1698,7 +1585,7 @@ bool lamexp_play_sound(const QString &name, const bool bAsync)
|
||||
*/
|
||||
bool lamexp_play_sound_alias(const QString &alias, const bool bAsync)
|
||||
{
|
||||
return PlaySound(QWCHAR(alias), GetModuleHandle(NULL), (SND_ALIAS | (bAsync ? SND_ASYNC : SND_SYNC))) != FALSE;
|
||||
return PlaySound(MUTILS_WCHR(alias), GetModuleHandle(NULL), (SND_ALIAS | (bAsync ? SND_ASYNC : SND_SYNC))) != FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1720,7 +1607,7 @@ bool lamexp_play_sound_file(const QString &library, const unsigned short uiSound
|
||||
|
||||
if(libraryFile.exists() && libraryFile.isFile())
|
||||
{
|
||||
if(HMODULE module = LoadLibraryW(QWCHAR(QDir::toNativeSeparators(libraryFile.canonicalFilePath()))))
|
||||
if(HMODULE module = LoadLibraryW(MUTILS_WCHR(QDir::toNativeSeparators(libraryFile.canonicalFilePath()))))
|
||||
{
|
||||
result = (PlaySound(MAKEINTRESOURCE(uiSoundIdx), module, (SND_RESOURCE | (bAsync ? SND_ASYNC : SND_SYNC))) != FALSE);
|
||||
FreeLibrary(module);
|
||||
@ -1728,7 +1615,7 @@ bool lamexp_play_sound_file(const QString &library, const unsigned short uiSound
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning("PlaySound: File \"%s\" could not be found!", QUTF8(libraryFile.absoluteFilePath()));
|
||||
qWarning("PlaySound: File \"%s\" could not be found!", MUTILS_UTF8(libraryFile.absoluteFilePath()));
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -1747,7 +1634,7 @@ bool lamexp_exec_shell(const QWidget *win, const QString &url, const bool explor
|
||||
*/
|
||||
bool lamexp_exec_shell(const QWidget *win, const QString &url, const QString ¶meters, const QString &directory, const bool explore)
|
||||
{
|
||||
return ((int) ShellExecuteW(((win) ? win->winId() : NULL), (explore ? L"explore" : L"open"), QWCHAR(url), ((!parameters.isEmpty()) ? QWCHAR(parameters) : NULL), ((!directory.isEmpty()) ? QWCHAR(directory) : NULL), SW_SHOW)) > 32;
|
||||
return ((int) ShellExecuteW(((win) ? win->winId() : NULL), (explore ? L"explore" : L"open"), MUTILS_WCHR(url), ((!parameters.isEmpty()) ? MUTILS_WCHR(parameters) : NULL), ((!directory.isEmpty()) ? MUTILS_WCHR(directory) : NULL), SW_SHOW)) > 32;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1786,7 +1673,7 @@ bool lamexp_append_sysmenu(const QWidget *win, const unsigned int identifier, co
|
||||
if(HMENU hMenu = GetSystemMenu(win->winId(), FALSE))
|
||||
{
|
||||
ok = (AppendMenuW(hMenu, MF_SEPARATOR, 0, 0) == TRUE);
|
||||
ok = (AppendMenuW(hMenu, MF_STRING, identifier, QWCHAR(text)) == TRUE);
|
||||
ok = (AppendMenuW(hMenu, MF_STRING, identifier, MUTILS_WCHR(text)) == TRUE);
|
||||
}
|
||||
|
||||
return ok;
|
||||
@ -1809,7 +1696,7 @@ bool lamexp_update_sysmenu(const QWidget *win, const unsigned int identifier, co
|
||||
|
||||
if(HMENU hMenu = ::GetSystemMenu(win->winId(), FALSE))
|
||||
{
|
||||
ok = (ModifyMenu(hMenu, identifier, MF_STRING | MF_BYCOMMAND, identifier, QWCHAR(text)) == TRUE);
|
||||
ok = (ModifyMenu(hMenu, identifier, MF_STRING | MF_BYCOMMAND, identifier, MUTILS_WCHR(text)) == TRUE);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@ -2025,8 +1912,8 @@ bool lamexp_open_media_file(const QString &mediaFilePath)
|
||||
QString mplayerPath;
|
||||
HKEY registryKeyHandle = NULL;
|
||||
|
||||
const QString currentKey = WCHAR2QSTR(registryPrefix[j]).append(WCHAR2QSTR(registryKeys[i]));
|
||||
if(RegOpenKeyExW(HKEY_LOCAL_MACHINE, QWCHAR(currentKey), 0, KEY_READ, ®istryKeyHandle) == ERROR_SUCCESS)
|
||||
const QString currentKey = MUTILS_QSTR(registryPrefix[j]).append(MUTILS_QSTR(registryKeys[i]));
|
||||
if(RegOpenKeyExW(HKEY_LOCAL_MACHINE, MUTILS_WCHR(currentKey), 0, KEY_READ, ®istryKeyHandle) == ERROR_SUCCESS)
|
||||
{
|
||||
for(size_t k = 0; k < 2; k++)
|
||||
{
|
||||
@ -2037,7 +1924,7 @@ bool lamexp_open_media_file(const QString &mediaFilePath)
|
||||
{
|
||||
if((DataType == REG_SZ) || (DataType == REG_EXPAND_SZ) || (DataType == REG_LINK))
|
||||
{
|
||||
mplayerPath = WCHAR2QSTR(Buffer);
|
||||
mplayerPath = MUTILS_QSTR(Buffer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2052,10 +1939,10 @@ bool lamexp_open_media_file(const QString &mediaFilePath)
|
||||
{
|
||||
for(size_t k = 0; k < 4; k++)
|
||||
{
|
||||
if(mplayerDir.exists(WCHAR2QSTR(appNames[k])))
|
||||
if(mplayerDir.exists(MUTILS_QSTR(appNames[k])))
|
||||
{
|
||||
qDebug("Player found at:\n%s\n", QUTF8(mplayerDir.absoluteFilePath(WCHAR2QSTR(appNames[k]))));
|
||||
QProcess::startDetached(mplayerDir.absoluteFilePath(WCHAR2QSTR(appNames[k])), QStringList() << QDir::toNativeSeparators(mediaFilePath));
|
||||
qDebug("Player found at:\n%s\n", MUTILS_UTF8(mplayerDir.absoluteFilePath(MUTILS_QSTR(appNames[k]))));
|
||||
QProcess::startDetached(mplayerDir.absoluteFilePath(MUTILS_QSTR(appNames[k])), QStringList() << QDir::toNativeSeparators(mediaFilePath));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -2095,7 +1982,7 @@ static void lamexp_init_dwmapi(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
LAMEXP_DELETE(g_lamexp_dwmapi.dwmapi_dll);
|
||||
MUTILS_DELETE(g_lamexp_dwmapi.dwmapi_dll);
|
||||
qWarning("Failed to load DWMAPI.DLL on a DWM-enabled system!");
|
||||
}
|
||||
}
|
||||
@ -2358,7 +2245,7 @@ bool lamexp_is_executable(const QString &path)
|
||||
{
|
||||
bool bIsExecutable = false;
|
||||
DWORD binaryType;
|
||||
if(GetBinaryType(QWCHAR(QDir::toNativeSeparators(path)), &binaryType))
|
||||
if(GetBinaryType(MUTILS_WCHR(QDir::toNativeSeparators(path)), &binaryType))
|
||||
{
|
||||
bIsExecutable = (binaryType == SCS_32BIT_BINARY || binaryType == SCS_64BIT_BINARY);
|
||||
}
|
||||
@ -2410,7 +2297,7 @@ void lamexp_fatal_exit(const char* const errorMessage)
|
||||
/*
|
||||
* Initialize debug thread
|
||||
*/
|
||||
static const HANDLE g_debug_thread1 = LAMEXP_DEBUG ? NULL : lamexp_debug_thread_init();
|
||||
static const HANDLE g_debug_thread1 = MUTILS_DEBUG ? NULL : lamexp_debug_thread_init();
|
||||
|
||||
/*
|
||||
* Get number private bytes [debug only]
|
||||
@ -2451,7 +2338,7 @@ void lamexp_dbg_dbg_output_string(const char* format, ...)
|
||||
|
||||
extern "C" void _lamexp_global_init_win32(void)
|
||||
{
|
||||
if((!LAMEXP_DEBUG) && lamexp_check_for_debugger())
|
||||
if((!MUTILS_DEBUG) && lamexp_check_for_debugger())
|
||||
{
|
||||
lamexp_fatal_exit("Not a debug build. Please unload debugger and try again!");
|
||||
}
|
||||
@ -2473,17 +2360,17 @@ extern "C" void _lamexp_global_init_win32(void)
|
||||
extern "C" void _lamexp_global_free_win32(void)
|
||||
{
|
||||
//Clear folder cache
|
||||
LAMEXP_DELETE(g_lamexp_known_folder.knownFolders);
|
||||
MUTILS_DELETE(g_lamexp_known_folder.knownFolders);
|
||||
|
||||
//Destroy Qt application object
|
||||
QApplication *application = dynamic_cast<QApplication*>(QApplication::instance());
|
||||
LAMEXP_DELETE(application);
|
||||
MUTILS_DELETE(application);
|
||||
|
||||
//Release DWM API
|
||||
g_lamexp_dwmapi.dwmIsCompositionEnabled = NULL;
|
||||
g_lamexp_dwmapi.dwmExtendFrameIntoClientArea = NULL;
|
||||
g_lamexp_dwmapi.dwmEnableBlurBehindWindow = NULL;
|
||||
LAMEXP_DELETE(g_lamexp_dwmapi.dwmapi_dll);
|
||||
MUTILS_DELETE(g_lamexp_dwmapi.dwmapi_dll);
|
||||
|
||||
//Free STDOUT and STDERR buffers
|
||||
if(g_lamexp_console_attached)
|
||||
@ -2491,12 +2378,12 @@ extern "C" void _lamexp_global_free_win32(void)
|
||||
if(std::filebuf *tmp = dynamic_cast<std::filebuf*>(std::cout.rdbuf()))
|
||||
{
|
||||
std::cout.rdbuf(NULL);
|
||||
LAMEXP_DELETE(tmp);
|
||||
MUTILS_DELETE(tmp);
|
||||
}
|
||||
if(std::filebuf *tmp = dynamic_cast<std::filebuf*>(std::cerr.rdbuf()))
|
||||
{
|
||||
std::cerr.rdbuf(NULL);
|
||||
LAMEXP_DELETE(tmp);
|
||||
MUTILS_DELETE(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2508,8 +2395,8 @@ extern "C" void _lamexp_global_free_win32(void)
|
||||
}
|
||||
|
||||
//Clear sound cache
|
||||
LAMEXP_DELETE(g_lamexp_sounds.sound_db);
|
||||
MUTILS_DELETE(g_lamexp_sounds.sound_db);
|
||||
|
||||
//Free CLI Arguments
|
||||
LAMEXP_DELETE(g_lamexp_argv.list);
|
||||
MUTILS_DELETE(g_lamexp_argv.list);
|
||||
}
|
||||
|
@ -119,12 +119,12 @@ LockedFile::LockedFile(QResource *const resource, const QString &outPath, const
|
||||
if(outFile.write(reinterpret_cast<const char*>(resource->data()), resource->size()) != resource->size())
|
||||
{
|
||||
QFile::remove(QFileInfo(outFile).canonicalFilePath());
|
||||
THROW_FMT("File '%s' could not be written!", QUTF8(QFileInfo(outFile).fileName()));
|
||||
THROW_FMT("File '%s' could not be written!", MUTILS_UTF8(QFileInfo(outFile).fileName()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
THROW_FMT("File '%s' could not be created!", QUTF8(QFileInfo(outFile).fileName()));
|
||||
THROW_FMT("File '%s' could not be created!", MUTILS_UTF8(QFileInfo(outFile).fileName()));
|
||||
}
|
||||
|
||||
//Close file after it has been written
|
||||
@ -133,7 +133,7 @@ LockedFile::LockedFile(QResource *const resource, const QString &outPath, const
|
||||
//Now lock the file!
|
||||
for(int i = 0; i < 64; i++)
|
||||
{
|
||||
fileHandle = CreateFileW(QWCHAR(QDir::toNativeSeparators(m_filePath)), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL);
|
||||
fileHandle = CreateFileW(MUTILS_WCHR(QDir::toNativeSeparators(m_filePath)), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL);
|
||||
if((fileHandle != NULL) && (fileHandle != INVALID_HANDLE_VALUE)) break;
|
||||
if(!i) qWarning("Failed to lock file on first attemp, retrying...");
|
||||
Sleep(100);
|
||||
@ -143,7 +143,7 @@ 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!", QUTF8(QFileInfo(m_filePath).fileName()));
|
||||
THROW_FMT("File '%s' could not be locked!", MUTILS_UTF8(QFileInfo(m_filePath).fileName()));
|
||||
}
|
||||
|
||||
//Get file descriptor
|
||||
@ -175,7 +175,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!", QUTF8(QFileInfo(m_filePath).fileName()));
|
||||
THROW_FMT("File '%s' could not be read!", MUTILS_UTF8(QFileInfo(m_filePath).fileName()));
|
||||
}
|
||||
|
||||
//Verify file contents
|
||||
@ -188,7 +188,7 @@ LockedFile::LockedFile(QResource *const resource, const QString &outPath, const
|
||||
qWarning("\nFile checksum error:\n A = %s\n B = %s\n", expectedHash.constData(), hash.constData());
|
||||
LAMEXP_CLOSE(fileHandle);
|
||||
QFile::remove(m_filePath);
|
||||
THROW_FMT("File '%s' is corruputed, take care!", QUTF8(QFileInfo(m_filePath).fileName()));
|
||||
THROW_FMT("File '%s' is corruputed, take care!", MUTILS_UTF8(QFileInfo(m_filePath).fileName()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,13 +206,13 @@ 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!", QUTF8(filePath));
|
||||
THROW_FMT("File '%s' does not exist!", MUTILS_UTF8(filePath));
|
||||
}
|
||||
|
||||
//Now lock the file
|
||||
for(int i = 0; i < 64; i++)
|
||||
{
|
||||
fileHandle = CreateFileW(QWCHAR(QDir::toNativeSeparators(m_filePath)), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL);
|
||||
fileHandle = CreateFileW(MUTILS_WCHR(QDir::toNativeSeparators(m_filePath)), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL);
|
||||
if((fileHandle != NULL) && (fileHandle != INVALID_HANDLE_VALUE)) break;
|
||||
if(!i) qWarning("Failed to lock file on first attemp, retrying...");
|
||||
Sleep(100);
|
||||
@ -221,7 +221,7 @@ 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!", QUTF8(QFileInfo(m_filePath).fileName()));
|
||||
THROW_FMT("File '%s' could not be locked!", MUTILS_UTF8(QFileInfo(m_filePath).fileName()));
|
||||
}
|
||||
|
||||
//Get file descriptor
|
||||
|
45
src/Main.cpp
45
src/Main.cpp
@ -33,6 +33,11 @@
|
||||
#include "Encoder_Abstract.h"
|
||||
#include "WinSevenTaskbar.h"
|
||||
|
||||
//MUitls
|
||||
#include <MUtils/Global.h>
|
||||
#include <MUtils/OSSupport.h>
|
||||
#include <MUtils/Version.h>
|
||||
|
||||
//Qt includes
|
||||
#include <QApplication>
|
||||
#include <QMessageBox>
|
||||
@ -58,8 +63,8 @@ static int lamexp_main(int argc, char* argv[])
|
||||
|
||||
//Print version info
|
||||
qDebug("LameXP - Audio Encoder Front-End v%d.%02d %s (Build #%03d)", lamexp_version_major(), lamexp_version_minor(), lamexp_version_release(), lamexp_version_build());
|
||||
qDebug("Copyright (c) 2004-%04d LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.", qMax(lamexp_version_date().year(), lamexp_current_date_safe().year()));
|
||||
qDebug("Built on %s at %s with %s for Win-%s.\n", lamexp_version_date().toString(Qt::ISODate).toLatin1().constData(), lamexp_version_time(), lamexp_version_compiler(), lamexp_version_arch());
|
||||
qDebug("Copyright (c) 2004-%04d LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.", qMax(MUtils::Version::build_date().year(), MUtils::OS::current_date().year()));
|
||||
qDebug("Built on %s at %s with %s for Win-%s.\n", MUTILS_UTF8(MUtils::Version::build_date().toString(Qt::ISODate)), MUTILS_UTF8(MUtils::Version::build_time().toString(Qt::ISODate)), MUtils::Version::compiler_version(), MUtils::Version::compiler_arch());
|
||||
|
||||
//print license info
|
||||
qDebug("This program is free software: you can redistribute it and/or modify");
|
||||
@ -67,7 +72,7 @@ static int lamexp_main(int argc, char* argv[])
|
||||
qDebug("Note that this program is distributed with ABSOLUTELY NO WARRANTY.\n");
|
||||
|
||||
//Print warning, if this is a "debug" build
|
||||
if(LAMEXP_DEBUG)
|
||||
if(MUTILS_DEBUG)
|
||||
{
|
||||
qWarning("---------------------------------------------------------");
|
||||
qWarning("DEBUG BUILD: DO NOT RELEASE THIS BINARY TO THE PUBLIC !!!");
|
||||
@ -78,16 +83,16 @@ static int lamexp_main(int argc, char* argv[])
|
||||
qDebug("Command-Line Arguments:");
|
||||
for(int i = 0; i < arguments.count(); i++)
|
||||
{
|
||||
qDebug("argv[%d]=%s", i, QUTF8(arguments.at(i)));
|
||||
qDebug("argv[%d]=%s", i, MUTILS_UTF8(arguments.at(i)));
|
||||
}
|
||||
qDebug("");
|
||||
|
||||
//Detect CPU capabilities
|
||||
lamexp_cpu_t cpuFeatures = lamexp_detect_cpu_features(arguments);
|
||||
qDebug(" CPU vendor id : %s (Intel: %s)", cpuFeatures.vendor, LAMEXP_BOOL2STR(cpuFeatures.intel));
|
||||
qDebug(" CPU vendor id : %s (Intel: %s)", cpuFeatures.vendor, MUTILS_BOOL2STR(cpuFeatures.intel));
|
||||
qDebug("CPU brand string : %s", cpuFeatures.brand);
|
||||
qDebug(" CPU signature : Family: %d, Model: %d, Stepping: %d", cpuFeatures.family, cpuFeatures.model, cpuFeatures.stepping);
|
||||
qDebug("CPU capabilities : MMX: %s, SSE: %s, SSE2: %s, SSE3: %s, SSSE3: %s, x64: %s", LAMEXP_BOOL2STR(cpuFeatures.mmx), LAMEXP_BOOL2STR(cpuFeatures.sse), LAMEXP_BOOL2STR(cpuFeatures.sse2), LAMEXP_BOOL2STR(cpuFeatures.sse3), LAMEXP_BOOL2STR(cpuFeatures.ssse3), LAMEXP_BOOL2STR(cpuFeatures.x64));
|
||||
qDebug("CPU capabilities : MMX: %s, SSE: %s, SSE2: %s, SSE3: %s, SSSE3: %s, x64: %s", MUTILS_BOOL2STR(cpuFeatures.mmx), MUTILS_BOOL2STR(cpuFeatures.sse), MUTILS_BOOL2STR(cpuFeatures.sse2), MUTILS_BOOL2STR(cpuFeatures.sse3), MUTILS_BOOL2STR(cpuFeatures.ssse3), MUTILS_BOOL2STR(cpuFeatures.x64));
|
||||
qDebug(" Number of CPU's : %d\n", cpuFeatures.count);
|
||||
|
||||
//Initialize Qt
|
||||
@ -99,10 +104,10 @@ static int lamexp_main(int argc, char* argv[])
|
||||
//Check for expiration
|
||||
if(lamexp_version_demo())
|
||||
{
|
||||
const QDate currentDate = lamexp_current_date_safe();
|
||||
if(currentDate.addDays(1) < lamexp_version_date())
|
||||
const QDate currentDate = MUtils::OS::current_date();
|
||||
if(currentDate.addDays(1) < MUtils::Version::build_date())
|
||||
{
|
||||
qFatal("System's date (%s) is before LameXP build date (%s). Huh?", currentDate.toString(Qt::ISODate).toLatin1().constData(), lamexp_version_date().toString(Qt::ISODate).toLatin1().constData());
|
||||
qFatal("System's date (%s) is before LameXP build date (%s). Huh?", currentDate.toString(Qt::ISODate).toLatin1().constData(), MUtils::Version::build_date().toString(Qt::ISODate).toLatin1().constData());
|
||||
}
|
||||
qWarning(QString("Note: This demo (pre-release) version of LameXP will expire at %1.\n").arg(lamexp_version_expires().toString(Qt::ISODate)).toLatin1().constData());
|
||||
}
|
||||
@ -121,10 +126,10 @@ static int lamexp_main(int argc, char* argv[])
|
||||
QMessageBox messageBox(QMessageBox::Critical, "LameXP", "LameXP is already running, but the running instance doesn't respond!", QMessageBox::NoButton, NULL, Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint | Qt::WindowStaysOnTopHint);
|
||||
messageBox.exec();
|
||||
messageProducerThread->wait();
|
||||
LAMEXP_DELETE(messageProducerThread);
|
||||
MUTILS_DELETE(messageProducerThread);
|
||||
return -1;
|
||||
}
|
||||
LAMEXP_DELETE(messageProducerThread);
|
||||
MUTILS_DELETE(messageProducerThread);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -139,7 +144,7 @@ static int lamexp_main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
//Self-test
|
||||
if(LAMEXP_DEBUG)
|
||||
if(MUTILS_DEBUG)
|
||||
{
|
||||
InitializationThread::selfTest();
|
||||
}
|
||||
@ -156,7 +161,7 @@ static int lamexp_main(int argc, char* argv[])
|
||||
InitializationThread *poInitializationThread = new InitializationThread(&cpuFeatures);
|
||||
SplashScreen::showSplash(poInitializationThread);
|
||||
settingsModel->slowStartup(poInitializationThread->getSlowIndicator());
|
||||
LAMEXP_DELETE(poInitializationThread);
|
||||
MUTILS_DELETE(poInitializationThread);
|
||||
|
||||
//Validate settings
|
||||
settingsModel->validate();
|
||||
@ -181,15 +186,15 @@ static int lamexp_main(int argc, char* argv[])
|
||||
ProcessingDialog *processingDialog = new ProcessingDialog(fileListModel, metaInfo, settingsModel);
|
||||
processingDialog->exec();
|
||||
iShutdown = processingDialog->getShutdownFlag();
|
||||
LAMEXP_DELETE(processingDialog);
|
||||
MUTILS_DELETE(processingDialog);
|
||||
}
|
||||
}
|
||||
|
||||
//Free models
|
||||
LAMEXP_DELETE(poMainWindow);
|
||||
LAMEXP_DELETE(fileListModel);
|
||||
LAMEXP_DELETE(metaInfo);
|
||||
LAMEXP_DELETE(settingsModel);
|
||||
MUTILS_DELETE(poMainWindow);
|
||||
MUTILS_DELETE(fileListModel);
|
||||
MUTILS_DELETE(metaInfo);
|
||||
MUTILS_DELETE(settingsModel);
|
||||
|
||||
//Taskbar un-init
|
||||
WinSevenTaskbar::uninit();
|
||||
@ -216,7 +221,7 @@ static int lamexp_main(int argc, char* argv[])
|
||||
|
||||
static int _main(int argc, char* argv[])
|
||||
{
|
||||
if(LAMEXP_DEBUG)
|
||||
if(MUTILS_DEBUG)
|
||||
{
|
||||
int iResult = -1;
|
||||
qInstallMsgHandler(lamexp_message_handler);
|
||||
@ -249,7 +254,7 @@ static int _main(int argc, char* argv[])
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if(LAMEXP_DEBUG)
|
||||
if(MUTILS_DEBUG)
|
||||
{
|
||||
int exit_code = -1;
|
||||
LAMEXP_MEMORY_CHECK(_main, exit_code, argc, argv);
|
||||
|
@ -22,8 +22,13 @@
|
||||
|
||||
#include "Model_Artwork.h"
|
||||
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//Qt
|
||||
#include <QFile>
|
||||
#include <QMutex>
|
||||
#include <QMutexLocker>
|
||||
@ -55,7 +60,7 @@ protected:
|
||||
else
|
||||
{
|
||||
qWarning("[ArtworkModel] Failed to open artwork file!");
|
||||
LAMEXP_DELETE(file);
|
||||
MUTILS_DELETE(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -69,7 +74,7 @@ protected:
|
||||
m_fileHandle->remove();
|
||||
}
|
||||
m_fileHandle->close();
|
||||
LAMEXP_DELETE(m_fileHandle);
|
||||
MUTILS_DELETE(m_fileHandle);
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,7 +161,7 @@ ArtworkModel::~ArtworkModel(void)
|
||||
QMutexLocker lock(m_mutex);
|
||||
ArtworkModel_SharedData::detach(&m_data);
|
||||
lock.unlock();
|
||||
LAMEXP_DELETE(m_mutex);
|
||||
MUTILS_DELETE(m_mutex);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -22,20 +22,26 @@
|
||||
|
||||
#include "Model_AudioFile.h"
|
||||
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//Qt
|
||||
#include <QTime>
|
||||
#include <QObject>
|
||||
#include <QMutexLocker>
|
||||
#include <QFile>
|
||||
|
||||
//CRT
|
||||
#include <limits.h>
|
||||
|
||||
const unsigned int AudioFileModel::BITDEPTH_IEEE_FLOAT32 = UINT_MAX-1;
|
||||
|
||||
#define PRINT_S(VAR) do \
|
||||
{ \
|
||||
if((VAR).isEmpty()) qDebug(#VAR " = N/A"); else qDebug(#VAR " = \"%s\"", QUTF8((VAR))); \
|
||||
if((VAR).isEmpty()) qDebug(#VAR " = N/A"); else qDebug(#VAR " = \"%s\"", MUTILS_UTF8((VAR))); \
|
||||
} \
|
||||
while(0)
|
||||
|
||||
@ -346,7 +352,7 @@ const QString AudioFileModel::audioCompressInfo(void) const
|
||||
info.append(QString(", %1: %2 kbps (%3)").arg(tr("Bitrate"), QString::number(m_techInfo.audioBitrate()), tr("Constant")));
|
||||
break;
|
||||
case BitrateModeVariable:
|
||||
info.append(WCHAR2QSTR(L", %1: \u2248%2 kbps (%3)").arg(tr("Bitrate"), QString::number(m_techInfo.audioBitrate()), tr("Variable")));
|
||||
info.append(MUTILS_QSTR(L", %1: \u2248%2 kbps (%3)").arg(tr("Bitrate"), QString::number(m_techInfo.audioBitrate()), tr("Variable")));
|
||||
break;
|
||||
default:
|
||||
info.append(QString(", %1: %2 kbps").arg(tr("Bitrate"), QString::number(m_techInfo.audioBitrate())));
|
||||
|
@ -20,11 +20,16 @@
|
||||
// http://www.gnu.org/licenses/gpl-2.0.txt
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
#include "Model_CueSheet.h"
|
||||
#include "Model_AudioFile.h"
|
||||
#include "Genres.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//Qt
|
||||
#include <QApplication>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
@ -34,6 +39,7 @@
|
||||
#include <QTextStream>
|
||||
#include <QMutexLocker>
|
||||
|
||||
//CRT
|
||||
#include <float.h>
|
||||
#include <limits>
|
||||
|
||||
@ -524,7 +530,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic
|
||||
/* --- FILE --- */
|
||||
if(rxFile.indexIn(line) >= 0)
|
||||
{
|
||||
qDebug("%03d File: <%s> <%s>", lines, QUTF8(rxFile.cap(1)), QUTF8(rxFile.cap(2)));
|
||||
qDebug("%03d File: <%s> <%s>", lines, MUTILS_UTF8(rxFile.cap(1)), MUTILS_UTF8(rxFile.cap(2)));
|
||||
if(currentFile)
|
||||
{
|
||||
if(currentTrack)
|
||||
@ -536,7 +542,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic
|
||||
}
|
||||
else
|
||||
{
|
||||
LAMEXP_DELETE(currentTrack);
|
||||
MUTILS_DELETE(currentTrack);
|
||||
}
|
||||
}
|
||||
if(currentFile->isValid())
|
||||
@ -546,12 +552,12 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic
|
||||
}
|
||||
else
|
||||
{
|
||||
LAMEXP_DELETE(currentFile);
|
||||
MUTILS_DELETE(currentFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LAMEXP_DELETE(currentTrack);
|
||||
MUTILS_DELETE(currentTrack);
|
||||
}
|
||||
if(!rxFile.cap(2).compare("WAVE", Qt::CaseInsensitive) || !rxFile.cap(2).compare("MP3", Qt::CaseInsensitive) || !rxFile.cap(2).compare("AIFF", Qt::CaseInsensitive))
|
||||
{
|
||||
@ -561,7 +567,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic
|
||||
else
|
||||
{
|
||||
bUnsupportedTrack = true;
|
||||
qWarning("%03d Skipping unsupported file of type '%s'.", lines, QUTF8(rxFile.cap(2)));
|
||||
qWarning("%03d Skipping unsupported file of type '%s'.", lines, MUTILS_UTF8(rxFile.cap(2)));
|
||||
currentFile = NULL;
|
||||
}
|
||||
bPreamble = false;
|
||||
@ -574,7 +580,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic
|
||||
{
|
||||
if(currentFile)
|
||||
{
|
||||
qDebug("%03d Track: <%s> <%s>", lines, QUTF8(rxTrack.cap(1)), QUTF8(rxTrack.cap(2)));
|
||||
qDebug("%03d Track: <%s> <%s>", lines, MUTILS_UTF8(rxTrack.cap(1)), MUTILS_UTF8(rxTrack.cap(2)));
|
||||
if(currentTrack)
|
||||
{
|
||||
if(currentTrack->isValid())
|
||||
@ -584,7 +590,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic
|
||||
}
|
||||
else
|
||||
{
|
||||
LAMEXP_DELETE(currentTrack);
|
||||
MUTILS_DELETE(currentTrack);
|
||||
}
|
||||
}
|
||||
if(!rxTrack.cap(2).compare("AUDIO", Qt::CaseInsensitive))
|
||||
@ -594,13 +600,13 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic
|
||||
else
|
||||
{
|
||||
bUnsupportedTrack = true;
|
||||
qWarning("%03d Skipping unsupported track of type '%s'.", lines, QUTF8(rxTrack.cap(2)));
|
||||
qWarning("%03d Skipping unsupported track of type '%s'.", lines, MUTILS_UTF8(rxTrack.cap(2)));
|
||||
currentTrack = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LAMEXP_DELETE(currentTrack);
|
||||
MUTILS_DELETE(currentTrack);
|
||||
}
|
||||
bPreamble = false;
|
||||
continue;
|
||||
@ -611,7 +617,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic
|
||||
{
|
||||
if(currentFile && currentTrack)
|
||||
{
|
||||
qDebug("%03d Index: <%s> <%s>", lines, QUTF8(rxIndex.cap(1)), QUTF8(rxIndex.cap(2)));
|
||||
qDebug("%03d Index: <%s> <%s>", lines, MUTILS_UTF8(rxIndex.cap(1)), MUTILS_UTF8(rxIndex.cap(2)));
|
||||
if(rxIndex.cap(1).toInt() == 1)
|
||||
{
|
||||
currentTrack->setStartIndex(parseTimeIndex(rxIndex.cap(2)));
|
||||
@ -629,7 +635,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic
|
||||
}
|
||||
else if(currentFile && currentTrack)
|
||||
{
|
||||
qDebug("%03d Title: <%s>", lines, QUTF8(rxTitle.cap(1)));
|
||||
qDebug("%03d Title: <%s>", lines, MUTILS_UTF8(rxTitle.cap(1)));
|
||||
currentTrack->metaInfo().setTitle(UNQUOTE(rxTitle.cap(1)).simplified());
|
||||
}
|
||||
continue;
|
||||
@ -644,7 +650,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic
|
||||
}
|
||||
else if(currentFile && currentTrack)
|
||||
{
|
||||
qDebug("%03d Title: <%s>", lines, QUTF8(rxPerformer.cap(1)));
|
||||
qDebug("%03d Title: <%s>", lines, MUTILS_UTF8(rxPerformer.cap(1)));
|
||||
currentTrack->metaInfo().setArtist(UNQUOTE(rxPerformer.cap(1)).simplified());
|
||||
}
|
||||
continue;
|
||||
@ -667,7 +673,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic
|
||||
}
|
||||
else if(currentFile && currentTrack)
|
||||
{
|
||||
qDebug("%03d Genre: <%s>", lines, QUTF8(rxGenre.cap(1)));
|
||||
qDebug("%03d Genre: <%s>", lines, MUTILS_UTF8(rxGenre.cap(1)));
|
||||
QString temp = UNQUOTE(rxGenre.cap(1).simplified());
|
||||
for(int i = 0; g_lamexp_generes[i]; i++)
|
||||
{
|
||||
@ -692,7 +698,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic
|
||||
}
|
||||
else if(currentFile && currentTrack)
|
||||
{
|
||||
qDebug("%03d Year: <%s>", lines, QUTF8(rxPerformer.cap(1)));
|
||||
qDebug("%03d Year: <%s>", lines, MUTILS_UTF8(rxPerformer.cap(1)));
|
||||
bool ok = false;
|
||||
unsigned int temp = rxYear.cap(1).toUInt(&ok);
|
||||
if(ok) currentTrack->metaInfo().setYear(temp);
|
||||
@ -713,7 +719,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic
|
||||
}
|
||||
else
|
||||
{
|
||||
LAMEXP_DELETE(currentTrack);
|
||||
MUTILS_DELETE(currentTrack);
|
||||
}
|
||||
}
|
||||
if(currentFile->isValid())
|
||||
@ -723,7 +729,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic
|
||||
}
|
||||
else
|
||||
{
|
||||
LAMEXP_DELETE(currentFile);
|
||||
MUTILS_DELETE(currentFile);
|
||||
}
|
||||
}
|
||||
|
||||
@ -832,7 +838,7 @@ double CueSheetModel::parseTimeIndex(const QString &index)
|
||||
}
|
||||
}
|
||||
|
||||
qWarning(" Bad time index: '%s'", QUTF8(index));
|
||||
qWarning(" Bad time index: '%s'", MUTILS_UTF8(index));
|
||||
return std::numeric_limits<double>::quiet_NaN();
|
||||
}
|
||||
|
||||
|
@ -22,8 +22,13 @@
|
||||
|
||||
#include "Model_FileList.h"
|
||||
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//Qt
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
@ -361,7 +366,7 @@ int FileListModel::importFromCsv(QWidget *parent, const QString &inFile)
|
||||
|
||||
if(input->exec() < 1)
|
||||
{
|
||||
LAMEXP_DELETE(input);
|
||||
MUTILS_DELETE(input);
|
||||
return CsvError_Aborted;
|
||||
}
|
||||
|
||||
@ -376,7 +381,7 @@ int FileListModel::importFromCsv(QWidget *parent, const QString &inFile)
|
||||
codec = QTextCodec::codecForName("System");
|
||||
}
|
||||
|
||||
LAMEXP_DELETE(input);
|
||||
MUTILS_DELETE(input);
|
||||
}
|
||||
|
||||
bomCheck.clear();
|
||||
@ -428,7 +433,7 @@ int FileListModel::importFromCsv(QWidget *parent, const QString &inFile)
|
||||
{
|
||||
if(stream.atEnd())
|
||||
{
|
||||
LAMEXP_DELETE_ARRAY(ignore);
|
||||
MUTILS_DELETE_ARRAY(ignore);
|
||||
return CsvError_Incomplete;
|
||||
}
|
||||
|
||||
@ -495,7 +500,7 @@ int FileListModel::importFromCsv(QWidget *parent, const QString &inFile)
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning("Unkonw field '%s' will be ignored!", QUTF8(header.at(j)));
|
||||
qWarning("Unkonw field '%s' will be ignored!", MUTILS_UTF8(header.at(j)));
|
||||
ignore[j] = true;
|
||||
|
||||
if(!checkArray(ignore, false, nCols))
|
||||
@ -509,7 +514,7 @@ int FileListModel::importFromCsv(QWidget *parent, const QString &inFile)
|
||||
|
||||
//----------------------//
|
||||
|
||||
LAMEXP_DELETE_ARRAY(ignore);
|
||||
MUTILS_DELETE_ARRAY(ignore);
|
||||
return CsvError_OK;
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,14 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "Model_FileSystem.h"
|
||||
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//Qt
|
||||
#include <QApplication>
|
||||
#include <QFileIconProvider>
|
||||
#include <QDesktopServices>
|
||||
@ -103,7 +109,7 @@ QIcon QFileIconProviderEx::icon(const QFileInfo &info) const
|
||||
}
|
||||
else if(info.isRoot())
|
||||
{
|
||||
switch(GetDriveType(QWCHAR(QDir::toNativeSeparators(info.absoluteFilePath()))))
|
||||
switch(GetDriveType(MUTILS_WCHR(QDir::toNativeSeparators(info.absoluteFilePath()))))
|
||||
{
|
||||
case DRIVE_CDROM:
|
||||
return m_cdromIcon;
|
||||
@ -170,7 +176,7 @@ QFileSystemModelEx::QFileSystemModelEx()
|
||||
QFileSystemModelEx::~QFileSystemModelEx()
|
||||
{
|
||||
removeAllFromCache();
|
||||
LAMEXP_DELETE(m_myIconProvider);
|
||||
MUTILS_DELETE(m_myIconProvider);
|
||||
}
|
||||
|
||||
bool QFileSystemModelEx::hasChildren(const QModelIndex &parent) const
|
||||
@ -272,7 +278,7 @@ bool QFileSystemModelEx::hasSubfolders(const QString &path)
|
||||
WIN32_FIND_DATAW findData;
|
||||
bool bChildren = false;
|
||||
|
||||
HANDLE h = FindFirstFileEx(QWCHAR(QDir::toNativeSeparators(path + "/*")), ((FINDEX_INFO_LEVELS)s_findFirstFileExInfoLevel), &findData, FindExSearchLimitToDirectories, NULL, 0);
|
||||
HANDLE h = FindFirstFileEx(MUTILS_WCHR(QDir::toNativeSeparators(path + "/*")), ((FINDEX_INFO_LEVELS)s_findFirstFileExInfoLevel), &findData, FindExSearchLimitToDirectories, NULL, 0);
|
||||
|
||||
if(h != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
@ -22,9 +22,14 @@
|
||||
|
||||
#include "Model_Settings.h"
|
||||
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
#include "Registry_Encoder.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//Qt
|
||||
#include <QSettings>
|
||||
#include <QDesktopServices>
|
||||
#include <QApplication>
|
||||
@ -59,10 +64,10 @@ public:
|
||||
{
|
||||
flushValues();
|
||||
|
||||
LAMEXP_DELETE(m_cache);
|
||||
LAMEXP_DELETE(m_cacheDirty);
|
||||
LAMEXP_DELETE(m_cacheLock);
|
||||
LAMEXP_DELETE(m_configFile);
|
||||
MUTILS_DELETE(m_cache);
|
||||
MUTILS_DELETE(m_cacheDirty);
|
||||
MUTILS_DELETE(m_cacheLock);
|
||||
MUTILS_DELETE(m_configFile);
|
||||
}
|
||||
|
||||
inline void storeValue(const QString &key, const QVariant &value)
|
||||
@ -112,7 +117,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning("Could not find '%s' in cache, but it has been marked as dirty!", QUTF8(*iter));
|
||||
qWarning("Could not find '%s' in cache, but it has been marked as dirty!", MUTILS_UTF8(*iter));
|
||||
}
|
||||
}
|
||||
m_configFile->sync();
|
||||
@ -331,7 +336,7 @@ SettingsModel::SettingsModel(void)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
qWarning("Deleting obsolete group from config: %s", QUTF8(current));
|
||||
qWarning("Deleting obsolete group from config: %s", MUTILS_UTF8(current));
|
||||
REMOVE_GROUP(configFile, current);
|
||||
}
|
||||
|
||||
@ -350,8 +355,8 @@ SettingsModel::SettingsModel(void)
|
||||
|
||||
SettingsModel::~SettingsModel(void)
|
||||
{
|
||||
LAMEXP_DELETE(m_configCache);
|
||||
LAMEXP_DELETE(m_defaultLanguage);
|
||||
MUTILS_DELETE(m_configCache);
|
||||
MUTILS_DELETE(m_defaultLanguage);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -466,9 +471,9 @@ QString SettingsModel::defaultLanguage(void) const
|
||||
//Detect system langauge
|
||||
QLocale systemLanguage= QLocale::system();
|
||||
qDebug("[Locale]");
|
||||
qDebug("Language: %s (%d)", QUTF8(QLocale::languageToString(systemLanguage.language())), systemLanguage.language());
|
||||
qDebug("Country is: %s (%d)", QUTF8(QLocale::countryToString(systemLanguage.country())), systemLanguage.country());
|
||||
qDebug("Script is: %s (%d)\n", QUTF8(QLocale::scriptToString(systemLanguage.script())), systemLanguage.script());
|
||||
qDebug("Language: %s (%d)", MUTILS_UTF8(QLocale::languageToString(systemLanguage.language())), systemLanguage.language());
|
||||
qDebug("Country is: %s (%d)", MUTILS_UTF8(QLocale::countryToString(systemLanguage.country())), systemLanguage.country());
|
||||
qDebug("Script is: %s (%d)\n", MUTILS_UTF8(QLocale::scriptToString(systemLanguage.script())), systemLanguage.script());
|
||||
|
||||
//Check if we can use the default translation
|
||||
if(systemLanguage.language() == QLocale::English /*|| systemLanguage.language() == QLocale::C*/)
|
||||
|
@ -22,8 +22,13 @@
|
||||
|
||||
#include "PlaylistImporter.h"
|
||||
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//Qt
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QDir>
|
||||
@ -170,7 +175,7 @@ bool PlaylistImporter::parsePlaylist_m3u(QFile &data, QStringList &fileList, con
|
||||
|
||||
if(filename.exists() && filename.isFile())
|
||||
{
|
||||
qDebug("Found: \"%s\"", QUTF8(filePath[i]));
|
||||
qDebug("Found: \"%s\"", MUTILS_UTF8(filePath[i]));
|
||||
if(isPlaylist(filename.canonicalFilePath()) == notPlaylist)
|
||||
{
|
||||
fileList << filename.canonicalFilePath();
|
||||
|
@ -22,6 +22,14 @@
|
||||
|
||||
#include "ShellIntegration.h"
|
||||
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
#include "Registry_Decoder.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//Qt
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QRegExp>
|
||||
@ -31,12 +39,10 @@
|
||||
#include <QMutexLocker>
|
||||
#include <QtConcurrentRun>
|
||||
|
||||
//Win32 API
|
||||
#include <Shlobj.h>
|
||||
#include <Shlwapi.h>
|
||||
|
||||
#include "Global.h"
|
||||
#include "Registry_Decoder.h"
|
||||
|
||||
//Const
|
||||
static const char *g_lamexpShellAction = "ConvertWithLameXP";
|
||||
static const char *g_lamexpFileType = "LameXP.SupportedAudioFile";
|
||||
@ -83,22 +89,22 @@ void ShellIntegration::install(bool async)
|
||||
const QString lamexpShellAction(g_lamexpShellAction);
|
||||
|
||||
//Register the LameXP file type
|
||||
if(RegCreateKeyEx(HKEY_CURRENT_USER, QWCHAR(QString("Software\\Classes\\%1").arg(lamexpFileType)), NULL, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS)
|
||||
if(RegCreateKeyEx(HKEY_CURRENT_USER, MUTILS_WCHR(QString("Software\\Classes\\%1").arg(lamexpFileType)), NULL, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS)
|
||||
{
|
||||
REG_WRITE_STRING(key, lamexpFileInfo);
|
||||
RegCloseKey(key);
|
||||
}
|
||||
if(RegCreateKeyEx(HKEY_CURRENT_USER, QWCHAR(QString("Software\\Classes\\%1\\shell").arg(lamexpFileType)), NULL, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS)
|
||||
if(RegCreateKeyEx(HKEY_CURRENT_USER, MUTILS_WCHR(QString("Software\\Classes\\%1\\shell").arg(lamexpFileType)), NULL, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS)
|
||||
{
|
||||
REG_WRITE_STRING(key, lamexpShellAction);
|
||||
RegCloseKey(key);
|
||||
}
|
||||
if(RegCreateKeyEx(HKEY_CURRENT_USER, QWCHAR(QString("Software\\Classes\\%1\\shell\\%2").arg(lamexpFileType, lamexpShellAction)), NULL, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS)
|
||||
if(RegCreateKeyEx(HKEY_CURRENT_USER, MUTILS_WCHR(QString("Software\\Classes\\%1\\shell\\%2").arg(lamexpFileType, lamexpShellAction)), NULL, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS)
|
||||
{
|
||||
REG_WRITE_STRING(key, lamexpShellText);
|
||||
RegCloseKey(key);
|
||||
}
|
||||
if(RegCreateKeyEx(HKEY_CURRENT_USER, QWCHAR(QString("Software\\Classes\\%1\\shell\\%2\\command").arg(lamexpFileType, lamexpShellAction)), NULL, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS)
|
||||
if(RegCreateKeyEx(HKEY_CURRENT_USER, MUTILS_WCHR(QString("Software\\Classes\\%1\\shell\\%2\\command").arg(lamexpFileType, lamexpShellAction)), NULL, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS)
|
||||
{
|
||||
REG_WRITE_STRING(key, lamexpShellCommand);
|
||||
RegCloseKey(key);
|
||||
@ -112,13 +118,13 @@ void ShellIntegration::install(bool async)
|
||||
{
|
||||
QString currentType = types->takeFirst();
|
||||
|
||||
if(RegCreateKeyEx(HKEY_CURRENT_USER, QWCHAR(QString("Software\\Classes\\%1\\shell\\%2").arg(currentType, lamexpShellAction)), NULL, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS)
|
||||
if(RegCreateKeyEx(HKEY_CURRENT_USER, MUTILS_WCHR(QString("Software\\Classes\\%1\\shell\\%2").arg(currentType, lamexpShellAction)), NULL, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS)
|
||||
{
|
||||
REG_WRITE_STRING(key, lamexpShellText);
|
||||
RegCloseKey(key);
|
||||
}
|
||||
|
||||
if(RegCreateKeyEx(HKEY_CURRENT_USER, QWCHAR(QString("Software\\Classes\\%1\\shell\\%2\\command").arg(currentType, lamexpShellAction)), NULL, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS)
|
||||
if(RegCreateKeyEx(HKEY_CURRENT_USER, MUTILS_WCHR(QString("Software\\Classes\\%1\\shell\\%2\\command").arg(currentType, lamexpShellAction)), NULL, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS)
|
||||
{
|
||||
REG_WRITE_STRING(key, lamexpShellCommand);
|
||||
RegCloseKey(key);
|
||||
@ -172,11 +178,11 @@ void ShellIntegration::remove(bool async)
|
||||
//Remove shell action from all file types
|
||||
while(!fileTypes.isEmpty())
|
||||
{
|
||||
SHDeleteKey(HKEY_CURRENT_USER, QWCHAR(QString("Software\\Classes\\%1\\shell\\%2").arg(fileTypes.takeFirst(), lamexpShellAction)));
|
||||
SHDeleteKey(HKEY_CURRENT_USER, MUTILS_WCHR(QString("Software\\Classes\\%1\\shell\\%2").arg(fileTypes.takeFirst(), lamexpShellAction)));
|
||||
}
|
||||
|
||||
//Unregister LameXP file type
|
||||
SHDeleteKey(HKEY_CURRENT_USER, QWCHAR(QString("Software\\Classes\\%1").arg(lamexpFileType)));
|
||||
SHDeleteKey(HKEY_CURRENT_USER, MUTILS_WCHR(QString("Software\\Classes\\%1").arg(lamexpFileType)));
|
||||
|
||||
//Shell notification
|
||||
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
|
||||
@ -215,7 +221,7 @@ QStringList *ShellIntegration::detectTypes(const QString &lamexpFileType, const
|
||||
{
|
||||
QString currentExt = extensions.takeFirst();
|
||||
|
||||
if(RegOpenKeyEx(HKEY_CLASSES_ROOT, QWCHAR(currentExt), NULL, KEY_QUERY_VALUE, &key) == ERROR_SUCCESS)
|
||||
if(RegOpenKeyEx(HKEY_CLASSES_ROOT, MUTILS_WCHR(currentExt), NULL, KEY_QUERY_VALUE, &key) == ERROR_SUCCESS)
|
||||
{
|
||||
wchar_t data[256];
|
||||
DWORD dataLen = 256 * sizeof(wchar_t);
|
||||
@ -236,14 +242,14 @@ QStringList *ShellIntegration::detectTypes(const QString &lamexpFileType, const
|
||||
}
|
||||
else
|
||||
{
|
||||
if(RegCreateKeyEx(HKEY_CURRENT_USER, QWCHAR(QString("Software\\Classes\\%1").arg(currentExt)), NULL, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS)
|
||||
if(RegCreateKeyEx(HKEY_CURRENT_USER, MUTILS_WCHR(QString("Software\\Classes\\%1").arg(currentExt)), NULL, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS)
|
||||
{
|
||||
REG_WRITE_STRING(key, lamexpFileType);
|
||||
RegCloseKey(key);
|
||||
}
|
||||
}
|
||||
|
||||
if(RegOpenKeyEx(HKEY_CURRENT_USER, QWCHAR(QString("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\%1\\UserChoice").arg(currentExt)), NULL, KEY_QUERY_VALUE, &key) == ERROR_SUCCESS)
|
||||
if(RegOpenKeyEx(HKEY_CURRENT_USER, MUTILS_WCHR(QString("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\%1\\UserChoice").arg(currentExt)), NULL, KEY_QUERY_VALUE, &key) == ERROR_SUCCESS)
|
||||
{
|
||||
wchar_t data[256];
|
||||
DWORD dataLen = 256 * sizeof(wchar_t);
|
||||
@ -263,7 +269,7 @@ QStringList *ShellIntegration::detectTypes(const QString &lamexpFileType, const
|
||||
RegCloseKey(key);
|
||||
}
|
||||
|
||||
if(RegOpenKeyEx(HKEY_CURRENT_USER, QWCHAR(QString("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\%1\\OpenWithProgids").arg(currentExt)), NULL, KEY_QUERY_VALUE, &key) == ERROR_SUCCESS)
|
||||
if(RegOpenKeyEx(HKEY_CURRENT_USER, MUTILS_WCHR(QString("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\%1\\OpenWithProgids").arg(currentExt)), NULL, KEY_QUERY_VALUE, &key) == ERROR_SUCCESS)
|
||||
{
|
||||
wchar_t name[256];
|
||||
for(DWORD i = 0; true; i++)
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "Thread_CueSplitter.h"
|
||||
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
#include "LockedFile.h"
|
||||
#include "Model_AudioFile.h"
|
||||
@ -29,6 +30,10 @@
|
||||
#include "Registry_Decoder.h"
|
||||
#include "Decoder_Abstract.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//Qt
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QProcess>
|
||||
@ -36,6 +41,7 @@
|
||||
#include <QTime>
|
||||
#include <QDebug>
|
||||
|
||||
//CRT
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include <limits>
|
||||
@ -65,7 +71,7 @@ CueSplitter::CueSplitter(const QString &outputDir, const QString &baseName, CueS
|
||||
for(int i = 0; i < nInputFiles; i++)
|
||||
{
|
||||
m_inputFilesInfo.insert(inputFilesInfo[i].filePath(), inputFilesInfo[i]);
|
||||
qDebug("File %02d: <%s>", i, QUTF8(inputFilesInfo[i].filePath()));
|
||||
qDebug("File %02d: <%s>", i, MUTILS_UTF8(inputFilesInfo[i].filePath()));
|
||||
}
|
||||
|
||||
qDebug("All input files added.");
|
||||
@ -76,7 +82,7 @@ CueSplitter::~CueSplitter(void)
|
||||
{
|
||||
while(!m_tempFiles.isEmpty())
|
||||
{
|
||||
lamexp_remove_file(m_tempFiles.takeFirst());
|
||||
MUtils::remove_file(m_tempFiles.takeFirst());
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,7 +102,7 @@ void CueSplitter::run()
|
||||
|
||||
if(!QDir(m_outputDir).exists())
|
||||
{
|
||||
qWarning("Output directory \"%s\" does not exist!", QUTF8(m_outputDir));
|
||||
qWarning("Output directory \"%s\" does not exist!", MUTILS_UTF8(m_outputDir));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -120,7 +126,7 @@ void CueSplitter::run()
|
||||
emit fileSelected(m_activeFile);
|
||||
emit progressValChanged(i+1);
|
||||
|
||||
QString tempFile = QString("%1/~%2.wav").arg(m_outputDir, lamexp_rand_str());
|
||||
QString tempFile = QString("%1/~%2.wav").arg(m_outputDir, MUtils::rand_str());
|
||||
connect(decoder, SIGNAL(statusUpdated(int)), this, SLOT(handleUpdate(int)), Qt::DirectConnection);
|
||||
|
||||
if(decoder->decode(inputFileList.at(i), tempFile, &m_abortFlag))
|
||||
@ -131,11 +137,11 @@ void CueSplitter::run()
|
||||
else
|
||||
{
|
||||
qWarning("Failed to decompress file: <%s>", inputFileList.at(i).toLatin1().constData());
|
||||
lamexp_remove_file(tempFile);
|
||||
MUtils::remove_file(tempFile);
|
||||
}
|
||||
|
||||
m_activeFile.clear();
|
||||
LAMEXP_DELETE(decoder);
|
||||
MUTILS_DELETE(decoder);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -244,12 +250,12 @@ void CueSplitter::handleUpdate(int progress)
|
||||
void CueSplitter::splitFile(const QString &output, const int trackNo, const QString &file, const double offset, const double length, const AudioFileModel_MetaInfo &metaInfo, const int baseProgress)
|
||||
{
|
||||
qDebug("[Track %02d]", trackNo);
|
||||
qDebug("File: <%s>", QUTF8(file));
|
||||
qDebug("File: <%s>", MUTILS_UTF8(file));
|
||||
qDebug("Offset: <%f> <%s>", offset, indexToString(offset).toLatin1().constData());
|
||||
qDebug("Length: <%f> <%s>", length, indexToString(length).toLatin1().constData());
|
||||
qDebug("Artist: <%s>", QUTF8(metaInfo.artist()));
|
||||
qDebug("Title: <%s>", QUTF8(metaInfo.title()));
|
||||
qDebug("Album: <%s>", QUTF8(metaInfo.album()));
|
||||
qDebug("Artist: <%s>", MUTILS_UTF8(metaInfo.artist()));
|
||||
qDebug("Title: <%s>", MUTILS_UTF8(metaInfo.title()));
|
||||
qDebug("Album: <%s>", MUTILS_UTF8(metaInfo.album()));
|
||||
|
||||
int prevProgress = baseProgress;
|
||||
|
||||
@ -262,7 +268,7 @@ void CueSplitter::splitFile(const QString &output, const int trackNo, const QStr
|
||||
|
||||
QString baseName = shortName(QFileInfo(output).fileName());
|
||||
QString decompressedInput = m_decompressedFiles[file];
|
||||
qDebug("Input: <%s>", QUTF8(decompressedInput));
|
||||
qDebug("Input: <%s>", MUTILS_UTF8(decompressedInput));
|
||||
|
||||
AudioFileModel outFileInfo(output);
|
||||
outFileInfo.setMetaInfo(metaInfo);
|
||||
@ -297,7 +303,7 @@ void CueSplitter::splitFile(const QString &output, const int trackNo, const QStr
|
||||
QRegExp rxDuration("Duration\\s*:\\s*(\\d\\d):(\\d\\d):(\\d\\d).(\\d\\d)", Qt::CaseInsensitive);
|
||||
|
||||
QProcess process;
|
||||
lamexp_init_process(process, m_outputDir);
|
||||
MUtils::init_process(process, m_outputDir);
|
||||
|
||||
process.start(m_soxBin, args);
|
||||
|
||||
|
@ -22,9 +22,14 @@
|
||||
|
||||
#include "Thread_DiskObserver.h"
|
||||
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
#include "Model_Progress.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//Qt
|
||||
#include <QDir>
|
||||
|
||||
#define MIN_DISKSPACE 104857600ui64 //100 MB
|
||||
@ -82,7 +87,7 @@ void DiskObserverThread::observe(void)
|
||||
{
|
||||
if(freeSpace < minimumSpace)
|
||||
{
|
||||
qWarning("Free diskspace on '%s' dropped below %s MB, only %s MB free!", QUTF8(m_path), QUTF8(QString::number(minimumSpace / 1048576ui64)), QUTF8(QString::number(freeSpace / 1048576ui64)));
|
||||
qWarning("Free diskspace on '%s' dropped below %s MB, only %s MB free!", MUTILS_UTF8(m_path), MUTILS_UTF8(QString::number(minimumSpace / 1048576ui64)), MUTILS_UTF8(QString::number(freeSpace / 1048576ui64)));
|
||||
emit messageLogged(tr("Low diskspace on drive '%1' detected (only %2 MB are free), problems can occur!").arg(QDir::toNativeSeparators(m_path), QString::number(freeSpace / 1048576ui64)), ProgressModel::SysMsg_Warning);
|
||||
minimumSpace = qMin(freeSpace, (minimumSpace >> 1));
|
||||
}
|
||||
|
@ -22,12 +22,17 @@
|
||||
|
||||
#include "Thread_FileAnalyzer.h"
|
||||
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
#include "LockedFile.h"
|
||||
#include "Model_AudioFile.h"
|
||||
#include "Thread_FileAnalyzer_Task.h"
|
||||
#include "PlaylistImporter.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//Qt
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QProcess>
|
||||
@ -86,9 +91,9 @@ FileAnalyzer::~FileAnalyzer(void)
|
||||
}
|
||||
}
|
||||
|
||||
LAMEXP_DELETE(m_templateFile);
|
||||
LAMEXP_DELETE(m_pool);
|
||||
LAMEXP_DELETE(m_timer);
|
||||
MUTILS_DELETE(m_templateFile);
|
||||
MUTILS_DELETE(m_pool);
|
||||
MUTILS_DELETE(m_timer);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -314,7 +319,7 @@ bool FileAnalyzer::createTemplate(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
QString templatePath = QString("%1/%2.txt").arg(lamexp_temp_folder2(), lamexp_rand_str());
|
||||
QString templatePath = QString("%1/%2.txt").arg(MUtils::temp_folder(), MUtils::rand_str());
|
||||
|
||||
QFile templateFile(templatePath);
|
||||
if(!templateFile.open(QIODevice::WriteOnly))
|
||||
|
@ -22,10 +22,15 @@
|
||||
|
||||
#include "Thread_FileAnalyzer_Task.h"
|
||||
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
#include "LockedFile.h"
|
||||
#include "Model_AudioFile.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//Qt
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QProcess>
|
||||
@ -37,6 +42,8 @@
|
||||
#include <QWriteLocker>
|
||||
#include <QThread>
|
||||
|
||||
|
||||
//CRT
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
#include <assert.h>
|
||||
@ -95,7 +102,7 @@ void AnalyzeTask::run_ex(void)
|
||||
{
|
||||
int fileType = fileTypeNormal;
|
||||
QString currentFile = QDir::fromNativeSeparators(m_inputFile);
|
||||
qDebug("Analyzing: %s", QUTF8(currentFile));
|
||||
qDebug("Analyzing: %s", MUTILS_UTF8(currentFile));
|
||||
|
||||
AudioFileModel file = analyzeFile(currentFile, &fileType);
|
||||
|
||||
@ -131,12 +138,12 @@ void AnalyzeTask::run_ex(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug("Rejected Avisynth file: %s", QUTF8(file.filePath()));
|
||||
qDebug("Rejected Avisynth file: %s", MUTILS_UTF8(file.filePath()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug("Rejected file of unknown type: %s", QUTF8(file.filePath()));
|
||||
qDebug("Rejected file of unknown type: %s", MUTILS_UTF8(file.filePath()));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -178,7 +185,7 @@ const AudioFileModel AnalyzeTask::analyzeFile(const QString &filePath, int *type
|
||||
params << QDir::toNativeSeparators(filePath);
|
||||
|
||||
QProcess process;
|
||||
lamexp_init_process(process, QFileInfo(m_mediaInfoBin).absolutePath());
|
||||
MUtils::init_process(process, QFileInfo(m_mediaInfoBin).absolutePath());
|
||||
|
||||
process.start(m_mediaInfoBin, params);
|
||||
|
||||
@ -218,7 +225,7 @@ const AudioFileModel AnalyzeTask::analyzeFile(const QString &filePath, int *type
|
||||
QString line = QString::fromUtf8(process.readLine().constData()).simplified();
|
||||
if(!line.isEmpty())
|
||||
{
|
||||
//qDebug("Line:%s", QUTF8(line));
|
||||
//qDebug("Line:%s", MUTILS_UTF8(line));
|
||||
|
||||
int index = line.indexOf('=');
|
||||
if(index > 0)
|
||||
@ -277,7 +284,7 @@ const AudioFileModel AnalyzeTask::analyzeFile(const QString &filePath, int *type
|
||||
|
||||
void AnalyzeTask::updateInfo(AudioFileModel &audioFile, bool *skipNext, unsigned int *id_val, cover_t *coverType, QByteArray *coverData, const QString &key, const QString &value)
|
||||
{
|
||||
//qWarning("'%s' -> '%s'", QUTF8(key), QUTF8(value));
|
||||
//qWarning("'%s' -> '%s'", MUTILS_UTF8(key), MUTILS_UTF8(value));
|
||||
|
||||
/*New Stream*/
|
||||
if(IS_KEY("Gen_ID") || IS_KEY("Aud_ID"))
|
||||
@ -392,7 +399,7 @@ void AnalyzeTask::updateInfo(AudioFileModel &audioFile, bool *skipNext, unsigned
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning("Unknown key '%s' with value '%s' found!", QUTF8(key), QUTF8(value));
|
||||
qWarning("Unknown key '%s' with value '%s' found!", MUTILS_UTF8(key), MUTILS_UTF8(value));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -453,13 +460,13 @@ void AnalyzeTask::updateInfo(AudioFileModel &audioFile, bool *skipNext, unsigned
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning("Unknown key '%s' with value '%s' found!", QUTF8(key), QUTF8(value));
|
||||
qWarning("Unknown key '%s' with value '%s' found!", MUTILS_UTF8(key), MUTILS_UTF8(value));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*Section not recognized*/
|
||||
qWarning("Unknown section: %s", QUTF8(key));
|
||||
qWarning("Unknown section: %s", MUTILS_UTF8(key));
|
||||
}
|
||||
|
||||
bool AnalyzeTask::checkFile_CDDA(QFile &file)
|
||||
@ -494,7 +501,7 @@ void AnalyzeTask::retrieveCover(AudioFileModel &audioFile, cover_t coverType, co
|
||||
|
||||
if(!(QImage::fromData(coverData, extension.toUpper().toLatin1().constData()).isNull()))
|
||||
{
|
||||
QFile coverFile(QString("%1/%2.%3").arg(lamexp_temp_folder2(), lamexp_rand_str(), extension));
|
||||
QFile coverFile(QString("%1/%2.%3").arg(MUtils::temp_folder(), MUtils::rand_str(), extension));
|
||||
if(coverFile.open(QIODevice::WriteOnly))
|
||||
{
|
||||
coverFile.write(coverData);
|
||||
@ -511,7 +518,7 @@ void AnalyzeTask::retrieveCover(AudioFileModel &audioFile, cover_t coverType, co
|
||||
bool AnalyzeTask::analyzeAvisynthFile(const QString &filePath, AudioFileModel &info)
|
||||
{
|
||||
QProcess process;
|
||||
lamexp_init_process(process, QFileInfo(m_avs2wavBin).absolutePath());
|
||||
MUtils::init_process(process, QFileInfo(m_avs2wavBin).absolutePath());
|
||||
|
||||
process.start(m_avs2wavBin, QStringList() << QDir::toNativeSeparators(filePath) << "?");
|
||||
|
||||
|
@ -22,10 +22,15 @@
|
||||
|
||||
#include "Thread_Initialization.h"
|
||||
|
||||
//Internal
|
||||
#include "LockedFile.h"
|
||||
#include "Tools.h"
|
||||
#include "Tool_Abstract.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//Qt
|
||||
#include <QFileInfo>
|
||||
#include <QCoreApplication>
|
||||
#include <QProcess>
|
||||
@ -170,7 +175,7 @@ protected:
|
||||
else
|
||||
{
|
||||
qDebug("Extracting file: %s -> %s", m_toolName.toLatin1().constData(), toolShortName.toLatin1().constData());
|
||||
lockedFile = new LockedFile(m_toolResource, QString("%1/lxp_%2").arg(lamexp_temp_folder2(), toolShortName), m_toolHash);
|
||||
lockedFile = new LockedFile(m_toolResource, QString("%1/lxp_%2").arg(MUtils::temp_folder(), toolShortName), m_toolHash);
|
||||
}
|
||||
|
||||
if(lockedFile)
|
||||
@ -329,15 +334,15 @@ double InitializationThread::doInit(const size_t threadCount)
|
||||
const QByteArray toolHash(checksum.toLatin1());
|
||||
if(toolHash.size() != 96)
|
||||
{
|
||||
qFatal("The checksum for \"%s\" has an invalid size!", QUTF8(toolName));
|
||||
qFatal("The checksum for \"%s\" has an invalid size!", MUTILS_UTF8(toolName));
|
||||
return -1.0;
|
||||
}
|
||||
|
||||
QResource *resource = new QResource(QString(":/tools/%1").arg(toolName));
|
||||
if(!(resource->isValid() && resource->data()))
|
||||
{
|
||||
LAMEXP_DELETE(resource);
|
||||
qFatal("The resource for \"%s\" could not be found!", QUTF8(toolName));
|
||||
MUTILS_DELETE(resource);
|
||||
qFatal("The resource for \"%s\" could not be found!", MUTILS_UTF8(toolName));
|
||||
return -1.0;
|
||||
}
|
||||
|
||||
@ -347,7 +352,7 @@ double InitializationThread::doInit(const size_t threadCount)
|
||||
continue;
|
||||
}
|
||||
|
||||
LAMEXP_DELETE(resource);
|
||||
MUTILS_DELETE(resource);
|
||||
}
|
||||
|
||||
//Sanity Check
|
||||
@ -358,7 +363,7 @@ double InitializationThread::doInit(const size_t threadCount)
|
||||
|
||||
//Wait for extrator threads to finish
|
||||
pool->waitForDone();
|
||||
LAMEXP_DELETE(pool);
|
||||
MUTILS_DELETE(pool);
|
||||
|
||||
const long long timeExtractEnd = lamexp_perfcounter_value();
|
||||
|
||||
@ -519,7 +524,7 @@ void InitializationThread::initTranslations(void)
|
||||
{
|
||||
if(lamexp_translation_register(langId, qmFile, langName, systemId, country))
|
||||
{
|
||||
qDebug("Registering translation: %s = %s (%u) [%u]", QUTF8(qmFile), QUTF8(langName), systemId, country);
|
||||
qDebug("Registering translation: %s = %s (%u) [%u]", MUTILS_UTF8(qmFile), MUTILS_UTF8(langName), systemId, country);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -553,12 +558,12 @@ void InitializationThread::initNeroAac(void)
|
||||
{
|
||||
if(!lamexp_is_executable(neroFileInfo[i].canonicalFilePath()))
|
||||
{
|
||||
qDebug("%s executbale is invalid -> AAC encoding support will be disabled!\n", QUTF8(neroFileInfo[i].fileName()));
|
||||
qDebug("%s executbale is invalid -> AAC encoding support will be disabled!\n", MUTILS_UTF8(neroFileInfo[i].fileName()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
qDebug("Found Nero AAC encoder binary:\n%s\n", QUTF8(neroFileInfo[0].canonicalFilePath()));
|
||||
qDebug("Found Nero AAC encoder binary:\n%s\n", MUTILS_UTF8(neroFileInfo[0].canonicalFilePath()));
|
||||
|
||||
//Lock the Nero binaries
|
||||
LockedFile *neroBin[3];
|
||||
@ -573,13 +578,13 @@ void InitializationThread::initNeroAac(void)
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
for(int i = 0; i < 3; i++) LAMEXP_DELETE(neroBin[i]);
|
||||
for(int i = 0; i < 3; i++) MUTILS_DELETE(neroBin[i]);
|
||||
qWarning("Failed to get excluive lock to Nero encoder binary -> AAC encoding support will be disabled!");
|
||||
return;
|
||||
}
|
||||
|
||||
QProcess process;
|
||||
lamexp_init_process(process, neroFileInfo[0].absolutePath());
|
||||
MUtils::init_process(process, neroFileInfo[0].absolutePath());
|
||||
|
||||
process.start(neroFileInfo[0].canonicalFilePath(), QStringList() << "-help");
|
||||
|
||||
@ -589,7 +594,7 @@ void InitializationThread::initNeroAac(void)
|
||||
qWarning("Error message: \"%s\"\n", process.errorString().toLatin1().constData());
|
||||
process.kill();
|
||||
process.waitForFinished(-1);
|
||||
for(int i = 0; i < 3; i++) LAMEXP_DELETE(neroBin[i]);
|
||||
for(int i = 0; i < 3; i++) MUTILS_DELETE(neroBin[i]);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -604,7 +609,7 @@ void InitializationThread::initNeroAac(void)
|
||||
qWarning("Nero process time out -> killing!");
|
||||
process.kill();
|
||||
process.waitForFinished(-1);
|
||||
for(int i = 0; i < 3; i++) LAMEXP_DELETE(neroBin[i]);
|
||||
for(int i = 0; i < 3; i++) MUTILS_DELETE(neroBin[i]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -633,7 +638,7 @@ void InitializationThread::initNeroAac(void)
|
||||
if(!(neroVersion > 0))
|
||||
{
|
||||
qWarning("Nero AAC version could not be determined -> AAC encoding support will be disabled!");
|
||||
for(int i = 0; i < 3; i++) LAMEXP_DELETE(neroBin[i]);
|
||||
for(int i = 0; i < 3; i++) MUTILS_DELETE(neroBin[i]);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -669,8 +674,8 @@ void InitializationThread::initFhgAac(void)
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug("Found FhgAacEnc cli_exe:\n%s\n", QUTF8(fhgFileInfo[0].canonicalFilePath()));
|
||||
qDebug("Found FhgAacEnc enc_dll:\n%s\n", QUTF8(fhgFileInfo[1].canonicalFilePath()));
|
||||
qDebug("Found FhgAacEnc cli_exe:\n%s\n", MUTILS_UTF8(fhgFileInfo[0].canonicalFilePath()));
|
||||
qDebug("Found FhgAacEnc enc_dll:\n%s\n", MUTILS_UTF8(fhgFileInfo[1].canonicalFilePath()));
|
||||
|
||||
//Lock the FhgAacEnc binaries
|
||||
LockedFile *fhgBin[5];
|
||||
@ -685,13 +690,13 @@ void InitializationThread::initFhgAac(void)
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
for(int i = 0; i < 5; i++) LAMEXP_DELETE(fhgBin[i]);
|
||||
for(int i = 0; i < 5; i++) MUTILS_DELETE(fhgBin[i]);
|
||||
qWarning("Failed to get excluive lock to FhgAacEnc binary -> FhgAacEnc support will be disabled!");
|
||||
return;
|
||||
}
|
||||
|
||||
QProcess process;
|
||||
lamexp_init_process(process, fhgFileInfo[0].absolutePath());
|
||||
MUtils::init_process(process, fhgFileInfo[0].absolutePath());
|
||||
|
||||
process.start(fhgFileInfo[0].canonicalFilePath(), QStringList() << "--version");
|
||||
|
||||
@ -701,7 +706,7 @@ void InitializationThread::initFhgAac(void)
|
||||
qWarning("Error message: \"%s\"\n", process.errorString().toLatin1().constData());
|
||||
process.kill();
|
||||
process.waitForFinished(-1);
|
||||
for(int i = 0; i < 5; i++) LAMEXP_DELETE(fhgBin[i]);
|
||||
for(int i = 0; i < 5; i++) MUTILS_DELETE(fhgBin[i]);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -716,7 +721,7 @@ void InitializationThread::initFhgAac(void)
|
||||
qWarning("FhgAacEnc process time out -> killing!");
|
||||
process.kill();
|
||||
process.waitForFinished(-1);
|
||||
for(int i = 0; i < 5; i++) LAMEXP_DELETE(fhgBin[i]);
|
||||
for(int i = 0; i < 5; i++) MUTILS_DELETE(fhgBin[i]);
|
||||
return;
|
||||
}
|
||||
while(process.bytesAvailable() > 0)
|
||||
@ -734,14 +739,14 @@ void InitializationThread::initFhgAac(void)
|
||||
if(!(fhgVersion > 0))
|
||||
{
|
||||
qWarning("FhgAacEnc version couldn't be determined -> FhgAacEnc support will be disabled!");
|
||||
for(int i = 0; i < 5; i++) LAMEXP_DELETE(fhgBin[i]);
|
||||
for(int i = 0; i < 5; i++) MUTILS_DELETE(fhgBin[i]);
|
||||
return;
|
||||
}
|
||||
else if(fhgVersion < lamexp_toolver_fhgaacenc())
|
||||
{
|
||||
qWarning("FhgAacEnc version is too much outdated (%s) -> FhgAacEnc support will be disabled!", lamexp_version2string("????-??-??", fhgVersion, "N/A").toLatin1().constData());
|
||||
qWarning("Minimum required FhgAacEnc version currently is: %s\n", lamexp_version2string("????-??-??", lamexp_toolver_fhgaacenc(), "N/A").toLatin1().constData());
|
||||
for(int i = 0; i < 5; i++) LAMEXP_DELETE(fhgBin[i]);
|
||||
for(int i = 0; i < 5; i++) MUTILS_DELETE(fhgBin[i]);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -776,7 +781,7 @@ void InitializationThread::initQAac(void)
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug("Found QAAC encoder:\n%s\n", QUTF8(qaacFileInfo[0].canonicalFilePath()));
|
||||
qDebug("Found QAAC encoder:\n%s\n", MUTILS_UTF8(qaacFileInfo[0].canonicalFilePath()));
|
||||
|
||||
//Lock the required QAAC binaries
|
||||
LockedFile *qaacBin[4];
|
||||
@ -791,13 +796,13 @@ void InitializationThread::initQAac(void)
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
for(int i = 0; i < 4; i++) LAMEXP_DELETE(qaacBin[i]);
|
||||
for(int i = 0; i < 4; i++) MUTILS_DELETE(qaacBin[i]);
|
||||
qWarning("Failed to get excluive lock to QAAC binary -> QAAC support will be disabled!");
|
||||
return;
|
||||
}
|
||||
|
||||
QProcess process;
|
||||
lamexp_init_process(process, qaacFileInfo[0].absolutePath());
|
||||
MUtils::init_process(process, qaacFileInfo[0].absolutePath());
|
||||
|
||||
process.start(qaacFileInfo[0].canonicalFilePath(), QStringList() << "--check");
|
||||
|
||||
@ -807,7 +812,7 @@ void InitializationThread::initQAac(void)
|
||||
qWarning("Error message: \"%s\"\n", process.errorString().toLatin1().constData());
|
||||
process.kill();
|
||||
process.waitForFinished(-1);
|
||||
for(int i = 0; i < 4; i++) LAMEXP_DELETE(qaacBin[i]);
|
||||
for(int i = 0; i < 4; i++) MUTILS_DELETE(qaacBin[i]);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -829,7 +834,7 @@ void InitializationThread::initQAac(void)
|
||||
qWarning("QAAC process time out -> killing!");
|
||||
process.kill();
|
||||
process.waitForFinished(-1);
|
||||
for(int i = 0; i < 4; i++) LAMEXP_DELETE(qaacBin[i]);
|
||||
for(int i = 0; i < 4; i++) MUTILS_DELETE(qaacBin[i]);
|
||||
return;
|
||||
}
|
||||
while(process.bytesAvailable() > 0)
|
||||
@ -870,28 +875,28 @@ void InitializationThread::initQAac(void)
|
||||
if(!(qaacVersion > 0))
|
||||
{
|
||||
qWarning("QAAC version couldn't be determined -> QAAC support will be disabled!");
|
||||
for(int i = 0; i < 4; i++) LAMEXP_DELETE(qaacBin[i]);
|
||||
for(int i = 0; i < 4; i++) MUTILS_DELETE(qaacBin[i]);
|
||||
return;
|
||||
}
|
||||
else if(qaacVersion < lamexp_toolver_qaacenc())
|
||||
{
|
||||
qWarning("QAAC version is too much outdated (%s) -> QAAC support will be disabled!", lamexp_version2string("v?.??", qaacVersion, "N/A").toLatin1().constData());
|
||||
qWarning("Minimum required QAAC version currently is: %s.\n", lamexp_version2string("v?.??", lamexp_toolver_qaacenc(), "N/A").toLatin1().constData());
|
||||
for(int i = 0; i < 4; i++) LAMEXP_DELETE(qaacBin[i]);
|
||||
for(int i = 0; i < 4; i++) MUTILS_DELETE(qaacBin[i]);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!(coreVersion > 0))
|
||||
{
|
||||
qWarning("CoreAudioToolbox version couldn't be determined -> QAAC support will be disabled!");
|
||||
for(int i = 0; i < 4; i++) LAMEXP_DELETE(qaacBin[i]);
|
||||
for(int i = 0; i < 4; i++) MUTILS_DELETE(qaacBin[i]);
|
||||
return;
|
||||
}
|
||||
else if(coreVersion < lamexp_toolver_coreaudio())
|
||||
{
|
||||
qWarning("CoreAudioToolbox version is too much outdated (%s) -> QAAC support will be disabled!", lamexp_version2string("v?.?.?.?", coreVersion, "N/A").toLatin1().constData());
|
||||
qWarning("Minimum required CoreAudioToolbox version currently is: %s.\n", lamexp_version2string("v?.??", lamexp_toolver_coreaudio(), "N/A").toLatin1().constData());
|
||||
for(int i = 0; i < 4; i++) LAMEXP_DELETE(qaacBin[i]);
|
||||
for(int i = 0; i < 4; i++) MUTILS_DELETE(qaacBin[i]);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -937,17 +942,17 @@ void InitializationThread::selfTest(void)
|
||||
const QByteArray expectedHash = QByteArray(g_lamexp_tools[i].pcHash);
|
||||
if(g_lamexp_tools[i].uiCpuType & cpu[k])
|
||||
{
|
||||
qDebug("%02i -> %s", ++n, QUTF8(toolName));
|
||||
qDebug("%02i -> %s", ++n, MUTILS_UTF8(toolName));
|
||||
QFile resource(QString(":/tools/%1").arg(toolName));
|
||||
if(!resource.open(QIODevice::ReadOnly))
|
||||
{
|
||||
qFatal("The resource for \"%s\" could not be opened!", QUTF8(toolName));
|
||||
qFatal("The resource for \"%s\" could not be opened!", MUTILS_UTF8(toolName));
|
||||
break;
|
||||
}
|
||||
QByteArray hash = LockedFile::fileHash(resource);
|
||||
if(hash.isNull() || _stricmp(hash.constData(), expectedHash.constData()))
|
||||
{
|
||||
qFatal("Hash check for tool \"%s\" has failed!", QUTF8(toolName));
|
||||
qFatal("Hash check for tool \"%s\" has failed!", MUTILS_UTF8(toolName));
|
||||
break;
|
||||
}
|
||||
resource.close();
|
||||
|
@ -22,13 +22,19 @@
|
||||
|
||||
#include "Thread_MessageProducer.h"
|
||||
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//Qt
|
||||
#include <QStringList>
|
||||
#include <QApplication>
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
|
||||
//CRT
|
||||
#include <limits.h>
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -70,7 +76,7 @@ void MessageProducerThread::run()
|
||||
QFileInfo file = QFileInfo(arguments[++i]);
|
||||
if(file.exists() && file.isFile())
|
||||
{
|
||||
lamexp_ipc_send(1, QUTF8(file.canonicalFilePath()));
|
||||
lamexp_ipc_send(1, MUTILS_UTF8(file.canonicalFilePath()));
|
||||
}
|
||||
bSentFiles = true;
|
||||
}
|
||||
@ -79,7 +85,7 @@ void MessageProducerThread::run()
|
||||
QDir dir = QDir(arguments[++i]);
|
||||
if(dir.exists())
|
||||
{
|
||||
lamexp_ipc_send(2, QUTF8(dir.canonicalPath()));
|
||||
lamexp_ipc_send(2, MUTILS_UTF8(dir.canonicalPath()));
|
||||
}
|
||||
bSentFiles = true;
|
||||
}
|
||||
@ -88,7 +94,7 @@ void MessageProducerThread::run()
|
||||
QDir dir = QDir(arguments[++i]);
|
||||
if(dir.exists())
|
||||
{
|
||||
lamexp_ipc_send(3, QUTF8(dir.canonicalPath()));
|
||||
lamexp_ipc_send(3, MUTILS_UTF8(dir.canonicalPath()));
|
||||
}
|
||||
bSentFiles = true;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "Thread_Process.h"
|
||||
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
#include "Model_AudioFile.h"
|
||||
#include "Model_Progress.h"
|
||||
@ -34,6 +35,11 @@
|
||||
#include "Registry_Decoder.h"
|
||||
#include "Model_Settings.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
#include <MUtils/Version.h>
|
||||
|
||||
//Qt
|
||||
#include <QUuid>
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
@ -42,6 +48,7 @@
|
||||
#include <QDate>
|
||||
#include <QThreadPool>
|
||||
|
||||
//CRT
|
||||
#include <limits.h>
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
@ -81,7 +88,7 @@ ProcessThread::~ProcessThread(void)
|
||||
{
|
||||
while(!m_tempFiles.isEmpty())
|
||||
{
|
||||
lamexp_remove_file(m_tempFiles.takeFirst());
|
||||
MUtils::remove_file(m_tempFiles.takeFirst());
|
||||
}
|
||||
|
||||
while(!m_filters.isEmpty())
|
||||
@ -89,8 +96,8 @@ ProcessThread::~ProcessThread(void)
|
||||
delete m_filters.takeFirst();
|
||||
}
|
||||
|
||||
LAMEXP_DELETE(m_encoder);
|
||||
LAMEXP_DELETE(m_propDetect);
|
||||
MUTILS_DELETE(m_encoder);
|
||||
MUTILS_DELETE(m_propDetect);
|
||||
|
||||
emit processFinished();
|
||||
}
|
||||
@ -110,7 +117,7 @@ bool ProcessThread::init(void)
|
||||
emit processStateInitialized(m_jobId, QFileInfo(m_audioFile.filePath()).fileName(), tr("Starting..."), ProgressModel::JobRunning);
|
||||
|
||||
//Initialize log
|
||||
handleMessage(QString().sprintf("LameXP v%u.%02u (Build #%u), compiled on %s at %s", lamexp_version_major(), lamexp_version_minor(), lamexp_version_build(), lamexp_version_date().toString(Qt::ISODate).toLatin1().constData(), lamexp_version_time()));
|
||||
handleMessage(QString().sprintf("LameXP v%u.%02u (Build #%u), compiled on %s at %s", lamexp_version_major(), lamexp_version_minor(), lamexp_version_build(), MUtils::Version::build_date().toString(Qt::ISODate).toLatin1().constData(), MUtils::Version::build_time()));
|
||||
handleMessage("\n-------------------------------\n");
|
||||
|
||||
return true;
|
||||
@ -219,7 +226,7 @@ void ProcessThread::processFile()
|
||||
connect(decoder, SIGNAL(messageLogged(QString)), this, SLOT(handleMessage(QString)), Qt::DirectConnection);
|
||||
|
||||
bSuccess = decoder->decode(sourceFile, tempFile, &m_aborted);
|
||||
LAMEXP_DELETE(decoder);
|
||||
MUTILS_DELETE(decoder);
|
||||
|
||||
if(bSuccess)
|
||||
{
|
||||
@ -417,7 +424,7 @@ int ProcessThread::generateOutFileName(QString &outFileName)
|
||||
}
|
||||
|
||||
//Make sure that the output dir is writable
|
||||
QFile writeTest(QString("%1/.%2").arg(targetDir.canonicalPath(), lamexp_rand_str()));
|
||||
QFile writeTest(QString("%1/.%2").arg(targetDir.canonicalPath(), MUtils::rand_str()));
|
||||
if(!writeTest.open(QIODevice::ReadWrite))
|
||||
{
|
||||
handleMessage(QString("%1\n%2").arg(tr("The target output directory is NOT writable:"), QDir::toNativeSeparators(targetDir.absolutePath())));
|
||||
@ -504,7 +511,7 @@ QString ProcessThread::generateTempFileName(void)
|
||||
|
||||
for(int i = 0; i < 4096; i++)
|
||||
{
|
||||
tempFileName = QString("%1/%2.wav").arg(m_tempDirectory, lamexp_rand_str());
|
||||
tempFileName = QString("%1/%2.wav").arg(m_tempDirectory, MUtils::rand_str());
|
||||
if(m_tempFiles.contains(tempFileName, Qt::CaseInsensitive) || QFileInfo(tempFileName).exists())
|
||||
{
|
||||
continue;
|
||||
|
@ -22,9 +22,14 @@
|
||||
|
||||
#include "Tool_Abstract.h"
|
||||
|
||||
//Internal
|
||||
#include "Global.h"
|
||||
#include "JobObject.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
|
||||
//Qt
|
||||
#include <QProcess>
|
||||
#include <QMutex>
|
||||
#include <QMutexLocker>
|
||||
@ -78,7 +83,7 @@ AbstractTool::~AbstractTool(void)
|
||||
s_jobObjRefCount--;
|
||||
if(s_jobObjRefCount < 1U)
|
||||
{
|
||||
LAMEXP_DELETE(s_jobObject);
|
||||
MUTILS_DELETE(s_jobObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -96,7 +101,7 @@ bool AbstractTool::startProcess(QProcess &process, const QString &program, const
|
||||
}
|
||||
|
||||
emit messageLogged(commandline2string(program, args) + "\n");
|
||||
lamexp_init_process(process, QFileInfo(program).absolutePath());
|
||||
MUtils::init_process(process, QFileInfo(program).absolutePath());
|
||||
|
||||
process.start(program, args);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user