mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-28 04:06:27 -05:00
Move slider spinbox to core lib
This commit is contained in:
@@ -262,6 +262,8 @@ target_sources(
|
||||
src/utils/screenshot-helper.hpp
|
||||
src/utils/section.cpp
|
||||
src/utils/section.hpp
|
||||
src/utils/slider-spinbox.cpp
|
||||
src/utils/slider-spinbox.hpp
|
||||
src/utils/transition-selection.cpp
|
||||
src/utils/transition-selection.hpp
|
||||
src/utils/utility.cpp
|
||||
|
||||
@@ -27,8 +27,6 @@ target_sources(
|
||||
paramerter-wrappers.hpp
|
||||
preview-dialog.cpp
|
||||
preview-dialog.hpp
|
||||
threshold-slider.cpp
|
||||
threshold-slider.hpp
|
||||
video-selection.cpp
|
||||
video-selection.hpp)
|
||||
|
||||
|
||||
@@ -285,7 +285,7 @@ MacroConditionVideoEdit::MacroConditionVideoEdit(
|
||||
_usePatternForChangedCheck(new QCheckBox(obs_module_text(
|
||||
"AdvSceneSwitcher.condition.video.usePatternForChangedCheck"))),
|
||||
_imagePath(new FileSelection()),
|
||||
_patternThreshold(new ThresholdSlider(
|
||||
_patternThreshold(new SliderSpinBox(
|
||||
0., 1.,
|
||||
obs_module_text(
|
||||
"AdvSceneSwitcher.condition.video.patternThreshold"),
|
||||
@@ -293,7 +293,7 @@ MacroConditionVideoEdit::MacroConditionVideoEdit(
|
||||
"AdvSceneSwitcher.condition.video.patternThresholdDescription"))),
|
||||
_useAlphaAsMask(new QCheckBox(obs_module_text(
|
||||
"AdvSceneSwitcher.condition.video.patternThresholdUseAlphaAsMask"))),
|
||||
_brightnessThreshold(new ThresholdSlider(
|
||||
_brightnessThreshold(new SliderSpinBox(
|
||||
0., 1.,
|
||||
obs_module_text(
|
||||
"AdvSceneSwitcher.condition.video.brightnessThreshold"),
|
||||
@@ -302,7 +302,7 @@ MacroConditionVideoEdit::MacroConditionVideoEdit(
|
||||
_currentBrightness(new QLabel),
|
||||
_modelDataPath(new FileSelection()),
|
||||
_modelPathLayout(new QHBoxLayout),
|
||||
_objectScaleThreshold(new ThresholdSlider(
|
||||
_objectScaleThreshold(new SliderSpinBox(
|
||||
1.1, 5.,
|
||||
obs_module_text(
|
||||
"AdvSceneSwitcher.condition.video.objectScaleThreshold"),
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
#include "opencv-helpers.hpp"
|
||||
#include "threshold-slider.hpp"
|
||||
#include "area-selection.hpp"
|
||||
#include "video-selection.hpp"
|
||||
#include "preview-dialog.hpp"
|
||||
@@ -9,6 +8,7 @@
|
||||
#include <macro.hpp>
|
||||
#include <file-selection.hpp>
|
||||
#include <screenshot-helper.hpp>
|
||||
#include <slider-spinbox.hpp>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QComboBox>
|
||||
@@ -138,15 +138,15 @@ protected:
|
||||
QCheckBox *_usePatternForChangedCheck;
|
||||
FileSelection *_imagePath;
|
||||
|
||||
ThresholdSlider *_patternThreshold;
|
||||
SliderSpinBox *_patternThreshold;
|
||||
QCheckBox *_useAlphaAsMask;
|
||||
|
||||
ThresholdSlider *_brightnessThreshold;
|
||||
SliderSpinBox *_brightnessThreshold;
|
||||
QLabel *_currentBrightness;
|
||||
|
||||
FileSelection *_modelDataPath;
|
||||
QHBoxLayout *_modelPathLayout;
|
||||
ThresholdSlider *_objectScaleThreshold;
|
||||
SliderSpinBox *_objectScaleThreshold;
|
||||
QHBoxLayout *_neighborsControlLayout;
|
||||
QSpinBox *_minNeighbors;
|
||||
QLabel *_minNeighborsDescription;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "threshold-slider.hpp"
|
||||
#include "slider-spinbox.hpp"
|
||||
#include <QHBoxLayout>
|
||||
|
||||
ThresholdSlider::ThresholdSlider(double min, double max, const QString &label,
|
||||
const QString &description, QWidget *parent)
|
||||
SliderSpinBox::SliderSpinBox(double min, double max, const QString &label,
|
||||
const QString &description, QWidget *parent)
|
||||
: QWidget(parent),
|
||||
_spinBox(new QDoubleSpinBox()),
|
||||
_slider(new QSlider())
|
||||
@@ -32,7 +32,7 @@ ThresholdSlider::ThresholdSlider(double min, double max, const QString &label,
|
||||
setLayout(mainLayout);
|
||||
}
|
||||
|
||||
void ThresholdSlider::SetDoubleValue(double value)
|
||||
void SliderSpinBox::SetDoubleValue(double value)
|
||||
{
|
||||
const QSignalBlocker b1(_slider);
|
||||
const QSignalBlocker b2(_spinBox);
|
||||
@@ -40,14 +40,14 @@ void ThresholdSlider::SetDoubleValue(double value)
|
||||
_spinBox->setValue(value);
|
||||
}
|
||||
|
||||
void ThresholdSlider::SpinBoxValueChanged(double value)
|
||||
void SliderSpinBox::SpinBoxValueChanged(double value)
|
||||
{
|
||||
int sliderPos = value * _scale;
|
||||
_slider->setValue(sliderPos);
|
||||
emit DoubleValueChanged(value);
|
||||
}
|
||||
|
||||
void ThresholdSlider::SliderValueChanged(int value)
|
||||
void SliderSpinBox::SliderValueChanged(int value)
|
||||
{
|
||||
double doubleValue = value / _scale;
|
||||
_spinBox->setValue(doubleValue);
|
||||
@@ -4,13 +4,13 @@
|
||||
#include <QLabel>
|
||||
#include <QDoubleSpinBox>
|
||||
|
||||
class ThresholdSlider : public QWidget {
|
||||
class SliderSpinBox : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ThresholdSlider(double min = 0., double max = 1.,
|
||||
const QString &label = "threshold",
|
||||
const QString &description = "", QWidget *parent = 0);
|
||||
SliderSpinBox(double min = 0., double max = 1.,
|
||||
const QString &label = "threshold",
|
||||
const QString &description = "", QWidget *parent = 0);
|
||||
void SetDoubleValue(double);
|
||||
public slots:
|
||||
void SliderValueChanged(int value);
|
||||
Reference in New Issue
Block a user