Qt: Replace debugger menu bar with toolbar

That way it's not missing on MacOS.
This commit is contained in:
Stenzek 2023-09-23 21:14:17 +10:00 committed by Connor McLaughlin
parent 0ac59b4152
commit 4027304ece
2 changed files with 78 additions and 31 deletions

View File

@ -38,20 +38,10 @@ DebuggerWindow::DebuggerWindow(QWidget* parent)
m_ui.cpuTabs->setStyleSheet(QStringLiteral("font: 8pt 'Monospace'")); m_ui.cpuTabs->setStyleSheet(QStringLiteral("font: 8pt 'Monospace'"));
#endif #endif
m_actionRunPause = new QAction(tr("Run"), this); connect(m_ui.actionRun, &QAction::triggered, this, &DebuggerWindow::onRunPause);
m_actionStepInto = new QAction(tr("Step Into"), this); connect(m_ui.actionStepInto, &QAction::triggered, this, &DebuggerWindow::onStepInto);
m_actionStepOver = new QAction(tr("Step Over"), this); connect(m_ui.actionStepOver, &QAction::triggered, this, &DebuggerWindow::onStepOver);
m_actionStepOut = new QAction(tr("Step Out"), this); connect(m_ui.actionStepOut, &QAction::triggered, this, &DebuggerWindow::onStepOut);
m_ui.menubar->addAction(m_actionRunPause);
m_ui.menubar->addAction(m_actionStepInto);
m_ui.menubar->addAction(m_actionStepOver);
m_ui.menubar->addAction(m_actionStepOut);
connect(m_actionRunPause, &QAction::triggered, this, &DebuggerWindow::onRunPause);
connect(m_actionStepInto, &QAction::triggered, this, &DebuggerWindow::onStepInto);
connect(m_actionStepOver, &QAction::triggered, this, &DebuggerWindow::onStepOver);
connect(m_actionStepOut, &QAction::triggered, this, &DebuggerWindow::onStepOut);
connect(g_emu_thread, &EmuThread::onVMPaused, this, &DebuggerWindow::onVMStateChanged); connect(g_emu_thread, &EmuThread::onVMPaused, this, &DebuggerWindow::onVMStateChanged);
connect(g_emu_thread, &EmuThread::onVMResumed, this, &DebuggerWindow::onVMStateChanged); connect(g_emu_thread, &EmuThread::onVMResumed, this, &DebuggerWindow::onVMStateChanged);
@ -78,18 +68,20 @@ void DebuggerWindow::onVMStateChanged()
if (!QtHost::IsVMPaused()) if (!QtHost::IsVMPaused())
{ {
nextStatePaused = true; nextStatePaused = true;
m_actionRunPause->setText(tr("Pause")); m_ui.actionRun->setText(tr("Pause"));
m_actionStepInto->setEnabled(false); m_ui.actionRun->setIcon(QIcon::fromTheme(QStringLiteral("pause-line")));
m_actionStepOver->setEnabled(false); m_ui.actionStepInto->setEnabled(false);
m_actionStepOut->setEnabled(false); m_ui.actionStepOver->setEnabled(false);
m_ui.actionStepOut->setEnabled(false);
} }
else else
{ {
nextStatePaused = false; nextStatePaused = false;
m_actionRunPause->setText(tr("Run")); m_ui.actionRun->setText(tr("Run"));
m_actionStepInto->setEnabled(true); m_ui.actionRun->setIcon(QIcon::fromTheme(QStringLiteral("play-line")));
m_actionStepOver->setEnabled(true); m_ui.actionStepInto->setEnabled(true);
m_actionStepOut->setEnabled(true); m_ui.actionStepOver->setEnabled(true);
m_ui.actionStepOut->setEnabled(true);
Host::RunOnCPUThread([] { Host::RunOnCPUThread([] {
if (CBreakPoints::GetBreakpointTriggered()) if (CBreakPoints::GetBreakpointTriggered())
{ {
@ -101,7 +93,6 @@ void DebuggerWindow::onVMStateChanged()
CBreakPoints::SetSkipFirst(BREAKPOINT_IOP, r3000Debug.getPC()); CBreakPoints::SetSkipFirst(BREAKPOINT_IOP, r3000Debug.getPC());
} }
}); });
} }
return; return;
} }

View File

@ -20,21 +20,77 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QMenuBar" name="menubar"> <widget class="QToolBar" name="toolBar">
<property name="geometry"> <property name="windowTitle">
<rect> <string>toolBar</string>
<x>0</x>
<y>0</y>
<width>800</width>
<height>22</height>
</rect>
</property> </property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="floatable">
<bool>false</bool>
</property>
<property name="movable">
<bool>false</bool>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="actionRun"/>
<addaction name="actionStepInto"/>
<addaction name="actionStepOver"/>
<addaction name="actionStepOut"/>
</widget> </widget>
<action name="actionRun"> <action name="actionRun">
<property name="icon">
<iconset theme="play-line"/>
</property>
<property name="text"> <property name="text">
<string>Run</string> <string>Run</string>
</property> </property>
</action> </action>
<action name="actionStepInto">
<property name="icon">
<iconset theme="debug-step-into-line"/>
</property>
<property name="text">
<string>Step Into</string>
</property>
<property name="shortcut">
<string>F11</string>
</property>
</action>
<action name="actionStepOver">
<property name="icon">
<iconset theme="debug-step-over-line"/>
</property>
<property name="text">
<string>Step Over</string>
</property>
<property name="shortcut">
<string>F10</string>
</property>
</action>
<action name="actionStepOut">
<property name="icon">
<iconset theme="debug-step-out-line"/>
</property>
<property name="text">
<string>Step Out</string>
</property>
<property name="shortcut">
<string>Shift+F11</string>
</property>
</action>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>