From 556059bf80e3a368811fd46fe2b6e35104d0eda3 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Mon, 18 Nov 2019 00:07:52 -0600 Subject: Qt UI: Factor out MAC address stringify to function --- ui/qt5/horizonwizard.hh | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'ui/qt5/horizonwizard.hh') diff --git a/ui/qt5/horizonwizard.hh b/ui/qt5/horizonwizard.hh index cd0d213..2941f08 100644 --- a/ui/qt5/horizonwizard.hh +++ b/ui/qt5/horizonwizard.hh @@ -18,6 +18,19 @@ #include #include +inline QString fromMacAddress(char address[6]) { + char buf[18]; + snprintf(buf, 18, "%02X:%02X:%02X:%02X:%02X:%02X", + address[0] & 0xFF, + address[1] & 0xFF, + address[2] & 0xFF, + address[3] & 0xFF, + address[4] & 0xFF, + address[5] & 0xFF); + QString mac(buf); + return mac; +} + class HorizonWizard : public QWizard { public: enum { -- cgit v1.2.3-60-g2f50