Browse Source

First couple of fixes

Malte Veerman 10 years ago
parent
commit
047ac5def4

+ 14 - 10
fancontrol-gui/qml/fancontrol-gui.qml

@@ -75,28 +75,22 @@ ApplicationWindow {
                 }
             }
             ToolButton {
-                property bool serviceActive
-
                 id: restartButton
-                iconName: serviceActive ? "system-reboot" : "system-run"
+                iconName: activeTimer.serviceActive ? "system-reboot" : "system-run"
                 visible: typeof systemdCom !== "undefined"
                 onClicked: systemdCom.dbusAction("ReloadOrRestartUnit",
                                                  [systemdCom.serviceName + ".service", "replace"])
 
                 ToolTip {
-                    text: parent.serviceActive ? "Restart fancontrol" : "Start fancontrol"
+                    text: activeTimer.serviceActive ? "Restart fancontrol" : "Start fancontrol"
                 }
 
-                Timer {
-                    interval: 1000
-                    running: typeof systemdCom !== "undefined"
-                    repeat: true
-                    onTriggered: parent.serviceActive = systemdCom.serviceActive()
-                }
+
             }
             ToolButton {
                 iconName: "system-shutdown"
                 visible: typeof systemdCom !== "undefined"
+                enabled: activeTimer.serviceActive
                 onClicked: systemdCom.dbusAction("StopUnit",
                                                  [systemdCom.serviceName + ".service", "replace"])
 
@@ -180,6 +174,16 @@ ApplicationWindow {
         }
     }
 
+    Timer {
+        property bool serviceActive
+
+        id: activeTimer
+        interval: 1000
+        running: typeof systemdCom !== "undefined"
+        repeat: true
+        onTriggered: serviceActive = systemdCom.serviceActive()
+    }
+
     FileDialog {
         id: openFileDialog
         title: "Please choose a configuration file"

+ 0 - 2
fancontrol-gui/src/loader.cpp

@@ -70,8 +70,6 @@ void Loader::parseHwmons()
         connect(hwmon, SIGNAL(configUpdateNeeded()), this, SLOT(createConfigFile()));
         connect(this, SIGNAL(sensorsUpdateNeeded()), hwmon, SLOT(updateSensors()));
         m_hwmons << hwmon;
-
-//        qDebug() << m_devnames.value(hwmon);
     }
     emit hwmonsChanged();
 }

+ 1 - 1
fancontrol-gui/src/systemdcommunicator.cpp

@@ -104,7 +104,7 @@ bool SystemdCommunicator::serviceExists()
 
 bool SystemdCommunicator::serviceActive()
 {
-    if (m_serviceInterface->isValid())
+    if (m_serviceInterface && m_serviceInterface->isValid())
     {
         if (m_serviceInterface->property("ActiveState").toString() == "active")
         {

+ 4 - 2
helper/CMakeLists.txt

@@ -3,9 +3,11 @@ kauth_install_actions(fancontrol.gui.helper fancontrol-gui.actions)
 
 set(LIBRARIES KF5::Auth)
 
-if(NOT NO_SYSTEMD)
+if(NO_SYSTEMD)
+    add_definitions(-DNO_SYSTEMD)
+else(NO_SYSTEMD)
     set(LIBRARIES ${LIBRARIES} Qt5::DBus)
-endif(NOT NO_SYSTEMD)
+endif(NO_SYSTEMD)
 
 add_executable(Fancontrol-GUIHelper src/helper.cpp)
 target_link_libraries(Fancontrol-GUIHelper ${LIBRARIES})

+ 1 - 1
share/qml/PwmFan.qml

@@ -394,7 +394,7 @@ Rectangle {
                 color: enabled ? palette.text : disabledPalette.text
                 renderType: Text.NativeRendering
             }
-            NumberOption {
+            OptionInput {
                 id: minStartInput
                 anchors.right: parent.right
                 width: 50

+ 1 - 0
share/qml/SensorsTab.qml

@@ -35,6 +35,7 @@ RowLayout {
             property int padding: 10
 
             Layout.preferredWidth: root.width / loader.hwmons.length - root.spacing
+            Layout.maximumWidth: 500
             Layout.fillHeight: true
             border.width: 1
             border.color: "black"