/* QGLView Copyright (C) 2019 Ivan Pelipenko peri4ko@yandex.ru This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "view_editor.h" #include "ui_view_editor.h" #include #include ViewEditor::ViewEditor(QWidget * parent): QWidget(parent) { ui = new Ui::ViewEditor(); ui->setupUi(this); view = 0; active = true; } void ViewEditor::assignQGLView(QGLView * v) { view = v; if (!view) return; active = false; ui->spinFOV->setValue(view->FOV()); ui->spinDepthStart->setValue(view->depthStart()); ui->groupHoverHalo->setChecked(view->isHoverHaloEnabled()); ui->groupSelectionHalo->setChecked(view->isSelectionHaloEnabled()); ui->spinHoverHaloFill->setValue(view->hoverHaloFillAlpha()); ui->spinSelectionHaloFill->setValue(view->selectionHaloFillAlpha()); ui->colorHoverHalo->setColor(view->hoverHaloColor()); ui->colorSelectionHalo->setColor(view->selectionHaloColor()); ui->checkFXAA->setChecked(view->isFeatureEnabled(QGLView::qglFXAA)); ui->checkCameraOrbit->setChecked(view->isCameraOrbit()); ui->checkService->setChecked(view->isServiceMode()); active = true; } void ViewEditor::changeEvent(QEvent * e) { QWidget::changeEvent(e); switch (e->type()) { case QEvent::LanguageChange: ui->retranslateUi(this); break; default: break; } } void ViewEditor::on_spinFOV_valueChanged(double val) { if (!view || !active) return; view->setFOV(val); } void ViewEditor::on_spinDepthStart_valueChanged(double val) { if (!view || !active) return; view->setDepthStart(val); } void ViewEditor::on_spinViewGamma_valueChanged(double val) { if (!view || !active) return; view->setGamma(val); } void ViewEditor::on_comboViewRenderMode_currentIndexChanged(int val) { if (!view || !active) return; static int modes[] = {GL_POINT, GL_LINE, GL_FILL}; view->setRenderMode((ObjectBase::RenderMode)modes[val]); } void ViewEditor::on_groupHoverHalo_clicked(bool val) { if (!view || !active) return; view->setHoverHaloEnabled(val); } void ViewEditor::on_groupSelectionHalo_clicked(bool val) { if (!view || !active) return; view->setSelectionHaloEnabled(val); } void ViewEditor::on_spinHoverHaloFill_valueChanged(double val) { if (!view || !active) return; view->setHoverHaloFillAlpha(val); } void ViewEditor::on_spinSelectionHaloFill_valueChanged(double val) { if (!view || !active) return; view->setSelectionHaloFillAlpha(val); } void ViewEditor::on_colorHoverHalo_colorChanged(QColor color) { if (!view || !active) return; view->setHoverHaloColor(color); } void ViewEditor::on_colorSelectionHalo_colorChanged(QColor color) { if (!view || !active) return; view->setSelectionHaloColor(color); } void ViewEditor::on_checkAutoExposure_toggled(bool val) { if (!view || !active) return; view->setAutoExposure(val); } void ViewEditor::on_checkFXAA_clicked(bool val) { if (!view || !active) return; view->setFeature(QGLView::qglFXAA, val); } void ViewEditor::on_checkCameraOrbit_clicked(bool val) { if (!view || !active) return; view->setCameraOrbit(val); } void ViewEditor::on_checkCameraLight_clicked(bool val) { if (!view || !active) return; view->setCameraLightOn(val); } void ViewEditor::on_checkService_clicked(bool val) { if (!view || !active) return; view->setServiceMode(val); }