This file is indexed.

/usr/include/plasma/widgets/signalplotter.h is in kdelibs5-dev 4:4.14.2-5+deb8u2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
/*
 *   KSysGuard, the KDE System Guard
 *
 *   Copyright 1999 - 2001 Chris Schlaeger <cs@kde.org>
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Library General Public License as
 *   published by the Free Software Foundation; either version 2, or
 *   (at your option) any later version.

 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#ifndef PLASMA_SIGNALPLOTTER_H
#define PLASMA_SIGNALPLOTTER_H

#include <QtGui/QFont>
#include <QtGui/QGraphicsWidget>
#include <plasma/plasma_export.h>

namespace Plasma
{

class SignalPlotterPrivate;

struct PlotColor
{
    QColor color;
    QColor darkColor;
};

/**
 * @class SignalPlotter plasma/widgets/signalplotter.h <Plasma/Widgets/SignalPlotter>
 *
 * @short Provides a signal plotter for plasma.
 */
class PLASMA_EXPORT SignalPlotter : public QGraphicsWidget
{
    Q_OBJECT
    Q_PROPERTY(QString title READ title WRITE setTitle)
    Q_PROPERTY(QString unit READ unit WRITE setUnit)
    Q_PROPERTY(qreal scale READ scaledBy WRITE scale) // Note: The naming of the functions here is poor
    Q_PROPERTY(bool useAutoRange READ useAutoRange WRITE setUseAutoRange)
    Q_PROPERTY(uint horizontalScale READ horizontalScale WRITE setHorizontalScale)
    Q_PROPERTY(bool showVerticalLines READ showVerticalLines WRITE setShowVerticalLines)
    Q_PROPERTY(QColor verticalLinesColor READ verticalLinesColor WRITE setVerticalLinesColor)
    Q_PROPERTY(uint verticalLinesDistance READ verticalLinesDistance WRITE setVerticalLinesDistance)
    Q_PROPERTY(bool verticalLinesScroll READ verticalLinesScroll WRITE setVerticalLinesScroll)
    Q_PROPERTY(bool showHorizontalLines READ showHorizontalLines WRITE setShowHorizontalLines)
    Q_PROPERTY(QColor horizontalLinesColor READ horizontalLinesColor WRITE setHorizontalLinesColor)
    Q_PROPERTY(QColor fontColor READ fontColor WRITE setFontColor)
    Q_PROPERTY(QFont font READ font WRITE setFont)
    Q_PROPERTY(uint horizontalLinesCount READ horizontalLinesCount WRITE setHorizontalLinesCount)
    Q_PROPERTY(bool showLabels READ showLabels WRITE setShowLabels)
    Q_PROPERTY(bool showTopBar READ showTopBar WRITE setShowTopBar)
    Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
    Q_PROPERTY(QString svgBackground READ svgBackground WRITE setSvgBackground)
    Q_PROPERTY(bool thinFrame READ thinFrame WRITE setThinFrame)
    Q_PROPERTY(bool stackPlots READ stackPlots WRITE setStackPlots)

public:
    SignalPlotter(QGraphicsItem *parent = 0);
    ~SignalPlotter();

    /**
     * Add a new line to the graph plotter, with the specified color.
     * Note that the order you add the plots must be the same order that
     * the same data is given in (unless you reorder the plots).
     * @param color the color to use for this plot
     */
    Q_INVOKABLE void addPlot(const QColor &color);

    /**
     * Add data to the graph, and advance the graph by one time period.
     * The data must be given as a list in the same order that the plots were
     * added (or consequently reordered).
     * @param samples a list with the new value for each plot
     */
    Q_INVOKABLE void addSample(const QList<double> &samples);

    /**
     * Reorder the plots into the order given.  For example:
     * \code
     *  Plasma::SignalPlotter *s = new Plasma::SignalPlotter(parent);
     *  s->addPlot(Qt::Blue);
     *  s->addPlot(Qt::Green);
     *  QList neworder;
     *  neworder << 1 << 0;
     *  s->reorderPlots(newOrder);
     *  //Now the order is Green then Blue
     * \endcode
     * @param newOrder a list with the new position of each plot
     */
    Q_INVOKABLE void reorderPlots(const QList<uint>& newOrder);

    /**
     * Removes the plot at the specified index.
     * @param pos the index of the plot to be removed
     */
    Q_INVOKABLE void removePlot(uint pos);

    /**
     * Return the list of plot colors, in the order that the plots
     * were added (or later reordered).
     * @return a list containing the color of every plot
     */
    QList<PlotColor> &plotColors();

