From d8760ed8ad688c7e69d2a5be89a8574f4bf44f74 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Thu, 18 Jul 2019 23:52:11 -0400 Subject: refactored Metrics and Display, no change in functionality --- src/envmetrics.h | 62 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 9 deletions(-) (limited to 'src/envmetrics.h') diff --git a/src/envmetrics.h b/src/envmetrics.h index 62fc8c49..bede36fc 100644 --- a/src/envmetrics.h +++ b/src/envmetrics.h @@ -4,25 +4,69 @@ namespace env { -class Metrics +// information about a monitor +// +class Display { public: - struct Display - { - int resX=0, resY=0, dpi=0; - bool primary=false; - int refreshRate = 0; - QString monitor, adapter; + Display(QString adapter, QString monitorDevice, bool primary); + + // display name of the adapter running the monitor + // + const QString& adapter() const; + + // internal device name of the monitor, this is not a display name + // + const QString& monitorDevice() const; + + // whether this monitor is the primary + // + bool primary(); + + // resolution + // + int resX() const; + int resY() const; + + // dpi + // + int dpi(); + + // refresh rate in hz + // + int refreshRate() const; + + // string representation + // + QString toString() const; + +private: + QString m_adapter; + QString m_monitorDevice; + bool m_primary; + int m_resX, m_resY; + int m_dpi; + int m_refreshRate; + + void getSettings(); +}; - QString toString() const; - }; +// holds various information about Windows metrics +// +class Metrics +{ +public: Metrics(); + // list of displays on the system + // const std::vector& displays() const; private: std::vector m_displays; + + void getDisplays(); }; } // namespace -- cgit v1.3.1