Address color issues. Fix #71
This commit is contained in:
parent
24b0178b23
commit
3a4ac315b1
@ -143,7 +143,7 @@ void ScreenOverlay::updateMag() {
|
||||
QPointF magnifierPos = cursorPos() + QPointF(5, 5);
|
||||
|
||||
magnifier->setPos(magnifierPos);
|
||||
magnifier->setPixmap(utils::extend(pixmap(), pixCnt, utils::invertColor(highlight()))
|
||||
magnifier->setPixmap(utils::extend(pixmap(), pixCnt, foreground())
|
||||
.copy(magnifierTopLeft.x() + pixCnt, magnifierTopLeft.y() + pixCnt, pixCnt, pixCnt)
|
||||
.scaled(110, 110));
|
||||
QPointF bottomRight = magnifierHintBox->sceneBoundingRect().bottomRight();
|
||||
@ -246,6 +246,7 @@ void ScreenOverlay::loadSettings() {
|
||||
setHighlight(settings::settings().value("highlightColor", QColor(Qt::cyan)).value<QColor>());
|
||||
setMovementPattern(settings::settings().value("movementPattern", MP_HJKL).value<MovementPattern>());
|
||||
setGrid(settings::settings().value("gridEnabled", true).toBool());
|
||||
setForeground(settings::settings().value("foregroundColor", QColor(Qt::white)).value<QColor>());
|
||||
}
|
||||
|
||||
void ScreenOverlay::contextMenuEvent(QGraphicsSceneContextMenuEvent *e) {
|
||||
@ -299,3 +300,12 @@ ScreenOverlay::MovementPattern ScreenOverlay::movementPattern() {
|
||||
bool ScreenOverlay::keyboardActiveSelection() {
|
||||
return selectActive;
|
||||
}
|
||||
|
||||
QColor ScreenOverlay::foreground() {
|
||||
return _foreground;
|
||||
}
|
||||
|
||||
void ScreenOverlay::setForeground(QColor fg) {
|
||||
_foreground = fg;
|
||||
magnifierHint->setDefaultTextColor(fg);
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ public:
|
||||
void updateMagnifierGrid();
|
||||
QColor highlight();
|
||||
void setHighlight(QColor highlight);
|
||||
QColor foreground();
|
||||
void setForeground(QColor foreground);
|
||||
bool grid();
|
||||
void setGrid(bool grid);
|
||||
QPointF cursorPos();
|
||||
@ -64,7 +66,7 @@ private:
|
||||
QGraphicsPolygonItem *cursorItem = nullptr;
|
||||
QList<QGraphicsRectItem *> gridRectsX;
|
||||
QList<QGraphicsRectItem *> gridRectsY;
|
||||
QColor _highlight = Qt::cyan;
|
||||
QColor _highlight = Qt::cyan, _foreground = Qt::white;
|
||||
bool _grid = true;
|
||||
bool selectActive = false;
|
||||
QPixmap _pixmap;
|
||||
|
@ -11,17 +11,30 @@ ScreenOverlaySettings::ScreenOverlaySettings(ScreenOverlay *overlay, QWidget *pa
|
||||
ui->gridBox->setChecked(overlay->grid());
|
||||
ui->movementPattern->setCurrentIndex(overlay->movementPattern());
|
||||
highlight = overlay->highlight();
|
||||
fg = overlay->foreground();
|
||||
ui->preview->setStyleSheet(QString("background-color: %1; color: %2;").arg(highlight.name()).arg(fg.name()));
|
||||
}
|
||||
|
||||
void ScreenOverlaySettings::on_buttonBox_accepted() {
|
||||
settings::settings().setValue("gridEnabled", ui->gridBox->isChecked());
|
||||
settings::settings().setValue("highlightColor", highlight);
|
||||
settings::settings().setValue("foregroundColor", fg);
|
||||
settings::settings().setValue("movementPattern", ui->movementPattern->currentIndex());
|
||||
overlay->loadSettings();
|
||||
}
|
||||
|
||||
void ScreenOverlaySettings::on_fgColor_pressed() {
|
||||
QColor fog = QColorDialog::getColor("Foreground color", this, tr("Foreground color"));
|
||||
if (!fog.isValid()) return;
|
||||
fg = fog;
|
||||
ui->preview->setStyleSheet(QString("background-color: %1; color: %2;").arg(highlight.name()).arg(fg.name()));
|
||||
}
|
||||
|
||||
void ScreenOverlaySettings::on_setHighlight_pressed() {
|
||||
highlight = QColorDialog::getColor(highlight, this, tr("Highlight color"));
|
||||
QColor hl = QColorDialog::getColor(highlight, this, tr("Highlight color"));
|
||||
if (!hl.isValid()) return;
|
||||
highlight = hl;
|
||||
ui->preview->setStyleSheet(QString("background-color: %1; color: %2;").arg(highlight.name()).arg(fg.name()));
|
||||
}
|
||||
|
||||
ScreenOverlaySettings::~ScreenOverlaySettings() {
|
||||
|
@ -18,10 +18,11 @@ public:
|
||||
private slots:
|
||||
void on_buttonBox_accepted();
|
||||
void on_setHighlight_pressed();
|
||||
void on_fgColor_pressed();
|
||||
|
||||
private:
|
||||
Ui::ScreenOverlaySettings *ui;
|
||||
QColor highlight;
|
||||
QColor fg, highlight;
|
||||
ScreenOverlay *overlay;
|
||||
};
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>208</width>
|
||||
<height>179</height>
|
||||
<width>214</width>
|
||||
<height>282</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -48,10 +48,36 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="setHighlight">
|
||||
<property name="text">
|
||||
<string>Set highlight color</string>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Colors</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="setHighlight">
|
||||
<property name="text">
|
||||
<string>Set highlight color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="fgColor">
|
||||
<property name="text">
|
||||
<string>Set foreground color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="preview">
|
||||
<property name="text">
|
||||
<string>Preview</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
Loading…
Reference in New Issue
Block a user