00001
00002
00003
00004
00005
00006 #include "stdafx.h"
00007 #include "FdmApp.h"
00008 #include "Dlg_CreateFVDownload.h"
00009 #include "vmsVideoSiteHtmlCodeParser.h"
00010 #include "mfchelp.h"
00011
00012 #ifdef _DEBUG
00013 #define new DEBUG_NEW
00014 #undef THIS_FILE
00015 static char THIS_FILE[] = __FILE__;
00016 #endif
00017
00018 CDlg_CreateFVDownload::CDlg_CreateFVDownload(CWnd* pParent )
00019 : CDialog(CDlg_CreateFVDownload::IDD, pParent)
00020 {
00021
00022
00023
00024 }
00025
00026 void CDlg_CreateFVDownload::DoDataExchange(CDataExchange* pDX)
00027 {
00028 CDialog::DoDataExchange(pDX);
00029
00030 DDX_Control(pDX, IDC_S_SITES, m_wndSSites);
00031
00032 }
00033
00034 BEGIN_MESSAGE_MAP(CDlg_CreateFVDownload, CDialog)
00035
00036 ON_BN_CLICKED(IDC_VIEW_S_SITES, OnViewSSites)
00037 ON_BN_CLICKED(IDC_USE_AUTO_CONVERT, OnUseAutoConvert)
00038 ON_BN_CLICKED(IDC_SETTINGS2, OnSettings)
00039
00040 END_MESSAGE_MAP()
00041
00042 BOOL CDlg_CreateFVDownload::OnInitDialog()
00043 {
00044 CDialog::OnInitDialog();
00045
00046 CRect rc;
00047 GetDlgItem (IDC__S0)->GetWindowRect (&rc);
00048 ScreenToClient (&rc);
00049
00050 CRect rc2;
00051 GetClientRect (&rc2);
00052
00053 GetWindowRect (&m_rcOldSize);
00054
00055 SetWindowPos (NULL, 0, 0, m_rcOldSize.Width (), m_rcOldSize.Height () - (rc2.bottom - rc.top),
00056 SWP_NOZORDER | SWP_NOMOVE);
00057
00058 LPCSTR apszSites [] = {
00059 "Youtube", "http://youtube.com/watch?v=xPxDw7ajfGE",
00060 "Google Video", "http://video.google.com/url?docid=1688669...",
00061 "ÓÅ¿á", "http://player.youku.com/player.php/sid/XMjg0OTI5OTY=/v.swf",
00062 "LiveDigital", "http://livedigital.com/video/",
00063 "MySpace Videos", "http://vids.myspace.com/index.cfm?fuseaction=...",
00064 "Blennus", "http://blennus.com/index.php?option=content&task=...",
00065 "Dailymotion", "http://www.dailymotion.com/us/cluster/animals/...",
00066 };
00067
00068 CString str;
00069 for (int i = 0; i < sizeof (apszSites) / sizeof (LPCSTR) / 2; i++)
00070 {
00071 str.Format ("%s, %s %s", apszSites [i*2], LS (L_E_G), apszSites [i*2+1]);
00072 m_wndSSites.AddString (str);
00073 }
00074 m_wndSSites.SetCurSel (0);
00075 m_wndSSites.ShowWindow (SW_HIDE);
00076
00077 CComboBox *pUrls = (CComboBox*) GetDlgItem (IDC_URL);
00078 for (i = 0; i < _LastFlashVideoUrls.GetRecordCount (); i++)
00079 pUrls->AddString (_LastFlashVideoUrls.GetRecord (i));
00080
00081 if (m_strUrl.IsEmpty ())
00082 {
00083 LPCSTR pszUrl = _ClipbrdMgr.Text ();
00084 if (pszUrl && *pszUrl)
00085 {
00086 fsURL url;
00087 if (url.Crack (pszUrl) == IR_SUCCESS &&
00088 vmsVideoSiteHtmlCodeParser::IsSiteSupported (url.GetHostName ()))
00089 SetDlgItemText (IDC_URL, pszUrl);
00090 }
00091 }
00092 else
00093 {
00094 SetDlgItemText (IDC_URL, m_strUrl);
00095 }
00096
00097 if (_App.View_CreateFVDownload_SetupAdvStgs ())
00098 CheckDlgButton (IDC_ADVANCED, BST_CHECKED);
00099
00100 if (_App.FVDownloads_AutoConvertVideo () && _AppMgr.IsMediaFeaturesInstalled ())
00101 {
00102 CheckDlgButton (IDC_USE_AUTO_CONVERT, BST_CHECKED);
00103 UpdateEnabled ();
00104 }
00105
00106 vmsMediaConvertMgr::GetDefaultSettings (m_stgsAutoConvert);
00107
00108 ApplyLanguage ();
00109
00110 mfcSetForegroundWindow (this);
00111
00112 return TRUE;
00113 }
00114
00115 void CDlg_CreateFVDownload::OnViewSSites()
00116 {
00117 m_wndSSites.ShowWindow (SW_SHOW);
00118
00119 SetWindowPos (NULL, 0, 0, m_rcOldSize.Width (), m_rcOldSize.Height (),
00120 SWP_NOZORDER | SWP_NOMOVE);
00121
00122 GetDlgItem (IDC_VIEW_S_SITES)->ShowWindow (SW_HIDE);
00123 }
00124
00125 void CDlg_CreateFVDownload::OnOK()
00126 {
00127 GetDlgItemText (IDC_URL, m_strUrl);
00128
00129 fsURL url;
00130 if (url.Crack (m_strUrl) != IR_SUCCESS ||
00131 FALSE == vmsVideoSiteHtmlCodeParser::IsSiteSupported (url.GetHostName ()))
00132 {
00133 MessageBox (LS (L_FVDLD_SITEISNOTSUPP), LS (L_INPERR), MB_ICONERROR);
00134 return;
00135 }
00136
00137 _LastFlashVideoUrls.AddRecord (m_strUrl);
00138 m_bSetupAdvStgs = IsDlgButtonChecked (IDC_ADVANCED) == BST_CHECKED;
00139 _App.View_CreateFVDownload_SetupAdvStgs (m_bSetupAdvStgs);
00140
00141 m_bAutoConvert = IsDlgButtonChecked (IDC_USE_AUTO_CONVERT) == BST_CHECKED;
00142
00143 CDialog::OnOK();
00144 }
00145
00146 void CDlg_CreateFVDownload::ApplyLanguage()
00147 {
00148 fsDlgLngInfo lnginfo [] = {
00149 fsDlgLngInfo (IDC_ADVANCED, L_SETUPADVOPTIONS),
00150 fsDlgLngInfo (IDC_VIEW_S_SITES, L_VIEW_LIST_OF_SUPP_SITES),
00151 fsDlgLngInfo (IDC_USE_AUTO_CONVERT, L_USE_AUTO_CONVERT),
00152 fsDlgLngInfo (IDC_SETTINGS2, L_CUSTOMIZE),
00153 fsDlgLngInfo (IDCANCEL, L_CANCEL),
00154 };
00155
00156 _LngMgr.ApplyLanguage (this, lnginfo, sizeof (lnginfo) / sizeof (fsDlgLngInfo), L_CREATEFVDLD);
00157 }
00158
00159 void CDlg_CreateFVDownload::OnUseAutoConvert()
00160 {
00161 if (_AppMgr.IsMediaFeaturesInstalled () == FALSE)
00162 {
00163 _AppMgr.ShowInstallMediaFeaturesMessage ();
00164 CheckDlgButton (IDC_USE_AUTO_CONVERT, BST_UNCHECKED);
00165 return;
00166 }
00167
00168 _App.FVDownloads_AutoConvertVideo (
00169 IsDlgButtonChecked (IDC_USE_AUTO_CONVERT) == BST_CHECKED);
00170 UpdateEnabled ();
00171 }
00172
00173 void CDlg_CreateFVDownload::UpdateEnabled()
00174 {
00175 GetDlgItem (IDC_SETTINGS2)->EnableWindow (
00176 IsDlgButtonChecked (IDC_USE_AUTO_CONVERT) == BST_CHECKED);
00177 }
00178
00179 void CDlg_CreateFVDownload::OnSettings()
00180 {
00181 vmsMediaConvertMgr::ShowSettingsUI (m_stgsAutoConvert);
00182 }