فهرست منبع

added auth icons to some buttons and changed advanced settings area in the kcm

Malte Veerman 10 سال پیش
والد
کامیت
988ec16ab8
3فایلهای تغییر یافته به همراه49 افزوده شده و 35 حذف شده
  1. 2 1
      kcm/src/fancontrolkcm.cpp
  2. 46 34
      package/contents/ui/KCM.qml
  3. 1 0
      package/contents/ui/SettingsTab.qml

+ 2 - 1
kcm/src/fancontrolkcm.cpp

@@ -30,6 +30,7 @@
 
 K_PLUGIN_FACTORY_WITH_JSON(FancontrolKCMFactory, "kcm_fancontrol.json", registerPlugin<FancontrolKCM>();)
 
+
 FancontrolKCM::FancontrolKCM(QObject *parent, const QVariantList& args)
     : ConfigModule(parent, args),
     m_base(new GUIBase(this)),
@@ -52,7 +53,7 @@ FancontrolKCM::FancontrolKCM(QObject *parent, const QVariantList& args)
     
     setButtons(Apply | Default);
     setAuthActionName("fancontrol.gui.helper.action");
-    
+      
     connect(m_base->loader(), &Loader::configFileChanged, [this] () { setNeedsSave(true); });
     connect(m_base, &GUIBase::minTempChanged, [this] () { setNeedsSave(true); });
     connect(m_base, &GUIBase::maxTempChanged, [this] () { setNeedsSave(true); });

+ 46 - 34
package/contents/ui/KCM.qml

@@ -34,42 +34,45 @@ Item {
     implicitWidth: 1024
     implicitHeight: 768
        
-    Column {
-        id: header
+    ColumnLayout {
+        id: noFansInfo
         width: parent.width
-        
-        CheckBox {
-            id: enabledBox
-            visible: kcm.loader.allPwmFans.length > 0
-            Layout.alignment: Qt.AlignLeft | Qt.AlignTop
-            text: i18n("Control fans manually")
-            checked: kcm.manualControl
-            onCheckedChanged: kcm.manualControl = checked
-            
-            Connections {
-                target: kcm
-                onManualControlChanged: enabledBox.checked = kcm.manualControl
-            }
-        }
+        anchors.verticalCenter: parent.verticalCenter
+        spacing: 20
+        visible: kcm.loader.allPwmFans.length == 0
         
         Label {
-            visible: kcm.loader.allPwmFans.length == 0
+            Layout.alignment: Qt.AlignCenter
             text: i18n("There are no pwm capable fans in your system.")
-            anchors.top: enabledBox.bottom
-            anchors.margins: 20
+            font.pointSize: 14
+            font.bold: true
         }
         
         Button {
+            Layout.alignment: Qt.AlignCenter
             text: i18n("Detect fans")
-            visible: kcm.loader.allPwmFans.length == 0
             onClicked: kcm.loader.detectSensors()
         }
     }
+    
+    CheckBox {
+        id: enabledBox
+        visible: kcm.loader.allPwmFans.length > 0
+        Layout.alignment: Qt.AlignLeft | Qt.AlignTop
+        text: i18n("Control fans manually")
+        checked: kcm.manualControl
+        onCheckedChanged: kcm.manualControl = checked
+        
+        Connections {
+            target: kcm
+            onManualControlChanged: enabledBox.checked = kcm.manualControl
+        }
+    }
         
     ColumnLayout {
         width: parent.width
         anchors.bottom: parent.bottom
-        anchors.top: header.bottom
+        anchors.top: enabledBox.bottom
         visible: enabledBox.checked
 
         RowLayout {  
@@ -89,6 +92,7 @@ Item {
             Button {
                 Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
                 text: i18n("Detect fans")
+                iconName: kcm.needsAuthorization ? "dialog-password" : ""
                 onClicked: kcm.loader.detectSensors()
             }
         }
@@ -108,22 +112,30 @@ Item {
             }
         }
         
-        Label {
+        Row {
             property bool expanded: false
-            property string prefix: expanded ? "v " : "> "
 
-            id: expandLabel
-            text: prefix + i18n("Advanced settings")
-            font.bold: true
-            
-            MouseArea {
-                anchors.fill: parent
-                onClicked: parent.expanded = parent.expanded ? false : true
+            id: expand
+
+            Image {
+                id: arrow
+                source: parent.expanded ? "image://icon/go-down" : "image://icon/go-next"
+                fillMode: Image.PreserveAspectFit
+                height: advancedLabel.implicitHeight
+            }
+            Label {
+                id: advancedLabel
+                text: i18n("Advanced settings")
+                font.bold: true
             }
         }
+        MouseArea {
+            anchors.fill: expand
+            onClicked: expand.expanded = expand.expanded ? false : true
+        }
         
         RowLayout {
-            visible: expandLabel.expanded
+            visible: expand.expanded
 
             Label {
                 Layout.preferredWidth: root.textWidth
@@ -150,7 +162,7 @@ Item {
             }
         }
         RowLayout {
-            visible: expandLabel.expanded
+            visible: expand.expanded
 
             Label {
                 Layout.preferredWidth: root.textWidth
@@ -177,7 +189,7 @@ Item {
             }
         }
         RowLayout {
-            visible: expandLabel.expanded
+            visible: expand.expanded
 
             Label {
                 Layout.preferredWidth: root.textWidth
@@ -204,7 +216,7 @@ Item {
             }
         }        
         RowLayout {
-            visible: expandLabel.expanded
+            visible: expand.expanded
 
             Label {
                 Layout.preferredWidth: root.textWidth

+ 1 - 0
package/contents/ui/SettingsTab.qml

@@ -169,6 +169,7 @@ Item {
         Button {
             x: maxTempValue.x
             text: i18n("Detect fans")
+            iconName: "dialog-password"
             onClicked: loader.detectSensors()
         }
     }