Index: /trunk/FACT++/gui/FactGui.h
===================================================================
--- /trunk/FACT++/gui/FactGui.h	(revision 10649)
+++ /trunk/FACT++/gui/FactGui.h	(revision 10650)
@@ -342,4 +342,43 @@
     map<string, DimInfo*> fServices;
 
+    // ========================== LED Colors ================================
+
+    enum LedColor_t
+    {
+        kLedRed,
+        kLedGreen,
+        kLedYellow,
+        kLedOrange,
+        kLedGray
+    };
+
+    void SetLedColor(QPushButton *button, LedColor_t col)
+    {
+        switch (col)
+        {
+        case kLedRed:
+            button->setIcon(QIcon(":/Resources/icons/red circle 1.png"));
+            break;
+
+        case kLedGreen:
+            button->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
+            break;
+
+        case kLedYellow:
+            button->setIcon(QIcon(":/Resources/icons/yellow circle 1.png"));
+            break;
+
+        case kLedOrange:
+            button->setIcon(QIcon(":/Resources/icons/orange circle 1.png"));
+            break;
+
+        case kLedGray:
+            button->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
+            break;
+        }
+
+        button->setToolTip("Last change: "+QDateTime::currentDateTimeUtc().toString()+" UTC");
+    }
+
     // ===================== Services and Commands ==========================
 
@@ -663,8 +702,5 @@
         str << "V" << version/100 << 'r' << version%100;
 
-        if (version==0)
-            fStatusDNSLed->setIcon(QIcon(":/Resources/icons/red circle 1.png"));
-        else
-            fStatusDNSLed->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
+        SetLedColor(fStatusDNSLed, version==0 ? kLedRed : kLedGreen);
 
         fStatusDNSLabel->setText(version==0?"Offline":str.str().c_str());
@@ -773,18 +809,7 @@
         const uint32_t files = d.get<uint32_t>();
 
-        if (files&1)
-            fLoggerLedLog->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
-        else
-            fLoggerLedLog->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
-
-        if (files&2)
-            fLoggerLedRep->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
-        else
-            fLoggerLedRep->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
-
-        if (files&4)
-            fLoggerLedFits->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
-        else
-            fLoggerLedFits->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
+        SetLedColor(fLoggerLedLog,  files&1 ? kLedGreen : kLedGray);
+        SetLedColor(fLoggerLedRep,  files&2 ? kLedGreen : kLedGray);
+        SetLedColor(fLoggerLedFits, files&4 ? kLedGreen : kLedGray);
     }
 
@@ -801,18 +826,7 @@
         const uint32_t files = d.get<uint32_t>();
 
-        if (files&1)
-            fLoggerLedLog->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
-        else
-            fLoggerLedLog->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
-
-        if (files&2)
-            fLoggerLedRep->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
-        else
-            fLoggerLedRep->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
-
-        if (files&4)
-            fLoggerLedFits->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
-        else
-            fLoggerLedFits->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
+        SetLedColor(fLoggerLedLog,  files&1 ? kLedGreen : kLedGray);
+        SetLedColor(fLoggerLedRep,  files&2 ? kLedGreen : kLedGray);
+        SetLedColor(fLoggerLedFits, files&4 ? kLedGreen : kLedGray);
     }
 
