# HG changeset patch # User Michiel Broek # Date 1656578283 -7200 # Node ID d1861707054cc7572a037d1f014dd2591d665e68 # Parent ff02aca2b63c42f9f9353c22fd2367ffaf487a79 Translated to English. diff -r ff02aca2b63c -r d1861707054c src/analog/led.cpp --- a/src/analog/led.cpp Wed Jun 29 23:06:38 2022 +0200 +++ b/src/analog/led.cpp Thu Jun 30 10:38:03 2022 +0200 @@ -58,17 +58,17 @@ updateWithBackground(); } -// Maluje całą diodę - koło o kolorze bazowym a na to nakłada odblask. +// Paints the whole diode - a circle with a base color, and a reflection over it void Led::paintEvent(QPaintEvent * /* event*/ ) { QPainter painter(this); initCoordinateSystem(painter); - // *** Draw circle */ + // *** Draw circle int h,s,v,a; QColor c,back = color(); c=back; - // Kolor diody + // Color of the LED if (!m_checked || !isEnabled()) { back.getHsv(&h,&s,&v,&a); @@ -77,9 +77,9 @@ } painter.setBrush(back); - // obwudka diody + // LED circuit QPen pen; - // przyciemnienie obwudki + // rim darkening c.getHsv(&h,&s,&v,&a); s*=0.5; c.setHsv(h,s,v,a); @@ -90,12 +90,12 @@ painter.drawEllipse(-149,-149,299,299); painter.end(); - // odblask światła diody - drawBackground(); // to maluje na tym co dotychczas to co jest w bitmapce + // LED reflector + drawBackground(); // It paints on what has been in the bitmap so far } -// Rysuje odblask swiatła na diodzie +// Draws a reflection of the light on the diode void Led::paintBackground(QPainter & painter) { initCoordinateSystem(painter); @@ -115,7 +115,7 @@ void Led::initCoordinateSystem(QPainter & painter) { int side = qMin(width(), height()); - // inicjalizacja paintera + // painter initialization painter.setRenderHint(QPainter::Antialiasing); painter.translate(width() / 2, height() / 2); painter.scale(side / 330.0, side / 330.0); diff -r ff02aca2b63c -r d1861707054c src/analog/led.h --- a/src/analog/led.h Wed Jun 29 23:06:38 2022 +0200 +++ b/src/analog/led.h Thu Jun 30 10:38:03 2022 +0200 @@ -26,9 +26,9 @@ #include #include "widgetwithbackground.h" - /** - * Klasa reprezentująca diodę w dowolnym kolorze jako dwustabilny element wskazujący - */ +/** + * A class representing a diode of any color as a bistable indicating element + */ class Led : public WidgetWithBackground { Q_OBJECT @@ -41,7 +41,7 @@ Led(QWidget *parent = 0); virtual ~Led() {}; - /** Zdarzenie obsługujące malowanie kontrolki */ + /* The event that handles the painting of the control */ void paintEvent(QPaintEvent * event); bool isChecked () const ; @@ -49,31 +49,26 @@ QColor color() const; void setColor(QColor); - + public slots: - void setChecked(bool); - + signals: - void checkChanged(bool val); - + protected: - - /** Inicjuje układ współrzędnych paintera */ + /** Initializes the painter coordinate system */ void initCoordinateSystem(QPainter & painter); - + /** - * Maluje tło kontrolki w tym przypadku pierwszy plan czyli odblask światła kontrolki - * @param painter Przestrzeń kontrolki - */ + * Paints the background of the control, in this case the foreground, i.e. a reflection of the control's light + * @param painter Control space + */ void paintBackground(QPainter & painter); - + protected: - bool m_checked; QColor m_color; - }; #endif // QLED_H diff -r ff02aca2b63c -r d1861707054c src/analog/widgetwithbackground.h --- a/src/analog/widgetwithbackground.h Wed Jun 29 23:06:38 2022 +0200 +++ b/src/analog/widgetwithbackground.h Thu Jun 30 10:38:03 2022 +0200 @@ -30,51 +30,50 @@ class WidgetWithBackground : public QWidget { Q_OBJECT - public: - /** Konstruktor */ +public: + /** Constructor */ WidgetWithBackground(QWidget * parent = 0); - /** Destruktor - usuwa bitmapkę. */ + /** Destructor - removes the bitmap. */ ~WidgetWithBackground (); /** - * Operacja odmalowywania kontrolki - - * wkleja bitmapę z tłem na kontrolkę - - * generująć ją wcześniej jeżeli zajdzie taka potrzeba. + * An operation to repaint a control - + * Pastes the background bitmap onto the control - + * Generate it earlier if needed. */ void drawBackground (); - /** Odmalowywuje kontrolkę bezwarunkowo odmalowywując tło. */ + /** Repaints the control by painting the background unconditionally. */ void updateWithBackground (); - + /** - * Zawraca informacje czy kontrolka została zmodyfikowana - * Ta informacja jest ustawiana gdy bitmapka tła się zmienia - * to znaczy zmienia się rozmiar komponentu lub istnieje - * potrzeba przemalowania tła. - */ + * Returns whether a control has been modified. + * This information is set when the background bitmap changes, that is, + * the size of the component changes or the background needs to be repainted. + */ bool doRepaintBackground(); - - protected: - /** Wywołuje paintBackground - odmalowywując tło na nowo */ + +protected: + /** Invoke paintBackground - redrawing the background */ void repaintBackground(); /** - * Odmalowywuje tło kontrolki - * @param painter urządzenie na ktróym mamy malować. - * @param background to tło kontrolki + * Repaints the background of the control + * @param painter the device on which we are to paint. + * @param background this is the background of the indicator */ virtual void paintBackground (QPainter & painer) = 0; - - - protected: - /** Bufor na tło. */ +protected: + /** Background buffer. */ QPixmap * m_pixmap; + /** - * Ustawia tą zmienną po zmianie właściwości - */ + * Sets this variable after a property change + */ bool m_modified; }; + #endif //WIDGETWITHBACKGROUND_H