mirror of https://github.com/mgba-emu/mgba.git
Qt: Rename REPL to Console
This commit is contained in:
parent
5406130432
commit
28a64fcbb8
2
CHANGES
2
CHANGES
|
@ -4,7 +4,7 @@ Features:
|
|||
- GBA: Better cheat type autodetection
|
||||
- GB: Tile viewer
|
||||
- Sprite viewer
|
||||
- Debugging REPL
|
||||
- Debugging console
|
||||
Bugfixes:
|
||||
- LR35902: Fix core never exiting with certain event patterns
|
||||
- GB Timer: Improve DIV reset behavior
|
||||
|
|
|
@ -118,7 +118,7 @@ set(UI_FILES
|
|||
ArchiveInspector.ui
|
||||
AssetTile.ui
|
||||
CheatsView.ui
|
||||
DebuggerREPL.ui
|
||||
DebuggerConsole.ui
|
||||
GIFView.ui
|
||||
IOViewer.ui
|
||||
LoadSaveState.ui
|
||||
|
@ -181,8 +181,8 @@ endif()
|
|||
if(USE_DEBUGGERS)
|
||||
list(APPEND SOURCE_FILES
|
||||
DebuggerController.cpp
|
||||
DebuggerREPL.cpp
|
||||
DebuggerREPLController.cpp)
|
||||
DebuggerConsole.cpp
|
||||
DebuggerConsoleController.cpp)
|
||||
endif()
|
||||
|
||||
if(USE_GDB_STUB)
|
||||
|
|
|
@ -3,17 +3,17 @@
|
|||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#include "DebuggerREPL.h"
|
||||
#include "DebuggerConsole.h"
|
||||
|
||||
#include "DebuggerREPLController.h"
|
||||
#include "DebuggerConsoleController.h"
|
||||
|
||||
#include <QScrollBar>
|
||||
|
||||
using namespace QGBA;
|
||||
|
||||
DebuggerREPL::DebuggerREPL(DebuggerREPLController* controller, QWidget* parent)
|
||||
DebuggerConsole::DebuggerConsole(DebuggerConsoleController* controller, QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, m_replController(controller)
|
||||
, m_consoleController(controller)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
|
||||
|
@ -24,19 +24,19 @@ DebuggerREPL::DebuggerREPL(DebuggerREPLController* controller, QWidget* parent)
|
|||
controller->attach();
|
||||
}
|
||||
|
||||
void DebuggerREPL::log(const QString& line) {
|
||||
void DebuggerConsole::log(const QString& line) {
|
||||
m_ui.log->moveCursor(QTextCursor::End);
|
||||
m_ui.log->insertPlainText(line);
|
||||
m_ui.log->verticalScrollBar()->setValue(m_ui.log->verticalScrollBar()->maximum());
|
||||
}
|
||||
|
||||
void DebuggerREPL::postLine() {
|
||||
void DebuggerConsole::postLine() {
|
||||
QString line = m_ui.prompt->text();
|
||||
m_ui.prompt->clear();
|
||||
if (line.isEmpty()) {
|
||||
m_replController->enterLine(QString("\n"));
|
||||
m_consoleController->enterLine(QString("\n"));
|
||||
} else {
|
||||
log(QString("> %1\n").arg(line));
|
||||
m_replController->enterLine(line);
|
||||
m_consoleController->enterLine(line);
|
||||
}
|
||||
}
|
|
@ -3,29 +3,29 @@
|
|||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#ifndef QGBA_DEBUGGER_REPL
|
||||
#define QGBA_DEBUGGER_REPL
|
||||
#ifndef QGBA_DEBUGGER_CONSOLE
|
||||
#define QGBA_DEBUGGER_CONSOLE
|
||||
|
||||
#include "ui_DebuggerREPL.h"
|
||||
#include "ui_DebuggerConsole.h"
|
||||
|
||||
namespace QGBA {
|
||||
|
||||
class DebuggerREPLController;
|
||||
class DebuggerConsoleController;
|
||||
|
||||
class DebuggerREPL : public QWidget {
|
||||
class DebuggerConsole : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DebuggerREPL(DebuggerREPLController* controller, QWidget* parent = nullptr);
|
||||
DebuggerConsole(DebuggerConsoleController* controller, QWidget* parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void log(const QString&);
|
||||
void postLine();
|
||||
|
||||
private:
|
||||
Ui::DebuggerREPL m_ui;
|
||||
Ui::DebuggerConsole m_ui;
|
||||
|
||||
DebuggerREPLController* m_replController;
|
||||
DebuggerConsoleController* m_consoleController;
|
||||
};
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DebuggerREPL</class>
|
||||
<widget class="QWidget" name="DebuggerREPL">
|
||||
<class>DebuggerConsole</class>
|
||||
<widget class="QWidget" name="DebuggerConsole">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
|
@ -3,7 +3,7 @@
|
|||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#include "DebuggerREPLController.h"
|
||||
#include "DebuggerConsoleController.h"
|
||||
|
||||
#include "GameController.h"
|
||||
|
||||
|
@ -15,7 +15,7 @@ extern "C" {
|
|||
|
||||
using namespace QGBA;
|
||||
|
||||
DebuggerREPLController::DebuggerREPLController(GameController* controller, QObject* parent)
|
||||
DebuggerConsoleController::DebuggerConsoleController(GameController* controller, QObject* parent)
|
||||
: DebuggerController(controller, &m_cliDebugger.d, parent)
|
||||
{
|
||||
m_backend.d.printf = printf;
|
||||
|
@ -31,7 +31,7 @@ DebuggerREPLController::DebuggerREPLController(GameController* controller, QObje
|
|||
CLIDebuggerAttachBackend(&m_cliDebugger, &m_backend.d);
|
||||
}
|
||||
|
||||
void DebuggerREPLController::enterLine(const QString& line) {
|
||||
void DebuggerConsoleController::enterLine(const QString& line) {
|
||||
QMutexLocker lock(&m_mutex);
|
||||
m_lines.append(line);
|
||||
if (m_cliDebugger.d.state == DEBUGGER_RUNNING) {
|
||||
|
@ -40,33 +40,33 @@ void DebuggerREPLController::enterLine(const QString& line) {
|
|||
m_cond.wakeOne();
|
||||
}
|
||||
|
||||
void DebuggerREPLController::attachInternal() {
|
||||
void DebuggerConsoleController::attachInternal() {
|
||||
mCore* core = m_gameController->thread()->core;
|
||||
CLIDebuggerAttachSystem(&m_cliDebugger, core->cliDebuggerSystem(core));
|
||||
}
|
||||
|
||||
void DebuggerREPLController::printf(struct CLIDebuggerBackend* be, const char* fmt, ...) {
|
||||
Backend* replBe = reinterpret_cast<Backend*>(be);
|
||||
DebuggerREPLController* self = replBe->self;
|
||||
void DebuggerConsoleController::printf(struct CLIDebuggerBackend* be, const char* fmt, ...) {
|
||||
Backend* consoleBe = reinterpret_cast<Backend*>(be);
|
||||
DebuggerConsoleController* self = consoleBe->self;
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
self->log(QString().vsprintf(fmt, args));
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void DebuggerREPLController::init(struct CLIDebuggerBackend* be) {
|
||||
Backend* replBe = reinterpret_cast<Backend*>(be);
|
||||
DebuggerREPLController* self = replBe->self;
|
||||
void DebuggerConsoleController::init(struct CLIDebuggerBackend* be) {
|
||||
Backend* consoleBe = reinterpret_cast<Backend*>(be);
|
||||
DebuggerConsoleController* self = consoleBe->self;
|
||||
}
|
||||
|
||||
void DebuggerREPLController::deinit(struct CLIDebuggerBackend* be) {
|
||||
Backend* replBe = reinterpret_cast<Backend*>(be);
|
||||
DebuggerREPLController* self = replBe->self;
|
||||
void DebuggerConsoleController::deinit(struct CLIDebuggerBackend* be) {
|
||||
Backend* consoleBe = reinterpret_cast<Backend*>(be);
|
||||
DebuggerConsoleController* self = consoleBe->self;
|
||||
}
|
||||
|
||||
const char* DebuggerREPLController::readLine(struct CLIDebuggerBackend* be, size_t* len) {
|
||||
Backend* replBe = reinterpret_cast<Backend*>(be);
|
||||
DebuggerREPLController* self = replBe->self;
|
||||
const char* DebuggerConsoleController::readLine(struct CLIDebuggerBackend* be, size_t* len) {
|
||||
Backend* consoleBe = reinterpret_cast<Backend*>(be);
|
||||
DebuggerConsoleController* self = consoleBe->self;
|
||||
GameController::Interrupter interrupter(self->m_gameController, true);
|
||||
QMutexLocker lock(&self->m_mutex);
|
||||
while (self->m_lines.isEmpty()) {
|
||||
|
@ -78,24 +78,24 @@ const char* DebuggerREPLController::readLine(struct CLIDebuggerBackend* be, size
|
|||
|
||||
}
|
||||
|
||||
void DebuggerREPLController::lineAppend(struct CLIDebuggerBackend* be, const char* line) {
|
||||
Backend* replBe = reinterpret_cast<Backend*>(be);
|
||||
DebuggerREPLController* self = replBe->self;
|
||||
void DebuggerConsoleController::lineAppend(struct CLIDebuggerBackend* be, const char* line) {
|
||||
Backend* consoleBe = reinterpret_cast<Backend*>(be);
|
||||
DebuggerConsoleController* self = consoleBe->self;
|
||||
self->lineAppend(QString::fromUtf8(line));
|
||||
}
|
||||
|
||||
const char* DebuggerREPLController::historyLast(struct CLIDebuggerBackend* be, size_t* len) {
|
||||
Backend* replBe = reinterpret_cast<Backend*>(be);
|
||||
DebuggerREPLController* self = replBe->self;
|
||||
const char* DebuggerConsoleController::historyLast(struct CLIDebuggerBackend* be, size_t* len) {
|
||||
Backend* consoleBe = reinterpret_cast<Backend*>(be);
|
||||
DebuggerConsoleController* self = consoleBe->self;
|
||||
GameController::Interrupter interrupter(self->m_gameController, true);
|
||||
QMutexLocker lock(&self->m_mutex);
|
||||
self->m_last = self->m_history.last().toUtf8();
|
||||
return self->m_last.constData();
|
||||
}
|
||||
|
||||
void DebuggerREPLController::historyAppend(struct CLIDebuggerBackend* be, const char* line) {
|
||||
Backend* replBe = reinterpret_cast<Backend*>(be);
|
||||
DebuggerREPLController* self = replBe->self;
|
||||
void DebuggerConsoleController::historyAppend(struct CLIDebuggerBackend* be, const char* line) {
|
||||
Backend* consoleBe = reinterpret_cast<Backend*>(be);
|
||||
DebuggerConsoleController* self = consoleBe->self;
|
||||
GameController::Interrupter interrupter(self->m_gameController, true);
|
||||
QMutexLocker lock(&self->m_mutex);
|
||||
self->m_history.append(QString::fromUtf8(line));
|
|
@ -3,8 +3,8 @@
|
|||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#ifndef QGBA_DEBUGGER_REPL_CONTROLLER
|
||||
#define QGBA_DEBUGGER_REPL_CONTROLLER
|
||||
#ifndef QGBA_DEBUGGER_CONSOLE_CONTROLLER
|
||||
#define QGBA_DEBUGGER_CONSOLE_CONTROLLER
|
||||
|
||||
#include "DebuggerController.h"
|
||||
|
||||
|
@ -20,11 +20,11 @@ namespace QGBA {
|
|||
|
||||
class GameController;
|
||||
|
||||
class DebuggerREPLController : public DebuggerController {
|
||||
class DebuggerConsoleController : public DebuggerController {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DebuggerREPLController(GameController* controller, QObject* parent = nullptr);
|
||||
DebuggerConsoleController(GameController* controller, QObject* parent = nullptr);
|
||||
|
||||
signals:
|
||||
void log(const QString&);
|
||||
|
@ -55,7 +55,7 @@ private:
|
|||
|
||||
struct Backend {
|
||||
CLIDebuggerBackend d;
|
||||
DebuggerREPLController* self;
|
||||
DebuggerConsoleController* self;
|
||||
} m_backend;
|
||||
};
|
||||
|
|
@ -18,8 +18,8 @@
|
|||
#include "ArchiveInspector.h"
|
||||
#include "CheatsView.h"
|
||||
#include "ConfigController.h"
|
||||
#include "DebuggerREPL.h"
|
||||
#include "DebuggerREPLController.h"
|
||||
#include "DebuggerConsole.h"
|
||||
#include "DebuggerConsoleController.h"
|
||||
#include "Display.h"
|
||||
#include "GameController.h"
|
||||
#include "GBAApp.h"
|
||||
|
@ -73,7 +73,7 @@ Window::Window(ConfigController* config, int playerId, QWidget* parent)
|
|||
, m_gdbController(nullptr)
|
||||
#endif
|
||||
#ifdef USE_DEBUGGERS
|
||||
, m_repl(nullptr)
|
||||
, m_console(nullptr)
|
||||
#endif
|
||||
, m_mruMenu(nullptr)
|
||||
, m_shortcutController(new ShortcutController(this))
|
||||
|
@ -519,11 +519,11 @@ void Window::gdbOpen() {
|
|||
#endif
|
||||
|
||||
#ifdef USE_DEBUGGERS
|
||||
void Window::replOpen() {
|
||||
if (!m_repl) {
|
||||
m_repl = new DebuggerREPLController(m_controller, this);
|
||||
void Window::consoleOpen() {
|
||||
if (!m_console) {
|
||||
m_console = new DebuggerConsoleController(m_controller, this);
|
||||
}
|
||||
DebuggerREPL* window = new DebuggerREPL(m_repl);
|
||||
DebuggerConsole* window = new DebuggerConsole(m_console);
|
||||
openView(window);
|
||||
}
|
||||
#endif
|
||||
|
@ -1353,9 +1353,9 @@ void Window::setupMenu(QMenuBar* menubar) {
|
|||
toolsMenu->addSeparator();
|
||||
|
||||
#ifdef USE_DEBUGGERS
|
||||
QAction* replWindow = new QAction(tr("Open debugger REPL..."), toolsMenu);
|
||||
connect(replWindow, SIGNAL(triggered()), this, SLOT(replOpen()));
|
||||
addControlledAction(toolsMenu, replWindow, "debuggerWindow");
|
||||
QAction* consoleWindow = new QAction(tr("Open debugger console..."), toolsMenu);
|
||||
connect(consoleWindow, SIGNAL(triggered()), this, SLOT(consoleOpen()));
|
||||
addControlledAction(toolsMenu, consoleWindow, "debuggerWindow");
|
||||
#endif
|
||||
|
||||
#ifdef USE_GDB_STUB
|
||||
|
|
|
@ -26,7 +26,7 @@ struct mArguments;
|
|||
namespace QGBA {
|
||||
|
||||
class ConfigController;
|
||||
class DebuggerREPLController;
|
||||
class DebuggerConsoleController;
|
||||
class Display;
|
||||
class GameController;
|
||||
class GDBController;
|
||||
|
@ -82,7 +82,7 @@ public slots:
|
|||
void openAboutScreen();
|
||||
|
||||
#ifdef USE_DEBUGGERS
|
||||
void replOpen();
|
||||
void consoleOpen();
|
||||
#endif
|
||||
|
||||
#ifdef USE_FFMPEG
|
||||
|
@ -162,7 +162,7 @@ private:
|
|||
LogController m_log;
|
||||
LogView* m_logView;
|
||||
#ifdef USE_DEBUGGERS
|
||||
DebuggerREPLController* m_repl;
|
||||
DebuggerConsoleController* m_console;
|
||||
#endif
|
||||
LoadSaveState* m_stateWindow;
|
||||
WindowBackground* m_screenWidget;
|
||||
|
|
Loading…
Reference in New Issue