2017-12-06 14:08:49 +01:00
|
|
|
#include "screenoverlaysettings.hpp"
|
|
|
|
#include "ui_screenoverlaysettings.h"
|
|
|
|
|
|
|
|
#include <QColorDialog>
|
2018-02-18 02:35:29 +01:00
|
|
|
#include <settings.hpp>
|
2017-12-06 14:08:49 +01:00
|
|
|
|
|
|
|
ScreenOverlaySettings::ScreenOverlaySettings(ScreenOverlay *overlay, QWidget *parent)
|
2017-12-08 12:26:26 +01:00
|
|
|
: QDialog(parent), ui(new Ui::ScreenOverlaySettings), overlay(overlay) {
|
2017-12-06 14:08:49 +01:00
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
|
|
ui->gridBox->setChecked(overlay->grid());
|
|
|
|
ui->movementPattern->setCurrentIndex(overlay->movementPattern());
|
|
|
|
highlight = overlay->highlight();
|
2018-05-09 23:28:36 +02:00
|
|
|
fg = overlay->foreground();
|
|
|
|
ui->preview->setStyleSheet(QString("background-color: %1; color: %2;").arg(highlight.name()).arg(fg.name()));
|
2017-12-06 14:08:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScreenOverlaySettings::on_buttonBox_accepted() {
|
|
|
|
settings::settings().setValue("gridEnabled", ui->gridBox->isChecked());
|
|
|
|
settings::settings().setValue("highlightColor", highlight);
|
2018-05-09 23:28:36 +02:00
|
|
|
settings::settings().setValue("foregroundColor", fg);
|
2017-12-06 14:08:49 +01:00
|
|
|
settings::settings().setValue("movementPattern", ui->movementPattern->currentIndex());
|
|
|
|
overlay->loadSettings();
|
|
|
|
}
|
|
|
|
|
2018-05-09 23:28:36 +02:00
|
|
|
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()));
|
|
|
|
}
|
|
|
|
|
2017-12-06 14:08:49 +01:00
|
|
|
void ScreenOverlaySettings::on_setHighlight_pressed() {
|
2018-05-09 23:28:36 +02:00
|
|
|
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()));
|
2017-12-06 14:08:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ScreenOverlaySettings::~ScreenOverlaySettings() {
|
|
|
|
delete ui;
|
|
|
|
}
|