Browse Source

performance improvement in loader::load

Malte Veerman 10 years ago
parent
commit
d777af82e7
1 changed files with 8 additions and 1 deletions
  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;
         return false;
     }
     }
 
 
+    //Disconnect hwmons for performance reasons
+    //They get reconnected later
     foreach (Hwmon *hwmon, m_hwmons)
     foreach (Hwmon *hwmon, m_hwmons)
     {
     {
         disconnect(hwmon, SIGNAL(configUpdateNeeded()), this, SLOT(createConfigFile()));
         disconnect(hwmon, SIGNAL(configUpdateNeeded()), this, SLOT(createConfigFile()));
@@ -133,7 +135,6 @@ bool Loader::load(const QUrl &url)
         {
         {
             qobject_cast<PwmFan *>(pwmFan)->reset();
             qobject_cast<PwmFan *>(pwmFan)->reset();
         }
         }
-        connect(hwmon, SIGNAL(configUpdateNeeded()), this, SLOT(createConfigFile()));
     }
     }
 
 
     stream.setString(&fileContent);
     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;
     m_configUrl = url;
     emit configUrlChanged();
     emit configUrlChanged();