mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-02 17:56:36 +00:00
Add Setting for Minimum Font Size in Graphs (#2524)
This commit is contained in:
parent
c985fdc1b1
commit
ac8c0e4175
@ -173,6 +173,16 @@ public:
|
||||
s.setValue("graph.maxcols", ch);
|
||||
}
|
||||
|
||||
int getGraphMinFontSize() const
|
||||
{
|
||||
return s.value("graph.minfontsize", 4).toInt();
|
||||
}
|
||||
|
||||
void setGraphMinFontSize(int sz)
|
||||
{
|
||||
s.setValue("graph.minfontsize", sz);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Getters and setters for the transaparent option state and scale factor for bitmap graph exports.
|
||||
*/
|
||||
|
@ -43,6 +43,9 @@ void GraphOptionsWidget::updateOptionsFromVars()
|
||||
ui->maxColsSpinBox->blockSignals(true);
|
||||
ui->maxColsSpinBox->setValue(Config()->getGraphBlockMaxChars());
|
||||
ui->maxColsSpinBox->blockSignals(false);
|
||||
ui->minFontSizeSpinBox->blockSignals(true);
|
||||
ui->minFontSizeSpinBox->setValue(Config()->getGraphMinFontSize());
|
||||
ui->minFontSizeSpinBox->blockSignals(false);
|
||||
auto blockSpacing = Config()->getGraphBlockSpacing();
|
||||
ui->horizontalBlockSpacing->setValue(blockSpacing.x());
|
||||
ui->verticalBlockSpacing->setValue(blockSpacing.y());
|
||||
@ -65,6 +68,12 @@ void GraphOptionsWidget::on_maxColsSpinBox_valueChanged(int value)
|
||||
triggerOptionsChanged();
|
||||
}
|
||||
|
||||
void GraphOptionsWidget::on_minFontSizeSpinBox_valueChanged(int value)
|
||||
{
|
||||
Config()->setGraphMinFontSize(value);
|
||||
triggerOptionsChanged();
|
||||
}
|
||||
|
||||
void GraphOptionsWidget::on_graphOffsetCheckBox_toggled(bool checked)
|
||||
{
|
||||
Config()->setConfig("graph.offset", checked);
|
||||
|
@ -30,6 +30,7 @@ private slots:
|
||||
void updateOptionsFromVars();
|
||||
|
||||
void on_maxColsSpinBox_valueChanged(int value);
|
||||
void on_minFontSizeSpinBox_valueChanged(int value);
|
||||
void on_graphOffsetCheckBox_toggled(bool checked);
|
||||
|
||||
void checkTransparentStateChanged(int checked);
|
||||
|
@ -43,15 +43,15 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="maxColsLabel">
|
||||
<property name="text">
|
||||
<string>Maximum Line Length:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="maxColsSpinBox">
|
||||
<property name="minimum">
|
||||
<number>25</number>
|
||||
@ -64,6 +64,29 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="minFontSizeLabel">
|
||||
<property name="toolTip">
|
||||
<string>Hide text when zooming out and it is smaller than the given value. Higher values can increase Performance.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Minimum Font Size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="minFontSizeSpinBox">
|
||||
<property name="toolTip">
|
||||
<string>Hide text when zooming out and it is smaller than the given value. Higher values can increase Performance.</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>4</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -413,7 +413,7 @@ void DisassemblerGraphView::drawBlock(QPainter &p, GraphView::GraphBlock &block,
|
||||
auto transform = p.combinedTransform();
|
||||
QRect screenChar = transform.mapRect(QRect(0, 0, charWidth, charHeight));
|
||||
|
||||
if (screenChar.width() * qhelpers::devicePixelRatio(p.device()) < 4) {
|
||||
if (screenChar.width() < Config()->getGraphMinFontSize()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ void SimpleTextGraphView::drawBlock(QPainter &p, GraphView::GraphBlock &block, b
|
||||
auto transform = p.combinedTransform();
|
||||
QRect screenChar = transform.mapRect(QRect(0, 0, charWidth, charHeight));
|
||||
|
||||
if (screenChar.width() * qhelpers::devicePixelRatio(p.device()) < 4) {
|
||||
if (screenChar.width() < Config()->getGraphMinFontSize()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user