瀏覽代碼

frontend: Remove unused OBSContextBarProxyStyle

All usages of OBSContextBarProxyStyle were removed in [1], so the class
is completely unused now. It should be deleted.

[1] 8dcfae9a390763645d354700f36caef6b8f482c7
Sebastian Beckmann 2 月之前
父節點
當前提交
28ca612d9e
共有 2 個文件被更改,包括 0 次插入77 次删除
  1. 0 71
      frontend/utility/OBSProxyStyle.cpp
  2. 0 6
      frontend/utility/OBSProxyStyle.hpp

+ 0 - 71
frontend/utility/OBSProxyStyle.cpp

@@ -1,77 +1,6 @@
 #include "OBSProxyStyle.hpp"
-
-#include <QStyleOption>
 #include "moc_OBSProxyStyle.cpp"
 
-static inline uint qt_intensity(uint r, uint g, uint b)
-{
-	/* 30% red, 59% green, 11% blue */
-	return (77 * r + 150 * g + 28 * b) / 255;
-}
-
-/* The constants in the default QT styles don't dim the icons enough in
- * disabled mode
- *
- * https://code.woboq.org/qt5/qtbase/src/widgets/styles/qcommonstyle.cpp.html#6429
- */
-QPixmap OBSContextBarProxyStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
-						     const QStyleOption *option) const
-{
-	if (iconMode == QIcon::Disabled) {
-		QImage im = pixmap.toImage().convertToFormat(QImage::Format_ARGB32);
-
-		/* Create a colortable based on the background
-		 * (black -> bg -> white) */
-
-		QColor bg = option->palette.color(QPalette::Disabled, QPalette::Window);
-		int red = bg.red();
-		int green = bg.green();
-		int blue = bg.blue();
-		uchar reds[256], greens[256], blues[256];
-
-		for (int i = 0; i < 128; ++i) {
-			reds[i] = uchar((red * (i << 1)) >> 8);
-			greens[i] = uchar((green * (i << 1)) >> 8);
-			blues[i] = uchar((blue * (i << 1)) >> 8);
-		}
-		for (int i = 0; i < 128; ++i) {
-			reds[i + 128] = uchar(qMin(red + (i << 1), 255));
-			greens[i + 128] = uchar(qMin(green + (i << 1), 255));
-			blues[i + 128] = uchar(qMin(blue + (i << 1), 255));
-		}
-
-		/* High intensity colors needs dark shifting in the color
-		 * table, while low intensity colors needs light shifting. This
-		 * is to increase the perceived contrast. */
-
-		int intensity = qt_intensity(red, green, blue);
-		const int factor = 191;
-
-		if ((red - factor > green && red - factor > blue) || (green - factor > red && green - factor > blue) ||
-		    (blue - factor > red && blue - factor > green))
-			qMin(255, intensity + 20);
-		else if (intensity <= 128)
-			intensity += 100;
-
-		for (int y = 0; y < im.height(); ++y) {
-			QRgb *scanLine = (QRgb *)im.scanLine(y);
-			for (int x = 0; x < im.width(); ++x) {
-				QRgb pixel = *scanLine;
-				/* Calculate color table index, taking
-				 * intensity adjustment and a magic offset into
-				 * account. */
-				uint ci = uint(qGray(pixel) / 3 + (130 - intensity / 3));
-				*scanLine = qRgba(reds[ci], greens[ci], blues[ci], qAlpha(pixel));
-				++scanLine;
-			}
-		}
-
-		return QPixmap::fromImage(im);
-	}
-
-	return QProxyStyle::generatedIconPixmap(iconMode, pixmap, option);
-}
-
 int OBSProxyStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget,
 			     QStyleHintReturn *returnData) const
 {

+ 0 - 6
frontend/utility/OBSProxyStyle.hpp

@@ -13,9 +13,3 @@ public:
 	int styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget,
 		      QStyleHintReturn *returnData) const override;
 };
-
-class OBSContextBarProxyStyle : public OBSProxyStyle {
-public:
-	QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
-				    const QStyleOption *option) const override;
-};