59 lines
2.5 KiB
C++
59 lines
2.5 KiB
C++
#pragma once
|
|
|
|
class App : public wxApp
|
|
{
|
|
public:
|
|
std::unique_ptr<wxConfigBase>pConfig;
|
|
// pConfig corresponds to the Windows Registry entry Computer\HKEY_CURRENT_USER\Software\ro\wallet
|
|
// Don't use the registry for stuff better served by wxStandardPaths and sqlit3 files located
|
|
// in locations specified by wxStandardPaths
|
|
App();
|
|
virtual ~App();
|
|
virtual bool OnInit() wxOVERRIDE;
|
|
virtual int OnExit() wxOVERRIDE;
|
|
virtual int OnRun() wxOVERRIDE;
|
|
void OnError(wxCommandEvent&);
|
|
virtual void OnInitCmdLine(wxCmdLineParser& parser) wxOVERRIDE;
|
|
virtual bool OnCmdLineParsed(wxCmdLineParser& parser) wxOVERRIDE;
|
|
virtual bool OnExceptionInMainLoop() wxOVERRIDE;
|
|
bool m_unit_test{ false };
|
|
bool m_display{ false };
|
|
bool m_display_in_front{ false };
|
|
bool m_log_focus_events{ false };
|
|
bool m_quick_unit_test{ false };
|
|
bool m_complete_unit_test{ false };
|
|
wxVector<wxString> m_params;
|
|
};
|
|
|
|
void UnitTest(wxIdleEvent& event);
|
|
|
|
static constexpr wxCmdLineEntryDesc g_cmdLineDesc[] =
|
|
{
|
|
{ wxCMD_LINE_SWITCH, "h", "help", "displays help on the command line parameters.",
|
|
wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
|
|
{ wxCMD_LINE_SWITCH, "t", "test", "-t or --test performs unit test, exits on completion of "
|
|
"unit test returning error value.",
|
|
wxCMD_LINE_VAL_NONE, wxCMD_LINE_SWITCH_NEGATABLE},
|
|
{ wxCMD_LINE_SWITCH, "q", "quick", "-qt or --quick --test performs those unit tests that do not cause noticeable startup delay.",
|
|
wxCMD_LINE_VAL_NONE, wxCMD_LINE_SWITCH_NEGATABLE},
|
|
{ wxCMD_LINE_SWITCH, "c", "complete", "-ct or --complete --test tests everything.",
|
|
wxCMD_LINE_VAL_NONE, wxCMD_LINE_SWITCH_NEGATABLE},
|
|
{ wxCMD_LINE_SWITCH, "d", "display", "-d or --display enables display of log in front. "
|
|
"Usually used with unit test as -dct. "
|
|
"If the log is displayed, then does not exit on completion of unit test.",
|
|
wxCMD_LINE_VAL_NONE, wxCMD_LINE_SWITCH_NEGATABLE},
|
|
{ wxCMD_LINE_SWITCH, "l", "log", "-l or --log enables display of log behind. "
|
|
"Usually used with unit test as -lt. "
|
|
"If the log is displayed, then does not exit on completion of unit test.",
|
|
wxCMD_LINE_VAL_NONE, wxCMD_LINE_SWITCH_NEGATABLE},
|
|
{ wxCMD_LINE_SWITCH, "f", "focus", "-f or --focus causes focus events to be logged for debugging purposes. "
|
|
"implies log",
|
|
wxCMD_LINE_VAL_NONE, wxCMD_LINE_SWITCH_NEGATABLE},
|
|
{ wxCMD_LINE_PARAM, "", "", "mywallet.wallet",
|
|
wxCMD_LINE_VAL_NONE, /*wxCMD_LINE_PARAM_MULTIPLE|*/wxCMD_LINE_PARAM_OPTIONAL},
|
|
{ wxCMD_LINE_NONE }
|
|
};
|
|
|
|
DECLARE_APP(App)
|
|
inline App *singletonApp{nullptr};
|