[Qt] style adjustments 5

rename even more members and clean headers
adjust some more connects
move some function bodies to cpp
This commit is contained in:
Megamouse 2017-09-06 20:13:01 +02:00 committed by Ani
parent 95231c4dee
commit 43bae9f9d7
8 changed files with 189 additions and 197 deletions

View File

@ -11,15 +11,12 @@ extern bool user_asked_for_frame_capture;
debugger_frame::debugger_frame(std::shared_ptr<gui_settings> settings, QWidget *parent)
: QDockWidget(tr("Debugger"), parent), xgui_settings(settings)
{
pSize = 10;
update = new QTimer(this);
connect(update, &QTimer::timeout, this, &debugger_frame::UpdateUI);
m_update = new QTimer(this);
connect(m_update, &QTimer::timeout, this, &debugger_frame::UpdateUI);
EnableUpdateTimer(true);
body = new QWidget(this);
mono = QFontDatabase::systemFont(QFontDatabase::FixedFont);
mono.setPointSize(pSize);
m_mono = QFontDatabase::systemFont(QFontDatabase::FixedFont);
m_mono.setPointSize(10);
QVBoxLayout* vbox_p_main = new QVBoxLayout();
QHBoxLayout* hbox_b_main = new QHBoxLayout();
@ -57,8 +54,8 @@ debugger_frame::debugger_frame(std::shared_ptr<gui_settings> settings, QWidget *
m_regs->setLineWrapMode(QTextEdit::NoWrap);
m_regs->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
m_list->setFont(mono);
m_regs->setFont(mono);
m_list->setFont(m_mono);
m_regs->setFont(m_mono);
m_splitter = new QSplitter(this);
m_splitter->addWidget(m_list);
@ -70,6 +67,7 @@ debugger_frame::debugger_frame(std::shared_ptr<gui_settings> settings, QWidget *
vbox_p_main->addLayout(hbox_b_main);
vbox_p_main->addLayout(hbox_w_list);
QWidget* body = new QWidget(this);
body->setLayout(vbox_p_main);
setWidget(body);
@ -191,7 +189,7 @@ void debugger_frame::UpdateUI()
{
UpdateUnitList();
if (m_noThreadSelected) return;
if (m_no_thread_selected) return;
const auto cpu = this->cpu.lock();
@ -279,13 +277,13 @@ void debugger_frame::OnSelectUnit()
if (m_choice_units->count() < 1 || m_current_choice == m_choice_units->currentText()) return;
m_current_choice = m_choice_units->currentText();
m_noThreadSelected = m_current_choice == NoThread;
m_list->m_noThreadSelected = m_noThreadSelected;
m_no_thread_selected = m_current_choice == NoThread;
m_list->m_no_thread_selected = m_no_thread_selected;
m_disasm.reset();
cpu.reset();
if (!m_noThreadSelected)
if (!m_no_thread_selected)
{
const auto on_select = [&](u32, cpu_thread& cpu)
{
@ -356,11 +354,11 @@ void debugger_frame::Show_Val()
QHBoxLayout* hbox_text_panel(new QHBoxLayout());
QHBoxLayout* hbox_button_panel(new QHBoxLayout());
QLineEdit* p_pc(new QLineEdit(diag));
p_pc->setFont(mono);
p_pc->setFont(m_mono);
p_pc->setMaxLength(8);
p_pc->setFixedWidth(90);
QLabel* addr(new QLabel(diag));
addr->setFont(mono);
addr->setFont(m_mono);
hbox_text_panel->addWidget(addr);
hbox_text_panel->addWidget(p_pc);
@ -450,7 +448,7 @@ void debugger_frame::DoStep()
void debugger_frame::EnableUpdateTimer(bool enable)
{
enable ? update->start(50) : update->stop();
enable ? m_update->start(50) : m_update->stop();
}
void debugger_frame::EnableButtons(bool enable)
@ -589,7 +587,7 @@ void debugger_list::keyPressEvent(QKeyEvent* event)
void debugger_list::mouseDoubleClickEvent(QMouseEvent* event)
{
if (event->button() == Qt::LeftButton && !Emu.IsStopped() && !m_noThreadSelected)
if (event->button() == Qt::LeftButton && !Emu.IsStopped() && !m_no_thread_selected)
{
long i = currentRow();
if (i < 0) return;

View File

@ -35,10 +35,8 @@ class debugger_frame : public QDockWidget
{
Q_OBJECT
QWidget* body;
debugger_list* m_list;
int pSize;
QFont mono;
QFont m_mono;
QTextEdit* m_regs;
QPushButton* m_go_to_addr;
QPushButton* m_go_to_pc;
@ -47,14 +45,14 @@ class debugger_frame : public QDockWidget
QPushButton* m_btn_run;
QComboBox* m_choice_units;
QString m_current_choice;
bool m_noThreadSelected = true;
bool m_no_thread_selected = true;
u64 m_threads_created = 0;
u64 m_threads_deleted = 0;
u32 m_last_pc = -1;
u32 m_last_stat = 0;
QTimer* update;
QTimer* m_update;
QSplitter* m_splitter;
const QString NoThread = tr("No Thread");
@ -109,7 +107,7 @@ class debugger_list : public QListWidget
public:
u32 m_pc;
u32 m_item_count;
bool m_noThreadSelected;
bool m_no_thread_selected;
public:
debugger_list(debugger_frame* parent);

View File

@ -8,14 +8,19 @@
inline std::string sstr(const QString& _in) { return _in.toUtf8().toStdString(); }
gui_settings::gui_settings(QObject* parent) : QObject(parent), settings(ComputeSettingsDir() + tr("CurrentSettings") + ".ini", QSettings::Format::IniFormat, parent),
settingsDir(ComputeSettingsDir())
gui_settings::gui_settings(QObject* parent) : QObject(parent), m_settings(ComputeSettingsDir() + tr("CurrentSettings") + ".ini", QSettings::Format::IniFormat, parent),
m_settingsDir(ComputeSettingsDir())
{
}
gui_settings::~gui_settings()
{
settings.sync();
m_settings.sync();
}
QString gui_settings::GetSettingsDir()
{
return m_settingsDir.absolutePath();
}
QString gui_settings::ComputeSettingsDir()
@ -29,14 +34,14 @@ void gui_settings::ChangeToConfig(const QString& name)
{ // don't try to change to yourself.
Reset(false);
QSettings other(settingsDir.absoluteFilePath(name + ".ini"), QSettings::IniFormat);
QSettings other(m_settingsDir.absoluteFilePath(name + ".ini"), QSettings::IniFormat);
QStringList keys = other.allKeys();
for (QStringList::iterator i = keys.begin(); i != keys.end(); i++)
{
settings.setValue(*i, other.value(*i));
m_settings.setValue(*i, other.value(*i));
}
settings.sync();
m_settings.sync();
}
}
@ -44,19 +49,19 @@ void gui_settings::Reset(bool removeMeta)
{
if (removeMeta)
{
settings.clear();
m_settings.clear();
}
else
{
settings.remove(GUI::logger);
settings.remove(GUI::main_window);
settings.remove(GUI::game_list);
m_settings.remove(GUI::logger);
m_settings.remove(GUI::main_window);
m_settings.remove(GUI::game_list);
}
}
QVariant gui_settings::GetValue(const GUI_SAVE& entry)
{
return settings.value(entry.key + "/" + entry.name, entry.def);
return m_settings.value(entry.key + "/" + entry.name, entry.def);
}
QVariant gui_settings::List2Var(const q_pair_list& list)
@ -138,9 +143,9 @@ QPixmap gui_settings::colorizedPixmap(const QPixmap& old_pixmap, const QColor& o
void gui_settings::SetValue(const GUI_SAVE& entry, const QVariant& value)
{
settings.beginGroup(entry.key);
settings.setValue(entry.name, value);
settings.endGroup();
m_settings.beginGroup(entry.key);
m_settings.setValue(entry.name, value);
m_settings.endGroup();
}
QStringList gui_settings::GetGameListCategoryFilters()
@ -269,7 +274,7 @@ QStringList gui_settings::GetConfigEntries()
{
QStringList nameFilter;
nameFilter << "*.ini";
QFileInfoList entries = settingsDir.entryInfoList(nameFilter, QDir::Files);
QFileInfoList entries = m_settingsDir.entryInfoList(nameFilter, QDir::Files);
QStringList res;
for (QFileInfo entry : entries)
{
@ -282,12 +287,12 @@ QStringList gui_settings::GetConfigEntries()
void gui_settings::BackupSettingsToTarget(const QString& friendlyName)
{
QSettings target(ComputeSettingsDir() + friendlyName + ".ini", QSettings::Format::IniFormat);
QStringList keys = settings.allKeys();
QStringList keys = m_settings.allKeys();
for (QStringList::iterator i = keys.begin(); i != keys.end(); i++)
{
if (!i->startsWith(GUI::meta))
{
target.setValue(*i, settings.value(*i));
target.setValue(*i, m_settings.value(*i));
}
}
target.sync();
@ -297,8 +302,8 @@ QStringList gui_settings::GetStylesheetEntries()
{
QStringList nameFilter;
nameFilter << "*.qss";
QString path = settingsDir.absolutePath();
QFileInfoList entries = settingsDir.entryInfoList(nameFilter, QDir::Files);
QString path = m_settingsDir.absolutePath();
QFileInfoList entries = m_settingsDir.entryInfoList(nameFilter, QDir::Files);
QStringList res;
for (QFileInfo entry : entries)
{
@ -317,5 +322,5 @@ QString gui_settings::GetCurrentStylesheetPath()
return "";
}
return settingsDir.absoluteFilePath(stylesheet + ".qss");
return m_settingsDir.absoluteFilePath(stylesheet + ".qss");
}

View File

@ -166,9 +166,7 @@ public:
explicit gui_settings(QObject* parent = nullptr);
~gui_settings();
QString GetSettingsDir() {
return settingsDir.absolutePath();
}
QString GetSettingsDir();
/** Changes the settings file to the destination preset*/
void ChangeToConfig(const QString& destination);
@ -217,6 +215,6 @@ private:
QString ComputeSettingsDir();
void BackupSettingsToTarget(const QString& destination);
QSettings settings;
QDir settingsDir;
QSettings m_settings;
QDir m_settingsDir;
};

View File

@ -102,42 +102,31 @@ static gui_listener s_gui_listener;
log_frame::log_frame(std::shared_ptr<gui_settings> guiSettings, QWidget *parent) : QDockWidget(tr("Log"), parent), xgui_settings(guiSettings)
{
tabWidget = new QTabWidget;
QTabWidget* tabWidget = new QTabWidget;
log = new QTextEdit(tabWidget);
QPalette logPalette = log->palette();
m_log = new QTextEdit(tabWidget);
QPalette logPalette = m_log->palette();
logPalette.setColor(QPalette::Base, Qt::black);
log->setPalette(logPalette);
log->setReadOnly(true);
m_log->setPalette(logPalette);
m_log->setReadOnly(true);
m_log->setContextMenuPolicy(Qt::CustomContextMenu);
tty = new QTextEdit(tabWidget);
QPalette ttyPalette = log->palette();
m_tty = new QTextEdit(tabWidget);
QPalette ttyPalette = m_log->palette();
ttyPalette.setColor(QPalette::Base, Qt::black);
ttyPalette.setColor(QPalette::Text, Qt::white);
tty->setPalette(ttyPalette);
tty->setReadOnly(true);
m_tty->setPalette(ttyPalette);
m_tty->setReadOnly(true);
tabWidget->addTab(log, tr("Log"));
tabWidget->addTab(tty, tr("TTY"));
tabWidget->addTab(m_log, tr("Log"));
tabWidget->addTab(m_tty, tr("TTY"));
setWidget(tabWidget);
// Open or create TTY.log
tty_file.open(fs::get_config_dir() + "TTY.log", fs::read + fs::create);
m_tty_file.open(fs::get_config_dir() + "TTY.log", fs::read + fs::create);
CreateAndConnectActions();
log->setContextMenuPolicy(Qt::CustomContextMenu);
connect(log, &QWidget::customContextMenuRequested, [=](const QPoint& pos){
QMenu* menu = log->createStandardContextMenu();
menu->addAction(clearAct);
menu->addSeparator();
menu->addActions({ nothingAct, fatalAct, errorAct, todoAct, successAct, warningAct, noticeAct, traceAct });
menu->addSeparator();
menu->addAction(stackAct);
menu->addSeparator();
menu->addAction(TTYAct);
menu->exec(mapToGlobal(pos));
});
// Check for updates every ~10 ms
QTimer *timer = new QTimer(this);
@ -152,47 +141,47 @@ void log_frame::SetLogLevel(logs::level lev)
case logs::level::always:
case logs::level::fatal:
{
fatalAct->trigger();
m_fatalAct->trigger();
break;
}
case logs::level::error:
{
errorAct->trigger();
m_errorAct->trigger();
break;
}
case logs::level::todo:
{
todoAct->trigger();
m_todoAct->trigger();
break;
}
case logs::level::success:
{
successAct->trigger();
m_successAct->trigger();
break;
}
case logs::level::warning:
{
warningAct->trigger();
m_warningAct->trigger();
break;
}
case logs::level::notice:
{
noticeAct->trigger();
m_noticeAct->trigger();
break;
}
case logs::level::trace:
{
traceAct->trigger();
m_traceAct->trigger();
break;
}
default:
warningAct->trigger();
m_warningAct->trigger();
}
}
void log_frame::SetTTYLogging(bool val)
{
TTYAct->setChecked(val);
m_TTYAct->setChecked(val);
}
void log_frame::CreateAndConnectActions()
@ -212,42 +201,57 @@ void log_frame::CreateAndConnectActions()
});
};
clearAct = new QAction(tr("Clear"), this);
connect(clearAct, &QAction::triggered, log, &QTextEdit::clear);
m_clearAct = new QAction(tr("Clear"), this);
connect(m_clearAct, &QAction::triggered, m_log, &QTextEdit::clear);
// Action groups make these actions mutually exclusive.
logLevels = new QActionGroup(this);
nothingAct = new QAction(tr("Nothing"), logLevels);
nothingAct->setVisible(false);
fatalAct = new QAction(tr("Fatal"), logLevels);
errorAct = new QAction(tr("Error"), logLevels);
todoAct = new QAction(tr("Todo"), logLevels);
successAct = new QAction(tr("Success"), logLevels);
warningAct = new QAction(tr("Warning"), logLevels);
noticeAct = new QAction(tr("Notice"), logLevels);
traceAct = new QAction(tr("Trace"), logLevels);
m_logLevels = new QActionGroup(this);
m_nothingAct = new QAction(tr("Nothing"), m_logLevels);
m_nothingAct->setVisible(false);
m_fatalAct = new QAction(tr("Fatal"), m_logLevels);
m_errorAct = new QAction(tr("Error"), m_logLevels);
m_todoAct = new QAction(tr("Todo"), m_logLevels);
m_successAct = new QAction(tr("Success"), m_logLevels);
m_warningAct = new QAction(tr("Warning"), m_logLevels);
m_noticeAct = new QAction(tr("Notice"), m_logLevels);
m_traceAct = new QAction(tr("Trace"), m_logLevels);
stackAct = new QAction(tr("Stack Mode"), this);
stackAct->setCheckable(true);
connect(stackAct, &QAction::toggled, xgui_settings.get(), [=](bool checked) {
m_stackAct = new QAction(tr("Stack Mode"), this);
m_stackAct->setCheckable(true);
connect(m_stackAct, &QAction::toggled, xgui_settings.get(), [=](bool checked)
{
xgui_settings->SetValue(GUI::l_stack, checked);
m_stack_log = checked;
});
TTYAct = new QAction(tr("TTY"), this);
TTYAct->setCheckable(true);
connect(TTYAct, &QAction::triggered, xgui_settings.get(), [=](bool checked){
m_TTYAct = new QAction(tr("TTY"), this);
m_TTYAct->setCheckable(true);
connect(m_TTYAct, &QAction::triggered, xgui_settings.get(), [=](bool checked)
{
xgui_settings->SetValue(GUI::l_tty, checked);
});
l_initAct(nothingAct, logs::level::fatal);
l_initAct(fatalAct, logs::level::fatal);
l_initAct(errorAct, logs::level::error);
l_initAct(todoAct, logs::level::todo);
l_initAct(successAct, logs::level::success);
l_initAct(warningAct, logs::level::warning);
l_initAct(noticeAct, logs::level::notice);
l_initAct(traceAct, logs::level::trace);
l_initAct(m_nothingAct, logs::level::fatal);
l_initAct(m_fatalAct, logs::level::fatal);
l_initAct(m_errorAct, logs::level::error);
l_initAct(m_todoAct, logs::level::todo);
l_initAct(m_successAct, logs::level::success);
l_initAct(m_warningAct, logs::level::warning);
l_initAct(m_noticeAct, logs::level::notice);
l_initAct(m_traceAct, logs::level::trace);
connect(m_log, &QWidget::customContextMenuRequested, [=](const QPoint& pos)
{
QMenu* menu = m_log->createStandardContextMenu();
menu->addAction(m_clearAct);
menu->addSeparator();
menu->addActions({ m_nothingAct, m_fatalAct, m_errorAct, m_todoAct, m_successAct, m_warningAct, m_noticeAct, m_traceAct });
menu->addSeparator();
menu->addAction(m_stackAct);
menu->addSeparator();
menu->addAction(m_TTYAct);
menu->exec(mapToGlobal(pos));
});
LoadSettings();
}
@ -257,7 +261,7 @@ void log_frame::LoadSettings()
SetLogLevel(xgui_settings->GetLogLevel());
SetTTYLogging(xgui_settings->GetValue(GUI::l_tty).toBool());
m_stack_log = xgui_settings->GetValue(GUI::l_stack).toBool();
stackAct->setChecked(m_stack_log);
m_stackAct->setChecked(m_stack_log);
}
void log_frame::UpdateUI()
@ -291,15 +295,15 @@ void log_frame::UpdateUI()
// Check TTY logs
while (const u64 size = std::min<u64>(buf.size(), tty_file.size() - tty_file.pos()))
while (const u64 size = std::min<u64>(buf.size(), m_tty_file.size() - m_tty_file.pos()))
{
QString text = get_utf8(tty_file, size);
QString text = get_utf8(m_tty_file, size);
// Hackily used the state of the check.. be better if I actually stored this value.
if (TTYAct->isChecked())
if (m_TTYAct->isChecked())
{
text.chop(1); // remove newline since Qt automatically adds a newline.
tty->append(text);
m_tty->append(text);
}
// Limit processing time
if (steady_clock::now() >= start + 4ms || text.isEmpty()) break;
@ -331,17 +335,17 @@ void log_frame::UpdateUI()
text += qstr(packet->msg);
// save old log state
QScrollBar *sb = log->verticalScrollBar();
QScrollBar *sb = m_log->verticalScrollBar();
bool isMax = sb->value() == sb->maximum();
int sb_pos = sb->value();
int sel_pos = log->textCursor().position();
int sel_start = log->textCursor().selectionStart();
int sel_end = log->textCursor().selectionEnd();
int sel_pos = m_log->textCursor().position();
int sel_start = m_log->textCursor().selectionStart();
int sel_end = m_log->textCursor().selectionEnd();
// clear selection or else it will get colorized as well
QTextCursor c = log->textCursor();
QTextCursor c = m_log->textCursor();
c.clearSelection();
log->setTextCursor(c);
m_log->setTextCursor(c);
// remove the new line because Qt's append adds a new line already.
text.chop(1);
@ -356,11 +360,11 @@ void log_frame::UpdateUI()
{
m_log_counter++;
suffix = QString(" x%1").arg(m_log_counter);
log->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor);
log->moveCursor(QTextCursor::StartOfLine, QTextCursor::MoveAnchor);
log->moveCursor(QTextCursor::End, QTextCursor::KeepAnchor);
log->textCursor().removeSelectedText();
log->textCursor().deletePreviousChar();
m_log->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor);
m_log->moveCursor(QTextCursor::StartOfLine, QTextCursor::MoveAnchor);
m_log->moveCursor(QTextCursor::End, QTextCursor::KeepAnchor);
m_log->textCursor().removeSelectedText();
m_log->textCursor().deletePreviousChar();
}
else
{
@ -370,14 +374,14 @@ void log_frame::UpdateUI()
}
// add actual log message
log->setTextColor(color);
log->append(text);
m_log->setTextColor(color);
m_log->append(text);
// add counter suffix if needed
if (m_stack_log && isSame)
{
log->setTextColor(Qt::white);
log->insertPlainText(suffix);
m_log->setTextColor(Qt::white);
m_log->insertPlainText(suffix);
}
// if we mark text from right to left we need to swap sides (start is always smaller than end)
@ -389,7 +393,7 @@ void log_frame::UpdateUI()
// reset old text cursor and selection
c.setPosition(sel_start);
c.setPosition(sel_end, QTextCursor::KeepAnchor);
log->setTextCursor(c);
m_log->setTextCursor(c);
// set scrollbar to max means auto-scroll
sb->setValue(isMax ? sb->maximum() : sb_pos);

View File

@ -35,30 +35,29 @@ private:
void CreateAndConnectActions();
QTabWidget *tabWidget;
QTextEdit *log;
QTextEdit *tty;
QTextEdit *m_log;
QTextEdit *m_tty;
QString m_old_text;
ullong m_log_counter;
bool m_stack_log;
fs::file tty_file;
fs::file m_tty_file;
QAction* clearAct;
QAction* m_clearAct;
QActionGroup* logLevels;
QAction* nothingAct;
QAction* fatalAct;
QAction* errorAct;
QAction* todoAct;
QAction* successAct;
QAction* warningAct;
QAction* noticeAct;
QAction* traceAct;
QActionGroup* m_logLevels;
QAction* m_nothingAct;
QAction* m_fatalAct;
QAction* m_errorAct;
QAction* m_todoAct;
QAction* m_successAct;
QAction* m_warningAct;
QAction* m_noticeAct;
QAction* m_traceAct;
QAction* stackAct;
QAction* m_stackAct;
QAction* TTYAct;
QAction* m_TTYAct;
std::shared_ptr<gui_settings> xgui_settings;
};

View File

@ -15,18 +15,14 @@ rsx_debugger::rsx_debugger(QWidget* parent)
, m_addr(0x0)
, m_cur_texture(0)
, exit(false)
, palette_bg()
{
setWindowTitle(tr("RSX Debugger"));
setAttribute(Qt::WA_DeleteOnClose);
//Fonts and Colors
pSize = 8;
mono = QFontDatabase::systemFont(QFontDatabase::FixedFont);
mono.setPointSize(pSize);
fontMetrics = new QFontMetrics(mono);
QFont mono = QFontDatabase::systemFont(QFontDatabase::FixedFont);
mono.setPointSize(8);
palette_bg.setColor(backgroundRole(), QColor(240, 240, 240));
QHBoxLayout* hbox_panel = new QHBoxLayout();
//Tools
@ -39,12 +35,12 @@ rsx_debugger::rsx_debugger(QWidget* parent)
// Controls: Address
QGroupBox* gb_controls_addr = new QGroupBox(tr("Address:"), this);
QHBoxLayout* hbox_controls_addr = new QHBoxLayout();
t_addr = new QLineEdit();
t_addr->setFont(mono);
t_addr->setPlaceholderText("00000000");
t_addr->setMaxLength(8);
t_addr->setMaximumWidth(65);
hbox_controls_addr->addWidget(t_addr);
m_addr_line = new QLineEdit();
m_addr_line->setFont(mono);
m_addr_line->setPlaceholderText("00000000");
m_addr_line->setMaxLength(8);
m_addr_line->setMaximumWidth(65);
hbox_controls_addr->addWidget(m_addr_line);
gb_controls_addr->setLayout(hbox_controls_addr);
// Controls: Go to
@ -220,10 +216,10 @@ rsx_debugger::rsx_debugger(QWidget* parent)
gb_buffers_text ->setLayout(hbox_buffers_text);
//Buffers and textures
m_panel_width = 108;
m_panel_height = 108;
m_text_width = 108;
m_text_height = 108;
int m_panel_width = 108;
int m_panel_height = 108;
int m_text_width = 108;
int m_text_height = 108;
//Panels for displaying the buffers
m_buffer_colorA = new Buffer(p_buffers, false, 0);
@ -282,17 +278,22 @@ rsx_debugger::rsx_debugger(QWidget* parent)
setLayout(hbox_panel);
//Events
connect(b_goto_get, &QAbstractButton::clicked, [=](){
if (const auto render = fxm::get<GSRender>()){
connect(b_goto_get, &QAbstractButton::clicked, [=]
{
if (const auto render = fxm::get<GSRender>())
{
u32 realAddr;
if (RSXIOMem.getRealAddr(render->ctrl->get.load(), realAddr)){
if (RSXIOMem.getRealAddr(render->ctrl->get.load(), realAddr))
{
m_addr = realAddr;
UpdateInformation();
}
}
});
connect(b_goto_put, &QAbstractButton::clicked, [=](){
if (const auto render = fxm::get<GSRender>()){
connect(b_goto_put, &QAbstractButton::clicked, [=]
{
if (const auto render = fxm::get<GSRender>())
{
u32 realAddr;
if (RSXIOMem.getRealAddr(render->ctrl->put.load(), realAddr))
{
@ -301,9 +302,10 @@ rsx_debugger::rsx_debugger(QWidget* parent)
}
}
});
connect(t_addr, &QLineEdit::returnPressed, [=](){
connect(m_addr_line, &QLineEdit::returnPressed, [=]
{
bool ok;
m_addr = t_addr->text().toULong(&ok, 16);
m_addr = m_addr_line->text().toULong(&ok, 16);
UpdateInformation();
});
connect(m_list_flags, &QTableWidget::itemClicked, this, &rsx_debugger::SetFlags);
@ -318,8 +320,8 @@ rsx_debugger::rsx_debugger(QWidget* parent)
//Fill the frame
UpdateInformation();
setFixedSize(sizeHint());
setFocusProxy(t_addr);
};
setFocusProxy(m_addr_line);
}
rsx_debugger::~rsx_debugger()
{
@ -399,14 +401,14 @@ void Buffer::showImage(const QImage& image)
{
if (image.isNull()) return;
m_image = image;
m_scaled = m_image.scaled(size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
m_canvas = new QLabel();
QImage scaled = m_image.scaled(size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
QLabel* m_canvas = new QLabel();
m_canvas->setFixedSize(size());
m_canvas->setPixmap(QPixmap::fromImage(m_scaled));
m_layout = new QHBoxLayout();
m_layout->setContentsMargins(0, 0, 0, 0);
m_layout->addWidget(m_canvas);
setLayout(m_layout);
m_canvas->setPixmap(QPixmap::fromImage(scaled));
QHBoxLayout* layout = new QHBoxLayout();
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(m_canvas);
setLayout(layout);
}
void Buffer::mouseDoubleClickEvent(QMouseEvent* event)
@ -643,7 +645,7 @@ void rsx_debugger::OnClickDrawCalls()
void rsx_debugger::UpdateInformation()
{
t_addr->setText(QString("%1").arg(m_addr, 8, 16, QChar('0'))); // get 8 digits in input line
m_addr_line->setText(QString("%1").arg(m_addr, 8, 16, QChar('0'))); // get 8 digits in input line
GetMemory();
GetBuffers();
GetFlags();
@ -1192,3 +1194,8 @@ QString rsx_debugger::DisAsmCommand(u32 cmd, u32 count, u32 currentAddr, u32 ioA
return qstr(disasm);
}
void rsx_debugger::SetPC(const uint pc)
{
m_addr = pc;
}

View File

@ -29,15 +29,11 @@
class Buffer : public QWidget
{
QHBoxLayout* m_layout;
QImage m_scaled;
u32 m_id;
bool m_isTex;
public:
QLabel* m_canvas;
QImage m_image;
public:
Buffer(QWidget* parent, bool isTex, u32 id = 4)
: QWidget(parent), m_isTex(isTex), m_id(id){};
void showImage(const QImage& image = QImage());
@ -52,17 +48,7 @@ class rsx_debugger : public QDialog
u32 m_addr;
u32 m_panel_width;
u32 m_panel_height;
u32 m_text_width;
u32 m_text_height;
u32 pSize;
QLineEdit* t_addr;
QPalette palette_bg;
QFont mono;
QFontMetrics* fontMetrics;
QLineEdit* m_addr_line;
u32 m_item_count;
QTableWidget* m_list_commands;
@ -103,10 +89,7 @@ public:
const char* ParseGCMEnum(u32 value, u32 type);
QString DisAsmCommand(u32 cmd, u32 count, u32 currentAddr, u32 ioAddr);
void SetPC(const uint pc) { m_addr = pc; }
private:
QSignalMapper *signalMapper;
void SetPC(const uint pc);
public Q_SLOTS:
virtual void keyPressEvent(QKeyEvent* event);