Add a few comments

This commit is contained in:
lupoDharkael
2017-05-18 03:07:14 +02:00
parent 1dc2220afb
commit 2e41b8c411
4 changed files with 9 additions and 5 deletions

View File

@@ -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<QColor>();
show();

View File

@@ -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<QColor>();
m_drawColor = settings.value("drawColor").value<QColor>();
// 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<QRect> 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);

View File

@@ -9,7 +9,6 @@ class ColorPicker : public QWidget
public:
explicit ColorPicker(QWidget *parent = 0);
~ColorPicker();
static QVector<Qt::GlobalColor> colorList;
QColor getDrawColor();
@@ -26,6 +25,7 @@ public slots:
private:
const int m_colorAreaSize;
QVector<QRect> m_colorAreaList;
static QVector<Qt::GlobalColor> colorList;
QColor m_uiColor, m_drawColor;
};

View File

@@ -124,7 +124,7 @@ QPixmap Screenshot::paintModifications(const QVector<CaptureModification> v) {
switch (modification.getType()) {
case Button::Type::arrow:
painter.drawLine(points[0], points[1]);
// TODO
break;
case Button::Type::circle: