summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/starwidget.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-05-27 19:03:30 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-05-27 13:55:08 -0700
commit330b300f220a78cb71e30b898f43c19f41961c8b (patch)
treed1a9ed44e04765a9049b615aa7649ca0b5a7108b /desktop-widgets/starwidget.cpp
parent26903256232809a6566bfe0c42d637deb883b078 (diff)
downloadsubsurface-330b300f220a78cb71e30b898f43c19f41961c8b.tar.gz
cleanup: unglobalize grayImage()
This function was globalized in be462ae1a6 to be used for the calender widget, but that never came to be. Therefore, for now unglobalize it until it is needed. That said, there probably is a helper function to turn pictures into gray-scale. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/starwidget.cpp')
-rw-r--r--desktop-widgets/starwidget.cpp37
1 files changed, 18 insertions, 19 deletions
diff --git a/desktop-widgets/starwidget.cpp b/desktop-widgets/starwidget.cpp
index d4a63b273..8748d929b 100644
--- a/desktop-widgets/starwidget.cpp
+++ b/desktop-widgets/starwidget.cpp
@@ -36,7 +36,6 @@ QImage focusedImage(const QImage& coloredImg)
return img;
}
-
int StarWidget::currentStars() const
{
return current;
@@ -91,6 +90,24 @@ void StarWidget::setCurrentStars(int value)
emit valueChanged(current);
}
+static QImage grayImage(const QImage &coloredImg)
+{
+ QImage img = coloredImg;
+ for (int i = 0; i < img.width(); ++i) {
+ for (int j = 0; j < img.height(); ++j) {
+ QRgb rgb = img.pixel(i, j);
+ if (!rgb)
+ continue;
+
+ QColor c(rgb);
+ int gray = 204 + (c.red() + c.green() + c.blue()) / 15;
+ img.setPixel(i, j, qRgb(gray, gray, gray));
+ }
+ }
+
+ return img;
+}
+
StarWidget::StarWidget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f),
current(0),
readOnly(false)
@@ -113,24 +130,6 @@ StarWidget::StarWidget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f),
setFocusPolicy(Qt::StrongFocus);
}
-QImage grayImage(const QImage& coloredImg)
-{
- QImage img = coloredImg;
- for (int i = 0; i < img.width(); ++i) {
- for (int j = 0; j < img.height(); ++j) {
- QRgb rgb = img.pixel(i, j);
- if (!rgb)
- continue;
-
- QColor c(rgb);
- int gray = 204 + (c.red() + c.green() + c.blue()) / 15;
- img.setPixel(i, j, qRgb(gray, gray, gray));
- }
- }
-
- return img;
-}
-
QSize StarWidget::sizeHint() const
{
const IconMetrics& metrics = defaultIconMetrics();