Skip to content

Commit

Permalink
Simplify code for obtaining a list of video profiles.
Browse files Browse the repository at this point in the history
Clang pointed out that the setup wizard video code is calling
m_vdp->GetProfiles when it could directly call the static
VideoDisplayProfile::GetProfiles function.  Same for the
GetDefaultProfileName function.  Making those changes removes any need
to create an instance of the VideoDisplayProfile class, so that code
can all go away.

This code was pointed out by clang-tidy's "static accesses through
instance" check.

https://clang.llvm.org/extra/clang-tidy/checks/readability-static-accessed-through-instance.html
  • Loading branch information
linuxdude42 committed Mar 26, 2019
1 parent 41b3e61 commit de18e7e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
15 changes: 6 additions & 9 deletions mythtv/programs/mythfrontend/setupwizard_video.cpp
Expand Up @@ -32,7 +32,6 @@ VideoSetupWizard::VideoSetupWizard(MythScreenStack *parent,
m_generalScreen(general), m_audioScreen(audio)
{
m_popupStack = GetMythMainWindow()->GetStack("popup stack");
m_vdp = new VideoDisplayProfile();

gCoreContext->addListener(this);
}
Expand Down Expand Up @@ -86,14 +85,12 @@ bool VideoSetupWizard::Create()

VideoSetupWizard::~VideoSetupWizard()
{
delete m_vdp;

gCoreContext->removeListener(this);
}

void VideoSetupWizard::loadData(void)
{
QStringList profiles = m_vdp->GetProfiles(gCoreContext->GetHostName());
QStringList profiles = VideoDisplayProfile::GetProfiles(gCoreContext->GetHostName());

for (QStringList::const_iterator i = profiles.begin();
i != profiles.end(); ++i)
Expand All @@ -103,7 +100,7 @@ void VideoSetupWizard::loadData(void)
item->SetData(*i);
}

QString currentpbp = m_vdp->GetDefaultProfileName(gCoreContext->GetHostName());
QString currentpbp = VideoDisplayProfile::GetDefaultProfileName(gCoreContext->GetHostName());
if (!currentpbp.isEmpty())
{
MythUIButtonListItem *set =
Expand Down Expand Up @@ -135,7 +132,7 @@ void VideoSetupWizard::save(void)
{
QString desiredpbp =
m_playbackProfileButtonList->GetItemCurrent()->GetText();
m_vdp->SetDefaultProfileName(desiredpbp, gCoreContext->GetHostName());
VideoDisplayProfile::SetDefaultProfileName(desiredpbp, gCoreContext->GetHostName());
}

void VideoSetupWizard::slotPrevious(void)
Expand Down Expand Up @@ -202,11 +199,11 @@ void VideoSetupWizard::playVideoTest(QString desc, QString title, QString file)
{
QString desiredpbp =
m_playbackProfileButtonList->GetItemCurrent()->GetText();
QString currentpbp = m_vdp->GetDefaultProfileName(gCoreContext->GetHostName());
QString currentpbp = VideoDisplayProfile::GetDefaultProfileName(gCoreContext->GetHostName());

m_vdp->SetDefaultProfileName(desiredpbp, gCoreContext->GetHostName());
VideoDisplayProfile::SetDefaultProfileName(desiredpbp, gCoreContext->GetHostName());
GetMythMainWindow()->HandleMedia("Internal", file, desc, title);
m_vdp->SetDefaultProfileName(currentpbp, gCoreContext->GetHostName());
VideoDisplayProfile::SetDefaultProfileName(currentpbp, gCoreContext->GetHostName());
}

void VideoSetupWizard::DownloadSample(QString url, QString dest)
Expand Down
2 changes: 0 additions & 2 deletions mythtv/programs/mythfrontend/setupwizard_video.h
Expand Up @@ -58,8 +58,6 @@ class VideoSetupWizard : public MythScreenType
MythUIButton *m_nextButton {nullptr};
MythUIButton *m_prevButton {nullptr};

VideoDisplayProfile *m_vdp {nullptr};

private slots:
void slotNext(void);
void slotPrevious(void);
Expand Down

0 comments on commit de18e7e

Please sign in to comment.