Moving XdbApp under ui::.

This commit is contained in:
Ben Vanik 2014-08-15 07:24:27 -07:00
parent 21225b5917
commit 4768f2fc0b
5 changed files with 15 additions and 15 deletions

View File

@ -8,8 +8,6 @@
'protocol.h', 'protocol.h',
'xdb.cc', 'xdb.cc',
'xdb.h', 'xdb.h',
'xdb_app.cc',
'xdb_app.h',
], ],
'includes': [ 'includes': [

View File

@ -4,6 +4,8 @@
'main_frame.cc', 'main_frame.cc',
'main_frame.h', 'main_frame.h',
'open_postmortem_trace_dialog.h', 'open_postmortem_trace_dialog.h',
'xdb_app.cc',
'xdb_app.h',
'xdb_ui.cpp', 'xdb_ui.cpp',
'xdb_ui.h', 'xdb_ui.h',
], ],

View File

@ -7,7 +7,7 @@
****************************************************************************** ******************************************************************************
*/ */
#include <xdb/xdb_app.h> #include <xdb/ui/xdb_app.h>
#include <atomic> #include <atomic>
#include <codecvt> #include <codecvt>
@ -20,6 +20,7 @@
#include <third_party/wxWidgets/include/wx/progdlg.h> #include <third_party/wxWidgets/include/wx/progdlg.h>
namespace xdb { namespace xdb {
namespace ui {
IMPLEMENT_APP(XdbApp); IMPLEMENT_APP(XdbApp);
@ -32,7 +33,7 @@ int XdbApp::OnExit() {
void XdbApp::OpenEmpty() { void XdbApp::OpenEmpty() {
while (true) { while (true) {
ui::OpenPostmortemTraceDialog dialog; OpenPostmortemTraceDialog dialog;
if (dialog.ShowModal() == wxID_CANCEL) { if (dialog.ShowModal() == wxID_CANCEL) {
Exit(); Exit();
return; return;
@ -100,7 +101,7 @@ bool XdbApp::OpenTraceFile(const std::wstring& trace_file_path,
} }
bool XdbApp::OpenDebugTarget(std::unique_ptr<DebugTarget> debug_target) { bool XdbApp::OpenDebugTarget(std::unique_ptr<DebugTarget> debug_target) {
auto main_frame = new ui::MainFrame(std::move(debug_target)); auto main_frame = new MainFrame(std::move(debug_target));
main_frames_.push_back(main_frame); main_frames_.push_back(main_frame);
main_frame->Connect(wxEVT_DESTROY, wxEventHandler(XdbApp::OnMainFrameDestroy), main_frame->Connect(wxEVT_DESTROY, wxEventHandler(XdbApp::OnMainFrameDestroy),
@ -128,4 +129,5 @@ void XdbApp::OnMainFrameDestroy(wxEvent& event) {
assert_always(); assert_always();
} }
} // namespace ui
} // namespace xdb } // namespace xdb

View File

@ -7,8 +7,8 @@
****************************************************************************** ******************************************************************************
*/ */
#ifndef XDB_XDB_APP_H_ #ifndef XDB_UI_XDB_APP_H_
#define XDB_XDB_APP_H_ #define XDB_UI_XDB_APP_H_
#include <memory> #include <memory>
#include <string> #include <string>
@ -19,11 +19,8 @@
namespace xdb { namespace xdb {
namespace ui { namespace ui {
class MainFrame;
} // namespace ui
} // namespace xdb
namespace xdb { class MainFrame;
class XdbApp : public wxApp { class XdbApp : public wxApp {
public: public:
@ -42,9 +39,10 @@ class XdbApp : public wxApp {
void OnMainFrameDestroy(wxEvent& event); void OnMainFrameDestroy(wxEvent& event);
std::vector<ui::MainFrame*> main_frames_; std::vector<MainFrame*> main_frames_;
}; };
} // namespace ui
} // namespace xdb } // namespace xdb
#endif // XDB_XDB_APP_H_ #endif // XDB_UI_XDB_APP_H_

View File

@ -14,7 +14,7 @@
#include <gflags/gflags.h> #include <gflags/gflags.h>
#include <poly/poly.h> #include <poly/poly.h>
#include <third_party/wxWidgets/include/wx/wx.h> #include <third_party/wxWidgets/include/wx/wx.h>
#include <xdb/xdb_app.h> #include <xdb/ui/xdb_app.h>
DEFINE_string(trace_file, "", "Trace file to load on startup."); DEFINE_string(trace_file, "", "Trace file to load on startup.");
DEFINE_string(content_file, "", DEFINE_string(content_file, "",
@ -38,7 +38,7 @@ int main(int argc, xechar_t** argv) {
} }
// App is auto-freed by wx. // App is auto-freed by wx.
auto app = new XdbApp(); auto app = new ui::XdbApp();
wxApp::SetInstance(app); wxApp::SetInstance(app);
if (!wxEntryStart(0, nullptr)) { if (!wxEntryStart(0, nullptr)) {
XEFATAL("Failed to enter wxWidgets app"); XEFATAL("Failed to enter wxWidgets app");