Added a debug window for debug output. Show mkvmerge's capabilities in the debug window.

This commit is contained in:
Moritz Bunkus 2005-02-27 12:16:55 +00:00
parent 77e119a01f
commit 79e6186cfe
2 changed files with 31 additions and 1 deletions

View File

@ -120,6 +120,15 @@ tab_settings::tab_settings(wxWindow *parent):
siz_misc->Add(cb_warn_usage, 0, wxLEFT, 5);
siz_misc->Add(0, 5, 0, 0, 0);
cb_gui_debugging =
new wxCheckBox(this, ID_CB_GUI_DEBUGGING, wxT("Show mmg's debug window"));
cb_gui_debugging->SetToolTip(TIP("Shows mmg's debug window in which "
"debug messages will appear. This is only "
"useful if you're helping the author "
"debug a problem in mmg."));
siz_misc->Add(cb_gui_debugging, 0, wxLEFT, 5);
siz_misc->Add(0, 5, 0, 0, 0);
siz_about = new wxStaticBoxSizer(new wxStaticBox(this, -1, wxT("About")),
wxHORIZONTAL);
siz_about->Add(new wxStaticBitmap(this, -1, wxBitmap(matroskalogo_big_xpm)),
@ -145,6 +154,9 @@ tab_settings::tab_settings(wxWindow *parent):
siz_all->Add(siz_about, 0, wxGROW | wxALL, 5);
SetSizer(siz_all);
log_window = new wxLogWindow(this, wxT("mmg debug output"), false);
wxLog::SetActiveTarget(log_window);
load_preferences();
}
@ -190,6 +202,12 @@ tab_settings::on_on_top_selected(wxCommandEvent &evt) {
mdlg->set_on_top(cb_on_top->IsChecked());
}
void
tab_settings::on_gui_debugging_selected(wxCommandEvent &evt) {
save_preferences();
log_window->Show(cb_gui_debugging->IsChecked());
}
void
tab_settings::load_preferences() {
wxConfig *cfg = (wxConfig *)wxConfigBase::Get();
@ -221,6 +239,9 @@ tab_settings::load_preferences() {
mdlg->set_on_top(b);
cfg->Read(wxT("warn_usage"), &b, true);
cb_warn_usage->SetValue(b);
cfg->Read(wxT("gui_debugging"), &b, false);
cb_gui_debugging->SetValue(b);
log_window->Show(b);
}
void
@ -237,6 +258,7 @@ tab_settings::save_preferences() {
cb_filenew_after_add_to_jobqueue->IsChecked());
cfg->Write(wxT("on_top"), cb_on_top->IsChecked());
cfg->Write(wxT("warn_usage"), cb_warn_usage->IsChecked());
cfg->Write(wxT("gui_debugging"), cb_gui_debugging->IsChecked());
cfg->Flush();
}
@ -260,6 +282,7 @@ tab_settings::query_mkvmerge_capabilities() {
vector<wxString> parts;
int result, i;
wxLogMessage(wxT("Querying mkvmerge's capabilities"));
tmp = wxT("\"") + mkvmerge_path + wxT("\" --capabilities");
#if defined(SYS_WINDOWS)
result = wxExecute(tmp, output);
@ -301,6 +324,7 @@ tab_settings::query_mkvmerge_capabilities() {
for (i = 0; i < output.Count(); i++) {
tmp = output[i];
strip(tmp);
wxLogMessage(wxT("Capability: %s"), tmp.c_str());
parts = split(tmp, wxU("="), 2);
if (parts.size() == 1)
capabilities[parts[0]] = wxT("true");
@ -318,4 +342,5 @@ BEGIN_EVENT_TABLE(tab_settings, wxPanel)
EVT_CHECKBOX(ID_CB_NEW_AFTER_ADD_TO_JOBQUEUE, tab_settings::on_xyz_selected)
EVT_CHECKBOX(ID_CB_ON_TOP, tab_settings::on_on_top_selected)
EVT_CHECKBOX(ID_CB_WARN_USAGE, tab_settings::on_xyz_selected)
EVT_CHECKBOX(ID_CB_GUI_DEBUGGING, tab_settings::on_gui_debugging_selected)
END_EVENT_TABLE();

View File

@ -16,6 +16,8 @@
#ifndef __TAB_SETTINGS_H
#define __TAB_SETTINGS_H
#include "wx/log.h"
#define ID_TC_MKVMERGE 15000
#define ID_B_BROWSEMKVMERGE 15001
#define ID_COB_PRIORITY 15002
@ -24,6 +26,7 @@
#define ID_CB_ON_TOP 15005
#define ID_CB_NEW_AFTER_ADD_TO_JOBQUEUE 15006
#define ID_CB_WARN_USAGE 15007
#define ID_CB_GUI_DEBUGGING 15008
class tab_settings: public wxPanel {
DECLARE_CLASS(tab_settings);
@ -33,8 +36,9 @@ public:
wxCheckBox *cb_show_commandline, *cb_autoset_output_filename;
wxCheckBox *cb_ask_before_overwriting, *cb_on_top;
wxCheckBox *cb_filenew_after_add_to_jobqueue;
wxCheckBox *cb_warn_usage;
wxCheckBox *cb_warn_usage, *cb_gui_debugging;
wxComboBox *cob_priority;
wxLogWindow *log_window;
public:
tab_settings(wxWindow *parent);
@ -43,6 +47,7 @@ public:
void on_browse(wxCommandEvent &evt);
void on_xyz_selected(wxCommandEvent &evt);
void on_on_top_selected(wxCommandEvent &evt);
void on_gui_debugging_selected(wxCommandEvent &evt);
void load_preferences();
void save_preferences();