From 6dba30b201a1eea2acda913dc65a3e26fa240be1 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Fri, 24 May 2024 16:43:28 +0300 Subject: [PATCH] libs: drop non-operation background feature of KSignalPlotter SVG_SUPPORT was never defined, must've been some experimental feature Signed-off-by: Ivailo Monev --- .../gui/SensorDisplayLib/FancyPlotter.cpp | 7 --- ksysguard/gui/SystemLoad2.sgrd | 6 +- .../signalplotter/ksignalplotter.cpp | 58 +------------------ libs/ksysguard/signalplotter/ksignalplotter.h | 10 ---- .../signalplotter/ksignalplotter_p.h | 22 +------ 5 files changed, 8 insertions(+), 95 deletions(-) diff --git a/ksysguard/gui/SensorDisplayLib/FancyPlotter.cpp b/ksysguard/gui/SensorDisplayLib/FancyPlotter.cpp index b7995cf9..50999a46 100644 --- a/ksysguard/gui/SensorDisplayLib/FancyPlotter.cpp +++ b/ksysguard/gui/SensorDisplayLib/FancyPlotter.cpp @@ -778,12 +778,6 @@ bool FancyPlotter::restoreSettings( QDomElement &element ) mPlotter->setShowHorizontalLines( element.attribute( "hLines", "1" ).toUInt() ); mPlotter->setStackGraph( element.attribute("stacked", "0").toInt()); - QString filename = element.attribute( "svgBackground"); - if (!filename.isEmpty() && filename[0] == '/') { - KStandardDirs* kstd = KGlobal::dirs(); - filename = kstd->findResource( "data", "ksysguard/" + filename); - } - mPlotter->setSvgBackground( filename ); if(version >= 1) { mPlotter->setShowAxis( element.attribute( "labels", "1" ).toUInt() ); uint fontsize = element.attribute( "fontSize", "0").toUInt(); @@ -850,7 +844,6 @@ bool FancyPlotter::saveSettings( QDomDocument &doc, QDomElement &element) element.setAttribute( "hLines", mPlotter->showHorizontalLines() ); - element.setAttribute( "svgBackground", mPlotter->svgBackground() ); element.setAttribute( "stacked", mPlotter->stackGraph() ); element.setAttribute( "version", 1 ); diff --git a/ksysguard/gui/SystemLoad2.sgrd b/ksysguard/gui/SystemLoad2.sgrd index bedde231..6a439611 100644 --- a/ksysguard/gui/SystemLoad2.sgrd +++ b/ksysguard/gui/SystemLoad2.sgrd @@ -2,14 +2,14 @@ - + - + - + diff --git a/libs/ksysguard/signalplotter/ksignalplotter.cpp b/libs/ksysguard/signalplotter/ksignalplotter.cpp index 8bd63eb1..0df74000 100644 --- a/libs/ksysguard/signalplotter/ksignalplotter.cpp +++ b/libs/ksysguard/signalplotter/ksignalplotter.cpp @@ -37,11 +37,6 @@ #include //For floor, ceil, log10 etc for calculating ranges #include -#ifdef SVG_SUPPORT -#include -#endif - - #define VERTICAL_LINE_OFFSET 1 //Never store less 1000 samples if not visible. This is kinda arbituary #define NUM_SAMPLES_WHEN_INVISIBLE ((uint)1000) @@ -311,27 +306,6 @@ bool KSignalPlotter::showAxis() const return d->mShowAxis; } -QString KSignalPlotter::svgBackground() const { - return d->mSvgFilename; -} -void KSignalPlotter::setSvgBackground( const QString &filename ) -{ - if(d->mSvgFilename == filename) return; - d->mSvgFilename = filename; -#ifdef SVG_SUPPORT - if(filename.isEmpty()) { - delete d->mSvgRenderer; - d->mSvgRenderer = NULL; - } else { - if(!d->mSvgRenderer) - d->mSvgRenderer = new Plasma::Svg(this); - d->mSvgRenderer->setImagePath(d->mSvgFilename); - } -#endif - d->mBackgroundImage = QPixmap(); - update(); -} - void KSignalPlotter::setMaxAxisTextWidth(int axisTextWidth) { if(d->mAxisTextWidth == axisTextWidth) return; @@ -606,15 +580,6 @@ void GraphWidget::paintEvent( QPaintEvent*) void KSignalPlotterPrivate::drawWidget(QPainter *p, const QRect &boundingBox) { -#ifdef SVG_SUPPORT - if(!mSvgFilename.isEmpty()) { - if(mBackgroundImage.isNull() || mBackgroundImage.height() != boundingBox.height() || mBackgroundImage.width() != boundingBox.width()) { //recreate on resize etc - updateSvgBackground(boundingBox); - } - p->drawPixmap(boundingBox, mBackgroundImage); - } -#endif - if( mScrollableImage.isNull() ) redrawScrollableImage(); @@ -642,12 +607,7 @@ void KSignalPlotterPrivate::drawWidget(QPainter *p, const QRect &boundingBox) void KSignalPlotterPrivate::drawBackground(QPainter *p, const QRect &boundingBox) const { p->setRenderHint(QPainter::Antialiasing, false); -#ifdef SVG_SUPPORT - if(!mSvgFilename.isEmpty()) //our background is an svg, so don't paint over the top of it - p->fillRect(boundingBox, Qt::transparent); - else -#endif - p->fillRect(boundingBox, q->palette().brush(QPalette::Base)); + p->fillRect(boundingBox, q->palette().brush(QPalette::Base)); if ( mShowHorizontalLines ) drawHorizontalLines(p, boundingBox.adjusted(0,0,1,0)); @@ -662,6 +622,7 @@ bool KSignalPlotter::thinFrame() const { return d->mShowThinFrame; } + void KSignalPlotter::setThinFrame(bool thinFrame) { if(thinFrame == d->mShowThinFrame) @@ -671,21 +632,6 @@ void KSignalPlotter::setThinFrame(bool thinFrame) update(); //Trigger a repaint } -#ifdef SVG_SUPPORT -void KSignalPlotterPrivate::updateSvgBackground(const QRect &boundingBox) -{ - Q_ASSERT(!mSvgFilename.isEmpty()); - Q_ASSERT(boundingBox.isNull()); - mBackgroundImage = QPixmap(boundingBox.width(), boundingBox.height()); - Q_ASSERT(!mBackgroundImage.isNull()); - QPainter pCache(&mBackgroundImage); - pCache.fill( q->palette().color(QPalette::Base) ); - - svgRenderer->resize(boundingBox.size()); - svgRenderer->paint(&pCache, 0, 0); - -} -#endif void KSignalPlotterPrivate::redrawScrollableImage() { //Align width of bounding box to the size of the horizontal scale diff --git a/libs/ksysguard/signalplotter/ksignalplotter.h b/libs/ksysguard/signalplotter/ksignalplotter.h index 657b72c7..44076cbe 100644 --- a/libs/ksysguard/signalplotter/ksignalplotter.h +++ b/libs/ksysguard/signalplotter/ksignalplotter.h @@ -44,7 +44,6 @@ Q_DECLARE_METATYPE(KLocalizedString) * Features include: * \li Points are joined by a bezier curve. * \li Lines are anti-aliased - * \li Background can be set as a specified SVG * \li The lines can be reordered * \li Uses as little memory and CPU as possible * \li Graph can be smoothed using the formula (value * 2 + last_value)/3 @@ -80,7 +79,6 @@ class KDE_EXPORT KSignalPlotter : public QWidget Q_PROPERTY(bool verticalLinesScroll READ verticalLinesScroll WRITE setVerticalLinesScroll) Q_PROPERTY(uint verticalLinesDistance READ verticalLinesDistance WRITE setVerticalLinesDistance) Q_PROPERTY(bool showAxis READ showAxis WRITE setShowAxis) - Q_PROPERTY(QString svgBackground READ svgBackground WRITE setSvgBackground) Q_PROPERTY(bool thinFrame READ thinFrame WRITE setThinFrame) Q_PROPERTY(int maxAxisTextWidth READ maxAxisTextWidth WRITE setMaxAxisTextWidth) Q_PROPERTY(bool smoothGraph READ smoothGraph WRITE setSmoothGraph) @@ -353,14 +351,6 @@ class KDE_EXPORT KSignalPlotter : public QWidget * \sa setShowAxis(), axisFont(), axisFontColor(), maxAxisTextWidth() */ bool showAxis() const; - /** \brief Set the filename of the SVG background. - * - * Set to empty (default) to disable again. */ - void setSvgBackground( const QString &filename ); - - /** \brief The filename of the SVG background. */ - QString svgBackground() const; - /** \brief Return the last value that we have for the given beam index. * * \return last value, or 0 if not known. */ diff --git a/libs/ksysguard/signalplotter/ksignalplotter_p.h b/libs/ksysguard/signalplotter/ksignalplotter_p.h index a47e7d79..52bfba39 100644 --- a/libs/ksysguard/signalplotter/ksignalplotter_p.h +++ b/libs/ksysguard/signalplotter/ksignalplotter_p.h @@ -24,20 +24,9 @@ //#define USE_QIMAGE -// SVG support causes it to crash at the moment :( -//#define SVG_SUPPORT -// Use a seperate child widget to draw the graph in - #include #include -#ifdef SVG_SUPPORT -namespace Plasma -{ - class SVG; -} -#endif - class GraphWidget; class KSignalPlotter; @@ -65,17 +54,12 @@ public: /** Return the given value as a string, with the given precision */ QString scaledValueAsString( qreal value, int precision) const; void addSample( const QList& sampleBuf ); -#ifdef SVG_SUPPORT - void updateSvgBackground(const QRect &boundingBox); - Plasma::SVG* mSvgRenderer; -#endif - QString mSvgFilename; - QPixmap mBackgroundImage; ///A cache of the background of the widget. Contains the SVG or just white background with lines + QPixmap mBackgroundImage; ///A cache of the background of the widget. Contains just white background with lines #ifdef USE_QIMAGE - QImage mScrollableImage; ///The scrollable image for the widget. Contains the SVG lines + QImage mScrollableImage; ///The scrollable image for the widget. Contains the lines #else - QPixmap mScrollableImage; ///The scrollable image for the widget. Contains the SVG lines + QPixmap mScrollableImage; ///The scrollable image for the widget. Contains the lines #endif int mScrollOffset; ///The scrollable image is, well, scrolled in a wrap-around window. mScrollOffset determines where the left hand side of the mScrollableImage should be drawn relative to the right hand side of view. 0 <= mScrollOffset < mScrollableImage.width() qreal mMinValue; ///The minimum value (unscaled) currently being displayed