Merge pull request #1360 from namecheap/bugfix/nc_custom-color-is-always-black

Custom color is always black
This commit is contained in:
borgmanJeremy
2021-02-19 12:46:11 -06:00
committed by GitHub
5 changed files with 6 additions and 30 deletions

View File

@@ -117,22 +117,6 @@ QVector<QColor> ConfigHandler::getUserColors()
return colors;
}
void ConfigHandler::setUserColors(const QVector<QColor>& l)
{
QStringList hexColors;
for (const QColor& color : l) {
if (color.isValid()) {
hexColors.append(color.name());
} else {
hexColors.append(QStringLiteral("picker"));
}
}
m_settings.setValue(QStringLiteral("userColors"),
QVariant::fromValue(hexColors));
}
QString ConfigHandler::savePath()
{
return m_settings.value(QStringLiteral("savePath")).toString();
@@ -301,7 +285,7 @@ int ConfigHandler::drawThicknessValue()
return res;
}
void ConfigHandler::setdrawThickness(const int thickness)
void ConfigHandler::setDrawThickness(const int thickness)
{
m_settings.setValue(QStringLiteral("drawThickness"), thickness);
}

View File

@@ -32,7 +32,6 @@ public:
void setButtons(const QVector<CaptureToolButton::ButtonType>&);
QVector<QColor> getUserColors();
void setUserColors(const QVector<QColor>&);
QString savePath();
void setSavePath(const QString&);
@@ -65,7 +64,7 @@ public:
void setDisabledTrayIcon(const bool);
int drawThicknessValue();
void setdrawThickness(const int);
void setDrawThickness(const int);
bool keepOpenAppLauncherValue();
void setKeepOpenAppLauncher(const bool);

View File

@@ -200,7 +200,7 @@ CaptureWidget::~CaptureWidget()
} else {
emit captureFailed(m_id);
}
m_config.setdrawThickness(m_context.thickness);
m_config.setDrawThickness(m_context.thickness);
}
// redefineButtons retrieves the buttons configured to be shown with the
@@ -548,6 +548,7 @@ void CaptureWidget::mouseReleaseEvent(QMouseEvent* e)
m_colorPicker->hide();
m_rightClick = false;
if (!m_context.color.isValid()) {
m_context.color = ConfigHandler().drawColorValue();
m_panel->show();
}
// when we end the drawing we have to register the last point and
@@ -1003,7 +1004,7 @@ void CaptureWidget::decrementCircleCount()
void CaptureWidget::setDrawThickness(const int& t)
{
m_context.thickness = qBound(0, t, 100);
ConfigHandler().setdrawThickness(m_context.thickness);
ConfigHandler().setDrawThickness(m_context.thickness);
emit thicknessChanged(m_context.thickness);
}

View File

@@ -53,11 +53,6 @@ ColorPicker::ColorPicker(QWidget* parent)
}
}
QColor ColorPicker::drawColor()
{
return m_drawColor;
}
void ColorPicker::show()
{
grabMouse();
@@ -131,8 +126,7 @@ void ColorPicker::mouseMoveEvent(QMouseEvent* e)
{
for (int i = 0; i < m_colorList.size(); ++i) {
if (m_colorAreaList.at(i).contains(e->pos())) {
m_drawColor = m_colorList.at(i);
emit colorSelected(m_drawColor);
emit colorSelected(m_colorList.at(i));
update();
break;
}

View File

@@ -25,8 +25,6 @@ class ColorPicker : public QWidget
public:
explicit ColorPicker(QWidget* parent = nullptr);
QColor drawColor();
void show();
void hide();