@@ -28,26 +28,28 @@ ColorQuantizerOperation::ColorQuantizerOperation(QUrl* source, qreal depth, qrea
2828    : source(source)
2929    , maxDepth(depth)
3030    , rescaleSize(rescaleSize) {
31- 	setAutoDelete (false );
31+ 	this -> setAutoDelete (false );
3232}
3333
3434void  ColorQuantizerOperation::quantizeImage (const  QAtomicInteger<bool >& shouldCancel) {
35- 	if  (shouldCancel.loadAcquire () || source->isEmpty ()) return ;
35+ 	if  (shouldCancel.loadAcquire () || this -> source ->isEmpty ()) return ;
3636
37- 	colors.clear ();
37+ 	this -> colors .clear ();
3838
39- 	auto  image = QImage (source->toLocalFile ());
40- 	if  ((image.width () > rescaleSize || image.height () > rescaleSize) && rescaleSize > 0 ) {
39+ 	auto  image = QImage (this ->source ->toLocalFile ());
40+ 	if  ((image.width () > this ->rescaleSize  || image.height () > this ->rescaleSize )
41+ 	    && this ->rescaleSize  > 0 )
42+ 	{
4143		image = image.scaled (
42- 		    static_cast <int >(rescaleSize),
43- 		    static_cast <int >(rescaleSize),
44+ 		    static_cast <int >(this -> rescaleSize ),
45+ 		    static_cast <int >(this -> rescaleSize ),
4446		    Qt::KeepAspectRatio,
4547		    Qt::SmoothTransformation
4648		);
4749	}
4850
4951	if  (image.isNull ()) {
50- 		qCWarning (logColorQuantizer) << " Failed to load image from"   << source->toString ();
52+ 		qCWarning (logColorQuantizer) << " Failed to load image from"   << this -> source ->toString ();
5153		return ;
5254	}
5355
@@ -63,7 +65,7 @@ void ColorQuantizerOperation::quantizeImage(const QAtomicInteger<bool>& shouldCa
6365
6466	auto  startTime = QDateTime::currentDateTime ();
6567
66- 	colors = quantization (pixels, 0 );
68+ 	this -> colors  = this -> quantization (pixels, 0 );
6769
6870	auto  endTime = QDateTime::currentDateTime ();
6971	auto  milliseconds = startTime.msecsTo (endTime);
@@ -77,7 +79,7 @@ QList<QColor> ColorQuantizerOperation::quantization(
7779) {
7880	if  (shouldCancel.loadAcquire ()) return  QList<QColor>();
7981
80- 	if  (depth >= maxDepth || rgbValues.isEmpty ()) {
82+ 	if  (depth >= this -> maxDepth  || rgbValues.isEmpty ()) {
8183		if  (rgbValues.isEmpty ()) return  QList<QColor>();
8284
8385		auto  totalR = 0 ;
@@ -114,8 +116,8 @@ QList<QColor> ColorQuantizerOperation::quantization(
114116	auto  rightHalf = rgbValues.mid (mid);
115117
116118	QList<QColor> result;
117- 	result.append (quantization (leftHalf, depth + 1 ));
118- 	result.append (quantization (rightHalf, depth + 1 ));
119+ 	result.append (this -> quantization (leftHalf, depth + 1 ));
120+ 	result.append (this -> quantization (rightHalf, depth + 1 ));
119121
120122	return  result;
121123}
@@ -159,7 +161,7 @@ void ColorQuantizerOperation::finishRun() {
159161}
160162
161163void  ColorQuantizerOperation::finished () {
162- 	emit this ->done (colors);
164+ 	emit this ->done (this -> colors );
163165	delete  this ;
164166}
165167
@@ -178,39 +180,39 @@ void ColorQuantizerOperation::run() {
178180void  ColorQuantizerOperation::tryCancel () { this ->shouldCancel .storeRelease (true ); }
179181
180182void  ColorQuantizer::componentComplete () {
181- 	componentCompleted = true ;
182- 	if  (!mSource .isEmpty ()) quantizeAsync ();
183+ 	this -> componentCompleted  = true ;
184+ 	if  (!this -> mSource .isEmpty ()) this -> quantizeAsync ();
183185}
184186
185187void  ColorQuantizer::setSource (const  QUrl& source) {
186- 	if  (mSource  != source) {
187- 		mSource  = source;
188+ 	if  (this -> mSource  != source) {
189+ 		this -> mSource  = source;
188190		emit this ->sourceChanged ();
189191
190- 		if  (this ->componentCompleted  && !mSource .isEmpty ()) quantizeAsync ();
192+ 		if  (this ->componentCompleted  && !this -> mSource .isEmpty ()) this -> quantizeAsync ();
191193	}
192194}
193195
194196void  ColorQuantizer::setDepth (qreal depth) {
195- 	if  (mDepth  != depth) {
196- 		mDepth  = depth;
197+ 	if  (this -> mDepth  != depth) {
198+ 		this -> mDepth  = depth;
197199		emit this ->depthChanged ();
198200
199- 		if  (this ->componentCompleted ) quantizeAsync ();
201+ 		if  (this ->componentCompleted ) this -> quantizeAsync ();
200202	}
201203}
202204
203205void  ColorQuantizer::setRescaleSize (int  rescaleSize) {
204- 	if  (mRescaleSize  != rescaleSize) {
205- 		mRescaleSize  = rescaleSize;
206+ 	if  (this -> mRescaleSize  != rescaleSize) {
207+ 		this -> mRescaleSize  = rescaleSize;
206208		emit this ->rescaleSizeChanged ();
207209
208- 		if  (this ->componentCompleted ) quantizeAsync ();
210+ 		if  (this ->componentCompleted ) this -> quantizeAsync ();
209211	}
210212}
211213
212214void  ColorQuantizer::operationFinished (const  QList<QColor>& result) {
213- 	bColors = result;
215+ 	this -> bColors  = result;
214216	this ->liveOperation  = nullptr ;
215217	emit this ->colorsChanged ();
216218}
@@ -219,7 +221,8 @@ void ColorQuantizer::quantizeAsync() {
219221	if  (this ->liveOperation ) this ->cancelAsync ();
220222
221223	qCDebug (logColorQuantizer) << " Starting color quantization asynchronously"  ;
222- 	this ->liveOperation  = new  ColorQuantizerOperation (&mSource , mDepth , mRescaleSize );
224+ 	this ->liveOperation  =
225+ 	    new  ColorQuantizerOperation (&this ->mSource , this ->mDepth , this ->mRescaleSize );
223226
224227	QObject::connect (
225228	    this ->liveOperation ,
0 commit comments