Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
3.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #if !defined(AFX_JOBWATCHDLG_H__761BDEEF_D549_4F10_817C_1C1FAF9FCA47__INCLUDED_)
  9. #define AFX_JOBWATCHDLG_H__761BDEEF_D549_4F10_817C_1C1FAF9FCA47__INCLUDED_
  10. #if _MSC_VER > 1000
  11. #pragma once
  12. #endif // _MSC_VER > 1000
  13. // JobWatchDlg.h : header file
  14. //
  15. #include "idle_dialog.h"
  16. #include "resource.h"
  17. #include "utlvector.h"
  18. #include "imysqlwrapper.h"
  19. #include "GraphControl.h"
  20. #include "window_anchor_mgr.h"
  21. #include "mysql_async.h"
  22. class CWorkerInfo
  23. {
  24. public:
  25. CWorkerInfo()
  26. {
  27. m_bConnected = false;
  28. m_nWorkUnitsDone = 0;
  29. m_JobWorkerID = 0xFFFFFFFF;
  30. m_RunningTimeMS = 0;
  31. m_ThreadWUs[0] = m_ThreadWUs[1] = m_ThreadWUs[2] = m_ThreadWUs[3] = -1;
  32. }
  33. CString m_ComputerName;
  34. int m_bConnected;
  35. int m_nWorkUnitsDone;
  36. unsigned long m_JobWorkerID;
  37. unsigned long m_RunningTimeMS;
  38. CString m_CurrentStage;
  39. int m_ThreadWUs[4];
  40. };
  41. /////////////////////////////////////////////////////////////////////////////
  42. // CJobWatchDlg dialog
  43. class CJobWatchDlg : public CIdleDialog
  44. {
  45. // Construction
  46. public:
  47. CJobWatchDlg( CWnd* pParent = NULL); // standard constructor
  48. virtual ~CJobWatchDlg();
  49. // Dialog Data
  50. //{{AFX_DATA(CJobWatchDlg)
  51. enum { IDD = IDD_JOB_WATCH };
  52. CListCtrl m_Workers;
  53. CEdit m_TextOutput;
  54. //}}AFX_DATA
  55. // Overrides
  56. // ClassWizard generated virtual function overrides
  57. //{{AFX_VIRTUAL(CJobWatchDlg)
  58. protected:
  59. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  60. virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  61. //}}AFX_VIRTUAL
  62. // Implementation
  63. protected:
  64. virtual void OnIdle();
  65. void RefreshWorkerStats();
  66. CWorkerInfo* FindWorkerByID( unsigned long jobWorkerID );
  67. CWorkerInfo* FindWorkerByMachineName( const char *pMachineName );
  68. void SetWorkerListItemInt( int nIndex, int iColumn, int value );
  69. void UpdateWorkersList();
  70. void ResortItems();
  71. // Query IDs.
  72. enum
  73. {
  74. QUERY_TEXT=0,
  75. QUERY_GRAPH,
  76. QUERY_WORKER_STATS,
  77. NUM_QUERIES
  78. };
  79. void ProcessQueryResults_Graph( IMySQLRowSet *pSet );
  80. void ProcessQueryResults_Text( IMySQLRowSet *pSet );
  81. void ProcessQueryResults_WorkerStats( IMySQLRowSet *pSet );
  82. bool m_bQueriesInProgress[NUM_QUERIES];
  83. // This is our connection to the mysql database.
  84. IMySQLAsync *m_pSQL;
  85. CSysModule *m_hMySQLDLL;
  86. CWindowAnchorMgr m_AnchorMgr;
  87. bool GetCurJobWorkerID( unsigned long &id );
  88. CGraphControl m_GraphControl;
  89. unsigned long m_JobID;
  90. int m_CurGraphTime;
  91. int m_CurMessageIndex;
  92. int m_CurWorkerTextToken; // used to let it ignore old text in the thread's queue
  93. DWORD m_LastQueryTime; // Last time we made a query.
  94. // Generated message map functions
  95. //{{AFX_MSG(CJobWatchDlg)
  96. virtual BOOL OnInitDialog();
  97. afx_msg void OnSelChangeWorkers();
  98. afx_msg void OnSize(UINT nType, int cx, int cy);
  99. afx_msg void OnOdstatechangedWorkers(NMHDR* pNMHDR, LRESULT* pResult);
  100. afx_msg void OnItemchangedWorkers(NMHDR* pNMHDR, LRESULT* pResult);
  101. //}}AFX_MSG
  102. DECLARE_MESSAGE_MAP()
  103. };
  104. //{{AFX_INSERT_LOCATION}}
  105. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  106. #endif // !defined(AFX_JOBWATCHDLG_H__761BDEEF_D549_4F10_817C_1C1FAF9FCA47__INCLUDED_)