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);
|
QPointF magnifierPos = cursorPos() + QPointF(5, 5);
|
||||||
|
|
||||||
magnifier->setPos(magnifierPos);
|
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)
|
.copy(magnifierTopLeft.x() + pixCnt, magnifierTopLeft.y() + pixCnt, pixCnt, pixCnt)
|
||||||
.scaled(110, 110));
|
.scaled(110, 110));
|
||||||
QPointF bottomRight = magnifierHintBox->sceneBoundingRect().bottomRight();
|
QPointF bottomRight = magnifierHintBox->sceneBoundingRect().bottomRight();
|
||||||
@ -246,6 +246,7 @@ void ScreenOverlay::loadSettings() {
|
|||||||
setHighlight(settings::settings().value("highlightColor", QColor(Qt::cyan)).value<QColor>());
|
setHighlight(settings::settings().value("highlightColor", QColor(Qt::cyan)).value<QColor>());
|
||||||
setMovementPattern(settings::settings().value("movementPattern", MP_HJKL).value<MovementPattern>());
|
setMovementPattern(settings::settings().value("movementPattern", MP_HJKL).value<MovementPattern>());
|
||||||
setGrid(settings::settings().value("gridEnabled", true).toBool());
|
setGrid(settings::settings().value("gridEnabled", true).toBool());
|
||||||
|
setForeground(settings::settings().value("foregroundColor", QColor(Qt::white)).value<QColor>());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenOverlay::contextMenuEvent(QGraphicsSceneContextMenuEvent *e) {
|
void ScreenOverlay::contextMenuEvent(QGraphicsSceneContextMenuEvent *e) {
|
||||||
@ -299,3 +300,12 @@ ScreenOverlay::MovementPattern ScreenOverlay::movementPattern() {
|
|||||||
bool ScreenOverlay::keyboardActiveSelection() {
|
bool ScreenOverlay::keyboardActiveSelection() {
|
||||||
return selectActive;
|
return selectActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QColor ScreenOverlay::foreground() {
|
||||||
|
return _foreground;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenOverlay::setForeground(QColor fg) {
|
||||||
|
_foreground = fg;
|
||||||
|
magnifierHint->setDefaultTextColor(fg);
|
||||||
|
}
|
||||||
|
@ -21,6 +21,8 @@ public:
|
|||||||
void updateMagnifierGrid();
|
void updateMagnifierGrid();
|
||||||
QColor highlight();
|
QColor highlight();
|
||||||
void setHighlight(QColor highlight);
|
void setHighlight(QColor highlight);
|
||||||
|
QColor foreground();
|
||||||
|
void setForeground(QColor foreground);
|
||||||
bool grid();
|
bool grid();
|
||||||
void setGrid(bool grid);
|
void setGrid(bool grid);
|
||||||
QPointF cursorPos();
|
QPointF cursorPos();
|
||||||
@ -64,7 +66,7 @@ private:
|
|||||||
QGraphicsPolygonItem *cursorItem = nullptr;
|
QGraphicsPolygonItem *cursorItem = nullptr;
|
||||||
QList<QGraphicsRectItem *> gridRectsX;
|
QList<QGraphicsRectItem *> gridRectsX;
|
||||||
QList<QGraphicsRectItem *> gridRectsY;
|
QList<QGraphicsRectItem *> gridRectsY;
|
||||||
QColor _highlight = Qt::cyan;
|
QColor _highlight = Qt::cyan, _foreground = Qt::white;
|
||||||
bool _grid = true;
|
bool _grid = true;
|
||||||
bool selectActive = false;
|
bool selectActive = false;
|
||||||
QPixmap _pixmap;
|
QPixmap _pixmap;
|
||||||
|
@ -11,17 +11,30 @@ ScreenOverlaySettings::ScreenOverlaySettings(ScreenOverlay *overlay, QWidget *pa
|
|||||||
ui->gridBox->setChecked(overlay->grid());
|
ui->gridBox->setChecked(overlay->grid());
|
||||||
ui->movementPattern->setCurrentIndex(overlay->movementPattern());
|
ui->movementPattern->setCurrentIndex(overlay->movementPattern());
|
||||||
highlight = overlay->highlight();
|
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() {
|
void ScreenOverlaySettings::on_buttonBox_accepted() {
|
||||||
settings::settings().setValue("gridEnabled", ui->gridBox->isChecked());
|
settings::settings().setValue("gridEnabled", ui->gridBox->isChecked());
|
||||||
settings::settings().setValue("highlightColor", highlight);
|
settings::settings().setValue("highlightColor", highlight);
|
||||||
|
settings::settings().setValue("foregroundColor", fg);
|
||||||
settings::settings().setValue("movementPattern", ui->movementPattern->currentIndex());
|
settings::settings().setValue("movementPattern", ui->movementPattern->currentIndex());
|
||||||
overlay->loadSettings();
|
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() {
|
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() {
|
ScreenOverlaySettings::~ScreenOverlaySettings() {
|
||||||
|
@ -18,10 +18,11 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void on_buttonBox_accepted();
|
void on_buttonBox_accepted();
|
||||||
void on_setHighlight_pressed();
|
void on_setHighlight_pressed();
|
||||||
|
void on_fgColor_pressed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ScreenOverlaySettings *ui;
|
Ui::ScreenOverlaySettings *ui;
|
||||||
QColor highlight;
|
QColor fg, highlight;
|
||||||
ScreenOverlay *overlay;
|
ScreenOverlay *overlay;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>208</width>
|
<width>214</width>
|
||||||
<height>179</height>
|
<height>282</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -48,10 +48,36 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="setHighlight">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="text">
|
<property name="title">
|
||||||
<string>Set highlight color</string>
|
<string>Colors</string>
|
||||||
</property>
|
</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>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
Loading…
Reference in New Issue
Block a user