瀏覽代碼

performance improvement in loader::load

Malte Veerman 10 年之前
父節點
當前提交
d777af82e7
共有 1 個文件被更改,包括 8 次插入1 次删除
  1. 8 1
      lib/src/loader.cpp

+ 8 - 1
lib/src/loader.cpp

@@ -126,6 +126,8 @@ bool Loader::load(const QUrl &url)
         return false;
     }
 
+    //Disconnect hwmons for performance reasons
+    //They get reconnected later
     foreach (Hwmon *hwmon, m_hwmons)
     {
         disconnect(hwmon, SIGNAL(configUpdateNeeded()), this, SLOT(createConfigFile()));
@@ -133,7 +135,6 @@ bool Loader::load(const QUrl &url)
         {
             qobject_cast<PwmFan *>(pwmFan)->reset();
         }
-        connect(hwmon, SIGNAL(configUpdateNeeded()), this, SLOT(createConfigFile()));
     }
 
     stream.setString(&fileContent);
@@ -316,6 +317,12 @@ bool Loader::load(const QUrl &url)
         }
     }
     
+    //Connect hwmons again
+    foreach (Hwmon *hwmon, m_hwmons)
+    {
+        connect(hwmon, SIGNAL(configUpdateNeeded()), this, SLOT(createConfigFile()));
+    }
+    
     m_configUrl = url;
     emit configUrlChanged();