Move cache indexing breakdown to separate groupbox
ADD
resources/icons/crosshair.svg
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve" width="512" height="512">
+<path d="M276,512h-40V317h40V512z M276,0h-40v195h40V0z M512,236H316v40h196V236z M195,236H0v40h195V236z M256,276 c11.046,0,20-8.954,20-20c0-11.046-8.954-20-20-20c-11.046,0-20,8.954-20,20C236,267.046,244.954,276,256,276z"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</svg>

MODIFY
resources/icons/icons.qrc
resources/icons/icons.qrc
<file>plus.svg</file>
<file>delete.svg</file>
<file>analytics.svg</file>
+ <file>crosshair.svg</file>
</qresource>
</RCC>

MODIFY
src/cachesim/cacheconfigwidget.ui
src/cachesim/cacheconfigwidget.ui
<rect>
<x>0</x>
<y>0</y>
- <width>645</width>
+ <width>665</width>
<height>271</height>
</rect>
</property>
<number>0</number>
</property>
<item row="0" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0">
+ <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
</item>
</layout>
</item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
<item>
- <layout class="QVBoxLayout" name="verticalLayout_2">
+ <widget class="QGroupBox" name="groupBox_3">
+ <property name="title">
+ <string>Cache indexing breakdown:</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_4">
+ <item row="0" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout_5">
<item>
- <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="indexingText">
<property name="text">
</layout>
</item>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="indexingKey">
<property name="text">
<string>#=tag</string>
</property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
</widget>
</item>
</layout>
</layout>
</item>
</layout>
+ </widget>
</item>
</layout>
- </widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
</property>
</widget>
</item>
+ <item>
+ <widget class="QToolButton" name="cachePlot">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
<item>
</property>
</widget>
</item>
- <item row="1" column="0">
- <widget class="QToolButton" name="cachePlot">
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
</layout>
</widget>
</item>

MODIFY
src/cachesim/cacheplotview.cpp
src/cachesim/cacheplotview.cpp
@@ -90,6 +90,10 @@ void CachePlotView::deleteCallout(Callout* callout) {
delete callout;
}
+void CachePlotView::enableCrosshair(bool enabled) {
+ m_crosshairEnabled = enabled;
+}
+
void CachePlotView::tooltip(QPointF point, bool state) {
m_tooltipLock.lock();
if (m_tooltip == nullptr)

MODIFY
src/cachesim/cacheplotview.h
src/cachesim/cacheplotview.h
@@ -36,6 +36,7 @@ public slots:
void keepCallout();
void deleteCallout(Callout* callout);
void tooltip(QPointF point, bool state);
+ void enableCrosshair(bool enabled);
private:
QPointF m_hoverPos;
@@ -45,6 +46,8 @@ private:
QChart* m_chart = nullptr;
Callout* m_tooltip = nullptr;
QMutex m_tooltipLock;
+
+ bool m_crosshairEnabled = true;
};
} // namespace Ripes

MODIFY
src/cachesim/cacheplotwidget.cpp
src/cachesim/cacheplotwidget.cpp
@@ -66,6 +66,16 @@ void CachePlotWidget::setupStackedVariablesList() {
}
void CachePlotWidget::setupToolbar() {
+ const QIcon crosshairIcon = QIcon(":/icons/crosshair.svg");
+ m_crosshairAction = new QAction("Enable plot crosshair", this);
+ m_crosshairAction->setIcon(crosshairIcon);
+ m_crosshairAction->setCheckable(true);
+ m_crosshairAction->setChecked(true);
+ m_toolbar->addAction(m_crosshairAction);
+ connect(m_crosshairAction, &QAction::triggered, m_ui->plotView, &CachePlotView::enableCrosshair);
+
+ m_toolbar->addSeparator();
+
const QIcon copyIcon = QIcon(":/icons/documents.svg");
m_copyDataAction = new QAction("Copy plot data to clipboard", this);
m_copyDataAction->setIcon(copyIcon);

MODIFY
src/cachesim/cacheplotwidget.h
src/cachesim/cacheplotwidget.h
@@ -61,6 +61,7 @@ private:
QToolBar* m_toolbar = nullptr;
QAction* m_copyDataAction = nullptr;
QAction* m_savePlotAction = nullptr;
+ QAction* m_crosshairAction = nullptr;
};
const static std::map<CachePlotWidget::Variable, QString> s_cacheVariableStrings{

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,2">
<item>
<widget class="CacheConfigWidget" name="cacheConfig" native="true"/>
</item>

Move cache indexing breakdown to separate groupbox