From 7fa11cca92af408246d7299dde78b1a504faa515 Mon Sep 17 00:00:00 2001 From: Dan Dennedy Date: Tue, 5 Nov 2024 10:09:58 -0800 Subject: [PATCH] fix astyle 3.1 check --- src/dialogs/transcribeaudiodialog.cpp | 9 ++- src/docks/playlistdock.cpp | 6 +- src/docks/timelinedock.cpp | 86 +++++++++++++-------------- src/mainwindow.cpp | 7 ++- src/mainwindow.h | 2 +- src/videowidget.cpp | 2 +- 6 files changed, 58 insertions(+), 54 deletions(-) diff --git a/src/dialogs/transcribeaudiodialog.cpp b/src/dialogs/transcribeaudiodialog.cpp index 25ae26c76c..03fc6bc693 100644 --- a/src/dialogs/transcribeaudiodialog.cpp +++ b/src/dialogs/transcribeaudiodialog.cpp @@ -192,7 +192,8 @@ TranscribeAudioDialog::TranscribeAudioDialog(const QString &trackName, QWidget * auto path = QFileDialog::getOpenFileName(this, tr("Find Whisper.cpp"), Settings.whisperExe(), QString(), nullptr, Util::getFileDialogOptions()); - if (QFileInfo(path).isExecutable()) { + if (QFileInfo(path).isExecutable()) + { Settings.setWhisperExe(path); updateWhisperStatus(); } @@ -212,11 +213,13 @@ TranscribeAudioDialog::TranscribeAudioDialog(const QString &trackName, QWidget * auto path = QFileDialog::getOpenFileName(this, tr("Find Whisper.cpp"), Settings.whisperModel(), "*.bin", nullptr, Util::getFileDialogOptions()); - if (QFileInfo(path).exists()) { + if (QFileInfo(path).exists()) + { LOG_INFO() << "Model found" << path; Settings.setWhisperModel(path); updateWhisperStatus(); - } else { + } else + { LOG_INFO() << "Model not found" << path; } }); diff --git a/src/docks/playlistdock.cpp b/src/docks/playlistdock.cpp index cafd8f2a90..d3aa7ebb06 100644 --- a/src/docks/playlistdock.cpp +++ b/src/docks/playlistdock.cpp @@ -816,8 +816,8 @@ void PlaylistDock::replaceClipsWithHash(const QString &hash, Mlt::Producer &prod for (auto &clip : producers) { Util::applyCustomProperties(producer, clip.parent(), clip.get_in(), clip.get_out()); MAIN.undoStack()->push( - new Playlist::ReplaceCommand(m_model, MLT.XML(&producer), - clip.get_int(kPlaylistIndexProperty) - 1)); + new Playlist::ReplaceCommand(m_model, MLT.XML(&producer), + clip.get_int(kPlaylistIndexProperty) - 1)); } if (n > 1) { MAIN.undoStack()->endMacro(); @@ -1009,7 +1009,7 @@ void PlaylistDock::onAppendCutActionTriggered() if (!MLT.isLiveProducer(&producer)) { ProxyManager::generateIfNotExists(producer); MAIN.undoStack()->push( - new Playlist::AppendCommand(m_model, MLT.XML(&producer))); + new Playlist::AppendCommand(m_model, MLT.XML(&producer))); setPlaylistIndex(&producer, m_model.playlist()->count() - 1); emit enableUpdate(true); } else { diff --git a/src/docks/timelinedock.cpp b/src/docks/timelinedock.cpp index 195e231aa0..a3fd136618 100644 --- a/src/docks/timelinedock.cpp +++ b/src/docks/timelinedock.cpp @@ -1557,10 +1557,10 @@ void TimelineDock::addTrackIfNeeded(int trackIndex, Mlt::Producer *srcTrack) if (srcTrack->get_int(kAudioTrackProperty) || (n > 0 && m_model.trackList()[n - 1].type == AudioTrackType)) { MAIN.undoStack()->push( - new Timeline::InsertTrackCommand(m_model, trackIndex, AudioTrackType)); + new Timeline::InsertTrackCommand(m_model, trackIndex, AudioTrackType)); } else { MAIN.undoStack()->push( - new Timeline::InsertTrackCommand(m_model, trackIndex, VideoTrackType)); + new Timeline::InsertTrackCommand(m_model, trackIndex, VideoTrackType)); } } } @@ -1820,8 +1820,8 @@ void TimelineDock::trimClipAtPlayhead(TrimLocation location, bool ripple) if (location == TrimInPoint) { MAIN.undoStack()->push( - new Timeline::TrimClipInCommand(m_model, m_markersModel, trackIndex, clipIndex, - m_position - info->start, ripple)); + new Timeline::TrimClipInCommand(m_model, m_markersModel, trackIndex, clipIndex, + m_position - info->start, ripple)); if (ripple) setPosition(info->start); if (m_updateCommand && m_updateCommand->trackIndex() == trackIndex @@ -1831,8 +1831,8 @@ void TimelineDock::trimClipAtPlayhead(TrimLocation location, bool ripple) emit MAIN.serviceInChanged(m_position - info->start, info->producer); } else { MAIN.undoStack()->push( - new Timeline::TrimClipOutCommand(m_model, m_markersModel, trackIndex, clipIndex, - info->start + info->frame_count - m_position, ripple)); + new Timeline::TrimClipOutCommand(m_model, m_markersModel, trackIndex, clipIndex, + info->start + info->frame_count - m_position, ripple)); if (m_updateCommand && m_updateCommand->trackIndex() == trackIndex && m_updateCommand->clipIndex() == clipIndex) m_updateCommand->setPosition(trackIndex, clipIndex, -1); @@ -1870,7 +1870,7 @@ void TimelineDock::insertTrack() if (m_selection.selectedTrack != -1) setSelection(); MAIN.undoStack()->push( - new Timeline::InsertTrackCommand(m_model, currentTrack())); + new Timeline::InsertTrackCommand(m_model, currentTrack())); } void TimelineDock::insertAudioTrack() @@ -1878,7 +1878,7 @@ void TimelineDock::insertAudioTrack() if (m_selection.selectedTrack != -1) setSelection(); MAIN.undoStack()->push( - new Timeline::InsertTrackCommand(m_model, currentTrack(), AudioTrackType)); + new Timeline::InsertTrackCommand(m_model, currentTrack(), AudioTrackType)); } void TimelineDock::insertVideoTrack() @@ -1886,7 +1886,7 @@ void TimelineDock::insertVideoTrack() if (m_selection.selectedTrack != -1) setSelection(); MAIN.undoStack()->push( - new Timeline::InsertTrackCommand(m_model, currentTrack(), VideoTrackType)); + new Timeline::InsertTrackCommand(m_model, currentTrack(), VideoTrackType)); } void TimelineDock::removeTrack() @@ -1894,7 +1894,7 @@ void TimelineDock::removeTrack() if (m_model.trackList().size() > 0) { int trackIndex = currentTrack(); MAIN.undoStack()->push( - new Timeline::RemoveTrackCommand(m_model, trackIndex)); + new Timeline::RemoveTrackCommand(m_model, trackIndex)); if (trackIndex >= m_model.trackList().count()) setCurrentTrack(m_model.trackList().count() - 1); } @@ -1983,7 +1983,7 @@ bool TimelineDock::mergeClipWithNext(int trackIndex, int clipIndex, bool dryrun) return m_model.mergeClipWithNext(trackIndex, clipIndex, true); MAIN.undoStack()->push( - new Timeline::MergeCommand(m_model, trackIndex, clipIndex)); + new Timeline::MergeCommand(m_model, trackIndex, clipIndex)); return true; } @@ -2087,7 +2087,7 @@ int TimelineDock::addAudioTrack() if (m_selection.selectedTrack != -1) setSelection(); MAIN.undoStack()->push( - new Timeline::AddTrackCommand(m_model, false)); + new Timeline::AddTrackCommand(m_model, false)); return m_model.trackList().size() - 1; } @@ -2096,7 +2096,7 @@ int TimelineDock::addVideoTrack() if (m_selection.selectedTrack != -1) setSelection(); MAIN.undoStack()->push( - new Timeline::AddTrackCommand(m_model, true)); + new Timeline::AddTrackCommand(m_model, true)); return 0; } @@ -2212,7 +2212,7 @@ void TimelineDock::append(int trackIndex) clip.set_in_and_out(info.frame_in, info.frame_out); bool lastClip = mltTrackIndex == tractor.count() - 1 && mltClipIndex == playlist.count() - 1; MAIN.undoStack()->push( - new Timeline::AppendCommand(m_model, trackIndex, MLT.XML(&clip), false, lastClip)); + new Timeline::AppendCommand(m_model, trackIndex, MLT.XML(&clip), false, lastClip)); } } } @@ -2226,7 +2226,7 @@ void TimelineDock::append(int trackIndex) } MAIN.undoStack()->push( - new Timeline::AppendCommand(m_model, trackIndex, xmlToUse)); + new Timeline::AppendCommand(m_model, trackIndex, xmlToUse)); } if (m_position < 0) { @@ -2252,7 +2252,7 @@ void TimelineDock::remove(int trackIndex, int clipIndex, bool ignoreTransition) MAIN.undoStack()->beginMacro(tr("Ripple delete transition")); auto info = m_model.getClipInfo(trackIndex, clipIndex); MAIN.undoStack()->push( - new Timeline::RemoveCommand(m_model, m_markersModel, trackIndex, clipIndex)); + new Timeline::RemoveCommand(m_model, m_markersModel, trackIndex, clipIndex)); if (clipIndex > 0 && info->producer && info->producer->is_valid()) { // verify the clip after belongs to transition Mlt::Tractor transition(*info->producer); @@ -2260,22 +2260,22 @@ void TimelineDock::remove(int trackIndex, int clipIndex, bool ignoreTransition) auto neighborClip = producerForClip(trackIndex, clipIndex); if (neighborClip.is_valid() && transitionClip && neighborClip.same_clip(*transitionClip)) MAIN.undoStack()->push( - new Timeline::TrimClipInCommand(m_model, m_markersModel, trackIndex, clipIndex, - -info->frame_count, true)); + new Timeline::TrimClipInCommand(m_model, m_markersModel, trackIndex, clipIndex, + -info->frame_count, true)); // verify the clip before belongs to transition transitionClip.reset(transition.track(0)); neighborClip = producerForClip(trackIndex, clipIndex - 1); if (neighborClip.is_valid() && transitionClip && neighborClip.same_clip(*transitionClip)) MAIN.undoStack()->push( - new Timeline::TrimClipOutCommand(m_model, m_markersModel, trackIndex, clipIndex - 1, - -info->frame_count, true)); + new Timeline::TrimClipOutCommand(m_model, m_markersModel, trackIndex, clipIndex - 1, + -info->frame_count, true)); } MAIN.undoStack()->endMacro(); } else { Mlt::Producer clip = producerForClip(trackIndex, clipIndex); if (clip.is_valid()) { MAIN.undoStack()->push( - new Timeline::RemoveCommand(m_model, m_markersModel, trackIndex, clipIndex)); + new Timeline::RemoveCommand(m_model, m_markersModel, trackIndex, clipIndex)); } } } @@ -2303,26 +2303,26 @@ void TimelineDock::lift(int trackIndex, int clipIndex, bool ignoreTransition) auto duration = info->frame_count; MAIN.undoStack()->push( - new Timeline::LiftCommand(m_model, trackIndex, clipIndex)); + new Timeline::LiftCommand(m_model, trackIndex, clipIndex)); if (clipBefore.is_valid() && clipAfter.is_valid() && !clipBefore.is_blank() && !clipAfter.is_blank()) duration /= 2; if (clipAfter.is_valid() && transitionClip && clipAfter.same_clip(*transitionClip)) MAIN.undoStack()->push( - new Timeline::TrimClipInCommand(m_model, m_markersModel, trackIndex, - clipIndex + (clipBefore.is_blank() ? 0 : 1), -duration, false)); + new Timeline::TrimClipInCommand(m_model, m_markersModel, trackIndex, + clipIndex + (clipBefore.is_blank() ? 0 : 1), -duration, false)); // verify the clip before belongs to transition transitionClip.reset(transition.track(0)); if (duration < info->frame_count) duration += info->frame_count % 2; if (clipBefore.is_valid() && transitionClip && clipBefore.same_clip(*transitionClip)) MAIN.undoStack()->push( - new Timeline::TrimClipOutCommand(m_model, m_markersModel, trackIndex, clipIndex - 1, - -duration, false)); + new Timeline::TrimClipOutCommand(m_model, m_markersModel, trackIndex, clipIndex - 1, + -duration, false)); } else { MAIN.undoStack()->push( - new Timeline::LiftCommand(m_model, trackIndex, clipIndex)); + new Timeline::LiftCommand(m_model, trackIndex, clipIndex)); } MAIN.undoStack()->endMacro(); } else { @@ -2331,7 +2331,7 @@ void TimelineDock::lift(int trackIndex, int clipIndex, bool ignoreTransition) if (clip.is_blank()) return; MAIN.undoStack()->push( - new Timeline::LiftCommand(m_model, trackIndex, clipIndex)); + new Timeline::LiftCommand(m_model, trackIndex, clipIndex)); setSelection(); } } @@ -2687,7 +2687,7 @@ void TimelineDock::detachAudio(int trackIndex, int clipIndex) Mlt::Producer clip(MLT.profile(), "xml-string", MLT.XML(info->producer).toUtf8().constData()); clip.set_in_and_out(info->frame_in, info->frame_out); MAIN.undoStack()->push( - new Timeline::DetachAudioCommand(*this, trackIndex, clipIndex, info->start, MLT.XML(&clip))); + new Timeline::DetachAudioCommand(*this, trackIndex, clipIndex, info->start, MLT.XML(&clip))); } } @@ -2748,7 +2748,7 @@ void TimelineDock::replace(int trackIndex, int clipIndex, const QString &xml) QString xmlToUse = !xml.isEmpty() ? xml : MLT.XML(MLT.isClip() ? nullptr : MLT.savedProducer()); MAIN.undoStack()->push( - new Timeline::ReplaceCommand(m_model, trackIndex, clipIndex, xmlToUse)); + new Timeline::ReplaceCommand(m_model, trackIndex, clipIndex, xmlToUse)); } else if (!MLT.isSeekableClip()) { emitNonSeekableWarning(); } @@ -3003,31 +3003,31 @@ void TimelineDock::onLoopChanged(int start, int end) void TimelineDock::setTrackName(int trackIndex, const QString &value) { MAIN.undoStack()->push( - new Timeline::NameTrackCommand(m_model, trackIndex, value)); + new Timeline::NameTrackCommand(m_model, trackIndex, value)); } void TimelineDock::toggleTrackMute(int trackIndex) { MAIN.undoStack()->push( - new Timeline::MuteTrackCommand(m_model, trackIndex)); + new Timeline::MuteTrackCommand(m_model, trackIndex)); } void TimelineDock::toggleTrackHidden(int trackIndex) { MAIN.undoStack()->push( - new Timeline::HideTrackCommand(m_model, trackIndex)); + new Timeline::HideTrackCommand(m_model, trackIndex)); } void TimelineDock::setTrackComposite(int trackIndex, bool composite) { MAIN.undoStack()->push( - new Timeline::CompositeTrackCommand(m_model, trackIndex, composite)); + new Timeline::CompositeTrackCommand(m_model, trackIndex, composite)); } void TimelineDock::setTrackLock(int trackIndex, bool lock) { MAIN.undoStack()->push( - new Timeline::LockTrackCommand(m_model, trackIndex, lock)); + new Timeline::LockTrackCommand(m_model, trackIndex, lock)); } bool TimelineDock::moveClip(int fromTrack, int toTrack, int clipIndex, int position, bool ripple) @@ -3317,8 +3317,8 @@ void TimelineDock::insert(int trackIndex, int position, const QString &xml, bool clip.set_in_and_out(info.frame_in, info.frame_out); bool lastClip = mltTrackIndex == tractor.count() - 1 && mltClipIndex == playlist.count() - 1; MAIN.undoStack()->push( - new Timeline::InsertCommand(m_model, m_markersModel, trackIndex, position + info.start, - MLT.XML(&clip), lastClip)); + new Timeline::InsertCommand(m_model, m_markersModel, trackIndex, position + info.start, + MLT.XML(&clip), lastClip)); } } } @@ -3331,7 +3331,7 @@ void TimelineDock::insert(int trackIndex, int position, const QString &xml, bool addVideoTrack(); } MAIN.undoStack()->push( - new Timeline::InsertCommand(m_model, m_markersModel, trackIndex, position, xmlToUse, seek)); + new Timeline::InsertCommand(m_model, m_markersModel, trackIndex, position, xmlToUse, seek)); } if (m_position < 0) { // This happens when pasting in a new session @@ -3426,7 +3426,7 @@ void TimelineDock::overwrite(int trackIndex, int position, const QString &xml, b clip.set_in_and_out(info.frame_in, info.frame_out); bool lastClip = mltTrackIndex == tractor.count() - 1 && mltClipIndex == playlist.count() - 1; MAIN.undoStack()->push( - new Timeline::OverwriteCommand(m_model, trackIndex, position + info.start, MLT.XML(&clip), false)); + new Timeline::OverwriteCommand(m_model, trackIndex, position + info.start, MLT.XML(&clip), false)); } } } @@ -3439,7 +3439,7 @@ void TimelineDock::overwrite(int trackIndex, int position, const QString &xml, b addVideoTrack(); } MAIN.undoStack()->push( - new Timeline::OverwriteCommand(m_model, trackIndex, position, xmlToUse, seek)); + new Timeline::OverwriteCommand(m_model, trackIndex, position, xmlToUse, seek)); } if (m_position < 0) { // This happens when pasting in a new session @@ -3485,7 +3485,7 @@ void TimelineDock::appendFromPlaylist(Mlt::Playlist *playlist, bool skipProxy, b auto autoAddTracks = Settings.timelineAutoAddTracks(); Settings.setTimelineAutoAddTracks(false); MAIN.undoStack()->push( - new Timeline::AppendCommand(m_model, trackIndex, MLT.XML(playlist), skipProxy)); + new Timeline::AppendCommand(m_model, trackIndex, MLT.XML(playlist), skipProxy)); connect(&m_model, &MultitrackModel::appended, this, &TimelineDock::selectClip, Qt::QueuedConnection); Settings.setTimelineAutoAddTracks(autoAddTracks); @@ -3501,7 +3501,7 @@ void TimelineDock::fadeIn(int trackIndex, int clipIndex, int duration) if (duration < 0) return; Q_ASSERT(trackIndex >= 0 && clipIndex >= 0); MAIN.undoStack()->push( - new Timeline::FadeInCommand(m_model, trackIndex, clipIndex, duration)); + new Timeline::FadeInCommand(m_model, trackIndex, clipIndex, duration)); emit fadeInChanged(duration); } @@ -3514,7 +3514,7 @@ void TimelineDock::fadeOut(int trackIndex, int clipIndex, int duration) if (duration < 0) return; Q_ASSERT(trackIndex >= 0 && clipIndex >= 0); MAIN.undoStack()->push( - new Timeline::FadeOutCommand(m_model, trackIndex, clipIndex, duration)); + new Timeline::FadeOutCommand(m_model, trackIndex, clipIndex, duration)); emit fadeOutChanged(duration); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 87bc3bcd3d..f4bf5756da 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -742,7 +742,8 @@ void MainWindow::setupMenuFile() filters << match.captured(1) + "*.mlt"; else filters << QFileInfo(m_currentFile).baseName().split(" - ").first() + "*.mlt"; - for (auto &fileInfo : dir.entryInfoList(filters, QDir::Files, QDir::Time)) { + for (auto &fileInfo : dir.entryInfoList(filters, QDir::Files, QDir::Time)) + { auto filename = fileInfo.fileName(); if (filename != name) { auto text = filename; @@ -2384,7 +2385,7 @@ QAction *MainWindow::actionProfileRemove() const return ui->actionProfileRemove; } -void MainWindow::buildVideoModeMenu(QMenu *topMenu, QMenu * &customMenu, QActionGroup *group, +void MainWindow::buildVideoModeMenu(QMenu *topMenu, QMenu *&customMenu, QActionGroup *group, QAction *addAction, QAction *removeAction) { topMenu->addAction(addProfile(group, "HD 720p 50 fps", "atsc_720p_50")); @@ -5005,7 +5006,7 @@ void MainWindow::replaceAllByHash(const QString &hash, Mlt::Producer &producer, // Append to playlist producer.set(kPlaylistIndexProperty, playlist()->count()); MAIN.undoStack()->push( - new Playlist::AppendCommand(*m_playlistDock->model(), MLT.XML(&producer))); + new Playlist::AppendCommand(*m_playlistDock->model(), MLT.XML(&producer))); } } if (isMultitrackValid()) { diff --git a/src/mainwindow.h b/src/mainwindow.h index bd3c674ce1..55a0edc5c2 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -116,7 +116,7 @@ class MainWindow : public QMainWindow { return m_profileGroup; } - void buildVideoModeMenu(QMenu *topMenu, QMenu * &customMenu, QActionGroup *group, + void buildVideoModeMenu(QMenu *topMenu, QMenu *&customMenu, QActionGroup *group, QAction *addAction, QAction *removeAction); void newProject(const QString &filename, bool isProjectFolder = false); diff --git a/src/videowidget.cpp b/src/videowidget.cpp index 437b0622c8..d675064286 100644 --- a/src/videowidget.cpp +++ b/src/videowidget.cpp @@ -550,7 +550,7 @@ RenderThread::RenderThread(thread_function_t function, void *data) , m_function{function} , m_data{data} , m_context{new QOpenGLContext} - , m_surface{new QOffscreenSurface} +, m_surface{new QOffscreenSurface} { QSurfaceFormat format; format.setProfile(QSurfaceFormat::CoreProfile);