From ea34f7b7e57945d8d0044d6061f8598246dd68b5 Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Fri, 22 May 2015 19:37:45 +0200 Subject: [PATCH] Some code clean-up. --- etc/Translation/Blank.ts | 6 +- etc/Translation/LameXP_DE.ts | 10 +- etc/Translation/LameXP_ES.ts | 6 +- etc/Translation/LameXP_FR.ts | 6 +- etc/Translation/LameXP_HU.ts | 6 +- etc/Translation/LameXP_IT.ts | 6 +- etc/Translation/LameXP_KR.ts | 6 +- etc/Translation/LameXP_PL.ts | 6 +- etc/Translation/LameXP_RU.ts | 6 +- etc/Translation/LameXP_SV.ts | 6 +- etc/Translation/LameXP_TW.ts | 6 +- etc/Translation/LameXP_UK.ts | 6 +- etc/Translation/LameXP_ZH.ts | 6 +- res/localization/LameXP_DE.qm | Bin 88941 -> 89146 bytes src/Config.h | 2 +- src/Dialog_MainWindow.cpp | 245 ++++++++++++++++------------------ src/Dialog_MainWindow.h | 37 ++--- src/Registry_Decoder.cpp | 22 ++- 18 files changed, 197 insertions(+), 191 deletions(-) diff --git a/etc/Translation/Blank.ts b/etc/Translation/Blank.ts index 3961eff8..6d81f26b 100644 --- a/etc/Translation/Blank.ts +++ b/etc/Translation/Blank.ts @@ -708,17 +708,17 @@ DecoderRegistry - + All supported types - + Playlists - + All files diff --git a/etc/Translation/LameXP_DE.ts b/etc/Translation/LameXP_DE.ts index aaab7d00..b4d3cfc3 100644 --- a/etc/Translation/LameXP_DE.ts +++ b/etc/Translation/LameXP_DE.ts @@ -711,17 +711,17 @@ DecoderRegistry - + All supported types Alle unterstützten Dateitypen - + All files Alle Dateien - + Playlists Wiedergabelisten @@ -1509,12 +1509,12 @@ Filter Files - + Dateinamen Filtern Select filename filter: - + Dateinamen-Filter auswählen: diff --git a/etc/Translation/LameXP_ES.ts b/etc/Translation/LameXP_ES.ts index de0dfc65..e212fafe 100644 --- a/etc/Translation/LameXP_ES.ts +++ b/etc/Translation/LameXP_ES.ts @@ -712,17 +712,17 @@ DecoderRegistry - + All supported types Todos los archivos soportados - + All files Todos los archivos - + Playlists Listas de reproducción diff --git a/etc/Translation/LameXP_FR.ts b/etc/Translation/LameXP_FR.ts index 26f2c04a..e618a16c 100644 --- a/etc/Translation/LameXP_FR.ts +++ b/etc/Translation/LameXP_FR.ts @@ -715,17 +715,17 @@ DecoderRegistry - + All supported types Tous types supportés - + All files Tous les fichiers - + Playlists Listes de lecture diff --git a/etc/Translation/LameXP_HU.ts b/etc/Translation/LameXP_HU.ts index 31f6c184..53f7c0f4 100644 --- a/etc/Translation/LameXP_HU.ts +++ b/etc/Translation/LameXP_HU.ts @@ -708,17 +708,17 @@ DecoderRegistry - + All supported types Támogatott típusok - + Playlists Lejátszási listák - + All files Minden fájl diff --git a/etc/Translation/LameXP_IT.ts b/etc/Translation/LameXP_IT.ts index 1a0f4d0f..67ff2165 100644 --- a/etc/Translation/LameXP_IT.ts +++ b/etc/Translation/LameXP_IT.ts @@ -711,17 +711,17 @@ DecoderRegistry - + All supported types Tutti i tipi supportati - + All files Tutti i file - + Playlists Playlists diff --git a/etc/Translation/LameXP_KR.ts b/etc/Translation/LameXP_KR.ts index a5149b76..c12a1943 100644 --- a/etc/Translation/LameXP_KR.ts +++ b/etc/Translation/LameXP_KR.ts @@ -708,17 +708,17 @@ DecoderRegistry - + All supported types 모든 지원 파일 - + Playlists 재생 목록 - + All files 모든 파일 diff --git a/etc/Translation/LameXP_PL.ts b/etc/Translation/LameXP_PL.ts index 9be5dfe9..2a0dc687 100644 --- a/etc/Translation/LameXP_PL.ts +++ b/etc/Translation/LameXP_PL.ts @@ -714,17 +714,17 @@ DecoderRegistry - + All supported types Wszystkie obsługiwane pliki - + Playlists Playlisty - + All files Wszystkie pliki diff --git a/etc/Translation/LameXP_RU.ts b/etc/Translation/LameXP_RU.ts index 0377d41e..123930e6 100644 --- a/etc/Translation/LameXP_RU.ts +++ b/etc/Translation/LameXP_RU.ts @@ -719,17 +719,17 @@ DecoderRegistry - + All supported types Все поддерживаемые типы - + Playlists Плэйлисты - + All files Все файлы diff --git a/etc/Translation/LameXP_SV.ts b/etc/Translation/LameXP_SV.ts index 1bf331c1..14da7813 100644 --- a/etc/Translation/LameXP_SV.ts +++ b/etc/Translation/LameXP_SV.ts @@ -712,17 +712,17 @@ DecoderRegistry - + All supported types Alla typer som stöds - + Playlists Spelningslistor - + All files Alla filer diff --git a/etc/Translation/LameXP_TW.ts b/etc/Translation/LameXP_TW.ts index 900f352e..80ac1989 100644 --- a/etc/Translation/LameXP_TW.ts +++ b/etc/Translation/LameXP_TW.ts @@ -708,17 +708,17 @@ DecoderRegistry - + All supported types 所有受支持的類型 - + All files 所有文件 - + Playlists 播放列表 diff --git a/etc/Translation/LameXP_UK.ts b/etc/Translation/LameXP_UK.ts index 11cef6a3..d97d3b81 100644 --- a/etc/Translation/LameXP_UK.ts +++ b/etc/Translation/LameXP_UK.ts @@ -715,17 +715,17 @@ DecoderRegistry - + All supported types Всі підтримувані типи - + Playlists Списки відтворення - + All files Всі файли diff --git a/etc/Translation/LameXP_ZH.ts b/etc/Translation/LameXP_ZH.ts index 210d4e9f..149b8962 100644 --- a/etc/Translation/LameXP_ZH.ts +++ b/etc/Translation/LameXP_ZH.ts @@ -708,17 +708,17 @@ DecoderRegistry - + All supported types 所有支持的类型 - + All files 所有文件 - + Playlists 播放列表 diff --git a/res/localization/LameXP_DE.qm b/res/localization/LameXP_DE.qm index b52d1ea53f5c00c1d1180e996a2ac10a9a0f41e2..7c58ddf65a35b4c232c51d8a5fefe18cd30d0359 100644 GIT binary patch delta 4316 zcmX9>d0b8D8~?uNo^$U#=bn3yHjzrwLPSZCwM4cNWn_s+iW(xz*kv7ztsEI;kjPp} zVJwLxP1fxDl5LcqtuVyo_s}2r^W3w&@AG`0@AG}0_thcc=wTtzlHE$OYTUaF5c&iA z`T>DGfH8f6Uh%-JBS3HnSQ{50#0%Kd0vKcu^q}`f76C7ufcRj**{sf1pGlhQlJGtd ze3>(#=0XUhRWo})7)x*GwScga2acsc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kmCj?bf%74%Ya zS1%#IOII!=InwoIi&A{_2leQ1<*v#=_v$sutG^0v(4%NTwwCw+LF(dK- diff --git a/src/Config.h b/src/Config.h index 3086d88c..1f09ce8e 100644 --- a/src/Config.h +++ b/src/Config.h @@ -35,7 +35,7 @@ #define VER_LAMEXP_MINOR_LO 2 #define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_PATCH 4 -#define VER_LAMEXP_BUILD 1743 +#define VER_LAMEXP_BUILD 1745 #define VER_LAMEXP_CONFG 1700 /////////////////////////////////////////////////////////////////////////////// diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp index 5b502e40..72226dd2 100644 --- a/src/Dialog_MainWindow.cpp +++ b/src/Dialog_MainWindow.cpp @@ -89,9 +89,9 @@ #define INIT_BANNER() do \ { \ - if(m_banner == NULL) \ + if(m_banner.isNull()) \ { \ - m_banner = new WorkingBanner(this); \ + m_banner.reset(new WorkingBanner(this)); \ } \ } \ while(0) @@ -225,6 +225,15 @@ while(0) } \ while(0) +class FileListBlocker +{ +public: + FileListBlocker(FileListModel *const fileList) : m_fileList(fileList) { m_fileList->setBlockUpdates(true); } + ~FileListBlocker(void) { m_fileList->setBlockUpdates(false); } +private: + FileListModel *const m_fileList; +}; + #define LINK(URL) QString("%2").arg(URL).arg(QString(URL).replace("-", "−")) #define FSLINK(PATH) QString("%2").arg(PATH).arg(QString(PATH).replace("-", "−")) #define CENTER_CURRENT_OUTPUT_FOLDER_DELAYED QTimer::singleShot(125, this, SLOT(centerOutputFolderModel())) @@ -244,8 +253,6 @@ MainWindow::MainWindow(MUtils::IPCChannel *const ipcChannel, FileListModel *cons m_fileListModel(fileListModel), m_metaData(metaInfo), m_settings(settingsModel), - m_fileSystemModel(NULL), - m_banner(NULL), m_accepted(false), m_firstTimeShown(true), m_outputFolderViewCentering(false), @@ -275,13 +282,13 @@ MainWindow::MainWindow(MUtils::IPCChannel *const ipcChannel, FileListModel *cons //Setup corner widget QLabel *cornerWidget = new QLabel(ui->menubar); - m_evenFilterCornerWidget = new CustomEventFilter; + m_evenFilterCornerWidget.reset(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*))); + cornerWidget->installEventFilter(m_evenFilterCornerWidget.data()); + connect(m_evenFilterCornerWidget.data(), SIGNAL(eventOccurred(QWidget*, QEvent*)), this, SLOT(cornerWidgetEventOccurred(QWidget*, QEvent*))); ui->menubar->setCornerWidget(cornerWidget); //-------------------------------- @@ -298,12 +305,12 @@ MainWindow::MainWindow(MUtils::IPCChannel *const ipcChannel, FileListModel *cons SET_FONT_BOLD(m_dropNoteLabel, true); SET_TEXT_COLOR(m_dropNoteLabel, Qt::darkGray); m_sourceFilesContextMenu = new QMenu(); - 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"); + 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"); m_sourceFilesContextMenu->addSeparator(); - m_exportCsvContextAction = m_sourceFilesContextMenu->addAction(QIcon(":/icons/table_save.png"), "N/A"); - m_importCsvContextAction = m_sourceFilesContextMenu->addAction(QIcon(":/icons/folder_table.png"), "N/A"); + 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())); @@ -334,44 +341,44 @@ MainWindow::MainWindow(MUtils::IPCChannel *const ipcChannel, FileListModel *cons ui->outputFolderView->setContextMenuPolicy(Qt::CustomContextMenu); ui->outputFolderView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); - m_evenFilterOutputFolderMouse = new CustomEventFilter; - ui->outputFoldersGoUpLabel->installEventFilter(m_evenFilterOutputFolderMouse); - ui->outputFoldersEditorLabel->installEventFilter(m_evenFilterOutputFolderMouse); - ui->outputFoldersFovoritesLabel->installEventFilter(m_evenFilterOutputFolderMouse); - ui->outputFolderLabel->installEventFilter(m_evenFilterOutputFolderMouse); + m_evenFilterOutputFolderMouse.reset(new CustomEventFilter); + ui->outputFoldersGoUpLabel ->installEventFilter(m_evenFilterOutputFolderMouse.data()); + ui->outputFoldersEditorLabel ->installEventFilter(m_evenFilterOutputFolderMouse.data()); + ui->outputFoldersFovoritesLabel->installEventFilter(m_evenFilterOutputFolderMouse.data()); + ui->outputFolderLabel ->installEventFilter(m_evenFilterOutputFolderMouse.data()); - m_evenFilterOutputFolderView = new CustomEventFilter; - ui->outputFolderView->installEventFilter(m_evenFilterOutputFolderView); + m_evenFilterOutputFolderView.reset(new CustomEventFilter); + ui->outputFolderView->installEventFilter(m_evenFilterOutputFolderView.data()); SET_CHECKBOX_STATE(ui->saveToSourceFolderCheckBox, m_settings->outputToSourceDir()); ui->prependRelativePathCheckBox->setChecked(m_settings->prependRelativeSourcePath()); - connect(ui->outputFolderView, SIGNAL(clicked(QModelIndex)), this, SLOT(outputFolderViewClicked(QModelIndex))); - connect(ui->outputFolderView, SIGNAL(activated(QModelIndex)), this, SLOT(outputFolderViewClicked(QModelIndex))); - connect(ui->outputFolderView, SIGNAL(pressed(QModelIndex)), this, SLOT(outputFolderViewClicked(QModelIndex))); - connect(ui->outputFolderView, SIGNAL(entered(QModelIndex)), this, SLOT(outputFolderViewMoved(QModelIndex))); - connect(ui->outputFolderView, SIGNAL(expanded(QModelIndex)), this, SLOT(outputFolderItemExpanded(QModelIndex))); - connect(ui->buttonMakeFolder, SIGNAL(clicked()), this, SLOT(makeFolderButtonClicked())); - connect(ui->buttonGotoHome, SIGNAL(clicked()), SLOT(gotoHomeFolderButtonClicked())); - connect(ui->buttonGotoDesktop, SIGNAL(clicked()), this, SLOT(gotoDesktopButtonClicked())); - connect(ui->buttonGotoMusic, SIGNAL(clicked()), this, SLOT(gotoMusicFolderButtonClicked())); - connect(ui->saveToSourceFolderCheckBox, SIGNAL(clicked()), this, SLOT(saveToSourceFolderChanged())); - connect(ui->prependRelativePathCheckBox, SIGNAL(clicked()), this, SLOT(prependRelativePathChanged())); - connect(ui->outputFolderEdit, SIGNAL(editingFinished()), this, SLOT(outputFolderEditFinished())); - connect(m_evenFilterOutputFolderMouse, SIGNAL(eventOccurred(QWidget*, QEvent*)), this, SLOT(outputFolderMouseEventOccurred(QWidget*, QEvent*))); - connect(m_evenFilterOutputFolderView, SIGNAL(eventOccurred(QWidget*, QEvent*)), this, SLOT(outputFolderViewEventOccurred(QWidget*, QEvent*))); + connect(ui->outputFolderView, SIGNAL(clicked(QModelIndex)), this, SLOT(outputFolderViewClicked(QModelIndex))); + connect(ui->outputFolderView, SIGNAL(activated(QModelIndex)), this, SLOT(outputFolderViewClicked(QModelIndex))); + connect(ui->outputFolderView, SIGNAL(pressed(QModelIndex)), this, SLOT(outputFolderViewClicked(QModelIndex))); + connect(ui->outputFolderView, SIGNAL(entered(QModelIndex)), this, SLOT(outputFolderViewMoved(QModelIndex))); + connect(ui->outputFolderView, SIGNAL(expanded(QModelIndex)), this, SLOT(outputFolderItemExpanded(QModelIndex))); + connect(ui->buttonMakeFolder, SIGNAL(clicked()), this, SLOT(makeFolderButtonClicked())); + connect(ui->buttonGotoHome, SIGNAL(clicked()), this, SLOT(gotoHomeFolderButtonClicked())); + connect(ui->buttonGotoDesktop, SIGNAL(clicked()), this, SLOT(gotoDesktopButtonClicked())); + connect(ui->buttonGotoMusic, SIGNAL(clicked()), this, SLOT(gotoMusicFolderButtonClicked())); + connect(ui->saveToSourceFolderCheckBox, SIGNAL(clicked()), this, SLOT(saveToSourceFolderChanged())); + connect(ui->prependRelativePathCheckBox, SIGNAL(clicked()), this, SLOT(prependRelativePathChanged())); + connect(ui->outputFolderEdit, SIGNAL(editingFinished()), this, SLOT(outputFolderEditFinished())); + connect(m_evenFilterOutputFolderMouse.data(), SIGNAL(eventOccurred(QWidget*, QEvent*)), this, SLOT(outputFolderMouseEventOccurred(QWidget*, QEvent*))); + connect(m_evenFilterOutputFolderView.data(), SIGNAL(eventOccurred(QWidget*, QEvent*)), this, SLOT(outputFolderViewEventOccurred(QWidget*, QEvent*))); if(m_outputFolderContextMenu = new QMenu()) { - m_showFolderContextAction = m_outputFolderContextMenu->addAction(QIcon(":/icons/zoom.png"), "N/A"); - m_goUpFolderContextAction = m_outputFolderContextMenu->addAction(QIcon(":/icons/folder_up.png"), "N/A"); + m_showFolderContextAction = m_outputFolderContextMenu->addAction(QIcon(":/icons/zoom.png"), "N/A"); + m_goUpFolderContextAction = m_outputFolderContextMenu->addAction(QIcon(":/icons/folder_up.png"), "N/A"); m_outputFolderContextMenu->addSeparator(); m_refreshFolderContextAction = m_outputFolderContextMenu->addAction(QIcon(":/icons/arrow_refresh.png"), "N/A"); m_outputFolderContextMenu->setDefaultAction(m_showFolderContextAction); - connect(ui->outputFolderView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(outputFolderContextMenu(QPoint))); - connect(m_showFolderContextAction, SIGNAL(triggered(bool)), this, SLOT(showFolderContextActionTriggered())); - connect(m_refreshFolderContextAction, SIGNAL(triggered(bool)), this, SLOT(refreshFolderContextActionTriggered())); - connect(m_goUpFolderContextAction, SIGNAL(triggered(bool)), this, SLOT(goUpFolderContextActionTriggered())); + connect(ui->outputFolderView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(outputFolderContextMenu(QPoint))); + connect(m_showFolderContextAction, SIGNAL(triggered(bool)), this, SLOT(showFolderContextActionTriggered())); + connect(m_refreshFolderContextAction, SIGNAL(triggered(bool)), this, SLOT(refreshFolderContextActionTriggered())); + connect(m_goUpFolderContextAction, SIGNAL(triggered(bool)), this, SLOT(goUpFolderContextActionTriggered())); } if(m_outputFolderFavoritesMenu = new QMenu()) @@ -389,7 +396,6 @@ MainWindow::MainWindow(MUtils::IPCChannel *const ipcChannel, FileListModel *cons m_outputFolderNoteBox->setFrameShape(QFrame::StyledPanel); SET_FONT_BOLD(m_outputFolderNoteBox, true); m_outputFolderNoteBox->hide(); - } outputFolderViewClicked(QModelIndex()); @@ -399,42 +405,42 @@ MainWindow::MainWindow(MUtils::IPCChannel *const ipcChannel, FileListModel *cons // Setup "Meta Data" tab //-------------------------------- - m_metaInfoModel = new MetaInfoModel(m_metaData); + m_metaInfoModel.reset(new MetaInfoModel(m_metaData)); m_metaInfoModel->clearData(); m_metaInfoModel->setData(m_metaInfoModel->index(4, 1), m_settings->metaInfoPosition()); - ui->metaDataView->setModel(m_metaInfoModel); + ui->metaDataView->setModel(m_metaInfoModel.data()); ui->metaDataView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents); ui->metaDataView->verticalHeader()->hide(); ui->metaDataView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents); SET_CHECKBOX_STATE(ui->writeMetaDataCheckBox, m_settings->writeMetaTags()); ui->generatePlaylistCheckBox->setChecked(m_settings->createPlaylist()); - connect(ui->buttonEditMeta, SIGNAL(clicked()), this, SLOT(editMetaButtonClicked())); - connect(ui->buttonClearMeta, SIGNAL(clicked()), this, SLOT(clearMetaButtonClicked())); - connect(ui->writeMetaDataCheckBox, SIGNAL(clicked()), this, SLOT(metaTagsEnabledChanged())); + connect(ui->buttonEditMeta, SIGNAL(clicked()), this, SLOT(editMetaButtonClicked())); + connect(ui->buttonClearMeta, SIGNAL(clicked()), this, SLOT(clearMetaButtonClicked())); + connect(ui->writeMetaDataCheckBox, SIGNAL(clicked()), this, SLOT(metaTagsEnabledChanged())); connect(ui->generatePlaylistCheckBox, SIGNAL(clicked()), this, SLOT(playlistEnabledChanged())); //-------------------------------- //Setup "Compression" tab //-------------------------------- - m_encoderButtonGroup = new QButtonGroup(this); - m_encoderButtonGroup->addButton(ui->radioButtonEncoderMP3, SettingsModel::MP3Encoder); + m_encoderButtonGroup.reset(new QButtonGroup(this)); + m_encoderButtonGroup->addButton(ui->radioButtonEncoderMP3, SettingsModel::MP3Encoder); m_encoderButtonGroup->addButton(ui->radioButtonEncoderVorbis, SettingsModel::VorbisEncoder); - 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); + 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); const int aacEncoder = EncoderRegistry::getAacEncoder(); ui->radioButtonEncoderAAC->setEnabled(aacEncoder > SettingsModel::AAC_ENCODER_NONE); - m_modeButtonGroup = new QButtonGroup(this); - m_modeButtonGroup->addButton(ui->radioButtonModeQuality, SettingsModel::VBRMode); + m_modeButtonGroup.reset(new QButtonGroup(this)); + m_modeButtonGroup->addButton(ui->radioButtonModeQuality, SettingsModel::VBRMode); m_modeButtonGroup->addButton(ui->radioButtonModeAverageBitrate, SettingsModel::ABRMode); - m_modeButtonGroup->addButton(ui->radioButtonConstBitrate, SettingsModel::CBRMode); + m_modeButtonGroup->addButton(ui->radioButtonConstBitrate, SettingsModel::CBRMode); ui->radioButtonEncoderMP3->setChecked(true); foreach(QAbstractButton *currentButton, m_encoderButtonGroup->buttons()) @@ -446,14 +452,14 @@ MainWindow::MainWindow(MUtils::IPCChannel *const ipcChannel, FileListModel *cons } } - m_evenFilterCompressionTab = new CustomEventFilter(); - ui->labelCompressionHelp->installEventFilter(m_evenFilterCompressionTab); - ui->labelResetEncoders ->installEventFilter(m_evenFilterCompressionTab); + m_evenFilterCompressionTab.reset(new CustomEventFilter()); + ui->labelCompressionHelp->installEventFilter(m_evenFilterCompressionTab.data()); + ui->labelResetEncoders ->installEventFilter(m_evenFilterCompressionTab.data()); - connect(m_encoderButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(updateEncoder(int))); - connect(m_modeButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(updateRCMode(int))); - connect(m_evenFilterCompressionTab, SIGNAL(eventOccurred(QWidget*, QEvent*)), this, SLOT(compressionTabEventOccurred(QWidget*, QEvent*))); - connect(ui->sliderBitrate, SIGNAL(valueChanged(int)), this, SLOT(updateBitrate(int))); + connect(m_encoderButtonGroup.data(), SIGNAL(buttonClicked(int)), this, SLOT(updateEncoder(int))); + connect(m_modeButtonGroup.data(), SIGNAL(buttonClicked(int)), this, SLOT(updateRCMode(int))); + connect(m_evenFilterCompressionTab.data(), SIGNAL(eventOccurred(QWidget*, QEvent*)), this, SLOT(compressionTabEventOccurred(QWidget*, QEvent*))); + connect(ui->sliderBitrate, SIGNAL(valueChanged(int)), this, SLOT(updateBitrate(int))); updateEncoder(m_encoderButtonGroup->checkedId()); @@ -506,15 +512,15 @@ MainWindow::MainWindow(MUtils::IPCChannel *const ipcChannel, FileListModel *cons ui->lineEditRenameRegExp_Search ->setText(m_settings->renameFiles_regExpSearch ()); ui->lineEditRenameRegExp_Replace->setText(m_settings->renameFiles_regExpReplace()); - m_evenFilterCustumParamsHelp = new CustomEventFilter(); - ui->helpCustomParamLAME->installEventFilter(m_evenFilterCustumParamsHelp); - ui->helpCustomParamOggEnc->installEventFilter(m_evenFilterCustumParamsHelp); - ui->helpCustomParamNeroAAC->installEventFilter(m_evenFilterCustumParamsHelp); - ui->helpCustomParamFLAC->installEventFilter(m_evenFilterCustumParamsHelp); - ui->helpCustomParamAften->installEventFilter(m_evenFilterCustumParamsHelp); - ui->helpCustomParamOpus->installEventFilter(m_evenFilterCustumParamsHelp); + m_evenFilterCustumParamsHelp.reset(new CustomEventFilter()); + ui->helpCustomParamLAME ->installEventFilter(m_evenFilterCustumParamsHelp.data()); + ui->helpCustomParamOggEnc ->installEventFilter(m_evenFilterCustumParamsHelp.data()); + ui->helpCustomParamNeroAAC->installEventFilter(m_evenFilterCustumParamsHelp.data()); + ui->helpCustomParamFLAC ->installEventFilter(m_evenFilterCustumParamsHelp.data()); + ui->helpCustomParamAften ->installEventFilter(m_evenFilterCustumParamsHelp.data()); + ui->helpCustomParamOpus ->installEventFilter(m_evenFilterCustumParamsHelp.data()); - m_overwriteButtonGroup = new QButtonGroup(this); + m_overwriteButtonGroup.reset(new QButtonGroup(this)); m_overwriteButtonGroup->addButton(ui->radioButtonOverwriteModeKeepBoth, SettingsModel::Overwrite_KeepBoth); m_overwriteButtonGroup->addButton(ui->radioButtonOverwriteModeSkipFile, SettingsModel::Overwrite_SkipFile); m_overwriteButtonGroup->addButton(ui->radioButtonOverwriteModeReplaces, SettingsModel::Overwrite_Replaces); @@ -581,8 +587,8 @@ MainWindow::MainWindow(MUtils::IPCChannel *const ipcChannel, FileListModel *cons connect(ui->buttonRename_FileEx, SIGNAL(clicked(bool)), this, SLOT(renameButtonClicked(bool))); connect(ui->buttonFileExts_Add, SIGNAL(clicked()), this, SLOT(fileExtAddButtonClicked())); connect(ui->buttonFileExts_Remove, SIGNAL(clicked()), this, SLOT(fileExtRemoveButtonClicked())); - connect(m_overwriteButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(overwriteModeChanged(int))); - connect(m_evenFilterCustumParamsHelp, SIGNAL(eventOccurred(QWidget*, QEvent*)), this, SLOT(customParamsHelpRequested(QWidget*, QEvent*))); + connect(m_overwriteButtonGroup.data(), SIGNAL(buttonClicked(int)), this, SLOT(overwriteModeChanged(int))); + connect(m_evenFilterCustumParamsHelp.data(), SIGNAL(eventOccurred(QWidget*, QEvent*)), this, SLOT(customParamsHelpRequested(QWidget*, QEvent*))); connect(fileExtModel, SIGNAL(modelReset()), this, SLOT(fileExtModelChanged())); //-------------------------------- @@ -607,7 +613,7 @@ MainWindow::MainWindow(MUtils::IPCChannel *const ipcChannel, FileListModel *cons connect(ui->actionOpenFolderRecursively, SIGNAL(triggered()), this, SLOT(openFolderActionActivated())); //Activate view menu actions - m_tabActionGroup = new QActionGroup(this); + m_tabActionGroup.reset(new QActionGroup(this)); m_tabActionGroup->addAction(ui->actionSourceFiles); m_tabActionGroup->addAction(ui->actionOutputDirectory); m_tabActionGroup->addAction(ui->actionCompression); @@ -619,10 +625,10 @@ MainWindow::MainWindow(MUtils::IPCChannel *const ipcChannel, FileListModel *cons ui->actionCompression->setData(3); ui->actionAdvancedOptions->setData(4); ui->actionSourceFiles->setChecked(true); - connect(m_tabActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(tabActionActivated(QAction*))); + connect(m_tabActionGroup.data(), SIGNAL(triggered(QAction*)), this, SLOT(tabActionActivated(QAction*))); //Activate style menu actions - m_styleActionGroup = new QActionGroup(this); + m_styleActionGroup .reset(new QActionGroup(this)); m_styleActionGroup->addAction(ui->actionStylePlastique); m_styleActionGroup->addAction(ui->actionStyleCleanlooks); m_styleActionGroup->addAction(ui->actionStyleWindowsVista); @@ -636,11 +642,11 @@ MainWindow::MainWindow(MUtils::IPCChannel *const ipcChannel, FileListModel *cons ui->actionStylePlastique->setChecked(true); 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*))); + connect(m_styleActionGroup.data(), SIGNAL(triggered(QAction*)), this, SLOT(styleActionActivated(QAction*))); styleActionActivated(NULL); //Populate the language menu - m_languageActionGroup = new QActionGroup(this); + m_languageActionGroup.reset(new QActionGroup(this)); QStringList translations; if(MUtils::Translation::enumerate(translations) > 0) { @@ -657,8 +663,8 @@ MainWindow::MainWindow(MUtils::IPCChannel *const ipcChannel, FileListModel *cons } } ui->menuLanguage->insertSeparator(ui->actionLoadTranslationFromFile); - connect(ui->actionLoadTranslationFromFile, SIGNAL(triggered(bool)), this, SLOT(languageFromFileActionActivated(bool))); - connect(m_languageActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(languageActionActivated(QAction*))); + connect(ui->actionLoadTranslationFromFile, SIGNAL(triggered(bool)), this, SLOT(languageFromFileActionActivated(bool))); + connect(m_languageActionGroup.data(), SIGNAL(triggered(QAction*)), this, SLOT(languageActionActivated(QAction*))); ui->actionLoadTranslationFromFile->setChecked(false); //Activate tools menu actions @@ -713,17 +719,17 @@ MainWindow::MainWindow(MUtils::IPCChannel *const ipcChannel, FileListModel *cons //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(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())); - connect(m_fileListModel, SIGNAL(rowAppended()), m_dropBox, SLOT(modelChanged())); + connect(m_fileListModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), m_dropBox, SLOT(modelChanged())); + connect(m_fileListModel, SIGNAL(rowAppended()), m_dropBox, SLOT(modelChanged())); //Create message handler thread 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(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); - connect(m_messageHandler, SIGNAL(killSignalReceived()), this, SLOT(close()), Qt::QueuedConnection); + connect(m_messageHandler, SIGNAL(killSignalReceived()), this, SLOT(close()), Qt::QueuedConnection); m_messageHandler->start(); //Init delayed file handling @@ -763,33 +769,19 @@ MainWindow::~MainWindow(void) } //Unset models - SET_MODEL(ui->sourceFileView, NULL); + SET_MODEL(ui->sourceFileView, NULL); SET_MODEL(ui->outputFolderView, NULL); - SET_MODEL(ui->metaDataView, NULL); + SET_MODEL(ui->metaDataView, NULL); //Free memory - 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); //Un-initialize the dialog MUTILS_DELETE(ui); @@ -813,26 +805,20 @@ void MainWindow::addFiles(const QStringList &files) tabPageChanged(ui->tabWidget->currentIndex(), true); INIT_BANNER(); - FileAnalyzer *analyzer = new FileAnalyzer(files); + QScopedPointer analyzer(new FileAnalyzer(files)); - connect(analyzer, SIGNAL(fileSelected(QString)), m_banner, SLOT(setText(QString)), Qt::QueuedConnection); - connect(analyzer, SIGNAL(progressValChanged(unsigned int)), m_banner, SLOT(setProgressVal(unsigned int)), Qt::QueuedConnection); - connect(analyzer, SIGNAL(progressMaxChanged(unsigned int)), m_banner, SLOT(setProgressMax(unsigned int)), Qt::QueuedConnection); - connect(analyzer, SIGNAL(fileAnalyzed(AudioFileModel)), m_fileListModel, SLOT(addFile(AudioFileModel)), Qt::QueuedConnection); - connect(m_banner, SIGNAL(userAbort()), analyzer, SLOT(abortProcess()), Qt::DirectConnection); + connect(analyzer.data(), SIGNAL(fileSelected(QString)), m_banner.data(), SLOT(setText(QString)), Qt::QueuedConnection); + connect(analyzer.data(), SIGNAL(progressValChanged(unsigned int)), m_banner.data(), SLOT(setProgressVal(unsigned int)), Qt::QueuedConnection); + connect(analyzer.data(), SIGNAL(progressMaxChanged(unsigned int)), m_banner.data(), SLOT(setProgressMax(unsigned int)), Qt::QueuedConnection); + connect(analyzer.data(), SIGNAL(fileAnalyzed(AudioFileModel)), m_fileListModel, SLOT(addFile(AudioFileModel)), Qt::QueuedConnection); + connect(m_banner.data(), SIGNAL(userAbort()), analyzer.data(), SLOT(abortProcess()), Qt::DirectConnection); - try + if(!analyzer.isNull()) { - m_fileListModel->setBlockUpdates(true); - QTime startTime = QTime::currentTime(); - m_banner->show(tr("Adding file(s), please wait..."), analyzer); - } - catch(...) - { - /* ignore any exceptions that may occur */ + FileListBlocker fileListBlocker(m_fileListModel); + m_banner->show(tr("Adding file(s), please wait..."), analyzer.data()); } - m_fileListModel->setBlockUpdates(false); qApp->processEvents(QEventLoop::ExcludeUserInputEvents); ui->sourceFileView->update(); qApp->processEvents(QEventLoop::ExcludeUserInputEvents); @@ -856,7 +842,6 @@ void MainWindow::addFiles(const QStringList &files) QMessageBox::warning(this, tr("Files Rejected"), QString("%1
%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.")))); } - MUTILS_DELETE(analyzer); m_banner->close(); } @@ -1286,7 +1271,7 @@ void MainWindow::keyPressEvent(QKeyEvent *e) */ bool MainWindow::eventFilter(QObject *obj, QEvent *event) { - if(obj == m_fileSystemModel) + if(obj == m_fileSystemModel.data()) { if(QApplication::overrideCursor() == NULL) { @@ -2117,12 +2102,12 @@ void MainWindow::importCueSheetActionTriggered(bool checked) if(!selectedCueFile.isEmpty()) { m_settings->mostRecentInputPath(QFileInfo(selectedCueFile).canonicalPath()); - CueImportDialog *cueImporter = new CueImportDialog(this, m_fileListModel, selectedCueFile, m_settings); + FileListBlocker fileListBlocker(m_fileListModel); + QScopedPointer cueImporter(new CueImportDialog(this, m_fileListModel, selectedCueFile, m_settings)); result = cueImporter->exec(); - MUTILS_DELETE(cueImporter); } - if(result == QDialog::Accepted) + if(result != QDialog::Rejected) { qApp->processEvents(QEventLoop::ExcludeUserInputEvents); ui->sourceFileView->update(); @@ -2130,6 +2115,10 @@ void MainWindow::importCueSheetActionTriggered(bool checked) ui->sourceFileView->scrollToBottom(); qApp->processEvents(QEventLoop::ExcludeUserInputEvents); } + else + { + qWarning("Whoops! (RESULT: %d)", result); + } if(result != (-1)) break; } @@ -3205,17 +3194,17 @@ void MainWindow::initOutputFolderModel(void) if(m_fileSystemModel) { SET_MODEL(ui->outputFolderView, NULL); - MUTILS_DELETE(m_fileSystemModel); ui->outputFolderView->repaint(); } - if(m_fileSystemModel = new QFileSystemModelEx()) + m_fileSystemModel.reset(new QFileSystemModelEx()); + if(!m_fileSystemModel.isNull()) { m_fileSystemModel->installEventFilter(this); - connect(m_fileSystemModel, SIGNAL(directoryLoaded(QString)), this, SLOT(outputFolderDirectoryLoaded(QString))); - connect(m_fileSystemModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(outputFolderRowsInserted(QModelIndex,int,int))); + connect(m_fileSystemModel.data(), SIGNAL(directoryLoaded(QString)), this, SLOT(outputFolderDirectoryLoaded(QString))); + connect(m_fileSystemModel.data(), SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(outputFolderRowsInserted(QModelIndex,int,int))); - SET_MODEL(ui->outputFolderView, m_fileSystemModel); + SET_MODEL(ui->outputFolderView, m_fileSystemModel.data()); ui->outputFolderView->header()->setStretchLastSection(true); ui->outputFolderView->header()->hideSection(1); ui->outputFolderView->header()->hideSection(2); diff --git a/src/Dialog_MainWindow.h b/src/Dialog_MainWindow.h index b89a0127..17ea08f5 100644 --- a/src/Dialog_MainWindow.h +++ b/src/Dialog_MainWindow.h @@ -217,23 +217,32 @@ private: uint m_outputFolderViewInitCounter; bool m_outputFolderViewCentering; - WorkingBanner *m_banner; + FileListModel *const m_fileListModel; + AudioFileModel_MetaInfo *const m_metaData; + SettingsModel *const m_settings; + + QScopedPointer m_banner; + QScopedPointer m_metaInfoModel; + QScopedPointer m_fileSystemModel; + QList *m_droppedFileList; QStringList *m_delayedFileList; QTimer *m_delayedFileTimer; DropBox *m_dropBox; QLabel *m_dropNoteLabel; - FileListModel *m_fileListModel; - QFileSystemModelEx *m_fileSystemModel; MessageHandlerThread *m_messageHandler; - AudioFileModel_MetaInfo *const m_metaData; - MetaInfoModel *m_metaInfoModel; QMenu *m_outputFolderContextMenu; - SettingsModel *m_settings; QMenu *m_sourceFilesContextMenu; QMenu *m_outputFolderFavoritesMenu; QLabel *m_outputFolderNoteBox; + QScopedPointer m_languageActionGroup; + QScopedPointer m_styleActionGroup; + QScopedPointer m_tabActionGroup; + QScopedPointer m_encoderButtonGroup; + QScopedPointer m_modeButtonGroup; + QScopedPointer m_overwriteButtonGroup; + QAction *m_findFileContextAction; QAction *m_previewContextAction; QAction *m_showDetailsContextAction; @@ -243,16 +252,10 @@ private: QAction *m_addFavoriteFolderAction; QAction *m_exportCsvContextAction; QAction *m_importCsvContextAction; - QActionGroup *m_languageActionGroup; - QActionGroup *m_styleActionGroup; - QActionGroup *m_tabActionGroup; - QButtonGroup *m_encoderButtonGroup; - QButtonGroup *m_modeButtonGroup; - QButtonGroup *m_overwriteButtonGroup; - CustomEventFilter *m_evenFilterCornerWidget; - CustomEventFilter *m_evenFilterCustumParamsHelp; - CustomEventFilter *m_evenFilterOutputFolderMouse; - CustomEventFilter *m_evenFilterOutputFolderView; - CustomEventFilter *m_evenFilterCompressionTab; + QScopedPointer m_evenFilterCornerWidget; + QScopedPointer m_evenFilterCustumParamsHelp; + QScopedPointer m_evenFilterOutputFolderMouse; + QScopedPointer m_evenFilterOutputFolderView; + QScopedPointer m_evenFilterCompressionTab; }; diff --git a/src/Registry_Decoder.cpp b/src/Registry_Decoder.cpp index 1e9ef46a..c09c190b 100644 --- a/src/Registry_Decoder.cpp +++ b/src/Registry_Decoder.cpp @@ -119,6 +119,16 @@ const QStringList &DecoderRegistry::getSupportedExts(void) } } + const char *const *const playlistPtr = PlaylistImporter::getSupportedExtensions(); + for(size_t i = 0; playlistPtr[i]; i++) + { + const QString ext = QString().sprintf("*.%s", playlistPtr[i]); + if(!m_supportedExts->contains(ext, Qt::CaseInsensitive)) + { + (*m_supportedExts) << ext; + } + } + m_supportedExts->sort(); return (*m_supportedExts); } @@ -133,6 +143,7 @@ const QStringList &DecoderRegistry::getSupportedTypes(void) } m_supportedTypes.reset(new QStringList()); + (*m_supportedTypes) << QString("%1 (%2)").arg(tr("All supported types"), getSupportedExts().join(" ")); const typeList_t &types = getAvailableDecoderTypes(); for(QList::ConstIterator iter = types.constBegin(); iter != types.constEnd(); iter++) @@ -151,16 +162,19 @@ const QStringList &DecoderRegistry::getSupportedTypes(void) } } - QStringList playlistExts; const char *const *const playlistPtr = PlaylistImporter::getSupportedExtensions(); + QStringList playListExts; for(size_t i = 0; playlistPtr[i]; i++) { - playlistExts << QString().sprintf("*.%s", playlistPtr[i]); + const QString ext = QString().sprintf("*.%s", playlistPtr[i]); + if(!playListExts.contains(ext, Qt::CaseInsensitive)) + { + playListExts << ext; + } } - (*m_supportedTypes) << QString("%1 (%2)").arg(tr("Playlists"), playlistExts.join(" ")); + (*m_supportedTypes) << QString("%1 (%2)").arg(tr("Playlists"), playListExts.join(" ")); (*m_supportedTypes) << QString("%1 (*.*)").arg(tr("All files")); - m_supportedTypes->prepend(QString("%1 (%2 %3)").arg(tr("All supported types"), getSupportedExts().join(" "), playlistExts.join(" "))); return (*m_supportedTypes); }