10 #include "ui_displayOptionsDlg.h"
29 #include <QColorDialog>
30 #include <QMetaObject>
33 #include <QStyleFactory>
42 : QDialog(parent, Qt::Tool),
43 m_ui(new
Ui::DisplayOptionsDlg()),
44 m_defaultAppStyleIndex(-1) {
47 connect(m_ui->ambientColorButton, &QAbstractButton::clicked,
this,
49 connect(m_ui->diffuseColorButton, &QAbstractButton::clicked,
this,
51 connect(m_ui->specularColorButton, &QAbstractButton::clicked,
this,
53 connect(m_ui->meshBackColorButton, &QAbstractButton::clicked,
this,
55 connect(m_ui->meshSpecularColorButton, &QAbstractButton::clicked,
this,
57 connect(m_ui->meshFrontColorButton, &QAbstractButton::clicked,
this,
59 connect(m_ui->bbColorButton, &QAbstractButton::clicked,
this,
61 connect(m_ui->showBBOnSelectedCheckBox, &QCheckBox::toggled,
this,
62 [&](
bool state) { parameters.showBBOnSelected = state; });
63 connect(m_ui->bbOpacityDoubleSpinBox,
64 static_cast<void (QDoubleSpinBox::*)(
double)
>(
65 &QDoubleSpinBox::valueChanged),
67 connect(m_ui->bbLineWidthSpinBox,
68 static_cast<void (QSpinBox::*)(
int)
>(&QSpinBox::valueChanged),
this,
70 connect(m_ui->bkgColorButton, &QAbstractButton::clicked,
this,
72 connect(m_ui->labelBkgColorButton, &QAbstractButton::clicked,
this,
74 connect(m_ui->labelMarkerColorButton, &QAbstractButton::clicked,
this,
76 connect(m_ui->pointsColorButton, &QAbstractButton::clicked,
this,
78 connect(m_ui->textColorButton, &QAbstractButton::clicked,
this,
81 connect(m_ui->doubleSidedCheckBox, &QCheckBox::toggled,
this,
82 [&](
bool state) { parameters.lightDoubleSided = state; });
83 connect(m_ui->enableGradientCheckBox, &QCheckBox::toggled,
this,
84 [&](
bool state) { parameters.drawBackgroundGradient = state; });
85 connect(m_ui->showCrossCheckBox, &QCheckBox::toggled,
this,
86 [&](
bool state) { parameters.displayCross = state; });
87 connect(m_ui->colorScaleShowHistogramCheckBox, &QCheckBox::toggled,
this,
88 [&](
bool state) { parameters.colorScaleShowHistogram = state; });
89 connect(m_ui->useColorScaleShaderCheckBox, &QCheckBox::toggled,
this,
90 [&](
bool state) { parameters.colorScaleUseShader = state; });
91 connect(m_ui->decimateMeshBox, &QCheckBox::toggled,
this,
92 [&](
bool state) { parameters.decimateMeshOnMove = state; });
93 connect(m_ui->decimateCloudBox, &QCheckBox::toggled,
this,
94 [&](
bool state) { parameters.decimateCloudOnMove = state; });
95 connect(m_ui->drawRoundedPointsCheckBox, &QCheckBox::toggled,
this,
96 [&](
bool state) { parameters.drawRoundedPoints = state; });
97 connect(m_ui->autoDisplayNormalsCheckBox, &QCheckBox::toggled,
this,
98 [&](
bool state) { options.normalsDisplayedByDefault = state; });
99 connect(m_ui->useNativeDialogsCheckBox, &QCheckBox::toggled,
this,
100 [&](
bool state) { options.useNativeDialogs = state; });
101 connect(m_ui->askForConfirmationBeforeQuittingCheckBox, &QCheckBox::toggled,
102 this, [&](
bool state) {
103 options.askForConfirmationBeforeQuitting = state;
105 connect(m_ui->logVerbosityComboBox,
106 static_cast<void (QComboBox::*)(
int)
>(
107 &QComboBox::currentIndexChanged),
110 connect(m_ui->useVBOCheckBox, &QAbstractButton::clicked,
this,
113 connect(m_ui->colorRampWidthSpinBox,
114 static_cast<void (QSpinBox::*)(
int)
>(&QSpinBox::valueChanged),
this,
117 connect(m_ui->defaultFontSizeSpinBox,
118 static_cast<void (QSpinBox::*)(
int)
>(&QSpinBox::valueChanged),
this,
120 connect(m_ui->labelFontSizeSpinBox,
121 static_cast<void (QSpinBox::*)(
int)
>(&QSpinBox::valueChanged),
this,
123 connect(m_ui->numberPrecisionSpinBox,
124 static_cast<void (QSpinBox::*)(
int)
>(&QSpinBox::valueChanged),
this,
126 connect(m_ui->labelOpacitySpinBox,
127 static_cast<void (QSpinBox::*)(
int)
>(&QSpinBox::valueChanged),
this,
129 connect(m_ui->labelMarkerSizeSpinBox,
130 static_cast<void (QSpinBox::*)(
int)
>(&QSpinBox::valueChanged),
this,
133 connect(m_ui->zoomSpeedDoubleSpinBox,
134 static_cast<void (QDoubleSpinBox::*)(
double)
>(
135 &QDoubleSpinBox::valueChanged),
137 connect(m_ui->maxCloudSizeDoubleSpinBox,
138 static_cast<void (QDoubleSpinBox::*)(
double)
>(
139 &QDoubleSpinBox::valueChanged),
141 connect(m_ui->maxMeshSizeDoubleSpinBox,
142 static_cast<void (QDoubleSpinBox::*)(
double)
>(
143 &QDoubleSpinBox::valueChanged),
146 connect(m_ui->autoComputeOctreeComboBox,
147 static_cast<void (QComboBox::*)(
int)
>(
148 &QComboBox::currentIndexChanged),
151 connect(m_ui->appStyleComboBox,
152 static_cast<void (QComboBox::*)(
int)
>(
153 &QComboBox::currentIndexChanged),
156 connect(m_ui->okButton, &QAbstractButton::clicked,
this,
158 connect(m_ui->applyButton, &QAbstractButton::clicked,
this,
160 connect(m_ui->resetButton, &QAbstractButton::clicked,
this,
162 connect(m_ui->cancelButton, &QAbstractButton::clicked,
this,
166 populateAppStyleComboBox();
173 setUpdatesEnabled(
true);
246 m_ui->colorScaleShowHistogramCheckBox->setChecked(
248 m_ui->useColorScaleShaderCheckBox->setChecked(
250 m_ui->useColorScaleShaderCheckBox->setEnabled(
262 m_ui->autoComputeOctreeComboBox->setCurrentIndex(
265 m_ui->autoDisplayNormalsCheckBox->setChecked(
268 m_ui->askForConfirmationBeforeQuittingCheckBox->setChecked(
270 m_ui->logVerbosityComboBox->setCurrentIndex(
279 if (!newCol.isValid())
return;
288 if (!newCol.isValid())
return;
299 if (!newCol.isValid())
return;
310 if (!newCol.isValid())
return;
321 QColor newCol = QColorDialog::getColor(
meshBackDiff,
this);
322 if (!newCol.isValid())
return;
333 if (!newCol.isValid())
return;
345 if (!newCol.isValid())
return;
355 QColor newCol = QColorDialog::getColor(
bbDefaultCol,
this);
356 if (!newCol.isValid())
return;
367 if (!newCol.isValid())
return;
378 if (!newCol.isValid())
return;
389 if (!newCol.isValid())
return;
400 if (!newCol.isValid())
return;
451 assert(index >= 0 && index < 3);
457 if (val < 0 || val > 100)
return;
462 if (val <= 0)
return;
468 if (val < 0.0 || val > 1.0)
return;
487 ecvApp->setAppStyle(oldStyle);
498 if (entity && entity->isSelected()) {
499 entity->setForceRedrawRecursive(
true);
527 QString style = m_ui->appStyleComboBox->currentText();
528 ecvApp->setAppStyle(style);
547 if (entity && entity->isSelected()) {
548 entity->setForceRedrawRecursive(
true);
571 void ccDisplayOptionsDlg::populateAppStyleComboBox() {
577 QString defaultStyleName = settings.value(
"style").toString();
581 QStringList appStyles = QStyleFactory::keys();
582 for (
const QString& style : appStyles) {
583 m_ui->appStyleComboBox->addItem(style);
587 m_ui->appStyleComboBox->addItem(QStringLiteral(
"QDarkStyleSheet::Light"));
588 m_ui->appStyleComboBox->addItem(QStringLiteral(
"QDarkStyleSheet::Dark"));
592 for (
int i = 0; i < m_ui->appStyleComboBox->count(); ++i) {
593 QString itemText = m_ui->appStyleComboBox->itemText(i);
606 for (
int i = 0; i < m_ui->appStyleComboBox->count(); ++i) {
607 QString itemText = m_ui->appStyleComboBox->itemText(i);
static bool Print(const char *format,...)
Prints out a formatted message in console.
static void SetVerbosityLevel(int level)
Sets the verbosity level.
MessageLevelFlags
Message level.
static int VerbosityLevel()
Returns the current verbosity level.
void refresh()
Refreshes dialog to reflect new parameters values.
void changeLabelFontSize(int)
void changeLabelBackgroundColor()
void changeColorScaleRampWidth(int)
void changeMaxMeshSize(double)
void changeBBLineWidth(int)
void changeNumberPrecision(int)
ccDisplayOptionsDlg(QWidget *parent)
ecvOptions options
Current options.
void changeBBOpacity(double)
void changeLightSpecularColor()
ecvGui::ParamStruct oldParameters
Old parameters (for restore)
void changeLogVerbosityLevel(int)
void changeLightAmbientColor()
void changeMeshBackDiffuseColor()
void changeLabelMarkerSize(int)
void changeLabelMarkerColor()
void changeMaxCloudSize(double)
void changeBackgroundColor()
ecvGui::ParamStruct parameters
Current GUI parameters.
void changeMeshSpecularColor()
QColor lightSpecularColor
void changeLabelOpacity(int)
int m_defaultAppStyleIndex
Default application style index (for reset)
void changeDefaultFontSize(int)
~ccDisplayOptionsDlg() override
QColor labelBackgroundCol
void changeAutoComputeOctreeOption(int)
ecvOptions oldOptions
Old options (for restore)
void changeMeshFrontDiffuseColor()
void changeZoomSpeed(double)
void changeLightDiffuseColor()
Hierarchical CLOUDVIEWER Object.
unsigned filterChildren(Container &filteredChildren, bool recursive=false, CV_CLASS_ENUM filter=CV_TYPES::OBJECT, bool strict=false) const
Collects the children corresponding to a certain pattern.
std::vector< ccHObject * > Container
Standard instances container (for children, etc.)
static void SetButtonColor(QAbstractButton *button, const QColor &col)
Sets a button background color.
static void Set(const ParamStruct ¶ms)
Sets GUI parameters.
static const ParamStruct & Parameters()
Returns the stored values of each parameter.
bool useNativeDialogs
Use native load/save dialogs.
static void Set(const ecvOptions &options)
Sets parameters.
void reset()
Resets parameters to default values.
bool normalsDisplayedByDefault
Whether to display the normals by default or not.
bool askForConfirmationBeforeQuitting
Ask for confirmation before quitting.
void toPersistentSettings() const
Saves to persistent DB.
CVLog::MessageLevelFlags logVerbosityLevel
Log/console verbosity level (reuses CVLog::MessageLevelFlags)
static const ecvOptions & Instance()
Returns the stored values of each parameter.
static const QString AppStyle()
#define ecvApp
Mimic Qt's qApp for easy access to the application instance.
static const double s_defaultMaxVBOCloudSizeM
constexpr QRegularExpression::PatternOption CaseInsensitive
Rgb FromQColor(QColor qColor)
Conversion from QColor.
Rgbaf FromQColoraf(QColor qColor)
Conversion from QColor'a' (floating point)
void reset()
Resets parameters to default values.
ComputeOctreeForPicking
Octree computation (for picking) behaviors.
ecvColor::Rgbaf lightDiffuseColor
Light diffuse color (RGBA)
ecvColor::Rgbaf meshSpecular
Default mesh specular color.
unsigned labelMarkerSize
Label marker size.
ecvColor::Rgbub backgroundCol
Background color.
ecvColor::Rgbaf lightAmbientColor
Light ambient color (RGBA)
unsigned displayedNumPrecision
Displayed numbers precision.
double bbOpacity
Bounding-box opacity (0.0 to 1.0)
ComputeOctreeForPicking autoComputeOctree
Octree computation (for picking) behavior.
unsigned labelFontSize
Label font size.
bool lightDoubleSided
Double sided light.
ecvColor::Rgbub labelMarkerCol
Labels marker color.
ecvColor::Rgbub textDefaultCol
Default text color.
bool drawRoundedPoints
Whether to draw rounded points (slower) or not.
unsigned minLoDCloudSize
Min cloud size for decimation.
unsigned defaultFontSize
Default displayed font size.
ecvColor::Rgbub labelBackgroundCol
Labels background color.
ecvColor::Rgbaf lightSpecularColor
Light specular color (RGBA)
ecvColor::Rgbub bbDefaultCol
Bounding-boxes color.
unsigned colorScaleRampWidth
Color scale ramp width (for display)
bool displayCross
Display cross in the middle of the screen.
void toPersistentSettings() const
Saves to persistent DB.
bool colorScaleUseShader
Whether to use shader for color scale display (if available) or not.
bool colorScaleShaderSupported
Whether shader for color scale display is available or not.
unsigned bbLineWidth
Bounding-box line width.
unsigned minLoDMeshSize
Min mesh size for decimation.
bool showBBOnSelected
Show bounding-box on selected objects.
ecvColor::Rgbaf meshFrontDiff
Default mesh diffuse color (front)
bool decimateMeshOnMove
Decimate meshes when moved.
bool drawBackgroundGradient
Use background gradient.
bool useVBOs
Whether to use VBOs for faster display.
unsigned labelOpacity
Labels background opcaity.
ecvColor::Rgbaf meshBackDiff
Default mesh diffuse color (back)
double zoomSpeed
Zoom speed (1.0 by default)
bool decimateCloudOnMove
Decimate clouds when moved.
ecvColor::Rgbub pointsDefaultCol
Default 3D points color.
bool colorScaleShowHistogram
Color scale option: show histogram next to color ramp.