Explorar o código

fixed qml fan path error

Malte Veerman %!s(int64=5) %!d(string=hai) anos
pai
achega
92dbd975ae
Modificáronse 4 ficheiros con 13 adicións e 3 borrados
  1. 1 1
      import/qml/FanHeader.qml
  2. 9 0
      import/src/sensor.cpp
  3. 2 1
      import/src/sensor.h
  4. 1 1
      import/src/temp.cpp

+ 1 - 1
import/qml/FanHeader.qml

@@ -40,7 +40,7 @@ RowLayout {
     Label {
         Layout.alignment: Qt.AlignRight
         Layout.rightMargin: Kirigami.Units.smallSpacing
-        text: !!fan ? fan.path : ""
+        text: !!fan ? fan.id : ""
         horizontalAlignment: Text.AlignRight
     }
 

+ 9 - 0
import/src/sensor.cpp

@@ -40,4 +40,13 @@ Sensor::Sensor(Hwmon *parent, uint index, const QString &type, bool device) : QO
     connect(this, &Sensor::error, parent, &Hwmon::error);
 }
 
+void Sensor::setId(const QString& id)
+{
+    if (m_id == id)
+        return;
+
+    m_id = id;
+}
+
+
 }

+ 2 - 1
import/src/sensor.h

@@ -64,7 +64,7 @@ signals:
 
 protected:
 
-    QString m_id;
+    void setId(const QString &id);
 
 
 private:
@@ -72,6 +72,7 @@ private:
     Hwmon *const m_parent;
     const uint m_index;
     QString m_path;
+    QString m_id;
     bool m_device;
 };
 

+ 1 - 1
import/src/temp.cpp

@@ -70,7 +70,7 @@ Temp::Temp(uint index, Hwmon *parent, bool device) :
             if (labelFile->open(QFile::ReadOnly))
             {
                 m_label = QTextStream(labelFile).readLine();
-                m_id = parent->name() + "/" + m_label;
+                setId(parent->name() + "/" + m_label);
             }
             else
                 emit error(i18n("Can't open label file: \'%1\'", path + "/temp" + QString::number(index) + "_label"));