///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End
-// Copyright (C) 2004-2013 LoRd_MuldeR <MuldeR2@GMX.de>
+// Copyright (C) 2004-2014 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 "Dialog_MainWindow.h"
//UIC includes
-#include "../tmp/UIC_MainWindow.h"
+#include "UIC_MainWindow.h"
//LameXP includes
#include "Global.h"
-#include "Resource.h"
#include "Dialog_WorkingBanner.h"
#include "Dialog_MetaInfo.h"
#include "Dialog_About.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>
#define ABORT_IF_BUSY do \
{ \
- if(BANNER_VISIBLE || m_delayedFileTimer->isActive()) \
+ if(BANNER_VISIBLE || m_delayedFileTimer->isActive() || (QApplication::activeModalWidget() != NULL)) \
{ \
lamexp_beep(lamexp_beep_warning); \
return; \
{ \
QItemSelectionModel *_tmp = (VIEW)->selectionModel(); \
(VIEW)->setModel(MODEL); \
- LAMEXP_DELETE(_tmp); \
+ MUTILS_DELETE(_tmp); \
} \
while(0)
} \
while(0)
+#define PLAY_SOUND_OPTIONAL(NAME, ASYNC) do \
+{ \
+ if(m_settings->soundsEnabled()) lamexp_play_sound((NAME), (ASYNC)); \
+} \
+while(0)
+
+#define SHOW_CORNER_WIDGET(FLAG) do \
+{ \
+ if(QWidget *cornerWidget = ui->menubar->cornerWidget()) \
+ { \
+ cornerWidget->setVisible((FLAG)); \
+ } \
+} \
+while(0)
+
#define LINK(URL) QString("<a href=\"%1\">%2</a>").arg(URL).arg(QString(URL).replace("-", "−"))
#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
//Enabled main buttons
connect(ui->buttonAbout, SIGNAL(clicked()), this, SLOT(aboutButtonClicked()));
connect(ui->buttonStart, SIGNAL(clicked()), this, SLOT(encodeButtonClicked()));
- connect(ui->buttonQuit, SIGNAL(clicked()), this, SLOT(closeButtonClicked()));
+ connect(ui->buttonQuit, SIGNAL(clicked()), this, SLOT(closeButtonClicked()));
//Setup tab widget
ui->tabWidget->setCurrentIndex(0);
//Add system menu
lamexp_append_sysmenu(this, IDM_ABOUTBOX, "About...");
+ //Setup corner widget
+ QLabel *cornerWidget = new QLabel(ui->menubar);
+ m_evenFilterCornerWidget = new CustomEventFilter;
+ cornerWidget->setText("N/A");
+ cornerWidget->setFixedHeight(ui->menubar->height());
+ cornerWidget->setCursor(QCursor(Qt::PointingHandCursor));
+ cornerWidget->hide();
+ cornerWidget->installEventFilter(m_evenFilterCornerWidget);
+ connect(m_evenFilterCornerWidget, SIGNAL(eventOccurred(QWidget*, QEvent*)), this, SLOT(cornerWidgetEventOccurred(QWidget*, QEvent*)));
+ ui->menubar->setCornerWidget(cornerWidget);
+
//--------------------------------
// Setup "Source" tab
//--------------------------------
m_exportCsvContextAction = m_sourceFilesContextMenu->addAction(QIcon(":/icons/table_save.png"), "N/A");
m_importCsvContextAction = m_sourceFilesContextMenu->addAction(QIcon(":/icons/folder_table.png"), "N/A");
SET_FONT_BOLD(m_showDetailsContextAction, true);
- connect(ui->buttonAddFiles, SIGNAL(clicked()), this, SLOT(addFilesButtonClicked()));
- connect(ui->buttonRemoveFile, SIGNAL(clicked()), this, SLOT(removeFileButtonClicked()));
- connect(ui->buttonClearFiles, SIGNAL(clicked()), this, SLOT(clearFilesButtonClicked()));
- connect(ui->buttonFileUp, SIGNAL(clicked()), this, SLOT(fileUpButtonClicked()));
- connect(ui->buttonFileDown, SIGNAL(clicked()), this, SLOT(fileDownButtonClicked()));
- connect(ui->buttonShowDetails, SIGNAL(clicked()), this, SLOT(showDetailsButtonClicked()));
- connect(m_fileListModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(sourceModelChanged()));
- connect(m_fileListModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(sourceModelChanged()));
- connect(m_fileListModel, SIGNAL(modelReset()), this, SLOT(sourceModelChanged()));
- connect(ui->sourceFileView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(sourceFilesContextMenu(QPoint)));
- connect(ui->sourceFileView->verticalScrollBar(), SIGNAL(sliderMoved(int)), this, SLOT(sourceFilesScrollbarMoved(int)));
- connect(ui->sourceFileView->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(sourceFilesScrollbarMoved(int)));
- 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()));
- connect(m_exportCsvContextAction, SIGNAL(triggered(bool)), this, SLOT(exportCsvContextActionTriggered()));
- connect(m_importCsvContextAction, SIGNAL(triggered(bool)), this, SLOT(importCsvContextActionTriggered()));
+
+ connect(ui->buttonAddFiles, SIGNAL(clicked()), this, SLOT(addFilesButtonClicked()));
+ connect(ui->buttonRemoveFile, SIGNAL(clicked()), this, SLOT(removeFileButtonClicked()));
+ connect(ui->buttonClearFiles, SIGNAL(clicked()), this, SLOT(clearFilesButtonClicked()));
+ connect(ui->buttonFileUp, SIGNAL(clicked()), this, SLOT(fileUpButtonClicked()));
+ connect(ui->buttonFileDown, SIGNAL(clicked()), this, SLOT(fileDownButtonClicked()));
+ connect(ui->buttonShowDetails, SIGNAL(clicked()), this, SLOT(showDetailsButtonClicked()));
+ connect(m_fileListModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(sourceModelChanged()));
+ connect(m_fileListModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(sourceModelChanged()));
+ connect(m_fileListModel, SIGNAL(modelReset()), this, SLOT(sourceModelChanged()));
+ connect(ui->sourceFileView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(sourceFilesContextMenu(QPoint)));
+ connect(ui->sourceFileView->verticalScrollBar(), SIGNAL(sliderMoved(int)), this, SLOT(sourceFilesScrollbarMoved(int)));
+ connect(ui->sourceFileView->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(sourceFilesScrollbarMoved(int)));
+ 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()));
+ connect(m_exportCsvContextAction, SIGNAL(triggered(bool)), this, SLOT(exportCsvContextActionTriggered()));
+ connect(m_importCsvContextAction, SIGNAL(triggered(bool)), this, SLOT(importCsvContextActionTriggered()));
//--------------------------------
// Setup "Output" tab
m_encoderButtonGroup->addButton(ui->radioButtonEncoderAAC, SettingsModel::AACEncoder);
m_encoderButtonGroup->addButton(ui->radioButtonEncoderAC3, SettingsModel::AC3Encoder);
m_encoderButtonGroup->addButton(ui->radioButtonEncoderFLAC, SettingsModel::FLACEncoder);
+ m_encoderButtonGroup->addButton(ui->radioButtonEncoderAPE, SettingsModel::MACEncoder);
m_encoderButtonGroup->addButton(ui->radioButtonEncoderOpus, SettingsModel::OpusEncoder);
m_encoderButtonGroup->addButton(ui->radioButtonEncoderDCA, SettingsModel::DCAEncoder);
m_encoderButtonGroup->addButton(ui->radioButtonEncoderPCM, SettingsModel::PCMEncoder);
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_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();
}
if(updateDialog->getSuccess())
{
+ SHOW_CORNER_WIDGET(false);
m_settings->autoUpdateLastCheck(QDate::currentDate().toString(Qt::ISODate));
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();
*/
void MainWindow::changeEvent(QEvent *e)
{
- if(e->type() == QEvent::LanguageChange)
+ QMainWindow::changeEvent(e);
+ if(e->type() != QEvent::LanguageChange)
{
- /*qWarning("\nMainWindow::changeEvent()\n");*/
+ return;
+ }
- int comboBoxIndex[8];
+ int comboBoxIndex[8];
- //Backup combobox indices, as retranslateUi() resets
- comboBoxIndex[0] = ui->comboBoxMP3ChannelMode->currentIndex();
- comboBoxIndex[1] = ui->comboBoxSamplingRate->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();
+ //Backup combobox indices, as retranslateUi() resets
+ comboBoxIndex[0] = ui->comboBoxMP3ChannelMode->currentIndex();
+ comboBoxIndex[1] = ui->comboBoxSamplingRate->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();
- //Re-translate from UIC
- ui->retranslateUi(this);
-
- //Restore combobox indices
- ui->comboBoxMP3ChannelMode->setCurrentIndex(comboBoxIndex[0]);
- ui->comboBoxSamplingRate->setCurrentIndex(comboBoxIndex[1]);
- 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]);
-
- //Update the window title
- if(LAMEXP_DEBUG)
- {
- setWindowTitle(QString("%1 [!!! DEBUG BUILD !!!]").arg(windowTitle()));
- }
- else if(lamexp_version_demo())
- {
- setWindowTitle(QString("%1 [%2]").arg(windowTitle(), tr("DEMO VERSION")));
- }
+ //Re-translate from UIC
+ ui->retranslateUi(this);
+
+ //Restore combobox indices
+ ui->comboBoxMP3ChannelMode->setCurrentIndex(comboBoxIndex[0]);
+ ui->comboBoxSamplingRate->setCurrentIndex(comboBoxIndex[1]);
+ 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]);
+
+ //Update the window title
+ if(MUTILS_DEBUG)
+ {
+ setWindowTitle(QString("%1 [!!! DEBUG BUILD !!!]").arg(windowTitle()));
+ }
+ else if(lamexp_version_demo())
+ {
+ setWindowTitle(QString("%1 [%2]").arg(windowTitle(), tr("DEMO VERSION")));
+ }
+
+ //Manually re-translate widgets that UIC doesn't handle
+ m_outputFolderNoteBox->setText(tr("Initializing directory outline, please be patient..."));
+ m_dropNoteLabel->setText(QString("<br><img src=\":/images/DropZone.png\"><br><br>%1").arg(tr("You can drop in audio files here!")));
+ if(QLabel *cornerWidget = dynamic_cast<QLabel*>(ui->menubar->cornerWidget()))
+ {
+ cornerWidget->setText(QString("<nobr><img src=\":/icons/exclamation_small.png\"> <b style=\"color:darkred\">%1</b> </nobr>").arg(tr("Check for Updates")));
+ }
+ 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"));
+ m_refreshFolderContextAction->setText(tr("Refresh Directory Outline"));
+ m_goUpFolderContextAction->setText(tr("Go To Parent Directory"));
+ m_addFavoriteFolderAction->setText(tr("Bookmark Current Output Folder"));
+ m_exportCsvContextAction->setText(tr("Export Meta Tags to CSV File"));
+ m_importCsvContextAction->setText(tr("Import Meta Tags from CSV File"));
+
+ //Force GUI update
+ m_metaInfoModel->clearData();
+ m_metaInfoModel->setData(m_metaInfoModel->index(4, 1), m_settings->metaInfoPosition());
+ updateEncoder(m_settings->compressionEncoder());
+ updateLameAlgoQuality(ui->sliderLameAlgoQuality->value());
+ updateMaximumInstances(ui->sliderMaxInstances->value());
+ renameOutputPatternChanged(ui->lineEditRenamePattern->text(), true);
+
+ //Re-install shell integration
+ if(m_settings->shellIntegrationEnabled())
+ {
+ ShellIntegration::install();
+ }
- //Manually re-translate widgets that UIC doesn't handle
- m_outputFolderNoteBox->setText(tr("Initializing directory outline, please be patient..."));
- m_dropNoteLabel->setText(QString("<br><img src=\":/images/DropZone.png\"><br><br>%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"));
- m_refreshFolderContextAction->setText(tr("Refresh Directory Outline"));
- m_goUpFolderContextAction->setText(tr("Go To Parent Directory"));
- m_addFavoriteFolderAction->setText(tr("Bookmark Current Output Folder"));
- m_exportCsvContextAction->setText(tr("Export Meta Tags to CSV File"));
- m_importCsvContextAction->setText(tr("Import Meta Tags from CSV File"));
-
- //Force GUI update
- m_metaInfoModel->clearData();
- m_metaInfoModel->setData(m_metaInfoModel->index(4, 1), m_settings->metaInfoPosition());
- updateEncoder(m_settings->compressionEncoder());
- updateLameAlgoQuality(ui->sliderLameAlgoQuality->value());
- updateMaximumInstances(ui->sliderMaxInstances->value());
- renameOutputPatternChanged(ui->lineEditRenamePattern->text(), true);
-
- //Re-install shell integration
- if(m_settings->shellIntegrationEnabled())
+ //Translate system menu
+ lamexp_update_sysmenu(this, IDM_ABOUTBOX, ui->buttonAbout->text());
+
+ //Force resize event
+ QApplication::postEvent(this, new QResizeEvent(this->size(), QSize()));
+ for(QObjectList::ConstIterator iter = this->children().constBegin(); iter != this->children().constEnd(); iter++)
+ {
+ if(QWidget *child = dynamic_cast<QWidget*>(*iter))
{
- ShellIntegration::install();
+ QApplication::postEvent(child, new QResizeEvent(child->size(), QSize()));
}
-
- //Translate system menu
- lamexp_update_sysmenu(this, IDM_ABOUTBOX, ui->buttonAbout->text());
-
- //Force resize, if needed
- tabPageChanged(ui->tabWidget->currentIndex(), true);
}
+
+ //Force tabe page change
+ tabPageChanged(ui->tabWidget->currentIndex(), true);
}
/*
(*m_droppedFileList) << event->mimeData()->urls();
if(!m_droppedFileList->isEmpty())
{
- if(m_settings->soundsEnabled()) lamexp_play_sound(IDR_WAVE_DROP, true);
+ PLAY_SOUND_OPTIONAL("drop", true);
QTimer::singleShot(0, this, SLOT(handleDroppedFiles()));
}
}
m_dropNoteLabel->setGeometry(port->geometry());
}
- if (QWidget *port = ui->outputFolderView->viewport())
+ if(QWidget *port = ui->outputFolderView->viewport())
{
m_outputFolderNoteBox->setGeometry(16, (port->height() - 64) / 2, port->width() - 32, 64);
}
{
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)
m_settings->licenseAccepted(++iAccepted);
m_settings->syncNow();
QApplication::processEvents();
- lamexp_play_sound(IDR_WAVE_WHAMMY, false);
+ lamexp_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())
return;
}
- lamexp_play_sound(IDR_WAVE_WOOHOO, false);
+ lamexp_play_sound("woohoo", false);
m_settings->licenseAccepted(1);
m_settings->syncNow();
if(lamexp_version_demo()) showAnnounceBox();
//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(IDR_WAVE_WHAMMY, false);
+ lamexp_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();
}
//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);
int ret = QMessageBox::warning(this, tr("Urgent Update"), NOBR(tr("Your version of LameXP is more than a year old. Time for an update!")), tr("Check for Updates"), tr("Exit Program"), tr("Ignore"));
switch(ret)
{
return;
default:
QEventLoop loop; QTimer::singleShot(7000, &loop, SLOT(quit()));
- lamexp_play_sound(IDR_WAVE_WAITING, true);
+ lamexp_play_sound("waiting", true);
SHOW_BANNER_ARG(tr("Skipping update check this time, please be patient..."), &loop);
break;
}
}
- else if(m_settings->autoUpdateEnabled())
+ 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))))
{
- if(QMessageBox::information(this, tr("Update Reminder"), NOBR(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)
+ SHOW_CORNER_WIDGET(true);
+ if(m_settings->autoUpdateEnabled())
{
- if(checkForUpdates())
+ if(QMessageBox::information(this, tr("Update Reminder"), NOBR(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)
{
- QApplication::quit();
- return;
+ if(checkForUpdates())
+ {
+ QApplication::quit();
+ return;
+ }
}
}
}
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)
{
QStringList tempFolderParts = tempFolder.split("/", QString::SkipEmptyParts, Qt::CaseInsensitive);
tempFolderParts.takeLast();
- if(m_settings->soundsEnabled()) lamexp_play_sound(IDR_WAVE_WHAMMY, false);
+ 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))),
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;
case SettingsModel::FLACEncoder:
case SettingsModel::OpusEncoder:
case SettingsModel::DCAEncoder:
+ case SettingsModel::MACEncoder:
case SettingsModel::PCMEncoder:
break;
default:
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);
);
}
}
//Play tick sound
- if(m_settings->soundsEnabled() && (!silent))
+ if(!silent)
{
- lamexp_play_sound(IDR_WAVE_TICK, true);
+ PLAY_SOUND_OPTIONAL("tick", true);
}
int initialWidth = this->width();
}
// =========================================================
+// Menubar slots
+// =========================================================
+
+/*
+ * Handle corner widget Event
+ */
+void MainWindow::cornerWidgetEventOccurred(QWidget *sender, QEvent *event)
+{
+ if(event->type() == QEvent::MouseButtonPress)
+ {
+ QTimer::singleShot(0, this, SLOT(checkUpdatesActionActivated()));
+ }
+}
+
+// =========================================================
// View menu slots
// =========================================================
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();
}
}
else if((sender == ui->labelResetEncoders) && (event->type() == QEvent::MouseButtonPress))
{
- if(m_settings->soundsEnabled())
- {
- lamexp_play_sound(IDR_WAVE_BLAST, true);
- }
-
+ PLAY_SOUND_OPTIONAL("blast", true);
EncoderRegistry::resetAllEncoders(m_settings);
m_settings->compressionEncoder(SettingsModel::MP3Encoder);
ui->radioButtonEncoderMP3->setChecked(true);
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)
*/
void MainWindow::resetAdvancedOptionsButtonClicked(void)
{
- if(m_settings->soundsEnabled())
- {
- lamexp_play_sound(IDR_WAVE_BLAST, true);
- }
+ PLAY_SOUND_OPTIONAL("blast", true);
ui->sliderLameAlgoQuality->setValue(m_settings->lameAlgoQualityDefault());
ui->spinBoxBitrateManagementMin->setValue(m_settings->bitrateManagementMinRateDefault());
{
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);
}