#include "Dialog_MainWindow.h"
//UIC includes
-#include "../tmp/UIC_MainWindow.h"
+#include "UIC_MainWindow.h"
//LameXP includes
#include "Global.h"
#include "ShellIntegration.h"
#include "CustomEventFilter.h"
+//Mutils includes
+#include <MUtils/Global.h>
+#include <MUtils/OSSupport.h>
+#include <MUtils/GUI.h>
+#include <MUtils/Version.h>
+
//Qt includes
#include <QMessageBox>
#include <QTimer>
{ \
QItemSelectionModel *_tmp = (VIEW)->selectionModel(); \
(VIEW)->setModel(MODEL); \
- LAMEXP_DELETE(_tmp); \
+ MUTILS_DELETE(_tmp); \
} \
while(0)
#define FSLINK(PATH) QString("<a href=\"file:///%1\">%2</a>").arg(PATH).arg(QString(PATH).replace("-", "−"))
#define CENTER_CURRENT_OUTPUT_FOLDER_DELAYED QTimer::singleShot(125, this, SLOT(centerOutputFolderModel()))
-//#define USE_NATIVE_FILE_DIALOG (lamexp_themes_enabled() || ((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) < QSysInfo::WV_XP))
-
static const unsigned int IDM_ABOUTBOX = 0xEFF0;
+static const char *g_hydrogen_audio_url = "http://wiki.hydrogenaud.io/index.php?title=Main_Page";
////////////////////////////////////////////////////////////
// Constructor
ui->comboBoxAftenCodingMode->setCurrentIndex(m_settings->aftenAudioCodingMode());
ui->comboBoxAftenDRCMode->setCurrentIndex(m_settings->aftenDynamicRangeCompression());
ui->comboBoxNormalizationMode->setCurrentIndex(m_settings->normalizationFilterEQMode());
- //comboBoxOpusOptimize->setCurrentIndex(m_settings->opusOptimizeFor());
ui->comboBoxOpusFramesize->setCurrentIndex(m_settings->opusFramesize());
SET_CHECKBOX_STATE(ui->checkBoxBitrateManagement, m_settings->bitrateManagementEnabled());
connect(ui->actionImportCueSheet, SIGNAL(triggered(bool)), this, SLOT(importCueSheetActionTriggered(bool)));
//Activate help menu actions
- ui->actionVisitHomepage->setData(QString::fromLatin1(lamexp_website_url()));
- ui->actionVisitSupport->setData(QString::fromLatin1(lamexp_support_url()));
- ui->actionVisitMuldersSite->setData(QString::fromLatin1(lamexp_mulders_url()));
- ui->actionDocumentFAQ->setData(QString("%1/FAQ.html").arg(QApplication::applicationDirPath()));
+ ui->actionVisitHomepage ->setData(QString::fromLatin1(lamexp_website_url()));
+ ui->actionVisitSupport ->setData(QString::fromLatin1(lamexp_support_url()));
+ ui->actionVisitMuldersSite ->setData(QString::fromLatin1(lamexp_mulders_url()));
+ ui->actionVisitTracker ->setData(QString::fromLatin1(lamexp_tracker_url()));
+ ui->actionVisitHAK ->setData(QString::fromLatin1(g_hydrogen_audio_url));
+ ui->actionDocumentFAQ ->setData(QString("%1/FAQ.html").arg(QApplication::applicationDirPath()));
ui->actionDocumentChangelog->setData(QString("%1/Changelog.html").arg(QApplication::applicationDirPath()));
ui->actionDocumentTranslate->setData(QString("%1/Translate.html").arg(QApplication::applicationDirPath()));
- connect(ui->actionCheckUpdates, SIGNAL(triggered()), this, SLOT(checkUpdatesActionActivated()));
- connect(ui->actionVisitHomepage, SIGNAL(triggered()), this, SLOT(visitHomepageActionActivated()));
- connect(ui->actionVisitMuldersSite, SIGNAL(triggered()), this, SLOT(visitHomepageActionActivated()));
- connect(ui->actionVisitSupport, SIGNAL(triggered()), this, SLOT(visitHomepageActionActivated()));
- connect(ui->actionDocumentFAQ, SIGNAL(triggered()), this, SLOT(documentActionActivated()));
+ connect(ui->actionCheckUpdates, SIGNAL(triggered()), this, SLOT(checkUpdatesActionActivated()));
+ connect(ui->actionVisitSupport, SIGNAL(triggered()), this, SLOT(visitHomepageActionActivated()));
+ connect(ui->actionVisitTracker, SIGNAL(triggered()), this, SLOT(visitHomepageActionActivated()));
+ connect(ui->actionVisitHomepage, SIGNAL(triggered()), this, SLOT(visitHomepageActionActivated()));
+ connect(ui->actionVisitMuldersSite, SIGNAL(triggered()), this, SLOT(visitHomepageActionActivated()));
+ connect(ui->actionVisitHAK, SIGNAL(triggered()), this, SLOT(visitHomepageActionActivated()));
+ connect(ui->actionDocumentFAQ, SIGNAL(triggered()), this, SLOT(documentActionActivated()));
connect(ui->actionDocumentChangelog, SIGNAL(triggered()), this, SLOT(documentActionActivated()));
connect(ui->actionDocumentTranslate, SIGNAL(triggered()), this, SLOT(documentActionActivated()));
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)
}
//Un-initialize the dialog
- LAMEXP_DELETE(ui);
+ MUTILS_DELETE(ui);
}
////////////////////////////////////////////////////////////
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();
}
bReadyToInstall = updateDialog->updateReadyToInstall();
}
- LAMEXP_DELETE(updateDialog);
+ MUTILS_DELETE(updateDialog);
return bReadyToInstall;
}
QAction *currentItem = folderList.takeFirst();
if(currentItem->isSeparator()) break;
m_outputFolderFavoritesMenu->removeAction(currentItem);
- LAMEXP_DELETE(currentItem);
+ MUTILS_DELETE(currentItem);
}
QAction *lastItem = m_outputFolderFavoritesMenu->actions().first();
ui->comboBoxOpusFramesize->setCurrentIndex(comboBoxIndex[7]);
//Update the window title
- if(LAMEXP_DEBUG)
+ if(MUTILS_DEBUG)
{
setWindowTitle(QString("%1 [!!! DEBUG BUILD !!!]").arg(windowTitle()));
}
{
switch(e->type())
{
- case lamexp_event_queryendsession:
+ case MUtils::GUI::USER_EVENT_QUERYENDSESSION:
qWarning("System is shutting down, main window prepares to close...");
if(BANNER_VISIBLE) m_banner->close();
if(m_delayedFileTimer->isActive()) m_delayedFileTimer->stop();
return true;
- case lamexp_event_endsession:
+ case MUtils::GUI::USER_EVENT_ENDSESSION:
qWarning("System is shutting down, main window will close now...");
if(isVisible())
{
*/
void MainWindow::windowShown(void)
{
- const QStringList &arguments = lamexp_arguments(); //QApplication::arguments();
+ const QStringList &arguments = MUtils::OS::arguments(); //QApplication::arguments();
//Force resize event
resizeEvent(NULL);
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)
//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);
}
//Update reminder
- if(lamexp_current_date_safe() >= lamexp_version_date().addYears(1))
+ if(MUtils::OS::current_date() >= MUtils::Version::app_build_date().addYears(1))
{
qWarning("Binary is more than a year old, time to update!");
SHOW_CORNER_WIDGET(true);
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())
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())
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);
}
}
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);
}
// =========================================================
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)
switch(QMessageBox::warning(this, tr("Low Diskspace Warning"), lowDiskspaceMsg, tr("Abort Encoding Process"), tr("Clean Disk Now"), tr("Ignore")))
{
case 1:
- QProcess::startDetached(QString("%1/cleanmgr.exe").arg(lamexp_known_folder(lamexp_folder_systemfolder)), QStringList() << "/D" << tempFolderParts.first());
+ QProcess::startDetached(QString("%1/cleanmgr.exe").arg(MUtils::OS::known_folder(MUtils::OS::FOLDER_SYSTEMFOLDER)), QStringList() << "/D" << tempFolderParts.first());
case 0:
return;
break;
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!")));
(
AboutDialog *aboutBox = new AboutDialog(m_settings, this);
aboutBox->exec();
- LAMEXP_DELETE(aboutBox);
+ MUTILS_DELETE(aboutBox);
);
}
if(QEvent *e = new QEvent(QEvent::LanguageChange))
{
changeEvent(e);
- LAMEXP_DELETE(e);
+ MUTILS_DELETE(e);
}
//Make transparent
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)
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());
if(!iResult) break;
}
- LAMEXP_DELETE(metaInfoDialog);
+ MUTILS_DELETE(metaInfoDialog);
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
sourceFilesScrollbarMoved(0);
}
{
QString systemRootPath;
- QDir systemRoot(lamexp_known_folder(lamexp_folder_systemfolder));
+ QDir systemRoot(MUtils::OS::known_folder(MUtils::OS::FOLDER_SYSTEMFOLDER));
if(systemRoot.exists() && systemRoot.cdUp())
{
systemRootPath = systemRoot.canonicalPath();
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)
{
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()));
}
}
if(m_fileSystemModel)
{
SET_MODEL(ui->outputFolderView, NULL);
- LAMEXP_DELETE(m_fileSystemModel);
+ MUTILS_DELETE(m_fileSystemModel);
ui->outputFolderView->repaint();
}
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();
}
QProcess process;
- lamexp_init_process(process, QFileInfo(binary).absolutePath());
+ MUtils::init_process(process, QFileInfo(binary).absolutePath());
process.start(binary, command.isEmpty() ? QStringList() : QStringList() << command);
LogViewDialog *dialog = new LogViewDialog(this);
TEMP_HIDE_DROPBOX( dialog->exec(output); );
- LAMEXP_DELETE(dialog);
+ MUTILS_DELETE(dialog);
}
void MainWindow::overwriteModeChanged(int id)
{
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);
}