PPageFileInfoClip.cpp

00001 /* 
00002  *      Copyright (C) 2003-2005 Gabest
00003  *      http://www.gabest.org
00004  *
00005  *  This Program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2, or (at your option)
00008  *  any later version.
00009  *   
00010  *  This Program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013  *  GNU General Public License for more details.
00014  *   
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with GNU Make; see the file COPYING.  If not, write to
00017  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
00018  *  http://www.gnu.org/copyleft/gpl.html
00019  *
00020  */
00021 
00022 // PPageFileInfoClip.cpp : implementation file
00023 //
00024 
00025 #include "stdafx.h"
00026 #include "mplayerc.h"
00027 #include "PPageFileInfoClip.h"
00028 #include <atlbase.h>
00029 #include <qnetwork.h>
00030 #include "..\..\DSUtil\DSUtil.h"
00031 
00032 // CPPageFileInfoClip dialog
00033 
00034 IMPLEMENT_DYNAMIC(CPPageFileInfoClip, CPropertyPage)
00035 CPPageFileInfoClip::CPPageFileInfoClip(CString fn, IFilterGraph* pFG)
00036         : CPropertyPage(CPPageFileInfoClip::IDD, CPPageFileInfoClip::IDD)
00037         , m_fn(fn)
00038         , m_pFG(pFG)
00039         , m_clip(_T("None"))
00040         , m_author(_T("None"))
00041         , m_copyright(_T("None"))
00042         , m_rating(_T("None"))
00043         , m_location(_T("None"))
00044         , m_hIcon(NULL)
00045 {
00046 }
00047 
00048 CPPageFileInfoClip::~CPPageFileInfoClip()
00049 {
00050         if(m_hIcon) DestroyIcon(m_hIcon);
00051 }
00052 
00053 void CPPageFileInfoClip::DoDataExchange(CDataExchange* pDX)
00054 {
00055         __super::DoDataExchange(pDX);
00056         DDX_Control(pDX, IDC_DEFAULTICON, m_icon);
00057         DDX_Text(pDX, IDC_EDIT1, m_fn);
00058         DDX_Text(pDX, IDC_EDIT4, m_clip);
00059         DDX_Text(pDX, IDC_EDIT3, m_author);
00060         DDX_Text(pDX, IDC_EDIT2, m_copyright);
00061         DDX_Text(pDX, IDC_EDIT5, m_rating);
00062         DDX_Text(pDX, IDC_EDIT6, m_location);
00063         DDX_Control(pDX, IDC_EDIT7, m_desc);
00064 }
00065 
00066 BEGIN_MESSAGE_MAP(CPPageFileInfoClip, CPropertyPage)
00067 END_MESSAGE_MAP()
00068 
00069 
00070 // CPPageFileInfoClip message handlers
00071 
00072 BOOL CPPageFileInfoClip::OnInitDialog()
00073 {
00074         __super::OnInitDialog();
00075 
00076         if(m_hIcon = LoadIcon(m_fn, false))
00077                 m_icon.SetIcon(m_hIcon);
00078 
00079         m_fn.TrimRight('/');
00080         int i = max(m_fn.ReverseFind('\\'), m_fn.ReverseFind('/'));
00081         if(i >= 0 && i < m_fn.GetLength()-1)
00082         {
00083                 m_location = m_fn.Left(i);
00084                 m_fn = m_fn.Mid(i+1);
00085 
00086                 if(m_location.GetLength() == 2 && m_location[1] == ':')
00087                         m_location += '\\';
00088         }
00089 
00090         bool fEmpty = true;
00091         BeginEnumFilters(m_pFG, pEF, pBF)
00092         {
00093                 if(CComQIPtr<IAMMediaContent, &IID_IAMMediaContent> pAMMC = pBF)
00094                 {
00095                         CComBSTR bstr;
00096                         if(SUCCEEDED(pAMMC->get_Title(&bstr)) && wcslen(bstr.m_str) > 0) {m_clip = bstr.m_str; fEmpty = false;}
00097                         if(SUCCEEDED(pAMMC->get_AuthorName(&bstr)) && wcslen(bstr.m_str) > 0) {m_author = bstr.m_str; fEmpty = false;}
00098                         if(SUCCEEDED(pAMMC->get_Copyright(&bstr)) && wcslen(bstr.m_str) > 0) {m_copyright = bstr.m_str; fEmpty = false;}
00099                         if(SUCCEEDED(pAMMC->get_Rating(&bstr)) && wcslen(bstr.m_str) > 0) {m_rating = bstr.m_str; fEmpty = false;}
00100                         if(SUCCEEDED(pAMMC->get_Description(&bstr)) && wcslen(bstr.m_str) > 0) {m_desc.SetWindowText(CString(bstr.m_str)); fEmpty = false;}
00101                         if(!fEmpty) break;
00102                 }
00103         }
00104         EndEnumFilters
00105 
00106         UpdateData(FALSE);
00107 
00108         return TRUE;  // return TRUE unless you set the focus to a control
00109         // EXCEPTION: OCX Property Pages should return FALSE
00110 }

Generated on Tue Dec 13 14:47:00 2005 for guliverkli by  doxygen 1.4.5