#include "Dialog_MetaInfo.h"
#include "Dialog_About.h"
#include "Dialog_Update.h"
+#include "Dialog_DropBox.h"
#include "Thread_FileAnalyzer.h"
#include "Thread_MessageHandler.h"
#include "Model_MetaInfo.h"
#include "Model_FileList.h"
#include "Model_FileSystem.h"
#include "WinSevenTaskbar.h"
+#include "Registry_Decoder.h"
//Qt includes
#include <QMessageBox>
#include <QUuid>
#include <QProcessEnvironment>
#include <QCryptographicHash>
+#include <QTranslator>
+#include <QResource>
//Win32 includes
#include <Windows.h>
#define ABORT_IF_BUSY if(m_banner->isVisible() || m_delayedFileTimer->isActive()) { MessageBeep(MB_ICONEXCLAMATION); return; }
#define SET_TEXT_COLOR(WIDGET,COLOR) { QPalette _palette = WIDGET->palette(); _palette.setColor(QPalette::WindowText, COLOR); WIDGET->setPalette(_palette); }
#define SET_FONT_BOLD(WIDGET,BOLD) { QFont _font = WIDGET->font(); _font.setBold(BOLD); WIDGET->setFont(_font); }
+#define FLASH_WINDOW(WND) { FLASHWINFO flashInfo; memset(&flashInfo, 0, sizeof(FLASHWINFO)); flashInfo.cbSize = sizeof(FLASHWINFO); flashInfo.dwFlags = FLASHW_ALL; flashInfo.uCount = 12; flashInfo.dwTimeout = 125; flashInfo.hwnd = WND->winId(); FlashWindowEx(&flashInfo); }
#define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(URL)
//Helper class
//Register meta types
qRegisterMetaType<AudioFileModel>("AudioFileModel");
- //Update window title
- if(lamexp_version_demo())
- {
- setWindowTitle(windowTitle().append(" [DEMO VERSION]"));
- }
-
//Enabled main buttons
connect(buttonAbout, SIGNAL(clicked()), this, SLOT(aboutButtonClicked()));
connect(buttonStart, SIGNAL(clicked()), this, SLOT(encodeButtonClicked()));
sourceFileView->setContextMenuPolicy(Qt::CustomContextMenu);
m_dropNoteLabel = new QLabel(sourceFileView);
m_dropNoteLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
- m_dropNoteLabel->setText("» You can drop in audio files here! «");
SET_FONT_BOLD(m_dropNoteLabel, true);
SET_TEXT_COLOR(m_dropNoteLabel, Qt::darkGray);
m_sourceFilesContextMenu = new QMenu();
- QAction *showDetailsContextAction = m_sourceFilesContextMenu->addAction(QIcon(":/icons/zoom.png"), "Show Details");
- QAction *previewContextAction = m_sourceFilesContextMenu->addAction(QIcon(":/icons/sound.png"), "Open File in External Application");
- QAction *findFileContextAction = m_sourceFilesContextMenu->addAction(QIcon(":/icons/folder_go.png"), "Browse File Location");
- SET_FONT_BOLD(showDetailsContextAction, true);
+ m_showDetailsContextAction = m_sourceFilesContextMenu->addAction(QIcon(":/icons/zoom.png"), "N/A");
+ m_previewContextAction = m_sourceFilesContextMenu->addAction(QIcon(":/icons/sound.png"), "N/A");
+ m_findFileContextAction = m_sourceFilesContextMenu->addAction(QIcon(":/icons/folder_go.png"), "N/A");
+ SET_FONT_BOLD(m_showDetailsContextAction, true);
connect(buttonAddFiles, SIGNAL(clicked()), this, SLOT(addFilesButtonClicked()));
connect(buttonRemoveFile, SIGNAL(clicked()), this, SLOT(removeFileButtonClicked()));
connect(buttonClearFiles, SIGNAL(clicked()), this, SLOT(clearFilesButtonClicked()));
connect(m_fileListModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(sourceModelChanged()));
connect(m_fileListModel, SIGNAL(modelReset()), this, SLOT(sourceModelChanged()));
connect(sourceFileView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(sourceFilesContextMenu(QPoint)));
- connect(showDetailsContextAction, SIGNAL(triggered(bool)), this, SLOT(showDetailsButtonClicked()));
- connect(previewContextAction, SIGNAL(triggered(bool)), this, SLOT(previewContextActionTriggered()));
- connect(findFileContextAction, SIGNAL(triggered(bool)), this, SLOT(findFileContextActionTriggered()));
+ connect(m_showDetailsContextAction, SIGNAL(triggered(bool)), this, SLOT(showDetailsButtonClicked()));
+ connect(m_previewContextAction, SIGNAL(triggered(bool)), this, SLOT(previewContextActionTriggered()));
+ connect(m_findFileContextAction, SIGNAL(triggered(bool)), this, SLOT(findFileContextActionTriggered()));
//Setup "Output" tab
m_fileSystemModel = new QFileSystemModelEx();
outputFolderView->header()->hideSection(3);
outputFolderView->setHeaderHidden(true);
outputFolderView->setAnimated(true);
- outputFolderView->installEventFilter(this);
outputFolderView->setMouseTracking(false);
outputFolderView->setContextMenuPolicy(Qt::CustomContextMenu);
while(saveToSourceFolderCheckBox->isChecked() != m_settings->outputToSourceDir()) saveToSourceFolderCheckBox->click();
prependRelativePathCheckBox->setChecked(m_settings->prependRelativeSourcePath());
connect(outputFolderView, SIGNAL(clicked(QModelIndex)), this, SLOT(outputFolderViewClicked(QModelIndex)));
connect(outputFolderView, SIGNAL(activated(QModelIndex)), this, SLOT(outputFolderViewClicked(QModelIndex)));
- connect(outputFolderView, SIGNAL(entered(QModelIndex)), this, SLOT(outputFolderViewClicked(QModelIndex)));
+ connect(outputFolderView, SIGNAL(pressed(QModelIndex)), this, SLOT(outputFolderViewClicked(QModelIndex)));
+ connect(outputFolderView, SIGNAL(entered(QModelIndex)), this, SLOT(outputFolderViewMoved(QModelIndex)));
outputFolderView->setCurrentIndex(m_fileSystemModel->index(m_settings->outputDir()));
outputFolderViewClicked(outputFolderView->currentIndex());
connect(buttonMakeFolder, SIGNAL(clicked()), this, SLOT(makeFolderButtonClicked()));
connect(saveToSourceFolderCheckBox, SIGNAL(clicked()), this, SLOT(saveToSourceFolderChanged()));
connect(prependRelativePathCheckBox, SIGNAL(clicked()), this, SLOT(prependRelativePathChanged()));
m_outputFolderContextMenu = new QMenu();
- QAction *showFolderContextAction = m_outputFolderContextMenu->addAction(QIcon(":/icons/zoom.png"), "Browse Selected Folder");
+ m_showFolderContextAction = m_outputFolderContextMenu->addAction(QIcon(":/icons/zoom.png"), "N/A");
connect(outputFolderView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(outputFolderContextMenu(QPoint)));
- connect(showFolderContextAction, SIGNAL(triggered(bool)), this, SLOT(showFolderContextActionTriggered()));
+ connect(m_showFolderContextAction, SIGNAL(triggered(bool)), this, SLOT(showFolderContextActionTriggered()));
+ outputFolderLabel->installEventFilter(this);
//Setup "Meta Data" tab
m_metaInfoModel = new MetaInfoModel(m_metaData, 6);
connect(m_styleActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(styleActionActivated(QAction*)));
styleActionActivated(NULL);
+ //Populate the language menu
+ m_languageActionGroup = new QActionGroup(this);
+ connect(m_languageActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(languageActionActivated(QAction*)));
+ QStringList translations = lamexp_query_translations();
+ while(!translations.isEmpty())
+ {
+ QString langId = translations.takeFirst();
+ QAction *currentLanguage = new QAction(this);
+ currentLanguage->setData(langId);
+ currentLanguage->setText(lamexp_translation_name(langId));
+ currentLanguage->setIcon(QIcon(QString(":/flags/%1.png").arg(langId)));
+ currentLanguage->setCheckable(true);
+ m_languageActionGroup->addAction(currentLanguage);
+ menuLanguage->addAction(currentLanguage);
+ }
+
//Activate tools menu actions
actionDisableUpdateReminder->setChecked(!m_settings->autoUpdateEnabled());
actionDisableSounds->setChecked(!m_settings->soundsEnabled());
+ actionDisableNeroAacNotifications->setChecked(!m_settings->neroAacNotificationsEnabled());
+ actionDisableWmaDecoderNotifications->setChecked(!m_settings->wmaDecoderNotificationsEnabled());
connect(actionDisableUpdateReminder, SIGNAL(triggered(bool)), this, SLOT(disableUpdateReminderActionTriggered(bool)));
connect(actionDisableSounds, SIGNAL(triggered(bool)), this, SLOT(disableSoundsActionTriggered(bool)));
connect(actionInstallWMADecoder, SIGNAL(triggered(bool)), this, SLOT(installWMADecoderActionTriggered(bool)));
+ connect(actionDisableNeroAacNotifications, SIGNAL(triggered(bool)), this, SLOT(disableNeroAacNotificationsActionTriggered(bool)));
+ connect(actionDisableWmaDecoderNotifications, SIGNAL(triggered(bool)), this, SLOT(disableWmaDecoderNotificationsActionTriggered(bool)));
+ connect(actionShowDropBoxWidget, SIGNAL(triggered(bool)), this, SLOT(showDropBoxWidgetActionTriggered(bool)));
//Activate help menu actions
connect(actionCheckUpdates, SIGNAL(triggered()), this, SLOT(checkUpdatesActionActivated()));
//Create banner
m_banner = new WorkingBanner(this);
+ //Create DropBox widget
+ m_dropBox = new DropBox(this, m_fileListModel, m_settings);
+ connect(m_fileListModel, SIGNAL(modelReset()), m_dropBox, SLOT(modelChanged()));
+ connect(m_fileListModel, SIGNAL(rowsInserted(QModelIndex,int,int)), m_dropBox, SLOT(modelChanged()));
+ connect(m_fileListModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), m_dropBox, SLOT(modelChanged()));
+
//Create message handler thread
m_messageHandler = new MessageHandlerThread();
m_delayedFileList = new QStringList();
connect(m_delayedFileTimer, SIGNAL(timeout()), this, SLOT(handleDelayedFiles()));
m_messageHandler->start();
+ //Load translation & re-translate UI
+ QList<QAction*> languageActions = m_languageActionGroup->actions();
+ while(!languageActions.isEmpty())
+ {
+ QAction *currentLanguage = languageActions.takeFirst();
+ if(currentLanguage->data().toString().compare(m_settings->currentLanguage(), Qt::CaseInsensitive) == 0)
+ {
+ currentLanguage->setChecked(true);
+ languageActionActivated(currentLanguage);
+ }
+ }
+ if(m_languageActionGroup->checkedAction() == NULL)
+ {
+ qWarning("No langauge is currently selected, going to select FIRST one!");
+ m_languageActionGroup->actions().first()->setChecked(true);
+ languageActionActivated(m_languageActionGroup->actions().first());
+ }
+
//Enable Drag & Drop
this->setAcceptDrops(true);
}
//Unset models
sourceFileView->setModel(NULL);
metaDataView->setModel(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_encoderButtonGroup);
LAMEXP_DELETE(m_encoderButtonGroup);
LAMEXP_DELETE(m_sourceFilesContextMenu);
+ LAMEXP_DELETE(m_dropBox);
+
}
////////////////////////////////////////////////////////////
// PRIVATE FUNCTIONS
////////////////////////////////////////////////////////////
+/*
+ * Add file to source list
+ */
void MainWindow::addFiles(const QStringList &files)
{
if(files.isEmpty())
connect(analyzer, SIGNAL(fileSelected(QString)), m_banner, SLOT(setText(QString)), Qt::QueuedConnection);
connect(analyzer, SIGNAL(fileAnalyzed(AudioFileModel)), m_fileListModel, SLOT(addFile(AudioFileModel)), Qt::QueuedConnection);
- m_banner->show("Adding file(s), please wait...", analyzer);
+ m_banner->show(tr("Adding file(s), please wait..."), analyzer);
if(analyzer->filesDenied())
{
- QMessageBox::warning(this, "Access Denied", QString("<nobr>%1 file(s) have been rejected, because read access was not granted!<br>This usually means the file is locked by another process.</nobr>").arg(analyzer->filesDenied()));
+ QMessageBox::warning(this, tr("Access Denied"), QString("<nobr>%1<br>%2</nobr>").arg(tr("%1 file(s) have been rejected, because read access was not granted!").arg(analyzer->filesDenied()), tr("This usually means the file is locked by another process.")));
}
if(analyzer->filesRejected())
{
- QMessageBox::warning(this, "Files Rejected", QString("<nobr>%1 file(s) have been rejected, because the file format could not be recognized!<br>This usually means the file is damaged or the file format is not supported.</nobr>").arg(analyzer->filesRejected()));
+ QMessageBox::warning(this, tr("Files Rejected"), QString("<nobr>%1<br>%2</nobr>").arg(tr("%1 file(s) have been rejected, because the file format could not be recognized!").arg(analyzer->filesRejected()), tr("This usually means the file is damaged or the file format is not supported.")));
}
LAMEXP_DELETE(analyzer);
// EVENTS
////////////////////////////////////////////////////////////
+/*
+ * Window is about to be shown
+ */
void MainWindow::showEvent(QShowEvent *event)
{
m_accepted = false;
m_firstTimeShown = false;
QTimer::singleShot(0, this, SLOT(windowShown()));
}
+ else
+ {
+ if(m_settings->dropBoxWidgetEnabled())
+ {
+ m_dropBox->setVisible(true);
+ }
+ }
+}
+
+/*
+ * Re-translate the UI
+ */
+void MainWindow::changeEvent(QEvent *e)
+{
+ if(e->type() == QEvent::LanguageChange)
+ {
+ Ui::MainWindow::retranslateUi(this);
+
+ if(lamexp_version_demo())
+ {
+ setWindowTitle(QString("%1 [%2]").arg(windowTitle(), tr("DEMO VERSION")));
+ }
+
+ m_dropNoteLabel->setText(QString("» %1 «").arg(tr("You can drop in audio files here!")));
+ m_showDetailsContextAction->setText(tr("Show Details"));
+ m_previewContextAction->setText(tr("Open File in External Application"));
+ m_findFileContextAction->setText(tr("Browse File Location"));
+ m_showFolderContextAction->setText(tr("Browse Selected Folder"));
+ }
}
+/*
+ * File dragged over window
+ */
void MainWindow::dragEnterEvent(QDragEnterEvent *event)
{
QStringList formats = event->mimeData()->formats();
}
}
+/*
+ * File dropped onto window
+ */
void MainWindow::dropEvent(QDropEvent *event)
{
ABORT_IF_BUSY;
addFiles(droppedFiles);
}
+/*
+ * Window tries to close
+ */
void MainWindow::closeEvent(QCloseEvent *event)
{
if(m_banner->isVisible() || m_delayedFileTimer->isActive())
MessageBeep(MB_ICONEXCLAMATION);
event->ignore();
}
+
+ if(m_dropBox)
+ {
+ m_dropBox->hide();
+ }
}
+/*
+ * Window was resized
+ */
void MainWindow::resizeEvent(QResizeEvent *event)
{
QMainWindow::resizeEvent(event);
m_dropNoteLabel->setGeometry(0, 0, sourceFileView->width(), sourceFileView->height());
}
+/*
+ * Event filter
+ */
bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
if(obj == m_fileSystemModel && QApplication::overrideCursor() == NULL)
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
QTimer::singleShot(250, this, SLOT(restoreCursor()));
}
- else if(obj == outputFolderView && (event->type() == QEvent::KeyRelease || event->type() == QEvent::KeyPress))
+ else if(obj == outputFolderLabel)
{
- outputFolderViewClicked(outputFolderView->currentIndex());
+ switch(event->type())
+ {
+ case QEvent::MouseButtonPress:
+ if(dynamic_cast<QMouseEvent*>(event)->button() == Qt::LeftButton)
+ {
+ QDesktopServices::openUrl(QString("file:///%1").arg(outputFolderLabel->text()));
+ }
+ break;
+ case QEvent::Enter:
+ outputFolderLabel->setForegroundRole(QPalette::Link);
+ break;
+ case QEvent::Leave:
+ outputFolderLabel->setForegroundRole(QPalette::WindowText);
+ break;
+ }
}
return false;
}
if(iAccepted <= 0)
{
m_settings->licenseAccepted(-1);
- QMessageBox::critical(this, "License Declined", "You have declined the license. Consequently the application will exit now!");
+ QApplication::processEvents();
+ PlaySound(MAKEINTRESOURCE(IDR_WAVE_WHAMMY), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC);
+ QMessageBox::critical(this, tr("License Declined"), tr("You have declined the license. Consequently the application will exit now!"), tr("Goodbye!"));
+ QProcess::startDetached(QString("%1/Uninstall.exe").arg(QApplication::applicationDirPath()), QStringList());
QApplication::quit();
return;
}
-
+
+ PlaySound(MAKEINTRESOURCE(IDR_WAVE_WOOHOO), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC);
m_settings->licenseAccepted(1);
}
if(QDate::currentDate() >= expireDate)
{
qWarning("Binary has expired !!!");
- if(QMessageBox::warning(this, "LameXP - Expired", QString("This demo (pre-release) version of LameXP has expired at %1.\nLameXP is free software and release versions won't expire.").arg(expireDate.toString(Qt::ISODate)), "Check for Updates", "Exit Program") == 0)
+ PlaySound(MAKEINTRESOURCE(IDR_WAVE_WHAMMY), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC);
+ if(QMessageBox::warning(this, tr("LameXP - Expired"), tr("This demo (pre-release) version of LameXP has expired at %1.\nLameXP is free software and release versions won't expire.").arg(expireDate.toString(Qt::ISODate)), tr("Check for Updates"), tr("Exit Program")) == 0)
{
checkUpdatesActionActivated();
}
if(QDate::currentDate() >= lamexp_version_date().addYears(1))
{
qWarning("Binary is more than a year old, time to update!");
- if(QMessageBox::warning(this, "Urgent Update", "Your version of LameXP is more than a year old. Time for an update!", "Check for Updates", "Exit Program") == 0)
+ if(QMessageBox::warning(this, tr("Urgent Update"), tr("Your version of LameXP is more than a year old. Time for an update!"), tr("Check for Updates"), tr("Exit Program")) == 0)
{
checkUpdatesActionActivated();
}
QDate lastUpdateCheck = QDate::fromString(m_settings->autoUpdateLastCheck(), Qt::ISODate);
if(!lastUpdateCheck.isValid() || QDate::currentDate() >= lastUpdateCheck.addDays(14))
{
- if(QMessageBox::information(this, "Update Reminer", (lastUpdateCheck.isValid() ? "Your last update check was more than 14 days ago. Check for updates now?" : "Your did not check for LameXP updates yet. Check for updates now?"), "Check for Updates", "Defer") == 0)
+ if(QMessageBox::information(this, tr("Update Reminer"), (lastUpdateCheck.isValid() ? tr("Your last update check was more than 14 days ago. Check for updates now?") : tr("Your did not check for LameXP updates yet. Check for updates now?")), tr("Check for Updates"), tr("Postpone")) == 0)
{
checkUpdatesActionActivated();
}
}
//Check for AAC support
- if(lamexp_check_tool("neroAacEnc.exe") && lamexp_check_tool("neroAacDec.exe") && lamexp_check_tool("neroAacTag.exe"))
+ if(m_settings->neroAacNotificationsEnabled())
{
- if(lamexp_tool_version("neroAacEnc.exe") < lamexp_toolver_neroaac())
+ if(lamexp_check_tool("neroAacEnc.exe") && lamexp_check_tool("neroAacDec.exe") && lamexp_check_tool("neroAacTag.exe"))
{
+ if(lamexp_tool_version("neroAacEnc.exe") < lamexp_toolver_neroaac())
+ {
+ QString messageText;
+ messageText += QString("<nobr>%1<br>").arg(tr("LameXP detected that your version of the Nero AAC encoder is outdated!"));
+ messageText += QString("%1<br><br>").arg(tr("The current version available is %1 (or later), but you still have version %2 installed.").arg(lamexp_version2string("?.?.?.?", lamexp_toolver_neroaac()), lamexp_version2string("?.?.?.?", lamexp_tool_version("neroAacEnc.exe"))));
+ messageText += QString("%1<br>").arg(tr("You can download the latest version of the Nero AAC encoder from the Nero website at:"));
+ messageText += "<b>" + LINK(AboutDialog::neroAacUrl) + "</b><br></nobr>";
+ QMessageBox::information(this, tr("AAC Encoder Outdated"), messageText);
+ }
+ }
+ else
+ {
+ radioButtonEncoderAAC->setEnabled(false);
QString messageText;
- messageText += "<nobr>LameXP detected that your version of the Nero AAC encoder is outdated!<br>";
- messageText += "The current version available is " + lamexp_version2string("?.?.?.?", lamexp_toolver_neroaac()) + " (or later), but you still have version " + lamexp_version2string("?.?.?.?", lamexp_tool_version("neroAacEnc.exe")) + " installed.<br><br>";
- messageText += "You can download the latest version of the Nero AAC encoder from the Nero website at:<br>";
+ messageText += QString("<nobr>%1<br>").arg(tr("The Nero AAC encoder could not be found. AAC encoding support will be disabled."));
+ messageText += QString("%1<br><br>").arg(tr("Please put 'neroAacEnc.exe', 'neroAacDec.exe' and 'neroAacTag.exe' into the LameXP directory!"));
+ messageText += QString("%1<br>").arg(tr("Your LameXP directory is located here:"));
+ messageText += QString("<i><nobr><a href=\"file:///%1\">%1</a></nobr></i><br><br>").arg(QDir::toNativeSeparators(QCoreApplication::applicationDirPath()));
+ messageText += QString("%1<br>").arg(tr("You can download the Nero AAC encoder for free from the official Nero website at:"));
messageText += "<b>" + LINK(AboutDialog::neroAacUrl) + "</b><br></nobr>";
- QMessageBox::information(this, "AAC Encoder Outdated", messageText);
+ QMessageBox::information(this, tr("AAC Support Disabled"), messageText);
}
}
- else
- {
- radioButtonEncoderAAC->setEnabled(false);
- QString messageText;
- messageText += "<nobr>The Nero AAC encoder could not be found. AAC encoding support will be disabled.<br>";
- messageText += "Please put 'neroAacEnc.exe', 'neroAacDec.exe' and 'neroAacTag.exe' into the LameXP directory!<br><br>";
- messageText += "Your LameXP directory is as follows:<br>";
- messageText += "<i><nobr>" + QDir::toNativeSeparators(QCoreApplication::applicationDirPath()) + "</nobr></i><br><br>";
- messageText += "You can download the Nero AAC encoder for free from the official Nero website at:<br>";
- messageText += "<b>" + LINK(AboutDialog::neroAacUrl) + "</b><br></nobr>";
- QMessageBox::information(this, "AAC Support Disabled", messageText);
- }
//Check for WMA support
- if(!lamexp_check_tool("wmawav.exe"))
+ if(m_settings->wmaDecoderNotificationsEnabled())
{
- QString messageText;
- messageText += "<nobr>LameXP has detected that the WMA File Decoder component is not currently installed on your system.<br>";
- messageText += "You won't be able to process WMA files as input unless the WMA File Decoder component is installed!</nobr>";
- QMessageBox::information(this, "WMA Decoder Missing", messageText);
- installWMADecoderActionTriggered(rand() % 2);
+ if(!lamexp_check_tool("wmawav.exe"))
+ {
+ QString messageText;
+ messageText += QString("<nobr>%1<br>").arg(tr("LameXP has detected that the WMA File Decoder component is not currently installed on your system."));
+ messageText += QString("%1</nobr>").arg(tr("You won't be able to process WMA files as input unless the WMA File Decoder component is installed!"));
+ QMessageBox::information(this, tr("WMA Decoder Missing"), messageText);
+ installWMADecoderActionTriggered(rand() % 2);
+ }
}
//Add files from the command-line
}
}
+ //Start delayed files timer
if(!m_delayedFileList->isEmpty() && !m_delayedFileTimer->isActive())
{
m_delayedFileTimer->start(5000);
}
+
+ //Make DropBox visible
+ if(m_settings->dropBoxWidgetEnabled())
+ {
+ m_dropBox->setVisible(true);
+ }
}
/*
void MainWindow::aboutButtonClicked(void)
{
ABORT_IF_BUSY;
+ if(m_dropBox->isVisible()) m_dropBox->hide();
AboutDialog *aboutBox = new AboutDialog(m_settings, this);
aboutBox->exec();
LAMEXP_DELETE(aboutBox);
+ if(m_settings->dropBoxWidgetEnabled()) m_dropBox->show();
}
/*
void MainWindow::encodeButtonClicked(void)
{
static const __int64 oneGigabyte = 1073741824;
- static const __int64 minimumFreeDiskspaceMultiplier = 222;
+ static const __int64 minimumFreeDiskspaceMultiplier = 2;
ABORT_IF_BUSY;
-
+
if(m_fileListModel->rowCount() < 1)
{
- QMessageBox::warning(this, "LameXP", "You must add at least one file to the list before proceeding!");
+ QMessageBox::warning(this, tr("LameXP"), tr("You must add at least one file to the list before proceeding!"));
tabWidget->setCurrentIndex(0);
return;
}
- if(lamexp_free_diskspace(lamexp_temp_folder()) < (oneGigabyte * minimumFreeDiskspaceMultiplier))
+ __int64 currentFreeDiskspace = lamexp_free_diskspace(lamexp_temp_folder());
+
+ if(currentFreeDiskspace < (oneGigabyte * minimumFreeDiskspaceMultiplier))
{
- QDir tempFolder(lamexp_temp_folder());
- tempFolder.cdUp();
- if(QMessageBox::warning(this, "Low Diskspace Warning", QString("<nobr>Warning: There are less than %1 GB of free diskspace available on your system's TEMP folder!</nobr><br><br>Your TEMP folder is located at:<br><i>%2</i>").arg(QString::number(minimumFreeDiskspaceMultiplier), tempFolder.path()), "Abort Process (Recommended)", "Ignore") != 1)
+ QStringList tempFolderParts = lamexp_temp_folder().split("/", QString::SkipEmptyParts, Qt::CaseInsensitive);
+ tempFolderParts.takeLast();
+ if(m_settings->soundsEnabled()) PlaySound(MAKEINTRESOURCE(IDR_WAVE_WHAMMY), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC);
+ switch(QMessageBox::warning(this, tr("Low Diskspace Warning"), QString("<nobr>%1</nobr><br><nobr>%2</nobr><br><br>%3").arg(tr("There are less than %1 GB of free diskspace available on your system's TEMP folder.").arg(QString::number(minimumFreeDiskspaceMultiplier)), tr("It is highly recommend to free up more diskspace before proceeding with the encode!"), tr("Your TEMP folder is located at:")).append("<br><nobr><i><a href=\"file:///%3\">%3</a></i></nobr><br>").arg(tempFolderParts.join("\\")), 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());
+ case 0:
return;
+ break;
+ default:
+ QMessageBox::warning(this, tr("Low Diskspace"), tr("You are proceeding with low diskspace. Problems might occur!"));
+ break;
}
}
case SettingsModel::PCMEncoder:
break;
default:
- QMessageBox::warning(this, "LameXP", "Sorry, an unsupported encoder has been chosen!");
+ QMessageBox::warning(this, tr("LameXP"), tr("Sorry, an unsupported encoder has been chosen!"));
tabWidget->setCurrentIndex(3);
return;
}
QFile writeTest(QString("%1/~%2.txt").arg(m_settings->outputDir(), QUuid::createUuid().toString()));
if(!writeTest.open(QIODevice::ReadWrite))
{
- QMessageBox::warning(this, "LameXP", QString("Cannot write to the selected output directory.<br><nobr>%1</nobr><br><br>Please choose a different directory!").arg(m_settings->outputDir()));
+ 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!")));
tabWidget->setCurrentIndex(1);
return;
}
void MainWindow::addFilesButtonClicked(void)
{
ABORT_IF_BUSY;
- QStringList selectedFiles = QFileDialog::getOpenFileNames(this, "Add file(s)", QString(), "All supported files (*.*)");
+ QStringList fileTypeFilters = DecoderRegistry::getSupportedTypes();
+ QStringList selectedFiles = QFileDialog::getOpenFileNames(this, tr("Add file(s)"), QString(), fileTypeFilters.join(";;"));
addFiles(selectedFiles);
}
void MainWindow::openFolderActionActivated(void)
{
ABORT_IF_BUSY;
- QString selectedFolder = QFileDialog::getExistingDirectory(this, "Add folder", QDesktopServices::storageLocation(QDesktopServices::MusicLocation));
+ QString selectedFolder = QFileDialog::getExistingDirectory(this, tr("Add folder"), QDesktopServices::storageLocation(QDesktopServices::MusicLocation));
if(!selectedFolder.isEmpty())
{
}
/*
- * Output folder changed
+ * Language action triggered
+ */
+void MainWindow::languageActionActivated(QAction *action)
+{
+ QString langId = action->data().toString();
+
+ if(lamexp_install_translator(langId))
+ {
+ m_settings->currentLanguage(langId);
+ }
+}
+
+/*
+ * Output folder changed (mouse clicked)
*/
void MainWindow::outputFolderViewClicked(const QModelIndex &index)
{
}
QString selectedDir = m_fileSystemModel->filePath(index);
if(selectedDir.length() < 3) selectedDir.append(QDir::separator());
- outputFolderLabel->setText(selectedDir);
+ outputFolderLabel->setText(QDir::toNativeSeparators(selectedDir));
m_settings->outputDir(selectedDir);
}
/*
+ * Output folder changed (mouse moved)
+ */
+void MainWindow::outputFolderViewMoved(const QModelIndex &index)
+{
+ if(QApplication::mouseButtons() & Qt::LeftButton)
+ {
+ outputFolderViewClicked(index);
+ }
+}
+
+/*
* Goto desktop button
*/
void MainWindow::gotoDesktopButtonClicked(void)
{
- outputFolderView->setCurrentIndex(m_fileSystemModel->index(QDesktopServices::storageLocation(QDesktopServices::DesktopLocation)));
- outputFolderViewClicked(outputFolderView->currentIndex());
- outputFolderView->setFocus();
+ QString desktopPath = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation);
+
+ if(!desktopPath.isEmpty() && QDir(desktopPath).exists())
+ {
+ outputFolderView->setCurrentIndex(m_fileSystemModel->index(desktopPath));
+ outputFolderViewClicked(outputFolderView->currentIndex());
+ outputFolderView->setFocus();
+ }
+ else
+ {
+ buttonGotoDesktop->setEnabled(false);
+ }
}
/*
*/
void MainWindow::gotoHomeFolderButtonClicked(void)
{
- outputFolderView->setCurrentIndex(m_fileSystemModel->index(QDesktopServices::storageLocation(QDesktopServices::HomeLocation)));
- outputFolderViewClicked(outputFolderView->currentIndex());
- outputFolderView->setFocus();
+ QString homePath = QDesktopServices::storageLocation(QDesktopServices::HomeLocation);
+
+ if(!homePath.isEmpty() && QDir(homePath).exists())
+ {
+ outputFolderView->setCurrentIndex(m_fileSystemModel->index(homePath));
+ outputFolderViewClicked(outputFolderView->currentIndex());
+ outputFolderView->setFocus();
+ }
+ else
+ {
+ buttonGotoHome->setEnabled(false);
+ }
}
/*
*/
void MainWindow::gotoMusicFolderButtonClicked(void)
{
- outputFolderView->setCurrentIndex(m_fileSystemModel->index(QDesktopServices::storageLocation(QDesktopServices::MusicLocation)));
- outputFolderViewClicked(outputFolderView->currentIndex());
- outputFolderView->setFocus();
+ QString musicPath = QDesktopServices::storageLocation(QDesktopServices::MusicLocation);
+
+ if(!musicPath.isEmpty() && QDir(musicPath).exists())
+ {
+ outputFolderView->setCurrentIndex(m_fileSystemModel->index(musicPath));
+ outputFolderViewClicked(outputFolderView->currentIndex());
+ outputFolderView->setFocus();
+ }
+ else
+ {
+ buttonGotoMusic->setEnabled(false);
+ }
}
/*
ABORT_IF_BUSY;
QDir basePath(m_fileSystemModel->fileInfo(outputFolderView->currentIndex()).absoluteFilePath());
- QString suggestedName = "New Folder";
+ QString suggestedName = tr("New Folder");
if(!m_metaData->fileArtist().isEmpty() && !m_metaData->fileAlbum().isEmpty())
{
while(true)
{
bool bApplied = false;
- QString folderName = QInputDialog::getText(this, "New Folder", QString("Enter the name of the new folder:").leftJustified(96, ' '), QLineEdit::Normal, suggestedName, &bApplied, Qt::WindowStaysOnTopHint).simplified();
+ QString folderName = QInputDialog::getText(this, tr("New Folder"), tr("Enter the name of the new folder:").leftJustified(96, ' '), QLineEdit::Normal, suggestedName, &bApplied, Qt::WindowStaysOnTopHint).simplified();
if(bApplied)
{
}
else
{
- QMessageBox::warning(this, "Failed to create folder", QString("The new folder could not be created:<br><nobr>%1</nobr><br><br>Drive is read-only or insufficient access rights!").arg(basePath.absoluteFilePath(newFolder)));
+ QMessageBox::warning(this, tr("Failed to create folder"), QString("%1<br><nobr>%2</nobr><br><br>%3").arg(tr("The new folder could not be created:"), basePath.absoluteFilePath(newFolder), tr("Drive is read-only or insufficient access rights!")));
}
}
break;
void MainWindow::checkUpdatesActionActivated(void)
{
ABORT_IF_BUSY;
-
+
+ if(m_dropBox->isVisible()) m_dropBox->hide();
UpdateDialog *updateDialog = new UpdateDialog(m_settings, this);
updateDialog->exec();
}
LAMEXP_DELETE(updateDialog);
+ if(m_settings->dropBoxWidgetEnabled()) m_dropBox->show();
}
/*
{
if(!m_banner->isVisible())
{
- QMessageBox msgBox(QMessageBox::Warning, "Already running", "LameXP is already running, please use the running instance!", QMessageBox::NoButton, this, Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint | Qt::WindowStaysOnTopHint);
+ QMessageBox msgBox(QMessageBox::Warning, tr("Already running"), tr("LameXP is already running, please use the running instance!"), QMessageBox::NoButton, this, Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint | Qt::WindowStaysOnTopHint);
msgBox.exec();
}
}
switch(m_settings->compressionEncoder())
{
case SettingsModel::MP3Encoder:
- labelBitrate->setText(QString("Quality Level %1").arg(9 - value));
+ labelBitrate->setText(tr("Quality Level %1").arg(9 - value));
break;
case SettingsModel::VorbisEncoder:
- labelBitrate->setText(QString("Quality Level %1").arg(value));
+ labelBitrate->setText(tr("Quality Level %1").arg(value));
break;
case SettingsModel::AACEncoder:
- labelBitrate->setText(QString("Quality Level %1").arg(QString().sprintf("%.2f", static_cast<double>(value * 5) / 100.0)));
+ labelBitrate->setText(tr("Quality Level %1").arg(QString().sprintf("%.2f", static_cast<double>(value * 5) / 100.0)));
break;
case SettingsModel::FLACEncoder:
- labelBitrate->setText(QString("Compression %1").arg(value));
+ labelBitrate->setText(tr("Compression %1").arg(value));
break;
case SettingsModel::PCMEncoder:
- labelBitrate->setText("Uncompressed");
+ labelBitrate->setText(tr("Uncompressed"));
break;
default:
labelBitrate->setText(QString::number(value));
labelBitrate->setText(QString("≈ %1 kbps").arg(SettingsModel::mp3Bitrates[value]));
break;
case SettingsModel::FLACEncoder:
- labelBitrate->setText(QString("Compression %1").arg(value));
+ labelBitrate->setText(tr("Compression %1").arg(value));
break;
case SettingsModel::PCMEncoder:
- labelBitrate->setText("Uncompressed");
+ labelBitrate->setText(tr("Uncompressed"));
break;
default:
labelBitrate->setText(QString("≈ %1 kbps").arg(min(500, value * 8)));
labelBitrate->setText(QString("%1 kbps").arg(SettingsModel::mp3Bitrates[value]));
break;
case SettingsModel::FLACEncoder:
- labelBitrate->setText(QString("Compression %1").arg(value));
+ labelBitrate->setText(tr("Compression %1").arg(value));
break;
case SettingsModel::PCMEncoder:
- labelBitrate->setText("Uncompressed");
+ labelBitrate->setText(tr("Uncompressed"));
break;
default:
labelBitrate->setText(QString("%1 kbps").arg(min(500, value * 8)));
{
if(checked)
{
- if(QMessageBox::Yes == QMessageBox::question(this, "Disable Update Reminder", "Do you really want to disable the update reminder?", QMessageBox::Yes | QMessageBox::No, QMessageBox::No))
+ if(QMessageBox::Yes == QMessageBox::question(this, tr("Disable Update Reminder"), tr("Do you really want to disable the update reminder?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No))
{
- QMessageBox::information(this, "Update Reminder", "The update reminder has been disabled.<br>Please remember to check for updates at regular intervals!");
+ QMessageBox::information(this, tr("Update Reminder"), QString("%1<br>%2").arg(tr("The update reminder has been disabled."), tr("Please remember to check for updates at regular intervals!")));
m_settings->autoUpdateEnabled(false);
}
else
}
else
{
- QMessageBox::information(this, "Update Reminder", "The update reminder has been re-enabled.");
+ QMessageBox::information(this, tr("Update Reminder"), tr("The update reminder has been re-enabled."));
m_settings->autoUpdateEnabled(true);
}
{
if(checked)
{
- if(QMessageBox::Yes == QMessageBox::question(this, "Disable Sound Effects", "Do you really want to disable all sound effects?", QMessageBox::Yes | QMessageBox::No, QMessageBox::No))
+ if(QMessageBox::Yes == QMessageBox::question(this, tr("Disable Sound Effects"), tr("Do you really want to disable all sound effects?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No))
{
- QMessageBox::information(this, "Sound Effects", "All sound effects have been disabled.");
+ QMessageBox::information(this, tr("Sound Effects"), tr("All sound effects have been disabled."));
m_settings->soundsEnabled(false);
}
else
}
else
{
- QMessageBox::information(this, "Sound Effects", "The sound effects have been re-enabled.");
+ QMessageBox::information(this, tr("Sound Effects"), tr("The sound effects have been re-enabled."));
m_settings->soundsEnabled(true);
}
actionDisableSounds->setChecked(!m_settings->soundsEnabled());
}
+/*
+ * Disable Nero AAC encoder action
+ */
+void MainWindow::disableNeroAacNotificationsActionTriggered(bool checked)
+{
+ if(checked)
+ {
+ if(QMessageBox::Yes == QMessageBox::question(this, tr("Nero AAC Notifications"), tr("Do you really want to disable all Nero AAC Encoder notifications?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No))
+ {
+ QMessageBox::information(this, tr("Nero AAC Notifications"), tr("All Nero AAC Encoder notifications have been disabled."));
+ m_settings->neroAacNotificationsEnabled(false);
+ }
+ else
+ {
+ m_settings->neroAacNotificationsEnabled(true);
+ }
+ }
+ else
+ {
+ QMessageBox::information(this, tr("Nero AAC Notifications"), tr("The Nero AAC Encoder notifications have been re-enabled."));
+ m_settings->neroAacNotificationsEnabled(true);
+ }
+
+ actionDisableNeroAacNotifications->setChecked(!m_settings->neroAacNotificationsEnabled());
+}
+
+/*
+ * Disable WMA Decoder component action
+ */
+void MainWindow::disableWmaDecoderNotificationsActionTriggered(bool checked)
+{
+ if(checked)
+ {
+ if(QMessageBox::Yes == QMessageBox::question(this, tr("WMA Decoder Notifications"), tr("Do you really want to disable all WMA Decoder notifications?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No))
+ {
+ QMessageBox::information(this, tr("WMA Decoder Notifications"), tr("All WMA Decoder notifications have been disabled."));
+ m_settings->wmaDecoderNotificationsEnabled(false);
+ }
+ else
+ {
+ m_settings->wmaDecoderNotificationsEnabled(true);
+ }
+ }
+ else
+ {
+ QMessageBox::information(this, tr("WMA Decoder Notifications"), tr("The WMA Decoder notifications have been re-enabled."));
+ m_settings->wmaDecoderNotificationsEnabled(true);
+ }
+
+ actionDisableWmaDecoderNotifications->setChecked(!m_settings->wmaDecoderNotificationsEnabled());
+}
+
+/*
+ * Download and install WMA Decoder component
+ */
void MainWindow::installWMADecoderActionTriggered(bool checked)
{
static const char *download_url = "http://www.nch.com.au/components/wmawav.exe";
static const char *download_hash = "52a3b0e6690faf3f830c336d3c0eadfb7a4e9bc6";
- if(QMessageBox::question(this, "Install WMA Decoder", "Do you want to download and install the WMA File Decoder component now?", "Download && Install", "Cancel") != 0)
+ if(QMessageBox::question(this, tr("Install WMA Decoder"), tr("Do you want to download and install the WMA File Decoder component now?"), tr("Download && Install"), tr("Cancel")) != 0)
{
return;
}
connect(&process, SIGNAL(finished(int, QProcess::ExitStatus)), &loop, SLOT(quit()));
process.start(binaryWGet, QStringList() << "-O" << QFileInfo(setupFile).fileName() << download_url);
- m_banner->show("Downloading WMA Decoder Setup, please wait...", &loop);
+ m_banner->show(tr("Downloading WMA Decoder Setup, please wait..."), &loop);
if(process.exitCode() != 0 || QFileInfo(setupFile).size() < 10240)
{
QFile::remove(setupFile);
- if(QMessageBox::critical(this, "Download Failed", "Failed to download the WMA Decoder setup. Check your internet connection!", "Try Again", "Cancel") == 0)
+ if(QMessageBox::critical(this, tr("Download Failed"), tr("Failed to download the WMA Decoder setup. Check your internet connection!"), tr("Try Again"), tr("Cancel")) == 0)
{
continue;
}
{
qWarning("Hash miscompare:\n Expected %s\n Detected %s\n", download_hash, setupFileHash.result().toHex().constData());
QFile::remove(setupFile);
- if(QMessageBox::critical(this, "Download Failed", "The download seems to be corrupted. Please try again!", "Try Again", "Cancel") == 0)
+ if(QMessageBox::critical(this, tr("Download Failed"), tr("The download seems to be corrupted. Please try again!"), tr("Try Again"), tr("Cancel")) == 0)
{
continue;
}
QFile::remove(setupFile);
QApplication::restoreOverrideCursor();
- if(QMessageBox::information(this, "WMA Decoder", "The WMA File Decoder has been installed. Please restart LameXP now!", "Quit LameXP", "Ignore") == 0)
+ if(QMessageBox::information(this, tr("WMA Decoder"), tr("The WMA File Decoder has been installed. Please restart LameXP now!"), tr("Quit LameXP"), tr("Postpone")) == 0)
{
QApplication::quit();
}
}
}
+void MainWindow::showDropBoxWidgetActionTriggered(bool checked)
+{
+ m_settings->dropBoxWidgetEnabled(true);
+
+ if(!m_dropBox->isVisible())
+ {
+ m_dropBox->show();
+ }
+
+ FLASH_WINDOW(m_dropBox);
+}