Skip to content

Commit

Permalink
kernel explorer: Make it single-instance tool
Browse files Browse the repository at this point in the history
  • Loading branch information
elad335 committed Jan 9, 2021
1 parent 36159c2 commit aa4c6f7
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 23 deletions.
17 changes: 12 additions & 5 deletions rpcs3/rpcs3qt/kernel_explorer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <QVBoxLayout>
#include <QPushButton>
#include <QHeaderView>
#include <QTreeWidget>
#include <QTreeWidgetItem>

#include "Emu/IdManager.h"
Expand Down Expand Up @@ -152,13 +153,16 @@ kernel_explorer::kernel_explorer(QWidget* parent) : QDialog(parent)
{
setWindowTitle(tr("Kernel Explorer"));
setObjectName("kernel_explorer");
setAttribute(Qt::WA_DeleteOnClose);
setMinimumSize(QSize(700, 450));

QVBoxLayout* vbox_panel = new QVBoxLayout();
QHBoxLayout* hbox_buttons = new QHBoxLayout();
QPushButton* button_refresh = new QPushButton(tr("Refresh"), this);
//QPushButton* button_log = new QPushButton(tr("Log"), this); // TODO

hbox_buttons->addWidget(button_refresh);
//hbox_buttons->addSpacing(4);
//hbox_buttons->addWidget(button_log);
hbox_buttons->addStretch();

m_tree = new QTreeWidget(this);
Expand All @@ -167,17 +171,20 @@ kernel_explorer::kernel_explorer(QWidget* parent) : QDialog(parent)
m_tree->header()->close();

// Merge and display everything
vbox_panel->addSpacing(10);
vbox_panel->addSpacing(8);
vbox_panel->addLayout(hbox_buttons);
vbox_panel->addSpacing(10);
vbox_panel->addSpacing(8);
vbox_panel->addWidget(m_tree);
vbox_panel->addSpacing(10);
setLayout(vbox_panel);

// Events
connect(button_refresh, &QAbstractButton::clicked, this, &kernel_explorer::Update);
}

Update();
void kernel_explorer::closeEvent(QCloseEvent *event)
{
QDialog::closeEvent(event);
Q_EMIT FrameClosed();
}

void kernel_explorer::Update()
Expand Down
10 changes: 8 additions & 2 deletions rpcs3/rpcs3qt/kernel_explorer.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#pragma once

#include <QDialog>
#include <QTreeWidget>

#include "util/types.hpp"

class QTreeWidget;

class kernel_explorer : public QDialog
{
Q_OBJECT
Expand All @@ -30,6 +31,11 @@ class kernel_explorer : public QDialog
private:
QTreeWidget* m_tree;

private Q_SLOTS:
void closeEvent(QCloseEvent* event) override;

Q_SIGNALS:
void FrameClosed();

public Q_SLOTS:
void Update();
};
27 changes: 20 additions & 7 deletions rpcs3/rpcs3qt/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ void main_window::EnableMenus(bool enabled)
ui->sysSendExitAct->setEnabled(enabled);

// Tools
ui->toolskernel_explorerAct->setEnabled(enabled);
ui->showKernelExplorerAct->setEnabled(enabled);
ui->toolsmemory_viewerAct->setEnabled(enabled);
ui->toolsRsxDebuggerAct->setEnabled(enabled);
ui->toolsStringSearchAct->setEnabled(enabled);
Expand Down Expand Up @@ -1757,12 +1757,6 @@ void main_window::CreateConnects()
cgdw->show();
});

connect(ui->toolskernel_explorerAct, &QAction::triggered, [this]
{
kernel_explorer* kernelExplorer = new kernel_explorer(this);
kernelExplorer->show();
});

connect(ui->toolsmemory_viewerAct, &QAction::triggered, [this]
{
memory_viewer_panel* mvp = new memory_viewer_panel(this);
Expand Down Expand Up @@ -1795,6 +1789,19 @@ void main_window::CreateConnects()
m_gui_settings->SetValue(gui::mw_logger, checked);
});

connect(ui->showKernelExplorerAct, &QAction::toggled, [this](bool checked)
{
if (checked)
{
m_kernel_explorer->Update();
m_kernel_explorer->show();
}
else
{
m_kernel_explorer->hide();
}
});

connect(ui->showGameListAct, &QAction::triggered, [this](bool checked)
{
checked ? m_game_list_frame->show() : m_game_list_frame->hide();
Expand Down Expand Up @@ -1971,6 +1978,7 @@ void main_window::CreateDockWindows()
m_debugger_frame->setObjectName("debugger");
m_log_frame = new log_frame(m_gui_settings, m_mw);
m_log_frame->setObjectName("logger");
m_kernel_explorer = new kernel_explorer(this);

m_mw->addDockWidget(Qt::LeftDockWidgetArea, m_game_list_frame);
m_mw->addDockWidget(Qt::LeftDockWidgetArea, m_log_frame);
Expand All @@ -1988,6 +1996,11 @@ void main_window::CreateDockWindows()
}
});

connect(m_kernel_explorer, &kernel_explorer::FrameClosed, [this]()
{
ui->showKernelExplorerAct->setChecked(false);
});

connect(m_debugger_frame, &debugger_frame::DebugFrameClosed, [this]()
{
if (ui->showDebuggerAct->isChecked())
Expand Down
2 changes: 2 additions & 0 deletions rpcs3/rpcs3qt/main_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class game_list_frame;
class gui_settings;
class emu_settings;
class persistent_settings;
class kernel_explorer;

struct gui_game_info;

Expand Down Expand Up @@ -164,6 +165,7 @@ private Q_SLOTS:
log_frame* m_log_frame = nullptr;
debugger_frame* m_debugger_frame = nullptr;
game_list_frame* m_game_list_frame = nullptr;
kernel_explorer* m_kernel_explorer;
std::shared_ptr<gui_settings> m_gui_settings;
std::shared_ptr<emu_settings> m_emu_settings;
std::shared_ptr<persistent_settings> m_persistent_settings;
Expand Down
18 changes: 9 additions & 9 deletions rpcs3/rpcs3qt/main_window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@
<string>Utilities</string>
</property>
<addaction name="toolsCgDisasmAct"/>
<addaction name="toolskernel_explorerAct"/>
<addaction name="toolsmemory_viewerAct"/>
<addaction name="toolsRsxDebuggerAct"/>
<addaction name="toolsStringSearchAct"/>
Expand Down Expand Up @@ -297,6 +296,7 @@
</widget>
<addaction name="showDebuggerAct"/>
<addaction name="showLogAct"/>
<addaction name="showKernelExplorerAct"/>
<addaction name="separator"/>
<addaction name="showTitleBarsAct"/>
<addaction name="showToolBarAct"/>
Expand Down Expand Up @@ -588,14 +588,6 @@
<string>Cg Disasm</string>
</property>
</action>
<action name="toolskernel_explorerAct">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Kernel Explorer</string>
</property>
</action>
<action name="toolsmemory_viewerAct">
<property name="enabled">
<bool>false</bool>
Expand Down Expand Up @@ -641,6 +633,14 @@
<string>Show Log/TTY</string>
</property>
</action>
<action name="showKernelExplorerAct">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Show Kernel Explorer</string>
</property>
</action>
<action name="aboutAct">
<property name="text">
<string>About RPCS3</string>
Expand Down

0 comments on commit aa4c6f7

Please sign in to comment.