added overlay alpha to overlay settings

This commit is contained in:
Niklas 2019-05-09 19:34:57 +02:00
parent 53f79673ee
commit 9134c726cb
4 changed files with 48 additions and 4 deletions

View File

@ -105,8 +105,7 @@ CropScene::CropScene(QObject *parent, QPixmap pixmap)
poly.append(prect.bottomRight());
poly.append(prect.bottomLeft());
polyItem = new QGraphicsPolygonItem(poly);
// TODO: Add Alpha Setting in screen overlay setting
polyItem->setBrush(QBrush(QColor(0, 0, 0, 96)));
polyItem->setBrush(QBrush(QColor(0, 0, 0, settings::settings().value("overlayAlpha", 96).toInt())));
polyItem->setPen(QPen(Qt::NoPen));
polyItem->setZValue(1);
addItem(polyItem);

View File

@ -10,6 +10,11 @@ ScreenOverlaySettings::ScreenOverlaySettings(ScreenOverlay *overlay, QWidget *pa
ui->gridBox->setChecked(overlay->grid());
ui->movementPattern->setCurrentIndex(overlay->movementPattern());
int overlayAlpha = settings::settings().value("overlayAlpha", 96).toInt();
ui->overlayAlphaSlider->setValue(overlayAlpha);
ui->overlayAlphaSpinner->setValue(overlayAlpha);
highlight = overlay->highlight();
fg = overlay->foreground();
ui->preview->setStyleSheet(QString("background-color: %1; color: %2;").arg(highlight.name()).arg(fg.name()));
@ -20,6 +25,8 @@ void ScreenOverlaySettings::on_buttonBox_accepted() {
settings::settings().setValue("highlightColor", highlight);
settings::settings().setValue("foregroundColor", fg);
settings::settings().setValue("movementPattern", ui->movementPattern->currentIndex());
settings::settings().setValue("overlayAlpha", ui->overlayAlphaSpinner->value());
overlay->loadSettings();
}
@ -37,6 +44,14 @@ void ScreenOverlaySettings::on_setHighlight_pressed() {
ui->preview->setStyleSheet(QString("background-color: %1; color: %2;").arg(highlight.name()).arg(fg.name()));
}
void ScreenOverlaySettings::on_overlayAlphaSlider_sliderMoved(int position) {
ui->overlayAlphaSpinner->setValue(position);
}
void ScreenOverlaySettings::on_overlayAlphaSpinner_valueChanged(int arg1) {
ui->overlayAlphaSlider->setValue(arg1);
}
ScreenOverlaySettings::~ScreenOverlaySettings() {
delete ui;
}

View File

@ -19,6 +19,8 @@ private slots:
void on_buttonBox_accepted();
void on_setHighlight_pressed();
void on_fgColor_pressed();
void on_overlayAlphaSpinner_valueChanged(int arg);
void on_overlayAlphaSlider_sliderMoved(int arg);
private:
Ui::ScreenOverlaySettings *ui;

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>214</width>
<height>282</height>
<width>211</width>
<height>356</height>
</rect>
</property>
<property name="windowTitle">
@ -47,6 +47,34 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Overlay Alpha</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSlider" name="overlayAlphaSlider">
<property name="maximum">
<number>255</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="overlayAlphaSpinner">
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">