Add Application output console to processor tab
MODIFY
src/mainwindow.cpp
src/mainwindow.cpp
@@ -31,26 +31,6 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), m_ui(new Ui::Main
connect(m_ui->tabbar, &FancyTabBar::activeIndexChanged, m_ui->stackedWidget, &QStackedWidget::setCurrentIndex);
m_ui->tabbar->setActiveIndex(0);
- // Setup splitter such that consoles are always as small as possible
- auto splitterSize = m_ui->splitter->size();
- m_ui->splitter->setSizes(QList<int>() << splitterSize.height() - (m_ui->consoles->minimumHeight() - 1)
- << (m_ui->consoles->minimumHeight() + 1));
-
- /// @todo implement application output!
- /// since we dont have any way to do application output yet, disable consoles
- m_ui->consoles->hide();
- /*
- connect(m_ui->actionShow_consoles, &QAction::triggered, [=](bool state) {
- if (state) {
- m_ui->consoles->show();
- } else {
- m_ui->consoles->hide();
- };
- });
- m_ui->menuSettings->setVisible(false);
- */
- // -----------------------------------------------------------------------
-
// Setup tab pointers
m_ui->processortab->initRegWidget();
m_ui->processortab->initInstructionView();
@@ -70,10 +50,6 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), m_ui(new Ui::Main
connect(this, &MainWindow::update, m_ui->processortab, &ProcessorTab::restart);
connect(this, &MainWindow::updateMemoryTab, m_ui->memorytab, &MemoryTab::update);
connect(m_ui->stackedWidget, &QStackedWidget::currentChanged, m_ui->memorytab, &MemoryTab::update);
-
- // Connect ECALL functionality to application output log
- connect(m_ui->processortab, &ProcessorTab::appendToLog,
- [this](QString string) { m_ui->applicationConsole->appendPlainText(string + '\n'); });
}
MainWindow::~MainWindow() {

MODIFY
src/mainwindow.ui
src/mainwindow.ui
<widget class="MemoryTab" name="memorytab"/>
<widget class="CacheTab" name="cachetab"/>
</widget>
- <widget class="QTabWidget" name="consoles">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="tab_5">
- <attribute name="title">
- <string>Application output</string>
- </attribute>
- <layout class="QGridLayout" name="gridLayout_6">
- <item row="0" column="0">
- <widget class="QPlainTextEdit" name="applicationConsole">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="readOnly">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
</widget>
</item>
</layout>

MODIFY
src/processortab.cpp
src/processortab.cpp
@@ -33,6 +33,20 @@ ProcessorTab::ProcessorTab(QWidget* parent) : QWidget(parent), m_ui(new Ui::Proc
connect(this, &ProcessorTab::update, m_ui->registerContainer, &RegisterContainerWidget::update);
connect(this, &ProcessorTab::update, m_ui->pipelineWidget, &PipelineWidget::update);
+
+ // Connect ECALL functionality to application output log
+ connect(this, &ProcessorTab::appendToLog,
+ [this](QString string) { m_ui->console->insertPlainText(string); });
+
+ // Setup splitter such that consoles are always as small as possible
+ m_ui->pipelinesplitter->setStretchFactor(0, 2);
+
+ const auto splitterSize = m_ui->pipelinesplitter->size();
+ m_ui->pipelinesplitter->setSizes(QList<int>() << splitterSize.height() - (m_ui->consolesTab->minimumHeight()-1)
+ << (m_ui->consolesTab->minimumHeight() + 1));
+ m_ui->consolesTab->removeTab(1);
+
+
// Initially, no file is loaded, disable run, step and reset buttons
m_ui->reset->setEnabled(false);
m_ui->step->setEnabled(false);

MODIFY
src/processortab.ui
src/processortab.ui
<property name="windowTitle">
<string>Form</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1">
- <item>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
</layout>
</widget>
</item>
- <item>
+ <item row="1" column="0">
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<property name="childrenCollapsible">
<bool>false</bool>
</property>
- <widget class="PipelineWidget" name="pipelineWidget">
+ <widget class="QWidget" name="layoutWidget">
+ <layout class="QVBoxLayout" name="verticalLayout" stretch="0">
+ <item>
+ <widget class="QSplitter" name="pipelinesplitter">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <widget class="PipelineWidget" name="pipelineWidget"/>
+ <widget class="QTabWidget" name="consolesTab">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tab_5">
+ <attribute name="title">
+ <string>Application output</string>
+ </attribute>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <widget class="QPlainTextEdit" name="console">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>1</horstretch>
+ <horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
- <widget class="QWidget" name="layoutWidget">
- <layout class="QVBoxLayout" name="verticalLayout" stretch="0,0">
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_6">
+ <attribute name="title">
+ <string>Tab 2</string>
+ </attribute>
+ </widget>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="verticalLayoutWidget">
+ <layout class="QVBoxLayout" name="verticalLayout_4" stretch="1,1">
<item>
<widget class="RegisterContainerWidget" name="registerContainer" native="true">
<property name="minimumSize">
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
+ <property name="minimumSize">
+ <size>
+ <width>250</width>
+ <height>0</height>
+ </size>
+ </property>
<property name="title">
<string>Instruction memory</string>
</property>
<item row="0" column="0">
<widget class="QTableView" name="instructionView">
<property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
+ <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>

Add Application output console to processor tab