-
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.
[Update_Qt_Version_and_Introduce_Equalizer]: 更新Qt版本至6.7.1并引入均衡器功能
- 更新`action.yml`文件,将Qt版本默认值设置为6.7.1 - 修改`cmake/qt.cmake`文件,更新Qt安装路径以匹配新版本 - 删除原有的`colorspacedialog`相关代码,并添加新的`equalizerdialog`模块 - 调整`CMakeLists.txt`和`.pro`文件,增加`mediaconfig`库的引用 - 重构`videorender`和`mpvplayer`模块,使用`Equalizer`代替旧的色彩空间调整功能 - 对`mpvplayer`模块进行了功能增强,增加了调整视频播放色彩效果的API
- Loading branch information
Showing
42 changed files
with
807 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,251 @@ | ||
#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 MediaConfig::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) | ||
{ | ||
MediaConfig::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 MediaConfig::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()); | ||
} | ||
|
||
MediaConfig::Equalizer EqualizerDialog::equalizer() const | ||
{ | ||
MediaConfig::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 <mediaconfig/equalizer.hpp> | ||
|
||
#include <QDialog> | ||
|
||
class EqualizerDialog : public QDialog | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit EqualizerDialog(QWidget *parent = nullptr); | ||
~EqualizerDialog() override; | ||
|
||
void setEqualizer(const MediaConfig::Equalizer &equalizer); | ||
[[nodiscard]] auto equalizer() const -> MediaConfig::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.