2017-01-23 15:09:06 +00:00
|
|
|
#include "..\Header\SettingsWindow.h"
|
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
SettingsWindow::SettingsWindow(QWidget * parent)
|
|
|
|
: QWidget(parent)
|
|
|
|
, ui(new Ui::SettingsWindow)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
|
|
setWindowFlags(Qt::Tool | Qt::NoDropShadowWindowHint);
|
|
|
|
|
|
|
|
// light off
|
2017-01-24 10:40:38 +00:00
|
|
|
connect(ui->lightOff_R_LE, &QLineEdit::textChanged, [this](const QString& value){ui->lightOff_R_S->setValue(value.toInt());});
|
|
|
|
connect(ui->lightOff_R_S, &QSlider::valueChanged, [this](const int& value){ui->lightOff_R_LE->setText(QString::number(value));});
|
2017-01-24 16:09:51 +00:00
|
|
|
connect(ui->lightOff_R_S, &QSlider::valueChanged, this, &SettingsWindow::backgroundColorOffChanged);
|
2017-01-23 15:09:06 +00:00
|
|
|
|
2017-01-24 10:40:38 +00:00
|
|
|
connect(ui->lightOff_G_LE, &QLineEdit::textChanged, [this](const QString& value){ui->lightOff_G_S->setValue(value.toInt());});
|
|
|
|
connect(ui->lightOff_G_S, &QSlider::valueChanged, [this](const int& value){ui->lightOff_G_LE->setText(QString::number(value));});
|
2017-01-24 16:09:51 +00:00
|
|
|
connect(ui->lightOff_G_S, &QSlider::valueChanged, this, &SettingsWindow::backgroundColorOffChanged);
|
2017-01-23 15:09:06 +00:00
|
|
|
|
2017-01-24 10:40:38 +00:00
|
|
|
connect(ui->lightOff_B_LE, &QLineEdit::textChanged, [this](const QString& value){ui->lightOff_B_S->setValue(value.toInt());});
|
|
|
|
connect(ui->lightOff_B_S, &QSlider::valueChanged, [this](const int& value){ui->lightOff_B_LE->setText(QString::number(value));});
|
2017-01-24 16:09:51 +00:00
|
|
|
connect(ui->lightOff_B_S, &QSlider::valueChanged, this, &SettingsWindow::backgroundColorOffChanged);
|
2017-01-23 15:09:06 +00:00
|
|
|
|
|
|
|
// light on
|
2017-01-24 10:40:38 +00:00
|
|
|
connect(ui->lightOn_R_LE, &QLineEdit::textChanged, [this](const QString& value){ui->lightOn_R_S->setValue(value.toInt());});
|
|
|
|
connect(ui->lightOn_R_S, &QSlider::valueChanged, [this](const int& value){ui->lightOn_R_LE->setText(QString::number(value));});
|
2017-01-24 16:09:51 +00:00
|
|
|
connect(ui->lightOn_R_S, &QSlider::valueChanged, this, &SettingsWindow::backgroundColorOnChanged);
|
2017-01-23 15:09:06 +00:00
|
|
|
|
2017-01-24 10:40:38 +00:00
|
|
|
connect(ui->lightOn_G_LE, &QLineEdit::textChanged, [this](const QString& value){ui->lightOn_G_S->setValue(value.toInt());});
|
|
|
|
connect(ui->lightOn_G_S, &QSlider::valueChanged, [this](const int& value){ui->lightOn_G_LE->setText(QString::number(value));});
|
2017-01-24 16:09:51 +00:00
|
|
|
connect(ui->lightOn_G_S, &QSlider::valueChanged, this, &SettingsWindow::backgroundColorOnChanged);
|
2017-01-23 15:09:06 +00:00
|
|
|
|
2017-01-24 10:40:38 +00:00
|
|
|
connect(ui->lightOn_B_LE, &QLineEdit::textChanged, [this](const QString& value){ui->lightOn_B_S->setValue(value.toInt());});
|
|
|
|
connect(ui->lightOn_B_S, &QSlider::valueChanged, [this](const int& value){ui->lightOn_B_LE->setText(QString::number(value));});
|
2017-01-24 16:09:51 +00:00
|
|
|
connect(ui->lightOn_B_S, &QSlider::valueChanged, this, &SettingsWindow::backgroundColorOnChanged);
|
2017-01-23 15:09:06 +00:00
|
|
|
|
|
|
|
// light
|
2017-01-24 10:40:38 +00:00
|
|
|
connect(ui->light_R_LE, &QLineEdit::textChanged, [this](const QString& value){ui->light_R_S->setValue(value.toInt());});
|
2017-01-24 16:09:51 +00:00
|
|
|
connect(ui->light_R_S, &QSlider::valueChanged, [this](const int& value){ui->light_R_LE->setText(QString::number(value)); if(ui->checkAutoColor->isChecked()) ui->lightOn_R_S->setValue((int)(value / 50));});
|
|
|
|
connect(ui->light_R_S, &QSlider::valueChanged, this, &SettingsWindow::lightColorChanged);
|
2017-01-23 15:09:06 +00:00
|
|
|
|
2017-01-24 10:40:38 +00:00
|
|
|
connect(ui->light_G_LE, &QLineEdit::textChanged, [this](const QString& value){ui->light_G_S->setValue(value.toInt());});
|
2017-01-24 16:09:51 +00:00
|
|
|
connect(ui->light_G_S, &QSlider::valueChanged, [this](const int& value){ui->light_G_LE->setText(QString::number(value)); if(ui->checkAutoColor->isChecked()) ui->lightOn_G_S->setValue((int)(value / 50));});
|
|
|
|
connect(ui->light_G_S, &QSlider::valueChanged, this, &SettingsWindow::lightColorChanged);
|
2017-01-23 15:09:06 +00:00
|
|
|
|
2017-01-24 10:40:38 +00:00
|
|
|
connect(ui->light_B_LE, &QLineEdit::textChanged, [this](const QString& value){ui->light_B_S->setValue(value.toInt());});
|
2017-01-24 16:09:51 +00:00
|
|
|
connect(ui->light_B_S, &QSlider::valueChanged, [this](const int& value){ui->light_B_LE->setText(QString::number(value)); if(ui->checkAutoColor->isChecked()) ui->lightOn_B_S->setValue((int)(value / 50));});
|
|
|
|
connect(ui->light_B_S, &QSlider::valueChanged, this, &SettingsWindow::lightColorChanged);
|
2017-01-23 15:09:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
connect(ui->checkAutoColor, &QCheckBox::toggled, this, &SettingsWindow::autoColorToggled);
|
|
|
|
connect(ui->radioDirectLight, &QRadioButton::toggled, this, &SettingsWindow::radioToggled);
|
2017-01-24 16:09:51 +00:00
|
|
|
connect(ui->ambCoef, static_cast<void(QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), [this](double value) {emit updateAmbCoef(value); });
|
|
|
|
connect(ui->attFac, static_cast<void(QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), [this](double value) {emit updateAttFac(value); });
|
2017-01-23 15:09:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SettingsWindow::~SettingsWindow()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2017-01-24 10:40:38 +00:00
|
|
|
// connection slots
|
2017-01-23 15:09:06 +00:00
|
|
|
|
|
|
|
void SettingsWindow::autoColorToggled()
|
|
|
|
{
|
|
|
|
if (!ui->checkAutoColor->isChecked())
|
|
|
|
{
|
|
|
|
ui->lightOn_R_LE->setEnabled(true);
|
|
|
|
ui->lightOn_R_S->setEnabled(true);
|
|
|
|
ui->lightOn_G_LE->setEnabled(true);
|
|
|
|
ui->lightOn_G_S->setEnabled(true);
|
|
|
|
ui->lightOn_B_LE->setEnabled(true);
|
|
|
|
ui->lightOn_B_S->setEnabled(true);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ui->lightOn_R_LE->setEnabled(false);
|
|
|
|
ui->lightOn_R_S->setEnabled(false);
|
|
|
|
ui->lightOn_G_LE->setEnabled(false);
|
|
|
|
ui->lightOn_G_S->setEnabled(false);
|
|
|
|
ui->lightOn_B_LE->setEnabled(false);
|
|
|
|
ui->lightOn_B_S->setEnabled(false);
|
|
|
|
|
|
|
|
ui->lightOn_R_LE->setText(QString::number((int)(ui->light_R_S->value() / 50)));
|
|
|
|
ui->lightOn_R_S->setValue((int)(ui->light_R_S->value() / 50));
|
|
|
|
ui->lightOn_G_LE->setText(QString::number((int)(ui->light_G_S->value() / 50)));
|
|
|
|
ui->lightOn_G_S->setValue((int)(ui->light_G_S->value() / 50));
|
|
|
|
ui->lightOn_B_LE->setText(QString::number((int)(ui->light_B_S->value() / 50)));
|
|
|
|
ui->lightOn_B_S->setValue((int)(ui->light_B_S->value() / 50));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SettingsWindow::radioToggled()
|
|
|
|
{
|
|
|
|
if(ui->radioDirectLight->isChecked())
|
|
|
|
{
|
|
|
|
ui->attFac->setValue(0.0);
|
|
|
|
ui->attFac->setEnabled(false);
|
2017-01-24 16:09:51 +00:00
|
|
|
ui->ambCoef->setEnabled(false);
|
2017-01-23 15:09:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ui->attFac->setEnabled(true);
|
2017-01-24 16:09:51 +00:00
|
|
|
ui->ambCoef->setEnabled(true);
|
2017-01-23 15:09:06 +00:00
|
|
|
}
|
|
|
|
}
|
2017-01-24 16:09:51 +00:00
|
|
|
|
|
|
|
void SettingsWindow::backgroundColorOffChanged()
|
|
|
|
{
|
|
|
|
emit updateBGColorOff(QVector3D(ui->lightOff_R_S->value(), ui->lightOff_G_S->value(), ui->lightOff_B_S->value()));
|
|
|
|
}
|
|
|
|
|
|
|
|
void SettingsWindow::backgroundColorOnChanged()
|
|
|
|
{
|
|
|
|
emit updateBGColorOn(QVector3D(ui->lightOn_R_S->value(), ui->lightOn_G_S->value(), ui->lightOn_B_S->value()));
|
|
|
|
}
|
|
|
|
|
|
|
|
void SettingsWindow::lightColorChanged()
|
|
|
|
{
|
|
|
|
emit updateLightColor(QVector3D(ui->light_R_S->value(), ui->light_G_S->value(), ui->light_B_S->value()));
|
|
|
|
}
|
|
|
|
|