Changeset 10650
- Timestamp:
- 05/10/11 14:11:36 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/FactGui.h
r10633 r10650 342 342 map<string, DimInfo*> fServices; 343 343 344 // ========================== LED Colors ================================ 345 346 enum LedColor_t 347 { 348 kLedRed, 349 kLedGreen, 350 kLedYellow, 351 kLedOrange, 352 kLedGray 353 }; 354 355 void SetLedColor(QPushButton *button, LedColor_t col) 356 { 357 switch (col) 358 { 359 case kLedRed: 360 button->setIcon(QIcon(":/Resources/icons/red circle 1.png")); 361 break; 362 363 case kLedGreen: 364 button->setIcon(QIcon(":/Resources/icons/green circle 1.png")); 365 break; 366 367 case kLedYellow: 368 button->setIcon(QIcon(":/Resources/icons/yellow circle 1.png")); 369 break; 370 371 case kLedOrange: 372 button->setIcon(QIcon(":/Resources/icons/orange circle 1.png")); 373 break; 374 375 case kLedGray: 376 button->setIcon(QIcon(":/Resources/icons/gray circle 1.png")); 377 break; 378 } 379 380 button->setToolTip("Last change: "+QDateTime::currentDateTimeUtc().toString()+" UTC"); 381 } 382 344 383 // ===================== Services and Commands ========================== 345 384 … … 663 702 str << "V" << version/100 << 'r' << version%100; 664 703 665 if (version==0) 666 fStatusDNSLed->setIcon(QIcon(":/Resources/icons/red circle 1.png")); 667 else 668 fStatusDNSLed->setIcon(QIcon(":/Resources/icons/green circle 1.png")); 704 SetLedColor(fStatusDNSLed, version==0 ? kLedRed : kLedGreen); 669 705 670 706 fStatusDNSLabel->setText(version==0?"Offline":str.str().c_str()); … … 773 809 const uint32_t files = d.get<uint32_t>(); 774 810 775 if (files&1) 776 fLoggerLedLog->setIcon(QIcon(":/Resources/icons/green circle 1.png")); 777 else 778 fLoggerLedLog->setIcon(QIcon(":/Resources/icons/gray circle 1.png")); 779 780 if (files&2) 781 fLoggerLedRep->setIcon(QIcon(":/Resources/icons/green circle 1.png")); 782 else 783 fLoggerLedRep->setIcon(QIcon(":/Resources/icons/gray circle 1.png")); 784 785 if (files&4) 786 fLoggerLedFits->setIcon(QIcon(":/Resources/icons/green circle 1.png")); 787 else 788 fLoggerLedFits->setIcon(QIcon(":/Resources/icons/gray circle 1.png")); 811 SetLedColor(fLoggerLedLog, files&1 ? kLedGreen : kLedGray); 812 SetLedColor(fLoggerLedRep, files&2 ? kLedGreen : kLedGray); 813 SetLedColor(fLoggerLedFits, files&4 ? kLedGreen : kLedGray); 789 814 } 790 815 … … 801 826 const uint32_t files = d.get<uint32_t>(); 802 827 803 if (files&1) 804 fLoggerLedLog->setIcon(QIcon(":/Resources/icons/green circle 1.png")); 805 else 806 fLoggerLedLog->setIcon(QIcon(":/Resources/icons/gray circle 1.png")); 807 808 if (files&2) 809 fLoggerLedRep->setIcon(QIcon(":/Resources/icons/green circle 1.png")); 810 else 811 fLoggerLedRep->setIcon(QIcon(":/Resources/icons/gray circle 1.png")); 812 813 if (files&4) 814 fLoggerLedFits->setIcon(QIcon(":/Resources/icons/green circle 1.png")); 815 else 816 fLoggerLedFits->setIcon(QIcon(":/Resources/icons/gray circle 1.png")); 828 SetLedColor(fLoggerLedLog, files&1 ? kLedGreen : kLedGray); 829 SetLedColor(fLoggerLedRep, files&2 ? kLedGreen : kLedGray); 830 SetLedColor(fLoggerLedFits, files&4 ? kLedGreen : kLedGray); 817 831 } 818 832 … … 933 947 void SetFtuLed(int idx, int counter) 934 948 { 935 if (counter==0 )949 if (counter==0 || counter>3) 936 950 counter = 3; 937 951 938 if (counter ==-1)952 if (counter<0) 939 953 counter = 0; 940 954 941 switch (counter) 955 const LedColor_t col[4] = { kLedGray, kLedGreen, kLedOrange, kLedRed }; 956 957 SetLedColor(fFtuLED[idx], col[counter]); 958 959 fFtuStatus[idx] = counter; 960 } 961 962 void SetFtuStatusLed() 963 { 964 const int max = fFtuStatus.max(); 965 966 switch (max) 942 967 { 943 968 case 0: 944 fFtuLED[idx]->setIcon(QIcon(":/Resources/icons/gray circle 1.png")); 945 break; 946 947 case 1: 948 fFtuLED[idx]->setIcon(QIcon(":/Resources/icons/green circle 1.png")); 949 break; 950 951 case 2: 952 fFtuLED[idx]->setIcon(QIcon(":/Resources/icons/orange circle 1.png")); 953 break; 954 955 case 3: 956 fFtuLED[idx]->setIcon(QIcon(":/Resources/icons/red circle 1.png")); 957 break; 958 } 959 960 fFtuStatus[idx] = counter; 961 } 962 963 void SetFtuStatusLed() 964 { 965 const int max = fFtuStatus.max(); 966 967 switch (max) 968 { 969 case 0: 970 fStatusFTULed->setIcon(QIcon(":/Resources/icons/gray circle 1.png")); 969 SetLedColor(fStatusFTULed, kLedGray); 971 970 fStatusFTULabel->setText("All disabled"); 972 971 fStatusFTULabel->setToolTip("All FTUs are disabled"); … … 974 973 975 974 case 1: 976 fStatusFTULed->setIcon(QIcon(":/Resources/icons/green circle 1.png"));975 SetLedColor(fStatusFTULed, kLedGreen); 977 976 fStatusFTULabel->setToolTip("Communication with FTU is smooth."); 978 fStatusFTULabel->setText(" Ok");977 fStatusFTULabel->setText("ok"); 979 978 break; 980 979 981 980 case 2: 982 fStatusFTULed->setIcon(QIcon(":/Resources/icons/orange circle 1.png"));981 SetLedColor(fStatusFTULed, kLedOrange); 983 982 fStatusFTULabel->setText("Warning"); 984 983 fStatusFTULabel->setToolTip("At least one FTU didn't answer immediately"); … … 986 985 987 986 case 3: 988 fStatusFTULed->setIcon(QIcon(":/Resources/icons/red circle 1.png"));987 SetLedColor(fStatusFTULed, kLedRed); 989 988 fStatusFTULabel->setToolTip("At least one FTU didn't answer!"); 990 989 fStatusFTULabel->setText("ERROR"); … … 1158 1157 1159 1158 if (s.index<FTM::kDisconnected) // No Dim connection 1160 fStatusFTMLed->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));1159 SetLedColor(fStatusFTMLed, kLedGray); 1161 1160 if (s.index==FTM::kDisconnected) // Dim connection / FTM disconnected 1162 fStatusFTMLed->setIcon(QIcon(":/Resources/icons/yellow circle 1.png"));1161 SetLedColor(fStatusFTMLed, kLedYellow); 1163 1162 if (s.index==FTM::kConnected || s.index==FTM::kIdle) // Dim connection / FTM connected 1164 1163 { 1165 fStatusFTMLed->setIcon(QIcon(":/Resources/icons/green circle 1.png"));1164 SetLedColor(fStatusFTMLed, kLedGreen); 1166 1165 enable = true; 1167 1166 } … … 1173 1172 if (!enable) 1174 1173 { 1175 fStatusFTULed->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));1174 SetLedColor(fStatusFTULed, kLedGray); 1176 1175 fStatusFTULabel->setText("Offline"); 1177 1176 fStatusFTULabel->setToolTip("FTM is not online."); … … 1185 1184 1186 1185 if (s.index<FTM::kDisconnected) // No Dim connection 1187 fStatusFADLed->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));1186 SetLedColor(fStatusFADLed, kLedGray); 1188 1187 if (s.index==FTM::kDisconnected) // Dim connection / FTM disconnected 1189 fStatusFADLed->setIcon(QIcon(":/Resources/icons/yellow circle 1.png"));1188 SetLedColor(fStatusFADLed, kLedYellow); 1190 1189 if (s.index==FTM::kConnected) // Dim connection / FTM connected 1191 fStatusFADLed->setIcon(QIcon(":/Resources/icons/green circle 1.png"));1190 SetLedColor(fStatusFADLed, kLedGreen); 1192 1191 } 1193 1192 … … 1200 1199 1201 1200 if (s.index<=30) // Ready/Waiting 1202 fStatusLoggerLed->setIcon(QIcon(":/Resources/icons/yellow circle 1.png"));1201 SetLedColor(fStatusLoggerLed, kLedYellow); 1203 1202 if (s.index<-1) // Offline 1204 1203 { 1205 fStatusLoggerLed->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));1204 SetLedColor(fStatusLoggerLed, kLedGray); 1206 1205 enable = false; 1207 1206 } 1208 1207 if (s.index>=0x100) // Error 1209 fStatusLoggerLed->setIcon(QIcon(":/Resources/icons/red circle 1.png"));1208 SetLedColor(fStatusLoggerLed, kLedRed); 1210 1209 if (s.index==40) // Logging 1211 fStatusLoggerLed->setIcon(QIcon(":/Resources/icons/green circle 1.png"));1210 SetLedColor(fStatusLoggerLed, kLedGreen); 1212 1211 1213 1212 fLoggerWidget->setEnabled(enable); … … 1220 1219 fChatOnline = s.index==0; 1221 1220 1222 if (fChatOnline) // Dim connection / FTM connected 1223 fStatusChatLed->setIcon(QIcon(":/Resources/icons/green circle 1.png")); 1224 else 1225 fStatusChatLed->setIcon(QIcon(":/Resources/icons/gray circle 1.png")); 1221 SetLedColor(fStatusChatLed, fChatOnline ? kLedGreen : kLedRed); 1226 1222 1227 1223 fChatSend->setEnabled(fChatOnline); … … 1233 1229 fStatusSchedulerLabel->setText(s.name.c_str()); 1234 1230 1235 if (s.index>=0) // Dim connection / FTM connected 1236 fStatusSchedulerLed->setIcon(QIcon(":/Resources/icons/green circle 1.png")); 1237 else 1238 fStatusSchedulerLed->setIcon(QIcon(":/Resources/icons/gray circle 1.png")); 1231 SetLedColor(fStatusSchedulerLed, s.index>=0 ? kLedGreen : kLedRed); 1239 1232 } 1240 1233 }
Note:
See TracChangeset
for help on using the changeset viewer.