@@ -933,40 +947,25 @@
     void SetFtuLed(int idx, int counter)
     {
-        if (counter==0)
+        if (counter==0 || counter>3)
             counter = 3;
 
-        if (counter==-1)
+        if (counter<0)
             counter = 0;
 
-        switch (counter)
+        const LedColor_t col[4] = { kLedGray, kLedGreen, kLedOrange, kLedRed };
+
+        SetLedColor(fFtuLED[idx], col[counter]);
+
+        fFtuStatus[idx] = counter;
+    }
+
+    void SetFtuStatusLed()
+    {
+        const int max = fFtuStatus.max();
+
+        switch (max)
         {
         case 0:
-            fFtuLED[idx]->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
-            break;
-
-        case 1:
-            fFtuLED[idx]->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
-            break;
-
-        case 2:
-            fFtuLED[idx]->setIcon(QIcon(":/Resources/icons/orange circle 1.png"));
-            break;
-
-        case 3:
-            fFtuLED[idx]->setIcon(QIcon(":/Resources/icons/red circle 1.png"));
-            break;
-        }
-
-        fFtuStatus[idx] = counter;
-    }
-
-    void SetFtuStatusLed()
-    {
-        const int max = fFtuStatus.max();
-
-        switch (max)
-        {
-        case 0:
-            fStatusFTULed->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
+            SetLedColor(fStatusFTULed, kLedGray);
             fStatusFTULabel->setText("All disabled");
             fStatusFTULabel->setToolTip("All FTUs are disabled");
@@ -974,11 +973,11 @@
 
         case 1:
-            fStatusFTULed->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
+            SetLedColor(fStatusFTULed, kLedGreen);
             fStatusFTULabel->setToolTip("Communication with FTU is smooth.");
-            fStatusFTULabel->setText("Ok");
+            fStatusFTULabel->setText("ok");
             break;
 
         case 2:
-            fStatusFTULed->setIcon(QIcon(":/Resources/icons/orange circle 1.png"));
+            SetLedColor(fStatusFTULed, kLedOrange);
             fStatusFTULabel->setText("Warning");
             fStatusFTULabel->setToolTip("At least one FTU didn't answer immediately");
@@ -986,5 +985,5 @@
 
         case 3:
-            fStatusFTULed->setIcon(QIcon(":/Resources/icons/red circle 1.png"));
+            SetLedColor(fStatusFTULed, kLedRed);
             fStatusFTULabel->setToolTip("At least one FTU didn't answer!");
             fStatusFTULabel->setText("ERROR");
@@ -1158,10 +1157,10 @@
 
             if (s.index<FTM::kDisconnected) // No Dim connection
-                fStatusFTMLed->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
+                SetLedColor(fStatusFTMLed, kLedGray);
             if (s.index==FTM::kDisconnected) // Dim connection / FTM disconnected
-                fStatusFTMLed->setIcon(QIcon(":/Resources/icons/yellow circle 1.png"));
+                SetLedColor(fStatusFTMLed, kLedYellow);
             if (s.index==FTM::kConnected || s.index==FTM::kIdle) // Dim connection / FTM connected
             {
-                fStatusFTMLed->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
+                SetLedColor(fStatusFTMLed, kLedGreen);
                 enable = true;
             }
@@ -1173,5 +1172,5 @@
             if (!enable)
             {
-                fStatusFTULed->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
+                SetLedColor(fStatusFTULed, kLedGray);
                 fStatusFTULabel->setText("Offline");
                 fStatusFTULabel->setToolTip("FTM is not online.");
@@ -1185,9 +1184,9 @@
 
             if (s.index<FTM::kDisconnected) // No Dim connection
-                fStatusFADLed->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
+                SetLedColor(fStatusFADLed, kLedGray);
             if (s.index==FTM::kDisconnected) // Dim connection / FTM disconnected
-                fStatusFADLed->setIcon(QIcon(":/Resources/icons/yellow circle 1.png"));
+                SetLedColor(fStatusFADLed, kLedYellow);
             if (s.index==FTM::kConnected) // Dim connection / FTM connected
-                fStatusFADLed->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
+                SetLedColor(fStatusFADLed, kLedGreen);
         }
 
@@ -1200,14 +1199,14 @@
 
             if (s.index<=30)   // Ready/Waiting
-                fStatusLoggerLed->setIcon(QIcon(":/Resources/icons/yellow circle 1.png"));
+                SetLedColor(fStatusLoggerLed, kLedYellow);
             if (s.index<-1)     // Offline
             {
-                fStatusLoggerLed->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
+                SetLedColor(fStatusLoggerLed, kLedGray);
                 enable = false;
             }
             if (s.index>=0x100) // Error
-                fStatusLoggerLed->setIcon(QIcon(":/Resources/icons/red circle 1.png"));
+                SetLedColor(fStatusLoggerLed, kLedRed);
             if (s.index==40)   // Logging
-                fStatusLoggerLed->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
+                SetLedColor(fStatusLoggerLed, kLedGreen);
 
             fLoggerWidget->setEnabled(enable);
@@ -1220,8 +1219,5 @@
             fChatOnline = s.index==0;
 
-            if (fChatOnline) // Dim connection / FTM connected
-                fStatusChatLed->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
-            else
-                fStatusChatLed->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
+            SetLedColor(fStatusChatLed, fChatOnline ? kLedGreen : kLedRed);
 
             fChatSend->setEnabled(fChatOnline);
@@ -1233,8 +1229,5 @@
             fStatusSchedulerLabel->setText(s.name.c_str());
 
-            if (s.index>=0) // Dim connection / FTM connected
-                fStatusSchedulerLed->setIcon(QIcon(":/Resources/icons/green circle 1.png"));
-            else
-                fStatusSchedulerLed->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));
+            SetLedColor(fStatusSchedulerLed, s.index>=0 ? kLedGreen : kLedRed);
         }
     }
