Delayed loading of stats draft default tip
authorJohn Abraham
Fri, 04 Apr 2014 06:43:55 -0700
changeset 251 6a6e0b135c33
parent 250 35ebd3d85f9c
Delayed loading of stats
animatorconstants.h
statsmode.cpp
statsmode.h
--- a/animatorconstants.h	Thu Apr 03 06:22:12 2014 -0700
+++ b/animatorconstants.h	Fri Apr 04 06:43:55 2014 -0700
@@ -25,7 +25,7 @@
 #define ANIMLINK_ZVALUE -1
 #define ANIMBACKGROUND_ZVALUE -2
 
-#define WIRED_PACKET_SLOTS 5
+#define WIRED_PACKET_SLOTS 4
 #define NODE_POS_STATS_DLG_WIDTH_MIN 200
 #define VERTICAL_TOOLBAR_WIDTH_DEFAULT 30
 #define ICON_WIDTH_DEFAULT 20
--- a/statsmode.cpp	Thu Apr 03 06:22:12 2014 -0700
+++ b/statsmode.cpp	Fri Apr 04 06:43:55 2014 -0700
@@ -85,6 +85,7 @@
 void
 StatsMode::init ()
 {
+  m_state = INIT;
   initToolbars ();
 
   StatsView::getInstance ()->setScene (InterfaceStatsScene::getInstance ());
@@ -328,9 +329,10 @@
 void
 StatsMode::systemReset ()
 {
+  m_state = INIT;
   InterfaceStatsScene::getInstance ()->systemReset ();
   addNodesToToolbar ();
-
+  m_state = READY;
 }
 
 void
@@ -712,7 +714,10 @@
         {
           m_activeNodes[nodeId] = active;
         }
-      InterfaceStatsScene::getInstance ()->reloadContent ();
+      if (m_state == READY)
+        {
+          InterfaceStatsScene::getInstance ()->reloadContent ();
+        }
       RoutingStatsScene::getInstance ()->reloadContent ();
       FlowMonStatsScene::getInstance ()->reloadContent ();
 
--- a/statsmode.h	Thu Apr 03 06:22:12 2014 -0700
+++ b/statsmode.h	Fri Apr 04 06:43:55 2014 -0700
@@ -51,6 +51,7 @@
     CounterTables = 3
   } StatType_t;
 public:
+
   // Getters
   static StatsMode * getInstance ();
   QWidget * getCentralWidget ();
@@ -74,6 +75,12 @@
 
 
 private:
+  // state
+  typedef enum
+  {
+    INIT,
+    READY
+  } StatsModeState_t;
 
   typedef std::vector<NodeButton *> NodeButtonVector_t;
   typedef std::map<uint32_t, bool> ActiveNodesMap_t;
@@ -118,6 +125,7 @@
   qreal m_parsedMaxSimulationTime;
   qreal m_currentFontSize;
   bool m_showChart;
+  StatsModeState_t m_state;
 
 
   StatsMode ();