added settings window,
connected all slider, lineEdits, checkboxes,..., need to connect everything with the OglViewerWidget now
This commit is contained in:
parent
0a9103fdc5
commit
73ee8a4040
|
@ -0,0 +1,479 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SettingsWindow</class>
|
||||
<widget class="QWidget" name="SettingsWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBackground">
|
||||
<property name="title">
|
||||
<string>Background</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="4" column="5">
|
||||
<widget class="QLineEdit" name="lightOn_G_LE">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>5</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="7">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>B:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="6">
|
||||
<widget class="QSlider" name="lightOn_G_S">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="9">
|
||||
<widget class="QSlider" name="lightOn_B_S">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3" colspan="3">
|
||||
<widget class="QCheckBox" name="checkAutoColor">
|
||||
<property name="text">
|
||||
<string>auto color</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="8">
|
||||
<widget class="QLineEdit" name="lightOn_B_LE">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>5</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_0">
|
||||
<property name="text">
|
||||
<string>R:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="4">
|
||||
<widget class="QLabel" name="label_1">
|
||||
<property name="text">
|
||||
<string>G:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="7">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>B:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="5">
|
||||
<widget class="QLineEdit" name="lightOff_G_LE">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>204</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="8">
|
||||
<widget class="QLineEdit" name="lightOff_B_LE">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>255</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="9">
|
||||
<widget class="QSlider" name="lightOff_B_S">
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLineEdit" name="lightOff_R_LE">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>127</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="6">
|
||||
<widget class="QSlider" name="lightOff_G_S">
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>204</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QSlider" name="lightOff_R_S">
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>127</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<widget class="QLabel" name="labelLightOn">
|
||||
<property name="text">
|
||||
<string>Light on:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="10">
|
||||
<widget class="QLabel" name="labelLightOff">
|
||||
<property name="text">
|
||||
<string>Light off:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>R:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QLineEdit" name="lightOn_R_LE">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>5</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QSlider" name="lightOn_R_S">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="4">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>G:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="5">
|
||||
<spacer name="verticalSpacerBackground">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QGroupBox" name="groupLight">
|
||||
<property name="title">
|
||||
<string>Light</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="2" column="0" colspan="4">
|
||||
<widget class="QLabel" name="labelAmbCoeff">
|
||||
<property name="text">
|
||||
<string>Ambientcoefficient:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="4">
|
||||
<widget class="QLabel" name="labelAttFac">
|
||||
<property name="text">
|
||||
<string>Attenuationfactor:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>B:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>G:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QLineEdit" name="light_G_LE">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>255</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="light_R_LE">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>255</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="4">
|
||||
<widget class="QRadioButton" name="radioDirectLight">
|
||||
<property name="text">
|
||||
<string>Directional light</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="7">
|
||||
<widget class="QLineEdit" name="light_B_LE">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>255</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>R:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QSlider" name="light_R_S">
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="8">
|
||||
<widget class="QSlider" name="light_B_S">
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<widget class="QSlider" name="light_G_S">
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="4">
|
||||
<spacer name="verticalSpacerLight">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="4" colspan="2">
|
||||
<widget class="QDoubleSpinBox" name="attFac">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>55</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="4" colspan="2">
|
||||
<widget class="QDoubleSpinBox" name="ambCoef">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>55</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.001000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.005000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4" colspan="4">
|
||||
<widget class="QRadioButton" name="radioPointLight">
|
||||
<property name="text">
|
||||
<string>Point light</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "geometryengine.h"
|
||||
|
||||
#include "..\Header\SettingsWindow.h"
|
||||
#include <QOpenGLWidget>
|
||||
#include <QOpenGLFunctions>
|
||||
#include <QMatrix4x4>
|
||||
|
@ -40,10 +40,12 @@ private:
|
|||
struct {
|
||||
QVector4D position = { 1,1,1,0 };
|
||||
QVector3D intensities = { 1.0,1.0,1.0 };
|
||||
float attenuationFactor = 0.2f;
|
||||
float attenuationFactor = 0.0f;
|
||||
float ambientCoefficient = 0.005f;
|
||||
} m_light;
|
||||
|
||||
SettingsWindow* m_settings;
|
||||
|
||||
QVector4D m_backgroundColor = {0.5f, 0.8f, 1.0f, 1.0f};
|
||||
|
||||
QOpenGLShaderProgram m_program;
|
||||
|
@ -83,6 +85,7 @@ public slots:
|
|||
void changeDirection(int direction);
|
||||
void toggleWireframe();
|
||||
void toggleLight();
|
||||
void showSettings();
|
||||
|
||||
signals:
|
||||
void sendMessage(QString message, int severity);
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
#pragma once
|
||||
#include <QWidget>
|
||||
#include "ui_SettingsWindow.h"
|
||||
|
||||
class SettingsWindow : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SettingsWindow(QWidget * parent = Q_NULLPTR);
|
||||
~SettingsWindow();
|
||||
|
||||
private:
|
||||
Ui::SettingsWindow* ui;
|
||||
|
||||
private slots:
|
||||
// light off
|
||||
void lightOffRValueChanged(QString value);
|
||||
void lightOffRValueChanged(int value);
|
||||
|
||||
void lightOffGValueChanged(QString value);
|
||||
void lightOffGValueChanged(int value);
|
||||
|
||||
void lightOffBValueChanged(QString value);
|
||||
void lightOffBValueChanged(int value);
|
||||
|
||||
// light on
|
||||
void lightOnRValueChanged(QString value);
|
||||
void lightOnRValueChanged(int value);
|
||||
|
||||
void lightOnGValueChanged(QString value);
|
||||
void lightOnGValueChanged(int value);
|
||||
|
||||
void lightOnBValueChanged(QString value);
|
||||
void lightOnBValueChanged(int value);
|
||||
|
||||
// light
|
||||
void lightRValueChanged(QString value);
|
||||
void lightRValueChanged(int value);
|
||||
|
||||
void lightGValueChanged(QString value);
|
||||
void lightGValueChanged(int value);
|
||||
|
||||
void lightBValueChanged(QString value);
|
||||
void lightBValueChanged(int value);
|
||||
|
||||
void autoColorToggled();
|
||||
|
||||
void radioToggled();
|
||||
};
|
|
@ -42,16 +42,15 @@ void main()
|
|||
if(light.position.w == 0)
|
||||
{
|
||||
surfaceToLight = normalize(light.position.xyz);
|
||||
attenuation = 1;
|
||||
}
|
||||
// point light
|
||||
else
|
||||
{
|
||||
surfaceToLight = normalize(light.position.xyz - v_surfacePosition);
|
||||
|
||||
float distanceToLight = length(light.position.xyz - v_surfacePosition);
|
||||
attenuation = 1.0 / (1.0 + light.attenuationFactor * pow(distanceToLight, 2));
|
||||
}
|
||||
|
||||
float distanceToLight = length(light.position.xyz - v_surfacePosition);
|
||||
attenuation = 1.0 / (1.0 + light.attenuationFactor * pow(distanceToLight, 2));
|
||||
|
||||
vec3 surfaceToCamera = normalize(cameraPosition - v_surfacePosition);
|
||||
|
||||
|
|
|
@ -127,6 +127,12 @@ void MainWindow::setupWidgets()
|
|||
connect(light, &QToolButton::pressed, viewer, &OglViewerWidget::toggleLight);
|
||||
ui->mainToolBar->addWidget(light);
|
||||
|
||||
QToolButton *settings = new QToolButton(this);
|
||||
settings->setObjectName("settings");
|
||||
settings->setToolTip("settings");
|
||||
connect(settings, &QToolButton::pressed, viewer, &OglViewerWidget::showSettings);
|
||||
ui->mainToolBar->addWidget(settings);
|
||||
|
||||
ui->mainToolBar->addSeparator();
|
||||
|
||||
QToolButton *fileInfo = new QToolButton(this);
|
||||
|
|
|
@ -12,9 +12,10 @@
|
|||
/////////////////////////////////////////////////////////////////////////
|
||||
// public constructor/destructor
|
||||
|
||||
OglViewerWidget::OglViewerWidget(QWidget *parent) :
|
||||
QOpenGLWidget(parent),
|
||||
m_dataEngine(0)
|
||||
OglViewerWidget::OglViewerWidget(QWidget *parent)
|
||||
: QOpenGLWidget(parent)
|
||||
, m_dataEngine(0)
|
||||
, m_settings(new SettingsWindow(this))
|
||||
{
|
||||
setFocus();
|
||||
m_translation.setZ(DEFAULT_Z_DISTANCE);
|
||||
|
@ -29,6 +30,8 @@ OglViewerWidget::~OglViewerWidget()
|
|||
makeCurrent();
|
||||
delete m_dataEngine;
|
||||
doneCurrent();
|
||||
|
||||
delete m_settings;
|
||||
}
|
||||
|
||||
|
||||
|
@ -363,3 +366,8 @@ void OglViewerWidget::toggleLight()
|
|||
|
||||
update();
|
||||
}
|
||||
|
||||
void OglViewerWidget::showSettings()
|
||||
{
|
||||
m_settings->show();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,237 @@
|
|||
#include "..\Header\SettingsWindow.h"
|
||||
#include <QString>
|
||||
#include <QLineEdit>
|
||||
#include <QSlider>
|
||||
|
||||
SettingsWindow::SettingsWindow(QWidget * parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::SettingsWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
setWindowFlags(Qt::Tool | Qt::NoDropShadowWindowHint);
|
||||
|
||||
// light off
|
||||
connect(ui->lightOff_R_LE, SIGNAL(textChanged(QString)), this, SLOT(lightOffRValueChanged(QString)));
|
||||
connect(ui->lightOff_R_S, SIGNAL(valueChanged(int)), this, SLOT(lightOffRValueChanged(int)));
|
||||
|
||||
connect(ui->lightOff_G_LE, SIGNAL(textChanged(QString)), this, SLOT(lightOffGValueChanged(QString)));
|
||||
connect(ui->lightOff_G_S, SIGNAL(valueChanged(int)), this, SLOT(lightOffGValueChanged(int)));
|
||||
|
||||
connect(ui->lightOff_B_LE, SIGNAL(textChanged(QString)), this, SLOT(lightOffBValueChanged(QString)));
|
||||
connect(ui->lightOff_B_S, SIGNAL(valueChanged(int)), this, SLOT(lightOffBValueChanged(int)));
|
||||
|
||||
// light on
|
||||
connect(ui->lightOn_R_LE, SIGNAL(textChanged(QString)), this, SLOT(lightOnRValueChanged(QString)));
|
||||
connect(ui->lightOn_R_S, SIGNAL(valueChanged(int)), this, SLOT(lightOnRValueChanged(int)));
|
||||
|
||||
connect(ui->lightOn_G_LE, SIGNAL(textChanged(QString)), this, SLOT(lightOnGValueChanged(QString)));
|
||||
connect(ui->lightOn_G_S, SIGNAL(valueChanged(int)), this, SLOT(lightOnGValueChanged(int)));
|
||||
|
||||
connect(ui->lightOn_B_LE, SIGNAL(textChanged(QString)), this, SLOT(lightOnBValueChanged(QString)));
|
||||
connect(ui->lightOn_B_S, SIGNAL(valueChanged(int)), this, SLOT(lightOnBValueChanged(int)));
|
||||
|
||||
// light
|
||||
connect(ui->light_R_LE, SIGNAL(textChanged(QString)), this, SLOT(lightRValueChanged(QString)));
|
||||
connect(ui->light_R_S, SIGNAL(valueChanged(int)), this, SLOT(lightRValueChanged(int)));
|
||||
|
||||
connect(ui->light_G_LE, SIGNAL(textChanged(QString)), this, SLOT(lightGValueChanged(QString)));
|
||||
connect(ui->light_G_S, SIGNAL(valueChanged(int)), this, SLOT(lightGValueChanged(int)));
|
||||
|
||||
connect(ui->light_B_LE, SIGNAL(textChanged(QString)), this, SLOT(lightBValueChanged(QString)));
|
||||
connect(ui->light_B_S, SIGNAL(valueChanged(int)), this, SLOT(lightBValueChanged(int)));
|
||||
|
||||
|
||||
connect(ui->checkAutoColor, &QCheckBox::toggled, this, &SettingsWindow::autoColorToggled);
|
||||
|
||||
connect(ui->radioDirectLight, &QRadioButton::toggled, this, &SettingsWindow::radioToggled);
|
||||
}
|
||||
|
||||
SettingsWindow::~SettingsWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Slider - LineEdit connections
|
||||
|
||||
#pragma region light off
|
||||
|
||||
void SettingsWindow::lightOffRValueChanged(QString value)
|
||||
{
|
||||
ui->lightOff_R_S->setValue(value.toInt());
|
||||
}
|
||||
|
||||
void SettingsWindow::lightOffRValueChanged(int value)
|
||||
{
|
||||
ui->lightOff_R_LE->setText(QString::number(value));
|
||||
}
|
||||
|
||||
void SettingsWindow::lightOffGValueChanged(QString value)
|
||||
{
|
||||
ui->lightOff_G_S->setValue(value.toInt());
|
||||
}
|
||||
|
||||
void SettingsWindow::lightOffGValueChanged(int value)
|
||||
{
|
||||
ui->lightOff_G_LE->setText(QString::number(value));
|
||||
}
|
||||
|
||||
void SettingsWindow::lightOffBValueChanged(QString value)
|
||||
{
|
||||
ui->lightOff_B_S->setValue(value.toInt());
|
||||
}
|
||||
|
||||
void SettingsWindow::lightOffBValueChanged(int value)
|
||||
{
|
||||
ui->lightOff_B_LE->setText(QString::number(value));
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region light on
|
||||
|
||||
void SettingsWindow::lightOnRValueChanged(QString value)
|
||||
{
|
||||
ui->lightOn_R_S->setValue(value.toInt());
|
||||
}
|
||||
|
||||
void SettingsWindow::lightOnRValueChanged(int value)
|
||||
{
|
||||
ui->lightOn_R_LE->setText(QString::number(value));
|
||||
}
|
||||
|
||||
void SettingsWindow::lightOnGValueChanged(QString value)
|
||||
{
|
||||
ui->lightOn_G_S->setValue(value.toInt());
|
||||
}
|
||||
|
||||
void SettingsWindow::lightOnGValueChanged(int value)
|
||||
{
|
||||
ui->lightOn_G_LE->setText(QString::number(value));
|
||||
}
|
||||
|
||||
void SettingsWindow::lightOnBValueChanged(QString value)
|
||||
{
|
||||
ui->lightOn_B_S->setValue(value.toInt());
|
||||
}
|
||||
|
||||
void SettingsWindow::lightOnBValueChanged(int value)
|
||||
{
|
||||
ui->lightOn_B_LE->setText(QString::number(value));
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region light
|
||||
|
||||
void SettingsWindow::lightRValueChanged(QString value)
|
||||
{
|
||||
ui->light_R_S->setValue(value.toInt());
|
||||
|
||||
if (ui->checkAutoColor->isChecked())
|
||||
{
|
||||
ui->lightOn_R_LE->setText(QString::number((int)(value.toInt() / 50)));
|
||||
ui->lightOn_R_S->setValue((int)(value.toInt() / 50));
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsWindow::lightRValueChanged(int value)
|
||||
{
|
||||
ui->light_R_LE->setText(QString::number(value));
|
||||
|
||||
if (ui->checkAutoColor->isChecked())
|
||||
{
|
||||
ui->lightOn_R_LE->setText(QString::number((int)(value / 50)));
|
||||
ui->lightOn_R_S->setValue((int)(value / 50));
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsWindow::lightGValueChanged(QString value)
|
||||
{
|
||||
ui->light_G_S->setValue(value.toInt());
|
||||
|
||||
if (ui->checkAutoColor->isChecked())
|
||||
{
|
||||
ui->lightOn_G_LE->setText(QString::number((int)(value.toInt() / 50)));
|
||||
ui->lightOn_G_S->setValue((int)(value.toInt() / 50));
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsWindow::lightGValueChanged(int value)
|
||||
{
|
||||
ui->light_G_LE->setText(QString::number(value));
|
||||
|
||||
if (ui->checkAutoColor->isChecked())
|
||||
{
|
||||
ui->lightOn_G_LE->setText(QString::number((int)(value / 50)));
|
||||
ui->lightOn_G_S->setValue((int)(value / 50));
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsWindow::lightBValueChanged(QString value)
|
||||
{
|
||||
ui->light_B_S->setValue(value.toInt());
|
||||
|
||||
if (ui->checkAutoColor->isChecked())
|
||||
{
|
||||
ui->lightOn_B_LE->setText(QString::number((int)(value.toInt() / 50)));
|
||||
ui->lightOn_B_S->setValue((int)(value.toInt() / 50));
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsWindow::lightBValueChanged(int value)
|
||||
{
|
||||
ui->light_B_LE->setText(QString::number(value));
|
||||
|
||||
if (ui->checkAutoColor->isChecked())
|
||||
{
|
||||
ui->lightOn_B_LE->setText(QString::number((int)(value / 50)));
|
||||
ui->lightOn_B_S->setValue((int)(value / 50));
|
||||
}
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->attFac->setEnabled(true);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue