TransmitterSwitchInfo.cpp 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. #include "TransmitterSwitchInfo.h"
  2. #include "lhstylemanager.h"
  3. ExecPlanItemInfo::ExecPlanItemInfo()
  4. {
  5. ExecType = -1;
  6. WeekDay = 0;
  7. // num = -1;
  8. date = QDate::fromString("1970-01-01","yyyy-MM-dd");
  9. execTime = QTime::fromString("00:00:00","hh:mm:ss");
  10. devName = "未定义";
  11. actionID = 0;
  12. actionName = "未定义";
  13. }
  14. ExecPlanItemInfo::ExecPlanItemInfo(const ExecPlanItemInfo& item)
  15. {
  16. ExecType = item.ExecType;
  17. WeekDay = item.WeekDay;
  18. date = item.date;
  19. execTime = item.execTime;
  20. actionID = item.actionID;
  21. devName = item.devName;
  22. actionName = item.actionName;
  23. }
  24. ExecPlanItemInfo& ExecPlanItemInfo::operator=(const ExecPlanItemInfo& item)
  25. {
  26. if(this == &item)
  27. return *this;
  28. ExecType = item.ExecType;
  29. WeekDay = item.WeekDay;
  30. // num = item.num;
  31. date = item.date;
  32. execTime = item.execTime;
  33. devName = item.devName;
  34. actionID = item.actionID;
  35. actionName = item.actionName;
  36. // dateType = item.dateType;
  37. // cfgDev = item.cfgDev;
  38. return *this;
  39. }
  40. DevTypeInfo::DevTypeInfo()
  41. {
  42. devTypeName = "";
  43. devAction.clear();
  44. devType_MB.clear();
  45. PTTypeCode = -1;
  46. }
  47. DevTypeInfo& DevTypeInfo::operator=(const DevTypeInfo& devInfo)
  48. {
  49. devTypeName = devInfo.devTypeName;
  50. devAction = devInfo.devAction;
  51. devType_MB = devInfo.devType_MB;
  52. PTTypeCode = devInfo.PTTypeCode;
  53. return *this;
  54. }
  55. MapDevType::MapDevType()
  56. {
  57. initDevType();
  58. }
  59. /* 添加支持的设备类型 */
  60. void MapDevType::initDevType()
  61. {
  62. /* 955发射机 */
  63. DevTypeInfo devInfo;
  64. devInfo.devTypeName = "衢州台发射机";
  65. devInfo.PTTypeCode = 955;
  66. devInfo.devAction[1] = "开机";
  67. devInfo.devAction[2] = "关机";
  68. devInfo.devType_MB.insert(enum_DeviceMB::Dev_Main,"主");
  69. devInfo.devType_MB.insert(enum_DeviceMB::Dev_Backup,"备");
  70. devInfo.devType_MB.insert(enum_DeviceMB::Dev_Contingency,"应急");
  71. m_mapDevType.insert(955, devInfo);
  72. /* 其他发射机 */
  73. }
  74. /* 获取某一个发射机类型 */
  75. DevTypeInfo MapDevType::getDevType(int PTTypeCode)
  76. {
  77. if(m_mapDevType.contains(PTTypeCode))
  78. {
  79. return m_mapDevType[PTTypeCode];
  80. }
  81. return DevTypeInfo();
  82. }
  83. DeviceInfo::DeviceInfo()
  84. {
  85. devName = "未定义";
  86. PTTypeCode = -1;
  87. DevType = DevTypeInfo();
  88. DTID = 0;
  89. DID = 0;
  90. ChannelID = 0;
  91. }
  92. DeviceInfo::DeviceInfo(const DeviceInfo& devInfo)
  93. {
  94. devName = devInfo.devName;
  95. PTTypeCode = devInfo.PTTypeCode;
  96. DevType = devInfo.DevType;
  97. DTID = devInfo.DTID;
  98. DID = devInfo.DID;
  99. ChannelID = devInfo.ChannelID;
  100. }
  101. DeviceInfo& DeviceInfo::operator=(const DeviceInfo& devInfo)
  102. {
  103. devName = devInfo.devName;
  104. PTTypeCode = devInfo.PTTypeCode;
  105. DevType = devInfo.DevType;
  106. DTID = devInfo.DTID;
  107. DID = devInfo.DID;
  108. ChannelID = devInfo.ChannelID;
  109. return *this;
  110. }
  111. MapDevice::MapDevice()
  112. {
  113. }
  114. /* 添加一个设备 */
  115. void MapDevice::addDevice(const DeviceInfo& devInfo)
  116. {
  117. /* 先查重 */
  118. if(m_mapDevice.contains(devInfo.devName))
  119. {
  120. return;
  121. }
  122. m_mapDevice.insert(devInfo.devName, devInfo);
  123. }
  124. /* 获取一个设备 */
  125. DeviceInfo MapDevice::getDevice(const QString& devName)
  126. {
  127. if(m_mapDevice.contains(devName))
  128. {
  129. return m_mapDevice[devName];
  130. }
  131. return DeviceInfo();
  132. }
  133. /* 查找一个设备 */
  134. bool MapDevice::findDevice(const QString& devName)
  135. {
  136. return m_mapDevice.contains(devName);
  137. }
  138. /* 根据设备名称获取设备动作 */
  139. bool MapDevice::getDevAction(const QString& devName, QMap<int, QString>& devAction)
  140. {
  141. if(m_mapDevice.contains(devName))
  142. {
  143. devAction = m_mapDevice[devName].DevType.devAction;
  144. return true;
  145. }
  146. return false;
  147. }
  148. /* 删除一个设备 */
  149. void MapDevice::deleteDevice(const QString& devName)
  150. {
  151. if(m_mapDevice.contains(devName))
  152. {
  153. m_mapDevice.remove(devName);
  154. }
  155. }
  156. ExecPlanGlobalConfig::ExecPlanGlobalConfig()
  157. {
  158. m_qssPath = "";
  159. }
  160. /* 设置样式表路径 */
  161. void ExecPlanGlobalConfig::setQSSPath(const QString& qssPath)
  162. {
  163. m_qssPath = qssPath;
  164. }
  165. /* 获取样式表路径 */
  166. QString ExecPlanGlobalConfig::getQSSPath()
  167. {
  168. if(LHStyleManager::Instance()->GetCurSkinStyle() == SkinStyle::eWhiteStyle)
  169. {
  170. return m_qssPath + m_lightQSS;
  171. }
  172. else if(LHStyleManager::Instance()->GetCurSkinStyle() == SkinStyle::eBlackStyle)
  173. {
  174. return m_qssPath + m_darkQSS;
  175. }
  176. return QString();
  177. }