Initial commit for new cache tab
MODIFY
resources/icons/server.svg
resources/icons/server.svg
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
- viewBox="0 0 280.027 280.027" style="enable-background:new 0 0 280.027 280.027;" xml:space="preserve">
-<g>
- <path style="fill:#CCD0D2;" d="M17.502,52.505v175.017c0,28.983,54.85,52.505,122.512,52.505s122.512-23.522,122.512-52.505V52.505
- H17.502z"/>
- <path style="fill:#ADB0B2;" d="M227.522,122.512c4.839,0,8.751-3.912,8.751-8.751c0-4.83-3.912-8.751-8.751-8.751
- c-4.839,0-8.751,3.92-8.751,8.751C218.771,118.6,222.682,122.512,227.522,122.512z M227.522,166.266
- c-4.839,0-8.751,3.92-8.751,8.751c0,4.839,3.912,8.751,8.751,8.751c4.839,0,8.751-3.912,8.751-8.751
- C236.272,170.187,232.353,166.266,227.522,166.266z M227.522,227.522c-4.839,0-8.751,3.912-8.751,8.751s3.912,8.751,8.751,8.751
- c4.839,0,8.751-3.912,8.751-8.751S232.353,227.522,227.522,227.522z"/>
- <path style="fill:#B7BBBD;" d="M140.014,166.275c67.662,0,122.512-25.342,122.512-56.609c0-1.593-0.236-3.15-0.516-4.717
- c-5.198,29.053-57.782,51.893-121.996,51.893S23.225,134.011,18.018,104.949c-0.28,1.566-0.516,3.124-0.516,4.717
- C17.502,140.924,72.343,166.275,140.014,166.275z M140.014,218.098c-64.214,0-116.789-22.822-121.996-51.893
- c-0.28,1.566-0.516,3.124-0.516,4.717c0,31.249,54.85,56.609,122.512,56.609s122.512-25.342,122.512-56.609
- c0-1.601-0.236-3.15-0.516-4.717C256.82,195.249,204.236,218.098,140.014,218.098z"/>
- <path style="fill:#C2C5C7;" d="M43.754,259.935V52.505H17.502v175.017C17.502,239.756,27.355,251.01,43.754,259.935z"/>
- <g>
- <path style="fill:#B2B5B7;" d="M43.754,205.864v-9.486c-14.369-8.462-23.697-18.823-25.736-30.173
- c-0.28,1.566-0.516,3.124-0.516,4.717C17.502,184.127,27.355,196.238,43.754,205.864z M43.754,144.608v-9.477
- c-14.369-8.462-23.697-18.832-25.736-30.19c-0.28,1.575-0.516,3.133-0.516,4.725C17.502,122.871,27.355,134.982,43.754,144.608z"
- />
- </g>
- <path style="fill:#E4E7E7;" d="M140.014,0c67.662,0,122.512,23.514,122.512,52.505s-54.85,52.505-122.512,52.505
- S17.502,81.497,17.502,52.505S72.343,0,140.014,0z"/>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ viewBox="0 0 280.027 280.027"
+ style="enable-background:new 0 0 280.027 280.027;"
+ xml:space="preserve"
+ sodipodi:docname="server.svg"
+ inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"><metadata
+ id="metadata964"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
+ id="defs962" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1848"
+ inkscape:window-height="1016"
+ id="namedview960"
+ showgrid="false"
+ inkscape:zoom="1.4962842"
+ inkscape:cx="0.41338502"
+ inkscape:cy="153.04043"
+ inkscape:window-x="72"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="Layer_1" />
+<g
+ id="g927"
+ transform="matrix(0.8786228,0,0,0.8786228,18.832399,12.0298)">
+ <path
+ style="fill:#ccd0d2"
+ d="m 17.502,52.505 v 175.017 c 0,28.983 54.85,52.505 122.512,52.505 67.662,0 122.512,-23.522 122.512,-52.505 V 52.505 Z"
+ id="path913"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#adb0b2"
+ d="m 227.522,122.512 c 4.839,0 8.751,-3.912 8.751,-8.751 0,-4.83 -3.912,-8.751 -8.751,-8.751 -4.839,0 -8.751,3.92 -8.751,8.751 0,4.839 3.911,8.751 8.751,8.751 z m 0,43.754 c -4.839,0 -8.751,3.92 -8.751,8.751 0,4.839 3.912,8.751 8.751,8.751 4.839,0 8.751,-3.912 8.751,-8.751 -0.001,-4.83 -3.92,-8.751 -8.751,-8.751 z m 0,61.256 c -4.839,0 -8.751,3.912 -8.751,8.751 0,4.839 3.912,8.751 8.751,8.751 4.839,0 8.751,-3.912 8.751,-8.751 0,-4.839 -3.92,-8.751 -8.751,-8.751 z"
+ id="path915"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#b7bbbd"
+ d="m 140.014,166.275 c 67.662,0 122.512,-25.342 122.512,-56.609 0,-1.593 -0.236,-3.15 -0.516,-4.717 -5.198,29.053 -57.782,51.893 -121.996,51.893 -64.214,0 -116.789,-22.831 -121.996,-51.893 -0.28,1.566 -0.516,3.124 -0.516,4.717 0,31.258 54.841,56.609 122.512,56.609 z m 0,51.823 c -64.214,0 -116.789,-22.822 -121.996,-51.893 -0.28,1.566 -0.516,3.124 -0.516,4.717 0,31.249 54.85,56.609 122.512,56.609 67.662,0 122.512,-25.342 122.512,-56.609 0,-1.601 -0.236,-3.15 -0.516,-4.717 -5.19,29.044 -57.774,51.893 -121.996,51.893 z"
+ id="path917"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#c2c5c7"
+ d="M 43.754,259.935 V 52.505 H 17.502 v 175.017 c 0,12.234 9.853,23.488 26.252,32.413 z"
+ id="path919"
+ inkscape:connector-curvature="0" />
+ <g
+ id="g923">
+ <path
+ style="fill:#b2b5b7"
+ d="m 43.754,205.864 v -9.486 c -14.369,-8.462 -23.697,-18.823 -25.736,-30.173 -0.28,1.566 -0.516,3.124 -0.516,4.717 0,13.205 9.853,25.316 26.252,34.942 z m 0,-61.256 v -9.477 c -14.369,-8.462 -23.697,-18.832 -25.736,-30.19 -0.28,1.575 -0.516,3.133 -0.516,4.725 0,13.205 9.853,25.316 26.252,34.942 z"
+ id="path921"
+ inkscape:connector-curvature="0" />
+ </g>
+ <path
+ style="fill:#e4e7e7"
+ d="m 140.014,0 c 67.662,0 122.512,23.514 122.512,52.505 0,28.991 -54.85,52.505 -122.512,52.505 C 72.352,105.01 17.502,81.497 17.502,52.505 17.502,23.513 72.343,0 140.014,0 Z"
+ id="path925"
+ inkscape:connector-curvature="0" />
+</g>
+<g
+ id="g929"
+ transform="matrix(0.92908296,0,0,0.92908296,13.27099,10.024833)">
+</g>
+<g
+ id="g931"
+ transform="matrix(0.92908296,0,0,0.92908296,13.27099,10.024833)">
+</g>
+<g
+ id="g933"
+ transform="matrix(0.92908296,0,0,0.92908296,13.27099,10.024833)">
+</g>
+<g
+ id="g935"
+ transform="matrix(0.92908296,0,0,0.92908296,13.27099,10.024833)">
+</g>
+<g
+ id="g937"
+ transform="matrix(0.92908296,0,0,0.92908296,13.27099,10.024833)">
+</g>
+<g
+ id="g939"
+ transform="matrix(0.92908296,0,0,0.92908296,13.27099,10.024833)">
+</g>
+<g
+ id="g941"
+ transform="matrix(0.92908296,0,0,0.92908296,13.27099,10.024833)">
+</g>
+<g
+ id="g943"
+ transform="matrix(0.92908296,0,0,0.92908296,13.27099,10.024833)">
+</g>
+<g
+ id="g945"
+ transform="matrix(0.92908296,0,0,0.92908296,13.27099,10.024833)">
+</g>
+<g
+ id="g947"
+ transform="matrix(0.92908296,0,0,0.92908296,13.27099,10.024833)">
+</g>
+<g
+ id="g949"
+ transform="matrix(0.92908296,0,0,0.92908296,13.27099,10.024833)">
+</g>
+<g
+ id="g951"
+ transform="matrix(0.92908296,0,0,0.92908296,13.27099,10.024833)">
+</g>
+<g
+ id="g953"
+ transform="matrix(0.92908296,0,0,0.92908296,13.27099,10.024833)">
+</g>
+<g
+ id="g955"
+ transform="matrix(0.92908296,0,0,0.92908296,13.27099,10.024833)">
+</g>
+<g
+ id="g957"
+ transform="matrix(0.92908296,0,0,0.92908296,13.27099,10.024833)">
</g>
</svg>
\ No newline at end of file

