* Fix commandline support, I have no idea what the !OnInit block was after OnInit(), I removed it and everthing works as expected.
* Add -x switch for dumping the report to report.xml Unfortunatly this causes a flicker of the reporter as we need to create the main frame in order to gather some desktop metrics. Originally committed to SVN as r3597.
This commit is contained in:
parent
38d5f06821
commit
c821a7e172
3 changed files with 32 additions and 14 deletions
|
@ -41,26 +41,34 @@
|
||||||
/// @brief Init the reporter.
|
/// @brief Init the reporter.
|
||||||
bool Reporter::OnInit()
|
bool Reporter::OnInit()
|
||||||
{
|
{
|
||||||
if ( !wxApp::OnInit() )
|
// if ( !wxApp::OnInit() )
|
||||||
return false;
|
// return false;
|
||||||
|
|
||||||
wxApp::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, _("Reporter"));
|
wxApp::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, _("Reporter"));
|
||||||
|
|
||||||
|
|
||||||
static const wxCmdLineEntryDesc cmdLineDesc[] = {
|
static const wxCmdLineEntryDesc cmdLineDesc[] = {
|
||||||
{ wxCMD_LINE_SWITCH, "c", "crash", "Launch in crash mode.", wxCMD_LINE_VAL_NONE, NULL },
|
{ wxCMD_LINE_SWITCH, "c", "crash", "Launch in crash mode.", wxCMD_LINE_VAL_NONE, NULL },
|
||||||
{ wxCMD_LINE_SWITCH, "r", "report", "Launch in Report mode.", wxCMD_LINE_VAL_NONE, NULL },
|
{ wxCMD_LINE_SWITCH, "r", "report", "Launch in Report mode.", wxCMD_LINE_VAL_NONE, NULL },
|
||||||
{ wxCMD_LINE_SWITCH, "h", "help", "This help message", wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
|
{ wxCMD_LINE_SWITCH, "x", "xml", "Dump XML file", wxCMD_LINE_VAL_NONE, NULL },
|
||||||
|
{ wxCMD_LINE_SWITCH, "h", "help", "This help message", wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
|
||||||
{ wxCMD_LINE_NONE, NULL, NULL, NULL, wxCMD_LINE_VAL_NONE, NULL}
|
{ wxCMD_LINE_NONE, NULL, NULL, NULL, wxCMD_LINE_VAL_NONE, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
wxCmdLineParser parser(cmdLineDesc, argc, argv);
|
wxCmdLineParser parser(cmdLineDesc, argc, argv);
|
||||||
|
|
||||||
|
parser.SetLogo("Aegisub Reporter version x.x");
|
||||||
|
parser.SetCmdLine(argc, argv);
|
||||||
switch ( parser.Parse() ) {
|
switch ( parser.Parse() ) {
|
||||||
case -1:
|
case -1:
|
||||||
|
return false;
|
||||||
break; // Help
|
break; // Help
|
||||||
case 0:
|
case 0:
|
||||||
break; // OK
|
break; // OK
|
||||||
default:
|
default:
|
||||||
wxLogMessage(_T("Syntax error."));
|
wxLogMessage(_T("Syntax error."));
|
||||||
|
return false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,10 +86,19 @@ bool Reporter::OnInit()
|
||||||
setlocale(LC_NUMERIC, "C");
|
setlocale(LC_NUMERIC, "C");
|
||||||
setlocale(LC_CTYPE, "C");
|
setlocale(LC_CTYPE, "C");
|
||||||
|
|
||||||
|
|
||||||
mFrame *frame = new mFrame(_("Aegisub Reporter"));
|
mFrame *frame = new mFrame(_("Aegisub Reporter"));
|
||||||
|
Report *r = new Report;
|
||||||
|
|
||||||
|
if (parser.Found("x")) {
|
||||||
|
r->Save("report.xml");
|
||||||
|
wxPrintf("Report saved to report.xml\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SetTopWindow(frame);
|
SetTopWindow(frame);
|
||||||
|
|
||||||
Report *r = new Report;
|
|
||||||
frame->SetReport(r);
|
frame->SetReport(r);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -186,16 +186,12 @@ void Report::ProcessNode(wxXmlNode *node, wxString *text, wxListView *listView)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Fill wxListView with report contents.
|
|
||||||
/// @param listview wxListview to fill.
|
|
||||||
void Report::Fill(wxString *text, wxListView *listView) {
|
void Report::Fill(wxString *text, wxListView *listView) {
|
||||||
|
|
||||||
listView->InsertColumn(0, _("Entry"), wxLIST_FORMAT_RIGHT);
|
listView->InsertColumn(0, _("Entry"), wxLIST_FORMAT_RIGHT);
|
||||||
listView->InsertColumn(1, _("Text"), wxLIST_FORMAT_LEFT, 100);
|
listView->InsertColumn(1, _("Text"), wxLIST_FORMAT_LEFT, 100);
|
||||||
|
|
||||||
|
|
||||||
//wxString *text = new wxString();
|
|
||||||
|
|
||||||
ProcessNode(doc.report, text, listView);
|
ProcessNode(doc.report, text, listView);
|
||||||
|
|
||||||
listView->SetColumnWidth(0, wxLIST_AUTOSIZE);
|
listView->SetColumnWidth(0, wxLIST_AUTOSIZE);
|
||||||
|
@ -204,6 +200,6 @@ void Report::Fill(wxString *text, wxListView *listView) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Return Report as Text for the Clipboard.
|
/// @brief Return Report as Text for the Clipboard.
|
||||||
wxString Report::AsText() {
|
void Report::Save(wxString file) {
|
||||||
return "not implimented.";
|
doc.doc->Save(file);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,13 @@ public:
|
||||||
Report();
|
Report();
|
||||||
~Report() {};
|
~Report() {};
|
||||||
|
|
||||||
|
/// Fill wxListView with report contents.
|
||||||
|
/// @param text pointer to text buffer
|
||||||
|
/// @param listview wxListview to fill
|
||||||
void Fill(wxString *text, wxListView *listView);
|
void Fill(wxString *text, wxListView *listView);
|
||||||
wxString AsText();
|
|
||||||
|
/// Save XML report to a file.
|
||||||
|
void Save(wxString file);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Comparison callback for nameMap.
|
/// Comparison callback for nameMap.
|
||||||
|
|
Loading…
Reference in a new issue