clean up updates from settings dialog to map redraw

parent 897a840e
......@@ -26,6 +26,14 @@
class KConfig;
enum class Dirty
{
Layout = 1,
AntiAliasing = 2,
Colors = 3,
Font
};
namespace Filelight
{
enum MapScheme { Rainbow, KDE, HighContrast, FileDensity, ModTime };
......
......@@ -24,20 +24,6 @@
#include <QColor>
enum class Dirty
{
Other = 0,
LayoutChanged = 1,
// Antialias on or off, contrast changed
RepaintNeeded = 2,
ColorsChanged = 3,
RepaintNeeded2 = 4,
};
class File;
namespace RadialMap
......
......@@ -32,6 +32,7 @@
#include <QApplication> //sendEvent
#include <QBitmap> //ctor - finding cursor size
#include <QCursor> //slotPostMouseEvent()
#include <QDebug>
#include <QTimer> //member
#include <QWidget>
......@@ -168,21 +169,27 @@ RadialMap::Widget::refresh(const Dirty filth)
{
switch (filth)
{
case Dirty::LayoutChanged:
m_focus=nullptr;
case Dirty::Layout:
m_focus = nullptr;
m_map.make(m_tree, true); //true means refresh only
break;
case Dirty::RepaintNeeded:
case Dirty::AntiAliasing:
m_map.paint();
break;
case Dirty::ColorsChanged:
m_map.colorise(); //FALL THROUGH!
case Dirty::RepaintNeeded2:
case Dirty::Colors:
m_map.colorise();
m_map.paint();
break;
// At the time of writing only used by the exploded labels
// which is redrawn with each paintEvent(), so just need an update()
case Dirty::Font:
break;
default:
qWarning() << "Unhandled filth type" << int(filth);
break;
}
......
......@@ -35,7 +35,7 @@
#include <QTimer>
#include "map.h"
#include "radialMap.h" // Dirty
#include "Config.h" // Dirty
class Folder;
class File;
......
......@@ -67,7 +67,6 @@ SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent)
connect(m_schemaGroup, static_cast<void (QButtonGroup::*)(QAbstractButton *)>(&QButtonGroup::buttonClicked), this, &SettingsDialog::changeScheme);
connect(contrastSlider, &QSlider::valueChanged, this, &SettingsDialog::changeContrast);
connect(contrastSlider, &QSlider::sliderReleased, this, &SettingsDialog::slotSliderReleased);
connect(scanAcrossMounts, &QCheckBox::toggled, this, &SettingsDialog::startTimer);
connect(dontScanRemoteMounts, &QCheckBox::toggled, this, &SettingsDialog::startTimer);
......@@ -206,44 +205,37 @@ void SettingsDialog::changeScheme(QAbstractButton *button)
if (button) {
const int s = m_schemaGroup->id(button);
Config::scheme = (Filelight::MapScheme)s;
Q_EMIT canvasIsDirty(Dirty::LayoutChanged);
Q_EMIT canvasIsDirty(Dirty::Colors);
}
}
void SettingsDialog::changeContrast(int c)
{
Config::contrast = c;
Q_EMIT canvasIsDirty(Dirty::ColorsChanged);
Q_EMIT canvasIsDirty(Dirty::Colors);
}
void SettingsDialog::toggleUseAntialiasing(bool b)
{
Config::antialias = b;
Q_EMIT canvasIsDirty(Dirty::RepaintNeeded);
Q_EMIT canvasIsDirty(Dirty::AntiAliasing);
}
void SettingsDialog::toggleVaryLabelFontSizes(bool b)
{
Config::varyLabelFontSizes = b;
minFontPitchLabel->setEnabled(b);
minFontPitch->setEnabled(b);
Q_EMIT canvasIsDirty(Dirty::Other);
Q_EMIT canvasIsDirty(Dirty::Font);
}
void SettingsDialog::changeMinFontPitch(int p)
{
Config::minFontPitch = p;
Q_EMIT canvasIsDirty(Dirty::Other);
Q_EMIT canvasIsDirty(Dirty::Font);
}
void SettingsDialog::toggleShowSmallFiles(bool b)
{
Config::showSmallFiles = b;
Q_EMIT canvasIsDirty(Dirty::LayoutChanged);
Q_EMIT canvasIsDirty(Dirty::Layout);
}
void SettingsDialog::slotSliderReleased()
{
Q_EMIT canvasIsDirty(Dirty::RepaintNeeded);
}
void SettingsDialog::reject()
{
//called when escape is pressed
......
......@@ -24,7 +24,7 @@
#include "ui_dialog.h" //generated by uic
#include "radialMap/radialMap.h" // for Dirty
#include "Config.h" // Dirty
#include <QTimer>
#include <QCloseEvent>
......@@ -57,7 +57,6 @@ public Q_SLOTS:
void changeScheme(QAbstractButton *button);
void changeMinFontPitch(int);
void toggleShowSmallFiles(bool);
void slotSliderReleased();
Q_SIGNALS:
void mapIsInvalid();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment