FRAME_CctvListF.cpp 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include "ITS_OPLibF.h"
  4. #include "ITSSkinF.h"
  5. #include "ITSUtilF.h"
  6. #include "ITSLangTransF.h"
  7. #include "CDSCodeF.h"
  8. #include "CDSCctvCtlrF.h"
  9. #pragma hdrstop
  10. #include "FRAME_CctvListF.h"
  11. //---------------------------------------------------------------------------
  12. #pragma package(smart_init)
  13. #pragma link "cxButtons"
  14. #pragma link "cxCalc"
  15. #pragma link "cxCheckBox"
  16. #pragma link "cxClasses"
  17. #pragma link "cxContainer"
  18. #pragma link "cxControls"
  19. #pragma link "cxCustomData"
  20. #pragma link "cxData"
  21. #pragma link "cxDataStorage"
  22. #pragma link "cxDropDownEdit"
  23. #pragma link "cxEdit"
  24. #pragma link "cxFilter"
  25. #pragma link "cxGraphics"
  26. #pragma link "cxGrid"
  27. #pragma link "cxGridCustomTableView"
  28. #pragma link "cxGridCustomView"
  29. #pragma link "cxGridLevel"
  30. #pragma link "cxGridTableView"
  31. #pragma link "cxLabel"
  32. #pragma link "cxLookAndFeelPainters"
  33. #pragma link "cxLookAndFeels"
  34. #pragma link "cxMaskEdit"
  35. #pragma link "cxStyles"
  36. #pragma link "cxTextEdit"
  37. #pragma link "dxSkinBlue"
  38. #pragma link "dxSkinsCore"
  39. #pragma link "dxSkinscxPCPainter"
  40. #pragma link "dxSkinBlack"
  41. #pragma link "dxSkinMcSkin"
  42. #pragma link "cxSpinEdit"
  43. #pragma resource "*.dfm"
  44. //TFRAMECctvList *FRAMECctvList;
  45. //---------------------------------------------------------------------------
  46. __fastcall TFRAMECctvList::TFRAMECctvList(TComponent* Owner)
  47. : TFrame(Owner)
  48. {
  49. LangTrans->Translate(this, ITSDb_GetConnection());
  50. m_pGDC = TvList->DataController;
  51. //TvList->OptionsView->NoDataToDisplayInfoText = "<CCTV Á¤º¸°¡ ¾ø½À´Ï´Ù>";
  52. #ifdef D_CCTV_HANTE
  53. APP_FillCode(CbType, "CTVT");
  54. Column07->Visible = true;
  55. Column09->Visible = true;
  56. Column06->Visible = false;
  57. Column13->Visible = false;
  58. #else
  59. Column07->Visible = false;
  60. Column09->Visible = false;
  61. Column06->Visible = true;
  62. Column13->Visible = true;
  63. #endif
  64. FTitle = lblTitle->Caption;
  65. }
  66. //---------------------------------------------------------------------------
  67. void __fastcall TFRAMECctvList::UpdateList()
  68. {
  69. CMM_ClearGridTableView(TvList);
  70. int nRow = 0;
  71. TvList->BeginUpdate();
  72. try
  73. {
  74. CctvCtlrManager->FLists.Lock();
  75. try
  76. {
  77. FOR_STL(TCctvCtlr*, pObj, CctvCtlrManager->FLists)
  78. {
  79. if (pObj->DEL_YN == "Y") continue;
  80. nRow = m_pGDC->AppendRecord();
  81. m_pGDC->Values[nRow][ColumnSel->Index] = false;
  82. m_pGDC->Values[nRow][Column00->Index] = "-";
  83. m_pGDC->Values[nRow][Column01->Index] = pObj->CTLR_NMBR.ToIntDef(0);
  84. m_pGDC->Values[nRow][Column02->Index] = pObj->CTLR_ID;
  85. m_pGDC->Values[nRow][Column03->Index] = pObj->NAME;
  86. m_pGDC->Values[nRow][Column05->Index] = pObj->CTLR_IP;
  87. m_pGDC->Values[nRow][Column08->Index] = pObj->STRM_SESN_NM;
  88. #ifdef D_CCTV_HANTE
  89. m_pGDC->Values[nRow][Column04->Index] = APP_GetCodeName(CbType, pObj->CCTV_TYPE);
  90. m_pGDC->Values[nRow][Column07->Index] = pObj->CCTV_IP;
  91. m_pGDC->Values[nRow][Column09->Index] = pObj->STRM_SVR_IP;
  92. #else
  93. m_pGDC->Values[nRow][Column04->Index] = pObj->CCTV_TYPE;
  94. m_pGDC->Values[nRow][Column06->Index] = pObj->CTLR_PORT;
  95. m_pGDC->Values[nRow][Column13->Index] = pObj->INTR_RTMP_ADDR;
  96. #endif
  97. m_pGDC->Values[nRow][Column10->Index] = pObj->STRM_RTSP_ADDR;
  98. m_pGDC->Values[nRow][Column11->Index] = pObj->STRM_RTMP_ADDR;
  99. m_pGDC->Values[nRow][Column12->Index] = pObj->STRM_HTTP_ADDR;
  100. m_pGDC->Values[nRow][Column14->Index] = pObj->CCTV_SBST_DSPL_YN;
  101. m_pGDC->Values[nRow][Column99->Index] = (int)pObj;
  102. }
  103. }
  104. __finally
  105. {
  106. CctvCtlrManager->FLists.UnLock();
  107. }
  108. }
  109. __finally
  110. {
  111. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  112. TvList->EndUpdate();
  113. Column01->SortIndex = Column01->Index;
  114. Column01->SortOrder = soAscending;
  115. TvList->DataController->GotoFirst();
  116. TvList->DataController->FocusedRecordIndex = 0;
  117. }
  118. }
  119. //---------------------------------------------------------------------------
  120. void __fastcall TFRAMECctvList::BtnAllSelectClick(TObject *Sender)
  121. {
  122. TcxButton *pBtn = (TcxButton*)Sender;
  123. CMM_CheckAllListItem(TvList, ColumnSel->Index, pBtn->Tag);
  124. }
  125. //---------------------------------------------------------------------------
  126. int __fastcall TFRAMECctvList::GetSelIds(String &ALinkIds)
  127. {
  128. ALinkIds = "";
  129. if (TvList->ViewData->RecordCount <= 0) return 0;
  130. int nIndex = m_pGDC->FocusedRecordIndex;
  131. if( nIndex < 0 )
  132. return 0;
  133. String sLinkId = VarToStr(m_pGDC->Values[nIndex][Column01->Index]);
  134. ALinkIds = sLinkId;
  135. return 1;
  136. }
  137. //---------------------------------------------------------------------------
  138. int __fastcall TFRAMECctvList::GetSelIds(TStringList *AStringList)
  139. {
  140. int nSelCnt = 0;
  141. try
  142. {
  143. TvList->BeginUpdate();
  144. int nRowCnt = TvList->ViewData->RecordCount;
  145. for (int ii = 0; ii < nRowCnt; ii++)
  146. {
  147. TcxCustomGridRow* ARow = TvList->ViewData->Rows[ii];
  148. if (((bool)ARow->Values[ColumnSel->Index]))
  149. {
  150. AStringList->Add(ARow->Values[Column01->Index]);
  151. nSelCnt++;
  152. }
  153. }
  154. }
  155. __finally
  156. {
  157. TvList->EndUpdate();
  158. }
  159. return nSelCnt;
  160. }
  161. //---------------------------------------------------------------------------
  162. void __fastcall TFRAMECctvList::TvListDataControllerFilterChanged(TObject *Sender)
  163. {
  164. LblRecords->Caption = "("+FormatFloat("##,##0", m_pGDC->FilteredRecordCount) +"/"+FormatFloat("##,##0", m_pGDC->RecordCount) + ")";
  165. }
  166. //---------------------------------------------------------------------------
  167. void __fastcall TFRAMECctvList::BtnExlSaveClick(TObject *Sender)
  168. {
  169. TcxGrid *pGrid = CxList;
  170. TcxGridTableView *pView = TvList;
  171. String sTitle= FTitle;//"CctvÁ¤º¸";
  172. CMM_ExportToExcelFile(sTitle, pGrid, pView, (TForm*)this);
  173. }
  174. //---------------------------------------------------------------------------
  175. void __fastcall TFRAMECctvList::OnCloseQuery(bool &CanClose)
  176. {
  177. }
  178. //---------------------------------------------------------------------------
  179. void __fastcall TFRAMECctvList::TvListCustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo,
  180. bool &ADone)
  181. {
  182. if (AViewInfo && Column14->Visible)
  183. {
  184. String sDispImg = AViewInfo->GridRecord->DisplayTexts[Column14->Index];
  185. if (sDispImg == "Y")
  186. {
  187. ACanvas->Brush->Color = clYellow;
  188. }
  189. }
  190. }
  191. //---------------------------------------------------------------------------