Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUnderground78 <underground78@users.sourceforge.net>2014-10-29 11:02:58 +0300
committerUnderground78 <underground78@users.sourceforge.net>2014-10-31 01:06:34 +0300
commite941b1c783fecd800a05871594cc99e23d5d420f (patch)
tree86c8d2245f16f8206af89e13af204998241bb84e
parent2105de827532b5adaa157df5da0d7975ea92127a (diff)
MediaInfo tab: Enable the "Save As" button only if some info is available.
Being that the tab can be displayed before the info is available or even if none could be found, it makes sense to disable the button in those cases.
-rw-r--r--src/mpc-hc/PPageFileMediaInfo.cpp10
-rw-r--r--src/mpc-hc/PPageFileMediaInfo.h4
2 files changed, 9 insertions, 5 deletions
diff --git a/src/mpc-hc/PPageFileMediaInfo.cpp b/src/mpc-hc/PPageFileMediaInfo.cpp
index 02c26adf9..abe262aa1 100644
--- a/src/mpc-hc/PPageFileMediaInfo.cpp
+++ b/src/mpc-hc/PPageFileMediaInfo.cpp
@@ -147,7 +147,7 @@ BOOL CPPageFileMediaInfo::PreTranslateMessage(MSG* pMsg)
BEGIN_MESSAGE_MAP(CPPageFileMediaInfo, CPropertyPage)
ON_WM_SHOWWINDOW()
ON_WM_DESTROY()
- ON_MESSAGE_VOID(WM_REFRESH_TEXT, OnRefreshText)
+ ON_MESSAGE_VOID(WM_MEDIAINFO_READY, OnMediaInfoReady)
END_MESSAGE_MAP()
// CPPageFileMediaInfo message handlers
@@ -174,9 +174,10 @@ BOOL CPPageFileMediaInfo::OnInitDialog()
m_mediainfo.SetFont(&m_font);
m_mediainfo.SetWindowText(ResStr(IDS_MEDIAINFO_ANALYSIS_IN_PROGRESS));
+ GetParent()->GetDlgItem(IDC_BUTTON_MI)->EnableWindow(FALSE); // Initially disable the "Save As" button
m_threadSetText = std::thread([this]() {
m_futureMIText.wait(); // Wait for the info to be ready
- PostMessage(WM_REFRESH_TEXT); // then notify the window to set the text
+ PostMessage(WM_MEDIAINFO_READY); // then notify the window that MediaInfo analysis finished
});
return TRUE; // return TRUE unless you set the focus to a control
@@ -197,8 +198,11 @@ void CPPageFileMediaInfo::OnDestroy()
}
}
-void CPPageFileMediaInfo::OnRefreshText()
+void CPPageFileMediaInfo::OnMediaInfoReady()
{
+ if (m_futureMIText.get() != ResStr(IDS_MEDIAINFO_NO_INFO_AVAILABLE)) {
+ GetParent()->GetDlgItem(IDC_BUTTON_MI)->EnableWindow(TRUE);
+ }
m_mediainfo.SetWindowText(m_futureMIText.get());
}
diff --git a/src/mpc-hc/PPageFileMediaInfo.h b/src/mpc-hc/PPageFileMediaInfo.h
index e1a795804..b6da2e025 100644
--- a/src/mpc-hc/PPageFileMediaInfo.h
+++ b/src/mpc-hc/PPageFileMediaInfo.h
@@ -55,7 +55,7 @@ public:
protected:
enum {
- WM_REFRESH_TEXT = WM_APP + 1
+ WM_MEDIAINFO_READY = WM_APP + 1
};
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
@@ -66,7 +66,7 @@ protected:
afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
afx_msg void OnDestroy();
- afx_msg void OnRefreshText();
+ afx_msg void OnMediaInfoReady();
bool OnKeyDownInEdit(MSG* pMsg);
};