Make console printing go through SystemIO
MODIFY
src/consolewidget.cpp
src/consolewidget.cpp
@@ -18,8 +18,12 @@ ConsoleWidget::ConsoleWidget(QWidget* parent) : QWidget(parent), m_ui(new Ui::Co
m_ui->clearConsoleButton->setIcon(QIcon(":/icons/clear.svg"));
m_ui->clearConsoleButton->setToolTip("Clear console");
- // Send input data from the console to the SystemIO stdin stream
+ // Send input data from the console to the SystemIO stdin stream.
connect(m_ui->console, &Console::sendData, &SystemIO::get(), &SystemIO::putStdInData);
+
+ // Print output data from SystemIO in the console.
+ connect(&SystemIO::get(), &SystemIO::doPrint, m_ui->console,
+ [&](auto text) { m_ui->console->putData(text.toUtf8()); });
}
ConsoleWidget::~ConsoleWidget() {

MODIFY
src/edittab.cpp
src/edittab.cpp
@@ -55,6 +55,8 @@ EditTab::EditTab(QToolBar* toolbar, QWidget* parent) : RipesTab(toolbar, parent)
[=](const QVariant& val) { m_ui->registers->setVisible(val.toBool()); });
RipesSettings::getObserver(RIPES_SETTING_EDITORREGS)->trigger();
+ RipesSettings::getObserver(RIPES_SETTING_EDITORREGS)->trigger();
+
connect(m_ui->enableEditor, &QPushButton::clicked, this, &EditTab::enableAssemblyInput);
connect(m_ui->codeEditor, &CodeEditor::timedTextChanged, this, &EditTab::sourceCodeChanged);

MODIFY
src/mainwindow.cpp
src/mainwindow.cpp
@@ -92,12 +92,10 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), m_ui(new Ui::Main
connect(m_ui->tabbar, &FancyTabBar::activeIndexChanged, this, &MainWindow::tabChanged);
connect(m_ui->tabbar, &FancyTabBar::activeIndexChanged, m_stackedTabs, &QStackedWidget::setCurrentIndex);
connect(m_ui->tabbar, &FancyTabBar::activeIndexChanged, editTab, &EditTab::updateProgramViewerHighlighting);
-
setupMenus();
// setup and connect widgets
connect(editTab, &EditTab::editorStateChanged, [=] { RipesSettings::setValue(RIPES_SETTING_HAS_SAVEFILE, false); });
- connect(&SystemIO::get(), &SystemIO::doPrint, processorTab, &ProcessorTab::printToLog);
// Setup status bar
setupStatusBar();

MODIFY
src/processortab.cpp
src/processortab.cpp
#include "registercontainerwidget.h"
#include "registermodel.h"
#include "ripessettings.h"
+#include "syscall/systemio.h"
#include "VSRTL/graphics/vsrtl_widget.h"
@@ -132,10 +133,6 @@ ProcessorTab::ProcessorTab(QToolBar* controlToolbar, QToolBar* additionalToolbar
enableSimulatorControls();
}
-void ProcessorTab::printToLog(const QString& text) {
- m_ui->console->putData(text.toUtf8());
-}
-
void ProcessorTab::loadLayout(const Layout& layout) {
if (layout.name.isEmpty() || layout.file.isEmpty())
return; // Not a valid layout
@@ -449,7 +446,7 @@ void ProcessorTab::updateInstructionLabels() {
void ProcessorTab::reset() {
m_autoClockAction->setChecked(false);
enableSimulatorControls();
- printToLog("\n");
+ SystemIO::printString("\n");
}
void ProcessorTab::setInstructionViewCenterAddr(AInt address) {

MODIFY
src/processortab.h
src/processortab.h
@@ -41,7 +41,6 @@ public slots:
void restart();
void reset();
void reverse();
- void printToLog(const QString&);
void processorFinished();
void runFinished();
void updateStatistics();

Make console printing go through SystemIO