From f7add23a1eab50c0aa9bb25d4d736a2f0f368dbc Mon Sep 17 00:00:00 2001
From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
Date: Fri, 7 Jun 2019 12:14:24 -0400
Subject: [PATCH] settings: fix auto update string and custom toggleswitch
 margins

Change-Id: Ib9aec88b5b2e857c76c06fc096e2fa41d0e3d8ed
---
 settingswidget.ui | 5 ++++-
 toggleswitch.cpp  | 6 ++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/settingswidget.ui b/settingswidget.ui
index 5bc12ee..9a77f37 100644
--- a/settingswidget.ui
+++ b/settingswidget.ui
@@ -959,6 +959,9 @@
                        </item>
                        <item>
                         <layout class="QVBoxLayout" name="verticalLayout_16">
+                         <property name="spacing">
+                          <number>14</number>
+                         </property>
                          <property name="leftMargin">
                           <number>20</number>
                          </property>
@@ -1005,7 +1008,7 @@
                               <string>Toggle automatic updates</string>
                              </property>
                              <property name="text" stdset="0">
-                              <string>Check for updates automatically every</string>
+                              <string>Check for updates automatically</string>
                              </property>
                              <property name="checked" stdset="0">
                               <bool>true</bool>
diff --git a/toggleswitch.cpp b/toggleswitch.cpp
index f7554a9..f20885d 100644
--- a/toggleswitch.cpp
+++ b/toggleswitch.cpp
@@ -28,7 +28,7 @@ ToggleSwitch::ToggleSwitch(QWidget *parent)
     switch_(false),
     margin_(3),
     thumb_("#d5d5d5"),
-    textMargin_(24),
+    textMargin_(18),
     anim_(new QPropertyAnimation(this, "offset", this)),
     style_(SwitchStyle::UWP)
 {
@@ -55,8 +55,6 @@ void ToggleSwitch::paintEvent(QPaintEvent *e)
 {
     Q_UNUSED(e);
     QPainter p(this);
-    //p.setOpacity(isEnabled() ? (switch_ ? 0.5 : 0.38) : 0.12);
-    //p.setOpacity(isEnabled() ? 1.0 : 0.12);
     p.setOpacity(isEnabled() ? (switch_ ? 1.0 : 0.5) : 0.12);
     p.setRenderHint(QPainter::Antialiasing, true);
 
@@ -98,7 +96,7 @@ void ToggleSwitch::paintEvent(QPaintEvent *e)
     }
     p.setOpacity(1.0);
     p.setPen(isEnabled() ? Qt::black : Qt::gray);
-    p.drawText(width_ + textMargin_, height_ - margin_, text_);
+    p.drawText(width_ + textMargin_, height_ - margin_ - 1, text_);
 }
 
 void ToggleSwitch::mouseReleaseEvent(QMouseEvent *e)
-- 
GitLab