From 2e41b8c411c6ebb498d051cd5c1ad3eba3753f59 Mon Sep 17 00:00:00 2001 From: lupoDharkael Date: Thu, 18 May 2017 03:07:14 +0200 Subject: [PATCH] Add a few comments --- capture/capturewidget.cpp | 2 +- capture/colorpicker.cpp | 8 ++++++-- capture/colorpicker.h | 2 +- capture/screenshot.cpp | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/capture/capturewidget.cpp b/capture/capturewidget.cpp index 22d57438..5f81ad06 100644 --- a/capture/capturewidget.cpp +++ b/capture/capturewidget.cpp @@ -82,7 +82,7 @@ CaptureWidget::CaptureWidget(QWidget *parent) : // init screenshot createCapture(); resize(m_screenshot.size()); - // initi interface color + // init interface color m_uiColor = QSettings().value("uiColor").value(); show(); diff --git a/capture/colorpicker.cpp b/capture/colorpicker.cpp index 8f4f1f69..6610c9de 100644 --- a/capture/colorpicker.cpp +++ b/capture/colorpicker.cpp @@ -7,17 +7,20 @@ ColorPicker::ColorPicker(QWidget *parent) : QWidget(parent), m_colorAreaSize(18) { setMouseTracking(true); - + // save the color values in member variables for faster access QSettings settings; m_uiColor = settings.value("uiColor").value(); m_drawColor = settings.value("drawColor").value(); + // extraSize represents the extra space needed for the highlight of the + // selected color. const int extraSize = 6; double radius = (colorList.size()*m_colorAreaSize/1.3)/(3.141592); resize(radius*2 + m_colorAreaSize + extraSize, radius*2 + m_colorAreaSize+ extraSize); double degree = 360 / (colorList.size()); double degreeAcum = degree; - + // this line is the radius of the circle which will be rotated to add + // the color components. QLineF baseLine = QLineF(QPoint(radius+extraSize/2, radius+extraSize/2), QPoint(radius*2, radius)); @@ -44,6 +47,7 @@ void ColorPicker::paintEvent(QPaintEvent *) { QVector rects = handleMask(); painter.setPen(QColor(Qt::black)); for(int i = 0; i < rects.size(); ++i) { + // draw the highlight when we have to draw the selected color if (m_drawColor == QColor(colorList.at(i))) { QColor c = QColor(m_uiColor); c.setAlpha(155); diff --git a/capture/colorpicker.h b/capture/colorpicker.h index 8cffaab5..a78db0b0 100644 --- a/capture/colorpicker.h +++ b/capture/colorpicker.h @@ -9,7 +9,6 @@ class ColorPicker : public QWidget public: explicit ColorPicker(QWidget *parent = 0); ~ColorPicker(); - static QVector colorList; QColor getDrawColor(); @@ -26,6 +25,7 @@ public slots: private: const int m_colorAreaSize; QVector m_colorAreaList; + static QVector colorList; QColor m_uiColor, m_drawColor; }; diff --git a/capture/screenshot.cpp b/capture/screenshot.cpp index 122451e4..27d3d9e9 100644 --- a/capture/screenshot.cpp +++ b/capture/screenshot.cpp @@ -124,7 +124,7 @@ QPixmap Screenshot::paintModifications(const QVector v) { switch (modification.getType()) { case Button::Type::arrow: painter.drawLine(points[0], points[1]); - + // TODO break; case Button::Type::circle: