-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 更新了`action.yml`文件,将Qt版本从`6.7.0`更改为`6.7.1`,以适应新的Qt版本需求。 - 调整了`cmake/qt.cmake`文件,更新了Windows和Linux系统下Qt的路径,使其与新版本匹配。 - 新增了`equalizerdialog.cpp`和`equalizerdialog.h`文件,为播放器增加了图形界面均衡器设置功能。 - 删除了`colorspacedialog`相关的文件,因为它们已被新的均衡器设置所取代。 - 更新了`CMakeLists.txt`和`.pro`文件,添加了新的均衡器源文件,并移除了旧的色彩空间设置文件。 - 在`ffmpegplayer`和`mpvplayer`的源文件中,增加了对均衡器的支持,并更新了相关的函数和信号。 - 新增了`mediainfo`子模块,并创建了`equalizer.cpp`和`equalizer.h`文件,为均衡器设置提供了数据结构和操作接口。 - 更新了`videorender`模块,增加了对均衡器效果的处理。 - 调整了`mpvplayer`模块,增加了对mpv播放器均衡器设置的支持。 - 新增了`utils`模块中的`range.hpp`文件,为均衡器范围提供了数据结构支持。
- Loading branch information
Showing
42 changed files
with
805 additions
and
449 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
if(CMAKE_HOST_WIN32) | ||
list(APPEND CMAKE_PREFIX_PATH "C:\\Qt\\6.7.0\\msvc2019_64") | ||
list(APPEND CMAKE_PREFIX_PATH "C:\\Qt\\6.7.1\\msvc2019_64") | ||
elseif(CMAKE_HOST_APPLE) | ||
|
||
elseif(CMAKE_HOST_LINUX) | ||
list(APPEND CMAKE_PREFIX_PATH "/opt/Qt/6.7.0/gcc_64") | ||
list(APPEND CMAKE_PREFIX_PATH "/opt/Qt/6.7.1/gcc_64") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,3 +57,7 @@ defineReplace(replaceLibName) { | |
isEmpty(RET):RET = $$LIBRARY_NAME | ||
return($$RET) | ||
} | ||
|
||
HEADERS += | ||
|
||
SOURCES += |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,249 @@ | ||
#include "equalizerdialog.h" | ||
|
||
#include <examples/common/slider.h> | ||
|
||
#include <QtWidgets> | ||
|
||
void setBlockValue(QSpinBox *spinBox, int value) | ||
{ | ||
spinBox->blockSignals(true); | ||
spinBox->setValue(value); | ||
spinBox->blockSignals(false); | ||
} | ||
|
||
void setBlockValue(QSlider *slider, int value) | ||
{ | ||
slider->blockSignals(true); | ||
slider->setValue(value); | ||
slider->blockSignals(false); | ||
} | ||
|
||
void init(QSlider *slider, QSpinBox *spinBox, const Media::Equalizer::EqualizerRange &equalizerRange) | ||
{ | ||
slider->setRange(equalizerRange.min(), equalizerRange.max()); | ||
slider->setValue(equalizerRange.value()); | ||
|
||
spinBox->setKeyboardTracking(false); | ||
spinBox->setRange(slider->minimum(), slider->maximum()); | ||
spinBox->setValue(slider->value()); | ||
} | ||
|
||
class EqualizerDialog::EqualizerDialogPrivate | ||
{ | ||
public: | ||
explicit EqualizerDialogPrivate(EqualizerDialog *q) | ||
: q_ptr(q) | ||
{ | ||
Media::Equalizer equalizer; | ||
|
||
contrastSlider = new Slider(q_ptr); | ||
contrastSpinBox = new QSpinBox(q_ptr); | ||
init(contrastSlider, contrastSpinBox, equalizer.contrastRange()); | ||
|
||
saturationSlider = new Slider(q_ptr); | ||
saturationSpinBox = new QSpinBox(q_ptr); | ||
init(saturationSlider, saturationSpinBox, equalizer.saturationRange()); | ||
|
||
brightnessSlider = new Slider(q_ptr); | ||
brightnessSpinBox = new QSpinBox(q_ptr); | ||
init(brightnessSlider, brightnessSpinBox, equalizer.brightnessRange()); | ||
|
||
gammaSlider = new Slider(q_ptr); | ||
gammaSpinBox = new QSpinBox(q_ptr); | ||
init(gammaSlider, gammaSpinBox, equalizer.gammaRange()); | ||
|
||
hueSlider = new Slider(q_ptr); | ||
hueSpinBox = new QSpinBox(q_ptr); | ||
init(hueSlider, hueSpinBox, equalizer.hueRange()); | ||
|
||
resetButton = new QToolButton(q_ptr); | ||
resetButton->setText("Reset"); | ||
} | ||
|
||
void setupUI() const | ||
{ | ||
auto *layout = new QGridLayout(q_ptr); | ||
layout->addWidget(new QLabel(QObject::tr("Contrast:"), q_ptr), 0, 0); | ||
layout->addWidget(contrastSlider, 0, 1); | ||
layout->addWidget(contrastSpinBox, 0, 2); | ||
layout->addWidget(new QLabel(QObject::tr("Saturation:"), q_ptr), 1, 0); | ||
layout->addWidget(saturationSlider, 1, 1); | ||
layout->addWidget(saturationSpinBox, 1, 2); | ||
layout->addWidget(new QLabel(QObject::tr("Brightness:"), q_ptr), 2, 0); | ||
layout->addWidget(brightnessSlider, 2, 1); | ||
layout->addWidget(brightnessSpinBox, 2, 2); | ||
layout->addWidget(new QLabel(QObject::tr("Gamma:"), q_ptr), 3, 0); | ||
layout->addWidget(gammaSlider, 3, 1); | ||
layout->addWidget(gammaSpinBox, 3, 2); | ||
layout->addWidget(new QLabel(QObject::tr("Hue:"), q_ptr), 4, 0); | ||
layout->addWidget(hueSlider, 4, 1); | ||
layout->addWidget(hueSpinBox, 4, 2); | ||
layout->addWidget(resetButton, 5, 2, Qt::AlignRight); | ||
} | ||
|
||
EqualizerDialog *q_ptr; | ||
|
||
Slider *contrastSlider; | ||
QSpinBox *contrastSpinBox; | ||
|
||
Slider *saturationSlider; | ||
QSpinBox *saturationSpinBox; | ||
|
||
Slider *brightnessSlider; | ||
QSpinBox *brightnessSpinBox; | ||
|
||
Slider *gammaSlider; | ||
QSpinBox *gammaSpinBox; | ||
|
||
Slider *hueSlider; | ||
QSpinBox *hueSpinBox; | ||
|
||
QToolButton *resetButton; | ||
}; | ||
|
||
EqualizerDialog::EqualizerDialog(QWidget *parent) | ||
: QDialog(parent) | ||
, d_ptr(new EqualizerDialogPrivate(this)) | ||
{ | ||
d_ptr->setupUI(); | ||
buildConnect(); | ||
resize(400, 250); | ||
} | ||
|
||
EqualizerDialog::~EqualizerDialog() = default; | ||
|
||
void EqualizerDialog::setEqualizer(const Media::Equalizer &equalizer) | ||
{ | ||
setBlockValue(d_ptr->contrastSlider, equalizer.contrastRange().value()); | ||
setBlockValue(d_ptr->contrastSpinBox, equalizer.contrastRange().value()); | ||
|
||
setBlockValue(d_ptr->saturationSlider, equalizer.saturationRange().value()); | ||
setBlockValue(d_ptr->saturationSpinBox, equalizer.saturationRange().value()); | ||
|
||
setBlockValue(d_ptr->brightnessSlider, equalizer.brightnessRange().value()); | ||
setBlockValue(d_ptr->brightnessSpinBox, equalizer.brightnessRange().value()); | ||
|
||
setBlockValue(d_ptr->gammaSlider, equalizer.gammaRange().value()); | ||
setBlockValue(d_ptr->gammaSpinBox, equalizer.gammaRange().value()); | ||
|
||
setBlockValue(d_ptr->hueSlider, equalizer.hueRange().value()); | ||
setBlockValue(d_ptr->hueSpinBox, equalizer.hueRange().value()); | ||
} | ||
|
||
Media::Equalizer EqualizerDialog::equalizer() const | ||
{ | ||
Media::Equalizer equalizer; | ||
equalizer.contrastRange().setValue(d_ptr->contrastSlider->value()); | ||
equalizer.saturationRange().setValue(d_ptr->saturationSlider->value()); | ||
equalizer.brightnessRange().setValue(d_ptr->brightnessSlider->value()); | ||
equalizer.gammaRange().setValue(d_ptr->gammaSlider->value()); | ||
equalizer.hueRange().setValue(d_ptr->hueSlider->value()); | ||
return equalizer; | ||
} | ||
|
||
void EqualizerDialog::onContrastSliderChanged(int value) | ||
{ | ||
setBlockValue(d_ptr->contrastSpinBox, value); | ||
emit equalizerChanged(); | ||
} | ||
|
||
void EqualizerDialog::onSaturationSliderChanged(int value) | ||
{ | ||
setBlockValue(d_ptr->saturationSpinBox, value); | ||
emit equalizerChanged(); | ||
} | ||
|
||
void EqualizerDialog::onBrightnessSliderChanged(int value) | ||
{ | ||
setBlockValue(d_ptr->brightnessSpinBox, value); | ||
emit equalizerChanged(); | ||
} | ||
|
||
void EqualizerDialog::onContrastSpinBoxChanged(int value) | ||
{ | ||
setBlockValue(d_ptr->contrastSlider, value); | ||
emit equalizerChanged(); | ||
} | ||
|
||
void EqualizerDialog::onSaturationSpinBoxChanged(int value) | ||
{ | ||
setBlockValue(d_ptr->saturationSlider, value); | ||
emit equalizerChanged(); | ||
} | ||
|
||
void EqualizerDialog::onBrightnessSpinBoxChanged(int value) | ||
{ | ||
setBlockValue(d_ptr->brightnessSlider, value); | ||
emit equalizerChanged(); | ||
} | ||
|
||
void EqualizerDialog::onGammaSliderChanged(int value) | ||
{ | ||
setBlockValue(d_ptr->gammaSpinBox, value); | ||
emit equalizerChanged(); | ||
} | ||
|
||
void EqualizerDialog::onGammaSpinBoxChanged(int value) | ||
{ | ||
setBlockValue(d_ptr->gammaSlider, value); | ||
emit equalizerChanged(); | ||
} | ||
|
||
void EqualizerDialog::onHueSliderChanged(int value) | ||
{ | ||
setBlockValue(d_ptr->hueSpinBox, value); | ||
emit equalizerChanged(); | ||
} | ||
|
||
void EqualizerDialog::onHueSpinBoxChanged(int value) | ||
{ | ||
setBlockValue(d_ptr->hueSlider, value); | ||
emit equalizerChanged(); | ||
} | ||
|
||
void EqualizerDialog::onReset() | ||
{ | ||
setEqualizer({}); | ||
emit equalizerChanged(); | ||
} | ||
|
||
void EqualizerDialog::buildConnect() | ||
{ | ||
connect(d_ptr->contrastSlider, | ||
&Slider::valueChanged, | ||
this, | ||
&EqualizerDialog::onContrastSliderChanged); | ||
connect(d_ptr->contrastSpinBox, | ||
&QSpinBox::valueChanged, | ||
this, | ||
&EqualizerDialog::onContrastSpinBoxChanged); | ||
|
||
connect(d_ptr->saturationSlider, | ||
&Slider::valueChanged, | ||
this, | ||
&EqualizerDialog::onSaturationSliderChanged); | ||
connect(d_ptr->saturationSpinBox, | ||
&QSpinBox::valueChanged, | ||
this, | ||
&EqualizerDialog::onSaturationSpinBoxChanged); | ||
|
||
connect(d_ptr->brightnessSlider, | ||
&Slider::valueChanged, | ||
this, | ||
&EqualizerDialog::onBrightnessSliderChanged); | ||
connect(d_ptr->brightnessSpinBox, | ||
&QSpinBox::valueChanged, | ||
this, | ||
&EqualizerDialog::onBrightnessSpinBoxChanged); | ||
|
||
connect(d_ptr->gammaSlider, &Slider::valueChanged, this, &EqualizerDialog::onGammaSliderChanged); | ||
connect(d_ptr->gammaSpinBox, | ||
&QSpinBox::valueChanged, | ||
this, | ||
&EqualizerDialog::onGammaSpinBoxChanged); | ||
|
||
connect(d_ptr->hueSlider, &Slider::valueChanged, this, &EqualizerDialog::onHueSliderChanged); | ||
connect(d_ptr->hueSpinBox, &QSpinBox::valueChanged, this, &EqualizerDialog::onHueSpinBoxChanged); | ||
|
||
connect(d_ptr->resetButton, &QToolButton::clicked, this, &EqualizerDialog::onReset); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#ifndef EQUALIZERDIALOG_H | ||
#define EQUALIZERDIALOG_H | ||
|
||
#include <mediainfo/equalizer.h> | ||
|
||
#include <QDialog> | ||
|
||
class EqualizerDialog : public QDialog | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit EqualizerDialog(QWidget *parent = nullptr); | ||
~EqualizerDialog() override; | ||
|
||
void setEqualizer(const Media::Equalizer &equalizer); | ||
[[nodiscard]] auto equalizer() const -> Media::Equalizer; | ||
|
||
signals: | ||
void equalizerChanged(); | ||
|
||
private slots: | ||
void onContrastSliderChanged(int value); | ||
void onContrastSpinBoxChanged(int value); | ||
|
||
void onSaturationSliderChanged(int value); | ||
void onSaturationSpinBoxChanged(int value); | ||
|
||
void onBrightnessSliderChanged(int value); | ||
void onBrightnessSpinBoxChanged(int value); | ||
|
||
void onGammaSliderChanged(int value); | ||
void onGammaSpinBoxChanged(int value); | ||
|
||
void onHueSliderChanged(int value); | ||
void onHueSpinBoxChanged(int value); | ||
|
||
void onReset(); | ||
|
||
private: | ||
void buildConnect(); | ||
|
||
class EqualizerDialogPrivate; | ||
QScopedPointer<EqualizerDialogPrivate> d_ptr; | ||
}; | ||
|
||
#endif // EQUALIZERDIALOG_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.