Make console a separate widget
ADD
src/consolewidget.cpp
+#include "consolewidget.h"
+#include "ui_consolewidget.h"
+
+#include "console.h"
+#include "fonts.h"
+#include "ripessettings.h"
+#include "syscall/systemio.h"
+
+#include <QPushButton>
+#include <QScrollBar>
+
+namespace Ripes {
+
+ConsoleWidget::ConsoleWidget(QWidget* parent) : QWidget(parent), m_ui(new Ui::ConsoleWidget) {
+ m_ui->setupUi(this);
+
+ connect(m_ui->clearConsoleButton, &QPushButton::clicked, m_ui->console, &Console::clearConsole);
+ 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
+ connect(m_ui->console, &Console::sendData, &SystemIO::get(), &SystemIO::putStdInData);
+}
+
+ConsoleWidget::~ConsoleWidget() {
+ delete m_ui;
+}
+
+void ConsoleWidget::putData(const QByteArray& d) {
+ m_ui->console->putData(d);
+}
+
+void ConsoleWidget::clearConsole() {
+ m_ui->console->clearConsole();
+}
+
+} // namespace Ripes

ADD
src/consolewidget.h
+#pragma once
+
+#include <QWidget>
+
+namespace Ripes {
+
+namespace Ui {
+class ConsoleWidget;
+}
+
+class ConsoleWidget : public QWidget {
+ Q_OBJECT
+
+public:
+ explicit ConsoleWidget(QWidget* parent = nullptr);
+ ~ConsoleWidget();
+
+ void putData(const QByteArray& data);
+ void clearConsole();
+
+private:
+ Ui::ConsoleWidget* m_ui;
+};
+
+} // namespace Ripes

ADD
src/consolewidget.ui
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Ripes::ConsoleWidget</class>
+ <widget class="QWidget" name="Ripes::ConsoleWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item row="0" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Console</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QToolButton" name="clearConsoleButton">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="Console" name="console">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>Console</class>
+ <extends>QPlainTextEdit</extends>
+ <header>console.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>

MODIFY
src/processortab.cpp
src/processortab.cpp
#include <QSpinBox>
#include <QTemporaryFile>
+#include "consolewidget.h"
#include "instructionmodel.h"
#include "pipelinediagrammodel.h"
#include "pipelinediagramwidget.h"
#include "registercontainerwidget.h"
#include "registermodel.h"
#include "ripessettings.h"
-#include "syscall/systemio.h"
#include "VSRTL/graphics/vsrtl_widget.h"
@@ -106,10 +106,6 @@ ProcessorTab::ProcessorTab(QToolBar* controlToolbar, QToolBar* additionalToolbar
connect(RipesSettings::getObserver(RIPES_SETTING_UIUPDATEPS), &SettingObserver::modified,
[=] { m_statUpdateTimer->setInterval(1000.0 / RipesSettings::value(RIPES_SETTING_UIUPDATEPS).toUInt()); });
- connect(m_ui->clearConsoleButton, &QPushButton::clicked, m_ui->console, &Console::clearConsole);
- m_ui->clearConsoleButton->setIcon(QIcon(":/icons/clear.svg"));
- m_ui->clearConsoleButton->setToolTip("Clear console");
-
// Connect changes in VSRTL reversible stack size to checking whether the simulator is reversible
connect(RipesSettings::getObserver(RIPES_SETTING_REWINDSTACKSIZE), &SettingObserver::modified,
[=](const auto&) { m_reverseAction->setEnabled(m_vsrtlWidget->isReversible()); });
@@ -120,9 +116,6 @@ ProcessorTab::ProcessorTab(QToolBar* controlToolbar, QToolBar* additionalToolbar
connect(ProcessorHandler::get(), &ProcessorHandler::runFinished, this, &ProcessorTab::runFinished);
connect(ProcessorHandler::get(), &ProcessorHandler::stopping, this, &ProcessorTab::pause);
- // Send input data from the console to the SystemIO stdin stream
- connect(m_ui->console, &Console::sendData, &SystemIO::get(), &SystemIO::putStdInData);
-
// Make processor view stretch wrt. consoles
m_ui->pipelinesplitter->setStretchFactor(0, 1);
m_ui->pipelinesplitter->setStretchFactor(1, 0);

MODIFY
src/processortab.ui
src/processortab.ui
<widget class="QWidget" name="horizontalLayoutWidget_2">
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0">
<item>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>Console</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QToolButton" name="clearConsoleButton">
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="Console" name="console">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- </widget>
- </item>
- </layout>
+ <widget class="ConsoleWidget" name="console" native="true"/>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<container>1</container>
</customwidget>
<customwidget>
- <class>Console</class>
- <extends>QPlainTextEdit</extends>
- <header>console.h</header>
+ <class>ConsoleWidget</class>
+ <extends>QWidget</extends>
+ <header>consolewidget.h</header>
+ <container>1</container>
</customwidget>
</customwidgets>
<resources/>

Make console a separate widget