From c12bef29d2b79f3b2e05f273f2e3ff9c55940c03 Mon Sep 17 00:00:00 2001 From: scorpion-26 Date: Sun, 23 Jul 2023 17:56:24 +0200 Subject: [PATCH] BluetoothDevices: Honor Location --- src/BluetoothDevices.cpp | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/src/BluetoothDevices.cpp b/src/BluetoothDevices.cpp index 6431c7e..1998913 100644 --- a/src/BluetoothDevices.cpp +++ b/src/BluetoothDevices.cpp @@ -299,8 +299,37 @@ namespace BluetoothDevices WidgetBody(*mainWidget); window.SetExclusive(false); - window.SetMargin(Anchor::Top, 8); - window.SetAnchor(Anchor::Right | Anchor::Top); + Anchor anchor; + Anchor marginAnchor; + switch (Config::Get().location) + { + case 'T': + anchor = Anchor::Right | Anchor::Top; + marginAnchor = Anchor::Top; + break; + case 'B': + anchor = Anchor::Bottom | Anchor::Right; + marginAnchor = Anchor::Bottom; + break; + case 'L': + anchor = Anchor::Left | Anchor::Bottom; + marginAnchor = Anchor::Left; + // TODO: Config + window.SetMargin(Anchor::Bottom, 150); + break; + case 'R': + anchor = Anchor::Right | Anchor::Bottom; + marginAnchor = Anchor::Right; + // TODO: Config + window.SetMargin(Anchor::Bottom, 150); + break; + default: + LOG("Invalid location char \"" << Config::Get().location << "\"!"); + anchor = Anchor::Right | Anchor::Top; + marginAnchor = Anchor::Top; + } + window.SetMargin(marginAnchor, 8); + window.SetAnchor(anchor); window.SetMainWidget(std::move(mainWidget)); } }