diff --git a/.clang-tidy b/.clang-tidy index 72475b4050e..c0f80639e6e 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -24,18 +24,10 @@ Checks: '-*, bugprone-*, - # A handful of warnings - bugprone-integer-division, - # Bunch of warnings.... , # Comment out this and the cppcoreguidelines version. , -bugprone-narrowing-conversions, - # Errors in code? GroupAnimation overrides several parent - # functions with an explicit nullptr. Shouldnt it just call - # up? , - bugprone-parent-virtual-call, - # Prevent self-assignment. Needs to be investigated. -bugprone-unhandled-self-assignment, @@ -112,10 +104,9 @@ Checks: '-*, -cppcoreguidelines-no-malloc, # No gsl. , -cppcoreguidelines-owning-memory, - # No gsl. , -cppcoreguidelines-pro-bounds-array-to-pointer-decay, - # No gsl. , -cppcoreguidelines-pro-bounds-constant-array-index, + # Bunch of warnings.... , -cppcoreguidelines-pro-bounds-pointer-arithmetic, cppcoreguidelines-pro-type-const-cast, @@ -160,19 +151,9 @@ Checks: '-*, # Noisy!!! foo(void) => foo() , -modernize-redundant-void-arg, - # Not investigated yet. , - -modernize-use-auto, - - # One weirdness in videooutput_xv.cpp. Making the proposed - # change causes one of the programs to fail in the link stage. , - -modernize-use-emplace, - # Why would anyone want this? , -modernize-use-trailing-return-type, - # Noisy. Needs work., - -modernize-use-using, - ## C++14 modernize-make-unique, ## C++14 modernize-use-transparent-functors, ## C++17 modernize-concat-nested-namespaces, @@ -188,12 +169,6 @@ Checks: '-*, # Not investigated yet. , -readability-function-size, - # Will fix member names, but not any uses of the changed - # memeber names. - # - # Done for all but libmythtv and libmythui. , - -readability-identifier-naming, - # Wants to convert all "if (x)" pointer validity checks to be # "if (x != nullptr)". These should be ignored as the # AllowPointerConditions key is set to "1", but tidy complains @@ -280,3 +255,8 @@ CheckOptions: value: 'camelBack' - key: readability-identifier-naming.StaticVariablePrefix value: 's_' + + - key: google-runtime-int.Signedtypeprefix + value: 'qint' + - key: google-runtime-int.UnsignedTypePrefix + value: 'quint' diff --git a/mythplugins/mytharchive/mytharchive/archivesettings.cpp b/mythplugins/mytharchive/mytharchive/archivesettings.cpp index 18e5e55e0a9..e34ed7e07bb 100644 --- a/mythplugins/mytharchive/mytharchive/archivesettings.cpp +++ b/mythplugins/mytharchive/mytharchive/archivesettings.cpp @@ -15,7 +15,7 @@ static HostFileBrowserSetting *MythArchiveTempDir() { - HostFileBrowserSetting *gc = new HostFileBrowserSetting("MythArchiveTempDir"); + auto *gc = new HostFileBrowserSetting("MythArchiveTempDir"); gc->setLabel(ArchiveSettings::tr("MythArchive Temp Directory")); gc->setValue(""); @@ -30,7 +30,7 @@ static HostFileBrowserSetting *MythArchiveTempDir() static HostFileBrowserSetting *MythArchiveShareDir() { - HostFileBrowserSetting *gc = new HostFileBrowserSetting("MythArchiveShareDir"); + auto *gc = new HostFileBrowserSetting("MythArchiveShareDir"); gc->setLabel(ArchiveSettings::tr("MythArchive Share Directory")); gc->setValue(GetShareDir() + "mytharchive/"); @@ -45,7 +45,7 @@ static HostFileBrowserSetting *MythArchiveShareDir() static HostComboBoxSetting *PALNTSC() { - HostComboBoxSetting *gc = new HostComboBoxSetting("MythArchiveVideoFormat"); + auto *gc = new HostComboBoxSetting("MythArchiveVideoFormat"); gc->setLabel(ArchiveSettings::tr("Video format")); @@ -59,7 +59,7 @@ static HostComboBoxSetting *PALNTSC() static HostTextEditSetting *MythArchiveFileFilter() { - HostTextEditSetting *gc = new HostTextEditSetting("MythArchiveFileFilter"); + auto *gc = new HostTextEditSetting("MythArchiveFileFilter"); gc->setLabel(ArchiveSettings::tr("File Selector Filter")); gc->setValue("*.mpg *.mov *.avi *.mpeg *.nuv"); @@ -71,7 +71,7 @@ static HostTextEditSetting *MythArchiveFileFilter() static HostFileBrowserSetting *MythArchiveDVDLocation() { - HostFileBrowserSetting *gc = new HostFileBrowserSetting("MythArchiveDVDLocation"); + auto *gc = new HostFileBrowserSetting("MythArchiveDVDLocation"); gc->setLabel(ArchiveSettings::tr("Location of DVD")); gc->setValue("/dev/dvd"); @@ -84,7 +84,7 @@ static HostFileBrowserSetting *MythArchiveDVDLocation() static HostSpinBoxSetting *MythArchiveDriveSpeed() { - HostSpinBoxSetting *gc = new HostSpinBoxSetting("MythArchiveDriveSpeed", 0, 48, 1); + auto *gc = new HostSpinBoxSetting("MythArchiveDriveSpeed", 0, 48, 1); gc->setLabel(ArchiveSettings::tr("DVD Drive Write Speed")); gc->setValue(0); @@ -98,7 +98,7 @@ static HostSpinBoxSetting *MythArchiveDriveSpeed() static HostTextEditSetting *MythArchiveDVDPlayerCmd() { - HostTextEditSetting *gc = new HostTextEditSetting("MythArchiveDVDPlayerCmd"); + auto *gc = new HostTextEditSetting("MythArchiveDVDPlayerCmd"); gc->setLabel(ArchiveSettings::tr("Command to play DVD")); gc->setValue("Internal"); @@ -114,7 +114,7 @@ static HostTextEditSetting *MythArchiveDVDPlayerCmd() static HostCheckBoxSetting *MythArchiveCopyRemoteFiles() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("MythArchiveCopyRemoteFiles"); + auto *gc = new HostCheckBoxSetting("MythArchiveCopyRemoteFiles"); gc->setLabel(ArchiveSettings::tr("Copy remote files")); gc->setValue(false); @@ -129,7 +129,7 @@ static HostCheckBoxSetting *MythArchiveCopyRemoteFiles() static HostCheckBoxSetting *MythArchiveAlwaysUseMythTranscode() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("MythArchiveAlwaysUseMythTranscode"); + auto *gc = new HostCheckBoxSetting("MythArchiveAlwaysUseMythTranscode"); gc->setLabel(ArchiveSettings::tr("Always Use Mythtranscode")); gc->setValue(true); @@ -144,7 +144,7 @@ static HostCheckBoxSetting *MythArchiveAlwaysUseMythTranscode() static HostCheckBoxSetting *MythArchiveUseProjectX() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("MythArchiveUseProjectX"); + auto *gc = new HostCheckBoxSetting("MythArchiveUseProjectX"); gc->setLabel(ArchiveSettings::tr("Use ProjectX")); gc->setValue(false); @@ -158,7 +158,7 @@ static HostCheckBoxSetting *MythArchiveUseProjectX() static HostCheckBoxSetting *MythArchiveUseFIFO() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("MythArchiveUseFIFO"); + auto *gc = new HostCheckBoxSetting("MythArchiveUseFIFO"); gc->setLabel(ArchiveSettings::tr("Use FIFOs")); gc->setValue(true); @@ -174,7 +174,7 @@ static HostCheckBoxSetting *MythArchiveUseFIFO() static HostCheckBoxSetting *MythArchiveAddSubtitles() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("MythArchiveAddSubtitles"); + auto *gc = new HostCheckBoxSetting("MythArchiveAddSubtitles"); gc->setLabel(ArchiveSettings::tr("Add Subtitles")); gc->setValue(false); @@ -187,7 +187,7 @@ static HostCheckBoxSetting *MythArchiveAddSubtitles() static HostComboBoxSetting *MainMenuAspectRatio() { - HostComboBoxSetting *gc = new HostComboBoxSetting("MythArchiveMainMenuAR"); + auto *gc = new HostComboBoxSetting("MythArchiveMainMenuAR"); gc->setLabel(ArchiveSettings::tr("Main Menu Aspect Ratio")); @@ -203,7 +203,7 @@ static HostComboBoxSetting *MainMenuAspectRatio() static HostComboBoxSetting *ChapterMenuAspectRatio() { - HostComboBoxSetting *gc = new HostComboBoxSetting("MythArchiveChapterMenuAR"); + auto *gc = new HostComboBoxSetting("MythArchiveChapterMenuAR"); gc->setLabel(ArchiveSettings::tr("Chapter Menu Aspect Ratio")); @@ -224,7 +224,7 @@ static HostComboBoxSetting *ChapterMenuAspectRatio() static HostComboBoxSetting *MythArchiveDateFormat() { - HostComboBoxSetting *gc = new HostComboBoxSetting("MythArchiveDateFormat"); + auto *gc = new HostComboBoxSetting("MythArchiveDateFormat"); gc->setLabel(ArchiveSettings::tr("Date format")); QDate sampdate = MythDate::current().toLocalTime().date(); @@ -260,7 +260,7 @@ static HostComboBoxSetting *MythArchiveDateFormat() static HostComboBoxSetting *MythArchiveTimeFormat() { - HostComboBoxSetting *gc = new HostComboBoxSetting("MythArchiveTimeFormat"); + auto *gc = new HostComboBoxSetting("MythArchiveTimeFormat"); gc->setLabel(ArchiveSettings::tr("Time format")); QTime samptime = QTime::currentTime(); @@ -278,7 +278,7 @@ static HostComboBoxSetting *MythArchiveTimeFormat() static HostComboBoxSetting *MythArchiveDefaultEncProfile() { - HostComboBoxSetting *gc = new HostComboBoxSetting("MythArchiveDefaultEncProfile"); + auto *gc = new HostComboBoxSetting("MythArchiveDefaultEncProfile"); gc->setLabel(ArchiveSettings::tr("Default Encoder Profile")); gc->addSelection(ArchiveSettings::tr("HQ", "Encoder profile"), "HQ"); @@ -295,7 +295,7 @@ static HostComboBoxSetting *MythArchiveDefaultEncProfile() static HostTextEditSetting *MythArchiveMplexCmd() { - HostTextEditSetting *gc = new HostTextEditSetting("MythArchiveMplexCmd"); + auto *gc = new HostTextEditSetting("MythArchiveMplexCmd"); gc->setLabel(ArchiveSettings::tr("mplex Command")); @@ -308,7 +308,7 @@ static HostTextEditSetting *MythArchiveMplexCmd() static HostTextEditSetting *MythArchiveDvdauthorCmd() { - HostTextEditSetting *gc = new HostTextEditSetting("MythArchiveDvdauthorCmd"); + auto *gc = new HostTextEditSetting("MythArchiveDvdauthorCmd"); gc->setLabel(ArchiveSettings::tr("dvdauthor command")); @@ -321,7 +321,7 @@ static HostTextEditSetting *MythArchiveDvdauthorCmd() static HostTextEditSetting *MythArchiveMkisofsCmd() { - HostTextEditSetting *gc = new HostTextEditSetting("MythArchiveMkisofsCmd"); + auto *gc = new HostTextEditSetting("MythArchiveMkisofsCmd"); gc->setLabel(ArchiveSettings::tr("mkisofs command")); @@ -334,7 +334,7 @@ static HostTextEditSetting *MythArchiveMkisofsCmd() static HostTextEditSetting *MythArchiveGrowisofsCmd() { - HostTextEditSetting *gc = new HostTextEditSetting("MythArchiveGrowisofsCmd"); + auto *gc = new HostTextEditSetting("MythArchiveGrowisofsCmd"); gc->setLabel(ArchiveSettings::tr("growisofs command")); @@ -347,7 +347,7 @@ static HostTextEditSetting *MythArchiveGrowisofsCmd() static HostTextEditSetting *MythArchiveM2VRequantiserCmd() { - HostTextEditSetting *gc = new HostTextEditSetting("MythArchiveM2VRequantiserCmd"); + auto *gc = new HostTextEditSetting("MythArchiveM2VRequantiserCmd"); gc->setLabel(ArchiveSettings::tr("M2VRequantiser command")); @@ -361,7 +361,7 @@ static HostTextEditSetting *MythArchiveM2VRequantiserCmd() static HostTextEditSetting *MythArchiveJpeg2yuvCmd() { - HostTextEditSetting *gc = new HostTextEditSetting("MythArchiveJpeg2yuvCmd"); + auto *gc = new HostTextEditSetting("MythArchiveJpeg2yuvCmd"); gc->setLabel(ArchiveSettings::tr("jpeg2yuv command")); @@ -374,7 +374,7 @@ static HostTextEditSetting *MythArchiveJpeg2yuvCmd() static HostTextEditSetting *MythArchiveSpumuxCmd() { - HostTextEditSetting *gc = new HostTextEditSetting("MythArchiveSpumuxCmd"); + auto *gc = new HostTextEditSetting("MythArchiveSpumuxCmd"); gc->setLabel(ArchiveSettings::tr("spumux command")); @@ -387,7 +387,7 @@ static HostTextEditSetting *MythArchiveSpumuxCmd() static HostTextEditSetting *MythArchiveMpeg2encCmd() { - HostTextEditSetting *gc = new HostTextEditSetting("MythArchiveMpeg2encCmd"); + auto *gc = new HostTextEditSetting("MythArchiveMpeg2encCmd"); gc->setLabel(ArchiveSettings::tr("mpeg2enc command")); @@ -400,7 +400,7 @@ static HostTextEditSetting *MythArchiveMpeg2encCmd() static HostTextEditSetting *MythArchiveProjectXCmd() { - HostTextEditSetting *gc = new HostTextEditSetting("MythArchiveProjectXCmd"); + auto *gc = new HostTextEditSetting("MythArchiveProjectXCmd"); gc->setLabel(ArchiveSettings::tr("projectx command")); @@ -430,7 +430,7 @@ ArchiveSettings::ArchiveSettings() addChild(MythArchiveUseFIFO()); addChild(MythArchiveDefaultEncProfile()); - GroupSetting* DVDSettings = new GroupSetting(); + auto* DVDSettings = new GroupSetting(); DVDSettings->setLabel(ArchiveSettings::tr("DVD Menu Settings")); DVDSettings->addChild(MainMenuAspectRatio()); DVDSettings->addChild(ChapterMenuAspectRatio()); @@ -438,7 +438,7 @@ ArchiveSettings::ArchiveSettings() DVDSettings->addChild(MythArchiveTimeFormat()); addChild(DVDSettings); - GroupSetting* externalCmdSettings = new GroupSetting(); + auto* externalCmdSettings = new GroupSetting(); externalCmdSettings->setLabel(ArchiveSettings::tr("MythArchive External Commands")); externalCmdSettings->addChild(MythArchiveMplexCmd()); externalCmdSettings->addChild(MythArchiveDvdauthorCmd()); diff --git a/mythplugins/mytharchive/mytharchive/archiveutil.cpp b/mythplugins/mytharchive/mytharchive/archiveutil.cpp index 52dd9bf0a30..8ca277e330a 100644 --- a/mythplugins/mytharchive/mytharchive/archiveutil.cpp +++ b/mythplugins/mytharchive/mytharchive/archiveutil.cpp @@ -288,7 +288,7 @@ bool getFileDetails(ArchiveItem *a) void showWarningDialog(const QString &msg) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythConfirmationDialog *dialog = new MythConfirmationDialog(popupStack, msg, false); + auto *dialog = new MythConfirmationDialog(popupStack, msg, false); if (dialog->Create()) popupStack->AddScreen(dialog); diff --git a/mythplugins/mytharchive/mytharchive/archiveutil.h b/mythplugins/mytharchive/mytharchive/archiveutil.h index 2a2f1ecd3a5..ff9909068e9 100644 --- a/mythplugins/mytharchive/mytharchive/archiveutil.h +++ b/mythplugins/mytharchive/mytharchive/archiveutil.h @@ -13,42 +13,42 @@ class ProgramInfo; -typedef enum +enum ARCHIVEDESTINATION { AD_DVD_SL = 0, AD_DVD_DL = 1, AD_DVD_RW = 2, AD_FILE = 3 -} ARCHIVEDESTINATION; +}; Q_DECLARE_METATYPE (ARCHIVEDESTINATION); -typedef struct ArchiveDestination +struct ArchiveDestination { ARCHIVEDESTINATION type; const char *name; const char *description; int64_t freeSpace; -}_ArchiveDestination; +}; extern struct ArchiveDestination ArchiveDestinations[]; extern int ArchiveDestinationsCount; -typedef struct +struct EncoderProfile { QString name; QString description; float bitrate; -} EncoderProfile; +}; -typedef struct ThumbImage +struct ThumbImage { QString caption; QString filename; qint64 frame; -} ThumbImage; +}; -typedef struct +struct ArchiveItem { int id; QString type; @@ -70,7 +70,7 @@ typedef struct bool useCutlist; bool editedDetails; QList thumbList; -} ArchiveItem; +}; QString formatSize(int64_t sizeKB, int prec = 2); QString getTempDirectory(bool showError = false); diff --git a/mythplugins/mytharchive/mytharchive/exportnative.cpp b/mythplugins/mytharchive/mytharchive/exportnative.cpp index 3f6085c3aa8..6b41f7cf0da 100644 --- a/mythplugins/mytharchive/mytharchive/exportnative.cpp +++ b/mythplugins/mytharchive/mytharchive/exportnative.cpp @@ -181,7 +181,7 @@ void ExportNative::updateSizeBar() void ExportNative::titleChanged(MythUIButtonListItem *item) { - ArchiveItem *a = item->GetData().value(); + auto *a = item->GetData().value(); if (!a) return; @@ -238,7 +238,7 @@ void ExportNative::updateArchiveList(void) { ArchiveItem *a = m_archiveList.at(x); - MythUIButtonListItem* item = new MythUIButtonListItem(m_archiveButtonList, a->title); + auto* item = new MythUIButtonListItem(m_archiveButtonList, a->title); item->SetData(qVariantFromValue(a)); } @@ -266,7 +266,7 @@ void ExportNative::getArchiveListFromDB(void) { while (query.next()) { - ArchiveItem *item = new ArchiveItem; + auto *item = new ArchiveItem; item->id = query.value(0).toInt(); item->type = query.value(1).toString(); @@ -348,7 +348,7 @@ void ExportNative::ShowMenu() { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(tr("Menu"), popupStack, "actionmenu"); + auto *menuPopup = new MythDialogBox(tr("Menu"), popupStack, "actionmenu"); if (menuPopup->Create()) popupStack->AddScreen(menuPopup); @@ -361,7 +361,7 @@ void ExportNative::ShowMenu() void ExportNative::removeItem() { MythUIButtonListItem *item = m_archiveButtonList->GetItemCurrent(); - ArchiveItem *curItem = item->GetData().value(); + auto *curItem = item->GetData().value(); if (!curItem) return; @@ -461,7 +461,7 @@ void ExportNative::handleAddRecording() { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - RecordingSelector *selector = new RecordingSelector(mainStack, &m_archiveList); + auto *selector = new RecordingSelector(mainStack, &m_archiveList); connect(selector, SIGNAL(haveResult(bool)), this, SLOT(selectorClosed(bool))); @@ -491,7 +491,7 @@ void ExportNative::handleAddVideo() MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - VideoSelector *selector = new VideoSelector(mainStack, &m_archiveList); + auto *selector = new VideoSelector(mainStack, &m_archiveList); connect(selector, SIGNAL(haveResult(bool)), this, SLOT(selectorClosed(bool))); diff --git a/mythplugins/mytharchive/mytharchive/fileselector.cpp b/mythplugins/mytharchive/mytharchive/fileselector.cpp index 3b767b83b62..7c890f75118 100644 --- a/mythplugins/mytharchive/mytharchive/fileselector.cpp +++ b/mythplugins/mytharchive/mytharchive/fileselector.cpp @@ -123,7 +123,7 @@ void FileSelector::itemClicked(MythUIButtonListItem *item) if (!item) return; - FileData *fileData = item->GetData().value(); + auto *fileData = item->GetData().value(); if (fileData->directory) { @@ -263,7 +263,7 @@ void FileSelector::OKPressed() if (pos > 0) title = f.mid(pos + 1); - ArchiveItem *a = new ArchiveItem; + auto *a = new ArchiveItem; a->type = "File"; a->title = title; a->subtitle = ""; @@ -289,7 +289,7 @@ void FileSelector::OKPressed() else { MythUIButtonListItem *item = m_fileButtonList->GetItemCurrent(); - FileData *fileData = item->GetData().value(); + auto *fileData = item->GetData().value(); if (m_selectorType == FSTYPE_DIRECTORY) { @@ -389,7 +389,7 @@ void FileSelector::updateFileList() fi = list.at(x); if (fi.fileName() != ".") { - FileData *data = new FileData; + auto *data = new FileData; data->selected = false; data->directory = true; data->filename = fi.fileName(); @@ -397,7 +397,7 @@ void FileSelector::updateFileList() m_fileData.append(data); // add a row to the MythUIButtonList - MythUIButtonListItem* item = new + auto* item = new MythUIButtonListItem(m_fileButtonList, data->filename); item->setCheckable(false); item->SetImage("ma_folder.png"); @@ -414,7 +414,7 @@ void FileSelector::updateFileList() for (int x = 0; x < list.size(); x++) { fi = list.at(x); - FileData *data = new FileData; + auto *data = new FileData; data->selected = false; data->directory = false; data->filename = fi.fileName(); @@ -422,7 +422,7 @@ void FileSelector::updateFileList() m_fileData.append(data); // add a row to the UIListBtnArea - MythUIButtonListItem* item = + auto* item = new MythUIButtonListItem(m_fileButtonList, data->filename); item->SetText(formatSize(data->size / 1024, 2), "size"); diff --git a/mythplugins/mytharchive/mytharchive/fileselector.h b/mythplugins/mytharchive/mytharchive/fileselector.h index a06ab0a0e5e..d331bbabeab 100644 --- a/mythplugins/mytharchive/mytharchive/fileselector.h +++ b/mythplugins/mytharchive/mytharchive/fileselector.h @@ -14,20 +14,20 @@ // mytharchive #include "archiveutil.h" -typedef struct +struct FileData { bool directory; bool selected; QString filename; int64_t size; -} FileData; +}; -typedef enum +enum FSTYPE { FSTYPE_FILELIST = 0, FSTYPE_FILE = 1, FSTYPE_DIRECTORY = 2 -} FSTYPE; +}; class MythUIText; class MythUITextEdit; diff --git a/mythplugins/mytharchive/mytharchive/importnative.cpp b/mythplugins/mytharchive/mytharchive/importnative.cpp index 45e6c29ac90..0d4eba5fb12 100644 --- a/mythplugins/mytharchive/mytharchive/importnative.cpp +++ b/mythplugins/mytharchive/mytharchive/importnative.cpp @@ -237,7 +237,7 @@ void ArchiveFileSelector::itemSelected(MythUIButtonListItem *item) if (!item) return; - FileData *fileData = item->GetData().value(); + auto *fileData = item->GetData().value(); if (!fileData) return; @@ -267,7 +267,7 @@ void ArchiveFileSelector::nextPressed() { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ImportNative *native = new ImportNative(mainStack, this, m_xmlFile, m_details); + auto *native = new ImportNative(mainStack, this, m_xmlFile, m_details); if (native->Create()) mainStack->AddScreen(native); @@ -505,7 +505,7 @@ void ImportNative::showList(const QString &caption, QString &value, { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUISearchDialog *searchDialog = new + auto *searchDialog = new MythUISearchDialog(popupStack, caption, m_searchList, true, value); if (!searchDialog->Create()) diff --git a/mythplugins/mytharchive/mytharchive/importnative.h b/mythplugins/mytharchive/mytharchive/importnative.h index f4677b7f079..1788c73838e 100644 --- a/mythplugins/mytharchive/mytharchive/importnative.h +++ b/mythplugins/mytharchive/mytharchive/importnative.h @@ -17,15 +17,15 @@ // mytharchive #include "fileselector.h" -typedef struct +struct FileInfo { bool directory; bool selected; QString filename; int64_t size; -} FileInfo; +}; -typedef struct +struct FileDetails { QString title; QString subtitle; @@ -35,7 +35,7 @@ typedef struct QString chanNo; QString chanName; QString callsign; -} FileDetails; +}; class MythUIText; diff --git a/mythplugins/mytharchive/mytharchive/logviewer.cpp b/mythplugins/mytharchive/mytharchive/logviewer.cpp index 6c709f5c58d..89655ff33bc 100644 --- a/mythplugins/mytharchive/mytharchive/logviewer.cpp +++ b/mythplugins/mytharchive/mytharchive/logviewer.cpp @@ -66,7 +66,7 @@ void showLogViewer(void) // do any logs exist? if ((!progressLog.isEmpty()) || (!fullLog.isEmpty())) { - LogViewer *viewer = new LogViewer(mainStack); + auto *viewer = new LogViewer(mainStack); viewer->setFilenames(progressLog, fullLog); if (viewer->Create()) mainStack->AddScreen(viewer); @@ -333,7 +333,7 @@ void LogViewer::showFullLog(void) void LogViewer::ShowMenu() { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(tr("Menu"), popupStack, "actionmenu"); + auto *menuPopup = new MythDialogBox(tr("Menu"), popupStack, "actionmenu"); if (menuPopup->Create()) popupStack->AddScreen(menuPopup); diff --git a/mythplugins/mytharchive/mytharchive/main.cpp b/mythplugins/mytharchive/mytharchive/main.cpp index 3ee093ac897..ae06d147cfe 100644 --- a/mythplugins/mytharchive/mytharchive/main.cpp +++ b/mythplugins/mytharchive/mytharchive/main.cpp @@ -131,7 +131,7 @@ static void runCreateDVD(void) } // show the select destination dialog - SelectDestination *dest = new SelectDestination(mainStack, false, "SelectDestination"); + auto *dest = new SelectDestination(mainStack, false, "SelectDestination"); if (dest->Create()) mainStack->AddScreen(dest); @@ -160,7 +160,7 @@ static void runCreateArchive(void) } // show the select destination dialog - SelectDestination *dest = new SelectDestination(mainStack, true, "SelectDestination"); + auto *dest = new SelectDestination(mainStack, true, "SelectDestination"); if (dest->Create()) mainStack->AddScreen(dest); @@ -195,7 +195,7 @@ static void runImportVideo(void) // show the find archive screen MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ArchiveFileSelector *selector = new ArchiveFileSelector(mainStack); + auto *selector = new ArchiveFileSelector(mainStack); if (selector->Create()) mainStack->AddScreen(selector); @@ -246,7 +246,7 @@ static void runTestDVD(void) static void runBurnDVD(void) { - BurnMenu *menu = new BurnMenu(); + auto *menu = new BurnMenu(); menu->start(); } @@ -300,9 +300,9 @@ static int runMenu(const QString& which_menu) } QString themedir = GetMythUI()->GetThemeDir(); - MythThemedMenu *diag = new MythThemedMenu( - themedir, which_menu, GetMythMainWindow()->GetMainStack(), - "archive menu"); + auto *diag = new MythThemedMenu(themedir, which_menu, + GetMythMainWindow()->GetMainStack(), + "archive menu"); // save the callback from the main menu if (mainMenu) @@ -382,9 +382,8 @@ int mythplugin_run(void) int mythplugin_config(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StandardSettingDialog *ssd = - new StandardSettingDialog(mainStack, "archivesettings", - new ArchiveSettings()); + auto *ssd = new StandardSettingDialog(mainStack, "archivesettings", + new ArchiveSettings()); if (ssd->Create()) { diff --git a/mythplugins/mytharchive/mytharchive/mythburn.cpp b/mythplugins/mytharchive/mytharchive/mythburn.cpp index 7e7f09b663f..383ab1bc46e 100644 --- a/mythplugins/mytharchive/mytharchive/mythburn.cpp +++ b/mythplugins/mytharchive/mytharchive/mythburn.cpp @@ -230,7 +230,7 @@ void MythBurn::updateSizeBar(void) void MythBurn::loadEncoderProfiles() { - EncoderProfile *item = new EncoderProfile; + auto *item = new EncoderProfile; item->name = "NONE"; item->description = ""; item->bitrate = 0.0F; @@ -293,7 +293,7 @@ void MythBurn::loadEncoderProfiles() } - EncoderProfile *item2 = new EncoderProfile; + auto *item2 = new EncoderProfile; item2->name = name; item2->description = desc; item2->bitrate = bitrate.toFloat(); @@ -304,7 +304,7 @@ void MythBurn::loadEncoderProfiles() void MythBurn::toggleUseCutlist(void) { MythUIButtonListItem *item = m_archiveButtonList->GetItemCurrent(); - ArchiveItem *a = item->GetData().value(); + auto *a = item->GetData().value(); if (!a) return; @@ -390,7 +390,7 @@ void MythBurn::updateArchiveList(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIBusyDialog *busyPopup = new + auto *busyPopup = new MythUIBusyDialog(message, popupStack, "mythburnbusydialog"); if (busyPopup->Create()) @@ -431,8 +431,7 @@ void MythBurn::updateArchiveList(void) recalcItemSize(a); - MythUIButtonListItem* item = new - MythUIButtonListItem(m_archiveButtonList, a->title); + auto* item = new MythUIButtonListItem(m_archiveButtonList, a->title); item->SetData(qVariantFromValue(a)); item->SetText(a->subtitle, "subtitle"); item->SetText(a->startDate + " " + a->startTime, "date"); @@ -580,7 +579,7 @@ void MythBurn::createConfigFile(const QString &filename) if (!item) continue; - ArchiveItem *a = item->GetData().value(); + auto *a = item->GetData().value(); if (!a) continue; @@ -673,7 +672,7 @@ void MythBurn::loadConfiguration(void) while (query.next()) { - ArchiveItem *a = new ArchiveItem; + auto *a = new ArchiveItem; a->type = query.value(0).toString(); a->title = query.value(1).toString(); a->subtitle = query.value(2).toString(); @@ -721,7 +720,7 @@ void MythBurn::saveConfiguration(void) if (!item) continue; - ArchiveItem *a = item->GetData().value(); + auto *a = item->GetData().value(); if (!a) continue; @@ -761,15 +760,14 @@ void MythBurn::ShowMenu() return; MythUIButtonListItem *item = m_archiveButtonList->GetItemCurrent(); - ArchiveItem *curItem = item->GetData().value(); + auto *curItem = item->GetData().value(); if (!curItem) return; MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(tr("Menu"), - popupStack, "actionmenu"); + auto *menuPopup = new MythDialogBox(tr("Menu"), popupStack, "actionmenu"); if (menuPopup->Create()) popupStack->AddScreen(menuPopup); @@ -795,7 +793,7 @@ void MythBurn::ShowMenu() void MythBurn::removeItem() { MythUIButtonListItem *item = m_archiveButtonList->GetItemCurrent(); - ArchiveItem *curItem = item->GetData().value(); + auto *curItem = item->GetData().value(); if (!curItem) return; @@ -808,14 +806,14 @@ void MythBurn::removeItem() void MythBurn::editDetails() { MythUIButtonListItem *item = m_archiveButtonList->GetItemCurrent(); - ArchiveItem *curItem = item->GetData().value(); + auto *curItem = item->GetData().value(); if (!curItem) return; MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - EditMetadataDialog *editor = new EditMetadataDialog(mainStack, curItem); + auto *editor = new EditMetadataDialog(mainStack, curItem); connect(editor, SIGNAL(haveResult(bool, ArchiveItem *)), this, SLOT(editorClosed(bool, ArchiveItem *))); @@ -827,14 +825,14 @@ void MythBurn::editDetails() void MythBurn::editThumbnails() { MythUIButtonListItem *item = m_archiveButtonList->GetItemCurrent(); - ArchiveItem *curItem = item->GetData().value(); + auto *curItem = item->GetData().value(); if (!curItem) return; MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ThumbFinder *finder = new ThumbFinder(mainStack, curItem, m_theme); + auto *finder = new ThumbFinder(mainStack, curItem, m_theme); if (finder->Create()) mainStack->AddScreen(finder); @@ -856,15 +854,14 @@ void MythBurn::editorClosed(bool ok, ArchiveItem *item) void MythBurn::changeProfile() { MythUIButtonListItem *item = m_archiveButtonList->GetItemCurrent(); - ArchiveItem *curItem = item->GetData().value(); + auto *curItem = item->GetData().value(); if (!curItem) return; MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - ProfileDialog *profileDialog = new ProfileDialog(popupStack, - curItem, m_profileList); + auto *profileDialog = new ProfileDialog(popupStack, curItem, m_profileList); if (profileDialog->Create()) { @@ -885,7 +882,7 @@ void MythBurn::profileChanged(int profileNo) if (!item) return; - ArchiveItem *archiveItem = item->GetData().value(); + auto *archiveItem = item->GetData().value(); if (!archiveItem) return; @@ -942,8 +939,7 @@ void MythBurn::handleAddRecording() { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - RecordingSelector *selector = new RecordingSelector(mainStack, - &m_archiveList); + auto *selector = new RecordingSelector(mainStack, &m_archiveList); connect(selector, SIGNAL(haveResult(bool)), this, SLOT(selectorClosed(bool))); @@ -973,7 +969,7 @@ void MythBurn::handleAddVideo() MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - VideoSelector *selector = new VideoSelector(mainStack, &m_archiveList); + auto *selector = new VideoSelector(mainStack, &m_archiveList); connect(selector, SIGNAL(haveResult(bool)), this, SLOT(selectorClosed(bool))); @@ -989,8 +985,8 @@ void MythBurn::handleAddFile() MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - FileSelector *selector = new FileSelector(mainStack, &m_archiveList, - FSTYPE_FILELIST, "/", filter); + auto *selector = new FileSelector(mainStack, &m_archiveList, + FSTYPE_FILELIST, "/", filter); connect(selector, SIGNAL(haveResult(bool)), this, SLOT(selectorClosed(bool))); @@ -1032,7 +1028,7 @@ bool ProfileDialog::Create() for (int x = 0; x < m_profileList.size(); x++) { - MythUIButtonListItem *item = new + auto *item = new MythUIButtonListItem(m_profile_list, m_profileList.at(x)->name); item->SetData(qVariantFromValue(m_profileList.at(x))); } @@ -1060,7 +1056,7 @@ void ProfileDialog::profileChanged(MythUIButtonListItem *item) if (!item) return; - EncoderProfile *profile = item->GetData().value(); + auto *profile = item->GetData().value(); if (!profile) return; @@ -1104,7 +1100,7 @@ void BurnMenu::start(void) QString msg = tr("\nPlace a blank DVD in the" " drive and select an option below."); MythScreenStack *mainStack = GetMythMainWindow()->GetStack("main stack"); - MythDialogBox *menuPopup = new MythDialogBox(title, msg, mainStack, + auto *menuPopup = new MythDialogBox(title, msg, mainStack, "actionmenu", true); if (menuPopup->Create()) diff --git a/mythplugins/mytharchive/mytharchive/recordingselector.cpp b/mythplugins/mytharchive/mytharchive/recordingselector.cpp index c09d9b28040..8f0c32f233c 100644 --- a/mythplugins/mytharchive/mytharchive/recordingselector.cpp +++ b/mythplugins/mytharchive/mytharchive/recordingselector.cpp @@ -110,7 +110,7 @@ void RecordingSelector::Init(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIBusyDialog *busyPopup = new + auto *busyPopup = new MythUIBusyDialog(message, popupStack, "recordingselectorbusydialog"); if (busyPopup->Create()) @@ -121,7 +121,7 @@ void RecordingSelector::Init(void) busyPopup = nullptr; } - GetRecordingListThread *thread = new GetRecordingListThread(this); + auto *thread = new GetRecordingListThread(this); while (thread->isRunning()) { qApp->processEvents(); @@ -178,7 +178,7 @@ void RecordingSelector::ShowMenu() { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(tr("Menu"), popupStack, "actionmenu"); + auto *menuPopup = new MythDialogBox(tr("Menu"), popupStack, "actionmenu"); if (menuPopup->Create()) popupStack->AddScreen(menuPopup); @@ -195,7 +195,7 @@ void RecordingSelector::selectAll() m_selectedList.takeFirst(); m_selectedList.clear(); - vector::iterator i = m_recordingList->begin(); + auto i = m_recordingList->begin(); for ( ; i != m_recordingList->end(); ++i) { ProgramInfo *p = *i; @@ -235,7 +235,7 @@ void RecordingSelector::toggleSelected(MythUIButtonListItem *item) void RecordingSelector::titleChanged(MythUIButtonListItem *item) { - ProgramInfo *p = item->GetData().value(); + auto *p = item->GetData().value(); if (!p) return; @@ -334,7 +334,7 @@ void RecordingSelector::OKPressed() for (int x = 0; x < m_selectedList.size(); x++) { ProgramInfo *p = m_selectedList.at(x); - ArchiveItem *a = new ArchiveItem; + auto *a = new ArchiveItem; a->type = "Recording"; a->title = p->GetTitle(); a->subtitle = p->GetSubtitle(); @@ -377,7 +377,7 @@ void RecordingSelector::updateRecordingList(void) if (m_categorySelector) { - vector::iterator i = m_recordingList->begin(); + auto i = m_recordingList->begin(); for ( ; i != m_recordingList->end(); ++i) { ProgramInfo *p = *i; @@ -385,7 +385,7 @@ void RecordingSelector::updateRecordingList(void) if (p->GetTitle() == m_categorySelector->GetValue() || m_categorySelector->GetValue() == tr("All Recordings")) { - MythUIButtonListItem* item = new MythUIButtonListItem( + auto* item = new MythUIButtonListItem( m_recordingButtonList, p->GetTitle() + " ~ " + p->GetScheduledStartTime().toLocalTime() @@ -461,7 +461,7 @@ void RecordingSelector::getRecordingList(void) if (m_recordingList && !m_recordingList->empty()) { - vector::iterator i = m_recordingList->begin(); + auto i = m_recordingList->begin(); for ( ; i != m_recordingList->end(); ++i) { ProgramInfo *p = *i; diff --git a/mythplugins/mytharchive/mytharchive/selectdestination.cpp b/mythplugins/mytharchive/mytharchive/selectdestination.cpp index e84cfda302a..7f7c34c0c5e 100644 --- a/mythplugins/mytharchive/mytharchive/selectdestination.cpp +++ b/mythplugins/mytharchive/mytharchive/selectdestination.cpp @@ -66,7 +66,7 @@ bool SelectDestination::Create(void) for (int x = 0; x < ArchiveDestinationsCount; x++) { - MythUIButtonListItem *item = new + auto *item = new MythUIButtonListItem(m_destinationSelector, tr(ArchiveDestinations[x].name)); item->SetData(qVariantFromValue(ArchiveDestinations[x].type)); } @@ -118,14 +118,14 @@ void SelectDestination::handleNextPage() if (m_nativeMode) { - ExportNative *native = new ExportNative(mainStack, this, m_archiveDestination, "ExportNative"); + auto *native = new ExportNative(mainStack, this, m_archiveDestination, "ExportNative"); if (native->Create()) mainStack->AddScreen(native); } else { - DVDThemeSelector *theme = new DVDThemeSelector(mainStack, this, m_archiveDestination, "ThemeSelector"); + auto *theme = new DVDThemeSelector(mainStack, this, m_archiveDestination, "ThemeSelector"); if (theme->Create()) mainStack->AddScreen(theme); @@ -269,7 +269,7 @@ void SelectDestination::handleFind(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - FileSelector *selector = new + auto *selector = new FileSelector(mainStack, nullptr, FSTYPE_DIRECTORY, m_filenameEdit->GetText(), "*.*"); connect(selector, SIGNAL(haveResult(QString)), diff --git a/mythplugins/mytharchive/mytharchive/themeselector.cpp b/mythplugins/mytharchive/mytharchive/themeselector.cpp index 1451a87c886..3c1da7d20a9 100644 --- a/mythplugins/mytharchive/mytharchive/themeselector.cpp +++ b/mythplugins/mytharchive/mytharchive/themeselector.cpp @@ -104,8 +104,8 @@ void DVDThemeSelector::handleNextPage() // show next page MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - MythBurn *burn = new MythBurn(mainStack, m_destinationScreen, this, - m_archiveDestination, "MythBurn"); + auto *burn = new MythBurn(mainStack, m_destinationScreen, this, + m_archiveDestination, "MythBurn"); if (burn->Create()) mainStack->AddScreen(burn); diff --git a/mythplugins/mytharchive/mytharchive/thumbfinder.cpp b/mythplugins/mytharchive/mytharchive/thumbfinder.cpp index f4fd5cf231b..60e82b6cdeb 100644 --- a/mythplugins/mytharchive/mytharchive/thumbfinder.cpp +++ b/mythplugins/mytharchive/mytharchive/thumbfinder.cpp @@ -94,7 +94,7 @@ ThumbFinder::ThumbFinder(MythScreenStack *parent, ArchiveItem *archiveItem, m_thumbList.clear(); for (int x = 0; x < m_archiveItem->thumbList.size(); x++) { - ThumbImage *thumb = new ThumbImage; + auto *thumb = new ThumbImage; *thumb = *m_archiveItem->thumbList.at(x); m_thumbList.append(thumb); } @@ -290,7 +290,7 @@ void ThumbFinder::savePressed() for (int x = 0; x < m_thumbList.size(); x++) { - ThumbImage *thumb = new ThumbImage; + auto *thumb = new ThumbImage; *thumb = *m_thumbList.at(x); m_archiveItem->thumbList.append(thumb); } @@ -500,7 +500,7 @@ bool ThumbFinder::getThumbImages() int sec = chapter % 60; QString time = QString::asprintf("%02d:%02d:%02d", hour, min, sec); - int64_t frame = (int64_t) (chapter * ceil(m_fps)); + auto frame = (int64_t) (chapter * ceil(m_fps)); // no thumb available create a new one thumb = new ThumbImage; @@ -865,7 +865,7 @@ void ThumbFinder::closeAVCodec() void ThumbFinder::ShowMenu() { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(tr("Menu"), popupStack, "actionmenu"); + auto *menuPopup = new MythDialogBox(tr("Menu"), popupStack, "actionmenu"); if (menuPopup->Create()) popupStack->AddScreen(menuPopup); @@ -882,7 +882,7 @@ void ThumbFinder::updatePositionBar(int64_t frame) return; QSize size = m_positionImage->GetArea().size(); - QPixmap *pixmap = new QPixmap(size.width(), size.height()); + auto *pixmap = new QPixmap(size.width(), size.height()); QPainter p(pixmap); QBrush brush(Qt::green); diff --git a/mythplugins/mytharchive/mytharchive/thumbfinder.h b/mythplugins/mytharchive/mytharchive/thumbfinder.h index 41d34a1dcfb..e55860d787b 100644 --- a/mythplugins/mytharchive/mytharchive/thumbfinder.h +++ b/mythplugins/mytharchive/mytharchive/thumbfinder.h @@ -19,11 +19,11 @@ extern "C" { #include "remoteavformatcontext.h" #include "mythavutil.h" -typedef struct SeekAmount +struct SeekAmount { QString name; int amount; -} SeekAmount; +}; extern struct SeekAmount SeekAmounts[]; extern int SeekAmountsCount; diff --git a/mythplugins/mytharchive/mytharchive/videoselector.cpp b/mythplugins/mytharchive/mytharchive/videoselector.cpp index eb68748dae3..a54103107b6 100644 --- a/mythplugins/mytharchive/mytharchive/videoselector.cpp +++ b/mythplugins/mytharchive/mytharchive/videoselector.cpp @@ -138,7 +138,7 @@ void VideoSelector::ShowMenu() { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(tr("Menu"), popupStack, "actionmenu"); + auto *menuPopup = new MythDialogBox(tr("Menu"), popupStack, "actionmenu"); if (menuPopup->Create()) popupStack->AddScreen(menuPopup); @@ -155,7 +155,7 @@ void VideoSelector::selectAll() m_selectedList.takeFirst(); m_selectedList.clear(); - vector::iterator i = m_videoList->begin(); + auto i = m_videoList->begin(); for ( ; i != m_videoList->end(); ++i) { VideoInfo *v = *i; @@ -195,7 +195,7 @@ void VideoSelector::toggleSelected(MythUIButtonListItem *item) void VideoSelector::titleChanged(MythUIButtonListItem *item) { - VideoInfo *v = item->GetData().value(); + auto *v = item->GetData().value(); if (!v) return; @@ -291,7 +291,7 @@ void VideoSelector::OKPressed() for (int x = 0; x < m_selectedList.size(); x++) { VideoInfo *v = m_selectedList.at(x); - ArchiveItem *a = new ArchiveItem; + auto *a = new ArchiveItem; a->type = "Video"; a->title = v->title; a->subtitle = ""; @@ -333,7 +333,7 @@ void VideoSelector::updateVideoList(void) if (m_categorySelector) { - vector::iterator i = m_videoList->begin(); + auto i = m_videoList->begin(); for ( ; i != m_videoList->end(); ++i) { VideoInfo *v = *i; @@ -343,8 +343,8 @@ void VideoSelector::updateVideoList(void) { if (v->parentalLevel <= m_currentParentalLevel) { - MythUIButtonListItem* item = new MythUIButtonListItem( - m_videoButtonList, v->title); + auto* item = new MythUIButtonListItem(m_videoButtonList, + v->title); item->setCheckable(true); if (m_selectedList.indexOf(v) != -1) { @@ -381,7 +381,7 @@ void VideoSelector::updateVideoList(void) vector *VideoSelector::getVideoListFromDB(void) { // get a list of category's - typedef QMap CategoryMap; + using CategoryMap = QMap; CategoryMap categoryMap; MSqlQuery query(MSqlQuery::InitCon()); query.prepare("SELECT intid, category FROM videocategory"); @@ -402,7 +402,7 @@ vector *VideoSelector::getVideoListFromDB(void) if (query.exec() && query.size()) { - vector *videoList = new vector; + auto *videoList = new vector; QString artist, genre, episode; while (query.next()) { @@ -411,7 +411,7 @@ vector *VideoSelector::getVideoListFromDB(void) if (filename.endsWith(".iso") || filename.endsWith(".ISO")) continue; - VideoInfo *info = new VideoInfo; + auto *info = new VideoInfo; info->id = query.value(0).toInt(); if (query.value(9).toInt() > 0) @@ -488,7 +488,7 @@ void VideoSelector::getVideoList(void) if (m_videoList && !m_videoList->empty()) { - vector::iterator i = m_videoList->begin(); + auto i = m_videoList->begin(); for ( ; i != m_videoList->end(); ++i) { VideoInfo *v = *i; diff --git a/mythplugins/mytharchive/mytharchive/videoselector.h b/mythplugins/mytharchive/mytharchive/videoselector.h index e3304618371..a719a40f0ba 100644 --- a/mythplugins/mytharchive/mytharchive/videoselector.h +++ b/mythplugins/mytharchive/mytharchive/videoselector.h @@ -23,7 +23,7 @@ class MythUIButton; class MythUIButtonList; class MythUIButtonListItem; -typedef struct +struct VideoInfo { int id; QString title; @@ -33,7 +33,7 @@ typedef struct QString coverfile; int parentalLevel; uint64_t size; -} VideoInfo; +}; class VideoSelector : public MythScreenType { diff --git a/mythplugins/mytharchive/mytharchivehelper/main.cpp b/mythplugins/mytharchive/mytharchivehelper/main.cpp index 604b238b7e7..49ecc23c5d2 100644 --- a/mythplugins/mytharchive/mytharchivehelper/main.cpp +++ b/mythplugins/mytharchive/mytharchivehelper/main.cpp @@ -1620,7 +1620,7 @@ static int grabThumbnail(const QString& inFile, const QString& thumbList, const MythPictureDeinterlacer deinterlacer(codecCtx->pix_fmt, width, height); int bufflen = width * height * 4; - unsigned char *outputbuf = new unsigned char[bufflen]; + auto *outputbuf = new unsigned char[bufflen]; int frameNo = -1, thumbCount = 0; bool frameFinished = false; diff --git a/mythplugins/mythbrowser/mythbrowser/bookmarkmanager.cpp b/mythplugins/mythbrowser/mythbrowser/bookmarkmanager.cpp index 2bac93d071d..7602de672e0 100644 --- a/mythplugins/mythbrowser/mythbrowser/bookmarkmanager.cpp +++ b/mythplugins/mythbrowser/mythbrowser/bookmarkmanager.cpp @@ -208,8 +208,8 @@ void BookmarkManager::UpdateURLList(void) if (group == site->m_category) { - MythUIButtonListItem *item2 = new MythUIButtonListItem( - m_bookmarkList, "", "", true, MythUIButtonListItem::NotChecked); + auto *item2 = new MythUIButtonListItem(m_bookmarkList, + "", "", true, MythUIButtonListItem::NotChecked); item2->SetText(site->m_name, "name"); item2->SetText(site->m_url, "url"); if (site->m_isHomepage) @@ -293,7 +293,7 @@ bool BookmarkManager::keyPressEvent(QKeyEvent *event) if (item) { - Bookmark *site = item->GetData().value(); + auto *site = item->GetData().value(); if (item->state() == MythUIButtonListItem::NotChecked) { @@ -336,7 +336,7 @@ void BookmarkManager::slotBookmarkClicked(MythUIButtonListItem *item) if (!item) return; - Bookmark *site = item->GetData().value(); + auto *site = item->GetData().value(); if (!site) return; @@ -408,8 +408,8 @@ void BookmarkManager::ShowEditDialog(bool edit) MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - BookmarkEditor *editor = new BookmarkEditor(&m_savedBookmark, edit, mainStack, - "bookmarkeditor"); + auto *editor = new BookmarkEditor(&m_savedBookmark, edit, mainStack, + "bookmarkeditor"); connect(editor, SIGNAL(Exiting()), this, SLOT(slotEditDialogExited())); @@ -436,7 +436,7 @@ void BookmarkManager::ReloadBookmarks(void) MythUIButtonListItem *item = m_bookmarkList->GetItemAt(x); if (item && item->GetData().isValid()) { - Bookmark *site = item->GetData().value(); + auto *site = item->GetData().value(); if (site && (*site == m_savedBookmark)) { m_bookmarkList->SetItemCurrent(item); @@ -449,7 +449,7 @@ void BookmarkManager::ReloadBookmarks(void) void BookmarkManager::slotSettings(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - BrowserConfig *config = new BrowserConfig(mainStack, "browserconfig"); + auto *config = new BrowserConfig(mainStack, "browserconfig"); if (config->Create()) mainStack->AddScreen(config); @@ -464,7 +464,7 @@ void BookmarkManager::slotSetHomepage(void) MythUIButtonListItem *item = m_bookmarkList->GetItemCurrent(); if (item && item->GetData().isValid()) { - Bookmark *site = item->GetData().value(); + auto *site = item->GetData().value(); if (site) UpdateHomepageInDB(site); } @@ -490,7 +490,7 @@ void BookmarkManager::slotDeleteCurrent(void) QString message = tr("Are you sure you want to delete the selected bookmark?"); - MythConfirmationDialog *dialog = new MythConfirmationDialog(popupStack, message, true); + auto *dialog = new MythConfirmationDialog(popupStack, message, true); if (dialog->Create()) popupStack->AddScreen(dialog); @@ -508,7 +508,7 @@ void BookmarkManager::slotDoDeleteCurrent(bool doDelete) if (item) { QString category = ""; - Bookmark *site = item->GetData().value(); + auto *site = item->GetData().value(); if (site) { category = site->m_category; @@ -534,7 +534,7 @@ void BookmarkManager::slotDeleteMarked(void) QString message = tr("Are you sure you want to delete the marked bookmarks?"); - MythConfirmationDialog *dialog = new MythConfirmationDialog(popupStack, message, true); + auto *dialog = new MythConfirmationDialog(popupStack, message, true); if (dialog->Create()) popupStack->AddScreen(dialog); @@ -581,7 +581,7 @@ void BookmarkManager::slotShowMarked(void) MythUIButtonListItem *item = m_bookmarkList->GetItemCurrent(); if (item && item->GetData().isValid()) { - Bookmark *site = item->GetData().value(); + auto *site = item->GetData().value(); m_savedBookmark = *site; } @@ -600,7 +600,7 @@ void BookmarkManager::slotShowMarked(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - MythBrowser *mythbrowser = new MythBrowser(mainStack, urls); + auto *mythbrowser = new MythBrowser(mainStack, urls); if (mythbrowser->Create()) { @@ -644,7 +644,7 @@ void BookmarkManager::slotClearMarked(void) { item->setChecked(MythUIButtonListItem::NotChecked); - Bookmark *site = item->GetData().value(); + auto *site = item->GetData().value(); if (site) site->m_selected = false; } diff --git a/mythplugins/mythbrowser/mythbrowser/browserdbutil.cpp b/mythplugins/mythbrowser/mythbrowser/browserdbutil.cpp index db4d637e944..6b48c030850 100644 --- a/mythplugins/mythbrowser/mythbrowser/browserdbutil.cpp +++ b/mythplugins/mythbrowser/mythbrowser/browserdbutil.cpp @@ -265,7 +265,7 @@ int GetSiteList(QList &siteList) std::shared_ptrsh = getMythSortHelper(); while (query.next()) { - Bookmark *site = new Bookmark(); + auto *site = new Bookmark(); site->m_category = query.value(0).toString(); site->m_name = query.value(1).toString(); site->m_sortName = sh->doTitle(site->m_name); diff --git a/mythplugins/mythbrowser/mythbrowser/main.cpp b/mythplugins/mythbrowser/mythbrowser/main.cpp index 13fa138d48b..2ebd0861b53 100644 --- a/mythplugins/mythbrowser/mythbrowser/main.cpp +++ b/mythplugins/mythbrowser/mythbrowser/main.cpp @@ -37,7 +37,7 @@ static int handleMedia(const QString &url, const QString &directory, const QStri if (urls[0].startsWith("mythflash://")) { - MythFlashPlayer *flashplayer = new MythFlashPlayer(mainStack, urls); + auto *flashplayer = new MythFlashPlayer(mainStack, urls); if (flashplayer->Create()) mainStack->AddScreen(flashplayer); else @@ -45,7 +45,7 @@ static int handleMedia(const QString &url, const QString &directory, const QStri } else { - MythBrowser *mythbrowser = new MythBrowser(mainStack, urls); + auto *mythbrowser = new MythBrowser(mainStack, urls); if (!directory.isEmpty()) mythbrowser->setDefaultSaveDirectory(directory); @@ -95,8 +95,7 @@ static void runHomepage() MythScreenStack *m_popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythConfirmationDialog *okPopup = - new MythConfirmationDialog(m_popupStack, message, false); + auto *okPopup = new MythConfirmationDialog(m_popupStack, message, false); if (okPopup->Create()) m_popupStack->AddScreen(okPopup); @@ -146,7 +145,7 @@ int mythplugin_run(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - BookmarkManager *manager = new BookmarkManager(mainStack, "bookmarkmanager"); + auto *manager = new BookmarkManager(mainStack, "bookmarkmanager"); if (manager->Create()) { @@ -161,7 +160,7 @@ int mythplugin_config(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - BrowserConfig *config = new BrowserConfig(mainStack, "browserconfig"); + auto *config = new BrowserConfig(mainStack, "browserconfig"); if (config->Create()) { diff --git a/mythplugins/mythbrowser/mythbrowser/mythbrowser.cpp b/mythplugins/mythbrowser/mythbrowser/mythbrowser.cpp index b4e166c7cf6..66b5a6d2d80 100644 --- a/mythplugins/mythbrowser/mythbrowser/mythbrowser.cpp +++ b/mythplugins/mythbrowser/mythbrowser/mythbrowser.cpp @@ -77,7 +77,7 @@ bool MythBrowser::Create(void) } // this is the template for all other browser tabs - WebPage *page = new WebPage(this, browser); + auto *page = new WebPage(this, browser); m_browserList.append(page); page->getBrowser()->SetDefaultSaveDirectory(m_defaultSaveDir); @@ -142,7 +142,7 @@ void MythBrowser::slotEnterURL(void) QString message = tr("Enter URL"); - MythTextInputDialog *dialog = new MythTextInputDialog(popupStack, message); + auto *dialog = new MythTextInputDialog(popupStack, message); if (dialog->Create()) popupStack->AddScreen(dialog); @@ -154,8 +154,8 @@ void MythBrowser::slotEnterURL(void) void MythBrowser::slotAddTab(const QString &url, bool doSwitch) { QString name = QString("browser%1").arg(m_browserList.size() + 1); - WebPage *page = new WebPage(this, m_browserList[0]->getBrowser()->GetArea(), - name.toLatin1().constData()); + auto *page = new WebPage(this, m_browserList[0]->getBrowser()->GetArea(), + name.toLatin1().constData()); m_browserList.append(page); QString newUrl = url; @@ -259,7 +259,7 @@ void MythBrowser::slotAddBookmark() MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - BookmarkEditor *editor = new BookmarkEditor(&m_editBookmark, + auto *editor = new BookmarkEditor(&m_editBookmark, true, mainStack, "bookmarkeditor"); diff --git a/mythplugins/mythgame/mythgame/gamedetails.cpp b/mythplugins/mythgame/mythgame/gamedetails.cpp index 2d4aa868147..70ec3922319 100644 --- a/mythplugins/mythgame/mythgame/gamedetails.cpp +++ b/mythplugins/mythgame/mythgame/gamedetails.cpp @@ -77,8 +77,7 @@ void GameDetailsPopup::Play() { if (m_retObject) { - DialogCompletionEvent *dce = - new DialogCompletionEvent(m_id, 0, "", ""); + auto *dce = new DialogCompletionEvent(m_id, 0, "", ""); QApplication::postEvent(m_retObject, dce); Close(); } diff --git a/mythplugins/mythgame/mythgame/gamehandler.cpp b/mythplugins/mythgame/mythgame/gamehandler.cpp index c9aa3b321f2..e84affe466b 100644 --- a/mythplugins/mythgame/mythgame/gamehandler.cpp +++ b/mythplugins/mythgame/mythgame/gamehandler.cpp @@ -219,7 +219,7 @@ void GameHandler::promptForRemoval(const GameScan& scan) return; MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *removalPopup = new MythDialogBox( + auto *removalPopup = new MythDialogBox( //: %1 is the file name tr("%1 appears to be missing.\n" "Remove it from the database?") @@ -598,7 +598,7 @@ int GameHandler::buildFileCount(const QString& directory, GameHandler *handler) void GameHandler::clearAllGameData(void) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *clearPopup = new MythDialogBox( + auto *clearPopup = new MythDialogBox( tr("This will clear all game metadata from the database. Are you sure " "you want to do this?"), popupStack, "clearAllPopup"); @@ -697,7 +697,7 @@ void GameHandler::processGames(GameHandler *handler) //: %1 is the system name QString message = tr("Scanning for %1 games...") .arg(handler->SystemName()); - MythUIBusyDialog *busyDialog = new MythUIBusyDialog(message, popupStack, + auto *busyDialog = new MythUIBusyDialog(message, popupStack, "gamescanbusy"); if (busyDialog->Create()) diff --git a/mythplugins/mythgame/mythgame/gamehandler.h b/mythplugins/mythgame/mythgame/gamehandler.h index 697089d738a..f2e60c308c9 100644 --- a/mythplugins/mythgame/mythgame/gamehandler.h +++ b/mythplugins/mythgame/mythgame/gamehandler.h @@ -49,7 +49,7 @@ class GameScan Q_DECLARE_METATYPE(GameScan) -typedef QMap GameScanMap; +using GameScanMap = QMap; class MythUIProgressDialog; class GameHandler : public QObject diff --git a/mythplugins/mythgame/mythgame/gamescan.cpp b/mythplugins/mythgame/mythgame/gamescan.cpp index bcb345c562c..948e3bd294a 100644 --- a/mythplugins/mythgame/mythgame/gamescan.cpp +++ b/mythplugins/mythgame/mythgame/gamescan.cpp @@ -181,8 +181,7 @@ void GameScannerThread::SendProgressEvent(uint progress, uint total, if (!m_dialog) return; - ProgressUpdateEvent *pue = new ProgressUpdateEvent(progress, total, - std::move(message)); + auto *pue = new ProgressUpdateEvent(progress, total, std::move(message)); QApplication::postEvent(m_dialog, pue); } @@ -206,7 +205,7 @@ void GameScanner::doScan(QList handlers) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIProgressDialog *progressDlg = new MythUIProgressDialog("", + auto *progressDlg = new MythUIProgressDialog("", popupStack, "gamescanprogressdialog"); if (progressDlg->Create()) diff --git a/mythplugins/mythgame/mythgame/gamescan.h b/mythplugins/mythgame/mythgame/gamescan.h index 5a88108c4c0..431f7a0a72f 100644 --- a/mythplugins/mythgame/mythgame/gamescan.h +++ b/mythplugins/mythgame/mythgame/gamescan.h @@ -26,7 +26,7 @@ struct RomFileInfo bool indb; }; -typedef QList< RomFileInfo > RomFileInfoList; +using RomFileInfoList = QList< RomFileInfo >; class GameScannerThread : public MThread { diff --git a/mythplugins/mythgame/mythgame/gamesettings.cpp b/mythplugins/mythgame/mythgame/gamesettings.cpp index 674a5c50b87..5bdd175fef7 100644 --- a/mythplugins/mythgame/mythgame/gamesettings.cpp +++ b/mythplugins/mythgame/mythgame/gamesettings.cpp @@ -66,7 +66,7 @@ QString GetGameTypeExtensions(const QString &GameType) static HostTextEditSetting *GameAllTreeLevels() { - HostTextEditSetting *gc = new HostTextEditSetting("GameAllTreeLevels"); + auto *gc = new HostTextEditSetting("GameAllTreeLevels"); gc->setLabel(TR("Game display order")); gc->setValue("system gamename"); gc->setHelpText(TR("Order in which to sort the " @@ -79,7 +79,7 @@ static HostTextEditSetting *GameAllTreeLevels() static HostTextEditSetting *GameFavTreeLevels() { - HostTextEditSetting *gc = new HostTextEditSetting("GameFavTreeLevels"); + auto *gc = new HostTextEditSetting("GameFavTreeLevels"); gc->setLabel(TR("Favorite display order")); gc->setValue("gamename"); gc->setHelpText(TR("Order in which to sort the " @@ -92,7 +92,7 @@ static HostTextEditSetting *GameFavTreeLevels() static HostCheckBoxSetting *GameDeepScan() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("GameDeepScan"); + auto *gc = new HostCheckBoxSetting("GameDeepScan"); gc->setLabel(TR("Indepth Game Scan")); gc->setHelpText( TR("Enabling this causes a game scan to " @@ -106,7 +106,7 @@ static HostCheckBoxSetting *GameDeepScan() static HostCheckBoxSetting *GameRemovalPrompt() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("GameRemovalPrompt"); + auto *gc = new HostCheckBoxSetting("GameRemovalPrompt"); gc->setLabel(TR("Prompt for removal of deleted ROM(s)")); gc->setHelpText(TR("This enables a prompt for " "removing deleted ROMs from " @@ -118,7 +118,7 @@ static HostCheckBoxSetting *GameRemovalPrompt() static HostCheckBoxSetting *GameShowFileNames() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("GameShowFileNames"); + auto *gc = new HostCheckBoxSetting("GameShowFileNames"); gc->setLabel(TR("Display Files Names in Game " "Tree")); gc->setHelpText(TR("Enabling this causes the " @@ -130,7 +130,7 @@ static HostCheckBoxSetting *GameShowFileNames() static HostCheckBoxSetting *GameTreeView() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("GameTreeView"); + auto *gc = new HostCheckBoxSetting("GameTreeView"); gc->setLabel(TR("Hash filenames in display")); gc->setValue(0); gc->setHelpText(TR("Enable hashing of names in " @@ -142,7 +142,7 @@ static HostCheckBoxSetting *GameTreeView() static HostTextEditSetting *GetScreenshotDir() { - HostTextEditSetting *gc = new HostTextEditSetting("mythgame.screenshotdir"); + auto *gc = new HostTextEditSetting("mythgame.screenshotdir"); gc->setLabel(TR("Directory where Game Screenshots " "are stored")); gc->setValue(GetConfDir() + "/MythGame/Screenshots"); @@ -154,7 +154,7 @@ static HostTextEditSetting *GetScreenshotDir() static HostTextEditSetting *GetFanartDir() { - HostTextEditSetting *gc = new HostTextEditSetting("mythgame.fanartdir"); + auto *gc = new HostTextEditSetting("mythgame.fanartdir"); gc->setLabel(TR("Directory where Game Fanart is " "stored")); gc->setValue(GetConfDir() + "/MythGame/Fanart"); @@ -166,7 +166,7 @@ static HostTextEditSetting *GetFanartDir() static HostTextEditSetting *GetBoxartDir() { - HostTextEditSetting *gc = new HostTextEditSetting("mythgame.boxartdir"); + auto *gc = new HostTextEditSetting("mythgame.boxartdir"); gc->setLabel(TR("Directory where Game Boxart is " "stored")); gc->setValue(GetConfDir() + "/MythGame/Boxart"); diff --git a/mythplugins/mythgame/mythgame/gameui.cpp b/mythplugins/mythgame/mythgame/gameui.cpp index add8bbf54fa..381d778b2e5 100644 --- a/mythplugins/mythgame/mythgame/gameui.cpp +++ b/mythplugins/mythgame/mythgame/gameui.cpp @@ -132,7 +132,7 @@ void GameUI::BuildTree() QString levels = gCoreContext->GetSetting("GameFavTreeLevels"); - MythGenericTree *new_node = new MythGenericTree(tr("Favorites"), 1, true); + auto *new_node = new MythGenericTree(tr("Favorites"), 1, true); new_node->SetData(qVariantFromValue( new GameTreeInfo(levels, systemFilter + " and favorite=1"))); m_favouriteNode = m_gameTree->addNode(new_node); @@ -228,7 +228,7 @@ void GameUI::nodeChanged(MythGenericTree* node) } else { - RomInfo *romInfo = node->GetData().value(); + auto *romInfo = node->GetData().value(); if (!romInfo) return; if (romInfo->Romname().isEmpty()) @@ -254,7 +254,7 @@ void GameUI::itemClicked(MythUIButtonListItem* /*item*/) MythGenericTree *node = m_gameUITree->GetCurrentNode(); if (isLeaf(node)) { - RomInfo *romInfo = node->GetData().value(); + auto *romInfo = node->GetData().value(); if (!romInfo) return; if (romInfo->RomCount() == 1) @@ -267,7 +267,7 @@ void GameUI::itemClicked(MythUIButtonListItem* /*item*/) QString msg = tr("Choose System for:\n%1").arg(node->GetText()); MythScreenStack *popupStack = GetMythMainWindow()-> GetStack("popup stack"); - MythDialogBox *chooseSystemPopup = new MythDialogBox( + auto *chooseSystemPopup = new MythDialogBox( msg, popupStack, "chooseSystemPopup"); if (chooseSystemPopup->Create()) @@ -380,11 +380,11 @@ void GameUI::edit(void) MythGenericTree *node = m_gameUITree->GetCurrentNode(); if (isLeaf(node)) { - RomInfo *romInfo = node->GetData().value(); + auto *romInfo = node->GetData().value(); MythScreenStack *screenStack = GetScreenStack(); - EditRomInfoDialog *md_editor = new EditRomInfoDialog(screenStack, + auto *md_editor = new EditRomInfoDialog(screenStack, "mythgameeditmetadata", romInfo); if (md_editor->Create()) @@ -402,12 +402,11 @@ void GameUI::showInfo() MythGenericTree *node = m_gameUITree->GetCurrentNode(); if (isLeaf(node)) { - RomInfo *romInfo = node->GetData().value(); + auto *romInfo = node->GetData().value(); if (!romInfo) return; MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - GameDetailsPopup *details_dialog = - new GameDetailsPopup(mainStack, romInfo); + auto *details_dialog = new GameDetailsPopup(mainStack, romInfo); if (details_dialog->Create()) { @@ -425,7 +424,7 @@ void GameUI::ShowMenu() MythScreenStack *popupStack = GetMythMainWindow()-> GetStack("popup stack"); - MythDialogBox *showMenuPopup = + auto *showMenuPopup = new MythDialogBox(node->GetText(), popupStack, "showMenuPopup"); if (showMenuPopup->Create()) @@ -435,7 +434,7 @@ void GameUI::ShowMenu() showMenuPopup->AddButton(tr("Scan For Changes")); if (isLeaf(node)) { - RomInfo *romInfo = node->GetData().value(); + auto *romInfo = node->GetData().value(); if (romInfo) { showMenuPopup->AddButton(tr("Show Information")); @@ -471,7 +470,7 @@ void GameUI::searchStart(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUISearchDialog *searchDialog = new MythUISearchDialog(popupStack, + auto *searchDialog = new MythUISearchDialog(popupStack, tr("Game Search"), childList, true, ""); if (searchDialog->Create()) @@ -491,7 +490,7 @@ void GameUI::toggleFavorite(void) MythGenericTree *node = m_gameUITree->GetCurrentNode(); if (isLeaf(node)) { - RomInfo *romInfo = node->GetData().value(); + auto *romInfo = node->GetData().value(); romInfo->setFavorite(true); updateChangedNode(node, romInfo); } @@ -536,17 +535,17 @@ void GameUI::customEvent(QEvent *event) if (!resulttext.isEmpty() && resulttext != tr("Cancel")) { MythGenericTree *node = m_gameUITree->GetCurrentNode(); - RomInfo *romInfo = node->GetData().value(); + auto *romInfo = node->GetData().value(); GameHandler::Launchgame(romInfo, resulttext); } } else if (resultid == "editMetadata") { MythGenericTree *node = m_gameUITree->GetCurrentNode(); - RomInfo *oldRomInfo = node->GetData().value(); + auto *oldRomInfo = node->GetData().value(); delete oldRomInfo; - RomInfo *romInfo = dce->GetData().value(); + auto *romInfo = dce->GetData().value(); node->SetData(qVariantFromValue(romInfo)); node->SetText(romInfo->Gamename()); @@ -581,7 +580,7 @@ void GameUI::customEvent(QEvent *event) } else { - MetadataResultsDialog *resultsdialog = + auto *resultsdialog = new MetadataResultsDialog(m_popupStack, lul); connect(resultsdialog, SIGNAL(haveResult(RefCountHandler)), @@ -608,10 +607,10 @@ void GameUI::customEvent(QEvent *event) if (!lul.empty()) { MetadataLookup *lookup = lul[0]; - MythGenericTree *node = lookup->GetData().value(); + auto *node = lookup->GetData().value(); if (node) { - RomInfo *metadata = node->GetData().value(); + auto *metadata = node->GetData().value(); if (metadata) { } @@ -622,7 +621,7 @@ void GameUI::customEvent(QEvent *event) } else if (event->type() == ImageDLEvent::kEventType) { - ImageDLEvent *ide = dynamic_cast(event); + auto *ide = dynamic_cast(event); if (ide == nullptr) return; MetadataLookup *lookup = ide->m_item; @@ -648,7 +647,7 @@ QString GameUI::getFillSql(MythGenericTree *node) const QString childLevel = getChildLevelString(node); QString filter = getFilter(node); bool childIsLeaf = childDepth == getLevelsOnThisBranch(node) + 1; - RomInfo *romInfo = node->GetData().value(); + auto *romInfo = node->GetData().value(); QString columns; QString conj = "where "; @@ -768,7 +767,7 @@ QString GameUI::getChildLevelString(MythGenericTree *node) while (node->getInt() != 1) node = node->getParent(); - GameTreeInfo *gi = node->GetData().value(); + auto *gi = node->GetData().value(); return gi->getLevel(this_level - 1); } @@ -776,7 +775,7 @@ QString GameUI::getFilter(MythGenericTree *node) { while (node->getInt() != 1) node = node->getParent(); - GameTreeInfo *gi = node->GetData().value(); + auto *gi = node->GetData().value(); return gi->getFilter(); } @@ -785,7 +784,7 @@ int GameUI::getLevelsOnThisBranch(MythGenericTree *node) while (node->getInt() != 1) node = node->getParent(); - GameTreeInfo *gi = node->GetData().value(); + auto *gi = node->GetData().value(); return gi->getDepth(); } @@ -797,7 +796,7 @@ bool GameUI::isLeaf(MythGenericTree *node) void GameUI::fillNode(MythGenericTree *node) { QString layername = node->GetText(); - RomInfo *romInfo = node->GetData().value(); + auto *romInfo = node->GetData().value(); MSqlQuery query(MSqlQuery::InitCon()); @@ -825,11 +824,11 @@ void GameUI::fillNode(MythGenericTree *node) while (query.next()) { QString current = query.value(0).toString().trimmed(); - MythGenericTree *new_node = + auto *new_node = new MythGenericTree(current, node->getInt() + 1, false); if (IsLeaf) { - RomInfo *temp = new RomInfo(); + auto *temp = new RomInfo(); temp->setSystem(query.value(1).toString().trimmed()); temp->setYear(query.value(2).toString()); temp->setGenre(query.value(3).toString().trimmed()); @@ -842,7 +841,7 @@ void GameUI::fillNode(MythGenericTree *node) RomInfo *newRomInfo = nullptr; if (node->getInt() > 1) { - RomInfo *currentRomInfo = node->GetData().value(); + auto *currentRomInfo = node->GetData().value(); newRomInfo = new RomInfo(*currentRomInfo); } else @@ -901,12 +900,11 @@ void GameUI::gameSearch(MythGenericTree *node, if (!node) return; - RomInfo *metadata = node->GetData().value(); - + auto *metadata = node->GetData().value(); if (!metadata) return; - MetadataLookup *lookup = new MetadataLookup(); + auto *lookup = new MetadataLookup(); lookup->SetStep(kLookupSearch); lookup->SetType(kMetadataGame); lookup->SetData(qVariantFromValue(node)); @@ -967,13 +965,11 @@ void GameUI::OnGameSearchDone(MetadataLookup *lookup) if (!lookup) return; - MythGenericTree *node = lookup->GetData().value(); - + auto *node = lookup->GetData().value(); if (!node) return; - RomInfo *metadata = node->GetData().value(); - + auto *metadata = node->GetData().value(); if (!metadata) return; @@ -1016,8 +1012,7 @@ void GameUI::StartGameImageSet(MythGenericTree *node, QStringList coverart, if (!node) return; - RomInfo *metadata = node->GetData().value(); - + auto *metadata = node->GetData().value(); if (!metadata) return; @@ -1048,7 +1043,7 @@ void GameUI::StartGameImageSet(MythGenericTree *node, QStringList coverart, map.insert(kArtworkScreenshot, info); } - MetadataLookup *lookup = new MetadataLookup(); + auto *lookup = new MetadataLookup(); lookup->SetTitle(metadata->Gamename()); lookup->SetSystem(metadata->System()); lookup->SetInetref(metadata->Inetref()); @@ -1064,13 +1059,11 @@ void GameUI::handleDownloadedImages(MetadataLookup *lookup) if (!lookup) return; - MythGenericTree *node = lookup->GetData().value(); - + auto *node = lookup->GetData().value(); if (!node) return; - RomInfo *metadata = node->GetData().value(); - + auto *metadata = node->GetData().value(); if (!metadata) return; diff --git a/mythplugins/mythgame/mythgame/main.cpp b/mythplugins/mythgame/mythgame/main.cpp index eb924dc298c..246ea53929d 100644 --- a/mythplugins/mythgame/mythgame/main.cpp +++ b/mythplugins/mythgame/mythgame/main.cpp @@ -20,7 +20,7 @@ struct GameData static void GameCallback(void *data, QString &selection) { - GameData *ddata = (GameData *)data; + auto *ddata = (GameData *)data; QString sel = selection.toLower(); (void)ddata; @@ -28,9 +28,8 @@ static void GameCallback(void *data, QString &selection) if (sel == "game_settings") { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StandardSettingDialog *ssd = - new StandardSettingDialog(mainStack, "gamesettings", - new GameGeneralSettings()); + auto *ssd = new StandardSettingDialog(mainStack, "gamesettings", + new GameGeneralSettings()); if (ssd->Create()) mainStack->AddScreen(ssd); @@ -55,7 +54,7 @@ static void GameCallback(void *data, QString &selection) } if (sel == "clear_game_data") { - GameHandler *handler = new GameHandler(); + auto *handler = new GameHandler(); handler->clearAllGameData(); } @@ -65,8 +64,9 @@ static int runMenu(const QString& which_menu) { QString themedir = GetMythUI()->GetThemeDir(); - MythThemedMenu *menu = new MythThemedMenu( - themedir, which_menu, GetMythMainWindow()->GetMainStack(), "game menu"); + auto *menu = new MythThemedMenu(themedir, which_menu, + GetMythMainWindow()->GetMainStack(), + "game menu"); GameData data; @@ -91,7 +91,7 @@ static int runMenu(const QString& which_menu) static int RunGames(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - GameUI *game = new GameUI(mainStack); + auto *game = new GameUI(mainStack); if (game->Create()) { diff --git a/mythplugins/mythgame/mythgame/rom_metadata.h b/mythplugins/mythgame/mythgame/rom_metadata.h index c788b395534..4cb3b8ac362 100644 --- a/mythplugins/mythgame/mythgame/rom_metadata.h +++ b/mythplugins/mythgame/mythgame/rom_metadata.h @@ -42,7 +42,7 @@ class RomData QString m_version; }; -typedef QMap RomDBMap; +using RomDBMap = QMap ; QString crcStr(int crc); diff --git a/mythplugins/mythgame/mythgame/romedit.cpp b/mythplugins/mythgame/mythgame/romedit.cpp index e3945e61877..af271a73e4f 100644 --- a/mythplugins/mythgame/mythgame/romedit.cpp +++ b/mythplugins/mythgame/mythgame/romedit.cpp @@ -103,7 +103,7 @@ namespace MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIFileBrowser *fb = new MythUIFileBrowser(popupStack, fp); + auto *fb = new MythUIFileBrowser(popupStack, fp); fb->SetNameFilter(GetSupportedImageExtensionFilter()); if (fb->Create()) { @@ -162,10 +162,9 @@ void EditRomInfoDialog::SaveAndExit() { if (m_retObject) { - RomInfo *romInfo = new RomInfo(*m_workingRomInfo); - DialogCompletionEvent *dce = - new DialogCompletionEvent(m_id, 0, "", - qVariantFromValue(romInfo)); + auto *romInfo = new RomInfo(*m_workingRomInfo); + auto *dce = new DialogCompletionEvent(m_id, 0, "", + qVariantFromValue(romInfo)); QApplication::postEvent(m_retObject, dce); } diff --git a/mythplugins/mythgame/mythgame/rominfo.cpp b/mythplugins/mythgame/mythgame/rominfo.cpp index 9b3079571b4..373999ad07d 100644 --- a/mythplugins/mythgame/mythgame/rominfo.cpp +++ b/mythplugins/mythgame/mythgame/rominfo.cpp @@ -338,7 +338,7 @@ QList RomInfo::GetAllRomInfo() while (query.next()) { - RomInfo *add = new RomInfo( + auto *add = new RomInfo( query.value(0).toInt(), query.value(2).toString(), query.value(1).toString(), diff --git a/mythplugins/mythmusic/mythmusic/avfdecoder.cpp b/mythplugins/mythmusic/mythmusic/avfdecoder.cpp index 9822ec58b25..6d554ffd8ad 100644 --- a/mythplugins/mythmusic/mythmusic/avfdecoder.cpp +++ b/mythplugins/mythmusic/mythmusic/avfdecoder.cpp @@ -54,7 +54,7 @@ extern "C" { /****************************************************************************/ -typedef QMap ShoutCastMetaMap; +using ShoutCastMetaMap = QMap; class ShoutCastMetaParser { diff --git a/mythplugins/mythmusic/mythmusic/bumpscope.cpp b/mythplugins/mythmusic/mythmusic/bumpscope.cpp index 30cea490e8b..6215848afbe 100644 --- a/mythplugins/mythmusic/mythmusic/bumpscope.cpp +++ b/mythplugins/mythmusic/mythmusic/bumpscope.cpp @@ -143,7 +143,7 @@ void BumpScope::generate_phongdat(void) if (i > 255) i = 255; - unsigned char uci = (unsigned char)i; + auto uci = (unsigned char)i; m_phongdat[y][x] = uci; m_phongdat[(PHONGRES-1)-y][x] = uci; diff --git a/mythplugins/mythmusic/mythmusic/cddb.cpp b/mythplugins/mythmusic/mythmusic/cddb.cpp index 6f2c18f3beb..368c7a2af95 100644 --- a/mythplugins/mythmusic/mythmusic/cddb.cpp +++ b/mythplugins/mythmusic/mythmusic/cddb.cpp @@ -47,7 +47,7 @@ struct Dbase static void CachePut(const Cddb::Album& album); // DiscID to album info cache - typedef QMap< Cddb::discid_t, Cddb::Album > cache_t; + using cache_t = QMap< Cddb::discid_t, Cddb::Album >; static cache_t s_cache; static const QString& GetDB(); diff --git a/mythplugins/mythmusic/mythmusic/cddb.h b/mythplugins/mythmusic/mythmusic/cddb.h index ee9c4737b7f..964090f7680 100644 --- a/mythplugins/mythmusic/mythmusic/cddb.h +++ b/mythplugins/mythmusic/mythmusic/cddb.h @@ -10,7 +10,7 @@ */ struct Cddb { - typedef unsigned long discid_t; + using discid_t = unsigned long; struct Album; // A CDDB query match @@ -38,7 +38,7 @@ struct Cddb { discid_t discID; // discID of query bool isExact; - typedef QVector< Match > match_t; + using match_t = QVector< Match >; match_t matches; Matches() : discID(0), isExact(false) {} @@ -49,7 +49,7 @@ struct Cddb int min, sec, frame; Msf(int m = 0, int s = 0, int f = 0) : min(m), sec(s), frame(f) {} }; - typedef QVector< Msf > Toc; + using Toc = QVector< Msf >; struct Track { @@ -69,10 +69,10 @@ struct Cddb QString submitter; int rev; bool isCompilation; - typedef QVector< Track > track_t; + using track_t = QVector< Track >; track_t tracks; QString extd; - typedef QVector< QString > ext_t; + using ext_t = QVector< QString >; ext_t ext; Toc toc; diff --git a/mythplugins/mythmusic/mythmusic/cddecoder.cpp b/mythplugins/mythmusic/mythmusic/cddecoder.cpp index 0900cb3c3b6..6ec0a4babc2 100644 --- a/mythplugins/mythmusic/mythmusic/cddecoder.cpp +++ b/mythplugins/mythmusic/mythmusic/cddecoder.cpp @@ -749,8 +749,8 @@ MusicMetadata *CdDecoder::getMetadata() if (title.isEmpty()) title = tr("Track %1").arg(tracknum); - MusicMetadata *m = new MusicMetadata(getURL(), artist, compilation_artist, - album, title, genre, year, tracknum, length); + auto *m = new MusicMetadata(getURL(), artist, compilation_artist, album, + title, genre, year, tracknum, length); if (m) m->setCompilation(isCompilation); diff --git a/mythplugins/mythmusic/mythmusic/cdrip.cpp b/mythplugins/mythmusic/mythmusic/cdrip.cpp index e5617365994..dde5e07a7ab 100644 --- a/mythplugins/mythmusic/mythmusic/cdrip.cpp +++ b/mythplugins/mythmusic/mythmusic/cdrip.cpp @@ -665,7 +665,7 @@ void Ripper::ShowMenu() MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menu = new MythDialogBox("", popupStack, "ripmusicmenu"); + auto *menu = new MythDialogBox("", popupStack, "ripmusicmenu"); if (menu->Create()) popupStack->AddScreen(menu); @@ -713,7 +713,7 @@ void Ripper::chooseBackend(void) QString msg = tr("Select where to save tracks"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUISearchDialog *searchDlg = new MythUISearchDialog(popupStack, msg, hostList, false, ""); + auto *searchDlg = new MythUISearchDialog(popupStack, msg, hostList, false, ""); if (!searchDlg->Create()) { @@ -766,7 +766,7 @@ void Ripper::ScanFinished() for (int trackno = 0; trackno < m_decoder->getNumTracks(); trackno++) { - RipTrack *ripTrack = new RipTrack; + auto *ripTrack = new RipTrack; MusicMetadata *metadata = m_decoder->getMetadata(trackno + 1); if (metadata) @@ -1102,8 +1102,7 @@ void Ripper::startRipper(void) int quality = m_qualityList->GetItemCurrent()->GetData().toInt(); - RipStatus *statusDialog = new RipStatus(mainStack, m_CDdevice, m_tracks, - quality); + auto *statusDialog = new RipStatus(mainStack, m_CDdevice, m_tracks, quality); if (statusDialog->Create()) { @@ -1198,7 +1197,7 @@ void Ripper::updateTrackList(void) RipTrack *track = m_tracks->at(i); MusicMetadata *metadata = track->metadata; - MythUIButtonListItem *item = new MythUIButtonListItem(m_trackList,""); + auto *item = new MythUIButtonListItem(m_trackList,""); item->setCheckable(true); @@ -1242,7 +1241,7 @@ void Ripper::searchArtist() QStringList searchList = MusicMetadata::fillFieldList("artist"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUISearchDialog *searchDlg = new MythUISearchDialog(popupStack, msg, searchList, false, ""); + auto *searchDlg = new MythUISearchDialog(popupStack, msg, searchList, false, ""); if (!searchDlg->Create()) { @@ -1266,7 +1265,7 @@ void Ripper::searchAlbum() QStringList searchList = MusicMetadata::fillFieldList("album"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUISearchDialog *searchDlg = new MythUISearchDialog(popupStack, msg, searchList, false, ""); + auto *searchDlg = new MythUISearchDialog(popupStack, msg, searchList, false, ""); if (!searchDlg->Create()) { @@ -1295,7 +1294,7 @@ void Ripper::searchGenre() m_searchList.sort(); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUISearchDialog *searchDlg = new MythUISearchDialog(popupStack, msg, searchList, false, ""); + auto *searchDlg = new MythUISearchDialog(popupStack, msg, searchList, false, ""); if (!searchDlg->Create()) { @@ -1318,7 +1317,7 @@ void Ripper::showEditMetadataDialog(MythUIButtonListItem *item) if (!item || m_tracks->isEmpty()) return; - RipTrack *track = item->GetData().value(); + auto *track = item->GetData().value(); if (!track) return; @@ -1327,7 +1326,7 @@ void Ripper::showEditMetadataDialog(MythUIButtonListItem *item) MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - EditMetadataDialog *editDialog = new EditMetadataDialog(mainStack, editMeta); + auto *editDialog = new EditMetadataDialog(mainStack, editMeta); editDialog->setSaveMetadataOnly(); if (!editDialog->Create()) @@ -1393,8 +1392,7 @@ void Ripper::ShowConflictMenu(RipTrack* track) "present in the database.\n" "Do you want to permanently delete the existing " "file(s)?"); - MythDialogBox *menu = new MythDialogBox(msg, popupStack, "conflictmenu", - true); + auto *menu = new MythDialogBox(msg, popupStack, "conflictmenu", true); if (menu->Create()) popupStack->AddScreen(menu); @@ -1440,7 +1438,7 @@ void Ripper::customEvent(QEvent* event) if (dce->GetId() == "conflictmenu") { int buttonNum = dce->GetResult(); - RipTrack *track = dce->GetData().value(); + auto *track = dce->GetData().value(); switch (buttonNum) { @@ -1536,7 +1534,7 @@ void RipStatus::customEvent(QEvent *event) { if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = dynamic_cast(event); + auto *dce = dynamic_cast(event); if (dce == nullptr) return; if (dce->GetId() == "stop_ripping" && dce->GetResult()) @@ -1549,7 +1547,7 @@ void RipStatus::customEvent(QEvent *event) return; } - RipStatusEvent *rse = dynamic_cast (event); + auto *rse = dynamic_cast (event); if (!rse) return; diff --git a/mythplugins/mythmusic/mythmusic/cdrip.h b/mythplugins/mythmusic/mythmusic/cdrip.h index dd0385c1087..d6b48c5ddb7 100644 --- a/mythplugins/mythmusic/mythmusic/cdrip.h +++ b/mythplugins/mythmusic/mythmusic/cdrip.h @@ -45,13 +45,13 @@ class CDEjectorThread: public MThread Ripper *m_parent {nullptr}; }; -typedef struct +struct RipTrack { MusicMetadata *metadata; bool active; int length; bool isNew; -} RipTrack; +}; Q_DECLARE_METATYPE(RipTrack *) diff --git a/mythplugins/mythmusic/mythmusic/decoder.cpp b/mythplugins/mythmusic/mythmusic/decoder.cpp index 2e5ace0a35f..2cc2baa8adf 100644 --- a/mythplugins/mythmusic/mythmusic/decoder.cpp +++ b/mythplugins/mythmusic/mythmusic/decoder.cpp @@ -52,7 +52,7 @@ void Decoder::setOutput(AudioOutput *o) void Decoder::error(const QString &e) { - QString *str = new QString(e.toUtf8()); + auto *str = new QString(e.toUtf8()); DecoderEvent ev(str); dispatch(ev); } diff --git a/mythplugins/mythmusic/mythmusic/decoder.h b/mythplugins/mythmusic/mythmusic/decoder.h index 6ecf7850787..30406eee87c 100644 --- a/mythplugins/mythmusic/mythmusic/decoder.h +++ b/mythplugins/mythmusic/mythmusic/decoder.h @@ -35,8 +35,7 @@ class DecoderEvent : public MythEvent ~DecoderEvent() { - if (m_error_msg) - delete m_error_msg; + delete m_error_msg; } const QString *errorMessage() const { return m_error_msg; } diff --git a/mythplugins/mythmusic/mythmusic/decoderhandler.cpp b/mythplugins/mythmusic/mythmusic/decoderhandler.cpp index 95c7b698d5d..4522b23f930 100644 --- a/mythplugins/mythmusic/mythmusic/decoderhandler.cpp +++ b/mythplugins/mythmusic/mythmusic/decoderhandler.cpp @@ -45,7 +45,7 @@ DecoderHandlerEvent::~DecoderHandlerEvent(void) MythEvent* DecoderHandlerEvent::clone(void) const { - DecoderHandlerEvent *result = new DecoderHandlerEvent(*this); + auto *result = new DecoderHandlerEvent(*this); if (m_msg) result->m_msg = new QString(*m_msg); @@ -116,7 +116,7 @@ void DecoderHandler::doStart(bool result) void DecoderHandler::error(const QString &e) { - QString *str = new QString(e); + auto *str = new QString(e); DecoderHandlerEvent ev(DecoderHandlerEvent::Error, str); dispatch(ev); } @@ -205,14 +205,14 @@ void DecoderHandler::stop(void) void DecoderHandler::customEvent(QEvent *event) { - if (DecoderHandlerEvent *dhe = dynamic_cast(event)) + if (auto *dhe = dynamic_cast(event)) { // Proxy all DecoderHandlerEvents return dispatch(*dhe); } if (event->type() == MythEvent::MythEventMessage) { - MythEvent *me = dynamic_cast(event); + auto *me = dynamic_cast(event); if (me == nullptr) return; QStringList tokens = me->Message().split(" ", QString::SkipEmptyParts); @@ -275,7 +275,7 @@ void DecoderHandler::createPlaylist(const QUrl &url) void DecoderHandler::createPlaylistForSingleFile(const QUrl &url) { - PlayListFileEntry *entry = new PlayListFileEntry; + auto *entry = new PlayListFileEntry; if (url.scheme() == "file" || QFileInfo(url.toString()).isAbsolute()) entry->setFile(url.toLocalFile()); diff --git a/mythplugins/mythmusic/mythmusic/decoderhandler.h b/mythplugins/mythmusic/mythmusic/decoderhandler.h index 999b63b278a..9ebdebc6304 100644 --- a/mythplugins/mythmusic/mythmusic/decoderhandler.h +++ b/mythplugins/mythmusic/mythmusic/decoderhandler.h @@ -72,12 +72,12 @@ class DecoderHandler : public QObject, public MythObservable Q_OBJECT public: - typedef enum + enum State { ACTIVE, LOADING, STOPPED - } State; + }; DecoderHandler(void) = default; virtual ~DecoderHandler(void); diff --git a/mythplugins/mythmusic/mythmusic/editmetadata.cpp b/mythplugins/mythmusic/mythmusic/editmetadata.cpp index 3ec0a2ae363..dd25d9bcf46 100644 --- a/mythplugins/mythmusic/mythmusic/editmetadata.cpp +++ b/mythplugins/mythmusic/mythmusic/editmetadata.cpp @@ -164,7 +164,7 @@ void EditMetadataCommon::showSaveMenu() MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menu = new MythDialogBox(label, popupStack, "savechangesmenu"); + auto *menu = new MythDialogBox(label, popupStack, "savechangesmenu"); if (!menu->Create()) { @@ -226,7 +226,7 @@ void EditMetadataCommon::saveAll() << s_metadata->Hostname() << QString::number(s_metadata->ID()); - SendStringListThread *thread = new SendStringListThread(strList); + auto *thread = new SendStringListThread(strList); MThreadPool::globalInstance()->start(thread, "UpdateMetadata"); } @@ -475,7 +475,7 @@ void EditMetadataDialog::showMenu(void ) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menu = new MythDialogBox(label, popupStack, "optionsmenu"); + auto *menu = new MythDialogBox(label, popupStack, "optionsmenu"); if (!menu->Create()) { @@ -500,7 +500,7 @@ void EditMetadataDialog::switchToAlbumArt() MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - EditAlbumartDialog *editDialog = new EditAlbumartDialog(mainStack); + auto *editDialog = new EditAlbumartDialog(mainStack); if (!editDialog->Create()) { @@ -536,7 +536,7 @@ void EditMetadataDialog::searchArtist() QString s = s_metadata->Artist(); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUISearchDialog *searchDlg = new MythUISearchDialog(popupStack, msg, searchList, false, s); + auto *searchDlg = new MythUISearchDialog(popupStack, msg, searchList, false, s); if (!searchDlg->Create()) { @@ -581,7 +581,7 @@ void EditMetadataDialog::searchCompilationArtist() QString s = s_metadata->CompilationArtist(); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUISearchDialog *searchDlg = new MythUISearchDialog(popupStack, msg, searchList, false, s); + auto *searchDlg = new MythUISearchDialog(popupStack, msg, searchList, false, s); if (!searchDlg->Create()) { @@ -606,7 +606,7 @@ void EditMetadataDialog::searchAlbum() QString s = s_metadata->Album(); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUISearchDialog *searchDlg = new MythUISearchDialog(popupStack, msg, searchList, false, s); + auto *searchDlg = new MythUISearchDialog(popupStack, msg, searchList, false, s); if (!searchDlg->Create()) { @@ -657,7 +657,7 @@ void EditMetadataDialog::searchGenre() QString s = s_metadata->Genre(); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUISearchDialog *searchDlg = new MythUISearchDialog(popupStack, msg, searchList, false, s); + auto *searchDlg = new MythUISearchDialog(popupStack, msg, searchList, false, s); if (!searchDlg->Create()) { @@ -772,7 +772,7 @@ void EditMetadataDialog::customEvent(QEvent *event) << s_metadata->Hostname() << QString::number(s_metadata->ID()); - SendStringListThread *thread = new SendStringListThread(strList); + auto *thread = new SendStringListThread(strList); MThreadPool::globalInstance()->start(thread, "Send MUSIC_CALC_TRACK_LENGTH"); ShowOkPopup(tr("Asked the backend to check the tracks length")); @@ -781,7 +781,7 @@ void EditMetadataDialog::customEvent(QEvent *event) } else if (event->type() == MythEvent::MythEventMessage) { - MythEvent *me = dynamic_cast(event); + auto *me = dynamic_cast(event); if (me == nullptr) return; QStringList tokens = me->Message().split(" ", QString::SkipEmptyParts); @@ -911,7 +911,7 @@ void EditAlbumartDialog::gridItemChanged(MythUIButtonListItem *item) if (m_coverartImage) { - AlbumArtImage *image = item->GetData().value(); + auto *image = item->GetData().value(); if (image) { m_coverartImage->SetFilename(image->m_filename); @@ -935,8 +935,7 @@ void EditAlbumartDialog::updateImageGrid(void) for (int x = 0; x < albumArtList->size(); x++) { - MythUIButtonListItem *item = - new MythUIButtonListItem(m_coverartList, + auto *item = new MythUIButtonListItem(m_coverartList, AlbumArtImages::getTypeName(albumArtList->at(x)->m_imageType), qVariantFromValue(albumArtList->at(x))); item->SetImage(albumArtList->at(x)->m_filename); @@ -976,7 +975,7 @@ void EditAlbumartDialog::switchToMetadata(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - EditMetadataDialog *editDialog = new EditMetadataDialog(mainStack); + auto *editDialog = new EditMetadataDialog(mainStack); if (!editDialog->Create()) { @@ -1003,7 +1002,7 @@ void EditAlbumartDialog::showTypeMenu(bool changeType) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menu = new MythDialogBox(label, popupStack, "typemenu"); + auto *menu = new MythDialogBox(label, popupStack, "typemenu"); if (!menu->Create()) { @@ -1036,7 +1035,7 @@ void EditAlbumartDialog::showMenu(void ) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menu = new MythDialogBox(label, popupStack, "optionsmenu"); + auto *menu = new MythDialogBox(label, popupStack, "optionsmenu"); if (!menu->Create()) { @@ -1063,7 +1062,7 @@ void EditAlbumartDialog::showMenu(void ) MythUIButtonListItem *item = m_coverartList->GetItemCurrent(); if (item) { - AlbumArtImage *image = item->GetData().value(); + auto *image = item->GetData().value(); if (image) { if (!image->m_embedded) @@ -1115,7 +1114,7 @@ void EditAlbumartDialog::customEvent(QEvent *event) if (item) { item->SetText(AlbumArtImages::getTypeName((ImageType) type)); - AlbumArtImage *image = item->GetData().value(); + auto *image = item->GetData().value(); if (image) { QStringList strList("MUSIC_TAG_CHANGEIMAGE"); @@ -1170,7 +1169,7 @@ void EditAlbumartDialog::customEvent(QEvent *event) } else if (event->type() == MythEvent::MythEventMessage) { - MythEvent *me = dynamic_cast(event); + auto *me = dynamic_cast(event); if (me == nullptr) return; QStringList tokens = me->Message().split(" ", QString::SkipEmptyParts); @@ -1183,7 +1182,7 @@ void EditAlbumartDialog::customEvent(QEvent *event) { if (tokens.size() >= 2) { - MusicMetadata::IdType songID = (MusicMetadata::IdType)tokens[1].toInt(); + auto songID = (MusicMetadata::IdType)tokens[1].toInt(); if (s_metadata->ID() == songID) { @@ -1217,7 +1216,7 @@ void EditAlbumartDialog::startCopyImageToTag(void) QString lastLocation = gCoreContext->GetSetting("MusicLastImageLocation", "/"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIFileBrowser *fb = new MythUIFileBrowser(popupStack, lastLocation); + auto *fb = new MythUIFileBrowser(popupStack, lastLocation); fb->SetTypeFilter(QDir::AllDirs | QDir::Files | QDir::Readable); @@ -1248,7 +1247,7 @@ void EditAlbumartDialog::copySelectedImageToTag(void) MythUIButtonListItem *item = m_coverartList->GetItemCurrent(); if (item) { - AlbumArtImage *image = item->GetData().value(); + auto *image = item->GetData().value(); if (image) doCopyImageToTag(image); } @@ -1259,7 +1258,7 @@ void EditAlbumartDialog::removeSelectedImageFromTag(void) MythUIButtonListItem *item = m_coverartList->GetItemCurrent(); if (item) { - AlbumArtImage *image = item->GetData().value(); + auto *image = item->GetData().value(); if (image) { QString msg = tr("Are you sure you want to permanently remove this image from the tag?"); @@ -1276,7 +1275,7 @@ void EditAlbumartDialog::doRemoveImageFromTag(bool doIt) MythUIButtonListItem *item = m_coverartList->GetItemCurrent(); if (item) { - AlbumArtImage *image = item->GetData().value(); + auto *image = item->GetData().value(); if (image) { // ask the backend to remove the image from the tracks tag @@ -1315,8 +1314,8 @@ class CopyImageThread: public MThread void EditAlbumartDialog::doCopyImageToTag(const AlbumArtImage *image) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIBusyDialog *busy = new MythUIBusyDialog(tr("Copying image to tag..."), - popupStack, "copyimagebusydialog"); + auto *busy = new MythUIBusyDialog(tr("Copying image to tag..."), + popupStack, "copyimagebusydialog"); if (busy->Create()) { @@ -1343,7 +1342,7 @@ void EditAlbumartDialog::doCopyImageToTag(const AlbumArtImage *image) << fi.fileName() << QString::number(image->m_imageType); - CopyImageThread *copyThread = new CopyImageThread(strList); + auto *copyThread = new CopyImageThread(strList); copyThread->start(); while (copyThread->isRunning()) diff --git a/mythplugins/mythmusic/mythmusic/importmusic.cpp b/mythplugins/mythmusic/mythmusic/importmusic.cpp index 972490d7f86..67b044f9418 100644 --- a/mythplugins/mythmusic/mythmusic/importmusic.cpp +++ b/mythplugins/mythmusic/mythmusic/importmusic.cpp @@ -297,7 +297,7 @@ void ImportMusicDialog::doExit(bool ok) void ImportMusicDialog::locationPressed() { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIFileBrowser *fb = new MythUIFileBrowser(popupStack, m_locationEdit->GetText()); + auto *fb = new MythUIFileBrowser(popupStack, m_locationEdit->GetText()); // TODO Install a name filter on supported music formats fb->SetTypeFilter(QDir::AllDirs | QDir::Readable); if (fb->Create()) @@ -463,7 +463,7 @@ bool ImportMusicDialog::copyFile(const QString &src, const QString &dst) QString host = QUrl(dst).host(); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIBusyDialog *busy = + auto *busy = new MythUIBusyDialog(tr("Copying music file to the 'Music' storage group on %1").arg(host), popupStack, "scanbusydialog"); @@ -478,7 +478,7 @@ bool ImportMusicDialog::copyFile(const QString &src, const QString &dst) busy = nullptr; } - FileCopyThread *copy = new FileCopyThread(src, dst); + auto *copy = new FileCopyThread(src, dst); copy->start(); while (!copy->isFinished()) @@ -505,10 +505,8 @@ void ImportMusicDialog::startScan() location.append('/'); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIBusyDialog *busy = - new MythUIBusyDialog(tr("Searching for music files"), - popupStack, - "scanbusydialog"); + auto *busy = new MythUIBusyDialog(tr("Searching for music files"), + popupStack, "scanbusydialog"); if (busy->Create()) { @@ -519,7 +517,7 @@ void ImportMusicDialog::startScan() delete busy; busy = nullptr; } - FileScannerThread *scanner = new FileScannerThread(this); + auto *scanner = new FileScannerThread(this); scanner->start(); while (!scanner->isFinished()) @@ -573,7 +571,7 @@ void ImportMusicDialog::scanDirectory(QString &directory, vector *tr MusicMetadata *metadata = tagger->read(filename); if (metadata) { - TrackInfo * track = new TrackInfo; + auto * track = new TrackInfo; track->metadata = metadata; track->isNewTune = isNewTune(metadata->Artist(), metadata->Album(), metadata->Title()); @@ -597,7 +595,7 @@ void ImportMusicDialog::showEditMetadataDialog() MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - EditMetadataDialog *editDialog = new EditMetadataDialog(mainStack, editMeta); + auto *editDialog = new EditMetadataDialog(mainStack, editMeta); if (!editDialog->Create()) { @@ -628,7 +626,7 @@ void ImportMusicDialog::ShowMenu() MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menu = new MythDialogBox("", popupStack, "importmusicmenu"); + auto *menu = new MythDialogBox("", popupStack, "importmusicmenu"); if (menu->Create()) popupStack->AddScreen(menu); @@ -683,7 +681,7 @@ void ImportMusicDialog::chooseBackend(void) QString msg = tr("Select where to save tracks"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUISearchDialog *searchDlg = new MythUISearchDialog(popupStack, msg, hostList, false, ""); + auto *searchDlg = new MythUISearchDialog(popupStack, msg, hostList, false, ""); if (!searchDlg->Create()) { @@ -881,7 +879,7 @@ void ImportMusicDialog::showImportCoverArtDialog(void) MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ImportCoverArtDialog *import = new ImportCoverArtDialog(mainStack, + auto *import = new ImportCoverArtDialog(mainStack, fi.absolutePath(), m_tracks->at(m_currentTrack)->metadata, m_musicStorageDir); diff --git a/mythplugins/mythmusic/mythmusic/importmusic.h b/mythplugins/mythmusic/mythmusic/importmusic.h index e155ff3b0db..235ea26848e 100644 --- a/mythplugins/mythmusic/mythmusic/importmusic.h +++ b/mythplugins/mythmusic/mythmusic/importmusic.h @@ -21,12 +21,12 @@ class MythUIButtonList; class MythUICheckBox; class MythDialogBox; -typedef struct +struct TrackInfo { MusicMetadata *metadata; bool isNewTune; bool metadataHasChanged; -} TrackInfo; +}; class FileScannerThread: public MThread { diff --git a/mythplugins/mythmusic/mythmusic/lyricsview.cpp b/mythplugins/mythmusic/mythmusic/lyricsview.cpp index 4f86c37aa7e..d18e7a88bfd 100644 --- a/mythplugins/mythmusic/mythmusic/lyricsview.cpp +++ b/mythplugins/mythmusic/mythmusic/lyricsview.cpp @@ -105,7 +105,7 @@ void LyricsView::customEvent(QEvent *event) { if (m_autoScroll) { - OutputEvent *oe = dynamic_cast(event); + auto *oe = dynamic_cast(event); MusicMetadata *curMeta = gPlayer->getCurrentMetadata(); if (!oe || !curMeta) @@ -124,7 +124,7 @@ void LyricsView::customEvent(QEvent *event) for (int x = 0; x < m_lyricsList->GetCount(); x++) { MythUIButtonListItem * item = m_lyricsList->GetItemAt(x); - LyricsLine *lyric = item->GetData().value(); + auto *lyric = item->GetData().value(); if (lyric) { if (lyric->m_time > 1000 && rs >= lyric->m_time) @@ -177,7 +177,7 @@ void LyricsView::customEvent(QEvent *event) } else if (event->type() == DecoderHandlerEvent::OperationStart) { - DecoderHandlerEvent *dhe = dynamic_cast(event); + auto *dhe = dynamic_cast(event); if (!dhe) return; if (dhe->getMessage() && m_bufferStatus) @@ -187,7 +187,7 @@ void LyricsView::customEvent(QEvent *event) } else if (event->type() == DecoderHandlerEvent::BufferStatus) { - DecoderHandlerEvent *dhe = dynamic_cast(event); + auto *dhe = dynamic_cast(event); if (!dhe) return; @@ -220,7 +220,7 @@ void LyricsView::ShowMenu(void) { QString label = tr("Actions"); - MythMenu *menu = new MythMenu(label, this, "actionmenu"); + auto *menu = new MythMenu(label, this, "actionmenu"); if (m_lyricData) { @@ -245,7 +245,7 @@ void LyricsView::ShowMenu(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(menu, popupStack, "actionmenu"); + auto *menuPopup = new MythDialogBox(menu, popupStack, "actionmenu"); if (menuPopup->Create()) popupStack->AddScreen(menuPopup); @@ -257,7 +257,7 @@ MythMenu* LyricsView::createFindLyricsMenu(void) { QString label = tr("Find Lyrics"); - MythMenu *menu = new MythMenu(label, this, "findlyricsmenu"); + auto *menu = new MythMenu(label, this, "findlyricsmenu"); menu->AddItem(tr("Search All Grabbers"), qVariantFromValue(QString("ALL"))); QStringList strList("MUSIC_LYRICS_GETGRABBERS"); @@ -335,7 +335,7 @@ void LyricsView::setLyricTime(void) MythUIButtonListItem *item = m_lyricsList->GetItemCurrent(); if (item) { - LyricsLine *lyric = item->GetData().value(); + auto *lyric = item->GetData().value(); if (lyric) { lyric->m_time = gPlayer->getOutput()->GetAudiotime() - 750; @@ -469,7 +469,7 @@ void LyricsView::editLyrics(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - EditLyricsDialog *editDialog = new EditLyricsDialog(mainStack, m_lyricData); + auto *editDialog = new EditLyricsDialog(mainStack, m_lyricData); if (!editDialog->Create()) { diff --git a/mythplugins/mythmusic/mythmusic/main.cpp b/mythplugins/mythmusic/mythmusic/main.cpp index f8aae947fa1..c90c58ed0e6 100644 --- a/mythplugins/mythmusic/mythmusic/main.cpp +++ b/mythplugins/mythmusic/mythmusic/main.cpp @@ -155,7 +155,7 @@ static void startPlayback(void) MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - PlaylistView *view = new PlaylistView(mainStack, nullptr); + auto *view = new PlaylistView(mainStack, nullptr); if (view->Create()) mainStack->AddScreen(view); @@ -169,7 +169,7 @@ static void startStreamPlayback(void) MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StreamView *view = new StreamView(mainStack, nullptr); + auto *view = new StreamView(mainStack, nullptr); if (view->Create()) mainStack->AddScreen(view); @@ -187,7 +187,7 @@ static void startDatabaseTree(void) MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); QString lastView = gCoreContext->GetSetting("MusicPlaylistEditorView", "tree"); - PlaylistEditorView *view = new PlaylistEditorView(mainStack, nullptr, lastView); + auto *view = new PlaylistEditorView(mainStack, nullptr, lastView); if (view->Create()) mainStack->AddScreen(view); @@ -205,7 +205,7 @@ static void startRipper(void) MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - Ripper *rip = new Ripper(mainStack, chooseCD()); + auto *rip = new Ripper(mainStack, chooseCD()); if (rip->Create()) { @@ -243,7 +243,7 @@ static void startImport(void) MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ImportMusicDialog *import = new ImportMusicDialog(mainStack); + auto *import = new ImportMusicDialog(mainStack); if (import->Create()) { @@ -286,7 +286,7 @@ static void MusicCallback(void *data, QString &selection) else if (sel == "settings_general") { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - GeneralSettings *gs = new GeneralSettings(mainStack, "general settings"); + auto *gs = new GeneralSettings(mainStack, "general settings"); if (gs->Create()) mainStack->AddScreen(gs); @@ -296,7 +296,7 @@ static void MusicCallback(void *data, QString &selection) else if (sel == "settings_player") { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - PlayerSettings *ps = new PlayerSettings(mainStack, "player settings"); + auto *ps = new PlayerSettings(mainStack, "player settings"); if (ps->Create()) mainStack->AddScreen(ps); @@ -306,7 +306,7 @@ static void MusicCallback(void *data, QString &selection) else if (sel == "settings_rating") { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - RatingSettings *rs = new RatingSettings(mainStack, "rating settings"); + auto *rs = new RatingSettings(mainStack, "rating settings"); if (rs->Create()) mainStack->AddScreen(rs); @@ -317,7 +317,7 @@ static void MusicCallback(void *data, QString &selection) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - VisualizationSettings *vs = new VisualizationSettings(mainStack, "visualization settings"); + auto *vs = new VisualizationSettings(mainStack, "visualization settings"); if (vs->Create()) mainStack->AddScreen(vs); @@ -327,7 +327,7 @@ static void MusicCallback(void *data, QString &selection) else if (sel == "settings_import") { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ImportSettings *is = new ImportSettings(mainStack, "import settings"); + auto *is = new ImportSettings(mainStack, "import settings"); if (is->Create()) mainStack->AddScreen(is); @@ -353,7 +353,7 @@ static int runMenu(const QString& which_menu) while (parentObject) { - MythThemedMenu *menu = dynamic_cast(parentObject); + auto *menu = dynamic_cast(parentObject); if (menu && menu->objectName() == "mainmenu") { @@ -364,9 +364,9 @@ static int runMenu(const QString& which_menu) parentObject = parentObject->parent(); } - MythThemedMenu *diag = new MythThemedMenu( - themedir, which_menu, GetMythMainWindow()->GetMainStack(), - "music menu"); + auto *diag = new MythThemedMenu(themedir, which_menu, + GetMythMainWindow()->GetMainStack(), + "music menu"); // save the callback from the main menu if (mainMenu) @@ -418,7 +418,7 @@ static void runRipCD(void) #if defined HAVE_CDIO MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - Ripper *rip = new Ripper(mainStack, chooseCD()); + auto *rip = new Ripper(mainStack, chooseCD()); if (rip->Create()) mainStack->AddScreen(rip); @@ -542,8 +542,7 @@ static void handleMedia(MythMediaDevice *cd) QString message = qApp->translate("(MythMusicMain)", "Searching for music files..."); - MythUIBusyDialog *busy = new MythUIBusyDialog( message, popupStack, - "musicscanbusydialog"); + auto *busy = new MythUIBusyDialog( message, popupStack, "musicscanbusydialog"); if (busy->Create()) popupStack->AddScreen(busy, false); else @@ -564,8 +563,8 @@ static void handleMedia(MythMediaDevice *cd) return; message = qApp->translate("(MythMusicMain)", "Loading music tracks"); - MythUIProgressDialog *progress = new MythUIProgressDialog( message, - popupStack, "scalingprogressdialog"); + auto *progress = new MythUIProgressDialog( message, popupStack, + "scalingprogressdialog"); if (progress->Create()) { popupStack->AddScreen(progress, false); @@ -696,7 +695,7 @@ static void handleCDMedia(MythMediaDevice *cd) gMusicData->m_all_playlists->getActive()->removeAllCDTracks(); // find any new cd tracks - CdDecoder *decoder = new CdDecoder("cda", nullptr, nullptr); + auto *decoder = new CdDecoder("cda", nullptr, nullptr); decoder->setDevice(newDevice); int tracks = decoder->getNumTracks(); diff --git a/mythplugins/mythmusic/mythmusic/musiccommon.cpp b/mythplugins/mythmusic/mythmusic/musiccommon.cpp index 61737ceabb7..26c3eaf667a 100644 --- a/mythplugins/mythmusic/mythmusic/musiccommon.cpp +++ b/mythplugins/mythmusic/mythmusic/musiccommon.cpp @@ -448,7 +448,7 @@ void MusicCommon::switchView(MusicView view) { case MV_PLAYLIST: { - PlaylistView *plview = new PlaylistView(mainStack, this); + auto *plview = new PlaylistView(mainStack, this); if (plview->Create()) { @@ -466,13 +466,13 @@ void MusicCommon::switchView(MusicView view) // if we are switching playlist editor views save and restore // the current position in the tree bool restorePos = (m_currentView == MV_PLAYLISTEDITORGALLERY); - PlaylistEditorView *oldView = dynamic_cast(this); + auto *oldView = dynamic_cast(this); if (oldView) oldView->saveTreePosition(); MythScreenType *parentScreen = (oldView != nullptr ? m_parentScreen : this); - PlaylistEditorView *pleview = new PlaylistEditorView(mainStack, parentScreen, "tree", restorePos); + auto *pleview = new PlaylistEditorView(mainStack, parentScreen, "tree", restorePos); if (pleview->Create()) { @@ -496,13 +496,13 @@ void MusicCommon::switchView(MusicView view) // if we are switching playlist editor views save and restore // the current position in the tree bool restorePos = (m_currentView == MV_PLAYLISTEDITORTREE); - PlaylistEditorView *oldView = dynamic_cast(this); + auto *oldView = dynamic_cast(this); if (oldView) oldView->saveTreePosition(); MythScreenType *parentScreen = (oldView != nullptr ? m_parentScreen : this); - PlaylistEditorView *pleview = new PlaylistEditorView(mainStack, parentScreen, "gallery", restorePos); + auto *pleview = new PlaylistEditorView(mainStack, parentScreen, "gallery", restorePos); if (pleview->Create()) { @@ -523,7 +523,7 @@ void MusicCommon::switchView(MusicView view) case MV_SEARCH: { - SearchView *sview = new SearchView(mainStack, this); + auto *sview = new SearchView(mainStack, this); if (sview->Create()) { @@ -538,7 +538,7 @@ void MusicCommon::switchView(MusicView view) case MV_VISUALIZER: { - VisualizerView *vview = new VisualizerView(mainStack, this); + auto *vview = new VisualizerView(mainStack, this); if (vview->Create()) { @@ -553,7 +553,7 @@ void MusicCommon::switchView(MusicView view) case MV_LYRICS: { - LyricsView *lview = new LyricsView(mainStack, this); + auto *lview = new LyricsView(mainStack, this); if (lview->Create()) { @@ -780,7 +780,7 @@ bool MusicCommon::keyPressEvent(QKeyEvent *e) { if (m_currentPlaylist->GetItemCurrent()) { - MusicMetadata *mdata = m_currentPlaylist->GetItemCurrent()->GetData().value(); + auto *mdata = m_currentPlaylist->GetItemCurrent()->GetData().value(); if (mdata) { if (action == "INFO") @@ -803,7 +803,7 @@ bool MusicCommon::keyPressEvent(QKeyEvent *e) MythUIButtonListItem *item = m_currentPlaylist->GetItemCurrent(); if (item) { - MusicMetadata *mdata = item->GetData().value(); + auto *mdata = item->GetData().value(); if (mdata) gPlayer->removeTrack(mdata->ID()); } @@ -950,7 +950,7 @@ void MusicCommon::showVolume(void) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythMusicVolumeDialog *vol = new MythMusicVolumeDialog(popupStack, "volumepopup"); + auto *vol = new MythMusicVolumeDialog(popupStack, "volumepopup"); if (!vol->Create()) { @@ -1249,7 +1249,7 @@ void MusicCommon::customEvent(QEvent *event) else if (event->type() == OutputEvent::Info) { - OutputEvent *oe = dynamic_cast(event); + auto *oe = dynamic_cast(event); if (!oe) return; @@ -1398,7 +1398,7 @@ void MusicCommon::customEvent(QEvent *event) MythUIButtonListItem *item = m_currentPlaylist->GetItemCurrent(); if (item) { - MusicMetadata *mdata = item->GetData().value(); + auto *mdata = item->GetData().value(); if (mdata) gPlayer->removeTrack(mdata->ID()); } @@ -1417,7 +1417,7 @@ void MusicCommon::customEvent(QEvent *event) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythTextInputDialog *inputdialog = new MythTextInputDialog(popupStack, message); + auto *inputdialog = new MythTextInputDialog(popupStack, message); if (inputdialog->Create()) { @@ -1434,7 +1434,7 @@ void MusicCommon::customEvent(QEvent *event) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUISearchDialog *searchdialog = new MythUISearchDialog(popupStack, message, playlists); + auto *searchdialog = new MythUISearchDialog(popupStack, message, playlists); if (searchdialog->Create()) { @@ -1574,7 +1574,7 @@ void MusicCommon::customEvent(QEvent *event) } else if (event->type() == MusicPlayerEvent::TrackChangeEvent) { - MusicPlayerEvent *mpe = dynamic_cast(event); + auto *mpe = dynamic_cast(event); if (!mpe) return; @@ -1627,7 +1627,7 @@ void MusicCommon::customEvent(QEvent *event) } else if (event->type() == MusicPlayerEvent::TrackRemovedEvent) { - MusicPlayerEvent *mpe = dynamic_cast(event); + auto *mpe = dynamic_cast(event); if (!mpe) return; @@ -1640,7 +1640,7 @@ void MusicCommon::customEvent(QEvent *event) for (int x = 0; x < m_currentPlaylist->GetCount(); x++) { MythUIButtonListItem *item = m_currentPlaylist->GetItemAt(x); - MusicMetadata *mdata = item->GetData().value(); + auto *mdata = item->GetData().value(); if (mdata && mdata->ID() == (MusicMetadata::IdType) trackID) { m_currentPlaylist->RemoveItem(item); @@ -1670,7 +1670,7 @@ void MusicCommon::customEvent(QEvent *event) } else if (event->type() == MusicPlayerEvent::TrackAddedEvent) { - MusicPlayerEvent *mpe = dynamic_cast(event); + auto *mpe = dynamic_cast(event); if (!mpe) return; @@ -1694,8 +1694,8 @@ void MusicCommon::customEvent(QEvent *event) InfoMap metadataMap; mdata->toMap(metadataMap); - MythUIButtonListItem *item = - new MythUIButtonListItem(m_currentPlaylist, "", qVariantFromValue(mdata)); + auto *item = new MythUIButtonListItem(m_currentPlaylist, "", + qVariantFromValue(mdata)); item->SetTextFromMap(metadataMap); @@ -1736,7 +1736,7 @@ void MusicCommon::customEvent(QEvent *event) else if (event->type() == MusicPlayerEvent::MetadataChangedEvent || event->type() == MusicPlayerEvent::TrackStatsChangedEvent) { - MusicPlayerEvent *mpe = dynamic_cast(event); + auto *mpe = dynamic_cast(event); if (!mpe) return; @@ -1748,7 +1748,7 @@ void MusicCommon::customEvent(QEvent *event) for (int x = 0; x < m_currentPlaylist->GetCount(); x++) { MythUIButtonListItem *item = m_currentPlaylist->GetItemAt(x); - MusicMetadata *mdata = item->GetData().value(); + auto *mdata = item->GetData().value(); if (mdata && mdata->ID() == trackID) { @@ -1766,7 +1766,7 @@ void MusicCommon::customEvent(QEvent *event) for (int x = 0; x < m_playedTracksList->GetCount(); x++) { MythUIButtonListItem *item = m_playedTracksList->GetItemAt(x); - MusicMetadata *mdata = item->GetData().value(); + auto *mdata = item->GetData().value(); if (mdata && mdata->ID() == trackID) { @@ -1786,7 +1786,7 @@ void MusicCommon::customEvent(QEvent *event) } else if (event->type() == MusicPlayerEvent::AlbumArtChangedEvent) { - MusicPlayerEvent *mpe = dynamic_cast(event); + auto *mpe = dynamic_cast(event); if (!mpe) return; @@ -1798,7 +1798,7 @@ void MusicCommon::customEvent(QEvent *event) for (int x = 0; x < m_currentPlaylist->GetCount(); x++) { MythUIButtonListItem *item = m_currentPlaylist->GetItemAt(x); - MusicMetadata *mdata = item->GetData().value(); + auto *mdata = item->GetData().value(); if (mdata && mdata->ID() == trackID) { // reload the albumart image if one has already been loaded for this track @@ -1825,7 +1825,7 @@ void MusicCommon::customEvent(QEvent *event) } else if (event->type() == MusicPlayerEvent::TrackUnavailableEvent) { - MusicPlayerEvent *mpe = dynamic_cast(event); + auto *mpe = dynamic_cast(event); if (!mpe) return; @@ -1837,7 +1837,7 @@ void MusicCommon::customEvent(QEvent *event) for (int x = 0; x < m_currentPlaylist->GetCount(); x++) { MythUIButtonListItem *item = m_currentPlaylist->GetItemAt(x); - MusicMetadata *mdata = item->GetData().value(); + auto *mdata = item->GetData().value(); if (mdata && mdata->ID() == trackID) { item->SetFontState("disabled"); @@ -1882,7 +1882,7 @@ void MusicCommon::editTrackInfo(MusicMetadata *mdata) MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - EditMetadataDialog *editDialog = new EditMetadataDialog(mainStack, mdata); + auto *editDialog = new EditMetadataDialog(mainStack, mdata); if (!editDialog->Create()) { @@ -1962,7 +1962,7 @@ void MusicCommon::showTrackInfo(MusicMetadata *mdata) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - TrackInfoDialog *dlg = new TrackInfoDialog(popupStack, mdata, "trackinfopopup"); + auto *dlg = new TrackInfoDialog(popupStack, mdata, "trackinfopopup"); if (!dlg->Create()) { @@ -1999,7 +1999,7 @@ void MusicCommon::playlistItemVisible(MythUIButtonListItem *item) if (!item) return; - MusicMetadata *mdata = item->GetData().value(); + auto *mdata = item->GetData().value(); if (mdata && item->GetText() == " ") { if (item->GetImageFilename().isEmpty()) @@ -2047,8 +2047,8 @@ void MusicCommon::updateUIPlaylist(void) MusicMetadata *mdata = playlist->getSongAt(x); if (mdata) { - MythUIButtonListItem *item = - new MythUIButtonListItem(m_currentPlaylist, " ", qVariantFromValue(mdata)); + auto *item = new MythUIButtonListItem(m_currentPlaylist, " ", + qVariantFromValue(mdata)); item->SetText(mdata->Artist() + mdata->Album() + mdata->Title(), "**search**"); item->SetFontState("normal"); @@ -2092,8 +2092,8 @@ void MusicCommon::updateUIPlayedList(void) for (int x = playedList.count(); x > 0; x--) { MusicMetadata *mdata = playedList[x-1]; - MythUIButtonListItem *item = - new MythUIButtonListItem(m_playedTracksList, "", qVariantFromValue(mdata)); + auto *item = new MythUIButtonListItem(m_playedTracksList, "", + qVariantFromValue(mdata)); InfoMap metadataMap; mdata->toMap(metadataMap); @@ -2184,11 +2184,11 @@ QString MusicCommon::getTimeString(int exTime, int maxTime) void MusicCommon::searchButtonList(void) { - MythUIButtonList *buttonList = dynamic_cast(GetFocusWidget()); + auto *buttonList = dynamic_cast(GetFocusWidget()); if (buttonList) buttonList->ShowSearchDialog(); - MythUIButtonTree *buttonTree = dynamic_cast(GetFocusWidget()); + auto *buttonTree = dynamic_cast(GetFocusWidget()); if (buttonTree) buttonTree->ShowSearchDialog(); } @@ -2199,7 +2199,7 @@ void MusicCommon::ShowMenu(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(mainMenu, popupStack, "actionmenu"); + auto *menuPopup = new MythDialogBox(mainMenu, popupStack, "actionmenu"); if (menuPopup->Create()) popupStack->AddScreen(menuPopup); @@ -2211,7 +2211,7 @@ MythMenu* MusicCommon::createMainMenu(void) { QString label = tr("View Actions"); - MythMenu *menu = new MythMenu(label, this, "mainmenu"); + auto *menu = new MythMenu(label, this, "mainmenu"); if (m_currentView == MV_PLAYLISTEDITORTREE) menu->AddItem(tr("Switch To Gallery View")); @@ -2246,7 +2246,7 @@ MythMenu* MusicCommon::createSubMenu(void) { QString label = tr("Actions"); - MythMenu *menu = new MythMenu(label, this, "submenu"); + auto *menu = new MythMenu(label, this, "submenu"); if (GetFocusWidget() && (GetFocusWidget()->inherits("MythUIButtonList") || GetFocusWidget()->inherits("MythUIButtonTree"))) @@ -2274,7 +2274,7 @@ MythMenu* MusicCommon::createPlaylistMenu(void) { QString label = tr("Playlist Options"); - MythMenu *menu = new MythMenu(label, this, "playlistmenu"); + auto *menu = new MythMenu(label, this, "playlistmenu"); if (m_currentPlaylist) { @@ -2305,7 +2305,7 @@ void MusicCommon::showExitMenu(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menu = new MythDialogBox(label, popupStack, "exitmenu"); + auto *menu = new MythDialogBox(label, popupStack, "exitmenu"); if (!menu->Create()) { @@ -2326,7 +2326,7 @@ MythMenu* MusicCommon::createPlayerMenu(void) { QString label = tr("Player Actions"); - MythMenu *menu = new MythMenu(label, this, "playermenu"); + auto *menu = new MythMenu(label, this, "playermenu"); menu->AddItem(tr("Change Volume")); menu->AddItem(tr("Mute")); @@ -2352,7 +2352,7 @@ MythMenu* MusicCommon::createRepeatMenu(void) { QString label = tr("Set Repeat Mode"); - MythMenu *menu = new MythMenu(label, this, "repeatmenu"); + auto *menu = new MythMenu(label, this, "repeatmenu"); menu->AddItem(tr("None"), qVariantFromValue((int)MusicPlayer::REPEAT_OFF)); menu->AddItem(tr("Track"), qVariantFromValue((int)MusicPlayer::REPEAT_TRACK)); @@ -2367,7 +2367,7 @@ MythMenu* MusicCommon::createShuffleMenu(void) { QString label = tr("Set Shuffle Mode"); - MythMenu *menu = new MythMenu(label, this, "shufflemenu"); + auto *menu = new MythMenu(label, this, "shufflemenu"); menu->AddItem(tr("None"), qVariantFromValue((int)MusicPlayer::SHUFFLE_OFF)); menu->AddItem(tr("Random"), qVariantFromValue((int)MusicPlayer::SHUFFLE_RANDOM)); @@ -2384,7 +2384,7 @@ MythMenu* MusicCommon::createQuickPlaylistsMenu(void) { QString label = tr("Quick Playlists"); - MythMenu *menu = new MythMenu(label, this, "quickplaylistmenu"); + auto *menu = new MythMenu(label, this, "quickplaylistmenu"); menu->AddItem(tr("All Tracks")); @@ -2407,7 +2407,7 @@ MythMenu* MusicCommon::createVisualizerMenu(void) { QString label = tr("Choose Visualizer"); - MythMenu *menu = new MythMenu(label, this, "visualizermenu"); + auto *menu = new MythMenu(label, this, "visualizermenu"); for (uint x = 0; x < static_cast(m_visualModes.count()); x++) menu->AddItem(m_visualModes.at(x), qVariantFromValue(x)); @@ -2421,7 +2421,7 @@ MythMenu* MusicCommon::createPlaylistOptionsMenu(void) { QString label = tr("Add to Playlist Options"); - MythMenu *menu = new MythMenu(label, this, "playlistoptionsmenu"); + auto *menu = new MythMenu(label, this, "playlistoptionsmenu"); menu->AddItem(tr("Replace Tracks")); menu->AddItem(tr("Add Tracks")); @@ -2540,7 +2540,7 @@ void MusicCommon::showPlaylistOptionsMenu(bool addMainMenu) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(menu, popupStack, "playlistoptionsmenu"); + auto *menuPopup = new MythDialogBox(menu, popupStack, "playlistoptionsmenu"); if (menuPopup->Create()) popupStack->AddScreen(menuPopup); diff --git a/mythplugins/mythmusic/mythmusic/musicdata.cpp b/mythplugins/mythmusic/mythmusic/musicdata.cpp index 23355233fde..b2931c88c4e 100644 --- a/mythplugins/mythmusic/mythmusic/musicdata.cpp +++ b/mythplugins/mythmusic/mythmusic/musicdata.cpp @@ -47,7 +47,7 @@ MusicData::~MusicData(void) void MusicData::scanMusic (void) { QStringList strList("SCAN_MUSIC"); - SendStringListThread *thread = new SendStringListThread(strList); + auto *thread = new SendStringListThread(strList); MThreadPool::globalInstance()->start(thread, "Send SCAN_MUSIC"); LOG(VB_GENERAL, LOG_INFO, "Requested a music file scan"); @@ -62,8 +62,7 @@ void MusicData::reloadMusic(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); QString message = tr("Rebuilding music tree"); - MythUIBusyDialog *busy = new MythUIBusyDialog(message, popupStack, - "musicscanbusydialog"); + auto *busy = new MythUIBusyDialog(message, popupStack, "musicscanbusydialog"); if (busy->Create()) popupStack->AddScreen(busy, false); @@ -106,8 +105,7 @@ void MusicData::loadMusic(void) QString message = qApp->translate("(MythMusicMain)", "Loading Music. Please wait ..."); - MythUIBusyDialog *busy = new MythUIBusyDialog(message, popupStack, - "musicscanbusydialog"); + auto *busy = new MythUIBusyDialog(message, popupStack, "musicscanbusydialog"); if (busy->Create()) popupStack->AddScreen(busy, false); else @@ -116,10 +114,10 @@ void MusicData::loadMusic(void) // Set the various track formatting modes MusicMetadata::setArtistAndTrackFormats(); - AllMusic *all_music = new AllMusic(); + auto *all_music = new AllMusic(); // Load all playlists into RAM (once!) - PlaylistContainer *all_playlists = new PlaylistContainer(all_music); + auto *all_playlists = new PlaylistContainer(all_music); gMusicData->m_all_music = all_music; gMusicData->m_all_streams = new AllStream(); diff --git a/mythplugins/mythmusic/mythmusic/musicplayer.cpp b/mythplugins/mythmusic/mythmusic/musicplayer.cpp index 905c6305d47..35c2884793d 100644 --- a/mythplugins/mythmusic/mythmusic/musicplayer.cpp +++ b/mythplugins/mythmusic/mythmusic/musicplayer.cpp @@ -515,7 +515,7 @@ void MusicPlayer::nextAuto(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MiniPlayer *miniplayer = new MiniPlayer(popupStack); + auto *miniplayer = new MiniPlayer(popupStack); if (miniplayer->Create()) popupStack->AddScreen(miniplayer); @@ -555,11 +555,11 @@ void MusicPlayer::customEvent(QEvent *event) } else if (event->type() == DecoderHandlerEvent::Meta) { - DecoderHandlerEvent *dhe = dynamic_cast(event); + auto *dhe = dynamic_cast(event); if (!dhe) return; - MusicMetadata *mdata = new MusicMetadata(*dhe->getMetadata()); + auto *mdata = new MusicMetadata(*dhe->getMetadata()); m_lastTrackStart += m_currentTime; @@ -583,7 +583,7 @@ void MusicPlayer::customEvent(QEvent *event) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MiniPlayer *miniplayer = new MiniPlayer(popupStack); + auto *miniplayer = new MiniPlayer(popupStack); if (miniplayer->Create()) popupStack->AddScreen(miniplayer); @@ -598,7 +598,7 @@ void MusicPlayer::customEvent(QEvent *event) // handle MythEvent events else if (event->type() == MythEvent::MythEventMessage) { - MythEvent *me = dynamic_cast(event); + auto *me = dynamic_cast(event); if (!me) return; @@ -791,7 +791,7 @@ void MusicPlayer::customEvent(QEvent *event) if (event->type() == OutputEvent::Error) { - OutputEvent *aoe = dynamic_cast(event); + auto *aoe = dynamic_cast(event); if (!aoe) return; @@ -813,7 +813,7 @@ void MusicPlayer::customEvent(QEvent *event) } else if (event->type() == DecoderEvent::Error) { - DecoderEvent *dxe = dynamic_cast(event); + auto *dxe = dynamic_cast(event); if (!dxe) return; @@ -835,7 +835,7 @@ void MusicPlayer::customEvent(QEvent *event) } else if (event->type() == DecoderHandlerEvent::Error) { - DecoderHandlerEvent *dhe = dynamic_cast(event); + auto *dhe = dynamic_cast(event); if (!dhe) return; @@ -857,7 +857,7 @@ void MusicPlayer::customEvent(QEvent *event) } else if (event->type() == OutputEvent::Info) { - OutputEvent *oe = dynamic_cast(event); + auto *oe = dynamic_cast(event); if (!oe) return; @@ -925,7 +925,7 @@ void MusicPlayer::customEvent(QEvent *event) } else if (event->type() == DecoderHandlerEvent::BufferStatus) { - DecoderHandlerEvent *dhe = dynamic_cast(event); + auto *dhe = dynamic_cast(event); if (!dhe) return; @@ -1114,7 +1114,7 @@ void MusicPlayer::showMiniPlayer(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MiniPlayer *miniplayer = new MiniPlayer(popupStack); + auto *miniplayer = new MiniPlayer(popupStack); if (miniplayer->Create()) popupStack->AddScreen(miniplayer); @@ -1287,7 +1287,7 @@ void MusicPlayer::updateVolatileMetadata(void) << QString::number(getCurrentMetadata()->Rating()) << QString::number(getCurrentMetadata()->Playcount()) << getCurrentMetadata()->LastPlay().toString(Qt::ISODate); - SendStringListThread *thread = new SendStringListThread(strList); + auto *thread = new SendStringListThread(strList); MThreadPool::globalInstance()->start(thread, "UpdateVolatile"); } @@ -1506,7 +1506,7 @@ void MusicPlayer::decoderHandlerReady(void) .arg(getDecoder()->getURL())); #ifdef HAVE_CDIO - CdDecoder *cddecoder = dynamic_cast(getDecoder()); + auto *cddecoder = dynamic_cast(getDecoder()); if (cddecoder) cddecoder->setDevice(gCDdevice); #endif @@ -1626,7 +1626,7 @@ void MusicPlayer::sendNotification(int notificationID, const QString &title, con map["minm"] = author; map["asal"] = desc; - MythImageNotification *n = new MythImageNotification(MythNotification::Info, image, map); + auto *n = new MythImageNotification(MythNotification::Info, image, map); n->SetId(notificationID); n->SetParent(this); diff --git a/mythplugins/mythmusic/mythmusic/mythgoom.cpp b/mythplugins/mythmusic/mythmusic/mythgoom.cpp index 0eb1cd33dbc..f3ec7a09668 100644 --- a/mythplugins/mythmusic/mythmusic/mythgoom.cpp +++ b/mythplugins/mythmusic/mythmusic/mythgoom.cpp @@ -107,7 +107,7 @@ bool Goom::draw(QPainter *p, const QColor &back) height /= m_scaleh; } - QImage *image = new QImage((uchar*) m_buffer, width, height, width * 4, QImage::Format_RGB32); + auto *image = new QImage((uchar*) m_buffer, width, height, width * 4, QImage::Format_RGB32); p->drawImage(QRect(0, 0, m_size.width(), m_size.height()), *image); diff --git a/mythplugins/mythmusic/mythmusic/playlist.cpp b/mythplugins/mythmusic/mythmusic/playlist.cpp index 883fd024ff6..987a60d492b 100644 --- a/mythplugins/mythmusic/mythmusic/playlist.cpp +++ b/mythplugins/mythmusic/mythmusic/playlist.cpp @@ -337,7 +337,7 @@ void Playlist::shuffleTracks(MusicPlayer::ShuffleMode shuffleMode) { // "intellegent/album" order - typedef map AlbumMap; + using AlbumMap = map; AlbumMap album_map; AlbumMap::iterator Ialbum; QString album; @@ -405,7 +405,7 @@ void Playlist::shuffleTracks(MusicPlayer::ShuffleMode shuffleMode) { // "intellegent/album" order - typedef map ArtistMap; + using ArtistMap = map; ArtistMap artist_map; ArtistMap::iterator Iartist; QString artist; diff --git a/mythplugins/mythmusic/mythmusic/playlist.h b/mythplugins/mythmusic/mythmusic/playlist.h index e0a49db9c40..1e3f9f00dd7 100644 --- a/mythplugins/mythmusic/mythmusic/playlist.h +++ b/mythplugins/mythmusic/mythmusic/playlist.h @@ -37,7 +37,7 @@ struct PlaylistOptions PlayPLOption playPLOption; }; -typedef QList SongList; +using SongList = QList; class Playlist : public QObject { diff --git a/mythplugins/mythmusic/mythmusic/playlistcontainer.cpp b/mythplugins/mythmusic/mythmusic/playlistcontainer.cpp index 8af61c0a7a1..34120b27be6 100644 --- a/mythplugins/mythmusic/mythmusic/playlistcontainer.cpp +++ b/mythplugins/mythmusic/mythmusic/playlistcontainer.cpp @@ -101,7 +101,7 @@ void PlaylistContainer::load() { while (query.next()) { - Playlist *temp_playlist = new Playlist(); + auto *temp_playlist = new Playlist(); // No, we don't destruct this ... temp_playlist->setParent(this); temp_playlist->loadPlaylistByID(query.value(0).toInt(), m_myHost); @@ -187,7 +187,7 @@ void PlaylistContainer::save(void) void PlaylistContainer::createNewPlaylist(const QString &name) { - Playlist *new_list = new Playlist(); + auto *new_list = new Playlist(); new_list->setParent(this); // Need to touch the database to get persistent ID @@ -198,7 +198,7 @@ void PlaylistContainer::createNewPlaylist(const QString &name) void PlaylistContainer::copyNewPlaylist(const QString &name) { - Playlist *new_list = new Playlist(); + auto *new_list = new Playlist(); new_list->setParent(this); // Need to touch the database to get persistent ID diff --git a/mythplugins/mythmusic/mythmusic/playlisteditorview.cpp b/mythplugins/mythmusic/mythmusic/playlisteditorview.cpp index 8da63aa0ce1..1192a24916c 100644 --- a/mythplugins/mythmusic/mythmusic/playlisteditorview.cpp +++ b/mythplugins/mythmusic/mythmusic/playlisteditorview.cpp @@ -62,7 +62,7 @@ void MusicGenericTree::setCheck(MythUIButtonListItem::CheckState state) MythUIButtonListItem *MusicGenericTree::CreateListButton(MythUIButtonList *list) { - MusicButtonItem *item = new MusicButtonItem(list, GetText()); + auto *item = new MusicButtonItem(list, GetText()); item->SetData(qVariantFromValue((MythGenericTree*) this)); if (visibleChildCount() > 0) @@ -200,7 +200,7 @@ void PlaylistEditorView::customEvent(QEvent *event) } else if (event->type() == MythEvent::MythEventMessage) { - MythEvent *me = dynamic_cast(event); + auto *me = dynamic_cast(event); if (!me) return; @@ -239,7 +239,7 @@ void PlaylistEditorView::customEvent(QEvent *event) if (!node) return; - MusicGenericTree *mnode = dynamic_cast(node); + auto *mnode = dynamic_cast(node); if (!mnode) return; @@ -250,7 +250,7 @@ void PlaylistEditorView::customEvent(QEvent *event) category = mnode->GetText(); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - SmartPlaylistEditor* editor = new SmartPlaylistEditor(mainStack); + auto* editor = new SmartPlaylistEditor(mainStack); if (!editor->Create()) { @@ -280,7 +280,7 @@ void PlaylistEditorView::customEvent(QEvent *event) QString name = mnode->GetText(); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - SmartPlaylistEditor* editor = new SmartPlaylistEditor(mainStack); + auto* editor = new SmartPlaylistEditor(mainStack); if (!editor->Create()) { @@ -317,7 +317,7 @@ void PlaylistEditorView::customEvent(QEvent *event) if (!node) return; - MusicGenericTree *mnode = dynamic_cast(node); + auto *mnode = dynamic_cast(node); if (!mnode) return; @@ -373,7 +373,7 @@ bool PlaylistEditorView::keyPressEvent(QKeyEvent *event) MythGenericTree *node = m_playlistTree->GetCurrentNode(); if (node) { - MusicGenericTree *mnode = dynamic_cast(node); + auto *mnode = dynamic_cast(node); if (mnode) { if (mnode->getAction() == "smartplaylist" && action == "EDIT") @@ -382,7 +382,7 @@ bool PlaylistEditorView::keyPressEvent(QKeyEvent *event) QString name = mnode->GetText(); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - SmartPlaylistEditor* editor = new SmartPlaylistEditor(mainStack); + auto* editor = new SmartPlaylistEditor(mainStack); if (!editor->Create()) { @@ -403,7 +403,7 @@ bool PlaylistEditorView::keyPressEvent(QKeyEvent *event) QString category = mnode->GetText(); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - SmartPlaylistEditor* editor = new SmartPlaylistEditor(mainStack); + auto* editor = new SmartPlaylistEditor(mainStack); if (!editor->Create()) { @@ -443,7 +443,7 @@ bool PlaylistEditorView::keyPressEvent(QKeyEvent *event) MythGenericTree *node = m_playlistTree->GetCurrentNode(); if (node) { - MusicGenericTree *mnode = dynamic_cast(node); + auto *mnode = dynamic_cast(node); if (mnode) { if (mnode->getAction() == "smartplaylist") @@ -479,8 +479,8 @@ bool PlaylistEditorView::keyPressEvent(QKeyEvent *event) MythUIButtonListItem *item = m_playlistTree->GetItemCurrent(); if (item) { - MythGenericTree *node = item->GetData().value(); - MusicGenericTree *mnode = dynamic_cast(node); + auto *node = item->GetData().value(); + auto *mnode = dynamic_cast(node); if (mnode) { @@ -541,7 +541,7 @@ void PlaylistEditorView::updateSonglist(MusicGenericTree *node) node->getAction() == "years") { // get the list of tracks from the previous 'All Tracks' node - MusicGenericTree *allTracksNode = dynamic_cast(node->getParent()->getChildAt(0)); + auto *allTracksNode = dynamic_cast(node->getParent()->getChildAt(0)); if (allTracksNode) { for (int x = 0; x < allTracksNode->childCount(); x++) @@ -561,7 +561,7 @@ void PlaylistEditorView::updateSonglist(MusicGenericTree *node) node->getAction() == "compartist") { // get the list of tracks from the 'All Tracks' node - MusicGenericTree *allTracksNode = dynamic_cast(node->getChildAt(0)); + auto *allTracksNode = dynamic_cast(node->getChildAt(0)); if (allTracksNode) { if (allTracksNode->childCount() == 0) @@ -608,7 +608,7 @@ void PlaylistEditorView::updateSonglist(MusicGenericTree *node) else { // fall back to getting the tracks from the MetadataPtrList - MetadataPtrList *tracks = node->GetData().value(); + auto *tracks = node->GetData().value(); for (int x = 0; x < tracks->count(); x++) { MusicMetadata *mdata = tracks->at(x); @@ -626,7 +626,7 @@ void PlaylistEditorView::ShowMenu(void) m_playlistOptions.insertPLOption = PL_REPLACE; MythMenu *menu = nullptr; - MusicGenericTree *mnode = dynamic_cast(m_playlistTree->GetCurrentNode()); + auto *mnode = dynamic_cast(m_playlistTree->GetCurrentNode()); if (mnode) { @@ -659,7 +659,7 @@ void PlaylistEditorView::ShowMenu(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(menu, popupStack, "actionmenu"); + auto *menuPopup = new MythDialogBox(menu, popupStack, "actionmenu"); if (menuPopup->Create()) popupStack->AddScreen(menuPopup); @@ -679,7 +679,7 @@ MythMenu* PlaylistEditorView::createPlaylistMenu(void) if (GetFocusWidget() == m_playlistTree) { - MusicGenericTree *mnode = dynamic_cast(m_playlistTree->GetCurrentNode()); + auto *mnode = dynamic_cast(m_playlistTree->GetCurrentNode()); if (!mnode) return nullptr; @@ -702,7 +702,7 @@ MythMenu* PlaylistEditorView::createSmartPlaylistMenu(void) if (GetFocusWidget() == m_playlistTree) { - MusicGenericTree *mnode = dynamic_cast(m_playlistTree->GetCurrentNode()); + auto *mnode = dynamic_cast(m_playlistTree->GetCurrentNode()); if (!mnode) return nullptr; @@ -736,7 +736,7 @@ void PlaylistEditorView::createRootNode(void ) if (!m_rootNode) m_rootNode = new MusicGenericTree(nullptr, "Root Music Node"); - MusicGenericTree *node = new MusicGenericTree(m_rootNode, tr("All Tracks"), "all tracks"); + auto *node = new MusicGenericTree(m_rootNode, tr("All Tracks"), "all tracks"); node->setDrawArrow(true); node->SetData(qVariantFromValue(gMusicData->m_all_music->getAllMetadata())); @@ -768,7 +768,7 @@ void PlaylistEditorView::createRootNode(void ) node->setDrawArrow(true); MetadataPtrList *alltracks = gMusicData->m_all_music->getAllMetadata(); - MetadataPtrList *compTracks = new MetadataPtrList; + auto *compTracks = new MetadataPtrList; m_deleteList.append(compTracks); for (int x = 0; x < alltracks->count(); x++) @@ -802,8 +802,8 @@ void PlaylistEditorView::createRootNode(void ) void PlaylistEditorView::treeItemClicked(MythUIButtonListItem *item) { - MythGenericTree *node = item->GetData().value(); - MusicGenericTree *mnode = dynamic_cast(node); + auto *node = item->GetData().value(); + auto *mnode = dynamic_cast(node); if (!mnode || !gPlayer->getCurrentPlaylist() || mnode->getAction() == "error") return; @@ -830,8 +830,8 @@ void PlaylistEditorView::treeItemClicked(MythUIButtonListItem *item) void PlaylistEditorView::treeItemVisible(MythUIButtonListItem *item) { - MythGenericTree *node = item->GetData().value();; - MusicGenericTree *mnode = dynamic_cast(node); + auto *node = item->GetData().value();; + auto *mnode = dynamic_cast(node); if (!mnode) return; @@ -851,7 +851,7 @@ void PlaylistEditorView::treeItemVisible(MythUIButtonListItem *item) else if (mnode->getAction() == "album") { // hunt for a coverart image for the album - MetadataPtrList *tracks = node->GetData().value(); + auto *tracks = node->GetData().value(); for (int x = 0; x < tracks->count(); x++) { MusicMetadata *mdata = tracks->at(x); @@ -919,7 +919,7 @@ void PlaylistEditorView::treeItemVisible(MythUIButtonListItem *item) void PlaylistEditorView::treeNodeChanged(MythGenericTree *node) { - MusicGenericTree *mnode = dynamic_cast(node); + auto *mnode = dynamic_cast(node); if (!mnode) return; @@ -969,7 +969,7 @@ void PlaylistEditorView::treeNodeChanged(MythGenericTree *node) void PlaylistEditorView::filterTracks(MusicGenericTree *node) { - MetadataPtrList *tracks = node->GetData().value(); + auto *tracks = node->GetData().value(); if (!tracks) return; @@ -979,7 +979,7 @@ void PlaylistEditorView::filterTracks(MusicGenericTree *node) QMap map; QStringList list; bool isAlbum = false; - MusicGenericTree *parentNode = dynamic_cast(node->getParent()); + auto *parentNode = dynamic_cast(node->getParent()); if (parentNode) isAlbum = parentNode->getAction() == "album"; @@ -1013,7 +1013,7 @@ void PlaylistEditorView::filterTracks(MusicGenericTree *node) QMap::const_iterator i = map.constBegin(); while (i != map.constEnd()) { - MusicGenericTree *newnode = new MusicGenericTree(node, i.key(), "trackid"); + auto *newnode = new MusicGenericTree(node, i.key(), "trackid"); newnode->setInt(i.value()); newnode->setDrawArrow(false); bool hasTrack = gPlayer->getCurrentPlaylist() ? gPlayer->getCurrentPlaylist()->checkTrack(newnode->getInt()) : false; @@ -1039,7 +1039,7 @@ void PlaylistEditorView::filterTracks(MusicGenericTree *node) } else { - MetadataPtrList *filteredTracks = new MetadataPtrList; + auto *filteredTracks = new MetadataPtrList; m_deleteList.append(filteredTracks); filteredTracks->append(mdata); map.insert(mdata->Artist(), filteredTracks); @@ -1050,7 +1050,7 @@ void PlaylistEditorView::filterTracks(MusicGenericTree *node) QMap::const_iterator i = map.constBegin(); while (i != map.constEnd()) { - MusicGenericTree *newnode = new MusicGenericTree(node, i.key(), "artist"); + auto *newnode = new MusicGenericTree(node, i.key(), "artist"); newnode->SetData(qVariantFromValue(i.value())); ++i; } @@ -1075,7 +1075,7 @@ void PlaylistEditorView::filterTracks(MusicGenericTree *node) } else { - MetadataPtrList *filteredTracks = new MetadataPtrList; + auto *filteredTracks = new MetadataPtrList; m_deleteList.append(filteredTracks); filteredTracks->append(mdata); map.insert(mdata->CompilationArtist(), filteredTracks); @@ -1087,7 +1087,7 @@ void PlaylistEditorView::filterTracks(MusicGenericTree *node) QMap::const_iterator i = map.constBegin(); while (i != map.constEnd()) { - MusicGenericTree *newnode = new MusicGenericTree(node, i.key(), "compartist"); + auto *newnode = new MusicGenericTree(node, i.key(), "compartist"); newnode->SetData(qVariantFromValue(i.value())); ++i; } @@ -1110,7 +1110,7 @@ void PlaylistEditorView::filterTracks(MusicGenericTree *node) } else { - MetadataPtrList *filteredTracks = new MetadataPtrList; + auto *filteredTracks = new MetadataPtrList; m_deleteList.append(filteredTracks); filteredTracks->append(mdata); map.insert(mdata->Album(), filteredTracks); @@ -1121,7 +1121,7 @@ void PlaylistEditorView::filterTracks(MusicGenericTree *node) QMap::const_iterator i = map.constBegin(); while (i != map.constEnd()) { - MusicGenericTree *newnode = new MusicGenericTree(node, i.key(), "album"); + auto *newnode = new MusicGenericTree(node, i.key(), "album"); newnode->SetData(qVariantFromValue(i.value())); ++i; } @@ -1144,7 +1144,7 @@ void PlaylistEditorView::filterTracks(MusicGenericTree *node) } else { - MetadataPtrList *filteredTracks = new MetadataPtrList; + auto *filteredTracks = new MetadataPtrList; m_deleteList.append(filteredTracks); filteredTracks->append(mdata); map.insert(mdata->Genre(), filteredTracks); @@ -1155,7 +1155,7 @@ void PlaylistEditorView::filterTracks(MusicGenericTree *node) QMap::const_iterator i = map.constBegin(); while (i != map.constEnd()) { - MusicGenericTree *newnode = new MusicGenericTree(node, i.key(), "genre"); + auto *newnode = new MusicGenericTree(node, i.key(), "genre"); newnode->SetSortText(i.key()); // No manipulation of prefixes on genres newnode->SetData(qVariantFromValue(i.value())); ++i; @@ -1180,7 +1180,7 @@ void PlaylistEditorView::filterTracks(MusicGenericTree *node) } else { - MetadataPtrList *filteredTracks = new MetadataPtrList; + auto *filteredTracks = new MetadataPtrList; m_deleteList.append(filteredTracks); filteredTracks->append(mdata); map.insert(ratingStr, filteredTracks); @@ -1191,7 +1191,7 @@ void PlaylistEditorView::filterTracks(MusicGenericTree *node) QMap::const_iterator i = map.constBegin(); while (i != map.constEnd()) { - MusicGenericTree *newnode = new MusicGenericTree(node, i.key(), "rating"); + auto *newnode = new MusicGenericTree(node, i.key(), "rating"); newnode->SetData(qVariantFromValue(i.value())); ++i; } @@ -1213,7 +1213,7 @@ void PlaylistEditorView::filterTracks(MusicGenericTree *node) } else { - MetadataPtrList *filteredTracks = new MetadataPtrList; + auto *filteredTracks = new MetadataPtrList; m_deleteList.append(filteredTracks); filteredTracks->append(mdata); map.insert(yearStr, filteredTracks); @@ -1224,7 +1224,7 @@ void PlaylistEditorView::filterTracks(MusicGenericTree *node) QMap::const_iterator i = map.constBegin(); while (i != map.constEnd()) { - MusicGenericTree *newnode = new MusicGenericTree(node, i.key(), "year"); + auto *newnode = new MusicGenericTree(node, i.key(), "year"); newnode->SetData(qVariantFromValue(i.value())); ++i; } @@ -1267,7 +1267,7 @@ void PlaylistEditorView::filterTracks(MusicGenericTree *node) } else { - MetadataPtrList *filteredTracks = new MetadataPtrList; + auto *filteredTracks = new MetadataPtrList; m_deleteList.append(filteredTracks); filteredTracks->append(mdata); map.insert(key, filteredTracks); @@ -1281,7 +1281,7 @@ void PlaylistEditorView::filterTracks(MusicGenericTree *node) { if (!i.key().startsWith("[TRACK]")) { - MusicGenericTree *newnode = new MusicGenericTree(node, i.key(), "directory"); + auto *newnode = new MusicGenericTree(node, i.key(), "directory"); newnode->SetData(qVariantFromValue(i.value())); } ++i; @@ -1293,7 +1293,7 @@ void PlaylistEditorView::filterTracks(MusicGenericTree *node) { if (i.key().startsWith("[TRACK]")) { - MusicGenericTree *newnode = new MusicGenericTree(node, i.key().mid(7), "trackid"); + auto *newnode = new MusicGenericTree(node, i.key().mid(7), "trackid"); newnode->setInt(i.value()->at(0)->ID()); newnode->setDrawArrow(false); bool hasTrack = gPlayer->getCurrentPlaylist() ? gPlayer->getCurrentPlaylist()->checkTrack(newnode->getInt()) : false; @@ -1316,7 +1316,7 @@ void PlaylistEditorView::filterTracks(MusicGenericTree *node) climber = dynamic_cast(climber->getParent()); } - MusicGenericTree *newnode = new MusicGenericTree(node, tr("All Tracks"), "all tracks"); + auto *newnode = new MusicGenericTree(node, tr("All Tracks"), "all tracks"); newnode->setDrawArrow(true); newnode->SetData(node->GetData()); @@ -1353,7 +1353,7 @@ void PlaylistEditorView::filterTracks(MusicGenericTree *node) // only show the Comp. Artist if it differs from the Artist bool found = false; - MetadataPtrList *tracks2 = node->GetData().value(); + auto *tracks2 = node->GetData().value(); for (int x = 0; x < tracks2->count(); x++) { MusicMetadata *mdata = tracks2->at(x); @@ -1417,7 +1417,7 @@ void PlaylistEditorView::getSmartPlaylistCategories(MusicGenericTree *node) { // No memory leak. MusicGenericTree adds the new node // into a list of nodes maintained by its parent. - MusicGenericTree *newnode = + auto *newnode = new MusicGenericTree(node, query.value(1).toString(), "smartplaylistcategory"); newnode->setInt(query.value(0).toInt()); } @@ -1445,7 +1445,7 @@ void PlaylistEditorView::getSmartPlaylists(MusicGenericTree *node) { // No memory leak. MusicGenericTree adds the new node // into a list of nodes maintained by its parent. - MusicGenericTree *newnode = + auto *newnode = new MusicGenericTree(node, query.value(1).toString(), "smartplaylist"); newnode->setInt(query.value(0).toInt()); } @@ -1552,7 +1552,7 @@ void PlaylistEditorView::getSmartPlaylistTracks(MusicGenericTree *node, int play while (query.next()) { - MusicGenericTree *newnode = + auto *newnode = new MusicGenericTree(node, query.value(1).toString(), "trackid"); newnode->setInt(query.value(0).toInt()); newnode->setDrawArrow(false); @@ -1563,7 +1563,7 @@ void PlaylistEditorView::getSmartPlaylistTracks(MusicGenericTree *node, int play // check we found some tracks if not add something to let the user know if (node->childCount() == 0) { - MusicGenericTree *newnode = + auto *newnode = new MusicGenericTree(node, tr("** No matching tracks **"), "error"); newnode->setDrawArrow(false); } @@ -1578,7 +1578,7 @@ void PlaylistEditorView::getPlaylists(MusicGenericTree *node) Playlist *playlist = playlists->at(x); // No memory leak. MusicGenericTree adds the new node // into a list of nodes maintained by its parent. - MusicGenericTree *newnode = + auto *newnode = new MusicGenericTree(node, playlist->getName(), "playlist"); newnode->setInt(playlist->getID()); } @@ -1592,7 +1592,7 @@ void PlaylistEditorView::getCDTracks(MusicGenericTree *node) { MusicMetadata *mdata = tracks->at(x); QString title = QString("%1 - %2").arg(mdata->Track()).arg(mdata->FormatTitle()); - MusicGenericTree *newnode = new MusicGenericTree(node, title, "trackid"); + auto *newnode = new MusicGenericTree(node, title, "trackid"); newnode->setInt(mdata->ID()); newnode->setDrawArrow(false); bool hasTrack = gPlayer->getCurrentPlaylist() ? gPlayer->getCurrentPlaylist()->checkTrack(mdata->ID()) : false; @@ -1611,7 +1611,7 @@ void PlaylistEditorView::getPlaylistTracks(MusicGenericTree *node, int playlistI MusicMetadata *mdata = playlist->getSongAt(x); if (mdata) { - MusicGenericTree *newnode = new MusicGenericTree(node, mdata->Title(), "trackid"); + auto *newnode = new MusicGenericTree(node, mdata->Title(), "trackid"); newnode->setInt(mdata->ID()); newnode->setDrawArrow(false); bool hasTrack = gPlayer->getCurrentPlaylist() ? gPlayer->getCurrentPlaylist()->checkTrack(mdata->ID()) : false; @@ -1623,7 +1623,7 @@ void PlaylistEditorView::getPlaylistTracks(MusicGenericTree *node, int playlistI // check we found some tracks if not add something to let the user know if (node->childCount() == 0) { - MusicGenericTree *newnode = + auto *newnode = new MusicGenericTree(node, tr("** Empty Playlist!! **"), "error"); newnode->setDrawArrow(false); } @@ -1638,7 +1638,7 @@ void PlaylistEditorView::updateSelectedTracks(MusicGenericTree *node) { for (int x = 0; x < node->childCount(); x++) { - MusicGenericTree *mnode = dynamic_cast(node->getChildAt(x)); + auto *mnode = dynamic_cast(node->getChildAt(x)); if (mnode) { if (mnode->getAction() == "trackid") @@ -1719,7 +1719,7 @@ void PlaylistEditorView::deleteSmartPlaylist(bool ok) MythGenericTree *node = m_playlistTree->GetCurrentNode(); if (node) { - MusicGenericTree *mnode = dynamic_cast(node); + auto *mnode = dynamic_cast(node); if (mnode) { if (mnode->getAction() == "smartplaylist") @@ -1742,7 +1742,7 @@ void PlaylistEditorView::deletePlaylist(bool ok) MythGenericTree *node = m_playlistTree->GetCurrentNode(); if (node) { - MusicGenericTree *mnode = dynamic_cast(node); + auto *mnode = dynamic_cast(node); if (mnode) { if (mnode->getAction() == "playlist") diff --git a/mythplugins/mythmusic/mythmusic/pls.cpp b/mythplugins/mythmusic/mythmusic/pls.cpp index b6fab8953b4..bb08e0bba6d 100644 --- a/mythplugins/mythmusic/mythmusic/pls.cpp +++ b/mythplugins/mythmusic/mythmusic/pls.cpp @@ -62,7 +62,7 @@ int PlayListFile::parsePLS(PlayListFile *pls, const QString &filename) for (int n = 1; n <= num_entries; n++) { - PlayListFileEntry *e = new PlayListFileEntry(); + auto *e = new PlayListFileEntry(); QString t_key = QString("Title%1").arg(n); QString f_key = QString("File%1").arg(n); QString l_key = QString("Length%1").arg(n); @@ -106,7 +106,7 @@ int PlayListFile::parseM3U(PlayListFile *pls, const QString &filename) continue; // add to the playlist - PlayListFileEntry *e = new PlayListFileEntry(); + auto *e = new PlayListFileEntry(); e->setFile(*it); e->setTitle(*it); e->setLength(-1); @@ -149,7 +149,7 @@ int PlayListFile::parseASX(PlayListFile *pls, const QString &filename) url = elem2.attribute("href"); // add to the playlist - PlayListFileEntry *e = new PlayListFileEntry(); + auto *e = new PlayListFileEntry(); e->setFile(url.replace("mms://", "mmsh://")); e->setTitle(url.replace("mms://", "mmsh://")); e->setLength(-1); diff --git a/mythplugins/mythmusic/mythmusic/remoteavformatcontext.h b/mythplugins/mythmusic/mythmusic/remoteavformatcontext.h index a3af18a38a7..f2086ecc825 100644 --- a/mythplugins/mythmusic/mythmusic/remoteavformatcontext.h +++ b/mythplugins/mythmusic/mythmusic/remoteavformatcontext.h @@ -42,8 +42,7 @@ class RemoteAVFormatContext avformat_free_context(m_inputFC); m_inputFC = avformat_alloc_context(); - if (m_rf) - delete m_rf; + delete m_rf; m_inputIsRemote = filename.startsWith("myth://"); if (m_inputIsRemote) @@ -122,11 +121,8 @@ class RemoteAVFormatContext m_inputFC = nullptr; } - if (m_rf) - { - delete m_rf; - m_rf = nullptr; - } + delete m_rf; + m_rf = nullptr; m_isOpen = false; } diff --git a/mythplugins/mythmusic/mythmusic/searchview.cpp b/mythplugins/mythmusic/mythmusic/searchview.cpp index a4cbd5d01c4..fe19db49052 100644 --- a/mythplugins/mythmusic/mythmusic/searchview.cpp +++ b/mythplugins/mythmusic/mythmusic/searchview.cpp @@ -85,7 +85,7 @@ void SearchView::customEvent(QEvent *event) if (event->type() == MusicPlayerEvent::TrackRemovedEvent || event->type() == MusicPlayerEvent::TrackAddedEvent) { - MusicPlayerEvent *mpe = dynamic_cast(event); + auto *mpe = dynamic_cast(event); if (!mpe) return; @@ -95,7 +95,7 @@ void SearchView::customEvent(QEvent *event) for (int x = 0; x < m_tracksList->GetCount(); x++) { MythUIButtonListItem *item = m_tracksList->GetItemAt(x); - MusicMetadata *mdata = item->GetData().value(); + auto *mdata = item->GetData().value(); if (mdata && (mdata->ID() == (MusicMetadata::IdType) trackID || trackID == -1)) { if (gPlayer->getCurrentPlaylist() && gPlayer->getCurrentPlaylist()->checkTrack(mdata->ID())) @@ -132,7 +132,7 @@ void SearchView::customEvent(QEvent *event) } else if (event->type() == MusicPlayerEvent::MetadataChangedEvent) { - MusicPlayerEvent *mpe = dynamic_cast(event); + auto *mpe = dynamic_cast(event); if (!mpe) return; @@ -142,7 +142,7 @@ void SearchView::customEvent(QEvent *event) for (int x = 0; x < m_tracksList->GetCount(); x++) { MythUIButtonListItem *item = m_tracksList->GetItemAt(x); - MusicMetadata *mdata = item->GetData().value(); + auto *mdata = item->GetData().value(); if (mdata && mdata->ID() == trackID) { InfoMap metadataMap; @@ -218,7 +218,7 @@ bool SearchView::keyPressEvent(QKeyEvent *event) { if (m_tracksList->GetItemCurrent()) { - MusicMetadata *mdata = m_tracksList->GetItemCurrent()->GetData().value(); + auto *mdata = m_tracksList->GetItemCurrent()->GetData().value(); if (mdata) { if (action == "INFO") @@ -261,12 +261,12 @@ void SearchView::ShowMenu(void) { QString label = tr("Search Actions"); - MythMenu *menu = new MythMenu(label, this, "searchviewmenu"); + auto *menu = new MythMenu(label, this, "searchviewmenu"); MythUIButtonListItem *item = m_tracksList->GetItemCurrent(); if (item) { - MusicMetadata *mdata = item->GetData().value(); + auto *mdata = item->GetData().value(); if (mdata) { if (gPlayer->getCurrentPlaylist() && gPlayer->getCurrentPlaylist()->checkTrack(mdata->ID())) @@ -286,7 +286,7 @@ void SearchView::ShowMenu(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(menu, popupStack, "actionmenu"); + auto *menuPopup = new MythDialogBox(menu, popupStack, "actionmenu"); if (menuPopup->Create()) popupStack->AddScreen(menuPopup); @@ -409,7 +409,7 @@ void SearchView::updateTracksList(void) MusicMetadata *mdata = gMusicData->m_all_music->getMetadata(trackid); if (mdata) { - MythUIButtonListItem *newitem = new MythUIButtonListItem(m_tracksList, ""); + auto *newitem = new MythUIButtonListItem(m_tracksList, ""); newitem->SetData(qVariantFromValue(mdata)); InfoMap metadataMap; mdata->toMap(metadataMap); @@ -435,7 +435,7 @@ void SearchView::trackClicked(MythUIButtonListItem *item) if (!gPlayer->getCurrentPlaylist()) return; - MusicMetadata *mdata = item->GetData().value(); + auto *mdata = item->GetData().value(); if (mdata) { if (gPlayer->getCurrentPlaylist()->checkTrack(mdata->ID())) @@ -453,7 +453,7 @@ void SearchView::trackVisible(MythUIButtonListItem *item) if (item->GetImageFilename().isEmpty()) { - MusicMetadata *mdata = item->GetData().value(); + auto *mdata = item->GetData().value(); if (mdata) { QString artFile = mdata->getAlbumArtFile(); diff --git a/mythplugins/mythmusic/mythmusic/smartplaylist.cpp b/mythplugins/mythmusic/mythmusic/smartplaylist.cpp index b3056f1873d..f09be208f09 100644 --- a/mythplugins/mythmusic/mythmusic/smartplaylist.cpp +++ b/mythplugins/mythmusic/mythmusic/smartplaylist.cpp @@ -469,7 +469,7 @@ void SmartPlaylistEditor::customEvent(QEvent *event) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); QString label = tr("Enter Name Of New Category"); - MythTextInputDialog *input = new MythTextInputDialog(popupStack, label); + auto *input = new MythTextInputDialog(popupStack, label); connect(input, SIGNAL(haveResult(QString)), SLOT(newCategory(QString))); @@ -486,7 +486,7 @@ void SmartPlaylistEditor::customEvent(QEvent *event) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); QString label = tr("Enter New Name For Category: %1").arg(m_categorySelector->GetValue()); - MythTextInputDialog *input = new MythTextInputDialog(popupStack, label); + auto *input = new MythTextInputDialog(popupStack, label); connect(input, SIGNAL(haveResult(QString)), SLOT(renameCategory(QString))); @@ -513,14 +513,14 @@ void SmartPlaylistEditor::editCriteria(void) if (!item) return; - SmartPLCriteriaRow *row = item->GetData().value(); + auto *row = item->GetData().value(); if (!row) return; MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - CriteriaRowEditor *editor = new CriteriaRowEditor(popupStack, row); + auto *editor = new CriteriaRowEditor(popupStack, row); if (!editor->Create()) { @@ -552,7 +552,7 @@ void SmartPlaylistEditor::doDeleteCriteria(bool doit) if (!item) return; - SmartPLCriteriaRow *row = item->GetData().value(); + auto *row = item->GetData().value(); if (!row) return; @@ -582,7 +582,7 @@ void SmartPlaylistEditor::addCriteria(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - CriteriaRowEditor *editor = new CriteriaRowEditor(popupStack, m_tempCriteriaRow); + auto *editor = new CriteriaRowEditor(popupStack, m_tempCriteriaRow); if (!editor->Create()) { @@ -618,7 +618,7 @@ void SmartPlaylistEditor::criteriaChanged() if (!item) return; - SmartPLCriteriaRow *row = item->GetData().value(); + auto *row = item->GetData().value(); if (!row) return; @@ -635,7 +635,7 @@ void SmartPlaylistEditor::showCategoryMenu(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menu = new MythDialogBox(label, popupStack, "actionmenu"); + auto *menu = new MythDialogBox(label, popupStack, "actionmenu"); if (!menu->Create()) { @@ -658,7 +658,7 @@ void SmartPlaylistEditor::showCriteriaMenu(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menu = new MythDialogBox(label, popupStack, "actionmenu"); + auto *menu = new MythDialogBox(label, popupStack, "actionmenu"); if (!menu->Create()) { @@ -872,8 +872,7 @@ void SmartPlaylistEditor::loadFromDatabase(const QString& category, const QStrin QString Value1 = query.value(2).toString(); QString Value2 = query.value(3).toString(); // load smartplaylist items - SmartPLCriteriaRow *row = - new SmartPLCriteriaRow(Field, Operator, Value1, Value2); + auto *row = new SmartPLCriteriaRow(Field, Operator, Value1, Value2); m_criteriaRows.append(row); new MythUIButtonListItem(m_criteriaList, row->toString(), qVariantFromValue(row)); @@ -1010,7 +1009,7 @@ void SmartPlaylistEditor::showResultsClicked(void) MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - SmartPLResultViewer *resultViewer = new SmartPLResultViewer(mainStack); + auto *resultViewer = new SmartPLResultViewer(mainStack); if (!resultViewer->Create()) { @@ -1027,7 +1026,7 @@ void SmartPlaylistEditor::orderByClicked(void) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - SmartPLOrderByDialog *orderByDialog = new SmartPLOrderByDialog(popupStack); + auto *orderByDialog = new SmartPLOrderByDialog(popupStack); if (!orderByDialog->Create()) { @@ -1551,7 +1550,7 @@ void CriteriaRowEditor::valueButtonClicked(void) } MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUISearchDialog *searchDlg = new MythUISearchDialog(popupStack, msg, searchList, false, s); + auto *searchDlg = new MythUISearchDialog(popupStack, msg, searchList, false, s); if (!searchDlg->Create()) { @@ -1575,7 +1574,7 @@ void CriteriaRowEditor::setValue(const QString& value) void CriteriaRowEditor::editDate(void) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - SmartPLDateDialog *dateDlg = new SmartPLDateDialog(popupStack); + auto *dateDlg = new SmartPLDateDialog(popupStack); QString date = GetFocusWidget() == m_value1Button ? m_value1Selector->GetValue() : m_value2Selector->GetValue(); if (!dateDlg->Create()) @@ -1676,7 +1675,7 @@ void SmartPLResultViewer::trackVisible(MythUIButtonListItem *item) if (item->GetImageFilename().isEmpty()) { - MusicMetadata *mdata = item->GetData().value(); + auto *mdata = item->GetData().value(); if (mdata) { QString artFile = mdata->getAlbumArtFile(); @@ -1704,13 +1703,13 @@ void SmartPLResultViewer::showTrackInfo(void) if (!item) return; - MusicMetadata *mdata = item->GetData().value(); + auto *mdata = item->GetData().value(); if (!mdata) return; MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - TrackInfoDialog *dlg = new TrackInfoDialog(popupStack, mdata, "trackinfopopup"); + auto *dlg = new TrackInfoDialog(popupStack, mdata, "trackinfopopup"); if (!dlg->Create()) { @@ -1737,7 +1736,7 @@ void SmartPLResultViewer::setSQL(const QString& sql) InfoMap metadataMap; mdata->toMap(metadataMap); - MythUIButtonListItem *item = new MythUIButtonListItem(m_trackList, "", qVariantFromValue(mdata)); + auto *item = new MythUIButtonListItem(m_trackList, "", qVariantFromValue(mdata)); item->SetTextFromMap(metadataMap); } } @@ -1824,7 +1823,7 @@ void SmartPLOrderByDialog::setFieldList(const QString &fieldList) for (int x = 0; x < list.count(); x++) { - MythUIButtonListItem *item = new MythUIButtonListItem(m_fieldList, list[x].trimmed()); + auto *item = new MythUIButtonListItem(m_fieldList, list[x].trimmed()); QString state = list[x].contains("(A)") ? "ascending" : "descending"; item->DisplayState(state, "sortstate"); } @@ -1866,7 +1865,7 @@ void SmartPLOrderByDialog::descendingPressed(void) void SmartPLOrderByDialog::addPressed(void) { - MythUIButtonListItem *item = new MythUIButtonListItem(m_fieldList, m_orderSelector->GetValue() + " (A)"); + auto *item = new MythUIButtonListItem(m_fieldList, m_orderSelector->GetValue() + " (A)"); item->DisplayState("ascending", "sortstate"); orderByChanged(); diff --git a/mythplugins/mythmusic/mythmusic/streamview.cpp b/mythplugins/mythmusic/mythmusic/streamview.cpp index 61c1548a8c7..c9950567e51 100644 --- a/mythplugins/mythmusic/mythmusic/streamview.cpp +++ b/mythplugins/mythmusic/mythmusic/streamview.cpp @@ -78,7 +78,7 @@ bool StreamView::Create(void) void StreamView::ShowMenu(void) { - MythMenu *menu = new MythMenu(tr("Stream Actions"), this, "mainmenu"); + auto *menu = new MythMenu(tr("Stream Actions"), this, "mainmenu"); menu->AddItem(tr("Add Stream")); if (m_streamList->GetItemCurrent()) @@ -94,7 +94,7 @@ void StreamView::ShowMenu(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(menu, popupStack, "actionmenu"); + auto *menuPopup = new MythDialogBox(menu, popupStack, "actionmenu"); if (menuPopup->Create()) popupStack->AddScreen(menuPopup); @@ -116,8 +116,8 @@ void StreamView::customEvent(QEvent *event) { MusicMetadata *mdata = gPlayer->getPlayedTracksList().last(); - MythUIButtonListItem *item = - new MythUIButtonListItem(m_playedTracksList, "", qVariantFromValue(mdata), 0); + auto *item = new MythUIButtonListItem(m_playedTracksList, "", + qVariantFromValue(mdata), 0); InfoMap metadataMap; mdata->toMap(metadataMap); @@ -131,7 +131,7 @@ void StreamView::customEvent(QEvent *event) } else if (event->type() == MusicPlayerEvent::TrackChangeEvent) { - MusicPlayerEvent *mpe = dynamic_cast(event); + auto *mpe = dynamic_cast(event); if (!mpe) return; @@ -212,7 +212,7 @@ void StreamView::customEvent(QEvent *event) } else if (event->type() == MythEvent::MythEventMessage) { - MythEvent *me = dynamic_cast(event); + auto *me = dynamic_cast(event); if (me == nullptr) return; QStringList tokens = me->Message().split(" ", QString::SkipEmptyParts); @@ -241,7 +241,7 @@ void StreamView::customEvent(QEvent *event) for (int x = 0; x < m_streamList->GetCount(); x++) { MythUIButtonListItem *item = m_streamList->GetItemAt(x); - MusicMetadata *mdata = item->GetData().value(); + auto *mdata = item->GetData().value(); if (mdata && mdata->LogoUrl() == url) item->SetImage(filename); } @@ -251,7 +251,7 @@ void StreamView::customEvent(QEvent *event) } else if (event->type() == DecoderHandlerEvent::OperationStart) { - DecoderHandlerEvent *dhe = dynamic_cast(event); + auto *dhe = dynamic_cast(event); if (!dhe) return; if (dhe->getMessage() && m_bufferStatus) @@ -261,7 +261,7 @@ void StreamView::customEvent(QEvent *event) } else if (event->type() == DecoderHandlerEvent::BufferStatus) { - DecoderHandlerEvent *dhe = dynamic_cast(event); + auto *dhe = dynamic_cast(event); if (!dhe) return; @@ -377,7 +377,7 @@ void StreamView::editStream(void) MythUIButtonListItem *item = m_streamList->GetItemCurrent(); if (item) { - MusicMetadata *mdata = item->GetData().value(); + auto *mdata = item->GetData().value(); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); MythScreenType *screen = new EditStreamMetadata(mainStack, this, mdata); @@ -393,7 +393,7 @@ void StreamView::removeStream(void) MythUIButtonListItem *item = m_streamList->GetItemCurrent(); if (item) { - MusicMetadata *mdata = item->GetData().value(); + auto *mdata = item->GetData().value(); if (mdata) ShowOkPopup(tr("Are you sure you want to delete this Stream?\n" @@ -411,7 +411,7 @@ void StreamView::doRemoveStream(bool ok) MythUIButtonListItem *item = m_streamList->GetItemCurrent(); if (item) { - MusicMetadata *mdata = item->GetData().value(); + auto *mdata = item->GetData().value(); if (mdata) deleteStream(mdata); @@ -430,7 +430,8 @@ void StreamView::updateStreamList(void) for (int x = 0; x < gPlayer->getCurrentPlaylist()->getTrackCount(); x++) { MusicMetadata *mdata = gPlayer->getCurrentPlaylist()->getSongAt(x); - MythUIButtonListItem *item = new MythUIButtonListItem(m_streamList, "", qVariantFromValue(mdata)); + auto *item = new MythUIButtonListItem(m_streamList, "", + qVariantFromValue(mdata)); InfoMap metadataMap; if (mdata) mdata->toMap(metadataMap); @@ -496,7 +497,7 @@ void StreamView::streamItemVisible(MythUIButtonListItem *item) if (!item->GetText("imageloaded").isEmpty()) return; - MusicMetadata *mdata = item->GetData().value(); + auto *mdata = item->GetData().value(); if (mdata) { if (!mdata->LogoUrl().isEmpty()) @@ -530,7 +531,7 @@ void StreamView::addStream(MusicMetadata *mdata) for (int x = 0; x < m_streamList->GetCount(); x++) { MythUIButtonListItem *item = m_streamList->GetItemAt(x); - MusicMetadata *itemsdata = item->GetData().value(); + auto *itemsdata = item->GetData().value(); if (itemsdata) { if (url == itemsdata->Url()) @@ -584,7 +585,7 @@ void StreamView::updateStream(MusicMetadata *mdata) for (int x = 0; x < m_playedTracksList->GetCount(); x++) { MythUIButtonListItem *item = m_playedTracksList->GetItemAt(x); - MusicMetadata *playedmdata = item->GetData().value(); + auto *playedmdata = item->GetData().value(); if (playedmdata && playedmdata->ID() == id) { @@ -602,7 +603,7 @@ void StreamView::updateStream(MusicMetadata *mdata) for (int x = 0; x < m_streamList->GetCount(); x++) { MythUIButtonListItem *item = m_streamList->GetItemAt(x); - MusicMetadata *itemsdata = item->GetData().value(); + auto *itemsdata = item->GetData().value(); if (itemsdata) { if (mdata->ID() == itemsdata->ID()) @@ -1116,7 +1117,8 @@ void SearchStream::doUpdateStreams(void) mdata.setCountry(query.value(11).toString()); mdata.setLanguage(query.value(12).toString()); - MythUIButtonListItem *item = new MythUIButtonListItem(m_streamList, "", qVariantFromValue(mdata)); + auto *item = new MythUIButtonListItem(m_streamList, "", + qVariantFromValue(mdata)); InfoMap metadataMap; mdata.toMap(metadataMap); diff --git a/mythplugins/mythmusic/mythmusic/synaesthesia.cpp b/mythplugins/mythmusic/mythmusic/synaesthesia.cpp index 47e5535936a..346b9da16ce 100644 --- a/mythplugins/mythmusic/mythmusic/synaesthesia.cpp +++ b/mythplugins/mythmusic/mythmusic/synaesthesia.cpp @@ -259,7 +259,7 @@ unsigned char Synaesthesia::getPixel(int x, int y, int where) void Synaesthesia::fadeFade(void) { - uint32_t *ptr = (uint32_t *)output; + auto *ptr = (uint32_t *)output; int i = m_outWidth * m_outHeight * 2 / sizeof(uint32_t); do { uint32_t x = *ptr; @@ -578,12 +578,12 @@ bool Synaesthesia::draw(QPainter *p, const QColor &back) (void)back; - uint32_t *ptrOutput = (uint32_t *)output; + auto *ptrOutput = (uint32_t *)output; for (int j = 0; j < m_outHeight * 2; j += 2) { - uint32_t *ptrTop = (uint32_t *)(m_outputImage->scanLine(j)); - uint32_t *ptrBot = (uint32_t *)(m_outputImage->scanLine(j+1)); + auto *ptrTop = (uint32_t *)(m_outputImage->scanLine(j)); + auto *ptrBot = (uint32_t *)(m_outputImage->scanLine(j+1)); int i = m_outWidth / 4; diff --git a/mythplugins/mythmusic/mythmusic/visualize.cpp b/mythplugins/mythmusic/mythmusic/visualize.cpp index 051d088393f..edfee9ba81e 100644 --- a/mythplugins/mythmusic/mythmusic/visualize.cpp +++ b/mythplugins/mythmusic/mythmusic/visualize.cpp @@ -94,8 +94,8 @@ void LogScale::setMax(int maxscale, int maxrange) delete [] m_indices; - long double domain = (long double) maxscale; - long double range = (long double) maxrange; + auto domain = (long double) maxscale; + auto range = (long double) maxrange; long double x = 1.0; long double dx = 1.0; long double e4 = 1.0E-8; @@ -159,7 +159,7 @@ bool StereoScope::process( VisualNode *node ) double const step = (double)SAMPLES_DEFAULT_SIZE / m_size.width(); for ( int i = 0; i < m_size.width(); i++) { - unsigned long indexTo = (unsigned long)(index + step); + auto indexTo = (unsigned long)(index + step); if (indexTo == (unsigned long)(index)) indexTo = (unsigned long)(index + 1); @@ -193,7 +193,7 @@ bool StereoScope::process( VisualNode *node ) } } #endif - for (unsigned long s = (unsigned long)index; s < indexTo && s < node->m_length; s++) + for (auto s = (unsigned long)index; s < indexTo && s < node->m_length; s++) { double adjHeight = static_cast(m_size.height()) / 4.0; double tmpL = ( ( node->m_left ? static_cast(node->m_left[s]) : 0.) * @@ -375,7 +375,7 @@ bool MonoScope::process( VisualNode *node ) double const step = (double)SAMPLES_DEFAULT_SIZE / m_size.width(); for (int i = 0; i < m_size.width(); i++) { - unsigned long indexTo = (unsigned long)(index + step); + auto indexTo = (unsigned long)(index + step); if (indexTo == (unsigned long)index) indexTo = (unsigned long)(index + 1); @@ -402,7 +402,7 @@ bool MonoScope::process( VisualNode *node ) } } #endif - for (unsigned long s = (unsigned long)index; s < indexTo && s < node->m_length; s++) + for (auto s = (unsigned long)index; s < indexTo && s < node->m_length; s++) { double tmp = ( static_cast(node->m_left[s]) + (node->m_right ? static_cast(node->m_right[s]) : 0.0) * @@ -1455,7 +1455,7 @@ bool AlbumArt::draw(QPainter *p, const QColor &back) if (imageFilename.startsWith("myth://")) { - RemoteFile *rf = new RemoteFile(imageFilename, false, false, 0); + auto *rf = new RemoteFile(imageFilename, false, false, 0); QByteArray data; bool ret = rf->SaveAs(data); diff --git a/mythplugins/mythmusic/mythmusic/visualize.h b/mythplugins/mythmusic/mythmusic/visualize.h index 9956d277d64..b6a9a0f2e42 100644 --- a/mythplugins/mythmusic/mythmusic/visualize.h +++ b/mythplugins/mythmusic/mythmusic/visualize.h @@ -245,7 +245,7 @@ class Piano : public VisualBase #define PIANO_MIN_VOL -10 #define PIANO_KEYPRESS_TOO_LIGHT .2 -typedef struct piano_key_data { +struct piano_key_data { goertzel_data q1, q2, coeff, magnitude; goertzel_data max_magnitude_seen; @@ -256,7 +256,7 @@ typedef struct piano_key_data { int samples_process_before_display_update; bool is_black_note; // These are painted on top of white notes, and have different colouring -} piano_key_data; +}; public: Piano(); diff --git a/mythplugins/mythmusic/mythmusic/visualizerview.cpp b/mythplugins/mythmusic/mythmusic/visualizerview.cpp index 32aae1a1df7..c802ff3010e 100644 --- a/mythplugins/mythmusic/mythmusic/visualizerview.cpp +++ b/mythplugins/mythmusic/mythmusic/visualizerview.cpp @@ -91,7 +91,7 @@ void VisualizerView::ShowMenu(void) { QString label = tr("Actions"); - MythMenu *menu = new MythMenu(label, this, "menu"); + auto *menu = new MythMenu(label, this, "menu"); menu->AddItem(tr("Change Visualizer"), nullptr, createVisualizerMenu()); menu->AddItem(tr("Show Track Info"), SLOT(showTrackInfoPopup())); @@ -99,7 +99,7 @@ void VisualizerView::ShowMenu(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(menu, popupStack, "actionmenu"); + auto *menuPopup = new MythDialogBox(menu, popupStack, "actionmenu"); if (menuPopup->Create()) popupStack->AddScreen(menuPopup); @@ -111,7 +111,7 @@ void VisualizerView::showTrackInfoPopup(void) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - TrackInfoPopup *popup = new TrackInfoPopup(popupStack, gPlayer->getCurrentMetadata()); + auto *popup = new TrackInfoPopup(popupStack, gPlayer->getCurrentMetadata()); if (!popup->Create()) { diff --git a/mythplugins/mythmusic/mythmusic/vorbisencoder.cpp b/mythplugins/mythmusic/mythmusic/vorbisencoder.cpp index 8f71e0f9e05..b9001630bab 100644 --- a/mythplugins/mythmusic/mythmusic/vorbisencoder.cpp +++ b/mythplugins/mythmusic/mythmusic/vorbisencoder.cpp @@ -104,7 +104,7 @@ VorbisEncoder::~VorbisEncoder() int VorbisEncoder::addSamples(int16_t * bytes, unsigned int length) { long realsamples = 0; - signed char *chars = (signed char *)bytes; + auto *chars = (signed char *)bytes; realsamples = length / 4; diff --git a/mythplugins/mythnetvision/mythnetvision/main.cpp b/mythplugins/mythnetvision/mythnetvision/main.cpp index 37febcb41c1..069bca7d674 100644 --- a/mythplugins/mythnetvision/mythnetvision/main.cpp +++ b/mythplugins/mythnetvision/mythnetvision/main.cpp @@ -27,7 +27,7 @@ static int RunNetVision(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - NetSearch *netsearch = new NetSearch(mainStack, "mythnetsearch"); + auto *netsearch = new NetSearch(mainStack, "mythnetsearch"); if (netsearch->Create()) { @@ -45,7 +45,7 @@ static int RunNetTree(void) DialogType type = static_cast(gCoreContext->GetNumSetting( "mythnetvision.ViewMode", DLG_TREE)); - NetTree *nettree = new NetTree(type, mainStack, "mythnettree"); + auto *nettree = new NetTree(type, mainStack, "mythnettree"); if (nettree->Create()) { diff --git a/mythplugins/mythnetvision/mythnetvision/netbase.cpp b/mythplugins/mythnetvision/mythnetvision/netbase.cpp index 71ba1ebf4a0..cf19e63c368 100644 --- a/mythplugins/mythnetvision/mythnetvision/netbase.cpp +++ b/mythplugins/mythnetvision/mythnetvision/netbase.cpp @@ -184,8 +184,7 @@ void NetBase::SlotDeleteVideo() { QString message = tr("Are you sure you want to delete this file?"); - MythConfirmationDialog *confirmdialog = - new MythConfirmationDialog(m_popupStack, message); + auto *confirmdialog = new MythConfirmationDialog(m_popupStack, message); if (confirmdialog->Create()) { @@ -223,7 +222,7 @@ void NetBase::customEvent(QEvent *event) { if (event->type() == MythEvent::MythEventMessage) { - MythEvent *me = dynamic_cast(event); + auto *me = dynamic_cast(event); if (me == nullptr) return; QStringList tokens = me->Message().split(" ", QString::SkipEmptyParts); diff --git a/mythplugins/mythnetvision/mythnetvision/neteditorbase.cpp b/mythplugins/mythnetvision/mythnetvision/neteditorbase.cpp index f6be947f36d..608a9fe0b6e 100644 --- a/mythplugins/mythnetvision/mythnetvision/neteditorbase.cpp +++ b/mythplugins/mythnetvision/mythnetvision/neteditorbase.cpp @@ -189,8 +189,7 @@ void NetEditorBase::FillGrabberButtonList() for (GrabberScript::scriptList::iterator i = m_grabberList.begin(); i != m_grabberList.end(); ++i) { - MythUIButtonListItem *item = - new MythUIButtonListItem(m_grabbers, (*i)->GetTitle()); + auto *item = new MythUIButtonListItem(m_grabbers, (*i)->GetTitle()); item->SetText((*i)->GetTitle(), "title"); item->SetData(qVariantFromValue(*i)); QString img = (*i)->GetImage(); @@ -217,8 +216,7 @@ void NetEditorBase::ToggleItem(MythUIButtonListItem *item) if (!item) return; - GrabberScript *script = item->GetData().value(); - + auto *script = item->GetData().value(); if (!script) return; diff --git a/mythplugins/mythnetvision/mythnetvision/netsearch.cpp b/mythplugins/mythnetvision/mythnetvision/netsearch.cpp index 3cfdfeec9f9..7e259c7449c 100644 --- a/mythplugins/mythnetvision/mythnetvision/netsearch.cpp +++ b/mythplugins/mythnetvision/mythnetvision/netsearch.cpp @@ -170,8 +170,8 @@ void NetSearch::ShowMenu(void) { QString label = tr("Search Options"); - MythDialogBox *menuPopup = new MythDialogBox(label, m_popupStack, - "mythnetvisionmenupopup"); + auto *menuPopup = new MythDialogBox(label, m_popupStack, + "mythnetvisionmenupopup"); if (menuPopup->Create()) { @@ -244,8 +244,7 @@ void NetSearch::FillGrabberButtonList() for (GrabberScript::scriptList::iterator i = m_grabberList.begin(); i != m_grabberList.end(); ++i) { - MythUIButtonListItem *item = - new MythUIButtonListItem(m_siteList, (*i)->GetTitle()); + auto *item = new MythUIButtonListItem(m_siteList, (*i)->GetTitle()); item->SetText((*i)->GetTitle(), "title"); item->SetData((*i)->GetCommandline()); QString thumb = QString("%1mythnetvision/icons/%2").arg(GetShareDir()) @@ -357,7 +356,7 @@ void NetSearch::SearchFinished(void) { CloseBusyPopup(); - Search *item = new Search(); + auto *item = new Search(); QByteArray data = m_reply->readAll(); item->SetData(data); @@ -421,9 +420,8 @@ void NetSearch::PopulateResultList(ResultItem::resultList list) i != list.end(); ++i) { QString title = (*i)->GetTitle(); - MythUIButtonListItem *item = - new MythUIButtonListItem(m_searchResultList, title, - qVariantFromValue(*i)); + auto *item = new MythUIButtonListItem(m_searchResultList, title, + qVariantFromValue(*i)); InfoMap metadataMap; (*i)->toMap(metadataMap); item->SetTextFromMap(metadataMap); @@ -458,7 +456,7 @@ void NetSearch::RunSearchEditor() { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - SearchEditor *searchedit = new SearchEditor(mainStack, "mythnetsearchedit"); + auto *searchedit = new SearchEditor(mainStack, "mythnetsearchedit"); if (searchedit->Create()) { @@ -482,7 +480,7 @@ void NetSearch::DoListRefresh() void NetSearch::SlotItemChanged() { - ResultItem *item = m_searchResultList->GetDataValue().value(); + auto *item = m_searchResultList->GetDataValue().value(); if (item && GetFocusWidget() == m_searchResultList) { @@ -545,7 +543,7 @@ void NetSearch::customEvent(QEvent *event) { if (event->type() == ThumbnailDLEvent::kEventType) { - ThumbnailDLEvent *tde = dynamic_cast(event); + auto *tde = dynamic_cast(event); if (tde == nullptr) return; diff --git a/mythplugins/mythnetvision/mythnetvision/nettree.cpp b/mythplugins/mythnetvision/mythnetvision/nettree.cpp index 1cd1dcd9277..2bf723cc8be 100644 --- a/mythplugins/mythnetvision/mythnetvision/nettree.cpp +++ b/mythplugins/mythnetvision/mythnetvision/nettree.cpp @@ -175,7 +175,7 @@ void NetTree::LoadData(void) MythGenericTree *selectedNode = m_currentNode->getSelectedChild(); - typedef QList MGTreeChildList; + using MGTreeChildList = QList; MGTreeChildList *lchildren = m_currentNode->getAllChildren(); for (MGTreeChildList::const_iterator p = lchildren->begin(); @@ -183,7 +183,7 @@ void NetTree::LoadData(void) { if (*p != nullptr) { - MythUIButtonListItem *item = + auto *item = new MythUIButtonListItem(m_siteButtonList, QString(), nullptr, true, MythUIButtonListItem::NotChecked); @@ -218,8 +218,8 @@ void NetTree::UpdateItem(MythUIButtonListItem *item) if (!node) return; - RSSSite *site = node->GetData().value(); - ResultItem *video = node->GetData().value(); + auto *site = node->GetData().value(); + auto *video = node->GetData().value(); int nodeInt = node->getInt(); @@ -398,7 +398,7 @@ void NetTree::ShowMenu(void) { QString label = tr("Playback/Download Options"); - MythMenu *menu = new MythMenu(label, this, "options"); + auto *menu = new MythMenu(label, this, "options"); ResultItem *item = nullptr; if (m_type == DLG_TREE) @@ -430,7 +430,7 @@ void NetTree::ShowMenu(void) menu->AddItem(tr("Scan/Manage Subscriptions"), nullptr, CreateShowManageMenu()); menu->AddItem(tr("Change View"), nullptr, CreateShowViewMenu()); - MythDialogBox *menuPopup = + auto *menuPopup = new MythDialogBox(menu, m_popupStack, "mythnettreemenupopup"); if (menuPopup->Create()) @@ -443,7 +443,7 @@ MythMenu* NetTree::CreateShowViewMenu() { QString label = tr("View Options"); - MythMenu *menu = new MythMenu(label, this, "options"); + auto *menu = new MythMenu(label, this, "options"); if (m_type != DLG_TREE) menu->AddItem(tr("Switch to List View"), SLOT(SwitchTreeView())); @@ -459,7 +459,7 @@ MythMenu* NetTree::CreateShowManageMenu() { QString label = tr("Subscription Management"); - MythMenu *menu = new MythMenu(label, this, "options"); + auto *menu = new MythMenu(label, this, "options"); menu->AddItem(tr("Update Site Maps"), SLOT(UpdateTrees())); menu->AddItem(tr("Update RSS"), SLOT(UpdateRSS())); @@ -499,7 +499,7 @@ void NetTree::SwitchBrowseView() void NetTree::SwitchView() { - NetTree *nettree = + auto *nettree = new NetTree(m_type, GetMythMainWindow()->GetMainStack(), "nettree"); if (nettree->Create()) @@ -519,8 +519,7 @@ void NetTree::FillTree() // First let's add all the RSS if (!m_rssList.isEmpty()) { - MythGenericTree *rssGeneric = - new MythGenericTree(RSSNode, kSubFolder, false); + auto *rssGeneric = new MythGenericTree(RSSNode, kSubFolder, false); // Add an upfolder if (m_type != DLG_TREE) @@ -534,7 +533,7 @@ void NetTree::FillTree() { ResultItem::resultList items = getRSSArticles((*i)->GetTitle(), VIDEO_PODCAST); - MythGenericTree *ret = + auto *ret = new MythGenericTree((*i)->GetTitle(), kSubFolder, false); ret->SetData(qVariantFromValue(*i)); rssGeneric->addNode(ret); @@ -563,8 +562,7 @@ void NetTree::FillTree() QList< QPair > paths = treePathsNodes.uniqueKeys(); - MythGenericTree *ret = new MythGenericTree( - (*g)->GetTitle(), kSubFolder, false); + auto *ret = new MythGenericTree((*g)->GetTitle(), kSubFolder, false); QString thumb = QString("%1mythnetvision/icons/%2").arg(GetShareDir()) .arg((*g)->GetImage()); ret->SetData(qVariantFromValue(thumb)); @@ -844,7 +842,7 @@ void NetTree::RunTreeEditor() { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - TreeEditor *treeedit = new TreeEditor(mainStack, "mythnettreeedit"); + auto *treeedit = new TreeEditor(mainStack, "mythnettreeedit"); if (treeedit->Create()) { @@ -860,7 +858,7 @@ void NetTree::RunRSSEditor() { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - RSSEditor *rssedit = new RSSEditor(mainStack, "mythnetrssedit"); + auto *rssedit = new RSSEditor(mainStack, "mythnetrssedit"); if (rssedit->Create()) { @@ -901,7 +899,7 @@ void NetTree::UpdateRSS() QString title(tr("Updating RSS. This could take a while...")); OpenBusyPopup(title); - RSSManager *rssMan = new RSSManager(); + auto *rssMan = new RSSManager(); connect(rssMan, SIGNAL(finished()), this, SLOT(DoTreeRefresh())); rssMan->startTimer(); rssMan->doUpdate(); @@ -935,7 +933,7 @@ void NetTree::customEvent(QEvent *event) { if (event->type() == ThumbnailDLEvent::kEventType) { - ThumbnailDLEvent *tde = dynamic_cast(event); + auto *tde = dynamic_cast(event); if (!tde) return; diff --git a/mythplugins/mythnetvision/mythnetvision/rsseditor.cpp b/mythplugins/mythnetvision/mythnetvision/rsseditor.cpp index d27f935144b..e48da248f28 100644 --- a/mythplugins/mythnetvision/mythnetvision/rsseditor.cpp +++ b/mythplugins/mythnetvision/mythnetvision/rsseditor.cpp @@ -276,7 +276,7 @@ void RSSEditPopup::SelectImagePopup(const QString &prefix, { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIFileBrowser *fb = new MythUIFileBrowser(popupStack, prefix); + auto *fb = new MythUIFileBrowser(popupStack, prefix); fb->SetNameFilter(GetSupportedImageExtensionFilter()); if (fb->Create()) { @@ -423,8 +423,7 @@ void RSSEditor::fillRSSButtonList() for (RSSSite::rssList::iterator i = m_siteList.begin(); i != m_siteList.end(); ++i) { - MythUIButtonListItem *item = - new MythUIButtonListItem(m_sites, (*i)->GetTitle()); + auto *item = new MythUIButtonListItem(m_sites, (*i)->GetTitle()); item->SetText((*i)->GetTitle(), "title"); item->SetText((*i)->GetDescription(), "description"); item->SetText((*i)->GetURL(), "url"); @@ -436,8 +435,7 @@ void RSSEditor::fillRSSButtonList() void RSSEditor::SlotItemChanged() { - RSSSite *site = m_sites->GetItemCurrent()->GetData().value(); - + auto *site = m_sites->GetItemCurrent()->GetData().value(); if (site) { if (m_image) @@ -473,8 +471,7 @@ void RSSEditor::SlotDeleteSite() MythScreenStack *m_popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythConfirmationDialog *confirmdialog = - new MythConfirmationDialog(m_popupStack,message); + auto *confirmdialog = new MythConfirmationDialog(m_popupStack,message); if (confirmdialog->Create()) { @@ -493,11 +490,10 @@ void RSSEditor::SlotEditSite() MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - RSSSite *site = m_sites->GetItemCurrent()->GetData().value(); - + auto *site = m_sites->GetItemCurrent()->GetData().value(); if (site) { - RSSEditPopup *rsseditpopup = + auto *rsseditpopup = new RSSEditPopup(site->GetURL(), true, mainStack, "rsseditpopup"); if (rsseditpopup->Create()) @@ -517,8 +513,7 @@ void RSSEditor::SlotNewSite() MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - RSSEditPopup *rsseditpopup = - new RSSEditPopup("", false, mainStack, "rsseditpopup"); + auto *rsseditpopup = new RSSEditPopup("", false, mainStack, "rsseditpopup"); if (rsseditpopup->Create()) { @@ -537,7 +532,7 @@ void RSSEditor::DoDeleteSite(bool remove) if (!remove) return; - RSSSite *site = m_sites->GetItemCurrent()->GetData().value(); + auto *site = m_sites->GetItemCurrent()->GetData().value(); if (removeFromDB(site)) ListChanged(); diff --git a/mythplugins/mythnews/mythnews/main.cpp b/mythplugins/mythnews/mythnews/main.cpp index 03d83ab1eea..cf64376b5d2 100644 --- a/mythplugins/mythnews/mythnews/main.cpp +++ b/mythplugins/mythnews/mythnews/main.cpp @@ -23,7 +23,7 @@ static int RunNews(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - MythNews *mythnews = new MythNews(mainStack, "mythnews"); + auto *mythnews = new MythNews(mainStack, "mythnews"); if (mythnews->Create()) { @@ -82,7 +82,7 @@ int mythplugin_config(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - MythNewsConfig *mythnewsconfig = new MythNewsConfig(mainStack, "mythnewsconfig"); + auto *mythnewsconfig = new MythNewsConfig(mainStack, "mythnewsconfig"); if (mythnewsconfig->Create()) { diff --git a/mythplugins/mythnews/mythnews/mythnews.cpp b/mythplugins/mythnews/mythnews/mythnews.cpp index da0bb760c90..f9e0f2c152b 100644 --- a/mythplugins/mythnews/mythnews/mythnews.cpp +++ b/mythplugins/mythnews/mythnews/mythnews.cpp @@ -182,11 +182,10 @@ void MythNews::loadSites(void) } std::sort(m_NewsSites.begin(), m_NewsSites.end(), NewsSite::sortByName); - NewsSite::List::iterator it = m_NewsSites.begin(); + auto it = m_NewsSites.begin(); for (; it != m_NewsSites.end(); ++it) { - MythUIButtonListItem *item = - new MythUIButtonListItem(m_sitesList, (*it)->name()); + auto *item = new MythUIButtonListItem(m_sitesList, (*it)->name()); item->SetData(qVariantFromValue(*it)); connect(*it, SIGNAL(finished(NewsSite*)), @@ -456,7 +455,7 @@ void MythNews::slotRetrieveNews(void) m_RetrieveTimer->stop(); - NewsSite::List::iterator it = m_NewsSites.begin(); + auto it = m_NewsSites.begin(); for (; it != m_NewsSites.end(); ++it) { if ((*it)->timeSinceLastUpdate() > m_UpdateFreq) @@ -493,7 +492,7 @@ void MythNews::cancelRetrieve(void) { QMutexLocker locker(&m_lock); - NewsSite::List::iterator it = m_NewsSites.begin(); + auto it = m_NewsSites.begin(); for (; it != m_NewsSites.end(); ++it) { (*it)->stop(); @@ -524,10 +523,10 @@ void MythNews::processAndShowNews(NewsSite *site) m_articles.clear(); NewsArticle::List articles = site->GetArticleList(); - NewsArticle::List::iterator it = articles.begin(); + auto it = articles.begin(); for (; it != articles.end(); ++it) { - MythUIButtonListItem *item = + auto *item = new MythUIButtonListItem(m_articlesList, (*it).title()); m_articles[item] = *it; } @@ -543,7 +542,7 @@ void MythNews::slotSiteSelected(MythUIButtonListItem *item) if (!item || item->GetData().isNull()) return; - NewsSite *site = item->GetData().value(); + auto *site = item->GetData().value(); if (!site) return; @@ -551,11 +550,10 @@ void MythNews::slotSiteSelected(MythUIButtonListItem *item) m_articles.clear(); NewsArticle::List articles = site->GetArticleList(); - NewsArticle::List::iterator it = articles.begin(); + auto it = articles.begin(); for (; it != articles.end(); ++it) { - MythUIButtonListItem *blitem = - new MythUIButtonListItem(m_articlesList, (*it).title()); + auto *blitem = new MythUIButtonListItem(m_articlesList, (*it).title()); m_articles[blitem] = *it; } @@ -628,8 +626,8 @@ void MythNews::ShowEditDialog(bool edit) MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - MythNewsEditor *mythnewseditor = new MythNewsEditor(site, edit, mainStack, - "mythnewseditor"); + auto *mythnewseditor = new MythNewsEditor(site, edit, mainStack, + "mythnewseditor"); if (mythnewseditor->Create()) { @@ -644,8 +642,7 @@ void MythNews::ShowFeedManager() { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - MythNewsConfig *mythnewsconfig = new MythNewsConfig(mainStack, - "mythnewsconfig"); + auto *mythnewsconfig = new MythNewsConfig(mainStack, "mythnewsconfig"); if (mythnewsconfig->Create()) { @@ -696,7 +693,7 @@ void MythNews::deleteNewsSite(void) if (siteUIItem && !siteUIItem->GetData().isNull()) { - NewsSite *site = siteUIItem->GetData().value(); + auto *site = siteUIItem->GetData().value(); if (site) { removeFromDB(site->name()); diff --git a/mythplugins/mythnews/mythnews/mythnewsconfig.cpp b/mythplugins/mythnews/mythnews/mythnewsconfig.cpp index 059bc01dd32..74b57e7df8d 100644 --- a/mythplugins/mythnews/mythnews/mythnewsconfig.cpp +++ b/mythplugins/mythnews/mythnews/mythnewsconfig.cpp @@ -151,11 +151,10 @@ void MythNewsConfig::loadData(void) { QMutexLocker locker(&m_lock); - NewsCategory::List::iterator it = m_priv->m_categoryList.begin(); + auto it = m_priv->m_categoryList.begin(); for (; it != m_priv->m_categoryList.end(); ++it) { - MythUIButtonListItem *item = - new MythUIButtonListItem(m_categoriesList, (*it).m_name); + auto *item = new MythUIButtonListItem(m_categoriesList, (*it).m_name); item->SetData(qVariantFromValue(&(*it))); if (!(*it).m_siteList.empty()) item->setDrawArrow(true); @@ -170,7 +169,7 @@ void MythNewsConfig::toggleItem(MythUIButtonListItem *item) if (!item ) return; - NewsSiteItem *site = item->GetData().value(); + auto *site = item->GetData().value(); if (!site) return; @@ -203,14 +202,14 @@ void MythNewsConfig::slotCategoryChanged(MythUIButtonListItem *item) m_siteList->Reset(); - NewsCategory *cat = item->GetData().value(); + auto *cat = item->GetData().value(); if (!cat) return; - NewsSiteItem::List::iterator it = cat->m_siteList.begin(); + auto it = cat->m_siteList.begin(); for (; it != cat->m_siteList.end(); ++it) { - MythUIButtonListItem *newitem = + auto *newitem = new MythUIButtonListItem(m_siteList, (*it).m_name, nullptr, true, (*it).m_inDB ? MythUIButtonListItem::FullChecked : diff --git a/mythplugins/mythnews/mythnews/newsarticle.h b/mythplugins/mythnews/mythnews/newsarticle.h index 68f2695c55d..2c7cdd358d9 100644 --- a/mythplugins/mythnews/mythnews/newsarticle.h +++ b/mythplugins/mythnews/mythnews/newsarticle.h @@ -11,7 +11,7 @@ using namespace std; class NewsArticle { public: - typedef vector List; + using List = vector; NewsArticle(QString title, QString desc, QString articleURL, QString thumbnail, QString mediaURL, QString enclosure); diff --git a/mythplugins/mythnews/mythnews/newssite.cpp b/mythplugins/mythnews/mythnews/newssite.cpp index c906dbf36f1..b4adb743de6 100644 --- a/mythplugins/mythnews/mythnews/newssite.cpp +++ b/mythplugins/mythnews/mythnews/newssite.cpp @@ -156,7 +156,7 @@ void NewsSite::customEvent(QEvent *event) { if (event->type() == MythEvent::MythEventMessage) { - MythEvent *me = dynamic_cast(event); + auto *me = dynamic_cast(event); if (me == nullptr) return; QStringList tokens = me->Message().split(" ", QString::SkipEmptyParts); diff --git a/mythplugins/mythnews/mythnews/newssite.h b/mythplugins/mythnews/mythnews/newssite.h index ddb46eea11c..ec138956b57 100644 --- a/mythplugins/mythnews/mythnews/newssite.h +++ b/mythplugins/mythnews/mythnews/newssite.h @@ -25,7 +25,7 @@ using namespace std; class NewsSiteItem { public: - typedef vector List; + using List = vector; QString m_name; QString m_category; @@ -39,7 +39,7 @@ Q_DECLARE_METATYPE(NewsSiteItem*) class NewsCategory { public: - typedef vector List; + using List = vector; QString m_name; NewsSiteItem::List m_siteList; diff --git a/mythplugins/mythweather/mythweather/main.cpp b/mythplugins/mythweather/mythweather/main.cpp index c342985f8ea..8b67f3c0f73 100644 --- a/mythplugins/mythweather/mythweather/main.cpp +++ b/mythplugins/mythweather/mythweather/main.cpp @@ -23,7 +23,7 @@ static int RunWeather() { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - Weather *weather = new Weather(mainStack, "mythweather", srcMan); + auto *weather = new Weather(mainStack, "mythweather", srcMan); if (weather->Create()) { @@ -91,7 +91,7 @@ static void WeatherCallback(void *data, QString &selection) if (selection == "SETTINGS_GENERAL") { - GlobalSetup *gsetup = new GlobalSetup(mainStack, "weatherglobalsetup"); + auto *gsetup = new GlobalSetup(mainStack, "weatherglobalsetup"); if (gsetup->Create()) mainStack->AddScreen(gsetup); @@ -100,7 +100,7 @@ static void WeatherCallback(void *data, QString &selection) } else if (selection == "SETTINGS_SCREEN") { - ScreenSetup *ssetup = new ScreenSetup(mainStack, "weatherscreensetup", srcMan); + auto *ssetup = new ScreenSetup(mainStack, "weatherscreensetup", srcMan); if (ssetup->Create()) mainStack->AddScreen(ssetup); @@ -109,7 +109,7 @@ static void WeatherCallback(void *data, QString &selection) } else if (selection == "SETTINGS_SOURCE") { - SourceSetup *srcsetup = new SourceSetup(mainStack, "weathersourcesetup"); + auto *srcsetup = new SourceSetup(mainStack, "weathersourcesetup"); if (srcsetup->Create()) mainStack->AddScreen(srcsetup); @@ -123,9 +123,9 @@ int mythplugin_config() QString menuname = "weather_settings.xml"; QString themedir = GetMythUI()->GetThemeDir(); - MythThemedMenu *menu = new MythThemedMenu( - themedir, menuname, - GetMythMainWindow()->GetMainStack(), "weather menu"); + auto *menu = new MythThemedMenu(themedir, menuname, + GetMythMainWindow()->GetMainStack(), + "weather menu"); menu->setCallback(WeatherCallback, nullptr); menu->setKillable(); diff --git a/mythplugins/mythweather/mythweather/sourceManager.cpp b/mythplugins/mythweather/mythweather/sourceManager.cpp index 2743e4047e2..2004d9af593 100644 --- a/mythplugins/mythweather/mythweather/sourceManager.cpp +++ b/mythplugins/mythweather/mythweather/sourceManager.cpp @@ -61,7 +61,7 @@ bool SourceManager::findScriptsDB() // findScripts() -- run when entering setup continue; } - ScriptInfo *si = new ScriptInfo; + auto *si = new ScriptInfo; si->id = db.value(0).toInt(); si->name = db.value(1).toString(); si->updateTimeout = db.value(2).toUInt() * 1000; @@ -95,8 +95,8 @@ bool SourceManager::findScripts() if (popupStack == nullptr) popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIBusyDialog *busyPopup = new MythUIBusyDialog(busymessage, popupStack, - "mythweatherbusydialog"); + auto *busyPopup = new MythUIBusyDialog(busymessage, popupStack, + "mythweatherbusydialog"); if (busyPopup->Create()) { @@ -217,7 +217,7 @@ QStringList SourceManager::getLocationList(ScriptInfo *si, const QString &str) { if (!m_scripts.contains(si)) return QStringList(); - WeatherSource *ws = new WeatherSource(si); + auto *ws = new WeatherSource(si); QStringList locationList(ws->getLocationList(str)); @@ -246,7 +246,7 @@ WeatherSource *SourceManager::needSourceFor(int id, const QString &loc, ScriptInfo *si = m_scripts.at(x); if (si->id == id) { - WeatherSource *ws = new WeatherSource(si); + auto *ws = new WeatherSource(si); ws->setLocale(loc); ws->setUnits(units); m_sources.append(ws); diff --git a/mythplugins/mythweather/mythweather/sourceManager.h b/mythplugins/mythweather/mythweather/sourceManager.h index 0b1a10f6ea1..b6307019d44 100644 --- a/mythplugins/mythweather/mythweather/sourceManager.h +++ b/mythplugins/mythweather/mythweather/sourceManager.h @@ -13,7 +13,7 @@ class WeatherScreen; class ScriptInfo; -typedef QMultiMap SourceMap; +using SourceMap = QMultiMap; class SourceManager : public QObject { diff --git a/mythplugins/mythweather/mythweather/weather.cpp b/mythplugins/mythweather/mythweather/weather.cpp index fd63b46fa7e..ce8123d83a6 100644 --- a/mythplugins/mythweather/mythweather/weather.cpp +++ b/mythplugins/mythweather/mythweather/weather.cpp @@ -142,8 +142,8 @@ bool Weather::SetupScreens() // If no screens exist, run the setup MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ScreenSetup *ssetup = new ScreenSetup(mainStack, "weatherscreensetup", - m_srcMan); + auto *ssetup = new ScreenSetup(mainStack, "weatherscreensetup", + m_srcMan); connect(ssetup, SIGNAL(Exiting()), this, SLOT(setupScreens())); @@ -326,8 +326,7 @@ void Weather::setupPage() MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ScreenSetup *ssetup = new ScreenSetup(mainStack, "weatherscreensetup", - m_srcMan); + auto *ssetup = new ScreenSetup(mainStack, "weatherscreensetup", m_srcMan); connect(ssetup, SIGNAL(Exiting()), this, SLOT(setupScreens())); diff --git a/mythplugins/mythweather/mythweather/weather.h b/mythplugins/mythweather/mythweather/weather.h index 8c1efbacfc5..6771305c33d 100644 --- a/mythplugins/mythweather/mythweather/weather.h +++ b/mythplugins/mythweather/mythweather/weather.h @@ -15,7 +15,7 @@ class SourceManager; class WeatherScreen; -typedef QList ScreenList; +using ScreenList = QList; class Weather : public MythScreenType { diff --git a/mythplugins/mythweather/mythweather/weatherScreen.cpp b/mythplugins/mythweather/mythweather/weatherScreen.cpp index 705b5237a2c..ef093140352 100644 --- a/mythplugins/mythweather/mythweather/weatherScreen.cpp +++ b/mythplugins/mythweather/mythweather/weatherScreen.cpp @@ -152,7 +152,7 @@ void WeatherScreen::prepareWidget(MythUIType *widget) * Basically so we don't do it twice since some screens (Static Map) mess * with image dimensions */ - MythUIImage *img = dynamic_cast(widget); + auto *img = dynamic_cast(widget); if (img != nullptr) { img->Load(); diff --git a/mythplugins/mythweather/mythweather/weatherSetup.cpp b/mythplugins/mythweather/mythweather/weatherSetup.cpp index 2ff80c5adf1..18b7a621faa 100644 --- a/mythplugins/mythweather/mythweather/weatherSetup.cpp +++ b/mythplugins/mythweather/mythweather/weatherSetup.cpp @@ -198,7 +198,7 @@ void ScreenSetup::updateHelpText() if (!item) return; - ScreenListInfo *si = item->GetData().value(); + auto *si = item->GetData().value(); if (!si) return; @@ -216,7 +216,7 @@ void ScreenSetup::updateHelpText() if (!item) return; - ScreenListInfo *si = item->GetData().value(); + auto *si = item->GetData().value(); if (!si) return; @@ -281,8 +281,7 @@ void ScreenSetup::loadData() ScriptInfo *script = scriptList.at(x); si->m_sources.append(script->name); } - MythUIButtonListItem *item = - new MythUIButtonListItem(m_inactiveList, si->m_title); + auto *item = new MythUIButtonListItem(m_inactiveList, si->m_title); item->SetData(qVariantFromValue(new ScreenListInfo(*si))); } @@ -325,14 +324,12 @@ void ScreenSetup::loadData() if (active_screens.find(draworder) == active_screens.end()) { - ScreenListInfo *si = new ScreenListInfo(screenListMap[name]); + auto *si = new ScreenListInfo(screenListMap[name]); // Clear types first as we will re-insert the values from the database si->m_types.clear(); si->m_units = units; - MythUIButtonListItem *item = - new MythUIButtonListItem(m_activeList, si->m_title); - + auto *item = new MythUIButtonListItem(m_activeList, si->m_title); // Only insert types meant for this screen for (QStringList::Iterator type_i = types.begin(); @@ -368,7 +365,7 @@ void ScreenSetup::saveData() for (int i=0; i < m_activeList->GetCount(); i++) { MythUIButtonListItem *item = m_activeList->GetItemAt(i); - ScreenListInfo *si = item->GetData().value(); + auto *si = item->GetData().value(); TypeListMap::iterator it = si->m_types.begin(); for (; it != si->m_types.end(); ++it) { @@ -403,7 +400,7 @@ void ScreenSetup::saveData() for (int i=0; i < m_activeList->GetCount(); i++) { MythUIButtonListItem *item = m_activeList->GetItemAt(i); - ScreenListInfo *si = item->GetData().value(); + auto *si = item->GetData().value(); db.bindValue(":DRAW", draworder); db.bindValue(":CONT", si->m_name); db.bindValue(":UNITS", si->m_units); @@ -465,15 +462,15 @@ void ScreenSetup::doListSelect(MythUIButtonListItem *selected) QString txt = selected->GetText(); if (GetFocusWidget() == m_activeList) { - ScreenListInfo *si = selected->GetData().value(); + auto *si = selected->GetData().value(); QString label = tr("Manipulate Screen"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(label, popupStack, - "screensetupmenupopup"); + auto *menuPopup = new MythDialogBox(label, popupStack, + "screensetupmenupopup"); if (menuPopup->Create()) { @@ -497,7 +494,7 @@ void ScreenSetup::doListSelect(MythUIButtonListItem *selected) } else if (GetFocusWidget() == m_inactiveList) { - ScreenListInfo *si = selected->GetData().value(); + auto *si = selected->GetData().value(); QStringList type_strs; TypeListMap::iterator it = si->m_types.begin(); @@ -533,8 +530,8 @@ void ScreenSetup::doLocationDialog(ScreenListInfo *si) MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - LocationDialog *locdialog = new LocationDialog(mainStack, "locationdialog", - this, si, m_sourceManager); + auto *locdialog = new LocationDialog(mainStack, "locationdialog", + this, si, m_sourceManager); if (locdialog->Create()) mainStack->AddScreen(locdialog); @@ -551,8 +548,7 @@ void ScreenSetup::showUnitsPopup(const QString &name, ScreenListInfo *si) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(label, popupStack, - "weatherunitspopup"); + auto *menuPopup = new MythDialogBox(label, popupStack, "weatherunitspopup"); if (menuPopup->Create()) { @@ -602,10 +598,8 @@ void ScreenSetup::customEvent(QEvent *event) { if (buttonnum > -1) { - MythUIButtonListItem *item = - dce->GetData().value(); - - ScreenListInfo *si = item->GetData().value(); + auto *item = dce->GetData().value(); + auto *si = item->GetData().value(); if (buttonnum == 0) { @@ -636,7 +630,7 @@ void ScreenSetup::customEvent(QEvent *event) { if (buttonnum > -1) { - ScreenListInfo *si = dce->GetData().value(); + auto *si = dce->GetData().value(); if (buttonnum == 0) { @@ -657,7 +651,7 @@ void ScreenSetup::customEvent(QEvent *event) } else if (resultid == "location") { - ScreenListInfo *si = dce->GetData().value(); + auto *si = dce->GetData().value(); TypeListMap::iterator it = si->m_types.begin(); for (; it != si->m_types.end(); ++it) @@ -675,8 +669,7 @@ void ScreenSetup::customEvent(QEvent *event) } else { - MythUIButtonListItem *item = - new MythUIButtonListItem(m_activeList, si->m_title); + auto *item = new MythUIButtonListItem(m_activeList, si->m_title); item->SetData(qVariantFromValue(si)); } @@ -778,7 +771,7 @@ bool SourceSetup::loadData() while (db.next()) { - SourceListInfo *si = new SourceListInfo; + auto *si = new SourceListInfo; si->id = db.value(0).toUInt(); si->name = db.value(1).toString(); si->update_timeout = db.value(2).toUInt() / 60; @@ -799,7 +792,7 @@ void SourceSetup::saveData() if (curritem) { - SourceListInfo *si = curritem->GetData().value(); + auto *si = curritem->GetData().value(); si->update_timeout = m_updateSpinbox->GetIntValue(); si->retrieve_timeout = m_retrieveSpinbox->GetIntValue(); } @@ -813,7 +806,7 @@ void SourceSetup::saveData() for (int i=0; i < m_sourceList->GetCount(); i++) { MythUIButtonListItem *item = m_sourceList->GetItemAt(i); - SourceListInfo *si = item->GetData().value(); + auto *si = item->GetData().value(); db.bindValue(":ID", si->id); db.bindValue(":UPDATE", si->update_timeout * 60); db.bindValue(":RETRIEVE", si->retrieve_timeout); @@ -831,7 +824,7 @@ void SourceSetup::updateSpinboxUpdate() { if (m_sourceList->GetItemCurrent()) { - SourceListInfo *si = m_sourceList->GetItemCurrent()->GetData().value(); + auto *si = m_sourceList->GetItemCurrent()->GetData().value(); si->update_timeout = m_updateSpinbox->GetIntValue(); } } @@ -840,7 +833,7 @@ void SourceSetup::retrieveSpinboxUpdate() { if (m_sourceList->GetItemCurrent()) { - SourceListInfo *si = m_sourceList->GetItemCurrent()->GetData().value(); + auto *si = m_sourceList->GetItemCurrent()->GetData().value(); si->retrieve_timeout = m_retrieveSpinbox->GetIntValue(); } } @@ -853,7 +846,7 @@ void SourceSetup::sourceListItemSelected(MythUIButtonListItem *item) if (!item) return; - SourceListInfo *si = item->GetData().value(); + auto *si = item->GetData().value(); if (!si) return; @@ -930,8 +923,8 @@ void LocationDialog::doSearch() MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIBusyDialog *busyPopup = new MythUIBusyDialog(busymessage, popupStack, - "mythweatherbusydialog"); + auto *busyPopup = new MythUIBusyDialog(busymessage, popupStack, + "mythweatherbusydialog"); if (busyPopup->Create()) { @@ -989,9 +982,8 @@ void LocationDialog::doSearch() continue; } QString resultstring = QString("%1 (%2)").arg(tmp[1]).arg(name); - MythUIButtonListItem *item = - new MythUIButtonListItem(m_locationList, resultstring); - ResultListInfo *ri = new ResultListInfo; + auto *item = new MythUIButtonListItem(m_locationList, resultstring); + auto *ri = new ResultListInfo; ri->idstr = tmp[0]; ri->src = si; item->SetData(qVariantFromValue(ri)); @@ -1024,15 +1016,14 @@ void LocationDialog::clearResults() void LocationDialog::itemSelected(MythUIButtonListItem *item) { - ResultListInfo *ri = item->GetData().value(); + auto *ri = item->GetData().value(); if (ri) m_sourceText->SetText(tr("Source: %1").arg(ri->src->name)); } void LocationDialog::itemClicked(MythUIButtonListItem *item) { - ResultListInfo *ri = item->GetData().value(); - + auto *ri = item->GetData().value(); if (ri) { TypeListMap::iterator it = m_screenListInfo->m_types.begin(); @@ -1043,9 +1034,8 @@ void LocationDialog::itemClicked(MythUIButtonListItem *item) } } - DialogCompletionEvent *dce = - new DialogCompletionEvent("location", 0, "", - qVariantFromValue(new ScreenListInfo(*m_screenListInfo))); + auto *dce = new DialogCompletionEvent("location", 0, "", + qVariantFromValue(new ScreenListInfo(*m_screenListInfo))); QApplication::postEvent(m_retScreen, dce); Close(); diff --git a/mythplugins/mythweather/mythweather/weatherSetup.h b/mythplugins/mythweather/mythweather/weatherSetup.h index 2bdc0786c80..6271a1aabe9 100644 --- a/mythplugins/mythweather/mythweather/weatherSetup.h +++ b/mythplugins/mythweather/mythweather/weatherSetup.h @@ -130,7 +130,7 @@ struct ResultListInfo Q_DECLARE_METATYPE(ResultListInfo *) -typedef QMultiHash > CacheMap; +using CacheMap = QMultiHash >; class LocationDialog : public MythScreenType { diff --git a/mythplugins/mythweather/mythweather/weatherUtils.h b/mythplugins/mythweather/mythweather/weatherUtils.h index 99d7ffa29af..1e7d97bc778 100644 --- a/mythplugins/mythweather/mythweather/weatherUtils.h +++ b/mythplugins/mythweather/mythweather/weatherUtils.h @@ -19,8 +19,8 @@ class ScriptInfo; -typedef unsigned char units_t; -typedef QMap DataMap; +using units_t = unsigned char; +using DataMap = QMap; class TypeListInfo { @@ -41,7 +41,7 @@ class TypeListInfo QString m_location; ScriptInfo *m_src {nullptr}; }; -typedef QMultiHash TypeListMap; +using TypeListMap = QMultiHash; class ScreenListInfo { @@ -76,7 +76,7 @@ class ScreenListInfo Q_DECLARE_METATYPE(ScreenListInfo *); -typedef QMap ScreenListMap; +using ScreenListMap = QMap; ScreenListMap loadScreens(); QStringList loadScreen(const QDomElement& ScreenListInfo); diff --git a/mythplugins/mythzoneminder/mythzmserver/main.cpp b/mythplugins/mythzoneminder/mythzmserver/main.cpp index 40feffa57ac..de8e4bff1b1 100644 --- a/mythplugins/mythzoneminder/mythzmserver/main.cpp +++ b/mythplugins/mythzoneminder/mythzmserver/main.cpp @@ -351,7 +351,7 @@ int main(int argc, char **argv) } // create new ZMServer and add to map - ZMServer *server = new ZMServer(newfd, debug); + auto *server = new ZMServer(newfd, debug); serverList[newfd] = server; printf("new connection from %s on socket %d\n", @@ -396,7 +396,7 @@ int main(int argc, char **argv) } // cleanly remove all the ZMServer's - for (std::map::iterator it = serverList.begin(); + for (auto it = serverList.begin(); it != serverList.end(); ++it) { delete it->second; diff --git a/mythplugins/mythzoneminder/mythzmserver/zmserver.cpp b/mythplugins/mythzoneminder/mythzmserver/zmserver.cpp index f80d1ad79b9..dbc03f025b1 100644 --- a/mythplugins/mythzoneminder/mythzmserver/zmserver.cpp +++ b/mythplugins/mythzoneminder/mythzmserver/zmserver.cpp @@ -1626,7 +1626,7 @@ void ZMServer::handleDeleteEventList(vector tokens) string eventList; string outStr; - vector::iterator it = tokens.begin(); + auto it = tokens.begin(); if (it != tokens.end()) ++it; while (it != tokens.end()) @@ -1705,7 +1705,7 @@ void ZMServer::getMonitorList(void) MYSQL_ROW row = mysql_fetch_row(res); if (row) { - MONITOR *m = new MONITOR; + auto *m = new MONITOR; m->m_mon_id = atoi(row[0]); m->m_name = row[1]; m->m_width = atoi(row[2]); diff --git a/mythplugins/mythzoneminder/mythzmserver/zmserver.h b/mythplugins/mythzoneminder/mythzmserver/zmserver.h index 02d49c816e0..28ca0c4a8f2 100644 --- a/mythplugins/mythzoneminder/mythzmserver/zmserver.h +++ b/mythplugins/mythzoneminder/mythzmserver/zmserver.h @@ -59,17 +59,17 @@ const string RESTART = "restart"; const string RELOAD = "reload"; const string RUNNING = "running"; -typedef enum +enum State { IDLE, PREALARM, ALARM, ALERT, TAPE -} State; +}; // shared data for ZM version 1.24.x and 1.25.x -typedef struct +struct SharedData { int size; bool valid; @@ -89,10 +89,10 @@ typedef struct int alarm_x; int alarm_y; char control_state[256]; -} SharedData; +}; // shared data for ZM version 1.26.x -typedef struct +struct SharedData26 { uint32_t size; uint32_t last_write_index; @@ -122,10 +122,10 @@ typedef struct uint64_t extrapad2; }; uint8_t control_state[256]; -} SharedData26; +}; // shared data for ZM version 1.32.x -typedef struct +struct SharedData32 { uint32_t size; uint32_t last_write_index; @@ -160,12 +160,12 @@ typedef struct uint8_t control_state[256]; char alarm_cause[256]; -} SharedData32; +}; -typedef enum { TRIGGER_CANCEL, TRIGGER_ON, TRIGGER_OFF } TriggerState; +enum TriggerState { TRIGGER_CANCEL, TRIGGER_ON, TRIGGER_OFF }; // Triggerdata for ZM version 1.24.x and 1.25.x -typedef struct +struct TriggerData { int size; TriggerState trigger_state; @@ -173,10 +173,10 @@ typedef struct char trigger_cause[32]; char trigger_text[256]; char trigger_showtext[256]; -} TriggerData; +}; // Triggerdata for ZM version 1.26.x and 1.32.x -typedef struct +struct TriggerData26 { uint32_t size; uint32_t trigger_state; @@ -185,16 +185,16 @@ typedef struct char trigger_cause[32]; char trigger_text[256]; char trigger_showtext[256]; -} TriggerData26; +}; // VideoStoreData for ZM version 1.32.x -typedef struct +struct VideoStoreData { uint32_t size; uint64_t current_event; char event_file[4096]; timeval recording; -} VideoStoreData; +}; class MONITOR { diff --git a/mythplugins/mythzoneminder/mythzoneminder/main.cpp b/mythplugins/mythzoneminder/mythzoneminder/main.cpp index 23fb7d4ecb9..a8d5f87a82e 100644 --- a/mythplugins/mythzoneminder/mythzoneminder/main.cpp +++ b/mythplugins/mythzoneminder/mythzoneminder/main.cpp @@ -53,7 +53,7 @@ static void runZMConsole(void) MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ZMConsole *console = new ZMConsole(mainStack); + auto *console = new ZMConsole(mainStack); if (console->Create()) mainStack->AddScreen(console); @@ -67,7 +67,7 @@ static void runZMLiveView(void) MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ZMLivePlayer *player = new ZMLivePlayer(mainStack); + auto *player = new ZMLivePlayer(mainStack); if (player->Create()) mainStack->AddScreen(player); @@ -80,7 +80,7 @@ static void runZMEventView(void) MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ZMEvents *events = new ZMEvents(mainStack); + auto *events = new ZMEvents(mainStack); if (events->Create()) mainStack->AddScreen(events); @@ -96,7 +96,7 @@ static void runZMMiniPlayer(void) MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ZMMiniPlayer *miniPlayer = new ZMMiniPlayer(mainStack); + auto *miniPlayer = new ZMMiniPlayer(mainStack); if (miniPlayer->Create()) mainStack->AddScreen(miniPlayer); @@ -145,7 +145,7 @@ static int runMenu(const QString& which_menu) parentObject = parentObject->parent(); } - MythThemedMenu *diag = new MythThemedMenu( + auto *diag = new MythThemedMenu( themedir, which_menu, GetMythMainWindow()->GetMainStack(), "zoneminder menu"); @@ -211,9 +211,8 @@ int mythplugin_run(void) int mythplugin_config(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StandardSettingDialog *ssd = - new StandardSettingDialog(mainStack, "zonemindersettings", - new ZMSettings()); + auto *ssd = new StandardSettingDialog(mainStack, "zonemindersettings", + new ZMSettings()); if (ssd->Create()) mainStack->AddScreen(ssd); diff --git a/mythplugins/mythzoneminder/mythzoneminder/zmclient.cpp b/mythplugins/mythzoneminder/mythzoneminder/zmclient.cpp index 2d6cb06867a..3f145033ca0 100644 --- a/mythplugins/mythzoneminder/mythzoneminder/zmclient.cpp +++ b/mythplugins/mythzoneminder/mythzoneminder/zmclient.cpp @@ -375,7 +375,7 @@ bool ZMClient::updateAlarmStates(void) for (int x = 0; x < monitorCount; x++) { int monID = strList[x * 2 + 2].toInt(); - State state = (State)strList[x * 2 + 3].toInt(); + auto state = (State)strList[x * 2 + 3].toInt(); if (m_monitorMap.contains(monID)) { @@ -536,7 +536,7 @@ void ZMClient::getFrameList(int eventID, vector *frameList) it++; it++; for (int x = 0; x < frameCount; x++) { - Frame *item = new Frame; + auto *item = new Frame; item->type = *it++; item->delta = (*it++).toDouble(); frameList->push_back(item); @@ -667,7 +667,7 @@ void ZMClient::getEventFrame(Event *event, int frameNo, MythImage **image) int imageSize = strList[1].toInt(); // grab the image data - unsigned char *data = new unsigned char[imageSize]; + auto *data = new unsigned char[imageSize]; if (!readData(data, imageSize)) { LOG(VB_GENERAL, LOG_ERR, @@ -715,7 +715,7 @@ void ZMClient::getAnalyseFrame(Event *event, int frameNo, QImage &image) int imageSize = strList[1].toInt(); // grab the image data - unsigned char *data = new unsigned char[imageSize]; + auto *data = new unsigned char[imageSize]; if (!readData(data, imageSize)) { LOG(VB_GENERAL, LOG_ERR, @@ -908,7 +908,7 @@ void ZMClient::doGetMonitorList(void) for (int x = 0; x < monitorCount; x++) { - Monitor *item = new Monitor; + auto *item = new Monitor; item->id = strList[x * 5 + 2].toInt(); item->name = strList[x * 5 + 3]; item->width = strList[x * 5 + 4].toInt(); @@ -965,7 +965,7 @@ void ZMClient::customEvent (QEvent* event) { if (event->type() == MythEvent::MythEventMessage) { - MythEvent *me = dynamic_cast(event); + auto *me = dynamic_cast(event); if (!me) return; @@ -991,7 +991,7 @@ void ZMClient::showMiniPlayer(int monitorID) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - ZMMiniPlayer *miniPlayer = new ZMMiniPlayer(popupStack); + auto *miniPlayer = new ZMMiniPlayer(popupStack); miniPlayer->setAlarmMonitor(monitorID); diff --git a/mythplugins/mythzoneminder/mythzoneminder/zmconsole.cpp b/mythplugins/mythzoneminder/mythzoneminder/zmconsole.cpp index 10cdf390f76..55aeae0e47a 100644 --- a/mythplugins/mythzoneminder/mythzoneminder/zmconsole.cpp +++ b/mythplugins/mythzoneminder/mythzoneminder/zmconsole.cpp @@ -241,7 +241,7 @@ bool ZMConsole::keyPressEvent(QKeyEvent *event) void ZMConsole::showEditFunctionPopup() { - Monitor *currentMonitor = m_monitor_list->GetItemCurrent()->GetData().value(); + auto *currentMonitor = m_monitor_list->GetItemCurrent()->GetData().value(); if (!currentMonitor) return; @@ -268,7 +268,7 @@ void ZMConsole::updateMonitorList() if (monitor) { - MythUIButtonListItem *item = new MythUIButtonListItem(m_monitor_list, + auto *item = new MythUIButtonListItem(m_monitor_list, "", nullptr, true, MythUIButtonListItem::NotChecked); item->SetData(qVariantFromValue(monitor)); item->SetText(monitor->name, "name"); diff --git a/mythplugins/mythzoneminder/mythzoneminder/zmdefines.h b/mythplugins/mythzoneminder/mythzoneminder/zmdefines.h index bd9d0ed4d9e..e72b78b7a8a 100644 --- a/mythplugins/mythzoneminder/mythzoneminder/zmdefines.h +++ b/mythplugins/mythzoneminder/mythzoneminder/zmdefines.h @@ -79,21 +79,21 @@ class Event QDateTime m_startTime; }; -typedef enum +enum State { IDLE, PREALARM, ALARM, ALERT, TAPE -} State; +}; // event frame details -typedef struct +struct Frame { QString type; double delta; -} Frame; +}; class Monitor { diff --git a/mythplugins/mythzoneminder/mythzoneminder/zmevents.cpp b/mythplugins/mythzoneminder/mythzoneminder/zmevents.cpp index 626dd86e595..2e8610f8d14 100644 --- a/mythplugins/mythzoneminder/mythzoneminder/zmevents.cpp +++ b/mythplugins/mythzoneminder/mythzoneminder/zmevents.cpp @@ -185,7 +185,8 @@ void ZMEvents::updateUIList() { Event *event = m_eventList->at(i); - MythUIButtonListItem *item = new MythUIButtonListItem(m_eventGrid, "", qVariantFromValue(event)); + auto *item = new MythUIButtonListItem(m_eventGrid, "", + qVariantFromValue(event)); item->SetText(event->eventName()); item->SetText(event->monitorName(), "camera" ); @@ -242,7 +243,7 @@ void ZMEvents::eventVisible(MythUIButtonListItem *item) if (item->HasImage()) return; - Event *event = item->GetData().value(); + auto *event = item->GetData().value(); if (event) { @@ -273,8 +274,8 @@ void ZMEvents::playPressed(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ZMPlayer *player = new ZMPlayer(mainStack, "ZMPlayer", - m_eventList, &m_savedPosition); + auto *player = new ZMPlayer(mainStack, "ZMPlayer", + m_eventList, &m_savedPosition); connect(player, SIGNAL(Exiting()), this, SLOT(playerExited())); @@ -461,8 +462,7 @@ void ZMEvents::deleteAll(void) QString title = tr("Delete All Events?"); QString msg = tr("Deleting %1 events in this view.").arg(m_eventGrid->GetCount()); - MythConfirmationDialog *dialog = new MythConfirmationDialog( - popupStack, title + '\n' + msg, true); + auto *dialog = new MythConfirmationDialog(popupStack, title + '\n' + msg, true); if (dialog->Create()) popupStack->AddScreen(dialog); diff --git a/mythplugins/mythzoneminder/mythzoneminder/zmliveplayer.cpp b/mythplugins/mythzoneminder/mythzoneminder/zmliveplayer.cpp index 04aac4ac46e..9aa15e22200 100644 --- a/mythplugins/mythzoneminder/mythzoneminder/zmliveplayer.cpp +++ b/mythplugins/mythzoneminder/mythzoneminder/zmliveplayer.cpp @@ -167,7 +167,7 @@ ZMLivePlayer::~ZMLivePlayer() if (m_players) { QString s = ""; - vector::iterator i = m_players->begin(); + auto i = m_players->begin(); for (; i != m_players->end(); ++i) { Player *p = *i; @@ -240,7 +240,7 @@ void ZMLivePlayer::ShowMenu() { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox("Menu", popupStack, "mainmenu"); + auto *menuPopup = new MythDialogBox("Menu", popupStack, "mainmenu"); if (menuPopup->Create()) popupStack->AddScreen(menuPopup); @@ -448,7 +448,7 @@ void ZMLivePlayer::setMonitorLayout(int layout, bool restore) MythUIText *cameraText = dynamic_cast (GetChild(QString("name%1-%2").arg(layout).arg(x))); MythUIText *statusText = dynamic_cast (GetChild(QString("status%1-%2").arg(layout).arg(x))); - Player *p = new Player(); + auto *p = new Player(); p->setMonitor(monitor); p->setWidgets(frameImage, statusText, cameraText); p->updateCamera(); diff --git a/mythplugins/mythzoneminder/mythzoneminder/zmminiplayer.cpp b/mythplugins/mythzoneminder/mythzoneminder/zmminiplayer.cpp index 6d12fd6226e..f0927c0c578 100644 --- a/mythplugins/mythzoneminder/mythzoneminder/zmminiplayer.cpp +++ b/mythplugins/mythzoneminder/mythzoneminder/zmminiplayer.cpp @@ -70,7 +70,7 @@ void ZMMiniPlayer::customEvent (QEvent* event) { if (event->type() == MythEvent::MythEventMessage) { - MythEvent *me = dynamic_cast(event); + auto *me = dynamic_cast(event); if (!me) return; diff --git a/mythplugins/mythzoneminder/mythzoneminder/zmsettings.cpp b/mythplugins/mythzoneminder/mythzoneminder/zmsettings.cpp index 04ffa93cb6c..f4b960f776d 100644 --- a/mythplugins/mythzoneminder/mythzoneminder/zmsettings.cpp +++ b/mythplugins/mythzoneminder/mythzoneminder/zmsettings.cpp @@ -14,7 +14,7 @@ static HostTextEditSetting *ZMServerIP() { - HostTextEditSetting *gc = new HostTextEditSetting("ZoneMinderServerIP"); + auto *gc = new HostTextEditSetting("ZoneMinderServerIP"); gc->setLabel(ZMSettings::tr("IP address of the MythZoneMinder server")); gc->setValue("127.0.0.1"); gc->setHelpText(ZMSettings::tr("Enter the IP address of the MythZoneMinder " @@ -25,7 +25,7 @@ static HostTextEditSetting *ZMServerIP() static HostTextEditSetting *ZMServerPort() { - HostTextEditSetting *gc = new HostTextEditSetting("ZoneMinderServerPort"); + auto *gc = new HostTextEditSetting("ZoneMinderServerPort"); gc->setLabel(ZMSettings::tr("Port the server runs on")); gc->setValue("6548"); gc->setHelpText(ZMSettings::tr("Unless you've got good reason to, don't " @@ -35,7 +35,7 @@ static HostTextEditSetting *ZMServerPort() static HostComboBoxSetting *ZMDateFormat() { - HostComboBoxSetting *gc = new HostComboBoxSetting("ZoneMinderDateFormat"); + auto *gc = new HostComboBoxSetting("ZoneMinderDateFormat"); gc->setLabel(ZMSettings::tr("Date format")); QDate sampdate = MythDate::current().toLocalTime().date(); @@ -71,7 +71,7 @@ static HostComboBoxSetting *ZMDateFormat() static HostComboBoxSetting *ZMTimeFormat() { - HostComboBoxSetting *gc = new HostComboBoxSetting("ZoneMinderTimeFormat"); + auto *gc = new HostComboBoxSetting("ZoneMinderTimeFormat"); gc->setLabel(ZMSettings::tr("Time format")); QTime samptime = QTime::currentTime(); diff --git a/mythtv/Makefile b/mythtv/Makefile index f64dd570c32..d6fef68cecf 100644 --- a/mythtv/Makefile +++ b/mythtv/Makefile @@ -121,4 +121,4 @@ cleanall: clean compdb: @echo "Building ../compile_commands.json" - @programs/scripts/build_commdb.py + @programs/scripts/build_compdb.py diff --git a/mythtv/configure b/mythtv/configure index f852d45ca2d..30ad6410338 100755 --- a/mythtv/configure +++ b/mythtv/configure @@ -86,6 +86,7 @@ Advanced options (experts only): --extra-cxxflags=ECXFLAGS add ECXXFLAGS to list of flags for C++ compile --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS] --disable-symbol-visibility disables symbol visibility options + --disable-deprecation-warnings disables deprecated declaration warnings --arch=ARCH select architecture [$arch] --tune=CPU tune instruction usage for a particular CPU [$tune] --cpu=CPU select the minimum required CPU (affects @@ -2018,6 +2019,7 @@ MYTHTV_LIST=' proc_opt silent_cc symbol_visibility + deprecation_warnings ' USING_LIST=' @@ -2764,6 +2766,7 @@ enable opengl enable opengles enable egl enable symbol_visibility +enable deprecation_warnings enable v4l1 enable v4l2 enable v4l2prime @@ -5168,7 +5171,7 @@ version2num(){ } # Minimum supported Qt version -QT_MIN_VERSION_STR="5.5" +QT_MIN_VERSION_STR="5.7" QT_MIN_VERSION=$(version2num $QT_MIN_VERSION_STR) QT_MIN_VERSION_HEX=$(printf "0x%06x" $QT_MIN_VERSION) @@ -6202,6 +6205,9 @@ enabled debug && add_cxxflags -g"$debuglevel" #check_cflags -Wdeclaration-after-statement check_cflags -Wall check_cflags -Wextra +if disabled deprecation_warnings; then + check_cflags -Wno-deprecated-declarations +fi ! disabled optimizations && check_cflags -Wdisabled-optimization check_cflags -Wpointer-arith disabled icc && check_cflags -Wredundant-decls @@ -6253,6 +6259,9 @@ EOF check_cxxflags -Wall check_cxxflags -Wextra check_cxxflags -Wpointer-arith +if disabled deprecation_warnings; then + check_cxxflags -Wno-deprecated-declarations +fi #needed for INT64_C in libs/libavformat under g++ check_cxxflags -D__STDC_CONSTANT_MACROS check_cxxflags -D__STDC_LIMIT_MACROS diff --git a/mythtv/libs/libmyth/audio/audioconvert.cpp b/mythtv/libs/libmyth/audio/audioconvert.cpp index d86319f5d61..67ac3568e30 100644 --- a/mythtv/libs/libmyth/audio/audioconvert.cpp +++ b/mythtv/libs/libmyth/audio/audioconvert.cpp @@ -682,7 +682,7 @@ int AudioConvert::Process(void* out, const void* in, int bytes, bool noclip) // cppcheck-suppress unassignedVariable uint8_t buffer[65536+15]; - uint8_t* tmp = (uint8_t*)(((long)buffer + 15) & ~0xf); + auto* tmp = (uint8_t*)(((long)buffer + 15) & ~0xf); int left = bytes; while (left > 0) @@ -720,8 +720,8 @@ int AudioConvert::Process(void* out, const void* in, int bytes, bool noclip) */ void AudioConvert::MonoToStereo(void* dst, const void* src, int samples) { - float* d = (float*)dst; - float* s = (float*)src; + auto* d = (float*)dst; + auto* s = (float*)src; for (int i = 0; i < samples; i++) { *d++ = *s; diff --git a/mythtv/libs/libmyth/audio/audiooutput.cpp b/mythtv/libs/libmyth/audio/audiooutput.cpp index 2e4934331a6..284838428a3 100644 --- a/mythtv/libs/libmyth/audio/audiooutput.cpp +++ b/mythtv/libs/libmyth/audio/audiooutput.cpp @@ -419,7 +419,7 @@ static void fillSelectionsFromDir(const QDir &dir, AudioOutput::ADCVect* AudioOutput::GetOutputList(void) { - ADCVect *list = new ADCVect; + auto *list = new ADCVect; #ifdef USING_PULSE bool pasuspended = PulseHandler::Suspend(PulseHandler::kPulseSuspend); @@ -650,7 +650,7 @@ int AudioOutput::DecodeAudio(AVCodecContext *ctx, return ret; } - AVSampleFormat format = (AVSampleFormat)m_frame->format; + auto format = (AVSampleFormat)m_frame->format; AudioFormat fmt = AudioOutputSettings::AVSampleFormatToFormat(format, ctx->bits_per_raw_sample); diff --git a/mythtv/libs/libmyth/audio/audiooutput.h b/mythtv/libs/libmyth/audio/audiooutput.h index 0f25a299d06..ae6c1a3fc60 100644 --- a/mythtv/libs/libmyth/audio/audiooutput.h +++ b/mythtv/libs/libmyth/audio/audiooutput.h @@ -42,7 +42,7 @@ class MPUBLIC AudioOutput : public VolumeBase, public OutputListeners AudioDeviceConfig &operator= (AudioDeviceConfig &&) = default; }; - typedef QVector ADCVect; + using ADCVect = QVector; static void Cleanup(void); static ADCVect* GetOutputList(void); diff --git a/mythtv/libs/libmyth/audio/audiooutputalsa.cpp b/mythtv/libs/libmyth/audio/audiooutputalsa.cpp index 448758e8b5a..e220e92ff1a 100644 --- a/mythtv/libs/libmyth/audio/audiooutputalsa.cpp +++ b/mythtv/libs/libmyth/audio/audiooutputalsa.cpp @@ -323,7 +323,7 @@ AudioOutputSettings* AudioOutputALSA::GetOutputSettings(bool passthrough) AudioFormat fmt = FORMAT_NONE; int err = 0; - AudioOutputSettings *settings = new AudioOutputSettings(); + auto *settings = new AudioOutputSettings(); if (m_pcm_handle) { @@ -827,7 +827,7 @@ int AudioOutputALSA::GetVolumeChannel(int channel) const if (!m_mixer.elem) return retvol; - snd_mixer_selem_channel_id_t chan = (snd_mixer_selem_channel_id_t) channel; + auto chan = (snd_mixer_selem_channel_id_t) channel; if (!snd_mixer_selem_has_playback_channel(m_mixer.elem, chan)) return retvol; @@ -863,7 +863,7 @@ void AudioOutputALSA::SetVolumeChannel(int channel, int volume) mixervol = max(mixervol, m_mixer.volmin); mixervol = min(mixervol, m_mixer.volmax); - snd_mixer_selem_channel_id_t chan = (snd_mixer_selem_channel_id_t) channel; + auto chan = (snd_mixer_selem_channel_id_t) channel; if (snd_mixer_selem_has_playback_switch(m_mixer.elem)) snd_mixer_selem_set_playback_switch(m_mixer.elem, chan, (volume > 0)); @@ -984,7 +984,7 @@ bool AudioOutputALSA::OpenMixer(void) QMap *AudioOutputALSA::GetDevices(const char *type) { - QMap *alsadevs = new QMap(); + auto *alsadevs = new QMap(); void **hints = nullptr, **n = nullptr; if (snd_device_name_hint(-1, type, &hints) < 0) diff --git a/mythtv/libs/libmyth/audio/audiooutputbase.cpp b/mythtv/libs/libmyth/audio/audiooutputbase.cpp index 31578fb5f6b..f3677c8bab1 100644 --- a/mythtv/libs/libmyth/audio/audiooutputbase.cpp +++ b/mythtv/libs/libmyth/audio/audiooutputbase.cpp @@ -189,7 +189,7 @@ AudioOutputSettings* AudioOutputBase::GetOutputSettingsUsers(bool digital) else if (m_output_settingsdigital) return m_output_settingsdigital; - AudioOutputSettings* aosettings = new AudioOutputSettings; + auto* aosettings = new AudioOutputSettings; *aosettings = *GetOutputSettingsCleaned(digital); aosettings->GetUsers(); @@ -1628,9 +1628,9 @@ void AudioOutputBase::GetBufferStatus(uint &fill, uint &total) */ void AudioOutputBase::OutputAudioLoop(void) { - uchar *zeros = new uchar[m_fragment_size]; - uchar *fragment_buf = new uchar[m_fragment_size + 16]; - uchar *fragment = (uchar *)AOALIGN(fragment_buf[0]); + auto *zeros = new uchar[m_fragment_size]; + auto *fragment_buf = new uchar[m_fragment_size + 16]; + auto *fragment = (uchar *)AOALIGN(fragment_buf[0]); memset(zeros, 0, m_fragment_size); // to reduce startup latency, write silence in 8ms chunks diff --git a/mythtv/libs/libmyth/audio/audiooutputdigitalencoder.cpp b/mythtv/libs/libmyth/audio/audiooutputdigitalencoder.cpp index 73b7aa62efd..57fb7194f66 100644 --- a/mythtv/libs/libmyth/audio/audiooutputdigitalencoder.cpp +++ b/mythtv/libs/libmyth/audio/audiooutputdigitalencoder.cpp @@ -161,7 +161,7 @@ size_t AudioOutputDigitalEncoder::Encode(void *buf, int len, AudioFormat format) LOG(VB_AUDIO, LOG_INFO, LOC + QString("low mem, reallocating in buffer from %1 to %2") .arg(m_in_size) .arg(required_len)); - inbuf_t *tmp = reinterpret_cast + auto *tmp = reinterpret_cast (realloc(m_in, m_in_size, required_len)); if (!tmp) { @@ -275,7 +275,7 @@ size_t AudioOutputDigitalEncoder::Encode(void *buf, int len, AudioFormat format) LOG(VB_AUDIO, LOG_WARNING, LOC + QString("low mem, reallocating out buffer from %1 to %2") .arg(m_out_size) .arg(required_len)); - outbuf_t *tmp = reinterpret_cast + auto *tmp = reinterpret_cast (realloc(m_out, m_out_size, required_len)); if (!tmp) { diff --git a/mythtv/libs/libmyth/audio/audiooutputdigitalencoder.h b/mythtv/libs/libmyth/audio/audiooutputdigitalencoder.h index aa32bc62f02..959f90477d6 100644 --- a/mythtv/libs/libmyth/audio/audiooutputdigitalencoder.h +++ b/mythtv/libs/libmyth/audio/audiooutputdigitalencoder.h @@ -13,8 +13,8 @@ extern "C" { class AudioOutputDigitalEncoder { - typedef int16_t inbuf_t; - typedef int16_t outbuf_t; + using inbuf_t = int16_t; + using outbuf_t = int16_t; public: AudioOutputDigitalEncoder(void); diff --git a/mythtv/libs/libmyth/audio/audiooutputdx.cpp b/mythtv/libs/libmyth/audio/audiooutputdx.cpp index baf4746636a..d26313d4938 100644 --- a/mythtv/libs/libmyth/audio/audiooutputdx.cpp +++ b/mythtv/libs/libmyth/audio/audiooutputdx.cpp @@ -30,7 +30,7 @@ DEFINE_GUID(IID_IDirectSoundNotify, 0xb0210783, 0x89cd, 0x11d0, #endif #ifndef _WAVEFORMATEXTENSIBLE_ -typedef struct { +struct WAVEFORMATEXTENSIBLE { WAVEFORMATEX Format; union { WORD wValidBitsPerSample; // bits of precision @@ -39,7 +39,8 @@ typedef struct { } Samples; DWORD dwChannelMask; // which channels are present in stream GUID SubFormat; -} WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE; +}; +using PWAVEFORMATEXTENSIBLE = WAVEFORMATEXTENSIBLE*; #endif DEFINE_GUID(_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, WAVE_FORMAT_IEEE_FLOAT, @@ -124,8 +125,8 @@ AudioOutputDX::~AudioOutputDX() timeEndPeriod(1); } -typedef HRESULT (WINAPI *LPFNDSC) (LPGUID, LPDIRECTSOUND *, LPUNKNOWN); -typedef HRESULT (WINAPI *LPFNDSE) (LPDSENUMCALLBACK, LPVOID); +using LPFNDSC = HRESULT (WINAPI *) (LPGUID, LPDIRECTSOUND *, LPUNKNOWN); +using LPFNDSE = HRESULT (WINAPI *) (LPDSENUMCALLBACK, LPVOID); #ifdef UNICODE int CALLBACK AudioOutputDXPrivate::DSEnumCallback(LPGUID lpGuid, diff --git a/mythtv/libs/libmyth/audio/audiooutputgraph.cpp b/mythtv/libs/libmyth/audio/audiooutputgraph.cpp index 627690c4253..13dc1a06542 100644 --- a/mythtv/libs/libmyth/audio/audiooutputgraph.cpp +++ b/mythtv/libs/libmyth/audio/audiooutputgraph.cpp @@ -37,7 +37,7 @@ class AudioOutputGraph::Buffer : protected QByteArray inline int64_t Next() const { return m_tcNext; } inline int64_t First() const { return m_tcFirst; } - typedef QPair range_t; + using range_t = QPair; range_t Avail(int64_t timecode) const { if (timecode == 0 || timecode == -1) @@ -154,8 +154,8 @@ class AudioOutputGraph::Buffer : protected QByteArray unsigned long cnt = len; int n = size(); resize(n + sizeof(int16_t) * cnt); - const uchar *s = reinterpret_cast< const uchar* >(b); - int16_t *p = reinterpret_cast< int16_t* >(data() + n); + const auto *s = reinterpret_cast< const uchar* >(b); + auto *p = reinterpret_cast< int16_t* >(data() + n); while (cnt--) *p++ = (int16_t(*s++) - CHAR_MAX) << (16 - CHAR_BIT); } @@ -172,8 +172,8 @@ class AudioOutputGraph::Buffer : protected QByteArray int n = size(); resize(n + sizeof(int16_t) * cnt); const float f((1 << 15) - 1); - const float *s = reinterpret_cast< const float* >(b); - int16_t *p = reinterpret_cast< int16_t* >(data() + n); + const auto *s = reinterpret_cast< const float* >(b); + auto *p = reinterpret_cast< int16_t* >(data() + n); while (cnt--) *p++ = int16_t(f * *s++); } @@ -312,7 +312,7 @@ MythImage *AudioOutputGraph::GetImage(int64_t timecode) const image.setPixel(x, height - 1 - y, rgb); } - MythImage *mi = new MythImage(m_painter); + auto *mi = new MythImage(m_painter); mi->Assign(image); return mi; } diff --git a/mythtv/libs/libmyth/audio/audiooutputjack.cpp b/mythtv/libs/libmyth/audio/audiooutputjack.cpp index cf11c93ac1b..6f669292d9c 100644 --- a/mythtv/libs/libmyth/audio/audiooutputjack.cpp +++ b/mythtv/libs/libmyth/audio/audiooutputjack.cpp @@ -58,7 +58,7 @@ AudioOutputSettings* AudioOutputJACK::GetOutputSettings(bool /*digital*/) int rate = 0; int i = 0; const char **matching_ports = nullptr; - AudioOutputSettings *settings = new AudioOutputSettings(); + auto *settings = new AudioOutputSettings(); m_client = _jack_client_open(); if (!m_client) @@ -344,7 +344,7 @@ void AudioOutputJACK::DeinterleaveAudio(const float *aubuf, float **bufs, int nf */ int AudioOutputJACK::_JackCallback(jack_nframes_t nframes, void *arg) { - AudioOutputJACK *aoj = static_cast(arg); + auto *aoj = static_cast(arg); return aoj->JackCallback(nframes); } @@ -433,7 +433,7 @@ int AudioOutputJACK::JackCallback(jack_nframes_t nframes) */ int AudioOutputJACK::_JackXRunCallback(void *arg) { - AudioOutputJACK *aoj = static_cast(arg); + auto *aoj = static_cast(arg); return aoj->JackXRunCallback(); } @@ -461,7 +461,7 @@ int AudioOutputJACK::JackXRunCallback(void) */ int AudioOutputJACK::_JackGraphOrderCallback(void *arg) { - AudioOutputJACK *aoj = static_cast(arg); + auto *aoj = static_cast(arg); return aoj->JackGraphOrderCallback(); } @@ -569,8 +569,7 @@ void AudioOutputJACK::WriteAudio(unsigned char *aubuf, int size) jack_client_t* AudioOutputJACK::_jack_client_open(void) { QString client_name = QString("mythtv_%1").arg(getpid()); - jack_options_t open_options = - (jack_options_t)(JackUseExactName | JackNoStartServer); + auto open_options = (jack_options_t)(JackUseExactName | JackNoStartServer); jack_status_t open_status = JackFailure; jack_client_t *client = jack_client_open(client_name.toLatin1().constData(), diff --git a/mythtv/libs/libmyth/audio/audiooutputnull.cpp b/mythtv/libs/libmyth/audio/audiooutputnull.cpp index 2cd52a95d83..4e465cf247c 100644 --- a/mythtv/libs/libmyth/audio/audiooutputnull.cpp +++ b/mythtv/libs/libmyth/audio/audiooutputnull.cpp @@ -53,7 +53,7 @@ void AudioOutputNULL::CloseDevice() AudioOutputSettings* AudioOutputNULL::GetOutputSettings(bool /*digital*/) { // Pretend that we support everything - AudioOutputSettings *settings = new AudioOutputSettings(); + auto *settings = new AudioOutputSettings(); // NOLINTNEXTLINE(bugprone-infinite-loop) while (int rate = settings->GetNextRate()) diff --git a/mythtv/libs/libmyth/audio/audiooutputopensles.h b/mythtv/libs/libmyth/audio/audiooutputopensles.h index e7dc38fa958..78b77295572 100644 --- a/mythtv/libs/libmyth/audio/audiooutputopensles.h +++ b/mythtv/libs/libmyth/audio/audiooutputopensles.h @@ -10,7 +10,7 @@ // MythTV headers #include "audiooutputbase.h" -typedef SLresult (*slCreateEngine_t)( +using slCreateEngine_t = SLresult (*)( SLObjectItf*, SLuint32, const SLEngineOption*, SLuint32, const SLInterfaceID*, const SLboolean*); diff --git a/mythtv/libs/libmyth/audio/audiooutputoss.cpp b/mythtv/libs/libmyth/audio/audiooutputoss.cpp index 8890d99ba95..ad94cfe5af3 100644 --- a/mythtv/libs/libmyth/audio/audiooutputoss.cpp +++ b/mythtv/libs/libmyth/audio/audiooutputoss.cpp @@ -36,7 +36,7 @@ AudioOutputOSS::~AudioOutputOSS() AudioOutputSettings* AudioOutputOSS::GetOutputSettings(bool /*digital*/) { - AudioOutputSettings *settings = new AudioOutputSettings(); + auto *settings = new AudioOutputSettings(); QByteArray device = m_main_device.toLatin1(); m_audiofd = open(device.constData(), O_WRONLY | O_NONBLOCK); diff --git a/mythtv/libs/libmyth/audio/audiooutputpulse.cpp b/mythtv/libs/libmyth/audio/audiooutputpulse.cpp index 46e95442acb..0bc80ef33e1 100644 --- a/mythtv/libs/libmyth/audio/audiooutputpulse.cpp +++ b/mythtv/libs/libmyth/audio/audiooutputpulse.cpp @@ -618,7 +618,7 @@ void AudioOutputPulseAudio::FlushStream(const char *caller) void AudioOutputPulseAudio::ContextStateCallback(pa_context *c, void *arg) { QString fn_log_tag = "_ContextStateCallback, "; - AudioOutputPulseAudio *audoutP = static_cast(arg); + auto *audoutP = static_cast(arg); switch (pa_context_get_state(c)) { case PA_CONTEXT_READY: @@ -637,7 +637,7 @@ void AudioOutputPulseAudio::ContextStateCallback(pa_context *c, void *arg) void AudioOutputPulseAudio::StreamStateCallback(pa_stream *s, void *arg) { QString fn_log_tag = "StreamStateCallback, "; - AudioOutputPulseAudio *audoutP = static_cast(arg); + auto *audoutP = static_cast(arg); switch (pa_stream_get_state(s)) { case PA_STREAM_READY: @@ -653,7 +653,7 @@ void AudioOutputPulseAudio::StreamStateCallback(pa_stream *s, void *arg) void AudioOutputPulseAudio::WriteCallback(pa_stream */*s*/, size_t /*size*/, void *arg) { - AudioOutputPulseAudio *audoutP = static_cast(arg); + auto *audoutP = static_cast(arg); pa_threaded_mainloop_signal(audoutP->m_mainloop, 0); } @@ -666,7 +666,7 @@ void AudioOutputPulseAudio::OpCompletionCallback( pa_context *c, int ok, void *arg) { QString fn_log_tag = "OpCompletionCallback, "; - AudioOutputPulseAudio *audoutP = static_cast(arg); + auto *audoutP = static_cast(arg); if (!ok) { VBERROR(fn_log_tag + QString("bummer, an operation failed: %1") @@ -690,7 +690,7 @@ void AudioOutputPulseAudio::ServerInfoCallback( void AudioOutputPulseAudio::SinkInfoCallback( pa_context */*c*/, const pa_sink_info *info, int /*eol*/, void *arg) { - AudioOutputPulseAudio *audoutP = static_cast(arg); + auto *audoutP = static_cast(arg); if (!info) { diff --git a/mythtv/libs/libmyth/audio/audiooutputsettings.h b/mythtv/libs/libmyth/audio/audiooutputsettings.h index 4f8acdbfc71..56456b989fe 100644 --- a/mythtv/libs/libmyth/audio/audiooutputsettings.h +++ b/mythtv/libs/libmyth/audio/audiooutputsettings.h @@ -21,7 +21,7 @@ extern "C" { } #include "eldutils.h" -typedef enum { +enum AudioFormat { FORMAT_NONE = 0, FORMAT_U8, FORMAT_S16, @@ -29,9 +29,9 @@ typedef enum { FORMAT_S24, FORMAT_S32, FORMAT_FLT -} AudioFormat; +}; -typedef enum { +enum DigitalFeature { FEATURE_NONE = 0, FEATURE_AC3 = 1 << 0, FEATURE_DTS = 1 << 1, @@ -40,7 +40,7 @@ typedef enum { FEATURE_TRUEHD = 1 << 4, FEATURE_DTSHD = 1 << 5, FEATURE_AAC = 1 << 6, -} DigitalFeature; +}; static const int srs[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200, 96000, 176400, 192000 }; diff --git a/mythtv/libs/libmyth/audio/audiooutpututil.cpp b/mythtv/libs/libmyth/audio/audiooutpututil.cpp index 6544ab14e82..6f4703642d6 100644 --- a/mythtv/libs/libmyth/audio/audiooutpututil.cpp +++ b/mythtv/libs/libmyth/audio/audiooutpututil.cpp @@ -102,7 +102,7 @@ void AudioOutputUtil::AdjustVolume(void *buf, int len, int volume, bool music, bool upmix) { float g = volume / 100.0F; - float *fptr = (float *)buf; + auto *fptr = (float *)buf; int samples = len >> 2; int i = 0; @@ -203,8 +203,8 @@ char *AudioOutputUtil::GeneratePinkFrames(char *frames, int channels, initialize_pink_noise(&pink, bits); - int16_t *samp16 = (int16_t*) frames; - int32_t *samp32 = (int32_t*) frames; + auto *samp16 = (int16_t*) frames; + auto *samp32 = (int32_t*) frames; while (count-- > 0) { @@ -287,7 +287,7 @@ int AudioOutputUtil::DecodeAudio(AVCodecContext *ctx, return ret; } - AVSampleFormat format = (AVSampleFormat)frame->format; + auto format = (AVSampleFormat)frame->format; data_size = frame->nb_samples * frame->channels * av_get_bytes_per_sample(format); diff --git a/mythtv/libs/libmyth/audio/audiooutputwin.cpp b/mythtv/libs/libmyth/audio/audiooutputwin.cpp index e73b149cd13..0ea1209ac65 100644 --- a/mythtv/libs/libmyth/audio/audiooutputwin.cpp +++ b/mythtv/libs/libmyth/audio/audiooutputwin.cpp @@ -24,7 +24,7 @@ using namespace std; #endif #ifndef _WAVEFORMATEXTENSIBLE_ -typedef struct { +struct WAVEFORMATEXTENSIBLE { WAVEFORMATEX Format; union { WORD wValidBitsPerSample; // bits of precision @@ -33,7 +33,8 @@ typedef struct { } Samples; DWORD dwChannelMask; // which channels are present in stream GUID SubFormat; -} WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE; +}; +using PWAVEFORMATEXTENSIBLE = WAVEFORMATEXTENSIBLE*; #endif const uint AudioOutputWin::kPacketCnt = 4; diff --git a/mythtv/libs/libmyth/audio/audiopulsehandler.cpp b/mythtv/libs/libmyth/audio/audiopulsehandler.cpp index 199a0926baa..b926df96cbd 100644 --- a/mythtv/libs/libmyth/audio/audiopulsehandler.cpp +++ b/mythtv/libs/libmyth/audio/audiopulsehandler.cpp @@ -55,7 +55,7 @@ bool PulseHandler::Suspend(enum PulseAction action) static int s_iPulseRunning = -1; static QTime s_time; - static enum PulseAction s_ePulseAction = PulseAction(-1); + static auto s_ePulseAction = PulseAction(-1); // Use the last result of IsPulseAudioRunning if within time if (!s_time.isNull() && s_time.elapsed() < 30000) @@ -93,7 +93,7 @@ bool PulseHandler::Suspend(enum PulseAction action) // create our handler if (!g_pulseHandler) { - PulseHandler* handler = new PulseHandler(); + auto* handler = new PulseHandler(); if (handler) { LOG(VB_AUDIO, LOG_INFO, LOC + "Created PulseHandler object"); @@ -125,7 +125,7 @@ static void StatusCallback(pa_context *ctx, void *userdata) return; // validate the callback - PulseHandler *handler = static_cast(userdata); + auto *handler = static_cast(userdata); if (!handler) { LOG(VB_GENERAL, LOG_ERR, LOC + "Callback: no handler."); @@ -167,7 +167,7 @@ static void OperationCallback(pa_context *ctx, int success, void *userdata) } // validate the callback - PulseHandler *handler = static_cast(userdata); + auto *handler = static_cast(userdata); if (!handler) { LOG(VB_GENERAL, LOG_ERR, LOC + "Operation: no handler."); diff --git a/mythtv/libs/libmyth/audio/audiosettings.h b/mythtv/libs/libmyth/audio/audiosettings.h index 02ad73ca868..c9b83d81444 100644 --- a/mythtv/libs/libmyth/audio/audiosettings.h +++ b/mythtv/libs/libmyth/audio/audiosettings.h @@ -14,12 +14,12 @@ #include "mythexp.h" #include "audiooutputsettings.h" -typedef enum { +enum AudioOutputSource { AUDIOOUTPUT_UNKNOWN, AUDIOOUTPUT_VIDEO, AUDIOOUTPUT_MUSIC, AUDIOOUTPUT_TELEPHONY, -} AudioOutputSource; +}; class MPUBLIC AudioSettings { diff --git a/mythtv/libs/libmyth/audio/spdifencoder.cpp b/mythtv/libs/libmyth/audio/spdifencoder.cpp index 43d77ddadd2..02b6b13fbd3 100644 --- a/mythtv/libs/libmyth/audio/spdifencoder.cpp +++ b/mythtv/libs/libmyth/audio/spdifencoder.cpp @@ -158,7 +158,7 @@ bool SPDIFEncoder::SetMaxHDRate(int rate) */ int SPDIFEncoder::funcIO(void *opaque, unsigned char *buf, int size) { - SPDIFEncoder *enc = (SPDIFEncoder *)opaque; + auto *enc = (SPDIFEncoder *)opaque; memcpy(enc->m_buffer + enc->m_size, buf, size); enc->m_size += size; diff --git a/mythtv/libs/libmyth/audio/volumebase.cpp b/mythtv/libs/libmyth/audio/volumebase.cpp index 8a0a7e08961..85db1eb8c95 100644 --- a/mythtv/libs/libmyth/audio/volumebase.cpp +++ b/mythtv/libs/libmyth/audio/volumebase.cpp @@ -23,7 +23,7 @@ class VolumeWriteBackThread : public MThread static VolumeWriteBackThread *Instance() { QMutexLocker lock(&s_mutex); - static VolumeWriteBackThread *s_instance = new VolumeWriteBackThread; + static auto *s_instance = new VolumeWriteBackThread; return s_instance; } diff --git a/mythtv/libs/libmyth/audio/volumebase.h b/mythtv/libs/libmyth/audio/volumebase.h index 5a61f401705..13ebbb9cd24 100644 --- a/mythtv/libs/libmyth/audio/volumebase.h +++ b/mythtv/libs/libmyth/audio/volumebase.h @@ -3,12 +3,12 @@ #include "mythexp.h" -typedef enum { +enum MuteState { kMuteOff = 0, kMuteLeft, kMuteRight, kMuteAll, -} MuteState; +}; class MPUBLIC VolumeBase { diff --git a/mythtv/libs/libmyth/backendselect.cpp b/mythtv/libs/libmyth/backendselect.cpp index 6021ecd70bd..c2ecfb13d58 100644 --- a/mythtv/libs/libmyth/backendselect.cpp +++ b/mythtv/libs/libmyth/backendselect.cpp @@ -52,7 +52,7 @@ BackendSelection::Decision BackendSelection::Prompt( if (!mainStack) return ret; - BackendSelection *backendSettings = + auto *backendSettings = new BackendSelection(mainStack, dbParams, pConfig, true); if (backendSettings->Create()) @@ -98,8 +98,7 @@ void BackendSelection::Accept(MythUIButtonListItem *item) if (!item) return; - DeviceLocation *dev = item->GetData().value(); - + auto *dev = item->GetData().value(); if (!dev) { Cancel(); @@ -304,7 +303,7 @@ void BackendSelection::customEvent(QEvent *event) { if (event->type() == MythEvent::MythEventMessage) { - MythEvent *me = dynamic_cast(event); + auto *me = dynamic_cast(event); if (me == nullptr) return; @@ -337,8 +336,7 @@ void BackendSelection::customEvent(QEvent *event) } else if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = dynamic_cast(event); - + auto *dce = dynamic_cast(event); if (!dce) return; @@ -358,10 +356,8 @@ void BackendSelection::PromptForPassword(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythTextInputDialog *pwDialog = new MythTextInputDialog(popupStack, - message, - FilterNone, - true); + auto *pwDialog = new MythTextInputDialog(popupStack, message, + FilterNone, true); if (pwDialog->Create()) { diff --git a/mythtv/libs/libmyth/backendselect.h b/mythtv/libs/libmyth/backendselect.h index 27897e295ab..58e37efad35 100644 --- a/mythtv/libs/libmyth/backendselect.h +++ b/mythtv/libs/libmyth/backendselect.h @@ -25,7 +25,7 @@ const QString kDefaultMFE = "UPnP/MythFrontend/DefaultBackend/"; const QString kDefaultPIN = kDefaultMFE + "SecurityPin"; const QString kDefaultUSN = kDefaultMFE + "USN"; -typedef QMap ItemMap; +using ItemMap = QMap ; /** * \class BackendSelection @@ -39,12 +39,12 @@ class BackendSelection : public MythScreenType Q_OBJECT public: - typedef enum Decision + enum Decision { kManualConfigure = -1, kCancelConfigure = 0, kAcceptConfigure = +1, - } BackendDecision; + }; static Decision Prompt( DatabaseParams *dbParams, Configuration *pConfig); @@ -88,7 +88,7 @@ class BackendSelection : public MythScreenType QMutex m_mutex; - BackendDecision m_backendDecision {kCancelConfigure}; + Decision m_backendDecision {kCancelConfigure}; QEventLoop *m_loop {nullptr}; }; diff --git a/mythtv/libs/libmyth/guistartup.cpp b/mythtv/libs/libmyth/guistartup.cpp index e06c7558672..b78551adfdc 100644 --- a/mythtv/libs/libmyth/guistartup.cpp +++ b/mythtv/libs/libmyth/guistartup.cpp @@ -176,9 +176,7 @@ void GUIStartup::Close(void) QString message = tr("Do you really want to exit MythTV?"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythConfirmationDialog *confirmdialog - = new MythConfirmationDialog( - popupStack, message); + auto *confirmdialog = new MythConfirmationDialog(popupStack, message); if (confirmdialog->Create()) popupStack->AddScreen(confirmdialog); diff --git a/mythtv/libs/libmyth/langsettings.cpp b/mythtv/libs/libmyth/langsettings.cpp index c6de3bdb584..54a65573a57 100644 --- a/mythtv/libs/libmyth/langsettings.cpp +++ b/mythtv/libs/libmyth/langsettings.cpp @@ -80,7 +80,7 @@ bool LanguageSelection::Create(void) void LanguageSelection::Load(void) { - MythLocale *locale = new MythLocale(); + auto *locale = new MythLocale(); QString langCode; @@ -187,8 +187,7 @@ bool LanguageSelection::prompt(bool force) if (!mainStack) return false; - LanguageSelection *langSettings = new LanguageSelection(mainStack, - true); + auto *langSettings = new LanguageSelection(mainStack, true); if (langSettings->Create()) { diff --git a/mythtv/libs/libmyth/mediamonitor-unix.cpp b/mythtv/libs/libmyth/mediamonitor-unix.cpp index fb171a8d34c..0754d4611fa 100644 --- a/mythtv/libs/libmyth/mediamonitor-unix.cpp +++ b/mythtv/libs/libmyth/mediamonitor-unix.cpp @@ -217,7 +217,7 @@ bool MediaMonitorUnix::CheckMountable(void) } // Enumerate devices - typedef QList QDBusObjectPathList; + using QDBusObjectPathList = QList; QDBusReply reply = iface.call("EnumerateDevices"); if (!reply.isValid()) { @@ -435,7 +435,7 @@ QStringList MediaMonitorUnix::GetCDROMBlockDevices(void) if (iface.isValid()) { // Enumerate devices - typedef QList QDBusObjectPathList; + using QDBusObjectPathList = QList; QDBusReply reply = iface.call("EnumerateDevices"); if (reply.isValid()) { diff --git a/mythtv/libs/libmyth/mythcontext.cpp b/mythtv/libs/libmyth/mythcontext.cpp index 32920539021..447756d60c6 100644 --- a/mythtv/libs/libmyth/mythcontext.cpp +++ b/mythtv/libs/libmyth/mythcontext.cpp @@ -476,8 +476,7 @@ bool MythContextPrivate::FindDatabase(bool prompt, bool noAutodetect) if (manualSelect) { // Get the user to select a backend from a possible list: - BackendSelection::Decision d = (BackendSelection::Decision) - ChooseBackend(failure); + auto d = (BackendSelection::Decision)ChooseBackend(failure); switch (d) { case BackendSelection::kAcceptConfigure: @@ -727,10 +726,9 @@ bool MythContextPrivate::PromptForDatabaseParams(const QString &error) EnableDBerrors(); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - DatabaseSettings *dbsetting = new DatabaseSettings(); - StandardSettingDialog *ssd = - new StandardSettingDialog(mainStack, "databasesettings", - dbsetting); + auto *dbsetting = new DatabaseSettings(); + auto *ssd = new StandardSettingDialog(mainStack, "databasesettings", + dbsetting); if (ssd->Create()) { mainStack->AddScreen(ssd); @@ -1361,7 +1359,7 @@ bool MythContextPrivate::event(QEvent *e) m_registration = GetNotificationCenter()->Register(this); } - MythEvent *me = dynamic_cast(e); + auto *me = dynamic_cast(e); if (me == nullptr) return true; diff --git a/mythtv/libs/libmyth/mythmediamonitor.cpp b/mythtv/libs/libmyth/mythmediamonitor.cpp index f7d9bbda8dd..d3eec769b10 100644 --- a/mythtv/libs/libmyth/mythmediamonitor.cpp +++ b/mythtv/libs/libmyth/mythmediamonitor.cpp @@ -361,7 +361,7 @@ MediaMonitor::MediaMonitor(QObject* par, unsigned long interval, QStringList::Iterator dev; for (dev = m_IgnoreList.begin(); dev != m_IgnoreList.end(); ++dev) { - QFileInfo *fi = new QFileInfo(*dev); + auto *fi = new QFileInfo(*dev); if (fi && fi->isSymLink()) { @@ -804,7 +804,7 @@ bool MediaMonitor::eventFilter(QObject *obj, QEvent *event) { if (event->type() == MythMediaEvent::kEventType) { - MythMediaEvent *me = dynamic_cast(event); + auto *me = dynamic_cast(event); if (me == nullptr) { LOG(VB_GENERAL, LOG_ALERT, diff --git a/mythtv/libs/libmyth/mythrssmanager.h b/mythtv/libs/libmyth/mythrssmanager.h index 41f74157c82..33ba7281226 100644 --- a/mythtv/libs/libmyth/mythrssmanager.h +++ b/mythtv/libs/libmyth/mythrssmanager.h @@ -48,7 +48,7 @@ class MPUBLIC RSSSite : public QObject ~RSSSite() = default; - typedef QList rssList; + using rssList = QList; const QString& GetTitle() const { return m_title; } const QString& GetSortTitle() const { return m_sortTitle; } diff --git a/mythtv/libs/libmyth/netgrabbermanager.cpp b/mythtv/libs/libmyth/netgrabbermanager.cpp index 42f97241746..4022d6146b2 100644 --- a/mythtv/libs/libmyth/netgrabbermanager.cpp +++ b/mythtv/libs/libmyth/netgrabbermanager.cpp @@ -168,7 +168,7 @@ void GrabberManager::stopTimer() void GrabberManager::doUpdate() { - GrabberDownloadThread *gdt = new GrabberDownloadThread(this); + auto *gdt = new GrabberDownloadThread(this); if (m_refreshAll) gdt->refreshAll(); gdt->start(QThread::LowPriority); diff --git a/mythtv/libs/libmyth/netgrabbermanager.h b/mythtv/libs/libmyth/netgrabbermanager.h index ddfeec242c5..63cc28aff9c 100644 --- a/mythtv/libs/libmyth/netgrabbermanager.h +++ b/mythtv/libs/libmyth/netgrabbermanager.h @@ -43,7 +43,7 @@ class MPUBLIC GrabberScript : public QObject, public MThread void run(void) override; // MThread - typedef QList scriptList; + using scriptList = QList; signals: diff --git a/mythtv/libs/libmyth/netutils.cpp b/mythtv/libs/libmyth/netutils.cpp index eaf852ecaef..7f79d5346c9 100644 --- a/mythtv/libs/libmyth/netutils.cpp +++ b/mythtv/libs/libmyth/netutils.cpp @@ -75,8 +75,8 @@ GrabberScript* findTreeGrabberByCommand(const QString& commandline, bool search = query.value(6).toBool(); bool tree = query.value(7).toBool(); - GrabberScript *tmp = new GrabberScript(title, image, type, author, search, - tree, desc, command, ver); + auto *tmp = new GrabberScript(title, image, type, author, search, + tree, desc, command, ver); return tmp; } @@ -107,8 +107,8 @@ GrabberScript* findSearchGrabberByCommand(const QString& commandline, bool search = query.value(6).toBool(); bool tree = query.value(7).toBool(); - GrabberScript *tmp = new GrabberScript(title, image, type, author, search, - tree, desc, command, ver); + auto *tmp = new GrabberScript(title, image, type, author, search, + tree, desc, command, ver); return tmp; } @@ -138,8 +138,8 @@ GrabberScript::scriptList findAllDBTreeGrabbers() bool search = query.value(7).toBool(); bool tree = query.value(8).toBool(); - GrabberScript *script = new GrabberScript(title, image, type, author, search, - tree, desc, commandline, ver); + auto *script = new GrabberScript(title, image, type, author, search, + tree, desc, commandline, ver); tmp.append(script); } @@ -173,8 +173,8 @@ GrabberScript::scriptList findAllDBTreeGrabbersByHost(ArticleType type) bool search = query.value(6).toBool(); bool tree = query.value(7).toBool(); - GrabberScript *script = new GrabberScript(title, image, type, author, search, - tree, desc, commandline, ver); + auto *script = new GrabberScript(title, image, type, author, search, + tree, desc, commandline, ver); tmp.append(script); } @@ -208,8 +208,8 @@ GrabberScript::scriptList findAllDBSearchGrabbers(ArticleType type) bool search = query.value(6).toBool(); bool tree = query.value(7).toBool(); - GrabberScript *script = new GrabberScript(title, image, type, author, search, - tree, desc, commandline, ver); + auto *script = new GrabberScript(title, image, type, author, search, + tree, desc, commandline, ver); tmp.append(script); } diff --git a/mythtv/libs/libmyth/output.cpp b/mythtv/libs/libmyth/output.cpp index 4994c4df5d9..f0b93e376f1 100644 --- a/mythtv/libs/libmyth/output.cpp +++ b/mythtv/libs/libmyth/output.cpp @@ -35,14 +35,14 @@ void OutputListeners::error(const QString &e) void OutputListeners::addVisual(MythTV::Visual *v) { - Visuals::iterator it = std::find(m_visuals.begin(), m_visuals.end(), v); + auto it = std::find(m_visuals.begin(), m_visuals.end(), v); if (it == m_visuals.end()) m_visuals.push_back(v); } void OutputListeners::removeVisual(MythTV::Visual *v) { - Visuals::iterator it = std::find(m_visuals.begin(), m_visuals.end(), v); + auto it = std::find(m_visuals.begin(), m_visuals.end(), v); if (it != m_visuals.end()) m_visuals.erase(it); } @@ -53,7 +53,7 @@ void OutputListeners::dispatchVisual(uchar *buffer, unsigned long b_len, if (! buffer) return; - Visuals::iterator it = m_visuals.begin(); + auto it = m_visuals.begin(); for (; it != m_visuals.end(); ++it) { QMutexLocker locker((*it)->mutex()); @@ -63,7 +63,7 @@ void OutputListeners::dispatchVisual(uchar *buffer, unsigned long b_len, void OutputListeners::prepareVisuals() { - Visuals::iterator it = m_visuals.begin(); + auto it = m_visuals.begin(); for (; it != m_visuals.end(); ++it) { QMutexLocker locker((*it)->mutex()); diff --git a/mythtv/libs/libmyth/output.h b/mythtv/libs/libmyth/output.h index 7c38cebc188..81912c48fd0 100644 --- a/mythtv/libs/libmyth/output.h +++ b/mythtv/libs/libmyth/output.h @@ -90,7 +90,7 @@ class MPUBLIC OutputEvent : public MythEvent int m_chan {0}; }; -typedef std::vector Visuals; +using Visuals = std::vector; class MPUBLIC OutputListeners : public MythObservable { diff --git a/mythtv/libs/libmyth/programinfo.cpp b/mythtv/libs/libmyth/programinfo.cpp index c1785081583..e1c107d8083 100644 --- a/mythtv/libs/libmyth/programinfo.cpp +++ b/mythtv/libs/libmyth/programinfo.cpp @@ -589,8 +589,8 @@ ProgramInfo::ProgramInfo( if (m_originalAirDate.isValid() && m_originalAirDate < QDate(1940, 1, 1)) m_originalAirDate = QDate(); - ProgramList::const_iterator it = schedList.begin(); - for (; it != schedList.end(); ++it) + auto it = schedList.cbegin(); + for (; it != schedList.cend(); ++it) { // If this showing is scheduled to be recorded, then we need to copy // some of the information from the scheduler @@ -2348,12 +2348,12 @@ static ProgramInfoType discover_program_info_type( return pit; } -void ProgramInfo::SetPathname(const QString &pn) const +void ProgramInfo::SetPathname(const QString &pn) { m_pathname = pn; ProgramInfoType pit = discover_program_info_type(m_chanid, m_pathname, false); - const_cast(this)->SetProgramInfoType(pit); + SetProgramInfoType(pit); } ProgramInfoType ProgramInfo::DiscoverProgramInfoType(void) const @@ -2457,7 +2457,7 @@ QString ProgramInfo::QueryBasename(void) const * call and so should not be called from the UI thread. */ QString ProgramInfo::GetPlaybackURL( - bool checkMaster, bool forceCheckLocal) const + bool checkMaster, bool forceCheckLocal) { // return the original path if BD or DVD URI if (IsVideoBD() || IsVideoDVD()) @@ -4743,7 +4743,7 @@ void ProgramInfo::SaveInetRef(const QString &inet) * call and so should not be called from the UI thread. * \return true iff file is readable */ -bool ProgramInfo::IsFileReadable(void) const +bool ProgramInfo::IsFileReadable(void) { if (IsLocal() && QFileInfo(m_pathname).isReadable()) return true; @@ -4813,7 +4813,7 @@ uint ProgramInfo::QueryTranscoderID(void) const * \note This method sometimes initiates a QUERY_CHECKFILE MythProto * call and so should not be called from the UI thread. */ -QString ProgramInfo::DiscoverRecordingDirectory(void) const +QString ProgramInfo::DiscoverRecordingDirectory(void) { if (!IsLocal()) { diff --git a/mythtv/libs/libmyth/programinfo.h b/mythtv/libs/libmyth/programinfo.h index 364c45c8630..3b816ebd056 100644 --- a/mythtv/libs/libmyth/programinfo.h +++ b/mythtv/libs/libmyth/programinfo.h @@ -27,7 +27,7 @@ #define NUMPROGRAMLINES 52 class ProgramInfo; -typedef AutoDeleteDeque ProgramList; +using ProgramList = AutoDeleteDeque; /** \class ProgramInfo * \brief Holds information on recordings and videos. @@ -348,7 +348,7 @@ class MPUBLIC ProgramInfo bool IsMythStream(void) const { return m_pathname.startsWith("myth://"); } bool IsPathSet(void) const { return GetBasename() != m_pathname; } bool HasPathname(void) const { return !GetPathname().isEmpty(); } - bool IsFileReadable(void) const; + bool IsFileReadable(void); QString GetTitle(void) const { return m_title; } QString GetSortTitle(void) const { return m_sortTitle; } @@ -488,13 +488,13 @@ class MPUBLIC ProgramInfo uint GetAudioProperties(void) const { return (m_properties & kAudioPropertyMask) >> kAudioPropertyOffset; } - typedef enum + enum Verbosity { kLongDescription, kTitleSubtitle, kRecordingKey, kSchedulingKey, - } Verbosity; + }; QString toString(Verbosity v = kLongDescription, const QString& sep = ":", const QString& grp = "\"") const; @@ -503,7 +503,7 @@ class MPUBLIC ProgramInfo void SetSubtitle(const QString &st, const QString &sst = nullptr); void SetProgramInfoType(ProgramInfoType t) { m_programflags &= ~FL_TYPEMASK; m_programflags |= ((uint32_t)t<<20); } - void SetPathname(const QString&) const; + void SetPathname(const QString&); void SetChanID(uint _chanid) { m_chanid = _chanid; } void SetScheduledStartTime(const QDateTime &dt) { m_startts = dt; } void SetScheduledEndTime( const QDateTime &dt) { m_endts = dt; } @@ -626,9 +626,9 @@ class MPUBLIC ProgramInfo void SaveInetRef(const QString &inet); // Extremely slow functions that cannot be called from the UI thread. - QString DiscoverRecordingDirectory(void) const; + QString DiscoverRecordingDirectory(void); QString GetPlaybackURL(bool checkMaster = false, - bool forceCheckLocal = false) const; + bool forceCheckLocal = false); ProgramInfoType DiscoverProgramInfoType(void) const; // Edit flagging map diff --git a/mythtv/libs/libmyth/programinfoupdater.cpp b/mythtv/libs/libmyth/programinfoupdater.cpp index ef3d21b54ba..a192337071b 100644 --- a/mythtv/libs/libmyth/programinfoupdater.cpp +++ b/mythtv/libs/libmyth/programinfoupdater.cpp @@ -55,7 +55,7 @@ void ProgramInfoUpdater::run(void) m_lock.lock(); // send adds and deletes in the order they were queued - vector::iterator ita = m_needsAddDelete.begin(); + auto ita = m_needsAddDelete.begin(); for (; ita != m_needsAddDelete.end(); ++ita) { if (kPIAdd != (*ita).m_action && kPIDelete != (*ita).m_action) diff --git a/mythtv/libs/libmyth/programinfoupdater.h b/mythtv/libs/libmyth/programinfoupdater.h index 6c1511af887..6254f6a36b4 100644 --- a/mythtv/libs/libmyth/programinfoupdater.h +++ b/mythtv/libs/libmyth/programinfoupdater.h @@ -15,12 +15,12 @@ // Myth #include "mythexp.h" -typedef enum PIAction { +enum PIAction { kPIAdd, kPIDelete, kPIUpdate, kPIUpdateFileSize, -} PIAction; +}; class MPUBLIC PIKeyAction { diff --git a/mythtv/libs/libmyth/programtypes.h b/mythtv/libs/libmyth/programtypes.h index 0e002007f36..8a7dc802290 100644 --- a/mythtv/libs/libmyth/programtypes.h +++ b/mythtv/libs/libmyth/programtypes.h @@ -43,9 +43,9 @@ MPUBLIC extern const char *kJobQueueInUseID; MPUBLIC extern const char *kCCExtractorInUseID; /// Frame # -> File offset map -typedef QMap frm_pos_map_t; +using frm_pos_map_t = QMap; -typedef enum { +enum MarkTypes { MARK_ALL = -100, MARK_UNSET = -10, MARK_TMP_CUT_END = -5, @@ -74,21 +74,21 @@ typedef enum { MARK_TOTAL_FRAMES = 34, MARK_UTIL_PROGSTART = 40, MARK_UTIL_LASTPLAYPOS = 41, -} MarkTypes; +}; MPUBLIC QString toString(MarkTypes type); /// Frame # -> Mark map -typedef QMap frm_dir_map_t; +using frm_dir_map_t = QMap; -typedef enum CommFlagStatuses { +enum CommFlagStatus { COMM_FLAG_NOT_FLAGGED = 0, COMM_FLAG_DONE = 1, COMM_FLAG_PROCESSING = 2, COMM_FLAG_COMMFREE = 3 -} CommFlagStatus; +}; /// This is used as a bitmask. -typedef enum SkipTypes { +enum SkipType { COMM_DETECT_COMMFREE = -2, COMM_DETECT_UNINIT = -1, COMM_DETECT_OFF = 0x00000000, @@ -112,22 +112,22 @@ typedef enum SkipTypes { COMM_DETECT_PREPOSTROLL_ALL = (COMM_DETECT_PREPOSTROLL | COMM_DETECT_BLANKS | COMM_DETECT_SCENE) -} SkipType; +}; MPUBLIC QString SkipTypeToString(int); MPUBLIC std::deque GetPreferredSkipTypeCombinations(void); -typedef enum TranscodingStatuses { +enum TranscodingStatus { TRANSCODING_NOT_TRANSCODED = 0, TRANSCODING_COMPLETE = 1, TRANSCODING_RUNNING = 2 -} TranscodingStatus; +}; /// If you change these please update: /// mythplugins/mythweb/modules/tv/classes/Program.php /// mythtv/bindings/perl/MythTV/Program.pm /// (search for "Assign the program flags" in both) -typedef enum FlagMask { +enum ProgramFlag { FL_NONE = 0x00000000, FL_COMMFLAG = 0x00000001, FL_CUTLIST = 0x00000002, @@ -152,20 +152,20 @@ typedef enum FlagMask { FL_INUSERECORDING = 0x01000000, FL_INUSEPLAYING = 0x02000000, FL_INUSEOTHER = 0x04000000, -} ProgramFlag; +}; -typedef enum ProgramInfoType { +enum ProgramInfoType { kProgramInfoTypeRecording = 0, kProgramInfoTypeVideoFile, kProgramInfoTypeVideoDVD, kProgramInfoTypeVideoStreamingHTML, kProgramInfoTypeVideoStreamingRTSP, kProgramInfoTypeVideoBD, -} ProgramInfoType; +}; /// if AudioProps changes, the audioprop column in program and /// recordedprogram has to changed accordingly -typedef enum AudioProps { +enum AudioProps { AUD_UNKNOWN = 0x00, // For backwards compatibility do not change 0 or 1 AUD_STEREO = 0x01, AUD_MONO = 0x02, @@ -173,14 +173,14 @@ typedef enum AudioProps { AUD_DOLBY = 0x08, AUD_HARDHEAR = 0x10, AUD_VISUALIMPAIR = 0x20, -} AudioProperty; // has 6 bits in ProgramInfo::properties +}; // has 6 bits in ProgramInfo::properties #define kAudioPropertyBits 6 #define kAudioPropertyOffset 0 #define kAudioPropertyMask (0x3f<SetText(*it); diff --git a/mythtv/libs/libmyth/recordingtypes.h b/mythtv/libs/libmyth/recordingtypes.h index 7720ec3a4ed..dbad8407469 100644 --- a/mythtv/libs/libmyth/recordingtypes.h +++ b/mythtv/libs/libmyth/recordingtypes.h @@ -16,7 +16,7 @@ #include "mythexp.h" -typedef enum RecordingTypes +enum RecordingType { kNotRecording = 0, kSingleRecord = 1, @@ -30,7 +30,7 @@ typedef enum RecordingTypes //kFindDailyRecord = 9, (Obsolete) //kFindWeeklyRecord = 10, (Obsolete) kTemplateRecord = 11 -} RecordingType; // note stored in uint8_t in ProgramInfo +}; // note stored in uint8_t in ProgramInfo MPUBLIC QString toString(RecordingType); MPUBLIC QString toDescription(RecordingType); MPUBLIC QString toRawString(RecordingType); @@ -39,20 +39,20 @@ MPUBLIC RecordingType recTypeFromString(const QString&); MPUBLIC int RecTypePrecedence(RecordingType rectype); -typedef enum RecordingDupInTypes +enum RecordingDupInType { kDupsUnset = 0x00, kDupsInRecorded = 0x01, kDupsInOldRecorded = 0x02, kDupsInAll = 0x0F, kDupsNewEpi = 0x10 -} RecordingDupInType; // note stored in uint8_t in ProgramInfo +}; // note stored in uint8_t in ProgramInfo MPUBLIC QString toString(RecordingDupInType); MPUBLIC QString toDescription(RecordingDupInType); MPUBLIC QString toRawString(RecordingDupInType); MPUBLIC RecordingDupInType dupInFromString(const QString&); -typedef enum RecordingDupMethodType +enum RecordingDupMethodType { kDupCheckUnset = 0x00, kDupCheckNone = 0x01, @@ -60,13 +60,13 @@ typedef enum RecordingDupMethodType kDupCheckDesc = 0x04, kDupCheckSubDesc = 0x06, kDupCheckSubThenDesc = 0x08 -} RecordingDupMethodType; // note stored in uint8_t in ProgramInfo +}; // note stored in uint8_t in ProgramInfo MPUBLIC QString toString(RecordingDupMethodType); MPUBLIC QString toDescription(RecordingDupMethodType); MPUBLIC QString toRawString(RecordingDupMethodType); MPUBLIC RecordingDupMethodType dupMethodFromString(const QString&); -typedef enum RecSearchTypes +enum RecSearchType { kNoSearch = 0, kPowerSearch, @@ -74,7 +74,7 @@ typedef enum RecSearchTypes kKeywordSearch, kPeopleSearch, kManualSearch -} RecSearchType; +}; MPUBLIC QString toString(RecSearchType); MPUBLIC QString toRawString(RecSearchType); MPUBLIC RecSearchType searchTypeFromString(const QString&); diff --git a/mythtv/libs/libmyth/remoteutil.cpp b/mythtv/libs/libmyth/remoteutil.cpp index 488ab9b3301..35059d9efc4 100644 --- a/mythtv/libs/libmyth/remoteutil.cpp +++ b/mythtv/libs/libmyth/remoteutil.cpp @@ -25,7 +25,7 @@ vector *RemoteGetRecordedList(int sort) QStringList strlist(str); - vector *info = new vector; + auto *info = new vector; if (!RemoteGetRecordingList(*info, strlist)) { @@ -87,7 +87,7 @@ bool RemoteGetMemStats(int &totalMB, int &freeMB, int &totalVM, int &freeVM) return false; } -bool RemoteCheckFile(const ProgramInfo *pginfo, bool checkSlaves) +bool RemoteCheckFile(ProgramInfo *pginfo, bool checkSlaves) { QStringList strlist("QUERY_CHECKFILE"); strlist << QString::number((int)checkSlaves); @@ -192,8 +192,8 @@ uint RemoteGetRecordingList( QStringList::const_iterator it = strList.begin() + 1; for (int i = 0; i < numrecordings; i++) { - ProgramInfo *pginfo = new ProgramInfo(it, strList.end()); - reclist.push_back(pginfo); + auto *pginfo = new ProgramInfo(it, strList.end()); + reclist.push_back(pginfo); } return ((uint) reclist.size()) - reclist_initial_size; @@ -205,7 +205,7 @@ vector *RemoteGetConflictList(const ProgramInfo *pginfo) QStringList strlist( cmd ); pginfo->ToStringList(strlist); - vector *retlist = new vector; + auto *retlist = new vector; RemoteGetRecordingList(*retlist, strlist); return retlist; @@ -537,8 +537,8 @@ vector *RemoteGetCurrentlyRecordingList(void) str += "Recording"; QStringList strlist( str ); - vector *reclist = new vector; - vector *info = new vector; + auto *reclist = new vector; + auto *info = new vector; if (!RemoteGetRecordingList(*info, strlist)) { delete info; @@ -546,7 +546,7 @@ vector *RemoteGetCurrentlyRecordingList(void) } ProgramInfo *p = nullptr; - vector::iterator it = info->begin(); + auto it = info->begin(); // make sure whatever RemoteGetRecordingList() returned // only has RecStatus::Recording shows for ( ; it != info->end(); ++it) diff --git a/mythtv/libs/libmyth/remoteutil.h b/mythtv/libs/libmyth/remoteutil.h index 477df2c5c7b..34e2e05cf42 100644 --- a/mythtv/libs/libmyth/remoteutil.h +++ b/mythtv/libs/libmyth/remoteutil.h @@ -20,7 +20,7 @@ MPUBLIC bool RemoteGetUptime(time_t &uptime); MPUBLIC bool RemoteGetMemStats(int &totalMB, int &freeMB, int &totalVM, int &freeVM); MPUBLIC bool RemoteCheckFile( - const ProgramInfo *pginfo, bool checkSlaves = true); + ProgramInfo *pginfo, bool checkSlaves = true); MPUBLIC bool RemoteDeleteRecording( uint recordingID, bool forceMetadataDelete, bool forgetHistory); MPUBLIC diff --git a/mythtv/libs/libmyth/rssparse.h b/mythtv/libs/libmyth/rssparse.h index 66f1404a935..fac21c8b11f 100644 --- a/mythtv/libs/libmyth/rssparse.h +++ b/mythtv/libs/libmyth/rssparse.h @@ -17,12 +17,12 @@ #include "mythexp.h" #include "mythtypes.h" -typedef enum ArticleTypes { +enum ArticleType { VIDEO_FILE = 0, VIDEO_PODCAST = 1, AUDIO_FILE = 2, AUDIO_PODCAST = 3 -} ArticleType; +}; /** Describes an enclosure associated with an item. */ @@ -111,8 +111,8 @@ class MPUBLIC ResultItem public: - typedef QList resultList; - typedef std::vector List; + using resultList = QList; + using List = std::vector; ResultItem(const QString& title, const QString& sortTitle, const QString& subtitle, const QString& sortSubtitle, diff --git a/mythtv/libs/libmyth/standardsettings.cpp b/mythtv/libs/libmyth/standardsettings.cpp index 3a6c3391f20..8084be9c976 100644 --- a/mythtv/libs/libmyth/standardsettings.cpp +++ b/mythtv/libs/libmyth/standardsettings.cpp @@ -36,8 +36,7 @@ StandardSetting::~StandardSetting() MythUIButtonListItem * StandardSetting::createButton(MythUIButtonList * list) { - MythUIButtonListItemSetting *item = - new MythUIButtonListItemSetting(list, m_label); + auto *item = new MythUIButtonListItemSetting(list, m_label); item->SetData(qVariantFromValue(this)); connect(this, SIGNAL(ShouldRedraw(StandardSetting *)), item, SLOT(ShouldUpdate(StandardSetting *))); @@ -290,8 +289,7 @@ void GroupSetting::edit(MythScreenType *screen) if (!isEnabled()) return; - DialogCompletionEvent *dce = - new DialogCompletionEvent("leveldown", 0, "", ""); + auto *dce = new DialogCompletionEvent("leveldown", 0, "", ""); QCoreApplication::postEvent(screen, dce); } @@ -383,7 +381,7 @@ void MythUITextEditSetting::edit(MythScreenType * screen) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythTextInputDialog *settingdialog = + auto *settingdialog = new MythTextInputDialog(popupStack, getLabel(), FilterNone, m_passwordEcho, m_settingValue); @@ -421,8 +419,7 @@ void MythUIFileBrowserSetting::edit(MythScreenType * screen) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIFileBrowser *settingdialog = new MythUIFileBrowser(popupStack, - m_settingValue); + auto *settingdialog = new MythUIFileBrowser(popupStack, m_settingValue); settingdialog->SetTypeFilter(m_typeFilter); settingdialog->SetNameFilter(m_nameFilter); @@ -520,8 +517,7 @@ void MythUIComboBoxSetting::edit(MythScreenType * screen) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = - new MythDialogBox(getLabel(), popupStack, "optionmenu"); + auto *menuPopup = new MythDialogBox(getLabel(), popupStack, "optionmenu"); if (menuPopup->Create()) { @@ -565,7 +561,7 @@ void MythUIComboBoxSetting::resultEdit(DialogCompletionEvent *dce) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythTextInputDialog *settingdialog = + auto *settingdialog = new MythTextInputDialog(popupStack, getLabel(), FilterNone, false, m_settingValue); @@ -667,8 +663,7 @@ void MythUISpinBoxSetting::edit(MythScreenType * screen) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythSpinBoxDialog *settingdialog = new MythSpinBoxDialog(popupStack, - getLabel()); + auto *settingdialog = new MythSpinBoxDialog(popupStack, getLabel()); if (settingdialog->Create()) { @@ -729,8 +724,7 @@ void MythUICheckBoxSetting::edit(MythScreenType * screen) if (!isEnabled()) return; - DialogCompletionEvent *dce = - new DialogCompletionEvent("editsetting", 0, "", ""); + auto *dce = new DialogCompletionEvent("editsetting", 0, "", ""); QCoreApplication::postEvent(screen, dce); } @@ -784,7 +778,7 @@ void StandardSettingDialog::settingSelected(MythUIButtonListItem *item) if (!item) return; - StandardSetting *setting = item->GetData().value(); + auto *setting = item->GetData().value(); if (setting && m_selectedSettingHelp) { disconnect(m_selectedSettingHelp); @@ -795,7 +789,7 @@ void StandardSettingDialog::settingSelected(MythUIButtonListItem *item) void StandardSettingDialog::settingClicked(MythUIButtonListItem *item) { - StandardSetting* setting = item->GetData().value(); + auto* setting = item->GetData().value(); if (setting) setting->edit(this); } @@ -819,7 +813,7 @@ void StandardSettingDialog::customEvent(QEvent *event) MythUIButtonListItem * item = m_buttonList->GetItemCurrent(); if (item) { - StandardSetting *ss = item->GetData().value(); + auto *ss = item->GetData().value(); if (ss) ss->resultEdit(dce); } @@ -937,7 +931,7 @@ void StandardSettingDialog::LevelDown() MythUIButtonListItem *item = m_buttonList->GetItemCurrent(); if (item) { - StandardSetting *ss = item->GetData().value(); + auto *ss = item->GetData().value(); if (ss && ss->haveSubSettings() && ss->isEnabled()) setCurrentGroupSetting(ss); } @@ -952,8 +946,7 @@ void StandardSettingDialog::Close(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox * menuPopup = - new MythDialogBox(label, popupStack, "exitmenu"); + auto * menuPopup = new MythDialogBox(label, popupStack, "exitmenu"); if (menuPopup->Create()) { @@ -991,7 +984,7 @@ bool StandardSettingDialog::keyPressEvent(QKeyEvent *e) MythUIButtonListItem * item = m_buttonList->GetItemCurrent(); if (item) { - StandardSetting *ss = item->GetData().value(); + auto *ss = item->GetData().value(); if (ss) handled = ss->keyPressEvent(e); } @@ -1032,19 +1025,18 @@ void StandardSettingDialog::ShowMenu() if (!item) return; - GroupSetting *source = item->GetData().value(); + auto *source = item->GetData().value(); if (!source) return; // m_title->GetText() for screen title - MythMenu *menu = new MythMenu(source->getLabel(), this, "mainmenu"); + auto *menu = new MythMenu(source->getLabel(), this, "mainmenu"); menu->AddItem(tr("Edit"), SLOT(editEntry())); if (source->canDelete()) menu->AddItem(tr("Delete"), SLOT(deleteSelected())); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(menu, popupStack, - "menudialog"); + auto *menuPopup = new MythDialogBox(menu, popupStack, "menudialog"); menuPopup->SetReturnEvent(this, "mainmenu"); if (menuPopup->Create()) @@ -1069,7 +1061,7 @@ void StandardSettingDialog::deleteEntry() if (!item) return; - GroupSetting *source = item->GetData().value(); + auto *source = item->GetData().value(); if (!source) return; @@ -1088,7 +1080,7 @@ void StandardSettingDialog::deleteEntryConfirmed(bool ok) MythUIButtonListItem *item = m_buttonList->GetItemCurrent(); if (!item) return; - GroupSetting *source = item->GetData().value(); + auto *source = item->GetData().value(); if (!source) return; source->deleteEntry(); diff --git a/mythtv/libs/libmyth/storagegroupeditor.cpp b/mythtv/libs/libmyth/storagegroupeditor.cpp index 90418136c7c..96fe30d45b8 100644 --- a/mythtv/libs/libmyth/storagegroupeditor.cpp +++ b/mythtv/libs/libmyth/storagegroupeditor.cpp @@ -95,8 +95,7 @@ void StorageGroupEditor::ShowDeleteDialog() } MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythConfirmationDialog *confirmDelete = - new MythConfirmationDialog(popupStack, message, true); + auto *confirmDelete = new MythConfirmationDialog(popupStack, message, true); if (confirmDelete->Create()) { connect(confirmDelete, SIGNAL(haveResult(bool)), @@ -202,8 +201,7 @@ void StorageGroupDirSetting::ShowDeleteDialog() QString message = tr("Remove '%1'\nDirectory From Storage Group?").arg(getValue()); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythConfirmationDialog *confirmDelete = - new MythConfirmationDialog(popupStack, message, true); + auto *confirmDelete = new MythConfirmationDialog(popupStack, message, true); if (confirmDelete->Create()) { @@ -238,8 +236,7 @@ void StorageGroupEditor::Load(void) { clearSettings(); - ButtonStandardSetting *button = - new ButtonStandardSetting(tr("(Add New Directory)")); + auto *button = new ButtonStandardSetting(tr("(Add New Directory)")); connect(button, SIGNAL(clicked()), SLOT(ShowFileBrowser())); addChild(button); @@ -283,7 +280,7 @@ void StorageGroupEditor::ShowFileBrowser() { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIFileBrowser *settingdialog = new MythUIFileBrowser(popupStack, ""); + auto *settingdialog = new MythUIFileBrowser(popupStack, ""); settingdialog->SetTypeFilter(QDir::AllDirs | QDir::Drives); if (settingdialog->Create()) @@ -299,7 +296,7 @@ void StorageGroupEditor::customEvent(QEvent *event) { if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = dynamic_cast(event); + auto *dce = dynamic_cast(event); if (dce == nullptr) return; QString resultid = dce->GetId(); @@ -350,7 +347,7 @@ StorageGroupListEditor::StorageGroupListEditor(void) void StorageGroupListEditor::AddSelection(const QString &label, const QString &value) { - StorageGroupEditor *button = new StorageGroupEditor(value); + auto *button = new StorageGroupEditor(value); button->setLabel(label); addChild(button); } @@ -443,8 +440,7 @@ void StorageGroupListEditor::Load(void) if (isMaster) { - ButtonStandardSetting *newGroup = - new ButtonStandardSetting(tr("(Create new group)")); + auto *newGroup = new ButtonStandardSetting(tr("(Create new group)")); connect(newGroup, SIGNAL(clicked()), SLOT(ShowNewGroupDialog())); addChild(newGroup); } @@ -470,8 +466,7 @@ void StorageGroupListEditor::Load(void) void StorageGroupListEditor::ShowNewGroupDialog() { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythTextInputDialog *settingdialog = - new MythTextInputDialog(popupStack, + auto *settingdialog = new MythTextInputDialog(popupStack, tr("Enter the name of the new storage group")); if (settingdialog->Create()) @@ -488,7 +483,7 @@ void StorageGroupListEditor::ShowNewGroupDialog() void StorageGroupListEditor::CreateNewGroup(const QString& name) { - StorageGroupEditor *button = new StorageGroupEditor(name); + auto *button = new StorageGroupEditor(name); button->setLabel(name + tr(" Storage Group Directories")); button->Load(); addChild(button); diff --git a/mythtv/libs/libmyth/test/test_programinfo/test_programinfo.h b/mythtv/libs/libmyth/test/test_programinfo/test_programinfo.h index 982b137cb7d..c989076b0ba 100644 --- a/mythtv/libs/libmyth/test/test_programinfo/test_programinfo.h +++ b/mythtv/libs/libmyth/test/test_programinfo/test_programinfo.h @@ -83,7 +83,7 @@ class TestProgramInfo : public QObject (uint) -1, /* record id */ - RecordingDupInTypes::kDupsUnset, /* dupin */ + RecordingDupInType::kDupsUnset, /* dupin */ RecordingDupMethodType::kDupCheckUnset, /* dupmethod */ (uint) -1, /* find id */ diff --git a/mythtv/libs/libmythbase/autodeletedeque.h b/mythtv/libs/libmythbase/autodeletedeque.h index 1ea1aed9706..89c4dad9425 100644 --- a/mythtv/libs/libmythbase/autodeletedeque.h +++ b/mythtv/libs/libmythbase/autodeletedeque.h @@ -11,11 +11,11 @@ class AutoDeleteDeque explicit AutoDeleteDeque(bool auto_delete = true) : m_autodelete(auto_delete) {} ~AutoDeleteDeque() { clear(); } - typedef typename std::deque< T > List; - typedef typename List::iterator iterator; - typedef typename List::const_iterator const_iterator; - typedef typename List::reverse_iterator reverse_iterator; - typedef typename List::const_reverse_iterator const_reverse_iterator; + using List = typename std::deque< T >; + using iterator = typename List::iterator; + using const_iterator = typename List::const_iterator; + using reverse_iterator = typename List::reverse_iterator; + using const_reverse_iterator = typename List::const_reverse_iterator; T operator[](uint index) { @@ -51,10 +51,14 @@ class AutoDeleteDeque iterator end(void) { return m_list.end(); } const_iterator begin(void) const { return m_list.begin(); } const_iterator end(void) const { return m_list.end(); } + const_iterator cbegin(void) const { return m_list.begin(); } + const_iterator cend(void) const { return m_list.end(); } reverse_iterator rbegin(void) { return m_list.rbegin(); } reverse_iterator rend(void) { return m_list.rend(); } const_reverse_iterator rbegin(void) const { return m_list.rbegin(); } const_reverse_iterator rend(void) const { return m_list.rend(); } + const_reverse_iterator crbegin(void) const { return m_list.rbegin(); } + const_reverse_iterator crend(void) const { return m_list.rend(); } T back(void) { return m_list.back(); } const T back(void) const { return m_list.back(); } diff --git a/mythtv/libs/libmythbase/bonjourregister.cpp b/mythtv/libs/libmythbase/bonjourregister.cpp index 5e9ecf2babf..de1cd2c153c 100644 --- a/mythtv/libs/libmythbase/bonjourregister.cpp +++ b/mythtv/libs/libmythbase/bonjourregister.cpp @@ -98,7 +98,7 @@ void BonjourRegister::BonjourCallback(DNSServiceRef ref, DNSServiceFlags flags, (void)ref; (void)flags; - BonjourRegister *bonjour = static_cast(object); + auto *bonjour = static_cast(object); if (bonjour) { delete bonjour->m_lock; diff --git a/mythtv/libs/libmythbase/cleanupguard.h b/mythtv/libs/libmythbase/cleanupguard.h index e513b68ac09..60b94752972 100644 --- a/mythtv/libs/libmythbase/cleanupguard.h +++ b/mythtv/libs/libmythbase/cleanupguard.h @@ -6,7 +6,7 @@ class MBASE_PUBLIC CleanupGuard { public: - typedef void (*CleanupFunc)(); + using CleanupFunc = void (*)(); public: explicit CleanupGuard(CleanupFunc cleanFunction); diff --git a/mythtv/libs/libmythbase/compat.h b/mythtv/libs/libmythbase/compat.h index 010f91d9446..239b100206b 100644 --- a/mythtv/libs/libmythbase/compat.h +++ b/mythtv/libs/libmythbase/compat.h @@ -73,9 +73,9 @@ #define snprintf _snprintf #ifdef _WIN64 - typedef __int64 ssize_t; + using ssize_t = __int64; #else - typedef int ssize_t; + using ssize_t = int; #endif // Check for execute, only checking existance in MSVC @@ -120,7 +120,7 @@ # endif #endif - typedef uint32_t mode_t; + using mode_t = uint32_t; #if !defined(__cplusplus) && !defined( inline ) # define inline __inline @@ -137,7 +137,7 @@ //used in videodevice only - that code is not windows-compatible anyway # define minor(X) 0 - typedef unsigned int uint; + using uint = unsigned int; #endif #if defined(__cplusplus) && defined(_WIN32) @@ -328,7 +328,7 @@ static __inline struct tm *localtime_r(const time_t *timep, struct tm *result) # define WEXITSTATUS(w) (((w) >> 8) & 0xff) # define WTERMSIG(w) ((w) & 0x7f) - typedef long suseconds_t; + using suseconds_t = long; #endif // _WIN32 @@ -337,13 +337,13 @@ static __inline struct tm *localtime_r(const time_t *timep, struct tm *result) #include "mythconfig.h" #if CONFIG_DARWIN && ! defined (_SUSECONDS_T) - typedef int32_t suseconds_t; // 10.3 or earlier don't have this + using suseconds_t = int32_t; // 10.3 or earlier don't have this #endif // Libdvdnav now uses off64_t lseek64(), which BSD/Darwin doesn't have. // Luckily, its lseek() is already 64bit compatible #ifdef BSD - typedef off_t off64_t; + typedef off_t off64_t; //NOLINT(modernize-use-using)included from C code #define lseek64(f,o,w) lseek(f,o,w) #endif diff --git a/mythtv/libs/libmythbase/housekeeper.cpp b/mythtv/libs/libmythbase/housekeeper.cpp index 25159ba0a10..cc7aec91c95 100644 --- a/mythtv/libs/libmythbase/housekeeper.cpp +++ b/mythtv/libs/libmythbase/housekeeper.cpp @@ -791,7 +791,7 @@ void HouseKeeper::StartThread(void) // we're running for the first time // start up a new thread LOG(VB_GENERAL, LOG_DEBUG, "Running initial HouseKeepingThread."); - HouseKeepingThread *thread = new HouseKeepingThread(this); + auto *thread = new HouseKeepingThread(this); m_threadList.append(thread); thread->start(); } @@ -806,7 +806,7 @@ void HouseKeeper::StartThread(void) "spawning replacement. Current count %1.") .arg(m_threadList.size())); m_threadList.first()->Discard(); - HouseKeepingThread *thread = new HouseKeepingThread(this); + auto *thread = new HouseKeepingThread(this); m_threadList.prepend(thread); thread->start(); } @@ -823,7 +823,7 @@ void HouseKeeper::customEvent(QEvent *e) { if (e->type() == MythEvent::MythEventMessage) { - MythEvent *me = dynamic_cast(e); + auto *me = dynamic_cast(e); if (me == nullptr) return; if ((me->Message().left(20) == "HOUSE_KEEPER_RUNNING") || diff --git a/mythtv/libs/libmythbase/iso3166.h b/mythtv/libs/libmythbase/iso3166.h index 319c931ab88..f43717905f0 100644 --- a/mythtv/libs/libmythbase/iso3166.h +++ b/mythtv/libs/libmythbase/iso3166.h @@ -20,7 +20,7 @@ * \sa iso639.h */ -typedef QMap ISO3166ToNameMap; +using ISO3166ToNameMap = QMap; // WARNING: These functions are not thread-safe and sould only be // called from the main UI thread. diff --git a/mythtv/libs/libmythbase/iso639.cpp b/mythtv/libs/libmythbase/iso639.cpp index b353d43e5a0..d28047528a8 100644 --- a/mythtv/libs/libmythbase/iso639.cpp +++ b/mythtv/libs/libmythbase/iso639.cpp @@ -873,7 +873,7 @@ static int createCode2ToCode3Map(QMap& codemap) { functionality. */ -typedef QMap ISO639ToNameMap; +using ISO639ToNameMap = QMap; static ISO639ToNameMap createLanguageMap(void) { ISO639ToNameMap map; diff --git a/mythtv/libs/libmythbase/logging.cpp b/mythtv/libs/libmythbase/logging.cpp index c184d8d78c6..0f7168cb9e2 100644 --- a/mythtv/libs/libmythbase/logging.cpp +++ b/mythtv/libs/libmythbase/logging.cpp @@ -77,13 +77,13 @@ static QHash logThreadTidHash; static bool logThreadFinished = false; static bool debugRegistration = false; -typedef struct { +struct LogPropagateOpts { bool m_propagate; int m_quiet; int m_facility; bool m_dblog; QString m_path; -} LogPropagateOpts; +}; LogPropagateOpts logPropagateOpts {false, 0, 0, true, ""}; QString logPropagateArgs; @@ -553,7 +553,7 @@ LoggingItem *LoggingItem::create(const char *_file, int _line, LogLevel_t _level, LoggingType _type) { - LoggingItem *item = new LoggingItem(_file, _function, _line, _level, _type); + auto *item = new LoggingItem(_file, _function, _line, _level, _type); return item; } @@ -563,7 +563,7 @@ LoggingItem *LoggingItem::create(QByteArray &buf) // Deserialize buffer QVariant variant = QJsonWrapper::parseJson(buf); - LoggingItem *item = new LoggingItem; + auto *item = new LoggingItem; QJsonWrapper::qvariant2qobject(variant.toMap(), item); return item; @@ -876,7 +876,7 @@ QString logLevelGetName(LogLevel_t level) /// \param helptext Descriptive text for --verbose help output void verboseAdd(uint64_t mask, QString name, bool additive, QString helptext) { - VerboseDef *item = new VerboseDef; + auto *item = new VerboseDef; item->mask = mask; // VB_GENERAL -> general @@ -896,7 +896,7 @@ void verboseAdd(uint64_t mask, QString name, bool additive, QString helptext) /// \param shortname one-letter short name for output into logs void loglevelAdd(int value, QString name, char shortname) { - LoglevelDef *item = new LoglevelDef; + auto *item = new LoglevelDef; item->value = value; // LOG_CRIT -> crit diff --git a/mythtv/libs/libmythbase/logging.h b/mythtv/libs/libmythbase/logging.h index f9d8e1ed84f..444af0170f5 100644 --- a/mythtv/libs/libmythbase/logging.h +++ b/mythtv/libs/libmythbase/logging.h @@ -39,18 +39,18 @@ void loggingGetTimeStamp(qlonglong *epoch, uint *usec); class QWaitCondition; -typedef enum { +enum LoggingType { kMessage = 0x01, kRegistering = 0x02, kDeregistering = 0x04, kFlush = 0x08, kStandardIO = 0x10, kInitializing = 0x20, -} LoggingType; +}; class LoggerThread; -typedef struct tm tmType; +using tmType = struct tm; #define SET_LOGGING_ARG(arg){ \ free(arg); \ diff --git a/mythtv/libs/libmythbase/loggingserver.cpp b/mythtv/libs/libmythbase/loggingserver.cpp index e6e36861e08..209d31f54fe 100644 --- a/mythtv/libs/libmythbase/loggingserver.cpp +++ b/mythtv/libs/libmythbase/loggingserver.cpp @@ -62,16 +62,16 @@ static QMap loggerMap; LogForwardThread *logForwardThread = nullptr; -typedef QList LoggerList; +using LoggerList = QList; -typedef struct { +struct LoggerListItem { LoggerList *m_itemList; qlonglong m_itemEpoch; -} LoggerListItem; -typedef QMap ClientMap; +}; +using ClientMap = QMap; -typedef QList ClientList; -typedef QMap RevClientMap; +using ClientList = QList; +using RevClientMap = QMap; static QMutex logClientMapMutex; static ClientMap logClientMap; @@ -159,7 +159,7 @@ FileLogger *FileLogger::create(const QString& filename, QMutex *mutex) logger = new FileLogger(file); mutex->lock(); - ClientList *clients = new ClientList; + auto *clients = new ClientList; logRevClientMap.insert(logger, clients); return logger; } @@ -266,7 +266,7 @@ SyslogLogger *SyslogLogger::create(QMutex *mutex, bool open) logger = new SyslogLogger(open); mutex->lock(); - ClientList *clients = new ClientList; + auto *clients = new ClientList; logRevClientMap.insert(logger, clients); return logger; } @@ -323,7 +323,7 @@ JournalLogger *JournalLogger::create(QMutex *mutex) logger = new JournalLogger(); mutex->lock(); - ClientList *clients = new ClientList; + auto *clients = new ClientList; logRevClientMap.insert(logger, clients); return logger; } @@ -395,7 +395,7 @@ DatabaseLogger *DatabaseLogger::create(const QString& table, QMutex *mutex) logger = new DatabaseLogger(tble); mutex->lock(); - ClientList *clients = new ClientList; + auto *clients = new ClientList; logRevClientMap.insert(logger, clients); return logger; } @@ -597,7 +597,7 @@ void DBLoggerThread::run(void) // We want the query to be out of scope before the RunEpilog() so // shutdown occurs correctly as otherwise the connection appears still // in use, and we get a qWarning on shutdown. - MSqlQuery *query = new MSqlQuery(MSqlQuery::InitCon()); + auto *query = new MSqlQuery(MSqlQuery::InitCon()); m_logger->prepare(*query); QMutexLocker qLock(&m_queueMutex); @@ -819,7 +819,7 @@ void LogForwardThread::forwardMessage(LogMessage *msg) QMutexLocker lock3(&logRevClientMapMutex); // Need to find or create the loggers - LoggerList *loggers = new LoggerList; + auto *loggers = new LoggerList; // FileLogger from logFile QString logfile = item->logFile(); @@ -939,7 +939,7 @@ void logForwardStop(void) void logForwardMessage(const QList &msg) { - LogMessage *message = new LogMessage(msg); + auto *message = new LogMessage(msg); QMutexLocker lock(&logMsgListMutex); bool wasEmpty = logMsgList.isEmpty(); diff --git a/mythtv/libs/libmythbase/loggingserver.h b/mythtv/libs/libmythbase/loggingserver.h index 712a4b66433..96808d06fa0 100644 --- a/mythtv/libs/libmythbase/loggingserver.h +++ b/mythtv/libs/libmythbase/loggingserver.h @@ -125,8 +125,8 @@ class DatabaseLogger : public LoggerBase /// (in ms) }; -typedef QList LogMessage; -typedef QList LogMessageList; +using LogMessage = QList; +using LogMessageList = QList; /// \brief The logging thread that forwards received messages to the consuming /// loggers via ZeroMQ diff --git a/mythtv/libs/libmythbase/mthreadpool.cpp b/mythtv/libs/libmythbase/mthreadpool.cpp index be994e8f17f..f563c362ca0 100644 --- a/mythtv/libs/libmythbase/mthreadpool.cpp +++ b/mythtv/libs/libmythbase/mthreadpool.cpp @@ -96,9 +96,9 @@ using namespace std; #include "mthread.h" #include "mythdb.h" -typedef QPair MPoolEntry; -typedef QList MPoolQueue; -typedef QMap MPoolQueues; +using MPoolEntry = QPair; +using MPoolQueue = QList; +using MPoolQueues = QMap; class MPoolThread : public MThread { @@ -423,7 +423,7 @@ bool MThreadPool::TryStartInternal( { if (reserved) m_priv->m_reserveThread++; - MPoolThread *thread = new MPoolThread(*this, m_priv->m_expiryTimeout); + auto *thread = new MPoolThread(*this, m_priv->m_expiryTimeout); m_priv->m_runningThreads.insert(thread); thread->SetRunnable(runnable, debugName, reserved); thread->start(); diff --git a/mythtv/libs/libmythbase/mythcdrom-linux.cpp b/mythtv/libs/libmythbase/mythcdrom-linux.cpp index 3c5070a610b..df599803282 100644 --- a/mythtv/libs/libmythbase/mythcdrom-linux.cpp +++ b/mythtv/libs/libmythbase/mythcdrom-linux.cpp @@ -31,13 +31,13 @@ // Some features cannot be detected (reliably) using the standard // Linux ioctl()s, so we use some direct low-level device queries. -typedef struct cdrom_generic_command CDROMgenericCmd; +using CDROMgenericCmd = struct cdrom_generic_command; // Some structures stolen from the __KERNEL__ section of linux/cdrom.h. // This contains the result of a GPCMD_GET_EVENT_STATUS_NOTIFICATION. // It is the joining of a struct event_header and a struct media_event_desc -typedef struct +struct CDROMeventStatus { uint16_t m_dataLen[2]; #if HAVE_BIGENDIAN @@ -65,10 +65,10 @@ typedef struct #endif uint8_t m_startSlot; uint8_t m_endSlot; -} CDROMeventStatus; +}; // and this is returned by GPCMD_READ_DISC_INFO -typedef struct { +struct CDROMdiscInfo { uint16_t m_discInformationLength; #if HAVE_BIGENDIAN uint8_t m_reserved1 : 3; @@ -106,7 +106,7 @@ typedef struct { uint8_t m_discBarCode[8]; uint8_t m_reserved3; uint8_t m_nOpc; -} CDROMdiscInfo; +}; enum CDROMdiscStatus { @@ -207,7 +207,7 @@ bool MythCDROMLinux::hasWritableMedia() return false; } - CDROMdiscInfo *di = (CDROMdiscInfo *) buffer; + auto *di = (CDROMdiscInfo *) buffer; switch (di->m_discStatus) { case MEDIA_IS_EMPTY: @@ -252,7 +252,7 @@ int MythCDROMLinux::SCSIstatus() cgc.buflen = sizeof(buffer); cgc.data_direction = CGC_DATA_READ; - CDROMeventStatus *es = (CDROMeventStatus *) buffer; + auto *es = (CDROMeventStatus *) buffer; if ((ioctl(m_DeviceHandle, CDROM_SEND_PACKET, &cgc) < 0) || es->m_nea // drive does not support request diff --git a/mythtv/libs/libmythbase/mythcdrom.cpp b/mythtv/libs/libmythbase/mythcdrom.cpp index 64663491f14..fbc39b6eb73 100644 --- a/mythtv/libs/libmythbase/mythcdrom.cpp +++ b/mythtv/libs/libmythbase/mythcdrom.cpp @@ -136,15 +136,15 @@ void MythCDROM::setDeviceSpeed(const char *devicePath, int speed) .arg(devicePath).arg(speed)); } -typedef struct +struct blockInput_t { udfread_block_input m_input; /* This *must* be the first entry in the struct */ RemoteFile* m_file; -} blockInput_t; +}; static int _def_close(udfread_block_input *p_gen) { - blockInput_t *p = (blockInput_t *)p_gen; + auto *p = (blockInput_t *)p_gen; int result = -1; if (p && p->m_file) @@ -159,7 +159,7 @@ static int _def_close(udfread_block_input *p_gen) static uint32_t _def_size(udfread_block_input *p_gen) { - blockInput_t *p = (blockInput_t *)p_gen; + auto *p = (blockInput_t *)p_gen; return (uint32_t)(p->m_file->GetRealFileSize() / UDF_BLOCK_SIZE); } @@ -168,7 +168,7 @@ static int _def_read(udfread_block_input *p_gen, uint32_t lba, void *buf, uint32 { (void)flags; int result = -1; - blockInput_t *p = (blockInput_t *)p_gen; + auto *p = (blockInput_t *)p_gen; if (p && p->m_file && (p->m_file->Seek(lba * UDF_BLOCK_SIZE, SEEK_SET) != -1)) result = p->m_file->Read(buf, nblocks * UDF_BLOCK_SIZE) / UDF_BLOCK_SIZE; diff --git a/mythtv/libs/libmythbase/mythcdrom.h b/mythtv/libs/libmythbase/mythcdrom.h index 8ad7963a7f6..a53ff20513b 100644 --- a/mythtv/libs/libmythbase/mythcdrom.h +++ b/mythtv/libs/libmythbase/mythcdrom.h @@ -23,12 +23,12 @@ class MBASE_PUBLIC MythCDROM : public MythMediaDevice static MythCDROM* get(QObject* par, const char* devicePath, bool SuperMount, bool AllowEject); - typedef enum + enum ImageType { kUnknown, kBluray, kDVD - }ImageType; + }; static ImageType inspectImage(const QString& path); diff --git a/mythtv/libs/libmythbase/mythcommandlineparser.cpp b/mythtv/libs/libmythbase/mythcommandlineparser.cpp index 65c07a75ad0..4cff319524d 100644 --- a/mythtv/libs/libmythbase/mythcommandlineparser.cpp +++ b/mythtv/libs/libmythbase/mythcommandlineparser.cpp @@ -2196,8 +2196,7 @@ void MythCommandLineParser::allowArgs(bool allow) else if (!allow) return; - CommandLineArg *arg = new CommandLineArg("_args", QVariant::StringList, - QStringList()); + auto *arg = new CommandLineArg("_args", QVariant::StringList, QStringList()); m_namedArgs["_args"] = arg; } @@ -2215,7 +2214,7 @@ void MythCommandLineParser::allowExtras(bool allow) return; QMap vmap; - CommandLineArg *arg = new CommandLineArg("_extra", QVariant::Map, vmap); + auto *arg = new CommandLineArg("_extra", QVariant::Map, vmap); m_namedArgs["_extra"] = arg; } @@ -2233,7 +2232,7 @@ void MythCommandLineParser::allowPassthrough(bool allow) else if (!allow) return; - CommandLineArg *arg = new CommandLineArg("_passthrough", + auto *arg = new CommandLineArg("_passthrough", QVariant::StringList, QStringList()); m_namedArgs["_passthrough"] = arg; } diff --git a/mythtv/libs/libmythbase/mythcorecontext.cpp b/mythtv/libs/libmythbase/mythcorecontext.cpp index e4733a9df5e..f24b55de29f 100644 --- a/mythtv/libs/libmythbase/mythcorecontext.cpp +++ b/mythtv/libs/libmythbase/mythcorecontext.cpp @@ -533,7 +533,7 @@ MythSocket *MythCoreContext::ConnectCommandSocket( MythSocket *MythCoreContext::ConnectEventSocket(const QString &hostname, int port) { - MythSocket *eventSock = new MythSocket(-1, this); + auto *eventSock = new MythSocket(-1, this); // Assume that since we _just_ connected the command socket, // this one won't need multiple retries to work... diff --git a/mythtv/libs/libmythbase/mythdate.h b/mythtv/libs/libmythbase/mythdate.h index 6275b997c43..4403a0a7bbe 100644 --- a/mythtv/libs/libmythbase/mythdate.h +++ b/mythtv/libs/libmythbase/mythdate.h @@ -9,7 +9,7 @@ namespace MythDate { -typedef enum Formats +enum Format { ISODate = Qt::ISODate, ///< Default UTC kFilename = 0x000100, ///< Default UTC, "yyyyMMddhhmmss" @@ -27,7 +27,7 @@ typedef enum Formats kRFC822 = 0x020000, ///< HTTP Date format kOverrideUTC = 0x100000, ///< Present date/time in UTC kOverrideLocal = 0x200000, ///< Present date/time in localtime -} Format; +}; /// Returns current Date and Time in UTC. /// \param stripped if true milliseconds are stripped diff --git a/mythtv/libs/libmythbase/mythdb.cpp b/mythtv/libs/libmythbase/mythdb.cpp index 6548f16fe79..4c0d3bddaaa 100644 --- a/mythtv/libs/libmythbase/mythdb.cpp +++ b/mythtv/libs/libmythbase/mythdb.cpp @@ -60,7 +60,7 @@ struct SingleSetting QString m_host; }; -typedef QHash SettingsMap; +using SettingsMap = QHash; class MythDBPrivate { @@ -434,7 +434,7 @@ QString MythDB::GetSetting(const QString &_key, const QString &defaultval) bool MythDB::GetSettings(QMap &_key_value_pairs) { QMap done; - typedef QMap::iterator KVIt; + using KVIt = QMap::iterator; KVIt kvit = _key_value_pairs.begin(); for (; kvit != _key_value_pairs.end(); ++kvit) done[kvit.key().toLower()] = false; diff --git a/mythtv/libs/libmythbase/mythdbcon.cpp b/mythtv/libs/libmythbase/mythdbcon.cpp index fcc977b5160..c90a4e19169 100644 --- a/mythtv/libs/libmythbase/mythdbcon.cpp +++ b/mythtv/libs/libmythbase/mythdbcon.cpp @@ -45,8 +45,7 @@ bool TestDatabase(const QString& dbHostName, if (dbHostName.isEmpty() || dbUserName.isEmpty()) return ret; - MSqlDatabase *db = new MSqlDatabase("dbtest"); - + auto *db = new MSqlDatabase("dbtest"); if (!db) return ret; diff --git a/mythtv/libs/libmythbase/mythdbcon.h b/mythtv/libs/libmythbase/mythdbcon.h index f4f193251e0..b332af38497 100644 --- a/mythtv/libs/libmythbase/mythdbcon.h +++ b/mythtv/libs/libmythbase/mythdbcon.h @@ -71,7 +71,7 @@ class MBASE_PUBLIC MDBManager MSqlDatabase *getStaticCon(MSqlDatabase **dbcon, const QString& name); QMutex m_lock; - typedef QList DBList; + using DBList = QList; QHash m_pool; // protected by m_lock #if REUSE_CONNECTION QHash m_inuse; // protected by m_lock @@ -87,15 +87,15 @@ class MBASE_PUBLIC MDBManager }; /// \brief MSqlDatabase Info, used by MSqlQuery. Do not use directly. -typedef struct _MSqlQueryInfo +struct MSqlQueryInfo { MSqlDatabase *db; QSqlDatabase qsqldb; bool returnConnection; -} MSqlQueryInfo; +}; /// \brief typedef for a map of string -> string bindings for generic queries. -typedef QMap MSqlBindings; +using MSqlBindings = QMap; /// \brief Add the entries in addfrom to the map in output MBASE_PUBLIC void MSqlAddMoreBindings(MSqlBindings &output, MSqlBindings &addfrom); @@ -212,11 +212,11 @@ class MBASE_PUBLIC MSqlQuery : private QSqlQuery /// \brief Checks DB connection + login (login info via Mythcontext) static bool testDBConnection(); - typedef enum + enum ConnectionReuse { kDedicatedConnection, kNormalConnection, - } ConnectionReuse; + }; /// \brief Only use this in combination with MSqlQuery constructor static MSqlQueryInfo InitCon(ConnectionReuse = kNormalConnection); diff --git a/mythtv/libs/libmythbase/mythdeque.h b/mythtv/libs/libmythbase/mythdeque.h index afecc7adfd0..8d266850372 100644 --- a/mythtv/libs/libmythbase/mythdeque.h +++ b/mythtv/libs/libmythbase/mythdeque.h @@ -41,9 +41,9 @@ class MythDeque : public deque /// \brief Adds item to the back of the list. O(1). void enqueue(T d) { deque::push_back(d); } - typedef typename deque::iterator iterator; - typedef typename deque::const_iterator const_iterator; - typedef typename deque::size_type size_type; + using iterator = typename deque::iterator; + using const_iterator = typename deque::const_iterator; + using size_type = typename deque::size_type; /// \brief Finds an item in the list via linear search O(n). iterator find(T const item) diff --git a/mythtv/libs/libmythbase/mythdownloadmanager.cpp b/mythtv/libs/libmythbase/mythdownloadmanager.cpp index 6123b521fa7..24779229880 100644 --- a/mythtv/libs/libmythbase/mythdownloadmanager.cpp +++ b/mythtv/libs/libmythbase/mythdownloadmanager.cpp @@ -126,7 +126,7 @@ class RemoteFileDownloadThread : public QRunnable { bool ok = false; - RemoteFile *rf = new RemoteFile(m_dlInfo->m_url, false, false, 0); + auto *rf = new RemoteFile(m_dlInfo->m_url, false, false, 0); ok = rf->SaveAs(m_dlInfo->m_privData); delete rf; @@ -170,7 +170,7 @@ MythDownloadManager *GetMythDownloadManager(void) if (downloadManager) return downloadManager; - MythDownloadManager *tmpDLM = new MythDownloadManager(); + auto *tmpDLM = new MythDownloadManager(); tmpDLM->start(); while (!tmpDLM->getQueueThread()) usleep(10000); @@ -339,7 +339,7 @@ void MythDownloadManager::queueItem(const QString &url, QNetworkRequest *req, QObject *caller, const MRequestType reqType, const bool reload) { - MythDownloadInfo *dlInfo = new MythDownloadInfo; + auto *dlInfo = new MythDownloadInfo; dlInfo->m_url = url; dlInfo->m_request = req; @@ -374,7 +374,7 @@ bool MythDownloadManager::processItem(const QString &url, QNetworkRequest *req, const QHash *headers, QString *finalUrl) { - MythDownloadInfo *dlInfo = new MythDownloadInfo; + auto *dlInfo = new MythDownloadInfo; dlInfo->m_url = url; dlInfo->m_request = req; @@ -476,7 +476,7 @@ bool MythDownloadManager::download(const QString &url, QByteArray *data, QNetworkReply *MythDownloadManager::download(const QString &url, const bool reload) { - MythDownloadInfo *dlInfo = new MythDownloadInfo; + auto *dlInfo = new MythDownloadInfo; QNetworkReply *reply = nullptr; dlInfo->m_url = url; @@ -657,8 +657,7 @@ bool MythDownloadManager::postAuth(const QString &url, QByteArray *data, */ void MythDownloadManager::downloadRemoteFile(MythDownloadInfo *dlInfo) { - RemoteFileDownloadThread *dlThread = - new RemoteFileDownloadThread(this, dlInfo); + auto *dlThread = new RemoteFileDownloadThread(this, dlInfo); MThreadPool::globalInstance()->start(dlThread, "RemoteFileDownload"); } @@ -1607,7 +1606,7 @@ QDateTime MythDownloadManager::GetLastModified(const QString &url) if (!result.isValid()) { - MythDownloadInfo *dlInfo = new MythDownloadInfo; + auto *dlInfo = new MythDownloadInfo; dlInfo->m_url = url; dlInfo->m_syncMode = true; // Head request, we only want to inspect the headers @@ -1644,7 +1643,7 @@ void MythDownloadManager::loadCookieJar(const QString &filename) { QMutexLocker locker(&m_cookieLock); - MythCookieJar *jar = new MythCookieJar; + auto *jar = new MythCookieJar; jar->load(filename); m_manager->setCookieJar(jar); } @@ -1684,7 +1683,7 @@ QNetworkCookieJar *MythDownloadManager::copyCookieJar(void) auto inJar = dynamic_cast(m_manager->cookieJar()); if (inJar == nullptr) return nullptr; - MythCookieJar *outJar = new MythCookieJar; + auto *outJar = new MythCookieJar; outJar->copyAllCookies(*inJar); return static_cast(outJar); @@ -1702,7 +1701,7 @@ void MythDownloadManager::refreshCookieJar(QNetworkCookieJar *jar) if (inJar == nullptr) return; - MythCookieJar *outJar = new MythCookieJar; + auto *outJar = new MythCookieJar; outJar->copyAllCookies(*inJar); m_inCookieJar = static_cast(outJar); @@ -1719,7 +1718,7 @@ void MythDownloadManager::updateCookieJar(void) auto inJar = dynamic_cast(m_inCookieJar); if (inJar != nullptr) { - MythCookieJar *outJar = new MythCookieJar; + auto *outJar = new MythCookieJar; outJar->copyAllCookies(*inJar); m_manager->setCookieJar(static_cast(outJar)); } diff --git a/mythtv/libs/libmythbase/mythdownloadmanager.h b/mythtv/libs/libmythbase/mythdownloadmanager.h index 4f4fd00c96a..249be1c142f 100644 --- a/mythtv/libs/libmythbase/mythdownloadmanager.h +++ b/mythtv/libs/libmythbase/mythdownloadmanager.h @@ -21,13 +21,13 @@ class RemoteFileDownloadThread; void ShutdownMythDownloadManager(void); // TODO : Overlap/Clash with RequestType in libupnp/httprequest.h -typedef enum MRequestType { +enum MRequestType { kRequestGet, kRequestHead, kRequestPost -} MRequestType; +}; -typedef void (*AuthCallback)(QNetworkReply*, QAuthenticator*, void*); +using AuthCallback = void (*)(QNetworkReply*, QAuthenticator*, void*); class MBASE_PUBLIC MythDownloadManager : public QObject, public MThread { diff --git a/mythtv/libs/libmythbase/mythevent.h b/mythtv/libs/libmythbase/mythevent.h index aefed0d0082..03fb78164a5 100644 --- a/mythtv/libs/libmythbase/mythevent.h +++ b/mythtv/libs/libmythbase/mythevent.h @@ -122,7 +122,7 @@ class MBASE_PUBLIC MythInfoMapEvent : public MythEvent class MBASE_PUBLIC MythCallbackEvent : public QEvent { public: - typedef void (*Callback)(void*, void*, void*); + using Callback = void (*)(void*, void*, void*); MythCallbackEvent(Callback Function, void *Opaque1, void *Opaque2, void* Opaque3) : QEvent(kCallbackType), m_function(Function), diff --git a/mythtv/libs/libmythbase/mythlocale.h b/mythtv/libs/libmythbase/mythlocale.h index 6834571431a..e0054b3a916 100644 --- a/mythtv/libs/libmythbase/mythlocale.h +++ b/mythtv/libs/libmythbase/mythlocale.h @@ -43,7 +43,7 @@ class MBASE_PUBLIC MythLocale bool m_defaultsLoaded {false}; QLocale m_qtLocale; - typedef QMap SettingsMap; + using SettingsMap = QMap; SettingsMap m_globalSettings; SettingsMap m_hostSettings; }; diff --git a/mythtv/libs/libmythbase/mythmedia.h b/mythtv/libs/libmythbase/mythmedia.h index fe10f7f9ff2..aa3f3419574 100644 --- a/mythtv/libs/libmythbase/mythmedia.h +++ b/mythtv/libs/libmythbase/mythmedia.h @@ -9,7 +9,7 @@ #include "mythbaseexp.h" -typedef enum { +enum MythMediaStatus { MEDIASTAT_ERROR, ///< Unable to mount, but could be usable MEDIASTAT_UNKNOWN, MEDIASTAT_UNPLUGGED, @@ -19,9 +19,9 @@ typedef enum { MEDIASTAT_USEABLE, MEDIASTAT_NOTMOUNTED, MEDIASTAT_MOUNTED -} MythMediaStatus; +}; -typedef enum { +enum MythMediaType { MEDIATYPE_UNKNOWN = 0x0001, MEDIATYPE_DATA = 0x0002, MEDIATYPE_MIXED = 0x0004, @@ -33,17 +33,17 @@ typedef enum { MEDIATYPE_MGALLERY = 0x0100, MEDIATYPE_BD = 0x0200, MEDIATYPE_END = 0x0400, -} MythMediaType; +}; // MediaType conflicts with a definition within OSX Quicktime Libraries. -typedef enum { +enum MythMediaError { MEDIAERR_OK, MEDIAERR_FAILED, MEDIAERR_UNSUPPORTED -} MythMediaError; +}; -typedef QMap ext_cnt_t; -typedef QMap ext_to_media_t; +using ext_cnt_t = QMap; +using ext_to_media_t = QMap; class MBASE_PUBLIC MythMediaDevice : public QObject { diff --git a/mythtv/libs/libmythbase/mythmiscutil.cpp b/mythtv/libs/libmythbase/mythmiscutil.cpp index f917c3f2b46..dfa92a90bde 100644 --- a/mythtv/libs/libmythbase/mythmiscutil.cpp +++ b/mythtv/libs/libmythbase/mythmiscutil.cpp @@ -262,7 +262,7 @@ bool ping(const QString &host, int timeout) */ bool telnet(const QString &host, int port) { - MythSocket *s = new MythSocket(); + auto *s = new MythSocket(); bool connected = s->ConnectToHost(host, port); s->DecrRef(); diff --git a/mythtv/libs/libmythbase/mythmiscutil.h b/mythtv/libs/libmythbase/mythmiscutil.h index f39ff696111..e1df3c411f8 100644 --- a/mythtv/libs/libmythbase/mythmiscutil.h +++ b/mythtv/libs/libmythbase/mythmiscutil.h @@ -95,10 +95,10 @@ inline void rdtsc(uint64_t &x) QueryPerformanceCounter((LARGE_INTEGER*)(&x)); } #else -typedef struct { +struct timing_ab_t { uint a; uint b; -} timing_ab_t; +}; inline void rdtsc(uint64_t &x) { timing_ab_t &y = (timing_ab_t&) x; diff --git a/mythtv/libs/libmythbase/mythplugin.cpp b/mythtv/libs/libmythbase/mythplugin.cpp index 6d7547f076a..3a056b42e1b 100644 --- a/mythtv/libs/libmythbase/mythplugin.cpp +++ b/mythtv/libs/libmythbase/mythplugin.cpp @@ -22,9 +22,8 @@ using namespace std; int MythPlugin::init(const char *libversion) { - typedef int (*PluginInitFunc)(const char *); - PluginInitFunc ifunc = (PluginInitFunc)QLibrary::resolve("mythplugin_init"); - + using PluginInitFunc = int (*)(const char *); + auto ifunc = (PluginInitFunc)QLibrary::resolve("mythplugin_init"); if (ifunc) return ifunc(libversion); @@ -44,10 +43,10 @@ int MythPlugin::init(const char *libversion) int MythPlugin::run(void) { - typedef int (*PluginRunFunc)(); + using PluginRunFunc = int (*)(); - int rVal = -1; - PluginRunFunc rfunc = (PluginRunFunc)QLibrary::resolve("mythplugin_run"); + int rVal = -1; + auto rfunc = (PluginRunFunc)QLibrary::resolve("mythplugin_run"); if (rfunc) rVal = rfunc(); @@ -57,11 +56,10 @@ int MythPlugin::run(void) int MythPlugin::config(void) { - typedef int (*PluginConfigFunc)(); + using PluginConfigFunc = int (*)(); - int rVal = -1; - PluginConfigFunc rfunc = (PluginConfigFunc)QLibrary::resolve( - "mythplugin_config"); + int rVal = -1; + auto rfunc = (PluginConfigFunc)QLibrary::resolve("mythplugin_config"); if (rfunc) { @@ -74,8 +72,8 @@ int MythPlugin::config(void) MythPluginType MythPlugin::type(void) { - typedef MythPluginType (*PluginTypeFunc)(); - PluginTypeFunc rfunc = (PluginTypeFunc)QLibrary::resolve("mythplugin_type"); + using PluginTypeFunc = MythPluginType (*)(); + auto rfunc = (PluginTypeFunc)QLibrary::resolve("mythplugin_type"); if (rfunc) return rfunc(); @@ -85,7 +83,7 @@ MythPluginType MythPlugin::type(void) void MythPlugin::destroy(void) { - typedef void (*PluginDestFunc)(); + using PluginDestFunc = void (*)(); PluginDestFunc rfunc = QLibrary::resolve("mythplugin_destroy"); if (rfunc) diff --git a/mythtv/libs/libmythbase/mythplugin.h b/mythtv/libs/libmythbase/mythplugin.h index 0c8f1971693..46f2e52521a 100644 --- a/mythtv/libs/libmythbase/mythplugin.h +++ b/mythtv/libs/libmythbase/mythplugin.h @@ -11,9 +11,9 @@ class QSqlDatabase; class MythContext; class QPainter; -typedef enum { +enum MythPluginType { kPluginType_Module = 0 -} MythPluginType; +}; class MythPlugin : public QLibrary { diff --git a/mythtv/libs/libmythbase/mythqtcompat.h b/mythtv/libs/libmythbase/mythqtcompat.h index 759831a74ad..90d4b813d3c 100644 --- a/mythtv/libs/libmythbase/mythqtcompat.h +++ b/mythtv/libs/libmythbase/mythqtcompat.h @@ -1,6 +1,6 @@ #ifndef MYTH_QT_COMPAT_H_ #define MYTH_QT_COMPAT_H_ -typedef qintptr qt_socket_fd_t; +using qt_socket_fd_t = qintptr; #endif // MYTH_QT_COMPAT_H_ diff --git a/mythtv/libs/libmythbase/mythscheduler.h b/mythtv/libs/libmythbase/mythscheduler.h index c825648f8ab..700814acce4 100644 --- a/mythtv/libs/libmythbase/mythscheduler.h +++ b/mythtv/libs/libmythbase/mythscheduler.h @@ -9,12 +9,12 @@ class ProgramInfo; class RecordingInfo; -typedef std::deque RecList; +using RecList = std::deque; #define SORT_RECLIST(LIST, ORDER) \ do { std::stable_sort((LIST).begin(), (LIST).end(), ORDER); } while (false) -typedef RecList::const_iterator RecConstIter; -typedef RecList::iterator RecIter; +using RecConstIter = RecList::const_iterator; +using RecIter = RecList::iterator; /** This is an generic interface to a program scheduler */ class MythScheduler diff --git a/mythtv/libs/libmythbase/mythsocket.cpp b/mythtv/libs/libmythbase/mythsocket.cpp index 3ce4ca8e41e..9475b2b7520 100644 --- a/mythtv/libs/libmythbase/mythsocket.cpp +++ b/mythtv/libs/libmythbase/mythsocket.cpp @@ -564,7 +564,7 @@ bool MythSocket::IsConnected(void) const return m_connected; } -bool MythSocket::IsDataAvailable(void) const +bool MythSocket::IsDataAvailable(void) { if (QThread::currentThread() == m_thread->qthread()) return m_tcpSocket->bytesAvailable() > 0; @@ -575,7 +575,7 @@ bool MythSocket::IsDataAvailable(void) const bool ret = false; QMetaObject::invokeMethod( - const_cast(this), "IsDataAvailableReal", + this, "IsDataAvailableReal", Qt::BlockingQueuedConnection, Q_ARG(bool*, &ret)); diff --git a/mythtv/libs/libmythbase/mythsocket.h b/mythtv/libs/libmythbase/mythsocket.h index 86820de2a0d..df57b0c815c 100644 --- a/mythtv/libs/libmythbase/mythsocket.h +++ b/mythtv/libs/libmythbase/mythsocket.h @@ -57,7 +57,7 @@ class MBASE_PUBLIC MythSocket : public QObject, public ReferenceCounter bool WriteStringList(const QStringList &list); bool IsConnected(void) const; - bool IsDataAvailable(void) const; + bool IsDataAvailable(void); QHostAddress GetPeerAddress(void) const; int GetPeerPort(void) const; diff --git a/mythtv/libs/libmythbase/mythsystem.cpp b/mythtv/libs/libmythbase/mythsystem.cpp index eaf05fb876a..0e5e2e22f01 100644 --- a/mythtv/libs/libmythbase/mythsystem.cpp +++ b/mythtv/libs/libmythbase/mythsystem.cpp @@ -51,8 +51,7 @@ class MythSystemLegacyWrapper : public MythSystem if (args.empty()) return nullptr; - MythSystemLegacy *legacy = - new MythSystemLegacy(args.join(" "), flags); + auto *legacy = new MythSystemLegacy(args.join(" "), flags); if (!startPath.isEmpty()) legacy->SetDirectory(startPath); @@ -64,8 +63,7 @@ class MythSystemLegacyWrapper : public MythSystem return nullptr; } - MythSystemLegacyWrapper *wrapper = - new MythSystemLegacyWrapper(legacy, flags); + auto *wrapper = new MythSystemLegacyWrapper(legacy, flags); // TODO implement cpuPriority and diskPriority return wrapper; diff --git a/mythtv/libs/libmythbase/mythsystem.h b/mythtv/libs/libmythbase/mythsystem.h index 91a8137d270..37e3035a0b6 100644 --- a/mythtv/libs/libmythbase/mythsystem.h +++ b/mythtv/libs/libmythbase/mythsystem.h @@ -29,7 +29,7 @@ // MythTV headers #include "mythbaseexp.h" -typedef enum MythSystemMask { +enum MythSystemFlag { kMSNone = 0x00000000, kMSDontBlockInputDevs = 0x00000001, ///< avoid blocking LIRC & Joystick Menu kMSDontDisableDrawing = 0x00000002, ///< avoid disabling UI drawing @@ -49,9 +49,9 @@ typedef enum MythSystemMask { /// for the duration of application. kMSPropagateLogs = 0x00020000, ///< add arguments for MythTV log /// propagation -} MythSystemMask; +}; -typedef enum MythSignal { +enum MythSignal { kSignalNone, kSignalUnknown, kSignalHangup, @@ -64,7 +64,7 @@ typedef enum MythSignal { kSignalUser2, kSignalTerm, kSignalStop, -} MythSignal; +}; class QStringList; class QIODevice; @@ -82,7 +82,7 @@ class MBASE_PUBLIC MythSystem { public: /// Priorities that can be used for cpu and disk usage of child process - typedef enum Priority { + enum Priority { kIdlePriority = 0, ///< run only when no one else wants to kLowestPriority, kLowPriority, @@ -91,7 +91,7 @@ class MBASE_PUBLIC MythSystem kHighestPriority, kTimeCriticalPriority, kInheritPriority, ///< Use parent priority - } Priority; + }; static MythSystem *Create( const QStringList &args, diff --git a/mythtv/libs/libmythbase/mythsystemlegacy.cpp b/mythtv/libs/libmythbase/mythsystemlegacy.cpp index 3473491ffec..e7c034be94a 100644 --- a/mythtv/libs/libmythbase/mythsystemlegacy.cpp +++ b/mythtv/libs/libmythbase/mythsystemlegacy.cpp @@ -453,7 +453,7 @@ void MythSystemLegacy::HandlePostRun(void) // handler thread), we need to use postEvents if (GetSetting("DisableDrawing")) { - QEvent *event = new QEvent(MythEvent::kPopDisableDrawingEventType); + auto *event = new QEvent(MythEvent::kPopDisableDrawingEventType); QCoreApplication::postEvent(gCoreContext->GetGUIObject(), event); } @@ -461,7 +461,7 @@ void MythSystemLegacy::HandlePostRun(void) // the UDP ports before the child application has stopped and terminated if (GetSetting("DisableUDP")) { - QEvent *event = new QEvent(MythEvent::kEnableUDPListenerEventType); + auto *event = new QEvent(MythEvent::kEnableUDPListenerEventType); QCoreApplication::postEvent(gCoreContext->GetGUIObject(), event); } @@ -469,7 +469,7 @@ void MythSystemLegacy::HandlePostRun(void) // after all existing (blocked) events are processed and ignored. if (GetSetting("BlockInputDevs")) { - QEvent *event = new QEvent(MythEvent::kUnlockInputDevicesEventType); + auto *event = new QEvent(MythEvent::kUnlockInputDevicesEventType); QCoreApplication::postEvent(gCoreContext->GetGUIObject(), event); } } @@ -501,7 +501,7 @@ MythSystemLegacyPrivate::MythSystemLegacyPrivate(const QString &debugName) : uint myth_system(const QString &command, uint flags, uint timeout) { flags |= kMSRunShell | kMSAutoCleanup; - MythSystemLegacy *ms = new MythSystemLegacy(command, flags); + auto *ms = new MythSystemLegacy(command, flags); ms->Run(timeout); uint result = ms->Wait(0); if (!ms->GetSetting("RunInBackground")) diff --git a/mythtv/libs/libmythbase/mythsystemlegacy.h b/mythtv/libs/libmythbase/mythsystemlegacy.h index 5a0ae840751..eb92477fcb8 100644 --- a/mythtv/libs/libmythbase/mythsystemlegacy.h +++ b/mythtv/libs/libmythbase/mythsystemlegacy.h @@ -48,7 +48,6 @@ #include "exitcodes.h" // included for GENERIC_EXIT_OK #include "mythsystem.h" // included for MythSystemFlag and MythSignal -typedef MythSystemMask MythSystemFlag; #include #include @@ -57,8 +56,7 @@ typedef MythSystemMask MythSystemFlag; #include #include // FIXME: This shouldn't be needed, Setting_t is not public -// FIXME: _t is not how we name types in MythTV... -typedef QMap Setting_t; +using Setting = QMap; void MBASE_PUBLIC ShutdownMythSystemLegacy(void); @@ -192,7 +190,7 @@ class MBASE_PUBLIC MythSystemLegacy : public QObject int m_nice {0}; int m_ioprio {0}; - Setting_t m_settings; + Setting m_settings; QBuffer m_stdbuff[3]; }; diff --git a/mythtv/libs/libmythbase/mythsystemunix.cpp b/mythtv/libs/libmythbase/mythsystemunix.cpp index 52fba200baa..26d4cc7a20e 100644 --- a/mythtv/libs/libmythbase/mythsystemunix.cpp +++ b/mythtv/libs/libmythbase/mythsystemunix.cpp @@ -43,12 +43,12 @@ if( (x) >= 0 ) { \ (x) = -1; \ } -typedef struct +struct FDType_t { MythSystemLegacyUnix *m_ms; int m_type; -} FDType_t; -typedef QMap FDMap_t; +}; +using FDMap_t = QMap; /********************************** * MythSystemLegacyManager method defines @@ -450,7 +450,7 @@ void MythSystemLegacyManager::append(MythSystemLegacyUnix *ms) if( ms->GetSetting("UseStdout") ) { - FDType_t *fdType = new FDType_t; + auto *fdType = new FDType_t; fdType->m_ms = ms; fdType->m_type = 1; fdLock.lock(); @@ -461,7 +461,7 @@ void MythSystemLegacyManager::append(MythSystemLegacyUnix *ms) if( ms->GetSetting("UseStderr") ) { - FDType_t *fdType = new FDType_t; + auto *fdType = new FDType_t; fdType->m_ms = ms; fdType->m_type = 2; fdLock.lock(); diff --git a/mythtv/libs/libmythbase/mythsystemunix.h b/mythtv/libs/libmythbase/mythsystemunix.h index 37a52c2f7b7..1b005467316 100644 --- a/mythtv/libs/libmythbase/mythsystemunix.h +++ b/mythtv/libs/libmythbase/mythsystemunix.h @@ -23,9 +23,9 @@ class MythSystemLegacyUnix; -typedef QMap > MSMap_t; -typedef QMap PMap_t; -typedef QList > MSList_t; +using MSMap_t = QMap >; +using PMap_t = QMap; +using MSList_t = QList >; class MythSystemLegacyIOHandler: public MThread { diff --git a/mythtv/libs/libmythbase/mythsystemwindows.cpp b/mythtv/libs/libmythbase/mythsystemwindows.cpp index 2a8a1ad9377..6deab671e23 100644 --- a/mythtv/libs/libmythbase/mythsystemwindows.cpp +++ b/mythtv/libs/libmythbase/mythsystemwindows.cpp @@ -43,12 +43,12 @@ if( (x) ) { \ (x) = nullptr; \ } -typedef struct +struct FDType_t { MythSystemLegacyWindows *ms; int type; -} FDType_t; -typedef QMap FDMap_t; +}; +using FDMap_t = QMap; /********************************** * MythSystemLegacyManager method defines diff --git a/mythtv/libs/libmythbase/mythsystemwindows.h b/mythtv/libs/libmythbase/mythsystemwindows.h index dbc9dc33fef..508bd5abfae 100644 --- a/mythtv/libs/libmythbase/mythsystemwindows.h +++ b/mythtv/libs/libmythbase/mythsystemwindows.h @@ -20,9 +20,9 @@ class MythSystemLegacyWindows; -typedef QMap MSMap_t; -typedef QMap PMap_t; -typedef QList MSList_t; +using MSMap_t = QMap; +using PMap_t = QMap; +using MSList_t = QList; class MythSystemLegacyIOHandler: public MThread { diff --git a/mythtv/libs/libmythbase/mythtimer.cpp b/mythtv/libs/libmythbase/mythtimer.cpp index 1d1f40a7cbc..eca2ceda7a7 100644 --- a/mythtv/libs/libmythbase/mythtimer.cpp +++ b/mythtv/libs/libmythbase/mythtimer.cpp @@ -87,7 +87,7 @@ void MythTimer::stop(void) * \note If addMSecs() has been called and the total offset applied * is negative then this can return a negative number. */ -int MythTimer::elapsed(void) const +int MythTimer::elapsed(void) { if (!m_timer.isValid()) { @@ -100,7 +100,7 @@ int MythTimer::elapsed(void) const qint64 e = m_timer.elapsed(); if (!QElapsedTimer::isMonotonic() && (e > 86300000)) { - const_cast(this)->start(); + start(); e = 0; } diff --git a/mythtv/libs/libmythbase/mythtimer.h b/mythtv/libs/libmythbase/mythtimer.h index 93659603e84..0c0174d1cf7 100644 --- a/mythtv/libs/libmythbase/mythtimer.h +++ b/mythtv/libs/libmythbase/mythtimer.h @@ -13,10 +13,10 @@ class MBASE_PUBLIC MythTimer { public: - typedef enum { + enum StartState { kStartRunning, kStartInactive, - } StartState; + }; explicit MythTimer(StartState state = kStartInactive); @@ -26,7 +26,7 @@ class MBASE_PUBLIC MythTimer void addMSecs(int ms); - int elapsed(void) const; + int elapsed(void); int64_t nsecsElapsed(void) const; bool isRunning(void) const; diff --git a/mythtv/libs/libmythbase/mythtimezone.cpp b/mythtv/libs/libmythbase/mythtimezone.cpp index f18f596bb75..708155a99f7 100644 --- a/mythtv/libs/libmythbase/mythtimezone.cpp +++ b/mythtv/libs/libmythbase/mythtimezone.cpp @@ -242,8 +242,7 @@ static QString getSystemTimeZoneID(void) // least get the zone name/abbreviation (as opposed to the // identifier for the set of rules governing the zone) char name[64]; - struct tm *result = (struct tm *)malloc(sizeof(*result)); - + auto *result = (struct tm *)malloc(sizeof(struct tm)); if (result != nullptr) { time_t t = time(nullptr); diff --git a/mythtv/libs/libmythbase/mythtranslation.cpp b/mythtv/libs/libmythbase/mythtranslation.cpp index c5680abf267..22991c7c998 100644 --- a/mythtv/libs/libmythbase/mythtranslation.cpp +++ b/mythtv/libs/libmythbase/mythtranslation.cpp @@ -11,7 +11,7 @@ #include "mythdirs.h" #include "mythcorecontext.h" -typedef QMap TransMap; +using TransMap = QMap; class MythTranslationPrivate { @@ -55,7 +55,7 @@ void MythTranslation::load(const QString &module_name) lang = "en_us"; } - QTranslator *trans = new QTranslator(nullptr); + auto *trans = new QTranslator(nullptr); if (trans->load(GetTranslationsDir() + module_name + "_" + lang + ".qm", ".")) { diff --git a/mythtv/libs/libmythbase/mythtypes.h b/mythtv/libs/libmythbase/mythtypes.h index 1d90ca9dac8..bf3ea9e2af0 100644 --- a/mythtv/libs/libmythbase/mythtypes.h +++ b/mythtv/libs/libmythbase/mythtypes.h @@ -12,7 +12,7 @@ #include #include "mythbaseexp.h" -typedef QHash InfoMap; +using InfoMap = QHash; QString InfoMapToString(const InfoMap &infoMap, const QString &sep="\n"); diff --git a/mythtv/libs/libmythbase/platforms/mythpowerdbus.cpp b/mythtv/libs/libmythbase/platforms/mythpowerdbus.cpp index 15886950926..ce92f6185f7 100644 --- a/mythtv/libs/libmythbase/platforms/mythpowerdbus.cpp +++ b/mythtv/libs/libmythbase/platforms/mythpowerdbus.cpp @@ -46,9 +46,9 @@ bool MythPowerDBus::IsAvailable(void) if (!checked) { checked = true; - QDBusInterface* upower = new QDBusInterface( + auto* upower = new QDBusInterface( UPOWER_SERVICE, UPOWER_PATH, UPOWER_INTERFACE, QDBusConnection::systemBus()); - QDBusInterface* login1 = new QDBusInterface( + auto* login1 = new QDBusInterface( LOGIN1_SERVICE, LOGIN1_PATH, LOGIN1_INTERFACE, QDBusConnection::systemBus()); available = upower->isValid() || login1->isValid(); delete upower; @@ -297,7 +297,7 @@ bool MythPowerDBus::ScheduleFeature(enum Feature Type, uint Delay) struct timespec time {}; if (clock_gettime(CLOCK_REALTIME, &time) == 0) { - quint64 nanosecs = static_cast((time.tv_sec * 1000000000) + + auto nanosecs = static_cast((time.tv_sec * 1000000000) + time.tv_nsec + (Delay * 1000000000)); QLatin1String type; switch (Type) diff --git a/mythtv/libs/libmythbase/referencecounterlist.h b/mythtv/libs/libmythbase/referencecounterlist.h index c0be78003ee..b21157ba96d 100644 --- a/mythtv/libs/libmythbase/referencecounterlist.h +++ b/mythtv/libs/libmythbase/referencecounterlist.h @@ -171,6 +171,6 @@ class RefCountedList : public QList > RefCountedList(const RefCountedList&) = default; }; -typedef RefCountedList ReferenceCounterList; +using ReferenceCounterList = RefCountedList; #endif /* defined(__MythTV__referencecounterlist__) */ diff --git a/mythtv/libs/libmythbase/remotefile.cpp b/mythtv/libs/libmythbase/remotefile.cpp index b460d4216b3..d75a87ab35a 100644 --- a/mythtv/libs/libmythbase/remotefile.cpp +++ b/mythtv/libs/libmythbase/remotefile.cpp @@ -137,7 +137,7 @@ MythSocket *RemoteFile::openSocket(bool control) QString sgroup = qurl.userName(); - MythSocket *lsock = new MythSocket(); + auto *lsock = new MythSocket(); QString stype = (control) ? "control socket" : "file data socket"; QString loc = QString("RemoteFile::openSocket(%1): ").arg(stype); diff --git a/mythtv/libs/libmythbase/serverpool.cpp b/mythtv/libs/libmythbase/serverpool.cpp index 41abd46a649..379bbcb3f68 100644 --- a/mythtv/libs/libmythbase/serverpool.cpp +++ b/mythtv/libs/libmythbase/serverpool.cpp @@ -396,7 +396,7 @@ bool ServerPool::listen(QList addrs, quint16 port, && ! gCoreContext->GetBoolSetting("IPv6Support",true)) continue; - PrivTcpServer *server = new PrivTcpServer(this, servertype); + auto *server = new PrivTcpServer(this, servertype); connect(server, &PrivTcpServer::newConnection, this, &ServerPool::newTcpConnection); @@ -525,7 +525,7 @@ bool ServerPool::bind(QList addrs, quint16 port, } } - PrivUdpSocket *socket = new PrivUdpSocket(this, host); + auto *socket = new PrivUdpSocket(this, host); if (socket->bind(*it, port)) { @@ -631,11 +631,11 @@ void ServerPool::newTcpConnection(qt_socket_fd_t socket) { // Ignore connections from an SSL server for now, these are only handled // by HttpServer which overrides newTcpConnection - PrivTcpServer *server = dynamic_cast(QObject::sender()); + auto *server = dynamic_cast(QObject::sender()); if (!server || server->GetServerType() == kSSLServer) return; - QTcpSocket *qsock = new QTcpSocket(this); + auto *qsock = new QTcpSocket(this); if (qsock->setSocketDescriptor(socket) && gCoreContext->CheckSubnet(qsock)) { @@ -647,7 +647,7 @@ void ServerPool::newTcpConnection(qt_socket_fd_t socket) void ServerPool::newUdpDatagram(void) { - QUdpSocket *socket = dynamic_cast(sender()); + auto *socket = dynamic_cast(sender()); while (socket->state() == QAbstractSocket::BoundState && socket->hasPendingDatagrams()) diff --git a/mythtv/libs/libmythbase/serverpool.h b/mythtv/libs/libmythbase/serverpool.h index fd422be88b6..e40956127f2 100644 --- a/mythtv/libs/libmythbase/serverpool.h +++ b/mythtv/libs/libmythbase/serverpool.h @@ -26,12 +26,12 @@ class PrivUdpSocket; -typedef enum PoolServerTypes +enum PoolServerType { kTCPServer, kUDPServer, kSSLServer -} PoolServerType; +}; // Making a 'Priv' server public is a contradiction, it was this or passing // through the server type in the newConnection signal which would have required diff --git a/mythtv/libs/libmythbase/signalhandling.cpp b/mythtv/libs/libmythbase/signalhandling.cpp index 7f1d4771c3a..c36dbd09e14 100644 --- a/mythtv/libs/libmythbase/signalhandling.cpp +++ b/mythtv/libs/libmythbase/signalhandling.cpp @@ -194,13 +194,13 @@ void SignalHandler::SetHandlerPrivate(int signum, SigHandlerFunc handler) #endif } -typedef struct { +struct SignalInfo { int m_signum; int m_code; int m_pid; int m_uid; uint64_t m_value; -} SignalInfo; +}; void SignalHandler::signalHandler(int signum, siginfo_t *info, void *context) { diff --git a/mythtv/libs/libmythbase/signalhandling.h b/mythtv/libs/libmythbase/signalhandling.h index e0f2edf6a55..37fb06c44fb 100644 --- a/mythtv/libs/libmythbase/signalhandling.h +++ b/mythtv/libs/libmythbase/signalhandling.h @@ -16,10 +16,10 @@ #ifdef _WIN32 // Quick fix to let this compile for Windows: we have it disabled on the // calling side for Windows anyways, IIRC. -typedef void siginfo_t; +using siginfo_t = void; #endif -typedef void (*SigHandlerFunc)(void); +using SigHandlerFunc = void (*)(void); /// \brief A container object to handle UNIX signals in the Qt space correctly class MBASE_PUBLIC SignalHandler: public QObject diff --git a/mythtv/libs/libmythbase/test/test_mythsorthelper/test_mythsorthelper.cpp b/mythtv/libs/libmythbase/test/test_mythsorthelper/test_mythsorthelper.cpp index ac823b62c34..1d76ed6520f 100644 --- a/mythtv/libs/libmythbase/test/test_mythsorthelper/test_mythsorthelper.cpp +++ b/mythtv/libs/libmythbase/test/test_mythsorthelper/test_mythsorthelper.cpp @@ -56,10 +56,8 @@ void TestSortHelper::titles_timing(void) QFETCH(int, sensitive); QFETCH(int, disposition); QFETCH(QString, exclusions); - MythSortHelper *sh = - new MythSortHelper(static_cast(sensitive), - static_cast(disposition), - ""); + auto *sh = new MythSortHelper(static_cast(sensitive), + static_cast(disposition), ""); QBENCHMARK { QString title = sh->doTitle("The Flash"); } @@ -77,10 +75,8 @@ void TestSortHelper::pathnames_timing(void) QFETCH(int, disposition); QFETCH(QString, exclusions); - MythSortHelper *sh = - new MythSortHelper(static_cast(sensitive), - static_cast(disposition), - ""); + auto *sh = new MythSortHelper(static_cast(sensitive), + static_cast(disposition), ""); QBENCHMARK { QString title = sh->doPathname("dvds/The Flash/Season 2/The Flash - S02E01.ts"); } diff --git a/mythtv/libs/libmythbase/unzip.cpp b/mythtv/libs/libmythbase/unzip.cpp index 78ec227d40b..27047f7c6db 100644 --- a/mythtv/libs/libmythbase/unzip.cpp +++ b/mythtv/libs/libmythbase/unzip.cpp @@ -227,7 +227,7 @@ bool UnZip::isOpen() const */ UnZip::ErrorCode UnZip::openArchive(const QString& filename) { - QFile* file = new QFile(filename); + auto* file = new QFile(filename); if (!file->exists()) { delete file; @@ -924,7 +924,7 @@ UnZip::ErrorCode UnzipPrivate::parseCentralDirectoryRecord() QString filename = QString::fromLatin1(buffer2, szName); - ZipEntryP* h = new ZipEntryP; + auto* h = new ZipEntryP; h->compMethod = compMethod; h->gpFlag[0] = buffer1[UNZIP_CD_OFF_GPFLAG]; @@ -1245,7 +1245,7 @@ bool UnzipPrivate::createDirectory(const QString& path) */ quint32 UnzipPrivate::getULong(const unsigned char* data, quint32 offset) { - quint32 res = (quint32) data[offset]; + auto res = (quint32) data[offset]; res |= (((quint32)data[offset+1]) << 8); res |= (((quint32)data[offset+2]) << 16); res |= (((quint32)data[offset+3]) << 24); @@ -1258,7 +1258,7 @@ quint32 UnzipPrivate::getULong(const unsigned char* data, quint32 offset) */ quint64 UnzipPrivate::getULLong(const unsigned char* data, quint32 offset) { - quint64 res = (quint64) data[offset]; + auto res = (quint64) data[offset]; res |= (((quint64)data[offset+1]) << 8); res |= (((quint64)data[offset+2]) << 16); res |= (((quint64)data[offset+3]) << 24); diff --git a/mythtv/libs/libmythbase/verbosedefs.h b/mythtv/libs/libmythbase/verbosedefs.h index 20d253ff771..e0b41bd9606 100644 --- a/mythtv/libs/libmythbase/verbosedefs.h +++ b/mythtv/libs/libmythbase/verbosedefs.h @@ -71,7 +71,7 @@ #endif #define LOGLEVEL_PREAMBLE \ - typedef enum { + typedef enum { //NOLINT(modernize-use-using) included from C code #define LOGLEVEL_POSTAMBLE \ } LogLevel_t; #define LOGLEVEL_MAP(name,value,shortname) \ diff --git a/mythtv/libs/libmythfreemheg/BaseClasses.cpp b/mythtv/libs/libmythfreemheg/BaseClasses.cpp index 1245c665392..50e63f8b11c 100644 --- a/mythtv/libs/libmythfreemheg/BaseClasses.cpp +++ b/mythtv/libs/libmythfreemheg/BaseClasses.cpp @@ -219,7 +219,7 @@ void MHOctetString::Append(const MHOctetString &str) int newLen = m_nLength + str.m_nLength; // Allocate a new string big enough to contain both and initialised to the first string. - unsigned char *p = (unsigned char *)realloc(m_pChars, newLen); + auto *p = (unsigned char *)realloc(m_pChars, newLen); if (p == nullptr) { diff --git a/mythtv/libs/libmythfreemheg/DynamicLineArt.cpp b/mythtv/libs/libmythfreemheg/DynamicLineArt.cpp index 55efaf6cf97..f8c5644f42b 100644 --- a/mythtv/libs/libmythfreemheg/DynamicLineArt.cpp +++ b/mythtv/libs/libmythfreemheg/DynamicLineArt.cpp @@ -184,7 +184,7 @@ void MHDrawPoly::Initialise(MHParseNode *p, MHEngine *engine) for (int i = 0; i < args->GetSeqCount(); i++) { - MHPointArg *pPoint = new MHPointArg; + auto *pPoint = new MHPointArg; m_Points.Append(pPoint); pPoint->Initialise(args->GetSeqN(i), engine); } diff --git a/mythtv/libs/libmythfreemheg/Engine.cpp b/mythtv/libs/libmythfreemheg/Engine.cpp index 246d86ef311..63c138c828e 100644 --- a/mythtv/libs/libmythfreemheg/Engine.cpp +++ b/mythtv/libs/libmythfreemheg/Engine.cpp @@ -48,7 +48,7 @@ MHEG *MHCreateEngine(MHContext *context) MHEngine::MHEngine(MHContext *context): m_Context(context) { // Required for BBC Freeview iPlayer - MHPSEntry *pEntry = new MHPSEntry; + auto *pEntry = new MHPSEntry; pEntry->m_FileName.Copy("ram://bbcipstr"); pEntry->m_Data.Append(new MHUnion(true)); // Default true // The next value must be true to enable Freeview interaction channel @@ -293,7 +293,7 @@ bool MHEngine::Launch(const MHObjectRef &target, bool fIsSpawn) return false; } - MHApplication *pProgram = dynamic_cast(ParseProgram(text)); + auto *pProgram = dynamic_cast(ParseProgram(text)); if (! pProgram) { MHLOG(MHLogWarning, "Empty application"); @@ -685,7 +685,7 @@ void MHEngine::EventTriggered(MHRoot *pSource, enum EventType ev, const MHUnion default: { // Asynchronous events. Add to the event queue. - MHAsynchEvent *pEvent = new MHAsynchEvent; + auto *pEvent = new MHAsynchEvent; pEvent->m_pEventSource = pSource; pEvent->m_eventType = ev; pEvent->m_eventData = evData; @@ -766,7 +766,7 @@ void MHEngine::BringToFront(const MHRoot *p) return; // If it's not there do nothing } - MHVisible *pVis = (MHVisible *)p; // Can now safely cast it. + auto *pVis = (MHVisible *)p; // Can now safely cast it. CurrentApp()->m_DisplayStack.RemoveAt(nPos); // Remove it from its present posn CurrentApp()->m_DisplayStack.Append(pVis); // Push it on the top. Redraw(pVis->GetVisibleArea()); // Request a redraw @@ -781,7 +781,7 @@ void MHEngine::SendToBack(const MHRoot *p) return; // If it's not there do nothing } - MHVisible *pVis = (MHVisible *)p; // Can now safely cast it. + auto *pVis = (MHVisible *)p; // Can now safely cast it. CurrentApp()->m_DisplayStack.RemoveAt(nPos); // Remove it from its present posn CurrentApp()->m_DisplayStack.InsertAt(pVis, 0); // Put it on the bottom. Redraw(pVis->GetVisibleArea()); // Request a redraw @@ -796,7 +796,7 @@ void MHEngine::PutBefore(const MHRoot *p, const MHRoot *pRef) return; // If it's not there do nothing } - MHVisible *pVis = (MHVisible *)p; // Can now safely cast it. + auto *pVis = (MHVisible *)p; // Can now safely cast it. int nRef = CurrentApp()->FindOnStack(pRef); if (nRef == -1) @@ -834,7 +834,7 @@ void MHEngine::PutBehind(const MHRoot *p, const MHRoot *pRef) return; // If the reference visible isn't there do nothing. } - MHVisible *pVis = (MHVisible *)p; // Can now safely cast it. + auto *pVis = (MHVisible *)p; // Can now safely cast it. CurrentApp()->m_DisplayStack.RemoveAt(nPos); if (nRef >= nPos) @@ -1016,7 +1016,7 @@ void MHEngine::RequestExternalContent(MHIngredient *pRequester) // Need to record this and check later. MHLOG(MHLogNotifications, QString("Waiting for %1 <= %2") .arg(pRequester->m_ObjectReference.Printable()).arg(csPath.left(128)) ); - MHExternContent *pContent = new MHExternContent; + auto *pContent = new MHExternContent; pContent->m_FileName = csPath; pContent->m_pRequester = pRequester; pContent->m_time.start(); @@ -1173,7 +1173,7 @@ bool MHEngine::LoadStorePersistent(bool fIsLoad, const MHOctetString &fileName, // Set the store to the values. for (i = 0; i < variables.Size(); i++) { - MHUnion *pValue = new MHUnion; + auto *pValue = new MHUnion; pEntry->m_Data.Append(pValue); FindObject(*(variables.GetAt(i)))->GetVariableValue(*pValue, this); MHLOG(MHLogNotifications, QString("Store Persistent(%1) %2=>#%3") diff --git a/mythtv/libs/libmythfreemheg/Groups.cpp b/mythtv/libs/libmythfreemheg/Groups.cpp index 9cfc5ebb1c8..d34dbd31a4d 100644 --- a/mythtv/libs/libmythfreemheg/Groups.cpp +++ b/mythtv/libs/libmythfreemheg/Groups.cpp @@ -371,7 +371,7 @@ void MHGroup::SetTimer(int nTimerId, bool fAbsolute, int nMilliSecs, MHEngine * return; } - MHTimer *pTimer = new MHTimer; + auto *pTimer = new MHTimer; m_Timers.append(pTimer); pTimer->m_nTimerId = nTimerId; @@ -920,7 +920,7 @@ void MHPersistent::Initialise(MHParseNode *p, MHEngine *engine) for (int i = 0; i < pVarSeq->GetSeqCount(); i++) { - MHObjectRef *pVar = new MHObjectRef; + auto *pVar = new MHObjectRef; m_Variables.Append(pVar); pVar->Initialise(pVarSeq->GetSeqN(i), engine); } diff --git a/mythtv/libs/libmythfreemheg/ParseBinary.cpp b/mythtv/libs/libmythfreemheg/ParseBinary.cpp index 1a1a702d222..e4e58e82ed8 100644 --- a/mythtv/libs/libmythfreemheg/ParseBinary.cpp +++ b/mythtv/libs/libmythfreemheg/ParseBinary.cpp @@ -58,7 +58,7 @@ void MHParseBinary::ParseString(int endStr, MHOctetString &str) } int nLength = endStr - m_p; - unsigned char *stringValue = (unsigned char *)malloc(nLength + 1); + auto *stringValue = (unsigned char *)malloc(nLength + 1); if (stringValue == nullptr) { MHERROR("Out of memory"); @@ -181,7 +181,7 @@ MHParseNode *MHParseBinary::DoParse() if (tagClass == Context) { - MHPTagged *pNode = new MHPTagged(tagNumber); + auto *pNode = new MHPTagged(tagNumber); try { @@ -343,7 +343,7 @@ MHParseNode *MHParseBinary::DoParse() } case U_SEQUENCE: // Sequence { - MHParseSequence *pNode = new MHParseSequence(); + auto *pNode = new MHParseSequence(); if (endOfItem == INDEFINITE_LENGTH) { diff --git a/mythtv/libs/libmythfreemheg/ParseNode.cpp b/mythtv/libs/libmythfreemheg/ParseNode.cpp index 98e2c52c96f..71f08b5b665 100644 --- a/mythtv/libs/libmythfreemheg/ParseNode.cpp +++ b/mythtv/libs/libmythfreemheg/ParseNode.cpp @@ -61,12 +61,12 @@ int MHParseNode::GetArgCount() { if (m_nNodeType == PNTagged) { - MHPTagged *pTag = (MHPTagged *)this; + auto *pTag = (MHPTagged *)this; return pTag->m_Args.Size(); } if (m_nNodeType == PNSeq) { - MHParseSequence *pSeq = (MHParseSequence *)this; + auto *pSeq = (MHParseSequence *)this; return pSeq->Size(); } @@ -79,7 +79,7 @@ MHParseNode *MHParseNode::GetArgN(int n) { if (m_nNodeType == PNTagged) { - MHPTagged *pTag = (MHPTagged *)this; + auto *pTag = (MHPTagged *)this; if (n < 0 || n >= pTag->m_Args.Size()) { @@ -90,7 +90,7 @@ MHParseNode *MHParseNode::GetArgN(int n) } if (m_nNodeType == PNSeq) { - MHParseSequence *pSeq = (MHParseSequence *)this; + auto *pSeq = (MHParseSequence *)this; if (n < 0 || n >= pSeq->Size()) { @@ -145,7 +145,7 @@ int MHParseNode::GetSeqCount() Failure("Expected sequence"); } - MHParseSequence *pSeq = (MHParseSequence *)this; + auto *pSeq = (MHParseSequence *)this; return pSeq->Size(); } @@ -156,7 +156,7 @@ MHParseNode *MHParseNode::GetSeqN(int n) Failure("Expected sequence"); } - MHParseSequence *pSeq = (MHParseSequence *)this; + auto *pSeq = (MHParseSequence *)this; if (n < 0 || n >= pSeq->Size()) { diff --git a/mythtv/libs/libmythfreemheg/ParseText.cpp b/mythtv/libs/libmythfreemheg/ParseText.cpp index d4b82cd205e..88c6c9aa205 100644 --- a/mythtv/libs/libmythfreemheg/ParseText.cpp +++ b/mythtv/libs/libmythfreemheg/ParseText.cpp @@ -466,7 +466,7 @@ void MHParseText::NextSym() } // We grow the buffer to the largest string in the input. - unsigned char *str = (unsigned char *)realloc(m_String, m_nStringLength + 2); + auto *str = (unsigned char *)realloc(m_String, m_nStringLength + 2); if (str == nullptr) { @@ -568,7 +568,7 @@ void MHParseText::NextSym() } // We grow the buffer to the largest string in the input. - unsigned char *str = (unsigned char *)realloc(m_String, m_nStringLength + 2); + auto *str = (unsigned char *)realloc(m_String, m_nStringLength + 2); if (str == nullptr) { @@ -785,7 +785,7 @@ void MHParseText::NextSym() if (stricmp(buff, colourTable[i].m_name) == 0) { m_nType = PTString; - unsigned char *str = (unsigned char *)realloc(m_String, 4 + 1); + auto *str = (unsigned char *)realloc(m_String, 4 + 1); if (str == nullptr) { @@ -858,7 +858,7 @@ MHParseNode *MHParseText::DoParse() Error("Expected ':' after '{'"); } - MHPTagged *pTag = new MHPTagged(m_nTag); + auto *pTag = new MHPTagged(m_nTag); pRes = pTag; NextSym(); @@ -874,7 +874,7 @@ MHParseNode *MHParseText::DoParse() case PTTag: // Tag on its own. { int nTag = m_nTag; - MHPTagged *pTag = new MHPTagged(nTag); + auto *pTag = new MHPTagged(nTag); pRes = pTag; NextSym(); @@ -1081,7 +1081,7 @@ MHParseNode *MHParseText::DoParse() case PTStartSeq: // Open parenthesis. { - MHParseSequence *pSeq = new MHParseSequence; + auto *pSeq = new MHParseSequence; pRes = pSeq; NextSym(); diff --git a/mythtv/libs/libmythfreemheg/Programs.cpp b/mythtv/libs/libmythfreemheg/Programs.cpp index 453a0c20ef1..fa9132669fb 100644 --- a/mythtv/libs/libmythfreemheg/Programs.cpp +++ b/mythtv/libs/libmythfreemheg/Programs.cpp @@ -1071,7 +1071,7 @@ void MHCall::Initialise(MHParseNode *p, MHEngine *engine) for (int i = 0; i < args->GetSeqCount(); i++) { - MHParameter *pParm = new MHParameter; + auto *pParm = new MHParameter; m_Parameters.Append(pParm); pParm->Initialise(args->GetSeqN(i), engine); } diff --git a/mythtv/libs/libmythfreemheg/Stream.cpp b/mythtv/libs/libmythfreemheg/Stream.cpp index 83a05fc0de7..1218512bcef 100644 --- a/mythtv/libs/libmythfreemheg/Stream.cpp +++ b/mythtv/libs/libmythfreemheg/Stream.cpp @@ -43,19 +43,19 @@ void MHStream::Initialise(MHParseNode *p, MHEngine *engine) if (pItem->GetTagNo() == C_AUDIO) { - MHAudio *pAudio = new MHAudio; + auto *pAudio = new MHAudio; m_Multiplex.Append(pAudio); pAudio->Initialise(pItem, engine); } else if (pItem->GetTagNo() == C_VIDEO) { - MHVideo *pVideo = new MHVideo; + auto *pVideo = new MHVideo; m_Multiplex.Append(pVideo); pVideo->Initialise(pItem, engine); } else if (pItem->GetTagNo() == C_RTGRAPHICS) { - MHRTGraphics *pRtGraph = new MHRTGraphics; + auto *pRtGraph = new MHRTGraphics; m_Multiplex.Append(pRtGraph); pRtGraph->Initialise(pItem, engine); } diff --git a/mythtv/libs/libmythfreemheg/Stream.h b/mythtv/libs/libmythfreemheg/Stream.h index 37c72a88905..e58c79147d4 100644 --- a/mythtv/libs/libmythfreemheg/Stream.h +++ b/mythtv/libs/libmythfreemheg/Stream.h @@ -196,7 +196,7 @@ class MHSetCounterPosition: public MHActionInt class MHSetSpeed: public MHElemAction { - typedef MHElemAction base; + using base = MHElemAction; public: MHSetSpeed(): base(":SetSpeed") {} void Initialise(MHParseNode *p, MHEngine *engine) override { // MHElemAction diff --git a/mythtv/libs/libmythfreemheg/Text.cpp b/mythtv/libs/libmythfreemheg/Text.cpp index b15dbed0586..15a494d4d9b 100644 --- a/mythtv/libs/libmythfreemheg/Text.cpp +++ b/mythtv/libs/libmythfreemheg/Text.cpp @@ -491,7 +491,7 @@ MHTextItem::MHTextItem() MHTextItem *MHTextItem::NewItem() { - MHTextItem *pItem = new MHTextItem; + auto *pItem = new MHTextItem; pItem->m_colour = m_colour; return pItem; } @@ -555,8 +555,8 @@ void MHText::Redraw() // Process any escapes in the text and construct the text arrays. MHSequence theText; // Set up the first item on the first line. - MHTextItem *pCurrItem = new MHTextItem; - MHTextLine *pCurrLine = new MHTextLine; + auto *pCurrItem = new MHTextItem; + auto *pCurrLine = new MHTextLine; pCurrLine->m_items.Append(pCurrItem); theText.Append(pCurrLine); MHStack colourStack; // Stack to handle nested colour codes. @@ -745,7 +745,7 @@ void MHText::Redraw() if (nNewWidth != 0) { // Create a new line from the extra text. - MHTextLine *pNewLine = new MHTextLine; + auto *pNewLine = new MHTextLine; theText.InsertAt(pNewLine, i + 1); // The first item on the new line is the rest of the text. MHTextItem *pNewItem = pItem->NewItem(); diff --git a/mythtv/libs/libmythfreemheg/TokenGroup.cpp b/mythtv/libs/libmythfreemheg/TokenGroup.cpp index 3a980dcc22b..0d8da5f2ea9 100644 --- a/mythtv/libs/libmythfreemheg/TokenGroup.cpp +++ b/mythtv/libs/libmythfreemheg/TokenGroup.cpp @@ -41,7 +41,7 @@ void MHTokenGroupItem::Initialise(MHParseNode *p, MHEngine *engine) for (int i = 0; i < pSlots->GetSeqCount(); i++) { MHParseNode *pAct = pSlots->GetSeqN(i); - MHActionSequence *pActions = new MHActionSequence; + auto *pActions = new MHActionSequence; m_ActionSlots.Append(pActions); // The action slot entry may be NULL. @@ -123,7 +123,7 @@ void MHTokenGroup::Initialise(MHParseNode *p, MHEngine *engine) { for (int i = 0; i < pMovements->GetArgCount(); i++) { - MHMovement *pMove = new MHMovement; + auto *pMove = new MHMovement; m_MovementTable.Append(pMove); pMove->Initialise(pMovements->GetArgN(i), engine); } @@ -135,7 +135,7 @@ void MHTokenGroup::Initialise(MHParseNode *p, MHEngine *engine) { for (int i = 0; i < pTokenGrp->GetArgCount(); i++) { - MHTokenGroupItem *pToken = new MHTokenGroupItem; + auto *pToken = new MHTokenGroupItem; m_TokenGrpItems.Append(pToken); pToken->Initialise(pTokenGrp->GetArgN(i), engine); } @@ -148,7 +148,7 @@ void MHTokenGroup::Initialise(MHParseNode *p, MHEngine *engine) for (int i = 0; i < pNoToken->GetArgCount(); i++) { MHParseNode *pAct = pNoToken->GetArgN(i); - MHActionSequence *pActions = new MHActionSequence; + auto *pActions = new MHActionSequence; m_NoTokenActionSlots.Append(pActions); // The action slot entry may be NULL. diff --git a/mythtv/libs/libmythfreesurround/el_processor.cpp b/mythtv/libs/libmythfreesurround/el_processor.cpp index 3e141733e86..19b67b5b6d1 100644 --- a/mythtv/libs/libmythfreesurround/el_processor.cpp +++ b/mythtv/libs/libmythfreesurround/el_processor.cpp @@ -29,7 +29,7 @@ extern "C" { #include "libavcodec/avfft.h" #include "libavcodec/fft.h" } -typedef FFTSample FFTComplexArray[2]; +using FFTComplexArray = FFTSample[2]; #endif @@ -37,7 +37,7 @@ typedef FFTSample FFTComplexArray[2]; #pragma comment (lib,"libfftw3f-3.lib") #endif -typedef std::complex cfloat; +using cfloat = std::complex; static const float PI = 3.141592654; static const float epsilon = 0.000001; diff --git a/mythtv/libs/libmythfreesurround/freesurround.cpp b/mythtv/libs/libmythfreesurround/freesurround.cpp index 3d1f096871d..78da10a6965 100644 --- a/mythtv/libs/libmythfreesurround/freesurround.cpp +++ b/mythtv/libs/libmythfreesurround/freesurround.cpp @@ -163,7 +163,7 @@ uint FreeSurround::putFrames(void* buffer, uint numFrames, uint numChannels) int ic = in_count; int bs = block_size/2; bool process = true; - float *samples = (float *)buffer; + auto *samples = (float *)buffer; // demultiplex float **inputs = decoder->getInputBuffers(); @@ -327,7 +327,7 @@ uint FreeSurround::receiveFrames(void *buffer, uint maxFrames) uint oc = out_count; if (maxFrames > oc) maxFrames = oc; uint outindex = processed_size - oc; - float *output = (float *)buffer; + auto *output = (float *)buffer; if (channels == 8) { float *l = &bufs->m_l[outindex]; diff --git a/mythtv/libs/libmythfreesurround/freesurround.h b/mythtv/libs/libmythfreesurround/freesurround.h index 6a29937a65f..11c2dac53dc 100644 --- a/mythtv/libs/libmythfreesurround/freesurround.h +++ b/mythtv/libs/libmythfreesurround/freesurround.h @@ -26,13 +26,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class FreeSurround { public: - typedef enum + enum SurroundMode { SurroundModePassive, SurroundModeActiveSimple, SurroundModeActiveLinear, SurroundModePassiveHall - } SurroundMode; + }; public: FreeSurround(uint srate, bool moviemode, SurroundMode mode); ~FreeSurround(); diff --git a/mythtv/libs/libmythmetadata/bluraymetadata.h b/mythtv/libs/libmythmetadata/bluraymetadata.h index b281f6c8501..851c63255fb 100644 --- a/mythtv/libs/libmythmetadata/bluraymetadata.h +++ b/mythtv/libs/libmythmetadata/bluraymetadata.h @@ -11,7 +11,7 @@ class QStringList; -typedef QList< QPair < uint,QString > > BlurayTitles; +using BlurayTitles = QList< QPair < uint,QString > >; struct meta_dl; class META_PUBLIC BlurayMetadata : public QObject diff --git a/mythtv/libs/libmythmetadata/cleanup.cpp b/mythtv/libs/libmythmetadata/cleanup.cpp index ec82bda508a..7b88ab821f8 100644 --- a/mythtv/libs/libmythmetadata/cleanup.cpp +++ b/mythtv/libs/libmythmetadata/cleanup.cpp @@ -6,7 +6,7 @@ class CleanupHooksImp { private: - typedef std::list clean_list; + using clean_list = std::list; private: clean_list m_cleanList; @@ -19,8 +19,7 @@ class CleanupHooksImp void removeHook(CleanupProc *clean_proc) { - clean_list::iterator p = std::find(m_cleanList.begin(), - m_cleanList.end(), clean_proc); + auto p = std::find(m_cleanList.begin(), m_cleanList.end(), clean_proc); if (p != m_cleanList.end()) { m_cleanList.erase(p); @@ -29,8 +28,7 @@ class CleanupHooksImp void cleanup() { - for (clean_list::iterator p = m_cleanList.begin(); - p != m_cleanList.end();++p) + for (auto p = m_cleanList.begin(); p != m_cleanList.end(); ++p) { (*p)->doClean(); } diff --git a/mythtv/libs/libmythmetadata/dbaccess.cpp b/mythtv/libs/libmythmetadata/dbaccess.cpp index ecca96b847d..aea9f4816b4 100644 --- a/mythtv/libs/libmythmetadata/dbaccess.cpp +++ b/mythtv/libs/libmythmetadata/dbaccess.cpp @@ -26,11 +26,11 @@ namespace class SingleValueImp { public: - typedef SingleValue::entry entry; - typedef std::vector entry_list; + using entry = SingleValue::entry; + using entry_list = std::vector; private: - typedef std::map entry_map; + using entry_map = std::map; public: SingleValueImp(QString table_name, QString id_name, QString value_name) @@ -97,7 +97,7 @@ class SingleValueImp void remove(int id) { - entry_map::iterator p = m_entries.find(id); + auto p = m_entries.find(id); if (p != m_entries.end()) { MSqlQuery query(MSqlQuery::InitCon()); @@ -164,8 +164,7 @@ class SingleValueImp private: entry_map::iterator find(const QString &name) { - for (entry_map::iterator p = m_entries.begin(); - p != m_entries.end(); ++p) + for (auto p = m_entries.begin(); p != m_entries.end(); ++p) { if (p->second == name) return p; @@ -253,10 +252,10 @@ void SingleValue::load_data() class MultiValueImp { public: - typedef MultiValue::entry entry; + using entry = MultiValue::entry; private: - typedef std::map id_map; + using id_map = std::map; public: MultiValueImp(QString table_name, QString id_name, @@ -291,12 +290,11 @@ class MultiValueImp int add(int id, int value) { bool db_insert = false; - id_map::iterator p = m_valMap.find(id); + auto p = m_valMap.find(id); if (p != m_valMap.end()) { entry::values_type &va = p->second.values; - entry::values_type::iterator v = - std::find(va.begin(), va.end(), value); + auto v = std::find(va.begin(), va.end(), value); if (v == va.end()) { va.push_back(value); @@ -327,7 +325,7 @@ class MultiValueImp bool get(int id, entry &values) { - id_map::iterator p = m_valMap.find(id); + auto p = m_valMap.find(id); if (p != m_valMap.end()) { values = p->second; @@ -338,12 +336,11 @@ class MultiValueImp void remove(int id, int value) { - id_map::iterator p = m_valMap.find(id); + auto p = m_valMap.find(id); if (p != m_valMap.end()) { - entry::values_type::iterator vp = - std::find(p->second.values.begin(), p->second.values.end(), - value); + auto vp = std::find(p->second.values.begin(), + p->second.values.end(), value); if (vp != p->second.values.end()) { MSqlQuery query(MSqlQuery::InitCon()); @@ -364,7 +361,7 @@ class MultiValueImp void remove(int id) { - id_map::iterator p = m_valMap.find(id); + auto p = m_valMap.find(id); if (p != m_valMap.end()) { MSqlQuery query(MSqlQuery::InitCon()); @@ -382,10 +379,10 @@ class MultiValueImp bool exists(int id, int value) { - id_map::iterator p = m_valMap.find(id); + auto p = m_valMap.find(id); if (p != m_valMap.end()) { - entry::values_type::iterator vp = + auto vp = std::find(p->second.values.begin(), p->second.values.end(), value); return vp != p->second.values.end(); @@ -407,7 +404,7 @@ class MultiValueImp if (query.exec(m_fillSql) && query.size() > 0) { - id_map::iterator p = m_valMap.end(); + auto p = m_valMap.end(); while (query.next()) { int id = query.value(0).toInt(); @@ -586,9 +583,9 @@ VideoCastMap &VideoCastMap::getCastMap() class FileAssociationsImp { public: - typedef FileAssociations::file_association file_association; - typedef FileAssociations::association_list association_list; - typedef FileAssociations::ext_ignore_list ext_ignore_list; + using file_association = FileAssociations::file_association; + using association_list = FileAssociations::association_list; + using ext_ignore_list = FileAssociations::ext_ignore_list; public: FileAssociationsImp() = default; @@ -600,7 +597,7 @@ class FileAssociationsImp file_association *existing_fa = nullptr; MSqlQuery query(MSqlQuery::InitCon()); - association_list::iterator p = find(ret_fa.extension); + auto p = find(ret_fa.extension); if (p != m_fileAssociations.end()) { ret_fa.id = p->id; @@ -645,7 +642,7 @@ class FileAssociationsImp bool get(unsigned int id, file_association &val) const { - association_list::const_iterator p = find(id); + auto p = cfind(id); if (p != m_fileAssociations.end()) { val = *p; @@ -656,7 +653,7 @@ class FileAssociationsImp bool get(const QString &ext, file_association &val) const { - association_list::const_iterator p = find(ext); + auto p = cfind(ext); if (p != m_fileAssociations.end()) { val = *p; @@ -667,7 +664,7 @@ class FileAssociationsImp bool remove(unsigned int id) { - association_list::iterator p = find(id); + auto p = find(id); if (p != m_fileAssociations.end()) { MSqlQuery query(MSqlQuery::InitCon()); @@ -689,8 +686,8 @@ class FileAssociationsImp void getExtensionIgnoreList(ext_ignore_list &ext_ignore) const { - for (association_list::const_iterator p = m_fileAssociations.begin(); - p != m_fileAssociations.end(); ++p) + for (auto p = m_fileAssociations.cbegin(); + p != m_fileAssociations.cend(); ++p) { ext_ignore.push_back(std::make_pair(p->extension, p->ignore)); } @@ -735,7 +732,7 @@ class FileAssociationsImp association_list::iterator find(const QString &ext) { - for (association_list::iterator p = m_fileAssociations.begin(); + for (auto p = m_fileAssociations.begin(); p != m_fileAssociations.end(); ++p) { if (p->extension.length() == ext.length() && @@ -749,7 +746,7 @@ class FileAssociationsImp association_list::iterator find(unsigned int id) { - for (association_list::iterator p = m_fileAssociations.begin(); + for (auto p = m_fileAssociations.begin(); p != m_fileAssociations.end(); ++p) { if (p->id == id) return p; @@ -757,10 +754,10 @@ class FileAssociationsImp return m_fileAssociations.end(); } - association_list::const_iterator find(const QString &ext) const + association_list::const_iterator cfind(const QString &ext) const { - for (association_list::const_iterator p = m_fileAssociations.begin(); - p != m_fileAssociations.end(); ++p) + for (auto p = m_fileAssociations.cbegin(); + p != m_fileAssociations.cend(); ++p) { if (p->extension.length() == ext.length() && ext.indexOf(p->extension) == 0) @@ -768,17 +765,17 @@ class FileAssociationsImp return p; } } - return m_fileAssociations.end(); + return m_fileAssociations.cend(); } - association_list::const_iterator find(unsigned int id) const + association_list::const_iterator cfind(unsigned int id) const { - for (association_list::const_iterator p = m_fileAssociations.begin(); - p != m_fileAssociations.end(); ++p) + for (auto p = m_fileAssociations.cbegin(); + p != m_fileAssociations.cend(); ++p) { if (p->id == id) return p; } - return m_fileAssociations.end(); + return m_fileAssociations.cend(); } private: diff --git a/mythtv/libs/libmythmetadata/dbaccess.h b/mythtv/libs/libmythmetadata/dbaccess.h index 17146adcdef..db1adaa26f3 100644 --- a/mythtv/libs/libmythmetadata/dbaccess.h +++ b/mythtv/libs/libmythmetadata/dbaccess.h @@ -11,8 +11,8 @@ class SingleValueImp; class META_PUBLIC SingleValue { public: - typedef std::pair entry; - typedef std::vector entry_list; + using entry = std::pair; + using entry_list = std::vector; public: int add(const QString &name); @@ -39,10 +39,10 @@ class META_PUBLIC MultiValue struct entry { int id; - typedef std::vector values_type; + using values_type = std::vector; values_type values; }; - typedef std::vector entry_list; + using entry_list = std::vector; public: int add(int id, int value); @@ -150,8 +150,8 @@ class META_PUBLIC FileAssociations : id(l_id), extension(ext), playcommand(playcmd), ignore(l_ignore), use_default(l_use_default) {} }; - typedef std::vector association_list; - typedef std::vector > ext_ignore_list; + using association_list = std::vector; + using ext_ignore_list = std::vector >; public: static FileAssociations &getFileAssociation(); diff --git a/mythtv/libs/libmythmetadata/dirscan.cpp b/mythtv/libs/libmythmetadata/dirscan.cpp index 89c6933495f..ed18acc8819 100644 --- a/mythtv/libs/libmythmetadata/dirscan.cpp +++ b/mythtv/libs/libmythmetadata/dirscan.cpp @@ -17,7 +17,7 @@ namespace class ext_lookup { private: - typedef std::map ext_map; + using ext_map = std::map; ext_map m_extensions; bool m_listUnknown; @@ -25,8 +25,8 @@ namespace ext_lookup(const FileAssociations::ext_ignore_list &ext_disposition, bool list_unknown) : m_listUnknown(list_unknown) { - for (FileAssociations::ext_ignore_list::const_iterator p = - ext_disposition.begin(); p != ext_disposition.end(); ++p) + for (auto p = ext_disposition.cbegin(); + p != ext_disposition.cend(); ++p) { m_extensions.insert(ext_map::value_type(p->first.toLower(), p->second)); @@ -35,6 +35,7 @@ namespace bool extension_ignored(const QString &extension) const { + //NOLINTNEXTLINE(modernize-use-auto) ext_map::const_iterator p = m_extensions.find(extension.toLower()); if (p != m_extensions.end()) return p->second; diff --git a/mythtv/libs/libmythmetadata/imagemanager.cpp b/mythtv/libs/libmythmetadata/imagemanager.cpp index 5e32cab6821..470792226cf 100644 --- a/mythtv/libs/libmythmetadata/imagemanager.cpp +++ b/mythtv/libs/libmythmetadata/imagemanager.cpp @@ -315,8 +315,7 @@ QStringList ImageAdapterBase::SupportedVideos() QStringList formats; const FileAssociations::association_list faList = FileAssociations::getFileAssociation().getList(); - for (FileAssociations::association_list::const_iterator p = - faList.begin(); p != faList.end(); ++p) + for (auto p = faList.cbegin(); p != faList.cend(); ++p) { if (!p->use_default && p->playcommand == "Internal") formats << QString(p->extension); @@ -336,7 +335,7 @@ QStringList ImageAdapterBase::SupportedVideos() ImageItem *ImageAdapterLocal::CreateItem(const QFileInfo &fi, int parentId, int devId, const QString & /*base*/) const { - ImageItem *im = new ImageItem(); + auto *im = new ImageItem(); im->m_parentId = parentId; im->m_device = devId; @@ -411,7 +410,7 @@ void ImageAdapterLocal::Notify(const QString &mesg, ImageItem *ImageAdapterSg::CreateItem(const QFileInfo &fi, int parentId, int /*devId*/, const QString &base) const { - ImageItem *im = new ImageItem(); + auto *im = new ImageItem(); im->m_device = 0; im->m_parentId = parentId; @@ -513,7 +512,7 @@ QString ImageAdapterSg::GetAbsFilePath(const ImagePtrK &im) const template ImageItem *ImageDb::CreateImage(const MSqlQuery &query) const { - ImageItem *im = new ImageItem(FS::ImageId(query.value(0).toInt())); + auto *im = new ImageItem(FS::ImageId(query.value(0).toInt())); // Ordered as per DB_COLUMNS im->m_filePath = query.value(1).toString(); @@ -1191,7 +1190,7 @@ QStringList ImageHandler::HandleGetMetadata(const QString &id) const RESULT_ERR("Image not found", QString("File %1 not found").arg(im->m_filePath)) - ReadMetaThread *worker = new ReadMetaThread(im, absPath); + auto *worker = new ReadMetaThread(im, absPath); MThreadPool::globalInstance()->start(worker, "ImageMetaData"); @@ -2500,7 +2499,7 @@ void ImageManagerFe::DeviceEvent(MythMediaEvent *event) QString ImageManagerFe::CreateImport() { - QTemporaryDir *tmp = new QTemporaryDir(QDir::tempPath() % "/" IMPORTDIR "-XXXXXX"); + auto *tmp = new QTemporaryDir(QDir::tempPath() % "/" IMPORTDIR "-XXXXXX"); if (!tmp->isValid()) { delete tmp; diff --git a/mythtv/libs/libmythmetadata/imagemanager.h b/mythtv/libs/libmythmetadata/imagemanager.h index 17e55909779..10d198828c9 100644 --- a/mythtv/libs/libmythmetadata/imagemanager.h +++ b/mythtv/libs/libmythmetadata/imagemanager.h @@ -109,7 +109,7 @@ class META_PUBLIC DeviceManager ~DeviceManager(); private: - typedef QMap DeviceMap; + using DeviceMap = QMap; //! Device store DeviceMap m_devices; diff --git a/mythtv/libs/libmythmetadata/imagemetadata.cpp b/mythtv/libs/libmythmetadata/imagemetadata.cpp index c58d4bd0ed0..1ad7ad49304 100644 --- a/mythtv/libs/libmythmetadata/imagemetadata.cpp +++ b/mythtv/libs/libmythmetadata/imagemetadata.cpp @@ -400,7 +400,7 @@ std::string PictureMetaData::GetTag(const QString &key, bool *exists) return value; Exiv2::ExifKey exifKey = Exiv2::ExifKey(key.toStdString()); - Exiv2::ExifData::iterator exifIt = m_exifData.findKey(exifKey); + auto exifIt = m_exifData.findKey(exifKey); if (exifIt == m_exifData.end()) return value; diff --git a/mythtv/libs/libmythmetadata/imagemetadata.h b/mythtv/libs/libmythmetadata/imagemetadata.h index 5f2dd4fccb8..bb9461bb115 100644 --- a/mythtv/libs/libmythmetadata/imagemetadata.h +++ b/mythtv/libs/libmythmetadata/imagemetadata.h @@ -76,7 +76,7 @@ class META_PUBLIC Orientation int Apply(int); - typedef QHash > Matrix; + using Matrix = QHash >; //! True when using Qt 5.4.1 with its deviant orientation behaviour static const bool krunningQt541; @@ -112,7 +112,7 @@ class META_PUBLIC ImageMetaData static QStringList FromString(const QString &str) { return str.split(kSeparator); } - typedef QMap TagMap; + using TagMap = QMap; static TagMap ToMap(const QStringList &tags); virtual bool IsValid() = 0; diff --git a/mythtv/libs/libmythmetadata/imagescanner.h b/mythtv/libs/libmythmetadata/imagescanner.h index fea855609fb..eadeb1c929f 100644 --- a/mythtv/libs/libmythmetadata/imagescanner.h +++ b/mythtv/libs/libmythmetadata/imagescanner.h @@ -61,7 +61,7 @@ class META_PUBLIC ImageScanThread : public MThread void CountFiles(const QStringList &paths); void Broadcast(int progress); - typedef QPair ClearTask; + using ClearTask = QPair; bool m_scanning {false}; //!< The requested scan state QMutex m_mutexState; //!< Mutex protecting scan state diff --git a/mythtv/libs/libmythmetadata/imagethumbs.h b/mythtv/libs/libmythmetadata/imagethumbs.h index afcca461908..497653af9f7 100644 --- a/mythtv/libs/libmythmetadata/imagethumbs.h +++ b/mythtv/libs/libmythmetadata/imagethumbs.h @@ -75,7 +75,7 @@ class META_PUBLIC ThumbTask bool m_notify; }; -typedef QSharedPointer TaskPtr; +using TaskPtr = QSharedPointer; //! A generator worker thread @@ -104,7 +104,7 @@ class ThumbThread : public MThread Q_DISABLE_COPY(ThumbThread) //! A priority queue where 0 is highest priority - typedef QMultiMap ThumbQueue; + using ThumbQueue = QMultiMap; QString CreateThumbnail(ImagePtrK im, int thumbPriority); static void RemoveTasks(ThumbQueue &queue, int devId); diff --git a/mythtv/libs/libmythmetadata/imagetypes.h b/mythtv/libs/libmythmetadata/imagetypes.h index a3888fa8add..ee121ef396c 100644 --- a/mythtv/libs/libmythmetadata/imagetypes.h +++ b/mythtv/libs/libmythmetadata/imagetypes.h @@ -56,11 +56,11 @@ enum ImageSortOrder { // Convenience types -typedef QList ImageIdList; -typedef QPair StringPair; -typedef QHash NameHash; -typedef QMap StringMap; -typedef QPair ThumbPair; +using ImageIdList = QList; +using StringPair = QPair; +using NameHash = QHash; +using StringMap = QMap; +using ThumbPair = QPair; //! Represents a picture, video or directory @@ -170,14 +170,14 @@ class META_PUBLIC ImageItem }; // Convenience containers -typedef QSharedPointer ImagePtr; -typedef QList ImageList; -typedef QHash ImageHash; +using ImagePtr = QSharedPointer; +using ImageList = QList; +using ImageHash = QHash; // Read-only images alias -typedef const ImageItem ImageItemK; -typedef QSharedPointer ImagePtrK; -typedef QList ImageListK; +using ImageItemK = const ImageItem; +using ImagePtrK = QSharedPointer; +using ImageListK = QList; Q_DECLARE_METATYPE(ImagePtrK) diff --git a/mythtv/libs/libmythmetadata/lyricsdata.cpp b/mythtv/libs/libmythmetadata/lyricsdata.cpp index 9cd12e054b9..8913ff10fb3 100644 --- a/mythtv/libs/libmythmetadata/lyricsdata.cpp +++ b/mythtv/libs/libmythmetadata/lyricsdata.cpp @@ -183,7 +183,7 @@ void LyricsData::customEvent(QEvent *event) { if (event->type() == MythEvent::MythEventMessage) { - MythEvent *me = dynamic_cast(event); + auto *me = dynamic_cast(event); if (!me) return; @@ -317,7 +317,7 @@ void LyricsData::setLyrics(const QStringList &lyrics) { QString lyric = lyrics.at(x); - LyricsLine *line = new LyricsLine; + auto *line = new LyricsLine; if (lyric.startsWith("[offset:")) { diff --git a/mythtv/libs/libmythmetadata/metadatacommon.cpp b/mythtv/libs/libmythmetadata/metadatacommon.cpp index c627509ad65..e7d3745f871 100644 --- a/mythtv/libs/libmythmetadata/metadatacommon.cpp +++ b/mythtv/libs/libmythmetadata/metadatacommon.cpp @@ -412,7 +412,7 @@ MetadataLookup* LookupFromProgramInfo(ProgramInfo *pginfo) .secsTo(pginfo->GetRecordingEndTime()); uint runtime = (runtimesecs/60); - MetadataLookup *ret = new MetadataLookup(kMetadataRecording, kUnknownVideo, + auto *ret = new MetadataLookup(kMetadataRecording, kUnknownVideo, qVariantFromValue(pginfo), kLookupData, false, false, false, false, false, pginfo->GetHostname(),pginfo->GetBasename(),pginfo->GetTitle(), QStringList() << pginfo->GetCategory(), pginfo->GetStars() * 10, diff --git a/mythtv/libs/libmythmetadata/metadatacommon.h b/mythtv/libs/libmythmetadata/metadatacommon.h index dc846f12a7c..d4756aa0a6e 100644 --- a/mythtv/libs/libmythmetadata/metadatacommon.h +++ b/mythtv/libs/libmythmetadata/metadatacommon.h @@ -76,9 +76,8 @@ enum PeopleType { kPersonGuestStar = 11 }; -typedef QMap< VideoArtworkType, ArtworkInfo > DownloadMap; - -typedef QMultiMap< PeopleType, PersonInfo > PeopleMap; +using DownloadMap = QMap< VideoArtworkType, ArtworkInfo >; +using PeopleMap = QMultiMap< PeopleType, PersonInfo >; class META_PUBLIC MetadataLookup : public QObject, public ReferenceCounter { @@ -455,7 +454,7 @@ class META_PUBLIC MetadataLookup : public QObject, public ReferenceCounter DownloadMap m_downloads; }; -typedef RefCountedList MetadataLookupList; +using MetadataLookupList = RefCountedList; META_PUBLIC QDomDocument CreateMetadataXML(MetadataLookupList list); META_PUBLIC QDomDocument CreateMetadataXML(MetadataLookup *lookup); diff --git a/mythtv/libs/libmythmetadata/metadatadownload.cpp b/mythtv/libs/libmythmetadata/metadatadownload.cpp index 75443c07531..d95c2774937 100644 --- a/mythtv/libs/libmythmetadata/metadatadownload.cpp +++ b/mythtv/libs/libmythmetadata/metadatadownload.cpp @@ -442,7 +442,7 @@ MetadataLookupList MetadataDownload::readMXML(const QString& MXMLpath, { QByteArray mxmlraw; QDomElement item; - RemoteFile *rf = new RemoteFile(MXMLpath); + auto *rf = new RemoteFile(MXMLpath); if (rf->isOpen()) { @@ -491,7 +491,7 @@ MetadataLookupList MetadataDownload::readNFO(const QString& NFOpath, { QByteArray nforaw; QDomElement item; - RemoteFile *rf = new RemoteFile(NFOpath); + auto *rf = new RemoteFile(NFOpath); if (rf->isOpen()) { diff --git a/mythtv/libs/libmythmetadata/metadatafactory.cpp b/mythtv/libs/libmythmetadata/metadatafactory.cpp index 0a0f61f4428..8faa60388e7 100644 --- a/mythtv/libs/libmythmetadata/metadatafactory.cpp +++ b/mythtv/libs/libmythmetadata/metadatafactory.cpp @@ -87,7 +87,7 @@ void MetadataFactory::Lookup(RecordingRule *recrule, bool automatic, if (!recrule) return; - MetadataLookup *lookup = new MetadataLookup(); + auto *lookup = new MetadataLookup(); lookup->SetStep(kLookupSearch); lookup->SetType(kMetadataRecording); @@ -115,7 +115,7 @@ void MetadataFactory::Lookup(ProgramInfo *pginfo, bool automatic, if (!pginfo) return; - MetadataLookup *lookup = new MetadataLookup(); + auto *lookup = new MetadataLookup(); lookup->SetStep(kLookupSearch); lookup->SetType(kMetadataRecording); @@ -143,7 +143,7 @@ void MetadataFactory::Lookup(VideoMetadata *metadata, bool automatic, if (!metadata) return; - MetadataLookup *lookup = new MetadataLookup(); + auto *lookup = new MetadataLookup(); lookup->SetStep(kLookupSearch); lookup->SetType(kMetadataVideo); @@ -186,7 +186,7 @@ META_PUBLIC MetadataLookupList MetadataFactory::SynchronousLookup(const QString& const QString& grabber, bool allowgeneric) { - MetadataLookup *lookup = new MetadataLookup(); + auto *lookup = new MetadataLookup(); lookup->SetStep(kLookupSearch); lookup->SetType(kMetadataRecording); @@ -362,7 +362,7 @@ void MetadataFactory::OnVideoResult(MetadataLookup *lookup) if (!lookup) return; - VideoMetadata *metadata = lookup->GetData().value(); + auto *metadata = lookup->GetData().value(); if (!metadata) return; @@ -551,7 +551,7 @@ void MetadataFactory::customEvent(QEvent *levent) } else if (levent->type() == ImageDLEvent::kEventType) { - ImageDLEvent *ide = dynamic_cast(levent); + auto *ide = dynamic_cast(levent); if (ide == nullptr) return; @@ -566,7 +566,7 @@ void MetadataFactory::customEvent(QEvent *levent) } else if (levent->type() == ImageDLFailureEvent::kEventType) { - ImageDLFailureEvent *ide = dynamic_cast(levent); + auto *ide = dynamic_cast(levent); if (ide == nullptr) return; @@ -581,7 +581,7 @@ void MetadataFactory::customEvent(QEvent *levent) } else if (levent->type() == VideoScanChanges::kEventType) { - VideoScanChanges *vsc = dynamic_cast(levent); + auto *vsc = dynamic_cast(levent); if (!vsc) return; @@ -658,7 +658,7 @@ LookupType GuessLookupType(ProgramInfo *pginfo) // recording have an inetref, season, episode, or // subtitle, it's *probably* a movie. If it's some // weird combination of both, we've got to try everything. - RecordingRule *rule = new RecordingRule(); + auto *rule = new RecordingRule(); rule->m_recordID = pginfo->GetRecordingRuleID(); rule->Load(); int ruleepisode = rule->m_episode; diff --git a/mythtv/libs/libmythmetadata/metadatafactory.h b/mythtv/libs/libmythmetadata/metadatafactory.h index a4cee804442..730a63939ca 100644 --- a/mythtv/libs/libmythmetadata/metadatafactory.h +++ b/mythtv/libs/libmythmetadata/metadatafactory.h @@ -125,7 +125,7 @@ class META_PUBLIC MetadataFactory : public QObject m_imagedownload->isRunning() || m_videoscanner->isRunning(); }; - bool VideoGrabbersFunctional(); + static bool VideoGrabbersFunctional(); private: diff --git a/mythtv/libs/libmythmetadata/metadatagrabber.cpp b/mythtv/libs/libmythmetadata/metadatagrabber.cpp index 0b08148bc7a..a6d8a4620da 100644 --- a/mythtv/libs/libmythmetadata/metadatagrabber.cpp +++ b/mythtv/libs/libmythmetadata/metadatagrabber.cpp @@ -24,11 +24,11 @@ static GrabberList grabberList; static QMutex grabberLock; static QDateTime grabberAge; -typedef struct GrabberOpts { +struct GrabberOpts { QString m_path; QString m_setting; QString m_def; -} GrabberOpts; +}; // TODO // it would be nice to statically compile these, but I can't manage to get it diff --git a/mythtv/libs/libmythmetadata/metadatagrabber.h b/mythtv/libs/libmythmetadata/metadatagrabber.h index 065948ac60f..c877e405bf0 100644 --- a/mythtv/libs/libmythmetadata/metadatagrabber.h +++ b/mythtv/libs/libmythmetadata/metadatagrabber.h @@ -12,10 +12,10 @@ //#include "metadatacommon.h" #include "referencecounterlist.h" class MetadataLookup; -typedef RefCountedList MetadataLookupList; +using MetadataLookupList = RefCountedList; class MetaGrabberScript; -typedef QList GrabberList; +using GrabberList = QList; enum GrabberType { kGrabberAll, diff --git a/mythtv/libs/libmythmetadata/metadataimagedownload.cpp b/mythtv/libs/libmythmetadata/metadataimagedownload.cpp index 3f7ba81c981..a8ce2ad5169 100644 --- a/mythtv/libs/libmythmetadata/metadataimagedownload.cpp +++ b/mythtv/libs/libmythmetadata/metadataimagedownload.cpp @@ -37,7 +37,7 @@ void MetadataImageDownload::addThumb(QString title, { QMutexLocker lock(&m_mutex); - ThumbnailData *id = new ThumbnailData(); + auto *id = new ThumbnailData(); id->title = std::move(title); id->data = std::move(data); id->url = std::move(url); diff --git a/mythtv/libs/libmythmetadata/metadataimagedownload.h b/mythtv/libs/libmythmetadata/metadataimagedownload.h index 03837f3debf..a7f0d1c7ab0 100644 --- a/mythtv/libs/libmythmetadata/metadataimagedownload.h +++ b/mythtv/libs/libmythmetadata/metadataimagedownload.h @@ -9,11 +9,11 @@ #include "mythmetaexp.h" #include "metadatacommon.h" -typedef struct { +struct ThumbnailData { QString title; QVariant data; QString url; -} ThumbnailData; +}; class META_PUBLIC ImageDLEvent : public QEvent { diff --git a/mythtv/libs/libmythmetadata/metaio.cpp b/mythtv/libs/libmythmetadata/metaio.cpp index 00efc6a757e..5a77fcd7a56 100644 --- a/mythtv/libs/libmythmetadata/metaio.cpp +++ b/mythtv/libs/libmythmetadata/metaio.cpp @@ -46,7 +46,7 @@ MetaIO* MetaIO::createTagger(const QString& filename) return new MetaIOOggVorbis; if (extension == "flac") { - MetaIOFLACVorbis *tagger = new MetaIOFLACVorbis; + auto *tagger = new MetaIOFLACVorbis; if (tagger->TagExists(filename)) return tagger; delete tagger; @@ -175,8 +175,8 @@ MusicMetadata* MetaIO::readFromFilename(const QString &filename, bool blnLength) if (blnLength) length = getTrackLength(filename); - MusicMetadata *retdata = new MusicMetadata(filename, artist, "", album, - title, genre, 0, tracknum, length); + auto *retdata = new MusicMetadata(filename, artist, "", album, title, genre, + 0, tracknum, length); return retdata; } diff --git a/mythtv/libs/libmythmetadata/metaioavfcomment.cpp b/mythtv/libs/libmythmetadata/metaioavfcomment.cpp index 9245601f2f5..0c1167103ec 100644 --- a/mythtv/libs/libmythmetadata/metaioavfcomment.cpp +++ b/mythtv/libs/libmythmetadata/metaioavfcomment.cpp @@ -75,7 +75,7 @@ MusicMetadata* MetaIOAVFComment::read(const QString &filename) length = getTrackLength(p_context); - MusicMetadata *retdata = new MusicMetadata(filename, artist, compilation_artist, album, + auto *retdata = new MusicMetadata(filename, artist, compilation_artist, album, title, genre, year, tracknum, length); retdata->determineIfCompilation(); diff --git a/mythtv/libs/libmythmetadata/metaioflacvorbis.cpp b/mythtv/libs/libmythmetadata/metaioflacvorbis.cpp index 3e22513ee8a..a0d26dbc361 100644 --- a/mythtv/libs/libmythmetadata/metaioflacvorbis.cpp +++ b/mythtv/libs/libmythmetadata/metaioflacvorbis.cpp @@ -22,8 +22,7 @@ TagLib::FLAC::File *MetaIOFLACVorbis::OpenFile(const QString &filename) { QByteArray fname = filename.toLocal8Bit(); - TagLib::FLAC::File *flacfile = - new TagLib::FLAC::File(fname.constData()); + auto *flacfile = new TagLib::FLAC::File(fname.constData()); if (!flacfile->isOpen()) { @@ -110,7 +109,7 @@ MusicMetadata* MetaIOFLACVorbis::read(const QString &filename) return nullptr; } - MusicMetadata *metadata = new MusicMetadata(filename); + auto *metadata = new MusicMetadata(filename); ReadGenericMetadata(tag, metadata); @@ -154,7 +153,7 @@ MusicMetadata* MetaIOFLACVorbis::read(const QString &filename) */ QImage* MetaIOFLACVorbis::getAlbumArt(const QString &filename, ImageType type) { - QImage *picture = new QImage(); + auto *picture = new QImage(); TagLib::FLAC::File * flacfile = OpenFile(filename); if (flacfile) @@ -252,8 +251,7 @@ AlbumArtList MetaIOFLACVorbis::getAlbumArtList(const QString &filename) { const TagLib::List& picList = flacfile->pictureList(); - for(TagLib::List::ConstIterator it = picList.begin(); - it != picList.end(); it++) + for(auto it = picList.begin(); it != picList.end(); it++) { Picture* pic = *it; // Assume a valid image would have at least @@ -266,7 +264,7 @@ AlbumArtList MetaIOFLACVorbis::getAlbumArtList(const QString &filename) continue; } - AlbumArtImage *art = new AlbumArtImage(); + auto *art = new AlbumArtImage(); if (pic->description().isEmpty()) art->m_description.clear(); diff --git a/mythtv/libs/libmythmetadata/metaioid3.cpp b/mythtv/libs/libmythmetadata/metaioid3.cpp index 1f94f4297b8..aa336d231ae 100644 --- a/mythtv/libs/libmythmetadata/metaioid3.cpp +++ b/mythtv/libs/libmythmetadata/metaioid3.cpp @@ -249,7 +249,7 @@ MusicMetadata *MetaIOID3::read(const QString &filename) } } - MusicMetadata *metadata = new MusicMetadata(filename); + auto *metadata = new MusicMetadata(filename); ReadGenericMetadata(tag, metadata); @@ -387,7 +387,7 @@ MusicMetadata *MetaIOID3::read(const QString &filename) */ QImage* MetaIOID3::getAlbumArt(const QString &filename, ImageType type) { - QImage *picture = new QImage(); + auto *picture = new QImage(); AttachedPictureFrame::Type apicType = AttachedPictureFrame::FrontCover; @@ -423,11 +423,9 @@ QImage* MetaIOID3::getAlbumArt(const QString &filename, ImageType type) { TagLib::ID3v2::FrameList apicframes = tag->frameListMap()["APIC"]; - for(TagLib::ID3v2::FrameList::Iterator it = apicframes.begin(); - it != apicframes.end(); ++it) + for(auto it = apicframes.begin(); it != apicframes.end(); ++it) { - AttachedPictureFrame *frame = - dynamic_cast(*it); + auto *frame = dynamic_cast(*it); if (frame && frame->type() == apicType) { picture->loadFromData((const uchar *)frame->picture().data(), @@ -480,12 +478,9 @@ AlbumArtList MetaIOID3::readAlbumArt(TagLib::ID3v2::Tag *tag) { TagLib::ID3v2::FrameList apicframes = tag->frameListMap()["APIC"]; - for(TagLib::ID3v2::FrameList::Iterator it = apicframes.begin(); - it != apicframes.end(); ++it) + for(auto it = apicframes.begin(); it != apicframes.end(); ++it) { - - AttachedPictureFrame *frame = - dynamic_cast(*it); + auto *frame = dynamic_cast(*it); if (frame == nullptr) { LOG(VB_GENERAL, LOG_DEBUG, @@ -503,7 +498,7 @@ AlbumArtList MetaIOID3::readAlbumArt(TagLib::ID3v2::Tag *tag) continue; } - AlbumArtImage *art = new AlbumArtImage(); + auto *art = new AlbumArtImage(); if (frame->description().isEmpty()) art->m_description.clear(); @@ -586,9 +581,9 @@ AttachedPictureFrame* MetaIOID3::findAPIC(TagLib::ID3v2::Tag *tag, const String &description) { TagLib::ID3v2::FrameList l = tag->frameList("APIC"); - for(TagLib::ID3v2::FrameList::Iterator it = l.begin(); it != l.end(); ++it) + for(auto it = l.begin(); it != l.end(); ++it) { - AttachedPictureFrame *f = dynamic_cast(*it); + auto *f = dynamic_cast(*it); if (f && f->type() == type && (description.isNull() || f->description() == description)) return f; @@ -811,10 +806,9 @@ UserTextIdentificationFrame* MetaIOID3::find(TagLib::ID3v2::Tag *tag, const String &description) { TagLib::ID3v2::FrameList l = tag->frameList("TXXX"); - for(TagLib::ID3v2::FrameList::Iterator it = l.begin(); it != l.end(); ++it) + for(auto it = l.begin(); it != l.end(); ++it) { - UserTextIdentificationFrame *f = - dynamic_cast(*it); + auto *f = dynamic_cast(*it); if (f && f->description() == description) return f; } @@ -832,9 +826,9 @@ PopularimeterFrame* MetaIOID3::findPOPM(TagLib::ID3v2::Tag *tag, const String &_email) { TagLib::ID3v2::FrameList l = tag->frameList("POPM"); - for(TagLib::ID3v2::FrameList::Iterator it = l.begin(); it != l.end(); ++it) + for(auto it = l.begin(); it != l.end(); ++it) { - PopularimeterFrame *f = dynamic_cast(*it); + auto *f = dynamic_cast(*it); if (f && f->email() == _email) return f; } diff --git a/mythtv/libs/libmythmetadata/metaioid3.h b/mythtv/libs/libmythmetadata/metaioid3.h index 7368b064cfe..9edd7423b7b 100644 --- a/mythtv/libs/libmythmetadata/metaioid3.h +++ b/mythtv/libs/libmythmetadata/metaioid3.h @@ -76,7 +76,7 @@ class META_PUBLIC MetaIOID3 : public MetaIOTagLib TagLib::File *m_file {nullptr}; - typedef enum { kMPEG, kFLAC } TagType; + enum TagType { kMPEG, kFLAC }; TagType m_fileType {kMPEG}; }; diff --git a/mythtv/libs/libmythmetadata/metaiomp4.cpp b/mythtv/libs/libmythmetadata/metaiomp4.cpp index b4a788e1af7..7ab8dd4aeaa 100644 --- a/mythtv/libs/libmythmetadata/metaiomp4.cpp +++ b/mythtv/libs/libmythmetadata/metaiomp4.cpp @@ -124,15 +124,10 @@ MusicMetadata* MetaIOMP4::read(const QString &filename) metadataSanityCheck(&artist, &album, &title, &genre); - MusicMetadata *retdata = new MusicMetadata(filename, - artist, - compilation ? artist : "", - album, - title, - genre, - year, - tracknum, - length); + auto *retdata = new MusicMetadata(filename, artist, + compilation ? artist : "", + album, title, genre, year, + tracknum, length); retdata->setCompilation(compilation); diff --git a/mythtv/libs/libmythmetadata/metaiooggvorbis.cpp b/mythtv/libs/libmythmetadata/metaiooggvorbis.cpp index 8fceea6f20d..08067d4174c 100644 --- a/mythtv/libs/libmythmetadata/metaiooggvorbis.cpp +++ b/mythtv/libs/libmythmetadata/metaiooggvorbis.cpp @@ -16,8 +16,7 @@ TagLib::Ogg::Vorbis::File *MetaIOOggVorbis::OpenFile(const QString &filename) { QByteArray fname = filename.toLocal8Bit(); - TagLib::Ogg::Vorbis::File *oggfile = - new TagLib::Ogg::Vorbis::File(fname.constData()); + auto *oggfile = new TagLib::Ogg::Vorbis::File(fname.constData()); if (!oggfile->isOpen()) { @@ -104,7 +103,7 @@ MusicMetadata* MetaIOOggVorbis::read(const QString &filename) return nullptr; } - MusicMetadata *metadata = new MusicMetadata(filename); + auto *metadata = new MusicMetadata(filename); ReadGenericMetadata(tag, metadata); diff --git a/mythtv/libs/libmythmetadata/metaiotaglib.cpp b/mythtv/libs/libmythmetadata/metaiotaglib.cpp index deaf9b29328..369db2e654a 100644 --- a/mythtv/libs/libmythmetadata/metaiotaglib.cpp +++ b/mythtv/libs/libmythmetadata/metaiotaglib.cpp @@ -106,7 +106,7 @@ int MetaIOTagLib::getTrackLength(const QString &filename) { int milliseconds = 0; QByteArray fname = filename.toLocal8Bit(); - TagLib::FileRef *file = new TagLib::FileRef(fname.constData()); + auto *file = new TagLib::FileRef(fname.constData()); if (file && file->audioProperties()) milliseconds = file->audioProperties()->length() * 1000; diff --git a/mythtv/libs/libmythmetadata/metaiowavpack.cpp b/mythtv/libs/libmythmetadata/metaiowavpack.cpp index 8b8307552ea..6218475cafc 100644 --- a/mythtv/libs/libmythmetadata/metaiowavpack.cpp +++ b/mythtv/libs/libmythmetadata/metaiowavpack.cpp @@ -19,7 +19,7 @@ TagLib::WavPack::File *MetaIOWavPack::OpenFile(const QString &filename) { QByteArray fname = filename.toLocal8Bit(); - TagLib::WavPack::File *wpfile = new TagLib::WavPack::File(fname.constData()); + auto *wpfile = new TagLib::WavPack::File(fname.constData()); if (!wpfile->isOpen()) { @@ -97,7 +97,7 @@ MusicMetadata* MetaIOWavPack::read(const QString &filename) return nullptr; } - MusicMetadata *metadata = new MusicMetadata(filename); + auto *metadata = new MusicMetadata(filename); ReadGenericMetadata(tag, metadata); diff --git a/mythtv/libs/libmythmetadata/musicfilescanner.h b/mythtv/libs/libmythmetadata/musicfilescanner.h index 72191e54019..5f2cae2ce13 100644 --- a/mythtv/libs/libmythmetadata/musicfilescanner.h +++ b/mythtv/libs/libmythmetadata/musicfilescanner.h @@ -7,7 +7,7 @@ // Qt headers #include -typedef QMap IdCache; +using IdCache = QMap; class META_PUBLIC MusicFileScanner { @@ -27,7 +27,7 @@ class META_PUBLIC MusicFileScanner MusicFileLocation location; }; - typedef QMap MusicLoadedMap; + using MusicLoadedMap = QMap ; public: MusicFileScanner(void); ~MusicFileScanner(void) = default; diff --git a/mythtv/libs/libmythmetadata/musicmetadata.cpp b/mythtv/libs/libmythmetadata/musicmetadata.cpp index 00de537337a..ba423864da9 100644 --- a/mythtv/libs/libmythmetadata/musicmetadata.cpp +++ b/mythtv/libs/libmythmetadata/musicmetadata.cpp @@ -281,7 +281,7 @@ MusicMetadata *MusicMetadata::createFromID(int trackid) if (query.exec() && query.next()) { - MusicMetadata *mdata = new MusicMetadata(); + auto *mdata = new MusicMetadata(); mdata->m_artist = query.value(0).toString(); mdata->m_compilation_artist = query.value(1).toString(); mdata->m_album = query.value(2).toString(); @@ -1498,7 +1498,7 @@ void AllMusic::resync() idList.append(id); - MusicMetadata *dbMeta = new MusicMetadata( + auto *dbMeta = new MusicMetadata( query.value(12).toString(), // filename query.value(2).toString(), // artist query.value(3).toString(), // compilation artist @@ -1669,7 +1669,7 @@ void AllMusic::clearCDData(void) void AllMusic::addCDTrack(const MusicMetadata &the_track) { - MusicMetadata *mdata = new MusicMetadata(the_track); + auto *mdata = new MusicMetadata(the_track); mdata->setID(m_cdData.count() + 1); mdata->setRepo(RT_CD); m_cdData.append(mdata); @@ -1761,7 +1761,7 @@ void AllStream::loadStreams(void) for (int x = 0; x < STREAMURLCOUNT; x++) urls[x] = query.value(4 + x).toString(); - MusicMetadata *mdata = new MusicMetadata( + auto *mdata = new MusicMetadata( query.value(0).toInt(), // intid query.value(1).toString(), // broadcaster query.value(2).toString(), // channel @@ -1917,7 +1917,7 @@ void AlbumArtImages::findImages(void) { QString logoUrl = query.value(0).toString(); - AlbumArtImage *image = new AlbumArtImage(); + auto *image = new AlbumArtImage(); image->m_id = -1; image->m_filename = logoUrl; image->m_imageType = IT_FRONTCOVER; @@ -1951,7 +1951,7 @@ void AlbumArtImages::findImages(void) { while (query.next()) { - AlbumArtImage *image = new AlbumArtImage(); + auto *image = new AlbumArtImage(); bool embedded = (query.value(4).toInt() == 1); image->m_id = query.value(0).toInt(); @@ -1988,7 +1988,7 @@ void AlbumArtImages::findImages(void) QString artist = m_parent->Artist().toLower(); if (findIcon("artist", artist) != QString()) { - AlbumArtImage *image = new AlbumArtImage(); + auto *image = new AlbumArtImage(); image->m_id = -1; image->m_filename = findIcon("artist", artist); image->m_imageType = IT_ARTIST; @@ -2002,8 +2002,8 @@ void AlbumArtImages::findImages(void) void AlbumArtImages::scanForImages() { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIBusyDialog *busy = new MythUIBusyDialog(tr("Scanning for music album art..."), - popupStack, "scanbusydialog"); + auto *busy = new MythUIBusyDialog(tr("Scanning for music album art..."), + popupStack, "scanbusydialog"); if (busy->Create()) { @@ -2021,7 +2021,7 @@ void AlbumArtImages::scanForImages() << QString::number(m_parent->ID()) << "1"; - AlbumArtScannerThread *scanThread = new AlbumArtScannerThread(strList); + auto *scanThread = new AlbumArtScannerThread(strList); scanThread->start(); while (scanThread->isRunning()) @@ -2045,7 +2045,7 @@ void AlbumArtImages::scanForImages() for (int x = 2; x < strList.count(); x += 6) { - AlbumArtImage *image = new AlbumArtImage; + auto *image = new AlbumArtImage; image->m_id = strList[x].toInt(); image->m_imageType = (ImageType) strList[x + 1].toInt(); image->m_embedded = (strList[x + 2].toInt() == 1); diff --git a/mythtv/libs/libmythmetadata/musicmetadata.h b/mythtv/libs/libmythmetadata/musicmetadata.h index db8aca94c50..5ec102a1d49 100644 --- a/mythtv/libs/libmythmetadata/musicmetadata.h +++ b/mythtv/libs/libmythmetadata/musicmetadata.h @@ -51,7 +51,7 @@ class META_PUBLIC AlbumArtImage bool m_embedded {false}; }; -typedef QList AlbumArtList; +using AlbumArtList = QList; enum RepoType { @@ -73,7 +73,7 @@ enum RepoType #define STREAMUPDATEURL "https://services.mythtv.org/music/data/?data=streams" #define STREAMURLCOUNT 5 -typedef QString UrlList[STREAMURLCOUNT]; +using UrlList = QString[STREAMURLCOUNT]; class META_PUBLIC MusicMetadata { @@ -81,7 +81,7 @@ class META_PUBLIC MusicMetadata public: - typedef uint32_t IdType; + using IdType = uint32_t; MusicMetadata(QString lfilename = "", QString lartist = "", QString lcompilation_artist = "", QString lalbum = "", QString ltitle = "", QString lgenre = "", @@ -383,7 +383,7 @@ bool operator!=(MusicMetadata& a, MusicMetadata& b); Q_DECLARE_METATYPE(MusicMetadata *) Q_DECLARE_METATYPE(MusicMetadata) -typedef QList MetadataPtrList; +using MetadataPtrList = QList; Q_DECLARE_METATYPE(MetadataPtrList *) Q_DECLARE_METATYPE(ImageType); @@ -445,7 +445,7 @@ class META_PUBLIC AllMusic int m_numPcs {0}; int m_numLoaded {0}; - typedef QMap MusicMap; + using MusicMap = QMap; MusicMap m_music_map; // cd stuff @@ -466,7 +466,7 @@ class META_PUBLIC AllMusic #endif }; -typedef QList StreamList; +using StreamList = QList; class META_PUBLIC AllStream { diff --git a/mythtv/libs/libmythmetadata/mythuiimageresults.cpp b/mythtv/libs/libmythmetadata/mythuiimageresults.cpp index 86b54cbb5c9..06039bfcee5 100644 --- a/mythtv/libs/libmythmetadata/mythuiimageresults.cpp +++ b/mythtv/libs/libmythmetadata/mythuiimageresults.cpp @@ -51,9 +51,7 @@ bool ImageSearchResultsDialog::Create() i != m_list.end(); ++i) { ArtworkInfo info = (*i); - MythUIButtonListItem *button = - new MythUIButtonListItem(m_resultsList, - QString()); + auto *button = new MythUIButtonListItem(m_resultsList, QString()); button->SetText(info.label, "label"); button->SetText(info.thumbnail, "thumbnail"); button->SetText(info.url, "url"); @@ -122,7 +120,7 @@ void ImageSearchResultsDialog::customEvent(QEvent *event) { if (event->type() == ThumbnailDLEvent::kEventType) { - ThumbnailDLEvent *tde = dynamic_cast(event); + auto *tde = dynamic_cast(event); if (tde == nullptr) return; diff --git a/mythtv/libs/libmythmetadata/mythuimetadataresults.cpp b/mythtv/libs/libmythmetadata/mythuimetadataresults.cpp index af84bf83725..87625c7f8c9 100644 --- a/mythtv/libs/libmythmetadata/mythuimetadataresults.cpp +++ b/mythtv/libs/libmythmetadata/mythuimetadataresults.cpp @@ -50,9 +50,8 @@ bool MetadataResultsDialog::Create() for (int i = 0; i != m_results.count(); ++i) { - MythUIButtonListItem *button = - new MythUIButtonListItem(m_resultsList, - m_results[i]->GetTitle()); + auto *button = new MythUIButtonListItem(m_resultsList, + m_results[i]->GetTitle()); InfoMap metadataMap; m_results[i]->toMap(metadataMap); @@ -128,7 +127,7 @@ void MetadataResultsDialog::customEvent(QEvent *event) { if (event->type() == ThumbnailDLEvent::kEventType) { - ThumbnailDLEvent *tde = dynamic_cast(event); + auto *tde = dynamic_cast(event); if (tde == nullptr) return; diff --git a/mythtv/libs/libmythmetadata/parentalcontrols.cpp b/mythtv/libs/libmythmetadata/parentalcontrols.cpp index 9a999a478a9..cc8f693070f 100644 --- a/mythtv/libs/libmythmetadata/parentalcontrols.cpp +++ b/mythtv/libs/libmythmetadata/parentalcontrols.cpp @@ -165,7 +165,7 @@ namespace class PasswordManager { private: - typedef std::map pws; + using pws = std::map; public: void Add(ParentalLevel::Level level, const QString &password) @@ -309,8 +309,7 @@ class ParentalLevelChangeCheckerPrivate : public QObject MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythTextInputDialog *pwd = - new MythTextInputDialog(popupStack, + auto *pwd = new MythTextInputDialog(popupStack, tr("Parental PIN:"), FilterNone, true); connect(pwd, SIGNAL(haveResult(QString)), diff --git a/mythtv/libs/libmythmetadata/videometadata.cpp b/mythtv/libs/libmythmetadata/videometadata.cpp index c5c6eb31671..7b3d5a2debb 100644 --- a/mythtv/libs/libmythmetadata/videometadata.cpp +++ b/mythtv/libs/libmythmetadata/videometadata.cpp @@ -26,9 +26,9 @@ using namespace std; class VideoMetadataImp { public: - typedef VideoMetadata::genre_list genre_list; - typedef VideoMetadata::country_list country_list; - typedef VideoMetadata::cast_list cast_list; + using genre_list = VideoMetadata::genre_list; + using country_list = VideoMetadata::country_list; + using cast_list = VideoMetadata::cast_list; public: VideoMetadataImp(QString filename, QString sortFilename, @@ -827,7 +827,7 @@ void VideoMetadataImp::updateGenres() VideoGenreMap::getGenreMap().remove(m_id); // ensure that all genres we have are in the DB - genre_list::iterator genre = m_genres.begin(); + auto genre = m_genres.begin(); while (genre != m_genres.end()) { if (!genre->second.trimmed().isEmpty()) @@ -848,7 +848,7 @@ void VideoMetadataImp::updateCountries() // remove countries for this video VideoCountryMap::getCountryMap().remove(m_id); - country_list::iterator country = m_countries.begin(); + auto country = m_countries.begin(); while (country != m_countries.end()) { if (!country->second.trimmed().isEmpty()) @@ -869,7 +869,7 @@ void VideoMetadataImp::updateCast() VideoCastMap::getCastMap().remove(m_id); // ensure that all cast we have are in the DB - cast_list::iterator cast = m_cast.begin(); + auto cast = m_cast.begin(); while (cast != m_cast.end()) { if (!cast->second.trimmed().isEmpty()) diff --git a/mythtv/libs/libmythmetadata/videometadata.h b/mythtv/libs/libmythmetadata/videometadata.h index f70d7a5a6fb..eab0d55a29f 100644 --- a/mythtv/libs/libmythmetadata/videometadata.h +++ b/mythtv/libs/libmythmetadata/videometadata.h @@ -19,19 +19,19 @@ enum { VIDEO_YEAR_DEFAULT = 1895 }; const QString VIDEO_SUBTITLE_DEFAULT = ""; -typedef QHash MetadataMap; +using MetadataMap = QHash; class META_PUBLIC VideoMetadata { Q_DECLARE_TR_FUNCTIONS(VideoMetadata); public: - typedef std::pair genre_entry; - typedef std::pair country_entry; - typedef std::pair cast_entry; - typedef std::vector genre_list; - typedef std::vector country_list; - typedef std::vector cast_list; + using genre_entry = std::pair; + using country_entry = std::pair; + using cast_entry = std::pair; + using genre_list = std::vector; + using country_list = std::vector; + using cast_list = std::vector; public: static int UpdateHashedDBRecord(const QString &hash, const QString &file_name, diff --git a/mythtv/libs/libmythmetadata/videometadatalistmanager.cpp b/mythtv/libs/libmythmetadata/videometadatalistmanager.cpp index bbfbb6584b2..326644b769f 100644 --- a/mythtv/libs/libmythmetadata/videometadatalistmanager.cpp +++ b/mythtv/libs/libmythmetadata/videometadatalistmanager.cpp @@ -7,12 +7,12 @@ class VideoMetadataListManagerImp { public: - typedef VideoMetadataListManager::VideoMetadataPtr VideoMetadataPtr; - typedef VideoMetadataListManager::metadata_list metadata_list; + using VideoMetadataPtr = VideoMetadataListManager::VideoMetadataPtr; + using metadata_list = VideoMetadataListManager::metadata_list; private: - typedef std::map int_to_meta; - typedef std::map string_to_meta; + using int_to_meta = std::map; + using string_to_meta = std::map; public: void setList(metadata_list &list) @@ -21,8 +21,7 @@ class VideoMetadataListManagerImp m_fileMap.clear(); m_metaList.swap(list); - for (metadata_list::iterator p = m_metaList.begin(); - p != m_metaList.end(); ++p) + for (auto p = m_metaList.begin(); p != m_metaList.end(); ++p) { m_idMap.insert(int_to_meta::value_type((*p)->GetID(), p)); m_fileMap.insert( @@ -38,6 +37,7 @@ class VideoMetadataListManagerImp VideoMetadataPtr byFilename(const QString &file_name) const { + //NOLINTNEXTLINE(modernize-use-auto) string_to_meta::const_iterator p = m_fileMap.find(file_name); if (p != m_fileMap.end()) { @@ -48,6 +48,7 @@ class VideoMetadataListManagerImp VideoMetadataPtr byID(unsigned int db_id) const { + //NOLINTNEXTLINE(modernize-use-auto) int_to_meta::const_iterator p = m_idMap.find(db_id); if (p != m_idMap.end()) { @@ -71,16 +72,15 @@ class VideoMetadataListManagerImp { if (metadata) { - int_to_meta::iterator im = m_idMap.find(metadata->GetID()); + auto im = m_idMap.find(metadata->GetID()); if (im != m_idMap.end()) { - metadata_list::iterator mdi = im->second; + auto mdi = im->second; (*mdi)->DeleteFromDatabase(); m_idMap.erase(im); - string_to_meta::iterator sm = - m_fileMap.find(metadata->GetFilename()); + auto sm = m_fileMap.find(metadata->GetFilename()); if (sm != m_fileMap.end()) m_fileMap.erase(sm); m_metaList.erase(mdi); @@ -440,8 +440,7 @@ bool meta_dir_node::has_entries() const if (!ret) { - for (meta_dir_list::const_iterator p = m_subdirs.begin(); - p != m_subdirs.end(); ++p) + for (auto p = m_subdirs.cbegin(); p != m_subdirs.cend(); ++p) { ret = (*p)->has_entries(); if (ret) break; diff --git a/mythtv/libs/libmythmetadata/videometadatalistmanager.h b/mythtv/libs/libmythmetadata/videometadatalistmanager.h index d94e3d8ef67..0a434189038 100644 --- a/mythtv/libs/libmythmetadata/videometadatalistmanager.h +++ b/mythtv/libs/libmythmetadata/videometadatalistmanager.h @@ -10,8 +10,8 @@ class META_PUBLIC VideoMetadataListManager { public: - typedef simple_ref_ptr VideoMetadataPtr; - typedef std::list metadata_list; + using VideoMetadataPtr = simple_ref_ptr; + using metadata_list = std::list; public: static VideoMetadataPtr loadOneFromDatabase(uint id); @@ -73,20 +73,20 @@ class META_PUBLIC meta_data_node : public meta_node class meta_dir_node; -typedef simple_ref_ptr smart_dir_node; -typedef simple_ref_ptr smart_meta_node; +using smart_dir_node = simple_ref_ptr; +using smart_meta_node = simple_ref_ptr; -typedef std::list meta_dir_list; -typedef std::list meta_data_list; +using meta_dir_list = std::list; +using meta_data_list = std::list; class META_PUBLIC meta_dir_node : public meta_node { public: - typedef meta_dir_list::iterator dir_iterator; - typedef meta_dir_list::const_iterator const_dir_iterator; + using dir_iterator = meta_dir_list::iterator; + using const_dir_iterator = meta_dir_list::const_iterator; - typedef meta_data_list::iterator entry_iterator; - typedef meta_data_list::const_iterator const_entry_iterator; + using entry_iterator = meta_data_list::iterator; + using const_entry_iterator = meta_data_list::const_iterator; public: meta_dir_node(const QString &path, const QString &name = "", diff --git a/mythtv/libs/libmythmetadata/videoscan.cpp b/mythtv/libs/libmythmetadata/videoscan.cpp index f1d45729734..d1f8d269fe8 100644 --- a/mythtv/libs/libmythmetadata/videoscan.cpp +++ b/mythtv/libs/libmythmetadata/videoscan.cpp @@ -75,7 +75,7 @@ namespace } private: - typedef std::set image_ext; + using image_ext = std::set; image_ext m_imageExt; DirListType &m_videoFiles; }; @@ -257,9 +257,8 @@ void VideoScannerThread::verifyFiles(FileCheckList &files, tr("Verifying video files")); // For every file we know about, check to see if it still exists. - for (VideoMetadataListManager::metadata_list::const_iterator p = - m_dbmetadata->getList().begin(); - p != m_dbmetadata->getList().end(); ++p) + for (auto p = m_dbmetadata->getList().cbegin(); + p != m_dbmetadata->getList().cend(); ++p) { QString lname = (*p)->GetFilename(); QString lhost = (*p)->GetHost().toLower(); @@ -312,7 +311,7 @@ bool VideoScannerThread::updateDB(const FileCheckList &add, const PurgeList &rem SendProgressEvent(counter, (uint)(add.size() + remove.size()), tr("Updating video database")); - for (FileCheckList::const_iterator p = add.begin(); p != add.end(); ++p) + for (auto p = add.cbegin(); p != add.cend(); ++p) { // add files not already in the DB if (!p->second.check) @@ -371,8 +370,7 @@ bool VideoScannerThread::updateDB(const FileCheckList &add, const PurgeList &rem // When prompting is restored, account for the answer here. ret += remove.size(); - for (PurgeList::const_iterator p = remove.begin(); p != remove.end(); - ++p) + for (auto p = remove.cbegin(); p != remove.cend(); ++p) { if (!m_movList.contains(p->first)) { @@ -411,8 +409,7 @@ void VideoScannerThread::SendProgressEvent(uint progress, uint total, if (!m_dialog) return; - ProgressUpdateEvent *pue = new ProgressUpdateEvent(progress, total, - std::move(messsage)); + auto *pue = new ProgressUpdateEvent(progress, total, std::move(messsage)); QApplication::postEvent(m_dialog, pue); } @@ -436,8 +433,8 @@ void VideoScanner::doScan(const QStringList &dirs) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIProgressDialog *progressDlg = new MythUIProgressDialog("", - popupStack, "videoscanprogressdialog"); + auto *progressDlg = new MythUIProgressDialog("", popupStack, + "videoscanprogressdialog"); if (progressDlg->Create()) { diff --git a/mythtv/libs/libmythmetadata/videoscan.h b/mythtv/libs/libmythmetadata/videoscan.h index 9c358691461..e1740878593 100644 --- a/mythtv/libs/libmythmetadata/videoscan.h +++ b/mythtv/libs/libmythmetadata/videoscan.h @@ -79,8 +79,8 @@ class META_PUBLIC VideoScannerThread : public MThread QString host; }; - typedef std::vector > PurgeList; - typedef std::map FileCheckList; + using PurgeList = std::vector >; + using FileCheckList = std::map; void removeOrphans(unsigned int id, const QString &filename); diff --git a/mythtv/libs/libmythmetadata/videoutils.cpp b/mythtv/libs/libmythmetadata/videoutils.cpp index d70751a6103..a68c1a40032 100644 --- a/mythtv/libs/libmythmetadata/videoutils.cpp +++ b/mythtv/libs/libmythmetadata/videoutils.cpp @@ -33,7 +33,7 @@ namespace template void CopySecond(const T &src, QStringList &dest) { - for (typename T::const_iterator p = src.begin(); p != src.end(); ++p) + for (auto p = src.cbegin(); p != src.cend(); ++p) { dest.push_back((*p).second); } @@ -56,12 +56,12 @@ void CheckedSet(MythUIType *container, const QString &itemName, if (container) { MythUIType *uit = container->GetChild(itemName); - MythUIText *tt = dynamic_cast(uit); + auto *tt = dynamic_cast(uit); if (tt) CheckedSet(tt, value); else { - MythUIStateType *st = dynamic_cast(uit); + auto *st = dynamic_cast(uit); CheckedSet(st, value); } } diff --git a/mythtv/libs/libmythprotoserver/mythsocketmanager.cpp b/mythtv/libs/libmythprotoserver/mythsocketmanager.cpp index df955a5147e..cc96a14768b 100644 --- a/mythtv/libs/libmythprotoserver/mythsocketmanager.cpp +++ b/mythtv/libs/libmythprotoserver/mythsocketmanager.cpp @@ -105,7 +105,7 @@ bool MythSocketManager::Listen(int port) void MythSocketManager::newConnection(qt_socket_fd_t sd) { QMutexLocker locker(&m_socketListLock); - MythSocket *ms = new MythSocket(sd, this); + auto *ms = new MythSocket(sd, this); if (ms->IsConnected()) m_socketList.insert(ms); else diff --git a/mythtv/libs/libmythprotoserver/requesthandler/basehandler.cpp b/mythtv/libs/libmythprotoserver/requesthandler/basehandler.cpp index aa16ca873fb..03eed1105d4 100644 --- a/mythtv/libs/libmythprotoserver/requesthandler/basehandler.cpp +++ b/mythtv/libs/libmythprotoserver/requesthandler/basehandler.cpp @@ -33,7 +33,7 @@ bool BaseRequestHandler::HandleAnnounce(MythSocket *socket, bool systemevents = ( (eventlevel == 1) || (eventlevel == 3)); bool normalevents = ( (eventlevel == 1) || (eventlevel == 2)); - SocketHandler *handler = new SocketHandler(socket, m_parent, hostname); + auto *handler = new SocketHandler(socket, m_parent, hostname); socket->SetAnnounce(slist); handler->BlockShutdown(blockShutdown); diff --git a/mythtv/libs/libmythprotoserver/requesthandler/deletethread.cpp b/mythtv/libs/libmythprotoserver/requesthandler/deletethread.cpp index 6b71550f3b4..73d4dcb86a3 100644 --- a/mythtv/libs/libmythprotoserver/requesthandler/deletethread.cpp +++ b/mythtv/libs/libmythprotoserver/requesthandler/deletethread.cpp @@ -73,7 +73,7 @@ bool DeleteThread::AddFile(const QString& path) return false; QMutexLocker lock(&m_newlock); - DeleteHandler *handler = new DeleteHandler(path); + auto *handler = new DeleteHandler(path); m_newfiles << handler; return true; } diff --git a/mythtv/libs/libmythprotoserver/requesthandler/fileserverhandler.cpp b/mythtv/libs/libmythprotoserver/requesthandler/fileserverhandler.cpp index 0cebe0cce5c..5dc2dd7ca3e 100644 --- a/mythtv/libs/libmythprotoserver/requesthandler/fileserverhandler.cpp +++ b/mythtv/libs/libmythprotoserver/requesthandler/fileserverhandler.cpp @@ -180,8 +180,7 @@ bool FileServerHandler::HandleAnnounce(MythSocket *socket, { if (slist.size() >= 3) { - SocketHandler *handler = - new SocketHandler(socket, m_parent, commands[2]); + auto *handler = new SocketHandler(socket, m_parent, commands[2]); handler->BlockShutdown(true); handler->AllowStandardEvents(true); diff --git a/mythtv/libs/libmythprotoserver/requesthandler/outboundhandler.cpp b/mythtv/libs/libmythprotoserver/requesthandler/outboundhandler.cpp index 1bd56418959..18937a4ec6f 100644 --- a/mythtv/libs/libmythprotoserver/requesthandler/outboundhandler.cpp +++ b/mythtv/libs/libmythprotoserver/requesthandler/outboundhandler.cpp @@ -63,7 +63,7 @@ bool OutboundRequestHandler::DoConnectToMaster(void) return false; } - SocketHandler *handler = new SocketHandler(m_socket, m_parent, hostname); + auto *handler = new SocketHandler(m_socket, m_parent, hostname); handler->BlockShutdown(true); handler->AllowStandardEvents(true); handler->AllowSystemEvents(true); diff --git a/mythtv/libs/libmythservicecontracts/datacontracts/backendInfo.h b/mythtv/libs/libmythservicecontracts/datacontracts/backendInfo.h index 751056cea49..6c04e86b527 100644 --- a/mythtv/libs/libmythservicecontracts/datacontracts/backendInfo.h +++ b/mythtv/libs/libmythservicecontracts/datacontracts/backendInfo.h @@ -67,7 +67,7 @@ class SERVICE_PUBLIC BackendInfo : public QObject Q_DISABLE_COPY(BackendInfo); }; -typedef BackendInfo* BackendInfoPtr; +using BackendInfoPtr = BackendInfo*; inline void BackendInfo::InitializeCustomTypes() { diff --git a/mythtv/libs/libmythservicecontracts/datacontracts/buildInfo.h b/mythtv/libs/libmythservicecontracts/datacontracts/buildInfo.h index 8b30709391a..7d783d0b370 100644 --- a/mythtv/libs/libmythservicecontracts/datacontracts/buildInfo.h +++ b/mythtv/libs/libmythservicecontracts/datacontracts/buildInfo.h @@ -56,7 +56,7 @@ class SERVICE_PUBLIC BuildInfo : public QObject Q_DISABLE_COPY(BuildInfo); }; -typedef BuildInfo* BuildInfoPtr; +using BuildInfoPtr = BuildInfo*; inline void BuildInfo::InitializeCustomTypes() { diff --git a/mythtv/libs/libmythservicecontracts/datacontracts/connectionInfo.h b/mythtv/libs/libmythservicecontracts/datacontracts/connectionInfo.h index 8eef04173d5..ff3b751ee9a 100644 --- a/mythtv/libs/libmythservicecontracts/datacontracts/connectionInfo.h +++ b/mythtv/libs/libmythservicecontracts/datacontracts/connectionInfo.h @@ -66,7 +66,7 @@ class SERVICE_PUBLIC ConnectionInfo : public QObject Q_DISABLE_COPY(ConnectionInfo); }; -typedef ConnectionInfo* ConnectionInfoPtr; +using ConnectionInfoPtr = ConnectionInfo*; inline void ConnectionInfo::InitializeCustomTypes() { diff --git a/mythtv/libs/libmythservicecontracts/datacontracts/databaseInfo.h b/mythtv/libs/libmythservicecontracts/datacontracts/databaseInfo.h index 353b7e9fe56..0a180739df0 100644 --- a/mythtv/libs/libmythservicecontracts/datacontracts/databaseInfo.h +++ b/mythtv/libs/libmythservicecontracts/datacontracts/databaseInfo.h @@ -73,7 +73,7 @@ class SERVICE_PUBLIC DatabaseInfo : public QObject Q_DISABLE_COPY(DatabaseInfo); }; -typedef DatabaseInfo * DatabaseInfoPtr; +using DatabaseInfoPtr = DatabaseInfo*; inline void DatabaseInfo::InitializeCustomTypes() { diff --git a/mythtv/libs/libmythservicecontracts/datacontracts/envInfo.h b/mythtv/libs/libmythservicecontracts/datacontracts/envInfo.h index 76b8053293d..332bfce119f 100644 --- a/mythtv/libs/libmythservicecontracts/datacontracts/envInfo.h +++ b/mythtv/libs/libmythservicecontracts/datacontracts/envInfo.h @@ -64,7 +64,7 @@ class SERVICE_PUBLIC EnvInfo : public QObject Q_DISABLE_COPY(EnvInfo); }; -typedef EnvInfo* EnvInfoPtr; +using EnvInfoPtr = EnvInfo*; inline void EnvInfo::InitializeCustomTypes() { diff --git a/mythtv/libs/libmythservicecontracts/datacontracts/logInfo.h b/mythtv/libs/libmythservicecontracts/datacontracts/logInfo.h index 0cefed9e9b1..200f635cb1c 100644 --- a/mythtv/libs/libmythservicecontracts/datacontracts/logInfo.h +++ b/mythtv/libs/libmythservicecontracts/datacontracts/logInfo.h @@ -49,7 +49,7 @@ class SERVICE_PUBLIC LogInfo : public QObject Q_DISABLE_COPY(LogInfo); }; -typedef LogInfo* LogInfoPtr; +using LogInfoPtr = LogInfo*; inline void LogInfo::InitializeCustomTypes() { diff --git a/mythtv/libs/libmythservicecontracts/datacontracts/versionInfo.h b/mythtv/libs/libmythservicecontracts/datacontracts/versionInfo.h index 6ef098725d0..3cd2e7f3d2d 100644 --- a/mythtv/libs/libmythservicecontracts/datacontracts/versionInfo.h +++ b/mythtv/libs/libmythservicecontracts/datacontracts/versionInfo.h @@ -65,7 +65,7 @@ class SERVICE_PUBLIC VersionInfo : public QObject Q_DISABLE_COPY(VersionInfo); }; -typedef VersionInfo* VersionInfoPtr; +using VersionInfoPtr = VersionInfo*; inline void VersionInfo::InitializeCustomTypes() { diff --git a/mythtv/libs/libmythservicecontracts/datacontracts/wolInfo.h b/mythtv/libs/libmythservicecontracts/datacontracts/wolInfo.h index 5100a9f26f3..9796e8f2bb7 100644 --- a/mythtv/libs/libmythservicecontracts/datacontracts/wolInfo.h +++ b/mythtv/libs/libmythservicecontracts/datacontracts/wolInfo.h @@ -60,7 +60,7 @@ class SERVICE_PUBLIC WOLInfo : public QObject Q_DISABLE_COPY(WOLInfo); }; -typedef WOLInfo* WOLInfoPtr; +using WOLInfoPtr = WOLInfo*; inline void WOLInfo::InitializeCustomTypes() { diff --git a/mythtv/libs/libmythservicecontracts/service.cpp b/mythtv/libs/libmythservicecontracts/service.cpp index 7f99f2eaed1..133f3d41f3c 100644 --- a/mythtv/libs/libmythservicecontracts/service.cpp +++ b/mythtv/libs/libmythservicecontracts/service.cpp @@ -105,7 +105,7 @@ void* Service::ConvertToParameterPtr( int nTypeId, int nParentId = QMetaType::type( sParentFQN.toUtf8() ); - QObject *pParentClass = (QObject *)QMetaType::create( nParentId ); + auto *pParentClass = (QObject *)QMetaType::create( nParentId ); if (pParentClass == nullptr) break; diff --git a/mythtv/libs/libmythservicecontracts/test/test_datacontracts/test_datacontracts.cpp b/mythtv/libs/libmythservicecontracts/test/test_datacontracts/test_datacontracts.cpp index e774aca3d63..737a42bb04b 100644 --- a/mythtv/libs/libmythservicecontracts/test/test_datacontracts/test_datacontracts.cpp +++ b/mythtv/libs/libmythservicecontracts/test/test_datacontracts/test_datacontracts.cpp @@ -35,7 +35,7 @@ void TestDataContracts::cleanupTestCase(void) void TestDataContracts::test_channelinfo(void) { - DTC::ChannelInfo *pChan = new DTC::ChannelInfo(); + auto *pChan = new DTC::ChannelInfo(); pChan->setChanId(1119); pChan->setChanNum("119"); pChan->setCallSign("WEATH"); @@ -48,7 +48,7 @@ void TestDataContracts::test_channelinfo(void) QCOMPARE(known, qtype); // Convert back to DTC::Program - DTC::ChannelInfo *pChan2 = v.value(); + auto *pChan2 = v.value(); QCOMPARE(pChan->ChanId(), pChan2->ChanId()); QCOMPARE(pChan->ChanNum(), pChan2->ChanNum()); QCOMPARE(pChan->CallSign(), pChan2->CallSign()); @@ -58,7 +58,7 @@ void TestDataContracts::test_channelinfo(void) void TestDataContracts::test_program(void) { // Create DTC::Program - DTC::Program *pProgram = new DTC::Program(); + auto *pProgram = new DTC::Program(); pProgram->setTitle("Big Buck Bunny"); pProgram->setDescription("Follow a day of the life of Big Buck Bunny " "when he meets three bullying rodents..."); @@ -72,7 +72,7 @@ void TestDataContracts::test_program(void) QCOMPARE(known, qtype); // Convert back to DTC::Program - DTC::Program *pProgram2 = v.value(); + auto *pProgram2 = v.value(); QCOMPARE(pProgram->Title(), pProgram2->Title()); QCOMPARE(pProgram->Description(), pProgram2->Description()); QCOMPARE(pProgram->Inetref(), pProgram2->Inetref()); @@ -82,7 +82,7 @@ void TestDataContracts::test_program(void) void TestDataContracts::test_programlist(void) { // Create ProgramList with one Program - DTC::ProgramList *pPrograms = new DTC::ProgramList(); + auto *pPrograms = new DTC::ProgramList(); DTC::Program *pProgram = pPrograms->AddNewProgram(); pProgram->setTitle("Big Buck Bunny"); pProgram->setDescription("Follow a day of the life of Big Buck Bunny " @@ -103,7 +103,7 @@ void TestDataContracts::test_programlist(void) QCOMPARE(known, qtype); // Convert back to DTC::ProgramList - DTC::ProgramList *pPrograms2 = v.value(); + auto *pPrograms2 = v.value(); QCOMPARE(pPrograms->StartIndex(), pPrograms2->StartIndex()); QCOMPARE(pPrograms->Count(), pPrograms2->Count()); QCOMPARE(pPrograms->TotalAvailable(), pPrograms2->TotalAvailable()); @@ -114,7 +114,7 @@ void TestDataContracts::test_programlist(void) // Check the program QVariant v2 = pPrograms2->Programs()[0]; - DTC::Program *pProgram2 = v2.value(); + auto *pProgram2 = v2.value(); QCOMPARE(pProgram->Title(), pProgram2->Title()); QCOMPARE(pProgram->Description(), pProgram2->Description()); QCOMPARE(pProgram->Inetref(), pProgram2->Inetref()); @@ -124,7 +124,7 @@ void TestDataContracts::test_programlist(void) void TestDataContracts::test_recrule(void) { // Create DTC::RecRule - DTC::RecRule *pRule = new DTC::RecRule(); + auto *pRule = new DTC::RecRule(); pRule->setId(12345); pRule->setTitle("Big Buck Bunny"); pRule->setSubTitle("Bunny"); @@ -140,7 +140,7 @@ void TestDataContracts::test_recrule(void) QCOMPARE(known, qtype); // Convert back to DTC::RecRule - DTC::RecRule *pRule2 = v.value(); + auto *pRule2 = v.value(); QCOMPARE(pRule->Id(), pRule2->Id()); QCOMPARE(pRule->Title(), pRule2->Title()); QCOMPARE(pRule->SubTitle(), pRule2->SubTitle()); @@ -154,7 +154,7 @@ void TestDataContracts::test_recordinginfo(void) QDateTime now = QDateTime::currentDateTime(); // Create DTC::RecordingInfo - DTC::RecordingInfo *pRecording = new DTC::RecordingInfo(); + auto *pRecording = new DTC::RecordingInfo(); pRecording->setRecordedId(12345); pRecording->setStatus(RecStatus::Recorded); pRecording->setStartTs(now); @@ -167,7 +167,7 @@ void TestDataContracts::test_recordinginfo(void) QCOMPARE(known, qtype); // Convert back to DTC::RecordingInfo - DTC::RecordingInfo *pRecording2 = v.value(); + auto *pRecording2 = v.value(); QCOMPARE(pRecording->RecordedId(), pRecording2->RecordedId()); QCOMPARE(pRecording->Status(), pRecording2->Status()); QCOMPARE(pRecording->StartTs(), pRecording2->StartTs()); diff --git a/mythtv/libs/libmythtv/AirPlay/mythairplayserver.cpp b/mythtv/libs/libmythtv/AirPlay/mythairplayserver.cpp index 690ddcb0e2d..d563e119f4a 100644 --- a/mythtv/libs/libmythtv/AirPlay/mythairplayserver.cpp +++ b/mythtv/libs/libmythtv/AirPlay/mythairplayserver.cpp @@ -537,7 +537,7 @@ void MythAirplayServer::newConnection(QTcpSocket *client) void MythAirplayServer::deleteConnection(void) { QMutexLocker locker(m_lock); - QTcpSocket *socket = dynamic_cast(sender()); + auto *socket = dynamic_cast(sender()); if (!socket) return; @@ -601,7 +601,7 @@ void MythAirplayServer::deleteConnection(QTcpSocket *socket) void MythAirplayServer::read(void) { QMutexLocker locker(m_lock); - QTcpSocket *socket = dynamic_cast(sender()); + auto *socket = dynamic_cast(sender()); if (!socket) return; @@ -612,7 +612,7 @@ void MythAirplayServer::read(void) if (!m_incoming.contains(socket)) { - APHTTPRequest *request = new APHTTPRequest(buf); + auto *request = new APHTTPRequest(buf); m_incoming.insert(socket, request); } else @@ -807,7 +807,7 @@ void MythAirplayServer::HandleResponse(APHTTPRequest *req, if (req->GetMethod() == "POST") { // this may be received before playback starts... - uint64_t intpos = (uint64_t)pos; + auto intpos = (uint64_t)pos; m_connections[session].m_position = pos; LOG(VB_GENERAL, LOG_INFO, LOC + QString("Scrub: (post) seek to %1").arg(intpos)); @@ -1210,8 +1210,7 @@ void MythAirplayServer::StartPlayback(const QString &pathname) LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Sending ACTION_HANDLEMEDIA for %1") .arg(pathname)); - MythEvent* me = new MythEvent(ACTION_HANDLEMEDIA, - QStringList(pathname)); + auto* me = new MythEvent(ACTION_HANDLEMEDIA, QStringList(pathname)); qApp->postEvent(GetMythMainWindow(), me); // Wait until we receive that the play has started gCoreContext->WaitUntilSignals(SIGNAL(TVPlaybackStarted()), @@ -1229,8 +1228,8 @@ void MythAirplayServer::StopPlayback(void) QString("Sending ACTION_STOP for %1") .arg(m_pathname)); - QKeyEvent* ke = new QKeyEvent(QEvent::KeyPress, 0, - Qt::NoModifier, ACTION_STOP); + auto* ke = new QKeyEvent(QEvent::KeyPress, 0, + Qt::NoModifier, ACTION_STOP); qApp->postEvent(GetMythMainWindow(), (QEvent*)ke); // Wait until we receive that playback has stopped gCoreContext->WaitUntilSignals(SIGNAL(TVPlaybackStopped()), @@ -1255,8 +1254,8 @@ void MythAirplayServer::SeekPosition(uint64_t position) .arg(position) .arg(m_pathname)); - MythEvent* me = new MythEvent(ACTION_SEEKABSOLUTE, - QStringList(QString::number(position))); + auto* me = new MythEvent(ACTION_SEEKABSOLUTE, + QStringList(QString::number(position))); qApp->postEvent(GetMythMainWindow(), me); // Wait until we receive that the seek has completed gCoreContext->WaitUntilSignals(SIGNAL(TVPlaybackSought(qint64)), @@ -1281,8 +1280,8 @@ void MythAirplayServer::PausePlayback(void) QString("Sending ACTION_PAUSE for %1") .arg(m_pathname)); - QKeyEvent* ke = new QKeyEvent(QEvent::KeyPress, 0, - Qt::NoModifier, ACTION_PAUSE); + auto* ke = new QKeyEvent(QEvent::KeyPress, 0, + Qt::NoModifier, ACTION_PAUSE); qApp->postEvent(GetMythMainWindow(), (QEvent*)ke); // Wait until we receive that playback has stopped gCoreContext->WaitUntilSignals(SIGNAL(TVPlaybackPaused()), @@ -1307,8 +1306,8 @@ void MythAirplayServer::UnpausePlayback(void) QString("Sending ACTION_PLAY for %1") .arg(m_pathname)); - QKeyEvent* ke = new QKeyEvent(QEvent::KeyPress, 0, - Qt::NoModifier, ACTION_PLAY); + auto* ke = new QKeyEvent(QEvent::KeyPress, 0, + Qt::NoModifier, ACTION_PLAY); qApp->postEvent(GetMythMainWindow(), (QEvent*)ke); // Wait until we receive that playback has stopped gCoreContext->WaitUntilSignals(SIGNAL(TVPlaybackPlaying()), diff --git a/mythtv/libs/libmythtv/AirPlay/mythairplayserver.h b/mythtv/libs/libmythtv/AirPlay/mythairplayserver.h index 3eba195b0a5..eaf32358e0a 100644 --- a/mythtv/libs/libmythtv/AirPlay/mythairplayserver.h +++ b/mythtv/libs/libmythtv/AirPlay/mythairplayserver.h @@ -89,12 +89,12 @@ class MTV_PUBLIC MythAirplayServer : public ServerPool ~MythAirplayServer(void) override; void Teardown(void); void HandleResponse(APHTTPRequest *req, QTcpSocket *socket); - QByteArray StatusToString(int status); - QString eventToString(AirplayEvent event); - void GetPlayerStatus(bool &playing, float &speed, - double &position, double &duration, - QString &pathname); - QString GetMacAddress(); + static QByteArray StatusToString(int status); + static QString eventToString(AirplayEvent event); + static void GetPlayerStatus(bool &playing, float &speed, + double &position, double &duration, + QString &pathname); + static QString GetMacAddress(); bool SendReverseEvent(QByteArray &session, AirplayEvent event); void SendResponse(QTcpSocket *socket, int status, const QByteArray& header, diff --git a/mythtv/libs/libmythtv/AirPlay/mythraopconnection.cpp b/mythtv/libs/libmythtv/AirPlay/mythraopconnection.cpp index d2c25ba3263..3208b9d2bac 100644 --- a/mythtv/libs/libmythtv/AirPlay/mythraopconnection.cpp +++ b/mythtv/libs/libmythtv/AirPlay/mythraopconnection.cpp @@ -319,7 +319,7 @@ void MythRAOPConnection::udpDataReady(QByteArray buf, const QHostAddress& /*peer // Check that the audio packet is valid, do so by decoding it. If an error // occurs, ask to resend it - QList *decoded = new QList(); + auto *decoded = new QList(); int numframes = decodeAudioPacket(type, &buf, decoded); if (numframes < 0) { @@ -627,7 +627,7 @@ uint32_t MythRAOPConnection::decodeAudioPacket(uint8_t type, tmp_pkt.size = len; uint32_t frames_added = 0; - uint8_t *samples = (uint8_t *)av_mallocz(AudioOutput::MAX_SIZE_BUFFER); + auto *samples = (uint8_t *)av_mallocz(AudioOutput::MAX_SIZE_BUFFER); while (tmp_pkt.size > 0) { int data_size; @@ -817,7 +817,7 @@ void MythRAOPConnection::audioRetry(void) */ void MythRAOPConnection::readClient(void) { - QTcpSocket *socket = dynamic_cast(sender()); + auto *socket = dynamic_cast(sender()); if (!socket) return; @@ -959,7 +959,7 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header, if (!LoadKey()) return; int tosize = RSA_size(LoadKey()); - uint8_t *to = new uint8_t[tosize]; + auto *to = new uint8_t[tosize]; QByteArray challenge = QByteArray::fromBase64(tags["Apple-Challenge"].toLatin1()); @@ -1465,8 +1465,8 @@ void MythRAOPConnection::FinishResponse(_NetStream *stream, QTcpSocket *socket, */ RSA *MythRAOPConnection::LoadKey(void) { - static QMutex lock; - QMutexLocker locker(&lock); + static QMutex s_lock; + QMutexLocker locker(&s_lock); if (g_rsa) return g_rsa; @@ -1618,7 +1618,7 @@ bool MythRAOPConnection::CreateDecoder(void) m_codeccontext = avcodec_alloc_context3(m_codec); if (m_codeccontext) { - unsigned char *extradata = new unsigned char[36]; + auto *extradata = new unsigned char[36]; memset(extradata, 0, 36); if (m_audioFormat.size() < 12) { @@ -1734,7 +1734,7 @@ int64_t MythRAOPConnection::AudioCardLatency(void) if (!m_audio) return 0; - int16_t *samples = (int16_t *)av_mallocz(AudioOutput::MAX_SIZE_BUFFER); + auto *samples = (int16_t *)av_mallocz(AudioOutput::MAX_SIZE_BUFFER); int frames = AUDIOCARD_BUFFER * m_frameRate / 1000; m_audio->AddData((char *)samples, frames * (m_sampleSize>>3) * m_channels, @@ -1760,7 +1760,7 @@ void MythRAOPConnection::newEventClient(QTcpSocket *client) void MythRAOPConnection::deleteEventClient(void) { - QTcpSocket *client = dynamic_cast(sender()); + auto *client = dynamic_cast(sender()); QString label; if (client != nullptr) diff --git a/mythtv/libs/libmythtv/AirPlay/mythraopconnection.h b/mythtv/libs/libmythtv/AirPlay/mythraopconnection.h index 203e950dd80..86e9df9d288 100644 --- a/mythtv/libs/libmythtv/AirPlay/mythraopconnection.h +++ b/mythtv/libs/libmythtv/AirPlay/mythraopconnection.h @@ -27,7 +27,7 @@ class AudioOutput; class ServerPool; class _NetStream; -typedef QHash RawHash; +using RawHash = QHash; struct AudioData { @@ -79,12 +79,12 @@ class MTV_PUBLIC MythRAOPConnection : public QObject void ResetAudio(void); void ProcessRequest(const QStringList &header, const QByteArray &content); - void FinishResponse(_NetStream *stream, QTcpSocket *socket, - QString &option, QString &cseq, QString &responseData); + static void FinishResponse(_NetStream *stream, QTcpSocket *socket, + QString &option, QString &cseq, QString &responseData); void FinishAuthenticationResponse(_NetStream *stream, QTcpSocket *socket, QString &cseq); - RawHash FindTags(const QStringList &lines); + static RawHash FindTags(const QStringList &lines); bool CreateDecoder(void); void DestroyDecoder(void); bool OpenAudioDevice(void); @@ -96,16 +96,16 @@ class MTV_PUBLIC MythRAOPConnection : public QObject // time sync void SendTimeRequest(void); void ProcessTimeResponse(const QByteArray &buf); - uint64_t NTPToLocal(uint32_t sec, uint32_t ticks); + static uint64_t NTPToLocal(uint32_t sec, uint32_t ticks); // incoming data packet - bool GetPacketType(const QByteArray &buf, uint8_t &type, + static bool GetPacketType(const QByteArray &buf, uint8_t &type, uint16_t &seq, uint64_t ×tamp); // utility functions int64_t AudioCardLatency(void); - QStringList splitLines(const QByteArray &lines); - QString stringFromSeconds(int timeInSeconds); + static QStringList splitLines(const QByteArray &lines); + static QString stringFromSeconds(int timeInSeconds); uint64_t framesToMs(uint64_t frames); // notification functions diff --git a/mythtv/libs/libmythtv/AirPlay/mythraopdevice.cpp b/mythtv/libs/libmythtv/AirPlay/mythraopdevice.cpp index 3805cc93cb6..12bdde8489c 100644 --- a/mythtv/libs/libmythtv/AirPlay/mythraopdevice.cpp +++ b/mythtv/libs/libmythtv/AirPlay/mythraopdevice.cpp @@ -215,8 +215,7 @@ void MythRAOPDevice::newConnection(QTcpSocket *client) n.SetVisibility(n.GetVisibility() & ~MythNotification::kPlayback); GetNotificationCenter()->Queue(n); - MythRAOPConnection *obj = - new MythRAOPConnection(this, client, m_hardwareId, 6000); + auto *obj = new MythRAOPConnection(this, client, m_hardwareId, 6000); if (obj->Init()) { diff --git a/mythtv/libs/libmythtv/Bluray/avformatdecoderbd.cpp b/mythtv/libs/libmythtv/Bluray/avformatdecoderbd.cpp index 7dca28057fd..d9f1e50780c 100644 --- a/mythtv/libs/libmythtv/Bluray/avformatdecoderbd.cpp +++ b/mythtv/libs/libmythtv/Bluray/avformatdecoderbd.cpp @@ -30,7 +30,7 @@ void AvFormatDecoderBD::UpdateFramesPlayed(void) if (!ringBuffer->IsBD()) return; - long long currentpos = (long long)(ringBuffer->BD()->GetCurrentTime() * m_fps); + auto currentpos = (long long)(ringBuffer->BD()->GetCurrentTime() * m_fps); m_framesPlayed = m_framesRead = currentpos ; m_parent->SetFramesPlayed(currentpos + 1); } diff --git a/mythtv/libs/libmythtv/Bluray/bdiowrapper.cpp b/mythtv/libs/libmythtv/Bluray/bdiowrapper.cpp index 492c5e024f9..b070fdb0e7d 100644 --- a/mythtv/libs/libmythtv/Bluray/bdiowrapper.cpp +++ b/mythtv/libs/libmythtv/Bluray/bdiowrapper.cpp @@ -57,7 +57,7 @@ static BD_DIR_H *dir_open_mythiowrapper(const char* dirname) return sDefaultDirOpen(dirname); } - BD_DIR_H *dir = (BD_DIR_H*)calloc(1, sizeof(BD_DIR_H)); + auto *dir = (BD_DIR_H*)calloc(1, sizeof(BD_DIR_H)); LOG(VB_FILE, LOG_DEBUG, LOC + QString("Opening mythdir dir %1...").arg(dirname)); dir->close = dir_close_mythiowrapper; @@ -119,7 +119,7 @@ static BD_FILE_H *file_open_mythiowrapper(const char* filename, const char *cmod return sDefaultFileOpen(filename, cmode); } - BD_FILE_H *file = (BD_FILE_H*)calloc(1, sizeof(BD_FILE_H)); + auto *file = (BD_FILE_H*)calloc(1, sizeof(BD_FILE_H)); LOG(VB_FILE, LOG_DEBUG, LOC + QString("Opening mythfile file %1...").arg(filename)); file->close = file_close_mythiowrapper; diff --git a/mythtv/libs/libmythtv/Bluray/bdoverlayscreen.cpp b/mythtv/libs/libmythtv/Bluray/bdoverlayscreen.cpp index 6a4b267f02e..45bd8cb2c70 100644 --- a/mythtv/libs/libmythtv/Bluray/bdoverlayscreen.cpp +++ b/mythtv/libs/libmythtv/Bluray/bdoverlayscreen.cpp @@ -51,7 +51,7 @@ void BDOverlayScreen::DisplayBDOverlay(BDOverlay *overlay) if (image) { image->Assign(img); - MythUIImage *uiimage = new MythUIImage(this, "bdoverlay"); + auto *uiimage = new MythUIImage(this, "bdoverlay"); if (uiimage) { uiimage->SetImage(image); diff --git a/mythtv/libs/libmythtv/Bluray/bdringbuffer.cpp b/mythtv/libs/libmythtv/Bluray/bdringbuffer.cpp index 3dce5654758..1d1581e474c 100644 --- a/mythtv/libs/libmythtv/Bluray/bdringbuffer.cpp +++ b/mythtv/libs/libmythtv/Bluray/bdringbuffer.cpp @@ -105,21 +105,21 @@ void BDOverlay::wipe(int x, int y, int width, int height) static void HandleOverlayCallback(void *data, const bd_overlay_s *const overlay) { - BDRingBuffer *bdrb = (BDRingBuffer*) data; + auto *bdrb = (BDRingBuffer*) data; if (bdrb) bdrb->SubmitOverlay(overlay); } static void HandleARGBOverlayCallback(void *data, const bd_argb_overlay_s *const overlay) { - BDRingBuffer *bdrb = (BDRingBuffer*) data; + auto *bdrb = (BDRingBuffer*) data; if (bdrb) bdrb->SubmitARGBOverlay(overlay); } static void file_opened_callback(void* bdr) { - BDRingBuffer *obj = (BDRingBuffer*)bdr; + auto *obj = (BDRingBuffer*)bdr; if (obj) obj->ProgressUpdate(); } @@ -1481,7 +1481,7 @@ bool BDRingBuffer::IsInStillFrame(void) const * \param streamCount Number of streams in the array * \return Pointer to the matching stream if found, otherwise nullptr. */ -const BLURAY_STREAM_INFO* BDRingBuffer::FindStream(int streamid, BLURAY_STREAM_INFO* streams, int streamCount) const +const BLURAY_STREAM_INFO* BDRingBuffer::FindStream(int streamid, BLURAY_STREAM_INFO* streams, int streamCount) { const BLURAY_STREAM_INFO* stream = nullptr; @@ -1728,7 +1728,7 @@ void BDRingBuffer::SubmitOverlay(const bd_overlay_s * const overlay) case BD_OVERLAY_FLUSH: /* all changes have been done, flush overlay to display at given pts */ if (osd) { - BDOverlay* newOverlay = new BDOverlay(*osd); + auto* newOverlay = new BDOverlay(*osd); newOverlay->m_image = osd->m_image.convertToFormat(QImage::Format_ARGB32); newOverlay->m_pts = overlay->pts; @@ -1811,7 +1811,7 @@ void BDRingBuffer::SubmitARGBOverlay(const bd_argb_overlay_s * const overlay) if (osd) { QMutexLocker lock(&m_overlayLock); - BDOverlay* newOverlay = new BDOverlay(*osd); + auto* newOverlay = new BDOverlay(*osd); newOverlay->m_pts = overlay->pts; m_overlayImages.append(newOverlay); } diff --git a/mythtv/libs/libmythtv/Bluray/bdringbuffer.h b/mythtv/libs/libmythtv/Bluray/bdringbuffer.h index b2cccb60f12..3162978dba0 100644 --- a/mythtv/libs/libmythtv/Bluray/bdringbuffer.h +++ b/mythtv/libs/libmythtv/Bluray/bdringbuffer.h @@ -161,15 +161,15 @@ class MTV_PUBLIC BDRingBuffer : public RingBuffer bool HandleBDEvents(void); void HandleBDEvent(BD_EVENT &event); - const BLURAY_STREAM_INFO* FindStream(int streamid, BLURAY_STREAM_INFO* streams, int streamCount) const; + static const BLURAY_STREAM_INFO* FindStream(int streamid, BLURAY_STREAM_INFO* streams, int streamCount); - typedef enum + enum processState_t { PROCESS_NORMAL, PROCESS_REPROCESS, PROCESS_WAIT - }processState_t; + }; BLURAY *m_bdnav {nullptr}; bool m_isHDMVNavigation {false}; diff --git a/mythtv/libs/libmythtv/Bluray/mythbdplayer.cpp b/mythtv/libs/libmythtv/Bluray/mythbdplayer.cpp index f8cc6f6b705..dcc6d7fcb2a 100644 --- a/mythtv/libs/libmythtv/Bluray/mythbdplayer.cpp +++ b/mythtv/libs/libmythtv/Bluray/mythbdplayer.cpp @@ -402,7 +402,7 @@ void MythBDPlayer::SetBookmark(bool clear) else LOG(VB_PLAYBACK, LOG_INFO, LOC + "Clear bookmark"); - player_ctx->m_playingInfo->SaveBDBookmark(fields); + ProgramInfo::SaveBDBookmark(fields); } player_ctx->UnlockPlayingInfo(__FILE__, __LINE__); diff --git a/mythtv/libs/libmythtv/DVD/avformatdecoderdvd.cpp b/mythtv/libs/libmythtv/DVD/avformatdecoderdvd.cpp index 1c9e469c120..aebc364d9a3 100644 --- a/mythtv/libs/libmythtv/DVD/avformatdecoderdvd.cpp +++ b/mythtv/libs/libmythtv/DVD/avformatdecoderdvd.cpp @@ -56,7 +56,7 @@ void AvFormatDecoderDVD::UpdateFramesPlayed(void) if (!ringBuffer->IsDVD()) return; - long long currentpos = (long long)(ringBuffer->DVD()->GetCurrentTime() * m_fps); + auto currentpos = (long long)(ringBuffer->DVD()->GetCurrentTime() * m_fps); m_framesPlayed = m_framesRead = currentpos ; m_parent->SetFramesPlayed(currentpos + 1); } diff --git a/mythtv/libs/libmythtv/DVD/avformatdecoderdvd.h b/mythtv/libs/libmythtv/DVD/avformatdecoderdvd.h index c53f96b6816..ba420e4c057 100644 --- a/mythtv/libs/libmythtv/DVD/avformatdecoderdvd.h +++ b/mythtv/libs/libmythtv/DVD/avformatdecoderdvd.h @@ -36,7 +36,7 @@ class AvFormatDecoderDVD : public AvFormatDecoder void CheckContext(int64_t pts); void ReleaseLastVideoPkt(); - void ReleaseContext(MythDVDContext *&context); + static void ReleaseContext(MythDVDContext *&context); long long DVDFindPosition(long long desiredFrame); diff --git a/mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp b/mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp index 0a53b0cb9f8..f42ca7a8771 100644 --- a/mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp +++ b/mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp @@ -738,8 +738,7 @@ int DVDRingBuffer::safe_read(void *data, uint sz) case DVDNAV_CELL_CHANGE: { // get event details - dvdnav_cell_change_event_t *cell_event = - (dvdnav_cell_change_event_t*) (blockBuf); + auto *cell_event = (dvdnav_cell_change_event_t*) (blockBuf); // update information for the current cell m_cellChanged = true; @@ -847,8 +846,7 @@ int DVDRingBuffer::safe_read(void *data, uint sz) case DVDNAV_SPU_STREAM_CHANGE: { // get event details - dvdnav_spu_stream_change_event_t* spu = - (dvdnav_spu_stream_change_event_t*)(blockBuf); + auto* spu = (dvdnav_spu_stream_change_event_t*)(blockBuf); // clear any existing subs/buttons IncrementButtonVersion; @@ -875,8 +873,7 @@ int DVDRingBuffer::safe_read(void *data, uint sz) case DVDNAV_AUDIO_STREAM_CHANGE: { // get event details - dvdnav_audio_stream_change_event_t* audio = - (dvdnav_audio_stream_change_event_t*)(blockBuf); + auto* audio = (dvdnav_audio_stream_change_event_t*)(blockBuf); // retrieve the new track int new_track = GetAudioTrackNum(audio->physical); @@ -1082,8 +1079,7 @@ int DVDRingBuffer::safe_read(void *data, uint sz) case DVDNAV_VTS_CHANGE: { // retrieve event details - dvdnav_vts_change_event_t* vts = - (dvdnav_vts_change_event_t*)(blockBuf); + auto* vts = (dvdnav_vts_change_event_t*)(blockBuf); // update player int aspect = dvdnav_get_video_aspect(m_dvdnav); @@ -1125,8 +1121,7 @@ int DVDRingBuffer::safe_read(void *data, uint sz) case DVDNAV_HIGHLIGHT: { // retrieve details - dvdnav_highlight_event_t* hl = - (dvdnav_highlight_event_t*)(blockBuf); + auto* hl = (dvdnav_highlight_event_t*)(blockBuf); // update the current button m_menuBtnLock.lock(); @@ -1153,8 +1148,7 @@ int DVDRingBuffer::safe_read(void *data, uint sz) case DVDNAV_STILL_FRAME: { // retrieve still frame details (length) - dvdnav_still_event_t* still = - (dvdnav_still_event_t*)(blockBuf); + auto* still = (dvdnav_still_event_t*)(blockBuf); if (!bReprocessing && !m_skipstillorwait) { diff --git a/mythtv/libs/libmythtv/DVD/dvdringbuffer.h b/mythtv/libs/libmythtv/DVD/dvdringbuffer.h index fef64bf1206..0f64e40b96b 100644 --- a/mythtv/libs/libmythtv/DVD/dvdringbuffer.h +++ b/mythtv/libs/libmythtv/DVD/dvdringbuffer.h @@ -199,12 +199,12 @@ class MTV_PUBLIC DVDRingBuffer : public RingBuffer int safe_read(void *data, uint sz) override; //RingBuffer long long SeekInternal(long long pos, int whence) override; //RingBuffer - typedef enum + enum processState_t { PROCESS_NORMAL, PROCESS_REPROCESS, PROCESS_WAIT - }processState_t; + }; dvdnav_t *m_dvdnav {nullptr}; unsigned char m_dvdBlockWriteBuf[DVD_BLOCK_SIZE] {0}; @@ -295,18 +295,18 @@ class MTV_PUBLIC DVDRingBuffer : public RingBuffer long long Seek(long long time); void ClearChapterCache(void); - uint ConvertLangCode(uint16_t code); + static uint ConvertLangCode(uint16_t code); void SelectDefaultButton(void); void WaitForPlayer(void); - int get_nibble(const uint8_t *buf, int nibble_offset); - int decode_rle(uint8_t *bitmap, int linesize, int w, int h, + static int get_nibble(const uint8_t *buf, int nibble_offset); + static int decode_rle(uint8_t *bitmap, int linesize, int w, int h, const uint8_t *buf, int nibble_offset, int buf_size); void guess_palette(uint32_t *rgba_palette,const uint8_t *palette, const uint8_t *alpha); - int is_transp(const uint8_t *buf, int pitch, int n, - const uint8_t *transp_color); - int find_smallest_bounding_rectangle(AVSubtitle *s); + static int is_transp(const uint8_t *buf, int pitch, int n, + const uint8_t *transp_color); + static int find_smallest_bounding_rectangle(AVSubtitle *s); }; #endif // DVD_RING_BUFFER_H_ diff --git a/mythtv/libs/libmythtv/DVD/mythdvdplayer.cpp b/mythtv/libs/libmythtv/DVD/mythdvdplayer.cpp index b39f4825b78..6c2f3c5d8a2 100644 --- a/mythtv/libs/libmythtv/DVD/mythdvdplayer.cpp +++ b/mythtv/libs/libmythtv/DVD/mythdvdplayer.cpp @@ -374,7 +374,7 @@ void MythDVDPlayer::SetBookmark(bool clear) else LOG(VB_PLAYBACK, LOG_INFO, LOC + "Clear bookmark"); - player_ctx->m_playingInfo->SaveDVDBookmark(fields); + ProgramInfo::SaveDVDBookmark(fields); } player_ctx->UnlockPlayingInfo(__FILE__, __LINE__); @@ -470,7 +470,7 @@ long long MythDVDPlayer::CalcMaxFFTime(long long ff, bool setjump) const return MythPlayer::CalcMaxFFTime(ff, setjump); } -int64_t MythDVDPlayer::GetSecondsPlayed(bool /*honorCutList*/, int divisor) const +int64_t MythDVDPlayer::GetSecondsPlayed(bool /*honorCutList*/, int divisor) { if (!player_ctx->m_buffer->IsDVD()) return 0; diff --git a/mythtv/libs/libmythtv/DVD/mythdvdplayer.h b/mythtv/libs/libmythtv/DVD/mythdvdplayer.h index c43b6c78fdd..45b5909b62f 100644 --- a/mythtv/libs/libmythtv/DVD/mythdvdplayer.h +++ b/mythtv/libs/libmythtv/DVD/mythdvdplayer.h @@ -24,7 +24,7 @@ class MythDVDPlayer : public MythPlayer // Gets uint64_t GetBookmark(void) override; // MythPlayer int64_t GetSecondsPlayed(bool honorCutList, - int divisor = 1000) const override; // MythPlayer + int divisor = 1000) override; // MythPlayer int64_t GetTotalSeconds(bool honorCutList, int divisor = 1000) const override; // MythPlayer diff --git a/mythtv/libs/libmythtv/HLS/httplivestream.cpp b/mythtv/libs/libmythtv/HLS/httplivestream.cpp index 7528812a6dc..d977af1939c 100644 --- a/mythtv/libs/libmythtv/HLS/httplivestream.cpp +++ b/mythtv/libs/libmythtv/HLS/httplivestream.cpp @@ -816,8 +816,7 @@ DTC::LiveStreamInfo *HTTPLiveStream::StartStream(void) if (GetDBStatus() != kHLSStatusQueued) return GetLiveStreamInfo(); - HTTPLiveStreamThread *streamThread = - new HTTPLiveStreamThread(GetStreamID()); + auto *streamThread = new HTTPLiveStreamThread(GetStreamID()); MThreadPool::globalInstance()->startReserved(streamThread, "HTTPLiveStream"); MythTimer statusTimer; @@ -852,7 +851,7 @@ bool HTTPLiveStream::RemoveStream(int id) return false; } - HTTPLiveStream *hls = new HTTPLiveStream(id); + auto *hls = new HTTPLiveStream(id); if (hls->GetDBStatus() == kHLSStatusRunning) { HTTPLiveStream::StopStream(id); @@ -927,7 +926,7 @@ DTC::LiveStreamInfo *HTTPLiveStream::StopStream(int id) return nullptr; } - HTTPLiveStream *hls = new HTTPLiveStream(id); + auto *hls = new HTTPLiveStream(id); if (!hls) return nullptr; @@ -996,7 +995,7 @@ DTC::LiveStreamInfo *HTTPLiveStream::GetLiveStreamInfo( DTC::LiveStreamInfoList *HTTPLiveStream::GetLiveStreamInfoList(const QString &FileName) { - DTC::LiveStreamInfoList *infoList = new DTC::LiveStreamInfoList(); + auto *infoList = new DTC::LiveStreamInfoList(); QString sql = "SELECT id FROM livestream "; diff --git a/mythtv/libs/libmythtv/HLS/httplivestream.h b/mythtv/libs/libmythtv/HLS/httplivestream.h index 9c07ff44953..e29401acb6d 100644 --- a/mythtv/libs/libmythtv/HLS/httplivestream.h +++ b/mythtv/libs/libmythtv/HLS/httplivestream.h @@ -7,7 +7,7 @@ #include "mythframe.h" -typedef enum { +enum HTTPLiveStreamStatus { kHLSStatusUndefined = -1, kHLSStatusQueued = 0, kHLSStatusStarting = 1, @@ -16,7 +16,7 @@ typedef enum { kHLSStatusErrored = 4, kHLSStatusStopping = 5, kHLSStatusStopped = 6 -} HTTPLiveStreamStatus; +}; class MTV_PUBLIC HTTPLiveStream @@ -68,7 +68,7 @@ class MTV_PUBLIC HTTPLiveStream bool UpdateStatusMessage(const QString& message); bool UpdatePercentComplete(int percent); - QString StatusToString(HTTPLiveStreamStatus status); + static QString StatusToString(HTTPLiveStreamStatus status); bool CheckStop(void); diff --git a/mythtv/libs/libmythtv/HLS/httplivestreambuffer.cpp b/mythtv/libs/libmythtv/HLS/httplivestreambuffer.cpp index d7592bd0a66..6f7ed9cf508 100644 --- a/mythtv/libs/libmythtv/HLS/httplivestreambuffer.cpp +++ b/mythtv/libs/libmythtv/HLS/httplivestreambuffer.cpp @@ -125,7 +125,7 @@ class HLSSegment m_url = uri; m_title = title; #ifdef USING_LIBCRYPTO - m_psz_key_path = current_key_path; + m_pszKeyPath = current_key_path; #else Q_UNUSED(current_key_path); #endif @@ -151,7 +151,7 @@ class HLSSegment // m_played = m_played; m_title = rhs.m_title; #ifdef USING_LIBCRYPTO - m_psz_key_path = rhs.m_psz_key_path; + m_pszKeyPath = rhs.m_pszKeyPath; memcpy(&m_aeskey, &(rhs.m_aeskey), sizeof(m_aeskey)); m_keyloaded = rhs.m_keyloaded; #endif @@ -278,7 +278,7 @@ class HLSSegment if (m_keyloaded) return RET_OK; QByteArray key; - bool ret = downloadURL(m_psz_key_path, &key); + bool ret = downloadURL(m_pszKeyPath, &key); if (!ret || key.size() != AES_BLOCK_SIZE) { if (ret) @@ -347,7 +347,7 @@ class HLSSegment bool HasKeyPath(void) const { - return !m_psz_key_path.isEmpty(); + return !m_pszKeyPath.isEmpty(); } bool KeyLoaded(void) const @@ -357,12 +357,12 @@ class HLSSegment QString KeyPath(void) const { - return m_psz_key_path; + return m_pszKeyPath; } void SetKeyPath(const QString &path) { - m_psz_key_path = path; + m_pszKeyPath = path; } void CopyAESKey(const HLSSegment &segment) @@ -373,7 +373,7 @@ class HLSSegment private: AES_KEY m_aeskey {}; // AES-128 key bool m_keyloaded {false}; - QString m_psz_key_path; // URL key path + QString m_pszKeyPath; // URL key path #endif private: @@ -400,7 +400,7 @@ class HLSStream m_bitrate = bitrate; m_url = uri; #ifdef USING_LIBCRYPTO - memset(m_AESIV, 0, sizeof(m_AESIV)); + memset(m_aesIv, 0, sizeof(m_aesIv)); #endif } @@ -414,7 +414,7 @@ class HLSStream for (; it != m_segments.end(); ++it) { const HLSSegment *old = *it; - HLSSegment *segment = new HLSSegment(*old); + auto *segment = new HLSSegment(*old); AppendSegment(segment); } } @@ -446,7 +446,7 @@ class HLSStream #ifdef USING_LIBCRYPTO m_keypath = rhs.m_keypath; m_ivloaded = rhs.m_ivloaded; - memcpy(m_AESIV, rhs.m_AESIV, sizeof(m_AESIV)); + memcpy(m_aesIv, rhs.m_aesIv, sizeof(m_aesIv)); #endif return *this; } @@ -560,8 +560,7 @@ class HLSStream #ifndef USING_LIBCRYPTO QString m_keypath; #endif - HLSSegment *segment = new HLSSegment(duration, id, title, psz_uri, - m_keypath); + auto *segment = new HLSSegment(duration, id, title, psz_uri, m_keypath); AppendSegment(segment); m_duration += duration; } @@ -681,7 +680,7 @@ class HLSStream return RET_OK; } } - if (segment->DecodeData(m_ivloaded ? m_AESIV : nullptr) != RET_OK) + if (segment->DecodeData(m_ivloaded ? m_aesIv : nullptr) != RET_OK) { segment->Unlock(); return RET_ERROR; @@ -835,13 +834,13 @@ class HLSStream int padding = max(0, AES_BLOCK_SIZE - (line.size() - 2)); QByteArray ba = QByteArray(padding, 0x0); ba.append(QByteArray::fromHex(QByteArray(line.toLatin1().constData() + 2))); - memcpy(m_AESIV, ba.constData(), ba.size()); + memcpy(m_aesIv, ba.constData(), ba.size()); m_ivloaded = true; return true; } uint8_t *AESIV(void) { - return m_AESIV; + return m_aesIv; } void SetKeyPath(const QString &x) { @@ -851,7 +850,7 @@ class HLSStream private: QString m_keypath; // URL path of the encrypted key bool m_ivloaded {false}; - uint8_t m_AESIV[AES_BLOCK_SIZE]{0};// IV used when decypher the block + uint8_t m_aesIv[AES_BLOCK_SIZE]{0};// IV used when decypher the block #endif private: @@ -1389,7 +1388,7 @@ class PlaylistWorker : public MThread */ int ReloadPlaylist(void) { - StreamsList *streams = new StreamsList; + auto *streams = new StreamsList; LOG(VB_PLAYBACK, LOG_INFO, LOC + "reloading HLS live meta playlist"); @@ -1429,7 +1428,7 @@ class PlaylistWorker : public MThread return RET_OK; } - int UpdatePlaylist(HLSStream *hls_new, HLSStream *hls) + static int UpdatePlaylist(HLSStream *hls_new, HLSStream *hls) { int count = hls_new->NumSegments(); @@ -1749,7 +1748,7 @@ bool HLSRingBuffer::TestForHTTPLiveStreaming(const QString &filename) } /* Parsing */ -QString HLSRingBuffer::ParseAttributes(const QString &line, const char *attr) const +QString HLSRingBuffer::ParseAttributes(const QString &line, const char *attr) { int p = line.indexOf(QLatin1String(":")); if (p < 0) @@ -1775,7 +1774,7 @@ QString HLSRingBuffer::ParseAttributes(const QString &line, const char *attr) co * Return the decimal argument in a line of type: blah:\ * presence of value \ is compulsory or it will return RET_ERROR */ -int HLSRingBuffer::ParseDecimalValue(const QString &line, int &target) const +int HLSRingBuffer::ParseDecimalValue(const QString &line, int &target) { int p = line.indexOf(QLatin1String(":")); if (p < 0) @@ -1789,7 +1788,7 @@ int HLSRingBuffer::ParseDecimalValue(const QString &line, int &target) const } int HLSRingBuffer::ParseSegmentInformation(const HLSStream *hls, const QString &line, - int &duration, QString &title) const + int &duration, QString &title) { /* * #EXTINF:, @@ -1846,7 +1845,7 @@ int HLSRingBuffer::ParseSegmentInformation(const HLSStream *hls, const QString & return RET_OK; } -int HLSRingBuffer::ParseTargetDuration(HLSStream *hls, const QString &line) const +int HLSRingBuffer::ParseTargetDuration(HLSStream *hls, const QString &line) { /* * #EXT-X-TARGETDURATION:<s> @@ -1908,7 +1907,7 @@ HLSStream *HLSRingBuffer::ParseStreamInformation(const QString &line, const QStr return new HLSStream(id, bw, psz_uri); } -int HLSRingBuffer::ParseMediaSequence(HLSStream *hls, const QString &line) const +int HLSRingBuffer::ParseMediaSequence(HLSStream *hls, const QString &line) { /* * #EXT-X-MEDIA-SEQUENCE:<number> @@ -2021,7 +2020,7 @@ int HLSRingBuffer::ParseKey(HLSStream *hls, const QString &line) return err; } -int HLSRingBuffer::ParseProgramDateTime(HLSStream */*hls*/, const QString &line) const +int HLSRingBuffer::ParseProgramDateTime(HLSStream */*hls*/, const QString &line) { /* * #EXT-X-PROGRAM-DATE-TIME:<YYYY-MM-DDThh:mm:ssZ> @@ -2032,7 +2031,7 @@ int HLSRingBuffer::ParseProgramDateTime(HLSStream */*hls*/, const QString &line) return RET_OK; } -int HLSRingBuffer::ParseAllowCache(HLSStream *hls, const QString &line) const +int HLSRingBuffer::ParseAllowCache(HLSStream *hls, const QString &line) { /* * The EXT-X-ALLOW-CACHE tag indicates whether the client MAY or MUST @@ -2056,7 +2055,7 @@ int HLSRingBuffer::ParseAllowCache(HLSStream *hls, const QString &line) const return RET_OK; } -int HLSRingBuffer::ParseVersion(const QString &line, int &version) const +int HLSRingBuffer::ParseVersion(const QString &line, int &version) { /* * The EXT-X-VERSION tag indicates the compatibility version of the @@ -2087,7 +2086,7 @@ int HLSRingBuffer::ParseVersion(const QString &line, int &version) const return RET_OK; } -int HLSRingBuffer::ParseEndList(HLSStream *hls) const +int HLSRingBuffer::ParseEndList(HLSStream *hls) { /* * The EXT-X-ENDLIST tag indicates that no more media files will be @@ -2099,7 +2098,7 @@ int HLSRingBuffer::ParseEndList(HLSStream *hls) const return RET_OK; } -int HLSRingBuffer::ParseDiscontinuity(HLSStream */*hls*/, const QString &line) const +int HLSRingBuffer::ParseDiscontinuity(HLSStream */*hls*/, const QString &line) { /* Not handled, never seen so far */ LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("#EXT-X-DISCONTINUITY %1").arg(line)); @@ -2767,8 +2766,8 @@ int HLSRingBuffer::DurationForBytes(uint size) { return 0; } - uint64_t byterate = (uint64_t)(((double)segment->Size()) / - ((double)segment->Duration())); + auto byterate = (uint64_t)(((double)segment->Size()) / + ((double)segment->Duration())); return (int)((size * 1000.0) / byterate); } diff --git a/mythtv/libs/libmythtv/HLS/httplivestreambuffer.h b/mythtv/libs/libmythtv/HLS/httplivestreambuffer.h index be55c436289..d1f86fa2e95 100644 --- a/mythtv/libs/libmythtv/HLS/httplivestreambuffer.h +++ b/mythtv/libs/libmythtv/HLS/httplivestreambuffer.h @@ -38,7 +38,7 @@ class StreamWorker; class PlaylistWorker; class HLSPlayback; -typedef QList<HLSStream*> StreamsList; +using StreamsList = QList<HLSStream*>; class HLSRingBuffer : public RingBuffer { @@ -76,19 +76,19 @@ class HLSRingBuffer : public RingBuffer HLSStream *GetLastStream(const StreamsList *streams = nullptr) const; HLSStream *FindStream(const HLSStream *hls_new, const StreamsList *streams = nullptr) const; HLSStream *GetCurrentStream(void) const; - QString ParseAttributes(const QString &line, const char *attr) const; - int ParseDecimalValue(const QString &line, int &target) const; - int ParseSegmentInformation(const HLSStream *hls, const QString &line, - int &duration, QString &title) const; - int ParseTargetDuration(HLSStream *hls, const QString &line) const; + static QString ParseAttributes(const QString &line, const char *attr); + static int ParseDecimalValue(const QString &line, int &target); + static int ParseSegmentInformation(const HLSStream *hls, const QString &line, + int &duration, QString &title); + static int ParseTargetDuration(HLSStream *hls, const QString &line); HLSStream *ParseStreamInformation(const QString &line, const QString &uri) const; - int ParseMediaSequence(HLSStream *hls, const QString &line) const; + static int ParseMediaSequence(HLSStream *hls, const QString &line); int ParseKey(HLSStream *hls, const QString &line); - int ParseProgramDateTime(HLSStream *hls, const QString &line) const; - int ParseAllowCache(HLSStream *hls, const QString &line) const; - int ParseVersion(const QString &line, int &version) const; - int ParseEndList(HLSStream *hls) const; - int ParseDiscontinuity(HLSStream *hls, const QString &line) const; + static int ParseProgramDateTime(HLSStream *hls, const QString &line); + static int ParseAllowCache(HLSStream *hls, const QString &line); + static int ParseVersion(const QString &line, int &version); + static int ParseEndList(HLSStream *hls); + static int ParseDiscontinuity(HLSStream *hls, const QString &line); int ParseM3U8(const QByteArray *buffer, StreamsList *streams = nullptr); int Prefetch(int count); void SanityCheck(const HLSStream *hls) const; diff --git a/mythtv/libs/libmythtv/audioplayer.cpp b/mythtv/libs/libmythtv/audioplayer.cpp index 2afec9b68df..d36c808a41b 100644 --- a/mythtv/libs/libmythtv/audioplayer.cpp +++ b/mythtv/libs/libmythtv/audioplayer.cpp @@ -11,9 +11,9 @@ AudioPlayer::AudioPlayer(MythPlayer *parent, bool muted) : m_parent(parent), - m_muted_on_creation(muted) + m_mutedOnCreation(muted) { - m_controls_volume = gCoreContext->GetBoolSetting("MythControlsVolume", true); + m_controlsVolume = gCoreContext->GetBoolSetting("MythControlsVolume", true); } AudioPlayer::~AudioPlayer() @@ -28,7 +28,7 @@ void AudioPlayer::addVisual(MythTV::Visual *vis) return; QMutexLocker lock(&m_lock); - Visuals::iterator it = std::find(m_visuals.begin(), m_visuals.end(), vis); + auto it = std::find(m_visuals.begin(), m_visuals.end(), vis); if (it == m_visuals.end()) { m_visuals.push_back(vis); @@ -42,7 +42,7 @@ void AudioPlayer::removeVisual(MythTV::Visual *vis) return; QMutexLocker lock(&m_lock); - Visuals::iterator it = std::find(m_visuals.begin(), m_visuals.end(), vis); + auto it = std::find(m_visuals.begin(), m_visuals.end(), vis); if (it != m_visuals.end()) { m_visuals.erase(it); @@ -98,7 +98,7 @@ void AudioPlayer::DeleteOutput(void) delete m_audioOutput; m_audioOutput = nullptr; } - m_no_audio_out = true; + m_noAudioOut = true; } QString AudioPlayer::ReinitAudio(void) @@ -109,23 +109,23 @@ QString AudioPlayer::ReinitAudio(void) if ((m_format == FORMAT_NONE) || (m_channels <= 0) || - (m_samplerate <= 0)) + (m_sampleRate <= 0)) { - m_no_audio_in = m_no_audio_out = true; + m_noAudioIn = m_noAudioOut = true; } else - m_no_audio_in = false; + m_noAudioIn = false; if (want_audio && !m_audioOutput) { // AudioOutput has never been created and we will want audio - AudioSettings aos = AudioSettings(m_main_device, - m_passthru_device, + AudioSettings aos = AudioSettings(m_mainDevice, + m_passthruDevice, m_format, m_channels, - m_codec, m_samplerate, + m_codec, m_sampleRate, AUDIOOUTPUT_VIDEO, - m_controls_volume, m_passthru); - if (m_no_audio_in) + m_controlsVolume, m_passthru); + if (m_noAudioIn) aos.m_init = false; m_audioOutput = AudioOutput::OpenAudio(aos); @@ -139,14 +139,14 @@ QString AudioPlayer::ReinitAudio(void) } AddVisuals(); } - else if (!m_no_audio_in && m_audioOutput) + else if (!m_noAudioIn && m_audioOutput) { const AudioSettings settings(m_format, m_channels, m_codec, - m_samplerate, m_passthru, 0, - m_codec_profile); + m_sampleRate, m_passthru, 0, + m_codecProfile); m_audioOutput->Reconfigure(settings); errMsg = m_audioOutput->GetError(); - SetStretchFactor(m_stretchfactor); + SetStretchFactor(m_stretchFactor); } if (!errMsg.isEmpty()) @@ -155,18 +155,18 @@ QString AudioPlayer::ReinitAudio(void) QString(", reason is: %1").arg(errMsg)); ShowNotificationError(tr("Disabling Audio"), AudioPlayer::tr( "Audio Player" ), errMsg); - m_no_audio_out = true; + m_noAudioOut = true; } - else if (m_no_audio_out && m_audioOutput) + else if (m_noAudioOut && m_audioOutput) { LOG(VB_GENERAL, LOG_NOTICE, LOC + "Enabling Audio"); - m_no_audio_out = false; + m_noAudioOut = false; } - if (m_muted_on_creation) + if (m_mutedOnCreation) { SetMuteState(kMuteAll); - m_muted_on_creation = false; + m_mutedOnCreation = false; } ResetVisuals(); @@ -177,12 +177,12 @@ QString AudioPlayer::ReinitAudio(void) void AudioPlayer::CheckFormat(void) { if (m_format == FORMAT_NONE) - m_no_audio_in = m_no_audio_out = true; + m_noAudioIn = m_noAudioOut = true; } bool AudioPlayer::Pause(bool pause) { - if (!m_audioOutput || m_no_audio_out) + if (!m_audioOutput || m_noAudioOut) return false; QMutexLocker lock(&m_lock); @@ -192,7 +192,7 @@ bool AudioPlayer::Pause(bool pause) bool AudioPlayer::IsPaused(void) { - if (!m_audioOutput || m_no_audio_out) + if (!m_audioOutput || m_noAudioOut) return false; QMutexLocker lock(&m_lock); return m_audioOutput->IsPaused(); @@ -200,7 +200,7 @@ bool AudioPlayer::IsPaused(void) void AudioPlayer::PauseAudioUntilBuffered() { - if (!m_audioOutput || m_no_audio_out) + if (!m_audioOutput || m_noAudioOut) return; QMutexLocker lock(&m_lock); m_audioOutput->PauseUntilBuffered(); @@ -218,7 +218,7 @@ void AudioPlayer::SetAudioOutput(AudioOutput *ao) uint AudioPlayer::GetVolume(void) { - if (!m_audioOutput || m_no_audio_out) + if (!m_audioOutput || m_noAudioOut) return 0; QMutexLocker lock(&m_lock); return m_audioOutput->GetCurrentVolume(); @@ -233,14 +233,14 @@ void AudioPlayer::SetAudioInfo(const QString &main_device, uint samplerate, int codec_profile) { - m_main_device.clear(); - m_passthru_device.clear(); + m_mainDevice.clear(); + m_passthruDevice.clear(); if (!main_device.isEmpty()) - m_main_device = main_device; + m_mainDevice = main_device; if (!passthru_device.isEmpty()) - m_passthru_device = passthru_device; - m_samplerate = (int)samplerate; - m_codec_profile = codec_profile; + m_passthruDevice = passthru_device; + m_sampleRate = (int)samplerate; + m_codecProfile = codec_profile; } /** @@ -253,19 +253,19 @@ void AudioPlayer::SetAudioParams(AudioFormat format, int orig_channels, int codec_profile) { m_format = CanProcess(format) ? format : FORMAT_S16; - m_orig_channels = orig_channels; + m_origChannels = orig_channels; m_channels = channels; m_codec = codec; - m_samplerate = samplerate; + m_sampleRate = samplerate; m_passthru = passthru; - m_codec_profile = codec_profile; + m_codecProfile = codec_profile; ResetVisuals(); } void AudioPlayer::SetEffDsp(int dsprate) { - if (!m_audioOutput || !m_no_audio_out) + if (!m_audioOutput || !m_noAudioOut) return; QMutexLocker lock(&m_lock); m_audioOutput->SetEffDsp(dsprate); @@ -276,13 +276,13 @@ bool AudioPlayer::SetMuted(bool mute) bool is_muted = IsMuted(); QMutexLocker lock(&m_lock); - if (m_audioOutput && !m_no_audio_out && !is_muted && mute && + if (m_audioOutput && !m_noAudioOut && !is_muted && mute && (kMuteAll == SetMuteState(kMuteAll))) { LOG(VB_AUDIO, LOG_INFO, QString("muting sound %1").arg(IsMuted())); return true; } - if (m_audioOutput && !m_no_audio_out && is_muted && !mute && + if (m_audioOutput && !m_noAudioOut && is_muted && !mute && (kMuteOff == SetMuteState(kMuteOff))) { LOG(VB_AUDIO, LOG_INFO, QString("unmuting sound %1").arg(IsMuted())); @@ -297,7 +297,7 @@ bool AudioPlayer::SetMuted(bool mute) MuteState AudioPlayer::SetMuteState(MuteState mstate) { - if (!m_audioOutput || m_no_audio_out) + if (!m_audioOutput || m_noAudioOut) return kMuteAll; QMutexLocker lock(&m_lock); return m_audioOutput->SetMuteState(mstate); @@ -305,14 +305,14 @@ MuteState AudioPlayer::SetMuteState(MuteState mstate) MuteState AudioPlayer::IncrMuteState(void) { - if (!m_audioOutput || m_no_audio_out) + if (!m_audioOutput || m_noAudioOut) return kMuteAll; return SetMuteState(VolumeBase::NextMuteState(GetMuteState())); } MuteState AudioPlayer::GetMuteState(void) { - if (!m_audioOutput || m_no_audio_out) + if (!m_audioOutput || m_noAudioOut) return kMuteAll; QMutexLocker lock(&m_lock); return m_audioOutput->GetMuteState(); @@ -320,7 +320,7 @@ MuteState AudioPlayer::GetMuteState(void) uint AudioPlayer::AdjustVolume(int change) { - if (!m_audioOutput || m_no_audio_out) + if (!m_audioOutput || m_noAudioOut) return GetVolume(); QMutexLocker lock(&m_lock); m_audioOutput->AdjustCurrentVolume(change); @@ -329,7 +329,7 @@ uint AudioPlayer::AdjustVolume(int change) uint AudioPlayer::SetVolume(int newvolume) { - if (!m_audioOutput || m_no_audio_out) + if (!m_audioOutput || m_noAudioOut) return GetVolume(); QMutexLocker lock(&m_lock); m_audioOutput->SetCurrentVolume(newvolume); @@ -338,7 +338,7 @@ uint AudioPlayer::SetVolume(int newvolume) int64_t AudioPlayer::GetAudioTime(void) { - if (!m_audioOutput || m_no_audio_out) + if (!m_audioOutput || m_noAudioOut) return 0LL; QMutexLocker lock(&m_lock); return m_audioOutput->GetAudiotime(); @@ -372,11 +372,11 @@ bool AudioPlayer::CanUpmix(void) void AudioPlayer::SetStretchFactor(float factor) { - m_stretchfactor = factor; + m_stretchFactor = factor; if (!m_audioOutput) return; QMutexLocker lock(&m_lock); - m_audioOutput->SetStretchFactor(m_stretchfactor); + m_audioOutput->SetStretchFactor(m_stretchFactor); } // The following methods are not locked as this hinders performance. @@ -453,10 +453,10 @@ bool AudioPlayer::CanDownmix(void) void AudioPlayer::AddAudioData(char *buffer, int len, int64_t timecode, int frames) { - if (!m_audioOutput || m_no_audio_out) + if (!m_audioOutput || m_noAudioOut) return; - if (m_parent->PrepareAudioSample(timecode) && !m_no_audio_out) + if (m_parent->PrepareAudioSample(timecode) && !m_noAudioOut) m_audioOutput->Drain(); int samplesize = m_audioOutput->GetBytesPerFrame(); @@ -488,7 +488,7 @@ int64_t AudioPlayer::LengthLastData(void) bool AudioPlayer::GetBufferStatus(uint &fill, uint &total) { fill = total = 0; - if (!m_audioOutput || m_no_audio_out) + if (!m_audioOutput || m_noAudioOut) return false; m_audioOutput->GetBufferStatus(fill, total); return true; diff --git a/mythtv/libs/libmythtv/audioplayer.h b/mythtv/libs/libmythtv/audioplayer.h index 4c625b39ef5..4550b33d88d 100644 --- a/mythtv/libs/libmythtv/audioplayer.h +++ b/mythtv/libs/libmythtv/audioplayer.h @@ -48,22 +48,22 @@ class MTV_PUBLIC AudioPlayer void SetEffDsp(int dsprate); void CheckFormat(void); - void SetNoAudio(void) { m_no_audio_out = true; } - bool HasAudioIn(void) const { return !m_no_audio_in; } - bool HasAudioOut(void) const { return !m_no_audio_out; } - bool ControlsVolume(void) const { return m_controls_volume; } + void SetNoAudio(void) { m_noAudioOut = true; } + bool HasAudioIn(void) const { return !m_noAudioIn; } + bool HasAudioOut(void) const { return !m_noAudioOut; } + bool ControlsVolume(void) const { return m_controlsVolume; } bool Pause(bool pause); bool IsPaused(void); void PauseAudioUntilBuffered(void); AVCodecID GetCodec(void) const { return m_codec; } int GetNumChannels(void) const { return m_channels; } - int GetOrigChannels(void) const { return m_orig_channels; } - int GetSampleRate(void) const { return m_samplerate; } + int GetOrigChannels(void) const { return m_origChannels; } + int GetSampleRate(void) const { return m_sampleRate; } uint GetVolume(void); uint AdjustVolume(int change); uint SetVolume(int newvolume); - float GetStretchFactor(void) const { return m_stretchfactor; } + float GetStretchFactor(void) const { return m_stretchFactor; } void SetStretchFactor(float factor); bool IsUpmixing(void); bool EnableUpmix(bool enable, bool toggle = false); @@ -112,20 +112,20 @@ class MTV_PUBLIC AudioPlayer MythPlayer *m_parent {nullptr}; AudioOutput *m_audioOutput {nullptr}; int m_channels {-1}; - int m_orig_channels {-1}; + int m_origChannels {-1}; AVCodecID m_codec {AV_CODEC_ID_NONE}; AudioFormat m_format {FORMAT_NONE}; - int m_samplerate {44100}; - int m_codec_profile {0}; - float m_stretchfactor {1.0F}; + int m_sampleRate {44100}; + int m_codecProfile {0}; + float m_stretchFactor {1.0F}; bool m_passthru {false}; QMutex m_lock {QMutex::Recursive}; - bool m_muted_on_creation; - QString m_main_device; - QString m_passthru_device; - bool m_no_audio_in {false}; - bool m_no_audio_out {true}; - bool m_controls_volume {true}; + bool m_mutedOnCreation {false}; + QString m_mainDevice; + QString m_passthruDevice; + bool m_noAudioIn {false}; + bool m_noAudioOut {true}; + bool m_controlsVolume {true}; vector<MythTV::Visual*> m_visuals; }; diff --git a/mythtv/libs/libmythtv/avformatwriter.cpp b/mythtv/libs/libmythtv/avformatwriter.cpp index 067d40410b7..66a038526e5 100644 --- a/mythtv/libs/libmythtv/avformatwriter.cpp +++ b/mythtv/libs/libmythtv/avformatwriter.cpp @@ -121,7 +121,7 @@ bool AVFormatWriter::Init(void) m_ctx->packet_size = 2324; QByteArray filename = m_filename.toLatin1(); - size_t size = static_cast<size_t>(filename.size()); + auto size = static_cast<size_t>(filename.size()); m_ctx->url = static_cast<char*>(av_malloc(size)); memcpy(m_ctx->url, filename.constData(), size); @@ -169,7 +169,7 @@ bool AVFormatWriter::OpenFile(void) } m_avfRingBuffer = new AVFRingBuffer(m_ringBuffer); - URLContext *uc = (URLContext *)m_ctx->pb->opaque; + auto *uc = (URLContext *)m_ctx->pb->opaque; uc->prot = AVFRingBuffer::GetRingBufferURLProtocol(); uc->priv_data = (void *)m_avfRingBuffer; diff --git a/mythtv/libs/libmythtv/avformatwriter.h b/mythtv/libs/libmythtv/avformatwriter.h index d32fd2f8209..a256fc43a87 100644 --- a/mythtv/libs/libmythtv/avformatwriter.h +++ b/mythtv/libs/libmythtv/avformatwriter.h @@ -40,7 +40,7 @@ class MTV_PUBLIC AVFormatWriter : public FileWriterBase void Cleanup(void); AVRational GetCodecTimeBase(void); - bool FindAudioFormat(AVCodecContext *ctx, AVCodec *c, AVSampleFormat format); + static bool FindAudioFormat(AVCodecContext *ctx, AVCodec *c, AVSampleFormat format); AVFRingBuffer *m_avfRingBuffer {nullptr}; RingBuffer *m_ringBuffer {nullptr}; diff --git a/mythtv/libs/libmythtv/avfringbuffer.cpp b/mythtv/libs/libmythtv/avfringbuffer.cpp index 870be8028d5..22327c337e2 100644 --- a/mythtv/libs/libmythtv/avfringbuffer.cpp +++ b/mythtv/libs/libmythtv/avfringbuffer.cpp @@ -1,7 +1,7 @@ #include "avfringbuffer.h" #include "mythcorecontext.h" -bool AVFRingBuffer::s_avrprotocol_initialised = false; +bool AVFRingBuffer::s_avfrProtocolInitialised = false; URLProtocol AVFRingBuffer::s_avfrURL; int AVFRingBuffer::AVF_Open(URLContext *h, const char *filename, int flags) @@ -15,8 +15,7 @@ int AVFRingBuffer::AVF_Open(URLContext *h, const char *filename, int flags) int AVFRingBuffer::AVF_Read(URLContext *h, uint8_t *buf, int buf_size) { - AVFRingBuffer *avfr = (AVFRingBuffer *)h->priv_data; - + auto *avfr = (AVFRingBuffer *)h->priv_data; if (!avfr) return 0; @@ -29,8 +28,7 @@ int AVFRingBuffer::AVF_Read(URLContext *h, uint8_t *buf, int buf_size) int AVFRingBuffer::AVF_Write(URLContext *h, const uint8_t *buf, int buf_size) { - AVFRingBuffer *avfr = (AVFRingBuffer *)h->priv_data; - + auto *avfr = (AVFRingBuffer *)h->priv_data; if (!avfr) return 0; @@ -39,8 +37,7 @@ int AVFRingBuffer::AVF_Write(URLContext *h, const uint8_t *buf, int buf_size) int64_t AVFRingBuffer::AVF_Seek(URLContext *h, int64_t offset, int whence) { - AVFRingBuffer *avfr = (AVFRingBuffer *)h->priv_data; - + auto *avfr = (AVFRingBuffer *)h->priv_data; if (!avfr) return 0; @@ -86,7 +83,7 @@ int64_t AVFRingBuffer::AVF_Seek_Packet(void *opaque, int64_t offset, int whence) URLProtocol *AVFRingBuffer::GetRingBufferURLProtocol(void) { QMutexLocker lock(avcodeclock); - if (!s_avrprotocol_initialised) + if (!s_avfrProtocolInitialised) { // just in case URLProtocol's members do not have default constructor memset((void *)&s_avfrURL, 0, sizeof(s_avfrURL)); @@ -98,7 +95,7 @@ URLProtocol *AVFRingBuffer::GetRingBufferURLProtocol(void) s_avfrURL.url_close = AVF_Close; s_avfrURL.priv_data_size = 0; s_avfrURL.flags = URL_PROTOCOL_FLAG_NETWORK; - s_avrprotocol_initialised = true; + s_avfrProtocolInitialised = true; } return &s_avfrURL; } diff --git a/mythtv/libs/libmythtv/avfringbuffer.h b/mythtv/libs/libmythtv/avfringbuffer.h index b375991eb0c..2f375e81b1d 100644 --- a/mythtv/libs/libmythtv/avfringbuffer.h +++ b/mythtv/libs/libmythtv/avfringbuffer.h @@ -38,7 +38,7 @@ class AVFRingBuffer private: RingBuffer *m_rbuffer {nullptr}; bool m_initState {true}; - static bool s_avrprotocol_initialised; + static bool s_avfrProtocolInitialised; static URLProtocol s_avfrURL; }; diff --git a/mythtv/libs/libmythtv/cardutil.cpp b/mythtv/libs/libmythtv/cardutil.cpp index 20da482a997..7b40daaabb7 100644 --- a/mythtv/libs/libmythtv/cardutil.cpp +++ b/mythtv/libs/libmythtv/cardutil.cpp @@ -183,7 +183,7 @@ bool CardUtil::IsCableCardPresent(uint inputid, url.setPath("/get_var.json"); url.setQuery(params); - QNetworkRequest *request = new QNetworkRequest(); + auto *request = new QNetworkRequest(); request->setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork); request->setUrl(url); @@ -1657,7 +1657,7 @@ bool CardUtil::GetInputInfo(InputInfo &input, vector<uint> *groupids) input.m_name = query.value(0).toString(); input.m_sourceid = query.value(1).toUInt(); - input.m_livetvorder = query.value(2).toUInt(); + input.m_liveTvOrder = query.value(2).toUInt(); input.m_scheduleOrder = query.value(3).toUInt(); input.m_displayName = query.value(4).toString(); input.m_recPriority = query.value(5).toInt(); @@ -1691,7 +1691,7 @@ QList<InputInfo> CardUtil::GetAllInputInfo() input.m_inputid = query.value(0).toUInt(); input.m_name = query.value(1).toString(); input.m_sourceid = query.value(2).toUInt(); - input.m_livetvorder = query.value(3).toUInt(); + input.m_liveTvOrder = query.value(3).toUInt(); input.m_scheduleOrder = query.value(4).toUInt(); input.m_displayName = query.value(5).toString(); input.m_recPriority = query.value(6).toInt(); @@ -2119,8 +2119,7 @@ bool CardUtil::GetTimeouts(uint inputid, bool CardUtil::IsInNeedOfExternalInputConf(uint inputid) { - DiSEqCDev dev; - DiSEqCDevTree *diseqc_tree = dev.FindTree(inputid); + DiSEqCDevTree *diseqc_tree = DiSEqCDev::FindTree(inputid); bool needsConf = false; if (diseqc_tree) diff --git a/mythtv/libs/libmythtv/cardutil.h b/mythtv/libs/libmythtv/cardutil.h index 891411224da..beb408f66a5 100644 --- a/mythtv/libs/libmythtv/cardutil.h +++ b/mythtv/libs/libmythtv/cardutil.h @@ -18,13 +18,13 @@ using namespace std; class InputInfo; class CardInput; -typedef QMap<int,QString> InputNames; +using InputNames = QMap<int,QString>; MTV_PUBLIC QString get_on_input(const QString&, uint); MTV_PUBLIC bool set_on_input(const QString&, uint, const QString&); -typedef enum +enum dvb_dev_type_t { DVB_DEV_FRONTEND = 1, DVB_DEV_DVR, @@ -32,7 +32,7 @@ typedef enum DVB_DEV_CA, DVB_DEV_AUDIO, DVB_DEV_VIDEO, -} dvb_dev_type_t; +}; /** \class CardUtil * \brief Collection of helper utilities for input DB use @@ -40,7 +40,7 @@ typedef enum class MTV_PUBLIC CardUtil { public: - typedef QMap<QString, QString> InputTypes; + using InputTypes = QMap<QString, QString>; /// \brief all the different inputs enum INPUT_TYPES diff --git a/mythtv/libs/libmythtv/cc608decoder.cpp b/mythtv/libs/libmythtv/cc608decoder.cpp index 0c0d8879ad3..607ff293e75 100644 --- a/mythtv/libs/libmythtv/cc608decoder.cpp +++ b/mythtv/libs/libmythtv/cc608decoder.cpp @@ -908,13 +908,13 @@ void CC608Decoder::DecodeVPS(const unsigned char *buf) void CC608Decoder::DecodeWSS(const unsigned char *buf) { - static const int wss_bits[8] = { 0, 0, 0, 1, 0, 1, 1, 1 }; + static const int kWssBits[8] = { 0, 0, 0, 1, 0, 1, 1, 1 }; uint wss = 0; for (uint i = 0; i < 16; i++) { - uint b1 = wss_bits[buf[i] & 7]; - uint b2 = wss_bits[(buf[i] >> 3) & 7]; + uint b1 = kWssBits[buf[i] & 7]; + uint b2 = kWssBits[(buf[i] >> 3) & 7]; if (b1 == b2) return; diff --git a/mythtv/libs/libmythtv/cc608reader.cpp b/mythtv/libs/libmythtv/cc608reader.cpp index 74d99eed247..42c085551b8 100644 --- a/mythtv/libs/libmythtv/cc608reader.cpp +++ b/mythtv/libs/libmythtv/cc608reader.cpp @@ -188,7 +188,7 @@ int CC608Reader::Update(unsigned char *inpos) int row = 0; int linecont = (subtitle.resumetext & CC_LINE_CONT); - vector<CC608Text*> *ccbuf = new vector<CC608Text*>; + auto *ccbuf = new vector<CC608Text*>; vector<CC608Text*>::iterator ccp; CC608Text *tmpcc = nullptr; int replace = linecont; @@ -278,7 +278,7 @@ int CC608Reader::Update(unsigned char *inpos) if (row) scroll = m_state[streamIdx].m_outputRow - 15; if (tmpcc) - tmpcc->y = 15; + tmpcc->m_y = 15; } } else if (subtitle.rowcount == 0 || row > 1) @@ -291,7 +291,7 @@ int CC608Reader::Update(unsigned char *inpos) for (; ccp != ccbuf->end(); ++ccp) { tmpcc = *ccp; - tmpcc->y -= (m_state[streamIdx].m_outputRow - 15); + tmpcc->m_y -= (m_state[streamIdx].m_outputRow - 15); } } } @@ -308,7 +308,7 @@ int CC608Reader::Update(unsigned char *inpos) { m_state[streamIdx].m_outputRow = subtitle.rowcount; if (tmpcc) - tmpcc->y = m_state[streamIdx].m_outputRow; + tmpcc->m_y = m_state[streamIdx].m_outputRow; } if (row) { @@ -365,17 +365,17 @@ void CC608Reader::Update608Text( vector<CC608Text*>::iterator i; int visible = 0; - m_state[streamIdx].m_output.lock.lock(); - if (!m_state[streamIdx].m_output.buffers.empty() && (scroll || replace)) + m_state[streamIdx].m_output.m_lock.lock(); + if (!m_state[streamIdx].m_output.m_buffers.empty() && (scroll || replace)) { CC608Text *cc; // get last row int ylast = 0; - i = m_state[streamIdx].m_output.buffers.end() - 1; + i = m_state[streamIdx].m_output.m_buffers.end() - 1; cc = *i; if (cc) - ylast = cc->y; + ylast = cc->m_y; // calculate row positions to delete, keep int ydel = scroll_yoff + scroll; @@ -388,34 +388,34 @@ void CC608Reader::Update608Text( ykeep += ymove; } - i = m_state[streamIdx].m_output.buffers.begin(); - while (i < m_state[streamIdx].m_output.buffers.end()) + i = m_state[streamIdx].m_output.m_buffers.begin(); + while (i < m_state[streamIdx].m_output.m_buffers.end()) { cc = (*i); if (!cc) { - i = m_state[streamIdx].m_output.buffers.erase(i); + i = m_state[streamIdx].m_output.m_buffers.erase(i); continue; } - if (cc->y > (ylast - replace)) + if (cc->m_y > (ylast - replace)) { // delete last lines delete cc; - i = m_state[streamIdx].m_output.buffers.erase(i); + i = m_state[streamIdx].m_output.m_buffers.erase(i); } else if (scroll) { - if (cc->y > ydel && cc->y <= ykeep) + if (cc->m_y > ydel && cc->m_y <= ykeep) { // scroll up - cc->y -= (scroll + ymove); + cc->m_y -= (scroll + ymove); ++i; } else { // delete lines outside scroll window - i = m_state[streamIdx].m_output.buffers.erase(i); + i = m_state[streamIdx].m_output.m_buffers.erase(i); delete cc; } } @@ -426,7 +426,7 @@ void CC608Reader::Update608Text( } } - visible += m_state[streamIdx].m_output.buffers.size(); + visible += m_state[streamIdx].m_output.m_buffers.size(); if (ccbuf) { @@ -436,12 +436,12 @@ void CC608Reader::Update608Text( if (*i) { visible++; - m_state[streamIdx].m_output.buffers.push_back(*i); + m_state[streamIdx].m_output.m_buffers.push_back(*i); } } } m_state[streamIdx].m_changed = visible; - m_state[streamIdx].m_output.lock.unlock(); + m_state[streamIdx].m_output.m_lock.unlock(); } void CC608Reader::ClearBuffers(bool input, bool output, int outputStreamIdx) diff --git a/mythtv/libs/libmythtv/cc608reader.h b/mythtv/libs/libmythtv/cc608reader.h index 8c6014428a1..0ed52822005 100644 --- a/mythtv/libs/libmythtv/cc608reader.h +++ b/mythtv/libs/libmythtv/cc608reader.h @@ -16,12 +16,12 @@ class CC608Text { public: CC608Text(const QString &T, int X, int Y) : - text(T), x(X), y(Y) {} + m_text(T), m_x(X), m_y(Y) {} CC608Text(const CC608Text &other) : - text(other.text), x(other.x), y(other.y) {} - QString text; - int x; - int y; + m_text(other.m_text), m_x(other.m_x), m_y(other.m_y) {} + QString m_text; + int m_x; + int m_y; }; struct TextContainer @@ -38,20 +38,19 @@ class CC608Buffer ~CC608Buffer(void) { Clear(); } void Clear(void) { - lock.lock(); - vector<CC608Text*>::iterator i = buffers.begin(); - for (; i != buffers.end(); ++i) + m_lock.lock(); + vector<CC608Text*>::iterator i = m_buffers.begin(); + for (; i != m_buffers.end(); ++i) { CC608Text *cc = (*i); - if (cc) - delete cc; + delete cc; } - buffers.clear(); - lock.unlock(); + m_buffers.clear(); + m_lock.unlock(); } - QMutex lock; - vector<CC608Text*> buffers; + QMutex m_lock; + vector<CC608Text*> m_buffers; }; class CC608StateTracker diff --git a/mythtv/libs/libmythtv/cc708decoder.cpp b/mythtv/libs/libmythtv/cc708decoder.cpp index 2ac075fea28..2870a53f74f 100644 --- a/mythtv/libs/libmythtv/cc708decoder.cpp +++ b/mythtv/libs/libmythtv/cc708decoder.cpp @@ -18,13 +18,13 @@ #define DEBUG_CC_DECODE 0 #define DEBUG_CC_PARSE 0 -typedef enum +enum kCCTypes { NTSC_CC_f1 = 0, NTSC_CC_f2 = 1, DTVCC_PACKET_DATA = 2, DTVCC_PACKET_START = 3, -} kCCTypes; +}; const char* cc_types[4] = { @@ -47,7 +47,7 @@ void CC708Decoder::decode_cc_data(uint cc_type, uint data1, uint data2) #endif if (m_partialPacket.size && m_reader) - parse_cc_packet(m_reader, &m_partialPacket, m_last_seen); + parse_cc_packet(m_reader, &m_partialPacket, m_lastSeen); m_partialPacket.data[0] = data1; m_partialPacket.data[1] = data2; @@ -69,7 +69,7 @@ void CC708Decoder::decode_cc_data(uint cc_type, uint data1, uint data2) void CC708Decoder::decode_cc_null(void) { if (m_partialPacket.size && m_reader) - parse_cc_packet(m_reader, &m_partialPacket, m_last_seen); + parse_cc_packet(m_reader, &m_partialPacket, m_lastSeen); m_partialPacket.size = 0; } @@ -80,10 +80,10 @@ void CC708Decoder::services(uint seconds, bool seen[64]) const seen[0] = false; // service zero is not allowed in CEA-708-D for (uint i = 1; i < 64; i++) - seen[i] = (m_last_seen[i] >= then); + seen[i] = (m_lastSeen[i] >= then); } -typedef enum +enum C0 { NUL = 0x00, ETX = 0x03, @@ -93,15 +93,15 @@ typedef enum HCR = 0x0E, EXT1 = 0x10, P16 = 0x18, -} C0; +}; -typedef enum +enum C1 { CW0=0x80, CW1, CW2, CW3, CW4, CW5, CW6, CW7, CLW, DSW, HDW, TGW, DLW, DLY, DLC, RST, SPA=0x90, SPC, SPL, SWA=0x97, DF0, DF1, DF2, DF3, DF4, DF5, DF6, DF7, -} C1; +}; extern ushort CCtableG0[0x60]; extern ushort CCtableG1[0x60]; @@ -117,18 +117,18 @@ static int handle_cc_c3(CC708Reader *cc, uint service_num, int i); #define SEND_STR \ do { \ - if (cc->m_temp_str_size[service_num]) \ + if (cc->m_tempStrSize[service_num]) \ { \ cc->TextWrite(service_num, \ - cc->m_temp_str[service_num], \ - cc->m_temp_str_size[service_num]); \ - cc->m_temp_str_size[service_num] = 0; \ + cc->m_tempStr[service_num], \ + cc->m_tempStrSize[service_num]); \ + cc->m_tempStrSize[service_num] = 0; \ } \ } while (false) static void parse_cc_service_stream(CC708Reader* cc, uint service_num) { - const int blk_size = cc->m_buf_size[service_num]; + const int blk_size = cc->m_bufSize[service_num]; int blk_start = 0, dlc_loc = 0, rst_loc = 0, i = 0; // find last reset or delay cancel in buffer @@ -259,7 +259,7 @@ static void parse_cc_service_stream(CC708Reader* cc, uint service_num) LOG(VB_VBI, LOG_INFO, "eia-708 decoding error..."); cc->Reset(service_num); cc->m_delayed[service_num] = false; - i = cc->m_buf_size[service_num]; + i = cc->m_bufSize[service_num]; } // There must be an incomplete code in buffer... break; @@ -282,7 +282,7 @@ static void parse_cc_service_stream(CC708Reader* cc, uint service_num) { memmove(cc->m_buf[service_num], cc->m_buf[service_num] + i, blk_size - i); - cc->m_buf_size[service_num] -= i; + cc->m_bufSize[service_num] -= i; } else { @@ -295,7 +295,7 @@ static void parse_cc_service_stream(CC708Reader* cc, uint service_num) msg += QString("0x%1 ").arg(cc->m_buf[service_num][i], 0, 16); LOG(VB_VBI, LOG_ERR, msg); } - cc->m_buf_size[service_num] = 0; + cc->m_bufSize[service_num] = 0; } } @@ -319,7 +319,7 @@ static int handle_cc_c0_ext1_p16(CC708Reader* cc, uint service_num, int i) else if (code<=0x17) { // double byte code - const int blk_size = cc->m_buf_size[service_num]; + const int blk_size = cc->m_bufSize[service_num]; if (EXT1==code && ((i+1)<blk_size)) { const int code2 = cc->m_buf[service_num][i+1]; @@ -352,7 +352,7 @@ static int handle_cc_c0_ext1_p16(CC708Reader* cc, uint service_num, int i) else if (code<=0x1f) { // triple byte code - const int blk_size = cc->m_buf_size[service_num]; + const int blk_size = cc->m_bufSize[service_num]; if (P16==code && ((i+2)<blk_size)) { // reserved for large alphabets, but not yet defined @@ -365,7 +365,7 @@ static int handle_cc_c0_ext1_p16(CC708Reader* cc, uint service_num, int i) static int handle_cc_c1(CC708Reader* cc, uint service_num, int i) { - const int blk_size = cc->m_buf_size[service_num]; + const int blk_size = cc->m_bufSize[service_num]; const int code = cc->m_buf[service_num][i]; const unsigned char* blk_buf = cc->m_buf[service_num]; @@ -501,7 +501,7 @@ static int handle_cc_c1(CC708Reader* cc, uint service_num, int i) static int handle_cc_c2(CC708Reader* cc, uint service_num, int i) { - const int blk_size = cc->m_buf_size[service_num]; + const int blk_size = cc->m_bufSize[service_num]; const int code = cc->m_buf[service_num][i+1]; if ((code<=0x7) && ((i+1)<blk_size)){ @@ -529,7 +529,7 @@ static int handle_cc_c2(CC708Reader* cc, uint service_num, int i) static int handle_cc_c3(CC708Reader* cc, uint service_num, int i) { const unsigned char* blk_buf = cc->m_buf[service_num]; - const int blk_size = cc->m_buf_size[service_num]; + const int blk_size = cc->m_bufSize[service_num]; const int code = cc->m_buf[service_num][i+1]; if ((code<=0x87) && ((i+5)<blk_size)) @@ -556,18 +556,18 @@ static int handle_cc_c3(CC708Reader* cc, uint service_num, int i) static bool rightsize_buf(CC708Reader* cc, uint service_num, uint block_size) { - size_t min_new_size = block_size + cc->m_buf_size[service_num]; + size_t min_new_size = block_size + cc->m_bufSize[service_num]; bool ret = true; - if (min_new_size >= cc->m_buf_alloc[service_num]) + if (min_new_size >= cc->m_bufAlloc[service_num]) { - size_t new_alloc = cc->m_buf_alloc[service_num]; + size_t new_alloc = cc->m_bufAlloc[service_num]; for (uint i = 0; (i < 32) && (new_alloc <= min_new_size); i++) new_alloc *= 2; void *new_buf = realloc(cc->m_buf[service_num], new_alloc); if (new_buf) { cc->m_buf[service_num] = (uchar *)new_buf; - cc->m_buf_alloc[service_num] = new_alloc; + cc->m_bufAlloc[service_num] = new_alloc; } else { @@ -576,15 +576,15 @@ static bool rightsize_buf(CC708Reader* cc, uint service_num, uint block_size) #if DEBUG_CC_SERVICE_2 LOG(VB_VBI, LOG_DEBUG, QString("rightsize_buf: srv %1 to %1 bytes") - .arg(service_num) .arg(cc->m_buf_alloc[service_num])); + .arg(service_num) .arg(cc->m_bufAlloc[service_num])); #endif } - if (min_new_size >= cc->m_buf_alloc[service_num]) + if (min_new_size >= cc->m_bufAlloc[service_num]) LOG(VB_VBI, LOG_ERR, QString("buffer resize error: min_new_size=%1, buf_alloc[%2]=%3") .arg(min_new_size) .arg(service_num) - .arg(cc->m_buf_alloc[service_num])); + .arg(cc->m_bufAlloc[service_num])); return ret; } @@ -597,15 +597,15 @@ static void append_cc(CC708Reader* cc, uint service_num, return; } - memcpy(cc->m_buf[service_num] + cc->m_buf_size[service_num], + memcpy(cc->m_buf[service_num] + cc->m_bufSize[service_num], blk_buf, block_size); - cc->m_buf_size[service_num] += block_size; + cc->m_bufSize[service_num] += block_size; #if DEBUG_CC_SERVICE_2 { uint i; QString msg("append_cc: "); - for (i = 0; i < cc->m_buf_size[service_num]; i++) + for (i = 0; i < cc->m_bufSize[service_num]; i++) msg += QString("0x%1").arg(cc->m_buf[service_num][i], 0, 16); LOG(VB_VBI, LOG_DEBUG, msg); } @@ -699,27 +699,27 @@ static void parse_cc_packet(CC708Reader* cb_cbs, CaptionPacket* pkt, static void append_character(CC708Reader *cc, uint service_num, short ch) { - if (cc->m_temp_str_size[service_num]+2 > cc->m_temp_str_alloc[service_num]) + if (cc->m_tempStrSize[service_num]+2 > cc->m_tempStrAlloc[service_num]) { - int new_alloc = (cc->m_temp_str_alloc[service_num]) ? - cc->m_temp_str_alloc[service_num] * 2 : 64; + int new_alloc = (cc->m_tempStrAlloc[service_num]) ? + cc->m_tempStrAlloc[service_num] * 2 : 64; - cc->m_temp_str[service_num] = (short*) - realloc(cc->m_temp_str[service_num], new_alloc * sizeof(short)); + cc->m_tempStr[service_num] = (short*) + realloc(cc->m_tempStr[service_num], new_alloc * sizeof(short)); - cc->m_temp_str_alloc[service_num] = new_alloc; // shorts allocated + cc->m_tempStrAlloc[service_num] = new_alloc; // shorts allocated } - if (cc->m_temp_str[service_num]) + if (cc->m_tempStr[service_num]) { - int i = cc->m_temp_str_size[service_num]; - cc->m_temp_str[service_num][i] = ch; - cc->m_temp_str_size[service_num]++; + int i = cc->m_tempStrSize[service_num]; + cc->m_tempStr[service_num][i] = ch; + cc->m_tempStrSize[service_num]++; } else { - cc->m_temp_str_size[service_num] = 0; - cc->m_temp_str_alloc[service_num]=0; + cc->m_tempStrSize[service_num] = 0; + cc->m_tempStrAlloc[service_num]=0; } } diff --git a/mythtv/libs/libmythtv/cc708decoder.h b/mythtv/libs/libmythtv/cc708decoder.h index 0c6252d5ce3..946110cd45f 100644 --- a/mythtv/libs/libmythtv/cc708decoder.h +++ b/mythtv/libs/libmythtv/cc708decoder.h @@ -12,11 +12,11 @@ #ifndef __CC_CALLBACKS_H__ /** EIA-708-A closed caption packet */ -typedef struct CaptionPacket +struct CaptionPacket { unsigned char data[128+16]; int size; -} CaptionPacket; +}; #endif class CC708Reader; @@ -27,7 +27,7 @@ class CC708Decoder explicit CC708Decoder(CC708Reader *ccr) : m_reader(ccr) { memset(&m_partialPacket, 0, sizeof(CaptionPacket)); - memset(m_last_seen, 0, sizeof(m_last_seen)); + memset(m_lastSeen, 0, sizeof(m_lastSeen)); } ~CC708Decoder() = default; @@ -40,7 +40,7 @@ class CC708Decoder private: CaptionPacket m_partialPacket; CC708Reader *m_reader {nullptr}; - time_t m_last_seen[64]; + time_t m_lastSeen[64]; }; #endif // CC708DECODER_H_ diff --git a/mythtv/libs/libmythtv/cc708reader.cpp b/mythtv/libs/libmythtv/cc708reader.cpp index cab91e8d7ff..9d8ffba6d1c 100644 --- a/mythtv/libs/libmythtv/cc708reader.cpp +++ b/mythtv/libs/libmythtv/cc708reader.cpp @@ -16,14 +16,14 @@ CC708Reader::CC708Reader(MythPlayer *owner) { for (uint i=0; i < k708MaxServices; i++) { - m_buf_alloc[i] = 512; - m_buf[i] = (unsigned char*) malloc(m_buf_alloc[i]); - m_buf_size[i] = 0; + m_bufAlloc[i] = 512; + m_buf[i] = (unsigned char*) malloc(m_bufAlloc[i]); + m_bufSize[i] = 0; m_delayed[i] = false; - m_temp_str_alloc[i] = 512; - m_temp_str_size[i] = 0; - m_temp_str[i] = (short*) malloc(m_temp_str_alloc[i] * sizeof(short)); + m_tempStrAlloc[i] = 512; + m_tempStrSize[i] = 0; + m_tempStr[i] = (short*) malloc(m_tempStrAlloc[i] * sizeof(short)); } memset(&CC708DelayedDeletes, 0, sizeof(CC708DelayedDeletes)); } @@ -33,7 +33,7 @@ CC708Reader::~CC708Reader() for (uint i=0; i < k708MaxServices; i++) { free(m_buf[i]); - free(m_temp_str[i]); + free(m_tempStr[i]); } } @@ -48,7 +48,7 @@ void CC708Reader::SetCurrentWindow(uint service_num, int window_id) CHECKENABLED; LOG(VB_VBI, LOG_DEBUG, LOC + QString("SetCurrentWindow(%1, %2)") .arg(service_num).arg(window_id)); - CC708services[service_num].m_current_window = window_id; + CC708services[service_num].m_currentWindow = window_id; } void CC708Reader::DefineWindow( @@ -91,7 +91,7 @@ void CC708Reader::DefineWindow( row_lock, column_lock, pen_style, window_style); - CC708services[service_num].m_current_window = window_id; + CC708services[service_num].m_currentWindow = window_id; } void CC708Reader::DeleteWindows(uint service_num, int window_map) @@ -219,7 +219,7 @@ void CC708Reader::SetPenAttributes( { CHECKENABLED; LOG(VB_VBI, LOG_DEBUG, LOC + QString("SetPenAttributes(%1, %2,") - .arg(service_num).arg(CC708services[service_num].m_current_window) + + .arg(service_num).arg(CC708services[service_num].m_currentWindow) + QString("\n\t\t\t\t\t pen_size %1, offset %2, text_tag %3, " "font_tag %4," "\n\t\t\t\t\t edge_type %5, underline %6, italics %7") @@ -242,13 +242,13 @@ void CC708Reader::SetPenColor( .arg(service_num).arg(fg_color).arg(fg_opacity) .arg(bg_color).arg(bg_opacity).arg(edge_color)); - CC708CharacterAttribute &attr = GetCCWin(service_num).m_pen.attr; + CC708CharacterAttribute &attr = GetCCWin(service_num).m_pen.m_attr; - attr.m_fg_color = fg_color; - attr.m_fg_opacity = fg_opacity; - attr.m_bg_color = bg_color; - attr.m_bg_opacity = bg_opacity; - attr.m_edge_color = edge_color; + attr.m_fgColor = fg_color; + attr.m_fgOpacity = fg_opacity; + attr.m_bgColor = bg_color; + attr.m_bgOpacity = bg_opacity; + attr.m_edgeColor = edge_color; } void CC708Reader::SetPenLocation(uint service_num, int row, int column) @@ -291,5 +291,5 @@ void CC708Reader::TextWrite(uint service_num, debug += QChar(unicode_string[i]); } LOG(VB_VBI, LOG_DEBUG, LOC + QString("AddText to %1->%2 |%3|") - .arg(service_num).arg(CC708services[service_num].m_current_window).arg(debug)); + .arg(service_num).arg(CC708services[service_num].m_currentWindow).arg(debug)); } diff --git a/mythtv/libs/libmythtv/cc708reader.h b/mythtv/libs/libmythtv/cc708reader.h index 0e1c0c4fba9..69fe338a9f4 100644 --- a/mythtv/libs/libmythtv/cc708reader.h +++ b/mythtv/libs/libmythtv/cc708reader.h @@ -19,8 +19,8 @@ class CC708Reader explicit CC708Reader(MythPlayer *owner); virtual ~CC708Reader(); - void SetCurrentService(int service) { m_currentservice = service; } - CC708Service* GetCurrentService(void) { return &CC708services[m_currentservice]; } + void SetCurrentService(int service) { m_currentService = service; } + CC708Service* GetCurrentService(void) { return &CC708services[m_currentService]; } void SetEnabled(bool enable) { m_enabled = enable; } void ClearBuffers(void); @@ -29,7 +29,7 @@ class CC708Reader CC708Window &GetCCWin(uint service_num, uint window_id) { return CC708services[service_num].m_windows[window_id]; } CC708Window &GetCCWin(uint svc_num) - { return GetCCWin(svc_num, CC708services[svc_num].m_current_window); } + { return GetCCWin(svc_num, CC708services[svc_num].m_currentWindow); } // Window settings virtual void SetCurrentWindow(uint service_num, int window_id); @@ -76,22 +76,17 @@ class CC708Reader // Data unsigned char *m_buf[k708MaxServices]; - uint m_buf_alloc[k708MaxServices]; - uint m_buf_size[k708MaxServices]; + uint m_bufAlloc[k708MaxServices]; + uint m_bufSize[k708MaxServices]; bool m_delayed[k708MaxServices]; - short *m_temp_str[k708MaxServices]; - int m_temp_str_alloc[k708MaxServices]; - int m_temp_str_size[k708MaxServices]; + short *m_tempStr[k708MaxServices]; + int m_tempStrAlloc[k708MaxServices]; + int m_tempStrSize[k708MaxServices]; - int m_currentservice {1}; + int m_currentService {1}; CC708Service CC708services[k708MaxServices]; int CC708DelayedDeletes[k708MaxServices]; - QString m_osdfontname; - QString m_osdccfontname; - QString m_osd708fontnames[20]; - QString m_osdprefix; - QString m_osdtheme; MythPlayer *m_parent {nullptr}; bool m_enabled {false}; diff --git a/mythtv/libs/libmythtv/cc708window.cpp b/mythtv/libs/libmythtv/cc708window.cpp index b6c135fb386..7639cfc7727 100644 --- a/mythtv/libs/libmythtv/cc708window.cpp +++ b/mythtv/libs/libmythtv/cc708window.cpp @@ -195,8 +195,7 @@ void CC708Window::Resize(uint new_rows, uint new_columns) // Expand the array if the new size exceeds the current capacity // in either dimension. - CC708Character *new_text = - new CC708Character[new_rows * new_columns]; + auto *new_text = new CC708Character[new_rows * new_columns]; m_pen.m_column = 0; m_pen.m_row = 0; uint i, j; @@ -205,11 +204,11 @@ void CC708Window::Resize(uint new_rows, uint new_columns) for (j = 0; j < m_column_count; ++j) new_text[i * new_columns + j] = m_text[i * m_true_column_count + j]; for (; j < new_columns; ++j) - new_text[i * new_columns + j].m_attr = m_pen.attr; + new_text[i * new_columns + j].m_attr = m_pen.m_attr; } for (; i < new_rows; ++i) for (j = 0; j < new_columns; ++j) - new_text[i * new_columns + j].m_attr = m_pen.attr; + new_text[i * new_columns + j].m_attr = m_pen.m_attr; delete [] m_text; m_text = new_text; @@ -225,13 +224,13 @@ void CC708Window::Resize(uint new_rows, uint new_columns) for (uint j = m_column_count; j < new_columns; ++j) { m_text[i * m_true_column_count + j].m_character = ' '; - m_text[i * m_true_column_count + j].m_attr = m_pen.attr; + m_text[i * m_true_column_count + j].m_attr = m_pen.m_attr; } for (uint i = m_row_count; i < new_rows; ++i) for (uint j = 0; j < new_columns; ++j) { m_text[i * m_true_column_count + j].m_character = ' '; - m_text[i * m_true_column_count + j].m_attr = m_pen.attr; + m_text[i * m_true_column_count + j].m_attr = m_pen.m_attr; } SetChanged(); } @@ -264,7 +263,7 @@ void CC708Window::Clear(void) for (uint i = 0; i < m_true_row_count * m_true_column_count; i++) { m_text[i].m_character = QChar(' '); - m_text[i].m_attr = m_pen.attr; + m_text[i].m_attr = m_pen.m_attr; } SetChanged(); } @@ -321,24 +320,24 @@ vector<CC708String*> CC708Window::GetStrings(void) const if (!cur) { cur = new CC708String; - cur->x = i; - cur->y = j; - cur->attr = chr.m_attr; + cur->m_x = i; + cur->m_y = j; + cur->m_attr = chr.m_attr; strStart = i; } bool isDisplayable = (chr.m_character != ' ' || chr.m_attr.m_underline); if (inLeadingSpaces && isDisplayable) { - cur->attr = chr.m_attr; + cur->m_attr = chr.m_attr; inLeadingSpaces = false; } if (isDisplayable) { inTrailingSpaces = false; } - if (cur->attr != chr.m_attr) + if (cur->m_attr != chr.m_attr) { - cur->str = QString(&chars[strStart], i - strStart); + cur->m_str = QString(&chars[strStart], i - strStart); list.push_back(cur); createdString = true; createdNonblankStrings = true; @@ -357,7 +356,7 @@ vector<CC708String*> CC708Window::GetStrings(void) const int length = allSpaces ? 0 : m_column_count - strStart; if (length) createdNonblankStrings = true; - cur->str = QString(&chars[strStart], length); + cur->m_str = QString(&chars[strStart], length); list.push_back(cur); } else @@ -370,7 +369,7 @@ vector<CC708String*> CC708Window::GetStrings(void) const return list; } -void CC708Window::DisposeStrings(vector<CC708String*> &strings) const +void CC708Window::DisposeStrings(vector<CC708String*> &strings) { while (!strings.empty()) { @@ -439,14 +438,14 @@ void CC708Window::AddChar(QChar ch) { DecrPenLocation(); CC708Character& chr = GetCCChar(); - chr.m_attr = m_pen.attr; + chr.m_attr = m_pen.m_attr; chr.m_character = QChar(' '); SetChanged(); return; } CC708Character& chr = GetCCChar(); - chr.m_attr = m_pen.attr; + chr.m_attr = m_pen.m_attr; chr.m_character = ch; int c = m_pen.m_column; int r = m_pen.m_row; @@ -607,47 +606,47 @@ void CC708Window::LimitPenLocation(void) void CC708Pen::SetPenStyle(uint style) { - static const uint style2font[] = { 0, 0, 1, 2, 3, 4, 3, 4 }; + static const uint kStyle2Font[] = { 0, 0, 1, 2, 3, 4, 3, 4 }; if ((style < 1) || (style > 7)) return; - attr.m_pen_size = k708AttrSizeStandard; - attr.m_offset = k708AttrOffsetNormal; - attr.m_font_tag = style2font[style]; - attr.m_italics = false; - attr.m_underline = false; - attr.m_boldface = false; - attr.m_edge_type = 0; - attr.m_fg_color = k708AttrColorWhite; - attr.m_fg_opacity = k708AttrOpacitySolid; - attr.m_bg_color = k708AttrColorBlack; - attr.m_bg_opacity = (style<6) ? + m_attr.m_penSize = k708AttrSizeStandard; + m_attr.m_offset = k708AttrOffsetNormal; + m_attr.m_fontTag = kStyle2Font[style]; + m_attr.m_italics = false; + m_attr.m_underline = false; + m_attr.m_boldface = false; + m_attr.m_edgeType = 0; + m_attr.m_fgColor = k708AttrColorWhite; + m_attr.m_fgOpacity = k708AttrOpacitySolid; + m_attr.m_bgColor = k708AttrColorBlack; + m_attr.m_bgOpacity = (style<6) ? k708AttrOpacitySolid : k708AttrOpacityTransparent; - attr.m_edge_color = k708AttrColorBlack; - attr.m_actual_fg_color = QColor(); + m_attr.m_edgeColor = k708AttrColorBlack; + m_attr.m_actualFgColor = QColor(); } CC708Character::CC708Character(const CC708Window &win) - : m_attr(win.m_pen.attr) + : m_attr(win.m_pen.m_attr) { } bool CC708CharacterAttribute::operator==( const CC708CharacterAttribute &other) const { - return ((m_pen_size == other.m_pen_size) && + return ((m_penSize == other.m_penSize) && (m_offset == other.m_offset) && - (m_text_tag == other.m_text_tag) && - (m_font_tag == other.m_font_tag) && - (m_edge_type == other.m_edge_type) && + (m_textTag == other.m_textTag) && + (m_fontTag == other.m_fontTag) && + (m_edgeType == other.m_edgeType) && (m_underline == other.m_underline) && (m_italics == other.m_italics) && - (m_fg_color == other.m_fg_color) && - (m_fg_opacity == other.m_fg_opacity) && - (m_bg_color == other.m_bg_color) && - (m_bg_opacity == other.m_bg_opacity) && - (m_edge_color == other.m_edge_color)); + (m_fgColor == other.m_fgColor) && + (m_fgOpacity == other.m_fgOpacity) && + (m_bgColor == other.m_bgColor) && + (m_bgOpacity == other.m_bgOpacity) && + (m_edgeColor == other.m_edgeColor)); } QColor CC708CharacterAttribute::ConvertToQColor(uint eia708color) @@ -656,6 +655,6 @@ QColor CC708CharacterAttribute::ConvertToQColor(uint eia708color) // U.S. ATSC programs seem to use just the higher-order bit, // i.e. values 0 and 2, so the last two elements of X[] are both // set to the maximum 255, otherwise font colors are dim. - static int X[] = {0, 96, 255, 255}; - return {X[(eia708color>>4)&3], X[(eia708color>>2)&3], X[eia708color&3]}; + static constexpr int kX[] = {0, 96, 255, 255}; + return {kX[(eia708color>>4)&3], kX[(eia708color>>2)&3], kX[eia708color&3]}; } diff --git a/mythtv/libs/libmythtv/cc708window.h b/mythtv/libs/libmythtv/cc708window.h index ea10cbda89d..7d539c646d5 100644 --- a/mythtv/libs/libmythtv/cc708window.h +++ b/mythtv/libs/libmythtv/cc708window.h @@ -73,22 +73,22 @@ const int k708MaxColumns = 64; // 6-bit field in DefineWindow class CC708CharacterAttribute { public: - uint m_pen_size {k708AttrSizeStandard}; + uint m_penSize {k708AttrSizeStandard}; uint m_offset {k708AttrOffsetNormal}; - uint m_text_tag {0}; - uint m_font_tag {0}; // system font - uint m_edge_type {k708AttrEdgeNone}; + uint m_textTag {0}; + uint m_fontTag {0}; // system font + uint m_edgeType {k708AttrEdgeNone}; bool m_underline {false}; bool m_italics {false}; bool m_boldface {false}; - uint m_fg_color {k708AttrColorWhite}; // will be overridden - uint m_fg_opacity {k708AttrOpacitySolid}; // solid - uint m_bg_color {k708AttrColorBlack}; - uint m_bg_opacity {k708AttrOpacitySolid}; - uint m_edge_color {k708AttrColorBlack}; + uint m_fgColor {k708AttrColorWhite}; // will be overridden + uint m_fgOpacity {k708AttrOpacitySolid}; // solid + uint m_bgColor {k708AttrColorBlack}; + uint m_bgOpacity {k708AttrOpacitySolid}; + uint m_edgeColor {k708AttrColorBlack}; - QColor m_actual_fg_color; // if !isValid(), then convert m_fg_color + QColor m_actualFgColor; // if !isValid(), then convert m_fgColor CC708CharacterAttribute(bool isItalic = false, bool isBold = false, @@ -97,38 +97,38 @@ class CC708CharacterAttribute m_underline(isUnderline), m_italics(isItalic), m_boldface(isBold), - m_actual_fg_color(fgColor) + m_actualFgColor(fgColor) { } static QColor ConvertToQColor(uint eia708color); QColor GetFGColor(void) const { - QColor fg = (m_actual_fg_color.isValid() ? - m_actual_fg_color : ConvertToQColor(m_fg_color)); + QColor fg = (m_actualFgColor.isValid() ? + m_actualFgColor : ConvertToQColor(m_fgColor)); fg.setAlpha(GetFGAlpha()); return fg; } QColor GetBGColor(void) const { - QColor bg = ConvertToQColor(m_bg_color); + QColor bg = ConvertToQColor(m_bgColor); bg.setAlpha(GetBGAlpha()); return bg; } - QColor GetEdgeColor(void) const { return ConvertToQColor(m_edge_color); } + QColor GetEdgeColor(void) const { return ConvertToQColor(m_edgeColor); } uint GetFGAlpha(void) const { //SOLID=0, FLASH=1, TRANSLUCENT=2, and TRANSPARENT=3. static uint alpha[4] = { 0xff, 0xff, 0x7f, 0x00, }; - return alpha[m_fg_opacity & 0x3]; + return alpha[m_fgOpacity & 0x3]; } uint GetBGAlpha(void) const { //SOLID=0, FLASH=1, TRANSLUCENT=2, and TRANSPARENT=3. static uint alpha[4] = { 0xff, 0xff, 0x7f, 0x00, }; - return alpha[m_bg_opacity & 0x3]; + return alpha[m_bgOpacity & 0x3]; } bool operator==(const CC708CharacterAttribute &other) const; @@ -145,17 +145,17 @@ class CC708Pen int offset, int text_tag, int font_tag, int edge_type, int underline, int italics) { - attr.m_pen_size = pen_size; - attr.m_offset = offset; - attr.m_text_tag = text_tag; - attr.m_font_tag = font_tag; - attr.m_edge_type = edge_type; - attr.m_underline = underline; - attr.m_italics = italics; - attr.m_boldface = 0; + m_attr.m_penSize = pen_size; + m_attr.m_offset = offset; + m_attr.m_textTag = text_tag; + m_attr.m_fontTag = font_tag; + m_attr.m_edgeType = edge_type; + m_attr.m_underline = underline; + m_attr.m_italics = italics; + m_attr.m_boldface = 0; } public: - CC708CharacterAttribute attr; + CC708CharacterAttribute m_attr; uint m_row {0}; uint m_column {0}; @@ -174,10 +174,10 @@ class CC708Character class CC708String { public: - uint x; - uint y; - QString str; - CC708CharacterAttribute attr; + uint m_x; + uint m_y; + QString m_str; + CC708CharacterAttribute m_attr; }; class MTV_PUBLIC CC708Window @@ -209,7 +209,7 @@ class MTV_PUBLIC CC708Window } CC708Character &GetCCChar(void) const; vector<CC708String*> GetStrings(void) const; - void DisposeStrings(vector<CC708String*> &strings) const; + static void DisposeStrings(vector<CC708String*> &strings); QColor GetFillColor(void) const { QColor fill = CC708CharacterAttribute::ConvertToQColor(m_fill_color); @@ -305,7 +305,7 @@ class CC708Service CC708Service() = default; public: - uint m_current_window {0}; + uint m_currentWindow {0}; CC708Window m_windows[k708MaxWindows]; }; diff --git a/mythtv/libs/libmythtv/channelgroup.cpp b/mythtv/libs/libmythtv/channelgroup.cpp index c14834ed4b3..660d4e804ee 100644 --- a/mythtv/libs/libmythtv/channelgroup.cpp +++ b/mythtv/libs/libmythtv/channelgroup.cpp @@ -213,7 +213,7 @@ int ChannelGroup::GetNextChannelGroup(const ChannelGroupList &sorted, int grpid) if (grpid == -1) return sorted[0].m_grpid; - ChannelGroupList::const_iterator it = find(sorted.begin(), sorted.end(), grpid); + auto it = find(sorted.cbegin(), sorted.cend(), grpid); // If grpid is not in the list, return -1 for all channels if (it == sorted.end()) diff --git a/mythtv/libs/libmythtv/channelgroup.h b/mythtv/libs/libmythtv/channelgroup.h index b8d9e6c4ba8..6f62a10e885 100644 --- a/mythtv/libs/libmythtv/channelgroup.h +++ b/mythtv/libs/libmythtv/channelgroup.h @@ -29,7 +29,7 @@ class MTV_PUBLIC ChannelGroupItem uint m_grpid; QString m_name; }; -typedef vector<ChannelGroupItem> ChannelGroupList; +using ChannelGroupList = vector<ChannelGroupItem>; /** \class ChannelGroup */ diff --git a/mythtv/libs/libmythtv/channelinfo.h b/mythtv/libs/libmythtv/channelinfo.h index 6cce8f1b6a1..836008b8d83 100644 --- a/mythtv/libs/libmythtv/channelinfo.h +++ b/mythtv/libs/libmythtv/channelinfo.h @@ -118,7 +118,7 @@ class MTV_PUBLIC ChannelInfo QList<uint> m_groupIdList; QList<uint> m_inputIdList; }; -typedef vector<ChannelInfo> ChannelInfoList; +using ChannelInfoList = vector<ChannelInfo>; class MTV_PUBLIC ChannelInsertInfo { @@ -240,7 +240,7 @@ class MTV_PUBLIC ChannelInsertInfo bool m_could_be_opencable {false}; int m_decryption_status {0}; }; -typedef vector<ChannelInsertInfo> ChannelInsertInfoList; +using ChannelInsertInfoList = vector<ChannelInsertInfo>; Q_DECLARE_METATYPE(ChannelInfo*) diff --git a/mythtv/libs/libmythtv/channelscan/channelimporter.cpp b/mythtv/libs/libmythtv/channelscan/channelimporter.cpp index 3da72df9097..cb48bda599d 100644 --- a/mythtv/libs/libmythtv/channelscan/channelimporter.cpp +++ b/mythtv/libs/libmythtv/channelscan/channelimporter.cpp @@ -206,21 +206,17 @@ uint ChannelImporter::DeleteChannels( AddChanToCopy(transport_copy, transports[i], chan); } } - if (transport_copy.m_channels.size() > 0) + if (!transport_copy.m_channels.empty()) off_air_transports.push_back(transport_copy); } if (off_air_list.empty()) - { return 0; - } - else - { - // List of off-air channels (in database but not in the scan) - cout << endl << "Off-air channels (" << SimpleCountChannels(off_air_transports) << "):" << endl; - ChannelImporterBasicStats infoA = CollectStats(off_air_transports); - cout << FormatChannels(off_air_transports, &infoA).toLatin1().constData() << endl; - } + + // List of off-air channels (in database but not in the scan) + cout << endl << "Off-air channels (" << SimpleCountChannels(off_air_transports) << "):" << endl; + ChannelImporterBasicStats infoA = CollectStats(off_air_transports); + cout << FormatChannels(off_air_transports, &infoA).toLatin1().constData() << endl; // Ask user whether to delete all or some of these stale channels // if some is selected ask about each individually @@ -351,7 +347,7 @@ void ChannelImporter::InsertChannels( uint chantype = (uint) kChannelTypeNonConflictingFirst; for (; chantype <= (uint) kChannelTypeNonConflictingLast; ++chantype) { - ChannelType type = (ChannelType) chantype; + auto type = (ChannelType) chantype; uint new_chan = 0; uint old_chan = 0; CountChannels(list, info, type, new_chan, old_chan); @@ -391,7 +387,7 @@ void ChannelImporter::InsertChannels( chantype = (uint) kChannelTypeConflictingFirst; for (; chantype <= (uint) kChannelTypeConflictingLast; ++chantype) { - ChannelType type = (ChannelType) chantype; + auto type = (ChannelType) chantype; uint new_chan = 0; uint old_chan = 0; CountChannels(list, info, type, new_chan, old_chan); @@ -417,29 +413,29 @@ void ChannelImporter::InsertChannels( } // List what has been done with each channel - if (updated.size() > 0) + if (!updated.empty()) { cout << endl << "Updated old channels (" << SimpleCountChannels(updated) << "):" << endl; cout << FormatChannels(updated).toLatin1().constData() << endl; } - if (skipped_updates.size() > 0) + if (!skipped_updates.empty()) { cout << endl << "Skipped old channels (" << SimpleCountChannels(skipped_updates) << "):" << endl; cout << FormatChannels(skipped_updates).toLatin1().constData() << endl; } - if (inserted.size() > 0) + if (!inserted.empty()) { cout << endl << "Inserted new channels (" << SimpleCountChannels(inserted) << "):" << endl; cout << FormatChannels(inserted).toLatin1().constData() << endl; } - if (skipped_inserts.size() > 0) + if (!skipped_inserts.empty()) { cout << endl << "Skipped new channels (" << SimpleCountChannels(skipped_inserts) << "):" << endl; cout << FormatChannels(skipped_inserts).toLatin1().constData() << endl; } // Remaining channels and sum uniques again - if (list.size() > 0) + if (!list.empty()) { ChannelImporterBasicStats ninfo = CollectStats(list); ChannelImporterUniquenessStats nstats = CollectUniquenessStats(list, ninfo); @@ -660,9 +656,9 @@ ScanDTVTransportList ChannelImporter::InsertChannels( chan.m_default_authority, chan.m_service_type); - if (!transports[i].m_iptv_tuning.GetDataURL().isEmpty()) + if (!transports[i].m_iptvTuning.GetDataURL().isEmpty()) ChannelUtil::CreateIPTVTuningData(chan.m_channel_id, - transports[i].m_iptv_tuning); + transports[i].m_iptvTuning); } } @@ -684,13 +680,13 @@ ScanDTVTransportList ChannelImporter::InsertChannels( } } - if (new_transport.m_channels.size() > 0) + if (!new_transport.m_channels.empty()) next_list.push_back(new_transport); - if (skipped_transport.m_channels.size() > 0) + if (!skipped_transport.m_channels.empty()) skipped_list.push_back(skipped_transport); - if (inserted_transport.m_channels.size() > 0) + if (!inserted_transport.m_channels.empty()) inserted_list.push_back(inserted_transport); } @@ -849,13 +845,13 @@ ScanDTVTransportList ChannelImporter::UpdateChannels( } } - if (new_transport.m_channels.size() > 0) + if (!new_transport.m_channels.empty()) next_list.push_back(new_transport); - if (skipped_transport.m_channels.size() > 0) + if (!skipped_transport.m_channels.empty()) skipped_list.push_back(skipped_transport); - if (updated_transport.m_channels.size() > 0) + if (!updated_transport.m_channels.empty()) updated_list.push_back(updated_transport); } @@ -877,7 +873,7 @@ void ChannelImporter::AddChanToCopy( const ChannelInsertInfo &chan ) { - if (transport_copy.m_channels.size() == 0) + if (transport_copy.m_channels.empty()) { transport_copy = transport; transport_copy.m_channels.clear(); @@ -885,7 +881,7 @@ void ChannelImporter::AddChanToCopy( transport_copy.m_channels.push_back(chan); } -void ChannelImporter::CleanupDuplicates(ScanDTVTransportList &transports) const +void ChannelImporter::CleanupDuplicates(ScanDTVTransportList &transports) { ScanDTVTransportList no_dups; @@ -1557,8 +1553,8 @@ int ChannelImporter::SimpleCountChannels( QString ChannelImporter::ComputeSuggestedChannelNum( const ChannelInsertInfo &chan) { - static QMutex last_free_lock; - static QMap<uint,uint> last_free_chan_num_map; + static QMutex s_lastFreeLock; + static QMap<uint,uint> s_lastFreeChanNumMap; // Suggest existing channel number if non-conflicting if (!ChannelUtil::IsConflicting(chan.m_chan_num, chan.m_source_id)) @@ -1609,8 +1605,8 @@ QString ChannelImporter::ComputeSuggestedChannelNum( } // Find unused channel number - QMutexLocker locker(&last_free_lock); - uint last_free_chan_num = last_free_chan_num_map[chan.m_source_id]; + QMutexLocker locker(&s_lastFreeLock); + uint last_free_chan_num = s_lastFreeChanNumMap[chan.m_source_id]; for (last_free_chan_num++; ; ++last_free_chan_num) { chan_num = QString::number(last_free_chan_num); @@ -1618,7 +1614,7 @@ QString ChannelImporter::ComputeSuggestedChannelNum( break; } // cppcheck-suppress unreadVariable - last_free_chan_num_map[chan.m_source_id] = last_free_chan_num; + s_lastFreeChanNumMap[chan.m_source_id] = last_free_chan_num; return chan_num; } @@ -1634,7 +1630,7 @@ ChannelImporter::QueryUserDelete(const QString &msg) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *deleteDialog = + auto *deleteDialog = new MythDialogBox(msg, popupStack, "deletechannels"); if (deleteDialog->Create()) @@ -1709,7 +1705,7 @@ ChannelImporter::QueryUserInsert(const QString &msg) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *insertDialog = + auto *insertDialog = new MythDialogBox(msg, popupStack, "insertchannels"); if (insertDialog->Create()) @@ -1779,7 +1775,7 @@ ChannelImporter::QueryUserUpdate(const QString &msg) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *updateDialog = + auto *updateDialog = new MythDialogBox(msg, popupStack, "updatechannels"); if (updateDialog->Create()) @@ -1841,8 +1837,8 @@ OkCancelType ChannelImporter::ShowManualChannelPopup( { int dc = -1; MythScreenStack *popupStack = parent->GetStack("popup stack"); - MythDialogBox *popup = new MythDialogBox(title, message, popupStack, - "manualchannelpopup"); + auto *popup = new MythDialogBox(title, message, popupStack, + "manualchannelpopup"); if (popup->Create()) { @@ -1868,7 +1864,7 @@ OkCancelType ChannelImporter::ShowManualChannelPopup( // Choice "Edit" if (1 == dc) { - MythTextInputDialog *textEdit = + auto *textEdit = new MythTextInputDialog(popupStack, tr("Please enter a unique channel number."), FilterNone, false, text); @@ -1910,8 +1906,8 @@ OkCancelType ChannelImporter::ShowResolveChannelPopup( { int dc = -1; MythScreenStack *popupStack = parent->GetStack("popup stack"); - MythDialogBox *popup = new MythDialogBox(title, message, popupStack, - "resolvechannelpopup"); + auto *popup = new MythDialogBox(title, message, popupStack, + "resolvechannelpopup"); if (popup->Create()) { @@ -1938,7 +1934,7 @@ OkCancelType ChannelImporter::ShowResolveChannelPopup( // Choice "Edit" if (2 == dc) { - MythTextInputDialog *textEdit = + auto *textEdit = new MythTextInputDialog(popupStack, tr("Please enter a unique channel number."), FilterNone, false, text); @@ -2146,4 +2142,4 @@ bool ChannelImporter::CheckChannelNumber( ok = ok && !ChannelUtil::IsConflicting( num, chan.m_source_id, chan.m_channel_id); return ok; -} \ No newline at end of file +} diff --git a/mythtv/libs/libmythtv/channelscan/channelimporter.h b/mythtv/libs/libmythtv/channelscan/channelimporter.h index 1d2cef045b7..c459b5a0d71 100644 --- a/mythtv/libs/libmythtv/channelscan/channelimporter.h +++ b/mythtv/libs/libmythtv/channelscan/channelimporter.h @@ -23,12 +23,12 @@ #include "channelscantypes.h" #include "mythmainwindow.h" -typedef enum { +enum OkCancelType { kOCTCancelAll = -1, kOCTCancel = +0, kOCTOk = +1, kOCTOkAll = +2, -} OkCancelType; +}; class ChannelImporterBasicStats { @@ -96,27 +96,27 @@ class MTV_PUBLIC ChannelImporter void Process(const ScanDTVTransportList&, int sourceid = -1); protected: - typedef enum + enum DeleteAction { kDeleteAll, kDeleteManual, kDeleteIgnoreAll, kDeleteInvisibleAll, - } DeleteAction; - typedef enum + }; + enum InsertAction { kInsertAll, kInsertManual, kInsertIgnoreAll, - } InsertAction; - typedef enum + }; + enum UpdateAction { kUpdateAll, kUpdateManual, kUpdateIgnoreAll, - } UpdateAction; + }; - typedef enum + enum ChannelType { kChannelTypeFirst = 0, @@ -136,11 +136,11 @@ class MTV_PUBLIC ChannelImporter kNTSCConflicting, kChannelTypeConflictingLast = kNTSCConflicting, kChannelTypeLast = kChannelTypeConflictingLast, - } ChannelType; + }; - QString toString(ChannelType type); + static QString toString(ChannelType type); - void CleanupDuplicates(ScanDTVTransportList &transports) const; + static void CleanupDuplicates(ScanDTVTransportList &transports); void FilterServices(ScanDTVTransportList &transports) const; ScanDTVTransportList GetDBTransports( uint sourceid, ScanDTVTransportList&) const; diff --git a/mythtv/libs/libmythtv/channelscan/channelscan_sm.cpp b/mythtv/libs/libmythtv/channelscan/channelscan_sm.cpp index 1ec4b17916f..0f407782aff 100644 --- a/mythtv/libs/libmythtv/channelscan/channelscan_sm.cpp +++ b/mythtv/libs/libmythtv/channelscan/channelscan_sm.cpp @@ -32,11 +32,13 @@ // C++ includes #include <algorithm> +#include <utility> + using namespace std; // Qt includes -#include <QObject> #include <QMutexLocker> +#include <QObject> // MythTV includes - General #include "channelscan_sm.h" @@ -96,7 +98,7 @@ class ScannedChannelInfo bool IsEmpty() const { return m_pats.empty() && m_pmts.empty() && - m_program_encryption_status.isEmpty() && + m_programEncryptionStatus.isEmpty() && !m_mgt && m_cvcts.empty() && m_tvcts.empty() && m_nits.empty() && m_sdts.empty() && m_bats.empty(); @@ -105,7 +107,7 @@ class ScannedChannelInfo // MPEG pat_map_t m_pats; pmt_vec_t m_pmts; - QMap<uint,uint> m_program_encryption_status; // pnum->enc_status + QMap<uint,uint> m_programEncryptionStatus; // pnum->enc_status // ATSC const MasterGuideTable *m_mgt {nullptr}; @@ -144,7 +146,7 @@ class ScannedChannelInfo ChannelScanSM::ChannelScanSM(ScanMonitor *_scan_monitor, const QString &_cardtype, ChannelBase *_channel, int _sourceID, uint signal_timeout, - uint channel_timeout, const QString &_inputname, + uint channel_timeout, QString _inputname, bool test_decryption) : // Set in constructor m_scanMonitor(_scan_monitor), @@ -154,7 +156,7 @@ ChannelScanSM::ChannelScanSM(ScanMonitor *_scan_monitor, m_sourceID(_sourceID), m_signalTimeout(signal_timeout), m_channelTimeout(channel_timeout), - m_inputName(_inputname), + m_inputName(std::move(_inputname)), m_testDecryption(test_decryption), // Misc m_analogSignalHandler(new AnalogSignalHandler(this)) @@ -166,7 +168,7 @@ ChannelScanSM::ChannelScanSM(ScanMonitor *_scan_monitor, if (dtvSigMon) { LOG(VB_CHANSCAN, LOG_INFO, LOC + "Connecting up DTVSignalMonitor"); - ScanStreamData *data = new ScanStreamData(); + auto *data = new ScanStreamData(); MSqlQuery query(MSqlQuery::InitCon()); query.prepare( @@ -200,7 +202,7 @@ ChannelScanSM::ChannelScanSM(ScanMonitor *_scan_monitor, SignalMonitor::kDTVSigMon_WaitForSDT); #ifdef USING_DVB - DVBChannel *dvbchannel = dynamic_cast<DVBChannel*>(m_channel); + auto *dvbchannel = dynamic_cast<DVBChannel*>(m_channel); if (dvbchannel && dvbchannel->GetRotor()) dtvSigMon->AddFlags(SignalMonitor::kDVBSigMon_WaitForPos); #endif @@ -355,7 +357,7 @@ bool ChannelScanSM::ScanExistingTransports(uint sourceid, bool follow_nit) return m_scanning; } -void ChannelScanSM::LogLines(const QString& string) const +void ChannelScanSM::LogLines(const QString& string) { QStringList lines = string.split('\n'); for (int i = 0; i < lines.size(); ++i) @@ -958,7 +960,7 @@ bool ChannelScanSM::UpdateChannelInfo(bool wait_until_complete) QMap<uint, uint>::const_iterator it = m_currentEncryptionStatus.begin(); for (; it != m_currentEncryptionStatus.end(); ++it) { - m_currentInfo->m_program_encryption_status[it.key()] = *it; + m_currentInfo->m_programEncryptionStatus[it.key()] = *it; if (m_testDecryption) { @@ -1019,14 +1021,14 @@ bool ChannelScanSM::UpdateChannelInfo(bool wait_until_complete) LOG(VB_CHANSCAN, LOG_DEBUG, LOC + QString("%1(%2) m_inputName: %3 ").arg(__FUNCTION__).arg(__LINE__).arg(m_inputName) + - QString("m_mod_sys:%1 %2").arg(item.m_tuning.m_mod_sys).arg(item.m_tuning.m_mod_sys.toString())); + QString("m_mod_sys:%1 %2").arg(item.m_tuning.m_modSys).arg(item.m_tuning.m_modSys.toString())); if (m_scanDTVTunerType == DTVTunerType::kTunerTypeDVBT2) { if (m_dvbt2Tried) - item.m_tuning.m_mod_sys = DTVModulationSystem::kModulationSystem_DVBT2; + item.m_tuning.m_modSys = DTVModulationSystem::kModulationSystem_DVBT2; else - item.m_tuning.m_mod_sys = DTVModulationSystem::kModulationSystem_DVBT; + item.m_tuning.m_modSys = DTVModulationSystem::kModulationSystem_DVBT; } m_channelList << ChannelListItem(m_current, m_currentInfo); @@ -1291,8 +1293,8 @@ ChannelScanSM::GetChannelList(transport_scan_items_it_t trans_info, pat_map_t::const_iterator pat_list_it = scan_info->m_pats.begin(); for (; pat_list_it != scan_info->m_pats.end(); ++pat_list_it) { - pat_vec_t::const_iterator pat_it = (*pat_list_it).begin(); - for (; pat_it != (*pat_list_it).end(); ++pat_it) + auto pat_it = (*pat_list_it).cbegin(); + for (; pat_it != (*pat_list_it).cend(); ++pat_it) { bool could_be_opencable = false; for (uint i = 0; i < (*pat_it)->ProgramCount(); ++i) @@ -1377,8 +1379,8 @@ ChannelScanSM::GetChannelList(transport_scan_items_it_t trans_info, sdt_map_t::const_iterator sdt_list_it = scan_info->m_sdts.begin(); for (; sdt_list_it != scan_info->m_sdts.end(); ++sdt_list_it) { - sdt_vec_t::const_iterator sdt_it = (*sdt_list_it).begin(); - for (; sdt_it != (*sdt_list_it).end(); ++sdt_it) + auto sdt_it = (*sdt_list_it).cbegin(); + for (; sdt_it != (*sdt_list_it).cend(); ++sdt_it) { for (uint i = 0; i < (*sdt_it)->ServiceCount(); ++i) { @@ -1698,7 +1700,7 @@ ChannelScanSM::GetChannelList(transport_scan_items_it_t trans_info, { uint pnum = dbchan_it.key(); ChannelInsertInfo &info = *dbchan_it; - info.m_decryption_status = scan_info->m_program_encryption_status[pnum]; + info.m_decryption_status = scan_info->m_programEncryptionStatus[pnum]; } return pnum_to_dbchan; @@ -1720,7 +1722,7 @@ ScanDTVTransportList ChannelScanSM::GetChannelList(bool addFullTS) const GetChannelList(it->first, it->second); ScanDTVTransport item((*it->first).m_tuning, tuner_type, cardid); - item.m_iptv_tuning = (*(it->first)).m_iptvTuning; + item.m_iptvTuning = (*(it->first)).m_iptvTuning; QMap<uint,ChannelInsertInfo>::iterator dbchan_it; for (dbchan_it = pnum_to_dbchan.begin(); @@ -2059,14 +2061,14 @@ bool ChannelScanSM::Tune(const transport_scan_items_it_t &transport) if (m_scanDTVTunerType == DTVTunerType::kTunerTypeDVBT) { - tuning.m_mod_sys = DTVModulationSystem::kModulationSystem_DVBT; + tuning.m_modSys = DTVModulationSystem::kModulationSystem_DVBT; } if (m_scanDTVTunerType == DTVTunerType::kTunerTypeDVBT2) { if (m_dvbt2Tried) - tuning.m_mod_sys = DTVModulationSystem::kModulationSystem_DVBT2; + tuning.m_modSys = DTVModulationSystem::kModulationSystem_DVBT2; else - tuning.m_mod_sys = DTVModulationSystem::kModulationSystem_DVBT; + tuning.m_modSys = DTVModulationSystem::kModulationSystem_DVBT; } return GetDTVChannel()->Tune(tuning); @@ -2190,7 +2192,7 @@ bool ChannelScanSM::ScanTransports( QString start = table_start; const QString& end = table_end; - freq_table_list_t::iterator it = tables.begin(); + auto it = tables.begin(); for (; it != tables.end(); ++it) { const FrequencyTable &ft = **it; @@ -2253,8 +2255,8 @@ bool ChannelScanSM::ScanForChannels(uint sourceid, DTVTunerType tunertype; tunertype.Parse(cardtype); - DTVChannelList::const_iterator it = channels.begin(); - for (uint i = 0; it != channels.end(); ++it, ++i) + auto it = channels.cbegin(); + for (uint i = 0; it != channels.cend(); ++it, ++i) { DTVTransport tmp = *it; tmp.m_sistandard = std; diff --git a/mythtv/libs/libmythtv/channelscan/channelscan_sm.h b/mythtv/libs/libmythtv/channelscan/channelscan_sm.h index 142628562ca..48a918d4f45 100644 --- a/mythtv/libs/libmythtv/channelscan/channelscan_sm.h +++ b/mythtv/libs/libmythtv/channelscan/channelscan_sm.h @@ -60,17 +60,17 @@ class SignalMonitor; class DTVSignalMonitor; class DVBSignalMonitor; -typedef vector<const ProgramMapTable*> pmt_vec_t; -typedef QMap<uint, pmt_vec_t> pmt_map_t; +using pmt_vec_t = vector<const ProgramMapTable*>; +using pmt_map_t = QMap<uint, pmt_vec_t>; class ScannedChannelInfo; -typedef QPair<transport_scan_items_it_t, ScannedChannelInfo*> ChannelListItem; -typedef QList<ChannelListItem> ChannelList; +using ChannelListItem = QPair<transport_scan_items_it_t, ScannedChannelInfo*>; +using ChannelList = QList<ChannelListItem>; class ChannelScanSM; class AnalogSignalHandler : public SignalMonitorListener { public: - explicit AnalogSignalHandler(ChannelScanSM *_siscan) : siscan(_siscan) { } + explicit AnalogSignalHandler(ChannelScanSM *_siscan) : m_siScan(_siscan) { } public: inline void AllGood(void) override; // SignalMonitorListener @@ -79,7 +79,7 @@ class AnalogSignalHandler : public SignalMonitorListener void StatusSignalStrength(const SignalMonitorValue&) override { } // SignalMonitorListener private: - ChannelScanSM *siscan; + ChannelScanSM *m_siScan; }; class ChannelScanSM : public MPEGStreamListener, @@ -94,7 +94,7 @@ class ChannelScanSM : public MPEGStreamListener, ChannelScanSM(ScanMonitor *_scan_monitor, const QString &_cardtype, ChannelBase* _channel, int _sourceID, uint signal_timeout, uint channel_timeout, - const QString &_inputname, bool test_decryption); + QString _inputname, bool test_decryption); ~ChannelScanSM(); void StartScanner(void); @@ -129,7 +129,7 @@ class ChannelScanSM : public MPEGStreamListener, DTVSignalMonitor *GetDTVSignalMonitor(void); DVBSignalMonitor *GetDVBSignalMonitor(void); - typedef QMap<uint,ChannelInsertInfo> chan_info_map_t; + using chan_info_map_t = QMap<uint,ChannelInsertInfo>; chan_info_map_t GetChannelList(transport_scan_items_it_t trans_info, ScannedChannelInfo *scan_info) const; uint GetCurrentTransportInfo(QString &chan, QString &chan_tr) const; @@ -172,7 +172,7 @@ class ChannelScanSM : public MPEGStreamListener, bool Tune(const transport_scan_items_it_t &transport); void ScanTransport(const transport_scan_items_it_t &transport); DTVTunerType GuessDTVTunerType(DTVTunerType) const; - void LogLines(const QString& string) const; + static void LogLines(const QString& string); /// \brief Updates Transport Scan progress bar inline void UpdateScanPercentCompleted(void); @@ -269,7 +269,7 @@ inline void ChannelScanSM::UpdateScanPercentCompleted(void) void AnalogSignalHandler::AllGood(void) { - siscan->HandleAllGood(); + m_siScan->HandleAllGood(); } #endif // SISCAN_H diff --git a/mythtv/libs/libmythtv/channelscan/channelscanner_cli.cpp b/mythtv/libs/libmythtv/channelscan/channelscanner_cli.cpp index c74e5ba95f4..10a4e88b1cf 100644 --- a/mythtv/libs/libmythtv/channelscan/channelscanner_cli.cpp +++ b/mythtv/libs/libmythtv/channelscan/channelscanner_cli.cpp @@ -104,11 +104,11 @@ void ChannelScannerCLI::HandleEvent(const ScannerEvent *scanEvent) if (VERBOSE_LEVEL_CHECK(VB_CHANSCAN, LOG_INFO)) { - static QString old_msg; - if (msg != old_msg) + static QString s_oldMsg; + if (msg != s_oldMsg) { LOG(VB_CHANSCAN, LOG_INFO, LOC + msg); - old_msg = msg; + s_oldMsg = msg; } } else if (VERBOSE_LEVEL_NONE) diff --git a/mythtv/libs/libmythtv/channelscan/channelscanner_gui_scan_pane.cpp b/mythtv/libs/libmythtv/channelscan/channelscanner_gui_scan_pane.cpp index 36966d3d0aa..f610292e427 100644 --- a/mythtv/libs/libmythtv/channelscan/channelscanner_gui_scan_pane.cpp +++ b/mythtv/libs/libmythtv/channelscan/channelscanner_gui_scan_pane.cpp @@ -155,7 +155,7 @@ void ChannelScannerGUIScanPane::AppendLine(const QString &text) { if (m_log) { - MythUIButtonListItem *listItem = new MythUIButtonListItem(m_log, text); + auto *listItem = new MythUIButtonListItem(m_log, text); m_log->SetItemCurrent(listItem); } } diff --git a/mythtv/libs/libmythtv/channelscan/channelscantypes.h b/mythtv/libs/libmythtv/channelscan/channelscantypes.h index ff750e8b0cf..b28d71979cf 100644 --- a/mythtv/libs/libmythtv/channelscan/channelscantypes.h +++ b/mythtv/libs/libmythtv/channelscan/channelscantypes.h @@ -1,13 +1,13 @@ #ifndef __CHANNEL_SCAN_TYPES_H_ #define __CHANNEL_SCAN_TYPES_H_ -typedef enum ServiceRequirements +enum ServiceRequirements { kRequireNothing = 0x0, kRequireVideo = 0x1, kRequireAudio = 0x2, kRequireAV = 0x3, kRequireData = 0x4, -} ServiceRequirements; +}; #endif // __CHANNEL_SCAN_TYPES_H_ diff --git a/mythtv/libs/libmythtv/channelscan/externrecscanner.cpp b/mythtv/libs/libmythtv/channelscan/externrecscanner.cpp index 5079bd1d481..2105172bc27 100644 --- a/mythtv/libs/libmythtv/channelscan/externrecscanner.cpp +++ b/mythtv/libs/libmythtv/channelscan/externrecscanner.cpp @@ -3,6 +3,7 @@ // Std C headers #include <cmath> #include <unistd.h> +#include <utility> // Qt headers #include <QFile> @@ -20,12 +21,12 @@ #define LOC QString("ExternRecChanFetch: ") ExternRecChannelScanner::ExternRecChannelScanner(uint cardid, - const QString &inputname, + QString inputname, uint sourceid, ScanMonitor *monitor) : m_scan_monitor(monitor) , m_cardid(cardid) - , m_inputname(inputname) + , m_inputname(std::move(inputname)) , m_sourceid(sourceid) , m_thread(new MThread("ExternRecChannelScanner", this)) { diff --git a/mythtv/libs/libmythtv/channelscan/externrecscanner.h b/mythtv/libs/libmythtv/channelscan/externrecscanner.h index b8e679da98d..c1b71936f12 100644 --- a/mythtv/libs/libmythtv/channelscan/externrecscanner.h +++ b/mythtv/libs/libmythtv/channelscan/externrecscanner.h @@ -24,7 +24,7 @@ class ExternRecChannelScanner : public QRunnable Q_DECLARE_TR_FUNCTIONS(ExternRecChannelScanner); public: - ExternRecChannelScanner(uint cardid, const QString &inputname, uint sourceid, + ExternRecChannelScanner(uint cardid, QString inputname, uint sourceid, ScanMonitor *monitor = nullptr); ~ExternRecChannelScanner(); diff --git a/mythtv/libs/libmythtv/channelscan/inputselectorsetting.cpp b/mythtv/libs/libmythtv/channelscan/inputselectorsetting.cpp index d779a2e7a0e..b30a7100b68 100644 --- a/mythtv/libs/libmythtv/channelscan/inputselectorsetting.cpp +++ b/mythtv/libs/libmythtv/channelscan/inputselectorsetting.cpp @@ -28,14 +28,17 @@ */ #include "inputselectorsetting.h" + +#include <utility> + #include "cardutil.h" #include "mythcorecontext.h" #include "mythdb.h" InputSelector::InputSelector(uint default_cardid, - const QString &default_inputname) : + QString default_inputname) : m_default_cardid(default_cardid), - m_default_inputname(default_inputname) + m_default_inputname(std::move(default_inputname)) { setLabel(tr("Input")); setHelpText( diff --git a/mythtv/libs/libmythtv/channelscan/inputselectorsetting.h b/mythtv/libs/libmythtv/channelscan/inputselectorsetting.h index 1c713a946ee..a433bba6a79 100644 --- a/mythtv/libs/libmythtv/channelscan/inputselectorsetting.h +++ b/mythtv/libs/libmythtv/channelscan/inputselectorsetting.h @@ -37,7 +37,7 @@ class InputSelector : public TransMythUIComboBoxSetting Q_OBJECT public: - InputSelector(uint default_cardid, const QString &default_inputname); + InputSelector(uint default_cardid, QString default_inputname); void Load(void) override; // StandardSetting diff --git a/mythtv/libs/libmythtv/channelscan/iptvchannelfetcher.cpp b/mythtv/libs/libmythtv/channelscan/iptvchannelfetcher.cpp index 94a2ef213b4..f4a51dd7686 100644 --- a/mythtv/libs/libmythtv/channelscan/iptvchannelfetcher.cpp +++ b/mythtv/libs/libmythtv/channelscan/iptvchannelfetcher.cpp @@ -3,6 +3,7 @@ // Std C headers #include <cmath> #include <unistd.h> +#include <utility> // Qt headers #include <QFile> @@ -31,10 +32,10 @@ static bool parse_extinf(const QString &line, int &nextChanNum); IPTVChannelFetcher::IPTVChannelFetcher( - uint cardid, const QString &inputname, uint sourceid, + uint cardid, QString inputname, uint sourceid, bool is_mpts, ScanMonitor *monitor) : m_scan_monitor(monitor), - m_cardid(cardid), m_inputname(inputname), + m_cardid(cardid), m_inputname(std::move(inputname)), m_sourceid(sourceid), m_is_mpts(is_mpts), m_thread(new MThread("IPTVChannelFetcher", this)) { @@ -532,14 +533,12 @@ static bool parse_extinf(const QString &line, nextChanNum = channel_number + 1; return true; } - else - { - // no valid channel number found use the default next one - LOG(VB_GENERAL, LOG_ERR, QString("No channel number found, using next available: %1 for channel: %2").arg(nextChanNum).arg(name)); - channum = QString::number(nextChanNum); - nextChanNum++; - return true; - } + + // no valid channel number found use the default next one + LOG(VB_GENERAL, LOG_ERR, QString("No channel number found, using next available: %1 for channel: %2").arg(nextChanNum).arg(name)); + channum = QString::number(nextChanNum); + nextChanNum++; + return true; } // not one of the formats we support diff --git a/mythtv/libs/libmythtv/channelscan/iptvchannelfetcher.h b/mythtv/libs/libmythtv/channelscan/iptvchannelfetcher.h index 2909fe7158b..c0397a1dcee 100644 --- a/mythtv/libs/libmythtv/channelscan/iptvchannelfetcher.h +++ b/mythtv/libs/libmythtv/channelscan/iptvchannelfetcher.h @@ -57,14 +57,14 @@ class IPTVChannelInfo uint m_programNumber {0}; IPTVTuningData m_tuning; }; -typedef QMap<QString,IPTVChannelInfo> fbox_chan_map_t; +using fbox_chan_map_t = QMap<QString,IPTVChannelInfo>; class IPTVChannelFetcher : public QRunnable { Q_DECLARE_TR_FUNCTIONS(IPTVChannelFetcher); public: - IPTVChannelFetcher(uint cardid, const QString &inputname, uint sourceid, + IPTVChannelFetcher(uint cardid, QString inputname, uint sourceid, bool is_mpts, ScanMonitor *monitor = nullptr); ~IPTVChannelFetcher(); diff --git a/mythtv/libs/libmythtv/channelscan/multiplexsetting.cpp b/mythtv/libs/libmythtv/channelscan/multiplexsetting.cpp index 87c6aee2786..96265d9f91f 100644 --- a/mythtv/libs/libmythtv/channelscan/multiplexsetting.cpp +++ b/mythtv/libs/libmythtv/channelscan/multiplexsetting.cpp @@ -57,7 +57,7 @@ void MultiplexSetting::Load(void) { QString ChannelNumber = QString("Freq %1").arg(query.value(3).toInt()); - struct CHANLIST* curList = chanlists[0].list; + CHANLIST* curList = chanlists[0].list; int totalChannels = chanlists[0].count; int findFrequency = (query.value(3).toInt() / 1000) - 1750; for (int x = 0 ; x < totalChannels ; ++x) diff --git a/mythtv/libs/libmythtv/channelscan/scaninfo.cpp b/mythtv/libs/libmythtv/channelscan/scaninfo.cpp index ec5ef262150..713e76fb942 100644 --- a/mythtv/libs/libmythtv/channelscan/scaninfo.cpp +++ b/mythtv/libs/libmythtv/channelscan/scaninfo.cpp @@ -1,5 +1,6 @@ // C++ headers #include <cstdint> +#include <utility> // Qt headers #include <QString> @@ -12,9 +13,9 @@ #include "mythlogging.h" ScanInfo::ScanInfo(uint scanid, uint cardid, uint sourceid, - bool processed, const QDateTime &scandate) : + bool processed, QDateTime scandate) : m_scanid(scanid), m_cardid(cardid), m_sourceid(sourceid), - m_processed(processed), m_scandate(scandate) + m_processed(processed), m_scandate(std::move(scandate)) { } diff --git a/mythtv/libs/libmythtv/channelscan/scaninfo.h b/mythtv/libs/libmythtv/channelscan/scaninfo.h index df31fe7d88e..45649d64b99 100644 --- a/mythtv/libs/libmythtv/channelscan/scaninfo.h +++ b/mythtv/libs/libmythtv/channelscan/scaninfo.h @@ -3,7 +3,7 @@ // C++ headers #include <cstdint> -typedef unsigned uint; +using uint = unsigned; #include <vector> using namespace std; @@ -20,7 +20,7 @@ class ScanInfo public: ScanInfo() = default; ScanInfo(uint scanid, uint cardid, uint sourceid, - bool processed, const QDateTime &scandate); + bool processed, QDateTime scandate); static bool MarkProcessed(uint scanid); static bool DeleteScan(uint scanid); diff --git a/mythtv/libs/libmythtv/channelscan/scanmonitor.cpp b/mythtv/libs/libmythtv/channelscan/scanmonitor.cpp index def074399ee..652345abce5 100644 --- a/mythtv/libs/libmythtv/channelscan/scanmonitor.cpp +++ b/mythtv/libs/libmythtv/channelscan/scanmonitor.cpp @@ -67,14 +67,14 @@ QEvent::Type ScannerEvent::SetStatusChannelTuned = void post_event(QObject *dest, QEvent::Type type, int val) { - ScannerEvent *e = new ScannerEvent(type); + auto *e = new ScannerEvent(type); e->intValue(val); QCoreApplication::postEvent(dest, e); } void post_event(QObject *dest, QEvent::Type type, const QString &val) { - ScannerEvent *e = new ScannerEvent(type); + auto *e = new ScannerEvent(type); e->strValue(val); QCoreApplication::postEvent(dest, e); } @@ -82,7 +82,7 @@ void post_event(QObject *dest, QEvent::Type type, const QString &val) void post_event(QObject *dest, QEvent::Type type, int val, Configurable *spp) { - ScannerEvent *e = new ScannerEvent(type); + auto *e = new ScannerEvent(type); e->intValue(val); e->ConfigurableValue(spp); QCoreApplication::postEvent(dest, e); @@ -162,7 +162,7 @@ void ScanMonitor::customEvent(QEvent *e) { if (m_channelScanner) { - ScannerEvent *scanEvent = dynamic_cast<ScannerEvent*>(e); + auto *scanEvent = dynamic_cast<ScannerEvent*>(e); if (scanEvent != nullptr) m_channelScanner->HandleEvent(scanEvent); } diff --git a/mythtv/libs/libmythtv/channelscan/scanwizardconfig.cpp b/mythtv/libs/libmythtv/channelscan/scanwizardconfig.cpp index 59d02ef8c58..fcada5c80d2 100644 --- a/mythtv/libs/libmythtv/channelscan/scanwizardconfig.cpp +++ b/mythtv/libs/libmythtv/channelscan/scanwizardconfig.cpp @@ -565,11 +565,11 @@ void ScanOptionalConfig::SetTuningPaneValues(uint frequency, const DTVMultiplex { pane->setInversion(mpx.m_inversion.toString()); pane->setBandwidth(mpx.m_bandwidth.toString()); - pane->setCodeRateHP(mpx.m_hp_code_rate.toString()); - pane->setCodeRateLP(mpx.m_lp_code_rate.toString()); + pane->setCodeRateHP(mpx.m_hpCodeRate.toString()); + pane->setCodeRateLP(mpx.m_lpCodeRate.toString()); pane->setConstellation(mpx.m_modulation.toString()); - pane->setTransmode(mpx.m_trans_mode.toString()); - pane->setGuardInterval(mpx.m_guard_interval.toString()); + pane->setTransmode(mpx.m_transMode.toString()); + pane->setGuardInterval(mpx.m_guardInterval.toString()); pane->setHierarchy(mpx.m_hierarchy.toString()); } } @@ -583,13 +583,13 @@ void ScanOptionalConfig::SetTuningPaneValues(uint frequency, const DTVMultiplex { pane->setInversion(mpx.m_inversion.toString()); pane->setBandwidth(mpx.m_bandwidth.toString()); - pane->setCodeRateHP(mpx.m_hp_code_rate.toString()); - pane->setCodeRateLP(mpx.m_lp_code_rate.toString()); + pane->setCodeRateHP(mpx.m_hpCodeRate.toString()); + pane->setCodeRateLP(mpx.m_lpCodeRate.toString()); pane->setConstellation(mpx.m_modulation.toString()); - pane->setTransmode(mpx.m_trans_mode.toString()); - pane->setGuardInterval(mpx.m_guard_interval.toString()); + pane->setTransmode(mpx.m_transMode.toString()); + pane->setGuardInterval(mpx.m_guardInterval.toString()); pane->setHierarchy(mpx.m_hierarchy.toString()); - pane->setModsys(mpx.m_mod_sys.toString()); + pane->setModsys(mpx.m_modSys.toString()); } } else if (st == ScanTypeSetting::FullScan_DVBC || @@ -631,7 +631,7 @@ void ScanOptionalConfig::SetTuningPaneValues(uint frequency, const DTVMultiplex pane->setFec(mpx.m_fec.toString()); pane->setPolarity(mpx.m_polarity.toString()); pane->setModulation(mpx.m_modulation.toString()); - pane->setModsys(mpx.m_mod_sys.toString()); + pane->setModsys(mpx.m_modSys.toString()); pane->setRolloff(mpx.m_rolloff.toString()); } } diff --git a/mythtv/libs/libmythtv/channelscan/vboxchannelfetcher.cpp b/mythtv/libs/libmythtv/channelscan/vboxchannelfetcher.cpp index 2609217ff7a..29c3bed0bd7 100644 --- a/mythtv/libs/libmythtv/channelscan/vboxchannelfetcher.cpp +++ b/mythtv/libs/libmythtv/channelscan/vboxchannelfetcher.cpp @@ -1,6 +1,7 @@ // Std C headers #include <cmath> #include <unistd.h> +#include <utility> // Qt headers #include <QFile> @@ -18,11 +19,11 @@ #define LOC QString("VBoxChanFetch: ") -VBoxChannelFetcher::VBoxChannelFetcher(uint cardid, const QString &inputname, uint sourceid, +VBoxChannelFetcher::VBoxChannelFetcher(uint cardid, QString inputname, uint sourceid, bool ftaOnly, ServiceRequirements serviceType, ScanMonitor *monitor) : m_scan_monitor(monitor), - m_cardid(cardid), m_inputname(inputname), + m_cardid(cardid), m_inputname(std::move(inputname)), m_sourceid(sourceid), m_ftaOnly(ftaOnly), m_serviceType(serviceType), m_thread(new MThread("VBoxChannelFetcher", this)) diff --git a/mythtv/libs/libmythtv/channelscan/vboxchannelfetcher.h b/mythtv/libs/libmythtv/channelscan/vboxchannelfetcher.h index ba94823d41d..7080f59e7e3 100644 --- a/mythtv/libs/libmythtv/channelscan/vboxchannelfetcher.h +++ b/mythtv/libs/libmythtv/channelscan/vboxchannelfetcher.h @@ -54,14 +54,14 @@ class VBoxChannelInfo uint m_networkID {0}; // Network ID from triplet uint m_transportID {0}; // Transport ID from triplet }; -typedef QMap<QString,VBoxChannelInfo> vbox_chan_map_t; +using vbox_chan_map_t = QMap<QString,VBoxChannelInfo>; class VBoxChannelFetcher : public QRunnable { Q_DECLARE_TR_FUNCTIONS(VBoxChannelFetcher); public: - VBoxChannelFetcher(uint cardid, const QString &inputname, uint sourceid, + VBoxChannelFetcher(uint cardid, QString inputname, uint sourceid, bool ftaOnly, ServiceRequirements serviceType, ScanMonitor *monitor = nullptr); ~VBoxChannelFetcher(); diff --git a/mythtv/libs/libmythtv/channelsettings.cpp b/mythtv/libs/libmythtv/channelsettings.cpp index a2a8bac9a4a..aedb05a2e18 100644 --- a/mythtv/libs/libmythtv/channelsettings.cpp +++ b/mythtv/libs/libmythtv/channelsettings.cpp @@ -1,7 +1,10 @@ +// C/C++ headers +#include <utility> + // Qt headers -#include <QWidget> -#include <QFile> #include <QCoreApplication> +#include <QFile> +#include <QWidget> // MythTV headers #include "channelsettings.h" @@ -67,7 +70,7 @@ class Source : public MythUIComboBoxSetting public: Source(const ChannelID &id, uint _default_sourceid) : MythUIComboBoxSetting(new ChannelDBStorage(this, id, "sourceid")), - default_sourceid(_default_sourceid) + m_defaultSourceId(_default_sourceid) { setLabel(QCoreApplication::translate("(Common)", "Video Source")); setHelpText(QCoreApplication::translate("(Common)", @@ -81,9 +84,9 @@ class Source : public MythUIComboBoxSetting fillSelections(); StandardSetting::Load(); - if (default_sourceid && (getValue().toUInt() == 0U)) + if (m_defaultSourceId && (getValue().toUInt() == 0U)) { - uint which = sourceid_to_index[default_sourceid]; + uint which = m_sourceIdToIndex[m_defaultSourceId]; if (which) setValue(which); } @@ -107,18 +110,18 @@ class Source : public MythUIComboBoxSetting { for (uint i = 1; query.next(); i++) { - sourceid_to_index[query.value(1).toUInt()] = i; + m_sourceIdToIndex[query.value(1).toUInt()] = i; addSelection(query.value(0).toString(), query.value(1).toString()); } } - sourceid_to_index[0] = 0; // Not selected entry. + m_sourceIdToIndex[0] = 0; // Not selected entry. } private: - uint default_sourceid; - QMap<uint,uint> sourceid_to_index; + uint m_defaultSourceId; + QMap<uint,uint> m_sourceIdToIndex; }; class Callsign : public MythUITextEditSetting @@ -251,9 +254,9 @@ class OutputFilters : public MythUITextEditSetting class XmltvID : public MythUIComboBoxSetting { public: - XmltvID(const ChannelID &id, const QString &_sourceName) : + XmltvID(const ChannelID &id, QString _sourceName) : MythUIComboBoxSetting(new ChannelDBStorage(this, id, "xmltvid"), true), - sourceName(_sourceName) + m_sourceName(std::move(_sourceName)) { setLabel(QCoreApplication::translate("(Common)", "XMLTV ID")); @@ -274,7 +277,7 @@ class XmltvID : public MythUIComboBoxSetting { clearSelections(); - QString xmltvFile = GetConfDir() + '/' + sourceName + ".xmltv"; + QString xmltvFile = GetConfDir() + '/' + m_sourceName + ".xmltv"; if (QFile::exists(xmltvFile)) { @@ -303,7 +306,7 @@ class XmltvID : public MythUIComboBoxSetting } private: - QString sourceName; + QString m_sourceName; }; class ServiceID : public MythUISpinBoxSetting @@ -504,9 +507,9 @@ ChannelOptionsCommon::ChannelOptionsCommon(const ChannelID &id, "Channel Options - Common")); addChild(new Name(id)); - Source *source = new Source(id, default_sourceid); + auto *source = new Source(id, default_sourceid); - Channum *channum = new Channum(id); + auto *channum = new Channum(id); addChild(channum); if (add_freqid) { diff --git a/mythtv/libs/libmythtv/channelsettings.h b/mythtv/libs/libmythtv/channelsettings.h index 7d092c06ee7..fdb8325f837 100644 --- a/mythtv/libs/libmythtv/channelsettings.h +++ b/mythtv/libs/libmythtv/channelsettings.h @@ -117,7 +117,7 @@ class MTV_PUBLIC ChannelOptionsCommon: public GroupSetting uint default_sourceid, bool add_freqid); public slots: - void onAirGuideChanged(bool); + static void onAirGuideChanged(bool); void sourceChanged(const QString&); protected: diff --git a/mythtv/libs/libmythtv/channelutil.cpp b/mythtv/libs/libmythtv/channelutil.cpp index e9bfa750be9..d9c87fd5229 100644 --- a/mythtv/libs/libmythtv/channelutil.cpp +++ b/mythtv/libs/libmythtv/channelutil.cpp @@ -423,11 +423,11 @@ uint ChannelUtil::CreateMultiplex(uint sourceid, const DTVMultiplex &mux, transport_id, network_id, mux.m_symbolrate, mux.m_bandwidth.toChar().toLatin1(), mux.m_polarity.toChar().toLatin1(), mux.m_inversion.toChar().toLatin1(), - mux.m_trans_mode.toChar().toLatin1(), + mux.m_transMode.toChar().toLatin1(), mux.m_fec.toString(), mux.m_modulation.toString(), - mux.m_hierarchy.toChar().toLatin1(), mux.m_hp_code_rate.toString(), - mux.m_lp_code_rate.toString(), mux.m_guard_interval.toString(), - mux.m_mod_sys.toString(), mux.m_rolloff.toString()); + mux.m_hierarchy.toChar().toLatin1(), mux.m_hpCodeRate.toString(), + mux.m_lpCodeRate.toString(), mux.m_guardInterval.toString(), + mux.m_modSys.toString(), mux.m_rolloff.toString()); } @@ -1171,17 +1171,17 @@ bool ChannelUtil::SetChannelValue(const QString &field_name, /** Returns the DVB default authority for the chanid given. */ QString ChannelUtil::GetDefaultAuthority(uint chanid) { - static QReadWriteLock channel_default_authority_map_lock; - static QMap<uint,QString> channel_default_authority_map; - static bool run_init = true; + static QReadWriteLock s_channelDefaultAuthorityMapLock; + static QMap<uint,QString> s_channelDefaultAuthorityMap; + static bool s_runInit = true; - channel_default_authority_map_lock.lockForRead(); + s_channelDefaultAuthorityMapLock.lockForRead(); - if (run_init) + if (s_runInit) { - channel_default_authority_map_lock.unlock(); - channel_default_authority_map_lock.lockForWrite(); - if (run_init) + s_channelDefaultAuthorityMapLock.unlock(); + s_channelDefaultAuthorityMapLock.lockForWrite(); + if (s_runInit) { MSqlQuery query(MSqlQuery::InitCon()); query.prepare( @@ -1196,11 +1196,11 @@ QString ChannelUtil::GetDefaultAuthority(uint chanid) { if (!query.value(1).toString().isEmpty()) { - channel_default_authority_map[query.value(0).toUInt()] = + s_channelDefaultAuthorityMap[query.value(0).toUInt()] = query.value(1).toString(); } } - run_init = false; + s_runInit = false; } else { @@ -1217,11 +1217,11 @@ QString ChannelUtil::GetDefaultAuthority(uint chanid) { if (!query.value(1).toString().isEmpty()) { - channel_default_authority_map[query.value(0).toUInt()] = + s_channelDefaultAuthorityMap[query.value(0).toUInt()] = query.value(1).toString(); } } - run_init = false; + s_runInit = false; } else { @@ -1231,60 +1231,60 @@ QString ChannelUtil::GetDefaultAuthority(uint chanid) } } - QMap<uint,QString>::iterator it = channel_default_authority_map.find(chanid); + QMap<uint,QString>::iterator it = s_channelDefaultAuthorityMap.find(chanid); QString ret; - if (it != channel_default_authority_map.end()) + if (it != s_channelDefaultAuthorityMap.end()) ret = *it; - channel_default_authority_map_lock.unlock(); + s_channelDefaultAuthorityMapLock.unlock(); return ret; } QString ChannelUtil::GetIcon(uint chanid) { - static QReadWriteLock channel_icon_map_lock; - static QHash<uint,QString> channel_icon_map; - static bool run_init = true; + static QReadWriteLock s_channelIconMapLock; + static QHash<uint,QString> s_channelIconMap; + static bool s_runInit = true; - channel_icon_map_lock.lockForRead(); + s_channelIconMapLock.lockForRead(); - QString ret(channel_icon_map.value(chanid, "_cold_")); + QString ret(s_channelIconMap.value(chanid, "_cold_")); - channel_icon_map_lock.unlock(); + s_channelIconMapLock.unlock(); if (ret != "_cold_") return ret; - channel_icon_map_lock.lockForWrite(); + s_channelIconMapLock.lockForWrite(); MSqlQuery query(MSqlQuery::InitCon()); QString iconquery = "SELECT chanid, icon FROM channel"; - if (run_init) + if (s_runInit) iconquery += " WHERE visible = 1"; else iconquery += " WHERE chanid = :CHANID"; query.prepare(iconquery); - if (!run_init) + if (!s_runInit) query.bindValue(":CHANID", chanid); if (query.exec()) { - if (run_init) + if (s_runInit) { - channel_icon_map.reserve(query.size()); + s_channelIconMap.reserve(query.size()); while (query.next()) { - channel_icon_map[query.value(0).toUInt()] = + s_channelIconMap[query.value(0).toUInt()] = query.value(1).toString(); } - run_init = false; + s_runInit = false; } else { - channel_icon_map[chanid] = (query.next()) ? + s_channelIconMap[chanid] = (query.next()) ? query.value(1).toString() : ""; } } @@ -1293,9 +1293,9 @@ QString ChannelUtil::GetIcon(uint chanid) MythDB::DBError("GetIcon", query); } - ret = channel_icon_map.value(chanid, ""); + ret = s_channelIconMap.value(chanid, ""); - channel_icon_map_lock.unlock(); + s_channelIconMapLock.unlock(); return ret; } @@ -2164,8 +2164,8 @@ inline bool lt_callsign(const ChannelInfo &a, const ChannelInfo &b) inline bool lt_smart(const ChannelInfo &a, const ChannelInfo &b) { - static QMutex sepExprLock; - static const QRegExp sepExpr(ChannelUtil::kATSCSeparators); + static QMutex s_sepExprLock; + static const QRegExp kSepExpr(ChannelUtil::kATSCSeparators); bool isIntA, isIntB; int a_int = a.m_channum.toUInt(&isIntA); @@ -2179,9 +2179,9 @@ inline bool lt_smart(const ChannelInfo &a, const ChannelInfo &b) bool tmp1, tmp2; int idxA, idxB; { - QMutexLocker locker(&sepExprLock); - idxA = a.m_channum.indexOf(sepExpr); - idxB = b.m_channum.indexOf(sepExpr); + QMutexLocker locker(&s_sepExprLock); + idxA = a.m_channum.indexOf(kSepExpr); + idxB = b.m_channum.indexOf(kSepExpr); } if (idxA >= 0) { @@ -2335,8 +2335,7 @@ uint ChannelUtil::GetNextChannel( bool skip_non_visible, bool skip_same_channum_and_callsign) { - ChannelInfoList::const_iterator it = - find(sorted.begin(), sorted.end(), old_chanid); + auto it = find(sorted.cbegin(), sorted.cend(), old_chanid); if (it == sorted.end()) it = sorted.begin(); // not in list, pretend we are on first channel @@ -2344,7 +2343,7 @@ uint ChannelUtil::GetNextChannel( if (it == sorted.end()) return 0; // no channels.. - ChannelInfoList::const_iterator start = it; + auto start = it; if (CHANNEL_DIRECTION_DOWN == direction) { diff --git a/mythtv/libs/libmythtv/channelutil.h b/mythtv/libs/libmythtv/channelutil.h index 6d30ba2f5ee..f17c1867631 100644 --- a/mythtv/libs/libmythtv/channelutil.h +++ b/mythtv/libs/libmythtv/channelutil.h @@ -40,7 +40,7 @@ class pid_cache_item_t uint m_pid {0}; uint m_sid_tid {0}; }; -typedef vector<pid_cache_item_t> pid_cache_t; +using pid_cache_t = vector<pid_cache_item_t>; /** \class ChannelUtil * \brief Collection of helper utilities for channel DB use diff --git a/mythtv/libs/libmythtv/dbcheck.cpp b/mythtv/libs/libmythtv/dbcheck.cpp index 6a741b82761..b81ebd53904 100644 --- a/mythtv/libs/libmythtv/dbcheck.cpp +++ b/mythtv/libs/libmythtv/dbcheck.cpp @@ -2823,7 +2823,7 @@ nullptr while (query.next()) { int recordingID = query.value(0).toInt(); - RecordingInfo *recInfo = new RecordingInfo(recordingID); + auto *recInfo = new RecordingInfo(recordingID); RecordingFile *recFile = recInfo->GetRecordingFile(); recFile->m_fileName = recInfo->GetBasename(); recFile->m_fileSize = recInfo->GetFilesize(); @@ -3595,7 +3595,7 @@ nullptr if (olddecoder == "vaapi2") newdecoder = "vaapi"; - auto UpdateDeinterlacer = [](QString Olddeint, QString &Newdeint, QString Decoder) + auto UpdateDeinterlacer = [](const QString &Olddeint, QString &Newdeint, const QString &Decoder) { if (Olddeint.isEmpty()) { @@ -3642,7 +3642,7 @@ nullptr UpdateDeinterlacer(olddeint0, newdeint0, decoder); UpdateDeinterlacer(olddeint1, newdeint1, decoder); - auto UpdateData = [](uint ProfileID, QString Value, QString Data) + auto UpdateData = [](uint ProfileID, const QString &Value, const QString &Data) { MSqlQuery update(MSqlQuery::InitCon()); update.prepare( diff --git a/mythtv/libs/libmythtv/decoders/avformatdecoder.cpp b/mythtv/libs/libmythtv/decoders/avformatdecoder.cpp index 45bd79ad401..a802e8f75c3 100644 --- a/mythtv/libs/libmythtv/decoders/avformatdecoder.cpp +++ b/mythtv/libs/libmythtv/decoders/avformatdecoder.cpp @@ -124,11 +124,11 @@ static float get_aspect(const AVCodecContext &ctx) } static float get_aspect(H264Parser &p) { - static const float default_aspect = 4.0F / 3.0F; + static constexpr float kDefaultAspect = 4.0F / 3.0F; int asp = p.aspectRatio(); switch (asp) { - case 0: return default_aspect; + case 0: return kDefaultAspect; case 2: return 4.0F / 3.0F; case 3: return 16.0F / 9.0F; case 4: return 2.21F; @@ -145,7 +145,7 @@ static float get_aspect(H264Parser &p) } else { - aspect_ratio = default_aspect; + aspect_ratio = kDefaultAspect; } } return aspect_ratio; @@ -239,9 +239,9 @@ static void myth_av_log(void *ptr, int level, const char* fmt, va_list vl) if (VERBOSE_LEVEL_NONE) return; - static QString full_line(""); - static const int msg_len = 255; - static QMutex string_lock; + static QString s_fullLine(""); + static constexpr int kMsgLen = 255; + static QMutex s_stringLock; uint64_t verbose_mask = VB_LIBAV; LogLevel_t verbose_level = LOG_EMERG; @@ -277,33 +277,33 @@ static void myth_av_log(void *ptr, int level, const char* fmt, va_list vl) if (!VERBOSE_LEVEL_CHECK(verbose_mask, verbose_level)) return; - string_lock.lock(); - if (full_line.isEmpty() && ptr) { + s_stringLock.lock(); + if (s_fullLine.isEmpty() && ptr) { AVClass* avc = *(AVClass**)ptr; - full_line = QString("[%1 @ %2] ") + s_fullLine = QString("[%1 @ %2] ") .arg(avc->item_name(ptr)) .arg((quintptr)avc, QT_POINTER_SIZE * 2, 16, QChar('0')); } - char str[msg_len+1]; - int bytes = vsnprintf(str, msg_len+1, fmt, vl); + char str[kMsgLen+1]; + int bytes = vsnprintf(str, kMsgLen+1, fmt, vl); // check for truncated messages and fix them - if (bytes > msg_len) + if (bytes > kMsgLen) { LOG(VB_GENERAL, LOG_WARNING, QString("Libav log output truncated %1 of %2 bytes written") - .arg(msg_len).arg(bytes)); - str[msg_len-1] = '\n'; + .arg(kMsgLen).arg(bytes)); + str[kMsgLen-1] = '\n'; } - full_line += QString(str); - if (full_line.endsWith("\n")) + s_fullLine += QString(str); + if (s_fullLine.endsWith("\n")) { - LOG(verbose_mask, verbose_level, full_line.trimmed()); - full_line.truncate(0); + LOG(verbose_mask, verbose_level, s_fullLine.trimmed()); + s_fullLine.truncate(0); } - string_lock.unlock(); + s_stringLock.unlock(); } static int get_canonical_lang(const char *lang_cstr) @@ -350,7 +350,7 @@ AvFormatDecoder::AvFormatDecoder(MythPlayer *parent, av_log_set_callback(myth_av_log); - m_audioIn.sample_size = -32; // force SetupAudioStream to run once + m_audioIn.m_sampleSize = -32;// force SetupAudioStream to run once m_itv = m_parent->GetInteractiveTV(); cc608_build_parity_table(m_cc608_parity_table); @@ -523,7 +523,7 @@ int AvFormatDecoder::GetCurrentChapter(long long framesPlayed) int64_t start = m_ic->chapters[i]->start; long double total_secs = (long double)start * (long double)num / (long double)den; - long long framenum = (long long)(total_secs * m_fps); + auto framenum = (long long)(total_secs * m_fps); if (framesPlayed >= framenum) { LOG(VB_PLAYBACK, LOG_INFO, LOC + @@ -545,7 +545,7 @@ long long AvFormatDecoder::GetChapter(int chapter) int64_t start = m_ic->chapters[chapter - 1]->start; long double total_secs = (long double)start * (long double)num / (long double)den; - long long framenum = (long long)(total_secs * m_fps); + auto framenum = (long long)(total_secs * m_fps); LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("GetChapter %1: framenum %2") .arg(chapter).arg(framenum)); return framenum; @@ -898,7 +898,7 @@ void AvFormatDecoder::InitByteContext(bool forceseek) m_readcontext.is_streamed = streamed; m_readcontext.max_packet_size = 0; m_readcontext.priv_data = m_avfRingBuffer; - unsigned char* buffer = (unsigned char *)av_malloc(buf_size); + auto *buffer = (unsigned char *)av_malloc(buf_size); m_ic->pb = avio_alloc_context(buffer, buf_size, 0, &m_readcontext, AVFRingBuffer::AVF_Read_Packet, @@ -913,8 +913,7 @@ void AvFormatDecoder::InitByteContext(bool forceseek) extern "C" void HandleStreamChange(void *data) { - AvFormatDecoder *decoder = - reinterpret_cast<AvFormatDecoder*>(data); + auto *decoder = reinterpret_cast<AvFormatDecoder*>(data); int cnt = decoder->m_ic->nb_streams; @@ -1257,7 +1256,7 @@ int AvFormatDecoder::OpenFile(RingBuffer *rbuffer, bool novideo, int minutes = ((int)total_secs / 60) - (hours * 60); double secs = (double)total_secs - (double)(hours * 60 * 60 + minutes * 60); - long long framenum = (long long)(total_secs * m_fps); + auto framenum = (long long)(total_secs * m_fps); LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Chapter %1 found @ [%2:%3:%4]->%5") .arg(QString().sprintf("%02d", i + 1)) @@ -2403,13 +2402,13 @@ int AvFormatDecoder::ScanStreams(bool novideo) if (tvformat == "ntsc" || tvformat == "ntsc-jp" || tvformat == "pal-m" || tvformat == "atsc") { - m_fps = 29.97f; - m_parent->SetVideoParams(-1, -1, 29.97, 1.0f, false, 16); + m_fps = 29.97F; + m_parent->SetVideoParams(-1, -1, 29.97, 1.0F, false, 16); } else { - m_fps = 25.0; - m_parent->SetVideoParams(-1, -1, 25.0, 1.0f, false, 16); + m_fps = 25.0F; + m_parent->SetVideoParams(-1, -1, 25.0, 1.0F, false, 16); } } @@ -2491,7 +2490,7 @@ int AvFormatDecoder::GetSubtitleLanguage(uint subtitle_index, uint stream_index) } /// Return ATSC Closed Caption Language -int AvFormatDecoder::GetCaptionLanguage(TrackTypes trackType, int service_num) +int AvFormatDecoder::GetCaptionLanguage(TrackType trackType, int service_num) { int ret = -1; for (uint i = 0; i < (uint) m_pmt_track_types.size(); i++) @@ -2581,7 +2580,7 @@ void AvFormatDecoder::SetupAudioStreamSubIndexes(int streamIndex) QMutexLocker locker(avcodeclock); // Find the position of the streaminfo in m_tracks[kTrackTypeAudio] - sinfo_vec_t::iterator current = m_tracks[kTrackTypeAudio].begin(); + auto current = m_tracks[kTrackTypeAudio].begin(); for (; current != m_tracks[kTrackTypeAudio].end(); ++current) { if (current->m_av_stream_index == streamIndex) @@ -2598,7 +2597,7 @@ void AvFormatDecoder::SetupAudioStreamSubIndexes(int streamIndex) } // Remove the extra substream or duplicate the current substream - sinfo_vec_t::iterator next = current + 1; + auto next = current + 1; if (current->m_av_substream_index == -1) { // Split stream in two (Language I + Language II) @@ -2658,7 +2657,7 @@ void AvFormatDecoder::RemoveAudioStreams() int get_avf_buffer(struct AVCodecContext *c, AVFrame *pic, int flags) { - AvFormatDecoder *decoder = static_cast<AvFormatDecoder*>(c->opaque); + auto *decoder = static_cast<AvFormatDecoder*>(c->opaque); VideoFrameType type = PixelFormatToFrameType(c->pix_fmt); VideoFrameType* supported = decoder->GetPlayer()->DirectRenderFormats(); bool found = false; @@ -2710,8 +2709,8 @@ int get_avf_buffer(struct AVCodecContext *c, AVFrame *pic, int flags) AVBufferRef *buffer = av_buffer_create(reinterpret_cast<uint8_t*>(frame), 0, [](void* Opaque, uint8_t* Data) { - AvFormatDecoder *avfd = static_cast<AvFormatDecoder*>(Opaque); - VideoFrame *vf = reinterpret_cast<VideoFrame*>(Data); + auto *avfd = static_cast<AvFormatDecoder*>(Opaque); + auto *vf = reinterpret_cast<VideoFrame*>(Data); if (avfd && avfd->GetPlayer()) avfd->GetPlayer()->DeLimboFrame(vf); } @@ -3049,8 +3048,7 @@ void AvFormatDecoder::MpegPreProcessPkt(AVStream *stream, AVPacket *pkt) { if (bufptr + 11 >= pkt->data + pkt->size) continue; // not enough valid data... - SequenceHeader *seq = reinterpret_cast<SequenceHeader*>( - const_cast<uint8_t*>(bufptr)); + const auto *seq = reinterpret_cast<const SequenceHeader*>(bufptr); int width = static_cast<int>(seq->width()) >> context->lowres; int height = static_cast<int>(seq->height()) >> context->lowres; @@ -3067,7 +3065,7 @@ void AvFormatDecoder::MpegPreProcessPkt(AVStream *stream, AVPacket *pkt) // some hardware decoders (e.g. VAAPI MPEG2) will reset when the aspect // ratio changes - bool forceaspectchange = !qFuzzyCompare(m_current_aspect + 10.0f, aspect + 10.0f) && + bool forceaspectchange = !qFuzzyCompare(m_current_aspect + 10.0F, aspect + 10.0F) && m_mythcodecctx && m_mythcodecctx->DecoderWillResetOnAspect(); m_current_aspect = aspect; @@ -3179,7 +3177,7 @@ int AvFormatDecoder::H264PreProcessPkt(AVStream *stream, AVPacket *pkt) bool res_changed = ((width != m_current_width) || (height != m_current_height)); bool fps_changed = (seqFPS > 0.0) && ((seqFPS > static_cast<double>(m_fps) + 0.01) || (seqFPS < static_cast<double>(m_fps) - 0.01)); - bool forcechange = !qFuzzyCompare(aspect + 10.0f, m_current_aspect) && + bool forcechange = !qFuzzyCompare(aspect + 10.0F, m_current_aspect) && m_mythcodecctx && m_mythcodecctx->DecoderWillResetOnAspect(); m_current_aspect = aspect; @@ -3214,7 +3212,7 @@ int AvFormatDecoder::H264PreProcessPkt(AVStream *stream, AVPacket *pkt) m_reordered_pts_detected = false; // fps debugging info - double avFPS = static_cast<double>(normalized_fps(stream, context)); + auto avFPS = static_cast<double>(normalized_fps(stream, context)); if ((seqFPS > avFPS + 0.01) || (seqFPS < avFPS - 0.01)) { LOG(VB_PLAYBACK, LOG_INFO, LOC + @@ -3469,7 +3467,7 @@ bool AvFormatDecoder::ProcessVideoPacket(AVStream *curstream, AVPacket *pkt, boo { // MythTV logic expects that only one frame is processed // Save the packet for later and return. - AVPacket *newPkt = new AVPacket; + auto *newPkt = new AVPacket; memset(newPkt, 0, sizeof(AVPacket)); av_init_packet(newPkt); av_packet_ref(newPkt, pkt); @@ -3522,7 +3520,7 @@ bool AvFormatDecoder::ProcessVideoFrame(AVStream *Stream, AVFrame *AvFrame) } } - VideoFrame *frame = static_cast<VideoFrame*>(AvFrame->opaque); + auto *frame = static_cast<VideoFrame*>(AvFrame->opaque); if (frame) frame->directrendering = m_directrendering; @@ -3730,13 +3728,13 @@ void AvFormatDecoder::ProcessVBIDataPacket( return; } - static const uint min_blank = 6; + static constexpr uint kMinBlank = 6; for (uint i = 0; i < 36; i++) { if (!((linemask >> i) & 0x1)) continue; - const uint line = ((i < 18) ? i : i-18) + min_blank; + const uint line = ((i < 18) ? i : i-18) + kMinBlank; const uint field = (i<18) ? 0 : 1; const uint id2 = *buf & 0xf; switch (id2) @@ -4157,8 +4155,8 @@ static vector<int> filter_lang(const sinfo_vec_t &tracks, int lang_key, { vector<int> ret; - vector<int>::const_iterator it = ftype.begin(); - for (; it != ftype.end(); ++it) + auto it = ftype.cbegin(); + for (; it != ftype.cend(); ++it) { if ((lang_key < 0) || tracks[*it].m_language == lang_key) ret.push_back(*it); @@ -4188,8 +4186,8 @@ int AvFormatDecoder::filter_max_ch(const AVFormatContext *ic, { int selectedTrack = -1, max_seen = -1; - vector<int>::const_iterator it = fs.begin(); - for (; it != fs.end(); ++it) + auto it = fs.cbegin(); + for (; it != fs.cend(); ++it) { const int stream_index = tracks[*it].m_av_stream_index; AVCodecParameters *par = ic->streams[stream_index]->codecpar; @@ -4476,13 +4474,13 @@ static void extract_mono_channel(uint channel, AudioInfo *audioInfo, char *buffer, int bufsize) { // Only stereo -> mono (left or right) is supported - if (audioInfo->channels != 2) + if (audioInfo->m_channels != 2) return; - if (channel >= (uint)audioInfo->channels) + if (channel >= (uint)audioInfo->m_channels) return; - const uint samplesize = audioInfo->sample_size; + const uint samplesize = audioInfo->m_sampleSize; const uint samples = bufsize / samplesize; const uint halfsample = samplesize >> 1; @@ -4608,16 +4606,16 @@ bool AvFormatDecoder::ProcessAudioPacket(AVStream *curstream, AVPacket *pkt, data_size = 0; // Check if the number of channels or sampling rate have changed - if (ctx->sample_rate != m_audioOut.sample_rate || - ctx->channels != m_audioOut.channels || + if (ctx->sample_rate != m_audioOut.m_sampleRate || + ctx->channels != m_audioOut.m_channels || AudioOutputSettings::AVSampleFormatToFormat(ctx->sample_fmt, ctx->bits_per_raw_sample) != m_audioOut.format) { LOG(VB_GENERAL, LOG_INFO, LOC + "Audio stream changed"); - if (ctx->channels != m_audioOut.channels) + if (ctx->channels != m_audioOut.m_channels) { LOG(VB_GENERAL, LOG_INFO, LOC + QString("Number of audio channels changed from %1 to %2") - .arg(m_audioOut.channels).arg(ctx->channels)); + .arg(m_audioOut.m_channels).arg(ctx->channels)); } m_currentTrack[kTrackTypeAudio] = -1; m_selectedTrack[kTrackTypeAudio].m_av_stream_index = -1; @@ -4625,7 +4623,7 @@ bool AvFormatDecoder::ProcessAudioPacket(AVStream *curstream, AVPacket *pkt, AutoSelectAudioTrack(); } - if (m_audioOut.do_passthru) + if (m_audioOut.m_doPassthru) { if (!already_decoded) { @@ -4679,7 +4677,7 @@ bool AvFormatDecoder::ProcessAudioPacket(AVStream *curstream, AVPacket *pkt, long long temppts = m_lastapts; - if (audSubIdx != -1 && !m_audioOut.do_passthru) + if (audSubIdx != -1 && !m_audioOut.m_doPassthru) extract_mono_channel(audSubIdx, &m_audioOut, (char *)m_audioSamples, data_size); @@ -4687,7 +4685,7 @@ bool AvFormatDecoder::ProcessAudioPacket(AVStream *curstream, AVPacket *pkt, int frames = (ctx->channels <= 0 || decoded_size < 0 || !samplesize) ? -1 : decoded_size / (ctx->channels * samplesize); m_audio->AddAudioData((char *)m_audioSamples, data_size, temppts, frames); - if (m_audioOut.do_passthru && !m_audio->NeedDecodingBeforePassthrough()) + if (m_audioOut.m_doPassthru && !m_audio->NeedDecodingBeforePassthrough()) { m_lastapts += m_audio->LengthLastData(); } @@ -5279,8 +5277,8 @@ bool AvFormatDecoder::SetupAudioStream(void) m_audio->SetAudioParams(m_audioOut.format, ctx->channels, requested_channels, - m_audioOut.codec_id, m_audioOut.sample_rate, - m_audioOut.do_passthru, m_audioOut.codec_profile); + m_audioOut.m_codecId, m_audioOut.m_sampleRate, + m_audioOut.m_doPassthru, m_audioOut.m_codecProfile); m_audio->ReinitAudio(); AudioOutput *audioOutput = m_audio->GetAudioOutput(); if (audioOutput) @@ -5320,12 +5318,12 @@ bool AvFormatDecoder::SetupAudioStream(void) lcd->setAudioFormatLEDs(audio_format, true); - if (m_audioOut.do_passthru) + if (m_audioOut.m_doPassthru) lcd->setVariousLEDs(VARIOUS_SPDIF, true); else lcd->setVariousLEDs(VARIOUS_SPDIF, false); - switch (m_audioIn.channels) + switch (m_audioIn.m_channels) { case 0: /* nb: aac and mp3 seem to be coming up 0 here, may point to an diff --git a/mythtv/libs/libmythtv/decoders/avformatdecoder.h b/mythtv/libs/libmythtv/decoders/avformatdecoder.h index c6206b64bb7..83d532f7227 100644 --- a/mythtv/libs/libmythtv/decoders/avformatdecoder.h +++ b/mythtv/libs/libmythtv/decoders/avformatdecoder.h @@ -46,40 +46,40 @@ extern "C" void HandleBDStreamChange(void*); class AudioInfo { public: - AudioInfo() : - codec_id(AV_CODEC_ID_NONE), format(FORMAT_NONE), sample_size(-2), - sample_rate(-1), channels(-1), codec_profile(0), - do_passthru(false), original_channels(-1) - {;} + AudioInfo() = default; AudioInfo(AVCodecID id, AudioFormat fmt, int sr, int ch, bool passthru, int original_ch, int profile = 0) : - codec_id(id), format(fmt), - sample_size(ch * AudioOutputSettings::SampleSize(fmt)), - sample_rate(sr), channels(ch), codec_profile(profile), - do_passthru(passthru), original_channels(original_ch) + m_codecId(id), format(fmt), + m_sampleSize(ch * AudioOutputSettings::SampleSize(fmt)), + m_sampleRate(sr), m_channels(ch), m_codecProfile(profile), + m_doPassthru(passthru), m_originalChannels(original_ch) { } - AVCodecID codec_id; - AudioFormat format; - int sample_size, sample_rate, channels, codec_profile; - bool do_passthru; - int original_channels; + AVCodecID m_codecId {AV_CODEC_ID_NONE}; + AudioFormat format {FORMAT_NONE}; + int m_sampleSize {-2}; + int m_sampleRate {-1}; + int m_channels {-1}; + int m_codecProfile {0}; + bool m_doPassthru {false}; + int m_originalChannels {-1}; + bool operator==(const AudioInfo &o) const { - return (codec_id==o.codec_id && channels==o.channels && - sample_size==o.sample_size && sample_rate==o.sample_rate && - format==o.format && do_passthru==o.do_passthru && - original_channels==o.original_channels && - codec_profile == o.codec_profile); + return (m_codecId==o.m_codecId && m_channels==o.m_channels && + m_sampleSize==o.m_sampleSize && m_sampleRate==o.m_sampleRate && + format==o.format && m_doPassthru==o.m_doPassthru && + m_originalChannels==o.m_originalChannels && + m_codecProfile == o.m_codecProfile); } QString toString() const { return QString("id(%1) %2Hz %3ch %4bps %5 (profile %6)") - .arg(ff_codec_id_string(codec_id),4).arg(sample_rate,6) - .arg(channels,2).arg(AudioOutputSettings::FormatToBits(format),2) - .arg((do_passthru) ? "pt":"",3).arg(codec_profile); + .arg(ff_codec_id_string(m_codecId),4).arg(m_sampleRate,6) + .arg(m_channels,2).arg(AudioOutputSettings::FormatToBits(format),2) + .arg((m_doPassthru) ? "pt":"",3).arg(m_codecProfile); } }; @@ -180,7 +180,7 @@ class AvFormatDecoder : public DecoderBase // Stream language info virtual int GetTeletextLanguage(uint lang_idx) const; virtual int GetSubtitleLanguage(uint subtitle_index, uint stream_index); - virtual int GetCaptionLanguage(TrackTypes trackType, int service_num); + virtual int GetCaptionLanguage(TrackType trackType, int service_num); virtual int GetAudioLanguage(uint audio_index, uint stream_index); virtual AudioTrackType GetAudioTrackType(uint stream_index); @@ -251,8 +251,8 @@ class AvFormatDecoder : public DecoderBase bool GenerateDummyVideoFrames(void); bool HasVideo(const AVFormatContext *ic); float normalized_fps(AVStream *stream, AVCodecContext *enc); - void av_update_stream_timings_video(AVFormatContext *ic); - bool OpenAVCodec(AVCodecContext *avctx, const AVCodec *codec); + static void av_update_stream_timings_video(AVFormatContext *ic); + static bool OpenAVCodec(AVCodecContext *avctx, const AVCodec *codec); void UpdateFramesPlayed(void) override; // DecoderBase bool DoRewindSeek(long long desiredFrame) override; // DecoderBase diff --git a/mythtv/libs/libmythtv/decoders/decoderbase.cpp b/mythtv/libs/libmythtv/decoders/decoderbase.cpp index cd4fee480a1..870d702f378 100644 --- a/mythtv/libs/libmythtv/decoders/decoderbase.cpp +++ b/mythtv/libs/libmythtv/decoders/decoderbase.cpp @@ -420,7 +420,7 @@ bool DecoderBase::FindPosition(long long desired_value, bool search_adjusted, { QMutexLocker locker(&m_positionMapLock); // Binary search - long long size = (long long) m_positionMap.size(); + auto size = (long long) m_positionMap.size(); long long lower = -1; long long upper = size; diff --git a/mythtv/libs/libmythtv/decoders/decoderbase.h b/mythtv/libs/libmythtv/decoders/decoderbase.h index 5038d1be6dc..5f730a73d6c 100644 --- a/mythtv/libs/libmythtv/decoders/decoderbase.h +++ b/mythtv/libs/libmythtv/decoders/decoderbase.h @@ -23,7 +23,7 @@ class MythCodecContext; const int kDecoderProbeBufferSize = 256 * 1024; /// Track types -typedef enum TrackTypes +enum TrackType { kTrackTypeUnknown = 0, kTrackTypeAudio, // 1 @@ -40,19 +40,19 @@ typedef enum TrackTypes // is used when auto-selecting the correct tracks to decode according to // language, bitrate etc kTrackTypeTextSubtitle, // 11 -} TrackType; +}; QString toString(TrackType type); int to_track_type(const QString &str); -typedef enum DecodeTypes +enum DecodeType { kDecodeNothing = 0x00, // Demux and preprocess only. kDecodeVideo = 0x01, kDecodeAudio = 0x02, kDecodeAV = 0x03, -} DecodeType; +}; -typedef enum AudioTrackType +enum AudioTrackType { kAudioTypeNormal = 0, kAudioTypeAudioDescription, // Audio Description for the visually impaired @@ -60,16 +60,16 @@ typedef enum AudioTrackType kAudioTypeHearingImpaired, // Greater contrast between dialog and background audio kAudioTypeSpokenSubs, // Spoken subtitles for the visually impaired kAudioTypeCommentary // Director/actor/etc Commentary -} AudioTrackType; +}; QString toString(AudioTrackType type); // Eof States -typedef enum +enum EofState { kEofStateNone, // no eof kEofStateDelayed, // decoder eof, but let player drain buffered frames kEofStateImmediate // true eof -} EofState; +}; class StreamInfo { @@ -108,7 +108,7 @@ class StreamInfo return (this->m_stream_id < b.m_stream_id); } }; -typedef vector<StreamInfo> sinfo_vec_t; +using sinfo_vec_t = vector<StreamInfo>; inline AVRational AVRationalInit(int num, int den = 1) { AVRational result; @@ -282,12 +282,12 @@ class DecoderBase long long GetLastFrameInPosMap(void) const; unsigned long GetPositionMapSize(void) const; - typedef struct posmapentry + struct PosMapEntry { long long index; // frame or keyframe number long long adjFrame; // keyFrameAdjustTable adjusted frame number long long pos; // position in stream - } PosMapEntry; + }; long long GetKey(const PosMapEntry &entry) const; MythPlayer *m_parent {nullptr}; diff --git a/mythtv/libs/libmythtv/decoders/mythcodeccontext.cpp b/mythtv/libs/libmythtv/decoders/mythcodeccontext.cpp index c429bd9c525..4b414526379 100644 --- a/mythtv/libs/libmythtv/decoders/mythcodeccontext.cpp +++ b/mythtv/libs/libmythtv/decoders/mythcodeccontext.cpp @@ -266,7 +266,7 @@ void MythCodecContext::InitVideoCodec(AVCodecContext *Context, /// \brief A generic hardware buffer initialisation method when using AVHWFramesContext. int MythCodecContext::GetBuffer(struct AVCodecContext *Context, AVFrame *Frame, int Flags) { - AvFormatDecoder *avfd = static_cast<AvFormatDecoder*>(Context->opaque); + auto *avfd = static_cast<AvFormatDecoder*>(Context->opaque); VideoFrame *videoframe = avfd->GetPlayer()->GetNextVideoFrame(); // set fields required for directrendering @@ -286,7 +286,7 @@ int MythCodecContext::GetBuffer(struct AVCodecContext *Context, AVFrame *Frame, // set the underlying pixel format. Set here rather than guessing later. if (Frame->hw_frames_ctx) { - AVHWFramesContext *context = reinterpret_cast<AVHWFramesContext*>(Frame->hw_frames_ctx->data); + auto *context = reinterpret_cast<AVHWFramesContext*>(Frame->hw_frames_ctx->data); if (context) videoframe->sw_pix_fmt = context->sw_format; } @@ -316,12 +316,12 @@ int MythCodecContext::GetBuffer(struct AVCodecContext *Context, AVFrame *Frame, /// \brief A generic hardware buffer initialisation method when AVHWFramesContext is NOT used. bool MythCodecContext::GetBuffer2(struct AVCodecContext *Context, VideoFrame* Frame, - AVFrame *AvFrame, int) + AVFrame *AvFrame, int /*Flags*/) { if (!AvFrame || !Context || !Frame) return false; - AvFormatDecoder *avfd = static_cast<AvFormatDecoder*>(Context->opaque); + auto *avfd = static_cast<AvFormatDecoder*>(Context->opaque); Frame->pix_fmt = Context->pix_fmt; Frame->directrendering = 1; @@ -333,7 +333,7 @@ bool MythCodecContext::GetBuffer2(struct AVCodecContext *Context, VideoFrame* Fr // retrieve the software format if (AvFrame->hw_frames_ctx) { - AVHWFramesContext *context = reinterpret_cast<AVHWFramesContext*>(AvFrame->hw_frames_ctx->data); + auto *context = reinterpret_cast<AVHWFramesContext*>(AvFrame->hw_frames_ctx->data); if (context) Frame->sw_pix_fmt = context->sw_format; } @@ -346,7 +346,7 @@ bool MythCodecContext::GetBuffer2(struct AVCodecContext *Context, VideoFrame* Fr Frame->priv[0] = reinterpret_cast<unsigned char*>(av_buffer_ref(AvFrame->buf[0])); // Retrieve and set the interop class - AVHWDeviceContext *devicectx = reinterpret_cast<AVHWDeviceContext*>(Context->hw_device_ctx->data); + auto *devicectx = reinterpret_cast<AVHWDeviceContext*>(Context->hw_device_ctx->data); Frame->priv[1] = reinterpret_cast<unsigned char*>(devicectx->user_opaque); // Set release method @@ -357,17 +357,17 @@ bool MythCodecContext::GetBuffer2(struct AVCodecContext *Context, VideoFrame* Fr void MythCodecContext::ReleaseBuffer(void *Opaque, uint8_t *Data) { - AvFormatDecoder *decoder = static_cast<AvFormatDecoder*>(Opaque); - VideoFrame *frame = reinterpret_cast<VideoFrame*>(Data); + auto *decoder = static_cast<AvFormatDecoder*>(Opaque); + auto *frame = reinterpret_cast<VideoFrame*>(Data); if (decoder && decoder->GetPlayer()) decoder->GetPlayer()->DeLimboFrame(frame); } -void MythCodecContext::DestroyInteropCallback(void *Wait, void *Interop, void*) +void MythCodecContext::DestroyInteropCallback(void *Wait, void *Interop, void* /*unused*/) { LOG(VB_PLAYBACK, LOG_INFO, LOC + "Destroy interop callback"); - QWaitCondition *wait = reinterpret_cast<QWaitCondition*>(Wait); - MythOpenGLInterop *interop = reinterpret_cast<MythOpenGLInterop*>(Interop); + auto *wait = reinterpret_cast<QWaitCondition*>(Wait); + auto *interop = reinterpret_cast<MythOpenGLInterop*>(Interop); if (interop) interop->DecrRef(); if (wait) @@ -393,7 +393,7 @@ void MythCodecContext::FramesContextFinished(AVHWFramesContext *Context) s_hwFramesContextCount--; LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("%1 frames context finished") .arg(av_hwdevice_get_type_name(Context->device_ctx->type))); - MythOpenGLInterop *interop = reinterpret_cast<MythOpenGLInterop*>(Context->user_opaque); + auto *interop = reinterpret_cast<MythOpenGLInterop*>(Context->user_opaque); if (interop) DestroyInterop(interop); } @@ -402,7 +402,7 @@ void MythCodecContext::DeviceContextFinished(AVHWDeviceContext* Context) { LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("%1 device context finished") .arg(av_hwdevice_get_type_name(Context->type))); - MythOpenGLInterop *interop = reinterpret_cast<MythOpenGLInterop*>(Context->user_opaque); + auto *interop = reinterpret_cast<MythOpenGLInterop*>(Context->user_opaque); if (interop) { DestroyInterop(interop); @@ -427,9 +427,9 @@ void MythCodecContext::DestroyInterop(MythOpenGLInterop *Interop) void MythCodecContext::CreateDecoderCallback(void *Wait, void *Context, void *Callback) { LOG(VB_PLAYBACK, LOG_INFO, LOC + "Create decoder callback"); - QWaitCondition *wait = reinterpret_cast<QWaitCondition*>(Wait); - AVCodecContext *context = reinterpret_cast<AVCodecContext*>(Context); - CreateHWDecoder callback = reinterpret_cast<CreateHWDecoder>(Callback); + auto *wait = reinterpret_cast<QWaitCondition*>(Wait); + auto *context = reinterpret_cast<AVCodecContext*>(Context); + auto callback = reinterpret_cast<CreateHWDecoder>(Callback); if (context && callback) (void)callback(context); if (wait) @@ -472,7 +472,7 @@ AVBufferRef* MythCodecContext::CreateDevice(AVHWDeviceType Type, MythOpenGLInter LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Created hardware device '%1'%2") .arg(av_hwdevice_get_type_name(Type)) .arg(Device == nullptr ? "" : QString(" (%1)").arg(Device))); - AVHWDeviceContext *context = reinterpret_cast<AVHWDeviceContext*>(result->data); + auto *context = reinterpret_cast<AVHWDeviceContext*>(result->data); if ((context->free || context->user_opaque) && !Interop) { @@ -568,7 +568,7 @@ bool MythCodecContext::RetrieveHWFrame(VideoFrame *Frame, AVFrame *AvFrame) // Dummy release method - we do not want to free the buffer temp->buf[0] = av_buffer_create(reinterpret_cast<uint8_t*>(Frame), 0, - [](void*, uint8_t*){}, this, 0); + [](void* /*unused*/, uint8_t* /*unused*/){}, this, 0); temp->width = AvFrame->width; temp->height = AvFrame->height; } diff --git a/mythtv/libs/libmythtv/decoders/mythcodeccontext.h b/mythtv/libs/libmythtv/decoders/mythcodeccontext.h index 4ebb61ac632..4db77921bda 100644 --- a/mythtv/libs/libmythtv/decoders/mythcodeccontext.h +++ b/mythtv/libs/libmythtv/decoders/mythcodeccontext.h @@ -42,7 +42,7 @@ extern "C" { #include "libavformat/avformat.h" } -typedef int (*CreateHWDecoder)(AVCodecContext *Context); +using CreateHWDecoder = int (*)(AVCodecContext *Context); class MythOpenGLInterop; class VideoDisplayProfile; diff --git a/mythtv/libs/libmythtv/decoders/mythdrmprimecontext.cpp b/mythtv/libs/libmythtv/decoders/mythdrmprimecontext.cpp index 5c617c88e45..eaba4975e6d 100644 --- a/mythtv/libs/libmythtv/decoders/mythdrmprimecontext.cpp +++ b/mythtv/libs/libmythtv/decoders/mythdrmprimecontext.cpp @@ -71,8 +71,8 @@ MythCodecID MythDRMPRIMEContext::GetSupportedCodec(AVCodecContext **Context, AVStream *Stream, uint StreamType) { - MythCodecID success = static_cast<MythCodecID>(kCodec_MPEG1_DRMPRIME + (StreamType - 1)); - MythCodecID failure = static_cast<MythCodecID>(kCodec_MPEG1 + (StreamType - 1)); + auto success = static_cast<MythCodecID>(kCodec_MPEG1_DRMPRIME + (StreamType - 1)); + auto failure = static_cast<MythCodecID>(kCodec_MPEG1 + (StreamType - 1)); // not us if (Decoder != "drmprime") diff --git a/mythtv/libs/libmythtv/decoders/mythnvdeccontext.cpp b/mythtv/libs/libmythtv/decoders/mythnvdeccontext.cpp index 6b1bb7aa23e..bc5222640f8 100644 --- a/mythtv/libs/libmythtv/decoders/mythnvdeccontext.cpp +++ b/mythtv/libs/libmythtv/decoders/mythnvdeccontext.cpp @@ -36,8 +36,8 @@ MythCodecID MythNVDECContext::GetSupportedCodec(AVCodecContext **Context, uint StreamType) { bool decodeonly = Decoder == "nvdec-dec"; - MythCodecID success = static_cast<MythCodecID>((decodeonly ? kCodec_MPEG1_NVDEC_DEC : kCodec_MPEG1_NVDEC) + (StreamType - 1)); - MythCodecID failure = static_cast<MythCodecID>(kCodec_MPEG1 + (StreamType - 1)); + auto success = static_cast<MythCodecID>((decodeonly ? kCodec_MPEG1_NVDEC_DEC : kCodec_MPEG1_NVDEC) + (StreamType - 1)); + auto failure = static_cast<MythCodecID>(kCodec_MPEG1 + (StreamType - 1)); // no brainers if (!Decoder.startsWith("nvdec") || getenv("NO_NVDEC") || !HaveNVDEC() || IsUnsupportedProfile(*Context)) @@ -81,7 +81,7 @@ MythCodecID MythNVDECContext::GetSupportedCodec(AVCodecContext **Context, { // iterate over known decoder capabilities s_NVDECLock->lock(); - vector<MythNVDECCaps>::const_iterator it = s_NVDECDecoderCaps.cbegin(); + auto it = s_NVDECDecoderCaps.cbegin(); for ( ; it != s_NVDECDecoderCaps.cend(); ++it) { if (((*it).m_codec == cudacodec) && ((*it).m_depth == depth) && ((*it).m_format == cudaformat)) @@ -183,10 +183,10 @@ int MythNVDECContext::InitialiseDecoder(AVCodecContext *Context) } // Set release method, interop and CUDA context - AVHWDeviceContext* hwdevicecontext = reinterpret_cast<AVHWDeviceContext*>(hwdeviceref->data); + auto* hwdevicecontext = reinterpret_cast<AVHWDeviceContext*>(hwdeviceref->data); hwdevicecontext->free = &MythCodecContext::DeviceContextFinished; hwdevicecontext->user_opaque = interop; - AVCUDADeviceContext *devicehwctx = reinterpret_cast<AVCUDADeviceContext*>(hwdevicecontext->hwctx); + auto *devicehwctx = reinterpret_cast<AVCUDADeviceContext*>(hwdevicecontext->hwctx); devicehwctx->cuda_ctx = interop->GetCUDAContext(); devicehwctx->stream = nullptr; @@ -221,7 +221,7 @@ int MythNVDECContext::HwDecoderInit(AVCodecContext *Context) return MythCodecContext::InitialiseDecoder2(Context, MythNVDECContext::InitialiseDecoder, "Create NVDEC decoder"); } - else if (codec_is_nvdec_dec(m_codecID)) + if (codec_is_nvdec_dec(m_codecID)) { AVBufferRef *context = MythCodecContext::CreateDevice(AV_HWDEVICE_TYPE_CUDA, nullptr, gCoreContext->GetSetting("NVDECDevice")); @@ -301,12 +301,10 @@ void MythNVDECContext::SetDeinterlacing(AVCodecContext *Context, { if (doubledeint) { - if (doublepref & DEINT_DRIVER) + if (doublepref & (DEINT_DRIVER | DEINT_CPU)) deinterlacer = doubledeint; else if (doublepref & DEINT_SHADER) other = true; - else if (doublepref & DEINT_CPU) - deinterlacer = doubledeint; } else { @@ -316,12 +314,10 @@ void MythNVDECContext::SetDeinterlacing(AVCodecContext *Context, if (!deinterlacer && !other && singledeint) { - if (singlepref & DEINT_DRIVER) + if (singlepref & (DEINT_DRIVER | DEINT_CPU)) deinterlacer = singledeint; else if (singlepref & DEINT_SHADER) { } - else if (singlepref & DEINT_CPU) - deinterlacer = singledeint; } } @@ -344,7 +340,7 @@ void MythNVDECContext::SetDeinterlacing(AVCodecContext *Context, } } -void MythNVDECContext::PostProcessFrame(AVCodecContext*, VideoFrame *Frame) +void MythNVDECContext::PostProcessFrame(AVCodecContext* /*Context*/, VideoFrame *Frame) { // Remove interlacing flags and set deinterlacer if necessary if (Frame && m_deinterlacer) @@ -357,7 +353,7 @@ void MythNVDECContext::PostProcessFrame(AVCodecContext*, VideoFrame *Frame) } } -bool MythNVDECContext::IsDeinterlacing(bool &DoubleRate, bool) +bool MythNVDECContext::IsDeinterlacing(bool &DoubleRate, bool /*unused*/) { if (m_deinterlacer != DEINT_NONE) { @@ -368,7 +364,7 @@ bool MythNVDECContext::IsDeinterlacing(bool &DoubleRate, bool) return false; } -enum AVPixelFormat MythNVDECContext::GetFormat(AVCodecContext*, const AVPixelFormat *PixFmt) +enum AVPixelFormat MythNVDECContext::GetFormat(AVCodecContext* /*Contextconst*/, const AVPixelFormat *PixFmt) { while (*PixFmt != AV_PIX_FMT_NONE) { @@ -385,7 +381,7 @@ bool MythNVDECContext::RetrieveFrame(AVCodecContext *Context, VideoFrame *Frame, return false; if (codec_is_nvdec_dec(m_codecID)) return RetrieveHWFrame(Frame, AvFrame); - else if (codec_is_nvdec(m_codecID)) + if (codec_is_nvdec(m_codecID)) return GetBuffer(Context, Frame, AvFrame, 0); return false; } @@ -396,7 +392,7 @@ bool MythNVDECContext::RetrieveFrame(AVCodecContext *Context, VideoFrame *Frame, * frame held in device (GPU) memory. There is no need to call avcodec_default_get_buffer2. */ bool MythNVDECContext::GetBuffer(struct AVCodecContext *Context, VideoFrame *Frame, - AVFrame *AvFrame, int) + AVFrame *AvFrame, int /*Flags*/) { if ((AvFrame->format != AV_PIX_FMT_CUDA) || !AvFrame->data[0]) { @@ -407,7 +403,7 @@ bool MythNVDECContext::GetBuffer(struct AVCodecContext *Context, VideoFrame *Fra if (!Context || !Frame) return false; - AvFormatDecoder *decoder = static_cast<AvFormatDecoder*>(Context->opaque); + auto *decoder = static_cast<AvFormatDecoder*>(Context->opaque); for (int i = 0; i < 3; i++) { @@ -427,7 +423,7 @@ bool MythNVDECContext::GetBuffer(struct AVCodecContext *Context, VideoFrame *Fra // set the pixel format - normally NV12 but P010 for 10bit etc. Set here rather than guessing later. if (AvFrame->hw_frames_ctx) { - AVHWFramesContext *context = reinterpret_cast<AVHWFramesContext*>(AvFrame->hw_frames_ctx->data); + auto *context = reinterpret_cast<AVHWFramesContext*>(AvFrame->hw_frames_ctx->data); if (context) Frame->sw_pix_fmt = context->sw_format; } @@ -465,21 +461,21 @@ MythNVDECContext::MythNVDECCaps::MythNVDECCaps(cudaVideoCodec Codec, uint Depth, bool MythNVDECContext::HaveNVDEC(void) { QMutexLocker locker(s_NVDECLock); - static bool checked = false; - if (!checked) + static bool s_checked = false; + if (!s_checked) { if (gCoreContext->IsUIThread()) NVDECCheck(); else MythMainWindow::HandleCallback("NVDEC support check", MythNVDECContext::NVDECCheckCallback, nullptr, nullptr); } - checked = true; + s_checked = true; return s_NVDECAvailable; } -void MythNVDECContext::NVDECCheckCallback(void *Wait, void*, void*) +void MythNVDECContext::NVDECCheckCallback(void *Wait, void* /*unused*/, void* /*unused*/) { - QWaitCondition *wait = reinterpret_cast<QWaitCondition*>(Wait); + auto *wait = reinterpret_cast<QWaitCondition*>(Wait); NVDECCheck(); if (wait) wait->wakeAll(); @@ -544,12 +540,12 @@ void MythNVDECContext::NVDECCheck(void) // now iterate over codecs, depths and formats to check support for (int codec = cudaVideoCodec_MPEG1; codec < cudaVideoCodec_NumCodecs; ++codec) { - cudaVideoCodec cudacodec = static_cast<cudaVideoCodec>(codec); + auto cudacodec = static_cast<cudaVideoCodec>(codec); if (cudacodec == cudaVideoCodec_JPEG) continue; for (int format = cudaVideoChromaFormat_420; format < cudaVideoChromaFormat_444; ++format) { - cudaVideoChromaFormat cudaformat = static_cast<cudaVideoChromaFormat>(format); + auto cudaformat = static_cast<cudaVideoChromaFormat>(format); for (uint depth = 0; depth < 9; ++depth) { CUVIDDECODECAPS caps; @@ -560,7 +556,7 @@ void MythNVDECContext::NVDECCheck(void) if (cuvid->cuvidGetDecoderCaps && (cuvid->cuvidGetDecoderCaps(&caps) == CUDA_SUCCESS) && caps.bIsSupported) { - s_NVDECDecoderCaps.push_back( + s_NVDECDecoderCaps.emplace_back( MythNVDECCaps(cudacodec, depth, cudaformat, QSize(caps.nMinWidth, caps.nMinHeight), QSize(static_cast<int>(caps.nMaxWidth), static_cast<int>(caps.nMaxHeight)), @@ -575,7 +571,7 @@ void MythNVDECContext::NVDECCheck(void) else if (!cuvid->cuvidGetDecoderCaps) { // dummy - just support everything:) - s_NVDECDecoderCaps.push_back(MythNVDECCaps(cudacodec, depth, cudaformat, + s_NVDECDecoderCaps.emplace_back(MythNVDECCaps(cudacodec, depth, cudaformat, QSize(32, 32), QSize(8192, 8192), (8192 * 8192) / 256)); } diff --git a/mythtv/libs/libmythtv/decoders/mythv4l2m2mcontext.cpp b/mythtv/libs/libmythtv/decoders/mythv4l2m2mcontext.cpp index 85437a68436..f099565c757 100644 --- a/mythtv/libs/libmythtv/decoders/mythv4l2m2mcontext.cpp +++ b/mythtv/libs/libmythtv/decoders/mythv4l2m2mcontext.cpp @@ -30,10 +30,6 @@ MythV4L2M2MContext::MythV4L2M2MContext(DecoderBase *Parent, MythCodecID CodecID) { } -MythV4L2M2MContext::~MythV4L2M2MContext() -{ -} - inline uint32_t V4L2CodecType(AVCodecID Id) { switch (Id) @@ -64,8 +60,8 @@ MythCodecID MythV4L2M2MContext::GetSupportedCodec(AVCodecContext **Context, uint StreamType) { bool decodeonly = Decoder == "v4l2-dec"; - MythCodecID success = static_cast<MythCodecID>((decodeonly ? kCodec_MPEG1_V4L2_DEC : kCodec_MPEG1_V4L2) + (StreamType - 1)); - MythCodecID failure = static_cast<MythCodecID>(kCodec_MPEG1 + (StreamType - 1)); + auto success = static_cast<MythCodecID>((decodeonly ? kCodec_MPEG1_V4L2_DEC : kCodec_MPEG1_V4L2) + (StreamType - 1)); + auto failure = static_cast<MythCodecID>(kCodec_MPEG1 + (StreamType - 1)); // not us if (!Decoder.startsWith("v4l2")) @@ -136,14 +132,14 @@ void MythV4L2M2MContext::SetDecoderOptions(AVCodecContext* Context, AVCodec* Cod * AvFormatDecoder but we copy the data from the AVFrame rather than providing * our own buffer (the codec does not support direct rendering). */ -bool MythV4L2M2MContext::GetBuffer(AVCodecContext *Context, VideoFrame *Frame, AVFrame *AvFrame, int) +bool MythV4L2M2MContext::GetBuffer(AVCodecContext *Context, VideoFrame *Frame, AVFrame *AvFrame, int /*Flags*/) { // Sanity checks if (!Context || !AvFrame || !Frame) return false; // Ensure we can render this format - AvFormatDecoder *decoder = static_cast<AvFormatDecoder*>(Context->opaque); + auto *decoder = static_cast<AvFormatDecoder*>(Context->opaque); VideoFrameType type = PixelFormatToFrameType(static_cast<AVPixelFormat>(AvFrame->format)); VideoFrameType* supported = decoder->GetPlayer()->DirectRenderFormats(); bool found = false; @@ -177,11 +173,11 @@ bool MythV4L2M2MContext::GetBuffer(AVCodecContext *Context, VideoFrame *Frame, A bool MythV4L2M2MContext::HaveV4L2Codecs(AVCodecID Codec /* = AV_CODEC_ID_NONE */) { - static QVector<AVCodecID> avcodecs({AV_CODEC_ID_MPEG1VIDEO, AV_CODEC_ID_MPEG2VIDEO, - AV_CODEC_ID_MPEG4, AV_CODEC_ID_H263, - AV_CODEC_ID_H264, AV_CODEC_ID_VC1, - AV_CODEC_ID_VP8, AV_CODEC_ID_VP9, - AV_CODEC_ID_HEVC}); + static QVector<AVCodecID> s_avcodecs({AV_CODEC_ID_MPEG1VIDEO, AV_CODEC_ID_MPEG2VIDEO, + AV_CODEC_ID_MPEG4, AV_CODEC_ID_H263, + AV_CODEC_ID_H264, AV_CODEC_ID_VC1, + AV_CODEC_ID_VP8, AV_CODEC_ID_VP9, + AV_CODEC_ID_HEVC}); static bool s_needscheck = true; static QVector<AVCodecID> s_supportedV4L2Codecs; @@ -232,7 +228,7 @@ bool MythV4L2M2MContext::HaveV4L2Codecs(AVCodecID Codec /* = AV_CODEC_ID_NONE */ // check codec support QStringList debug; - foreach (AVCodecID codec, avcodecs) + foreach (AVCodecID codec, s_avcodecs) { bool found = false; uint32_t v4l2pixfmt = V4L2CodecType(codec); diff --git a/mythtv/libs/libmythtv/decoders/mythv4l2m2mcontext.h b/mythtv/libs/libmythtv/decoders/mythv4l2m2mcontext.h index 8793aa2d1a7..7f113ff2749 100644 --- a/mythtv/libs/libmythtv/decoders/mythv4l2m2mcontext.h +++ b/mythtv/libs/libmythtv/decoders/mythv4l2m2mcontext.h @@ -8,7 +8,7 @@ class MythV4L2M2MContext : public MythDRMPRIMEContext { public: MythV4L2M2MContext(DecoderBase *Parent, MythCodecID CodecID); - ~MythV4L2M2MContext() override; + ~MythV4L2M2MContext() = default; static MythCodecID GetSupportedCodec (AVCodecContext **Context, AVCodec **Codec, const QString &Decoder, diff --git a/mythtv/libs/libmythtv/decoders/mythvaapicontext.cpp b/mythtv/libs/libmythtv/decoders/mythvaapicontext.cpp index 50a87fdc7d7..a731ac067fc 100644 --- a/mythtv/libs/libmythtv/decoders/mythvaapicontext.cpp +++ b/mythtv/libs/libmythtv/decoders/mythvaapicontext.cpp @@ -128,13 +128,13 @@ inline AVPixelFormat MythVAAPIContext::FramesFormat(AVPixelFormat Format) /*! \brief Confirm whether VAAPI support is available given Decoder and Context */ MythCodecID MythVAAPIContext::GetSupportedCodec(AVCodecContext **Context, - AVCodec **, + AVCodec ** /*Codec*/, const QString &Decoder, uint StreamType) { bool decodeonly = Decoder == "vaapi-dec"; - MythCodecID success = static_cast<MythCodecID>((decodeonly ? kCodec_MPEG1_VAAPI_DEC : kCodec_MPEG1_VAAPI) + (StreamType - 1)); - MythCodecID failure = static_cast<MythCodecID>(kCodec_MPEG1 + (StreamType - 1)); + auto success = static_cast<MythCodecID>((decodeonly ? kCodec_MPEG1_VAAPI_DEC : kCodec_MPEG1_VAAPI) + (StreamType - 1)); + auto failure = static_cast<MythCodecID>(kCodec_MPEG1 + (StreamType - 1)); if (!Decoder.startsWith("vaapi") || !HaveVAAPI() || getenv("NO_VAAPI")) return failure; @@ -165,8 +165,8 @@ MythCodecID MythVAAPIContext::GetSupportedCodec(AVCodecContext **Context, // Check for ironlake decode only - which won't work due to FFmpeg frame format // constraints. May apply to other platforms. - AVHWDeviceContext *device = reinterpret_cast<AVHWDeviceContext*>(hwdevicectx->data); - AVVAAPIDeviceContext *hwctx = reinterpret_cast<AVVAAPIDeviceContext*>(device->hwctx); + auto *device = reinterpret_cast<AVHWDeviceContext*>(hwdevicectx->data); + auto *hwctx = reinterpret_cast<AVVAAPIDeviceContext*>(device->hwctx); if (decodeonly) { @@ -186,7 +186,7 @@ MythCodecID MythVAAPIContext::GetSupportedCodec(AVCodecContext **Context, VAConfigID config; if (vaCreateConfig(hwctx->display, desired, VAEntrypointVLD, nullptr, 0, &config) == VA_STATUS_SUCCESS) { - AVVAAPIHWConfig *hwconfig = reinterpret_cast<AVVAAPIHWConfig*>(av_hwdevice_hwconfig_alloc(hwdevicectx)); + auto *hwconfig = reinterpret_cast<AVVAAPIHWConfig*>(av_hwdevice_hwconfig_alloc(hwdevicectx)); hwconfig->config_id = config; AVHWFramesConstraints *constraints = av_hwdevice_get_hwframe_constraints(hwdevicectx, hwconfig); vaDestroyConfig(hwctx->display, config); @@ -204,7 +204,7 @@ MythCodecID MythVAAPIContext::GetSupportedCodec(AVCodecContext **Context, // FFmpeg checks profiles very late and never checks entrypoints. int profilecount = vaMaxNumProfiles(hwctx->display); - VAProfile *profilelist = static_cast<VAProfile*>(av_malloc_array(static_cast<size_t>(profilecount), sizeof(VAProfile))); + auto *profilelist = static_cast<VAProfile*>(av_malloc_array(static_cast<size_t>(profilecount), sizeof(VAProfile))); if (vaQueryConfigProfiles(hwctx->display, profilelist, &profilecount) == VA_STATUS_SUCCESS) { for (int i = 0; i < profilecount; ++i) @@ -222,7 +222,7 @@ MythCodecID MythVAAPIContext::GetSupportedCodec(AVCodecContext **Context, { int count = 0; int entrysize = vaMaxNumEntrypoints(hwctx->display); - VAEntrypoint *entrylist = static_cast<VAEntrypoint*>(av_malloc_array(static_cast<size_t>(entrysize), sizeof(VAEntrypoint))); + auto *entrylist = static_cast<VAEntrypoint*>(av_malloc_array(static_cast<size_t>(entrysize), sizeof(VAEntrypoint))); if (vaQueryConfigEntrypoints(hwctx->display, desired, entrylist, &count) == VA_STATUS_SUCCESS) { for (int i = 0; i < count; ++i) @@ -328,10 +328,10 @@ int MythVAAPIContext::InitialiseContext(AVCodecContext *Context) } // set hardware device context - just needs a display - AVHWDeviceContext* hwdevicecontext = reinterpret_cast<AVHWDeviceContext*>(hwdeviceref->data); + auto* hwdevicecontext = reinterpret_cast<AVHWDeviceContext*>(hwdeviceref->data); if (!hwdevicecontext || (hwdevicecontext && !hwdevicecontext->hwctx)) return -1; - AVVAAPIDeviceContext *vaapidevicectx = reinterpret_cast<AVVAAPIDeviceContext*>(hwdevicecontext->hwctx); + auto *vaapidevicectx = reinterpret_cast<AVVAAPIDeviceContext*>(hwdevicecontext->hwctx); if (!vaapidevicectx) return -1; @@ -369,8 +369,8 @@ int MythVAAPIContext::InitialiseContext(AVCodecContext *Context) // setup the frames context // the frames context now holds the reference to MythVAAPIInterop // Set the callback to ensure it is released - AVHWFramesContext* hw_frames_ctx = reinterpret_cast<AVHWFramesContext*>(Context->hw_frames_ctx->data); - AVVAAPIFramesContext* vaapi_frames_ctx = reinterpret_cast<AVVAAPIFramesContext*>(hw_frames_ctx->hwctx); + auto* hw_frames_ctx = reinterpret_cast<AVHWFramesContext*>(Context->hw_frames_ctx->data); + auto* vaapi_frames_ctx = reinterpret_cast<AVVAAPIFramesContext*>(hw_frames_ctx->hwctx); // Workarounds for specific drivers, surface formats and codecs // NV12 seems to work best across GPUs and codecs with the exception of @@ -385,7 +385,7 @@ int MythVAAPIContext::InitialiseContext(AVCodecContext *Context) if (format != VA_FOURCC_NV12) { - MythCodecID vaapiid = static_cast<MythCodecID>(kCodec_MPEG1_VAAPI + (mpeg_version(Context->codec_id) - 1)); + auto vaapiid = static_cast<MythCodecID>(kCodec_MPEG1_VAAPI + (mpeg_version(Context->codec_id) - 1)); LOG(VB_GENERAL, LOG_INFO, LOC + QString("Forcing surface format for %1 and %2 with driver '%3'") .arg(toString(vaapiid)).arg(MythOpenGLInterop::TypeToString(type)).arg(vendor)); } @@ -446,8 +446,8 @@ int MythVAAPIContext::InitialiseContext2(AVCodecContext *Context) } int referenceframes = AvFormatDecoder::GetMaxReferenceFrames(Context); - AVHWFramesContext* hw_frames_ctx = reinterpret_cast<AVHWFramesContext*>(Context->hw_frames_ctx->data); - AVVAAPIFramesContext* vaapi_frames_ctx = reinterpret_cast<AVVAAPIFramesContext*>(hw_frames_ctx->hwctx); + auto* hw_frames_ctx = reinterpret_cast<AVHWFramesContext*>(Context->hw_frames_ctx->data); + auto* vaapi_frames_ctx = reinterpret_cast<AVVAAPIFramesContext*>(hw_frames_ctx->hwctx); hw_frames_ctx->sw_format = FramesFormat(Context->sw_pix_fmt); hw_frames_ctx->format = AV_PIX_FMT_VAAPI; hw_frames_ctx->width = Context->coded_width; @@ -481,18 +481,18 @@ int MythVAAPIContext::InitialiseContext2(AVCodecContext *Context) */ bool MythVAAPIContext::HaveVAAPI(bool ReCheck /*= false*/) { - static bool havevaapi = false; - static bool checked = false; - if (checked && !ReCheck) - return havevaapi; - checked = true; + static bool s_haveVaapi = false; + static bool s_checked = false; + if (s_checked && !ReCheck) + return s_haveVaapi; + s_checked = true; AVBufferRef *context = MythCodecContext::CreateDevice(AV_HWDEVICE_TYPE_VAAPI, nullptr, gCoreContext->GetSetting("VAAPIDevice")); if (context) { - AVHWDeviceContext *hwdevice = reinterpret_cast<AVHWDeviceContext*>(context->data); - AVVAAPIDeviceContext *hwctx = reinterpret_cast<AVVAAPIDeviceContext*>(hwdevice->hwctx); + auto *hwdevice = reinterpret_cast<AVHWDeviceContext*>(context->data); + auto *hwctx = reinterpret_cast<AVVAAPIDeviceContext*>(hwdevice->hwctx); QString vendor(vaQueryVendorString(hwctx->display)); if (vendor.contains("vdpau", Qt::CaseInsensitive)) { @@ -501,7 +501,7 @@ bool MythVAAPIContext::HaveVAAPI(bool ReCheck /*= false*/) else { LOG(VB_GENERAL, LOG_INFO, LOC + "VAAPI is available"); - havevaapi = true; + s_haveVaapi = true; } av_buffer_unref(&context); } @@ -510,7 +510,7 @@ bool MythVAAPIContext::HaveVAAPI(bool ReCheck /*= false*/) LOG(VB_GENERAL, LOG_INFO, LOC + "VAAPI functionality checked failed"); } - return havevaapi; + return s_haveVaapi; } void MythVAAPIContext::InitVideoCodec(AVCodecContext *Context, bool SelectedStream, bool &DirectRendering) @@ -521,7 +521,7 @@ void MythVAAPIContext::InitVideoCodec(AVCodecContext *Context, bool SelectedStre Context->get_format = MythVAAPIContext::GetFormat; return; } - else if (codec_is_vaapi_dec(m_codecID)) + if (codec_is_vaapi_dec(m_codecID)) { Context->get_format = MythVAAPIContext::GetFormat2; DirectRendering = false; @@ -531,7 +531,7 @@ void MythVAAPIContext::InitVideoCodec(AVCodecContext *Context, bool SelectedStre MythCodecContext::InitVideoCodec(Context, SelectedStream, DirectRendering); } -bool MythVAAPIContext::RetrieveFrame(AVCodecContext*, VideoFrame *Frame, AVFrame *AvFrame) +bool MythVAAPIContext::RetrieveFrame(AVCodecContext* /*unused*/, VideoFrame *Frame, AVFrame *AvFrame) { if (AvFrame->format != AV_PIX_FMT_VAAPI) return false; @@ -625,8 +625,8 @@ void MythVAAPIContext::PostProcessFrame(AVCodecContext* Context, VideoFrame *Fra Frame->deinterlace_allowed = Frame->deinterlace_allowed & ~DEINT_DRIVER; return; } - else if (kCodec_HEVC_VAAPI_DEC == m_codecID || kCodec_VP9_VAAPI_DEC == m_codecID || - kCodec_VP8_VAAPI_DEC == m_codecID) + if (kCodec_HEVC_VAAPI_DEC == m_codecID || kCodec_VP9_VAAPI_DEC == m_codecID || + kCodec_VP8_VAAPI_DEC == m_codecID) { // enabling VPP deinterlacing with these codecs breaks decoding for some reason. // HEVC interlacing is not currently detected by FFmpeg and I can't find diff --git a/mythtv/libs/libmythtv/decoders/mythvdpaucontext.cpp b/mythtv/libs/libmythtv/decoders/mythvdpaucontext.cpp index 20200ae05b1..6f7b0c5c2e0 100644 --- a/mythtv/libs/libmythtv/decoders/mythvdpaucontext.cpp +++ b/mythtv/libs/libmythtv/decoders/mythvdpaucontext.cpp @@ -43,7 +43,7 @@ int MythVDPAUContext::InitialiseContext(AVCodecContext* Context) return -1; // Create interop - MythCodecID vdpauid = static_cast<MythCodecID>(kCodec_MPEG1_VDPAU + (mpeg_version(Context->codec_id) - 1)); + auto vdpauid = static_cast<MythCodecID>(kCodec_MPEG1_VDPAU + (mpeg_version(Context->codec_id) - 1)); MythVDPAUInterop *interop = MythVDPAUInterop::Create(render, vdpauid); if (!interop) return -1; @@ -53,7 +53,7 @@ int MythVDPAUContext::InitialiseContext(AVCodecContext* Context) if (!hwdeviceref) return -1; - AVHWDeviceContext* hwdevicecontext = reinterpret_cast<AVHWDeviceContext*>(hwdeviceref->data); + auto* hwdevicecontext = reinterpret_cast<AVHWDeviceContext*>(hwdeviceref->data); if (!hwdevicecontext || (hwdevicecontext && !hwdevicecontext->hwctx)) return -1; @@ -76,7 +76,7 @@ int MythVDPAUContext::InitialiseContext(AVCodecContext* Context) } // Add our interop class and set the callback for its release - AVHWFramesContext* hwframesctx = reinterpret_cast<AVHWFramesContext*>(Context->hw_frames_ctx->data); + auto* hwframesctx = reinterpret_cast<AVHWFramesContext*>(Context->hw_frames_ctx->data); hwframesctx->user_opaque = interop; hwframesctx->free = &MythCodecContext::FramesContextFinished; @@ -94,7 +94,7 @@ int MythVDPAUContext::InitialiseContext(AVCodecContext* Context) return res; } - AVVDPAUDeviceContext* vdpaudevicectx = static_cast<AVVDPAUDeviceContext*>(hwdevicecontext->hwctx); + auto* vdpaudevicectx = static_cast<AVVDPAUDeviceContext*>(hwdevicecontext->hwctx); if (av_vdpau_bind_context(Context, vdpaudevicectx->device, vdpaudevicectx->get_proc_address, 0) != 0) { LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to bind VDPAU context"); @@ -112,13 +112,13 @@ int MythVDPAUContext::InitialiseContext(AVCodecContext* Context) } MythCodecID MythVDPAUContext::GetSupportedCodec(AVCodecContext **Context, - AVCodec **, + AVCodec ** /*Codec*/, const QString &Decoder, uint StreamType) { bool decodeonly = Decoder == "vdpau-dec"; - MythCodecID success = static_cast<MythCodecID>((decodeonly ? kCodec_MPEG1_VDPAU_DEC : kCodec_MPEG1_VDPAU) + (StreamType - 1)); - MythCodecID failure = static_cast<MythCodecID>(kCodec_MPEG1 + (StreamType - 1)); + auto success = static_cast<MythCodecID>((decodeonly ? kCodec_MPEG1_VDPAU_DEC : kCodec_MPEG1_VDPAU) + (StreamType - 1)); + auto failure = static_cast<MythCodecID>(kCodec_MPEG1 + (StreamType - 1)); if (!Decoder.startsWith("vdpau") || getenv("NO_VDPAU") || IsUnsupportedProfile(*Context)) return failure; @@ -188,7 +188,7 @@ enum AVPixelFormat MythVDPAUContext::GetFormat2(struct AVCodecContext* Context, return AV_PIX_FMT_NONE; } -bool MythVDPAUContext::RetrieveFrame(AVCodecContext*, VideoFrame *Frame, AVFrame *AvFrame) +bool MythVDPAUContext::RetrieveFrame(AVCodecContext* /*unused*/, VideoFrame *Frame, AVFrame *AvFrame) { if (AvFrame->format != AV_PIX_FMT_VDPAU) return false; @@ -228,8 +228,8 @@ bool MythVDPAUContext::DecoderNeedsReset(AVCodecContext* Context) if (!Context->hw_frames_ctx) return false; - AVHWFramesContext* hwframesctx = reinterpret_cast<AVHWFramesContext*>(Context->hw_frames_ctx->data); - MythVDPAUInterop* interop = reinterpret_cast<MythVDPAUInterop*>(hwframesctx->user_opaque); + auto* hwframesctx = reinterpret_cast<AVHWFramesContext*>(Context->hw_frames_ctx->data); + auto* interop = reinterpret_cast<MythVDPAUInterop*>(hwframesctx->user_opaque); if (interop && interop->IsPreempted()) { m_resetRequired = true; @@ -247,7 +247,7 @@ void MythVDPAUContext::InitVideoCodec(AVCodecContext *Context, bool SelectedStre Context->slice_flags = SLICE_FLAG_CODED_ORDER | SLICE_FLAG_ALLOW_FIELD; return; } - else if (codec_is_vdpau_dechw(m_codecID)) + if (codec_is_vdpau_dechw(m_codecID)) { Context->get_format = MythVDPAUContext::GetFormat2; Context->slice_flags = SLICE_FLAG_CODED_ORDER | SLICE_FLAG_ALLOW_FIELD; diff --git a/mythtv/libs/libmythtv/decoders/mythvdpauhelper.cpp b/mythtv/libs/libmythtv/decoders/mythvdpauhelper.cpp index d7aa7146733..d73612de487 100644 --- a/mythtv/libs/libmythtv/decoders/mythvdpauhelper.cpp +++ b/mythtv/libs/libmythtv/decoders/mythvdpauhelper.cpp @@ -32,13 +32,13 @@ status = m_vdpGetProcAddress(m_device, FUNC_ID, reinterpret_cast<void **>(&(PROC bool MythVDPAUHelper::HaveVDPAU(void) { QMutexLocker locker(&gVDPAULock); - static bool checked = false; - if (checked) + static bool s_checked = false; + if (s_checked) return gVDPAUAvailable; MythVDPAUHelper vdpau; gVDPAUAvailable = vdpau.IsValid(); - checked = true; + s_checked = true; if (gVDPAUAvailable) { LOG(VB_GENERAL, LOG_INFO, LOC + "VDPAU is available"); @@ -56,9 +56,9 @@ bool MythVDPAUHelper::HaveMPEG4Decode(void) return gVDPAUMPEG4Available; } -static void vdpau_preemption_callback(VdpDevice, void* Opaque) +static void vdpau_preemption_callback(VdpDevice /*unused*/, void* Opaque) { - MythVDPAUHelper* helper = static_cast<MythVDPAUHelper*>(Opaque); + auto* helper = static_cast<MythVDPAUHelper*>(Opaque); if (helper) helper->SetPreempted(); } @@ -81,10 +81,10 @@ MythVDPAUHelper::MythVDPAUHelper(AVVDPAUDeviceContext* Context) } } -static const char* DummyGetError(VdpStatus) +static const char* DummyGetError(VdpStatus /*status*/) { - static const char dummy[] = "Unknown"; - return &dummy[0]; + static constexpr char kDummy[] = "Unknown"; + return &kDummy[0]; } MythVDPAUHelper::MythVDPAUHelper(void) @@ -417,9 +417,9 @@ void MythVDPAUHelper::MixerRender(VdpVideoMixer Mixer, VdpVideoSurface Source, VdpVideoSurface past[2] = { VDP_INVALID_HANDLE, VDP_INVALID_HANDLE }; VdpVideoSurface future[1] = { VDP_INVALID_HANDLE }; - VdpVideoSurface next = static_cast<VdpVideoSurface>(reinterpret_cast<uintptr_t>(Frames[0]->data)); - VdpVideoSurface current = static_cast<VdpVideoSurface>(reinterpret_cast<uintptr_t>(Frames[count > 1 ? 1 : 0]->data)); - VdpVideoSurface last = static_cast<VdpVideoSurface>(reinterpret_cast<uintptr_t>(Frames[count > 2 ? 2 : 0]->data)); + auto next = static_cast<VdpVideoSurface>(reinterpret_cast<uintptr_t>(Frames[0]->data)); + auto current = static_cast<VdpVideoSurface>(reinterpret_cast<uintptr_t>(Frames[count > 1 ? 1 : 0]->data)); + auto last = static_cast<VdpVideoSurface>(reinterpret_cast<uintptr_t>(Frames[count > 2 ? 2 : 0]->data)); if (field == VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD) { @@ -478,7 +478,7 @@ bool MythVDPAUHelper::IsFeatureAvailable(uint Feature) QSize MythVDPAUHelper::GetSurfaceParameters(VdpVideoSurface Surface, VdpChromaType &Chroma) { if (!Surface) - return QSize(); + return {}; uint width = 0; uint height = 0; @@ -486,5 +486,5 @@ QSize MythVDPAUHelper::GetSurfaceParameters(VdpVideoSurface Surface, VdpChromaTy status = m_vdpVideoSurfaceGetParameters(Surface, &Chroma, &width, &height); CHECK_ST - return QSize(static_cast<int>(width), static_cast<int>(height)); + return {static_cast<int>(width), static_cast<int>(height)}; } diff --git a/mythtv/libs/libmythtv/decoders/nuppeldecoder.cpp b/mythtv/libs/libmythtv/decoders/nuppeldecoder.cpp index 1823c1c5556..29df57e6089 100644 --- a/mythtv/libs/libmythtv/decoders/nuppeldecoder.cpp +++ b/mythtv/libs/libmythtv/decoders/nuppeldecoder.cpp @@ -607,15 +607,15 @@ int NuppelDecoder::OpenFile(RingBuffer *rbuffer, bool novideo, void release_nuppel_buffer(void *opaque, uint8_t *data) { - VideoFrame *frame = (VideoFrame*)data; - NuppelDecoder *nd = (NuppelDecoder*)opaque; + auto *frame = (VideoFrame*)data; + auto *nd = (NuppelDecoder*)opaque; if (nd && nd->GetPlayer()) nd->GetPlayer()->DeLimboFrame(frame); } int get_nuppel_buffer(struct AVCodecContext *c, AVFrame *pic, int /*flags*/) { - NuppelDecoder *nd = (NuppelDecoder *)(c->opaque); + auto *nd = (NuppelDecoder *)(c->opaque); int i; @@ -977,7 +977,7 @@ long NuppelDecoder::UpdateStoredFrameNum(long framenum) { long sync_offset = 0; - list<RawDataList*>::iterator it = m_storedData.begin(); + auto it = m_storedData.begin(); for ( ; it != m_storedData.end(); ++it) { RawDataList *data = *it; @@ -1025,7 +1025,7 @@ void NuppelDecoder::ClearStoredData() } } -bool NuppelDecoder::GetFrame(DecodeType decodetype, bool&) +bool NuppelDecoder::GetFrame(DecodeType decodetype, bool& /*Retry*/) { bool gotvideo = false; int seeklen = 0; diff --git a/mythtv/libs/libmythtv/decoders/nuppeldecoder.h b/mythtv/libs/libmythtv/decoders/nuppeldecoder.h index 91e9e629bc7..4cc71d6d129 100644 --- a/mythtv/libs/libmythtv/decoders/nuppeldecoder.h +++ b/mythtv/libs/libmythtv/decoders/nuppeldecoder.h @@ -68,7 +68,7 @@ class NuppelDecoder : public DecoderBase bool DecodeFrame(struct rtframeheader *frameheader, unsigned char *lstrm, VideoFrame *frame); - bool isValidFrametype(char type); + static bool isValidFrametype(char type); bool InitAVCodecVideo(int codec); void CloseAVCodecVideo(void); diff --git a/mythtv/libs/libmythtv/deletemap.cpp b/mythtv/libs/libmythtv/deletemap.cpp index c067cae435a..d20db7026f8 100644 --- a/mythtv/libs/libmythtv/deletemap.cpp +++ b/mythtv/libs/libmythtv/deletemap.cpp @@ -413,7 +413,7 @@ void DeleteMap::NewCut(uint64_t frame) if (existing > -1) { uint64_t total = m_ctx->m_player->GetTotalFrameCount(); - uint64_t otherframe = static_cast<uint64_t>(existing); + auto otherframe = static_cast<uint64_t>(existing); if (otherframe == frame) Delete(otherframe); else diff --git a/mythtv/libs/libmythtv/deletemap.h b/mythtv/libs/libmythtv/deletemap.h index cbf9ba2bb78..1ea9042d6b1 100644 --- a/mythtv/libs/libmythtv/deletemap.h +++ b/mythtv/libs/libmythtv/deletemap.h @@ -9,15 +9,14 @@ class OSD; class PlayerContext; -typedef struct DeleteMapUndoEntry +struct DeleteMapUndoEntry { frm_dir_map_t m_deleteMap; QString m_message; // how we got from previous map to this map DeleteMapUndoEntry(const frm_dir_map_t &dm, const QString &msg) : m_deleteMap(dm), m_message(msg) { } DeleteMapUndoEntry(void) = default; - -} DeleteMapUndoEntry; +}; class MTV_PUBLIC DeleteMap { @@ -32,7 +31,7 @@ class MTV_PUBLIC DeleteMap void SetSeekAmount(float amount) { m_seekamount = amount; } void UpdateOSD(uint64_t frame, double frame_rate, OSD *osd); - void UpdateOSD(int64_t timecode, OSD *osd); + static void UpdateOSD(int64_t timecode, OSD *osd); bool IsEditing(void) const { return m_editing; } void SetEditing(bool edit, OSD *osd = nullptr); diff --git a/mythtv/libs/libmythtv/diseqc.cpp b/mythtv/libs/libmythtv/diseqc.cpp index b610ce4b3a6..733adb261ef 100644 --- a/mythtv/libs/libmythtv/diseqc.cpp +++ b/mythtv/libs/libmythtv/diseqc.cpp @@ -129,7 +129,7 @@ uint DiSEqCDevDevice::TableFromString(const QString &type, */ bool DiSEqCDevSettings::Load(uint card_input_id) { - if (card_input_id == m_input_id) + if (card_input_id == m_inputId) return true; m_config.clear(); @@ -151,7 +151,7 @@ bool DiSEqCDevSettings::Load(uint card_input_id) while (query.next()) m_config[query.value(0).toUInt()] = query.value(1).toDouble(); - m_input_id = card_input_id; + m_inputId = card_input_id; return true; } @@ -222,7 +222,7 @@ double DiSEqCDevSettings::GetValue(uint devid) const void DiSEqCDevSettings::SetValue(uint devid, double value) { m_config[devid] = value; - m_input_id = (uint) -1; + m_inputId = (uint) -1; } //////////////////////////////////////// DiSEqCDev @@ -267,13 +267,13 @@ DiSEqCDevTrees::~DiSEqCDevTrees() */ DiSEqCDevTree *DiSEqCDevTrees::FindTree(uint cardid) { - QMutexLocker lock(&m_trees_lock); + QMutexLocker lock(&m_treesLock); cardid_to_diseqc_tree_t::iterator it = m_trees.find(cardid); if (it != m_trees.end()) return *it; - DiSEqCDevTree *tree = new DiSEqCDevTree; + auto *tree = new DiSEqCDevTree; tree->Load(cardid); m_trees[cardid] = tree; @@ -285,7 +285,7 @@ DiSEqCDevTree *DiSEqCDevTrees::FindTree(uint cardid) */ void DiSEqCDevTrees::InvalidateTrees(void) { - QMutexLocker lock(&m_trees_lock); + QMutexLocker lock(&m_treesLock); cardid_to_diseqc_tree_t::iterator it = m_trees.begin(); for (; it != m_trees.end(); ++it) @@ -493,7 +493,7 @@ bool DiSEqCDevTree::SetTone(bool on) #ifdef USING_DVB for (uint retry = 0; !success && (retry < TIMEOUT_RETRIES); retry++) { - if (ioctl(m_fd_frontend, FE_SET_TONE, + if (ioctl(m_fdFrontend, FE_SET_TONE, on ? SEC_TONE_ON : SEC_TONE_OFF) == 0) success = true; else @@ -545,7 +545,7 @@ void DiSEqCDevTree::Reset(void) if (m_root) m_root->Reset(); - m_last_voltage = (uint) -1; + m_lastVoltage = (uint) -1; } /** \fn DiSEqCDevTree::FindRotor(const DiSEqCDevSettings&,uint) @@ -800,7 +800,7 @@ bool DiSEqCDevTree::ResetDiseqc(bool hard_reset, bool is_SCR) */ void DiSEqCDevTree::Open(int fd_frontend, bool is_SCR) { - m_fd_frontend = fd_frontend; + m_fdFrontend = fd_frontend; // issue reset command ResetDiseqc(false, is_SCR); @@ -809,7 +809,7 @@ void DiSEqCDevTree::Open(int fd_frontend, bool is_SCR) bool DiSEqCDevTree::SetVoltage(uint voltage) { - if (voltage == m_last_voltage) + if (voltage == m_lastVoltage) return true; int volts = ((voltage == SEC_VOLTAGE_18) ? 18 : @@ -823,7 +823,7 @@ bool DiSEqCDevTree::SetVoltage(uint voltage) #ifdef USING_DVB for (uint retry = 0; !success && retry < TIMEOUT_RETRIES; retry++) { - if (ioctl(m_fd_frontend, FE_SET_VOLTAGE, voltage) == 0) + if (ioctl(m_fdFrontend, FE_SET_VOLTAGE, voltage) == 0) success = true; else usleep(TIMEOUT_WAIT); @@ -836,7 +836,7 @@ bool DiSEqCDevTree::SetVoltage(uint voltage) return false; } - m_last_voltage = voltage; + m_lastVoltage = voltage; return true; } @@ -865,7 +865,7 @@ bool DiSEqCDevTree::ApplyVoltage(const DiSEqCDevSettings &settings, * \brief Represents a node in a DVB-S device network. */ -const DiSEqCDevDevice::TypeTable DiSEqCDevDevice::dvbdev_lookup[5] = +const DiSEqCDevDevice::TypeTable DiSEqCDevDevice::kDvbdevLookup[5] = { { "switch", kTypeSwitch }, { "rotor", kTypeRotor }, @@ -1056,7 +1056,7 @@ DiSEqCDevDevice *DiSEqCDevDevice::CreateByType(DiSEqCDevTree &tree, * \brief Switch class, including tone, legacy and DiSEqC switches. */ -const DiSEqCDevDevice::TypeTable DiSEqCDevSwitch::SwitchTypeTable[9] = +const DiSEqCDevDevice::TypeTable DiSEqCDevSwitch::kSwitchTypeTable[9] = { { "legacy_sw21", kTypeLegacySW21 }, { "legacy_sw42", kTypeLegacySW42 }, @@ -1072,9 +1072,9 @@ const DiSEqCDevDevice::TypeTable DiSEqCDevSwitch::SwitchTypeTable[9] = DiSEqCDevSwitch::DiSEqCDevSwitch(DiSEqCDevTree &tree, uint devid) : DiSEqCDevDevice(tree, devid) { - m_children.resize(m_num_ports); + m_children.resize(m_numPorts); - for (uint i = 0; i < m_num_ports; i++) + for (uint i = 0; i < m_numPorts; i++) m_children[i] = nullptr; DiSEqCDevSwitch::Reset(); @@ -1082,7 +1082,7 @@ DiSEqCDevSwitch::DiSEqCDevSwitch(DiSEqCDevTree &tree, uint devid) DiSEqCDevSwitch::~DiSEqCDevSwitch() { - dvbdev_vec_t::iterator it = m_children.begin(); + auto it = m_children.begin(); for (; it != m_children.end(); ++it) { if (*it) @@ -1137,7 +1137,7 @@ bool DiSEqCDevSwitch::Execute(const DiSEqCDevSettings &settings, usleep(DISEQC_LONG_WAIT); } - m_last_pos = pos; + m_lastPos = pos; } // chain to child if the switch was successful @@ -1149,10 +1149,10 @@ bool DiSEqCDevSwitch::Execute(const DiSEqCDevSettings &settings, void DiSEqCDevSwitch::Reset(void) { - m_last_pos = (uint) -1; - m_last_high_band = (uint) -1; - m_last_horizontal = (uint) -1; - dvbdev_vec_t::iterator it = m_children.begin(); + m_lastPos = (uint) -1; + m_lastHighBand = (uint) -1; + m_lastHorizontal = (uint) -1; + auto it = m_children.begin(); for (; it != m_children.end(); ++it) { if (*it) @@ -1183,7 +1183,7 @@ DiSEqCDevDevice *DiSEqCDevSwitch::GetSelectedChild(const DiSEqCDevSettings &sett uint DiSEqCDevSwitch::GetChildCount(void) const { - return m_num_ports; + return m_numPorts; } DiSEqCDevDevice *DiSEqCDevSwitch::GetChild(uint ordinal) @@ -1227,7 +1227,7 @@ uint DiSEqCDevSwitch::GetVoltage(const DiSEqCDevSettings &settings, bool DiSEqCDevSwitch::Load(void) { // clear old children - dvbdev_vec_t::iterator it = m_children.begin(); + auto it = m_children.begin(); for (; it != m_children.end(); ++it) { if (*it) @@ -1253,10 +1253,10 @@ bool DiSEqCDevSwitch::Load(void) { m_type = SwitchTypeFromString(query.value(0).toString()); m_address = query.value(1).toUInt(); - m_num_ports = query.value(2).toUInt(); + m_numPorts = query.value(2).toUInt(); m_repeat = query.value(3).toUInt(); - m_children.resize(m_num_ports); - for (uint i = 0; i < m_num_ports; i++) + m_children.resize(m_numPorts); + for (uint i = 0; i < m_numPorts; i++) m_children[i] = nullptr; } @@ -1281,7 +1281,7 @@ bool DiSEqCDevSwitch::Load(void) { LOG(VB_GENERAL, LOG_ERR, LOC + QString("Switch port out of range (%1 > %2)") - .arg(ordinal + 1).arg(m_num_ports)); + .arg(ordinal + 1).arg(m_numPorts)); delete child; } } @@ -1330,7 +1330,7 @@ bool DiSEqCDevSwitch::Store(void) const query.bindValue(":DESC", GetDescription()); query.bindValue(":ADDRESS", m_address); query.bindValue(":TYPE", type); - query.bindValue(":PORTS", m_num_ports); + query.bindValue(":PORTS", m_numPorts); query.bindValue(":REPEAT", m_repeat); if (!query.exec()) @@ -1374,7 +1374,7 @@ void DiSEqCDevSwitch::SetNumPorts(uint num_ports) m_children[ch] = nullptr; } - m_num_ports = num_ports; + m_numPorts = num_ports; } bool DiSEqCDevSwitch::ExecuteLegacy(const DiSEqCDevSettings &settings, @@ -1386,10 +1386,10 @@ bool DiSEqCDevSwitch::ExecuteLegacy(const DiSEqCDevSettings &settings, (void) pos; #if defined(USING_DVB) && defined(FE_DISHNETWORK_SEND_LEGACY_CMD) - static const unsigned char sw21_cmds[] = { 0x34, 0x65, }; - static const unsigned char sw42_cmds[] = { 0x46, 0x17, }; - static const unsigned char sw64_v_cmds[] = { 0x39, 0x4b, 0x0d, }; - static const unsigned char sw64_h_cmds[] = { 0x1a, 0x5c, 0x2e, }; + static const unsigned char kSw21Cmds[] = { 0x34, 0x65, }; + static const unsigned char kSw42Cmds[] = { 0x46, 0x17, }; + static const unsigned char kSw64VCmds[] = { 0x39, 0x4b, 0x0d, }; + static const unsigned char kSw64HCmds[] = { 0x1a, 0x5c, 0x2e, }; const unsigned char *cmds = nullptr; unsigned char horizcmd = 0x00; @@ -1405,20 +1405,20 @@ bool DiSEqCDevSwitch::ExecuteLegacy(const DiSEqCDevSettings &settings, switch (m_type) { case kTypeLegacySW21: - cmds = sw21_cmds; + cmds = kSw21Cmds; num_ports = 2; if (horizontal) horizcmd = 0x80; break; case kTypeLegacySW42: - cmds = sw42_cmds; + cmds = kSw42Cmds; num_ports = 2; break; case kTypeLegacySW64: if (horizontal) - cmds = sw64_h_cmds; + cmds = kSw64HCmds; else - cmds = sw64_v_cmds; + cmds = kSw64VCmds; num_ports = 3; break; default: @@ -1605,8 +1605,8 @@ bool DiSEqCDevSwitch::ShouldSwitch(const DiSEqCDevSettings &settings, horizontal = lnb->IsHorizontal(tuning); } - if(high_band != m_last_high_band || - horizontal != m_last_horizontal) + if(high_band != m_lastHighBand || + horizontal != m_lastHorizontal) return true; } else if (kTypeLegacySW42 == m_type || @@ -1618,14 +1618,14 @@ bool DiSEqCDevSwitch::ShouldSwitch(const DiSEqCDevSettings &settings, if (lnb) horizontal = lnb->IsHorizontal(tuning); - if (horizontal != m_last_horizontal) + if (horizontal != m_lastHorizontal) return true; } else if (kTypeVoltage == m_type || kTypeTone == m_type) return true; - return m_last_pos != (uint)pos; + return m_lastPos != (uint)pos; } bool DiSEqCDevSwitch::ExecuteDiseqc(const DiSEqCDevSettings &settings, @@ -1643,12 +1643,12 @@ bool DiSEqCDevSwitch::ExecuteDiseqc(const DiSEqCDevSettings &settings, } // check number of ports - if (((kTypeDiSEqCCommitted == m_type) && (m_num_ports > 4)) || - ((kTypeDiSEqCUncommitted == m_type) && (m_num_ports > 16))) + if (((kTypeDiSEqCCommitted == m_type) && (m_numPorts > 4)) || + ((kTypeDiSEqCUncommitted == m_type) && (m_numPorts > 16))) { LOG(VB_GENERAL, LOG_ERR, LOC + QString("Invalid number of ports for DiSEqC 1.x Switch (%1)") - .arg(m_num_ports)); + .arg(m_numPorts)); return false; } @@ -1663,13 +1663,13 @@ bool DiSEqCDevSwitch::ExecuteDiseqc(const DiSEqCDevSettings &settings, data |= 0xf0; LOG(VB_CHANNEL, LOG_INFO, LOC + "Changing to DiSEqC switch port " + - QString("%1/%2").arg(pos + 1).arg(m_num_ports)); + QString("%1/%2").arg(pos + 1).arg(m_numPorts)); bool ret = m_tree.SendCommand(m_address, cmd, m_repeat, 1, &data); if(ret) { - m_last_high_band = high_band; - m_last_horizontal = horizontal; + m_lastHighBand = high_band; + m_lastHorizontal = horizontal; } return ret; } @@ -1678,10 +1678,10 @@ int DiSEqCDevSwitch::GetPosition(const DiSEqCDevSettings &settings) const { int pos = (int) settings.GetValue(GetDeviceID()); - if (pos >= (int)m_num_ports) + if (pos >= (int)m_numPorts) { LOG(VB_GENERAL, LOG_ERR, LOC + QString("Port %1 ").arg(pos + 1) + - QString("is not in range [0..%1)").arg(m_num_ports)); + QString("is not in range [0..%1)").arg(m_numPorts)); return -1; } @@ -1710,7 +1710,7 @@ static double GetCurTimeFloating(void) * \brief Rotor class. */ -const DiSEqCDevDevice::TypeTable DiSEqCDevRotor::RotorTypeTable[] = +const DiSEqCDevDevice::TypeTable DiSEqCDevRotor::kRotorTypeTable[] = { { "diseqc_1_2", kTypeDiSEqC_1_2 }, { "diseqc_1_3", kTypeDiSEqC_1_3 }, @@ -1728,7 +1728,7 @@ bool DiSEqCDevRotor::Execute(const DiSEqCDevSettings &settings, bool success = true; double position = settings.GetValue(GetDeviceID()); - if (m_reset || (position != m_last_position)) + if (m_reset || (position != m_lastPosition)) { switch (m_type) { @@ -1745,7 +1745,7 @@ bool DiSEqCDevRotor::Execute(const DiSEqCDevSettings &settings, break; } - m_last_position = position; + m_lastPosition = position; m_reset = false; if (success) // prevent tuning paramaters overiding rotor parameters @@ -1771,7 +1771,7 @@ bool DiSEqCDevRotor::IsCommandNeeded(const DiSEqCDevSettings &settings, { double position = settings.GetValue(GetDeviceID()); - if (m_reset || (position != m_last_position)) + if (m_reset || (position != m_lastPosition)) return true; if (m_child) @@ -1808,9 +1808,9 @@ bool DiSEqCDevRotor::IsMoving(const DiSEqCDevSettings &settings) const { double position = settings.GetValue(GetDeviceID()); double completed = GetProgress(); - bool moving = (completed < 1.0) || (position != m_last_position); + bool moving = (completed < 1.0) || (position != m_lastPosition); - return (m_last_pos_known && moving); + return (m_lastPosKnown && moving); } uint DiSEqCDevRotor::GetVoltage(const DiSEqCDevSettings &settings, @@ -1850,8 +1850,8 @@ bool DiSEqCDevRotor::Load(void) if (query.next()) { m_type = RotorTypeFromString(query.value(0).toString()); - m_speed_hi = query.value(2).toDouble(); - m_speed_lo = query.value(3).toDouble(); + m_speedHi = query.value(2).toDouble(); + m_speedLo = query.value(3).toDouble(); m_repeat = query.value(4).toUInt(); // form of "angle1=index1:angle2=index2:..." @@ -1947,8 +1947,8 @@ bool DiSEqCDevRotor::Store(void) const query.bindValue(":ORDINAL", m_ordinal); query.bindValue(":DESC", GetDescription()); query.bindValue(":TYPE", type); - query.bindValue(":HISPEED", m_speed_hi); - query.bindValue(":LOSPEED", m_speed_lo); + query.bindValue(":HISPEED", m_speedHi); + query.bindValue(":LOSPEED", m_speedLo); query.bindValue(":POSMAP", posmap); query.bindValue(":REPEAT", m_repeat); @@ -1976,17 +1976,17 @@ bool DiSEqCDevRotor::Store(void) const */ double DiSEqCDevRotor::GetProgress(void) const { - if (m_move_time == 0.0) + if (m_moveTime == 0.0) return 1.0; // calculate duration of move double speed = ((m_tree.GetVoltage() == SEC_VOLTAGE_18) ? - m_speed_hi : m_speed_lo); - double change = abs(m_desired_azimuth - m_last_azimuth); + m_speedHi : m_speedLo); + double change = abs(m_desiredAzimuth - m_lastAzimuth); double duration = change / speed; // determine completion percentage - double time_since_move = GetCurTimeFloating() - m_move_time; + double time_since_move = GetCurTimeFloating() - m_moveTime; double completed = time_since_move / duration; if(completed > 1.0) { @@ -2006,7 +2006,7 @@ double DiSEqCDevRotor::GetProgress(void) const */ bool DiSEqCDevRotor::IsPositionKnown(void) const { - return m_last_pos_known; + return m_lastPosKnown; } uint_to_dbl_t DiSEqCDevRotor::GetPosMap(void) const @@ -2067,7 +2067,7 @@ bool DiSEqCDevRotor::ExecuteUSALS(const DiSEqCDevSettings& /*settings*/, m_repeat, 2, cmd); } -double DiSEqCDevRotor::CalculateAzimuth(double angle) const +double DiSEqCDevRotor::CalculateAzimuth(double angle) { // Azimuth Calculation references: // http://engr.nmsu.edu/~etti/3_2/3_2e.html @@ -2085,32 +2085,32 @@ double DiSEqCDevRotor::CalculateAzimuth(double angle) const double DiSEqCDevRotor::GetApproxAzimuth(void) const { - if (m_move_time == 0.0) - return m_last_azimuth; + if (m_moveTime == 0.0) + return m_lastAzimuth; - double change = m_desired_azimuth - m_last_azimuth; - return m_last_azimuth + (change * GetProgress()); + double change = m_desiredAzimuth - m_lastAzimuth; + return m_lastAzimuth + (change * GetProgress()); } void DiSEqCDevRotor::StartRotorPositionTracking(double azimuth) { // save time and angle of this command - m_desired_azimuth = azimuth; + m_desiredAzimuth = azimuth; // set last to approximate current position (or worst case if unknown) - if (m_last_pos_known || m_move_time > 0.0) - m_last_azimuth = GetApproxAzimuth(); + if (m_lastPosKnown || m_moveTime > 0.0) + m_lastAzimuth = GetApproxAzimuth(); else - m_last_azimuth = azimuth > 0.0 ? -75.0 : 75.0; + m_lastAzimuth = azimuth > 0.0 ? -75.0 : 75.0; - m_move_time = GetCurTimeFloating(); + m_moveTime = GetCurTimeFloating(); } void DiSEqCDevRotor::RotationComplete(void) const { - m_move_time = 0.0; - m_last_pos_known = true; - m_last_azimuth = m_desired_azimuth; + m_moveTime = 0.0; + m_lastPosKnown = true; + m_lastAzimuth = m_desiredAzimuth; } //////////////////////////////////////// @@ -2119,7 +2119,7 @@ void DiSEqCDevRotor::RotationComplete(void) const * \brief Unicable / SCR Class. */ -const DiSEqCDevDevice::TypeTable DiSEqCDevSCR::SCRPositionTable[3] = +const DiSEqCDevDevice::TypeTable DiSEqCDevSCR::kSCRPositionTable[3] = { { "A", kTypeScrPosA }, { "B", kTypeScrPosB }, @@ -2150,16 +2150,16 @@ bool DiSEqCDevSCR::Execute(const DiSEqCDevSettings &settings, const DTVMultiplex bool high_band = lnb->IsHighBand(tuning); bool horizontal = lnb->IsHorizontal(tuning); uint32_t frequency = lnb->GetIntermediateFrequency(settings, tuning); - uint t = (frequency / 1000 + m_scr_frequency + 2) / 4 - 350; + uint t = (frequency / 1000 + m_scrFrequency + 2) / 4 - 350; // retrieve position settings (value should be 0 or 1) - dvbdev_pos_t scr_position = (dvbdev_pos_t)int(settings.GetValue(GetDeviceID())); + auto scr_position = (dvbdev_pos_t)int(settings.GetValue(GetDeviceID())); // check parameters - if (m_scr_userband > 8) + if (m_scrUserband > 8) { LOG(VB_GENERAL, LOG_INFO, QString("SCR: Userband ID=%1 is out of standard range!") - .arg(m_scr_userband)); + .arg(m_scrUserband)); } if (t >= 1024) @@ -2172,15 +2172,15 @@ bool DiSEqCDevSCR::Execute(const DiSEqCDevSettings &settings, const DTVMultiplex .arg(tuning.m_frequency) .arg(high_band ? "HiBand" : "LoBand") .arg(horizontal ? "H" : "V") - .arg(m_scr_userband) - .arg(m_scr_frequency) + .arg(m_scrUserband) + .arg(m_scrFrequency) .arg((scr_position) ? "B" : "A") - .arg((m_scr_pin >= 0 && m_scr_pin <= 255) ? - QString(", PIN=%1").arg(m_scr_pin) : QString(""))); + .arg((m_scrPin >= 0 && m_scrPin <= 255) ? + QString(", PIN=%1").arg(m_scrPin) : QString(""))); // build command unsigned char data[3]; - data[0] = t >> 8 | m_scr_userband << 5; + data[0] = t >> 8 | m_scrUserband << 5; data[1] = t & 0x00FF; if (high_band) @@ -2193,9 +2193,9 @@ bool DiSEqCDevSCR::Execute(const DiSEqCDevSettings &settings, const DTVMultiplex data[0] |= (1 << 4); // send command - if (m_scr_pin >= 0 && m_scr_pin <= 255) + if (m_scrPin >= 0 && m_scrPin <= 255) { - data[2] = m_scr_pin; + data[2] = m_scrPin; return SendCommand(DISEQC_CMD_ODU_MDU, m_repeat, 3, data); } return SendCommand(DISEQC_CMD_ODU, m_repeat, 2, data); @@ -2204,27 +2204,27 @@ bool DiSEqCDevSCR::Execute(const DiSEqCDevSettings &settings, const DTVMultiplex bool DiSEqCDevSCR::PowerOff(void) const { // check parameters - if (m_scr_userband > 8) + if (m_scrUserband > 8) { LOG(VB_GENERAL, LOG_INFO, QString("SCR: Userband ID=%1 is out of standard range!") - .arg(m_scr_userband)); + .arg(m_scrUserband)); } LOG(VB_CHANNEL, LOG_INFO, LOC + QString("SCR: Power off UB=%1%7") - .arg(m_scr_userband) - .arg((m_scr_pin >= 0 && m_scr_pin <= 255) - ? QString(", PIN=%1").arg(m_scr_pin) + .arg(m_scrUserband) + .arg((m_scrPin >= 0 && m_scrPin <= 255) + ? QString(", PIN=%1").arg(m_scrPin) : QString(""))); // build command unsigned char data[3]; - data[0] = (uint8_t) (m_scr_userband << 5); + data[0] = (uint8_t) (m_scrUserband << 5); data[1] = 0x00; // send command - if (m_scr_pin >= 0 && m_scr_pin <= 255) + if (m_scrPin >= 0 && m_scrPin <= 255) { - data[2] = m_scr_pin; + data[2] = m_scrPin; return SendCommand(DISEQC_CMD_ODU_MDU, m_repeat, 3, data); } return SendCommand(DISEQC_CMD_ODU, m_repeat, 2, data); @@ -2258,7 +2258,7 @@ uint DiSEqCDevSCR::GetVoltage(const DiSEqCDevSettings &/*settings*/, uint32_t DiSEqCDevSCR::GetIntermediateFrequency(const uint32_t frequency) const { - uint t = (frequency / 1000 + m_scr_frequency + 2) / 4 - 350; + uint t = (frequency / 1000 + m_scrFrequency + 2) / 4 - 350; return ((t + 350) * 4) * 1000 - frequency; } @@ -2280,9 +2280,9 @@ bool DiSEqCDevSCR::Load(void) } if (query.next()) { - m_scr_userband = query.value(0).toUInt(); - m_scr_frequency = query.value(1).toUInt(); - m_scr_pin = query.value(2).toInt(); + m_scrUserband = query.value(0).toUInt(); + m_scrFrequency = query.value(1).toUInt(); + m_scrPin = query.value(2).toInt(); m_repeat = query.value(3).toUInt(); } @@ -2351,9 +2351,9 @@ bool DiSEqCDevSCR::Store(void) const query.bindValue(":ORDINAL", m_ordinal); query.bindValue(":DESC", GetDescription()); - query.bindValue(":USERBAND", m_scr_userband); - query.bindValue(":FREQUENCY", m_scr_frequency); - query.bindValue(":PIN", m_scr_pin); + query.bindValue(":USERBAND", m_scrUserband); + query.bindValue(":FREQUENCY", m_scrFrequency); + query.bindValue(":PIN", m_scrPin); query.bindValue(":REPEAT", m_repeat); // update dev_id @@ -2399,7 +2399,7 @@ bool DiSEqCDevSCR::SetChild(uint ordinal, DiSEqCDevDevice *device) * \brief LNB Class. */ -const DiSEqCDevDevice::TypeTable DiSEqCDevLNB::LNBTypeTable[5] = +const DiSEqCDevDevice::TypeTable DiSEqCDevLNB::kLNBTypeTable[5] = { { "fixed", kTypeFixed }, { "voltage", kTypeVoltageControl }, @@ -2451,9 +2451,9 @@ bool DiSEqCDevLNB::Load(void) if (query.next()) { m_type = LNBTypeFromString(query.value(0).toString()); - m_lof_switch = query.value(1).toInt(); - m_lof_hi = query.value(2).toInt(); - m_lof_lo = query.value(3).toInt(); + m_lofSwitch = query.value(1).toInt(); + m_lofHi = query.value(2).toInt(); + m_lofLo = query.value(3).toInt(); m_pol_inv = query.value(4).toBool(); m_repeat = query.value(5).toUInt(); } @@ -2505,9 +2505,9 @@ bool DiSEqCDevLNB::Store(void) const query.bindValue(":ORDINAL", m_ordinal); query.bindValue(":DESC", GetDescription()); query.bindValue(":TYPE", type); - query.bindValue(":LOFSW", m_lof_switch); - query.bindValue(":LOFLO", m_lof_lo); - query.bindValue(":LOFHI", m_lof_hi); + query.bindValue(":LOFSW", m_lofSwitch); + query.bindValue(":LOFLO", m_lofLo); + query.bindValue(":LOFHI", m_lofHi); query.bindValue(":POLINV", m_pol_inv); query.bindValue(":REPEAT", m_repeat); @@ -2536,7 +2536,7 @@ bool DiSEqCDevLNB::IsHighBand(const DTVMultiplex &tuning) const switch (m_type) { case kTypeVoltageAndToneControl: - return (tuning.m_frequency > m_lof_switch); + return (tuning.m_frequency > m_lofSwitch); case kTypeBandstacked: return IsHorizontal(tuning); default: @@ -2567,7 +2567,7 @@ uint32_t DiSEqCDevLNB::GetIntermediateFrequency( const DiSEqCDevSettings& /*settings*/, const DTVMultiplex &tuning) const { uint64_t abs_freq = tuning.m_frequency; - uint lof = (IsHighBand(tuning)) ? m_lof_hi : m_lof_lo; + uint lof = (IsHighBand(tuning)) ? m_lofHi : m_lofLo; return (lof > abs_freq) ? (lof - abs_freq) : (abs_freq - lof); } diff --git a/mythtv/libs/libmythtv/diseqc.h b/mythtv/libs/libmythtv/diseqc.h index 47dfe719527..257e593a0fe 100644 --- a/mythtv/libs/libmythtv/diseqc.h +++ b/mythtv/libs/libmythtv/diseqc.h @@ -27,10 +27,10 @@ class DiSEqCDevRotor; class DiSEqCDevLNB; class DiSEqCDevSCR; -typedef QMap<uint, double> uint_to_dbl_t; -typedef QMap<double, uint> dbl_to_uint_t; -typedef QMap<uint, DiSEqCDevTree*> cardid_to_diseqc_tree_t; -typedef vector<DiSEqCDevDevice*> dvbdev_vec_t; +using uint_to_dbl_t = QMap<uint, double>; +using dbl_to_uint_t = QMap<double, uint>; +using cardid_to_diseqc_tree_t = QMap<uint, DiSEqCDevTree*>; +using dvbdev_vec_t = vector<DiSEqCDevDevice*>; class DiSEqCDevSettings { @@ -44,14 +44,14 @@ class DiSEqCDevSettings protected: uint_to_dbl_t m_config; //< map of dev tree id to configuration value - uint m_input_id {1}; ///< current input id + uint m_inputId {1}; ///< current input id }; class DiSEqCDev { public: - DiSEqCDevTree* FindTree(uint cardid); - void InvalidateTrees(void); + static DiSEqCDevTree* FindTree(uint cardid); + static void InvalidateTrees(void); protected: static DiSEqCDevTrees s_trees; @@ -67,7 +67,7 @@ class DiSEqCDevTrees protected: cardid_to_diseqc_tree_t m_trees; - QMutex m_trees_lock; + QMutex m_treesLock; }; class DiSEqCDevTree @@ -99,20 +99,20 @@ class DiSEqCDevTree // frontend fd void Open(int fd_frontend, bool is_SCR); - void Close(void) { m_fd_frontend = -1; } - int GetFD(void) const { return m_fd_frontend; } + void Close(void) { m_fdFrontend = -1; } + int GetFD(void) const { return m_fdFrontend; } // Sets bool SetTone(bool on); bool SetVoltage(uint voltage); // Gets - uint GetVoltage(void) const { return m_last_voltage; } + uint GetVoltage(void) const { return m_lastVoltage; } bool IsInNeedOfConf(void) const; // tree management void AddDeferredDelete(uint dev_id) { m_delete.push_back(dev_id); } - uint CreateFakeDiSEqCID(void) { return m_previous_fake_diseqcid++; } + uint CreateFakeDiSEqCID(void) { return m_previousFakeDiseqcid++; } static bool IsFakeDiSEqCID(uint id) { return id >= kFirstFakeDiSEqCID; } static bool Exists(int cardid); @@ -121,10 +121,10 @@ class DiSEqCDevTree bool ApplyVoltage(const DiSEqCDevSettings &settings, const DTVMultiplex &tuning); - int m_fd_frontend {-1}; + int m_fdFrontend {-1}; DiSEqCDevDevice *m_root {nullptr}; - uint m_last_voltage; - uint m_previous_fake_diseqcid {kFirstFakeDiSEqCID}; + uint m_lastVoltage {UINT_MAX}; + uint m_previousFakeDiseqcid {kFirstFakeDiSEqCID}; vector<uint> m_delete; static const uint kFirstFakeDiSEqCID; @@ -151,7 +151,7 @@ class DiSEqCDevDevice kTypeSCR = 2, kTypeLNB = 3, }; - void SetDeviceType(dvbdev_t type) { m_dev_type = type; } + void SetDeviceType(dvbdev_t type) { m_devType = type; } void SetParent(DiSEqCDevDevice* parent) { m_parent = parent; } void SetOrdinal(uint ordinal) { m_ordinal = ordinal; } void SetDescription(const QString &desc) { m_desc = desc; } @@ -159,7 +159,7 @@ class DiSEqCDevDevice virtual bool SetChild(uint, DiSEqCDevDevice*){return false; } // Gets - dvbdev_t GetDeviceType(void) const { return m_dev_type; } + dvbdev_t GetDeviceType(void) const { return m_devType; } uint GetDeviceID(void) const { return m_devid; } bool IsRealDeviceID(void) const { return !DiSEqCDevTree::IsFakeDiSEqCID(m_devid); } @@ -182,9 +182,9 @@ class DiSEqCDevDevice // Statics static QString DevTypeToString(dvbdev_t type) - { return TableToString((uint)type, dvbdev_lookup); } + { return TableToString((uint)type, kDvbdevLookup); } static dvbdev_t DevTypeFromString(const QString &type) - { return (dvbdev_t) TableFromString(type, dvbdev_lookup); } + { return (dvbdev_t) TableFromString(type, kDvbdevLookup); } static DiSEqCDevDevice *CreateById( DiSEqCDevTree &tree, uint devid); @@ -196,20 +196,20 @@ class DiSEqCDevDevice void SetDeviceID(uint devid) const { m_devid = devid; } mutable uint m_devid; - dvbdev_t m_dev_type {kTypeLNB}; + dvbdev_t m_devType {kTypeLNB}; QString m_desc; DiSEqCDevTree &m_tree; DiSEqCDevDevice *m_parent {nullptr}; uint m_ordinal {0}; uint m_repeat {1}; - typedef struct { QString name; uint value; } TypeTable; + struct TypeTable { QString name; uint value; }; static QString TableToString(uint type, const TypeTable *table); static uint TableFromString(const QString &type, const TypeTable *table); private: - static const TypeTable dvbdev_lookup[5]; + static const TypeTable kDvbdevLookup[5]; }; class DiSEqCDevSwitch : public DiSEqCDevDevice @@ -244,7 +244,7 @@ class DiSEqCDevSwitch : public DiSEqCDevDevice // Gets dvbdev_switch_t GetType(void) const { return m_type; } uint GetAddress(void) const { return m_address; } - uint GetNumPorts(void) const { return m_num_ports; } + uint GetNumPorts(void) const { return m_numPorts; } bool ShouldSwitch(const DiSEqCDevSettings &settings, const DTVMultiplex &tuning) const; uint GetChildCount(void) const override; // DiSEqCDevDevice @@ -259,9 +259,9 @@ class DiSEqCDevSwitch : public DiSEqCDevDevice // Statics static QString SwitchTypeToString(dvbdev_switch_t type) - { return TableToString((uint)type, SwitchTypeTable); } + { return TableToString((uint)type, kSwitchTypeTable); } static dvbdev_switch_t SwitchTypeFromString(const QString &type) - { return (dvbdev_switch_t) TableFromString(type, SwitchTypeTable); } + { return (dvbdev_switch_t) TableFromString(type, kSwitchTypeTable); } protected: @@ -281,13 +281,13 @@ class DiSEqCDevSwitch : public DiSEqCDevDevice private: dvbdev_switch_t m_type {kTypeTone}; uint m_address {0x10}; //DISEQC_ADR_SW_ALL - uint m_num_ports {2}; - uint m_last_pos {(uint)-1}; - uint m_last_high_band {(uint)-1}; - uint m_last_horizontal {(uint)-1}; + uint m_numPorts {2}; + uint m_lastPos {(uint)-1}; + uint m_lastHighBand {(uint)-1}; + uint m_lastHorizontal {(uint)-1}; dvbdev_vec_t m_children; - static const TypeTable SwitchTypeTable[9]; + static const TypeTable kSwitchTypeTable[9]; }; class DiSEqCDevRotor : public DiSEqCDevDevice @@ -306,16 +306,16 @@ class DiSEqCDevRotor : public DiSEqCDevDevice // Sets enum dvbdev_rotor_t { kTypeDiSEqC_1_2 = 0, kTypeDiSEqC_1_3 = 1, }; void SetType(dvbdev_rotor_t type) { m_type = type; } - void SetLoSpeed(double speed) { m_speed_lo = speed; } - void SetHiSpeed(double speed) { m_speed_hi = speed; } + void SetLoSpeed(double speed) { m_speedLo = speed; } + void SetHiSpeed(double speed) { m_speedHi = speed; } void SetPosMap(const uint_to_dbl_t &posmap); bool SetChild(uint ordinal, DiSEqCDevDevice* device) override; // DiSEqCDevDevice void RotationComplete(void) const; // Gets dvbdev_rotor_t GetType(void) const { return m_type; } - double GetLoSpeed(void) const { return m_speed_lo; } - double GetHiSpeed(void) const { return m_speed_hi; } + double GetLoSpeed(void) const { return m_speedLo; } + double GetHiSpeed(void) const { return m_speedHi; } uint_to_dbl_t GetPosMap(void) const; double GetProgress(void) const; bool IsPositionKnown(void) const; @@ -334,9 +334,9 @@ class DiSEqCDevRotor : public DiSEqCDevDevice // Statics static QString RotorTypeToString(dvbdev_rotor_t type) - { return TableToString((uint)type, RotorTypeTable); } + { return TableToString((uint)type, kRotorTypeTable); } static dvbdev_rotor_t RotorTypeFromString(const QString &type) - { return (dvbdev_rotor_t) TableFromString(type, RotorTypeTable); } + { return (dvbdev_rotor_t) TableFromString(type, kRotorTypeTable); } protected: bool ExecuteRotor(const DiSEqCDevSettings&, const DTVMultiplex&, @@ -345,29 +345,29 @@ class DiSEqCDevRotor : public DiSEqCDevDevice double angle); void StartRotorPositionTracking(double azimuth); - double CalculateAzimuth(double angle) const; + static double CalculateAzimuth(double angle); double GetApproxAzimuth(void) const; private: // configuration dvbdev_rotor_t m_type {kTypeDiSEqC_1_3}; - double m_speed_hi {2.5}; - double m_speed_lo {1.9}; + double m_speedHi {2.5}; + double m_speedLo {1.9}; dbl_to_uint_t m_posmap; DiSEqCDevDevice *m_child {nullptr}; // state - double m_last_position {0.0}; - double m_desired_azimuth {0.0}; + double m_lastPosition {0.0}; + double m_desiredAzimuth {0.0}; bool m_reset {true}; // rotor position tracking state - mutable double m_move_time {0.0}; - mutable bool m_last_pos_known {false}; - mutable double m_last_azimuth {0.0}; + mutable double m_moveTime {0.0}; + mutable bool m_lastPosKnown {false}; + mutable double m_lastAzimuth {0.0}; // statics - static const TypeTable RotorTypeTable[3]; + static const TypeTable kRotorTypeTable[3]; }; class DiSEqCDevSCR : public DiSEqCDevDevice @@ -390,15 +390,15 @@ class DiSEqCDevSCR : public DiSEqCDevDevice kTypeScrPosA = 0, kTypeScrPosB = 1, }; - void SetUserBand(uint userband) { m_scr_userband = userband; } - void SetFrequency(uint freq) { m_scr_frequency = freq; } - void SetPIN(int pin) { m_scr_pin = pin; } + void SetUserBand(uint userband) { m_scrUserband = userband; } + void SetFrequency(uint freq) { m_scrFrequency = freq; } + void SetPIN(int pin) { m_scrPin = pin; } bool SetChild(uint ordinal, DiSEqCDevDevice* device) override; // DiSEqCDevDevice // Gets - uint GetUserBand(void) const { return m_scr_userband; } - uint GetFrequency(void) const { return m_scr_frequency; } - int GetPIN(void) const { return m_scr_pin; } + uint GetUserBand(void) const { return m_scrUserband; } + uint GetFrequency(void) const { return m_scrFrequency; } + int GetPIN(void) const { return m_scrPin; } uint GetChildCount(void) const override // DiSEqCDevDevice { return 1; } bool IsCommandNeeded(const DiSEqCDevSettings&, @@ -416,23 +416,23 @@ class DiSEqCDevSCR : public DiSEqCDevDevice // statics static QString SCRPositionToString(dvbdev_pos_t pos) - { return TableToString((uint)pos, SCRPositionTable); } + { return TableToString((uint)pos, kSCRPositionTable); } static dvbdev_pos_t SCRPositionFromString(const QString &pos) - { return (dvbdev_pos_t) TableFromString(pos, SCRPositionTable); } + { return (dvbdev_pos_t) TableFromString(pos, kSCRPositionTable); } protected: bool SendCommand(uint cmd, uint repeats, uint data_len = 0, unsigned char *data = nullptr) const; private: - uint m_scr_userband {0}; /* 0-7 */ - uint m_scr_frequency {1400}; - int m_scr_pin {-1}; /* 0-255, -1=disabled */ + uint m_scrUserband {0}; /* 0-7 */ + uint m_scrFrequency {1400}; + int m_scrPin {-1}; /* 0-255, -1=disabled */ DiSEqCDevDevice *m_child {nullptr}; - static const TypeTable SCRPositionTable[3]; + static const TypeTable kSCRPositionTable[3]; }; class DiSEqCDevLNB : public DiSEqCDevDevice @@ -455,16 +455,16 @@ class DiSEqCDevLNB : public DiSEqCDevDevice kTypeBandstacked = 3, }; void SetType(dvbdev_lnb_t type) { m_type = type; } - void SetLOFSwitch(uint lof_switch) { m_lof_switch = lof_switch; } - void SetLOFHigh( uint lof_hi) { m_lof_hi = lof_hi; } - void SetLOFLow( uint lof_lo) { m_lof_lo = lof_lo; } + void SetLOFSwitch(uint lof_switch) { m_lofSwitch = lof_switch; } + void SetLOFHigh( uint lof_hi) { m_lofHi = lof_hi; } + void SetLOFLow( uint lof_lo) { m_lofLo = lof_lo; } void SetPolarityInverted(bool inv) { m_pol_inv = inv; } // Gets dvbdev_lnb_t GetType(void) const { return m_type; } - uint GetLOFSwitch(void) const { return m_lof_switch; } - uint GetLOFHigh(void) const { return m_lof_hi; } - uint GetLOFLow(void) const { return m_lof_lo; } + uint GetLOFSwitch(void) const { return m_lofSwitch; } + uint GetLOFHigh(void) const { return m_lofHi; } + uint GetLOFLow(void) const { return m_lofLo; } bool IsPolarityInverted(void) const { return m_pol_inv; } bool IsHighBand(const DTVMultiplex&) const; bool IsHorizontal(const DTVMultiplex&) const; @@ -475,22 +475,22 @@ class DiSEqCDevLNB : public DiSEqCDevDevice // statics static QString LNBTypeToString(dvbdev_lnb_t type) - { return TableToString((uint)type, LNBTypeTable); } + { return TableToString((uint)type, kLNBTypeTable); } static dvbdev_lnb_t LNBTypeFromString(const QString &type) - { return (dvbdev_lnb_t) TableFromString(type, LNBTypeTable); } + { return (dvbdev_lnb_t) TableFromString(type, kLNBTypeTable); } private: dvbdev_lnb_t m_type {kTypeVoltageAndToneControl}; - uint m_lof_switch {11700000}; - uint m_lof_hi {10600000}; - uint m_lof_lo { 9750000}; + uint m_lofSwitch {11700000}; + uint m_lofHi {10600000}; + uint m_lofLo { 9750000}; /// If a signal is circularly polarized the polarity will flip /// on each reflection, so antenna systems with an even number /// of reflectors will need to set this value. bool m_pol_inv {false}; - static const TypeTable LNBTypeTable[5]; + static const TypeTable kLNBTypeTable[5]; }; #endif // _DISEQC_H_ diff --git a/mythtv/libs/libmythtv/diseqcsettings.cpp b/mythtv/libs/libmythtv/diseqcsettings.cpp index cf3dfd0d573..e77a60cb59c 100644 --- a/mythtv/libs/libmythtv/diseqcsettings.cpp +++ b/mythtv/libs/libmythtv/diseqcsettings.cpp @@ -6,6 +6,7 @@ // Std C headers #include <cmath> +#include <utility> // MythTV headers #include "mythdbcon.h" @@ -16,7 +17,7 @@ static GlobalTextEditSetting *DiSEqCLatitude(void) { - GlobalTextEditSetting *gc = new GlobalTextEditSetting("latitude"); + auto *gc = new GlobalTextEditSetting("latitude"); gc->setLabel("Latitude"); gc->setHelpText( DeviceTree::tr("The Cartesian latitude for your location. " @@ -26,7 +27,7 @@ static GlobalTextEditSetting *DiSEqCLatitude(void) static GlobalTextEditSetting *DiSEqCLongitude(void) { - GlobalTextEditSetting *gc = new GlobalTextEditSetting("longitude"); + auto *gc = new GlobalTextEditSetting("longitude"); gc->setLabel("Longitude"); gc->setHelpText( DeviceTree::tr("The Cartesian longitude for your location. " @@ -501,7 +502,7 @@ class RotorPosTextEdit : public TransTextEditSetting void RotorPosMap::valueChanged(StandardSetting *setting) { - RotorPosTextEdit *posEdit = dynamic_cast<RotorPosTextEdit*>(setting); + auto *posEdit = dynamic_cast<RotorPosTextEdit*>(setting); if (posEdit == nullptr) return; QString value = posEdit->getValue(); @@ -521,7 +522,7 @@ void RotorPosMap::PopulateList(void) if (it != m_posmap.end()) posval = AngleToString(*it); - RotorPosTextEdit *posEdit = + auto *posEdit = new RotorPosTextEdit(DeviceTree::tr("Position #%1").arg(pos), pos, posval); @@ -543,7 +544,7 @@ RotorConfig::RotorConfig(DiSEqCDevRotor &rotor, StandardSetting *parent) parent->addChild(new DeviceDescrSetting(rotor)); parent->addChild(new DeviceRepeatSetting(rotor)); - RotorTypeSetting *rtype = new RotorTypeSetting(rotor); + auto *rtype = new RotorTypeSetting(rotor); connect(rtype, SIGNAL(valueChanged(const QString&)), this, SLOT( SetType( const QString&))); parent->addChild(rtype); @@ -669,20 +670,20 @@ SCRConfig::SCRConfig(DiSEqCDevSCR &scr, StandardSetting *parent) : m_scr(scr) class lnb_preset { public: - lnb_preset(const QString &_name, DiSEqCDevLNB::dvbdev_lnb_t _type, + lnb_preset(QString _name, DiSEqCDevLNB::dvbdev_lnb_t _type, uint _lof_sw = 0, uint _lof_lo = 0, uint _lof_hi = 0, bool _pol_inv = false) : - name(_name), type(_type), - lof_sw(_lof_sw), lof_lo(_lof_lo), - lof_hi(_lof_hi), pol_inv(_pol_inv) {} + m_name(std::move(_name)), m_type(_type), + m_lofSw(_lof_sw), m_lofLo(_lof_lo), + m_lofHi(_lof_hi), m_polInv(_pol_inv) {} public: - QString name; - DiSEqCDevLNB::dvbdev_lnb_t type; - uint lof_sw; - uint lof_lo; - uint lof_hi; - bool pol_inv; + QString m_name; + DiSEqCDevLNB::dvbdev_lnb_t m_type; + uint m_lofSw; + uint m_lofLo; + uint m_lofHi; + bool m_polInv; }; static lnb_preset lnb_presets[] = @@ -708,13 +709,13 @@ static lnb_preset lnb_presets[] = static uint FindPreset(const DiSEqCDevLNB &lnb) { uint i; - for (i = 0; !lnb_presets[i].name.isEmpty(); i++) + for (i = 0; !lnb_presets[i].m_name.isEmpty(); i++) { - if (lnb_presets[i].type == lnb.GetType() && - lnb_presets[i].lof_sw == lnb.GetLOFSwitch() && - lnb_presets[i].lof_lo == lnb.GetLOFLow() && - lnb_presets[i].lof_hi == lnb.GetLOFHigh() && - lnb_presets[i].pol_inv== lnb.IsPolarityInverted()) + if (lnb_presets[i].m_type == lnb.GetType() && + lnb_presets[i].m_lofSw == lnb.GetLOFSwitch() && + lnb_presets[i].m_lofLo == lnb.GetLOFLow() && + lnb_presets[i].m_lofHi == lnb.GetLOFHigh() && + lnb_presets[i].m_polInv== lnb.IsPolarityInverted()) { break; } @@ -734,8 +735,8 @@ class LNBPresetSetting : public MythUIComboBoxSetting setHelpText(help); uint i = 0; - for (; !lnb_presets[i].name.isEmpty(); i++) - addSelection(DeviceTree::tr( lnb_presets[i].name.toUtf8() ), + for (; !lnb_presets[i].m_name.isEmpty(); i++) + addSelection(DeviceTree::tr( lnb_presets[i].m_name.toUtf8() ), QString::number(i)); addSelection(DeviceTree::tr("Custom"), QString::number(i)); } @@ -917,20 +918,20 @@ LNBConfig::LNBConfig(DiSEqCDevLNB &lnb, StandardSetting *parent) setValue(lnb.GetDescription()); parent = this; - DeviceDescrSetting *deviceDescr = new DeviceDescrSetting(lnb); + auto *deviceDescr = new DeviceDescrSetting(lnb); parent->addChild(deviceDescr); m_preset = new LNBPresetSetting(lnb); parent->addChild(m_preset); m_type = new LNBTypeSetting(lnb); parent->addChild(m_type); - m_lof_switch = new LNBLOFSwitchSetting(lnb); - parent->addChild(m_lof_switch); - m_lof_lo = new LNBLOFLowSetting(lnb); - parent->addChild(m_lof_lo); - m_lof_hi = new LNBLOFHighSetting(lnb); - parent->addChild(m_lof_hi); - m_pol_inv = new LNBPolarityInvertedSetting(lnb); - parent->addChild(m_pol_inv); + m_lofSwitch = new LNBLOFSwitchSetting(lnb); + parent->addChild(m_lofSwitch); + m_lofLo = new LNBLOFLowSetting(lnb); + parent->addChild(m_lofLo); + m_lofHi = new LNBLOFHighSetting(lnb); + parent->addChild(m_lofHi); + m_polInv = new LNBPolarityInvertedSetting(lnb); + parent->addChild(m_polInv); connect(m_type, SIGNAL(valueChanged(const QString&)), this, SLOT( UpdateType( void))); connect(m_preset, SIGNAL(valueChanged(const QString&)), @@ -952,7 +953,7 @@ void LNBConfig::SetPreset(const QString &value) return; lnb_preset &preset = lnb_presets[index]; - if (preset.name.isEmpty()) + if (preset.m_name.isEmpty()) { m_type->setEnabled(true); UpdateType(); @@ -960,16 +961,16 @@ void LNBConfig::SetPreset(const QString &value) else { m_type->setValue(m_type->getValueIndex( - QString::number((uint)preset.type))); - m_lof_switch->setValue(QString::number(preset.lof_sw / 1000)); - m_lof_lo->setValue(QString::number(preset.lof_lo / 1000)); - m_lof_hi->setValue(QString::number(preset.lof_hi / 1000)); - m_pol_inv->setValue(preset.pol_inv); + QString::number((uint)preset.m_type))); + m_lofSwitch->setValue(QString::number(preset.m_lofSw / 1000)); + m_lofLo->setValue(QString::number(preset.m_lofLo / 1000)); + m_lofHi->setValue(QString::number(preset.m_lofHi / 1000)); + m_polInv->setValue(preset.m_polInv); m_type->setEnabled(false); - m_lof_switch->setEnabled(false); - m_lof_hi->setEnabled(false); - m_lof_lo->setEnabled(false); - m_pol_inv->setEnabled(false); + m_lofSwitch->setEnabled(false); + m_lofHi->setEnabled(false); + m_lofLo->setEnabled(false); + m_polInv->setEnabled(false); } } @@ -982,22 +983,22 @@ void LNBConfig::UpdateType(void) { case DiSEqCDevLNB::kTypeFixed: case DiSEqCDevLNB::kTypeVoltageControl: - m_lof_switch->setEnabled(false); - m_lof_hi->setEnabled(false); - m_lof_lo->setEnabled(true); - m_pol_inv->setEnabled(true); + m_lofSwitch->setEnabled(false); + m_lofHi->setEnabled(false); + m_lofLo->setEnabled(true); + m_polInv->setEnabled(true); break; case DiSEqCDevLNB::kTypeVoltageAndToneControl: - m_lof_switch->setEnabled(true); - m_lof_hi->setEnabled(true); - m_lof_lo->setEnabled(true); - m_pol_inv->setEnabled(true); + m_lofSwitch->setEnabled(true); + m_lofHi->setEnabled(true); + m_lofLo->setEnabled(true); + m_polInv->setEnabled(true); break; case DiSEqCDevLNB::kTypeBandstacked: - m_lof_switch->setEnabled(false); - m_lof_hi->setEnabled(true); - m_lof_lo->setEnabled(true); - m_pol_inv->setEnabled(true); + m_lofSwitch->setEnabled(false); + m_lofHi->setEnabled(true); + m_lofLo->setEnabled(true); + m_polInv->setEnabled(true); break; } } @@ -1039,7 +1040,7 @@ DiseqcConfigBase* DiseqcConfigBase::CreateByType(DiSEqCDevDevice *dev, { case DiSEqCDevDevice::kTypeSwitch: { - DiSEqCDevSwitch *sw = dynamic_cast<DiSEqCDevSwitch*>(dev); + auto *sw = dynamic_cast<DiSEqCDevSwitch*>(dev); if (sw) setting = new SwitchConfig(*sw, parent); } @@ -1047,7 +1048,7 @@ DiseqcConfigBase* DiseqcConfigBase::CreateByType(DiSEqCDevDevice *dev, case DiSEqCDevDevice::kTypeRotor: { - DiSEqCDevRotor *rotor = dynamic_cast<DiSEqCDevRotor*>(dev); + auto *rotor = dynamic_cast<DiSEqCDevRotor*>(dev); if (rotor) setting = new RotorConfig(*rotor, parent); } @@ -1055,7 +1056,7 @@ DiseqcConfigBase* DiseqcConfigBase::CreateByType(DiSEqCDevDevice *dev, case DiSEqCDevDevice::kTypeSCR: { - DiSEqCDevSCR *scr = dynamic_cast<DiSEqCDevSCR*>(dev); + auto *scr = dynamic_cast<DiSEqCDevSCR*>(dev); if (scr) setting = new SCRConfig(*scr, parent); } @@ -1063,7 +1064,7 @@ DiseqcConfigBase* DiseqcConfigBase::CreateByType(DiSEqCDevDevice *dev, case DiSEqCDevDevice::kTypeLNB: { - DiSEqCDevLNB *lnb = dynamic_cast<DiSEqCDevLNB*>(dev); + auto *lnb = dynamic_cast<DiSEqCDevLNB*>(dev); if (lnb) setting = new LNBConfig(*lnb, parent); } @@ -1083,7 +1084,7 @@ void DeviceTree::PopulateTree(DiSEqCDevDevice *node, { if (node) { - DeviceTypeSetting *devtype = new DeviceTypeSetting(); + auto *devtype = new DeviceTypeSetting(); devtype->SetDevice(node); devtype->Load(); DiseqcConfigBase *setting = DiseqcConfigBase::CreateByType(node, @@ -1102,7 +1103,7 @@ void DeviceTree::PopulateTree(DiSEqCDevDevice *node, } else { - DeviceTypeSetting *devtype = new DeviceTypeSetting(); + auto *devtype = new DeviceTypeSetting(); AddDeviceTypeSetting(devtype, parent, childnum, parentSetting); } } @@ -1154,8 +1155,7 @@ void DeviceTree::ValueChanged(const QString &value, // Remove old setting from m_tree DeleteDevice(devtype); - const DiSEqCDevDevice::dvbdev_t type = - static_cast<DiSEqCDevDevice::dvbdev_t>(value.toUInt()); + const auto type = static_cast<DiSEqCDevDevice::dvbdev_t>(value.toUInt()); DiSEqCDevDevice *dev = DiSEqCDevDevice::CreateByType(m_tree, type); if (dev) @@ -1234,7 +1234,7 @@ class RotorSetting : public MythUIComboBoxSetting setLabel(node.GetDescription()); setHelpText(DeviceTree::tr("Choose a satellite position.")); - DiSEqCDevRotor *rotor = dynamic_cast<DiSEqCDevRotor*>(&m_node); + auto *rotor = dynamic_cast<DiSEqCDevRotor*>(&m_node); if (rotor) m_posmap = rotor->GetPosMap(); } @@ -1269,8 +1269,8 @@ class USALSRotorSetting : public GroupSetting { public: USALSRotorSetting(DiSEqCDevDevice &node, DiSEqCDevSettings &settings) : - numeric(new TransTextEditSetting()), - hemisphere(new TransMythUIComboBoxSetting(/*false*/)), + m_numeric(new TransTextEditSetting()), + m_hemisphere(new TransMythUIComboBoxSetting(/*false*/)), m_node(node), m_settings(settings) { QString help = @@ -1279,17 +1279,17 @@ class USALSRotorSetting : public GroupSetting "with the longitude along the Clarke Belt of " "the satellite [-180..180] and its hemisphere."); - numeric->setLabel(DeviceTree::tr("Longitude (degrees)")); - numeric->setHelpText(help); - hemisphere->setLabel(DeviceTree::tr("Hemisphere")); - hemisphere->addSelection(DeviceTree::tr("Eastern"), "E", false); - hemisphere->addSelection(DeviceTree::tr("Western"), "W", true); - hemisphere->setHelpText(help); + m_numeric->setLabel(DeviceTree::tr("Longitude (degrees)")); + m_numeric->setHelpText(help); + m_hemisphere->setLabel(DeviceTree::tr("Hemisphere")); + m_hemisphere->addSelection(DeviceTree::tr("Eastern"), "E", false); + m_hemisphere->addSelection(DeviceTree::tr("Western"), "W", true); + m_hemisphere->setHelpText(help); - addChild(numeric); - addChild(hemisphere); + addChild(m_numeric); + addChild(m_hemisphere); - addChild(new RotorConfig(static_cast<DiSEqCDevRotor&>(node), this)); + addChild(new RotorConfig(static_cast<DiSEqCDevRotor&>(m_node), this)); } void Load(void) override // StandardSetting @@ -1297,23 +1297,23 @@ class USALSRotorSetting : public GroupSetting double val = m_settings.GetValue(m_node.GetDeviceID()); QString hemi; double eval = AngleToEdit(val, hemi); - numeric->setValue(QString::number(eval)); - hemisphere->setValue(hemisphere->getValueIndex(hemi)); + m_numeric->setValue(QString::number(eval)); + m_hemisphere->setValue(m_hemisphere->getValueIndex(hemi)); GroupSetting::Load(); } void Save(void) override // StandardSetting { - QString val = QString::number(numeric->getValue().toDouble()); - val += hemisphere->getValue(); + QString val = QString::number(m_numeric->getValue().toDouble()); + val += m_hemisphere->getValue(); m_settings.SetValue(m_node.GetDeviceID(), AngleToFloat(val, false)); } private: - TransTextEditSetting *numeric; - TransMythUIComboBoxSetting *hemisphere; - DiSEqCDevDevice &m_node; - DiSEqCDevSettings &m_settings; + TransTextEditSetting *m_numeric {nullptr}; + TransMythUIComboBoxSetting *m_hemisphere {nullptr}; + DiSEqCDevDevice &m_node; + DiSEqCDevSettings &m_settings; }; //////////////////////////////////////// SCRPositionSetting @@ -1353,7 +1353,7 @@ class SCRPositionSetting : public MythUIComboBoxSetting DTVDeviceConfigGroup::DTVDeviceConfigGroup( DiSEqCDevSettings &settings, uint cardid, bool switches_enabled) : - m_settings(settings), m_switches_enabled(switches_enabled) + m_settings(settings), m_switchesEnabled(switches_enabled) { setLabel(DeviceTree::tr("DTV Device Configuration")); @@ -1375,11 +1375,11 @@ void DTVDeviceConfigGroup::AddNodes( { case DiSEqCDevDevice::kTypeSwitch: setting = new SwitchSetting(*node, m_settings); - setting->setEnabled(m_switches_enabled); + setting->setEnabled(m_switchesEnabled); break; case DiSEqCDevDevice::kTypeRotor: { - DiSEqCDevRotor *rotor = dynamic_cast<DiSEqCDevRotor*>(node); + auto *rotor = dynamic_cast<DiSEqCDevRotor*>(node); if (rotor && (rotor->GetType() == DiSEqCDevRotor::kTypeDiSEqC_1_2)) setting = new RotorSetting(*node, m_settings); else diff --git a/mythtv/libs/libmythtv/diseqcsettings.h b/mythtv/libs/libmythtv/diseqcsettings.h index 164bf30ec98..84a199c0015 100644 --- a/mythtv/libs/libmythtv/diseqcsettings.h +++ b/mythtv/libs/libmythtv/diseqcsettings.h @@ -10,7 +10,7 @@ #include "diseqc.h" #include "standardsettings.h" -typedef QMap<uint, StandardSetting*> devid_to_setting_t; +using devid_to_setting_t = QMap<uint, StandardSetting*>; class SwitchTypeSetting; class SwitchPortsSetting; @@ -119,10 +119,10 @@ class LNBConfig : public DiseqcConfigBase private: LNBPresetSetting *m_preset {nullptr}; LNBTypeSetting *m_type {nullptr}; - LNBLOFSwitchSetting *m_lof_switch {nullptr}; - LNBLOFLowSetting *m_lof_lo {nullptr}; - LNBLOFHighSetting *m_lof_hi {nullptr}; - LNBPolarityInvertedSetting *m_pol_inv {nullptr}; + LNBLOFSwitchSetting *m_lofSwitch {nullptr}; + LNBLOFLowSetting *m_lofLo {nullptr}; + LNBLOFHighSetting *m_lofHi {nullptr}; + LNBPolarityInvertedSetting *m_polInv {nullptr}; }; class DeviceTypeSetting; @@ -172,14 +172,14 @@ class DTVDeviceConfigGroup : public GroupSetting void AddNodes(StandardSetting *group, const QString &trigger, DiSEqCDevDevice *node); - void AddChild(StandardSetting *group, const QString &trigger, - StandardSetting *setting); + static void AddChild(StandardSetting *group, const QString &trigger, + StandardSetting *setting); private: DiSEqCDevTree m_tree; DiSEqCDevSettings &m_settings; devid_to_setting_t m_devs; - bool m_switches_enabled; + bool m_switchesEnabled; }; #endif // _DISEQCSETTINGS_H_ diff --git a/mythtv/libs/libmythtv/driveroption.h b/mythtv/libs/libmythtv/driveroption.h index 437bbfd7366..7be984c63d8 100644 --- a/mythtv/libs/libmythtv/driveroption.h +++ b/mythtv/libs/libmythtv/driveroption.h @@ -16,8 +16,8 @@ struct DriverOption enum type_t { UNKNOWN_TYPE, INTEGER, BOOLEAN, STRING, MENU, BUTTON, BITMASK }; - typedef QMap<int, QString> menu_t; - typedef QMap<category_t, DriverOption> Options; + using menu_t = QMap<int, QString>; + using Options = QMap<category_t, DriverOption>; DriverOption(void) = default; ~DriverOption(void) = default; @@ -26,7 +26,7 @@ struct DriverOption category_t m_category {UNKNOWN_CAT}; int32_t m_minimum {0}; int32_t m_maximum {0}; - int32_t m_default_value {0}; + int32_t m_defaultValue {0}; int32_t m_current {0}; uint32_t m_step {0}; uint32_t m_flags {0}; diff --git a/mythtv/libs/libmythtv/dtvconfparser.cpp b/mythtv/libs/libmythtv/dtvconfparser.cpp index 4fe85fff10b..90f85b8fc2e 100644 --- a/mythtv/libs/libmythtv/dtvconfparser.cpp +++ b/mythtv/libs/libmythtv/dtvconfparser.cpp @@ -134,11 +134,11 @@ bool DTVConfParser::ParseConfOFDM(const QStringList &tokens) PARSE_UINT(mux.m_frequency); PARSE_CONF(mux.m_inversion); PARSE_CONF(mux.m_bandwidth); - PARSE_CONF(mux.m_hp_code_rate); - PARSE_CONF(mux.m_lp_code_rate); + PARSE_CONF(mux.m_hpCodeRate); + PARSE_CONF(mux.m_lpCodeRate); PARSE_CONF(mux.m_modulation); - PARSE_CONF(mux.m_trans_mode); - PARSE_CONF(mux.m_guard_interval); + PARSE_CONF(mux.m_transMode); + PARSE_CONF(mux.m_guardInterval); PARSE_CONF(mux.m_hierarchy); PARSE_SKIP(unknown); PARSE_SKIP(unknown); @@ -244,19 +244,19 @@ bool DTVConfParser::ParseVDR(const QStringList &tokens, int channelNo) mux.m_bandwidth.ParseVDR(params); break; case 'C': - mux.m_hp_code_rate.ParseVDR(params); + mux.m_hpCodeRate.ParseVDR(params); break; case 'D': - mux.m_lp_code_rate.ParseVDR(params); + mux.m_lpCodeRate.ParseVDR(params); break; case 'M': mux.m_modulation.ParseVDR(params); break; case 'T': - mux.m_trans_mode.ParseVDR(params); + mux.m_transMode.ParseVDR(params); break; case 'G': - mux.m_guard_interval.ParseVDR(params); + mux.m_guardInterval.ParseVDR(params); break; case 'Y': mux.m_hierarchy.ParseVDR(params); @@ -268,7 +268,7 @@ bool DTVConfParser::ParseVDR(const QStringList &tokens, int channelNo) mux.m_polarity.ParseVDR(ori); break; case 'S': - mux.m_mod_sys.ParseVDR(params); + mux.m_modSys.ParseVDR(params); break; case 'O': mux.m_rolloff.ParseVDR(params); diff --git a/mythtv/libs/libmythtv/dtvconfparser.h b/mythtv/libs/libmythtv/dtvconfparser.h index c387d52decb..72cb8d3f5a9 100644 --- a/mythtv/libs/libmythtv/dtvconfparser.h +++ b/mythtv/libs/libmythtv/dtvconfparser.h @@ -57,7 +57,7 @@ class DTVChannelInfo uint m_serviceid {0}; int m_lcn {-1}; }; -typedef vector<DTVChannelInfo> DTVChannelInfoList; +using DTVChannelInfoList = vector<DTVChannelInfo>; class DTVTransport : public DTVMultiplex { @@ -67,7 +67,7 @@ class DTVTransport : public DTVMultiplex public: DTVChannelInfoList channels; }; -typedef vector<DTVTransport> DTVChannelList; +using DTVChannelList = vector<DTVTransport>; /** \class DTVConfParser * \brief Parses dvb-utils channel scanner output files. diff --git a/mythtv/libs/libmythtv/dtvconfparserhelpers.h b/mythtv/libs/libmythtv/dtvconfparserhelpers.h index 45be182898f..2e5789b9074 100644 --- a/mythtv/libs/libmythtv/dtvconfparserhelpers.h +++ b/mythtv/libs/libmythtv/dtvconfparserhelpers.h @@ -53,12 +53,12 @@ struct DTVParamHelperStruct class DTVParamHelper { public: - explicit DTVParamHelper(int _value) : value(_value) { } - DTVParamHelper &operator=(int _value) { value = _value; return *this; } + explicit DTVParamHelper(int _value) : m_value(_value) { } + DTVParamHelper &operator=(int _value) { m_value = _value; return *this; } - operator int() const { return value; } - bool operator==(const int& v) const { return value == v; } - bool operator!=(const int& v) const { return value != v; } + operator int() const { return m_value; } + bool operator==(const int& v) const { return m_value == v; } + bool operator!=(const int& v) const { return m_value != v; } protected: static bool ParseParam(const QString &symbol, int &value, @@ -68,7 +68,7 @@ class DTVParamHelper uint strings_size); protected: - int value; + int m_value; }; class DTVTunerType : public DTVParamHelper @@ -124,32 +124,32 @@ class DTVTunerType : public DTVParamHelper explicit DTVTunerType(int _default = kTunerTypeUnknown) : DTVParamHelper(_default) { initStr(); } - DTVTunerType& operator=(int type) { value = type; return *this; } + DTVTunerType& operator=(int type) { m_value = type; return *this; } bool Parse(const QString &_value) - { return ParseParam(_value, value, s_parseTable); } + { return ParseParam(_value, m_value, s_parseTable); } bool IsFECVariable(void) const { - return ((kTunerTypeDVBC == value) || - (kTunerTypeDVBS1 == value) || - (kTunerTypeDVBS2 == value)); + return ((kTunerTypeDVBC == m_value) || + (kTunerTypeDVBS1 == m_value) || + (kTunerTypeDVBS2 == m_value)); } bool IsModulationVariable(void) const { - return ((kTunerTypeDVBC == value) || - (kTunerTypeATSC == value) || - (kTunerTypeDVBS2 == value)); + return ((kTunerTypeDVBC == m_value) || + (kTunerTypeATSC == m_value) || + (kTunerTypeDVBS2 == m_value)); } bool IsDiSEqCSupported(void) const { - return ((kTunerTypeDVBS1 == value) || - (kTunerTypeDVBS2 == value)); + return ((kTunerTypeDVBS1 == m_value) || + (kTunerTypeDVBS2 == m_value)); } - QString toString() const { return toString(value); } + QString toString() const { return toString(m_value); } static void initStr(void); static QString toString(int _value); @@ -180,25 +180,25 @@ class DTVInversion : public DTVParamHelper explicit DTVInversion(Types _default = kInversionAuto) : DTVParamHelper(_default) { } DTVInversion& operator=(const Types _value) - { value = _value; return *this; } + { m_value = _value; return *this; } #ifdef USING_DVB DTVInversion& operator=(const fe_spectral_inversion_t type) - { value = type; return *this; } + { m_value = type; return *this; } #endif bool IsCompatible(const DTVInversion &other) const - { return value == other.value || value == kInversionAuto || - other.value == kInversionAuto; + { return m_value == other.m_value || m_value == kInversionAuto || + other.m_value == kInversionAuto; } bool ParseConf(const QString &_value) - { return ParseParam(_value, value, s_confTable); } + { return ParseParam(_value, m_value, s_confTable); } bool ParseVDR(const QString &_value) - { return ParseParam(_value, value, s_vdrTable); } + { return ParseParam(_value, m_value, s_vdrTable); } bool Parse(const QString &_value) - { return ParseParam(_value, value, s_parseTable); } + { return ParseParam(_value, m_value, s_parseTable); } - QString toString() const { return toString(value); } + QString toString() const { return toString(m_value); } QChar toChar() const { if (toString().length() > 0) return toString()[0]; else return QChar(0); } @@ -233,25 +233,25 @@ class DTVBandwidth : public DTVParamHelper explicit DTVBandwidth(Types _default = kBandwidthAuto) : DTVParamHelper(_default) { } DTVBandwidth& operator=(const Types _value) - { value = _value; return *this; } + { m_value = _value; return *this; } #ifdef USING_DVB DTVBandwidth& operator=(const fe_bandwidth_t bwidth) - { value = bwidth; return *this; } + { m_value = bwidth; return *this; } #endif bool IsCompatible(const DTVBandwidth &other) const - { return value == other.value || value == kBandwidthAuto || - other.value == kBandwidthAuto; + { return m_value == other.m_value || m_value == kBandwidthAuto || + other.m_value == kBandwidthAuto; } bool ParseConf(const QString &_value) - { return ParseParam(_value, value, s_confTable); } + { return ParseParam(_value, m_value, s_confTable); } bool ParseVDR(const QString &_value) - { return ParseParam(_value, value, s_vdrTable); } + { return ParseParam(_value, m_value, s_vdrTable); } bool Parse(const QString &_value) - { return ParseParam(_value, value, s_parseTable); } + { return ParseParam(_value, m_value, s_parseTable); } - QString toString() const { return toString(value); } + QString toString() const { return toString(m_value); } QChar toChar() const { if (toString().length() > 0) return toString()[0]; else return QChar(0); } @@ -294,25 +294,25 @@ class DTVCodeRate : public DTVParamHelper explicit DTVCodeRate(Types _default = kFECAuto) : DTVParamHelper(_default) { } DTVCodeRate& operator=(const Types _value) - { value = _value; return *this; } + { m_value = _value; return *this; } #ifdef USING_DVB DTVCodeRate& operator=(const fe_code_rate_t rate) - { value = rate; return *this; } + { m_value = rate; return *this; } #endif bool IsCompatible(const DTVCodeRate &other) const - { return value == other.value || value == kFECAuto || - other.value == kFECAuto; + { return m_value == other.m_value || m_value == kFECAuto || + other.m_value == kFECAuto; } bool ParseConf(const QString &_value) - { return ParseParam(_value, value, s_confTable); } + { return ParseParam(_value, m_value, s_confTable); } bool ParseVDR(const QString &_value) - { return ParseParam(_value, value, s_vdrTable); } + { return ParseParam(_value, m_value, s_vdrTable); } bool Parse(const QString &_value) - { return ParseParam(_value, value, s_parseTable); } + { return ParseParam(_value, m_value, s_parseTable); } - QString toString() const { return toString(value); } + QString toString() const { return toString(m_value); } static QString toString(int _value) { return DTVParamHelper::toString(s_dbStr, _value, kDBStrCnt); } @@ -355,25 +355,25 @@ class DTVModulation : public DTVParamHelper explicit DTVModulation(Types _default = kModulationQAMAuto) : DTVParamHelper(_default) { } DTVModulation& operator=(const Types _value) - { value = _value; return *this; } + { m_value = _value; return *this; } #ifdef USING_DVB DTVModulation& operator=(const fe_modulation_t modulation) - { value = modulation; return *this; } + { m_value = modulation; return *this; } #endif bool IsCompatible(const DTVModulation &other) const - { return value == other.value || value == kModulationQAMAuto || - other.value == kModulationQAMAuto; + { return m_value == other.m_value || m_value == kModulationQAMAuto || + other.m_value == kModulationQAMAuto; } bool ParseConf(const QString &_value) - { return ParseParam(_value, value, s_confTable); } + { return ParseParam(_value, m_value, s_confTable); } bool ParseVDR(const QString &_value) - { return ParseParam(_value, value, s_vdrTable); } + { return ParseParam(_value, m_value, s_vdrTable); } bool Parse(const QString &_value) - { return ParseParam(_value, value, s_parseTable); } + { return ParseParam(_value, m_value, s_parseTable); } - QString toString() const { return toString(value); } + QString toString() const { return toString(m_value); } static QString toString(int _value) { @@ -410,25 +410,25 @@ class DTVTransmitMode : public DTVParamHelper explicit DTVTransmitMode(Types _default = kTransmissionModeAuto) : DTVParamHelper(_default) { } DTVTransmitMode& operator=(const Types _value) - { value = _value; return *this; } + { m_value = _value; return *this; } #ifdef USING_DVB DTVTransmitMode& operator=(const fe_transmit_mode_t mode) - { value = mode; return *this; } + { m_value = mode; return *this; } #endif bool IsCompatible(const DTVTransmitMode &other) const - { return value == other.value || value == kTransmissionModeAuto || - other.value == kTransmissionModeAuto; + { return m_value == other.m_value || m_value == kTransmissionModeAuto || + other.m_value == kTransmissionModeAuto; } bool ParseConf(const QString &_value) - { return ParseParam(_value, value, s_confTable); } + { return ParseParam(_value, m_value, s_confTable); } bool ParseVDR(const QString &_value) - { return ParseParam(_value, value, s_vdrTable); } + { return ParseParam(_value, m_value, s_vdrTable); } bool Parse(const QString &_value) - { return ParseParam(_value, value, s_parseTable); } + { return ParseParam(_value, m_value, s_parseTable); } - QString toString() const { return toString(value); } + QString toString() const { return toString(m_value); } QChar toChar() const { if (toString().length() > 0) return toString()[0]; else return QChar(0); } @@ -464,25 +464,25 @@ class DTVGuardInterval : public DTVParamHelper explicit DTVGuardInterval(Types _default = kGuardIntervalAuto) : DTVParamHelper(_default) { } DTVGuardInterval& operator=(const Types _value) - { value = _value; return *this; } + { m_value = _value; return *this; } #ifdef USING_DVB DTVGuardInterval& operator=(const fe_guard_interval_t interval) - { value = interval; return *this; } + { m_value = interval; return *this; } #endif bool IsCompatible(const DTVGuardInterval &other) const - { return value == other.value || value == kGuardIntervalAuto || - other.value == kGuardIntervalAuto; + { return m_value == other.m_value || m_value == kGuardIntervalAuto || + other.m_value == kGuardIntervalAuto; } bool ParseConf(const QString &_value) - { return ParseParam(_value, value, s_confTable); } + { return ParseParam(_value, m_value, s_confTable); } bool ParseVDR(const QString &_value) - { return ParseParam(_value, value, s_vdrTable); } + { return ParseParam(_value, m_value, s_vdrTable); } bool Parse(const QString &_value) - { return ParseParam(_value, value, s_parseTable); } + { return ParseParam(_value, m_value, s_parseTable); } - QString toString() const { return toString(value); } + QString toString() const { return toString(m_value); } static QString toString(int _value) { return DTVParamHelper::toString(s_dbStr, _value, kDBStrCnt); } @@ -515,25 +515,25 @@ class DTVHierarchy : public DTVParamHelper explicit DTVHierarchy(Types _default = kHierarchyAuto) : DTVParamHelper(_default) { } DTVHierarchy& operator=(const Types _value) - { value = _value; return *this; } + { m_value = _value; return *this; } #ifdef USING_DVB DTVHierarchy& operator=(const fe_hierarchy_t hierarchy) - { value = hierarchy; return *this; } + { m_value = hierarchy; return *this; } #endif bool IsCompatible(const DTVHierarchy &other) const - { return value == other.value || value == kHierarchyAuto || - other.value == kHierarchyAuto; + { return m_value == other.m_value || m_value == kHierarchyAuto || + other.m_value == kHierarchyAuto; } bool ParseConf(const QString &_value) - { return ParseParam(_value, value, s_confTable); } + { return ParseParam(_value, m_value, s_confTable); } bool ParseVDR(const QString &_value) - { return ParseParam(_value, value, s_vdrTable); } + { return ParseParam(_value, m_value, s_vdrTable); } bool Parse(const QString &_value) - { return ParseParam(_value, value, s_parseTable); } + { return ParseParam(_value, m_value, s_parseTable); } - QString toString() const { return toString(value); } + QString toString() const { return toString(m_value); } QChar toChar() const { if (toString().length() > 0) return toString()[0]; else return QChar(0); } @@ -561,16 +561,16 @@ class DTVPolarity : public DTVParamHelper explicit DTVPolarity(PolarityValues _default = kPolarityVertical) : DTVParamHelper(_default) { } DTVPolarity& operator=(const PolarityValues _value) - { value = _value; return *this; } + { m_value = _value; return *this; } bool ParseConf(const QString &_value) - { return ParseParam(_value, value, s_parseTable); } + { return ParseParam(_value, m_value, s_parseTable); } bool ParseVDR(const QString &_value) - { return ParseParam(_value, value, s_parseTable); } + { return ParseParam(_value, m_value, s_parseTable); } bool Parse(const QString &_value) - { return ParseParam(_value, value, s_parseTable); } + { return ParseParam(_value, m_value, s_parseTable); } - QString toString() const { return toString(value); } + QString toString() const { return toString(m_value); } QChar toChar() const { if (toString().length() > 0) return toString()[0]; else return QChar(0); } @@ -621,26 +621,26 @@ class DTVModulationSystem : public DTVParamHelper explicit DTVModulationSystem(Types _default = kModulationSystem_UNDEFINED) : DTVParamHelper(_default) { } DTVModulationSystem& operator=(const Types _value) - { value = _value; return *this; } + { m_value = _value; return *this; } #ifdef USING_DVB DTVModulationSystem& operator=(fe_delivery_system_t type) - { value = type; return *this; } + { m_value = type; return *this; } #endif bool IsCompatible(const DTVModulationSystem &other) const { return - (value == other.value) || - (value == kModulationSystem_DVBT && other.value == kModulationSystem_DVBT2) || - (value == kModulationSystem_DVBT2 && other.value == kModulationSystem_DVBT); + (m_value == other.m_value) || + (m_value == kModulationSystem_DVBT && other.m_value == kModulationSystem_DVBT2) || + (m_value == kModulationSystem_DVBT2 && other.m_value == kModulationSystem_DVBT); } bool ParseConf(const QString &_value) - { return ParseParam(_value, value, s_confTable); } + { return ParseParam(_value, m_value, s_confTable); } bool ParseVDR(const QString &_value) - { return ParseParam(_value, value, s_vdrTable); } + { return ParseParam(_value, m_value, s_vdrTable); } bool Parse(const QString &_value) - { return ParseParam(_value, value, s_parseTable); } + { return ParseParam(_value, m_value, s_parseTable); } - QString toString() const { return toString(value); } + QString toString() const { return toString(m_value); } static QString toString(int _value) { return DTVParamHelper::toString(s_dbStr, _value, kDBStrCnt); } @@ -672,25 +672,25 @@ class DTVRollOff : public DTVParamHelper explicit DTVRollOff(Types _default = kRollOff_35) : DTVParamHelper(_default) { } DTVRollOff& operator=(const Types _value) - { value = _value; return *this; } + { m_value = _value; return *this; } #ifdef USING_DVB DTVRollOff& operator=(fe_rolloff_t type) - { value = type; return *this; } + { m_value = type; return *this; } #endif bool IsCompatible(const DTVRollOff &other) const - { return value == other.value || value == kRollOff_Auto || - other.value == kRollOff_Auto; + { return m_value == other.m_value || m_value == kRollOff_Auto || + other.m_value == kRollOff_Auto; } bool ParseConf(const QString &_value) - { return ParseParam(_value, value, s_confTable); } + { return ParseParam(_value, m_value, s_confTable); } bool ParseVDR(const QString &_value) - { return ParseParam(_value, value, s_vdrTable); } + { return ParseParam(_value, m_value, s_vdrTable); } bool Parse(const QString &_value) - { return ParseParam(_value, value, s_parseTable); } + { return ParseParam(_value, m_value, s_parseTable); } - QString toString() const { return toString(value); } + QString toString() const { return toString(m_value); } static QString toString(int _value) { return DTVParamHelper::toString(s_dbStr, _value, kDBStrCnt); } diff --git a/mythtv/libs/libmythtv/dtvmultiplex.cpp b/mythtv/libs/libmythtv/dtvmultiplex.cpp index 9c4c0829c26..34dba71ce15 100644 --- a/mythtv/libs/libmythtv/dtvmultiplex.cpp +++ b/mythtv/libs/libmythtv/dtvmultiplex.cpp @@ -15,16 +15,16 @@ bool DTVMultiplex::operator==(const DTVMultiplex &m) const (m_modulation == m.m_modulation) && (m_inversion == m.m_inversion) && (m_bandwidth == m.m_bandwidth) && - (m_hp_code_rate == m.m_hp_code_rate) && - (m_lp_code_rate == m.m_lp_code_rate) && - (m_trans_mode == m.m_trans_mode) && - (m_guard_interval == m.m_guard_interval) && + (m_hpCodeRate == m.m_hpCodeRate) && + (m_lpCodeRate == m.m_lpCodeRate) && + (m_transMode == m.m_transMode) && + (m_guardInterval == m.m_guardInterval) && (m_fec == m.m_fec) && - (m_mod_sys == m.m_mod_sys) && + (m_modSys == m.m_modSys) && (m_rolloff == m.m_rolloff) && (m_polarity == m.m_polarity) && (m_hierarchy == m.m_hierarchy) && - (m_iptv_tuning == m.m_iptv_tuning) + (m_iptvTuning == m.m_iptvTuning) ); } @@ -37,12 +37,12 @@ QString DTVMultiplex::toString() const .arg(m_frequency).arg(m_modulation.toString()).arg(m_inversion.toString()); ret += QString("%1 %2 %3 %4 %5 %6 %7") - .arg(m_hp_code_rate.toString()).arg(m_lp_code_rate.toString()) - .arg(m_bandwidth.toString()).arg(m_trans_mode.toString()) - .arg(m_guard_interval.toString()).arg(m_hierarchy.toString()) + .arg(m_hpCodeRate.toString()).arg(m_lpCodeRate.toString()) + .arg(m_bandwidth.toString()).arg(m_transMode.toString()) + .arg(m_guardInterval.toString()).arg(m_hierarchy.toString()) .arg(m_polarity.toString()); ret += QString(" fec: %1 msys: %2 rolloff: %3") - .arg(m_fec.toString()).arg(m_mod_sys.toString()).arg(m_rolloff.toString()); + .arg(m_fec.toString()).arg(m_modSys.toString()).arg(m_rolloff.toString()); return ret; } @@ -78,23 +78,23 @@ bool DTVMultiplex::IsEqual(DTVTunerType type, const DTVMultiplex &other, return m_inversion.IsCompatible(other.m_inversion) && m_bandwidth.IsCompatible(other.m_bandwidth) && - m_hp_code_rate.IsCompatible(other.m_hp_code_rate) && - m_lp_code_rate.IsCompatible(other.m_lp_code_rate) && + m_hpCodeRate.IsCompatible(other.m_hpCodeRate) && + m_lpCodeRate.IsCompatible(other.m_lpCodeRate) && m_modulation.IsCompatible(other.m_modulation) && - m_guard_interval.IsCompatible(other.m_guard_interval) && - m_trans_mode.IsCompatible(other.m_trans_mode) && + m_guardInterval.IsCompatible(other.m_guardInterval) && + m_transMode.IsCompatible(other.m_transMode) && m_hierarchy.IsCompatible(other.m_hierarchy) && - m_mod_sys.IsCompatible(other.m_mod_sys); + m_modSys.IsCompatible(other.m_modSys); return (m_inversion == other.m_inversion) && (m_bandwidth == other.m_bandwidth) && - (m_hp_code_rate == other.m_hp_code_rate) && - (m_lp_code_rate == other.m_lp_code_rate) && + (m_hpCodeRate == other.m_hpCodeRate) && + (m_lpCodeRate == other.m_lpCodeRate) && (m_modulation == other.m_modulation) && - (m_guard_interval == other.m_guard_interval) && - (m_trans_mode == other.m_trans_mode) && + (m_guardInterval == other.m_guardInterval) && + (m_transMode == other.m_transMode) && (m_hierarchy == other.m_hierarchy) && - (m_mod_sys == other.m_mod_sys); + (m_modSys == other.m_modSys); } if (DTVTunerType::kTunerTypeATSC == type) @@ -110,7 +110,7 @@ bool DTVMultiplex::IsEqual(DTVTunerType type, const DTVMultiplex &other, bool ret = (m_symbolrate == other.m_symbolrate) && (m_polarity == other.m_polarity) && - (m_mod_sys == other.m_mod_sys); + (m_modSys == other.m_modSys); if (fuzzy) return ret && @@ -125,7 +125,7 @@ bool DTVMultiplex::IsEqual(DTVTunerType type, const DTVMultiplex &other, if (DTVTunerType::kTunerTypeIPTV == type) { - return (m_iptv_tuning == other.m_iptv_tuning); + return (m_iptvTuning == other.m_iptvTuning); } return false; @@ -171,14 +171,14 @@ bool DTVMultiplex::ParseDVB_T( ok = true; } - ok &= m_mod_sys.Parse("DVB-T"); + ok &= m_modSys.Parse("DVB-T"); ok &= m_bandwidth.Parse(_bandwidth); - ok &= m_hp_code_rate.Parse(_coderate_hp); - ok &= m_lp_code_rate.Parse(_coderate_lp); + ok &= m_hpCodeRate.Parse(_coderate_hp); + ok &= m_lpCodeRate.Parse(_coderate_lp); ok &= m_modulation.Parse(_modulation); - ok &= m_trans_mode.Parse(_trans_mode); + ok &= m_transMode.Parse(_trans_mode); ok &= m_hierarchy.Parse(_hierarchy); - ok &= m_guard_interval.Parse(_guard_interval); + ok &= m_guardInterval.Parse(_guard_interval); if (ok) m_frequency = _frequency.toInt(&ok); @@ -228,7 +228,7 @@ bool DTVMultiplex::ParseDVB_S( { bool ok = ParseDVB_S_and_C(_frequency, _inversion, _symbol_rate, _fec_inner, _modulation, _polarity); - m_mod_sys = DTVModulationSystem::kModulationSystem_DVBS; + m_modSys = DTVModulationSystem::kModulationSystem_DVBS; return ok; } @@ -241,20 +241,20 @@ bool DTVMultiplex::ParseDVB_C( bool ok = ParseDVB_S_and_C(_frequency, _inversion, _symbol_rate, _fec_inner, _modulation, _polarity); - m_mod_sys.Parse(_mod_sys); - if (DTVModulationSystem::kModulationSystem_UNDEFINED == m_mod_sys) + m_modSys.Parse(_mod_sys); + if (DTVModulationSystem::kModulationSystem_UNDEFINED == m_modSys) { - m_mod_sys = DTVModulationSystem::kModulationSystem_DVBC_ANNEX_A; + m_modSys = DTVModulationSystem::kModulationSystem_DVBC_ANNEX_A; } LOG(VB_GENERAL, LOG_DEBUG, LOC + QString("%1 ").arg(__FUNCTION__) + QString("_mod_sys:%1 ok:%2 ").arg(_mod_sys).arg(ok) + - QString("m_mod_sys:%1 %2 ").arg(m_mod_sys).arg(m_mod_sys.toString())); + QString("m_mod_sys:%1 %2 ").arg(m_modSys).arg(m_modSys.toString())); - if ((DTVModulationSystem::kModulationSystem_DVBC_ANNEX_A != m_mod_sys) && - (DTVModulationSystem::kModulationSystem_DVBC_ANNEX_B != m_mod_sys) && - (DTVModulationSystem::kModulationSystem_DVBC_ANNEX_C != m_mod_sys)) + if ((DTVModulationSystem::kModulationSystem_DVBC_ANNEX_A != m_modSys) && + (DTVModulationSystem::kModulationSystem_DVBC_ANNEX_B != m_modSys) && + (DTVModulationSystem::kModulationSystem_DVBC_ANNEX_C != m_modSys)) { LOG(VB_GENERAL, LOG_ERR, LOC + "Unsupported DVB-C modulation system " + QString("parameter '%1', aborting.").arg(_mod_sys)); @@ -273,7 +273,7 @@ bool DTVMultiplex::ParseDVB_S2( bool ok = ParseDVB_S_and_C(_frequency, _inversion, _symbol_rate, _fec_inner, _modulation, _polarity); - if (!m_mod_sys.Parse(_mod_sys)) + if (!m_modSys.Parse(_mod_sys)) { LOG(VB_GENERAL, LOG_ERR, LOC + "Invalid DVB-S2 modulation system " + QString("parameter '%1', aborting.").arg(_mod_sys)); @@ -281,15 +281,15 @@ bool DTVMultiplex::ParseDVB_S2( } // For #10153, guess at modulation system based on modulation - if (DTVModulationSystem::kModulationSystem_UNDEFINED == m_mod_sys) + if (DTVModulationSystem::kModulationSystem_UNDEFINED == m_modSys) { - m_mod_sys = (DTVModulation::kModulationQPSK == m_modulation) ? + m_modSys = (DTVModulation::kModulationQPSK == m_modulation) ? DTVModulationSystem::kModulationSystem_DVBS : DTVModulationSystem::kModulationSystem_DVBS2; } - if ((DTVModulationSystem::kModulationSystem_DVBS != m_mod_sys) && - (DTVModulationSystem::kModulationSystem_DVBS2 != m_mod_sys)) + if ((DTVModulationSystem::kModulationSystem_DVBS != m_modSys) && + (DTVModulationSystem::kModulationSystem_DVBS2 != m_modSys)) { LOG(VB_GENERAL, LOG_ERR, LOC + "Unsupported DVB-S2 modulation system " + QString("parameter '%1', aborting.").arg(_mod_sys)); @@ -320,31 +320,31 @@ bool DTVMultiplex::ParseDVB_T2( { LOG(VB_GENERAL, LOG_WARNING, LOC + "Invalid DVB-T2 modulation system " + QString("parameter '%1', using DVB-T2.").arg(_mod_sys)); - m_mod_sys = DTVModulationSystem::kModulationSystem_DVBT2; - l_mod_sys = m_mod_sys.toString(); + m_modSys = DTVModulationSystem::kModulationSystem_DVBT2; + l_mod_sys = m_modSys.toString(); } else if (_mod_sys == "0") { LOG(VB_GENERAL, LOG_WARNING, LOC + "Invalid DVB-T modulation system " + QString("parameter '%1', using DVB-T.").arg(_mod_sys)); - m_mod_sys = DTVModulationSystem::kModulationSystem_DVBT; - l_mod_sys = m_mod_sys.toString(); + m_modSys = DTVModulationSystem::kModulationSystem_DVBT; + l_mod_sys = m_modSys.toString(); } - if (!m_mod_sys.Parse(l_mod_sys)) + if (!m_modSys.Parse(l_mod_sys)) { LOG(VB_GENERAL, LOG_WARNING, LOC + "Invalid DVB-T/T2 modulation system " + QString("parameter '%1', aborting.").arg(l_mod_sys)); return false; } - if (m_mod_sys == DTVModulationSystem::kModulationSystem_UNDEFINED) + if (m_modSys == DTVModulationSystem::kModulationSystem_UNDEFINED) { - m_mod_sys = DTVModulationSystem::kModulationSystem_DVBT; + m_modSys = DTVModulationSystem::kModulationSystem_DVBT; } - if ((DTVModulationSystem::kModulationSystem_DVBT != m_mod_sys) && - (DTVModulationSystem::kModulationSystem_DVBT2 != m_mod_sys)) + if ((DTVModulationSystem::kModulationSystem_DVBT != m_modSys) && + (DTVModulationSystem::kModulationSystem_DVBT2 != m_modSys)) { LOG(VB_GENERAL, LOG_ERR, LOC + "Unsupported DVB-T2 modulation system " + QString("parameter '%1', aborting.").arg(l_mod_sys)); @@ -644,13 +644,13 @@ uint ScanDTVTransport::SaveScan(uint scanid) const query.bindValue(":SYMBOLRATE", QString::number(m_symbolrate)); query.bindValue(":FEC", m_fec.toString()); query.bindValue(":POLARITY", m_polarity.toString()); - query.bindValue(":HP_CODE_RATE", m_hp_code_rate.toString()); - query.bindValue(":LP_CODE_RATE", m_lp_code_rate.toString()); + query.bindValue(":HP_CODE_RATE", m_hpCodeRate.toString()); + query.bindValue(":LP_CODE_RATE", m_lpCodeRate.toString()); query.bindValue(":MODULATION", m_modulation.toString()); - query.bindValue(":TRANSMISSION_MODE", m_trans_mode.toString()); - query.bindValue(":GUARD_INTERVAL", m_guard_interval.toString()); + query.bindValue(":TRANSMISSION_MODE", m_transMode.toString()); + query.bindValue(":GUARD_INTERVAL", m_guardInterval.toString()); query.bindValue(":HIERARCHY", m_hierarchy.toString()); - query.bindValue(":MOD_SYS", m_mod_sys.toString()); + query.bindValue(":MOD_SYS", m_modSys.toString()); query.bindValue(":ROLLOFF", m_rolloff.toString()); query.bindValue(":BANDWIDTH", m_bandwidth.toString()); query.bindValue(":SISTANDARD", m_sistandard); diff --git a/mythtv/libs/libmythtv/dtvmultiplex.h b/mythtv/libs/libmythtv/dtvmultiplex.h index d7606157a4c..cb738e33ace 100644 --- a/mythtv/libs/libmythtv/dtvmultiplex.h +++ b/mythtv/libs/libmythtv/dtvmultiplex.h @@ -95,21 +95,21 @@ class MTV_PUBLIC DTVMultiplex uint64_t m_symbolrate {0}; DTVInversion m_inversion; DTVBandwidth m_bandwidth; - DTVCodeRate m_hp_code_rate; ///< High Priority FEC rate - DTVCodeRate m_lp_code_rate; ///< Low Priority FEC rate + DTVCodeRate m_hpCodeRate; ///< High Priority FEC rate + DTVCodeRate m_lpCodeRate; ///< Low Priority FEC rate DTVModulation m_modulation; - DTVTransmitMode m_trans_mode; - DTVGuardInterval m_guard_interval; + DTVTransmitMode m_transMode; + DTVGuardInterval m_guardInterval; DTVHierarchy m_hierarchy; DTVPolarity m_polarity; DTVCodeRate m_fec; ///< Inner Forward Error Correction rate - DTVModulationSystem m_mod_sys; ///< Modulation system + DTVModulationSystem m_modSys; ///< Modulation system DTVRollOff m_rolloff; // Optional additional info uint m_mplex {0}; QString m_sistandard; - IPTVTuningData m_iptv_tuning; + IPTVTuningData m_iptvTuning; }; class MTV_PUBLIC ScanDTVTransport : public DTVMultiplex @@ -138,6 +138,6 @@ class MTV_PUBLIC ScanDTVTransport : public DTVMultiplex uint m_cardid {0}; ChannelInsertInfoList m_channels; }; -typedef vector<ScanDTVTransport> ScanDTVTransportList; +using ScanDTVTransportList = vector<ScanDTVTransport>; #endif // _DTVMULTIPLEX_H_ diff --git a/mythtv/libs/libmythtv/dvdstream.cpp b/mythtv/libs/libmythtv/dvdstream.cpp index 835af150eb4..dc5b216dfdb 100644 --- a/mythtv/libs/libmythtv/dvdstream.cpp +++ b/mythtv/libs/libmythtv/dvdstream.cpp @@ -96,7 +96,7 @@ bool DVDStream::OpenFile(const QString &filename, uint /*retry_ms*/) { // Locate the start block of the requested title uint32_t len; - m_start = UDFFindFile(m_reader, const_cast<char*>(qPrintable(path)), &len); + m_start = UDFFindFile(m_reader, qPrintable(path), &len); if (m_start == 0) { LOG(VB_GENERAL, LOG_ERR, QString("DVDStream(%1) UDFFindFile(%2) failed"). diff --git a/mythtv/libs/libmythtv/dvdstream.h b/mythtv/libs/libmythtv/dvdstream.h index 247abbeb0ff..98346672727 100644 --- a/mythtv/libs/libmythtv/dvdstream.h +++ b/mythtv/libs/libmythtv/dvdstream.h @@ -11,7 +11,7 @@ #include "ringbuffer.h" -typedef struct dvd_reader_s dvd_reader_t; +using dvd_reader_t = struct dvd_reader_s; /** @@ -41,7 +41,7 @@ class MTV_PUBLIC DVDStream : public RingBuffer uint32_t m_start {0}; class BlockRange; - typedef QList<BlockRange> list_t; + using list_t = QList<BlockRange>; list_t m_list; // List of possibly encryoted block ranges uint32_t m_pos {0}; // Current read position (blocks) diff --git a/mythtv/libs/libmythtv/dxva2decoder.cpp b/mythtv/libs/libmythtv/dxva2decoder.cpp index e3842786a5e..0050da01f05 100644 --- a/mythtv/libs/libmythtv/dxva2decoder.cpp +++ b/mythtv/libs/libmythtv/dxva2decoder.cpp @@ -77,11 +77,11 @@ DEFINE_GUID(DXVA2_Intel_ModeH264_C, 0x604F8E66, 0x4951, 0x4c54, 0x88,0xFE,0xAB,0 DEFINE_GUID(DXVA2_Intel_ModeH264_E, 0x604F8E68, 0x4951, 0x4c54, 0x88,0xFE,0xAB,0xD2,0x5C,0x15,0xB3,0xD6); DEFINE_GUID(DXVA2_Intel_ModeVC1_E , 0xBCC5DB6D, 0xA2B6, 0x4AF0, 0xAC,0xE4,0xAD,0xB1,0xF7,0x87,0xBC,0x89); -typedef struct { +struct dxva2_mode { const QString name; const GUID *guid; MythCodecID codec; -} dxva2_mode; +}; static const dxva2_mode dxva2_modes[] = { @@ -160,7 +160,7 @@ bool DXVA2Decoder::Init(MythRenderD3D9* render) return ok; } -typedef HRESULT (__stdcall *DXVA2CreateVideoServicePtr)(IDirect3DDevice9* pDD, +using DXVA2CreateVideoServicePtr = HRESULT (__stdcall *)(IDirect3DDevice9* pDD, REFIID riid, void** ppService); diff --git a/mythtv/libs/libmythtv/eitcache.cpp b/mythtv/libs/libmythtv/eitcache.cpp index 467871c6d25..1bcb84f23e9 100644 --- a/mythtv/libs/libmythtv/eitcache.cpp +++ b/mythtv/libs/libmythtv/eitcache.cpp @@ -239,7 +239,7 @@ event_map_t * EITCache::LoadChannel(uint chanid) return nullptr; } - event_map_t * eventMap = new event_map_t(); + auto *eventMap = new event_map_t(); while (query.next()) { diff --git a/mythtv/libs/libmythtv/eitcache.h b/mythtv/libs/libmythtv/eitcache.h index cda91c32894..6ee1a306101 100644 --- a/mythtv/libs/libmythtv/eitcache.h +++ b/mythtv/libs/libmythtv/eitcache.h @@ -16,8 +16,8 @@ // MythTV headers #include "mythtvexp.h" -typedef QMap<uint, uint64_t> event_map_t; -typedef QMap<uint, event_map_t*> key_map_t; +using event_map_t = QMap<uint, uint64_t>; +using key_map_t = QMap<uint, event_map_t*>; class EITCache { diff --git a/mythtv/libs/libmythtv/eitfixup.cpp b/mythtv/libs/libmythtv/eitfixup.cpp index 118bd75f792..c3f1a3226e7 100644 --- a/mythtv/libs/libmythtv/eitfixup.cpp +++ b/mythtv/libs/libmythtv/eitfixup.cpp @@ -1139,7 +1139,7 @@ void EITFixUp::FixUK(DBEventEIT &event) const /** \fn EITFixUp::FixPBS(DBEventEIT&) const * \brief Use this to standardize PBS ATSC guide in the USA. */ -void EITFixUp::FixPBS(DBEventEIT &event) const +void EITFixUp::FixPBS(DBEventEIT &event) { /* Used for PBS ATSC Subtitles are separated by a colon */ int position = event.m_description.indexOf(':'); @@ -1396,7 +1396,7 @@ void EITFixUp::FixComHem(DBEventEIT &event, bool process_subtitle) const /** \fn EITFixUp::FixAUStar(DBEventEIT&) const * \brief Use this to standardize DVB-S guide in Australia. */ -void EITFixUp::FixAUStar(DBEventEIT &event) const +void EITFixUp::FixAUStar(DBEventEIT &event) { event.m_category = event.m_subtitle; /* Used for DVB-S Subtitles are separated by a colon */ @@ -1412,7 +1412,7 @@ void EITFixUp::FixAUStar(DBEventEIT &event) const /** \fn EITFixUp::FixAUDescription(DBEventEIT&) const * \brief Use this to standardize DVB-T guide in Australia. (fix common annoyances common to most networks) */ -void EITFixUp::FixAUDescription(DBEventEIT &event) const +void EITFixUp::FixAUDescription(DBEventEIT &event) { if (event.m_description.startsWith("[Program data ") || event.m_description.startsWith("[Program info "))//TEN { @@ -1437,7 +1437,7 @@ void EITFixUp::FixAUDescription(DBEventEIT &event) const /** \fn EITFixUp::FixAUNine(DBEventEIT&) const * \brief Use this to standardize DVB-T guide in Australia. (Nine network) */ -void EITFixUp::FixAUNine(DBEventEIT &event) const +void EITFixUp::FixAUNine(DBEventEIT &event) { QRegExp rating("\\((G|PG|M|MA)\\)"); if (rating.indexIn(event.m_description) == 0) @@ -1468,7 +1468,7 @@ void EITFixUp::FixAUNine(DBEventEIT &event) const /** \fn EITFixUp::FixAUSeven(DBEventEIT&) const * \brief Use this to standardize DVB-T guide in Australia. (Seven network) */ -void EITFixUp::FixAUSeven(DBEventEIT &event) const +void EITFixUp::FixAUSeven(DBEventEIT &event) { if (event.m_description.endsWith(" Rpt")) { @@ -2250,7 +2250,7 @@ void EITFixUp::FixNL(DBEventEIT &event) const } -void EITFixUp::FixCategory(DBEventEIT &event) const +void EITFixUp::FixCategory(DBEventEIT &event) { // remove category movie from short events if (event.m_categoryType == ProgramInfo::kCategoryMovie && @@ -2550,7 +2550,7 @@ void EITFixUp::FixStripHTML(DBEventEIT &event) const // as more description field. All the sort-out will happen in the description // field. Also, sometimes the description is just a repeat of the title. If so, // we remove it. -void EITFixUp::FixGreekSubtitle(DBEventEIT &event) const +void EITFixUp::FixGreekSubtitle(DBEventEIT &event) { if (event.m_title == event.m_description) { diff --git a/mythtv/libs/libmythtv/eitfixup.h b/mythtv/libs/libmythtv/eitfixup.h index 995abe87b69..0a0981bc914 100644 --- a/mythtv/libs/libmythtv/eitfixup.h +++ b/mythtv/libs/libmythtv/eitfixup.h @@ -93,14 +93,14 @@ class EITFixUp void FixBellExpressVu(DBEventEIT &event) const; // Canada DVB-S void SetUKSubtitle(DBEventEIT &event) const; void FixUK(DBEventEIT &event) const; // UK DVB-T - void FixPBS(DBEventEIT &event) const; // USA ATSC + static void FixPBS(DBEventEIT &event); // USA ATSC void FixComHem(DBEventEIT &event, bool process_subtitle) const; // Sweden DVB-C - void FixAUStar(DBEventEIT &event) const; // Australia DVB-S + static void FixAUStar(DBEventEIT &event); // Australia DVB-S void FixAUFreeview(DBEventEIT &event) const; // Australia DVB-T - void FixAUNine(DBEventEIT &event) const; - void FixAUSeven(DBEventEIT &event) const; - void FixAUDescription(DBEventEIT &event) const; + static void FixAUNine(DBEventEIT &event); + static void FixAUSeven(DBEventEIT &event); + static void FixAUDescription(DBEventEIT &event); void FixMCA(DBEventEIT &event) const; // MultiChoice Africa DVB-S void FixRTL(DBEventEIT &event) const; // RTL group DVB void FixPRO7(DBEventEIT &event) const; // Pro7/Sat1 Group @@ -109,12 +109,12 @@ class EITFixUp void FixFI(DBEventEIT &event) const; // Finland DVB-T void FixPremiere(DBEventEIT &event) const; // german pay-tv Premiere void FixNL(DBEventEIT &event) const; // Netherlands DVB-C - void FixCategory(DBEventEIT &event) const; // Generic Category fixes + static void FixCategory(DBEventEIT &event); // Generic Category fixes void FixNO(DBEventEIT &event) const; // Norwegian DVB-S void FixNRK_DVBT(DBEventEIT &event) const; // Norwegian NRK DVB-T void FixDK(DBEventEIT &event) const; // Danish YouSee DVB-C void FixStripHTML(DBEventEIT &event) const; // Strip HTML tags - void FixGreekSubtitle(DBEventEIT &event) const; // Greek Nat TV fix + static void FixGreekSubtitle(DBEventEIT &event);// Greek Nat TV fix void FixGreekEIT(DBEventEIT &event) const; void FixGreekCategories(DBEventEIT &event) const; // Greek categories from descr. void FixUnitymedia(DBEventEIT &event) const; // handle cast/crew from Unitymedia diff --git a/mythtv/libs/libmythtv/eithelper.cpp b/mythtv/libs/libmythtv/eithelper.cpp index 9420ce3fb6b..018b5d4ccaf 100644 --- a/mythtv/libs/libmythtv/eithelper.cpp +++ b/mythtv/libs/libmythtv/eithelper.cpp @@ -22,7 +22,7 @@ using namespace std; #include "compat.h" // for gmtime_r on windows. const uint EITHelper::kChunkSize = 20; -EITCache *EITHelper::s_eitcache = new EITCache(); +EITCache *EITHelper::s_eitCache = new EITCache(); static uint get_chan_id_from_db_atsc(uint sourceid, uint atsc_major, uint atsc_minor); @@ -35,27 +35,24 @@ static void init_fixup(FixupMap &fix); #define LOC QString("EITHelper: ") EITHelper::EITHelper() : - eitfixup(new EITFixUp()), - gps_offset(-1 * GPS_LEAP_SECONDS), - sourceid(0), channelid(0), - maxStarttime(QDateTime()), seenEITother(false) + m_eitFixup(new EITFixUp()) { - init_fixup(fixup); + init_fixup(m_fixup); } EITHelper::~EITHelper() { - QMutexLocker locker(&eitList_lock); - while (!db_events.empty()) - delete db_events.dequeue(); + QMutexLocker locker(&m_eitListLock); + while (!m_dbEvents.empty()) + delete m_dbEvents.dequeue(); - delete eitfixup; + delete m_eitFixup; } uint EITHelper::GetListSize(void) const { - QMutexLocker locker(&eitList_lock); - return db_events.size(); + QMutexLocker locker(&m_eitListLock); + return m_dbEvents.size(); } /** \fn EITHelper::ProcessEvents(void) @@ -65,36 +62,36 @@ uint EITHelper::GetListSize(void) const */ uint EITHelper::ProcessEvents(void) { - QMutexLocker locker(&eitList_lock); + QMutexLocker locker(&m_eitListLock); uint insertCount = 0; - if (db_events.empty()) + if (m_dbEvents.empty()) return 0; MSqlQuery query(MSqlQuery::InitCon()); - for (uint i = 0; (i < kChunkSize) && (!db_events.empty()); i++) + for (uint i = 0; (i < kChunkSize) && (!m_dbEvents.empty()); i++) { - DBEventEIT *event = db_events.dequeue(); - eitList_lock.unlock(); + DBEventEIT *event = m_dbEvents.dequeue(); + m_eitListLock.unlock(); - eitfixup->Fix(*event); + m_eitFixup->Fix(*event); insertCount += event->UpdateDB(query, 1000); - maxStarttime = max (maxStarttime, event->m_starttime); + m_maxStarttime = max (m_maxStarttime, event->m_starttime); delete event; - eitList_lock.lock(); + m_eitListLock.lock(); } if (!insertCount) return 0; - if (!incomplete_events.empty()) + if (!m_incompleteEvents.empty()) { LOG(VB_EIT, LOG_INFO, LOC + QString("Added %1 events -- complete: %2 incomplete: %3") - .arg(insertCount).arg(db_events.size()) - .arg(incomplete_events.size())); + .arg(insertCount).arg(m_dbEvents.size()) + .arg(m_incompleteEvents.size())); } else { @@ -105,16 +102,16 @@ uint EITHelper::ProcessEvents(void) return insertCount; } -void EITHelper::SetFixup(uint atsc_major, uint atsc_minor, FixupValue drheitfixup) +void EITHelper::SetFixup(uint atsc_major, uint atsc_minor, FixupValue eitfixup) { - QMutexLocker locker(&eitList_lock); + QMutexLocker locker(&m_eitListLock); FixupKey atsc_key = (atsc_major << 16) | atsc_minor; - fixup[atsc_key] = drheitfixup; + m_fixup[atsc_key] = eitfixup; } void EITHelper::SetLanguagePreferences(const QStringList &langPref) { - QMutexLocker locker(&eitList_lock); + QMutexLocker locker(&m_eitListLock); uint priority = 1; QStringList::const_iterator it; @@ -124,34 +121,34 @@ void EITHelper::SetLanguagePreferences(const QStringList &langPref) { uint language_key = iso639_str3_to_key(*it); uint canonoical_key = iso639_key_to_canonical_key(language_key); - languagePreferences[canonoical_key] = priority++; + m_languagePreferences[canonoical_key] = priority++; } } } void EITHelper::SetSourceID(uint _sourceid) { - QMutexLocker locker(&eitList_lock); - sourceid = _sourceid; + QMutexLocker locker(&m_eitListLock); + m_sourceid = _sourceid; } void EITHelper::SetChannelID(uint _channelid) { - QMutexLocker locker(&eitList_lock); - channelid = _channelid; + QMutexLocker locker(&m_eitListLock); + m_channelid = _channelid; } void EITHelper::AddEIT(uint atsc_major, uint atsc_minor, const EventInformationTable *eit) { uint atsc_key = (atsc_major << 16) | atsc_minor; - EventIDToATSCEvent &events = incomplete_events[atsc_key]; + EventIDToATSCEvent &events = m_incompleteEvents[atsc_key]; for (uint i = 0; i < eit->EventCount(); i++) { ATSCEvent ev(eit->StartTimeRaw(i), eit->LengthInSeconds(i), eit->ETMLocation(i), - eit->title(i).GetBestMatch(languagePreferences), + eit->title(i).GetBestMatch(m_languagePreferences), eit->Descriptors(i), eit->DescriptorsLength(i)); // Create an event immediately if the ETM_location specifies @@ -172,7 +169,7 @@ void EITHelper::AddEIT(uint atsc_major, uint atsc_minor, } // Save the EIT event in the incomplete_events for this channel. - unsigned char *tmp = new unsigned char[ev.m_desc_length]; + auto *tmp = new unsigned char[ev.m_desc_length]; memcpy(tmp, eit->Descriptors(i), ev.m_desc_length); ev.m_desc = tmp; events.insert(eit->EventID(i), ev); @@ -186,8 +183,8 @@ void EITHelper::AddETT(uint atsc_major, uint atsc_minor, // Find the matching incomplete EIT event for this ETT // If we have no EIT event then just discard the ETT. uint atsc_key = (atsc_major << 16) | atsc_minor; - ATSCSRCToEvents::iterator eits_it = incomplete_events.find(atsc_key); - if (eits_it != incomplete_events.end()) + ATSCSRCToEvents::iterator eits_it = m_incompleteEvents.find(atsc_key); + if (eits_it != m_incompleteEvents.end()) { EventIDToATSCEvent::iterator it = (*eits_it).find(ett->EventID()); if (it != (*eits_it).end()) @@ -196,7 +193,7 @@ void EITHelper::AddETT(uint atsc_major, uint atsc_minor, if (!it->IsStale()) { CompleteEvent( atsc_major, atsc_minor, *it, - ett->ExtendedTextMessage().GetBestMatch(languagePreferences)); + ett->ExtendedTextMessage().GetBestMatch(m_languagePreferences)); } // Remove EIT event from the incomplete_event list. @@ -342,19 +339,19 @@ void EITHelper::AddEIT(const DVBEventInformationTable *eit) // do not reschedule if its only present+following if (eit->TableID() != TableID::PF_EITo) { - seenEITother = true; + m_seenEITother = true; } } if (!chanid) return; uint descCompression = (eit->TableID() > 0x80) ? 2 : 1; - FixupValue fix = fixup.value((FixupKey)eit->OriginalNetworkID() << 16); - fix |= fixup.value((((FixupKey)eit->TSID()) << 32) | + FixupValue fix = m_fixup.value((FixupKey)eit->OriginalNetworkID() << 16); + fix |= m_fixup.value((((FixupKey)eit->TSID()) << 32) | ((FixupKey)eit->OriginalNetworkID() << 16)); - fix |= fixup.value(((FixupKey)eit->OriginalNetworkID() << 16) | + fix |= m_fixup.value(((FixupKey)eit->OriginalNetworkID() << 16) | (FixupKey)eit->ServiceID()); - fix |= fixup.value((((FixupKey)eit->TSID()) << 32) | + fix |= m_fixup.value((((FixupKey)eit->TSID()) << 32) | ((FixupKey)eit->OriginalNetworkID() << 16) | (FixupKey)eit->ServiceID()); fix |= EITFixUp::kFixGenericDVB; @@ -364,7 +361,7 @@ void EITHelper::AddEIT(const DVBEventInformationTable *eit) for (uint i = 0; i < eit->EventCount(); i++) { // Skip event if we have already processed it before... - if (!s_eitcache->IsNewEIT(chanid, tableid, version, eit->EventID(i), + if (!s_eitCache->IsNewEIT(chanid, tableid, version, eit->EventID(i), eit->EndTimeUnixUTC(i))) { continue; @@ -408,7 +405,7 @@ void EITHelper::AddEIT(const DVBEventInformationTable *eit) } else { - parse_dvb_event_descriptors(list, fix, languagePreferences, + parse_dvb_event_descriptors(list, fix, m_languagePreferences, title, subtitle, description, items); } @@ -510,7 +507,7 @@ void EITHelper::AddEIT(const DVBEventInformationTable *eit) } else if (EITFixUp::kFixAUDescription & fix)//AU Freeview assigned genres { - static const char *AUGenres[] = + static const char *s_auGenres[] = {/* 0*/"Unknown", "Movie", "News", "Entertainment", /* 4*/"Sport", "Children", "Music", "Arts/Culture", /* 8*/"Current Affairs", "Education", "Infotainment", @@ -519,13 +516,13 @@ void EITHelper::AddEIT(const DVBEventInformationTable *eit) ContentDescriptor content(content_data); if (content.IsValid()) { - category = AUGenres[content.Nibble1(0)]; + category = s_auGenres[content.Nibble1(0)]; category_type = content.GetMythCategory(0); } } else if (EITFixUp::kFixGreekEIT & fix)//Greek { - static const char *GrGenres[] = + static const char *s_grGenres[] = {/* 0*/"Unknown", "Ταινία", "ΕνημεÏωτικό", "Unknown", /* 4*/"Αθλητικό", "Παιδικό", "Unknown", "Unknown", /* 8*/"Unknown", "ÎτοκιμαντέÏ", "Unknown", "Unknown", @@ -533,7 +530,7 @@ void EITHelper::AddEIT(const DVBEventInformationTable *eit) ContentDescriptor content(content_data); if (content.IsValid()) { - category = GrGenres[content.Nibble2(0)]; + category = s_grGenres[content.Nibble2(0)]; category_type = content.GetMythCategory(2); } } @@ -616,7 +613,7 @@ void EITHelper::AddEIT(const DVBEventInformationTable *eit) EITFixUp::TimeFix(starttime); QDateTime endtime = starttime.addSecs(eit->DurationInSeconds(i)); - DBEventEIT *event = new DBEventEIT( + auto *event = new DBEventEIT( chanid, title, subtitle, description, category, category_type, @@ -628,7 +625,7 @@ void EITHelper::AddEIT(const DVBEventInformationTable *eit) season, episode, totalepisodes); event->m_items = items; - db_events.enqueue(event); + m_dbEvents.enqueue(event); } } @@ -637,7 +634,7 @@ void EITHelper::AddEIT(const DVBEventInformationTable *eit) void EITHelper::AddEIT(const PremiereContentInformationTable *cit) { // set fixup for Premiere - FixupValue fix = fixup.value(133 << 16); + FixupValue fix = m_fixup.value(133 << 16); fix |= EITFixUp::kFixGenericDVB; QString title = QString(""); @@ -653,7 +650,7 @@ void EITHelper::AddEIT(const PremiereContentInformationTable *cit) desc_list_t list = MPEGDescriptor::Parse( cit->Descriptors(), cit->DescriptorsLength()); - parse_dvb_event_descriptors(list, fix, languagePreferences, + parse_dvb_event_descriptors(list, fix, m_languagePreferences, title, subtitle, description, items); parse_dvb_component_descriptors(list, subtitle_type, audio_props, @@ -720,7 +717,7 @@ void EITHelper::AddEIT(const PremiereContentInformationTable *cit) } // Skip event if we have already processed it before... - if (!s_eitcache->IsNewEIT(chanid, tableid, version, contentid, endtime)) + if (!s_eitCache->IsNewEIT(chanid, tableid, version, contentid, endtime)) { continue; } @@ -733,7 +730,7 @@ void EITHelper::AddEIT(const PremiereContentInformationTable *cit) EITFixUp::TimeFix(txstart); QDateTime txend = txstart.addSecs(cit->DurationInSeconds()); - DBEventEIT *event = new DBEventEIT( + auto *event = new DBEventEIT( chanid, title, subtitle, description, category, category_type, @@ -745,7 +742,7 @@ void EITHelper::AddEIT(const PremiereContentInformationTable *cit) season, episode, totalepisodes); event->m_items = items; - db_events.enqueue(event); + m_dbEvents.enqueue(event); } } } @@ -753,12 +750,12 @@ void EITHelper::AddEIT(const PremiereContentInformationTable *cit) void EITHelper::PruneEITCache(uint timestamp) { - s_eitcache->PruneOldEntries(timestamp); + s_eitCache->PruneOldEntries(timestamp); } void EITHelper::WriteEITCache(void) { - s_eitcache->WriteToDB(); + s_eitCache->WriteToDB(); } ////////////////////////////////////////////////////////////////////// @@ -775,10 +772,10 @@ void EITHelper::CompleteEvent(uint atsc_major, uint atsc_minor, #if QT_VERSION < QT_VERSION_CHECK(5,8,0) QDateTime starttime = MythDate::fromTime_t( - event.m_start_time + GPS_EPOCH + gps_offset); + event.m_start_time + GPS_EPOCH + m_gpsOffset); #else QDateTime starttime = MythDate::fromSecsSinceEpoch( - event.m_start_time + GPS_EPOCH + gps_offset); + event.m_start_time + GPS_EPOCH + m_gpsOffset); #endif // fix starttime only if the duration is a multiple of a minute @@ -795,28 +792,28 @@ void EITHelper::CompleteEvent(uint atsc_major, uint atsc_minor, uint atsc_key = (atsc_major << 16) | atsc_minor; - QMutexLocker locker(&eitList_lock); + QMutexLocker locker(&m_eitListLock); QString title = event.m_title; const QString& subtitle = ett; - db_events.enqueue(new DBEventEIT(chanid, title, subtitle, + m_dbEvents.enqueue(new DBEventEIT(chanid, title, subtitle, starttime, endtime, - fixup.value(atsc_key), subtitle_type, + m_fixup.value(atsc_key), subtitle_type, audio_properties, video_properties)); } uint EITHelper::GetChanID(uint atsc_major, uint atsc_minor) { uint64_t key; - key = ((uint64_t) sourceid); + key = ((uint64_t) m_sourceid); key |= ((uint64_t) atsc_minor) << 16; key |= ((uint64_t) atsc_major) << 32; - ServiceToChanID::const_iterator it = srv_to_chanid.find(key); - if (it != srv_to_chanid.end()) + ServiceToChanID::const_iterator it = m_srvToChanid.find(key); + if (it != m_srvToChanid.end()) return *it; - uint chanid = get_chan_id_from_db_atsc(sourceid, atsc_major, atsc_minor); - srv_to_chanid[key] = chanid; + uint chanid = get_chan_id_from_db_atsc(m_sourceid, atsc_major, atsc_minor); + m_srvToChanid[key] = chanid; return chanid; } @@ -824,17 +821,17 @@ uint EITHelper::GetChanID(uint atsc_major, uint atsc_minor) uint EITHelper::GetChanID(uint serviceid, uint networkid, uint tsid) { uint64_t key; - key = ((uint64_t) sourceid); + key = ((uint64_t) m_sourceid); key |= ((uint64_t) serviceid) << 16; key |= ((uint64_t) networkid) << 32; key |= ((uint64_t) tsid) << 48; - ServiceToChanID::const_iterator it = srv_to_chanid.find(key); - if (it != srv_to_chanid.end()) + ServiceToChanID::const_iterator it = m_srvToChanid.find(key); + if (it != m_srvToChanid.end()) return *it; - uint chanid = get_chan_id_from_db_dvb(sourceid, serviceid, networkid, tsid); - srv_to_chanid[key] = chanid; + uint chanid = get_chan_id_from_db_dvb(m_sourceid, serviceid, networkid, tsid); + m_srvToChanid[key] = chanid; return chanid; } @@ -842,16 +839,16 @@ uint EITHelper::GetChanID(uint serviceid, uint networkid, uint tsid) uint EITHelper::GetChanID(uint program_number) { uint64_t key; - key = ((uint64_t) sourceid); + key = ((uint64_t) m_sourceid); key |= ((uint64_t) program_number) << 16; - key |= ((uint64_t) channelid) << 32; + key |= ((uint64_t) m_channelid) << 32; - ServiceToChanID::const_iterator it = srv_to_chanid.find(key); - if (it != srv_to_chanid.end()) + ServiceToChanID::const_iterator it = m_srvToChanid.find(key); + if (it != m_srvToChanid.end()) return *it; - uint chanid = get_chan_id_from_db_dtv(sourceid, program_number, channelid); - srv_to_chanid[key] = chanid; + uint chanid = get_chan_id_from_db_dtv(m_sourceid, program_number, m_channelid); + m_srvToChanid[key] = chanid; return chanid; } @@ -1405,8 +1402,8 @@ static void init_fixup(FixupMap &fix) void EITHelper::RescheduleRecordings(void) { ScheduledRecording::RescheduleMatch( - 0, sourceid, seenEITother ? 0 : ChannelUtil::GetMplexID(channelid), - maxStarttime, "EITScanner"); - seenEITother = false; - maxStarttime = QDateTime(); + 0, m_sourceid, m_seenEITother ? 0 : ChannelUtil::GetMplexID(m_channelid), + m_maxStarttime, "EITScanner"); + m_seenEITother = false; + m_maxStarttime = QDateTime(); } diff --git a/mythtv/libs/libmythtv/eithelper.h b/mythtv/libs/libmythtv/eithelper.h index 06c8cc5b909..18704943892 100644 --- a/mythtv/libs/libmythtv/eithelper.h +++ b/mythtv/libs/libmythtv/eithelper.h @@ -16,6 +16,7 @@ // MythTV includes #include "mythdeque.h" +#include "mpegtables.h" // for GPS_LEAP_SECONDS class MSqlQuery; @@ -68,14 +69,14 @@ class ATSCEtt time_t m_scan_time; }; -typedef QMap<uint,ATSCEvent> EventIDToATSCEvent; -typedef QMap<uint,ATSCEtt> EventIDToETT; -typedef QMap<uint,EventIDToATSCEvent> ATSCSRCToEvents; -typedef QMap<unsigned long long,uint> ServiceToChanID; +using EventIDToATSCEvent = QMap<uint,ATSCEvent> ; +using EventIDToETT = QMap<uint,ATSCEtt>; +using ATSCSRCToEvents = QMap<uint,EventIDToATSCEvent>; +using ServiceToChanID = QMap<unsigned long long,uint>; -typedef uint64_t FixupKey; -typedef uint64_t FixupValue; -typedef QMap<FixupKey, FixupValue> FixupMap; +using FixupKey = uint64_t; +using FixupValue = uint64_t; +using FixupMap = QMap<FixupKey, FixupValue>; class DBEventEIT; class EITFixUp; @@ -96,10 +97,10 @@ class EITHelper uint GetListSize(void) const; uint ProcessEvents(void); - uint GetGPSOffset(void) const { return (uint) (0 - gps_offset); } + uint GetGPSOffset(void) const { return (uint) (0 - m_gpsOffset); } void SetChannelID(uint _channelid); - void SetGPSOffset(uint _gps_offset) { gps_offset = 0 - _gps_offset; } + void SetGPSOffset(uint _gps_offset) { m_gpsOffset = 0 - _gps_offset; } void SetFixup(uint atsc_major, uint atsc_minor, FixupValue eitfixup); void SetLanguagePreferences(const QStringList &langPref); void SetSourceID(uint _sourceid); @@ -120,8 +121,8 @@ class EITHelper #endif // !USING_BACKEND // EIT cache handling - void PruneEITCache(uint timestamp); - void WriteEITCache(void); + static void PruneEITCache(uint timestamp); + static void WriteEITCache(void); private: // only ATSC @@ -135,27 +136,27 @@ class EITHelper const ATSCEvent &event, const QString &ett); - //QListList_Events eitList; ///< Event Information Tables List - mutable QMutex eitList_lock; ///< EIT List lock - mutable ServiceToChanID srv_to_chanid; + //QListList_Events m_eitList; ///< Event Information Tables List + mutable QMutex m_eitListLock; ///< EIT List lock + mutable ServiceToChanID m_srvToChanid; - EITFixUp *eitfixup; - static EITCache *s_eitcache; + EITFixUp *m_eitFixup {nullptr}; + static EITCache *s_eitCache; - int gps_offset; + int m_gpsOffset {-1 * GPS_LEAP_SECONDS}; /* carry some values to optimize channel lookup and reschedules */ - uint sourceid; ///< id of the video source - uint channelid; ///< id of the channel - QDateTime maxStarttime; ///< latest starttime of changed events - bool seenEITother; ///< if false we only reschedule the active mplex + uint m_sourceid {0}; ///< id of the video source + uint m_channelid {0}; ///< id of the channel + QDateTime m_maxStarttime; ///< latest starttime of changed events + bool m_seenEITother {false};///< if false we only reschedule the active mplex - FixupMap fixup; - ATSCSRCToEvents incomplete_events; + FixupMap m_fixup; + ATSCSRCToEvents m_incompleteEvents; - MythDeque<DBEventEIT*> db_events; + MythDeque<DBEventEIT*> m_dbEvents; - QMap<uint,uint> languagePreferences; + QMap<uint,uint> m_languagePreferences; /// Maximum number of DB inserts per ProcessEvents call. static const uint kChunkSize; diff --git a/mythtv/libs/libmythtv/eitscanner.cpp b/mythtv/libs/libmythtv/eitscanner.cpp index 817b168946d..cb94cad115f 100644 --- a/mythtv/libs/libmythtv/eitscanner.cpp +++ b/mythtv/libs/libmythtv/eitscanner.cpp @@ -65,8 +65,8 @@ void EITScanner::TeardownAll(void) */ void EITScanner::run(void) { - static const uint sz[] = { 2000, 1800, 1600, 1400, 1200, }; - static const float rt[] = { 0.0F, 0.2F, 0.4F, 0.6F, 0.8F, }; + static constexpr uint kSz[] = { 2000, 1800, 1600, 1400, 1200, }; + static constexpr float kRt[] = { 0.0F, 0.2F, 0.4F, 0.6F, 0.8F, }; m_lock.lock(); @@ -81,9 +81,9 @@ void EITScanner::run(void) float rate = 1.0F; for (uint i = 0; i < 5; i++) { - if (list_size >= sz[i]) + if (list_size >= kSz[i]) { - rate = rt[i]; + rate = kRt[i]; break; } } @@ -131,11 +131,11 @@ void EITScanner::run(void) if (!(*m_activeScanNextChan).isEmpty()) { - m_eitHelper->WriteEITCache(); - if (rec->QueueEITChannelChange(*m_activeScanNextChan)) + EITHelper::WriteEITCache(); + if (m_rec->QueueEITChannelChange(*m_activeScanNextChan)) { m_eitHelper->SetChannelID(ChannelUtil::GetChanID( - rec->GetSourceID(), *m_activeScanNextChan)); + m_rec->GetSourceID(), *m_activeScanNextChan)); LOG(VB_EIT, LOG_INFO, LOC_ID + QString("Now looking for EIT data on " "multiplex of channel %1") @@ -154,9 +154,9 @@ void EITScanner::run(void) // 24 hours ago #if QT_VERSION < QT_VERSION_CHECK(5,8,0) - m_eitHelper->PruneEITCache(m_activeScanNextTrig.toTime_t() - 86400); + EITHelper::PruneEITCache(m_activeScanNextTrig.toTime_t() - 86400); #else - m_eitHelper->PruneEITCache(m_activeScanNextTrig.toSecsSinceEpoch() - 86400); + EITHelper::PruneEITCache(m_activeScanNextTrig.toSecsSinceEpoch() - 86400); #endif } @@ -226,14 +226,14 @@ void EITScanner::StopPassiveScan(void) } m_channel = nullptr; - m_eitHelper->WriteEITCache(); + EITHelper::WriteEITCache(); m_eitHelper->SetChannelID(0); m_eitHelper->SetSourceID(0); } void EITScanner::StartActiveScan(TVRec *_rec, uint max_seconds_per_source) { - rec = _rec; + m_rec = _rec; if (m_activeScanChannels.isEmpty()) { @@ -254,7 +254,7 @@ void EITScanner::StartActiveScan(TVRec *_rec, uint max_seconds_per_source) "GROUP BY mplexid " "ORDER BY capturecard.sourceid, mplexid, " " atsc_major_chan, atsc_minor_chan "); - query.bindValue(":CARDID", rec->GetInputId()); + query.bindValue(":CARDID", m_rec->GetInputId()); if (!query.exec() || !query.isActive()) { @@ -311,5 +311,5 @@ void EITScanner::StopActiveScan(void) while (!m_activeScan && !m_activeScanStopped) m_activeScanCond.wait(&m_lock, 100); - rec = nullptr; + m_rec = nullptr; } diff --git a/mythtv/libs/libmythtv/eitscanner.h b/mythtv/libs/libmythtv/eitscanner.h index a98f748aa96..861afc237c0 100644 --- a/mythtv/libs/libmythtv/eitscanner.h +++ b/mythtv/libs/libmythtv/eitscanner.h @@ -57,7 +57,7 @@ class EITScanner : public QRunnable volatile bool m_exitThread {false}; QWaitCondition m_exitThreadCond; // protected by lock - TVRec *rec {nullptr}; + TVRec *m_rec {nullptr}; volatile bool m_activeScan {false}; volatile bool m_activeScanStopped {true}; // protected by lock QWaitCondition m_activeScanCond; // protected by lock diff --git a/mythtv/libs/libmythtv/fifowriter.cpp b/mythtv/libs/libmythtv/fifowriter.cpp index 3d333b20d84..b9fb4d4f89a 100644 --- a/mythtv/libs/libmythtv/fifowriter.cpp +++ b/mythtv/libs/libmythtv/fifowriter.cpp @@ -29,9 +29,9 @@ FIFOWriter::FIFOWriter(int count, bool sync) : if (count <= 0) return; - m_fifo_buf = new struct fifo_buf *[count]; - m_fb_inptr = new struct fifo_buf *[count]; - m_fb_outptr = new struct fifo_buf *[count]; + m_fifo_buf = new fifo_buf *[count]; + m_fb_inptr = new fifo_buf *[count]; + m_fb_outptr = new fifo_buf *[count]; m_fifothrds = new FIFOThread[count]; m_fifo_lock = new QMutex[count]; m_full_cond = new QWaitCondition[count]; @@ -100,7 +100,7 @@ bool FIFOWriter::FIFOInit(int id, const QString& desc, const QString& name, long m_killwr[id] = 0; m_fbcount[id] = (m_usesync) ? 2 : num_bufs; m_fbmaxcount[id] = 512; - m_fifo_buf[id] = new struct fifo_buf; + m_fifo_buf[id] = new fifo_buf; struct fifo_buf *fifoptr = m_fifo_buf[id]; for (int i = 0; i < m_fbcount[id]; i++) { diff --git a/mythtv/libs/libmythtv/fifowriter.h b/mythtv/libs/libmythtv/fifowriter.h index 942e1011c30..6197397ca90 100644 --- a/mythtv/libs/libmythtv/fifowriter.h +++ b/mythtv/libs/libmythtv/fifowriter.h @@ -42,15 +42,15 @@ class MTV_PUBLIC FIFOWriter private: void FIFOWriteThread(int id); - typedef struct fifo_buf + struct fifo_buf { struct fifo_buf *next; unsigned char *data; long blksize; - } fifo_buf_t; - fifo_buf_t **m_fifo_buf {nullptr}; - fifo_buf_t **m_fb_inptr {nullptr}; - fifo_buf_t **m_fb_outptr {nullptr}; + }; + fifo_buf **m_fifo_buf {nullptr}; + fifo_buf **m_fb_inptr {nullptr}; + fifo_buf **m_fb_outptr {nullptr}; FIFOThread *m_fifothrds {nullptr}; QMutex *m_fifo_lock {nullptr}; diff --git a/mythtv/libs/libmythtv/format.h b/mythtv/libs/libmythtv/format.h index bdcf59772d1..854667b6c49 100644 --- a/mythtv/libs/libmythtv/format.h +++ b/mythtv/libs/libmythtv/format.h @@ -9,7 +9,7 @@ #define MYTH_PACKED #endif -typedef struct rtfileheader +struct rtfileheader { char finfo[12]; // "NuppelVideo" + \0 char version[5]; // "0.05" + \0 @@ -25,9 +25,9 @@ typedef struct rtfileheader int audioblocks; // count of audio-blocks -1 .. unknown 0 .. no audio int textsblocks; // count of text-blocks -1 .. unknown 0 .. no text int keyframedist; -} rtfileheader; +}; -typedef struct rtframeheader +struct rtframeheader { char frametype; // A .. Audio, V .. Video, S .. Sync, T .. Text // R .. Seekpoint: String RTjjjjjjjj (use full packet) @@ -83,13 +83,13 @@ typedef struct rtframeheader int packetlength; // V,A,T: length of following data in stream // S: length of packet correl. information [NI] // R: do not use here! (fixed 'RTjjjjjjjjjjjjjj') -} MYTH_PACKED rtframeheader; +} MYTH_PACKED; // The fourcc's here are for the most part taken from libavcodec. // As to their correctness, I have no idea. The audio ones are surely wrong, // but I suppose it doesn't really matter as long as I'm consistant. -typedef struct extendeddata +struct extendeddata { int version; // yes, this is repeated from the file header int video_fourcc; // video encoding method used @@ -118,25 +118,25 @@ typedef struct extendeddata // unused for later -- total size of 128 integers. // new fields must be added at the end, above this comment. int expansion[109]; -} MYTH_PACKED extendeddata; +} MYTH_PACKED; -typedef struct seektable_entry +struct seektable_entry { long long file_offset; int keyframe_number; -} MYTH_PACKED seektable_entry; +} MYTH_PACKED; -typedef struct kfatable_entry +struct kfatable_entry { int adjust; int keyframe_number; -} MYTH_PACKED kfatable_entry; +} MYTH_PACKED; #define FRAMEHEADERSIZE sizeof(rtframeheader) #define FILEHEADERSIZE sizeof(rtfileheader) #define EXTENDEDSIZE sizeof(extendeddata) -typedef struct vidbuffertype +struct vidbuffertype { int sample; int timecode; @@ -145,18 +145,18 @@ typedef struct vidbuffertype unsigned char *buffer; int bufferlen; int forcekey; -} vidbuffertyp; +}; -typedef struct audbuffertype +struct audbuffertype { int sample; int timecode; int freeToEncode; int freeToBuffer; unsigned char *buffer; -} audbuffertyp; +}; -typedef struct txtbuffertype +struct txtbuffertype { int timecode; int pagenr; @@ -164,9 +164,9 @@ typedef struct txtbuffertype int freeToBuffer; unsigned char *buffer; int bufferlen; -} txtbuffertyp; +}; -typedef struct teletextsubtitle +struct teletextsubtitle { unsigned char row; unsigned char col; @@ -174,9 +174,9 @@ typedef struct teletextsubtitle unsigned char fg; unsigned char bg; unsigned char len; -} teletextsubtitle; +}; -typedef struct ccsubtitle +struct ccsubtitle { unsigned char row; unsigned char rowcount; @@ -184,7 +184,7 @@ typedef struct ccsubtitle unsigned char resumetext; unsigned char clr; // clear the display unsigned char len; //length of string to follow -} ccsubtitle; +}; // resumedirect codes #define CC_STYLE_POPUP 0x00 diff --git a/mythtv/libs/libmythtv/frequencies.cpp b/mythtv/libs/libmythtv/frequencies.cpp index 1a9295984dd..b2589560b29 100644 --- a/mythtv/libs/libmythtv/frequencies.cpp +++ b/mythtv/libs/libmythtv/frequencies.cpp @@ -6,7 +6,7 @@ /* --------------------------------------------------------------------- */ /* US broadcast */ -static struct CHANLIST ntsc_bcast[] = { +static CHANLIST ntsc_bcast[] = { { "2", 55250 }, { "3", 61250 }, { "4", 67250 }, @@ -63,7 +63,7 @@ static struct CHANLIST ntsc_bcast[] = { }; /* US cable */ -static struct CHANLIST ntsc_cable[] = { +static CHANLIST ntsc_cable[] = { { "2", 55250 }, { "3", 61250 }, { "4", 67250 }, @@ -203,7 +203,7 @@ static struct CHANLIST ntsc_cable[] = { }; /* US HRC */ -static struct CHANLIST ntsc_hrc[] = { +static CHANLIST ntsc_hrc[] = { { "1", 72004 }, { "2", 54003 }, @@ -337,7 +337,7 @@ static struct CHANLIST ntsc_hrc[] = { }; /** US IRC http://www.jneuhaus.com/fccindex/cablech.html */ -static struct CHANLIST ntsc_irc[] = { +static CHANLIST ntsc_irc[] = { { "1", 73263 }, { "2", 55263 }, { "3", 61263 }, @@ -471,7 +471,7 @@ static struct CHANLIST ntsc_irc[] = { /* --------------------------------------------------------------------- */ /* JP broadcast */ -static struct CHANLIST ntsc_bcast_jp[] = { +static CHANLIST ntsc_bcast_jp[] = { { "1", 91250 }, { "2", 97250 }, { "3", 103250 }, @@ -539,7 +539,7 @@ static struct CHANLIST ntsc_bcast_jp[] = { }; /* JP cable */ -static struct CHANLIST ntsc_cable_jp[] = { +static CHANLIST ntsc_cable_jp[] = { { "13", 109250 }, { "14", 115250 }, { "15", 121250 }, @@ -597,7 +597,7 @@ static struct CHANLIST ntsc_cable_jp[] = { /* --------------------------------------------------------------------- */ /* australia */ -static struct CHANLIST pal_australia[] = { +static CHANLIST pal_australia[] = { { "0", 46250 }, { "1", 57250 }, { "2", 64250 }, @@ -653,7 +653,7 @@ static struct CHANLIST pal_australia[] = { { "69", 814250 }, }; -static struct CHANLIST pal_australia_optus[] = { +static CHANLIST pal_australia_optus[] = { { "1", 138250 }, { "2", 147250 }, { "3", 154250 }, @@ -878,7 +878,7 @@ static struct CHANLIST pal_australia_optus[] = { { "68", 847250 }, \ { "69", 855250 } -static struct CHANLIST europe_west[] = { +static CHANLIST europe_west[] = { FREQ_CCIR_I_III, FREQ_CCIR_SL_SH, FREQ_CCIR_H, @@ -886,7 +886,7 @@ static struct CHANLIST europe_west[] = { FREQ_UHF }; -static struct CHANLIST europe_east[] = { +static CHANLIST europe_east[] = { FREQ_OIRT_I_III, FREQ_OIRT_SL_SH, FREQ_CCIR_I_III, @@ -896,7 +896,7 @@ static struct CHANLIST europe_east[] = { FREQ_UHF }; -static struct CHANLIST pal_italy[] = { +static CHANLIST pal_italy[] = { { "A", 53750 }, { "B", 62250 }, { "C", 82250 }, @@ -910,7 +910,7 @@ static struct CHANLIST pal_italy[] = { FREQ_UHF }; -static struct CHANLIST pal_ireland[] = { +static CHANLIST pal_ireland[] = { { "A0", 45750 }, { "A1", 48000 }, { "A2", 53750 }, @@ -951,7 +951,7 @@ static struct CHANLIST pal_ireland[] = { FREQ_UHF, }; -static struct CHANLIST secam_france[] = { +static CHANLIST secam_france[] = { { "K01", 47750 }, { "K02", 55750 }, { "K03", 60500 }, @@ -1002,7 +1002,7 @@ static struct CHANLIST secam_france[] = { /* --------------------------------------------------------------------- */ -static struct CHANLIST pal_newzealand[] = { +static CHANLIST pal_newzealand[] = { { "1", 45250 }, { "2", 55250 }, { "3", 62250 }, @@ -1020,7 +1020,7 @@ static struct CHANLIST pal_newzealand[] = { /* --------------------------------------------------------------------- */ /* China broadcast */ -static struct CHANLIST pal_bcast_cn[] = { +static CHANLIST pal_bcast_cn[] = { { "1", 49750 }, { "2", 57750 }, { "3", 65750 }, @@ -1120,7 +1120,7 @@ static struct CHANLIST pal_bcast_cn[] = { /* --------------------------------------------------------------------- */ /* South Africa Broadcast */ -static struct CHANLIST pal_bcast_za[] ={ +static CHANLIST pal_bcast_za[] ={ { "4", 175250 }, { "5", 183250 }, { "6", 191250 }, @@ -1136,7 +1136,7 @@ static struct CHANLIST pal_bcast_za[] ={ /* --------------------------------------------------------------------- */ /* Singapore broadcast added by Teo En Ming on 16 July 2006 */ -static struct CHANLIST pal_bcast_sg[] = { +static CHANLIST pal_bcast_sg[] = { { "1", 175250 }, { "2", 196250 }, { "3", 224250 }, @@ -1148,7 +1148,7 @@ static struct CHANLIST pal_bcast_sg[] = { /* --------------------------------------------------------------------- */ /* Malaysia broadcast added by Andrew Chuah on 26 Sept 2006 */ -static struct CHANLIST pal_bcast_my[] = { +static CHANLIST pal_bcast_my[] = { { "1", 175500 }, { "2", 217500 }, { "3", 535000 }, @@ -1158,7 +1158,7 @@ static struct CHANLIST pal_bcast_my[] = { }; /* --------------------------------------------------------------------- */ -static struct CHANLIST argentina[] = { +static CHANLIST argentina[] = { { "001", 56250 }, { "002", 62250 }, { "003", 68250 }, @@ -1254,7 +1254,7 @@ static struct CHANLIST argentina[] = { { "093", 644250 }, }; -static struct CHANLIST try_all [] = { +static CHANLIST try_all [] = { { "1" , 44000 } , { "2" , 45000 } , { "3" , 46000 } , @@ -2176,7 +2176,7 @@ static struct CHANLIST try_all [] = { three companies that have recently joined to form HOT - matav, tevel, and Golden Channels. This is the frequency table used in Matav. */ /* Added by Max Timchenko [www.maxvt.net], 04/04/2007 */ -static struct CHANLIST israel_hot_matav[] = { +static CHANLIST israel_hot_matav[] = { { "1", 184250 }, { "2", 192250 }, { "3", 200250 }, diff --git a/mythtv/libs/libmythtv/frequencies.h b/mythtv/libs/libmythtv/frequencies.h index ad1794992b7..04941885d18 100644 --- a/mythtv/libs/libmythtv/frequencies.h +++ b/mythtv/libs/libmythtv/frequencies.h @@ -93,16 +93,16 @@ /* --------------------------------------------------------------------- */ -typedef struct CHANLIST { +struct CHANLIST { const char *name; int freq; -} _chanlist; +}; -typedef struct CHANLISTS { +struct CHANLISTS { const char *name; struct CHANLIST *list; int count; -} _chanlists; +}; #define CHAN_COUNT(x) (sizeof(x)/sizeof(struct CHANLIST)) diff --git a/mythtv/libs/libmythtv/frequencytables.cpp b/mythtv/libs/libmythtv/frequencytables.cpp index ed4795cb923..f97cc3363cb 100644 --- a/mythtv/libs/libmythtv/frequencytables.cpp +++ b/mythtv/libs/libmythtv/frequencytables.cpp @@ -1,3 +1,5 @@ +#include <utility> + #include <QMutex> #include "frequencies.h" @@ -20,10 +22,10 @@ TransportScanItem::TransportScanItem() TransportScanItem::TransportScanItem(uint sourceid, const QString &_si_std, - const QString &_name, + QString _name, uint _mplexid, uint _timeoutTune) - : m_mplexid(_mplexid), m_friendlyName(_name), + : m_mplexid(_mplexid), m_friendlyName(std::move(_name)), m_sourceID(sourceid), m_timeoutTune(_timeoutTune) { @@ -38,11 +40,11 @@ TransportScanItem::TransportScanItem(uint sourceid, } TransportScanItem::TransportScanItem(uint _sourceid, - const QString &_name, + QString _name, DTVMultiplex &_tuning, uint _timeoutTune) : m_mplexid(0), - m_friendlyName(_name), + m_friendlyName(std::move(_name)), m_sourceID(_sourceid), m_timeoutTune(_timeoutTune) { @@ -50,12 +52,12 @@ TransportScanItem::TransportScanItem(uint _sourceid, } TransportScanItem::TransportScanItem(uint _sourceid, - const QString &_name, + QString _name, DTVTunerType _tuner_type, const DTVTransport &_tuning, uint _timeoutTune) : m_mplexid(0), - m_friendlyName(_name), + m_friendlyName(std::move(_name)), m_sourceID(_sourceid), m_timeoutTune(_timeoutTune) { @@ -67,22 +69,22 @@ TransportScanItem::TransportScanItem(uint _sourceid, _tuner_type, QString::number(_tuning.m_frequency), _tuning.m_inversion.toString(), QString::number(_tuning.m_symbolrate), _tuning.m_fec.toString(), - _tuning.m_polarity.toString(), _tuning.m_hp_code_rate.toString(), - _tuning.m_lp_code_rate.toString(), _tuning.m_modulation.toString(), - _tuning.m_trans_mode.toString(), _tuning.m_guard_interval.toString(), + _tuning.m_polarity.toString(), _tuning.m_hpCodeRate.toString(), + _tuning.m_lpCodeRate.toString(), _tuning.m_modulation.toString(), + _tuning.m_transMode.toString(), _tuning.m_guardInterval.toString(), _tuning.m_hierarchy.toString(), _tuning.m_modulation.toString(), - _tuning.m_bandwidth.toString(), _tuning.m_mod_sys.toString(), + _tuning.m_bandwidth.toString(), _tuning.m_modSys.toString(), _tuning.m_rolloff.toString()); } TransportScanItem::TransportScanItem(uint sourceid, const QString &std, - const QString &strFmt, + QString strFmt, uint freqNum, uint freq, const FrequencyTable &ft, uint timeoutTune) - : m_mplexid(0), m_friendlyName(strFmt), + : m_mplexid(0), m_friendlyName(std::move(strFmt)), m_friendlyNum(freqNum), m_sourceID(sourceid), m_timeoutTune(timeoutTune) { @@ -108,10 +110,10 @@ TransportScanItem::TransportScanItem(uint sourceid, { m_tuning.m_inversion = ft.m_inversion; m_tuning.m_bandwidth = ft.m_bandwidth; - m_tuning.m_hp_code_rate = ft.m_coderateHp; - m_tuning.m_lp_code_rate = ft.m_coderateLp; - m_tuning.m_trans_mode = ft.m_transMode; - m_tuning.m_guard_interval = ft.m_guardInterval; + m_tuning.m_hpCodeRate = ft.m_coderateHp; + m_tuning.m_lpCodeRate = ft.m_coderateLp; + m_tuning.m_transMode = ft.m_transMode; + m_tuning.m_guardInterval = ft.m_guardInterval; m_tuning.m_hierarchy = ft.m_hierarchy; } else if (std == "dvbc" || std == "dvbs") @@ -124,15 +126,15 @@ TransportScanItem::TransportScanItem(uint sourceid, } TransportScanItem::TransportScanItem(uint _sourceid, - const QString &_name, - const IPTVTuningData &_tuning, - const QString &_channel, + QString _name, + IPTVTuningData _tuning, + QString _channel, uint _timeoutTune) : m_mplexid(0), - m_friendlyName(_name), + m_friendlyName(std::move(_name)), m_sourceID(_sourceid), m_timeoutTune(_timeoutTune), - m_iptvTuning(_tuning), m_iptvChannel(_channel) + m_iptvTuning(std::move(_tuning)), m_iptvChannel(std::move(_channel)) { m_tuning.Clear(); m_tuning.m_sistandard = "MPEG"; @@ -153,7 +155,7 @@ uint TransportScanItem::GetMultiplexIdFromDB(void) const uint64_t TransportScanItem::freq_offset(uint i) const { - int64_t freq = (int64_t) m_tuning.m_frequency; + auto freq = (int64_t) m_tuning.m_frequency; return (uint64_t) (freq + m_freqOffsets[i]); } @@ -186,11 +188,11 @@ QString TransportScanItem::toString() const str += QString("\t inv(%1) bandwidth(%2) hp(%3) lp(%4)\n") .arg(m_tuning.m_inversion) .arg(m_tuning.m_bandwidth) - .arg(m_tuning.m_hp_code_rate) - .arg(m_tuning.m_lp_code_rate); + .arg(m_tuning.m_hpCodeRate) + .arg(m_tuning.m_lpCodeRate); str += QString("\t trans_mode(%1) guard_int(%2) hierarchy(%3)\n") - .arg(m_tuning.m_trans_mode) - .arg(m_tuning.m_guard_interval) + .arg(m_tuning.m_transMode) + .arg(m_tuning.m_guardInterval) .arg(m_tuning.m_hierarchy); } str += QString("\t offset[0..2]: %1 %2 %3") @@ -692,7 +694,7 @@ static void init_freq_tables(freq_table_map_t &fmap) } // create old school frequency tables... - for (struct CHANLISTS *ptr = chanlists; ptr->name ; ptr++) + for (CHANLISTS *ptr = chanlists; ptr->name ; ptr++) { QString tbl_name = ptr->name; for (uint i = 0; i < (uint)ptr->count; i++) diff --git a/mythtv/libs/libmythtv/frequencytables.h b/mythtv/libs/libmythtv/frequencytables.h index 58a3b67de47..e632c4944bc 100644 --- a/mythtv/libs/libmythtv/frequencytables.h +++ b/mythtv/libs/libmythtv/frequencytables.h @@ -21,8 +21,8 @@ using namespace std; class FrequencyTable; class TransportScanItem; -typedef QMap<QString, const FrequencyTable*> freq_table_map_t; -typedef vector<const FrequencyTable*> freq_table_list_t; +using freq_table_map_t = QMap<QString, const FrequencyTable*>; +using freq_table_list_t = vector<const FrequencyTable*>; bool teardown_frequency_tables(void); @@ -127,33 +127,33 @@ class TransportScanItem TransportScanItem(); TransportScanItem(uint _sourceid, const QString &_si_std, - const QString &_name, + QString _name, uint _mplexid, uint _timeoutTune); TransportScanItem(uint _sourceid, - const QString &_name, + QString _name, DTVMultiplex &_tuning, uint _timeoutTune); TransportScanItem(uint _sourceid, - const QString &_name, + QString _name, DTVTunerType _tuner_type, const DTVTransport &_tuning, uint _timeoutTune); TransportScanItem(uint _sourceid, const QString &_si_std, - const QString &strFmt, /* fmt for info shown to user */ + QString strFmt, /* fmt for info shown to user */ uint freqNum, uint frequency, /* center frequency to use */ const FrequencyTable&, /* freq table to get info from */ uint _timeoutTune); TransportScanItem(uint _sourceid, - const QString &_name, - const IPTVTuningData &_tuning, - const QString &_channel, + QString _name, + IPTVTuningData _tuning, + QString _channel, uint _timeoutTune); uint offset_cnt() const @@ -283,6 +283,6 @@ inline bool operator==(const transport_scan_items_it_t& A, return (A_it == B_it) && (0 == A.offset()); } -typedef list<TransportScanItem> transport_scan_items_t; +using transport_scan_items_t = list<TransportScanItem>; #endif // FREQUENCY_TABLE_H diff --git a/mythtv/libs/libmythtv/inputinfo.cpp b/mythtv/libs/libmythtv/inputinfo.cpp index 724f358d173..43d1cae4a9b 100644 --- a/mythtv/libs/libmythtv/inputinfo.cpp +++ b/mythtv/libs/libmythtv/inputinfo.cpp @@ -23,7 +23,7 @@ bool InputInfo::FromStringList(QStringList::const_iterator &it, m_sourceid = (*it).toUInt(); NEXT(); m_inputid = (*it).toUInt(); NEXT(); m_mplexid = (*it).toUInt(); NEXT(); - m_livetvorder = (*it).toUInt(); NEXT(); + m_liveTvOrder = (*it).toUInt(); NEXT(); m_displayName = *it; m_displayName = (m_displayName == "<EMPTY>") ? QString() : m_displayName; @@ -44,7 +44,7 @@ void InputInfo::ToStringList(QStringList &list) const list.push_back(QString::number(m_sourceid)); list.push_back(QString::number(m_inputid)); list.push_back(QString::number(m_mplexid)); - list.push_back(QString::number(m_livetvorder)); + list.push_back(QString::number(m_liveTvOrder)); list.push_back(m_displayName.isEmpty() ? "<EMPTY>" : m_displayName); list.push_back(QString::number(m_recPriority)); list.push_back(QString::number(m_scheduleOrder)); diff --git a/mythtv/libs/libmythtv/inputinfo.h b/mythtv/libs/libmythtv/inputinfo.h index ad1877d30f8..0a4fe53b4ac 100644 --- a/mythtv/libs/libmythtv/inputinfo.h +++ b/mythtv/libs/libmythtv/inputinfo.h @@ -21,7 +21,7 @@ class MTV_PUBLIC InputInfo m_inputid(_inputid), m_mplexid(_mplexid), m_chanid(_chanid), - m_livetvorder(_livetvorder) {} + m_liveTvOrder(_livetvorder) {} InputInfo(const InputInfo &other) : m_name(other.m_name), @@ -32,7 +32,7 @@ class MTV_PUBLIC InputInfo m_displayName(other.m_displayName), m_recPriority(other.m_recPriority), m_scheduleOrder(other.m_scheduleOrder), - m_livetvorder(other.m_livetvorder), + m_liveTvOrder(other.m_liveTvOrder), m_quickTune(other.m_quickTune) {} InputInfo &operator=(const InputInfo &other) @@ -45,7 +45,7 @@ class MTV_PUBLIC InputInfo m_displayName = other.m_displayName; m_recPriority = other.m_recPriority; m_scheduleOrder = other.m_scheduleOrder; - m_livetvorder = other.m_livetvorder; + m_liveTvOrder = other.m_liveTvOrder; m_quickTune = other.m_quickTune; return *this; } @@ -74,7 +74,7 @@ class MTV_PUBLIC InputInfo QString m_displayName; int m_recPriority {0}; uint m_scheduleOrder {0}; - uint m_livetvorder {0}; ///< order for live TV use + uint m_liveTvOrder {0}; ///< order for live TV use bool m_quickTune {false}; }; diff --git a/mythtv/libs/libmythtv/iptvtuningdata.h b/mythtv/libs/libmythtv/iptvtuningdata.h index 1cbe15f5e66..15565a85c79 100644 --- a/mythtv/libs/libmythtv/iptvtuningdata.h +++ b/mythtv/libs/libmythtv/iptvtuningdata.h @@ -15,15 +15,15 @@ class MTV_PUBLIC IPTVTuningData { public: - typedef enum FECType + enum FECType { kNone, kRFC2733, kRFC5109, kSMPTE2022, - } FECType; + }; - typedef enum IPTVType + enum IPTVType { kData = 1, kRFC2733_1, @@ -32,9 +32,9 @@ class MTV_PUBLIC IPTVTuningData kRFC5109_2, kSMPTE2022_1, kSMPTE2022_2, - } IPTVType; + }; - typedef enum IPTVProtocol + enum IPTVProtocol { inValid = 0, udp, @@ -42,15 +42,15 @@ class MTV_PUBLIC IPTVTuningData rtsp, http_ts, http_hls - } IPTVProtocol; + }; - IPTVTuningData() : m_fec_type(kNone), m_protocol(inValid) + IPTVTuningData() { memset(&m_bitrate, 0, sizeof(m_bitrate)); } IPTVTuningData(const QString &data_url, IPTVProtocol protocol) : - m_data_url(data_url), m_fec_type(kNone), m_protocol(protocol) + m_dataUrl(data_url), m_protocol(protocol) { memset(&m_bitrate, 0, sizeof(m_bitrate)); } @@ -59,8 +59,8 @@ class MTV_PUBLIC IPTVTuningData const FECType fec_type, const QString &fec_url0, uint fec_bitrate0, const QString &fec_url1, uint fec_bitrate1) : - m_data_url(data_url), - m_fec_type(fec_type), m_fec_url0(fec_url0), m_fec_url1(fec_url1) + m_dataUrl(data_url), + m_fecType(fec_type), m_fecUrl0(fec_url0), m_fecUrl1(fec_url1) { GuessProtocol(); m_bitrate[0] = data_bitrate; @@ -73,23 +73,23 @@ class MTV_PUBLIC IPTVTuningData const QString &fec_url0, uint fec_bitrate0, const QString &fec_url1, uint fec_bitrate1, const IPTVProtocol protocol) : - m_data_url(data_url), - m_fec_type(kNone), m_fec_url0(fec_url0), m_fec_url1(fec_url1), + m_dataUrl(data_url), + m_fecUrl0(fec_url0), m_fecUrl1(fec_url1), m_protocol(protocol) { m_bitrate[0] = data_bitrate; m_bitrate[1] = fec_bitrate0; m_bitrate[2] = fec_bitrate1; if (fec_type.toLower() == "rfc2733") - m_fec_type = kRFC2733; + m_fecType = kRFC2733; else if (fec_type.toLower() == "rfc5109") - m_fec_type = kRFC5109; + m_fecType = kRFC5109; else if (fec_type.toLower() == "smpte2022") - m_fec_type = kSMPTE2022; + m_fecType = kSMPTE2022; else { - m_fec_url0.clear(); - m_fec_url1.clear(); + m_fecUrl0.clear(); + m_fecUrl1.clear(); } } @@ -126,13 +126,13 @@ class MTV_PUBLIC IPTVTuningData void SetDataURL(const QUrl &url) { - m_data_url = url; + m_dataUrl = url; GuessProtocol(); } - QUrl GetDataURL(void) const { return m_data_url; } - QUrl GetFECURL0(void) const { return m_fec_url0; } - QUrl GetFECURL1(void) const { return m_fec_url1; } + QUrl GetDataURL(void) const { return m_dataUrl; } + QUrl GetFECURL0(void) const { return m_fecUrl0; } + QUrl GetFECURL1(void) const { return m_fecUrl1; } QUrl GetURL(uint i) const { if (0 == i) @@ -146,13 +146,13 @@ class MTV_PUBLIC IPTVTuningData } uint GetBitrate(uint i) const { return m_bitrate[i]; } - FECType GetFECType(void) const { return m_fec_type; } + FECType GetFECType(void) const { return m_fecType; } QString GetFECTypeString(uint i) const { if (0 == i) return "data"; - switch (m_fec_type) + switch (m_fecType) { case kNone: return QString(); case kRFC2733: return QString("rfc2733-%1").arg(i); @@ -166,10 +166,10 @@ class MTV_PUBLIC IPTVTuningData bool IsValid(void) const { - bool ret = (m_data_url.isValid() && (IsUDP() || IsRTP() || IsRTSP() || IsHLS() || IsHTTPTS())); + bool ret = (m_dataUrl.isValid() && (IsUDP() || IsRTP() || IsRTSP() || IsHLS() || IsHTTPTS())); LOG(VB_CHANNEL, LOG_DEBUG, QString("IPTVTuningdata (%1): IsValid = %2") - .arg(m_data_url.toString()) + .arg(m_dataUrl.toString()) .arg(ret ? "true" : "false")); return ret; @@ -202,17 +202,17 @@ class MTV_PUBLIC IPTVTuningData void GuessProtocol(void) { - if (!m_data_url.isValid()) + if (!m_dataUrl.isValid()) m_protocol = IPTVTuningData::inValid; - else if (m_data_url.scheme() == "udp") + else if (m_dataUrl.scheme() == "udp") m_protocol = IPTVTuningData::udp; - else if (m_data_url.scheme() == "rtp") + else if (m_dataUrl.scheme() == "rtp") m_protocol = IPTVTuningData::rtp; - else if (m_data_url.scheme() == "rtsp") + else if (m_dataUrl.scheme() == "rtsp") m_protocol = IPTVTuningData::rtsp; - else if (((m_data_url.scheme() == "http") || (m_data_url.scheme() == "https")) && IsHLSPlaylist()) + else if (((m_dataUrl.scheme() == "http") || (m_dataUrl.scheme() == "https")) && IsHLSPlaylist()) m_protocol = IPTVTuningData::http_hls; - else if ((m_data_url.scheme() == "http") || (m_data_url.scheme() == "https")) + else if ((m_dataUrl.scheme() == "http") || (m_dataUrl.scheme() == "https")) m_protocol = IPTVTuningData::http_ts; else m_protocol = IPTVTuningData::inValid; @@ -232,7 +232,7 @@ class MTV_PUBLIC IPTVTuningData return false; } - QString url = m_data_url.toString(); + QString url = m_dataUrl.toString(); // check url is valid for a playlist before downloading (see trac ticket #12856) if(url.endsWith(".m3u8", Qt::CaseInsensitive) || @@ -264,12 +264,12 @@ class MTV_PUBLIC IPTVTuningData } protected: - QUrl m_data_url; - FECType m_fec_type; - QUrl m_fec_url0; - QUrl m_fec_url1; + QUrl m_dataUrl; + FECType m_fecType {kNone}; + QUrl m_fecUrl0; + QUrl m_fecUrl1; uint m_bitrate[3]; - IPTVProtocol m_protocol; + IPTVProtocol m_protocol {inValid}; }; #endif // _IPTV_TUNING_DATA_H_ diff --git a/mythtv/libs/libmythtv/jitterometer.cpp b/mythtv/libs/libmythtv/jitterometer.cpp index 1fe69fd6c6f..5867e7707cc 100644 --- a/mythtv/libs/libmythtv/jitterometer.cpp +++ b/mythtv/libs/libmythtv/jitterometer.cpp @@ -3,8 +3,9 @@ #include "jitterometer.h" // Std -#include <cstdlib> #include <cmath> +#include <cstdlib> +#include <utility> #define UNIX_PROC_STAT "/proc/stat" #define MAX_CORES 8 @@ -16,8 +17,8 @@ #include <mach/vm_map.h> #endif -Jitterometer::Jitterometer(const QString &nname, int ncycles) - : m_num_cycles(ncycles), m_name(nname) +Jitterometer::Jitterometer(QString nname, int ncycles) + : m_num_cycles(ncycles), m_name(std::move(nname)) { m_times.resize(m_num_cycles); @@ -165,9 +166,9 @@ QString Jitterometer::GetCPUStat(void) line = m_cpustat->readLine(256); while (!line.isEmpty() && cores < MAX_CORES) { - static const int size = sizeof(unsigned long long) * 9; + static constexpr int kSize = sizeof(unsigned long long) * 9; unsigned long long stats[9]; - memset(stats, 0, size); + memset(stats, 0, kSize); int num = 0; if (sscanf(line.constData(), "cpu%30d %30llu %30llu %30llu %30llu %30llu " @@ -184,7 +185,7 @@ QString Jitterometer::GetCPUStat(void) float total = load + stats[3] - m_laststats[ptr + 3]; if (total > 0) result += QString("%1% ").arg(load / total * 100, 0, 'f', 0); - memcpy(&m_laststats[ptr], stats, size); + memcpy(&m_laststats[ptr], stats, kSize); } line = m_cpustat->readLine(256); cores++; diff --git a/mythtv/libs/libmythtv/jitterometer.h b/mythtv/libs/libmythtv/jitterometer.h index 6336c06ad14..196437e3618 100644 --- a/mythtv/libs/libmythtv/jitterometer.h +++ b/mythtv/libs/libmythtv/jitterometer.h @@ -43,7 +43,7 @@ class MTV_PUBLIC Jitterometer { public: - Jitterometer(const QString &nname, int ncycles = 0); + Jitterometer(QString nname, int ncycles = 0); ~Jitterometer(); float GetLastFPS(void) const { return m_last_fps; } diff --git a/mythtv/libs/libmythtv/jobqueue.cpp b/mythtv/libs/libmythtv/jobqueue.cpp index 4708fca07f3..1d0da5b4634 100644 --- a/mythtv/libs/libmythtv/jobqueue.cpp +++ b/mythtv/libs/libmythtv/jobqueue.cpp @@ -84,7 +84,7 @@ void JobQueue::customEvent(QEvent *e) { if (e->type() == MythEvent::MythEventMessage) { - MythEvent *me = dynamic_cast<MythEvent *>(e); + auto *me = dynamic_cast<MythEvent *>(e); if (me == nullptr) return; QString message = me->Message(); @@ -1776,7 +1776,7 @@ void JobQueue::ProcessJob(const JobQueueEntry& job) void JobQueue::StartChildJob(void *(*ChildThreadRoutine)(void *), int jobID) { - JobThreadStruct *jts = new JobThreadStruct; + auto *jts = new JobThreadStruct; jts->jq = this; jts->jobID = jobID; @@ -1877,10 +1877,10 @@ QString JobQueue::PrettyPrint(off_t bytes) // Pretty print "bytes" as KB, MB, GB, TB, etc., subject to the desired // number of units static const struct { - const char *suffix; - unsigned int max; - int precision; - } pptab[] = { + const char *m_suffix; + unsigned int m_max; + int m_precision; + } kPpTab[] = { { "bytes", 9999, 0 }, { "kB", 999, 0 }, { "MB", 999, 1 }, @@ -1895,19 +1895,19 @@ QString JobQueue::PrettyPrint(off_t bytes) float fbytes = bytes; ii = 0; - while (pptab[ii].max && fbytes > pptab[ii].max) { + while (kPpTab[ii].m_max && fbytes > kPpTab[ii].m_max) { fbytes /= 1024; ii++; } return QString("%1 %2") - .arg(fbytes, 0, 'f', pptab[ii].precision) - .arg(pptab[ii].suffix); + .arg(fbytes, 0, 'f', kPpTab[ii].m_precision) + .arg(kPpTab[ii].m_suffix); } void *JobQueue::TranscodeThread(void *param) { - JobThreadStruct *jts = (JobThreadStruct *)param; + auto *jts = (JobThreadStruct *)param; JobQueue *jq = jts->jq; MThread::ThreadSetup(QString("Transcode_%1").arg(jts->jobID)); @@ -2137,7 +2137,7 @@ void JobQueue::DoTranscodeThread(int jobID) void *JobQueue::MetadataLookupThread(void *param) { - JobThreadStruct *jts = (JobThreadStruct *)param; + auto *jts = (JobThreadStruct *)param; JobQueue *jq = jts->jq; MThread::ThreadSetup(QString("Metadata_%1").arg(jts->jobID)); @@ -2262,7 +2262,7 @@ void JobQueue::DoMetadataLookupThread(int jobID) void *JobQueue::FlagCommercialsThread(void *param) { - JobThreadStruct *jts = (JobThreadStruct *)param; + auto *jts = (JobThreadStruct *)param; JobQueue *jq = jts->jq; MThread::ThreadSetup(QString("Commflag_%1").arg(jts->jobID)); @@ -2384,8 +2384,8 @@ void JobQueue::DoFlagCommercialsThread(int jobID) program_info->SetPathname(program_info->GetPlaybackURL(false,true)); if (program_info->IsLocal()) { - PreviewGenerator *pg = new PreviewGenerator( - program_info, QString(), PreviewGenerator::kLocal); + auto *pg = new PreviewGenerator(program_info, QString(), + PreviewGenerator::kLocal); pg->Run(); pg->deleteLater(); } @@ -2409,7 +2409,7 @@ void JobQueue::DoFlagCommercialsThread(int jobID) void *JobQueue::UserJobThread(void *param) { - JobThreadStruct *jts = (JobThreadStruct *)param; + auto *jts = (JobThreadStruct *)param; JobQueue *jq = jts->jq; MThread::ThreadSetup(QString("UserJob_%1").arg(jts->jobID)); diff --git a/mythtv/libs/libmythtv/jobqueue.h b/mythtv/libs/libmythtv/jobqueue.h index 68cf8c24353..85169e4ff26 100644 --- a/mythtv/libs/libmythtv/jobqueue.h +++ b/mythtv/libs/libmythtv/jobqueue.h @@ -96,7 +96,7 @@ static QMap< QString, int > JobNameToType { { "UserJob4", JOB_USERJOB4 } }; -typedef struct jobqueueentry { +struct JobQueueEntry { int id; uint chanid; QDateTime recstartts; @@ -111,16 +111,16 @@ typedef struct jobqueueentry { QString hostname; QString args; QString comment; -} JobQueueEntry; +}; -typedef struct runningjobinfo { +struct RunningJobInfo { int id; int type; int flag; QString desc; QString command; ProgramInfo *pginfo; -} RunningJobInfo; +}; class JobQueue; @@ -216,11 +216,11 @@ class MTV_PUBLIC JobQueue : public QObject, public QRunnable static bool InJobRunWindow(QDateTime jobstarttsRaw); private: - typedef struct jobthreadstruct + struct JobThreadStruct { JobQueue *jq; int jobID; - } JobThreadStruct; + }; void run(void) override; // QRunnable void ProcessQueue(void); @@ -233,8 +233,8 @@ class MTV_PUBLIC JobQueue : public QObject, public QRunnable void StartChildJob(void *(*ChildThreadRoutine)(void *), int jobID); - QString GetJobDescription(int jobType); - QString GetJobCommand(int id, int jobType, ProgramInfo *tmpInfo); + static QString GetJobDescription(int jobType); + static QString GetJobCommand(int id, int jobType, ProgramInfo *tmpInfo); void RemoveRunningJob(int id); static QString PrettyPrint(off_t bytes); diff --git a/mythtv/libs/libmythtv/listingsources.h b/mythtv/libs/libmythtv/listingsources.h index ce40376ab92..f0deeedeaaf 100644 --- a/mythtv/libs/libmythtv/listingsources.h +++ b/mythtv/libs/libmythtv/listingsources.h @@ -1,7 +1,7 @@ -typedef enum { +enum ListingSource { kListingSourceEIT = 0x1, kListingSourceDDSchedulesDirect = 0x2, kListingSourceXMLTV = 0x4, kListingSourceDBOX2EPG = 0x8, -} ListingSource; +}; diff --git a/mythtv/libs/libmythtv/livetvchain.cpp b/mythtv/libs/libmythtv/livetvchain.cpp index 6a3eb38655d..ddcd0c26d43 100644 --- a/mythtv/libs/libmythtv/livetvchain.cpp +++ b/mythtv/libs/libmythtv/livetvchain.cpp @@ -294,7 +294,7 @@ void LiveTVChain::GetEntryAt(int at, LiveTVChainEntry &entry) const ProgramInfo *LiveTVChain::EntryToProgram(const LiveTVChainEntry &entry) { - ProgramInfo *pginfo = new ProgramInfo(entry.chanid, entry.starttime); + auto *pginfo = new ProgramInfo(entry.chanid, entry.starttime); if (pginfo->GetChanID()) { @@ -706,10 +706,10 @@ void LiveTVChain::SetHostSocket(MythSocket *sock) m_inUseSocks.append(sock); } -bool LiveTVChain::IsHostSocket(const MythSocket *sock) const +bool LiveTVChain::IsHostSocket(MythSocket *sock) { QMutexLocker lock(&m_sockLock); - return m_inUseSocks.contains(const_cast<MythSocket*>(sock)); + return m_inUseSocks.contains(sock); } uint LiveTVChain::HostSocketCount(void) const diff --git a/mythtv/libs/libmythtv/livetvchain.h b/mythtv/libs/libmythtv/livetvchain.h index 700a6c2be4b..867e2dabd28 100644 --- a/mythtv/libs/libmythtv/livetvchain.h +++ b/mythtv/libs/libmythtv/livetvchain.h @@ -85,7 +85,7 @@ class MTV_PUBLIC LiveTVChain : public ReferenceCounter // socket stuff void SetHostSocket(MythSocket *sock); - bool IsHostSocket(const MythSocket *sock) const; + bool IsHostSocket(MythSocket *sock); uint HostSocketCount(void) const; void DelHostSocket(MythSocket *sock); diff --git a/mythtv/libs/libmythtv/metadataimagehelper.cpp b/mythtv/libs/libmythtv/metadataimagehelper.cpp index 2f7162694e0..3d69ec33540 100644 --- a/mythtv/libs/libmythtv/metadataimagehelper.cpp +++ b/mythtv/libs/libmythtv/metadataimagehelper.cpp @@ -15,7 +15,7 @@ namespace { { uint port = gCoreContext->GetBackendServerPort(host); - return gCoreContext->GenMythURL(host, port, path, + return MythCoreContext::GenMythURL(host, port, path, StorageGroup::GetGroupToUse(host, storage_group)); } } diff --git a/mythtv/libs/libmythtv/metadataimagehelper.h b/mythtv/libs/libmythtv/metadataimagehelper.h index 06f6d9140ef..7eb795dd559 100644 --- a/mythtv/libs/libmythtv/metadataimagehelper.h +++ b/mythtv/libs/libmythtv/metadataimagehelper.h @@ -27,9 +27,8 @@ struct ArtworkInfo uint height; }; -typedef QList< ArtworkInfo > ArtworkList; - -typedef QMultiMap< VideoArtworkType, ArtworkInfo > ArtworkMap; +using ArtworkList = QList< ArtworkInfo >; +using ArtworkMap = QMultiMap< VideoArtworkType, ArtworkInfo >; MTV_PUBLIC ArtworkMap GetArtwork(const QString& inetref, uint season, diff --git a/mythtv/libs/libmythtv/mheg/dsmcc.cpp b/mythtv/libs/libmythtv/mheg/dsmcc.cpp index 8c426409050..a84a1666d37 100644 --- a/mythtv/libs/libmythtv/mheg/dsmcc.cpp +++ b/mythtv/libs/libmythtv/mheg/dsmcc.cpp @@ -187,7 +187,7 @@ void Dsmcc::ProcessDownloadServerInitiate(const unsigned char *data, ObjCarousel *car = GetCarouselById(carouselId); // This provides us with a map from component tag to carousel ID. - ProfileBodyFull *full = dynamic_cast<ProfileBodyFull*>(gatewayProfile.m_profile_body); + auto *full = dynamic_cast<ProfileBodyFull*>(gatewayProfile.m_profile_body); if (full) { LOG(VB_DSMCC, LOG_DEBUG, QString("[dsmcc] DSI ServiceGateway" diff --git a/mythtv/libs/libmythtv/mheg/dsmcc.h b/mythtv/libs/libmythtv/mheg/dsmcc.h index 4e3913f1f14..dccdb7071eb 100644 --- a/mythtv/libs/libmythtv/mheg/dsmcc.h +++ b/mythtv/libs/libmythtv/mheg/dsmcc.h @@ -95,10 +95,10 @@ class Dsmcc void ProcessSectionIndication(const unsigned char *data, int length, unsigned short streamTag); void ProcessSectionData(const unsigned char *data, int length); - void ProcessSectionDesc(const unsigned char *data, int length); + static void ProcessSectionDesc(const unsigned char *data, int length); - bool ProcessSectionHeader(DsmccSectionHeader *header, - const unsigned char *data, int length); + static bool ProcessSectionHeader(DsmccSectionHeader *header, + const unsigned char *data, int length); void ProcessDownloadServerInitiate(const unsigned char *data, int length); void ProcessDownloadInfoIndication(const unsigned char *data, diff --git a/mythtv/libs/libmythtv/mheg/dsmccbiop.cpp b/mythtv/libs/libmythtv/mheg/dsmccbiop.cpp index fa6ec869866..beb12c11828 100644 --- a/mythtv/libs/libmythtv/mheg/dsmccbiop.cpp +++ b/mythtv/libs/libmythtv/mheg/dsmccbiop.cpp @@ -263,9 +263,9 @@ bool BiopMessage::ProcessDir( if (pDir && binding.m_name.m_comp_count >= 1) { if (strcmp("fil", binding.m_name.m_comps[0].m_kind) == 0) - filecache->AddFileInfo(pDir, &binding); + DSMCCCache::AddFileInfo(pDir, &binding); else if (strcmp("dir", binding.m_name.m_comps[0].m_kind) == 0) - filecache->AddDirInfo(pDir, &binding); + DSMCCCache::AddDirInfo(pDir, &binding); else LOG(VB_DSMCC, LOG_WARNING, QString("[biop] ProcessDir unknown kind %1") .arg(binding.m_name.m_comps[0].m_kind)); diff --git a/mythtv/libs/libmythtv/mheg/dsmcccache.cpp b/mythtv/libs/libmythtv/mheg/dsmcccache.cpp index 9280d0c8c94..8e73a1f11ca 100644 --- a/mythtv/libs/libmythtv/mheg/dsmcccache.cpp +++ b/mythtv/libs/libmythtv/mheg/dsmcccache.cpp @@ -146,7 +146,7 @@ DSMCCCacheDir *DSMCCCache::Srg(const DSMCCCacheReference &ref) LOG(VB_DSMCC, LOG_INFO, QString("[DSMCCCache] New gateway reference %1") .arg(ref.toString())); - DSMCCCacheDir *pSrg = new DSMCCCacheDir(ref); + auto *pSrg = new DSMCCCacheDir(ref); m_Gateways.insert(ref, pSrg); return pSrg; @@ -169,7 +169,7 @@ DSMCCCacheDir *DSMCCCache::Directory(const DSMCCCacheReference &ref) LOG(VB_DSMCC, LOG_INFO, QString("[DSMCCCache] New directory reference %1") .arg(ref.toString())); - DSMCCCacheDir *pDir = new DSMCCCacheDir(ref); + auto *pDir = new DSMCCCacheDir(ref); m_Directories.insert(ref, pDir); return pDir; diff --git a/mythtv/libs/libmythtv/mheg/dsmcccache.h b/mythtv/libs/libmythtv/mheg/dsmcccache.h index bb556067590..11f8968d331 100644 --- a/mythtv/libs/libmythtv/mheg/dsmcccache.h +++ b/mythtv/libs/libmythtv/mheg/dsmcccache.h @@ -102,9 +102,9 @@ class DSMCCCache // Create a new directory. DSMCCCacheDir *Directory(const DSMCCCacheReference &ref); // Add a file to the directory or gateway. - void AddFileInfo(DSMCCCacheDir *dir, const BiopBinding *); + static void AddFileInfo(DSMCCCacheDir *dir, const BiopBinding *); // Add a directory to the directory or gateway. - void AddDirInfo(DSMCCCacheDir *dir, const BiopBinding *); + static void AddDirInfo(DSMCCCacheDir *dir, const BiopBinding *); // Add the contents of a file. void CacheFileData(const DSMCCCacheReference &ref, const QByteArray &data); diff --git a/mythtv/libs/libmythtv/mheg/dsmccobjcarousel.cpp b/mythtv/libs/libmythtv/mheg/dsmccobjcarousel.cpp index 7cf438f97b6..b92e63342e6 100644 --- a/mythtv/libs/libmythtv/mheg/dsmccobjcarousel.cpp +++ b/mythtv/libs/libmythtv/mheg/dsmccobjcarousel.cpp @@ -33,7 +33,7 @@ DSMCCCacheModuleData::DSMCCCacheModuleData(DsmccDii *dii, DSMCCCacheModuleData::~DSMCCCacheModuleData() { - vector<QByteArray*>::iterator it = m_blocks.begin(); + auto it = m_blocks.begin(); for (; it != m_blocks.end(); ++it) delete *it; m_blocks.clear(); @@ -96,7 +96,7 @@ unsigned char *DSMCCCacheModuleData::AddModuleData(DsmccDb *ddb, .arg(m_module_id)); // Re-assemble the blocks into the complete module. - unsigned char *tmp_data = (unsigned char*) malloc(m_receivedData); + auto *tmp_data = (unsigned char*) malloc(m_receivedData); if (tmp_data == nullptr) return nullptr; @@ -126,7 +126,7 @@ unsigned char *DSMCCCacheModuleData::AddModuleData(DsmccDb *ddb, "compressed size %1, final size %2") .arg(m_moduleSize).arg(dataLen)); - unsigned char *uncompressed = (unsigned char*) malloc(dataLen); + auto *uncompressed = (unsigned char*) malloc(dataLen); int ret = uncompress(uncompressed, &dataLen, tmp_data, m_moduleSize); if (ret != Z_OK) { @@ -210,7 +210,7 @@ void ObjCarousel::AddModuleInfo(DsmccDii *dii, Dsmcc *status, .arg(dii->m_modules[i].m_module_id)); // Create a new cache module data object. - DSMCCCacheModuleData *cachep = new DSMCCCacheModuleData(dii, info, streamTag); + auto *cachep = new DSMCCCacheModuleData(dii, info, streamTag); int tag = info->m_modinfo.m_tap.m_assoc_tag; LOG(VB_DSMCC, LOG_DEBUG, QString("[dsmcc] Module info tap identifies " "tag %1 with carousel %2") diff --git a/mythtv/libs/libmythtv/mheg/dsmccreceiver.h b/mythtv/libs/libmythtv/mheg/dsmccreceiver.h index ca52054833f..402c3c67d41 100644 --- a/mythtv/libs/libmythtv/mheg/dsmccreceiver.h +++ b/mythtv/libs/libmythtv/mheg/dsmccreceiver.h @@ -13,8 +13,7 @@ class DsmccDii DsmccDii() = default; ~DsmccDii() { - if (m_modules) - delete[] m_modules; + delete[] m_modules; } unsigned long m_download_id {0}; diff --git a/mythtv/libs/libmythtv/mheg/mhegic.cpp b/mythtv/libs/libmythtv/mheg/mhegic.cpp index 08eda245958..ff0978e5df7 100644 --- a/mythtv/libs/libmythtv/mheg/mhegic.cpp +++ b/mythtv/libs/libmythtv/mheg/mhegic.cpp @@ -165,7 +165,7 @@ MHInteractionChannel::GetFile(const QString &csPath, QByteArray &data, // signal from NetStream void MHInteractionChannel::slotFinished(QObject *obj) { - NetStream* p = dynamic_cast< NetStream* >(obj); + auto* p = dynamic_cast< NetStream* >(obj); if (!p) return; diff --git a/mythtv/libs/libmythtv/mheg/mhegic.h b/mythtv/libs/libmythtv/mheg/mhegic.h index c6a71c4d905..c61808ac1ad 100644 --- a/mythtv/libs/libmythtv/mheg/mhegic.h +++ b/mythtv/libs/libmythtv/mheg/mhegic.h @@ -44,7 +44,7 @@ private slots: private: Q_DISABLE_COPY(MHInteractionChannel) mutable QMutex m_mutex; - typedef QHash< QUrl, NetStream* > map_t; + using map_t = QHash< QUrl, NetStream* >; map_t m_pending; // Pending requests map_t m_finished; // Completed requests }; diff --git a/mythtv/libs/libmythtv/mheg/mhi.cpp b/mythtv/libs/libmythtv/mheg/mhi.cpp index abf18ac5cb4..44c1663e603 100644 --- a/mythtv/libs/libmythtv/mheg/mhi.cpp +++ b/mythtv/libs/libmythtv/mheg/mhi.cpp @@ -72,18 +72,9 @@ class MHIImageData bool m_bUnder; }; -// Special value for the NetworkBootInfo version. Real values are a byte. -#define NBI_VERSION_UNSET 257 - MHIContext::MHIContext(InteractiveTV *parent) : m_parent(parent), m_dsmcc(new Dsmcc()), - m_notify(nullptr), m_keyProfile(0), - m_engine(MHCreateEngine(this)), m_stop(false), - m_updated(false), m_face(nullptr), - m_face_loaded(false), m_engineThread(nullptr), m_currentChannel(-1), - m_currentStream(-1), m_isLive(false), m_currentSource(-1), - m_audioTag(-1), m_videoTag(-1), - m_lastNbiVersion(NBI_VERSION_UNSET) + m_engine(MHCreateEngine(this)) { if (!ft_loaded) { @@ -145,7 +136,7 @@ MHIContext::~MHIContext() // NB caller must hold m_display_lock void MHIContext::ClearDisplay(void) { - list<MHIImageData*>::iterator it = m_display.begin(); + auto it = m_display.begin(); for (; it != m_display.end(); ++it) delete *it; m_display.clear(); @@ -155,7 +146,7 @@ void MHIContext::ClearDisplay(void) // NB caller must hold m_dsmccLock void MHIContext::ClearQueue(void) { - MythDeque<DSMCCPacket*>::iterator it = m_dsmccQueue.begin(); + auto it = m_dsmccQueue.begin(); for (; it != m_dsmccQueue.end(); ++it) delete *it; m_dsmccQueue.clear(); @@ -305,8 +296,7 @@ void MHIContext::QueueDSMCCPacket( unsigned char *data, int length, int componentTag, unsigned carouselId, int dataBroadcastId) { - unsigned char *dataCopy = - (unsigned char*) malloc(length * sizeof(unsigned char)); + auto *dataCopy = (unsigned char*) malloc(length * sizeof(unsigned char)); if (dataCopy == nullptr) return; @@ -519,7 +509,7 @@ bool MHIContext::GetCarouselData(QString objectPath, QByteArray &result) // Mapping from key name & UserInput register to UserInput EventData class MHKeyLookup { - typedef QPair< QString, int /*UserInput register*/ > key_t; + using key_t = QPair< QString, int /*UserInput register*/ >; public: MHKeyLookup(); @@ -617,8 +607,8 @@ MHKeyLookup::MHKeyLookup() // and return true otherwise we return false. bool MHIContext::OfferKey(const QString& key) { - static const MHKeyLookup s_keymap; - int action = s_keymap.Find(key, m_keyProfile); + static const MHKeyLookup kKeymap; + int action = kKeymap.Find(key, m_keyProfile); if (action == 0) return false; @@ -645,7 +635,7 @@ void MHIContext::Reinit(const QRect &videoRect, const QRect &dispRect, float asp // MHEG presumes square pixels enum { kNone, kHoriz, kBoth }; int mode = gCoreContext->GetNumSetting("MhegAspectCorrection", kNone); - double const aspectd = static_cast<double>(aspect); + auto const aspectd = static_cast<double>(aspect); double const vz = (mode == kBoth) ? min(1.15, 1. / sqrt(aspectd)) : 1.; double const hz = (mode > kNone) ? vz * aspectd : 1.; @@ -684,7 +674,7 @@ void MHIContext::UpdateOSD(InteractiveScreen *osdWindow, // but when we create the OSD we overlay everything over the video. // We need to cut out anything belowthe video on the display stack // to leave the video area clear. - list<MHIImageData*>::iterator it = m_display.begin(); + auto it = m_display.begin(); for (; it != m_display.end(); ++it) { MHIImageData *data = *it; @@ -712,7 +702,7 @@ void MHIContext::UpdateOSD(InteractiveScreen *osdWindow, QImage image = data->m_image.copy(rect.x()-data->m_x, rect.y()-data->m_y, rect.width(), rect.height()); - MHIImageData *newData = new MHIImageData; + auto *newData = new MHIImageData; newData->m_image = image; newData->m_x = rect.x(); newData->m_y = rect.y(); @@ -736,8 +726,7 @@ void MHIContext::UpdateOSD(InteractiveScreen *osdWindow, continue; image->Assign(data->m_image); - MythUIImage *uiimage = new MythUIImage(osdWindow, QString("itv%1") - .arg(count)); + auto *uiimage = new MythUIImage(osdWindow, QString("itv%1").arg(count)); if (uiimage) { uiimage->SetImage(image); @@ -808,7 +797,7 @@ void MHIContext::AddToDisplay(const QImage &image, const QRect &displayRect, boo { const QRect scaledRect = Scale(displayRect); - MHIImageData *data = new MHIImageData; + auto *data = new MHIImageData; data->m_image = image.convertToFormat(QImage::Format_ARGB32).scaled( scaledRect.width(), scaledRect.height(), @@ -823,7 +812,7 @@ void MHIContext::AddToDisplay(const QImage &image, const QRect &displayRect, boo else { // Replace any existing items under the video with this - list<MHIImageData*>::iterator it = m_display.begin(); + auto it = m_display.begin(); while (it != m_display.end()) { MHIImageData *old = *it; @@ -867,7 +856,7 @@ void MHIContext::DrawVideo(const QRect &videoRect, const QRect &dispRect) // Mark all existing items in the display stack as under the video QMutexLocker locker(&m_display_lock); - list<MHIImageData*>::iterator it = m_display.begin(); + auto it = m_display.begin(); for (; it != m_display.end(); ++it) { (*it)->m_bUnder = true; @@ -1244,15 +1233,6 @@ void MHIContext::DrawBackground(const QRegion ®) MHRgba(0, 0, 0, 255)/* black. */); } -MHIText::MHIText(MHIContext *parent): m_parent(parent) -{ - m_fontsize = 12; - m_fontItalic = false; - m_fontBold = false; - m_width = 0; - m_height = 0; -} - void MHIText::Draw(int x, int y) { m_parent->DrawImage(x, y, QRect(x, y, m_width, m_height), m_image); @@ -1712,7 +1692,7 @@ void MHIDLA::DrawArcSector(int /*x*/, int /*y*/, int /*width*/, int /*height*/, // The UK profile says that MHEG should not contain concave or // self-crossing polygons but we can get the former at least as // a result of rounding when drawing ellipses. -typedef struct { int yBottom, yTop, xBottom; float slope; } lineSeg; +struct lineSeg { int m_yBottom, m_yTop, m_xBottom; float m_slope; }; void MHIDLA::DrawPoly(bool isFilled, int nPoints, const int *xArray, const int *yArray) { @@ -1737,17 +1717,17 @@ void MHIDLA::DrawPoly(bool isFilled, int nPoints, const int *xArray, const int * { if (lastY > thisY) { - lineArray[nLines].yBottom = thisY; - lineArray[nLines].yTop = lastY; - lineArray[nLines].xBottom = thisX; + lineArray[nLines].m_yBottom = thisY; + lineArray[nLines].m_yTop = lastY; + lineArray[nLines].m_xBottom = thisX; } else { - lineArray[nLines].yBottom = lastY; - lineArray[nLines].yTop = thisY; - lineArray[nLines].xBottom = lastX; + lineArray[nLines].m_yBottom = lastY; + lineArray[nLines].m_yTop = thisY; + lineArray[nLines].m_xBottom = lastX; } - lineArray[nLines++].slope = + lineArray[nLines++].m_slope = (float)(thisX-lastX) / (float)(thisY-lastY); } if (thisY < yMin) @@ -1768,10 +1748,10 @@ void MHIDLA::DrawPoly(bool isFilled, int nPoints, const int *xArray, const int * int crossings = 0, xMin = 0, xMax = 0; for (int l = 0; l < nLines; l++) { - if (y >= lineArray[l].yBottom && y < lineArray[l].yTop) + if (y >= lineArray[l].m_yBottom && y < lineArray[l].m_yTop) { - int x = (int)round((float)(y - lineArray[l].yBottom) * - lineArray[l].slope) + lineArray[l].xBottom; + int x = (int)round((float)(y - lineArray[l].m_yBottom) * + lineArray[l].m_slope) + lineArray[l].m_xBottom; if (crossings == 0 || x < xMin) xMin = x; if (crossings == 0 || x > xMax) @@ -1806,7 +1786,7 @@ void MHIDLA::DrawPoly(bool isFilled, int nPoints, const int *xArray, const int * } MHIBitmap::MHIBitmap(MHIContext *parent, bool tiled) - : m_parent(parent), m_tiled(tiled), m_opaque(false), + : m_parent(parent), m_tiled(tiled), m_copyCtx(new MythAVCopy(false)) { } @@ -1948,7 +1928,7 @@ void MHIBitmap::CreateFromMPEG(const unsigned char *data, int length) memset(&retbuf, 0, sizeof(AVFrame)); int bufflen = nContentWidth * nContentHeight * 3; - unsigned char *outputbuf = (unsigned char*)av_malloc(bufflen); + auto *outputbuf = (unsigned char*)av_malloc(bufflen); av_image_fill_arrays(retbuf.data, retbuf.linesize, outputbuf, AV_PIX_FMT_RGB24, diff --git a/mythtv/libs/libmythtv/mheg/mhi.h b/mythtv/libs/libmythtv/mheg/mhi.h index e8ad5a02289..53dee1ae6b0 100644 --- a/mythtv/libs/libmythtv/mheg/mhi.h +++ b/mythtv/libs/libmythtv/mheg/mhi.h @@ -41,6 +41,9 @@ class MHStream; class MThread; class QByteArray; +// Special value for the NetworkBootInfo version. Real values are a byte. +#define NBI_VERSION_UNSET 257 + /** \class MHIContext * \brief Contains various utility functions for interactive television. */ @@ -175,53 +178,54 @@ class MHIContext : public MHContext, public QRunnable bool GetDSMCCObject(const QString &objectPath, QByteArray &result); bool CheckAccess(const QString &objectPath, QByteArray &cert); - InteractiveTV *m_parent; + InteractiveTV *m_parent {nullptr}; - Dsmcc *m_dsmcc; // Pointer to the DSMCC object carousel. + // Pointer to the DSMCC object carousel. + Dsmcc *m_dsmcc {nullptr}; QMutex m_dsmccLock; MythDeque<DSMCCPacket*> m_dsmccQueue; MHInteractionChannel m_ic; // Interaction channel - MHStream *m_notify; + MHStream *m_notify {nullptr}; QMutex m_keyLock; MythDeque<int> m_keyQueue; - int m_keyProfile; + int m_keyProfile {0}; MHEG *m_engine; // Pointer to the MHEG engine mutable QMutex m_runLock; QWaitCondition m_engine_wait; // protected by m_runLock - bool m_stop; // protected by m_runLock + bool m_stop {false}; // protected by m_runLock QMutex m_display_lock; - bool m_updated; + bool m_updated {false}; list<MHIImageData*> m_display; // List of items to display - FT_Face m_face; - bool m_face_loaded; + FT_Face m_face {nullptr}; + bool m_face_loaded {false}; - MThread *m_engineThread; + MThread *m_engineThread {nullptr}; - int m_currentChannel; - int m_currentStream; - bool m_isLive; - int m_currentSource; + int m_currentChannel {-1}; + int m_currentStream {-1}; + bool m_isLive {false}; + int m_currentSource {-1}; - int m_audioTag; - int m_videoTag; + int m_audioTag {-1}; + int m_videoTag {-1}; QList<int> m_tuneinfo; - uint m_lastNbiVersion; + uint m_lastNbiVersion {NBI_VERSION_UNSET}; vector<unsigned char> m_nbiData; QRect m_videoRect, m_videoDisplayRect; QRect m_displayRect; // Channel index database cache - typedef QPair< int, int > Val_t; // transportid, chanid - typedef QPair< int, int > Key_t; // networkid, serviceid - typedef QMap< Key_t, Val_t > ChannelCache_t; + using Val_t = QPair< int, int >; // transportid, chanid + using Key_t = QPair< int, int >; // networkid, serviceid + using ChannelCache_t = QMap< Key_t, Val_t >; ChannelCache_t m_channelCache; QMutex m_channelMutex; static inline int Tid(ChannelCache_t::const_iterator it) { return it->first; } @@ -234,7 +238,8 @@ class MHIContext : public MHContext, public QRunnable class MHIText : public MHTextDisplay { public: - explicit MHIText(MHIContext *parent); + explicit MHIText(MHIContext *parent) + : m_parent(parent) {} virtual ~MHIText() = default; void Draw(int x, int y) override; // MHTextDisplay @@ -247,13 +252,13 @@ class MHIText : public MHTextDisplay QRect GetBounds(const QString &str, int &strLen, int maxSize = -1) override; // MHTextDisplay public: - MHIContext *m_parent; + MHIContext *m_parent {nullptr}; QImage m_image; - int m_fontsize; - bool m_fontItalic; - bool m_fontBold; - int m_width; - int m_height; + int m_fontsize {12}; + bool m_fontItalic {false}; + bool m_fontBold {false}; + int m_width {0}; + int m_height {0}; }; /** \class MHIBitmap @@ -297,11 +302,11 @@ class MHIBitmap : public MHBitmapDisplay bool IsOpaque(void) override { return !m_image.isNull() && m_opaque; } // MHBitmapDisplay public: - MHIContext *m_parent; + MHIContext *m_parent {nullptr}; bool m_tiled; QImage m_image; - bool m_opaque; - MythAVCopy *m_copyCtx; + bool m_opaque {false}; + MythAVCopy *m_copyCtx {nullptr}; }; /** \class MHIDLA @@ -312,10 +317,8 @@ class MHIDLA : public MHDLADisplay public: MHIDLA(MHIContext *parent, bool isBoxed, MHRgba lineColour, MHRgba fillColour) - : m_parent(parent), m_width(0), - m_height(0), m_boxed(isBoxed), - m_boxLineColour(lineColour), m_boxFillColour(fillColour), - m_lineWidth(0) {} + : m_parent(parent), m_boxed(isBoxed), + m_boxLineColour(lineColour), m_boxFillColour(fillColour) {} /// Draw the completed drawing onto the display. void Draw(int x, int y) override; // MHDLADisplay /// Set the box size. Also clears the drawing. @@ -348,16 +351,16 @@ class MHIDLA : public MHDLADisplay void DrawLineSub(int x1, int y1, int x2, int y2, bool swapped); protected: - MHIContext *m_parent; + MHIContext *m_parent {nullptr}; QImage m_image; - int m_width; ///< Width of the drawing - int m_height; ///< Height of the drawing - bool m_boxed; ///< Does it have a border? - MHRgba m_boxLineColour; ///< Line colour for the background - MHRgba m_boxFillColour; ///< Fill colour for the background - MHRgba m_lineColour; ///< Current line colour. - MHRgba m_fillColour; ///< Current fill colour. - int m_lineWidth; ///< Current line width. + int m_width {0}; ///< Width of the drawing + int m_height {0}; ///< Height of the drawing + bool m_boxed; ///< Does it have a border? + MHRgba m_boxLineColour; ///< Line colour for the background + MHRgba m_boxFillColour; ///< Fill colour for the background + MHRgba m_lineColour; ///< Current line colour. + MHRgba m_fillColour; ///< Current fill colour. + int m_lineWidth {0}; ///< Current line width. }; /** \class DSMCCPacket @@ -380,7 +383,7 @@ class DSMCCPacket } public: - unsigned char *m_data; + unsigned char *m_data {nullptr}; int m_length; int m_componentTag; unsigned m_carouselId; diff --git a/mythtv/libs/libmythtv/mpeg/H264Parser.cpp b/mythtv/libs/libmythtv/mpeg/H264Parser.cpp index 05be47870e6..6f76ce1bc9c 100644 --- a/mythtv/libs/libmythtv/mpeg/H264Parser.cpp +++ b/mythtv/libs/libmythtv/mpeg/H264Parser.cpp @@ -333,7 +333,7 @@ bool H264Parser::fillRBSP(const uint8_t *byteP, uint32_t byte_count, required_size = ((required_size / 188) + 1) * 188; /* Need a bigger buffer */ - uint8_t *new_buffer = new uint8_t[required_size]; + auto *new_buffer = new uint8_t[required_size]; if (new_buffer == nullptr) { diff --git a/mythtv/libs/libmythtv/mpeg/H264Parser.h b/mythtv/libs/libmythtv/mpeg/H264Parser.h index d9d7c28c370..ee34ed6697b 100644 --- a/mythtv/libs/libmythtv/mpeg/H264Parser.h +++ b/mythtv/libs/libmythtv/mpeg/H264Parser.h @@ -137,7 +137,7 @@ class H264Parser { const uint64_t stream_offset); void Reset(void); - QString NAL_type_str(uint8_t type); + static QString NAL_type_str(uint8_t type); bool stateChanged(void) const { return state_changed; } diff --git a/mythtv/libs/libmythtv/mpeg/atsc_huffman.cpp b/mythtv/libs/libmythtv/mpeg/atsc_huffman.cpp index 7e0d186d7de..17e3740b9e4 100644 --- a/mythtv/libs/libmythtv/mpeg/atsc_huffman.cpp +++ b/mythtv/libs/libmythtv/mpeg/atsc_huffman.cpp @@ -7,9 +7,9 @@ *------------------------------------------------------------------------*/ struct huffman_table { - unsigned int encoded_sequence; - unsigned char character; - unsigned char number_of_bits; + unsigned int m_encodedSequence; + unsigned char m_character; + unsigned char m_numberOfBits; }; unsigned char ATSC_C5[] = @@ -2308,9 +2308,9 @@ QString atsc_huffman2_to_string(const unsigned char *compressed, while (cur_size < max_size) { uint key = lookup[bits]; - if (key && (ptrTable[key].number_of_bits == cur_size)) + if (key && (ptrTable[key].m_numberOfBits == cur_size)) { - decompressed += ptrTable[key].character; + decompressed += ptrTable[key].m_character; current_bit += cur_size; break; } diff --git a/mythtv/libs/libmythtv/mpeg/atscdescriptors.cpp b/mythtv/libs/libmythtv/mpeg/atscdescriptors.cpp index 36af89fa398..9622f6a0e46 100644 --- a/mythtv/libs/libmythtv/mpeg/atscdescriptors.cpp +++ b/mythtv/libs/libmythtv/mpeg/atscdescriptors.cpp @@ -149,8 +149,7 @@ QString MultipleStringStructure::Uncompressed( // Standard Compression Scheme for Unicode (SCSU) str=QString("TODO SCSU encoding"); } else if (mode==0x3f) { // Unicode, UTF-16 Form - const unsigned short* ustr = - reinterpret_cast<const unsigned short*>(buf); + const auto* ustr = reinterpret_cast<const unsigned short*>(buf); for (int j=0; j<(len>>1); j++) str.append( QChar( (ustr[j]<<8) | (ustr[j]>>8) ) ); } else if (0x40<=mode && mode<=0x41) @@ -234,26 +233,26 @@ QString ContentAdvisoryDescriptor::toString() const QString AudioStreamDescriptor::SampleRateCodeString(void) const { - static const char* asd[] = + static const char* s_asd[] = { "48kbps", "44.1kbps", "32kbps", "Reserved", "48kbps or 44.1kbps", "48kbps or 32kbps", "44.1kbps or 32kbps", "48kbps or 44.1kbps or 32kbps" }; - return QString(asd[SampleRateCode()]); + return QString(s_asd[SampleRateCode()]); } QString AudioStreamDescriptor::BitRateCodeString(void) const { // cppcheck-suppress variableScope - static const char* ebr[19] = + static const char* s_ebr[19] = { "=32kbps", "=40kbps", "=48kbps", "=56kbps", "=64kbps", "=80kbps", "=96kbps", "=112kbps", "=128kbps", "=160kbps", "=192kbps", "=224kbps", "=256kbps", "=320kbps", "=384kbps", "=448kbps", "=512kbps", "=576kbps", "=640kbps" }; - static const char* ubr[19] = + static const char* s_ubr[19] = { "<=32kbps", "<=40kbps", "<=48kbps", "<=56kbps", "<=64kbps", "<=80kbps", "<=96kbps", "<=112kbps", "<=128kbps", "<=160kbps", @@ -262,34 +261,34 @@ QString AudioStreamDescriptor::BitRateCodeString(void) const }; if (BitRateCode() <= 18) - return QString(ebr[BitRateCode()]); + return QString(s_ebr[BitRateCode()]); if ((BitRateCode() >= 32) && (BitRateCode() <= 50)) - return QString(ubr[BitRateCode()-32]); + return QString(s_ubr[BitRateCode()-32]); return QString("Unknown Bit Rate Code"); } QString AudioStreamDescriptor::SurroundModeString(void) const { - static const char* sms[] = + static const char* s_sms[] = { "Not indicated", "Not Dolby surround encoded", "Dolby surround encoded", "Reserved", }; - return QString(sms[SurroundMode()]); + return QString(s_sms[SurroundMode()]); } QString AudioStreamDescriptor::ChannelsString(void) const { - static const char* cs[] = + static const char* s_cs[] = { "1 + 1", "1/0", "2/0", "3/0", "2/1", "3/1", "2/2 ", "3/2", "1", "<= 2", "<= 3", "<= 4", "<= 5", "<= 6", "Reserved", "Reserved" }; - return cs[Channels()]; + return s_cs[Channels()]; } QString AudioStreamDescriptor::toString() const diff --git a/mythtv/libs/libmythtv/mpeg/atscdescriptors.h b/mythtv/libs/libmythtv/mpeg/atscdescriptors.h index 38f38e332e0..f6bd0553c60 100644 --- a/mythtv/libs/libmythtv/mpeg/atscdescriptors.h +++ b/mythtv/libs/libmythtv/mpeg/atscdescriptors.h @@ -13,7 +13,7 @@ using namespace std; using namespace std; -typedef QMap<int, const unsigned char*> IntToBuf; +using IntToBuf = QMap<int, const unsigned char*>; class MultipleStringStructure { diff --git a/mythtv/libs/libmythtv/mpeg/atscstreamdata.cpp b/mythtv/libs/libmythtv/mpeg/atscstreamdata.cpp index ce155031ebd..d7997df5224 100644 --- a/mythtv/libs/libmythtv/mpeg/atscstreamdata.cpp +++ b/mythtv/libs/libmythtv/mpeg/atscstreamdata.cpp @@ -227,7 +227,7 @@ bool ATSCStreamData::HandleTables(uint pid, const PSIPTable &psip) SetVersionMGT(version); if (_cache_tables) { - MasterGuideTable *mgt = new MasterGuideTable(psip); + auto *mgt = new MasterGuideTable(psip); CacheMGT(mgt); ProcessMGT(mgt); } @@ -244,8 +244,7 @@ bool ATSCStreamData::HandleTables(uint pid, const PSIPTable &psip) SetVersionTVCT(tsid, version); if (_cache_tables) { - TerrestrialVirtualChannelTable *vct = - new TerrestrialVirtualChannelTable(psip); + auto *vct = new TerrestrialVirtualChannelTable(psip); CacheTVCT(pid, vct); ProcessTVCT(tsid, vct); } @@ -262,8 +261,7 @@ bool ATSCStreamData::HandleTables(uint pid, const PSIPTable &psip) SetVersionCVCT(tsid, version); if (_cache_tables) { - CableVirtualChannelTable *vct = - new CableVirtualChannelTable(psip); + auto *vct = new CableVirtualChannelTable(psip); CacheCVCT(pid, vct); ProcessCVCT(tsid, vct); } @@ -860,7 +858,7 @@ void ATSCStreamData::CacheCVCT(uint pid, CableVirtualChannelTable* cvct) _cached_cvcts[pid] = cvct; } -bool ATSCStreamData::DeleteCachedTable(PSIPTable *psip) const +bool ATSCStreamData::DeleteCachedTable(const PSIPTable *psip) const { if (!psip) return false; @@ -903,14 +901,14 @@ bool ATSCStreamData::DeleteCachedTable(PSIPTable *psip) const void ATSCStreamData::ReturnCachedTVCTTables(tvct_vec_t &tvcts) const { - for (tvct_vec_t::iterator it = tvcts.begin(); it != tvcts.end(); ++it) + for (auto it = tvcts.begin(); it != tvcts.end(); ++it) ReturnCachedTable(*it); tvcts.clear(); } void ATSCStreamData::ReturnCachedCVCTTables(cvct_vec_t &cvcts) const { - for (cvct_vec_t::iterator it = cvcts.begin(); it != cvcts.end(); ++it) + for (auto it = cvcts.begin(); it != cvcts.end(); ++it) ReturnCachedTable(*it); cvcts.clear(); } @@ -919,7 +917,7 @@ void ATSCStreamData::AddATSCMainListener(ATSCMainStreamListener *val) { QMutexLocker locker(&_listener_lock); - atsc_main_listener_vec_t::iterator it = _atsc_main_listeners.begin(); + auto it = _atsc_main_listeners.begin(); for (; it != _atsc_main_listeners.end(); ++it) if (((void*)val) == ((void*)*it)) return; @@ -931,7 +929,7 @@ void ATSCStreamData::RemoveATSCMainListener(ATSCMainStreamListener *val) { QMutexLocker locker(&_listener_lock); - atsc_main_listener_vec_t::iterator it = _atsc_main_listeners.begin(); + auto it = _atsc_main_listeners.begin(); for (; it != _atsc_main_listeners.end(); ++it) { if (((void*)val) == ((void*)*it)) @@ -946,7 +944,7 @@ void ATSCStreamData::AddSCTEMainListener(SCTEMainStreamListener *val) { QMutexLocker locker(&_listener_lock); - scte_main_listener_vec_t::iterator it = _scte_main_listeners.begin(); + auto it = _scte_main_listeners.begin(); for (; it != _scte_main_listeners.end(); ++it) if (((void*)val) == ((void*)*it)) return; @@ -958,7 +956,7 @@ void ATSCStreamData::RemoveSCTEMainListener(SCTEMainStreamListener *val) { QMutexLocker locker(&_listener_lock); - scte_main_listener_vec_t::iterator it = _scte_main_listeners.begin(); + auto it = _scte_main_listeners.begin(); for (; it != _scte_main_listeners.end(); ++it) { if (((void*)val) == ((void*)*it)) @@ -973,7 +971,7 @@ void ATSCStreamData::AddATSCAuxListener(ATSCAuxStreamListener *val) { QMutexLocker locker(&_listener_lock); - atsc_aux_listener_vec_t::iterator it = _atsc_aux_listeners.begin(); + auto it = _atsc_aux_listeners.begin(); for (; it != _atsc_aux_listeners.end(); ++it) if (((void*)val) == ((void*)*it)) return; @@ -985,7 +983,7 @@ void ATSCStreamData::RemoveATSCAuxListener(ATSCAuxStreamListener *val) { QMutexLocker locker(&_listener_lock); - atsc_aux_listener_vec_t::iterator it = _atsc_aux_listeners.begin(); + auto it = _atsc_aux_listeners.begin(); for (; it != _atsc_aux_listeners.end(); ++it) { if (((void*)val) == ((void*)*it)) @@ -1000,7 +998,7 @@ void ATSCStreamData::AddATSCEITListener(ATSCEITStreamListener *val) { QMutexLocker locker(&_listener_lock); - atsc_eit_listener_vec_t::iterator it = _atsc_eit_listeners.begin(); + auto it = _atsc_eit_listeners.begin(); for (; it != _atsc_eit_listeners.end(); ++it) if (((void*)val) == ((void*)*it)) return; @@ -1012,7 +1010,7 @@ void ATSCStreamData::RemoveATSCEITListener(ATSCEITStreamListener *val) { QMutexLocker locker(&_listener_lock); - atsc_eit_listener_vec_t::iterator it = _atsc_eit_listeners.begin(); + auto it = _atsc_eit_listeners.begin(); for (; it != _atsc_eit_listeners.end(); ++it) { if (((void*)val) == ((void*)*it)) @@ -1027,7 +1025,7 @@ void ATSCStreamData::AddATSC81EITListener(ATSC81EITStreamListener *val) { QMutexLocker locker(&_listener_lock); - atsc81_eit_listener_vec_t::iterator it = _atsc81_eit_listeners.begin(); + auto it = _atsc81_eit_listeners.begin(); for (; it != _atsc81_eit_listeners.end(); ++it) if (((void*)val) == ((void*)*it)) return; @@ -1039,7 +1037,7 @@ void ATSCStreamData::RemoveATSC81EITListener(ATSC81EITStreamListener *val) { QMutexLocker locker(&_listener_lock); - atsc81_eit_listener_vec_t::iterator it = _atsc81_eit_listeners.begin(); + auto it = _atsc81_eit_listeners.begin(); for (; it != _atsc81_eit_listeners.end(); ++it) { if (((void*)val) == ((void*)*it)) diff --git a/mythtv/libs/libmythtv/mpeg/atscstreamdata.h b/mythtv/libs/libmythtv/mpeg/atscstreamdata.h index 2a43770c241..749b5b2cb0f 100644 --- a/mythtv/libs/libmythtv/mpeg/atscstreamdata.h +++ b/mythtv/libs/libmythtv/mpeg/atscstreamdata.h @@ -121,7 +121,7 @@ class MTV_PUBLIC ATSCStreamData : virtual public MPEGStreamData void CacheTVCT(uint pid, TerrestrialVirtualChannelTable*); void CacheCVCT(uint pid, CableVirtualChannelTable*); protected: - bool DeleteCachedTable(PSIPTable *psip) const override; // MPEGStreamData + bool DeleteCachedTable(const PSIPTable *psip) const override; // MPEGStreamData private: uint _GPS_UTC_offset; diff --git a/mythtv/libs/libmythtv/mpeg/atsctables.cpp b/mythtv/libs/libmythtv/mpeg/atsctables.cpp index 3fe3e1c00ae..f5983b572a7 100644 --- a/mythtv/libs/libmythtv/mpeg/atsctables.cpp +++ b/mythtv/libs/libmythtv/mpeg/atsctables.cpp @@ -5,7 +5,7 @@ QString MasterGuideTable::TableClassString(uint i) const { - static const QString tts[] = { + static const QString kTts[] = { QString("UNKNOWN"), QString("Terrestrial VCT with current()"), QString("Terrestrial VCT with !current()"), @@ -19,7 +19,7 @@ QString MasterGuideTable::TableClassString(uint i) const QString("RTT + 0x300") }; int tt = TableClass(i) + 1; - return tts[tt]; + return kTts[tt]; } int MasterGuideTable::TableClass(uint i) const @@ -174,27 +174,27 @@ QString MasterGuideTable::toStringXML(uint indent_level) const QString VirtualChannelTable::ModulationModeString(uint i) const { - static const char *modnames[6] = + static const char *s_modnames[6] = { "[Reserved]", "Analog", "SCTE mode 1", "SCTE mode 2", "ATSC 8-VSB", "ATSC 16-VSB", }; uint mode = ModulationMode(i); - if (mode >= (sizeof(modnames) / sizeof(char*))) + if (mode >= (sizeof(s_modnames) / sizeof(char*))) return QString("Unknown 0x%1").arg(mode,2,16,QChar('0')); - return QString(modnames[mode]); + return QString(s_modnames[mode]); } QString VirtualChannelTable::ServiceTypeString(uint i) const { - static const char *servicenames[5] = + static const char *s_servicenames[5] = { "[Reserved]", "Analog", "ATSC TV", "ATSC Audio", "ATSC Data", }; uint type = ServiceType(i); - if (type >= (sizeof(servicenames) / sizeof(char*))) + if (type >= (sizeof(s_servicenames) / sizeof(char*))) return QString("Unknown 0x%1").arg(type,2,16,QChar('0')); - return QString(servicenames[type]); + return QString(s_servicenames[type]); } QString VirtualChannelTable::toString(void) const diff --git a/mythtv/libs/libmythtv/mpeg/atsctables.h b/mythtv/libs/libmythtv/mpeg/atsctables.h index 1eef89fdb9a..8a458539d5e 100644 --- a/mythtv/libs/libmythtv/mpeg/atsctables.h +++ b/mythtv/libs/libmythtv/mpeg/atsctables.h @@ -51,7 +51,7 @@ class MTV_PUBLIC TableClass { public: - typedef enum + enum kTableTypes { UNKNOWN = -1, TVCTc = 0, @@ -64,7 +64,7 @@ class MTV_PUBLIC TableClass ETTe = 7, DCCT = 8, RRT = 9, - } kTableTypes; + }; }; /** \class MasterGuideTable diff --git a/mythtv/libs/libmythtv/mpeg/dishdescriptors.cpp b/mythtv/libs/libmythtv/mpeg/dishdescriptors.cpp index 91e1dabf7d1..bd223df3aa4 100644 --- a/mythtv/libs/libmythtv/mpeg/dishdescriptors.cpp +++ b/mythtv/libs/libmythtv/mpeg/dishdescriptors.cpp @@ -301,28 +301,28 @@ volatile bool DishContentDescriptor::dishCategoryDescExists = false; QString dish_theme_type_to_string(uint theme_type) { // cppcheck-suppress variableScope - static const char *themes[kThemeLast] = + static const char *s_themes[kThemeLast] = { "", "Movie", "Sports", "News/Business", "Family/Children", "Education", "Series/Special", "Music/Art", "Religious", "Off-Air" }; if ((theme_type > kThemeNone) && (theme_type < kThemeLast)) - return QString(themes[theme_type]); + return QString(s_themes[theme_type]); return ""; } DishThemeType string_to_dish_theme_type(const QString &theme_type) { - static const char *themes[kThemeLast] = + static const char *s_themes[kThemeLast] = { "", "Movie", "Sports", "News/Business", "Family/Children", "Education", "Series/Special", "Music/Art", "Religious", "Off-Air" }; for (uint i = 1; i < 10; i++) - if (theme_type == themes[i]) + if (theme_type == s_themes[i]) return (DishThemeType) i; return kThemeNone; diff --git a/mythtv/libs/libmythtv/mpeg/dishdescriptors.h b/mythtv/libs/libmythtv/mpeg/dishdescriptors.h index f86d7cc35e6..fbbe39a5ee5 100644 --- a/mythtv/libs/libmythtv/mpeg/dishdescriptors.h +++ b/mythtv/libs/libmythtv/mpeg/dishdescriptors.h @@ -134,7 +134,7 @@ class DishEventTagsDescriptor : public MPEGDescriptor QDate originalairdate(void) const; }; -typedef enum +enum DishThemeType { kThemeNone = 0, kThemeMovie, @@ -147,7 +147,7 @@ typedef enum kThemeReligious, kThemeOffAir, kThemeLast, -} DishThemeType; +}; QString dish_theme_type_to_string(uint theme_type); DishThemeType string_to_dish_theme_type(const QString &type); diff --git a/mythtv/libs/libmythtv/mpeg/dvbdescriptors.cpp b/mythtv/libs/libmythtv/mpeg/dvbdescriptors.cpp index 53610c790a0..39aa0cc976d 100644 --- a/mythtv/libs/libmythtv/mpeg/dvbdescriptors.cpp +++ b/mythtv/libs/libmythtv/mpeg/dvbdescriptors.cpp @@ -66,7 +66,7 @@ QString dvb_decode_text(const unsigned char *src, uint raw_length, if (src[0] == 0x11) { size_t length = (raw_length - 1) / 2; - QChar *to = new QChar[length]; + auto *to = new QChar[length]; for (size_t i=0; i<length; i++) to[i] = (src[1 + i*2] << 8) + src[1 + i*2 + 1]; QString to2(to, length); @@ -85,8 +85,7 @@ QString dvb_decode_text(const unsigned char *src, uint raw_length, // if a override encoding is specified and the default ISO 6937 encoding // would be used copy the override encoding in front of the text - unsigned char *dst = - new unsigned char[raw_length + encoding_override_length]; + auto *dst = new unsigned char[raw_length + encoding_override_length]; uint length = 0; if (encoding_override && src[0] >= 0x20) { @@ -117,7 +116,7 @@ static QString decode_text(const unsigned char *buf, uint length) { // Only some of the QTextCodec calls are reentrant. // If you use this please verify that you are using a reentrant call. - static const QTextCodec *iso8859_codecs[16] = + static const QTextCodec *s_iso8859Codecs[16] = { QTextCodec::codecForName("Latin1"), QTextCodec::codecForName("ISO8859-1"), // Western @@ -144,7 +143,7 @@ static QString decode_text(const unsigned char *buf, uint length) } if ((buf[0] >= 0x01) && (buf[0] <= 0x0B)) { - return iso8859_codecs[4 + buf[0]]->toUnicode((char*)(buf + 1), length - 1); + return s_iso8859Codecs[4 + buf[0]]->toUnicode((char*)(buf + 1), length - 1); } if (buf[0] == 0x10) { @@ -156,7 +155,7 @@ static QString decode_text(const unsigned char *buf, uint length) uint code = buf[1] << 8 | buf[2]; if (code <= 15) - return iso8859_codecs[code]->toUnicode((char*)(buf + 3), length - 3); + return s_iso8859Codecs[code]->toUnicode((char*)(buf + 3), length - 3); return QString::fromLocal8Bit((char*)(buf + 3), length - 3); } if (buf[0] == 0x15) // Already Unicode @@ -189,7 +188,7 @@ QString dvb_decode_short_name(const unsigned char *src, uint raw_length) return ""; } - unsigned char *dst = new unsigned char[raw_length]; + auto *dst = new unsigned char[raw_length]; uint length = 0; // check for emphasis control codes diff --git a/mythtv/libs/libmythtv/mpeg/dvbstreamdata.cpp b/mythtv/libs/libmythtv/mpeg/dvbstreamdata.cpp index a0e07f71331..2ebe5161a47 100644 --- a/mythtv/libs/libmythtv/mpeg/dvbstreamdata.cpp +++ b/mythtv/libs/libmythtv/mpeg/dvbstreamdata.cpp @@ -221,7 +221,7 @@ bool DVBStreamData::HandleTables(uint pid, const PSIPTable &psip) if ((psip.TableID() == TableID::NIT && psip.TableIDExtension() != (uint)_dvb_real_network_id) || (psip.TableID() == TableID::NITo && psip.TableIDExtension() == (uint)_dvb_real_network_id) ) { - NetworkInformationTable *nit = new NetworkInformationTable(psip); + auto *nit = new NetworkInformationTable(psip); if (!nit->Mutate()) { delete nit; @@ -245,8 +245,7 @@ bool DVBStreamData::HandleTables(uint pid, const PSIPTable &psip) if (_cache_tables) { - NetworkInformationTable *nit = - new NetworkInformationTable(psip); + auto *nit = new NetworkInformationTable(psip); CacheNIT(nit); QMutexLocker locker(&_listener_lock); for (size_t i = 0; i < _dvb_main_listeners.size(); i++) @@ -270,8 +269,7 @@ bool DVBStreamData::HandleTables(uint pid, const PSIPTable &psip) if (_cache_tables) { - ServiceDescriptionTable *sdt = - new ServiceDescriptionTable(psip); + auto *sdt = new ServiceDescriptionTable(psip); CacheSDT(sdt); ProcessSDT(tsid, sdt); } @@ -319,8 +317,7 @@ bool DVBStreamData::HandleTables(uint pid, const PSIPTable &psip) if (_desired_netid == sdt.OriginalNetworkID() && _desired_tsid == tsid) { - ServiceDescriptionTable *sdta = - new ServiceDescriptionTable(psip); + auto *sdta = new ServiceDescriptionTable(psip); if (!sdta->Mutate()) { delete sdta; @@ -353,8 +350,7 @@ bool DVBStreamData::HandleTables(uint pid, const PSIPTable &psip) if (_cache_tables) { - BouquetAssociationTable *bat = - new BouquetAssociationTable(psip); + auto *bat = new BouquetAssociationTable(psip); CacheBAT(bat); QMutexLocker locker(&_listener_lock); for (size_t i = 0; i < _dvb_other_listeners.size(); i++) @@ -906,12 +902,12 @@ sdt_vec_t DVBStreamData::GetCachedSDTs(bool current) const void DVBStreamData::ReturnCachedSDTTables(sdt_vec_t &sdts) const { - for (sdt_vec_t::iterator it = sdts.begin(); it != sdts.end(); ++it) + for (auto it = sdts.begin(); it != sdts.end(); ++it) ReturnCachedTable(*it); sdts.clear(); } -bool DVBStreamData::DeleteCachedTable(PSIPTable *psip) const +bool DVBStreamData::DeleteCachedTable(const PSIPTable *psip) const { if (!psip) return false; @@ -996,7 +992,7 @@ void DVBStreamData::AddDVBMainListener(DVBMainStreamListener *val) { QMutexLocker locker(&_listener_lock); - dvb_main_listener_vec_t::iterator it = _dvb_main_listeners.begin(); + auto it = _dvb_main_listeners.begin(); for (; it != _dvb_main_listeners.end(); ++it) if (((void*)val) == ((void*)*it)) return; @@ -1008,7 +1004,7 @@ void DVBStreamData::RemoveDVBMainListener(DVBMainStreamListener *val) { QMutexLocker locker(&_listener_lock); - dvb_main_listener_vec_t::iterator it = _dvb_main_listeners.begin(); + auto it = _dvb_main_listeners.begin(); for (; it != _dvb_main_listeners.end(); ++it) { if (((void*)val) == ((void*)*it)) @@ -1023,7 +1019,7 @@ void DVBStreamData::AddDVBOtherListener(DVBOtherStreamListener *val) { QMutexLocker locker(&_listener_lock); - dvb_other_listener_vec_t::iterator it = _dvb_other_listeners.begin(); + auto it = _dvb_other_listeners.begin(); for (; it != _dvb_other_listeners.end(); ++it) if (((void*)val) == ((void*)*it)) return; @@ -1035,7 +1031,7 @@ void DVBStreamData::RemoveDVBOtherListener(DVBOtherStreamListener *val) { QMutexLocker locker(&_listener_lock); - dvb_other_listener_vec_t::iterator it = _dvb_other_listeners.begin(); + auto it = _dvb_other_listeners.begin(); for (; it != _dvb_other_listeners.end(); ++it) { if (((void*)val) == ((void*)*it)) @@ -1050,7 +1046,7 @@ void DVBStreamData::AddDVBEITListener(DVBEITStreamListener *val) { QMutexLocker locker(&_listener_lock); - dvb_eit_listener_vec_t::iterator it = _dvb_eit_listeners.begin(); + auto it = _dvb_eit_listeners.begin(); for (; it != _dvb_eit_listeners.end(); ++it) if (((void*)val) == ((void*)*it)) return; @@ -1062,7 +1058,7 @@ void DVBStreamData::RemoveDVBEITListener(DVBEITStreamListener *val) { QMutexLocker locker(&_listener_lock); - dvb_eit_listener_vec_t::iterator it = _dvb_eit_listeners.begin(); + auto it = _dvb_eit_listeners.begin(); for (; it != _dvb_eit_listeners.end(); ++it) { if (((void*)val) == ((void*)*it)) diff --git a/mythtv/libs/libmythtv/mpeg/dvbstreamdata.h b/mythtv/libs/libmythtv/mpeg/dvbstreamdata.h index b58c565f8ac..199ea68b10a 100644 --- a/mythtv/libs/libmythtv/mpeg/dvbstreamdata.h +++ b/mythtv/libs/libmythtv/mpeg/dvbstreamdata.h @@ -125,7 +125,7 @@ class MTV_PUBLIC DVBStreamData : virtual public MPEGStreamData void CacheBAT(BouquetAssociationTable*); protected: - bool DeleteCachedTable(PSIPTable *psip) const override; // MPEGStreamData + bool DeleteCachedTable(const PSIPTable *psip) const override; // MPEGStreamData private: /// DVB table monitoring diff --git a/mythtv/libs/libmythtv/mpeg/dvbtables.cpp b/mythtv/libs/libmythtv/mpeg/dvbtables.cpp index 12d9e56c977..e3ea0dae2bf 100644 --- a/mythtv/libs/libmythtv/mpeg/dvbtables.cpp +++ b/mythtv/libs/libmythtv/mpeg/dvbtables.cpp @@ -310,8 +310,8 @@ QDateTime dvbdate2qt(const unsigned char *buf) // "Specification for Service Information in Digital Video Broadcasting" // to convert from Modified Julian Date to Year, Month, Day. - const float tmpA = (float)(1.0 / 365.25); - const float tmpB = (float)(1.0 / 30.6001); + const auto tmpA = (float)(1.0 / 365.25); + const auto tmpB = (float)(1.0 / 30.6001); float mjdf = mjd; int year = (int) truncf((mjdf - 15078.2F) * tmpA); diff --git a/mythtv/libs/libmythtv/mpeg/freesat_huffman.cpp b/mythtv/libs/libmythtv/mpeg/freesat_huffman.cpp index df40eb18d01..4ae73f57eaa 100644 --- a/mythtv/libs/libmythtv/mpeg/freesat_huffman.cpp +++ b/mythtv/libs/libmythtv/mpeg/freesat_huffman.cpp @@ -1,9 +1,9 @@ #include "freesat_huffman.h" struct fsattab { - unsigned int value; - short bits; - char next; + unsigned int m_value; + short m_bits; + char m_next; }; #define START '\0' @@ -59,19 +59,19 @@ QString freesat_huffman_to_string(const unsigned char *compressed, uint size) } else { - unsigned indx = (unsigned)lastch; + auto indx = (unsigned)lastch; for (unsigned j = fsat_index[indx]; j < fsat_index[indx+1]; j++) { unsigned mask = 0, maskbit = 0x80000000; - for (short kk = 0; kk < fsat_table[j].bits; kk++) + for (short kk = 0; kk < fsat_table[j].m_bits; kk++) { mask |= maskbit; maskbit >>= 1; } - if ((value & mask) == fsat_table[j].value) + if ((value & mask) == fsat_table[j].m_value) { - nextCh = fsat_table[j].next; - bitShift = fsat_table[j].bits; + nextCh = fsat_table[j].m_next; + bitShift = fsat_table[j].m_bits; found = true; lastch = nextCh; break; diff --git a/mythtv/libs/libmythtv/mpeg/mpegdescriptors.cpp b/mythtv/libs/libmythtv/mpeg/mpegdescriptors.cpp index acd8979e1b1..a794245855f 100644 --- a/mythtv/libs/libmythtv/mpeg/mpegdescriptors.cpp +++ b/mythtv/libs/libmythtv/mpeg/mpegdescriptors.cpp @@ -78,8 +78,8 @@ desc_list_t MPEGDescriptor::ParseOnlyInclude( const unsigned char *MPEGDescriptor::Find(const desc_list_t &parsed, uint desc_tag) { - desc_list_t::const_iterator it = parsed.begin(); - for (; it != parsed.end(); ++it) + auto it = parsed.cbegin(); + for (; it != parsed.cend(); ++it) { if ((*it)[0] == desc_tag) return *it; @@ -90,8 +90,8 @@ const unsigned char *MPEGDescriptor::Find(const desc_list_t &parsed, desc_list_t MPEGDescriptor::FindAll(const desc_list_t &parsed, uint desc_tag) { desc_list_t tmp; - desc_list_t::const_iterator it = parsed.begin(); - for (; it != parsed.end(); ++it) + auto it = parsed.cbegin(); + for (; it != parsed.cend(); ++it) { if ((*it)[0] == desc_tag) tmp.push_back(*it); @@ -387,7 +387,7 @@ QString MPEGDescriptor::DescriptorTagString(void) const if (IsValid()) { DESC_NAME d(_data, DescriptorLength()+2); \ if (d.IsValid()) str = d.toString(); } } while (false) -QString MPEGDescriptor::descrDump(QString name) const +QString MPEGDescriptor::descrDump(const QString &name) const { QString str; str = QString("%1 Descriptor (0x%2) length(%3). Dumping\n") diff --git a/mythtv/libs/libmythtv/mpeg/mpegdescriptors.h b/mythtv/libs/libmythtv/mpeg/mpegdescriptors.h index db905fdc34c..2b1a6f1fadc 100644 --- a/mythtv/libs/libmythtv/mpeg/mpegdescriptors.h +++ b/mythtv/libs/libmythtv/mpeg/mpegdescriptors.h @@ -314,7 +314,7 @@ class MTV_PUBLIC MPEGDescriptor public: QString hexdump(void) const; - QString descrDump(QString name) const; + QString descrDump(const QString &name) const; }; // a_52a.pdf p119, Table A1 diff --git a/mythtv/libs/libmythtv/mpeg/mpegstreamdata.cpp b/mythtv/libs/libmythtv/mpeg/mpegstreamdata.cpp index 9ef304775d3..f0deb55ad46 100644 --- a/mythtv/libs/libmythtv/mpeg/mpegstreamdata.cpp +++ b/mythtv/libs/libmythtv/mpeg/mpegstreamdata.cpp @@ -239,7 +239,7 @@ PSIPTable* MPEGStreamData::AssemblePSIP(const TSPacket* tspacket, return nullptr; } - PSIPTable* psip = new PSIPTable(*partial); + auto* psip = new PSIPTable(*partial); // Advance to the next packet // pesdata starts only at PSIOffset()+1 @@ -328,7 +328,7 @@ PSIPTable* MPEGStreamData::AssemblePSIP(const TSPacket* tspacket, return nullptr; } - PSIPTable *psip = new PSIPTable(*tspacket); // must be complete packet + auto *psip = new PSIPTable(*tspacket); // must be complete packet // There might be another section after this one in the // current packet. We need room before the end of the @@ -338,7 +338,7 @@ PSIPTable* MPEGStreamData::AssemblePSIP(const TSPacket* tspacket, { // This isn't stuffing, so we need to put this // on as a partial packet. - PSIPTable *pesp = new PSIPTable(*tspacket); + auto *pesp = new PSIPTable(*tspacket); pesp->SetPSIOffset(offset + psip->SectionLength()); SavePartialPSIP(tspacket->PID(), pesp); return psip; @@ -973,7 +973,7 @@ int MPEGStreamData::ProcessData(const unsigned char *buffer, int len) pos = newpos; } - const TSPacket *pkt = reinterpret_cast<const TSPacket*>(&buffer[pos]); + const auto *pkt = reinterpret_cast<const TSPacket*>(&buffer[pos]); pos += TSPacket::kSize; // Advance to next TS packet resync = false; if (!ProcessTSPacket(*pkt)) @@ -1462,13 +1462,13 @@ void MPEGStreamData::ReturnCachedTable(const PSIPTable *psip) const psip_refcnt_map_t::iterator it; it = _cached_slated_for_deletion.find(psip); if (it != _cached_slated_for_deletion.end()) - DeleteCachedTable(const_cast<PSIPTable*>(psip)); + DeleteCachedTable(psip); } } void MPEGStreamData::ReturnCachedPATTables(pat_vec_t &pats) const { - for (pat_vec_t::iterator it = pats.begin(); it != pats.end(); ++it) + for (auto it = pats.begin(); it != pats.end(); ++it) ReturnCachedTable(*it); pats.clear(); } @@ -1482,7 +1482,7 @@ void MPEGStreamData::ReturnCachedPATTables(pat_map_t &pats) const void MPEGStreamData::ReturnCachedCATTables(cat_vec_t &cats) const { - for (cat_vec_t::iterator it = cats.begin(); it != cats.end(); ++it) + for (auto it = cats.begin(); it != cats.end(); ++it) ReturnCachedTable(*it); cats.clear(); } @@ -1496,7 +1496,7 @@ void MPEGStreamData::ReturnCachedCATTables(cat_map_t &cats) const void MPEGStreamData::ReturnCachedPMTTables(pmt_vec_t &pmts) const { - for (pmt_vec_t::iterator it = pmts.begin(); it != pmts.end(); ++it) + for (auto it = pmts.begin(); it != pmts.end(); ++it) ReturnCachedTable(*it); pmts.clear(); } @@ -1514,7 +1514,7 @@ void MPEGStreamData::IncrementRefCnt(const PSIPTable *psip) const _cached_ref_cnt[psip] = _cached_ref_cnt[psip] + 1; } -bool MPEGStreamData::DeleteCachedTable(PSIPTable *psip) const +bool MPEGStreamData::DeleteCachedTable(const PSIPTable *psip) const { if (!psip) return false; @@ -1560,7 +1560,7 @@ bool MPEGStreamData::DeleteCachedTable(PSIPTable *psip) const void MPEGStreamData::CachePAT(const ProgramAssociationTable *_pat) { - ProgramAssociationTable *pat = new ProgramAssociationTable(*_pat); + auto *pat = new ProgramAssociationTable(*_pat); uint key = (_pat->TransportStreamID() << 8) | _pat->Section(); QMutexLocker locker(&_cache_lock); @@ -1574,7 +1574,7 @@ void MPEGStreamData::CachePAT(const ProgramAssociationTable *_pat) void MPEGStreamData::CacheCAT(const ConditionalAccessTable *_cat) { - ConditionalAccessTable *cat = new ConditionalAccessTable(*_cat); + auto *cat = new ConditionalAccessTable(*_cat); uint key = (_cat->TableIDExtension() << 8) | _cat->Section(); QMutexLocker locker(&_cache_lock); @@ -1588,7 +1588,7 @@ void MPEGStreamData::CacheCAT(const ConditionalAccessTable *_cat) void MPEGStreamData::CachePMT(const ProgramMapTable *_pmt) { - ProgramMapTable *pmt = new ProgramMapTable(*_pmt); + auto *pmt = new ProgramMapTable(*_pmt); uint key = (_pmt->ProgramNumber() << 8) | _pmt->Section(); QMutexLocker locker(&_cache_lock); @@ -1604,7 +1604,7 @@ void MPEGStreamData::AddMPEGListener(MPEGStreamListener *val) { QMutexLocker locker(&_listener_lock); - mpeg_listener_vec_t::iterator it = _mpeg_listeners.begin(); + auto it = _mpeg_listeners.begin(); for (; it != _mpeg_listeners.end(); ++it) if (((void*)val) == ((void*)*it)) return; @@ -1616,7 +1616,7 @@ void MPEGStreamData::RemoveMPEGListener(MPEGStreamListener *val) { QMutexLocker locker(&_listener_lock); - mpeg_listener_vec_t::iterator it = _mpeg_listeners.begin(); + auto it = _mpeg_listeners.begin(); for (; it != _mpeg_listeners.end(); ++it) { if (((void*)val) == ((void*)*it)) @@ -1631,7 +1631,7 @@ void MPEGStreamData::AddWritingListener(TSPacketListener *val) { QMutexLocker locker(&_listener_lock); - ts_listener_vec_t::iterator it = _ts_writing_listeners.begin(); + auto it = _ts_writing_listeners.begin(); for (; it != _ts_writing_listeners.end(); ++it) if (((void*)val) == ((void*)*it)) return; @@ -1643,7 +1643,7 @@ void MPEGStreamData::RemoveWritingListener(TSPacketListener *val) { QMutexLocker locker(&_listener_lock); - ts_listener_vec_t::iterator it = _ts_writing_listeners.begin(); + auto it = _ts_writing_listeners.begin(); for (; it != _ts_writing_listeners.end(); ++it) { if (((void*)val) == ((void*)*it)) @@ -1658,7 +1658,7 @@ void MPEGStreamData::AddAVListener(TSPacketListenerAV *val) { QMutexLocker locker(&_listener_lock); - ts_av_listener_vec_t::iterator it = _ts_av_listeners.begin(); + auto it = _ts_av_listeners.begin(); for (; it != _ts_av_listeners.end(); ++it) if (((void*)val) == ((void*)*it)) return; @@ -1670,7 +1670,7 @@ void MPEGStreamData::RemoveAVListener(TSPacketListenerAV *val) { QMutexLocker locker(&_listener_lock); - ts_av_listener_vec_t::iterator it = _ts_av_listeners.begin(); + auto it = _ts_av_listeners.begin(); for (; it != _ts_av_listeners.end(); ++it) { if (((void*)val) == ((void*)*it)) @@ -1685,7 +1685,7 @@ void MPEGStreamData::AddMPEGSPListener(MPEGSingleProgramStreamListener *val) { QMutexLocker locker(&_listener_lock); - mpeg_sp_listener_vec_t::iterator it = _mpeg_sp_listeners.begin(); + auto it = _mpeg_sp_listeners.begin(); for (; it != _mpeg_sp_listeners.end(); ++it) if (((void*)val) == ((void*)*it)) return; @@ -1697,7 +1697,7 @@ void MPEGStreamData::RemoveMPEGSPListener(MPEGSingleProgramStreamListener *val) { QMutexLocker locker(&_listener_lock); - mpeg_sp_listener_vec_t::iterator it = _mpeg_sp_listeners.begin(); + auto it = _mpeg_sp_listeners.begin(); for (; it != _mpeg_sp_listeners.end(); ++it) { if (((void*)val) == ((void*)*it)) @@ -1712,7 +1712,7 @@ void MPEGStreamData::AddPSStreamListener(PSStreamListener *val) { QMutexLocker locker(&_listener_lock); - ps_listener_vec_t::iterator it = _ps_listeners.begin(); + auto it = _ps_listeners.begin(); for (; it != _ps_listeners.end(); ++it) if (((void*)val) == ((void*)*it)) return; @@ -1724,7 +1724,7 @@ void MPEGStreamData::RemovePSStreamListener(PSStreamListener *val) { QMutexLocker locker(&_listener_lock); - ps_listener_vec_t::iterator it = _ps_listeners.begin(); + auto it = _ps_listeners.begin(); for (; it != _ps_listeners.end(); ++it) { if (((void*)val) == ((void*)*it)) diff --git a/mythtv/libs/libmythtv/mpeg/mpegstreamdata.h b/mythtv/libs/libmythtv/mpeg/mpegstreamdata.h index 4ae5ae213ec..60140cb153c 100644 --- a/mythtv/libs/libmythtv/mpeg/mpegstreamdata.h +++ b/mythtv/libs/libmythtv/mpeg/mpegstreamdata.h @@ -53,12 +53,12 @@ typedef vector<TSPacketListenerAV*> ts_av_listener_vec_t; typedef vector<MPEGSingleProgramStreamListener*> mpeg_sp_listener_vec_t; typedef vector<PSStreamListener*> ps_listener_vec_t; -typedef enum +enum CryptStatus { kEncUnknown = 0, kEncDecrypted = 1, kEncEncrypted = 2, -} CryptStatus; +}; class MTV_PUBLIC CryptInfo { @@ -78,13 +78,13 @@ class MTV_PUBLIC CryptInfo uint decrypted_min; }; -typedef enum +enum PIDPriority { kPIDPriorityNone = 0, kPIDPriorityLow = 1, kPIDPriorityNormal = 2, kPIDPriorityHigh = 3, -} PIDPriority; +}; typedef QMap<uint, PIDPriority> pid_map_t; class MTV_PUBLIC MPEGStreamData : public EITSource @@ -305,7 +305,7 @@ class MTV_PUBLIC MPEGStreamData : public EITSource // Caching void IncrementRefCnt(const PSIPTable *psip) const; - virtual bool DeleteCachedTable(PSIPTable *psip) const; + virtual bool DeleteCachedTable(const PSIPTable *psip) const; void CachePAT(const ProgramAssociationTable *pat); void CacheCAT(const ConditionalAccessTable *_cat); void CachePMT(const ProgramMapTable *pmt); @@ -387,15 +387,13 @@ class MTV_PUBLIC MPEGStreamData : public EITSource inline void MPEGStreamData::SetPATSingleProgram(ProgramAssociationTable* pat) { - if (_pat_single_program) - delete _pat_single_program; + delete _pat_single_program; _pat_single_program = pat; } inline void MPEGStreamData::SetPMTSingleProgram(ProgramMapTable* pmt) { - if (_pmt_single_program) - delete _pmt_single_program; + delete _pmt_single_program; _pmt_single_program = pmt; } diff --git a/mythtv/libs/libmythtv/mpeg/mpegtables.cpp b/mythtv/libs/libmythtv/mpeg/mpegtables.cpp index fe8db206b9d..0eefc6237bb 100644 --- a/mythtv/libs/libmythtv/mpeg/mpegtables.cpp +++ b/mythtv/libs/libmythtv/mpeg/mpegtables.cpp @@ -337,7 +337,7 @@ ProgramAssociationTable* ProgramAssociationTable::CreateBlank(bool smallPacket) psip.SetLength(TSPacket::kPayloadSize - 1 /* for start of field pointer */ - 3 /* for data before data last byte of pes length */); - ProgramAssociationTable *pat = new ProgramAssociationTable(psip); + auto *pat = new ProgramAssociationTable(psip); pat->SetTotalLength(sizeof(DEFAULT_PAT_HEADER)); delete tspacket; return pat; @@ -470,7 +470,7 @@ void ProgramMapTable::Parse() const { _ptrs.clear(); const unsigned char *cpos = psipdata() + pmt_header + ProgramInfoLength(); - unsigned char *pos = const_cast<unsigned char*>(cpos); + auto *pos = const_cast<unsigned char*>(cpos); for (uint i = 0; pos < psipdata() + Length() - 9; i++) { _ptrs.push_back(pos); @@ -617,14 +617,14 @@ bool ProgramMapTable::IsStreamEncrypted(uint pid) const bool ProgramMapTable::IsStillPicture(const QString& sistandard) const { - static const unsigned char STILL_PICTURE_FLAG = 0x01; + static constexpr unsigned char kStillPictureFlag = 0x01; for (uint i = 0; i < StreamCount(); i++) { if (IsVideo(i, sistandard)) { return StreamInfoLength(i) > 2 && - ((StreamInfo(i)[2] & STILL_PICTURE_FLAG) != 0); + ((StreamInfo(i)[2] & kStillPictureFlag) != 0); } } return false; @@ -1266,7 +1266,7 @@ QString SpliceTimeView::toStringXML( /// \brief Returns decrypted version of this packet. SpliceInformationTable *SpliceInformationTable::GetDecrypted( - const QString &/*codeWord*/) const + const QString &/*codeWord*/) { // TODO return nullptr; diff --git a/mythtv/libs/libmythtv/mpeg/mpegtables.h b/mythtv/libs/libmythtv/mpeg/mpegtables.h index b9b2360753b..847f7fef5fe 100644 --- a/mythtv/libs/libmythtv/mpeg/mpegtables.h +++ b/mythtv/libs/libmythtv/mpeg/mpegtables.h @@ -1149,7 +1149,7 @@ class MTV_PUBLIC SpliceInformationTable : public PSIPTable // E_CRC_32 32 ??.0 // CRC_32 32 ??.0 - SpliceInformationTable *GetDecrypted(const QString &codeWord) const; + static SpliceInformationTable *GetDecrypted(const QString &codeWord); bool Parse(void); QString toString(void) const override // PSIPTable diff --git a/mythtv/libs/libmythtv/mpeg/premieredescriptors.cpp b/mythtv/libs/libmythtv/mpeg/premieredescriptors.cpp index 2287faf8278..1a17425974c 100644 --- a/mythtv/libs/libmythtv/mpeg/premieredescriptors.cpp +++ b/mythtv/libs/libmythtv/mpeg/premieredescriptors.cpp @@ -51,8 +51,8 @@ QDateTime PremiereContentTransmissionDescriptor::StartTimeUTC(uint index) const // "Specification for Service Information in Digital Video Broadcasting" // to convert from Modified Julian Date to Year, Month, Day. - const float tmpA = (float)(1.0 / 365.25); - const float tmpB = (float)(1.0 / 30.6001); + const auto tmpA = (float)(1.0 / 365.25); + const auto tmpB = (float)(1.0 / 30.6001); float mjdf = mjd; int year = (int) truncf((mjdf - 15078.2F) * tmpA); diff --git a/mythtv/libs/libmythtv/mpeg/scanstreamdata.cpp b/mythtv/libs/libmythtv/mpeg/scanstreamdata.cpp index e5f07d21c42..864eae626bf 100644 --- a/mythtv/libs/libmythtv/mpeg/scanstreamdata.cpp +++ b/mythtv/libs/libmythtv/mpeg/scanstreamdata.cpp @@ -94,7 +94,7 @@ QString ScanStreamData::GetSIStandard(const QString& guess) const } -bool ScanStreamData::DeleteCachedTable(PSIPTable *psip) const +bool ScanStreamData::DeleteCachedTable(const PSIPTable *psip) const { if (!psip) return false; diff --git a/mythtv/libs/libmythtv/mpeg/scanstreamdata.h b/mythtv/libs/libmythtv/mpeg/scanstreamdata.h index c822b641fa8..ee34531c4a3 100644 --- a/mythtv/libs/libmythtv/mpeg/scanstreamdata.h +++ b/mythtv/libs/libmythtv/mpeg/scanstreamdata.h @@ -34,7 +34,7 @@ class MTV_PUBLIC ScanStreamData : void SetFreesatAdditionalSI(bool freesat_si); private: - bool DeleteCachedTable(PSIPTable *psip) const override; // ATSCStreamData + bool DeleteCachedTable(const PSIPTable *psip) const override; // ATSCStreamData /// listen for additional Freesat service information bool m_dvb_uk_freesat_si {false}; bool m_no_default_pid; diff --git a/mythtv/libs/libmythtv/mpeg/sctetables.cpp b/mythtv/libs/libmythtv/mpeg/sctetables.cpp index fb6f9db1a98..155655112e3 100644 --- a/mythtv/libs/libmythtv/mpeg/sctetables.cpp +++ b/mythtv/libs/libmythtv/mpeg/sctetables.cpp @@ -126,7 +126,7 @@ QString ModulationModeSubtable::ModulationFormatString(void) const } } -QString ModulationModeSubtable::toString(void) const +QString ModulationModeSubtable::toString(void) { return "ModulationMode"; } diff --git a/mythtv/libs/libmythtv/mpeg/sctetables.h b/mythtv/libs/libmythtv/mpeg/sctetables.h index 1abf6045191..869ee2645fc 100644 --- a/mythtv/libs/libmythtv/mpeg/sctetables.h +++ b/mythtv/libs/libmythtv/mpeg/sctetables.h @@ -179,7 +179,7 @@ class ModulationModeSubtable uint DescriptorsLength(void) const { return _end - _beg - 7; } const unsigned char *Descriptors(void) const { return _beg + 7; } - QString toString(void) const; + static QString toString(void); QString toStringXML(uint indent_level) const; private: diff --git a/mythtv/libs/libmythtv/mpeg/splicedescriptors.cpp b/mythtv/libs/libmythtv/mpeg/splicedescriptors.cpp index 0c116567e40..00cda576f1b 100644 --- a/mythtv/libs/libmythtv/mpeg/splicedescriptors.cpp +++ b/mythtv/libs/libmythtv/mpeg/splicedescriptors.cpp @@ -88,8 +88,8 @@ desc_list_t SpliceDescriptor::ParseOnlyInclude( const unsigned char *SpliceDescriptor::Find( const desc_list_t &parsed, uint desc_tag) { - desc_list_t::const_iterator it = parsed.begin(); - for (; it != parsed.end(); ++it) + auto it = parsed.cbegin(); + for (; it != parsed.cend(); ++it) { if ((*it)[0] == desc_tag) return *it; @@ -100,8 +100,8 @@ const unsigned char *SpliceDescriptor::Find( desc_list_t SpliceDescriptor::FindAll(const desc_list_t &parsed, uint desc_tag) { desc_list_t tmp; - desc_list_t::const_iterator it = parsed.begin(); - for (; it != parsed.end(); ++it) + auto it = parsed.cbegin(); + for (; it != parsed.cend(); ++it) { if ((*it)[0] == desc_tag) tmp.push_back(*it); diff --git a/mythtv/libs/libmythtv/mythavutil.cpp b/mythtv/libs/libmythtv/mythavutil.cpp index 97a4ebf04af..9248f824db0 100644 --- a/mythtv/libs/libmythtv/mythavutil.cpp +++ b/mythtv/libs/libmythtv/mythavutil.cpp @@ -47,7 +47,7 @@ AVPixelFormat FrameTypeToPixelFormat(VideoFrameType type) case FMT_YUV444P14: return AV_PIX_FMT_YUV444P14; case FMT_YUV444P16: return AV_PIX_FMT_YUV444P16; case FMT_RGB24: return AV_PIX_FMT_RGB24; - case FMT_BGRA: return AV_PIX_FMT_BGRA; + case FMT_BGRA: return AV_PIX_FMT_BGRA; // NOLINT(bugprone-branch-clone) case FMT_RGB32: return AV_PIX_FMT_RGB32; case FMT_ARGB32: return AV_PIX_FMT_ARGB; case FMT_RGBA32: return AV_PIX_FMT_RGBA; @@ -213,18 +213,18 @@ class MythAVCopyPrivate { public: explicit MythAVCopyPrivate(bool uswc) - : swsctx(nullptr), copyctx(new MythUSWCCopy(4096, !uswc)), - width(0), height(0), size(0), format(AV_PIX_FMT_NONE) + : m_swsctx(nullptr), m_copyctx(new MythUSWCCopy(4096, !uswc)), + m_width(0), m_height(0), m_size(0), m_format(AV_PIX_FMT_NONE) { } ~MythAVCopyPrivate() { - if (swsctx) + if (m_swsctx) { - sws_freeContext(swsctx); + sws_freeContext(m_swsctx); } - delete copyctx; + delete m_copyctx; } MythAVCopyPrivate(const MythAVCopyPrivate &) = delete; // not copyable @@ -232,21 +232,23 @@ class MythAVCopyPrivate int SizeData(int _width, int _height, AVPixelFormat _fmt) { - if (_width == width && _height == height && _fmt == format) + if (_width == m_width && _height == m_height && _fmt == m_format) { - return size; + return m_size; } - size = av_image_get_buffer_size(_fmt, _width, _height, IMAGE_ALIGN); - width = _width; - height = _height; - format = _fmt; - return size; + m_size = av_image_get_buffer_size(_fmt, _width, _height, IMAGE_ALIGN); + m_width = _width; + m_height = _height; + m_format = _fmt; + return m_size; } - SwsContext *swsctx; - MythUSWCCopy *copyctx; - int width, height, size; - AVPixelFormat format; + SwsContext *m_swsctx; + MythUSWCCopy *m_copyctx; + int m_width; + int m_height; + int m_size; + AVPixelFormat m_format; }; MythAVCopy::MythAVCopy(bool uswc) : d(new MythAVCopyPrivate(uswc)) @@ -296,7 +298,7 @@ int MythAVCopy::Copy(AVFrame *dst, AVPixelFormat dst_pix_fmt, FillFrame(&framein, src, width, width, height, pix_fmt); FillFrame(&frameout, dst, width, width, height, dst_pix_fmt); - d->copyctx->copy(&frameout, &framein); + d->m_copyctx->copy(&frameout, &framein); return frameout.size; } @@ -312,15 +314,15 @@ int MythAVCopy::Copy(AVFrame *dst, AVPixelFormat dst_pix_fmt, && dst_pix_fmt == AV_PIX_FMT_BGRA) new_width = width - 1; #endif - d->swsctx = sws_getCachedContext(d->swsctx, width, height, pix_fmt, + d->m_swsctx = sws_getCachedContext(d->m_swsctx, width, height, pix_fmt, new_width, height, dst_pix_fmt, SWS_FAST_BILINEAR, nullptr, nullptr, nullptr); - if (d->swsctx == nullptr) + if (d->m_swsctx == nullptr) { return -1; } - sws_scale(d->swsctx, src->data, src->linesize, + sws_scale(d->m_swsctx, src->data, src->linesize, 0, height, dst->data, dst->linesize); return d->SizeData(width, height, dst_pix_fmt); @@ -331,7 +333,7 @@ int MythAVCopy::Copy(VideoFrame *dst, const VideoFrame *src) if ((src->codec == FMT_YV12 || src->codec == FMT_NV12) && (dst->codec == FMT_YV12)) { - d->copyctx->copy(dst, src); + d->m_copyctx->copy(dst, src); return dst->size; } diff --git a/mythtv/libs/libmythtv/mythavutil.h b/mythtv/libs/libmythtv/mythavutil.h index d6931cd0296..6ff5da2dea6 100644 --- a/mythtv/libs/libmythtv/mythavutil.h +++ b/mythtv/libs/libmythtv/mythavutil.h @@ -141,8 +141,8 @@ class MTV_PUBLIC MythAVCopy int width, int height); private: - void FillFrame(VideoFrame *frame, const AVFrame *pic, int pitch, - int width, int height, AVPixelFormat pix_fmt); + static void FillFrame(VideoFrame *frame, const AVFrame *pic, int pitch, + int width, int height, AVPixelFormat pix_fmt); MythAVCopy(const MythAVCopy &) = delete; // not copyable MythAVCopy &operator=(const MythAVCopy &) = delete; // not copyable MythAVCopyPrivate *d; diff --git a/mythtv/libs/libmythtv/mythccextractorplayer.cpp b/mythtv/libs/libmythtv/mythccextractorplayer.cpp index 2885f26bac2..06ac5819b1d 100644 --- a/mythtv/libs/libmythtv/mythccextractorplayer.cpp +++ b/mythtv/libs/libmythtv/mythccextractorplayer.cpp @@ -21,6 +21,8 @@ */ #include <iostream> +#include <utility> + using namespace std; #include <QFileInfo> @@ -50,13 +52,13 @@ TeletextStuff::~TeletextStuff() { delete reader; } DVBSubStuff::~DVBSubStuff() { delete reader; } MythCCExtractorPlayer::MythCCExtractorPlayer(PlayerFlags flags, bool showProgress, - const QString &fileName, + QString fileName, const QString &destdir) : MythPlayer(flags), m_curTime(0), m_myFramesPlayed(0), m_showProgress(showProgress), - m_fileName(fileName) + m_fileName(std::move(fileName)) { // Determine where we will put extracted info. QStringList comps = QFileInfo(m_fileName).fileName().split("."); @@ -106,8 +108,8 @@ static QString progress_string( .arg(m_myFramesPlayed,7); } - static char const spin_chars[] = "/-\\|"; - static uint spin_cnt = 0; + static constexpr char kSpinChars[] = "/-\\|"; + static uint s_spinCnt = 0; double elapsed = flagTime.elapsed() * 0.001; double flagFPS = (elapsed > 0.0) ? (m_myFramesPlayed / elapsed) : 0; @@ -121,7 +123,7 @@ static QString progress_string( .arg(flagFPS,4,'f', (flagFPS < 10.0 ? 1 : 0)).arg(percentage,4,'f',1); return QString("%1 fps %2 \r") .arg(flagFPS,4,'f', (flagFPS < 10.0 ? 1 : 0)) - .arg(spin_chars[++spin_cnt % 4]); + .arg(kSpinChars[++s_spinCnt % 4]); } bool MythCCExtractorPlayer::run(void) @@ -294,7 +296,7 @@ void MythCCExtractorPlayer::IngestSubtitle( void MythCCExtractorPlayer::Ingest608Captions(void) { - static const int ccIndexTbl[7] = + static constexpr int kCcIndexTbl[7] = { 0, // CC_CC1 1, // CC_CC2 @@ -322,20 +324,20 @@ void MythCCExtractorPlayer::Ingest608Captions(void) if (streamRawIdx < 0) continue; - textlist->lock.lock(); + textlist->m_lock.lock(); - const int ccIdx = ccIndexTbl[min(streamRawIdx,6)]; + const int ccIdx = kCcIndexTbl[min(streamRawIdx,6)]; if (ccIdx >= 4) { - textlist->lock.unlock(); + textlist->m_lock.unlock(); continue; } - FormattedTextSubtitle608 fsub(textlist->buffers); + FormattedTextSubtitle608 fsub(textlist->m_buffers); QStringList content = fsub.ToSRT(); - textlist->lock.unlock(); + textlist->m_lock.unlock(); IngestSubtitle((*it).subs[ccIdx], content); } @@ -366,7 +368,7 @@ void MythCCExtractorPlayer::Process608Captions(uint flags) if (!(*cc608it).srtwriters[idx]) { int langCode = 0; - AvFormatDecoder *avd = dynamic_cast<AvFormatDecoder *>(decoder); + auto *avd = dynamic_cast<AvFormatDecoder *>(decoder); if (avd) langCode = avd->GetCaptionLanguage( kTrackTypeCC608, idx + 1); @@ -425,7 +427,7 @@ void MythCCExtractorPlayer::Ingest708Captions(void) Ingest708Caption(it.key(), serviceIdx, windowIdx, win.m_pen.m_row, win.m_pen.m_column, win, strings); - win.DisposeStrings(strings); + CC708Window::DisposeStrings(strings); } service->m_windows[windowIdx].ResetChanged(); } @@ -493,7 +495,7 @@ void MythCCExtractorPlayer::Process708Captions(uint flags) if (!(*cc708it).srtwriters[idx]) { int langCode = 0; - AvFormatDecoder *avd = dynamic_cast<AvFormatDecoder*>(decoder); + auto *avd = dynamic_cast<AvFormatDecoder*>(decoder); if (avd) langCode = avd->GetCaptionLanguage(kTrackTypeCC708, idx); @@ -550,7 +552,7 @@ void MythCCExtractorPlayer::IngestTeletext(void) TeletextInfo::iterator ttxit = m_ttx_info.begin(); for (; ttxit != m_ttx_info.end(); ++ttxit) { - typedef QPair<int, int> qpii; + using qpii = QPair<int, int>; QSet<qpii> updatedPages = (*ttxit).reader->GetUpdatedPages(); if (updatedPages.isEmpty()) continue; @@ -594,7 +596,7 @@ void MythCCExtractorPlayer::ProcessTeletext(uint flags) if (!(*ttxit).srtwriters[page]) { int langCode = 0; - AvFormatDecoder *avd = dynamic_cast<AvFormatDecoder *>(decoder); + auto *avd = dynamic_cast<AvFormatDecoder *>(decoder); if (avd) langCode = avd->GetTeletextLanguage(page); @@ -661,7 +663,7 @@ void MythCCExtractorPlayer::IngestDVBSubtitles(void) while (!avsubtitles->m_buffers.empty()) { - const AVSubtitle subtitle = avsubtitles->m_buffers.front(); + AVSubtitle subtitle = avsubtitles->m_buffers.front(); avsubtitles->m_buffers.pop_front(); const QSize v_size = @@ -709,7 +711,7 @@ void MythCCExtractorPlayer::IngestDVBSubtitles(void) sub.length = subtitle.end_display_time - subtitle.start_display_time; - (*subit).reader->FreeAVSubtitle(subtitle); + SubtitleReader::FreeAVSubtitle(subtitle); if (min_x < max_x && min_y < max_y) { @@ -739,7 +741,7 @@ void MythCCExtractorPlayer::ProcessDVBSubtitles(uint flags) for (; subit != m_dvbsub_info.end(); ++subit) { int langCode = 0; - AvFormatDecoder *avd = dynamic_cast<AvFormatDecoder *>(decoder); + auto *avd = dynamic_cast<AvFormatDecoder *>(decoder); int idx = subit.key(); if (avd) langCode = avd->GetSubtitleLanguage(subtitleStreamCount, idx); diff --git a/mythtv/libs/libmythtv/mythccextractorplayer.h b/mythtv/libs/libmythtv/mythccextractorplayer.h index 6724b0413bd..d119cac2b3d 100644 --- a/mythtv/libs/libmythtv/mythccextractorplayer.h +++ b/mythtv/libs/libmythtv/mythccextractorplayer.h @@ -54,13 +54,13 @@ class MTV_PUBLIC OneSubtitle }; /// Key is a CC number (1-4), values are the subtitles in chrono order. -typedef QHash<int, QList<OneSubtitle> > CC608StreamType; +using CC608StreamType = QHash<int, QList<OneSubtitle> >; /// Key is a CC service (1-63), values are the subtitles in chrono order. -typedef QHash<int, QList<OneSubtitle> > CC708StreamType; +using CC708StreamType = QHash<int, QList<OneSubtitle> >; /// Key is a page number, values are the subtitles in chrono order. -typedef QHash<int, QList<OneSubtitle> > TeletextStreamType; +using TeletextStreamType = QHash<int, QList<OneSubtitle> >; /// Subtitles in chrono order. -typedef QList<OneSubtitle> DVBStreamType; +using DVBStreamType = QList<OneSubtitle>; class SRTStuff { @@ -79,7 +79,7 @@ class CC608Stuff : public SRTStuff CC608Reader *reader; CC608StreamType subs; }; -typedef QHash<uint, CC608Stuff> CC608Info; +using CC608Info = QHash<uint, CC608Stuff>; class CC708Stuff : public SRTStuff { @@ -89,7 +89,7 @@ class CC708Stuff : public SRTStuff CC708Reader *reader; CC708StreamType subs; }; -typedef QHash<uint, CC708Stuff> CC708Info; +using CC708Info = QHash<uint, CC708Stuff>; class TeletextExtractorReader; class TeletextStuff : public SRTStuff @@ -100,7 +100,7 @@ class TeletextStuff : public SRTStuff TeletextExtractorReader *reader; TeletextStreamType subs; }; -typedef QHash<uint, TeletextStuff> TeletextInfo; +using TeletextInfo = QHash<uint, TeletextStuff>; class DVBSubStuff { @@ -111,15 +111,15 @@ class DVBSubStuff int subs_num; DVBStreamType subs; }; -typedef QHash<uint, DVBSubStuff> DVBSubInfo; +using DVBSubInfo = QHash<uint, DVBSubStuff>; -typedef QHash<uint, SubtitleReader*> SubtitleReaders; +using SubtitleReaders = QHash<uint, SubtitleReader*>; class MTV_PUBLIC MythCCExtractorPlayer : public MythPlayer { public: MythCCExtractorPlayer(PlayerFlags flags, bool showProgress, - const QString &fileName, const QString & destdir); + QString fileName, const QString & destdir); MythCCExtractorPlayer(const MythCCExtractorPlayer& rhs); ~MythCCExtractorPlayer() = default; @@ -132,7 +132,7 @@ class MTV_PUBLIC MythCCExtractorPlayer : public MythPlayer private: void IngestSubtitle(QList<OneSubtitle>&, const QStringList&); - void IngestSubtitle(QList<OneSubtitle>&, const OneSubtitle&); + static void IngestSubtitle(QList<OneSubtitle>&, const OneSubtitle&); enum { kProcessNormal = 0, kProcessFinalize = 1 }; void Ingest608Captions(void); @@ -168,7 +168,7 @@ class MTV_PUBLIC MythCCExtractorPlayer : public MythPlayer uint column; QStringList text; }; - typedef QHash<uint, QMap<int, Window> > WindowsOnService; + using WindowsOnService = QHash<uint, QMap<int, Window> >; QHash<uint, WindowsOnService > m_cc708_windows; /// Keeps track for decoding time to make timestamps for subtitles. diff --git a/mythtv/libs/libmythtv/mythcodecid.cpp b/mythtv/libs/libmythtv/mythcodecid.cpp index 18001c1174e..463e875e855 100644 --- a/mythtv/libs/libmythtv/mythcodecid.cpp +++ b/mythtv/libs/libmythtv/mythcodecid.cpp @@ -660,35 +660,35 @@ QString get_decoder_name(MythCodecID codec_id) { if (codec_is_vdpau(codec_id)) return "vdpau"; - else if (codec_is_vdpau_dec(codec_id)) + if (codec_is_vdpau_dec(codec_id)) return "vdpau-dec"; - else if (codec_is_vaapi(codec_id)) + if (codec_is_vaapi(codec_id)) return "vaapi"; - else if (codec_is_vaapi_dec(codec_id)) + if (codec_is_vaapi_dec(codec_id)) return "vaapi-dec"; - else if (codec_is_dxva2(codec_id)) + if (codec_is_dxva2(codec_id)) return "dxva2"; - else if (codec_is_mediacodec(codec_id)) + if (codec_is_mediacodec(codec_id)) return "mediacodec"; - else if (codec_is_mediacodec_dec(codec_id)) + if (codec_is_mediacodec_dec(codec_id)) return "mediacodec-dec"; - else if (codec_is_nvdec(codec_id)) + if (codec_is_nvdec(codec_id)) return "nvdec"; - else if (codec_is_nvdec_dec(codec_id)) + if (codec_is_nvdec_dec(codec_id)) return "nvdec-dec"; - else if (codec_is_vtb(codec_id)) + if (codec_is_vtb(codec_id)) return "vtb"; - else if (codec_is_vtb_dec(codec_id)) + if (codec_is_vtb_dec(codec_id)) return "vtb-dec"; - else if (codec_is_v4l2(codec_id)) + if (codec_is_v4l2(codec_id)) return "v4l2"; - else if (codec_is_v4l2_dec(codec_id)) + if (codec_is_v4l2_dec(codec_id)) return "v4l2-dec"; - else if (codec_is_mmal(codec_id)) + if (codec_is_mmal(codec_id)) return "mmal"; - else if (codec_is_mmal_dec(codec_id)) + if (codec_is_mmal_dec(codec_id)) return "mmal-dec"; - else if (codec_is_drmprime(codec_id)) + if (codec_is_drmprime(codec_id)) return "drmprime"; return "ffmpeg"; } diff --git a/mythtv/libs/libmythtv/mythcodecid.h b/mythtv/libs/libmythtv/mythcodecid.h index 591ffd28564..3fa5e715606 100644 --- a/mythtv/libs/libmythtv/mythcodecid.h +++ b/mythtv/libs/libmythtv/mythcodecid.h @@ -7,7 +7,7 @@ extern "C" #include "libavcodec/avcodec.h" } -typedef enum +enum MythCodecID { // if you add anything to this list please update // myth2av_codecid and get_encoding_type @@ -270,7 +270,7 @@ typedef enum kCodec_HEVC_DRMPRIME, kCodec_DRMPRIME_END -} MythCodecID; +}; // MythCodecID convenience functions #define codec_is_std(id) (id < kCodec_NORMAL_END) diff --git a/mythtv/libs/libmythtv/mythdeinterlacer.cpp b/mythtv/libs/libmythtv/mythdeinterlacer.cpp index 44fc9bbb6d6..be02c759d34 100644 --- a/mythtv/libs/libmythtv/mythdeinterlacer.cpp +++ b/mythtv/libs/libmythtv/mythdeinterlacer.cpp @@ -138,7 +138,7 @@ void MythDeinterlacer::Filter(VideoFrame *Frame, FrameScanType Scan) // copy Frame metadata, preserving any existing buffer allocation unsigned char *buf = m_bobFrame->buf; int size = m_bobFrame->size; - memcpy(m_bobFrame, Frame, sizeof(VideoFrame_)); + memcpy(m_bobFrame, Frame, sizeof(VideoFrame)); m_bobFrame->priv[0] = m_bobFrame->priv[1] = m_bobFrame->priv[2] = m_bobFrame->priv[3] = nullptr; m_bobFrame->buf = buf; m_bobFrame->size = size; diff --git a/mythtv/libs/libmythtv/mythframe.h b/mythtv/libs/libmythtv/mythframe.h index 2bcb1e01f1d..31a4cb38b34 100644 --- a/mythtv/libs/libmythtv/mythframe.h +++ b/mythtv/libs/libmythtv/mythframe.h @@ -20,7 +20,7 @@ extern "C" { #define MYTH_WIDTH_ALIGNMENT 64 #define MYTH_HEIGHT_ALIGNMENT 16 -typedef enum FrameType_ +enum VideoFrameType { FMT_NONE = -1, // YV12 and variants @@ -65,7 +65,7 @@ typedef enum FrameType_ FMT_VTB, FMT_NVDEC, FMT_DRMPRIME -} VideoFrameType; +}; const char* format_description(VideoFrameType Type); @@ -117,7 +117,7 @@ static inline int format_is_yuv(VideoFrameType Type) format_is_nv12(Type) || format_is_packed(Type); } -typedef enum MythDeintType +enum MythDeintType { DEINT_NONE = 0x0000, DEINT_BASIC = 0x0001, @@ -127,13 +127,13 @@ typedef enum MythDeintType DEINT_SHADER = 0x0020, DEINT_DRIVER = 0x0040, DEINT_ALL = 0x0077 -} MythDeintType; +}; inline MythDeintType operator| (MythDeintType a, MythDeintType b) { return static_cast<MythDeintType>(static_cast<int>(a) | static_cast<int>(b)); } inline MythDeintType operator& (MythDeintType a, MythDeintType b) { return static_cast<MythDeintType>(static_cast<int>(a) & static_cast<int>(b)); } inline MythDeintType operator~ (MythDeintType a) { return static_cast<MythDeintType>(~(static_cast<int>(a))); } -typedef struct VideoFrame_ +struct VideoFrame { VideoFrameType codec; unsigned char *buf; @@ -174,7 +174,7 @@ typedef struct VideoFrame_ MythDeintType deinterlace_allowed; MythDeintType deinterlace_inuse; int deinterlace_inuse2x; -} VideoFrame; +}; #ifdef __cplusplus } diff --git a/mythtv/libs/libmythtv/mythiowrapper.h b/mythtv/libs/libmythtv/mythiowrapper.h index c38911ce004..b8fcffd6c0c 100644 --- a/mythtv/libs/libmythtv/mythiowrapper.h +++ b/mythtv/libs/libmythtv/mythiowrapper.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef void (*callback_t)(void*); +typedef void (*callback_t)(void*); //NOLINT(modernize-use-using)included from C code void mythfile_open_register_callback(const char *pathname, void* object, callback_t func); diff --git a/mythtv/libs/libmythtv/mythplayer.cpp b/mythtv/libs/libmythtv/mythplayer.cpp index e0dc4766088..64a762bb366 100644 --- a/mythtv/libs/libmythtv/mythplayer.cpp +++ b/mythtv/libs/libmythtv/mythplayer.cpp @@ -652,7 +652,7 @@ void MythPlayer::SetVideoParams(int width, int height, double fps, { paramsChanged = true; video_dim = video_disp_dim = QSize(width, height); - video_aspect = aspect > 0.0f ? aspect : static_cast<float>(width) / height; + video_aspect = aspect > 0.0F ? aspect : static_cast<float>(width) / height; } if (!qIsNaN(fps) && fps > 0.0 && fps < 121.0) @@ -729,11 +729,11 @@ void MythPlayer::OpenDummy(void) if (!videoOutput) { SetKeyframeDistance(15); - SetVideoParams(720, 576, 25.00, 1.25f, false, 2); + SetVideoParams(720, 576, 25.00, 1.25F, false, 2); } player_ctx->LockPlayingInfo(__FILE__, __LINE__); - DummyDecoder *dec = new DummyDecoder(this, *(player_ctx->m_playingInfo)); + auto *dec = new DummyDecoder(this, *(player_ctx->m_playingInfo)); player_ctx->UnlockPlayingInfo(__FILE__, __LINE__); SetDecoder(dec); } @@ -911,10 +911,10 @@ int MythPlayer::GetFreeVideoFrames(void) const /// \brief Return a list of frame types that can be rendered directly. VideoFrameType* MythPlayer::DirectRenderFormats(void) { - static VideoFrameType defaultformats[] = { FMT_YV12, FMT_NONE }; + static VideoFrameType s_defaultFormats[] = { FMT_YV12, FMT_NONE }; if (videoOutput) return videoOutput->DirectRenderFormats(); - return &defaultformats[0]; + return &s_defaultFormats[0]; } /** @@ -1934,7 +1934,7 @@ void MythPlayer::AVSync2(VideoFrame *buffer) int64_t audio_adjustment = 0; int64_t unow = 0; int64_t lateness = 0; - int64_t playspeed1000 = static_cast<int64_t>(1000.0f / play_speed); + auto playspeed1000 = static_cast<int64_t>(1000.0F / play_speed); bool reset = false; while (framedue == 0) @@ -2017,7 +2017,7 @@ void MythPlayer::AVSync2(VideoFrame *buffer) if (audio_adjustment * sign > 200) // fix the sync within 15 - 20 frames fix_amount = audio_adjustment * sign / 15; - int64_t speedup1000 = static_cast<int64_t>(1000 * play_speed); + auto speedup1000 = static_cast<int64_t>(1000 * play_speed); rtcbase -= static_cast<int64_t>(1000000 * fix_amount * sign / speedup1000); if (audio_adjustment * sign > 20 || (framesPlayed % 400 == 0)) LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("AV Sync: Audio %1 by %2 ms") @@ -2160,7 +2160,7 @@ void MythPlayer::RefreshPauseFrame(void) { osdLock.lock(); if (osd) - deleteMap.UpdateOSD(GetLatestVideoTimecode(), osd); + DeleteMap::UpdateOSD(GetLatestVideoTimecode(), osd); osdLock.unlock(); } } @@ -2238,7 +2238,7 @@ bool MythPlayer::PrebufferEnoughFrames(int min_buffers) { uint64_t frameCount = GetCurrentFrameCount(); uint64_t framesLeft = frameCount - framesPlayed; - uint64_t margin = (uint64_t) (video_frame_rate * 3); + auto margin = (uint64_t) (video_frame_rate * 3); if (framesLeft < margin) { if (rtcbase) @@ -2716,7 +2716,7 @@ void MythPlayer::SwitchToProgram(void) if (player_ctx->m_buffer->GetType() == ICRingBuffer::kRingBufferType) { // Restore original ringbuffer - ICRingBuffer *ic = dynamic_cast< ICRingBuffer* >(player_ctx->m_buffer); + auto *ic = dynamic_cast< ICRingBuffer* >(player_ctx->m_buffer); if (ic) // should always be true player_ctx->m_buffer = ic->Take(); delete ic; @@ -2872,7 +2872,7 @@ void MythPlayer::JumpToProgram(void) if (player_ctx->m_buffer->GetType() == ICRingBuffer::kRingBufferType) { // Restore original ringbuffer - ICRingBuffer *ic = dynamic_cast< ICRingBuffer* >(player_ctx->m_buffer); + auto *ic = dynamic_cast< ICRingBuffer* >(player_ctx->m_buffer); if (ic) // should always be true player_ctx->m_buffer = ic->Take(); delete ic; @@ -4064,7 +4064,7 @@ bool MythPlayer::IsNearEnd(void) } player_ctx->UnlockPlayingInfo(__FILE__, __LINE__); - long long margin = (long long)(video_frame_rate * 2); + auto margin = (long long)(video_frame_rate * 2); margin = (long long) (margin * audio.GetStretchFactor()); bool watchingTV = IsWatchingInprogress(); @@ -4635,7 +4635,7 @@ bool MythPlayer::HasTVChainNext(void) const char *MythPlayer::GetScreenGrab(int secondsin, int &bufflen, int &vw, int &vh, float &ar) { - long long frameNum = (long long)(secondsin * video_frame_rate); + auto frameNum = (long long)(secondsin * video_frame_rate); return GetScreenGrabAtFrame(frameNum, false, bufflen, vw, vh, ar); } @@ -5065,7 +5065,7 @@ void MythPlayer::GetPlaybackData(InfoMap &infoMap) GetCodecDescription(infoMap); } -int64_t MythPlayer::GetSecondsPlayed(bool honorCutList, int divisor) const +int64_t MythPlayer::GetSecondsPlayed(bool honorCutList, int divisor) { int64_t pos = TranslatePositionFrameToMs(framesPlayed, honorCutList); LOG(VB_PLAYBACK, LOG_DEBUG, LOC + @@ -5572,7 +5572,7 @@ long MythPlayer::GetStreamMaxPos() // Called from the interactiveTV (MHIContext) thread long MythPlayer::SetStreamPos(long ms) { - uint64_t frameNum = (uint64_t)((ms * SafeFPS(decoder)) / 1000); + auto frameNum = (uint64_t)((ms * SafeFPS(decoder)) / 1000); LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("SetStreamPos %1 mS = frame %2, now=%3") .arg(ms).arg(frameNum).arg(GetFramesPlayed()) ); JumpToFrame(frameNum); @@ -5824,16 +5824,16 @@ void MythPlayer::ForceSetupAudioStream(void) static unsigned dbg_ident(const MythPlayer *player) { - static QMutex dbg_lock; - static unsigned dbg_next_ident = 0; - typedef QMap<const MythPlayer*, unsigned> DbgMapType; - static DbgMapType dbg_ident; + static QMutex s_dbgLock; + static unsigned s_dbgNextIdent = 0; + using DbgMapType = QMap<const MythPlayer*, unsigned>; + static DbgMapType s_dbgIdent; - QMutexLocker locker(&dbg_lock); - DbgMapType::iterator it = dbg_ident.find(player); - if (it != dbg_ident.end()) + QMutexLocker locker(&s_dbgLock); + DbgMapType::iterator it = s_dbgIdent.find(player); + if (it != s_dbgIdent.end()) return *it; - return dbg_ident[player] = dbg_next_ident++; + return s_dbgIdent[player] = s_dbgNextIdent++; } /* vim: set expandtab tabstop=4 shiftwidth=4: */ diff --git a/mythtv/libs/libmythtv/mythplayer.h b/mythtv/libs/libmythtv/mythplayer.h index 68ab3bb8b1f..d7dc35683b4 100644 --- a/mythtv/libs/libmythtv/mythplayer.h +++ b/mythtv/libs/libmythtv/mythplayer.h @@ -53,7 +53,7 @@ class QThread; class QWidget; class RingBuffer; -typedef void (*StatusCallback)(int, void*); +using StatusCallback = void (*)(int, void*); /// Timecode types enum TCTypes @@ -212,7 +212,7 @@ class MTV_PUBLIC MythPlayer // divisor can be passed in as an argument, e.g. pass divisor=1 to // return the time in milliseconds. virtual int64_t GetSecondsPlayed(bool honorCutList, - int divisor = 1000) const; + int divisor = 1000); virtual int64_t GetTotalSeconds(bool honorCutList, int divisor = 1000) const; int64_t GetLatestVideoTimecode() const { return m_latestVideoTimecode; } @@ -608,7 +608,7 @@ class MTV_PUBLIC MythPlayer // Private seeking stuff void WaitForSeek(uint64_t frame, uint64_t seeksnap_wanted); void ClearAfterSeek(bool clearvideobuffers = true); - void ClearBeforeSeek(uint64_t Frames); + static void ClearBeforeSeek(uint64_t Frames); // Private chapter stuff virtual bool DoJumpChapter(int chapter); diff --git a/mythtv/libs/libmythtv/mythsystemevent.cpp b/mythtv/libs/libmythtv/mythsystemevent.cpp index ad5829d49d5..4fa2124080f 100644 --- a/mythtv/libs/libmythtv/mythsystemevent.cpp +++ b/mythtv/libs/libmythtv/mythsystemevent.cpp @@ -34,8 +34,8 @@ class SystemEventThread : public QRunnable * \param cmd Command line to run for this System Event * \param eventName Optional System Event name for this command */ - explicit SystemEventThread(const QString &cmd, QString eventName = "") - : m_command(cmd), m_event(std::move(eventName)) {}; + explicit SystemEventThread(QString cmd, QString eventName = "") + : m_command(std::move(cmd)), m_event(std::move(eventName)) {}; /** \fn SystemEventThread::run() * \brief Runs the System Event handler command @@ -261,7 +261,7 @@ void MythSystemEventHandler::customEvent(QEvent *e) { if (e->type() == MythEvent::MythEventMessage) { - MythEvent *me = dynamic_cast<MythEvent *>(e); + auto *me = dynamic_cast<MythEvent *>(e); if (me == nullptr) return; QString msg = me->Message().simplified(); @@ -298,7 +298,7 @@ void MythSystemEventHandler::customEvent(QEvent *e) { SubstituteMatches(tokens, cmd); - SystemEventThread *eventThread = new SystemEventThread(cmd); + auto *eventThread = new SystemEventThread(cmd); MThreadPool::globalInstance()->startReserved( eventThread, "SystemEvent"); } @@ -312,8 +312,7 @@ void MythSystemEventHandler::customEvent(QEvent *e) LOG(VB_GENERAL, LOG_INFO, LOC + QString("Starting thread for command '%1'").arg(cmd)); - SystemEventThread *eventThread = - new SystemEventThread(cmd, tokens[1]); + auto *eventThread = new SystemEventThread(cmd, tokens[1]); MThreadPool::globalInstance()->startReserved( eventThread, "SystemEvent"); } diff --git a/mythtv/libs/libmythtv/mythsystemevent.h b/mythtv/libs/libmythtv/mythsystemevent.h index 2d16f87650d..b366e18defc 100644 --- a/mythtv/libs/libmythtv/mythsystemevent.h +++ b/mythtv/libs/libmythtv/mythsystemevent.h @@ -34,8 +34,8 @@ class MTV_PUBLIC MythSystemEventHandler : public QObject private: // Helpers for converting incoming events to command lines - void SubstituteMatches(const QStringList &tokens, QString &command); - QString EventNameToSetting(const QString &name); + static void SubstituteMatches(const QStringList &tokens, QString &command); + static QString EventNameToSetting(const QString &name); // Custom Event Handler void customEvent(QEvent *e) override; // QObject diff --git a/mythtv/libs/libmythtv/mythvideoout.cpp b/mythtv/libs/libmythtv/mythvideoout.cpp index c4a6ab16ddb..b5746d5e5b8 100644 --- a/mythtv/libs/libmythtv/mythvideoout.cpp +++ b/mythtv/libs/libmythtv/mythvideoout.cpp @@ -76,7 +76,7 @@ MythVideoOutput *MythVideoOutput::Create(const QString &Decoder, MythCodecID QString renderer; - VideoDisplayProfile *vprof = new VideoDisplayProfile(); + auto *vprof = new VideoDisplayProfile(); if (!renderers.empty()) { @@ -253,21 +253,7 @@ MythVideoOutput *MythVideoOutput::Create(const QString &Decoder, MythCodecID * Init(int,int,float,WId,int,int,int,int,WId) call. */ MythVideoOutput::MythVideoOutput() - : m_display(nullptr), - m_dbDisplayDimensionsMM(0,0), - m_dbAspectOverride(kAspect_Off), - m_dbAdjustFill(kAdjustFill_Off), - m_dbLetterboxColour(kLetterBoxColour_Black), - m_videoCodecID(kCodec_NONE), - m_maxReferenceFrames(16), - m_dbDisplayProfile(nullptr), - m_errorState(kError_None), - m_framesPlayed(0), - m_monitorSize(640,480), - m_monitorDimensions(400,300), - m_visual(nullptr), - m_stereo(kStereoscopicModeNone), - m_deinterlacer() + : m_display(nullptr) { m_dbDisplayDimensionsMM = QSize(gCoreContext->GetNumSetting("DisplaySizeWidth", 0), gCoreContext->GetNumSetting("DisplaySizeHeight", 0)); @@ -405,8 +391,8 @@ void MythVideoOutput::VideoAspectRatioChanged(float VideoAspect) */ bool MythVideoOutput::InputChanged(const QSize &VideoDim, const QSize &VideoDispDim, float VideoAspect, MythCodecID CodecID, - bool &/*AspectOnly*/, MythMultiLocker*, - int ReferenceFrames, bool) + bool &/*AspectOnly*/, MythMultiLocker* /*Locks*/, + int ReferenceFrames, bool /*ForceChange*/) { m_window.InputChanged(VideoDim, VideoDispDim, VideoAspect); m_maxReferenceFrames = ReferenceFrames; @@ -475,7 +461,7 @@ QRect MythVideoOutput::GetVisibleOSDBounds(float &VisibleAspect, float ova = m_window.GetOverridenVideoAspect(); QRect vr = m_window.GetVideoRect(); float vs = vr.height() ? static_cast<float>(vr.width()) / vr.height() : 1.0F; - VisibleAspect = ThemeAspect * (ova > 0.0f ? vs / ova : 1.F) * dispPixelAdj; + VisibleAspect = ThemeAspect * (ova > 0.0F ? vs / ova : 1.F) * dispPixelAdj; FontScaling = 1.0F; return { QPoint(0,0), dvr.size() }; @@ -847,11 +833,11 @@ QRect MythVideoOutput::GetImageRect(const QRect &Rect, QRect *DisplayRect) */ QRect MythVideoOutput::GetSafeRect(void) { - static const float safeMargin = 0.05F; + static constexpr float kSafeMargin = 0.05F; float dummy; QRect result = GetVisibleOSDBounds(dummy, dummy, 1.0F); - int safex = static_cast<int>(static_cast<float>(result.width()) * safeMargin); - int safey = static_cast<int>(static_cast<float>(result.height()) * safeMargin); + int safex = static_cast<int>(static_cast<float>(result.width()) * kSafeMargin); + int safey = static_cast<int>(static_cast<float>(result.height()) * kSafeMargin); return { result.left() + safex, result.top() + safey, result.width() - (2 * safex), result.height() - (2 * safey) }; } @@ -863,8 +849,8 @@ void MythVideoOutput::SetPIPState(PIPState Setting) VideoFrameType* MythVideoOutput::DirectRenderFormats(void) { - static VideoFrameType defaultformats[] = { FMT_YV12, FMT_NONE }; - return &defaultformats[0]; + static VideoFrameType s_defaultFormats[] = { FMT_YV12, FMT_NONE }; + return &s_defaultFormats[0]; } /** @@ -917,7 +903,7 @@ void MythVideoOutput::DiscardFrame(VideoFrame *Frame) /// \brief Releases all frames not being actively displayed from any queue /// onto the queue of frames ready for decoding onto. -void MythVideoOutput::DiscardFrames(bool KeyFrame, bool) +void MythVideoOutput::DiscardFrames(bool KeyFrame, bool /*unused*/) { m_videoBuffers.DiscardFrames(KeyFrame); } @@ -959,7 +945,7 @@ void MythVideoOutput::ResizeForVideo(int Width, int Height) return; } - float rate = m_dbDisplayProfile ? m_dbDisplayProfile->GetOutput() : 0.0f; + float rate = m_dbDisplayProfile ? m_dbDisplayProfile->GetOutput() : 0.0F; if (m_display->SwitchToVideo(Width, Height, static_cast<double>(rate))) { // Switching to custom display resolution succeeded diff --git a/mythtv/libs/libmythtv/mythvideoout.h b/mythtv/libs/libmythtv/mythvideoout.h index 2310cdbe78f..afb1fc33056 100644 --- a/mythtv/libs/libmythtv/mythvideoout.h +++ b/mythtv/libs/libmythtv/mythvideoout.h @@ -29,7 +29,7 @@ class OSD; class AudioPlayer; class MythRender; -typedef QMap<MythPlayer*,PIPLocation> PIPMap; +using PIPMap = QMap<MythPlayer*,PIPLocation>; class MythMultiLocker; @@ -157,23 +157,23 @@ class MythVideoOutput static void CopyFrame(VideoFrame* To, const VideoFrame* From); - MythDisplay* m_display; + MythDisplay* m_display {nullptr}; VideoOutWindow m_window; - QSize m_dbDisplayDimensionsMM; + QSize m_dbDisplayDimensionsMM {0,0}; VideoColourSpace m_videoColourSpace; - AspectOverrideMode m_dbAspectOverride; - AdjustFillMode m_dbAdjustFill; - LetterBoxColour m_dbLetterboxColour; - MythCodecID m_videoCodecID; - int m_maxReferenceFrames; - VideoDisplayProfile *m_dbDisplayProfile; + AspectOverrideMode m_dbAspectOverride {kAspect_Off}; + AdjustFillMode m_dbAdjustFill {kAdjustFill_Off}; + LetterBoxColour m_dbLetterboxColour {kLetterBoxColour_Black}; + MythCodecID m_videoCodecID {kCodec_NONE}; + int m_maxReferenceFrames {16}; + VideoDisplayProfile *m_dbDisplayProfile {nullptr}; VideoBuffers m_videoBuffers; - VideoErrorState m_errorState; - long long m_framesPlayed; - QSize m_monitorSize; - QSize m_monitorDimensions; - VideoVisual *m_visual; - StereoscopicMode m_stereo; + VideoErrorState m_errorState {kError_None}; + long long m_framesPlayed {0}; + QSize m_monitorSize {640,480}; + QSize m_monitorDimensions {400,300}; + VideoVisual *m_visual {nullptr}; + StereoscopicMode m_stereo {kStereoscopicModeNone}; MythAVCopy m_copyFrame; MythDeinterlacer m_deinterlacer; }; diff --git a/mythtv/libs/libmythtv/mythvideooutnull.cpp b/mythtv/libs/libmythtv/mythvideooutnull.cpp index 63116f85921..cf079dbcc25 100644 --- a/mythtv/libs/libmythtv/mythvideooutnull.cpp +++ b/mythtv/libs/libmythtv/mythvideooutnull.cpp @@ -48,22 +48,21 @@ void MythVideoOutputNull::GetRenderOptions(RenderOptions &Options) Options.priorities->insert("null", 10); } -MythVideoOutputNull::MythVideoOutputNull() : - global_lock(QMutex::Recursive) +MythVideoOutputNull::MythVideoOutputNull() { LOG(VB_PLAYBACK, LOG_INFO, "VideoOutputNull()"); - memset(&av_pause_frame, 0, sizeof(av_pause_frame)); + memset(&m_avPauseFrame, 0, sizeof(m_avPauseFrame)); } MythVideoOutputNull::~MythVideoOutputNull() { LOG(VB_PLAYBACK, LOG_INFO, "~VideoOutputNull()"); - QMutexLocker locker(&global_lock); + QMutexLocker locker(&m_globalLock); - if (av_pause_frame.buf) + if (m_avPauseFrame.buf) { - delete [] av_pause_frame.buf; - memset(&av_pause_frame, 0, sizeof(av_pause_frame)); + delete [] m_avPauseFrame.buf; + memset(&m_avPauseFrame, 0, sizeof(m_avPauseFrame)); } m_videoBuffers.DeleteBuffers(); @@ -71,21 +70,21 @@ MythVideoOutputNull::~MythVideoOutputNull() void MythVideoOutputNull::CreatePauseFrame(void) { - if (av_pause_frame.buf) + if (m_avPauseFrame.buf) { - delete [] av_pause_frame.buf; - av_pause_frame.buf = nullptr; + delete [] m_avPauseFrame.buf; + m_avPauseFrame.buf = nullptr; } - init(&av_pause_frame, FMT_YV12, + init(&m_avPauseFrame, FMT_YV12, new unsigned char[m_videoBuffers.GetScratchFrame()->size + 128], m_videoBuffers.GetScratchFrame()->width, m_videoBuffers.GetScratchFrame()->height, m_videoBuffers.GetScratchFrame()->size); - av_pause_frame.frameNumber = m_videoBuffers.GetScratchFrame()->frameNumber; - av_pause_frame.frameCounter = m_videoBuffers.GetScratchFrame()->frameCounter; - clear(&av_pause_frame); + m_avPauseFrame.frameNumber = m_videoBuffers.GetScratchFrame()->frameNumber; + m_avPauseFrame.frameCounter = m_videoBuffers.GetScratchFrame()->frameCounter; + clear(&m_avPauseFrame); } bool MythVideoOutputNull::InputChanged(const QSize &video_dim_buf, @@ -110,7 +109,7 @@ bool MythVideoOutputNull::InputChanged(const QSize &video_dim_buf, return false; } - QMutexLocker locker(&global_lock); + QMutexLocker locker(&m_globalLock); if (video_dim_disp == m_window.GetVideoDim()) { @@ -161,7 +160,7 @@ bool MythVideoOutputNull::Init(const QSize &video_dim_buf, const QSize &video_di return false; } - QMutexLocker locker(&global_lock); + QMutexLocker locker(&m_globalLock); MythVideoOutput::Init(video_dim_buf, video_dim_disp, aspect, Display, win_rect, codec_id); @@ -187,14 +186,14 @@ bool MythVideoOutputNull::Init(const QSize &video_dim_buf, const QSize &video_di void MythVideoOutputNull::EmbedInWidget(const QRect &rect) { - QMutexLocker locker(&global_lock); + QMutexLocker locker(&m_globalLock); if (!m_window.IsEmbedding()) MythVideoOutput::EmbedInWidget(rect); } void MythVideoOutputNull::StopEmbedding(void) { - QMutexLocker locker(&global_lock); + QMutexLocker locker(&m_globalLock); if (m_window.IsEmbedding()) MythVideoOutput::StopEmbedding(); } @@ -226,7 +225,7 @@ void MythVideoOutputNull::Show(FrameScanType /*scan*/) void MythVideoOutputNull::UpdatePauseFrame(int64_t &disp_timecode) { - QMutexLocker locker(&global_lock); + QMutexLocker locker(&m_globalLock); // Try used frame first, then fall back to scratch frame. m_videoBuffers.BeginLock(kVideoBuffer_used); @@ -235,19 +234,20 @@ void MythVideoOutputNull::UpdatePauseFrame(int64_t &disp_timecode) used_frame = m_videoBuffers.Head(kVideoBuffer_used); if (used_frame) - CopyFrame(&av_pause_frame, used_frame); + CopyFrame(&m_avPauseFrame, used_frame); m_videoBuffers.EndLock(); if (!used_frame) { m_videoBuffers.GetScratchFrame()->frameNumber = m_framesPlayed - 1; - CopyFrame(&av_pause_frame, m_videoBuffers.GetScratchFrame()); + CopyFrame(&m_avPauseFrame, m_videoBuffers.GetScratchFrame()); } - disp_timecode = av_pause_frame.disp_timecode; + disp_timecode = m_avPauseFrame.disp_timecode; } -void MythVideoOutputNull::ProcessFrame(VideoFrame *Frame, OSD*, const PIPMap &, FrameScanType Scan) +void MythVideoOutputNull::ProcessFrame(VideoFrame *Frame, OSD* /*Osd*/, + const PIPMap & /*PipPlayers*/, FrameScanType Scan) { if (Frame && !Frame->dummy) m_deinterlacer.Filter(Frame, Scan); diff --git a/mythtv/libs/libmythtv/mythvideooutnull.h b/mythtv/libs/libmythtv/mythvideooutnull.h index de7bfcf3232..59266553191 100644 --- a/mythtv/libs/libmythtv/mythvideooutnull.h +++ b/mythtv/libs/libmythtv/mythvideooutnull.h @@ -39,7 +39,7 @@ class MythVideoOutputNull : public MythVideoOutput { return false; } private: - QMutex global_lock; - VideoFrame av_pause_frame; + QMutex m_globalLock {QMutex::Recursive}; + VideoFrame m_avPauseFrame; }; #endif diff --git a/mythtv/libs/libmythtv/netstream.cpp b/mythtv/libs/libmythtv/netstream.cpp index f9235d2be06..6e2159fb93a 100644 --- a/mythtv/libs/libmythtv/netstream.cpp +++ b/mythtv/libs/libmythtv/netstream.cpp @@ -8,29 +8,30 @@ using std::getenv; #include <cstddef> #include <cstdio> +#include <utility> // Qt +#include <QAtomicInt> +#include <QCoreApplication> +#include <QDesktopServices> +#include <QEvent> +#include <QFile> +#include <QMetaType> // qRegisterMetaType +#include <QMutexLocker> #include <QNetworkAccessManager> -#include <QNetworkRequest> -#include <QNetworkReply> -#include <QNetworkProxy> #include <QNetworkDiskCache> +#include <QNetworkProxy> +#include <QNetworkReply> +#include <QNetworkRequest> +#include <QScopedPointer> +#include <QThread> +#include <QUrl> #ifndef QT_NO_OPENSSL #include <QSslConfiguration> #include <QSslError> #include <QSslSocket> #include <QSslKey> #endif -#include <QFile> -#include <QUrl> -#include <QThread> -#include <QMutexLocker> -#include <QEvent> -#include <QCoreApplication> -#include <QAtomicInt> -#include <QMetaType> // qRegisterMetaType -#include <QDesktopServices> -#include <QScopedPointer> // Myth #include "mythlogging.h" @@ -93,16 +94,10 @@ class NetStreamAbort : public QEvent * Network streaming request */ NetStream::NetStream(const QUrl &url, EMode mode /*= kPreferCache*/, - const QByteArray &cert) : + QByteArray cert) : m_id(s_nRequest.fetchAndAddRelaxed(1)), m_url(url), - m_state(kClosed), - m_pending(nullptr), - m_reply(nullptr), - m_nRedirections(0), - m_size(-1), - m_pos(0), - m_cert(cert) + m_cert(std::move(cert)) { setObjectName("NetStream " + url.toString()); @@ -727,12 +722,12 @@ NAMThread & NAMThread::manager() QMutexLocker locker(&s_mtx); // Singleton - static NAMThread thread; - thread.start(); - return thread; + static NAMThread s_thread; + s_thread.start(); + return s_thread; } -NAMThread::NAMThread() : m_bQuit(false), m_mutexNAM(QMutex::Recursive), m_nam(nullptr) +NAMThread::NAMThread() { setObjectName("NAMThread"); @@ -958,7 +953,7 @@ QDateTime NAMThread::GetLastModified(const QUrl &url) Q_FOREACH(const QNetworkCacheMetaData::RawHeader &h, headers) { // RFC 1123 date format: Thu, 01 Dec 1994 16:00:00 GMT - static const char kszFormat[] = "ddd, dd MMM yyyy HH:mm:ss 'GMT'"; + static constexpr char kSzFormat[] = "ddd, dd MMM yyyy HH:mm:ss 'GMT'"; QString const first(h.first.toLower()); if (first == "cache-control") @@ -975,7 +970,7 @@ QDateTime NAMThread::GetLastModified(const QUrl &url) } else if (first == "date") { - QDateTime d = QDateTime::fromString(h.second, kszFormat); + QDateTime d = QDateTime::fromString(h.second, kSzFormat); if (!d.isValid()) { LOG(VB_GENERAL, LOG_WARNING, LOC + diff --git a/mythtv/libs/libmythtv/netstream.h b/mythtv/libs/libmythtv/netstream.h index 5a431f7dc52..0878d2e4033 100644 --- a/mythtv/libs/libmythtv/netstream.h +++ b/mythtv/libs/libmythtv/netstream.h @@ -34,7 +34,7 @@ class NetStream : public QObject public: enum EMode { kNeverCache, kPreferCache, kAlwaysCache }; NetStream(const QUrl &, EMode mode = kPreferCache, - const QByteArray &cert = QByteArray()); + QByteArray cert = QByteArray()); virtual ~NetStream(); public: @@ -93,17 +93,17 @@ private slots: const int m_id; // Unique request ID const QUrl m_url; - mutable QMutex m_mutex; // Protects r/w access to the following data - QNetworkRequest m_request; - enum { kClosed, kPending, kStarted, kReady, kFinished } m_state; - NetStreamRequest* m_pending; - QNetworkReply* m_reply; - int m_nRedirections; - qlonglong m_size; - qlonglong m_pos; - QByteArray m_cert; - QWaitCondition m_ready; - QWaitCondition m_finished; + mutable QMutex m_mutex; // Protects r/w access to the following data + QNetworkRequest m_request; + enum { kClosed, kPending, kStarted, kReady, kFinished } m_state {kClosed}; + NetStreamRequest* m_pending {nullptr}; + QNetworkReply* m_reply {nullptr}; + int m_nRedirections {0}; + qlonglong m_size {-1}; + qlonglong m_pos {0}; + QByteArray m_cert; + QWaitCondition m_ready; + QWaitCondition m_finished; }; @@ -137,7 +137,7 @@ class NAMThread : public QThread void run() override; // QThread bool NewRequest(QEvent *); bool StartRequest(NetStreamRequest *); - bool AbortRequest(NetStreamAbort *); + static bool AbortRequest(NetStreamAbort *); private slots: void quit(); @@ -145,13 +145,13 @@ private slots: private: Q_DISABLE_COPY(NAMThread) - volatile bool m_bQuit; - QSemaphore m_running; - mutable QMutex m_mutexNAM; // Provides recursive access to m_nam - QNetworkAccessManager *m_nam; - mutable QMutex m_mutex; // Protects r/w access to the following data - QQueue< QEvent * > m_workQ; - QWaitCondition m_work; + volatile bool m_bQuit {false}; + QSemaphore m_running; + mutable QMutex m_mutexNAM {QMutex::Recursive}; // Provides recursive access to m_nam + QNetworkAccessManager *m_nam {nullptr}; + mutable QMutex m_mutex; // Protects r/w access to the following data + QQueue< QEvent * > m_workQ; + QWaitCondition m_work; }; #endif /* ndef NETSTREAM_H */ diff --git a/mythtv/libs/libmythtv/opengl/mythdrmprimeinterop.cpp b/mythtv/libs/libmythtv/opengl/mythdrmprimeinterop.cpp index 7c54c4ecd31..8a1f62e8d64 100644 --- a/mythtv/libs/libmythtv/opengl/mythdrmprimeinterop.cpp +++ b/mythtv/libs/libmythtv/opengl/mythdrmprimeinterop.cpp @@ -32,7 +32,7 @@ void MythDRMPRIMEInterop::DeleteTextures(void) for ( ; it != m_openglTextures.constEnd(); ++it) { vector<MythVideoTexture*> textures = it.value(); - vector<MythVideoTexture*>::iterator it2 = textures.begin(); + auto it2 = textures.begin(); for ( ; it2 != textures.end(); ++it2) { if ((*it2)->m_data) @@ -102,7 +102,7 @@ AVDRMFrameDescriptor* MythDRMPRIMEInterop::VerifyBuffer(MythRenderOpenGL *Contex vector<MythVideoTexture*> MythDRMPRIMEInterop::Acquire(MythRenderOpenGL *Context, VideoColourSpace *ColourSpace, - VideoFrame *Frame, FrameScanType) + VideoFrame *Frame, FrameScanType /*Scan*/) { vector<MythVideoTexture*> result; if (!Frame) @@ -115,7 +115,7 @@ vector<MythVideoTexture*> MythDRMPRIMEInterop::Acquire(MythRenderOpenGL *Context bool firstpass = m_openglTextures.isEmpty(); // return cached texture(s) if available - unsigned long long id = reinterpret_cast<unsigned long long>(drmdesc); + auto id = reinterpret_cast<unsigned long long>(drmdesc); if (!m_openglTextures.contains(id)) { result = CreateTextures(drmdesc, m_context, Frame); @@ -126,7 +126,7 @@ vector<MythVideoTexture*> MythDRMPRIMEInterop::Acquire(MythRenderOpenGL *Context result = m_openglTextures[id]; } - if (result.size() > 0 ? format_is_yuv(result[0]->m_frameType) : false) + if (!result.empty() ? format_is_yuv(result[0]->m_frameType) : false) { // YUV frame - enable picture attributes if (firstpass) diff --git a/mythtv/libs/libmythtv/opengl/mythegldmabuf.cpp b/mythtv/libs/libmythtv/opengl/mythegldmabuf.cpp index d6eabaed125..c6d074502be 100644 --- a/mythtv/libs/libmythtv/opengl/mythegldmabuf.cpp +++ b/mythtv/libs/libmythtv/opengl/mythegldmabuf.cpp @@ -61,7 +61,7 @@ inline vector<MythVideoTexture*> MythEGLDMABUF::CreateComposed(AVDRMFrameDescrip VideoFrame *Frame) { vector<QSize> sizes; - sizes.push_back(QSize(Frame->width, Frame->height)); + sizes.emplace_back(QSize(Frame->width, Frame->height)); vector<MythVideoTexture*> textures = MythVideoTexture::CreateTextures(Context, Frame->codec, FMT_RGBA32, sizes, m_gltwo ? GL_TEXTURE_EXTERNAL_OES : QOpenGLTexture::Target2D); @@ -86,19 +86,19 @@ inline vector<MythVideoTexture*> MythEGLDMABUF::CreateComposed(AVDRMFrameDescrip break; } - static const EGLint PLANE_FD[4] = + static constexpr EGLint kPlaneFd[4] = { EGL_DMA_BUF_PLANE0_FD_EXT, EGL_DMA_BUF_PLANE1_FD_EXT, EGL_DMA_BUF_PLANE2_FD_EXT, EGL_DMA_BUF_PLANE3_FD_EXT }; - static const EGLint PLANE_OFFSET[4] = + static constexpr EGLint kPlaneOffset[4] = { EGL_DMA_BUF_PLANE0_OFFSET_EXT, EGL_DMA_BUF_PLANE1_OFFSET_EXT, EGL_DMA_BUF_PLANE2_OFFSET_EXT, EGL_DMA_BUF_PLANE3_OFFSET_EXT }; - static const EGLint PLANE_PITCH[4] = + static constexpr EGLint kPlanePitch[4] = { EGL_DMA_BUF_PLANE0_PITCH_EXT, EGL_DMA_BUF_PLANE1_PITCH_EXT, EGL_DMA_BUF_PLANE2_PITCH_EXT, EGL_DMA_BUF_PLANE3_PITCH_EXT }; - static const EGLint PLANE_MODLO[4] = + static constexpr EGLint kPlaneModlo[4] = { EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT, EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT, EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT, EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT }; - static const EGLint PLANE_MODHI[4] = + static constexpr EGLint kPlaneModhi[4] = { EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT, EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT, EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT, EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT }; @@ -117,14 +117,14 @@ inline vector<MythVideoTexture*> MythEGLDMABUF::CreateComposed(AVDRMFrameDescrip for (int plane = 0; plane < layer->nb_planes; ++plane) { AVDRMPlaneDescriptor* drmplane = &layer->planes[plane]; - attribs << PLANE_FD[plane] << Desc->objects[drmplane->object_index].fd - << PLANE_OFFSET[plane] << static_cast<EGLint>(drmplane->offset) - << PLANE_PITCH[plane] << static_cast<EGLint>(drmplane->pitch); + attribs << kPlaneFd[plane] << Desc->objects[drmplane->object_index].fd + << kPlaneOffset[plane] << static_cast<EGLint>(drmplane->offset) + << kPlanePitch[plane] << static_cast<EGLint>(drmplane->pitch); if (m_useModifiers && (Desc->objects[drmplane->object_index].format_modifier != 0 /* DRM_FORMAT_MOD_NONE*/)) { - attribs << PLANE_MODLO[plane] + attribs << kPlaneModlo[plane] << static_cast<EGLint>(Desc->objects[drmplane->object_index].format_modifier & 0xffffffff) - << PLANE_MODHI[plane] + << kPlaneModhi[plane] << static_cast<EGLint>(Desc->objects[drmplane->object_index].format_modifier >> 32); } } @@ -154,7 +154,7 @@ inline vector<MythVideoTexture*> MythEGLDMABUF::CreateSeparate(AVDRMFrameDescrip { int width = Frame->width >> ((plane > 0) ? 1 : 0); int height = Frame->height >> ((plane > 0) ? 1 : 0); - sizes.push_back(QSize(width, height)); + sizes.emplace_back(QSize(width, height)); } VideoFrameType format = PixelFormatToFrameType(static_cast<AVPixelFormat>(Frame->sw_pix_fmt)); @@ -235,9 +235,5 @@ vector<MythVideoTexture*> MythEGLDMABUF::CreateTextures(AVDRMFrameDescriptor* De if (numlayers == 1) return CreateComposed(Desc, Context, Frame); // X layers with one plane each - else - return CreateSeparate(Desc, Context, Frame); - - LOG(VB_PLAYBACK, LOG_ERR, LOC + "Unknown DRM frame format"); - return result; + return CreateSeparate(Desc, Context, Frame); } diff --git a/mythtv/libs/libmythtv/opengl/mythnvdecinterop.cpp b/mythtv/libs/libmythtv/opengl/mythnvdecinterop.cpp index 75570c87d3c..6319788a1e9 100644 --- a/mythtv/libs/libmythtv/opengl/mythnvdecinterop.cpp +++ b/mythtv/libs/libmythtv/opengl/mythnvdecinterop.cpp @@ -8,19 +8,17 @@ #define CUDA_CHECK(CUDA_FUNCS, CUDA_CALL) \ { \ - CUresult res = CUDA_FUNCS->CUDA_CALL; \ + CUresult res = (CUDA_FUNCS)->CUDA_CALL; \ if (res != CUDA_SUCCESS) { \ const char * desc; \ - CUDA_FUNCS->cuGetErrorString(res, &desc); \ + (CUDA_FUNCS)->cuGetErrorString(res, &desc); \ LOG(VB_GENERAL, LOG_ERR, LOC + QString("CUDA error %1 (%2)").arg(res).arg(desc)); \ } \ } MythNVDECInterop::MythNVDECInterop(MythRenderOpenGL *Context) : MythOpenGLInterop(Context, NVDEC), - m_cudaContext(), - m_cudaFuncs(nullptr), - m_referenceFrames() + m_cudaContext() { InitialiseCuda(); } @@ -48,10 +46,10 @@ void MythNVDECInterop::DeleteTextures(void) for ( ; it != m_openglTextures.constEnd(); ++it) { vector<MythVideoTexture*> textures = it.value(); - vector<MythVideoTexture*>::iterator it2 = textures.begin(); + auto it2 = textures.begin(); for ( ; it2 != textures.end(); ++it2) { - QPair<CUarray,CUgraphicsResource> *data = reinterpret_cast<QPair<CUarray,CUgraphicsResource>*>((*it2)->m_data); + auto *data = reinterpret_cast<QPair<CUarray,CUgraphicsResource>*>((*it2)->m_data); if (data && data->second) CUDA_CHECK(m_cudaFuncs, cuGraphicsUnregisterResource(data->second)); delete data; @@ -141,7 +139,7 @@ vector<MythVideoTexture*> MythNVDECInterop::Acquire(MythRenderOpenGL *Context, return result; } - CUdeviceptr cudabuffer = reinterpret_cast<CUdeviceptr>(Frame->buf); + auto cudabuffer = reinterpret_cast<CUdeviceptr>(Frame->buf); if (!cudabuffer) return result; @@ -156,8 +154,8 @@ vector<MythVideoTexture*> MythNVDECInterop::Acquire(MythRenderOpenGL *Context, if (!m_openglTextures.contains(cudabuffer)) { vector<QSize> sizes; - sizes.push_back(QSize(Frame->width, Frame->height)); - sizes.push_back(QSize(Frame->width, Frame->height >> 1)); + sizes.emplace_back(QSize(Frame->width, Frame->height)); + sizes.emplace_back(QSize(Frame->width, Frame->height >> 1)); vector<MythVideoTexture*> textures = MythVideoTexture::CreateTextures(m_context, FMT_NVDEC, type, sizes); if (textures.empty()) @@ -210,10 +208,10 @@ vector<MythVideoTexture*> MythNVDECInterop::Acquire(MythRenderOpenGL *Context, } else { - vector<MythVideoTexture*>::iterator it = textures.begin(); + auto it = textures.begin(); for ( ; it != textures.end(); ++it) { - QPair<CUarray,CUgraphicsResource> *data = reinterpret_cast<QPair<CUarray,CUgraphicsResource>*>((*it)->m_data); + auto *data = reinterpret_cast<QPair<CUarray,CUgraphicsResource>*>((*it)->m_data); if (data && data->second) CUDA_CHECK(m_cudaFuncs, cuGraphicsUnregisterResource(data->second)); delete data; @@ -238,7 +236,7 @@ vector<MythVideoTexture*> MythNVDECInterop::Acquire(MythRenderOpenGL *Context, result = m_openglTextures[cudabuffer]; for (uint i = 0; i < result.size(); ++i) { - QPair<CUarray,CUgraphicsResource> *data = reinterpret_cast<QPair<CUarray,CUgraphicsResource>*>(result[i]->m_data); + auto *data = reinterpret_cast<QPair<CUarray,CUgraphicsResource>*>(result[i]->m_data); CUDA_MEMCPY2D cpy; memset(&cpy, 0, sizeof(cpy)); cpy.srcMemoryType = CU_MEMORYTYPE_DEVICE; @@ -292,10 +290,7 @@ vector<MythVideoTexture*> MythNVDECInterop::Acquire(MythRenderOpenGL *Context, result.push_back(tex); return result; } - else - { - m_referenceFrames.clear(); - } + m_referenceFrames.clear(); m_discontinuityCounter = Frame->frameCounter; return result; @@ -381,7 +376,7 @@ void MythNVDECInterop::RotateReferenceFrames(CUdeviceptr Buffer) return; // don't retain twice for double rate - if ((m_referenceFrames.size() > 0) && (m_referenceFrames[0] == Buffer)) + if (!m_referenceFrames.empty() && (m_referenceFrames[0] == Buffer)) return; m_referenceFrames.push_front(Buffer); diff --git a/mythtv/libs/libmythtv/opengl/mythnvdecinterop.h b/mythtv/libs/libmythtv/opengl/mythnvdecinterop.h index ade5bdd6324..20bc433bb5b 100644 --- a/mythtv/libs/libmythtv/opengl/mythnvdecinterop.h +++ b/mythtv/libs/libmythtv/opengl/mythnvdecinterop.h @@ -37,7 +37,7 @@ class MythNVDECInterop : public MythOpenGLInterop void RotateReferenceFrames(CUdeviceptr Buffer); CUcontext m_cudaContext; - CudaFunctions *m_cudaFuncs; + CudaFunctions *m_cudaFuncs { nullptr }; QVector<CUdeviceptr> m_referenceFrames; }; diff --git a/mythtv/libs/libmythtv/opengl/mythopenglinterop.cpp b/mythtv/libs/libmythtv/opengl/mythopenglinterop.cpp index 78892c8bb58..fca85ee90d5 100644 --- a/mythtv/libs/libmythtv/opengl/mythopenglinterop.cpp +++ b/mythtv/libs/libmythtv/opengl/mythopenglinterop.cpp @@ -59,9 +59,9 @@ QStringList MythOpenGLInterop::GetAllowedRenderers(VideoFrameType Format) void MythOpenGLInterop::GetInteropTypeCallback(void *Wait, void *Format, void *Result) { LOG(VB_PLAYBACK, LOG_INFO, LOC + "Check interop callback"); - QWaitCondition *wait = reinterpret_cast<QWaitCondition*>(Wait); - VideoFrameType *format = reinterpret_cast<VideoFrameType*>(Format); - MythOpenGLInterop::Type *result = reinterpret_cast<MythOpenGLInterop::Type*>(Result); + auto *wait = reinterpret_cast<QWaitCondition*>(Wait); + auto *format = reinterpret_cast<VideoFrameType*>(Format); + auto *result = reinterpret_cast<MythOpenGLInterop::Type*>(Result); if (format && result) *result = MythOpenGLInterop::GetInteropType(*format); @@ -173,19 +173,19 @@ vector<MythVideoTexture*> MythOpenGLInterop::Retrieve(MythRenderOpenGL *Context, else { // Unpick - AVBufferRef* buffer = reinterpret_cast<AVBufferRef*>(Frame->priv[1]); + auto* buffer = reinterpret_cast<AVBufferRef*>(Frame->priv[1]); if (!buffer || (buffer && !buffer->data)) return result; if (Frame->codec == FMT_NVDEC) { - AVHWDeviceContext* context = reinterpret_cast<AVHWDeviceContext*>(buffer->data); + auto* context = reinterpret_cast<AVHWDeviceContext*>(buffer->data); if (!context || (context && !context->user_opaque)) return result; interop = reinterpret_cast<MythOpenGLInterop*>(context->user_opaque); } else { - AVHWFramesContext* frames = reinterpret_cast<AVHWFramesContext*>(buffer->data); + auto* frames = reinterpret_cast<AVHWFramesContext*>(buffer->data); if (!frames || (frames && !frames->user_opaque)) return result; interop = reinterpret_cast<MythOpenGLInterop*>(frames->user_opaque); @@ -199,15 +199,10 @@ vector<MythVideoTexture*> MythOpenGLInterop::Retrieve(MythRenderOpenGL *Context, } MythOpenGLInterop::MythOpenGLInterop(MythRenderOpenGL *Context, Type InteropType) - : QObject(), - ReferenceCounter("GLInterop", true), + : ReferenceCounter("GLInterop", true), m_context(Context), m_type(InteropType), - m_openglTextures(), - m_openglTextureSize(), - m_discontinuityCounter(0), - m_defaultFree(nullptr), - m_defaultUserOpaque(nullptr) + m_openglTextureSize() { if (m_context) m_context->IncrRef(); @@ -229,8 +224,9 @@ MythOpenGLInterop* MythOpenGLInterop::CreateDummy(void) return new MythOpenGLInterop(nullptr, DUMMY); } -vector<MythVideoTexture*> MythOpenGLInterop::Acquire(MythRenderOpenGL*, VideoColourSpace*, - VideoFrame*, FrameScanType) +vector<MythVideoTexture*> MythOpenGLInterop::Acquire(MythRenderOpenGL* /*Context*/, + VideoColourSpace* /*ColourSpace*/, + VideoFrame* /*Frame*/, FrameScanType /*Scan*/) { return vector<MythVideoTexture*>(); } @@ -245,7 +241,7 @@ void MythOpenGLInterop::DeleteTextures(void) for ( ; it != m_openglTextures.constEnd(); ++it) { vector<MythVideoTexture*> textures = it.value(); - vector<MythVideoTexture*>::iterator it2 = textures.begin(); + auto it2 = textures.begin(); for ( ; it2 != textures.end(); ++it2) { if ((*it2)->m_textureId) diff --git a/mythtv/libs/libmythtv/opengl/mythopenglinterop.h b/mythtv/libs/libmythtv/opengl/mythopenglinterop.h index a0abbaf629d..abcd200fee4 100644 --- a/mythtv/libs/libmythtv/opengl/mythopenglinterop.h +++ b/mythtv/libs/libmythtv/opengl/mythopenglinterop.h @@ -16,7 +16,7 @@ using std::vector; class VideoColourSpace; -typedef void (*FreeAVHWDeviceContext)(struct AVHWDeviceContext*); +using FreeAVHWDeviceContext = void (*)(struct AVHWDeviceContext*); #define DUMMY_INTEROP_ID 1 class MythOpenGLInterop : public QObject, public ReferenceCounter @@ -71,10 +71,10 @@ class MythOpenGLInterop : public QObject, public ReferenceCounter Type m_type; QHash<unsigned long long, vector<MythVideoTexture*> > m_openglTextures; QSize m_openglTextureSize; - long long m_discontinuityCounter; + long long m_discontinuityCounter { 0 }; - FreeAVHWDeviceContext m_defaultFree; - void *m_defaultUserOpaque; + FreeAVHWDeviceContext m_defaultFree { nullptr }; + void *m_defaultUserOpaque { nullptr }; }; #endif // MYTHOPENGLINTEROP_H diff --git a/mythtv/libs/libmythtv/opengl/mythopenglvideo.cpp b/mythtv/libs/libmythtv/opengl/mythopenglvideo.cpp index 702bcacb207..491f3bd0da1 100644 --- a/mythtv/libs/libmythtv/opengl/mythopenglvideo.cpp +++ b/mythtv/libs/libmythtv/opengl/mythopenglvideo.cpp @@ -1,3 +1,6 @@ +// C/C++ +#include <utility> + // MythTV #include "mythcontext.h" #include "tv.h" @@ -23,35 +26,16 @@ MythOpenGLVideo::MythOpenGLVideo(MythRenderOpenGL *Render, VideoColourSpace *Col QSize VideoDim, QSize VideoDispDim, QRect DisplayVisibleRect, QRect DisplayVideoRect, QRect VideoRect, bool ViewportControl, QString Profile) - : QObject(), - m_valid(false), - m_profile(Profile), - m_inputType(FMT_NONE), - m_outputType(FMT_NONE), + : m_profile(std::move(Profile)), m_render(Render), m_videoDispDim(VideoDispDim), m_videoDim(VideoDim), m_masterViewportSize(DisplayVisibleRect.size()), m_displayVideoRect(DisplayVideoRect), m_videoRect(VideoRect), - m_deinterlacer(MythDeintType::DEINT_NONE), - m_deinterlacer2x(false), - m_fallbackDeinterlacer(MythDeintType::DEINT_NONE), m_videoColourSpace(ColourSpace), m_viewportControl(ViewportControl), - m_inputTextures(), - m_prevTextures(), - m_nextTextures(), - m_frameBuffer(nullptr), - m_frameBufferTexture(nullptr), - m_inputTextureSize(m_videoDim), - m_features(), - m_extraFeatures(0), - m_resizing(false), - m_textureTarget(QOpenGLTexture::Target2D), - m_discontinuityCounter(0), - m_lastRotation(0), - m_chromaUpsamplingFilter(false) + m_inputTextureSize(m_videoDim) { if (!m_render || !m_videoColourSpace) return; @@ -103,7 +87,7 @@ void MythOpenGLVideo::UpdateColourSpace(bool PrimariesChanged) } float colourgamma = m_videoColourSpace->GetColourGamma(); - float displaygamma = 1.0f / m_videoColourSpace->GetDisplayGamma(); + float displaygamma = 1.0F / m_videoColourSpace->GetDisplayGamma(); QMatrix4x4 primary = m_videoColourSpace->GetPrimaryMatrix(); for (int i = Progressive; i < ShaderCount; ++i) { @@ -124,9 +108,9 @@ void MythOpenGLVideo::UpdateShaderParameters(void) OpenGLLocker locker(m_render); bool rect = m_textureTarget == QOpenGLTexture::TargetRectangle; - GLfloat lineheight = rect ? 1.0f : 1.0f / m_inputTextureSize.height(); + GLfloat lineheight = rect ? 1.0F : 1.0F / m_inputTextureSize.height(); GLfloat maxheight = rect ? m_videoDispDim.height() : m_videoDispDim.height() / static_cast<GLfloat>(m_inputTextureSize.height()); - GLfloat fieldsize = rect ? 0.5f : m_inputTextureSize.height() / 2.0f; + GLfloat fieldsize = rect ? 0.5F : m_inputTextureSize.height() / 2.0F; QVector4D parameters(lineheight, /* lineheight */ static_cast<GLfloat>(m_inputTextureSize.width()), /* 'Y' select */ maxheight - lineheight, /* maxheight */ @@ -251,7 +235,7 @@ bool MythOpenGLVideo::AddDeinterlacer(const VideoFrame *Frame, FrameScanType Sca if (refstocreate) { vector<QSize> sizes; - sizes.push_back(QSize(m_videoDim)); + sizes.emplace_back(QSize(m_videoDim)); m_prevTextures = MythVideoTexture::CreateTextures(m_render, m_inputType, m_outputType, sizes); m_nextTextures = MythVideoTexture::CreateTextures(m_render, m_inputType, m_outputType, sizes); } @@ -821,9 +805,9 @@ void MythOpenGLVideo::PrepareFrame(VideoFrame *Frame, bool TopFieldFirst, FrameS if (DrawBorder) { QRect piprect = m_displayVideoRect.adjusted(-10, -10, +10, +10); - static const QPen nopen(Qt::NoPen); - static const QBrush redbrush(QBrush(QColor(127, 0, 0, 255))); - m_render->DrawRect(nullptr, piprect, redbrush, nopen, 255); + static const QPen kNopen(Qt::NoPen); + static const QBrush kRedBrush(QBrush(QColor(127, 0, 0, 255))); + m_render->DrawRect(nullptr, piprect, kRedBrush, kNopen, 255); } // bind correct textures diff --git a/mythtv/libs/libmythtv/opengl/mythopenglvideo.h b/mythtv/libs/libmythtv/opengl/mythopenglvideo.h index b5d8a31c4a6..710065df5f0 100644 --- a/mythtv/libs/libmythtv/opengl/mythopenglvideo.h +++ b/mythtv/libs/libmythtv/opengl/mythopenglvideo.h @@ -67,19 +67,19 @@ class MythOpenGLVideo : public QObject bool AddDeinterlacer(const VideoFrame *Frame, FrameScanType Scan, MythDeintType Filter = DEINT_SHADER, bool CreateReferences = true); - bool m_valid; + bool m_valid { false }; QString m_profile; - VideoFrameType m_inputType; ///< Usually YV12 for software, VDPAU etc for hardware - VideoFrameType m_outputType; ///< Set by profile for software or decoder for hardware - MythRenderOpenGL *m_render; + VideoFrameType m_inputType { FMT_NONE }; ///< Usually YV12 for software, VDPAU etc for hardware + VideoFrameType m_outputType { FMT_NONE }; ///< Set by profile for software or decoder for hardware + MythRenderOpenGL *m_render { nullptr }; QSize m_videoDispDim; ///< Useful video frame size e.g. 1920x1080 QSize m_videoDim; ///< Total video frame size e.g. 1920x1088 QSize m_masterViewportSize; ///< Current viewport into which OpenGL is rendered, usually the window size QRect m_displayVideoRect; ///< Sub-rect of display_visible_rect for video QRect m_videoRect; ///< Sub-rect of video_disp_dim to display (after zoom adjustments etc) - MythDeintType m_deinterlacer; - bool m_deinterlacer2x; - MythDeintType m_fallbackDeinterlacer; ///< Only used if there are insufficient texture units (for kernel) + MythDeintType m_deinterlacer { MythDeintType::DEINT_NONE }; + bool m_deinterlacer2x { false }; + MythDeintType m_fallbackDeinterlacer { MythDeintType::DEINT_NONE }; ///< Only used if there are insufficient texture units (for kernel) VideoColourSpace *m_videoColourSpace; bool m_viewportControl; ///< Video has control over view port QOpenGLShaderProgram* m_shaders[ShaderCount] { nullptr }; @@ -87,15 +87,15 @@ class MythOpenGLVideo : public QObject vector<MythVideoTexture*> m_inputTextures; ///< Current textures with raw video data vector<MythVideoTexture*> m_prevTextures; ///< Previous textures with raw video data vector<MythVideoTexture*> m_nextTextures; ///< Next textures with raw video data - QOpenGLFramebufferObject* m_frameBuffer; - MythVideoTexture* m_frameBufferTexture; + QOpenGLFramebufferObject* m_frameBuffer { nullptr }; + MythVideoTexture* m_frameBufferTexture { nullptr }; QSize m_inputTextureSize; ///< Actual size of input texture(s) QOpenGLFunctions::OpenGLFeatures m_features; ///< Default features available from Qt - int m_extraFeatures; ///< OR'd list of extra, Myth specific features - bool m_resizing; - GLenum m_textureTarget; ///< Some interops require custom texture targets - long long m_discontinuityCounter; ///< Check when to release reference frames after a skip - int m_lastRotation; ///< Track rotation for pause frame - bool m_chromaUpsamplingFilter; /// Attempt to fix Chroma Upsampling Error in shaders + int m_extraFeatures { 0 }; ///< OR'd list of extra, Myth specific features + bool m_resizing { false }; + GLenum m_textureTarget { QOpenGLTexture::Target2D }; ///< Some interops require custom texture targets + long long m_discontinuityCounter { 0 }; ///< Check when to release reference frames after a skip + int m_lastRotation { 0 }; ///< Track rotation for pause frame + bool m_chromaUpsamplingFilter { false }; /// Attempt to fix Chroma Upsampling Error in shaders }; #endif // MYTH_OPENGL_VIDEO_H_ diff --git a/mythtv/libs/libmythtv/opengl/mythvaapidrminterop.cpp b/mythtv/libs/libmythtv/opengl/mythvaapidrminterop.cpp index 4549429eb47..882884e67bc 100644 --- a/mythtv/libs/libmythtv/opengl/mythvaapidrminterop.cpp +++ b/mythtv/libs/libmythtv/opengl/mythvaapidrminterop.cpp @@ -71,7 +71,7 @@ void MythVAAPIInteropDRM::DeleteTextures(void) for ( ; it != m_openglTextures.constEnd(); ++it) { vector<MythVideoTexture*> textures = it.value(); - vector<MythVideoTexture*>::iterator it2 = textures.begin(); + auto it2 = textures.begin(); for ( ; it2 != textures.end(); ++it2) { if ((*it2)->m_data) @@ -121,7 +121,7 @@ void MythVAAPIInteropDRM::RotateReferenceFrames(AVBufferRef *Buffer) return; // don't retain twice for double rate - if ((m_referenceFrames.size() > 0) && + if (!m_referenceFrames.empty() && (static_cast<VASurfaceID>(reinterpret_cast<uintptr_t>(m_referenceFrames[0]->data)) == static_cast<VASurfaceID>(reinterpret_cast<uintptr_t>(Buffer->data)))) { @@ -145,9 +145,9 @@ vector<MythVideoTexture*> MythVAAPIInteropDRM::GetReferenceFrames(void) if (size < 1) return result; - VASurfaceID next = static_cast<VASurfaceID>(reinterpret_cast<uintptr_t>(m_referenceFrames[0]->data)); - VASurfaceID current = static_cast<VASurfaceID>(reinterpret_cast<uintptr_t>(m_referenceFrames[size > 1 ? 1 : 0]->data)); - VASurfaceID last = static_cast<VASurfaceID>(reinterpret_cast<uintptr_t>(m_referenceFrames[size > 2 ? 2 : 0]->data)); + auto next = static_cast<VASurfaceID>(reinterpret_cast<uintptr_t>(m_referenceFrames[0]->data)); + auto current = static_cast<VASurfaceID>(reinterpret_cast<uintptr_t>(m_referenceFrames[size > 1 ? 1 : 0]->data)); + auto last = static_cast<VASurfaceID>(reinterpret_cast<uintptr_t>(m_referenceFrames[size > 2 ? 2 : 0]->data)); if (!m_openglTextures.contains(next) || !m_openglTextures.contains(current) || !m_openglTextures.contains(last)) @@ -253,8 +253,7 @@ vector<MythVideoTexture*> MythVAAPIInteropDRM::Acquire(MythRenderOpenGL *Context { if (needreferenceframes) return GetReferenceFrames(); - else - return m_openglTextures[id]; + return m_openglTextures[id]; } OpenGLLocker locker(m_context); @@ -347,7 +346,7 @@ VideoFrameType MythVAAPIInteropDRM::VATypeToMythType(uint32_t Fourcc) case VA_FOURCC_IYUV: case VA_FOURCC_I420: return FMT_YV12; case VA_FOURCC_NV12: return FMT_NV12; - case VA_FOURCC_YUY2: return FMT_YUY2; + case VA_FOURCC_YUY2: return FMT_YUY2; // NOLINT(bugprone-branch-clone) case VA_FOURCC_UYVY: return FMT_YUY2; // ? case VA_FOURCC_P010: return FMT_P010; case VA_FOURCC_P016: return FMT_P016; @@ -409,7 +408,7 @@ vector<MythVideoTexture*> MythVAAPIInteropDRM::AcquirePrime(VASurfaceID Id, exportflags, &vadesc); CHECK_ST; - AVDRMFrameDescriptor *drmdesc = reinterpret_cast<AVDRMFrameDescriptor*>(av_mallocz(sizeof(*drmdesc))); + auto *drmdesc = reinterpret_cast<AVDRMFrameDescriptor*>(av_mallocz(sizeof(AVDRMFrameDescriptor))); VADRMtoPRIME(&vadesc, drmdesc); m_drmFrames.insert(Id, drmdesc); } @@ -443,13 +442,13 @@ void MythVAAPIInteropDRM::CleanupDRMPRIME(void) bool MythVAAPIInteropDRM::TestPrimeInterop(void) { - static bool supported = false; + static bool s_supported = false; #if VA_CHECK_VERSION(1, 1, 0) - static bool checked = false; + static bool s_checked = false; - if (checked) - return supported; - checked = true; + if (s_checked) + return s_supported; + s_checked = true; OpenGLLocker locker(m_context); @@ -479,13 +478,13 @@ bool MythVAAPIInteropDRM::TestPrimeInterop(void) VADRMtoPRIME(&vadesc, &drmdesc); vector<MythVideoTexture*> textures = CreateTextures(&drmdesc, m_context, &frame); - if (textures.size() > 0) + if (!textures.empty()) { - supported = true; - vector<MythVideoTexture*>::iterator it = textures.begin(); + s_supported = true; + auto it = textures.begin(); for ( ; it != textures.end(); ++it) { - supported &= (*it)->m_data && (*it)->m_textureId; + s_supported &= (*it)->m_data && (*it)->m_textureId; if ((*it)->m_data) m_context->eglDestroyImageKHR(m_context->GetEGLDisplay(), (*it)->m_data); (*it)->m_data = nullptr; @@ -502,6 +501,6 @@ bool MythVAAPIInteropDRM::TestPrimeInterop(void) } #endif LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("VAAPI DRM PRIME interop is %1supported") - .arg(supported ? "" : "not ")); - return supported; + .arg(s_supported ? "" : "not ")); + return s_supported; } diff --git a/mythtv/libs/libmythtv/opengl/mythvaapidrminterop.h b/mythtv/libs/libmythtv/opengl/mythvaapidrminterop.h index ec52506d9f7..246f86f86f9 100644 --- a/mythtv/libs/libmythtv/opengl/mythvaapidrminterop.h +++ b/mythtv/libs/libmythtv/opengl/mythvaapidrminterop.h @@ -24,7 +24,7 @@ class MythVAAPIInteropDRM : public MythVAAPIInterop, public MythEGLDMABUF void PostInitDeinterlacer(void) override; private: - VideoFrameType VATypeToMythType(uint32_t Fourcc); + static VideoFrameType VATypeToMythType(uint32_t Fourcc); void CleanupReferenceFrames(void); void RotateReferenceFrames(AVBufferRef *Buffer); vector<MythVideoTexture*> GetReferenceFrames(void); diff --git a/mythtv/libs/libmythtv/opengl/mythvaapiglxinterop.cpp b/mythtv/libs/libmythtv/opengl/mythvaapiglxinterop.cpp index 76f11c67504..0f483a6cb5c 100644 --- a/mythtv/libs/libmythtv/opengl/mythvaapiglxinterop.cpp +++ b/mythtv/libs/libmythtv/opengl/mythvaapiglxinterop.cpp @@ -105,7 +105,7 @@ void MythVAAPIInteropGLX::InitPictureAttributes(VideoColourSpace *ColourSpace) int supported_controls = kPictureAttributeSupported_None; QList<VADisplayAttribute> supported; int num = vaMaxNumDisplayAttributes(m_vaDisplay); - VADisplayAttribute* attribs = new VADisplayAttribute[static_cast<unsigned int>(num)]; + auto* attribs = new VADisplayAttribute[static_cast<unsigned int>(num)]; int actual = 0; INIT_ST; @@ -452,8 +452,8 @@ vector<MythVideoTexture*> MythVAAPIInteropGLXPixmap::Acquire(MythRenderOpenGL *C INIT_ST; va_status = vaSyncSurface(m_vaDisplay, id); CHECK_ST; - unsigned short width = static_cast<unsigned short>(m_openglTextureSize.width()); - unsigned short height = static_cast<unsigned short>(m_openglTextureSize.height()); + auto width = static_cast<unsigned short>(m_openglTextureSize.width()); + auto height = static_cast<unsigned short>(m_openglTextureSize.height()); va_status = vaPutSurface(m_vaDisplay, id, m_pixmap, 0, 0, width, height, 0, 0, width, height, nullptr, 0, GetFlagsForFrame(Frame, Scan)); diff --git a/mythtv/libs/libmythtv/opengl/mythvaapiglxinterop.h b/mythtv/libs/libmythtv/opengl/mythvaapiglxinterop.h index 7c646b986ad..5e53e92b467 100644 --- a/mythtv/libs/libmythtv/opengl/mythvaapiglxinterop.h +++ b/mythtv/libs/libmythtv/opengl/mythvaapiglxinterop.h @@ -42,8 +42,8 @@ class MythVAAPIInteropGLXCopy : public MythVAAPIInteropGLX #include "GL/glx.h" #include "GL/glxext.h" -typedef void ( * MYTH_GLXBINDTEXIMAGEEXT)(Display*, GLXDrawable, int, int*); -typedef void ( * MYTH_GLXRELEASETEXIMAGEEXT)(Display*, GLXDrawable, int); +using MYTH_GLXBINDTEXIMAGEEXT = void (*)(Display*, GLXDrawable, int, int*); +using MYTH_GLXRELEASETEXIMAGEEXT = void (*)(Display*, GLXDrawable, int); class MythVAAPIInteropGLXPixmap : public MythVAAPIInteropGLX { diff --git a/mythtv/libs/libmythtv/opengl/mythvaapiinterop.cpp b/mythtv/libs/libmythtv/opengl/mythvaapiinterop.cpp index f222f7860ba..3b2dc769e5c 100644 --- a/mythtv/libs/libmythtv/opengl/mythvaapiinterop.cpp +++ b/mythtv/libs/libmythtv/opengl/mythvaapiinterop.cpp @@ -44,9 +44,9 @@ MythOpenGLInterop::Type MythVAAPIInterop::GetInteropType(VideoFrameType Format) // best first if (egl && MythVAAPIInteropDRM::IsSupported(context)) // zero copy return VAAPIEGLDRM; - else if (!egl && !wayland && MythVAAPIInteropGLXPixmap::IsSupported(context)) // copy + if (!egl && !wayland && MythVAAPIInteropGLXPixmap::IsSupported(context)) // copy return VAAPIGLXPIX; - else if (!egl && !opengles && !wayland) // 2 * copy + if (!egl && !opengles && !wayland) // 2 * copy return VAAPIGLXCOPY; return Unsupported; } @@ -58,9 +58,9 @@ MythVAAPIInterop* MythVAAPIInterop::Create(MythRenderOpenGL *Context, Type Inter if (InteropType == VAAPIEGLDRM) return new MythVAAPIInteropDRM(Context); - else if (InteropType == VAAPIGLXPIX) + if (InteropType == VAAPIGLXPIX) return new MythVAAPIInteropGLXPixmap(Context); - else if (InteropType == VAAPIGLXCOPY) + if (InteropType == VAAPIGLXCOPY) return new MythVAAPIInteropGLXCopy(Context); return nullptr; } @@ -157,7 +157,7 @@ VASurfaceID MythVAAPIInterop::VerifySurface(MythRenderOpenGL *Context, VideoFram } // Retrieve surface - VASurfaceID id = static_cast<VASurfaceID>(reinterpret_cast<uintptr_t>(Frame->buf)); + auto id = static_cast<VASurfaceID>(reinterpret_cast<uintptr_t>(Frame->buf)); if (id) result = id; return result; @@ -322,7 +322,7 @@ VASurfaceID MythVAAPIInterop::Deinterlace(VideoFrame *Frame, VASurfaceID Current if (deinterlacer != DEINT_NONE) { - AVBufferRef* frames = reinterpret_cast<AVBufferRef*>(Frame->priv[1]); + auto* frames = reinterpret_cast<AVBufferRef*>(Frame->priv[1]); if (!frames) break; @@ -330,10 +330,10 @@ VASurfaceID MythVAAPIInterop::Deinterlace(VideoFrame *Frame, VASurfaceID Current if (!hwdeviceref) break; - AVHWDeviceContext* hwdevicecontext = reinterpret_cast<AVHWDeviceContext*>(hwdeviceref->data); - hwdevicecontext->free = [](AVHWDeviceContext*) { LOG(VB_PLAYBACK, LOG_INFO, LOC + "VAAPI VPP device context finished"); }; + auto* hwdevicecontext = reinterpret_cast<AVHWDeviceContext*>(hwdeviceref->data); + hwdevicecontext->free = [](AVHWDeviceContext* /*unused*/) { LOG(VB_PLAYBACK, LOG_INFO, LOC + "VAAPI VPP device context finished"); }; - AVVAAPIDeviceContext *vaapidevicectx = reinterpret_cast<AVVAAPIDeviceContext*>(hwdevicecontext->hwctx); + auto *vaapidevicectx = reinterpret_cast<AVVAAPIDeviceContext*>(hwdevicecontext->hwctx); vaapidevicectx->display = m_vaDisplay; // re-use the existing display if (av_hwdevice_ctx_init(hwdeviceref) < 0) @@ -351,18 +351,18 @@ VASurfaceID MythVAAPIInterop::Deinterlace(VideoFrame *Frame, VASurfaceID Current break; } - AVHWFramesContext* dstframes = reinterpret_cast<AVHWFramesContext*>(newframes->data); - AVHWFramesContext* srcframes = reinterpret_cast<AVHWFramesContext*>(frames->data); + auto* dstframes = reinterpret_cast<AVHWFramesContext*>(newframes->data); + auto* srcframes = reinterpret_cast<AVHWFramesContext*>(frames->data); m_filterWidth = srcframes->width; m_filterHeight = srcframes->height; - static const int vpppoolsize = 2; // seems to be enough + static constexpr int kVppPoolSize = 2; // seems to be enough dstframes->sw_format = srcframes->sw_format; dstframes->width = m_filterWidth; dstframes->height = m_filterHeight; - dstframes->initial_pool_size = vpppoolsize; + dstframes->initial_pool_size = kVppPoolSize; dstframes->format = AV_PIX_FMT_VAAPI; - dstframes->free = [](AVHWFramesContext*) { LOG(VB_PLAYBACK, LOG_INFO, LOC + "VAAPI VPP frames context finished"); }; + dstframes->free = [](AVHWFramesContext* /*unused*/) { LOG(VB_PLAYBACK, LOG_INFO, LOC + "VAAPI VPP frames context finished"); }; if (av_hwframe_ctx_init(newframes) < 0) { @@ -374,7 +374,7 @@ VASurfaceID MythVAAPIInterop::Deinterlace(VideoFrame *Frame, VASurfaceID Current m_vppFramesContext = newframes; LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("New VAAPI frame pool with %1 %2x%3 surfaces") - .arg(vpppoolsize).arg(m_filterWidth).arg(m_filterHeight)); + .arg(kVppPoolSize).arg(m_filterWidth).arg(m_filterHeight)); av_buffer_unref(&hwdeviceref); if (!MythVAAPIInterop::SetupDeinterlacer(deinterlacer, doublerate, m_vppFramesContext, @@ -438,7 +438,7 @@ VASurfaceID MythVAAPIInterop::Deinterlace(VideoFrame *Frame, VASurfaceID Current m_firstField = true; break; } - else if (ret != AVERROR(EAGAIN)) + if (ret != AVERROR(EAGAIN)) break; } diff --git a/mythtv/libs/libmythtv/opengl/mythvdpauinterop.cpp b/mythtv/libs/libmythtv/opengl/mythvdpauinterop.cpp index 71a0b9c6b1c..e01dd9b50c1 100644 --- a/mythtv/libs/libmythtv/opengl/mythvdpauinterop.cpp +++ b/mythtv/libs/libmythtv/opengl/mythvdpauinterop.cpp @@ -87,7 +87,7 @@ void MythVDPAUInterop::RotateReferenceFrames(AVBufferRef *Buffer) return; // don't retain twice for double rate - if ((m_referenceFrames.size() > 0) && + if (!m_referenceFrames.empty() && (static_cast<VdpVideoSurface>(reinterpret_cast<uintptr_t>(m_referenceFrames[0]->data)) == static_cast<VdpVideoSurface>(reinterpret_cast<uintptr_t>(Buffer->data)))) { @@ -132,11 +132,8 @@ bool MythVDPAUInterop::InitNV(AVVDPAUDeviceContext* DeviceContext) LOG(VB_PLAYBACK, LOG_INFO, LOC + "Ready"); return true; } - else - { - delete m_helper; - m_helper = nullptr; - } + delete m_helper; + m_helper = nullptr; } LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to retrieve procs"); @@ -255,13 +252,13 @@ vector<MythVideoTexture*> MythVDPAUInterop::Acquire(MythRenderOpenGL *Context, !Frame->buf || !Frame->priv[1]) return result; - AVBufferRef* buffer = reinterpret_cast<AVBufferRef*>(Frame->priv[1]); + auto* buffer = reinterpret_cast<AVBufferRef*>(Frame->priv[1]); if (!buffer || (buffer && !buffer->data)) return result; - AVHWFramesContext* frames = reinterpret_cast<AVHWFramesContext*>(buffer->data); + auto* frames = reinterpret_cast<AVHWFramesContext*>(buffer->data); if (!frames || (frames && !frames->device_ctx)) return result; - AVVDPAUDeviceContext *devicecontext = reinterpret_cast<AVVDPAUDeviceContext*>(frames->device_ctx->hwctx); + auto *devicecontext = reinterpret_cast<AVVDPAUDeviceContext*>(frames->device_ctx->hwctx); if (!devicecontext) return result; @@ -270,7 +267,7 @@ vector<MythVideoTexture*> MythVDPAUInterop::Acquire(MythRenderOpenGL *Context, return result; // Retrieve surface - we need its size to create the mixer and output surface - VdpVideoSurface surface = static_cast<VdpVideoSurface>(reinterpret_cast<uintptr_t>(Frame->buf)); + auto surface = static_cast<VdpVideoSurface>(reinterpret_cast<uintptr_t>(Frame->buf)); if (!surface) return result; @@ -356,7 +353,7 @@ vector<MythVideoTexture*> MythVDPAUInterop::Acquire(MythRenderOpenGL *Context, return m_openglTextures[DUMMY_INTEROP_ID]; } -void MythVDPAUInterop::UpdateColourSpace(bool) +void MythVDPAUInterop::UpdateColourSpace(bool /*PrimariesChanged*/) { if (!m_mixer || !m_context || !m_colourSpace || !m_helper) return; diff --git a/mythtv/libs/libmythtv/opengl/mythvdpauinterop.h b/mythtv/libs/libmythtv/opengl/mythvdpauinterop.h index f62e487c0be..ab896486c03 100644 --- a/mythtv/libs/libmythtv/opengl/mythvdpauinterop.h +++ b/mythtv/libs/libmythtv/opengl/mythvdpauinterop.h @@ -15,12 +15,12 @@ extern "C" { class MythVDPAUHelper; -typedef GLintptr MythVDPAUSurfaceNV; -typedef void (APIENTRY * MYTH_VDPAUINITNV)(const void*, const void*); -typedef void (APIENTRY * MYTH_VDPAUFININV)(void); -typedef MythVDPAUSurfaceNV (APIENTRY * MYTH_VDPAUREGOUTSURFNV)(const void*, GLenum, GLsizei, const GLuint*); -typedef void (APIENTRY * MYTH_VDPAUSURFACCESSNV)(MythVDPAUSurfaceNV, GLenum); -typedef void (APIENTRY * MYTH_VDPAUMAPSURFNV)(GLsizei, MythVDPAUSurfaceNV*); +using MythVDPAUSurfaceNV = GLintptr; +using MYTH_VDPAUINITNV = void (APIENTRY *)(const void*, const void*); +using MYTH_VDPAUFININV = void (APIENTRY *)(void); +using MYTH_VDPAUREGOUTSURFNV = MythVDPAUSurfaceNV (APIENTRY *)(const void*, GLenum, GLsizei, const GLuint*); +using MYTH_VDPAUSURFACCESSNV = void (APIENTRY *)(MythVDPAUSurfaceNV, GLenum); +using MYTH_VDPAUMAPSURFNV = void (APIENTRY *)(GLsizei, MythVDPAUSurfaceNV*); class MythVDPAUInterop : public MythOpenGLInterop { diff --git a/mythtv/libs/libmythtv/opengl/mythvideooutopengl.cpp b/mythtv/libs/libmythtv/opengl/mythvideooutopengl.cpp index 0b39745bcdf..ec9b260d0ae 100644 --- a/mythtv/libs/libmythtv/opengl/mythvideooutopengl.cpp +++ b/mythtv/libs/libmythtv/opengl/mythvideooutopengl.cpp @@ -1,3 +1,6 @@ +// C/C++ +#include <utility> + // MythTV #include "mythcontext.h" #include "mythmainwindow.h" @@ -93,20 +96,8 @@ void MythVideoOutputOpenGL::GetRenderOptions(RenderOptions &Options) #endif } -MythVideoOutputOpenGL::MythVideoOutputOpenGL(const QString &Profile) - : MythVideoOutput(), - m_render(nullptr), - m_isGLES2(false), - m_openGLVideo(nullptr), - m_openGLVideoPiPActive(nullptr), - m_openGLPainter(nullptr), - m_videoProfile(Profile), - m_newCodecId(kCodec_NONE), - m_newVideoDim(), - m_newVideoDispDim(), - m_newAspect(0.0f), - m_buffersCreated(false), - m_openGLPerf(nullptr) +MythVideoOutputOpenGL::MythVideoOutputOpenGL(QString Profile) + : m_videoProfile(std::move(Profile)) { // Retrieve render context m_render = MythRenderOpenGL::GetOpenGLRender(); @@ -176,8 +167,7 @@ MythVideoOutputOpenGL::~MythVideoOutputOpenGL() m_openGLVideoPiPsReady.clear(); if (m_openGLPainter) m_openGLPainter->SetSwapControl(true); - if (m_openGLVideo) - delete m_openGLVideo; + delete m_openGLVideo; if (m_render) { m_render->makeCurrent(); @@ -265,7 +255,7 @@ bool MythVideoOutputOpenGL::Init(const QSize &VideoDim, const QSize &VideoDispDi bool MythVideoOutputOpenGL::InputChanged(const QSize &VideoDim, const QSize &VideoDispDim, float Aspect, MythCodecID CodecId, bool &AspectOnly, - MythMultiLocker*, int ReferenceFrames, + MythMultiLocker* /*Locks*/, int ReferenceFrames, bool ForceChange) { QSize currentvideodim = m_window.GetVideoDim(); @@ -367,17 +357,17 @@ bool MythVideoOutputOpenGL::CreateBuffers(MythCodecID CodecID, QSize Size) if (codec_is_mediacodec(CodecID)) return m_videoBuffers.CreateBuffers(FMT_MEDIACODEC, Size, false, 1, 2, 2); - else if (codec_is_vaapi(CodecID)) + if (codec_is_vaapi(CodecID)) return m_videoBuffers.CreateBuffers(FMT_VAAPI, Size, false, 2, 1, 4, m_maxReferenceFrames); - else if (codec_is_vtb(CodecID)) + if (codec_is_vtb(CodecID)) return m_videoBuffers.CreateBuffers(FMT_VTB, Size, false, 1, 4, 2); - else if (codec_is_vdpau(CodecID)) + if (codec_is_vdpau(CodecID)) return m_videoBuffers.CreateBuffers(FMT_VDPAU, Size, false, 2, 1, 4, m_maxReferenceFrames); - else if (codec_is_nvdec(CodecID)) + if (codec_is_nvdec(CodecID)) return m_videoBuffers.CreateBuffers(FMT_NVDEC, Size, false, 2, 1, 4); - else if (codec_is_mmal(CodecID)) + if (codec_is_mmal(CodecID)) return m_videoBuffers.CreateBuffers(FMT_MMAL, Size, false, 2, 1, 4); - else if (codec_is_v4l2(CodecID) || codec_is_drmprime(CodecID)) + if (codec_is_v4l2(CodecID) || codec_is_drmprime(CodecID)) return m_videoBuffers.CreateBuffers(FMT_DRMPRIME, Size, false, 2, 1, 4); return m_videoBuffers.CreateBuffers(FMT_YV12, Size, false, 1, 8, 4, m_maxReferenceFrames); @@ -429,7 +419,7 @@ void MythVideoOutputOpenGL::ProcessFrame(VideoFrame *Frame, OSD */*osd*/, m_newCodecId = kCodec_NONE; m_newVideoDim = QSize(); m_newVideoDispDim = QSize(); - m_newAspect = 0.0f; + m_newAspect = 0.0F; if (wasembedding && ok) EmbedInWidget(oldrect); @@ -720,7 +710,7 @@ void MythVideoOutputOpenGL::DiscardFrames(bool KeyFrame, bool Flushed) VideoFrameType* MythVideoOutputOpenGL::DirectRenderFormats(void) { - static VideoFrameType openglformats[] = + static VideoFrameType s_openglFormats[] = { FMT_YV12, FMT_NV12, FMT_YUY2, FMT_YUV422P, FMT_YUV444P, FMT_YUV420P9, FMT_YUV420P10, FMT_YUV420P12, FMT_YUV420P14, FMT_YUV420P16, FMT_YUV422P9, FMT_YUV422P10, FMT_YUV422P12, FMT_YUV422P14, FMT_YUV422P16, @@ -728,9 +718,9 @@ VideoFrameType* MythVideoOutputOpenGL::DirectRenderFormats(void) FMT_P010, FMT_P016, FMT_NONE }; // OpenGLES2 only allows luminance textures - no RG etc - static VideoFrameType opengles2formats[] = + static VideoFrameType s_opengles2Formats[] = { FMT_YV12, FMT_YUY2, FMT_YUV422P, FMT_YUV444P, FMT_NONE }; - return m_isGLES2 ? &opengles2formats[0] : &openglformats[0]; + return m_isGLES2 ? &s_opengles2Formats[0] : &s_openglFormats[0]; } void MythVideoOutputOpenGL::WindowResized(const QSize &Size) @@ -777,7 +767,7 @@ void MythVideoOutputOpenGL::ClearAfterSeek(void) * filtering, we allow the OpenGL video code to fallback to a supported, reasonable * alternative. */ -QStringList MythVideoOutputOpenGL::GetAllowedRenderers(MythCodecID CodecId, const QSize&) +QStringList MythVideoOutputOpenGL::GetAllowedRenderers(MythCodecID CodecId, const QSize& /*VideoDim*/) { QStringList allowed; if (getenv("NO_OPENGL")) @@ -836,7 +826,7 @@ void MythVideoOutputOpenGL::InitPictureAttributes(void) m_videoColourSpace.SetSupportedAttributes(ALL_PICTURE_ATTRIBUTES); } -void MythVideoOutputOpenGL::ShowPIP(VideoFrame*, MythPlayer *PiPPlayer, PIPLocation Location) +void MythVideoOutputOpenGL::ShowPIP(VideoFrame* /*Frame*/, MythPlayer *PiPPlayer, PIPLocation Location) { if (!PiPPlayer) return; @@ -846,7 +836,7 @@ void MythVideoOutputOpenGL::ShowPIP(VideoFrame*, MythPlayer *PiPPlayer, PIPLocat const QSize pipvideodim = PiPPlayer->GetVideoBufferSize(); QRect pipvideorect = QRect(QPoint(0, 0), pipvideodim); - if ((PiPPlayer->GetVideoAspect() <= 0.0f) || !pipimage || !pipimage->buf || + if ((PiPPlayer->GetVideoAspect() <= 0.0F) || !pipimage || !pipimage->buf || (pipimage->codec != FMT_YV12) || !PiPPlayer->IsPIPVisible()) { PiPPlayer->ReleaseCurrentFrame(pipimage); @@ -861,7 +851,7 @@ void MythVideoOutputOpenGL::ShowPIP(VideoFrame*, MythPlayer *PiPPlayer, PIPLocat if (!gl_pipchain) { LOG(VB_PLAYBACK, LOG_INFO, LOC + "Initialise PiP"); - VideoColourSpace *colourspace = new VideoColourSpace(&m_videoColourSpace); + auto *colourspace = new VideoColourSpace(&m_videoColourSpace); m_openGLVideoPiPs[PiPPlayer] = gl_pipchain = new MythOpenGLVideo(m_render, colourspace, pipvideodim, pipvideodim, dvr, position, pipvideorect, @@ -880,7 +870,7 @@ void MythVideoOutputOpenGL::ShowPIP(VideoFrame*, MythPlayer *PiPPlayer, PIPLocat { LOG(VB_PLAYBACK, LOG_INFO, LOC + "Re-initialise PiP."); delete gl_pipchain; - VideoColourSpace *colourspace = new VideoColourSpace(&m_videoColourSpace); + auto *colourspace = new VideoColourSpace(&m_videoColourSpace); m_openGLVideoPiPs[PiPPlayer] = gl_pipchain = new MythOpenGLVideo(m_render, colourspace, pipvideodim, pipvideodim, dvr, position, pipvideorect, @@ -930,12 +920,12 @@ MythPainter *MythVideoOutputOpenGL::GetOSDPainter(void) return m_openGLPainter; } -bool MythVideoOutputOpenGL::CanVisualise(AudioPlayer *Audio, MythRender*) +bool MythVideoOutputOpenGL::CanVisualise(AudioPlayer *Audio, MythRender* /*Render*/) { return MythVideoOutput::CanVisualise(Audio, m_render); } -bool MythVideoOutputOpenGL::SetupVisualisation(AudioPlayer *Audio, MythRender*, const QString &Name) +bool MythVideoOutputOpenGL::SetupVisualisation(AudioPlayer *Audio, MythRender* /*Render*/, const QString &Name) { return MythVideoOutput::SetupVisualisation(Audio, m_render, Name); } diff --git a/mythtv/libs/libmythtv/opengl/mythvideooutopengl.h b/mythtv/libs/libmythtv/opengl/mythvideooutopengl.h index a7c87d97f77..3c63b1356ab 100644 --- a/mythtv/libs/libmythtv/opengl/mythvideooutopengl.h +++ b/mythtv/libs/libmythtv/opengl/mythvideooutopengl.h @@ -15,7 +15,7 @@ class MythVideoOutputOpenGL : public MythVideoOutput static void GetRenderOptions(RenderOptions &Options); static QStringList GetAllowedRenderers(MythCodecID CodecId, const QSize &VideoDim); - explicit MythVideoOutputOpenGL(const QString &Profile = QString()); + explicit MythVideoOutputOpenGL(QString Profile = QString()); ~MythVideoOutputOpenGL() override; // VideoOutput @@ -51,22 +51,22 @@ class MythVideoOutputOpenGL : public MythVideoOutput bool CreateBuffers(MythCodecID CodecID, QSize Size); QRect GetDisplayVisibleRect(void); - MythRenderOpenGL *m_render; - bool m_isGLES2; - MythOpenGLVideo *m_openGLVideo; + MythRenderOpenGL *m_render { nullptr }; + bool m_isGLES2 { false }; + MythOpenGLVideo *m_openGLVideo { nullptr }; QMap<MythPlayer*,MythOpenGLVideo*> m_openGLVideoPiPs; QMap<MythPlayer*,bool> m_openGLVideoPiPsReady; - MythOpenGLVideo *m_openGLVideoPiPActive; - MythOpenGLPainter *m_openGLPainter; + MythOpenGLVideo *m_openGLVideoPiPActive { nullptr }; + MythOpenGLPainter *m_openGLPainter { nullptr }; QString m_videoProfile; - MythCodecID m_newCodecId; + MythCodecID m_newCodecId { kCodec_NONE }; QSize m_newVideoDim; QSize m_newVideoDispDim; - float m_newAspect; - bool m_buffersCreated; + float m_newAspect { 0.0F }; + bool m_buffersCreated { false }; // performance monitoring (-v gpu) - MythOpenGLPerf *m_openGLPerf; + MythOpenGLPerf *m_openGLPerf { nullptr }; }; #endif diff --git a/mythtv/libs/libmythtv/opengl/mythvideotexture.cpp b/mythtv/libs/libmythtv/opengl/mythvideotexture.cpp index 66dc40ce5b8..3abb162f4f1 100644 --- a/mythtv/libs/libmythtv/opengl/mythvideotexture.cpp +++ b/mythtv/libs/libmythtv/opengl/mythvideotexture.cpp @@ -14,24 +14,16 @@ MythVideoTexture::MythVideoTexture(GLuint Texture) { } -MythVideoTexture::~MythVideoTexture() -{ -} - void MythVideoTexture::DeleteTexture(MythRenderOpenGL *Context, MythVideoTexture *Texture) { if (!Context || !Texture) return; OpenGLLocker locker(Context); - if (Texture->m_copyContext) - delete Texture->m_copyContext; - if (Texture->m_texture) - delete Texture->m_texture; - if (Texture->m_data) - delete [] Texture->m_data; - if (Texture->m_vbo) - delete Texture->m_vbo; + delete Texture->m_copyContext; + delete Texture->m_texture; + delete [] Texture->m_data; + delete Texture->m_vbo; delete Texture; } @@ -118,7 +110,7 @@ vector<MythVideoTexture*> MythVideoTexture::CreateHardwareTextures(MythRenderOpe if (!textureid) continue; - MythVideoTexture* texture = new MythVideoTexture(textureid); + auto* texture = new MythVideoTexture(textureid); texture->m_frameType = Type; texture->m_frameFormat = Format; texture->m_plane = plane; @@ -424,11 +416,11 @@ MythVideoTexture* MythVideoTexture::CreateTexture(MythRenderOpenGL *Context, OpenGLLocker locker(Context); - int datasize = Context->GetBufferSize(Size, PixelFormat, PixelType); + int datasize = MythRenderOpenGL::GetBufferSize(Size, PixelFormat, PixelType); if (!datasize) return nullptr; - QOpenGLTexture *texture = new QOpenGLTexture(static_cast<QOpenGLTexture::Target>(Target)); + auto *texture = new QOpenGLTexture(static_cast<QOpenGLTexture::Target>(Target)); texture->setAutoMipMapGenerationEnabled(false); texture->setMipLevels(1); texture->setSize(Size.width(), Size.height()); // this triggers creation @@ -451,7 +443,7 @@ MythVideoTexture* MythVideoTexture::CreateTexture(MythRenderOpenGL *Context, texture->setMinMagFilters(Filter, Filter); texture->setWrapMode(Wrap); - MythVideoTexture *result = new MythVideoTexture(texture); + auto *result = new MythVideoTexture(texture); result->m_target = Target; result->m_pixelFormat = PixelFormat; result->m_pixelType = PixelType; @@ -579,7 +571,7 @@ MythVideoTexture* MythVideoTexture::CreateHelperTexture(MythRenderOpenGL *Contex for (int i = 0; i < width; i++) { - float x = (i + 0.5f) / static_cast<float>(width); + float x = (i + 0.5F) / static_cast<float>(width); StoreBicubicWeights(x, ref); ref += 4; } diff --git a/mythtv/libs/libmythtv/opengl/mythvideotexture.h b/mythtv/libs/libmythtv/opengl/mythvideotexture.h index a43cd636414..f58f9891e08 100644 --- a/mythtv/libs/libmythtv/opengl/mythvideotexture.h +++ b/mythtv/libs/libmythtv/opengl/mythvideotexture.h @@ -40,7 +40,7 @@ class MythVideoTexture : public MythGLTexture QOpenGLTexture::TextureFormat Format = QOpenGLTexture::NoFormat, QOpenGLTexture::Filter Filter = QOpenGLTexture::Linear, QOpenGLTexture::WrapMode Wrap = QOpenGLTexture::ClampToEdge); - ~MythVideoTexture(); + ~MythVideoTexture() = default; public: bool m_valid { false }; diff --git a/mythtv/libs/libmythtv/osd.cpp b/mythtv/libs/libmythtv/osd.cpp index 6e087d65fc0..460dc27a59e 100644 --- a/mythtv/libs/libmythtv/osd.cpp +++ b/mythtv/libs/libmythtv/osd.cpp @@ -32,12 +32,6 @@ QEvent::Type OSDHideEvent::kEventType = static_cast<QEvent::Type>(QEvent::registerEventType()); -ChannelEditor::ChannelEditor(QObject *RetObject, const char *Name) - : MythScreenType(static_cast<MythScreenType*>(nullptr), Name), - m_retObject(RetObject) -{ -} - bool ChannelEditor::Create(void) { if (!XMLParseBase::LoadWindowFromXML("osd.xml", "ChannelEditor", this)) @@ -141,19 +135,10 @@ void ChannelEditor::SendResult(int result) break; } - DialogCompletionEvent *dce = new DialogCompletionEvent("", result, - "", message); + auto *dce = new DialogCompletionEvent("", result, "", message); QCoreApplication::postEvent(m_retObject, dce); } -OSD::OSD(MythPlayer *Player, QObject *Parent, MythPainter *Painter) - : m_parent(Player), - m_ParentObject(Parent), - m_CurrentPainter(Painter) -{ - SetTimeouts(3000, 5000, 13000); -} - OSD::~OSD() { TearDown(); @@ -308,14 +293,14 @@ void OSD::HideAll(bool KeepSubs, MythScreenType* Except, bool DropNotification) void OSD::LoadWindows(void) { - static const char* default_windows[7] = { + static const char* s_defaultWindows[7] = { "osd_message", "osd_input", "program_info", "browse_info", "osd_status", "osd_program_editor", "osd_debug"}; for (int i = 0; i < 7; i++) { - const char* window = default_windows[i]; - MythOSDWindow *win = new MythOSDWindow(nullptr, window, true); + const char* window = s_defaultWindows[i]; + auto *win = new MythOSDWindow(nullptr, window, true); win->SetPainter(m_CurrentPainter); if (win->Create()) @@ -555,7 +540,7 @@ void OSD::SetText(const QString &Window, const InfoMap &Map, OSDTimeout Timeout) if (win == m_Dialog) { - ChannelEditor *edit = dynamic_cast<ChannelEditor*>(m_Dialog); + auto *edit = dynamic_cast<ChannelEditor*>(m_Dialog); if (edit) edit->SetText(Map); else @@ -639,7 +624,7 @@ void OSD::SetGraph(const QString &Window, const QString &Graph, int64_t Timecode if (!win) return; - MythUIImage *image = dynamic_cast<MythUIImage* >(win->GetChild(Graph)); + auto *image = dynamic_cast<MythUIImage* >(win->GetChild(Graph)); if (!image) return; @@ -684,7 +669,7 @@ bool OSD::Draw(MythPainter* Painter, QSize Size, bool Repaint) QList<MythScreenType*>::iterator it2 = notifications.begin(); while (it2 != notifications.end()) { - if (!nc->ScreenCreated(*it2)) + if (!MythNotificationCenter::ScreenCreated(*it2)) { LOG(VB_GUI, LOG_DEBUG, LOC + "Creating OSD Notification"); @@ -708,11 +693,11 @@ bool OSD::Draw(MythPainter* Painter, QSize Size, bool Repaint) (*it2)->SetPainter(m_CurrentPainter); - nc->UpdateScreen(*it2); + MythNotificationCenter::UpdateScreen(*it2); visible = true; (*it2)->Pulse(); - QTime expires = nc->ScreenExpiryTime(*it2).time(); + QTime expires = MythNotificationCenter::ScreenExpiryTime(*it2).time(); int left = now.msecsTo(expires); if (left < 0) left = 0; @@ -779,7 +764,7 @@ void OSD::CheckExpiry(void) if (!m_PulsedDialogText.isEmpty() && now > m_NextPulseUpdate) { QString newtext = m_PulsedDialogText; - MythDialogBox *dialog = dynamic_cast<MythDialogBox*>(m_Dialog); + auto *dialog = dynamic_cast<MythDialogBox*>(m_Dialog); if (dialog) { // The disambiguation string must be an empty string @@ -789,7 +774,7 @@ void OSD::CheckExpiry(void) static_cast<int>(now.secsTo(it.value()))); dialog->SetText(newtext.replace("%d", replace)); } - MythConfirmationDialog *cdialog = dynamic_cast<MythConfirmationDialog*>(m_Dialog); + auto *cdialog = dynamic_cast<MythConfirmationDialog*>(m_Dialog); if (cdialog) { QString replace = QString::number(now.secsTo(it.value())); @@ -948,7 +933,7 @@ void OSD::HideWindow(const QString &Window) void OSD::SendHideEvent(void) { - OSDHideEvent *event = new OSDHideEvent(m_FunctionalType); + auto *event = new OSDHideEvent(m_FunctionalType); QCoreApplication::postEvent(m_ParentObject, event); } @@ -999,7 +984,7 @@ void OSD::DialogShow(const QString &Window, const QString &Text, int UpdateFor) } else { - MythDialogBox *dialog = dynamic_cast<MythDialogBox*>(m_Dialog); + auto *dialog = dynamic_cast<MythDialogBox*>(m_Dialog); if (dialog) dialog->Reset(); @@ -1026,10 +1011,10 @@ void OSD::DialogShow(const QString &Window, const QString &Text, int UpdateFor) { PositionWindow(dialog); m_Dialog = dialog; - MythDialogBox *dbox = dynamic_cast<MythDialogBox*>(m_Dialog); + auto *dbox = dynamic_cast<MythDialogBox*>(m_Dialog); if (dbox) dbox->SetReturnEvent(m_ParentObject, Window); - MythConfirmationDialog *cbox = dynamic_cast<MythConfirmationDialog*>(m_Dialog); + auto *cbox = dynamic_cast<MythConfirmationDialog*>(m_Dialog); if (cbox) { cbox->SetReturnEvent(m_ParentObject, Window); @@ -1061,14 +1046,14 @@ void OSD::DialogShow(const QString &Window, const QString &Text, int UpdateFor) void OSD::DialogSetText(const QString &Text) { - MythDialogBox *dialog = dynamic_cast<MythDialogBox*>(m_Dialog); + auto *dialog = dynamic_cast<MythDialogBox*>(m_Dialog); if (dialog) dialog->SetText(Text); } void OSD::DialogBack(const QString& Text, const QVariant& Data, bool Exit) { - MythDialogBox *dialog = dynamic_cast<MythDialogBox*>(m_Dialog); + auto *dialog = dynamic_cast<MythDialogBox*>(m_Dialog); if (dialog) { dialog->SetBackAction(Text, Data); @@ -1079,14 +1064,14 @@ void OSD::DialogBack(const QString& Text, const QVariant& Data, bool Exit) void OSD::DialogAddButton(const QString& Text, QVariant Data, bool Menu, bool Current) { - MythDialogBox *dialog = dynamic_cast<MythDialogBox*>(m_Dialog); + auto *dialog = dynamic_cast<MythDialogBox*>(m_Dialog); if (dialog) dialog->AddButton(Text, std::move(Data), Menu, Current); } void OSD::DialogGetText(InfoMap &Map) { - ChannelEditor *edit = dynamic_cast<ChannelEditor*>(m_Dialog); + auto *edit = dynamic_cast<ChannelEditor*>(m_Dialog); if (edit) edit->GetText(Map); } @@ -1259,13 +1244,6 @@ void OSD::DisplayBDOverlay(BDOverlay* Overlay) bd->DisplayBDOverlay(Overlay); } -OsdNavigation::OsdNavigation(QObject *RetObject, const QString &Name, OSD *Osd) - : MythScreenType(static_cast<MythScreenType*>(nullptr), Name), - m_retObject(RetObject), - m_osd(Osd) -{ -} - bool OsdNavigation::Create(void) { if (!XMLParseBase::LoadWindowFromXML("osd.xml", "osd_navigation", this)) @@ -1370,8 +1348,7 @@ void OsdNavigation::SendResult(int Result, const QString& Action) if (!m_retObject) return; - DialogCompletionEvent *dce = - new DialogCompletionEvent("", Result, "", Action); + auto *dce = new DialogCompletionEvent("", Result, "", Action); QCoreApplication::postEvent(m_retObject, dce); } diff --git a/mythtv/libs/libmythtv/osd.h b/mythtv/libs/libmythtv/osd.h index db8e677ac3a..5dcd94b65d0 100644 --- a/mythtv/libs/libmythtv/osd.h +++ b/mythtv/libs/libmythtv/osd.h @@ -83,7 +83,9 @@ class ChannelEditor : public MythScreenType Q_OBJECT public: - ChannelEditor(QObject *RetObject, const char * Name); + ChannelEditor(QObject *RetObject, const char * Name) + : MythScreenType((MythScreenType*)nullptr, Name), + m_retObject(RetObject) {} bool Create(void) override; bool keyPressEvent(QKeyEvent *Event) override; @@ -131,7 +133,8 @@ class OSD Q_DECLARE_TR_FUNCTIONS(OSD) public: - OSD(MythPlayer *Player, QObject *Parent, MythPainter *Painter); + OSD(MythPlayer *Player, QObject *Parent, MythPainter *Painter) + : m_parent(Player), m_ParentObject(Parent), m_CurrentPainter(Painter) {} ~OSD(); bool Init(const QRect &Rect, float FontAspect); @@ -205,10 +208,10 @@ class OSD QDateTime m_NextPulseUpdate { }; bool m_Refresh { false }; bool m_Visible { false }; - int m_Timeouts[4] { 0 }; + int m_Timeouts[4] { -1,3000,5000,13000 }; bool m_UIScaleOverride { false }; float m_SavedWMult { 1.0F }; - float m_SavedHMult { 1.0F}; + float m_SavedHMult { 1.0F }; QRect m_SavedUIRect { }; int m_fontStretch { 100 }; int m_savedFontStretch { 100 }; @@ -223,7 +226,9 @@ class OsdNavigation : public MythScreenType Q_OBJECT public: - OsdNavigation(QObject *RetObject, const QString &Name, OSD *Osd); + OsdNavigation(QObject *RetObject, const QString &Name, OSD *Osd) + : MythScreenType((MythScreenType*)nullptr, Name), + m_retObject(RetObject), m_osd(Osd) {} bool Create(void) override; bool keyPressEvent(QKeyEvent *Event) override; void SetTextFromMap(const InfoMap &Map) override; diff --git a/mythtv/libs/libmythtv/playercontext.cpp b/mythtv/libs/libmythtv/playercontext.cpp index 44b6bb04c60..b64a9945c7b 100644 --- a/mythtv/libs/libmythtv/playercontext.cpp +++ b/mythtv/libs/libmythtv/playercontext.cpp @@ -1,4 +1,5 @@ #include <cmath> +#include <utility> #include <QPainter> @@ -26,8 +27,8 @@ const uint PlayerContext::kSMExitTimeout = 2000; const uint PlayerContext::kMaxChannelHistory = 30; -PlayerContext::PlayerContext(const QString &inUseID) : - m_recUsage(inUseID) +PlayerContext::PlayerContext(QString inUseID) : + m_recUsage(std::move(inUseID)) { m_lastSignalMsgTime.start(); m_lastSignalMsgTime.addMSecs(-2 * (int)kSMExitTimeout); diff --git a/mythtv/libs/libmythtv/playercontext.h b/mythtv/libs/libmythtv/playercontext.h index c0d1e59d429..5d72723cd3c 100644 --- a/mythtv/libs/libmythtv/playercontext.h +++ b/mythtv/libs/libmythtv/playercontext.h @@ -36,19 +36,19 @@ struct osdInfo QHash<QString,int> values; }; -typedef enum +enum PseudoState { kPseudoNormalLiveTV = 0, kPseudoChangeChannel = 1, kPseudoRecording = 2, -} PseudoState; +}; -typedef deque<QString> StringDeque; +using StringDeque = deque<QString>; class MTV_PUBLIC PlayerContext { public: - explicit PlayerContext(const QString &inUseID = QString("Unknown")); + explicit PlayerContext(QString inUseID = QString("Unknown")); ~PlayerContext(); // Actions diff --git a/mythtv/libs/libmythtv/playgroup.cpp b/mythtv/libs/libmythtv/playgroup.cpp index 6e8698c901d..4ea21322f1e 100644 --- a/mythtv/libs/libmythtv/playgroup.cpp +++ b/mythtv/libs/libmythtv/playgroup.cpp @@ -14,13 +14,13 @@ class PlayGroupDBStorage : public SimpleDBStorage PlayGroupDBStorage(StandardSetting *_setting, const PlayGroupConfig &_parent, const QString& _name) : - SimpleDBStorage(_setting, "playgroup", _name), parent(_parent) + SimpleDBStorage(_setting, "playgroup", _name), m_parent(_parent) { } QString GetWhereClause(MSqlBindings &bindings) const override; // SimpleDBStorage - const PlayGroupConfig &parent; + const PlayGroupConfig &m_parent; }; QString PlayGroupDBStorage::GetWhereClause(MSqlBindings &bindings) const @@ -28,7 +28,7 @@ QString PlayGroupDBStorage::GetWhereClause(MSqlBindings &bindings) const QString nameTag(":WHERENAME"); QString query("name = " + nameTag); - bindings.insert(nameTag, parent.getName()); + bindings.insert(nameTag, m_parent.getName()); return query; } @@ -277,8 +277,8 @@ PlayGroupEditor::PlayGroupEditor() void PlayGroupEditor::CreateNewPlayBackGroup() { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythTextInputDialog *settingdialog = - new MythTextInputDialog(popupStack, tr("Enter new group name")); + auto *settingdialog = new MythTextInputDialog(popupStack, + tr("Enter new group name")); if (settingdialog->Create()) { diff --git a/mythtv/libs/libmythtv/previewgenerator.cpp b/mythtv/libs/libmythtv/previewgenerator.cpp index 8faead874b2..45ea947a59a 100644 --- a/mythtv/libs/libmythtv/previewgenerator.cpp +++ b/mythtv/libs/libmythtv/previewgenerator.cpp @@ -1,5 +1,6 @@ // C headers #include <cmath> +#include <utility> // POSIX headers #include <sys/types.h> // for utime @@ -8,14 +9,14 @@ #include <utime.h> // for utime // Qt headers +#include <QApplication> #include <QCoreApplication> -#include <QTemporaryFile> +#include <QDir> #include <QFileInfo> -#include <QMetaType> #include <QImage> -#include <QDir> +#include <QMetaType> +#include <QTemporaryFile> #include <QUrl> -#include <QApplication> // MythTV headers #include "mythconfig.h" @@ -70,12 +71,12 @@ * in order to be processed. */ PreviewGenerator::PreviewGenerator(const ProgramInfo *pginfo, - const QString &token, + QString token, PreviewGenerator::Mode mode) : MThread("PreviewGenerator"), m_programInfo(*pginfo), m_mode(mode), m_pathname(pginfo->GetPathname()), - m_token(token) + m_token(std::move(token)) { // Qt requires that a receiver have the same thread affinity as the QThread // sending the event, which is used to dispatch MythEvents sent by @@ -257,7 +258,7 @@ bool PreviewGenerator::Run(void) cmdargs << "--outfile" << m_outFileName; // Timeout in 30s - MythSystemLegacy *ms = new MythSystemLegacy(command, cmdargs, + auto *ms = new MythSystemLegacy(command, cmdargs, kMSDontBlockInputDevs | kMSDontDisableDrawing | kMSProcessEvents | @@ -419,7 +420,7 @@ bool PreviewGenerator::event(QEvent *e) if (e->type() != MythEvent::MythEventMessage) return QObject::event(e); - MythEvent *me = dynamic_cast<MythEvent*>(e); + auto *me = dynamic_cast<MythEvent*>(e); if (me == nullptr) return false; if (me->Message() != "GENERATED_PIXMAP" || me->ExtraDataCount() < 3) @@ -685,10 +686,9 @@ bool PreviewGenerator::LocalPreviewRun(void) } width = height = sz = 0; - unsigned char *data = (unsigned char*) - GetScreenGrab(m_programInfo, m_pathname, - captime, m_timeInSeconds, - sz, width, height, aspect); + auto *data = (unsigned char*) GetScreenGrab(m_programInfo, m_pathname, + captime, m_timeInSeconds, + sz, width, height, aspect); QString outname = CreateAccessibleFilename(m_pathname, m_outFileName); @@ -834,7 +834,7 @@ char *PreviewGenerator::GetScreenGrab( return nullptr; } - PlayerContext *ctx = new PlayerContext(kPreviewGeneratorInUseID); + auto *ctx = new PlayerContext(kPreviewGeneratorInUseID); ctx->SetRingBuffer(rbuf); ctx->SetPlayingInfo(&pginfo); ctx->SetPlayer(new MythPlayer((PlayerFlags)(kAudioMuted | kVideoIsNull | kNoITV))); diff --git a/mythtv/libs/libmythtv/previewgenerator.h b/mythtv/libs/libmythtv/previewgenerator.h index 7558cb977f1..5a7ff577890 100644 --- a/mythtv/libs/libmythtv/previewgenerator.h +++ b/mythtv/libs/libmythtv/previewgenerator.h @@ -21,7 +21,7 @@ class MythSocket; class QObject; class QEvent; -typedef QMap<QString,QDateTime> FileTimeStampMap; +using FileTimeStampMap = QMap<QString,QDateTime>; class MTV_PUBLIC PreviewGenerator : public QObject, public MThread { @@ -36,7 +36,7 @@ class MTV_PUBLIC PreviewGenerator : public QObject, public MThread Q_OBJECT public: - typedef enum Mode + enum Mode { kNone = 0x0, kLocal = 0x1, @@ -44,11 +44,11 @@ class MTV_PUBLIC PreviewGenerator : public QObject, public MThread kLocalAndRemote = 0x3, kForceLocal = 0x5, kModeMask = 0x7, - } Mode; + }; public: PreviewGenerator(const ProgramInfo *pginfo, - const QString &token, + QString token, Mode mode = kLocal); void SetPreviewTime(long long time, bool in_seconds) diff --git a/mythtv/libs/libmythtv/previewgeneratorqueue.cpp b/mythtv/libs/libmythtv/previewgeneratorqueue.cpp index 508612879d3..5f560563655 100644 --- a/mythtv/libs/libmythtv/previewgeneratorqueue.cpp +++ b/mythtv/libs/libmythtv/previewgeneratorqueue.cpp @@ -168,7 +168,7 @@ void PreviewGeneratorQueue::GetPreviewImage( extra += outputfile; extra += QString::number(time); extra += (in_seconds ? "1" : "0"); - MythEvent *e = new MythEvent("GET_PREVIEW", extra); + auto *e = new MythEvent("GET_PREVIEW", extra); QCoreApplication::postEvent(s_pgq, e); } @@ -225,7 +225,7 @@ bool PreviewGeneratorQueue::event(QEvent *e) if (e->type() != MythEvent::MythEventMessage) return QObject::event(e); - MythEvent *me = dynamic_cast<MythEvent*>(e); + auto *me = dynamic_cast<MythEvent*>(e); if (me == nullptr) return false; if (me->Message() == "GET_PREVIEW") @@ -318,7 +318,7 @@ bool PreviewGeneratorQueue::event(QEvent *e) QSet<QObject*>::iterator sit = m_listeners.begin(); for (; sit != m_listeners.end(); ++sit) { - MythEvent *le = new MythEvent(me->Message(), list); + auto *le = new MythEvent(me->Message(), list); QCoreApplication::postEvent(*sit, le); } (*it).m_tokens.clear(); @@ -372,7 +372,7 @@ void PreviewGeneratorQueue::SendEvent( QSet<QObject*>::iterator it = m_listeners.begin(); for (; it != m_listeners.end(); ++it) { - MythEvent *e = new MythEvent(eventname, list); + auto *e = new MythEvent(eventname, list); QCoreApplication::postEvent(*it, e); } } @@ -535,7 +535,7 @@ QString PreviewGeneratorQueue::GeneratePreviewImage( { LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Requesting preview for '%1'") .arg(key)); - PreviewGenerator *pg = new PreviewGenerator(&pginfo, token, m_mode); + auto *pg = new PreviewGenerator(&pginfo, token, m_mode); if (!outputfile.isEmpty() || time >= 0 || size.width() || size.height()) { diff --git a/mythtv/libs/libmythtv/previewgeneratorqueue.h b/mythtv/libs/libmythtv/previewgeneratorqueue.h index d83582ddcbd..5388a8ea55c 100644 --- a/mythtv/libs/libmythtv/previewgeneratorqueue.h +++ b/mythtv/libs/libmythtv/previewgeneratorqueue.h @@ -46,7 +46,7 @@ class PreviewGenState /// this preview. QSet<QString> m_tokens; }; -typedef QMap<QString,PreviewGenState> PreviewMap; +using PreviewMap = QMap<QString,PreviewGenState>; /** * This class implements a queue of preview generation requests. It diff --git a/mythtv/libs/libmythtv/profilegroup.cpp b/mythtv/libs/libmythtv/profilegroup.cpp index f7f9e509f4e..fcfc2f27b2e 100644 --- a/mythtv/libs/libmythtv/profilegroup.cpp +++ b/mythtv/libs/libmythtv/profilegroup.cpp @@ -46,7 +46,7 @@ ProfileGroup::ProfileGroup() setLabel(tr("Profile Group")); addChild(m_name = new Name(*this)); - CardInfo *cardInfo = new CardInfo(*this); + auto *cardInfo = new CardInfo(*this); addChild(cardInfo); CardType::fillSelections(cardInfo); m_host = new HostName(*this); @@ -164,7 +164,7 @@ void ProfileGroup::fillSelections(GroupSetting* setting) } else { - ProfileGroup *profileGroup = new ProfileGroup(); + auto *profileGroup = new ProfileGroup(); profileGroup->loadByID(id.toInt()); profileGroup->setLabel(name); profileGroup->addChild( diff --git a/mythtv/libs/libmythtv/programdata.cpp b/mythtv/libs/libmythtv/programdata.cpp index 281697799bc..fb1ad56c238 100644 --- a/mythtv/libs/libmythtv/programdata.cpp +++ b/mythtv/libs/libmythtv/programdata.cpp @@ -3,6 +3,8 @@ // C++ includes #include <algorithm> #include <climits> +#include <utility> + using namespace std; // Qt includes @@ -63,14 +65,14 @@ DBPerson::DBPerson(const DBPerson &other) : m_name.squeeze(); } -DBPerson::DBPerson(Role role, const QString &name) : - m_role(role), m_name(name) +DBPerson::DBPerson(Role role, QString name) : + m_role(role), m_name(std::move(name)) { m_name.squeeze(); } -DBPerson::DBPerson(const QString &role, const QString &name) : - m_role(kUnknown), m_name(name) +DBPerson::DBPerson(const QString &role, QString name) : + m_role(kUnknown), m_name(std::move(name)) { if (!role.isEmpty()) { diff --git a/mythtv/libs/libmythtv/programdata.h b/mythtv/libs/libmythtv/programdata.h index 2929f167e70..e24695733f1 100644 --- a/mythtv/libs/libmythtv/programdata.h +++ b/mythtv/libs/libmythtv/programdata.h @@ -24,7 +24,7 @@ class MSqlQuery; class MTV_PUBLIC DBPerson { public: - typedef enum + enum Role { kUnknown = 0, kActor, @@ -38,11 +38,11 @@ class MTV_PUBLIC DBPerson kPresenter, kCommentator, kGuest, - } Role; + }; DBPerson(const DBPerson&); - DBPerson(Role _role, const QString &_name); - DBPerson(const QString &_role, const QString &_name); + DBPerson(Role _role, QString _name); + DBPerson(const QString &_role, QString _name); QString GetRole(void) const; @@ -59,7 +59,7 @@ class MTV_PUBLIC DBPerson Role m_role; QString m_name; }; -typedef vector<DBPerson> DBCredits; +using DBCredits = vector<DBPerson>; class MTV_PUBLIC EventRating { diff --git a/mythtv/libs/libmythtv/recorders/ExternalRecChannelFetcher.cpp b/mythtv/libs/libmythtv/recorders/ExternalRecChannelFetcher.cpp index e66cb3d9ebc..a2b2427c369 100644 --- a/mythtv/libs/libmythtv/recorders/ExternalRecChannelFetcher.cpp +++ b/mythtv/libs/libmythtv/recorders/ExternalRecChannelFetcher.cpp @@ -18,6 +18,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +// C/C++ includes +#include <utility> + // Qt includes #include <QString> @@ -28,9 +31,9 @@ #define LOC QString("ExternalRec[%1](%2): ").arg(m_cardid).arg(m_command) ExternalRecChannelFetcher::ExternalRecChannelFetcher(int cardid, - const QString & cmd) + QString cmd) : m_cardid(cardid) - , m_command(cmd) + , m_command(std::move(cmd)) { m_stream_handler = ExternalStreamHandler::Get(m_command, m_cardid, m_cardid); } diff --git a/mythtv/libs/libmythtv/recorders/ExternalRecChannelFetcher.h b/mythtv/libs/libmythtv/recorders/ExternalRecChannelFetcher.h index adad738e9c4..f4619924e1c 100644 --- a/mythtv/libs/libmythtv/recorders/ExternalRecChannelFetcher.h +++ b/mythtv/libs/libmythtv/recorders/ExternalRecChannelFetcher.h @@ -26,7 +26,7 @@ class ExternalStreamHandler; class ExternalRecChannelFetcher { public: - ExternalRecChannelFetcher(int cardid, const QString & cmd); + ExternalRecChannelFetcher(int cardid, QString cmd); ~ExternalRecChannelFetcher(void); bool Valid(void) const; diff --git a/mythtv/libs/libmythtv/recorders/ExternalSignalMonitor.h b/mythtv/libs/libmythtv/recorders/ExternalSignalMonitor.h index da42c38c151..fa5b3204b11 100644 --- a/mythtv/libs/libmythtv/recorders/ExternalSignalMonitor.h +++ b/mythtv/libs/libmythtv/recorders/ExternalSignalMonitor.h @@ -10,7 +10,7 @@ class ExternalStreamHandler; -typedef QMap<uint,int> FilterMap; +using FilterMap = QMap<uint,int>; class ExternalSignalMonitor: public DTVSignalMonitor { diff --git a/mythtv/libs/libmythtv/recorders/ExternalStreamHandler.cpp b/mythtv/libs/libmythtv/recorders/ExternalStreamHandler.cpp index dd1228918e8..a6b8ac8b11e 100644 --- a/mythtv/libs/libmythtv/recorders/ExternalStreamHandler.cpp +++ b/mythtv/libs/libmythtv/recorders/ExternalStreamHandler.cpp @@ -465,8 +465,7 @@ ExternalStreamHandler *ExternalStreamHandler::Get(const QString &devname, if (it == s_handlers.end()) { - ExternalStreamHandler *newhandler = - new ExternalStreamHandler(devname, inputid, majorid); + auto *newhandler = new ExternalStreamHandler(devname, inputid, majorid); s_handlers[majorid] = newhandler; s_handlers_refcnt[majorid] = 1; diff --git a/mythtv/libs/libmythtv/recorders/ExternalStreamHandler.h b/mythtv/libs/libmythtv/recorders/ExternalStreamHandler.h index 4dcf1f8f3b5..3529100015a 100644 --- a/mythtv/libs/libmythtv/recorders/ExternalStreamHandler.h +++ b/mythtv/libs/libmythtv/recorders/ExternalStreamHandler.h @@ -34,7 +34,7 @@ class ExternIO QString ErrorString(void) const { return m_error; } void ClearError(void) { m_error.clear(); } - bool KillIfRunning(const QString & cmd); + static bool KillIfRunning(const QString & cmd); private: void Fork(void); diff --git a/mythtv/libs/libmythtv/recorders/HLS/HLSPlaylistWorker.cpp b/mythtv/libs/libmythtv/recorders/HLS/HLSPlaylistWorker.cpp index 962db6353f3..a4803e76f0b 100644 --- a/mythtv/libs/libmythtv/recorders/HLS/HLSPlaylistWorker.cpp +++ b/mythtv/libs/libmythtv/recorders/HLS/HLSPlaylistWorker.cpp @@ -37,7 +37,7 @@ void HLSPlaylistWorker::run(void) RunProlog(); - MythSingleDownload *downloader = new MythSingleDownload; + auto *downloader = new MythSingleDownload; while (!m_cancel) { diff --git a/mythtv/libs/libmythtv/recorders/HLS/HLSReader.cpp b/mythtv/libs/libmythtv/recorders/HLS/HLSReader.cpp index 8ffd2ded4b0..e27c38661e4 100644 --- a/mythtv/libs/libmythtv/recorders/HLS/HLSReader.cpp +++ b/mythtv/libs/libmythtv/recorders/HLS/HLSReader.cpp @@ -359,9 +359,8 @@ bool HLSReader::ParseM3U8(const QByteArray& buffer, HLSRecStream* stream) if (!M3U::ParseStreamInformation(line, url, StreamURL(), id, bandwidth)) break; - HLSRecStream *hls = - new HLSRecStream(id, bandwidth, url, m_segment_base); - + auto *hls = new HLSRecStream(id, bandwidth, url, + m_segment_base); if (hls) { LOG(VB_RECORD, LOG_INFO, LOC + diff --git a/mythtv/libs/libmythtv/recorders/HLS/HLSReader.h b/mythtv/libs/libmythtv/recorders/HLS/HLSReader.h index 5a7fb4b1fb7..db52110d0c2 100644 --- a/mythtv/libs/libmythtv/recorders/HLS/HLSReader.h +++ b/mythtv/libs/libmythtv/recorders/HLS/HLSReader.h @@ -37,8 +37,8 @@ class MTV_PUBLIC HLSReader friend class HLSPlaylistWorker; public: - typedef QMap<QString, HLSRecStream* > StreamContainer; - typedef QList<HLSRecSegment> SegmentContainer; + using StreamContainer = QMap<QString, HLSRecStream* >; + using SegmentContainer = QList<HLSRecSegment>; HLSReader(void) = default; ~HLSReader(void); diff --git a/mythtv/libs/libmythtv/recorders/HLS/HLSSegment.cpp b/mythtv/libs/libmythtv/recorders/HLS/HLSSegment.cpp index df474c684e7..963ca0c1671 100644 --- a/mythtv/libs/libmythtv/recorders/HLS/HLSSegment.cpp +++ b/mythtv/libs/libmythtv/recorders/HLS/HLSSegment.cpp @@ -1,4 +1,8 @@ #include "HLSSegment.h" + +// C/C++ +#include <utility> + #include "HLSReader.h" #define LOC QString("HLSSegment: ") @@ -15,21 +19,21 @@ HLSRecSegment::HLSRecSegment(const HLSRecSegment& rhs) } HLSRecSegment::HLSRecSegment(int seq, int duration, - const QString& title, const QUrl& uri) + QString title, QUrl uri) : m_sequence(seq), m_duration(duration), - m_title(title), - m_url(uri) + m_title(std::move(title)), + m_url(std::move(uri)) { LOG(VB_RECORD, LOG_DEBUG, LOC + "ctor"); } -HLSRecSegment::HLSRecSegment(int seq, int duration, const QString& title, - const QUrl& uri, const QString& current_key_path) +HLSRecSegment::HLSRecSegment(int seq, int duration, QString title, + QUrl uri, const QString& current_key_path) : m_sequence(seq), m_duration(duration), - m_title(title), - m_url(uri) + m_title(std::move(title)), + m_url(std::move(uri)) { LOG(VB_RECORD, LOG_DEBUG, LOC + "ctor"); #ifdef USING_LIBCRYPTO diff --git a/mythtv/libs/libmythtv/recorders/HLS/HLSSegment.h b/mythtv/libs/libmythtv/recorders/HLS/HLSSegment.h index 2e7f0a96541..9435b55abc4 100644 --- a/mythtv/libs/libmythtv/recorders/HLS/HLSSegment.h +++ b/mythtv/libs/libmythtv/recorders/HLS/HLSSegment.h @@ -13,10 +13,10 @@ class HLSRecSegment HLSRecSegment(void); HLSRecSegment(const HLSRecSegment& rhs); - HLSRecSegment(int seq, int duration, const QString& title, - const QUrl& uri); - HLSRecSegment(int seq, int duration, const QString& title, - const QUrl& uri, const QString& current_key_path); + HLSRecSegment(int seq, int duration, QString title, + QUrl uri); + HLSRecSegment(int seq, int duration, QString title, + QUrl uri, const QString& current_key_path); ~HLSRecSegment(); HLSRecSegment& operator=(const HLSRecSegment& rhs); diff --git a/mythtv/libs/libmythtv/recorders/HLS/HLSStream.cpp b/mythtv/libs/libmythtv/recorders/HLS/HLSStream.cpp index 6db8f536764..15bfffb7e13 100644 --- a/mythtv/libs/libmythtv/recorders/HLS/HLSStream.cpp +++ b/mythtv/libs/libmythtv/recorders/HLS/HLSStream.cpp @@ -1,5 +1,7 @@ #include <unistd.h> +#include <utility> + #include "mythlogging.h" #include "HLSReader.h" @@ -7,11 +9,11 @@ #define LOC QString("%1 stream: ").arg(m_m3u8_url) -HLSRecStream::HLSRecStream(int seq, uint64_t bitrate, const QString& m3u8_url, const QString &segment_base_url) +HLSRecStream::HLSRecStream(int seq, uint64_t bitrate, QString m3u8_url, QString segment_base_url) : m_id(seq), m_bitrate(bitrate), - m_m3u8_url(m3u8_url), - m_segment_base_url(segment_base_url) + m_m3u8_url(std::move(m3u8_url)), + m_segment_base_url(std::move(segment_base_url)) { LOG(VB_RECORD, LOG_DEBUG, LOC + "ctor"); } @@ -73,7 +75,7 @@ bool HLSRecStream::DecodeData(MythSingleDownload& downloader, if ((Ikey = m_aeskeys.find(keypath)) == m_aeskeys.end()) { - AES_KEY* key = new AES_KEY; + auto* key = new AES_KEY; DownloadKey(downloader, keypath, key); Ikey = m_aeskeys.insert(keypath, key); if (Ikey == m_aeskeys.end()) diff --git a/mythtv/libs/libmythtv/recorders/HLS/HLSStream.h b/mythtv/libs/libmythtv/recorders/HLS/HLSStream.h index 868f4987e91..92612458fdb 100644 --- a/mythtv/libs/libmythtv/recorders/HLS/HLSStream.h +++ b/mythtv/libs/libmythtv/recorders/HLS/HLSStream.h @@ -19,10 +19,10 @@ class HLSRecStream public: #ifdef USING_LIBCRYPTO - typedef QMap<QString, AES_KEY* > AESKeyMap; + using AESKeyMap = QMap<QString, AES_KEY* >; #endif - HLSRecStream(int seq, uint64_t bitrate, const QString& m3u8_url, const QString &segment_base_url); + HLSRecStream(int seq, uint64_t bitrate, QString m3u8_url, QString segment_base_url); ~HLSRecStream(void); int Read(uint8_t* buffer, int len); diff --git a/mythtv/libs/libmythtv/recorders/NuppelVideoRecorder.cpp b/mythtv/libs/libmythtv/recorders/NuppelVideoRecorder.cpp index f207ace5030..80bfb41dc21 100644 --- a/mythtv/libs/libmythtv/recorders/NuppelVideoRecorder.cpp +++ b/mythtv/libs/libmythtv/recorders/NuppelVideoRecorder.cpp @@ -361,7 +361,7 @@ bool NuppelVideoRecorder::IsPaused(bool holding_lock) const return ret; } -void NuppelVideoRecorder::SetVideoFilters(QString&) +void NuppelVideoRecorder::SetVideoFilters(QString& /*filters*/) { } @@ -781,7 +781,7 @@ void NuppelVideoRecorder::InitBuffers(void) for (int i = 0; i < m_video_buffer_count; i++) { - vidbuffertype *vidbuf = new vidbuffertype; + auto *vidbuf = new vidbuffertype; vidbuf->buffer = new unsigned char[m_video_buffer_size]; vidbuf->sample = 0; vidbuf->freeToEncode = 0; @@ -794,7 +794,7 @@ void NuppelVideoRecorder::InitBuffers(void) for (int i = 0; i < m_audio_buffer_count; i++) { - audbuffertype *audbuf = new audbuffertype; + auto *audbuf = new audbuffertype; audbuf->buffer = new unsigned char[m_audio_buffer_size]; audbuf->sample = 0; audbuf->freeToEncode = 0; @@ -805,7 +805,7 @@ void NuppelVideoRecorder::InitBuffers(void) for (int i = 0; i < m_text_buffer_count; i++) { - txtbuffertype *txtbuf = new txtbuffertype; + auto *txtbuf = new txtbuffertype; txtbuf->buffer = new unsigned char[m_text_buffer_size]; txtbuf->freeToEncode = 0; txtbuf->freeToBuffer = 1; @@ -1884,11 +1884,11 @@ void NuppelVideoRecorder::SetNewVideoParams(double newaspect) void NuppelVideoRecorder::WriteFileHeader(void) { struct rtfileheader fileheader {}; - static const char finfo[12] = "MythTVVideo"; - static const char vers[5] = "0.07"; + static constexpr char kFinfo[12] = "MythTVVideo"; + static constexpr char kVers[5] = "0.07"; - memcpy(fileheader.finfo, finfo, sizeof(fileheader.finfo)); - memcpy(fileheader.version, vers, sizeof(fileheader.version)); + memcpy(fileheader.finfo, kFinfo, sizeof(fileheader.finfo)); + memcpy(fileheader.version, kVers, sizeof(fileheader.version)); fileheader.width = m_w_out; fileheader.height = (int)(m_h_out * m_height_multiplier); fileheader.desiredwidth = 0; @@ -1935,16 +1935,16 @@ void NuppelVideoRecorder::WriteHeader(void) } else { - static unsigned long int tbls[128]; + static unsigned long int s_tbls[128]; frameheader.comptype = 'R'; // compressor data for RTjpeg - frameheader.packetlength = sizeof(tbls); + frameheader.packetlength = sizeof(s_tbls); // compression configuration header WriteFrameheader(&frameheader); - memset(tbls, 0, sizeof(tbls)); - m_ringBuffer->Write(tbls, sizeof(tbls)); + memset(s_tbls, 0, sizeof(s_tbls)); + m_ringBuffer->Write(s_tbls, sizeof(s_tbls)); } memset(&frameheader, 0, sizeof(frameheader)); @@ -2048,7 +2048,7 @@ void NuppelVideoRecorder::WriteSeekTable(void) char *seekbuf = new char[frameheader.packetlength]; int offset = 0; - vector<struct seektable_entry>::iterator it = m_seektable->begin(); + auto it = m_seektable->begin(); for (; it != m_seektable->end(); ++it) { memcpy(seekbuf + offset, (const void *)&(*it), @@ -2085,8 +2085,8 @@ void NuppelVideoRecorder::WriteKeyFrameAdjustTable( char *kfa_buf = new char[frameheader.packetlength]; uint offset = 0; - vector<struct kfatable_entry>::const_iterator it = kfa_table.begin(); - for (; it != kfa_table.end() ; ++it) + auto it = kfa_table.cbegin(); + for (; it != kfa_table.cend() ; ++it) { memcpy(kfa_buf + offset, &(*it), sizeof(struct kfatable_entry)); @@ -2217,7 +2217,7 @@ void NuppelVideoRecorder::doAudioThread(void) } struct timeval anow {}; - unsigned char *buffer = new unsigned char[m_audio_buffer_size]; + auto *buffer = new unsigned char[m_audio_buffer_size]; int act = 0, lastread = 0; m_audio_bytes_per_sample = m_audio_channels * m_audio_bits / 8; @@ -2935,10 +2935,10 @@ void NuppelVideoRecorder::WriteAudio(unsigned char *buf, int fnum, int timecode) // of recording and the first timestamp, maybe we // can calculate the audio-video +-lack at the // beginning too - double abytes = (double)m_audiobytes; // - (double)m_audio_buffer_size; + auto abytes = (double)m_audiobytes; // - (double)m_audio_buffer_size; // wrong guess ;-) // need seconds instead of msec's - double mt = (double)timecode; + auto mt = (double)timecode; if (mt > 0.0) { double eff = (abytes / mt) * (100000.0 / m_audio_bytes_per_sample); @@ -3045,14 +3045,14 @@ void NuppelVideoRecorder::WriteText(unsigned char *buf, int len, int timecode, frameheader.packetlength = len + 4; WriteFrameheader(&frameheader); union page_t { - int32_t val32; - struct { int8_t a,b,c,d; } val8; + int32_t m_val32; + struct { int8_t m_a,m_b,m_c,m_d; } m_val8; } v {}; - v.val32 = pagenr; - m_ringBuffer->Write(&v.val8.d, sizeof(int8_t)); - m_ringBuffer->Write(&v.val8.c, sizeof(int8_t)); - m_ringBuffer->Write(&v.val8.b, sizeof(int8_t)); - m_ringBuffer->Write(&v.val8.a, sizeof(int8_t)); + v.m_val32 = pagenr; + m_ringBuffer->Write(&v.m_val8.m_d, sizeof(int8_t)); + m_ringBuffer->Write(&v.m_val8.m_c, sizeof(int8_t)); + m_ringBuffer->Write(&v.m_val8.m_b, sizeof(int8_t)); + m_ringBuffer->Write(&v.m_val8.m_a, sizeof(int8_t)); m_ringBuffer->Write(buf, len); } else if (VBIMode::NTSC_CC == m_vbimode) diff --git a/mythtv/libs/libmythtv/recorders/RTjpegN.cpp b/mythtv/libs/libmythtv/recorders/RTjpegN.cpp index e0c6484160c..cb5ab0d9967 100644 --- a/mythtv/libs/libmythtv/recorders/RTjpegN.cpp +++ b/mythtv/libs/libmythtv/recorders/RTjpegN.cpp @@ -114,7 +114,7 @@ int RTjpeg::b2s(const int16_t *data, int8_t *strm, uint8_t /*bt8*/) unsigned char bitten; unsigned char bitoff; - uint8_t *ustrm = (uint8_t *)strm; + auto *ustrm = (uint8_t *)strm; #ifdef SHOWBLOCK int ii; @@ -280,7 +280,7 @@ fprintf(stdout, "\n\n"); int RTjpeg::s2b(int16_t *data, const int8_t *strm, uint8_t /*bt8*/, int32_t *qtbla) { - uint32_t *qtbl = (uint32_t *)qtbla; + auto *qtbl = (uint32_t *)qtbla; int ci; int co; int i; @@ -518,17 +518,17 @@ int RTjpeg::s2b(int16_t *data, const int8_t *strm, uint8_t bt8, uint32_t *qtbla) void RTjpeg::QuantInit(void) { int i; - typedef union { int16_t *int16; int32_t *int32; } P16_32; + using P16_32 = union { int16_t *m_int16; int32_t *m_int32; }; P16_32 qtbl; - qtbl.int32 = lqt; + qtbl.m_int32 = lqt; for (i = 0; i < 64; i++) - qtbl.int16[i] = static_cast<int16_t>(lqt[i]); + qtbl.m_int16[i] = static_cast<int16_t>(lqt[i]); // cppcheck-suppress unreadVariable - qtbl.int32 = cqt; + qtbl.m_int32 = cqt; for (i = 0; i < 64; i++) - qtbl.int16[i] = static_cast<int16_t>(cqt[i]); + qtbl.m_int16[i] = static_cast<int16_t>(cqt[i]); } void RTjpeg::Quant(int16_t *_block, int32_t *qtbl) @@ -710,8 +710,8 @@ void RTjpeg::DctY(uint8_t *idata, int rskip) } #else volatile mmx_t tmp6, tmp7; - mmx_t *dataptr = (mmx_t *)block; - mmx_t *idata2 = (mmx_t *)idata; + auto *dataptr = (mmx_t *)block; + auto *idata2 = (mmx_t *)idata; // first copy the input 8 bit to the destination 16 bits @@ -1540,15 +1540,15 @@ void RTjpeg::Idct(uint8_t *odata, int16_t *data, int rskip) { #ifdef MMX -static mmx_t fix_141; fix_141.q = 0x5a825a825a825a82LL; -static mmx_t fix_184n261; fix_184n261.q = 0xcf04cf04cf04cf04LL; -static mmx_t fix_184; fix_184.q = 0x7641764176417641LL; -static mmx_t fix_n184; fix_n184.q = 0x896f896f896f896fLL; -static mmx_t fix_108n184; fix_108n184.q = 0xcf04cf04cf04cf04LL; +static mmx_t s_fix141; s_fix141.q = 0x5a825a825a825a82LL; +static mmx_t s_fix184n261; s_fix184n261.q = 0xcf04cf04cf04cf04LL; +static mmx_t s_fix184; s_fix184.q = 0x7641764176417641LL; +static mmx_t s_fixN184; s_fixN184.q = 0x896f896f896f896fLL; +static mmx_t s_fix108n184; s_fix108n184.q = 0xcf04cf04cf04cf04LL; - mmx_t *wsptr = (mmx_t *)ws; - mmx_t *dataptr = (mmx_t *)odata; - mmx_t *idata = (mmx_t *)data; + auto *wsptr = (mmx_t *)ws; + auto *dataptr = (mmx_t *)odata; + auto *idata = (mmx_t *)data; rskip = rskip>>3; /* @@ -1574,10 +1574,10 @@ static mmx_t fix_108n184; fix_108n184.q = 0xcf04cf04cf04cf04LL; psllw_i2r(2, mm2); // shift z10 movq_r2r(mm2, mm0); // copy z10 - pmulhw_m2r(fix_184n261, mm2); // MULTIPLY( z12, FIX_1_847759065); /* 2*c2 */ + pmulhw_m2r(s_fix184n261, mm2); // MULTIPLY( z12, FIX_1_847759065); /* 2*c2 */ movq_r2r(mm3, mm5); // copy tmp4 - pmulhw_m2r(fix_n184, mm0); // MULTIPLY(z10, -FIX_1_847759065); /* 2*c2 */ + pmulhw_m2r(s_fixN184, mm0); // MULTIPLY(z10, -FIX_1_847759065); /* 2*c2 */ paddw_r2r(mm4, mm3); // z11 = tmp4 + tmp7; movq_r2r(mm3, mm6); // copy z11 /* phase 5 */ @@ -1589,13 +1589,13 @@ static mmx_t fix_108n184; fix_108n184.q = 0xcf04cf04cf04cf04LL; movq_m2r(*(idata+12), mm4); // load idata[DCTSIZE*6], even part movq_r2r(mm5, mm7); // copy z12 - pmulhw_m2r(fix_108n184, mm5); // MULT(z12, (FIX_1_08-FIX_1_84)) //- z5; /* 2*(c2-c6) */ even part + pmulhw_m2r(s_fix108n184, mm5); // MULT(z12, (FIX_1_08-FIX_1_84)) //- z5; /* 2*(c2-c6) */ even part paddw_r2r(mm1, mm3); // tmp7 = z11 + z13; //ok /* Even part */ - pmulhw_m2r(fix_184, mm7); // MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) //+ z5; /* -2*(c2+c6) */ + pmulhw_m2r(s_fix184, mm7); // MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) //+ z5; /* -2*(c2+c6) */ psllw_i2r(2, mm6); movq_m2r(*(idata+4), mm1); // load idata[DCTSIZE*2] @@ -1604,7 +1604,7 @@ static mmx_t fix_108n184; fix_108n184.q = 0xcf04cf04cf04cf04LL; paddw_r2r(mm7, mm2); // tmp12 - pmulhw_m2r(fix_141, mm6); // tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */ + pmulhw_m2r(s_fix141, mm6); // tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */ psubw_r2r(mm3, mm2); // tmp6 = tmp12 - tmp7 movq_r2r(mm1, mm5); // copy tmp1 @@ -1618,7 +1618,7 @@ static mmx_t fix_108n184; fix_108n184.q = 0xcf04cf04cf04cf04LL; movq_m2r(*(idata), mm7); // load idata[DCTSIZE*0] - pmulhw_m2r(fix_141, mm5); // MULTIPLY(tmp1 - tmp3, FIX_1_414213562) + pmulhw_m2r(s_fix141, mm5); // MULTIPLY(tmp1 - tmp3, FIX_1_414213562) paddw_r2r(mm6, mm0); // tmp4 = tmp10 + tmp5; movq_m2r(*(idata+8), mm4); // load idata[DCTSIZE*4] @@ -1701,10 +1701,10 @@ static mmx_t fix_108n184; fix_108n184.q = 0xcf04cf04cf04cf04LL; psllw_i2r(2, mm2); // shift z10 movq_r2r(mm2, mm0); // copy z10 - pmulhw_m2r(fix_184n261, mm2); // MULTIPLY( z12, FIX_1_847759065); /* 2*c2 */ + pmulhw_m2r(s_fix184n261, mm2); // MULTIPLY( z12, FIX_1_847759065); /* 2*c2 */ movq_r2r(mm3, mm5); // copy tmp4 - pmulhw_m2r(fix_n184, mm0); // MULTIPLY(z10, -FIX_1_847759065); /* 2*c2 */ + pmulhw_m2r(s_fixN184, mm0); // MULTIPLY(z10, -FIX_1_847759065); /* 2*c2 */ paddw_r2r(mm4, mm3); // z11 = tmp4 + tmp7; movq_r2r(mm3, mm6); // copy z11 /* phase 5 */ @@ -1716,13 +1716,13 @@ static mmx_t fix_108n184; fix_108n184.q = 0xcf04cf04cf04cf04LL; movq_m2r(*(idata+12), mm4); // load idata[DCTSIZE*6], even part movq_r2r(mm5, mm7); // copy z12 - pmulhw_m2r(fix_108n184, mm5); // MULT(z12, (FIX_1_08-FIX_1_84)) //- z5; /* 2*(c2-c6) */ even part + pmulhw_m2r(s_fix108n184, mm5); // MULT(z12, (FIX_1_08-FIX_1_84)) //- z5; /* 2*(c2-c6) */ even part paddw_r2r(mm1, mm3); // tmp7 = z11 + z13; //ok /* Even part */ - pmulhw_m2r(fix_184, mm7); // MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) //+ z5; /* -2*(c2+c6) */ + pmulhw_m2r(s_fix184, mm7); // MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) //+ z5; /* -2*(c2+c6) */ psllw_i2r(2, mm6); movq_m2r(*(idata+4), mm1); // load idata[DCTSIZE*2] @@ -1731,7 +1731,7 @@ static mmx_t fix_108n184; fix_108n184.q = 0xcf04cf04cf04cf04LL; paddw_r2r(mm7, mm2); // tmp12 - pmulhw_m2r(fix_141, mm6); // tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */ + pmulhw_m2r(s_fix141, mm6); // tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */ psubw_r2r(mm3, mm2); // tmp6 = tmp12 - tmp7 movq_r2r(mm1, mm5); // copy tmp1 @@ -1746,7 +1746,7 @@ static mmx_t fix_108n184; fix_108n184.q = 0xcf04cf04cf04cf04LL; movq_m2r(*(idata), mm7); // load idata[DCTSIZE*0] paddw_r2r(mm6, mm0); // tmp4 = tmp10 + tmp5; - pmulhw_m2r(fix_141, mm5); // MULTIPLY(tmp1 - tmp3, FIX_1_414213562) + pmulhw_m2r(s_fix141, mm5); // MULTIPLY(tmp1 - tmp3, FIX_1_414213562) movq_m2r(*(idata+8), mm4); // load idata[DCTSIZE*4] @@ -1888,7 +1888,7 @@ static mmx_t fix_108n184; fix_108n184.q = 0xcf04cf04cf04cf04LL; punpckldq_r2r(mm4, mm1); // wsptr[0,tmp11],[1,tmp11],[2,tmp11],[3,tmp11] psllw_i2r(2, mm6); - pmulhw_m2r(fix_141, mm6); + pmulhw_m2r(s_fix141, mm6); punpckldq_r2r(mm3, mm0); // wsptr[0,tmp10],[1,tmp10],[2,tmp10],[3,tmp10] punpckhdq_r2r(mm3, mm2); // wsptr[0,tmp13],[1,tmp13],[2,tmp13],[3,tmp13] @@ -2021,26 +2021,26 @@ static mmx_t fix_108n184; fix_108n184.q = 0xcf04cf04cf04cf04LL; psllw_i2r(2, mm0); - pmulhw_m2r(fix_141, mm1); // tmp21 + pmulhw_m2r(s_fix141, mm1); // tmp21 // tmp20 = MULTIPLY(z12, (FIX_1_082392200- FIX_1_847759065)) /* 2*(c2-c6) */ // + MULTIPLY(z10, - FIX_1_847759065); /* 2*c2 */ psllw_i2r(2, mm3); movq_r2r(mm0, mm7); - pmulhw_m2r(fix_n184, mm7); + pmulhw_m2r(s_fixN184, mm7); movq_r2r(mm3, mm6); movq_m2r(*(wsptr), mm2); // tmp0,final1 - pmulhw_m2r(fix_108n184, mm6); + pmulhw_m2r(s_fix108n184, mm6); // tmp22 = MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) /* -2*(c2+c6) */ // + MULTIPLY(z12, FIX_1_847759065); /* 2*c2 */ movq_r2r(mm2, mm4); // final1 - pmulhw_m2r(fix_184n261, mm0); + pmulhw_m2r(s_fix184n261, mm0); paddw_r2r(mm5, mm2); // tmp0+tmp7,final1 - pmulhw_m2r(fix_184, mm3); + pmulhw_m2r(s_fix184, mm3); psubw_r2r(mm5, mm4); // tmp0-tmp7,final1 // tmp6 = tmp22 - tmp7; /* phase 2 */ @@ -2248,7 +2248,7 @@ static mmx_t fix_108n184; fix_108n184.q = 0xcf04cf04cf04cf04LL; punpckldq_r2r(mm4, mm1); // wsptr[0,tmp11],[1,tmp11],[2,tmp11],[3,tmp11] psllw_i2r(2, mm6); - pmulhw_m2r(fix_141, mm6); + pmulhw_m2r(s_fix141, mm6); punpckldq_r2r(mm3, mm0); // wsptr[0,tmp10],[1,tmp10],[2,tmp10],[3,tmp10] punpckhdq_r2r(mm3, mm2); // wsptr[0,tmp13],[1,tmp13],[2,tmp13],[3,tmp13] @@ -2382,26 +2382,26 @@ static mmx_t fix_108n184; fix_108n184.q = 0xcf04cf04cf04cf04LL; psllw_i2r(2, mm0); - pmulhw_m2r(fix_141, mm1); // tmp21 + pmulhw_m2r(s_fix141, mm1); // tmp21 // tmp20 = MULTIPLY(z12, (FIX_1_082392200- FIX_1_847759065)) /* 2*(c2-c6) */ // + MULTIPLY(z10, - FIX_1_847759065); /* 2*c2 */ psllw_i2r(2, mm3); movq_r2r(mm0, mm7); - pmulhw_m2r(fix_n184, mm7); + pmulhw_m2r(s_fixN184, mm7); movq_r2r(mm3, mm6); movq_m2r(*(wsptr), mm2); // tmp0,final1 - pmulhw_m2r(fix_108n184, mm6); + pmulhw_m2r(s_fix108n184, mm6); // tmp22 = MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) /* -2*(c2+c6) */ // + MULTIPLY(z12, FIX_1_847759065); /* 2*c2 */ movq_r2r(mm2, mm4); // final1 - pmulhw_m2r(fix_184n261, mm0); + pmulhw_m2r(s_fix184n261, mm0); paddw_r2r(mm5, mm2); // tmp0+tmp7,final1 - pmulhw_m2r(fix_184, mm3); + pmulhw_m2r(s_fix184, mm3); psubw_r2r(mm5, mm4); // tmp0-tmp7,final1 // tmp6 = tmp22 - tmp7; /* phase 2 */ @@ -3076,13 +3076,13 @@ inline void RTjpeg::decompress8(int8_t *sp, uint8_t **planes) int RTjpeg::bcomp(int16_t *rblock, int16_t *_old, mmx_t *mask) { int i; - mmx_t *mold=(mmx_t *)_old; - mmx_t *mblock=(mmx_t *)rblock; + auto *mold=(mmx_t *)_old; + auto *mblock=(mmx_t *)rblock; volatile mmx_t result; - static mmx_t neg= { 0xffffffffffffffffULL }; + static mmx_t s_neg= { 0xffffffffffffffffULL }; movq_m2r(*mask, mm7); - movq_m2r(neg, mm6); + movq_m2r(s_neg, mm6); pxor_r2r(mm5, mm5); for(i=0; i<8; i++) @@ -3314,7 +3314,7 @@ void RTjpeg::SetNextKey(void) int RTjpeg::Compress(int8_t *sp, uint8_t **planes) { - RTjpeg_frameheader * fh = (RTjpeg_frameheader *)sp; + auto * fh = (RTjpeg_frameheader *)sp; int ds = 0; if (key_rate == 0) @@ -3351,7 +3351,7 @@ int RTjpeg::Compress(int8_t *sp, uint8_t **planes) void RTjpeg::Decompress(int8_t *sp, uint8_t **planes) { - RTjpeg_frameheader * fh = (RTjpeg_frameheader *)sp; + auto * fh = (RTjpeg_frameheader *)sp; if ((RTJPEG_SWAP_HALFWORD(fh->width) != width)|| (RTJPEG_SWAP_HALFWORD(fh->height) != height)) diff --git a/mythtv/libs/libmythtv/recorders/RTjpegN.h b/mythtv/libs/libmythtv/recorders/RTjpegN.h index d04cfe5686f..38b910a02ec 100644 --- a/mythtv/libs/libmythtv/recorders/RTjpegN.h +++ b/mythtv/libs/libmythtv/recorders/RTjpegN.h @@ -78,11 +78,11 @@ class RTjpeg void SetNextKey(void); private: - int b2s(const int16_t *data, int8_t *strm, uint8_t bt8); - int s2b(int16_t *data, const int8_t *strm, uint8_t bt8, int32_t *qtbla); + static int b2s(const int16_t *data, int8_t *strm, uint8_t bt8); + static int s2b(int16_t *data, const int8_t *strm, uint8_t bt8, int32_t *qtbla); void QuantInit(void); - void Quant(int16_t *block, int32_t *qtbl); + static void Quant(int16_t *block, int32_t *qtbl); void DctInit(void); void DctY(uint8_t *idata, int rskip); @@ -105,9 +105,9 @@ class RTjpeg void decompress8(int8_t *sp, uint8_t **planes); #ifdef MMX - int bcomp(int16_t *rblock, int16_t *old, mmx_t *mask); + static int bcomp(int16_t *rblock, int16_t *old, mmx_t *mask); #else - int bcomp(int16_t *rblock, int16_t *old, uint16_t *mask); + static int bcomp(int16_t *rblock, int16_t *old, uint16_t *mask); #endif int16_t block[64] MALIGN32 {0}; @@ -140,7 +140,7 @@ class RTjpeg int key_rate {0}; }; -typedef struct { +struct RTjpeg_frameheader { uint32_t framesize; uint8_t headersize; uint8_t version; @@ -149,6 +149,6 @@ typedef struct { uint8_t quality; uint8_t key; uint8_t data; -} RTjpeg_frameheader; +}; #endif diff --git a/mythtv/libs/libmythtv/recorders/asichannel.cpp b/mythtv/libs/libmythtv/recorders/asichannel.cpp index d990c531d50..e964bac2702 100644 --- a/mythtv/libs/libmythtv/recorders/asichannel.cpp +++ b/mythtv/libs/libmythtv/recorders/asichannel.cpp @@ -2,6 +2,9 @@ * Class ASIChannel */ +// C/C++ includes +#include <utility> + // MythTV includes #include "mythlogging.h" #include "mpegtables.h" @@ -9,8 +12,8 @@ #define LOC QString("ASIChan[%1](%2): ").arg(GetInputID()).arg(ASIChannel::GetDevice()) -ASIChannel::ASIChannel(TVRec *parent, const QString &device) : - DTVChannel(parent), m_device(device) +ASIChannel::ASIChannel(TVRec *parent, QString device) : + DTVChannel(parent), m_device(std::move(device)) { m_tuner_types.emplace_back(DTVTunerType::kTunerTypeASI); } diff --git a/mythtv/libs/libmythtv/recorders/asichannel.h b/mythtv/libs/libmythtv/recorders/asichannel.h index 4d5ee22f8dd..8f8986867cf 100644 --- a/mythtv/libs/libmythtv/recorders/asichannel.h +++ b/mythtv/libs/libmythtv/recorders/asichannel.h @@ -15,7 +15,7 @@ using namespace std; class ASIChannel : public DTVChannel { public: - ASIChannel(TVRec *parent, const QString &device); + ASIChannel(TVRec *parent, QString device); ~ASIChannel(void); // Commands diff --git a/mythtv/libs/libmythtv/recorders/asistreamhandler.cpp b/mythtv/libs/libmythtv/recorders/asistreamhandler.cpp index 7648cc93527..33303c95c88 100644 --- a/mythtv/libs/libmythtv/recorders/asistreamhandler.cpp +++ b/mythtv/libs/libmythtv/recorders/asistreamhandler.cpp @@ -41,7 +41,7 @@ ASIStreamHandler *ASIStreamHandler::Get(const QString &devname, if (it == s_handlers.end()) { - ASIStreamHandler *newhandler = new ASIStreamHandler(devname, inputid); + auto *newhandler = new ASIStreamHandler(devname, inputid); newhandler->Open(); s_handlers[devkey] = newhandler; s_handlers_refcnt[devkey] = 1; @@ -142,7 +142,7 @@ void ASIStreamHandler::run(void) return; } - DeviceReadBuffer *drb = new DeviceReadBuffer(this, true, false); + auto *drb = new DeviceReadBuffer(this, true, false); bool ok = drb->Setup(m_device, m_fd, m_packet_size, m_buf_size, m_num_buffers / 4); if (!ok) @@ -157,7 +157,7 @@ void ASIStreamHandler::run(void) } uint buffer_size = m_packet_size * 15000; - unsigned char *buffer = new unsigned char[buffer_size]; + auto *buffer = new unsigned char[buffer_size]; if (!buffer) { LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to allocate buffer"); diff --git a/mythtv/libs/libmythtv/recorders/asistreamhandler.h b/mythtv/libs/libmythtv/recorders/asistreamhandler.h index b142de03334..a8483c47dc6 100644 --- a/mythtv/libs/libmythtv/recorders/asistreamhandler.h +++ b/mythtv/libs/libmythtv/recorders/asistreamhandler.h @@ -18,15 +18,15 @@ class DTVSignalMonitor; class ASIChannel; class DeviceReadBuffer; -typedef enum ASIClockSource +enum ASIClockSource { kASIInternalClock = 0, kASIExternalClock = 1, kASIRecoveredReceiveClock = 2, kASIExternalClock2 = 1, -} ASIClockSource; +}; -typedef enum ASIRXMode +enum ASIRXMode { kASIRXRawMode = 0, kASIRXSyncOn188 = 1, @@ -34,7 +34,7 @@ typedef enum ASIRXMode kASIRXSyncOnActualSize = 3, kASIRXSyncOnActualConvertTo188 = 4, kASIRXSyncOn204ConvertTo188 = 5, -} ASIRXMode; +}; //#define RETUNE_TIMEOUT 5000 diff --git a/mythtv/libs/libmythtv/recorders/audioinputalsa.cpp b/mythtv/libs/libmythtv/recorders/audioinputalsa.cpp index 9e356b9bc1d..2f6f164ba63 100644 --- a/mythtv/libs/libmythtv/recorders/audioinputalsa.cpp +++ b/mythtv/libs/libmythtv/recorders/audioinputalsa.cpp @@ -234,7 +234,7 @@ bool AudioInputALSA::PrepSwParams(void) int AudioInputALSA::PcmRead(void* buf, uint nbytes) { - unsigned char* bufptr = (unsigned char*)buf; + auto* bufptr = (unsigned char*)buf; snd_pcm_uframes_t to_read = snd_pcm_bytes_to_frames(pcm_handle, nbytes); snd_pcm_uframes_t nframes = to_read; snd_pcm_sframes_t nread, avail; diff --git a/mythtv/libs/libmythtv/recorders/audioinputalsa.h b/mythtv/libs/libmythtv/recorders/audioinputalsa.h index 9c9ef77c8c5..3065dd25017 100644 --- a/mythtv/libs/libmythtv/recorders/audioinputalsa.h +++ b/mythtv/libs/libmythtv/recorders/audioinputalsa.h @@ -26,8 +26,8 @@ #ifdef USING_ALSA #include <alsa/asoundlib.h> #else -typedef int snd_pcm_t; -typedef int snd_pcm_uframes_t; +using snd_pcm_t = int; +using snd_pcm_uframes_t = int; #endif // USING_ALSA class AudioInputALSA : public AudioInput diff --git a/mythtv/libs/libmythtv/recorders/cetonrtsp.h b/mythtv/libs/libmythtv/recorders/cetonrtsp.h index 88a9d16bc5c..3b310002edf 100644 --- a/mythtv/libs/libmythtv/recorders/cetonrtsp.h +++ b/mythtv/libs/libmythtv/recorders/cetonrtsp.h @@ -19,7 +19,7 @@ class QTcpSocket; class QUdpSocket; -typedef QMap<QString, QString> Params; +using Params = QMap<QString, QString>; class CetonRTSP : QObject { @@ -47,7 +47,7 @@ class CetonRTSP : QObject const QString &alternative = QString()); private: - QStringList splitLines(const QByteArray &lines); + static QStringList splitLines(const QByteArray &lines); QString readParameters(const QString &key, Params ¶meters); QUrl GetBaseUrl(void); void timerEvent(QTimerEvent*) override; // QObject diff --git a/mythtv/libs/libmythtv/recorders/cetonstreamhandler.cpp b/mythtv/libs/libmythtv/recorders/cetonstreamhandler.cpp index 5fc4f43c1c1..f278adc07fd 100644 --- a/mythtv/libs/libmythtv/recorders/cetonstreamhandler.cpp +++ b/mythtv/libs/libmythtv/recorders/cetonstreamhandler.cpp @@ -45,7 +45,7 @@ CetonStreamHandler *CetonStreamHandler::Get(const QString &devname, if (it == s_handlers.end()) { - CetonStreamHandler *newhandler = new CetonStreamHandler(devkey, inputid); + auto *newhandler = new CetonStreamHandler(devkey, inputid); newhandler->Open(); s_handlers[devkey] = newhandler; s_handlers_refcnt[devkey] = 1; @@ -536,7 +536,7 @@ bool CetonStreamHandler::HttpRequest( QString &response, uint &status_code) const { QUrl url; - QNetworkRequest *request = new QNetworkRequest(); + auto *request = new QNetworkRequest(); QByteArray data; MythDownloadManager *manager = GetMythDownloadManager(); diff --git a/mythtv/libs/libmythtv/recorders/channelbase.cpp b/mythtv/libs/libmythtv/recorders/channelbase.cpp index ce1dcfb8a0f..c39e7633a60 100644 --- a/mythtv/libs/libmythtv/recorders/channelbase.cpp +++ b/mythtv/libs/libmythtv/recorders/channelbase.cpp @@ -696,85 +696,85 @@ ChannelBase *ChannelBase::CreateChannel( rbFileExt = "ts"; ChannelBase *channel = nullptr; - if (genOpt.inputtype == "DVB") + if (genOpt.m_inputType == "DVB") { #ifdef USING_DVB - channel = new DVBChannel(genOpt.videodev, tvrec); - DVBChannel *dvbchannel = dynamic_cast<DVBChannel*>(channel); + channel = new DVBChannel(genOpt.m_videoDev, tvrec); + auto *dvbchannel = dynamic_cast<DVBChannel*>(channel); if (dvbchannel != nullptr) - dvbchannel->SetSlowTuning(dvbOpt.dvb_tuning_delay); + dvbchannel->SetSlowTuning(dvbOpt.m_dvbTuningDelay); #endif } - else if (genOpt.inputtype == "FIREWIRE") + else if (genOpt.m_inputType == "FIREWIRE") { #ifdef USING_FIREWIRE - channel = new FirewireChannel(tvrec, genOpt.videodev, fwOpt); + channel = new FirewireChannel(tvrec, genOpt.m_videoDev, fwOpt); #else Q_UNUSED(fwOpt); #endif } - else if (genOpt.inputtype == "HDHOMERUN") + else if (genOpt.m_inputType == "HDHOMERUN") { #ifdef USING_HDHOMERUN - channel = new HDHRChannel(tvrec, genOpt.videodev); + channel = new HDHRChannel(tvrec, genOpt.m_videoDev); #endif } - else if ((genOpt.inputtype == "IMPORT") || - (genOpt.inputtype == "DEMO") || - (genOpt.inputtype == "MPEG" && - genOpt.videodev.toLower().startsWith("file:"))) + else if ((genOpt.m_inputType == "IMPORT") || + (genOpt.m_inputType == "DEMO") || + (genOpt.m_inputType == "MPEG" && + genOpt.m_videoDev.toLower().startsWith("file:"))) { channel = new DummyChannel(tvrec); rbFileExt = "mpg"; } #ifdef USING_IPTV - else if (genOpt.inputtype == "FREEBOX") // IPTV + else if (genOpt.m_inputType == "FREEBOX") // IPTV { // NOLINTNEXTLINE(bugprone-branch-clone) - channel = new IPTVChannel(tvrec, genOpt.videodev); + channel = new IPTVChannel(tvrec, genOpt.m_videoDev); } #endif #ifdef USING_VBOX - else if (genOpt.inputtype == "VBOX") + else if (genOpt.m_inputType == "VBOX") { - channel = new IPTVChannel(tvrec, genOpt.videodev); + channel = new IPTVChannel(tvrec, genOpt.m_videoDev); } #endif #ifdef USING_ASI - else if (genOpt.inputtype == "ASI") + else if (genOpt.m_inputType == "ASI") { - channel = new ASIChannel(tvrec, genOpt.videodev); + channel = new ASIChannel(tvrec, genOpt.m_videoDev); } #endif #ifdef USING_CETON - else if (genOpt.inputtype == "CETON") + else if (genOpt.m_inputType == "CETON") { - channel = new CetonChannel(tvrec, genOpt.videodev); + channel = new CetonChannel(tvrec, genOpt.m_videoDev); } #endif - else if (genOpt.inputtype == "V4L2ENC") + else if (genOpt.m_inputType == "V4L2ENC") { #ifdef USING_V4L2 - channel = new V4LChannel(tvrec, genOpt.videodev); + channel = new V4LChannel(tvrec, genOpt.m_videoDev); #endif - if (genOpt.inputtype == "MPEG") + if (genOpt.m_inputType == "MPEG") rbFileExt = "mpg"; } - else if (CardUtil::IsV4L(genOpt.inputtype)) + else if (CardUtil::IsV4L(genOpt.m_inputType)) { #ifdef USING_V4L2 - channel = new V4LChannel(tvrec, genOpt.videodev); + channel = new V4LChannel(tvrec, genOpt.m_videoDev); #endif - if (genOpt.inputtype != "HDPVR") + if (genOpt.m_inputType != "HDPVR") { - if (genOpt.inputtype != "MPEG") + if (genOpt.m_inputType != "MPEG") rbFileExt = "nuv"; else rbFileExt = "mpg"; } } - else if (genOpt.inputtype == "EXTERNAL") + else if (genOpt.m_inputType == "EXTERNAL") { - channel = new ExternalChannel(tvrec, genOpt.videodev); + channel = new ExternalChannel(tvrec, genOpt.m_videoDev); } if (!channel) @@ -785,8 +785,8 @@ ChannelBase *ChannelBase::CreateChannel( "\n" "Recompile MythTV with %4 support or remove the card \n" "from the configuration and restart MythTV.") - .arg(genOpt.inputtype).arg(genOpt.videodev) - .arg(genOpt.inputtype).arg(genOpt.inputtype); + .arg(genOpt.m_inputType).arg(genOpt.m_videoDev) + .arg(genOpt.m_inputType).arg(genOpt.m_inputType); LOG(VB_GENERAL, LOG_ERR, "ChannelBase: CreateChannel() Error: \n" + msg + "\n"); return nullptr; @@ -795,7 +795,7 @@ ChannelBase *ChannelBase::CreateChannel( if (!channel->Open()) { LOG(VB_GENERAL, LOG_ERR, "ChannelBase: CreateChannel() Error: " + - QString("Failed to open device %1").arg(genOpt.videodev)); + QString("Failed to open device %1").arg(genOpt.m_videoDev)); delete channel; return nullptr; } @@ -806,15 +806,15 @@ ChannelBase *ChannelBase::CreateChannel( if (enter_power_save_mode) { if (channel && - ((genOpt.inputtype == "DVB" && dvbOpt.dvb_on_demand) || - genOpt.inputtype == "HDHOMERUN" || - CardUtil::IsV4L(genOpt.inputtype))) + ((genOpt.m_inputType == "DVB" && dvbOpt.m_dvbOnDemand) || + genOpt.m_inputType == "HDHOMERUN" || + CardUtil::IsV4L(genOpt.m_inputType))) { channel->Close(); } else if (setchan) { - DTVChannel *dtvchannel = dynamic_cast<DTVChannel*>(channel); + auto *dtvchannel = dynamic_cast<DTVChannel*>(channel); if (dtvchannel) dtvchannel->EnterPowerSavingMode(); } diff --git a/mythtv/libs/libmythtv/recorders/darwinavcinfo.h b/mythtv/libs/libmythtv/recorders/darwinavcinfo.h index 7901cb5d5f5..8154768987d 100644 --- a/mythtv/libs/libmythtv/recorders/darwinavcinfo.h +++ b/mythtv/libs/libmythtv/recorders/darwinavcinfo.h @@ -62,7 +62,7 @@ class DarwinAVCInfo : public AVCInfo IOFireWireAVCLibUnitInterface **avc_handle {0}; IOFireWireLibDeviceRef fw_handle {0}; }; -typedef QMap<uint64_t,DarwinAVCInfo*> avcinfo_list_t; +using avcinfo_list_t = QMap<uint64_t,DarwinAVCInfo*>; #endif // USING_OSX_FIREWIRE diff --git a/mythtv/libs/libmythtv/recorders/dtvchannel.cpp b/mythtv/libs/libmythtv/recorders/dtvchannel.cpp index cd220db0720..c631bdd05b3 100644 --- a/mythtv/libs/libmythtv/recorders/dtvchannel.cpp +++ b/mythtv/libs/libmythtv/recorders/dtvchannel.cpp @@ -11,7 +11,7 @@ #define LOC QString("DTVChan[%1](%2): ").arg(m_inputid).arg(GetDevice()) QReadWriteLock DTVChannel::s_master_map_lock(QReadWriteLock::Recursive); -typedef QMap<QString,QList<DTVChannel*> > MasterMap; +using MasterMap = QMap<QString,QList<DTVChannel*> >; MasterMap DTVChannel::s_master_map; DTVChannel::~DTVChannel() @@ -338,7 +338,7 @@ bool DTVChannel::SetChannelByString(const QString &channum) int pcrpid = -1; vector<uint> pids; vector<uint> types; - pid_cache_t::iterator pit = pid_cache.begin(); + auto pit = pid_cache.begin(); for (; pit != pid_cache.end(); ++pit) { if (!pit->GetStreamID()) diff --git a/mythtv/libs/libmythtv/recorders/dtvchannel.h b/mythtv/libs/libmythtv/recorders/dtvchannel.h index 4787c52c762..3079fe9f822 100644 --- a/mythtv/libs/libmythtv/recorders/dtvchannel.h +++ b/mythtv/libs/libmythtv/recorders/dtvchannel.h @@ -124,7 +124,7 @@ class DTVChannel : public ChannelBase void RegisterForMaster(const QString &key); void DeregisterForMaster(const QString &key); static DTVChannel *GetMasterLock(const QString &key); - typedef DTVChannel* DTVChannelP; + using DTVChannelP = DTVChannel*; static void ReturnMasterLock(DTVChannelP&); /// \brief Returns true if this is the first of a number of multi-rec devs @@ -176,7 +176,7 @@ class DTVChannel : public ChannelBase /// This is a generated PMT for RAW pid tuning ProgramMapTable *m_genPMT {nullptr}; - typedef QMap<QString,QList<DTVChannel*> > MasterMap; + using MasterMap = QMap<QString,QList<DTVChannel*> >; static QReadWriteLock s_master_map_lock; static MasterMap s_master_map; }; diff --git a/mythtv/libs/libmythtv/recorders/dtvrecorder.cpp b/mythtv/libs/libmythtv/recorders/dtvrecorder.cpp index 576212f4765..a3281b1e2c0 100644 --- a/mythtv/libs/libmythtv/recorders/dtvrecorder.cpp +++ b/mythtv/libs/libmythtv/recorders/dtvrecorder.cpp @@ -217,11 +217,11 @@ void DTVRecorder::InitStreamData(void) m_stream_data->AddMPEGSPListener(this); m_stream_data->AddMPEGListener(this); - DVBStreamData *dvb = dynamic_cast<DVBStreamData*>(m_stream_data); + auto *dvb = dynamic_cast<DVBStreamData*>(m_stream_data); if (dvb) dvb->AddDVBMainListener(this); - ATSCStreamData *atsc = dynamic_cast<ATSCStreamData*>(m_stream_data); + auto *atsc = dynamic_cast<ATSCStreamData*>(m_stream_data); if (atsc && atsc->DesiredMinorChannel()) atsc->SetDesiredChannel(atsc->DesiredMajorChannel(), @@ -693,14 +693,13 @@ bool DTVRecorder::FindAudioKeyframes(const TSPacket* /*tspacket*/) if (!m_ringBuffer || (GetStreamData()->VideoPIDSingleProgram() <= 0x1fff)) return hasKeyFrame; - static const uint64_t msec_per_day = 24 * 60 * 60 * 1000ULL; + static constexpr uint64_t kMsecPerDay = 24 * 60 * 60 * 1000ULL; const double frame_interval = (1000.0 / m_video_frame_rate); uint64_t elapsed = (uint64_t) max(m_audio_timer.elapsed(), 0); - uint64_t expected_frame = - (uint64_t) ((double)elapsed / frame_interval); + auto expected_frame = (uint64_t) ((double)elapsed / frame_interval); while (m_frames_seen_count > expected_frame + 10000) - expected_frame += (uint64_t) ((double)msec_per_day / frame_interval); + expected_frame += (uint64_t) ((double)kMsecPerDay / frame_interval); if (!m_frames_seen_count || (m_frames_seen_count < expected_frame)) { @@ -1435,17 +1434,17 @@ bool DTVRecorder::ProcessTSPacket(const TSPacket &tspacket) * unprocessed we cannot wait for a keyframe to trigger the * writes. */ - static MythTimer timer; + static MythTimer s_timer; if (m_frames_seen_count++ == 0) - timer.start(); + s_timer.start(); - if (timer.elapsed() > 500) // 0.5 seconds + if (s_timer.elapsed() > 500) // 0.5 seconds { UpdateFramesWritten(); m_last_keyframe_seen = m_frames_seen_count; HandleKeyframe(m_payload_buffer.size()); - timer.addMSecs(-500); + s_timer.addMSecs(-500); } } else if (m_stream_id[pid] == 0) diff --git a/mythtv/libs/libmythtv/recorders/dvbcam.cpp b/mythtv/libs/libmythtv/recorders/dvbcam.cpp index 8fa31e55e78..20439b0fa2a 100644 --- a/mythtv/libs/libmythtv/recorders/dvbcam.cpp +++ b/mythtv/libs/libmythtv/recorders/dvbcam.cpp @@ -33,11 +33,13 @@ * */ +#include <cstdio> +#include <cstdlib> #include <iostream> -#include <vector> #include <map> -#include <cstdlib> -#include <cstdio> +#include <utility> +#include <vector> + using namespace std; #include <fcntl.h> @@ -59,8 +61,8 @@ using namespace std; #define LOC QString("DVB#%1 CA: ").arg(m_device) -DVBCam::DVBCam(const QString &aDevice) - : m_device(aDevice) +DVBCam::DVBCam(QString aDevice) + : m_device(std::move(aDevice)) { QString dvbdev = CardUtil::GetDeviceName(DVB_DEV_CA, m_device); QByteArray dev = dvbdev.toLatin1(); diff --git a/mythtv/libs/libmythtv/recorders/dvbcam.h b/mythtv/libs/libmythtv/recorders/dvbcam.h index 72ca5ad106c..3aaa652ecb6 100644 --- a/mythtv/libs/libmythtv/recorders/dvbcam.h +++ b/mythtv/libs/libmythtv/recorders/dvbcam.h @@ -18,12 +18,12 @@ class cCiHandler; class MThread; class DVBCam; -typedef QMap<const ChannelBase*, ProgramMapTable*> pmt_list_t; +using pmt_list_t = QMap<const ChannelBase*, ProgramMapTable*>; class DVBCam : public QRunnable { public: - explicit DVBCam(const QString &device); + explicit DVBCam(QString device); ~DVBCam(); bool Start(void); diff --git a/mythtv/libs/libmythtv/recorders/dvbchannel.cpp b/mythtv/libs/libmythtv/recorders/dvbchannel.cpp index 696fe89cefa..87e69fcfaaf 100644 --- a/mythtv/libs/libmythtv/recorders/dvbchannel.cpp +++ b/mythtv/libs/libmythtv/recorders/dvbchannel.cpp @@ -34,6 +34,7 @@ // POSIX headers #include <fcntl.h> #include <unistd.h> +#include <utility> #include <sys/poll.h> #include <sys/select.h> #include <sys/time.h> @@ -72,8 +73,8 @@ QDateTime DVBChannel::s_last_tuning = QDateTime::currentDateTime(); * * \bug Only supports single input cards. */ -DVBChannel::DVBChannel(const QString &aDevice, TVRec *parent) - : DTVChannel(parent), m_device(aDevice) +DVBChannel::DVBChannel(QString aDevice, TVRec *parent) + : DTVChannel(parent), m_device(std::move(aDevice)) { s_master_map_lock.lockForWrite(); QString key = CardUtil::GetDeviceName(DVB_DEV_FRONTEND, m_device); @@ -81,7 +82,7 @@ DVBChannel::DVBChannel(const QString &aDevice, TVRec *parent) key += QString(":%1") .arg(CardUtil::GetSourceID(m_pParent->GetInputId())); s_master_map[key].push_back(this); // == RegisterForMaster - DVBChannel *master = static_cast<DVBChannel*>(s_master_map[key].front()); + auto *master = static_cast<DVBChannel*>(s_master_map[key].front()); if (master == this) { m_dvbcam = new DVBCam(m_device); @@ -106,7 +107,7 @@ DVBChannel::~DVBChannel() if (m_pParent) key += QString(":%1") .arg(CardUtil::GetSourceID(m_pParent->GetInputId())); - DVBChannel *master = static_cast<DVBChannel*>(s_master_map[key].front()); + auto *master = static_cast<DVBChannel*>(s_master_map[key].front()); if (master == this) { s_master_map[key].pop_front(); @@ -278,7 +279,7 @@ bool DVBChannel::Open(DVBChannel *who) if (m_tunerType.IsDiSEqCSupported()) { - m_diseqc_tree = m_diseqc_dev.FindTree(m_inputid); + m_diseqc_tree = DiSEqCDev::FindTree(m_inputid); if (m_diseqc_tree) { bool is_SCR = false; @@ -395,13 +396,13 @@ void DVBChannel::CheckOptions(DTVMultiplex &tuning) const // Check OFDM Tuning params - if (!CheckCodeRate(tuning.m_hp_code_rate)) + if (!CheckCodeRate(tuning.m_hpCodeRate)) { LOG(VB_GENERAL, LOG_WARNING, LOC + "Selected code_rate_hp parameter unsupported by this driver."); } - if (!CheckCodeRate(tuning.m_lp_code_rate)) + if (!CheckCodeRate(tuning.m_lpCodeRate)) { LOG(VB_GENERAL, LOG_WARNING, LOC + "Selected code_rate_lp parameter unsupported by this driver."); @@ -414,14 +415,14 @@ void DVBChannel::CheckOptions(DTVMultiplex &tuning) const "'Auto' bandwidth parameter unsupported by this driver."); } - if ((tuning.m_trans_mode == DTVTransmitMode::kTransmissionModeAuto) && + if ((tuning.m_transMode == DTVTransmitMode::kTransmissionModeAuto) && ((m_capabilities & FE_CAN_TRANSMISSION_MODE_AUTO) == 0U)) { LOG(VB_GENERAL, LOG_WARNING, LOC + "'Auto' transmission_mode parameter unsupported by this driver."); } - if ((tuning.m_guard_interval == DTVGuardInterval::kGuardIntervalAuto) && + if ((tuning.m_guardInterval == DTVGuardInterval::kGuardIntervalAuto) && ((m_capabilities & FE_CAN_GUARD_INTERVAL_AUTO) == 0U)) { LOG(VB_GENERAL, LOG_WARNING, LOC + @@ -537,7 +538,7 @@ static struct dtv_properties *dtvmultiplex_to_dtvproperties( return nullptr; } - LOG(VB_CHANNEL, LOG_DEBUG, "DVBChan: modsys " + tuning.m_mod_sys.toString()); + LOG(VB_CHANNEL, LOG_DEBUG, "DVBChan: modsys " + tuning.m_modSys.toString()); cmdseq = (struct dtv_properties*) calloc(1, sizeof(*cmdseq)); if (!cmdseq) @@ -552,7 +553,7 @@ static struct dtv_properties *dtvmultiplex_to_dtvproperties( // The cx24116 DVB-S2 demod anounce FE_CAN_FEC_AUTO but has apparently // trouble with FEC_AUTO on DVB-S2 transponders - if (tuning.m_mod_sys == DTVModulationSystem::kModulationSystem_DVBS2) + if (tuning.m_modSys == DTVModulationSystem::kModulationSystem_DVBS2) can_fec_auto = false; if (tuner_type == DTVTunerType::kTunerTypeDVBS2 || @@ -560,7 +561,7 @@ static struct dtv_properties *dtvmultiplex_to_dtvproperties( tuner_type == DTVTunerType::kTunerTypeDVBT2) { cmdseq->props[c].cmd = DTV_DELIVERY_SYSTEM; - cmdseq->props[c++].u.data = tuning.m_mod_sys; + cmdseq->props[c++].u.data = tuning.m_modSys; } cmdseq->props[c].cmd = DTV_FREQUENCY; @@ -591,25 +592,25 @@ static struct dtv_properties *dtvmultiplex_to_dtvproperties( cmdseq->props[c].cmd = DTV_BANDWIDTH_HZ; cmdseq->props[c++].u.data = (8-tuning.m_bandwidth) * 1000000; cmdseq->props[c].cmd = DTV_CODE_RATE_HP; - cmdseq->props[c++].u.data = tuning.m_hp_code_rate; + cmdseq->props[c++].u.data = tuning.m_hpCodeRate; cmdseq->props[c].cmd = DTV_CODE_RATE_LP; - cmdseq->props[c++].u.data = tuning.m_lp_code_rate; + cmdseq->props[c++].u.data = tuning.m_lpCodeRate; cmdseq->props[c].cmd = DTV_TRANSMISSION_MODE; - cmdseq->props[c++].u.data = tuning.m_trans_mode; + cmdseq->props[c++].u.data = tuning.m_transMode; cmdseq->props[c].cmd = DTV_GUARD_INTERVAL; - cmdseq->props[c++].u.data = tuning.m_guard_interval; + cmdseq->props[c++].u.data = tuning.m_guardInterval; cmdseq->props[c].cmd = DTV_HIERARCHY; cmdseq->props[c++].u.data = tuning.m_hierarchy; } - if (tuning.m_mod_sys == DTVModulationSystem::kModulationSystem_DVBS2) + if (tuning.m_modSys == DTVModulationSystem::kModulationSystem_DVBS2) { cmdseq->props[c].cmd = DTV_PILOT; cmdseq->props[c++].u.data = PILOT_AUTO; cmdseq->props[c].cmd = DTV_ROLLOFF; cmdseq->props[c++].u.data = tuning.m_rolloff; } - else if (tuning.m_mod_sys == DTVModulationSystem::kModulationSystem_DVBS) + else if (tuning.m_modSys == DTVModulationSystem::kModulationSystem_DVBS) { cmdseq->props[c].cmd = DTV_ROLLOFF; cmdseq->props[c++].u.data = DTVRollOff::kRollOff_35; @@ -1352,7 +1353,7 @@ DVBChannel *DVBChannel::GetMasterLock(void) key += QString(":%1") .arg(CardUtil::GetSourceID(m_pParent->GetInputId())); DTVChannel *master = DTVChannel::GetMasterLock(key); - DVBChannel *dvbm = dynamic_cast<DVBChannel*>(master); + auto *dvbm = dynamic_cast<DVBChannel*>(master); if (master && !dvbm) DTVChannel::ReturnMasterLock(master); return dvbm; @@ -1360,7 +1361,7 @@ DVBChannel *DVBChannel::GetMasterLock(void) void DVBChannel::ReturnMasterLock(DVBChannelP &dvbm) { - DTVChannel *chan = static_cast<DTVChannel*>(dvbm); + auto *chan = static_cast<DTVChannel*>(dvbm); DTVChannel::ReturnMasterLock(chan); dvbm = nullptr; } @@ -1372,7 +1373,7 @@ const DVBChannel *DVBChannel::GetMasterLock(void) const key += QString(":%1") .arg(CardUtil::GetSourceID(m_pParent->GetInputId())); DTVChannel *master = DTVChannel::GetMasterLock(key); - DVBChannel *dvbm = dynamic_cast<DVBChannel*>(master); + auto *dvbm = dynamic_cast<DVBChannel*>(master); if (master && !dvbm) DTVChannel::ReturnMasterLock(master); return dvbm; @@ -1380,8 +1381,7 @@ const DVBChannel *DVBChannel::GetMasterLock(void) const void DVBChannel::ReturnMasterLock(DVBChannelCP &dvbm) { - DTVChannel *chan = - static_cast<DTVChannel*>(const_cast<DVBChannel*>(dvbm)); + auto *chan = static_cast<DTVChannel*>(const_cast<DVBChannel*>(dvbm)); DTVChannel::ReturnMasterLock(chan); dvbm = nullptr; } @@ -1482,7 +1482,7 @@ static struct dvb_frontend_parameters dtvmultiplex_to_dvbparams( if (DTVTunerType::kTunerTypeDVBS1 == tuner_type) { - if (tuning.m_mod_sys == DTVModulationSystem::kModulationSystem_DVBS2) + if (tuning.m_modSys == DTVModulationSystem::kModulationSystem_DVBS2) LOG(VB_GENERAL, LOG_ERR, "DVBChan: Error, Tuning of a DVB-S2 transport " "with a DVB-S card will fail."); @@ -1513,15 +1513,15 @@ static struct dvb_frontend_parameters dtvmultiplex_to_dvbparams( params.u.ofdm.bandwidth = (fe_bandwidth_t) (int) tuning.m_bandwidth; params.u.ofdm.code_rate_HP = - (fe_code_rate_t) (int) tuning.m_hp_code_rate; + (fe_code_rate_t) (int) tuning.m_hpCodeRate; params.u.ofdm.code_rate_LP = - (fe_code_rate_t) (int) tuning.m_lp_code_rate; + (fe_code_rate_t) (int) tuning.m_lpCodeRate; params.u.ofdm.constellation = (fe_modulation_t) (int) tuning.m_modulation; params.u.ofdm.transmission_mode = - (fe_transmit_mode_t) (int) tuning.m_trans_mode; + (fe_transmit_mode_t) (int) tuning.m_transMode; params.u.ofdm.guard_interval = - (fe_guard_interval_t) (int) tuning.m_guard_interval; + (fe_guard_interval_t) (int) tuning.m_guardInterval; params.u.ofdm.hierarchy_information = (fe_hierarchy_t) (int) tuning.m_hierarchy; } @@ -1561,11 +1561,11 @@ static DTVMultiplex dvbparams_to_dtvmultiplex( DTVTunerType::kTunerTypeDVBT2 == tuner_type) { tuning.m_bandwidth = params.u.ofdm.bandwidth; - tuning.m_hp_code_rate = params.u.ofdm.code_rate_HP; - tuning.m_lp_code_rate = params.u.ofdm.code_rate_LP; + tuning.m_hpCodeRate = params.u.ofdm.code_rate_HP; + tuning.m_lpCodeRate = params.u.ofdm.code_rate_LP; tuning.m_modulation = params.u.ofdm.constellation; - tuning.m_trans_mode = params.u.ofdm.transmission_mode; - tuning.m_guard_interval = params.u.ofdm.guard_interval; + tuning.m_transMode = params.u.ofdm.transmission_mode; + tuning.m_guardInterval = params.u.ofdm.guard_interval; tuning.m_hierarchy = params.u.ofdm.hierarchy_information; } diff --git a/mythtv/libs/libmythtv/recorders/dvbchannel.h b/mythtv/libs/libmythtv/recorders/dvbchannel.h index ced4a4fe2e1..abd4d125a2c 100644 --- a/mythtv/libs/libmythtv/recorders/dvbchannel.h +++ b/mythtv/libs/libmythtv/recorders/dvbchannel.h @@ -24,12 +24,12 @@ class DVBCam; class DVBRecorder; class DVBChannel; -typedef QMap<const DVBChannel*,bool> IsOpenMap; +using IsOpenMap = QMap<const DVBChannel*,bool>; class DVBChannel : public DTVChannel { public: - DVBChannel(const QString &device, TVRec *parent = nullptr); + DVBChannel(QString device, TVRec *parent = nullptr); ~DVBChannel(); bool Open(void) override // ChannelBase @@ -102,11 +102,11 @@ class DVBChannel : public DTVChannel bool CheckModulation(DTVModulation modulation) const; bool CheckCodeRate(DTVCodeRate rate) const; - typedef DVBChannel* DVBChannelP; + using DVBChannelP = DVBChannel*; DVBChannel *GetMasterLock(void); static void ReturnMasterLock(DVBChannelP &dvbm); - typedef const DVBChannel* DVBChannelCP; + using DVBChannelCP = const DVBChannel*; const DVBChannel *GetMasterLock(void) const; static void ReturnMasterLock(DVBChannelCP &dvbm); diff --git a/mythtv/libs/libmythtv/recorders/dvbdev/dvbci.cpp b/mythtv/libs/libmythtv/recorders/dvbdev/dvbci.cpp index 68556bf025a..1770d50cfe0 100644 --- a/mythtv/libs/libmythtv/recorders/dvbdev/dvbci.cpp +++ b/mythtv/libs/libmythtv/recorders/dvbdev/dvbci.cpp @@ -375,7 +375,7 @@ class cCiTransportConnection { uint8_t m_tcid {0}; eState m_state {stIDLE}; cTPDU *m_tpdu {nullptr}; - struct timeval m_last_poll {0,0}; + struct timeval m_lastPoll {0,0}; int m_lastResponse {ERROR}; bool m_dataAvailable {false}; void Init(int Fd, uint8_t Slot, uint8_t Tcid); @@ -552,13 +552,13 @@ int cCiTransportConnection::Poll(void) gettimeofday(&curr_time, nullptr); uint64_t msdiff = (curr_time.tv_sec * 1000) + (curr_time.tv_usec / 1000) - - (m_last_poll.tv_sec * 1000) - (m_last_poll.tv_usec / 1000); + (m_lastPoll.tv_sec * 1000) - (m_lastPoll.tv_usec / 1000); if (msdiff < POLL_INTERVAL) return OK; - m_last_poll.tv_sec = curr_time.tv_sec; - m_last_poll.tv_usec = curr_time.tv_usec; + m_lastPoll.tv_sec = curr_time.tv_sec; + m_lastPoll.tv_usec = curr_time.tv_usec; if (SendTPDU(T_DATA_LAST) != OK) return ERROR; @@ -745,27 +745,27 @@ cCiTransportConnection *cCiTransportLayer::Process(int Slot) class cCiSession { private: - int sessionId; - int resourceId; + int m_sessionId; + int m_resourceId; cCiTransportConnection *m_tc; protected: - int GetTag(int &Length, const uint8_t **Data); - const uint8_t *GetData(const uint8_t *Data, int &Length); + static int GetTag(int &Length, const uint8_t **Data); + static const uint8_t *GetData(const uint8_t *Data, int &Length); int SendData(int Tag, int Length = 0, const uint8_t *Data = nullptr); public: cCiSession(int SessionId, int ResourceId, cCiTransportConnection *Tc); virtual ~cCiSession() = default; const cCiTransportConnection *Tc(void) { return m_tc; } - int SessionId(void) { return sessionId; } - int ResourceId(void) { return resourceId; } + int SessionId(void) { return m_sessionId; } + int ResourceId(void) { return m_resourceId; } virtual bool HasUserIO(void) { return false; } virtual bool Process(int Length = 0, const uint8_t *Data = nullptr); }; cCiSession::cCiSession(int SessionId, int ResourceId, cCiTransportConnection *Tc) { - sessionId = SessionId; - resourceId = ResourceId; + m_sessionId = SessionId; + m_resourceId = ResourceId; m_tc = Tc; } @@ -800,8 +800,8 @@ int cCiSession::SendData(int Tag, int Length, const uint8_t *Data) uint8_t *p = buffer; *p++ = ST_SESSION_NUMBER; *p++ = 0x02; - *p++ = (sessionId >> 8) & 0xFF; - *p++ = sessionId & 0xFF; + *p++ = (m_sessionId >> 8) & 0xFF; + *p++ = m_sessionId & 0xFF; *p++ = (Tag >> 16) & 0xFF; *p++ = (Tag >> 8) & 0xFF; *p++ = Tag & 0xFF; @@ -839,7 +839,7 @@ bool cCiSession::Process(int Length, const uint8_t *Data) class cCiResourceManager : public cCiSession { private: - int state; + int m_state; public: cCiResourceManager(int SessionId, cCiTransportConnection *Tc); bool Process(int Length = 0, const uint8_t *Data = nullptr) override; // cCiSession @@ -849,7 +849,7 @@ cCiResourceManager::cCiResourceManager(int SessionId, cCiTransportConnection *Tc :cCiSession(SessionId, RI_RESOURCE_MANAGER, Tc) { dbgprotocol("New Resource Manager (session id %d)\n", SessionId); - state = 0; + m_state = 0; } bool cCiResourceManager::Process(int Length, const uint8_t *Data) @@ -869,22 +869,22 @@ bool cCiResourceManager::Process(int Length, const uint8_t *Data) }; dbgprotocol("%d: ==> Profile\n", SessionId()); SendData(AOT_PROFILE, sizeof(resources), (uint8_t*)resources); - state = 3; + m_state = 3; } break; case AOT_PROFILE: { dbgprotocol("%d: <== Profile\n", SessionId()); - if (state == 1) { + if (m_state == 1) { int l = 0; const uint8_t *d = GetData(Data, l); if (l > 0 && d) esyslog("CI resource manager: unexpected data"); dbgprotocol("%d: ==> Profile Change\n", SessionId()); SendData(AOT_PROFILE_CHANGE); - state = 2; + m_state = 2; } else { - esyslog("ERROR: CI resource manager: unexpected tag %06X in state %d", Tag, state); + esyslog("ERROR: CI resource manager: unexpected tag %06X in state %d", Tag, m_state); } } break; @@ -892,10 +892,10 @@ bool cCiResourceManager::Process(int Length, const uint8_t *Data) return false; } } - else if (state == 0) { + else if (m_state == 0) { dbgprotocol("%d: ==> Profile Enq\n", SessionId()); SendData(AOT_PROFILE_ENQ); - state = 1; + m_state = 1; } return true; } @@ -904,37 +904,37 @@ bool cCiResourceManager::Process(int Length, const uint8_t *Data) class cCiApplicationInformation : public cCiSession { private: - int state; - time_t creationTime; - uint8_t applicationType; - uint16_t applicationManufacturer; - uint16_t manufacturerCode; - char *menuString; + int m_state; + time_t m_creationTime; + uint8_t m_applicationType; + uint16_t m_applicationManufacturer; + uint16_t m_manufacturerCode; + char *m_menuString; public: cCiApplicationInformation(int SessionId, cCiTransportConnection *Tc); ~cCiApplicationInformation() override; bool Process(int Length = 0, const uint8_t *Data = nullptr) override; // cCiSession bool EnterMenu(void); - char *GetApplicationString() { return strdup(menuString); }; - uint16_t GetApplicationManufacturer() { return applicationManufacturer; }; - uint16_t GetManufacturerCode() { return manufacturerCode; }; + char *GetApplicationString() { return strdup(m_menuString); }; + uint16_t GetApplicationManufacturer() { return m_applicationManufacturer; }; + uint16_t GetManufacturerCode() { return m_manufacturerCode; }; }; cCiApplicationInformation::cCiApplicationInformation(int SessionId, cCiTransportConnection *Tc) :cCiSession(SessionId, RI_APPLICATION_INFORMATION, Tc) { dbgprotocol("New Application Information (session id %d)\n", SessionId); - state = 0; - creationTime = time(nullptr); - applicationType = 0; - applicationManufacturer = 0; - manufacturerCode = 0; - menuString = nullptr; + m_state = 0; + m_creationTime = time(nullptr); + m_applicationType = 0; + m_applicationManufacturer = 0; + m_manufacturerCode = 0; + m_menuString = nullptr; } cCiApplicationInformation::~cCiApplicationInformation() { - free(menuString); + free(m_menuString); } bool cCiApplicationInformation::Process(int Length, const uint8_t *Data) @@ -947,35 +947,35 @@ bool cCiApplicationInformation::Process(int Length, const uint8_t *Data) int l = 0; const uint8_t *d = GetData(Data, l); if ((l -= 1) < 0) break; - applicationType = *d++; + m_applicationType = *d++; if ((l -= 2) < 0) break; - applicationManufacturer = ntohs(*(uint16_t *)d); + m_applicationManufacturer = ntohs(*(uint16_t *)d); d += 2; if ((l -= 2) < 0) break; - manufacturerCode = ntohs(*(uint16_t *)d); + m_manufacturerCode = ntohs(*(uint16_t *)d); d += 2; - free(menuString); - menuString = GetString(l, &d); - isyslog("CAM: %s, %02X, %04X, %04X", menuString, applicationType, - applicationManufacturer, manufacturerCode); + free(m_menuString); + m_menuString = GetString(l, &d); + isyslog("CAM: %s, %02X, %04X, %04X", m_menuString, m_applicationType, + m_applicationManufacturer, m_manufacturerCode); } - state = 2; + m_state = 2; break; default: esyslog("ERROR: CI application information: unknown tag %06X", Tag); return false; } } - else if (state == 0) { + else if (m_state == 0) { dbgprotocol("%d: ==> Application Info Enq\n", SessionId()); SendData(AOT_APPLICATION_INFO_ENQ); - state = 1; + m_state = 1; } return true; } bool cCiApplicationInformation::EnterMenu(void) { - if (state == 2 && time(nullptr) - creationTime > WRKRND_TIME_BEFORE_ENTER_MENU) { + if (m_state == 2 && time(nullptr) - m_creationTime > WRKRND_TIME_BEFORE_ENTER_MENU) { dbgprotocol("%d: ==> Enter Menu\n", SessionId()); SendData(AOT_ENTER_MENU); return true;//XXX @@ -987,7 +987,7 @@ bool cCiApplicationInformation::EnterMenu(void) class cCiConditionalAccessSupport : public cCiSession { private: - int state {0}; + int m_state {0}; int m_numCaSystemIds {0}; unsigned short m_caSystemIds[MAXCASYSTEMIDS + 1] {0}; // list is zero terminated! bool m_needCaPmt {false}; @@ -1038,24 +1038,24 @@ bool cCiConditionalAccessSupport::Process(int Length, const uint8_t *Data) } dbgprotocol("\n"); } - state = 2; + m_state = 2; m_needCaPmt = true; break; default: esyslog("ERROR: CI conditional access support: unknown tag %06X", Tag); return false; } } - else if (state == 0) { + else if (m_state == 0) { dbgprotocol("%d: ==> Ca Info Enq\n", SessionId()); SendData(AOT_CA_INFO_ENQ); - state = 1; + m_state = 1; } return true; } bool cCiConditionalAccessSupport::SendPMT(cCiCaPmt &CaPmt) { - if (state == 2) { + if (m_state == 2) { SendData(AOT_CA_PMT, CaPmt.m_length, CaPmt.m_capmt); m_needCaPmt = false; return true; @@ -1067,9 +1067,9 @@ bool cCiConditionalAccessSupport::SendPMT(cCiCaPmt &CaPmt) class cCiDateTime : public cCiSession { private: - int interval; - time_t lastTime; - int timeOffset; + int m_interval; + time_t m_lastTime; + int m_timeOffset; bool SendDateTime(void); public: cCiDateTime(int SessionId, cCiTransportConnection *Tc); @@ -1080,16 +1080,16 @@ class cCiDateTime : public cCiSession { cCiDateTime::cCiDateTime(int SessionId, cCiTransportConnection *Tc) :cCiSession(SessionId, RI_DATE_TIME, Tc) { - interval = 0; - lastTime = 0; - timeOffset = 0; + m_interval = 0; + m_lastTime = 0; + m_timeOffset = 0; dbgprotocol("New Date Time (session id %d)\n", SessionId); } void cCiDateTime::SetTimeOffset(double offset) { - timeOffset = (int) offset; - dbgprotocol("New Time Offset: %i secs\n", timeOffset); + m_timeOffset = (int) offset; + dbgprotocol("New Time Offset: %i secs\n", m_timeOffset); } bool cCiDateTime::SendDateTime(void) @@ -1099,10 +1099,10 @@ bool cCiDateTime::SendDateTime(void) struct tm tm_loc {}; // Avoid using signed time_t types - if (timeOffset < 0) - t -= (time_t)(-timeOffset); + if (m_timeOffset < 0) + t -= (time_t)(-m_timeOffset); else - t += (time_t)(timeOffset); + t += (time_t)(m_timeOffset); if (gmtime_r(&t, &tm_gmt) && localtime_r(&t, &tm_loc)) { int Y = tm_gmt.tm_year; @@ -1138,13 +1138,13 @@ bool cCiDateTime::Process(int Length, const uint8_t *Data) int Tag = GetTag(Length, &Data); switch (Tag) { case AOT_DATE_TIME_ENQ: { - interval = 0; + m_interval = 0; int l = 0; const uint8_t *d = GetData(Data, l); if (l > 0) - interval = *d; - dbgprotocol("%d: <== Date Time Enq, interval = %d\n", SessionId(), interval); - lastTime = time(nullptr); + m_interval = *d; + dbgprotocol("%d: <== Date Time Enq, interval = %d\n", SessionId(), m_interval); + m_lastTime = time(nullptr); return SendDateTime(); } break; @@ -1152,8 +1152,8 @@ bool cCiDateTime::Process(int Length, const uint8_t *Data) return false; } } - else if (interval && time(nullptr) - lastTime > interval) { - lastTime = time(nullptr); + else if (m_interval && time(nullptr) - m_lastTime > m_interval) { + m_lastTime = time(nullptr); return SendDateTime(); } return true; @@ -1203,13 +1203,13 @@ bool cCiDateTime::Process(int Length, const uint8_t *Data) class cCiMMI : public cCiSession { private: char *GetText(int &Length, const uint8_t **Data); - cCiMenu *menu; - cCiEnquiry *enquiry; + cCiMenu *m_menu; + cCiEnquiry *m_enquiry; public: cCiMMI(int SessionId, cCiTransportConnection *Tc); ~cCiMMI() override; bool Process(int Length = 0, const uint8_t *Data = nullptr) override; // cCiSession - bool HasUserIO(void) override { return menu || enquiry; } // cCiSession + bool HasUserIO(void) override { return m_menu || m_enquiry; } // cCiSession cCiMenu *Menu(void); cCiEnquiry *Enquiry(void); bool SendMenuAnswer(uint8_t Selection); @@ -1220,14 +1220,14 @@ cCiMMI::cCiMMI(int SessionId, cCiTransportConnection *Tc) :cCiSession(SessionId, RI_MMI, Tc) { dbgprotocol("New MMI (session id %d)\n", SessionId); - menu = nullptr; - enquiry = nullptr; + m_menu = nullptr; + m_enquiry = nullptr; } cCiMMI::~cCiMMI() { - delete menu; - delete enquiry; + delete m_menu; + delete m_enquiry; } char *cCiMMI::GetText(int &Length, const uint8_t **Data) @@ -1262,10 +1262,10 @@ bool cCiMMI::Process(int Length, const uint8_t *Data) switch (*d) { case DCC_SET_MMI_MODE: if (l == 2 && *++d == MM_HIGH_LEVEL) { - struct tDisplayReply { uint8_t id; uint8_t mode; }; + struct tDisplayReply { uint8_t m_id; uint8_t m_mode; }; tDisplayReply dr {}; - dr.id = DRI_MMI_MODE_ACK; - dr.mode = MM_HIGH_LEVEL; + dr.m_id = DRI_MMI_MODE_ACK; + dr.m_mode = MM_HIGH_LEVEL; dbgprotocol("%d: ==> Display Reply\n", SessionId()); SendData(AOT_DISPLAY_REPLY, 2, (uint8_t *)&dr); } @@ -1279,21 +1279,21 @@ bool cCiMMI::Process(int Length, const uint8_t *Data) case AOT_LIST_LAST: case AOT_MENU_LAST: { dbgprotocol("%d: <== Menu Last\n", SessionId()); - delete menu; - menu = new cCiMenu(this, Tag == AOT_MENU_LAST); + delete m_menu; + m_menu = new cCiMenu(this, Tag == AOT_MENU_LAST); int l = 0; const uint8_t *d = GetData(Data, l); if (l > 0) { // since the specification allows choiceNb to be undefined it is useless, so let's just skip it: d++; l--; - if (l > 0) menu->m_titleText = GetText(l, &d); - if (l > 0) menu->m_subTitleText = GetText(l, &d); - if (l > 0) menu->m_bottomText = GetText(l, &d); + if (l > 0) m_menu->m_titleText = GetText(l, &d); + if (l > 0) m_menu->m_subTitleText = GetText(l, &d); + if (l > 0) m_menu->m_bottomText = GetText(l, &d); while (l > 0) { char *s = GetText(l, &d); if (s) { - if (!menu->AddEntry(s)) + if (!m_menu->AddEntry(s)) free(s); } else @@ -1304,19 +1304,19 @@ bool cCiMMI::Process(int Length, const uint8_t *Data) break; case AOT_ENQ: { dbgprotocol("%d: <== Enq\n", SessionId()); - delete enquiry; - enquiry = new cCiEnquiry(this); + delete m_enquiry; + m_enquiry = new cCiEnquiry(this); int l = 0; const uint8_t *d = GetData(Data, l); if (l > 0) { uint8_t blind = *d++; //XXX GetByte()??? l--; - enquiry->m_blind = ((blind & EF_BLIND) != 0); - enquiry->m_expectedLength = *d++; + m_enquiry->m_blind = ((blind & EF_BLIND) != 0); + m_enquiry->m_expectedLength = *d++; l--; // I really wonder why there is no text length field here... - enquiry->m_text = CopyString(l, d); + m_enquiry->m_text = CopyString(l, d); } } break; @@ -1348,15 +1348,15 @@ bool cCiMMI::Process(int Length, const uint8_t *Data) cCiMenu *cCiMMI::Menu(void) { - cCiMenu *m = menu; - menu = nullptr; + cCiMenu *m = m_menu; + m_menu = nullptr; return m; } cCiEnquiry *cCiMMI::Enquiry(void) { - cCiEnquiry *e = enquiry; - enquiry = nullptr; + cCiEnquiry *e = m_enquiry; + m_enquiry = nullptr; return e; } @@ -1371,12 +1371,12 @@ bool cCiMMI::SendMenuAnswer(uint8_t Selection) bool cCiMMI::SendAnswer(const char *Text) { dbgprotocol("%d: ==> Answ\n", SessionId()); - struct tAnswer { uint8_t id; char text[256]; };//XXX + struct tAnswer { uint8_t m_id; char m_text[256]; };//XXX tAnswer answer {}; - answer.id = Text ? AI_ANSWER : AI_CANCEL; + answer.m_id = Text ? AI_ANSWER : AI_CANCEL; if (Text) { - strncpy(answer.text, Text, sizeof(answer.text) - 1); - answer.text[255] = '\0'; + strncpy(answer.m_text, Text, sizeof(answer.m_text) - 1); + answer.m_text[255] = '\0'; } SendData(AOT_ANSW, Text ? strlen(Text) + 1 : 1, (uint8_t *)&answer); //XXX return value of all SendData() calls??? @@ -1799,7 +1799,7 @@ cCiMenu *cLlCiHandler::GetMenu(void) { cMutexLock MutexLock(&m_mutex); for (int Slot = 0; Slot < m_numSlots; Slot++) { - cCiMMI *mmi = dynamic_cast<cCiMMI *>(GetSessionByResourceId(RI_MMI, Slot)); + auto *mmi = dynamic_cast<cCiMMI *>(GetSessionByResourceId(RI_MMI, Slot)); if (mmi) return mmi->Menu(); } @@ -1810,7 +1810,7 @@ cCiEnquiry *cLlCiHandler::GetEnquiry(void) { cMutexLock MutexLock(&m_mutex); for (int Slot = 0; Slot < m_numSlots; Slot++) { - cCiMMI *mmi = dynamic_cast<cCiMMI *>(GetSessionByResourceId(RI_MMI, Slot)); + auto *mmi = dynamic_cast<cCiMMI *>(GetSessionByResourceId(RI_MMI, Slot)); if (mmi) return mmi->Enquiry(); } @@ -1851,7 +1851,7 @@ bool cLlCiHandler::Reset(int Slot) return m_tpl->ResetSlot(Slot); } -bool cLlCiHandler::connected() const +bool cLlCiHandler::connected() { return _connected; } diff --git a/mythtv/libs/libmythtv/recorders/dvbdev/dvbci.h b/mythtv/libs/libmythtv/recorders/dvbdev/dvbci.h index e0136dc9a9f..478c76ae20d 100644 --- a/mythtv/libs/libmythtv/recorders/dvbdev/dvbci.h +++ b/mythtv/libs/libmythtv/recorders/dvbdev/dvbci.h @@ -168,7 +168,7 @@ class cLlCiHandler : public cCiHandler { cCiSession *m_sessions[MAX_CI_SESSION] {}; cCiTransportLayer *m_tpl {nullptr}; cCiTransportConnection *m_tc {nullptr}; - int ResourceIdToInt(const uint8_t *Data); + static int ResourceIdToInt(const uint8_t *Data); bool Send(uint8_t Tag, int SessionId, int ResourceId = 0, int Status = -1); cCiSession *GetSessionBySessionId(int SessionId); cCiSession *GetSessionByResourceId(int ResourceId, int Slot); @@ -196,7 +196,7 @@ class cLlCiHandler : public cCiHandler { bool SetCaPmt(cCiCaPmt &CaPmt, int Slot) override; // cCiHandler void SetTimeOffset(double offset_in_seconds) override; // cCiHandler bool Reset(int Slot); - bool connected() const; + static bool connected(); }; class cHlCiHandler : public cCiHandler { diff --git a/mythtv/libs/libmythtv/recorders/dvbstreamhandler.cpp b/mythtv/libs/libmythtv/recorders/dvbstreamhandler.cpp index 9a885285f3f..5da4233a3a8 100644 --- a/mythtv/libs/libmythtv/recorders/dvbstreamhandler.cpp +++ b/mythtv/libs/libmythtv/recorders/dvbstreamhandler.cpp @@ -159,7 +159,7 @@ void DVBStreamHandler::RunTS(void) int remainder = 0; int buffer_size = TSPacket::kSize * 15000; - unsigned char *buffer = new unsigned char[buffer_size]; + auto *buffer = new unsigned char[buffer_size]; if (!buffer) { LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to allocate memory"); @@ -354,7 +354,7 @@ void DVBStreamHandler::RunSR(void) LOG(VB_RECORD, LOG_DEBUG, LOC + "RunSR(): " + "end"); } -typedef vector<uint> pid_list_t; +using pid_list_t = vector<uint>; static pid_list_t::iterator find( const PIDInfoMap &map, @@ -407,14 +407,12 @@ void DVBStreamHandler::CycleFiltersByPriority(void) // if we can open a filter, just do it // find first closed filter after first open an filter "k" - pid_list_t::iterator open = find( - m_pid_info, priority_queue[i], + auto open = find(m_pid_info, priority_queue[i], priority_queue[i].begin(), priority_queue[i].end(), true); if (open == priority_queue[i].end()) open = priority_queue[i].begin(); - pid_list_t::iterator closed = find( - m_pid_info, priority_queue[i], + auto closed = find(m_pid_info, priority_queue[i], open, priority_queue[i].end(), false); if (closed == priority_queue[i].end()) @@ -429,7 +427,7 @@ void DVBStreamHandler::CycleFiltersByPriority(void) // if we can't open a filter, try to close a lower priority one bool freed = false; - for (PIDPriority j = (PIDPriority)((int)i - 1); + for (auto j = (PIDPriority)((int)i - 1); (j > kPIDPriorityNone) && !freed; j = (PIDPriority)((int)j-1)) { diff --git a/mythtv/libs/libmythtv/recorders/firewirechannel.cpp b/mythtv/libs/libmythtv/recorders/firewirechannel.cpp index a7e193bb557..5d8f9dd4e71 100644 --- a/mythtv/libs/libmythtv/recorders/firewirechannel.cpp +++ b/mythtv/libs/libmythtv/recorders/firewirechannel.cpp @@ -5,6 +5,9 @@ * Distributed as part of MythTV under GPL v2 and later. */ +// C/C++ includes +#include <utility> + #include "mythlogging.h" #include "tv_rec.h" #include "linuxfirewiredevice.h" @@ -15,23 +18,23 @@ #define LOC QString("FireChan[%1](%2): ").arg(m_inputid).arg(FirewireChannel::GetDevice()) -FirewireChannel::FirewireChannel(TVRec *parent, const QString &_videodevice, - const FireWireDBOptions &firewire_opts) : +FirewireChannel::FirewireChannel(TVRec *parent, QString _videodevice, + FireWireDBOptions firewire_opts) : DTVChannel(parent), - m_videodevice(_videodevice), - m_fw_opts(firewire_opts) + m_videodevice(std::move(_videodevice)), + m_fw_opts(std::move(firewire_opts)) { uint64_t guid = string_to_guid(m_videodevice); uint subunitid = 0; // we only support first tuner on STB... #ifdef USING_LINUX_FIREWIRE m_device = new LinuxFirewireDevice( - guid, subunitid, m_fw_opts.speed, - LinuxFirewireDevice::kConnectionP2P == (uint) m_fw_opts.connection); + guid, subunitid, m_fw_opts.m_speed, + LinuxFirewireDevice::kConnectionP2P == (uint) m_fw_opts.m_connection); #endif // USING_LINUX_FIREWIRE #ifdef USING_OSX_FIREWIRE - m_device = new DarwinFirewireDevice(guid, subunitid, m_fw_opts.speed); + m_device = new DarwinFirewireDevice(guid, subunitid, m_fw_opts.m_speed); #endif // USING_OSX_FIREWIRE } @@ -57,11 +60,11 @@ bool FirewireChannel::Open(void) if (!m_inputid) return false; - if (!FirewireDevice::IsSTBSupported(m_fw_opts.model) && + if (!FirewireDevice::IsSTBSupported(m_fw_opts.m_model) && !IsExternalChannelChangeInUse()) { LOG(VB_GENERAL, LOG_ERR, LOC + - QString("Model: '%1' is not supported.").arg(m_fw_opts.model)); + QString("Model: '%1' is not supported.").arg(m_fw_opts.m_model)); return false; } @@ -153,7 +156,7 @@ bool FirewireChannel::Tune(const QString &freqid, int /*finetune*/) return true; // signal monitor will call retune later... } - if (!m_device->SetChannel(m_fw_opts.model, 0, channel)) + if (!m_device->SetChannel(m_fw_opts.m_model, 0, channel)) return false; m_current_channel = channel; diff --git a/mythtv/libs/libmythtv/recorders/firewirechannel.h b/mythtv/libs/libmythtv/recorders/firewirechannel.h index 49b2db6c464..2a23c4dddd8 100644 --- a/mythtv/libs/libmythtv/recorders/firewirechannel.h +++ b/mythtv/libs/libmythtv/recorders/firewirechannel.h @@ -17,8 +17,8 @@ class FirewireChannel : public DTVChannel friend class FirewireRecorder; public: - FirewireChannel(TVRec *parent, const QString &videodevice, - const FireWireDBOptions &firewire_opts); + FirewireChannel(TVRec *parent, QString videodevice, + FireWireDBOptions firewire_opts); virtual ~FirewireChannel(); // Commands diff --git a/mythtv/libs/libmythtv/recorders/firewiredevice.cpp b/mythtv/libs/libmythtv/recorders/firewiredevice.cpp index 1b22d7c8507..9d292e78279 100644 --- a/mythtv/libs/libmythtv/recorders/firewiredevice.cpp +++ b/mythtv/libs/libmythtv/recorders/firewiredevice.cpp @@ -37,9 +37,7 @@ void FirewireDevice::AddListener(TSDataListener *listener) { if (listener) { - vector<TSDataListener*>::iterator it = - find(m_listeners.begin(), m_listeners.end(), listener); - + auto it = find(m_listeners.begin(), m_listeners.end(), listener); if (it == m_listeners.end()) m_listeners.push_back(listener); } @@ -50,7 +48,7 @@ void FirewireDevice::AddListener(TSDataListener *listener) void FirewireDevice::RemoveListener(TSDataListener *listener) { - vector<TSDataListener*>::iterator it = m_listeners.end(); + auto it = m_listeners.end(); do { @@ -316,7 +314,7 @@ void FirewireDevice::BroadcastToListeners( ProcessPATPacket(*((const TSPacket*)data)); } - vector<TSDataListener*>::iterator it = m_listeners.begin(); + auto it = m_listeners.begin(); for (; it != m_listeners.end(); ++it) (*it)->AddData(data, dataSize); } diff --git a/mythtv/libs/libmythtv/recorders/firewiredevice.h b/mythtv/libs/libmythtv/recorders/firewiredevice.h index 64783b7af0a..2ad03288aba 100644 --- a/mythtv/libs/libmythtv/recorders/firewiredevice.h +++ b/mythtv/libs/libmythtv/recorders/firewiredevice.h @@ -26,16 +26,16 @@ class FirewireDevice public: // Public enums - typedef enum + enum PowerState { kAVCPowerOn, kAVCPowerOff, kAVCPowerUnknown, kAVCPowerQueryFailed, - } PowerState; + }; // AVC commands - typedef enum + enum IEEE1394Command { kAVCControlCommand = 0x00, kAVCStatusInquiryCommand = 0x01, @@ -52,10 +52,10 @@ class FirewireDevice kAVCInterimStatus = 0x0f, kAVCResponseImplemented = 0x0c, - } IEEE1394Command; + }; // AVC unit addresses - typedef enum + enum IEEE1394UnitAddress { kAVCSubunitId0 = 0x00, kAVCSubunitId1 = 0x01, @@ -80,10 +80,10 @@ class FirewireDevice kAVCSubunitTypeVendorUnique = (0x1c << 3), kAVCSubunitTypeExtended = (0x1e << 3), kAVCSubunitTypeUnit = (0x1f << 3), - } IEEE1394UnitAddress; + }; // AVC opcode - typedef enum + enum IEEE1394Opcode { // Unit kAVCUnitPlugInfoOpcode = 0x02, @@ -115,17 +115,17 @@ class FirewireDevice // Panel kAVCPanelPassThrough = 0x7c, - } IEEE1394Opcode; + }; // AVC param 0 - typedef enum + enum IEEE1394UnitPowerParam0 { kAVCPowerStateOn = 0x70, kAVCPowerStateOff = 0x60, kAVCPowerStateQuery = 0x7f, - } IEEE1394UnitPowerParam0; + }; - typedef enum + enum IEEE1394PanelPassThroughParam0 { kAVCPanelKeySelect = 0x00, kAVCPanelKeyUp = 0x01, @@ -188,7 +188,7 @@ class FirewireDevice kAVCPanelKeyPress = 0x00, kAVCPanelKeyRelease = 0x80, - } IEEE1394PanelPassThroughParam0; + }; virtual ~FirewireDevice() = default; diff --git a/mythtv/libs/libmythtv/recorders/firewiresignalmonitor.cpp b/mythtv/libs/libmythtv/recorders/firewiresignalmonitor.cpp index 352f1ba3477..61cc4264736 100644 --- a/mythtv/libs/libmythtv/recorders/firewiresignalmonitor.cpp +++ b/mythtv/libs/libmythtv/recorders/firewiresignalmonitor.cpp @@ -90,7 +90,7 @@ void FirewireSignalMonitor::HandlePAT(const ProgramAssociationTable *pat) { AddFlags(kDTVSigMon_PATSeen); - FirewireChannel *fwchan = dynamic_cast<FirewireChannel*>(m_channel); + auto *fwchan = dynamic_cast<FirewireChannel*>(m_channel); if (!fwchan) return; @@ -137,7 +137,7 @@ void FirewireSignalMonitor::RunTableMonitor(void) LOG(VB_CHANNEL, LOG_INFO, LOC + "RunTableMonitor(): -- begin"); - FirewireChannel *lchan = dynamic_cast<FirewireChannel*>(m_channel); + auto *lchan = dynamic_cast<FirewireChannel*>(m_channel); if (!lchan) { LOG(VB_CHANNEL, LOG_INFO, LOC + "RunTableMonitor(): -- err"); @@ -209,7 +209,7 @@ void FirewireSignalMonitor::UpdateValues(void) } m_stb_needs_to_wait_for_power = false; - FirewireChannel *fwchan = dynamic_cast<FirewireChannel*>(m_channel); + auto *fwchan = dynamic_cast<FirewireChannel*>(m_channel); if (!fwchan) return; diff --git a/mythtv/libs/libmythtv/recorders/hdhrchannel.cpp b/mythtv/libs/libmythtv/recorders/hdhrchannel.cpp index 587273d2fc6..9b00f579a43 100644 --- a/mythtv/libs/libmythtv/recorders/hdhrchannel.cpp +++ b/mythtv/libs/libmythtv/recorders/hdhrchannel.cpp @@ -18,6 +18,8 @@ // C++ includes #include <algorithm> +#include <utility> + using namespace std; // MythTV includes @@ -30,9 +32,9 @@ using namespace std; #define LOC QString("HDHRChan[%1](%2): ").arg(m_inputid).arg(HDHRChannel::GetDevice()) -HDHRChannel::HDHRChannel(TVRec *parent, const QString &device) +HDHRChannel::HDHRChannel(TVRec *parent, QString device) : DTVChannel(parent), - m_device_id(device) + m_device_id(std::move(device)) { RegisterForMaster(m_device_id); } diff --git a/mythtv/libs/libmythtv/recorders/hdhrchannel.h b/mythtv/libs/libmythtv/recorders/hdhrchannel.h index 88f996b4249..7fcee1864b5 100644 --- a/mythtv/libs/libmythtv/recorders/hdhrchannel.h +++ b/mythtv/libs/libmythtv/recorders/hdhrchannel.h @@ -23,7 +23,7 @@ class HDHRChannel : public DTVChannel friend class HDHRRecorder; public: - HDHRChannel(TVRec *parent, const QString &device); + HDHRChannel(TVRec *parent, QString device); ~HDHRChannel(void); bool Open(void) override; // ChannelBase diff --git a/mythtv/libs/libmythtv/recorders/hdhrstreamhandler.cpp b/mythtv/libs/libmythtv/recorders/hdhrstreamhandler.cpp index c747826d7a9..2b5d1258003 100644 --- a/mythtv/libs/libmythtv/recorders/hdhrstreamhandler.cpp +++ b/mythtv/libs/libmythtv/recorders/hdhrstreamhandler.cpp @@ -38,8 +38,7 @@ HDHRStreamHandler *HDHRStreamHandler::Get(const QString &devname, if (it == s_handlers.end()) { - HDHRStreamHandler *newhandler = new HDHRStreamHandler(devname, inputid, - majorid); + auto *newhandler = new HDHRStreamHandler(devname, inputid, majorid); newhandler->Open(); s_handlers[majorid] = newhandler; s_handlers_refcnt[majorid] = 1; diff --git a/mythtv/libs/libmythtv/recorders/hlsstreamhandler.cpp b/mythtv/libs/libmythtv/recorders/hlsstreamhandler.cpp index ed1f68114c6..4d5e49ecc16 100644 --- a/mythtv/libs/libmythtv/recorders/hlsstreamhandler.cpp +++ b/mythtv/libs/libmythtv/recorders/hlsstreamhandler.cpp @@ -33,7 +33,7 @@ HLSStreamHandler* HLSStreamHandler::Get(const IPTVTuningData& tuning, int inputi if (it == s_hlshandlers.end()) { - HLSStreamHandler* newhandler = new HLSStreamHandler(tuning, inputid); + auto* newhandler = new HLSStreamHandler(tuning, inputid); newhandler->Start(); s_hlshandlers[devkey] = newhandler; s_hlshandlers_refcnt[devkey] = 1; diff --git a/mythtv/libs/libmythtv/recorders/httptsstreamhandler.cpp b/mythtv/libs/libmythtv/recorders/httptsstreamhandler.cpp index 91677804c69..97942c45de4 100644 --- a/mythtv/libs/libmythtv/recorders/httptsstreamhandler.cpp +++ b/mythtv/libs/libmythtv/recorders/httptsstreamhandler.cpp @@ -26,7 +26,7 @@ HTTPTSStreamHandler* HTTPTSStreamHandler::Get(const IPTVTuningData& tuning, if (it == s_httphandlers.end()) { - HTTPTSStreamHandler* newhandler = new HTTPTSStreamHandler(tuning, inputid); + auto* newhandler = new HTTPTSStreamHandler(tuning, inputid); newhandler->Start(); s_httphandlers[devkey] = newhandler; s_httphandlers_refcnt[devkey] = 1; diff --git a/mythtv/libs/libmythtv/recorders/importrecorder.cpp b/mythtv/libs/libmythtv/recorders/importrecorder.cpp index 363fe58d368..953668d65b3 100644 --- a/mythtv/libs/libmythtv/recorders/importrecorder.cpp +++ b/mythtv/libs/libmythtv/recorders/importrecorder.cpp @@ -118,7 +118,7 @@ void ImportRecorder::run(void) // build seek table if (m_import_fd && IsRecordingRequested() && !IsErrored()) { - MythCommFlagPlayer *cfp = + auto *cfp = new MythCommFlagPlayer((PlayerFlags)(kAudioMuted | kVideoIsNull | kNoITV)); RingBuffer *rb = RingBuffer::Create( m_ringBuffer->GetFilename(), false, true, 6000); @@ -126,7 +126,7 @@ void ImportRecorder::run(void) //recorded / failure status for the relevant recording SetRecordingStatus(RecStatus::Recording, __FILE__, __LINE__); - PlayerContext *ctx = new PlayerContext(kImportRecorderInUseID); + auto *ctx = new PlayerContext(kImportRecorderInUseID); ctx->SetPlayingInfo(m_curRecording); ctx->SetRingBuffer(rb); ctx->SetPlayer(cfp); diff --git a/mythtv/libs/libmythtv/recorders/iptvchannel.cpp b/mythtv/libs/libmythtv/recorders/iptvchannel.cpp index 89324b02c61..1db7692bfc1 100644 --- a/mythtv/libs/libmythtv/recorders/iptvchannel.cpp +++ b/mythtv/libs/libmythtv/recorders/iptvchannel.cpp @@ -7,6 +7,9 @@ * Distributed as part of MythTV under GPL v2 and later. */ +// C++ headers +#include <utility> + // Qt headers #include <QUrl> @@ -21,8 +24,8 @@ #define LOC QString("IPTVChan[%1]: ").arg(m_inputid) -IPTVChannel::IPTVChannel(TVRec *rec, const QString &videodev) : - DTVChannel(rec), m_videodev(videodev) +IPTVChannel::IPTVChannel(TVRec *rec, QString videodev) : + DTVChannel(rec), m_videodev(std::move(videodev)) { LOG(VB_CHANNEL, LOG_INFO, LOC + "ctor"); } @@ -127,8 +130,8 @@ void IPTVChannel::CloseStreamHandler(void) m_stream_data = nullptr; //see trac ticket #12773 } - HLSStreamHandler* hsh = dynamic_cast<HLSStreamHandler*>(m_stream_handler); - HTTPTSStreamHandler* httpsh = dynamic_cast<HTTPTSStreamHandler*>(m_stream_handler); + auto* hsh = dynamic_cast<HLSStreamHandler*>(m_stream_handler); + auto* httpsh = dynamic_cast<HTTPTSStreamHandler*>(m_stream_handler); if (hsh) { diff --git a/mythtv/libs/libmythtv/recorders/iptvchannel.h b/mythtv/libs/libmythtv/recorders/iptvchannel.h index 944d68d397b..7c6c391d6e7 100644 --- a/mythtv/libs/libmythtv/recorders/iptvchannel.h +++ b/mythtv/libs/libmythtv/recorders/iptvchannel.h @@ -27,7 +27,7 @@ class IPTVChannel : QObject, public DTVChannel friend class IPTVRecorder; public: - IPTVChannel(TVRec*, const QString&); + IPTVChannel(TVRec*, QString); ~IPTVChannel(); // Commands diff --git a/mythtv/libs/libmythtv/recorders/iptvstreamhandler.cpp b/mythtv/libs/libmythtv/recorders/iptvstreamhandler.cpp index f2cd341a6d6..cb60fe93af8 100644 --- a/mythtv/libs/libmythtv/recorders/iptvstreamhandler.cpp +++ b/mythtv/libs/libmythtv/recorders/iptvstreamhandler.cpp @@ -43,7 +43,7 @@ IPTVStreamHandler *IPTVStreamHandler::Get(const IPTVTuningData &tuning, if (it == s_iptvhandlers.end()) { - IPTVStreamHandler *newhandler = new IPTVStreamHandler(tuning, inputid); + auto *newhandler = new IPTVStreamHandler(tuning, inputid); newhandler->Start(); s_iptvhandlers[devkey] = newhandler; s_iptvhandlers_refcnt[devkey] = 1; diff --git a/mythtv/libs/libmythtv/recorders/linuxavcinfo.h b/mythtv/libs/libmythtv/recorders/linuxavcinfo.h index 40261fa893b..3431d2e4895 100644 --- a/mythtv/libs/libmythtv/recorders/linuxavcinfo.h +++ b/mythtv/libs/libmythtv/recorders/linuxavcinfo.h @@ -44,7 +44,7 @@ class LinuxAVCInfo : public AVCInfo public: raw1394handle_t m_fw_handle; }; -typedef QMap<uint64_t,LinuxAVCInfo*> avcinfo_list_t; +using avcinfo_list_t = QMap<uint64_t,LinuxAVCInfo*>; #endif // USING_LINUX_FIREWIRE diff --git a/mythtv/libs/libmythtv/recorders/linuxfirewiredevice.cpp b/mythtv/libs/libmythtv/recorders/linuxfirewiredevice.cpp index ac94575ba37..7ff5ed3c6fd 100644 --- a/mythtv/libs/libmythtv/recorders/linuxfirewiredevice.cpp +++ b/mythtv/libs/libmythtv/recorders/linuxfirewiredevice.cpp @@ -43,7 +43,7 @@ using namespace std; #define kNoDataTimeout 50 /* msec */ #define kResetTimeout 1000 /* msec */ -typedef QMap<raw1394handle_t,LinuxFirewireDevice*> handle_to_lfd_t; +using handle_to_lfd_t = QMap<raw1394handle_t,LinuxFirewireDevice*>; class LFDPriv { @@ -57,35 +57,34 @@ class LFDPriv delete (*it); m_devices.clear(); - if (m_port_handler_thread) + if (m_portHandlerThread) { - m_port_handler_thread->wait(); - delete m_port_handler_thread; + m_portHandlerThread->wait(); + delete m_portHandlerThread; } } uint m_generation {0}; - bool m_reset_timer_on {false}; - MythTimer m_reset_timer; + bool m_resetTimerOn {false}; + MythTimer m_resetTimer; - bool m_run_port_handler {false}; - bool m_is_port_handler_running {false}; - QWaitCondition m_port_handler_wait; - QMutex m_start_stop_port_handler_lock; + bool m_runPortHandler {false}; + bool m_isPortHandlerRunning {false}; + QWaitCondition m_portHandlerWait; + QMutex m_startStopPortHandlerLock; iec61883_mpeg2_t m_avstream {nullptr}; int m_channel {-1}; - int m_output_plug {-1}; - int m_input_plug {-1}; + int m_outputPlug {-1}; + int m_inputPlug {-1}; int m_bandwidth {0}; - uint m_no_data_cnt {0}; + uint m_noDataCnt {0}; - bool m_is_p2p_node_open {false}; - bool m_is_bcast_node_open {false}; - bool m_is_streaming {false}; + bool m_isP2pNodeOpen {false}; + bool m_isBcastNodeOpen {false}; + bool m_isStreaming {false}; - QDateTime m_stop_streaming_timer; - MThread *m_port_handler_thread {nullptr}; + MThread *m_portHandlerThread {nullptr}; avcinfo_list_t m_devices; @@ -168,8 +167,8 @@ void LinuxFirewireDevice::SignalReset(uint generation) UpdateDeviceList(); LOG(VB_GENERAL, LOG_INFO, loc + ": Updating device list -- end"); - m_priv->m_reset_timer_on = true; - m_priv->m_reset_timer.start(); + m_priv->m_resetTimerOn = true; + m_priv->m_resetTimer.start(); } void LinuxFirewireDevice::HandleBusReset(void) @@ -179,7 +178,7 @@ void LinuxFirewireDevice::HandleBusReset(void) if (!GetInfoPtr() || !GetInfoPtr()->m_fw_handle) return; - if (m_priv->m_is_p2p_node_open) + if (m_priv->m_isP2pNodeOpen) { LOG(VB_GENERAL, LOG_INFO, loc + ": Reconnecting P2P connection"); nodeid_t output = GetInfoPtr()->GetNode() | 0xffc0; @@ -187,8 +186,8 @@ void LinuxFirewireDevice::HandleBusReset(void) int fwchan = iec61883_cmp_reconnect( GetInfoPtr()->m_fw_handle, - output, &m_priv->m_output_plug, - input, &m_priv->m_input_plug, + output, &m_priv->m_outputPlug, + input, &m_priv->m_inputPlug, &m_priv->m_bandwidth, m_priv->m_channel); if (fwchan < 0) @@ -208,7 +207,7 @@ void LinuxFirewireDevice::HandleBusReset(void) .arg(fwchan).arg(output,0,16).arg(input,0,16)); } - if (m_priv->m_is_bcast_node_open) + if (m_priv->m_isBcastNodeOpen) { nodeid_t output = GetInfoPtr()->GetNode() | 0xffc0; @@ -218,7 +217,7 @@ void LinuxFirewireDevice::HandleBusReset(void) int err = iec61883_cmp_create_bcast_output( GetInfoPtr()->m_fw_handle, - output, m_priv->m_output_plug, + output, m_priv->m_outputPlug, m_priv->m_channel, m_speed); if (err < 0) @@ -231,7 +230,7 @@ void LinuxFirewireDevice::HandleBusReset(void) bool LinuxFirewireDevice::OpenPort(void) { LOG(VB_RECORD, LOG_INFO, LOC + "Starting Port Handler Thread"); - QMutexLocker locker(&m_priv->m_start_stop_port_handler_lock); + QMutexLocker locker(&m_priv->m_startStopPortHandlerLock); LOG(VB_RECORD, LOG_INFO, LOC + "Starting Port Handler Thread -- locked"); LOG(VB_RECORD, LOG_INFO, LOC + "OpenPort()"); @@ -272,14 +271,14 @@ bool LinuxFirewireDevice::OpenPort(void) return false; } - m_priv->m_run_port_handler = true; + m_priv->m_runPortHandler = true; LOG(VB_RECORD, LOG_INFO, LOC + "Starting port handler thread"); - m_priv->m_port_handler_thread = new MThread("LinuxController", this); - m_priv->m_port_handler_thread->start(); + m_priv->m_portHandlerThread = new MThread("LinuxController", this); + m_priv->m_portHandlerThread->start(); - while (!m_priv->m_is_port_handler_running) - m_priv->m_port_handler_wait.wait(mlocker.mutex(), 100); + while (!m_priv->m_isPortHandlerRunning) + m_priv->m_portHandlerWait.wait(mlocker.mutex(), 100); LOG(VB_RECORD, LOG_INFO, LOC + "Port handler thread started"); @@ -291,7 +290,7 @@ bool LinuxFirewireDevice::OpenPort(void) bool LinuxFirewireDevice::ClosePort(void) { LOG(VB_RECORD, LOG_INFO, LOC + "Stopping Port Handler Thread"); - QMutexLocker locker(&m_priv->m_start_stop_port_handler_lock); + QMutexLocker locker(&m_priv->m_startStopPortHandlerLock); LOG(VB_RECORD, LOG_INFO, LOC + "Stopping Port Handler Thread -- locked"); QMutexLocker mlocker(&m_lock); @@ -316,15 +315,15 @@ bool LinuxFirewireDevice::ClosePort(void) LOG(VB_RECORD, LOG_INFO, LOC + "Waiting for port handler thread to stop"); - m_priv->m_run_port_handler = false; - m_priv->m_port_handler_wait.wakeAll(); + m_priv->m_runPortHandler = false; + m_priv->m_portHandlerWait.wakeAll(); mlocker.unlock(); - m_priv->m_port_handler_thread->wait(); + m_priv->m_portHandlerThread->wait(); mlocker.relock(); - delete m_priv->m_port_handler_thread; - m_priv->m_port_handler_thread = nullptr; + delete m_priv->m_portHandlerThread; + m_priv->m_portHandlerThread = nullptr; LOG(VB_RECORD, LOG_INFO, LOC + "Joined port handler thread"); @@ -395,10 +394,10 @@ bool LinuxFirewireDevice::OpenNode(void) bool LinuxFirewireDevice::CloseNode(void) { - if (m_priv->m_is_p2p_node_open) + if (m_priv->m_isP2pNodeOpen) return CloseP2PNode(); - if (m_priv->m_is_bcast_node_open) + if (m_priv->m_isBcastNodeOpen) return CloseBroadcastNode(); return true; @@ -408,22 +407,22 @@ bool LinuxFirewireDevice::CloseNode(void) // a P2P connection first. bool LinuxFirewireDevice::OpenP2PNode(void) { - if (m_priv->m_is_bcast_node_open) + if (m_priv->m_isBcastNodeOpen) return false; - if (m_priv->m_is_p2p_node_open) + if (m_priv->m_isP2pNodeOpen) return true; LOG(VB_RECORD, LOG_INFO, LOC + "Opening P2P connection"); m_priv->m_bandwidth = +1; // +1 == allocate bandwidth - m_priv->m_output_plug = -1; // -1 == find first online plug - m_priv->m_input_plug = -1; // -1 == find first online plug + m_priv->m_outputPlug = -1; // -1 == find first online plug + m_priv->m_inputPlug = -1; // -1 == find first online plug nodeid_t output = GetInfoPtr()->GetNode() | 0xffc0; nodeid_t input = raw1394_get_local_id(GetInfoPtr()->m_fw_handle); m_priv->m_channel = iec61883_cmp_connect(GetInfoPtr()->m_fw_handle, - output, &m_priv->m_output_plug, - input, &m_priv->m_input_plug, + output, &m_priv->m_outputPlug, + input, &m_priv->m_inputPlug, &m_priv->m_bandwidth); if (m_priv->m_channel < 0) @@ -435,14 +434,14 @@ bool LinuxFirewireDevice::OpenP2PNode(void) return false; } - m_priv->m_is_p2p_node_open = true; + m_priv->m_isP2pNodeOpen = true; return true; } bool LinuxFirewireDevice::CloseP2PNode(void) { - if (m_priv->m_is_p2p_node_open && (m_priv->m_channel >= 0)) + if (m_priv->m_isP2pNodeOpen && (m_priv->m_channel >= 0)) { LOG(VB_RECORD, LOG_INFO, LOC + "Closing P2P connection"); @@ -453,14 +452,14 @@ bool LinuxFirewireDevice::CloseP2PNode(void) nodeid_t input = raw1394_get_local_id(GetInfoPtr()->m_fw_handle); iec61883_cmp_disconnect(GetInfoPtr()->m_fw_handle, - output, m_priv->m_output_plug, - input, m_priv->m_input_plug, + output, m_priv->m_outputPlug, + input, m_priv->m_inputPlug, m_priv->m_channel, m_priv->m_bandwidth); m_priv->m_channel = -1; - m_priv->m_output_plug = -1; - m_priv->m_input_plug = -1; - m_priv->m_is_p2p_node_open = false; + m_priv->m_outputPlug = -1; + m_priv->m_inputPlug = -1; + m_priv->m_isP2pNodeOpen = false; } return true; @@ -468,18 +467,18 @@ bool LinuxFirewireDevice::CloseP2PNode(void) bool LinuxFirewireDevice::OpenBroadcastNode(void) { - if (m_priv->m_is_p2p_node_open) + if (m_priv->m_isP2pNodeOpen) return false; - if (m_priv->m_is_bcast_node_open) + if (m_priv->m_isBcastNodeOpen) return true; if (m_priv->m_avstream) CloseAVStream(); m_priv->m_channel = kBroadcastChannel - GetInfoPtr()->GetNode(); - m_priv->m_output_plug = 0; - m_priv->m_input_plug = 0; + m_priv->m_outputPlug = 0; + m_priv->m_inputPlug = 0; nodeid_t output = GetInfoPtr()->GetNode() | 0xffc0; LOG(VB_RECORD, LOG_INFO, LOC + "Opening broadcast connection on " + @@ -488,7 +487,7 @@ bool LinuxFirewireDevice::OpenBroadcastNode(void) int err = iec61883_cmp_create_bcast_output( GetInfoPtr()->m_fw_handle, - output, m_priv->m_output_plug, + output, m_priv->m_outputPlug, m_priv->m_channel, m_speed); if (err != 0) @@ -496,27 +495,27 @@ bool LinuxFirewireDevice::OpenBroadcastNode(void) LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to create Broadcast connection"); m_priv->m_channel = -1; - m_priv->m_output_plug = -1; - m_priv->m_input_plug = -1; + m_priv->m_outputPlug = -1; + m_priv->m_inputPlug = -1; return false; } - m_priv->m_is_bcast_node_open = true; + m_priv->m_isBcastNodeOpen = true; return true; } bool LinuxFirewireDevice::CloseBroadcastNode(void) { - if (m_priv->m_is_bcast_node_open) + if (m_priv->m_isBcastNodeOpen) { LOG(VB_RECORD, LOG_INFO, LOC + "Closing broadcast connection"); m_priv->m_channel = -1; - m_priv->m_output_plug = -1; - m_priv->m_input_plug = -1; - m_priv->m_is_bcast_node_open = false; + m_priv->m_outputPlug = -1; + m_priv->m_inputPlug = -1; + m_priv->m_isBcastNodeOpen = false; } return true; } @@ -569,7 +568,7 @@ bool LinuxFirewireDevice::CloseAVStream(void) while (!m_listeners.empty()) FirewireDevice::RemoveListener(m_listeners[m_listeners.size() - 1]); - if (m_priv->m_is_streaming) + if (m_priv->m_isStreaming) StopStreaming(); iec61883_mpeg2_close(m_priv->m_avstream); @@ -583,31 +582,31 @@ void LinuxFirewireDevice::run(void) LOG(VB_RECORD, LOG_INFO, LOC + "RunPortHandler -- start"); m_lock.lock(); LOG(VB_RECORD, LOG_INFO, LOC + "RunPortHandler -- got first lock"); - m_priv->m_is_port_handler_running = true; - m_priv->m_port_handler_wait.wakeAll(); + m_priv->m_isPortHandlerRunning = true; + m_priv->m_portHandlerWait.wakeAll(); // we need to unlock & sleep to allow wakeAll to wake other threads. m_lock.unlock(); std::this_thread::sleep_for(std::chrono::microseconds(2500)); m_lock.lock(); - m_priv->m_no_data_cnt = 0; - while (m_priv->m_run_port_handler) + m_priv->m_noDataCnt = 0; + while (m_priv->m_runPortHandler) { LFDPriv::s_lock.lock(); - bool reset_timer_on = m_priv->m_reset_timer_on; + bool reset_timer_on = m_priv->m_resetTimerOn; bool handle_reset = reset_timer_on && - (m_priv->m_reset_timer.elapsed() > 100); + (m_priv->m_resetTimer.elapsed() > 100); if (handle_reset) - m_priv->m_reset_timer_on = false; + m_priv->m_resetTimerOn = false; LFDPriv::s_lock.unlock(); if (handle_reset) HandleBusReset(); - if (!reset_timer_on && m_priv->m_is_streaming && - (m_priv->m_no_data_cnt > (kResetTimeout / kNoDataTimeout))) + if (!reset_timer_on && m_priv->m_isStreaming && + (m_priv->m_noDataCnt > (kResetTimeout / kNoDataTimeout))) { - m_priv->m_no_data_cnt = 0; + m_priv->m_noDataCnt = 0; ResetBus(); } @@ -616,9 +615,9 @@ void LinuxFirewireDevice::run(void) { // We unlock here because this can take a long time // and we don't want to block other actions. - m_priv->m_port_handler_wait.wait(&m_lock, kNoDataTimeout); + m_priv->m_portHandlerWait.wait(&m_lock, kNoDataTimeout); - m_priv->m_no_data_cnt += (m_priv->m_is_streaming) ? 1 : 0; + m_priv->m_noDataCnt += (m_priv->m_isStreaming) ? 1 : 0; continue; } @@ -630,12 +629,12 @@ void LinuxFirewireDevice::run(void) bool ready = has_data(fwfd, kNoDataTimeout); m_lock.lock(); - if (!ready && m_priv->m_is_streaming) + if (!ready && m_priv->m_isStreaming) { - m_priv->m_no_data_cnt++; + m_priv->m_noDataCnt++; LOG(VB_GENERAL, LOG_WARNING, LOC + QString("No Input in %1 msec...") - .arg(m_priv->m_no_data_cnt * kNoDataTimeout)); + .arg(m_priv->m_noDataCnt * kNoDataTimeout)); } // Confirm that we won't block, now that we have the lock... @@ -654,16 +653,16 @@ void LinuxFirewireDevice::run(void) } } - m_priv->m_is_port_handler_running = false; - m_priv->m_port_handler_wait.wakeAll(); + m_priv->m_isPortHandlerRunning = false; + m_priv->m_portHandlerWait.wakeAll(); m_lock.unlock(); LOG(VB_RECORD, LOG_INFO, LOC + "RunPortHandler -- end"); } bool LinuxFirewireDevice::StartStreaming(void) { - if (m_priv->m_is_streaming) - return m_priv->m_is_streaming; + if (m_priv->m_isStreaming) + return m_priv->m_isStreaming; if (!IsAVStreamOpen() && !OpenAVStream()) return false; @@ -678,7 +677,7 @@ bool LinuxFirewireDevice::StartStreaming(void) if (iec61883_mpeg2_recv_start(m_priv->m_avstream, m_priv->m_channel) == 0) { - m_priv->m_is_streaming = true; + m_priv->m_isStreaming = true; } else { @@ -687,16 +686,16 @@ bool LinuxFirewireDevice::StartStreaming(void) LOG(VB_RECORD, LOG_INFO, LOC + "Starting A/V streaming -- done"); - return m_priv->m_is_streaming; + return m_priv->m_isStreaming; } bool LinuxFirewireDevice::StopStreaming(void) { - if (m_priv->m_is_streaming) + if (m_priv->m_isStreaming) { LOG(VB_RECORD, LOG_INFO, LOC + "Stopping A/V streaming -- really"); - m_priv->m_is_streaming = false; + m_priv->m_isStreaming = false; iec61883_mpeg2_recv_stop(m_priv->m_avstream); @@ -757,7 +756,7 @@ bool LinuxFirewireDevice::SetAVStreamSpeed(uint speed) bool LinuxFirewireDevice::IsNodeOpen(void) const { - return m_priv->m_is_p2p_node_open || m_priv->m_is_bcast_node_open; + return m_priv->m_isP2pNodeOpen || m_priv->m_isBcastNodeOpen; } bool LinuxFirewireDevice::IsAVStreamOpen(void) const @@ -839,19 +838,19 @@ vector<AVCInfo> LinuxFirewireDevice::GetSTBListPrivate(void) return list; } -typedef struct +struct dev_item { - raw1394handle_t handle; - int port; - int node; -} dev_item; + raw1394handle_t m_handle; + int m_port; + int m_node; +}; bool LinuxFirewireDevice::UpdateDeviceList(void) { dev_item item; - item.handle = raw1394_new_handle(); - if (!item.handle) + item.m_handle = raw1394_new_handle(); + if (!item.m_handle) { LOG(VB_GENERAL, LOG_ERR, QString("LinuxFirewireDevice: ") + "Couldn't get handle" + ENO); @@ -859,57 +858,57 @@ bool LinuxFirewireDevice::UpdateDeviceList(void) } struct raw1394_portinfo port_info[16]; - int numcards = raw1394_get_port_info(item.handle, port_info, 16); + int numcards = raw1394_get_port_info(item.m_handle, port_info, 16); if (numcards < 1) { - raw1394_destroy_handle(item.handle); + raw1394_destroy_handle(item.m_handle); return true; } map<uint64_t,bool> guid_online; for (int port = 0; port < numcards; port++) { - if (raw1394_set_port(item.handle, port) < 0) + if (raw1394_set_port(item.m_handle, port) < 0) { LOG(VB_GENERAL, LOG_ERR, QString("LinuxFirewireDevice: " "Couldn't set port to %1").arg(port)); continue; } - for (int node = 0; node < raw1394_get_nodecount(item.handle); node++) + for (int node = 0; node < raw1394_get_nodecount(item.m_handle); node++) { uint64_t guid; - guid = rom1394_get_guid(item.handle, node); - item.port = port; - item.node = node; + guid = rom1394_get_guid(item.m_handle, node); + item.m_port = port; + item.m_node = node; UpdateDeviceListItem(guid, &item); guid_online[guid] = true; } - raw1394_destroy_handle(item.handle); + raw1394_destroy_handle(item.m_handle); - item.handle = raw1394_new_handle(); - if (!item.handle) + item.m_handle = raw1394_new_handle(); + if (!item.m_handle) { LOG(VB_GENERAL, LOG_ERR, QString("LinuxFirewireDevice: ") + "Couldn't get handle " + QString("(after setting port %1").arg(port) + ENO); - item.handle = nullptr; + item.m_handle = nullptr; break; } - numcards = raw1394_get_port_info(item.handle, port_info, 16); + numcards = raw1394_get_port_info(item.m_handle, port_info, 16); } - if (item.handle) + if (item.m_handle) { - raw1394_destroy_handle(item.handle); - item.handle = nullptr; + raw1394_destroy_handle(item.m_handle); + item.m_handle = nullptr; } - item.port = -1; - item.node = -1; + item.m_port = -1; + item.m_node = -1; avcinfo_list_t::iterator it = m_priv->m_devices.begin(); for (; it != m_priv->m_devices.end(); ++it) { @@ -926,7 +925,7 @@ void LinuxFirewireDevice::UpdateDeviceListItem(uint64_t guid, void *pitem) if (it == m_priv->m_devices.end()) { - LinuxAVCInfo *ptr = new LinuxAVCInfo(); + auto *ptr = new LinuxAVCInfo(); LOG(VB_RECORD, LOG_INFO, LOC + QString("Adding 0x%1").arg(guid,0,16)); @@ -939,9 +938,9 @@ void LinuxFirewireDevice::UpdateDeviceListItem(uint64_t guid, void *pitem) dev_item &item = *((dev_item*) pitem); LOG(VB_RECORD, LOG_INFO, LOC + QString("Updating 0x%1 port: %2 node: %3") - .arg(guid,0,16).arg(item.port).arg(item.node)); + .arg(guid,0,16).arg(item.m_port).arg(item.m_node)); - (*it)->Update(guid, item.handle, item.port, item.node); + (*it)->Update(guid, item.m_handle, item.m_port, item.m_node); } } @@ -966,9 +965,7 @@ const LinuxAVCInfo *LinuxFirewireDevice::GetInfoPtr(void) const int linux_firewire_device_tspacket_handler( unsigned char *tspacket, int len, uint dropped, void *callback_data) { - LinuxFirewireDevice *fw = - reinterpret_cast<LinuxFirewireDevice*>(callback_data); - + auto *fw = reinterpret_cast<LinuxFirewireDevice*>(callback_data); if (!fw) return 0; @@ -1004,8 +1001,8 @@ static QString speed_to_string(uint speed) if (speed > 3) return QString("Invalid Speed (%1)").arg(speed); - static const uint speeds[] = { 100, 200, 400, 800 }; - return QString("%1Mbps").arg(speeds[speed]); + static constexpr uint kSpeeds[] = { 100, 200, 400, 800 }; + return QString("%1Mbps").arg(kSpeeds[speed]); } static int linux_firewire_device_bus_reset_handler( diff --git a/mythtv/libs/libmythtv/recorders/mpegrecorder.cpp b/mythtv/libs/libmythtv/recorders/mpegrecorder.cpp index bd9b0737152..828a5031e28 100644 --- a/mythtv/libs/libmythtv/recorders/mpegrecorder.cpp +++ b/mythtv/libs/libmythtv/recorders/mpegrecorder.cpp @@ -686,30 +686,30 @@ static void add_ext_ctrl(vector<struct v4l2_ext_control> &ctrl_list, static void set_ctrls(int fd, vector<struct v4l2_ext_control> &ext_ctrls) { - static QMutex control_description_lock; - static QMap<uint32_t,QString> control_description; + static QMutex s_controlDescriptionLock; + static QMap<uint32_t,QString> s_controlDescription; - control_description_lock.lock(); - if (control_description.isEmpty()) + s_controlDescriptionLock.lock(); + if (s_controlDescription.isEmpty()) { - control_description[V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ] = + s_controlDescription[V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ] = "Audio Sampling Frequency"; - control_description[V4L2_CID_MPEG_VIDEO_ASPECT] = + s_controlDescription[V4L2_CID_MPEG_VIDEO_ASPECT] = "Video Aspect ratio"; - control_description[V4L2_CID_MPEG_AUDIO_ENCODING] = + s_controlDescription[V4L2_CID_MPEG_AUDIO_ENCODING] = "Audio Encoding"; - control_description[V4L2_CID_MPEG_AUDIO_L2_BITRATE] = + s_controlDescription[V4L2_CID_MPEG_AUDIO_L2_BITRATE] = "Audio L2 Bitrate"; - control_description[V4L2_CID_MPEG_VIDEO_BITRATE_PEAK] = + s_controlDescription[V4L2_CID_MPEG_VIDEO_BITRATE_PEAK] = "Video Peak Bitrate"; - control_description[V4L2_CID_MPEG_VIDEO_BITRATE] = + s_controlDescription[V4L2_CID_MPEG_VIDEO_BITRATE] = "Video Average Bitrate"; - control_description[V4L2_CID_MPEG_STREAM_TYPE] = + s_controlDescription[V4L2_CID_MPEG_STREAM_TYPE] = "MPEG Stream type"; - control_description[V4L2_CID_MPEG_VIDEO_BITRATE_MODE] = + s_controlDescription[V4L2_CID_MPEG_VIDEO_BITRATE_MODE] = "MPEG Bitrate mode"; } - control_description_lock.unlock(); + s_controlDescriptionLock.unlock(); for (size_t i = 0; i < ext_ctrls.size(); i++) { @@ -723,10 +723,10 @@ static void set_ctrls(int fd, vector<struct v4l2_ext_control> &ext_ctrls) if (ioctl(fd, VIDIOC_S_EXT_CTRLS, &ctrls) < 0) { - QMutexLocker locker(&control_description_lock); + QMutexLocker locker(&s_controlDescriptionLock); LOG(VB_GENERAL, LOG_ERR, QString("mpegrecorder.cpp:set_ctrls(): ") + QString("Could not set %1 to %2") - .arg(control_description[ext_ctrls[i].id]).arg(value) + + .arg(s_controlDescription[ext_ctrls[i].id]).arg(value) + ENO); } } @@ -925,9 +925,9 @@ void MpegRecorder::run(void) if (m_driver == "hdpvr") { int progNum = 1; - MPEGStreamData *sd = new MPEGStreamData - (progNum, m_tvrec ? m_tvrec->GetInputId() : -1, - true); + auto *sd = new MPEGStreamData(progNum, + m_tvrec ? m_tvrec->GetInputId() : -1, + true); sd->SetRecordingType(m_recording_type); SetStreamData(sd); @@ -948,7 +948,7 @@ void MpegRecorder::run(void) m_recordingWait.wakeAll(); } - unsigned char *buffer = new unsigned char[m_bufferSize + 1]; + auto *buffer = new unsigned char[m_bufferSize + 1]; int len; int remainder = 0; diff --git a/mythtv/libs/libmythtv/recorders/recorderbase.cpp b/mythtv/libs/libmythtv/recorders/recorderbase.cpp index 84a5043e2d3..65115cb05fb 100644 --- a/mythtv/libs/libmythtv/recorders/recorderbase.cpp +++ b/mythtv/libs/libmythtv/recorders/recorderbase.cpp @@ -839,101 +839,101 @@ void RecorderBase::SetTotalFrames(uint64_t total_frames) RecorderBase *RecorderBase::CreateRecorder( TVRec *tvrec, ChannelBase *channel, - const RecordingProfile &profile, + RecordingProfile &profile, const GeneralDBOptions &genOpt) { if (!channel) return nullptr; RecorderBase *recorder = nullptr; - if (genOpt.inputtype == "MPEG") + if (genOpt.m_inputType == "MPEG") { // NOLINTNEXTLINE(bugprone-branch-clone) #ifdef USING_IVTV recorder = new MpegRecorder(tvrec); #endif // USING_IVTV } #ifdef USING_HDPVR - else if (genOpt.inputtype == "HDPVR") + else if (genOpt.m_inputType == "HDPVR") { recorder = new MpegRecorder(tvrec); } #endif // USING_HDPVR #ifdef USING_V4L2 - else if (genOpt.inputtype == "V4L2ENC") + else if (genOpt.m_inputType == "V4L2ENC") { if (dynamic_cast<V4LChannel*>(channel)) recorder = new V4L2encRecorder(tvrec, dynamic_cast<V4LChannel*>(channel)); } #endif #ifdef USING_FIREWIRE - else if (genOpt.inputtype == "FIREWIRE") + else if (genOpt.m_inputType == "FIREWIRE") { if (dynamic_cast<FirewireChannel*>(channel)) recorder = new FirewireRecorder(tvrec, dynamic_cast<FirewireChannel*>(channel)); } #endif // USING_FIREWIRE #ifdef USING_HDHOMERUN - else if (genOpt.inputtype == "HDHOMERUN") + else if (genOpt.m_inputType == "HDHOMERUN") { if (dynamic_cast<HDHRChannel*>(channel)) { recorder = new HDHRRecorder(tvrec, dynamic_cast<HDHRChannel*>(channel)); - recorder->SetBoolOption("wait_for_seqstart", genOpt.wait_for_seqstart); + recorder->SetBoolOption("wait_for_seqstart", genOpt.m_waitForSeqstart); } } #endif // USING_HDHOMERUN #ifdef USING_CETON - else if (genOpt.inputtype == "CETON") + else if (genOpt.m_inputType == "CETON") { if (dynamic_cast<CetonChannel*>(channel)) { recorder = new CetonRecorder(tvrec, dynamic_cast<CetonChannel*>(channel)); - recorder->SetBoolOption("wait_for_seqstart", genOpt.wait_for_seqstart); + recorder->SetBoolOption("wait_for_seqstart", genOpt.m_waitForSeqstart); } } #endif // USING_CETON #ifdef USING_DVB - else if (genOpt.inputtype == "DVB") + else if (genOpt.m_inputType == "DVB") { if (dynamic_cast<DVBChannel*>(channel)) { recorder = new DVBRecorder(tvrec, dynamic_cast<DVBChannel*>(channel)); - recorder->SetBoolOption("wait_for_seqstart", genOpt.wait_for_seqstart); + recorder->SetBoolOption("wait_for_seqstart", genOpt.m_waitForSeqstart); } } #endif // USING_DVB #ifdef USING_IPTV - else if (genOpt.inputtype == "FREEBOX") + else if (genOpt.m_inputType == "FREEBOX") { if (dynamic_cast<IPTVChannel*>(channel)) { recorder = new IPTVRecorder(tvrec, dynamic_cast<IPTVChannel*>(channel)); - recorder->SetOption("mrl", genOpt.videodev); + recorder->SetOption("mrl", genOpt.m_videoDev); } } #endif // USING_IPTV #ifdef USING_VBOX - else if (genOpt.inputtype == "VBOX") + else if (genOpt.m_inputType == "VBOX") { if (dynamic_cast<IPTVChannel*>(channel)) recorder = new IPTVRecorder(tvrec, dynamic_cast<IPTVChannel*>(channel)); } #endif // USING_VBOX #ifdef USING_ASI - else if (genOpt.inputtype == "ASI") + else if (genOpt.m_inputType == "ASI") { if (dynamic_cast<ASIChannel*>(channel)) { recorder = new ASIRecorder(tvrec, dynamic_cast<ASIChannel*>(channel)); - recorder->SetBoolOption("wait_for_seqstart", genOpt.wait_for_seqstart); + recorder->SetBoolOption("wait_for_seqstart", genOpt.m_waitForSeqstart); } } #endif // USING_ASI - else if (genOpt.inputtype == "IMPORT") + else if (genOpt.m_inputType == "IMPORT") { recorder = new ImportRecorder(tvrec); } - else if (genOpt.inputtype == "DEMO") + else if (genOpt.m_inputType == "DEMO") { #ifdef USING_IVTV recorder = new MpegRecorder(tvrec); @@ -942,14 +942,14 @@ RecorderBase *RecorderBase::CreateRecorder( #endif } #if CONFIG_LIBMP3LAME && defined(USING_V4L2) - else if (CardUtil::IsV4L(genOpt.inputtype)) + else if (CardUtil::IsV4L(genOpt.m_inputType)) { // V4L/MJPEG/GO7007 from here on recorder = new NuppelVideoRecorder(tvrec, channel); - recorder->SetBoolOption("skipbtaudio", genOpt.skip_btaudio); + recorder->SetBoolOption("skipbtaudio", genOpt.m_skipBtAudio); } #endif // USING_V4L2 - else if (genOpt.inputtype == "EXTERNAL") + else if (genOpt.m_inputType == "EXTERNAL") { if (dynamic_cast<ExternalChannel*>(channel)) recorder = new ExternalRecorder(tvrec, dynamic_cast<ExternalChannel*>(channel)); @@ -957,18 +957,17 @@ RecorderBase *RecorderBase::CreateRecorder( if (recorder) { - recorder->SetOptionsFromProfile( - const_cast<RecordingProfile*>(&profile), - genOpt.videodev, genOpt.audiodev, genOpt.vbidev); + recorder->SetOptionsFromProfile(&profile, + genOpt.m_videoDev, genOpt.m_audioDev, genOpt.m_vbiDev); // Override the samplerate defined in the profile if this card // was configured with a fixed rate. - if (genOpt.audiosamplerate) - recorder->SetOption("samplerate", genOpt.audiosamplerate); + if (genOpt.m_audioSampleRate) + recorder->SetOption("samplerate", genOpt.m_audioSampleRate); } else { QString msg = "Need %1 recorder, but compiled without %2 support!"; - msg = msg.arg(genOpt.inputtype).arg(genOpt.inputtype); + msg = msg.arg(genOpt.m_inputType).arg(genOpt.m_inputType); LOG(VB_GENERAL, LOG_ERR, "RecorderBase::CreateRecorder() Error, " + msg); } diff --git a/mythtv/libs/libmythtv/recorders/recorderbase.h b/mythtv/libs/libmythtv/recorders/recorderbase.h index 012bcc908db..daf53a9d63c 100644 --- a/mythtv/libs/libmythtv/recorders/recorderbase.h +++ b/mythtv/libs/libmythtv/recorders/recorderbase.h @@ -245,7 +245,7 @@ class MTV_PUBLIC RecorderBase : public QRunnable static RecorderBase *CreateRecorder( TVRec *tvrec, ChannelBase *channel, - const RecordingProfile &profile, + RecordingProfile &profile, const GeneralDBOptions &genOpt); protected: diff --git a/mythtv/libs/libmythtv/recorders/signalmonitor.cpp b/mythtv/libs/libmythtv/recorders/signalmonitor.cpp index 2f2f06d8ea6..63e40d8ce7b 100644 --- a/mythtv/libs/libmythtv/recorders/signalmonitor.cpp +++ b/mythtv/libs/libmythtv/recorders/signalmonitor.cpp @@ -100,7 +100,7 @@ SignalMonitor *SignalMonitor::Init(const QString& cardtype, int db_cardnum, #ifdef USING_DVB else if (CardUtil::IsDVBInputType(cardtype)) { - DVBChannel *dvbc = dynamic_cast<DVBChannel*>(channel); + auto *dvbc = dynamic_cast<DVBChannel*>(channel); if (dvbc) signalMonitor = new DVBSignalMonitor(db_cardnum, dvbc, release_stream); @@ -110,14 +110,14 @@ SignalMonitor *SignalMonitor::Init(const QString& cardtype, int db_cardnum, #ifdef USING_V4L2 else if ((cardtype.toUpper() == "HDPVR")) { - V4LChannel *chan = dynamic_cast<V4LChannel*>(channel); + auto *chan = dynamic_cast<V4LChannel*>(channel); if (chan) signalMonitor = new AnalogSignalMonitor(db_cardnum, chan, release_stream); } else if (cardtype.toUpper() == "V4L2ENC") { - V4LChannel *chan = dynamic_cast<V4LChannel*>(channel); + auto *chan = dynamic_cast<V4LChannel*>(channel); if (chan) signalMonitor = new V4L2encSignalMonitor(db_cardnum, chan, release_stream); @@ -127,7 +127,7 @@ SignalMonitor *SignalMonitor::Init(const QString& cardtype, int db_cardnum, #ifdef USING_HDHOMERUN else if (cardtype.toUpper() == "HDHOMERUN") { - HDHRChannel *hdhrc = dynamic_cast<HDHRChannel*>(channel); + auto *hdhrc = dynamic_cast<HDHRChannel*>(channel); if (hdhrc) signalMonitor = new HDHRSignalMonitor(db_cardnum, hdhrc, release_stream); @@ -137,7 +137,7 @@ SignalMonitor *SignalMonitor::Init(const QString& cardtype, int db_cardnum, #ifdef USING_CETON else if (cardtype.toUpper() == "CETON") { - CetonChannel *cetonchan = dynamic_cast<CetonChannel*>(channel); + auto *cetonchan = dynamic_cast<CetonChannel*>(channel); if (cetonchan) signalMonitor = new CetonSignalMonitor(db_cardnum, cetonchan, release_stream); @@ -147,7 +147,7 @@ SignalMonitor *SignalMonitor::Init(const QString& cardtype, int db_cardnum, #ifdef USING_IPTV else if (cardtype.toUpper() == "FREEBOX") { - IPTVChannel *fbc = dynamic_cast<IPTVChannel*>(channel); + auto *fbc = dynamic_cast<IPTVChannel*>(channel); if (fbc) signalMonitor = new IPTVSignalMonitor(db_cardnum, fbc, release_stream); @@ -157,7 +157,7 @@ SignalMonitor *SignalMonitor::Init(const QString& cardtype, int db_cardnum, #ifdef USING_VBOX else if (cardtype.toUpper() == "VBOX") { - IPTVChannel *fbc = dynamic_cast<IPTVChannel*>(channel); + auto *fbc = dynamic_cast<IPTVChannel*>(channel); if (fbc) signalMonitor = new IPTVSignalMonitor(db_cardnum, fbc, release_stream); @@ -167,7 +167,7 @@ SignalMonitor *SignalMonitor::Init(const QString& cardtype, int db_cardnum, #ifdef USING_FIREWIRE else if (cardtype.toUpper() == "FIREWIRE") { - FirewireChannel *fc = dynamic_cast<FirewireChannel*>(channel); + auto *fc = dynamic_cast<FirewireChannel*>(channel); if (fc) signalMonitor = new FirewireSignalMonitor(db_cardnum, fc, release_stream); @@ -177,7 +177,7 @@ SignalMonitor *SignalMonitor::Init(const QString& cardtype, int db_cardnum, #ifdef USING_ASI else if (cardtype.toUpper() == "ASI") { - ASIChannel *fc = dynamic_cast<ASIChannel*>(channel); + auto *fc = dynamic_cast<ASIChannel*>(channel); if (fc) signalMonitor = new ASISignalMonitor(db_cardnum, fc, release_stream); @@ -186,7 +186,7 @@ SignalMonitor *SignalMonitor::Init(const QString& cardtype, int db_cardnum, else if (cardtype.toUpper() == "EXTERNAL") { - ExternalChannel *fc = dynamic_cast<ExternalChannel*>(channel); + auto *fc = dynamic_cast<ExternalChannel*>(channel); if (fc) signalMonitor = new ExternalSignalMonitor(db_cardnum, fc, release_stream); @@ -406,8 +406,7 @@ void SignalMonitor::SendMessage( for (size_t i = 0; i < m_listeners.size(); i++) { SignalMonitorListener *listener = m_listeners[i]; - DVBSignalMonitorListener *dvblistener = - dynamic_cast<DVBSignalMonitorListener*>(listener); + auto *dvblistener = dynamic_cast<DVBSignalMonitorListener*>(listener); switch (type) { diff --git a/mythtv/libs/libmythtv/recorders/streamhandler.cpp b/mythtv/libs/libmythtv/recorders/streamhandler.cpp index 39296d2bba7..604a5b85fc8 100644 --- a/mythtv/libs/libmythtv/recorders/streamhandler.cpp +++ b/mythtv/libs/libmythtv/recorders/streamhandler.cpp @@ -245,7 +245,7 @@ bool StreamHandler::RemoveAllPIDFilters(void) del_pids.push_back(it.key()); bool ok = true; - vector<int>::iterator dit = del_pids.begin(); + auto dit = del_pids.begin(); for (; dit != del_pids.end(); ++dit) ok &= RemovePIDFilter(*dit); @@ -325,7 +325,7 @@ bool StreamHandler::UpdateFiltersFromStreamData(void) // Remove PIDs bool ok = true; - vector<uint>::iterator dit = del_pids.begin(); + auto dit = del_pids.begin(); for (; dit != del_pids.end(); ++dit) ok &= RemovePIDFilter(*dit); diff --git a/mythtv/libs/libmythtv/recorders/streamhandler.h b/mythtv/libs/libmythtv/recorders/streamhandler.h index 43500fdbca0..89376da430c 100644 --- a/mythtv/libs/libmythtv/recorders/streamhandler.h +++ b/mythtv/libs/libmythtv/recorders/streamhandler.h @@ -45,7 +45,7 @@ class PIDInfo // Please do not change this to hash or other unordered container. // HDHRStreamHandler::UpdateFilters() relies on the forward // iterator returning these in order of ascending pid number. -typedef QMap<uint,PIDInfo*> PIDInfoMap; +using PIDInfoMap = QMap<uint,PIDInfo*>; // locking order // _pid_lock -> _listener_lock @@ -138,7 +138,7 @@ class StreamHandler : protected MThread, public DeviceReaderCB QString m_mpts_base_file; QMutex m_mpts_lock; - typedef QMap<MPEGStreamData*,QString> StreamDataList; + using StreamDataList = QMap<MPEGStreamData*,QString>; mutable QMutex m_listener_lock {QMutex::Recursive}; StreamDataList m_stream_data_list; }; diff --git a/mythtv/libs/libmythtv/recorders/v4l2encsignalmonitor.cpp b/mythtv/libs/libmythtv/recorders/v4l2encsignalmonitor.cpp index fe70a6e0ca7..6a6fb20e1e9 100644 --- a/mythtv/libs/libmythtv/recorders/v4l2encsignalmonitor.cpp +++ b/mythtv/libs/libmythtv/recorders/v4l2encsignalmonitor.cpp @@ -140,7 +140,7 @@ void V4L2encSignalMonitor::UpdateValues(void) kDTVSigMon_WaitForMGT | kDTVSigMon_WaitForVCT | kDTVSigMon_WaitForNIT | kDTVSigMon_WaitForSDT)) { - V4LChannel* chn = reinterpret_cast<V4LChannel*>(m_channel); + auto* chn = reinterpret_cast<V4LChannel*>(m_channel); m_stream_handler = V4L2encStreamHandler::Get(chn->GetDevice(), chn->GetAudioDevice().toInt(), m_inputid); diff --git a/mythtv/libs/libmythtv/recorders/v4l2encsignalmonitor.h b/mythtv/libs/libmythtv/recorders/v4l2encsignalmonitor.h index 4c29899dc0b..ff2bde89557 100644 --- a/mythtv/libs/libmythtv/recorders/v4l2encsignalmonitor.h +++ b/mythtv/libs/libmythtv/recorders/v4l2encsignalmonitor.h @@ -11,7 +11,7 @@ class V4L2encStreamHandler; -typedef QMap<uint,int> FilterMap; +using FilterMap = QMap<uint,int>; class V4L2encSignalMonitor: public DTVSignalMonitor { diff --git a/mythtv/libs/libmythtv/recorders/v4l2encstreamhandler.cpp b/mythtv/libs/libmythtv/recorders/v4l2encstreamhandler.cpp index fd35e919887..62f29b3d442 100644 --- a/mythtv/libs/libmythtv/recorders/v4l2encstreamhandler.cpp +++ b/mythtv/libs/libmythtv/recorders/v4l2encstreamhandler.cpp @@ -66,9 +66,7 @@ V4L2encStreamHandler *V4L2encStreamHandler::Get(const QString &devname, if (it == s_handlers.end()) { - V4L2encStreamHandler *newhandler = new V4L2encStreamHandler(devname, - audioinput, - inputid); + auto *newhandler = new V4L2encStreamHandler(devname, audioinput, inputid); s_handlers[devkey] = newhandler; s_handlers_refcnt[devkey] = 1; diff --git a/mythtv/libs/libmythtv/recorders/v4lchannel.h b/mythtv/libs/libmythtv/recorders/v4lchannel.h index 97c2d714d9d..65a542f1334 100644 --- a/mythtv/libs/libmythtv/recorders/v4lchannel.h +++ b/mythtv/libs/libmythtv/recorders/v4lchannel.h @@ -8,7 +8,7 @@ #ifdef USING_V4L2 #include "videodev2.h" // needed for v4l2_std_id type #else -typedef uint64_t v4l2_std_id; +using v4l2_std_id = uint64_t; #endif using namespace std; @@ -17,7 +17,7 @@ using namespace std; class TVRec; -typedef QMap<int,v4l2_std_id> VidModV4L2; +using VidModV4L2 = QMap<int,v4l2_std_id>; /** \class V4LChannel * \brief Implements tuning for TV cards using the V4L driver API, diff --git a/mythtv/libs/libmythtv/recorders/v4lrecorder.cpp b/mythtv/libs/libmythtv/recorders/v4lrecorder.cpp index 0f39e53d938..c6f324db1a4 100644 --- a/mythtv/libs/libmythtv/recorders/v4lrecorder.cpp +++ b/mythtv/libs/libmythtv/recorders/v4lrecorder.cpp @@ -74,7 +74,7 @@ static void vbi_event(struct VBIData *data, struct vt_event *ev) { case EV_PAGE: { - struct vt_page *vtp = (struct vt_page *) ev->p1; + auto *vtp = (struct vt_page *) ev->p1; if (vtp->flags & PG_SUBTITLE) { #if 0 diff --git a/mythtv/libs/libmythtv/recorders/vbitext/lang.c b/mythtv/libs/libmythtv/recorders/vbitext/lang.c index 10371fc3e59..017312d1da3 100644 --- a/mythtv/libs/libmythtv/recorders/vbitext/lang.c +++ b/mythtv/libs/libmythtv/recorders/vbitext/lang.c @@ -17,7 +17,7 @@ static unsigned char lang_char[256]; -static struct mark { const char *g0, *latin1, *latin2; } marks[16] = +static struct mark { const char *m_g0, *m_latin1, *m_latin2; } marks[16] = { /* none */ { "#", "\xA4", /* ¤ */ @@ -176,12 +176,12 @@ do_enhancements(struct enhance *eh, struct vt_page *vtp) struct mark *mark = marks + (mode - 16); char *x; - if ((x = strchr(mark->g0, data))) + if ((x = strchr(mark->m_g0, data))) { if (latin1) - data = mark->latin1[x - mark->g0]; + data = mark->m_latin1[x - mark->m_g0]; else - data = mark->latin2[x - mark->g0]; + data = mark->m_latin2[x - mark->m_g0]; } vtp->data[row][adr] = data; } diff --git a/mythtv/libs/libmythtv/recorders/vbitext/vbi.c b/mythtv/libs/libmythtv/recorders/vbitext/vbi.c index 91254ee7d8b..7dfaeebb92f 100644 --- a/mythtv/libs/libmythtv/recorders/vbitext/vbi.c +++ b/mythtv/libs/libmythtv/recorders/vbitext/vbi.c @@ -606,14 +606,14 @@ setup_dev(struct vbi *vbi) struct vbi * vbi_open(const char *vbi_dev_name, struct cache *ca, int fine_tune, int big_buf) { - static int inited = 0; + static int s_inited = 0; struct vbi *vbi = 0; (void)ca; - if (! inited) + if (! s_inited) lang_init(); - inited = 1; + s_inited = 1; if (!(vbi = malloc(sizeof(*vbi)))) { diff --git a/mythtv/libs/libmythtv/recorders/vboxutils.cpp b/mythtv/libs/libmythtv/recorders/vboxutils.cpp index 68339d3aa2f..0b58770570a 100644 --- a/mythtv/libs/libmythtv/recorders/vboxutils.cpp +++ b/mythtv/libs/libmythtv/recorders/vboxutils.cpp @@ -193,7 +193,7 @@ QString VBox::getIPFromVideoDevice(const QString& dev) QDomDocument *VBox::getBoardInfo(void) { - QDomDocument *xmlDoc = new QDomDocument(); + auto *xmlDoc = new QDomDocument(); QString query = QUERY_BOARDINFO; query.replace("{URL}", m_url); @@ -294,8 +294,8 @@ QStringList VBox::getTuners(void) vbox_chan_map_t *VBox::getChannels(void) { - vbox_chan_map_t *result = new vbox_chan_map_t; - QDomDocument *xmlDoc = new QDomDocument(); + auto *result = new vbox_chan_map_t; + auto *xmlDoc = new QDomDocument(); QString query = QUERY_CHANNELS; query.replace("{URL}", m_url); diff --git a/mythtv/libs/libmythtv/recorders/vboxutils.h b/mythtv/libs/libmythtv/recorders/vboxutils.h index c50ee518d46..f704865cdef 100644 --- a/mythtv/libs/libmythtv/recorders/vboxutils.h +++ b/mythtv/libs/libmythtv/recorders/vboxutils.h @@ -40,14 +40,14 @@ class VBox REQUEST_ABOTRED = 8 }; - bool sendQuery(const QString &query, QDomDocument *xmlDoc); + static bool sendQuery(const QString &query, QDomDocument *xmlDoc); QString m_url; private: static QStringList doUPNPSearch(void); - QString getFirstText(QDomElement &element); - QString getStrValue(QDomElement &element, const QString &name, int index = 0); - int getIntValue(QDomElement &element, const QString &name, int index = 0); + static QString getFirstText(QDomElement &element); + static QString getStrValue(QDomElement &element, const QString &name, int index = 0); + static int getIntValue(QDomElement &element, const QString &name, int index = 0); }; #endif // _VBOX_UTILS_H_ diff --git a/mythtv/libs/libmythtv/recordingfile.h b/mythtv/libs/libmythtv/recordingfile.h index 5c9432aebae..0db12340de0 100644 --- a/mythtv/libs/libmythtv/recordingfile.h +++ b/mythtv/libs/libmythtv/recordingfile.h @@ -9,13 +9,13 @@ class RecordingRule; -typedef enum AVContainerFormats +enum AVContainer { formatUnknown = 0, formatNUV = 1, formatMPEG2_TS = 2, formatMPEG2_PS = 3 -} AVContainer; +}; /** \class RecordingFile * \brief Holds information on a recording file and it's video and audio streams diff --git a/mythtv/libs/libmythtv/recordinginfo.h b/mythtv/libs/libmythtv/recordinginfo.h index cc5def134a1..2890c1a0e7f 100644 --- a/mythtv/libs/libmythtv/recordinginfo.h +++ b/mythtv/libs/libmythtv/recordinginfo.h @@ -29,7 +29,7 @@ class RecordingRule; class RecordingInfo; class RecordingRule; -typedef AutoDeleteDeque<RecordingInfo*> RecordingList; +using RecordingList = AutoDeleteDeque<RecordingInfo*>; class MTV_PUBLIC RecordingInfo : public ProgramInfo { @@ -176,21 +176,21 @@ class MTV_PUBLIC RecordingInfo : public ProgramInfo // Create ProgramInfo that overlaps the desired time on the // specified channel id. - typedef enum { + enum LoadStatus { kNoProgram = 0, kFoundProgram = 1, kFakedLiveTVProgram = 2, kFakedZeroMinProgram = 3, - } LoadStatus; + }; RecordingInfo(uint _chanid, const QDateTime &desiredts, bool genUnknown, uint maxHours = 0, LoadStatus *status = nullptr); - typedef enum { + enum SpecialRecordingGroups { kDefaultRecGroup = 1, // Auto-increment columns start at one kLiveTVRecGroup = 2, kDeletedRecGroup = 3, - } SpecialRecordingGroups; + }; public: RecordingInfo &operator=(const RecordingInfo &other) diff --git a/mythtv/libs/libmythtv/recordingprofile.cpp b/mythtv/libs/libmythtv/recordingprofile.cpp index a86d6ec6e23..ad59402d9fa 100644 --- a/mythtv/libs/libmythtv/recordingprofile.cpp +++ b/mythtv/libs/libmythtv/recordingprofile.cpp @@ -25,7 +25,7 @@ class CodecParamStorage : public SimpleDBStorage const RecordingProfile &parentProfile, const QString& name) : SimpleDBStorage(_setting, "codecparams", "value"), - m_parent(parentProfile), codecname(name) + m_parent(parentProfile), m_codecName(name) { _setting->setName(name); } @@ -34,7 +34,7 @@ class CodecParamStorage : public SimpleDBStorage QString GetWhereClause(MSqlBindings &bindings) const override; // SimpleDBStorage const RecordingProfile &m_parent; - QString codecname; + QString m_codecName; }; QString CodecParamStorage::GetSetClause(MSqlBindings &bindings) const @@ -47,7 +47,7 @@ QString CodecParamStorage::GetSetClause(MSqlBindings &bindings) const + ", value = " + valueTag); bindings.insert(profileTag, m_parent.getProfileNum()); - bindings.insert(nameTag, codecname); + bindings.insert(nameTag, m_codecName); bindings.insert(valueTag, m_user->GetDBValue()); return query; @@ -61,7 +61,7 @@ QString CodecParamStorage::GetWhereClause(MSqlBindings &bindings) const QString query("profile = " + profileTag + " AND name = " + nameTag); bindings.insert(profileTag, m_parent.getProfileNum()); - bindings.insert(nameTag, codecname); + bindings.insert(nameTag, m_codecName); return query; } @@ -117,13 +117,13 @@ class SampleRate : public MythUIComboBoxSetting, public CodecParamStorage "Ensure that you choose a sampling rate appropriate " "for your device. btaudio may only allow 32000.")); - rates.push_back(32000); - rates.push_back(44100); - rates.push_back(48000); + m_rates.push_back(32000); + m_rates.push_back(44100); + m_rates.push_back(48000); - allowed_rate[48000] = true; - for (uint i = 0; analog && (i < rates.size()); i++) - allowed_rate[rates[i]] = true; + m_allowedRate[48000] = true; + for (uint i = 0; analog && (i < m_rates.size()); i++) + m_allowedRate[m_rates[i]] = true; }; @@ -133,16 +133,16 @@ class SampleRate : public MythUIComboBoxSetting, public CodecParamStorage QString val = getValue(); clearSelections(); - for (size_t i = 0; i < rates.size(); i++) + for (size_t i = 0; i < m_rates.size(); i++) { - if (allowed_rate[rates[i]]) - addSelection(QString::number(rates[i])); + if (m_allowedRate[m_rates[i]]) + addSelection(QString::number(m_rates[i])); } int which = getValueIndex(val); setValue(max(which,0)); - if (allowed_rate.size() <= 1) + if (m_allowedRate.size() <= 1) setEnabled(false); } @@ -152,7 +152,7 @@ class SampleRate : public MythUIComboBoxSetting, public CodecParamStorage { QString val = value.isEmpty() ? label : value; uint rate = val.toUInt(); - if (allowed_rate[rate]) + if (m_allowedRate[rate]) { MythUIComboBoxSetting::addSelection(label, value, select); } @@ -164,8 +164,8 @@ class SampleRate : public MythUIComboBoxSetting, public CodecParamStorage } } - vector<uint> rates; - QMap<uint,bool> allowed_rate; + vector<uint> m_rates; + QMap<uint,bool> m_allowedRate; }; class MPEG2audType : public MythUIComboBoxSetting, public CodecParamStorage @@ -174,21 +174,21 @@ class MPEG2audType : public MythUIComboBoxSetting, public CodecParamStorage MPEG2audType(const RecordingProfile &parent, bool layer1, bool layer2, bool layer3) : MythUIComboBoxSetting(this), CodecParamStorage(this, parent, "mpeg2audtype"), - allow_layer1(layer1), allow_layer2(layer2), allow_layer3(layer3) + m_allowLayer1(layer1), m_allowLayer2(layer2), m_allowLayer3(layer3) { setLabel(QObject::tr("Type")); - if (allow_layer1) + if (m_allowLayer1) addSelection("Layer I"); - if (allow_layer2) + if (m_allowLayer2) addSelection("Layer II"); - if (allow_layer3) + if (m_allowLayer3) addSelection("Layer III"); uint allowed_cnt = 0; - allowed_cnt += ((allow_layer1) ? 1 : 0); - allowed_cnt += ((allow_layer2) ? 1 : 0); - allowed_cnt += ((allow_layer3) ? 1 : 0); + allowed_cnt += ((m_allowLayer1) ? 1 : 0); + allowed_cnt += ((m_allowLayer2) ? 1 : 0); + allowed_cnt += ((m_allowLayer3) ? 1 : 0); if (1 == allowed_cnt) setEnabled(false); @@ -201,22 +201,22 @@ class MPEG2audType : public MythUIComboBoxSetting, public CodecParamStorage CodecParamStorage::Load(); QString val = getValue(); - if ((val == "Layer I") && !allow_layer1) + if ((val == "Layer I") && !m_allowLayer1) { - val = (allow_layer2) ? "Layer II" : - ((allow_layer3) ? "Layer III" : val); + val = (m_allowLayer2) ? "Layer II" : + ((m_allowLayer3) ? "Layer III" : val); } - if ((val == "Layer II") && !allow_layer2) + if ((val == "Layer II") && !m_allowLayer2) { - val = (allow_layer3) ? "Layer III" : - ((allow_layer1) ? "Layer I" : val); + val = (m_allowLayer3) ? "Layer III" : + ((m_allowLayer1) ? "Layer I" : val); } - if ((val == "Layer III") && !allow_layer3) + if ((val == "Layer III") && !m_allowLayer3) { - val = (allow_layer2) ? "Layer II" : - ((allow_layer1) ? "Layer I" : val); + val = (m_allowLayer2) ? "Layer II" : + ((m_allowLayer1) ? "Layer I" : val); } if (getValue() != val) @@ -228,9 +228,9 @@ class MPEG2audType : public MythUIComboBoxSetting, public CodecParamStorage } private: - bool allow_layer1; - bool allow_layer2; - bool allow_layer3; + bool m_allowLayer1; + bool m_allowLayer2; + bool m_allowLayer3; }; class MPEG2audBitrateL1 : public MythUIComboBoxSetting, public CodecParamStorage @@ -342,8 +342,7 @@ class MPEG2AudioBitrateSettings : public GroupSetting setLabel(QObject::tr("Bitrate Settings")); - MPEG2audType *audType = new MPEG2audType( - parent, layer1, layer2, layer3); + auto *audType = new MPEG2audType(parent, layer1, layer2, layer3); addChild(audType); @@ -952,7 +951,7 @@ class VideoCompressionSettings : public GroupSetting m_codecName->addTargetedChild(label, new PeakBitrate(m_parent)); label = "MPEG-4 AVC Hardware Encoder"; - GroupSetting *h0 = new GroupSetting(); + auto *h0 = new GroupSetting(); h0->setLabel(QObject::tr("Low Resolution")); h0->addChild(new AverageBitrate(m_parent, "low_mpeg4avgbitrate", 1000, 13500, 4500, 500)); @@ -960,7 +959,7 @@ class VideoCompressionSettings : public GroupSetting 1100, 20200, 6000, 500)); m_codecName->addTargetedChild(label, h0); - GroupSetting *h1 = new GroupSetting(); + auto *h1 = new GroupSetting(); h1->setLabel(QObject::tr("Medium Resolution")); h1->addChild(new AverageBitrate(m_parent, "medium_mpeg4avgbitrate", 1000, 13500, 9000, 500)); @@ -968,7 +967,7 @@ class VideoCompressionSettings : public GroupSetting 1100, 20200, 11000, 500)); m_codecName->addTargetedChild(label, h1); - GroupSetting *h2 = new GroupSetting(); + auto *h2 = new GroupSetting(); h2->setLabel(QObject::tr("High Resolution")); h2->addChild(new AverageBitrate(m_parent, "high_mpeg4avgbitrate", 1000, 13500, 13500, 500)); @@ -1004,9 +1003,9 @@ class VideoCompressionSettings : public GroupSetting QStringList::iterator Icodec = m_v4l2codecs.begin(); for ( ; Icodec < m_v4l2codecs.end(); ++Icodec) { - GroupSetting* bit_low = new GroupSetting(); - GroupSetting* bit_medium = new GroupSetting(); - GroupSetting* bit_high = new GroupSetting(); + auto* bit_low = new GroupSetting(); + auto* bit_medium = new GroupSetting(); + auto* bit_high = new GroupSetting(); bool dynamic_res = !v4l2->UserAdjustableResolution(); for (auto Iopt = options.begin() ; Iopt != options.end(); ++Iopt) @@ -1017,7 +1016,7 @@ class VideoCompressionSettings : public GroupSetting new MPEG2streamType(m_parent, (*Iopt).m_minimum, (*Iopt).m_maximum, - (*Iopt).m_default_value)); + (*Iopt).m_defaultValue)); } else if ((*Iopt).m_category == DriverOption::VIDEO_ASPECT) { @@ -1025,7 +1024,7 @@ class VideoCompressionSettings : public GroupSetting new MPEG2aspectRatio(m_parent, (*Iopt).m_minimum, (*Iopt).m_maximum, - (*Iopt).m_default_value)); + (*Iopt).m_defaultValue)); } else if ((*Iopt).m_category == DriverOption::VIDEO_BITRATE_MODE) @@ -1051,7 +1050,7 @@ class VideoCompressionSettings : public GroupSetting "low_mpegavgbitrate", (*Iopt).m_minimum / 1000, (*Iopt).m_maximum / 1000, - (*Iopt).m_default_value / 1000, + (*Iopt).m_defaultValue / 1000, (*Iopt).m_step / 1000)); bit_medium->setLabel(QObject:: @@ -1060,7 +1059,7 @@ class VideoCompressionSettings : public GroupSetting "medium_mpegavgbitrate", (*Iopt).m_minimum / 1000, (*Iopt).m_maximum / 1000, - (*Iopt).m_default_value / 1000, + (*Iopt).m_defaultValue / 1000, (*Iopt).m_step / 1000)); bit_high->setLabel(QObject:: @@ -1069,7 +1068,7 @@ class VideoCompressionSettings : public GroupSetting "high_mpegavgbitrate", (*Iopt).m_minimum / 1000, (*Iopt).m_maximum / 1000, - (*Iopt).m_default_value / 1000, + (*Iopt).m_defaultValue / 1000, (*Iopt).m_step / 1000)); } else @@ -1079,7 +1078,7 @@ class VideoCompressionSettings : public GroupSetting "mpeg2bitrate", (*Iopt).m_minimum / 1000, (*Iopt).m_maximum / 1000, - (*Iopt).m_default_value / 1000, + (*Iopt).m_defaultValue / 1000, (*Iopt).m_step / 1000)); } } @@ -1092,19 +1091,19 @@ class VideoCompressionSettings : public GroupSetting "low_mpegpeakbitrate", (*Iopt).m_minimum / 1000, (*Iopt).m_maximum / 1000, - (*Iopt).m_default_value / 1000, + (*Iopt).m_defaultValue / 1000, (*Iopt).m_step / 1000)); bit_medium->addChild(new PeakBitrate(m_parent, "medium_mpegpeakbitrate", (*Iopt).m_minimum / 1000, (*Iopt).m_maximum / 1000, - (*Iopt).m_default_value / 1000, + (*Iopt).m_defaultValue / 1000, (*Iopt).m_step / 1000)); bit_high->addChild(new PeakBitrate(m_parent, "high_mpegpeakbitrate", (*Iopt).m_minimum / 1000, (*Iopt).m_maximum / 1000, - (*Iopt).m_default_value / 1000, + (*Iopt).m_defaultValue / 1000, (*Iopt).m_step / 1000)); } else @@ -1112,7 +1111,7 @@ class VideoCompressionSettings : public GroupSetting "mpeg2maxbitrate", (*Iopt).m_minimum / 1000, (*Iopt).m_maximum / 1000, - (*Iopt).m_default_value / 1000, + (*Iopt).m_defaultValue / 1000, (*Iopt).m_step / 1000)); } } @@ -1654,28 +1653,26 @@ void RecordingProfile::setCodecTypes() } RecordingProfileEditor::RecordingProfileEditor(int id, QString profName) : - group(id), labelName(std::move(profName)) + m_group(id), m_labelName(std::move(profName)) { - if (!labelName.isEmpty()) - setLabel(labelName); + if (!m_labelName.isEmpty()) + setLabel(m_labelName); } void RecordingProfileEditor::Load(void) { clearSettings(); - ButtonStandardSetting *newProfile = - new ButtonStandardSetting(tr("(Create new profile)")); + auto *newProfile = new ButtonStandardSetting(tr("(Create new profile)")); connect(newProfile, SIGNAL(clicked()), SLOT(ShowNewProfileDialog())); addChild(newProfile); - RecordingProfile::fillSelections(this, group); + RecordingProfile::fillSelections(this, m_group); StandardSetting::Load(); } void RecordingProfileEditor::ShowNewProfileDialog() { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythTextInputDialog *settingdialog = - new MythTextInputDialog(popupStack, + auto *settingdialog = new MythTextInputDialog(popupStack, tr("Enter the name of the new profile")); if (settingdialog->Create()) @@ -1701,7 +1698,7 @@ void RecordingProfileEditor::CreateNewProfile(const QString& profName) query.bindValue(":NAME", profName); query.bindValue(":VIDEOCODEC", "MPEG-4"); query.bindValue(":AUDIOCODEC", "MP3"); - query.bindValue(":PROFILEGROUP", group); + query.bindValue(":PROFILEGROUP", m_group); if (!query.exec()) { MythDB::DBError("RecordingProfileEditor::open", query); @@ -1713,7 +1710,7 @@ void RecordingProfileEditor::CreateNewProfile(const QString& profName) "FROM recordingprofiles " "WHERE name = :NAME AND profilegroup = :PROFILEGROUP;"); query.bindValue(":NAME", profName); - query.bindValue(":PROFILEGROUP", group); + query.bindValue(":PROFILEGROUP", m_group); if (!query.exec()) { MythDB::DBError("RecordingProfileEditor::open", query); @@ -1722,7 +1719,7 @@ void RecordingProfileEditor::CreateNewProfile(const QString& profName) { if (query.next()) { - RecordingProfile* profile = new RecordingProfile(profName); + auto* profile = new RecordingProfile(profName); profile->loadByID(query.value(0).toInt()); profile->setCodecTypes(); @@ -1740,7 +1737,7 @@ void RecordingProfile::fillSelections(GroupSetting *setting, int group, { for (uint i = 0; !availProfiles[i].isEmpty(); i++) { - GroupSetting *profile = new GroupSetting(); + auto *profile = new GroupSetting(); profile->setLabel(availProfiles[i]); setting->addChild(profile); } @@ -1768,7 +1765,7 @@ void RecordingProfile::fillSelections(GroupSetting *setting, int group, if (group == RecordingProfile::TranscoderGroup && foldautodetect) { QString id = QString::number(RecordingProfile::TranscoderAutodetect); - GroupSetting *profile = new GroupSetting(); + auto *profile = new GroupSetting(); profile->setLabel(QObject::tr("Autodetect")); setting->addChild(profile); } @@ -1784,7 +1781,7 @@ void RecordingProfile::fillSelections(GroupSetting *setting, int group, { if (!foldautodetect) { - RecordingProfile *profile = + auto *profile = new RecordingProfile(QObject::tr("Autodetect from %1") .arg(name)); profile->loadByID(id.toInt()); @@ -1794,7 +1791,7 @@ void RecordingProfile::fillSelections(GroupSetting *setting, int group, } else { - RecordingProfile *profile = new RecordingProfile(name); + auto *profile = new RecordingProfile(name); profile->loadByID(id.toInt()); profile->setCodecTypes(); setting->addChild(profile); @@ -1802,7 +1799,7 @@ void RecordingProfile::fillSelections(GroupSetting *setting, int group, continue; } - RecordingProfile *profile = new RecordingProfile(name); + auto *profile = new RecordingProfile(name); profile->loadByID(id.toInt()); profile->setCodecTypes(); setting->addChild(profile); diff --git a/mythtv/libs/libmythtv/recordingprofile.h b/mythtv/libs/libmythtv/recordingprofile.h index 7f0f4179490..b5baac15cf3 100644 --- a/mythtv/libs/libmythtv/recordingprofile.h +++ b/mythtv/libs/libmythtv/recordingprofile.h @@ -102,7 +102,7 @@ class MTV_PUBLIC RecordingProfile : public GroupSetting static QString getName(int id); // Hardcoded DB group values - typedef enum RecProfileGroups + enum RecProfileGroup { AllGroups = 0, SoftwareEncoderGroup = 1, @@ -119,7 +119,7 @@ class MTV_PUBLIC RecordingProfile : public GroupSetting ASIGroup = 15, OCURGroup = 16, CetonGroup = 17 - } RecProfileGroup; + }; static QMap<int, QString> GetProfiles(RecProfileGroup group = AllGroups); static QMap<int, QString> GetTranscodingProfiles(); @@ -165,8 +165,8 @@ class RecordingProfileEditor : void CreateNewProfile(const QString&); protected: - int group; - QString labelName; + int m_group; + QString m_labelName; }; #endif diff --git a/mythtv/libs/libmythtv/recordingquality.cpp b/mythtv/libs/libmythtv/recordingquality.cpp index 82237d2dfbb..9cc3ee8c34e 100644 --- a/mythtv/libs/libmythtv/recordingquality.cpp +++ b/mythtv/libs/libmythtv/recordingquality.cpp @@ -1,4 +1,6 @@ #include <algorithm> +#include <utility> + using namespace std; #include "recordingquality.h" @@ -13,8 +15,8 @@ static QDateTime get_start(const RecordingInfo& /*ri*/); static QDateTime get_end(const RecordingInfo& /*ri*/); RecordingQuality::RecordingQuality(const RecordingInfo *ri, - const RecordingGaps &rg) - : m_recording_gaps(rg) + RecordingGaps rg) + : m_recording_gaps(std::move(rg)) { if (!ri) return; @@ -29,9 +31,9 @@ RecordingQuality::RecordingQuality(const RecordingInfo *ri, } RecordingQuality::RecordingQuality( - const RecordingInfo *ri, const RecordingGaps &rg, + const RecordingInfo *ri, RecordingGaps rg, const QDateTime &first, const QDateTime &latest) : - m_recording_gaps(rg) + m_recording_gaps(std::move(rg)) { if (!ri) return; diff --git a/mythtv/libs/libmythtv/recordingquality.h b/mythtv/libs/libmythtv/recordingquality.h index 29c99a0d504..f10fee95b06 100644 --- a/mythtv/libs/libmythtv/recordingquality.h +++ b/mythtv/libs/libmythtv/recordingquality.h @@ -27,15 +27,15 @@ class RecordingGap QDateTime m_start; QDateTime m_end; }; -typedef QList<RecordingGap> RecordingGaps; +using RecordingGaps = QList<RecordingGap>; class MTV_PUBLIC RecordingQuality { public: RecordingQuality(const RecordingInfo *ri, - const RecordingGaps &rg); + RecordingGaps rg); RecordingQuality( - const RecordingInfo*, const RecordingGaps&, + const RecordingInfo*, RecordingGaps, const QDateTime &firstData, const QDateTime &latestData); void AddTSStatistics(int continuity_error_count, int packet_count); diff --git a/mythtv/libs/libmythtv/remoteencoder.cpp b/mythtv/libs/libmythtv/remoteencoder.cpp index 9356b13c1b2..9b192a50946 100644 --- a/mythtv/libs/libmythtv/remoteencoder.cpp +++ b/mythtv/libs/libmythtv/remoteencoder.cpp @@ -142,7 +142,7 @@ ProgramInfo *RemoteEncoder::GetRecording(void) if (SendReceiveStringList(strlist)) { - ProgramInfo *proginfo = new ProgramInfo(strlist); + auto *proginfo = new ProgramInfo(strlist); if (proginfo->GetChanID()) return proginfo; delete proginfo; diff --git a/mythtv/libs/libmythtv/ringbuffer.cpp b/mythtv/libs/libmythtv/ringbuffer.cpp index e97a1259fc7..f29238d83c7 100644 --- a/mythtv/libs/libmythtv/ringbuffer.cpp +++ b/mythtv/libs/libmythtv/ringbuffer.cpp @@ -198,7 +198,7 @@ RingBuffer *RingBuffer::Create( if (!mythurl && lower.endsWith(".vob") && lfilename.contains("/VIDEO_TS/")) { LOG(VB_PLAYBACK, LOG_INFO, "DVD VOB at " + lfilename); - DVDStream *s = new DVDStream(lfilename); + auto *s = new DVDStream(lfilename); if (s && s->IsOpen()) return s; @@ -1655,9 +1655,9 @@ uint64_t RingBuffer::UpdateDecoderRate(uint64_t latest) return 0; // TODO use QDateTime once we've moved to Qt 4.7 - static QTime midnight = QTime(0, 0, 0); + static QTime s_midnight = QTime(0, 0, 0); QTime now = QTime::currentTime(); - qint64 age = midnight.msecsTo(now); + qint64 age = s_midnight.msecsTo(now); qint64 oldest = age - 1000; m_decoderReadLock.lock(); @@ -1675,7 +1675,7 @@ uint64_t RingBuffer::UpdateDecoderRate(uint64_t latest) total += it.value(); } - uint64_t average = (uint64_t)((double)total * 8.0); + auto average = (uint64_t)((double)total * 8.0); m_decoderReadLock.unlock(); LOG(VB_FILE, LOG_INFO, LOC + QString("Decoder read speed: %1 %2") @@ -1689,9 +1689,9 @@ uint64_t RingBuffer::UpdateStorageRate(uint64_t latest) return 0; // TODO use QDateTime once we've moved to Qt 4.7 - static QTime midnight = QTime(0, 0, 0); + static QTime s_midnight = QTime(0, 0, 0); QTime now = QTime::currentTime(); - qint64 age = midnight.msecsTo(now); + qint64 age = s_midnight.msecsTo(now); qint64 oldest = age - 1000; m_storageReadLock.lock(); diff --git a/mythtv/libs/libmythtv/scanwizard.cpp b/mythtv/libs/libmythtv/scanwizard.cpp index 535fe9c4a94..c9fbbae818b 100644 --- a/mythtv/libs/libmythtv/scanwizard.cpp +++ b/mythtv/libs/libmythtv/scanwizard.cpp @@ -48,7 +48,7 @@ ScanWizard::ScanWizard(uint default_sourceid, m_scannerPane(new ChannelScannerGUI()) { SetupConfig(default_sourceid, default_cardid, default_inputname); - ButtonStandardSetting *scanButton = new ButtonStandardSetting(tr("Scan")); + auto *scanButton = new ButtonStandardSetting(tr("Scan")); connect(scanButton, SIGNAL(clicked()), SLOT(Scan())); addChild(scanButton); } diff --git a/mythtv/libs/libmythtv/signalmonitorlistener.h b/mythtv/libs/libmythtv/signalmonitorlistener.h index b1aca738438..42528e4255c 100644 --- a/mythtv/libs/libmythtv/signalmonitorlistener.h +++ b/mythtv/libs/libmythtv/signalmonitorlistener.h @@ -7,7 +7,7 @@ #include "mythtvexp.h" #include "signalmonitorvalue.h" -typedef enum { +enum SignalMonitorMessageType { kAllGood, kStatusChannelTuned, kStatusSignalLock, @@ -16,7 +16,7 @@ typedef enum { kStatusBitErrorRate, kStatusUncorrectedBlocks, kStatusRotorPosition, -} SignalMonitorMessageType; +}; class MTV_PUBLIC SignalMonitorListener { diff --git a/mythtv/libs/libmythtv/signalmonitorvalue.cpp b/mythtv/libs/libmythtv/signalmonitorvalue.cpp index 603bf7221d0..590adb8d7c9 100644 --- a/mythtv/libs/libmythtv/signalmonitorvalue.cpp +++ b/mythtv/libs/libmythtv/signalmonitorvalue.cpp @@ -1,4 +1,6 @@ #include <algorithm> +#include <utility> + using namespace std; #include "signalmonitorvalue.h" @@ -32,14 +34,14 @@ void SignalMonitorValue::Init() } } -SignalMonitorValue::SignalMonitorValue(const QString& _name, - const QString& _noSpaceName, +SignalMonitorValue::SignalMonitorValue(QString _name, + QString _noSpaceName, int _threshold, bool _high_threshold, int _min, int _max, int _timeout) : - m_name(_name), - m_noSpaceName(_noSpaceName), + m_name(std::move(_name)), + m_noSpaceName(std::move(_noSpaceName)), m_value(0), m_threshold(_threshold), m_minVal(_min), m_maxVal(_max), m_timeout(_timeout), @@ -55,14 +57,14 @@ SignalMonitorValue::SignalMonitorValue(const QString& _name, #endif } -SignalMonitorValue::SignalMonitorValue(const QString& _name, - const QString& _noSpaceName, +SignalMonitorValue::SignalMonitorValue(QString _name, + QString _noSpaceName, int _value, int _threshold, bool _high_threshold, int _min, int _max, int _timeout, bool _set) : - m_name(_name), - m_noSpaceName(_noSpaceName), + m_name(std::move(_name)), + m_noSpaceName(std::move(_noSpaceName)), m_value(_value), m_threshold(_threshold), m_minVal(_min), m_maxVal(_max), m_timeout(_timeout), @@ -132,7 +134,7 @@ bool SignalMonitorValue::Set(const QString& _name, const QString& _longString) SignalMonitorValue* SignalMonitorValue::Create(const QString& _name, const QString& _longString) { - SignalMonitorValue *smv = new SignalMonitorValue(); + auto *smv = new SignalMonitorValue(); if (!smv->Set(_name, _longString)) { delete smv; @@ -175,8 +177,8 @@ SignalMonitorList SignalMonitorValue::Parse(const QStringList& slist) bool SignalMonitorValue::AllGood(const SignalMonitorList& slist) { bool good = true; - SignalMonitorList::const_iterator it = slist.begin(); - for (; it != slist.end(); ++it) + auto it = slist.cbegin(); + for (; it != slist.cend(); ++it) good &= it->IsGood(); #if DEBUG_SIGNAL_MONITOR_VALUE if (!good) @@ -205,8 +207,8 @@ bool SignalMonitorValue::AllGood(const SignalMonitorList& slist) int SignalMonitorValue::MaxWait(const SignalMonitorList& slist) { int wait = 0, minWait = 0; - SignalMonitorList::const_iterator it = slist.begin(); - for (; it != slist.end(); ++it) + auto it = slist.cbegin(); + for (; it != slist.cend(); ++it) { wait = max(wait, it->GetTimeout()); minWait = min(minWait, it->GetTimeout()); diff --git a/mythtv/libs/libmythtv/signalmonitorvalue.h b/mythtv/libs/libmythtv/signalmonitorvalue.h index bb57c3e4f9e..0f0719bb11e 100644 --- a/mythtv/libs/libmythtv/signalmonitorvalue.h +++ b/mythtv/libs/libmythtv/signalmonitorvalue.h @@ -15,9 +15,9 @@ class SignalMonitorValue { Q_DECLARE_TR_FUNCTIONS(SignalMonitorValue) - typedef vector<SignalMonitorValue> SignalMonitorList; + using SignalMonitorList = vector<SignalMonitorValue>; public: - SignalMonitorValue(const QString& _name, const QString& _noSpaceName, + SignalMonitorValue(QString _name, QString _noSpaceName, int _threshold, bool _high_threshold, int _min, int _max, int _timeout); virtual ~SignalMonitorValue() { ; } /* forces class to have vtable */ @@ -130,7 +130,7 @@ class SignalMonitorValue } private: SignalMonitorValue() = default; - SignalMonitorValue(const QString& _name, const QString& _noSpaceName, + SignalMonitorValue(QString _name, QString _noSpaceName, int _value, int _threshold, bool _high_threshold, int _min, int _max, int _timeout, bool _set); bool Set(const QString& _name, const QString& _longString); @@ -146,6 +146,6 @@ class SignalMonitorValue bool m_set {false}; // false until value initially set }; -typedef vector<SignalMonitorValue> SignalMonitorList; +using SignalMonitorList = vector<SignalMonitorValue>; #endif // SIGNALMONITORVALUES_H diff --git a/mythtv/libs/libmythtv/sourceutil.cpp b/mythtv/libs/libmythtv/sourceutil.cpp index 9d25730dbb3..31927c71ca9 100644 --- a/mythtv/libs/libmythtv/sourceutil.cpp +++ b/mythtv/libs/libmythtv/sourceutil.cpp @@ -89,13 +89,13 @@ QString SourceUtil::GetChannelSeparator(uint sourceid) } QString sep = "_"; uint max = counts["_"]; - static const char *spacers[6] = { "", "-", "#", ".", "0", nullptr }; - for (uint i=0; (spacers[i] != nullptr); ++i) + static const char *s_spacers[6] = { "", "-", "#", ".", "0", nullptr }; + for (uint i=0; (s_spacers[i] != nullptr); ++i) { - if (counts[spacers[i]] > max) + if (counts[s_spacers[i]] > max) { - max = counts[spacers[i]]; - sep = spacers[i]; + max = counts[s_spacers[i]]; + sep = s_spacers[i]; } } return sep; @@ -333,7 +333,7 @@ bool SourceUtil::IsCableCardPresent(uint sourceid) { bool ccpresent = false; vector<uint> inputs = CardUtil::GetInputIDs(sourceid); - vector<uint>::iterator it = inputs.begin(); + auto it = inputs.begin(); for (; it != inputs.end(); ++it) { if (CardUtil::IsCableCardPresent(*it, CardUtil::GetRawInputType(*it)) diff --git a/mythtv/libs/libmythtv/subtitlereader.cpp b/mythtv/libs/libmythtv/subtitlereader.cpp index 3b21c90ab59..74ca19360a0 100644 --- a/mythtv/libs/libmythtv/subtitlereader.cpp +++ b/mythtv/libs/libmythtv/subtitlereader.cpp @@ -23,7 +23,7 @@ void SubtitleReader::EnableRawTextSubtitles(bool enable) m_RawTextSubtitlesEnabled = enable; } -bool SubtitleReader::AddAVSubtitle(const AVSubtitle &subtitle, +bool SubtitleReader::AddAVSubtitle(AVSubtitle &subtitle, bool fix_position, bool allow_forced) { @@ -79,9 +79,9 @@ void SubtitleReader::ClearAVSubtitles(void) m_AVSubtitles.m_lock.unlock(); } -void SubtitleReader::FreeAVSubtitle(const AVSubtitle &subtitle) +void SubtitleReader::FreeAVSubtitle(AVSubtitle &subtitle) { - avsubtitle_free(const_cast<AVSubtitle*>(&subtitle)); + avsubtitle_free(&subtitle); } void SubtitleReader::LoadExternalSubtitles(const QString &subtitleFileName, diff --git a/mythtv/libs/libmythtv/subtitlereader.h b/mythtv/libs/libmythtv/subtitlereader.h index 90954d5de28..df74b619697 100644 --- a/mythtv/libs/libmythtv/subtitlereader.h +++ b/mythtv/libs/libmythtv/subtitlereader.h @@ -40,10 +40,10 @@ class SubtitleReader void EnableRawTextSubtitles(bool enable); AVSubtitles* GetAVSubtitles(void) { return &m_AVSubtitles; } - bool AddAVSubtitle(const AVSubtitle& subtitle, bool fix_position, + bool AddAVSubtitle(AVSubtitle& subtitle, bool fix_position, bool allow_forced); void ClearAVSubtitles(void); - void FreeAVSubtitle(const AVSubtitle &sub); + static void FreeAVSubtitle(AVSubtitle &sub); TextSubtitles* GetTextSubtitles(void) { return &m_TextSubtitles; } bool HasTextSubtitles(void); diff --git a/mythtv/libs/libmythtv/subtitlescreen.cpp b/mythtv/libs/libmythtv/subtitlescreen.cpp index 2c36b1d8f43..e248de532b0 100644 --- a/mythtv/libs/libmythtv/subtitlescreen.cpp +++ b/mythtv/libs/libmythtv/subtitlescreen.cpp @@ -248,9 +248,9 @@ SubtitleFormat::GetFont(const QString &family, { int origPixelSize = pixelSize; float scale = zoom / 100.0; - if ((attr.m_pen_size & 0x3) == k708AttrSizeSmall) + if ((attr.m_penSize & 0x3) == k708AttrSizeSmall) scale = scale * 32 / 42; - else if ((attr.m_pen_size & 0x3) == k708AttrSizeLarge) + else if ((attr.m_penSize & 0x3) == k708AttrSizeLarge) scale = scale * 42 / 32; QString prefix = MakePrefix(family, attr); @@ -288,12 +288,12 @@ SubtitleFormat::GetFont(const QString &family, { int off = lroundf(scale * pixelSize / 20); offset = QPoint(off, off); - if (attr.m_edge_type == k708AttrEdgeLeftDropShadow) + if (attr.m_edgeType == k708AttrEdgeLeftDropShadow) { shadow = true; offset.setX(-off); } - else if (attr.m_edge_type == k708AttrEdgeRightDropShadow) + else if (attr.m_edgeType == k708AttrEdgeRightDropShadow) shadow = true; else shadow = false; @@ -316,9 +316,9 @@ SubtitleFormat::GetFont(const QString &family, alpha = attr.GetFGAlpha(); if (IsUnlocked(prefix, kSubAttrOutlinesize)) { - if (attr.m_edge_type == k708AttrEdgeUniform || - attr.m_edge_type == k708AttrEdgeRaised || - attr.m_edge_type == k708AttrEdgeDepressed) + if (attr.m_edgeType == k708AttrEdgeUniform || + attr.m_edgeType == k708AttrEdgeRaised || + attr.m_edgeType == k708AttrEdgeDepressed) { outline = true; off = lroundf(scale * pixelSize / 20); @@ -357,7 +357,7 @@ QString SubtitleFormat::MakePrefix(const QString &family, const CC708CharacterAttribute &attr) { if (family == kSubFamily708) - return family + "_" + QString::number(attr.m_font_tag & 0x7); + return family + "_" + QString::number(attr.m_fontTag & 0x7); return family; } @@ -368,8 +368,8 @@ void SubtitleFormat::CreateProviderDefault(const QString &family, MythFontProperties **returnFont, MythUIShape **returnBg) { - MythFontProperties *font = new MythFontProperties(); - MythUIShape *bg = new MythUIShape(parent, kSubProvider); + auto *font = new MythFontProperties(); + auto *bg = new MythUIShape(parent, kSubProvider); if (family == kSubFamily608) { font->GetFace()->setFamily("FreeMono"); @@ -379,7 +379,7 @@ void SubtitleFormat::CreateProviderDefault(const QString &family, } else if (family == kSubFamily708) { - static const char *cc708Fonts[] = { + static const char *s_cc708Fonts[] = { "FreeMono", // default "FreeMono", // mono serif "Droid Serif", // prop serif @@ -389,7 +389,7 @@ void SubtitleFormat::CreateProviderDefault(const QString &family, "TeX Gyre Chorus", // cursive "Droid Serif" // small caps, QFont::SmallCaps will be applied }; - font->GetFace()->setFamily(cc708Fonts[attr.m_font_tag & 0x7]); + font->GetFace()->setFamily(s_cc708Fonts[attr.m_fontTag & 0x7]); } else if (family == kSubFamilyText) { @@ -454,7 +454,7 @@ void SubtitleFormat::Load(const QString &family, const CC708CharacterAttribute &attr) { // Widgets for the actual values - MythUIType *baseParent = new MythUIType(nullptr, "base"); + auto *baseParent = new MythUIType(nullptr, "base"); m_cleanup += baseParent; MythFontProperties *providerBaseFont; MythUIShape *providerBaseShape; @@ -462,7 +462,7 @@ void SubtitleFormat::Load(const QString &family, &providerBaseFont, &providerBaseShape); // Widgets for the "negative" values - MythUIType *negParent = new MythUIType(nullptr, "base"); + auto *negParent = new MythUIType(nullptr, "base"); m_cleanup += negParent; MythFontProperties *negFont; MythUIShape *negBG; @@ -481,8 +481,7 @@ void SubtitleFormat::Load(const QString &family, MythFontProperties *resultFont = baseParent->GetFont(prefix); if (!resultFont) resultFont = providerBaseFont; - MythUIShape *resultBG = - dynamic_cast<MythUIShape *>(baseParent->GetChild(prefix)); + auto *resultBG = dynamic_cast<MythUIShape *>(baseParent->GetChild(prefix)); // The providerBaseShape object is not leaked here. It is added // to a list of children in its base class constructor. @@ -491,12 +490,11 @@ void SubtitleFormat::Load(const QString &family, MythFontProperties *testFont = negParent->GetFont(prefix); if (!testFont) testFont = negFont; - MythUIShape *testBG = - dynamic_cast<MythUIShape *>(negParent->GetChild(prefix)); + auto *testBG = dynamic_cast<MythUIShape *>(negParent->GetChild(prefix)); if (!testBG) testBG = negBG; if (family == kSubFamily708 && - (attr.m_font_tag & 0x7) == k708AttrFontSmallCaps) + (attr.m_fontTag & 0x7) == k708AttrFontSmallCaps) resultFont->GetFace()->setCapitalization(QFont::SmallCaps); m_fontMap[prefix] = resultFont; m_shapeMap[prefix] = resultBG; @@ -602,8 +600,8 @@ SubtitleFormat::GetBackground(MythUIType *parent, const QString &name, Load(family, attr); if (m_shapeMap[prefix]->GetAlpha() == 0) return nullptr; - SubShape *result = new SubShape(parent, name, area, whichImageCache, - start + duration); + auto *result = new SubShape(parent, name, area, whichImageCache, + start + duration); result->CopyFrom(m_shapeMap[prefix]); if (family == kSubFamily708) { @@ -681,15 +679,15 @@ QString FormattedTextChunk::ToLogString(void) const .arg(m_format.GetBGAlpha()); str += QString("edge=%1.%2 ") .arg(srtColorString(m_format.GetEdgeColor())) - .arg(m_format.m_edge_type); + .arg(m_format.m_edgeType); str += QString("off=%1 pensize=%2 ") .arg(m_format.m_offset) - .arg(m_format.m_pen_size); + .arg(m_format.m_penSize); str += QString("it=%1 ul=%2 bf=%3 ") .arg(m_format.m_italics) .arg(m_format.m_underline) .arg(m_format.m_boldface); - str += QString("font=%1 ").arg(m_format.m_font_tag); + str += QString("font=%1 ").arg(m_format.m_fontTag); str += QString(" text='%1'").arg(m_text); return str; } @@ -883,8 +881,7 @@ void FormattedTextSubtitle::Draw(void) // shapes should be added/drawn first, and text drawn on // top. if ((*chunk).m_textRect.width() > 0) { - SubSimpleText *text = - new SubSimpleText((*chunk).m_text, *mythfont, + auto *text = new SubSimpleText((*chunk).m_text, *mythfont, (*chunk).m_textRect, Qt::AlignLeft|Qt::AlignTop, /*m_subScreen*/nullptr, @@ -1212,7 +1209,7 @@ void FormattedTextSubtitle608::Layout(void) void FormattedTextSubtitle608::Init(const vector<CC608Text*> &buffers) { - static const QColor clr[8] = + static const QColor kClr[8] = { Qt::white, Qt::green, Qt::blue, Qt::cyan, Qt::red, Qt::yellow, Qt::magenta, Qt::white, @@ -1220,7 +1217,7 @@ void FormattedTextSubtitle608::Init(const vector<CC608Text*> &buffers) if (buffers.empty()) return; - vector<CC608Text*>::const_iterator i = buffers.begin(); + auto i = buffers.cbegin(); int xscale = 36; int yscale = 17; int pixelSize = m_safeArea.height() / (yscale * LINE_SPACING); @@ -1231,7 +1228,7 @@ void FormattedTextSubtitle608::Init(const vector<CC608Text*> &buffers) { zoom = m_subScreen->GetZoom(); m_subScreen->SetFontSize(pixelSize); - CC708CharacterAttribute def_attr(false, false, false, clr[0]); + CC708CharacterAttribute def_attr(false, false, false, kClr[0]); QFont *font = m_subScreen->GetFont(def_attr)->GetFace(); QFontMetrics fm(*font); fontwidth = fm.averageCharWidth(); @@ -1241,15 +1238,15 @@ void FormattedTextSubtitle608::Init(const vector<CC608Text*> &buffers) xscale = m_safeArea.width() / fontwidth; } - for (; i != buffers.end(); ++i) + for (; i != buffers.cend(); ++i) { CC608Text *cc = (*i); int color = 0; bool isItalic = false, isUnderline = false; const bool isBold = false; - QString text(cc->text); + QString text(cc->m_text); - int orig_x = cc->x; + int orig_x = cc->m_x; // position as if we use a fixed size font // - font size already has zoom factor applied @@ -1261,7 +1258,7 @@ void FormattedTextSubtitle608::Init(const vector<CC608Text*> &buffers) // fallback x = (orig_x + 3) * m_safeArea.width() / xscale; - int orig_y = cc->y; + int orig_y = cc->m_y; int y; if (orig_y < yscale / 2) // top half -- anchor up @@ -1278,12 +1275,12 @@ void FormattedTextSubtitle608::Init(const vector<CC608Text*> &buffers) QString captionText = extract_cc608(text, color, isItalic, isUnderline); CC708CharacterAttribute attr(isItalic, isBold, isUnderline, - clr[min(max(0, color), 7)]); + kClr[min(max(0, color), 7)]); FormattedTextChunk chunk(captionText, attr, m_subScreen); line.chunks += chunk; LOG(VB_VBI, LOG_INFO, QString("Adding cc608 chunk (%1,%2): %3") - .arg(cc->x).arg(cc->y).arg(chunk.ToLogString())); + .arg(cc->m_x).arg(cc->m_y).arg(chunk.ToLogString())); } m_lines += line; } @@ -1296,8 +1293,7 @@ void FormattedTextSubtitle708::Draw(void) if (m_bgFillAlpha) // TODO border? { QBrush fill(m_bgFillColor, Qt::SolidPattern); - SubShape *shape = - new SubShape(m_subScreen, QString("cc708bg%1").arg(m_num), + auto *shape = new SubShape(m_subScreen, QString("cc708bg%1").arg(m_num), MythRect(m_bounds), m_num, m_start + m_duration); shape->SetFillBrush(fill); shape->SetArea(MythRect(m_bounds)); @@ -1334,12 +1330,12 @@ void FormattedTextSubtitle708::Init(const CC708Window &win, for (size_t i = 0; i < list.size(); i++) { - if (list[i]->y >= (uint)m_lines.size()) - m_lines.resize(list[i]->y + 1); - FormattedTextChunk chunk(list[i]->str, list[i]->attr, m_subScreen); - m_lines[list[i]->y].chunks += chunk; + if (list[i]->m_y >= (uint)m_lines.size()) + m_lines.resize(list[i]->m_y + 1); + FormattedTextChunk chunk(list[i]->m_str, list[i]->m_attr, m_subScreen); + m_lines[list[i]->m_y].chunks += chunk; LOG(VB_VBI, LOG_INFO, QString("Adding cc708 chunk: win %1 row %2: %3") - .arg(m_num).arg(list[i]->y).arg(chunk.ToLogString())); + .arg(m_num).arg(list[i]->m_y).arg(chunk.ToLogString())); } } @@ -1471,7 +1467,7 @@ void SubtitleScreen::DisplayDVDButton(AVSubtitle* dvdButton, QRect &buttonPos) uint w = hl_button->w; QRect rect = QRect(hl_button->x, hl_button->y, w, h); QImage bg_image(hl_button->data[0], w, h, w, QImage::Format_Indexed8); - uint32_t *bgpalette = (uint32_t *)(hl_button->data[1]); + auto *bgpalette = (uint32_t *)(hl_button->data[1]); QVector<uint32_t> bg_palette(4); for (int i = 0; i < 4; i++) @@ -1482,7 +1478,7 @@ void SubtitleScreen::DisplayDVDButton(AVSubtitle* dvdButton, QRect &buttonPos) const QRect fg_rect(buttonPos.translated(-hl_button->x, -hl_button->y)); QImage fg_image = bg_image.copy(fg_rect); QVector<uint32_t> fg_palette(4); - uint32_t *fgpalette = (uint32_t *)(dvdButton->rects[1]->data[1]); + auto *fgpalette = (uint32_t *)(dvdButton->rects[1]->data[1]); if (fgpalette) { for (int i = 0; i < 4; i++) @@ -1540,7 +1536,7 @@ void SubtitleScreen::Clear708Cache(uint64_t mask) for (it = list.begin(); it != list.end(); ++it) { MythUIType *child = *it; - SubWrapper *wrapper = dynamic_cast<SubWrapper *>(child); + auto *wrapper = dynamic_cast<SubWrapper *>(child); if (wrapper) { int whichImageCache = wrapper->GetWhichImageCache(); @@ -1696,7 +1692,7 @@ void SubtitleScreen::Pulse(void) { itNext = it + 1; MythUIType *child = *it; - SubWrapper *wrapper = dynamic_cast<SubWrapper *>(child); + auto *wrapper = dynamic_cast<SubWrapper *>(child); if (!wrapper) continue; @@ -1712,7 +1708,7 @@ void SubtitleScreen::Pulse(void) // Rescale the AV subtitle image if the zoom changed. if (expireTime > 0 && needRescale) { - SubImage *image = dynamic_cast<SubImage *>(child); + auto *image = dynamic_cast<SubImage *>(child); if (image) { double factor = m_textFontZoom / (double)m_textFontZoomPrev; @@ -1768,7 +1764,7 @@ void SubtitleScreen::OptimiseDisplayedArea(void) while (i.hasNext()) { MythUIType *img = i.next(); - SubWrapper *wrapper = dynamic_cast<SubWrapper *>(img); + auto *wrapper = dynamic_cast<SubWrapper *>(img); if (wrapper && img->IsVisible()) visible = visible.united(wrapper->GetOrigArea()); } @@ -1787,7 +1783,7 @@ void SubtitleScreen::OptimiseDisplayedArea(void) while (i.hasNext()) { MythUIType *img = i.next(); - SubWrapper *wrapper = dynamic_cast<SubWrapper *>(img); + auto *wrapper = dynamic_cast<SubWrapper *>(img); if (wrapper && img->IsVisible()) img->SetArea(wrapper->GetOrigArea().translated(left, top)); } @@ -1815,7 +1811,7 @@ void SubtitleScreen::DisplayAVSubtitles(void) while (!subs->m_buffers.empty()) { - const AVSubtitle subtitle = subs->m_buffers.front(); + AVSubtitle subtitle = subs->m_buffers.front(); if (subtitle.start_display_time > currentFrame->timecode) break; @@ -1904,7 +1900,7 @@ void SubtitleScreen::DisplayAVSubtitles(void) } #endif } - m_subreader->FreeAVSubtitle(subtitle); + SubtitleReader::FreeAVSubtitle(subtitle); } #ifdef USING_LIBASS RenderAssTrack(currentFrame->timecode); @@ -2183,9 +2179,8 @@ void SubtitleScreen::DisplayRawTextSubtitles(void) void SubtitleScreen::DrawTextSubtitles(const QStringList &subs, uint64_t start, uint64_t duration) { - FormattedTextSubtitleSRT *fsub = - new FormattedTextSubtitleSRT(m_family, m_safeArea, start, duration, - this, subs); + auto *fsub = new FormattedTextSubtitleSRT(m_family, m_safeArea, start, + duration, this, subs); m_qInited.append(fsub); } @@ -2210,13 +2205,12 @@ void SubtitleScreen::DisplayCC608Subtitles(void) if (!textlist) return; - QMutexLocker locker(&textlist->lock); + QMutexLocker locker(&textlist->m_lock); - if (textlist->buffers.empty()) + if (textlist->m_buffers.empty()) return; - FormattedTextSubtitle608 *fsub = - new FormattedTextSubtitle608(textlist->buffers, m_family, + auto *fsub = new FormattedTextSubtitle608(textlist->m_buffers, m_family, m_safeArea, this/*, m_textFontZoom*/); m_qInited.append(fsub); } @@ -2256,13 +2250,11 @@ void SubtitleScreen::DisplayCC708Subtitles(void) vector<CC708String*> list = win.GetStrings(); if (!list.empty()) { - FormattedTextSubtitle708 *fsub = - new FormattedTextSubtitle708(win, i, list, m_family, - m_safeArea, - this, video_aspect); + auto *fsub = new FormattedTextSubtitle708(win, i, list, m_family, + m_safeArea, this, video_aspect); addList.append(fsub); } - win.DisposeStrings(list); + CC708Window::DisposeStrings(list); } if (clearMask) { @@ -2335,8 +2327,8 @@ static void myth_libass_log(int level, const char *fmt, va_list vl, void */*ctx* if (!VERBOSE_LEVEL_CHECK(verbose_mask, verbose_level)) return; - static QMutex string_lock; - string_lock.lock(); + static QMutex s_stringLock; + s_stringLock.lock(); char str[1024]; int bytes = vsnprintf(str, sizeof str, fmt, vl); @@ -2350,7 +2342,7 @@ static void myth_libass_log(int level, const char *fmt, va_list vl, void */*ctx* } LOG(verbose_mask, verbose_level, QString("libass: %1").arg(str)); - string_lock.unlock(); + s_stringLock.unlock(); } bool SubtitleScreen::InitialiseAssLibrary(void) diff --git a/mythtv/libs/libmythtv/teletextreader.cpp b/mythtv/libs/libmythtv/teletextreader.cpp index 4fd91b351df..8080a1be992 100644 --- a/mythtv/libs/libmythtv/teletextreader.cpp +++ b/mythtv/libs/libmythtv/teletextreader.cpp @@ -582,14 +582,13 @@ const TeletextSubPage *TeletextReader::FindSubPageInternal( return nullptr; const TeletextPage *ttpage = &(pageIter->second); - int_to_subpage_t::const_iterator subpageIter = - ttpage->subpages.begin(); + auto subpageIter = ttpage->subpages.cbegin(); // try to find the subpage given, or first if subpage == -1 if (subpage != -1) subpageIter = ttpage->subpages.find(subpage); - if (subpageIter == ttpage->subpages.end()) + if (subpageIter == ttpage->subpages.cend()) return nullptr; if (subpage == -1) @@ -599,10 +598,9 @@ const TeletextSubPage *TeletextReader::FindSubPageInternal( if (direction == -1) { --subpageIter; - if (subpageIter == ttpage->subpages.end()) + if (subpageIter == ttpage->subpages.cend()) { - int_to_subpage_t::const_reverse_iterator iter = - ttpage->subpages.rbegin(); + auto iter = ttpage->subpages.crbegin(); res = &(iter->second); } else @@ -614,8 +612,8 @@ const TeletextSubPage *TeletextReader::FindSubPageInternal( if (direction == 1) { ++subpageIter; - if (subpageIter == ttpage->subpages.end()) - subpageIter = ttpage->subpages.begin(); + if (subpageIter == ttpage->subpages.cend()) + subpageIter = ttpage->subpages.cbegin(); res = &(subpageIter->second); } diff --git a/mythtv/libs/libmythtv/teletextreader.h b/mythtv/libs/libmythtv/teletextreader.h index 53b81cb0260..89975c82c24 100644 --- a/mythtv/libs/libmythtv/teletextreader.h +++ b/mythtv/libs/libmythtv/teletextreader.h @@ -11,7 +11,7 @@ using namespace std; -typedef enum +enum TTColor { kTTColorBlack = 0, kTTColorRed = 1, @@ -22,7 +22,7 @@ typedef enum kTTColorCyan = 6, kTTColorWhite = 7, kTTColorTransparent = 8, -} TTColor; +}; #define TP_SUPPRESS_HEADER 0x01 #define TP_UPDATE_INDICATOR 0x02 @@ -47,7 +47,7 @@ class TeletextSubPage bool active; ///< data has arrived since page last cleared }; -typedef map<int, TeletextSubPage> int_to_subpage_t; +using int_to_subpage_t = map<int, TeletextSubPage>; class TeletextPage { @@ -56,7 +56,7 @@ class TeletextPage int current_subpage; int_to_subpage_t subpages; }; -typedef map<int, TeletextPage> int_to_page_t; +using int_to_page_t = map<int, TeletextPage>; class TeletextMagazine { diff --git a/mythtv/libs/libmythtv/teletextscreen.cpp b/mythtv/libs/libmythtv/teletextscreen.cpp index 0ce3369a690..a499526d050 100644 --- a/mythtv/libs/libmythtv/teletextscreen.cpp +++ b/mythtv/libs/libmythtv/teletextscreen.cpp @@ -78,7 +78,7 @@ QImage* TeletextScreen::GetRowImage(int row, QRect &rect) rect.translate(0, -(y * m_rowHeight)); if (!m_rowImages.contains(y)) { - QImage* img = new QImage(m_safeArea.width(), m_rowHeight * 2, + auto* img = new QImage(m_safeArea.width(), m_rowHeight * 2, QImage::Format_ARGB32); if (img) { @@ -110,8 +110,7 @@ void TeletextScreen::OptimiseDisplayedArea(void) int row = it.key(); image->Assign(*(it.value())); - MythUIImage *uiimage = new MythUIImage(this, QString("ttrow%1") - .arg(row)); + auto *uiimage = new MythUIImage(this, QString("ttrow%1").arg(row)); if (uiimage) { uiimage->SetImage(image); @@ -683,9 +682,9 @@ void TeletextScreen::DrawStatus(void) bool TeletextScreen::InitialiseFont() { - static bool initialised = false; + static bool s_initialised = false; //QString font = gCoreContext->GetSetting("DefaultSubtitleFont", "FreeMono"); - if (initialised) + if (s_initialised) { return true; #if 0 @@ -695,7 +694,7 @@ bool TeletextScreen::InitialiseFont() #endif // 0 } - MythFontProperties *mythfont = new MythFontProperties(); + auto *mythfont = new MythFontProperties(); QString font = SubtitleScreen::GetTeletextFontName(); if (mythfont) { @@ -708,7 +707,7 @@ bool TeletextScreen::InitialiseFont() gTTBackgroundAlpha = SubtitleScreen::GetTeletextBackgroundAlpha(); - initialised = true; + s_initialised = true; LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Loaded main subtitle font '%1'") .arg(font)); return true; diff --git a/mythtv/libs/libmythtv/teletextscreen.h b/mythtv/libs/libmythtv/teletextscreen.h index a49ab6312fe..45ce66092b9 100644 --- a/mythtv/libs/libmythtv/teletextscreen.h +++ b/mythtv/libs/libmythtv/teletextscreen.h @@ -29,7 +29,7 @@ class TeletextScreen: public MythScreenType private: void OptimiseDisplayedArea(void); QImage* GetRowImage(int row, QRect &rect); - void SetForegroundColor(int color); + static void SetForegroundColor(int color); void SetBackgroundColor(int color); void DrawBackground(int x, int y); void DrawRect(int row, const QRect); diff --git a/mythtv/libs/libmythtv/test/test_eitfixups/test_eitfixups.cpp b/mythtv/libs/libmythtv/test/test_eitfixups/test_eitfixups.cpp index 4898db1e06a..fe93fb05fa8 100644 --- a/mythtv/libs/libmythtv/test/test_eitfixups/test_eitfixups.cpp +++ b/mythtv/libs/libmythtv/test/test_eitfixups/test_eitfixups.cpp @@ -417,7 +417,7 @@ void TestEITFixups::testUKMarvel() DBEventEIT *TestEITFixups::SimpleDBEventEIT (FixupValue fixup, const QString& title, const QString& subtitle, const QString& description) { - DBEventEIT *event = new DBEventEIT (1, // channel id + auto *event = new DBEventEIT (1, // channel id title, // title subtitle, // subtitle description, // description diff --git a/mythtv/libs/libmythtv/test/test_mpegtables/test_mpegtables.cpp b/mythtv/libs/libmythtv/test/test_mpegtables/test_mpegtables.cpp index fb4e57d3881..808f8dc0dd5 100644 --- a/mythtv/libs/libmythtv/test/test_mpegtables/test_mpegtables.cpp +++ b/mythtv/libs/libmythtv/test/test_mpegtables/test_mpegtables.cpp @@ -115,7 +115,7 @@ void TestMPEGTables::pat_test(void) memset (&si_data4, 0, sizeof(si_data4)); si_data4[1] = 1 << 7 & 0 << 6 & 3 << 4 & 0 << 2 & 0; si_data4[2] = 0x00; - ProgramAssociationTable* pat4 = new ProgramAssociationTable(PSIPTable((unsigned char*)&si_data4)); + auto* pat4 = new ProgramAssociationTable(PSIPTable((unsigned char*)&si_data4)); QCOMPARE (pat4->CalcCRC(), (uint) 0xFFFFFFFF); QVERIFY (pat4->VerifyCRC()); delete pat4; @@ -223,7 +223,7 @@ void TestMPEGTables::ContentIdentifierDescriptor_test(void) void TestMPEGTables::clone_test(void) { - unsigned char *si_data = new unsigned char[8]; + auto *si_data = new unsigned char[8]; si_data[0] = 0x70; /* pp....37 */ si_data[1] = 0x70; si_data[2] = 0x05; diff --git a/mythtv/libs/libmythtv/textsubtitleparser.cpp b/mythtv/libs/libmythtv/textsubtitleparser.cpp index e805605ae14..f8a8080fbcb 100644 --- a/mythtv/libs/libmythtv/textsubtitleparser.cpp +++ b/mythtv/libs/libmythtv/textsubtitleparser.cpp @@ -191,7 +191,7 @@ QStringList TextSubtitles::GetSubtitles(uint64_t timecode) uint64_t startCode = 0, endCode = 0; if (nextSubPos != m_subtitles.begin()) { - TextSubtitleList::const_iterator currentSubPos = nextSubPos; + auto currentSubPos = nextSubPos; --currentSubPos; const text_subtitle_t &sub = *currentSubPos; diff --git a/mythtv/libs/libmythtv/textsubtitleparser.h b/mythtv/libs/libmythtv/textsubtitleparser.h index 754da92f40d..d4a49e4c32b 100644 --- a/mythtv/libs/libmythtv/textsubtitleparser.h +++ b/mythtv/libs/libmythtv/textsubtitleparser.h @@ -38,7 +38,7 @@ class text_subtitle_t QStringList m_textLines; }; -typedef vector<text_subtitle_t> TextSubtitleList; +using TextSubtitleList = vector<text_subtitle_t>; class TextSubtitles { diff --git a/mythtv/libs/libmythtv/transporteditor.cpp b/mythtv/libs/libmythtv/transporteditor.cpp index 35ec15c2688..8f53337402c 100644 --- a/mythtv/libs/libmythtv/transporteditor.cpp +++ b/mythtv/libs/libmythtv/transporteditor.cpp @@ -186,7 +186,7 @@ TransportListEditor::TransportListEditor(uint sourceid) : addChild(m_videosource); m_videosource->setEnabled(false); - ButtonStandardSetting *newTransport = + auto *newTransport = new ButtonStandardSetting("(" + tr("New Transport") + ")"); connect(newTransport, SIGNAL(clicked()), SLOT(NewTransport(void))); @@ -268,9 +268,8 @@ void TransportListEditor::Load() .arg(mod).arg(query.value(2).toString()) .arg(hz).arg(rate).arg(netid).arg(tid).arg(type); - TransportSetting *transport = - new TransportSetting(txt, query.value(0).toUInt(), m_sourceid, - m_cardtype); + auto *transport = new TransportSetting(txt, query.value(0).toUInt(), + m_sourceid, m_cardtype); connect(transport, &TransportSetting::deletePressed, this, [transport, this] () { Delete(transport); }); connect(transport, &TransportSetting::openMenu, @@ -286,9 +285,8 @@ void TransportListEditor::Load() void TransportListEditor::NewTransport() { - TransportSetting *transport = - new TransportSetting(QString("New Transport"), 0, - m_sourceid, m_cardtype); + auto *transport = new TransportSetting(QString("New Transport"), 0, + m_sourceid, m_cardtype); addChild(transport); m_list.push_back(transport); emit settingsChanged(this); @@ -325,16 +323,7 @@ void TransportListEditor::Delete(TransportSetting *transport) MythDB::DBError("TransportEditor -- delete channels", query); removeChild(transport); - // m_list.removeAll(transport); - // Following for QT 5.3 which does not have the removeAll - // method in QVector - int ix; - do - { - ix = m_list.indexOf(transport); - if (ix != -1) - m_list.remove(ix); - } while (ix != -1); + m_list.removeAll(transport); }, true); } @@ -344,13 +333,12 @@ void TransportListEditor::Menu(TransportSetting *transport) if (m_isLoading) return; - MythMenu *menu = new MythMenu(tr("Transport Menu"), this, "transportmenu"); + auto *menu = new MythMenu(tr("Transport Menu"), this, "transportmenu"); menu->AddItem(tr("Delete..."), [transport, this] () { Delete(transport); }); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(menu, popupStack, - "menudialog"); + auto *menuPopup = new MythDialogBox(menu, popupStack, "menudialog"); menuPopup->SetReturnEvent(this, "transportmenu"); if (menuPopup->Create()) @@ -363,36 +351,36 @@ class MuxDBStorage : public SimpleDBStorage { protected: MuxDBStorage(StorageUser *_setting, const MultiplexID *_id, const QString& _name) : - SimpleDBStorage(_setting, "dtv_multiplex", _name), mplexid(_id) + SimpleDBStorage(_setting, "dtv_multiplex", _name), m_mplexId(_id) { } QString GetSetClause(MSqlBindings &bindings) const override; // SimpleDBStorage QString GetWhereClause(MSqlBindings &bindings) const override; // SimpleDBStorage - const MultiplexID *mplexid; + const MultiplexID *m_mplexId; }; QString MuxDBStorage::GetWhereClause(MSqlBindings &bindings) const { - QString muxTag = ":WHERE" + mplexid->GetColumnName().toUpper(); + QString muxTag = ":WHERE" + m_mplexId->GetColumnName().toUpper(); - bindings.insert(muxTag, mplexid->getValue()); + bindings.insert(muxTag, m_mplexId->getValue()); // return query - return mplexid->GetColumnName() + " = " + muxTag; + return m_mplexId->GetColumnName() + " = " + muxTag; } QString MuxDBStorage::GetSetClause(MSqlBindings &bindings) const { - QString muxTag = ":SET" + mplexid->GetColumnName().toUpper(); + QString muxTag = ":SET" + m_mplexId->GetColumnName().toUpper(); QString nameTag = ":SET" + GetColumnName().toUpper(); - bindings.insert(muxTag, mplexid->getValue()); + bindings.insert(muxTag, m_mplexId->getValue()); bindings.insert(nameTag, m_user->GetDBValue()); // return query - return (mplexid->GetColumnName() + " = " + muxTag + ", " + + return (m_mplexId->GetColumnName() + " = " + muxTag + ", " + GetColumnName() + " = " + nameTag); } diff --git a/mythtv/libs/libmythtv/tv.h b/mythtv/libs/libmythtv/tv.h index 434b1fab4ce..0eba3cb2de6 100644 --- a/mythtv/libs/libmythtv/tv.h +++ b/mythtv/libs/libmythtv/tv.h @@ -6,12 +6,12 @@ class VBIMode { public: - typedef enum + enum vbimode_t { None = 0, PAL_TT = 1, NTSC_CC = 2, - } vbimode_t; + }; static uint Parse(QString vbiformat) { @@ -25,16 +25,16 @@ class VBIMode /** \brief ChannelChangeDirection is an enumeration of possible channel * changing directions. */ -typedef enum +enum ChannelChangeDirection { CHANNEL_DIRECTION_UP = 0, CHANNEL_DIRECTION_DOWN = 1, CHANNEL_DIRECTION_FAVORITE = 2, CHANNEL_DIRECTION_SAME = 3, -} ChannelChangeDirection; +}; /// Used to request ProgramInfo for channel browsing. -typedef enum BrowseDirections +enum BrowseDirection { BROWSE_INVALID = -1, BROWSE_SAME = 0, ///< Fetch browse information on current channel and time @@ -43,11 +43,11 @@ typedef enum BrowseDirections BROWSE_LEFT, ///< Fetch information on current channel in the past BROWSE_RIGHT, ///< Fetch information on current channel in the future BROWSE_FAVORITE ///< Fetch information on the next favorite channel -} BrowseDirection; +}; /** \brief TVState is an enumeration of the states used by TV and TVRec. */ -typedef enum +enum TVState { /** \brief Error State, if we ever try to enter this state errored is set. */ @@ -87,14 +87,14 @@ typedef enum * of changing the state. */ kState_ChangingState, -} TVState; +}; inline TVState myth_deque_init(const TVState*) { return (TVState)(0); } QString StateToString(TVState state); /** \brief SleepStatus is an enumeration of the awake/sleep status of a slave. */ -typedef enum SleepStatus { +enum SleepStatus { /** \brief A slave is awake when it is connected to the master */ sStatus_Awake = 0x0, @@ -115,25 +115,25 @@ typedef enum SleepStatus { * awakened. */ sStatus_Undefined = 0x8 -} SleepStatus; +}; -typedef enum PictureAdjustType +enum PictureAdjustType { kAdjustingPicture_None = 0, kAdjustingPicture_Playback, kAdjustingPicture_Channel, kAdjustingPicture_Recording, -} PictureAdjustType; +}; QString toTypeString(PictureAdjustType type); QString toTitleString(PictureAdjustType type); -typedef enum +enum CommSkipMode { kCommSkipOff = 0, kCommSkipOn = 1, kCommSkipNotify = 2, kCommSkipCount, kCommSkipIncr, -} CommSkipMode; +}; QString toString(CommSkipMode type); #endif diff --git a/mythtv/libs/libmythtv/tv_play.cpp b/mythtv/libs/libmythtv/tv_play.cpp index f04540b03ff..a5390a1618b 100644 --- a/mythtv/libs/libmythtv/tv_play.cpp +++ b/mythtv/libs/libmythtv/tv_play.cpp @@ -464,8 +464,7 @@ bool TV::StartTV(ProgramInfo *tvrec, uint flags, if (!playerError.isEmpty()) { MythScreenStack *ss = GetMythMainWindow()->GetStack("popup stack"); - MythConfirmationDialog *dlg = new MythConfirmationDialog( - ss, playerError, false); + auto *dlg = new MythConfirmationDialog(ss, playerError, false); if (!dlg->Create()) delete dlg; else @@ -1589,7 +1588,7 @@ void TV::GetStatus(void) /** * \brief get tv state of active player context */ -TVState TV::GetState(const PlayerContext *actx) const +TVState TV::GetState(const PlayerContext *actx) { TVState ret = kState_ChangingState; if (!actx->InStateChange()) @@ -1714,7 +1713,7 @@ void TV::AskAllowRecording(PlayerContext *ctx, if (!StateIsLiveTV(GetState(ctx))) return; - ProgramInfo *info = new ProgramInfo(msg); + auto *info = new ProgramInfo(msg); if (!info->GetChanID()) { delete info; @@ -1741,7 +1740,7 @@ void TV::AskAllowRecording(PlayerContext *ctx, QMap<QString,AskProgramInfo>::iterator it = m_askAllowPrograms.find(key); if (it != m_askAllowPrograms.end()) { - delete (*it).info; + delete (*it).m_info; m_askAllowPrograms.erase(it); } delete info; @@ -1777,13 +1776,13 @@ void TV::ShowOSDAskAllow(PlayerContext *ctx) while (it != m_askAllowPrograms.end()) { next = it; ++next; - if ((*it).expiry <= timeNow) + if ((*it).m_expiry <= timeNow) { #if 0 LOG(VB_GENERAL, LOG_DEBUG, LOC + "-- " + - QString("removing '%1'").arg((*it).info->m_title)); + QString("removing '%1'").arg((*it).m_info->m_title)); #endif - delete (*it).info; + delete (*it).m_info; m_askAllowPrograms.erase(it); } it = next; @@ -1793,9 +1792,9 @@ void TV::ShowOSDAskAllow(PlayerContext *ctx) uint conflict_count = m_askAllowPrograms.size(); it = m_askAllowPrograms.begin(); - if ((1 == m_askAllowPrograms.size()) && ((*it).info->GetInputID() == cardid)) + if ((1 == m_askAllowPrograms.size()) && ((*it).m_info->GetInputID() == cardid)) { - (*it).is_in_same_input_group = (*it).is_conflicting = true; + (*it).m_isInSameInputGroup = (*it).m_isConflicting = true; } else if (!m_askAllowPrograms.empty()) { @@ -1809,10 +1808,10 @@ void TV::ShowOSDAskAllow(PlayerContext *ctx) it = m_askAllowPrograms.begin(); for (; it != m_askAllowPrograms.end(); ++it) { - (*it).is_in_same_input_group = - (cardid == (*it).info->GetInputID()); + (*it).m_isInSameInputGroup = + (cardid == (*it).m_info->GetInputID()); - if ((*it).is_in_same_input_group) + if ((*it).m_isInSameInputGroup) continue; // is busy_input in same input group as recording @@ -1823,14 +1822,14 @@ void TV::ShowOSDAskAllow(PlayerContext *ctx) } vector<uint> input_grps = - CardUtil::GetInputGroups((*it).info->GetInputID()); + CardUtil::GetInputGroups((*it).m_info->GetInputID()); for (size_t i = 0; i < input_grps.size(); i++) { if (find(busy_input_grps.begin(), busy_input_grps.end(), input_grps[i]) != busy_input_grps.end()) { - (*it).is_in_same_input_group = true; + (*it).m_isInSameInputGroup = true; break; } } @@ -1841,26 +1840,26 @@ void TV::ShowOSDAskAllow(PlayerContext *ctx) it = m_askAllowPrograms.begin(); for (; it != m_askAllowPrograms.end(); ++it) { - if (!(*it).is_in_same_input_group) - (*it).is_conflicting = false; // NOLINT(bugprone-branch-clone) - else if (cardid == (*it).info->GetInputID()) - (*it).is_conflicting = true; // NOLINT(bugprone-branch-clone) - else if (!CardUtil::IsTunerShared(cardid, (*it).info->GetInputID())) - (*it).is_conflicting = true; + if (!(*it).m_isInSameInputGroup) + (*it).m_isConflicting = false; // NOLINT(bugprone-branch-clone) + else if (cardid == (*it).m_info->GetInputID()) + (*it).m_isConflicting = true; // NOLINT(bugprone-branch-clone) + else if (!CardUtil::IsTunerShared(cardid, (*it).m_info->GetInputID())) + (*it).m_isConflicting = true; else if ((busy_input.m_mplexid && - (busy_input.m_mplexid == (*it).info->QueryMplexID())) || + (busy_input.m_mplexid == (*it).m_info->QueryMplexID())) || (!busy_input.m_mplexid && - (busy_input.m_chanid == (*it).info->GetChanID()))) - (*it).is_conflicting = false; + (busy_input.m_chanid == (*it).m_info->GetChanID()))) + (*it).m_isConflicting = false; else - (*it).is_conflicting = true; + (*it).m_isConflicting = true; - conflict_count += (*it).is_conflicting ? 1 : 0; + conflict_count += (*it).m_isConflicting ? 1 : 0; } } it = m_askAllowPrograms.begin(); - for (; it != m_askAllowPrograms.end() && !(*it).is_conflicting; ++it); + for (; it != m_askAllowPrograms.end() && !(*it).m_isConflicting; ++it); if (conflict_count == 0) { @@ -1869,7 +1868,7 @@ void TV::ShowOSDAskAllow(PlayerContext *ctx) // TODO take down mplexid and inform user of problem // on channel changes. } - else if (conflict_count == 1 && ((*it).info->GetInputID() == cardid)) + else if (conflict_count == 1 && ((*it).m_info->GetInputID() == cardid)) { #if 0 LOG(VB_GENERAL, LOG_DEBUG, LOC + "UpdateOSDAskAllowDialog -- " + @@ -1880,24 +1879,24 @@ void TV::ShowOSDAskAllow(PlayerContext *ctx) QString channel = m_dbChannelFormat; channel - .replace("<num>", (*it).info->GetChanNum()) - .replace("<sign>", (*it).info->GetChannelSchedulingID()) - .replace("<name>", (*it).info->GetChannelName()); + .replace("<num>", (*it).m_info->GetChanNum()) + .replace("<sign>", (*it).m_info->GetChannelSchedulingID()) + .replace("<name>", (*it).m_info->GetChannelName()); - message = single_rec.arg((*it).info->GetTitle()).arg(channel); + message = single_rec.arg((*it).m_info->GetTitle()).arg(channel); OSD *osd = GetOSDLock(ctx); if (osd) { m_browseHelper->BrowseEnd(ctx, false); - timeuntil = MythDate::current().secsTo((*it).expiry) * 1000; + timeuntil = MythDate::current().secsTo((*it).m_expiry) * 1000; osd->DialogShow(OSD_DLG_ASKALLOW, message, timeuntil); osd->DialogAddButton(record_watch, "DIALOG_ASKALLOW_WATCH_0", - false, !((*it).has_rec)); + false, !((*it).m_hasRec)); osd->DialogAddButton(let_record1, "DIALOG_ASKALLOW_EXIT_0"); - osd->DialogAddButton(((*it).has_later) ? record_later1 : do_not_record1, + osd->DialogAddButton(((*it).m_hasLater) ? record_later1 : do_not_record1, "DIALOG_ASKALLOW_CANCELRECORDING_0", - false, ((*it).has_rec)); + false, ((*it).m_hasRec)); } ReturnOSDLock(ctx, osd); } @@ -1914,20 +1913,20 @@ void TV::ShowOSDAskAllow(PlayerContext *ctx) it = m_askAllowPrograms.begin(); for (; it != m_askAllowPrograms.end(); ++it) { - if (!(*it).is_conflicting) + if (!(*it).m_isConflicting) continue; - QString title = (*it).info->GetTitle(); - if ((title.length() < 10) && !(*it).info->GetSubtitle().isEmpty()) - title += ": " + (*it).info->GetSubtitle(); + QString title = (*it).m_info->GetTitle(); + if ((title.length() < 10) && !(*it).m_info->GetSubtitle().isEmpty()) + title += ": " + (*it).m_info->GetSubtitle(); if (title.length() > 20) title = title.left(17) + "..."; QString channel = m_dbChannelFormat; channel - .replace("<num>", (*it).info->GetChanNum()) - .replace("<sign>", (*it).info->GetChannelSchedulingID()) - .replace("<name>", (*it).info->GetChannelName()); + .replace("<num>", (*it).m_info->GetChanNum()) + .replace("<sign>", (*it).m_info->GetChannelSchedulingID()) + .replace("<name>", (*it).m_info->GetChannelName()); if (conflict_count > 1) { @@ -1936,8 +1935,8 @@ void TV::ShowOSDAskAllow(PlayerContext *ctx) } else { - message = single_rec.arg((*it).info->GetTitle()).arg(channel); - has_rec = (*it).has_rec; + message = single_rec.arg((*it).m_info->GetTitle()).arg(channel); + has_rec = (*it).m_hasRec; } } @@ -1952,10 +1951,10 @@ void TV::ShowOSDAskAllow(PlayerContext *ctx) it = m_askAllowPrograms.begin(); for (; it != m_askAllowPrograms.end(); ++it) { - if ((*it).is_conflicting) + if ((*it).m_isConflicting) { - all_have_later &= (*it).has_later; - int tmp = MythDate::current().secsTo((*it).expiry); + all_have_later &= (*it).m_hasLater; + int tmp = MythDate::current().secsTo((*it).m_expiry); tmp *= 1000; timeuntil = min(timeuntil, max(tmp, 0)); } @@ -2008,8 +2007,8 @@ void TV::HandleOSDAskAllow(PlayerContext *ctx, const QString& action) m_askAllowPrograms.begin(); for (; it != m_askAllowPrograms.end(); ++it) { - if ((*it).is_conflicting) - RemoteCancelNextRecording((*it).info->GetInputID(), true); + if ((*it).m_isConflicting) + RemoteCancelNextRecording((*it).m_info->GetInputID(), true); } } else if (action == "WATCH") @@ -3536,7 +3535,7 @@ bool TV::event(QEvent *e) { PlayerContext *mctx = GetPlayerReadLock(0, __FILE__, __LINE__); mctx->LockDeletePlayer(__FILE__, __LINE__); - const QResizeEvent *qre = dynamic_cast<const QResizeEvent*>(e); + const auto *qre = dynamic_cast<const QResizeEvent*>(e); if (qre && mctx->m_player) mctx->m_player->WindowResized(qre->size()); mctx->UnlockDeletePlayer(__FILE__, __LINE__); @@ -3828,7 +3827,7 @@ bool TV::ProcessKeypressOrGesture(PlayerContext *actx, QEvent *e) #ifdef Q_OS_LINUX // Fixups for _some_ linux native codes that QT doesn't know - QKeyEvent* eKeyEvent = dynamic_cast<QKeyEvent*>(e); + auto* eKeyEvent = dynamic_cast<QKeyEvent*>(e); if (eKeyEvent) { if (eKeyEvent->key() <= 0) { @@ -3844,8 +3843,8 @@ bool TV::ProcessKeypressOrGesture(PlayerContext *actx, QEvent *e) if (keycode > 0) { - QKeyEvent *key = new QKeyEvent(QEvent::KeyPress, keycode, - eKeyEvent->modifiers()); + auto *key = new QKeyEvent(QEvent::KeyPress, keycode, + eKeyEvent->modifiers()); QCoreApplication::postEvent(this, key); } } @@ -3881,12 +3880,12 @@ bool TV::ProcessKeypressOrGesture(PlayerContext *actx, QEvent *e) { if (QEvent::KeyPress == e->type()) { - QKeyEvent *qke = dynamic_cast<QKeyEvent*>(e); + auto *qke = dynamic_cast<QKeyEvent*>(e); handled = (qke != nullptr) && osd->DialogHandleKeypress(qke); } if (MythGestureEvent::kEventType == e->type()) { - MythGestureEvent *mge = dynamic_cast<MythGestureEvent*>(e); + auto *mge = dynamic_cast<MythGestureEvent*>(e); handled = (mge != nullptr) && osd->DialogHandleGesture(mge); } } @@ -3949,7 +3948,7 @@ bool TV::ProcessKeypressOrGesture(PlayerContext *actx, QEvent *e) // This allows hex teletext entry and minor channel entry. if (QEvent::KeyPress == e->type()) { - QKeyEvent *qke = dynamic_cast<QKeyEvent*>(e); + auto *qke = dynamic_cast<QKeyEvent*>(e); if (qke == nullptr) return false; const QString txt = qke->text(); @@ -5613,7 +5612,7 @@ bool TV::CreatePIP(PlayerContext *ctx, const ProgramInfo *info) return false; } - PlayerContext *pipctx = new PlayerContext(kPIPPlayerInUseID); + auto *pipctx = new PlayerContext(kPIPPlayerInUseID); // Hardware acceleration of PiP is currently disabled as the null video // renderer cannot deal with hardware codecs which are returned by the display // profile. The workaround would be to encourage the decoder, when using null @@ -6874,7 +6873,7 @@ void TV::DoQueueTranscode(PlayerContext *ctx, const QString& profile) ctx->UnlockPlayingInfo(__FILE__, __LINE__); } -int TV::GetNumChapters(const PlayerContext *ctx) const +int TV::GetNumChapters(const PlayerContext *ctx) { int num_chapters = 0; ctx->LockDeletePlayer(__FILE__, __LINE__); @@ -6884,7 +6883,7 @@ int TV::GetNumChapters(const PlayerContext *ctx) const return num_chapters; } -void TV::GetChapterTimes(const PlayerContext *ctx, QList<long long> ×) const +void TV::GetChapterTimes(const PlayerContext *ctx, QList<long long> ×) { ctx->LockDeletePlayer(__FILE__, __LINE__); if (ctx->m_player) @@ -6892,7 +6891,7 @@ void TV::GetChapterTimes(const PlayerContext *ctx, QList<long long> ×) cons ctx->UnlockDeletePlayer(__FILE__, __LINE__); } -int TV::GetCurrentChapter(const PlayerContext *ctx) const +int TV::GetCurrentChapter(const PlayerContext *ctx) { int chapter = 0; ctx->LockDeletePlayer(__FILE__, __LINE__); @@ -6918,7 +6917,7 @@ void TV::DoJumpChapter(PlayerContext *ctx, int chapter) ctx->UnlockDeletePlayer(__FILE__, __LINE__); } -int TV::GetNumTitles(const PlayerContext *ctx) const +int TV::GetNumTitles(const PlayerContext *ctx) { int num_titles = 0; ctx->LockDeletePlayer(__FILE__, __LINE__); @@ -6928,7 +6927,7 @@ int TV::GetNumTitles(const PlayerContext *ctx) const return num_titles; } -int TV::GetCurrentTitle(const PlayerContext *ctx) const +int TV::GetCurrentTitle(const PlayerContext *ctx) { int currentTitle = 0; ctx->LockDeletePlayer(__FILE__, __LINE__); @@ -6938,7 +6937,7 @@ int TV::GetCurrentTitle(const PlayerContext *ctx) const return currentTitle; } -int TV::GetNumAngles(const PlayerContext *ctx) const +int TV::GetNumAngles(const PlayerContext *ctx) { int num_angles = 0; ctx->LockDeletePlayer(__FILE__, __LINE__); @@ -6948,7 +6947,7 @@ int TV::GetNumAngles(const PlayerContext *ctx) const return num_angles; } -int TV::GetCurrentAngle(const PlayerContext *ctx) const +int TV::GetCurrentAngle(const PlayerContext *ctx) { int currentAngle = 0; ctx->LockDeletePlayer(__FILE__, __LINE__); @@ -6958,7 +6957,7 @@ int TV::GetCurrentAngle(const PlayerContext *ctx) const return currentAngle; } -QString TV::GetAngleName(const PlayerContext *ctx, int angle) const +QString TV::GetAngleName(const PlayerContext *ctx, int angle) { QString name; ctx->LockDeletePlayer(__FILE__, __LINE__); @@ -6968,7 +6967,7 @@ QString TV::GetAngleName(const PlayerContext *ctx, int angle) const return name; } -int TV::GetTitleDuration(const PlayerContext *ctx, int title) const +int TV::GetTitleDuration(const PlayerContext *ctx, int title) { int seconds = 0; ctx->LockDeletePlayer(__FILE__, __LINE__); @@ -6979,7 +6978,7 @@ int TV::GetTitleDuration(const PlayerContext *ctx, int title) const } -QString TV::GetTitleName(const PlayerContext *ctx, int title) const +QString TV::GetTitleName(const PlayerContext *ctx, int title) { QString name; ctx->LockDeletePlayer(__FILE__, __LINE__); @@ -8051,7 +8050,7 @@ void TV::UpdateOSDInput(const PlayerContext *ctx) /** \fn TV::UpdateOSDSignal(const PlayerContext*, const QStringList&) * \brief Updates Signal portion of OSD... */ -void TV::UpdateOSDSignal(const PlayerContext *ctx, const QStringList &strlist) +void TV::UpdateOSDSignal(PlayerContext *ctx, const QStringList &strlist) { OSD *osd = GetOSDLock(ctx); if (!osd || m_browseHelper->IsBrowsing() || !m_queuedChanNum.isEmpty()) @@ -8061,8 +8060,7 @@ void TV::UpdateOSDSignal(const PlayerContext *ctx, const QStringList &strlist) ReturnOSDLock(ctx, osd); QMutexLocker locker(&m_timerIdLock); - m_signalMonitorTimerId[StartTimer(1, __LINE__)] = - const_cast<PlayerContext*>(ctx); + m_signalMonitorTimerId[StartTimer(1, __LINE__)] = ctx; return; } ReturnOSDLock(ctx, osd); @@ -8247,17 +8245,17 @@ void TV::UpdateOSDTimeoutMessage(PlayerContext *ctx) } // create dialog... - static QString chan_up = GET_KEY("TV Playback", ACTION_CHANNELUP); - static QString chan_down = GET_KEY("TV Playback", ACTION_CHANNELDOWN); - static QString next_src = GET_KEY("TV Playback", "NEXTSOURCE"); - static QString tog_cards = GET_KEY("TV Playback", "NEXTINPUT"); + static QString s_chanUp = GET_KEY("TV Playback", ACTION_CHANNELUP); + static QString s_chanDown = GET_KEY("TV Playback", ACTION_CHANNELDOWN); + static QString s_nextSrc = GET_KEY("TV Playback", "NEXTSOURCE"); + static QString s_togCards = GET_KEY("TV Playback", "NEXTINPUT"); QString message = tr( "You should have received a channel lock by now. " "You can continue to wait for a signal, or you " "can change the channel with %1 or %2, change " "video source (%3), inputs (%4), etc.") - .arg(chan_up).arg(chan_down).arg(next_src).arg(tog_cards); + .arg(s_chanUp).arg(s_chanDown).arg(s_nextSrc).arg(s_togCards); osd->DialogShow(OSD_DLG_INFO, message); QString action = "DIALOG_INFO_CHANNELLOCK_0"; @@ -8375,7 +8373,7 @@ bool TV::IsTunable(uint chanid) static QString toCommaList(const QSet<uint> &list) { QString ret = ""; - for (QSet<uint>::const_iterator it = list.begin(); it != list.end(); ++it) + for (auto it = list.cbegin(); it != list.cend(); ++it) ret += QString("%1,").arg(*it); if (ret.length()) @@ -8660,7 +8658,7 @@ void TV::EditSchedule(const PlayerContext */*ctx*/, int editType) { // post the request so the guide will be created in the UI thread QString message = QString("START_EPG %1").arg(editType); - MythEvent* me = new MythEvent(message); + auto* me = new MythEvent(message); qApp->postEvent(this, me); } @@ -8753,7 +8751,7 @@ void TV::ChangeTimeStretch(PlayerContext *ctx, int dir, bool allowEdit) return; } - ctx->m_tsNormal = kTimeStretchStep * (int)(new_ts_normal / kTimeStretchStep + 0.5F); + ctx->m_tsNormal = kTimeStretchStep * lroundf(new_ts_normal / kTimeStretchStep); ctx->LockDeletePlayer(__FILE__, __LINE__); if (ctx->m_player && !ctx->m_player->IsPaused()) @@ -9177,7 +9175,7 @@ void TV::customEvent(QEvent *e) if (e->type() == MythEvent::MythUserMessage) { - MythEvent *me = dynamic_cast<MythEvent*>(e); + auto *me = dynamic_cast<MythEvent*>(e); if (me == nullptr) return; QString message = me->Message(); @@ -9208,8 +9206,7 @@ void TV::customEvent(QEvent *e) if (e->type() == MythEvent::kUpdateBrowseInfoEventType) { - UpdateBrowseInfoEvent *b = - reinterpret_cast<UpdateBrowseInfoEvent*>(e); + auto *b = reinterpret_cast<UpdateBrowseInfoEvent*>(e); PlayerContext *mctx = GetPlayerReadLock(0, __FILE__, __LINE__); OSD *osd = GetOSDLock(mctx); if (osd) @@ -9224,8 +9221,7 @@ void TV::customEvent(QEvent *e) if (e->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = - reinterpret_cast<DialogCompletionEvent*>(e); + auto *dce = reinterpret_cast<DialogCompletionEvent*>(e); if (dce->GetData().userType() == qMetaTypeId<MenuNodeTuple>()) { MenuNodeTuple data = dce->GetData().value<MenuNodeTuple>(); @@ -9243,7 +9239,7 @@ void TV::customEvent(QEvent *e) if (e->type() == OSDHideEvent::kEventType) { - OSDHideEvent *ce = reinterpret_cast<OSDHideEvent*>(e); + auto *ce = reinterpret_cast<OSDHideEvent*>(e); HandleOSDClosed(ce->GetFunctionalType()); return; } @@ -9259,7 +9255,7 @@ void TV::customEvent(QEvent *e) return; } - MythMediaEvent *me = dynamic_cast<MythMediaEvent*>(e); + auto *me = dynamic_cast<MythMediaEvent*>(e); if (me == nullptr) return; MythMediaDevice *device = me->getDevice(); @@ -9288,7 +9284,7 @@ void TV::customEvent(QEvent *e) return; uint cardnum = 0; - MythEvent *me = dynamic_cast<MythEvent*>(e); + auto *me = dynamic_cast<MythEvent*>(e); if (me == nullptr) return; QString message = me->Message(); @@ -10279,7 +10275,7 @@ bool TV::HandleOSDChannelEdit(PlayerContext *ctx, const QString& action) /** \fn TV::ChannelEditAutoFill(const PlayerContext*,InfoMap&) const * \brief Automatically fills in as much information as possible. */ -void TV::ChannelEditAutoFill(const PlayerContext *ctx, InfoMap &infoMap) const +void TV::ChannelEditAutoFill(const PlayerContext *ctx, InfoMap &infoMap) { #if 0 const QString keys[4] = { "XMLTV", "callsign", "channame", "channum", }; @@ -10289,7 +10285,7 @@ void TV::ChannelEditAutoFill(const PlayerContext *ctx, InfoMap &infoMap) const ChannelEditXDSFill(ctx, infoMap); } -void TV::ChannelEditXDSFill(const PlayerContext *ctx, InfoMap &infoMap) const +void TV::ChannelEditXDSFill(const PlayerContext *ctx, InfoMap &infoMap) { QMap<QString,bool> modifiable; if (!(modifiable["callsign"] = infoMap["callsign"].isEmpty())) @@ -10532,8 +10528,8 @@ void TV::OSDDialogEvent(int result, const QString& text, QString action) cur_channum = actx->m_tvchain->GetChannelName(-1); new_channum = cur_channum; - ChannelInfoList::const_iterator it = list.begin(); - for (; it != list.end(); ++it) + auto it = list.cbegin(); + for (; it != list.cend(); ++it) { if ((*it).m_channum == cur_channum) { @@ -11288,10 +11284,10 @@ bool TV::MenuItemDisplayPlayback(const MenuItemContext &c) else if (matchesGroup(actionName, "ADJUSTSTRETCH", category, prefix)) { static struct { - int speedX100; - QString suffix; - QString trans; - } speeds[] = { + int m_speedX100; + QString m_suffix; + QString m_trans; + } s_speeds[] = { { 0, "", tr("Adjust")}, { 50, "0.5", tr("0.5x")}, { 90, "0.9", tr("0.9x")}, @@ -11302,11 +11298,11 @@ bool TV::MenuItemDisplayPlayback(const MenuItemContext &c) {140, "1.4", tr("1.4x")}, {150, "1.5", tr("1.5x")}, }; - for (size_t i = 0; i < sizeof(speeds) / sizeof(*speeds); ++i) + for (size_t i = 0; i < sizeof(s_speeds) / sizeof(*s_speeds); ++i) { - QString action = prefix + speeds[i].suffix; - active = (m_tvmSpeedX100 == speeds[i].speedX100); - BUTTON(action, speeds[i].trans); + QString action = prefix + s_speeds[i].m_suffix; + active = (m_tvmSpeedX100 == s_speeds[i].m_speedX100); + BUTTON(action, s_speeds[i].m_trans); } } else if (matchesGroup(actionName, "TOGGLESLEEP", category, prefix)) @@ -11339,13 +11335,13 @@ bool TV::MenuItemDisplayPlayback(const MenuItemContext &c) { if (m_tvmIsRecording || m_tvmIsRecorded) { - static uint cas_ord[] = { 0, 2, 1 }; - for (size_t i = 0; i < sizeof(cas_ord)/sizeof(cas_ord[0]); i++) + static constexpr uint kCasOrd[] = { 0, 2, 1 }; + for (size_t i = 0; i < sizeof(kCasOrd)/sizeof(kCasOrd[0]); i++) { - const CommSkipMode mode = (CommSkipMode) cas_ord[i]; - QString action = prefix + QString::number(cas_ord[i]); + const auto mode = (CommSkipMode) kCasOrd[i]; + QString action = prefix + QString::number(kCasOrd[i]); active = (mode == m_tvmCurSkip); - BUTTON(action, toString((CommSkipMode) cas_ord[i])); + BUTTON(action, toString((CommSkipMode) kCasOrd[i])); } } } @@ -11406,7 +11402,7 @@ bool TV::MenuItemDisplayPlayback(const MenuItemContext &c) { uint inputid = ctx->GetCardID(); vector<InputInfo> inputs = RemoteRequestFreeInputInfo(inputid); - vector<InputInfo>::iterator it = inputs.begin(); + auto it = inputs.begin(); QSet <QString> addednames; addednames += CardUtil::GetDisplayName(inputid); for (; it != inputs.end(); ++it) @@ -11432,7 +11428,7 @@ bool TV::MenuItemDisplayPlayback(const MenuItemContext &c) uint sourceid = info["sourceid"].toUInt(); QMap<uint, bool> sourceids; vector<InputInfo> inputs = RemoteRequestFreeInputInfo(inputid); - vector<InputInfo>::iterator it = inputs.begin(); + auto it = inputs.begin(); for (; it != inputs.end(); ++it) { if ((*it).m_sourceid == sourceid || @@ -12011,7 +12007,7 @@ void TV::PlaybackMenuShow(const MenuBase &menu, PlaybackMenuDeinit(menu); } -void TV::MenuStrings(void) const +void TV::MenuStrings(void) { // Playback menu (void)tr("Playback Menu"); @@ -12628,7 +12624,7 @@ void TV::DoSeekRWND(PlayerContext *ctx) */ void TV::DVDJumpBack(PlayerContext *ctx) { - DVDRingBuffer *dvdrb = dynamic_cast<DVDRingBuffer*>(ctx->m_buffer); + auto *dvdrb = dynamic_cast<DVDRingBuffer*>(ctx->m_buffer); if (!ctx->HasPlayer() || !dvdrb) return; @@ -12667,7 +12663,7 @@ void TV::DVDJumpBack(PlayerContext *ctx) */ void TV::DVDJumpForward(PlayerContext *ctx) { - DVDRingBuffer *dvdrb = dynamic_cast<DVDRingBuffer*>(ctx->m_buffer); + auto *dvdrb = dynamic_cast<DVDRingBuffer*>(ctx->m_buffer); if (!ctx->HasPlayer() || !dvdrb) return; @@ -12710,7 +12706,7 @@ void TV::DVDJumpForward(PlayerContext *ctx) /* \fn TV::IsBookmarkAllowed(const PlayerContext*) const * \brief Returns true if bookmarks are allowed for the current player. */ -bool TV::IsBookmarkAllowed(const PlayerContext *ctx) const +bool TV::IsBookmarkAllowed(const PlayerContext *ctx) { ctx->LockPlayingInfo(__FILE__, __LINE__); @@ -12736,7 +12732,7 @@ bool TV::IsBookmarkAllowed(const PlayerContext *ctx) const /* \fn TV::IsDeleteAllowed(const PlayerContext*) const * \brief Returns true if the delete menu option should be offered. */ -bool TV::IsDeleteAllowed(const PlayerContext *ctx) const +bool TV::IsDeleteAllowed(const PlayerContext *ctx) { bool allowed = false; @@ -13245,7 +13241,7 @@ void TV::ReturnPlayerLock(const PlayerContext *&ctx) const ctx = nullptr; } -QString TV::GetLiveTVIndex(const PlayerContext *ctx) const +QString TV::GetLiveTVIndex(const PlayerContext *ctx) { #ifdef DEBUG_LIVETV_TRANSITION return (ctx->m_tvchain ? diff --git a/mythtv/libs/libmythtv/tv_play.h b/mythtv/libs/libmythtv/tv_play.h index e21409dc7a3..d28a4ffcc80 100644 --- a/mythtv/libs/libmythtv/tv_play.h +++ b/mythtv/libs/libmythtv/tv_play.h @@ -51,10 +51,10 @@ class TV; class TVBrowseHelper; struct osdInfo; -typedef void (*EMBEDRETURNVOID) (void *, bool); -typedef void (*EMBEDRETURNVOIDEPG) (uint, const QString &, const QDateTime, TV *, bool, bool, int); -typedef void (*EMBEDRETURNVOIDFINDER) (TV *, bool, bool); -typedef void (*EMBEDRETURNVOIDSCHEDIT) (const ProgramInfo *, void *); +using EMBEDRETURNVOID = void (*) (void *, bool); +using EMBEDRETURNVOIDEPG = void (*) (uint, const QString &, const QDateTime, TV *, bool, bool, int); +using EMBEDRETURNVOIDFINDER = void (*) (TV *, bool, bool); +using EMBEDRETURNVOIDSCHEDIT = void (*) (const ProgramInfo *, void *); // Locking order // @@ -96,12 +96,12 @@ enum scheduleEditTypes { /** * Type of message displayed in ShowNoRecorderDialog() */ -typedef enum +enum NoRecorderMsg { kNoRecorders = 0, ///< No free recorders kNoCurrRec = 1, ///< No current recordings kNoTuners = 2, ///< No capture cards configured -} NoRecorderMsg; +}; enum { kStartTVNoFlags = 0x00, @@ -115,21 +115,16 @@ enum { class AskProgramInfo { public: - AskProgramInfo() : - has_rec(false), has_later(false), - is_in_same_input_group(false), is_conflicting(false), - info(nullptr) {} + AskProgramInfo() = default; AskProgramInfo(const QDateTime &e, bool r, bool l, ProgramInfo *i) : - expiry(e), has_rec(r), has_later(l), - is_in_same_input_group(false), is_conflicting(false), - info(i) {} - - QDateTime expiry; - bool has_rec; - bool has_later; - bool is_in_same_input_group; - bool is_conflicting; - ProgramInfo *info; + m_expiry(e), m_hasRec(r), m_hasLater(l), m_info(i) {} + + QDateTime m_expiry; + bool m_hasRec {false}; + bool m_hasLater {false}; + bool m_isInSameInputGroup {false}; + bool m_isConflicting {false}; + ProgramInfo *m_info {nullptr}; }; enum MenuCategory { @@ -222,7 +217,7 @@ class MenuItemDisplayer class MenuBase { public: - MenuBase() : m_document(nullptr), m_translationContext("") {} + MenuBase() = default; ~MenuBase(); bool LoadFromFile(const QString &filename, const QString &menuname, @@ -257,8 +252,8 @@ class MenuBase const QString &keyBindingContext, int includeLevel); void ProcessIncludes(QDomElement &root, int includeLevel); - QDomDocument *m_document; - const char *m_translationContext; + QDomDocument *m_document {nullptr}; + const char *m_translationContext {""}; QString m_menuName; QString m_keyBindingContext; }; @@ -360,7 +355,7 @@ class MTV_PUBLIC TV : public QObject, public MenuItemDisplayer // Private initialisation bool Init(bool createWindow = true); void InitFromDB(void); - QList<QKeyEvent> ConvertScreenPressKeyMap(const QString& keyList); + static QList<QKeyEvent> ConvertScreenPressKeyMap(const QString& keyList); // Top level playback methods bool LiveTV(bool showDialogs, const ChannelInfoList &selection); @@ -393,7 +388,7 @@ class MTV_PUBLIC TV : public QObject, public MenuItemDisplayer const bool isDVD); bool TimeStretchHandleAction(PlayerContext*, const QStringList &actions); - bool DiscMenuHandleAction(PlayerContext*, const QStringList &actions); + static bool DiscMenuHandleAction(PlayerContext*, const QStringList &actions); bool Handle3D(PlayerContext *ctx, const QString &action); // Timers and timer events @@ -419,7 +414,7 @@ class MTV_PUBLIC TV : public QObject, public MenuItemDisplayer int editType = kScheduleProgramGuide); bool StartEmbedding(const QRect&); void StopEmbedding(void); - bool IsTunable(const PlayerContext*, uint chanid); + static bool IsTunable(const PlayerContext*, uint chanid); static QSet<uint> IsTunableOn(const PlayerContext*, uint chanid); void ChangeChannel(const PlayerContext*, const ChannelInfoList &options); void DoEditSchedule(int editType = kScheduleProgramGuide); @@ -457,7 +452,7 @@ class MTV_PUBLIC TV : public QObject, public MenuItemDisplayer static bool StateIsLiveTV(TVState state); TVState GetState(int player_idx) const; - TVState GetState(const PlayerContext*) const; + static TVState GetState(const PlayerContext*); void HandleStateChange(PlayerContext *mctx, PlayerContext *ctx); void GetStatus(void); void ForceNextStateNone(PlayerContext*); @@ -505,11 +500,11 @@ class MTV_PUBLIC TV : public QObject, public MenuItemDisplayer /// This is set if the user asked MythTV to jump to the previous /// recording in the playlist. bool getJumpToProgram(void) const { return m_jumpToProgram; } - bool IsDeleteAllowed(const PlayerContext*) const; + static bool IsDeleteAllowed(const PlayerContext*); // Channels - void ToggleChannelFavorite(PlayerContext *ctx); - void ToggleChannelFavorite(PlayerContext*, const QString&); + static void ToggleChannelFavorite(PlayerContext *ctx); + static void ToggleChannelFavorite(PlayerContext*, const QString&); void ChangeChannel(PlayerContext*, ChannelChangeDirection direction); void ChangeChannel(PlayerContext*, uint chanid, const QString &channum); @@ -547,7 +542,7 @@ class MTV_PUBLIC TV : public QObject, public MenuItemDisplayer void DoTogglePauseFinish(PlayerContext*, float time, bool showOSD); void DoTogglePause(PlayerContext*, bool showOSD); vector<bool> DoSetPauseState(PlayerContext *lctx, const vector<bool>&); - bool ContextIsPaused(PlayerContext *ctx, const char *file, int location); + static bool ContextIsPaused(PlayerContext *ctx, const char *file, int location); // Program jumping stuff void SetLastProgram(const ProgramInfo *rcinfo); @@ -584,20 +579,20 @@ class MTV_PUBLIC TV : public QObject, public MenuItemDisplayer void EnableUpmix(PlayerContext*, bool enable, bool toggle = false); void ChangeAudioSync(PlayerContext*, int dir, int newsync = -9999); bool AudioSyncHandleAction(PlayerContext*, const QStringList &actions); - void PauseAudioUntilBuffered(PlayerContext *ctx); + static void PauseAudioUntilBuffered(PlayerContext *ctx); // Chapters, titles and angles - int GetNumChapters(const PlayerContext*) const; - void GetChapterTimes(const PlayerContext*, QList<long long> ×) const; - int GetCurrentChapter(const PlayerContext*) const; - int GetNumTitles(const PlayerContext *ctx) const; - int GetCurrentTitle(const PlayerContext *ctx) const; - int GetTitleDuration(const PlayerContext *ctx, int title) const; - QString GetTitleName(const PlayerContext *ctx, int title) const; + static int GetNumChapters(const PlayerContext*); + static void GetChapterTimes(const PlayerContext*, QList<long long> ×); + static int GetCurrentChapter(const PlayerContext*); + static int GetNumTitles(const PlayerContext *ctx); + static int GetCurrentTitle(const PlayerContext *ctx); + static int GetTitleDuration(const PlayerContext *ctx, int title); + static QString GetTitleName(const PlayerContext *ctx, int title); void DoSwitchTitle(PlayerContext*, int title); - int GetNumAngles(const PlayerContext *ctx) const; - int GetCurrentAngle(const PlayerContext *ctx) const; - QString GetAngleName(const PlayerContext *ctx, int angle) const; + static int GetNumAngles(const PlayerContext *ctx); + static int GetCurrentAngle(const PlayerContext *ctx); + static QString GetAngleName(const PlayerContext *ctx, int angle); void DoSwitchAngle(PlayerContext*, int angle); void DoJumpChapter(PlayerContext*, int chapter); @@ -610,7 +605,7 @@ class MTV_PUBLIC TV : public QObject, public MenuItemDisplayer void DoQueueTranscode(PlayerContext*, const QString& profile); // Bookmarks - bool IsBookmarkAllowed(const PlayerContext*) const; + static bool IsBookmarkAllowed(const PlayerContext*); void SetBookmark(PlayerContext* ctx, bool clear = false); // OSD @@ -629,7 +624,7 @@ class MTV_PUBLIC TV : public QObject, public MenuItemDisplayer void UpdateOSDSeekMessage(const PlayerContext*, const QString &mesg, enum OSDTimeout timeout); void UpdateOSDInput(const PlayerContext*); - void UpdateOSDSignal(const PlayerContext*, const QStringList &strlist); + void UpdateOSDSignal(PlayerContext*, const QStringList &strlist); void UpdateOSDTimeoutMessage(PlayerContext*); void UpdateOSDAskAllowDialog(PlayerContext*); void SetUpdateOSDPosition(bool set_it); @@ -654,7 +649,7 @@ class MTV_PUBLIC TV : public QObject, public MenuItemDisplayer void PxPToggleType( PlayerContext *mctx, bool wantPBP); void PxPSwap( PlayerContext *mctx, PlayerContext *pipctx); bool PIPAddPlayer( PlayerContext *mctx, PlayerContext *ctx); - bool PIPRemovePlayer(PlayerContext *mctx, PlayerContext *ctx); + static bool PIPRemovePlayer(PlayerContext *mctx, PlayerContext *ctx); void PBPRestartMainPlayer(PlayerContext *mctx); void SetActive(PlayerContext *lctx, int index, bool osd_msg); @@ -665,7 +660,7 @@ class MTV_PUBLIC TV : public QObject, public MenuItemDisplayer AspectOverrideMode aspectMode = kAspect_Toggle); void ToggleAdjustFill(PlayerContext*, AdjustFillMode adjustfillMode = kAdjustFill_Toggle); - void DoToggleNightMode(const PlayerContext*); + static void DoToggleNightMode(const PlayerContext*); void DoTogglePictureAttribute(const PlayerContext*, PictureAdjustType type); void DoChangePictureAttribute( @@ -676,10 +671,10 @@ class MTV_PUBLIC TV : public QObject, public MenuItemDisplayer const QStringList &actions); static PictureAttribute NextPictureAdjustType( PictureAdjustType type, MythPlayer *mp, PictureAttribute attr); - void HandleDeinterlacer(PlayerContext* ctx, const QString &action); + static void HandleDeinterlacer(PlayerContext* ctx, const QString &action); // Sundry on screen - void ITVRestart(PlayerContext*, bool isLive); + static void ITVRestart(PlayerContext*, bool isLive); void EnableVisualisation(const PlayerContext*, bool enable, bool toggle = false, const QString &action = QString("")); @@ -691,8 +686,8 @@ class MTV_PUBLIC TV : public QObject, public MenuItemDisplayer // Channel editing support void StartChannelEditMode(PlayerContext*); bool HandleOSDChannelEdit(PlayerContext*, const QString& action); - void ChannelEditAutoFill(const PlayerContext*, InfoMap&) const; - void ChannelEditXDSFill(const PlayerContext*, InfoMap&) const; + static void ChannelEditAutoFill(const PlayerContext*, InfoMap&); + static void ChannelEditXDSFill(const PlayerContext*, InfoMap&); // General dialog handling bool DialogIsVisible(PlayerContext *ctx, const QString &dialog); @@ -750,7 +745,7 @@ class MTV_PUBLIC TV : public QObject, public MenuItemDisplayer bool MenuItemDisplayCutlist(const MenuItemContext &c); void PlaybackMenuInit(const MenuBase &menu); void PlaybackMenuDeinit(const MenuBase &menu); - void MenuStrings(void) const; + static void MenuStrings(void); void MenuLazyInit(void *field); // LCD @@ -769,7 +764,7 @@ class MTV_PUBLIC TV : public QObject, public MenuItemDisplayer // for temp debugging only.. int find_player_index(const PlayerContext*) const; - QString GetLiveTVIndex(const PlayerContext*) const; + static QString GetLiveTVIndex(const PlayerContext*); private: // Configuration variables from database @@ -949,8 +944,8 @@ class MTV_PUBLIC TV : public QObject, public MenuItemDisplayer MythDeque<QString> networkControlCommands; // Timers - typedef QMap<int,PlayerContext*> TimerContextMap; - typedef QMap<int,const PlayerContext*> TimerContextConstMap; + using TimerContextMap = QMap<int,PlayerContext*>; + using TimerContextConstMap = QMap<int,const PlayerContext*>; mutable QMutex m_timerIdLock; volatile int m_lcdTimerId {0}; volatile int m_lcdVolumeTimerId {0}; diff --git a/mythtv/libs/libmythtv/tv_play_win.cpp b/mythtv/libs/libmythtv/tv_play_win.cpp index 7f5c2a0b6a8..c7bb92fd880 100644 --- a/mythtv/libs/libmythtv/tv_play_win.cpp +++ b/mythtv/libs/libmythtv/tv_play_win.cpp @@ -13,7 +13,7 @@ TvPlayWindow::TvPlayWindow(MythScreenStack *parent, const char *name) - : MythScreenType(parent, name), m_progressBar(nullptr), m_progress(0) + : MythScreenType(parent, name) { SetCanTakeFocus(true); } diff --git a/mythtv/libs/libmythtv/tv_play_win.h b/mythtv/libs/libmythtv/tv_play_win.h index 92a5a41b990..17b8215a52c 100644 --- a/mythtv/libs/libmythtv/tv_play_win.h +++ b/mythtv/libs/libmythtv/tv_play_win.h @@ -23,8 +23,8 @@ class TvPlayWindow : public MythScreenType void UpdateProgress(void); protected: - MythUIProgressBar *m_progressBar; - int m_progress; + MythUIProgressBar *m_progressBar {nullptr}; + int m_progress {0}; }; #endif diff --git a/mythtv/libs/libmythtv/tv_rec.cpp b/mythtv/libs/libmythtv/tv_rec.cpp index 726486fcab7..f23b5d989ae 100644 --- a/mythtv/libs/libmythtv/tv_rec.cpp +++ b/mythtv/libs/libmythtv/tv_rec.cpp @@ -109,7 +109,7 @@ bool TVRec::CreateChannel(const QString &startchannel, this, m_genOpt, m_dvbOpt, m_fwOpt, startchannel, enter_power_save_mode, m_rbFileExt, setchan); - if (m_genOpt.inputtype == "VBOX") + if (m_genOpt.m_inputType == "VBOX") { if (!CardUtil::IsVBoxPresent(m_inputid)) { @@ -282,8 +282,8 @@ void TVRec::RecordPending(const ProgramInfo *rcinfo, int secsleft, PendingMap::iterator it = m_pendingRecordings.find(rcinfo->GetInputID()); if (it != m_pendingRecordings.end()) { - (*it).ask = false; - (*it).doNotAsk = (*it).canceled = true; + (*it).m_ask = false; + (*it).m_doNotAsk = (*it).m_canceled = true; } return; } @@ -292,11 +292,11 @@ void TVRec::RecordPending(const ProgramInfo *rcinfo, int secsleft, QString("RecordPending on inputid [%1]").arg(rcinfo->GetInputID())); PendingInfo pending; - pending.info = new ProgramInfo(*rcinfo); - pending.recordingStart = MythDate::current().addSecs(secsleft); - pending.hasLaterShowing = hasLater; - pending.ask = true; - pending.doNotAsk = false; + pending.m_info = new ProgramInfo(*rcinfo); + pending.m_recordingStart = MythDate::current().addSecs(secsleft); + pending.m_hasLaterShowing = hasLater; + pending.m_ask = true; + pending.m_doNotAsk = false; m_pendingRecordings[rcinfo->GetInputID()] = pending; @@ -308,7 +308,7 @@ void TVRec::RecordPending(const ProgramInfo *rcinfo, int secsleft, vector<uint> inputids = CardUtil::GetConflictingInputs( rcinfo->GetInputID()); - m_pendingRecordings[rcinfo->GetInputID()].possibleConflicts = inputids; + m_pendingRecordings[rcinfo->GetInputID()].m_possibleConflicts = inputids; pendlock.unlock(); statelock.unlock(); @@ -360,7 +360,7 @@ void TVRec::CancelNextRecording(bool cancel) if (cancel) { - vector<uint> &inputids = (*it).possibleConflicts; + vector<uint> &inputids = (*it).m_possibleConflicts; for (size_t i = 0; i < inputids.size(); i++) { LOG(VB_RECORD, LOG_INFO, LOC + @@ -368,7 +368,7 @@ void TVRec::CancelNextRecording(bool cancel) .arg((uint64_t)inputids[i],0,16)); pendlock.unlock(); - RemoteRecordPending(inputids[i], (*it).info, -1, false); + RemoteRecordPending(inputids[i], (*it).m_info, -1, false); pendlock.relock(); } @@ -376,11 +376,11 @@ void TVRec::CancelNextRecording(bool cancel) QString("CancelNextRecording -- inputid [%1]") .arg(m_inputid)); - RecordPending((*it).info, -1, false); + RecordPending((*it).m_info, -1, false); } else { - (*it).canceled = false; + (*it).m_canceled = false; } LOG(VB_RECORD, LOG_INFO, LOC + @@ -450,8 +450,8 @@ RecStatus::Type TVRec::StartRecording(ProgramInfo *pginfo) m_pendingRecLock.lock(); if ((it = m_pendingRecordings.find(m_inputid)) != m_pendingRecordings.end()) { - (*it).ask = (*it).doNotAsk = false; - cancelNext = (*it).canceled; + (*it).m_ask = (*it).m_doNotAsk = false; + cancelNext = (*it).m_canceled; } m_pendingRecLock.unlock(); @@ -470,11 +470,11 @@ RecStatus::Type TVRec::StartRecording(ProgramInfo *pginfo) // If the needed input is in a shared input group, and we are // not canceling the recording anyway, check other recorders - if (!cancelNext && has_pending && !pendinfo.possibleConflicts.empty()) + if (!cancelNext && has_pending && !pendinfo.m_possibleConflicts.empty()) { LOG(VB_RECORD, LOG_INFO, LOC + "Checking input group recorders - begin"); - vector<uint> &inputids = pendinfo.possibleConflicts; + vector<uint> &inputids = pendinfo.m_possibleConflicts; uint mplexid = 0, chanid = 0, sourceid = 0; vector<uint> inputids2; @@ -488,9 +488,9 @@ RecStatus::Type TVRec::StartRecording(ProgramInfo *pginfo) if (is_busy && !sourceid) { - mplexid = pendinfo.info->QueryMplexID(); - chanid = pendinfo.info->GetChanID(); - sourceid = pendinfo.info->GetSourceID(); + mplexid = pendinfo.m_info->QueryMplexID(); + chanid = pendinfo.m_info->GetChanID(); + sourceid = pendinfo.m_info->GetSourceID(); } if (is_busy && @@ -641,7 +641,7 @@ RecStatus::Type TVRec::StartRecording(ProgramInfo *pginfo) } for (int i = 0; i < m_pendingRecordings.size(); i++) - delete m_pendingRecordings[i].info; + delete m_pendingRecordings[i].m_info; m_pendingRecordings.clear(); if (!did_switch) @@ -841,26 +841,26 @@ void TVRec::FinishedRecording(RecordingInfo *curRec, RecordingQuality *recq) // Figure out if this was already done for this recording bool was_finished = false; - static QMutex finRecLock; - static QHash<QString,QDateTime> finRecMap; + static QMutex s_finRecLock; + static QHash<QString,QDateTime> s_finRecMap; { - QMutexLocker locker(&finRecLock); + QMutexLocker locker(&s_finRecLock); QDateTime now = MythDate::current(); QDateTime expired = now.addSecs(-60*5); - QHash<QString,QDateTime>::iterator it = finRecMap.begin(); - while (it != finRecMap.end()) + QHash<QString,QDateTime>::iterator it = s_finRecMap.begin(); + while (it != s_finRecMap.end()) { if ((*it) < expired) - it = finRecMap.erase(it); + it = s_finRecMap.erase(it); else ++it; } QString key = curRec->MakeUniqueKey(); - it = finRecMap.find(key); - if (it != finRecMap.end()) + it = s_finRecMap.find(key); + if (it != s_finRecMap.end()) was_finished = true; else - finRecMap[key] = now; + s_finRecMap[key] = now; } // Print something informative to the log @@ -1160,11 +1160,11 @@ DTVRecorder *TVRec::GetDTVRecorder(void) void TVRec::CloseChannel(void) { if (m_channel && - ((m_genOpt.inputtype == "DVB" && m_dvbOpt.dvb_on_demand) || - m_genOpt.inputtype == "FREEBOX" || - m_genOpt.inputtype == "VBOX" || - m_genOpt.inputtype == "HDHOMERUN" || - CardUtil::IsV4L(m_genOpt.inputtype))) + ((m_genOpt.m_inputType == "DVB" && m_dvbOpt.m_dvbOnDemand) || + m_genOpt.m_inputType == "FREEBOX" || + m_genOpt.m_inputType == "VBOX" || + m_genOpt.m_inputType == "HDHOMERUN" || + CardUtil::IsV4L(m_genOpt.m_inputType))) { m_channel->Close(); } @@ -1265,9 +1265,9 @@ void TVRec::run(void) m_eitScanStartTime = MythDate::current(); // check whether we should use the EITScanner in this TVRec instance - if (CardUtil::IsEITCapable(m_genOpt.inputtype) && + if (CardUtil::IsEITCapable(m_genOpt.m_inputType) && (!GetDTVChannel() || GetDTVChannel()->IsMaster()) && - (m_dvbOpt.dvb_eitscan || get_use_eit(m_inputid))) + (m_dvbOpt.m_dvbEitScan || get_use_eit(m_inputid))) { m_scanner = new EITScanner(m_inputid); m_eitScanStartTime = m_eitScanStartTime.addSecs( @@ -1418,7 +1418,7 @@ void TVRec::run(void) if (m_scanner && m_channel && MythDate::current() > m_eitScanStartTime) { - if (!m_dvbOpt.dvb_eitscan) + if (!m_dvbOpt.m_dvbEitScan) { LOG(VB_EIT, LOG_INFO, LOC + "EIT scanning disabled for this input."); @@ -1554,14 +1554,14 @@ void TVRec::HandlePendingRecordings(void) for (it = m_pendingRecordings.begin(); it != m_pendingRecordings.end();) { next = it; ++next; - if (MythDate::current() > (*it).recordingStart.addSecs(30)) + if (MythDate::current() > (*it).m_recordingStart.addSecs(30)) { LOG(VB_RECORD, LOG_INFO, LOC + "Deleting stale pending recording " + QString("[%1] '%2'") - .arg((*it).info->GetInputID()) - .arg((*it).info->GetTitle())); + .arg((*it).m_info->GetInputID()) + .arg((*it).m_info->GetTitle())); - delete (*it).info; + delete (*it).m_info; m_pendingRecordings.erase(it); } it = next; @@ -1585,41 +1585,41 @@ void TVRec::HandlePendingRecordings(void) bool has_rec = false; it = m_pendingRecordings.begin(); if ((1 == m_pendingRecordings.size()) && - (*it).ask && - ((*it).info->GetInputID() == m_inputid) && + (*it).m_ask && + ((*it).m_info->GetInputID() == m_inputid) && (GetState() == kState_WatchingLiveTV)) { CheckForRecGroupChange(); has_rec = m_pseudoLiveTVRecording && (m_pseudoLiveTVRecording->GetRecordingEndTime() > - (*it).recordingStart); + (*it).m_recordingStart); } for (it = m_pendingRecordings.begin(); it != m_pendingRecordings.end(); ++it) { - if (!(*it).ask && !(*it).doNotAsk) + if (!(*it).m_ask && !(*it).m_doNotAsk) continue; - int timeuntil = ((*it).doNotAsk) ? - -1: MythDate::current().secsTo((*it).recordingStart); + int timeuntil = ((*it).m_doNotAsk) ? + -1: MythDate::current().secsTo((*it).m_recordingStart); if (has_rec) - (*it).canceled = true; + (*it).m_canceled = true; QString query = QString("ASK_RECORDING %1 %2 %3 %4") .arg(m_inputid) .arg(timeuntil) .arg(has_rec ? 1 : 0) - .arg((*it).hasLaterShowing ? 1 : 0); + .arg((*it).m_hasLaterShowing ? 1 : 0); LOG(VB_GENERAL, LOG_INFO, LOC + query); QStringList msg; - (*it).info->ToStringList(msg); + (*it).m_info->ToStringList(msg); MythEvent me(query, msg); gCoreContext->dispatch(me); - (*it).ask = (*it).doNotAsk = false; + (*it).m_ask = (*it).m_doNotAsk = false; } } @@ -1660,50 +1660,50 @@ bool TVRec::GetDevices(uint inputid, // General options test = query.value(0).toString(); if (!test.isEmpty()) - gen_opts.videodev = test; + gen_opts.m_videoDev = test; test = query.value(1).toString(); if (!test.isEmpty()) - gen_opts.vbidev = test; + gen_opts.m_vbiDev = test; test = query.value(2).toString(); if (!test.isEmpty()) - gen_opts.audiodev = test; + gen_opts.m_audioDev = test; - gen_opts.audiosamplerate = max(testnum, query.value(3).toInt()); + gen_opts.m_audioSampleRate = max(testnum, query.value(3).toInt()); test = query.value(4).toString(); if (!test.isEmpty()) - gen_opts.inputtype = test; + gen_opts.m_inputType = test; - gen_opts.skip_btaudio = query.value(5).toBool(); + gen_opts.m_skipBtAudio = query.value(5).toBool(); - gen_opts.signal_timeout = (uint) max(query.value(6).toInt(), 0); - gen_opts.channel_timeout = (uint) max(query.value(7).toInt(), 0); + gen_opts.m_signalTimeout = (uint) max(query.value(6).toInt(), 0); + gen_opts.m_channelTimeout = (uint) max(query.value(7).toInt(), 0); // We should have at least 100 ms to acquire tables... - int table_timeout = ((int)gen_opts.channel_timeout - - (int)gen_opts.signal_timeout); + int table_timeout = ((int)gen_opts.m_channelTimeout - + (int)gen_opts.m_signalTimeout); if (table_timeout < 100) - gen_opts.channel_timeout = gen_opts.signal_timeout + 2500; + gen_opts.m_channelTimeout = gen_opts.m_signalTimeout + 2500; - gen_opts.wait_for_seqstart = query.value(8).toBool(); + gen_opts.m_waitForSeqstart = query.value(8).toBool(); // DVB options uint dvboff = 9; - dvb_opts.dvb_on_demand = query.value(dvboff + 0).toBool(); - dvb_opts.dvb_tuning_delay = query.value(dvboff + 1).toUInt(); - dvb_opts.dvb_eitscan = query.value(dvboff + 2).toBool(); + dvb_opts.m_dvbOnDemand = query.value(dvboff + 0).toBool(); + dvb_opts.m_dvbTuningDelay = query.value(dvboff + 1).toUInt(); + dvb_opts.m_dvbEitScan = query.value(dvboff + 2).toBool(); // Firewire options uint fireoff = dvboff + 3; - firewire_opts.speed = query.value(fireoff + 0).toUInt(); + firewire_opts.m_speed = query.value(fireoff + 0).toUInt(); test = query.value(fireoff + 1).toString(); if (!test.isEmpty()) - firewire_opts.model = test; + firewire_opts.m_model = test; - firewire_opts.connection = query.value(fireoff + 2).toUInt(); + firewire_opts.m_connection = query.value(fireoff + 2).toUInt(); parentid = query.value(15).toUInt(); @@ -1868,7 +1868,7 @@ bool TVRec::SetupDTVSignalMonitor(bool EITscan) } QString recording_type = "all"; - RecordingInfo *rec = m_lastTuningRequest.program; + RecordingInfo *rec = m_lastTuningRequest.m_program; RecordingProfile profile; m_recProfileName = LoadProfile(m_tvChain, rec, profile); const StandardSetting *setting = profile.byName("recordingtype"); @@ -1885,7 +1885,7 @@ bool TVRec::SetupDTVSignalMonitor(bool EITscan) QString msg = QString("ATSC channel: %1_%2").arg(major).arg(minor); LOG(VB_RECORD, LOG_INFO, LOC + msg); - ATSCStreamData *asd = dynamic_cast<ATSCStreamData*>(sd); + auto *asd = dynamic_cast<ATSCStreamData*>(sd); if (!asd) { sd = asd = new ATSCStreamData(major, minor, m_inputid); @@ -1911,12 +1911,12 @@ bool TVRec::SetupDTVSignalMonitor(bool EITscan) // Check if this is an DVB channel int progNum = dtvchan->GetProgramNumber(); - if ((progNum >= 0) && (tuningmode == "dvb") && (m_genOpt.inputtype != "VBOX")) + if ((progNum >= 0) && (tuningmode == "dvb") && (m_genOpt.m_inputType != "VBOX")) { int netid = dtvchan->GetOriginalNetworkID(); int tsid = dtvchan->GetTransportID(); - DVBStreamData *dsd = dynamic_cast<DVBStreamData*>(sd); + auto *dsd = dynamic_cast<DVBStreamData*>(sd); if (!dsd) { sd = dsd = new DVBStreamData(netid, tsid, progNum, m_inputid); @@ -2043,14 +2043,14 @@ bool TVRec::SetupSignalMonitor(bool tablemon, bool EITscan, bool notify) return false; // nothing to monitor here either (DummyChannel) - if (m_genOpt.inputtype == "IMPORT" || m_genOpt.inputtype == "DEMO") + if (m_genOpt.m_inputType == "IMPORT" || m_genOpt.m_inputType == "DEMO") return true; // make sure statics are initialized SignalMonitorValue::Init(); - if (SignalMonitor::IsSupported(m_genOpt.inputtype) && m_channel->Open()) - m_signalMonitor = SignalMonitor::Init(m_genOpt.inputtype, m_inputid, + if (SignalMonitor::IsSupported(m_genOpt.m_inputType) && m_channel->Open()) + m_signalMonitor = SignalMonitor::Init(m_genOpt.m_inputType, m_inputid, m_channel, false); if (m_signalMonitor) @@ -2129,7 +2129,7 @@ int TVRec::SetSignalMonitoringRate(int rate, int notifyFrontend) QMutexLocker lock(&m_stateChangeLock); - if (!SignalMonitor::IsSupported(m_genOpt.inputtype)) + if (!SignalMonitor::IsSupported(m_genOpt.m_inputType)) { LOG(VB_GENERAL, LOG_ERR, LOC + "Signal Monitoring is notsupported by your hardware."); @@ -2321,7 +2321,7 @@ bool TVRec::CheckChannelPrefix(const QString &prefix, #endif static const uint kSpacerListSize = 5; - static const char* spacers[kSpacerListSize] = { "", "_", "-", "#", "." }; + static const char* s_spacers[kSpacerListSize] = { "", "_", "-", "#", "." }; MSqlQuery query(MSqlQuery::InitCon()); QString basequery = QString( @@ -2347,7 +2347,7 @@ bool TVRec::CheckChannelPrefix(const QString &prefix, for (uint j = 0; j < kSpacerListSize; j++) { QString qprefix = add_spacer( - prefix, (QString(spacers[j]) == "_") ? "\\_" : spacers[j]); + prefix, (QString(s_spacers[j]) == "_") ? "\\_" : s_spacers[j]); query.prepare(basequery.arg(qprefix) + inputquery[i]); if (!query.exec() || !query.isActive()) @@ -2361,7 +2361,7 @@ bool TVRec::CheckChannelPrefix(const QString &prefix, fchanid.push_back(query.value(0).toUInt()); fchannum.push_back(query.value(1).toString()); finputid.push_back(query.value(2).toUInt()); - fspacer.emplace_back(spacers[j]); + fspacer.emplace_back(s_spacers[j]); #if DEBUG_CHANNEL_PREFIX LOG(VB_GENERAL, LOG_DEBUG, QString("(%1,%2) Adding %3 rec %4") @@ -2514,15 +2514,15 @@ bool TVRec::IsBusy(InputInfo *busy_input, int time_buffer) const if (!busy_input->m_inputid && has_pending) { int timeLeft = MythDate::current() - .secsTo(pendinfo.recordingStart); + .secsTo(pendinfo.m_recordingStart); if (timeLeft <= time_buffer) { QString channum, input; - if (pendinfo.info->QueryTuningInfo(channum, input)) + if (pendinfo.m_info->QueryTuningInfo(channum, input)) { busy_input->m_inputid = m_channel->GetInputID(); - chanid = pendinfo.info->GetChanID(); + chanid = pendinfo.m_info->GetChanID(); } } } @@ -2639,12 +2639,12 @@ bool TVRec::GetKeyframeDurations( long long TVRec::GetMaxBitrate(void) const { long long bitrate; - if (m_genOpt.inputtype == "MPEG") + if (m_genOpt.m_inputType == "MPEG") // NOLINTNEXTLINE(bugprone-branch-clone) bitrate = 10080000LL; // use DVD max bit rate - else if (m_genOpt.inputtype == "HDPVR") + else if (m_genOpt.m_inputType == "HDPVR") bitrate = 20200000LL; // Peek bit rate for HD-PVR - else if (!CardUtil::IsEncoder(m_genOpt.inputtype)) + else if (!CardUtil::IsEncoder(m_genOpt.m_inputType)) bitrate = 22200000LL; // 1080i else // frame grabber bitrate = 10080000LL; // use DVD max bit rate, probably too big @@ -2665,12 +2665,12 @@ void TVRec::SpawnLiveTV(LiveTVChain *newchain, bool pip, QString startchan) m_tvChain->IncrRef(); // mark it for TVRec use m_tvChain->ReloadAll(); - QString hostprefix = gCoreContext->GenMythURL( + QString hostprefix = MythCoreContext::GenMythURL( gCoreContext->GetHostName(), gCoreContext->GetBackendServerPort()); m_tvChain->SetHostPrefix(hostprefix); - m_tvChain->SetInputType(m_genOpt.inputtype); + m_tvChain->SetInputType(m_genOpt.m_inputType); m_ispip = pip; m_liveTVStartChannel = std::move(startchan); @@ -3088,17 +3088,17 @@ void TVRec::SetChannel(const QString& name, uint requestType) if (requestType & kFlagDetect) { WaitForEventThreadSleep(); - requestType = m_lastTuningRequest.flags & (kFlagRec | kFlagNoRec); + requestType = m_lastTuningRequest.m_flags & (kFlagRec | kFlagNoRec); } // Clear the RingBuffer reset flag, in case we wait for a reset below ClearFlags(kFlagRingBufferReady, __FILE__, __LINE__); // Clear out any EITScan channel change requests - TuningQueue::iterator it = m_tuningRequests.begin(); + auto it = m_tuningRequests.begin(); while (it != m_tuningRequests.end()) { - if ((*it).flags & kFlagEITScan) + if ((*it).m_flags & kFlagEITScan) it = m_tuningRequests.erase(it); else ++it; @@ -3398,17 +3398,17 @@ QString TVRec::TuningGetChanNum(const TuningRequest &request, { QString channum; - if (request.program) + if (request.m_program) { - request.program->QueryTuningInfo(channum, input); + request.m_program->QueryTuningInfo(channum, input); return channum; } - channum = request.channel; - input = request.input; + channum = request.m_channel; + input = request.m_input; // If this is Live TV startup, we need a channel... - if (channum.isEmpty() && (request.flags & kFlagLiveTV)) + if (channum.isEmpty() && (request.m_flags & kFlagLiveTV)) { if (!m_liveTVStartChannel.isEmpty()) channum = m_liveTVStartChannel; @@ -3418,7 +3418,7 @@ QString TVRec::TuningGetChanNum(const TuningRequest &request, channum = GetStartChannel(m_inputid); } } - if (request.flags & kFlagLiveTV) + if (request.m_flags & kFlagLiveTV) m_channel->Init(channum, false); if (m_channel && !channum.isEmpty() && (channum.indexOf("NextChannel") >= 0)) @@ -3434,7 +3434,7 @@ QString TVRec::TuningGetChanNum(const TuningRequest &request, bool TVRec::TuningOnSameMultiplex(TuningRequest &request) { - if ((request.flags & kFlagAntennaAdjust) || request.input.isEmpty() || + if ((request.m_flags & kFlagAntennaAdjust) || request.m_input.isEmpty() || !GetDTVRecorder() || m_signalMonitor || !m_channel || !m_channel->IsOpen()) { return false; @@ -3442,12 +3442,12 @@ bool TVRec::TuningOnSameMultiplex(TuningRequest &request) uint sourceid = m_channel->GetSourceID(); QString oldchannum = m_channel->GetChannelName(); - QString newchannum = request.channel; + QString newchannum = request.m_channel; if (ChannelUtil::IsOnSameMultiplex(sourceid, newchannum, oldchannum)) { MPEGStreamData *mpeg = GetDTVRecorder()->GetStreamData(); - ATSCStreamData *atsc = dynamic_cast<ATSCStreamData*>(mpeg); + auto *atsc = dynamic_cast<ATSCStreamData*>(mpeg); if (atsc) { @@ -3456,8 +3456,8 @@ bool TVRec::TuningOnSameMultiplex(TuningRequest &request) if (minor && atsc->HasChannel(major, minor)) { - request.majorChan = major; - request.minorChan = minor; + request.m_majorChan = major; + request.m_minorChan = minor; return true; } } @@ -3467,7 +3467,7 @@ bool TVRec::TuningOnSameMultiplex(TuningRequest &request) uint progNum = ChannelUtil::GetProgramNumber(sourceid, newchannum); if (mpeg->HasProgram(progNum)) { - request.progNum = progNum; + request.m_progNum = progNum; return true; } } @@ -3492,8 +3492,8 @@ void TVRec::HandleTuning(void) "HandleTuning Request: " + request.toString()); QString input; - request.channel = TuningGetChanNum(request, input); - request.input = input; + request.m_channel = TuningGetChanNum(request, input); + request.m_input = input; if (TuningOnSameMultiplex(request)) LOG(VB_CHANNEL, LOG_INFO, LOC + "On same multiplex"); @@ -3505,8 +3505,8 @@ void TVRec::HandleTuning(void) m_tuningRequests.dequeue(); // Now we start new stuff - if (request.flags & (kFlagRecording|kFlagLiveTV| - kFlagEITScan|kFlagAntennaAdjust)) + if (request.m_flags & (kFlagRecording|kFlagLiveTV| + kFlagEITScan|kFlagAntennaAdjust)) { if (!m_recorder) { @@ -3562,7 +3562,7 @@ void TVRec::TuningShutdowns(const TuningRequest &request) QString channum, inputname; - if (m_scanner && !(request.flags & kFlagEITScan) && + if (m_scanner && !(request.m_flags & kFlagEITScan) && HasFlags(kFlagEITScannerRunning)) { m_scanner->StopActiveScan(); @@ -3594,7 +3594,7 @@ void TVRec::TuningShutdowns(const TuningRequest &request) // At this point any waits are canceled. - if (request.flags & kFlagNoRec) + if (request.m_flags & kFlagNoRec) { if (HasFlags(kFlagDummyRecorderRunning)) { @@ -3609,7 +3609,7 @@ void TVRec::TuningShutdowns(const TuningRequest &request) m_curRecording->GetRecordingStatus() == RecStatus::Failing))) { m_stateChangeLock.unlock(); - TeardownRecorder(request.flags); + TeardownRecorder(request.m_flags); m_stateChangeLock.lock(); } // At this point the recorders are shut down @@ -3618,7 +3618,7 @@ void TVRec::TuningShutdowns(const TuningRequest &request) // At this point the channel is shut down } - if (m_ringBuffer && (request.flags & kFlagKillRingBuffer)) + if (m_ringBuffer && (request.m_flags & kFlagKillRingBuffer)) { LOG(VB_RECORD, LOG_INFO, LOC + "Tearing down RingBuffer"); SetRingBuffer(nullptr); @@ -3665,20 +3665,20 @@ void TVRec::TuningFrequency(const TuningRequest &request) dtvchan->SetTuningMode(tuningmode); - if (request.minorChan && (tuningmode == "atsc")) + if (request.m_minorChan && (tuningmode == "atsc")) { - m_channel->SetChannelByString(request.channel); + m_channel->SetChannelByString(request.m_channel); - ATSCStreamData *atsc = dynamic_cast<ATSCStreamData*>(mpeg); + auto *atsc = dynamic_cast<ATSCStreamData*>(mpeg); if (atsc) - atsc->SetDesiredChannel(request.majorChan, request.minorChan); + atsc->SetDesiredChannel(request.m_majorChan, request.m_minorChan); } - else if (request.progNum >= 0) + else if (request.m_progNum >= 0) { - m_channel->SetChannelByString(request.channel); + m_channel->SetChannelByString(request.m_channel); if (mpeg) - mpeg->SetDesiredProgram(request.progNum); + mpeg->SetDesiredProgram(request.m_progNum); } } @@ -3690,7 +3690,7 @@ void TVRec::TuningFrequency(const TuningRequest &request) if (m_channel) { m_channel->Renumber( CardUtil::GetSourceID(m_channel->GetInputID()), - m_channel->GetChannelName(), request.channel ); + m_channel->GetChannelName(), request.m_channel ); } QStringList slist; @@ -3702,7 +3702,7 @@ void TVRec::TuningFrequency(const TuningRequest &request) return; } - QString channum = request.channel; + QString channum = request.m_channel; bool ok1; if (m_channel) @@ -3718,7 +3718,7 @@ void TVRec::TuningFrequency(const TuningRequest &request) if (!ok1) { - if (!(request.flags & kFlagLiveTV) || !(request.flags & kFlagEITScan)) + if (!(request.m_flags & kFlagLiveTV) || !(request.m_flags & kFlagEITScan)) { if (m_curRecording) m_curRecording->SetRecordingStatus(RecStatus::Failed); @@ -3751,9 +3751,9 @@ void TVRec::TuningFrequency(const TuningRequest &request) } - bool livetv = (request.flags & kFlagLiveTV) != 0U; - bool antadj = (request.flags & kFlagAntennaAdjust) != 0U; - bool use_sm = !mpts_only && SignalMonitor::IsRequired(m_genOpt.inputtype); + bool livetv = (request.m_flags & kFlagLiveTV) != 0U; + bool antadj = (request.m_flags & kFlagAntennaAdjust) != 0U; + bool use_sm = !mpts_only && SignalMonitor::IsRequired(m_genOpt.m_inputType); bool use_dr = use_sm && (livetv || antadj); bool has_dummy = false; @@ -3772,7 +3772,7 @@ void TVRec::TuningFrequency(const TuningRequest &request) ok2 = SwitchLiveTVRingBuffer(channum, true, false); m_pseudoLiveTVRecording = tmp; - m_tvChain->SetInputType(m_genOpt.inputtype); + m_tvChain->SetInputType(m_genOpt.m_inputType); if (!ok2) { @@ -3789,7 +3789,7 @@ void TVRec::TuningFrequency(const TuningRequest &request) LOG(VB_RECORD, LOG_INFO, LOC + "Starting Signal Monitor"); bool error = false; if (!SetupSignalMonitor( - !antadj, (request.flags & kFlagEITScan) != 0U, livetv || antadj)) + !antadj, (request.m_flags & kFlagEITScan) != 0U, livetv || antadj)) { LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to setup signal monitor"); if (m_signalMonitor) @@ -3806,7 +3806,7 @@ void TVRec::TuningFrequency(const TuningRequest &request) if (m_signalMonitor) { - if (request.flags & kFlagEITScan) + if (request.m_flags & kFlagEITScan) { GetDTVSignalMonitor()->GetStreamData()-> SetVideoStreamsRequired(0); @@ -3827,9 +3827,9 @@ void TVRec::TuningFrequency(const TuningRequest &request) // recording is marked as failed, so the scheduler // can try another showing. m_startRecordingDeadline = - expire.addMSecs(m_genOpt.channel_timeout); + expire.addMSecs(m_genOpt.m_channelTimeout); m_preFailDeadline = - expire.addMSecs(m_genOpt.channel_timeout * 2 / 3); + expire.addMSecs(m_genOpt.m_channelTimeout * 2 / 3); // Keep trying to record this showing (even if it // has been marked as failed) until the scheduled // end time. @@ -3850,12 +3850,12 @@ void TVRec::TuningFrequency(const TuningRequest &request) else { m_signalMonitorDeadline = - expire.addMSecs(m_genOpt.channel_timeout); + expire.addMSecs(m_genOpt.m_channelTimeout); } m_signalMonitorCheckCnt = 0; //System Event TUNING_TIMEOUT deadline - m_signalEventCmdTimeout = expire.addMSecs(m_genOpt.channel_timeout); + m_signalEventCmdTimeout = expire.addMSecs(m_genOpt.m_channelTimeout); m_signalEventCmdSent = false; } } @@ -3881,7 +3881,7 @@ void TVRec::TuningFrequency(const TuningRequest &request) // Request a recorder, if the command is a recording command ClearFlags(kFlagNeedToStartRecorder, __FILE__, __LINE__); - if (request.flags & kFlagRec && !antadj) + if (request.m_flags & kFlagRec && !antadj) SetFlags(kFlagNeedToStartRecorder, __FILE__, __LINE__); } @@ -3915,7 +3915,7 @@ MPEGStreamData *TVRec::TuningSignalCheck(void) m_curRecording->SaveVideoProperties(VID_DAMAGED, VID_DAMAGED); QString desc = tr("Good signal seen after %1 ms") - .arg(m_genOpt.channel_timeout + + .arg(m_genOpt.m_channelTimeout + m_startRecordingDeadline.msecsTo(current_time)); QString title = m_curRecording->GetTitle(); if (!m_curRecording->GetSubtitle().isEmpty()) @@ -3930,7 +3930,7 @@ MPEGStreamData *TVRec::TuningSignalCheck(void) LOG(VB_GENERAL, LOG_WARNING, LOC + QString("It took longer than %1 ms to get a signal lock. " "Keeping status of '%2'") - .arg(m_genOpt.channel_timeout) + .arg(m_genOpt.m_channelTimeout) .arg(RecStatus::toString(newRecStatus, kSingleRecord))); LOG(VB_GENERAL, LOG_WARNING, LOC + "See 'Tuning timeout' in mythtv-setup for this input"); @@ -3971,7 +3971,7 @@ MPEGStreamData *TVRec::TuningSignalCheck(void) SendMythSystemRecEvent("REC_FAILING", m_curRecording); QString desc = tr("Taking more than %1 ms to get a lock.") - .arg(m_genOpt.channel_timeout); + .arg(m_genOpt.m_channelTimeout); QString title = m_curRecording->GetTitle(); if (!m_curRecording->GetSubtitle().isEmpty()) title += " - " + m_curRecording->GetSubtitle(); @@ -3986,7 +3986,7 @@ MPEGStreamData *TVRec::TuningSignalCheck(void) LOG(VB_GENERAL, LOG_WARNING, LOC + QString("TuningSignalCheck: taking more than %1 ms to get a lock. " "marking this recording as '%2'.") - .arg(m_genOpt.channel_timeout) + .arg(m_genOpt.m_channelTimeout) .arg(RecStatus::toString(newRecStatus, kSingleRecord))); LOG(VB_GENERAL, LOG_WARNING, LOC + "See 'Tuning timeout' in mythtv-setup for this input"); @@ -4038,7 +4038,7 @@ MPEGStreamData *TVRec::TuningSignalCheck(void) if (streamData) { - DVBStreamData *dsd = dynamic_cast<DVBStreamData*>(streamData); + auto *dsd = dynamic_cast<DVBStreamData*>(streamData); if (dsd) dsd->SetDishNetEIT(is_dishnet_eit(m_inputid)); if (!get_use_eit(GetInputId())) @@ -4124,8 +4124,8 @@ QString TVRec::LoadProfile(void *tvchain, RecordingInfo *rec, QString profileRequested = profileName; - if (profile.loadByType(profileName, m_genOpt.inputtype, - m_genOpt.videodev)) + if (profile.loadByType(profileName, m_genOpt.m_inputType, + m_genOpt.m_videoDev)) { LOG(VB_RECORD, LOG_INFO, LOC + QString("Using profile '%1' to record") @@ -4134,7 +4134,7 @@ QString TVRec::LoadProfile(void *tvchain, RecordingInfo *rec, else { profileName = "Default"; - if (profile.loadByType(profileName, m_genOpt.inputtype, m_genOpt.videodev)) + if (profile.loadByType(profileName, m_genOpt.m_inputType, m_genOpt.m_videoDev)) { LOG(VB_RECORD, LOG_INFO, LOC + QString("Profile '%1' not found, using " @@ -4170,7 +4170,7 @@ void TVRec::TuningNewRecorder(MPEGStreamData *streamData) had_dummyrec = true; } - RecordingInfo *rec = m_lastTuningRequest.program; + RecordingInfo *rec = m_lastTuningRequest.m_program; RecordingProfile profile; m_recProfileName = LoadProfile(m_tvChain, rec, profile); @@ -4194,9 +4194,9 @@ void TVRec::TuningNewRecorder(MPEGStreamData *streamData) rec = m_curRecording; // new'd in Create/SwitchLiveTVRingBuffer() } - if (m_lastTuningRequest.flags & kFlagRecording) + if (m_lastTuningRequest.m_flags & kFlagRecording) { - bool write = m_genOpt.inputtype != "IMPORT"; + bool write = m_genOpt.m_inputType != "IMPORT"; LOG(VB_GENERAL, LOG_INFO, LOC + QString("rec->GetPathname(): '%1'") .arg(rec->GetPathname())); SetRingBuffer(RingBuffer::Create(rec->GetPathname(), write)); @@ -4227,7 +4227,7 @@ void TVRec::TuningNewRecorder(MPEGStreamData *streamData) goto err_ret; } - if (m_channel && m_genOpt.inputtype == "MJPEG") + if (m_channel && m_genOpt.m_inputType == "MJPEG") m_channel->Close(); // Needed because of NVR::MJPEGInit() LOG(VB_GENERAL, LOG_INFO, LOC + "TuningNewRecorder - CreateRecorder()"); @@ -4273,7 +4273,7 @@ void TVRec::TuningNewRecorder(MPEGStreamData *streamData) GetDTVRecorder()->SetStreamData(streamData); } - if (m_channel && m_genOpt.inputtype == "MJPEG") + if (m_channel && m_genOpt.m_inputType == "MJPEG") m_channel->Open(); // Needed because of NVR::MJPEGInit() // Setup for framebuffer capture devices.. @@ -4308,7 +4308,7 @@ void TVRec::TuningNewRecorder(MPEGStreamData *streamData) //workaround for failed import recordings, no signal monitor means we never //go to recording state and the status here seems to override the status //set in the importrecorder and backend via setrecordingstatus - if (m_genOpt.inputtype == "IMPORT") + if (m_genOpt.m_inputType == "IMPORT") { SetRecordingStatus(RecStatus::Recording, __LINE__); if (m_curRecording) @@ -4550,7 +4550,7 @@ bool TVRec::GetProgramRingBufferForLiveTV(RecordingInfo **pginfo, if (chanid < 0) { // Test setups might have zero channels - if (m_genOpt.inputtype == "IMPORT" || m_genOpt.inputtype == "DEMO") + if (m_genOpt.m_inputType == "IMPORT" || m_genOpt.m_inputType == "DEMO") chanid = 9999; else { @@ -4774,7 +4774,7 @@ RecordingInfo *TVRec::SwitchRecordingRingBuffer(const RecordingInfo &rcinfo) return nullptr; } - RecordingInfo *ri = new RecordingInfo(rcinfo); + auto *ri = new RecordingInfo(rcinfo); RecordingProfile profile; QString pn = LoadProfile(nullptr, ri, profile); @@ -4793,7 +4793,7 @@ RecordingInfo *TVRec::SwitchRecordingRingBuffer(const RecordingInfo &rcinfo) ri->MarkAsInUse(true, kRecorderInUseID); StartedRecording(ri); - bool write = m_genOpt.inputtype != "IMPORT"; + bool write = m_genOpt.m_inputType != "IMPORT"; RingBuffer *rb = RingBuffer::Create(ri->GetPathname(), write); if (!rb || !rb->IsOpen()) { @@ -4827,9 +4827,9 @@ TVRec* TVRec::GetTVRec(uint inputid) QString TuningRequest::toString(void) const { return QString("Program(%1) channel(%2) input(%3) flags(%4)") - .arg((program == nullptr) ? QString("NULL") : program->toString()) - .arg(channel).arg(input) - .arg(TVRec::FlagToString(flags)); + .arg((m_program == nullptr) ? QString("NULL") : m_program->toString()) + .arg(m_channel).arg(m_input) + .arg(TVRec::FlagToString(m_flags)); } #ifdef USING_DVB diff --git a/mythtv/libs/libmythtv/tv_rec.h b/mythtv/libs/libmythtv/tv_rec.h index eb357636413..c089a9145c1 100644 --- a/mythtv/libs/libmythtv/tv_rec.h +++ b/mythtv/libs/libmythtv/tv_rec.h @@ -64,88 +64,79 @@ class RecordingQuality; class GeneralDBOptions { public: - GeneralDBOptions() : - videodev(""), vbidev(""), - audiodev(""), - inputtype("V4L"), - audiosamplerate(-1), skip_btaudio(false), - signal_timeout(1000), channel_timeout(3000), - wait_for_seqstart(false) {} - - QString videodev; - QString vbidev; - QString audiodev; - QString inputtype; - int audiosamplerate; - bool skip_btaudio; - uint signal_timeout; - uint channel_timeout; - bool wait_for_seqstart; + GeneralDBOptions()= default; + + QString m_videoDev; + QString m_vbiDev; + QString m_audioDev; + QString m_inputType {"V4L"}; + int m_audioSampleRate {-1}; + bool m_skipBtAudio {false}; + uint m_signalTimeout {1000}; + uint m_channelTimeout {3000}; + bool m_waitForSeqstart {false}; }; class DVBDBOptions { public: - DVBDBOptions() : dvb_on_demand(false), dvb_tuning_delay(0), dvb_eitscan(true) {;} - bool dvb_on_demand; - uint dvb_tuning_delay; - bool dvb_eitscan; + DVBDBOptions() = default; + + bool m_dvbOnDemand {false}; + uint m_dvbTuningDelay {0}; + bool m_dvbEitScan {true}; }; class FireWireDBOptions { public: - FireWireDBOptions() : speed(-1), connection(-1), model("") {;} + FireWireDBOptions() = default; - int speed; - int connection; - QString model; + int m_speed {-1}; + int m_connection {-1}; + QString m_model; }; class TuningRequest { public: explicit TuningRequest(uint f) : - flags(f), program(nullptr), - majorChan(0), minorChan(0), progNum(-1) {;} + m_flags(f) {;} TuningRequest(uint f, RecordingInfo *p) : - flags(f), program(p), - majorChan(0), minorChan(0), progNum(-1) {;} + m_flags(f), m_program(p) {;} TuningRequest(uint f, const QString& ch, const QString& in = QString()) : - flags(f), program(nullptr), channel(ch), - input(in), majorChan(0), minorChan(0), progNum(-1) {;} + m_flags(f), m_channel(ch), m_input(in) {;} QString toString(void) const; - bool IsOnSameMultiplex(void) const { return minorChan || (progNum >= 0); } + bool IsOnSameMultiplex(void) const { return m_minorChan || (m_progNum >= 0); } public: - uint flags; - RecordingInfo *program; - QString channel; - QString input; - uint majorChan; - uint minorChan; - int progNum; + uint m_flags; + RecordingInfo *m_program {nullptr}; + QString m_channel; + QString m_input; + uint m_majorChan {0}; + uint m_minorChan {0}; + int m_progNum {-1}; }; -typedef MythDeque<TuningRequest> TuningQueue; +using TuningQueue = MythDeque<TuningRequest>; inline TuningRequest myth_deque_init(const TuningRequest*) { return (TuningRequest)(0); } class PendingInfo { public: - PendingInfo() : - info(nullptr), hasLaterShowing(false), canceled(false), - ask(false), doNotAsk(false) { } - ProgramInfo *info; - QDateTime recordingStart; - bool hasLaterShowing; - bool canceled; - bool ask; - bool doNotAsk; - vector<uint> possibleConflicts; + PendingInfo() = default; + + ProgramInfo *m_info {nullptr}; + QDateTime m_recordingStart; + bool m_hasLaterShowing {false}; + bool m_canceled {false}; + bool m_ask {false}; + bool m_doNotAsk {false}; + vector<uint> m_possibleConflicts; }; -typedef QMap<uint,PendingInfo> PendingMap; +using PendingMap = QMap<uint,PendingInfo>; class MTV_PUBLIC TVRec : public SignalMonitorListener, public QRunnable { @@ -308,8 +299,8 @@ class MTV_PUBLIC TVRec : public SignalMonitorListener, public QRunnable void HandleStateChange(void); void ChangeState(TVState nextState); - bool StateIsRecording(TVState state); - bool StateIsPlaying(TVState state); + static bool StateIsRecording(TVState state); + static bool StateIsPlaying(TVState state); TVState RemovePlaying(TVState state); TVState RemoveRecording(TVState state); @@ -329,7 +320,7 @@ class MTV_PUBLIC TVRec : public SignalMonitorListener, public QRunnable QDateTime GetRecordEndTime(const ProgramInfo*) const; void CheckForRecGroupChange(void); void NotifySchedulerOfRecording(RecordingInfo*); - typedef enum { kAutoRunProfile, kAutoRunNone, } AutoRunInitType; + enum AutoRunInitType { kAutoRunProfile, kAutoRunNone, }; void InitAutoRunJobs(RecordingInfo*, AutoRunInitType, RecordingProfile *, int line); diff --git a/mythtv/libs/libmythtv/tvbrowsehelper.cpp b/mythtv/libs/libmythtv/tvbrowsehelper.cpp index c1b2bce2e38..31a93946d88 100644 --- a/mythtv/libs/libmythtv/tvbrowsehelper.cpp +++ b/mythtv/libs/libmythtv/tvbrowsehelper.cpp @@ -223,8 +223,8 @@ uint TVBrowseHelper::GetChanId( { if (pref_sourceid) { - ChannelInfoList::const_iterator it = m_dbAllChannels.begin(); - for (; it != m_dbAllChannels.end(); ++it) + auto it = m_dbAllChannels.cbegin(); + for (; it != m_dbAllChannels.cend(); ++it) { if ((*it).m_sourceid == pref_sourceid && (*it).m_channum == channum) return (*it).m_chanid; @@ -233,8 +233,8 @@ uint TVBrowseHelper::GetChanId( if (pref_cardid) { - ChannelInfoList::const_iterator it = m_dbAllChannels.begin(); - for (; it != m_dbAllChannels.end(); ++it) + auto it = m_dbAllChannels.cbegin(); + for (; it != m_dbAllChannels.cend(); ++it) { if ((*it).GetInputIds().contains(pref_cardid) && (*it).m_channum == channum) @@ -244,8 +244,8 @@ uint TVBrowseHelper::GetChanId( if (m_dbBrowseAllTuners) { - ChannelInfoList::const_iterator it = m_dbAllChannels.begin(); - for (; it != m_dbAllChannels.end(); ++it) + auto it = m_dbAllChannels.cbegin(); + for (; it != m_dbAllChannels.cend(); ++it) { if ((*it).m_channum == channum) return (*it).m_chanid; @@ -515,7 +515,7 @@ void TVBrowseHelper::run() { for (size_t i = 0; i < chanids.size(); i++) { - if (m_tv->IsTunable(ctx, chanids[i])) + if (TV::IsTunable(ctx, chanids[i])) { infoMap["chanid"] = QString::number(chanids[i]); GetNextProgramDB(direction, infoMap); @@ -527,7 +527,7 @@ void TVBrowseHelper::run() { uint orig_chanid = infoMap["chanid"].toUInt(); GetNextProgramDB(direction, infoMap); - while (!m_tv->IsTunable(ctx, infoMap["chanid"].toUInt()) && + while (!TV::IsTunable(ctx, infoMap["chanid"].toUInt()) && (infoMap["chanid"].toUInt() != orig_chanid)) { GetNextProgramDB(direction, infoMap); diff --git a/mythtv/libs/libmythtv/v4l2util.cpp b/mythtv/libs/libmythtv/v4l2util.cpp index e453320c924..6cb2a3a0929 100644 --- a/mythtv/libs/libmythtv/v4l2util.cpp +++ b/mythtv/libs/libmythtv/v4l2util.cpp @@ -201,7 +201,7 @@ void V4L2util::log_qctrl(struct v4l2_queryctrl& queryctrl, drv_opt.m_minimum = queryctrl.minimum; drv_opt.m_maximum = queryctrl.maximum; drv_opt.m_step = queryctrl.step; - drv_opt.m_default_value = queryctrl.default_value;; + drv_opt.m_defaultValue = queryctrl.default_value;; if (nameStr == "Stream Type") drv_opt.m_category = DriverOption::STREAM_TYPE; @@ -432,9 +432,9 @@ void V4L2util::SetDefaultOptions(DriverOption::Options& options) DriverOption drv_opt; drv_opt.m_category = DriverOption::VIDEO_ENCODING; drv_opt.m_name = "Video Encoding"; - drv_opt.m_minimum = drv_opt.m_maximum = drv_opt.m_default_value = + drv_opt.m_minimum = drv_opt.m_maximum = drv_opt.m_defaultValue = V4L2_MPEG_VIDEO_ENCODING_MPEG_2; - drv_opt.m_menu[drv_opt.m_default_value] = "MPEG-2 Video"; + drv_opt.m_menu[drv_opt.m_defaultValue] = "MPEG-2 Video"; options[drv_opt.m_category] = drv_opt; } @@ -445,32 +445,32 @@ void V4L2util::SetDefaultOptions(DriverOption::Options& options) // V4L2_CID_MPEG_AUDIO_ENCODING drv_opt.m_category = DriverOption::AUDIO_ENCODING; drv_opt.m_name = "Audio Encoding"; - drv_opt.m_minimum = drv_opt.m_maximum = drv_opt.m_default_value = + drv_opt.m_minimum = drv_opt.m_maximum = drv_opt.m_defaultValue = V4L2_MPEG_AUDIO_ENCODING_LAYER_2; - drv_opt.m_menu[drv_opt.m_default_value] = "MPEG-1/2 Layer II encoding"; + drv_opt.m_menu[drv_opt.m_defaultValue] = "MPEG-1/2 Layer II encoding"; options[drv_opt.m_category] = drv_opt; drv_opt.m_category = DriverOption::AUDIO_BITRATE; drv_opt.m_name = "Audio Bitrate"; - drv_opt.m_minimum = drv_opt.m_maximum = drv_opt.m_default_value = + drv_opt.m_minimum = drv_opt.m_maximum = drv_opt.m_defaultValue = V4L2_MPEG_AUDIO_ENCODING_LAYER_2; - drv_opt.m_menu[drv_opt.m_default_value] = "MPEG-1/2 Layer II encoding"; + drv_opt.m_menu[drv_opt.m_defaultValue] = "MPEG-1/2 Layer II encoding"; options[drv_opt.m_category] = drv_opt; // V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ drv_opt.m_category = DriverOption::AUDIO_SAMPLERATE; drv_opt.m_name = "MPEG Audio sampling frequency"; - drv_opt.m_minimum = drv_opt.m_maximum = drv_opt.m_default_value = + drv_opt.m_minimum = drv_opt.m_maximum = drv_opt.m_defaultValue = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000; - drv_opt.m_menu[drv_opt.m_default_value] = "48 kHz"; + drv_opt.m_menu[drv_opt.m_defaultValue] = "48 kHz"; options[drv_opt.m_category] = drv_opt; // VIDIOC_S_TUNER drv_opt.m_category = DriverOption::AUDIO_LANGUAGE; drv_opt.m_name = "Tuner Audio Modes"; - drv_opt.m_minimum = drv_opt.m_maximum = drv_opt.m_default_value = + drv_opt.m_minimum = drv_opt.m_maximum = drv_opt.m_defaultValue = V4L2_TUNER_MODE_STEREO; - drv_opt.m_menu[drv_opt.m_default_value] = "Play stereo audio"; + drv_opt.m_menu[drv_opt.m_defaultValue] = "Play stereo audio"; options[drv_opt.m_category] = drv_opt; } diff --git a/mythtv/libs/libmythtv/v4l2util.h b/mythtv/libs/libmythtv/v4l2util.h index 89143301b3f..48322c78450 100644 --- a/mythtv/libs/libmythtv/v4l2util.h +++ b/mythtv/libs/libmythtv/v4l2util.h @@ -75,7 +75,7 @@ class MTV_PUBLIC V4L2util protected: // VBI - bool OpenVBI(const QString& vbi_dev_name); + static bool OpenVBI(const QString& vbi_dev_name); bool SetSlicedVBI(const VBIMode::vbimode_t& vbimode); int GetExtControl(int request, const QString& ctrl_desc = "") const; diff --git a/mythtv/libs/libmythtv/vaapi2context.cpp b/mythtv/libs/libmythtv/vaapi2context.cpp index 6b4822e7eef..3917cdaf6e9 100644 --- a/mythtv/libs/libmythtv/vaapi2context.cpp +++ b/mythtv/libs/libmythtv/vaapi2context.cpp @@ -55,9 +55,9 @@ int Vaapi2Context::FilteredReceiveFrame(AVCodecContext *ctx, AVFrame *frame) while (true) { - if (filter_graph) + if (m_filterGraph) { - ret = av_buffersink_get_frame(buffersink_ctx, frame); + ret = av_buffersink_get_frame(m_bufferSinkCtx, frame); if (ret >= 0) { if (priorPts[0] && ptsUsed == priorPts[1]) @@ -83,9 +83,9 @@ int Vaapi2Context::FilteredReceiveFrame(AVCodecContext *ctx, AVFrame *frame) break; priorPts[0]=priorPts[1]; priorPts[1]=frame->pts; - if (frame->interlaced_frame || filter_graph) + if (frame->interlaced_frame || m_filterGraph) { - if (!filtersInitialized + if (!m_filtersInitialized || width != frame->width || height != frame->height) { @@ -99,9 +99,9 @@ int Vaapi2Context::FilteredReceiveFrame(AVCodecContext *ctx, AVFrame *frame) break; } } - if (filter_graph) + if (m_filterGraph) { - ret = av_buffersrc_add_frame(buffersrc_ctx, frame); + ret = av_buffersrc_add_frame(m_bufferSrcCtx, frame); if (ret < 0) break; } @@ -123,13 +123,13 @@ int Vaapi2Context::InitDeinterlaceFilter(AVCodecContext *ctx, AVFrame *frame) CloseFilters(); width = frame->width; height = frame->height; - filtersInitialized = true; - if (!player || !stream) + m_filtersInitialized = true; + if (!player || !m_stream) { LOG(VB_GENERAL, LOG_ERR, LOC + "Player or stream is not set up in MythCodecContext"); return -1; } - if (doublerate && !player->CanSupportDoubleRate()) + if (m_doubleRate && !player->CanSupportDoubleRate()) { QString request = deinterlacername; deinterlacername = GetFallbackDeint(); @@ -138,7 +138,7 @@ int Vaapi2Context::InitDeinterlaceFilter(AVCodecContext *ctx, AVFrame *frame) .arg(request).arg(deinterlacername)); if (!isCodecDeinterlacer(deinterlacername)) deinterlacername.clear(); - doublerate = deinterlacername.contains("doublerate"); + m_doubleRate = deinterlacername.contains("doublerate"); // if the fallback is a non-vaapi - deinterlace will be turned off // and the videoout methods can take over. @@ -157,11 +157,11 @@ int Vaapi2Context::InitDeinterlaceFilter(AVCodecContext *ctx, AVFrame *frame) const AVFilter *buffersink = avfilter_get_by_name("buffersink"); AVFilterInOut *outputs = avfilter_inout_alloc(); AVFilterInOut *inputs = avfilter_inout_alloc(); - AVRational time_base = stream->time_base; + AVRational time_base = m_stream->time_base; AVBufferSrcParameters* params = nullptr; - filter_graph = avfilter_graph_alloc(); - if (!outputs || !inputs || !filter_graph) + m_filterGraph = avfilter_graph_alloc(); + if (!outputs || !inputs || !m_filterGraph) { ret = AVERROR(ENOMEM); goto end; @@ -176,8 +176,8 @@ int Vaapi2Context::InitDeinterlaceFilter(AVCodecContext *ctx, AVFrame *frame) // isInterlaced = frame->interlaced_frame; - ret = avfilter_graph_create_filter(&buffersrc_ctx, buffersrc, "in", - args, nullptr, filter_graph); + ret = avfilter_graph_create_filter(&m_bufferSrcCtx, buffersrc, "in", + args, nullptr, m_filterGraph); if (ret < 0) { LOG(VB_GENERAL, LOG_ERR, LOC + "avfilter_graph_create_filter failed for buffer source"); @@ -185,12 +185,12 @@ int Vaapi2Context::InitDeinterlaceFilter(AVCodecContext *ctx, AVFrame *frame) } params = av_buffersrc_parameters_alloc(); - if (hw_frames_ctx) - av_buffer_unref(&hw_frames_ctx); - hw_frames_ctx = av_buffer_ref(frame->hw_frames_ctx); - params->hw_frames_ctx = hw_frames_ctx; + if (m_hwFramesCtx) + av_buffer_unref(&m_hwFramesCtx); + m_hwFramesCtx = av_buffer_ref(frame->m_hwFramesCtx); + params->m_hwFramesCtx = m_hwFramesCtx; - ret = av_buffersrc_parameters_set(buffersrc_ctx, params); + ret = av_buffersrc_parameters_set(m_bufferSrcCtx, params); if (ret < 0) { @@ -201,8 +201,8 @@ int Vaapi2Context::InitDeinterlaceFilter(AVCodecContext *ctx, AVFrame *frame) av_freep(¶ms); /* buffer video sink: to terminate the filter chain. */ - ret = avfilter_graph_create_filter(&buffersink_ctx, buffersink, "out", - nullptr, nullptr, filter_graph); + ret = avfilter_graph_create_filter(&m_bufferSinkCtx, buffersink, "out", + nullptr, nullptr, m_filterGraph); if (ret < 0) { LOG(VB_GENERAL, LOG_ERR, LOC + "avfilter_graph_create_filter failed for buffer sink"); @@ -221,7 +221,7 @@ int Vaapi2Context::InitDeinterlaceFilter(AVCodecContext *ctx, AVFrame *frame) * default. */ outputs->name = av_strdup("in"); - outputs->filter_ctx = buffersrc_ctx; + outputs->filter_ctx = m_bufferSrcCtx; outputs->pad_idx = 0; outputs->next = nullptr; @@ -232,11 +232,11 @@ int Vaapi2Context::InitDeinterlaceFilter(AVCodecContext *ctx, AVFrame *frame) * default. */ inputs->name = av_strdup("out"); - inputs->filter_ctx = buffersink_ctx; + inputs->filter_ctx = m_bufferSinkCtx; inputs->pad_idx = 0; inputs->next = nullptr; - if ((ret = avfilter_graph_parse_ptr(filter_graph, filters.toLocal8Bit(), + if ((ret = avfilter_graph_parse_ptr(m_filterGraph, filters.toLocal8Bit(), &inputs, &outputs,nullptr)) < 0) { LOG(VB_GENERAL, LOG_ERR, LOC @@ -244,7 +244,7 @@ int Vaapi2Context::InitDeinterlaceFilter(AVCodecContext *ctx, AVFrame *frame) goto end; } - if ((ret = avfilter_graph_config(filter_graph, nullptr)) < 0) + if ((ret = avfilter_graph_config(m_filterGraph, nullptr)) < 0) { LOG(VB_GENERAL, LOG_ERR, LOC + QString("avfilter_graph_config failed")); @@ -257,9 +257,9 @@ int Vaapi2Context::InitDeinterlaceFilter(AVCodecContext *ctx, AVFrame *frame) end: if (ret < 0) { - avfilter_graph_free(&filter_graph); - filter_graph = nullptr; - doublerate = false; + avfilter_graph_free(&m_filterGraph); + m_filterGraph = nullptr; + m_doubleRate = false; } avfilter_inout_free(&inputs); avfilter_inout_free(&outputs); @@ -269,18 +269,18 @@ int Vaapi2Context::InitDeinterlaceFilter(AVCodecContext *ctx, AVFrame *frame) void Vaapi2Context::CloseFilters() { - avfilter_graph_free(&filter_graph); - filter_graph = nullptr; - buffersink_ctx = nullptr; - buffersrc_ctx = nullptr; - filtersInitialized = false; - ptsUsed = 0; - priorPts[0] = 0; - priorPts[1] = 0; + avfilter_graph_free(&m_filterGraph); + m_filterGraph = nullptr; + m_bufferSinkCtx = nullptr; + m_bufferSrcCtx = nullptr; + m_filtersInitialized = false; + m_ptsUsed = 0; + m_priorPts[0] = 0; + m_priorPts[1] = 0; // isInterlaced = 0; - width = 0; - height = 0; + m_width = 0; + m_height = 0; - if (hw_frames_ctx) - av_buffer_unref(&hw_frames_ctx); + if (m_hwFramesCtx) + av_buffer_unref(&m_hwFramesCtx); } diff --git a/mythtv/libs/libmythtv/vaapi2context.h b/mythtv/libs/libmythtv/vaapi2context.h index 20c7176dfc3..4a1989e123f 100644 --- a/mythtv/libs/libmythtv/vaapi2context.h +++ b/mythtv/libs/libmythtv/vaapi2context.h @@ -48,17 +48,17 @@ class MTV_PUBLIC Vaapi2Context : public MythCodecContext virtual int InitDeinterlaceFilter(AVCodecContext *ctx, AVFrame *frame); - AVStream* stream; - AVFilterContext *buffersink_ctx; - AVFilterContext *buffersrc_ctx; - AVFilterGraph *filter_graph; - bool filtersInitialized; - AVBufferRef *hw_frames_ctx; - int64_t priorPts[2]; - int64_t ptsUsed; - int width; - int height; - bool doublerate; + AVStream *m_stream {nullptr}; + AVFilterContext *m_bufferSinkCtx {nullptr}; + AVFilterContext *m_bufferSrcCtx {nullptr}; + AVFilterGraph *m_filterGraph {nullptr}; + bool m_filtersInitialized {false}; + AVBufferRef *m_hwFramesCtx {nullptr}; + int64_t m_priorPts[2] {0,0}; + int64_t m_ptsUsed {0}; + int m_width {0}; + int m_height {0}; + bool m_doubleRate {false}; }; #endif // VAAPI2CONTEXT_H diff --git a/mythtv/libs/libmythtv/videobuffers.cpp b/mythtv/libs/libmythtv/videobuffers.cpp index 832296156c1..13d7f31f59a 100644 --- a/mythtv/libs/libmythtv/videobuffers.cpp +++ b/mythtv/libs/libmythtv/videobuffers.cpp @@ -151,7 +151,7 @@ uint VideoBuffers::GetNumBuffers(int PixelFormat, int MaxReferenceFrames, bool D case FMT_VDPAU: return refs + 12; // Copyback of hardware frames. These decoders are buffering internally // already - so no need for a large presentation buffer - case FMT_NONE: return 8; + case FMT_NONE: return 8; // NOLINT(bugprone-branch-clone) // As for copyback, these decoders buffer internally case FMT_NVDEC: return 8; case FMT_MEDIACODEC: return 8; @@ -229,7 +229,7 @@ void VideoBuffers::SetDeinterlacing(MythDeintType Single, MythDeintType Double, MythCodecID CodecID) { QMutexLocker locker(&m_globalLock); - frame_vector_t::iterator it = m_buffers.begin(); + auto it = m_buffers.begin(); for ( ; it != m_buffers.end(); ++it) SetDeinterlacingFlags(*it, Single, Double, CodecID); } @@ -244,33 +244,35 @@ void VideoBuffers::SetDeinterlacing(MythDeintType Single, MythDeintType Double, void VideoBuffers::SetDeinterlacingFlags(VideoFrame &Frame, MythDeintType Single, MythDeintType Double, MythCodecID CodecID) { - static const MythDeintType driver = DEINT_ALL & ~(DEINT_CPU | DEINT_SHADER); - static const MythDeintType shader = DEINT_ALL & ~(DEINT_CPU | DEINT_DRIVER); - static const MythDeintType software = DEINT_ALL & ~(DEINT_SHADER | DEINT_DRIVER); + static const MythDeintType kDriver = DEINT_ALL & ~(DEINT_CPU | DEINT_SHADER); + static const MythDeintType kShader = DEINT_ALL & ~(DEINT_CPU | DEINT_DRIVER); + static const MythDeintType kSoftware = DEINT_ALL & ~(DEINT_SHADER | DEINT_DRIVER); Frame.deinterlace_single = Single; Frame.deinterlace_double = Double; if (codec_is_copyback(CodecID)) { if (codec_is_vaapi_dec(CodecID) || codec_is_nvdec_dec(CodecID)) - Frame.deinterlace_allowed = software | shader | driver; + Frame.deinterlace_allowed = kSoftware | kShader | kDriver; else // VideoToolBox, MediaCodec and VDPAU copyback - Frame.deinterlace_allowed = software | shader; + Frame.deinterlace_allowed = kSoftware | kShader; } else if (FMT_DRMPRIME == Frame.codec) - Frame.deinterlace_allowed = shader; // No driver deint - if RGBA frames are returned, shaders will be disabled + // NOLINTNEXTLINE(bugprone-branch-clone) + Frame.deinterlace_allowed = kShader; // No driver deint - if RGBA frames are returned, shaders will be disabled else if (FMT_MMAL == Frame.codec) - Frame.deinterlace_allowed = shader; // No driver deint yet (TODO) and YUV frames returned + Frame.deinterlace_allowed = kShader; // No driver deint yet (TODO) and YUV frames returned else if (FMT_VTB == Frame.codec) - Frame.deinterlace_allowed = shader; // No driver deint and YUV frames returned + Frame.deinterlace_allowed = kShader; // No driver deint and YUV frames returned else if (FMT_NVDEC == Frame.codec) - Frame.deinterlace_allowed = shader | driver; // YUV frames and decoder deint + Frame.deinterlace_allowed = kShader | kDriver; // YUV frames and decoder deint else if (FMT_VDPAU == Frame.codec) - Frame.deinterlace_allowed = driver; // No YUV frames for shaders + // NOLINTNEXTLINE(bugprone-branch-clone) + Frame.deinterlace_allowed = kDriver; // No YUV frames for shaders else if (FMT_VAAPI == Frame.codec) - Frame.deinterlace_allowed = driver; // DRM will allow shader if no VPP + Frame.deinterlace_allowed = kDriver; // DRM will allow shader if no VPP else - Frame.deinterlace_allowed = software | shader; + Frame.deinterlace_allowed = kSoftware | kShader; } /** @@ -304,7 +306,7 @@ void VideoBuffers::ReleaseDecoderResources(VideoFrame *Frame) { if (format_is_hw(Frame->codec)) { - AVBufferRef* ref = reinterpret_cast<AVBufferRef*>(Frame->priv[0]); + auto* ref = reinterpret_cast<AVBufferRef*>(Frame->priv[0]); if (ref != nullptr) av_buffer_unref(&ref); Frame->buf = Frame->priv[0] = nullptr; @@ -454,7 +456,7 @@ void VideoBuffers::DoneDisplayingFrame(VideoFrame *Frame) // check if any finished frames are no longer used by decoder and return to available frame_queue_t ula(m_finished); - frame_queue_t::iterator it = ula.begin(); + auto it = ula.begin(); for (; it != ula.end(); ++it) { if (!m_decode.contains(*it)) @@ -625,8 +627,7 @@ frame_queue_t::iterator VideoBuffers::BeginLock(BufferType Type) frame_queue_t *queue = Queue(Type); if (queue) return queue->begin(); - else - return m_available.begin(); + return m_available.begin(); } void VideoBuffers::EndLock(void) @@ -742,7 +743,7 @@ void VideoBuffers::DiscardFrames(bool NextFrameIsKeyFrame) if (!NextFrameIsKeyFrame) { frame_queue_t ula(m_used); - frame_queue_t::iterator it = ula.begin(); + auto it = ula.begin(); for (; it != ula.end(); ++it) DiscardFrame(*it); LOG(VB_PLAYBACK, LOG_INFO, @@ -987,7 +988,7 @@ QString VideoBuffers::GetStatus(uint Num) const unsigned long long x = to_bitmap(m_decode, count); for (uint i = 0; i < Num; i++) { - unsigned long long mask = 1Ull << i; + unsigned long long mask = 1ULL << i; QString tmp(""); if (a & mask) tmp += (x & mask) ? "a" : "A"; @@ -1060,7 +1061,7 @@ map<const VideoFrame *, int> dbg_str; static int DebugNum(const VideoFrame *Frame) { - map<const VideoFrame *, int>::iterator it = dbg_str.find(Frame); + auto it = dbg_str.find(Frame); if (it == dbg_str.end()) return dbg_str[Frame] = next_dbg_str++; return it->second; @@ -1070,8 +1071,7 @@ const QString& DebugString(const VideoFrame *Frame, bool Short) { if (Short) return dbg_str_arr_short[DebugNum(Frame) % DBG_STR_ARR_SIZE]; - else - return dbg_str_arr[DebugNum(Frame) % DBG_STR_ARR_SIZE]; + return dbg_str_arr[DebugNum(Frame) % DBG_STR_ARR_SIZE]; } const QString& DebugString(uint FrameNum, bool Short) @@ -1082,8 +1082,8 @@ const QString& DebugString(uint FrameNum, bool Short) static unsigned long long to_bitmap(const frame_queue_t& Queue, int Num) { unsigned long long bitmap = 0; - frame_queue_t::const_iterator it = Queue.begin(); - for (; it != Queue.end(); ++it) + auto it = Queue.cbegin(); + for (; it != Queue.cend(); ++it) { int shift = DebugNum(*it) % Num; bitmap |= 1ULL << shift; diff --git a/mythtv/libs/libmythtv/videobuffers.h b/mythtv/libs/libmythtv/videobuffers.h index 097f8fd5714..083ef6bc423 100644 --- a/mythtv/libs/libmythtv/videobuffers.h +++ b/mythtv/libs/libmythtv/videobuffers.h @@ -17,9 +17,9 @@ #include <map> using namespace std; -typedef MythDeque<VideoFrame*> frame_queue_t; -typedef vector<VideoFrame> frame_vector_t; -typedef map<const VideoFrame*, uint> vbuffer_map_t; +using frame_queue_t = MythDeque<VideoFrame*> ; +using frame_vector_t = vector<VideoFrame>; +using vbuffer_map_t = map<const VideoFrame*, uint>; const QString& DebugString(const VideoFrame *Frame, bool Short = false); const QString& DebugString(uint FrameNum, bool Short = false); @@ -121,7 +121,7 @@ class MTV_PUBLIC VideoBuffers frame_queue_t *Queue(BufferType Type); const frame_queue_t *Queue(BufferType Type) const; VideoFrame *GetNextFreeFrameInternal(BufferType EnqueueTo); - void ReleaseDecoderResources(VideoFrame *Frame); + static void ReleaseDecoderResources(VideoFrame *Frame); static void SetDeinterlacingFlags(VideoFrame &Frame, MythDeintType Single, MythDeintType Double, MythCodecID CodecID); diff --git a/mythtv/libs/libmythtv/videocolourspace.cpp b/mythtv/libs/libmythtv/videocolourspace.cpp index cf9238d1a24..0a5fc85f35a 100644 --- a/mythtv/libs/libmythtv/videocolourspace.cpp +++ b/mythtv/libs/libmythtv/videocolourspace.cpp @@ -14,13 +14,13 @@ extern "C" { #include <cmath> const VideoColourSpace::ColourPrimaries VideoColourSpace::BT709 = - {{{0.640f, 0.330f}, {0.300f, 0.600f}, {0.150f, 0.060f}}, {0.3127f, 0.3290f}}; + {{{0.640F, 0.330F}, {0.300F, 0.600F}, {0.150F, 0.060F}}, {0.3127F, 0.3290F}}; const VideoColourSpace::ColourPrimaries VideoColourSpace::BT610_525 = - {{{0.640f, 0.340f}, {0.310f, 0.595f}, {0.155f, 0.070f}}, {0.3127f, 0.3290f}}; + {{{0.640F, 0.340F}, {0.310F, 0.595F}, {0.155F, 0.070F}}, {0.3127F, 0.3290F}}; const VideoColourSpace::ColourPrimaries VideoColourSpace::BT610_625 = - {{{0.640f, 0.330f}, {0.290f, 0.600f}, {0.150f, 0.060f}}, {0.3127f, 0.3290f}}; + {{{0.640F, 0.330F}, {0.290F, 0.600F}, {0.150F, 0.060F}}, {0.3127F, 0.3290F}}; const VideoColourSpace::ColourPrimaries VideoColourSpace::BT2020 = - {{{0.708f, 0.292f}, {0.170f, 0.797f}, {0.131f, 0.046f}}, {0.3127f, 0.3290f}}; + {{{0.708F, 0.292F}, {0.170F, 0.797F}, {0.131F, 0.046F}}, {0.3127F, 0.3290F}}; #define LOC QString("ColourSpace: ") @@ -53,30 +53,7 @@ const VideoColourSpace::ColourPrimaries VideoColourSpace::BT2020 = * using an HDR display. Futher work is required. */ VideoColourSpace::VideoColourSpace(VideoColourSpace *Parent) - : QObject(), - QMatrix4x4(), - ReferenceCounter("Colour"), - m_supportedAttributes(kPictureAttributeSupported_None), - m_fullRange(true), - m_brightness(0.0F), - m_contrast(1.0F), - m_saturation(1.0F), - m_hue(0.0F), - m_alpha(1.0F), - m_colourSpace(AVCOL_SPC_UNSPECIFIED), - m_colourSpaceDepth(8), - m_range(AVCOL_RANGE_MPEG), - m_updatesDisabled(true), - m_colourShifted(0), - m_colourTransfer(AVCOL_TRC_BT709), - m_primariesMode(PrimariesAuto), - m_colourPrimaries(AVCOL_PRI_BT709), - m_displayPrimaries(AVCOL_PRI_BT709), - m_colourGamma(2.2f), - m_displayGamma(2.2f), - m_primaryMatrix(), - m_customDisplayGamma(2.2f), - m_customDisplayPrimaries(nullptr), + : ReferenceCounter("Colour"), m_parent(Parent) { if (m_parent) @@ -269,7 +246,7 @@ void VideoColourSpace::Update(void) // Works for NVDEC and VAAPI. VideoToolBox untested. if ((m_colourSpaceDepth > 8) && !m_colourShifted) { - float scaler = 65535.0f / ((1 << m_colourSpaceDepth) -1); + float scaler = 65535.0F / ((1 << m_colourSpaceDepth) -1); scale(scaler); } static_cast<QMatrix4x4*>(this)->operator = (this->transposed()); @@ -413,7 +390,7 @@ void VideoColourSpace::SetContrast(int Value) void VideoColourSpace::SetHue(int Value) { - m_hue = Value * -3.6f; + m_hue = Value * -3.6F; Update(); } @@ -425,7 +402,7 @@ void VideoColourSpace::SetSaturation(int Value) void VideoColourSpace::SetAlpha(int Value) { - m_alpha = 100.0f / Value; + m_alpha = 100.0F / Value; Update(); } @@ -491,8 +468,8 @@ void VideoColourSpace::SaveValue(PictureAttribute AttributeType, int Value) QMatrix4x4 VideoColourSpace::GetPrimaryConversion(int Source, int Dest) { QMatrix4x4 result; // identity - AVColorPrimaries source = static_cast<AVColorPrimaries>(Source); - AVColorPrimaries dest = static_cast<AVColorPrimaries>(Dest); + auto source = static_cast<AVColorPrimaries>(Source); + auto dest = static_cast<AVColorPrimaries>(Dest); if ((source == dest) || (m_primariesMode == PrimariesDisabled)) return result; @@ -505,7 +482,7 @@ QMatrix4x4 VideoColourSpace::GetPrimaryConversion(int Source, int Dest) // and destination. Most people will not notice the difference bt709 and bt610 etc // and we avoid extra GPU processing. // BT2020 is currently the main target - which is easily differentiated by its gamma. - if ((m_primariesMode == PrimariesAuto) && qFuzzyCompare(m_colourGamma + 1.0f, m_displayGamma + 1.0f)) + if ((m_primariesMode == PrimariesAuto) && qFuzzyCompare(m_colourGamma + 1.0F, m_displayGamma + 1.0F)) return result; // N.B. Custom primaries are not yet implemented but will, some day soon, @@ -521,15 +498,15 @@ QMatrix4x4 VideoColourSpace::GetPrimaryConversion(int Source, int Dest) void VideoColourSpace::GetPrimaries(int Primary, ColourPrimaries &Out, float &Gamma) { - AVColorPrimaries primary = static_cast<AVColorPrimaries>(Primary); - Gamma = 2.2f; + auto primary = static_cast<AVColorPrimaries>(Primary); + Gamma = 2.2F; switch (primary) { case AVCOL_PRI_BT470BG: case AVCOL_PRI_BT470M: Out = BT610_625; return; case AVCOL_PRI_SMPTE170M: case AVCOL_PRI_SMPTE240M: Out = BT610_525; return; - case AVCOL_PRI_BT2020: Out = BT2020; Gamma = 2.4f; return; + case AVCOL_PRI_BT2020: Out = BT2020; Gamma = 2.4F; return; default: Out = BT709; return; } } @@ -552,7 +529,7 @@ inline float CalcGy(const float p[3][2], const float w[2], const float By) inline float CalcRy(const float By, const float Gy) { - return 1.0f - Gy - By; + return 1.0F - Gy - By; } /*! \brief Create a conversion matrix for RGB to XYZ with the given primaries @@ -578,7 +555,7 @@ QMatrix4x4 VideoColourSpace::RGBtoXYZ(ColourPrimaries Primaries) temp[2][0] = Ry / Primaries.primaries[0][1] * (1- Primaries.primaries[0][0] - Primaries.primaries[0][1]); temp[2][1] = Gy / Primaries.primaries[1][1] * (1- Primaries.primaries[1][0] - Primaries.primaries[1][1]); temp[2][2] = By / Primaries.primaries[2][1] * (1- Primaries.primaries[2][0] - Primaries.primaries[2][1]); - temp[0][3] = temp[1][3] = temp[2][3] = temp[3][0] = temp[3][1] = temp[3][2] = 0.0f; - temp[3][3] = 1.0f; + temp[0][3] = temp[1][3] = temp[2][3] = temp[3][0] = temp[3][1] = temp[3][2] = 0.0F; + temp[3][3] = 1.0F; return QMatrix4x4(temp[0]); } diff --git a/mythtv/libs/libmythtv/videocolourspace.h b/mythtv/libs/libmythtv/videocolourspace.h index 3e153aeeb9d..063bf197a2d 100644 --- a/mythtv/libs/libmythtv/videocolourspace.h +++ b/mythtv/libs/libmythtv/videocolourspace.h @@ -11,6 +11,9 @@ #include "videoouttypes.h" #include "referencecounter.h" +// FFmpeg +#include "libavutil/pixfmt.h" // For AVCOL_xxx defines + class VideoColourSpace : public QObject, public QMatrix4x4, public ReferenceCounter { Q_OBJECT @@ -63,34 +66,34 @@ class VideoColourSpace : public QObject, public QMatrix4x4, public ReferenceCoun void Update(void); void Debug(void); QMatrix4x4 GetPrimaryConversion(int Source, int Dest); - void GetPrimaries(int Primary, ColourPrimaries &Out, float &Gamma); - QMatrix4x4 RGBtoXYZ(ColourPrimaries Primaries); + static void GetPrimaries(int Primary, ColourPrimaries &Out, float &Gamma); + static QMatrix4x4 RGBtoXYZ(ColourPrimaries Primaries); private: - PictureAttributeSupported m_supportedAttributes; + PictureAttributeSupported m_supportedAttributes {kPictureAttributeSupported_None}; QMap<PictureAttribute,int> m_dbSettings; - bool m_fullRange; - float m_brightness; - float m_contrast; - float m_saturation; - float m_hue; - float m_alpha; - int m_colourSpace; - int m_colourSpaceDepth; - int m_range; - bool m_updatesDisabled; - int m_colourShifted; - int m_colourTransfer; - PrimariesMode m_primariesMode; - int m_colourPrimaries; - int m_displayPrimaries; - float m_colourGamma; - float m_displayGamma; - QMatrix4x4 m_primaryMatrix; - float m_customDisplayGamma; - ColourPrimaries* m_customDisplayPrimaries; - VideoColourSpace *m_parent; + bool m_fullRange {true}; + float m_brightness {0.0F}; + float m_contrast {1.0F}; + float m_saturation {1.0F}; + float m_hue {0.0F}; + float m_alpha {1.0F}; + int m_colourSpace {AVCOL_SPC_UNSPECIFIED}; + int m_colourSpaceDepth {8}; + int m_range {AVCOL_RANGE_MPEG}; + bool m_updatesDisabled {true}; + int m_colourShifted {0}; + int m_colourTransfer {AVCOL_TRC_BT709}; + PrimariesMode m_primariesMode {PrimariesAuto}; + int m_colourPrimaries {AVCOL_PRI_BT709}; + int m_displayPrimaries {AVCOL_PRI_BT709}; + float m_colourGamma {2.2F}; + float m_displayGamma {2.2F}; + QMatrix4x4 m_primaryMatrix; + float m_customDisplayGamma {2.2F}; + ColourPrimaries *m_customDisplayPrimaries {nullptr}; + VideoColourSpace *m_parent {nullptr}; }; #endif diff --git a/mythtv/libs/libmythtv/videodev2.h b/mythtv/libs/libmythtv/videodev2.h index 750afa7236d..4da7acc28d9 100644 --- a/mythtv/libs/libmythtv/videodev2.h +++ b/mythtv/libs/libmythtv/videodev2.h @@ -60,14 +60,14 @@ #include <sys/time.h> #ifdef __FreeBSD__ -typedef uint64_t __u64; -typedef uint32_t __u32; -typedef uint16_t __u16; -typedef uint8_t __u8; -typedef int64_t __s64; -typedef int32_t __s32; -typedef int16_t __s16; -typedef int8_t __s8; +using __u64 = uint64_t; +using __u32 = uint32_t; +using __u16 = uint16_t; +using __u8 = uint8_t; +using __s64 = int64_t; +using __s32 = int32_t; +using __s16 = int16_t; +using __s8 = int8_t; #else #include <linux/ioctl.h> #include <linux/types.h> @@ -1140,7 +1140,7 @@ struct v4l2_selection { * A N A L O G V I D E O S T A N D A R D */ -typedef __u64 v4l2_std_id; +using v4l2_std_id = __u64; /* one bit for each */ #define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001) diff --git a/mythtv/libs/libmythtv/videodisplayprofile.cpp b/mythtv/libs/libmythtv/videodisplayprofile.cpp index 3036243a82f..d0a890258c8 100644 --- a/mythtv/libs/libmythtv/videodisplayprofile.cpp +++ b/mythtv/libs/libmythtv/videodisplayprofile.cpp @@ -53,14 +53,14 @@ uint ProfileItem::GetPriority(void) const // If string is blank then assumes a match. // If value is 0 or negative assume a match (i.e. value unknown assumes a match) // float values must be no more than 3 decimals. -bool ProfileItem::CheckRange(const QString Key, float Value, bool *Ok) const +bool ProfileItem::CheckRange(const QString &Key, float Value, bool *Ok) const { - return CheckRange(std::move(Key), Value, 0, true, Ok); + return CheckRange(Key, Value, 0, true, Ok); } -bool ProfileItem::CheckRange(const QString Key, int Value, bool *Ok) const +bool ProfileItem::CheckRange(const QString &Key, int Value, bool *Ok) const { - return CheckRange(std::move(Key), 0.0, Value, false, Ok); + return CheckRange(Key, 0.0, Value, false, Ok); } bool ProfileItem::CheckRange(const QString& Key, @@ -361,7 +361,7 @@ void VideoDisplayProfile::SetInput(const QSize &Size, float Framerate, const QSt m_lastSize = Size; change = true; } - if (Framerate > 0.0F && !qFuzzyCompare(Framerate + 1.0f, m_lastRate + 1.0f)) + if (Framerate > 0.0F && !qFuzzyCompare(Framerate + 1.0F, m_lastRate + 1.0F)) { m_lastRate = Framerate; change = true; @@ -378,7 +378,7 @@ void VideoDisplayProfile::SetInput(const QSize &Size, float Framerate, const QSt void VideoDisplayProfile::SetOutput(float Framerate) { QMutexLocker locker(&m_lock); - if (!qFuzzyCompare(Framerate + 1.0f, m_lastRate + 1.0f)) + if (!qFuzzyCompare(Framerate + 1.0F, m_lastRate + 1.0F)) { m_lastRate = Framerate; LoadBestPreferences(m_lastSize, m_lastRate, m_lastCodecName); @@ -514,7 +514,7 @@ void VideoDisplayProfile::LoadBestPreferences .arg(static_cast<double>(Framerate), 0, 'f', 3).arg(CodecName)); m_currentPreferences.clear(); - vector<ProfileItem>::const_iterator it = FindMatch(Size, Framerate, CodecName); + auto it = FindMatch(Size, Framerate, CodecName); if (it != m_allowedPreferences.end()) m_currentPreferences = (*it).GetAll(); @@ -592,8 +592,8 @@ bool VideoDisplayProfile::DeleteDB(uint GroupId, const vector<ProfileItem> &Item " profileid = :PROFILEID"); bool ok = true; - vector<ProfileItem>::const_iterator it = Items.begin(); - for (; it != Items.end(); ++it) + auto it = Items.cbegin(); + for (; it != Items.cend(); ++it) { if (!(*it).GetProfileID()) continue; @@ -637,7 +637,7 @@ bool VideoDisplayProfile::SaveDB(uint GroupId, vector<ProfileItem> &Items) " value = :VALUE"); bool ok = true; - vector<ProfileItem>::iterator it = Items.begin(); + auto it = Items.begin(); for (; it != Items.end(); ++it) { QMap<QString,QString> list = (*it).GetAll(); diff --git a/mythtv/libs/libmythtv/videodisplayprofile.h b/mythtv/libs/libmythtv/videodisplayprofile.h index 6da9bd45c24..d5ebaffd7a5 100644 --- a/mythtv/libs/libmythtv/videodisplayprofile.h +++ b/mythtv/libs/libmythtv/videodisplayprofile.h @@ -50,8 +50,8 @@ class MTV_PUBLIC ProfileItem QMap<QString,QString> GetAll(void) const; // Other - bool CheckRange(const QString Key, float Value, bool *Ok = nullptr) const; - bool CheckRange(const QString Key, int Value, bool *Ok = nullptr) const; + bool CheckRange(const QString& Key, float Value, bool *Ok = nullptr) const; + bool CheckRange(const QString& Key, int Value, bool *Ok = nullptr) const; bool CheckRange(const QString& Key, float FValue, int IValue, bool IsFloat, bool *Ok = nullptr) const; bool IsMatch(const QSize &Size, float Framerate, const QString &CodecName) const; bool IsValid(QString *Reason = nullptr) const; diff --git a/mythtv/libs/libmythtv/videometadatautil.cpp b/mythtv/libs/libmythtv/videometadatautil.cpp index 75638c55480..803407d10a9 100644 --- a/mythtv/libs/libmythtv/videometadatautil.cpp +++ b/mythtv/libs/libmythtv/videometadatautil.cpp @@ -9,9 +9,9 @@ #define LOC QString("VideoMetaDataUtil: ") static QReadWriteLock art_path_map_lock; -typedef QPair< QString, QString > ArtPair; +using ArtPair = QPair< QString, QString >; static QMultiHash<QString, ArtPair> art_path_map; -typedef QList< ArtPair > ArtList; +using ArtList = QList<ArtPair>; QString VideoMetaDataUtil::GetArtPath(const QString &pathname, const QString &type) diff --git a/mythtv/libs/libmythtv/videoout_d3d.cpp b/mythtv/libs/libmythtv/videoout_d3d.cpp index 44474ef33ef..81769ef6ba2 100644 --- a/mythtv/libs/libmythtv/videoout_d3d.cpp +++ b/mythtv/libs/libmythtv/videoout_d3d.cpp @@ -46,17 +46,9 @@ void VideoOutputD3D::GetRenderOptions(RenderOptions &Options) } VideoOutputD3D::VideoOutputD3D(void) - : MythVideoOutput(), m_lock(QMutex::Recursive), - m_hWnd(nullptr), m_render(nullptr), - m_video(nullptr), - m_render_valid(false), m_render_reset(false), m_pip_active(nullptr), - m_osd_painter(nullptr) + : MythVideoOutput(), { m_pauseFrame.buf = nullptr; -#ifdef USING_DXVA2 - m_decoder = nullptr; -#endif - m_pause_surface = nullptr; } VideoOutputD3D::~VideoOutputD3D() @@ -76,16 +68,16 @@ void VideoOutputD3D::TearDown(void) m_pauseFrame.buf = nullptr; } - if (m_osd_painter) + if (m_osdPainter) { // Hack to ensure that the osd painter is not // deleted while image load thread is still busy // loading images with that painter - m_osd_painter->Teardown(); + m_osdPainter->Teardown(); if (invalid_osd_painter) delete invalid_osd_painter; - invalid_osd_painter = m_osd_painter; - m_osd_painter = nullptr; + invalid_osd_painter = m_osdPainter; + m_osdPainter = nullptr; } DeleteDecoder(); @@ -95,15 +87,15 @@ void VideoOutputD3D::TearDown(void) void VideoOutputD3D::DestroyContext(void) { QMutexLocker locker(&m_lock); - m_render_valid = false; - m_render_reset = false; + m_renderValid = false; + m_renderReset = false; while (!m_pips.empty()) { delete *m_pips.begin(); m_pips.erase(m_pips.begin()); } - m_pip_ready.clear(); + m_pipReady.clear(); if (m_video) { @@ -195,7 +187,7 @@ bool VideoOutputD3D::SetupContext() LOG(VB_PLAYBACK, LOG_INFO, LOC + "Direct3D device successfully initialized."); - m_render_valid = true; + m_renderValid = true; return true; } @@ -239,10 +231,10 @@ bool VideoOutputD3D::Init(const QSize &video_dim_buf, TearDown(); else { - m_osd_painter = new MythD3D9Painter(m_render); - if (m_osd_painter) + m_osdPainter = new MythD3D9Painter(m_render); + if (m_osdPainter) { - m_osd_painter->SetSwapControl(false); + m_osdPainter->SetSwapControl(false); LOG(VB_PLAYBACK, LOG_INFO, LOC + "Created D3D9 osd painter."); } else @@ -337,8 +329,8 @@ void VideoOutputD3D::PrepareFrame(VideoFrame *buffer, FrameScanType t, if (!m_render || !m_video) return; - m_render_valid = m_render->Test(m_render_reset); - if (m_render_valid) + m_renderValid = m_render->Test(m_renderReset); + if (m_renderValid) { QRect dvr = m_window.GetITVResizing() ? m_window.GetITVDisplayRect() : m_window.GetDisplayVideoRect(); @@ -357,9 +349,9 @@ void VideoOutputD3D::PrepareFrame(VideoFrame *buffer, FrameScanType t, QMap<MythPlayer*,D3D9Image*>::iterator it = m_pips.begin(); for (; it != m_pips.end(); ++it) { - if (m_pip_ready[it.key()]) + if (m_pipReady[it.key()]) { - if (m_pip_active == *it) + if (m_pipActive == *it) { QRect rect = (*it)->GetRect(); if (!rect.isNull()) @@ -373,10 +365,10 @@ void VideoOutputD3D::PrepareFrame(VideoFrame *buffer, FrameScanType t, } if (m_visual) - m_visual->Draw(GetTotalOSDBounds(), m_osd_painter, nullptr); + m_visual->Draw(GetTotalOSDBounds(), m_osdPainter, nullptr); - if (osd && m_osd_painter && !m_window.IsEmbedding()) - osd->Draw(m_osd_painter, GetTotalOSDBounds().size(), + if (osd && m_osdPainter && !m_window.IsEmbedding()) + osd->Draw(m_osdPainter, GetTotalOSDBounds().size(), true); m_render->End(); } @@ -397,8 +389,8 @@ void VideoOutputD3D::Show(FrameScanType ) if (!m_render) return; - m_render_valid = m_render->Test(m_render_reset); - if (m_render_valid) + m_renderValid = m_render->Test(m_renderReset); + if (m_renderValid) m_render->Present(m_window.IsEmbedding() ? m_hEmbedWnd : nullptr); } @@ -435,7 +427,7 @@ void VideoOutputD3D::UpdatePauseFrame(int64_t &disp_timecode) { if (used_frame) { - m_pause_surface = used_frame->buf; + m_pauseSurface = used_frame->buf; disp_timecode = used_frame->disp_timecode; } else @@ -512,28 +504,28 @@ void VideoOutputD3D::ProcessFrame(VideoFrame *frame, OSD *osd, ShowPIPs(frame, pipPlayers); // Test the device - m_render_valid |= m_render->Test(m_render_reset); - if (m_render_reset) + m_renderValid |= m_render->Test(m_renderReset); + if (m_renderReset) SetupContext(); // Update a software decoded frame - if (m_render_valid && !gpu && !dummy) + if (m_renderValid && !gpu && !dummy) UpdateFrame(frame, m_video); // Update a GPU decoded frame - if (m_render_valid && gpu && !dummy) + if (m_renderValid && gpu && !dummy) { - m_render_valid = m_render->Test(m_render_reset); - if (m_render_reset) + m_renderValid = m_render->Test(m_renderReset); + if (m_renderReset) CreateDecoder(); - if (m_render_valid && frame) + if (m_renderValid && frame) { m_render->CopyFrame(frame->buf, m_video); } - else if (m_render_valid && pauseframe) + else if (m_renderValid && pauseframe) { - m_render->CopyFrame(m_pause_surface, m_video); + m_render->CopyFrame(m_pauseSurface, m_video); } } } @@ -563,7 +555,7 @@ void VideoOutputD3D::ShowPIP(VideoFrame */*frame*/, QRect position = GetPIPRect(loc, pipplayer); - m_pip_ready[pipplayer] = false; + m_pipReady[pipplayer] = false; D3D9Image *m_pip = m_pips[pipplayer]; if (!m_pip) { @@ -596,9 +588,9 @@ void VideoOutputD3D::ShowPIP(VideoFrame */*frame*/, m_pip->UpdateVertices(position, QRect(0, 0, pipVideoWidth, pipVideoHeight), 255, true); UpdateFrame(pipimage, m_pip); - m_pip_ready[pipplayer] = true; + m_pipReady[pipplayer] = true; if (pipActive) - m_pip_active = m_pip; + m_pipActive = m_pip; pipplayer->ReleaseCurrentFrame(pipimage); } @@ -613,7 +605,7 @@ void VideoOutputD3D::RemovePIP(MythPlayer *pipplayer) D3D9Image *m_pip = m_pips[pipplayer]; if (m_pip) delete m_pip; - m_pip_ready.remove(pipplayer); + m_pipReady.remove(pipplayer); m_pips.remove(pipplayer); } @@ -631,7 +623,7 @@ QStringList VideoOutputD3D::GetAllowedRenderers( MythPainter *VideoOutputD3D::GetOSDPainter(void) { - return m_osd_painter; + return m_osdPainter; } MythCodecID VideoOutputD3D::GetBestSupportedCodec( diff --git a/mythtv/libs/libmythtv/videoout_d3d.h b/mythtv/libs/libmythtv/videoout_d3d.h index 747716468c7..b416a77c7e4 100644 --- a/mythtv/libs/libmythtv/videoout_d3d.h +++ b/mythtv/libs/libmythtv/videoout_d3d.h @@ -72,26 +72,26 @@ class VideoOutputD3D : public MythVideoOutput private: VideoFrame m_pauseFrame; - QMutex m_lock; - HWND m_hWnd; - HWND m_hEmbedWnd; - MythRenderD3D9 *m_render; - D3D9Image *m_video; - bool m_render_valid; - bool m_render_reset; + QMutex m_lock {QMutex::Recursive}; + HWND m_hWnd {nullptr}; + HWND m_hEmbedWnd {nullptr}; + MythRenderD3D9 *m_render {nullptr}; + D3D9Image *m_video {nullptr}; + bool m_renderValid {false}; + bool m_renderReset {false}; QMap<MythPlayer*,D3D9Image*> m_pips; - QMap<MythPlayer*,bool> m_pip_ready; - D3D9Image *m_pip_active; + QMap<MythPlayer*,bool> m_pipReady {nullptr}; + D3D9Image *m_pipActive {nullptr}; - MythD3D9Painter *m_osd_painter; + MythD3D9Painter *m_osdPainter {nullptr}; bool CreateDecoder(void); void DeleteDecoder(void); #ifdef USING_DXVA2 - DXVA2Decoder *m_decoder; + DXVA2Decoder *m_decoder {nullptr}; #endif - void *m_pause_surface; + void *m_pauseSurface {nullptr}; }; #endif diff --git a/mythtv/libs/libmythtv/videoouttypes.h b/mythtv/libs/libmythtv/videoouttypes.h index 58bfcb618e0..5c89d82992d 100644 --- a/mythtv/libs/libmythtv/videoouttypes.h +++ b/mythtv/libs/libmythtv/videoouttypes.h @@ -7,25 +7,25 @@ #include <QObject> #include <QSize> -typedef enum PIPState +enum PIPState { kPIPOff = 0, kPIPonTV, kPIPStandAlone, kPBPLeft, kPBPRight, -} PIPState; +}; -typedef enum PIPLocation +enum PIPLocation { kPIPTopLeft = 0, kPIPBottomLeft, kPIPTopRight, kPIPBottomRight, kPIP_END -} PIPLocation; +}; -typedef enum ZoomDirection +enum ZoomDirection { kZoomHome = 0, kZoomIn, @@ -41,9 +41,9 @@ typedef enum ZoomDirection kZoomAspectUp, kZoomAspectDown, kZoom_END -} ZoomDirection; +}; -typedef enum AspectOverrideMode +enum AspectOverrideMode { kAspect_Toggle = -1, kAspect_Off = 0, @@ -52,9 +52,9 @@ typedef enum AspectOverrideMode kAspect_14_9, // added after 16:9 so as not to upset existing setups. kAspect_2_35_1, kAspect_END -} AspectOverrideMode; +}; -typedef enum AdjustFillMode +enum AdjustFillMode { kAdjustFill_Toggle = -1, kAdjustFill_Off = 0, @@ -67,26 +67,26 @@ typedef enum AdjustFillMode kAdjustFill_END, kAdjustFill_AutoDetect_DefaultOff, kAdjustFill_AutoDetect_DefaultHalf, -} AdjustFillMode; +}; -typedef enum LetterBoxColour +enum LetterBoxColour { kLetterBoxColour_Toggle = -1, kLetterBoxColour_Black = 0, kLetterBoxColour_Gray25, kLetterBoxColour_END -} LetterBoxColour; +}; -typedef enum FrameScanType +enum FrameScanType { kScan_Ignore = -1, kScan_Detect = 0, kScan_Interlaced = 1, kScan_Intr2ndField = 2, kScan_Progressive = 3, -} FrameScanType; +}; -typedef enum PictureAttribute +enum PictureAttribute { kPictureAttribute_None = 0, kPictureAttribute_MIN = 0, @@ -97,9 +97,9 @@ typedef enum PictureAttribute kPictureAttribute_Range, kPictureAttribute_Volume, kPictureAttribute_MAX -} PictureAttribute; +}; -typedef enum PictureAttributeSupported +enum PictureAttributeSupported { kPictureAttributeSupported_None = 0x00, kPictureAttributeSupported_Brightness = 0x01, @@ -108,7 +108,7 @@ typedef enum PictureAttributeSupported kPictureAttributeSupported_Hue = 0x08, kPictureAttributeSupported_Range = 0x10, kPictureAttributeSupported_Volume = 0x20, -} PictureAttributeSupported; +}; #define ALL_PICTURE_ATTRIBUTES static_cast<PictureAttributeSupported> \ (kPictureAttributeSupported_Brightness | \ @@ -117,21 +117,21 @@ typedef enum PictureAttributeSupported kPictureAttributeSupported_Hue | \ kPictureAttributeSupported_Range) -typedef enum StereoscopicMode +enum StereoscopicMode { kStereoscopicModeNone, kStereoscopicModeSideBySide, kStereoscopicModeSideBySideDiscard, kStereoscopicModeTopAndBottom, kStereoscopicModeTopAndBottomDiscard, -} StereoscopicMode; +}; -typedef enum PrimariesMode +enum PrimariesMode { PrimariesDisabled = 0, PrimariesAuto, PrimariesAlways -} PrimariesMode; +}; inline QString StereoscopictoString(StereoscopicMode mode) { @@ -151,11 +151,11 @@ inline QString StereoscopictoString(StereoscopicMode mode) return QObject::tr("Unknown"); } -typedef enum VideoErrorState +enum VideoErrorState { kError_None = 0x00, kError_Unknown = 0x01, -} VideoErrorState; +}; inline bool is_interlaced(FrameScanType scan) { diff --git a/mythtv/libs/libmythtv/videooutwindow.cpp b/mythtv/libs/libmythtv/videooutwindow.cpp index d81d8de53e3..9ca86c51f04 100644 --- a/mythtv/libs/libmythtv/videooutwindow.cpp +++ b/mythtv/libs/libmythtv/videooutwindow.cpp @@ -49,46 +49,7 @@ const float VideoOutWindow::kManualZoomMinVerticalZoom = 0.25F; const int VideoOutWindow::kManualZoomMaxMove = 50; VideoOutWindow::VideoOutWindow() - : m_display(nullptr), - // DB settings - m_dbMove(0, 0), - m_dbHorizScale(0.0F), - m_dbVertScale(0.0F), - m_dbPipSize(26), - m_dbScalingAllowed(true), - m_usingXinerama(false), - m_screenGeometry(0, 0, 1024, 768), - // Manual Zoom - m_manualVertScale(1.0F), - m_manualHorizScale(1.0F), - m_manualMove(0, 0), - // Physical dimensions - m_displayDimensions(400, 300), - m_displayAspect(1.3333F), - // Video dimensions - m_videoDim(640, 480), - m_videoDispDim(640, 480), - m_videoAspect(1.3333F), - // Aspect override - m_videoAspectOverride(1.3333F), - m_videoAspectOverrideMode(kAspect_Off), - // Adjust Fill - m_adjustFill(kAdjustFill_Off), - m_rotation(0), - // Screen settings - m_videoRect(0, 0, 0, 0), - m_displayVideoRect(0, 0, 0, 0), - m_displayVisibleRect(0, 0, 0, 0), - m_windowRect(0, 0, 0, 0), - m_tmpDisplayVisibleRect(0, 0, 0, 0), - m_embeddingRect(QRect()), - // ITV resizing - m_itvResizing(false), - m_itvDisplayVideoRect(), - // Various state variables - m_embedding(false), - m_bottomLine(false), - m_pipState(kPIPOff) + : m_display(nullptr) { m_dbPipSize = gCoreContext->GetNumSetting("PIPSize", 26); @@ -204,7 +165,7 @@ void VideoOutWindow::Rotate(void) m_manualHorizScale = m_manualVertScale; m_manualVertScale = temp; m_manualMove = QPoint(m_manualMove.y(), m_manualMove.x()); - m_displayAspect = 1.0f / m_displayAspect; + m_displayAspect = 1.0F / m_displayAspect; m_displayVisibleRect = QRect(QPoint(m_displayVisibleRect.top(), m_displayVisibleRect.left()), QSize(m_displayVisibleRect.height(), m_displayVisibleRect.width())); @@ -583,7 +544,7 @@ void VideoOutWindow::InputChanged(const QSize &VideoDim, const QSize &VideoDispD QSize newvideodispdim = Fix1088(VideoDispDim); if (!((VideoDim == m_videoDim) && (newvideodispdim == m_videoDispDim) && - qFuzzyCompare(Aspect + 100.0f, m_videoAspect + 100.0f))) + qFuzzyCompare(Aspect + 100.0F, m_videoAspect + 100.0F))) { m_videoDispDim = newvideodispdim; m_videoDim = VideoDim; @@ -653,8 +614,8 @@ void VideoOutWindow::SetVideoScalingAllowed(bool Change) m_dbScalingAllowed = false; } - if (!(qFuzzyCompare(oldvert + 100.0f, m_dbVertScale + 100.0f) && - qFuzzyCompare(oldhoriz + 100.0f, m_dbHorizScale + 100.0f))) + if (!(qFuzzyCompare(oldvert + 100.0F, m_dbVertScale + 100.0F) && + qFuzzyCompare(oldhoriz + 100.0F, m_dbHorizScale + 100.0F))) { LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Over/underscan. V: %1, H: %2") .arg(static_cast<double>(m_dbVertScale)).arg(static_cast<double>(m_dbHorizScale))); @@ -664,7 +625,7 @@ void VideoOutWindow::SetVideoScalingAllowed(bool Change) void VideoOutWindow::SetDisplayProperties(QSize DisplayDim, float DisplayAspect) { - if (DisplayDim != m_displayDimensions || !qFuzzyCompare(DisplayAspect + 10.0f, m_displayAspect + 10.0f)) + if (DisplayDim != m_displayDimensions || !qFuzzyCompare(DisplayAspect + 10.0F, m_displayAspect + 10.0F)) { LOG(VB_GENERAL, LOG_INFO, LOC + QString("New display properties: %1mmx%2mm Aspect %3") .arg(DisplayDim.width()).arg(DisplayDim.height()) @@ -942,7 +903,7 @@ void VideoOutWindow::Zoom(ZoomDirection Direction) float oldhorizscale = m_manualHorizScale; QPoint oldmove = m_manualMove; - const float zf = 0.02f; + const float zf = 0.02F; if (kZoomHome == Direction) { m_manualVertScale = 1.0F; @@ -1017,8 +978,8 @@ void VideoOutWindow::Zoom(ZoomDirection Direction) m_manualVertScale = snap(m_manualVertScale, 1.0F, zf / 2); m_manualHorizScale = snap(m_manualHorizScale, 1.0F, zf / 2); - if (!((oldmove == m_manualMove) && qFuzzyCompare(m_manualVertScale + 100.0f, oldvertscale + 100.0f) && - qFuzzyCompare(m_manualHorizScale + 100.0f, oldhorizscale + 100.0f))) + if (!((oldmove == m_manualMove) && qFuzzyCompare(m_manualVertScale + 100.0F, oldvertscale + 100.0F) && + qFuzzyCompare(m_manualHorizScale + 100.0F, oldhorizscale + 100.0F))) { LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("New zoom: Offset %1x%2 HScale %3 VScale %4") .arg(m_manualMove.x()).arg(m_manualMove.y()) @@ -1054,8 +1015,8 @@ void VideoOutWindow::ToggleMoveBottomLine(void) m_bottomLine = true; } - if (!((oldmove == m_manualMove) && qFuzzyCompare(m_manualVertScale + 100.0f, oldvertscale + 100.0f) && - qFuzzyCompare(m_manualHorizScale + 100.0f, oldhorizscale + 100.0f))) + if (!((oldmove == m_manualMove) && qFuzzyCompare(m_manualVertScale + 100.0F, oldvertscale + 100.0F) && + qFuzzyCompare(m_manualHorizScale + 100.0F, oldhorizscale + 100.0F))) { LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("New custom zoom: Offset %1x%2 HScale %3 VScale %4") .arg(m_manualMove.x()).arg(m_manualMove.y()) diff --git a/mythtv/libs/libmythtv/videooutwindow.h b/mythtv/libs/libmythtv/videooutwindow.h index ebc56be6ef3..b3f51c4d256 100644 --- a/mythtv/libs/libmythtv/videooutwindow.h +++ b/mythtv/libs/libmythtv/videooutwindow.h @@ -105,66 +105,66 @@ class VideoOutWindow : public QObject void ApplyLetterboxing (void); void PrintMoveResizeDebug (void); void SetVideoAspectRatio (float Aspect); - QSize Fix1088 (QSize Dimensions); + static QSize Fix1088 (QSize Dimensions); void Rotate (void); private: - MythDisplay* m_display; - QPoint m_dbMove; ///< Percentage move from database - float m_dbHorizScale; ///< Horizontal Overscan/Underscan percentage - float m_dbVertScale; ///< Vertical Overscan/Underscan percentage - int m_dbPipSize; ///< percentage of full window to use for PiP - bool m_dbScalingAllowed;///< disable this to prevent overscan/underscan - bool m_dbUseGUISize; ///< Use the gui size for video window - bool m_usingXinerama; ///< Display is using multiple screens - QRect m_screenGeometry; ///< Full screen geometry + MythDisplay* m_display {nullptr}; + QPoint m_dbMove {0,0}; ///< Percentage move from database + float m_dbHorizScale {0.0F}; ///< Horizontal Overscan/Underscan percentage + float m_dbVertScale {0.0F}; ///< Vertical Overscan/Underscan percentage + int m_dbPipSize {26}; ///< percentage of full window to use for PiP + bool m_dbScalingAllowed {true}; ///< disable this to prevent overscan/underscan + bool m_dbUseGUISize {false}; ///< Use the gui size for video window + bool m_usingXinerama {false}; ///< Display is using multiple screens + QRect m_screenGeometry {0,0,1024,768}; ///< Full screen geometry // Manual Zoom - float m_manualVertScale;///< Manually applied vertical scaling. - float m_manualHorizScale; ///< Manually applied horizontal scaling. - QPoint m_manualMove; ///< Manually applied percentage move. + float m_manualVertScale {1.0F}; ///< Manually applied vertical scaling. + float m_manualHorizScale {1.0F}; ///< Manually applied horizontal scaling. + QPoint m_manualMove {0,0}; ///< Manually applied percentage move. // Physical dimensions - QSize m_displayDimensions; ///< Screen dimensions of playback window in mm - float m_displayAspect; ///< Physical aspect ratio of playback window + QSize m_displayDimensions {400,300}; ///< Screen dimensions of playback window in mm + float m_displayAspect {1.3333F}; ///< Physical aspect ratio of playback window // Video dimensions - QSize m_videoDim; ///< Pixel dimensions of video buffer - QSize m_videoDispDim; ///< Pixel dimensions of video display area - float m_videoAspect; ///< Physical aspect ratio of video + QSize m_videoDim {640,480}; ///< Pixel dimensions of video buffer + QSize m_videoDispDim {640,480}; ///< Pixel dimensions of video display area + float m_videoAspect {1.3333F}; ///< Physical aspect ratio of video /// Normally this is the same as videoAspect, but may not be /// if the user has toggled the aspect override mode. - float m_videoAspectOverride; + float m_videoAspectOverride {1.3333F}; /// AspectOverrideMode to use to modify overriden_video_aspect - AspectOverrideMode m_videoAspectOverrideMode; + AspectOverrideMode m_videoAspectOverrideMode {kAspect_Off}; /// Zoom mode - AdjustFillMode m_adjustFill; - int m_rotation; + AdjustFillMode m_adjustFill {kAdjustFill_Off}; + int m_rotation {0}; /// Pixel rectangle in video frame to display - QRect m_videoRect; + QRect m_videoRect {0,0,0,0}; /// Pixel rectangle in display window into which video_rect maps to - QRect m_displayVideoRect; + QRect m_displayVideoRect {0,0,0,0}; /// Visible portion of display window in pixels. /// This may be bigger or smaller than display_video_rect. - QRect m_displayVisibleRect; + QRect m_displayVisibleRect {0,0,0,0}; /// Rectangle describing QWidget bounds. - QRect m_windowRect; + QRect m_windowRect {0,0,0,0}; /// Used to save the display_visible_rect for /// restoration after video embedding ends. - QRect m_tmpDisplayVisibleRect; + QRect m_tmpDisplayVisibleRect {0,0,0,0}; /// Embedded video rectangle QRect m_embeddingRect; // Interactive TV (MHEG) video embedding - bool m_itvResizing; + bool m_itvResizing {false}; QRect m_itvDisplayVideoRect; /// State variables - bool m_embedding; - bool m_bottomLine; - PIPState m_pipState; + bool m_embedding {false}; + bool m_bottomLine {false}; + PIPState m_pipState {kPIPOff}; // Constants static const float kManualZoomMaxHorizontalZoom; diff --git a/mythtv/libs/libmythtv/videosource.cpp b/mythtv/libs/libmythtv/videosource.cpp index d599fd1761e..8522ad711a1 100644 --- a/mythtv/libs/libmythtv/videosource.cpp +++ b/mythtv/libs/libmythtv/videosource.cpp @@ -61,11 +61,11 @@ using namespace std; #include HDHOMERUN_HEADERFILE #endif -VideoSourceSelector::VideoSourceSelector(uint _initial_sourceid, - const QString &_card_types, - bool _must_have_mplexid) : +VideoSourceSelector::VideoSourceSelector(uint _initial_sourceid, + QString _card_types, + bool _must_have_mplexid) : m_initialSourceId(_initial_sourceid), - m_cardTypes(_card_types), + m_cardTypes(std::move(_card_types)), m_mustHaveMplexId(_must_have_mplexid) { setLabel(tr("Video Source")); @@ -353,7 +353,7 @@ class CaptureCardTextEditSetting : public MythUITextEditSetting class ScanFrequency : public MythUITextEditSetting { public: - ScanFrequency(const VideoSource &parent) : + explicit ScanFrequency(const VideoSource &parent) : MythUITextEditSetting(new VideoSourceDBStorage(this, parent, "scanfrequency")) { setLabel(QObject::tr("Scan Frequency")); @@ -538,7 +538,7 @@ XMLTV_generic_config::XMLTV_generic_config(const VideoSource& _parent, _setting->addTargetedChild(_grabber, new UseEIT(m_parent)); - ButtonStandardSetting *config = new ButtonStandardSetting(tr("Configure")); + auto *config = new ButtonStandardSetting(tr("Configure")); config->setHelpText(tr("Run XMLTV configure command.")); _setting->addTargetedChild(_grabber, config); @@ -607,7 +607,7 @@ NoGrabber_config::NoGrabber_config(const VideoSource& _parent) m_useeit->setVisible(false); addChild(m_useeit); - TransTextEditSetting *label = new TransTextEditSetting(); + auto *label = new TransTextEditSetting(); label->setValue(QObject::tr("Do not configure a grabber")); addTargetedChild("/bin/true", label); } @@ -675,7 +675,7 @@ void VideoSource::fillSelections(GroupSetting* setting) { while (result.next()) { - VideoSource* source = new VideoSource(); + auto* source = new VideoSource(); source->setLabel(result.value(0).toString()); source->loadByID(result.value(1).toInt()); setting->addChild(source); @@ -1188,17 +1188,17 @@ class FirewireGUID : public CaptureCardComboBoxSetting for (size_t i = 0; i < list.size(); i++) { QString guid = list[i].GetGUIDString(); - guid_to_avcinfo[guid] = list[i]; + m_guidToAvcInfo[guid] = list[i]; addSelection(guid); } #endif // USING_FIREWIRE } AVCInfo GetAVCInfo(const QString &guid) const - { return guid_to_avcinfo[guid]; } + { return m_guidToAvcInfo[guid]; } private: - QMap<QString,AVCInfo> guid_to_avcinfo; + QMap<QString,AVCInfo> m_guidToAvcInfo; }; FirewireModel::FirewireModel(const CaptureCard &parent, @@ -1289,9 +1289,9 @@ class FirewireSpeed : public MythUIComboBoxSetting #ifdef USING_FIREWIRE static void FirewireConfigurationGroup(CaptureCard& parent, CardType& cardtype) { - FirewireGUID *dev(new FirewireGUID(parent)); - FirewireDesc *desc(new FirewireDesc(dev)); - FirewireModel *model(new FirewireModel(parent, dev)); + auto *dev(new FirewireGUID(parent)); + auto *desc(new FirewireDesc(dev)); + auto *model(new FirewireModel(parent, dev)); cardtype.addTargetedChild("FIREWIRE", dev); cardtype.addTargetedChild("FIREWIRE", new EmptyAudioDevice(parent)); cardtype.addTargetedChild("FIREWIRE", new EmptyVBIDevice(parent)); @@ -1397,7 +1397,7 @@ HDHomeRunConfigurationGroup::HDHomeRunConfigurationGroup a_cardtype.addTargetedChild("HDHOMERUN", new EmptyVBIDevice(m_parent)); a_cardtype.addTargetedChild("HDHOMERUN", m_deviceId); - GroupSetting *buttonRecOpt = new GroupSetting(); + auto *buttonRecOpt = new GroupSetting(); buttonRecOpt->setLabel(tr("Recording Options")); buttonRecOpt->addChild(new SignalTimeout(m_parent, 1000, 250)); buttonRecOpt->addChild(new ChannelTimeout(m_parent, 3000, 1750)); @@ -1856,7 +1856,7 @@ ImportConfigurationGroup::ImportConfigurationGroup(CaptureCard& a_parent, m_info(new TransTextEditSetting()), m_size(new TransTextEditSetting()) { setVisible(false); - FileDevice *device = new FileDevice(m_parent); + auto *device = new FileDevice(m_parent); device->setHelpText(tr("A local file used to simulate a recording." " Leave empty to use MythEvents to trigger an" " external program to import recording files.")); @@ -2065,15 +2065,13 @@ void CetonDeviceID::UpdateValues(void) #ifdef USING_CETON static void CetonConfigurationGroup(CaptureCard& parent, CardType& cardtype) { - CetonDeviceID *deviceid = new CetonDeviceID(parent); - GroupSetting *desc = new GroupSetting(); + auto *deviceid = new CetonDeviceID(parent); + auto *desc = new GroupSetting(); desc->setLabel(QCoreApplication::translate("CetonConfigurationGroup", "Description")); - CetonSetting *ip = new CetonSetting( - "IP Address", + auto *ip = new CetonSetting("IP Address", "IP Address of the Ceton device (192.168.200.1 by default)"); - CetonSetting *tuner = new CetonSetting( - "Tuner", + auto *tuner = new CetonSetting("Tuner", "Number of the tuner on the Ceton device (first tuner is number 0)"); cardtype.addTargetedChild("CETON", ip); @@ -2102,7 +2100,7 @@ V4LConfigurationGroup::V4LConfigurationGroup(CaptureCard& a_parent, { setVisible(false); QString drv = "(?!ivtv|hdpvr|(saa7164(.*))).*"; - VideoDevice *device = new VideoDevice(m_parent, 0, 15, QString(), drv); + auto *device = new VideoDevice(m_parent, 0, 15, QString(), drv); m_cardInfo->setLabel(tr("Probed info")); m_cardInfo->setEnabled(false); @@ -2190,7 +2188,7 @@ DemoConfigurationGroup::DemoConfigurationGroup(CaptureCard &a_parent, m_info(new TransTextEditSetting()), m_size(new TransTextEditSetting()) { setVisible(false); - FileDevice *device = new FileDevice(m_parent); + auto *device = new FileDevice(m_parent); device->setHelpText(tr("A local MPEG file used to simulate a recording.")); a_cardtype.addTargetedChild("DEMO", device); @@ -2242,7 +2240,7 @@ ExternalConfigurationGroup::ExternalConfigurationGroup(CaptureCard &a_parent, m_info(new TransTextEditSetting()) { setVisible(false); - CommandPath *device = new CommandPath(m_parent); + auto *device = new CommandPath(m_parent); device->setLabel(tr("Command path")); device->setHelpText(tr("A 'black box' application controlled via " "stdin, status on stderr and TransportStream " @@ -2297,8 +2295,7 @@ HDPVRConfigurationGroup::HDPVRConfigurationGroup(CaptureCard &a_parent, { setVisible(false); - VideoDevice *device = - new VideoDevice(m_parent, 0, 15, QString(), "hdpvr"); + auto *device = new VideoDevice(m_parent, 0, 15, QString(), "hdpvr"); m_cardInfo->setLabel(tr("Probed info")); m_cardInfo->setEnabled(false); @@ -2377,8 +2374,7 @@ void V4L2encGroup::probeCard(const QString &device_name) if (m_device->getSubSettings()->empty()) { - TunerCardAudioInput* audioinput = - new TunerCardAudioInput(m_parent, QString(), "V4L2"); + auto* audioinput = new TunerCardAudioInput(m_parent, QString(), "V4L2"); if (audioinput->fillSelections(device_name) > 1) { audioinput->setName("AudioInput"); @@ -2389,7 +2385,7 @@ void V4L2encGroup::probeCard(const QString &device_name) if (v4l2.HasSlicedVBI()) { - VBIDevice* vbidev = new VBIDevice(m_parent); + auto* vbidev = new VBIDevice(m_parent); if (vbidev->setFilter(card_name, m_DriverName) > 0) { vbidev->setName("VBIDevice"); @@ -2412,7 +2408,7 @@ CaptureCardGroup::CaptureCardGroup(CaptureCard &parent) { setLabel(QObject::tr("Capture Card Setup")); - CardType* cardtype = new CardType(parent); + auto* cardtype = new CardType(parent); parent.addChild(cardtype); #ifdef USING_DVB @@ -2524,7 +2520,7 @@ void CaptureCard::fillSelections(GroupSetting *setting) QString cardtype = query.value(2).toString(); QString label = CardUtil::GetDeviceLabel(cardtype, videodevice); - CaptureCard *card = new CaptureCard(); + auto *card = new CaptureCard(); card->loadByID(cardid); card->setLabel(label); setting->addChild(card); @@ -2691,7 +2687,7 @@ class InputName : public MythUIComboBoxSetting void fillSelections() { clearSelections(); addSelection(QObject::tr("(None)"), "None"); - CardInputDBStorage *storage = dynamic_cast<CardInputDBStorage*>(GetStorage()); + auto *storage = dynamic_cast<CardInputDBStorage*>(GetStorage()); if (storage == nullptr) return; uint cardid = storage->getInputID(); @@ -2958,7 +2954,7 @@ void StartingChannel::SetSourceID(const QString &sourceid) return; // Get the existing starting channel - CardInputDBStorage *storage = dynamic_cast<CardInputDBStorage*>(GetStorage()); + auto *storage = dynamic_cast<CardInputDBStorage*>(GetStorage()); if (storage == nullptr) return; int inputId = storage->getInputID(); @@ -3085,7 +3081,7 @@ CardInput::CardInput(const QString & cardtype, const QString & device, // same field capturecard/inputname for both if ("DVB" == cardtype) { - DeliverySystem *ds = new DeliverySystem(); + auto *ds = new DeliverySystem(); ds->setValue(CardUtil::GetDeliverySystemFromDB(_cardid)); addChild(ds); } @@ -3122,7 +3118,7 @@ CardInput::CardInput(const QString & cardtype, const QString & device, addChild(m_startChan); - GroupSetting *interact = new GroupSetting(); + auto *interact = new GroupSetting(); interact->setLabel(QObject::tr("Interactions between inputs")); if (CardUtil::IsTunerSharingCapable(cardtype)) @@ -3136,7 +3132,7 @@ CardInput::CardInput(const QString & cardtype, const QString & device, interact->addChild(new ScheduleOrder(*this, _cardid)); interact->addChild(new LiveTVOrder(*this, _cardid)); - ButtonStandardSetting *ingrpbtn = + auto *ingrpbtn = new ButtonStandardSetting(QObject::tr("Create a New Input Group")); ingrpbtn->setHelpText( QObject::tr("Input groups are only needed when two or more cards " @@ -3191,7 +3187,7 @@ void CardInput::CreateNewInputGroup(void) m_inputGrp1->Save(); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythTextInputDialog *settingdialog = + auto *settingdialog = new MythTextInputDialog(popupStack, tr("Enter new group name")); if (settingdialog->Create()) @@ -3270,9 +3266,8 @@ void CardInput::channelScanner(void) } MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StandardSettingDialog *ssd = - new StandardSettingDialog(mainStack, "generalsettings", - new ScanWizard(srcid, crdid, in)); + auto *ssd = new StandardSettingDialog(mainStack, "generalsettings", + new ScanWizard(srcid, crdid, in)); if (ssd->Create()) { @@ -3432,7 +3427,7 @@ void CaptureCardButton::edit(MythScreenType * /*screen*/) void CaptureCardEditor::AddSelection(const QString &label, const char *slot) { - ButtonStandardSetting *button = new ButtonStandardSetting(label); + auto *button = new ButtonStandardSetting(label); connect(button, SIGNAL(clicked()), slot); addChild(button); } @@ -3459,7 +3454,7 @@ void CaptureCardEditor::ShowDeleteAllCaptureCardsDialog() void CaptureCardEditor::AddNewCard() { - CaptureCard *card = new CaptureCard(); + auto *card = new CaptureCard(); card->setLabel(tr("New capture card")); card->Load(); addChild(card); @@ -3541,7 +3536,7 @@ void VideoSourceEditor::Load(void) void VideoSourceEditor::AddSelection(const QString &label, const char* slot) { - ButtonStandardSetting *button = new ButtonStandardSetting(label); + auto *button = new ButtonStandardSetting(label); connect(button, SIGNAL(clicked()), slot); addChild(button); } @@ -3568,7 +3563,7 @@ void VideoSourceEditor::DeleteAllSources(bool doDelete) void VideoSourceEditor::NewSource(void) { - VideoSource *source = new VideoSource(); + auto *source = new VideoSource(); source->setLabel(tr("New video source")); source->Load(); addChild(source); @@ -3611,8 +3606,7 @@ void CardInputEditor::Load(void) QString cardtype = query.value(2).toString(); QString inputname = query.value(3).toString(); - CardInput *cardinput = new CardInput(cardtype, videodevice, - cardid); + auto *cardinput = new CardInput(cardtype, videodevice, cardid); cardinput->loadByID(cardid); QString inputlabel = QString("%1 (%2) -> %3") .arg(CardUtil::GetDeviceLabel(cardtype, videodevice)) @@ -3930,6 +3924,5 @@ void DVBConfigurationGroup::Save(void) { GroupSetting::Save(); m_diseqcTree->Store(m_parent.getCardID(), m_cardNum->getValue()); - DiSEqCDev trees; - trees.InvalidateTrees(); + DiSEqCDev::InvalidateTrees(); } diff --git a/mythtv/libs/libmythtv/videosource.h b/mythtv/libs/libmythtv/videosource.h index b6fa5a3203d..3c9487e2726 100644 --- a/mythtv/libs/libmythtv/videosource.h +++ b/mythtv/libs/libmythtv/videosource.h @@ -58,9 +58,9 @@ class VideoSourceSelector : public TransMythUIComboBoxSetting Q_OBJECT public: - VideoSourceSelector(uint _initial_sourceid, - const QString &_card_types, - bool _must_have_mplexid); + VideoSourceSelector(uint _initial_sourceid, + QString _card_types, + bool _must_have_mplexid); void Load(void) override; // StandardSetting @@ -326,7 +326,7 @@ class HDHomeRunDevice UseHDHomeRunDevice *checkbox; }; -typedef QMap<QString, HDHomeRunDevice> HDHomeRunDeviceList; +using HDHomeRunDeviceList = QMap<QString, HDHomeRunDevice>; class HDHomeRunDeviceID; class HDHomeRunConfigurationGroup : public GroupSetting @@ -378,7 +378,7 @@ class VBoxDevice bool discovered; }; -typedef QMap<QString, VBoxDevice> VBoxDeviceList; +using VBoxDeviceList = QMap<QString, VBoxDevice>; class VBoxDeviceIDList; class VBoxDeviceID; @@ -733,8 +733,8 @@ class MTV_PUBLIC VideoSourceEditor : public GroupSetting public: VideoSourceEditor(); - bool cardTypesInclude(const int& SourceID, - const QString& thecardtype); + static bool cardTypesInclude(const int& SourceID, + const QString& thecardtype); void Load(void) override; // StandardSetting void AddSelection(const QString &label, const char *slot); diff --git a/mythtv/libs/libmythtv/visualisations/goom/filters.c b/mythtv/libs/libmythtv/visualisations/goom/filters.c index 77c6c666673..6685e74ca22 100644 --- a/mythtv/libs/libmythtv/visualisations/goom/filters.c +++ b/mythtv/libs/libmythtv/visualisations/goom/filters.c @@ -49,8 +49,8 @@ static int zf_use_xmmx = 0; static int zf_use_mmx = 0; static void select_zoom_filter (void) { - static int firsttime = 1; - if (firsttime){ + static int s_firsttime = 1; + if (s_firsttime){ if (zoom_filter_xmmx_supported()) { zf_use_xmmx = 1; printf ("Extended MMX detected. Using the fastest method !\n"); @@ -62,7 +62,7 @@ static void select_zoom_filter (void) { else { printf ("Too bad ! No MMX detected.\n"); } - firsttime = 0; + s_firsttime = 0; } } @@ -154,12 +154,12 @@ void getPixelRGB_ (const Uint * buffer, Uint x, Color * c); void generatePrecalCoef () { - static int firstime = 1; + static int s_firstime = 1; - if (firstime) { + if (s_firstime) { int coefh, coefv; - firstime = 0; + s_firstime = 0; for (coefh = 0; coefh < 16; coefh++) { @@ -208,28 +208,28 @@ generatePrecalCoef () calculatePXandPY (int x, int y, int *px, int *py) { if (theMode == WATER_MODE) { - static int wave = 0; - static int wavesp = 0; + static int s_wave = 0; + static int s_wavesp = 0; int yy; - yy = y + RAND () % 4 - RAND () % 4 + wave / 10; + yy = y + RAND () % 4 - RAND () % 4 + s_wave / 10; if (yy < 0) yy = 0; if (yy >= (int)c_resoly) yy = c_resoly - 1; - *px = (x << 4) + firedec[yy] + (wave / 10); + *px = (x << 4) + firedec[yy] + (s_wave / 10); *py = (y << 4) + 132 - ((vitesse < 131) ? vitesse : 130); // NOLINTNEXTLINE(misc-redundant-expression) - wavesp += RAND () % 3 - RAND () % 3; - if (wave < -10) - wavesp += 2; - if (wave > 10) - wavesp -= 2; - wave += (wavesp / 10) + RAND () % 3 - RAND () % 3; - if (wavesp > 100) - wavesp = (wavesp * 9) / 10; + s_wavesp += RAND () % 3 - RAND () % 3; + if (s_wave < -10) + s_wavesp += 2; + if (s_wave > 10) + s_wavesp -= 2; + s_wave += (s_wavesp / 10) + RAND () % 3 - RAND () % 3; + if (s_wavesp > 100) + s_wavesp = (s_wavesp * 9) / 10; } else { int dist = 0, vx9, vy9; @@ -507,13 +507,13 @@ zoomFilterFastRGB (Uint * pix1, Uint * pix2, ZoomFilterData * zf, Uint resx, Uin { register Uint x, y; - static unsigned char pertedec = 8; - static char firstTime = 1; + static unsigned char s_pertedec = 8; + static char s_firstTime = 1; #define INTERLACE_INCR 16 #define INTERLACE_ADD 9 #define INTERLACE_AND 0xf - static int interlace_start = -2; + static int s_interlaceStart = -2; expix1 = pix1; expix2 = pix2; @@ -535,23 +535,23 @@ zoomFilterFastRGB (Uint * pix1, Uint * pix2, ZoomFilterData * zf, Uint resx, Uin middleX = resx / 2; middleY = resy - 1; - firstTime = 1; + s_firstTime = 1; if (firedec) free (firedec); firedec = 0; } - if (interlace_start != -2) + if (s_interlaceStart != -2) zf = NULL; /** changement de config **/ if (zf) { - static char reverse = 0; // vitesse inversé..(zoom out) - reverse = zf->reverse; + static char s_reverse = 0; // vitesse inversé..(zoom out) + s_reverse = zf->reverse; vitesse = zf->vitesse; - if (reverse) + if (s_reverse) vitesse = 256 - vitesse; - pertedec = zf->pertedec; + s_pertedec = zf->pertedec; middleX = zf->middleX; middleY = zf->middleY; theMode = zf->mode; @@ -563,16 +563,16 @@ zoomFilterFastRGB (Uint * pix1, Uint * pix2, ZoomFilterData * zf, Uint resx, Uin } /* Silence a gcc warning */ - (void)pertedec; + (void)s_pertedec; /** generation d'un effet **/ - if (firstTime || zf) { + if (s_firstTime || zf) { // generation d'une table de sinus - if (firstTime) { + if (s_firstTime) { unsigned short us; - firstTime = 0; + s_firstTime = 0; generatePrecalCoef (); select_zoom_filter (); @@ -617,49 +617,49 @@ zoomFilterFastRGB (Uint * pix1, Uint * pix2, ZoomFilterData * zf, Uint resx, Uin firedec = (int *) malloc (prevY * sizeof (int)); for (loopv = prevY; loopv != 0;) { - static int decc = 0; - static int spdc = 0; - static int accel = 0; + static int s_decc = 0; + static int s_spdc = 0; + static int s_accel = 0; loopv--; - firedec[loopv] = decc; - decc += spdc / 10; + firedec[loopv] = s_decc; + s_decc += s_spdc / 10; // NOLINTNEXTLINE(misc-redundant-expression) - spdc += RAND () % 3 - RAND () % 3; + s_spdc += RAND () % 3 - RAND () % 3; - if (decc > 4) - spdc -= 1; - if (decc < -4) - spdc += 1; + if (s_decc > 4) + s_spdc -= 1; + if (s_decc < -4) + s_spdc += 1; - if (spdc > 30) - spdc = spdc - RAND () % 3 + accel / 10; - if (spdc < -30) - spdc = spdc + RAND () % 3 + accel / 10; + if (s_spdc > 30) + s_spdc = s_spdc - RAND () % 3 + s_accel / 10; + if (s_spdc < -30) + s_spdc = s_spdc + RAND () % 3 + s_accel / 10; - if (decc > 8 && spdc > 1) - spdc -= RAND () % 3 - 2; + if (s_decc > 8 && s_spdc > 1) + s_spdc -= RAND () % 3 - 2; - if (decc < -8 && spdc < -1) - spdc += RAND () % 3 + 2; + if (s_decc < -8 && s_spdc < -1) + s_spdc += RAND () % 3 + 2; - if (decc > 8 || decc < -8) - decc = decc * 8 / 9; + if (s_decc > 8 || s_decc < -8) + s_decc = s_decc * 8 / 9; // NOLINTNEXTLINE(misc-redundant-expression) - accel += RAND () % 2 - RAND () % 2; - if (accel > 20) - accel -= 2; - if (accel < -20) - accel += 2; + s_accel += RAND () % 2 - RAND () % 2; + if (s_accel > 20) + s_accel -= 2; + if (s_accel < -20) + s_accel += 2; } } } - interlace_start = 0; + s_interlaceStart = 0; } // generation du buffer de trans - if (interlace_start==-1) { + if (s_interlaceStart==-1) { /* sauvegarde de l'etat actuel dans la nouvelle source */ @@ -678,7 +678,7 @@ zoomFilterFastRGB (Uint * pix1, Uint * pix2, ZoomFilterData * zf, Uint resx, Uin buffratio = 0; } - if (interlace_start==-1) { + if (s_interlaceStart==-1) { signed int * tmp; tmp = brutD; brutD=brutT; @@ -686,13 +686,13 @@ zoomFilterFastRGB (Uint * pix1, Uint * pix2, ZoomFilterData * zf, Uint resx, Uin tmp = freebrutD; freebrutD=freebrutT; freebrutT=tmp; - interlace_start = -2; + s_interlaceStart = -2; } - if (interlace_start>=0) { - int maxEnd = (interlace_start+INTERLACE_INCR); + if (s_interlaceStart>=0) { + int maxEnd = (s_interlaceStart+INTERLACE_INCR); /* creation de la nouvelle destination */ - for (y = (Uint)interlace_start; (y < (Uint)prevY) && (y < (Uint)maxEnd); y++) { + for (y = (Uint)s_interlaceStart; (y < (Uint)prevY) && (y < (Uint)maxEnd); y++) { Uint premul_y_prevX = y * prevX * 2; for (x = 0; x < prevX; x++) { int px, py; @@ -704,8 +704,8 @@ zoomFilterFastRGB (Uint * pix1, Uint * pix2, ZoomFilterData * zf, Uint resx, Uin premul_y_prevX += 2; } } - interlace_start += INTERLACE_INCR; - if (y >= prevY-1) interlace_start = -1; + s_interlaceStart += INTERLACE_INCR; + if (y >= prevY-1) s_interlaceStart = -1; } if (switchIncr != 0) { diff --git a/mythtv/libs/libmythtv/visualisations/goom/goom_core.c b/mythtv/libs/libmythtv/visualisations/goom/goom_core.c index 0fbda25e187..abbceb0704b 100644 --- a/mythtv/libs/libmythtv/visualisations/goom/goom_core.c +++ b/mythtv/libs/libmythtv/visualisations/goom/goom_core.c @@ -36,15 +36,15 @@ static guint32 *p1, *p2, *tmp; static guint32 cycle; typedef struct { - int drawIFS; - int drawPoints; - int drawTentacle; + int m_drawIfs; + int m_drawPoints; + int m_drawTentacle; - int drawScope; - int farScope; + int m_drawScope; + int m_farScope; - int rangemin; - int rangemax; + int m_rangeMin; + int m_rangeMax; } GoomState; #define STATES_NB 8 @@ -139,39 +139,39 @@ void goom_set_resolution (guint32 resx, guint32 resy, int cinemascope) { guint32 * goom_update (gint16 data[2][512], int forceMode) { - static int lockvar = 0; // pour empecher de nouveaux changements - static int goomvar = 0; // boucle des gooms - static int totalgoom = 0; // nombre de gooms par seconds - static int agoom = 0; // un goom a eu lieu.. - static int abiggoom = 0; // un big goom a eu lieu.. - static int loopvar = 0; // mouvement des points - static int speedvar = 0; // vitesse des particules + static int s_lockVar = 0; // pour empecher de nouveaux changements + static int s_goomVar = 0; // boucle des gooms + static int s_totalGoom = 0; // nombre de gooms par seconds + static int s_aGoom = 0; // un goom a eu lieu.. + static int s_aBigGoom = 0; // un big goom a eu lieu.. + static int s_loopVar = 0; // mouvement des points + static int s_speedVar = 0; // vitesse des particules // duree de la transition entre afficher les lignes ou pas #define DRAWLINES 80 - static int lineMode = DRAWLINES; // l'effet lineaire a dessiner - static int nombreCDDC = 0; // nombre de Cycle Depuis Dernier Changement + static int s_lineMode = DRAWLINES; // l'effet lineaire a dessiner + static int s_nombreCddc = 0; // nombre de Cycle Depuis Dernier Changement guint32 *return_val; guint32 pointWidth; guint32 pointHeight; - int incvar; // volume du son - static int accelvar=0; // acceleration des particules + int incvar; // volume du son + static int s_accelVar=0; // acceleration des particules int i; - float largfactor; // elargissement de l'intervalle d'évolution - static int stop_lines = 0; + float largfactor; // elargissement de l'intervalle d'évolution + static int s_stopLines = 0; // des points - static int ifs_incr = 1; // dessiner l'ifs (0 = non: > = increment) - static int decay_ifs = 0; // disparition de l'ifs - static int recay_ifs = 0; // dédisparition de l'ifs + static int s_ifsIncr = 1; // dessiner l'ifs (0 = non: > = increment) + static int s_decayIfs = 0; // disparition de l'ifs + static int s_recayIfs = 0; // dédisparition de l'ifs #define SWITCHMULT (29.0F/30.0F) #define SWITCHINCR 0x7f - static float switchMult = 1.0F; - static int switchIncr = SWITCHINCR; + static float s_switchMult = 1.0F; + static int s_switchIncr = SWITCHINCR; - static char goomlimit = 2; // sensibilité du goom - static ZoomFilterData zfd = { + static char s_goomLimit = 2; // sensibilité du goom + static ZoomFilterData s_zfd = { 127, 8, 16, 1, 1, 0, NORMAL_MODE, 0, 0, 0, 0, 0 @@ -190,83 +190,83 @@ guint32 * goom_update (gint16 data[2][512], int forceMode) { incvar = data[0][i]; } - i = accelvar; - accelvar = incvar / 1000; + i = s_accelVar; + s_accelVar = incvar / 1000; - if (speedvar > 5) { - accelvar--; - if (speedvar > 20) - accelvar--; - if (speedvar > 40) - speedvar = 40; + if (s_speedVar > 5) { + s_accelVar--; + if (s_speedVar > 20) + s_accelVar--; + if (s_speedVar > 40) + s_speedVar = 40; } - accelvar--; + s_accelVar--; - i = accelvar - i; + i = s_accelVar - i; if (i<0) i=-i; - speedvar += (speedvar + i/2); - speedvar /= 2; - if ((speedvar) && (cycle%9==0)) { - speedvar -= 1; + s_speedVar += (s_speedVar + i/2); + s_speedVar /= 2; + if ((s_speedVar) && (cycle%9==0)) { + s_speedVar -= 1; } - if ((speedvar) && (cycle%5==0)) { - speedvar = (speedvar*7)/8; + if ((s_speedVar) && (cycle%5==0)) { + s_speedVar = (s_speedVar*7)/8; } - if (speedvar < 0) - speedvar = 0; - if (speedvar > 50) - speedvar = 50; + if (s_speedVar < 0) + s_speedVar = 0; + if (s_speedVar > 50) + s_speedVar = 50; /* ! calcul du deplacement des petits points ... */ - largfactor = ((float) speedvar / 40.0F + (float) incvar / 50000.0F) / 1.5F; + largfactor = ((float) s_speedVar / 40.0F + (float) incvar / 50000.0F) / 1.5F; if (largfactor > 1.5F) largfactor = 1.5F; - decay_ifs--; - if (decay_ifs > 0) - ifs_incr += 2; - if (decay_ifs == 0) - ifs_incr = 0; + s_decayIfs--; + if (s_decayIfs > 0) + s_ifsIncr += 2; + if (s_decayIfs == 0) + s_ifsIncr = 0; - if (recay_ifs) { - ifs_incr -= 2; - recay_ifs--; - if ((recay_ifs == 0)&&(ifs_incr<=0)) - ifs_incr = 1; + if (s_recayIfs) { + s_ifsIncr -= 2; + s_recayIfs--; + if ((s_recayIfs == 0)&&(s_ifsIncr<=0)) + s_ifsIncr = 1; } - if (ifs_incr > 0) - ifs_update (p1 + c_offset, p2 + c_offset, resolx, c_resoly, ifs_incr); + if (s_ifsIncr > 0) + ifs_update (p1 + c_offset, p2 + c_offset, resolx, c_resoly, s_ifsIncr); - if (curGState->drawPoints) { - for (i = 1; i * 15 <= speedvar + 15; i++) { - loopvar += speedvar*2/3 + 1; + if (curGState->m_drawPoints) { + for (i = 1; i * 15 <= s_speedVar + 15; i++) { + s_loopVar += s_speedVar*2/3 + 1; pointFilter (p1 + c_offset, YELLOW, ((pointWidth - 6.0F) * largfactor + 5.0F), ((pointHeight - 6.0F) * largfactor + 5.0F), - i * 152.0F, 128.0F, loopvar + i * 2032); + i * 152.0F, 128.0F, s_loopVar + i * 2032); pointFilter (p1 + c_offset, ORANGE, ((pointWidth / 2.0F) * largfactor) / i + 10.0F * i, ((pointHeight / 2.0F) * largfactor) / i + 10.0F * i, - 96.0F, i * 80.0F, loopvar / i); + 96.0F, i * 80.0F, s_loopVar / i); pointFilter (p1 + c_offset, VIOLET, ((pointHeight / 3.0F + 5.0F) * largfactor) / i + 10.0F * i, ((pointHeight / 3.0F + 5.0F) * largfactor) / i + 10.0F * i, - i + 122.0F, 134.0F, loopvar / i); + i + 122.0F, 134.0F, s_loopVar / i); pointFilter (p1 + c_offset, BLACK, ((pointHeight / 3.0F) * largfactor + 20.0F), ((pointHeight / 3.0F) * largfactor + 20.0F), - 58.0F, i * 66.0F, loopvar / i); + 58.0F, i * 66.0F, s_loopVar / i); pointFilter (p1 + c_offset, WHITE, (pointHeight * largfactor + 10.0F * i) / i, (pointHeight * largfactor + 10.0F * i) / i, - 66.0F, 74.0F, loopvar + i * 500); } + 66.0F, 74.0F, s_loopVar + i * 500); } } // par défaut pas de changement de zoom @@ -287,158 +287,158 @@ guint32 * goom_update (gint16 data[2][512], int forceMode) { // changement d'etat du plugins juste apres un autre changement d'etat. oki // // ? - if (--lockvar < 0) - lockvar = 0; + if (--s_lockVar < 0) + s_lockVar = 0; // temps du goom - if (--agoom < 0) - agoom = 0; + if (--s_aGoom < 0) + s_aGoom = 0; // temps du goom - if (--abiggoom < 0) - abiggoom = 0; + if (--s_aBigGoom < 0) + s_aBigGoom = 0; - if ((!abiggoom) && (speedvar > 4) && (goomlimit > 4) && - ((accelvar > goomlimit*9/8+7)||(accelvar < -goomlimit*9/8-7))) { - static int couleur = + if ((!s_aBigGoom) && (s_speedVar > 4) && (s_goomLimit > 4) && + ((s_accelVar > s_goomLimit*9/8+7)||(s_accelVar < -s_goomLimit*9/8-7))) { + static int s_couleur = (0xc0<<(ROUGE*8)) |(0xc0<<(VERT*8)) |(0xf0<<(BLEU*8)) |(0xf0<<(ALPHA*8)); - abiggoom = 100; + s_aBigGoom = 100; int size = resolx*c_resoly; for (int j=0;j<size;j++) - (p1+c_offset)[j] = (~(p1+c_offset)[j]) | couleur; + (p1+c_offset)[j] = (~(p1+c_offset)[j]) | s_couleur; } // on verifie qu'il ne se pas un truc interressant avec le son. - if ((accelvar > goomlimit) || (accelvar < -goomlimit) || (forceMode > 0) - || (nombreCDDC > TIME_BTW_CHG)) { + if ((s_accelVar > s_goomLimit) || (s_accelVar < -s_goomLimit) || (forceMode > 0) + || (s_nombreCddc > TIME_BTW_CHG)) { // if (nombreCDDC > 300) { // } // UN GOOM !!! YAHOO ! - totalgoom++; - agoom = 20; // mais pdt 20 cycles, il n'y en aura plus. + s_totalGoom++; + s_aGoom = 20; // mais pdt 20 cycles, il n'y en aura plus. // changement eventuel de mode if (iRAND(16) == 0) switch (iRAND (32)) { case 0: case 10: - zfd.hypercosEffect = iRAND (2); + s_zfd.hypercosEffect = iRAND (2); // Checked Fedora26 get-plugins-good sources. // No break statement there. // fall through case 13: case 20: case 21: - zfd.mode = WAVE_MODE; - zfd.reverse = 0; - zfd.waveEffect = (iRAND (3) == 0); + s_zfd.mode = WAVE_MODE; + s_zfd.reverse = 0; + s_zfd.waveEffect = (iRAND (3) == 0); if (iRAND (2)) - zfd.vitesse = (zfd.vitesse + 127) >> 1; + s_zfd.vitesse = (s_zfd.vitesse + 127) >> 1; break; case 1: case 11: - zfd.mode = CRYSTAL_BALL_MODE; - zfd.waveEffect = 0; - zfd.hypercosEffect = 0; + s_zfd.mode = CRYSTAL_BALL_MODE; + s_zfd.waveEffect = 0; + s_zfd.hypercosEffect = 0; break; case 2: case 12: - zfd.mode = AMULETTE_MODE; - zfd.waveEffect = 0; - zfd.hypercosEffect = 0; + s_zfd.mode = AMULETTE_MODE; + s_zfd.waveEffect = 0; + s_zfd.hypercosEffect = 0; break; case 3: - zfd.mode = WATER_MODE; - zfd.waveEffect = 0; - zfd.hypercosEffect = 0; + s_zfd.mode = WATER_MODE; + s_zfd.waveEffect = 0; + s_zfd.hypercosEffect = 0; break; case 4: case 14: - zfd.mode = SCRUNCH_MODE; - zfd.waveEffect = 0; - zfd.hypercosEffect = 0; + s_zfd.mode = SCRUNCH_MODE; + s_zfd.waveEffect = 0; + s_zfd.hypercosEffect = 0; break; case 5: case 15: case 22: - zfd.mode = HYPERCOS1_MODE; - zfd.waveEffect = 0; - zfd.hypercosEffect = (iRAND (3) == 0); + s_zfd.mode = HYPERCOS1_MODE; + s_zfd.waveEffect = 0; + s_zfd.hypercosEffect = (iRAND (3) == 0); break; case 6: case 16: - zfd.mode = HYPERCOS2_MODE; - zfd.waveEffect = 0; - zfd.hypercosEffect = 0; + s_zfd.mode = HYPERCOS2_MODE; + s_zfd.waveEffect = 0; + s_zfd.hypercosEffect = 0; break; case 7: case 17: - zfd.mode = CRYSTAL_BALL_MODE; - zfd.waveEffect = (iRAND (4) == 0); - zfd.hypercosEffect = iRAND (2); + s_zfd.mode = CRYSTAL_BALL_MODE; + s_zfd.waveEffect = (iRAND (4) == 0); + s_zfd.hypercosEffect = iRAND (2); break; case 8: case 18: case 19: - zfd.mode = SCRUNCH_MODE; - zfd.waveEffect = 1; - zfd.hypercosEffect = 1; + s_zfd.mode = SCRUNCH_MODE; + s_zfd.waveEffect = 1; + s_zfd.hypercosEffect = 1; break; case 29: case 30: - zfd.mode = YONLY_MODE; + s_zfd.mode = YONLY_MODE; break; case 31: case 32: - zfd.mode = SPEEDWAY_MODE; + s_zfd.mode = SPEEDWAY_MODE; break; default: - zfd.mode = NORMAL_MODE; - zfd.waveEffect = 0; - zfd.hypercosEffect = 0; + s_zfd.mode = NORMAL_MODE; + s_zfd.waveEffect = 0; + s_zfd.hypercosEffect = 0; } } // tout ceci ne sera fait qu'en cas de non-blocage - if (lockvar == 0) { + if (s_lockVar == 0) { // reperage de goom (acceleration forte de l'acceleration du volume) // -> coup de boost de la vitesse si besoin.. - if ((accelvar > goomlimit) || (accelvar < -goomlimit)) { - static int rndn = 0; - static int blocker = 0; - goomvar++; + if ((s_accelVar > s_goomLimit) || (s_accelVar < -s_goomLimit)) { + static int s_rndn = 0; + static int s_blocker = 0; + s_goomVar++; /* SELECTION OF THE GOOM STATE */ - if ((!blocker)&&(iRAND(3))) { - rndn = iRAND(STATES_RANGEMAX); - blocker = 3; + if ((!s_blocker)&&(iRAND(3))) { + s_rndn = iRAND(STATES_RANGEMAX); + s_blocker = 3; } - else if (blocker) blocker--; + else if (s_blocker) s_blocker--; for (int j=0;j<STATES_NB;j++) - if ((rndn >= states[j].rangemin) - && (rndn <= states[j].rangemax)) + if ((s_rndn >= states[j].m_rangeMin) + && (s_rndn <= states[j].m_rangeMax)) curGState = states+j; - if ((curGState->drawIFS) && (ifs_incr<=0)) { - recay_ifs = 5; - ifs_incr = 11; + if ((curGState->m_drawIfs) && (s_ifsIncr<=0)) { + s_recayIfs = 5; + s_ifsIncr = 11; } - if ((!curGState->drawIFS) && (ifs_incr>0) && (decay_ifs<=0)) - decay_ifs = 100; + if ((!curGState->m_drawIfs) && (s_ifsIncr>0) && (s_decayIfs<=0)) + s_decayIfs = 100; - if (!curGState->drawScope) - stop_lines = 0xf000 & 5; + if (!curGState->m_drawScope) + s_stopLines = 0xf000 & 5; - if (!curGState->drawScope) { - stop_lines = 0; - lineMode = DRAWLINES; + if (!curGState->m_drawScope) { + s_stopLines = 0; + s_lineMode = DRAWLINES; } // if (goomvar % 1 == 0) @@ -446,184 +446,184 @@ guint32 * goom_update (gint16 data[2][512], int forceMode) { guint32 vtmp; guint32 newvit; - lockvar = 50; - newvit = STOP_SPEED + 1 - (4.0F * log10f(speedvar+1)); + s_lockVar = 50; + newvit = STOP_SPEED + 1 - (4.0F * log10f(s_speedVar+1)); // retablir le zoom avant.. - if ((zfd.reverse) && (!(cycle % 13)) && (rand () % 5 == 0)) { - zfd.reverse = 0; - zfd.vitesse = STOP_SPEED - 2; - lockvar = 75; + if ((s_zfd.reverse) && (!(cycle % 13)) && (rand () % 5 == 0)) { + s_zfd.reverse = 0; + s_zfd.vitesse = STOP_SPEED - 2; + s_lockVar = 75; } if (iRAND (10) == 0) { - zfd.reverse = 1; - lockvar = 100; + s_zfd.reverse = 1; + s_lockVar = 100; } if (iRAND (10) == 0) - zfd.vitesse = STOP_SPEED - 1; + s_zfd.vitesse = STOP_SPEED - 1; if (iRAND (12) == 0) - zfd.vitesse = STOP_SPEED + 1; + s_zfd.vitesse = STOP_SPEED + 1; // changement de milieu.. switch (iRAND (25)) { case 0: case 3: case 6: - zfd.middleY = c_resoly - 1; - zfd.middleX = resolx / 2; + s_zfd.middleY = c_resoly - 1; + s_zfd.middleX = resolx / 2; break; case 1: case 4: - zfd.middleX = resolx - 1; + s_zfd.middleX = resolx - 1; break; case 2: case 5: - zfd.middleX = 1; + s_zfd.middleX = 1; break; default: - zfd.middleY = c_resoly / 2; - zfd.middleX = resolx / 2; + s_zfd.middleY = c_resoly / 2; + s_zfd.middleX = resolx / 2; } - if ((zfd.mode == WATER_MODE) - || (zfd.mode == YONLY_MODE) - || (zfd.mode == AMULETTE_MODE)) { - zfd.middleX = resolx / 2; - zfd.middleY = c_resoly / 2; + if ((s_zfd.mode == WATER_MODE) + || (s_zfd.mode == YONLY_MODE) + || (s_zfd.mode == AMULETTE_MODE)) { + s_zfd.middleX = resolx / 2; + s_zfd.middleY = c_resoly / 2; } switch (vtmp = (iRAND (15))) { case 0: // NOLINTNEXTLINE(misc-redundant-expression) - zfd.vPlaneEffect = iRAND (3) - iRAND (3); + s_zfd.vPlaneEffect = iRAND (3) - iRAND (3); // NOLINTNEXTLINE(misc-redundant-expression) - zfd.hPlaneEffect = iRAND (3) - iRAND (3); + s_zfd.hPlaneEffect = iRAND (3) - iRAND (3); break; case 3: - zfd.vPlaneEffect = 0; + s_zfd.vPlaneEffect = 0; // NOLINTNEXTLINE(misc-redundant-expression) - zfd.hPlaneEffect = iRAND (8) - iRAND (8); + s_zfd.hPlaneEffect = iRAND (8) - iRAND (8); break; case 4: case 5: case 6: case 7: // NOLINTNEXTLINE(misc-redundant-expression) - zfd.vPlaneEffect = iRAND (5) - iRAND (5); - zfd.hPlaneEffect = -zfd.vPlaneEffect; + s_zfd.vPlaneEffect = iRAND (5) - iRAND (5); + s_zfd.hPlaneEffect = -s_zfd.vPlaneEffect; break; case 8: - zfd.hPlaneEffect = 5 + iRAND (8); - zfd.vPlaneEffect = -zfd.hPlaneEffect; + s_zfd.hPlaneEffect = 5 + iRAND (8); + s_zfd.vPlaneEffect = -s_zfd.hPlaneEffect; break; case 9: - zfd.vPlaneEffect = 5 + iRAND (8); - zfd.hPlaneEffect = -zfd.hPlaneEffect; + s_zfd.vPlaneEffect = 5 + iRAND (8); + s_zfd.hPlaneEffect = -s_zfd.hPlaneEffect; break; case 13: - zfd.hPlaneEffect = 0; + s_zfd.hPlaneEffect = 0; // NOLINTNEXTLINE(misc-redundant-expression) - zfd.vPlaneEffect = iRAND (10) - iRAND (10); + s_zfd.vPlaneEffect = iRAND (10) - iRAND (10); break; case 14: // NOLINTNEXTLINE(misc-redundant-expression) - zfd.hPlaneEffect = iRAND (10) - iRAND (10); + s_zfd.hPlaneEffect = iRAND (10) - iRAND (10); // NOLINTNEXTLINE(misc-redundant-expression) - zfd.vPlaneEffect = iRAND (10) - iRAND (10); + s_zfd.vPlaneEffect = iRAND (10) - iRAND (10); break; default: if (vtmp < 10) { - zfd.vPlaneEffect = 0; - zfd.hPlaneEffect = 0; + s_zfd.vPlaneEffect = 0; + s_zfd.hPlaneEffect = 0; } } if (iRAND (5) != 0) - zfd.noisify = 0; + s_zfd.noisify = 0; else { - zfd.noisify = iRAND (2) + 1; - lockvar *= 2; + s_zfd.noisify = iRAND (2) + 1; + s_lockVar *= 2; } - if (zfd.mode == AMULETTE_MODE) { - zfd.vPlaneEffect = 0; - zfd.hPlaneEffect = 0; - zfd.noisify = 0; + if (s_zfd.mode == AMULETTE_MODE) { + s_zfd.vPlaneEffect = 0; + s_zfd.hPlaneEffect = 0; + s_zfd.noisify = 0; } - if ((zfd.middleX == 1) || (zfd.middleX == (int)resolx - 1)) { - zfd.vPlaneEffect = 0; - zfd.hPlaneEffect = iRAND (2) ? 0 : zfd.hPlaneEffect; + if ((s_zfd.middleX == 1) || (s_zfd.middleX == (int)resolx - 1)) { + s_zfd.vPlaneEffect = 0; + s_zfd.hPlaneEffect = iRAND (2) ? 0 : s_zfd.hPlaneEffect; } - if (newvit < (guint32)zfd.vitesse) // on accelere + if (newvit < (guint32)s_zfd.vitesse) // on accelere { - pzfd = &zfd; + pzfd = &s_zfd; if (((newvit < STOP_SPEED - 7) && - (zfd.vitesse < STOP_SPEED - 6) && + (s_zfd.vitesse < STOP_SPEED - 6) && (cycle % 3 == 0)) || (iRAND (40) == 0)) { - zfd.vitesse = STOP_SPEED - iRAND (2) + iRAND (2); - zfd.reverse = !zfd.reverse; + s_zfd.vitesse = STOP_SPEED - iRAND (2) + iRAND (2); + s_zfd.reverse = !s_zfd.reverse; } else { - zfd.vitesse = (newvit + zfd.vitesse * 7) / 8; + s_zfd.vitesse = (newvit + s_zfd.vitesse * 7) / 8; } - lockvar += 50; + s_lockVar += 50; } } - if (lockvar > 150) { - switchIncr = SWITCHINCR; - switchMult = 1.0F; + if (s_lockVar > 150) { + s_switchIncr = SWITCHINCR; + s_switchMult = 1.0F; } } // mode mega-lent if (iRAND (700) == 0) { - pzfd = &zfd; - zfd.vitesse = STOP_SPEED - 1; - zfd.pertedec = 8; - zfd.sqrtperte = 16; - goomvar = 1; - lockvar += 50; - switchIncr = SWITCHINCR; - switchMult = 1.0F; + pzfd = &s_zfd; + s_zfd.vitesse = STOP_SPEED - 1; + s_zfd.pertedec = 8; + s_zfd.sqrtperte = 16; + s_goomVar = 1; + s_lockVar += 50; + s_switchIncr = SWITCHINCR; + s_switchMult = 1.0F; } } /* * gros frein si la musique est calme */ - if ((speedvar < 1) && (zfd.vitesse < STOP_SPEED - 4) && (cycle % 16 == 0)) { - pzfd = &zfd; - zfd.vitesse += 3; - zfd.pertedec = 8; - zfd.sqrtperte = 16; - goomvar = 0; + if ((s_speedVar < 1) && (s_zfd.vitesse < STOP_SPEED - 4) && (cycle % 16 == 0)) { + pzfd = &s_zfd; + s_zfd.vitesse += 3; + s_zfd.pertedec = 8; + s_zfd.sqrtperte = 16; + s_goomVar = 0; } /* * baisser regulierement la vitesse... */ - if ((cycle % 73 == 0) && (zfd.vitesse < STOP_SPEED - 5)) { - pzfd = &zfd; - zfd.vitesse++; + if ((cycle % 73 == 0) && (s_zfd.vitesse < STOP_SPEED - 5)) { + pzfd = &s_zfd; + s_zfd.vitesse++; } /* * arreter de decrémenter au bout d'un certain temps */ - if ((cycle % 101 == 0) && (zfd.pertedec == 7)) { - pzfd = &zfd; - zfd.pertedec = 8; - zfd.sqrtperte = 16; + if ((cycle % 101 == 0) && (s_zfd.pertedec == 7)) { + pzfd = &s_zfd; + s_zfd.pertedec = 8; + s_zfd.sqrtperte = 16; } /* * Permet de forcer un effet. */ if ((forceMode > 0) && (forceMode <= NB_FX)) { - pzfd = &zfd; + pzfd = &s_zfd; pzfd->mode = forceMode - 1; } @@ -635,35 +635,35 @@ guint32 * goom_update (gint16 data[2][512], int forceMode) { * Changement d'effet de zoom ! */ if (pzfd != NULL) { - static int exvit = 128; + static int s_exvit = 128; int dif; - nombreCDDC = 0; + s_nombreCddc = 0; - switchIncr = SWITCHINCR; + s_switchIncr = SWITCHINCR; - dif = zfd.vitesse - exvit; + dif = s_zfd.vitesse - s_exvit; if (dif < 0) dif = -dif; if (dif > 2) { - switchIncr *= (dif + 2) / 2; + s_switchIncr *= (dif + 2) / 2; } - exvit = zfd.vitesse; - switchMult = 1.0F; + s_exvit = s_zfd.vitesse; + s_switchMult = 1.0F; - if (((accelvar > goomlimit) && (totalgoom < 2)) || (forceMode > 0)) { - switchIncr = 0; - switchMult = SWITCHMULT; + if (((s_accelVar > s_goomLimit) && (s_totalGoom < 2)) || (forceMode > 0)) { + s_switchIncr = 0; + s_switchMult = SWITCHMULT; } } else { - if (nombreCDDC > TIME_BTW_CHG) { - pzfd = &zfd; - nombreCDDC = 0; + if (s_nombreCddc > TIME_BTW_CHG) { + pzfd = &s_zfd; + s_nombreCddc = 0; } else - nombreCDDC++; + s_nombreCddc++; } #ifdef VERBOSE @@ -673,16 +673,16 @@ guint32 * goom_update (gint16 data[2][512], int forceMode) { #endif // Zoom here ! - zoomFilterFastRGB (p1 + c_offset, p2 + c_offset, pzfd, resolx, c_resoly, switchIncr, switchMult); + zoomFilterFastRGB (p1 + c_offset, p2 + c_offset, pzfd, resolx, c_resoly, s_switchIncr, s_switchMult); /* * Affichage tentacule */ - if (goomlimit!=0) - tentacle_update((gint32*)(p2 + c_offset), (gint32*)(p1 + c_offset), resolx, c_resoly, data, (float)accelvar/goomlimit, curGState->drawTentacle); + if (s_goomLimit!=0) + tentacle_update((gint32*)(p2 + c_offset), (gint32*)(p1 + c_offset), resolx, c_resoly, data, (float)s_accelVar/s_goomLimit, curGState->m_drawTentacle); else - tentacle_update((gint32*)(p2 + c_offset), (gint32*)(p1 + c_offset), resolx, c_resoly, data,0.0F, curGState->drawTentacle); + tentacle_update((gint32*)(p2 + c_offset), (gint32*)(p1 + c_offset), resolx, c_resoly, data,0.0F, curGState->m_drawTentacle); /* { @@ -742,7 +742,7 @@ guint32 * goom_update (gint16 data[2][512], int forceMode) { /* * arret demande */ - if ((stop_lines & 0xf000)||(!curGState->drawScope)) { + if ((s_stopLines & 0xf000)||(!curGState->m_drawScope)) { float param1, param2, amplitude; int couleur; int mode; @@ -752,37 +752,37 @@ guint32 * goom_update (gint16 data[2][512], int forceMode) { goom_lines_switch_to (gmline1, mode, param1, amplitude, couleur); goom_lines_switch_to (gmline2, mode, param2, amplitude, couleur); - stop_lines &= 0x0fff; + s_stopLines &= 0x0fff; } /* * arret aleatore.. changement de mode de ligne.. */ - if (lineMode != DRAWLINES) { - lineMode--; - if (lineMode == -1) - lineMode = 0; + if (s_lineMode != DRAWLINES) { + s_lineMode--; + if (s_lineMode == -1) + s_lineMode = 0; } else - if ((cycle%80==0)&&(iRAND(5)==0)&&lineMode) - lineMode--; + if ((cycle%80==0)&&(iRAND(5)==0)&&s_lineMode) + s_lineMode--; if ((cycle % 120 == 0) && (iRAND (4) == 0) - && (curGState->drawScope)) { - if (lineMode == 0) - lineMode = DRAWLINES; - else if (lineMode == DRAWLINES) { + && (curGState->m_drawScope)) { + if (s_lineMode == 0) + s_lineMode = DRAWLINES; + else if (s_lineMode == DRAWLINES) { float param1, param2, amplitude; int couleur1,couleur2; int mode; - lineMode--; - choose_a_goom_line (¶m1, ¶m2, &couleur1, &mode, &litude,stop_lines); + s_lineMode--; + choose_a_goom_line (¶m1, ¶m2, &couleur1, &mode, &litude,s_stopLines); couleur2 = 5-couleur1; - if (stop_lines) { - stop_lines--; + if (s_stopLines) { + s_stopLines--; if (iRAND(2)) couleur2=couleur1 = GML_BLACK; } @@ -795,23 +795,23 @@ guint32 * goom_update (gint16 data[2][512], int forceMode) { /* * si on est dans un goom : afficher les lignes... */ - if ((lineMode != 0) || (agoom > 15)) { + if ((s_lineMode != 0) || (s_aGoom > 15)) { gmline2->power = gmline1->power; goom_lines_draw (gmline1, data[0], p2 + c_offset); goom_lines_draw (gmline2, data[1], p2 + c_offset); if (((cycle % 121) == 9) && (iRAND (3) == 1) - && ((lineMode == 0) || (lineMode == DRAWLINES))) { + && ((s_lineMode == 0) || (s_lineMode == DRAWLINES))) { float param1, param2, amplitude; int couleur1,couleur2; int mode; - choose_a_goom_line (¶m1, ¶m2, &couleur1, &mode, &litude, stop_lines); + choose_a_goom_line (¶m1, ¶m2, &couleur1, &mode, &litude, s_stopLines); couleur2 = 5-couleur1; - if (stop_lines) { - stop_lines--; + if (s_stopLines) { + s_stopLines--; if (iRAND(2)) couleur2=couleur1 = GML_BLACK; } @@ -831,20 +831,20 @@ guint32 * goom_update (gint16 data[2][512], int forceMode) { // toute les 2 secondes : vérifier si le taux de goom est correct // et le modifier sinon.. if (!(cycle % 64)) { - if (speedvar<1) - goomlimit /= 2; - if (totalgoom > 4) { - goomlimit++; + if (s_speedVar<1) + s_goomLimit /= 2; + if (s_totalGoom > 4) { + s_goomLimit++; } - if (totalgoom > 7) { - goomlimit*=4/3; - goomlimit+=2; + if (s_totalGoom > 7) { + s_goomLimit*=4/3; + s_goomLimit+=2; } - if ((totalgoom == 0) && (goomlimit > 1)) - goomlimit--; - if ((totalgoom == 1) && (goomlimit > 1)) - goomlimit--; - totalgoom = 0; + if ((s_totalGoom == 0) && (s_goomLimit > 1)) + s_goomLimit--; + if ((s_totalGoom == 1) && (s_goomLimit > 1)) + s_goomLimit--; + s_totalGoom = 0; } return return_val; } diff --git a/mythtv/libs/libmythtv/visualisations/goom/ifs.c b/mythtv/libs/libmythtv/visualisations/goom/ifs.c index daa1e40b226..8c279628f16 100644 --- a/mythtv/libs/libmythtv/visualisations/goom/ifs.c +++ b/mythtv/libs/libmythtv/visualisations/goom/ifs.c @@ -117,26 +117,26 @@ typedef struct Fractal_Struct FRACTAL; struct Similitude_Struct { - DBL c_x, c_y; - DBL r, r2, A, A2; - F_PT Ct, St, Ct2, St2; - F_PT Cx, Cy; - F_PT R, R2; + DBL m_dCx, m_dCy; + DBL m_dR, m_dR2, m_dA, m_dA2; + F_PT m_fCt, m_fSt, m_fCt2, m_fSt2; + F_PT m_fCx, m_fCy; + F_PT m_fR, m_fR2; }; struct Fractal_Struct { - int Nb_Simi; - SIMI Components[5 * MAX_SIMI]; - int Depth, Col; - int Count, Speed; - int Width, Height, Lx, Ly; - DBL r_mean, dr_mean, dr2_mean; - int Cur_Pt, Max_Pt; + int m_nbSimi; + SIMI m_components[5 * MAX_SIMI]; + int m_depth, m_col; + int m_count, m_speed; + int m_width, m_height, m_lx, m_ly; + DBL m_rMean, m_drMean, m_dr2Mean; + int m_curPt, m_maxPt; - IFSPoint *Buffer1, *Buffer2; + IFSPoint *m_buffer1, *m_buffer2; // Pixmap dbuf; // GC dbuf_gc; }; @@ -175,12 +175,12 @@ static void Random_Simis (FRACTAL * F, SIMI * Cur, int i) { while (i--) { - Cur->c_x = Gauss_Rand (0.0, .8, 4.0); - Cur->c_y = Gauss_Rand (0.0, .8, 4.0); - Cur->r = Gauss_Rand (F->r_mean, F->dr_mean, 3.0); - Cur->r2 = Half_Gauss_Rand (0.0, F->dr2_mean, 2.0); - Cur->A = Gauss_Rand (0.0, 360.0, 4.0) * (M_PI / 180.0); - Cur->A2 = Gauss_Rand (0.0, 360.0, 4.0) * (M_PI / 180.0); + Cur->m_dCx = Gauss_Rand (0.0, .8, 4.0); + Cur->m_dCy = Gauss_Rand (0.0, .8, 4.0); + Cur->m_dR = Gauss_Rand (F->m_rMean, F->m_drMean, 3.0); + Cur->m_dR2 = Half_Gauss_Rand (0.0, F->m_dr2Mean, 2.0); + Cur->m_dA = Gauss_Rand (0.0, 360.0, 4.0) * (M_PI / 180.0); + Cur->m_dA2 = Gauss_Rand (0.0, 360.0, 4.0) * (M_PI / 180.0); Cur++; } } @@ -188,13 +188,13 @@ Random_Simis (FRACTAL * F, SIMI * Cur, int i) static void free_ifs_buffers (FRACTAL * Fractal) { - if (Fractal->Buffer1 != NULL) { - (void) free ((void *) Fractal->Buffer1); - Fractal->Buffer1 = (IFSPoint *) NULL; + if (Fractal->m_buffer1 != NULL) { + (void) free ((void *) Fractal->m_buffer1); + Fractal->m_buffer1 = (IFSPoint *) NULL; } - if (Fractal->Buffer2 != NULL) { - (void) free ((void *) Fractal->Buffer2); - Fractal->Buffer2 = (IFSPoint *) NULL; + if (Fractal->m_buffer2 != NULL) { + (void) free ((void *) Fractal->m_buffer2); + Fractal->m_buffer2 = (IFSPoint *) NULL; } } @@ -219,8 +219,8 @@ init_ifs (int width, int height) Root = (FRACTAL *) malloc (sizeof (FRACTAL)); if (Root == NULL) return; - Root->Buffer1 = (IFSPoint *) NULL; - Root->Buffer2 = (IFSPoint *) NULL; + Root->m_buffer1 = (IFSPoint *) NULL; + Root->m_buffer2 = (IFSPoint *) NULL; } Fractal = Root; @@ -231,69 +231,69 @@ init_ifs (int width, int height) i = (NRAND (4)) + 2; /* Number of centers */ switch (i) { case 3: - Fractal->Depth = MAX_DEPTH_3; - Fractal->r_mean = .6; - Fractal->dr_mean = .4; - Fractal->dr2_mean = .3; + Fractal->m_depth = MAX_DEPTH_3; + Fractal->m_rMean = .6; + Fractal->m_drMean = .4; + Fractal->m_dr2Mean = .3; break; case 4: - Fractal->Depth = MAX_DEPTH_4; - Fractal->r_mean = .5; - Fractal->dr_mean = .4; - Fractal->dr2_mean = .3; + Fractal->m_depth = MAX_DEPTH_4; + Fractal->m_rMean = .5; + Fractal->m_drMean = .4; + Fractal->m_dr2Mean = .3; break; case 5: - Fractal->Depth = MAX_DEPTH_5; - Fractal->r_mean = .5; - Fractal->dr_mean = .4; - Fractal->dr2_mean = .3; + Fractal->m_depth = MAX_DEPTH_5; + Fractal->m_rMean = .5; + Fractal->m_drMean = .4; + Fractal->m_dr2Mean = .3; break; default: case 2: - Fractal->Depth = MAX_DEPTH_2; - Fractal->r_mean = .7; - Fractal->dr_mean = .3; - Fractal->dr2_mean = .4; + Fractal->m_depth = MAX_DEPTH_2; + Fractal->m_rMean = .7; + Fractal->m_drMean = .3; + Fractal->m_dr2Mean = .4; break; } // fprintf( stderr, "N=%d\n", i ); - Fractal->Nb_Simi = i; - Fractal->Max_Pt = Fractal->Nb_Simi - 1; - for (i = 0; i <= Fractal->Depth + 2; ++i) - Fractal->Max_Pt *= Fractal->Nb_Simi; + Fractal->m_nbSimi = i; + Fractal->m_maxPt = Fractal->m_nbSimi - 1; + for (i = 0; i <= Fractal->m_depth + 2; ++i) + Fractal->m_maxPt *= Fractal->m_nbSimi; - if ((Fractal->Buffer1 = (IFSPoint *) calloc (Fractal->Max_Pt, + if ((Fractal->m_buffer1 = (IFSPoint *) calloc (Fractal->m_maxPt, sizeof (IFSPoint))) == NULL) { free_ifs (Fractal); return; } - if ((Fractal->Buffer2 = (IFSPoint *) calloc (Fractal->Max_Pt, + if ((Fractal->m_buffer2 = (IFSPoint *) calloc (Fractal->m_maxPt, sizeof (IFSPoint))) == NULL) { free_ifs (Fractal); return; } // printf ("--ifs setting params\n"); - Fractal->Speed = 6; - Fractal->Width = width; /* modif by JeKo */ - Fractal->Height = height; /* modif by JeKo */ - Fractal->Cur_Pt = 0; - Fractal->Count = 0; - Fractal->Lx = (Fractal->Width - 1) / 2; - Fractal->Ly = (Fractal->Height - 1) / 2; - Fractal->Col = rand () % (width * height); /* modif by JeKo */ + Fractal->m_speed = 6; + Fractal->m_width = width; /* modif by JeKo */ + Fractal->m_height = height; /* modif by JeKo */ + Fractal->m_curPt = 0; + Fractal->m_count = 0; + Fractal->m_lx = (Fractal->m_width - 1) / 2; + Fractal->m_ly = (Fractal->m_height - 1) / 2; + Fractal->m_col = rand () % (width * height); /* modif by JeKo */ - Random_Simis (Fractal, Fractal->Components, 5 * MAX_SIMI); + Random_Simis (Fractal, Fractal->m_components, 5 * MAX_SIMI); /* * #ifndef NO_DBUF * if (Fractal->dbuf != None) * XFreePixmap(display, Fractal->dbuf); * Fractal->dbuf = XCreatePixmap(display, window, - * Fractal->Width, Fractal->Height, 1); + * Fractal->m_width, Fractal->m_height, 1); * * Allocation checked * * if (Fractal->dbuf != None) { * XGCValues gcv; @@ -312,7 +312,7 @@ init_ifs (int width, int height) * Fractal->dbuf = None; * } else { * XFillRectangle(display, Fractal->dbuf, - * Fractal->dbuf_gc, 0, 0, Fractal->Width, Fractal->Height); + * Fractal->dbuf_gc, 0, 0, Fractal->m_width, Fractal->m_height); * XSetBackground(display, gc, MI_BLACK_PIXEL(mi)); * XSetFunction(display, gc, GXcopy); * } @@ -339,20 +339,20 @@ Transform (SIMI * Simi, F_PT xo, F_PT yo, F_PT * x, F_PT * y) { F_PT xx, yy; - xo = xo - Simi->Cx; - xo = (xo * Simi->R) / UNIT; - yo = yo - Simi->Cy; - yo = (yo * Simi->R) / UNIT; + xo = xo - Simi->m_fCx; + xo = (xo * Simi->m_fR) / UNIT; + yo = yo - Simi->m_fCy; + yo = (yo * Simi->m_fR) / UNIT; - xx = xo - Simi->Cx; - xx = (xx * Simi->R2) / UNIT; - yy = -yo - Simi->Cy; - yy = (yy * Simi->R2) / UNIT; + xx = xo - Simi->m_fCx; + xx = (xx * Simi->m_fR2) / UNIT; + yy = -yo - Simi->m_fCy; + yy = (yy * Simi->m_fR2) / UNIT; *x = - ((xo * Simi->Ct - yo * Simi->St + xx * Simi->Ct2 - yy * Simi->St2) / UNIT ) + Simi->Cx; + ((xo * Simi->m_fCt - yo * Simi->m_fSt + xx * Simi->m_fCt2 - yy * Simi->m_fSt2) / UNIT ) + Simi->m_fCx; *y = - ((xo * Simi->St + yo * Simi->Ct + xx * Simi->St2 + yy * Simi->Ct2) / UNIT ) + Simi->Cy; + ((xo * Simi->m_fSt + yo * Simi->m_fCt + xx * Simi->m_fSt2 + yy * Simi->m_fCt2) / UNIT ) + Simi->m_fCy; } /***************************************************************/ @@ -363,20 +363,20 @@ Trace (FRACTAL * F, F_PT xo, F_PT yo) F_PT x, y, i; SIMI *Cur; - Cur = Cur_F->Components; - for (i = Cur_F->Nb_Simi; i; --i, Cur++) { + Cur = Cur_F->m_components; + for (i = Cur_F->m_nbSimi; i; --i, Cur++) { Transform (Cur, xo, yo, &x, &y); - Buf->x = F->Lx + ((x * F->Lx) / (UNIT*2) ); - Buf->y = F->Ly - ((y * F->Ly) / (UNIT*2) ); + Buf->x = F->m_lx + ((x * F->m_lx) / (UNIT*2) ); + Buf->y = F->m_ly - ((y * F->m_ly) / (UNIT*2) ); Buf++; Cur_Pt++; - if (F->Depth && ((x - xo) / 16) && ((y - yo) / 16)) { - F->Depth--; + if (F->m_depth && ((x - xo) / 16) && ((y - yo) / 16)) { + F->m_depth--; Trace (F, x, y); - F->Depth++; + F->m_depth++; } } } @@ -389,28 +389,28 @@ Draw_Fractal ( void /* ModeInfo * mi */ ) F_PT x, y; SIMI *Cur, *Simi; - for (Cur = F->Components, i = F->Nb_Simi; i; --i, Cur++) { - Cur->Cx = DBL_To_F_PT (Cur->c_x); - Cur->Cy = DBL_To_F_PT (Cur->c_y); + for (Cur = F->m_components, i = F->m_nbSimi; i; --i, Cur++) { + Cur->m_fCx = DBL_To_F_PT (Cur->m_dCx); + Cur->m_fCy = DBL_To_F_PT (Cur->m_dCy); - Cur->Ct = DBL_To_F_PT (cos (Cur->A)); - Cur->St = DBL_To_F_PT (sin (Cur->A)); - Cur->Ct2 = DBL_To_F_PT (cos (Cur->A2)); - Cur->St2 = DBL_To_F_PT (sin (Cur->A2)); + Cur->m_fCt = DBL_To_F_PT (cos (Cur->m_dA)); + Cur->m_fSt = DBL_To_F_PT (sin (Cur->m_dA)); + Cur->m_fCt2 = DBL_To_F_PT (cos (Cur->m_dA2)); + Cur->m_fSt2 = DBL_To_F_PT (sin (Cur->m_dA2)); - Cur->R = DBL_To_F_PT (Cur->r); - Cur->R2 = DBL_To_F_PT (Cur->r2); + Cur->m_fR = DBL_To_F_PT (Cur->m_dR); + Cur->m_fR2 = DBL_To_F_PT (Cur->m_dR2); } Cur_Pt = 0; Cur_F = F; - Buf = F->Buffer2; - for (Cur = F->Components, i = F->Nb_Simi; i; --i, Cur++) { + Buf = F->m_buffer2; + for (Cur = F->m_components, i = F->m_nbSimi; i; --i, Cur++) { F_PT xo, yo; - xo = Cur->Cx; - yo = Cur->Cy; - for (Simi = F->Components, j = F->Nb_Simi; j; --j, Simi++) { + xo = Cur->m_fCx; + yo = Cur->m_fCy; + for (Simi = F->m_components, j = F->m_nbSimi; j; --j, Simi++) { if (Simi == Cur) continue; Transform (Simi, xo, yo, &x, &y); @@ -420,17 +420,17 @@ Draw_Fractal ( void /* ModeInfo * mi */ ) /* Erase previous */ -/* if (F->Cur_Pt) { +/* if (F->m_curPt) { XSetForeground(display, gc, MI_BLACK_PIXEL(mi)); if (F->dbuf != None) { XSetForeground(display, F->dbuf_gc, 0); */ - /* XDrawPoints(display, F->dbuf, F->dbuf_gc, F->Buffer1, F->Cur_Pt, * * * * + /* XDrawPoints(display, F->dbuf, F->dbuf_gc, F->m_buffer1, F->m_curPt, * * * * * CoordModeOrigin); */ /* XFillRectangle(display, F->dbuf, F->dbuf_gc, 0, 0, - F->Width, F->Height); + F->m_width, F->m_height); } else - XDrawPoints(display, window, gc, F->Buffer1, F->Cur_Pt, CoordModeOrigin); + XDrawPoints(display, window, gc, F->m_buffer1, F->m_curPt, CoordModeOrigin); } if (MI_NPIXELS(mi) < 2) XSetForeground(display, gc, MI_WHITE_PIXEL(mi)); @@ -439,19 +439,19 @@ Draw_Fractal ( void /* ModeInfo * mi */ ) if (Cur_Pt) { if (F->dbuf != None) { XSetForeground(display, F->dbuf_gc, 1); - XDrawPoints(display, F->dbuf, F->dbuf_gc, F->Buffer2, Cur_Pt, + XDrawPoints(display, F->dbuf, F->dbuf_gc, F->m_buffer2, Cur_Pt, CoordModeOrigin); } else - XDrawPoints(display, window, gc, F->Buffer2, Cur_Pt, CoordModeOrigin); + XDrawPoints(display, window, gc, F->m_buffer2, Cur_Pt, CoordModeOrigin); } if (F->dbuf != None) - XCopyPlane(display, F->dbuf, window, gc, 0, 0, F->Width, F->Height, 0, 0, 1); + XCopyPlane(display, F->dbuf, window, gc, 0, 0, F->m_width, F->m_height, 0, 0, 1); */ - F->Cur_Pt = Cur_Pt; - Buf = F->Buffer1; - F->Buffer1 = F->Buffer2; - F->Buffer2 = Buf; + F->m_curPt = Cur_Pt; + Buf = F->m_buffer1; + F->m_buffer1 = F->m_buffer2; + F->m_buffer2 = Buf; } @@ -466,10 +466,10 @@ draw_ifs ( /* ModeInfo * mi */ int *nbPoints) if (Root == NULL) return NULL; F = Root; // [/*MI_SCREEN(mi)*/0]; - if (F->Buffer1 == NULL) + if (F->m_buffer1 == NULL) return NULL; - u = (DBL) (F->Count) * (DBL) (F->Speed) / 1000.0; + u = (DBL) (F->m_count) * (DBL) (F->m_speed) / 1000.0; uu = u * u; v = 1.0 - u; vv = v * v; @@ -478,56 +478,56 @@ draw_ifs ( /* ModeInfo * mi */ int *nbPoints) u2 = 3.0 * v * uu; u3 = u * uu; - S = F->Components; - S1 = S + F->Nb_Simi; - S2 = S1 + F->Nb_Simi; - S3 = S2 + F->Nb_Simi; - S4 = S3 + F->Nb_Simi; - - for (i = F->Nb_Simi; i; --i, S++, S1++, S2++, S3++, S4++) { - S->c_x = u0 * S1->c_x + u1 * S2->c_x + u2 * S3->c_x + u3 * S4->c_x; - S->c_y = u0 * S1->c_y + u1 * S2->c_y + u2 * S3->c_y + u3 * S4->c_y; - S->r = u0 * S1->r + u1 * S2->r + u2 * S3->r + u3 * S4->r; - S->r2 = u0 * S1->r2 + u1 * S2->r2 + u2 * S3->r2 + u3 * S4->r2; - S->A = u0 * S1->A + u1 * S2->A + u2 * S3->A + u3 * S4->A; - S->A2 = u0 * S1->A2 + u1 * S2->A2 + u2 * S3->A2 + u3 * S4->A2; + S = F->m_components; + S1 = S + F->m_nbSimi; + S2 = S1 + F->m_nbSimi; + S3 = S2 + F->m_nbSimi; + S4 = S3 + F->m_nbSimi; + + for (i = F->m_nbSimi; i; --i, S++, S1++, S2++, S3++, S4++) { + S->m_dCx = u0 * S1->m_dCx + u1 * S2->m_dCx + u2 * S3->m_dCx + u3 * S4->m_dCx; + S->m_dCy = u0 * S1->m_dCy + u1 * S2->m_dCy + u2 * S3->m_dCy + u3 * S4->m_dCy; + S->m_dR = u0 * S1->m_dR + u1 * S2->m_dR + u2 * S3->m_dR + u3 * S4->m_dR; + S->m_dR2 = u0 * S1->m_dR2 + u1 * S2->m_dR2 + u2 * S3->m_dR2 + u3 * S4->m_dR2; + S->m_dA = u0 * S1->m_dA + u1 * S2->m_dA + u2 * S3->m_dA + u3 * S4->m_dA; + S->m_dA2 = u0 * S1->m_dA2 + u1 * S2->m_dA2 + u2 * S3->m_dA2 + u3 * S4->m_dA2; } // MI_IS_DRAWN(mi) = True; Draw_Fractal ( /* mi */ ); - if (F->Count >= 1000 / F->Speed) { - S = F->Components; - S1 = S + F->Nb_Simi; - S2 = S1 + F->Nb_Simi; - S3 = S2 + F->Nb_Simi; - S4 = S3 + F->Nb_Simi; - - for (i = F->Nb_Simi; i; --i, S++, S1++, S2++, S3++, S4++) { - S2->c_x = 2.0 * S4->c_x - S3->c_x; - S2->c_y = 2.0 * S4->c_y - S3->c_y; - S2->r = 2.0 * S4->r - S3->r; - S2->r2 = 2.0 * S4->r2 - S3->r2; - S2->A = 2.0 * S4->A - S3->A; - S2->A2 = 2.0 * S4->A2 - S3->A2; + if (F->m_count >= 1000 / F->m_speed) { + S = F->m_components; + S1 = S + F->m_nbSimi; + S2 = S1 + F->m_nbSimi; + S3 = S2 + F->m_nbSimi; + S4 = S3 + F->m_nbSimi; + + for (i = F->m_nbSimi; i; --i, S++, S1++, S2++, S3++, S4++) { + S2->m_dCx = 2.0 * S4->m_dCx - S3->m_dCx; + S2->m_dCy = 2.0 * S4->m_dCy - S3->m_dCy; + S2->m_dR = 2.0 * S4->m_dR - S3->m_dR; + S2->m_dR2 = 2.0 * S4->m_dR2 - S3->m_dR2; + S2->m_dA = 2.0 * S4->m_dA - S3->m_dA; + S2->m_dA2 = 2.0 * S4->m_dA2 - S3->m_dA2; *S1 = *S4; } - Random_Simis (F, F->Components + 3 * F->Nb_Simi, F->Nb_Simi); + Random_Simis (F, F->m_components + 3 * F->m_nbSimi, F->m_nbSimi); - Random_Simis (F, F->Components + 4 * F->Nb_Simi, F->Nb_Simi); + Random_Simis (F, F->m_components + 4 * F->m_nbSimi, F->m_nbSimi); - F->Count = 0; + F->m_count = 0; } else - F->Count++; + F->m_count++; - F->Col++; + F->m_col++; /* #1 code added by JeKo */ (*nbPoints) = Cur_Pt; - return F->Buffer2; + return F->m_buffer2; /* #1 end */ } diff --git a/mythtv/libs/libmythtv/visualisations/goom/ifs_display.c b/mythtv/libs/libmythtv/visualisations/goom/ifs_display.c index 9146e0239a2..fd517314bff 100644 --- a/mythtv/libs/libmythtv/visualisations/goom/ifs_display.c +++ b/mythtv/libs/libmythtv/visualisations/goom/ifs_display.c @@ -11,31 +11,31 @@ void ifs_update (guint32 * data, const guint32 * back, int width, int height, int increment) { - static int couleur = 0xc0c0c0c0; - static int v[4] = { 2, 4, 3, 2 }; - static int col[4] = { 2, 4, 3, 2 }; + static int s_couleur = 0xc0c0c0c0; + static int s_v[4] = { 2, 4, 3, 2 }; + static int s_col[4] = { 2, 4, 3, 2 }; #define MOD_MER 0 #define MOD_FEU 1 #define MOD_MERVER 2 - static int mode = MOD_MERVER; - static int justChanged = 0; - static int cycle = 0; + static int s_mode = MOD_MERVER; + static int s_justChanged = 0; + static int s_cycle = 0; int cycle10; int nbpt; IFSPoint *points; - int couleursl = couleur; + int couleursl = s_couleur; - cycle++; - if (cycle >= 80) - cycle = 0; + s_cycle++; + if (s_cycle >= 80) + s_cycle = 0; - if (cycle < 40) - cycle10 = cycle / 10; + if (s_cycle < 40) + cycle10 = s_cycle / 10; else - cycle10 = 7 - cycle / 10; + cycle10 = 7 - s_cycle / 10; { unsigned char *tmp = (unsigned char *) &couleursl; @@ -89,179 +89,179 @@ ifs_update (guint32 * data, const guint32 * back, int width, int height, } } #endif /*MMX*/ - justChanged--; + s_justChanged--; - col[ALPHA] = couleur >> (ALPHA * 8) & 0xff; - col[BLEU] = couleur >> (BLEU * 8) & 0xff; - col[VERT] = couleur >> (VERT * 8) & 0xff; - col[ROUGE] = couleur >> (ROUGE * 8) & 0xff; + s_col[ALPHA] = s_couleur >> (ALPHA * 8) & 0xff; + s_col[BLEU] = s_couleur >> (BLEU * 8) & 0xff; + s_col[VERT] = s_couleur >> (VERT * 8) & 0xff; + s_col[ROUGE] = s_couleur >> (ROUGE * 8) & 0xff; - if (mode == MOD_MER) { - col[BLEU] += v[BLEU]; - if (col[BLEU] > 255) { - col[BLEU] = 255; - v[BLEU] = -(RAND() % 4) - 1; + if (s_mode == MOD_MER) { + s_col[BLEU] += s_v[BLEU]; + if (s_col[BLEU] > 255) { + s_col[BLEU] = 255; + s_v[BLEU] = -(RAND() % 4) - 1; } - if (col[BLEU] < 32) { - col[BLEU] = 32; - v[BLEU] = (RAND() % 4) + 1; + if (s_col[BLEU] < 32) { + s_col[BLEU] = 32; + s_v[BLEU] = (RAND() % 4) + 1; } - col[VERT] += v[VERT]; - if (col[VERT] > 200) { - col[VERT] = 200; - v[VERT] = -(RAND() % 3) - 2; + s_col[VERT] += s_v[VERT]; + if (s_col[VERT] > 200) { + s_col[VERT] = 200; + s_v[VERT] = -(RAND() % 3) - 2; } - if (col[VERT] > col[BLEU]) { - col[VERT] = col[BLEU]; - v[VERT] = v[BLEU]; + if (s_col[VERT] > s_col[BLEU]) { + s_col[VERT] = s_col[BLEU]; + s_v[VERT] = s_v[BLEU]; } - if (col[VERT] < 32) { - col[VERT] = 32; - v[VERT] = (RAND() % 3) + 2; + if (s_col[VERT] < 32) { + s_col[VERT] = 32; + s_v[VERT] = (RAND() % 3) + 2; } - col[ROUGE] += v[ROUGE]; - if (col[ROUGE] > 64) { - col[ROUGE] = 64; - v[ROUGE] = -(RAND () % 4) - 1; + s_col[ROUGE] += s_v[ROUGE]; + if (s_col[ROUGE] > 64) { + s_col[ROUGE] = 64; + s_v[ROUGE] = -(RAND () % 4) - 1; } - if (col[ROUGE] < 0) { - col[ROUGE] = 0; - v[ROUGE] = (RAND () % 4) + 1; + if (s_col[ROUGE] < 0) { + s_col[ROUGE] = 0; + s_v[ROUGE] = (RAND () % 4) + 1; } - col[ALPHA] += v[ALPHA]; - if (col[ALPHA] > 0) { - col[ALPHA] = 0; - v[ALPHA] = -(RAND () % 4) - 1; + s_col[ALPHA] += s_v[ALPHA]; + if (s_col[ALPHA] > 0) { + s_col[ALPHA] = 0; + s_v[ALPHA] = -(RAND () % 4) - 1; } - if (col[ALPHA] < 0) { - col[ALPHA] = 0; - v[ALPHA] = (RAND () % 4) + 1; + if (s_col[ALPHA] < 0) { + s_col[ALPHA] = 0; + s_v[ALPHA] = (RAND () % 4) + 1; } - if (((col[VERT] > 32) && (col[ROUGE] < col[VERT] + 40) - && (col[VERT] < col[ROUGE] + 20) && (col[BLEU] < 64) - && (RAND () % 20 == 0)) && (justChanged < 0)) { - mode = (RAND () % 3) ? MOD_FEU : MOD_MERVER; - justChanged = 250; + if (((s_col[VERT] > 32) && (s_col[ROUGE] < s_col[VERT] + 40) + && (s_col[VERT] < s_col[ROUGE] + 20) && (s_col[BLEU] < 64) + && (RAND () % 20 == 0)) && (s_justChanged < 0)) { + s_mode = (RAND () % 3) ? MOD_FEU : MOD_MERVER; + s_justChanged = 250; } } - else if (mode == MOD_MERVER) { - col[BLEU] += v[BLEU]; - if (col[BLEU] > 128) { - col[BLEU] = 128; - v[BLEU] = -(RAND () % 4) - 1; + else if (s_mode == MOD_MERVER) { + s_col[BLEU] += s_v[BLEU]; + if (s_col[BLEU] > 128) { + s_col[BLEU] = 128; + s_v[BLEU] = -(RAND () % 4) - 1; } - if (col[BLEU] < 16) { - col[BLEU] = 16; - v[BLEU] = (RAND () % 4) + 1; + if (s_col[BLEU] < 16) { + s_col[BLEU] = 16; + s_v[BLEU] = (RAND () % 4) + 1; } - col[VERT] += v[VERT]; - if (col[VERT] > 200) { - col[VERT] = 200; - v[VERT] = -(RAND () % 3) - 2; + s_col[VERT] += s_v[VERT]; + if (s_col[VERT] > 200) { + s_col[VERT] = 200; + s_v[VERT] = -(RAND () % 3) - 2; } - if (col[VERT] > col[ALPHA]) { - col[VERT] = col[ALPHA]; - v[VERT] = v[ALPHA]; + if (s_col[VERT] > s_col[ALPHA]) { + s_col[VERT] = s_col[ALPHA]; + s_v[VERT] = s_v[ALPHA]; } - if (col[VERT] < 32) { - col[VERT] = 32; - v[VERT] = (RAND () % 3) + 2; + if (s_col[VERT] < 32) { + s_col[VERT] = 32; + s_v[VERT] = (RAND () % 3) + 2; } - col[ROUGE] += v[ROUGE]; - if (col[ROUGE] > 128) { - col[ROUGE] = 128; - v[ROUGE] = -(RAND () % 4) - 1; + s_col[ROUGE] += s_v[ROUGE]; + if (s_col[ROUGE] > 128) { + s_col[ROUGE] = 128; + s_v[ROUGE] = -(RAND () % 4) - 1; } - if (col[ROUGE] < 0) { - col[ROUGE] = 0; - v[ROUGE] = (RAND () % 4) + 1; + if (s_col[ROUGE] < 0) { + s_col[ROUGE] = 0; + s_v[ROUGE] = (RAND () % 4) + 1; } - col[ALPHA] += v[ALPHA]; - if (col[ALPHA] > 255) { - col[ALPHA] = 255; - v[ALPHA] = -(RAND () % 4) - 1; + s_col[ALPHA] += s_v[ALPHA]; + if (s_col[ALPHA] > 255) { + s_col[ALPHA] = 255; + s_v[ALPHA] = -(RAND () % 4) - 1; } - if (col[ALPHA] < 0) { - col[ALPHA] = 0; - v[ALPHA] = (RAND () % 4) + 1; + if (s_col[ALPHA] < 0) { + s_col[ALPHA] = 0; + s_v[ALPHA] = (RAND () % 4) + 1; } - if (((col[VERT] > 32) && (col[ROUGE] < col[VERT] + 40) - && (col[VERT] < col[ROUGE] + 20) && (col[BLEU] < 64) - && (RAND () % 20 == 0)) && (justChanged < 0)) { - mode = (RAND () % 3) ? MOD_FEU : MOD_MER; - justChanged = 250; + if (((s_col[VERT] > 32) && (s_col[ROUGE] < s_col[VERT] + 40) + && (s_col[VERT] < s_col[ROUGE] + 20) && (s_col[BLEU] < 64) + && (RAND () % 20 == 0)) && (s_justChanged < 0)) { + s_mode = (RAND () % 3) ? MOD_FEU : MOD_MER; + s_justChanged = 250; } } - else if (mode == MOD_FEU) { + else if (s_mode == MOD_FEU) { - col[BLEU] += v[BLEU]; - if (col[BLEU] > 64) { - col[BLEU] = 64; - v[BLEU] = -(RAND () % 4) - 1; + s_col[BLEU] += s_v[BLEU]; + if (s_col[BLEU] > 64) { + s_col[BLEU] = 64; + s_v[BLEU] = -(RAND () % 4) - 1; } - if (col[BLEU] < 0) { - col[BLEU] = 0; - v[BLEU] = (RAND () % 4) + 1; + if (s_col[BLEU] < 0) { + s_col[BLEU] = 0; + s_v[BLEU] = (RAND () % 4) + 1; } - col[VERT] += v[VERT]; - if (col[VERT] > 200) { - col[VERT] = 200; - v[VERT] = -(RAND () % 3) - 2; + s_col[VERT] += s_v[VERT]; + if (s_col[VERT] > 200) { + s_col[VERT] = 200; + s_v[VERT] = -(RAND () % 3) - 2; } - if (col[VERT] > col[ROUGE] + 20) { - col[VERT] = col[ROUGE] + 20; - v[VERT] = -(RAND () % 3) - 2; - v[ROUGE] = (RAND () % 4) + 1; - v[BLEU] = (RAND () % 4) + 1; + if (s_col[VERT] > s_col[ROUGE] + 20) { + s_col[VERT] = s_col[ROUGE] + 20; + s_v[VERT] = -(RAND () % 3) - 2; + s_v[ROUGE] = (RAND () % 4) + 1; + s_v[BLEU] = (RAND () % 4) + 1; } - if (col[VERT] < 0) { - col[VERT] = 0; - v[VERT] = (RAND () % 3) + 2; + if (s_col[VERT] < 0) { + s_col[VERT] = 0; + s_v[VERT] = (RAND () % 3) + 2; } - col[ROUGE] += v[ROUGE]; - if (col[ROUGE] > 255) { - col[ROUGE] = 255; - v[ROUGE] = -(RAND () % 4) - 1; + s_col[ROUGE] += s_v[ROUGE]; + if (s_col[ROUGE] > 255) { + s_col[ROUGE] = 255; + s_v[ROUGE] = -(RAND () % 4) - 1; } - if (col[ROUGE] > col[VERT] + 40) { - col[ROUGE] = col[VERT] + 40; - v[ROUGE] = -(RAND () % 4) - 1; + if (s_col[ROUGE] > s_col[VERT] + 40) { + s_col[ROUGE] = s_col[VERT] + 40; + s_v[ROUGE] = -(RAND () % 4) - 1; } - if (col[ROUGE] < 0) { - col[ROUGE] = 0; - v[ROUGE] = (RAND () % 4) + 1; + if (s_col[ROUGE] < 0) { + s_col[ROUGE] = 0; + s_v[ROUGE] = (RAND () % 4) + 1; } - col[ALPHA] += v[ALPHA]; - if (col[ALPHA] > 0) { - col[ALPHA] = 0; - v[ALPHA] = -(RAND () % 4) - 1; + s_col[ALPHA] += s_v[ALPHA]; + if (s_col[ALPHA] > 0) { + s_col[ALPHA] = 0; + s_v[ALPHA] = -(RAND () % 4) - 1; } - if (col[ALPHA] < 0) { - col[ALPHA] = 0; - v[ALPHA] = (RAND () % 4) + 1; + if (s_col[ALPHA] < 0) { + s_col[ALPHA] = 0; + s_v[ALPHA] = (RAND () % 4) + 1; } - if (((col[ROUGE] < 64) && (col[VERT] > 32) && (col[VERT] < col[BLEU]) - && (col[BLEU] > 32) - && (RAND () % 20 == 0)) && (justChanged < 0)) { - mode = (RAND () % 2) ? MOD_MER : MOD_MERVER; - justChanged = 250; + if (((s_col[ROUGE] < 64) && (s_col[VERT] > 32) && (s_col[VERT] < s_col[BLEU]) + && (s_col[BLEU] > 32) + && (RAND () % 20 == 0)) && (s_justChanged < 0)) { + s_mode = (RAND () % 2) ? MOD_MER : MOD_MERVER; + s_justChanged = 250; } } - couleur = (col[ALPHA] << (ALPHA * 8)) - | (col[BLEU] << (BLEU * 8)) - | (col[VERT] << (VERT * 8)) - | (col[ROUGE] << (ROUGE * 8)); + s_couleur = (s_col[ALPHA] << (ALPHA * 8)) + | (s_col[BLEU] << (BLEU * 8)) + | (s_col[VERT] << (VERT * 8)) + | (s_col[ROUGE] << (ROUGE * 8)); } diff --git a/mythtv/libs/libmythtv/visualisations/goom/tentacle3d.c b/mythtv/libs/libmythtv/visualisations/goom/tentacle3d.c index efdb0dcf1db..47286329c0b 100644 --- a/mythtv/libs/libmythtv/visualisations/goom/tentacle3d.c +++ b/mythtv/libs/libmythtv/visualisations/goom/tentacle3d.c @@ -95,97 +95,97 @@ int evolutecolor (unsigned int src,unsigned int dest, unsigned int mask, unsigne } static void pretty_move (float lcycle, float *dist,float *dist2, float *rotangle) { - static float distt = 10.0F; - static float distt2 = 0.0F; - static float rot = 0.0F; // entre 0 et 2 * M_PI - static int happens = 0; + static float s_distT = 10.0F; + static float s_distT2 = 0.0F; + static float s_rot = 0.0F; // entre 0 et 2 * M_PI + static int s_happens = 0; float tmp; - static int rotation = 0; - static int lock = 0; - - if (happens) - happens -= 1; - else if (lock == 0) { - happens = iRAND(200)?0:100+iRAND(60); - lock = happens * 3 / 2; + static int s_rotation = 0; + static int s_lock = 0; + + if (s_happens) + s_happens -= 1; + else if (s_lock == 0) { + s_happens = iRAND(200)?0:100+iRAND(60); + s_lock = s_happens * 3 / 2; } - else lock --; + else s_lock --; // happens = 1; - tmp = happens?8.0F:0; - *dist2 = distt2 = (tmp + 15.0F*distt2)/16.0F; + tmp = s_happens?8.0F:0; + *dist2 = s_distT2 = (tmp + 15.0F*s_distT2)/16.0F; tmp = 30+D-90.0F*(1.0F+sinf(lcycle*19/20)); - if (happens) + if (s_happens) tmp *= 0.6F; - *dist = distt = (tmp + 3.0F*distt)/4.0F; + *dist = s_distT = (tmp + 3.0F*s_distT)/4.0F; - if (!happens){ + if (!s_happens){ tmp = M_PI_F*sinf(lcycle)/32+3*M_PI_F/2; } else { - rotation = iRAND(500)?rotation:iRAND(2); - if (rotation) + s_rotation = iRAND(500)?s_rotation:iRAND(2); + if (s_rotation) lcycle *= 2.0F*M_PI_F; else lcycle *= -1.0F*M_PI_F; tmp = lcycle - (M_PI_F*2.0F) * floorf(lcycle/(M_PI_F*2.0F)); } - if (fabsf(tmp-rot) > fabsf(tmp-(rot+2.0F*M_PI_F))) { - rot = (tmp + 15.0F*(rot+2*M_PI_F)) / 16.0F; - if (rot>2.0F*M_PI_F) - rot -= 2.0F*M_PI_F; - *rotangle = rot; + if (fabsf(tmp-s_rot) > fabsf(tmp-(s_rot+2.0F*M_PI_F))) { + s_rot = (tmp + 15.0F*(s_rot+2*M_PI_F)) / 16.0F; + if (s_rot>2.0F*M_PI_F) + s_rot -= 2.0F*M_PI_F; + *rotangle = s_rot; } - else if (fabsf(tmp-rot) > fabsf(tmp-(rot-2.0F*M_PI_F))) { - rot = (tmp + 15.0F*(rot-2.0F*M_PI_F)) / 16.0F; - if (rot<0.0F) - rot += 2.0F*M_PI_F; - *rotangle = rot; + else if (fabsf(tmp-s_rot) > fabsf(tmp-(s_rot-2.0F*M_PI_F))) { + s_rot = (tmp + 15.0F*(s_rot-2.0F*M_PI_F)) / 16.0F; + if (s_rot<0.0F) + s_rot += 2.0F*M_PI_F; + *rotangle = s_rot; } else - *rotangle = rot = (tmp + 15.0F*rot) / 16.0F; + *rotangle = s_rot = (tmp + 15.0F*s_rot) / 16.0F; } void tentacle_update(int *buf, int *back, int W, int H, short data[2][512], float rapport, int drawit) { - static int colors[] = { + static int s_colors[] = { (0x18<<(ROUGE*8))|(0x4c<<(VERT*8))|(0x2f<<(BLEU*8)), (0x48<<(ROUGE*8))|(0x2c<<(VERT*8))|(0x6f<<(BLEU*8)), (0x58<<(ROUGE*8))|(0x3c<<(VERT*8))|(0x0f<<(BLEU*8))}; - static int col = (0x28<<(ROUGE*8))|(0x2c<<(VERT*8))|(0x5f<<(BLEU*8)); - static int dstcol = 0; - static float lig = 1.15F; - static float ligs = 0.1F; + static int s_col = (0x28<<(ROUGE*8))|(0x2c<<(VERT*8))|(0x5f<<(BLEU*8)); + static int s_dstCol = 0; + static float s_lig = 1.15F; + static float s_ligs = 0.1F; int color; int colorlow; float dist,dist2,rotangle; - if ((!drawit) && (ligs>0.0F)) - ligs = -ligs; + if ((!drawit) && (s_ligs>0.0F)) + s_ligs = -s_ligs; - lig += ligs; + s_lig += s_ligs; - if (lig > 1.01F) { - if ((lig>10.0F) | (lig<1.1F)) ligs = -ligs; + if (s_lig > 1.01F) { + if ((s_lig>10.0F) | (s_lig<1.1F)) s_ligs = -s_ligs; - if ((lig<6.3F)&&(iRAND(30)==0)) - dstcol=iRAND(3); + if ((s_lig<6.3F)&&(iRAND(30)==0)) + s_dstCol=iRAND(3); - col = evolutecolor(col,colors[dstcol],0xff,0x01); - col = evolutecolor(col,colors[dstcol],0xff00,0x0100); - col = evolutecolor(col,colors[dstcol],0xff0000,0x010000); - col = evolutecolor(col,colors[dstcol],0xff000000,0x01000000); + s_col = evolutecolor(s_col,s_colors[s_dstCol],0xff,0x01); + s_col = evolutecolor(s_col,s_colors[s_dstCol],0xff00,0x0100); + s_col = evolutecolor(s_col,s_colors[s_dstCol],0xff0000,0x010000); + s_col = evolutecolor(s_col,s_colors[s_dstCol],0xff000000,0x01000000); - color = col; - colorlow = col; + color = s_col; + colorlow = s_col; - lightencolor(&color,lig * 2.0F + 2.0F); - lightencolor(&colorlow,(lig/3.0F)+0.67F); + lightencolor(&color,s_lig * 2.0F + 2.0F); + lightencolor(&colorlow,(s_lig/3.0F)+0.67F); rapport = 1.0F + 2.0F * (rapport - 1.0F); rapport *= 1.2F; @@ -207,9 +207,9 @@ void tentacle_update(int *buf, int *back, int W, int H, short data[2][512], floa grid3d_draw (grille[tmp],color,colorlow,dist,buf,back,W,H); } else { - lig = 1.05F; - if (ligs < 0.0F) - ligs = -ligs; + s_lig = 1.05F; + if (s_ligs < 0.0F) + s_ligs = -s_ligs; pretty_move (cycle,&dist,&dist2,&rotangle); cycle+=0.1F; if (cycle > 1000) diff --git a/mythtv/libs/libmythtv/visualisations/videovisualcircles.cpp b/mythtv/libs/libmythtv/visualisations/videovisualcircles.cpp index 505223064d2..18fa5e0f256 100644 --- a/mythtv/libs/libmythtv/visualisations/videovisualcircles.cpp +++ b/mythtv/libs/libmythtv/visualisations/videovisualcircles.cpp @@ -12,7 +12,7 @@ void VideoVisualCircles::DrawPriv(MythPainter *painter, QPaintDevice* device) if (!painter) return; - static const QBrush nobrush(Qt::NoBrush); + static const QBrush kNobrush(Qt::NoBrush); int red = 0, green = 200; QPen pen(QColor(red, green, 0, 255)); int count = m_scale.range(); @@ -27,7 +27,7 @@ void VideoVisualCircles::DrawPriv(MythPainter *painter, QPaintDevice* device) if (mag > 1.0) { pen.setWidth((int)mag); - painter->DrawRoundRect(circ, rad, nobrush, pen, 200); + painter->DrawRoundRect(circ, rad, kNobrush, pen, 200); } circ.adjust(-m_range, -m_range, m_range, m_range); pen.setColor(QColor(red, green, 0, 255)); @@ -52,8 +52,8 @@ static class VideoVisualCirclesFactory : public VideoVisualFactory public: const QString &name(void) const override // VideoVisualFactory { - static QString name("Circles"); - return name; + static QString s_name("Circles"); + return s_name; } VideoVisual *Create(AudioPlayer *audio, diff --git a/mythtv/libs/libmythtv/visualisations/videovisualdefs.h b/mythtv/libs/libmythtv/visualisations/videovisualdefs.h index 092eae1742d..9e45e31f05c 100644 --- a/mythtv/libs/libmythtv/visualisations/videovisualdefs.h +++ b/mythtv/libs/libmythtv/visualisations/videovisualdefs.h @@ -14,8 +14,7 @@ class LogScale ~LogScale() { - if (indices) - delete [] indices; + delete [] indices; } int scale() const { return s; } @@ -29,8 +28,7 @@ class LogScale s = maxscale; r = maxrange; - if (indices) - delete [] indices; + delete [] indices; double alpha; long double domain = (long double) maxscale; diff --git a/mythtv/libs/libmythtv/visualisations/videovisualgoom.cpp b/mythtv/libs/libmythtv/visualisations/videovisualgoom.cpp index 3ccccef2642..6c9cbfe9bb1 100644 --- a/mythtv/libs/libmythtv/visualisations/videovisualgoom.cpp +++ b/mythtv/libs/libmythtv/visualisations/videovisualgoom.cpp @@ -36,7 +36,7 @@ VideoVisualGoom::~VideoVisualGoom() #ifdef USING_OPENGL if (m_glSurface && m_render && (m_render->Type() == kRenderOpenGL)) { - MythRenderOpenGL *glrender = static_cast<MythRenderOpenGL*>(m_render); + auto *glrender = static_cast<MythRenderOpenGL*>(m_render); if (glrender) glrender->DeleteTexture(m_glSurface); m_glSurface = nullptr; @@ -81,7 +81,7 @@ void VideoVisualGoom::Draw(const QRect &area, MythPainter */*painter*/, #ifdef USING_OPENGL if ((m_render->Type() == kRenderOpenGL)) { - MythRenderOpenGL *glrender = dynamic_cast<MythRenderOpenGL*>(m_render); + auto *glrender = dynamic_cast<MythRenderOpenGL*>(m_render); if (glrender && m_buffer) { glrender->makeCurrent(); @@ -115,8 +115,8 @@ static class VideoVisualGoomFactory : public VideoVisualFactory public: const QString &name(void) const override // VideoVisualFactory { - static QString name("Goom"); - return name; + static QString s_name("Goom"); + return s_name; } VideoVisual *Create(AudioPlayer *audio, @@ -136,8 +136,8 @@ static class VideoVisualGoomHDFactory : public VideoVisualFactory public: const QString &name(void) const override // VideoVisualFactory { - static QString name("Goom HD"); - return name; + static QString s_name("Goom HD"); + return s_name; } VideoVisual *Create(AudioPlayer *audio, diff --git a/mythtv/libs/libmythtv/visualisations/videovisualspectrum.cpp b/mythtv/libs/libmythtv/visualisations/videovisualspectrum.cpp index eb5ca859bca..f55ac9fa1a2 100644 --- a/mythtv/libs/libmythtv/visualisations/videovisualspectrum.cpp +++ b/mythtv/libs/libmythtv/visualisations/videovisualspectrum.cpp @@ -135,8 +135,8 @@ void VideoVisualSpectrum::prepare(void) void VideoVisualSpectrum::DrawPriv(MythPainter *painter, QPaintDevice* device) { - static const QBrush brush(QColor(0, 0, 200, 180)); - static const QPen pen(QColor(255, 255, 255, 255)); + static const QBrush kBrush(QColor(0, 0, 200, 180)); + static const QPen kPen(QColor(255, 255, 255, 255)); double range = m_area.height() / 2.0; int count = m_scale.range(); painter->Begin(device); @@ -145,7 +145,7 @@ void VideoVisualSpectrum::DrawPriv(MythPainter *painter, QPaintDevice* device) m_rects[i].setTop(range - int(m_magnitudes[i])); m_rects[i].setBottom(range + int(m_magnitudes[i + count])); if (m_rects[i].height() > 4) - painter->DrawRect(m_rects[i], brush, pen, 255); + painter->DrawRect(m_rects[i], kBrush, kPen, 255); } painter->End(); } @@ -190,8 +190,8 @@ static class VideoVisualSpectrumFactory : public VideoVisualFactory public: const QString &name(void) const override // VideoVisualFactory { - static QString name("Spectrum"); - return name; + static QString s_name("Spectrum"); + return s_name; } VideoVisual *Create(AudioPlayer *audio, diff --git a/mythtv/libs/libmythtv/vsync.cpp b/mythtv/libs/libmythtv/vsync.cpp index 3edbf679fb5..0642c590c89 100644 --- a/mythtv/libs/libmythtv/vsync.cpp +++ b/mythtv/libs/libmythtv/vsync.cpp @@ -166,22 +166,22 @@ int VideoSync::CalcDelay(int nominal_frame_interval) #define DRM_VBLANK_RELATIVE 0x1; struct drm_wait_vblank_request { - int type; - unsigned int sequence; - unsigned long signal; + int m_type; + unsigned int m_sequence; + unsigned long m_signal; }; struct drm_wait_vblank_reply { - int type; - unsigned int sequence; - long tval_sec; - long tval_usec; + int m_type; + unsigned int m_sequence; + long m_tvalSec; + long m_tvalUsec; }; -typedef union drm_wait_vblank { - struct drm_wait_vblank_request request; - struct drm_wait_vblank_reply reply; -} drm_wait_vblank_t; +using drm_wait_vblank_t = union drm_wait_vblank { + struct drm_wait_vblank_request m_request; + struct drm_wait_vblank_reply m_reply; +}; #define DRM_IOCTL_BASE 'd' #define DRM_IOWR(nr,type) _IOWR(DRM_IOCTL_BASE,nr,type) @@ -194,7 +194,7 @@ static int drmWaitVBlank(int fd, drm_wait_vblank_t *vbl) do { ret = ioctl(fd, DRM_IOCTL_WAIT_VBLANK, vbl); - vbl->request.type &= ~DRM_VBLANK_RELATIVE; + vbl->m_request.m_type &= ~DRM_VBLANK_RELATIVE; } while (ret && errno == EINTR); return ret; @@ -228,8 +228,8 @@ bool DRMVideoSync::TryInit(void) return false; // couldn't open device } - blank.request.type = DRM_VBLANK_RELATIVE; - blank.request.sequence = 1; + blank.m_request.m_type = DRM_VBLANK_RELATIVE; + blank.m_request.m_sequence = 1; if (drmWaitVBlank(m_dri_fd, &blank)) { LOG(VB_PLAYBACK, LOG_ERR, LOC + @@ -245,8 +245,8 @@ void DRMVideoSync::Start(void) { // Wait for a refresh so we start out synched drm_wait_vblank_t blank; - blank.request.type = DRM_VBLANK_RELATIVE; - blank.request.sequence = 1; + blank.m_request.m_type = DRM_VBLANK_RELATIVE; + blank.m_request.m_sequence = 1; drmWaitVBlank(m_dri_fd, &blank); VideoSync::Start(); } @@ -265,8 +265,8 @@ int DRMVideoSync::WaitForFrame(int nominal_frame_interval, int extra_delay) if (m_delay > -(m_refresh_interval/2)) { drm_wait_vblank_t blank; - blank.request.type = DRM_VBLANK_RELATIVE; - blank.request.sequence = 1; + blank.m_request.m_type = DRM_VBLANK_RELATIVE; + blank.m_request.m_sequence = 1; drmWaitVBlank(m_dri_fd, &blank); m_delay = CalcDelay(nominal_frame_interval); #if 0 @@ -280,8 +280,8 @@ int DRMVideoSync::WaitForFrame(int nominal_frame_interval, int extra_delay) int n = (m_delay + m_refresh_interval - 1) / m_refresh_interval; drm_wait_vblank_t blank; - blank.request.type = DRM_VBLANK_RELATIVE; - blank.request.sequence = n; + blank.m_request.m_type = DRM_VBLANK_RELATIVE; + blank.m_request.m_sequence = n; drmWaitVBlank(m_dri_fd, &blank); m_delay = CalcDelay(nominal_frame_interval); #if 0 diff --git a/mythtv/libs/libmythtv/vsync.h b/mythtv/libs/libmythtv/vsync.h index 93f6ba9bd24..7703cc1e61f 100644 --- a/mythtv/libs/libmythtv/vsync.h +++ b/mythtv/libs/libmythtv/vsync.h @@ -92,7 +92,7 @@ class VideoSync static VideoSync *BestMethod(MythVideoOutput *, uint refresh_interval); protected: - int64_t GetTime(void); + static int64_t GetTime(void); int CalcDelay(int nominal_frame_interval); MythVideoOutput *m_video_output {nullptr}; diff --git a/mythtv/libs/libmythtv/xine_demux_sputext.cpp b/mythtv/libs/libmythtv/xine_demux_sputext.cpp index 87e8a2d35bd..a4f4d2a994a 100644 --- a/mythtv/libs/libmythtv/xine_demux_sputext.cpp +++ b/mythtv/libs/libmythtv/xine_demux_sputext.cpp @@ -142,8 +142,8 @@ static char *read_line_from_input(demux_sputext_t *demuxstr, char *line, off_t l static subtitle_t *sub_read_line_sami(demux_sputext_t *demuxstr, subtitle_t *current) { - static char line[LINE_LEN + 1]; - static char *s = nullptr; + static char s_line[LINE_LEN + 1]; + static char *s_s = nullptr; char text[LINE_LEN + 1], *p, *q; int state; @@ -153,44 +153,44 @@ static subtitle_t *sub_read_line_sami(demux_sputext_t *demuxstr, subtitle_t *cur state = 0; /* read the first line */ - if (!s) - if (!(s = read_line_from_input(demuxstr, line, LINE_LEN))) return nullptr; + if (!s_s) + if (!(s_s = read_line_from_input(demuxstr, s_line, LINE_LEN))) return nullptr; do { switch (state) { case 0: /* find "START=" */ - s = strstr (s, "Start="); - if (s) { - current->start = strtol (s + 6, &s, 0) / 10; + s_s = strstr (s_s, "Start="); + if (s_s) { + current->start = strtol (s_s + 6, &s_s, 0) / 10; state = 1; continue; } break; case 1: /* find "<P" */ - if ((s = strstr (s, "<P"))) { s += 2; state = 2; continue; } + if ((s_s = strstr (s_s, "<P"))) { s_s += 2; state = 2; continue; } break; case 2: /* find ">" */ - if ((s = strchr (s, '>'))) { s++; state = 3; p = text; continue; } + if ((s_s = strchr (s_s, '>'))) { s_s++; state = 3; p = text; continue; } break; case 3: /* get all text until '<' appears */ - if (*s == '\0') { break; } - else if (*s == '<') { state = 4; } - else if (strncasecmp (s, " ", 6) == 0) { *p++ = ' '; s += 6; } - else if (*s == '\r') { s++; } - else if (strncasecmp (s, "<br>", 4) == 0 || *s == '\n') { + if (*s_s == '\0') { break; } + else if (*s_s == '<') { state = 4; } + else if (strncasecmp (s_s, " ", 6) == 0) { *p++ = ' '; s_s += 6; } + else if (*s_s == '\r') { s_s++; } + else if (strncasecmp (s_s, "<br>", 4) == 0 || *s_s == '\n') { *p = '\0'; p = text; trail_space (text); if (text[0] != '\0') current->text[current->lines++] = strdup (text); - if (*s == '\n') s++; else s += 4; + if (*s_s == '\n') s_s++; else s_s += 4; } - else *p++ = *s++; + else *p++ = *s_s++; continue; case 4: /* get current->end or skip <TAG> */ - q = strstr (s, "Start="); + q = strstr (s_s, "Start="); if (q) { current->end = strtol (q + 6, &q, 0) / 10 - 1; *p = '\0'; trail_space (text); @@ -199,13 +199,13 @@ static subtitle_t *sub_read_line_sami(demux_sputext_t *demuxstr, subtitle_t *cur if (current->lines > 0) { state = 99; break; } state = 0; continue; } - s = strchr (s, '>'); - if (s) { s++; state = 3; continue; } + s_s = strchr (s_s, '>'); + if (s_s) { s_s++; state = 3; continue; } break; } /* read next line */ - if (state != 99 && !(s = read_line_from_input (demuxstr, line, LINE_LEN))) + if (state != 99 && !(s_s = read_line_from_input (demuxstr, s_line, LINE_LEN))) return nullptr; } while (state != 99); @@ -510,7 +510,7 @@ static subtitle_t *sub_read_line_rt(demux_sputext_t *demuxstr,subtitle_t *curren static subtitle_t *sub_read_line_ssa(demux_sputext_t *demuxstr,subtitle_t *current) { int comma; - static int max_comma = 32; /* let's use 32 for the case that the */ + static int s_maxComma = 32; /* let's use 32 for the case that the */ /* amount of commas increase with newer SSA versions */ int hour1, min1, sec1, hunsec1, hour2, min2, sec2, hunsec2, nothing; @@ -536,7 +536,7 @@ static subtitle_t *sub_read_line_ssa(demux_sputext_t *demuxstr,subtitle_t *curre if (!line2) return nullptr; - for (comma = 4; comma < max_comma; comma ++) + for (comma = 4; comma < s_maxComma; comma ++) { tmp = line2; if(!(tmp=strchr(++tmp, ','))) break; @@ -545,7 +545,7 @@ static subtitle_t *sub_read_line_ssa(demux_sputext_t *demuxstr,subtitle_t *curre line2 = tmp; } - if(comma < max_comma)max_comma = comma; + if(comma < s_maxComma)s_maxComma = comma; /* eliminate the trailing comma */ if(*line2 == ',') line2++; @@ -700,8 +700,8 @@ static subtitle_t *sub_read_line_aqt (demux_sputext_t *demuxstr, subtitle_t *cur static subtitle_t *sub_read_line_jacobsub(demux_sputext_t *demuxstr, subtitle_t *current) { char line1[LINE_LEN+1], line2[LINE_LEN+1], directive[LINE_LEN+1], *p, *q; unsigned a1, a2, a3, a4, b1, b2, b3, b4, comment = 0; - static unsigned jacoTimeres = 30; - static int jacoShift = 0; + static unsigned s_jacoTimeRes = 30; + static int s_jacoShift = 0; memset(current, 0, sizeof(subtitle_t)); memset(line1, 0, LINE_LEN+1); @@ -717,7 +717,7 @@ static subtitle_t *sub_read_line_jacobsub(demux_sputext_t *demuxstr, subtitle_t if (sscanf(line1, "@%u @%u %" LINE_LEN_QUOT "[^\n\r]", &a4, &b4, line2) < 3) { if (line1[0] == '#') { int hours = 0, minutes = 0, seconds, delta; - unsigned units = jacoShift; + unsigned units = s_jacoShift; int inverter = 1; switch (toupper(line1[1])) { case 'S': @@ -749,9 +749,9 @@ static subtitle_t *sub_read_line_jacobsub(demux_sputext_t *demuxstr, subtitle_t &units); seconds *= inverter; } - jacoShift = + s_jacoShift = ((hours * 3600 + minutes * 60 + - seconds) * jacoTimeres + + seconds) * s_jacoTimeRes + units) * inverter; } break; @@ -761,27 +761,27 @@ static subtitle_t *sub_read_line_jacobsub(demux_sputext_t *demuxstr, subtitle_t } else { delta = 2; } - sscanf(&line1[delta], "%u", &jacoTimeres); + sscanf(&line1[delta], "%u", &s_jacoTimeRes); break; } } continue; } current->start = - (unsigned long) ((a4 + jacoShift) * 100.0 / - jacoTimeres); + (unsigned long) ((a4 + s_jacoShift) * 100.0 / + s_jacoTimeRes); current->end = - (unsigned long) ((b4 + jacoShift) * 100.0 / - jacoTimeres); + (unsigned long) ((b4 + s_jacoShift) * 100.0 / + s_jacoTimeRes); } else { current->start = (unsigned - long) (((a1 * 3600 + a2 * 60 + a3) * jacoTimeres + a4 + - jacoShift) * 100.0 / jacoTimeres); + long) (((a1 * 3600 + a2 * 60 + a3) * s_jacoTimeRes + a4 + + s_jacoShift) * 100.0 / s_jacoTimeRes); current->end = (unsigned - long) (((b1 * 3600 + b2 * 60 + b3) * jacoTimeres + b4 + - jacoShift) * 100.0 / jacoTimeres); + long) (((b1 * 3600 + b2 * 60 + b3) * s_jacoTimeRes + b4 + + s_jacoShift) * 100.0 / s_jacoTimeRes); } current->lines = 0; p = line2; @@ -1145,7 +1145,7 @@ subtitle_t *sub_read_file (demux_sputext_t *demuxstr) { if(demuxstr->num>=n_max){ n_max+=16; - subtitle_t *new_first=(subtitle_t *)realloc(first,n_max*sizeof(subtitle_t)); + auto *new_first=(subtitle_t *)realloc(first,n_max*sizeof(subtitle_t)); if (new_first == nullptr) { free(first); return nullptr; diff --git a/mythtv/libs/libmythtv/xine_demux_sputext.h b/mythtv/libs/libmythtv/xine_demux_sputext.h index 28420b375b6..fb75857e1c3 100644 --- a/mythtv/libs/libmythtv/xine_demux_sputext.h +++ b/mythtv/libs/libmythtv/xine_demux_sputext.h @@ -9,7 +9,7 @@ #define DEBUG_XINE_DEMUX_SPUTEXT 0 -typedef struct { +struct subtitle_t { int lines; ///< Count of text lines in this subtitle set. @@ -17,9 +17,9 @@ typedef struct { long end; ///< Ending time in msec or starting frame char *text[SUB_MAX_TEXT]; ///< The subtitle text lines. -} subtitle_t; +}; -typedef struct { +struct demux_sputext_t { char *rbuffer_text; off_t rbuffer_len; @@ -41,7 +41,7 @@ typedef struct { int format; /* constants see below */ char next_line[SUB_BUFSIZE]; /* a buffer for next line read from file */ -} demux_sputext_t; +}; subtitle_t *sub_read_file (demux_sputext_t*); diff --git a/mythtv/libs/libmythui/AppleRemote.cpp b/mythtv/libs/libmythui/AppleRemote.cpp index eb617eec602..f5cfc157fb0 100644 --- a/mythtv/libs/libmythui/AppleRemote.cpp +++ b/mythtv/libs/libmythui/AppleRemote.cpp @@ -33,14 +33,14 @@ AppleRemote* AppleRemote::_instance = nullptr; #define LOC QString("AppleRemote::") -typedef struct _ATV_IR_EVENT +struct ATV_IR_EVENT { UInt32 time_ms32; UInt32 time_ls32; // units of microsecond UInt32 unknown1; UInt32 keycode; UInt32 unknown2; -} ATV_IR_EVENT; +}; static io_object_t _findAppleRemoteDevice(const char *devName); diff --git a/mythtv/libs/libmythui/DisplayResScreen.cpp b/mythtv/libs/libmythui/DisplayResScreen.cpp index a6fe874bccb..44ffc8c015d 100644 --- a/mythtv/libs/libmythui/DisplayResScreen.cpp +++ b/mythtv/libs/libmythui/DisplayResScreen.cpp @@ -139,10 +139,10 @@ int DisplayResScreen::FindBestMatch(const DisplayResVector& dsr, { while (!end) { - for (double precision = 0.001; - precision < 1.0; - precision *= 10.0) + double precisions1[] = {0.001, 0.01, 0.1}; + for (uint p = 0; p < sizeof(precisions1); p++) { + double precision = precisions1[p]; for (size_t j=0; j < rates.size(); ++j) { // Multiple of target_rate will do @@ -158,10 +158,10 @@ int DisplayResScreen::FindBestMatch(const DisplayResVector& dsr, } // Can't find exact frame rate, so try rounding to the // nearest integer, so 23.97Hz will work with 24Hz etc - for (double precision = 0.01; - precision < 2.0; - precision *= 10.0) + double precisions2[] = {0.01, 0.1, 1}; + for (uint p = 0; p < sizeof(precisions2); p++) { + double precision = precisions2[p]; double rounded = round(videorate); for (size_t j=0; j < rates.size(); ++j) { diff --git a/mythtv/libs/libmythui/DisplayResScreen.h b/mythtv/libs/libmythui/DisplayResScreen.h index d329a438a8b..9b1c4883404 100644 --- a/mythtv/libs/libmythui/DisplayResScreen.h +++ b/mythtv/libs/libmythui/DisplayResScreen.h @@ -12,13 +12,13 @@ class DisplayResScreen; -typedef std::vector<DisplayResScreen> DisplayResVector; -typedef DisplayResVector::iterator DisplayResVectorIt; -typedef DisplayResVector::const_iterator DisplayResVectorCIt; +using DisplayResVector = std::vector<DisplayResScreen>; +using DisplayResVectorIt = DisplayResVector::iterator; +using DisplayResVectorCIt = DisplayResVector::const_iterator; -typedef std::map<uint64_t, DisplayResScreen> DisplayResMap; -typedef DisplayResMap::iterator DisplayResMapIt; -typedef DisplayResMap::const_iterator DisplayResMapCIt; +using DisplayResMap = std::map<uint64_t, DisplayResScreen>; +using DisplayResMapIt = DisplayResMap::iterator; +using DisplayResMapCIt = DisplayResMap::const_iterator; class MUI_PUBLIC DisplayResScreen { diff --git a/mythtv/libs/libmythui/cecadapter.cpp b/mythtv/libs/libmythui/cecadapter.cpp index f902b00e2cc..2f37627769b 100644 --- a/mythtv/libs/libmythui/cecadapter.cpp +++ b/mythtv/libs/libmythui/cecadapter.cpp @@ -154,7 +154,7 @@ class CECAdapterPriv // find adapters #if CEC_LIB_VERSION_MAJOR >= 4 - cec_adapter_descriptor *devices = new cec_adapter_descriptor[MAX_CEC_DEVICES]; + auto *devices = new cec_adapter_descriptor[MAX_CEC_DEVICES]; uint8_t num_devices = m_adapter->DetectAdapters(devices, MAX_CEC_DEVICES, nullptr, true); #else cec_adapter *devices = new cec_adapter[MAX_CEC_DEVICES]; @@ -665,7 +665,7 @@ class CECAdapterPriv return 1; MythUIHelper::ResetScreensaver(); - QKeyEvent* ke = new QKeyEvent(QEvent::KeyPress, action, modifier); + auto* ke = new QKeyEvent(QEvent::KeyPress, action, modifier); qApp->postEvent(GetMythMainWindow(), (QEvent*)ke); return 1; @@ -1000,7 +1000,7 @@ class CECAdapterPriv return; MythUIHelper::ResetScreensaver(); - QKeyEvent* ke = new QKeyEvent(QEvent::KeyPress, action, Qt::NoModifier); + auto* ke = new QKeyEvent(QEvent::KeyPress, action, Qt::NoModifier); qApp->postEvent(GetMythMainWindow(), (QEvent*)ke); } diff --git a/mythtv/libs/libmythui/jsmenu.h b/mythtv/libs/libmythui/jsmenu.h index e856139a2de..fc06e1ab31b 100644 --- a/mythtv/libs/libmythui/jsmenu.h +++ b/mythtv/libs/libmythui/jsmenu.h @@ -15,20 +15,20 @@ // MythTV headers #include "mthread.h" -typedef struct +struct buttonMapType { int button; QString keystring; int chord; -} buttonMapType; +}; -typedef struct +struct axisMapType { int axis; int from; int to; QString keystring; -} axisMapType; +}; /** * \class JoystickMap @@ -62,8 +62,8 @@ class JoystickMap m_axisMap.push_back(new_axis); } - typedef std::vector<buttonMapType> button_map_t; - typedef std::vector<axisMapType> axis_map_t; + using button_map_t = std::vector<buttonMapType>; + using axis_map_t = std::vector<axisMapType>; const button_map_t &buttonMap() const { return m_buttonMap; } const axis_map_t &axisMap() const { return m_axisMap; } diff --git a/mythtv/libs/libmythui/lirc.cpp b/mythtv/libs/libmythui/lirc.cpp index 9e210c5a5ec..177ae923672 100644 --- a/mythtv/libs/libmythui/lirc.cpp +++ b/mythtv/libs/libmythui/lirc.cpp @@ -339,14 +339,14 @@ bool LIRC::IsDoRunSet(void) const return doRun; } -void LIRC::Process(const QByteArray &data) +void LIRC::Process(QByteArray &data) { QMutexLocker static_lock(&lirclib_lock); // lirc_code2char will make code point to a static datafer.. char *code = nullptr; int ret = lirc_code2char( - d->m_lircState, d->m_lircConfig, const_cast<char*>(data.constData()), &code); + d->m_lircState, d->m_lircConfig, data.data(), &code); while ((0 == ret) && code) { @@ -401,7 +401,7 @@ void LIRC::Process(const QByteArray &data) QCoreApplication::postEvent(m_mainWindow, keyReleases[i]); ret = lirc_code2char( - d->m_lircState, d->m_lircConfig, const_cast<char*>(data.constData()), &code); + d->m_lircState, d->m_lircConfig, data.data(), &code); } } diff --git a/mythtv/libs/libmythui/lirc.h b/mythtv/libs/libmythui/lirc.h index e8067ca9295..22692447a6e 100644 --- a/mythtv/libs/libmythui/lirc.h +++ b/mythtv/libs/libmythui/lirc.h @@ -41,7 +41,7 @@ class LIRC : public QObject, public MThread bool IsDoRunSet(void) const; void run(void) override; // MThread QList<QByteArray> GetCodes(void); - void Process(const QByteArray &data); + void Process(QByteArray &data); mutable QMutex lock; static QMutex lirclib_lock; diff --git a/mythtv/libs/libmythui/lirc_client.c b/mythtv/libs/libmythui/lirc_client.c index 7f900f61c9a..d5c9a90654d 100644 --- a/mythtv/libs/libmythui/lirc_client.c +++ b/mythtv/libs/libmythui/lirc_client.c @@ -42,10 +42,10 @@ /* internal data structures */ struct filestack_t { - FILE *file; - char *name; - int line; - struct filestack_t *parent; + FILE *m_file; + char *m_name; + int m_line; + struct filestack_t *m_parent; }; enum packet_state @@ -805,10 +805,10 @@ static struct filestack_t *stack_push(const struct lirc_state *state, struct fil lirc_printf(state, "%s: out of memory\n",state->lirc_prog); return NULL; } - entry->file = NULL; - entry->name = NULL; - entry->line = 0; - entry->parent = parent; + entry->m_file = NULL; + entry->m_name = NULL; + entry->m_line = 0; + entry->m_parent = parent; return entry; } @@ -817,9 +817,9 @@ static struct filestack_t *stack_pop(struct filestack_t *entry) struct filestack_t *parent = NULL; if (entry) { - parent = entry->parent; - if (entry->name) - free(entry->name); + parent = entry->m_parent; + if (entry->m_name) + free(entry->m_name); free(entry); } return parent; @@ -965,13 +965,13 @@ static int lirc_readconfig_only_internal(const struct lirc_state *state, { return -1; } - filestack->file = lirc_open(state, file, NULL, &(filestack->name)); - if (filestack->file == NULL) + filestack->m_file = lirc_open(state, file, NULL, &(filestack->m_name)); + if (filestack->m_file == NULL) { stack_free(filestack); return -1; } - filestack->line = 0; + filestack->m_line = 0; int open_files = 1; struct lirc_config_entry *new_entry = NULL; @@ -981,14 +981,14 @@ static int lirc_readconfig_only_internal(const struct lirc_state *state, char *remote=LIRC_ALL; while (filestack) { - if((ret=lirc_readline(state,&string,filestack->file))==-1 || + if((ret=lirc_readline(state,&string,filestack->m_file))==-1 || string==NULL) { - fclose(filestack->file); + fclose(filestack->m_file); if(open_files == 1 && full_name != NULL) { - save_full_name = filestack->name; - filestack->name = NULL; + save_full_name = filestack->m_name; + filestack->m_name = NULL; } filestack = stack_pop(filestack); open_files--; @@ -1011,7 +1011,7 @@ static int lirc_readconfig_only_internal(const struct lirc_state *state, } } } - filestack->line++; + filestack->m_line++; char *eq=strchr(string,'='); if(eq==NULL) { @@ -1027,8 +1027,8 @@ static int lirc_readconfig_only_internal(const struct lirc_state *state, lirc_printf(state, "%s: too many files " "included at %s:%d\n", state->lirc_prog, - filestack->name, - filestack->line); + filestack->m_name, + filestack->m_line); ret=-1; } else @@ -1036,8 +1036,8 @@ static int lirc_readconfig_only_internal(const struct lirc_state *state, token2 = strtok_r(NULL, "", &strtok_state); token2 = lirc_trim(token2); lirc_parse_include - (token2, filestack->name, - filestack->line); + (token2, filestack->m_name, + filestack->m_line); struct filestack_t *stack_tmp = stack_push(state, filestack); if (stack_tmp == NULL) @@ -1046,9 +1046,9 @@ static int lirc_readconfig_only_internal(const struct lirc_state *state, } else { - stack_tmp->file = lirc_open(state, token2, filestack->name, &(stack_tmp->name)); - stack_tmp->line = 0; - if (stack_tmp->file) + stack_tmp->m_file = lirc_open(state, token2, filestack->m_name, &(stack_tmp->m_name)); + stack_tmp->m_line = 0; + if (stack_tmp->m_file) { open_files++; filestack = stack_tmp; @@ -1069,15 +1069,15 @@ static int lirc_readconfig_only_internal(const struct lirc_state *state, (token3=strtok_r(NULL," \t",&strtok_state))!=NULL) { lirc_printf(state, "%s: unexpected token in line %s:%d\n", - state->lirc_prog,filestack->name,filestack->line); + state->lirc_prog,filestack->m_name,filestack->m_line); } else { ret=lirc_mode(state, token,token2,&mode, &new_entry,&first,&last, check, - filestack->name, - filestack->line); + filestack->m_name, + filestack->m_line); if(ret==0) { if(remote!=LIRC_ALL) @@ -1113,7 +1113,7 @@ static int lirc_readconfig_only_internal(const struct lirc_state *state, else if(new_entry==NULL) { lirc_printf(state, "%s: bad file format, %s:%d\n", - state->lirc_prog,filestack->name,filestack->line); + state->lirc_prog,filestack->m_name,filestack->m_line); ret=-1; } else @@ -1242,7 +1242,7 @@ static int lirc_readconfig_only_internal(const struct lirc_state *state, } else { - lirc_parse_string(state,token2,filestack->name,filestack->line); + lirc_parse_string(state,token2,filestack->m_name,filestack->m_line); new_list->string=token2; new_list->next=NULL; if(new_entry->config==NULL) @@ -1271,7 +1271,7 @@ static int lirc_readconfig_only_internal(const struct lirc_state *state, { free(token2); lirc_printf(state, "%s: unknown token \"%s\" in %s:%d ignored\n", - state->lirc_prog,token,filestack->name,filestack->line); + state->lirc_prog,token,filestack->m_name,filestack->m_line); } } } @@ -1632,19 +1632,19 @@ int lirc_code2char(const struct lirc_state *state, struct lirc_config *config,ch char* command = malloc((10+strlen(code)+1+1) * sizeof(char)); if (command == NULL) return LIRC_RET_ERROR; - static char buf[LIRC_PACKET_SIZE]; + static char s_buf[LIRC_PACKET_SIZE]; size_t buf_len = LIRC_PACKET_SIZE; int success = LIRC_RET_ERROR; sprintf(command, "CODE %s\n", code); int ret = lirc_send_command(state, config->sockfd, command, - buf, &buf_len, &success); + s_buf, &buf_len, &success); if(success == LIRC_RET_SUCCESS) { if(ret > 0) { - *string = buf; + *string = s_buf; } else { @@ -1770,14 +1770,14 @@ char *lirc_nextir(struct lirc_state *state) int lirc_nextcode(struct lirc_state *state, char **code) { - static int packet_size=PACKET_SIZE; - static int end_len=0; + static int s_packetSize=PACKET_SIZE; + static int s_endLen=0; char *end = NULL, c = '\0'; *code=NULL; if(state->lirc_buffer==NULL) { - state->lirc_buffer=(char *) malloc(packet_size+1); + state->lirc_buffer=(char *) malloc(s_packetSize+1); if(state->lirc_buffer==NULL) { lirc_printf(state, "%s: out of memory\n",state->lirc_prog); @@ -1787,24 +1787,24 @@ int lirc_nextcode(struct lirc_state *state, char **code) } while((end=strchr(state->lirc_buffer,'\n'))==NULL) { - if(end_len>=packet_size) + if(s_endLen>=s_packetSize) { - packet_size+=PACKET_SIZE; - char *new_buffer=(char *) realloc(state->lirc_buffer,packet_size+1); + s_packetSize+=PACKET_SIZE; + char *new_buffer=(char *) realloc(state->lirc_buffer,s_packetSize+1); if(new_buffer==NULL) { return(-1); } state->lirc_buffer=new_buffer; } - ssize_t len=read(state->lirc_lircd,state->lirc_buffer+end_len,packet_size-end_len); + ssize_t len=read(state->lirc_lircd,state->lirc_buffer+s_endLen,s_packetSize-s_endLen); if(len<=0) { if(len==-1 && errno==EAGAIN) return(0); return(-1); } - end_len+=len; - state->lirc_buffer[end_len]=0; + s_endLen+=len; + state->lirc_buffer[s_endLen]=0; /* return if next code not yet available completely */ if(strchr(state->lirc_buffer,'\n')==NULL) { @@ -1820,12 +1820,12 @@ int lirc_nextcode(struct lirc_state *state, char **code) // // cppcheck-suppress nullPointerArithmeticRedundantCheck end++; - end_len=strlen(end); + s_endLen=strlen(end); c=end[0]; end[0]=0; *code=strdup(state->lirc_buffer); end[0]=c; - memmove(state->lirc_buffer,end,end_len+1); + memmove(state->lirc_buffer,end,s_endLen+1); if(*code==NULL) return(-1); return(0); } @@ -1844,17 +1844,17 @@ const char *lirc_getmode(const struct lirc_state *state, struct lirc_config *con { if(config->sockfd!=-1) { - static char buf[LIRC_PACKET_SIZE]; + static char s_buf[LIRC_PACKET_SIZE]; size_t buf_len = LIRC_PACKET_SIZE; int success = LIRC_RET_ERROR; int ret = lirc_send_command(state, config->sockfd, "GETMODE\n", - buf, &buf_len, &success); + s_buf, &buf_len, &success); if(success == LIRC_RET_SUCCESS) { if(ret > 0) { - return buf; + return s_buf; } return NULL; } @@ -1867,7 +1867,7 @@ const char *lirc_setmode(const struct lirc_state *state, struct lirc_config *con { if(config->sockfd!=-1) { - static char buf[LIRC_PACKET_SIZE]; + static char s_buf[LIRC_PACKET_SIZE]; size_t buf_len = LIRC_PACKET_SIZE; int success = LIRC_RET_ERROR; char cmd[LIRC_PACKET_SIZE]; @@ -1880,12 +1880,12 @@ const char *lirc_setmode(const struct lirc_state *state, struct lirc_config *con } int ret = lirc_send_command(state, config->sockfd, cmd, - buf, &buf_len, &success); + s_buf, &buf_len, &success); if(success == LIRC_RET_SUCCESS) { if(ret > 0) { - return buf; + return s_buf; } return NULL; } @@ -1899,26 +1899,26 @@ const char *lirc_setmode(const struct lirc_state *state, struct lirc_config *con static const char *lirc_read_string(const struct lirc_state *state, int fd) { - static char buffer[LIRC_PACKET_SIZE+1]=""; + static char s_buffer[LIRC_PACKET_SIZE+1]=""; char *end = NULL; - static size_t head=0, tail=0; + static size_t s_head=0, s_tail=0; int ret = 0; ssize_t n = 0; fd_set fds; struct timeval tv; - if(head>0) + if(s_head>0) { - memmove(buffer,buffer+head,tail-head+1); - tail-=head; - head=0; - end=strchr(buffer,'\n'); + memmove(s_buffer,s_buffer+s_head,s_tail-s_head+1); + s_tail-=s_head; + s_head=0; + end=strchr(s_buffer,'\n'); } else { end=NULL; } - if(strlen(buffer)!=tail) + if(strlen(s_buffer)!=s_tail) { lirc_printf(state, "%s: protocol error\n", state->lirc_prog); goto lirc_read_string_error; @@ -1926,7 +1926,7 @@ static const char *lirc_read_string(const struct lirc_state *state, int fd) while(end==NULL) { - if(LIRC_PACKET_SIZE<=tail) + if(LIRC_PACKET_SIZE<=s_tail) { lirc_printf(state, "%s: bad packet\n", state->lirc_prog); goto lirc_read_string_error; @@ -1953,25 +1953,25 @@ static const char *lirc_read_string(const struct lirc_state *state, int fd) goto lirc_read_string_error; } - n=read(fd, buffer+tail, LIRC_PACKET_SIZE-tail); + n=read(fd, s_buffer+s_tail, LIRC_PACKET_SIZE-s_tail); if(n<=0) { lirc_printf(state, "%s: read() failed\n", state->lirc_prog); lirc_perror(state, state->lirc_prog); goto lirc_read_string_error; } - buffer[tail+n]=0; - tail+=n; - end=strchr(buffer,'\n'); + s_buffer[s_tail+n]=0; + s_tail+=n; + end=strchr(s_buffer,'\n'); } end[0]=0; - head=strlen(buffer)+1; - return(buffer); + s_head=strlen(s_buffer)+1; + return(s_buffer); lirc_read_string_error: - head=tail=0; - buffer[0]=0; + s_head=s_tail=0; + s_buffer[0]=0; return(NULL); } diff --git a/mythtv/libs/libmythui/mythdialogbox.cpp b/mythtv/libs/libmythui/mythdialogbox.cpp index e84b0caad49..38536354c64 100644 --- a/mythtv/libs/libmythui/mythdialogbox.cpp +++ b/mythtv/libs/libmythui/mythdialogbox.cpp @@ -54,20 +54,20 @@ MythMenu::~MythMenu(void) void MythMenu::AddItem(const QString& title, const char* slot, MythMenu *subMenu, bool selected, bool checked) { - MythMenuItem *item = new MythMenuItem(title, slot, checked, subMenu); + auto *item = new MythMenuItem(title, slot, checked, subMenu); AddItem(item, selected, subMenu); } void MythMenu::AddItem(const QString &title, QVariant data, MythMenu *subMenu, bool selected, bool checked) { - MythMenuItem *item = new MythMenuItem(title, std::move(data), checked, subMenu); + auto *item = new MythMenuItem(title, std::move(data), checked, subMenu); AddItem(item, selected, subMenu); } void MythMenu::AddItem(const QString &title, const MythUIButtonCallback &slot, MythMenu *subMenu, bool selected, bool checked) { - MythMenuItem *item = new MythMenuItem(title, slot, checked, subMenu); + auto *item = new MythMenuItem(title, slot, checked, subMenu); AddItem(item, selected, subMenu); } @@ -194,7 +194,7 @@ void MythDialogBox::updateMenu(void) for (int x = 0; x < m_currentMenu->m_menuItems.count(); x++) { MythMenuItem *menuItem = m_currentMenu->m_menuItems.at(x); - MythUIButtonListItem *button = new MythUIButtonListItem(m_buttonList, menuItem->m_text); + auto *button = new MythUIButtonListItem(m_buttonList, menuItem->m_text); button->SetData(qVariantFromValue(menuItem)); button->setDrawArrow((menuItem->m_subMenu != nullptr)); @@ -214,7 +214,7 @@ void MythDialogBox::Select(MythUIButtonListItem* item) if (m_currentMenu) { - MythMenuItem *menuItem = item->GetData().value< MythMenuItem * >(); + auto *menuItem = item->GetData().value< MythMenuItem * >(); if (menuItem->m_subMenu) { @@ -299,7 +299,7 @@ void MythDialogBox::SetText(const QString &text) void MythDialogBox::AddButton(const QString &title, QVariant data, bool newMenu, bool setCurrent) { - MythUIButtonListItem *button = new MythUIButtonListItem(m_buttonList, title); + auto *button = new MythUIButtonListItem(m_buttonList, title); button->SetData(std::move(data)); button->setDrawArrow(newMenu); @@ -313,7 +313,7 @@ void MythDialogBox::AddButton(const QString &title, QVariant data, bool newMenu, void MythDialogBox::AddButton(const QString &title, const char *slot, bool newMenu, bool setCurrent) { - MythUIButtonListItem *button = new MythUIButtonListItem(m_buttonList, title); + auto *button = new MythUIButtonListItem(m_buttonList, title); m_useSlots = true; @@ -418,7 +418,7 @@ void MythDialogBox::SendEvent(int res, const QString& text, const QVariant& data if (!m_currentMenu->m_retObject) return; - DialogCompletionEvent *dce = new DialogCompletionEvent(m_currentMenu->m_resultid, res, text, data); + auto *dce = new DialogCompletionEvent(m_currentMenu->m_resultid, res, text, data); QCoreApplication::postEvent(m_currentMenu->m_retObject, dce); } else @@ -428,7 +428,7 @@ void MythDialogBox::SendEvent(int res, const QString& text, const QVariant& data if (!m_retObject) return; - DialogCompletionEvent *dce = new DialogCompletionEvent(m_id, res, text, data); + auto *dce = new DialogCompletionEvent(m_id, res, text, data); QCoreApplication::postEvent(m_retObject, dce); } } @@ -535,8 +535,7 @@ void MythConfirmationDialog::sendResult(bool ok) if (ok) res = 1; - DialogCompletionEvent *dce = new DialogCompletionEvent(m_id, res, "", - m_resultData); + auto *dce = new DialogCompletionEvent(m_id, res, "", m_resultData); QCoreApplication::postEvent(m_retObject, dce); m_retObject = nullptr; } @@ -657,8 +656,7 @@ void MythTextInputDialog::sendResult() if (m_retObject) { - DialogCompletionEvent *dce = new DialogCompletionEvent(m_id, 0, - inputString, ""); + auto *dce = new DialogCompletionEvent(m_id, 0, inputString, ""); QCoreApplication::postEvent(m_retObject, dce); } @@ -756,8 +754,7 @@ void MythSpinBoxDialog::sendResult() if (m_retObject) { - DialogCompletionEvent *dce = new DialogCompletionEvent(m_id, 0, - inputString, ""); + auto *dce = new DialogCompletionEvent(m_id, 0, inputString, ""); QCoreApplication::postEvent(m_retObject, dce); } @@ -864,8 +861,7 @@ void MythUISearchDialog::slotSendResult() if (m_retObject) { - DialogCompletionEvent *dce = new DialogCompletionEvent(m_id, 0, - result, ""); + auto *dce = new DialogCompletionEvent(m_id, 0, result, ""); QCoreApplication::postEvent(m_retObject, dce); } @@ -1067,8 +1063,7 @@ void MythTimeInputDialog::okClicked(void) if (m_retObject) { QVariant data(dateTime); - DialogCompletionEvent *dce = new DialogCompletionEvent(m_id, 0, "", - data); + auto *dce = new DialogCompletionEvent(m_id, 0, "", data); QCoreApplication::postEvent(m_retObject, dce); } diff --git a/mythtv/libs/libmythui/mythdisplay.cpp b/mythtv/libs/libmythui/mythdisplay.cpp index 2da54e5c61a..624318e576f 100644 --- a/mythtv/libs/libmythui/mythdisplay.cpp +++ b/mythtv/libs/libmythui/mythdisplay.cpp @@ -492,7 +492,7 @@ bool MythDisplay::SwitchToVideo(int Width, int Height, double Rate) bool MythDisplay::SwitchToGUI(Mode NextMode) { DisplayResScreen next = m_mode[NextMode]; - double target_rate = static_cast<double>(NAN); + auto target_rate = static_cast<double>(NAN); // need to change video mode? // If GuiVidModeRefreshRate is 0, assume any refresh rate is good enough. @@ -536,7 +536,7 @@ double MythDisplay::GetRefreshRate(void) std::vector<double> MythDisplay::GetRefreshRates(int Width, int Height) { - double tr = static_cast<double>(NAN); + auto tr = static_cast<double>(NAN); std::vector<double> empty; const DisplayResScreen drs(Width, Height, 0, 0, -1.0, 0.0); diff --git a/mythtv/libs/libmythui/mythfontmanager.cpp b/mythtv/libs/libmythui/mythfontmanager.cpp index ebd7d76d6db..b3f625142d3 100644 --- a/mythtv/libs/libmythui/mythfontmanager.cpp +++ b/mythtv/libs/libmythui/mythfontmanager.cpp @@ -248,8 +248,7 @@ bool MythFontManager::RegisterFont(const QString &fontPath, return false; id = ref->GetFontID(); } - MythFontReference *fontReference = - new MythFontReference(fontPath, registeredFor, id); + auto *fontReference = new MythFontReference(fontPath, registeredFor, id); m_fontPathToReference.insert(fontPath, fontReference); return true; } diff --git a/mythtv/libs/libmythui/mythfontmanager.h b/mythtv/libs/libmythui/mythfontmanager.h index e3b2fe964f6..0e548dc9cf5 100644 --- a/mythtv/libs/libmythui/mythfontmanager.h +++ b/mythtv/libs/libmythui/mythfontmanager.h @@ -8,7 +8,7 @@ #include "mythuiexp.h" class MythFontReference; -typedef QMultiHash<QString, MythFontReference*> FontPathToReference; +using FontPathToReference = QMultiHash<QString, MythFontReference*>; class MUI_PUBLIC MythFontManager { diff --git a/mythtv/libs/libmythui/mythfontproperties.cpp b/mythtv/libs/libmythui/mythfontproperties.cpp index 5ee4ca9b498..5e14a63ab4d 100644 --- a/mythtv/libs/libmythui/mythfontproperties.cpp +++ b/mythtv/libs/libmythui/mythfontproperties.cpp @@ -175,9 +175,9 @@ MythFontProperties *MythFontProperties::ParseFromXml( { // Crappy, but cached. Move to GlobalFontMap? - static bool show_available = true; + static bool s_showAvailable = true; bool fromBase = false; - MythFontProperties *newFont = new MythFontProperties(); + auto *newFont = new MythFontProperties(); newFont->Freeze(); if (element.tagName() == "font") @@ -438,7 +438,7 @@ MythFontProperties *MythFontProperties::ParseFromXml( QString("Failed to load '%1', got '%2' instead") .arg(newFont->m_face.family()).arg(fi.family())); - if (show_available) + if (s_showAvailable) { LOG(VB_GUI, LOG_DEBUG, "Available fonts:"); @@ -468,7 +468,7 @@ MythFontProperties *MythFontProperties::ParseFromXml( } LOG(VB_GUI, LOG_DEBUG, family_styles.join(" ")); } - show_available = false; + s_showAvailable = false; } } else diff --git a/mythtv/libs/libmythui/mythgenerictree.cpp b/mythtv/libs/libmythui/mythgenerictree.cpp index 46f77bead07..ff0b368605e 100644 --- a/mythtv/libs/libmythui/mythgenerictree.cpp +++ b/mythtv/libs/libmythui/mythgenerictree.cpp @@ -87,7 +87,7 @@ void MythGenericTree::ensureSortFields(void) MythGenericTree* MythGenericTree::addNode(const QString &a_string, int an_int, bool selectable_flag, bool visible) { - MythGenericTree *new_node = new MythGenericTree(a_string.simplified(), + auto *new_node = new MythGenericTree(a_string.simplified(), an_int, selectable_flag); new_node->SetVisible(visible); return addNode(new_node); @@ -97,7 +97,7 @@ MythGenericTree* MythGenericTree::addNode(const QString &a_string, const QString &sortText, int an_int, bool selectable_flag, bool visible) { - MythGenericTree *new_node = new MythGenericTree(a_string.simplified(), + auto *new_node = new MythGenericTree(a_string.simplified(), an_int, selectable_flag); new_node->SetVisible(visible); new_node->SetSortText(sortText); @@ -502,7 +502,7 @@ void MythGenericTree::SetVisible(bool visible) MythUIButtonListItem *MythGenericTree::CreateListButton(MythUIButtonList *list) { - MythUIButtonListItem *item = new MythUIButtonListItem(list, GetText()); + auto *item = new MythUIButtonListItem(list, GetText()); item->SetData(qVariantFromValue(this)); item->SetTextFromMap(m_strings); item->SetImageFromMap(m_imageFilenames); diff --git a/mythtv/libs/libmythui/mythgenerictree.h b/mythtv/libs/libmythui/mythgenerictree.h index 86be56e01d1..c2be594d3b8 100644 --- a/mythtv/libs/libmythui/mythgenerictree.h +++ b/mythtv/libs/libmythui/mythgenerictree.h @@ -18,7 +18,7 @@ class SortableMythGenericTreeList; class MUI_PUBLIC MythGenericTree { - typedef QVector<int> IntVector; + using IntVector = QVector<int>; public: MythGenericTree(const QString &a_string = "", int an_int = 0, diff --git a/mythtv/libs/libmythui/mythimage.cpp b/mythtv/libs/libmythui/mythimage.cpp index 3d0cbb95f76..df6ebd4a13e 100644 --- a/mythtv/libs/libmythui/mythimage.cpp +++ b/mythtv/libs/libmythui/mythimage.cpp @@ -273,7 +273,7 @@ bool MythImage::Load(MythImageReader *reader) if (!reader || !reader->canRead()) return false; - QImage *im = new QImage; + auto *im = new QImage; if (im && reader->read(im)) { @@ -306,7 +306,7 @@ bool MythImage::Load(const QString &filename) QString mythUrl = RemoteFile::FindFile(fname, url.host(), url.userName()); if (!mythUrl.isEmpty()) { - RemoteFile *rf = new RemoteFile(mythUrl, false, false, 0); + auto *rf = new RemoteFile(mythUrl, false, false, 0); QByteArray data; bool ret = rf->SaveAs(data); diff --git a/mythtv/libs/libmythui/mythmainwindow.cpp b/mythtv/libs/libmythui/mythmainwindow.cpp index 8dac81147aa..d6f00c6ce07 100644 --- a/mythtv/libs/libmythui/mythmainwindow.cpp +++ b/mythtv/libs/libmythui/mythmainwindow.cpp @@ -111,16 +111,16 @@ class KeyContext struct JumpData { - void (*callback)(void); - QString destination; - QString description; - bool exittomain; - QString localAction; + void (*m_callback)(void); + QString m_destination; + QString m_description; + bool m_exittomain; + QString m_localAction; }; struct MPData { - QString description; - MediaPlayCallback playFn; + QString m_description; + MediaPlayCallback m_playFn; }; class MythMainWindowPrivate @@ -143,10 +143,10 @@ class MythMainWindowPrivate int m_xbase {0}; int m_ybase {0}; - bool m_does_fill_screen {false}; + bool m_doesFillScreen {false}; - bool m_ignore_lirc_keys {false}; - bool m_ignore_joystick_keys {false}; + bool m_ignoreLircKeys {false}; + bool m_ignoreJoystickKeys {false}; LIRC *m_lircThread {nullptr}; @@ -175,10 +175,10 @@ class MythMainWindowPrivate QMap<QString, MPData> m_mediaPluginMap; QHash<QString, QHash<QString, QString> > m_actionText; - void (*exitmenucallback)(void) {nullptr}; + void (*m_exitMenuCallback)(void) {nullptr}; - void (*exitmenumediadevicecallback)(MythMediaDevice* mediadevice) {nullptr}; - MythMediaDevice * mediadeviceforcallback {nullptr}; + void (*m_exitMenuMediaDeviceCallback)(MythMediaDevice* mediadevice) {nullptr}; + MythMediaDevice * m_mediaDeviceForCallback {nullptr}; int m_escapekey {0}; @@ -193,8 +193,6 @@ class MythMainWindowPrivate MythPainter *m_painter {nullptr}; MythRender *m_render {nullptr}; - bool m_AllowInput {true}; - QRegion m_repaintRegion; MythGesture m_gesture; @@ -218,14 +216,17 @@ class MythMainWindowPrivate MythThemeBase *m_themeBase {nullptr}; MythUDPListener *m_udpListener {nullptr}; - bool m_pendingUpdate {false}; - + MythNotificationCenter *m_nc {nullptr}; QTimer *m_idleTimer {nullptr}; int m_idleTime {0}; bool m_standby {false}; bool m_enteringStandby {false}; bool m_disableIdle {false}; - MythNotificationCenter *m_NC {nullptr}; + + bool m_allowInput {true}; + + bool m_pendingUpdate {false}; + // window aspect bool m_firstinit {true}; bool m_bSavedPOS {false}; @@ -409,7 +410,7 @@ MythMainWindow::MythMainWindow(const bool useDB) setObjectName("mainwindow"); - d->m_AllowInput = false; + d->m_allowInput = false; // This prevents database errors from RegisterKey() when there is no DB: d->m_useDB = useDB; @@ -421,13 +422,13 @@ MythMainWindow::MythMainWindow(const bool useDB) //Init(); - d->m_ignore_lirc_keys = false; - d->m_ignore_joystick_keys = false; + d->m_ignoreLircKeys = false; + d->m_ignoreJoystickKeys = false; d->m_exitingtomain = false; d->m_popwindows = true; - d->exitmenucallback = nullptr; - d->exitmenumediadevicecallback = nullptr; - d->mediadeviceforcallback = nullptr; + d->m_exitMenuCallback = nullptr; + d->m_exitMenuMediaDeviceCallback = nullptr; + d->m_mediaDeviceForCallback = nullptr; d->m_escapekey = Qt::Key_Escape; d->m_mainStack = nullptr; d->m_sysEventHandler = nullptr; @@ -438,7 +439,7 @@ MythMainWindow::MythMainWindow(const bool useDB) StartLIRC(); #ifdef USE_JOYSTICK_MENU - d->m_ignore_joystick_keys = false; + d->m_ignoreJoystickKeys = false; QString joy_config_file = GetConfDir() + "/joystickmenurc"; @@ -491,7 +492,7 @@ MythMainWindow::MythMainWindow(const bool useDB) d->m_drawTimer = new MythSignalingTimer(this, SLOT(animate())); d->m_drawTimer->start(d->m_drawInterval); - d->m_AllowInput = true; + d->m_allowInput = true; d->m_repaintRegion = QRegion(QRect(0,0,0,0)); @@ -582,7 +583,7 @@ MythMainWindow::~MythMainWindow() delete d->m_cecAdapter; #endif - delete d->m_NC; + delete d->m_nc; delete d->m_painter; // Don't delete. If the app is closing down it causes intermittent segfaults @@ -601,7 +602,7 @@ MythPainter *MythMainWindow::GetCurrentPainter(void) MythNotificationCenter *MythMainWindow::GetCurrentNotificationCenter(void) { - return d->m_NC; + return d->m_nc; } QWidget *MythMainWindow::GetPaintWindow(void) @@ -851,8 +852,8 @@ void MythMainWindow::closeEvent(QCloseEvent *e) { if (e->spontaneous()) { - QKeyEvent *key = new QKeyEvent(QEvent::KeyPress, d->m_escapekey, - Qt::NoModifier); + auto *key = new QKeyEvent(QEvent::KeyPress, d->m_escapekey, + Qt::NoModifier); QCoreApplication::postEvent(this, key); e->ignore(); } @@ -989,7 +990,7 @@ void MythMainWindow::Init(const QString& forcedpainter, bool mayReInit) GetMythUI()->GetScreenSettings(d->m_xbase, d->m_screenwidth, d->m_wmult, d->m_ybase, d->m_screenheight, d->m_hmult); - d->m_does_fill_screen = + d->m_doesFillScreen = (GetMythDB()->GetNumSetting("GuiOffsetX") == 0 && GetMythDB()->GetNumSetting("GuiWidth") == 0 && GetMythDB()->GetNumSetting("GuiOffsetY") == 0 && @@ -999,7 +1000,7 @@ void MythMainWindow::Init(const QString& forcedpainter, bool mayReInit) Qt::WindowFlags flags = Qt::Window; bool inwindow = GetMythDB()->GetBoolSetting("RunFrontendInWindow", false); - bool fullscreen = d->m_does_fill_screen && !MythUIHelper::IsGeometryOverridden(); + bool fullscreen = d->m_doesFillScreen && !MythUIHelper::IsGeometryOverridden(); // On Compiz/Unit, when the window is fullscreen and frameless changing // screen position ends up stuck. Adding a border temporarily prevents this @@ -1174,9 +1175,9 @@ void MythMainWindow::Init(const QString& forcedpainter, bool mayReInit) else d->m_themeBase = new MythThemeBase(); - if (!d->m_NC) + if (!d->m_nc) { - d->m_NC = new MythNotificationCenter(); + d->m_nc = new MythNotificationCenter(); } } @@ -1380,7 +1381,7 @@ void MythMainWindow::ReinitDone(void) void MythMainWindow::Show(void) { bool inwindow = GetMythDB()->GetBoolSetting("RunFrontendInWindow", false); - bool fullscreen = d->m_does_fill_screen && !MythUIHelper::IsGeometryOverridden(); + bool fullscreen = d->m_doesFillScreen && !MythUIHelper::IsGeometryOverridden(); if (fullscreen && !inwindow && !d->m_firstinit) { @@ -1393,7 +1394,7 @@ void MythMainWindow::Show(void) d->m_firstinit = false; #ifdef Q_WS_MACX_OLDQT - if (d->m_does_fill_screen) + if (d->m_doesFillScreen) HideMenuBar(); else ShowMenuBar(); @@ -1494,13 +1495,13 @@ void MythMainWindow::ExitToMainMenu(void) gCoreContext->dispatch(xe); if (screen->objectName() == QString("video playback window")) { - MythEvent *me = new MythEvent("EXIT_TO_MENU"); + auto *me = new MythEvent("EXIT_TO_MENU"); QCoreApplication::postEvent(screen, me); } else { - QKeyEvent *key = new QKeyEvent(QEvent::KeyPress, d->m_escapekey, - Qt::NoModifier); + auto *key = new QKeyEvent(QEvent::KeyPress, d->m_escapekey, + Qt::NoModifier); QCoreApplication::postEvent(this, key); MythNotificationCenter *nc = MythNotificationCenter::GetInstance(); // Notifications have their own stack. We need to continue @@ -1519,17 +1520,17 @@ void MythMainWindow::ExitToMainMenu(void) { d->m_exitingtomain = false; d->m_popwindows = true; - if (d->exitmenucallback) + if (d->m_exitMenuCallback) { - void (*callback)(void) = d->exitmenucallback; - d->exitmenucallback = nullptr; + void (*callback)(void) = d->m_exitMenuCallback; + d->m_exitMenuCallback = nullptr; callback(); } - else if (d->exitmenumediadevicecallback) + else if (d->m_exitMenuMediaDeviceCallback) { - void (*callback)(MythMediaDevice*) = d->exitmenumediadevicecallback; - MythMediaDevice * mediadevice = d->mediadeviceforcallback; - d->mediadeviceforcallback = nullptr; + void (*callback)(MythMediaDevice*) = d->m_exitMenuMediaDeviceCallback; + MythMediaDevice * mediadevice = d->m_mediaDeviceForCallback; + d->m_mediaDeviceForCallback = nullptr; callback(mediadevice); } } @@ -1582,27 +1583,27 @@ bool MythMainWindow::TranslateKeyPress(const QString &context, QStringList localActions; if (allowJumps && (d->m_jumpMap.count(keynum) > 0) && - (!d->m_jumpMap[keynum]->localAction.isEmpty()) && + (!d->m_jumpMap[keynum]->m_localAction.isEmpty()) && (d->m_keyContexts.value(context)) && (d->m_keyContexts.value(context)->GetMapping(keynum, localActions))) { - if (localActions.contains(d->m_jumpMap[keynum]->localAction)) + if (localActions.contains(d->m_jumpMap[keynum]->m_localAction)) allowJumps = false; } if (allowJumps && d->m_jumpMap.count(keynum) > 0 && - !d->m_jumpMap[keynum]->exittomain && d->exitmenucallback == nullptr) + !d->m_jumpMap[keynum]->m_exittomain && d->m_exitMenuCallback == nullptr) { - void (*callback)(void) = d->m_jumpMap[keynum]->callback; + void (*callback)(void) = d->m_jumpMap[keynum]->m_callback; callback(); return true; } if (allowJumps && - d->m_jumpMap.count(keynum) > 0 && d->exitmenucallback == nullptr) + d->m_jumpMap.count(keynum) > 0 && d->m_exitMenuCallback == nullptr) { d->m_exitingtomain = true; - d->exitmenucallback = d->m_jumpMap[keynum]->callback; + d->m_exitMenuCallback = d->m_jumpMap[keynum]->m_callback; QCoreApplication::postEvent( this, new QEvent(MythEvent::kExitToMainMenuEventType)); return true; @@ -1791,7 +1792,7 @@ void MythMainWindow::ClearJump(const QString &destination) { it.next(); JumpData *jd = it.value(); - if (jd->destination == destination) + if (jd->m_destination == destination) it.remove(); } } @@ -1891,11 +1892,11 @@ void MythMainWindow::ClearAllJumps() void MythMainWindow::JumpTo(const QString& destination, bool pop) { - if (d->m_destinationMap.count(destination) > 0 && d->exitmenucallback == nullptr) + if (d->m_destinationMap.count(destination) > 0 && d->m_exitMenuCallback == nullptr) { d->m_exitingtomain = true; d->m_popwindows = pop; - d->exitmenucallback = d->m_destinationMap[destination].callback; + d->m_exitMenuCallback = d->m_destinationMap[destination].m_callback; QCoreApplication::postEvent( this, new QEvent(MythEvent::kExitToMainMenuEventType)); return; @@ -1946,7 +1947,7 @@ bool MythMainWindow::HandleMedia(const QString &handler, const QString &mrl, // Let's see if we have a plugin that matches the handler name... if (d->m_mediaPluginMap.count(lhandler)) { - d->m_mediaPluginMap[lhandler].playFn(mrl, plot, title, subtitle, + d->m_mediaPluginMap[lhandler].m_playFn(mrl, plot, title, subtitle, director, season, episode, inetref, lenMins, year, id, useBookmarks); @@ -1985,7 +1986,7 @@ void MythMainWindow::HandleCallback(const QString &Debug, MythCallbackEvent::Cal QWaitCondition wait; QMutex lock; lock.lock(); - MythCallbackEvent *event = new MythCallbackEvent(Function, &wait, Opaque1, Opaque2); + auto *event = new MythCallbackEvent(Function, &wait, Opaque1, Opaque2); QCoreApplication::postEvent(window, event, Qt::HighEventPriority); int count = 0; while (!wait.wait(&lock, 100) && (count += 100)) @@ -1995,7 +1996,7 @@ void MythMainWindow::HandleCallback(const QString &Debug, MythCallbackEvent::Cal void MythMainWindow::AllowInput(bool allow) { - d->m_AllowInput = allow; + d->m_allowInput = allow; } void MythMainWindow::mouseTimeout(void) @@ -2020,7 +2021,7 @@ bool MythMainWindow::keyLongPressFilter(QEvent **e, QScopedPointer<QEvent> &sNewEvent) { QEvent *newEvent = nullptr; - QKeyEvent *ke = dynamic_cast<QKeyEvent*>(*e); + auto *ke = dynamic_cast<QKeyEvent*>(*e); if (!ke) return false; int keycode = ke->key(); @@ -2090,8 +2091,10 @@ bool MythMainWindow::keyLongPressFilter(QEvent **e, // short press or non-repeating keyboard - generate key Qt::KeyboardModifiers modifier = Qt::NoModifier; if (ke->timestamp() - d->m_longPressTime >= LONGPRESS_INTERVAL) + { // non-repeatng keyboard modifier = Qt::MetaModifier; + } newEvent = new QKeyEvent(QEvent::KeyPress, keycode, ke->modifiers() | modifier, ke->nativeScanCode(), ke->nativeVirtualKey(), ke->nativeModifiers(), @@ -2117,7 +2120,7 @@ bool MythMainWindow::keyLongPressFilter(QEvent **e, bool MythMainWindow::eventFilter(QObject * /*watched*/, QEvent *e) { /* Don't let anything through if input is disallowed. */ - if (!d->m_AllowInput) + if (!d->m_allowInput) return true; QScopedPointer<QEvent> sNewEvent(nullptr); @@ -2129,7 +2132,7 @@ bool MythMainWindow::eventFilter(QObject * /*watched*/, QEvent *e) case QEvent::KeyPress: { ResetIdleTimer(); - QKeyEvent *ke = dynamic_cast<QKeyEvent*>(e); + auto *ke = dynamic_cast<QKeyEvent*>(e); // Work around weird GCC run-time bug. Only manifest on Mac OS X if (!ke) @@ -2151,8 +2154,8 @@ bool MythMainWindow::eventFilter(QObject * /*watched*/, QEvent *e) if (keycode > 0) { - QKeyEvent *key = new QKeyEvent(QEvent::KeyPress, keycode, - ke->modifiers()); + auto *key = new QKeyEvent(QEvent::KeyPress, keycode, + ke->modifiers()); QObject *key_target = getTarget(*key); if (!key_target) QCoreApplication::postEvent(this, key); @@ -2188,7 +2191,7 @@ bool MythMainWindow::eventFilter(QObject * /*watched*/, QEvent *e) if (!d->m_gesture.recording()) { d->m_gesture.start(); - QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent*>(e); + auto *mouseEvent = dynamic_cast<QMouseEvent*>(e); if (!mouseEvent) return false; d->m_gesture.record(mouseEvent->pos()); @@ -2212,7 +2215,7 @@ bool MythMainWindow::eventFilter(QObject * /*watched*/, QEvent *e) d->m_gesture.stop(); MythGestureEvent *ge = d->m_gesture.gesture(); - QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent*>(e); + auto *mouseEvent = dynamic_cast<QMouseEvent*>(e); /* handle clicks separately */ if (ge->gesture() == MythGestureEvent::Click) @@ -2337,7 +2340,7 @@ bool MythMainWindow::eventFilter(QObject * /*watched*/, QEvent *e) d->m_gestureTimer->stop(); d->m_gestureTimer->start(GESTURE_TIMEOUT); - QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent*>(e); + auto *mouseEvent = dynamic_cast<QMouseEvent*>(e); if (!mouseEvent) return false; d->m_gesture.record(mouseEvent->pos()); @@ -2349,13 +2352,13 @@ bool MythMainWindow::eventFilter(QObject * /*watched*/, QEvent *e) { ResetIdleTimer(); ShowMouseCursor(true); - QWheelEvent* qmw = static_cast<QWheelEvent*>(e); + auto* qmw = static_cast<QWheelEvent*>(e); int delta = qmw->delta(); if (delta>0) { qmw->accept(); - QKeyEvent *key = new QKeyEvent(QEvent::KeyPress, Qt::Key_Up, - Qt::NoModifier); + auto *key = new QKeyEvent(QEvent::KeyPress, Qt::Key_Up, + Qt::NoModifier); QObject *key_target = getTarget(*key); if (!key_target) QCoreApplication::postEvent(this, key); @@ -2365,8 +2368,8 @@ bool MythMainWindow::eventFilter(QObject * /*watched*/, QEvent *e) if (delta<0) { qmw->accept(); - QKeyEvent *key = new QKeyEvent(QEvent::KeyPress, Qt::Key_Down, - Qt::NoModifier); + auto *key = new QKeyEvent(QEvent::KeyPress, Qt::Key_Down, + Qt::NoModifier); QObject *key_target = getTarget(*key); if (!key_target) QCoreApplication::postEvent(this, key); @@ -2386,7 +2389,7 @@ void MythMainWindow::customEvent(QEvent *ce) { if (ce->type() == MythGestureEvent::kEventType) { - MythGestureEvent *ge = static_cast<MythGestureEvent*>(ce); + auto *ge = static_cast<MythGestureEvent*>(ce); MythScreenStack *toplevel = GetMainStack(); if (toplevel) { @@ -2403,7 +2406,7 @@ void MythMainWindow::customEvent(QEvent *ce) } else if (ce->type() == ExternalKeycodeEvent::kEventType) { - ExternalKeycodeEvent *eke = static_cast<ExternalKeycodeEvent *>(ce); + auto *eke = static_cast<ExternalKeycodeEvent *>(ce); int keycode = eke->getKeycode(); QKeyEvent key(QEvent::KeyPress, keycode, Qt::NoModifier); @@ -2416,9 +2419,9 @@ void MythMainWindow::customEvent(QEvent *ce) } #if defined(USE_LIRC) || defined(USING_APPLEREMOTE) else if (ce->type() == LircKeycodeEvent::kEventType && - !d->m_ignore_lirc_keys) + !d->m_ignoreLircKeys) { - LircKeycodeEvent *lke = static_cast<LircKeycodeEvent *>(ce); + auto *lke = static_cast<LircKeycodeEvent *>(ce); if (LircKeycodeEvent::kLIRCInvalidKeyCombo == lke->modifiers()) { @@ -2446,9 +2449,9 @@ void MythMainWindow::customEvent(QEvent *ce) #endif #ifdef USE_JOYSTICK_MENU else if (ce->type() == JoystickKeycodeEvent::kEventType && - !d->m_ignore_joystick_keys) + !d->m_ignoreJoystickKeys) { - JoystickKeycodeEvent *jke = static_cast<JoystickKeycodeEvent *>(ce); + auto *jke = static_cast<JoystickKeycodeEvent *>(ce); int keycode = jke->getKeycode(); if (keycode) @@ -2481,7 +2484,7 @@ void MythMainWindow::customEvent(QEvent *ce) #endif else if (ce->type() == MythMediaEvent::kEventType) { - MythMediaEvent *me = static_cast<MythMediaEvent*>(ce); + auto *me = static_cast<MythMediaEvent*>(ce); // A listener based system might be more efficient, but we should never // have that many screens open at once so impact should be minimal. @@ -2518,7 +2521,7 @@ void MythMainWindow::customEvent(QEvent *ce) } else if (ce->type() == ScreenSaverEvent::kEventType) { - ScreenSaverEvent *sse = static_cast<ScreenSaverEvent *>(ce); + auto *sse = static_cast<ScreenSaverEvent *>(ce); switch (sse->getSSEventType()) { case ScreenSaverEvent::ssetDisable: @@ -2572,7 +2575,7 @@ void MythMainWindow::customEvent(QEvent *ce) } else if (ce->type() == MythEvent::MythEventMessage) { - MythEvent *me = static_cast<MythEvent *>(ce); + auto *me = static_cast<MythEvent *>(ce); QString message = me->Message(); if (message.startsWith(ACTION_HANDLEMEDIA)) @@ -2662,7 +2665,7 @@ void MythMainWindow::customEvent(QEvent *ce) } else if (ce->type() == MythEvent::MythUserMessage) { - MythEvent *me = static_cast<MythEvent *>(ce); + auto *me = static_cast<MythEvent *>(ce); const QString& message = me->Message(); if (!message.isEmpty()) @@ -2674,7 +2677,7 @@ void MythMainWindow::customEvent(QEvent *ce) } else if (ce->type() == MythCallbackEvent::kCallbackType) { - MythCallbackEvent *me = static_cast<MythCallbackEvent*>(ce); + auto *me = static_cast<MythCallbackEvent*>(ce); if (me && me->m_function) me->m_function(me->m_opaque1, me->m_opaque2, me->m_opaque3); } @@ -2838,11 +2841,11 @@ void MythMainWindow::LockInputDevices( bool locked ) LOG(VB_GENERAL, LOG_INFO, "Unlocking input devices"); #ifdef USE_LIRC - d->m_ignore_lirc_keys = locked; + d->m_ignoreLircKeys = locked; #endif #ifdef USE_JOYSTICK_MENU - d->m_ignore_joystick_keys = locked; + d->m_ignoreJoystickKeys = locked; #endif } diff --git a/mythtv/libs/libmythui/mythmainwindow.h b/mythtv/libs/libmythui/mythmainwindow.h index 7e5ee059215..51a23a598e2 100644 --- a/mythtv/libs/libmythui/mythmainwindow.h +++ b/mythtv/libs/libmythui/mythmainwindow.h @@ -19,7 +19,7 @@ class MythMediaDevice; #define REG_JUMPEX(a, b, c, d, e) GetMythMainWindow()->RegisterJump(a, b, c, d, e) #define REG_MEDIAPLAYER(a,b,c) GetMythMainWindow()->RegisterMediaPlugin(a, b, c) -typedef int (*MediaPlayCallback)(const QString &, const QString &, const QString &, const QString &, const QString &, int, int, const QString &, int, const QString &, const QString &, bool); +using MediaPlayCallback = int (*)(const QString &, const QString &, const QString &, const QString &, const QString &, int, int, const QString &, int, const QString &, const QString &, bool); class MythMainWindowPrivate; diff --git a/mythtv/libs/libmythui/mythnotification.h b/mythtv/libs/libmythui/mythnotification.h index 2305767fcef..67efef5ab7b 100644 --- a/mythtv/libs/libmythui/mythnotification.h +++ b/mythtv/libs/libmythui/mythnotification.h @@ -16,8 +16,8 @@ #include "mythevent.h" #include "mythuiexp.h" -typedef QMap<QString,QString> DMAP; -typedef unsigned int VNMask; +using DMAP = QMap<QString,QString>; +using VNMask = unsigned int; class MUI_PUBLIC MythNotification : public MythEvent { diff --git a/mythtv/libs/libmythui/mythnotificationcenter.cpp b/mythtv/libs/libmythui/mythnotificationcenter.cpp index 4e4a17954bd..7751dba5523 100644 --- a/mythtv/libs/libmythui/mythnotificationcenter.cpp +++ b/mythtv/libs/libmythui/mythnotificationcenter.cpp @@ -133,8 +133,7 @@ MythScreenType *MythNotificationScreenStack::GetTopScreen(void) const // loop from last to 2nd for (; it != m_Children.begin(); --it) { - MythNotificationScreen *s = dynamic_cast<MythNotificationScreen *>(*it); - + auto *s = dynamic_cast<MythNotificationScreen *>(*it); if (!s) { // if for whatever reason it's not a notification on our screen @@ -230,8 +229,7 @@ void MythNotificationScreen::SetNotification(MythNotification ¬ification) update = false; } - MythImageNotification *img = - dynamic_cast<MythImageNotification*>(¬ification); + auto *img = dynamic_cast<MythImageNotification*>(¬ification); if (img) { QString path = img->GetImagePath(); @@ -248,8 +246,7 @@ void MythNotificationScreen::SetNotification(MythNotification ¬ification) } } - MythPlaybackNotification *play = - dynamic_cast<MythPlaybackNotification*>(¬ification); + auto *play = dynamic_cast<MythPlaybackNotification*>(¬ification); if (play) { UpdatePlayback(play->GetProgress(), play->GetProgressText()); @@ -257,8 +254,7 @@ void MythNotificationScreen::SetNotification(MythNotification ¬ification) m_update |= kDuration; } - MythMediaNotification *media = - dynamic_cast<MythMediaNotification*>(¬ification); + auto *media = dynamic_cast<MythMediaNotification*>(¬ification); if (media && m_imagePath.isEmpty() && m_image.isNull()) { m_update |= kNoArtwork; @@ -793,8 +789,7 @@ NCPrivate::~NCPrivate() */ void NCPrivate::ScreenDeleted(void) { - MythNotificationScreen *screen = - static_cast<MythNotificationScreen*>(sender()); + auto *screen = static_cast<MythNotificationScreen*>(sender()); bool duefordeletion = m_deletedScreens.contains(screen); @@ -842,7 +837,7 @@ void NCPrivate::ScreenDeleted(void) { // don't remove the id from the list, as the application is still registered // re-create the screen - MythNotificationScreen *newscreen = + auto *newscreen = new MythNotificationScreen(m_screenStack, *screen); connect(newscreen, SIGNAL(ScreenDeleted()), this, SLOT(ScreenDeleted())); m_registrations[screen->m_id] = newscreen; @@ -872,7 +867,7 @@ bool NCPrivate::Queue(const MythNotification ¬ification) int id = notification.GetId(); void *parent = notification.GetParent(); - MythNotification *tmp = static_cast<MythNotification*>(notification.clone()); + auto *tmp = static_cast<MythNotification*>(notification.clone()); if (id > 0) { // quick sanity check to ensure the right caller is attempting @@ -1247,9 +1242,7 @@ void NCPrivate::GetNotificationScreens(QList<MythScreenType*> &_screens) int position = 0; for (; it != itend; ++it) { - MythNotificationScreen *screen = - dynamic_cast<MythNotificationScreen*>(*it); - + auto *screen = dynamic_cast<MythNotificationScreen*>(*it); if (screen) { if ((screen->m_visibility & MythNotification::kPlayback) == 0) @@ -1392,9 +1385,7 @@ void MythNotificationCenter::UnRegister(void *from, int id, bool closeimemdiatel QDateTime MythNotificationCenter::ScreenExpiryTime(const MythScreenType *screen) { - const MythNotificationScreen *s = - dynamic_cast<const MythNotificationScreen*>(screen); - + const auto *s = dynamic_cast<const MythNotificationScreen*>(screen); if (!s) return QDateTime(); return s->m_expiry; @@ -1402,11 +1393,9 @@ QDateTime MythNotificationCenter::ScreenExpiryTime(const MythScreenType *screen) bool MythNotificationCenter::ScreenCreated(const MythScreenType *screen) { - const MythNotificationScreen *s = - dynamic_cast<const MythNotificationScreen*>(screen); - + const auto *s = dynamic_cast<const MythNotificationScreen*>(screen); if (!s) - return true;; + return true; return s->m_created; } @@ -1417,9 +1406,7 @@ void MythNotificationCenter::GetNotificationScreens(QList<MythScreenType*> &_scr void MythNotificationCenter::UpdateScreen(MythScreenType *screen) { - MythNotificationScreen *s = - dynamic_cast<MythNotificationScreen*>(screen); - + auto *s = dynamic_cast<MythNotificationScreen*>(screen); if (!s) return; diff --git a/mythtv/libs/libmythui/mythpainter.cpp b/mythtv/libs/libmythui/mythpainter.cpp index 1dc56e37f85..929df5e02be 100644 --- a/mythtv/libs/libmythui/mythpainter.cpp +++ b/mythtv/libs/libmythui/mythpainter.cpp @@ -492,7 +492,7 @@ MythImage* MythPainter::GetImageFromRect(const QRect &area, int radius, QString incoming("R"); if (fillBrush.style() == Qt::LinearGradientPattern && fillBrush.gradient()) { - const QLinearGradient *gradient = static_cast<const QLinearGradient*>(fillBrush.gradient()); + const auto *gradient = static_cast<const QLinearGradient*>(fillBrush.gradient()); if (gradient) { incoming = QString::number( diff --git a/mythtv/libs/libmythui/mythpainter.h b/mythtv/libs/libmythui/mythpainter.h index f000a9222c0..de51a134f8c 100644 --- a/mythtv/libs/libmythui/mythpainter.h +++ b/mythtv/libs/libmythui/mythpainter.h @@ -26,8 +26,8 @@ class MythFontProperties; class MythImage; class UIEffects; -typedef QVector<QTextLayout *> LayoutVector; -typedef QVector<QTextLayout::FormatRange> FormatVector; +using LayoutVector = QVector<QTextLayout *>; +using FormatVector = QVector<QTextLayout::FormatRange>; class MUI_PUBLIC MythPainter { diff --git a/mythtv/libs/libmythui/mythpainter_qimage.cpp b/mythtv/libs/libmythui/mythpainter_qimage.cpp index 650540fb369..e52f6daf088 100644 --- a/mythtv/libs/libmythui/mythpainter_qimage.cpp +++ b/mythtv/libs/libmythui/mythpainter_qimage.cpp @@ -112,7 +112,7 @@ void MythQImagePainter::Clear(QPaintDevice *device, const QRegion ®ion) if (!device || region.isEmpty()) return; - QImage *dev = dynamic_cast<QImage*>(device); + auto *dev = dynamic_cast<QImage*>(device); if (!dev) return; diff --git a/mythtv/libs/libmythui/mythpainter_qt.cpp b/mythtv/libs/libmythui/mythpainter_qt.cpp index e53bff1229a..45f5b19286c 100644 --- a/mythtv/libs/libmythui/mythpainter_qt.cpp +++ b/mythtv/libs/libmythui/mythpainter_qt.cpp @@ -19,14 +19,14 @@ class MythQtImage : public MythImage MythImage(parent, "MythQtImage") { } void SetChanged(bool change = true) override; // MythImage - QPixmap *GetPixmap(void) { return m_Pixmap; } - void SetPixmap(QPixmap *p) { m_Pixmap = p; } + QPixmap *GetPixmap(void) { return m_pixmap; } + void SetPixmap(QPixmap *p) { m_pixmap = p; } bool NeedsRegen(void) { return m_bRegenPixmap; } void RegeneratePixmap(void); protected: - QPixmap *m_Pixmap {nullptr}; + QPixmap *m_pixmap {nullptr}; bool m_bRegenPixmap {false}; }; @@ -42,12 +42,12 @@ void MythQtImage::RegeneratePixmap(void) { // We allocate the pixmap here so it is done in the UI // thread since QPixmap uses non-reentrant X calls. - if (!m_Pixmap) - m_Pixmap = new QPixmap; + if (!m_pixmap) + m_pixmap = new QPixmap; - if (m_Pixmap) + if (m_pixmap) { - *m_Pixmap = QPixmap::fromImage(*((QImage *)this)); + *m_pixmap = QPixmap::fromImage(*((QImage *)this)); m_bRegenPixmap = false; } } @@ -119,7 +119,7 @@ void MythQtPainter::DrawImage(const QRect &r, MythImage *im, return; } - MythQtImage *qim = reinterpret_cast<MythQtImage *>(im); + auto *qim = reinterpret_cast<MythQtImage *>(im); if (qim->NeedsRegen()) qim->RegeneratePixmap(); @@ -136,7 +136,7 @@ MythImage *MythQtPainter::GetFormatImagePriv() void MythQtPainter::DeleteFormatImagePriv(MythImage *im) { - MythQtImage *qim = static_cast<MythQtImage *>(im); + auto *qim = static_cast<MythQtImage *>(im); QMutexLocker locker(&m_imageDeleteLock); if (qim->GetPixmap()) diff --git a/mythtv/libs/libmythui/mythprogressdialog.cpp b/mythtv/libs/libmythui/mythprogressdialog.cpp index e9d20ace98b..2016ced6eb0 100644 --- a/mythtv/libs/libmythui/mythprogressdialog.cpp +++ b/mythtv/libs/libmythui/mythprogressdialog.cpp @@ -90,22 +90,22 @@ MythUIBusyDialog *ShowBusyPopup(const QString &message) { QString LOC = "ShowBusyPopup('" + message + "') - "; MythUIBusyDialog *pop = nullptr; - static MythScreenStack *stk = nullptr; + static MythScreenStack *s_stk = nullptr; - if (!stk) + if (!s_stk) { MythMainWindow *win = GetMythMainWindow(); if (win) - stk = win->GetStack("popup stack"); + s_stk = win->GetStack("popup stack"); else { LOG(VB_GENERAL, LOG_ERR, LOC + "no main window?"); return nullptr; } - if (!stk) + if (!s_stk) { LOG(VB_GENERAL, LOG_ERR, LOC + "no popup stack? " "Is there a MythThemeBase?"); @@ -113,9 +113,9 @@ MythUIBusyDialog *ShowBusyPopup(const QString &message) } } - pop = new MythUIBusyDialog(message, stk, "showBusyPopup"); + pop = new MythUIBusyDialog(message, s_stk, "showBusyPopup"); if (pop->Create()) - stk->AddScreen(pop); + s_stk->AddScreen(pop); return pop; } @@ -164,8 +164,7 @@ void MythUIProgressDialog::customEvent(QEvent *event) { if (event->type() == ProgressUpdateEvent::kEventType) { - ProgressUpdateEvent *pue = dynamic_cast<ProgressUpdateEvent*>(event); - + auto *pue = dynamic_cast<ProgressUpdateEvent*>(event); if (!pue) { LOG(VB_GENERAL, LOG_ERR, diff --git a/mythtv/libs/libmythui/mythrender_base.h b/mythtv/libs/libmythui/mythrender_base.h index 312b4ece542..ce9e5e72b23 100644 --- a/mythtv/libs/libmythui/mythrender_base.h +++ b/mythtv/libs/libmythui/mythrender_base.h @@ -9,13 +9,13 @@ #include "mythuiexp.h" #include "mythuidefines.h" -typedef enum +enum RenderType { kRenderUnknown = 0, kRenderDirect3D9, kRenderVDPAU, kRenderOpenGL -} RenderType; +}; class MUI_PUBLIC MythRender : public ReferenceCounter { diff --git a/mythtv/libs/libmythui/mythrender_d3d9.cpp b/mythtv/libs/libmythui/mythrender_d3d9.cpp index d9f2b267840..04b6f8381a4 100644 --- a/mythtv/libs/libmythui/mythrender_d3d9.cpp +++ b/mythtv/libs/libmythui/mythrender_d3d9.cpp @@ -40,7 +40,7 @@ class MythD3DSurface D3DFORMAT m_fmt; }; -typedef struct +struct TEXTUREVERTEX { FLOAT x; FLOAT y; @@ -51,16 +51,16 @@ typedef struct FLOAT t1v; FLOAT t2u; FLOAT t2v; -} TEXTUREVERTEX; +}; -typedef struct +struct VERTEX { FLOAT x; FLOAT y; FLOAT z; FLOAT rhw; D3DCOLOR diffuse; -} VERTEX; +}; D3D9Image::D3D9Image(MythRenderD3D9 *render, QSize size, bool video) : m_size(size), m_render(render) @@ -249,7 +249,7 @@ bool MythRenderD3D9::Create(QSize size, HWND window) { QMutexLocker locker(&m_lock); - typedef LPDIRECT3D9 (WINAPI *LPFND3DC)(UINT SDKVersion); + using LPFND3DC = LPDIRECT3D9 (WINAPI *)(UINT SDKVersion); static LPFND3DC OurDirect3DCreate9 = nullptr; OurDirect3DCreate9 = (LPFND3DC)ResolveAddress("D3D9","Direct3DCreate9"); @@ -1186,7 +1186,7 @@ void MythRenderD3D9::ReleaseDevice(void) } #ifdef USING_DXVA2 -typedef HRESULT (WINAPI *CreateDeviceManager9Ptr)(UINT *pResetToken, +using CreateDeviceManager9Ptr = HRESULT (WINAPI *)(UINT *pResetToken, IDirect3DDeviceManager9 **); #endif diff --git a/mythtv/libs/libmythui/mythrender_d3d9.h b/mythtv/libs/libmythui/mythrender_d3d9.h index a09da749415..e35376ab67e 100644 --- a/mythtv/libs/libmythui/mythrender_d3d9.h +++ b/mythtv/libs/libmythui/mythrender_d3d9.h @@ -13,7 +13,7 @@ #ifdef USING_DXVA2 #include "dxva2api.h" #else -typedef void* IDirect3DDeviceManager9; +using IDirect3DDeviceManager9 = void*; #endif class MythD3DVertexBuffer; diff --git a/mythtv/libs/libmythui/mythscreentype.cpp b/mythtv/libs/libmythui/mythscreentype.cpp index 06a6ff281c4..a77f125fa98 100644 --- a/mythtv/libs/libmythui/mythscreentype.cpp +++ b/mythtv/libs/libmythui/mythscreentype.cpp @@ -310,7 +310,7 @@ void MythScreenType::LoadInBackground(const QString& message) OpenBusyPopup(message); - ScreenLoadTask *loadTask = new ScreenLoadTask(*this); + auto *loadTask = new ScreenLoadTask(*this); MThreadPool::globalInstance()->start(loadTask, "ScreenLoad"); } @@ -522,7 +522,7 @@ bool MythScreenType::ParseElement( */ void MythScreenType::CopyFrom(MythUIType *base) { - MythScreenType *st = dynamic_cast<MythScreenType *>(base); + auto *st = dynamic_cast<MythScreenType *>(base); if (!st) { LOG(VB_GENERAL, LOG_ERR, "ERROR, bad parsing"); diff --git a/mythtv/libs/libmythui/myththemedmenu.cpp b/mythtv/libs/libmythui/myththemedmenu.cpp index 8f9fc11d2c5..712d84ef11f 100644 --- a/mythtv/libs/libmythui/myththemedmenu.cpp +++ b/mythtv/libs/libmythui/myththemedmenu.cpp @@ -56,7 +56,7 @@ bool MythThemedMenuState::Create(void) void MythThemedMenuState::CopyFrom(MythUIType *base) { - MythThemedMenuState *st = dynamic_cast<MythThemedMenuState *>(base); + auto *st = dynamic_cast<MythThemedMenuState *>(base); if (!st) { LOG(VB_GENERAL, LOG_INFO, "ERROR, bad parsing"); @@ -373,7 +373,7 @@ void MythThemedMenu::customEvent(QEvent *event) { if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); + auto *dce = (DialogCompletionEvent*)(event); QString resultid = dce->GetId(); //int buttonnum = dce->GetResult(); @@ -691,8 +691,7 @@ void MythThemedMenu::addButton(const QString &type, const QString &text, if (m_watermarkState) m_watermarkState->EnsureStateLoaded(type); - MythUIButtonListItem *listbuttonitem = - new MythUIButtonListItem(m_buttonList, text, + auto *listbuttonitem = new MythUIButtonListItem(m_buttonList, text, qVariantFromValue(newbutton)); listbuttonitem->DisplayState(type, "icon"); @@ -794,8 +793,7 @@ bool MythThemedMenu::handleAction(const QString &action, const QString &password MythScreenStack *stack = GetScreenStack(); - MythThemedMenu *newmenu = new MythThemedMenu("", menu, stack, menu, - false, m_state); + auto *newmenu = new MythThemedMenu("", menu, stack, menu, false, m_state); if (newmenu->foundTheme()) stack->AddScreen(newmenu); else @@ -921,8 +919,7 @@ bool MythThemedMenu::checkPinCode(const QString &password_setting) QString text = tr("Enter password:"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythTextInputDialog *dialog = - new MythTextInputDialog(popupStack, text, FilterNone, true); + auto *dialog = new MythTextInputDialog(popupStack, text, FilterNone, true); if (dialog->Create()) { diff --git a/mythtv/libs/libmythui/mythudplistener.cpp b/mythtv/libs/libmythui/mythudplistener.cpp index 2829bdcf49b..9070682b44b 100644 --- a/mythtv/libs/libmythui/mythudplistener.cpp +++ b/mythtv/libs/libmythui/mythudplistener.cpp @@ -180,7 +180,7 @@ void MythUDPListener::Process(const QByteArray &buf, const QHostAddress& /*sende QStringList args; args << QString::number(timeout); MythMainWindow *window = GetMythMainWindow(); - MythEvent* me = new MythEvent(MythEvent::MythUserMessage, msg, args); + auto* me = new MythEvent(MythEvent::MythUserMessage, msg, args); qApp->postEvent(window, me); } } diff --git a/mythtv/libs/libmythui/mythuianimation.cpp b/mythtv/libs/libmythui/mythuianimation.cpp index 20b953f230e..f4ecda50e76 100644 --- a/mythtv/libs/libmythui/mythuianimation.cpp +++ b/mythtv/libs/libmythui/mythuianimation.cpp @@ -268,7 +268,7 @@ void MythUIAnimation::ParseSection(const QDomElement &element, else continue; - MythUIAnimation* a = new MythUIAnimation(parent, trigger, type); + auto* a = new MythUIAnimation(parent, trigger, type); a->setStartValue(start); a->setEndValue(end); a->setDuration(effectduration); diff --git a/mythtv/libs/libmythui/mythuibutton.cpp b/mythtv/libs/libmythui/mythuibutton.cpp index fc37b45e778..a8f0f99714d 100644 --- a/mythtv/libs/libmythui/mythuibutton.cpp +++ b/mythtv/libs/libmythui/mythuibutton.cpp @@ -104,7 +104,7 @@ void MythUIButton::SetState(const QString& state) m_BackgroundState->DisplayState(m_state); - MythUIGroup *activeState = dynamic_cast<MythUIGroup *> + auto *activeState = dynamic_cast<MythUIGroup *> (m_BackgroundState->GetCurrentState()); if (activeState) @@ -230,7 +230,7 @@ void MythUIButton::SetText(const QString &msg) m_Message = msg; - MythUIGroup *activeState = dynamic_cast<MythUIGroup *> + auto *activeState = dynamic_cast<MythUIGroup *> (m_BackgroundState->GetCurrentState()); if (activeState) @@ -274,7 +274,7 @@ bool MythUIButton::ParseElement( */ void MythUIButton::CreateCopy(MythUIType *parent) { - MythUIButton *button = new MythUIButton(parent, objectName()); + auto *button = new MythUIButton(parent, objectName()); button->CopyFrom(this); } @@ -283,8 +283,7 @@ void MythUIButton::CreateCopy(MythUIType *parent) */ void MythUIButton::CopyFrom(MythUIType *base) { - MythUIButton *button = dynamic_cast<MythUIButton *>(base); - + auto *button = dynamic_cast<MythUIButton *>(base); if (!button) { LOG(VB_GENERAL, LOG_ERR, "Dynamic cast of base failed"); diff --git a/mythtv/libs/libmythui/mythuibuttonlist.cpp b/mythtv/libs/libmythui/mythuibuttonlist.cpp index 7bbc56b503a..11fe6b54846 100644 --- a/mythtv/libs/libmythui/mythuibuttonlist.cpp +++ b/mythtv/libs/libmythui/mythuibuttonlist.cpp @@ -212,7 +212,7 @@ MythUIGroup *MythUIButtonList::PrepareButton(int buttonIdx, int itemIdx, if (buttonIdx < 0 || buttonIdx + 1 > m_maxVisible) { QString name = QString("buttonlist button %1").arg(m_maxVisible); - MythUIStateType *button = new MythUIStateType(this, name); + auto *button = new MythUIStateType(this, name); button->CopyFrom(m_buttontemplate); button->ConnectDependants(true); @@ -238,7 +238,7 @@ MythUIGroup *MythUIButtonList::PrepareButton(int buttonIdx, int itemIdx, MythUIStateType *realButton = m_ButtonList[buttonIdx]; m_ButtonToItem[buttonIdx] = buttonItem; buttonItem->SetToRealButton(realButton, itemIdx == m_selPosition); - MythUIGroup *buttonstate = + auto *buttonstate = dynamic_cast<MythUIGroup *>(realButton->GetCurrentState()); if (itemIdx == m_selPosition) @@ -1153,7 +1153,7 @@ bool MythUIButtonList::DistributeButtons(void) if (buttonIdx >= first_button) { MythUIStateType *realButton = m_ButtonList[buttonIdx]; - MythUIGroup *buttonstate = dynamic_cast<MythUIGroup *> + auto *buttonstate = dynamic_cast<MythUIGroup *> (realButton->GetCurrentState()); if (!buttonstate) break; // Not continue @@ -1694,7 +1694,7 @@ void MythUIButtonList::InitButton(int itemIdx, MythUIStateType* & realButton, if (m_maxVisible == 0) { QString name("buttonlist button 0"); - MythUIStateType *button = new MythUIStateType(this, name); + auto *button = new MythUIStateType(this, name); button->CopyFrom(m_buttontemplate); button->ConnectDependants(true); m_ButtonList.append(button); @@ -1742,7 +1742,7 @@ int MythUIButtonList::PageUp(void) MythUIButtonListItem *buttonItem = nullptr; InitButton(pos, realButton, buttonItem); buttonItem->SetToRealButton(realButton, true); - MythUIGroup *buttonstate = dynamic_cast<MythUIGroup *> + auto *buttonstate = dynamic_cast<MythUIGroup *> (realButton->GetCurrentState()); if (buttonstate == nullptr) @@ -1795,7 +1795,7 @@ int MythUIButtonList::PageUp(void) MythUIButtonListItem *buttonItem = nullptr; InitButton(pos, realButton, buttonItem); buttonItem->SetToRealButton(realButton, true); - MythUIGroup *buttonstate = dynamic_cast<MythUIGroup *> + auto *buttonstate = dynamic_cast<MythUIGroup *> (realButton->GetCurrentState()); if (buttonstate == nullptr) @@ -1848,7 +1848,7 @@ int MythUIButtonList::PageDown(void) MythUIButtonListItem *buttonItem = nullptr; InitButton(pos, realButton, buttonItem); buttonItem->SetToRealButton(realButton, true); - MythUIGroup *buttonstate = dynamic_cast<MythUIGroup *> + auto *buttonstate = dynamic_cast<MythUIGroup *> (realButton->GetCurrentState()); if (buttonstate == nullptr) @@ -1901,7 +1901,7 @@ int MythUIButtonList::PageDown(void) MythUIButtonListItem *buttonItem = nullptr; InitButton(pos, realButton, buttonItem); buttonItem->SetToRealButton(realButton, true); - MythUIGroup *buttonstate = dynamic_cast<MythUIGroup *> + auto *buttonstate = dynamic_cast<MythUIGroup *> (realButton->GetCurrentState()); if (!buttonstate) @@ -2389,7 +2389,7 @@ void MythUIButtonList::Init() for (int i = 0; i < (int)m_itemsVisible; ++i) { QString name = QString("buttonlist button %1").arg(i); - MythUIStateType *button = new MythUIStateType(this, name); + auto *button = new MythUIStateType(this, name); button->CopyFrom(m_buttontemplate); button->ConnectDependants(true); @@ -2601,8 +2601,7 @@ bool MythUIButtonList::gestureEvent(MythGestureEvent *event) if (!type) return false; - MythUIStateType *object = dynamic_cast<MythUIStateType *>(type); - + auto *object = dynamic_cast<MythUIStateType *>(type); if (object) { handled = true; @@ -2705,8 +2704,7 @@ void MythUIButtonList::customEvent(QEvent *event) { if (event->type() == NextButtonListPageEvent::kEventType) { - NextButtonListPageEvent *npe = - static_cast<NextButtonListPageEvent*>(event); + auto *npe = static_cast<NextButtonListPageEvent*>(event); int cur = npe->m_start; for (; cur < npe->m_start + npe->m_pageSize && cur < GetCount(); ++cur) { @@ -2928,7 +2926,7 @@ void MythUIButtonList::DrawSelf(MythPainter * /*p*/, int /*xoffset*/, int /*yoff */ void MythUIButtonList::CreateCopy(MythUIType *parent) { - MythUIButtonList *lb = new MythUIButtonList(parent, objectName()); + auto *lb = new MythUIButtonList(parent, objectName()); lb->CopyFrom(this); } @@ -2937,8 +2935,7 @@ void MythUIButtonList::CreateCopy(MythUIType *parent) */ void MythUIButtonList::CopyFrom(MythUIType *base) { - MythUIButtonList *lb = dynamic_cast<MythUIButtonList *>(base); - + auto *lb = dynamic_cast<MythUIButtonList *>(base); if (!lb) return; @@ -3067,7 +3064,7 @@ void MythUIButtonList::ShowSearchDialog(void) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - SearchButtonListDialog *dlg = new SearchButtonListDialog(popupStack, "MythSearchListDialog", this, ""); + auto *dlg = new SearchButtonListDialog(popupStack, "MythSearchListDialog", this, ""); if (dlg->Create()) { @@ -3594,8 +3591,7 @@ void MythUIButtonListItem::SetToRealButton(MythUIStateType *button, bool selecte } // End compatibility code - MythUIGroup *buttonstate = dynamic_cast<MythUIGroup *> - (button->GetState(state)); + auto *buttonstate = dynamic_cast<MythUIGroup *>(button->GetState(state)); if (!buttonstate) { LOG(VB_GENERAL, LOG_CRIT, QString("Theme Error: Missing buttonlist state: %1") @@ -3656,7 +3652,7 @@ void MythUIButtonListItem::SetToRealButton(MythUIStateType *button, bool selecte while (string_it != m_strings.end()) { - MythUIText *text = dynamic_cast<MythUIText *> + auto *text = dynamic_cast<MythUIText *> (buttonstate->GetChild(string_it.key())); if (text) @@ -3712,9 +3708,8 @@ void MythUIButtonListItem::SetToRealButton(MythUIStateType *button, bool selecte while (imagefile_it != m_imageFilenames.end()) { - MythUIImage *image = dynamic_cast<MythUIImage *> + auto *image = dynamic_cast<MythUIImage *> (buttonstate->GetChild(imagefile_it.key())); - if (image) { if (!imagefile_it.value().isEmpty()) @@ -3733,9 +3728,8 @@ void MythUIButtonListItem::SetToRealButton(MythUIStateType *button, bool selecte while (image_it != m_images.end()) { - MythUIImage *image = dynamic_cast<MythUIImage *> + auto *image = dynamic_cast<MythUIImage *> (buttonstate->GetChild(image_it.key())); - if (image) { if (image_it.value()) @@ -3751,9 +3745,8 @@ void MythUIButtonListItem::SetToRealButton(MythUIStateType *button, bool selecte while (state_it != m_states.end()) { - MythUIStateType *statetype = dynamic_cast<MythUIStateType *> + auto *statetype = dynamic_cast<MythUIStateType *> (buttonstate->GetChild(state_it.key())); - if (statetype) { if (!statetype->DisplayState(state_it.value())) diff --git a/mythtv/libs/libmythui/mythuibuttontree.cpp b/mythtv/libs/libmythui/mythuibuttontree.cpp index 832b0000c26..1e2e43c327e 100644 --- a/mythtv/libs/libmythui/mythuibuttontree.cpp +++ b/mythtv/libs/libmythui/mythuibuttontree.cpp @@ -50,7 +50,7 @@ void MythUIButtonTree::Init() while (i < (int)m_numLists) { QString listname = QString("buttontree list %1").arg(i); - MythUIButtonList *list = new MythUIButtonList(this, listname); + auto *list = new MythUIButtonList(this, listname); list->CopyFrom(m_listTemplate); list->SetVisible(false); list->SetActive(false); @@ -387,7 +387,7 @@ void MythUIButtonTree::RemoveItem(MythUIButtonListItem *item, bool deleteNode) if (!item || !m_rootNode) return; - MythGenericTree *node = item->GetData().value<MythGenericTree *>(); + auto *node = item->GetData().value<MythGenericTree *>(); if (node && node->getParent()) { @@ -523,7 +523,7 @@ void MythUIButtonTree::handleSelect(MythUIButtonListItem *item) m_activeList = list; - MythGenericTree *node = item->GetData().value<MythGenericTree *> (); + auto *node = item->GetData().value<MythGenericTree *> (); DoSetCurrentNode(node); SetTreeState(); } @@ -538,7 +538,7 @@ void MythUIButtonTree::handleClick(MythUIButtonListItem *item) if (!item) return; - MythGenericTree *node = item->GetData().value<MythGenericTree *>(); + auto *node = item->GetData().value<MythGenericTree *>(); if (DoSetCurrentNode(node)) emit itemClicked(item); @@ -633,7 +633,7 @@ bool MythUIButtonTree::gestureEvent(MythGestureEvent *event) if (!type) return false; - MythUIButtonList *list = dynamic_cast<MythUIButtonList *>(type); + auto *list = dynamic_cast<MythUIButtonList *>(type); if (list) handled = list->gestureEvent(event); @@ -669,7 +669,7 @@ bool MythUIButtonTree::ParseElement( */ void MythUIButtonTree::CreateCopy(MythUIType *parent) { - MythUIButtonTree *bt = new MythUIButtonTree(parent, objectName()); + auto *bt = new MythUIButtonTree(parent, objectName()); bt->CopyFrom(this); } @@ -678,7 +678,7 @@ void MythUIButtonTree::CreateCopy(MythUIType *parent) */ void MythUIButtonTree::CopyFrom(MythUIType *base) { - MythUIButtonTree *bt = dynamic_cast<MythUIButtonTree *>(base); + auto *bt = dynamic_cast<MythUIButtonTree *>(base); if (!bt) return; diff --git a/mythtv/libs/libmythui/mythuicheckbox.cpp b/mythtv/libs/libmythui/mythuicheckbox.cpp index f3b126ad301..f44e8bf3e6a 100644 --- a/mythtv/libs/libmythui/mythuicheckbox.cpp +++ b/mythtv/libs/libmythui/mythuicheckbox.cpp @@ -186,7 +186,7 @@ bool MythUICheckBox::keyPressEvent(QKeyEvent *event) */ void MythUICheckBox::CreateCopy(MythUIType *parent) { - MythUICheckBox *checkbox = new MythUICheckBox(parent, objectName()); + auto *checkbox = new MythUICheckBox(parent, objectName()); checkbox->CopyFrom(this); } @@ -195,7 +195,7 @@ void MythUICheckBox::CreateCopy(MythUIType *parent) */ void MythUICheckBox::CopyFrom(MythUIType *base) { - MythUICheckBox *button = dynamic_cast<MythUICheckBox *>(base); + auto *button = dynamic_cast<MythUICheckBox *>(base); if (!button) { diff --git a/mythtv/libs/libmythui/mythuiclock.cpp b/mythtv/libs/libmythui/mythuiclock.cpp index b3f5272e327..877e4815b74 100644 --- a/mythtv/libs/libmythui/mythuiclock.cpp +++ b/mythtv/libs/libmythui/mythuiclock.cpp @@ -109,7 +109,7 @@ bool MythUIClock::ParseElement( */ void MythUIClock::CopyFrom(MythUIType *base) { - MythUIClock *clock = dynamic_cast<MythUIClock *>(base); + auto *clock = dynamic_cast<MythUIClock *>(base); if (!clock) { @@ -135,6 +135,6 @@ void MythUIClock::CopyFrom(MythUIType *base) */ void MythUIClock::CreateCopy(MythUIType *parent) { - MythUIClock *clock = new MythUIClock(parent, objectName()); + auto *clock = new MythUIClock(parent, objectName()); clock->CopyFrom(this); } diff --git a/mythtv/libs/libmythui/mythuicomposite.cpp b/mythtv/libs/libmythui/mythuicomposite.cpp index 11e1e3abae7..d484b93e7ea 100644 --- a/mythtv/libs/libmythui/mythuicomposite.cpp +++ b/mythtv/libs/libmythui/mythuicomposite.cpp @@ -15,11 +15,11 @@ void MythUIComposite::SetTextFromMap(const InfoMap &infoMap) { MythUIType *type = i.next(); - MythUIText *textType = dynamic_cast<MythUIText *> (type); + auto *textType = dynamic_cast<MythUIText *> (type); if (textType) textType->SetTextFromMap(infoMap); - MythUIComposite *group = dynamic_cast<MythUIComposite *> (type); + auto *group = dynamic_cast<MythUIComposite *> (type); if (group) group->SetTextFromMap(infoMap); } @@ -37,11 +37,11 @@ void MythUIComposite::ResetMap(const InfoMap &infoMap) { MythUIType *type = i.next(); - MythUIText *textType = dynamic_cast<MythUIText *> (type); + auto *textType = dynamic_cast<MythUIText *> (type); if (textType) textType->ResetMap(infoMap); - MythUIComposite *group = dynamic_cast<MythUIComposite *> (type); + auto *group = dynamic_cast<MythUIComposite *> (type); if (group) group->ResetMap(infoMap); } diff --git a/mythtv/libs/libmythui/mythuieditbar.cpp b/mythtv/libs/libmythui/mythuieditbar.cpp index 6ff9a6fd35d..4253109a94c 100644 --- a/mythtv/libs/libmythui/mythuieditbar.cpp +++ b/mythtv/libs/libmythui/mythuieditbar.cpp @@ -127,12 +127,12 @@ void MythUIEditBar::Display(void) return; } - MythUIShape *barshape = dynamic_cast<MythUIShape *>(cut); - MythUIImage *barimage = dynamic_cast<MythUIImage *>(cut); - MythUIShape *leftshape = dynamic_cast<MythUIShape *>(cuttoleft); - MythUIImage *leftimage = dynamic_cast<MythUIImage *>(cuttoleft); - MythUIShape *rightshape = dynamic_cast<MythUIShape *>(cuttoright); - MythUIImage *rightimage = dynamic_cast<MythUIImage *>(cuttoright); + auto *barshape = dynamic_cast<MythUIShape *>(cut); + auto *barimage = dynamic_cast<MythUIImage *>(cut); + auto *leftshape = dynamic_cast<MythUIShape *>(cuttoleft); + auto *leftimage = dynamic_cast<MythUIImage *>(cuttoleft); + auto *rightshape = dynamic_cast<MythUIShape *>(cuttoright); + auto *rightimage = dynamic_cast<MythUIImage *>(cuttoright); QListIterator<QPair<float, float> > regions(m_regions); @@ -202,8 +202,8 @@ void MythUIEditBar::AddBar(MythUIShape *_shape, MythUIImage *_image, if (add) { - MythUIShape *shape = dynamic_cast<MythUIShape *>(add); - MythUIImage *image = dynamic_cast<MythUIImage *>(add); + auto *shape = dynamic_cast<MythUIShape *>(add); + auto *image = dynamic_cast<MythUIImage *>(add); if (shape) shape->SetCropRect(area.left(), area.top(), area.width(), area.height()); @@ -235,7 +235,7 @@ MythUIType *MythUIEditBar::GetNew(MythUIShape *shape, MythUIImage *image) if (shape) { - MythUIShape *newshape = new MythUIShape(this, name); + auto *newshape = new MythUIShape(this, name); if (newshape) { @@ -247,7 +247,7 @@ MythUIType *MythUIEditBar::GetNew(MythUIShape *shape, MythUIImage *image) } else if (image) { - MythUIImage *newimage = new MythUIImage(this, name); + auto *newimage = new MythUIImage(this, name); if (newimage) { @@ -304,7 +304,7 @@ void MythUIEditBar::ClearImages(void) */ void MythUIEditBar::CopyFrom(MythUIType *base) { - MythUIEditBar *editbar = dynamic_cast<MythUIEditBar *>(base); + auto *editbar = dynamic_cast<MythUIEditBar *>(base); if (!editbar) return; @@ -324,7 +324,7 @@ void MythUIEditBar::CopyFrom(MythUIType *base) */ void MythUIEditBar::CreateCopy(MythUIType *parent) { - MythUIEditBar *editbar = new MythUIEditBar(parent, objectName()); + auto *editbar = new MythUIEditBar(parent, objectName()); editbar->CopyFrom(this); } diff --git a/mythtv/libs/libmythui/mythuifilebrowser.cpp b/mythtv/libs/libmythui/mythuifilebrowser.cpp index 82ac23e5a04..2920bb7c71b 100644 --- a/mythtv/libs/libmythui/mythuifilebrowser.cpp +++ b/mythtv/libs/libmythui/mythuifilebrowser.cpp @@ -291,9 +291,8 @@ void MythUIFileBrowser::PathClicked(MythUIButtonListItem *item) { if (m_retObject) { - DialogCompletionEvent *dce = - new DialogCompletionEvent(m_id, 0, finfo.filePath(), - item->GetData()); + auto *dce = new DialogCompletionEvent(m_id, 0, finfo.filePath(), + item->GetData()); QCoreApplication::postEvent(m_retObject, dce); } @@ -400,9 +399,8 @@ void MythUIFileBrowser::OKPressed() if (m_retObject) { QString selectedPath = m_locationEdit->GetText(); - DialogCompletionEvent *dce = new DialogCompletionEvent(m_id, 0, - selectedPath, - item->GetData()); + auto *dce = new DialogCompletionEvent(m_id, 0, selectedPath, + item->GetData()); QCoreApplication::postEvent(m_retObject, dce); } @@ -493,9 +491,8 @@ void MythUIFileBrowser::updateRemoteFileList() m_parentSGDir = ""; } - MythUIButtonListItem *item = new MythUIButtonListItem( - m_fileList, displayName, - qVariantFromValue(finfo)); + auto *item = new MythUIButtonListItem(m_fileList, displayName, + qVariantFromValue(finfo)); item->SetText(QString("0"), "filesize"); item->SetText(m_parentDir, "fullpath"); @@ -570,9 +567,8 @@ void MythUIFileBrowser::updateRemoteFileList() continue; } - MythUIButtonListItem *item = - new MythUIButtonListItem(m_fileList, displayName, - qVariantFromValue(finfo)); + auto *item = new MythUIButtonListItem(m_fileList, displayName, + qVariantFromValue(finfo)); if (finfo.size()) item->SetText(FormatSize(finfo.size()), "filesize"); @@ -610,8 +606,8 @@ void MythUIFileBrowser::updateLocalFileList() if (list.isEmpty()) { - MythUIButtonListItem *item = new MythUIButtonListItem(m_fileList, - tr("Parent Directory")); + auto *item = new MythUIButtonListItem(m_fileList, + tr("Parent Directory")); item->DisplayState("upfolder", "nodetype"); } else @@ -657,9 +653,8 @@ void MythUIFileBrowser::updateLocalFileList() type = "file"; } - MythUIButtonListItem *item = - new MythUIButtonListItem(m_fileList, displayName, - qVariantFromValue(finfo)); + auto *item = new MythUIButtonListItem(m_fileList, displayName, + qVariantFromValue(finfo)); if (IsImage(finfo.suffix())) { diff --git a/mythtv/libs/libmythui/mythuigroup.cpp b/mythtv/libs/libmythui/mythuigroup.cpp index 3222162cced..71eea2ad518 100644 --- a/mythtv/libs/libmythui/mythuigroup.cpp +++ b/mythtv/libs/libmythui/mythuigroup.cpp @@ -8,8 +8,7 @@ void MythUIGroup::Reset() void MythUIGroup::CopyFrom(MythUIType *base) { - MythUIGroup *group = dynamic_cast<MythUIGroup *>(base); - + auto *group = dynamic_cast<MythUIGroup *>(base); if (!group) return; @@ -18,6 +17,6 @@ void MythUIGroup::CopyFrom(MythUIType *base) void MythUIGroup::CreateCopy(MythUIType *parent) { - MythUIGroup *group = new MythUIGroup(parent, objectName()); + auto *group = new MythUIGroup(parent, objectName()); group->CopyFrom(this); } diff --git a/mythtv/libs/libmythui/mythuiguidegrid.cpp b/mythtv/libs/libmythui/mythuiguidegrid.cpp index 5982b023845..9b97259b4aa 100644 --- a/mythtv/libs/libmythui/mythuiguidegrid.cpp +++ b/mythtv/libs/libmythui/mythuiguidegrid.cpp @@ -212,7 +212,7 @@ bool MythUIGuideGrid::ParseElement( void MythUIGuideGrid::CopyFrom(MythUIType *base) { - MythUIGuideGrid *gg = dynamic_cast<MythUIGuideGrid *>(base); + auto *gg = dynamic_cast<MythUIGuideGrid *>(base); if (!gg) { @@ -247,7 +247,7 @@ void MythUIGuideGrid::CopyFrom(MythUIType *base) void MythUIGuideGrid::CreateCopy(MythUIType *parent) { - MythUIGuideGrid *gg = new MythUIGuideGrid(parent, objectName()); + auto *gg = new MythUIGuideGrid(parent, objectName()); gg->CopyFrom(this); } @@ -505,8 +505,8 @@ void MythUIGuideGrid::drawBox(MythPainter *p, int xoffset, int yoffset, UIGTCon area.translate(xoffset, yoffset); // Convert to global coordinates area.adjust(breakin, breakin, -breakin, -breakin); - static const QPen nopen(Qt::NoPen); - p->DrawRect(area, QBrush(calcColor(color, m_categoryAlpha)), nopen, alphaMod); + static const QPen kNoPen(Qt::NoPen); + p->DrawRect(area, QBrush(calcColor(color, m_categoryAlpha)), kNoPen, alphaMod); } /** \fn MythUIGuideGrid::drawBackground(MythPainter *, int, int, UIGTCon *, int) @@ -602,13 +602,13 @@ void MythUIGuideGrid::drawBackground(MythPainter *p, int xoffset, int yoffset, U if (area.height() <= 1) area.setHeight(2); - static const QPen nopen(Qt::NoPen); + static const QPen kNoPen(Qt::NoPen); area.translate(xoffset, yoffset); // Convert to global coordinates - p->DrawRect(area, QBrush(fillColor), nopen, alphaMod); + p->DrawRect(area, QBrush(fillColor), kNoPen, alphaMod); if (overArea.width() > 0) { overArea.translate(xoffset, yoffset); // Convert to global coordinates - p->DrawRect(overArea, QBrush(overColor), nopen, alphaMod); + p->DrawRect(overArea, QBrush(overColor), kNoPen, alphaMod); } } @@ -689,7 +689,7 @@ void MythUIGuideGrid::SetProgramInfo(int row, int col, const QRect &area, bool selected) { (void)col; - UIGTCon *data = new UIGTCon(area, title, genre, arrow, recType, recStat); + auto *data = new UIGTCon(area, title, genre, arrow, recType, recStat); m_allData[row].append(data); if (m_drawCategoryColors) @@ -774,7 +774,7 @@ void MythUIGuideGrid::SetCategoryColors(const QMap<QString, QString> &catC) void MythUIGuideGrid::LoadImage(int recType, const QString &file) { - MythUIImage *uiimage = new MythUIImage(file, this, "guidegrid image"); + auto *uiimage = new MythUIImage(file, this, "guidegrid image"); uiimage->m_imageProperties.m_isThemeImage = true; uiimage->SetVisible(false); uiimage->Load(false); @@ -786,7 +786,7 @@ void MythUIGuideGrid::LoadImage(int recType, const QString &file) void MythUIGuideGrid::SetArrow(int direction, const QString &file) { - MythUIImage *uiimage = new MythUIImage(file, this, "guidegrid arrow"); + auto *uiimage = new MythUIImage(file, this, "guidegrid arrow"); uiimage->m_imageProperties.m_isThemeImage = true; uiimage->SetVisible(false); uiimage->Load(false); diff --git a/mythtv/libs/libmythui/mythuihelper.cpp b/mythtv/libs/libmythui/mythuihelper.cpp index 09ad10d723d..697de4f3e12 100644 --- a/mythtv/libs/libmythui/mythuihelper.cpp +++ b/mythtv/libs/libmythui/mythuihelper.cpp @@ -94,7 +94,7 @@ class MythUIHelperPrivate explicit MythUIHelperPrivate(MythUIHelper *p) : m_cacheLock(new QMutex(QMutex::Recursive)), m_imageThreadPool(new MThreadPool("MythUIHelper")), - parent(p) {} + m_parent(p) {} ~MythUIHelperPrivate(); void Init(); @@ -172,9 +172,9 @@ class MythUIHelperPrivate MThreadPool *m_imageThreadPool {nullptr}; - MythUIMenuCallbacks callbacks {nullptr,nullptr,nullptr,nullptr,nullptr}; + MythUIMenuCallbacks m_callbacks {nullptr,nullptr,nullptr,nullptr,nullptr}; - MythUIHelper *parent {nullptr}; + MythUIHelper *m_parent {nullptr}; int m_fontStretch {100}; @@ -406,7 +406,7 @@ MythUIHelper::~MythUIHelper() void MythUIHelper::Init(MythUIMenuCallbacks &cbs) { d->Init(); - d->callbacks = cbs; + d->m_callbacks = cbs; d->m_maxCacheSize.fetchAndStoreRelease( GetMythDB()->GetNumSetting("UIImageCacheSize", 30) * 1024 * 1024); @@ -427,7 +427,7 @@ void MythUIHelper::Init(void) MythUIMenuCallbacks *MythUIHelper::GetMenuCBs(void) { - return &(d->callbacks); + return &(d->m_callbacks); } bool MythUIHelper::IsScreenSetup(void) @@ -463,8 +463,7 @@ void MythUIHelper::LoadQtConfig(void) QString themename = GetMythDB()->GetSetting("Theme", DEFAULT_UI_THEME); QString themedir = FindThemeDir(themename); - ThemeInfo *themeinfo = new ThemeInfo(themedir); - + auto *themeinfo = new ThemeInfo(themedir); if (themeinfo) { d->m_isWide = themeinfo->IsWide(); @@ -752,19 +751,19 @@ bool MythUIHelper::IsImageInCache(const QString &url) QString MythUIHelper::GetThemeCacheDir(void) { - static QString oldcachedir; + static QString s_oldcachedir; QString tmpcachedir = GetThemeBaseCacheDir() + "/" + GetMythDB()->GetSetting("Theme", DEFAULT_UI_THEME) + "." + QString::number(d->m_screenwidth) + "." + QString::number(d->m_screenheight); - if (tmpcachedir != oldcachedir) + if (tmpcachedir != s_oldcachedir) { LOG(VB_GUI | VB_FILE, LOG_INFO, LOC + QString("Creating cache dir: %1").arg(tmpcachedir)); QDir dir; dir.mkdir(tmpcachedir); - oldcachedir = tmpcachedir; + s_oldcachedir = tmpcachedir; } return tmpcachedir; } diff --git a/mythtv/libs/libmythui/mythuihelper.h b/mythtv/libs/libmythui/mythuihelper.h index 304ac0b554b..7a9982c06dc 100644 --- a/mythtv/libs/libmythui/mythuihelper.h +++ b/mythtv/libs/libmythui/mythuihelper.h @@ -21,13 +21,13 @@ class QWidget; class QPixmap; class QSize; -typedef enum ImageCacheMode +enum ImageCacheMode { kCacheNormal = 0x0, kCacheIgnoreDisk = 0x1, kCacheCheckMemoryOnly = 0x2, kCacheForceStat = 0x4, -} ImageCacheMode; +}; struct MUI_PUBLIC MythUIMenuCallbacks { diff --git a/mythtv/libs/libmythui/mythuiimage.cpp b/mythtv/libs/libmythui/mythuiimage.cpp index f36dcb06372..bc175d29b37 100644 --- a/mythtv/libs/libmythui/mythuiimage.cpp +++ b/mythtv/libs/libmythui/mythuiimage.cpp @@ -391,9 +391,8 @@ class ImageLoader QString frameFilename; int imageCount = 1; - MythImageReader *imageReader = new MythImageReader(imProps.m_filename); - - AnimationFrames *images = new AnimationFrames(); + auto *imageReader = new MythImageReader(imProps.m_filename); + auto *images = new AnimationFrames(); while (imageReader->canRead() && !aborted) { @@ -478,7 +477,7 @@ QEvent::Type ImageLoadEvent::kEventType = class ImageLoadThread : public QRunnable { public: - ImageLoadThread(const MythUIImage *parent, MythPainter *painter, + ImageLoadThread(MythUIImage *parent, MythPainter *painter, const ImageProperties &imProps, QString basefile, int number, ImageCacheMode mode) : m_parent(parent), m_painter(painter), m_imageProperties(imProps), @@ -503,11 +502,10 @@ class ImageLoadThread : public QRunnable if (frames && frames->count() > 1) { - ImageLoadEvent *le = new ImageLoadEvent(m_parent, frames, - m_basefile, - m_imageProperties.m_filename, - aborted); - QCoreApplication::postEvent(const_cast<MythUIImage*>(m_parent), le); + auto *le = new ImageLoadEvent(m_parent, frames, m_basefile, + m_imageProperties.m_filename, + aborted); + QCoreApplication::postEvent(m_parent, le); return; } @@ -519,14 +517,14 @@ class ImageLoadThread : public QRunnable m_cacheMode, m_parent, aborted); - ImageLoadEvent *le = new ImageLoadEvent(m_parent, image, m_basefile, - m_imageProperties.m_filename, - m_number, aborted); - QCoreApplication::postEvent(const_cast<MythUIImage*>(m_parent), le); + auto *le = new ImageLoadEvent(m_parent, image, m_basefile, + m_imageProperties.m_filename, + m_number, aborted); + QCoreApplication::postEvent(m_parent, le); } private: - const MythUIImage *m_parent {nullptr}; + MythUIImage *m_parent {nullptr}; MythPainter *m_painter {nullptr}; ImageProperties m_imageProperties; QString m_basefile; @@ -544,7 +542,7 @@ class MythUIImagePrivate MythUIImage *m_parent {nullptr}; - QReadWriteLock m_UpdateLock {QReadWriteLock::Recursive}; + QReadWriteLock m_updateLock {QReadWriteLock::Recursive}; }; ///////////////////////////////////////////////////////////////// @@ -612,7 +610,7 @@ MythUIImage::~MythUIImage() */ void MythUIImage::Clear(void) { - QWriteLocker updateLocker(&d->m_UpdateLock); + QWriteLocker updateLocker(&d->m_updateLock); QMutexLocker locker(&m_ImagesLock); while (!m_Images.isEmpty()) @@ -640,7 +638,7 @@ void MythUIImage::Clear(void) */ void MythUIImage::Reset(void) { - d->m_UpdateLock.lockForWrite(); + d->m_updateLock.lockForWrite(); SetMinArea(MythRect()); @@ -657,11 +655,11 @@ void MythUIImage::Reset(void) } emit DependChanged(true); - d->m_UpdateLock.unlock(); + d->m_updateLock.unlock(); Load(); } else - d->m_UpdateLock.unlock(); + d->m_updateLock.unlock(); MythUIType::Reset(); } @@ -671,7 +669,7 @@ void MythUIImage::Reset(void) */ void MythUIImage::SetFilename(const QString &filename) { - QWriteLocker updateLocker(&d->m_UpdateLock); + QWriteLocker updateLocker(&d->m_updateLock); m_imageProperties.m_isThemeImage = false; m_imageProperties.m_filename = filename; if (filename == m_OrigFilename) @@ -687,7 +685,7 @@ void MythUIImage::SetFilename(const QString &filename) void MythUIImage::SetFilepattern(const QString &filepattern, int low, int high) { - QWriteLocker updateLocker(&d->m_UpdateLock); + QWriteLocker updateLocker(&d->m_updateLock); m_imageProperties.m_isThemeImage = false; m_imageProperties.m_filename = filepattern; m_LowNum = low; @@ -703,7 +701,7 @@ void MythUIImage::SetFilepattern(const QString &filepattern, int low, */ void MythUIImage::SetImageCount(int low, int high) { - QWriteLocker updateLocker(&d->m_UpdateLock); + QWriteLocker updateLocker(&d->m_updateLock); m_LowNum = low; m_HighNum = high; } @@ -713,7 +711,7 @@ void MythUIImage::SetImageCount(int low, int high) */ void MythUIImage::SetDelay(int delayms) { - QWriteLocker updateLocker(&d->m_UpdateLock); + QWriteLocker updateLocker(&d->m_updateLock); m_Delay = delayms; m_LastDisplay = QTime::currentTime(); m_CurPos = 0; @@ -724,7 +722,7 @@ void MythUIImage::SetDelay(int delayms) */ void MythUIImage::SetDelays(QVector<int> delays) { - QWriteLocker updateLocker(&d->m_UpdateLock); + QWriteLocker updateLocker(&d->m_updateLock); QMutexLocker imageLocker(&m_ImagesLock); for (auto it = delays.begin(); it != delays.end(); ++it) @@ -743,11 +741,11 @@ void MythUIImage::SetDelays(QVector<int> delays) */ void MythUIImage::SetImage(MythImage *img) { - d->m_UpdateLock.lockForWrite(); + d->m_updateLock.lockForWrite(); if (!img) { - d->m_UpdateLock.unlock(); + d->m_updateLock.unlock(); Reset(); return; } @@ -793,7 +791,7 @@ void MythUIImage::SetImage(MythImage *img) m_Initiator = m_EnableInitiator; SetRedraw(); - d->m_UpdateLock.unlock(); + d->m_updateLock.unlock(); } /** @@ -805,7 +803,7 @@ void MythUIImage::SetImages(QVector<MythImage *> *images) { Clear(); - QWriteLocker updateLocker(&d->m_UpdateLock); + QWriteLocker updateLocker(&d->m_updateLock); QSize aSize = GetFullArea().size(); m_imageProperties.m_isThemeImage = false; @@ -897,9 +895,9 @@ void MythUIImage::ForceSize(const QSize &size) if (m_imageProperties.m_forceSize == size) return; - d->m_UpdateLock.lockForWrite(); + d->m_updateLock.lockForWrite(); m_imageProperties.m_forceSize = size; - d->m_UpdateLock.unlock(); + d->m_updateLock.unlock(); if (size.isEmpty()) return; @@ -931,7 +929,7 @@ void MythUIImage::SetSize(int width, int height) */ void MythUIImage::SetSize(const QSize &size) { - QWriteLocker updateLocker(&d->m_UpdateLock); + QWriteLocker updateLocker(&d->m_updateLock); MythUIType::SetSize(size); m_NeedLoad = true; } @@ -951,7 +949,7 @@ void MythUIImage::SetCropRect(int x, int y, int width, int height) */ void MythUIImage::SetCropRect(const MythRect &rect) { - QWriteLocker updateLocker(&d->m_UpdateLock); + QWriteLocker updateLocker(&d->m_updateLock); m_imageProperties.m_cropRect = rect; SetRedraw(); } @@ -961,13 +959,13 @@ void MythUIImage::SetCropRect(const MythRect &rect) */ bool MythUIImage::Load(bool allowLoadInBackground, bool forceStat) { - d->m_UpdateLock.lockForRead(); + d->m_updateLock.lockForRead(); m_Initiator = m_EnableInitiator; QString bFilename = m_imageProperties.m_filename; - d->m_UpdateLock.unlock(); + d->m_updateLock.unlock(); QString filename = bFilename; @@ -1038,8 +1036,7 @@ bool MythUIImage::Load(bool allowLoadInBackground, bool forceStat) QString("Load(), spawning thread to load '%1'").arg(filename)); m_runningThreads++; - ImageLoadThread *bImgThread = - new ImageLoadThread(this, GetPainter(), + auto *bImgThread = new ImageLoadThread(this, GetPainter(), imProps, bFilename, i, static_cast<ImageCacheMode>(cacheMode2)); GetMythUI()->GetImageThreadPool()->start(bImgThread, "ImageLoad"); @@ -1100,9 +1097,9 @@ bool MythUIImage::Load(bool allowLoadInBackground, bool forceStat) m_ImagesLock.unlock(); SetRedraw(); - d->m_UpdateLock.lockForWrite(); + d->m_updateLock.lockForWrite(); m_LastDisplay = QTime::currentTime(); - d->m_UpdateLock.unlock(); + d->m_updateLock.unlock(); } else { @@ -1132,7 +1129,7 @@ bool MythUIImage::Load(bool allowLoadInBackground, bool forceStat) */ void MythUIImage::Pulse(void) { - d->m_UpdateLock.lockForWrite(); + d->m_updateLock.lockForWrite(); int delay = -1; @@ -1147,9 +1144,9 @@ void MythUIImage::Pulse(void) if (m_showingRandomImage) { FindRandomImage(); - d->m_UpdateLock.unlock(); + d->m_updateLock.unlock(); Load(); - d->m_UpdateLock.lockForWrite(); + d->m_updateLock.lockForWrite(); } else { @@ -1189,7 +1186,7 @@ void MythUIImage::Pulse(void) MythUIType::Pulse(); - d->m_UpdateLock.unlock(); + d->m_updateLock.unlock(); } /** @@ -1202,7 +1199,7 @@ void MythUIImage::DrawSelf(MythPainter *p, int xoffset, int yoffset, if (!m_Images.empty()) { - d->m_UpdateLock.lockForWrite(); + d->m_updateLock.lockForWrite(); if (m_CurPos >= (uint)m_Images.size()) m_CurPos = 0; @@ -1232,12 +1229,12 @@ void MythUIImage::DrawSelf(MythPainter *p, int xoffset, int yoffset, currentImage->IncrRef(); m_ImagesLock.unlock(); - d->m_UpdateLock.unlock(); + d->m_updateLock.unlock(); if (!currentImage) return; - d->m_UpdateLock.lockForRead(); + d->m_updateLock.lockForRead(); QRect currentImageArea = currentImage->rect(); @@ -1268,7 +1265,7 @@ void MythUIImage::DrawSelf(MythPainter *p, int xoffset, int yoffset, p->SetClipRect(clipRect); p->DrawImage(area, currentImage, srcRect, alpha); currentImage->DecrRef(); - d->m_UpdateLock.unlock(); + d->m_updateLock.unlock(); } else m_ImagesLock.unlock(); @@ -1280,7 +1277,7 @@ void MythUIImage::DrawSelf(MythPainter *p, int xoffset, int yoffset, bool MythUIImage::ParseElement( const QString &filename, QDomElement &element, bool showWarnings) { - QWriteLocker updateLocker(&d->m_UpdateLock); + QWriteLocker updateLocker(&d->m_updateLock); if (element.tagName() == "filename") { @@ -1420,16 +1417,15 @@ bool MythUIImage::ParseElement( */ void MythUIImage::CopyFrom(MythUIType *base) { - d->m_UpdateLock.lockForWrite(); - MythUIImage *im = dynamic_cast<MythUIImage *>(base); - + d->m_updateLock.lockForWrite(); + auto *im = dynamic_cast<MythUIImage *>(base); if (!im) { LOG(VB_GENERAL, LOG_ERR, QString("'%1' (%2) ERROR, bad parsing '%3' (%4)") .arg(objectName()).arg(GetXMLLocation()) .arg(base->objectName()).arg(base->GetXMLLocation())); - d->m_UpdateLock.unlock(); + d->m_updateLock.unlock(); return; } @@ -1459,17 +1455,17 @@ void MythUIImage::CopyFrom(MythUIType *base) m_NeedLoad = im->m_NeedLoad; - d->m_UpdateLock.unlock(); + d->m_updateLock.unlock(); - d->m_UpdateLock.lockForRead(); + d->m_updateLock.lockForRead(); if (m_NeedLoad) { - d->m_UpdateLock.unlock(); + d->m_updateLock.unlock(); Load(); } else - d->m_UpdateLock.unlock(); + d->m_updateLock.unlock(); } /** @@ -1477,8 +1473,8 @@ void MythUIImage::CopyFrom(MythUIType *base) */ void MythUIImage::CreateCopy(MythUIType *parent) { - QReadLocker updateLocker(&d->m_UpdateLock); - MythUIImage *im = new MythUIImage(parent, objectName()); + QReadLocker updateLocker(&d->m_updateLock); + auto *im = new MythUIImage(parent, objectName()); im->CopyFrom(this); } @@ -1487,15 +1483,15 @@ void MythUIImage::CreateCopy(MythUIType *parent) */ void MythUIImage::Finalize(void) { - d->m_UpdateLock.lockForRead(); + d->m_updateLock.lockForRead(); if (m_NeedLoad) { - d->m_UpdateLock.unlock(); + d->m_updateLock.unlock(); Load(); } else - d->m_UpdateLock.unlock(); + d->m_updateLock.unlock(); MythUIType::Finalize(); } @@ -1505,16 +1501,16 @@ void MythUIImage::Finalize(void) */ void MythUIImage::LoadNow(void) { - d->m_UpdateLock.lockForWrite(); + d->m_updateLock.lockForWrite(); if (m_NeedLoad) { - d->m_UpdateLock.unlock(); + d->m_updateLock.unlock(); return; } m_NeedLoad = true; - d->m_UpdateLock.unlock(); + d->m_updateLock.unlock(); Load(false); @@ -1528,8 +1524,7 @@ void MythUIImage::customEvent(QEvent *event) { if (event->type() == ImageLoadEvent::kEventType) { - ImageLoadEvent *le = static_cast<ImageLoadEvent *>(event); - + auto *le = static_cast<ImageLoadEvent *>(event); if (le->GetParent() != this) return; @@ -1541,9 +1536,9 @@ void MythUIImage::customEvent(QEvent *event) m_runningThreads--; - d->m_UpdateLock.lockForRead(); + d->m_updateLock.lockForRead(); QString propFilename = m_imageProperties.m_filename; - d->m_UpdateLock.unlock(); + d->m_updateLock.unlock(); // 1) We aborted loading the image for some reason (e.g. two requests // for same image) @@ -1587,7 +1582,7 @@ void MythUIImage::customEvent(QEvent *event) if ((m_HighNum == m_LowNum) && !m_animatedImage) Clear(); - d->m_UpdateLock.lockForWrite(); + d->m_updateLock.lockForWrite(); if (m_imageProperties.m_forceSize.isNull()) SetSize(image->size()); @@ -1596,7 +1591,7 @@ void MythUIImage::customEvent(QEvent *event) rect.setSize(image->size()); SetMinArea(rect); - d->m_UpdateLock.unlock(); + d->m_updateLock.unlock(); m_ImagesLock.lock(); @@ -1613,9 +1608,9 @@ void MythUIImage::customEvent(QEvent *event) SetRedraw(); - d->m_UpdateLock.lockForWrite(); + d->m_updateLock.lockForWrite(); m_LastDisplay = QTime::currentTime(); - d->m_UpdateLock.unlock(); + d->m_updateLock.unlock(); } else { diff --git a/mythtv/libs/libmythui/mythuiimage.h b/mythtv/libs/libmythui/mythuiimage.h index b3b35b43da2..70da35313b2 100644 --- a/mythtv/libs/libmythui/mythuiimage.h +++ b/mythtv/libs/libmythui/mythuiimage.h @@ -84,8 +84,8 @@ class ImageProperties QString m_maskImageFilename; }; -typedef QPair<MythImage *, int> AnimationFrame; -typedef QVector<AnimationFrame> AnimationFrames; +using AnimationFrame = QPair<MythImage *, int>; +using AnimationFrames = QVector<AnimationFrame>; /** * \class MythUIImage diff --git a/mythtv/libs/libmythui/mythuiprogressbar.cpp b/mythtv/libs/libmythui/mythuiprogressbar.cpp index 35d41c0ab04..cdfb4e78e52 100644 --- a/mythtv/libs/libmythui/mythuiprogressbar.cpp +++ b/mythtv/libs/libmythui/mythuiprogressbar.cpp @@ -138,8 +138,8 @@ void MythUIProgressBar::CalculatePosition(void) break; } - MythUIImage *progressImage = dynamic_cast<MythUIImage *>(progressType); - MythUIShape *progressShape = dynamic_cast<MythUIShape *>(progressType); + auto *progressImage = dynamic_cast<MythUIImage *>(progressType); + auto *progressShape = dynamic_cast<MythUIShape *>(progressType); if (width <= 0) width = 1; @@ -162,7 +162,7 @@ void MythUIProgressBar::Finalize() void MythUIProgressBar::CopyFrom(MythUIType *base) { - MythUIProgressBar *progressbar = dynamic_cast<MythUIProgressBar *>(base); + auto *progressbar = dynamic_cast<MythUIProgressBar *>(base); if (!progressbar) return; @@ -179,7 +179,7 @@ void MythUIProgressBar::CopyFrom(MythUIType *base) void MythUIProgressBar::CreateCopy(MythUIType *parent) { - MythUIProgressBar *progressbar = new MythUIProgressBar(parent, objectName()); + auto *progressbar = new MythUIProgressBar(parent, objectName()); progressbar->CopyFrom(this); } diff --git a/mythtv/libs/libmythui/mythuiscrollbar.cpp b/mythtv/libs/libmythui/mythuiscrollbar.cpp index 774d94762c7..030d53ab53f 100644 --- a/mythtv/libs/libmythui/mythuiscrollbar.cpp +++ b/mythtv/libs/libmythui/mythuiscrollbar.cpp @@ -145,7 +145,7 @@ void MythUIScrollBar::Finalize() void MythUIScrollBar::CopyFrom(MythUIType *base) { - MythUIScrollBar *scrollbar = dynamic_cast<MythUIScrollBar *>(base); + auto *scrollbar = dynamic_cast<MythUIScrollBar *>(base); if (!scrollbar) return; @@ -158,7 +158,7 @@ void MythUIScrollBar::CopyFrom(MythUIType *base) void MythUIScrollBar::CreateCopy(MythUIType *parent) { - MythUIScrollBar *scrollbar = new MythUIScrollBar(parent, objectName()); + auto *scrollbar = new MythUIScrollBar(parent, objectName()); scrollbar->CopyFrom(this); } diff --git a/mythtv/libs/libmythui/mythuishape.cpp b/mythtv/libs/libmythui/mythuishape.cpp index 446f413a21f..5c653c17751 100644 --- a/mythtv/libs/libmythui/mythuishape.cpp +++ b/mythtv/libs/libmythui/mythuishape.cpp @@ -149,7 +149,7 @@ bool MythUIShape::ParseElement( */ void MythUIShape::CopyFrom(MythUIType *base) { - MythUIShape *shape = dynamic_cast<MythUIShape *>(base); + auto *shape = dynamic_cast<MythUIShape *>(base); if (!shape) { @@ -171,6 +171,6 @@ void MythUIShape::CopyFrom(MythUIType *base) */ void MythUIShape::CreateCopy(MythUIType *parent) { - MythUIShape *shape = new MythUIShape(parent, objectName()); + auto *shape = new MythUIShape(parent, objectName()); shape->CopyFrom(this); } diff --git a/mythtv/libs/libmythui/mythuisimpletext.cpp b/mythtv/libs/libmythui/mythuisimpletext.cpp index 037c639280a..a83bac67d23 100644 --- a/mythtv/libs/libmythui/mythuisimpletext.cpp +++ b/mythtv/libs/libmythui/mythuisimpletext.cpp @@ -44,7 +44,7 @@ void MythUISimpleText::DrawSelf(MythPainter *p, int xoffset, int yoffset, void MythUISimpleText::CopyFrom(MythUIType *base) { - MythUISimpleText *text = dynamic_cast<MythUISimpleText *>(base); + auto *text = dynamic_cast<MythUISimpleText *>(base); if (!text) { @@ -61,6 +61,6 @@ void MythUISimpleText::CopyFrom(MythUIType *base) void MythUISimpleText::CreateCopy(MythUIType *parent) { - MythUISimpleText *text = new MythUISimpleText(parent, objectName()); + auto *text = new MythUISimpleText(parent, objectName()); text->CopyFrom(this); } diff --git a/mythtv/libs/libmythui/mythuispinbox.cpp b/mythtv/libs/libmythui/mythuispinbox.cpp index 7d7ac2383df..59503a819fe 100644 --- a/mythtv/libs/libmythui/mythuispinbox.cpp +++ b/mythtv/libs/libmythui/mythuispinbox.cpp @@ -178,7 +178,7 @@ bool MythUISpinBox::MoveUp(MovementUnit unit, uint amount) */ void MythUISpinBox::CreateCopy(MythUIType *parent) { - MythUISpinBox *spinbox = new MythUISpinBox(parent, objectName()); + auto *spinbox = new MythUISpinBox(parent, objectName()); spinbox->CopyFrom(this); } @@ -187,7 +187,7 @@ void MythUISpinBox::CreateCopy(MythUIType *parent) */ void MythUISpinBox::CopyFrom(MythUIType *base) { - MythUISpinBox *spinbox = dynamic_cast<MythUISpinBox *>(base); + auto *spinbox = dynamic_cast<MythUISpinBox *>(base); if (!spinbox) return; @@ -265,7 +265,7 @@ void MythUISpinBox::ShowEntryDialog(QString initialEntry) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - SpinBoxEntryDialog *dlg = new SpinBoxEntryDialog(popupStack, "SpinBoxEntryDialog", + auto *dlg = new SpinBoxEntryDialog(popupStack, "SpinBoxEntryDialog", this, std::move(initialEntry), m_low, m_high, m_step); if (dlg->Create()) diff --git a/mythtv/libs/libmythui/mythuistatetracker.cpp b/mythtv/libs/libmythui/mythuistatetracker.cpp index dcbd0084531..093df5099b5 100644 --- a/mythtv/libs/libmythui/mythuistatetracker.cpp +++ b/mythtv/libs/libmythui/mythuistatetracker.cpp @@ -44,7 +44,7 @@ void MythUIStateTracker::GetFreshState(QVariantMap &state) return; } - MythEvent *e = new MythEvent(ACTION_GETSTATUS); + auto *e = new MythEvent(ACTION_GETSTATUS); qApp->postEvent(GetMythMainWindow(), e); int tries = 0; diff --git a/mythtv/libs/libmythui/mythuistatetype.cpp b/mythtv/libs/libmythui/mythuistatetype.cpp index b510378e7dd..f18dee16f4a 100644 --- a/mythtv/libs/libmythui/mythuistatetype.cpp +++ b/mythtv/libs/libmythui/mythuistatetype.cpp @@ -28,7 +28,7 @@ bool MythUIStateType::AddImage(const QString &name, MythImage *image) // Uses name, not key which is lower case otherwise we break // inheritance - MythUIImage *imType = new MythUIImage(this, name); + auto *imType = new MythUIImage(this, name); imType->SetImage(image); return AddObject(key, imType); @@ -59,7 +59,7 @@ bool MythUIStateType::AddImage(StateType type, MythImage *image) QString name = QString("stateimage%1").arg(type); - MythUIImage *imType = new MythUIImage(this, name); + auto *imType = new MythUIImage(this, name); imType->SetImage(image); return AddObject(type, imType); @@ -263,7 +263,7 @@ bool MythUIStateType::ParseElement( void MythUIStateType::CopyFrom(MythUIType *base) { - MythUIStateType *st = dynamic_cast<MythUIStateType *>(base); + auto *st = dynamic_cast<MythUIStateType *>(base); if (!st) return; @@ -299,7 +299,7 @@ void MythUIStateType::CopyFrom(MythUIType *base) void MythUIStateType::CreateCopy(MythUIType *parent) { - MythUIStateType *st = new MythUIStateType(parent, objectName()); + auto *st = new MythUIStateType(parent, objectName()); st->CopyFrom(this); } @@ -340,7 +340,7 @@ void MythUIStateType::RecalculateArea(bool recurse) { if (objectName().startsWith("buttonlist button")) { - MythUIButtonList *list = static_cast<MythUIButtonList *>(m_Parent); + auto *list = static_cast<MythUIButtonList *>(m_Parent); m_ParentArea = list->GetButtonArea(); } else @@ -395,11 +395,11 @@ void MythUIStateType::SetTextFromMap(const InfoMap &infoMap) { MythUIType *type = i.value(); - MythUIText *textType = dynamic_cast<MythUIText *> (type); + auto *textType = dynamic_cast<MythUIText *> (type); if (textType) textType->SetTextFromMap(infoMap); - MythUIComposite *group = dynamic_cast<MythUIComposite *> (type); + auto *group = dynamic_cast<MythUIComposite *> (type); if (group) group->SetTextFromMap(infoMap); } @@ -410,11 +410,11 @@ void MythUIStateType::SetTextFromMap(const InfoMap &infoMap) { MythUIType *type = j.value(); - MythUIText *textType = dynamic_cast<MythUIText *> (type); + auto *textType = dynamic_cast<MythUIText *> (type); if (textType) textType->SetTextFromMap(infoMap); - MythUIComposite *group = dynamic_cast<MythUIComposite *> (type); + auto *group = dynamic_cast<MythUIComposite *> (type); if (group) group->SetTextFromMap(infoMap); } diff --git a/mythtv/libs/libmythui/mythuitext.cpp b/mythtv/libs/libmythui/mythuitext.cpp index 3e8e11abe03..a12f0cacd91 100644 --- a/mythtv/libs/libmythui/mythuitext.cpp +++ b/mythtv/libs/libmythui/mythuitext.cpp @@ -754,7 +754,7 @@ bool MythUIText::GetNarrowWidth(const QStringList & paragraphs, qreal lines = roundf((height - m_drawRect.height()) / line_height); lines -= (1.0 - last_line_width / width); width += (lines * width) / - ((float)m_drawRect.height() / line_height); + ((double)m_drawRect.height() / line_height); if (width > best_width || static_cast<int>(width) == last_width) { @@ -1615,7 +1615,7 @@ bool MythUIText::ParseElement( void MythUIText::CopyFrom(MythUIType *base) { - MythUIText *text = dynamic_cast<MythUIText *>(base); + auto *text = dynamic_cast<MythUIText *>(base); if (!text) { @@ -1682,7 +1682,7 @@ void MythUIText::CopyFrom(MythUIType *base) void MythUIText::CreateCopy(MythUIType *parent) { - MythUIText *text = new MythUIText(parent, objectName()); + auto *text = new MythUIText(parent, objectName()); text->CopyFrom(this); } diff --git a/mythtv/libs/libmythui/mythuitextedit.cpp b/mythtv/libs/libmythui/mythuitextedit.cpp index a665755b07f..13e5dcc346a 100644 --- a/mythtv/libs/libmythui/mythuitextedit.cpp +++ b/mythtv/libs/libmythui/mythuitextedit.cpp @@ -382,7 +382,7 @@ void MythUITextEdit::PasteTextFromClipboard(QClipboard::Mode mode) InsertText(clipboard->text(mode)); } -typedef QPair<int, int> keyCombo; +using keyCombo = QPair<int, int>; static QMap<keyCombo, int> gDeadKeyMap; static void LoadDeadKeys(QMap<QPair<int, int>, int> &map) @@ -527,7 +527,7 @@ bool MythUITextEdit::keyPressEvent(QKeyEvent *event) && GetMythDB()->GetNumSetting("UseVirtualKeyboard", 1) == 1) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIVirtualKeyboard *kb = new MythUIVirtualKeyboard(popupStack, this); + auto *kb = new MythUIVirtualKeyboard(popupStack, this); if (kb->Create()) { @@ -576,7 +576,7 @@ bool MythUITextEdit::gestureEvent(MythGestureEvent *event) void MythUITextEdit::CopyFrom(MythUIType *base) { - MythUITextEdit *textedit = dynamic_cast<MythUITextEdit *>(base); + auto *textedit = dynamic_cast<MythUITextEdit *>(base); if (!textedit) { @@ -600,6 +600,6 @@ void MythUITextEdit::CopyFrom(MythUIType *base) void MythUITextEdit::CreateCopy(MythUIType *parent) { - MythUITextEdit *textedit = new MythUITextEdit(parent, objectName()); + auto *textedit = new MythUITextEdit(parent, objectName()); textedit->CopyFrom(this); } diff --git a/mythtv/libs/libmythui/mythuitype.cpp b/mythtv/libs/libmythui/mythuitype.cpp index f7b111be0c9..bc6bc26a6c5 100644 --- a/mythtv/libs/libmythui/mythuitype.cpp +++ b/mythtv/libs/libmythui/mythuitype.cpp @@ -498,10 +498,10 @@ void MythUIType::Draw(MythPainter *p, int xoffset, int yoffset, int alphaMod, if (p->ShowBorders()) { - static const QBrush nullbrush(Qt::NoBrush); + static const QBrush kNullBrush(Qt::NoBrush); QPen pen(m_BorderColor); pen.setWidth(1); - p->DrawRect(realArea, nullbrush, pen, 255); + p->DrawRect(realArea, kNullBrush, pen, 255); if (p->ShowTypeNames()) { @@ -1070,7 +1070,7 @@ void MythUIType::UpdateDependState(MythUIType *dependee, bool isDefault) void MythUIType::UpdateDependState(bool isDefault) { - MythUIType *dependee = static_cast<MythUIType*>(sender()); + auto *dependee = static_cast<MythUIType*>(sender()); UpdateDependState(dependee, isDefault); } @@ -1172,7 +1172,7 @@ void MythUIType::CopyFrom(MythUIType *base) QList<MythUIAnimation*>::Iterator i; for (i = base->m_animations.begin(); i != base->m_animations.end(); ++i) { - MythUIAnimation* animation = new MythUIAnimation(this); + auto* animation = new MythUIAnimation(this); animation->CopyFrom(*i); m_animations.push_back(animation); } diff --git a/mythtv/libs/libmythui/mythuiutils.h b/mythtv/libs/libmythui/mythuiutils.h index 27f15e8bcf6..1552f5412cc 100644 --- a/mythtv/libs/libmythui/mythuiutils.h +++ b/mythtv/libs/libmythui/mythuiutils.h @@ -49,7 +49,7 @@ struct UIUtilDisp } }; -typedef struct UIUtilDisp<ETPrintWarning> UIUtilW; -typedef struct UIUtilDisp<ETPrintError> UIUtilE; +using UIUtilW = struct UIUtilDisp<ETPrintWarning>; +using UIUtilE = struct UIUtilDisp<ETPrintError>; #endif diff --git a/mythtv/libs/libmythui/mythuivideo.cpp b/mythtv/libs/libmythui/mythuivideo.cpp index a6abfe8cdf6..cae01dc2832 100644 --- a/mythtv/libs/libmythui/mythuivideo.cpp +++ b/mythtv/libs/libmythui/mythuivideo.cpp @@ -119,6 +119,6 @@ void MythUIVideo::CopyFrom(MythUIType *base) */ void MythUIVideo::CreateCopy(MythUIType *parent) { - MythUIVideo *im = new MythUIVideo(parent, objectName()); + auto *im = new MythUIVideo(parent, objectName()); im->CopyFrom(this); } diff --git a/mythtv/libs/libmythui/mythuiwebbrowser.cpp b/mythtv/libs/libmythui/mythuiwebbrowser.cpp index 726af0e2267..241dd40f055 100644 --- a/mythtv/libs/libmythui/mythuiwebbrowser.cpp +++ b/mythtv/libs/libmythui/mythuiwebbrowser.cpp @@ -39,9 +39,9 @@ struct MimeType { - QString mimeType; - QString extension; - bool isVideo; + QString m_mimeType; + QString m_extension; + bool m_isVideo; }; static MimeType SupportedMimeTypes[] = @@ -244,7 +244,7 @@ void BrowserApi::customEvent(QEvent *e) { if (e->type() == MythEvent::MythEventMessage) { - MythEvent *me = static_cast<MythEvent *>(e); + auto *me = static_cast<MythEvent *>(e); const QString& message = me->Message(); if (!message.startsWith("MUSIC_CONTROL")) @@ -291,7 +291,7 @@ bool MythWebPage::extension(Extension extension, const ExtensionOption *option, if (!option || !output) return false; - const ErrorPageExtensionOption *erroroption + const auto *erroroption = static_cast<const ErrorPageExtensionOption *>(option); ErrorPageExtensionReturn *erroroutput = nullptr; erroroutput = static_cast<ErrorPageExtensionReturn *>(output); @@ -536,9 +536,8 @@ void MythWebView::doDownloadRequested(const QNetworkRequest &request) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); QString msg = tr("Enter filename to save file"); - MythTextInputDialog *input = new MythTextInputDialog(popupStack, msg, - FilterNone, false, - saveFilename); + auto *input = new MythTextInputDialog(popupStack, msg, FilterNone, + false, saveFilename); if (input->Create()) { @@ -592,7 +591,7 @@ void MythWebView::customEvent(QEvent *event) { if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent *)(event); + auto *dce = (DialogCompletionEvent *)(event); // make sure the user didn't ESCAPE out of the dialog if (dce->GetResult() < 0) @@ -641,7 +640,7 @@ void MythWebView::customEvent(QEvent *event) } else if (event->type() == MythEvent::MythEventMessage) { - MythEvent *me = static_cast<MythEvent *>(event); + auto *me = static_cast<MythEvent *>(event); QStringList tokens = me->Message().split(" ", QString::SkipEmptyParts); if (tokens.isEmpty()) @@ -686,7 +685,7 @@ void MythWebView::showDownloadMenu(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menu = new MythDialogBox(label, popupStack, "downloadmenu"); + auto *menu = new MythDialogBox(label, popupStack, "downloadmenu"); if (!menu->Create()) { @@ -712,8 +711,8 @@ QString MythWebView::getExtensionForMimetype(const QString &mimetype) { for (int x = 0; x < SupportedMimeTypesCount; x++) { - if (!mimetype.isEmpty() && mimetype == SupportedMimeTypes[x].mimeType) - return SupportedMimeTypes[x].extension; + if (!mimetype.isEmpty() && mimetype == SupportedMimeTypes[x].m_mimeType) + return SupportedMimeTypes[x].m_extension; } return QString(""); @@ -723,14 +722,14 @@ bool MythWebView::isMusicFile(const QString &extension, const QString &mimetype) { for (int x = 0; x < SupportedMimeTypesCount; x++) { - if (!SupportedMimeTypes[x].isVideo) + if (!SupportedMimeTypes[x].m_isVideo) { if (!mimetype.isEmpty() && - mimetype == SupportedMimeTypes[x].mimeType) + mimetype == SupportedMimeTypes[x].m_mimeType) return true; if (!extension.isEmpty() && - extension.toLower() == SupportedMimeTypes[x].extension) + extension.toLower() == SupportedMimeTypes[x].m_extension) return true; } } @@ -742,14 +741,14 @@ bool MythWebView::isVideoFile(const QString &extension, const QString &mimetype) { for (int x = 0; x < SupportedMimeTypesCount; x++) { - if (SupportedMimeTypes[x].isVideo) + if (SupportedMimeTypes[x].m_isVideo) { if (!mimetype.isEmpty() && - mimetype == SupportedMimeTypes[x].mimeType) + mimetype == SupportedMimeTypes[x].m_mimeType) return true; if (!extension.isEmpty() && - extension.toLower() == SupportedMimeTypes[x].extension) + extension.toLower() == SupportedMimeTypes[x].m_extension) return true; } } @@ -1680,7 +1679,7 @@ void MythUIWebBrowser::HandleMouseAction(const QString &action) { curPos = widget->mapFromGlobal(curPos); - QMouseEvent *me = new QMouseEvent(QEvent::MouseButtonPress, curPos, + auto *me = new QMouseEvent(QEvent::MouseButtonPress, curPos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); QCoreApplication::postEvent(widget, me); @@ -1763,8 +1762,7 @@ bool MythUIWebBrowser::ParseElement( */ void MythUIWebBrowser::CopyFrom(MythUIType *base) { - MythUIWebBrowser *browser = dynamic_cast<MythUIWebBrowser *>(base); - + auto *browser = dynamic_cast<MythUIWebBrowser *>(base); if (!browser) { LOG(VB_GENERAL, LOG_ERR, "ERROR, bad parsing"); @@ -1789,6 +1787,6 @@ void MythUIWebBrowser::CopyFrom(MythUIType *base) */ void MythUIWebBrowser::CreateCopy(MythUIType *parent) { - MythUIWebBrowser *browser = new MythUIWebBrowser(parent, objectName()); + auto *browser = new MythUIWebBrowser(parent, objectName()); browser->CopyFrom(this); } diff --git a/mythtv/libs/libmythui/mythvirtualkeyboard.cpp b/mythtv/libs/libmythui/mythvirtualkeyboard.cpp index 85e2bdcedfe..c4b5355bd0b 100644 --- a/mythtv/libs/libmythui/mythvirtualkeyboard.cpp +++ b/mythtv/libs/libmythui/mythvirtualkeyboard.cpp @@ -282,7 +282,7 @@ void MythUIVirtualKeyboard::updateKeys(bool connectSignals) QList<MythUIType *> *children = GetAllChildren(); for (int i = 0; i < children->size(); ++i) { - MythUIButton *button = dynamic_cast<MythUIButton *>(children->at(i)); + auto *button = dynamic_cast<MythUIButton *>(children->at(i)); if (button) { if (m_keyMap.contains(button->objectName())) @@ -422,7 +422,7 @@ void MythUIVirtualKeyboard::charClicked(void) if (m_parentEdit) { - QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, 0, Qt::NoModifier, c); + auto *event = new QKeyEvent(QEvent::KeyPress, 0, Qt::NoModifier, c); m_parentEdit->keyPressEvent(event); } @@ -442,7 +442,7 @@ void MythUIVirtualKeyboard::charClicked(void) if (m_parentEdit) { - QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, 0, Qt::NoModifier, c); + auto *event = new QKeyEvent(QEvent::KeyPress, 0, Qt::NoModifier, c); m_parentEdit->keyPressEvent(event); } @@ -483,7 +483,7 @@ void MythUIVirtualKeyboard::delClicked(void) if (m_parentEdit) { //QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Delete, Qt::NoModifier, ""); - QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier, ""); + auto *event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier, ""); m_parentEdit->keyPressEvent(event); } } @@ -494,7 +494,7 @@ void MythUIVirtualKeyboard::backClicked(void) if (m_parentEdit) { - QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier, ""); + auto *event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier, ""); m_parentEdit->keyPressEvent(event); } } @@ -530,7 +530,7 @@ void MythUIVirtualKeyboard::returnClicked(void) if (m_shift) { emit keyPressed("{NEWLINE}"); - QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, m_newlineKey.keyCode, m_newlineKey.modifiers, ""); + auto *event = new QKeyEvent(QEvent::KeyPress, m_newlineKey.keyCode, m_newlineKey.modifiers, ""); m_parentEdit->keyPressEvent(event); } else @@ -544,13 +544,13 @@ void MythUIVirtualKeyboard::moveleftClicked(void) if (m_shift) { emit keyPressed("{MOVEUP}"); - QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, m_upKey.keyCode, m_upKey.modifiers, ""); + auto *event = new QKeyEvent(QEvent::KeyPress, m_upKey.keyCode, m_upKey.modifiers, ""); m_parentEdit->keyPressEvent(event); } else { emit keyPressed("{MOVELEFT}"); - QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, m_leftKey.keyCode, m_leftKey.modifiers,""); + auto *event = new QKeyEvent(QEvent::KeyPress, m_leftKey.keyCode, m_leftKey.modifiers,""); m_parentEdit->keyPressEvent(event); } } @@ -563,13 +563,13 @@ void MythUIVirtualKeyboard::moverightClicked(void) if (m_shift) { emit keyPressed("{MOVEDOWN}"); - QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, m_downKey.keyCode, m_downKey.modifiers, ""); + auto *event = new QKeyEvent(QEvent::KeyPress, m_downKey.keyCode, m_downKey.modifiers, ""); m_parentEdit->keyPressEvent(event); } else { emit keyPressed("{MOVERIGHT}"); - QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, m_rightKey.keyCode, m_rightKey.modifiers,""); + auto *event = new QKeyEvent(QEvent::KeyPress, m_rightKey.keyCode, m_rightKey.modifiers,""); m_parentEdit->keyPressEvent(event); } } diff --git a/mythtv/libs/libmythui/opengl/mythegl.h b/mythtv/libs/libmythui/opengl/mythegl.h index 2818bd676e9..95c1a05d5ac 100644 --- a/mythtv/libs/libmythui/opengl/mythegl.h +++ b/mythtv/libs/libmythui/opengl/mythegl.h @@ -7,9 +7,9 @@ // MythTV #include "mythuiexp.h" -typedef void ( * MYTH_EGLIMAGETARGET) (GLenum, void*); -typedef void* ( * MYTH_EGLCREATEIMAGE) (void*, void*, unsigned int, void*, const int32_t *); -typedef void ( * MYTH_EGLDESTROYIMAGE) (void*, void*); +using MYTH_EGLIMAGETARGET = void (*)(GLenum, void*); +using MYTH_EGLCREATEIMAGE = void* (*)(void*, void*, unsigned int, void*, const int32_t *); +using MYTH_EGLDESTROYIMAGE = void (*)(void*, void*); class MythRenderOpenGL; @@ -22,7 +22,7 @@ class MUI_PUBLIC MythEGL bool IsEGL(void); bool HasEGLExtension(QString Extension); void* GetEGLDisplay(void); - qint32 GetEGLError(void); + static qint32 GetEGLError(void); void eglImageTargetTexture2DOES (GLenum Target, void* Image); void* eglCreateImageKHR (void* Disp, void* Context, unsigned int Target, void* Buffer, const int32_t *Attributes); diff --git a/mythtv/libs/libmythui/opengl/mythopenglperf.cpp b/mythtv/libs/libmythui/opengl/mythopenglperf.cpp index 87330a79bfb..2c1a49a5d66 100644 --- a/mythtv/libs/libmythui/opengl/mythopenglperf.cpp +++ b/mythtv/libs/libmythui/opengl/mythopenglperf.cpp @@ -1,17 +1,20 @@ +// C++ +#include <utility> + // MythTV #include "mythlogging.h" #include "mythopenglperf.h" + /*! \class MythOpenGLPerf * \brief A simple overload of QOpenGLTimeMonitor to record and log OpenGL execution intervals */ -MythOpenGLPerf::MythOpenGLPerf(const QString &Name, +MythOpenGLPerf::MythOpenGLPerf(QString Name, QVector<QString> Names, int SampleCount) - : QOpenGLTimeMonitor(), - m_name(Name), + : m_name(std::move(Name)), m_totalSamples(SampleCount), - m_timerNames(Names) + m_timerNames(std::move(Names)) { while (m_timerData.size() < m_timerNames.size()) m_timerData.append(0); diff --git a/mythtv/libs/libmythui/opengl/mythopenglperf.h b/mythtv/libs/libmythui/opengl/mythopenglperf.h index be29f92f2dc..5f0eb4a302b 100644 --- a/mythtv/libs/libmythui/opengl/mythopenglperf.h +++ b/mythtv/libs/libmythui/opengl/mythopenglperf.h @@ -9,7 +9,7 @@ #if defined(QT_OPENGL_ES_2) #ifndef GLuint64 -typedef uint64_t GLuint64; +using GLuint64 = uint64_t; #endif class QOpenGLTimeMonitor @@ -33,7 +33,7 @@ class QOpenGLTimeMonitor class MUI_PUBLIC MythOpenGLPerf : public QOpenGLTimeMonitor { public: - MythOpenGLPerf(const QString &Name, QVector<QString> Names, int SampleCount = 30); + MythOpenGLPerf(QString Name, QVector<QString> Names, int SampleCount = 30); void RecordSample (void); void LogSamples (void); int GetTimersRunning(void); diff --git a/mythtv/libs/libmythui/opengl/mythpainteropengl.cpp b/mythtv/libs/libmythui/opengl/mythpainteropengl.cpp index c4871bac006..ef0cabcdd53 100644 --- a/mythtv/libs/libmythui/opengl/mythpainteropengl.cpp +++ b/mythtv/libs/libmythui/opengl/mythpainteropengl.cpp @@ -13,16 +13,8 @@ using namespace std; MythOpenGLPainter::MythOpenGLPainter(MythRenderOpenGL *Render, QWidget *Parent) - : MythPainter(), - m_parent(Parent), - m_render(Render), - m_target(nullptr), - m_swapControl(true), - m_imageToTextureMap(), - m_ImageExpireList(), - m_textureDeleteList(), - m_textureDeleteLock(), - m_mappedTextures() + : m_parent(Parent), + m_render(Render) { m_mappedTextures.reserve(MAX_BUFFER_POOL); } @@ -64,7 +56,7 @@ void MythOpenGLPainter::DeleteTextures(void) while (!m_textureDeleteList.empty()) { MythGLTexture *texture = m_textureDeleteList.front(); - m_HardwareCacheSize -= m_render->GetTextureDataSize(texture); + m_HardwareCacheSize -= MythRenderOpenGL::GetTextureDataSize(texture); m_render->DeleteTexture(texture); m_textureDeleteList.pop_front(); } @@ -94,7 +86,7 @@ void MythOpenGLPainter::Begin(QPaintDevice *Parent) if (!m_render) { - MythPainterWindowGL* glwin = static_cast<MythPainterWindowGL*>(m_parent); + auto* glwin = static_cast<MythPainterWindowGL*>(m_parent); if (!glwin) { LOG(VB_GENERAL, LOG_ERR, "FATAL ERROR: Failed to cast parent to MythPainterWindowGL"); @@ -203,7 +195,7 @@ MythGLTexture* MythOpenGLPainter::GetTextureFromCache(MythImage *Image) } CheckFormatImage(Image); - m_HardwareCacheSize += m_render->GetTextureDataSize(texture); + m_HardwareCacheSize += MythRenderOpenGL::GetTextureDataSize(texture); m_imageToTextureMap[Image] = texture; m_ImageExpireList.push_back(Image); diff --git a/mythtv/libs/libmythui/opengl/mythpainteropengl.h b/mythtv/libs/libmythui/opengl/mythpainteropengl.h index 4262e79c495..e859d557855 100644 --- a/mythtv/libs/libmythui/opengl/mythpainteropengl.h +++ b/mythtv/libs/libmythui/opengl/mythpainteropengl.h @@ -55,10 +55,10 @@ class MUI_PUBLIC MythOpenGLPainter : public MythPainter void DeleteFormatImagePriv(MythImage *Image) override; protected: - QWidget *m_parent; - MythRenderOpenGL *m_render; - QOpenGLFramebufferObject* m_target; - bool m_swapControl; + QWidget *m_parent { nullptr }; + MythRenderOpenGL *m_render { nullptr }; + QOpenGLFramebufferObject* m_target { nullptr }; + bool m_swapControl { true }; QMap<MythImage *, MythGLTexture*> m_imageToTextureMap; std::list<MythImage *> m_ImageExpireList; diff --git a/mythtv/libs/libmythui/opengl/mythrenderopengl.cpp b/mythtv/libs/libmythui/opengl/mythrenderopengl.cpp index ee62c5800d3..5741784e6b8 100644 --- a/mythtv/libs/libmythui/opengl/mythrenderopengl.cpp +++ b/mythtv/libs/libmythui/opengl/mythrenderopengl.cpp @@ -70,13 +70,13 @@ MythRenderOpenGL* MythRenderOpenGL::GetOpenGLRender(void) if (!window) return nullptr; - MythRenderOpenGL* result = dynamic_cast<MythRenderOpenGL*>(window->GetRenderDevice()); + auto* result = dynamic_cast<MythRenderOpenGL*>(window->GetRenderDevice()); if (result) return result; return nullptr; } -MythRenderOpenGL* MythRenderOpenGL::Create(const QString&, QPaintDevice* Device) +MythRenderOpenGL* MythRenderOpenGL::Create(const QString& /*Painter*/, QPaintDevice* Device) { QString display = getenv("DISPLAY"); // Determine if we are running a remote X11 session @@ -126,48 +126,16 @@ MythRenderOpenGL* MythRenderOpenGL::Create(const QString&, QPaintDevice* Device) MythRenderOpenGL::MythRenderOpenGL(const QSurfaceFormat& Format, QPaintDevice* Device, RenderType Type) - : QOpenGLContext(), - QOpenGLFunctions(), - MythEGL(this), + : MythEGL(this), MythRender(Type), - m_activeFramebuffer(nullptr), - m_fence(0), - m_activeProgram(nullptr), - m_cachedVertices(), - m_vertexExpiry(), - m_cachedVBOS(), - m_vboExpiry(), - m_lock(QMutex::Recursive), - m_lockLevel(0), - m_features(Multitexture), - m_extraFeatures(kGLFeatNone), - m_extraFeaturesUsed(kGLFeatNone), - m_maxTextureSize(0), - m_maxTextureUnits(0), - m_colorDepth(0), - m_coreProfile(false), - m_viewport(), - m_activeTexture(0), - m_blend(false), - m_background(0x00000000), - m_fullRange(gCoreContext->GetBoolSetting("GUIRGBLevels", true)), - m_projection(), - m_transforms(), - m_parameters(), - m_cachedMatrixUniforms(), - m_cachedUniformLocations(), - m_vao(0), - m_flushEnabled(true), - m_openglDebugger(nullptr), - m_openGLDebuggerFilter(QOpenGLDebugMessage::InvalidType), - m_window(nullptr) + m_fullRange(gCoreContext->GetBoolSetting("GUIRGBLevels", true)) { memset(m_defaultPrograms, 0, sizeof(m_defaultPrograms)); m_projection.fill(0); m_parameters.fill(0); m_transforms.push(QMatrix4x4()); - QWidget *w = dynamic_cast<QWidget*>(Device); + auto *w = dynamic_cast<QWidget*>(Device); m_window = (w) ? w->windowHandle() : nullptr; setFormat(Format); @@ -241,6 +209,8 @@ void MythRenderOpenGL:: logDebugMarker(const QString &Message) } } +// Can't be static because its connected to a signal and passed "this". +// NOLINTNEXTLINE(readability-convert-member-functions-to-static) void MythRenderOpenGL::contextToBeDestroyed(void) { LOG(VB_GENERAL, LOG_WARNING, LOC + "Context about to be destroyed"); @@ -274,7 +244,7 @@ bool MythRenderOpenGL::Init(void) m_openglDebugger->startLogging(mode); if (mode == QOpenGLDebugLogger::AsynchronousLogging) LOG(VB_GENERAL, LOG_INFO, LOC + "GPU debug logging started (async)"); - else + else LOG(VB_GENERAL, LOG_INFO, LOC + "Started synchronous GPU debug logging (will hurt performance)"); // filter messages. Some drivers can be extremely verbose for certain issues. @@ -400,14 +370,14 @@ bool MythRenderOpenGL::Init(void) return true; } -#define GLYesNo(arg) (arg ? "Yes" : "No") +#define GLYesNo(arg) ((arg) ? "Yes" : "No") void MythRenderOpenGL::DebugFeatures(void) { - static bool debugged = false; - if (debugged) + static bool s_debugged = false; + if (s_debugged) return; - debugged = true; + s_debugged = true; QSurfaceFormat fmt = format(); QString qtglversion = QString("OpenGL%1 %2.%3") .arg(fmt.renderableType() == QSurfaceFormat::OpenGLES ? "ES" : "") @@ -593,7 +563,7 @@ void MythRenderOpenGL::SetBackground(int r, int g, int b, int a) m_background = tmp; makeCurrent(); - glClearColor(r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f); + glClearColor(r / 255.0F, g / 255.0F, b / 255.0F, a / 255.0F); doneCurrent(); } @@ -603,7 +573,7 @@ MythGLTexture* MythRenderOpenGL::CreateTextureFromQImage(QImage *Image) return nullptr; OpenGLLocker locker(this); - QOpenGLTexture *texture = new QOpenGLTexture(*Image, QOpenGLTexture::DontGenerateMipMaps); + auto *texture = new QOpenGLTexture(*Image, QOpenGLTexture::DontGenerateMipMaps); if (!texture->textureId()) { LOG(VB_GENERAL, LOG_INFO, LOC + "Failed to create texure"); @@ -612,7 +582,7 @@ MythGLTexture* MythRenderOpenGL::CreateTextureFromQImage(QImage *Image) } texture->setMinMagFilters(QOpenGLTexture::Linear, QOpenGLTexture::Linear); texture->setWrapMode(QOpenGLTexture::ClampToEdge); - MythGLTexture *result = new MythGLTexture(texture); + auto *result = new MythGLTexture(texture); result->m_texture = texture; result->m_vbo = CreateVBO(kVertexSize); result->m_totalSize = GetTextureSize(Image->size(), result->m_target != QOpenGLTexture::TargetRectangle); @@ -636,7 +606,7 @@ QSize MythRenderOpenGL::GetTextureSize(const QSize &size, bool Normalised) w *= 2; while (h < size.height()) h *= 2; - return QSize(w, h); + return {w, h}; } int MythRenderOpenGL::GetTextureDataSize(MythGLTexture *Texture) @@ -690,12 +660,9 @@ void MythRenderOpenGL::DeleteTexture(MythGLTexture *Texture) makeCurrent(); // N.B. Don't delete m_textureId - it is owned externally - if (Texture->m_texture) - delete Texture->m_texture; - if (Texture->m_data) - delete [] Texture->m_data; - if (Texture->m_vbo) - delete Texture->m_vbo; + delete Texture->m_texture; + delete [] Texture->m_data; + delete Texture->m_vbo; delete Texture; Flush(); doneCurrent(); @@ -733,7 +700,7 @@ MythGLTexture* MythRenderOpenGL::CreateFramebufferTexture(QOpenGLFramebufferObje if (!Framebuffer) return nullptr; - MythGLTexture *texture = new MythGLTexture(Framebuffer->texture()); + auto *texture = new MythGLTexture(Framebuffer->texture()); texture->m_size = texture->m_totalSize = Framebuffer->size(); texture->m_vbo = CreateVBO(kVertexSize); texture->m_flip = false; @@ -816,12 +783,12 @@ void MythRenderOpenGL::DrawBitmap(MythGLTexture *Texture, QOpenGLFramebufferObje glEnableVertexAttribArray(VERTEX_INDEX); glEnableVertexAttribArray(TEXTURE_INDEX); glVertexAttribPointerI(VERTEX_INDEX, VERTEX_SIZE, GL_FLOAT, GL_FALSE, VERTEX_SIZE * sizeof(GLfloat), kVertexOffset); - glVertexAttrib4f(COLOR_INDEX, 1.0f, 1.0f, 1.0f, Alpha / 255.0f); + glVertexAttrib4f(COLOR_INDEX, 1.0F, 1.0F, 1.0F, Alpha / 255.0F); glVertexAttribPointerI(TEXTURE_INDEX, TEXTURE_SIZE, GL_FLOAT, GL_FALSE, TEXTURE_SIZE * sizeof(GLfloat), kTextureOffset); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glDisableVertexAttribArray(TEXTURE_INDEX); glDisableVertexAttribArray(VERTEX_INDEX); - buffer->release(QOpenGLBuffer::VertexBuffer); + QOpenGLBuffer::release(QOpenGLBuffer::VertexBuffer); doneCurrent(); } @@ -885,12 +852,12 @@ void MythRenderOpenGL::DrawBitmap(MythGLTexture **Textures, uint TextureCount, glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glDisableVertexAttribArray(TEXTURE_INDEX); glDisableVertexAttribArray(VERTEX_INDEX); - buffer->release(QOpenGLBuffer::VertexBuffer); + QOpenGLBuffer::release(QOpenGLBuffer::VertexBuffer); doneCurrent(); } -static const float kLimitedRangeOffset = (16.0f / 255.0f); -static const float kLimitedRangeScale = (219.0f / 255.0f); +static const float kLimitedRangeOffset = (16.0F / 255.0F); +static const float kLimitedRangeScale = (219.0F / 255.0F); /// \brief An optimised method to clear a QRect to the given color void MythRenderOpenGL::ClearRect(QOpenGLFramebufferObject *Target, const QRect &Area, int Color) @@ -900,8 +867,8 @@ void MythRenderOpenGL::ClearRect(QOpenGLFramebufferObject *Target, const QRect & glEnableVertexAttribArray(VERTEX_INDEX); // Set the fill color - float color = m_fullRange ? Color / 255.0f : (Color * kLimitedRangeScale) + kLimitedRangeOffset; - glVertexAttrib4f(COLOR_INDEX, color, color, color, 255.0f); + float color = m_fullRange ? Color / 255.0F : (Color * kLimitedRangeScale) + kLimitedRangeOffset; + glVertexAttrib4f(COLOR_INDEX, color, color, color, 255.0F); SetShaderProgramParams(m_defaultPrograms[kShaderSimple], m_projection, "u_projection"); SetShaderProgramParams(m_defaultPrograms[kShaderSimple], m_transforms.top(), "u_transform"); @@ -960,10 +927,10 @@ void MythRenderOpenGL::DrawRoundRect(QOpenGLFramebufferObject *Target, if (m_fullRange) { glVertexAttrib4f(COLOR_INDEX, - FillBrush.color().red() / 255.0f, - FillBrush.color().green() / 255.0f, - FillBrush.color().blue() / 255.0f, - (FillBrush.color().alpha() / 255.0f) * (Alpha / 255.0f)); + FillBrush.color().red() / 255.0F, + FillBrush.color().green() / 255.0F, + FillBrush.color().blue() / 255.0F, + (FillBrush.color().alpha() / 255.0F) * (Alpha / 255.0F)); } else { @@ -971,12 +938,12 @@ void MythRenderOpenGL::DrawRoundRect(QOpenGLFramebufferObject *Target, (FillBrush.color().red() * kLimitedRangeScale) + kLimitedRangeOffset, (FillBrush.color().blue() * kLimitedRangeScale) + kLimitedRangeOffset, (FillBrush.color().green() * kLimitedRangeScale) + kLimitedRangeOffset, - (FillBrush.color().alpha() / 255.0f) * (Alpha / 255.0f)); + (FillBrush.color().alpha() / 255.0F) * (Alpha / 255.0F)); } // Set the radius m_parameters(2,0) = rad; - m_parameters(3,0) = rad - 1.0f; + m_parameters(3,0) = rad - 1.0F; // Enable the Circle shader SetShaderProgramParams(elip, m_projection, "u_projection"); @@ -1046,10 +1013,10 @@ void MythRenderOpenGL::DrawRoundRect(QOpenGLFramebufferObject *Target, if (m_fullRange) { glVertexAttrib4f(COLOR_INDEX, - LinePen.color().red() / 255.0f, - LinePen.color().green() / 255.0f, - LinePen.color().blue() / 255.0f, - (LinePen.color().alpha() / 255.0f) * (Alpha / 255.0f)); + LinePen.color().red() / 255.0F, + LinePen.color().green() / 255.0F, + LinePen.color().blue() / 255.0F, + (LinePen.color().alpha() / 255.0F) * (Alpha / 255.0F)); } else { @@ -1057,12 +1024,12 @@ void MythRenderOpenGL::DrawRoundRect(QOpenGLFramebufferObject *Target, (LinePen.color().red() * kLimitedRangeScale) + kLimitedRangeOffset, (LinePen.color().blue() * kLimitedRangeScale) + kLimitedRangeOffset, (LinePen.color().green() * kLimitedRangeScale) + kLimitedRangeOffset, - (FillBrush.color().alpha() / 255.0f) * (Alpha / 255.0f)); + (FillBrush.color().alpha() / 255.0F) * (Alpha / 255.0F)); } // Set the radius and width - m_parameters(2,0) = rad - lineWidth / 2.0f; - m_parameters(3,0) = lineWidth / 2.0f; + m_parameters(2,0) = rad - lineWidth / 2.0F; + m_parameters(3,0) = lineWidth / 2.0F; // Enable the edge shader SetShaderProgramParams(edge, m_projection, "u_projection"); @@ -1104,7 +1071,7 @@ void MythRenderOpenGL::DrawRoundRect(QOpenGLFramebufferObject *Target, SetShaderProgramParams(vline, m_projection, "u_projection"); SetShaderProgramParams(vline, m_transforms.top(), "u_transform"); - m_parameters(1,0) = lineWidth / 2.0f; + m_parameters(1,0) = lineWidth / 2.0F; QRect vl(r.left(), r.top() + rad, lineWidth, r.height() - dia); // Draw the left line segment @@ -1164,18 +1131,18 @@ void MythRenderOpenGL::Init2DState(void) glDisable(GL_DEPTH_TEST); glDepthMask(GL_FALSE); glDisable(GL_CULL_FACE); - glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + glClearColor(0.0F, 0.0F, 0.0F, 0.0F); glClear(GL_COLOR_BUFFER_BIT); Flush(); } QFunctionPointer MythRenderOpenGL::GetProcAddress(const QString &Proc) const { - static const QString exts[4] = { "", "ARB", "EXT", "OES" }; + static const QString kExts[4] = { "", "ARB", "EXT", "OES" }; QFunctionPointer result = nullptr; for (int i = 0; i < 4; i++) { - result = getProcAddress((Proc + exts[i]).toLocal8Bit().constData()); + result = getProcAddress((Proc + kExts[i]).toLocal8Bit().constData()); if (result) break; } @@ -1187,14 +1154,14 @@ QFunctionPointer MythRenderOpenGL::GetProcAddress(const QString &Proc) const QOpenGLBuffer* MythRenderOpenGL::CreateVBO(int Size, bool Release /*=true*/) { OpenGLLocker locker(this); - QOpenGLBuffer* buffer = new QOpenGLBuffer(QOpenGLBuffer::VertexBuffer); + auto* buffer = new QOpenGLBuffer(QOpenGLBuffer::VertexBuffer); if (buffer->create()) { buffer->setUsagePattern(QOpenGLBuffer::StreamDraw); buffer->bind(); buffer->allocate(Size); if (Release) - buffer->release(QOpenGLBuffer::VertexBuffer); + QOpenGLBuffer::release(QOpenGLBuffer::VertexBuffer); return buffer; } delete buffer; @@ -1217,15 +1184,14 @@ void MythRenderOpenGL::ReleaseResources(void) } if (VERBOSE_LEVEL_CHECK(VB_GPU, LOG_INFO)) logDebugMarker("RENDER_RELEASE_END"); - if (m_openglDebugger) - delete m_openglDebugger; + delete m_openglDebugger; m_openglDebugger = nullptr; Flush(); - if (m_cachedVertices.size()) + if (!m_cachedVertices.empty()) LOG(VB_GENERAL, LOG_ERR, LOC + QString(" %1 unexpired vertices").arg(m_cachedVertices.size())); - if (m_cachedVBOS.size()) + if (!m_cachedVBOS.empty()) LOG(VB_GENERAL, LOG_ERR, LOC + QString(" %1 unexpired VBOs").arg(m_cachedVertices.size())); } @@ -1329,7 +1295,7 @@ GLfloat* MythRenderOpenGL::GetCachedVertices(GLuint Type, const QRect &Area) return m_cachedVertices[ref]; } - GLfloat *vertices = new GLfloat[8]; + auto *vertices = new GLfloat[8]; vertices[2] = vertices[0] = Area.left(); vertices[5] = vertices[1] = Area.top(); @@ -1396,7 +1362,6 @@ void MythRenderOpenGL::GetCachedVBO(GLuint Type, const QRect &Area) vbo->write(0, vertices, kTextureOffset); } ExpireVBOS(MAX_VERTEX_CACHE); - return; } void MythRenderOpenGL::ExpireVBOS(int Max) @@ -1454,7 +1419,7 @@ int MythRenderOpenGL::GetBufferSize(QSize Size, QOpenGLTexture::PixelFormat Form void MythRenderOpenGL::PushTransformation(const UIEffects &fx, QPointF ¢er) { QMatrix4x4 newtop = m_transforms.top(); - if (fx.m_hzoom != 1.0f || fx.m_vzoom != 1.0f || fx.m_angle != 0.0f) + if (fx.m_hzoom != 1.0F || fx.m_vzoom != 1.0F || fx.m_angle != 0.0F) { newtop.translate(static_cast<GLfloat>(center.x()), static_cast<GLfloat>(center.y())); newtop.scale(fx.m_hzoom, fx.m_vzoom); @@ -1492,7 +1457,7 @@ QOpenGLShaderProgram *MythRenderOpenGL::CreateShaderProgram(const QString &Verte OpenGLLocker locker(this); QString vertex = Vertex.isEmpty() ? kDefaultVertexShader : Vertex; QString fragment = Fragment.isEmpty() ? kDefaultFragmentShader: Fragment; - QOpenGLShaderProgram *program = new QOpenGLShaderProgram(); + auto *program = new QOpenGLShaderProgram(); if (!program->addShaderFromSourceCode(QOpenGLShader::Vertex, vertex)) return ShaderError(program, vertex); if (!program->addShaderFromSourceCode(QOpenGLShader::Fragment, fragment)) @@ -1514,8 +1479,7 @@ QOpenGLShaderProgram *MythRenderOpenGL::CreateShaderProgram(const QString &Verte void MythRenderOpenGL::DeleteShaderProgram(QOpenGLShaderProgram *Program) { makeCurrent(); - if (Program) - delete Program; + delete Program; m_cachedMatrixUniforms.clear(); m_activeProgram = nullptr; m_cachedUniformLocations.remove(Program); diff --git a/mythtv/libs/libmythui/opengl/mythrenderopengl.h b/mythtv/libs/libmythui/opengl/mythrenderopengl.h index 0b2246ec0dc..015bc877fca 100644 --- a/mythtv/libs/libmythui/opengl/mythrenderopengl.h +++ b/mythtv/libs/libmythui/opengl/mythrenderopengl.h @@ -27,14 +27,14 @@ #include "mythuianimation.h" #include "mythegl.h" -typedef enum +enum GLFeatures { kGLFeatNone = 0x0000, kGLBufferMap = 0x0001, kGLExtRects = 0x0002, kGLExtRGBA16 = 0x0004, kGLExtSubimage = 0x0008 -} GLFeatures; +}; #define TEX_OFFSET 8 @@ -66,7 +66,7 @@ class MUI_PUBLIC MythGLTexture Q_DISABLE_COPY(MythGLTexture) }; -typedef enum +enum DefaultShaders { kShaderSimple = 0, kShaderDefault, @@ -75,7 +75,7 @@ typedef enum kShaderVertLine, kShaderHorizLine, kShaderCount, -} DefaultShaders; +}; class QWindow; class QPaintDevice; @@ -118,12 +118,12 @@ class MUI_PUBLIC MythRenderOpenGL : public QOpenGLContext, public QOpenGLFunctio MythGLTexture* CreateTextureFromQImage(QImage *Image); QSize GetTextureSize(const QSize &size, bool Normalised); - int GetTextureDataSize(MythGLTexture *Texture); + static int GetTextureDataSize(MythGLTexture *Texture); void SetTextureFilters(MythGLTexture *Texture, QOpenGLTexture::Filter Filter, QOpenGLTexture::WrapMode Wrap = QOpenGLTexture::ClampToEdge); void ActiveTexture(GLuint ActiveTex); void DeleteTexture(MythGLTexture *Texture); - int GetBufferSize(QSize Size, QOpenGLTexture::PixelFormat Format, QOpenGLTexture::PixelType Type); + static int GetBufferSize(QSize Size, QOpenGLTexture::PixelFormat Format, QOpenGLTexture::PixelType Type); QOpenGLFramebufferObject* CreateFramebuffer(QSize &Size, GLenum InternalFormat = 0); MythGLTexture* CreateFramebufferTexture(QOpenGLFramebufferObject *Framebuffer); @@ -161,8 +161,8 @@ class MUI_PUBLIC MythRenderOpenGL : public QOpenGLContext, public QOpenGLFunctio void Init2DState(void); void SetMatrixView(void); void DeleteFramebuffers(void); - bool UpdateTextureVertices(MythGLTexture *Texture, const QRect &Source, - const QRect &Destination, int Rotation); + static bool UpdateTextureVertices(MythGLTexture *Texture, const QRect &Source, + const QRect &Destination, int Rotation); GLfloat* GetCachedVertices(GLuint Type, const QRect &Area); void ExpireVertices(int Max = 0); void GetCachedVBO(GLuint Type, const QRect &Area); @@ -176,14 +176,14 @@ class MUI_PUBLIC MythRenderOpenGL : public QOpenGLContext, public QOpenGLFunctio GLboolean Normalize, GLsizei Stride, const GLuint Value); // Framebuffers - QOpenGLFramebufferObject *m_activeFramebuffer; + QOpenGLFramebufferObject *m_activeFramebuffer { nullptr }; // Synchronisation - GLuint m_fence; + GLuint m_fence { 0 }; // Shaders QOpenGLShaderProgram* m_defaultPrograms[kShaderCount]; - QOpenGLShaderProgram* m_activeProgram; + QOpenGLShaderProgram* m_activeProgram { nullptr }; // Vertices QMap<uint64_t,GLfloat*> m_cachedVertices; @@ -192,41 +192,41 @@ class MUI_PUBLIC MythRenderOpenGL : public QOpenGLContext, public QOpenGLFunctio QList<uint64_t> m_vboExpiry; // Locking - QMutex m_lock; - int m_lockLevel; + QMutex m_lock { QMutex::Recursive }; + int m_lockLevel { 0 }; // profile - QOpenGLFunctions::OpenGLFeatures m_features; - int m_extraFeatures; - int m_extraFeaturesUsed; - int m_maxTextureSize; - int m_maxTextureUnits; - int m_colorDepth; - bool m_coreProfile; + QOpenGLFunctions::OpenGLFeatures m_features { Multitexture }; + int m_extraFeatures { kGLFeatNone }; + int m_extraFeaturesUsed { kGLFeatNone }; + int m_maxTextureSize { 0 }; + int m_maxTextureUnits { 0 }; + int m_colorDepth { 0 }; + bool m_coreProfile { false }; // State QRect m_viewport; - GLuint m_activeTexture; - bool m_blend; - int32_t m_background; - bool m_fullRange; + GLuint m_activeTexture { 0 }; + bool m_blend { false }; + int32_t m_background { 0x00000000 }; + bool m_fullRange { true }; QMatrix4x4 m_projection; QStack<QMatrix4x4> m_transforms; QMatrix4x4 m_parameters; QHash<QString,QMatrix4x4> m_cachedMatrixUniforms; QHash<QOpenGLShaderProgram*, QHash<QByteArray, GLint> > m_cachedUniformLocations; - GLuint m_vao; // core profile only + GLuint m_vao { 0 }; // core profile only // For Performance improvement set false to disable glFlush. // Needed for Raspberry pi - bool m_flushEnabled; + bool m_flushEnabled { true }; private: Q_DISABLE_COPY(MythRenderOpenGL) void DebugFeatures (void); - QOpenGLDebugLogger *m_openglDebugger; - QOpenGLDebugMessage::Types m_openGLDebuggerFilter; - QWindow *m_window; + QOpenGLDebugLogger *m_openglDebugger { nullptr }; + QOpenGLDebugMessage::Types m_openGLDebuggerFilter { QOpenGLDebugMessage::InvalidType }; + QWindow *m_window { nullptr }; }; class MUI_PUBLIC OpenGLLocker diff --git a/mythtv/libs/libmythui/opengl/mythrenderopengldefs.h b/mythtv/libs/libmythui/opengl/mythrenderopengldefs.h index cd6e7d4318d..e7beea5e413 100644 --- a/mythtv/libs/libmythui/opengl/mythrenderopengldefs.h +++ b/mythtv/libs/libmythui/opengl/mythrenderopengldefs.h @@ -21,9 +21,7 @@ #define APIENTRY #endif -typedef ptrdiff_t MYTH_GLsizeiptr; -typedef GLvoid* (APIENTRY * MYTH_GLMAPBUFFERPROC) - (GLenum target, GLenum access); -typedef GLboolean (APIENTRY * MYTH_GLUNMAPBUFFERPROC) - (GLenum target); +using MYTH_GLsizeiptr = ptrdiff_t; +using MYTH_GLMAPBUFFERPROC = GLvoid* (APIENTRY *) (GLenum target, GLenum access); +using MYTH_GLUNMAPBUFFERPROC = GLboolean (APIENTRY *) (GLenum target); #endif diff --git a/mythtv/libs/libmythui/platforms/mythdisplayx11.cpp b/mythtv/libs/libmythui/platforms/mythdisplayx11.cpp index 31f0283e9e1..6a1265d608f 100644 --- a/mythtv/libs/libmythui/platforms/mythdisplayx11.cpp +++ b/mythtv/libs/libmythui/platforms/mythdisplayx11.cpp @@ -27,15 +27,15 @@ MythDisplayX11::~MythDisplayX11() bool MythDisplayX11::IsAvailable(void) { - static bool checked = false; - static bool available = false; - if (!checked) + static bool s_checked = false; + static bool s_available = false; + if (!s_checked) { - checked = true; + s_checked = true; MythXDisplay display; - available = display.Open(); + s_available = display.Open(); } - return available; + return s_available; } DisplayInfo MythDisplayX11::GetDisplayInfo(int VideoRate) @@ -129,7 +129,7 @@ const std::vector<DisplayResScreen>& MythDisplayX11::GetVideoModes(void) bool MythDisplayX11::SwitchToVideoMode(int Width, int Height, double DesiredRate) { - double rate = static_cast<double>(NAN); + auto rate = static_cast<double>(NAN); DisplayResScreen desired_screen(Width, Height, 0, 0, -1.0, DesiredRate); int idx = DisplayResScreen::FindBestMatch(m_videoModesUnsorted, desired_screen, rate); @@ -146,7 +146,7 @@ bool MythDisplayX11::SwitchToVideoMode(int Width, int Height, double DesiredRate XRRConfigCurrentConfiguration(cfg, &rot); // Search real xrandr rate for desired_rate - short finalrate = static_cast<short>(rate); + auto finalrate = static_cast<short>(rate); for (size_t i = 0; i < m_videoModes.size(); i++) { @@ -197,12 +197,12 @@ void MythDisplayX11::DebugModes(const QString& Message) const if (VERBOSE_LEVEL_CHECK(VB_PLAYBACK, LOG_INFO)) { LOG(VB_PLAYBACK, LOG_INFO, LOC + Message + ":"); - std::vector<DisplayResScreen>::const_iterator it = m_videoModes.cbegin(); + auto it = m_videoModes.cbegin(); for ( ; it != m_videoModes.cend(); ++it) { const std::vector<double>& rates = (*it).RefreshRates(); QStringList rateslist; - std::vector<double>::const_reverse_iterator it2 = rates.crbegin(); + auto it2 = rates.crbegin(); for ( ; it2 != rates.crend(); ++it2) rateslist.append(QString("%1").arg(*it2, 2, 'f', 2, '0')); LOG(VB_PLAYBACK, LOG_INFO, QString("%1x%2\t%3") diff --git a/mythtv/libs/libmythui/platforms/mythnvcontrol.cpp b/mythtv/libs/libmythui/platforms/mythnvcontrol.cpp index e9b086f3724..1586a7a73c3 100644 --- a/mythtv/libs/libmythui/platforms/mythnvcontrol.cpp +++ b/mythtv/libs/libmythui/platforms/mythnvcontrol.cpp @@ -101,7 +101,7 @@ bool MythNVControl::GetNvidiaRates(MythXDisplay *MythDisplay, std::vector<Displa if (!major) { LOG(VB_GENERAL, LOG_DEBUG, LOC + "Dynamic Twinview not enabled, ignoring"); - return 0; + return false; } // Query the enabled displays on this screen, print basic information about each display @@ -281,7 +281,7 @@ bool MythNVControl::GetNvidiaRates(MythXDisplay *MythDisplay, std::vector<Displa do { erased = false; - std::vector<DisplayResScreen>::iterator it = VideoModes.begin(); + auto it = VideoModes.begin(); for ( ; it != VideoModes.end(); ++it) { QPair<int,int> resolution((*it).Width(), (*it).Height()); @@ -294,7 +294,7 @@ bool MythNVControl::GetNvidiaRates(MythXDisplay *MythDisplay, std::vector<Displa break; } } - } while (erased == true); + } while (erased); // Update refresh rates for (size_t i = 0; i < VideoModes.size(); i++) @@ -309,7 +309,7 @@ bool MythNVControl::GetNvidiaRates(MythXDisplay *MythDisplay, std::vector<Displa const std::vector<double>& rates = scr.RefreshRates(); bool found = false; - for (std::vector<double>::const_iterator it = rates.cbegin(); it != rates.cend(); ++it) + for (auto it = rates.cbegin(); it != rates.cend(); ++it) { uint64_t key = DisplayResScreen::CalcKey(w, h, *it); if (screenmap.contains(key)) diff --git a/mythtv/libs/libmythui/platforms/mythxdisplay.cpp b/mythtv/libs/libmythui/platforms/mythxdisplay.cpp index 1727064efdd..474e59ff899 100644 --- a/mythtv/libs/libmythui/platforms/mythxdisplay.cpp +++ b/mythtv/libs/libmythui/platforms/mythxdisplay.cpp @@ -15,8 +15,8 @@ extern "C" { #include <X11/extensions/Xinerama.h> #include <X11/extensions/xf86vmode.h> } -typedef int (*XErrorCallbackType)(Display *, XErrorEvent *); -typedef std::vector<XErrorEvent> XErrorVectorType; +using XErrorCallbackType = int (*)(Display *, XErrorEvent *); +using XErrorVectorType = std::vector<XErrorEvent>; std::map<Display*, XErrorVectorType> xerrors; std::map<Display*, XErrorCallbackType> xerror_handlers; std::map<Display*, MythXDisplay*> xdisplays; @@ -58,7 +58,7 @@ MythXDisplay *GetMythXDisplay(Display *d) MythXDisplay *OpenMythXDisplay(bool Warn /*= true*/) { - MythXDisplay *disp = new MythXDisplay(); + auto *disp = new MythXDisplay(); if (disp && disp->Open()) return disp; @@ -269,7 +269,7 @@ void MythXDisplay::CheckOrphanedErrors(void) if (xerrors.empty()) return; - std::map<Display*, XErrorVectorType>::iterator errors = xerrors.begin(); + auto errors = xerrors.begin(); for (; errors != xerrors.end(); ++errors) if (!xerror_handlers.count(errors->first)) CheckErrors(errors->first); diff --git a/mythtv/libs/libmythui/screensaver-dbus.cpp b/mythtv/libs/libmythui/screensaver-dbus.cpp index 1c04b0e8db4..5f03856437a 100644 --- a/mythtv/libs/libmythui/screensaver-dbus.cpp +++ b/mythtv/libs/libmythui/screensaver-dbus.cpp @@ -123,7 +123,7 @@ ScreenSaverDBus::ScreenSaverDBus() : { // service, path, interface, bus - note that interface = service, hence it is used twice for (uint i=0; i < NUM_DBUS_METHODS; i++) { - ScreenSaverDBusPrivate *ssdbp = + auto *ssdbp = new ScreenSaverDBusPrivate(m_dbusService[i], m_dbusPath[i], m_dbusService[i], &m_bus); ssdbp->SetUnInhibit(m_dbusUnInhibit[i]); m_dbusPrivateInterfaces.push_back(ssdbp); diff --git a/mythtv/libs/libmythui/screensaver-x11.cpp b/mythtv/libs/libmythui/screensaver-x11.cpp index 18be65a7edc..c0cae74b70d 100644 --- a/mythtv/libs/libmythui/screensaver-x11.cpp +++ b/mythtv/libs/libmythui/screensaver-x11.cpp @@ -159,24 +159,24 @@ class ScreenSaverX11Private void SaveScreenSaver(void) { - if (!m_state.saved && m_display) + if (!m_state.m_saved && m_display) { - XGetScreenSaver(m_display->GetDisplay(), &m_state.timeout, - &m_state.interval, &m_state.preferblank, - &m_state.allowexposure); - m_state.saved = true; + XGetScreenSaver(m_display->GetDisplay(), &m_state.m_timeout, + &m_state.m_interval, &m_state.m_preferblank, + &m_state.m_allowexposure); + m_state.m_saved = true; } } void RestoreScreenSaver(void) { - if (m_state.saved && m_display) + if (m_state.m_saved && m_display) { - XSetScreenSaver(m_display->GetDisplay(), m_state.timeout, - m_state.interval, m_state.preferblank, - m_state.allowexposure); + XSetScreenSaver(m_display->GetDisplay(), m_state.m_timeout, + m_state.m_interval, m_state.m_preferblank, + m_state.m_allowexposure); m_display->Sync(); - m_state.saved = false; + m_state.m_saved = false; } } @@ -186,8 +186,8 @@ class ScreenSaverX11Private return; QDateTime current_time = MythDate::current(); - if ((!m_last_deactivated.isValid()) || - (m_last_deactivated.secsTo(current_time) > 30)) + if ((!m_lastDeactivated.isValid()) || + (m_lastDeactivated.secsTo(current_time) > 30)) { if (m_xscreensaverRunning) { @@ -198,7 +198,7 @@ class ScreenSaverX11Private kMSDontDisableDrawing | kMSRunBackground); } - m_last_deactivated = current_time; + m_lastDeactivated = current_time; } } @@ -207,11 +207,11 @@ class ScreenSaverX11Private { public: ScreenSaverState() = default; - bool saved {false}; - int timeout {-1}; - int interval {-1}; - int preferblank {-1}; - int allowexposure {-1}; + bool m_saved {false}; + int m_timeout {-1}; + int m_interval {-1}; + int m_preferblank {-1}; + int m_allowexposure {-1}; }; private: @@ -223,7 +223,7 @@ class ScreenSaverX11Private int m_timeoutInterval {-1}; QTimer *m_resetTimer {nullptr}; - QDateTime m_last_deactivated; + QDateTime m_lastDeactivated; ScreenSaverState m_state; MythXDisplay *m_display {nullptr}; diff --git a/mythtv/libs/libmythui/themeinfo.h b/mythtv/libs/libmythui/themeinfo.h index 77ca08775c2..76fde8830ed 100644 --- a/mythtv/libs/libmythui/themeinfo.h +++ b/mythtv/libs/libmythui/themeinfo.h @@ -11,12 +11,12 @@ #include "xmlparsebase.h" // for VERBOSE_XML && Xml Parsing helpers -typedef enum { +enum ThemeType { THEME_UNKN = 0x00, THEME_UI = 0x01, THEME_OSD = 0x02, THEME_MENU = 0x04 -} ThemeType; +}; class MUI_PUBLIC ThemeInfo : public XMLParseBase { diff --git a/mythtv/libs/libmythui/x11colors.cpp b/mythtv/libs/libmythui/x11colors.cpp index 90dfc761267..7a774505342 100644 --- a/mythtv/libs/libmythui/x11colors.cpp +++ b/mythtv/libs/libmythui/x11colors.cpp @@ -7,19 +7,19 @@ struct colormap { - const char *name; - unsigned char r, g, b; + const char *m_name; + unsigned char m_r, m_g, m_b; }; QColor createColor(const QString &color) { - static QMutex x11colormapLock; - static QMap<QString, QColor> x11colormap; + static QMutex s_x11ColorMapLock; + static QMap<QString, QColor> s_x11ColorMap; - QMutexLocker locker(&x11colormapLock); - if (x11colormap.empty()) + QMutexLocker locker(&s_x11ColorMapLock); + if (s_x11ColorMap.empty()) { - static const colormap cmap[] = { + static const colormap kCMap[] = { { "snow", 255, 250, 250}, { "ghost", 248, 248, 255}, { "ghostwhite", 248, 248, 255}, @@ -774,14 +774,14 @@ QColor createColor(const QString &color) { "lightgreen", 144, 238, 144} }; - for (size_t i = 0; i < (sizeof(cmap) / sizeof(cmap[0])); i++) - x11colormap[QString(cmap[i].name)] = QColor(cmap[i].r, - cmap[i].g, - cmap[i].b); + for (size_t i = 0; i < (sizeof(kCMap) / sizeof(kCMap[0])); i++) + s_x11ColorMap[QString(kCMap[i].m_name)] = QColor(kCMap[i].m_r, + kCMap[i].m_g, + kCMap[i].m_b); } - QMap<QString, QColor>::const_iterator it = x11colormap.find(color.toLower()); - if (it != x11colormap.end()) + QMap<QString, QColor>::const_iterator it = s_x11ColorMap.find(color.toLower()); + if (it != s_x11ColorMap.end()) return it.value(); return {color}; diff --git a/mythtv/libs/libmythui/xmlparsebase.cpp b/mythtv/libs/libmythui/xmlparsebase.cpp index 9ff7479d554..30926a25a91 100644 --- a/mythtv/libs/libmythui/xmlparsebase.cpp +++ b/mythtv/libs/libmythui/xmlparsebase.cpp @@ -916,7 +916,7 @@ bool XMLParseBase::CopyWindowFromBase(const QString &windowname, return false; } - MythScreenType *st = dynamic_cast<MythScreenType *>(ui); + auto *st = dynamic_cast<MythScreenType *>(ui); if (!st) { LOG(VB_GENERAL, LOG_ERR, LOC + diff --git a/mythtv/libs/libmythupnp/bufferedsocketdevice.cpp b/mythtv/libs/libmythupnp/bufferedsocketdevice.cpp index 659c7c867a0..8d08aa704ef 100644 --- a/mythtv/libs/libmythupnp/bufferedsocketdevice.cpp +++ b/mythtv/libs/libmythupnp/bufferedsocketdevice.cpp @@ -260,7 +260,7 @@ void BufferedSocketDevice::Flush() while ( !osBufferFull && ( m_nWriteSize > 0 ) && m_pSocket->isValid()) { - deque<QByteArray*>::iterator it = m_bufWrite.begin(); + auto it = m_bufWrite.begin(); QByteArray *a = *it; int nwritten = 0; diff --git a/mythtv/libs/libmythupnp/eventing.cpp b/mythtv/libs/libmythupnp/eventing.cpp index fb3c87ca197..7656ca6bad0 100644 --- a/mythtv/libs/libmythupnp/eventing.cpp +++ b/mythtv/libs/libmythupnp/eventing.cpp @@ -374,7 +374,7 @@ void Eventing::NotifySubscriber( SubscriberInfo *pInfo ) // -=>TODO: Need to add support for more than one CallBack URL. - QByteArray *pBuffer = new QByteArray(); // UPnpEventTask will delete this pointer. + auto *pBuffer = new QByteArray(); // UPnpEventTask will delete this pointer. QTextStream tsMsg( pBuffer, QIODevice::WriteOnly ); tsMsg.setCodec(QTextCodec::codecForName("UTF-8")); @@ -407,9 +407,8 @@ void Eventing::NotifySubscriber( SubscriberInfo *pInfo ) QString("UPnp::Eventing::NotifySubscriber( %1 ) : %2 Variables") .arg( sHost ).arg(nCount)); - UPnpEventTask *pEventTask = - new UPnpEventTask(QHostAddress( pInfo->m_qURL.host() ), - nPort, pBuffer ); + auto *pEventTask = new UPnpEventTask(QHostAddress(pInfo->m_qURL.host()), + nPort, pBuffer); TaskQueue::Instance()->AddTask( 250, pEventTask ); diff --git a/mythtv/libs/libmythupnp/eventing.h b/mythtv/libs/libmythupnp/eventing.h index c7ae9363d1c..a804d5fecc7 100644 --- a/mythtv/libs/libmythupnp/eventing.h +++ b/mythtv/libs/libmythupnp/eventing.h @@ -84,7 +84,7 @@ class UPNP_PUBLIC SubscriberInfo ////////////////////////////////////////////////////////////////////////////// -typedef QMap<QString,SubscriberInfo*> Subscribers; +using Subscribers = QMap<QString,SubscriberInfo*>; ////////////////////////////////////////////////////////////////////////////// // @@ -172,7 +172,7 @@ class UPNP_PUBLIC StateVariables protected: virtual void Notify() = 0; - typedef QMap<QString, StateVariableBase*> SVMap; + using SVMap = QMap<QString, StateVariableBase*>; SVMap m_map; public: diff --git a/mythtv/libs/libmythupnp/httprequest.h b/mythtv/libs/libmythupnp/httprequest.h index 90d0301af83..14210099e50 100644 --- a/mythtv/libs/libmythupnp/httprequest.h +++ b/mythtv/libs/libmythupnp/httprequest.h @@ -36,7 +36,7 @@ // Typedefs / Defines ///////////////////////////////////////////////////////////////////////////// -typedef enum +enum HttpRequestType { RequestTypeUnknown = 0x0000, // HTTP 1.1 @@ -56,17 +56,16 @@ typedef enum // Not a request type RequestTypeResponse = 0x1000 -} HttpRequestType; +}; -typedef enum +enum HttpContentType { ContentType_Unknown = 0, ContentType_Urlencoded = 1, ContentType_XML = 2 +}; -} HttpContentType; - -typedef enum +enum HttpResponseType { ResponseTypeNone = -1, ResponseTypeUnknown = 0, @@ -79,15 +78,14 @@ typedef enum ResponseTypeFile = 7, ResponseTypeOther = 8, ResponseTypeHeader = 9 +}; -} HttpResponseType; - -typedef struct +struct MIMETypes { const char *pszExtension; const char *pszType; -} MIMETypes; +}; ///////////////////////////////////////////////////////////////////////////// diff --git a/mythtv/libs/libmythupnp/httpserver.cpp b/mythtv/libs/libmythupnp/httpserver.cpp index e4b40e60817..9c597699738 100644 --- a/mythtv/libs/libmythupnp/httpserver.cpp +++ b/mythtv/libs/libmythupnp/httpserver.cpp @@ -301,7 +301,7 @@ QString HttpServer::GetServerVersion(void) void HttpServer::newTcpConnection(qt_socket_fd_t socket) { PoolServerType type = kTCPServer; - PrivTcpServer *server = dynamic_cast<PrivTcpServer *>(QObject::sender()); + auto *server = dynamic_cast<PrivTcpServer *>(QObject::sender()); if (server) type = server->GetServerType(); @@ -482,7 +482,7 @@ void HttpWorker::run(void) { #ifndef QT_NO_OPENSSL - QSslSocket *pSslSocket = new QSslSocket(); + auto *pSslSocket = new QSslSocket(); if (pSslSocket->setSocketDescriptor(m_socket) && gCoreContext->CheckSubnet(pSslSocket)) { diff --git a/mythtv/libs/libmythupnp/httpserver.h b/mythtv/libs/libmythupnp/httpserver.h index a672f893fe0..9a280819f7c 100644 --- a/mythtv/libs/libmythupnp/httpserver.h +++ b/mythtv/libs/libmythupnp/httpserver.h @@ -42,7 +42,7 @@ #include "upnputil.h" #include "compat.h" -typedef struct timeval TaskTime; +using TaskTime = struct timeval; class HttpWorkerThread; class QScriptEngine; @@ -53,12 +53,12 @@ class QSslCertificate; class QSslConfiguration; #endif -typedef enum +enum ContentProtection { cpLocalNoAuth = 0x00, // Can only be accessed locally, but no authentication is required cpLocalAuth = 0x01, // Can only be accessed locally, authentication is required cpRemoteAuth = 0x02 // Can be accessed remotely, authentication is required -} ContentProtection; +}; ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// @@ -99,7 +99,7 @@ class UPNP_PUBLIC HttpServerExtension : public QObject virtual int GetSocketTimeout() const { return m_nSocketTimeout; }// -1 = Use config value }; -typedef QList<QPointer<HttpServerExtension> > HttpServerExtensionList; +using HttpServerExtensionList = QList<QPointer<HttpServerExtension> >; ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// diff --git a/mythtv/libs/libmythupnp/mmembuf.cpp b/mythtv/libs/libmythupnp/mmembuf.cpp index af43091934c..9198429aae0 100644 --- a/mythtv/libs/libmythupnp/mmembuf.cpp +++ b/mythtv/libs/libmythupnp/mmembuf.cpp @@ -150,7 +150,7 @@ int MMembuf::ungetch(int ch) { if (buf.isEmpty() || _index==0) { // we need a new QByteArray - QByteArray *ba = new QByteArray; + auto *ba = new QByteArray; ba->resize(1); buf.prepend(ba); _size++; diff --git a/mythtv/libs/libmythupnp/msocketdevice_unix.cpp b/mythtv/libs/libmythupnp/msocketdevice_unix.cpp index 0cc413d43bb..2c633514c21 100644 --- a/mythtv/libs/libmythupnp/msocketdevice_unix.cpp +++ b/mythtv/libs/libmythupnp/msocketdevice_unix.cpp @@ -99,7 +99,7 @@ static inline void qt_socket_getportaddr(struct sockaddr *sa, if (sa->sa_family == AF_INET6) { - struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)sa; + auto *sa6 = (struct sockaddr_in6 *)sa; Q_IPV6ADDR tmp; memcpy(&tmp, &sa6->sin6_addr.s6_addr, sizeof(tmp)); QHostAddress a(tmp); @@ -109,7 +109,7 @@ static inline void qt_socket_getportaddr(struct sockaddr *sa, } - struct sockaddr_in *sa4 = (struct sockaddr_in *)sa; + auto *sa4 = (struct sockaddr_in *)sa; QHostAddress a(ntohl(sa4->sin_addr.s_addr)); @@ -132,7 +132,7 @@ MSocketDevice::Protocol MSocketDevice::getProtocol() const struct sockaddr_storage sa {}; QT_SOCKLEN_T sz = sizeof(sa); - struct sockaddr *sap = reinterpret_cast<struct sockaddr *>(&sa); + auto *sap = reinterpret_cast<struct sockaddr *>(&sa); if (!::getsockname(fd, sap, &sz)) { @@ -376,7 +376,7 @@ int MSocketDevice::option(Option opt) const if (!e) { - MSocketDevice *that = (MSocketDevice*)this; // mutable function + auto *that = (MSocketDevice*)this; // mutable function switch (errno) { diff --git a/mythtv/libs/libmythupnp/msocketdevice_win.cpp b/mythtv/libs/libmythupnp/msocketdevice_win.cpp index 2a4732d6f79..cbc53e591c8 100644 --- a/mythtv/libs/libmythupnp/msocketdevice_win.cpp +++ b/mythtv/libs/libmythupnp/msocketdevice_win.cpp @@ -87,7 +87,7 @@ struct qt_in6_addr u_char qt_s6_addr[16]; }; -typedef struct +struct qt_sockaddr_in6 { short sin6_family; /* AF_INET6 */ u_short sin6_port; /* Transport level port number */ @@ -95,7 +95,7 @@ typedef struct struct qt_in6_addr sin6_addr; /* IPv6 address */ u_long sin6_scope_id; /* set of interfaces for a scope */ -} qt_sockaddr_in6; +}; #endif diff --git a/mythtv/libs/libmythupnp/servicehost.h b/mythtv/libs/libmythupnp/servicehost.h index 9529a64fcd5..b35b2550758 100644 --- a/mythtv/libs/libmythupnp/servicehost.h +++ b/mythtv/libs/libmythupnp/servicehost.h @@ -47,7 +47,7 @@ class UPNP_PUBLIC MethodInfo QVariant Invoke( Service *pService, const QStringMap &reqParams ); }; -typedef QMap< QString, MethodInfo > MetaInfoMap; +using MetaInfoMap = QMap< QString, MethodInfo >; ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// diff --git a/mythtv/libs/libmythupnp/services/rtti.cpp b/mythtv/libs/libmythupnp/services/rtti.cpp index 411a89d7d4b..fd92ec2d9c6 100644 --- a/mythtv/libs/libmythupnp/services/rtti.cpp +++ b/mythtv/libs/libmythupnp/services/rtti.cpp @@ -66,7 +66,7 @@ DTC::Enum* Rtti::GetEnum( const QString &sFQN ) nParentId = QMetaType::type( sParentFQN.toUtf8() ); } - QObject *pParentClass = (QObject *)QMetaType::create( nParentId ); + auto *pParentClass = (QObject *)QMetaType::create( nParentId ); if (pParentClass == nullptr) return nullptr; @@ -89,7 +89,7 @@ DTC::Enum* Rtti::GetEnum( const QString &sFQN ) // // ---------------------------------------------------------------------- - DTC::Enum *pEnum = new DTC::Enum(); + auto *pEnum = new DTC::Enum(); pEnum->setType( sFQN ); diff --git a/mythtv/libs/libmythupnp/ssdp.cpp b/mythtv/libs/libmythupnp/ssdp.cpp index 77439bfb7e9..685fb750cef 100644 --- a/mythtv/libs/libmythupnp/ssdp.cpp +++ b/mythtv/libs/libmythupnp/ssdp.cpp @@ -127,7 +127,7 @@ SSDP::~SSDP() m_pNotifyTask = nullptr; } - for (int nIdx = 0; nIdx < (int)NumberOfSockets; nIdx++ ) + for (int nIdx = 0; nIdx < kNumberOfSockets; nIdx++ ) { if (m_Sockets[ nIdx ] != nullptr ) { @@ -266,7 +266,7 @@ void SSDP::run() FD_ZERO( &read_set ); - for (size_t nIdx = 0; nIdx < NumberOfSockets; nIdx++ ) + for (size_t nIdx = 0; nIdx < kNumberOfSockets; nIdx++ ) { if (m_Sockets[nIdx] != nullptr && m_Sockets[nIdx]->socket() >= 0) { @@ -290,7 +290,7 @@ void SSDP::run() int count = select(nMaxSocket + 1, &read_set, nullptr, nullptr, &timeout); - for (int nIdx = 0; count && nIdx < (int)NumberOfSockets; nIdx++ ) + for (int nIdx = 0; count && nIdx < kNumberOfSockets; nIdx++ ) { bool cond1 = m_Sockets[nIdx] != nullptr; bool cond2 = cond1 && m_Sockets[nIdx]->socket() >= 0; @@ -549,7 +549,7 @@ bool SSDP::ProcessSearchRequest( const QStringMap &sHeaders, if ((sST == "ssdp:all") || (sST == "upnp:rootdevice")) { - UPnpSearchTask *pTask = new UPnpSearchTask( m_nServicePort, + auto *pTask = new UPnpSearchTask( m_nServicePort, peerAddress, peerPort, sST, UPnp::g_UPnpDeviceDesc.m_rootDevice.GetUDN()); @@ -575,11 +575,8 @@ bool SSDP::ProcessSearchRequest( const QStringMap &sHeaders, if (sUDN.length() > 0) { - UPnpSearchTask *pTask = new UPnpSearchTask( m_nServicePort, - peerAddress, - peerPort, - sST, - sUDN ); + auto *pTask = new UPnpSearchTask( m_nServicePort, peerAddress, + peerPort, sST, sUDN ); // Excute task now for fastest response, queue for time-delayed response // -=>TODO: To be trully uPnp compliant, this Execute should be removed. diff --git a/mythtv/libs/libmythupnp/ssdp.h b/mythtv/libs/libmythupnp/ssdp.h index c0ddeb253fe..6b146216d60 100644 --- a/mythtv/libs/libmythupnp/ssdp.h +++ b/mythtv/libs/libmythupnp/ssdp.h @@ -27,22 +27,20 @@ #define SSDP_PORT 1900 #define SSDP_SEARCHPORT 6549 -typedef enum +enum SSDPMethod { SSDPM_Unknown = 0, SSDPM_GetDeviceDesc = 1, SSDPM_GetDeviceList = 2 +}; -} SSDPMethod; - -typedef enum +enum SSDPRequestType { SSDP_Unknown = 0, SSDP_MSearch = 1, SSDP_MSearchResp = 2, SSDP_Notify = 3 - -} SSDPRequestType; +}; ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// @@ -56,8 +54,6 @@ typedef enum #define SocketIdx_Multicast 1 #define SocketIdx_Broadcast 2 -#define NumberOfSockets (sizeof( m_Sockets ) / sizeof( MSocketDevice * )) - class UPNP_PUBLIC SSDP : public MThread { private: @@ -65,7 +61,8 @@ class UPNP_PUBLIC SSDP : public MThread static SSDP* g_pSSDP; QRegExp m_procReqLineExp {"[ \r\n][ \r\n]*"}; - MSocketDevice *m_Sockets[3] {nullptr,nullptr,nullptr}; + constexpr static int kNumberOfSockets = 3; + MSocketDevice *m_Sockets[kNumberOfSockets] {nullptr,nullptr,nullptr}; int m_nPort {SSDP_PORT}; int m_nSearchPort {SSDP_SEARCHPORT}; diff --git a/mythtv/libs/libmythupnp/ssdpcache.cpp b/mythtv/libs/libmythupnp/ssdpcache.cpp index 37df9b1fe7e..821ff9f8dbf 100644 --- a/mythtv/libs/libmythupnp/ssdpcache.cpp +++ b/mythtv/libs/libmythupnp/ssdpcache.cpp @@ -255,7 +255,7 @@ SSDPCache::SSDPCache() // Add Task to keep SSDPCache purged of stale entries. // ---------------------------------------------------------------------- - SSDPCacheTask *task = new SSDPCacheTask(); + auto *task = new SSDPCacheTask(); TaskQueue::Instance()->AddTask(task); task->DecrRef(); } diff --git a/mythtv/libs/libmythupnp/ssdpcache.h b/mythtv/libs/libmythupnp/ssdpcache.h index 3e32627adce..c9610b9425b 100644 --- a/mythtv/libs/libmythupnp/ssdpcache.h +++ b/mythtv/libs/libmythupnp/ssdpcache.h @@ -25,7 +25,7 @@ #include "upnpexp.h" /// Key == Unique Service Name (USN) -typedef QMap< QString, DeviceLocation * > EntryMap; +using EntryMap = QMap< QString, DeviceLocation * >; ///////////////////////////////////////////////////////////////////////////// // QDict Implementation that uses RefCounted pointers @@ -67,7 +67,7 @@ class UPNP_PUBLIC SSDPCacheEntries : public ReferenceCounter }; /// Key == Service Type URI -typedef QMap< QString, SSDPCacheEntries * > SSDPCacheEntriesMap; +using SSDPCacheEntriesMap = QMap< QString, SSDPCacheEntries * >; ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// diff --git a/mythtv/libs/libmythupnp/taskqueue.cpp b/mythtv/libs/libmythupnp/taskqueue.cpp index ee4bb6a9aba..d21ee7ecd0b 100644 --- a/mythtv/libs/libmythupnp/taskqueue.cpp +++ b/mythtv/libs/libmythupnp/taskqueue.cpp @@ -152,9 +152,7 @@ void TaskQueue::Clear( ) { m_mutex.lock(); - for ( TaskMap::iterator it = m_mapTasks.begin(); - it != m_mapTasks.end(); - ++it ) + for ( auto it = m_mapTasks.begin(); it != m_mapTasks.end(); ++it ) { if ((*it).second != nullptr) (*it).second->DecrRef(); @@ -222,8 +220,7 @@ Task *TaskQueue::GetNextExpiredTask( TaskTime tt, long nWithinMilliSecs /*=50*/ m_mutex.lock(); - TaskMap::iterator it = m_mapTasks.begin(); - + auto it = m_mapTasks.begin(); if (it != m_mapTasks.end()) { TaskTime ttTask = (*it).first; diff --git a/mythtv/libs/libmythupnp/taskqueue.h b/mythtv/libs/libmythupnp/taskqueue.h index 4a7fbf24660..80056a02079 100644 --- a/mythtv/libs/libmythupnp/taskqueue.h +++ b/mythtv/libs/libmythupnp/taskqueue.h @@ -40,7 +40,7 @@ class TaskQueue; // Typedefs ///////////////////////////////////////////////////////////////////////////// -typedef std::multimap< TaskTime, Task *> TaskMap; +using TaskMap = std::multimap< TaskTime, Task *>; ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// diff --git a/mythtv/libs/libmythupnp/upnp.h b/mythtv/libs/libmythupnp/upnp.h index 911583e9f74..dda5fffb321 100644 --- a/mythtv/libs/libmythupnp/upnp.h +++ b/mythtv/libs/libmythupnp/upnp.h @@ -28,7 +28,7 @@ // ////////////////////////////////////////////////////////////////////////////// -typedef enum +enum UPnPResultCode { UPnPResult_Success = 0, @@ -81,8 +81,7 @@ typedef enum UPnPResult_MythTV_NoNamespaceGiven = 32001, UPnPResult_MythTV_XmlParseError = 32002, - -} UPnPResultCode; +}; ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// diff --git a/mythtv/libs/libmythupnp/upnpcds.cpp b/mythtv/libs/libmythupnp/upnpcds.cpp index bd18e3a902d..b7ea052067e 100644 --- a/mythtv/libs/libmythupnp/upnpcds.cpp +++ b/mythtv/libs/libmythupnp/upnpcds.cpp @@ -740,7 +740,7 @@ void UPnpCDS::HandleGetSystemUpdateID( HTTPRequest *pRequest ) QString("UPnpCDS::ProcessRequest : %1 : %2") .arg(pRequest->m_sBaseUrl) .arg(pRequest->m_sMethod)); - uint16_t nId = GetValue<uint16_t>("SystemUpdateID"); + auto nId = GetValue<uint16_t>("SystemUpdateID"); list.push_back(NameValue("Id", nId)); @@ -838,7 +838,7 @@ UPnpCDSExtensionResults *UPnpCDSExtension::Browse( UPnpCDSRequest *pRequest ) // Process based on location in hierarchy // ---------------------------------------------------------------------- - UPnpCDSExtensionResults *pResults = new UPnpCDSExtensionResults(); + auto *pResults = new UPnpCDSExtensionResults(); if (pResults != nullptr) { @@ -917,7 +917,7 @@ UPnpCDSExtensionResults *UPnpCDSExtension::Search( UPnpCDSRequest *pRequest ) return nullptr; } - UPnpCDSExtensionResults *pResults = new UPnpCDSExtensionResults(); + auto *pResults = new UPnpCDSExtensionResults(); // CreateItems( pRequest, pResults, 0, "", false ); diff --git a/mythtv/libs/libmythupnp/upnpcds.h b/mythtv/libs/libmythupnp/upnpcds.h index 9c0b6d74d6f..9b91ed84355 100644 --- a/mythtv/libs/libmythupnp/upnpcds.h +++ b/mythtv/libs/libmythupnp/upnpcds.h @@ -25,7 +25,7 @@ class UPnpCDS; -typedef enum +enum UPnpCDSMethod { CDSM_Unknown = 0, CDSM_GetServiceDescription = 1, @@ -36,18 +36,16 @@ typedef enum CDSM_GetSystemUpdateID = 6, CDSM_GetFeatureList = 7, CDSM_GetServiceResetToken = 8 +}; -} UPnpCDSMethod; - -typedef enum +enum UPnpCDSBrowseFlag { CDS_BrowseUnknown = 0, CDS_BrowseMetadata = 1, CDS_BrowseDirectChildren = 2 +}; -} UPnpCDSBrowseFlag; - -typedef enum +enum UPnpCDSClient { CDS_ClientDefault = 0, // (no special attention required) CDS_ClientWMP = 1, // Windows Media Player @@ -55,14 +53,14 @@ typedef enum CDS_ClientMP101 = 3, // Netgear MP101 CDS_ClientXBox = 4, // XBox 360 CDS_ClientSonyDB = 5, // Sony Blu-ray players -} UPnpCDSClient; +}; -typedef struct +struct UPnpCDSClientException { UPnpCDSClient nClientType; QString sHeaderKey; QString sHeaderValue; -} UPnpCDSClientException; +}; ////////////////////////////////////////////////////////////////////////////// @@ -190,12 +188,12 @@ class UPNP_PUBLIC UPnPShortcutFeature : public UPnPFeature QMap<ShortCutType, QString> m_shortcuts; }; -typedef QMap<UPnPShortcutFeature::ShortCutType, QString> CDSShortCutList; +using CDSShortCutList = QMap<UPnPShortcutFeature::ShortCutType, QString>; ////////////////////////////////////////////////////////////////////////////// -typedef QMap<QString, QString> IDTokenMap; -typedef QPair<QString, QString> IDToken; +using IDTokenMap = QMap<QString, QString>; +using IDToken = QPair<QString, QString>; class UPNP_PUBLIC UPnpCDSExtension { @@ -268,7 +266,7 @@ class UPNP_PUBLIC UPnpCDSExtension virtual CDSShortCutList GetShortCuts () { return m_shortcuts; } }; -typedef QList<UPnpCDSExtension*> UPnpCDSExtensionList; +using UPnpCDSExtensionList = QList<UPnpCDSExtension*>; ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// diff --git a/mythtv/libs/libmythupnp/upnpcdsobjects.cpp b/mythtv/libs/libmythupnp/upnpcdsobjects.cpp index 4f30ba26056..e9508977c8f 100644 --- a/mythtv/libs/libmythupnp/upnpcdsobjects.cpp +++ b/mythtv/libs/libmythupnp/upnpcdsobjects.cpp @@ -200,7 +200,7 @@ CDSObject *CDSObject::GetChild( const QString &sID ) Resource *CDSObject::AddResource( const QString& sProtocol, const QString& sURI ) { - Resource *pRes = new Resource( sProtocol, sURI ); + auto *pRes = new Resource( sProtocol, sURI ); m_resources.append( pRes ); diff --git a/mythtv/libs/libmythupnp/upnpcdsobjects.h b/mythtv/libs/libmythupnp/upnpcdsobjects.h index 0e0d5973dbe..1ca4cd95c8f 100644 --- a/mythtv/libs/libmythupnp/upnpcdsobjects.h +++ b/mythtv/libs/libmythupnp/upnpcdsobjects.h @@ -29,14 +29,13 @@ class QTextStream; // ////////////////////////////////////////////////////////////////////////////// -typedef enum +enum ObjectTypes { OT_Undefined = 0, OT_Container = 1, OT_Item = 2, OT_Res = 3 - -} ObjectTypes; +}; ////////////////////////////////////////////////////////////////////////////// // @@ -93,8 +92,8 @@ class Property QString m_sValue; }; -typedef QMap<QString,Property*> Properties; -typedef QList<CDSObject*> CDSObjects; +using Properties = QMap<QString,Property*>; +using CDSObjects = QList<CDSObject*>; ////////////////////////////////////////////////////////////////////////////// // @@ -125,7 +124,7 @@ class Resource } }; -typedef QList<Resource*> Resources; +using Resources = QList<Resource*>; ////////////////////////////////////////////////////////////////////////////// // @@ -151,7 +150,7 @@ class ContainerClass } }; -typedef QList<ContainerClass*> Classes; +using Classes = QList<ContainerClass*>; /** * NOTE FilterMap contains a list of what should be included, not what should @@ -177,7 +176,7 @@ typedef QList<ContainerClass*> Classes; * * See UPnP MediaServer, ContentDirectory Service Section 2.3.18, 2013 */ -typedef QStringList FilterMap; +using FilterMap = QStringList; ////////////////////////////////////////////////////////////////////////////// diff --git a/mythtv/libs/libmythupnp/upnpcmgr.h b/mythtv/libs/libmythupnp/upnpcmgr.h index fb452b0c9ab..1e6f90f1e3b 100644 --- a/mythtv/libs/libmythupnp/upnpcmgr.h +++ b/mythtv/libs/libmythupnp/upnpcmgr.h @@ -16,7 +16,7 @@ #include "httpserver.h" #include "eventing.h" -typedef enum +enum UPnpCMGRMethod { CMGRM_Unknown = 0, CMGRM_GetServiceDescription = 1, @@ -24,20 +24,18 @@ typedef enum CMGRM_GetCurrentConnectionInfo = 3, CMGRM_GetCurrentConnectionIDs = 4, CMGRM_GetFeatureList = 5 - -} UPnpCMGRMethod; +}; ////////////////////////////////////////////////////////////////////////////// -typedef enum +enum UPnpCMGRConnectionStatus { CMGRSTATUS_Unknown = 0, CMGRSTATUS_OK = 1, CMGRSTATUS_ContentFormatMismatch = 2, CMGRSTATUS_InsufficientBandwidth = 3, CMGRSTATUS_UnreliableChannel = 4 - -} UPnpCMGRConnectionStatus; +}; ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// diff --git a/mythtv/libs/libmythupnp/upnpdevice.cpp b/mythtv/libs/libmythupnp/upnpdevice.cpp index 0e7286a8d1c..891476d1212 100644 --- a/mythtv/libs/libmythupnp/upnpdevice.cpp +++ b/mythtv/libs/libmythupnp/upnpdevice.cpp @@ -184,7 +184,7 @@ void UPnpDeviceDesc::ProcessIconList( const QDomNode& oListNode, UPnpDevice *pDe if ( e.tagName() == "icon" ) { - UPnpIcon *pIcon = new UPnpIcon(); + auto *pIcon = new UPnpIcon(); pDevice->m_listIcons.append( pIcon ); SetStrValue( e.namedItem( "mimetype" ), pIcon->m_sMimeType ); @@ -213,7 +213,7 @@ void UPnpDeviceDesc::ProcessServiceList( const QDomNode& oListNode, UPnpDevice * if ( e.tagName() == "service" ) { - UPnpService *pService = new UPnpService(); + auto *pService = new UPnpService(); pDevice->m_listServices.append( pService ); SetStrValue(e.namedItem( "serviceType" ), pService->m_sServiceType); @@ -248,7 +248,7 @@ void UPnpDeviceDesc::ProcessDeviceList( const QDomNode& oListNode, if ( e.tagName() == "device") { - UPnpDevice *pNewDevice = new UPnpDevice(); + auto *pNewDevice = new UPnpDevice(); pDevice->m_listDevices.append( pNewDevice ); _InternalLoad( e, pNewDevice ); } @@ -708,7 +708,7 @@ UPnpDevice::UPnpDevice() : // devices too. // Large PNG Icon - UPnpIcon *pngIconLrg = new UPnpIcon(); + auto *pngIconLrg = new UPnpIcon(); pngIconLrg->m_nDepth = 24; pngIconLrg->m_nHeight = 120; pngIconLrg->m_nWidth = 120; @@ -717,7 +717,7 @@ UPnpDevice::UPnpDevice() : m_listIcons.append(pngIconLrg); // Large JPG Icon - UPnpIcon *jpgIconLrg = new UPnpIcon(); + auto *jpgIconLrg = new UPnpIcon(); jpgIconLrg->m_nDepth = 24; jpgIconLrg->m_nHeight = 120; jpgIconLrg->m_nWidth = 120; @@ -726,7 +726,7 @@ UPnpDevice::UPnpDevice() : m_listIcons.append(jpgIconLrg); // Small PNG Icon - UPnpIcon *pngIconSm = new UPnpIcon(); + auto *pngIconSm = new UPnpIcon(); pngIconSm->m_nDepth = 24; pngIconSm->m_nHeight = 48; pngIconSm->m_nWidth = 48; @@ -735,7 +735,7 @@ UPnpDevice::UPnpDevice() : m_listIcons.append(pngIconSm); // Small JPG Icon - UPnpIcon *jpgIconSm = new UPnpIcon(); + auto *jpgIconSm = new UPnpIcon(); jpgIconSm->m_nDepth = 24; jpgIconSm->m_nHeight = 48; jpgIconSm->m_nWidth = 48; diff --git a/mythtv/libs/libmythupnp/upnpdevice.h b/mythtv/libs/libmythupnp/upnpdevice.h index b24429f2867..e9633222169 100644 --- a/mythtv/libs/libmythupnp/upnpdevice.h +++ b/mythtv/libs/libmythupnp/upnpdevice.h @@ -33,9 +33,9 @@ class QTextStream; // Typedefs ///////////////////////////////////////////////////////////////////////////// -typedef QList< UPnpDevice* > UPnpDeviceList; -typedef QList< UPnpService* > UPnpServiceList; -typedef QList< UPnpIcon* > UPnpIconList; +using UPnpDeviceList = QList< UPnpDevice* >; +using UPnpServiceList = QList< UPnpService* >; +using UPnpIconList = QList< UPnpIcon* >; ///////////////////////////////////////////////////////////////////////////// // @@ -217,8 +217,7 @@ class UPNP_PUBLIC DeviceLocation : public ReferenceCounter // Should be atomic decrement g_nAllocated--; - if (m_pDeviceDesc != nullptr) - delete m_pDeviceDesc; + delete m_pDeviceDesc; } UPnpDeviceDesc *m_pDeviceDesc; // We take ownership of this pointer. diff --git a/mythtv/libs/libmythupnp/upnpmsrr.h b/mythtv/libs/libmythupnp/upnpmsrr.h index 224cffbe0b4..af55c969297 100644 --- a/mythtv/libs/libmythupnp/upnpmsrr.h +++ b/mythtv/libs/libmythupnp/upnpmsrr.h @@ -10,15 +10,14 @@ class UPnpMSRR; -typedef enum +enum UPnpMSRRMethod { MSRR_Unknown = 0, MSRR_GetServiceDescription = 1, MSRR_IsAuthorized = 2, MSRR_RegisterDevice = 3, MSRR_IsValidated = 4 - -} UPnpMSRRMethod; +}; ////////////////////////////////////////////////////////////////////////////// // diff --git a/mythtv/libs/libmythupnp/upnpserviceimpl.cpp b/mythtv/libs/libmythupnp/upnpserviceimpl.cpp index 087b22eb4ce..57c287c1e92 100644 --- a/mythtv/libs/libmythupnp/upnpserviceimpl.cpp +++ b/mythtv/libs/libmythupnp/upnpserviceimpl.cpp @@ -6,7 +6,7 @@ void UPnpServiceImpl::RegisterService(UPnpDevice *pDevice) { if (pDevice != nullptr) { - UPnpService *pService = new UPnpService(); + auto *pService = new UPnpService(); pService->m_sServiceType = GetServiceType(); pService->m_sServiceId = GetServiceId(); diff --git a/mythtv/libs/libmythupnp/upnpsubscription.cpp b/mythtv/libs/libmythupnp/upnpsubscription.cpp index 5a396d30101..729f003fa12 100644 --- a/mythtv/libs/libmythupnp/upnpsubscription.cpp +++ b/mythtv/libs/libmythupnp/upnpsubscription.cpp @@ -290,8 +290,8 @@ bool UPNPSubscription::SendUnsubscribeRequest(const QString &usn, LOG(VB_UPNP, LOG_DEBUG, LOC + "\n\n" + sub); - MSocketDevice *sockdev = new MSocketDevice(MSocketDevice::Stream); - BufferedSocketDevice *sock = new BufferedSocketDevice(sockdev); + auto *sockdev = new MSocketDevice(MSocketDevice::Stream); + auto *sock = new BufferedSocketDevice(sockdev); sockdev->setBlocking(true); if (sock->Connect(QHostAddress(host), port)) @@ -357,8 +357,8 @@ int UPNPSubscription::SendSubscribeRequest(const QString &callback, LOG(VB_UPNP, LOG_DEBUG, LOC + "\n\n" + sub); - MSocketDevice *sockdev = new MSocketDevice(MSocketDevice::Stream); - BufferedSocketDevice *sock = new BufferedSocketDevice(sockdev); + auto *sockdev = new MSocketDevice(MSocketDevice::Stream); + auto *sock = new BufferedSocketDevice(sockdev); sockdev->setBlocking(true); QString uuid; diff --git a/mythtv/libs/libmythupnp/upnptasknotify.h b/mythtv/libs/libmythupnp/upnptasknotify.h index f82191752cd..f48e7b7999e 100644 --- a/mythtv/libs/libmythupnp/upnptasknotify.h +++ b/mythtv/libs/libmythupnp/upnptasknotify.h @@ -35,12 +35,11 @@ class UPnpDevice; // Typedefs ///////////////////////////////////////////////////////////////////////////// -typedef enum +enum UPnpNotifyNTS { NTS_alive = 0, NTS_byebye = 1 - -} UPnpNotifyNTS; +}; ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// diff --git a/mythtv/libs/libmythupnp/upnptasksearch.cpp b/mythtv/libs/libmythupnp/upnptasksearch.cpp index c0aaad08573..e06eeda0556 100644 --- a/mythtv/libs/libmythupnp/upnptasksearch.cpp +++ b/mythtv/libs/libmythupnp/upnptasksearch.cpp @@ -147,7 +147,7 @@ void UPnpSearchTask::SendMsg( MSocketDevice *pSocket, void UPnpSearchTask::Execute( TaskQueue * /*pQueue*/ ) { - MSocketDevice *pSocket = new MSocketDevice( MSocketDevice::Datagram ); + auto *pSocket = new MSocketDevice( MSocketDevice::Datagram ); // ---------------------------------------------------------------------- // Refresh IP Address List in case of changes diff --git a/mythtv/libs/libmythupnp/upnputil.h b/mythtv/libs/libmythupnp/upnputil.h index adbbea05224..464e480e2ae 100644 --- a/mythtv/libs/libmythupnp/upnputil.h +++ b/mythtv/libs/libmythupnp/upnputil.h @@ -36,8 +36,8 @@ template <class T> inline const T& Max( const T &x, const T &y ) // Typedefs ////////////////////////////////////////////////////////////////////////////// -typedef struct timeval TaskTime; -typedef QMap< QString, QString > QStringMap; +using TaskTime = struct timeval; +using QStringMap = QMap< QString, QString >; ///////////////////////////////////////////////////////////////////////////// @@ -117,11 +117,8 @@ inline NameValue& NameValue::operator=(const NameValue &nv) inline NameValue::~NameValue() { - if (m_pAttributes) - { - delete m_pAttributes; - m_pAttributes = nullptr; - } + delete m_pAttributes; + m_pAttributes = nullptr; } inline void NameValue::AddAttribute(const QString &name, const QString &value, diff --git a/mythtv/libs/libmythupnp/websocket.cpp b/mythtv/libs/libmythupnp/websocket.cpp index 7d9df42e3a2..8f869e02a99 100644 --- a/mythtv/libs/libmythupnp/websocket.cpp +++ b/mythtv/libs/libmythupnp/websocket.cpp @@ -49,7 +49,7 @@ void WebSocketServer::newTcpConnection(qt_socket_fd_t socket) { PoolServerType type = kTCPServer; - PrivTcpServer *server = dynamic_cast<PrivTcpServer *>(QObject::sender()); + auto *server = dynamic_cast<PrivTcpServer *>(QObject::sender()); if (server) type = server->GetServerType(); @@ -83,7 +83,7 @@ WebSocketWorkerThread::WebSocketWorkerThread(WebSocketServer& webSocketServer, void WebSocketWorkerThread::run(void) { - WebSocketWorker *worker = new WebSocketWorker(m_webSocketServer, m_socketFD, + auto *worker = new WebSocketWorker(m_webSocketServer, m_socketFD, m_connectionType #ifndef QT_NO_OPENSSL , m_sslConfig @@ -163,7 +163,7 @@ void WebSocketWorker::SetupSocket() { #ifndef QT_NO_OPENSSL - QSslSocket *pSslSocket = new QSslSocket(); + auto *pSslSocket = new QSslSocket(); if (pSslSocket->setSocketDescriptor(m_socketFD) && gCoreContext->CheckSubnet(pSslSocket)) { diff --git a/mythtv/libs/libmythupnp/websocket.h b/mythtv/libs/libmythupnp/websocket.h index 8cea0b7e250..6d4c11c6e98 100644 --- a/mythtv/libs/libmythupnp/websocket.h +++ b/mythtv/libs/libmythupnp/websocket.h @@ -98,7 +98,7 @@ class WebSocketFrame m_fragmented = false; } - typedef enum OpCodes + enum OpCode { kOpContinuation = 0x0, kOpTextFrame = 0x1, @@ -108,7 +108,7 @@ class WebSocketFrame kOpPing = 0x9, kOpPong = 0xA // Reserved - } OpCode; + }; bool m_finalFrame {false}; QByteArray m_payload; @@ -216,7 +216,7 @@ class WebSocketWorker : public QObject void Exec(); - typedef enum ErrorCodes + enum ErrorCode { kCloseNormal = 1000, kCloseGoingAway = 1001, @@ -237,7 +237,7 @@ class WebSocketWorker : public QObject // Reserved - 1012-1014 kCloseNoTLS = 1012 // Connection closed because it must use TLS // Reserved - } ErrorCode; + }; public slots: void doRead(); diff --git a/mythtv/libs/libmythupnp/websocket_extensions/websocket_mythevent.cpp b/mythtv/libs/libmythupnp/websocket_extensions/websocket_mythevent.cpp index fef7b5e44c4..09741e7d732 100644 --- a/mythtv/libs/libmythupnp/websocket_extensions/websocket_mythevent.cpp +++ b/mythtv/libs/libmythupnp/websocket_extensions/websocket_mythevent.cpp @@ -57,7 +57,7 @@ void WebSocketMythEvent::customEvent(QEvent* event) if (!m_sendEvents) return; - MythEvent *me = static_cast<MythEvent *>(event); + auto *me = static_cast<MythEvent *>(event); QString message = me->Message(); if (message.startsWith("SYSTEM_EVENT")) diff --git a/mythtv/libs/libmythupnp/xsd.h b/mythtv/libs/libmythupnp/xsd.h index 95742349d01..291307e78bc 100644 --- a/mythtv/libs/libmythupnp/xsd.h +++ b/mythtv/libs/libmythupnp/xsd.h @@ -69,6 +69,6 @@ class UPNP_PUBLIC Xsd : public QDomDocument ////////////////////////////////////////////////////////////////////////////// -typedef struct TypeInfo { QString sAttrName; QString sContentType; } TypeInfo; +struct TypeInfo { QString sAttrName; QString sContentType; }; #endif diff --git a/mythtv/programs/mythavtest/main.cpp b/mythtv/programs/mythavtest/main.cpp index 5b049132eb7..d283e51238b 100644 --- a/mythtv/programs/mythavtest/main.cpp +++ b/mythtv/programs/mythavtest/main.cpp @@ -1,5 +1,6 @@ #include <unistd.h> #include <iostream> +#include <utility> using namespace std; @@ -7,8 +8,8 @@ using namespace std; #include <QDir> #include <QRegExp> #include <QString> -#include <QTime> #include <QSurfaceFormat> +#include <QTime> #include "tv_play.h" #include "programinfo.h" @@ -34,14 +35,14 @@ using namespace std; class VideoPerformanceTest { public: - VideoPerformanceTest(const QString &filename, bool decodeno, bool onlydecode, + VideoPerformanceTest(QString filename, bool decodeno, bool onlydecode, int runfor, bool deint, bool gpu) : m_file(std::move(filename)), m_noDecode(decodeno), m_decodeOnly(onlydecode), m_secondsToRun(runfor), m_deinterlace(deint), - m_allowgpu(gpu), + m_allowGpu(gpu), m_ctx(nullptr) { if (m_secondsToRun < 1) @@ -59,14 +60,14 @@ class VideoPerformanceTest { PIPMap dummy; RingBuffer *rb = RingBuffer::Create(m_file, false, true, 2000); - MythPlayer *mp = new MythPlayer( - (PlayerFlags)(kAudioMuted | (m_allowgpu ? (kDecodeAllowGPU | kDecodeAllowEXT): kNoFlags))); + auto *mp = new MythPlayer( + (PlayerFlags)(kAudioMuted | (m_allowGpu ? (kDecodeAllowGPU | kDecodeAllowEXT): kNoFlags))); mp->GetAudio()->SetAudioInfo("NULL", "NULL", 0, 0); mp->GetAudio()->SetNoAudio(); m_ctx = new PlayerContext("VideoPerformanceTest"); m_ctx->SetRingBuffer(rb); m_ctx->SetPlayer(mp); - ProgramInfo *pinfo = new ProgramInfo(m_file); + auto *pinfo = new ProgramInfo(m_file); m_ctx->SetPlayingInfo(pinfo); // makes a copy delete pinfo; mp->SetPlayerInfo(nullptr, GetMythMainWindow(), m_ctx); @@ -102,7 +103,7 @@ class VideoPerformanceTest if (dec) LOG(VB_GENERAL, LOG_INFO, QString("Using decoder: %1").arg(dec->GetCodecDecoderName())); - Jitterometer *jitter = new Jitterometer("Performance: ", static_cast<int>(mp->GetFrameRate())); + auto *jitter = new Jitterometer("Performance: ", static_cast<int>(mp->GetFrameRate())); int ms = m_secondsToRun * 1000; QTime start = QTime::currentTime(); @@ -169,7 +170,7 @@ class VideoPerformanceTest bool m_decodeOnly; int m_secondsToRun; bool m_deinterlace; - bool m_allowgpu; + bool m_allowGpu; PlayerContext *m_ctx; }; @@ -319,7 +320,7 @@ int main(int argc, char *argv[]) int seconds = 5; if (!cmdline.toString("seconds").isEmpty()) seconds = cmdline.toInt("seconds"); - VideoPerformanceTest *test = new VideoPerformanceTest(filename, + auto *test = new VideoPerformanceTest(filename, cmdline.toBool("nodecode"), cmdline.toBool("decodeonly"), seconds, cmdline.toBool("deinterlace"), diff --git a/mythtv/programs/mythbackend/autoexpire.cpp b/mythtv/programs/mythbackend/autoexpire.cpp index 5d3a5b1be49..5ec5cbde53e 100644 --- a/mythtv/programs/mythbackend/autoexpire.cpp +++ b/mythtv/programs/mythbackend/autoexpire.cpp @@ -176,7 +176,7 @@ void AutoExpire::CalcParams() uint64_t thisKBperMin = 0; // append unknown recordings to all fsIDs - vector<int>::iterator unknownfs_it = fsEncoderMap[-1].begin(); + auto unknownfs_it = fsEncoderMap[-1].begin(); for (; unknownfs_it != fsEncoderMap[-1].end(); ++unknownfs_it) fsEncoderMap[fsit->getFSysID()].push_back(*unknownfs_it); @@ -189,8 +189,7 @@ void AutoExpire::CalcParams() .arg(fsit->getUsedSpace() / 1024.0 / 1024.0, 7, 'f', 1) .arg(fsit->getFreeSpace() / 1024.0 / 1024.0, 7, 'f', 1)); - vector<int>::iterator encit = - fsEncoderMap[fsit->getFSysID()].begin(); + auto encit = fsEncoderMap[fsit->getFSysID()].begin(); for (; encit != fsEncoderMap[fsit->getFSysID()].end(); ++encit) { EncoderLink *enc = *(m_encoderList->find(*encit)); @@ -529,7 +528,7 @@ void AutoExpire::ExpireRecordings(void) LOG(VB_FILE, LOG_INFO, " Searching for files expirable in these directories"); QString myHostName = gCoreContext->GetHostName(); - pginfolist_t::iterator it = expireList.begin(); + auto it = expireList.begin(); while ((it != expireList.end()) && (max((int64_t)0LL, fsit->getFreeSpace()) < m_desired_space[fsit->getFSysID()])) @@ -625,7 +624,7 @@ void AutoExpire::SendDeleteMessages(pginfolist_t &deleteList) LOG(VB_FILE, LOG_INFO, LOC + "SendDeleteMessages, cycling through deleteList."); - pginfolist_t::iterator it = deleteList.begin(); + auto it = deleteList.begin(); while (it != deleteList.end()) { msg = QString("%1Expiring %2 MB for %3 => %4") @@ -804,7 +803,7 @@ void AutoExpire::PrintExpireList(const QString& expHost) msg += "(programs listed in order of expiration)"; cout << msg.toLocal8Bit().constData() << endl; - pginfolist_t::iterator i = expireList.begin(); + auto i = expireList.begin(); for (; i != expireList.end(); ++i) { ProgramInfo *first = (*i); @@ -849,7 +848,7 @@ void AutoExpire::GetAllExpiring(QStringList &strList) strList << QString::number(expireList.size()); - pginfolist_t::iterator it = expireList.begin(); + auto it = expireList.begin(); for (; it != expireList.end(); ++it) (*it)->ToStringList(strList); @@ -872,7 +871,7 @@ void AutoExpire::GetAllExpiring(pginfolist_t &list) FillDBOrdered(expireList, gCoreContext->GetNumSetting("AutoExpireMethod", emOldestFirst)); - pginfolist_t::iterator it = expireList.begin(); + auto it = expireList.begin(); for (; it != expireList.end(); ++it) list.push_back( new ProgramInfo( *(*it) )); @@ -1009,7 +1008,7 @@ void AutoExpire::FillDBOrdered(pginfolist_t &expireList, int expMethod) } else { - ProgramInfo *pginfo = new ProgramInfo(chanid, recstartts); + auto *pginfo = new ProgramInfo(chanid, recstartts); if (pginfo->GetChanID()) { LOG(VB_FILE, LOG_INFO, LOC + QString(" Adding %1 at %2") diff --git a/mythtv/programs/mythbackend/autoexpire.h b/mythtv/programs/mythbackend/autoexpire.h index 8c16b6c7255..77141582675 100644 --- a/mythtv/programs/mythbackend/autoexpire.h +++ b/mythtv/programs/mythbackend/autoexpire.h @@ -22,8 +22,8 @@ class EncoderLink; class FileSystemInfo; class MainServer; -typedef vector<ProgramInfo*> pginfolist_t; -typedef vector<EncoderLink*> enclinklist_t; +using pginfolist_t = vector<ProgramInfo*>; +using enclinklist_t = vector<EncoderLink*>; enum ExpireMethodType { emOldestFirst = 1, diff --git a/mythtv/programs/mythbackend/httpstatus.h b/mythtv/programs/mythbackend/httpstatus.h index d24b1d5e659..df92fc401e7 100644 --- a/mythtv/programs/mythbackend/httpstatus.h +++ b/mythtv/programs/mythbackend/httpstatus.h @@ -18,13 +18,13 @@ #include "httpserver.h" #include "programinfo.h" -typedef enum +enum HttpStatusMethod { HSM_Unknown = 0, HSM_GetStatusHTML = 1, HSM_GetStatusXML = 2 -} HttpStatusMethod; +}; ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// diff --git a/mythtv/programs/mythbackend/internetContent.cpp b/mythtv/programs/mythbackend/internetContent.cpp index d39a3570572..6e79846e35c 100644 --- a/mythtv/programs/mythbackend/internetContent.cpp +++ b/mythtv/programs/mythbackend/internetContent.cpp @@ -124,7 +124,7 @@ void InternetContent::GetInternetSearch( HTTPRequest *pRequest ) return; } - Search *search = new Search(); + auto *search = new Search(); QEventLoop loop; QObject::connect(search, SIGNAL(finishedSearch(Search *)), diff --git a/mythtv/programs/mythbackend/main_helpers.cpp b/mythtv/programs/mythbackend/main_helpers.cpp index e0b1888c759..fe32384cc8d 100644 --- a/mythtv/programs/mythbackend/main_helpers.cpp +++ b/mythtv/programs/mythbackend/main_helpers.cpp @@ -179,7 +179,7 @@ bool setupTVs(bool ismaster, bool &error) TVRec *tv = TVRec::GetTVRec(cardid); if (tv && tv->Init()) { - EncoderLink *enc = new EncoderLink(cardid, tv); + auto *enc = new EncoderLink(cardid, tv); tvList[cardid] = enc; } else @@ -200,7 +200,7 @@ bool setupTVs(bool ismaster, bool &error) TVRec *tv = TVRec::GetTVRec(cardid); if (tv && tv->Init()) { - EncoderLink *enc = new EncoderLink(cardid, tv); + auto *enc = new EncoderLink(cardid, tv); tvList[cardid] = enc; } else @@ -212,7 +212,7 @@ bool setupTVs(bool ismaster, bool &error) } else { - EncoderLink *enc = new EncoderLink(cardid, nullptr, host); + auto *enc = new EncoderLink(cardid, nullptr, host); tvList[cardid] = enc; } } @@ -367,7 +367,7 @@ int handle_command(const MythBackendCommandLineParser &cmdline) if (cmdline.toBool("printsched") || cmdline.toBool("testsched")) { - Scheduler *sched = new Scheduler(false, &tvList); + auto *sched = new Scheduler(false, &tvList); if (cmdline.toBool("printsched")) { if (!gCoreContext->ConnectToMasterServer()) @@ -442,7 +442,7 @@ using namespace MythTZ; int connect_to_master(void) { - MythSocket *tempMonitorConnection = new MythSocket(); + auto *tempMonitorConnection = new MythSocket(); if (tempMonitorConnection->ConnectToHost( gCoreContext->GetMasterServerIP(), MythCoreContext::GetMasterServerPort())) diff --git a/mythtv/programs/mythbackend/mainserver.cpp b/mythtv/programs/mythbackend/mainserver.cpp index 1121bdfcaa2..f28dff4272c 100644 --- a/mythtv/programs/mythbackend/mainserver.cpp +++ b/mythtv/programs/mythbackend/mainserver.cpp @@ -433,7 +433,7 @@ void MainServer::autoexpireUpdate(void) void MainServer::NewConnection(qt_socket_fd_t socketDescriptor) { QWriteLocker locker(&m_sockListLock); - MythSocket *ms = new MythSocket(socketDescriptor, this); + auto *ms = new MythSocket(socketDescriptor, this); if (ms->IsConnected()) m_controlSocketList.insert(ms); else @@ -1129,7 +1129,7 @@ void MainServer::customEvent(QEvent *e) if (e->type() == MythEvent::MythEventMessage) { - MythEvent *me = static_cast<MythEvent *>(e); + auto *me = static_cast<MythEvent *>(e); QString message = me->Message(); QString error; @@ -1433,7 +1433,7 @@ void MainServer::customEvent(QEvent *e) uint cardid = tokens[1].toUInt(); uint chanid = tokens[2].toUInt(); QDateTime startts = MythDate::fromString(tokens[3]); - RecStatus::Type recstatus = RecStatus::Type(tokens[4].toInt()); + auto recstatus = RecStatus::Type(tokens[4].toInt()); QDateTime recendts = MythDate::fromString(tokens[5]); m_sched->UpdateRecStatus(cardid, chanid, startts, recstatus, recendts); @@ -1748,14 +1748,12 @@ void MainServer::HandleAnnounce(QStringList &slist, QStringList commands, // Monitor connections are same as Playback but they don't // block shutdowns. See the Scheduler event loop for more. - PlaybackSockEventsMode eventsMode = - (PlaybackSockEventsMode)commands[3].toInt(); + auto eventsMode = (PlaybackSockEventsMode)commands[3].toInt(); QWriteLocker lock(&m_sockListLock); if (!m_controlSocketList.remove(socket)) return; // socket was disconnected - PlaybackSock *pbs = new PlaybackSock(this, socket, commands[2], - eventsMode); + auto *pbs = new PlaybackSock(this, socket, commands[2], eventsMode); m_playbackList.push_back(pbs); lock.unlock(); @@ -1772,7 +1770,7 @@ void MainServer::HandleAnnounce(QStringList &slist, QStringList commands, if (commands[1] == "Frontend") { pbs->SetAsFrontend(); - Frontend *frontend = new Frontend(); + auto *frontend = new Frontend(); frontend->m_name = commands[2]; // On a combined mbe/fe the frontend will connect using the localhost // address, we need the external IP which happily will be the same as @@ -1802,8 +1800,8 @@ void MainServer::HandleAnnounce(QStringList &slist, QStringList commands, QWriteLocker lock(&m_sockListLock); if (!m_controlSocketList.remove(socket)) return; // socket was disconnected - PlaybackSock *pbs = new PlaybackSock(this, socket, commands[2], - kPBSEvents_Normal); + auto *pbs = new PlaybackSock(this, socket, commands[2], + kPBSEvents_Normal); pbs->setAsMediaServer(); pbs->setBlockShutdown(false); m_playbackList.push_back(pbs); @@ -1827,8 +1825,8 @@ void MainServer::HandleAnnounce(QStringList &slist, QStringList commands, QWriteLocker lock(&m_sockListLock); if (!m_controlSocketList.remove(socket)) return; // socket was disconnected - PlaybackSock *pbs = new PlaybackSock(this, socket, commands[2], - kPBSEvents_None); + auto *pbs = new PlaybackSock(this, socket, commands[2], + kPBSEvents_None); m_playbackList.push_back(pbs); lock.unlock(); @@ -1844,7 +1842,7 @@ void MainServer::HandleAnnounce(QStringList &slist, QStringList commands, QStringList::const_iterator sit = slist.begin()+1; while (sit != slist.end()) { - RecordingInfo *recinfo = new RecordingInfo(sit, slist.end()); + auto *recinfo = new RecordingInfo(sit, slist.end()); if (!recinfo->GetChanID()) { delete recinfo; @@ -2154,7 +2152,7 @@ void MainServer::HandleQueryRecordings(const QString& type, PlaybackSock *pbs) int port = gCoreContext->GetBackendServerPort(); QString host = gCoreContext->GetHostName(); - ProgramList::iterator it = destination.begin(); + auto it = destination.begin(); for (it = destination.begin(); it != destination.end(); ++it) { ProgramInfo *proginfo = *it; @@ -2728,9 +2726,9 @@ bool MainServer::TruncateAndClose(ProgramInfo *pginfo, int fd, // Time between truncation steps in milliseconds const size_t sleep_time = 500; const size_t min_tps = 8 * 1024 * 1024; - const size_t calc_tps = (size_t) (cards * 1.2 * (22200000LL / 8.0)); + const auto calc_tps = (size_t) (cards * 1.2 * (22200000LL / 8.0)); const size_t tps = max(min_tps, calc_tps); - const size_t increment = (size_t) (tps * (sleep_time * 0.001F)); + const auto increment = (size_t) (tps * (sleep_time * 0.001F)); LOG(VB_FILE, LOG_INFO, LOC + QString("Truncating '%1' by %2 MB every %3 milliseconds") @@ -3078,7 +3076,7 @@ void MainServer::DoHandleDeleteRecording( qDebug() << "DoHandleDeleteRecording() Empty Recording ID"; } - DeleteThread *deleteThread = new DeleteThread(this, filename, + auto *deleteThread = new DeleteThread(this, filename, recinfo.GetTitle(), recinfo.GetChanID(), recinfo.GetRecordingStartTime(), recinfo.GetRecordingEndTime(), recinfo.GetRecordingID(), @@ -3253,7 +3251,7 @@ bool MainServer::HandleAddChildInput(uint inputid) if (hostname == localhostname) { - TVRec *tv = new TVRec(childid); + auto *tv = new TVRec(childid); if (!tv || !tv->Init()) { LOG(VB_GENERAL, LOG_ERR, LOC + @@ -3264,7 +3262,7 @@ bool MainServer::HandleAddChildInput(uint inputid) return false; } - EncoderLink *enc = new EncoderLink(childid, tv); + auto *enc = new EncoderLink(childid, tv); (*m_encoderList)[childid] = enc; } else @@ -3291,7 +3289,7 @@ bool MainServer::HandleAddChildInput(uint inputid) else { // Create the slave TVRec and EncoderLink. - TVRec *tv = new TVRec(inputid); + auto *tv = new TVRec(inputid); if (!tv || !tv->Init()) { LOG(VB_GENERAL, LOG_ERR, LOC + @@ -3301,7 +3299,7 @@ bool MainServer::HandleAddChildInput(uint inputid) return false; } - EncoderLink *enc = new EncoderLink(inputid, tv); + auto *enc = new EncoderLink(inputid, tv); (*m_encoderList)[inputid] = enc; } @@ -3767,8 +3765,7 @@ void MainServer::HandleGetPendingRecordings(PlaybackSock *pbs, m_sched->GetAllPending(strList); else { - Scheduler *sched = new Scheduler(false, m_encoderList, - tmptable, m_sched); + auto *sched = new Scheduler(false, m_encoderList, tmptable, m_sched); sched->FillRecordListFromDB(recordid); sched->GetAllPending(strList); delete sched; @@ -3782,7 +3779,7 @@ void MainServer::HandleGetPendingRecordings(PlaybackSock *pbs, if (query.exec() && query.size()) { - RecordingRule *record = new RecordingRule(); + auto *record = new RecordingRule(); record->m_recordID = recordid; if (record->Load() && record->m_searchType == kManualSearch) @@ -4325,8 +4322,8 @@ void MainServer::HandleFreeTuner(int cardid, PlaybackSock *pbs) static bool comp_livetvorder(const InputInfo &a, const InputInfo &b) { - if (a.m_livetvorder != b.m_livetvorder) - return a.m_livetvorder < b.m_livetvorder; + if (a.m_liveTvOrder != b.m_liveTvOrder) + return a.m_liveTvOrder < b.m_liveTvOrder; return a.m_inputid < b.m_inputid; } @@ -4374,7 +4371,7 @@ void MainServer::HandleGetFreeInputInfo(PlaybackSock *pbs, info.m_mplexid = busyinfo.m_mplexid; busyinputs.push_back(info); } - else if (info.m_livetvorder) + else if (info.m_liveTvOrder) { LOG(VB_CHANNEL, LOG_DEBUG, LOC + QString("Input %1 is free") @@ -4386,12 +4383,12 @@ void MainServer::HandleGetFreeInputInfo(PlaybackSock *pbs, // Loop over each busy input and restrict or delete any free // inputs that are in the same group. - vector<InputInfo>::iterator busyiter = busyinputs.begin(); + auto busyiter = busyinputs.begin(); for (; busyiter != busyinputs.end(); ++busyiter) { InputInfo &busyinfo = *busyiter; - vector<InputInfo>::iterator freeiter = freeinputs.begin(); + auto freeiter = freeinputs.begin(); while (freeiter != freeinputs.end()) { InputInfo &freeinfo = *freeiter; @@ -4674,8 +4671,7 @@ void MainServer::HandleRecorderQuery(QStringList &slist, QStringList &commands, } else if (command == "CHANGE_CHANNEL") { - ChannelChangeDirection direction = - (ChannelChangeDirection) slist[2].toInt(); + auto direction = (ChannelChangeDirection) slist[2].toInt(); enc->ChangeChannel(direction); retlist << "OK"; } @@ -4774,7 +4770,7 @@ void MainServer::HandleRecorderQuery(QStringList &slist, QStringList &commands, { QString channelname = slist[2]; uint chanid = slist[3].toUInt(); - BrowseDirection direction = (BrowseDirection)slist[4].toInt(); + auto direction = (BrowseDirection)slist[4].toInt(); QString starttime = slist[5]; QString title = "", subtitle = "", desc = "", category = ""; @@ -5216,7 +5212,7 @@ void MainServer::BackendQueryDiskSpace(QStringList &strlist, bool consolidated, m_sockListLock.unlock(); - for (list<PlaybackSock *>::iterator p = localPlaybackList.begin() ; + for (auto p = localPlaybackList.begin() ; p != localPlaybackList.end() ; ++p) { (*p)->GetDiskSpace(strlist); (*p)->DecrRef(); @@ -5445,7 +5441,7 @@ void MainServer::HandleMoveFile(PlaybackSock *pbs, const QString &storagegroup, // Renaming on same filesystem should always be fast but is liable to delays // for unknowable reasons so we delegate to a separate thread for safety. - RenameThread *renamer = new RenameThread(*this, *pbs, srcAbs, dstAbs); + auto *renamer = new RenameThread(*this, *pbs, srcAbs, dstAbs); MThreadPool::globalInstance()->start(renamer, "Rename"); } @@ -5564,8 +5560,7 @@ bool MainServer::HandleDeleteFile(const QString& filename, const QString& storag if (fd >= 0) { // Thread off the actual file truncate - TruncateThread *truncateThread = - new TruncateThread(this, fullfile, fd, size); + auto *truncateThread = new TruncateThread(this, fullfile, fd, size); truncateThread->run(); } @@ -6199,7 +6194,7 @@ void MainServer::HandleMusicFindAlbumArt(const QStringList &slist, PlaybackSock QStringList files = dir.entryList(); // create an empty image list - AlbumArtImages *images = new AlbumArtImages(mdata, false); + auto *images = new AlbumArtImages(mdata, false); fi.setFile(mdata->Filename(false)); QString startDir = fi.path(); @@ -6207,7 +6202,7 @@ void MainServer::HandleMusicFindAlbumArt(const QStringList &slist, PlaybackSock for (int x = 0; x < files.size(); x++) { fi.setFile(files.at(x)); - AlbumArtImage *image = new AlbumArtImage(); + auto *image = new AlbumArtImage(); image->m_filename = startDir + '/' + fi.fileName(); image->m_hostname = gCoreContext->GetHostName(); image->m_embedded = false; @@ -6375,8 +6370,8 @@ void MainServer::HandleMusicTagChangeImage(const QStringList &slist, PlaybackSoc } int songID = slist[2].toInt(); - ImageType oldType = (ImageType)slist[3].toInt(); - ImageType newType = (ImageType)slist[4].toInt(); + auto oldType = (ImageType)slist[3].toInt(); + auto newType = (ImageType)slist[4].toInt(); // load the metadata from the database MusicMetadata *mdata = MusicMetadata::createFromID(songID); @@ -6544,7 +6539,7 @@ void MainServer::HandleMusicTagAddImage(const QStringList& slist, PlaybackSock* // load the metadata from the database int songID = slist[2].toInt(); QString filename = slist[3]; - ImageType imageType = (ImageType) slist[4].toInt(); + auto imageType = (ImageType) slist[4].toInt(); MusicMetadata *mdata = MusicMetadata::createFromID(songID); @@ -8015,7 +8010,7 @@ LiveTVChain *MainServer::GetExistingChain(const QString &id) return nullptr; } -LiveTVChain *MainServer::GetExistingChain(const MythSocket *sock) +LiveTVChain *MainServer::GetExistingChain(MythSocket *sock) { QMutexLocker lock(&m_liveTVChainsLock); @@ -8172,7 +8167,7 @@ QString MainServer::LocalFilePath(const QString &path, const QString &wantgroup) void MainServer::reconnectTimeout(void) { - MythSocket *masterServerSock = new MythSocket(-1, this); + auto *masterServerSock = new MythSocket(-1, this); QString server = gCoreContext->GetMasterServerIP(); int port = MythCoreContext::GetMasterServerPort(); diff --git a/mythtv/programs/mythbackend/mainserver.h b/mythtv/programs/mythbackend/mainserver.h index e5b04e88418..e78ebe173d5 100644 --- a/mythtv/programs/mythbackend/mainserver.h +++ b/mythtv/programs/mythbackend/mainserver.h @@ -292,7 +292,7 @@ class MainServer : public QObject, public MythSocketCBs static void DoDeleteInDB(DeleteStruct *ds); LiveTVChain *GetExistingChain(const QString &id); - LiveTVChain *GetExistingChain(const MythSocket *sock); + LiveTVChain *GetExistingChain(MythSocket *sock); LiveTVChain *GetChainWithRecording(const ProgramInfo &pginfo); void AddToChains(LiveTVChain *chain); void DeleteChain(LiveTVChain *chain); @@ -362,7 +362,7 @@ class MainServer : public QObject, public MythSocketCBs int m_exitCode {GENERIC_EXIT_OK}; - typedef QHash<QString,QString> RequestedBy; + using RequestedBy = QHash<QString,QString>; RequestedBy m_previewRequestedBy; bool m_stopped {false}; diff --git a/mythtv/programs/mythbackend/mediaserver.cpp b/mythtv/programs/mythbackend/mediaserver.cpp index ec66fb3c06c..bf021f98e81 100644 --- a/mythtv/programs/mythbackend/mediaserver.cpp +++ b/mythtv/programs/mythbackend/mediaserver.cpp @@ -74,7 +74,7 @@ void MediaServer::Init(bool bIsMaster, bool bDisableUPnp /* = false */) int nSSLPort = g_pConfig->GetValue( "BackendSSLPort", (g_pConfig->GetValue( "BackendStatusPort", 6544 ) + 10) ); int nWSPort = (g_pConfig->GetValue( "BackendStatusPort", 6544 ) + 5); - HttpServer *pHttpServer = new HttpServer(); + auto *pHttpServer = new HttpServer(); if (!pHttpServer->isListening()) { @@ -130,7 +130,7 @@ void MediaServer::Init(bool bIsMaster, bool bDisableUPnp /* = false */) LOG(VB_UPNP, LOG_INFO, "MediaServer: Registering Http Server Extensions."); - HtmlServerExtension *pHtmlServer = + auto *pHtmlServer = new HtmlServerExtension(m_sSharePath + "html", "backend_"); pHttpServer->RegisterExtension( pHtmlServer ); pHttpServer->RegisterExtension( new HttpConfig() ); diff --git a/mythtv/programs/mythbackend/mythsettings.cpp b/mythtv/programs/mythbackend/mythsettings.cpp index 8c6639c38cd..5eb48b79f5f 100644 --- a/mythtv/programs/mythbackend/mythsettings.cpp +++ b/mythtv/programs/mythbackend/mythsettings.cpp @@ -30,14 +30,13 @@ static QString extract_query_list( MythSettingList::const_iterator it = settings.begin(); for (; it != settings.end(); ++it) { - const MythSettingGroup *group = - dynamic_cast<const MythSettingGroup*>(*it); + const auto *group = dynamic_cast<const MythSettingGroup*>(*it); if (group) { list += extract_query_list(group->m_settings, stype); continue; } - const MythSetting *setting = dynamic_cast<const MythSetting*>(*it); + const auto *setting = dynamic_cast<const MythSetting*>(*it); if (setting && (setting->m_stype == stype)) list += QString(",'%1'").arg(setting->m_value); } @@ -51,8 +50,7 @@ static void fill_setting( MythSettingBase *sb, const QMap<QString,QString> &map, MythSetting::SettingType stype) { - const MythSettingGroup *group = - dynamic_cast<const MythSettingGroup*>(sb); + const auto *group = dynamic_cast<const MythSettingGroup*>(sb); if (group) { MythSettingList::const_iterator it = group->m_settings.begin(); @@ -61,7 +59,7 @@ static void fill_setting( return; } - MythSetting *setting = dynamic_cast<MythSetting*>(sb); + auto *setting = dynamic_cast<MythSetting*>(sb); if (setting && (setting->m_stype == stype)) { QMap<QString,QString>::const_iterator it = map.find(setting->m_value); @@ -506,7 +504,7 @@ bool parse_dom(MythSettingList &settings, const QDomElement &element, tmpIncludeAllChildren = true; } - MythSettingGroup *g = new MythSettingGroup( + auto *g = new MythSettingGroup( m_human_label, m_unique_label, m_ecma_script); if ((e.hasChildNodes()) && @@ -620,7 +618,7 @@ bool parse_dom(MythSettingList &settings, const QDomElement &element, return false; } - MythSetting *s = new MythSetting( + auto *s = new MythSetting( m["value"], m["default_data"], stype, m["label"], m["help_text"], dtype, data_list, display_list, range_min, range_max, diff --git a/mythtv/programs/mythbackend/mythsettings.h b/mythtv/programs/mythbackend/mythsettings.h index f2acf2c156b..c934e984713 100644 --- a/mythtv/programs/mythbackend/mythsettings.h +++ b/mythtv/programs/mythbackend/mythsettings.h @@ -13,7 +13,7 @@ class MythSettingBase virtual ~MythSettingBase() = default; virtual QString ToHTML(uint) const { return QString(); } }; -typedef QList<MythSettingBase*> MythSettingList; +using MythSettingList = QList<MythSettingBase*>; class MythSettingGroup : public MythSettingBase { @@ -34,14 +34,14 @@ class MythSettingGroup : public MythSettingBase class MythSetting : public MythSettingBase { public: - typedef enum { + enum SettingType { kFile, kHost, kGlobal, kInvalidSettingType, - } SettingType; + }; - typedef enum { + enum DataType { kInteger, kUnsignedInteger, kIntegerRange, @@ -57,7 +57,7 @@ class MythSetting : public MythSettingBase kTimeOfDay, kOther, kInvalidDataType, - } DataType; + }; MythSetting(const QString& _value, const QString& _default_data, SettingType _stype, const QString& _label, diff --git a/mythtv/programs/mythbackend/playbacksock.cpp b/mythtv/programs/mythbackend/playbacksock.cpp index 06972cf1321..d537fbeafeb 100644 --- a/mythtv/programs/mythbackend/playbacksock.cpp +++ b/mythtv/programs/mythbackend/playbacksock.cpp @@ -420,7 +420,7 @@ ProgramInfo *PlaybackSock::GetRecording(uint cardid) if (!SendReceiveStringList(strlist)) return nullptr; - ProgramInfo *pginfo = new ProgramInfo(strlist); + auto *pginfo = new ProgramInfo(strlist); if (!pginfo->HasPathname() && !pginfo->GetChanID()) { delete pginfo; diff --git a/mythtv/programs/mythbackend/playbacksock.h b/mythtv/programs/mythbackend/playbacksock.h index 4d9348d0ba3..92660fac4e3 100644 --- a/mythtv/programs/mythbackend/playbacksock.h +++ b/mythtv/programs/mythbackend/playbacksock.h @@ -18,12 +18,12 @@ class MythSocket; class MainServer; class ProgramInfo; -typedef enum { +enum PlaybackSockEventsMode { kPBSEvents_None = 0, kPBSEvents_Normal = 1, kPBSEvents_NonSystem = 2, kPBSEvents_SystemOnly = 3 -} PlaybackSockEventsMode; +}; class PlaybackSock : public ReferenceCounter { diff --git a/mythtv/programs/mythbackend/scheduler.cpp b/mythtv/programs/mythbackend/scheduler.cpp index 20e691263e6..4db013d0dbe 100644 --- a/mythtv/programs/mythbackend/scheduler.cpp +++ b/mythtv/programs/mythbackend/scheduler.cpp @@ -572,7 +572,7 @@ void Scheduler::FillRecordListFromMaster(void) QMutexLocker lockit(&m_schedLock); - RecordingList::iterator it = schedList.begin(); + auto it = schedList.begin(); for (; it != schedList.end(); ++it) m_reclist.push_back(*it); } @@ -588,7 +588,7 @@ void Scheduler::PrintList(RecList &list, bool onlyFutureRecordings) LOG(VB_SCHEDULE, LOG_INFO, "Title - Subtitle Ch Station " "Day Start End G I T N Pri"); - RecIter i = list.begin(); + auto i = list.begin(); for ( ; i != list.end(); ++i) { RecordingInfo *first = (*i); @@ -823,7 +823,7 @@ void Scheduler::SlaveConnected(RecordingList &slavelist) QMutexLocker lockit(&m_schedLock); QReadLocker tvlocker(&TVRec::s_inputsLock); - RecordingList::iterator it = slavelist.begin(); + auto it = slavelist.begin(); for (; it != slavelist.end(); ++it) { RecordingInfo *sp = *it; @@ -992,7 +992,7 @@ void Scheduler::PruneOverlaps(void) { RecordingInfo *lastp = nullptr; - RecIter dreciter = m_worklist.begin(); + auto dreciter = m_worklist.begin(); while (dreciter != m_worklist.end()) { RecordingInfo *p = *dreciter; @@ -1214,7 +1214,7 @@ void Scheduler::MarkOtherShowings(RecordingInfo *p) void Scheduler::MarkShowingsList(RecList &showinglist, RecordingInfo *p) { - RecIter i = showinglist.begin(); + auto i = showinglist.begin(); for ( ; i != showinglist.end(); ++i) { RecordingInfo *q = *i; @@ -1276,7 +1276,7 @@ bool Scheduler::TryAnotherShowing(RecordingInfo *p, bool samePriority, RecordingInfo *best = nullptr; uint bestaffinity = 0; - RecIter j = showinglist->begin(); + auto j = showinglist->begin(); for ( ; j != showinglist->end(); ++j) { RecordingInfo *q = *j; @@ -1393,8 +1393,7 @@ void Scheduler::SchedNewRecords(void) m_openEnd = (OpenEndType)gCoreContext->GetNumSetting("SchedOpenEnd", openEndNever); - RecIter i = m_worklist.begin(); - + auto i = m_worklist.begin(); for ( ; i != m_worklist.end(); ++i) { if ((*i)->GetRecordingStatus() != RecStatus::Recording && @@ -1406,7 +1405,7 @@ void Scheduler::SchedNewRecords(void) while (i != m_worklist.end()) { - RecIter levelStart = i; + auto levelStart = i; int recpriority = (*i)->GetRecordingPriority(); while (i != m_worklist.end()) @@ -1415,7 +1414,7 @@ void Scheduler::SchedNewRecords(void) (*i)->GetRecordingPriority() != recpriority) break; - RecIter sublevelStart = i; + auto sublevelStart = i; int recpriority2 = (*i)->GetRecordingPriority2(); LOG(VB_SCHEDULE, LOG_DEBUG, QString("Trying priority %1/%2...") .arg(recpriority).arg(recpriority2)); @@ -1572,7 +1571,7 @@ void Scheduler::PruneRedundants(void) RecordingInfo *lastp = nullptr; int lastrecpri2 = 0; - RecIter i = m_worklist.begin(); + auto i = m_worklist.begin(); while (i != m_worklist.end()) { RecordingInfo *p = *i; @@ -1655,7 +1654,7 @@ void Scheduler::UpdateNextRecord(void) QMap<int, QDateTime> nextRecMap; - RecIter i = m_reclist.begin(); + auto i = m_reclist.begin(); while (i != m_reclist.end()) { RecordingInfo *p = *i; @@ -1868,7 +1867,7 @@ void Scheduler::AddRecording(const RecordingInfo &pi) LOG(VB_GENERAL, LOG_INFO, LOC + QString("AddRecording() recid: %1") .arg(pi.GetRecordingRuleID())); - for (RecIter it = m_reclist.begin(); it != m_reclist.end(); ++it) + for (auto it = m_reclist.begin(); it != m_reclist.end(); ++it) { RecordingInfo *p = *it; if (p->GetRecordingStatus() == RecStatus::Recording && @@ -1884,7 +1883,7 @@ void Scheduler::AddRecording(const RecordingInfo &pi) LOG(VB_SCHEDULE, LOG_INFO, LOC + QString("Adding '%1' to reclist.").arg(pi.GetTitle())); - RecordingInfo * new_pi = new RecordingInfo(pi); + auto * new_pi = new RecordingInfo(pi); new_pi->m_mplexid = new_pi->QueryMplexID(); new_pi->m_sgroupid = m_sinputinfomap[new_pi->GetInputID()].m_sgroupid; m_reclist.push_back(new_pi); @@ -2055,7 +2054,7 @@ void Scheduler::run(void) gCoreContext->GetBoolSetting("blockSDWUwithoutClient", true); bool firstRun = true; QDateTime nextSleepCheck = MythDate::current(); - RecIter startIter = m_reclist.begin(); + auto startIter = m_reclist.begin(); QDateTime idleSince = QDateTime(); int schedRunTime = 0; // max scheduler run time in seconds bool statuschanged = false; @@ -2172,7 +2171,7 @@ void Scheduler::run(void) // & call RecordPending for recordings due to start in 30 seconds // & handle RecStatus::Tuning updates bool done = false; - for (RecIter it = startIter; it != m_reclist.end() && !done; ++it) + for (auto it = startIter; it != m_reclist.end() && !done; ++it) { done = HandleRecording( **it, statuschanged, nextStartTime, nextWakeTime, @@ -2187,7 +2186,7 @@ void Scheduler::run(void) /// Wake any slave backends that need waking curtime = MythDate::current(); - for (RecIter it = startIter; it != m_reclist.end(); ++it) + for (auto it = startIter; it != m_reclist.end(); ++it) { int secsleft = curtime.secsTo((*it)->GetRecordingStartTime()); if ((secsleft - prerollseconds) <= wakeThreshold) @@ -2447,7 +2446,7 @@ bool Scheduler::HandleReschedule(void) LOG(VB_GENERAL, LOG_INFO, msg); // Write changed entries to oldrecorded. - for (RecIter it = m_reclist.begin(); it != m_reclist.end(); ++it) + for (auto it = m_reclist.begin(); it != m_reclist.end(); ++it) { RecordingInfo *p = *it; if (p->GetRecordingStatus() != p->m_oldrecstatus) @@ -2486,7 +2485,7 @@ bool Scheduler::HandleRunSchedulerStartup( QString startupParam = "user"; // find the first recording that WILL be recorded - RecIter firstRunIter = m_reclist.begin(); + auto firstRunIter = m_reclist.begin(); for ( ; firstRunIter != m_reclist.end(); ++firstRunIter) { if ((*firstRunIter)->GetRecordingStatus() == RecStatus::WillRecord || @@ -2946,7 +2945,7 @@ bool Scheduler::AssignGroupInput(RecordingInfo &ri, // First, see if anything is already pending or still // recording. - for (RecIter j = m_reclist.begin(); j != m_reclist.end(); ++j) + for (auto j = m_reclist.begin(); j != m_reclist.end(); ++j) { RecordingInfo *p = (*j); if (now.secsTo(p->GetRecordingStartTime()) > @@ -3139,7 +3138,7 @@ void Scheduler::HandleIdleShutdown( if (!wasValid) idleSince = curtime; - RecIter idleIter = m_reclist.begin(); + auto idleIter = m_reclist.begin(); for ( ; idleIter != m_reclist.end(); ++idleIter) if ((*idleIter)->GetRecordingStatus() == RecStatus::WillRecord || @@ -3340,7 +3339,7 @@ void Scheduler::ShutdownServer(int prerollseconds, QDateTime &idleSince) { m_isShuttingDown = true; - RecIter recIter = m_reclist.begin(); + auto recIter = m_reclist.begin(); for ( ; recIter != m_reclist.end(); ++recIter) if ((*recIter)->GetRecordingStatus() == RecStatus::WillRecord || (*recIter)->GetRecordingStatus() == RecStatus::Pending) @@ -3481,7 +3480,7 @@ void Scheduler::PutInactiveSlavesToSleep(void) "next %1 minutes.") .arg(sleepThreshold / 60)); LOG(VB_SCHEDULE, LOG_DEBUG, "Checking scheduler's reclist"); - RecIter recIter = m_reclist.begin(); + auto recIter = m_reclist.begin(); QDateTime curtime = MythDate::current(); QStringList SlavesInUse; for ( ; recIter != m_reclist.end(); ++recIter) @@ -4536,7 +4535,7 @@ void Scheduler::AddNewRecords(void) if (inputname.isEmpty()) inputname = QString("Input %1").arg(result.value(24).toUInt()); - RecordingInfo *p = new RecordingInfo( + auto *p = new RecordingInfo( title, QString(),//sorttitle result.value(5).toString(),//subtitle @@ -4620,7 +4619,7 @@ void Scheduler::AddNewRecords(void) // time should be done after PruneOverlaps, but that would // complicate the list handling. Do it here unless it becomes // problematic. - for (RecIter rec = m_worklist.begin(); rec != m_worklist.end(); ++rec) + for (auto rec = m_worklist.begin(); rec != m_worklist.end(); ++rec) { RecordingInfo *r = *rec; if (p->IsSameTitleStartTimeAndChannel(*r)) @@ -4721,7 +4720,7 @@ void Scheduler::AddNewRecords(void) } LOG(VB_SCHEDULE, LOG_INFO, " +-- Cleanup..."); - RecIter tmp = tmpList.begin(); + auto tmp = tmpList.begin(); for ( ; tmp != tmpList.end(); ++tmp) m_worklist.push_back(*tmp); } @@ -4803,7 +4802,7 @@ void Scheduler::AddNotListed(void) { bool sor = (kSingleRecord == rectype) || (kOverrideRecord == rectype); - RecordingInfo *p = new RecordingInfo( + auto *p = new RecordingInfo( result.value(0).toString(), // Title QString(), // Title Sort (sor) ? result.value(1).toString() : QString(), // Subtitle @@ -4845,7 +4844,7 @@ void Scheduler::AddNotListed(void) { tmpList.push_back(p); } - RecIter tmp = tmpList.begin(); + auto tmp = tmpList.begin(); for ( ; tmp != tmpList.end(); ++tmp) m_worklist.push_back(*tmp); } @@ -5286,7 +5285,7 @@ int Scheduler::FillRecordingDir( LOG(VB_FILE | VB_SCHEDULE, LOG_INFO, LOC + "FillRecordingDir: Adjusting FS Weights from scheduler."); - for (RecConstIter recIter = reclist.begin(); recIter != reclist.end(); ++recIter) + for (auto recIter = reclist.begin(); recIter != reclist.end(); ++recIter) { RecordingInfo *thispg = *recIter; @@ -5414,8 +5413,7 @@ int Scheduler::FillRecordingDir( pginfolist_t expiring; m_expirer->GetAllExpiring(expiring); - for(pginfolist_t::iterator it=expiring.begin(); - it != expiring.end(); ++it) + for(auto it=expiring.begin(); it != expiring.end(); ++it) { // find the filesystem its on FileSystemInfo *fs = nullptr; @@ -5623,8 +5621,7 @@ void Scheduler::SchedLiveTV(void) // Get the program that will be recording on this channel at // record start time and assume this LiveTV session continues // for at least another 30 minutes from now. - RecordingInfo *dummy = new RecordingInfo( - in.m_chanid, m_livetvTime, true, 4); + auto *dummy = new RecordingInfo(in.m_chanid, m_livetvTime, true, 4); dummy->SetRecordingStartTime(m_schedTime); if (m_schedTime.secsTo(dummy->GetRecordingEndTime()) < 1800) dummy->SetRecordingEndTime(m_schedTime.addSecs(1800)); @@ -5745,7 +5742,7 @@ bool Scheduler::CreateConflictLists(void) // Create a new conflict list for the resulting set of inputs // and point each inputs list at it. - RecList *conflictlist = new RecList(); + auto *conflictlist = new RecList(); m_conflictlists.push_back(conflictlist); for (sit = checkset.begin(); sit != checkset.end(); ++sit) { @@ -5774,7 +5771,7 @@ bool Scheduler::CreateConflictLists(void) uint id = query.value(0).toUInt(); LOG(VB_GENERAL, LOG_ERR, LOC + QString("Input %1 is not assigned to any input group").arg(id)); - RecList *conflictlist = new RecList(); + auto *conflictlist = new RecList(); m_conflictlists.push_back(conflictlist); LOG(VB_SCHEDULE, LOG_INFO, QString("Assigning input %1 to conflict set %2") diff --git a/mythtv/programs/mythbackend/scheduler.h b/mythtv/programs/mythbackend/scheduler.h index 5ad5be69e9b..f33460067e0 100644 --- a/mythtv/programs/mythbackend/scheduler.h +++ b/mythtv/programs/mythbackend/scheduler.h @@ -286,8 +286,8 @@ class Scheduler : public MThread, public MythScheduler OpenEndType m_openEnd; // cache IsSameProgram() - typedef pair<const RecordingInfo*,const RecordingInfo*> IsSameKey; - typedef QMap<IsSameKey,bool> IsSameCacheType; + using IsSameKey = pair<const RecordingInfo*,const RecordingInfo*>; + using IsSameCacheType = QMap<IsSameKey,bool>; mutable IsSameCacheType m_cache_is_same_program; int m_tmLastLog {0}; }; diff --git a/mythtv/programs/mythbackend/services/capture.cpp b/mythtv/programs/mythbackend/services/capture.cpp index c10776f23a0..ac1211c0eca 100644 --- a/mythtv/programs/mythbackend/services/capture.cpp +++ b/mythtv/programs/mythbackend/services/capture.cpp @@ -88,7 +88,7 @@ DTC::CaptureCardList* Capture::GetCaptureCardList( const QString &sHostName, // return the results of the query // ---------------------------------------------------------------------- - DTC::CaptureCardList* pList = new DTC::CaptureCardList(); + auto* pList = new DTC::CaptureCardList(); while (query.next()) { @@ -179,7 +179,7 @@ DTC::CaptureCard* Capture::GetCaptureCard( int nCardId ) throw( QString( "Database Error executing query." )); } - DTC::CaptureCard* pCaptureCard = new DTC::CaptureCard(); + auto* pCaptureCard = new DTC::CaptureCard(); if (query.next()) { diff --git a/mythtv/programs/mythbackend/services/channel.cpp b/mythtv/programs/mythbackend/services/channel.cpp index 987c20099a8..74e32be9263 100644 --- a/mythtv/programs/mythbackend/services/channel.cpp +++ b/mythtv/programs/mythbackend/services/channel.cpp @@ -70,15 +70,15 @@ DTC::ChannelInfoList* Channel::GetChannelInfoList( uint nSourceID, // Build Response // ---------------------------------------------------------------------- - DTC::ChannelInfoList *pChannelInfos = new DTC::ChannelInfoList(); + auto *pChannelInfos = new DTC::ChannelInfoList(); nStartIndex = (nStartIndex > 0) ? min( nStartIndex, nTotalAvailable ) : 0; nCount = (nCount > 0) ? min(nCount, (nTotalAvailable - nStartIndex)) : (nTotalAvailable - nStartIndex); ChannelInfoList::iterator chanIt; - ChannelInfoList::iterator chanItBegin = chanList.begin() + nStartIndex; - ChannelInfoList::iterator chanItEnd = chanItBegin + nCount; + auto chanItBegin = chanList.begin() + nStartIndex; + auto chanItEnd = chanItBegin + nCount; for( chanIt = chanItBegin; chanIt < chanItEnd; ++chanIt ) { @@ -128,7 +128,7 @@ DTC::ChannelInfo* Channel::GetChannelInfo( uint nChanID ) if (nChanID == 0) throw( QString("Channel ID appears invalid.")); - DTC::ChannelInfo *pChannelInfo = new DTC::ChannelInfo(); + auto *pChannelInfo = new DTC::ChannelInfo(); if (!FillChannelInfo(pChannelInfo, nChanID, true)) { @@ -231,7 +231,7 @@ DTC::VideoSourceList* Channel::GetVideoSourceList() // return the results of the query // ---------------------------------------------------------------------- - DTC::VideoSourceList* pList = new DTC::VideoSourceList(); + auto* pList = new DTC::VideoSourceList(); while (query.next()) { @@ -290,7 +290,7 @@ DTC::VideoSource* Channel::GetVideoSource( uint nSourceID ) // return the results of the query // ---------------------------------------------------------------------- - DTC::VideoSource *pVideoSource = new DTC::VideoSource(); + auto *pVideoSource = new DTC::VideoSource(); if (query.next()) { @@ -466,7 +466,7 @@ DTC::LineupList* Channel::GetDDLineupList( const QString &/*sSource*/, const QString &/*sUserId*/, const QString &/*sPassword*/ ) { - DTC::LineupList *pLineups = new DTC::LineupList(); + auto *pLineups = new DTC::LineupList(); return pLineups; } @@ -535,7 +535,7 @@ DTC::VideoMultiplexList* Channel::GetVideoMultiplexList( uint nSourceID, // Build Response // ---------------------------------------------------------------------- - DTC::VideoMultiplexList *pVideoMultiplexes = new DTC::VideoMultiplexList(); + auto *pVideoMultiplexes = new DTC::VideoMultiplexList(); nStartIndex = (nStartIndex > 0) ? min( nStartIndex, muxCount ) : 0; nCount = (nCount > 0) ? min( nCount, muxCount ) : muxCount; @@ -624,7 +624,7 @@ DTC::VideoMultiplex* Channel::GetVideoMultiplex( uint nMplexID ) throw( QString( "Database Error executing query." )); } - DTC::VideoMultiplex *pVideoMultiplex = new DTC::VideoMultiplex(); + auto *pVideoMultiplex = new DTC::VideoMultiplex(); if (query.next()) { diff --git a/mythtv/programs/mythbackend/services/content.cpp b/mythtv/programs/mythbackend/services/content.cpp index aa8ef8c41aa..9a92e2c5859 100644 --- a/mythtv/programs/mythbackend/services/content.cpp +++ b/mythtv/programs/mythbackend/services/content.cpp @@ -181,7 +181,7 @@ QFileInfo Content::GetImageFile( const QString &sStorageGroup, // Must generate Generate Image and save. // ---------------------------------------------------------------------- - QImage *pImage = new QImage( sFullFileName ); + auto *pImage = new QImage( sFullFileName ); if (!pImage || pImage->isNull()) return QFileInfo(); @@ -316,7 +316,7 @@ DTC::ArtworkInfoList* Content::GetRecordingArtworkList( int RecordedId, DTC::ArtworkInfoList* Content::GetProgramArtworkList( const QString &sInetref, int nSeason ) { - DTC::ArtworkInfoList *pArtwork = new DTC::ArtworkInfoList(); + auto *pArtwork = new DTC::ArtworkInfoList(); FillArtworkInfoList (pArtwork, sInetref, nSeason); @@ -565,9 +565,8 @@ QFileInfo Content::GetPreviewImage( int nRecordedId, if (!pginfo.IsLocal()) return QFileInfo(); - PreviewGenerator *previewgen = new PreviewGenerator( &pginfo, - QString(), - PreviewGenerator::kLocal); + auto *previewgen = new PreviewGenerator( &pginfo, QString(), + PreviewGenerator::kLocal); previewgen->SetPreviewTimeAsSeconds( nSecsIn ); previewgen->SetOutputFilename ( sPreviewFileName ); @@ -636,9 +635,8 @@ QFileInfo Content::GetPreviewImage( int nRecordedId, if (QFile::exists( sNewFileName )) return QFileInfo( sNewFileName ); - PreviewGenerator *previewgen = new PreviewGenerator( &pginfo, - QString(), - PreviewGenerator::kLocal); + auto *previewgen = new PreviewGenerator( &pginfo, QString(), + PreviewGenerator::kLocal); previewgen->SetPreviewTimeAsSeconds( nSecsIn ); previewgen->SetOutputFilename ( sNewFileName ); previewgen->SetOutputSize (QSize(nWidth,nHeight)); @@ -914,9 +912,8 @@ DTC::LiveStreamInfo *Content::AddLiveStream( const QString &sStorageGroup, MythCoreContext::GenMythURL(sHostName, 0, sFileName, sStorageGroup); } - HTTPLiveStream *hls = new - HTTPLiveStream(sFullFileName, nWidth, nHeight, nBitrate, nAudioBitrate, - nMaxSegments, 0, 0, nSampleRate); + auto *hls = new HTTPLiveStream(sFullFileName, nWidth, nHeight, nBitrate, + nAudioBitrate, nMaxSegments, 0, 0, nSampleRate); if (!hls) { @@ -956,7 +953,7 @@ DTC::LiveStreamInfo *Content::StopLiveStream( int nId ) DTC::LiveStreamInfo *Content::GetLiveStream( int nId ) { - HTTPLiveStream *hls = new HTTPLiveStream(nId); + auto *hls = new HTTPLiveStream(nId); if (!hls) { diff --git a/mythtv/programs/mythbackend/services/dvr.cpp b/mythtv/programs/mythbackend/services/dvr.cpp index e22af870577..c4b380a85c6 100644 --- a/mythtv/programs/mythbackend/services/dvr.cpp +++ b/mythtv/programs/mythbackend/services/dvr.cpp @@ -95,7 +95,7 @@ DTC::ProgramList* Dvr::GetRecordedList( bool bDescending, // Build Response // ---------------------------------------------------------------------- - DTC::ProgramList *pPrograms = new DTC::ProgramList(); + auto *pPrograms = new DTC::ProgramList(); int nAvailable = 0; int nMax = (nCount > 0) ? nCount : progList.size(); @@ -234,7 +234,7 @@ DTC::ProgramList* Dvr::GetOldRecordedList( bool bDescending, // Build Response // ---------------------------------------------------------------------- - DTC::ProgramList *pPrograms = new DTC::ProgramList(); + auto *pPrograms = new DTC::ProgramList(); nCount = (int)progList.size(); int nEndIndex = (int)progList.size(); @@ -278,7 +278,7 @@ DTC::Program* Dvr::GetRecorded(int RecordedId, else pi = ProgramInfo(chanid, recstarttsRaw.toUTC()); - DTC::Program *pProgram = new DTC::Program(); + auto *pProgram = new DTC::Program(); FillProgramInfo( pProgram, &pi, true ); return pProgram; @@ -484,9 +484,8 @@ long Dvr::GetSavedBookmark( int RecordedId, if (offsettype.toLower() == "duration"){ if (ri.QueryKeyFrameDuration(&offset, position, isend)) return offset; - else - // If bookmark cannot be converted to a duration return -1 - return -1; + // If bookmark cannot be converted to a duration return -1 + return -1; } return position; } @@ -549,7 +548,7 @@ DTC::CutList* Dvr::GetRecordedCutList ( int RecordedId, else ri = RecordingInfo(chanid, recstarttsRaw.toUTC()); - DTC::CutList* pCutList = new DTC::CutList(); + auto* pCutList = new DTC::CutList(); if (offsettype == "Position") marktype = 1; else if (offsettype == "Duration") @@ -582,7 +581,7 @@ DTC::CutList* Dvr::GetRecordedCommBreak ( int RecordedId, else ri = RecordingInfo(chanid, recstarttsRaw.toUTC()); - DTC::CutList* pCutList = new DTC::CutList(); + auto* pCutList = new DTC::CutList(); if (offsettype == "Position") marktype = 1; else if (offsettype == "Duration") @@ -609,7 +608,7 @@ DTC::CutList* Dvr::GetRecordedSeek ( int RecordedId, RecordingInfo ri; ri = RecordingInfo(RecordedId); - DTC::CutList* pCutList = new DTC::CutList(); + auto* pCutList = new DTC::CutList(); if (offsettype == "BYTES") marktype = MARK_GOP_BYFRAME; else if (offsettype == "DURATION") @@ -641,7 +640,7 @@ DTC::ProgramList* Dvr::GetExpiringList( int nStartIndex, // Build Response // ---------------------------------------------------------------------- - DTC::ProgramList *pPrograms = new DTC::ProgramList(); + auto *pPrograms = new DTC::ProgramList(); nStartIndex = (nStartIndex > 0) ? min( nStartIndex, (int)infoList.size() ) : 0; nCount = (nCount > 0) ? min( nCount, (int)infoList.size() ) : infoList.size(); @@ -679,7 +678,7 @@ DTC::ProgramList* Dvr::GetExpiringList( int nStartIndex, DTC::EncoderList* Dvr::GetEncoderList() { - DTC::EncoderList* pList = new DTC::EncoderList(); + auto* pList = new DTC::EncoderList(); QReadLocker tvlocker(&TVRec::s_inputsLock); QList<InputInfo> inputInfoList = CardUtil::GetAllInputInfo(); @@ -750,7 +749,7 @@ DTC::EncoderList* Dvr::GetEncoderList() DTC::InputList* Dvr::GetInputList() { - DTC::InputList *pList = new DTC::InputList(); + auto *pList = new DTC::InputList(); QList<InputInfo> inputInfoList = CardUtil::GetAllInputInfo(); QList<InputInfo>::iterator it = inputInfoList.begin(); @@ -837,7 +836,7 @@ QStringList Dvr::GetPlayGroupList() DTC::RecRuleFilterList* Dvr::GetRecRuleFilterList() { - DTC::RecRuleFilterList* filterList = new DTC::RecRuleFilterList(); + auto* filterList = new DTC::RecRuleFilterList(); MSqlQuery query(MSqlQuery::InitCon()); @@ -913,7 +912,7 @@ DTC::TitleInfoList* Dvr::GetTitleInfoList() query.prepare(querystr); - DTC::TitleInfoList *pTitleInfos = new DTC::TitleInfoList(); + auto *pTitleInfos = new DTC::TitleInfoList(); if (!query.exec()) { MythDB::DBError("GetTitleList recorded", query); @@ -950,12 +949,12 @@ DTC::ProgramList* Dvr::GetUpcomingList( int nStartIndex, // NOTE: Fetching this information directly from the schedule is // significantly faster than using ProgramInfo::LoadFromScheduler() - Scheduler *scheduler = dynamic_cast<Scheduler*>(gCoreContext->GetScheduler()); + auto *scheduler = dynamic_cast<Scheduler*>(gCoreContext->GetScheduler()); if (scheduler) scheduler->GetAllPending(tmpList, nRecordId); // Sort the upcoming into only those which will record - RecList::iterator it = tmpList.begin(); + auto it = tmpList.begin(); for(; it < tmpList.end(); ++it) { if ((nRecStatus != 0) && @@ -988,7 +987,7 @@ DTC::ProgramList* Dvr::GetUpcomingList( int nStartIndex, // Build Response // ---------------------------------------------------------------------- - DTC::ProgramList *pPrograms = new DTC::ProgramList(); + auto *pPrograms = new DTC::ProgramList(); nStartIndex = (nStartIndex > 0) ? min( nStartIndex, (int)recordingList.size() ) : 0; nCount = (nCount > 0) ? min( nCount, (int)recordingList.size() ) : recordingList.size(); @@ -1031,12 +1030,12 @@ DTC::ProgramList* Dvr::GetConflictList( int nStartIndex, // NOTE: Fetching this information directly from the schedule is // significantly faster than using ProgramInfo::LoadFromScheduler() - Scheduler *scheduler = dynamic_cast<Scheduler*>(gCoreContext->GetScheduler()); + auto *scheduler = dynamic_cast<Scheduler*>(gCoreContext->GetScheduler()); if (scheduler) scheduler->GetAllPending(tmpList, nRecordId); // Sort the upcoming into only those which are conflicts - RecList::iterator it = tmpList.begin(); + auto it = tmpList.begin(); for(; it < tmpList.end(); ++it) { if (((*it)->GetRecordingStatus() == RecStatus::Conflict) && @@ -1052,7 +1051,7 @@ DTC::ProgramList* Dvr::GetConflictList( int nStartIndex, // Build Response // ---------------------------------------------------------------------- - DTC::ProgramList *pPrograms = new DTC::ProgramList(); + auto *pPrograms = new DTC::ProgramList(); nStartIndex = (nStartIndex > 0) ? min( nStartIndex, (int)recordingList.size() ) : 0; nCount = (nCount > 0) ? min( nCount, (int)recordingList.size() ) : recordingList.size(); @@ -1449,7 +1448,7 @@ DTC::RecRuleList* Dvr::GetRecordScheduleList( int nStartIndex, // Build Response // ---------------------------------------------------------------------- - DTC::RecRuleList *pRecRules = new DTC::RecRuleList(); + auto *pRecRules = new DTC::RecRuleList(); nStartIndex = (nStartIndex > 0) ? min( nStartIndex, (int)recList.size() ) : 0; nCount = (nCount > 0) ? min( nCount, (int)recList.size() ) : recList.size(); @@ -1532,7 +1531,7 @@ DTC::RecRule* Dvr::GetRecordSchedule( uint nRecordId, throw QString("Invalid request."); } - DTC::RecRule *pRecRule = new DTC::RecRule(); + auto *pRecRule = new DTC::RecRule(); FillRecRuleInfo( pRecRule, &rule ); return pRecRule; @@ -1601,7 +1600,7 @@ int Dvr::RecordedIdForPathname(const QString & pathname) QString Dvr::RecStatusToString(int RecStatus) { - RecStatus::Type type = static_cast<RecStatus::Type>(RecStatus); + auto type = static_cast<RecStatus::Type>(RecStatus); return RecStatus::toString(type); } @@ -1610,15 +1609,15 @@ QString Dvr::RecStatusToDescription(int RecStatus, int recType, { //if (!StartTime.isValid()) // throw QString("StartTime appears invalid."); - RecStatus::Type rsType = static_cast<RecStatus::Type>(RecStatus); - RecordingType recordingType = static_cast<RecordingType>(recType); + auto rsType = static_cast<RecStatus::Type>(RecStatus); + auto recordingType = static_cast<RecordingType>(recType); return RecStatus::toDescription(rsType, recordingType, StartTime); } QString Dvr::RecTypeToString(QString recType) { bool ok = false; - RecordingType enumType = static_cast<RecordingType>(recType.toInt(&ok, 10)); + auto enumType = static_cast<RecordingType>(recType.toInt(&ok, 10)); if (ok) return toString(enumType); // RecordingType type = static_cast<RecordingType>(recType); @@ -1628,7 +1627,7 @@ QString Dvr::RecTypeToString(QString recType) QString Dvr::RecTypeToDescription(QString recType) { bool ok = false; - RecordingType enumType = static_cast<RecordingType>(recType.toInt(&ok, 10)); + auto enumType = static_cast<RecordingType>(recType.toInt(&ok, 10)); if (ok) return toDescription(enumType); // RecordingType type = static_cast<RecordingType>(recType); diff --git a/mythtv/programs/mythbackend/services/guide.cpp b/mythtv/programs/mythbackend/services/guide.cpp index 0e68a6e2142..e71d00510bd 100644 --- a/mythtv/programs/mythbackend/services/guide.cpp +++ b/mythtv/programs/mythbackend/services/guide.cpp @@ -114,7 +114,7 @@ DTC::ProgramGuide *Guide::GetProgramGuide( const QDateTime &rawStartTime, // NOTE: Fetching this information directly from the schedule is // significantly faster than using ProgramInfo::LoadFromScheduler() - Scheduler *scheduler = dynamic_cast<Scheduler*>(gCoreContext->GetScheduler()); + auto *scheduler = dynamic_cast<Scheduler*>(gCoreContext->GetScheduler()); if (scheduler) scheduler->GetAllPending(schedList); @@ -122,7 +122,7 @@ DTC::ProgramGuide *Guide::GetProgramGuide( const QDateTime &rawStartTime, // Build Response // ---------------------------------------------------------------------- - DTC::ProgramGuide *pGuide = new DTC::ProgramGuide(); + auto *pGuide = new DTC::ProgramGuide(); ChannelInfoList::iterator chan_it; for (chan_it = chanList.begin(); chan_it != chanList.end(); ++chan_it) @@ -298,7 +298,7 @@ DTC::ProgramList* Guide::GetProgramList(int nStartIndex, // NOTE: Fetching this information directly from the schedule is // significantly faster than using ProgramInfo::LoadFromScheduler() - Scheduler *scheduler = dynamic_cast<Scheduler*>(gCoreContext->GetScheduler()); + auto *scheduler = dynamic_cast<Scheduler*>(gCoreContext->GetScheduler()); if (scheduler) scheduler->GetAllPending(schedList); @@ -312,7 +312,7 @@ DTC::ProgramList* Guide::GetProgramList(int nStartIndex, // Build Response // ---------------------------------------------------------------------- - DTC::ProgramList *pPrograms = new DTC::ProgramList(); + auto *pPrograms = new DTC::ProgramList(); nCount = (int)progList.size(); int nEndIndex = (int)progList.size(); @@ -359,7 +359,7 @@ DTC::Program* Guide::GetProgramDetails( int nChanId, // Build Response - DTC::Program *pProgram = new DTC::Program(); + auto *pProgram = new DTC::Program(); ProgramInfo *pInfo = LoadProgramFromProgram(nChanId, dtStartTime); FillProgramInfo( pProgram, pInfo, true, true, true ); @@ -447,7 +447,7 @@ QFileInfo Guide::GetChannelIcon( int nChanId, return QFileInfo(); } - QImage *pImage = new QImage( sFullFileName ); + auto *pImage = new QImage( sFullFileName ); if (!pImage) { @@ -501,7 +501,7 @@ QFileInfo Guide::GetChannelIcon( int nChanId, DTC::ChannelGroupList* Guide::GetChannelGroupList( bool bIncludeEmpty ) { ChannelGroupList list = ChannelGroup::GetChannelGroups(bIncludeEmpty); - DTC::ChannelGroupList *pGroupList = new DTC::ChannelGroupList(); + auto *pGroupList = new DTC::ChannelGroupList(); ChannelGroupList::iterator it; for (it = list.begin(); it < list.end(); ++it) diff --git a/mythtv/programs/mythbackend/services/image.cpp b/mythtv/programs/mythbackend/services/image.cpp index bedc0d8e8af..17fe46f4b8a 100644 --- a/mythtv/programs/mythbackend/services/image.cpp +++ b/mythtv/programs/mythbackend/services/image.cpp @@ -76,7 +76,7 @@ DTC::ImageMetadataInfoList* Image::GetImageInfoList(int id) { // This holds the xml data structure from // the returned stringlist with the exif data - DTC::ImageMetadataInfoList *imInfoList = new DTC::ImageMetadataInfoList(); + auto *imInfoList = new DTC::ImageMetadataInfoList(); // Read all metadata tags // ImageManagerBe *mgr = ImageManagerBe::getInstance(); @@ -203,7 +203,7 @@ DTC::ImageSyncInfo* Image::GetSyncStatus( void ) QString("Image: Sync status is running: %1, current: %2, total: %3") .arg(running).arg(current).arg(total)); - DTC::ImageSyncInfo *syncInfo = new DTC::ImageSyncInfo(); + auto *syncInfo = new DTC::ImageSyncInfo(); syncInfo->setRunning(running); syncInfo->setCurrent(current); syncInfo->setTotal(total); diff --git a/mythtv/programs/mythbackend/services/music.cpp b/mythtv/programs/mythbackend/services/music.cpp index 1c8bf1b8a7d..855801df894 100644 --- a/mythtv/programs/mythbackend/services/music.cpp +++ b/mythtv/programs/mythbackend/services/music.cpp @@ -25,7 +25,7 @@ DTC::MusicMetadataInfoList* Music::GetTrackList(int nStartIndex, int nCount) { - AllMusic *all_music = new AllMusic(); + auto *all_music = new AllMusic(); while (!all_music->doneLoading()) { @@ -39,7 +39,7 @@ DTC::MusicMetadataInfoList* Music::GetTrackList(int nStartIndex, // Build Response // ---------------------------------------------------------------------- - DTC::MusicMetadataInfoList *pMusicMetadataInfos = new DTC::MusicMetadataInfoList(); + auto *pMusicMetadataInfos = new DTC::MusicMetadataInfoList(); nStartIndex = (nStartIndex > 0) ? min( nStartIndex, musicList->count() ) : 0; nCount = (nCount > 0) ? min( nCount, musicList->count() ) : musicList->count(); @@ -88,7 +88,7 @@ DTC::MusicMetadataInfoList* Music::GetTrackList(int nStartIndex, DTC::MusicMetadataInfo* Music::GetTrack(int Id) { - AllMusic *all_music = new AllMusic(); + auto *all_music = new AllMusic(); while (!all_music->doneLoading()) { @@ -104,7 +104,7 @@ DTC::MusicMetadataInfo* Music::GetTrack(int Id) throw(QString("No metadata found for selected ID!.")); } - DTC::MusicMetadataInfo *pMusicMetadataInfo = new DTC::MusicMetadataInfo(); + auto *pMusicMetadataInfo = new DTC::MusicMetadataInfo(); FillMusicMetadataInfo(pMusicMetadataInfo, metadata, true); diff --git a/mythtv/programs/mythbackend/services/myth.cpp b/mythtv/programs/mythbackend/services/myth.cpp index d015fe8484a..76ddc8a41e0 100644 --- a/mythtv/programs/mythbackend/services/myth.cpp +++ b/mythtv/programs/mythbackend/services/myth.cpp @@ -96,7 +96,7 @@ DTC::ConnectionInfo* Myth::GetConnectionInfo( const QString &sPin ) // Create and populate a ConnectionInfo object // ---------------------------------------------------------------------- - DTC::ConnectionInfo *pInfo = new DTC::ConnectionInfo(); + auto *pInfo = new DTC::ConnectionInfo(); DTC::DatabaseInfo *pDatabase = pInfo->Database(); DTC::WOLInfo *pWOL = pInfo->WOL(); DTC::VersionInfo *pVersion = pInfo->Version(); @@ -263,7 +263,7 @@ DTC::StorageGroupDirList *Myth::GetStorageGroupDirs( const QString &sGroupName, // return the results of the query plus R/W and size information // ---------------------------------------------------------------------- - DTC::StorageGroupDirList* pList = new DTC::StorageGroupDirList(); + auto* pList = new DTC::StorageGroupDirList(); while (query.next()) { @@ -394,7 +394,7 @@ bool Myth::RemoveStorageGroupDir( const QString &sGroupName, DTC::TimeZoneInfo *Myth::GetTimeZone( ) { - DTC::TimeZoneInfo *pResults = new DTC::TimeZoneInfo(); + auto *pResults = new DTC::TimeZoneInfo(); pResults->setTimeZoneID( MythTZ::getTimeZoneID() ); pResults->setUTCOffset( MythTZ::calc_utc_offset() ); @@ -469,7 +469,7 @@ DTC::LogMessageList *Myth::GetLogs( const QString &HostName, const QString &Level, const QString &MsgContains ) { - DTC::LogMessageList *pList = new DTC::LogMessageList(); + auto *pList = new DTC::LogMessageList(); MSqlQuery query(MSqlQuery::InitCon()); @@ -590,7 +590,7 @@ DTC::LogMessageList *Myth::GetLogs( const QString &HostName, DTC::FrontendList *Myth::GetFrontends( bool OnLine ) { - DTC::FrontendList *pList = new DTC::FrontendList(); + auto *pList = new DTC::FrontendList(); QMap<QString, Frontend*> frontends; if (OnLine) frontends = gBackendContext->GetConnectedFrontends(); @@ -665,7 +665,7 @@ DTC::SettingList *Myth::GetSettingList(const QString &sHostName) .arg( sHostName )); } - DTC::SettingList *pList = new DTC::SettingList(); + auto *pList = new DTC::SettingList(); //pList->setObjectName( "Settings" ); pList->setHostName ( sHostName ); @@ -792,7 +792,7 @@ bool Myth::SendMessage( const QString &sMessage, if (udpPort != 0) port = udpPort; - QUdpSocket *sock = new QUdpSocket(); + auto *sock = new QUdpSocket(); QByteArray utf8 = xmlMessage.toUtf8(); int size = utf8.length(); @@ -866,7 +866,7 @@ bool Myth::SendNotification( bool bError, if (udpPort != 0) port = udpPort; - QUdpSocket *sock = new QUdpSocket(); + auto *sock = new QUdpSocket(); QByteArray utf8 = xmlMessage.toUtf8(); int size = utf8.length(); @@ -938,7 +938,7 @@ bool Myth::CheckDatabase( bool repair ) bool Myth::DelayShutdown( void ) { - Scheduler *scheduler = dynamic_cast<Scheduler*>(gCoreContext->GetScheduler()); + auto *scheduler = dynamic_cast<Scheduler*>(gCoreContext->GetScheduler()); scheduler->DelayShutdown(); LOG(VB_GENERAL, LOG_NOTICE, "Shutdown delayed 5 minutes for external application."); return true; @@ -1035,7 +1035,7 @@ DTC::BackendInfo* Myth::GetBackendInfo( void ) // Create and populate a Configuration object // ---------------------------------------------------------------------- - DTC::BackendInfo *pInfo = new DTC::BackendInfo(); + auto *pInfo = new DTC::BackendInfo(); DTC::BuildInfo *pBuild = pInfo->Build(); DTC::EnvInfo *pEnv = pInfo->Env(); DTC::LogInfo *pLog = pInfo->Log(); diff --git a/mythtv/programs/mythbackend/services/serviceUtil.cpp b/mythtv/programs/mythbackend/services/serviceUtil.cpp index b717c408ae0..73f642d5898 100644 --- a/mythtv/programs/mythbackend/services/serviceUtil.cpp +++ b/mythtv/programs/mythbackend/services/serviceUtil.cpp @@ -525,7 +525,7 @@ void FillInputInfo(DTC::Input* input, const InputInfo& inputInfo) input->setCardId(inputInfo.m_inputid); input->setSourceId(inputInfo.m_sourceid); input->setDisplayName(inputInfo.m_displayName); - input->setLiveTVOrder(inputInfo.m_livetvorder); + input->setLiveTVOrder(inputInfo.m_liveTvOrder); input->setScheduleOrder(inputInfo.m_scheduleOrder); input->setRecPriority(inputInfo.m_recPriority); input->setQuickTune(inputInfo.m_quickTune); diff --git a/mythtv/programs/mythbackend/services/video.cpp b/mythtv/programs/mythbackend/services/video.cpp index eb6e9a7134a..3a9478c6f3a 100644 --- a/mythtv/programs/mythbackend/services/video.cpp +++ b/mythtv/programs/mythbackend/services/video.cpp @@ -90,7 +90,7 @@ DTC::VideoMetadataInfoList* Video::GetVideoList( const QString &Folder, // Build Response // ---------------------------------------------------------------------- - DTC::VideoMetadataInfoList *pVideoMetadataInfos = new DTC::VideoMetadataInfoList(); + auto *pVideoMetadataInfos = new DTC::VideoMetadataInfoList(); nStartIndex = (nStartIndex > 0) ? min( nStartIndex, (int)videos.size() ) : 0; nCount = (nCount > 0) ? min( nCount, (int)videos.size() ) : videos.size(); @@ -143,7 +143,7 @@ DTC::VideoMetadataInfo* Video::GetVideo( int Id ) if ( !metadata ) throw( QString( "No metadata found for selected ID!." )); - DTC::VideoMetadataInfo *pVideoMetadataInfo = new DTC::VideoMetadataInfo(); + auto *pVideoMetadataInfo = new DTC::VideoMetadataInfo(); FillVideoMetadataInfo ( pVideoMetadataInfo, metadata, true ); @@ -165,7 +165,7 @@ DTC::VideoMetadataInfo* Video::GetVideoByFileName( const QString &FileName ) if ( !metadata ) throw( QString( "No metadata found for selected filename!." )); - DTC::VideoMetadataInfo *pVideoMetadataInfo = new DTC::VideoMetadataInfo(); + auto *pVideoMetadataInfo = new DTC::VideoMetadataInfo(); FillVideoMetadataInfo ( pVideoMetadataInfo, metadata, true ); @@ -184,11 +184,11 @@ DTC::VideoLookupList* Video::LookupVideo( const QString &Title, const QString &GrabberType, bool AllowGeneric ) { - DTC::VideoLookupList *pVideoLookups = new DTC::VideoLookupList(); + auto *pVideoLookups = new DTC::VideoLookupList(); MetadataLookupList list; - MetadataFactory *factory = new MetadataFactory(nullptr); + auto *factory = new MetadataFactory(nullptr); if (factory) list = factory->SynchronousLookup(Title, Subtitle, @@ -401,7 +401,7 @@ DTC::BlurayInfo* Video::GetBluray( const QString &sPath ) LOG(VB_GENERAL, LOG_NOTICE, QString("Parsing Blu-ray at path: %1 ").arg(path)); - BlurayMetadata *bdmeta = new BlurayMetadata(path); + auto *bdmeta = new BlurayMetadata(path); if ( !bdmeta ) throw( QString( "Unable to open Blu-ray Metadata Parser!" )); @@ -412,7 +412,7 @@ DTC::BlurayInfo* Video::GetBluray( const QString &sPath ) if ( !bdmeta->ParseDisc() ) throw( QString( "Unable to parse metadata from Blu-ray Disc/Path!" )); - DTC::BlurayInfo *pBlurayInfo = new DTC::BlurayInfo(); + auto *pBlurayInfo = new DTC::BlurayInfo(); pBlurayInfo->setPath(path); pBlurayInfo->setTitle(bdmeta->GetTitle()); diff --git a/mythtv/programs/mythbackend/upnpcdsmusic.cpp b/mythtv/programs/mythbackend/upnpcdsmusic.cpp index 3f86fb38f67..a9171fce65d 100644 --- a/mythtv/programs/mythbackend/upnpcdsmusic.cpp +++ b/mythtv/programs/mythbackend/upnpcdsmusic.cpp @@ -91,9 +91,9 @@ void UPnpCDSMusic::CreateRoot() // HACK: I'm not entirely happy with this solution, but it's at least // tidier than passing through half a dozen extra args to Load[Foo] // or having yet more methods just to load the counts - UPnpCDSRequest *pRequest = new UPnpCDSRequest(); + auto *pRequest = new UPnpCDSRequest(); pRequest->m_nRequestedCount = 0; // We don't want to load any results, we just want the TotalCount - UPnpCDSExtensionResults *pResult = new UPnpCDSExtensionResults(); + auto *pResult = new UPnpCDSExtensionResults(); IDTokenMap tokens; // END HACK diff --git a/mythtv/programs/mythbackend/upnpcdsmusic.h b/mythtv/programs/mythbackend/upnpcdsmusic.h index 7c178e67b57..12526fd94b8 100644 --- a/mythtv/programs/mythbackend/upnpcdsmusic.h +++ b/mythtv/programs/mythbackend/upnpcdsmusic.h @@ -49,13 +49,13 @@ class UPnpCDSMusic : public UPnpCDSExtension void PopulateArtworkURIS( CDSObject *pItem, int songID ); - bool LoadArtists(const UPnpCDSRequest *pRequest, + static bool LoadArtists(const UPnpCDSRequest *pRequest, UPnpCDSExtensionResults *pResults, const IDTokenMap& tokens); bool LoadAlbums(const UPnpCDSRequest *pRequest, UPnpCDSExtensionResults *pResults, const IDTokenMap& tokens); - bool LoadGenres(const UPnpCDSRequest *pRequest, + static bool LoadGenres(const UPnpCDSRequest *pRequest, UPnpCDSExtensionResults *pResults, const IDTokenMap& tokens); bool LoadTracks(const UPnpCDSRequest *pRequest, diff --git a/mythtv/programs/mythbackend/upnpcdstv.cpp b/mythtv/programs/mythbackend/upnpcdstv.cpp index e3ec08e5e02..667d99417a2 100644 --- a/mythtv/programs/mythbackend/upnpcdstv.cpp +++ b/mythtv/programs/mythbackend/upnpcdstv.cpp @@ -158,9 +158,9 @@ void UPnpCDSTv::CreateRoot() // HACK: I'm not entirely happy with this solution, but it's at least // tidier than passing through half a dozen extra args to Load[Foo] // or having yet more methods just to load the counts - UPnpCDSRequest *pRequest = new UPnpCDSRequest(); + auto *pRequest = new UPnpCDSRequest(); pRequest->m_nRequestedCount = 0; // We don't want to load any results, we just want the TotalCount - UPnpCDSExtensionResults *pResult = new UPnpCDSExtensionResults(); + auto *pResult = new UPnpCDSExtensionResults(); IDTokenMap tokens; // END HACK diff --git a/mythtv/programs/mythbackend/upnpcdstv.h b/mythtv/programs/mythbackend/upnpcdstv.h index 7170721ca2a..863611c32c5 100644 --- a/mythtv/programs/mythbackend/upnpcdstv.h +++ b/mythtv/programs/mythbackend/upnpcdstv.h @@ -47,18 +47,18 @@ class UPnpCDSTv : public UPnpCDSExtension bool LoadTitles ( const UPnpCDSRequest *pRequest, UPnpCDSExtensionResults *pResults, const IDTokenMap& tokens ); - bool LoadDates ( const UPnpCDSRequest *pRequest, - UPnpCDSExtensionResults *pResults, - const IDTokenMap& tokens ); - bool LoadGenres ( const UPnpCDSRequest *pRequest, - UPnpCDSExtensionResults *pResults, - const IDTokenMap& tokens ); - bool LoadChannels ( const UPnpCDSRequest *pRequest, - UPnpCDSExtensionResults *pResults, - const IDTokenMap& tokens ); - bool LoadRecGroups ( const UPnpCDSRequest *pRequest, - UPnpCDSExtensionResults *pResults, - const IDTokenMap& tokens ); + static bool LoadDates ( const UPnpCDSRequest *pRequest, + UPnpCDSExtensionResults *pResults, + const IDTokenMap& tokens ); + static bool LoadGenres ( const UPnpCDSRequest *pRequest, + UPnpCDSExtensionResults *pResults, + const IDTokenMap& tokens ); + static bool LoadChannels ( const UPnpCDSRequest *pRequest, + UPnpCDSExtensionResults *pResults, + const IDTokenMap& tokens ); + static bool LoadRecGroups ( const UPnpCDSRequest *pRequest, + UPnpCDSExtensionResults *pResults, + const IDTokenMap& tokens ); bool LoadMovies ( const UPnpCDSRequest *pRequest, UPnpCDSExtensionResults *pResults, IDTokenMap tokens ); diff --git a/mythtv/programs/mythbackend/upnpcdsvideo.cpp b/mythtv/programs/mythbackend/upnpcdsvideo.cpp index e940ee9fecf..5fa104a4c03 100644 --- a/mythtv/programs/mythbackend/upnpcdsvideo.cpp +++ b/mythtv/programs/mythbackend/upnpcdsvideo.cpp @@ -54,9 +54,9 @@ void UPnpCDSVideo::CreateRoot() // HACK: I'm not entirely happy with this solution, but it's at least // tidier than passing through half a dozen extra args to Load[Foo] // or having yet more methods just to load the counts - UPnpCDSRequest *pRequest = new UPnpCDSRequest(); + auto *pRequest = new UPnpCDSRequest(); pRequest->m_nRequestedCount = 0; // We don't want to load any results, we just want the TotalCount - UPnpCDSExtensionResults *pResult = new UPnpCDSExtensionResults(); + auto *pResult = new UPnpCDSExtensionResults(); IDTokenMap tokens; // END HACK diff --git a/mythtv/programs/mythbackend/upnpcdsvideo.h b/mythtv/programs/mythbackend/upnpcdsvideo.h index 6c33e3cfdd9..9cc4f4fdc6a 100644 --- a/mythtv/programs/mythbackend/upnpcdsvideo.h +++ b/mythtv/programs/mythbackend/upnpcdsvideo.h @@ -14,7 +14,7 @@ #include "mainserver.h" #include "upnpcds.h" -typedef QMap<int, QString> IntMap; +using IntMap = QMap<int, QString>; ////////////////////////////////////////////////////////////////////////////// // @@ -55,9 +55,9 @@ class UPnpCDSVideo : public UPnpCDSExtension UPnpCDSExtensionResults *pResults, IDTokenMap tokens ); - bool LoadGenres( const UPnpCDSRequest *pRequest, - UPnpCDSExtensionResults *pResults, - const IDTokenMap& tokens ); + static bool LoadGenres( const UPnpCDSRequest *pRequest, + UPnpCDSExtensionResults *pResults, + const IDTokenMap& tokens ); bool LoadVideos( const UPnpCDSRequest *pRequest, UPnpCDSExtensionResults *pResults, diff --git a/mythtv/programs/mythccextractor/main.cpp b/mythtv/programs/mythccextractor/main.cpp index 7d99fb1ef08..f74121dafe3 100644 --- a/mythtv/programs/mythccextractor/main.cpp +++ b/mythtv/programs/mythccextractor/main.cpp @@ -31,7 +31,7 @@ namespace { } } -static int RunCCExtract(const ProgramInfo &program_info, const QString & destdir) +static int RunCCExtract(ProgramInfo &program_info, const QString & destdir) { QString filename = program_info.GetPlaybackURL(); if (filename.startsWith("myth://")) @@ -66,13 +66,12 @@ static int RunCCExtract(const ProgramInfo &program_info, const QString & destdir tmprbuf->SetWaitForWrite(); } - PlayerFlags flags = (PlayerFlags)(kVideoIsNull | kAudioMuted | - kDecodeNoLoopFilter | kDecodeFewBlocks | - kDecodeLowRes | kDecodeSingleThreaded | - kDecodeNoDecode); - MythCCExtractorPlayer *ccp = new MythCCExtractorPlayer(flags, true, - filename, destdir); - PlayerContext *ctx = new PlayerContext(kCCExtractorInUseID); + auto flags = (PlayerFlags)(kVideoIsNull | kAudioMuted | + kDecodeNoLoopFilter | kDecodeFewBlocks | + kDecodeLowRes | kDecodeSingleThreaded | + kDecodeNoDecode); + auto *ccp = new MythCCExtractorPlayer(flags, true, filename, destdir); + auto *ctx = new PlayerContext(kCCExtractorInUseID); ctx->SetPlayingInfo(&program_info); ctx->SetRingBuffer(tmprbuf); ctx->SetPlayer(ccp); diff --git a/mythtv/programs/mythcommflag/BlankFrameDetector.cpp b/mythtv/programs/mythcommflag/BlankFrameDetector.cpp index 2586132f3d2..6df07a61c08 100644 --- a/mythtv/programs/mythcommflag/BlankFrameDetector.cpp +++ b/mythtv/programs/mythcommflag/BlankFrameDetector.cpp @@ -85,8 +85,8 @@ computeBlankMap(FrameAnalyzer::FrameMap *blankMap, long long nframes, /* Select percentile values from monochromatic frames. */ - uchar *blankmedian = new unsigned char[nblanks]; - float *blankstddev = new float[nblanks]; + auto *blankmedian = new unsigned char[nblanks]; + auto *blankstddev = new float[nblanks]; long long blankno = 0; for (frameno = 0; frameno < nframes; frameno++) { @@ -248,7 +248,7 @@ computeBreakMap(FrameAnalyzer::FrameMap *breakMap, long long jjlen = *jjblank; long long end = brke + jjlen / 2; - long long testlen = (long long)roundf((end - start) / fps); + auto testlen = (long long)roundf((end - start) / fps); if (testlen > kBreakType[ii].m_len + kBreakType[ii].m_delta) break; /* Too far ahead; break to next break length. */ diff --git a/mythtv/programs/mythcommflag/BorderDetector.h b/mythtv/programs/mythcommflag/BorderDetector.h index ca43bddaa04..b32fc5140bd 100644 --- a/mythtv/programs/mythcommflag/BorderDetector.h +++ b/mythtv/programs/mythcommflag/BorderDetector.h @@ -12,7 +12,7 @@ #ifndef __BORDERDETECTOR_H__ #define __BORDERDETECTOR_H__ -typedef struct AVFrame AVFrame; +using AVFrame = struct AVFrame; class MythPlayer; class TemplateFinder; diff --git a/mythtv/programs/mythcommflag/CannyEdgeDetector.h b/mythtv/programs/mythcommflag/CannyEdgeDetector.h index f0b8e565df7..cee81ca0133 100644 --- a/mythtv/programs/mythcommflag/CannyEdgeDetector.h +++ b/mythtv/programs/mythcommflag/CannyEdgeDetector.h @@ -12,7 +12,6 @@ extern "C" { } #include "EdgeDetector.h" -typedef struct VideoFrame_ VideoFrame; class MythPlayer; class CannyEdgeDetector : public EdgeDetector diff --git a/mythtv/programs/mythcommflag/ClassicCommDetector.cpp b/mythtv/programs/mythcommflag/ClassicCommDetector.cpp index 9acdc751499..53e85abab98 100644 --- a/mythtv/programs/mythcommflag/ClassicCommDetector.cpp +++ b/mythtv/programs/mythcommflag/ClassicCommDetector.cpp @@ -750,8 +750,8 @@ void ClassicCommDetector::ProcessFrame(VideoFrame *frame, int min = 255; int blankPixelsChecked = 0; long long totBrightness = 0; - unsigned char *rowMax = new unsigned char[m_height]; - unsigned char *colMax = new unsigned char[m_width]; + auto *rowMax = new unsigned char[m_height]; + auto *colMax = new unsigned char[m_width]; memset(rowMax, 0, sizeof(*rowMax)*m_height); memset(colMax, 0, sizeof(*colMax)*m_width); int topDarkRow = m_commDetectBorder; @@ -1200,7 +1200,7 @@ void ClassicCommDetector::BuildAllMethodsCommList(void) m_commBreakMap.clear(); - FrameBlock *fblock = new FrameBlock[m_blankFrameCount + 2]; + auto *fblock = new FrameBlock[m_blankFrameCount + 2]; int curBlock = 0; uint64_t curFrame = 1; @@ -1849,9 +1849,9 @@ void ClassicCommDetector::BuildBlankFrameCommList(void) { LOG(VB_COMMFLAG, LOG_INFO, "CommDetect::BuildBlankFrameCommList()"); - long long *bframes = new long long[m_blankFrameMap.count()*2]; - long long *c_start = new long long[m_blankFrameMap.count()]; - long long *c_end = new long long[m_blankFrameMap.count()]; + auto *bframes = new long long[m_blankFrameMap.count()*2]; + auto *c_start = new long long[m_blankFrameMap.count()]; + auto *c_end = new long long[m_blankFrameMap.count()]; int frames = 0; int commercials = 0; @@ -2031,7 +2031,7 @@ void ClassicCommDetector::BuildSceneChangeCommList(void) { if (section_start == -1) { - long long f = (long long)(s * m_fps); + auto f = (long long)(s * m_fps); for(int i = 0; i < m_fps; i++, f++) { if (m_sceneMap.contains(f)) @@ -2048,7 +2048,7 @@ void ClassicCommDetector::BuildSceneChangeCommList(void) if ((section_start >= 0) && (s > (section_start + 32))) { - long long f = (long long)(section_start * m_fps); + auto f = (long long)(section_start * m_fps); bool found_end = false; for(int i = 0; i < m_fps; i++, f++) diff --git a/mythtv/programs/mythcommflag/ClassicCommDetector.h b/mythtv/programs/mythcommflag/ClassicCommDetector.h index 3b01facf6b7..02cc4bb481a 100644 --- a/mythtv/programs/mythcommflag/ClassicCommDetector.h +++ b/mythtv/programs/mythcommflag/ClassicCommDetector.h @@ -73,7 +73,7 @@ class ClassicCommDetector : public CommDetectorBase virtual ~ClassicCommDetector() = default; private: - typedef struct frameblock + struct FrameBlock { long start; long end; @@ -87,8 +87,7 @@ class ClassicCommDetector : public CommDetectorBase int formatMatch; int aspectMatch; int score; - } - FrameBlock; + }; void ClearAllMaps(void); void GetBlankCommMap(frm_dir_map_t &comms); @@ -112,7 +111,7 @@ class ClassicCommDetector : public CommDetectorBase void CleanupFrameInfo(void); void GetLogoCommBreakMap(show_map_t &map); - enum SkipTypes m_commDetectMethod; + SkipType m_commDetectMethod; frm_dir_map_t m_lastSentCommBreakMap; bool m_commBreakMapUpdateRequested {false}; bool m_sendCommBreakMapUpdates {false}; diff --git a/mythtv/programs/mythcommflag/ClassicLogoDetector.cpp b/mythtv/programs/mythcommflag/ClassicLogoDetector.cpp index b1dc0334dea..67060974d16 100644 --- a/mythtv/programs/mythcommflag/ClassicLogoDetector.cpp +++ b/mythtv/programs/mythcommflag/ClassicLogoDetector.cpp @@ -12,15 +12,14 @@ #include "ClassicLogoDetector.h" #include "ClassicCommDetector.h" -typedef struct edgemaskentry +struct EdgeMaskEntry { int m_isEdge; int m_horiz; int m_vert; int m_rdiag; int m_ldiag; -} -EdgeMaskEntry; +}; ClassicLogoDetector::ClassicLogoDetector(ClassicCommDetector* commdetector, @@ -82,7 +81,7 @@ bool ClassicLogoDetector::searchForLogo(MythPlayer* player) m_logoInfoAvailable = false; - EdgeMaskEntry *edgeCounts = new EdgeMaskEntry[m_width * m_height]; + auto *edgeCounts = new EdgeMaskEntry[m_width * m_height]; // Back in 2005, a threshold of 50 minimum pixelsInMask was established. // I don't know whether that was tested against SD or HD resolutions. diff --git a/mythtv/programs/mythcommflag/ClassicLogoDetector.h b/mythtv/programs/mythcommflag/ClassicLogoDetector.h index 473eb78f976..729e2327501 100644 --- a/mythtv/programs/mythcommflag/ClassicLogoDetector.h +++ b/mythtv/programs/mythcommflag/ClassicLogoDetector.h @@ -3,8 +3,7 @@ #include "LogoDetectorBase.h" -typedef struct edgemaskentry EdgeMaskEntry; -typedef struct VideoFrame_ VideoFrame; +struct EdgeMaskEntry; class ClassicCommDetector; class ClassicLogoDetector : public LogoDetectorBase diff --git a/mythtv/programs/mythcommflag/CommDetector2.cpp b/mythtv/programs/mythcommflag/CommDetector2.cpp index 40929640545..c3bdced6b3d 100644 --- a/mythtv/programs/mythcommflag/CommDetector2.cpp +++ b/mythtv/programs/mythcommflag/CommDetector2.cpp @@ -81,7 +81,7 @@ bool MythPlayerInited(FrameAnalyzerItem &pass, MythPlayer *player, long long nframes) { - FrameAnalyzerItem::iterator it = pass.begin(); + auto it = pass.begin(); while (it != pass.end()) { FrameAnalyzer::analyzeFrameResult ares = @@ -123,7 +123,7 @@ long long processFrame(FrameAnalyzerItem &pass, long long nextFrame = 0; long long minNextFrame = FrameAnalyzer::ANYFRAME; - FrameAnalyzerItem::iterator it = pass.begin(); + auto it = pass.begin(); while (it != pass.end()) { FrameAnalyzer::analyzeFrameResult ares = @@ -165,7 +165,7 @@ long long processFrame(FrameAnalyzerItem &pass, int passFinished(FrameAnalyzerItem &pass, long long nframes, bool final) { - FrameAnalyzerItem::iterator it = pass.begin(); + auto it = pass.begin(); for (; it != pass.end(); ++it) (void)(*it)->finished(nframes, final); @@ -174,8 +174,8 @@ int passFinished(FrameAnalyzerItem &pass, long long nframes, bool final) int passReportTime(const FrameAnalyzerItem &pass) { - FrameAnalyzerItem::const_iterator it = pass.begin(); - for (; it != pass.end(); ++it) + auto it = pass.cbegin(); + for (; it != pass.cend(); ++it) (void)(*it)->reportTime(); return 0; @@ -186,9 +186,7 @@ bool searchingForLogo(TemplateFinder *tf, const FrameAnalyzerItem &pass) if (!tf) return false; - FrameAnalyzerItem::const_iterator it = - std::find(pass.begin(), pass.end(), tf); - + auto it = std::find(pass.cbegin(), pass.cend(), tf); return it != pass.end(); } @@ -215,7 +213,7 @@ QString debugDirectory(int chanid, const QDateTime& recstartts) return ""; } - const ProgramInfo pginfo(chanid, recstartts); + ProgramInfo pginfo(chanid, recstartts); if (!pginfo.GetChanID()) return ""; @@ -298,7 +296,7 @@ QString strftimeval(const struct timeval *tv) using namespace commDetector2; CommDetector2::CommDetector2( - enum SkipTypes commDetectMethod_in, + SkipType commDetectMethod_in, bool showProgress_in, bool fullSpeed_in, MythPlayer *player_in, @@ -308,7 +306,7 @@ CommDetector2::CommDetector2( QDateTime recstartts_in, QDateTime recendts_in, bool useDB) : - m_commDetectMethod((enum SkipTypes)(commDetectMethod_in & ~COMM_DETECT_2)), + m_commDetectMethod((SkipType)(commDetectMethod_in & ~COMM_DETECT_2)), m_showProgress(showProgress_in), m_fullSpeed(fullSpeed_in), m_player(player_in), m_startts(std::move(startts_in)), m_endts(std::move(endts_in)), @@ -390,7 +388,7 @@ CommDetector2::CommDetector2( if (!borderDetector) borderDetector = new BorderDetector(); - CannyEdgeDetector *cannyEdgeDetector = new CannyEdgeDetector(); + auto *cannyEdgeDetector = new CannyEdgeDetector(); if (!m_logoFinder) { diff --git a/mythtv/programs/mythcommflag/CommDetector2.h b/mythtv/programs/mythcommflag/CommDetector2.h index 2dffc490a80..3d15e400a34 100644 --- a/mythtv/programs/mythcommflag/CommDetector2.h +++ b/mythtv/programs/mythcommflag/CommDetector2.h @@ -31,8 +31,8 @@ QString strftimeval(const struct timeval *tv); }; /* namespace */ -typedef vector<FrameAnalyzer*> FrameAnalyzerItem; -typedef vector<FrameAnalyzerItem> FrameAnalyzerList; +using FrameAnalyzerItem = vector<FrameAnalyzer*>; +using FrameAnalyzerList = vector<FrameAnalyzerItem>; class CommDetector2 : public CommDetectorBase { @@ -57,7 +57,7 @@ class CommDetector2 : public CommDetectorBase int computeBreaks(long long nframes); private: - enum SkipTypes m_commDetectMethod; + SkipType m_commDetectMethod; bool m_showProgress {false}; bool m_fullSpeed {false}; MythPlayer *m_player {nullptr}; diff --git a/mythtv/programs/mythcommflag/CommDetectorBase.h b/mythtv/programs/mythcommflag/CommDetectorBase.h index cafccee7ecb..2441feabfc9 100644 --- a/mythtv/programs/mythcommflag/CommDetectorBase.h +++ b/mythtv/programs/mythcommflag/CommDetectorBase.h @@ -11,13 +11,13 @@ using namespace std; #define MAX_BLANK_FRAMES 180 -typedef enum commMapValues { +enum CommMapValue { MARK_START = 0, MARK_END = 1, MARK_PRESENT = 2, -} CommMapValue; +}; -typedef QMap<uint64_t, CommMapValue> show_map_t; +using show_map_t = QMap<uint64_t, CommMapValue>; /** \class CommDetectorBase * \brief Abstract base class for all CommDetectors. diff --git a/mythtv/programs/mythcommflag/EdgeDetector.h b/mythtv/programs/mythcommflag/EdgeDetector.h index b0ef0ca7d58..3d1ba0fbe61 100644 --- a/mythtv/programs/mythcommflag/EdgeDetector.h +++ b/mythtv/programs/mythcommflag/EdgeDetector.h @@ -8,7 +8,7 @@ #ifndef __EDGEDETECTOR_H__ #define __EDGEDETECTOR_H__ -typedef struct AVFrame AVFrame; +using AVFrame = struct AVFrame; namespace edgeDetector { diff --git a/mythtv/programs/mythcommflag/FrameAnalyzer.h b/mythtv/programs/mythcommflag/FrameAnalyzer.h index 37b8411242e..61b55082af6 100644 --- a/mythtv/programs/mythcommflag/FrameAnalyzer.h +++ b/mythtv/programs/mythcommflag/FrameAnalyzer.h @@ -10,8 +10,8 @@ /* Base class for commercial flagging video frame analyzers. */ #include <climits> - #include <QMap> +#include "mythframe.h" /* * At least FreeBSD doesn't define LONG_LONG_MAX, but it does define @@ -21,7 +21,6 @@ #define LONG_LONG_MAX __LONG_LONG_MAX__ #endif -typedef struct VideoFrame_ VideoFrame; class MythPlayer; class FrameAnalyzer @@ -41,7 +40,7 @@ class FrameAnalyzer /* 0-based frameno => nframes */ - typedef QMap<long long, long long> FrameMap; + using FrameMap = QMap<long long, long long>; virtual enum analyzeFrameResult MythPlayerInited( MythPlayer *player, long long nframes) { diff --git a/mythtv/programs/mythcommflag/Histogram.h b/mythtv/programs/mythcommflag/Histogram.h index 8cde0edbd41..b0fd66add07 100644 --- a/mythtv/programs/mythcommflag/Histogram.h +++ b/mythtv/programs/mythcommflag/Histogram.h @@ -1,7 +1,7 @@ #ifndef _HISTOGRAM_H_ #define _HISTOGRAM_H_ -typedef struct VideoFrame_ VideoFrame; +#include "mythframe.h" class Histogram { diff --git a/mythtv/programs/mythcommflag/HistogramAnalyzer.h b/mythtv/programs/mythcommflag/HistogramAnalyzer.h index 02399e69b11..5a043b38169 100644 --- a/mythtv/programs/mythcommflag/HistogramAnalyzer.h +++ b/mythtv/programs/mythcommflag/HistogramAnalyzer.h @@ -9,7 +9,6 @@ #include "FrameAnalyzer.h" -typedef struct AVFrame AVFrame; class PGMConverter; class BorderDetector; class TemplateFinder; @@ -32,7 +31,7 @@ class HistogramAnalyzer int reportTime(void) const; /* Each color 0-255 gets a scaled frequency counter 0-255. */ - typedef unsigned char Histogram[UCHAR_MAX + 1]; + using Histogram = unsigned char[UCHAR_MAX + 1]; const float *getMeans(void) const { return m_mean; } const unsigned char *getMedians(void) const { return m_median; } diff --git a/mythtv/programs/mythcommflag/LogoDetectorBase.h b/mythtv/programs/mythcommflag/LogoDetectorBase.h index f9863e663b3..3606cbffd02 100644 --- a/mythtv/programs/mythcommflag/LogoDetectorBase.h +++ b/mythtv/programs/mythcommflag/LogoDetectorBase.h @@ -2,9 +2,9 @@ #define _LOGODETECTORBASE_H_ #include <QObject> +#include "mythframe.h" class MythPlayer; -typedef struct VideoFrame_ VideoFrame; class LogoDetectorBase : public QObject { diff --git a/mythtv/programs/mythcommflag/PGMConverter.h b/mythtv/programs/mythcommflag/PGMConverter.h index 6c4b7df9633..4afe7c9b24a 100644 --- a/mythtv/programs/mythcommflag/PGMConverter.h +++ b/mythtv/programs/mythcommflag/PGMConverter.h @@ -11,7 +11,6 @@ extern "C" { #include "libavcodec/avcodec.h" /* AVFrame */ } -typedef struct VideoFrame_ VideoFrame; class MythPlayer; class MythAVCopy; diff --git a/mythtv/programs/mythcommflag/SceneChangeDetector.cpp b/mythtv/programs/mythcommflag/SceneChangeDetector.cpp index 9eae8bcd840..d48d1394228 100644 --- a/mythtv/programs/mythcommflag/SceneChangeDetector.cpp +++ b/mythtv/programs/mythcommflag/SceneChangeDetector.cpp @@ -23,10 +23,8 @@ int scenechange_data_sort_desc_frequency(const void *aa, const void *bb) { /* Descending by frequency, then ascending by color. */ - const struct SceneChangeDetector::scenechange_data *sc1 = - (const struct SceneChangeDetector::scenechange_data*)aa; - const struct SceneChangeDetector::scenechange_data *sc2 = - (const struct SceneChangeDetector::scenechange_data*)bb; + const auto *sc1 = (const struct SceneChangeDetector::scenechange_data*)aa; + const auto *sc2 = (const struct SceneChangeDetector::scenechange_data*)bb; int freqdiff = sc2->frequency - sc1->frequency; return freqdiff ? freqdiff : sc1->color - sc2->color; } @@ -192,7 +190,7 @@ SceneChangeDetector::finished(long long nframes, bool final) } /* Identify all scene-change frames (changeMap). */ - unsigned short *scdiffsort = new unsigned short[nframes]; + auto *scdiffsort = new unsigned short[nframes]; memcpy(scdiffsort, m_scdiff, nframes * sizeof(*m_scdiff)); unsigned short mindiff = quick_select_ushort(scdiffsort, nframes, (int)(0.979472 * nframes)); diff --git a/mythtv/programs/mythcommflag/SceneChangeDetector.h b/mythtv/programs/mythcommflag/SceneChangeDetector.h index f1be93acfa1..890f521b862 100644 --- a/mythtv/programs/mythcommflag/SceneChangeDetector.h +++ b/mythtv/programs/mythcommflag/SceneChangeDetector.h @@ -11,7 +11,7 @@ #include "FrameAnalyzer.h" -typedef struct AVFrame AVFrame; +using AVFrame = struct AVFrame; class HistogramAnalyzer; class SceneChangeDetector : public FrameAnalyzer @@ -35,10 +35,11 @@ class SceneChangeDetector : public FrameAnalyzer /* SceneChangeDetector interface. */ const FrameAnalyzer::FrameMap *getChanges(void) const { return &m_changeMap; } - typedef struct scenechange_data { + struct scenechange_data { unsigned char color; unsigned char frequency; - } SceneChangeData[UCHAR_MAX + 1]; + }; + using SceneChangeData = scenechange_data[UCHAR_MAX + 1]; protected: virtual ~SceneChangeDetector(void) = default; diff --git a/mythtv/programs/mythcommflag/SceneChangeDetectorBase.h b/mythtv/programs/mythcommflag/SceneChangeDetectorBase.h index 4ab8d59138c..0a12cc741e1 100644 --- a/mythtv/programs/mythcommflag/SceneChangeDetectorBase.h +++ b/mythtv/programs/mythcommflag/SceneChangeDetectorBase.h @@ -2,8 +2,7 @@ #define _SCENECHANGEDETECTORBASE_H_ #include <QObject> - -typedef struct VideoFrame_ VideoFrame; +#include "mythframe.h" class SceneChangeDetectorBase : public QObject { diff --git a/mythtv/programs/mythcommflag/TemplateMatcher.cpp b/mythtv/programs/mythcommflag/TemplateMatcher.cpp index 344b5fd1454..62eaa4c5a09 100644 --- a/mythtv/programs/mythcommflag/TemplateMatcher.cpp +++ b/mythtv/programs/mythcommflag/TemplateMatcher.cpp @@ -245,7 +245,7 @@ unsigned short pick_mintmpledges(const unsigned short *matches, static constexpr float kMatchStart = 0.20; static constexpr float kMatchEnd = 0.80; - ushort *sorted = new unsigned short[nframes]; + auto *sorted = new unsigned short[nframes]; memcpy(sorted, matches, nframes * sizeof(*matches)); qsort(sorted, nframes, sizeof(*sorted), sort_ascending); ushort minmatch = sorted[0]; @@ -253,12 +253,12 @@ unsigned short pick_mintmpledges(const unsigned short *matches, ushort matchrange = maxmatch - minmatch; /* degenerate minmatch==maxmatch case is gracefully handled */ - ushort leftwidth = (unsigned short)(kLeftWidth * matchrange); - ushort middlewidth = (unsigned short)(kMiddleWidth * matchrange); - ushort rightwidth = (unsigned short)(kRightWidth * matchrange); + auto leftwidth = (unsigned short)(kLeftWidth * matchrange); + auto middlewidth = (unsigned short)(kMiddleWidth * matchrange); + auto rightwidth = (unsigned short)(kRightWidth * matchrange); int nfreq = maxmatch + 1; - ushort *freq = new unsigned short[nfreq]; + auto *freq = new unsigned short[nfreq]; memset(freq, 0, nfreq * sizeof(*freq)); for (long long frameno = 0; frameno < nframes; frameno++) freq[matches[frameno]]++; /* freq[<matchcnt>] = <framecnt> */ diff --git a/mythtv/programs/mythcommflag/TemplateMatcher.h b/mythtv/programs/mythcommflag/TemplateMatcher.h index 2a09fadd42d..a7431087059 100644 --- a/mythtv/programs/mythcommflag/TemplateMatcher.h +++ b/mythtv/programs/mythcommflag/TemplateMatcher.h @@ -23,7 +23,7 @@ extern "C" { } #include "FrameAnalyzer.h" -typedef struct AVFrame AVFrame; +using AVFrame = struct AVFrame; class PGMConverter; class EdgeDetector; class TemplateFinder; diff --git a/mythtv/programs/mythcommflag/main.cpp b/mythtv/programs/mythcommflag/main.cpp index 7aed149ec40..c8d5abccd91 100644 --- a/mythtv/programs/mythcommflag/main.cpp +++ b/mythtv/programs/mythcommflag/main.cpp @@ -78,12 +78,12 @@ int recorderNum = -1; int jobID = -1; int lastCmd = -1; -static QMap<QString,SkipTypes> *init_skip_types(); -QMap<QString,SkipTypes> *skipTypes = init_skip_types(); +static QMap<QString,SkipType> *init_skip_types(); +QMap<QString,SkipType> *skipTypes = init_skip_types(); -static QMap<QString,SkipTypes> *init_skip_types(void) +static QMap<QString,SkipType> *init_skip_types(void) { - QMap<QString,SkipTypes> *tmp = new QMap<QString,SkipTypes>; + auto *tmp = new QMap<QString,SkipType>; (*tmp)["commfree"] = COMM_DETECT_COMMFREE; (*tmp)["uninit"] = COMM_DETECT_UNINIT; (*tmp)["off"] = COMM_DETECT_OFF; @@ -102,11 +102,11 @@ static QMap<QString,SkipTypes> *init_skip_types(void) return tmp; } -typedef enum +enum OutputMethod { kOutputMethodEssentials = 1, kOutputMethodFull, -} OutputMethod; +}; OutputMethod outputMethod = kOutputMethodEssentials; static QMap<QString,OutputMethod> *init_output_types(); @@ -114,7 +114,7 @@ QMap<QString,OutputMethod> *outputTypes = init_output_types(); static QMap<QString,OutputMethod> *init_output_types(void) { - QMap<QString,OutputMethod> *tmp = new QMap<QString,OutputMethod>; + auto *tmp = new QMap<QString,OutputMethod>; (*tmp)["essentials"] = kOutputMethodEssentials; (*tmp)["full"] = kOutputMethodFull; return tmp; @@ -469,7 +469,7 @@ static void incomingCustomEvent(QEvent* e) { if (e->type() == MythEvent::MythEventMessage) { - MythEvent *me = static_cast<MythEvent *>(e); + auto *me = static_cast<MythEvent *>(e); QString message = me->Message(); message = message.simplified(); @@ -521,7 +521,7 @@ static void incomingCustomEvent(QEvent* e) static int DoFlagCommercials( ProgramInfo *program_info, bool showPercentage, bool fullSpeed, int jobid, - MythCommFlagPlayer* cfp, enum SkipTypes commDetectMethod, + MythCommFlagPlayer* cfp, SkipType commDetectMethod, const QString &outputfilename, bool useDB) { commDetector = CommDetectorFactory::makeCommDetector( @@ -540,10 +540,10 @@ static int DoFlagCommercials( if (useDB) program_info->SaveCommFlagged(COMM_FLAG_PROCESSING); - CustomEventRelayer *cer = new CustomEventRelayer(incomingCustomEvent); - SlotRelayer *a = new SlotRelayer(commDetectorBreathe); - SlotRelayer *b = new SlotRelayer(commDetectorStatusUpdate); - SlotRelayer *c = new SlotRelayer(commDetectorGotNewCommercialBreakList); + auto *cer = new CustomEventRelayer(incomingCustomEvent); + auto *a = new SlotRelayer(commDetectorBreathe); + auto *b = new SlotRelayer(commDetectorStatusUpdate); + auto *c = new SlotRelayer(commDetectorGotNewCommercialBreakList); QObject::connect(commDetector, SIGNAL(breathe()), a, SLOT(relay())); QObject::connect(commDetector, SIGNAL(statusUpdate(const QString&)), @@ -716,7 +716,7 @@ static int FlagCommercials(ProgramInfo *program_info, int jobid, int breaksFound = 0; // configure commercial detection method - SkipTypes commDetectMethod = (SkipTypes)gCoreContext->GetNumSetting( + SkipType commDetectMethod = (SkipType)gCoreContext->GetNumSetting( "CommercialSkipMethod", COMM_DETECT_ALL); if (cmdline.toBool("commmethod")) @@ -726,7 +726,7 @@ static int FlagCommercials(ProgramInfo *program_info, int jobid, // assume definition as integer value bool ok = true; - commDetectMethod = (SkipTypes) commmethod.toInt(&ok); + commDetectMethod = (SkipType) commmethod.toInt(&ok); if (!ok) { // not an integer, attempt comma separated list @@ -754,7 +754,7 @@ static int FlagCommercials(ProgramInfo *program_info, int jobid, if (commDetectMethod == COMM_DETECT_UNINIT) { commDetectMethod = skipTypes->value(val); } else { - commDetectMethod = (SkipTypes) ((int)commDetectMethod + commDetectMethod = (SkipType) ((int)commDetectMethod | (int)skipTypes->value(val)); } } @@ -780,12 +780,11 @@ static int FlagCommercials(ProgramInfo *program_info, int jobid, } else if (query.next()) { - commDetectMethod = (enum SkipTypes)query.value(0).toInt(); + commDetectMethod = (SkipType)query.value(0).toInt(); if (commDetectMethod == COMM_DETECT_COMMFREE) { // if the channel is commercial free, drop to the default instead - commDetectMethod = - (enum SkipTypes)gCoreContext->GetNumSetting( + commDetectMethod = (SkipType)gCoreContext->GetNumSetting( "CommercialSkipMethod", COMM_DETECT_ALL); LOG(VB_COMMFLAG, LOG_INFO, QString("Chanid %1 is marked as being Commercial Free, " @@ -794,8 +793,7 @@ static int FlagCommercials(ProgramInfo *program_info, int jobid, } else if (commDetectMethod == COMM_DETECT_UNINIT) // no value set, so use the database default - commDetectMethod = - (enum SkipTypes)gCoreContext->GetNumSetting( + commDetectMethod = (SkipType)gCoreContext->GetNumSetting( "CommercialSkipMethod", COMM_DETECT_ALL); LOG(VB_COMMFLAG, LOG_INFO, QString("Using method: %1 from channel %2") @@ -862,12 +860,12 @@ static int FlagCommercials(ProgramInfo *program_info, int jobid, } } - PlayerFlags flags = (PlayerFlags)(kAudioMuted | - kVideoIsNull | - kDecodeLowRes | - kDecodeSingleThreaded | - kDecodeNoLoopFilter | - kNoITV); + auto flags = (PlayerFlags)(kAudioMuted | + kVideoIsNull | + kDecodeLowRes | + kDecodeSingleThreaded | + kDecodeNoLoopFilter | + kNoITV); /* blank detector needs to be only sample center for this optimization. */ if ((COMM_DETECT_BLANKS == commDetectMethod) || (COMM_DETECT_2_BLANK == commDetectMethod)) @@ -875,8 +873,8 @@ static int FlagCommercials(ProgramInfo *program_info, int jobid, flags = (PlayerFlags) (flags | kDecodeFewBlocks); } - MythCommFlagPlayer *cfp = new MythCommFlagPlayer(flags); - PlayerContext *ctx = new PlayerContext(kFlaggerInUseID); + auto *cfp = new MythCommFlagPlayer(flags); + auto *ctx = new PlayerContext(kFlaggerInUseID); ctx->SetPlayingInfo(program_info); ctx->SetRingBuffer(tmprbuf); ctx->SetPlayer(cfp); @@ -1021,10 +1019,9 @@ static int RebuildSeekTable(ProgramInfo *pginfo, int jobid, bool writefile = fal return GENERIC_EXIT_PERMISSIONS_ERROR; } - MythCommFlagPlayer *cfp = new MythCommFlagPlayer( - (PlayerFlags)(kAudioMuted | kVideoIsNull | - kDecodeNoDecode | kNoITV)); - PlayerContext *ctx = new PlayerContext(kFlaggerInUseID); + auto *cfp = new MythCommFlagPlayer((PlayerFlags)(kAudioMuted | kVideoIsNull | + kDecodeNoDecode | kNoITV)); + auto *ctx = new PlayerContext(kFlaggerInUseID); ctx->SetPlayingInfo(pginfo); ctx->SetRingBuffer(tmprbuf); ctx->SetPlayer(cfp); diff --git a/mythtv/programs/mythexternrecorder/MythExternRecApp.cpp b/mythtv/programs/mythexternrecorder/MythExternRecApp.cpp index 9f3349b20c2..97b6b799599 100644 --- a/mythtv/programs/mythexternrecorder/MythExternRecApp.cpp +++ b/mythtv/programs/mythexternrecorder/MythExternRecApp.cpp @@ -167,11 +167,9 @@ bool MythExternRecApp::Open(void) QObject::connect(&m_proc, &QProcess::readyReadStandardError, this, &MythExternRecApp::ProcReadStandardError); -#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError"); QObject::connect(&m_proc, &QProcess::errorOccurred, this, &MythExternRecApp::ProcError); -#endif qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus"); QObject::connect(&m_proc, diff --git a/mythtv/programs/mythexternrecorder/main.cpp b/mythtv/programs/mythexternrecorder/main.cpp index 09e8945d091..71ca26079f1 100644 --- a/mythtv/programs/mythexternrecorder/main.cpp +++ b/mythtv/programs/mythexternrecorder/main.cpp @@ -65,7 +65,7 @@ int main(int argc, char *argv[]) QString logfile = cmdline.GetLogFilePath(); QString logging = logPropagateArgs; - MythExternControl *control = new MythExternControl(); + auto *control = new MythExternControl(); MythExternRecApp *process = nullptr; QString conf_file = cmdline.toString("conf"); diff --git a/mythtv/programs/mythfilerecorder/mythfilerecorder.cpp b/mythtv/programs/mythfilerecorder/mythfilerecorder.cpp index fd926e62f59..ff1dade647d 100644 --- a/mythtv/programs/mythfilerecorder/mythfilerecorder.cpp +++ b/mythtv/programs/mythfilerecorder/mythfilerecorder.cpp @@ -314,7 +314,7 @@ bool Commands::Run(const QString & filename, int data_rate, bool loopinput) m_fileName = filename; m_streamer = new Streamer(this, m_fileName, data_rate, loopinput); - QThread *streamThread = new QThread(this); + auto *streamThread = new QThread(this); m_streamer->moveToThread(streamThread); connect(streamThread, SIGNAL(finished(void)), diff --git a/mythtv/programs/mythfilldatabase/channeldata.cpp b/mythtv/programs/mythfilldatabase/channeldata.cpp index 127732b06a1..db2d98e67af 100644 --- a/mythtv/programs/mythfilldatabase/channeldata.cpp +++ b/mythtv/programs/mythfilldatabase/channeldata.cpp @@ -137,7 +137,7 @@ ChannelList ChannelData::channelList(int sourceId) ChannelUtil::kChanGroupByChanid, sourceId); - ChannelInfoList::iterator it = channelList.begin(); + auto it = channelList.begin(); for ( ; it != channelList.end(); ++it) { QString chanName = (*it).m_name; @@ -202,7 +202,7 @@ void ChannelData::handleChannels(int id, ChannelInfoList *chanlist) bool insertChan = insert_chan(id); // unscannable source - ChannelInfoList::iterator i = chanlist->begin(); + auto i = chanlist->begin(); for (; i != chanlist->end(); ++i) { if ((*i).m_xmltvid.isEmpty()) diff --git a/mythtv/programs/mythfilldatabase/filldata.h b/mythtv/programs/mythfilldatabase/filldata.h index 47cc5cddc27..73adf2e0134 100644 --- a/mythtv/programs/mythfilldatabase/filldata.h +++ b/mythtv/programs/mythfilldatabase/filldata.h @@ -37,7 +37,7 @@ struct Source QString xmltvgrabber_prefmethod; vector<int> dd_dups; }; -typedef vector<Source> SourceList; +using SourceList = vector<Source>; class FillData { diff --git a/mythtv/programs/mythfilldatabase/xmltvparser.cpp b/mythtv/programs/mythfilldatabase/xmltvparser.cpp index e19082b41ed..5590b1834e2 100644 --- a/mythtv/programs/mythfilldatabase/xmltvparser.cpp +++ b/mythtv/programs/mythfilldatabase/xmltvparser.cpp @@ -42,7 +42,7 @@ void XMLTVParser::lateInit() static uint ELFHash(const QByteArray &ba) { - const uchar *k = (const uchar *)ba.data(); + const auto *k = (const uchar *)ba.data(); uint h = 0; if (k) @@ -74,7 +74,7 @@ static QString getFirstText(const QDomElement& element) ChannelInfo *XMLTVParser::parseChannel(QDomElement &element, QUrl &baseUrl) { - ChannelInfo *chaninfo = new ChannelInfo; + auto *chaninfo = new ChannelInfo; QString xmltvid = element.attribute("id", ""); @@ -316,7 +316,7 @@ static void parseAudio(QDomElement &element, ProgInfo *pginfo) ProgInfo *XMLTVParser::parseProgram(QDomElement &element) { QString programid, season, episode, totalepisodes; - ProgInfo *pginfo = new ProgInfo(); + auto *pginfo = new ProgInfo(); QString text = element.attribute("start", ""); fromXMLTVDate(text, pginfo->m_starttime); diff --git a/mythtv/programs/mythfrontend/action.h b/mythtv/programs/mythfrontend/action.h index cf4e2d59038..16550327ce2 100644 --- a/mythtv/programs/mythfrontend/action.h +++ b/mythtv/programs/mythfrontend/action.h @@ -72,7 +72,7 @@ class Action QString m_description; ///< The actions description. QStringList m_keys; ///< The keys bound to the action. }; -typedef QHash<QString, Action*> Context; +using Context = QHash<QString, Action*>; /** \class ActionID * \brief A class that uniquely identifies an action. @@ -117,6 +117,6 @@ class ActionID QString m_context; QString m_action; }; -typedef QList<ActionID> ActionList; +using ActionList = QList<ActionID>; #endif /* ACTION_H */ diff --git a/mythtv/programs/mythfrontend/actionset.cpp b/mythtv/programs/mythfrontend/actionset.cpp index 8f39e4e11ab..c6f3ba271dc 100644 --- a/mythtv/programs/mythfrontend/actionset.cpp +++ b/mythtv/programs/mythfrontend/actionset.cpp @@ -205,7 +205,7 @@ bool ActionSet::AddAction(const ActionID &id, else if ((*cit).find(id.GetAction()) != (*cit).end()) return false; - Action *a = new Action(description, keys); + auto *a = new Action(description, keys); (*cit).insert(id.GetAction(), a); const QStringList keylist = a->GetKeys(); diff --git a/mythtv/programs/mythfrontend/actionset.h b/mythtv/programs/mythfrontend/actionset.h index 7aa60013a6b..3dc5304c4d6 100644 --- a/mythtv/programs/mythfrontend/actionset.h +++ b/mythtv/programs/mythfrontend/actionset.h @@ -83,7 +83,7 @@ class ActionSet private: QMap<QString, ActionList> m_keyToActionMap; - typedef QHash<QString, Context> ContextMap; + using ContextMap = QHash<QString, Context>; ContextMap m_contexts; ActionList m_modified; }; diff --git a/mythtv/programs/mythfrontend/audiogeneralsettings.cpp b/mythtv/programs/mythfrontend/audiogeneralsettings.cpp index eb5c98644fd..7c0b634a98d 100644 --- a/mythtv/programs/mythfrontend/audiogeneralsettings.cpp +++ b/mythtv/programs/mythfrontend/audiogeneralsettings.cpp @@ -100,8 +100,7 @@ void AudioConfigScreen::Init(void) { StandardSettingDialog::Init(); - AudioConfigSettings *settings = - static_cast<AudioConfigSettings*>(GetGroupSettings()); + auto *settings = static_cast<AudioConfigSettings*>(GetGroupSettings()); settings->CheckConfiguration(); } @@ -112,7 +111,7 @@ AudioConfigSettings::AudioConfigSettings() addChild((m_OutputDevice = new AudioDeviceComboBox(this))); // Rescan button - ButtonStandardSetting *rescan = new ButtonStandardSetting("rescan"); + auto *rescan = new ButtonStandardSetting("rescan"); rescan->setLabel(tr("Rescan")); rescan->setHelpText(tr("Rescan for available audio devices. " "Current entry will be checked and " @@ -136,7 +135,7 @@ AudioConfigSettings::AudioConfigSettings() addChild(MythControlsVolume()); //Advanced Settings - GroupSetting * advancedSettings = new GroupSetting(); + auto *advancedSettings = new GroupSetting(); advancedSettings->setLabel(tr("Advanced Audio Settings")); advancedSettings->setHelpText(tr("Enable extra audio settings. Under most " "usage all options should be left alone")); @@ -423,7 +422,7 @@ HostComboBoxSetting *AudioConfigSettings::MaxAudioChannels() { QString name = "MaxChannels"; - HostComboBoxSetting *gc = new HostComboBoxSetting(name, false); + auto *gc = new HostComboBoxSetting(name, false); gc->setLabel(tr("Speaker configuration")); @@ -438,7 +437,7 @@ HostComboBoxSetting *AudioConfigSettings::MaxAudioChannels() HostCheckBoxSetting *AudioConfigSettings::AudioUpmix() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("AudioDefaultUpmix"); + auto *gc = new HostCheckBoxSetting("AudioDefaultUpmix"); gc->setLabel(tr("Upconvert stereo to 5.1 surround")); @@ -452,7 +451,7 @@ HostCheckBoxSetting *AudioConfigSettings::AudioUpmix() HostComboBoxSetting *AudioConfigSettings::AudioUpmixType() { - HostComboBoxSetting *gc = new HostComboBoxSetting("AudioUpmixType", false); + auto *gc = new HostComboBoxSetting("AudioUpmixType", false); gc->setLabel(tr("Upmix Quality")); @@ -468,7 +467,7 @@ HostComboBoxSetting *AudioConfigSettings::AudioUpmixType() HostCheckBoxSetting *AudioConfigSettings::AC3PassThrough() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("AC3PassThru"); + auto *gc = new HostCheckBoxSetting("AC3PassThru"); gc->setLabel(tr("Dolby Digital")); @@ -482,7 +481,7 @@ HostCheckBoxSetting *AudioConfigSettings::AC3PassThrough() HostCheckBoxSetting *AudioConfigSettings::DTSPassThrough() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("DTSPassThru"); + auto *gc = new HostCheckBoxSetting("DTSPassThru"); gc->setLabel(tr("DTS")); @@ -496,7 +495,7 @@ HostCheckBoxSetting *AudioConfigSettings::DTSPassThrough() HostCheckBoxSetting *AudioConfigSettings::EAC3PassThrough() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("EAC3PassThru"); + auto *gc = new HostCheckBoxSetting("EAC3PassThru"); gc->setLabel(tr("E-AC-3")); @@ -509,7 +508,7 @@ HostCheckBoxSetting *AudioConfigSettings::EAC3PassThrough() HostCheckBoxSetting *AudioConfigSettings::TrueHDPassThrough() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("TrueHDPassThru"); + auto *gc = new HostCheckBoxSetting("TrueHDPassThru"); gc->setLabel(tr("TrueHD")); @@ -522,7 +521,7 @@ HostCheckBoxSetting *AudioConfigSettings::TrueHDPassThrough() HostCheckBoxSetting *AudioConfigSettings::DTSHDPassThrough() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("DTSHDPassThru"); + auto *gc = new HostCheckBoxSetting("DTSHDPassThru"); gc->setLabel(tr("DTS-HD")); @@ -948,7 +947,7 @@ void AudioTest::prepareTest() QString msg = tr("Audio device is invalid or not useable."); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - MythConfirmationDialog *mcd = new MythConfirmationDialog(mainStack, + auto *mcd = new MythConfirmationDialog(mainStack, msg, false); if (mcd->Create()) @@ -963,8 +962,8 @@ bool AudioTest::event(QEvent *event) if (event->type() != ChannelChangedEvent::kEventType) return QObject::event(event); //not handled - ChannelChangedEvent *cce = (ChannelChangedEvent*)(event); - QString channel = cce->m_channel; + auto *cce = (ChannelChangedEvent*)(event); + QString channel = cce->m_channel; if (!cce->m_fulltest) return false; @@ -1026,7 +1025,7 @@ bool AudioTest::event(QEvent *event) HostCheckBoxSetting *AudioConfigSettings::MythControlsVolume() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("MythControlsVolume"); + auto *gc = new HostCheckBoxSetting("MythControlsVolume"); gc->setLabel(tr("Use internal volume controls")); @@ -1047,7 +1046,7 @@ HostCheckBoxSetting *AudioConfigSettings::MythControlsVolume() HostComboBoxSetting *AudioConfigSettings::MixerDevice() { - HostComboBoxSetting *gc = new HostComboBoxSetting("MixerDevice", true); + auto *gc = new HostComboBoxSetting("MixerDevice", true); gc->setLabel(tr("Mixer device")); #ifdef USING_OSS @@ -1088,7 +1087,7 @@ const char* AudioConfigSettings::MixerControlControls[] = HostComboBoxSetting *AudioConfigSettings::MixerControl() { - HostComboBoxSetting *gc = new HostComboBoxSetting("MixerControl", true); + auto *gc = new HostComboBoxSetting("MixerControl", true); gc->setLabel(tr("Mixer controls")); @@ -1105,8 +1104,7 @@ HostComboBoxSetting *AudioConfigSettings::MixerControl() HostSpinBoxSetting *AudioConfigSettings::MixerVolume() { - HostSpinBoxSetting *gs = new HostSpinBoxSetting("MasterMixerVolume", 0, 100, - 1); + auto *gs = new HostSpinBoxSetting("MasterMixerVolume", 0, 100, 1); gs->setLabel(tr("Master mixer volume")); @@ -1120,8 +1118,7 @@ HostSpinBoxSetting *AudioConfigSettings::MixerVolume() HostSpinBoxSetting *AudioConfigSettings::PCMVolume() { - HostSpinBoxSetting *gs = new HostSpinBoxSetting("PCMMixerVolume", 0, 100, - 1); + auto *gs = new HostSpinBoxSetting("PCMMixerVolume", 0, 100, 1); gs->setLabel(tr("PCM mixer volume")); @@ -1134,7 +1131,7 @@ HostSpinBoxSetting *AudioConfigSettings::PCMVolume() HostCheckBoxSetting *AudioConfigSettings::MPCM() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("StereoPCM"); + auto *gc = new HostCheckBoxSetting("StereoPCM"); gc->setLabel(tr("Stereo PCM Only")); @@ -1149,7 +1146,7 @@ HostCheckBoxSetting *AudioConfigSettings::MPCM() HostCheckBoxSetting *AudioConfigSettings::SRCQualityOverride() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("SRCQualityOverride"); + auto *gc = new HostCheckBoxSetting("SRCQualityOverride"); gc->setLabel(tr("Override SRC quality")); @@ -1162,7 +1159,7 @@ HostCheckBoxSetting *AudioConfigSettings::SRCQualityOverride() HostComboBoxSetting *AudioConfigSettings::SRCQuality() { - HostComboBoxSetting *gc = new HostComboBoxSetting("SRCQuality", false); + auto *gc = new HostComboBoxSetting("SRCQuality", false); gc->setLabel(tr("Sample rate conversion")); @@ -1183,7 +1180,7 @@ HostComboBoxSetting *AudioConfigSettings::SRCQuality() HostCheckBoxSetting *AudioConfigSettings::Audio48kOverride() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("Audio48kOverride"); + auto *gc = new HostCheckBoxSetting("Audio48kOverride"); gc->setLabel(tr("Force audio device output to 48kHz")); gc->setValue(false); @@ -1196,7 +1193,7 @@ HostCheckBoxSetting *AudioConfigSettings::Audio48kOverride() HostCheckBoxSetting *AudioConfigSettings::PassThroughOverride() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("PassThruDeviceOverride"); + auto *gc = new HostCheckBoxSetting("PassThruDeviceOverride"); gc->setLabel(tr("Separate digital output device")); @@ -1209,7 +1206,7 @@ HostCheckBoxSetting *AudioConfigSettings::PassThroughOverride() HostComboBoxSetting *AudioConfigSettings::PassThroughOutputDevice() { - HostComboBoxSetting *gc = new HostComboBoxSetting("PassThruOutputDevice", + auto *gc = new HostComboBoxSetting("PassThruOutputDevice", true); gc->setLabel(tr("Digital output device")); @@ -1234,7 +1231,7 @@ HostComboBoxSetting *AudioConfigSettings::PassThroughOutputDevice() HostCheckBoxSetting *AudioConfigSettings::SPDIFRateOverride() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("SPDIFRateOverride"); + auto *gc = new HostCheckBoxSetting("SPDIFRateOverride"); gc->setLabel(tr("SPDIF 48kHz rate override")); @@ -1249,7 +1246,7 @@ HostCheckBoxSetting *AudioConfigSettings::SPDIFRateOverride() HostCheckBoxSetting *AudioConfigSettings::HBRPassthrough() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("HBRPassthru"); + auto *gc = new HostCheckBoxSetting("HBRPassthru"); gc->setLabel(tr("HBR passthrough support")); diff --git a/mythtv/programs/mythfrontend/audiogeneralsettings.h b/mythtv/programs/mythfrontend/audiogeneralsettings.h index 19720902bca..e083692ad87 100644 --- a/mythtv/programs/mythfrontend/audiogeneralsettings.h +++ b/mythtv/programs/mythfrontend/audiogeneralsettings.h @@ -35,7 +35,7 @@ class AudioConfigSettings : public GroupSetting AudioConfigSettings(); void Load() override; // StandardSetting - typedef QMap<QString,AudioOutput::AudioDeviceConfig> ADCMap; + using ADCMap = QMap<QString,AudioOutput::AudioDeviceConfig>; ADCMap &AudioDeviceMap(void) { return audiodevs; }; AudioOutput::ADCVect &AudioDeviceVect(void) { return devices; }; diff --git a/mythtv/programs/mythfrontend/backendconnectionmanager.cpp b/mythtv/programs/mythfrontend/backendconnectionmanager.cpp index 90e39ef8333..c7be329386b 100644 --- a/mythtv/programs/mythfrontend/backendconnectionmanager.cpp +++ b/mythtv/programs/mythfrontend/backendconnectionmanager.cpp @@ -65,7 +65,7 @@ void BackendConnectionManager::customEvent(QEvent *event) if (event->type() == MythEvent::MythEventMessage) { - MythEvent *me = static_cast<MythEvent *>(event); + auto *me = static_cast<MythEvent *>(event); const QString& message = me->Message(); if (message == "BACKEND_SOCKETS_CLOSED") diff --git a/mythtv/programs/mythfrontend/channelrecpriority.cpp b/mythtv/programs/mythfrontend/channelrecpriority.cpp index 76e77cc253f..bc07733b22f 100644 --- a/mythtv/programs/mythfrontend/channelrecpriority.cpp +++ b/mythtv/programs/mythfrontend/channelrecpriority.cpp @@ -21,11 +21,11 @@ using namespace std; #include "mythdialogbox.h" #include "mythmainwindow.h" -typedef struct RecPriorityInfo +struct RecPriorityInfo { ChannelInfo *m_chan; int m_cnt; -} RecPriorityInfo; +}; class channelSort { @@ -158,8 +158,7 @@ void ChannelRecPriority::ShowMenu() MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(label, popupStack, - "chanrecmenupopup"); + auto *menuPopup = new MythDialogBox(label, popupStack, "chanrecmenupopup"); if (!menuPopup->Create()) { @@ -183,7 +182,7 @@ void ChannelRecPriority::changeRecPriority(int howMuch) if (!item) return; - ChannelInfo *chanInfo = item->GetData().value<ChannelInfo *>(); + auto *chanInfo = item->GetData().value<ChannelInfo *>(); // inc/dec recording priority int tempRecPriority = chanInfo->m_recpriority + howMuch; @@ -259,7 +258,7 @@ void ChannelRecPriority::FillList(void) int cnt = 999; while (result.next()) { - ChannelInfo *chaninfo = new ChannelInfo; + auto *chaninfo = new ChannelInfo; chaninfo->m_chanid = result.value(0).toInt(); chaninfo->m_channum = result.value(1).toString(); chaninfo->m_sourceid = result.value(2).toInt(); @@ -298,9 +297,8 @@ void ChannelRecPriority::updateList() { ChannelInfo *chanInfo = *it; - MythUIButtonListItem *item = - new MythUIButtonListItem(m_channelList, "", - qVariantFromValue(chanInfo)); + auto *item = new MythUIButtonListItem(m_channelList, "", + qVariantFromValue(chanInfo)); QString fontState = "default"; @@ -344,7 +342,7 @@ void ChannelRecPriority::SortList() if (item) { - ChannelInfo *channelItem = item->GetData().value<ChannelInfo *>(); + auto *channelItem = item->GetData().value<ChannelInfo *>(); m_currentItem = channelItem; } @@ -396,7 +394,7 @@ void ChannelRecPriority::updateInfo(MythUIButtonListItem *item) if (!item) return; - ChannelInfo *channelItem = item->GetData().value<ChannelInfo *>(); + auto *channelItem = item->GetData().value<ChannelInfo *>(); if (!m_channelData.isEmpty() && channelItem) { QString rectype; @@ -429,14 +427,14 @@ void ChannelRecPriority::upcoming() if (!item) return; - ChannelInfo *chanInfo = item->GetData().value<ChannelInfo *>(); + auto *chanInfo = item->GetData().value<ChannelInfo *>(); if (!chanInfo || chanInfo->m_chanid < 1) return; QString chanID = QString("%1").arg(chanInfo->m_chanid); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ProgLister *pl = new ProgLister(mainStack, plChannel, chanID, ""); + auto *pl = new ProgLister(mainStack, plChannel, chanID, ""); if (pl->Create()) mainStack->AddScreen(pl); else @@ -448,7 +446,7 @@ void ChannelRecPriority::customEvent(QEvent *event) { if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); + auto *dce = (DialogCompletionEvent*)(event); QString resultid = dce->GetId(); int buttonnum = dce->GetResult(); diff --git a/mythtv/programs/mythfrontend/customedit.cpp b/mythtv/programs/mythfrontend/customedit.cpp index f0bcc474007..258fd327393 100644 --- a/mythtv/programs/mythfrontend/customedit.cpp +++ b/mythtv/programs/mythfrontend/customedit.cpp @@ -135,9 +135,8 @@ void CustomEdit::loadData(void) // No memory leak. MythUIButtonListItem adds the new item // into m_ruleList. - MythUIButtonListItem *item = - new MythUIButtonListItem(m_ruleList, rule.title, - qVariantFromValue(rule)); + auto *item = new MythUIButtonListItem(m_ruleList, rule.title, + qVariantFromValue(rule)); if (trimTitle == m_baseTitle || result.value(0).toUInt() == m_pginfo->GetRecordingRuleID()) @@ -647,9 +646,9 @@ void CustomEdit::testClicked(void) } MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ProgLister *pl = new ProgLister(mainStack, plSQLSearch, - evaluate(m_descriptionEdit->GetText()), - m_subtitleEdit->GetText()); + auto *pl = new ProgLister(mainStack, plSQLSearch, + evaluate(m_descriptionEdit->GetText()), + m_subtitleEdit->GetText()); if (pl->Create()) { mainStack->AddScreen(pl); @@ -676,7 +675,7 @@ void CustomEdit::recordClicked(void) if (!checkSyntax()) return; - RecordingRule *record = new RecordingRule(); + auto *record = new RecordingRule(); MythUIButtonListItem* item = m_ruleList->GetItemCurrent(); CustomRuleInfo rule = item->GetData().value<CustomRuleInfo>(); @@ -697,7 +696,7 @@ void CustomEdit::recordClicked(void) } MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ScheduleEditor *schededit = new ScheduleEditor(mainStack, record); + auto *schededit = new ScheduleEditor(mainStack, record); if (schededit->Create()) { mainStack->AddScreen(schededit); @@ -734,8 +733,7 @@ void CustomEdit::storeClicked(void) msg += m_descriptionEdit->GetText(); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - MythDialogBox *storediag = new MythDialogBox(msg, mainStack, - "storePopup", true); + auto *storediag = new MythDialogBox(msg, mainStack, "storePopup", true); storediag->SetReturnEvent(this, "storeruledialog"); if (storediag->Create()) @@ -810,7 +808,7 @@ bool CustomEdit::checkSyntax(void) { MythScreenStack *popupStack = GetMythMainWindow()-> GetStack("popup stack"); - MythConfirmationDialog *checkSyntaxPopup = + auto *checkSyntaxPopup = new MythConfirmationDialog(popupStack, msg, false); if (checkSyntaxPopup->Create()) @@ -902,7 +900,7 @@ void CustomEdit::customEvent(QEvent *event) { if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); + auto *dce = (DialogCompletionEvent*)(event); QString resultid = dce->GetId(); QString resulttext = dce->GetResultText(); diff --git a/mythtv/programs/mythfrontend/custompriority.cpp b/mythtv/programs/mythfrontend/custompriority.cpp index 5d3f3c923f9..2df29ee43ca 100644 --- a/mythtv/programs/mythfrontend/custompriority.cpp +++ b/mythtv/programs/mythfrontend/custompriority.cpp @@ -454,7 +454,7 @@ void CustomPriority::testSchedule(void) ltitle = m_titleEdit->GetText(); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ViewScheduleDiff *vsd = new ViewScheduleDiff(mainStack, ttable, 0, ltitle); + auto *vsd = new ViewScheduleDiff(mainStack, ttable, 0, ltitle); if (vsd->Create()) mainStack->AddScreen(vsd); diff --git a/mythtv/programs/mythfrontend/editvideometadata.cpp b/mythtv/programs/mythfrontend/editvideometadata.cpp index e70ef260b8a..6d89ac3026e 100644 --- a/mythtv/programs/mythfrontend/editvideometadata.cpp +++ b/mythtv/programs/mythfrontend/editvideometadata.cpp @@ -233,7 +233,7 @@ namespace MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIFileBrowser *fb = new MythUIFileBrowser(popupStack, fp); + auto *fb = new MythUIFileBrowser(popupStack, fp); fb->SetNameFilter(GetSupportedImageExtensionFilter()); if (fb->Create()) { @@ -260,13 +260,12 @@ namespace const FileAssociations::association_list fa_list = FileAssociations::getFileAssociation().getList(); - for (FileAssociations::association_list::const_iterator p = - fa_list.begin(); p != fa_list.end(); ++p) + for (auto p = fa_list.cbegin(); p != fa_list.cend(); ++p) { exts << QString("*.%1").arg(p->extension.toUpper()); } - MythUIFileBrowser *fb = new MythUIFileBrowser(popupStack, fp); + auto *fb = new MythUIFileBrowser(popupStack, fp); fb->SetNameFilter(exts); if (fb->Create()) { @@ -326,12 +325,11 @@ void EditMetadataDialog::fillWidgets() // No memory leak. MythUIButtonListItem adds the new item into // m_categoryList. - MythUIButtonListItem *button = + auto *button = new MythUIButtonListItem(m_categoryList, VIDEO_CATEGORY_UNKNOWN); const VideoCategory::entry_list &vcl = VideoCategory::GetCategory().getList(); - for (VideoCategory::entry_list::const_iterator p = vcl.begin(); - p != vcl.end(); ++p) + for (auto p = vcl.cbegin(); p != vcl.cend(); ++p) { // No memory leak. MythUIButtonListItem adds the new item into // m_categoryList. @@ -363,12 +361,11 @@ void EditMetadataDialog::fillWidgets() // TODO: maybe make the title list have the same sort order // as elsewhere. - typedef std::vector<std::pair<unsigned int, QString> > title_list; + using title_list = std::vector<std::pair<unsigned int, QString> >; const VideoMetadataListManager::metadata_list &mdl = m_metaCache.getList(); title_list tc; tc.reserve(mdl.size()); - for (VideoMetadataListManager::metadata_list::const_iterator p = mdl.begin(); - p != mdl.end(); ++p) + for (auto p = mdl.cbegin(); p != mdl.cend(); ++p) { QString title; if ((*p)->GetSeason() > 0 || (*p)->GetEpisode() > 0) @@ -497,8 +494,7 @@ void EditMetadataDialog::NewCategoryPopup() MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythTextInputDialog *categorydialog = - new MythTextInputDialog(popupStack,message); + auto *categorydialog = new MythTextInputDialog(popupStack,message); if (categorydialog->Create()) { @@ -651,7 +647,7 @@ void EditMetadataDialog::OnArtworkSearchDone(MetadataLookup *lookup) m_busyPopup = nullptr; } - VideoArtworkType type = lookup->GetData().value<VideoArtworkType>(); + auto type = lookup->GetData().value<VideoArtworkType>(); ArtworkList list = lookup->GetArtwork(type); if (list.isEmpty()) @@ -660,8 +656,7 @@ void EditMetadataDialog::OnArtworkSearchDone(MetadataLookup *lookup) GetNotificationCenter()->Queue(n); return; } - ImageSearchResultsDialog *resultsdialog = - new ImageSearchResultsDialog(m_popupStack, list, type); + auto *resultsdialog = new ImageSearchResultsDialog(m_popupStack, list, type); connect(resultsdialog, SIGNAL(haveResult(ArtworkInfo, VideoArtworkType)), SLOT(OnSearchListSelection(ArtworkInfo, VideoArtworkType))); @@ -675,7 +670,7 @@ void EditMetadataDialog::OnSearchListSelection(const ArtworkInfo& info, VideoArt QString msg = tr("Downloading selected artwork..."); createBusyDialog(msg); - MetadataLookup *lookup = new MetadataLookup(); + auto *lookup = new MetadataLookup(); lookup->SetType(kMetadataVideo); lookup->SetSubtype(GuessLookupType(m_workingMetadata)); @@ -707,7 +702,7 @@ void EditMetadataDialog::handleDownloadedImages(MetadataLookup *lookup) m_busyPopup = nullptr; } - VideoArtworkType type = lookup->GetData().value<VideoArtworkType>(); + auto type = lookup->GetData().value<VideoArtworkType>(); ArtworkMap map = lookup->GetDownloads(); if (map.count() >= 1) @@ -731,7 +726,7 @@ void EditMetadataDialog::FindNetArt(VideoArtworkType type) QString msg = tr("Searching for available artwork..."); createBusyDialog(msg); - MetadataLookup *lookup = new MetadataLookup(); + auto *lookup = new MetadataLookup(); lookup->SetStep(kLookupSearch); lookup->SetType(kMetadataVideo); lookup->SetAutomatic(true); @@ -977,7 +972,7 @@ void EditMetadataDialog::customEvent(QEvent *levent) { if (levent->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent*)(levent); + auto *dce = (DialogCompletionEvent*)(levent); const QString resultid = dce->GetId(); @@ -996,7 +991,7 @@ void EditMetadataDialog::customEvent(QEvent *levent) } else if (levent->type() == MetadataLookupEvent::kEventType) { - MetadataLookupEvent *lue = (MetadataLookupEvent *)levent; + auto *lue = (MetadataLookupEvent *)levent; MetadataLookupList lul = lue->m_lookupList; @@ -1020,7 +1015,7 @@ void EditMetadataDialog::customEvent(QEvent *levent) } else if (levent->type() == MetadataLookupFailure::kEventType) { - MetadataLookupFailure *luf = (MetadataLookupFailure *)levent; + auto *luf = (MetadataLookupFailure *)levent; MetadataLookupList lul = luf->m_lookupList; @@ -1040,7 +1035,7 @@ void EditMetadataDialog::customEvent(QEvent *levent) } else if (levent->type() == ImageDLEvent::kEventType) { - ImageDLEvent *ide = (ImageDLEvent *)levent; + auto *ide = (ImageDLEvent *)levent; MetadataLookup *lookup = ide->m_item; diff --git a/mythtv/programs/mythfrontend/exitprompt.cpp b/mythtv/programs/mythfrontend/exitprompt.cpp index f25450bef59..1f85c914164 100644 --- a/mythtv/programs/mythfrontend/exitprompt.cpp +++ b/mythtv/programs/mythfrontend/exitprompt.cpp @@ -230,8 +230,8 @@ void ExitPrompter::handleExit() } MythScreenStack *ss = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *dlg = new MythDialogBox( - tr("Do you really want to exit MythTV?"), ss, "exit prompt"); + auto *dlg = new MythDialogBox(tr("Do you really want to exit MythTV?"), ss, + "exit prompt"); if (!dlg->Create()) { @@ -266,7 +266,7 @@ void ExitPrompter::handleExit() void ExitPrompter::confirm(int Action) { MythScreenStack *ss = GetMythMainWindow()->GetStack("popup stack"); - MythConfirmationDialog *dlg = new MythConfirmationDialog(ss, + auto *dlg = new MythConfirmationDialog(ss, tr("Mythbackend is running on this system. Are you sure you want to continue?")); if (!dlg->Create()) diff --git a/mythtv/programs/mythfrontend/galleryconfig.cpp b/mythtv/programs/mythfrontend/galleryconfig.cpp index bf297997f9a..d0736a1015f 100644 --- a/mythtv/programs/mythfrontend/galleryconfig.cpp +++ b/mythtv/programs/mythfrontend/galleryconfig.cpp @@ -10,7 +10,7 @@ StandardSetting *GallerySettings::ImageOrder() { - HostComboBoxSetting *gc = new HostComboBoxSetting("GalleryImageOrder"); + auto *gc = new HostComboBoxSetting("GalleryImageOrder"); gc->setLabel(TR("Image Order")); gc->setHelpText(TR("The order that pictures/videos are shown in thumbnail " @@ -45,7 +45,7 @@ StandardSetting *GallerySettings::ImageOrder() StandardSetting *GallerySettings::DirOrder() { - HostComboBoxSetting *gc = new HostComboBoxSetting("GalleryDirOrder"); + auto *gc = new HostComboBoxSetting("GalleryDirOrder"); gc->setLabel(TR("Directory Order")); gc->setHelpText(TR("The order that dirctories are shown and traversed " @@ -67,7 +67,7 @@ static void AddFormat(HostComboBoxSetting* gc, const QDateTime& date, const QStr StandardSetting *GallerySettings::DateFormat() { - HostComboBoxSetting *gc = new HostComboBoxSetting("GalleryDateFormat"); + auto *gc = new HostComboBoxSetting("GalleryDateFormat"); gc->setLabel(TR("Date Format")); gc->setHelpText(TR("Date format of thumbnail captions. Other places use the system date format. " @@ -101,7 +101,7 @@ StandardSetting *GallerySettings::DateFormat() static StandardSetting *TransitionType() { - HostComboBoxSetting *gc = new HostComboBoxSetting("GalleryTransitionType"); + auto *gc = new HostComboBoxSetting("GalleryTransitionType"); gc->setLabel(TR("Transition")); gc->setHelpText(TR("Effect to use between slides")); @@ -121,7 +121,7 @@ static StandardSetting *TransitionType() static StandardSetting *SlideDuration() { - HostSpinBoxSetting *gc = new HostSpinBoxSetting("GallerySlideShowTime", 100, 60000, 100, 5); + auto *gc = new HostSpinBoxSetting("GallerySlideShowTime", 100, 60000, 100, 5); gc->setLabel(TR("Slide Duration (ms)")); gc->setHelpText(TR("The time that a slide is displayed (between transitions), " @@ -131,7 +131,7 @@ static StandardSetting *SlideDuration() static StandardSetting *TransitionDuration() { - HostSpinBoxSetting *gc = new HostSpinBoxSetting("GalleryTransitionTime", 100, 60000, 100, 5); + auto *gc = new HostSpinBoxSetting("GalleryTransitionTime", 100, 60000, 100, 5); gc->setLabel(TR("Transition Duration (ms)")); gc->setHelpText(TR("The time that each transition lasts, in milliseconds.")); @@ -140,7 +140,7 @@ static StandardSetting *TransitionDuration() static StandardSetting *StatusDelay() { - HostSpinBoxSetting *gc = new HostSpinBoxSetting("GalleryStatusDelay", 0, 10000, 50, 10); + auto *gc = new HostSpinBoxSetting("GalleryStatusDelay", 0, 10000, 50, 10); gc->setLabel(TR("Status Delay (ms)")); gc->setHelpText(TR("The delay before showing the Loading/Playing status, " @@ -150,7 +150,7 @@ static StandardSetting *StatusDelay() static StandardSetting *UseTransitions() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("GalleryBrowseTransition"); + auto *gc = new HostCheckBoxSetting("GalleryBrowseTransition"); gc->setLabel(TR("Use transitions when browsing")); gc->setHelpText(TR("When cleared, transitions will only be used " @@ -164,7 +164,7 @@ static StandardSetting *UseTransitions() */ static StandardSetting *Import(bool enabled) { - HostTextEditSetting *gc = new HostTextEditSetting("GalleryImportCmd"); + auto *gc = new HostTextEditSetting("GalleryImportCmd"); gc->setVisible(enabled); gc->setLabel(TR("Import Command")); @@ -181,7 +181,7 @@ static StandardSetting *Import(bool enabled) */ StandardSetting *GallerySettings::Exclusions(bool enabled) { - GlobalTextEditSetting *gc = new GlobalTextEditSetting("GalleryIgnoreFilter"); + auto *gc = new GlobalTextEditSetting("GalleryIgnoreFilter"); gc->setVisible(enabled); gc->setLabel(TR("Scanner Exclusions")); @@ -201,7 +201,7 @@ StandardSetting *GallerySettings::Exclusions(bool enabled) */ static StandardSetting *Autorun(bool enabled) { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("GalleryAutoStart"); + auto *gc = new HostCheckBoxSetting("GalleryAutoStart"); gc->setVisible(enabled); gc->setLabel(TR("Start Gallery when media inserted")); @@ -216,7 +216,7 @@ static StandardSetting *Autorun(bool enabled) */ static StandardSetting *Password(bool enabled) { - GlobalTextEditSetting *gc = new GlobalTextEditSetting("GalleryPassword"); + auto *gc = new GlobalTextEditSetting("GalleryPassword"); gc->setVisible(enabled); gc->setLabel(TR("Password")); @@ -235,7 +235,7 @@ static StandardSetting *Password(bool enabled) */ StandardSetting *GallerySettings::ClearDb(bool enabled) { - ButtonStandardSetting *gc = new ButtonStandardSetting(TR("Reset Image Database")); + auto *gc = new ButtonStandardSetting(TR("Reset Image Database")); gc->setVisible(enabled); gc->setLabel(TR("Reset Image Database")); diff --git a/mythtv/programs/mythfrontend/galleryinfo.cpp b/mythtv/programs/mythfrontend/galleryinfo.cpp index b22c50df54f..be6d478feda 100644 --- a/mythtv/programs/mythfrontend/galleryinfo.cpp +++ b/mythtv/programs/mythfrontend/galleryinfo.cpp @@ -136,7 +136,7 @@ void InfoList::CreateButton(const QString& name, const QString& value) if (value.isEmpty()) return; - MythUIButtonListItem *item = new MythUIButtonListItem(m_btnList, ""); + auto *item = new MythUIButtonListItem(m_btnList, ""); InfoMap infoMap; infoMap.insert("name", name); @@ -269,7 +269,7 @@ void InfoList::Display(ImageItemK &im, const QStringList &tagStrings) foreach (const QString &group, tags.uniqueKeys()) { // Iterate earliest->latest to preserve tag order - typedef QList<QStringList> TagList; + using TagList = QList<QStringList>; TagList tagList = tags.values(group); TagList::const_iterator i = tagList.constEnd(); diff --git a/mythtv/programs/mythfrontend/galleryslide.cpp b/mythtv/programs/mythfrontend/galleryslide.cpp index f9fe783e02a..f5090a7d630 100644 --- a/mythtv/programs/mythfrontend/galleryslide.cpp +++ b/mythtv/programs/mythfrontend/galleryslide.cpp @@ -597,7 +597,7 @@ void SlideBuffer::Initialise(MythUIImage &image) // Fill buffer with slides cloned from the XML image widget // Create first as a child of the XML image. - Slide *slide = new Slide(nullptr, "slide0", &image); + auto *slide = new Slide(nullptr, "slide0", &image); // Buffer is notified when it has loaded image connect(slide, SIGNAL(ImageLoaded(Slide *)), diff --git a/mythtv/programs/mythfrontend/galleryslideview.cpp b/mythtv/programs/mythfrontend/galleryslideview.cpp index b98424f8b4d..2bd648403c7 100644 --- a/mythtv/programs/mythfrontend/galleryslideview.cpp +++ b/mythtv/programs/mythfrontend/galleryslideview.cpp @@ -212,8 +212,8 @@ void GallerySlideView::customEvent(QEvent *event) { if (event->type() == MythEvent::MythEventMessage) { - MythEvent *me = static_cast<MythEvent *>(event); - const QString& message = me->Message(); + auto *me = static_cast<MythEvent *>(event); + const QString& message = me->Message(); QStringList extra = me->ExtraDataList(); @@ -233,7 +233,7 @@ void GallerySlideView::customEvent(QEvent *event) } else if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent *)(event); + auto *dce = (DialogCompletionEvent *)(event); QString resultid = dce->GetId(); int buttonnum = dce->GetResult(); @@ -261,7 +261,7 @@ void GallerySlideView::customEvent(QEvent *event) void GallerySlideView::MenuMain() { // Create the main menu that will contain the submenus above - MythMenu *menu = new MythMenu(tr("Slideshow Options"), this, "mainmenu"); + auto *menu = new MythMenu(tr("Slideshow Options"), this, "mainmenu"); ImagePtrK im = m_slides.GetCurrent().GetImageData(); if (im && im->m_type == kVideoFile) @@ -301,7 +301,7 @@ void GallerySlideView::MenuMain() menu->AddItem(tr("Hide Details"), SLOT(HideInfo())); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(menu, popupStack, "menuPopup"); + auto *menuPopup = new MythDialogBox(menu, popupStack, "menuPopup"); if (menuPopup->Create()) popupStack->AddScreen(menuPopup); else @@ -318,7 +318,7 @@ void GallerySlideView::MenuTransforms(MythMenu &mainMenu) ImagePtrK im = m_slides.GetCurrent().GetImageData(); if (im && !m_playing) { - MythMenu *menu = new MythMenu(tr("Transform Options"), + auto *menu = new MythMenu(tr("Transform Options"), this, "metadatamenu"); if (m_editsAllowed) { diff --git a/mythtv/programs/mythfrontend/gallerythumbview.cpp b/mythtv/programs/mythfrontend/gallerythumbview.cpp index 51fe45551ee..36b6bb3bf7d 100644 --- a/mythtv/programs/mythfrontend/gallerythumbview.cpp +++ b/mythtv/programs/mythfrontend/gallerythumbview.cpp @@ -55,8 +55,8 @@ class TransferThread : public MThread { Q_DECLARE_TR_FUNCTIONS(FileTransferWorker); public: - typedef QMap<ImagePtrK, QString> TransferMap; - typedef QSet<ImagePtrK> ImageSet; + using TransferMap = QMap<ImagePtrK, QString>; + using ImageSet = QSet<ImagePtrK>; TransferThread(TransferMap files, bool move, MythUIProgressDialog *dialog) : MThread("FileTransfer"), @@ -85,8 +85,7 @@ class TransferThread : public MThread .arg(action, QFileInfo(im->m_url).fileName(), ImageAdapterBase::FormatSize(im->m_size / 1024)); - ProgressUpdateEvent *pue = - new ProgressUpdateEvent(progressSize, total, message); + auto *pue = new ProgressUpdateEvent(progressSize, total, message); QApplication::postEvent(m_dialog, pue); } @@ -113,7 +112,7 @@ class TransferThread : public MThread // Update progress dialog if (m_dialog) { - ProgressUpdateEvent *pue = + auto *pue = new ProgressUpdateEvent(progressSize, total, tr("Complete")); QApplication::postEvent(m_dialog, pue); } @@ -352,8 +351,8 @@ void GalleryThumbView::customEvent(QEvent *event) if (event->type() == MythEvent::MythEventMessage) { - MythEvent *me = static_cast<MythEvent *>(event); - const QString& mesg = me->Message(); + auto *me = static_cast<MythEvent *>(event); + const QString& mesg = me->Message(); QStringList extra = me->ExtraDataList(); // Internal messages contain a hostname. Ignore other FE messages @@ -451,7 +450,7 @@ void GalleryThumbView::customEvent(QEvent *event) } else if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent *)(event); + auto *dce = (DialogCompletionEvent *)(event); QString resultid = dce->GetId(); int buttonnum = dce->GetResult(); @@ -655,8 +654,8 @@ void GalleryThumbView::BuildImageList() // Data must be set by constructor: First item is automatically // selected and must have data available for selection event, as // subsequent reselection of same item will always fail. - MythUIButtonListItem *item = - new MythUIButtonListItem(m_imageList, "", qVariantFromValue(im)); + auto *item = new MythUIButtonListItem(m_imageList, "", + qVariantFromValue(im)); item->setCheckable(true); item->setChecked(MythUIButtonListItem::NotChecked); @@ -1003,7 +1002,7 @@ void GalleryThumbView::SetUiSelection(MythUIButtonListItem *item) void GalleryThumbView::MenuMain() { // Create the main menu - MythMenu *menu = new MythMenu(tr("Gallery Options"), this, "mainmenu"); + auto *menu = new MythMenu(tr("Gallery Options"), this, "mainmenu"); // Menu options depend on the marked files and the current node m_menuState = m_view->GetMenuSubjects(); @@ -1031,7 +1030,7 @@ void GalleryThumbView::MenuMain() menu->AddItem(tr("Settings"), SLOT(ShowSettings())); - MythDialogBox *popup = new MythDialogBox(menu, &m_popupStack, "menuPopup"); + auto *popup = new MythDialogBox(menu, &m_popupStack, "menuPopup"); if (popup->Create()) m_popupStack.AddScreen(popup); else @@ -1051,7 +1050,7 @@ void GalleryThumbView::MenuMarked(MythMenu *mainMenu) return; QString title = tr("%L1 marked").arg(m_menuState.m_markedId.size()); - MythMenu *menu = new MythMenu(title, this, "markmenu"); + auto *menu = new MythMenu(title, this, "markmenu"); // Mark/unmark selected if (m_menuState.m_selected->IsFile()) @@ -1111,7 +1110,7 @@ void GalleryThumbView::MenuPaste(MythMenu *mainMenu) QString title = tr("%L1 marked").arg(files.size()); - MythMenu *menu = new MythMenu(title, this, "pastemenu"); + auto *menu = new MythMenu(title, this, "pastemenu"); menu->AddItem(tr("Move Marked Into"), SLOT(Move())); menu->AddItem(tr("Copy Marked Into"), SLOT(Copy())); @@ -1132,7 +1131,7 @@ void GalleryThumbView::MenuTransform(MythMenu *mainMenu) { QString title = tr("%L1 marked").arg(m_menuState.m_markedId.size()); - MythMenu *menu = new MythMenu(title, this, ""); + auto *menu = new MythMenu(title, this, ""); menu->AddItem(tr("Rotate Marked CW"), SLOT(RotateCWMarked())); menu->AddItem(tr("Rotate Marked CCW"), SLOT(RotateCCWMarked())); @@ -1144,7 +1143,7 @@ void GalleryThumbView::MenuTransform(MythMenu *mainMenu) } else if (m_menuState.m_selected->IsFile()) { - MythMenu *menu = new MythMenu(m_menuState.m_selected->m_baseName, this, ""); + auto *menu = new MythMenu(m_menuState.m_selected->m_baseName, this, ""); menu->AddItem(tr("Rotate CW"), SLOT(RotateCW())); menu->AddItem(tr("Rotate CCW"), SLOT(RotateCCW())); @@ -1241,8 +1240,8 @@ void GalleryThumbView::MenuSlideshow(MythMenu *mainMenu) case kOrdered : ordering = tr("Ordered"); break; } - MythMenu *menu = new MythMenu(tr("Slideshow") + " (" + ordering + ")", - this, "SlideshowMenu"); + auto *menu = new MythMenu(tr("Slideshow") + " (" + ordering + ")", + this, "SlideshowMenu"); // Use selected dir or parent, if image selected if (m_menuState.m_selected->IsDirectory()) @@ -1256,8 +1255,7 @@ void GalleryThumbView::MenuSlideshow(MythMenu *mainMenu) else menu->AddItem(tr("Current Directory"), SLOT(Slideshow())); - MythMenu *orderMenu = new MythMenu(tr("Slideshow Order"), this, - "SlideOrderMenu"); + auto *orderMenu = new MythMenu(tr("Slideshow Order"), this, "SlideOrderMenu"); orderMenu->AddItem(tr("Ordered"), nullptr, nullptr, order == kOrdered); orderMenu->AddItem(tr("Shuffled"), nullptr, nullptr, order == kShuffle); @@ -1281,7 +1279,7 @@ void GalleryThumbView::MenuSlideshow(MythMenu *mainMenu) */ void GalleryThumbView::MenuShow(MythMenu *mainMenu) { - MythMenu *menu = new MythMenu(tr("Show Options"), this, "showmenu"); + auto *menu = new MythMenu(tr("Show Options"), this, "showmenu"); int type = m_mgr.GetType(); if (type == kPicAndVideo) @@ -1294,8 +1292,8 @@ void GalleryThumbView::MenuShow(MythMenu *mainMenu) SLOT(ShowType())); int show = gCoreContext->GetNumSetting("GalleryImageCaption"); - MythMenu *captionMenu = new MythMenu(tr("Image Captions"), this, - "ImageCaptionMenu"); + auto *captionMenu = new MythMenu(tr("Image Captions"), this, + "ImageCaptionMenu"); captionMenu->AddItem(tr("Name"), nullptr, nullptr, show == kNameCaption); captionMenu->AddItem(tr("Date"), nullptr, nullptr, show == kDateCaption); @@ -1401,8 +1399,8 @@ void GalleryThumbView::StartSlideshow(ImageSlideShowType mode) return; MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - GallerySlideView *slide = new GallerySlideView(mainStack, "galleryslideview", - m_editsAllowed); + auto *slide = new GallerySlideView(mainStack, "galleryslideview", + m_editsAllowed); if (slide->Create()) { mainStack->AddScreen(slide); @@ -1607,11 +1605,9 @@ void GalleryThumbView::DeleteMarked() void GalleryThumbView::ShowSettings() { // Show settings dialog - GallerySettings *config = new GallerySettings(m_editsAllowed); + auto *config = new GallerySettings(m_editsAllowed); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, - "gallerysettings", - config); + auto *ssd = new StandardSettingDialog(mainStack, "gallerysettings", config); if (!ssd->Create()) { delete ssd; @@ -1680,8 +1676,7 @@ void GalleryThumbView::ShowHidden(bool show) */ void GalleryThumbView::ShowDialog(const QString& msg, const QString& event) { - MythConfirmationDialog *popup = - new MythConfirmationDialog(&m_popupStack, msg, true); + auto *popup = new MythConfirmationDialog(&m_popupStack, msg, true); if (popup->Create()) { @@ -1702,8 +1697,8 @@ void GalleryThumbView::ShowRenameInput() { QString base = QFileInfo(m_menuState.m_selected->m_baseName).completeBaseName(); QString msg = tr("Enter a new name:"); - MythTextInputDialog *popup = - new MythTextInputDialog(&m_popupStack, msg, FilterNone, false, base); + auto *popup = new MythTextInputDialog(&m_popupStack, msg, FilterNone, + false, base); if (popup->Create()) { popup->SetReturnEvent(this, "FileRename"); @@ -1730,8 +1725,7 @@ void GalleryThumbView::ShowDetails() void GalleryThumbView::ShowPassword() { QString msg = tr("Enter password:"); - MythTextInputDialog *popup = - new MythTextInputDialog(&m_popupStack, msg, FilterNone, true); + auto *popup = new MythTextInputDialog(&m_popupStack, msg, FilterNone, true); if (popup->Create()) { popup->SetReturnEvent(this, "Password"); @@ -1842,9 +1836,9 @@ void GalleryThumbView::SelectZoomWidget(int change) */ void GalleryThumbView::MakeDir() { - MythTextInputDialog *popup = - new MythTextInputDialog(&m_popupStack, tr("Enter name of new directory"), - FilterNone, false); + auto *popup = new MythTextInputDialog(&m_popupStack, + tr("Enter name of new directory"), + FilterNone, false); if (popup->Create()) { popup->SetReturnEvent(this, "MakeDir"); @@ -1926,8 +1920,8 @@ void GalleryThumbView::Copy(bool deleteAfter) // Create progress dialog MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIProgressDialog *progress = - new MythUIProgressDialog(tr("Copying files"), popupStack, "copydialog"); + auto *progress = new MythUIProgressDialog(tr("Copying files"), popupStack, + "copydialog"); if (progress->Create()) popupStack->AddScreen(progress, false); else @@ -2060,8 +2054,8 @@ void GalleryThumbView::Move() // Create progress dialog MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIProgressDialog *progress = - new MythUIProgressDialog(tr("Moving files"), popupStack, "movedialog"); + auto *progress = new MythUIProgressDialog(tr("Moving files"), popupStack, + "movedialog"); if (progress->Create()) popupStack->AddScreen(progress, false); diff --git a/mythtv/programs/mythfrontend/gallerythumbview.h b/mythtv/programs/mythfrontend/gallerythumbview.h index 41828f7093f..5085af7d2e5 100644 --- a/mythtv/programs/mythfrontend/gallerythumbview.h +++ b/mythtv/programs/mythfrontend/gallerythumbview.h @@ -114,7 +114,7 @@ private slots: void RepeatOff() { RepeatOn(0); } private: - typedef QPair<int,int> IntPair; + using IntPair = QPair<int,int>; // Theme widgets MythUIButtonList *m_imageList {nullptr}; @@ -144,7 +144,7 @@ private slots: //! Current selection/marked files when menu is invoked MenuSubjects m_menuState; - typedef QPair<MythUIButtonListItem *, int> ThumbLocation; + using ThumbLocation = QPair<MythUIButtonListItem *, int>; //! Buttons waiting for thumbnails to be created QHash<int, ThumbLocation> m_pendingMap; diff --git a/mythtv/programs/mythfrontend/gallerytransitions.cpp b/mythtv/programs/mythfrontend/gallerytransitions.cpp index 151cf0633dc..b00660a9803 100644 --- a/mythtv/programs/mythfrontend/gallerytransitions.cpp +++ b/mythtv/programs/mythfrontend/gallerytransitions.cpp @@ -211,12 +211,12 @@ void GroupTransition::Pulse(int interval) void TransitionBlend::Initialise() { // Fade out prev image - Animation *oldPic = new Animation(m_prev, Animation::Alpha); + auto *oldPic = new Animation(m_prev, Animation::Alpha); oldPic->Set(255, 0, m_duration, QEasingCurve::InOutQuad); m_animation->Add(oldPic); // Fade in next image - Animation *newPic = new Animation(m_next, Animation::Alpha); + auto *newPic = new Animation(m_next, Animation::Alpha); newPic->Set(0, 255, m_duration, QEasingCurve::InOutQuad); m_animation->Add(newPic); @@ -241,12 +241,12 @@ void TransitionBlend::Finalise() void TransitionTwist::Initialise() { // Reduce hzoom of left image to nothing - Animation *oldPic = new Animation(m_prev, Animation::HorizontalZoom); + auto *oldPic = new Animation(m_prev, Animation::HorizontalZoom); oldPic->Set(1.0, 0.0, m_duration / 2, QEasingCurve::InQuart); m_animation->Add(oldPic); // Increase hzoom of right image from nothing to full - Animation *newPic = new Animation(m_next, Animation::HorizontalZoom); + auto *newPic = new Animation(m_next, Animation::HorizontalZoom); newPic->Set(0.0, 1.0, m_duration / 2, QEasingCurve::OutQuart); m_animation->Add(newPic); @@ -274,12 +274,12 @@ void TransitionSlide::Initialise() int width = m_old->GetArea().width(); // Slide off to left - Animation *oldPic = new Animation(m_prev, Animation::Position); + auto *oldPic = new Animation(m_prev, Animation::Position); oldPic->Set(QPoint(0, 0), QPoint(-width, 0), m_duration, QEasingCurve::InOutQuart); m_animation->Add(oldPic); // Slide in from right - Animation *newPic = new Animation(m_next, Animation::Position); + auto *newPic = new Animation(m_next, Animation::Position); newPic->Set(QPoint(width, 0), QPoint(0, 0), m_duration, QEasingCurve::InOutQuart); m_animation->Add(newPic); @@ -307,21 +307,21 @@ void TransitionZoom::Initialise() int width = m_old->GetArea().width(); // Zoom away to left - Animation *oldZoom = new Animation(m_prev, Animation::Zoom); + auto *oldZoom = new Animation(m_prev, Animation::Zoom); oldZoom->Set(1.0, 0.0, m_duration, QEasingCurve::OutQuad); m_animation->Add(oldZoom); - Animation *oldMove = new Animation(m_prev, Animation::Position); + auto *oldMove = new Animation(m_prev, Animation::Position); oldMove->Set(QPoint(0, 0), QPoint(-width / 2, 0), m_duration, QEasingCurve::InQuad); m_animation->Add(oldMove); // Zoom in from right - Animation *newZoom = new Animation(m_next, Animation::Zoom); + auto *newZoom = new Animation(m_next, Animation::Zoom); newZoom->Set(0.0, 1.0, m_duration, QEasingCurve::InQuad); m_animation->Add(newZoom); - Animation *newMove = new Animation(m_next, Animation::Position); + auto *newMove = new Animation(m_next, Animation::Position); newMove->Set(QPoint(width / 2, 0), QPoint(0, 0), m_duration, QEasingCurve::OutQuad); m_animation->Add(newMove); @@ -352,7 +352,7 @@ void TransitionSpin::Initialise() TransitionBlend::Initialise(); // Add simultaneous spin - Animation *an = new Animation(m_prev, Animation::Angle); + auto *an = new Animation(m_prev, Animation::Angle); an->Set(0.0, 360.1, m_duration, QEasingCurve::InOutQuad); m_animation->Add(an); @@ -361,7 +361,7 @@ void TransitionSpin::Initialise() m_animation->Add(an); // Zoom prev away, then back - SequentialAnimation *seq = new SequentialAnimation(); + auto *seq = new SequentialAnimation(); m_animation->Add(seq); an = new Animation(m_prev, Animation::Zoom); diff --git a/mythtv/programs/mythfrontend/gallerytransitions.h b/mythtv/programs/mythfrontend/gallerytransitions.h index 5651d695464..2b42b294ab9 100644 --- a/mythtv/programs/mythfrontend/gallerytransitions.h +++ b/mythtv/programs/mythfrontend/gallerytransitions.h @@ -63,7 +63,7 @@ protected slots: }; -typedef QMap<int, Transition*> TransitionMap; +using TransitionMap = QMap<int, Transition*>; //! Switches images instantly with no effects diff --git a/mythtv/programs/mythfrontend/galleryviews.h b/mythtv/programs/mythfrontend/galleryviews.h index 7a4f0495302..61a8c727011 100644 --- a/mythtv/programs/mythfrontend/galleryviews.h +++ b/mythtv/programs/mythfrontend/galleryviews.h @@ -24,7 +24,7 @@ enum SlideOrderType { //! Seasonal weightings for images in a view -typedef QVector<double> WeightList; +using WeightList = QVector<double>; //! A container of images/dirs that have been marked diff --git a/mythtv/programs/mythfrontend/globalsettings.cpp b/mythtv/programs/mythfrontend/globalsettings.cpp index 1f1cc153473..314595b3771 100644 --- a/mythtv/programs/mythfrontend/globalsettings.cpp +++ b/mythtv/programs/mythfrontend/globalsettings.cpp @@ -55,7 +55,7 @@ static HostSpinBoxSetting *AudioReadAhead() // was previously *DecodeExtraAudio() { - HostSpinBoxSetting *gc = new HostSpinBoxSetting("AudioReadAhead",0,5000,10,10); + auto *gc = new HostSpinBoxSetting("AudioReadAhead",0,5000,10,10); gc->setLabel(PlaybackSettings::tr("Audio read ahead (ms)")); @@ -71,7 +71,7 @@ static HostSpinBoxSetting *AudioReadAhead() static HostCheckBoxSetting *ChromaUpsampling() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("ChromaUpsamplingFilter"); + auto *gc = new HostCheckBoxSetting("ChromaUpsamplingFilter"); gc->setLabel(PlaybackSettings::tr("Enable Chroma Upsampling Filter when deinterlacing")); gc->setHelpText(PlaybackSettings::tr( "The 'Chroma upsampling error' affects the quality of interlaced material " @@ -86,7 +86,7 @@ static HostCheckBoxSetting *ChromaUpsampling() #ifdef USING_VAAPI static HostTextEditSetting *VAAPIDevice() { - HostTextEditSetting *ge = new HostTextEditSetting("VAAPIDevice"); + auto *ge = new HostTextEditSetting("VAAPIDevice"); ge->setLabel(MainGeneralSettings::tr("Decoder Device for VAAPI hardware decoding")); @@ -113,7 +113,7 @@ static HostTextEditSetting *VAAPIDevice() static HostCheckBoxSetting *PlaybackAVSync2() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("PlaybackAVSync2"); + auto *gc = new HostCheckBoxSetting("PlaybackAVSync2"); gc->setLabel(PlaybackSettings::tr("Enable new timestamp based playback speed (AVSync2)")); @@ -128,7 +128,7 @@ static HostCheckBoxSetting *PlaybackAVSync2() static HostSpinBoxSetting *AVSync2AdjustMS() // was previously *DecodeExtraAudio() { - HostSpinBoxSetting *gc = new HostSpinBoxSetting("AVSync2AdjustMS",1,40,1,1); + auto *gc = new HostSpinBoxSetting("AVSync2AdjustMS",1,40,1,1); gc->setLabel(PlaybackSettings::tr("AVSync2 audio correction (ms)")); @@ -159,7 +159,7 @@ static HostCheckBoxSetting *FFmpegDemuxer() static HostComboBoxSetting *PIPLocationComboBox() { - HostComboBoxSetting *gc = new HostComboBoxSetting("PIPLocation"); + auto *gc = new HostComboBoxSetting("PIPLocation"); gc->setLabel(PlaybackSettings::tr("PIP video location")); @@ -173,7 +173,7 @@ static HostComboBoxSetting *PIPLocationComboBox() static HostComboBoxSetting *DisplayRecGroup() { - HostComboBoxSetting *gc = new HostComboBoxSetting("DisplayRecGroup"); + auto *gc = new HostComboBoxSetting("DisplayRecGroup"); gc->setLabel(PlaybackSettings::tr("Default group filter to apply")); @@ -215,7 +215,7 @@ static HostComboBoxSetting *DisplayRecGroup() static HostCheckBoxSetting *QueryInitialFilter() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("QueryInitialFilter"); + auto *gc = new HostCheckBoxSetting("QueryInitialFilter"); gc->setLabel(PlaybackSettings::tr("Always prompt for initial group " "filter")); @@ -231,7 +231,7 @@ static HostCheckBoxSetting *QueryInitialFilter() static HostCheckBoxSetting *RememberRecGroup() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("RememberRecGroup"); + auto *gc = new HostCheckBoxSetting("RememberRecGroup"); gc->setLabel(PlaybackSettings::tr("Save current group filter when " "changed")); @@ -248,7 +248,7 @@ static HostCheckBoxSetting *RememberRecGroup() static HostCheckBoxSetting *RecGroupMod() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("RecGroupsFocusable"); + auto *gc = new HostCheckBoxSetting("RecGroupsFocusable"); gc->setLabel(PlaybackSettings::tr("Change Recording Group using the arrow " "keys")); @@ -266,7 +266,7 @@ static HostCheckBoxSetting *RecGroupMod() static HostCheckBoxSetting *PBBStartInTitle() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("PlaybackBoxStartInTitle"); + auto *gc = new HostCheckBoxSetting("PlaybackBoxStartInTitle"); gc->setLabel(PlaybackSettings::tr("Start in group list")); @@ -280,7 +280,7 @@ static HostCheckBoxSetting *PBBStartInTitle() static HostCheckBoxSetting *SmartForward() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("SmartForward"); + auto *gc = new HostCheckBoxSetting("SmartForward"); gc->setLabel(PlaybackSettings::tr("Smart fast forwarding")); @@ -294,7 +294,7 @@ static HostCheckBoxSetting *SmartForward() static GlobalComboBoxSetting *CommercialSkipMethod() { - GlobalComboBoxSetting *bc = new GlobalComboBoxSetting("CommercialSkipMethod"); + auto *bc = new GlobalComboBoxSetting("CommercialSkipMethod"); bc->setLabel(GeneralSettings::tr("Commercial detection method")); @@ -312,7 +312,7 @@ static GlobalComboBoxSetting *CommercialSkipMethod() static GlobalCheckBoxSetting *CommFlagFast() { - GlobalCheckBoxSetting *gc = new GlobalCheckBoxSetting("CommFlagFast"); + auto *gc = new GlobalCheckBoxSetting("CommFlagFast"); gc->setLabel(GeneralSettings::tr("Enable experimental speedup of " "commercial detection")); @@ -326,7 +326,7 @@ static GlobalCheckBoxSetting *CommFlagFast() static HostComboBoxSetting *AutoCommercialSkip() { - HostComboBoxSetting *gc = new HostComboBoxSetting("AutoCommercialSkip"); + auto *gc = new HostComboBoxSetting("AutoCommercialSkip"); gc->setLabel(PlaybackSettings::tr("Automatically skip commercials")); @@ -347,7 +347,7 @@ static HostComboBoxSetting *AutoCommercialSkip() static GlobalSpinBoxSetting *DeferAutoTranscodeDays() { - GlobalSpinBoxSetting *gs = new GlobalSpinBoxSetting("DeferAutoTranscodeDays", 0, 365, 1); + auto *gs = new GlobalSpinBoxSetting("DeferAutoTranscodeDays", 0, 365, 1); gs->setLabel(GeneralSettings::tr("Deferral days for auto transcode jobs")); @@ -363,7 +363,7 @@ static GlobalSpinBoxSetting *DeferAutoTranscodeDays() static GlobalCheckBoxSetting *AggressiveCommDetect() { - GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AggressiveCommDetect"); + auto *bc = new GlobalCheckBoxSetting("AggressiveCommDetect"); bc->setLabel(GeneralSettings::tr("Strict commercial detection")); @@ -377,7 +377,7 @@ static GlobalCheckBoxSetting *AggressiveCommDetect() static HostSpinBoxSetting *CommRewindAmount() { - HostSpinBoxSetting *gs = new HostSpinBoxSetting("CommRewindAmount", 0, 10, 1); + auto *gs = new HostSpinBoxSetting("CommRewindAmount", 0, 10, 1); gs->setLabel(PlaybackSettings::tr("Commercial skip automatic rewind amount " "(secs)")); @@ -393,7 +393,7 @@ static HostSpinBoxSetting *CommRewindAmount() static HostSpinBoxSetting *CommNotifyAmount() { - HostSpinBoxSetting *gs = new HostSpinBoxSetting("CommNotifyAmount", 0, 10, 1); + auto *gs = new HostSpinBoxSetting("CommNotifyAmount", 0, 10, 1); gs->setLabel(PlaybackSettings::tr("Commercial skip notify amount (secs)")); @@ -410,7 +410,7 @@ static HostSpinBoxSetting *CommNotifyAmount() static GlobalSpinBoxSetting *MaximumCommercialSkip() { - GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("MaximumCommercialSkip", 0, 3600, 10); + auto *bs = new GlobalSpinBoxSetting("MaximumCommercialSkip", 0, 3600, 10); bs->setLabel(PlaybackSettings::tr("Maximum commercial skip (secs)")); @@ -428,7 +428,7 @@ static GlobalSpinBoxSetting *MaximumCommercialSkip() static GlobalSpinBoxSetting *MergeShortCommBreaks() { - GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("MergeShortCommBreaks", 0, 3600, 5); + auto *bs = new GlobalSpinBoxSetting("MergeShortCommBreaks", 0, 3600, 5); bs->setLabel(PlaybackSettings::tr("Merge short commercial breaks (secs)")); @@ -446,7 +446,7 @@ static GlobalSpinBoxSetting *MergeShortCommBreaks() static GlobalSpinBoxSetting *AutoExpireExtraSpace() { - GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("AutoExpireExtraSpace", 0, 200, 1); + auto *bs = new GlobalSpinBoxSetting("AutoExpireExtraSpace", 0, 200, 1); bs->setLabel(GeneralSettings::tr("Extra disk space (GB)")); @@ -478,7 +478,7 @@ static GlobalCheckBoxSetting *AutoExpireInsteadOfDelete() static GlobalSpinBoxSetting *DeletedMaxAge() { - GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("DeletedMaxAge", -1, 365, 1); + auto *bs = new GlobalSpinBoxSetting("DeletedMaxAge", -1, 365, 1); bs->setLabel(GeneralSettings::tr("Time to retain deleted recordings " "(days)")); @@ -524,7 +524,7 @@ class DeletedExpireOptions : public TriggeredConfigurationGroup static GlobalComboBoxSetting *AutoExpireMethod() { - GlobalComboBoxSetting *bc = new GlobalComboBoxSetting("AutoExpireMethod"); + auto *bc = new GlobalComboBoxSetting("AutoExpireMethod"); bc->setLabel(GeneralSettings::tr("Auto-Expire method")); @@ -544,7 +544,7 @@ static GlobalComboBoxSetting *AutoExpireMethod() static GlobalCheckBoxSetting *AutoExpireWatchedPriority() { - GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("AutoExpireWatchedPriority"); + auto *bc = new GlobalCheckBoxSetting("AutoExpireWatchedPriority"); bc->setLabel(GeneralSettings::tr("Watched before unwatched")); @@ -559,7 +559,7 @@ static GlobalCheckBoxSetting *AutoExpireWatchedPriority() static GlobalSpinBoxSetting *AutoExpireDayPriority() { - GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("AutoExpireDayPriority", 1, 400, 1); + auto *bs = new GlobalSpinBoxSetting("AutoExpireDayPriority", 1, 400, 1); bs->setLabel(GeneralSettings::tr("Priority weight")); @@ -575,7 +575,7 @@ static GlobalSpinBoxSetting *AutoExpireDayPriority() static GlobalSpinBoxSetting *AutoExpireLiveTVMaxAge() { - GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("AutoExpireLiveTVMaxAge", 1, 365, 1); + auto *bs = new GlobalSpinBoxSetting("AutoExpireLiveTVMaxAge", 1, 365, 1); bs->setLabel(GeneralSettings::tr("Live TV max age (days)")); @@ -607,7 +607,7 @@ static GlobalSpinBoxSetting *MinRecordDiskThreshold() static GlobalCheckBoxSetting *RerecordWatched() { - GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("RerecordWatched"); + auto *bc = new GlobalCheckBoxSetting("RerecordWatched"); bc->setLabel(GeneralSettings::tr("Re-record watched")); @@ -622,7 +622,7 @@ static GlobalCheckBoxSetting *RerecordWatched() static GlobalSpinBoxSetting *RecordPreRoll() { - GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("RecordPreRoll", 0, 600, 60, 1); + auto *bs = new GlobalSpinBoxSetting("RecordPreRoll", 0, 600, 60, 1); bs->setLabel(GeneralSettings::tr("Time to record before start of show " "(secs)")); @@ -640,7 +640,7 @@ static GlobalSpinBoxSetting *RecordPreRoll() static GlobalSpinBoxSetting *RecordOverTime() { - GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("RecordOverTime", 0, 1800, 60, 1); + auto *bs = new GlobalSpinBoxSetting("RecordOverTime", 0, 1800, 60, 1); bs->setLabel(GeneralSettings::tr("Time to record past end of show (secs)")); @@ -657,7 +657,7 @@ static GlobalSpinBoxSetting *RecordOverTime() static GlobalComboBoxSetting *OverTimeCategory() { - GlobalComboBoxSetting *gc = new GlobalComboBoxSetting("OverTimeCategory"); + auto *gc = new GlobalComboBoxSetting("OverTimeCategory"); gc->setLabel(GeneralSettings::tr("Category of shows to be extended")); @@ -687,8 +687,7 @@ static GlobalComboBoxSetting *OverTimeCategory() static GlobalSpinBoxSetting *CategoryOverTime() { - GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("CategoryOverTime", - 0, 180, 60, 1); + auto *bs = new GlobalSpinBoxSetting("CategoryOverTime", 0, 180, 60, 1); bs->setLabel(GeneralSettings::tr("Record past end of show (mins)")); @@ -705,7 +704,7 @@ static GlobalSpinBoxSetting *CategoryOverTime() static GroupSetting *CategoryOverTimeSettings() { - GroupSetting *vcg = new GroupSetting(); + auto *vcg = new GroupSetting(); vcg->setLabel(GeneralSettings::tr("Category record over-time")); @@ -1128,8 +1127,7 @@ void PlaybackProfileItemConfig::ShowDeleteDialog() { QString message = tr("Remove this profile item?"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythConfirmationDialog *confirmDelete = - new MythConfirmationDialog(popupStack, message, true); + auto *confirmDelete = new MythConfirmationDialog(popupStack, message, true); if (confirmDelete->Create()) { @@ -1212,8 +1210,7 @@ void PlaybackProfileConfig::InitUI(StandardSetting *parent) StandardSetting * PlaybackProfileConfig::InitProfileItem( uint i, StandardSetting *parent) { - PlaybackProfileItemConfig* ppic = - new PlaybackProfileItemConfig(this, i, m_items[i]); + auto *ppic = new PlaybackProfileItemConfig(this, i, m_items[i]); m_items[i].Set("pref_priority", QString::number(i + 1)); @@ -1326,8 +1323,7 @@ void PlaybackProfileConfig::swap(int indexA, int indexB) static HostComboBoxSetting * CurrentPlaybackProfile() { - HostComboBoxSetting *grouptrigger = - new HostComboBoxSetting("DefaultVideoPlaybackProfile"); + auto *grouptrigger = new HostComboBoxSetting("DefaultVideoPlaybackProfile"); grouptrigger->setLabel( QCoreApplication::translate("PlaybackProfileConfigs", "Current Video Playback Profile")); @@ -1361,8 +1357,7 @@ void PlaybackSettings::NewPlaybackProfileSlot() MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythTextInputDialog *settingdialog = - new MythTextInputDialog(popupStack, msg); + auto *settingdialog = new MythTextInputDialog(popupStack, msg); if (settingdialog->Create()) { @@ -1417,7 +1412,7 @@ static HostComboBoxSetting *PlayBoxOrdering() "titles. Sections in parentheses are " "not affected."); - HostComboBoxSetting *gc = new HostComboBoxSetting("PlayBoxOrdering"); + auto *gc = new HostComboBoxSetting("PlayBoxOrdering"); gc->setLabel(PlaybackSettings::tr("Episode sort orderings")); @@ -1432,7 +1427,7 @@ static HostComboBoxSetting *PlayBoxOrdering() static HostComboBoxSetting *PlayBoxEpisodeSort() { - HostComboBoxSetting *gc = new HostComboBoxSetting("PlayBoxEpisodeSort"); + auto *gc = new HostComboBoxSetting("PlayBoxEpisodeSort"); gc->setLabel(PlaybackSettings::tr("Sort episodes")); @@ -1449,7 +1444,7 @@ static HostComboBoxSetting *PlayBoxEpisodeSort() static HostSpinBoxSetting *FFRewReposTime() { - HostSpinBoxSetting *gs = new HostSpinBoxSetting("FFRewReposTime", 0, 200, 5); + auto *gs = new HostSpinBoxSetting("FFRewReposTime", 0, 200, 5); gs->setLabel(PlaybackSettings::tr("Fast forward/rewind reposition amount")); @@ -1468,7 +1463,7 @@ static HostSpinBoxSetting *FFRewReposTime() static HostCheckBoxSetting *FFRewReverse() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("FFRewReverse"); + auto *gc = new HostCheckBoxSetting("FFRewReverse"); gc->setLabel(PlaybackSettings::tr("Reverse direction in fast " "forward/rewind")); @@ -1487,7 +1482,7 @@ static HostCheckBoxSetting *FFRewReverse() static HostComboBoxSetting *MenuTheme() { - HostComboBoxSetting *gc = new HostComboBoxSetting("MenuTheme"); + auto *gc = new HostComboBoxSetting("MenuTheme"); gc->setLabel(AppearanceSettings::tr("Menu theme")); @@ -1531,7 +1526,7 @@ static HostComboBoxSetting *DecodeVBIFormat() static HostComboBoxSetting *SubtitleCodec() { - HostComboBoxSetting *gc = new HostComboBoxSetting("SubtitleCodec"); + auto *gc = new HostComboBoxSetting("SubtitleCodec"); gc->setLabel(OSDSettings::tr("Subtitle Codec")); @@ -1548,7 +1543,7 @@ static HostComboBoxSetting *SubtitleCodec() static HostComboBoxSetting *ChannelOrdering() { - HostComboBoxSetting *gc = new HostComboBoxSetting("ChannelOrdering"); + auto *gc = new HostComboBoxSetting("ChannelOrdering"); gc->setLabel(GeneralSettings::tr("Channel ordering")); @@ -1560,7 +1555,7 @@ static HostComboBoxSetting *ChannelOrdering() static HostSpinBoxSetting *VertScanPercentage() { - HostSpinBoxSetting *gs = new HostSpinBoxSetting("VertScanPercentage", -100, 100, 1); + auto *gs = new HostSpinBoxSetting("VertScanPercentage", -100, 100, 1); gs->setLabel(PlaybackSettings::tr("Vertical scaling")); @@ -1574,7 +1569,7 @@ static HostSpinBoxSetting *VertScanPercentage() static HostSpinBoxSetting *HorizScanPercentage() { - HostSpinBoxSetting *gs = new HostSpinBoxSetting("HorizScanPercentage", -100, 100, 1); + auto *gs = new HostSpinBoxSetting("HorizScanPercentage", -100, 100, 1); gs->setLabel(PlaybackSettings::tr("Horizontal scaling")); @@ -1588,7 +1583,7 @@ static HostSpinBoxSetting *HorizScanPercentage() static HostSpinBoxSetting *XScanDisplacement() { - HostSpinBoxSetting *gs = new HostSpinBoxSetting("XScanDisplacement", -50, 50, 1); + auto *gs = new HostSpinBoxSetting("XScanDisplacement", -50, 50, 1); gs->setLabel(PlaybackSettings::tr("Scan displacement (X)")); @@ -1602,7 +1597,7 @@ static HostSpinBoxSetting *XScanDisplacement() static HostSpinBoxSetting *YScanDisplacement() { - HostSpinBoxSetting *gs = new HostSpinBoxSetting("YScanDisplacement", -50, 50, 1); + auto *gs = new HostSpinBoxSetting("YScanDisplacement", -50, 50, 1); gs->setLabel(PlaybackSettings::tr("Scan displacement (Y)")); @@ -1616,7 +1611,7 @@ static HostSpinBoxSetting *YScanDisplacement() static HostCheckBoxSetting *DefaultCCMode() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("DefaultCCMode"); + auto *gc = new HostCheckBoxSetting("DefaultCCMode"); gc->setLabel(OSDSettings::tr("Always display closed captioning or " "subtitles")); @@ -1633,7 +1628,7 @@ static HostCheckBoxSetting *DefaultCCMode() static HostCheckBoxSetting *EnableMHEG() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("EnableMHEG"); + auto *gc = new HostCheckBoxSetting("EnableMHEG"); gc->setLabel(OSDSettings::tr("Enable interactive TV")); @@ -1648,7 +1643,7 @@ static HostCheckBoxSetting *EnableMHEG() static HostCheckBoxSetting *EnableMHEGic() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("EnableMHEGic"); + auto *gc = new HostCheckBoxSetting("EnableMHEGic"); gc->setLabel(OSDSettings::tr("Enable network access for interactive TV")); gc->setValue(true); gc->setHelpText(OSDSettings::tr("If enabled, interactive TV applications " @@ -1660,7 +1655,7 @@ static HostCheckBoxSetting *EnableMHEGic() static HostCheckBoxSetting *PersistentBrowseMode() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("PersistentBrowseMode"); + auto *gc = new HostCheckBoxSetting("PersistentBrowseMode"); gc->setLabel(OSDSettings::tr("Always use browse mode in Live TV")); @@ -1675,7 +1670,7 @@ static HostCheckBoxSetting *PersistentBrowseMode() static HostCheckBoxSetting *BrowseAllTuners() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("BrowseAllTuners"); + auto *gc = new HostCheckBoxSetting("BrowseAllTuners"); gc->setLabel(OSDSettings::tr("Browse all channels")); @@ -1690,7 +1685,7 @@ static HostCheckBoxSetting *BrowseAllTuners() static HostCheckBoxSetting *ClearSavedPosition() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("ClearSavedPosition"); + auto *gc = new HostCheckBoxSetting("ClearSavedPosition"); gc->setLabel(PlaybackSettings::tr("Clear bookmark on playback")); @@ -1707,7 +1702,7 @@ static HostCheckBoxSetting *ClearSavedPosition() static HostCheckBoxSetting *UseProgStartMark() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("UseProgStartMark"); + auto *gc = new HostCheckBoxSetting("UseProgStartMark"); gc->setLabel(PlaybackSettings::tr("Playback from start of program")); @@ -1724,7 +1719,7 @@ static HostCheckBoxSetting *UseProgStartMark() static HostComboBoxSetting *PlaybackExitPrompt() { - HostComboBoxSetting *gc = new HostComboBoxSetting("PlaybackExitPrompt"); + auto *gc = new HostComboBoxSetting("PlaybackExitPrompt"); gc->setLabel(PlaybackSettings::tr("Action on playback exit")); @@ -1747,7 +1742,7 @@ static HostComboBoxSetting *PlaybackExitPrompt() static HostCheckBoxSetting *EndOfRecordingExitPrompt() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("EndOfRecordingExitPrompt"); + auto *gc = new HostCheckBoxSetting("EndOfRecordingExitPrompt"); gc->setLabel(PlaybackSettings::tr("Prompt at end of recording")); @@ -1761,7 +1756,7 @@ static HostCheckBoxSetting *EndOfRecordingExitPrompt() static HostCheckBoxSetting *MusicChoiceEnabled() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("MusicChoiceEnabled"); + auto *gc = new HostCheckBoxSetting("MusicChoiceEnabled"); gc->setLabel(PlaybackSettings::tr("Enable Music Choice")); @@ -1778,7 +1773,7 @@ static HostCheckBoxSetting *MusicChoiceEnabled() static HostCheckBoxSetting *JumpToProgramOSD() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("JumpToProgramOSD"); + auto *gc = new HostCheckBoxSetting("JumpToProgramOSD"); gc->setLabel(PlaybackSettings::tr("Jump to program OSD")); @@ -1795,7 +1790,7 @@ static HostCheckBoxSetting *JumpToProgramOSD() static HostCheckBoxSetting *ContinueEmbeddedTVPlay() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("ContinueEmbeddedTVPlay"); + auto *gc = new HostCheckBoxSetting("ContinueEmbeddedTVPlay"); gc->setLabel(PlaybackSettings::tr("Continue playback when embedded")); @@ -1812,7 +1807,7 @@ static HostCheckBoxSetting *ContinueEmbeddedTVPlay() static HostCheckBoxSetting *AutomaticSetWatched() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("AutomaticSetWatched"); + auto *gc = new HostCheckBoxSetting("AutomaticSetWatched"); gc->setLabel(PlaybackSettings::tr("Automatically mark a recording as " "watched")); @@ -1831,7 +1826,7 @@ static HostCheckBoxSetting *AutomaticSetWatched() static HostSpinBoxSetting *LiveTVIdleTimeout() { - HostSpinBoxSetting *gs = new HostSpinBoxSetting("LiveTVIdleTimeout", 0, 3600, 1); + auto *gs = new HostSpinBoxSetting("LiveTVIdleTimeout", 0, 3600, 1); gs->setLabel(PlaybackSettings::tr("Live TV idle timeout (mins)")); @@ -1878,7 +1873,7 @@ static HostSpinBoxSetting *LiveTVIdleTimeout() static HostCheckBoxSetting *UseVirtualKeyboard() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("UseVirtualKeyboard"); + auto *gc = new HostCheckBoxSetting("UseVirtualKeyboard"); gc->setLabel(MainGeneralSettings::tr("Use line edit virtual keyboards")); @@ -1894,7 +1889,7 @@ static HostCheckBoxSetting *UseVirtualKeyboard() static HostSpinBoxSetting *FrontendIdleTimeout() { - HostSpinBoxSetting *gs = new HostSpinBoxSetting("FrontendIdleTimeout", 0, 360, 5); + auto *gs = new HostSpinBoxSetting("FrontendIdleTimeout", 0, 360, 5); gs->setLabel(MainGeneralSettings::tr("Idle time before entering standby " "mode (minutes)")); @@ -1918,7 +1913,7 @@ static HostSpinBoxSetting *FrontendIdleTimeout() static HostComboBoxSetting *OverrideExitMenu() { - HostComboBoxSetting *gc = new HostComboBoxSetting("OverrideExitMenu"); + auto *gc = new HostComboBoxSetting("OverrideExitMenu"); gc->setLabel(MainGeneralSettings::tr("Customize exit menu options")); @@ -1942,7 +1937,7 @@ static HostComboBoxSetting *OverrideExitMenu() static HostTextEditSetting *RebootCommand() { - HostTextEditSetting *ge = new HostTextEditSetting("RebootCommand"); + auto *ge = new HostTextEditSetting("RebootCommand"); ge->setLabel(MainGeneralSettings::tr("Reboot command")); @@ -1959,7 +1954,7 @@ static HostTextEditSetting *RebootCommand() static HostTextEditSetting *HaltCommand() { - HostTextEditSetting *ge = new HostTextEditSetting("HaltCommand"); + auto *ge = new HostTextEditSetting("HaltCommand"); ge->setLabel(MainGeneralSettings::tr("Halt command")); @@ -1976,7 +1971,7 @@ static HostTextEditSetting *HaltCommand() static HostTextEditSetting *LircDaemonDevice() { - HostTextEditSetting *ge = new HostTextEditSetting("LircSocket"); + auto *ge = new HostTextEditSetting("LircSocket"); ge->setLabel(MainGeneralSettings::tr("LIRC daemon socket")); @@ -1998,7 +1993,7 @@ static HostTextEditSetting *LircDaemonDevice() static HostTextEditSetting *ScreenShotPath() { - HostTextEditSetting *ge = new HostTextEditSetting("ScreenShotPath"); + auto *ge = new HostTextEditSetting("ScreenShotPath"); ge->setLabel(MainGeneralSettings::tr("Screen shot path")); @@ -2013,7 +2008,7 @@ static HostTextEditSetting *ScreenShotPath() static HostTextEditSetting *SetupPinCode() { - HostTextEditSetting *ge = new HostTextEditSetting("SetupPinCode"); + auto *ge = new HostTextEditSetting("SetupPinCode"); ge->setLabel(MainGeneralSettings::tr("Setup PIN code")); @@ -2032,7 +2027,7 @@ static HostTextEditSetting *SetupPinCode() static HostComboBoxSetting *XineramaScreen() { - HostComboBoxSetting *gc = new HostComboBoxSetting("XineramaScreen", false); + auto *gc = new HostComboBoxSetting("XineramaScreen", false); gc->setLabel(AppearanceSettings::tr("Display on screen")); gc->setValue(0); gc->setHelpText(AppearanceSettings::tr("Run on the specified screen or " @@ -2043,7 +2038,7 @@ static HostComboBoxSetting *XineramaScreen() static HostComboBoxSetting *XineramaMonitorAspectRatio() { - HostComboBoxSetting *gc = new HostComboBoxSetting("XineramaMonitorAspectRatio"); + auto *gc = new HostComboBoxSetting("XineramaMonitorAspectRatio"); gc->setLabel(AppearanceSettings::tr("Monitor aspect ratio")); @@ -2060,7 +2055,7 @@ static HostComboBoxSetting *XineramaMonitorAspectRatio() static HostComboBoxSetting *LetterboxingColour() { - HostComboBoxSetting *gc = new HostComboBoxSetting("LetterboxColour"); + auto *gc = new HostComboBoxSetting("LetterboxColour"); gc->setLabel(PlaybackSettings::tr("Letterboxing color")); @@ -2078,7 +2073,7 @@ static HostComboBoxSetting *LetterboxingColour() static HostComboBoxSetting *AspectOverride() { - HostComboBoxSetting *gc = new HostComboBoxSetting("AspectOverride"); + auto *gc = new HostComboBoxSetting("AspectOverride"); gc->setLabel(PlaybackSettings::tr("Video aspect override")); @@ -2093,7 +2088,7 @@ static HostComboBoxSetting *AspectOverride() static HostComboBoxSetting *AdjustFill() { - HostComboBoxSetting *gc = new HostComboBoxSetting("AdjustFill"); + auto *gc = new HostComboBoxSetting("AdjustFill"); gc->setLabel(PlaybackSettings::tr("Zoom")); @@ -2114,7 +2109,7 @@ static HostComboBoxSetting *AdjustFill() static HostSpinBoxSetting *GuiWidth() { - HostSpinBoxSetting *gs = new HostSpinBoxSetting("GuiWidth", 0, 3840, 8, 1); + auto *gs = new HostSpinBoxSetting("GuiWidth", 0, 3840, 8, 1); gs->setLabel(AppearanceSettings::tr("GUI width (pixels)")); @@ -2130,7 +2125,7 @@ static HostSpinBoxSetting *GuiWidth() static HostSpinBoxSetting *GuiHeight() { - HostSpinBoxSetting *gs = new HostSpinBoxSetting("GuiHeight", 0, 2160, 8, 1); + auto *gs = new HostSpinBoxSetting("GuiHeight", 0, 2160, 8, 1); gs->setLabel(AppearanceSettings::tr("GUI height (pixels)")); @@ -2146,7 +2141,7 @@ static HostSpinBoxSetting *GuiHeight() static HostSpinBoxSetting *GuiOffsetX() { - HostSpinBoxSetting *gs = new HostSpinBoxSetting("GuiOffsetX", -3840, 3840, 32, 1); + auto *gs = new HostSpinBoxSetting("GuiOffsetX", -3840, 3840, 32, 1); gs->setLabel(AppearanceSettings::tr("GUI X offset")); @@ -2160,7 +2155,7 @@ static HostSpinBoxSetting *GuiOffsetX() static HostSpinBoxSetting *GuiOffsetY() { - HostSpinBoxSetting *gs = new HostSpinBoxSetting("GuiOffsetY", -1600, 1600, 8, 1); + auto *gs = new HostSpinBoxSetting("GuiOffsetY", -1600, 1600, 8, 1); gs->setLabel(AppearanceSettings::tr("GUI Y offset")); @@ -2205,7 +2200,7 @@ static HostSpinBoxSetting *DisplaySizeHeight() static HostCheckBoxSetting *GuiSizeForTV() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("GuiSizeForTV"); + auto *gc = new HostCheckBoxSetting("GuiSizeForTV"); gc->setLabel(AppearanceSettings::tr("Use GUI size for TV playback")); @@ -2233,9 +2228,8 @@ static HostCheckBoxSetting *UseVideoModes() static HostSpinBoxSetting *VidModeWidth(int idx) { - HostSpinBoxSetting *gs = - new HostSpinBoxSetting(QString("VidModeWidth%1").arg(idx), - 0, 3840, 16, 1); + auto *gs = new HostSpinBoxSetting(QString("VidModeWidth%1").arg(idx), + 0, 3840, 16, 1); gs->setLabel(VideoModeSettings::tr("In X", "Video mode width")); @@ -2249,9 +2243,8 @@ static HostSpinBoxSetting *VidModeWidth(int idx) static HostSpinBoxSetting *VidModeHeight(int idx) { - HostSpinBoxSetting *gs = - new HostSpinBoxSetting(QString("VidModeHeight%1").arg(idx), - 0, 2160, 16, 1); + auto *gs = new HostSpinBoxSetting(QString("VidModeHeight%1").arg(idx), + 0, 2160, 16, 1); gs->setLabel(VideoModeSettings::tr("In Y", "Video mode height")); @@ -2265,7 +2258,7 @@ static HostSpinBoxSetting *VidModeHeight(int idx) static HostComboBoxSetting *GuiVidModeResolution() { - HostComboBoxSetting *gc = new HostComboBoxSetting("GuiVidModeResolution"); + auto *gc = new HostComboBoxSetting("GuiVidModeResolution"); gc->setLabel(VideoModeSettings::tr("GUI")); @@ -2312,7 +2305,7 @@ static HostComboBoxSetting *TVVidModeResolution(int idx=-1) QString qstr = (idx<0) ? "TVVidModeResolution" : QString("TVVidModeResolution%1").arg(idx); - HostComboBoxSetting *gc = new HostComboBoxSetting(qstr); + auto *gc = new HostComboBoxSetting(qstr); QString lstr = (idx<0) ? VideoModeSettings::tr("Video output") : VideoModeSettings::tr("Output"); QString hstr = (idx<0) ? dhelp : ohelp; @@ -2403,8 +2396,7 @@ static HostRefreshRateComboBoxSetting *TVVidModeRefreshRate(int idx=-1) QString qstr = (idx<0) ? "TVVidModeRefreshRate" : QString("TVVidModeRefreshRate%1").arg(idx); - HostRefreshRateComboBoxSetting *gc = - new HostRefreshRateComboBoxSetting(qstr); + auto *gc = new HostRefreshRateComboBoxSetting(qstr); QString lstr = VideoModeSettings::tr("Rate"); QString hstr = (idx<0) ? dhelp : ohelp; @@ -2434,7 +2426,7 @@ static HostComboBoxSetting *TVVidModeForceAspect(int idx=-1) QString qstr = (idx<0) ? "TVVidModeForceAspect" : QString("TVVidModeForceAspect%1").arg(idx); - HostComboBoxSetting *gc = new HostComboBoxSetting(qstr); + auto *gc = new HostComboBoxSetting(qstr); gc->setLabel(VideoModeSettings::tr("Aspect")); @@ -2457,7 +2449,7 @@ void VideoModeSettings::updateButton(MythUIButtonListItem *item) static HostSpinBoxSetting* VideoModeChangePause(void) { - HostSpinBoxSetting *pause = new HostSpinBoxSetting("VideoModeChangePauseMS", 0, 5000, 100); + auto *pause = new HostSpinBoxSetting("VideoModeChangePauseMS", 0, 5000, 100); pause->setLabel(VideoModeSettings::tr("Pause while switching video modes (ms)")); pause->setHelpText(VideoModeSettings::tr( "For most displays, switching video modes takes time and content can be missed. " @@ -2481,7 +2473,7 @@ VideoModeSettings::VideoModeSettings(const char *c) : HostCheckBoxSetting(c) connect(res, SIGNAL(valueChanged(StandardSetting *)), rate, SLOT(ChangeResolution(StandardSetting *))); - GroupSetting* overrides = new GroupSetting(); + auto *overrides = new GroupSetting(); overrides->setLabel(tr("Overrides for specific video sizes")); @@ -2505,7 +2497,7 @@ VideoModeSettings::VideoModeSettings(const char *c) : HostCheckBoxSetting(c) static HostCheckBoxSetting *HideMouseCursor() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("HideMouseCursor"); + auto *gc = new HostCheckBoxSetting("HideMouseCursor"); gc->setLabel(AppearanceSettings::tr("Hide mouse cursor in MythTV")); @@ -2523,7 +2515,7 @@ static HostCheckBoxSetting *HideMouseCursor() static HostCheckBoxSetting *RunInWindow() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("RunFrontendInWindow"); + auto *gc = new HostCheckBoxSetting("RunFrontendInWindow"); gc->setLabel(AppearanceSettings::tr("Use window border")); @@ -2536,7 +2528,7 @@ static HostCheckBoxSetting *RunInWindow() static HostCheckBoxSetting *AlwaysOnTop() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("AlwaysOnTop"); + auto *gc = new HostCheckBoxSetting("AlwaysOnTop"); gc->setLabel(AppearanceSettings::tr("Always On Top")); @@ -2549,7 +2541,8 @@ static HostCheckBoxSetting *AlwaysOnTop() static HostSpinBoxSetting *StartupScreenDelay() { - HostSpinBoxSetting *gs = new HostSpinBoxSetting("StartupScreenDelay", -1, 60, 1, 1, "Never show startup screen"); + auto *gs = new HostSpinBoxSetting("StartupScreenDelay", -1, 60, 1, 1, + "Never show startup screen"); gs->setLabel(AppearanceSettings::tr("Startup Screen Delay")); @@ -2564,8 +2557,7 @@ static HostSpinBoxSetting *StartupScreenDelay() static HostSpinBoxSetting *GUIFontZoom() { - HostSpinBoxSetting *gs = new HostSpinBoxSetting("GUITEXTZOOM", - 50, 150, 1, 1); + auto *gs = new HostSpinBoxSetting("GUITEXTZOOM", 50, 150, 1, 1); gs->setLabel(AppearanceSettings::tr("GUI text zoom percentage")); @@ -2580,7 +2572,7 @@ static HostSpinBoxSetting *GUIFontZoom() static HostComboBoxSetting *MythDateFormatCB() { - HostComboBoxSetting *gc = new HostComboBoxSetting("DateFormat"); + auto *gc = new HostComboBoxSetting("DateFormat"); gc->setLabel(AppearanceSettings::tr("Date format")); QDate sampdate = MythDate::current().toLocalTime().date(); @@ -2634,7 +2626,7 @@ static HostComboBoxSetting *MythDateFormatCB() static HostComboBoxSetting *MythShortDateFormat() { - HostComboBoxSetting *gc = new HostComboBoxSetting("ShortDateFormat"); + auto *gc = new HostComboBoxSetting("ShortDateFormat"); gc->setLabel(AppearanceSettings::tr("Short date format")); QDate sampdate = MythDate::current().toLocalTime().date(); @@ -2687,7 +2679,7 @@ static HostComboBoxSetting *MythShortDateFormat() static HostComboBoxSetting *MythTimeFormat() { - HostComboBoxSetting *gc = new HostComboBoxSetting("TimeFormat"); + auto *gc = new HostComboBoxSetting("TimeFormat"); gc->setLabel(AppearanceSettings::tr("Time format")); @@ -2715,7 +2707,7 @@ static HostComboBoxSetting *MythTimeFormat() #if ! CONFIG_DARWIN static HostComboBoxSetting *ThemePainter() { - HostComboBoxSetting *gc = new HostComboBoxSetting("ThemePainter"); + auto *gc = new HostComboBoxSetting("ThemePainter"); gc->setLabel(AppearanceSettings::tr("Paint engine")); @@ -2746,7 +2738,7 @@ static HostComboBoxSetting *ThemePainter() static HostCheckBoxSetting *GUIRGBLevels() { - HostCheckBoxSetting *rgb = new HostCheckBoxSetting("GUIRGBLevels"); + auto *rgb = new HostCheckBoxSetting("GUIRGBLevels"); rgb->setLabel(AppearanceSettings::tr("Use full range RGB output")); rgb->setValue(true); rgb->setHelpText("Enable (recommended) to supply full range RGB output to your display device. " @@ -2758,7 +2750,7 @@ static HostCheckBoxSetting *GUIRGBLevels() static HostComboBoxSetting *ChannelFormat() { - HostComboBoxSetting *gc = new HostComboBoxSetting("ChannelFormat"); + auto *gc = new HostComboBoxSetting("ChannelFormat"); gc->setLabel(GeneralSettings::tr("Channel format")); @@ -2777,7 +2769,7 @@ static HostComboBoxSetting *ChannelFormat() static HostComboBoxSetting *LongChannelFormat() { - HostComboBoxSetting *gc = new HostComboBoxSetting("LongChannelFormat"); + auto *gc = new HostComboBoxSetting("LongChannelFormat"); gc->setLabel(GeneralSettings::tr("Long channel format")); @@ -2796,7 +2788,7 @@ static HostComboBoxSetting *LongChannelFormat() static HostCheckBoxSetting *ChannelGroupRememberLast() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("ChannelGroupRememberLast"); + auto *gc = new HostCheckBoxSetting("ChannelGroupRememberLast"); gc->setLabel(ChannelGroupSettings::tr("Remember last channel group")); @@ -2813,7 +2805,7 @@ static HostCheckBoxSetting *ChannelGroupRememberLast() static HostComboBoxSetting *ChannelGroupDefault() { - HostComboBoxSetting *gc = new HostComboBoxSetting("ChannelGroupDefault"); + auto *gc = new HostComboBoxSetting("ChannelGroupDefault"); gc->setLabel(ChannelGroupSettings::tr("Default channel group")); @@ -2839,7 +2831,7 @@ static HostComboBoxSetting *ChannelGroupDefault() static HostCheckBoxSetting *BrowseChannelGroup() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("BrowseChannelGroup"); + auto *gc = new HostCheckBoxSetting("BrowseChannelGroup"); gc->setLabel(GeneralSettings::tr("Browse/change channels from Channel " "Group")); @@ -2903,7 +2895,7 @@ static GlobalTextEditSetting *SortPrefixExceptions() static GlobalComboBoxSetting *GRSchedOpenEnd() { - GlobalComboBoxSetting *bc = new GlobalComboBoxSetting("SchedOpenEnd"); + auto *bc = new GlobalComboBoxSetting("SchedOpenEnd"); bc->setLabel(GeneralRecPrioritiesSettings::tr("Avoid back to back " "recordings")); @@ -2928,7 +2920,7 @@ static GlobalComboBoxSetting *GRSchedOpenEnd() static GlobalSpinBoxSetting *GRPrefInputRecPriority() { - GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("PrefInputPriority", 1, 99, 1); + auto *bs = new GlobalSpinBoxSetting("PrefInputPriority", 1, 99, 1); bs->setLabel(GeneralRecPrioritiesSettings::tr("Preferred input priority")); @@ -2945,7 +2937,7 @@ static GlobalSpinBoxSetting *GRPrefInputRecPriority() static GlobalSpinBoxSetting *GRHDTVRecPriority() { - GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("HDTVRecPriority", -99, 99, 1); + auto *bs = new GlobalSpinBoxSetting("HDTVRecPriority", -99, 99, 1); bs->setLabel(GeneralRecPrioritiesSettings::tr("HDTV recording priority")); @@ -2961,7 +2953,7 @@ static GlobalSpinBoxSetting *GRHDTVRecPriority() static GlobalSpinBoxSetting *GRWSRecPriority() { - GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("WSRecPriority", -99, 99, 1); + auto *bs = new GlobalSpinBoxSetting("WSRecPriority", -99, 99, 1); bs->setLabel(GeneralRecPrioritiesSettings::tr("Widescreen recording " "priority")); @@ -2978,8 +2970,7 @@ static GlobalSpinBoxSetting *GRWSRecPriority() static GlobalSpinBoxSetting *GRSignLangRecPriority() { - GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("SignLangRecPriority", - -99, 99, 1); + auto *bs = new GlobalSpinBoxSetting("SignLangRecPriority", -99, 99, 1); bs->setLabel(GeneralRecPrioritiesSettings::tr("Sign language recording " "priority")); @@ -2997,8 +2988,7 @@ static GlobalSpinBoxSetting *GRSignLangRecPriority() static GlobalSpinBoxSetting *GROnScrSubRecPriority() { - GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("OnScrSubRecPriority", - -99, 99, 1); + auto *bs = new GlobalSpinBoxSetting("OnScrSubRecPriority", -99, 99, 1); bs->setLabel(GeneralRecPrioritiesSettings::tr("In-vision Subtitles " "Recording Priority")); @@ -3015,8 +3005,7 @@ static GlobalSpinBoxSetting *GROnScrSubRecPriority() static GlobalSpinBoxSetting *GRCCRecPriority() { - GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("CCRecPriority", - -99, 99, 1); + auto *bs = new GlobalSpinBoxSetting("CCRecPriority", -99, 99, 1); bs->setLabel(GeneralRecPrioritiesSettings::tr("Subtitles/CC recording " "priority")); @@ -3034,8 +3023,7 @@ static GlobalSpinBoxSetting *GRCCRecPriority() static GlobalSpinBoxSetting *GRHardHearRecPriority() { - GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("HardHearRecPriority", - -99, 99, 1); + auto *bs = new GlobalSpinBoxSetting("HardHearRecPriority", -99, 99, 1); bs->setLabel(GeneralRecPrioritiesSettings::tr("Hard of hearing priority")); @@ -3052,8 +3040,7 @@ static GlobalSpinBoxSetting *GRHardHearRecPriority() static GlobalSpinBoxSetting *GRAudioDescRecPriority() { - GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("AudioDescRecPriority", - -99, 99, 1); + auto *bs = new GlobalSpinBoxSetting("AudioDescRecPriority", -99, 99, 1); bs->setLabel(GeneralRecPrioritiesSettings::tr("Audio described priority")); @@ -3068,7 +3055,7 @@ static GlobalSpinBoxSetting *GRAudioDescRecPriority() static HostTextEditSetting *DefaultTVChannel() { - HostTextEditSetting *ge = new HostTextEditSetting("DefaultTVChannel"); + auto *ge = new HostTextEditSetting("DefaultTVChannel"); ge->setLabel(EPGSettings::tr("Guide starts at channel")); @@ -3084,7 +3071,7 @@ static HostTextEditSetting *DefaultTVChannel() static HostSpinBoxSetting *EPGRecThreshold() { - HostSpinBoxSetting *gs = new HostSpinBoxSetting("SelChangeRecThreshold", 1, 600, 1); + auto *gs = new HostSpinBoxSetting("SelChangeRecThreshold", 1, 600, 1); gs->setLabel(EPGSettings::tr("Record threshold")); @@ -3098,7 +3085,7 @@ static HostSpinBoxSetting *EPGRecThreshold() static GlobalComboBoxSetting *MythLanguage() { - GlobalComboBoxSetting *gc = new GlobalComboBoxSetting("Language"); + auto *gc = new GlobalComboBoxSetting("Language"); gc->setLabel(AppearanceSettings::tr("Language")); @@ -3153,7 +3140,7 @@ static void ISO639_fill_selections(MythUIComboBoxSetting *widget, uint i) static GlobalComboBoxSetting *ISO639PreferredLanguage(uint i) { - GlobalComboBoxSetting *gc = new GlobalComboBoxSetting(QString("ISO639Language%1").arg(i)); + auto *gc = new GlobalComboBoxSetting(QString("ISO639Language%1").arg(i)); gc->setLabel(AppearanceSettings::tr("Guide language #%1").arg(i+1)); @@ -3169,7 +3156,7 @@ static GlobalComboBoxSetting *ISO639PreferredLanguage(uint i) static HostCheckBoxSetting *NetworkControlEnabled() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("NetworkControlEnabled"); + auto *gc = new HostCheckBoxSetting("NetworkControlEnabled"); gc->setLabel(MainGeneralSettings::tr("Enable Network Remote Control " "interface")); @@ -3185,7 +3172,7 @@ static HostCheckBoxSetting *NetworkControlEnabled() static HostSpinBoxSetting *NetworkControlPort() { - HostSpinBoxSetting *gs = new HostSpinBoxSetting("NetworkControlPort", 1025, 65535, 1); + auto *gs = new HostSpinBoxSetting("NetworkControlPort", 1025, 65535, 1); gs->setLabel(MainGeneralSettings::tr("Network Remote Control port")); @@ -3200,7 +3187,7 @@ static HostSpinBoxSetting *NetworkControlPort() static HostTextEditSetting *UDPNotifyPort() { - HostTextEditSetting *ge = new HostTextEditSetting("UDPNotifyPort"); + auto *ge = new HostTextEditSetting("UDPNotifyPort"); ge->setLabel(MainGeneralSettings::tr("UDP notify port")); @@ -3216,7 +3203,7 @@ static HostTextEditSetting *UDPNotifyPort() #ifdef USING_LIBCEC static HostCheckBoxSetting *CECEnabled() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("libCECEnabled"); + auto *gc = new HostCheckBoxSetting("libCECEnabled"); gc->setLabel(MainGeneralSettings::tr("Enable CEC Control " "interface")); gc->setHelpText(MainGeneralSettings::tr("This enables " @@ -3230,7 +3217,7 @@ static HostCheckBoxSetting *CECEnabled() static HostCheckBoxSetting *CECPowerOnTVAllowed() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("PowerOnTVAllowed"); + auto *gc = new HostCheckBoxSetting("PowerOnTVAllowed"); gc->setLabel(MainGeneralSettings::tr("Allow Power On TV")); gc->setHelpText(MainGeneralSettings::tr("Enables your TV to be powered " "on from MythTV remote or when MythTV starts " @@ -3241,7 +3228,7 @@ static HostCheckBoxSetting *CECPowerOnTVAllowed() static HostCheckBoxSetting *CECPowerOffTVAllowed() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("PowerOffTVAllowed"); + auto *gc = new HostCheckBoxSetting("PowerOffTVAllowed"); gc->setLabel(MainGeneralSettings::tr("Allow Power Off TV")); gc->setHelpText(MainGeneralSettings::tr("Enables your TV to be powered " "off from MythTV remote or when MythTV starts " @@ -3252,7 +3239,7 @@ static HostCheckBoxSetting *CECPowerOffTVAllowed() static HostCheckBoxSetting *CECPowerOnTVOnStart() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("PowerOnTVOnStart"); + auto *gc = new HostCheckBoxSetting("PowerOnTVOnStart"); gc->setLabel(MainGeneralSettings::tr("Power on TV At Start")); gc->setHelpText(MainGeneralSettings::tr("Powers " "on your TV when you start MythTV " @@ -3263,7 +3250,7 @@ static HostCheckBoxSetting *CECPowerOnTVOnStart() static HostCheckBoxSetting *CECPowerOffTVOnExit() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("PowerOffTVOnExit"); + auto *gc = new HostCheckBoxSetting("PowerOffTVOnExit"); gc->setLabel(MainGeneralSettings::tr("Power off TV At Exit")); gc->setHelpText(MainGeneralSettings::tr("Powers " "off your TV when you exit MythTV " @@ -3278,7 +3265,7 @@ static HostCheckBoxSetting *CECPowerOffTVOnExit() // AirPlay Settings static HostCheckBoxSetting *AirPlayEnabled() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("AirPlayEnabled"); + auto *gc = new HostCheckBoxSetting("AirPlayEnabled"); gc->setLabel(MainGeneralSettings::tr("Enable AirPlay")); @@ -3294,7 +3281,7 @@ static HostCheckBoxSetting *AirPlayEnabled() static HostCheckBoxSetting *AirPlayAudioOnly() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("AirPlayAudioOnly"); + auto *gc = new HostCheckBoxSetting("AirPlayAudioOnly"); gc->setLabel(MainGeneralSettings::tr("Only support AirTunes (no video)")); @@ -3309,7 +3296,7 @@ static HostCheckBoxSetting *AirPlayAudioOnly() static HostCheckBoxSetting *AirPlayPasswordEnabled() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("AirPlayPasswordEnabled"); + auto *gc = new HostCheckBoxSetting("AirPlayPasswordEnabled"); gc->setLabel(MainGeneralSettings::tr("Require password")); @@ -3324,7 +3311,7 @@ static HostCheckBoxSetting *AirPlayPasswordEnabled() static HostTextEditSetting *AirPlayPassword() { - HostTextEditSetting *ge = new HostTextEditSetting("AirPlayPassword"); + auto *ge = new HostTextEditSetting("AirPlayPassword"); ge->setLabel(MainGeneralSettings::tr("Password")); @@ -3339,7 +3326,7 @@ static HostTextEditSetting *AirPlayPassword() static GroupSetting *AirPlayPasswordSettings() { - GroupSetting *hc = new GroupSetting(); + auto *hc = new GroupSetting(); hc->setLabel(MainGeneralSettings::tr("AirPlay - Password")); hc->addChild(AirPlayPasswordEnabled()); @@ -3350,7 +3337,7 @@ static GroupSetting *AirPlayPasswordSettings() static HostCheckBoxSetting *AirPlayFullScreen() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("AirPlayFullScreen"); + auto *gc = new HostCheckBoxSetting("AirPlayFullScreen"); gc->setLabel(MainGeneralSettings::tr("AirPlay full screen playback")); @@ -3394,7 +3381,7 @@ static HostCheckBoxSetting *AirPlayFullScreen() static HostCheckBoxSetting *RealtimePriority() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("RealtimePriority"); + auto *gc = new HostCheckBoxSetting("RealtimePriority"); gc->setLabel(PlaybackSettings::tr("Enable realtime priority threads")); @@ -3410,7 +3397,7 @@ static HostCheckBoxSetting *RealtimePriority() static HostTextEditSetting *IgnoreMedia() { - HostTextEditSetting *ge = new HostTextEditSetting("IgnoreDevices"); + auto *ge = new HostTextEditSetting("IgnoreDevices"); ge->setLabel(MainGeneralSettings::tr("Ignore devices")); @@ -3426,7 +3413,7 @@ static HostTextEditSetting *IgnoreMedia() static HostComboBoxSetting *DisplayGroupTitleSort() { - HostComboBoxSetting *gc = new HostComboBoxSetting("DisplayGroupTitleSort"); + auto *gc = new HostComboBoxSetting("DisplayGroupTitleSort"); gc->setLabel(PlaybackSettings::tr("Sort titles")); @@ -3442,7 +3429,7 @@ static HostComboBoxSetting *DisplayGroupTitleSort() static HostCheckBoxSetting *PlaybackWatchList() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("PlaybackWatchList"); + auto *gc = new HostCheckBoxSetting("PlaybackWatchList"); gc->setLabel(WatchListSettings::tr("Include the 'Watch List' group")); @@ -3458,7 +3445,7 @@ static HostCheckBoxSetting *PlaybackWatchList() static HostCheckBoxSetting *PlaybackWLStart() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("PlaybackWLStart"); + auto *gc = new HostCheckBoxSetting("PlaybackWLStart"); gc->setLabel(WatchListSettings::tr("Start from the Watch List view")); @@ -3472,7 +3459,7 @@ static HostCheckBoxSetting *PlaybackWLStart() static HostCheckBoxSetting *PlaybackWLAutoExpire() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("PlaybackWLAutoExpire"); + auto *gc = new HostCheckBoxSetting("PlaybackWLAutoExpire"); gc->setLabel(WatchListSettings::tr("Exclude recordings not set for " "Auto-Expire")); @@ -3490,7 +3477,7 @@ static HostCheckBoxSetting *PlaybackWLAutoExpire() static HostSpinBoxSetting *PlaybackWLMaxAge() { - HostSpinBoxSetting *gs = new HostSpinBoxSetting("PlaybackWLMaxAge", 30, 180, 10); + auto *gs = new HostSpinBoxSetting("PlaybackWLMaxAge", 30, 180, 10); gs->setLabel(WatchListSettings::tr("Maximum days counted in the score")); @@ -3506,7 +3493,7 @@ static HostSpinBoxSetting *PlaybackWLMaxAge() static HostSpinBoxSetting *PlaybackWLBlackOut() { - HostSpinBoxSetting *gs = new HostSpinBoxSetting("PlaybackWLBlackOut", 0, 5, 1); + auto *gs = new HostSpinBoxSetting("PlaybackWLBlackOut", 0, 5, 1); gs->setLabel(WatchListSettings::tr("Days to exclude weekly episodes after " "delete")); @@ -3525,7 +3512,7 @@ static HostSpinBoxSetting *PlaybackWLBlackOut() static HostCheckBoxSetting *EnableMediaMon() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("MonitorDrives"); + auto *gc = new HostCheckBoxSetting("MonitorDrives"); gc->setLabel(MainGeneralSettings::tr("Media Monitor")); @@ -3544,7 +3531,7 @@ static HostCheckBoxSetting *EnableMediaMon() static HostCheckBoxSetting *LCDShowTime() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDShowTime"); + auto *gc = new HostCheckBoxSetting("LCDShowTime"); gc->setLabel(LcdSettings::tr("Display time")); @@ -3558,7 +3545,7 @@ static HostCheckBoxSetting *LCDShowTime() static HostCheckBoxSetting *LCDShowRecStatus() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDShowRecStatus"); + auto *gc = new HostCheckBoxSetting("LCDShowRecStatus"); gc->setLabel(LcdSettings::tr("Display recording status")); @@ -3572,7 +3559,7 @@ static HostCheckBoxSetting *LCDShowRecStatus() static HostCheckBoxSetting *LCDShowMenu() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDShowMenu"); + auto *gc = new HostCheckBoxSetting("LCDShowMenu"); gc->setLabel(LcdSettings::tr("Display menus")); @@ -3585,7 +3572,7 @@ static HostCheckBoxSetting *LCDShowMenu() static HostSpinBoxSetting *LCDPopupTime() { - HostSpinBoxSetting *gs = new HostSpinBoxSetting("LCDPopupTime", 1, 300, 1, 1); + auto *gs = new HostSpinBoxSetting("LCDPopupTime", 1, 300, 1, 1); gs->setLabel(LcdSettings::tr("Menu pop-up time")); @@ -3599,7 +3586,7 @@ static HostSpinBoxSetting *LCDPopupTime() static HostCheckBoxSetting *LCDShowMusic() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDShowMusic"); + auto *gc = new HostCheckBoxSetting("LCDShowMusic"); gc->setLabel(LcdSettings::tr("Display music artist and title")); @@ -3613,7 +3600,7 @@ static HostCheckBoxSetting *LCDShowMusic() static HostComboBoxSetting *LCDShowMusicItems() { - HostComboBoxSetting *gc = new HostComboBoxSetting("LCDShowMusicItems"); + auto *gc = new HostComboBoxSetting("LCDShowMusicItems"); gc->setLabel(LcdSettings::tr("Items")); @@ -3628,7 +3615,7 @@ static HostComboBoxSetting *LCDShowMusicItems() static HostCheckBoxSetting *LCDShowChannel() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDShowChannel"); + auto *gc = new HostCheckBoxSetting("LCDShowChannel"); gc->setLabel(LcdSettings::tr("Display channel information")); @@ -3642,7 +3629,7 @@ static HostCheckBoxSetting *LCDShowChannel() static HostCheckBoxSetting *LCDShowVolume() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDShowVolume"); + auto *gc = new HostCheckBoxSetting("LCDShowVolume"); gc->setLabel(LcdSettings::tr("Display volume information")); @@ -3656,7 +3643,7 @@ static HostCheckBoxSetting *LCDShowVolume() static HostCheckBoxSetting *LCDShowGeneric() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDShowGeneric"); + auto *gc = new HostCheckBoxSetting("LCDShowGeneric"); gc->setLabel(LcdSettings::tr("Display generic information")); @@ -3669,7 +3656,7 @@ static HostCheckBoxSetting *LCDShowGeneric() static HostCheckBoxSetting *LCDBacklightOn() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDBacklightOn"); + auto *gc = new HostCheckBoxSetting("LCDBacklightOn"); gc->setLabel(LcdSettings::tr("Backlight always on")); @@ -3682,7 +3669,7 @@ static HostCheckBoxSetting *LCDBacklightOn() static HostCheckBoxSetting *LCDHeartBeatOn() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDHeartBeatOn"); + auto *gc = new HostCheckBoxSetting("LCDHeartBeatOn"); gc->setLabel(LcdSettings::tr("Heartbeat always on")); @@ -3695,7 +3682,7 @@ static HostCheckBoxSetting *LCDHeartBeatOn() static HostCheckBoxSetting *LCDBigClock() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDBigClock"); + auto *gc = new HostCheckBoxSetting("LCDBigClock"); gc->setLabel(LcdSettings::tr("Display large clock")); @@ -3709,7 +3696,7 @@ static HostCheckBoxSetting *LCDBigClock() static HostTextEditSetting *LCDKeyString() { - HostTextEditSetting *ge = new HostTextEditSetting("LCDKeyString"); + auto *ge = new HostTextEditSetting("LCDKeyString"); ge->setLabel(LcdSettings::tr("LCD key order")); @@ -3726,7 +3713,7 @@ static HostTextEditSetting *LCDKeyString() static HostCheckBoxSetting *LCDEnable() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("LCDEnable"); + auto *gc = new HostCheckBoxSetting("LCDEnable"); gc->setLabel(LcdSettings::tr("Enable LCD device")); @@ -4015,12 +4002,12 @@ MainGeneralSettings::MainGeneralSettings() addChild(new DatabaseSettings()); - GroupSetting *pin = new GroupSetting(); + auto *pin = new GroupSetting(); pin->setLabel(tr("Settings Access")); pin->addChild(SetupPinCode()); addChild(pin); - GroupSetting *general = new GroupSetting(); + auto *general = new GroupSetting(); general->setLabel(tr("General")); general->addChild(UseVirtualKeyboard()); general->addChild(ScreenShotPath()); @@ -4043,7 +4030,7 @@ MainGeneralSettings::MainGeneralSettings() addChild(new ShutDownRebootSetting()); - GroupSetting *remotecontrol = new GroupSetting(); + auto *remotecontrol = new GroupSetting(); remotecontrol->setLabel(tr("Remote Control")); remotecontrol->addChild(LircDaemonDevice()); remotecontrol->addChild(NetworkControlEnabled()); @@ -4068,7 +4055,7 @@ MainGeneralSettings::MainGeneralSettings() addChild(remotecontrol); #ifdef USING_AIRPLAY - GroupSetting *airplay = new GroupSetting(); + auto *airplay = new GroupSetting(); airplay->setLabel(tr("AirPlay Settings")); airplay->addChild(AirPlayEnabled()); airplay->addChild(AirPlayFullScreen()); @@ -4175,8 +4162,7 @@ void PlaybackSettingsDialog::ShowMenu(void) MythUIButtonListItem *item = m_buttonList->GetItemCurrent(); if (item) { - PlaybackProfileItemConfig *config = - item->GetData().value<PlaybackProfileItemConfig*>(); + auto *config = item->GetData().value<PlaybackProfileItemConfig*>(); if (config) ShowPlaybackProfileMenu(item); } @@ -4185,8 +4171,7 @@ void PlaybackSettingsDialog::ShowMenu(void) void PlaybackSettingsDialog::ShowPlaybackProfileMenu(MythUIButtonListItem *item) { - MythMenu *menu = new MythMenu(tr("Playback Profile Menu"), this, - "mainmenu"); + auto *menu = new MythMenu(tr("Playback Profile Menu"), this, "mainmenu"); if (m_buttonList->GetItemPos(item) > 2) menu->AddItem(tr("Move Up"), SLOT(MoveProfileItemUp())); @@ -4197,8 +4182,7 @@ void PlaybackSettingsDialog::ShowPlaybackProfileMenu(MythUIButtonListItem *item) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(menu, popupStack, - "menudialog"); + auto *menuPopup = new MythDialogBox(menu, popupStack, "menudialog"); menuPopup->SetReturnEvent(this, "mainmenu"); if (menuPopup->Create()) @@ -4212,8 +4196,7 @@ void PlaybackSettingsDialog::MoveProfileItemDown(void) MythUIButtonListItem *item = m_buttonList->GetItemCurrent(); if (item) { - PlaybackProfileItemConfig *config = - item->GetData().value<PlaybackProfileItemConfig*>(); + auto *config = item->GetData().value<PlaybackProfileItemConfig*>(); if (config) { const int currentPos = m_buttonList->GetCurrentPos(); @@ -4230,8 +4213,7 @@ void PlaybackSettingsDialog::MoveProfileItemUp(void) MythUIButtonListItem *item = m_buttonList->GetItemCurrent(); if (item) { - PlaybackProfileItemConfig *config = - item->GetData().value<PlaybackProfileItemConfig*>(); + auto *config = item->GetData().value<PlaybackProfileItemConfig*>(); if (config) { const int currentPos = m_buttonList->GetCurrentPos(); @@ -4245,8 +4227,7 @@ void PlaybackSettingsDialog::MoveProfileItemUp(void) void PlaybackSettingsDialog::DeleteProfileItem(void) { - PlaybackProfileItemConfig *config = - m_buttonList->GetDataValue().value<PlaybackProfileItemConfig*>(); + auto *config = m_buttonList->GetDataValue().value<PlaybackProfileItemConfig*>(); if (config) config->ShowDeleteDialog(); } @@ -4258,7 +4239,7 @@ PlaybackSettings::PlaybackSettings() void PlaybackSettings::Load(void) { - GroupSetting* general = new GroupSetting(); + auto *general = new GroupSetting(); general->setLabel(tr("General Playback")); general->addChild(JumpToProgramOSD()); general->addChild(ClearSavedPosition()); @@ -4283,7 +4264,7 @@ void PlaybackSettings::Load(void) general->addChild(MusicChoiceEnabled()); addChild(general); - GroupSetting* advanced = new GroupSetting(); + auto *advanced = new GroupSetting(); advanced->setLabel(tr("Advanced Playback Settings")); advanced->addChild(RealtimePriority()); advanced->addChild(AudioReadAhead()); @@ -4306,7 +4287,7 @@ void PlaybackSettings::Load(void) connect(m_newPlaybackProfileButton, SIGNAL(clicked()), SLOT(NewPlaybackProfileSlot())); - GroupSetting* pbox = new GroupSetting(); + auto *pbox = new GroupSetting(); pbox->setLabel(tr("View Recordings")); pbox->addChild(PlayBoxOrdering()); pbox->addChild(PlayBoxEpisodeSort()); @@ -4315,7 +4296,7 @@ void PlaybackSettings::Load(void) // pbox->addChild(HWAccelPlaybackPreview()); pbox->addChild(PBBStartInTitle()); - GroupSetting* pbox2 = new GroupSetting(); + auto *pbox2 = new GroupSetting(); pbox2->setLabel(tr("Recording Groups")); pbox2->addChild(DisplayRecGroup()); pbox2->addChild(QueryInitialFilter()); @@ -4334,7 +4315,7 @@ void PlaybackSettings::Load(void) pbox->addChild(playbackWatchList); addChild(pbox); - GroupSetting* seek = new GroupSetting(); + auto *seek = new GroupSetting(); seek->setLabel(tr("Seeking")); seek->addChild(SmartForward()); seek->addChild(FFRewReposTime()); @@ -4342,7 +4323,7 @@ void PlaybackSettings::Load(void) addChild(seek); - GroupSetting* comms = new GroupSetting(); + auto *comms = new GroupSetting(); comms->setLabel(tr("Commercial Skip")); comms->addChild(AutoCommercialSkip()); comms->addChild(CommRewindAmount()); @@ -4407,7 +4388,7 @@ OSDSettings::OSDSettings() GeneralSettings::GeneralSettings() { setLabel(tr("General (Basic)")); - GroupSetting* general = new GroupSetting(); + auto *general = new GroupSetting(); general->setLabel(tr("General (Basic)")); general->addChild(ChannelOrdering()); general->addChild(ChannelFormat()); @@ -4415,7 +4396,7 @@ GeneralSettings::GeneralSettings() addChild(general); - GroupSetting* autoexp = new GroupSetting(); + auto *autoexp = new GroupSetting(); autoexp->setLabel(tr("General (Auto-Expire)")); @@ -4433,7 +4414,7 @@ GeneralSettings::GeneralSettings() addChild(autoexp); - GroupSetting* jobs = new GroupSetting(); + auto *jobs = new GroupSetting(); jobs->setLabel(tr("General (Jobs)")); @@ -4444,7 +4425,7 @@ GeneralSettings::GeneralSettings() addChild(jobs); - GroupSetting* general2 = new GroupSetting(); + auto *general2 = new GroupSetting(); general2->setLabel(tr("General (Advanced)")); @@ -4453,7 +4434,7 @@ GeneralSettings::GeneralSettings() general2->addChild(CategoryOverTimeSettings()); addChild(general2); - GroupSetting* changrp = new GroupSetting(); + auto *changrp = new GroupSetting(); changrp->setLabel(tr("General (Channel Groups)")); @@ -4474,7 +4455,7 @@ EPGSettings::EPGSettings() GeneralRecPrioritiesSettings::GeneralRecPrioritiesSettings() { - GroupSetting* sched = new GroupSetting(); + auto *sched = new GroupSetting(); sched->setLabel(tr("Scheduler Options")); @@ -4485,7 +4466,7 @@ GeneralRecPrioritiesSettings::GeneralRecPrioritiesSettings() addChild(sched); - GroupSetting* access = new GroupSetting(); + auto *access = new GroupSetting(); access->setLabel(tr("Accessibility Options")); @@ -4573,7 +4554,7 @@ void AppearanceSettings::PopulateScreens(int Screens) AppearanceSettings::AppearanceSettings() { - GroupSetting* screen = new GroupSetting(); + auto *screen = new GroupSetting(); screen->setLabel(tr("Theme / Screen Settings")); addChild(screen); @@ -4613,7 +4594,7 @@ AppearanceSettings::AppearanceSettings() if (!scr.empty()) addChild(UseVideoModes()); #endif - GroupSetting* dates = new GroupSetting(); + auto *dates = new GroupSetting(); dates->setLabel(tr("Localization")); @@ -4729,8 +4710,7 @@ void ChannelGroupSetting::Save() { if ((*i) != m_groupName) { - ChannelCheckBoxSetting *channel = - dynamic_cast<ChannelCheckBoxSetting *>(*i); + auto *channel = dynamic_cast<ChannelCheckBoxSetting *>(*i); if (channel) { if (channel->boolValue()) @@ -4782,7 +4762,7 @@ void ChannelGroupSetting::Load() { while (query.next()) { - ChannelCheckBoxSetting *channelCheckBox = + auto *channelCheckBox = new ChannelCheckBoxSetting(query.value(0).toUInt(), query.value(1).toString(), query.value(2).toString()); @@ -4825,8 +4805,7 @@ ChannelGroupsSetting::ChannelGroupsSetting() void ChannelGroupsSetting::Load() { clearSettings(); - ButtonStandardSetting *newGroup = - new ButtonStandardSetting(tr("(Create New Channel Group)")); + auto *newGroup = new ButtonStandardSetting(tr("(Create New Channel Group)")); connect(newGroup, SIGNAL(clicked()), SLOT(ShowNewGroupDialog())); addChild(newGroup); @@ -4861,8 +4840,7 @@ void ChannelGroupsSetting::Load() void ChannelGroupsSetting::ShowNewGroupDialog() { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythTextInputDialog *settingdialog = - new MythTextInputDialog(popupStack, + auto *settingdialog = new MythTextInputDialog(popupStack, tr("Enter the name of the new channel group")); if (settingdialog->Create()) @@ -4879,7 +4857,7 @@ void ChannelGroupsSetting::ShowNewGroupDialog() void ChannelGroupsSetting::CreateNewGroup(const QString& name) { - ChannelGroupSetting *button = new ChannelGroupSetting(name,-1); + auto *button = new ChannelGroupSetting(name,-1); button->setLabel(name); button->Load(); addChild(button); diff --git a/mythtv/programs/mythfrontend/globalsettings.h b/mythtv/programs/mythfrontend/globalsettings.h index b469db54d74..5d5099d7d78 100644 --- a/mythtv/programs/mythfrontend/globalsettings.h +++ b/mythtv/programs/mythfrontend/globalsettings.h @@ -227,9 +227,9 @@ class PlaybackProfileItemConfig : public GroupSetting TransMythUICheckBoxSetting *Shader, TransMythUICheckBoxSetting *Driver, QString &Value); - QString GetQuality(TransMythUIComboBoxSetting *Deint, - TransMythUICheckBoxSetting *Shader, - TransMythUICheckBoxSetting *Driver); + static QString GetQuality(TransMythUIComboBoxSetting *Deint, + TransMythUICheckBoxSetting *Shader, + TransMythUICheckBoxSetting *Driver); void InitLabel(void); void DoDeleteSlot(bool); diff --git a/mythtv/programs/mythfrontend/grabbersettings.cpp b/mythtv/programs/mythfrontend/grabbersettings.cpp index 676949da5bb..eb8d8c151ec 100644 --- a/mythtv/programs/mythfrontend/grabbersettings.cpp +++ b/mythtv/programs/mythfrontend/grabbersettings.cpp @@ -82,8 +82,8 @@ void GrabberSettings::Init(void) { InfoMap map; it->toMap(map); - MythUIButtonListItem *item = - new MythUIButtonListItem(m_movieGrabberButtonList, it->GetName()); + auto *item = new MythUIButtonListItem(m_movieGrabberButtonList, + it->GetName()); item->SetData(it->GetRelPath()); item->SetTextFromMap(map); } @@ -95,8 +95,8 @@ void GrabberSettings::Init(void) { InfoMap map; it->toMap(map); - MythUIButtonListItem *item = - new MythUIButtonListItem(m_tvGrabberButtonList, it->GetName()); + auto *item = new MythUIButtonListItem(m_tvGrabberButtonList, + it->GetName()); item->SetData(it->GetRelPath()); item->SetTextFromMap(map); } @@ -108,8 +108,8 @@ void GrabberSettings::Init(void) { InfoMap map; it->toMap(map); - MythUIButtonListItem *item = - new MythUIButtonListItem(m_gameGrabberButtonList, it->GetName()); + auto *item = new MythUIButtonListItem(m_gameGrabberButtonList, + it->GetName()); item->SetData(it->GetRelPath()); item->SetTextFromMap(map); } diff --git a/mythtv/programs/mythfrontend/guidegrid.cpp b/mythtv/programs/mythfrontend/guidegrid.cpp index 956689ec6c4..05637bcb1bd 100644 --- a/mythtv/programs/mythfrontend/guidegrid.cpp +++ b/mythtv/programs/mythfrontend/guidegrid.cpp @@ -472,10 +472,8 @@ void GuideGrid::RunProgramGuide(uint chanid, const QString &channum, } MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - GuideGrid *gg = new GuideGrid(mainStack, - chanid, actualChannum, startTime, - player, embedVideo, allowFinder, - changrpid); + auto *gg = new GuideGrid(mainStack, chanid, actualChannum, startTime, + player, embedVideo, allowFinder, changrpid); if (gg->Create()) mainStack->AddScreen(gg, (player == nullptr)); @@ -872,7 +870,7 @@ bool GuideGrid::gestureEvent(MythGestureEvent *event) if (!type) return false; - MythUIStateType *object = dynamic_cast<MythUIStateType *>(type); + auto *object = dynamic_cast<MythUIStateType *>(type); if (object) { @@ -881,7 +879,7 @@ bool GuideGrid::gestureEvent(MythGestureEvent *event) if (name.startsWith("channellist")) { - MythUIButtonList* channelList = dynamic_cast<MythUIButtonList*>(object); + auto* channelList = dynamic_cast<MythUIButtonList*>(object); if (channelList) { @@ -891,7 +889,7 @@ bool GuideGrid::gestureEvent(MythGestureEvent *event) } else if (name.startsWith("guidegrid")) { - MythUIGuideGrid* guidegrid = dynamic_cast<MythUIGuideGrid*>(object); + auto* guidegrid = dynamic_cast<MythUIGuideGrid*>(object); if (guidegrid) { @@ -1060,8 +1058,7 @@ void GuideGrid::ShowMenu(void) QString label = tr("Guide Options"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(label, popupStack, - "guideMenuPopup"); + auto *menuPopup = new MythDialogBox(label, popupStack, "guideMenuPopup"); if (menuPopup->Create()) { @@ -1107,8 +1104,7 @@ void GuideGrid::ShowRecordingMenu(void) QString label = tr("Recording Options"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(label, popupStack, - "recMenuPopup"); + auto *menuPopup = new MythDialogBox(label, popupStack, "recMenuPopup"); if (menuPopup->Create()) { @@ -1193,8 +1189,8 @@ static ProgramList *CopyProglist(ProgramList *proglist) { if (!proglist) return nullptr; - ProgramList *result = new ProgramList(); - for (ProgramList::iterator pi = proglist->begin(); + auto *result = new ProgramList(); + for (auto pi = proglist->begin(); pi != proglist->end(); ++pi) result->push_back(new ProgramInfo(**pi)); return result; @@ -1223,7 +1219,7 @@ uint GuideGrid::GetAlternateChannelIndex( if (with_same_channum != same_channum) continue; - if (!m_player->IsTunable(ctx, ciinfo->m_chanid)) + if (!TV::IsTunable(ctx, ciinfo->m_chanid)) continue; if (with_same_channum) @@ -1358,7 +1354,7 @@ void GuideGrid::fillChannelInfos(bool gotostartchannel) 0, (m_changrpid < 0) ? 0 : m_changrpid); - typedef vector<uint> uint_list_t; + using uint_list_t = vector<uint>; QMap<QString,uint_list_t> channum_to_index_map; QMap<QString,uint_list_t> callsign_to_index_map; @@ -1507,8 +1503,7 @@ void GuideGrid::fillTimeInfos() infomap["endtime"] = MythDate::toString(endtime, MythDate::kTime); - MythUIButtonListItem *item = - new MythUIButtonListItem(m_timeList, timeStr); + auto *item = new MythUIButtonListItem(m_timeList, timeStr); item->SetTextFromMap(infomap); } @@ -1525,7 +1520,7 @@ void GuideGrid::fillProgramInfos(bool useExistingData) ProgramList *GuideGrid::getProgramListFromProgram(int chanNum) { - ProgramList *proglist = new ProgramList(); + auto *proglist = new ProgramList(); if (proglist) { @@ -1609,8 +1604,7 @@ void GuideGrid::fillProgramRowInfos(int firstRow, bool useExistingData) m_currentStartTime, m_currentEndTime, m_currentStartChannel, m_currentRow, m_currentCol, m_channelCount, m_timeCount, m_verticalLayout, m_firstTime, m_lastTime); - GuideUpdateProgramRow *updater = - new GuideUpdateProgramRow(this, gs, proglists); + auto *updater = new GuideUpdateProgramRow(this, gs, proglists); m_threadPool.start(new GuideHelper(this, updater), "GuideHelper"); } @@ -1643,7 +1637,7 @@ void GuideUpdateProgramRow::fillProgramRowInfosWith(int row, m_progPast = progPast; - ProgramList::iterator program = proglist->begin(); + auto program = proglist->begin(); vector<ProgramInfo*> unknownlist; bool unknown = false; ProgramInfo *proginfo = nullptr; @@ -1698,7 +1692,7 @@ void GuideUpdateProgramRow::fillProgramRowInfosWith(int row, ts = ts.addSecs(5 * 60); } - vector<ProgramInfo*>::iterator it = unknownlist.begin(); + auto it = unknownlist.begin(); for (; it != unknownlist.end(); ++it) proglist->push_back(*it); @@ -1851,7 +1845,7 @@ void GuideGrid::customEvent(QEvent *event) { if (event->type() == MythEvent::MythEventMessage) { - MythEvent *me = static_cast<MythEvent *>(event); + auto *me = static_cast<MythEvent *>(event); const QString& message = me->Message(); if (message == "SCHEDULE_CHANGE") @@ -1871,7 +1865,7 @@ void GuideGrid::customEvent(QEvent *event) } else if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); + auto *dce = (DialogCompletionEvent*)(event); QString resultid = dce->GetId(); QString resulttext = dce->GetResultText(); @@ -1879,8 +1873,7 @@ void GuideGrid::customEvent(QEvent *event) if (resultid == "deleterule") { - RecordingRule *record = - dce->GetData().value<RecordingRule *>(); + auto *record = dce->GetData().value<RecordingRule *>(); if (record) { if ((buttonnum > 0) && !record->Delete()) @@ -2010,7 +2003,7 @@ void GuideGrid::customEvent(QEvent *event) } else if (event->type() == UpdateGuideEvent::kEventType) { - UpdateGuideEvent *uge = static_cast<UpdateGuideEvent*>(event); + auto *uge = static_cast<UpdateGuideEvent*>(event); if (uge->m_updater) { uge->m_updater->ExecuteUI(); @@ -2066,8 +2059,7 @@ void GuideGrid::updateProgramsUI(unsigned int firstRow, unsigned int numRows, void GuideGrid::updateChannels(void) { - GuideUpdateChannels *updater = - new GuideUpdateChannels(this, m_currentStartChannel); + auto *updater = new GuideUpdateChannels(this, m_currentStartChannel); m_threadPool.start(new GuideHelper(this, updater), "GuideHelper"); } @@ -2093,7 +2085,7 @@ void GuideGrid::updateChannelsNonUI(QVector<ChannelInfo *> &chinfos, const PlayerContext *ctx = m_player->GetPlayerReadLock( -1, __FILE__, __LINE__); if (ctx && chinfo) - try_alt = !m_player->IsTunable(ctx, chinfo->m_chanid); + try_alt = !TV::IsTunable(ctx, chinfo->m_chanid); m_player->ReturnPlayerLock(ctx); } @@ -2131,9 +2123,8 @@ void GuideGrid::updateChannelsUI(const QVector<ChannelInfo *> &chinfos, { ChannelInfo *chinfo = chinfos[i]; bool unavailable = unavailables[i]; - MythUIButtonListItem *item = - new MythUIButtonListItem(m_channelList, - chinfo ? chinfo->GetFormatted(ChannelInfo::kChannelShort) : QString()); + auto *item = new MythUIButtonListItem(m_channelList, + chinfo ? chinfo->GetFormatted(ChannelInfo::kChannelShort) : QString()); QString state = "available"; if (unavailable) @@ -2261,8 +2252,7 @@ void GuideGrid::ChannelGroupMenu(int mode) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythConfirmationDialog *okPopup = new MythConfirmationDialog(popupStack, - message, false); + auto *okPopup = new MythConfirmationDialog(popupStack, message, false); if (okPopup->Create()) popupStack->AddScreen(okPopup); else @@ -2274,7 +2264,7 @@ void GuideGrid::ChannelGroupMenu(int mode) QString label = tr("Select Channel Group"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(label, popupStack, "menuPopup"); + auto *menuPopup = new MythDialogBox(label, popupStack, "menuPopup"); if (menuPopup->Create()) { @@ -2548,7 +2538,7 @@ void GuideGrid::deleteRule() if (!pginfo || !pginfo->GetRecordingRuleID()) return; - RecordingRule *record = new RecordingRule(); + auto *record = new RecordingRule(); if (!record->LoadByProgram(pginfo)) { delete record; @@ -2560,8 +2550,7 @@ void GuideGrid::deleteRule() MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythConfirmationDialog *okPopup = new MythConfirmationDialog(popupStack, - message, true); + auto *okPopup = new MythConfirmationDialog(popupStack, message, true); okPopup->SetReturnEvent(this, "deleterule"); okPopup->SetData(qVariantFromValue(record)); @@ -2653,7 +2642,7 @@ void GuideGrid::HideTVWindow(void) void GuideGrid::EmbedTVWindow(void) { - MythEvent *me = new MythEvent("STOP_VIDEO_REFRESH_TIMER"); + auto *me = new MythEvent("STOP_VIDEO_REFRESH_TIMER"); qApp->postEvent(this, me); m_usingNullVideo = !m_player->StartEmbedding(m_videoRect); @@ -2701,8 +2690,7 @@ void GuideGrid::ShowJumpToTime(void) MythTimeInputDialog::kHours); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythTimeInputDialog *timedlg = new MythTimeInputDialog(popupStack, message, - flags); + auto *timedlg = new MythTimeInputDialog(popupStack, message, flags); if (timedlg->Create()) { diff --git a/mythtv/programs/mythfrontend/guidegrid.h b/mythtv/programs/mythfrontend/guidegrid.h index 4a6e2c3d8de..f0edde70fd6 100644 --- a/mythtv/programs/mythfrontend/guidegrid.h +++ b/mythtv/programs/mythfrontend/guidegrid.h @@ -31,9 +31,9 @@ class QTimer; class MythUIButtonList; class MythUIGuideGrid; -typedef vector<ChannelInfo> db_chan_list_t; -typedef vector<db_chan_list_t> db_chan_list_list_t; -typedef ProgramInfo *ProgInfoGuideArray[MAX_DISPLAY_CHANS][MAX_DISPLAY_TIMES]; +using db_chan_list_t = vector<ChannelInfo> ; +using db_chan_list_list_t = vector<db_chan_list_t>; +using ProgInfoGuideArray = ProgramInfo *[MAX_DISPLAY_CHANS][MAX_DISPLAY_TIMES]; class JumpToChannel; class JumpToChannelListener diff --git a/mythtv/programs/mythfrontend/idlescreen.cpp b/mythtv/programs/mythfrontend/idlescreen.cpp index 2eb4c6cba44..5d7140946d8 100644 --- a/mythtv/programs/mythfrontend/idlescreen.cpp +++ b/mythtv/programs/mythfrontend/idlescreen.cpp @@ -162,7 +162,7 @@ void IdleScreen::UpdateScreen(void) // update scheduled if (!m_scheduledList.empty()) { - ProgramList::iterator pit = m_scheduledList.begin(); + auto pit = m_scheduledList.begin(); while (pit != m_scheduledList.end()) { @@ -196,8 +196,7 @@ void IdleScreen::UpdateScreen(void) if (list != nullptr) { - MythUIButtonListItem *item = - new MythUIButtonListItem(list,"", + auto *item = new MythUIButtonListItem(list,"", qVariantFromValue(progInfo)); InfoMap infoMap; @@ -245,7 +244,7 @@ void IdleScreen::customEvent(QEvent* event) { if (event->type() == MythEvent::MythEventMessage) { - MythEvent *me = static_cast<MythEvent *>(event); + auto *me = static_cast<MythEvent *>(event); if (me->Message().startsWith("RECONNECT_")) { diff --git a/mythtv/programs/mythfrontend/main.cpp b/mythtv/programs/mythfrontend/main.cpp index 39f1239c265..ac87699d972 100644 --- a/mythtv/programs/mythfrontend/main.cpp +++ b/mythtv/programs/mythfrontend/main.cpp @@ -185,7 +185,7 @@ namespace if (passwordValid) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StandardSettingDialog *ssd = + auto *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings", new VideoGeneralSettings()); @@ -228,7 +228,7 @@ namespace QString btn0msg = tr("Play from bookmark"); QString btn1msg = tr("Play from beginning"); - MythDialogBox *popup = new MythDialogBox(msg, GetScreenStack(), "bookmarkdialog"); + auto *popup = new MythDialogBox(msg, GetScreenStack(), "bookmarkdialog"); if (!popup->Create()) { delete popup; @@ -247,7 +247,7 @@ namespace { if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); + auto *dce = (DialogCompletionEvent*)(event); int buttonnum = dce->GetResult(); if (dce->GetId() == "bookmarkdialog") @@ -337,7 +337,7 @@ static void startAppearWiz(void) "mythfrontend is operating in windowed mode.")); else { - MythSystemLegacy *wizard = new MythSystemLegacy( + auto *wizard = new MythSystemLegacy( GetAppBinDir() + "mythscreenwizard", QStringList(), kMSDisableUDPListener | kMSPropagateLogs); @@ -370,7 +370,7 @@ static void startKeysSetup() { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - MythControls *mythcontrols = new MythControls(mainStack, "mythcontrols"); + auto *mythcontrols = new MythControls(mainStack, "mythcontrols"); if (mythcontrols->Create()) mainStack->AddScreen(mythcontrols); @@ -394,7 +394,7 @@ static void startFinder(void) static void startSearchTitle(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ProgLister *pl = new ProgLister(mainStack, plTitleSearch, "", ""); + auto *pl = new ProgLister(mainStack, plTitleSearch, "", ""); if (pl->Create()) mainStack->AddScreen(pl); else @@ -404,7 +404,7 @@ static void startSearchTitle(void) static void startSearchKeyword(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ProgLister *pl = new ProgLister(mainStack, plKeywordSearch, "", ""); + auto *pl = new ProgLister(mainStack, plKeywordSearch, "", ""); if (pl->Create()) mainStack->AddScreen(pl); else @@ -414,7 +414,7 @@ static void startSearchKeyword(void) static void startSearchPeople(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ProgLister *pl = new ProgLister(mainStack, plPeopleSearch, "", ""); + auto *pl = new ProgLister(mainStack, plPeopleSearch, "", ""); if (pl->Create()) mainStack->AddScreen(pl); else @@ -424,7 +424,7 @@ static void startSearchPeople(void) static void startSearchPower(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ProgLister *pl = new ProgLister(mainStack, plPowerSearch, "", ""); + auto *pl = new ProgLister(mainStack, plPowerSearch, "", ""); if (pl->Create()) mainStack->AddScreen(pl); else @@ -434,7 +434,7 @@ static void startSearchPower(void) static void startSearchStored(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ProgLister *pl = new ProgLister(mainStack, plStoredSearch, "", ""); + auto *pl = new ProgLister(mainStack, plStoredSearch, "", ""); if (pl->Create()) mainStack->AddScreen(pl); else @@ -444,7 +444,7 @@ static void startSearchStored(void) static void startSearchChannel(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ProgLister *pl = new ProgLister(mainStack, plChannel, "", ""); + auto *pl = new ProgLister(mainStack, plChannel, "", ""); if (pl->Create()) mainStack->AddScreen(pl); else @@ -454,7 +454,7 @@ static void startSearchChannel(void) static void startSearchCategory(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ProgLister *pl = new ProgLister(mainStack, plCategory, "", ""); + auto *pl = new ProgLister(mainStack, plCategory, "", ""); if (pl->Create()) mainStack->AddScreen(pl); else @@ -464,7 +464,7 @@ static void startSearchCategory(void) static void startSearchMovie(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ProgLister *pl = new ProgLister(mainStack, plMovies, "", ""); + auto *pl = new ProgLister(mainStack, plMovies, "", ""); if (pl->Create()) mainStack->AddScreen(pl); else @@ -474,7 +474,7 @@ static void startSearchMovie(void) static void startSearchNew(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ProgLister *pl = new ProgLister(mainStack, plNewListings, "", ""); + auto *pl = new ProgLister(mainStack, plNewListings, "", ""); if (pl->Create()) mainStack->AddScreen(pl); else @@ -484,7 +484,7 @@ static void startSearchNew(void) static void startSearchTime(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ProgLister *pl = new ProgLister(mainStack, plTime, "", ""); + auto *pl = new ProgLister(mainStack, plTime, "", ""); if (pl->Create()) mainStack->AddScreen(pl); else @@ -495,7 +495,7 @@ static void startManaged(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ViewScheduled *viewsched = new ViewScheduled(mainStack); + auto *viewsched = new ViewScheduled(mainStack); if (viewsched->Create()) mainStack->AddScreen(viewsched); @@ -507,8 +507,7 @@ static void startManageRecordingRules(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ProgramRecPriority *progRecPrior = new ProgramRecPriority(mainStack, - "ManageRecRules"); + auto *progRecPrior = new ProgramRecPriority(mainStack, "ManageRecRules"); if (progRecPrior->Create()) mainStack->AddScreen(progRecPrior); @@ -520,7 +519,7 @@ static void startChannelRecPriorities(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ChannelRecPriority *chanRecPrior = new ChannelRecPriority(mainStack); + auto *chanRecPrior = new ChannelRecPriority(mainStack); if (chanRecPrior->Create()) mainStack->AddScreen(chanRecPrior); @@ -532,7 +531,7 @@ static void startCustomPriority(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - CustomPriority *custom = new CustomPriority(mainStack); + auto *custom = new CustomPriority(mainStack); if (custom->Create()) mainStack->AddScreen(custom); @@ -544,8 +543,7 @@ static void startPlaybackWithGroup(const QString& recGroup = "") { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - PlaybackBox *pbb = new PlaybackBox( - mainStack, "playbackbox"); + auto *pbb = new PlaybackBox(mainStack, "playbackbox"); if (pbb->Create()) { @@ -566,7 +564,7 @@ static void startPlayback(void) static void startPrevious(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - PrevRecordedList *pl = new PrevRecordedList(mainStack); + auto *pl = new PrevRecordedList(mainStack); if (pl->Create()) mainStack->AddScreen(pl); else @@ -576,7 +574,7 @@ static void startPrevious(void) static void startPreviousOld(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ProgLister *pl = new ProgLister(mainStack); + auto *pl = new ProgLister(mainStack); if (pl->Create()) mainStack->AddScreen(pl); else @@ -586,7 +584,7 @@ static void startPreviousOld(void) static void startCustomEdit(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - CustomEdit *custom = new CustomEdit(mainStack); + auto *custom = new CustomEdit(mainStack); if (custom->Create()) mainStack->AddScreen(custom); @@ -598,7 +596,7 @@ static void startManualSchedule(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ManualSchedule *mansched= new ManualSchedule(mainStack); + auto *mansched= new ManualSchedule(mainStack); if (mansched->Create()) mainStack->AddScreen(mansched); @@ -652,7 +650,7 @@ static void showStatus(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StatusBox *statusbox = new StatusBox(mainStack); + auto *statusbox = new StatusBox(mainStack); if (statusbox->Create()) mainStack->AddScreen(statusbox); @@ -665,7 +663,7 @@ static void standbyScreen(void) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - IdleScreen *idlescreen = new IdleScreen(mainStack); + auto *idlescreen = new IdleScreen(mainStack); if (idlescreen->Create()) mainStack->AddScreen(idlescreen); @@ -681,8 +679,8 @@ static void RunVideoScreen(VideoDialog::DialogType type, bool fromJump = false) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIBusyDialog *busyPopup = new MythUIBusyDialog(message, - popupStack, "mythvideobusydialog"); + auto *busyPopup = new MythUIBusyDialog(message, popupStack, + "mythvideobusydialog"); if (busyPopup->Create()) popupStack->AddScreen(busyPopup, false); @@ -710,7 +708,7 @@ static void RunVideoScreen(VideoDialog::DialogType type, bool fromJump = false) if (!video_list) video_list = new VideoList; - VideoDialog *mythvideo = + auto *mythvideo = new VideoDialog(mainStack, "mythvideo", video_list, type, browse); if (mythvideo->Create()) @@ -731,7 +729,7 @@ static void jumpScreenVideoDefault() { RunVideoScreen(VideoDialog::DLG_DEFAULT, static void RunGallery() { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - GalleryThumbView *galleryView = new GalleryThumbView(mainStack, "galleryview"); + auto *galleryView = new GalleryThumbView(mainStack, "galleryview"); if (galleryView->Create()) { mainStack->AddScreen(galleryView); @@ -943,9 +941,8 @@ static void TVMenuCallback(void *data, QString &selection) else if (sel == "settings appearance") { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StandardSettingDialog *ssd = - new StandardSettingDialog(mainStack, "videogeneralsettings", - new AppearanceSettings()); + auto *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings", + new AppearanceSettings()); if (ssd->Create()) { @@ -957,7 +954,7 @@ static void TVMenuCallback(void *data, QString &selection) else if (sel == "settings themechooser") { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ThemeChooser *tp = new ThemeChooser(mainStack); + auto *tp = new ThemeChooser(mainStack); if (tp->Create()) mainStack->AddScreen(tp); @@ -967,7 +964,7 @@ static void TVMenuCallback(void *data, QString &selection) else if (sel == "settings setupwizard") { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - GeneralSetupWizard *sw = new GeneralSetupWizard(mainStack, "setupwizard"); + auto *sw = new GeneralSetupWizard(mainStack, "setupwizard"); if (sw->Create()) mainStack->AddScreen(sw); @@ -977,7 +974,7 @@ static void TVMenuCallback(void *data, QString &selection) else if (sel == "settings grabbers") { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - GrabberSettings *gs = new GrabberSettings(mainStack, "grabbersettings"); + auto *gs = new GrabberSettings(mainStack, "grabbersettings"); if (gs->Create()) mainStack->AddScreen(gs); @@ -995,9 +992,8 @@ static void TVMenuCallback(void *data, QString &selection) else if (sel == "settings playgroup") { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StandardSettingDialog *ssd = - new StandardSettingDialog(mainStack, "playbackgroupsetting", - new PlayGroupEditor()); + auto *ssd = new StandardSettingDialog(mainStack, "playbackgroupsetting", + new PlayGroupEditor()); if (ssd->Create()) { @@ -1009,9 +1005,8 @@ static void TVMenuCallback(void *data, QString &selection) else if (sel == "settings general") { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StandardSettingDialog *ssd = - new StandardSettingDialog(mainStack, "videogeneralsettings", - new GeneralSettings()); + auto *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings", + new GeneralSettings()); if (ssd->Create()) { @@ -1037,9 +1032,8 @@ static void TVMenuCallback(void *data, QString &selection) else if (sel == "settings maingeneral") { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StandardSettingDialog *ssd = - new StandardSettingDialog(mainStack, "maingeneralsettings", - new MainGeneralSettings()); + auto *ssd = new StandardSettingDialog(mainStack, "maingeneralsettings", + new MainGeneralSettings()); if (ssd->Create()) { @@ -1064,9 +1058,8 @@ static void TVMenuCallback(void *data, QString &selection) else if (sel == "settings osd") { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StandardSettingDialog *ssd = - new StandardSettingDialog(mainStack, "osdsettings", - new OSDSettings()); + auto *ssd = new StandardSettingDialog(mainStack, "osdsettings", + new OSDSettings()); if (ssd->Create()) { @@ -1078,9 +1071,8 @@ static void TVMenuCallback(void *data, QString &selection) else if (sel == "settings epg") { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StandardSettingDialog *ssd = - new StandardSettingDialog(mainStack, "epgsettings", - new EPGSettings()); + auto *ssd = new StandardSettingDialog(mainStack, "epgsettings", + new EPGSettings()); if (ssd->Create()) { @@ -1092,9 +1084,8 @@ static void TVMenuCallback(void *data, QString &selection) else if (sel == "settings channelgroups") { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StandardSettingDialog *ssd = - new StandardSettingDialog(mainStack, "channelgroupssettings", - new ChannelGroupsSetting()); + auto *ssd = new StandardSettingDialog(mainStack, "channelgroupssettings", + new ChannelGroupsSetting()); if (ssd->Create()) { @@ -1106,10 +1097,9 @@ static void TVMenuCallback(void *data, QString &selection) else if (sel == "settings generalrecpriorities") { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StandardSettingDialog *ssd = - new StandardSettingDialog(mainStack, - "generalrecprioritiessettings", - new GeneralRecPrioritiesSettings()); + auto *ssd = new StandardSettingDialog(mainStack, + "generalrecprioritiessettings", + new GeneralRecPrioritiesSettings()); if (ssd->Create()) { @@ -1130,8 +1120,7 @@ static void TVMenuCallback(void *data, QString &selection) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - MythSystemEventEditor *msee = new MythSystemEventEditor( - mainStack, "System Event Editor"); + auto *msee = new MythSystemEventEditor(mainStack, "System Event Editor"); if (msee->Create()) mainStack->AddScreen(msee); @@ -1147,7 +1136,7 @@ static void TVMenuCallback(void *data, QString &selection) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - PlayerSettings *ps = new PlayerSettings(mainStack, "player settings"); + auto *ps = new PlayerSettings(mainStack, "player settings"); if (ps->Create()) mainStack->AddScreen(ps); @@ -1158,7 +1147,7 @@ static void TVMenuCallback(void *data, QString &selection) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - MetadataSettings *ms = new MetadataSettings(mainStack, "metadata settings"); + auto *ms = new MetadataSettings(mainStack, "metadata settings"); if (ms->Create()) mainStack->AddScreen(ms); @@ -1169,7 +1158,7 @@ static void TVMenuCallback(void *data, QString &selection) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - FileAssocDialog *fa = new FileAssocDialog(mainStack, "fa dialog"); + auto *fa = new FileAssocDialog(mainStack, "fa dialog"); if (fa->Create()) mainStack->AddScreen(fa); @@ -1306,7 +1295,7 @@ static int internal_play_media(const QString &mrl, const QString &plot, return res; } - ProgramInfo *pginfo = new ProgramInfo( + auto *pginfo = new ProgramInfo( mrl, plot, title, QString(), subtitle, QString(), director, season, episode, inetref, lenMins, (year.toUInt()) ? year.toUInt() : 1900, id); @@ -1317,7 +1306,7 @@ static int internal_play_media(const QString &mrl, const QString &plot, if (pginfo->IsVideoDVD()) { - DVDInfo *dvd = new DVDInfo(pginfo->GetPlaybackURL()); + auto *dvd = new DVDInfo(pginfo->GetPlaybackURL()); if (dvd->IsValid()) { QString name; @@ -1370,7 +1359,7 @@ static int internal_play_media(const QString &mrl, const QString &plot, if (useBookmark && bookmarkPresent) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - BookmarkDialog *bookmarkdialog = new BookmarkDialog(pginfo, mainStack); + auto *bookmarkdialog = new BookmarkDialog(pginfo, mainStack); if (!bookmarkdialog->Create()) { delete bookmarkdialog; @@ -1393,7 +1382,7 @@ static int internal_play_media(const QString &mrl, const QString &plot, static void gotoMainMenu(void) { // Reset the selected button to the first item. - MythThemedMenuState *lmenu = dynamic_cast<MythThemedMenuState *> + auto *lmenu = dynamic_cast<MythThemedMenuState *> (GetMythMainWindow()->GetMainStack()->GetTopScreen()); if (lmenu) lmenu->m_buttonList->SetItemCurrent(0); @@ -2191,7 +2180,7 @@ int main(int argc, char **argv) if (gCoreContext->GetBoolSetting("ThemeUpdateNofications", true)) themeUpdateChecker = new ThemeUpdateChecker(); - MythSystemEventHandler *sysEventHandler = new MythSystemEventHandler(); + auto *sysEventHandler = new MythSystemEventHandler(); BackendConnectionManager bcm; @@ -2199,7 +2188,7 @@ int main(int argc, char **argv) PreviewGenerator::kRemote, 50, 60); fe_sd_notify("STATUS=Creating housekeeper"); - HouseKeeper *housekeeping = new HouseKeeper(); + auto *housekeeping = new HouseKeeper(); #ifdef __linux__ #ifdef CONFIG_BINDINGS_PYTHON housekeeping->RegisterTask(new HardwareProfileTask()); diff --git a/mythtv/programs/mythfrontend/manualschedule.cpp b/mythtv/programs/mythfrontend/manualschedule.cpp index e63a485d430..2380e942b70 100644 --- a/mythtv/programs/mythfrontend/manualschedule.cpp +++ b/mythtv/programs/mythfrontend/manualschedule.cpp @@ -71,8 +71,7 @@ bool ManualSchedule::Create(void) { QString chantext = channels[i].GetFormatted(ChannelInfo::kChannelLong); - MythUIButtonListItem *item = - new MythUIButtonListItem(m_channelList, chantext); + auto *item = new MythUIButtonListItem(m_channelList, chantext); InfoMap infomap; channels[i].ToMap(infomap); item->SetTextFromMap(infomap); @@ -217,12 +216,12 @@ void ManualSchedule::recordClicked(void) m_chanids[m_channelList->GetCurrentPos()], m_startDateTime, endts); - RecordingRule *record = new RecordingRule(); + auto *record = new RecordingRule(); record->LoadByProgram(&p); record->m_searchType = kManualSearch; MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ScheduleEditor *schededit = new ScheduleEditor(mainStack, record); + auto *schededit = new ScheduleEditor(mainStack, record); if (schededit->Create()) { mainStack->AddScreen(schededit); diff --git a/mythtv/programs/mythfrontend/mediarenderer.cpp b/mythtv/programs/mythfrontend/mediarenderer.cpp index 2a9639ff7b0..99e5da7ec75 100644 --- a/mythtv/programs/mythfrontend/mediarenderer.cpp +++ b/mythtv/programs/mythfrontend/mediarenderer.cpp @@ -52,7 +52,7 @@ MediaRenderer::MediaRenderer() int nPort = g_pConfig->GetValue( "UPnP/MythFrontend/ServicePort", 6547 ); - HttpServer *pHttpServer = new HttpServer(); + auto *pHttpServer = new HttpServer(); if (!pHttpServer) return; @@ -69,7 +69,7 @@ MediaRenderer::MediaRenderer() // Register any HttpServerExtensions... // ------------------------------------------------------------------ - HtmlServerExtension *pHtmlServer = + auto *pHtmlServer = new HtmlServerExtension(pHttpServer->GetSharePath() + "html", "frontend_"); pHttpServer->RegisterExtension(pHtmlServer); diff --git a/mythtv/programs/mythfrontend/mythcontrols.cpp b/mythtv/programs/mythfrontend/mythcontrols.cpp index 0fde3962ca0..98d821faa28 100644 --- a/mythtv/programs/mythfrontend/mythcontrols.cpp +++ b/mythtv/programs/mythfrontend/mythcontrols.cpp @@ -245,8 +245,7 @@ void MythControls::Close() MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythConfirmationDialog *confirmPopup - = new MythConfirmationDialog(popupStack, label, true); + auto *confirmPopup = new MythConfirmationDialog(popupStack, label, true); if (confirmPopup->Create()) popupStack->AddScreen(confirmPopup); @@ -292,7 +291,7 @@ void MythControls::SetListContents( QStringList::const_iterator it = contents.begin(); for (; it != contents.end(); ++it) { - MythUIButtonListItem *item = new MythUIButtonListItem(uilist, *it); + auto *item = new MythUIButtonListItem(uilist, *it); item->setDrawArrow(arrows); } } @@ -550,8 +549,7 @@ void MythControls::DeleteKey(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythConfirmationDialog *confirmPopup = - new MythConfirmationDialog(popupStack, label, false); + auto *confirmPopup = new MythConfirmationDialog(popupStack, label, false); if (confirmPopup->Create()) { @@ -588,8 +586,7 @@ void MythControls::ResolveConflict(ActionID *conflict, int error_level, MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythConfirmationDialog *confirmPopup = - new MythConfirmationDialog(popupStack, label, !error); + auto *confirmPopup = new MythConfirmationDialog(popupStack, label, !error); if (!error) { @@ -609,7 +606,7 @@ void MythControls::GrabKey(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - KeyGrabPopupBox *keyGrabPopup = new KeyGrabPopupBox(popupStack); + auto *keyGrabPopup = new KeyGrabPopupBox(popupStack); if (keyGrabPopup->Create()) popupStack->AddScreen(keyGrabPopup, false); @@ -666,7 +663,7 @@ void MythControls::customEvent(QEvent *event) { if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); + auto *dce = (DialogCompletionEvent*)(event); QString resultid = dce->GetId(); int buttonnum = dce->GetResult(); diff --git a/mythtv/programs/mythfrontend/mythcontrols.h b/mythtv/programs/mythfrontend/mythcontrols.h index 4b990ff4906..d6e25473981 100644 --- a/mythtv/programs/mythfrontend/mythcontrols.h +++ b/mythtv/programs/mythfrontend/mythcontrols.h @@ -38,7 +38,7 @@ class MythUIButton; class MythUIImage; class MythDialogBox; -typedef enum { kActionsByContext, kKeysByContext, kContextsByKey, } ViewType; +enum ViewType { kActionsByContext, kKeysByContext, kContextsByKey, }; /** * \class MythControls @@ -63,12 +63,12 @@ class MythControls : public MythScreenType bool Create(void) override; // MythScreenType void customEvent(QEvent*) override; // MythUIType - typedef enum + enum ListType { kContextList, kKeyList, kActionList - } ListType; + }; // Gets QString GetCurrentContext(void); diff --git a/mythtv/programs/mythfrontend/mythfexml.h b/mythtv/programs/mythfrontend/mythfexml.h index c31b1adf6dd..d8cfe0c700b 100644 --- a/mythtv/programs/mythfrontend/mythfexml.h +++ b/mythtv/programs/mythfrontend/mythfexml.h @@ -12,14 +12,14 @@ #include "eventing.h" #include "mythcontext.h" -typedef enum +enum MythFEXMLMethod { MFEXML_Unknown = 0, MFEXML_GetServiceDescription, MFEXML_GetScreenShot, MFEXML_ActionListTest, MFEXML_GetRemote, -} MythFEXMLMethod; +}; class MythFEXML : public Eventing { diff --git a/mythtv/programs/mythfrontend/networkcontrol.cpp b/mythtv/programs/mythfrontend/networkcontrol.cpp index fef74ace2cf..c70d826080c 100644 --- a/mythtv/programs/mythfrontend/networkcontrol.cpp +++ b/mythtv/programs/mythfrontend/networkcontrol.cpp @@ -368,7 +368,7 @@ void NetworkControl::newConnection(QTcpSocket *client) gCoreContext->SendSystemEvent("NET_CTRL_CONNECTED"); - NetworkControlClient *ncc = new NetworkControlClient(client); + auto *ncc = new NetworkControlClient(client); QMutexLocker locker(&clientLock); clients.push_back(ncc); @@ -405,7 +405,7 @@ NetworkControlClient::~NetworkControlClient() void NetworkControlClient::readClient(void) { - QTcpSocket *socket = (QTcpSocket *)sender(); + auto *socket = (QTcpSocket *)sender(); if (!socket) return; @@ -435,7 +435,7 @@ void NetworkControl::receiveCommand(QString &command) { LOG(VB_NETWORK, LOG_INFO, LOC + QString("NetworkControl::receiveCommand(%1)").arg(command)); - NetworkControlClient *ncc = static_cast<NetworkControlClient *>(sender()); + auto *ncc = static_cast<NetworkControlClient *>(sender()); if (!ncc) return; @@ -591,7 +591,7 @@ QString NetworkControl::processPlay(NetworkCommand *nc, int clientID) { QStringList args; args << nc->getFrom(2); - MythEvent *me = new MythEvent(ACTION_HANDLEMEDIA, args); + auto *me = new MythEvent(ACTION_HANDLEMEDIA, args); qApp->postEvent(GetMythMainWindow(), me); } else @@ -1179,7 +1179,7 @@ QString NetworkControl::processTheme( NetworkCommand* nc) if (!topScreen) return QString("ERROR: no top screen found!"); - MythUIType *currType = static_cast<MythUIType*>(topScreen); + auto *currType = static_cast<MythUIType*>(topScreen); while (!path.isEmpty()) { @@ -1222,7 +1222,7 @@ QString NetworkControl::processTheme( NetworkCommand* nc) if (!topScreen) return QString("ERROR: no top screen found!"); - MythUIType *currType = static_cast<MythUIType*>(topScreen); + auto *currType = static_cast<MythUIType*>(topScreen); while (path.count() > 1) { @@ -1270,7 +1270,7 @@ QString NetworkControl::processTheme( NetworkCommand* nc) if (!topScreen) return QString("ERROR: no top screen found!"); - MythUIType *currType = static_cast<MythUIType*>(topScreen); + auto *currType = static_cast<MythUIType*>(topScreen); while (path.count() > 1) { @@ -1486,7 +1486,7 @@ QString NetworkControl::processMessage(NetworkCommand *nc) QString message = nc->getCommand().remove(0, 7).trimmed(); MythMainWindow *window = GetMythMainWindow(); - MythEvent* me = new MythEvent(MythEvent::MythUserMessage, message); + auto* me = new MythEvent(MythEvent::MythUserMessage, message); qApp->postEvent(window, me); return QString("OK"); } @@ -1540,7 +1540,7 @@ void NetworkControl::customEvent(QEvent *e) { if (e->type() == MythEvent::MythEventMessage) { - MythEvent *me = static_cast<MythEvent *>(e); + auto *me = static_cast<MythEvent *>(e); const QString& message = me->Message(); if (message.startsWith("MUSIC_CONTROL")) @@ -1613,7 +1613,7 @@ void NetworkControl::customEvent(QEvent *e) } else if (e->type() == NetworkControlCloseEvent::kEventType) { - NetworkControlCloseEvent *ncce = static_cast<NetworkControlCloseEvent*>(e); + auto *ncce = static_cast<NetworkControlCloseEvent*>(e); NetworkControlClient *ncc = ncce->getClient(); deleteClient(ncc); @@ -1797,7 +1797,7 @@ QString NetworkControl::saveScreenshot(NetworkCommand *nc) args << QString::number(width); args << QString::number(height); } - MythEvent* me = new MythEvent(MythEvent::MythEventMessage, + auto *me = new MythEvent(MythEvent::MythEventMessage, ACTION_SCREENSHOT, args); qApp->postEvent(window, me); return "OK"; diff --git a/mythtv/programs/mythfrontend/playbackbox.cpp b/mythtv/programs/mythfrontend/playbackbox.cpp index 18479109ac9..f5fc57acb23 100644 --- a/mythtv/programs/mythfrontend/playbackbox.cpp +++ b/mythtv/programs/mythfrontend/playbackbox.cpp @@ -367,8 +367,7 @@ void * PlaybackBox::RunPlaybackBox(void * player, bool showTV) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - PlaybackBox *pbb = new PlaybackBox( - mainStack,"playbackbox", (TV *)player, showTV); + auto *pbb = new PlaybackBox(mainStack,"playbackbox", (TV *)player, showTV); if (pbb->Create()) mainStack->AddScreen(pbb); @@ -395,7 +394,7 @@ PlaybackBox::PlaybackBox(MythScreenStack *parent, const QString& name, // Other m_helper(this) { - for (size_t i = 0; i < sizeof(m_artImage) / sizeof(MythUIImage*); i++) + for (size_t i = 0; i < kNumArtImages; i++) { m_artImage[i] = nullptr; m_artTimer[i] = new QTimer(this); @@ -473,7 +472,7 @@ PlaybackBox::~PlaybackBox(void) gCoreContext->removeListener(this); PreviewGeneratorQueue::RemoveListener(this); - for (size_t i = 0; i < sizeof(m_artImage) / sizeof(MythUIImage*); i++) + for (size_t i = 0; i < kNumArtImages; i++) { m_artTimer[i]->disconnect(this); m_artTimer[i] = nullptr; @@ -600,8 +599,7 @@ void PlaybackBox::displayRecGroup(const QString &newRecGroup) QString label = tr("Password for group '%1':").arg(newRecGroup); - MythTextInputDialog *pwd = new MythTextInputDialog(popupStack, - label, FilterNone, true); + auto *pwd = new MythTextInputDialog(popupStack, label, FilterNone, true); connect(pwd, SIGNAL(haveResult(QString)), SLOT(checkPassword(QString))); @@ -680,7 +678,7 @@ void PlaybackBox::updateGroupInfo(const QString &groupname, ProgramList group = m_progLists[groupname]; float groupSize = 0.0; - for (ProgramList::iterator it = group.begin(); it != group.end(); ++it) + for (auto it = group.begin(); it != group.end(); ++it) { ProgramInfo *info = *it; if (info) @@ -786,7 +784,7 @@ void PlaybackBox::UpdateUIListItem(MythUIButtonListItem *item, if (!item) return; - ProgramInfo *pginfo = item->GetData().value<ProgramInfo *>(); + auto *pginfo = item->GetData().value<ProgramInfo *>(); if (!pginfo) return; @@ -865,7 +863,7 @@ void PlaybackBox::UpdateUIListItem(MythUIButtonListItem *item, // Handle artwork QString arthost; - for (size_t i = 0; i < sizeof(m_artImage) / sizeof(MythUIImage*); i++) + for (size_t i = 0; i < kNumArtImages; i++) { if (!m_artImage[i]) continue; @@ -898,7 +896,7 @@ void PlaybackBox::UpdateUIListItem(MythUIButtonListItem *item, void PlaybackBox::ItemLoaded(MythUIButtonListItem *item) { - ProgramInfo *pginfo = item->GetData().value<ProgramInfo*>(); + auto *pginfo = item->GetData().value<ProgramInfo*>(); if (item->GetText("is_item_initialized").isNull()) { QMap<AudioProps, QString> audioFlags; @@ -913,7 +911,7 @@ void PlaybackBox::ItemLoaded(MythUIButtonListItem *item) videoFlags[VID_HDTV] = "hdtv"; videoFlags[VID_WIDESCREEN] = "widescreen"; - QMap<SubtitleTypes, QString> subtitleFlags; + QMap<SubtitleType, QString> subtitleFlags; subtitleFlags[SUB_SIGNED] = "deafsigned"; subtitleFlags[SUB_ONSCREEN] = "onscreensub"; subtitleFlags[SUB_NORMAL] = "subtitles"; @@ -962,7 +960,7 @@ void PlaybackBox::ItemLoaded(MythUIButtonListItem *item) item->DisplayState(vit.value(), "videoprops"); } - QMap<SubtitleTypes, QString>::iterator sit; + QMap<SubtitleType, QString>::iterator sit; for (sit = subtitleFlags.begin(); sit != subtitleFlags.end(); ++sit) { if (pginfo->GetSubtitleType() & sit.key()) @@ -979,7 +977,7 @@ void PlaybackBox::ItemLoaded(MythUIButtonListItem *item) void PlaybackBox::ItemVisible(MythUIButtonListItem *item) { - ProgramInfo *pginfo = item->GetData().value<ProgramInfo*>(); + auto *pginfo = item->GetData().value<ProgramInfo*>(); ItemLoaded(item); // Job status (recording, transcoding, flagging) @@ -999,8 +997,7 @@ void PlaybackBox::ItemVisible(MythUIButtonListItem *item) m_preview_tokens.insert(token); // now make sure selected item is still at the top of the queue - ProgramInfo *sel_pginfo = - sel_item->GetData().value<ProgramInfo*>(); + auto *sel_pginfo = sel_item->GetData().value<ProgramInfo*>(); if (sel_pginfo && sel_item->GetImageFilename("preview").isEmpty() && (asAvailable == sel_pginfo->GetAvailableStatus())) { @@ -1262,8 +1259,8 @@ void PlaybackBox::UpdateUsageUI(void) !GetChild("diskspacepercentused") && !GetChild("diskspacepercentfree")) return; - double freeSpaceTotal = (double) m_helper.GetFreeSpaceTotalMB(); - double freeSpaceUsed = (double) m_helper.GetFreeSpaceUsedMB(); + auto freeSpaceTotal = (double) m_helper.GetFreeSpaceTotalMB(); + auto freeSpaceUsed = (double) m_helper.GetFreeSpaceUsedMB(); QLocale locale = gCoreContext->GetQLocale(); InfoMap usageMap; @@ -1325,8 +1322,8 @@ void PlaybackBox::UpdateUIRecGroupList(void) if (m_recGroups.size() == 2 && key == "Default") continue; // All and Default will be the same, so only show All - MythUIButtonListItem *item = new MythUIButtonListItem( - m_recgroupList, name, qVariantFromValue(key)); + auto *item = new MythUIButtonListItem(m_recgroupList, name, + qVariantFromValue(key)); if (idx == m_recGroupIdx) m_recgroupList->SetItemCurrent(item); @@ -1346,9 +1343,8 @@ void PlaybackBox::UpdateUIGroupList(const QStringList &groupPreferences) { QString groupname = (*it); - MythUIButtonListItem *item = - new MythUIButtonListItem( - m_groupList, "", qVariantFromValue(groupname.toLower())); + auto *item = new MythUIButtonListItem(m_groupList, "", + qVariantFromValue(groupname.toLower())); int pref = groupPreferences.indexOf(groupname.toLower()); if ((pref >= 0) && (pref < best_pref)) @@ -1419,7 +1415,7 @@ void PlaybackBox::updateRecList(MythUIButtonListItem *sel_item) ProgramList &progList = *pmit; - ProgramList::iterator it = progList.begin(); + auto it = progList.begin(); for (; it != progList.end(); ++it) { if ((*it)->GetAvailableStatus() == asPendingDelete || @@ -1467,14 +1463,14 @@ static bool save_position( for (int i = curPos; (i >= 0) && (i < recordingList->GetCount()); i++) { MythUIButtonListItem *item = recordingList->GetItemAt(i); - ProgramInfo *pginfo = item->GetData().value<ProgramInfo*>(); + auto *pginfo = item->GetData().value<ProgramInfo*>(); itemSelPref.push_back(groupSelPref.front()); itemSelPref.push_back(QString::number(pginfo->GetRecordingID())); } for (int i = curPos; (i >= 0) && (i < recordingList->GetCount()); i--) { MythUIButtonListItem *item = recordingList->GetItemAt(i); - ProgramInfo *pginfo = item->GetData().value<ProgramInfo*>(); + auto *pginfo = item->GetData().value<ProgramInfo*>(); itemSelPref.push_back(groupSelPref.front()); itemSelPref.push_back(QString::number(pginfo->GetRecordingID())); } @@ -1485,7 +1481,7 @@ static bool save_position( if (i >= 0 && i < recordingList->GetCount()) { MythUIButtonListItem *item = recordingList->GetItemAt(i); - ProgramInfo *pginfo = item->GetData().value<ProgramInfo*>(); + auto *pginfo = item->GetData().value<ProgramInfo*>(); if (i == topPos) { itemTopPref.push_front(QString::number(pginfo->GetRecordingID())); @@ -1531,7 +1527,7 @@ static void restore_position( for (uint j = 0; j < (uint)recordingList->GetCount(); j++) { MythUIButtonListItem *item = recordingList->GetItemAt(j); - ProgramInfo *pginfo = item->GetData().value<ProgramInfo*>(); + auto *pginfo = item->GetData().value<ProgramInfo*>(); if (pginfo && (pginfo->GetRecordingID() == recordingID)) { sel = j; @@ -1552,7 +1548,7 @@ static void restore_position( for (uint j = 0; j < (uint)recordingList->GetCount(); j++) { MythUIButtonListItem *item = recordingList->GetItemAt(j); - ProgramInfo *pginfo = item->GetData().value<ProgramInfo*>(); + auto *pginfo = item->GetData().value<ProgramInfo*>(); if (pginfo && (pginfo->GetRecordingID() == recordingID)) { top = j; @@ -1599,8 +1595,8 @@ bool PlaybackBox::UpdateUILists(void) if (!m_progLists.isEmpty()) { - ProgramList::iterator it = m_progLists[""].begin(); - ProgramList::iterator end = m_progLists[""].end(); + auto it = m_progLists[""].begin(); + auto end = m_progLists[""].end(); for (; it != end; ++it) { uint asRecordingID = (*it)->GetRecordingID(); @@ -1929,7 +1925,7 @@ bool PlaybackBox::UpdateUILists(void) } } - ProgramList::iterator pit = m_progLists[m_watchGroupLabel].begin(); + auto pit = m_progLists[m_watchGroupLabel].begin(); while (pit != m_progLists[m_watchGroupLabel].end()) { int recid = (*pit)->GetRecordingRuleID(); @@ -2209,7 +2205,7 @@ void PlaybackBox::PlayFromBookmarkOrProgStart(MythUIButtonListItem *item) if (!item) return; - ProgramInfo *pginfo = item->GetData().value<ProgramInfo *>(); + auto *pginfo = item->GetData().value<ProgramInfo *>(); const bool ignoreBookmark = false; const bool ignoreProgStart = false; @@ -2228,7 +2224,7 @@ void PlaybackBox::PlayFromBookmark(MythUIButtonListItem *item) if (!item) return; - ProgramInfo *pginfo = item->GetData().value<ProgramInfo *>(); + auto *pginfo = item->GetData().value<ProgramInfo *>(); const bool ignoreBookmark = false; const bool ignoreProgStart = true; @@ -2247,7 +2243,7 @@ void PlaybackBox::PlayFromBeginning(MythUIButtonListItem *item) if (!item) return; - ProgramInfo *pginfo = item->GetData().value<ProgramInfo *>(); + auto *pginfo = item->GetData().value<ProgramInfo *>(); const bool ignoreBookmark = true; const bool ignoreProgStart = true; @@ -2266,7 +2262,7 @@ void PlaybackBox::PlayFromLastPlayPos(MythUIButtonListItem *item) if (!item) return; - ProgramInfo *pginfo = item->GetData().value<ProgramInfo *>(); + auto *pginfo = item->GetData().value<ProgramInfo *>(); const bool ignoreBookmark = true; const bool ignoreProgStart = true; @@ -2321,7 +2317,7 @@ void PlaybackBox::deleteSelected(MythUIButtonListItem *item) if (!item) return; - ProgramInfo *pginfo = item->GetData().value<ProgramInfo *>(); + auto *pginfo = item->GetData().value<ProgramInfo *>(); if (!pginfo) return; @@ -2491,7 +2487,7 @@ bool PlaybackBox::Play( return false; } - for (size_t i = 0; i < sizeof(m_artImage) / sizeof(MythUIImage*); i++) + for (size_t i = 0; i < kNumArtImages; i++) { if (!m_artImage[i]) continue; @@ -2750,7 +2746,7 @@ MythMenu* PlaybackBox::createPlaylistMenu(void) QString label = tr("There is %n item(s) in the playlist. Actions affect " "all items in the playlist", "", m_playList.size()); - MythMenu *menu = new MythMenu(label, this, "slotmenu"); + auto *menu = new MythMenu(label, this, "slotmenu"); menu->AddItem(tr("Play"), SLOT(doPlayList())); menu->AddItem(tr("Shuffle Play"), SLOT(doPlayListRandom())); @@ -2783,7 +2779,7 @@ MythMenu* PlaybackBox::createPlaylistStorageMenu() QString label = tr("There is %n item(s) in the playlist. Actions affect " "all items in the playlist", "", m_playList.size()); - MythMenu *menu = new MythMenu(label, this, "slotmenu"); + auto *menu = new MythMenu(label, this, "slotmenu"); menu->AddItem(tr("Change Recording Group"), SLOT(ShowRecGroupChangerUsePlaylist())); menu->AddItem(tr("Change Playback Group"), SLOT(ShowPlayGroupChangerUsePlaylist())); @@ -2801,7 +2797,7 @@ MythMenu* PlaybackBox::createPlaylistJobMenu(void) QString label = tr("There is %n item(s) in the playlist. Actions affect " "all items in the playlist", "", m_playList.size()); - MythMenu *menu = new MythMenu(label, this, "slotmenu"); + auto *menu = new MythMenu(label, this, "slotmenu"); QString jobTitle; QString command; @@ -2978,7 +2974,7 @@ MythMenu* PlaybackBox::createPlayFromMenu() QString title = tr("Play Options") + CreateProgramInfoString(*pginfo); - MythMenu *menu = new MythMenu(title, this, "slotmenu"); + auto *menu = new MythMenu(title, this, "slotmenu"); if (pginfo->IsBookmarkSet()) menu->AddItem(tr("Play from bookmark"), SLOT(PlayFromBookmark())); @@ -3007,7 +3003,7 @@ MythMenu* PlaybackBox::createStorageMenu() QString preserveText = (pginfo->IsPreserved()) ? tr("Do not preserve this episode") : tr("Preserve this episode"); - MythMenu *menu = new MythMenu(title, this, "slotmenu"); + auto *menu = new MythMenu(title, this, "slotmenu"); menu->AddItem(tr("Change Recording Group"), SLOT(ShowRecGroupChanger())); menu->AddItem(tr("Change Playback Group"), SLOT(ShowPlayGroupChanger())); menu->AddItem(autoExpireText, SLOT(toggleAutoExpire())); @@ -3024,7 +3020,7 @@ MythMenu* PlaybackBox::createRecordingMenu(void) QString title = tr("Scheduling Options") + CreateProgramInfoString(*pginfo); - MythMenu *menu = new MythMenu(title, this, "slotmenu"); + auto *menu = new MythMenu(title, this, "slotmenu"); menu->AddItem(tr("Edit Recording Schedule"), SLOT(EditScheduled())); @@ -3047,7 +3043,7 @@ MythMenu* PlaybackBox::createJobMenu() QString title = tr("Job Options") + CreateProgramInfoString(*pginfo); - MythMenu *menu = new MythMenu(title, this, "slotmenu"); + auto *menu = new MythMenu(title, this, "slotmenu"); QString command; @@ -3125,7 +3121,7 @@ MythMenu* PlaybackBox::createTranscodingProfilesMenu() { QString label = tr("Transcoding profiles"); - MythMenu *menu = new MythMenu(label, this, "transcode"); + auto *menu = new MythMenu(label, this, "transcode"); menu->AddItem(tr("Default"), qVariantFromValue(-1)); menu->AddItem(tr("Autodetect"), qVariantFromValue(0)); @@ -3543,7 +3539,7 @@ void PlaybackBox::Delete(DeleteFlags flags) if (!m_delList.empty()) { - MythEvent *e = new MythEvent("DELETE_FAILURES", m_delList); + auto *e = new MythEvent("DELETE_FAILURES", m_delList); m_delList.clear(); QCoreApplication::postEvent(this, e); } @@ -3601,7 +3597,7 @@ ProgramInfo *PlaybackBox::FindProgramInUILists(uint recordingID, for (uint i = 0; i < 2; i++) { - ProgramList::iterator it = _it[i], end = _end[i]; + auto it = _it[i], end = _end[i]; for (; it != end; ++it) { if ((*it)->GetRecordingID() == recordingID) @@ -3621,7 +3617,7 @@ void PlaybackBox::toggleWatched(void) if (!item) return; - ProgramInfo *pginfo = item->GetData().value<ProgramInfo *>(); + auto *pginfo = item->GetData().value<ProgramInfo *>(); if (!pginfo) return; @@ -3647,7 +3643,7 @@ void PlaybackBox::toggleAutoExpire() if (!item) return; - ProgramInfo *pginfo = item->GetData().value<ProgramInfo *>(); + auto *pginfo = item->GetData().value<ProgramInfo *>(); if (!pginfo) return; @@ -3669,7 +3665,7 @@ void PlaybackBox::togglePreserveEpisode() if (!item) return; - ProgramInfo *pginfo = item->GetData().value<ProgramInfo *>(); + auto *pginfo = item->GetData().value<ProgramInfo *>(); if (!pginfo) return; @@ -3697,8 +3693,8 @@ void PlaybackBox::togglePlayListTitle(void) { QString groupname = m_groupList->GetItemCurrent()->GetData().toString(); - ProgramList::iterator it = m_progLists[groupname].begin(); - ProgramList::iterator end = m_progLists[groupname].end(); + auto it = m_progLists[groupname].begin(); + auto end = m_progLists[groupname].end(); for (; it != end; ++it) { if (*it && ((*it)->GetAvailableStatus() == asAvailable)) @@ -3713,7 +3709,7 @@ void PlaybackBox::togglePlayListItem(void) if (!item) return; - ProgramInfo *pginfo = item->GetData().value<ProgramInfo *>(); + auto *pginfo = item->GetData().value<ProgramInfo *>(); if (!pginfo) return; @@ -3982,7 +3978,7 @@ void PlaybackBox::customEvent(QEvent *event) { if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = dynamic_cast<DialogCompletionEvent*>(event); + auto *dce = dynamic_cast<DialogCompletionEvent*>(event); if (!dce) return; @@ -3994,7 +3990,7 @@ void PlaybackBox::customEvent(QEvent *event) } else if (event->type() == MythEvent::MythEventMessage) { - MythEvent *me = static_cast<MythEvent *>(event); + auto *me = static_cast<MythEvent *>(event); const QString& message = me->Message(); if (message.startsWith("RECORDING_LIST_CHANGE")) @@ -4044,8 +4040,8 @@ void PlaybackBox::customEvent(QEvent *event) Qt::AltModifier | Qt::MetaModifier | Qt::KeypadModifier; - QKeyEvent *keyevent = new QKeyEvent(QEvent::KeyPress, - Qt::Key_LaunchMedia, modifiers); + auto *keyevent = new QKeyEvent(QEvent::KeyPress, + Qt::Key_LaunchMedia, modifiers); QCoreApplication::postEvent((QObject*)(GetMythMainWindow()), keyevent); @@ -4184,10 +4180,8 @@ void PlaybackBox::customEvent(QEvent *event) const uint kMaxUIWaitTime = 10000; // ms QStringList list = me->ExtraDataList(); uint recordingID = list[0].toUInt(); - CheckAvailabilityType cat = - (CheckAvailabilityType) list[1].toInt(); - AvailableStatusType availableStatus = - (AvailableStatusType) list[2].toInt(); + auto cat = (CheckAvailabilityType) list[1].toInt(); + auto availableStatus = (AvailableStatusType) list[2].toInt(); uint64_t fs = list[3].toULongLong(); QTime tm; tm.setHMS(list[4].toUInt(), list[5].toUInt(), @@ -4277,7 +4271,7 @@ void PlaybackBox::customEvent(QEvent *event) } else if ((message == "FOUND_ARTWORK") && (me->ExtraDataCount() >= 5)) { - VideoArtworkType type = (VideoArtworkType) me->ExtraData(2).toInt(); + auto type = (VideoArtworkType) me->ExtraData(2).toInt(); uint recordingID = me->ExtraData(3).toUInt(); const QString& group = me->ExtraData(4); const QString& fn = me->ExtraData(5); @@ -4333,7 +4327,7 @@ void PlaybackBox::HandleRecordingRemoveEvent(uint recordingID) ProgramMap::iterator git = m_progLists.begin(); while (git != m_progLists.end()) { - ProgramList::iterator pit = (*git).begin(); + auto pit = (*git).begin(); while (pit != (*git).end()) { if ((*pit)->GetRecordingID() == recordingID) @@ -4436,7 +4430,7 @@ void PlaybackBox::ScheduleUpdateUIList(void) void PlaybackBox::showIconHelp(void) { - HelpPopup *helpPopup = new HelpPopup(m_popupStack); + auto *helpPopup = new HelpPopup(m_popupStack); if (helpPopup->Create()) m_popupStack->AddScreen(helpPopup); @@ -4446,7 +4440,7 @@ void PlaybackBox::showIconHelp(void) void PlaybackBox::showViewChanger(void) { - ChangeView *viewPopup = new ChangeView(m_popupStack, this, m_viewMask); + auto *viewPopup = new ChangeView(m_popupStack, this, m_viewMask); if (viewPopup->Create()) { @@ -4571,9 +4565,8 @@ void PlaybackBox::showGroupFilter(void) QString label = tr("Change Filter"); - GroupSelector *recGroupPopup = new GroupSelector(m_popupStack, label, - displayNames, groupNames, - m_recGroup); + auto *recGroupPopup = new GroupSelector(m_popupStack, label, displayNames, + groupNames, m_recGroup); if (recGroupPopup->Create()) { @@ -4721,9 +4714,8 @@ void PlaybackBox::ShowRecGroupChanger(bool use_playlist) QString label = tr("Select Recording Group") + CreateProgramInfoString(*pginfo); - GroupSelector *rgChanger = new GroupSelector( - m_popupStack, label, displayNames, groupNames, - pginfo->GetRecordingGroup()); + auto *rgChanger = new GroupSelector(m_popupStack, label, displayNames, + groupNames, pginfo->GetRecordingGroup()); if (rgChanger->Create()) { @@ -4765,9 +4757,8 @@ void PlaybackBox::ShowPlayGroupChanger(bool use_playlist) QString label = tr("Select Playback Group") + CreateProgramInfoString(*pginfo); - GroupSelector *pgChanger = new GroupSelector( - m_popupStack, label,displayNames, groupNames, - pginfo->GetPlaybackGroup()); + auto *pgChanger = new GroupSelector(m_popupStack, label,displayNames, + groupNames, pginfo->GetPlaybackGroup()); if (pgChanger->Create()) { @@ -4819,7 +4810,7 @@ void PlaybackBox::showMetadataEditor() MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - RecMetadataEdit *editMetadata = new RecMetadataEdit(mainStack, pgInfo); + auto *editMetadata = new RecMetadataEdit(mainStack, pgInfo); if (editMetadata->Create()) { @@ -4845,7 +4836,7 @@ void PlaybackBox::saveRecMetadata(const QString &newTitle, if (!item) return; - ProgramInfo *pginfo = item->GetData().value<ProgramInfo *>(); + auto *pginfo = item->GetData().value<ProgramInfo *>(); if (!pginfo) return; @@ -4912,8 +4903,8 @@ void PlaybackBox::setRecGroup(QString newRecGroup) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythTextInputDialog *newgroup = new MythTextInputDialog( - popupStack, tr("New Recording Group")); + auto *newgroup = new MythTextInputDialog(popupStack, + tr("New Recording Group")); connect(newgroup, SIGNAL(haveResult(QString)), SLOT(setRecGroup(QString))); @@ -5017,8 +5008,7 @@ void PlaybackBox::showRecGroupPasswordChanger(void) QString currentPassword = getRecGroupPassword(m_recGroup); - PasswordChange *pwChanger = new PasswordChange(m_popupStack, - currentPassword); + auto *pwChanger = new PasswordChange(m_popupStack, currentPassword); if (pwChanger->Create()) { @@ -5340,7 +5330,7 @@ void RecMetadataEdit::PerformQuery() if (m_busyPopup->Create()) m_popupStack->AddScreen(m_busyPopup); - MetadataLookup *lookup = new MetadataLookup(); + auto *lookup = new MetadataLookup(); lookup->SetStep(kLookupSearch); lookup->SetType(kMetadataRecording); LookupType type = GuessLookupType(m_inetrefEdit->GetText()); @@ -5410,15 +5400,14 @@ void RecMetadataEdit::customEvent(QEvent *levent) m_busyPopup = nullptr; } - MetadataFactoryMultiResult *mfmr = dynamic_cast<MetadataFactoryMultiResult*>(levent); + auto *mfmr = dynamic_cast<MetadataFactoryMultiResult*>(levent); if (!mfmr) return; MetadataLookupList list = mfmr->m_results; - MetadataResultsDialog *resultsdialog = - new MetadataResultsDialog(m_popupStack, list); + auto *resultsdialog = new MetadataResultsDialog(m_popupStack, list); connect(resultsdialog, SIGNAL(haveResult(RefCountHandler<MetadataLookup>)), SLOT(OnSearchListSelection(RefCountHandler<MetadataLookup>)), @@ -5435,7 +5424,7 @@ void RecMetadataEdit::customEvent(QEvent *levent) m_busyPopup = nullptr; } - MetadataFactorySingleResult *mfsr = dynamic_cast<MetadataFactorySingleResult*>(levent); + auto *mfsr = dynamic_cast<MetadataFactorySingleResult*>(levent); if (!mfsr || !mfsr->m_result) return; @@ -5450,7 +5439,7 @@ void RecMetadataEdit::customEvent(QEvent *levent) m_busyPopup = nullptr; } - MetadataFactoryNoResult *mfnr = dynamic_cast<MetadataFactoryNoResult*>(levent); + auto *mfnr = dynamic_cast<MetadataFactoryNoResult*>(levent); if (!mfnr) return; @@ -5459,8 +5448,7 @@ void RecMetadataEdit::customEvent(QEvent *levent) "try entering a TVDB/TMDB number, season, and " "episode manually."); - MythConfirmationDialog *okPopup = - new MythConfirmationDialog(m_popupStack, title, false); + auto *okPopup = new MythConfirmationDialog(m_popupStack, title, false); if (okPopup->Create()) m_popupStack->AddScreen(okPopup); @@ -5518,7 +5506,7 @@ bool HelpPopup::Create() void HelpPopup::addItem(const QString &state, const QString &text) { - MythUIButtonListItem *item = new MythUIButtonListItem(m_iconList, text); + auto *item = new MythUIButtonListItem(m_iconList, text); item->DisplayState(state, "icons"); } diff --git a/mythtv/programs/mythfrontend/playbackbox.h b/mythtv/programs/mythfrontend/playbackbox.h index 1db44a0c6f2..b34beee60fb 100644 --- a/mythtv/programs/mythfrontend/playbackbox.h +++ b/mythtv/programs/mythfrontend/playbackbox.h @@ -46,8 +46,8 @@ class MythDialogBox; class MythMenu; class MythUIBusyDialog; -typedef QMap<QString,ProgramList> ProgramMap; -typedef QMap<QString,QString> Str2StrMap; +using ProgramMap = QMap<QString,ProgramList>; +using Str2StrMap = QMap<QString,QString>; enum { kArtworkFanTimeout = 300, @@ -62,7 +62,7 @@ class PlaybackBox : public ScheduleCommon public: // ViewType values cannot change; they are stored in the database. - typedef enum { + enum ViewType { TitlesOnly = 0, TitlesCategories = 1, TitlesCategoriesRecGroups = 2, @@ -71,16 +71,16 @@ class PlaybackBox : public ScheduleCommon CategoriesRecGroups = 5, RecGroups = 6, ViewTypes, // placeholder value, not in database - } ViewType; + }; // Sort function when TitlesOnly. Values are stored in database. - typedef enum { + enum ViewTitleSort { TitleSortAlphabetical = 0, TitleSortRecPriority = 1, TitleSortMethods, // placeholder value, not in database - } ViewTitleSort; + }; - typedef enum { + enum ViewMask { VIEW_NONE = 0x0000, VIEW_TITLES = 0x0001, VIEW_CATEGORIES = 0x0002, @@ -90,30 +90,30 @@ class PlaybackBox : public ScheduleCommon VIEW_LIVETVGRP = 0x0020, // insert new entries above here VIEW_WATCHED = 0x8000 - } ViewMask; + }; - typedef enum + enum DeletePopupType { kDeleteRecording, kStopRecording, kForceDeleteRecording, - } DeletePopupType; + }; - typedef enum + enum DeleteFlags { kNoFlags = 0x00, kForgetHistory = 0x01, kForce = 0x02, kIgnore = 0x04, kAllRemaining = 0x08, - } DeleteFlags; + }; - typedef enum + enum killStateType { kNvpToPlay, kNvpToStop, kDone - } killStateType; + }; PlaybackBox(MythScreenStack *parent, const QString& name, TV *player = nullptr, bool showTV = false); @@ -348,8 +348,9 @@ class PlaybackBox : public ScheduleCommon MythUIImage *m_previewImage {nullptr}; QString m_artHostOverride; - MythUIImage *m_artImage[3]; - QTimer *m_artTimer[3]; + constexpr static int kNumArtImages = 3; + MythUIImage *m_artImage[kNumArtImages]; + QTimer *m_artTimer[kNumArtImages]; InfoMap m_currentMap; @@ -391,7 +392,7 @@ class PlaybackBox : public ScheduleCommon bool m_doToggleMenu {true}; // Recording Group popup support - typedef QPair<QString, QString> RecGroup; + using RecGroup = QPair<QString, QString>; QMap<QString,QString> m_recGroupType; QMap<QString,QString> m_recGroupPwCache; @@ -464,7 +465,7 @@ class PlaybackBox : public ScheduleCommon void Update(); QDateTime m_lastUpdated; // Maps <chanid, recstartts> to a set of JobQueueEntry values. - typedef QMultiMap<QPair<uint, QDateTime>, JobQueueEntry> MapType; + using MapType = QMultiMap<QPair<uint, QDateTime>, JobQueueEntry>; MapType m_jobs; } m_jobQueue; }; diff --git a/mythtv/programs/mythfrontend/playbackboxhelper.cpp b/mythtv/programs/mythfrontend/playbackboxhelper.cpp index ab5a0034536..22aa088c7e5 100644 --- a/mythtv/programs/mythfrontend/playbackboxhelper.cpp +++ b/mythtv/programs/mythfrontend/playbackboxhelper.cpp @@ -112,7 +112,7 @@ AvailableStatusType PBHEventHandler::CheckAvailability(const QStringList &slist) QStringList list; list.push_back(QString::number(evinfo.GetRecordingID())); list.push_back(evinfo.GetPathname()); - MythEvent *e0 = new MythEvent("SET_PLAYBACK_URL", list); + auto *e0 = new MythEvent("SET_PLAYBACK_URL", list); QCoreApplication::postEvent(m_pbh.m_listener, e0); list.clear(); @@ -131,7 +131,7 @@ AvailableStatusType PBHEventHandler::CheckAvailability(const QStringList &slist) if (*cit == kCheckForCache && cats.size() > 1) continue; list[1] = QString::number((int)*cit); - MythEvent *e = new MythEvent("AVAILABILITY", list); + auto *e = new MythEvent("AVAILABILITY", list); QCoreApplication::postEvent(m_pbh.m_listener, e); } @@ -142,7 +142,7 @@ bool PBHEventHandler::event(QEvent *e) { if (e->type() == QEvent::Timer) { - QTimerEvent *te = (QTimerEvent*)e; + auto *te = (QTimerEvent*)e; const int timer_id = te->timerId(); if (timer_id == m_freeSpaceTimerId) UpdateFreeSpaceEvent(); @@ -164,7 +164,7 @@ bool PBHEventHandler::event(QEvent *e) } if (e->type() == MythEvent::MythEventMessage) { - MythEvent *me = static_cast<MythEvent*>(e); + auto *me = static_cast<MythEvent*>(e); if (me->Message() == "UPDATE_FREE_SPACE") { UpdateFreeSpaceEvent(); @@ -200,12 +200,12 @@ bool PBHEventHandler::event(QEvent *e) } if (!successes.empty()) { - MythEvent *oe = new MythEvent("DELETE_SUCCESSES", successes); + auto *oe = new MythEvent("DELETE_SUCCESSES", successes); QCoreApplication::postEvent(m_pbh.m_listener, oe); } if (!failures.empty()) { - MythEvent *oe = new MythEvent("DELETE_FAILURES", failures); + auto *oe = new MythEvent("DELETE_FAILURES", failures); QCoreApplication::postEvent(m_pbh.m_listener, oe); } @@ -229,12 +229,12 @@ bool PBHEventHandler::event(QEvent *e) } if (!successes.empty()) { - MythEvent *oe = new MythEvent("UNDELETE_SUCCESSES", successes); + auto *oe = new MythEvent("UNDELETE_SUCCESSES", successes); QCoreApplication::postEvent(m_pbh.m_listener, oe); } if (!failures.empty()) { - MythEvent *oe = new MythEvent("UNDELETE_FAILURES", failures); + auto *oe = new MythEvent("UNDELETE_FAILURES", failures); QCoreApplication::postEvent(m_pbh.m_listener, oe); } @@ -278,7 +278,7 @@ bool PBHEventHandler::event(QEvent *e) { const QString& inetref = me->ExtraData(0); uint season = me->ExtraData(1).toUInt(); - const VideoArtworkType type = (VideoArtworkType)me->ExtraData(2).toInt(); + const auto type = (VideoArtworkType)me->ExtraData(2).toInt(); #if 0 /* const ref for an unused variable doesn't make much sense either */ uint recordingID = me->ExtraData(3).toUInt(); const QString &group = me->ExtraData(4); @@ -303,7 +303,7 @@ bool PBHEventHandler::event(QEvent *e) { QStringList list = me->ExtraDataList(); list.push_back(foundFile); - MythEvent *oe = new MythEvent("FOUND_ARTWORK", list); + auto *oe = new MythEvent("FOUND_ARTWORK", list); QCoreApplication::postEvent(m_pbh.m_listener, oe); } @@ -354,7 +354,7 @@ void PlaybackBoxHelper::StopRecording(const ProgramInfo &pginfo) { QStringList list; pginfo.ToStringList(list); - MythEvent *e = new MythEvent("STOP_RECORDING", list); + auto *e = new MythEvent("STOP_RECORDING", list); QCoreApplication::postEvent(m_eventHandler, e); } @@ -370,7 +370,7 @@ void PlaybackBoxHelper::DeleteRecording( uint recordingID, bool forceDelete, void PlaybackBoxHelper::DeleteRecordings(const QStringList &list) { - MythEvent *e = new MythEvent("DELETE_RECORDINGS", list); + auto *e = new MythEvent("DELETE_RECORDINGS", list); QCoreApplication::postEvent(m_eventHandler, e); } @@ -378,7 +378,7 @@ void PlaybackBoxHelper::UndeleteRecording(uint recordingID) { QStringList list; list.push_back(QString::number(recordingID)); - MythEvent *e = new MythEvent("UNDELETE_RECORDINGS", list); + auto *e = new MythEvent("UNDELETE_RECORDINGS", list); QCoreApplication::postEvent(m_eventHandler, e); } @@ -395,7 +395,7 @@ void PlaybackBoxHelper::UpdateFreeSpace(void) m_freeSpaceUsedMB = (uint64_t) (fsInfos[i].getUsedSpace() >> 10); } } - MythEvent *e = new MythEvent("UPDATE_USAGE_UI"); + auto *e = new MythEvent("UPDATE_USAGE_UI"); QCoreApplication::postEvent(m_listener, e); } @@ -429,7 +429,7 @@ void PlaybackBoxHelper::CheckAvailability( { (*it).push_back(catstr); } - MythEvent *e = new MythEvent("CHECK_AVAILABILITY", QStringList(catstr)); + auto *e = new MythEvent("CHECK_AVAILABILITY", QStringList(catstr)); QCoreApplication::postEvent(m_eventHandler, e); } @@ -455,7 +455,7 @@ QString PlaybackBoxHelper::LocateArtwork( list.push_back(QString::number(type)); list.push_back((pginfo)?QString::number(pginfo->GetRecordingID()):""); list.push_back(groupname); - MythEvent *e = new MythEvent("LOCATE_ARTWORK", list); + auto *e = new MythEvent("LOCATE_ARTWORK", list); QCoreApplication::postEvent(m_eventHandler, e); return QString(); @@ -476,7 +476,7 @@ QString PlaybackBoxHelper::GetPreviewImage( QStringList extra(token); extra.push_back(check_availability?"1":"0"); pginfo.ToStringList(extra); - MythEvent *e = new MythEvent("GET_PREVIEW", extra); + auto *e = new MythEvent("GET_PREVIEW", extra); QCoreApplication::postEvent(m_eventHandler, e); return token; diff --git a/mythtv/programs/mythfrontend/playbackboxhelper.h b/mythtv/programs/mythfrontend/playbackboxhelper.h index 1336a19d635..cd678576805 100644 --- a/mythtv/programs/mythfrontend/playbackboxhelper.h +++ b/mythtv/programs/mythfrontend/playbackboxhelper.h @@ -19,12 +19,12 @@ class QStringList; class QObject; class QTimer; -typedef enum CheckAvailabilityType { +enum CheckAvailabilityType { kCheckForCache, kCheckForMenuAction, kCheckForPlayAction, kCheckForPlaylistAction, -} CheckAvailabilityType; +}; class PlaybackBoxHelper : public MThread { diff --git a/mythtv/programs/mythfrontend/prevreclist.cpp b/mythtv/programs/mythfrontend/prevreclist.cpp index 175228a2383..60cba78ee0a 100644 --- a/mythtv/programs/mythfrontend/prevreclist.cpp +++ b/mythtv/programs/mythfrontend/prevreclist.cpp @@ -164,8 +164,7 @@ void PrevRecordedList::Load(void) else LoadDates(); } - ScreenLoadCompletionEvent *slce = - new ScreenLoadCompletionEvent(objectName()); + auto *slce = new ScreenLoadCompletionEvent(objectName()); QCoreApplication::postEvent(this, slce); } @@ -221,7 +220,7 @@ bool PrevRecordedList::LoadTitles(void) while (query.next()) { QString title(query.value(0).toString()); - ProgramInfo *program = new ProgramInfo(); + auto *program = new ProgramInfo(); program->SetTitle(title); m_titleData.push_back(program); } @@ -259,7 +258,7 @@ bool PrevRecordedList::LoadDates(void) // Create "Last two weeks" entry // It is identified by bogus date of 0000/00 - ProgramInfo *program = new ProgramInfo(); + auto *program = new ProgramInfo(); program->SetRecordingStartTime(QDateTime::currentDateTime()); program->SetTitle(tr("Last two weeks"), "0000/00"); m_titleData.push_back(program); @@ -305,8 +304,8 @@ void PrevRecordedList::UpdateList(MythUIButtonList *bnList, bnList->Reset(); for (size_t i = 0; i < progData->size(); ++i) { - MythUIButtonListItem *item = - new MythUIButtonListItem(bnList, "", QVariant::fromValue((*progData)[i])); + auto *item = new MythUIButtonListItem(bnList, "", + QVariant::fromValue((*progData)[i])); InfoMap infoMap; (*progData)[i]->ToMap(infoMap,true); QString state; @@ -532,12 +531,12 @@ bool PrevRecordedList::keyPressEvent(QKeyEvent *e) void PrevRecordedList::ShowMenu(void) { - MythMenu *sortMenu = new MythMenu(tr("Sort Options"), this, "sortmenu"); + auto *sortMenu = new MythMenu(tr("Sort Options"), this, "sortmenu"); sortMenu->AddItem(tr("Reverse Sort Order")); sortMenu->AddItem(tr("Sort By Title")); sortMenu->AddItem(tr("Sort By Time")); - MythMenu *menu = new MythMenu(tr("List Options"), this, "menu"); + auto *menu = new MythMenu(tr("List Options"), this, "menu"); menu->AddItem(tr("Sort"), nullptr, sortMenu); @@ -552,7 +551,7 @@ void PrevRecordedList::ShowMenu(void) } menu->AddItem(tr("Program Guide"), SLOT(ShowGuide())); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(menu, popupStack, "menuPopup"); + auto *menuPopup = new MythDialogBox(menu, popupStack, "menuPopup"); if (!menuPopup->Create()) { @@ -565,7 +564,7 @@ void PrevRecordedList::ShowMenu(void) void PrevRecordedList::ShowItemMenu(void) { - MythMenu *menu = new MythMenu(tr("Recording Options"), this, "menu"); + auto *menu = new MythMenu(tr("Recording Options"), this, "menu"); ProgramInfo *pi = GetCurrentProgram(); if (pi) @@ -580,7 +579,7 @@ void PrevRecordedList::ShowItemMenu(void) SLOT(ShowDeleteOldSeriesMenu())); } MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(menu, popupStack, "menuPopup"); + auto *menuPopup = new MythDialogBox(menu, popupStack, "menuPopup"); if (!menuPopup->Create()) { @@ -597,7 +596,7 @@ void PrevRecordedList::customEvent(QEvent *event) if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); + auto *dce = (DialogCompletionEvent*)(event); QString resultid = dce->GetId(); QString resulttext = dce->GetResultText(); @@ -625,8 +624,7 @@ void PrevRecordedList::customEvent(QEvent *event) } else if (resultid == "deleterule") { - RecordingRule *record = - dce->GetData().value<RecordingRule *>(); + auto *record = dce->GetData().value<RecordingRule *>(); if (record && buttonnum > 0 && !record->Delete()) { LOG(VB_GENERAL, LOG_ERR, LOC + @@ -641,7 +639,7 @@ void PrevRecordedList::customEvent(QEvent *event) } else if (event->type() == ScreenLoadCompletionEvent::kEventType) { - ScreenLoadCompletionEvent *slce = (ScreenLoadCompletionEvent*)(event); + auto *slce = (ScreenLoadCompletionEvent*)(event); QString id = slce->GetId(); if (id == objectName()) @@ -740,8 +738,7 @@ void PrevRecordedList::DeleteOldEpisode(bool ok) ScheduledRecording::RescheduleCheck(*pi, "DeleteOldEpisode"); // Delete the current item from both m_showData and m_showList. - ProgramList::iterator it = - m_showData.begin() + m_showList->GetCurrentPos(); + auto it = m_showData.begin() + m_showList->GetCurrentPos(); m_showData.erase(it); MythUIButtonListItem *item = m_showList->GetItemCurrent(); m_showList->RemoveItem(item); @@ -781,7 +778,7 @@ void PrevRecordedList::DeleteOldSeries(bool ok) // Delete the matching items from both m_showData and m_showList. int pos = 0; - ProgramList::iterator it = m_showData.begin(); + auto it = m_showData.begin(); while (pos < (int)m_showData.size()) { if ((*it)->GetTitle() == title) diff --git a/mythtv/programs/mythfrontend/progfind.cpp b/mythtv/programs/mythfrontend/progfind.cpp index 96f597c972a..f6bfab773a3 100644 --- a/mythtv/programs/mythfrontend/progfind.cpp +++ b/mythtv/programs/mythfrontend/progfind.cpp @@ -214,7 +214,7 @@ void ProgFinder::ShowMenu(void) QString label = tr("Options"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(label, popupStack, "menuPopup"); + auto *menuPopup = new MythDialogBox(label, popupStack, "menuPopup"); if (menuPopup->Create()) { @@ -246,7 +246,7 @@ void ProgFinder::customEvent(QEvent *event) { if (event->type() == MythEvent::MythEventMessage) { - MythEvent *me = static_cast<MythEvent *>(event); + auto *me = static_cast<MythEvent *>(event); const QString& message = me->Message(); if (message == "SCHEDULE_CHANGE") @@ -262,7 +262,7 @@ void ProgFinder::customEvent(QEvent *event) } else if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); + auto *dce = (DialogCompletionEvent*)(event); QString resultid = dce->GetId(); QString resulttext = dce->GetResultText(); @@ -280,8 +280,7 @@ void ProgFinder::customEvent(QEvent *event) else if (resulttext == tr("Edit Search")) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - SearchInputDialog *textInput = - new SearchInputDialog(popupStack, m_searchStr); + auto *textInput = new SearchInputDialog(popupStack, m_searchStr); if (textInput->Create()) { @@ -441,8 +440,7 @@ void ProgFinder::updateTimesList() itemText = MythDate::toString(starttime, MythDate::kDateTimeFull | MythDate::kSimplify); - MythUIButtonListItem *item = - new MythUIButtonListItem(m_timesList, ""); + auto *item = new MythUIButtonListItem(m_timesList, ""); QString state = RecStatus::toUIState(m_showData[i]->GetRecordingStatus()); item->SetText(itemText, "buttontext", state); @@ -1098,8 +1096,7 @@ void SearchInputDialog::editChanged(void) if (m_retObject) { //FIXME: add a new event type for this? - DialogCompletionEvent *dce = - new DialogCompletionEvent(m_id, 0, inputString, ""); + auto *dce = new DialogCompletionEvent(m_id, 0, inputString, ""); QCoreApplication::postEvent(m_retObject, dce); } } diff --git a/mythtv/programs/mythfrontend/progfind.h b/mythtv/programs/mythfrontend/progfind.h index cc6f7e08db7..f867c925a4b 100644 --- a/mythtv/programs/mythfrontend/progfind.h +++ b/mythtv/programs/mythfrontend/progfind.h @@ -48,7 +48,7 @@ class ProgFinder : public ScheduleCommon void updateInfo(void); protected: - typedef QMap<QString,QString> ShowName; + using ShowName = QMap<QString,QString>; void Init(void) override; // MythScreenType diff --git a/mythtv/programs/mythfrontend/proginfolist.cpp b/mythtv/programs/mythfrontend/proginfolist.cpp index 7fbf236f05c..e4def035acd 100644 --- a/mythtv/programs/mythfrontend/proginfolist.cpp +++ b/mythtv/programs/mythfrontend/proginfolist.cpp @@ -76,7 +76,7 @@ void ProgInfoList::CreateButton(const QString& name, const QString& value) if (value.isEmpty()) return; - MythUIButtonListItem *item = new MythUIButtonListItem(m_btnList, ""); + auto *item = new MythUIButtonListItem(m_btnList, ""); InfoMap infoMap; infoMap.insert("name", name); diff --git a/mythtv/programs/mythfrontend/proglist.cpp b/mythtv/programs/mythfrontend/proglist.cpp index 1c785cdefbb..95eab344834 100644 --- a/mythtv/programs/mythfrontend/proglist.cpp +++ b/mythtv/programs/mythfrontend/proglist.cpp @@ -171,8 +171,7 @@ void ProgLister::Load(void) FillItemList(false, false); - ScreenLoadCompletionEvent *slce = - new ScreenLoadCompletionEvent(objectName()); + auto *slce = new ScreenLoadCompletionEvent(objectName()); QCoreApplication::postEvent(this, slce); } @@ -266,12 +265,12 @@ bool ProgLister::keyPressEvent(QKeyEvent *e) void ProgLister::ShowMenu(void) { - MythMenu *sortMenu = new MythMenu(tr("Sort Options"), this, "sortmenu"); + auto *sortMenu = new MythMenu(tr("Sort Options"), this, "sortmenu"); sortMenu->AddItem(tr("Reverse Sort Order")); sortMenu->AddItem(tr("Sort By Title")); sortMenu->AddItem(tr("Sort By Time")); - MythMenu *menu = new MythMenu(tr("Options"), this, "menu"); + auto *menu = new MythMenu(tr("Options"), this, "menu"); if (m_allowViewDialog && m_type != plPreviouslyRecorded) { @@ -307,7 +306,7 @@ void ProgLister::ShowMenu(void) } MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(menu, popupStack, "menuPopup"); + auto *menuPopup = new MythDialogBox(menu, popupStack, "menuPopup"); if (!menuPopup->Create()) { @@ -594,7 +593,7 @@ void ProgLister::ShowDeleteRuleMenu(void) if (!pi || !pi->GetRecordingRuleID()) return; - RecordingRule *record = new RecordingRule(); + auto *record = new RecordingRule(); if (!record->LoadByProgram(pi)) { delete record; @@ -606,7 +605,7 @@ void ProgLister::ShowDeleteRuleMenu(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythConfirmationDialog *okPopup = new MythConfirmationDialog( + auto *okPopup = new MythConfirmationDialog( popupStack, message, true); okPopup->SetReturnEvent(this, "deleterule"); @@ -701,7 +700,7 @@ void ProgLister::ShowOldRecordedMenu(void) QString title = tr("Previously Recorded"); - MythMenu *menu = new MythMenu(title, message, this, "deletemenu"); + auto *menu = new MythMenu(title, message, this, "deletemenu"); if (pi->IsDuplicate()) menu->AddItem(tr("Allow this episode to re-record")); else @@ -711,7 +710,7 @@ void ProgLister::ShowOldRecordedMenu(void) menu->AddItem(tr("Cancel")); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - MythDialogBox *menuPopup = new MythDialogBox(menu, mainStack, "deletepopup", true); + auto *menuPopup = new MythDialogBox(menu, mainStack, "deletepopup", true); if (menuPopup->Create()) mainStack->AddScreen(menuPopup); @@ -1361,7 +1360,7 @@ void ProgLister::FillItemList(bool restorePosition, bool updateDisp) { // Prune to one per title QString curtitle; - ProgramList::iterator it = m_itemList.begin(); + auto it = m_itemList.begin(); while (it != m_itemList.end()) { if ((*it)->GetSortTitle() != curtitle) @@ -1492,7 +1491,7 @@ void ProgLister::RestoreSelection(const ProgramInfo *selected, void ProgLister::HandleVisible(MythUIButtonListItem *item) { - ProgramInfo *pginfo = item->GetData().value<ProgramInfo*>(); + auto *pginfo = item->GetData().value<ProgramInfo*>(); if (item->GetText("is_item_initialized").isNull()) { @@ -1548,7 +1547,7 @@ void ProgLister::HandleSelected(MythUIButtonListItem *item) return; } - ProgramInfo *pginfo = item->GetData().value<ProgramInfo*> (); + auto *pginfo = item->GetData().value<ProgramInfo*> (); if (!pginfo) { ClearCurrentProgramInfo(); @@ -1584,7 +1583,7 @@ void ProgLister::customEvent(QEvent *event) if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); + auto *dce = (DialogCompletionEvent*)(event); QString resultid = dce->GetId(); QString resulttext = dce->GetResultText(); @@ -1638,8 +1637,7 @@ void ProgLister::customEvent(QEvent *event) } else if (resultid == "deleterule") { - RecordingRule *record = - dce->GetData().value<RecordingRule *>(); + auto *record = dce->GetData().value<RecordingRule *>(); if (record && buttonnum > 0 && !record->Delete()) { LOG(VB_GENERAL, LOG_ERR, LOC + @@ -1654,7 +1652,7 @@ void ProgLister::customEvent(QEvent *event) } else if (event->type() == ScreenLoadCompletionEvent::kEventType) { - ScreenLoadCompletionEvent *slce = (ScreenLoadCompletionEvent*)(event); + auto *slce = (ScreenLoadCompletionEvent*)(event); QString id = slce->GetId(); if (id == objectName()) @@ -1668,7 +1666,7 @@ void ProgLister::customEvent(QEvent *event) } else if (event->type() == MythEvent::MythEventMessage) { - MythEvent *me = static_cast<MythEvent *>(event); + auto *me = static_cast<MythEvent *>(event); const QString& message = me->Message(); if (m_allowViewDialog && message == "CHOOSE_VIEW") diff --git a/mythtv/programs/mythfrontend/proglist.h b/mythtv/programs/mythfrontend/proglist.h index c181fe8140a..d06f8e47e5f 100644 --- a/mythtv/programs/mythfrontend/proglist.h +++ b/mythtv/programs/mythfrontend/proglist.h @@ -83,7 +83,7 @@ class ProgLister : public ScheduleCommon void SwitchToPreviousView(void); void SwitchToNextView(void); - typedef enum { kTimeSort, kPrevTitleSort, kTitleSort, } SortBy; + enum SortBy { kTimeSort, kPrevTitleSort, kTitleSort, }; SortBy GetSortBy(void) const; void SortList(SortBy sortby, bool reverseSort); diff --git a/mythtv/programs/mythfrontend/proglist_helpers.cpp b/mythtv/programs/mythfrontend/proglist_helpers.cpp index f2d01bd64c7..ff00b4954a8 100644 --- a/mythtv/programs/mythfrontend/proglist_helpers.cpp +++ b/mythtv/programs/mythfrontend/proglist_helpers.cpp @@ -189,12 +189,12 @@ void PhrasePopup::recordClicked(void) MSqlEscapeAsAQuery(what, bindings); } - RecordingRule *record = new RecordingRule(); + auto *record = new RecordingRule(); record->LoadBySearch(m_searchType, text, what, fromgenre); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ScheduleEditor *schededit = new ScheduleEditor(mainStack, record); + auto *schededit = new ScheduleEditor(mainStack, record); if (schededit->Create()) { mainStack->AddScreen(schededit); @@ -290,8 +290,7 @@ void PowerSearchPopup::editClicked(void) if (m_phraseList->GetCurrentPos() != 0) currentItem = m_phraseList->GetValue(); - EditPowerSearchPopup *popup = new EditPowerSearchPopup( - popupStack, m_parent, currentItem); + auto *popup = new EditPowerSearchPopup(popupStack, m_parent, currentItem); if (!popup->Create()) { @@ -371,12 +370,12 @@ void PowerSearchPopup::recordClicked(void) MSqlEscapeAsAQuery(what, bindings); } - RecordingRule *record = new RecordingRule(); + auto *record = new RecordingRule(); record->LoadBySearch(m_searchType, text, what, fromgenre); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ScheduleEditor *schededit = new ScheduleEditor(mainStack, record); + auto *schededit = new ScheduleEditor(mainStack, record); if (schededit->Create()) { mainStack->AddScreen(schededit); @@ -531,8 +530,8 @@ void EditPowerSearchPopup::initLists(void) m_parent->m_viewList << QString::number(channels[i].m_chanid); m_parent->m_viewTextList << chantext; - MythUIButtonListItem *item = - new MythUIButtonListItem(m_channelList, chantext, nullptr, false); + auto *item = new MythUIButtonListItem(m_channelList, chantext, + nullptr, false); InfoMap chanmap; channels[i].ToMap(chanmap); diff --git a/mythtv/programs/mythfrontend/programinfocache.cpp b/mythtv/programs/mythfrontend/programinfocache.cpp index bb62d113e5b..a7f88a315b7 100644 --- a/mythtv/programs/mythfrontend/programinfocache.cpp +++ b/mythtv/programs/mythfrontend/programinfocache.cpp @@ -16,12 +16,12 @@ #include <algorithm> -typedef vector<ProgramInfo*> *VPI_ptr; +using VPI_ptr = vector<ProgramInfo *> *; static void free_vec(VPI_ptr &v) { if (v) { - vector<ProgramInfo*>::iterator it = v->begin(); + auto it = v->begin(); for (; it != v->end(); ++it) delete *it; delete v; @@ -120,7 +120,7 @@ void ProgramInfoCache::Refresh(void) if (m_next_cache) { Clear(); - vector<ProgramInfo*>::iterator it = m_next_cache->begin(); + auto it = m_next_cache->begin(); for (; it != m_next_cache->end(); ++it) { if (!(*it)->GetChanID()) diff --git a/mythtv/programs/mythfrontend/programinfocache.h b/mythtv/programs/mythfrontend/programinfocache.h index a5f5373a745..494b96d9643 100644 --- a/mythtv/programs/mythfrontend/programinfocache.h +++ b/mythtv/programs/mythfrontend/programinfocache.h @@ -52,7 +52,7 @@ class ProgramInfoCache // We could store a hash, but sort the vector in GetOrdered which might // be a suitable compromise, fractionally slower initial load but faster // scrolling and updates - typedef QHash<uint,ProgramInfo*> Cache; + using Cache = QHash<uint,ProgramInfo*>; mutable QMutex m_lock; Cache m_cache; diff --git a/mythtv/programs/mythfrontend/programrecpriority.cpp b/mythtv/programs/mythfrontend/programrecpriority.cpp index a55876d7a97..26d9787668c 100644 --- a/mythtv/programs/mythfrontend/programrecpriority.cpp +++ b/mythtv/programs/mythfrontend/programrecpriority.cpp @@ -600,7 +600,7 @@ void ProgramRecPriority::showMenu(void) QString label = tr("Options"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(label, popupStack, "menuPopup"); + auto *menuPopup = new MythDialogBox(label, popupStack, "menuPopup"); if (menuPopup->Create()) { @@ -628,7 +628,7 @@ void ProgramRecPriority::showSortMenu(void) QString label = tr("Sort Options"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(label, popupStack, "menuPopup"); + auto *menuPopup = new MythDialogBox(label, popupStack, "menuPopup"); if (menuPopup->Create()) { @@ -655,7 +655,7 @@ void ProgramRecPriority::customEvent(QEvent *event) { if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); + auto *dce = (DialogCompletionEvent*)(event); QString resultid = dce->GetId(); QString resulttext = dce->GetResultText(); @@ -698,9 +698,8 @@ void ProgramRecPriority::customEvent(QEvent *event) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythTextInputDialog *textInput = - new MythTextInputDialog(popupStack, - tr("Template Name")); + auto *textInput = new MythTextInputDialog(popupStack, + tr("Template Name")); if (textInput->Create()) { textInput->SetReturnEvent(this, "templatecat"); @@ -797,8 +796,7 @@ void ProgramRecPriority::customEvent(QEvent *event) } else if (resultid == "deleterule") { - RecordingRule *record = - dce->GetData().value<RecordingRule *>(); + auto *record = dce->GetData().value<RecordingRule *>(); if (record) { if (buttonnum > 0) @@ -829,19 +827,17 @@ void ProgramRecPriority::edit(MythUIButtonListItem *item) if (!item) return; - ProgramRecPriorityInfo *pgRecInfo = - item->GetData().value<ProgramRecPriorityInfo*>(); - + auto *pgRecInfo = item->GetData().value<ProgramRecPriorityInfo*>(); if (!pgRecInfo) return; - RecordingRule *record = new RecordingRule(); + auto *record = new RecordingRule(); record->m_recordID = pgRecInfo->GetRecordingRuleID(); if (record->m_searchType == kNoSearch) record->LoadByProgram(pgRecInfo); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ScheduleEditor *schededit = new ScheduleEditor(mainStack, record); + auto *schededit = new ScheduleEditor(mainStack, record); if (schededit->Create()) { mainStack->AddScreen(schededit); @@ -873,13 +869,13 @@ void ProgramRecPriority::newTemplate(QString category) } } - RecordingRule *record = new RecordingRule(); + auto *record = new RecordingRule(); if (!record) return; record->MakeTemplate(category); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ScheduleEditor *schededit = new ScheduleEditor(mainStack, record); + auto *schededit = new ScheduleEditor(mainStack, record); if (schededit->Create()) { mainStack->AddScreen(schededit); @@ -972,9 +968,7 @@ void ProgramRecPriority::remove(void) if (!item) return; - ProgramRecPriorityInfo *pgRecInfo = - item->GetData().value<ProgramRecPriorityInfo*>(); - + auto *pgRecInfo = item->GetData().value<ProgramRecPriorityInfo*>(); if (!pgRecInfo || (pgRecInfo->m_recType == kTemplateRecord && pgRecInfo->GetCategory() @@ -983,7 +977,7 @@ void ProgramRecPriority::remove(void) return; } - RecordingRule *record = new RecordingRule(); + auto *record = new RecordingRule(); record->m_recordID = pgRecInfo->GetRecordingRuleID(); if (!record->Load()) { @@ -996,9 +990,7 @@ void ProgramRecPriority::remove(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythConfirmationDialog *okPopup = new MythConfirmationDialog(popupStack, - message, true); - + auto *okPopup = new MythConfirmationDialog(popupStack, message, true); okPopup->SetReturnEvent(this, "deleterule"); okPopup->SetData(qVariantFromValue(record)); @@ -1014,9 +1006,7 @@ void ProgramRecPriority::deactivate(void) if (!item) return; - ProgramRecPriorityInfo *pgRecInfo = - item->GetData().value<ProgramRecPriorityInfo*>(); - + auto *pgRecInfo = item->GetData().value<ProgramRecPriorityInfo*>(); if (pgRecInfo) { MSqlQuery query(MSqlQuery::InitCon()); @@ -1069,9 +1059,7 @@ void ProgramRecPriority::changeRecPriority(int howMuch) if (!item) return; - ProgramRecPriorityInfo *pgRecInfo = - item->GetData().value<ProgramRecPriorityInfo*>(); - + auto *pgRecInfo = item->GetData().value<ProgramRecPriorityInfo*>(); if (!pgRecInfo) return; @@ -1130,7 +1118,7 @@ void ProgramRecPriority::FillList(void) RemoteGetAllScheduledRecordings(recordinglist); - vector<ProgramInfo *>::iterator pgiter = recordinglist.begin(); + auto pgiter = recordinglist.begin(); for (; pgiter != recordinglist.end(); ++pgiter) { @@ -1308,9 +1296,8 @@ void ProgramRecPriority::UpdateList() { ProgramRecPriorityInfo *progInfo = *it; - MythUIButtonListItem *item = - new MythUIButtonListItem(m_programList, "", - qVariantFromValue(progInfo)); + auto *item = new MythUIButtonListItem(m_programList, "", + qVariantFromValue(progInfo)); int progRecPriority = progInfo->GetRecordingPriority(); @@ -1430,8 +1417,7 @@ void ProgramRecPriority::updateInfo(MythUIButtonListItem *item) if (!item) return; - ProgramRecPriorityInfo *pgRecInfo = item->GetData() - .value<ProgramRecPriorityInfo *>(); + auto *pgRecInfo = item->GetData().value<ProgramRecPriorityInfo *>(); if (!pgRecInfo) return; @@ -1540,8 +1526,7 @@ void ProgramRecPriority::RemoveItemFromList(MythUIButtonListItem *item) if (!item) return; - ProgramRecPriorityInfo *pgRecInfo = item->GetData() - .value<ProgramRecPriorityInfo *>(); + auto *pgRecInfo = item->GetData().value<ProgramRecPriorityInfo *>(); if (!pgRecInfo) return; diff --git a/mythtv/programs/mythfrontend/schedulecommon.cpp b/mythtv/programs/mythfrontend/schedulecommon.cpp index 4d711fbd92e..50488166a82 100644 --- a/mythtv/programs/mythfrontend/schedulecommon.cpp +++ b/mythtv/programs/mythfrontend/schedulecommon.cpp @@ -37,7 +37,7 @@ void ScheduleCommon::ShowDetails(void) const return; MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ProgDetails *details_dialog = new ProgDetails(mainStack, pginfo); + auto *details_dialog = new ProgDetails(mainStack, pginfo); if (!details_dialog->Create()) { @@ -58,7 +58,7 @@ void ScheduleCommon::ShowUpcoming(const QString &title, return; MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ProgLister *pl = new ProgLister(mainStack, plTitle, title, seriesid); + auto *pl = new ProgLister(mainStack, plTitle, title, seriesid); if (pl->Create()) { mainStack->AddScreen(pl); @@ -99,8 +99,7 @@ void ScheduleCommon::ShowUpcomingScheduled(void) const return ShowUpcoming(pginfo->GetTitle(), pginfo->GetSeriesID()); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ProgLister *pl = new ProgLister(mainStack, plRecordid, - QString::number(id), ""); + auto *pl = new ProgLister(mainStack, plRecordid, QString::number(id), ""); if (pl->Create()) mainStack->AddScreen(pl); @@ -118,9 +117,9 @@ void ScheduleCommon::ShowChannelSearch() const return; MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ProgLister *pl = new ProgLister(mainStack, plChannel, - QString::number(pginfo->GetChanID()), "", - pginfo->GetScheduledStartTime()); + auto *pl = new ProgLister(mainStack, plChannel, + QString::number(pginfo->GetChanID()), "", + pginfo->GetScheduledStartTime()); if (pl->Create()) mainStack->AddScreen(pl); else @@ -187,7 +186,7 @@ void ScheduleCommon::EditScheduled(ProgramInfo *pginfo) void ScheduleCommon::EditScheduled(RecordingInfo *recinfo) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ScheduleEditor *schededit = new ScheduleEditor(mainStack, recinfo); + auto *schededit = new ScheduleEditor(mainStack, recinfo); if (schededit->Create()) mainStack->AddScreen(schededit); else @@ -207,7 +206,7 @@ void ScheduleCommon::EditCustom(void) return; MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - CustomEdit *ce = new CustomEdit(mainStack, pginfo); + auto *ce = new CustomEdit(mainStack, pginfo); if (ce->Create()) mainStack->AddScreen(ce); else @@ -222,7 +221,7 @@ void ScheduleCommon::MakeOverride(RecordingInfo *recinfo) if (!recinfo || !recinfo->GetRecordingRuleID()) return; - RecordingRule *recrule = new RecordingRule(); + auto *recrule = new RecordingRule(); if (!recrule->LoadByProgram(static_cast<ProgramInfo*>(recinfo))) LOG(VB_GENERAL, LOG_ERR, "Failed to load by program info"); @@ -236,7 +235,7 @@ void ScheduleCommon::MakeOverride(RecordingInfo *recinfo) recrule->m_type = kOverrideRecord; MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ScheduleEditor *schededit = new ScheduleEditor(mainStack, recrule); + auto *schededit = new ScheduleEditor(mainStack, recrule); if (schededit->Create()) mainStack->AddScreen(schededit); else @@ -261,7 +260,7 @@ void ScheduleCommon::ShowPrevious(void) const void ScheduleCommon::ShowPrevious(uint ruleid, const QString &title) const { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - PrevRecordedList *pl = new PrevRecordedList(mainStack, ruleid, title); + auto *pl = new PrevRecordedList(mainStack, ruleid, title); if (pl->Create()) mainStack->AddScreen(pl); else @@ -324,8 +323,8 @@ void ScheduleCommon::EditRecording(bool may_watch_now) } MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(message, popupStack, - "recOptionPopup", true); + auto *menuPopup = new MythDialogBox(message, popupStack, + "recOptionPopup", true); if (!menuPopup->Create()) { delete menuPopup; @@ -473,7 +472,7 @@ void ScheduleCommon::customEvent(QEvent *event) { if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); + auto *dce = (DialogCompletionEvent*)(event); QString resultid = dce->GetId(); QString resulttext = dce->GetResultText(); diff --git a/mythtv/programs/mythfrontend/scheduleeditor.cpp b/mythtv/programs/mythfrontend/scheduleeditor.cpp index d260796b0ed..0adbdb7273a 100644 --- a/mythtv/programs/mythfrontend/scheduleeditor.cpp +++ b/mythtv/programs/mythfrontend/scheduleeditor.cpp @@ -65,12 +65,11 @@ static QString fs11(QT_TRANSLATE_NOOP("SchedFilterEditor", "No episodes")); void *ScheduleEditor::RunScheduleEditor(ProgramInfo *proginfo, void *player) { - RecordingRule *rule = new RecordingRule(); + auto *rule = new RecordingRule(); rule->LoadByProgram(proginfo); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ScheduleEditor *se = new ScheduleEditor(mainStack, rule, - static_cast<TV*>(player)); + auto *se = new ScheduleEditor(mainStack, rule, static_cast<TV*>(player)); if (se->Create()) mainStack->AddScreen(se, (player == nullptr)); @@ -424,8 +423,8 @@ void ScheduleEditor::ShowSchedOpt() SchedOptMixin::Save(); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - SchedOptEditor *schedoptedit = new SchedOptEditor(mainStack, *this, - *m_recordingRule, m_recInfo); + auto *schedoptedit = new SchedOptEditor(mainStack, *this, + *m_recordingRule, m_recInfo); if (!schedoptedit->Create()) { delete schedoptedit; @@ -449,8 +448,8 @@ void ScheduleEditor::ShowStoreOpt() StoreOptMixin::Save(); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StoreOptEditor *storeoptedit = new StoreOptEditor(mainStack, *this, - *m_recordingRule, m_recInfo); + auto *storeoptedit = new StoreOptEditor(mainStack, *this, + *m_recordingRule, m_recInfo); if (!storeoptedit->Create()) { delete storeoptedit; @@ -474,8 +473,8 @@ void ScheduleEditor::ShowPostProc() PostProcMixin::Save(); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - PostProcEditor *ppedit = new PostProcEditor(mainStack, *this, - *m_recordingRule, m_recInfo); + auto *ppedit = new PostProcEditor(mainStack, *this, + *m_recordingRule, m_recInfo); if (!ppedit->Create()) { delete ppedit; @@ -495,7 +494,7 @@ void ScheduleEditor::ShowSchedInfo() QString label = tr("Schedule Information"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(label, popupStack, "menuPopup"); + auto *menuPopup = new MythDialogBox(label, popupStack, "menuPopup"); if (menuPopup->Create()) { @@ -554,7 +553,7 @@ void ScheduleEditor::customEvent(QEvent *event) { if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); + auto *dce = (DialogCompletionEvent*)(event); QString resultid = dce->GetId(); QString resulttext = dce->GetResultText(); @@ -617,9 +616,8 @@ void ScheduleEditor::showUpcomingByRule(void) } MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ProgLister *pl = new ProgLister(mainStack, plRecordid, - QString::number(m_recordingRule->m_recordID), - ""); + auto *pl = new ProgLister(mainStack, plRecordid, + QString::number(m_recordingRule->m_recordID), ""); if (pl->Create()) mainStack->AddScreen(pl); @@ -670,9 +668,9 @@ void ScheduleEditor::ShowPreview(void) m_recordingRule->UseTempTable(true, ttable); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ViewScheduleDiff *vsd = new ViewScheduleDiff(mainStack, ttable, - m_recordingRule->m_tempID, - m_recordingRule->m_title); + auto *vsd = new ViewScheduleDiff(mainStack, ttable, + m_recordingRule->m_tempID, + m_recordingRule->m_title); if (vsd->Create()) mainStack->AddScreen(vsd); else @@ -692,8 +690,8 @@ void ScheduleEditor::ShowMetadataOptions(void) m_child->Close(); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - MetadataOptions *rad = new MetadataOptions(mainStack, *this, - *m_recordingRule, m_recInfo); + auto *rad = new MetadataOptions(mainStack, *this, + *m_recordingRule, m_recInfo); if (!rad->Create()) { delete rad; @@ -717,8 +715,8 @@ void ScheduleEditor::ShowFilters(void) FilterOptMixin::Save(); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - SchedFilterEditor *schedfilteredit = new SchedFilterEditor(mainStack, - *this, *m_recordingRule, m_recInfo); + auto *schedfilteredit = new SchedFilterEditor(mainStack, *this, + *m_recordingRule, m_recInfo); if (!schedfilteredit->Create()) { delete schedfilteredit; @@ -789,8 +787,7 @@ void ScheduleEditor::showMenu(void) { QString label = tr("Options"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = - new MythDialogBox(label, popupStack, "menuPopup"); + auto *menuPopup = new MythDialogBox(label, popupStack, "menuPopup"); MythUIButtonListItem *item = m_rulesList->GetItemCurrent(); RecordingType type = static_cast<RecordingType>(item->GetData().toInt()); @@ -836,8 +833,7 @@ void ScheduleEditor::showTemplateMenu(void) QString label = tr("Template Options"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = - new MythDialogBox(label, popupStack, "menuPopup"); + auto *menuPopup = new MythDialogBox(label, popupStack, "menuPopup"); if (menuPopup->Create()) { @@ -1150,7 +1146,7 @@ void StoreOptEditor::customEvent(QEvent *event) { if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); + auto *dce = (DialogCompletionEvent*)(event); QString resultid = dce->GetId(); QString resulttext = dce->GetResultText(); @@ -1403,7 +1399,7 @@ void MetadataOptions::OnImageSearchListSelection(const ArtworkInfo& info, QString msg = tr("Downloading selected artwork..."); CreateBusyDialog(msg); - MetadataLookup *lookup = new MetadataLookup(); + auto *lookup = new MetadataLookup(); lookup->SetType(kMetadataVideo); lookup->SetHost(gCoreContext->GetMasterHostName()); @@ -1520,7 +1516,7 @@ void MetadataOptions::FindImagePopup(const QString &prefix, MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIFileBrowser *fb = new MythUIFileBrowser(popupStack, fp); + auto *fb = new MythUIFileBrowser(popupStack, fp); fb->SetNameFilter(GetSupportedImageExtensionFilter()); if (fb->Create()) { @@ -1560,7 +1556,7 @@ bool MetadataOptions::CanSetArtwork() MetadataLookup *MetadataOptions::CreateLookup(MetadataType mtype) { - MetadataLookup *lookup = new MetadataLookup(); + auto *lookup = new MetadataLookup(); lookup->SetStep(kLookupSearch); lookup->SetType(mtype); LookupType type = GuessLookupType(m_inetrefEdit->GetText()); @@ -1622,7 +1618,7 @@ void MetadataOptions::OnArtworkSearchDone(MetadataLookup *lookup) m_busyPopup = nullptr; } - VideoArtworkType type = lookup->GetData().value<VideoArtworkType>(); + auto type = lookup->GetData().value<VideoArtworkType>(); ArtworkList list = lookup->GetArtwork(type); if (list.isEmpty()) @@ -1632,8 +1628,7 @@ void MetadataOptions::OnArtworkSearchDone(MetadataLookup *lookup) return; } - ImageSearchResultsDialog *resultsdialog = - new ImageSearchResultsDialog(m_popupStack, list, type); + auto *resultsdialog = new ImageSearchResultsDialog(m_popupStack, list, type); connect(resultsdialog, SIGNAL(haveResult(ArtworkInfo, VideoArtworkType)), SLOT(OnImageSearchListSelection(ArtworkInfo, VideoArtworkType))); @@ -1705,8 +1700,7 @@ void MetadataOptions::customEvent(QEvent *levent) m_busyPopup = nullptr; } - MetadataFactoryMultiResult *mfmr = dynamic_cast<MetadataFactoryMultiResult*>(levent); - + auto *mfmr = dynamic_cast<MetadataFactoryMultiResult*>(levent); if (!mfmr) return; @@ -1752,8 +1746,7 @@ void MetadataOptions::customEvent(QEvent *levent) } LOG(VB_GENERAL, LOG_INFO, "Falling through to selection dialog."); - MetadataResultsDialog *resultsdialog = - new MetadataResultsDialog(m_popupStack, list); + auto *resultsdialog = new MetadataResultsDialog(m_popupStack, list); connect(resultsdialog, SIGNAL(haveResult(RefCountHandler<MetadataLookup>)), SLOT(OnSearchListSelection(RefCountHandler<MetadataLookup>)), @@ -1771,8 +1764,7 @@ void MetadataOptions::customEvent(QEvent *levent) m_busyPopup = nullptr; } - MetadataFactorySingleResult *mfsr = dynamic_cast<MetadataFactorySingleResult*>(levent); - + auto *mfsr = dynamic_cast<MetadataFactorySingleResult*>(levent); if (!mfsr) return; @@ -1791,8 +1783,7 @@ void MetadataOptions::customEvent(QEvent *levent) m_busyPopup = nullptr; } - MetadataFactoryNoResult *mfnr = dynamic_cast<MetadataFactoryNoResult*>(levent); - + auto *mfnr = dynamic_cast<MetadataFactoryNoResult*>(levent); if (!mfnr) return; @@ -1800,8 +1791,7 @@ void MetadataOptions::customEvent(QEvent *levent) "try entering a TVDB/TMDB number, season, and " "episode manually."); - MythConfirmationDialog *okPopup = - new MythConfirmationDialog(m_popupStack, title, false); + auto *okPopup = new MythConfirmationDialog(m_popupStack, title, false); if (okPopup->Create()) m_popupStack->AddScreen(okPopup); @@ -1814,7 +1804,7 @@ void MetadataOptions::customEvent(QEvent *levent) m_busyPopup = nullptr; } - MetadataLookupEvent *lue = (MetadataLookupEvent *)levent; + auto *lue = (MetadataLookupEvent *)levent; MetadataLookupList lul = lue->m_lookupList; @@ -1834,7 +1824,7 @@ void MetadataOptions::customEvent(QEvent *levent) m_busyPopup = nullptr; } - MetadataLookupFailure *luf = (MetadataLookupFailure *)levent; + auto *luf = (MetadataLookupFailure *)levent; MetadataLookupList lul = luf->m_lookupList; @@ -1845,8 +1835,7 @@ void MetadataOptions::customEvent(QEvent *levent) "be down). Check your information and try " "again."); - MythConfirmationDialog *okPopup = - new MythConfirmationDialog(m_popupStack, title, false); + auto *okPopup = new MythConfirmationDialog(m_popupStack, title, false); if (okPopup->Create()) m_popupStack->AddScreen(okPopup); @@ -1860,7 +1849,7 @@ void MetadataOptions::customEvent(QEvent *levent) m_busyPopup = nullptr; } - ImageDLEvent *ide = (ImageDLEvent *)levent; + auto *ide = (ImageDLEvent *)levent; MetadataLookup *lookup = ide->m_item; @@ -1883,7 +1872,7 @@ void MetadataOptions::customEvent(QEvent *levent) } else if (levent->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent*)(levent); + auto *dce = (DialogCompletionEvent*)(levent); const QString resultid = dce->GetId(); ArtworkInfo info; @@ -2574,8 +2563,7 @@ void StoreOptMixin::PromptForRecGroup(void) QString label = QObject::tr("New Recording group name: "); - MythTextInputDialog *textDialog = - new MythTextInputDialog(popupStack, label, + auto *textDialog = new MythTextInputDialog(popupStack, label, static_cast<InputFilter>(FilterSymbols | FilterPunct)); textDialog->SetReturnEvent(m_screen, "newrecgroup"); @@ -2596,9 +2584,8 @@ void StoreOptMixin::SetRecGroup(int recgroupID, QString recgroup) return; QString label = QObject::tr("Include in the \"%1\" recording group"); - MythUIButtonListItem *item = - new MythUIButtonListItem(m_recgroupList, label.arg(recgroup), - qVariantFromValue(recgroup)); + auto *item = new MythUIButtonListItem(m_recgroupList, label.arg(recgroup), + qVariantFromValue(recgroup)); m_recgroupList->SetItemCurrent(item); if (m_other && m_other->m_recgroupList) diff --git a/mythtv/programs/mythfrontend/services/frontend.cpp b/mythtv/programs/mythfrontend/services/frontend.cpp index 83dc99d2b2c..eae412bec93 100644 --- a/mythtv/programs/mythfrontend/services/frontend.cpp +++ b/mythtv/programs/mythfrontend/services/frontend.cpp @@ -31,7 +31,7 @@ QHash<QString,QStringList> Frontend::gActionDescriptions = QHash<QString,QString DTC::FrontendStatus* Frontend::GetStatus(void) { - DTC::FrontendStatus *status = new DTC::FrontendStatus(); + auto *status = new DTC::FrontendStatus(); MythUIStateTracker::GetFreshState(status->State()); status->setName(gCoreContext->GetHostName()); @@ -100,7 +100,7 @@ bool Frontend::SendAction(const QString &Action, const QString &Value, if (!Value.isEmpty() && kValueActions.contains(Action)) { - MythEvent* me = new MythEvent(Action, QStringList(Value)); + auto* me = new MythEvent(Action, QStringList(Value)); qApp->postEvent(GetMythMainWindow(), me); return true; } @@ -115,12 +115,12 @@ bool Frontend::SendAction(const QString &Action, const QString &Value, QStringList args; args << QString::number(Width) << QString::number(Height); - MythEvent* me = new MythEvent(Action, args); + auto* me = new MythEvent(Action, args); qApp->postEvent(GetMythMainWindow(), me); return true; } - QKeyEvent* ke = new QKeyEvent(QEvent::KeyPress, 0, Qt::NoModifier, Action); + auto* ke = new QKeyEvent(QEvent::KeyPress, 0, Qt::NoModifier, Action); qApp->postEvent(GetMythMainWindow(), (QEvent*)ke); return true; } @@ -239,7 +239,7 @@ bool Frontend::PlayVideo(const QString &Id, bool UseBookmark) << QString::number(metadata->GetID()) << QString::number(UseBookmark); - MythEvent *me = new MythEvent(ACTION_HANDLEMEDIA, args); + auto *me = new MythEvent(ACTION_HANDLEMEDIA, args); qApp->postEvent(GetMythMainWindow(), me); return true; @@ -253,7 +253,7 @@ QStringList Frontend::GetContextList(void) DTC::FrontendActionList* Frontend::GetActionList(const QString &lContext) { - DTC::FrontendActionList *list = new DTC::FrontendActionList(); + auto *list = new DTC::FrontendActionList(); InitialiseActions(); @@ -305,7 +305,7 @@ void Frontend::InitialiseActions(void) return; s_initialised = true; - KeyBindings *bindings = new KeyBindings(gCoreContext->GetHostName()); + auto *bindings = new KeyBindings(gCoreContext->GetHostName()); if (bindings) { QStringList contexts = bindings->GetContexts(); diff --git a/mythtv/programs/mythfrontend/setupwizard_audio.cpp b/mythtv/programs/mythfrontend/setupwizard_audio.cpp index b3792a29db2..934ddc00cd5 100644 --- a/mythtv/programs/mythfrontend/setupwizard_audio.cpp +++ b/mythtv/programs/mythfrontend/setupwizard_audio.cpp @@ -168,8 +168,7 @@ void AudioSetupWizard::Init(void) it != m_outputlist->end(); ++it) { QString name = it->m_name; - MythUIButtonListItem *output = - new MythUIButtonListItem(m_audioDeviceButtonList, name); + auto *output = new MythUIButtonListItem(m_audioDeviceButtonList, name); output->SetData(name); } if (found) @@ -269,7 +268,7 @@ AudioOutputSettings AudioSetupWizard::UpdateCapabilities(bool restore, bool AC3) { case 2: { - MythUIButtonListItem *stereo = + auto *stereo = new MythUIButtonListItem(m_speakerNumberButtonList, QObject::tr("Stereo")); stereo->SetData(2); @@ -277,7 +276,7 @@ AudioOutputSettings AudioSetupWizard::UpdateCapabilities(bool restore, bool AC3) } case 6: { - MythUIButtonListItem *sixchan = + auto *sixchan = new MythUIButtonListItem(m_speakerNumberButtonList, QObject::tr("5.1 Channel Audio")); sixchan->SetData(6); @@ -285,7 +284,7 @@ AudioOutputSettings AudioSetupWizard::UpdateCapabilities(bool restore, bool AC3) } case 8: { - MythUIButtonListItem *eightchan = + auto *eightchan = new MythUIButtonListItem(m_speakerNumberButtonList, QObject::tr("7.1 Channel Audio")); eightchan->SetData(8); @@ -336,8 +335,8 @@ void AudioSetupWizard::slotNext(void) save(); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - VideoSetupWizard *sw = new VideoSetupWizard(mainStack, m_generalScreen, - this, "videosetupwizard"); + auto *sw = new VideoSetupWizard(mainStack, m_generalScreen, + this, "videosetupwizard"); if (sw->Create()) { diff --git a/mythtv/programs/mythfrontend/setupwizard_general.cpp b/mythtv/programs/mythfrontend/setupwizard_general.cpp index 2d6025e8d2e..879267c3c4f 100644 --- a/mythtv/programs/mythfrontend/setupwizard_general.cpp +++ b/mythtv/programs/mythfrontend/setupwizard_general.cpp @@ -107,7 +107,7 @@ void GeneralSetupWizard::slotNext(void) save(); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - AudioSetupWizard *sw = new AudioSetupWizard(mainStack, this, "audiosetupwizard"); + auto *sw = new AudioSetupWizard(mainStack, this, "audiosetupwizard"); if (sw->Create()) { @@ -123,8 +123,7 @@ void GeneralSetupWizard::slotSubmit(void) "hardware profile with the MythTV developers? " "Profiles are anonymous and are a great way to " "help with future development."); - MythConfirmationDialog *confirmdialog = - new MythConfirmationDialog(m_popupStack,message); + auto *confirmdialog = new MythConfirmationDialog(m_popupStack,message); if (confirmdialog->Create()) m_popupStack->AddScreen(confirmdialog); @@ -222,8 +221,7 @@ void GeneralSetupWizard::slotDelete(void) "is anonymous and helps the developers " "to know what hardware the majority of users " "prefer."); - MythConfirmationDialog *confirmdialog = - new MythConfirmationDialog(m_popupStack,message); + auto *confirmdialog = new MythConfirmationDialog(m_popupStack,message); if (confirmdialog->Create()) m_popupStack->AddScreen(confirmdialog); diff --git a/mythtv/programs/mythfrontend/setupwizard_video.cpp b/mythtv/programs/mythfrontend/setupwizard_video.cpp index c79c0717d56..967cc5d16a1 100644 --- a/mythtv/programs/mythfrontend/setupwizard_video.cpp +++ b/mythtv/programs/mythfrontend/setupwizard_video.cpp @@ -95,8 +95,7 @@ void VideoSetupWizard::loadData(void) for (QStringList::const_iterator i = profiles.begin(); i != profiles.end(); ++i) { - MythUIButtonListItem *item = - new MythUIButtonListItem(m_playbackProfileButtonList, *i); + auto *item = new MythUIButtonListItem(m_playbackProfileButtonList, *i); item->SetData(*i); } @@ -233,7 +232,7 @@ void VideoSetupWizard::customEvent(QEvent *e) { if (e->type() == MythEvent::MythEventMessage) { - MythEvent *me = static_cast<MythEvent *>(e); + auto *me = static_cast<MythEvent *>(e); QStringList tokens = me->Message().split(" ", QString::SkipEmptyParts); if (tokens.isEmpty()) diff --git a/mythtv/programs/mythfrontend/statusbox.cpp b/mythtv/programs/mythfrontend/statusbox.cpp index 69a8b762206..e7031d97ff1 100644 --- a/mythtv/programs/mythfrontend/statusbox.cpp +++ b/mythtv/programs/mythfrontend/statusbox.cpp @@ -101,8 +101,7 @@ bool StatusBox::Create() void StatusBox::Init() { - MythUIButtonListItem *item = - new MythUIButtonListItem(m_categoryList, tr("Listings Status"), + auto *item = new MythUIButtonListItem(m_categoryList, tr("Listings Status"), qVariantFromValue((void*)SLOT(doListingsStatus()))); item->DisplayState("listings", "icon"); @@ -158,8 +157,8 @@ void StatusBox::AddLogLine(const QString & line, logline.m_state = state; logline.m_data = data; - MythUIButtonListItem *item = new MythUIButtonListItem(m_logList, line, - qVariantFromValue(logline)); + auto *item = new MythUIButtonListItem(m_logList, line, + qVariantFromValue(logline)); if (logline.m_state.isEmpty()) logline.m_state = "normal"; @@ -195,7 +194,7 @@ bool StatusBox::keyPressEvent(QKeyEvent *event) QString message = tr("Acknowledge all log entries at " "this priority level or lower?"); - MythConfirmationDialog *confirmPopup = + auto *confirmPopup = new MythConfirmationDialog(m_popupStack, message); confirmPopup->SetReturnEvent(this, "LogAckAll"); @@ -269,8 +268,7 @@ void StatusBox::clicked(MythUIButtonListItem *item) { QString message = tr("Acknowledge this log entry?"); - MythConfirmationDialog *confirmPopup = - new MythConfirmationDialog(m_popupStack, message); + auto *confirmPopup = new MythConfirmationDialog(m_popupStack, message); confirmPopup->SetReturnEvent(this, "LogAck"); confirmPopup->SetData(logline.m_data); @@ -287,7 +285,7 @@ void StatusBox::clicked(MythUIButtonListItem *item) { QString message = tr("Delete Job?"); - MythConfirmationDialog *confirmPopup = + auto *confirmPopup = new MythConfirmationDialog(m_popupStack, message); confirmPopup->SetReturnEvent(this, "JobDelete"); @@ -303,8 +301,8 @@ void StatusBox::clicked(MythUIButtonListItem *item) { QString label = tr("Job Queue Actions:"); - MythDialogBox *menuPopup = new MythDialogBox(label, m_popupStack, - "statusboxpopup"); + auto *menuPopup = new MythDialogBox(label, m_popupStack, + "statusboxpopup"); if (menuPopup->Create()) m_popupStack->AddScreen(menuPopup, false); @@ -324,7 +322,7 @@ void StatusBox::clicked(MythUIButtonListItem *item) { QString message = tr("Requeue Job?"); - MythConfirmationDialog *confirmPopup = + auto *confirmPopup = new MythConfirmationDialog(m_popupStack, message); confirmPopup->SetReturnEvent(this, "JobRequeue"); @@ -342,8 +340,8 @@ void StatusBox::clicked(MythUIButtonListItem *item) { QString label = tr("AutoExpire Actions:"); - MythDialogBox *menuPopup = new MythDialogBox(label, m_popupStack, - "statusboxpopup"); + auto *menuPopup = new MythDialogBox(label, m_popupStack, + "statusboxpopup"); if (menuPopup->Create()) m_popupStack->AddScreen(menuPopup, false); @@ -371,7 +369,7 @@ void StatusBox::customEvent(QEvent *event) { if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); + auto *dce = (DialogCompletionEvent*)(event); QString resultid = dce->GetId(); int buttonnum = dce->GetResult(); @@ -442,7 +440,7 @@ void StatusBox::customEvent(QEvent *event) } else if (resultid == "AutoExpireManage") { - ProgramInfo* rec = dce->GetData().value<ProgramInfo*>(); + auto* rec = dce->GetData().value<ProgramInfo*>(); // button 2 is "No Change" if (!rec || buttonnum == 2) diff --git a/mythtv/programs/mythfrontend/statusbox.h b/mythtv/programs/mythfrontend/statusbox.h index 861e96a6e1e..bdbd1ccd677 100644 --- a/mythtv/programs/mythfrontend/statusbox.h +++ b/mythtv/programs/mythfrontend/statusbox.h @@ -13,7 +13,7 @@ class MythUIButtonList; class MythUIButtonListItem; class MythUIStateType; -typedef QMap<QString, unsigned int> recprof2bps_t; +using recprof2bps_t = QMap<QString, unsigned int>; class StatusBox : public MythScreenType { diff --git a/mythtv/programs/mythfrontend/themechooser.cpp b/mythtv/programs/mythfrontend/themechooser.cpp index 867121ffd23..1fbd849f2d8 100644 --- a/mythtv/programs/mythfrontend/themechooser.cpp +++ b/mythtv/programs/mythfrontend/themechooser.cpp @@ -52,8 +52,7 @@ class ThemeExtractThread : public QRunnable { extractZIP(m_srcFile, m_destDir); - MythEvent *me = - new MythEvent("THEME_INSTALLED", QStringList(m_srcFile)); + auto *me = new MythEvent("THEME_INSTALLED", QStringList(m_srcFile)); QCoreApplication::postEvent(m_parent, me); } @@ -557,7 +556,7 @@ void ThemeChooser::showPopupMenu(void) MythUIButtonListItem *current = m_themes->GetItemCurrent(); if (current) { - ThemeInfo *info = current->GetData().value<ThemeInfo *>(); + auto *info = current->GetData().value<ThemeInfo *>(); if (info) { @@ -636,7 +635,7 @@ void ThemeChooser::toggleFullscreenPreview(void) else { MythUIButtonListItem *item = m_themes->GetItemCurrent(); - ThemeInfo *info = item->GetData().value<ThemeInfo*>(); + auto *info = item->GetData().value<ThemeInfo*>(); if (info) { if (m_fullScreenPreview) @@ -680,7 +679,7 @@ void ThemeChooser::saveAndReload(void) void ThemeChooser::saveAndReload(MythUIButtonListItem *item) { - ThemeInfo *info = item->GetData().value<ThemeInfo *>(); + auto *info = item->GetData().value<ThemeInfo *>(); if (!info) return; @@ -736,7 +735,7 @@ void ThemeChooser::saveAndReload(MythUIButtonListItem *item) void ThemeChooser::itemChanged(MythUIButtonListItem *item) { - ThemeInfo *info = item->GetData().value<ThemeInfo*>(); + auto *info = item->GetData().value<ThemeInfo*>(); if (!info) return; @@ -805,7 +804,7 @@ void ThemeChooser::customEvent(QEvent *e) { if (e->type() == MythEvent::MythEventMessage) { - MythEvent *me = static_cast<MythEvent *>(e); + auto *me = static_cast<MythEvent *>(e); QStringList tokens = me->Message().split(" ", QString::SkipEmptyParts); if (tokens.isEmpty()) @@ -876,7 +875,7 @@ void ThemeChooser::customEvent(QEvent *e) (fileSize > 0)) { m_downloadState = dsExtractingTheme; - ThemeExtractThread *extractThread = + auto *extractThread = new ThemeExtractThread(this, m_downloadFile, m_userThemeDir); MThreadPool::globalInstance()->start( @@ -913,7 +912,7 @@ void ThemeChooser::customEvent(QEvent *e) gCoreContext->SaveSetting("Theme", m_downloadTheme->GetDirectoryName()); // Send a message to ourself so we trigger a reload our next chance - MythEvent *me2 = new MythEvent("THEME_RELOAD"); + auto *me2 = new MythEvent("THEME_RELOAD"); qApp->postEvent(this, me2); } else if ((me->Message() == "THEME_RELOAD") && @@ -933,7 +932,7 @@ void ThemeChooser::removeTheme(void) return; } - ThemeInfo *info = current->GetData().value<ThemeInfo *>(); + auto *info = current->GetData().value<ThemeInfo *>(); if (!info) { ShowOkPopup(tr("Error, unable to find current theme.")); @@ -1081,7 +1080,7 @@ void ThemeUpdateChecker::checkForUpdate(void) int locMaj = 0; int locMin = 0; - ThemeInfo *remoteTheme = new ThemeInfo(remoteThemeDir); + auto *remoteTheme = new ThemeInfo(remoteThemeDir); if (!remoteTheme || remoteTheme->GetType() & THEME_UNKN) { LOG(VB_GENERAL, LOG_ERR, diff --git a/mythtv/programs/mythfrontend/upnpscanner.cpp b/mythtv/programs/mythfrontend/upnpscanner.cpp index 524db44ab36..eae081cf1cc 100644 --- a/mythtv/programs/mythfrontend/upnpscanner.cpp +++ b/mythtv/programs/mythfrontend/upnpscanner.cpp @@ -194,7 +194,7 @@ UPNPScanner* UPNPScanner::Instance(UPNPSubscription *sub) void UPNPScanner::StartFullScan(void) { m_fullscan = true; - MythEvent *me = new MythEvent(QString("UPNP_STARTSCAN")); + auto *me = new MythEvent(QString("UPNP_STARTSCAN")); qApp->postEvent(this, me); } @@ -302,7 +302,7 @@ bool UPNPScanner::GetMetadata(QVariant &data) if (!valid) return false; - MythEvent *me = new MythEvent("UPNP_BROWSEOBJECT", list); + auto *me = new MythEvent("UPNP_BROWSEOBJECT", list); qApp->postEvent(this, me); int count = 0; @@ -643,7 +643,7 @@ void UPNPScanner::customEvent(QEvent *event) return; // UPnP events - MythEvent *me = static_cast<MythEvent *>(event); + auto *me = static_cast<MythEvent *>(event); const QString& ev = me->Message(); if (ev == "UPNP_STARTSCAN") @@ -673,7 +673,7 @@ void UPNPScanner::customEvent(QEvent *event) } if (ev == "UPNP_EVENT") { - MythInfoMapEvent *info = (MythInfoMapEvent*)event; + auto *info = (MythInfoMapEvent*)event; if (!info) return; if (!info->GetInfoMap()) @@ -991,7 +991,7 @@ void UPNPScanner::ParseBrowse(const QUrl &url, QNetworkReply *reply) return; // Open the response for parsing - QDomDocument *parent = new QDomDocument(); + auto *parent = new QDomDocument(); QString errorMessage; int errorLine = 0; int errorColumn = 0; diff --git a/mythtv/programs/mythfrontend/videodlg.cpp b/mythtv/programs/mythfrontend/videodlg.cpp index d60d2596c1f..ad215015320 100644 --- a/mythtv/programs/mythfrontend/videodlg.cpp +++ b/mythtv/programs/mythfrontend/videodlg.cpp @@ -141,7 +141,7 @@ namespace const QString base_name = qfi.completeBaseName(); QList<QByteArray> image_types = QImageReader::supportedImageFormats(); - typedef std::set<QString> image_type_list; + using image_type_list = std::set<QString>; image_type_list image_exts; QString suffix; @@ -168,8 +168,7 @@ namespace RemoteGetFileList(host, "", &hostFiles, sgroup, true); const QString hntm("%2.%3"); - for (image_type_list::const_iterator ext = image_exts.begin(); - ext != image_exts.end(); ++ext) + for (auto ext = image_exts.cbegin(); ext != image_exts.cend(); ++ext) { QStringList sfn; if (episode > 0 || season > 0) @@ -212,8 +211,7 @@ namespace { if (!(*dir).length()) continue; - for (image_type_list::const_iterator ext = image_exts.begin(); - ext != image_exts.end(); ++ext) + for (auto ext = image_exts.cbegin(); ext != image_exts.cend(); ++ext) { QStringList sfn; if (season > 0 || episode > 0) @@ -439,7 +437,7 @@ namespace void CopyMetadataToUI(const VideoMetadata *metadata, CopyMetadataDestination &dest) { - typedef std::map<QString, QString> valuelist; + using valuelist = std::map<QString, QString>; valuelist tmp; if (metadata) @@ -666,8 +664,7 @@ const char * const ItemDetailPopup::WINDOW_NAME = "itemdetailpopup"; class VideoDialogPrivate { private: - typedef std::list<std::pair<QString, ParentalLevel::Level> > - parental_level_map; + using parental_level_map = std::list<std::pair<QString, ParentalLevel::Level> >; struct rating_to_pl_less : public std::binary_function<parental_level_map::value_type, @@ -680,7 +677,7 @@ class VideoDialogPrivate } }; - typedef VideoDialog::VideoListPtr VideoListPtr; + using VideoListPtr = VideoDialog::VideoListPtr; public: VideoDialogPrivate(const VideoListPtr& videoList, VideoDialog::DialogType type, @@ -1186,7 +1183,7 @@ void VideoDialog::loadData() } } - typedef QList<MythGenericTree *> MGTreeChildList; + using MGTreeChildList = QList<MythGenericTree *>; MGTreeChildList *lchildren = m_d->m_currentNode->getAllChildren(); for (MGTreeChildList::const_iterator p = lchildren->begin(); @@ -1194,7 +1191,7 @@ void VideoDialog::loadData() { if (*p != nullptr) { - MythUIButtonListItem *item = + auto *item = new MythUIButtonListItem(m_videoButtonList, QString(), nullptr, true, MythUIButtonListItem::NotChecked); @@ -2185,8 +2182,7 @@ void VideoDialog::createOkDialog(const QString& title) { const QString& message = title; - MythConfirmationDialog *okPopup = - new MythConfirmationDialog(m_popupStack, message, false); + auto *okPopup = new MythConfirmationDialog(m_popupStack, message, false); if (okPopup->Create()) m_popupStack->AddScreen(okPopup); @@ -2255,7 +2251,7 @@ void VideoDialog::searchStart(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUISearchDialog *searchDialog = new MythUISearchDialog(popupStack, + auto *searchDialog = new MythUISearchDialog(popupStack, tr("Video Search"), childList, false, ""); if (searchDialog->Create()) @@ -2409,7 +2405,7 @@ void VideoDialog::VideoMenu() else label = tr("Video Options"); - MythMenu *menu = new MythMenu(label, this, "actions"); + auto *menu = new MythMenu(label, this, "actions"); MythUIButtonListItem *item = GetItemCurrent(); MythGenericTree *node = GetNodePtrFromButton(item); @@ -2464,7 +2460,7 @@ MythMenu* VideoDialog::CreatePlayMenu() else return nullptr; - MythMenu *menu = new MythMenu(label, this, "actions"); + auto *menu = new MythMenu(label, this, "actions"); menu->AddItem(tr("Play"), SLOT(playVideo())); @@ -2496,7 +2492,7 @@ void VideoDialog::DisplayMenu() { QString label = tr("Video Display Menu"); - MythMenu *menu = new MythMenu(label, this, "display"); + auto *menu = new MythMenu(label, this, "display"); menu->AddItem(tr("Scan For Changes"), SLOT(doVideoScan())); menu->AddItem(tr("Retrieve All Details"), SLOT(VideoAutoSearch())); @@ -2538,7 +2534,7 @@ MythMenu* VideoDialog::CreateViewMenu() { QString label = tr("Change View"); - MythMenu *menu = new MythMenu(label, this, "view"); + auto *menu = new MythMenu(label, this, "view"); if (!(m_d->m_type & DLG_BROWSER)) menu->AddItem(tr("Switch to Browse View"), SLOT(SwitchBrowse())); @@ -2574,7 +2570,7 @@ MythMenu* VideoDialog::CreateSettingsMenu() { QString label = tr("Video Settings"); - MythMenu *menu = new MythMenu(label, this, "settings"); + auto *menu = new MythMenu(label, this, "settings"); menu->AddItem(tr("Player Settings"), SLOT(ShowPlayerSettings())); menu->AddItem(tr("Metadata Settings"), SLOT(ShowMetadataSettings())); @@ -2589,7 +2585,7 @@ MythMenu* VideoDialog::CreateSettingsMenu() */ void VideoDialog::ShowPlayerSettings() { - PlayerSettings *ps = new PlayerSettings(m_mainStack, "player settings"); + auto *ps = new PlayerSettings(m_mainStack, "player settings"); if (ps->Create()) m_mainStack->AddScreen(ps); @@ -2603,7 +2599,7 @@ void VideoDialog::ShowPlayerSettings() */ void VideoDialog::ShowMetadataSettings() { - MetadataSettings *ms = new MetadataSettings(m_mainStack, "metadata settings"); + auto *ms = new MetadataSettings(m_mainStack, "metadata settings"); if (ms->Create()) m_mainStack->AddScreen(ms); @@ -2617,7 +2613,7 @@ void VideoDialog::ShowMetadataSettings() */ void VideoDialog::ShowExtensionSettings() { - FileAssocDialog *fa = new FileAssocDialog(m_mainStack, "fa dialog"); + auto *fa = new FileAssocDialog(m_mainStack, "fa dialog"); if (fa->Create()) m_mainStack->AddScreen(fa); @@ -2633,7 +2629,7 @@ MythMenu* VideoDialog::CreateMetadataBrowseMenu() { QString label = tr("Browse By"); - MythMenu *menu = new MythMenu(label, this, "metadata"); + auto *menu = new MythMenu(label, this, "metadata"); if (m_d->m_groupType != BRS_CAST) menu->AddItem(tr("Cast"), SLOT(SwitchVideoCastGroup())); @@ -2676,7 +2672,7 @@ MythMenu *VideoDialog::CreateInfoMenu() { QString label = tr("Video Info"); - MythMenu *menu = new MythMenu(label, this, "info"); + auto *menu = new MythMenu(label, this, "info"); if (ItemDetailPopup::Exists()) menu->AddItem(tr("View Details"), SLOT(DoItemDetailShow())); @@ -2703,7 +2699,7 @@ MythMenu *VideoDialog::CreateManageMenu() { QString label = tr("Manage Video Details"); - MythMenu *menu = new MythMenu(label, this, "manage"); + auto *menu = new MythMenu(label, this, "manage"); VideoMetadata *metadata = GetMetadata(GetItemCurrent()); @@ -2950,7 +2946,7 @@ void VideoDialog::SwitchLayout(DialogType type, BrowseType browse) // save current position so it can be restored after the switch SavePosition(); - VideoDialog *mythvideo = + auto *mythvideo = new VideoDialog(GetMythMainWindow()->GetMainStack(), "mythvideo", m_d->m_videoList, type, browse); @@ -2977,7 +2973,7 @@ void VideoDialog::ViewPlot() { VideoMetadata *metadata = GetMetadata(GetItemCurrent()); - PlotDialog *plotdialog = new PlotDialog(m_popupStack, metadata); + auto *plotdialog = new PlotDialog(m_popupStack, metadata); if (plotdialog->Create()) m_popupStack->AddScreen(plotdialog); @@ -2994,7 +2990,7 @@ bool VideoDialog::DoItemDetailShow() if (metadata) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ItemDetailPopup *idp = new ItemDetailPopup(mainStack, metadata, + auto *idp = new ItemDetailPopup(mainStack, metadata, m_d->m_videoList->getListCache()); if (idp->Create()) @@ -3015,7 +3011,7 @@ void VideoDialog::ShowCastDialog() { VideoMetadata *metadata = GetMetadata(GetItemCurrent()); - CastDialog *castdialog = new CastDialog(m_popupStack, metadata); + auto *castdialog = new CastDialog(m_popupStack, metadata); if (castdialog->Create()) m_popupStack->AddScreen(castdialog); @@ -3247,7 +3243,7 @@ void VideoDialog::ChangeFilter() { MythScreenStack *mainStack = GetScreenStack(); - VideoFilterDialog *filterdialog = new VideoFilterDialog(mainStack, + auto *filterdialog = new VideoFilterDialog(mainStack, "videodialogfilters", m_d->m_videoList.get()); if (filterdialog->Create()) @@ -3283,7 +3279,7 @@ void VideoDialog::customEvent(QEvent *levent) { if (levent->type() == MetadataFactoryMultiResult::kEventType) { - MetadataFactoryMultiResult *mfmr = dynamic_cast<MetadataFactoryMultiResult*>(levent); + auto *mfmr = dynamic_cast<MetadataFactoryMultiResult*>(levent); if (!mfmr) return; @@ -3292,11 +3288,9 @@ void VideoDialog::customEvent(QEvent *levent) if (list.count() > 1) { - VideoMetadata *metadata = - list[0]->GetData().value<VideoMetadata *>(); + auto *metadata = list[0]->GetData().value<VideoMetadata *>(); dismissFetchDialog(metadata, true); - MetadataResultsDialog *resultsdialog = - new MetadataResultsDialog(m_popupStack, list); + auto *resultsdialog = new MetadataResultsDialog(m_popupStack, list); connect(resultsdialog, SIGNAL(haveResult(RefCountHandler<MetadataLookup>)), SLOT(OnVideoSearchListSelection(RefCountHandler<MetadataLookup>)), @@ -3308,7 +3302,7 @@ void VideoDialog::customEvent(QEvent *levent) } else if (levent->type() == MetadataFactorySingleResult::kEventType) { - MetadataFactorySingleResult *mfsr = dynamic_cast<MetadataFactorySingleResult*>(levent); + auto *mfsr = dynamic_cast<MetadataFactorySingleResult*>(levent); if (!mfsr) return; @@ -3322,7 +3316,7 @@ void VideoDialog::customEvent(QEvent *levent) } else if (levent->type() == MetadataFactoryNoResult::kEventType) { - MetadataFactoryNoResult *mfnr = dynamic_cast<MetadataFactoryNoResult*>(levent); + auto *mfnr = dynamic_cast<MetadataFactoryNoResult*>(levent); if (!mfnr) return; @@ -3332,8 +3326,7 @@ void VideoDialog::customEvent(QEvent *levent) if (!lookup) return; - VideoMetadata *metadata = - lookup->GetData().value<VideoMetadata *>(); + auto *metadata = lookup->GetData().value<VideoMetadata *>(); if (metadata) { dismissFetchDialog(metadata, false); @@ -3346,7 +3339,7 @@ void VideoDialog::customEvent(QEvent *levent) } else if (levent->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = static_cast<DialogCompletionEvent *>(levent); + auto *dce = static_cast<DialogCompletionEvent *>(levent); QString id = dce->GetId(); if (id == "scanprompt") @@ -3447,7 +3440,7 @@ void VideoDialog::VideoAutoSearch(MythGenericTree *node) { if (!node) node = m_d->m_rootNode; - typedef QList<MythGenericTree *> MGTreeChildList; + using MGTreeChildList = QList<MythGenericTree *>; MGTreeChildList *lchildren = node->getAllChildren(); LOG(VB_GENERAL, LOG_DEBUG, @@ -3522,7 +3515,7 @@ void VideoDialog::EditMetadata() MythScreenStack *screenStack = GetScreenStack(); - EditMetadataDialog *md_editor = new EditMetadataDialog(screenStack, + auto *md_editor = new EditMetadataDialog(screenStack, "mythvideoeditmetadata", metadata, m_d->m_videoList->getListCache()); @@ -3542,8 +3535,7 @@ void VideoDialog::RemoveVideo() QString message = tr("Are you sure you want to permanently delete:\n%1") .arg(metadata->GetTitle()); - MythConfirmationDialog *confirmdialog = - new MythConfirmationDialog(m_popupStack,message); + auto *confirmdialog = new MythConfirmationDialog(m_popupStack,message); if (confirmdialog->Create()) m_popupStack->AddScreen(confirmdialog); @@ -3579,8 +3571,8 @@ void VideoDialog::OnRemoveVideo(bool dodelete) { QString message = tr("Failed to delete file"); - MythConfirmationDialog *confirmdialog = - new MythConfirmationDialog(m_popupStack,message,false); + auto *confirmdialog = new MythConfirmationDialog(m_popupStack,message, + false); if (confirmdialog->Create()) m_popupStack->AddScreen(confirmdialog); @@ -3683,7 +3675,7 @@ void VideoDialog::OnVideoSearchDone(MetadataLookup *lookup) if (!lookup) return; - VideoMetadata *metadata = lookup->GetData().value<VideoMetadata *>(); + auto *metadata = lookup->GetData().value<VideoMetadata *>(); if (!metadata) return; @@ -3820,9 +3812,7 @@ void VideoDialog::PromptToScan() { QString message = tr("There are no videos in the database, would you like " "to scan your video directories now?"); - MythConfirmationDialog *dialog = new MythConfirmationDialog(m_popupStack, - message, - true); + auto *dialog = new MythConfirmationDialog(m_popupStack, message, true); dialog->SetReturnEvent(this, "scanprompt"); if (dialog->Create()) m_popupStack->AddScreen(dialog); diff --git a/mythtv/programs/mythfrontend/videodlg.h b/mythtv/programs/mythfrontend/videodlg.h index 72ac811cbb2..35c67075ce1 100644 --- a/mythtv/programs/mythfrontend/videodlg.h +++ b/mythtv/programs/mythfrontend/videodlg.h @@ -41,9 +41,8 @@ class VideoDialog : public MythScreenType BRS_USERRATING = 0x20, BRS_INSERTDATE = 0x40, BRS_TVMOVIE = 0x80, BRS_STUDIO = 0x100, btLast }; - typedef simple_ref_ptr<class VideoList> VideoListPtr; - - typedef QPointer<class VideoListDeathDelay> VideoListDeathDelayPtr; + using VideoListPtr = simple_ref_ptr<class VideoList>; + using VideoListDeathDelayPtr = QPointer<class VideoListDeathDelay>; static VideoListDeathDelayPtr &GetSavedVideoList(); diff --git a/mythtv/programs/mythfrontend/videofileassoc.cpp b/mythtv/programs/mythfrontend/videofileassoc.cpp index dac00009298..68941726951 100644 --- a/mythtv/programs/mythfrontend/videofileassoc.cpp +++ b/mythtv/programs/mythfrontend/videofileassoc.cpp @@ -123,15 +123,14 @@ namespace ~BlockSignalsGuard() { - for (list_type::iterator p = m_objects.begin(); - p != m_objects.end(); ++p) + for (auto p = m_objects.begin(); p != m_objects.end(); ++p) { (*p)->blockSignals(false); } } private: - typedef std::vector<QObject *> list_type; + using list_type = std::vector<QObject *>; private: list_type m_objects; @@ -139,7 +138,7 @@ namespace struct UIDToFAPair { - typedef unsigned int UID_type; + using UID_type = unsigned int; UIDToFAPair() = default; @@ -166,7 +165,7 @@ namespace class FileAssocDialogPrivate { public: - typedef std::vector<UIDToFAPair> UIReadyList_type; + using UIReadyList_type = std::vector<UIDToFAPair>; public: FileAssocDialogPrivate() @@ -176,7 +175,7 @@ class FileAssocDialogPrivate ~FileAssocDialogPrivate() { - for (FA_collection::iterator p = m_fileAssociations.begin(); + for (auto p = m_fileAssociations.begin(); p != m_fileAssociations.end(); ++p) { delete p->second; @@ -185,7 +184,7 @@ class FileAssocDialogPrivate void SaveFileAssociations() { - for (FA_collection::iterator p = m_fileAssociations.begin(); + for (auto p = m_fileAssociations.begin(); p != m_fileAssociations.end(); ++p) { p->second->CommitChanges(); @@ -207,7 +206,7 @@ class FileAssocDialogPrivate bool DeleteExtension(UIDToFAPair::UID_type uid) { - FA_collection::iterator p = m_fileAssociations.find(uid); + auto p = m_fileAssociations.find(uid); if (p != m_fileAssociations.end()) { p->second->MarkForDeletion(); @@ -224,7 +223,7 @@ class FileAssocDialogPrivate UIReadyList_type ret; std::transform(m_fileAssociations.begin(), m_fileAssociations.end(), std::back_inserter(ret), fa_col_ent_2_UIDFAPair()); - UIReadyList_type::iterator deleted = std::remove_if(ret.begin(), + auto deleted = std::remove_if(ret.begin(), ret.end(), test_fa_state<FileAssociationWrap::efsDELETE>()); if (deleted != ret.end()) @@ -261,8 +260,7 @@ class FileAssocDialogPrivate } private: - typedef std::map<UIDToFAPair::UID_type, FileAssociationWrap *> - FA_collection; + using FA_collection = std::map<UIDToFAPair::UID_type, FileAssociationWrap *>; private: struct fa_col_ent_2_UIDFAPair @@ -285,15 +283,14 @@ class FileAssocDialogPrivate void LoadFileAssociations() { - typedef std::vector<UIDToFAPair> tmp_fa_list; + using tmp_fa_list = std::vector<UIDToFAPair>; const FileAssociations::association_list &fa_list = FileAssociations::getFileAssociation().getList(); tmp_fa_list tmp_fa; tmp_fa.reserve(fa_list.size()); - for (FileAssociations::association_list::const_iterator p = - fa_list.begin(); p != fa_list.end(); ++p) + for (auto p = fa_list.cbegin(); p != fa_list.cend(); ++p) { tmp_fa.push_back(UIDToFAPair(++m_nextFAID, new FileAssociationWrap(*p))); @@ -443,8 +440,7 @@ void FileAssocDialog::OnNewExtensionPressed() QString message = tr("Enter the new extension:"); - MythTextInputDialog *newextdialog = - new MythTextInputDialog(popupStack, message); + auto *newextdialog = new MythTextInputDialog(popupStack, message); if (newextdialog->Create()) popupStack->AddScreen(newextdialog); @@ -501,15 +497,13 @@ void FileAssocDialog::UpdateScreen(bool useSelectionOverride /* = false*/) m_extensionList->SetVisible(true); m_extensionList->Reset(); - for (FileAssocDialogPrivate::UIReadyList_type::iterator p = - tmp_list.begin(); p != tmp_list.end(); ++p) + for (auto p = tmp_list.begin(); p != tmp_list.end(); ++p) { if (p->m_fileAssoc) { // No memory leak. MythUIButtonListItem adds the new // item into m_extensionList. - MythUIButtonListItem *new_item = - new MythUIButtonListItem(m_extensionList, + auto *new_item = new MythUIButtonListItem(m_extensionList, p->m_fileAssoc->GetExtension(), QVariant::fromValue(*p)); if (selected_id && p->m_uid == selected_id) diff --git a/mythtv/programs/mythfrontend/videofilter.cpp b/mythtv/programs/mythfrontend/videofilter.cpp index 8cc50fa0a0f..fea760b75c4 100644 --- a/mythtv/programs/mythfrontend/videofilter.cpp +++ b/mythtv/programs/mythfrontend/videofilter.cpp @@ -213,8 +213,7 @@ bool VideoFilterSettings::matches_filter(const VideoMetadata &mdata) const matches = false; const VideoMetadata::genre_list &gl = mdata.GetGenres(); - for (VideoMetadata::genre_list::const_iterator p = gl.begin(); - p != gl.end(); ++p) + for (auto p = gl.cbegin(); p != gl.cend(); ++p) { if ((matches = (p->first == m_genre))) { @@ -228,8 +227,7 @@ bool VideoFilterSettings::matches_filter(const VideoMetadata &mdata) const matches = false; const VideoMetadata::country_list &cl = mdata.GetCountries(); - for (VideoMetadata::country_list::const_iterator p = cl.begin(); - p != cl.end(); ++p) + for (auto p = cl.cbegin(); p != cl.cend(); ++p) { if ((matches = (p->first == m_country))) { @@ -250,8 +248,7 @@ bool VideoFilterSettings::matches_filter(const VideoMetadata &mdata) const { matches = false; - for (VideoMetadata::cast_list::const_iterator p = cl.begin(); - p != cl.end(); ++p) + for (auto p = cl.cbegin(); p != cl.cend(); ++p) { if ((matches = (p->first == m_cast))) { @@ -553,15 +550,14 @@ void VideoFilterDialog::fillWidgets() bool have_unknown_year = false; bool have_unknown_runtime = false; - typedef std::set<int> int_list; + using int_list = std::set<int>; int_list years; int_list runtimes; int_list user_ratings; const VideoMetadataListManager::metadata_list &mdl = m_videoList.getListCache().getList(); - for (VideoMetadataListManager::metadata_list::const_iterator p = mdl.begin(); - p != mdl.end(); ++p) + for (auto p = mdl.cbegin(); p != mdl.cend(); ++p) { int year = (*p)->GetYear(); if ((year == 0) || (year == VIDEO_YEAR_DEFAULT)) @@ -584,8 +580,7 @@ void VideoFilterDialog::fillWidgets() const VideoCategory::entry_list &vcl = VideoCategory::GetCategory().getList(); - for (VideoCategory::entry_list::const_iterator p = vcl.begin(); - p != vcl.end(); ++p) + for (auto p = vcl.cbegin(); p != vcl.cend(); ++p) { new MythUIButtonListItem(m_categoryList, p->second, p->first); } @@ -598,8 +593,7 @@ void VideoFilterDialog::fillWidgets() new MythUIButtonListItem(m_genreList, tr("All", "Genre"), kGenreFilterAll); const VideoGenre::entry_list &gl = VideoGenre::getGenre().getList(); - for (VideoGenre::entry_list::const_iterator p = gl.begin(); - p != gl.end(); ++p) + for (auto p = gl.cbegin(); p != gl.cend(); ++p) { new MythUIButtonListItem(m_genreList, p->second, p->first); } @@ -611,8 +605,7 @@ void VideoFilterDialog::fillWidgets() new MythUIButtonListItem(m_castList, tr("All", "Cast"), kCastFilterAll); const VideoCast::entry_list &cl = VideoCast::GetCast().getList(); - for (VideoCast::entry_list::const_iterator p = cl.begin(); - p != cl.end(); ++p) + for (auto p = cl.cbegin(); p != cl.cend(); ++p) { new MythUIButtonListItem(m_castList, p->second, p->first); } @@ -624,8 +617,7 @@ void VideoFilterDialog::fillWidgets() new MythUIButtonListItem(m_countryList, tr("All", "Country"), kCountryFilterAll); const VideoCountry::entry_list &cnl = VideoCountry::getCountry().getList(); - for (VideoCountry::entry_list::const_iterator p = cnl.begin(); - p != cnl.end(); ++p) + for (auto p = cnl.cbegin(); p != cnl.cend(); ++p) { new MythUIButtonListItem(m_countryList, p->second, p->first); } @@ -637,8 +629,7 @@ void VideoFilterDialog::fillWidgets() // Year new MythUIButtonListItem(m_yearList, tr("All", "Year"), kYearFilterAll); - for (int_list::const_reverse_iterator p = years.rbegin(); - p != years.rend(); ++p) + for (auto p = years.crbegin(); p != years.crend(); ++p) { new MythUIButtonListItem(m_yearList, QString::number(*p), *p); } @@ -656,8 +647,7 @@ void VideoFilterDialog::fillWidgets() new MythUIButtonListItem(m_runtimeList, VIDEO_RUNTIME_UNKNOWN, kRuntimeFilterUnknown); - for (int_list::const_iterator p = runtimes.begin(); - p != runtimes.end(); ++p) + for (auto p = runtimes.cbegin(); p != runtimes.cend(); ++p) { QString s = QString("%1 %2 ~ %3 %4").arg(*p * 30).arg(tr("minutes")) .arg((*p + 1) * 30).arg(tr("minutes")); @@ -670,8 +660,7 @@ void VideoFilterDialog::fillWidgets() new MythUIButtonListItem(m_userratingList, tr("All", "User rating"), kUserRatingFilterAll); - for (int_list::const_reverse_iterator p = user_ratings.rbegin(); - p != user_ratings.rend(); ++p) + for (auto p = user_ratings.crbegin(); p != user_ratings.crend(); ++p) { new MythUIButtonListItem(m_userratingList, QString(">= %1").arg(QString::number(*p)), diff --git a/mythtv/programs/mythfrontend/videoglobalsettings.cpp b/mythtv/programs/mythfrontend/videoglobalsettings.cpp index ed691486067..d7ce74a5c1f 100644 --- a/mythtv/programs/mythfrontend/videoglobalsettings.cpp +++ b/mythtv/programs/mythfrontend/videoglobalsettings.cpp @@ -14,7 +14,7 @@ namespace // General Settings HostComboBoxSetting *VideoDefaultParentalLevel() { - HostComboBoxSetting *gc = new HostComboBoxSetting("VideoDefaultParentalLevel"); + auto *gc = new HostComboBoxSetting("VideoDefaultParentalLevel"); gc->setLabel(VideoGeneralSettings::tr("Starting Parental Level")); @@ -43,7 +43,7 @@ const char *password_clue = HostTextEditSetting *VideoAdminPassword() { - HostTextEditSetting *gc = new HostTextEditSetting("VideoAdminPassword"); + auto *gc = new HostTextEditSetting("VideoAdminPassword"); gc->setLabel(VideoGeneralSettings::tr("Parental Level 4 PIN")); @@ -58,7 +58,7 @@ HostTextEditSetting *VideoAdminPassword() HostTextEditSetting *VideoAdminPasswordThree() { - HostTextEditSetting *gc = new HostTextEditSetting("VideoAdminPasswordThree"); + auto *gc = new HostTextEditSetting("VideoAdminPasswordThree"); gc->setLabel(VideoGeneralSettings::tr("Parental Level 3 PIN")); @@ -72,7 +72,7 @@ HostTextEditSetting *VideoAdminPasswordThree() HostTextEditSetting *VideoAdminPasswordTwo() { - HostTextEditSetting *gc = new HostTextEditSetting("VideoAdminPasswordTwo"); + auto *gc = new HostTextEditSetting("VideoAdminPasswordTwo"); gc->setLabel(VideoGeneralSettings::tr("Parental Level 2 PIN")); @@ -86,7 +86,7 @@ HostTextEditSetting *VideoAdminPasswordTwo() HostCheckBoxSetting *VideoAggressivePC() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("VideoAggressivePC"); + auto *gc = new HostCheckBoxSetting("VideoAggressivePC"); gc->setLabel(VideoGeneralSettings::tr("Aggressive Parental Control")); gc->setValue(false); @@ -101,7 +101,7 @@ HostCheckBoxSetting *VideoAggressivePC() HostTextEditSetting *VideoStartupDirectory() { - HostTextEditSetting *gc = new HostTextEditSetting("VideoStartupDir"); + auto *gc = new HostTextEditSetting("VideoStartupDir"); gc->setLabel(VideoGeneralSettings::tr("Directories that hold videos")); @@ -117,7 +117,7 @@ HostTextEditSetting *VideoStartupDirectory() HostTextEditSetting *VideoArtworkDirectory() { - HostTextEditSetting *gc = new HostTextEditSetting("VideoArtworkDir"); + auto *gc = new HostTextEditSetting("VideoArtworkDir"); gc->setLabel(VideoGeneralSettings::tr("Directory that holds movie " "posters")); @@ -133,7 +133,7 @@ HostTextEditSetting *VideoArtworkDirectory() HostTextEditSetting *VideoScreenshotDirectory() { - HostTextEditSetting *gc = new HostTextEditSetting("mythvideo.screenshotDir"); + auto *gc = new HostTextEditSetting("mythvideo.screenshotDir"); gc->setLabel(VideoGeneralSettings::tr("Directory that holds movie " "screenshots")); @@ -149,7 +149,7 @@ HostTextEditSetting *VideoScreenshotDirectory() HostTextEditSetting *VideoBannerDirectory() { - HostTextEditSetting *gc = new HostTextEditSetting("mythvideo.bannerDir"); + auto *gc = new HostTextEditSetting("mythvideo.bannerDir"); gc->setLabel(VideoGeneralSettings::tr("Directory that holds movie/TV " "Banners")); @@ -165,7 +165,7 @@ HostTextEditSetting *VideoBannerDirectory() HostTextEditSetting *VideoFanartDirectory() { - HostTextEditSetting *gc = new HostTextEditSetting("mythvideo.fanartDir"); + auto *gc = new HostTextEditSetting("mythvideo.fanartDir"); gc->setLabel(VideoGeneralSettings::tr("Directory that holds movie fanart")); @@ -180,7 +180,7 @@ HostTextEditSetting *VideoFanartDirectory() HostTextEditSetting *TrailerDirectory() { - HostTextEditSetting *gc = new HostTextEditSetting("mythvideo.TrailersDir"); + auto *gc = new HostTextEditSetting("mythvideo.TrailersDir"); gc->setLabel(VideoGeneralSettings::tr("Directory that holds movie " "trailers")); @@ -202,7 +202,7 @@ HostTextEditSetting *TrailerDirectory() HostComboBoxSetting *SetOnInsertDVD() { - HostComboBoxSetting *gc = new HostComboBoxSetting("DVDOnInsertDVD"); + auto *gc = new HostComboBoxSetting("DVDOnInsertDVD"); gc->setLabel(VideoGeneralSettings::tr("On DVD insertion")); @@ -219,7 +219,7 @@ HostComboBoxSetting *SetOnInsertDVD() HostCheckBoxSetting *VideoTreeRemember() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("mythvideo.VideoTreeRemember"); + auto *gc = new HostCheckBoxSetting("mythvideo.VideoTreeRemember"); gc->setLabel(VideoGeneralSettings::tr("Video Tree remembers last selected " "position")); @@ -233,8 +233,7 @@ HostCheckBoxSetting *VideoTreeRemember() HostCheckBoxSetting *RatingsToPL() { - HostCheckBoxSetting *r2pl = - new HostCheckBoxSetting("mythvideo.ParentalLevelFromRating"); + auto *r2pl = new HostCheckBoxSetting("mythvideo.ParentalLevelFromRating"); r2pl->setLabel(VideoGeneralSettings::tr("Enable automatic Parental " "Level from rating")); @@ -246,7 +245,7 @@ HostCheckBoxSetting *RatingsToPL() "matching the rating " "below.")); - typedef std::map<ParentalLevel::Level, QString> r2pl_map; + using r2pl_map = std::map<ParentalLevel::Level, QString>; r2pl_map r2pl_defaults; @@ -264,7 +263,7 @@ HostCheckBoxSetting *RatingsToPL() for (ParentalLevel pl(ParentalLevel::plLowest); pl.GetLevel() <= ParentalLevel::plHigh && pl.good(); ++pl) { - HostTextEditSetting *hle = new HostTextEditSetting(QString("mythvideo.AutoR2PL%1") + auto *hle = new HostTextEditSetting(QString("mythvideo.AutoR2PL%1") .arg(pl.GetLevel())); hle->setLabel(VideoGeneralSettings::tr("Level %1") @@ -307,7 +306,7 @@ VideoGeneralSettings::VideoGeneralSettings() addChild(SetOnInsertDVD()); addChild(VideoTreeRemember()); - GroupSetting *pctrl = new GroupSetting(); + auto *pctrl = new GroupSetting(); pctrl->setLabel(tr("Parental Control Settings")); pctrl->addChild(VideoDefaultParentalLevel()); pctrl->addChild(VideoAdminPassword()); diff --git a/mythtv/programs/mythfrontend/videolist.cpp b/mythtv/programs/mythfrontend/videolist.cpp index cf1bef4763f..a602aa6ae98 100644 --- a/mythtv/programs/mythfrontend/videolist.cpp +++ b/mythtv/programs/mythfrontend/videolist.cpp @@ -329,7 +329,7 @@ static int AddFileNode(MythGenericTree *where_to_add, const QString& name, class VideoListImp { public: - typedef vector<VideoMetadata *> metadata_view_list; + using metadata_view_list = vector<VideoMetadata *>; private: enum metadata_list_type { ltNone, ltFileSystem, ltDBMetadata, @@ -338,8 +338,8 @@ class VideoListImp ltDBStudioGroup, ltDBCastGroup, ltDBUserRatingGroup, ltDBInsertDateGroup, ltTVMetadata}; - typedef VideoMetadataListManager::metadata_list metadata_list; - typedef VideoMetadataListManager::VideoMetadataPtr MetadataPtr; + using metadata_list = VideoMetadataListManager::metadata_list; + using MetadataPtr = VideoMetadataListManager::VideoMetadataPtr; public: VideoListImp(); @@ -373,8 +373,8 @@ class VideoListImp int TryFilter(const VideoFilterSettings &filter) const { int ret = 0; - for (metadata_list::const_iterator p = m_metadata.getList().begin(); - p != m_metadata.getList().end(); ++p) + for (auto p = m_metadata.getList().cbegin(); + p != m_metadata.getList().cend(); ++p) { if (filter.matches_filter(**p)) ++ret; } @@ -797,7 +797,7 @@ void VideoListImp::buildGroupList(metadata_list_type whence) metadata_path_sort mps = metadata_path_sort(); sort(mlist.begin(), mlist.end(), mps); - typedef map<QString, meta_dir_node *> group_to_node_map; + using group_to_node_map = map<QString, meta_dir_node *>; group_to_node_map gtnm; meta_dir_node *video_root = &m_metadataTree; @@ -805,7 +805,7 @@ void VideoListImp::buildGroupList(metadata_list_type whence) smart_dir_node sdn1 = video_root->addSubDir("All"); meta_dir_node* all_group_node = sdn1.get(); - for (metadata_view_list::iterator p = mlist.begin(); p != mlist.end(); ++p) + for (auto p = mlist.begin(); p != mlist.end(); ++p) { VideoMetadata *data = *p; @@ -820,8 +820,7 @@ void VideoListImp::buildGroupList(metadata_list_type whence) vector<pair <int, QString> > genres = data->GetGenres(); - for (vector<pair <int, QString> >::iterator i = - genres.begin(); i != genres.end(); ++i) + for (auto i = genres.begin(); i != genres.end(); ++i) { pair<int, QString> item = *i; groups.push_back(item.second); @@ -852,8 +851,7 @@ void VideoListImp::buildGroupList(metadata_list_type whence) { vector<pair<int, QString> > cast = data->GetCast(); - for (vector<pair<int, QString> >::iterator i = - cast.begin(); i != cast.end(); ++i) + for (auto i = cast.begin(); i != cast.end(); ++i) { pair<int, QString> item = *i; groups.push_back(item.second); @@ -895,8 +893,7 @@ void VideoListImp::buildGroupList(metadata_list_type whence) group_node->addEntry(smart_meta_node(new meta_data_node(data))); } - for (vector<QString>::iterator i = groups.begin(); - i != groups.end(); ++i) + for (auto i = groups.begin(); i != groups.end(); ++i) { QString item = *i; @@ -938,7 +935,7 @@ void VideoListImp::buildTVList(void) smart_dir_node vdn = video_root->addSubDir(QObject::tr("Movies")); meta_dir_node* movie_node = vdn.get(); - for (metadata_view_list::iterator p = mlist.begin(); p != mlist.end(); ++p) + for (auto p = mlist.begin(); p != mlist.end(); ++p) { VideoMetadata *data = *p; @@ -977,7 +974,7 @@ void VideoListImp::buildDbList() sort(mlist.begin(), mlist.end(), mps); // TODO: break out the prefix in the DB so this isn't needed - typedef map<QString, meta_dir_node *> prefix_to_node_map; + using prefix_to_node_map = map<QString, meta_dir_node *>; prefix_to_node_map ptnm; QStringList dirs = GetVideoDirs(); @@ -996,7 +993,7 @@ void VideoListImp::buildDbList() ptnm.insert(prefix_to_node_map::value_type(test_prefix, video_root)); } - for (metadata_view_list::iterator p = mlist.begin(); p != mlist.end(); ++p) + for (auto p = mlist.begin(); p != mlist.end(); ++p) { AddMetadataToDir(*p, video_root); } @@ -1010,7 +1007,7 @@ void VideoListImp::buildFsysList() // Fill metadata from directory structure // - typedef vector<pair<QString, QString> > node_to_path_list; + using node_to_path_list = vector<pair<QString, QString> >; node_to_path_list node_paths; @@ -1035,8 +1032,7 @@ void VideoListImp::buildFsysList() // Add all root-nodes to the tree. // metadata_list ml; - for (node_to_path_list::iterator p = node_paths.begin(); - p != node_paths.end(); ++p) + for (auto p = node_paths.begin(); p != node_paths.end(); ++p) { smart_dir_node root = m_metadataTree.addSubDir(p->second, p->first); root->setPathRoot(); @@ -1057,7 +1053,7 @@ void VideoListImp::buildFsysList() metadata_list db_metadata; VideoMetadataListManager::loadAllFromDatabase(db_metadata); mdlm.setList(db_metadata); - for (metadata_list::iterator p = ml.begin(); p != ml.end(); ++p) + for (auto p = ml.begin(); p != ml.end(); ++p) { (*p)->FillDataFromFilename(mdlm); } @@ -1069,8 +1065,7 @@ void VideoListImp::buildFsysList() static void copy_entries(meta_dir_node &dst, meta_dir_node &src, const VideoFilterSettings &filter) { - for (meta_dir_node::entry_iterator e = src.entries_begin(); - e != src.entries_end(); ++e) + for (auto e = src.entries_begin(); e != src.entries_end(); ++e) { if (filter.matches_filter(*((*e)->getData()))) { @@ -1084,8 +1079,7 @@ static void copy_filtered_tree(meta_dir_node &dst, meta_dir_node &src, const VideoFilterSettings &filter) { copy_entries(dst, src, filter); - for (meta_dir_node::dir_iterator dir = src.dirs_begin(); - dir != src.dirs_end(); ++dir) + for (auto dir = src.dirs_begin(); dir != src.dirs_end(); ++dir) { smart_dir_node sdn = dst.addSubDir((*dir)->getPath(), (*dir)->getName(), @@ -1130,8 +1124,8 @@ void VideoListImp::update_meta_view(bool flat_list) if (flat_list) { - for (metadata_list::const_iterator p = m_metadata.getList().begin(); - p != m_metadata.getList().end(); ++p) + for (auto p = m_metadata.getList().cbegin(); + p != m_metadata.getList().cend(); ++p) { if (m_videoFilter.matches_filter(*(*p))) { @@ -1141,7 +1135,7 @@ void VideoListImp::update_meta_view(bool flat_list) sort_view_data(flat_list); - for (metadata_view_list::iterator p = m_metadataViewFlat.begin(); + for (auto p = m_metadataViewFlat.begin(); p != m_metadataViewFlat.end(); ++p) { m_metadataViewTree.addEntry(new meta_data_node(*p)); @@ -1163,7 +1157,7 @@ void VideoListImp::update_meta_view(bool flat_list) class dirhandler : public DirectoryHandler { public: - typedef list<simple_ref_ptr<DirectoryHandler> > free_list; + using free_list = list<simple_ref_ptr<DirectoryHandler> >; public: dirhandler(smart_dir_node &directory, const QString &prefix, diff --git a/mythtv/programs/mythfrontend/videoplayercommand.cpp b/mythtv/programs/mythfrontend/videoplayercommand.cpp index 28cded04845..c0161567f75 100644 --- a/mythtv/programs/mythfrontend/videoplayercommand.cpp +++ b/mythtv/programs/mythfrontend/videoplayercommand.cpp @@ -185,8 +185,8 @@ class VideoPlayerCommandPrivate VideoPlayerCommandPrivate(const VideoPlayerCommandPrivate &other) { - for (player_list::const_iterator p = other.m_playerProcs.begin(); - p != other.m_playerProcs.end(); ++p) + for (auto p = other.m_playerProcs.cbegin(); + p != other.m_playerProcs.cend(); ++p) { m_playerProcs.push_back((*p)->Clone()); } @@ -272,8 +272,7 @@ class VideoPlayerCommandPrivate const FileAssociations::association_list fa_list = FileAssociations::getFileAssociation().getList(); - for (FileAssociations::association_list::const_iterator p = - fa_list.begin(); p != fa_list.end(); ++p) + for (auto p = fa_list.cbegin(); p != fa_list.cend(); ++p) { if (p->extension.toLower() == extension.toLower() && !p->use_default) @@ -317,8 +316,7 @@ class VideoPlayerCommandPrivate void ClearPlayerList() { - for (player_list::iterator p = m_playerProcs.begin(); - p != m_playerProcs.end(); ++p) + for (auto p = m_playerProcs.begin(); p != m_playerProcs.end(); ++p) { delete *p; } @@ -327,8 +325,7 @@ class VideoPlayerCommandPrivate void Play() const { - for (player_list::const_iterator p = m_playerProcs.begin(); - p != m_playerProcs.end(); ++p) + for (auto p = m_playerProcs.cbegin(); p != m_playerProcs.cend(); ++p) { if ((*p)->Play()) break; } @@ -354,7 +351,7 @@ class VideoPlayerCommandPrivate } private: - typedef std::vector<VideoPlayProc *> player_list; + using player_list = std::vector<VideoPlayProc *>; player_list m_playerProcs; }; diff --git a/mythtv/programs/mythfrontend/videoplayersettings.cpp b/mythtv/programs/mythfrontend/videoplayersettings.cpp index 374e120c2a8..85aa647a914 100644 --- a/mythtv/programs/mythfrontend/videoplayersettings.cpp +++ b/mythtv/programs/mythfrontend/videoplayersettings.cpp @@ -144,21 +144,21 @@ void PlayerSettings::toggleAlt() void PlayerSettings::fillRegionList() { - MythUIButtonListItem *noRegion = + auto *noRegion = new MythUIButtonListItem(m_blurayRegionList, tr("No Region")); noRegion->SetData(0); - MythUIButtonListItem *regionA = + auto *regionA = new MythUIButtonListItem(m_blurayRegionList, tr("Region A: " "The Americas, Southeast Asia, Japan")); regionA->SetData(1); - MythUIButtonListItem *regionB = + auto *regionB = new MythUIButtonListItem(m_blurayRegionList, tr("Region B: " "Europe, Middle East, Africa, Oceania")); regionB->SetData(2); - MythUIButtonListItem *regionC = + auto *regionC = new MythUIButtonListItem(m_blurayRegionList, tr("Region C: " "Eastern Europe, Central and South Asia")); regionC->SetData(4); diff --git a/mythtv/programs/mythfrontend/viewscheduled.cpp b/mythtv/programs/mythfrontend/viewscheduled.cpp index 68c031a7960..ec196e9de09 100644 --- a/mythtv/programs/mythfrontend/viewscheduled.cpp +++ b/mythtv/programs/mythfrontend/viewscheduled.cpp @@ -32,8 +32,7 @@ void *ViewScheduled::RunViewScheduled(void *player, bool showTV) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ViewScheduled *vsb = new ViewScheduled(mainStack, static_cast<TV*>(player), - showTV); + auto *vsb = new ViewScheduled(mainStack, static_cast<TV*>(player), showTV); if (vsb->Create()) mainStack->AddScreen(vsb, (player == nullptr)); @@ -200,8 +199,7 @@ void ViewScheduled::ShowMenu(void) QString label = tr("Options"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(label, popupStack, - "menuPopup"); + auto *menuPopup = new MythDialogBox(label, popupStack, "menuPopup"); if (menuPopup->Create()) { @@ -244,8 +242,7 @@ void ViewScheduled::LoadList(bool useExistingData) if (currentItem) { - ProgramInfo *currentpginfo = currentItem->GetData() - .value<ProgramInfo*>(); + auto *currentpginfo = currentItem->GetData().value<ProgramInfo*>(); if (currentpginfo) { callsign = currentpginfo->GetChannelSchedulingID(); @@ -267,7 +264,7 @@ void ViewScheduled::LoadList(bool useExistingData) if (!useExistingData) LoadFromScheduler(m_recList, m_conflictBool); - ProgramList::iterator pit = m_recList.begin(); + auto pit = m_recList.begin(); QString currentDate; m_recgroupList[m_defaultGroup] = ProgramList(false); m_recgroupList[m_defaultGroup].setAutoDelete(false); @@ -396,7 +393,7 @@ void ViewScheduled::FillList() plist = m_recgroupList[m_currentGroup]; - ProgramList::iterator pit = plist.begin(); + auto pit = plist.begin(); while (pit != plist.end()) { ProgramInfo *pginfo = *pit; @@ -440,9 +437,8 @@ void ViewScheduled::FillList() else state = "warning"; - MythUIButtonListItem *item = - new MythUIButtonListItem(m_schedulesList,"", - qVariantFromValue(pginfo)); + auto *item = new MythUIButtonListItem(m_schedulesList,"", + qVariantFromValue(pginfo)); InfoMap infoMap; pginfo->ToMap(infoMap); @@ -500,7 +496,7 @@ void ViewScheduled::updateInfo(MythUIButtonListItem *item) if (!item) return; - ProgramInfo *pginfo = item->GetData().value<ProgramInfo*> (); + auto *pginfo = item->GetData().value<ProgramInfo*> (); if (pginfo) { InfoMap infoMap; @@ -524,11 +520,11 @@ void ViewScheduled::deleteRule() if (!item) return; - ProgramInfo *pginfo = item->GetData().value<ProgramInfo*>(); + auto *pginfo = item->GetData().value<ProgramInfo*>(); if (!pginfo) return; - RecordingRule *record = new RecordingRule(); + auto *record = new RecordingRule(); if (!record->LoadByProgram(pginfo)) { delete record; @@ -540,8 +536,7 @@ void ViewScheduled::deleteRule() MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythConfirmationDialog *okPopup = new MythConfirmationDialog(popupStack, - message, true); + auto *okPopup = new MythConfirmationDialog(popupStack, message, true); okPopup->SetReturnEvent(this, "deleterule"); okPopup->SetData(qVariantFromValue(record)); @@ -582,7 +577,7 @@ void ViewScheduled::customEvent(QEvent *event) { if (event->type() == MythEvent::MythEventMessage) { - MythEvent *me = static_cast<MythEvent *>(event); + auto *me = static_cast<MythEvent *>(event); const QString& message = me->Message(); if (message != "SCHEDULE_CHANGE") @@ -601,7 +596,7 @@ void ViewScheduled::customEvent(QEvent *event) } else if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); + auto *dce = (DialogCompletionEvent*)(event); QString resultid = dce->GetId(); QString resulttext = dce->GetResultText(); @@ -609,8 +604,7 @@ void ViewScheduled::customEvent(QEvent *event) if (resultid == "deleterule") { - RecordingRule *record = - dce->GetData().value<RecordingRule *>(); + auto *record = dce->GetData().value<RecordingRule *>(); if (record) { if (buttonnum > 0) diff --git a/mythtv/programs/mythfrontend/viewschedulediff.cpp b/mythtv/programs/mythfrontend/viewschedulediff.cpp index 0614f7e0c6d..35ada16c720 100644 --- a/mythtv/programs/mythfrontend/viewschedulediff.cpp +++ b/mythtv/programs/mythfrontend/viewschedulediff.cpp @@ -124,8 +124,8 @@ void ViewScheduleDiff::showStatus(MythUIButtonListItem */*item*/) QString title = QObject::tr("Program Status"); MythScreenStack *mainStack = GetMythMainWindow()->GetStack("main stack"); - MythDialogBox *dlg = new MythDialogBox(title, message, mainStack, - "statusdialog", true); + auto *dlg = new MythDialogBox(title, message, mainStack, + "statusdialog", true); if (dlg->Create()) { @@ -192,7 +192,7 @@ void ViewScheduleDiff::fillList(void) QDateTime now = MythDate::current(); - ProgramList::iterator it = m_recListBefore.begin(); + auto it = m_recListBefore.begin(); while (it != m_recListBefore.end()) { if ((*it)->GetRecordingEndTime() >= now || @@ -220,8 +220,8 @@ void ViewScheduleDiff::fillList(void) } } - ProgramList::iterator pb = m_recListBefore.begin(); - ProgramList::iterator pa = m_recListAfter.begin(); + auto pb = m_recListBefore.begin(); + auto pa = m_recListAfter.begin(); ProgramStruct s; m_recList.clear(); @@ -279,8 +279,8 @@ void ViewScheduleDiff::updateUIList(void) if (!pginfo) pginfo = s.m_before; - MythUIButtonListItem *item = new MythUIButtonListItem( - m_conflictList, "", qVariantFromValue(pginfo)); + auto *item = new MythUIButtonListItem(m_conflictList, "", + qVariantFromValue(pginfo)); InfoMap infoMap; pginfo->ToMap(infoMap); @@ -319,7 +319,7 @@ void ViewScheduleDiff::updateInfo(MythUIButtonListItem *item) if (!item) return; - ProgramInfo *pginfo = item->GetData().value<ProgramInfo*> (); + auto *pginfo = item->GetData().value<ProgramInfo*> (); if (pginfo) { InfoMap infoMap; diff --git a/mythtv/programs/mythjobqueue/main.cpp b/mythtv/programs/mythjobqueue/main.cpp index eebae4ccc44..4618d759b7e 100644 --- a/mythtv/programs/mythjobqueue/main.cpp +++ b/mythtv/programs/mythjobqueue/main.cpp @@ -119,9 +119,9 @@ int main(int argc, char *argv[]) jobqueue = new JobQueue(false); - MythSystemEventHandler *sysEventHandler = new MythSystemEventHandler(); + auto *sysEventHandler = new MythSystemEventHandler(); - HouseKeeper *housekeeping = new HouseKeeper(); + auto *housekeeping = new HouseKeeper(); #ifdef __linux__ #ifdef CONFIG_BINDINGS_PYTHON housekeeping->RegisterTask(new HardwareProfileTask()); diff --git a/mythtv/programs/mythlcdserver/lcdprocclient.cpp b/mythtv/programs/mythlcdserver/lcdprocclient.cpp index 329508c23fa..44f532737b7 100644 --- a/mythtv/programs/mythlcdserver/lcdprocclient.cpp +++ b/mythtv/programs/mythlcdserver/lcdprocclient.cpp @@ -2388,7 +2388,7 @@ void LCDProcClient::customEvent(QEvent *e) { if (e->type() == MythEvent::MythEventMessage) { - MythEvent *me = static_cast<MythEvent *>(e); + auto *me = static_cast<MythEvent *>(e); if (me->Message().startsWith("RECORDING_LIST_CHANGE") || me->Message() == "UPDATE_PROG_INFO") diff --git a/mythtv/programs/mythlcdserver/lcdserver.cpp b/mythtv/programs/mythlcdserver/lcdserver.cpp index 63698102f13..88de28b235f 100644 --- a/mythtv/programs/mythlcdserver/lcdserver.cpp +++ b/mythtv/programs/mythlcdserver/lcdserver.cpp @@ -119,7 +119,7 @@ void LCDServer::newConnection(QTcpSocket *socket) void LCDServer::endConnection(void) { - QTcpSocket *socket = dynamic_cast<QTcpSocket*>(sender()); + auto *socket = dynamic_cast<QTcpSocket*>(sender()); if (socket) { socket->close(); @@ -134,8 +134,7 @@ void LCDServer::endConnection(void) void LCDServer::readSocket() { - QTcpSocket *socket = dynamic_cast<QTcpSocket*>(sender()); - + auto *socket = dynamic_cast<QTcpSocket*>(sender()); if (socket) { m_lastSocket = socket; diff --git a/mythtv/programs/mythlcdserver/main.cpp b/mythtv/programs/mythlcdserver/main.cpp index c1d21a92984..01ba4ca3bbf 100644 --- a/mythtv/programs/mythlcdserver/main.cpp +++ b/mythtv/programs/mythlcdserver/main.cpp @@ -130,8 +130,7 @@ int main(int argc, char **argv) assigned_port = special_port; } - LCDServer *server = - new LCDServer(assigned_port, startup_message, message_time); + auto *server = new LCDServer(assigned_port, startup_message, message_time); QCoreApplication::exec(); diff --git a/mythtv/programs/mythmediaserver/main.cpp b/mythtv/programs/mythmediaserver/main.cpp index 33f6418c750..f4814eaf31b 100644 --- a/mythtv/programs/mythmediaserver/main.cpp +++ b/mythtv/programs/mythmediaserver/main.cpp @@ -140,7 +140,7 @@ int main(int argc, char *argv[]) } ms_sd_notify("STATUS=Creating socket manager"); - MythSocketManager *sockmanager = new MythSocketManager(); + auto *sockmanager = new MythSocketManager(); if (!sockmanager->Listen(port)) { LOG(VB_GENERAL, LOG_ERR, @@ -153,11 +153,11 @@ int main(int argc, char *argv[]) sockmanager->RegisterHandler(new FileServerHandler()); sockmanager->RegisterHandler(new MessageHandler()); - ControlRequestHandler *controlRequestHandler = new ControlRequestHandler(); + auto *controlRequestHandler = new ControlRequestHandler(); sockmanager->RegisterHandler(controlRequestHandler); controlRequestHandler->ConnectToMaster(); - MythSystemEventHandler *sysEventHandler = new MythSystemEventHandler(); + auto *sysEventHandler = new MythSystemEventHandler(); // Provide systemd ready notification (for type=notify units) ms_sd_notify("STATUS="); diff --git a/mythtv/programs/mythmetadatalookup/lookup.cpp b/mythtv/programs/mythmetadatalookup/lookup.cpp index f833454cdcb..5d5a8fa96f0 100644 --- a/mythtv/programs/mythmetadatalookup/lookup.cpp +++ b/mythtv/programs/mythmetadatalookup/lookup.cpp @@ -37,7 +37,7 @@ void LookerUpper::HandleSingleRecording(const uint chanid, const QDateTime &starttime, bool updaterules) { - ProgramInfo *pginfo = new ProgramInfo(chanid, starttime); + auto *pginfo = new ProgramInfo(chanid, starttime); if (!pginfo) { @@ -67,7 +67,7 @@ void LookerUpper::HandleAllRecordings(bool updaterules) for( int n = 0; n < (int)progList.size(); n++) { - ProgramInfo *pginfo = new ProgramInfo(*(progList[n])); + auto *pginfo = new ProgramInfo(*(progList[n])); if ((pginfo->GetRecordingGroup() != "Deleted") && (pginfo->GetRecordingGroup() != "LiveTV") && (pginfo->GetInetRef().isEmpty() || @@ -97,7 +97,7 @@ void LookerUpper::HandleAllRecordingRules() for( int n = 0; n < (int)recordingList.size(); n++) { - ProgramInfo *pginfo = new ProgramInfo(*(recordingList[n])); + auto *pginfo = new ProgramInfo(*(recordingList[n])); if (pginfo->GetInetRef().isEmpty()) { QString msg = QString("Looking up: %1 %2").arg(pginfo->GetTitle()) @@ -127,7 +127,7 @@ void LookerUpper::HandleAllArtwork(bool aggressive) for( int n = 0; n < (int)recordingList.size(); n++) { - ProgramInfo *pginfo = new ProgramInfo(*(recordingList[n])); + auto *pginfo = new ProgramInfo(*(recordingList[n])); bool dolookup = true; if (pginfo->GetInetRef().isEmpty()) @@ -161,7 +161,7 @@ void LookerUpper::HandleAllArtwork(bool aggressive) for( int n = 0; n < (int)progList.size(); n++) { - ProgramInfo *pginfo = new ProgramInfo(*(progList[n])); + auto *pginfo = new ProgramInfo(*(progList[n])); bool dolookup = true; @@ -206,10 +206,10 @@ void LookerUpper::CopyRuleInetrefsToRecordings() for( int n = 0; n < (int)progList.size(); n++) { - ProgramInfo *pginfo = new ProgramInfo(*(progList[n])); + auto *pginfo = new ProgramInfo(*(progList[n])); if (pginfo && pginfo->GetInetRef().isEmpty()) { - RecordingRule *rule = new RecordingRule(); + auto *rule = new RecordingRule(); rule->m_recordID = pginfo->GetRecordingRuleID(); rule->Load(); if (!rule->m_inetref.isEmpty()) @@ -231,7 +231,7 @@ void LookerUpper::customEvent(QEvent *levent) { if (levent->type() == MetadataFactoryMultiResult::kEventType) { - MetadataFactoryMultiResult *mfmr = dynamic_cast<MetadataFactoryMultiResult*>(levent); + auto *mfmr = dynamic_cast<MetadataFactoryMultiResult*>(levent); if (!mfmr) return; @@ -248,7 +248,7 @@ void LookerUpper::customEvent(QEvent *levent) for (int p = 0; p != list.size(); ++p) { - ProgramInfo *pginfo = list[p]->GetData().value<ProgramInfo *>(); + auto *pginfo = list[p]->GetData().value<ProgramInfo *>(); if (pginfo && (QString::compare(pginfo->GetTitle(), list[p]->GetBaseTitle(), Qt::CaseInsensitive)) == 0) { @@ -304,7 +304,7 @@ void LookerUpper::customEvent(QEvent *levent) if (yearindex > -1) { MetadataLookup *lookup = list[yearindex]; - ProgramInfo *pginfo = lookup->GetData().value<ProgramInfo *>(); + auto *pginfo = lookup->GetData().value<ProgramInfo *>(); if (lookup->GetSubtype() != kProbableGenericTelevision) pginfo->SaveSeasonEpisode(lookup->GetSeason(), lookup->GetEpisode()); pginfo->SaveInetRef(lookup->GetInetref()); @@ -316,7 +316,7 @@ void LookerUpper::customEvent(QEvent *levent) { LOG(VB_GENERAL, LOG_INFO, QString("Best match released %1").arg(exactTitleDate.toString())); MetadataLookup *lookup = exactTitleMeta; - ProgramInfo *pginfo = exactTitleMeta->GetData().value<ProgramInfo *>(); + auto *pginfo = exactTitleMeta->GetData().value<ProgramInfo *>(); if (lookup->GetSubtype() != kProbableGenericTelevision) pginfo->SaveSeasonEpisode(lookup->GetSeason(), lookup->GetEpisode()); pginfo->SaveInetRef(lookup->GetInetref()); @@ -328,7 +328,7 @@ void LookerUpper::customEvent(QEvent *levent) "You may wish to manually set the season, episode, and " "inetref in the 'Watch Recordings' screen."); - ProgramInfo *pginfo = list[0]->GetData().value<ProgramInfo *>(); + auto *pginfo = list[0]->GetData().value<ProgramInfo *>(); if (pginfo) { @@ -338,8 +338,7 @@ void LookerUpper::customEvent(QEvent *levent) } else if (levent->type() == MetadataFactorySingleResult::kEventType) { - MetadataFactorySingleResult *mfsr = - dynamic_cast<MetadataFactorySingleResult*>(levent); + auto *mfsr = dynamic_cast<MetadataFactorySingleResult*>(levent); if (!mfsr) return; @@ -349,7 +348,7 @@ void LookerUpper::customEvent(QEvent *levent) if (!lookup) return; - ProgramInfo *pginfo = lookup->GetData().value<ProgramInfo *>(); + auto *pginfo = lookup->GetData().value<ProgramInfo *>(); // This null check could hang us as this pginfo would then never be // removed @@ -380,7 +379,7 @@ void LookerUpper::customEvent(QEvent *levent) if (m_updaterules) { - RecordingRule *rule = new RecordingRule(); + auto *rule = new RecordingRule(); if (rule) { rule->LoadByProgram(pginfo); @@ -409,7 +408,7 @@ void LookerUpper::customEvent(QEvent *levent) } else if (levent->type() == MetadataFactoryNoResult::kEventType) { - MetadataFactoryNoResult *mfnr = dynamic_cast<MetadataFactoryNoResult*>(levent); + auto *mfnr = dynamic_cast<MetadataFactoryNoResult*>(levent); if (!mfnr) return; @@ -419,7 +418,7 @@ void LookerUpper::customEvent(QEvent *levent) if (!lookup) return; - ProgramInfo *pginfo = lookup->GetData().value<ProgramInfo *>(); + auto *pginfo = lookup->GetData().value<ProgramInfo *>(); // This null check could hang us as this pginfo would then never be removed if (!pginfo) diff --git a/mythtv/programs/mythmetadatalookup/main.cpp b/mythtv/programs/mythmetadatalookup/main.cpp index c90543a8213..462eb1dcbb8 100644 --- a/mythtv/programs/mythmetadatalookup/main.cpp +++ b/mythtv/programs/mythmetadatalookup/main.cpp @@ -106,7 +106,7 @@ int main(int argc, char *argv[]) MythTranslation::load("mythfrontend"); - LookerUpper *lookup = new LookerUpper(); + auto *lookup = new LookerUpper(); LOG(VB_GENERAL, LOG_INFO, "Testing grabbers and metadata sites for functionality..."); diff --git a/mythtv/programs/mythpreviewgen/main.cpp b/mythtv/programs/mythpreviewgen/main.cpp index 23589c72330..abf579f1675 100644 --- a/mythtv/programs/mythpreviewgen/main.cpp +++ b/mythtv/programs/mythpreviewgen/main.cpp @@ -112,8 +112,8 @@ int preview_helper(uint chanid, QDateTime starttime, return GENERIC_EXIT_NOT_OK; } - PreviewGenerator *previewgen = new PreviewGenerator( - pginfo, QString(), PreviewGenerator::kLocal); + auto *previewgen = new PreviewGenerator(pginfo, QString(), + PreviewGenerator::kLocal); if (previewFrameNumber >= 0) previewgen->SetPreviewTimeAsFrameNumber(previewFrameNumber); diff --git a/mythtv/programs/mythscreenwizard/main.cpp b/mythtv/programs/mythscreenwizard/main.cpp index 0d7cbba2213..6912e28f5c0 100644 --- a/mythtv/programs/mythscreenwizard/main.cpp +++ b/mythtv/programs/mythscreenwizard/main.cpp @@ -97,8 +97,7 @@ static void startAppearWiz(int _x, int _y, int _w, int _h) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ScreenWizard *screenwizard = new ScreenWizard(mainStack, - "screenwizard"); + auto *screenwizard = new ScreenWizard(mainStack, "screenwizard"); screenwizard->SetInitialSettings(_x, _y, _w, _h); if (screenwizard->Create()) diff --git a/mythtv/programs/mythscreenwizard/screenwizard.cpp b/mythtv/programs/mythscreenwizard/screenwizard.cpp index 3113161acba..7bf9fe300ac 100644 --- a/mythtv/programs/mythscreenwizard/screenwizard.cpp +++ b/mythtv/programs/mythscreenwizard/screenwizard.cpp @@ -353,7 +353,7 @@ void ScreenWizard::customEvent(QEvent *event) if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); + auto *dce = (DialogCompletionEvent*)(event); QString resultid = dce->GetId(); int buttonnum = dce->GetResult(); diff --git a/mythtv/programs/mythtranscode/audioreencodebuffer.cpp b/mythtv/programs/mythtranscode/audioreencodebuffer.cpp index 44a34c7c41b..7cce9724a65 100644 --- a/mythtv/programs/mythtranscode/audioreencodebuffer.cpp +++ b/mythtv/programs/mythtranscode/audioreencodebuffer.cpp @@ -44,7 +44,7 @@ void AudioBuffer::appendData(unsigned char *buffer, int len, int frames, // can't use av_realloc as it doesn't guarantee reallocated memory // to be 16 bytes aligned m_realsize = ((m_size + len) / ABLOCK_SIZE + 1 ) * ABLOCK_SIZE; - uint8_t *tmp = (uint8_t *)av_malloc(m_realsize); + auto *tmp = (uint8_t *)av_malloc(m_realsize); if (tmp == nullptr) { throw std::bad_alloc(); @@ -138,7 +138,7 @@ bool AudioReencodeBuffer::AddFrames(void *buffer, int frames, int64_t timecode) bool AudioReencodeBuffer::AddData(void *buffer, int len, int64_t timecode, int frames) { - unsigned char *buf = (unsigned char *)buffer; + auto *buf = (unsigned char *)buffer; // Test if target is using a fixed buffer size. if (m_audioFrameSize) diff --git a/mythtv/programs/mythtranscode/main.cpp b/mythtv/programs/mythtranscode/main.cpp index c1c0d01a95f..140adacf747 100644 --- a/mythtv/programs/mythtranscode/main.cpp +++ b/mythtv/programs/mythtranscode/main.cpp @@ -544,7 +544,7 @@ int main(int argc, char *argv[]) if (jobID >= 0) JobQueue::ChangeJobStatus(jobID, JOB_RUNNING); - Transcode *transcode = new Transcode(pginfo); + auto *transcode = new Transcode(pginfo); if (!build_index) { @@ -642,7 +642,7 @@ int main(int argc, char *argv[]) check_func = &CheckJobQueue; } - MPEG2fixup *m2f = new MPEG2fixup(infile, outfile, + auto *m2f = new MPEG2fixup(infile, outfile, &deleteMap, nullptr, false, false, 20, showprogress, otype, update_func, check_func); diff --git a/mythtv/programs/mythtranscode/mpeg2fix.cpp b/mythtv/programs/mythtranscode/mpeg2fix.cpp index 8f6c42eabfe..1dbfa0ac5e4 100644 --- a/mythtv/programs/mythtranscode/mpeg2fix.cpp +++ b/mythtv/programs/mythtranscode/mpeg2fix.cpp @@ -460,7 +460,7 @@ int MPEG2fixup::FindMPEG2Header(const uint8_t *buf, int size, uint8_t code) // concurrently static int fill_buffers(void *r, int finish) { - MPEG2replex *rx = (MPEG2replex *)r; + auto *rx = (MPEG2replex *)r; if (finish) return 0; @@ -518,7 +518,7 @@ int MPEG2replex::WaitBuffers() void *MPEG2fixup::ReplexStart(void *data) { MThread::ThreadSetup("MPEG2Replex"); - MPEG2fixup *m2f = static_cast<MPEG2fixup *>(data); + auto *m2f = static_cast<MPEG2fixup *>(data); if (!m2f) return nullptr; m2f->m_rx.Start(); @@ -905,7 +905,7 @@ int MPEG2fixup::ProcessVideo(MPEG2frame *vf, mpeg2dec_t *dec) vf->m_isGop = false; } - mpeg2_info_t *info = (mpeg2_info_t *)mpeg2_info(dec); + auto *info = (mpeg2_info_t *)mpeg2_info(dec); mpeg2_buffer(dec, vf->m_pkt.data, vf->m_pkt.data + vf->m_pkt.size); @@ -1047,7 +1047,7 @@ void MPEG2fixup::WriteFrame(const QString& filename, AVPacket *pkt) WriteData(fname, pkt->data, pkt->size); mpeg2dec_t *tmp_decoder = mpeg2_init(); - mpeg2_info_t *info = (mpeg2_info_t *)mpeg2_info(tmp_decoder); + auto *info = (mpeg2_info_t *)mpeg2_info(tmp_decoder); while (!info->display_picture) { diff --git a/mythtv/programs/mythtranscode/mpeg2fix.h b/mythtv/programs/mythtranscode/mpeg2fix.h index dc79113d7da..6f302247743 100644 --- a/mythtv/programs/mythtranscode/mpeg2fix.h +++ b/mythtv/programs/mythtranscode/mpeg2fix.h @@ -60,12 +60,12 @@ class MPEG2frame mpeg2_picture_t m_mpeg2_pic; }; -typedef struct { +struct poq_idx_t { int64_t newPTS; int64_t pos_pts; int framenum; bool type; -} poq_idx_t; +}; class PTSOffsetQueue { @@ -110,9 +110,9 @@ class MPEG2replex multiplex_t *m_mplex {nullptr}; }; -typedef QList<MPEG2frame *> FrameList; -typedef QQueue<MPEG2frame *> FrameQueue; -typedef QMap<int, FrameList *> FrameMap; +using FrameList = QList<MPEG2frame *>; +using FrameQueue = QQueue<MPEG2frame *>; +using FrameMap = QMap<int, FrameList *>; class MPEG2fixup { diff --git a/mythtv/programs/mythtranscode/transcode.cpp b/mythtv/programs/mythtranscode/transcode.cpp index 2030f8f4187..2439117afcb 100644 --- a/mythtv/programs/mythtranscode/transcode.cpp +++ b/mythtv/programs/mythtranscode/transcode.cpp @@ -204,7 +204,7 @@ static bool get_bool_option(RecordingProfile *profile, const QString &name) static void TranscodeWriteText(void *ptr, unsigned char *buf, int len, int timecode, int pagenr) { - NuppelVideoRecorder *nvr = (NuppelVideoRecorder *)ptr; + auto *nvr = (NuppelVideoRecorder *)ptr; nvr->WriteText(buf, len, timecode, pagenr); } #endif // CONFIG_LIBMP3LAME @@ -264,7 +264,7 @@ int Transcode::TranscodeFile(const QString &inputname, } // Input setup - PlayerContext *player_ctx = new PlayerContext(kTranscoderInUseID); + auto *player_ctx = new PlayerContext(kTranscoderInUseID); player_ctx->SetPlayingInfo(m_proginfo); RingBuffer *rb = (hls && (hlsStreamID != -1)) ? RingBuffer::Create(hls->GetSourceFile(), false, false) : @@ -1078,7 +1078,7 @@ int Transcode::TranscodeFile(const QString &inputname, else LOG(VB_GENERAL, LOG_INFO, "Transcoding Video and Audio"); - VideoDecodeBuffer *videoBuffer = + auto *videoBuffer = new VideoDecodeBuffer(GetPlayer(), videoOutput, honorCutList); MThreadPool::globalInstance()->start(videoBuffer, "VideoDecodeBuffer"); @@ -1405,7 +1405,7 @@ int Transcode::TranscodeFile(const QString &inputname, AudioBuffer *ab = nullptr; while ((ab = arb->GetData(lastWrittenTime)) != nullptr) { - unsigned char *buf = (unsigned char *)ab->data(); + auto *buf = (unsigned char *)ab->data(); if (avfMode) { if (did_ff != 1) diff --git a/mythtv/programs/mythtranscode/transcode.h b/mythtv/programs/mythtranscode/transcode.h index 4223e131114..55e91d85cb5 100644 --- a/mythtv/programs/mythtranscode/transcode.h +++ b/mythtv/programs/mythtranscode/transcode.h @@ -9,7 +9,7 @@ class NuppelVideoRecorder; class MythPlayer; class RingBuffer; -typedef vector<struct kfatable_entry> KFATable; +using KFATable = vector<struct kfatable_entry>; class Transcode : public QObject { diff --git a/mythtv/programs/mythtranscode/videodecodebuffer.h b/mythtv/programs/mythtranscode/videodecodebuffer.h index 88ffe630765..e0c90b1bad5 100644 --- a/mythtv/programs/mythtranscode/videodecodebuffer.h +++ b/mythtv/programs/mythtranscode/videodecodebuffer.h @@ -25,12 +25,12 @@ class VideoDecodeBuffer : public QRunnable VideoFrame *GetFrame(int &didFF, bool &isKey); private: - typedef struct decodedFrameInfo + struct DecodedFrameInfo { VideoFrame *frame; int didFF; bool isKey; - } DecodedFrameInfo; + }; MythPlayer * const m_player {nullptr}; MythVideoOutput * const m_videoOutput {nullptr}; diff --git a/mythtv/programs/mythtv-setup/backendsettings.cpp b/mythtv/programs/mythtv-setup/backendsettings.cpp index febce9b7cdc..64bfb4344fc 100644 --- a/mythtv/programs/mythtv-setup/backendsettings.cpp +++ b/mythtv/programs/mythtv-setup/backendsettings.cpp @@ -11,7 +11,7 @@ static TransMythUICheckBoxSetting *IsMasterBackend() { - TransMythUICheckBoxSetting *gc = new TransMythUICheckBoxSetting(); + auto *gc = new TransMythUICheckBoxSetting(); gc->setLabel(QObject::tr("This server is the Master Backend")); gc->setValue(false); gc->setHelpText(QObject::tr( @@ -26,7 +26,7 @@ static TransMythUICheckBoxSetting *IsMasterBackend() static GlobalTextEditSetting *MasterServerName() { - GlobalTextEditSetting *gc = new GlobalTextEditSetting("MasterServerName"); + auto *gc = new GlobalTextEditSetting("MasterServerName"); gc->setLabel(QObject::tr("Master Backend Name")); gc->setValue(""); gc->setEnabled(false); @@ -38,7 +38,7 @@ static GlobalTextEditSetting *MasterServerName() static HostCheckBoxSetting *AllowConnFromAll() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("AllowConnFromAll"); + auto *gc = new HostCheckBoxSetting("AllowConnFromAll"); gc->setLabel(QObject::tr("Allow Connections from all Subnets")); gc->setValue(false); gc->setHelpText(QObject::tr( @@ -50,7 +50,7 @@ static HostCheckBoxSetting *AllowConnFromAll() static HostComboBoxSetting *LocalServerIP() { - HostComboBoxSetting *gc = new HostComboBoxSetting("BackendServerIP"); + auto *gc = new HostComboBoxSetting("BackendServerIP"); gc->setLabel(QObject::tr("IPv4 address")); QList<QHostAddress> list = QNetworkInterface::allAddresses(); QList<QHostAddress>::iterator it; @@ -72,7 +72,7 @@ static HostComboBoxSetting *LocalServerIP() static HostComboBoxSetting *LocalServerIP6() { - HostComboBoxSetting *gc = new HostComboBoxSetting("BackendServerIP6"); + auto *gc = new HostComboBoxSetting("BackendServerIP6"); gc->setLabel(QObject::tr("Listen on IPv6 address")); QList<QHostAddress> list = QNetworkInterface::allAddresses(); QList<QHostAddress>::iterator it; @@ -107,7 +107,7 @@ static HostComboBoxSetting *LocalServerIP6() static HostCheckBoxSetting *UseLinkLocal() { - HostCheckBoxSetting *hc = new HostCheckBoxSetting("AllowLinkLocal"); + auto *hc = new HostCheckBoxSetting("AllowLinkLocal"); hc->setLabel(QObject::tr("Listen on Link-Local addresses")); hc->setValue(true); hc->setHelpText(QObject::tr("Enable servers on this machine to listen on " @@ -145,7 +145,7 @@ class IpAddressSettings : public HostCheckBoxSetting static HostTextEditSetting *LocalServerPort() { - HostTextEditSetting *gc = new HostTextEditSetting("BackendServerPort"); + auto *gc = new HostTextEditSetting("BackendServerPort"); gc->setLabel(QObject::tr("Port")); gc->setValue("6543"); gc->setHelpText(QObject::tr("Unless you've got good reason, don't " @@ -155,7 +155,7 @@ static HostTextEditSetting *LocalServerPort() static HostTextEditSetting *LocalStatusPort() { - HostTextEditSetting *gc = new HostTextEditSetting("BackendStatusPort"); + auto *gc = new HostTextEditSetting("BackendStatusPort"); gc->setLabel(QObject::tr("Status port")); gc->setValue("6544"); gc->setHelpText(QObject::tr("Port on which the server will listen for " @@ -166,7 +166,7 @@ static HostTextEditSetting *LocalStatusPort() static HostComboBoxSetting *BackendServerAddr() { - HostComboBoxSetting *gc = new HostComboBoxSetting("BackendServerAddr", true); + auto *gc = new HostComboBoxSetting("BackendServerAddr", true); gc->setLabel(QObject::tr("Primary IP address / DNS name")); gc->setValue("127.0.0.1"); gc->setHelpText(QObject::tr("The Primary IP address of this backend " @@ -183,7 +183,7 @@ static HostComboBoxSetting *BackendServerAddr() // Deprecated static GlobalTextEditSetting *MasterServerIP() { - GlobalTextEditSetting *gc = new GlobalTextEditSetting("MasterServerIP"); + auto *gc = new GlobalTextEditSetting("MasterServerIP"); gc->setLabel(QObject::tr("IP address")); gc->setValue("127.0.0.1"); return gc; @@ -192,7 +192,7 @@ static GlobalTextEditSetting *MasterServerIP() // Deprecated static GlobalTextEditSetting *MasterServerPort() { - GlobalTextEditSetting *gc = new GlobalTextEditSetting("MasterServerPort"); + auto *gc = new GlobalTextEditSetting("MasterServerPort"); gc->setLabel(QObject::tr("Port")); gc->setValue("6543"); return gc; @@ -200,7 +200,7 @@ static GlobalTextEditSetting *MasterServerPort() static HostTextEditSetting *LocalSecurityPin() { - HostTextEditSetting *gc = new HostTextEditSetting("SecurityPin"); + auto *gc = new HostTextEditSetting("SecurityPin"); gc->setLabel(QObject::tr("Security PIN (required)")); gc->setValue(""); gc->setHelpText(QObject::tr("PIN code required for a frontend to connect " @@ -212,7 +212,7 @@ static HostTextEditSetting *LocalSecurityPin() static GlobalComboBoxSetting *TVFormat() { - GlobalComboBoxSetting *gc = new GlobalComboBoxSetting("TVFormat"); + auto *gc = new GlobalComboBoxSetting("TVFormat"); gc->setLabel(QObject::tr("TV format")); QStringList list = ChannelTVFormat::GetFormats(); @@ -225,7 +225,7 @@ static GlobalComboBoxSetting *TVFormat() static GlobalComboBoxSetting *VbiFormat() { - GlobalComboBoxSetting *gc = new GlobalComboBoxSetting("VbiFormat"); + auto *gc = new GlobalComboBoxSetting("VbiFormat"); gc->setLabel(QObject::tr("VBI format")); gc->addSelection("None"); gc->addSelection("PAL teletext"); @@ -238,7 +238,7 @@ static GlobalComboBoxSetting *VbiFormat() static GlobalComboBoxSetting *FreqTable() { - GlobalComboBoxSetting *gc = new GlobalComboBoxSetting("FreqTable"); + auto *gc = new GlobalComboBoxSetting("FreqTable"); gc->setLabel(QObject::tr("Channel frequency table")); for (uint i = 0; chanlists[i].name; i++) @@ -252,7 +252,7 @@ static GlobalComboBoxSetting *FreqTable() static GlobalCheckBoxSetting *SaveTranscoding() { - GlobalCheckBoxSetting *gc = new GlobalCheckBoxSetting("SaveTranscoding"); + auto *gc = new GlobalCheckBoxSetting("SaveTranscoding"); gc->setLabel(QObject::tr("Save original files after transcoding (globally)")); gc->setValue(false); gc->setHelpText(QObject::tr("If enabled and the transcoder is active, the " @@ -263,7 +263,7 @@ static GlobalCheckBoxSetting *SaveTranscoding() static HostCheckBoxSetting *TruncateDeletes() { - HostCheckBoxSetting *hc = new HostCheckBoxSetting("TruncateDeletesSlowly"); + auto *hc = new HostCheckBoxSetting("TruncateDeletesSlowly"); hc->setLabel(QObject::tr("Delete files slowly")); hc->setValue(false); hc->setHelpText(QObject::tr("Some filesystems use a lot of resources when " @@ -275,7 +275,7 @@ static HostCheckBoxSetting *TruncateDeletes() static GlobalCheckBoxSetting *DeletesFollowLinks() { - GlobalCheckBoxSetting *gc = new GlobalCheckBoxSetting("DeletesFollowLinks"); + auto *gc = new GlobalCheckBoxSetting("DeletesFollowLinks"); gc->setLabel(QObject::tr("Follow symbolic links when deleting files")); gc->setValue(false); gc->setHelpText(QObject::tr("If enabled, MythTV will follow symlinks " @@ -286,7 +286,7 @@ static GlobalCheckBoxSetting *DeletesFollowLinks() static GlobalSpinBoxSetting *HDRingbufferSize() { - GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting( + auto *bs = new GlobalSpinBoxSetting( "HDRingbufferSize", 25*188, 512*188, 25*188); bs->setLabel(QObject::tr("HD ringbuffer size (kB)")); bs->setHelpText(QObject::tr("The HD device ringbuffer allows the " @@ -301,7 +301,7 @@ static GlobalSpinBoxSetting *HDRingbufferSize() static GlobalComboBoxSetting *StorageScheduler() { - GlobalComboBoxSetting *gc = new GlobalComboBoxSetting("StorageScheduler"); + auto *gc = new GlobalComboBoxSetting("StorageScheduler"); gc->setLabel(QObject::tr("Storage Group disk scheduler")); gc->addSelection(QObject::tr("Balanced free space"), "BalancedFreeSpace"); gc->addSelection(QObject::tr("Balanced percent free space"), "BalancedPercFreeSpace"); @@ -317,7 +317,7 @@ static GlobalComboBoxSetting *StorageScheduler() static GlobalCheckBoxSetting *DisableAutomaticBackup() { - GlobalCheckBoxSetting *gc = new GlobalCheckBoxSetting("DisableAutomaticBackup"); + auto *gc = new GlobalCheckBoxSetting("DisableAutomaticBackup"); gc->setLabel(QObject::tr("Disable automatic database backup")); gc->setValue(false); gc->setHelpText(QObject::tr("If enabled, MythTV will not backup the " @@ -329,7 +329,7 @@ static GlobalCheckBoxSetting *DisableAutomaticBackup() static HostCheckBoxSetting *DisableFirewireReset() { - HostCheckBoxSetting *hc = new HostCheckBoxSetting("DisableFirewireReset"); + auto *hc = new HostCheckBoxSetting("DisableFirewireReset"); hc->setLabel(QObject::tr("Disable FireWire reset")); hc->setHelpText( QObject::tr( @@ -343,7 +343,7 @@ static HostCheckBoxSetting *DisableFirewireReset() static HostTextEditSetting *MiscStatusScript() { - HostTextEditSetting *he = new HostTextEditSetting("MiscStatusScript"); + auto *he = new HostTextEditSetting("MiscStatusScript"); he->setLabel(QObject::tr("Miscellaneous status application")); he->setValue(""); he->setHelpText(QObject::tr("External application or script that outputs " @@ -355,7 +355,7 @@ static HostTextEditSetting *MiscStatusScript() static GlobalSpinBoxSetting *EITTransportTimeout() { - GlobalSpinBoxSetting *gc = new GlobalSpinBoxSetting("EITTransportTimeout", 1, 15, 1); + auto *gc = new GlobalSpinBoxSetting("EITTransportTimeout", 1, 15, 1); gc->setLabel(QObject::tr("EIT transport timeout (mins)")); gc->setValue(5); QString helpText = QObject::tr( @@ -368,7 +368,7 @@ static GlobalSpinBoxSetting *EITTransportTimeout() static GlobalCheckBoxSetting *MasterBackendOverride() { - GlobalCheckBoxSetting *gc = new GlobalCheckBoxSetting("MasterBackendOverride"); + auto *gc = new GlobalCheckBoxSetting("MasterBackendOverride"); gc->setLabel(QObject::tr("Master backend override")); gc->setValue(true); gc->setHelpText(QObject::tr("If enabled, the master backend will stream and" @@ -380,7 +380,7 @@ static GlobalCheckBoxSetting *MasterBackendOverride() static GlobalSpinBoxSetting *EITCrawIdleStart() { - GlobalSpinBoxSetting *gc = new GlobalSpinBoxSetting("EITCrawIdleStart", 30, 7200, 30); + auto *gc = new GlobalSpinBoxSetting("EITCrawIdleStart", 30, 7200, 30); gc->setLabel(QObject::tr("Backend idle before EIT crawl (secs)")); gc->setValue(60); QString help = QObject::tr( @@ -392,7 +392,7 @@ static GlobalSpinBoxSetting *EITCrawIdleStart() static GlobalSpinBoxSetting *WOLbackendReconnectWaitTime() { - GlobalSpinBoxSetting *gc = new GlobalSpinBoxSetting("WOLbackendReconnectWaitTime", 0, 1200, 5); + auto *gc = new GlobalSpinBoxSetting("WOLbackendReconnectWaitTime", 0, 1200, 5); gc->setLabel(QObject::tr("Delay between wake attempts (secs)")); gc->setValue(0); gc->setHelpText(QObject::tr("Length of time the frontend waits between " @@ -404,7 +404,7 @@ static GlobalSpinBoxSetting *WOLbackendReconnectWaitTime() static GlobalSpinBoxSetting *WOLbackendConnectRetry() { - GlobalSpinBoxSetting *gc = new GlobalSpinBoxSetting("WOLbackendConnectRetry", 1, 60, 1); + auto *gc = new GlobalSpinBoxSetting("WOLbackendConnectRetry", 1, 60, 1); gc->setLabel(QObject::tr("Wake attempts")); gc->setHelpText(QObject::tr("Number of times the frontend will try to wake " "up the master backend.")); @@ -414,7 +414,7 @@ static GlobalSpinBoxSetting *WOLbackendConnectRetry() static GlobalTextEditSetting *WOLbackendCommand() { - GlobalTextEditSetting *gc = new GlobalTextEditSetting("WOLbackendCommand"); + auto *gc = new GlobalTextEditSetting("WOLbackendCommand"); gc->setLabel(QObject::tr("Wake command")); gc->setValue(""); gc->setHelpText(QObject::tr("The command used to wake up your master " @@ -424,7 +424,7 @@ static GlobalTextEditSetting *WOLbackendCommand() static HostTextEditSetting *SleepCommand() { - HostTextEditSetting *gc = new HostTextEditSetting("SleepCommand"); + auto *gc = new HostTextEditSetting("SleepCommand"); gc->setLabel(QObject::tr("Sleep command")); gc->setValue(""); gc->setHelpText(QObject::tr("The command used to put this slave to sleep. " @@ -435,7 +435,7 @@ static HostTextEditSetting *SleepCommand() static HostTextEditSetting *WakeUpCommand() { - HostTextEditSetting *gc = new HostTextEditSetting("WakeUpCommand"); + auto *gc = new HostTextEditSetting("WakeUpCommand"); gc->setLabel(QObject::tr("Wake command")); gc->setValue(""); gc->setHelpText(QObject::tr("The command used to wake up this slave " @@ -446,7 +446,7 @@ static HostTextEditSetting *WakeUpCommand() static GlobalTextEditSetting *BackendStopCommand() { - GlobalTextEditSetting *gc = new GlobalTextEditSetting("BackendStopCommand"); + auto *gc = new GlobalTextEditSetting("BackendStopCommand"); gc->setLabel(QObject::tr("Backend stop command")); gc->setValue("killall mythbackend"); gc->setHelpText(QObject::tr("The command used to stop the backend" @@ -457,7 +457,7 @@ static GlobalTextEditSetting *BackendStopCommand() static GlobalTextEditSetting *BackendStartCommand() { - GlobalTextEditSetting *gc = new GlobalTextEditSetting("BackendStartCommand"); + auto *gc = new GlobalTextEditSetting("BackendStartCommand"); gc->setLabel(QObject::tr("Backend start command")); gc->setValue("mythbackend"); gc->setHelpText(QObject::tr("The command used to start the backend" @@ -468,7 +468,7 @@ static GlobalTextEditSetting *BackendStartCommand() static GlobalSpinBoxSetting *idleTimeoutSecs() { - GlobalSpinBoxSetting *gc = new GlobalSpinBoxSetting("idleTimeoutSecs", 0, 1200, 5); + auto *gc = new GlobalSpinBoxSetting("idleTimeoutSecs", 0, 1200, 5); gc->setLabel(QObject::tr("Idle shutdown timeout (secs)")); gc->setValue(0); gc->setHelpText(QObject::tr("The number of seconds the master backend " @@ -479,7 +479,7 @@ static GlobalSpinBoxSetting *idleTimeoutSecs() static GlobalSpinBoxSetting *idleWaitForRecordingTime() { - GlobalSpinBoxSetting *gc = new GlobalSpinBoxSetting("idleWaitForRecordingTime", 0, 300, 1); + auto *gc = new GlobalSpinBoxSetting("idleWaitForRecordingTime", 0, 300, 1); gc->setLabel(QObject::tr("Maximum wait for recording (mins)")); gc->setValue(15); gc->setHelpText(QObject::tr("The number of minutes the master backend " @@ -491,7 +491,7 @@ static GlobalSpinBoxSetting *idleWaitForRecordingTime() static GlobalSpinBoxSetting *StartupSecsBeforeRecording() { - GlobalSpinBoxSetting *gc = new GlobalSpinBoxSetting("StartupSecsBeforeRecording", 0, 1200, 5); + auto *gc = new GlobalSpinBoxSetting("StartupSecsBeforeRecording", 0, 1200, 5); gc->setLabel(QObject::tr("Startup before recording (secs)")); gc->setValue(120); gc->setHelpText(QObject::tr("The number of seconds the master backend " @@ -501,7 +501,7 @@ static GlobalSpinBoxSetting *StartupSecsBeforeRecording() static GlobalTextEditSetting *WakeupTimeFormat() { - GlobalTextEditSetting *gc = new GlobalTextEditSetting("WakeupTimeFormat"); + auto *gc = new GlobalTextEditSetting("WakeupTimeFormat"); gc->setLabel(QObject::tr("Wakeup time format")); gc->setValue("hh:mm yyyy-MM-dd"); gc->setHelpText(QObject::tr("The format of the time string passed to the " @@ -513,7 +513,7 @@ static GlobalTextEditSetting *WakeupTimeFormat() static GlobalTextEditSetting *SetWakeuptimeCommand() { - GlobalTextEditSetting *gc = new GlobalTextEditSetting("SetWakeuptimeCommand"); + auto *gc = new GlobalTextEditSetting("SetWakeuptimeCommand"); gc->setLabel(QObject::tr("Command to set wakeup time")); gc->setValue(""); gc->setHelpText(QObject::tr("The command used to set the wakeup time " @@ -523,7 +523,7 @@ static GlobalTextEditSetting *SetWakeuptimeCommand() static GlobalTextEditSetting *ServerHaltCommand() { - GlobalTextEditSetting *gc = new GlobalTextEditSetting("ServerHaltCommand"); + auto *gc = new GlobalTextEditSetting("ServerHaltCommand"); gc->setLabel(QObject::tr("Server halt command")); gc->setValue("sudo /sbin/halt -p"); gc->setHelpText(QObject::tr("The command used to halt the backends.")); @@ -532,7 +532,7 @@ static GlobalTextEditSetting *ServerHaltCommand() static GlobalTextEditSetting *preSDWUCheckCommand() { - GlobalTextEditSetting *gc = new GlobalTextEditSetting("preSDWUCheckCommand"); + auto *gc = new GlobalTextEditSetting("preSDWUCheckCommand"); gc->setLabel(QObject::tr("Pre-shutdown-check command")); gc->setValue(""); gc->setHelpText(QObject::tr("A command executed before the backend would " @@ -545,7 +545,7 @@ static GlobalTextEditSetting *preSDWUCheckCommand() static GlobalCheckBoxSetting *blockSDWUwithoutClient() { - GlobalCheckBoxSetting *gc = new GlobalCheckBoxSetting("blockSDWUwithoutClient"); + auto *gc = new GlobalCheckBoxSetting("blockSDWUwithoutClient"); gc->setLabel(QObject::tr("Block shutdown before client connected")); gc->setValue(true); gc->setHelpText(QObject::tr("If enabled, the automatic shutdown routine will " @@ -555,7 +555,7 @@ static GlobalCheckBoxSetting *blockSDWUwithoutClient() static GlobalTextEditSetting *startupCommand() { - GlobalTextEditSetting *gc = new GlobalTextEditSetting("startupCommand"); + auto *gc = new GlobalTextEditSetting("startupCommand"); gc->setLabel(QObject::tr("Startup command")); gc->setValue(""); gc->setHelpText(QObject::tr("This command is executed right after starting " @@ -567,7 +567,7 @@ static GlobalTextEditSetting *startupCommand() static HostSpinBoxSetting *JobQueueMaxSimultaneousJobs() { - HostSpinBoxSetting *gc = new HostSpinBoxSetting("JobQueueMaxSimultaneousJobs", 1, 10, 1); + auto *gc = new HostSpinBoxSetting("JobQueueMaxSimultaneousJobs", 1, 10, 1); gc->setLabel(QObject::tr("Maximum simultaneous jobs on this backend")); gc->setHelpText(QObject::tr("The Job Queue will be limited to running " "this many simultaneous jobs on this backend.")); @@ -577,7 +577,7 @@ static HostSpinBoxSetting *JobQueueMaxSimultaneousJobs() static HostSpinBoxSetting *JobQueueCheckFrequency() { - HostSpinBoxSetting *gc = new HostSpinBoxSetting("JobQueueCheckFrequency", 5, 300, 5); + auto *gc = new HostSpinBoxSetting("JobQueueCheckFrequency", 5, 300, 5); gc->setLabel(QObject::tr("Job Queue check frequency (secs)")); gc->setHelpText(QObject::tr("When looking for new jobs to process, the " "Job Queue will wait this many seconds between checks.")); @@ -587,7 +587,7 @@ static HostSpinBoxSetting *JobQueueCheckFrequency() static HostComboBoxSetting *JobQueueCPU() { - HostComboBoxSetting *gc = new HostComboBoxSetting("JobQueueCPU"); + auto *gc = new HostComboBoxSetting("JobQueueCPU"); gc->setLabel(QObject::tr("CPU usage")); gc->addSelection(QObject::tr("Low"), "0"); gc->addSelection(QObject::tr("Medium"), "1"); @@ -601,7 +601,7 @@ static HostComboBoxSetting *JobQueueCPU() static HostTimeBoxSetting *JobQueueWindowStart() { - HostTimeBoxSetting *gc = new HostTimeBoxSetting("JobQueueWindowStart", "00:00"); + auto *gc = new HostTimeBoxSetting("JobQueueWindowStart", "00:00"); gc->setLabel(QObject::tr("Job Queue start time")); gc->setHelpText(QObject::tr("This setting controls the start of the " "Job Queue time window, which determines when new jobs " @@ -611,7 +611,7 @@ static HostTimeBoxSetting *JobQueueWindowStart() static HostTimeBoxSetting *JobQueueWindowEnd() { - HostTimeBoxSetting *gc = new HostTimeBoxSetting("JobQueueWindowEnd", "23:59"); + auto *gc = new HostTimeBoxSetting("JobQueueWindowEnd", "23:59"); gc->setLabel(QObject::tr("Job Queue end time")); gc->setHelpText(QObject::tr("This setting controls the end of the " "Job Queue time window, which determines when new jobs " @@ -621,7 +621,7 @@ static HostTimeBoxSetting *JobQueueWindowEnd() static GlobalCheckBoxSetting *JobsRunOnRecordHost() { - GlobalCheckBoxSetting *gc = new GlobalCheckBoxSetting("JobsRunOnRecordHost"); + auto *gc = new GlobalCheckBoxSetting("JobsRunOnRecordHost"); gc->setLabel(QObject::tr("Run jobs only on original recording backend")); gc->setValue(false); gc->setHelpText(QObject::tr("If enabled, jobs in the queue will be required " @@ -632,7 +632,7 @@ static GlobalCheckBoxSetting *JobsRunOnRecordHost() static GlobalCheckBoxSetting *AutoTranscodeBeforeAutoCommflag() { - GlobalCheckBoxSetting *gc = new GlobalCheckBoxSetting("AutoTranscodeBeforeAutoCommflag"); + auto *gc = new GlobalCheckBoxSetting("AutoTranscodeBeforeAutoCommflag"); gc->setLabel(QObject::tr("Run transcode jobs before auto commercial " "detection")); gc->setValue(false); @@ -645,7 +645,7 @@ static GlobalCheckBoxSetting *AutoTranscodeBeforeAutoCommflag() static GlobalCheckBoxSetting *AutoCommflagWhileRecording() { - GlobalCheckBoxSetting *gc = new GlobalCheckBoxSetting("AutoCommflagWhileRecording"); + auto *gc = new GlobalCheckBoxSetting("AutoCommflagWhileRecording"); gc->setLabel(QObject::tr("Start auto-commercial-detection jobs when the " "recording starts")); gc->setValue(false); @@ -658,7 +658,7 @@ static GlobalCheckBoxSetting *AutoCommflagWhileRecording() static GlobalTextEditSetting *UserJob(uint job_num) { - GlobalTextEditSetting *gc = new GlobalTextEditSetting(QString("UserJob%1").arg(job_num)); + auto *gc = new GlobalTextEditSetting(QString("UserJob%1").arg(job_num)); gc->setLabel(QObject::tr("User Job #%1 command").arg(job_num)); gc->setValue(""); gc->setHelpText(QObject::tr("The command to run whenever this User Job " @@ -668,7 +668,7 @@ static GlobalTextEditSetting *UserJob(uint job_num) static GlobalTextEditSetting *UserJobDesc(uint job_num) { - GlobalTextEditSetting *gc = new GlobalTextEditSetting(QString("UserJobDesc%1") + auto *gc = new GlobalTextEditSetting(QString("UserJobDesc%1") .arg(job_num)); gc->setLabel(QObject::tr("User Job #%1 description").arg(job_num)); gc->setValue(QObject::tr("User Job #%1").arg(job_num)); @@ -678,7 +678,7 @@ static GlobalTextEditSetting *UserJobDesc(uint job_num) static HostCheckBoxSetting *JobAllowMetadata() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("JobAllowMetadata"); + auto *gc = new HostCheckBoxSetting("JobAllowMetadata"); gc->setLabel(QObject::tr("Allow metadata lookup jobs")); gc->setValue(true); gc->setHelpText(QObject::tr("If enabled, allow jobs of this type to " @@ -688,7 +688,7 @@ static HostCheckBoxSetting *JobAllowMetadata() static HostCheckBoxSetting *JobAllowCommFlag() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("JobAllowCommFlag"); + auto *gc = new HostCheckBoxSetting("JobAllowCommFlag"); gc->setLabel(QObject::tr("Allow commercial-detection jobs")); gc->setValue(true); gc->setHelpText(QObject::tr("If enabled, allow jobs of this type to " @@ -698,7 +698,7 @@ static HostCheckBoxSetting *JobAllowCommFlag() static HostCheckBoxSetting *JobAllowTranscode() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("JobAllowTranscode"); + auto *gc = new HostCheckBoxSetting("JobAllowTranscode"); gc->setLabel(QObject::tr("Allow transcoding jobs")); gc->setValue(true); gc->setHelpText(QObject::tr("If enabled, allow jobs of this type to " @@ -708,7 +708,7 @@ static HostCheckBoxSetting *JobAllowTranscode() static HostCheckBoxSetting *JobAllowPreview() { - HostCheckBoxSetting *gc = new HostCheckBoxSetting("JobAllowPreview"); + auto *gc = new HostCheckBoxSetting("JobAllowPreview"); gc->setLabel(QObject::tr("Allow preview jobs")); gc->setValue(true); gc->setHelpText(QObject::tr("If enabled, allow jobs of this type to " @@ -718,7 +718,7 @@ static HostCheckBoxSetting *JobAllowPreview() static GlobalTextEditSetting *JobQueueTranscodeCommand() { - GlobalTextEditSetting *gc = new GlobalTextEditSetting("JobQueueTranscodeCommand"); + auto *gc = new GlobalTextEditSetting("JobQueueTranscodeCommand"); gc->setLabel(QObject::tr("Transcoder command")); gc->setValue("mythtranscode"); gc->setHelpText(QObject::tr("The program used to transcode recordings. " @@ -728,7 +728,7 @@ static GlobalTextEditSetting *JobQueueTranscodeCommand() static GlobalTextEditSetting *JobQueueCommFlagCommand() { - GlobalTextEditSetting *gc = new GlobalTextEditSetting("JobQueueCommFlagCommand"); + auto *gc = new GlobalTextEditSetting("JobQueueCommFlagCommand"); gc->setLabel(QObject::tr("Commercial-detection command")); gc->setValue("mythcommflag"); gc->setHelpText(QObject::tr("The program used to detect commercials in a " @@ -743,7 +743,7 @@ static HostCheckBoxSetting *JobAllowUserJob(uint job_num) QString desc = gCoreContext->GetSetting(QString("UserJobDesc%1").arg(job_num)); QString label = QObject::tr("Allow %1 jobs").arg(desc); - HostCheckBoxSetting *bc = new HostCheckBoxSetting(dbStr); + auto *bc = new HostCheckBoxSetting(dbStr); bc->setLabel(label); bc->setValue(false); // FIXME: @@ -774,7 +774,7 @@ static GlobalCheckBoxSetting *UPNPShowRecordingUnderVideos() static GlobalComboBoxSetting *UPNPWmpSource() { - GlobalComboBoxSetting *gc = new GlobalComboBoxSetting("UPnP/WMPSource"); + auto *gc = new GlobalComboBoxSetting("UPnP/WMPSource"); gc->setLabel(QObject::tr("Video content to show a WMP client")); gc->addSelection(QObject::tr("Recordings"),"0"); gc->addSelection(QObject::tr("Videos"),"1"); @@ -786,7 +786,7 @@ static GlobalComboBoxSetting *UPNPWmpSource() static GlobalCheckBoxSetting *MythFillEnabled() { - GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("MythFillEnabled"); + auto *bc = new GlobalCheckBoxSetting("MythFillEnabled"); bc->setLabel(QObject::tr("Automatically update program listings")); bc->setValue(true); bc->setHelpText(QObject::tr("If enabled, the guide data program " @@ -796,7 +796,7 @@ static GlobalCheckBoxSetting *MythFillEnabled() static GlobalSpinBoxSetting *MythFillMinHour() { - GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("MythFillMinHour", 0, 23, 1); + auto *bs = new GlobalSpinBoxSetting("MythFillMinHour", 0, 23, 1); bs->setLabel(QObject::tr("Guide data program execution start")); bs->setValue(0); bs->setHelpText(QObject::tr("This setting and the following one define a " @@ -809,7 +809,7 @@ static GlobalSpinBoxSetting *MythFillMinHour() static GlobalSpinBoxSetting *MythFillMaxHour() { - GlobalSpinBoxSetting *bs = new GlobalSpinBoxSetting("MythFillMaxHour", 0, 23, 1); + auto *bs = new GlobalSpinBoxSetting("MythFillMaxHour", 0, 23, 1); bs->setLabel(QObject::tr("Guide data program execution end")); bs->setValue(23); bs->setHelpText(QObject::tr("This setting and the preceding one define a " @@ -822,7 +822,7 @@ static GlobalSpinBoxSetting *MythFillMaxHour() static GlobalCheckBoxSetting *MythFillGrabberSuggestsTime() { - GlobalCheckBoxSetting *bc = new GlobalCheckBoxSetting("MythFillGrabberSuggestsTime"); + auto *bc = new GlobalCheckBoxSetting("MythFillGrabberSuggestsTime"); bc->setLabel(QObject::tr("Run guide data program at time suggested by the " "grabber.")); bc->setValue(true); @@ -835,7 +835,7 @@ static GlobalCheckBoxSetting *MythFillGrabberSuggestsTime() static GlobalTextEditSetting *MythFillDatabasePath() { - GlobalTextEditSetting *be = new GlobalTextEditSetting("MythFillDatabasePath"); + auto *be = new GlobalTextEditSetting("MythFillDatabasePath"); be->setLabel(QObject::tr("Guide data program")); be->setValue("mythfilldatabase"); be->setHelpText(QObject::tr( @@ -847,7 +847,7 @@ static GlobalTextEditSetting *MythFillDatabasePath() static GlobalTextEditSetting *MythFillDatabaseArgs() { - GlobalTextEditSetting *be = new GlobalTextEditSetting("MythFillDatabaseArgs"); + auto *be = new GlobalTextEditSetting("MythFillDatabaseArgs"); be->setLabel(QObject::tr("Guide data arguments")); be->setValue(""); be->setHelpText(QObject::tr("Any arguments you want passed to the " @@ -881,7 +881,7 @@ BackendSettings::BackendSettings() m_masterServerPort = MasterServerPort(); //++ Host Address Backend Setup ++ - GroupSetting* server = new GroupSetting(); + auto* server = new GroupSetting(); server->setLabel(tr("Host Address Backend Setup")); m_localServerPort = LocalServerPort(); server->addChild(m_localServerPort); @@ -911,17 +911,17 @@ BackendSettings::BackendSettings() addChild(server); //++ Locale Settings ++ - GroupSetting* locale = new GroupSetting(); + auto* locale = new GroupSetting(); locale->setLabel(QObject::tr("Locale Settings")); locale->addChild(TVFormat()); locale->addChild(VbiFormat()); locale->addChild(FreqTable()); addChild(locale); - GroupSetting* group2 = new GroupSetting(); + auto* group2 = new GroupSetting(); group2->setLabel(QObject::tr("Miscellaneous Settings")); - GroupSetting* fm = new GroupSetting(); + auto* fm = new GroupSetting(); fm->setLabel(QObject::tr("File Management Settings")); fm->addChild(MasterBackendOverride()); fm->addChild(DeletesFollowLinks()); @@ -929,7 +929,7 @@ BackendSettings::BackendSettings() fm->addChild(HDRingbufferSize()); fm->addChild(StorageScheduler()); group2->addChild(fm); - GroupSetting* upnp = new GroupSetting(); + auto* upnp = new GroupSetting(); upnp->setLabel(QObject::tr("UPnP Server Settings")); //upnp->addChild(UPNPShowRecordingUnderVideos()); upnp->addChild(UPNPWmpSource()); @@ -939,13 +939,13 @@ BackendSettings::BackendSettings() group2->addChild(DisableFirewireReset()); addChild(group2); - GroupSetting* group2a1 = new GroupSetting(); + auto* group2a1 = new GroupSetting(); group2a1->setLabel(QObject::tr("EIT Scanner Options")); group2a1->addChild(EITTransportTimeout()); group2a1->addChild(EITCrawIdleStart()); addChild(group2a1); - GroupSetting* group3 = new GroupSetting(); + auto* group3 = new GroupSetting(); group3->setLabel(QObject::tr("Shutdown/Wakeup Options")); group3->addChild(startupCommand()); group3->addChild(blockSDWUwithoutClient()); @@ -958,30 +958,30 @@ BackendSettings::BackendSettings() group3->addChild(preSDWUCheckCommand()); addChild(group3); - GroupSetting* group4 = new GroupSetting(); + auto* group4 = new GroupSetting(); group4->setLabel(QObject::tr("Backend Wakeup settings")); - GroupSetting* backend = new GroupSetting(); + auto* backend = new GroupSetting(); backend->setLabel(QObject::tr("Master Backend")); backend->addChild(WOLbackendReconnectWaitTime()); backend->addChild(WOLbackendConnectRetry()); backend->addChild(WOLbackendCommand()); group4->addChild(backend); - GroupSetting* slaveBackend = new GroupSetting(); + auto* slaveBackend = new GroupSetting(); slaveBackend->setLabel(QObject::tr("Slave Backends")); slaveBackend->addChild(SleepCommand()); slaveBackend->addChild(WakeUpCommand()); group4->addChild(slaveBackend); addChild(group4); - GroupSetting* backendControl = new GroupSetting(); + auto* backendControl = new GroupSetting(); backendControl->setLabel(QObject::tr("Backend Control")); backendControl->addChild(BackendStopCommand()); backendControl->addChild(BackendStartCommand()); addChild(backendControl); - GroupSetting* group5 = new GroupSetting(); + auto* group5 = new GroupSetting(); group5->setLabel(QObject::tr("Job Queue (Backend-Specific)")); group5->addChild(JobQueueMaxSimultaneousJobs()); group5->addChild(JobQueueCheckFrequency()); @@ -998,7 +998,7 @@ BackendSettings::BackendSettings() group5->addChild(JobAllowUserJob(4)); addChild(group5); - GroupSetting* group6 = new GroupSetting(); + auto* group6 = new GroupSetting(); group6->setLabel(QObject::tr("Job Queue (Global)")); group6->addChild(JobsRunOnRecordHost()); group6->addChild(AutoCommflagWhileRecording()); @@ -1008,7 +1008,7 @@ BackendSettings::BackendSettings() group6->addChild(SaveTranscoding()); addChild(group6); - GroupSetting* group7 = new GroupSetting(); + auto* group7 = new GroupSetting(); group7->setLabel(QObject::tr("Job Queue (Job Commands)")); group7->addChild(UserJobDesc(1)); group7->addChild(UserJob(1)); @@ -1020,7 +1020,7 @@ BackendSettings::BackendSettings() group7->addChild(UserJob(4)); addChild(group7); - MythFillSettings *mythfill = new MythFillSettings(); + auto *mythfill = new MythFillSettings(); addChild(mythfill); } diff --git a/mythtv/programs/mythtv-setup/channeleditor.cpp b/mythtv/programs/mythtv-setup/channeleditor.cpp index 1dee84e6dab..06471172b4d 100644 --- a/mythtv/programs/mythtv-setup/channeleditor.cpp +++ b/mythtv/programs/mythtv-setup/channeleditor.cpp @@ -45,12 +45,10 @@ ChannelWizard::ChannelWizard(int id, int default_sourceid) all_asi &= cardtypes[i] == "ASI"; } - ChannelOptionsCommon *common = - new ChannelOptionsCommon(*m_cid, default_sourceid,!all_v4l); + auto *common = new ChannelOptionsCommon(*m_cid, default_sourceid,!all_v4l); addChild(common); - ChannelOptionsFilters *filters = - new ChannelOptionsFilters(*m_cid); + auto *filters = new ChannelOptionsFilters(*m_cid); addChild(filters); if (all_v4l) @@ -240,7 +238,7 @@ void ChannelEditor::fillList(void) uint currentIndex = qMax(m_channelList->GetCurrentPos(), 0); m_channelList->Reset(); QString newchanlabel = tr("(Add New Channel)"); - MythUIButtonListItem *item = new MythUIButtonListItem(m_channelList, ""); + auto *item = new MythUIButtonListItem(m_channelList, ""); item->SetText(newchanlabel, "compoundname"); item->SetText(newchanlabel, "name"); @@ -408,7 +406,7 @@ void ChannelEditor::del() QString message = tr("Delete channel '%1'?").arg(item->GetText("name")); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythConfirmationDialog *dialog = new MythConfirmationDialog(popupStack, message, true); + auto *dialog = new MythConfirmationDialog(popupStack, message, true); if (dialog->Create()) { @@ -434,7 +432,7 @@ void ChannelEditor::deleteChannels(void) tr("Delete all channels on %1?").arg(currentLabel)); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythConfirmationDialog *dialog = new MythConfirmationDialog(popupStack, message, true); + auto *dialog = new MythConfirmationDialog(popupStack, message, true); if (dialog->Create()) { @@ -456,9 +454,8 @@ void ChannelEditor::edit(MythUIButtonListItem *item) MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); int chanid = item->GetData().toInt(); - ChannelWizard *cw = new ChannelWizard(chanid, m_sourceFilter); - StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, - "channelwizard", cw); + auto *cw = new ChannelWizard(chanid, m_sourceFilter); + auto *ssd = new StandardSettingDialog(mainStack, "channelwizard", cw); if (ssd->Create()) { connect(ssd, SIGNAL(Exiting()), SLOT(fillList())); @@ -484,7 +481,7 @@ void ChannelEditor::menu() MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menu = new MythDialogBox(label, popupStack, "chanoptmenu"); + auto *menu = new MythDialogBox(label, popupStack, "chanoptmenu"); if (menu->Create()) { @@ -565,9 +562,8 @@ void ChannelEditor::scan(void) // Create the dialog now that we have a video source and a capture card MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StandardSettingDialog *ssd = - new StandardSettingDialog(mainStack, "scanwizard", - new ScanWizard(m_sourceFilter)); + auto *ssd = new StandardSettingDialog(mainStack, "scanwizard", + new ScanWizard(m_sourceFilter)); if (ssd->Create()) { connect(ssd, SIGNAL(Exiting()), SLOT(fillList())); @@ -585,8 +581,7 @@ void ChannelEditor::transportEditor(void) // Create the dialog now that we have a video source and a capture card MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StandardSettingDialog *ssd = - new StandardSettingDialog(mainStack, "transporteditor", + auto *ssd = new StandardSettingDialog(mainStack, "transporteditor", new TransportListEditor(m_sourceFilter)); if (ssd->Create()) { @@ -626,7 +621,7 @@ void ChannelEditor::channelIconImport(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menu = new MythDialogBox(label, popupStack, "iconoptmenu"); + auto *menu = new MythDialogBox(label, popupStack, "iconoptmenu"); if (menu->Create()) { @@ -651,7 +646,7 @@ void ChannelEditor::customEvent(QEvent *event) { if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); + auto *dce = (DialogCompletionEvent*)(event); QString resultid= dce->GetId(); int buttonnum = dce->GetResult(); @@ -670,8 +665,7 @@ void ChannelEditor::customEvent(QEvent *event) } else if (resultid == "delsingle" && buttonnum == 1) { - MythUIButtonListItem *item = - dce->GetData().value<MythUIButtonListItem *>(); + auto *item = dce->GetData().value<MythUIButtonListItem *>(); if (!item) return; uint chanid = item->GetData().toUInt(); diff --git a/mythtv/programs/mythtv-setup/exitprompt.cpp b/mythtv/programs/mythtv-setup/exitprompt.cpp index dd796e19c3b..1aba14a2645 100644 --- a/mythtv/programs/mythtv-setup/exitprompt.cpp +++ b/mythtv/programs/mythtv-setup/exitprompt.cpp @@ -41,9 +41,7 @@ void ExitPrompter::masterPromptExit() " master backend to populate the" " database with guide information."); - MythConfirmationDialog *dia = new MythConfirmationDialog(m_d->m_stk, - label, - false); + auto *dia = new MythConfirmationDialog(m_d->m_stk, label, false); if (!dia->Create()) { LOG(VB_GENERAL, LOG_ERR, "Can't create fill DB prompt?"); @@ -71,8 +69,8 @@ void ExitPrompter::handleExit() problems.push_back(tr("Do you want to go back and fix this(these) " "problem(s)?", nullptr, problems.size())); - MythDialogBox *dia = new MythDialogBox(problems.join("\n"), - m_d->m_stk, "exit prompt"); + auto *dia = new MythDialogBox(problems.join("\n"), + m_d->m_stk, "exit prompt"); if (!dia->Create()) { LOG(VB_GENERAL, LOG_ERR, "Can't create Exit Prompt dialog?"); @@ -97,7 +95,7 @@ void ExitPrompter::customEvent(QEvent *event) { if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); + auto *dce = (DialogCompletionEvent*)(event); QString resultid= dce->GetId(); int buttonnum = dce->GetResult(); diff --git a/mythtv/programs/mythtv-setup/importicons.cpp b/mythtv/programs/mythtv-setup/importicons.cpp index c6927468d45..f8b2bd8122c 100644 --- a/mythtv/programs/mythtv-setup/importicons.cpp +++ b/mythtv/programs/mythtv-setup/importicons.cpp @@ -533,7 +533,7 @@ QString ImportIconsWizard::wget(QUrl& url, const QString& strParam ) { QByteArray data(strParam.toLatin1()); - QNetworkRequest *req = new QNetworkRequest(url); + auto *req = new QNetworkRequest(url); req->setHeader(QNetworkRequest::ContentTypeHeader, QString("application/x-www-form-urlencoded")); req->setHeader(QNetworkRequest::ContentLengthHeader, data.size()); @@ -775,8 +775,7 @@ void ImportIconsWizard::askSubmit(const QString& strParam) "choices back to mythtv.org so that others can " "benefit from your selections."); - MythConfirmationDialog *confirmPopup = - new MythConfirmationDialog(m_popupStack, message); + auto *confirmPopup = new MythConfirmationDialog(m_popupStack, message); confirmPopup->SetReturnEvent(this, "submitresults"); @@ -836,7 +835,7 @@ void ImportIconsWizard::customEvent(QEvent *event) { if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); + auto *dce = (DialogCompletionEvent*)(event); QString resultid = dce->GetId(); int buttonnum = dce->GetResult(); diff --git a/mythtv/programs/mythtv-setup/importicons.h b/mythtv/programs/mythtv-setup/importicons.h index b6ad041a05f..dc4cb3e2008 100644 --- a/mythtv/programs/mythtv-setup/importicons.h +++ b/mythtv/programs/mythtv-setup/importicons.h @@ -70,9 +70,9 @@ class ImportIconsWizard : public MythScreenType QString strNameCSV; //!< name (csv form) }; //! List of CSV entries - typedef QList<CSVEntry> ListEntries; + using ListEntries = QList<CSVEntry>; //! iterator over list of CSV entries - typedef QList<CSVEntry>::Iterator ListEntriesIter; + using ListEntriesIter = QList<CSVEntry>::Iterator; ListEntries m_listEntries; //!< list of TV channels to search for ListEntries m_missingEntries; //!< list of TV channels with no unique icon @@ -80,9 +80,9 @@ class ImportIconsWizard : public MythScreenType ListEntriesIter m_missingIter; //! List of SearchEntry entries - typedef QList<SearchEntry> ListSearchEntries; + using ListSearchEntries = QList<SearchEntry>; //! iterator over list of SearchEntry entries - typedef QList<SearchEntry>::Iterator ListSearchEntriesIter; + using ListSearchEntriesIter = QList<SearchEntry>::Iterator; /*! \brief changes a string into csv format * \param str the string to change diff --git a/mythtv/programs/mythtv-setup/main.cpp b/mythtv/programs/mythtv-setup/main.cpp index 4bcc462f2ae..a21863ccc28 100644 --- a/mythtv/programs/mythtv-setup/main.cpp +++ b/mythtv/programs/mythtv-setup/main.cpp @@ -76,9 +76,8 @@ static void SetupMenuCallback(void* /* data */, QString& selection) if (sel == "general") { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StandardSettingDialog *ssd = - new StandardSettingDialog(mainStack, "generalsettings", - new BackendSettings()); + auto *ssd = new StandardSettingDialog(mainStack, "generalsettings", + new BackendSettings()); if (ssd->Create()) mainStack->AddScreen(ssd); @@ -88,9 +87,8 @@ static void SetupMenuCallback(void* /* data */, QString& selection) else if (sel == "capture cards") { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StandardSettingDialog *ssd = - new StandardSettingDialog(mainStack, "capturecardeditor", - new CaptureCardEditor()); + auto *ssd = new StandardSettingDialog(mainStack, "capturecardeditor", + new CaptureCardEditor()); if (ssd->Create()) mainStack->AddScreen(ssd); @@ -100,8 +98,7 @@ static void SetupMenuCallback(void* /* data */, QString& selection) else if (sel == "video sources") { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StandardSettingDialog *ssd = - new StandardSettingDialog(mainStack, "videosourceeditor", + auto *ssd = new StandardSettingDialog(mainStack, "videosourceeditor", new VideoSourceEditor()); if (ssd->Create()) mainStack->AddScreen(ssd); @@ -111,9 +108,8 @@ static void SetupMenuCallback(void* /* data */, QString& selection) else if (sel == "card inputs") { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StandardSettingDialog *ssd = - new StandardSettingDialog(mainStack, "cardinputeditor", - new CardInputEditor()); + auto *ssd = new StandardSettingDialog(mainStack, "cardinputeditor", + new CardInputEditor()); if (ssd->Create()) mainStack->AddScreen(ssd); @@ -123,9 +119,8 @@ static void SetupMenuCallback(void* /* data */, QString& selection) else if (sel == "recording profile") { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StandardSettingDialog *ssd = - new StandardSettingDialog(mainStack, "recordingprofileeditor", - new ProfileGroupEditor()); + auto *ssd = new StandardSettingDialog(mainStack, "recordingprofileeditor", + new ProfileGroupEditor()); if (ssd->Create()) mainStack->AddScreen(ssd); @@ -136,7 +131,7 @@ static void SetupMenuCallback(void* /* data */, QString& selection) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - ChannelEditor *chanedit = new ChannelEditor(mainStack); + auto *chanedit = new ChannelEditor(mainStack); if (chanedit->Create()) mainStack->AddScreen(chanedit); @@ -146,9 +141,8 @@ static void SetupMenuCallback(void* /* data */, QString& selection) else if (sel == "storage groups") { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StandardSettingDialog *ssd = - new StandardSettingDialog(mainStack, "storagegroupeditor", - new StorageGroupListEditor()); + auto *ssd = new StandardSettingDialog(mainStack, "storagegroupeditor", + new StorageGroupListEditor()); if (ssd->Create()) mainStack->AddScreen(ssd); @@ -159,8 +153,7 @@ static void SetupMenuCallback(void* /* data */, QString& selection) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - MythSystemEventEditor *msee = new MythSystemEventEditor( - mainStack, "System Event Editor"); + auto *msee = new MythSystemEventEditor(mainStack, "System Event Editor"); if (msee->Create()) mainStack->AddScreen(msee); diff --git a/mythtv/programs/mythtv-setup/startprompt.cpp b/mythtv/programs/mythtv-setup/startprompt.cpp index 1d142188712..83db44fcb27 100644 --- a/mythtv/programs/mythtv-setup/startprompt.cpp +++ b/mythtv/programs/mythtv-setup/startprompt.cpp @@ -82,7 +82,7 @@ void StartPrompter::backendRunningPrompt(void) warning += tr("Recording Status: None."); } - MythDialogBox *dia = new MythDialogBox(warning, m_d->m_stk, "actionmenu"); + auto *dia = new MythDialogBox(warning, m_d->m_stk, "actionmenu"); if (!dia->Create()) { diff --git a/mythtv/programs/mythutil/messageutils.cpp b/mythtv/programs/mythutil/messageutils.cpp index a390692e5cb..3d0e2281c8f 100644 --- a/mythtv/programs/mythutil/messageutils.cpp +++ b/mythtv/programs/mythutil/messageutils.cpp @@ -137,7 +137,7 @@ static int SendMessage(const MythUtilCommandLineParser &cmdline) cout << "output:\n" << message.toLocal8Bit().constData() << endl; - QUdpSocket *sock = new QUdpSocket(); + auto *sock = new QUdpSocket(); QByteArray utf8 = message.toUtf8(); int result = GENERIC_EXIT_OK; diff --git a/mythtv/programs/mythutil/mpegutils.cpp b/mythtv/programs/mythutil/mpegutils.cpp index f057e38716e..401efbac9f2 100644 --- a/mythtv/programs/mythutil/mpegutils.cpp +++ b/mythtv/programs/mythutil/mpegutils.cpp @@ -747,7 +747,7 @@ static int pid_printer(const MythUtilCommandLineParser &cmdline) bool autopts = !cmdline.toBool("noautopts"); bool use_xml = cmdline.toBool("xml"); - ScanStreamData *sd = new ScanStreamData(true); + auto *sd = new ScanStreamData(true); for (QHash<uint,bool>::iterator it = use_pid.begin(); it != use_pid.end(); ++it) { @@ -760,23 +760,16 @@ static int pid_printer(const MythUtilCommandLineParser &cmdline) sd->AddWritingPID(it.key()); } - PTSListener *ptsl = new PTSListener(); - PrintMPEGStreamListener *pmsl = - new PrintMPEGStreamListener(out, *ptsl, autopts, sd, use_pid, use_xml); - PrintATSCMainStreamListener *pasl = - new PrintATSCMainStreamListener(out, use_xml); - PrintSCTEMainStreamListener *pssl = - new PrintSCTEMainStreamListener(out, use_xml); - PrintATSCAuxStreamListener *paasl = - new PrintATSCAuxStreamListener(out, use_xml); - PrintATSCEITStreamListener *paesl = - new PrintATSCEITStreamListener(out, use_xml); - PrintDVBMainStreamListener *pdmsl = - new PrintDVBMainStreamListener(out, use_xml); - PrintDVBOtherStreamListener *pdosl = - new PrintDVBOtherStreamListener(out, use_xml); - PrintDVBEITStreamListener *pdesl = - new PrintDVBEITStreamListener(out, use_xml); + auto *ptsl = new PTSListener(); + auto *pmsl = new PrintMPEGStreamListener(out, *ptsl, autopts, sd, + use_pid, use_xml); + auto *pasl = new PrintATSCMainStreamListener(out, use_xml); + auto *pssl = new PrintSCTEMainStreamListener(out, use_xml); + auto *paasl = new PrintATSCAuxStreamListener(out, use_xml); + auto *paesl = new PrintATSCEITStreamListener(out, use_xml); + auto *pdmsl = new PrintDVBMainStreamListener(out, use_xml); + auto *pdosl = new PrintDVBOtherStreamListener(out, use_xml); + auto *pdesl = new PrintDVBEITStreamListener(out, use_xml); sd->AddWritingListener(ptsl); sd->AddMPEGListener(pmsl); diff --git a/mythtv/programs/mythutil/musicmetautils.cpp b/mythtv/programs/mythutil/musicmetautils.cpp index 59cd56a0e42..28346052279 100644 --- a/mythtv/programs/mythutil/musicmetautils.cpp +++ b/mythtv/programs/mythutil/musicmetautils.cpp @@ -179,7 +179,7 @@ static int ExtractImage(const MythUtilCommandLineParser &cmdline) static int ScanMusic(const MythUtilCommandLineParser &/*cmdline*/) { - MusicFileScanner *fscan = new MusicFileScanner(); + auto *fscan = new MusicFileScanner(); QStringList dirList; if (!StorageGroup::FindDirs("Music", gCoreContext->GetHostName(), &dirList)) diff --git a/mythtv/programs/mythutil/mythutil.h b/mythtv/programs/mythutil/mythutil.h index de395e4a9ef..69880a817a6 100644 --- a/mythtv/programs/mythutil/mythutil.h +++ b/mythtv/programs/mythutil/mythutil.h @@ -11,9 +11,8 @@ // Local includes #include "commandlineparser.h" -typedef int (*UtilFunc)(const MythUtilCommandLineParser &cmdline); - -typedef QMap<QString, UtilFunc> UtilMap; +using UtilFunc = int (*)(const MythUtilCommandLineParser &cmdline); +using UtilMap = QMap<QString, UtilFunc>; bool GetProgramInfo(const MythUtilCommandLineParser &cmdline, ProgramInfo &pginfo); diff --git a/mythtv/programs/mythutil/recordingutils.cpp b/mythtv/programs/mythutil/recordingutils.cpp index 729323fccda..88917a04ccb 100644 --- a/mythtv/programs/mythutil/recordingutils.cpp +++ b/mythtv/programs/mythutil/recordingutils.cpp @@ -87,7 +87,7 @@ static int CheckRecordings(const MythUtilCommandLineParser &cmdline) if (!recordingList->empty()) { - vector<ProgramInfo *>::iterator i = recordingList->begin(); + auto i = recordingList->begin(); for ( ; i != recordingList->end(); ++i) { ProgramInfo *p = *i; @@ -180,7 +180,7 @@ static int CheckRecordings(const MythUtilCommandLineParser &cmdline) cout << endl << endl; cout << "MISSING RECORDINGS" << endl; cout << "------------------" << endl; - vector<ProgramInfo *>::iterator i = missingRecordings.begin(); + auto i = missingRecordings.begin(); for ( ; i != missingRecordings.end(); ++i) { ProgramInfo *p = *i; @@ -195,7 +195,7 @@ static int CheckRecordings(const MythUtilCommandLineParser &cmdline) cout << endl << endl; cout << "ZERO BYTE RECORDINGS" << endl; cout << "--------------------" << endl; - vector<ProgramInfo *>::iterator i = zeroByteRecordings.begin(); + auto i = zeroByteRecordings.begin(); for ( ; i != zeroByteRecordings.end(); ++i) { ProgramInfo *p = *i; @@ -210,7 +210,7 @@ static int CheckRecordings(const MythUtilCommandLineParser &cmdline) cout << endl << endl; cout << "NO SEEKTABLE RECORDINGS" << endl; cout << "-----------------------" << endl; - vector<ProgramInfo *>::iterator i = noSeektableRecordings.begin(); + auto i = noSeektableRecordings.begin(); for ( ; i != noSeektableRecordings.end(); ++i) { ProgramInfo *p = *i; diff --git a/mythtv/programs/mythwelcome/welcomedialog.cpp b/mythtv/programs/mythwelcome/welcomedialog.cpp index a54ce9d76d6..5b597d89e19 100644 --- a/mythtv/programs/mythwelcome/welcomedialog.cpp +++ b/mythtv/programs/mythwelcome/welcomedialog.cpp @@ -140,7 +140,7 @@ void WelcomeDialog::customEvent(QEvent *e) { if (e->type() == MythEvent::MythEventMessage) { - MythEvent *me = static_cast<MythEvent *>(e); + auto *me = static_cast<MythEvent *>(e); if (me->Message().startsWith("RECORDING_LIST_CHANGE") || me->Message() == "UPDATE_PROG_INFO") @@ -215,8 +215,7 @@ void WelcomeDialog::customEvent(QEvent *e) void WelcomeDialog::ShowSettings(GroupSetting *screen) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "settings", - screen); + auto *ssd = new StandardSettingDialog(mainStack, "settings", screen); if (ssd->Create()) mainStack->AddScreen(ssd); else diff --git a/mythtv/programs/scripts/build_compdb.py b/mythtv/programs/scripts/build_compdb.py new file mode 100755 index 00000000000..2a59500fdd7 --- /dev/null +++ b/mythtv/programs/scripts/build_compdb.py @@ -0,0 +1,56 @@ +#! /usr/bin/python3 + +from pathlib import Path +import json +from optparse import OptionParser + +parser = OptionParser() +parser.add_option("-v", "--verbose", + action="store_true", dest="verbose", + help="Print progress messages") +(options, args) = parser.parse_args() + +paths = list(Path("..").glob("**/*.o.json")) +if len(paths) < 600: + print("Not enough *.o.json files present. Did you remember to") + print("clean ccache and do a full build with clang?") + exit(1) + +outlines = [] +for path in paths: + filename = path.as_posix() + badnames = ["/external/", "moc_", "dummy.o.json"] + if any(bad in filename for bad in badnames): + if options.verbose: + print("Skipping input file: {0:s}".format(path.as_posix())) + continue + in_file = open(path, "r") + if not in_file: + if options.verbose: + print("Cannot open input file: {0:s}".format(filename)) + continue + + # Read and strip trailing comma + rawcontent = in_file.read() + if len(rawcontent) < 2: + print("Bad file contents: {0:s}".format(filename)) + exit(1) + content = json.loads(rawcontent[:-2]) + in_file.close() + + # Manipulate file names + if content["file"].startswith("../") and not content["file"].endswith("Json.cpp"): + if options.verbose: + print("Skipping input file2: {0:s}".format(filename)) + continue + content["file"] = content["directory"] + "/" + content["file"] + + # Save the output for this file + if options.verbose: + print("Including input file: {0:s}".format(path.as_posix())) + outlines.append(json.dumps(content, indent=4)) + +# Dump out the compdb file +out_file = open("../compile_commands.json", "w") +print("[\n{0:s}\n]".format(",\n".join(outlines)), file=out_file) +out_file.close()