Clone
ixen <ixen@copyhandler.com>
committed
on 04 Nov 16
Added explorer taskbar progress bar for status window (CH-289).
ParallelizeReaderWriter + 3 more
src/ch/StatusDlg.cpp (+16 -0)
695 695         m_ctlProgressAll.SetPos(boost::numeric_cast<int>(m_spTaskMgrStats->GetCombinedProgress() * 100.0));
696 696         
697 697         // progress - count of processed data/count of data
698 698         CString strTemp;
699 699         strTemp = GetSizeString(m_spTaskMgrStats->GetProcessedSize()) + CString(_T("/"));
700 700         strTemp += GetSizeString(m_spTaskMgrStats->GetTotalSize());
701 701         GetDlgItem(IDC_GLOBALPROCESSED_STATIC)->SetWindowText(strTemp);
702 702         
703 703         // transfer
704 704         CString strSpeed = GetSpeedString(m_spTaskMgrStats->GetSizeSpeed(), m_spTaskMgrStats->GetAvgSizeSpeed(), m_spTaskMgrStats->GetCountSpeed(), m_spTaskMgrStats->GetAvgCountSpeed());
705 705         GetDlgItem(IDC_GLOBALTRANSFER_STATIC)->SetWindowText(strSpeed);
706 706
707 707         // if selection's missing - hide controls
708 708         if (m_ctlStatusList.GetSelectedCount() == 0)
709 709                 EnableControls(false);
710 710         else
711 711                 EnableControls();               // enable controls
712 712         
713 713         // apply state of the resume, cancel, ... buttons
714 714         ApplyButtonsState();
  715
  716         // update taskbar progress
  717         UpdateTaskBarProgress();
715 718 }
716 719
717 720 void CStatusDlg::OnSelectionChanged(NMHDR* /*pNMHDR*/, LRESULT* /*pResult*/)
718 721 {
719 722         TRACE("Received LVN_CHANGEDSELECTION\n");
720 723         RefreshStatus();
721 724 }
722 725
723 726 void CStatusDlg::OnCancel()
724 727 {
725 728         PostCloseMessage();
726 729         CLanguageDialog::OnCancel();
727 730 }
728 731
729 732 void CStatusDlg::OnShowLogButton()
730 733 {
731 734         // show log
732 735         chcore::TTaskPtr spTask = GetSelectedItemPointer();
733 736         if(!spTask)
734 737                 return;
 
1230 1233
1231 1234 void CStatusDlg::SetWindowTitle(PCTSTR pszText)
1232 1235 {
1233 1236         CString strCurrentTitle;
1234 1237         GetWindowText(strCurrentTitle);
1235 1238         if(strCurrentTitle != CString(pszText))
1236 1239                 SetWindowText(pszText);
1237 1240 }
1238 1241
1239 1242 CString CStatusDlg::GetProgressWindowTitleText() const
1240 1243 {
1241 1244         CString strTitleText;
1242 1245
1243 1246         if(m_spTaskMgrStats->GetTaskStatsCount() != 0)
1244 1247                 strTitleText.Format(_T("%s [%.1f %%]"), GetResManager().LoadString(IDS_STATUSTITLE_STRING), m_spTaskMgrStats->GetCombinedProgress() * 100.0);
1245 1248         else
1246 1249                 strTitleText = GetResManager().LoadString(IDS_STATUSTITLE_STRING);
1247 1250
1248 1251         return strTitleText;
1249 1252 }
  1253
  1254 void CStatusDlg::UpdateTaskBarProgress() const
  1255 {
  1256         if(m_spTaskMgrStats->GetRunningTasks() != 0)
  1257         {
  1258                 unsigned long long ullProgress = (unsigned long long)(m_spTaskMgrStats->GetCombinedProgress() * 100.0);
  1259
  1260                 m_taskBarProgress.SetState(m_hWnd, TBPF_NORMAL);
  1261                 m_taskBarProgress.SetPosition(m_hWnd, ullProgress, 100);
  1262         }
  1263         else
  1264                 m_taskBarProgress.SetState(m_hWnd, TBPF_NOPROGRESS);
  1265 }