[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/applets/system-monitor
From:       Petri Damstén <petri.damsten () kdemail ! net>
Date:       2009-09-08 13:36:16
Message-ID: 1252416976.396619.29390.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1021189 by pdamsten:

Make sure interfaces are always shown in the same order.
BUG:200551

 M  +12 -5     net.cpp  


--- trunk/KDE/kdebase/workspace/plasma/applets/system-monitor/net.cpp #1021188:1021189
@@ -134,10 +134,17 @@
 void SM::Net::dataUpdated(const QString& source,
                           const Plasma::DataEngine::Data &data)
 {
-    QString interface = source.split('/')[2];
-
-    m_data[interface] << data["value"].toDouble();
-    if (m_data[interface].count() > 1) {
+    QStringList splitted = source.split('/');
+    if (splitted.length() < 4) {
+        return;
+    }
+    QString interface = splitted[2];
+    int index = (splitted[3] == "receiver") ? 0 : 1;
+    if (!m_data.contains(interface)) {
+        m_data[interface] = QList<double>() << -1 << -1;
+    }
+    m_data[interface][index] = data["value"].toDouble();
+    if (!m_data[interface].contains(-1)) {
        Plasma::SignalPlotter *plotter = plotters()[interface];
         if (plotter) {
             plotter->addSample(m_data[interface]);
@@ -155,7 +162,7 @@
                 Plasma::ToolTipManager::self()->setContent(this, data);
             }
         }
-        m_data[interface].clear();
+        m_data[interface] = QList<double>() << -1 << -1;
     }
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic