diff options
author | sansnom05 <sansnom05@users.sourceforge.net> | 2010-12-16 16:53:08 +0300 |
---|---|---|
committer | sansnom05 <sansnom05@users.sourceforge.net> | 2010-12-16 16:53:08 +0300 |
commit | f0d88a6ff96770b10031dcc59447cca2c7dbc91c (patch) | |
tree | e188e4e733fcf6fc9b00dc349618c19f4d47a7c9 /src/apps/mplayerc/PPageSubMisc.cpp | |
parent | 5067b0b48d4d15b24669c8032b28e90e45202801 (diff) |
legacy branch: merge r2662-r2759
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/branches/legacy@2778 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/apps/mplayerc/PPageSubMisc.cpp')
-rw-r--r-- | src/apps/mplayerc/PPageSubMisc.cpp | 61 |
1 files changed, 58 insertions, 3 deletions
diff --git a/src/apps/mplayerc/PPageSubMisc.cpp b/src/apps/mplayerc/PPageSubMisc.cpp index 39fd42635..329c0afa4 100644 --- a/src/apps/mplayerc/PPageSubMisc.cpp +++ b/src/apps/mplayerc/PPageSubMisc.cpp @@ -23,7 +23,7 @@ #include "stdafx.h"
#include "mplayerc.h"
#include "PPageSubMisc.h"
-
+#include "ISDb.h"
// CPPageSubMisc dialog
@@ -34,6 +34,7 @@ CPPageSubMisc::CPPageSubMisc() , m_fPrioritizeExternalSubtitles(FALSE)
, m_fDisableInternalSubtitles(FALSE)
, m_szAutoloadPaths("")
+ , m_ISDb(_T(""))
{
}
@@ -48,6 +49,8 @@ void CPPageSubMisc::DoDataExchange(CDataExchange* pDX) DDX_Check(pDX, IDC_CHECK1, m_fPrioritizeExternalSubtitles);
DDX_Check(pDX, IDC_CHECK2, m_fDisableInternalSubtitles);
DDX_Text(pDX, IDC_EDIT1, m_szAutoloadPaths);
+ DDX_Control(pDX, IDC_COMBO1, m_ISDbCombo);
+ DDX_CBString(pDX, IDC_COMBO1, m_ISDb);
}
BOOL CPPageSubMisc::OnInitDialog()
@@ -58,7 +61,12 @@ BOOL CPPageSubMisc::OnInitDialog() m_fPrioritizeExternalSubtitles = s.fPrioritizeExternalSubtitles;
m_fDisableInternalSubtitles = s.fDisableInternalSubtitles;
- m_szAutoloadPaths = s.szSubtitlePaths;
+ m_szAutoloadPaths = s.strSubtitlePaths;
+
+ m_ISDb = s.strISDb;
+ m_ISDbCombo.AddString(m_ISDb);
+ if(m_ISDb.CompareNoCase(_T("www.opensubtitles.org/isdb")))
+ m_ISDbCombo.AddString(_T("www.opensubtitles.org/isdb"));
UpdateData(FALSE);
@@ -73,11 +81,58 @@ BOOL CPPageSubMisc::OnApply() s.fPrioritizeExternalSubtitles = m_fPrioritizeExternalSubtitles;
s.fDisableInternalSubtitles = m_fDisableInternalSubtitles;
- s.szSubtitlePaths = m_szAutoloadPaths;
+ s.strSubtitlePaths = m_szAutoloadPaths;
+
+ s.strISDb = m_ISDb;
+ s.strISDb.TrimRight('/');
return __super::OnApply();
}
BEGIN_MESSAGE_MAP(CPPageSubMisc, CPPageBase)
+ ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
+ ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton2)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON2, OnUpdateButton2)
END_MESSAGE_MAP()
+
+void CPPageSubMisc::OnBnClickedButton1()
+{
+ UpdateData();
+
+ AppSettings& s = AfxGetAppSettings();
+ m_szAutoloadPaths = s.strSubtitlePaths;
+
+ UpdateData(FALSE);
+}
+
+void CPPageSubMisc::OnBnClickedButton2()
+{
+ CString ISDb, ver, msg, str;
+
+ m_ISDbCombo.GetWindowText(ISDb);
+ ISDb.TrimRight('/');
+
+ ver.Format(_T("ISDb v%d"), ISDb_PROTOCOL_VERSION);
+
+ CWebTextFile wtf;
+ if(wtf.Open(_T("http://") + ISDb + _T("/test.php")) && wtf.ReadString(str) && str == ver)
+ {
+ msg = ResStr(IDS_PPSDB_URLCORRECT);
+ }
+ else if(str.Find(_T("ISDb v")) == 0)
+ {
+ msg = ResStr(IDS_PPSDB_PROTOCOLERR);
+ }
+ else
+ {
+ msg = ResStr(IDS_PPSDB_BADURL);
+ }
+
+ AfxMessageBox(msg, MB_OK);
+}
+
+void CPPageSubMisc::OnUpdateButton2(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_ISDbCombo.GetWindowTextLength() > 0);
+}
|