Skip to content

Commit

Permalink
MythDisplay: Use run time check for mode switching support
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-kendall committed Jan 22, 2020
1 parent 00186a1 commit b508699
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
1 change: 1 addition & 0 deletions mythtv/libs/libmythui/mythdisplay.h
Expand Up @@ -25,6 +25,7 @@ class MUI_PUBLIC MythDisplay : public QObject, public ReferenceCounter
static MythDisplay* AcquireRelease(bool Acquire = true);
static QStringList GetDescription(void);

virtual bool VideoModesAvailable(void) { return false; }
virtual bool UsingVideoModes(void) { return false; }
virtual const vector<MythDisplayMode>& GetVideoModes(void);

Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythui/platforms/mythdisplayosx.h
Expand Up @@ -15,6 +15,7 @@ class MythDisplayOSX : public MythDisplay

void UpdateCurrentMode(void) override;

bool VideoModesAvailable(void) override { return true; }
bool UsingVideoModes(void) override;
const std::vector<MythDisplayMode>& GetVideoModes(void) override;
bool SwitchToVideoMode(QSize Size, double DesiredRate) override;
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythui/platforms/mythdisplayrpi.h
Expand Up @@ -22,6 +22,7 @@ class MythDisplayRPI : public MythDisplay
~MythDisplayRPI() override;

void UpdateCurrentMode (void) override final;
bool VideoModesAvailable(void) override { return true; }
bool UsingVideoModes (void) override final;
bool SwitchToVideoMode (QSize Size, double Framerate) override final;
const vector<MythDisplayMode>& GetVideoModes(void) override final;
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythui/platforms/mythdisplayx11.h
Expand Up @@ -21,6 +21,7 @@ class MythDisplayX11 : public MythDisplay
void UpdateCurrentMode(void) override final;

#ifdef USING_XRANDR
bool VideoModesAvailable(void) override { return true; }
bool UsingVideoModes(void) override;
const std::vector<MythDisplayMode>& GetVideoModes(void) override;
bool SwitchToVideoMode(QSize Size, double DesiredRate) override;
Expand Down
14 changes: 7 additions & 7 deletions mythtv/programs/mythfrontend/globalsettings.cpp
Expand Up @@ -2186,7 +2186,6 @@ static HostCheckBoxSetting *GuiSizeForTV()
return gc;
}

#if defined(USING_XRANDR) || CONFIG_DARWIN
static HostCheckBoxSetting *UseVideoModes()
{
HostCheckBoxSetting *gc = new VideoModeSettings("UseVideoModes");
Expand Down Expand Up @@ -2472,7 +2471,6 @@ VideoModeSettings::VideoModeSettings(const char *c) : HostCheckBoxSetting(c)

addChild(overrides);
};
#endif

static HostCheckBoxSetting *HideMouseCursor()
{
Expand Down Expand Up @@ -4536,13 +4534,15 @@ AppearanceSettings::AppearanceSettings()
screen->addChild(AirPlayFullScreen());
#endif

#if defined(USING_XRANDR) || CONFIG_DARWIN
MythDisplay* display = MythDisplay::AcquireRelease();
vector<MythDisplayMode> scr = display->GetVideoModes();
if (display->VideoModesAvailable())
{
vector<MythDisplayMode> scr = display->GetVideoModes();
if (!scr.empty())
addChild(UseVideoModes());
}
MythDisplay::AcquireRelease(false);
if (!scr.empty())
addChild(UseVideoModes());
#endif

auto *dates = new GroupSetting();

dates->setLabel(tr("Localization"));
Expand Down
6 changes: 1 addition & 5 deletions mythtv/programs/mythfrontend/globalsettings.h
Expand Up @@ -52,9 +52,7 @@ class VideoModeSettings : public HostCheckBoxSetting

public:
explicit VideoModeSettings(const char *c);
#if defined(USING_XRANDR) || CONFIG_DARWIN
void updateButton(MythUIButtonListItem *item) override; // MythUICheckBoxSetting
#endif
void updateButton(MythUIButtonListItem *item) override;
};

class LcdSettings
Expand Down Expand Up @@ -162,9 +160,7 @@ class HostRefreshRateComboBoxSetting : public HostComboBoxSetting
~HostRefreshRateComboBoxSetting() override = default;

public slots:
#if defined(USING_XRANDR) || CONFIG_DARWIN
virtual void ChangeResolution(StandardSetting *setting);
#endif

private:
static vector<double> GetRefreshRates(const QString &resolution);
Expand Down

0 comments on commit b508699

Please sign in to comment.