///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End
-// Copyright (C) 2004-2014 LoRd_MuldeR <MuldeR2@GMX.de>
+// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
#include "Model_Settings.h"
#include "Model_FileList.h"
#include "Model_FileSystem.h"
-#include "WinSevenTaskbar.h"
#include "Registry_Encoder.h"
#include "Registry_Decoder.h"
#include "Encoder_Abstract.h"
#include <MUtils/Global.h>
#include <MUtils/OSSupport.h>
#include <MUtils/GUI.h>
+#include <MUtils/Exception.h>
+#include <MUtils/Sound.h>
+#include <MUtils/Translation.h>
#include <MUtils/Version.h>
//Qt includes
{ \
if(BANNER_VISIBLE || m_delayedFileTimer->isActive() || (QApplication::activeModalWidget() != NULL)) \
{ \
- lamexp_beep(lamexp_beep_warning); \
+ MUtils::Sound::beep(MUtils::Sound::BEEP_WRN); \
return; \
} \
} \
#define SET_CHECKBOX_STATE(CHCKBX, STATE) do \
{ \
+ const bool isDisabled = (!(CHCKBX)->isEnabled()); \
+ if(isDisabled) \
+ { \
+ (CHCKBX)->setEnabled(true); \
+ } \
if((CHCKBX)->isChecked() != (STATE)) \
{ \
(CHCKBX)->click(); \
{ \
qWarning("Warning: Failed to set checkbox " #CHCKBX " state!"); \
} \
+ if(isDisabled) \
+ { \
+ (CHCKBX)->setEnabled(false); \
+ } \
} \
while(0)
#define PLAY_SOUND_OPTIONAL(NAME, ASYNC) do \
{ \
- if(m_settings->soundsEnabled()) lamexp_play_sound((NAME), (ASYNC)); \
+ if(m_settings->soundsEnabled()) MUtils::Sound::play_sound((NAME), (ASYNC)); \
} \
while(0)
static const unsigned int IDM_ABOUTBOX = 0xEFF0;
static const char *g_hydrogen_audio_url = "http://wiki.hydrogenaud.io/index.php?title=Main_Page";
+static const char *g_documents_base_url = "http://lamexp.sourceforge.net/doc";
////////////////////////////////////////////////////////////
// Constructor
////////////////////////////////////////////////////////////
-MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel_MetaInfo *metaInfo, SettingsModel *settingsModel, QWidget *parent)
+MainWindow::MainWindow(MUtils::IPCChannel *const ipcChannel, FileListModel *const fileListModel, AudioFileModel_MetaInfo *const metaInfo, SettingsModel *const settingsModel, QWidget *const parent)
:
QMainWindow(parent),
ui(new Ui::MainWindow),
m_fileListModel(fileListModel),
m_metaData(metaInfo),
m_settings(settingsModel),
- m_windowIcon(NULL),
m_fileSystemModel(NULL),
m_banner(NULL),
m_accepted(false),
setWindowFlags(windowFlags() ^ Qt::WindowMaximizeButtonHint);
//Create window icon
- m_windowIcon = lamexp_set_window_icon(this, lamexp_app_icon(), true);
+ MUtils::GUI::set_window_icon(this, lamexp_app_icon(), true);
//Register meta types
qRegisterMetaType<AudioFileModel>("AudioFileModel");
connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabPageChanged(int)));
//Add system menu
- lamexp_append_sysmenu(this, IDM_ABOUTBOX, "About...");
+ MUtils::GUI::sysmenu_append(this, IDM_ABOUTBOX, "About...");
//Setup corner widget
QLabel *cornerWidget = new QLabel(ui->menubar);
ui->sliderLameAlgoQuality->setValue(m_settings->lameAlgoQuality());
if(m_settings->maximumInstances() > 0) ui->sliderMaxInstances->setValue(m_settings->maximumInstances());
- ui->spinBoxBitrateManagementMin->setValue(m_settings->bitrateManagementMinRate());
- ui->spinBoxBitrateManagementMax->setValue(m_settings->bitrateManagementMaxRate());
- ui->spinBoxNormalizationFilter->setValue(static_cast<double>(m_settings->normalizationFilterMaxVolume()) / 100.0);
- ui->spinBoxToneAdjustBass->setValue(static_cast<double>(m_settings->toneAdjustBass()) / 100.0);
- ui->spinBoxToneAdjustTreble->setValue(static_cast<double>(m_settings->toneAdjustTreble()) / 100.0);
- ui->spinBoxAftenSearchSize->setValue(m_settings->aftenExponentSearchSize());
- ui->spinBoxOpusComplexity->setValue(m_settings->opusComplexity());
+ ui->spinBoxBitrateManagementMin ->setValue(m_settings->bitrateManagementMinRate());
+ ui->spinBoxBitrateManagementMax ->setValue(m_settings->bitrateManagementMaxRate());
+ ui->spinBoxNormalizationFilterPeak->setValue(static_cast<double>(m_settings->normalizationFilterMaxVolume()) / 100.0);
+ ui->spinBoxNormalizationFilterSize->setValue(m_settings->normalizationFilterSize());
+ ui->spinBoxToneAdjustBass ->setValue(static_cast<double>(m_settings->toneAdjustBass()) / 100.0);
+ ui->spinBoxToneAdjustTreble ->setValue(static_cast<double>(m_settings->toneAdjustTreble()) / 100.0);
+ ui->spinBoxAftenSearchSize ->setValue(m_settings->aftenExponentSearchSize());
+ ui->spinBoxOpusComplexity ->setValue(m_settings->opusComplexity());
- ui->comboBoxMP3ChannelMode->setCurrentIndex(m_settings->lameChannelMode());
- ui->comboBoxSamplingRate->setCurrentIndex(m_settings->samplingRate());
- ui->comboBoxAACProfile->setCurrentIndex(m_settings->aacEncProfile());
- ui->comboBoxAftenCodingMode->setCurrentIndex(m_settings->aftenAudioCodingMode());
- ui->comboBoxAftenDRCMode->setCurrentIndex(m_settings->aftenDynamicRangeCompression());
- ui->comboBoxNormalizationMode->setCurrentIndex(m_settings->normalizationFilterEQMode());
- ui->comboBoxOpusFramesize->setCurrentIndex(m_settings->opusFramesize());
+ ui->comboBoxMP3ChannelMode ->setCurrentIndex(m_settings->lameChannelMode());
+ ui->comboBoxSamplingRate ->setCurrentIndex(m_settings->samplingRate());
+ ui->comboBoxAACProfile ->setCurrentIndex(m_settings->aacEncProfile());
+ ui->comboBoxAftenCodingMode ->setCurrentIndex(m_settings->aftenAudioCodingMode());
+ ui->comboBoxAftenDRCMode ->setCurrentIndex(m_settings->aftenDynamicRangeCompression());
+ ui->comboBoxOpusFramesize ->setCurrentIndex(m_settings->opusFramesize());
- SET_CHECKBOX_STATE(ui->checkBoxBitrateManagement, m_settings->bitrateManagementEnabled());
- SET_CHECKBOX_STATE(ui->checkBoxNeroAAC2PassMode, m_settings->neroAACEnable2Pass());
- SET_CHECKBOX_STATE(ui->checkBoxAftenFastAllocation, m_settings->aftenFastBitAllocation());
- SET_CHECKBOX_STATE(ui->checkBoxNormalizationFilter, m_settings->normalizationFilterEnabled());
- SET_CHECKBOX_STATE(ui->checkBoxAutoDetectInstances, (m_settings->maximumInstances() < 1));
- SET_CHECKBOX_STATE(ui->checkBoxUseSystemTempFolder, !m_settings->customTempPathEnabled());
- SET_CHECKBOX_STATE(ui->checkBoxRenameOutput, m_settings->renameOutputFilesEnabled());
- SET_CHECKBOX_STATE(ui->checkBoxForceStereoDownmix, m_settings->forceStereoDownmix());
- SET_CHECKBOX_STATE(ui->checkBoxOpusDisableResample, m_settings->opusDisableResample());
+ SET_CHECKBOX_STATE(ui->checkBoxBitrateManagement, m_settings->bitrateManagementEnabled());
+ SET_CHECKBOX_STATE(ui->checkBoxNeroAAC2PassMode, m_settings->neroAACEnable2Pass());
+ SET_CHECKBOX_STATE(ui->checkBoxAftenFastAllocation, m_settings->aftenFastBitAllocation());
+ SET_CHECKBOX_STATE(ui->checkBoxNormalizationFilterEnabled, m_settings->normalizationFilterEnabled());
+ SET_CHECKBOX_STATE(ui->checkBoxNormalizationFilterDynamic, m_settings->normalizationFilterDynamic());
+ SET_CHECKBOX_STATE(ui->checkBoxNormalizationFilterCoupled, m_settings->normalizationFilterCoupled());
+ SET_CHECKBOX_STATE(ui->checkBoxAutoDetectInstances, (m_settings->maximumInstances() < 1));
+ SET_CHECKBOX_STATE(ui->checkBoxUseSystemTempFolder, (!m_settings->customTempPathEnabled()));
+ SET_CHECKBOX_STATE(ui->checkBoxRenameOutput, m_settings->renameOutputFilesEnabled());
+ SET_CHECKBOX_STATE(ui->checkBoxForceStereoDownmix, m_settings->forceStereoDownmix());
+ SET_CHECKBOX_STATE(ui->checkBoxOpusDisableResample, m_settings->opusDisableResample());
+
ui->checkBoxNeroAAC2PassMode->setEnabled(aacEncoder == SettingsModel::AAC_ENCODER_NERO);
ui->lineEditCustomParamLAME ->setText(EncoderRegistry::loadEncoderCustomParams(m_settings, SettingsModel::MP3Encoder));
ui->radioButtonOverwriteModeSkipFile->setChecked(m_settings->overwriteMode() == SettingsModel::Overwrite_SkipFile);
ui->radioButtonOverwriteModeReplaces->setChecked(m_settings->overwriteMode() == SettingsModel::Overwrite_Replaces);
- connect(ui->sliderLameAlgoQuality, SIGNAL(valueChanged(int)), this, SLOT(updateLameAlgoQuality(int)));
- connect(ui->checkBoxBitrateManagement, SIGNAL(clicked(bool)), this, SLOT(bitrateManagementEnabledChanged(bool)));
- connect(ui->spinBoxBitrateManagementMin, SIGNAL(valueChanged(int)), this, SLOT(bitrateManagementMinChanged(int)));
- connect(ui->spinBoxBitrateManagementMax, SIGNAL(valueChanged(int)), this, SLOT(bitrateManagementMaxChanged(int)));
- connect(ui->comboBoxMP3ChannelMode, SIGNAL(currentIndexChanged(int)), this, SLOT(channelModeChanged(int)));
- connect(ui->comboBoxSamplingRate, SIGNAL(currentIndexChanged(int)), this, SLOT(samplingRateChanged(int)));
- connect(ui->checkBoxNeroAAC2PassMode, SIGNAL(clicked(bool)), this, SLOT(neroAAC2PassChanged(bool)));
- connect(ui->comboBoxAACProfile, SIGNAL(currentIndexChanged(int)), this, SLOT(neroAACProfileChanged(int)));
- connect(ui->checkBoxNormalizationFilter, SIGNAL(clicked(bool)), this, SLOT(normalizationEnabledChanged(bool)));
- connect(ui->comboBoxAftenCodingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(aftenCodingModeChanged(int)));
- connect(ui->comboBoxAftenDRCMode, SIGNAL(currentIndexChanged(int)), this, SLOT(aftenDRCModeChanged(int)));
- connect(ui->spinBoxAftenSearchSize, SIGNAL(valueChanged(int)), this, SLOT(aftenSearchSizeChanged(int)));
- connect(ui->checkBoxAftenFastAllocation, SIGNAL(clicked(bool)), this, SLOT(aftenFastAllocationChanged(bool)));
- connect(ui->spinBoxNormalizationFilter, SIGNAL(valueChanged(double)), this, SLOT(normalizationMaxVolumeChanged(double)));
- connect(ui->comboBoxNormalizationMode, SIGNAL(currentIndexChanged(int)), this, SLOT(normalizationModeChanged(int)));
- connect(ui->spinBoxToneAdjustBass, SIGNAL(valueChanged(double)), this, SLOT(toneAdjustBassChanged(double)));
- connect(ui->spinBoxToneAdjustTreble, SIGNAL(valueChanged(double)), this, SLOT(toneAdjustTrebleChanged(double)));
- connect(ui->buttonToneAdjustReset, SIGNAL(clicked()), this, SLOT(toneAdjustTrebleReset()));
- connect(ui->lineEditCustomParamLAME, SIGNAL(editingFinished()), this, SLOT(customParamsChanged()));
- connect(ui->lineEditCustomParamOggEnc, SIGNAL(editingFinished()), this, SLOT(customParamsChanged()));
- connect(ui->lineEditCustomParamNeroAAC, SIGNAL(editingFinished()), this, SLOT(customParamsChanged()));
- connect(ui->lineEditCustomParamFLAC, SIGNAL(editingFinished()), this, SLOT(customParamsChanged()));
- connect(ui->lineEditCustomParamAften, SIGNAL(editingFinished()), this, SLOT(customParamsChanged()));
- connect(ui->lineEditCustomParamOpus, SIGNAL(editingFinished()), this, SLOT(customParamsChanged()));
- connect(ui->sliderMaxInstances, SIGNAL(valueChanged(int)), this, SLOT(updateMaximumInstances(int)));
- connect(ui->checkBoxAutoDetectInstances, SIGNAL(clicked(bool)), this, SLOT(autoDetectInstancesChanged(bool)));
- connect(ui->buttonBrowseCustomTempFolder, SIGNAL(clicked()), this, SLOT(browseCustomTempFolderButtonClicked()));
- connect(ui->lineEditCustomTempFolder, SIGNAL(textChanged(QString)), this, SLOT(customTempFolderChanged(QString)));
- connect(ui->checkBoxUseSystemTempFolder, SIGNAL(clicked(bool)), this, SLOT(useCustomTempFolderChanged(bool)));
- connect(ui->buttonResetAdvancedOptions, SIGNAL(clicked()), this, SLOT(resetAdvancedOptionsButtonClicked()));
- connect(ui->checkBoxRenameOutput, SIGNAL(clicked(bool)), this, SLOT(renameOutputEnabledChanged(bool)));
- connect(ui->lineEditRenamePattern, SIGNAL(editingFinished()), this, SLOT(renameOutputPatternChanged()));
- connect(ui->lineEditRenamePattern, SIGNAL(textChanged(QString)), this, SLOT(renameOutputPatternChanged(QString)));
- connect(ui->labelShowRenameMacros, SIGNAL(linkActivated(QString)), this, SLOT(showRenameMacros(QString)));
- connect(ui->checkBoxForceStereoDownmix, SIGNAL(clicked(bool)), this, SLOT(forceStereoDownmixEnabledChanged(bool)));
- connect(ui->comboBoxOpusFramesize, SIGNAL(currentIndexChanged(int)), this, SLOT(opusSettingsChanged()));
- connect(ui->spinBoxOpusComplexity, SIGNAL(valueChanged(int)), this, SLOT(opusSettingsChanged()));
- connect(ui->checkBoxOpusDisableResample, SIGNAL(clicked(bool)), SLOT(opusSettingsChanged()));
- connect(m_overwriteButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(overwriteModeChanged(int)));
- connect(m_evenFilterCustumParamsHelp, SIGNAL(eventOccurred(QWidget*, QEvent*)), this, SLOT(customParamsHelpRequested(QWidget*, QEvent*)));
+ connect(ui->sliderLameAlgoQuality, SIGNAL(valueChanged(int)), this, SLOT(updateLameAlgoQuality(int)));
+ connect(ui->checkBoxBitrateManagement, SIGNAL(clicked(bool)), this, SLOT(bitrateManagementEnabledChanged(bool)));
+ connect(ui->spinBoxBitrateManagementMin, SIGNAL(valueChanged(int)), this, SLOT(bitrateManagementMinChanged(int)));
+ connect(ui->spinBoxBitrateManagementMax, SIGNAL(valueChanged(int)), this, SLOT(bitrateManagementMaxChanged(int)));
+ connect(ui->comboBoxMP3ChannelMode, SIGNAL(currentIndexChanged(int)), this, SLOT(channelModeChanged(int)));
+ connect(ui->comboBoxSamplingRate, SIGNAL(currentIndexChanged(int)), this, SLOT(samplingRateChanged(int)));
+ connect(ui->checkBoxNeroAAC2PassMode, SIGNAL(clicked(bool)), this, SLOT(neroAAC2PassChanged(bool)));
+ connect(ui->comboBoxAACProfile, SIGNAL(currentIndexChanged(int)), this, SLOT(neroAACProfileChanged(int)));
+ connect(ui->checkBoxNormalizationFilterEnabled, SIGNAL(clicked(bool)), this, SLOT(normalizationEnabledChanged(bool)));
+ connect(ui->checkBoxNormalizationFilterDynamic, SIGNAL(clicked(bool)), this, SLOT(normalizationDynamicChanged(bool)));
+ connect(ui->checkBoxNormalizationFilterCoupled, SIGNAL(clicked(bool)), this, SLOT(normalizationCoupledChanged(bool)));
+ connect(ui->comboBoxAftenCodingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(aftenCodingModeChanged(int)));
+ connect(ui->comboBoxAftenDRCMode, SIGNAL(currentIndexChanged(int)), this, SLOT(aftenDRCModeChanged(int)));
+ connect(ui->spinBoxAftenSearchSize, SIGNAL(valueChanged(int)), this, SLOT(aftenSearchSizeChanged(int)));
+ connect(ui->checkBoxAftenFastAllocation, SIGNAL(clicked(bool)), this, SLOT(aftenFastAllocationChanged(bool)));
+ connect(ui->spinBoxNormalizationFilterPeak, SIGNAL(valueChanged(double)), this, SLOT(normalizationMaxVolumeChanged(double)));
+ connect(ui->spinBoxNormalizationFilterSize, SIGNAL(valueChanged(int)), this, SLOT(normalizationFilterSizeChanged(int)));
+ connect(ui->spinBoxNormalizationFilterSize, SIGNAL(editingFinished()), this, SLOT(normalizationFilterSizeFinished()));
+ connect(ui->spinBoxToneAdjustBass, SIGNAL(valueChanged(double)), this, SLOT(toneAdjustBassChanged(double)));
+ connect(ui->spinBoxToneAdjustTreble, SIGNAL(valueChanged(double)), this, SLOT(toneAdjustTrebleChanged(double)));
+ connect(ui->buttonToneAdjustReset, SIGNAL(clicked()), this, SLOT(toneAdjustTrebleReset()));
+ connect(ui->lineEditCustomParamLAME, SIGNAL(editingFinished()), this, SLOT(customParamsChanged()));
+ connect(ui->lineEditCustomParamOggEnc, SIGNAL(editingFinished()), this, SLOT(customParamsChanged()));
+ connect(ui->lineEditCustomParamNeroAAC, SIGNAL(editingFinished()), this, SLOT(customParamsChanged()));
+ connect(ui->lineEditCustomParamFLAC, SIGNAL(editingFinished()), this, SLOT(customParamsChanged()));
+ connect(ui->lineEditCustomParamAften, SIGNAL(editingFinished()), this, SLOT(customParamsChanged()));
+ connect(ui->lineEditCustomParamOpus, SIGNAL(editingFinished()), this, SLOT(customParamsChanged()));
+ connect(ui->sliderMaxInstances, SIGNAL(valueChanged(int)), this, SLOT(updateMaximumInstances(int)));
+ connect(ui->checkBoxAutoDetectInstances, SIGNAL(clicked(bool)), this, SLOT(autoDetectInstancesChanged(bool)));
+ connect(ui->buttonBrowseCustomTempFolder, SIGNAL(clicked()), this, SLOT(browseCustomTempFolderButtonClicked()));
+ connect(ui->lineEditCustomTempFolder, SIGNAL(textChanged(QString)), this, SLOT(customTempFolderChanged(QString)));
+ connect(ui->checkBoxUseSystemTempFolder, SIGNAL(clicked(bool)), this, SLOT(useCustomTempFolderChanged(bool)));
+ connect(ui->buttonResetAdvancedOptions, SIGNAL(clicked()), this, SLOT(resetAdvancedOptionsButtonClicked()));
+ connect(ui->checkBoxRenameOutput, SIGNAL(clicked(bool)), this, SLOT(renameOutputEnabledChanged(bool)));
+ connect(ui->lineEditRenamePattern, SIGNAL(editingFinished()), this, SLOT(renameOutputPatternChanged()));
+ connect(ui->lineEditRenamePattern, SIGNAL(textChanged(QString)), this, SLOT(renameOutputPatternChanged(QString)));
+ connect(ui->labelShowRenameMacros, SIGNAL(linkActivated(QString)), this, SLOT(showRenameMacros(QString)));
+ connect(ui->checkBoxForceStereoDownmix, SIGNAL(clicked(bool)), this, SLOT(forceStereoDownmixEnabledChanged(bool)));
+ connect(ui->comboBoxOpusFramesize, SIGNAL(currentIndexChanged(int)), this, SLOT(opusSettingsChanged()));
+ connect(ui->spinBoxOpusComplexity, SIGNAL(valueChanged(int)), this, SLOT(opusSettingsChanged()));
+ connect(ui->checkBoxOpusDisableResample, SIGNAL(clicked(bool)), this, SLOT(opusSettingsChanged()));
+ connect(m_overwriteButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(overwriteModeChanged(int)));
+ connect(m_evenFilterCustumParamsHelp, SIGNAL(eventOccurred(QWidget*, QEvent*)), this, SLOT(customParamsHelpRequested(QWidget*, QEvent*)));
//--------------------------------
// Force initial GUI update
updateMaximumInstances(ui->sliderMaxInstances->value());
toneAdjustTrebleChanged(ui->spinBoxToneAdjustTreble->value());
toneAdjustBassChanged(ui->spinBoxToneAdjustBass->value());
+ normalizationEnabledChanged(ui->checkBoxNormalizationFilterEnabled->isChecked());
customParamsChanged();
//--------------------------------
ui->actionStyleWindowsXP->setData(3);
ui->actionStyleWindowsClassic->setData(4);
ui->actionStylePlastique->setChecked(true);
- ui->actionStyleWindowsXP->setEnabled((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) >= QSysInfo::WV_XP && lamexp_themes_enabled());
- ui->actionStyleWindowsVista->setEnabled((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) >= QSysInfo::WV_VISTA && lamexp_themes_enabled());
+ ui->actionStyleWindowsXP->setEnabled((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) >= QSysInfo::WV_XP && MUtils::GUI::themes_enabled());
+ ui->actionStyleWindowsVista->setEnabled((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) >= QSysInfo::WV_VISTA && MUtils::GUI::themes_enabled());
connect(m_styleActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(styleActionActivated(QAction*)));
styleActionActivated(NULL);
//Populate the language menu
m_languageActionGroup = new QActionGroup(this);
- 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);
- currentLanguage->setChecked(false);
- m_languageActionGroup->addAction(currentLanguage);
- ui->menuLanguage->insertAction(ui->actionLoadTranslationFromFile, currentLanguage);
+ QStringList translations;
+ if(MUtils::Translation::enumerate(translations) > 0)
+ {
+ for(QStringList::ConstIterator iter = translations.constBegin(); iter != translations.constEnd(); iter++)
+ {
+ QAction *currentLanguage = new QAction(this);
+ currentLanguage->setData(*iter);
+ currentLanguage->setText(MUtils::Translation::get_name(*iter));
+ currentLanguage->setIcon(QIcon(QString(":/flags/%1.png").arg(*iter)));
+ currentLanguage->setCheckable(true);
+ currentLanguage->setChecked(false);
+ m_languageActionGroup->addAction(currentLanguage);
+ ui->menuLanguage->insertAction(ui->actionLoadTranslationFromFile, currentLanguage);
+ }
}
ui->menuLanguage->insertSeparator(ui->actionLoadTranslationFromFile);
connect(ui->actionLoadTranslationFromFile, SIGNAL(triggered(bool)), this, SLOT(languageFromFileActionActivated(bool)));
ui->actionDisableNeroAacNotifications->setChecked(!m_settings->neroAacNotificationsEnabled());
ui->actionDisableSlowStartupNotifications->setChecked(!m_settings->antivirNotificationsEnabled());
ui->actionDisableShellIntegration->setChecked(!m_settings->shellIntegrationEnabled());
- ui->actionDisableShellIntegration->setDisabled(lamexp_portable_mode() && ui->actionDisableShellIntegration->isChecked());
+ ui->actionDisableShellIntegration->setDisabled(lamexp_version_portable() && ui->actionDisableShellIntegration->isChecked());
ui->actionCheckForBetaUpdates->setChecked(m_settings->autoUpdateCheckBeta() || lamexp_version_demo());
ui->actionCheckForBetaUpdates->setEnabled(!lamexp_version_demo());
ui->actionHibernateComputer->setChecked(m_settings->hibernateComputer());
- ui->actionHibernateComputer->setEnabled(lamexp_is_hibernation_supported());
+ ui->actionHibernateComputer->setEnabled(MUtils::OS::is_hibernation_supported());
connect(ui->actionDisableUpdateReminder, SIGNAL(triggered(bool)), this, SLOT(disableUpdateReminderActionTriggered(bool)));
connect(ui->actionDisableSounds, SIGNAL(triggered(bool)), this, SLOT(disableSoundsActionTriggered(bool)));
connect(ui->actionDisableNeroAacNotifications, SIGNAL(triggered(bool)), this, SLOT(disableNeroAacNotificationsActionTriggered(bool)));
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->actionDocumentManual ->setData(QString("%1/Manual.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->actionVisitHAK, SIGNAL(triggered()), this, SLOT(visitHomepageActionActivated()));
- connect(ui->actionDocumentFAQ, SIGNAL(triggered()), this, SLOT(documentActionActivated()));
+ connect(ui->actionDocumentManual, SIGNAL(triggered()), this, SLOT(documentActionActivated()));
connect(ui->actionDocumentChangelog, SIGNAL(triggered()), this, SLOT(documentActionActivated()));
connect(ui->actionDocumentTranslate, SIGNAL(triggered()), this, SLOT(documentActionActivated()));
connect(m_fileListModel, SIGNAL(rowAppended()), m_dropBox, SLOT(modelChanged()));
//Create message handler thread
- m_messageHandler = new MessageHandlerThread();
+ m_messageHandler = new MessageHandlerThread(ipcChannel);
connect(m_messageHandler, SIGNAL(otherInstanceDetected()), this, SLOT(notifyOtherInstance()), Qt::QueuedConnection);
connect(m_messageHandler, SIGNAL(fileReceived(QString)), this, SLOT(addFileDelayed(QString)), Qt::QueuedConnection);
connect(m_messageHandler, SIGNAL(folderReceived(QString, bool)), this, SLOT(addFolderDelayed(QString, bool)), Qt::QueuedConnection);
MUTILS_DELETE(m_evenFilterOutputFolderMouse);
MUTILS_DELETE(m_evenFilterOutputFolderView);
MUTILS_DELETE(m_evenFilterCompressionTab);
-
- //Free window icon
- if(m_windowIcon)
- {
- lamexp_free_window_icon(m_windowIcon);
- m_windowIcon = NULL;
- }
//Un-initialize the dialog
MUTILS_DELETE(ui);
SHOW_BANNER(tr("Scanning folder(s) for files, please wait..."));
QApplication::processEvents();
- lamexp_check_escape_state();
+ MUtils::OS::check_key_state_esc();
while(!folderInfoList.isEmpty())
{
- if(lamexp_check_escape_state())
+ if(MUtils::OS::check_key_state_esc())
{
- lamexp_beep(lamexp_beep_error);
qWarning("Operation cancelled by user!");
+ MUtils::Sound::beep(MUtils::Sound::BEEP_ERR);
fileList.clear();
break;
}
const QString qmFilePath = QFileInfo(m_settings->currentLanguageFile()).canonicalFilePath();
if((!qmFilePath.isEmpty()) && QFileInfo(qmFilePath).exists() && QFileInfo(qmFilePath).isFile() && (QFileInfo(qmFilePath).suffix().compare("qm", Qt::CaseInsensitive) == 0))
{
- if(lamexp_install_translator_from_file(qmFilePath))
+ if(MUtils::Translation::install_translator_from_file(qmFilePath))
{
QList<QAction*> actions = m_languageActionGroup->actions();
while(!actions.isEmpty()) actions.takeFirst()->setChecked(false);
while(!languageActions.isEmpty())
{
QAction *currentLanguage = languageActions.takeFirst();
- if(currentLanguage->data().toString().compare(LAMEXP_DEFAULT_LANGID, Qt::CaseInsensitive) == 0)
+ if(currentLanguage->data().toString().compare(MUtils::Translation::DEFAULT_LANGID, Qt::CaseInsensitive) == 0)
{
currentLanguage->setChecked(true);
languageActionActivated(currentLanguage);
}
}
+/*
+ * Open a document link
+ */
+void MainWindow::openDocumentLink(QAction *const action)
+{
+ if(!(action->data().isValid() && (action->data().type() == QVariant::String)))
+ {
+ qWarning("Cannot open document for this QAction!");
+ return;
+ }
+
+ //Try to open exitsing document file
+ const QFileInfo document(action->data().toString());
+ if(document.exists() && document.isFile() && (document.size() >= 1024))
+ {
+ QDesktopServices::openUrl(QUrl::fromLocalFile(document.canonicalFilePath()));
+ return;
+ }
+
+ //Document not found -> fallback mode!
+ qWarning("Document '%s' not found -> redirecting to the website!", MUTILS_UTF8(document.fileName()));
+ const QUrl url(QString("%1/%2").arg(QString::fromLatin1(g_documents_base_url), document.fileName()));
+ QDesktopServices::openUrl(url);
+}
+
////////////////////////////////////////////////////////////
// EVENTS
////////////////////////////////////////////////////////////
return;
}
- int comboBoxIndex[8];
+ int comboBoxIndex[6];
//Backup combobox indices, as retranslateUi() resets
comboBoxIndex[0] = ui->comboBoxMP3ChannelMode->currentIndex();
comboBoxIndex[2] = ui->comboBoxAACProfile->currentIndex();
comboBoxIndex[3] = ui->comboBoxAftenCodingMode->currentIndex();
comboBoxIndex[4] = ui->comboBoxAftenDRCMode->currentIndex();
- comboBoxIndex[5] = ui->comboBoxNormalizationMode->currentIndex();
- comboBoxIndex[6] = 0; //comboBoxOpusOptimize->currentIndex();
- comboBoxIndex[7] = ui->comboBoxOpusFramesize->currentIndex();
+ comboBoxIndex[5] = ui->comboBoxOpusFramesize->currentIndex();
//Re-translate from UIC
ui->retranslateUi(this);
ui->comboBoxAACProfile->setCurrentIndex(comboBoxIndex[2]);
ui->comboBoxAftenCodingMode->setCurrentIndex(comboBoxIndex[3]);
ui->comboBoxAftenDRCMode->setCurrentIndex(comboBoxIndex[4]);
- ui->comboBoxNormalizationMode->setCurrentIndex(comboBoxIndex[5]);
- //comboBoxOpusOptimize->setCurrentIndex(comboBoxIndex[6]);
- ui->comboBoxOpusFramesize->setCurrentIndex(comboBoxIndex[7]);
+ ui->comboBoxOpusFramesize->setCurrentIndex(comboBoxIndex[5]);
//Update the window title
if(MUTILS_DEBUG)
}
//Translate system menu
- lamexp_update_sysmenu(this, IDM_ABOUTBOX, ui->buttonAbout->text());
+ MUtils::GUI::sysmenu_update(this, IDM_ABOUTBOX, ui->buttonAbout->text());
//Force resize event
QApplication::postEvent(this, new QResizeEvent(this->size(), QSize()));
{
if(BANNER_VISIBLE || m_delayedFileTimer->isActive())
{
- lamexp_beep(lamexp_beep_warning);
+ MUtils::Sound::beep(MUtils::Sound::BEEP_WRN);
event->ignore();
}
if(e->modifiers().testFlag(Qt::ControlModifier) && (e->key() == Qt::Key_F5))
{
initializeTranslation();
- lamexp_beep(lamexp_beep_info);
+ MUtils::Sound::beep(MUtils::Sound::BEEP_NFO);
return;
}
bool MainWindow::winEvent(MSG *message, long *result)
{
- if(lamexp_check_sysmenu_msg(message, IDM_ABOUTBOX))
+ if(MUtils::GUI::sysmenu_check_msg(message, IDM_ABOUTBOX))
{
QTimer::singleShot(0, ui->buttonAbout, SLOT(click()));
*result = 0;
return true;
}
- return WinSevenTaskbar::handleWinEvent(message, result);
+ return false;
}
////////////////////////////////////////////////////////////
*/
void MainWindow::windowShown(void)
{
- const QStringList &arguments = MUtils::OS::arguments(); //QApplication::arguments();
+ const MUtils::OS::ArgumentMap &arguments = MUtils::OS::arguments(); //QApplication::arguments();
//Force resize event
resizeEvent(NULL);
//First run?
- bool firstRun = false;
- for(int i = 0; i < arguments.count(); i++)
- {
- /*QMessageBox::information(this, QString::number(i), arguments[i]);*/
- if(!arguments[i].compare("--first-run", Qt::CaseInsensitive)) firstRun = true;
- }
+ const bool firstRun = arguments.contains("first-run");
//Check license
if((m_settings->licenseAccepted() <= 0) || firstRun)
m_settings->licenseAccepted(++iAccepted);
m_settings->syncNow();
QApplication::processEvents();
- lamexp_play_sound("whammy", false);
+ MUtils::Sound::play_sound("whammy", false);
QMessageBox::critical(this, tr("License Declined"), tr("You have declined the license. Consequently the application will exit now!"), tr("Goodbye!"));
QFileInfo uninstallerInfo = QFileInfo(QString("%1/Uninstall.exe").arg(QApplication::applicationDirPath()));
if(uninstallerInfo.exists())
QString uninstallerPath = uninstallerInfo.canonicalFilePath();
for(int i = 0; i < 3; i++)
{
- if(lamexp_exec_shell(this, QDir::toNativeSeparators(uninstallerPath), "/Force", QDir::toNativeSeparators(uninstallerDir))) break;
+ if(MUtils::OS::shell_open(this, QDir::toNativeSeparators(uninstallerPath), "/Force", QDir::toNativeSeparators(uninstallerDir))) break;
}
}
QApplication::quit();
return;
}
- lamexp_play_sound("woohoo", false);
+ MUtils::Sound::play_sound("woohoo", false);
m_settings->licenseAccepted(1);
m_settings->syncNow();
if(lamexp_version_demo()) showAnnounceBox();
if(MUtils::OS::current_date() >= lamexp_version_expires())
{
qWarning("Binary has expired !!!");
- lamexp_play_sound("whammy", false);
+ MUtils::Sound::play_sound("whammy", false);
if(QMessageBox::warning(this, tr("LameXP - Expired"), QString("%1<br>%2").arg(NOBR(tr("This demo (pre-release) version of LameXP has expired at %1.").arg(lamexp_version_expires().toString(Qt::ISODate))), NOBR(tr("LameXP is free software and release versions won't expire."))), tr("Check for Updates"), tr("Exit Program")) == 0)
{
checkForUpdates();
return;
default:
QEventLoop loop; QTimer::singleShot(7000, &loop, SLOT(quit()));
- lamexp_play_sound("waiting", true);
+ MUtils::Sound::play_sound("waiting", true);
SHOW_BANNER_ARG(tr("Skipping update check this time, please be patient..."), &loop);
break;
}
{
if(m_settings->neroAacNotificationsEnabled())
{
- if(lamexp_tool_version("neroAacEnc.exe") < lamexp_toolver_neroaac())
+ if(lamexp_tools_version("neroAacEnc.exe") < lamexp_toolver_neroaac())
{
QString messageText;
messageText += NOBR(tr("LameXP detected that your version of the Nero AAC encoder is outdated!")).append("<br>");
- messageText += NOBR(tr("The current version available is %1 (or later), but you still have version %2 installed.").arg(lamexp_version2string("?.?.?.?", lamexp_toolver_neroaac(), tr("n/a")), lamexp_version2string("?.?.?.?", lamexp_tool_version("neroAacEnc.exe"), tr("n/a")))).append("<br><br>");
+ messageText += NOBR(tr("The current version available is %1 (or later), but you still have version %2 installed.").arg(lamexp_version2string("?.?.?.?", lamexp_toolver_neroaac(), tr("n/a")), lamexp_version2string("?.?.?.?", lamexp_tools_version("neroAacEnc.exe"), tr("n/a")))).append("<br><br>");
messageText += NOBR(tr("You can download the latest version of the Nero AAC encoder from the Nero website at:")).append("<br>");
messageText += "<nobr><tt>" + LINK(AboutDialog::neroAacUrl) + "</tt></nobr><br><br>";
messageText += NOBR(tr("(Hint: Please ignore the name of the downloaded ZIP file and check the included 'changelog.txt' instead!)")).append("<br>");
}
//Add files from the command-line
- for(int i = 0; i < arguments.count() - 1; i++)
+ QStringList addedFiles;
+ foreach(const QString &value, arguments.values("add"))
{
- QStringList addedFiles;
- if(!arguments[i].compare("--add", Qt::CaseInsensitive))
+ if(!value.isEmpty())
{
- QFileInfo currentFile(arguments[++i].trimmed());
+ QFileInfo currentFile(value);
qDebug("Adding file from CLI: %s", MUTILS_UTF8(currentFile.absoluteFilePath()));
addedFiles.append(currentFile.absoluteFilePath());
}
- if(!addedFiles.isEmpty())
- {
- addFilesDelayed(addedFiles);
- }
+ }
+ if(!addedFiles.isEmpty())
+ {
+ addFilesDelayed(addedFiles);
}
//Add folders from the command-line
- for(int i = 0; i < arguments.count() - 1; i++)
+ foreach(const QString &value, arguments.values("add-folder"))
{
- if(!arguments[i].compare("--add-folder", Qt::CaseInsensitive))
+ if(!value.isEmpty())
{
- QFileInfo currentFile(arguments[++i].trimmed());
+ const QFileInfo currentFile(value);
qDebug("Adding folder from CLI: %s", MUTILS_UTF8(currentFile.absoluteFilePath()));
addFolder(currentFile.absoluteFilePath(), false, true);
}
- if(!arguments[i].compare("--add-recursive", Qt::CaseInsensitive))
+ }
+ foreach(const QString &value, arguments.values("add-recursive"))
+ {
+ if(!value.isEmpty())
{
- QFileInfo currentFile(arguments[++i].trimmed());
+ const QFileInfo currentFile(value);
qDebug("Adding folder recursively from CLI: %s", MUTILS_UTF8(currentFile.absoluteFilePath()));
addFolder(currentFile.absoluteFilePath(), true, true);
}
return;
}
- bool ok = false;
- unsigned __int64 currentFreeDiskspace = lamexp_free_diskspace(tempFolder, &ok);
-
- if(ok && (currentFreeDiskspace < (oneGigabyte * minimumFreeDiskspaceMultiplier)))
+ quint64 currentFreeDiskspace = 0;
+ if(MUtils::OS::free_diskspace(tempFolder, currentFreeDiskspace))
{
- QStringList tempFolderParts = tempFolder.split("/", QString::SkipEmptyParts, Qt::CaseInsensitive);
- tempFolderParts.takeLast();
- PLAY_SOUND_OPTIONAL("whammy", false);
- QString lowDiskspaceMsg = QString("%1<br>%2<br><br>%3<br>%4<br>").arg
- (
- NOBR(tr("There are less than %1 GB of free diskspace available on your system's TEMP folder.").arg(QString::number(minimumFreeDiskspaceMultiplier))),
- NOBR(tr("It is highly recommend to free up more diskspace before proceeding with the encode!")),
- NOBR(tr("Your TEMP folder is located at:")),
- QString("<nobr><tt>%1</tt></nobr>").arg(FSLINK(tempFolderParts.join("\\")))
- );
- switch(QMessageBox::warning(this, tr("Low Diskspace Warning"), lowDiskspaceMsg, tr("Abort Encoding Process"), tr("Clean Disk Now"), tr("Ignore")))
+ if(currentFreeDiskspace < (oneGigabyte * minimumFreeDiskspaceMultiplier))
{
- case 1:
- QProcess::startDetached(QString("%1/cleanmgr.exe").arg(MUtils::OS::known_folder(MUtils::OS::FOLDER_SYSTEMFOLDER)), QStringList() << "/D" << tempFolderParts.first());
- case 0:
- return;
- break;
- default:
- QMessageBox::warning(this, tr("Low Diskspace"), NOBR(tr("You are proceeding with low diskspace. Problems might occur!")));
- break;
+ QStringList tempFolderParts = tempFolder.split("/", QString::SkipEmptyParts, Qt::CaseInsensitive);
+ tempFolderParts.takeLast();
+ PLAY_SOUND_OPTIONAL("whammy", false);
+ QString lowDiskspaceMsg = QString("%1<br>%2<br><br>%3<br>%4<br>").arg
+ (
+ NOBR(tr("There are less than %1 GB of free diskspace available on your system's TEMP folder.").arg(QString::number(minimumFreeDiskspaceMultiplier))),
+ NOBR(tr("It is highly recommend to free up more diskspace before proceeding with the encode!")),
+ NOBR(tr("Your TEMP folder is located at:")),
+ QString("<nobr><tt>%1</tt></nobr>").arg(FSLINK(tempFolderParts.join("\\")))
+ );
+ 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(MUtils::OS::known_folder(MUtils::OS::FOLDER_SYSTEMFOLDER)), QStringList() << "/D" << tempFolderParts.first());
+ case 0:
+ return;
+ break;
+ default:
+ QMessageBox::warning(this, tr("Low Diskspace"), NOBR(tr("You are proceeding with low diskspace. Problems might occur!")));
+ break;
+ }
}
}
{
QString langId = action->data().toString();
- if(lamexp_install_translator(langId))
+ if(MUtils::Translation::install_translator(langId))
{
action->setChecked(true);
ui->actionLoadTranslationFromFile->setChecked(false);
{
QStringList selectedFiles = dialog.selectedFiles();
const QString qmFile = QFileInfo(selectedFiles.first()).canonicalFilePath();
- if(lamexp_install_translator_from_file(qmFile))
+ if(MUtils::Translation::install_translator_from_file(qmFile))
{
QList<QAction*> actions = m_languageActionGroup->actions();
while(!actions.isEmpty())
int result = 0;
QString selectedCueFile;
- if(lamexp_themes_enabled())
+ if(MUtils::GUI::themes_enabled())
{
selectedCueFile = QFileDialog::getOpenFileName(this, tr("Open Cue Sheet"), m_settings->mostRecentInputPath(), QString("%1 (*.cue)").arg(tr("Cue Sheet File")));
}
QTimer::singleShot(2500, m_dropBox, SLOT(showToolTip()));
}
- lamexp_blink_window(m_dropBox);
+ MUtils::GUI::blink_window(m_dropBox);
}
/*
ui->actionDisableShellIntegration->setChecked(!m_settings->shellIntegrationEnabled());
- if(lamexp_portable_mode() && ui->actionDisableShellIntegration->isChecked())
+ if(lamexp_version_portable() && ui->actionDisableShellIntegration->isChecked())
{
ui->actionDisableShellIntegration->setEnabled(false);
}
{
if(QAction *action = dynamic_cast<QAction*>(QObject::sender()))
{
- if(action->data().isValid() && (action->data().type() == QVariant::String))
- {
- QFileInfo document(action->data().toString());
- QFileInfo resource(QString(":/doc/%1.html").arg(document.baseName()));
- if(document.exists() && document.isFile() && (document.size() == resource.size()))
- {
- QDesktopServices::openUrl(QUrl::fromLocalFile(document.canonicalFilePath()));
- }
- else
- {
- QFile source(resource.filePath());
- 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());
- action->setData(output.fileName());
- source.close();
- output.close();
- QDesktopServices::openUrl(QUrl::fromLocalFile(output.fileName()));
- }
- }
- }
+ openDocumentLink(action);
}
}
TEMP_HIDE_DROPBOX
(
- if(lamexp_themes_enabled())
+ if(MUtils::GUI::themes_enabled())
{
QStringList fileTypeFilters = DecoderRegistry::getSupportedTypes();
QStringList selectedFiles = QFileDialog::getOpenFileNames(this, tr("Add file(s)"), m_settings->mostRecentInputPath(), fileTypeFilters.join(";;"));
{
TEMP_HIDE_DROPBOX
(
- if(lamexp_themes_enabled())
+ if(MUtils::GUI::themes_enabled())
{
selectedFolder = QFileDialog::getExistingDirectory(this, tr("Add Folder"), m_settings->mostRecentInputPath());
}
return;
}
- if(!lamexp_open_media_file(m_fileListModel->getFile(index).filePath()))
+ if(!MUtils::OS::open_media_file(m_fileListModel->getFile(index).filePath()))
{
qDebug("Player not found, falling back to default application...");
QDesktopServices::openUrl(QString("file:///").append(m_fileListModel->getFile(index).filePath()));
(
QString selectedCsvFile;
- if(lamexp_themes_enabled())
+ if(MUtils::GUI::themes_enabled())
{
selectedCsvFile = QFileDialog::getSaveFileName(this, tr("Save CSV file"), m_settings->mostRecentInputPath(), QString("%1 (*.csv)").arg(tr("CSV File")));
}
(
QString selectedCsvFile;
- if(lamexp_themes_enabled())
+ if(MUtils::GUI::themes_enabled())
{
selectedCsvFile = QFileDialog::getOpenFileName(this, tr("Open CSV file"), m_settings->mostRecentInputPath(), QString("%1 (*.csv)").arg(tr("CSV File")));
}
}
else
{
- lamexp_beep(lamexp_beep_error);
+ MUtils::Sound::beep(MUtils::Sound::BEEP_ERR);
m_outputFolderFavoritesMenu->removeAction(item);
item->deleteLater();
}
}
}
- suggestedName = lamexp_clean_filename(suggestedName);
+ suggestedName = MUtils::clean_file_name(suggestedName);
while(true)
{
if(bApplied)
{
- folderName = lamexp_clean_filepath(folderName.simplified());
+ folderName = MUtils::clean_file_path(folderName.simplified());
if(folderName.isEmpty())
{
- lamexp_beep(lamexp_beep_error);
+ MUtils::Sound::beep(MUtils::Sound::BEEP_ERR);
continue;
}
QString path = QDir::toNativeSeparators(m_fileSystemModel->filePath(ui->outputFolderView->currentIndex()));
if(!path.endsWith(QDir::separator())) path.append(QDir::separator());
- lamexp_exec_shell(this, path, true);
+ MUtils::OS::shell_open(this, path, true);
}
/*
}
else
{
- lamexp_beep(lamexp_beep_warning);
+ MUtils::Sound::beep(MUtils::Sound::BEEP_WRN);
}
CENTER_CURRENT_OUTPUT_FOLDER_DELAYED;
}
}
else
{
- lamexp_beep(lamexp_beep_warning);
+ MUtils::Sound::beep(MUtils::Sound::BEEP_WRN);
}
m_settings->favoriteOutputFolders(favorites.join("|"));
ui->outputFolderLabel->setVisible(true);
ui->outputFolderView->setEnabled(true);
- if(!ok) lamexp_beep(lamexp_beep_error);
+ if(!ok) MUtils::Sound::beep(MUtils::Sound::BEEP_ERR);
CENTER_CURRENT_OUTPUT_FOLDER_DELAYED;
}
{
QString path = ui->outputFolderLabel->text();
if(!path.endsWith(QDir::separator())) path.append(QDir::separator());
- lamexp_exec_shell(this, path, true);
+ MUtils::OS::shell_open(this, path, true);
}
break;
case QEvent::Enter:
}
else
{
- THROW("Oups, this is not supposed to happen!");
+ MUTILS_THROW("Oups, this is not supposed to happen!");
}
}
}
if(ui->radioButtonModeQuality->isEnabled()) ui->radioButtonModeQuality->setChecked(true);
else if(ui->radioButtonModeAverageBitrate->isEnabled()) ui->radioButtonModeAverageBitrate->setChecked(true);
else if(ui->radioButtonConstBitrate->isEnabled()) ui->radioButtonConstBitrate->setChecked(true);
- else THROW("It appears that the encoder does not support *any* RC mode!");
+ else MUTILS_THROW("It appears that the encoder does not support *any* RC mode!");
//Apply current RC mode
const int currentRCMode = EncoderRegistry::loadEncoderMode(m_settings, id);
case SettingsModel::VBRMode: if(ui->radioButtonModeQuality->isEnabled()) ui->radioButtonModeQuality->setChecked(true); break;
case SettingsModel::ABRMode: if(ui->radioButtonModeAverageBitrate->isEnabled()) ui->radioButtonModeAverageBitrate->setChecked(true); break;
case SettingsModel::CBRMode: if(ui->radioButtonConstBitrate->isEnabled()) ui->radioButtonConstBitrate->setChecked(true); break;
- default: THROW("updateEncoder(): Unknown rc-mode encountered!");
+ default: MUTILS_THROW("updateEncoder(): Unknown rc-mode encountered!");
}
//Display encoder description
ui->labelBitrate->setText(tr("Uncompressed"));
break;
default:
- THROW("Unknown display value type encountered!");
+ MUTILS_THROW("Unknown display value type encountered!");
break;
}
}
void MainWindow::normalizationEnabledChanged(bool checked)
{
m_settings->normalizationFilterEnabled(checked);
+ normalizationDynamicChanged(ui->checkBoxNormalizationFilterDynamic->isChecked());
+}
+
+/*
+ * Dynamic normalization enabled changed
+ */
+void MainWindow::normalizationDynamicChanged(bool checked)
+{
+ ui->spinBoxNormalizationFilterSize->setEnabled(ui->checkBoxNormalizationFilterEnabled->isChecked() && checked);
+ m_settings->normalizationFilterDynamic(checked);
}
/*
/*
* Normalization equalization mode changed
*/
-void MainWindow::normalizationModeChanged(int mode)
+void MainWindow::normalizationCoupledChanged(bool checked)
+{
+ m_settings->normalizationFilterCoupled(checked);
+}
+
+/*
+ * Normalization filter size changed
+ */
+void MainWindow::normalizationFilterSizeChanged(int value)
{
- m_settings->normalizationFilterEQMode(mode);
+ m_settings->normalizationFilterSize(value);
+}
+
+/*
+ * Normalization filter size editing finished
+ */
+void MainWindow::normalizationFilterSizeFinished(void)
+{
+ const int value = ui->spinBoxNormalizationFilterSize->value();
+ if((value % 2) != 1)
+ {
+ bool rnd = MUtils::parity(MUtils::next_rand32());
+ ui->spinBoxNormalizationFilterSize->setValue(rnd ? value+1 : value-1);
+ }
}
/*
pattern.replace("<Year>", "2001", Qt::CaseInsensitive);
pattern.replace("<Comment>", "Encoded by LameXP", Qt::CaseInsensitive);
- const QString patternClean = lamexp_clean_filename(pattern);
+ const QString patternClean = MUtils::clean_file_name(pattern);
if(pattern.compare(patternClean))
{
if(ui->lineEditRenamePattern->palette().color(QPalette::Text) != Qt::red)
{
- if(!silent) lamexp_beep(lamexp_beep_error);
+ if(!silent) MUtils::Sound::beep(MUtils::Sound::BEEP_ERR);
SET_TEXT_COLOR(ui->lineEditRenamePattern, Qt::red);
}
}
{
if(ui->lineEditRenamePattern->palette() != QPalette())
{
- if(!silent) lamexp_beep(lamexp_beep_info);
+ if(!silent) MUtils::Sound::beep(MUtils::Sound::BEEP_NFO);
ui->lineEditRenamePattern->setPalette(QPalette());
}
}
{
QString newTempFolder;
- if(lamexp_themes_enabled())
+ if(MUtils::GUI::themes_enabled())
{
newTempFolder = QFileDialog::getExistingDirectory(this, QString(), m_settings->customTempPath());
}
case SettingsModel::AAC_ENCODER_QAAC: showCustomParamsHelpScreen("qaac.exe", "--help"); break;
case SettingsModel::AAC_ENCODER_FHG : showCustomParamsHelpScreen("fhgaacenc.exe", ""); break;
case SettingsModel::AAC_ENCODER_NERO: showCustomParamsHelpScreen("neroAacEnc.exe", "-help"); break;
- default: lamexp_beep(lamexp_beep_error); break;
+ default: MUtils::Sound::beep(MUtils::Sound::BEEP_ERR); break;
}
}
else if(obj == ui->helpCustomParamFLAC) showCustomParamsHelpScreen("flac.exe", "--help");
else if(obj == ui->helpCustomParamAften) showCustomParamsHelpScreen("aften.exe", "-h");
else if(obj == ui->helpCustomParamOpus) showCustomParamsHelpScreen("opusenc.exe", "--help");
- else lamexp_beep(lamexp_beep_error);
+ else MUtils::Sound::beep(MUtils::Sound::BEEP_ERR);
}
/*
*/
void MainWindow::showCustomParamsHelpScreen(const QString &toolName, const QString &command)
{
- const QString binary = lamexp_lookup_tool(toolName);
+ const QString binary = lamexp_tools_lookup(toolName);
if(binary.isEmpty())
{
- lamexp_beep(lamexp_beep_error);
+ MUtils::Sound::beep(MUtils::Sound::BEEP_ERR);
qWarning("customParamsHelpRequested: Binary could not be found!");
return;
}
if(output.count() < 1)
{
qWarning("Empty output, cannot show help screen!");
- lamexp_beep(lamexp_beep_error);
+ MUtils::Sound::beep(MUtils::Sound::BEEP_ERR);
}
LogViewDialog *dialog = new LogViewDialog(this);
{
PLAY_SOUND_OPTIONAL("blast", true);
- ui->sliderLameAlgoQuality->setValue(m_settings->lameAlgoQualityDefault());
- ui->spinBoxBitrateManagementMin->setValue(m_settings->bitrateManagementMinRateDefault());
- ui->spinBoxBitrateManagementMax->setValue(m_settings->bitrateManagementMaxRateDefault());
- ui->spinBoxNormalizationFilter->setValue(static_cast<double>(m_settings->normalizationFilterMaxVolumeDefault()) / 100.0);
- ui->spinBoxToneAdjustBass->setValue(static_cast<double>(m_settings->toneAdjustBassDefault()) / 100.0);
- ui->spinBoxToneAdjustTreble->setValue(static_cast<double>(m_settings->toneAdjustTrebleDefault()) / 100.0);
- ui->spinBoxAftenSearchSize->setValue(m_settings->aftenExponentSearchSizeDefault());
- ui->spinBoxOpusComplexity->setValue(m_settings->opusComplexityDefault());
- ui->comboBoxMP3ChannelMode->setCurrentIndex(m_settings->lameChannelModeDefault());
- ui->comboBoxSamplingRate->setCurrentIndex(m_settings->samplingRateDefault());
- ui->comboBoxAACProfile->setCurrentIndex(m_settings->aacEncProfileDefault());
- ui->comboBoxAftenCodingMode->setCurrentIndex(m_settings->aftenAudioCodingModeDefault());
- ui->comboBoxAftenDRCMode->setCurrentIndex(m_settings->aftenDynamicRangeCompressionDefault());
- ui->comboBoxNormalizationMode->setCurrentIndex(m_settings->normalizationFilterEQModeDefault());
- ui->comboBoxOpusFramesize->setCurrentIndex(m_settings->opusFramesizeDefault());
-
- SET_CHECKBOX_STATE(ui->checkBoxBitrateManagement, m_settings->bitrateManagementEnabledDefault());
- SET_CHECKBOX_STATE(ui->checkBoxNeroAAC2PassMode, m_settings->neroAACEnable2PassDefault());
- SET_CHECKBOX_STATE(ui->checkBoxNormalizationFilter, m_settings->normalizationFilterEnabledDefault());
- SET_CHECKBOX_STATE(ui->checkBoxAutoDetectInstances, (m_settings->maximumInstancesDefault() < 1));
- SET_CHECKBOX_STATE(ui->checkBoxUseSystemTempFolder, !m_settings->customTempPathEnabledDefault());
- SET_CHECKBOX_STATE(ui->checkBoxAftenFastAllocation, m_settings->aftenFastBitAllocationDefault());
- SET_CHECKBOX_STATE(ui->checkBoxRenameOutput, m_settings->renameOutputFilesEnabledDefault());
- SET_CHECKBOX_STATE(ui->checkBoxForceStereoDownmix, m_settings->forceStereoDownmixDefault());
- SET_CHECKBOX_STATE(ui->checkBoxOpusDisableResample, m_settings->opusDisableResampleDefault());
+ ui->sliderLameAlgoQuality ->setValue(m_settings->lameAlgoQualityDefault());
+ ui->spinBoxBitrateManagementMin ->setValue(m_settings->bitrateManagementMinRateDefault());
+ ui->spinBoxBitrateManagementMax ->setValue(m_settings->bitrateManagementMaxRateDefault());
+ ui->spinBoxNormalizationFilterPeak->setValue(static_cast<double>(m_settings->normalizationFilterMaxVolumeDefault()) / 100.0);
+ ui->spinBoxNormalizationFilterSize->setValue(m_settings->normalizationFilterSizeDefault());
+ ui->spinBoxToneAdjustBass ->setValue(static_cast<double>(m_settings->toneAdjustBassDefault()) / 100.0);
+ ui->spinBoxToneAdjustTreble ->setValue(static_cast<double>(m_settings->toneAdjustTrebleDefault()) / 100.0);
+ ui->spinBoxAftenSearchSize ->setValue(m_settings->aftenExponentSearchSizeDefault());
+ ui->spinBoxOpusComplexity ->setValue(m_settings->opusComplexityDefault());
+ ui->comboBoxMP3ChannelMode ->setCurrentIndex(m_settings->lameChannelModeDefault());
+ ui->comboBoxSamplingRate ->setCurrentIndex(m_settings->samplingRateDefault());
+ ui->comboBoxAACProfile ->setCurrentIndex(m_settings->aacEncProfileDefault());
+ ui->comboBoxAftenCodingMode ->setCurrentIndex(m_settings->aftenAudioCodingModeDefault());
+ ui->comboBoxAftenDRCMode ->setCurrentIndex(m_settings->aftenDynamicRangeCompressionDefault());
+ ui->comboBoxOpusFramesize ->setCurrentIndex(m_settings->opusFramesizeDefault());
+
+ SET_CHECKBOX_STATE(ui->checkBoxBitrateManagement, m_settings->bitrateManagementEnabledDefault());
+ SET_CHECKBOX_STATE(ui->checkBoxNeroAAC2PassMode, m_settings->neroAACEnable2PassDefault());
+ SET_CHECKBOX_STATE(ui->checkBoxNormalizationFilterEnabled, m_settings->normalizationFilterEnabledDefault());
+ SET_CHECKBOX_STATE(ui->checkBoxNormalizationFilterDynamic, m_settings->normalizationFilterDynamicDefault());
+ SET_CHECKBOX_STATE(ui->checkBoxNormalizationFilterCoupled, m_settings->normalizationFilterCoupledDefault());
+ SET_CHECKBOX_STATE(ui->checkBoxAutoDetectInstances, (m_settings->maximumInstancesDefault() < 1));
+ SET_CHECKBOX_STATE(ui->checkBoxUseSystemTempFolder, (!m_settings->customTempPathEnabledDefault()));
+ SET_CHECKBOX_STATE(ui->checkBoxAftenFastAllocation, m_settings->aftenFastBitAllocationDefault());
+ SET_CHECKBOX_STATE(ui->checkBoxRenameOutput, m_settings->renameOutputFilesEnabledDefault());
+ SET_CHECKBOX_STATE(ui->checkBoxForceStereoDownmix, m_settings->forceStereoDownmixDefault());
+ SET_CHECKBOX_STATE(ui->checkBoxOpusDisableResample, m_settings->opusDisableResampleDefault());
ui->lineEditCustomParamLAME ->setText(m_settings->customParametersLAMEDefault());
ui->lineEditCustomParamOggEnc ->setText(m_settings->customParametersOggEncDefault());