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 zcwQx!d0bBU7so%}``r6H&%Mumo~uo?Nm90Ksbnn_WkeZSB9fv;*@tXdC&pH;j2I-c z7AcIOC`pqwdv@7|{A@9nviuJH(d+cw<$J&9oX>fm^L=qhIC5A>wqzA4R*eG60ii#z zw;$l|2aM?p^qB%Nh(opXLQfL=BICLT9iJ z6A;*P0WiH7fu5?Ck}BZizw1M8ZKVTI)2g>-}&$o8A^!!qqnghjh20(T-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jY@;iqZqCW|xS6&ih$wWCkqh9muo%sgL~k3yd_ZpxNM7r4!R zzalf6AzL2qjpq$y+i0MYm>}DYzJ{j%Pj1Zpyi+c;~L;JULITo^~l;U4^_ab@jv9D0h^GqZ*BClkOTe)H$L)~98d+fIgaEx zPmn=XR&D&0A&2GycrHa=+Ojb`%OrV?Gs^3HR$iNg-+NE4jbG#Bux(gp=1uv4Wf?5G zt9&S`E6j{$wtRRp7GAVoPWlA;xAB&bY=>}&=JH8GJQyygSAxdYZt|It$n@nfIpZYg zd_BfAx~|>$o<;H_dt6s8804o;;G=UZ`NiyoaJ5tA*FWP}o&0$f#>44X@|V42z_lN7(r@_>x5{hfCR?*MzkBG9q(GoP$@h-r{pW@#7K>s2gzaRG0mrd`5yT<^1RV&P} zOj}c&nWMwU-3A*qZa#a>4EC!5!K&p3rHrUws>V>L<>xHM2 zS$-cSXB~8KL9%iw7J7DOmr``{2WIq2<-Q7X)MdT$=Fc#qHS3kH!%@ntXH$vwSqTe9 aR;HP*R%vzXO^r;;O(=CqYjEFT#s2|wF(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 - { - m_fileListModel->setBlockUpdates(true); - QTime startTime = QTime::currentTime(); - m_banner->show(tr("Adding file(s), please wait..."), analyzer); - } - catch(...) + if(!analyzer.isNull()) { - /* 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); } -- 2.11.4.GIT