⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 playbacklistdlg.cpp

📁 一个完整的数字硬盘录像机系统软件
💻 CPP
字号:
// PlaybackListDlg.cpp : implementation file
//

#include "stdafx.h"
#include "gtmpeg.h"
#include "PlaybackListDlg.h"
#include "GtMpegWnd.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
CPlaybackListDlg::CPlaybackListDlg(CGtMpegWnd* pParent /*=NULL*/)
	: CDialog(CPlaybackListDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CPlaybackListDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	m_pParentWnd=pParent;
	ASSERT(m_pParentWnd!=NULL);
	for(int i=0;i<theApp.m_nChannels;i++)
	    m_pParentWnd->m_nChoiceChannel[i]=0;
	m_pParentWnd->m_arFileName.SetSize(theApp.m_nChannels);
}
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
void CPlaybackListDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPlaybackListDlg)
	DDX_Control(pDX, IDC_PLAYBACK_LIST, m_cPlaybackList);
	//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
BEGIN_MESSAGE_MAP(CPlaybackListDlg, CDialog)
	//{{AFX_MSG_MAP(CPlaybackListDlg)
	ON_LBN_DBLCLK(IDC_PLAYBACK_LIST, OnDblclkPlaybackList)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
BOOL CPlaybackListDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	CFileFind PlaybackFile;
	CString sFind="*.mpg";
	CString sTmp=GetAppPath()+"mpeg\\";
	sFind=sTmp+sFind;
	BOOL bFind=PlaybackFile.FindFile(sFind);
	while(bFind)
	{
		   bFind=PlaybackFile.FindNextFile();
		   sTmp=PlaybackFile.GetFileTitle();
		   CString sChannel,sStartDate,sEndDate;
           sChannel=sTmp.Left(2);
           sStartDate=sTmp.Mid(3,4);
           sStartDate+="/";
           sStartDate+=sTmp.Mid(7,2);
           sStartDate+="/";
           sStartDate+=sTmp.Mid(9,2);
           sStartDate+="/";
           sStartDate+=sTmp.Mid(11,2);
           sStartDate+=":";
           sStartDate+=sTmp.Mid(13,2);
           sStartDate+=".";
           sStartDate+=sTmp.Mid(15,2);
		   m_cPlaybackList.AddString(sChannel+"    \t"+sStartDate);
	}
	return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
void CPlaybackListDlg::OnOK() 
{
	int SelCount=m_cPlaybackList.GetSelCount();
	int *pInt=new int[SelCount];
	int nCount=m_cPlaybackList.GetSelItems(SelCount,pInt);
	if (nCount<1||nCount>theApp.m_nChannels) 
	{
		if(nCount<1)
			MessageBox("请选择要回放的录象");
		else
            MessageBox("选择要回放的录象超过总路数");
		for(int i=0;i<theApp.m_nChannels;i++)
	    m_pParentWnd->m_nChoiceChannel[i]=0;
	    m_pParentWnd->m_arFileName.SetSize(theApp.m_nChannels);
		return;
	}
	for(int i=0;i<nCount;i++)
	{
	   CString sChannel=m_cPlaybackList.GetColText(pInt[i],0);
	   sChannel.TrimRight();
	   int nChannel=StringToInt(sChannel)-1;
	   if(m_pParentWnd->m_nChoiceChannel[StringToInt(sChannel)-1]==0)
	   {
	      m_pParentWnd->m_nChoiceChannel[StringToInt(sChannel)-1]=1;
		  CString sStartDate=m_cPlaybackList.GetColText(pInt[i],1);
		  sStartDate.TrimRight( );
          sStartDate.Replace("/","");
          sStartDate.Replace(":","");
		  sStartDate.Replace(".","");
          CString sFileName=GetAppPath();
          sFileName+="mpeg\\";
          sFileName+=sChannel+"-";
          sFileName+=sStartDate;
		  sFileName+=".mpg";
		  g_pDevice[nChannel]->m_arFileName.Add(sFileName);
	   }
	   else
	   {
	      MessageBox("不能同时选择同一路,请重新选择");
	      for(int i=0;i<theApp.m_nChannels;i++)
	         m_pParentWnd->m_nChoiceChannel[i]=0;
	      m_pParentWnd->m_arFileName.SetSize(theApp.m_nChannels);
		  return;
	   }
	}
	CDialog::OnOK();
}
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
void CPlaybackListDlg::OnDblclkPlaybackList() 
{
}
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -