This file is indexed.

/usr/include/CLAM/qtmonitors/SegmentationView.hxx is in libclam-qtmonitors-dev 1.4.0-3.1.

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
#ifndef SegmentationView_hxx
#define SegmentationView_hxx


#include "SegmentationDataSource.hxx"

#include <QtGui/QLabel>
#include <QtGui/QPainter>
#include <CLAM/Processing.hxx>
#include <CLAM/PortMonitor.hxx>
#include <QtDesigner/QDesignerExportWidget>


class QDESIGNER_WIDGET_EXPORT SegmentationView : public QWidget
{
	Q_OBJECT
	Q_PROPERTY(QColor lineColor READ lineColor WRITE setLineColor)
	Q_PROPERTY(QColor pointColor READ pointColor WRITE setPointColor)
	Q_PROPERTY(bool centred READ isCentred WRITE beCentred)
	Q_PROPERTY(double timeSpan READ timeSpan WRITE setTimeSpan)
	enum Dimensions {
	};
public:
	SegmentationView(QWidget * parent=0, CLAM::VM::SegmentationDataSource * dataSource=0)
		: QWidget(parent)
		, _dataSource(dataSource)
		, _lineColor(Qt::darkGray)
		, _pointColor(Qt::white)
		, _centred(false)
		, _timeSpan(20.)
	{
		startTimer(50);
	}
	QColor colorForLabel(const std::string & label)
	{
		static std::map<std::string, QColor> labelToColor;
		std::map<std::string, QColor>::iterator item = labelToColor.find(label);
		if (item != labelToColor.end())
		{
			return item->second;
		}
		static unsigned colorIndex = 0;
		static const char * colors[] =
		{
			"#C99",
			"#EC8",
			"#FD1",
			"#FE2",
			"#FF3",
			"#EE2",
			"#CD0",
			"#AD2",
			"#7D8",
			"#9E9",
			"#9DD",
			"#99D",
			"#AAF",
			"#88F",
			0
		};
		if (not colors[colorIndex]) colorIndex=0;
		return labelToColor[label] = QColor(colors[colorIndex++]);
	}
	void paintEvent(QPaintEvent * event)
	{
		const unsigned margin = 4;
		if ( !_dataSource) return;
		QVector<QRectF> segmentBoxes;
		const CLAM::Segmentation & segmentation = _dataSource->frameData();
		double currentTime = _dataSource->currentTime();
		double headPosition = _centred ? .5 : 1.;
		double maxTime = currentTime + (1.-headPosition)* _timeSpan;
		double minTime = currentTime - (headPosition) * _timeSpan;
		if (maxTime<1) maxTime=1;
		for (unsigned i=0; i<segmentation.onsets().size(); i++)
		{
			float onsetPosition = width()*(segmentation.onsets()[i]-minTime)/(maxTime-minTime);
			float offsetPosition = width()*(segmentation.offsets()[i]-minTime)/(maxTime-minTime);
			QRectF box(onsetPosition,margin,offsetPosition-onsetPosition,height()-2*margin);
			segmentBoxes << box;
		}
		QPainter painter(this);
		painter.setPen(QPen(_lineColor,3));
		for (unsigned i=0; i<segmentation.onsets().size(); i++)
		{
			if (segmentation.onsets()[i]>maxTime) continue;
			if (segmentation.offsets()[i]<minTime) continue;
			painter.setBrush(colorForLabel(segmentation.labels()[i]));
#if QT_VERSION < 0x040400
			painter.drawRect(segmentBoxes[i]);
#else
			painter.drawRoundedRect(segmentBoxes[i], margin, margin);
#endif
		}
		painter.setPen(Qt::black);
		for (unsigned i=0; i<segmentation.onsets().size(); i++)
		{
			if (segmentation.onsets()[i]>maxTime) continue;
			if (segmentation.offsets()[i]<minTime) continue;
			painter.drawText(segmentBoxes[i], Qt::AlignCenter|Qt::TextWordWrap, segmentation.labels()[i].c_str());
		}
		_dataSource->release();

		if (_centred)
		{
			painter.setPen(QPen(Qt::red, 1));
			painter.setBrush(Qt::NoBrush);
			painter.drawLine(QPoint(width()/2, 0), QPoint(width()/2, height()));
		}

	}

	void setDataSource(CLAM::VM::SegmentationDataSource & dataSource)
	{
		_dataSource = & dataSource;
	}
	void noDataSource()
	{
		_dataSource = 0;
	}
	void setPointColor(const QColor & color)
	{
		_pointColor = color;
	}
	QColor pointColor() const
	{
		return _pointColor;
	}
	void setLineColor(const QColor & color)
	{
		_lineColor = color;
	}
	QColor lineColor() const
	{
		return _lineColor;
	}
	void beCentred(bool centred)
	{
		_centred = centred;
	}
	bool isCentred() const
	{
		return _centred;
	}
	void setTimeSpan(double timeSpan)
	{
		_timeSpan = timeSpan;
	}
	double timeSpan() const
	{
		return _timeSpan;
	}
	void timerEvent(QTimerEvent *event)
	{
		if ( !_dataSource) return;
		if ( !_dataSource->isEnabled()) return;
		update();
	}
private:
	CLAM::VM::SegmentationDataSource * _dataSource;
	QColor _lineColor;
	QColor _pointColor;
	bool   _centred;
	double _timeSpan;
};


#endif//SegmentationView_hxx