3
0
Fork 0
forked from suyu/suyu

Qt: Re-organize setup of debugging widgets

This commit is contained in:
Yuri Kunde Schlesner 2017-02-18 02:16:24 -08:00
parent e823c908ea
commit 4cb1f36896
4 changed files with 51 additions and 39 deletions

View file

@ -15,6 +15,9 @@ public:
explicit GraphicsTracingWidget(std::shared_ptr<Pica::DebugContext> debug_context,
QWidget* parent = nullptr);
void OnEmulationStarting(EmuThread* emu_thread);
void OnEmulationStopping();
private slots:
void StartRecording();
void StopRecording();
@ -23,9 +26,6 @@ private slots:
void OnBreakPointHit(Pica::DebugContext::Event event, void* data) override;
void OnResumed() override;
void OnEmulationStarting(EmuThread* emu_thread);
void OnEmulationStopping();
signals:
void SetStartTracingButtonEnabled(bool enable);
void SetStopTracingButtonEnabled(bool enable);

View file

@ -59,7 +59,7 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) {
statusBar()->hide();
InitializeWidgets();
InitializeDebugMenuActions();
InitializeDebugWidgets();
InitializeRecentFileMenuActions();
InitializeHotkeys();
@ -93,74 +93,85 @@ void GMainWindow::InitializeWidgets() {
game_list = new GameList();
ui.horizontalLayout->addWidget(game_list);
}
void GMainWindow::InitializeDebugWidgets() {
connect(ui.action_Create_Pica_Surface_Viewer, &QAction::triggered, this,
&GMainWindow::OnCreateGraphicsSurfaceViewer);
QMenu* debug_menu = ui.menu_View_Debugging;
profilerWidget = new ProfilerWidget(this);
addDockWidget(Qt::BottomDockWidgetArea, profilerWidget);
profilerWidget->hide();
debug_menu->addAction(profilerWidget->toggleViewAction());
#if MICROPROFILE_ENABLED
microProfileDialog = new MicroProfileDialog(this);
microProfileDialog->hide();
debug_menu->addAction(microProfileDialog->toggleViewAction());
#endif
disasmWidget = new DisassemblerWidget(this, emu_thread.get());
addDockWidget(Qt::BottomDockWidgetArea, disasmWidget);
disasmWidget->hide();
debug_menu->addAction(disasmWidget->toggleViewAction());
connect(this, &GMainWindow::EmulationStarting, disasmWidget,
&DisassemblerWidget::OnEmulationStarting);
connect(this, &GMainWindow::EmulationStopping, disasmWidget,
&DisassemblerWidget::OnEmulationStopping);
registersWidget = new RegistersWidget(this);
addDockWidget(Qt::RightDockWidgetArea, registersWidget);
registersWidget->hide();
debug_menu->addAction(registersWidget->toggleViewAction());
connect(this, &GMainWindow::EmulationStarting, registersWidget,
&RegistersWidget::OnEmulationStarting);
connect(this, &GMainWindow::EmulationStopping, registersWidget,
&RegistersWidget::OnEmulationStopping);
callstackWidget = new CallstackWidget(this);
addDockWidget(Qt::RightDockWidgetArea, callstackWidget);
callstackWidget->hide();
debug_menu->addAction(callstackWidget->toggleViewAction());
graphicsWidget = new GPUCommandStreamWidget(this);
addDockWidget(Qt::RightDockWidgetArea, graphicsWidget);
graphicsWidget->hide();
debug_menu->addAction(graphicsWidget->toggleViewAction());
graphicsCommandsWidget = new GPUCommandListWidget(this);
addDockWidget(Qt::RightDockWidgetArea, graphicsCommandsWidget);
graphicsCommandsWidget->hide();
debug_menu->addAction(graphicsCommandsWidget->toggleViewAction());
graphicsBreakpointsWidget = new GraphicsBreakPointsWidget(Pica::g_debug_context, this);
addDockWidget(Qt::RightDockWidgetArea, graphicsBreakpointsWidget);
graphicsBreakpointsWidget->hide();
debug_menu->addAction(graphicsBreakpointsWidget->toggleViewAction());
graphicsVertexShaderWidget = new GraphicsVertexShaderWidget(Pica::g_debug_context, this);
addDockWidget(Qt::RightDockWidgetArea, graphicsVertexShaderWidget);
graphicsVertexShaderWidget->hide();
debug_menu->addAction(graphicsVertexShaderWidget->toggleViewAction());
graphicsTracingWidget = new GraphicsTracingWidget(Pica::g_debug_context, this);
addDockWidget(Qt::RightDockWidgetArea, graphicsTracingWidget);
graphicsTracingWidget->hide();
debug_menu->addAction(graphicsTracingWidget->toggleViewAction());
connect(this, &GMainWindow::EmulationStarting, graphicsTracingWidget,
&GraphicsTracingWidget::OnEmulationStarting);
connect(this, &GMainWindow::EmulationStopping, graphicsTracingWidget,
&GraphicsTracingWidget::OnEmulationStopping);
waitTreeWidget = new WaitTreeWidget(this);
addDockWidget(Qt::LeftDockWidgetArea, waitTreeWidget);
waitTreeWidget->hide();
}
void GMainWindow::InitializeDebugMenuActions() {
auto graphicsSurfaceViewerAction = new QAction(tr("Create Pica Surface Viewer"), this);
connect(graphicsSurfaceViewerAction, SIGNAL(triggered()), this,
SLOT(OnCreateGraphicsSurfaceViewer()));
QMenu* debug_menu = ui.menu_View->addMenu(tr("Debugging"));
debug_menu->addAction(graphicsSurfaceViewerAction);
debug_menu->addSeparator();
debug_menu->addAction(profilerWidget->toggleViewAction());
#if MICROPROFILE_ENABLED
debug_menu->addAction(microProfileDialog->toggleViewAction());
#endif
debug_menu->addAction(disasmWidget->toggleViewAction());
debug_menu->addAction(registersWidget->toggleViewAction());
debug_menu->addAction(callstackWidget->toggleViewAction());
debug_menu->addAction(graphicsWidget->toggleViewAction());
debug_menu->addAction(graphicsCommandsWidget->toggleViewAction());
debug_menu->addAction(graphicsBreakpointsWidget->toggleViewAction());
debug_menu->addAction(graphicsVertexShaderWidget->toggleViewAction());
debug_menu->addAction(graphicsTracingWidget->toggleViewAction());
debug_menu->addAction(waitTreeWidget->toggleViewAction());
connect(this, &GMainWindow::EmulationStarting, waitTreeWidget,
&WaitTreeWidget::OnEmulationStarting);
connect(this, &GMainWindow::EmulationStopping, waitTreeWidget,
&WaitTreeWidget::OnEmulationStopping);
}
void GMainWindow::InitializeRecentFileMenuActions() {
@ -235,21 +246,9 @@ void GMainWindow::ConnectWidgetEvents() {
connect(ui.action_Stop, SIGNAL(triggered()), this, SLOT(OnStopGame()));
connect(ui.action_Single_Window_Mode, SIGNAL(triggered(bool)), this, SLOT(ToggleWindowMode()));
connect(this, SIGNAL(EmulationStarting(EmuThread*)), disasmWidget,
SLOT(OnEmulationStarting(EmuThread*)));
connect(this, SIGNAL(EmulationStopping()), disasmWidget, SLOT(OnEmulationStopping()));
connect(this, SIGNAL(EmulationStarting(EmuThread*)), registersWidget,
SLOT(OnEmulationStarting(EmuThread*)));
connect(this, SIGNAL(EmulationStopping()), registersWidget, SLOT(OnEmulationStopping()));
connect(this, SIGNAL(EmulationStarting(EmuThread*)), render_window,
SLOT(OnEmulationStarting(EmuThread*)));
connect(this, SIGNAL(EmulationStopping()), render_window, SLOT(OnEmulationStopping()));
connect(this, SIGNAL(EmulationStarting(EmuThread*)), graphicsTracingWidget,
SLOT(OnEmulationStarting(EmuThread*)));
connect(this, SIGNAL(EmulationStopping()), graphicsTracingWidget, SLOT(OnEmulationStopping()));
connect(this, SIGNAL(EmulationStarting(EmuThread*)), waitTreeWidget,
SLOT(OnEmulationStarting(EmuThread*)));
connect(this, SIGNAL(EmulationStopping()), waitTreeWidget, SLOT(OnEmulationStopping()));
}
void GMainWindow::OnDisplayTitleBars(bool show) {

View file

@ -64,7 +64,7 @@ signals:
private:
void InitializeWidgets();
void InitializeDebugMenuActions();
void InitializeDebugWidgets();
void InitializeRecentFileMenuActions();
void InitializeHotkeys();

View file

@ -79,8 +79,16 @@
<property name="title">
<string>&amp;View</string>
</property>
<widget class="QMenu" name="menu_View_Debugging">
<property name="title">
<string>Debugging</string>
</property>
<addaction name="action_Create_Pica_Surface_Viewer"/>
<addaction name="separator"/>
</widget>
<addaction name="action_Single_Window_Mode"/>
<addaction name="action_Display_Dock_Widget_Headers"/>
<addaction name="menu_View_Debugging"/>
</widget>
<widget class="QMenu" name="menu_Help">
<property name="title">
@ -167,6 +175,11 @@
<string>Selects a folder to display in the game list</string>
</property>
</action>
<action name="action_Create_Pica_Surface_Viewer">
<property name="text">
<string>Create Pica Surface Viewer</string>
</property>
</action>
</widget>
<resources/>
<connections>