3#include <QRegularExpression>
18#define LOC QString("UIBounds: ")
42 static const QRegularExpression sre(
"^(\\d+)x(\\d+)$");
43 static const QRegularExpression lre(R
"(^(\d+)x(\d+)([+-]\d+)([+-]\d+)$)");
45 bool longform =
false;
47 auto smatch = sre.match(Geometry);
48 auto lmatch = lre.match(Geometry);
49 if (smatch.hasMatch())
51 geometry = smatch.capturedTexts();
53 else if (lmatch.hasMatch())
55 geometry = lmatch.capturedTexts();
60 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Geometry does not match either form - "
61 "WIDTHxHEIGHT or WIDTHxHEIGHT+XOFF+YOFF");
67 int width = geometry[1].toInt(&parsed);
69 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Could not parse width of geometry override");
73 height = geometry[2].toInt(&parsed);
75 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Could not parse height of geometry override");
82 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"Overriding GUI size: %1x%2")
83 .arg(width).arg(height));
87 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Failed to override GUI size.");
92 int x = geometry[3].toInt(&parsed);
95 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Could not parse horizontal offset of geometry override");
96 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Failed to override GUI offset.");
100 int y = geometry[4].toInt(&parsed);
103 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Could not parse vertical offset of geometry override");
104 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Failed to override GUI offset.");
110 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"Overriding GUI offset: %1+%2").arg(x).arg(y));
121 return QGuiApplication::platformName().toLower().contains(
"eglfs");
174 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"Strange screen size: %1x%2 - forcing 640x480")
186 QFont font = QFont(
"Arial");
187 if (!font.exactMatch())
190 font.setStyleHint(QFont::SansSerif, QFont::PreferAntialias);
193 font.setStretch(stretch);
195 QApplication::setFont(font);
208 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"New UI bounds: %1x%2+%3+%4")
void OverrideSettingForSession(const QString &key, const QString &value)
int GetNumSetting(const QString &key, int defaultval=0)
bool GetBoolSetting(const QString &key, bool defaultval=false)
void GetResolutionSetting(const QString &type, int &width, int &height, double &forced_aspect, double &refresh_rate, int index=-1)
double GetPixelAspectRatio()
void SetScalingFactors(float Horizontal, float Vertical)
void SetFontStretch(int Stretch)
static QRect GetGeometryOverride()
QSize NormSize(QSize Size) const
int GetFontStretch() const
static bool WindowIsAlwaysFullscreen()
Return true if the current platform only supports fullscreen windows.
void UpdateScreenSettings(MythDisplay *mDisplay)
void GetScalingFactors(float &Horizontal, float &Vertical) const
static void ParseGeometryOverride(const QString &Geometry)
Parse an X11 style command line geometry string.
void UIScreenRectChanged(const QRect &Rect)
static bool GeometryIsOverridden()
void SetUIScreenRect(QRect Rect)
void SetScreenSize(QSize Size)
QSize GetBaseSize() const
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
MythUIHelper * GetMythUI()