| |
9 |
9 |
|
| |
10 |
10 |
|
| |
11 |
11 |
|
| |
12 |
12 |
|
| |
13 |
13 |
|
| |
14 |
14 |
|
| |
15 |
15 |
|
| |
16 |
16 |
|
| |
17 |
17 |
|
| |
18 |
18 |
|
| |
19 |
19 |
#include "stdafx.h" |
| |
20 |
20 |
#include "ch.h" |
| |
21 |
21 |
#include "resource.h" |
| |
22 |
22 |
#include "StatusDlg.h" |
| |
23 |
23 |
#include "BufferSizeDlg.h" |
| |
24 |
24 |
#include "StringHelpers.h" |
| |
25 |
25 |
#include "StaticEx.h" |
| |
26 |
26 |
#include "Structs.h" |
| |
27 |
27 |
#include "CfgProperties.h" |
| |
28 |
28 |
#include "../libchengine/TTaskManager.h" |
| |
|
29 |
#include "../libchengine/TLocalFilesystem.h" |
| |
29 |
30 |
|
| |
30 |
31 |
#ifdef _DEBUG |
| |
31 |
32 |
#define new DEBUG_NEW |
| |
32 |
33 |
#undef THIS_FILE |
| |
33 |
34 |
static char THIS_FILE[] = __FILE__; |
| |
34 |
35 |
#endif |
| |
35 |
36 |
|
| |
36 |
37 |
bool CStatusDlg::m_bLock=false; |
| |
37 |
38 |
|
| |
38 |
39 |
|
| |
39 |
40 |
|
| |
40 |
41 |
|
| |
41 |
42 |
CStatusDlg::CStatusDlg(chengine::TTaskManager* pTasks, CWnd* pParent ) |
| |
42 |
43 |
: ictranslate::CLanguageDialog(IDD_STATUS_DIALOG, pParent, &m_bLock), |
| |
43 |
44 |
m_pTasks(pTasks), |
| |
44 |
45 |
m_spTaskMgrStats(new chengine::TTaskManagerStatsSnapshot) |
| |
45 |
46 |
{ |
| |
46 |
47 |
RegisterStaticExControl(AfxGetInstanceHandle()); |
| |
47 |
48 |
} |
| |
48 |
49 |
|
|
| |
716 |
717 |
|
| |
717 |
718 |
void CStatusDlg::OnSelectionChanged(NMHDR* , LRESULT* ) |
| |
718 |
719 |
{ |
| |
719 |
720 |
TRACE("Received LVN_CHANGEDSELECTION\n"); |
| |
720 |
721 |
RefreshStatus(); |
| |
721 |
722 |
} |
| |
722 |
723 |
|
| |
723 |
724 |
void CStatusDlg::OnCancel() |
| |
724 |
725 |
{ |
| |
725 |
726 |
PostCloseMessage(); |
| |
726 |
727 |
CLanguageDialog::OnCancel(); |
| |
727 |
728 |
} |
| |
728 |
729 |
|
| |
729 |
730 |
void CStatusDlg::OnShowLogButton() |
| |
730 |
731 |
{ |
| |
731 |
732 |
|
| |
732 |
733 |
chengine::TTaskPtr spTask = GetSelectedItemPointer(); |
| |
733 |
734 |
if(!spTask) |
| |
734 |
735 |
return; |
| |
735 |
736 |
|
| |
736 |
|
ULONG_PTR hResult = (ULONG_PTR)ShellExecute(this->m_hWnd, _T("open"), _T("notepad.exe"), spTask->GetLogPath().ToString(), nullptr, SW_SHOWNORMAL); |
| |
|
737 |
chcore::TSmartPath logPath = spTask->GetLogPath(); |
| |
|
738 |
chengine::TLocalFilesystem localFilesystem(GetLogFileData()); |
| |
|
739 |
if(!localFilesystem.PathExist(logPath)) |
| |
|
740 |
{ |
| |
|
741 |
MsgBox(IDS_LOGFILEEMPTY_STRING, MB_OK | MB_ICONINFORMATION); |
| |
|
742 |
return; |
| |
|
743 |
} |
| |
|
744 |
|
| |
|
745 |
ULONG_PTR hResult = (ULONG_PTR)ShellExecute(this->m_hWnd, _T("open"), _T("notepad.exe"), logPath.ToString(), nullptr, SW_SHOWNORMAL); |
| |
737 |
746 |
if(hResult < 32) |
| |
738 |
747 |
{ |
| |
739 |
748 |
ictranslate::CFormat fmt(GetResManager().LoadString(IDS_SHELLEXECUTEERROR_STRING)); |
| |
740 |
749 |
fmt.SetParam(_T("%errno"), hResult); |
| |
741 |
750 |
fmt.SetParam(_T("%path"), spTask->GetLogPath().ToString()); |
| |
742 |
751 |
AfxMessageBox(fmt.ToString()); |
| |
743 |
752 |
} |
| |
744 |
753 |
} |
| |
745 |
754 |
|
| |
746 |
755 |
LRESULT CStatusDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) |
| |
747 |
756 |
{ |
| |
748 |
757 |
if (message == WM_UPDATESTATUS) |
| |
749 |
758 |
{ |
| |
750 |
759 |
TRACE("Received WM_UPDATESTATUS\n"); |
| |
751 |
760 |
RefreshStatus(); |
| |
752 |
761 |
} |
| |
753 |
762 |
return ictranslate::CLanguageDialog::WindowProc(message, wParam, lParam); |
| |
754 |
763 |
} |
| |
755 |
764 |
|
| |
756 |
765 |
void CStatusDlg::OnStickButton() |