    /**
     * Set the title of the graph. Drawn in the top left.
     * @param title the title to use in the plotter
     */
    void setTitle(const QString &title);

    /**
     * Get the title of the graph.  Drawn in the top left.
     * @return the title to use in the plotter
     */
    QString title() const;

    /**
     *  Set the units.  Drawn on the vertical axis of the graph.
     *  Must be already translated into the local language.
     *  @param unit the unit string to use
     */
    void setUnit(const QString &unit);

    /**
     * Return the units used on the vertical axis of the graph.
     * @return the unit string used
     */
    QString unit() const;

    /**
     *  Scale all the values down by the given amount. This is useful
     *  when the data is given in, say, kilobytes, but you set the
     *  units as megabytes.  Thus you would have to call this with @p value
     *  set to 1024. This affects all the data already entered.
     *  @param delta the factor used to scale down the values
     */
    void scale(qreal delta);

    /**
     * Amount scaled down by. @see scale
     * @return the factor used to scale down the values
     */
    qreal scaledBy() const;

    /**
     * Set the minimum and maximum values on the vertical axis
     * automatically from the data available.
     * @param value true if the plotter should calculate its own
     * min and max values, otherwise false
     */
    void setUseAutoRange(bool value);

    /**
     * Whether the vertical axis range is set automatically.
     * @return true if the plotter calculates its own min and max
     * values, otherwise false
     */
    bool useAutoRange() const;

    /**
     * Change the minimum and maximum values drawn on the graph.
     * Note that these values are sanitised.  For example, if you
     * set the minimum as 3, and the maximum as 97, then the graph
     * would be drawn between 0 and 100.  The algorithm to determine
     * this "nice range" attempts to minimize the number of non-zero
     * digits.
     *
     * Use setAutoRange instead to determine the range automatically
     * from the data.
     * @param min the minimum value to use for the vertical axis
     * @param max the maximum value to use for the vertical axis
     */
    void setVerticalRange(double min, double max);

    /**
     * Get the min value of the vertical axis.  @see changeRange
     * @return the minimum value to use for the vertical axis
     */
    double verticalMinValue() const;

    /**
     * Get the max value of the vertical axis.  @see changeRange
     * @return the maximum value to use for the vertical axis
     */
    double verticalMaxValue() const;

    /**
     * Set the number of pixels horizontally between data points
     * @param scale the number of pixel to draw between two data points
     */
    void setHorizontalScale(uint scale);

    /**
     * The number of pixels horizontally between data points
     * @return the number of pixel drawn between two data points
     */
    uint horizontalScale() const;

    /**
     * Whether to draw the vertical grid lines
     * @param value true if the lines should be drawn, otherwise false
     */
    void setShowVerticalLines(bool value);

    /**
     * Whether the vertical grid lines will be drawn
     * @return true if the lines will be drawn, otherwise false
     */
    bool showVerticalLines() const;

    /**
     * The color of the vertical grid lines
     * @param color the color used to draw the vertical grid lines
     */
    void setVerticalLinesColor(const QColor &color);

    /**
     * The color of the vertical grid lines
     * @return the color used to draw the vertical grid lines
     */
    QColor verticalLinesColor() const;

    /**
     * The horizontal distance between the vertical grid lines
     * @param distance the distance between two vertical grid lines
     */
    void setVerticalLinesDistance(uint distance);

    /**
     * The horizontal distance between the vertical grid lines
     * @return the distance between two vertical grid lines
     */
    uint verticalLinesDistance() const;

    /**
     * Whether the vertical lines move with the data
     * @param value true if the vertical lines should move with the data
     */
    void setVerticalLinesScroll(bool value);

    /**
     * Whether the vertical lines move with the data
     * @return true if the vertical lines will move with the data
     */
    bool verticalLinesScroll() const;

    /**
     * Whether to draw the horizontal grid lines
     * @param value true if the lines should be drawn, otherwise false
     */
    void setShowHorizontalLines(bool value);
    /**
     * Whether to draw the horizontal grid lines
     * @return true if the lines will be drawn, otherwise false
     */
    bool showHorizontalLines() const;

    /**
     * The color of the horizontal grid lines
     * @param color the color used to draw the horizontal grid lines
     */
    void setHorizontalLinesColor(const QColor &color);

    /**
     * The color of the horizontal grid lines
     * @return the color used to draw the horizontal grid lines
     */
    QColor horizontalLinesColor() const;

    /**
     * The color of the font used for the axis
     * @param color the color used to draw the text of the vertical values
     */
    void setFontColor(const QColor &color);

