Skip to content

Commit

Permalink
开始重构;
Browse files Browse the repository at this point in the history
  • Loading branch information
RealChuan committed Aug 21, 2023
1 parent bcd1767 commit 6d3ea5b
Show file tree
Hide file tree
Showing 28 changed files with 335 additions and 214 deletions.
17 changes: 15 additions & 2 deletions .calng-tidy → .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
Checks: '-*,clang-diagnostic-*,bugprone-*,modernize-*,performance-*,readability-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes'
# 类名改为大驼峰
---
Checks: '-*,clang-analyzer-*,readability-*,performance-*,modernize-*,bugprone-*,cert-,cppcoreguidelines-,portability-*,llvm-*,google-*'
WarningsAsErrors: ''
HeaderFilterRegex: '.'
AnalyzeTemporaryDtors: false
FormatStyle: file
User: user
CheckOptions:
# 类名改为大驼峰
- key: readability-identifier-naming.ClassCase
value: CamelCase
# 函数名改为小驼峰
Expand All @@ -15,3 +22,9 @@ Checks: '-*,clang-diagnostic-*,bugprone-*,modernize-*,performance-*,readability-
value: '1'
- key: modernize-use-trailing-return-type.UseEastWestConst
value: '1'
- key: readability-identifier-naming.ClassMemberPrefix
value: 'm_'
- key: readability-identifier-naming.ConstexprVariablePrefix
value: 'k'
- key: readability-identifier-naming.GlobalVariablePrefix
value: 'g_'
6 changes: 3 additions & 3 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ on:
push:
paths-ignore: # 下列文件的变更不触发部署,可以自行添加
- 'doc/**'
- '.clang-format'
- '.clang*'
- '.gitignore'
- 'LICENSE'
- 'README*'
pull_request:
paths-ignore: # 下列文件的变更不触发部署,可以自行添加
- 'doc/**'
- '.clang-format'
- '.clang*'
- '.gitignore'
- 'LICENSE'
- 'README*'
Expand All @@ -31,7 +31,7 @@ jobs:
qt_ver:
- 6.5.2
build_type:
- "Release"
- "RelWithDebInfo"
generators:
- "Ninja"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/qmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ on:
push:
paths-ignore: # 下列文件的变更不触发部署,可以自行添加
- 'doc'
- '.clang-format'
- '.clang*'
- '.gitignore'
- 'LICENSE'
- 'README*'
pull_request:
paths-ignore: # 下列文件的变更不触发部署,可以自行添加
- 'doc'
- '.clang-format'
- '.clang*'
- '.gitignore'
- 'LICENSE'
- 'README*'
Expand Down
6 changes: 0 additions & 6 deletions examples/player/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,6 @@ void MainWindow::buildConnect()
d_ptr->controlWidget,
[this](const QStringList &tracks) {
qDeleteAll(d_ptr->audioTracksGroup->actions());
if (tracks.size() < 2) {
return;
}
for (const auto &item : qAsConst(tracks)) {
auto action = new QAction(item, this);
action->setCheckable(true);
Expand All @@ -438,9 +435,6 @@ void MainWindow::buildConnect()
d_ptr->controlWidget,
[this](const QStringList &tracks) {
qDeleteAll(d_ptr->subTracksGroup->actions());
if (tracks.size() < 2) {
return;
}
for (const auto &item : qAsConst(tracks)) {
auto action = new QAction(item, this);
action->setCheckable(true);
Expand Down
5 changes: 5 additions & 0 deletions examples/player/slider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ void Slider::enterEvent(QEnterEvent *event)
void Slider::leaveEvent(QEvent *e)
{
QSlider::leaveEvent(e);

auto pos = QCursor::pos();
if (rect().contains(mapFromGlobal(pos))) {
return;
}
emit onLeave();
unsetCursor();
}
Expand Down
8 changes: 3 additions & 5 deletions ffmpeg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ target_link_libraries(
unofficial::brotli::brotlidec
unofficial::brotli::brotlienc)

if(CMAKE_HOST_APPLE)
if(CMAKE_HOST_WIN32)
target_compile_definitions(ffmpeg PRIVATE "FFMPEG_LIBRARY")
elseif(CMAKE_HOST_APPLE)
target_link_libraries(
ffmpeg
PRIVATE ${Foundation_LIBRARY}
Expand All @@ -112,7 +114,3 @@ if(CMAKE_HOST_APPLE)
${CoreVideo_LIBRARY}
${CoreServices_LIBRARY})
endif()

if(CMAKE_HOST_WIN32)
target_compile_definitions(ffmpeg PRIVATE "FFMPEG_LIBRARY")
endif()
10 changes: 6 additions & 4 deletions ffmpeg/audiodecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ namespace Ffmpeg {
class AudioDecoder::AudioDecoderPrivate
{
public:
AudioDecoderPrivate(QObject *parent)
: owner(parent)
AudioDecoderPrivate(AudioDecoder *q)
: q_ptr(q)
{
decoderAudioFrame = new DecoderAudioFrame(owner);
decoderAudioFrame = new DecoderAudioFrame(q_ptr);
}
QObject *owner;

AudioDecoder *q_ptr;

DecoderAudioFrame *decoderAudioFrame;
};

Expand Down
6 changes: 3 additions & 3 deletions ffmpeg/audiofifo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ namespace Ffmpeg {
class AudioFifo::AudioFifoPrivtate
{
public:
AudioFifoPrivtate(QObject *parent)
: owner(parent)
AudioFifoPrivtate(AudioFifo *q)
: q_ptr(q)
{}

~AudioFifoPrivtate()
Expand All @@ -26,7 +26,7 @@ class AudioFifo::AudioFifoPrivtate

void setError(int errorCode) { AVErrorManager::instance()->setErrorCode(errorCode); }

QObject *owner;
AudioFifo *q_ptr;

AVAudioFifo *audioFifo = nullptr;
};
Expand Down
6 changes: 3 additions & 3 deletions ffmpeg/audioframeconverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ QAudioFormat::SampleFormat getSampleFormat(AVSampleFormat format)
class AudioFrameConverter::AudioFrameConverterPrivate
{
public:
AudioFrameConverterPrivate(QObject *parent)
: owner(parent)
AudioFrameConverterPrivate(AudioFrameConverter *q)
: q_ptr(q)
{}

void setError(int errorCode) { AVErrorManager::instance()->setErrorCode(errorCode); }

QObject *owner;
AudioFrameConverter *q_ptr;

SwrContext *swrContext;
QAudioFormat format;
Expand Down
2 changes: 1 addition & 1 deletion ffmpeg/decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ template<typename T>
class Decoder : public QThread
{
public:
Decoder(QObject *parent = nullptr)
explicit Decoder(QObject *parent = nullptr)
: QThread(parent)
{}
virtual ~Decoder() override { stopDecoder(); }
Expand Down
2 changes: 1 addition & 1 deletion ffmpeg/decodersubtitleframe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Ffmpeg {
class DecoderSubtitleFrame::DecoderSubtitleFramePrivate
{
public:
DecoderSubtitleFramePrivate(QObject *parent)
explicit DecoderSubtitleFramePrivate(QObject *parent)
: owner(parent)
{}

Expand Down
Loading

0 comments on commit 6d3ea5b

Please sign in to comment.