Clone
ixen <ixen@copyhandler.com>
committed
on 20 Jun 13
Updated subtask, task, and task mgr stats calculation (CH-57).
LoggerImprovements + 5 more
src/ch/MainWnd.cpp (+4 -4)
59 59 #define TM_AUTOREMOVE                   1000
60 60 #define TM_ACCEPTING                    100
61 61
62 62 extern int iCount;
63 63 extern unsigned short msg[];
64 64
65 65 extern int iOffCount;
66 66 extern unsigned char off[];
67 67 extern unsigned short _hash[];
68 68
69 69
70 70 /////////////////////////////////////////////////////////////////////////////
71 71 // CMainWnd
72 72 /////////////////////////////////////////////////////////////////////////////
73 73 // CMainWnd construction/destruction
74 74 CMainWnd::CMainWnd() :
75 75         m_pFeedbackFactory(CFeedbackHandlerFactory::CreateFactory()),
76 76         m_pdlgStatus(NULL),
77 77         m_pdlgMiniView(NULL),
78 78         m_dwLastTime(0),
79           m_tasks()
  79         m_tasks(),
  80         m_spTaskMgrStats(new chcore::TTaskManagerStatsSnapshot)
80 81 {
81 82 }
82 83
83 84 CMainWnd::~CMainWnd()
84 85 {
85 86         if(m_pFeedbackFactory)
86 87                 m_pFeedbackFactory->Delete();
87 88 }
88 89
89 90 // registers main window class
90 91 BOOL CMainWnd::RegisterClass()
91 92 {
92 93         WNDCLASS wc;
93 94
94 95         wc.style                        = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
95 96         wc.lpfnWndProc          = (WNDPROC)::DefWindowProc;
96 97         wc.cbClsExtra           = 0;
97 98         wc.cbWndExtra           = 0;
98 99         wc.hInstance            = AfxGetInstanceHandle();
99 100         wc.hIcon                        = ::LoadIcon(NULL, MAKEINTRESOURCE(AFX_IDI_STD_FRAME));
 
345 346                         // get current cursor pos
346 347                         POINT pt;
347 348                         GetCursorPos(&pt);
348 349
349 350                         pSubMenu->CheckMenuItem(ID_POPUP_MONITORING, MF_BYCOMMAND | (GetPropValue<PP_PCLIPBOARDMONITORING>(GetConfig()) ? MF_CHECKED : MF_UNCHECKED));
350 351                         pSubMenu->CheckMenuItem(ID_POPUP_SHUTAFTERFINISHED, MF_BYCOMMAND | (GetPropValue<PP_PSHUTDOWNAFTREFINISHED>(GetConfig()) ? MF_CHECKED : MF_UNCHECKED));
351 352
352 353                         // track the menu
353 354                         pSubMenu->TrackPopupMenu(TPM_LEFTBUTTON, pt.x, pt.y, this);
354 355
355 356                         // destroy
356 357                         pSubMenu->DestroyMenu();
357 358                         mMenu.DestroyMenu();
358 359                         
359 360                         break;
360 361                 }
361 362         case WM_MOUSEMOVE:
362 363                 {
363 364                         if (m_tasks.GetSize() != 0)
364 365                         {
365                                   chcore::TTaskManagerStatsSnapshot tTMStats;
366                                   m_tasks.GetStatsSnapshot(tTMStats);
  366                                 m_tasks.GetStatsSnapshot(m_spTaskMgrStats);
367 367
368                                   _sntprintf(text, _MAX_PATH, _T("%s - %d %%"), GetApp().GetAppName(), tTMStats.GetGlobalProgressInPercent());
  368                                 _sntprintf(text, _MAX_PATH, _T("%s - %.0f %%"), GetApp().GetAppName(), m_spTaskMgrStats->GetCombinedProgress() * 100.0);
369 369                                 m_ctlTray.SetTooltipText(text);
370 370                         }
371 371                         else
372 372                         {
373 373                                 CString strText = GetApp().GetAppNameVer();
374 374                                 if(GetApp().IsInPortableMode())
375 375                                         strText += GetResManager().LoadString(IDS_CH_PORTABLE_STRING);
376 376                                 m_ctlTray.SetTooltipText(strText);
377 377                         }
378 378                         break;
379 379                 }
380 380         }
381 381         
382 382         return (LRESULT)TRUE;
383 383 }
384 384
385 385 /////////////////////////////////////////////////////////////////////////////
386 386 // CMainWnd/CTrayIcon menu message handlers
387 387
388 388 void CMainWnd::ShowStatusWindow(const chcore::TTaskPtr& spSelect)