    /**
     * The color of the font used for the axis
     * @return the color used to draw the text of the vertical values
     */
    QColor fontColor() const;

    /**
     * The font used for the axis
     * @param font the font used to draw the text of the vertical values
     */
    void setFont(const QFont &font);

    /**
     * The font used for the axis
     * @return the font used to draw the text of the vertical values
     */
    QFont font() const;

    /**
     * The number of horizontal lines to draw.  Doesn't include the top
     * most and bottom most lines.
     * @param count the number of horizontal lines to draw
     */
    void setHorizontalLinesCount(uint count);

    /**
     * The number of horizontal lines to draw.  Doesn't include the top
     * most and bottom most lines.
     * @return the number of horizontal lines that will be drawn
     */
    uint horizontalLinesCount() const;

    /**
     * Whether to show the vertical axis labels
     * @param value true if the values for the vertical axis should get drawn
     */
    void setShowLabels(bool value);

    /**
     * Whether to show the vertical axis labels
     * @return true if the values for the vertical axis will get drawn
     */
    bool showLabels() const;

    /**
     * Whether to show the title etc at the top.  Even if set, it
     * won't be shown if there isn't room
     * @param value true if the topbar should be shown
     */
    void setShowTopBar(bool value);

    /**
     * Whether to show the title etc at the top.  Even if set, it
     * won't be shown if there isn't room
     * @return true if the topbar will be shown
     */
    bool showTopBar() const;

    /**
     * The color to set the background.  This might not be seen
     * if an svg is also set.
     * @param color the color to use for the plotter background
     */
    void setBackgroundColor(const QColor &color);

    /**
     * The color to set the background.  This might not be seen
     * if an svg is also set.
     * @return the color of the plotter background
     */
    QColor backgroundColor() const;

    /**
     * The filename of the svg background.  Set to empty to disable
     * again.
     * @param filename the SVG file to use as a background image
     */
    void setSvgBackground(const QString &filename);

    /**
     * The filename of the svg background.  Set to empty to disable
     * again.
     * @return the file used as a background image
     */
    QString svgBackground();

    /**
     * Return the last value that we have for plot i. Returns 0 if not known.
     * @param i the plot we like to have the last value from
     * @return the last value of this plot or 0 if not found
     */
    double lastValue(uint i) const;

    /**
     * Return a translated string like: "34 %" or "100 KB" for plot i
     * @param i the plot we like to have the value as string from
     * @return the last value of this plot as a string
     */
    QString lastValueAsString(uint i) const;

    /**
     * Whether to show a white line on the left and bottom of the widget,
     * for a 3D effect
     * @param set true if the frame should get drawn
     */
    void setThinFrame(bool set);

    /**
     * show a white line on the left and bottom of the widget for a 3D effect
     * @return true if frame show be draw
     * @since 4.3
     */
    bool thinFrame() const;

    /**
     * Whether to stack the plots on top of each other.  The first plot
     * added will be at the bottom.  The next plot will be drawn on top,
     * and so on.
     * @param stack true if the plots should be stacked
     */
    void setStackPlots(bool stack);

    /**
     * Whether to stack the plots.  @see setStackPlots
     * @return true if the plots will be stacked
     */
    bool stackPlots() const;

    /**
     * Render the graph to the specified width and height, and return it
     * as an image.  This is useful, for example, if you draw a small version
     * of the graph, but then want to show a large version in a tooltip etc
     * @param width the width of the snapshot
     * @param height the height of the snapshot
     * @return a snapshot of the plotter as an image
     */
    QPixmap getSnapshotImage(uint width, uint height);

    /**
     * Overwritten to be notified of size changes. Needed to update the
     * data buffers that are used to store the samples.
     */
    virtual void setGeometry(const QRectF &geometry);

protected:
    void updateDataBuffers();
    void calculateNiceRange();

    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);

    void drawWidget(QPainter *p, uint w, uint height, int horizontalScale);
    void drawBackground(QPainter *p, int w, int h);
    void drawThinFrame(QPainter *p, int w, int h);
    void drawTopBarFrame(QPainter *p, int separatorX, int height);
    void drawTopBarContents(QPainter *p, int x, int width, int height);
    void drawVerticalLines(QPainter *p, int top, int w, int h);
    void drawPlots(QPainter *p, int top, int w, int h, int horizontalScale);
    void drawAxisText(QPainter *p, int top, int h);
    void drawHorizontalLines(QPainter *p, int top, int w, int h);

private:
    SignalPlotterPrivate *const d;
    Q_PRIVATE_SLOT(d, void themeChanged())
};

} // Plasma namespace

#endif