MODIFY
src/cachesim/cacheview.cpp
src/cachesim/cacheview.cpp
@@ -31,6 +31,10 @@ void CacheView::mousePressEvent(QMouseEvent* event) {
QGraphicsView::mousePressEvent(event);
}
+void CacheView::fitScene() {
+ fitInView(scene()->sceneRect(), Qt::KeepAspectRatio);
+}
+
void CacheView::wheelEvent(QWheelEvent* e) {
if (e->modifiers() & Qt::ControlModifier) {
if (e->angleDelta().y() > 0)

MODIFY
src/cachesim/cacheview.h
src/cachesim/cacheview.h
@@ -8,6 +8,7 @@ class CacheView : public QGraphicsView {
Q_OBJECT
public:
CacheView(QWidget* parent);
+ void fitScene();
protected:
void wheelEvent(QWheelEvent*) override;

MODIFY
src/cachesim/cachewidget.cpp
src/cachesim/cachewidget.cpp
#include <QGraphicsView>
#include "cachegraphic.h"
+#include "cacheview.h"
+#include "ripessettings.h"
namespace Ripes {
CacheWidget::CacheWidget(QWidget* parent) : QWidget(parent), m_ui(new Ui::CacheWidget) {
m_ui->setupUi(this);
- auto* scene = new QGraphicsScene(this);
+ m_scene = std::make_unique<QGraphicsScene>(this);
m_cacheSim = std::make_shared<CacheSim>(this);
m_ui->cacheConfig->setCache(m_cacheSim);
auto* cacheGraphic = new CacheGraphic(*m_cacheSim);
- m_ui->cacheView->setScene(scene);
- scene->addItem(cacheGraphic);
+ m_scene->addItem(cacheGraphic);
+ connect(m_cacheSim.get(), &CacheSim::configurationChanged, [=] {
+ RipesSettings::getObserver(RIPES_GLOBALSIGNAL_REQRESET)->trigger();
- connect(m_ui->cacheView, &CacheView::cacheAddressSelected,
- [=](uint32_t address) { emit cacheAddressSelected(address); });
-
- connect(m_cacheSim.get(), &CacheSim::configurationChanged, [=] { emit configurationChanged(); });
+ auto cacheViews = m_scene->views();
+ if (cacheViews.size() > 0) {
+ static_cast<CacheView*>(cacheViews.at(0))->fitScene();
+ }
+ });
}
void CacheWidget::setNextLevelCache(std::shared_ptr<CacheSim>& cache) {

MODIFY
src/cachesim/cachewidget.h
src/cachesim/cachewidget.h
#include "cachesim.h"
#include "processors/RISC-V/rv_memory.h"
+QT_FORWARD_DECLARE_CLASS(QGraphicsScene)
+
using RVMemory = vsrtl::core::RVMemory<32, 32>;
namespace Ripes {
@@ -24,14 +26,12 @@ public:
void setNextLevelCache(std::shared_ptr<CacheSim>& cache);
std::shared_ptr<CacheSim>& getCacheSim() { return m_cacheSim; }
-
-signals:
- void cacheAddressSelected(uint32_t);
- void configurationChanged();
+ QGraphicsScene* getScene() { return m_scene.get(); }
private:
Ui::CacheWidget* m_ui;
std::shared_ptr<CacheSim> m_cacheSim;
+ std::unique_ptr<QGraphicsScene> m_scene;
};
} // namespace Ripes

MODIFY
src/cachesim/cachewidget.ui
src/cachesim/cachewidget.ui
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
- <layout class="QVBoxLayout" name="verticalLayout" stretch="0,1">
+ <layout class="QVBoxLayout" name="verticalLayout" stretch="0">
<item>
<widget class="CacheConfigWidget" name="cacheConfig" native="true">
<property name="sizePolicy">
</property>
</widget>
</item>
- <item>
- <widget class="CacheView" name="cacheView">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
</layout>
</item>
</layout>
<header>cachesim/cacheconfigwidget.h</header>
<container>1</container>
</customwidget>
- <customwidget>
- <class>CacheView</class>
- <extends>QGraphicsView</extends>
- <header>cachesim/cacheview.h</header>
- </customwidget>
</customwidgets>
<resources/>
<connections/>

ADD
src/cachetab.cpp
+#include "cachetab.h"
+#include "ui_cachetab.h"
+
+#include "cachesim/cacheview.h"
+#include "cachesim/cachewidget.h"
+
+namespace Ripes {
+
+CacheTab::CacheTab(QToolBar* toolbar, QWidget* parent) : RipesTab(toolbar, parent), m_ui(new Ui::CacheTab) {
+ m_ui->setupUi(this);
+
+ connect(m_ui->cacheView, &CacheView::cacheAddressSelected, this, &CacheTab::focusAddressChanged);
+
+ connect(m_ui->cacheTabWidget, &CacheTabWidget::cacheFocusChanged, [=](CacheWidget* widget) {
+ m_ui->cacheView->setScene(widget->getScene());
+ m_ui->cacheView->fitScene();
+ });
+
+ // CacheTabWidget has a tendency to expand, but we'd like to minimize its size. Stretch the CacheView.
+ m_ui->splitter->setStretchFactor(1, 10);
+}
+
+CacheTab::~CacheTab() {
+ delete m_ui;
+}
+
+} // namespace Ripes

ADD
src/cachetab.h
+#pragma once
+
+#include <QWidget>
+#include "ripestab.h"
+
+namespace Ripes {
+
+namespace Ui {
+class CacheTab;
+}
+
+class CacheTab : public RipesTab {
+ Q_OBJECT
+
+public:
+ explicit CacheTab(QToolBar* toolbar, QWidget* parent = nullptr);
+ ~CacheTab() override;
+
+signals:
+ void focusAddressChanged(uint32_t address);
+
+private:
+ Ui::CacheTab* m_ui;
+};
+
+} // namespace Ripes

ADD
src/cachetab.ui
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Ripes::CacheTab</class>
+ <widget class="QWidget" name="Ripes::CacheTab">
+ <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">
+ <item row="0" column="0">
+ <widget class="QSplitter" name="splitter">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="childrenCollapsible">
+ <bool>false</bool>
+ </property>
+ <widget class="QWidget" name="verticalLayoutWidget">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QGridLayout" name="gridLayout_2"/>
+ </item>
+ <item>
+ <widget class="CacheTabWidget" name="cacheTabWidget" native="true"/>
+ </item>
+ </layout>
+ </widget>
+ <widget class="CacheView" name="cacheView"/>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>CacheTabWidget</class>
+ <extends>QWidget</extends>
+ <header>cachetabwidget.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
+ <class>CacheView</class>
+ <extends>QGraphicsView</extends>
+ <header>cachesim/cacheview.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>

MODIFY
src/cachetabwidget.cpp
src/cachetabwidget.cpp
@@ -52,18 +52,15 @@ CacheTabWidget::CacheTabWidget(QWidget* parent) : QWidget(parent), m_ui(new Ui::
m_ui->tabWidget->tabBar()->installEventFilter(new ScrollEventFilter(this));
}
-void CacheTabWidget::connectCacheWidget(CacheWidget* w) {
- connect(w, &CacheWidget::cacheAddressSelected, this, &CacheTabWidget::focusAddressChanged);
-}
-
void CacheTabWidget::handleTabCloseRequest(int index) {
// Only the last-level cache should be closeable
Q_ASSERT(index == m_addTabIdx - 1 && index > InstrCache);
- m_ui->tabWidget->setCurrentIndex(index - 1);
+ const int newIndex = index - 1;
+ m_ui->tabWidget->setCurrentIndex(newIndex);
m_ui->tabWidget->removeTab(index);
m_addTabIdx = m_ui->tabWidget->count() - 1;
- if (index - 1 > InstrCache) {
- m_ui->tabWidget->tabBar()->tabButton(index - 1, QTabBar::RightSide)->resize(m_defaultTabButtonSize);
+ if (newIndex > InstrCache) {
+ m_ui->tabWidget->tabBar()->tabButton(newIndex, QTabBar::RightSide)->resize(m_defaultTabButtonSize);
}
m_nextCacheLevel--;
m_ui->tabWidget->setTabText(m_addTabIdx, QString("L%1 Cache").arg(m_nextCacheLevel));
@@ -73,7 +70,6 @@ void CacheTabWidget::handleTabIndexChanged(int index) {
if (index == m_addTabIdx) {
// Add new level of cache
auto* cw = new CacheWidget(this);
- connectCacheWidget(cw);
m_ui->tabWidget->insertTab(m_addTabIdx, cw, QString("L%1 Cache").arg(m_nextCacheLevel));
m_nextCacheLevel++;
@@ -84,6 +80,15 @@ void CacheTabWidget::handleTabIndexChanged(int index) {
m_ui->tabWidget->setCurrentIndex(index);
m_ui->tabWidget->setTabText(m_addTabIdx, QString("L%1 Cache").arg(m_nextCacheLevel));
}
+
+ // Locate cacheWidget for the current index
+ for (const auto& ch : m_ui->tabWidget->widget(index)->children()) {
+ auto* cw = dynamic_cast<CacheWidget*>(ch);
+ if (cw) {
+ emit cacheFocusChanged(cw);
+ break;
+ }
+ }
}
CacheTabWidget::~CacheTabWidget() {

MODIFY
src/cachetabwidget.h
src/cachetabwidget.h
@@ -19,6 +19,7 @@ public:
signals:
void focusAddressChanged(unsigned address);
+ void cacheFocusChanged(CacheWidget* cacheInFocus);
private:
enum FixedCacheIdx { DataCache, InstrCache };

MODIFY
src/cachetabwidget.ui
src/cachetabwidget.ui
<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">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">

MODIFY
src/mainwindow.cpp
src/mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
+#include "cachetab.h"
#include "defines.h"
#include "edittab.h"
#include "iotab.h"
@@ -56,26 +57,32 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), m_ui(new Ui::Main
m_editToolbar = addToolBar("Edit");
m_editToolbar->setVisible(false);
m_editTab = new EditTab(m_editToolbar, this);
- m_stackedTabs->insertWidget(0, m_editTab);
+ m_stackedTabs->insertWidget(EditTabID, m_editTab);
m_processorToolbar = addToolBar("Processor");
m_processorToolbar->setVisible(false);
m_processorTab = new ProcessorTab(m_controlToolbar, m_processorToolbar, this);
- m_stackedTabs->insertWidget(1, m_processorTab);
+ m_stackedTabs->insertWidget(ProcessorTabID, m_processorTab);
+
+ m_cacheToolbar = addToolBar("Cache");
+ m_cacheToolbar->setVisible(false);
+ m_cacheTab = new CacheTab(m_memoryToolbar, this);
+ m_stackedTabs->insertWidget(CacheTabID, m_cacheTab);
m_memoryToolbar = addToolBar("Memory");
m_memoryToolbar->setVisible(false);
m_memoryTab = new MemoryTab(m_memoryToolbar, this);
- m_stackedTabs->insertWidget(2, m_memoryTab);
+ m_stackedTabs->insertWidget(MemoryTabID, m_memoryTab);
m_IOToolbar = addToolBar("I/O");
m_IOToolbar->setVisible(false);
m_IOTab = new IOTab(m_IOToolbar, this);
- m_stackedTabs->insertWidget(3, m_IOTab);
+ m_stackedTabs->insertWidget(IOTabID, m_IOTab);
// Setup tab bar
m_ui->tabbar->addFancyTab(QIcon(":/icons/binary-code.svg"), "Editor");
m_ui->tabbar->addFancyTab(QIcon(":/icons/cpu.svg"), "Processor");
+ m_ui->tabbar->addFancyTab(QIcon(":/icons/server.svg"), "Cache");
m_ui->tabbar->addFancyTab(QIcon(":/icons/ram-memory.svg"), "Memory");
m_ui->tabbar->addFancyTab(QIcon(":/icons/led.svg"), "I/O");
connect(m_ui->tabbar, &FancyTabBar::activeIndexChanged, this, &MainWindow::tabChanged);
@@ -137,10 +144,11 @@ void MainWindow::setupStatusBar() {
}
void MainWindow::tabChanged(int index) {
- m_editToolbar->setVisible(index == 0);
- m_processorToolbar->setVisible(index == 1);
- m_memoryToolbar->setVisible(index == 2);
- m_IOToolbar->setVisible(index == 3);
+ m_editToolbar->setVisible(index == EditTabID);
+ m_processorToolbar->setVisible(index == ProcessorTabID);
+ m_memoryToolbar->setVisible(index == MemoryTabID);
+ m_cacheToolbar->setVisible(index == CacheTabID);
+ m_IOToolbar->setVisible(index == IOTabID);
}
void MainWindow::fitToView() {

MODIFY
src/mainwindow.h
src/mainwindow.h
@@ -17,6 +17,7 @@ class MainWindow;
class EditTab;
class MemoryTab;
class ProcessorTab;
+class CacheTab;
class IOTab;
class ProcessorHandler;
struct LoadFileParams;
@@ -24,6 +25,8 @@ struct LoadFileParams;
class MainWindow : public QMainWindow {
Q_OBJECT
+ enum TabIndex { EditTabID, ProcessorTabID, CacheTabID, MemoryTabID, IOTabID, NTabsID };
+
public:
explicit MainWindow(QWidget* parent = nullptr);
~MainWindow() override;
@@ -66,12 +69,14 @@ private:
ProcessorTab* m_processorTab = nullptr;
EditTab* m_editTab = nullptr;
+ CacheTab* m_cacheTab = nullptr;
MemoryTab* m_memoryTab = nullptr;
IOTab* m_IOTab = nullptr;
QToolBar* m_controlToolbar = nullptr;
QToolBar* m_processorToolbar = nullptr;
QToolBar* m_editToolbar = nullptr;
+ QToolBar* m_cacheToolbar = nullptr;
QToolBar* m_memoryToolbar = nullptr;
QToolBar* m_IOToolbar = nullptr;
};

Initial commit for new cache tab