diff options
-rw-r--r-- | desktop-widgets/simplewidgets.h | 1 | ||||
-rw-r--r-- | desktop-widgets/starwidget.cpp | 37 |
2 files changed, 18 insertions, 20 deletions
diff --git a/desktop-widgets/simplewidgets.h b/desktop-widgets/simplewidgets.h index ed364e75f..706b46818 100644 --- a/desktop-widgets/simplewidgets.h +++ b/desktop-widgets/simplewidgets.h @@ -161,6 +161,5 @@ private: }; bool isGnome3Session(); -QImage grayImage(const QImage &coloredImg); #endif // SIMPLEWIDGETS_H 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(); |